UNPKG

ccmultihelper

Version:

Claude Code Multi-Worktree Helper - Single-session parallel worktree automation with MCP server

26 lines 722 kB
#!/usr/bin/env node import{createRequire as PU}from"node:module";var VU=Object.create;var{getPrototypeOf:BU,defineProperty:gF,getOwnPropertyNames:EU}=Object;var TU=Object.prototype.hasOwnProperty;var x=(D,F,Z)=>{Z=D!=null?VU(BU(D)):{};let J=F||!D||!D.__esModule?gF(Z,"default",{value:D,enumerable:!0}):Z;for(let X of EU(D))if(!TU.call(J,X))gF(J,X,{get:()=>D[X],enumerable:!0});return J};var $=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var R=PU(import.meta.url);var g8=$((UU)=>{class c5 extends Error{constructor(D,F,Z){super(Z);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=F,this.exitCode=D,this.nestedError=void 0}}class hF extends c5{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}UU.CommanderError=c5;UU.InvalidArgumentError=hF});var l4=$((NU)=>{var{InvalidArgumentError:IU}=g8();class fF{constructor(D,F){switch(this.description=F||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.concat(D)}default(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,Z)=>{if(!this.argChoices.includes(F))throw new IU(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,Z);return F},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function AU(D){let F=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+F+">":"["+F+"]"}NU.Argument=fF;NU.humanReadableArgName=AU});var n5=$((wU)=>{var{humanReadableArgName:OU}=l4();class mF{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(D){let F=D.commands.filter((J)=>!J._hidden),Z=D._getHelpCommand();if(Z&&!Z._hidden)F.push(Z);if(this.sortSubcommands)F.sort((J,X)=>{return J.name().localeCompare(X.name())});return F}compareOptions(D,F){let Z=(J)=>{return J.short?J.short.replace(/^-/,""):J.long.replace(/^--/,"")};return Z(D).localeCompare(Z(F))}visibleOptions(D){let F=D.options.filter((J)=>!J.hidden),Z=D._getHelpOption();if(Z&&!Z.hidden){let J=Z.short&&D._findOption(Z.short),X=Z.long&&D._findOption(Z.long);if(!J&&!X)F.push(Z);else if(Z.long&&!X)F.push(D.createOption(Z.long,Z.description));else if(Z.short&&!J)F.push(D.createOption(Z.short,Z.description))}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let F=[];for(let Z=D.parent;Z;Z=Z.parent){let J=Z.options.filter((X)=>!X.hidden);F.push(...J)}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((F)=>{F.description=F.description||D._argsDescription[F.name()]||""});if(D.registeredArguments.find((F)=>F.description))return D.registeredArguments;return[]}subcommandTerm(D){let F=D.registeredArguments.map((Z)=>OU(Z)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(F?" "+F:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,F){return F.visibleCommands(D).reduce((Z,J)=>{return Math.max(Z,F.subcommandTerm(J).length)},0)}longestOptionTermLength(D,F){return F.visibleOptions(D).reduce((Z,J)=>{return Math.max(Z,F.optionTerm(J).length)},0)}longestGlobalOptionTermLength(D,F){return F.visibleGlobalOptions(D).reduce((Z,J)=>{return Math.max(Z,F.optionTerm(J).length)},0)}longestArgumentTermLength(D,F){return F.visibleArguments(D).reduce((Z,J)=>{return Math.max(Z,F.argumentTerm(J).length)},0)}commandUsage(D){let F=D._name;if(D._aliases[0])F=F+"|"+D._aliases[0];let Z="";for(let J=D.parent;J;J=J.parent)Z=J.name()+" "+Z;return Z+F+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((Z)=>JSON.stringify(Z)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)F.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)F.push(`env: ${D.envVar}`);if(F.length>0)return`${D.description} (${F.join(", ")})`;return D.description}argumentDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((Z)=>JSON.stringify(Z)).join(", ")}`);if(D.defaultValue!==void 0)F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(F.length>0){let Z=`(${F.join(", ")})`;if(D.description)return`${D.description} ${Z}`;return Z}return D.description}formatHelp(D,F){let Z=F.padWidth(D,F),J=F.helpWidth||80,X=2,Y=2;function Q(B,E){if(E){let T=`${B.padEnd(Z+2)}${E}`;return F.wrap(T,J-2,Z+2)}return B}function H(B){return B.join(` `).replace(/^/gm," ".repeat(2))}let K=[`Usage: ${F.commandUsage(D)}`,""],q=F.commandDescription(D);if(q.length>0)K=K.concat([F.wrap(q,J,0),""]);let W=F.visibleArguments(D).map((B)=>{return Q(F.argumentTerm(B),F.argumentDescription(B))});if(W.length>0)K=K.concat(["Arguments:",H(W),""]);let z=F.visibleOptions(D).map((B)=>{return Q(F.optionTerm(B),F.optionDescription(B))});if(z.length>0)K=K.concat(["Options:",H(z),""]);if(this.showGlobalOptions){let B=F.visibleGlobalOptions(D).map((E)=>{return Q(F.optionTerm(E),F.optionDescription(E))});if(B.length>0)K=K.concat(["Global Options:",H(B),""])}let V=F.visibleCommands(D).map((B)=>{return Q(F.subcommandTerm(B),F.subcommandDescription(B))});if(V.length>0)K=K.concat(["Commands:",H(V),""]);return K.join(` `)}padWidth(D,F){return Math.max(F.longestOptionTermLength(D,F),F.longestGlobalOptionTermLength(D,F),F.longestSubcommandTermLength(D,F),F.longestArgumentTermLength(D,F))}wrap(D,F,Z,J=40){let Y=new RegExp(`[\\n][${" \\f\\t\\v   -    \uFEFF"}]+`);if(D.match(Y))return D;let Q=F-Z;if(Q<J)return D;let H=D.slice(0,Z),K=D.slice(Z).replace(`\r `,` `),q=" ".repeat(Z),z=`\\s${"​"}`,V=new RegExp(` |.{1,${Q-1}}([${z}]|$)|[^${z}]+?([${z}]|$)`,"g"),B=K.match(V)||[];return H+B.map((E,T)=>{if(E===` `)return"";return(T>0?q:"")+E.trimEnd()}).join(` `)}}wU.Help=mF});var a5=$((yU)=>{var{InvalidArgumentError:kU}=g8();class uF{constructor(D,F){this.flags=D,this.description=F||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let Z=xU(D);if(this.short=Z.shortFlag,this.long=Z.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(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let F=D;if(typeof D==="string")F={[D]:!0};return this.implied=Object.assign(this.implied||{},F),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_concatValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.concat(D)}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,Z)=>{if(!this.argChoices.includes(F))throw new kU(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,Z);return F},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return SU(this.name().replace(/^no-/,""))}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class bF{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((F)=>{if(F.negate)this.negativeOptions.set(F.attributeName(),F);else this.positiveOptions.set(F.attributeName(),F)}),this.negativeOptions.forEach((F,Z)=>{if(this.positiveOptions.has(Z))this.dualOptions.add(Z)})}valueFromOption(D,F){let Z=F.attributeName();if(!this.dualOptions.has(Z))return!0;let J=this.negativeOptions.get(Z).presetArg,X=J!==void 0?J:!1;return F.negate===(X===D)}}function SU(D){return D.split("-").reduce((F,Z)=>{return F+Z[0].toUpperCase()+Z.slice(1)})}function xU(D){let F,Z,J=D.split(/[ |,]+/);if(J.length>1&&!/^[[<]/.test(J[1]))F=J.shift();if(Z=J.shift(),!F&&/^-[^-]$/.test(Z))F=Z,Z=void 0;return{shortFlag:F,longFlag:Z}}yU.Option=uF;yU.DualOptions=bF});var dF=$((fU)=>{function gU(D,F){if(Math.abs(D.length-F.length)>3)return Math.max(D.length,F.length);let Z=[];for(let J=0;J<=D.length;J++)Z[J]=[J];for(let J=0;J<=F.length;J++)Z[0][J]=J;for(let J=1;J<=F.length;J++)for(let X=1;X<=D.length;X++){let Y=1;if(D[X-1]===F[J-1])Y=0;else Y=1;if(Z[X][J]=Math.min(Z[X-1][J]+1,Z[X][J-1]+1,Z[X-1][J-1]+Y),X>1&&J>1&&D[X-1]===F[J-2]&&D[X-2]===F[J-1])Z[X][J]=Math.min(Z[X][J],Z[X-2][J-2]+1)}return Z[D.length][F.length]}function hU(D,F){if(!F||F.length===0)return"";F=Array.from(new Set(F));let Z=D.startsWith("--");if(Z)D=D.slice(2),F=F.map((Q)=>Q.slice(2));let J=[],X=3,Y=0.4;if(F.forEach((Q)=>{if(Q.length<=1)return;let H=gU(D,Q),K=Math.max(D.length,Q.length);if((K-H)/K>Y){if(H<X)X=H,J=[Q];else if(H===X)J.push(Q)}}),J.sort((Q,H)=>Q.localeCompare(H)),Z)J=J.map((Q)=>`--${Q}`);if(J.length>1)return` (Did you mean one of ${J.join(", ")}?)`;if(J.length===1)return` (Did you mean ${J[0]}?)`;return""}fU.suggestSimilar=hU});var nF=$((cU)=>{var uU=R("node:events").EventEmitter,i5=R("node:child_process"),T1=R("node:path"),o5=R("node:fs"),J0=R("node:process"),{Argument:bU,humanReadableArgName:dU}=l4(),{CommanderError:s5}=g8(),{Help:lU}=n5(),{Option:lF,DualOptions:pU}=a5(),{suggestSimilar:pF}=dF();class t5 extends uU{constructor(D){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=D||"",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:(F)=>J0.stdout.write(F),writeErr:(F)=>J0.stderr.write(F),getOutHelpWidth:()=>J0.stdout.isTTY?J0.stdout.columns:void 0,getErrHelpWidth:()=>J0.stderr.isTTY?J0.stderr.columns:void 0,outputError:(F,Z)=>Z(F)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let F=this;F;F=F.parent)D.push(F);return D}command(D,F,Z){let J=F,X=Z;if(typeof J==="object"&&J!==null)X=J,J=null;X=X||{};let[,Y,Q]=D.match(/([^ ]+) *(.*)/),H=this.createCommand(Y);if(J)H.description(J),H._executableHandler=!0;if(X.isDefault)this._defaultCommandName=H._name;if(H._hidden=!!(X.noHelp||X.hidden),H._executableFile=X.executableFile||null,Q)H.arguments(Q);if(this._registerCommand(H),H.parent=this,H.copyInheritedSettings(this),J)return this;return H}createCommand(D){return new t5(D)}createHelp(){return Object.assign(new lU,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,D),this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,F){if(!D._name)throw Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);if(F=F||{},F.isDefault)this._defaultCommandName=D._name;if(F.noHelp||F.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,F){return new bU(D,F)}argument(D,F,Z,J){let X=this.createArgument(D,F);if(typeof Z==="function")X.default(J).argParser(Z);else X.default(Z);return this.addArgument(X),this}arguments(D){return D.trim().split(/ +/).forEach((F)=>{this.argument(F)}),this}addArgument(D){let F=this.registeredArguments.slice(-1)[0];if(F&&F.variadic)throw Error(`only the last argument can be variadic '${F.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,F){if(typeof D==="boolean")return this._addImplicitHelpCommand=D,this;D=D??"help [command]";let[,Z,J]=D.match(/([^ ]+) *(.*)/),X=F??"display help for command",Y=this.createCommand(Z);if(Y.helpOption(!1),J)Y.arguments(J);if(X)Y.description(X);return this._addImplicitHelpCommand=!0,this._helpCommand=Y,this}addHelpCommand(D,F){if(typeof D!=="object")return this.helpCommand(D,F),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,F){let Z=["preSubcommand","preAction","postAction"];if(!Z.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'. Expecting one of '${Z.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(F);else this._lifeCycleHooks[D]=[F];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(F)=>{if(F.code!=="commander.executeSubCommandAsync")throw F};return this}_exit(D,F,Z){if(this._exitCallback)this._exitCallback(new s5(D,F,Z));J0.exit(D)}action(D){let F=(Z)=>{let J=this.registeredArguments.length,X=Z.slice(0,J);if(this._storeOptionsAsProperties)X[J]=this;else X[J]=this.opts();return X.push(this),D.apply(this,X)};return this._actionHandler=F,this}createOption(D,F){return new lF(D,F)}_callParseArg(D,F,Z,J){try{return D.parseArg(F,Z)}catch(X){if(X.code==="commander.invalidArgument"){let Y=`${J} ${X.message}`;this.error(Y,{exitCode:X.exitCode,code:X.code})}throw X}}_registerOption(D){let F=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(F){let Z=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${Z}' - already used by option '${F.flags}'`)}this.options.push(D)}_registerCommand(D){let F=(J)=>{return[J.name()].concat(J.aliases())},Z=F(D).find((J)=>this._findCommand(J));if(Z){let J=F(this._findCommand(Z)).join("|"),X=F(D).join("|");throw Error(`cannot add command '${X}' as already have command '${J}'`)}this.commands.push(D)}addOption(D){this._registerOption(D);let F=D.name(),Z=D.attributeName();if(D.negate){let X=D.long.replace(/^--no-/,"--");if(!this._findOption(X))this.setOptionValueWithSource(Z,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(Z,D.defaultValue,"default");let J=(X,Y,Q)=>{if(X==null&&D.presetArg!==void 0)X=D.presetArg;let H=this.getOptionValue(Z);if(X!==null&&D.parseArg)X=this._callParseArg(D,X,H,Y);else if(X!==null&&D.variadic)X=D._concatValue(X,H);if(X==null)if(D.negate)X=!1;else if(D.isBoolean()||D.optional)X=!0;else X="";this.setOptionValueWithSource(Z,X,Q)};if(this.on("option:"+F,(X)=>{let Y=`error: option '${D.flags}' argument '${X}' is invalid.`;J(X,Y,"cli")}),D.envVar)this.on("optionEnv:"+F,(X)=>{let Y=`error: option '${D.flags}' value '${X}' from env '${D.envVar}' is invalid.`;J(X,Y,"env")});return this}_optionEx(D,F,Z,J,X){if(typeof F==="object"&&F instanceof lF)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Y=this.createOption(F,Z);if(Y.makeOptionMandatory(!!D.mandatory),typeof J==="function")Y.default(X).argParser(J);else if(J instanceof RegExp){let Q=J;J=(H,K)=>{let q=Q.exec(H);return q?q[0]:K},Y.default(X).argParser(J)}else Y.default(J);return this.addOption(Y)}option(D,F,Z,J){return this._optionEx({},D,F,Z,J)}requiredOption(D,F,Z,J){return this._optionEx({mandatory:!0},D,F,Z,J)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,F){return this.setOptionValueWithSource(D,F,void 0)}setOptionValueWithSource(D,F,Z){if(this._storeOptionsAsProperties)this[D]=F;else this._optionValues[D]=F;return this._optionValueSources[D]=Z,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let F;return this._getCommandAndAncestors().forEach((Z)=>{if(Z.getOptionValueSource(D)!==void 0)F=Z.getOptionValueSource(D)}),F}_prepareUserArgs(D,F){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(F=F||{},D===void 0&&F.from===void 0){if(J0.versions?.electron)F.from="electron";let J=J0.execArgv??[];if(J.includes("-e")||J.includes("--eval")||J.includes("-p")||J.includes("--print"))F.from="eval"}if(D===void 0)D=J0.argv;this.rawArgs=D.slice();let Z;switch(F.from){case void 0:case"node":this._scriptPath=D[1],Z=D.slice(2);break;case"electron":if(J0.defaultApp)this._scriptPath=D[1],Z=D.slice(2);else Z=D.slice(1);break;case"user":Z=D.slice(0);break;case"eval":Z=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${F.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",Z}parse(D,F){let Z=this._prepareUserArgs(D,F);return this._parseCommand([],Z),this}async parseAsync(D,F){let Z=this._prepareUserArgs(D,F);return await this._parseCommand([],Z),this}_executeSubCommand(D,F){F=F.slice();let Z=!1,J=[".js",".ts",".tsx",".mjs",".cjs"];function X(q,W){let z=T1.resolve(q,W);if(o5.existsSync(z))return z;if(J.includes(T1.extname(W)))return;let V=J.find((B)=>o5.existsSync(`${z}${B}`));if(V)return`${z}${V}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=D._executableFile||`${this._name}-${D._name}`,Q=this._executableDir||"";if(this._scriptPath){let q;try{q=o5.realpathSync(this._scriptPath)}catch(W){q=this._scriptPath}Q=T1.resolve(T1.dirname(q),Q)}if(Q){let q=X(Q,Y);if(!q&&!D._executableFile&&this._scriptPath){let W=T1.basename(this._scriptPath,T1.extname(this._scriptPath));if(W!==this._name)q=X(Q,`${W}-${D._name}`)}Y=q||Y}Z=J.includes(T1.extname(Y));let H;if(J0.platform!=="win32")if(Z)F.unshift(Y),F=cF(J0.execArgv).concat(F),H=i5.spawn(J0.argv[0],F,{stdio:"inherit"});else H=i5.spawn(Y,F,{stdio:"inherit"});else F.unshift(Y),F=cF(J0.execArgv).concat(F),H=i5.spawn(J0.execPath,F,{stdio:"inherit"});if(!H.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{J0.on(W,()=>{if(H.killed===!1&&H.exitCode===null)H.kill(W)})});let K=this._exitCallback;H.on("close",(q)=>{if(q=q??1,!K)J0.exit(q);else K(new s5(q,"commander.executeSubCommandAsync","(close)"))}),H.on("error",(q)=>{if(q.code==="ENOENT"){let W=Q?`searched for local subcommand relative to directory '${Q}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",z=`'${Y}' does not exist - if '${D._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${W}`;throw Error(z)}else if(q.code==="EACCES")throw Error(`'${Y}' not executable`);if(!K)J0.exit(1);else{let W=new s5(1,"commander.executeSubCommandAsync","(error)");W.nestedError=q,K(W)}}),this.runningCommand=H}_dispatchSubcommand(D,F,Z){let J=this._findCommand(D);if(!J)this.help({error:!0});let X;return X=this._chainOrCallSubCommandHook(X,J,"preSubcommand"),X=this._chainOrCall(X,()=>{if(J._executableHandler)this._executeSubCommand(J,F.concat(Z));else return J._parseCommand(F,Z)}),X}_dispatchHelpCommand(D){if(!D)this.help();let F=this._findCommand(D);if(F&&!F._executableHandler)F.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,F)=>{if(D.required&&this.args[F]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(Z,J,X)=>{let Y=J;if(J!==null&&Z.parseArg){let Q=`error: command-argument value '${J}' is invalid for argument '${Z.name()}'.`;Y=this._callParseArg(Z,J,X,Q)}return Y};this._checkNumberOfArguments();let F=[];this.registeredArguments.forEach((Z,J)=>{let X=Z.defaultValue;if(Z.variadic){if(J<this.args.length){if(X=this.args.slice(J),Z.parseArg)X=X.reduce((Y,Q)=>{return D(Z,Q,Y)},Z.defaultValue)}else if(X===void 0)X=[]}else if(J<this.args.length){if(X=this.args[J],Z.parseArg)X=D(Z,X,Z.defaultValue)}F[J]=X}),this.processedArgs=F}_chainOrCall(D,F){if(D&&D.then&&typeof D.then==="function")return D.then(()=>F());return F()}_chainOrCallHooks(D,F){let Z=D,J=[];if(this._getCommandAndAncestors().reverse().filter((X)=>X._lifeCycleHooks[F]!==void 0).forEach((X)=>{X._lifeCycleHooks[F].forEach((Y)=>{J.push({hookedCommand:X,callback:Y})})}),F==="postAction")J.reverse();return J.forEach((X)=>{Z=this._chainOrCall(Z,()=>{return X.callback(X.hookedCommand,this)})}),Z}_chainOrCallSubCommandHook(D,F,Z){let J=D;if(this._lifeCycleHooks[Z]!==void 0)this._lifeCycleHooks[Z].forEach((X)=>{J=this._chainOrCall(J,()=>{return X(this,F)})});return J}_parseCommand(D,F){let Z=this.parseOptions(F);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(Z.operands),F=Z.unknown,this.args=D.concat(F),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),F);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(F),this._dispatchSubcommand(this._defaultCommandName,D,F);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(Z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=()=>{if(Z.unknown.length>0)this.unknownOption(Z.unknown[0])},X=`command:${this.name()}`;if(this._actionHandler){J(),this._processArguments();let Y;if(Y=this._chainOrCallHooks(Y,"preAction"),Y=this._chainOrCall(Y,()=>this._actionHandler(this.processedArgs)),this.parent)Y=this._chainOrCall(Y,()=>{this.parent.emit(X,D,F)});return Y=this._chainOrCallHooks(Y,"postAction"),Y}if(this.parent&&this.parent.listenerCount(X))J(),this._processArguments(),this.parent.emit(X,D,F);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,F);if(this.listenerCount("command:*"))this.emit("command:*",D,F);else if(this.commands.length)this.unknownCommand();else J(),this._processArguments()}else if(this.commands.length)J(),this.help({error:!0});else J(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((F)=>F._name===D||F._aliases.includes(D))}_findOption(D){return this.options.find((F)=>F.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((F)=>{if(F.mandatory&&D.getOptionValue(F.attributeName())===void 0)D.missingMandatoryOptionValue(F)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((Z)=>{let J=Z.attributeName();if(this.getOptionValue(J)===void 0)return!1;return this.getOptionValueSource(J)!=="default"});D.filter((Z)=>Z.conflictsWith.length>0).forEach((Z)=>{let J=D.find((X)=>Z.conflictsWith.includes(X.attributeName()));if(J)this._conflictingOption(Z,J)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let F=[],Z=[],J=F,X=D.slice();function Y(H){return H.length>1&&H[0]==="-"}let Q=null;while(X.length){let H=X.shift();if(H==="--"){if(J===Z)J.push(H);J.push(...X);break}if(Q&&!Y(H)){this.emit(`option:${Q.name()}`,H);continue}if(Q=null,Y(H)){let K=this._findOption(H);if(K){if(K.required){let q=X.shift();if(q===void 0)this.optionMissingArgument(K);this.emit(`option:${K.name()}`,q)}else if(K.optional){let q=null;if(X.length>0&&!Y(X[0]))q=X.shift();this.emit(`option:${K.name()}`,q)}else this.emit(`option:${K.name()}`);Q=K.variadic?K:null;continue}}if(H.length>2&&H[0]==="-"&&H[1]!=="-"){let K=this._findOption(`-${H[1]}`);if(K){if(K.required||K.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${K.name()}`,H.slice(2));else this.emit(`option:${K.name()}`),X.unshift(`-${H.slice(2)}`);continue}}if(/^--[^=]+=/.test(H)){let K=H.indexOf("="),q=this._findOption(H.slice(0,K));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,H.slice(K+1));continue}}if(Y(H))J=Z;if((this._enablePositionalOptions||this._passThroughOptions)&&F.length===0&&Z.length===0){if(this._findCommand(H)){if(F.push(H),X.length>0)Z.push(...X);break}else if(this._getHelpCommand()&&H===this._getHelpCommand().name()){if(F.push(H),X.length>0)F.push(...X);break}else if(this._defaultCommandName){if(Z.push(H),X.length>0)Z.push(...X);break}}if(this._passThroughOptions){if(J.push(H),X.length>0)J.push(...X);break}J.push(H)}return{operands:F,unknown:Z}}opts(){if(this._storeOptionsAsProperties){let D={},F=this.options.length;for(let Z=0;Z<F;Z++){let J=this.options[Z].attributeName();D[J]=J===this._versionOptionName?this._version:this[J]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,F)=>Object.assign(D,F.opts()),{})}error(D,F){if(this._outputConfiguration.outputError(`${D} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError} `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0});let Z=F||{},J=Z.exitCode||1,X=Z.code||"commander.error";this._exit(J,X,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in J0.env){let F=D.attributeName();if(this.getOptionValue(F)===void 0||["default","config","env"].includes(this.getOptionValueSource(F)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,J0.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new pU(this.options),F=(Z)=>{return this.getOptionValue(Z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(Z))};this.options.filter((Z)=>Z.implied!==void 0&&F(Z.attributeName())&&D.valueFromOption(this.getOptionValue(Z.attributeName()),Z)).forEach((Z)=>{Object.keys(Z.implied).filter((J)=>!F(J)).forEach((J)=>{this.setOptionValueWithSource(J,Z.implied[J],"implied")})})}missingArgument(D){let F=`error: missing required argument '${D}'`;this.error(F,{code:"commander.missingArgument"})}optionMissingArgument(D){let F=`error: option '${D.flags}' argument missing`;this.error(F,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let F=`error: required option '${D.flags}' not specified`;this.error(F,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,F){let Z=(Y)=>{let Q=Y.attributeName(),H=this.getOptionValue(Q),K=this.options.find((W)=>W.negate&&Q===W.attributeName()),q=this.options.find((W)=>!W.negate&&Q===W.attributeName());if(K&&(K.presetArg===void 0&&H===!1||K.presetArg!==void 0&&H===K.presetArg))return K;return q||Y},J=(Y)=>{let Q=Z(Y),H=Q.attributeName();if(this.getOptionValueSource(H)==="env")return`environment variable '${Q.envVar}'`;return`option '${Q.flags}'`},X=`error: ${J(D)} cannot be used with ${J(F)}`;this.error(X,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let J=[],X=this;do{let Y=X.createHelp().visibleOptions(X).filter((Q)=>Q.long).map((Q)=>Q.long);J=J.concat(Y),X=X.parent}while(X&&!X._enablePositionalOptions);F=pF(D,J)}let Z=`error: unknown option '${D}'${F}`;this.error(Z,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let F=this.registeredArguments.length,Z=F===1?"":"s",X=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${F} argument${Z} but got ${D.length}.`;this.error(X,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],F="";if(this._showSuggestionAfterError){let J=[];this.createHelp().visibleCommands(this).forEach((X)=>{if(J.push(X.name()),X.alias())J.push(X.alias())}),F=pF(D,J)}let Z=`error: unknown command '${D}'${F}`;this.error(Z,{code:"commander.unknownCommand"})}version(D,F,Z){if(D===void 0)return this._version;this._version=D,F=F||"-V, --version",Z=Z||"output the version number";let J=this.createOption(F,Z);return this._versionOptionName=J.attributeName(),this._registerOption(J),this.on("option:"+J.name(),()=>{this._outputConfiguration.writeOut(`${D} `),this._exit(0,"commander.version",D)}),this}description(D,F){if(D===void 0&&F===void 0)return this._description;if(this._description=D,F)this._argsDescription=F;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let F=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)F=this.commands[this.commands.length-1];if(D===F._name)throw Error("Command alias can't be the same as its name");let Z=this.parent?._findCommand(D);if(Z){let J=[Z.name()].concat(Z.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${J}'`)}return F._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((F)=>this.alias(F)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let F=this.registeredArguments.map((Z)=>{return dU(Z)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?F:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}nameFromFilename(D){return this._name=T1.basename(D,T1.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let F=this.createHelp();if(F.helpWidth===void 0)F.helpWidth=D&&D.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return F.formatHelp(this,F)}_getHelpContext(D){D=D||{};let F={error:!!D.error},Z;if(F.error)Z=(J)=>this._outputConfiguration.writeErr(J);else Z=(J)=>this._outputConfiguration.writeOut(J);return F.write=D.write||Z,F.command=this,F}outputHelp(D){let F;if(typeof D==="function")F=D,D=void 0;let Z=this._getHelpContext(D);this._getCommandAndAncestors().reverse().forEach((X)=>X.emit("beforeAllHelp",Z)),this.emit("beforeHelp",Z);let J=this.helpInformation(Z);if(F){if(J=F(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(Z.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Z),this._getCommandAndAncestors().forEach((X)=>X.emit("afterAllHelp",Z))}helpOption(D,F){if(typeof D==="boolean"){if(D)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return D=D??"-h, --help",F=F??"display help for command",this._helpOption=this.createOption(D,F),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this}help(D){this.outputHelp(D);let F=J0.exitCode||0;if(F===0&&D&&typeof D!=="function"&&D.error)F=1;this._exit(F,"commander.help","(outputHelp)")}addHelpText(D,F){let Z=["beforeAll","before","after","afterAll"];if(!Z.includes(D))throw Error(`Unexpected value for position to addHelpText. Expecting one of '${Z.join("', '")}'`);let J=`${D}Help`;return this.on(J,(X)=>{let Y;if(typeof F==="function")Y=F({error:X.error,command:X.command});else Y=F;if(Y)X.write(`${Y} `)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((J)=>F.is(J)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function cF(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let Z,J="127.0.0.1",X="9229",Y;if((Y=F.match(/^(--inspect(-brk)?)$/))!==null)Z=Y[1];else if((Y=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(Z=Y[1],/^\d+$/.test(Y[3]))X=Y[3];else J=Y[3];else if((Y=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)Z=Y[1],J=Y[3],X=Y[4];if(Z&&X!=="0")return`${Z}=${J}:${parseInt(X)+1}`;return F})}cU.Command=t5});var sF=$((oU)=>{var{Argument:aF}=l4(),{Command:r5}=nF(),{CommanderError:aU,InvalidArgumentError:iF}=g8(),{Help:iU}=n5(),{Option:oF}=a5();oU.program=new r5;oU.createCommand=(D)=>new r5(D);oU.createOption=(D,F)=>new oF(D,F);oU.createArgument=(D,F)=>new aF(D,F);oU.Command=r5;oU.Option=oF;oU.Argument=aF;oU.Help=iU;oU.CommanderError=aU;oU.InvalidArgumentError=iF;oU.InvalidOptionArgumentError=iF});var u8=$((IM,J3)=>{var g=IM;IM.default=g;var b="\x1B[",m8="\x1B]",SD="\x07",n4=";",$Z=process.env.TERM_PROGRAM==="Apple_Terminal";g.cursorTo=(D,F)=>{if(typeof D!=="number")throw TypeError("The `x` argument is required");if(typeof F!=="number")return b+(D+1)+"G";return b+(F+1)+";"+(D+1)+"H"};g.cursorMove=(D,F)=>{if(typeof D!=="number")throw TypeError("The `x` argument is required");let Z="";if(D<0)Z+=b+-D+"D";else if(D>0)Z+=b+D+"C";if(F<0)Z+=b+-F+"A";else if(F>0)Z+=b+F+"B";return Z};g.cursorUp=(D=1)=>b+D+"A";g.cursorDown=(D=1)=>b+D+"B";g.cursorForward=(D=1)=>b+D+"C";g.cursorBackward=(D=1)=>b+D+"D";g.cursorLeft=b+"G";g.cursorSavePosition=$Z?"\x1B7":b+"s";g.cursorRestorePosition=$Z?"\x1B8":b+"u";g.cursorGetPosition=b+"6n";g.cursorNextLine=b+"E";g.cursorPrevLine=b+"F";g.cursorHide=b+"?25l";g.cursorShow=b+"?25h";g.eraseLines=(D)=>{let F="";for(let Z=0;Z<D;Z++)F+=g.eraseLine+(Z<D-1?g.cursorUp():"");if(D)F+=g.cursorLeft;return F};g.eraseEndLine=b+"K";g.eraseStartLine=b+"1K";g.eraseLine=b+"2K";g.eraseDown=b+"J";g.eraseUp=b+"1J";g.eraseScreen=b+"2J";g.scrollUp=b+"S";g.scrollDown=b+"T";g.clearScreen="\x1Bc";g.clearTerminal=process.platform==="win32"?`${g.eraseScreen}${b}0f`:`${g.eraseScreen}${b}3J${b}H`;g.beep=SD;g.link=(D,F)=>{return[m8,"8",n4,n4,F,SD,D,m8,"8",n4,n4,SD].join("")};g.image=(D,F={})=>{let Z=`${m8}1337;File=inline=1`;if(F.width)Z+=`;width=${F.width}`;if(F.height)Z+=`;height=${F.height}`;if(F.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+D.toString("base64")+SD};g.iTerm={setCwd:(D=process.cwd())=>`${m8}50;CurrentDir=${D}${SD}`,annotation:(D,F={})=>{let Z=`${m8}1337;`,J=typeof F.x<"u",X=typeof F.y<"u";if((J||X)&&!(J&&X&&typeof F.length<"u"))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(D=D.replace(/\|/g,""),Z+=F.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",F.length>0)Z+=(J?[D,F.length,F.x,F.y]:[F.length,D]).join("|");else Z+=D;return Z+SD}}});var m0=$((En,GZ)=>{var NM=R("node:tty"),RM=NM?.WriteStream?.prototype?.hasColors?.()??!1,y=(D,F)=>{if(!RM)return(X)=>X;let Z=`\x1B[${D}m`,J=`\x1B[${F}m`;return(X)=>{let Y=X+"",Q=Y.indexOf(J);if(Q===-1)return Z+Y+J;let H=Z,K=0,W=(F===22?J:"")+Z;while(Q!==-1)H+=Y.slice(K,Q)+W,K=Q+J.length,Q=Y.indexOf(J,K);return H+=Y.slice(K)+J,H}},k={};k.reset=y(0,0);k.bold=y(1,22);k.dim=y(2,22);k.italic=y(3,23);k.underline=y(4,24);k.overline=y(53,55);k.inverse=y(7,27);k.hidden=y(8,28);k.strikethrough=y(9,29);k.black=y(30,39);k.red=y(31,39);k.green=y(32,39);k.yellow=y(33,39);k.blue=y(34,39);k.magenta=y(35,39);k.cyan=y(36,39);k.white=y(37,39);k.gray=y(90,39);k.bgBlack=y(40,49);k.bgRed=y(41,49);k.bgGreen=y(42,49);k.bgYellow=y(43,49);k.bgBlue=y(44,49);k.bgMagenta=y(45,49);k.bgCyan=y(46,49);k.bgWhite=y(47,49);k.bgGray=y(100,49);k.redBright=y(91,39);k.greenBright=y(92,39);k.yellowBright=y(93,39);k.blueBright=y(94,39);k.magentaBright=y(95,39);k.cyanBright=y(96,39);k.whiteBright=y(97,39);k.bgRedBright=y(101,49);k.bgGreenBright=y(102,49);k.bgYellowBright=y(103,49);k.bgBlueBright=y(104,49);k.bgMagentaBright=y(105,49);k.bgCyanBright=y(106,49);k.bgWhiteBright=y(107,49);GZ.exports=k});var b8=$((Mn,EZ)=>{function VZ(D){return!!D&&(typeof D==="object"||typeof D==="function")&&typeof D.then==="function"}var BZ=EZ.exports=function(D,F,Z="async"){if(typeof F==="string")Z=F,F=void 0;return F=F||function(){},function(){var J=arguments,X=this,Y=new Promise(function(Q,H){var K=!1;let q=function(N){if(K)console.warn("Run-async promise already resolved.");K=!0,Q(N)};var W=!1;let z=function(N){if(W)console.warn("Run-async promise already rejected.");W=!0,H(N)};var V=!1,B=!1,E=!1,T=function(){if(E)return console.warn("Run-async async() called outside a valid run-async context, callback will be ignored."),function(){};if(B)console.warn(`Run-async wrapped function (async) returned a promise. Calls to async() callback can have unexpected results.`);return V=!0,function(N,v){if(N)z(N);else q(v)}},P;if(X&&Z&&Proxy)P=new Proxy(X,{get(N,v){if(v===Z){if(v in N)console.warn(`${Z} property is been shadowed by run-sync`);return T}return Reflect.get(...arguments)}});else P={[Z]:T};var U=D.apply(P,Array.prototype.slice.call(J));if(V){if(VZ(U))console.warn("Run-async wrapped function (sync) returned a promise but async() callback must be executed to resolve.")}else if(VZ(U))B=!0,U.then(q,z);else q(U);E=!0});return Y.then(F.bind(null,null),F),Y}};BZ.cb=function(D,F){return BZ(function(){var Z=Array.prototype.slice.call(arguments);if(Z.length===D.length-1)Z.push(this.async());return D.apply(this,Z)},F)}});var d=$((TZ)=>{Object.defineProperty(TZ,"__esModule",{value:!0});TZ.isFunction=void 0;function xM(D){return typeof D==="function"}TZ.isFunction=xM});var S1=$((UZ)=>{Object.defineProperty(UZ,"__esModule",{value:!0});UZ.createErrorClass=void 0;function yM(D){var F=function(J){Error.call(J),J.stack=Error().stack},Z=D(F);return Z.prototype=Object.create(Error.prototype),Z.prototype.constructor=Z,Z}UZ.createErrorClass=yM});var X3=$((LZ)=>{Object.defineProperty(LZ,"__esModule",{value:!0});LZ.UnsubscriptionError=void 0;var vM=S1();LZ.UnsubscriptionError=vM.createErrorClass(function(D){return function(Z){D(this),this.message=Z?Z.length+` errors occurred during unsubscription: `+Z.map(function(J,X){return X+1+") "+J.toString()}).join(` `):"",this.name="UnsubscriptionError",this.errors=Z}})});var P1=$((AZ)=>{Object.defineProperty(AZ,"__esModule",{value:!0});AZ.arrRemove=void 0;function _M(D,F){if(D){var Z=D.indexOf(F);0<=Z&&D.splice(Z,1)}}AZ.arrRemove=_M});var v0=$((k0)=>{var RZ=k0&&k0.__values||function(D){var F=typeof Symbol==="function"&&Symbol.iterator,Z=F&&D[F],J=0;if(Z)return Z.call(D);if(D&&typeof D.length==="number")return{next:function(){if(D&&J>=D.length)D=void 0;return{value:D&&D[J++],done:!D}}};throw TypeError(F?"Object is not iterable.":"Symbol.iterator is not defined.")},CZ=k0&&k0.__read||function(D,F){var Z=typeof Symbol==="function"&&D[Symbol.iterator];if(!Z)return D;var J=Z.call(D),X,Y=[],Q;try{while((F===void 0||F-- >0)&&!(X=J.next()).done)Y.push(X.value)}catch(H){Q={error:H}}finally{try{if(X&&!X.done&&(Z=J.return))Z.call(J)}finally{if(Q)throw Q.error}}return Y},OZ=k0&&k0.__spreadArray||function(D,F){for(var Z=0,J=F.length,X=D.length;Z<J;Z++,X++)D[X]=F[Z];return D};Object.defineProperty(k0,"__esModule",{value:!0});k0.isSubscription=k0.EMPTY_SUBSCRIPTION=k0.Subscription=void 0;var d8=d(),Y3=X3(),wZ=P1(),Q3=function(){function D(F){this.initialTeardown=F,this.closed=!1,this._parentage=null,this._finalizers=null}return D.prototype.unsubscribe=function(){var F,Z,J,X,Y;if(!this.closed){this.closed=!0;var Q=this._parentage;if(Q)if(this._parentage=null,Array.isArray(Q))try{for(var H=RZ(Q),K=H.next();!K.done;K=H.next()){var q=K.value;q.remove(this)}}catch(T){F={error:T}}finally{try{if(K&&!K.done&&(Z=H.return))Z.call(H)}finally{if(F)throw F.error}}else Q.remove(this);var W=this.initialTeardown;if(d8.isFunction(W))try{W()}catch(T){Y=T instanceof Y3.UnsubscriptionError?T.errors:[T]}var z=this._finalizers;if(z){this._finalizers=null;try{for(var V=RZ(z),B=V.next();!B.done;B=V.next()){var E=B.value;try{jZ(E)}catch(T){if(Y=Y!==null&&Y!==void 0?Y:[],T instanceof Y3.UnsubscriptionError)Y=OZ(OZ([],CZ(Y)),CZ(T.errors));else Y.push(T)}}}catch(T){J={error:T}}finally{try{if(B&&!B.done&&(X=V.return))X.call(V)}finally{if(J)throw J.error}}}if(Y)throw new Y3.UnsubscriptionError(Y)}},D.prototype.add=function(F){var Z;if(F&&F!==this)if(this.closed)jZ(F);else{if(F instanceof D){if(F.closed||F._hasParent(this))return;F._addParent(this)}(this._finalizers=(Z=this._finalizers)!==null&&Z!==void 0?Z:[]).push(F)}},D.prototype._hasParent=function(F){var Z=this._parentage;return Z===F||Array.isArray(Z)&&Z.includes(F)},D.prototype._addParent=function(F){var Z=this._parentage;this._parentage=Array.isArray(Z)?(Z.push(F),Z):Z?[Z,F]:F},D.prototype._removeParent=function(F){var Z=this._parentage;if(Z===F)this._parentage=null;else if(Array.isArray(Z))wZ.arrRemove(Z,F)},D.prototype.remove=function(F){var Z=this._finalizers;if(Z&&wZ.arrRemove(Z,F),F instanceof D)F._removeParent(this)},D.EMPTY=function(){var F=new D;return F.closed=!0,F}(),D}();k0.Subscription=Q3;k0.EMPTY_SUBSCRIPTION=Q3.EMPTY;function gM(D){return D instanceof Q3||D&&"closed"in D&&d8.isFunction(D.remove)&&d8.isFunction(D.add)&&d8.isFunction(D.unsubscribe)}k0.isSubscription=gM;function jZ(D){if(d8.isFunction(D))D();else D.unsubscribe()}});var xD=$((kZ)=>{Object.defineProperty(kZ,"__esModule",{value:!0});kZ.config=void 0;kZ.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}});var H3=$((X1)=>{var xZ=X1&&X1.__read||function(D,F){var Z=typeof Symbol==="function"&&D[Symbol.iterator];if(!Z)return D;var J=Z.call(D),X,Y=[],Q;try{while((F===void 0||F-- >0)&&!(X=J.next()).done)Y.push(X.value)}catch(H){Q={error:H}}finally{try{if(X&&!X.done&&(Z=J.return))Z.call(J)}finally{if(Q)throw Q.error}}return Y},yZ=X1&&X1.__spreadArray||function(D,F){for(var Z=0,J=F.length,X=D.length;Z<J;Z++,X++)D[X]=F[Z];return D};Object.defineProperty(X1,"__esModule",{value:!0});X1.timeoutProvider=void 0;X1.timeoutProvider={setTimeout:function(D,F){var Z=[];for(var J=2;J<arguments.length;J++)Z[J-2]=arguments[J];var X=X1.timeoutProvider.delegate;if(X===null||X===void 0?void 0:X.setTimeout)return X.setTimeout.apply(X,yZ([D,F],xZ(Z)));return setTimeout.apply(void 0,yZ([D,F],xZ(Z)))},clearTimeout:function(D){var F=X1.timeoutProvider.delegate;return((F===null||F===void 0?void 0:F.clearTimeout)||clearTimeout)(D)},delegate:void 0}});var K3=$((vZ)=>{Object.defineProperty(vZ,"__esModule",{value:!0});vZ.reportUnhandledError=void 0;var hM=xD(),fM=H3();function mM(D){fM.timeoutProvider.setTimeout(function(){var F=hM.config.onUnhandledError;if(F)F(D);else throw D})}vZ.reportUnhandledError=mM});var B0=$((gZ)=>{Object.defineProperty(gZ,"__esModule",{value:!0});gZ.noop=void 0;function uM(){}gZ.noop=uM});var uZ=$((fZ)=>{Object.defineProperty(fZ,"__esModule",{value:!0});fZ.createNotification=fZ.nextNotification=fZ.errorNotification=fZ.COMPLETE_NOTIFICATION=void 0;fZ.COMPLETE_NOTIFICATION=function(){return a4("C",void 0,void 0)}();function bM(D){return a4("E",void 0,D)}fZ.errorNotification=bM;function dM(D){return a4("N",D,void 0)}fZ.nextNotification=dM;function a4(D,F,Z){return{kind:D,value:F,error:Z}}fZ.createNotification=a4});var i4=$((dZ)=>{Object.defineProperty(dZ,"__esModule",{value:!0});dZ.captureError=dZ.errorContext=void 0;var bZ=xD(),GD=null;function nM(D){if(bZ.config.useDeprecatedSynchronousErrorHandling){var F=!GD;if(F)GD={errorThrown:!1,error:null};if(D(),F){var Z=GD,J=Z.errorThrown,X=Z.error;if(GD=null,J)throw X}}else D()}dZ.errorContext=nM;function aM(D){if(bZ.config.useDeprecatedSynchronousErrorHandling&&GD)GD.errorThrown=!0,GD.error=D}dZ.captureError=aM});var yD=$((o0)=>{var nZ=o0&&o0.__extends||function(){var D=function(F,Z){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,X){J.__proto__=X}||function(J,X){for(var Y in X)if(Object.prototype.hasOwnProperty.call(X,Y))J[Y]=X[Y]},D(F,Z)};return function(F,Z){if(typeof Z!=="function"&&Z!==null)throw TypeError("Class extends value "+String(Z)+" is not a constructor or null");D(F,Z);function J(){this.constructor=F}F.prototype=Z===null?Object.create(Z):(J.prototype=Z.prototype,new J)}}();Object.defineProperty(o0,"__esModule",{value:!0});o0.EMPTY_OBSERVER=o0.SafeSubscriber=o0.Subscriber=void 0;var oM=d(),pZ=v0(),W3=xD(),sM=K3(),cZ=B0(),q3=uZ(),tM=H3(),rM=i4(),aZ=function(D){nZ(F,D);function F(Z){var J=D.call(this)||this;if(J.isStopped=!1,Z){if(J.destination=Z,pZ.isSubscription(Z))Z.add(J)}else J.destination=o0.EMPTY_OBSERVER;return J}return F.create=function(Z,J,X){return new iZ(Z,J,X)},F.prototype.next=function(Z){if(this.isStopped)G3(q3.nextNotification(Z),this);else this._next(Z)},F.prototype.error=function(Z){if(this.isStopped)G3(q3.errorNotification(Z),this);else this.isStopped=!0,this._error(Z)},F.prototype.complete=function(){if(this.isStopped)G3(q3.COMPLETE_NOTIFICATION,this);else this.isStopped=!0,this._complete()},F.prototype.unsubscribe=function(){if(!this.closed)this.isStopped=!0,D.prototype.unsubscribe.call(this),this.destination=null},F.prototype._next=function(Z){this.destination.next(Z)},F.prototype._error=function(Z){try{this.destination.error(Z)}finally{this.unsubscribe()}},F.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},F}(pZ.Subscription);o0.Subscriber=aZ;var eM=Function.prototype.bind;function $3(D,F){return eM.call(D,F)}var DL=function(){function D(F){this.partialObserver=F}return D.prototype.next=function(F){var Z=this.partialObserver;if(Z.next)try{Z.next(F)}catch(J){o4(J)}},D.prototype.error=function(F){var Z=this.partialObserver;if(Z.error)try{Z.error(F)}catch(J){o4(J)}else o4(F)},D.prototype.complete=function(){var F=this.partialObserver;if(F.complete)try{F.complete()}catch(Z){o4(Z)}},D}(),iZ=function(D){nZ(F,D);function F(Z,J,X){var Y=D.call(this)||this,Q;if(oM.isFunction(Z)||!Z)Q={next:Z!==null&&Z!==void 0?Z:void 0,error:J!==null&&J!==void 0?J:void 0,complete:X!==null&&X!==void 0?X:void 0};else{var H;if(Y&&W3.config.useDeprecatedNextContext)H=Object.create(Z),H.unsubscribe=function(){return Y.unsubscribe()},Q={next:Z.next&&$3(Z.next,H),error:Z.error&&$3(Z.error,H),complete:Z.complete&&$3(Z.complete,H)};else Q=Z}return Y.destination=new DL(Q),Y}return F}(aZ);o0.SafeSubscriber=iZ;function o4(D){if(W3.config.useDeprecatedSynchronousErrorHandling)rM.captureError(D);else sM.reportUnhandledError(D)}function FL(D){throw D}function G3(D,F){var Z=W3.config.onStoppedNotification;Z&&tM.timeoutProvider.setTimeout(function(){return Z(D,F)})}o0.EMPTY_OBSERVER={closed:!0,next:cZ.noop,error:FL,complete:cZ.noop}});var l8=$((oZ)=>{Object.defineProperty(oZ,"__esModule",{value:!0});oZ.observable=void 0;oZ.observable=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}()});var E0=$((tZ)=>{Object.defineProperty(tZ,"__esModule",{value:!0});tZ.identity=void 0;function ZL(D){return D}tZ.identity=ZL});var p8=$((DJ)=>{Object.defineProperty(DJ,"__esModule",{value:!0});DJ.pipeFromArray=DJ.pipe=void 0;var JL=E0();function XL(){var D=[];for(var F=0;F<arguments.length;F++)D[F]=arguments[F];return eZ(D)}DJ.pipe=XL;function eZ(D){if(D.length===0)return JL.identity;if(D.length===1)return D[0];return function(Z){return D.reduce(function(J,X){return X(J)},Z)}}DJ.pipeFromArray=eZ});var l=$((JJ)=>{Object.defineProperty(JJ,"__esModule",{value:!