UNPKG

@ibm/telemetry-js

Version:

JavaScript telemetry tooling for open/inner source projects

33 lines (32 loc) 4.41 MB
#!/usr/bin/env node /* * Copyright IBM Corp. 2023, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ const require = (await import("node:module")).createRequire(import.meta.url); const __filename = (await import("node:url")).fileURLToPath(import.meta.url); const __dirname = (await import("node:path")).dirname(__filename); var lzt=Object.create;var tie=Object.defineProperty;var fzt=Object.getOwnPropertyDescriptor;var _zt=Object.getOwnPropertyNames;var pzt=Object.getPrototypeOf,dzt=Object.prototype.hasOwnProperty;var cf=(u=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(u,{get:(o,_)=>(typeof require<"u"?require:o)[_]}):u)(function(u){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+u+'" is not supported')});var Jo=(u,o)=>()=>(u&&(o=u(u=0)),o);var wt=(u,o)=>()=>(o||u((o={exports:{}}).exports,o),o.exports),qAe=(u,o)=>{for(var _ in o)tie(u,_,{get:o[_],enumerable:!0})},jXe=(u,o,_,y)=>{if(o&&typeof o=="object"||typeof o=="function")for(let b of _zt(o))!dzt.call(u,b)&&b!==_&&tie(u,b,{get:()=>o[b],enumerable:!(y=fzt(o,b))||y.enumerable});return u};var n_=(u,o,_)=>(_=u!=null?lzt(pzt(u)):{},jXe(o||!u||!u.__esModule?tie(_,"default",{value:u,enumerable:!0}):_,u)),_c=u=>jXe(tie({},"__esModule",{value:!0}),u);var Qq=wt(WAe=>{var rie=class extends Error{constructor(o,_,y){super(y),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=_,this.exitCode=o,this.nestedError=void 0}},zAe=class extends rie{constructor(o){super(1,"commander.invalidArgument",o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};WAe.CommanderError=rie;WAe.InvalidArgumentError=zAe});var nie=wt(GAe=>{var{InvalidArgumentError:mzt}=Qq(),HAe=class{constructor(o,_){switch(this.description=_||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,o[0]){case"<":this.required=!0,this._name=o.slice(1,-1);break;case"[":this.required=!1,this._name=o.slice(1,-1);break;default:this.required=!0,this._name=o;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(o,_){return _===this.defaultValue||!Array.isArray(_)?[o]:_.concat(o)}default(o,_){return this.defaultValue=o,this.defaultValueDescription=_,this}argParser(o){return this.parseArg=o,this}choices(o){return this.argChoices=o.slice(),this.parseArg=(_,y)=>{if(!this.argChoices.includes(_))throw new mzt(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(_,y):_},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function hzt(u){let o=u.name()+(u.variadic===!0?"...":"");return u.required?"<"+o+">":"["+o+"]"}GAe.Argument=HAe;GAe.humanReadableArgName=hzt});var YAe=wt(BXe=>{var{humanReadableArgName:gzt}=nie(),$Ae=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(o){let _=o.commands.filter(b=>!b._hidden),y=o._getHelpCommand();return y&&!y._hidden&&_.push(y),this.sortSubcommands&&_.sort((b,A)=>b.name().localeCompare(A.name())),_}compareOptions(o,_){let y=b=>b.short?b.short.replace(/^-/,""):b.long.replace(/^--/,"");return y(o).localeCompare(y(_))}visibleOptions(o){let _=o.options.filter(b=>!b.hidden),y=o._getHelpOption();if(y&&!y.hidden){let b=y.short&&o._findOption(y.short),A=y.long&&o._findOption(y.long);!b&&!A?_.push(y):y.long&&!A?_.push(o.createOption(y.long,y.description)):y.short&&!b&&_.push(o.createOption(y.short,y.description))}return this.sortOptions&&_.sort(this.compareOptions),_}visibleGlobalOptions(o){if(!this.showGlobalOptions)return[];let _=[];for(let y=o.parent;y;y=y.parent){let b=y.options.filter(A=>!A.hidden);_.push(...b)}return this.sortOptions&&_.sort(this.compareOptions),_}visibleArguments(o){return o._argsDescription&&o.registeredArguments.forEach(_=>{_.description=_.description||o._argsDescription[_.name()]||""}),o.registeredArguments.find(_=>_.description)?o.registeredArguments:[]}subcommandTerm(o){let _=o.registeredArguments.map(y=>gzt(y)).join(" ");return o._name+(o._aliases[0]?"|"+o._aliases[0]:"")+(o.options.length?" [options]":"")+(_?" "+_:"")}optionTerm(o){return o.flags}argumentTerm(o){return o.name()}longestSubcommandTermLength(o,_){return _.visibleCommands(o).reduce((y,b)=>Math.max(y,_.subcommandTerm(b).length),0)}longestOptionTermLength(o,_){return _.visibleOptions(o).reduce((y,b)=>Math.max(y,_.optionTerm(b).length),0)}longestGlobalOptionTermLength(o,_){return _.visibleGlobalOptions(o).reduce((y,b)=>Math.max(y,_.optionTerm(b).length),0)}longestArgumentTermLength(o,_){return _.visibleArguments(o).reduce((y,b)=>Math.max(y,_.argumentTerm(b).length),0)}commandUsage(o){let _=o._name;o._aliases[0]&&(_=_+"|"+o._aliases[0]);let y="";for(let b=o.parent;b;b=b.parent)y=b.name()+" "+y;return y+_+" "+o.usage()}commandDescription(o){return o.description()}subcommandDescription(o){return o.summary()||o.description()}optionDescription(o){let _=[];return o.argChoices&&_.push(`choices: ${o.argChoices.map(y=>JSON.stringify(y)).join(", ")}`),o.defaultValue!==void 0&&(o.required||o.optional||o.isBoolean()&&typeof o.defaultValue=="boolean")&&_.push(`default: ${o.defaultValueDescription||JSON.stringify(o.defaultValue)}`),o.presetArg!==void 0&&o.optional&&_.push(`preset: ${JSON.stringify(o.presetArg)}`),o.envVar!==void 0&&_.push(`env: ${o.envVar}`),_.length>0?`${o.description} (${_.join(", ")})`:o.description}argumentDescription(o){let _=[];if(o.argChoices&&_.push(`choices: ${o.argChoices.map(y=>JSON.stringify(y)).join(", ")}`),o.defaultValue!==void 0&&_.push(`default: ${o.defaultValueDescription||JSON.stringify(o.defaultValue)}`),_.length>0){let y=`(${_.join(", ")})`;return o.description?`${o.description} ${y}`:y}return o.description}formatHelp(o,_){let y=_.padWidth(o,_),b=_.helpWidth||80,A=2,h=2;function p(Br,Mt){if(Mt){let At=`${Br.padEnd(y+h)}${Mt}`;return _.wrap(At,b-A,y+h)}return Br}function k(Br){return Br.join(` `).replace(/^/gm," ".repeat(A))}let B=[`Usage: ${_.commandUsage(o)}`,""],ue=_.commandDescription(o);ue.length>0&&(B=B.concat([_.wrap(ue,b,0),""]));let We=_.visibleArguments(o).map(Br=>p(_.argumentTerm(Br),_.argumentDescription(Br)));We.length>0&&(B=B.concat(["Arguments:",k(We),""]));let be=_.visibleOptions(o).map(Br=>p(_.optionTerm(Br),_.optionDescription(Br)));if(be.length>0&&(B=B.concat(["Options:",k(be),""])),this.showGlobalOptions){let Br=_.visibleGlobalOptions(o).map(Mt=>p(_.optionTerm(Mt),_.optionDescription(Mt)));Br.length>0&&(B=B.concat(["Global Options:",k(Br),""]))}let dr=_.visibleCommands(o).map(Br=>p(_.subcommandTerm(Br),_.subcommandDescription(Br)));return dr.length>0&&(B=B.concat(["Commands:",k(dr),""])),B.join(` `)}padWidth(o,_){return Math.max(_.longestOptionTermLength(o,_),_.longestGlobalOptionTermLength(o,_),_.longestSubcommandTermLength(o,_),_.longestArgumentTermLength(o,_))}wrap(o,_,y,b=40){let A=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",h=new RegExp(`[\\n][${A}]+`);if(o.match(h))return o;let p=_-y;if(p<b)return o;let k=o.slice(0,y),B=o.slice(y).replace(`\r `,` `),ue=" ".repeat(y),be="\\s\u200B",dr=new RegExp(` |.{1,${p-1}}([${be}]|$)|[^${be}]+?([${be}]|$)`,"g"),Br=B.match(dr)||[];return k+Br.map((Mt,At)=>Mt===` `?"":(At>0?ue:"")+Mt.trimEnd()).join(` `)}};BXe.Help=$Ae});var ZAe=wt(QAe=>{var{InvalidArgumentError:yzt}=Qq(),KAe=class{constructor(o,_){this.flags=o,this.description=_||"",this.required=o.includes("<"),this.optional=o.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(o),this.mandatory=!1;let y=bzt(o);this.short=y.shortFlag,this.long=y.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(o,_){return this.defaultValue=o,this.defaultValueDescription=_,this}preset(o){return this.presetArg=o,this}conflicts(o){return this.conflictsWith=this.conflictsWith.concat(o),this}implies(o){let _=o;return typeof o=="string"&&(_={[o]:!0}),this.implied=Object.assign(this.implied||{},_),this}env(o){return this.envVar=o,this}argParser(o){return this.parseArg=o,this}makeOptionMandatory(o=!0){return this.mandatory=!!o,this}hideHelp(o=!0){return this.hidden=!!o,this}_concatValue(o,_){return _===this.defaultValue||!Array.isArray(_)?[o]:_.concat(o)}choices(o){return this.argChoices=o.slice(),this.parseArg=(_,y)=>{if(!this.argChoices.includes(_))throw new yzt(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(_,y):_},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return vzt(this.name().replace(/^no-/,""))}is(o){return this.short===o||this.long===o}isBoolean(){return!this.required&&!this.optional&&!this.negate}},XAe=class{constructor(o){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,o.forEach(_=>{_.negate?this.negativeOptions.set(_.attributeName(),_):this.positiveOptions.set(_.attributeName(),_)}),this.negativeOptions.forEach((_,y)=>{this.positiveOptions.has(y)&&this.dualOptions.add(y)})}valueFromOption(o,_){let y=_.attributeName();if(!this.dualOptions.has(y))return!0;let b=this.negativeOptions.get(y).presetArg,A=b!==void 0?b:!1;return _.negate===(A===o)}};function vzt(u){return u.split("-").reduce((o,_)=>o+_[0].toUpperCase()+_.slice(1))}function bzt(u){let o,_,y=u.split(/[ |,]+/);return y.length>1&&!/^[[<]/.test(y[1])&&(o=y.shift()),_=y.shift(),!o&&/^-[^-]$/.test(_)&&(o=_,_=void 0),{shortFlag:o,longFlag:_}}QAe.Option=KAe;QAe.DualOptions=XAe});var VXe=wt(UXe=>{function Szt(u,o){if(Math.abs(u.length-o.length)>3)return Math.max(u.length,o.length);let _=[];for(let y=0;y<=u.length;y++)_[y]=[y];for(let y=0;y<=o.length;y++)_[0][y]=y;for(let y=1;y<=o.length;y++)for(let b=1;b<=u.length;b++){let A=1;u[b-1]===o[y-1]?A=0:A=1,_[b][y]=Math.min(_[b-1][y]+1,_[b][y-1]+1,_[b-1][y-1]+A),b>1&&y>1&&u[b-1]===o[y-2]&&u[b-2]===o[y-1]&&(_[b][y]=Math.min(_[b][y],_[b-2][y-2]+1))}return _[u.length][o.length]}function Tzt(u,o){if(!o||o.length===0)return"";o=Array.from(new Set(o));let _=u.startsWith("--");_&&(u=u.slice(2),o=o.map(h=>h.slice(2)));let y=[],b=3,A=.4;return o.forEach(h=>{if(h.length<=1)return;let p=Szt(u,h),k=Math.max(u.length,h.length);(k-p)/k>A&&(p<b?(b=p,y=[h]):p===b&&y.push(h))}),y.sort((h,p)=>h.localeCompare(p)),_&&(y=y.map(h=>`--${h}`)),y.length>1?` (Did you mean one of ${y.join(", ")}?)`:y.length===1?` (Did you mean ${y[0]}?)`:""}UXe.suggestSimilar=Tzt});var HXe=wt(WXe=>{var xzt=cf("node:events").EventEmitter,e6e=cf("node:child_process"),lk=cf("node:path"),t6e=cf("node:fs"),Wd=cf("node:process"),{Argument:Ezt,humanReadableArgName:Czt}=nie(),{CommanderError:r6e}=Qq(),{Help:Azt}=YAe(),{Option:JXe,DualOptions:kzt}=ZAe(),{suggestSimilar:qXe}=VXe(),n6e=class u extends xzt{constructor(o){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=o||"",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:_=>Wd.stdout.write(_),writeErr:_=>Wd.stderr.write(_),getOutHelpWidth:()=>Wd.stdout.isTTY?Wd.stdout.columns:void 0,getErrHelpWidth:()=>Wd.stderr.isTTY?Wd.stderr.columns:void 0,outputError:(_,y)=>y(_)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(o){return this._outputConfiguration=o._outputConfiguration,this._helpOption=o._helpOption,this._helpCommand=o._helpCommand,this._helpConfiguration=o._helpConfiguration,this._exitCallback=o._exitCallback,this._storeOptionsAsProperties=o._storeOptionsAsProperties,this._combineFlagAndOptionalValue=o._combineFlagAndOptionalValue,this._allowExcessArguments=o._allowExcessArguments,this._enablePositionalOptions=o._enablePositionalOptions,this._showHelpAfterError=o._showHelpAfterError,this._showSuggestionAfterError=o._showSuggestionAfterError,this}_getCommandAndAncestors(){let o=[];for(let _=this;_;_=_.parent)o.push(_);return o}command(o,_,y){let b=_,A=y;typeof b=="object"&&b!==null&&(A=b,b=null),A=A||{};let[,h,p]=o.match(/([^ ]+) *(.*)/),k=this.createCommand(h);return b&&(k.description(b),k._executableHandler=!0),A.isDefault&&(this._defaultCommandName=k._name),k._hidden=!!(A.noHelp||A.hidden),k._executableFile=A.executableFile||null,p&&k.arguments(p),this._registerCommand(k),k.parent=this,k.copyInheritedSettings(this),b?this:k}createCommand(o){return new u(o)}createHelp(){return Object.assign(new Azt,this.configureHelp())}configureHelp(o){return o===void 0?this._helpConfiguration:(this._helpConfiguration=o,this)}configureOutput(o){return o===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,o),this)}showHelpAfterError(o=!0){return typeof o!="string"&&(o=!!o),this._showHelpAfterError=o,this}showSuggestionAfterError(o=!0){return this._showSuggestionAfterError=!!o,this}addCommand(o,_){if(!o._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return _=_||{},_.isDefault&&(this._defaultCommandName=o._name),(_.noHelp||_.hidden)&&(o._hidden=!0),this._registerCommand(o),o.parent=this,o._checkForBrokenPassThrough(),this}createArgument(o,_){return new Ezt(o,_)}argument(o,_,y,b){let A=this.createArgument(o,_);return typeof y=="function"?A.default(b).argParser(y):A.default(y),this.addArgument(A),this}arguments(o){return o.trim().split(/ +/).forEach(_=>{this.argument(_)}),this}addArgument(o){let _=this.registeredArguments.slice(-1)[0];if(_&&_.variadic)throw new Error(`only the last argument can be variadic '${_.name()}'`);if(o.required&&o.defaultValue!==void 0&&o.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${o.name()}'`);return this.registeredArguments.push(o),this}helpCommand(o,_){if(typeof o=="boolean")return this._addImplicitHelpCommand=o,this;o=o??"help [command]";let[,y,b]=o.match(/([^ ]+) *(.*)/),A=_??"display help for command",h=this.createCommand(y);return h.helpOption(!1),b&&h.arguments(b),A&&h.description(A),this._addImplicitHelpCommand=!0,this._helpCommand=h,this}addHelpCommand(o,_){return typeof o!="object"?(this.helpCommand(o,_),this):(this._addImplicitHelpCommand=!0,this._helpCommand=o,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(o,_){let y=["preSubcommand","preAction","postAction"];if(!y.includes(o))throw new Error(`Unexpected value for event passed to hook : '${o}'. Expecting one of '${y.join("', '")}'`);return this._lifeCycleHooks[o]?this._lifeCycleHooks[o].push(_):this._lifeCycleHooks[o]=[_],this}exitOverride(o){return o?this._exitCallback=o:this._exitCallback=_=>{if(_.code!=="commander.executeSubCommandAsync")throw _},this}_exit(o,_,y){this._exitCallback&&this._exitCallback(new r6e(o,_,y)),Wd.exit(o)}action(o){let _=y=>{let b=this.registeredArguments.length,A=y.slice(0,b);return this._storeOptionsAsProperties?A[b]=this:A[b]=this.opts(),A.push(this),o.apply(this,A)};return this._actionHandler=_,this}createOption(o,_){return new JXe(o,_)}_callParseArg(o,_,y,b){try{return o.parseArg(_,y)}catch(A){if(A.code==="commander.invalidArgument"){let h=`${b} ${A.message}`;this.error(h,{exitCode:A.exitCode,code:A.code})}throw A}}_registerOption(o){let _=o.short&&this._findOption(o.short)||o.long&&this._findOption(o.long);if(_){let y=o.long&&this._findOption(o.long)?o.long:o.short;throw new Error(`Cannot add option '${o.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${y}' - already used by option '${_.flags}'`)}this.options.push(o)}_registerCommand(o){let _=b=>[b.name()].concat(b.aliases()),y=_(o).find(b=>this._findCommand(b));if(y){let b=_(this._findCommand(y)).join("|"),A=_(o).join("|");throw new Error(`cannot add command '${A}' as already have command '${b}'`)}this.commands.push(o)}addOption(o){this._registerOption(o);let _=o.name(),y=o.attributeName();if(o.negate){let A=o.long.replace(/^--no-/,"--");this._findOption(A)||this.setOptionValueWithSource(y,o.defaultValue===void 0?!0:o.defaultValue,"default")}else o.defaultValue!==void 0&&this.setOptionValueWithSource(y,o.defaultValue,"default");let b=(A,h,p)=>{A==null&&o.presetArg!==void 0&&(A=o.presetArg);let k=this.getOptionValue(y);A!==null&&o.parseArg?A=this._callParseArg(o,A,k,h):A!==null&&o.variadic&&(A=o._concatValue(A,k)),A==null&&(o.negate?A=!1:o.isBoolean()||o.optional?A=!0:A=""),this.setOptionValueWithSource(y,A,p)};return this.on("option:"+_,A=>{let h=`error: option '${o.flags}' argument '${A}' is invalid.`;b(A,h,"cli")}),o.envVar&&this.on("optionEnv:"+_,A=>{let h=`error: option '${o.flags}' value '${A}' from env '${o.envVar}' is invalid.`;b(A,h,"env")}),this}_optionEx(o,_,y,b,A){if(typeof _=="object"&&_ instanceof JXe)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let h=this.createOption(_,y);if(h.makeOptionMandatory(!!o.mandatory),typeof b=="function")h.default(A).argParser(b);else if(b instanceof RegExp){let p=b;b=(k,B)=>{let ue=p.exec(k);return ue?ue[0]:B},h.default(A).argParser(b)}else h.default(b);return this.addOption(h)}option(o,_,y,b){return this._optionEx({},o,_,y,b)}requiredOption(o,_,y,b){return this._optionEx({mandatory:!0},o,_,y,b)}combineFlagAndOptionalValue(o=!0){return this._combineFlagAndOptionalValue=!!o,this}allowUnknownOption(o=!0){return this._allowUnknownOption=!!o,this}allowExcessArguments(o=!0){return this._allowExcessArguments=!!o,this}enablePositionalOptions(o=!0){return this._enablePositionalOptions=!!o,this}passThroughOptions(o=!0){return this._passThroughOptions=!!o,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(o=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!o,this}getOptionValue(o){return this._storeOptionsAsProperties?this[o]:this._optionValues[o]}setOptionValue(o,_){return this.setOptionValueWithSource(o,_,void 0)}setOptionValueWithSource(o,_,y){return this._storeOptionsAsProperties?this[o]=_:this._optionValues[o]=_,this._optionValueSources[o]=y,this}getOptionValueSource(o){return this._optionValueSources[o]}getOptionValueSourceWithGlobals(o){let _;return this._getCommandAndAncestors().forEach(y=>{y.getOptionValueSource(o)!==void 0&&(_=y.getOptionValueSource(o))}),_}_prepareUserArgs(o,_){if(o!==void 0&&!Array.isArray(o))throw new Error("first parameter to parse must be array or undefined");if(_=_||{},o===void 0&&_.from===void 0){Wd.versions?.electron&&(_.from="electron");let b=Wd.execArgv??[];(b.includes("-e")||b.includes("--eval")||b.includes("-p")||b.includes("--print"))&&(_.from="eval")}o===void 0&&(o=Wd.argv),this.rawArgs=o.slice();let y;switch(_.from){case void 0:case"node":this._scriptPath=o[1],y=o.slice(2);break;case"electron":Wd.defaultApp?(this._scriptPath=o[1],y=o.slice(2)):y=o.slice(1);break;case"user":y=o.slice(0);break;case"eval":y=o.slice(1);break;default:throw new Error(`unexpected parse option { from: '${_.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",y}parse(o,_){let y=this._prepareUserArgs(o,_);return this._parseCommand([],y),this}async parseAsync(o,_){let y=this._prepareUserArgs(o,_);return await this._parseCommand([],y),this}_executeSubCommand(o,_){_=_.slice();let y=!1,b=[".js",".ts",".tsx",".mjs",".cjs"];function A(ue,We){let be=lk.resolve(ue,We);if(t6e.existsSync(be))return be;if(b.includes(lk.extname(We)))return;let dr=b.find(Br=>t6e.existsSync(`${be}${Br}`));if(dr)return`${be}${dr}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let h=o._executableFile||`${this._name}-${o._name}`,p=this._executableDir||"";if(this._scriptPath){let ue;try{ue=t6e.realpathSync(this._scriptPath)}catch{ue=this._scriptPath}p=lk.resolve(lk.dirname(ue),p)}if(p){let ue=A(p,h);if(!ue&&!o._executableFile&&this._scriptPath){let We=lk.basename(this._scriptPath,lk.extname(this._scriptPath));We!==this._name&&(ue=A(p,`${We}-${o._name}`))}h=ue||h}y=b.includes(lk.extname(h));let k;Wd.platform!=="win32"?y?(_.unshift(h),_=zXe(Wd.execArgv).concat(_),k=e6e.spawn(Wd.argv[0],_,{stdio:"inherit"})):k=e6e.spawn(h,_,{stdio:"inherit"}):(_.unshift(h),_=zXe(Wd.execArgv).concat(_),k=e6e.spawn(Wd.execPath,_,{stdio:"inherit"})),k.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(We=>{Wd.on(We,()=>{k.killed===!1&&k.exitCode===null&&k.kill(We)})});let B=this._exitCallback;k.on("close",ue=>{ue=ue??1,B?B(new r6e(ue,"commander.executeSubCommandAsync","(close)")):Wd.exit(ue)}),k.on("error",ue=>{if(ue.code==="ENOENT"){let We=p?`searched for local subcommand relative to directory '${p}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",be=`'${h}' does not exist - if '${o._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 - ${We}`;throw new Error(be)}else if(ue.code==="EACCES")throw new Error(`'${h}' not executable`);if(!B)Wd.exit(1);else{let We=new r6e(1,"commander.executeSubCommandAsync","(error)");We.nestedError=ue,B(We)}}),this.runningCommand=k}_dispatchSubcommand(o,_,y){let b=this._findCommand(o);b||this.help({error:!0});let A;return A=this._chainOrCallSubCommandHook(A,b,"preSubcommand"),A=this._chainOrCall(A,()=>{if(b._executableHandler)this._executeSubCommand(b,_.concat(y));else return b._parseCommand(_,y)}),A}_dispatchHelpCommand(o){o||this.help();let _=this._findCommand(o);return _&&!_._executableHandler&&_.help(),this._dispatchSubcommand(o,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((o,_)=>{o.required&&this.args[_]==null&&this.missingArgument(o.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let o=(y,b,A)=>{let h=b;if(b!==null&&y.parseArg){let p=`error: command-argument value '${b}' is invalid for argument '${y.name()}'.`;h=this._callParseArg(y,b,A,p)}return h};this._checkNumberOfArguments();let _=[];this.registeredArguments.forEach((y,b)=>{let A=y.defaultValue;y.variadic?b<this.args.length?(A=this.args.slice(b),y.parseArg&&(A=A.reduce((h,p)=>o(y,p,h),y.defaultValue))):A===void 0&&(A=[]):b<this.args.length&&(A=this.args[b],y.parseArg&&(A=o(y,A,y.defaultValue))),_[b]=A}),this.processedArgs=_}_chainOrCall(o,_){return o&&o.then&&typeof o.then=="function"?o.then(()=>_()):_()}_chainOrCallHooks(o,_){let y=o,b=[];return this._getCommandAndAncestors().reverse().filter(A=>A._lifeCycleHooks[_]!==void 0).forEach(A=>{A._lifeCycleHooks[_].forEach(h=>{b.push({hookedCommand:A,callback:h})})}),_==="postAction"&&b.reverse(),b.forEach(A=>{y=this._chainOrCall(y,()=>A.callback(A.hookedCommand,this))}),y}_chainOrCallSubCommandHook(o,_,y){let b=o;return this._lifeCycleHooks[y]!==void 0&&this._lifeCycleHooks[y].forEach(A=>{b=this._chainOrCall(b,()=>A(this,_))}),b}_parseCommand(o,_){let y=this.parseOptions(_);if(this._parseOptionsEnv(),this._parseOptionsImplied(),o=o.concat(y.operands),_=y.unknown,this.args=o.concat(_),o&&this._findCommand(o[0]))return this._dispatchSubcommand(o[0],o.slice(1),_);if(this._getHelpCommand()&&o[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(o[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(_),this._dispatchSubcommand(this._defaultCommandName,o,_);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(y.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let b=()=>{y.unknown.length>0&&this.unknownOption(y.unknown[0])},A=`command:${this.name()}`;if(this._actionHandler){b(),this._processArguments();let h;return h=this._chainOrCallHooks(h,"preAction"),h=this._chainOrCall(h,()=>this._actionHandler(this.processedArgs)),this.parent&&(h=this._chainOrCall(h,()=>{this.parent.emit(A,o,_)})),h=this._chainOrCallHooks(h,"postAction"),h}if(this.parent&&this.parent.listenerCount(A))b(),this._processArguments(),this.parent.emit(A,o,_);else if(o.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",o,_);this.listenerCount("command:*")?this.emit("command:*",o,_):this.commands.length?this.unknownCommand():(b(),this._processArguments())}else this.commands.length?(b(),this.help({error:!0})):(b(),this._processArguments())}_findCommand(o){if(o)return this.commands.find(_=>_._name===o||_._aliases.includes(o))}_findOption(o){return this.options.find(_=>_.is(o))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(o=>{o.options.forEach(_=>{_.mandatory&&o.getOptionValue(_.attributeName())===void 0&&o.missingMandatoryOptionValue(_)})})}_checkForConflictingLocalOptions(){let o=this.options.filter(y=>{let b=y.attributeName();return this.getOptionValue(b)===void 0?!1:this.getOptionValueSource(b)!=="default"});o.filter(y=>y.conflictsWith.length>0).forEach(y=>{let b=o.find(A=>y.conflictsWith.includes(A.attributeName()));b&&this._conflictingOption(y,b)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(o=>{o._checkForConflictingLocalOptions()})}parseOptions(o){let _=[],y=[],b=_,A=o.slice();function h(k){return k.length>1&&k[0]==="-"}let p=null;for(;A.length;){let k=A.shift();if(k==="--"){b===y&&b.push(k),b.push(...A);break}if(p&&!h(k)){this.emit(`option:${p.name()}`,k);continue}if(p=null,h(k)){let B=this._findOption(k);if(B){if(B.required){let ue=A.shift();ue===void 0&&this.optionMissingArgument(B),this.emit(`option:${B.name()}`,ue)}else if(B.optional){let ue=null;A.length>0&&!h(A[0])&&(ue=A.shift()),this.emit(`option:${B.name()}`,ue)}else this.emit(`option:${B.name()}`);p=B.variadic?B:null;continue}}if(k.length>2&&k[0]==="-"&&k[1]!=="-"){let B=this._findOption(`-${k[1]}`);if(B){B.required||B.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${B.name()}`,k.slice(2)):(this.emit(`option:${B.name()}`),A.unshift(`-${k.slice(2)}`));continue}}if(/^--[^=]+=/.test(k)){let B=k.indexOf("="),ue=this._findOption(k.slice(0,B));if(ue&&(ue.required||ue.optional)){this.emit(`option:${ue.name()}`,k.slice(B+1));continue}}if(h(k)&&(b=y),(this._enablePositionalOptions||this._passThroughOptions)&&_.length===0&&y.length===0){if(this._findCommand(k)){_.push(k),A.length>0&&y.push(...A);break}else if(this._getHelpCommand()&&k===this._getHelpCommand().name()){_.push(k),A.length>0&&_.push(...A);break}else if(this._defaultCommandName){y.push(k),A.length>0&&y.push(...A);break}}if(this._passThroughOptions){b.push(k),A.length>0&&b.push(...A);break}b.push(k)}return{operands:_,unknown:y}}opts(){if(this._storeOptionsAsProperties){let o={},_=this.options.length;for(let y=0;y<_;y++){let b=this.options[y].attributeName();o[b]=b===this._versionOptionName?this._version:this[b]}return o}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((o,_)=>Object.assign(o,_.opts()),{})}error(o,_){this._outputConfiguration.outputError(`${o} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));let y=_||{},b=y.exitCode||1,A=y.code||"commander.error";this._exit(b,A,o)}_parseOptionsEnv(){this.options.forEach(o=>{if(o.envVar&&o.envVar in Wd.env){let _=o.attributeName();(this.getOptionValue(_)===void 0||["default","config","env"].includes(this.getOptionValueSource(_)))&&(o.required||o.optional?this.emit(`optionEnv:${o.name()}`,Wd.env[o.envVar]):this.emit(`optionEnv:${o.name()}`))}})}_parseOptionsImplied(){let o=new kzt(this.options),_=y=>this.getOptionValue(y)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(y));this.options.filter(y=>y.implied!==void 0&&_(y.attributeName())&&o.valueFromOption(this.getOptionValue(y.attributeName()),y)).forEach(y=>{Object.keys(y.implied).filter(b=>!_(b)).forEach(b=>{this.setOptionValueWithSource(b,y.implied[b],"implied")})})}missingArgument(o){let _=`error: missing required argument '${o}'`;this.error(_,{code:"commander.missingArgument"})}optionMissingArgument(o){let _=`error: option '${o.flags}' argument missing`;this.error(_,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(o){let _=`error: required option '${o.flags}' not specified`;this.error(_,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(o,_){let y=h=>{let p=h.attributeName(),k=this.getOptionValue(p),B=this.options.find(We=>We.negate&&p===We.attributeName()),ue=this.options.find(We=>!We.negate&&p===We.attributeName());return B&&(B.presetArg===void 0&&k===!1||B.presetArg!==void 0&&k===B.presetArg)?B:ue||h},b=h=>{let p=y(h),k=p.attributeName();return this.getOptionValueSource(k)==="env"?`environment variable '${p.envVar}'`:`option '${p.flags}'`},A=`error: ${b(o)} cannot be used with ${b(_)}`;this.error(A,{code:"commander.conflictingOption"})}unknownOption(o){if(this._allowUnknownOption)return;let _="";if(o.startsWith("--")&&this._showSuggestionAfterError){let b=[],A=this;do{let h=A.createHelp().visibleOptions(A).filter(p=>p.long).map(p=>p.long);b=b.concat(h),A=A.parent}while(A&&!A._enablePositionalOptions);_=qXe(o,b)}let y=`error: unknown option '${o}'${_}`;this.error(y,{code:"commander.unknownOption"})}_excessArguments(o){if(this._allowExcessArguments)return;let _=this.registeredArguments.length,y=_===1?"":"s",A=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${_} argument${y} but got ${o.length}.`;this.error(A,{code:"commander.excessArguments"})}unknownCommand(){let o=this.args[0],_="";if(this._showSuggestionAfterError){let b=[];this.createHelp().visibleCommands(this).forEach(A=>{b.push(A.name()),A.alias()&&b.push(A.alias())}),_=qXe(o,b)}let y=`error: unknown command '${o}'${_}`;this.error(y,{code:"commander.unknownCommand"})}version(o,_,y){if(o===void 0)return this._version;this._version=o,_=_||"-V, --version",y=y||"output the version number";let b=this.createOption(_,y);return this._versionOptionName=b.attributeName(),this._registerOption(b),this.on("option:"+b.name(),()=>{this._outputConfiguration.writeOut(`${o} `),this._exit(0,"commander.version",o)}),this}description(o,_){return o===void 0&&_===void 0?this._description:(this._description=o,_&&(this._argsDescription=_),this)}summary(o){return o===void 0?this._summary:(this._summary=o,this)}alias(o){if(o===void 0)return this._aliases[0];let _=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(_=this.commands[this.commands.length-1]),o===_._name)throw new Error("Command alias can't be the same as its name");let y=this.parent?._findCommand(o);if(y){let b=[y.name()].concat(y.aliases()).join("|");throw new Error(`cannot add alias '${o}' to command '${this.name()}' as already have command '${b}'`)}return _._aliases.push(o),this}aliases(o){return o===void 0?this._aliases:(o.forEach(_=>this.alias(_)),this)}usage(o){if(o===void 0){if(this._usage)return this._usage;let _=this.registeredArguments.map(y=>Czt(y));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?_:[]).join(" ")}return this._usage=o,this}name(o){return o===void 0?this._name:(this._name=o,this)}nameFromFilename(o){return this._name=lk.basename(o,lk.extname(o)),this}executableDir(o){return o===void 0?this._executableDir:(this._executableDir=o,this)}helpInformation(o){let _=this.createHelp();return _.helpWidth===void 0&&(_.helpWidth=o&&o.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),_.formatHelp(this,_)}_getHelpContext(o){o=o||{};let _={error:!!o.error},y;return _.error?y=b=>this._outputConfiguration.writeErr(b):y=b=>this._outputConfiguration.writeOut(b),_.write=o.write||y,_.command=this,_}outputHelp(o){let _;typeof o=="function"&&(_=o,o=void 0);let y=this._getHelpContext(o);this._getCommandAndAncestors().reverse().forEach(A=>A.emit("beforeAllHelp",y)),this.emit("beforeHelp",y);let b=this.helpInformation(y);if(_&&(b=_(b),typeof b!="string"&&!Buffer.isBuffer(b)))throw new Error("outputHelp callback must return a string or a Buffer");y.write(b),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",y),this._getCommandAndAncestors().forEach(A=>A.emit("afterAllHelp",y))}helpOption(o,_){return typeof o=="boolean"?(o?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(o=o??"-h, --help",_=_??"display help for command",this._helpOption=this.createOption(o,_),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(o){return this._helpOption=o,this}help(o){this.outputHelp(o);let _=Wd.exitCode||0;_===0&&o&&typeof o!="function"&&o.error&&(_=1),this._exit(_,"commander.help","(outputHelp)")}addHelpText(o,_){let y=["beforeAll","before","after","afterAll"];if(!y.includes(o))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${y.join("', '")}'`);let b=`${o}Help`;return this.on(b,A=>{let h;typeof _=="function"?h=_({error:A.error,command:A.command}):h=_,h&&A.write(`${h} `)}),this}_outputHelpIfRequested(o){let _=this._getHelpOption();_&&o.find(b=>_.is(b))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function zXe(u){return u.map(o=>{if(!o.startsWith("--inspect"))return o;let _,y="127.0.0.1",b="9229",A;return(A=o.match(/^(--inspect(-brk)?)$/))!==null?_=A[1]:(A=o.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(_=A[1],/^\d+$/.test(A[3])?b=A[3]:y=A[3]):(A=o.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(_=A[1],y=A[3],b=A[4]),_&&b!=="0"?`${_}=${y}:${parseInt(b)+1}`:o})}WXe.Command=n6e});var KXe=wt(O2=>{var{Argument:GXe}=nie(),{Command:i6e}=HXe(),{CommanderError:Pzt,InvalidArgumentError:$Xe}=Qq(),{Help:Nzt}=YAe(),{Option:YXe}=ZAe();O2.program=new i6e;O2.createCommand=u=>new i6e(u);O2.createOption=(u,o)=>new YXe(u,o);O2.createArgument=(u,o)=>new GXe(u,o);O2.Command=i6e;O2.Option=YXe;O2.Argument=GXe;O2.Help=Nzt;O2.CommanderError=Pzt;O2.InvalidArgumentError=$Xe;O2.InvalidOptionArgumentError=$Xe});var QXe,ZXe=Jo(()=>{QXe=typeof globalThis=="object"?globalThis:global});var eQe=Jo(()=>{ZXe()});var tQe=Jo(()=>{eQe()});var fk,s6e=Jo(()=>{fk="1.9.0"});function qzt(u){var o=new Set([u]),_=new Set,y=u.match(rQe);if(!y)return function(){return!1};var b={major:+y[1],minor:+y[2],patch:+y[3],prerelease:y[4]};if(b.prerelease!=null)return function(k){return k===u};function A(p){return _.add(p),!1}function h(p){return o.add(p),!0}return function(k){if(o.has(k))return!0;if(_.has(k))return!1;var B=k.match(rQe);if(!B)return A(k);var ue={major:+B[1],minor:+B[2],patch:+B[3],prerelease:B[4]};return ue.prerelease!=null||b.major!==ue.major?A(k):b.major===0?b.minor===ue.minor&&b.patch<=ue.patch?h(k):A(k):b.minor<=ue.minor?h(k):A(k)}}var rQe,nQe,iQe=Jo(()=>{s6e();rQe=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;nQe=qzt(fk)});function EC(u,o,_,y){var b;y===void 0&&(y=!1);var A=ez[Zq]=(b=ez[Zq])!==null&&b!==void 0?b:{version:fk};if(!y&&A[u]){var h=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+u);return _.error(h.stack||h.message),!1}if(A.version!==fk){var h=new Error("@opentelemetry/api: Registration of version v"+A.version+" for "+u+" does not match previously registered API v"+fk);return _.error(h.stack||h.message),!1}return A[u]=o,_.debug("@opentelemetry/api: Registered a global for "+u+" v"+fk+"."),!0}function Xb(u){var o,_,y=(o=ez[Zq])===null||o===void 0?void 0:o.version;if(!(!y||!nQe(y)))return(_=ez[Zq])===null||_===void 0?void 0:_[u]}function CC(u,o){o.debug("@opentelemetry/api: Unregistering a global for "+u+" v"+fk+".");var _=ez[Zq];_&&delete _[u]}var zzt,Zq,ez,RI=Jo(()=>{tQe();s6e();iQe();zzt=fk.split(".")[0],Zq=Symbol.for("opentelemetry.js.api."+zzt),ez=QXe});function tz(u,o,_){var y=Xb("diag");if(y)return _.unshift(o),y[u].apply(y,Hzt([],Wzt(_),!1))}var Wzt,Hzt,aQe,sQe=Jo(()=>{RI();Wzt=function(u,o){var _=typeof Symbol=="function"&&u[Symbol.iterator];if(!_)return u;var y=_.call(u),b,A=[],h;try{for(;(o===void 0||o-- >0)&&!(b=y.next()).done;)A.push(b.value)}catch(p){h={error:p}}finally{try{b&&!b.done&&(_=y.return)&&_.call(y)}finally{if(h)throw h.error}}return A},Hzt=function(u,o,_){if(_||arguments.length===2)for(var y=0,b=o.length,A;y<b;y++)(A||!(y in o))&&(A||(A=Array.prototype.slice.call(o,0,y)),A[y]=o[y]);return u.concat(A||Array.prototype.slice.call(o))},aQe=(function(){function u(o){this._namespace=o.namespace||"DiagComponentLogger"}return u.prototype.debug=function(){for(var o=[],_=0;_<arguments.length;_++)o[_]=arguments[_];return tz("debug",this._namespace,o)},u.prototype.error=function(){for(var o=[],_=0;_<arguments.length;_++)o[_]=arguments[_];return tz("error",this._namespace,o)},u.prototype.info=function(){for(var o=[],_=0;_<arguments.length;_++)o[_]=arguments[_];return tz("info",this._namespace,o)},u.prototype.warn=function(){for(var o=[],_=0;_<arguments.length;_++)o[_]=arguments[_];return tz("warn",this._namespace,o)},u.prototype.verbose=function(){for(var o=[],_=0;_<arguments.length;_++)o[_]=arguments[_];return tz("verbose",this._namespace,o)},u})()});var y0,aie=Jo(()=>{(function(u){u[u.NONE=0]="NONE",u[u.ERROR=30]="ERROR",u[u.WARN=50]="WARN",u[u.INFO=60]="INFO",u[u.DEBUG=70]="DEBUG",u[u.VERBOSE=80]="VERBOSE",u[u.ALL=9999]="ALL"})(y0||(y0={}))});function oQe(u,o){u<y0.NONE?u=y0.NONE:u>y0.ALL&&(u=y0.ALL),o=o||{};function _(y,b){var A=o[y];return typeof A=="function"&&u>=b?A.bind(o):function(){}}return{error:_("error",y0.ERROR),warn:_("warn",y0.WARN),info:_("info",y0.INFO),debug:_("debug",y0.DEBUG),verbose:_("verbose",y0.VERBOSE)}}var cQe=Jo(()=>{aie()});var Gzt,$zt,Yzt,ny,MI=Jo(()=>{sQe();cQe();aie();RI();Gzt=function(u,o){var _=typeof Symbol=="function"&&u[Symbol.iterator];if(!_)return u;var y=_.call(u),b,A=[],h;try{for(;(o===void 0||o-- >0)&&!(b=y.next()).done;)A.push(b.value)}catch(p){h={error:p}}finally{try{b&&!b.done&&(_=y.return)&&_.call(y)}finally{if(h)throw h.error}}return A},$zt=function(u,o,_){if(_||arguments.length===2)for(var y=0,b=o.length,A;y<b;y++)(A||!(y in o))&&(A||(A=Array.prototype.slice.call(o,0,y)),A[y]=o[y]);return u.concat(A||Array.prototype.slice.call(o))},Yzt="diag",ny=(function(){function u(){function o(b){return function(){for(var A=[],h=0;h<arguments.length;h++)A[h]=arguments[h];var p=Xb("diag");if(p)return p[b].apply(p,$zt([],Gzt(A),!1))}}var _=this,y=function(b,A){var h,p,k;if(A===void 0&&(A={logLevel:y0.INFO}),b===_){var B=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return _.error((h=B.stack)!==null&&h!==void 0?h:B.message),!1}typeof A=="number"&&(A={logLevel:A});var ue=Xb("diag"),We=oQe((p=A.logLevel)!==null&&p!==void 0?p:y0.INFO,b);if(ue&&!A.suppressOverrideMessage){var be=(k=new Error().stack)!==null&&k!==void 0?k:"<failed to generate stacktrace>";ue.warn("Current logger will be overwritten from "+be),We.warn("Current logger will overwrite one already registered from "+be)}return EC("diag",We,_,!0)};_.setLogger=y,_.disable=function(){CC(Yzt,_)},_.createComponentLogger=function(b){return new aQe(b)},_.verbose=o("verbose"),_.debug=o("debug"),_.info=o("info"),_.warn=o("warn"),_.error=o("error")}return u.instance=function(){return this._instance||(this._instance=new u),this._instance},u})()});var Kzt,Xzt,uQe,lQe=Jo(()=>{Kzt=function(u,o){var _=typeof Symbol=="function"&&u[Symbol.iterator];if(!_)return u;var y=_.call(u),b,A=[],h;try{for(;(o===void 0||o-- >0)&&!(b=y.next()).done;)A.push(b.value)}catch(p){h={error:p}}finally{try{b&&!b.done&&(_=y.return)&&_.call(y)}finally{if(h)throw h.error}}return A},Xzt=function(u){var o=typeof Symbol=="function"&&Symbol.iterator,_=o&&u[o],y=0;if(_)return _.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&y>=u.length&&(u=void 0),{value:u&&u[y++],done:!u}}};throw new TypeError(o?"Object is not iterable.":"Symbol.iterator is not defined.")},uQe=(function(){function u(o){this._entries=o?new Map(o):new Map}return u.prototype.getEntry=function(o){var _=this._entries.get(o);if(_)return Object.assign({},_)},u.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(o){var _=Kzt(o,2),y=_[0],b=_[1];return[y,b]})},u.prototype.setEntry=function(o,_){var y=new u(this._entries);return y._entries.set(o,_),y},u.prototype.removeEntry=function(o){var _=new u(this._entries);return _._entries.delete(o),_},u.prototype.removeEntries=function(){for(var o,_,y=[],b=0;b<arguments.length;b++)y[b]=arguments[b];var A=new u(this._entries);try{for(var h=Xzt(y),p=h.next();!p.done;p=h.next()){var k=p.value;A._entries.delete(k)}}catch(B){o={error:B}}finally{try{p&&!p.done&&(_=h.return)&&_.call(h)}finally{if(o)throw o.error}}return A},u.prototype.clear=function(){return new u},u})()});var fQe,_Qe=Jo(()=>{fQe=Symbol("BaggageEntryMetadata")});function pQe(u){return u===void 0&&(u={}),new uQe(new Map(Object.entries(u)))}function dQe(u){return typeof u!="string"&&(Qzt.error("Cannot create baggage metadata from unknown type: "+typeof u),u=""),{__TYPE__:fQe,toString:function(){return u}}}var Qzt,o6e=Jo(()=>{MI();lQe();_Qe();Qzt=ny.instance()});function xM(u){return Symbol.for(u)}var Zzt,sie,rz=Jo(()=>{Zzt=(function(){function u(o){var _=this;_._currentContext=o?new Map(o):new Map,_.getValue=function(y){return _._currentContext.get(y)},_.setValue=function(y,b){var A=new u(_._currentContext);return A._currentContext.set(y,b),A},_.deleteValue=function(y){var b=new u(_._currentContext);return b._currentContext.delete(y),b}}return u})(),sie=new Zzt});var c6e,mQe,hQe=Jo(()=>{c6e=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],mQe=(function(){function u(){function o(y){return function(){for(var b=[],A=0;A<arguments.length;A++)b[A]=arguments[A];if(console){var h=console[y];if(typeof h!="function"&&(h=console.log),typeof h=="function")return h.apply(console,b)}}}for(var _=0;_<c6e.length;_++)this[c6e[_].n]=o(c6e[_].c)}return u})()});function gQe(){return l6e}var LI,eWt,oie,tWt,rWt,nWt,iWt,u6e,aWt,sWt,oWt,l6e,cWt,uWt,lWt,fWt,_Wt,pWt,dWt,f6e=Jo(()=>{LI=(function(){var u=function(o,_){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,b){y.__proto__=b}||function(y,b){for(var A in b)Object.prototype.hasOwnProperty.call(b,A)&&(y[A]=b[A])},u(o,_)};return function(o,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");u(o,_);function y(){this.constructor=o}o.prototype=_===null?Object.create(_):(y.prototype=_.prototype,new y)}})(),eWt=(function(){function u(){}return u.prototype.createGauge=function(o,_){return uWt},u.prototype.createHistogram=function(o,_){return lWt},u.prototype.createCounter=function(o,_){return cWt},u.prototype.createUpDownCounter=function(o,_){return fWt},u.prototype.createObservableGauge=function(o,_){return pWt},u.prototype.createObservableCounter=function(o,_){return _Wt},u.prototype.createObservableUpDownCounter=function(o,_){return dWt},u.prototype.addBatchObservableCallback=function(o,_){},u.prototype.removeBatchObservableCallback=function(o){},u})(),oie=(function(){function u(){}return u})(),tWt=(function(u){LI(o,u);function o(){return u!==null&&u.apply(this,arguments)||this}return o.prototype.add=function(_,y){},o})(oie),rWt=(function(u){LI(o,u);function o(){return u!==null&&u.apply(this,arguments)||this}return o.prototype.add=function(_,y){},o})(oie),nWt=(function(u){LI(o,u);function o(){return u!==null&&u.apply(this,arguments)||this}return o.prototype.record=function(_,y){},o})(oie),iWt=(function(u){LI(o,u);function o(){return u!==null&&u.apply(this,arguments)||this}return o.prototype.record=function(_,y){},o})(oie),u6e=(function(){function u(){}return u.prototype.addCallback=function(o){},u.prototype.removeCallback=function(o){},u})(),aWt=(function(u){LI(o,u);function o(){return u!==null&&u.apply(this,arguments)||this}return o})(u6e),sWt=(function(u){LI(o,u);function o(){return u!==null&&u.apply(this,arguments)||this}return o})(u6e),oWt=(function(u){LI(o,u);function o(){return u!==null&&u.apply(this,arguments)||this}return o})(u6e),l6e=new eWt,cWt=new tWt,uWt=new nWt,lWt=new iWt,fWt=new rWt,_Wt=new aWt,pWt=new sWt,dWt=new oWt});var EM,yQe=Jo(()=>{(function(u){u[u.INT=0]="INT",u[u.DOUBLE=1]="DOUBLE"})(EM||(EM={}))});var cie,uie,_6e=Jo(()=>{cie={get:function(u,o){if(u!=null)return u[o]},keys:function(u){return u==null?[]:Object.keys(u)}},uie={set:function(u,o,_){u!=null&&(u[o]=_)}}});var mWt,hWt,vQe,bQe=Jo(()=>{rz();mWt=function(u,o){var _=typeof Symbol=="function"&&u[Symbol.iterator];if(!_)return u;var y=_.call(u),b,A=[],h;try{for(;(o===void 0||o-- >0)&&!(b=y.next()).done;)A.push(b.value)}catch(p){h={error:p}}finally{try{b&&!b.done&&(_=y.return)&&_.call(y)}finally{if(h)throw h.error}}return A},hWt=function(u,o,_){if(_||arguments.length===2)for(var y=0,b=o.length,A;y<b;y++)(A||!(y in o))&&(A||(A=Array.prototype.slice.call(o,0,y)),A[y]=o[y]);return u.concat(A||Array.prototype.slice.call(o))},vQe=(function(){function u(){}return u.prototype.active=function(){return sie},u.prototype.with=function(o,_,y){for(var b=[],A=3;A<arguments.length;A++)b[A-3]=arguments[A];return _.call.apply(_,hWt([y],mWt(b),!1))},u.prototype.bind=function(o,_){return _},u.prototype.enable=function(){return this},u.prototype.disable=function(){return this},u})()});var gWt,yWt,p6e,vWt,mN,nz=Jo(()=>{bQe();RI();MI();gWt=function(u,o){var _=typeof Symbol=="function"&&u[Symbol.iterator];if(!_)return u;var y=_.call(u),b,A=[],h;try{for(;(o===void 0||o-- >0)&&!(b=y.next()).done;)A.push(b.value)}catch(p){h={error:p}}finally{try{b&&!b.done&&(_=y.return)&&_.call(y)}finally{if(h)throw h.error}}return A},yWt=function(u,o,_){if(_||arguments.length===2)for(var y=0,b=o.length,A;y<b;y++)(A||!(y in o))&&(A||(A=Array.prototype.slice.call(o,0,y)),A[y]=o[y]);return u.concat(A||Array.prototype.slice.call(o))},p6e="context",vWt=new vQe,mN=(function(){function u(){}return u.getInstance=function(){return this._instance||(this._instance=new u),this._instance},u.prototype.setGlobalContextManager=function(o){return EC(p6e,o,ny.instance())},u.prototype.active=function(){return this._getContextManager().active()},u.prototype.with=function(o,_,y){for(var b,A=[],h=3;h<arguments.length;h++)A[h-3]=arguments[h];return(b=this._getContextManager()).with.apply(b,yWt([o,_,y],gWt(A),!1))},u.prototype.bind=function(o,_){return this._getContextManager().bind(o,_)},u.prototype._getContextManager=function(){return Xb(p6e)||vWt},u.prototype.disable=function(){this._getContextManager().disable(),CC(p6e,ny.instance())},u})()});var CM,d6e=Jo(()=>{(function(u){u[u.NONE=0]="NONE",u[u.SAMPLED=1]="SAMPLED"})(CM||(CM={}))});var iz,az,lie,fie=Jo(()=>{d6e();iz="0000000000000000",az="00000000000000000000000000000000",lie={traceId:az,spanId:iz,traceFlags:CM.NONE}});var hN,_ie=Jo(()=>{fie();hN=(function(){function u(o){o===void 0&&(o=lie),this._spanContext=o}return u.prototype.spanContext=function(){return this._spanContext},u.prototype.setAttribute=function(o,_){return this},u.prototype.setAttributes=function(o){return this},u.prototype.addEvent=function(o,_){return this},u.prototype.addLink=function(o){return this},u.prototype.addLinks=function(o){return this},u.prototype.setStatus=function(o){return this},u.prototype.updateName=function(o){return this},u.prototype.end=function(o){},u.prototype.isRecording=function(){return!1},u.prototype.recordException=function(o,_){},u})()});function pie(u){return u.getValue(m6e)||void 0}function SQe(){return pie(mN.getInstance().active())}function sz(u,o){return u.setValue(m6e,o)}function TQe(u){return u.deleteValue(m6e)}function xQe(u,o){return sz(u,new hN(o))}function die(u){var o;return(o=pie(u))===null||o===void 0?void 0:o.spanContext()}var m6e,h6e=Jo(()=>{rz();_ie();nz();m6e=xM("OpenTelemetry Context Key SPAN")});function g6e(u){return bWt.test(u)&&u!==az}function y6e(u){return SWt.test(u)&&u!==iz}function AM(u){return g6e(u.traceId)&&y6e(u.spanId)}function EQe(u){return new hN(u)}var bWt,SWt,mie=Jo(()=>{fie();_ie();bWt=/^([0-9a-f]{32})$/i,SWt=/^[0-9a-f]{16}$/i});function TWt(u){return typeof u=="object"&&typeof u.spanId=="string"&&typeof u.traceId=="strin