@earlyai/cli 2.16.3 → 2.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +58 -51
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -17,7 +17,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
17
17
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
18
18
|
- ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let o=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function l(e,t){let n=r.resolve(e,t);if(i.existsSync(n))return n;if(s.includes(r.extname(t)))return;let a=s.find(e=>i.existsSync(`${n}${e}`));if(a)return`${n}${a}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=i.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=r.resolve(r.dirname(e),d)}if(d){let t=l(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=l(d,`${n}-${e._name}`))}u=t||u}o=s.includes(r.extname(u));let f;a.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.execPath,t,{stdio:`inherit`})):o?(t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.argv[0],t,{stdio:`inherit`})):f=n.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{a.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new c(e,`commander.executeSubCommandAsync`,`(close)`)):a.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)a.exit(1);else{let e=new c(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-\d*\.?\d+(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
19
19
|
`),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new f(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=p(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=p(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>s(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=r.basename(e,r.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(a.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
20
|
-
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g}));const{program:j,createCommand:te,createArgument:M,createOption:N,CommanderError:P,InvalidArgumentError:F,InvalidOptionArgumentError:I,Command:L,Argument:ne,Option:R,Help:z}=u(s((e=>{let{Argument:t}=D(),{Command:n}=ee(),{CommanderError:r,InvalidArgumentError:i}=E(),{Help:a}=O(),{Option:o}=k();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;var re=`2.16.3`,ie=s((e=>{let t=e=>e!=null,n=e=>typeof e==`object`&&!!e,r=e=>Array.isArray(e),i=e=>e instanceof Map,a=e=>e instanceof Set,o=e=>e instanceof Date,s=e=>typeof e==`number`,c=e=>typeof e==`string`,l=e=>typeof e==`boolean`,u=e=>e instanceof Error,d=e=>t(e)?c(e)||r(e)?e.length===0:i(e)||a(e)?e.size===0:o(e)?!1:n(e)?Object.keys(e).length===0:!1:!0,f=e=>u(e)?e.message:`error is not Instance of Error`,p=(e,t)=>{let n=new Set(e);for(let e of n)t.includes(e)||n.delete(e);return[...n]},m=async(e,t)=>{let n=await Promise.all(e.map(e=>t(e)));return e.filter((e,t)=>n[t])},h=(e,t)=>{let n=[];for(let r of e)n.some(e=>t(r,e))||n.push(r);return n},g=e=>[...new Set(e)],_=async e=>Promise.all(e.map(e=>new Promise((t,n)=>e().then(e=>e?t(e):n(e)).catch(e=>n(e))))).then(()=>!0).catch(e=>{if(!l(e))throw e;return e}),v=e=>e.trim().replaceAll(/([\da-z])([A-Z])/g,`$1-$2`).replaceAll(/([A-Z])([A-Z][\da-z])/g,`$1-$2`).replaceAll(/[\s_]+/g,`-`).toLowerCase(),y=e=>e.replaceAll(/[\s-]+/g,` `).split(` `).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``),b=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n)??0;t=Math.trunc(t*31+r)}return t>>>0},x=(...e)=>{let n={};for(let r of e)for(let e in r)t(r[e])&&(n[e]=r[e]);return n},S=(e,t)=>r(e)?e.map(e=>S(e,t)):n(e)?Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)).map(([e,n])=>[e,S(n,t)])):e,C=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},w=(e,t)=>{let n=!1;return(...r)=>{n||(e(...r),n=!0,setTimeout(()=>{n=!1},t))}};var T=class{listeners=[];addListener(e){this.listeners.push(e)}notifyAll(e){for(let t of this.listeners)t(e)}clear(){this.listeners.length=0}},E=class{set=new Set;constructor(e=[]){for(let t of e)this.safeAdd(t)}safeAdd(e){return t(e)?(this.set.add(e),!0):!1}has(e){return t(e)?this.set.has(e):!1}delete(e){return t(e)?this.set.delete(e):!1}clear(){this.set.clear()}get size(){return this.set.size}values(){return this.set.values()}toSet(){return structuredClone(this.set)}[Symbol.iterator](){return this.set[Symbol.iterator]()}concatSet(e){for(let t of e)this.safeAdd(t)}};e.Observer=T,e.SafeSet=E,e.arePromiseFnsTruthy=_,e.debounce=C,e.fastHash=b,e.filterAsync=m,e.getErrorMessage=f,e.intersection=p,e.isArray=r,e.isBoolean=l,e.isDate=o,e.isDefined=t,e.isEmpty=d,e.isError=u,e.isMap=i,e.isNumber=s,e.isObject=n,e.isSet=a,e.isString=c,e.merge=x,e.removeNestedField=S,e.throttle=w,e.toCamelCase=y,e.toKebabCase=v,e.uniq=g,e.uniqWith=h})),B=ie();function V(e,t,n,{key:r=``,prefix:i=`EARLY`,parser:a,def:o,isRequired:s=!1,envName:c}={}){let l=new R(t,n);a&&l.argParser(a),s&&l.makeOptionMandatory(!0);let u=c??(()=>{let n=[];for(let t=e;t&&(0,B.isDefined)(t.name());t=t.parent)t.parent&&n.unshift(t.name());return[i,...n,r||t.split(/[ ,|]/)[1].replace(/^--?/,``)].join(`_`).replaceAll(/[- ]/g,`_`).toUpperCase()})();return l.env(u),(0,B.isDefined)(o)&&l.default(o),e.addOption(l),l}function ae(e){return(typeof e==`object`&&!!e||typeof e==`function`)&&typeof e.then==`function`}function oe(e){switch(typeof e){case`string`:case`symbol`:return e.toString();case`function`:return e.name;default:throw Error(`Unexpected ${typeof e} service id type`)}}const se=Symbol.for(`@inversifyjs/common/islazyServiceIdentifier`);var ce=class{[se];#e;constructor(e){this.#e=e,this[se]=!0}static is(e){return typeof e==`object`&&!!e&&!0===e[se]}unwrap(){return this.#e()}};function le(e,t,n){return Reflect.getOwnMetadata(t,e,n)}function ue(e,t,n,r){Reflect.defineMetadata(t,n,e,r)}function de(e,t,n,r,i){let a=r(le(e,t,i)??n());Reflect.defineMetadata(t,a,e,i)}function fe(e){return Object.getPrototypeOf(e.prototype)?.constructor}const pe=`@inversifyjs/container/bindingId`;function me(){let e=le(Object,pe)??0;return e===2**53-1?ue(Object,pe,-(2**53-1)):de(Object,pe,()=>e,e=>e+1),e}const he={Request:`Request`,Singleton:`Singleton`,Transient:`Transient`},ge={ConstantValue:`ConstantValue`,DynamicValue:`DynamicValue`,Factory:`Factory`,Instance:`Instance`,Provider:`Provider`,ResolvedValue:`ResolvedValue`,ServiceRedirection:`ServiceRedirection`};function*_e(...e){for(let t of e)yield*t}var ve=class e{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(let t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#a(e).push(t);for(let n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){let e=this.#r(),t=this.#i(),n=Reflect.ownKeys(this.#n),r=this._buildNewInstance(this.#n);this.#u(this.#e,r.#e,e,t);for(let t of n)this.#l(this.#t[t],r.#t[t],e);return r}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){let n=this.get(e,t);if(n===void 0)return;let r=new Set(n);for(let n of r){let r=this.#e.get(n);if(r===void 0)throw Error(`Expecting model relation, none found`);for(let i of r)i[e]===t&&this.#d(n,i);this.#e.delete(n)}}_buildNewInstance(t){return new e(t)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){let e=new Map;for(let t of this.#e.keys()){let n=this._cloneModel(t);e.set(t,n)}return e}#i(){let e=new Map;for(let t of this.#e.values())for(let n of t){let t=this._cloneRelation(n);e.set(n,t)}return e}#a(e){let t=this.#e.get(e);return t===void 0&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return n===void 0&&(n=[],this.#t[e].set(t,n)),n}#s(e,t){let n=t.get(e);if(n===void 0)throw Error(`Expecting model to be cloned, none found`);return n}#c(e,t){let n=t.get(e);if(n===void 0)throw Error(`Expecting relation to be cloned, none found`);return n}#l(e,t,n){for(let[r,i]of e){let e=[];for(let t of i)e.push(this.#s(t,n));t.set(r,e)}}#u(e,t,n,r){for(let[i,a]of e){let e=[];for(let t of a)e.push(this.#c(t,r));t.set(this.#s(i,n),e)}}#d(e,t){for(let n of Reflect.ownKeys(t))this.#f(e,n,t[n])}#f(e,t,n){let r=this.#t[t].get(n);if(r!==void 0){let i=r.indexOf(e);i!==-1&&r.splice(i,1),r.length===0&&this.#t[t].delete(n)}}},ye;(function(e){e.moduleId=`moduleId`,e.serviceId=`serviceId`})(ye||={});var be=class e{#e;#t;constructor(e,t){this.#e=t??new ve({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#t=e}static build(t){return new e(t)}add(e,t){this.#e.add(e,t)}clone(){return new e(this.#t,this.#e.clone())}get(e){let t=[],n=this.#e.get(ye.serviceId,e);n!==void 0&&t.push(n);let r=this.#t()?.get(e);if(r!==void 0&&t.push(r),t.length!==0)return _e(...t)}removeAllByModuleId(e){this.#e.removeByRelation(ye.moduleId,e)}removeAllByServiceId(e){this.#e.removeByRelation(ye.serviceId,e)}};const xe=`@inversifyjs/core/classMetadataReflectKey`;function Se(){return{constructorArguments:[],lifecycle:{postConstructMethodNames:new Set,preDestroyMethodNames:new Set},properties:new Map,scope:void 0}}const Ce=`@inversifyjs/core/pendingClassMetadataCountReflectKey`,we=Symbol.for(`@inversifyjs/core/InversifyCoreError`);var Te=class e extends Error{[we];kind;constructor(e,t,n){super(t,n),this[we]=!0,this.kind=e}static is(e){return typeof e==`object`&&!!e&&!0===e[we]}static isErrorOfKind(t,n){return e.is(t)&&t.kind===n}},Ee,De,Oe,ke,Ae;function je(e){let t=le(e,xe)??Se();if(!function(e){let t=le(e,Ce);return t!==void 0&&t!==0}(e))return function(e,t){let n=[];if(t.length<e.length)throw new Te(Ee.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<t.length;++e)t[e]===void 0&&n.push(e);if(n.length>0)throw new Te(Ee.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join(`", "`)}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,t.constructorArguments),t;(function(e,t){let n=[];for(let r=0;r<t.constructorArguments.length;++r){let i=t.constructorArguments[r];i!==void 0&&i.kind!==De.unknown||n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${r.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(let[r,i]of t.properties)i.kind===De.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${r.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);throw n.length===0?new Te(Ee.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`):new Te(Ee.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\n\n${n.join(`
|
|
20
|
+
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g}));const{program:j,createCommand:te,createArgument:M,createOption:N,CommanderError:P,InvalidArgumentError:F,InvalidOptionArgumentError:I,Command:L,Argument:ne,Option:R,Help:z}=u(s((e=>{let{Argument:t}=D(),{Command:n}=ee(),{CommanderError:r,InvalidArgumentError:i}=E(),{Help:a}=O(),{Option:o}=k();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;var re=`2.16.4`,ie=s((e=>{let t=e=>e!=null,n=e=>typeof e==`object`&&!!e,r=e=>Array.isArray(e),i=e=>e instanceof Map,a=e=>e instanceof Set,o=e=>e instanceof Date,s=e=>typeof e==`number`,c=e=>typeof e==`string`,l=e=>typeof e==`boolean`,u=e=>e instanceof Error,d=e=>t(e)?c(e)||r(e)?e.length===0:i(e)||a(e)?e.size===0:o(e)?!1:n(e)?Object.keys(e).length===0:!1:!0,f=e=>u(e)?e.message:`error is not Instance of Error`,p=(e,t)=>{let n=new Set(e);for(let e of n)t.includes(e)||n.delete(e);return[...n]},m=async(e,t)=>{let n=await Promise.all(e.map(e=>t(e)));return e.filter((e,t)=>n[t])},h=(e,t)=>{let n=[];for(let r of e)n.some(e=>t(r,e))||n.push(r);return n},g=e=>[...new Set(e)],_=async e=>Promise.all(e.map(e=>new Promise((t,n)=>e().then(e=>e?t(e):n(e)).catch(e=>n(e))))).then(()=>!0).catch(e=>{if(!l(e))throw e;return e}),v=e=>e.trim().replaceAll(/([\da-z])([A-Z])/g,`$1-$2`).replaceAll(/([A-Z])([A-Z][\da-z])/g,`$1-$2`).replaceAll(/[\s_]+/g,`-`).toLowerCase(),y=e=>e.replaceAll(/[\s-]+/g,` `).split(` `).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``),b=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n)??0;t=Math.trunc(t*31+r)}return t>>>0},x=(...e)=>{let n={};for(let r of e)for(let e in r)t(r[e])&&(n[e]=r[e]);return n},S=(e,t)=>r(e)?e.map(e=>S(e,t)):n(e)?Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)).map(([e,n])=>[e,S(n,t)])):e,C=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},w=(e,t)=>{let n=!1;return(...r)=>{n||(e(...r),n=!0,setTimeout(()=>{n=!1},t))}};var T=class{listeners=[];addListener(e){this.listeners.push(e)}notifyAll(e){for(let t of this.listeners)t(e)}clear(){this.listeners.length=0}},E=class{set=new Set;constructor(e=[]){for(let t of e)this.safeAdd(t)}safeAdd(e){return t(e)?(this.set.add(e),!0):!1}has(e){return t(e)?this.set.has(e):!1}delete(e){return t(e)?this.set.delete(e):!1}clear(){this.set.clear()}get size(){return this.set.size}values(){return this.set.values()}toSet(){return structuredClone(this.set)}[Symbol.iterator](){return this.set[Symbol.iterator]()}concatSet(e){for(let t of e)this.safeAdd(t)}};e.Observer=T,e.SafeSet=E,e.arePromiseFnsTruthy=_,e.debounce=C,e.fastHash=b,e.filterAsync=m,e.getErrorMessage=f,e.intersection=p,e.isArray=r,e.isBoolean=l,e.isDate=o,e.isDefined=t,e.isEmpty=d,e.isError=u,e.isMap=i,e.isNumber=s,e.isObject=n,e.isSet=a,e.isString=c,e.merge=x,e.removeNestedField=S,e.throttle=w,e.toCamelCase=y,e.toKebabCase=v,e.uniq=g,e.uniqWith=h})),B=ie();function V(e,t,n,{key:r=``,prefix:i=`EARLY`,parser:a,def:o,isRequired:s=!1,envName:c}={}){let l=new R(t,n);a&&l.argParser(a),s&&l.makeOptionMandatory(!0);let u=c??(()=>{let n=[];for(let t=e;t&&(0,B.isDefined)(t.name());t=t.parent)t.parent&&n.unshift(t.name());return[i,...n,r||t.split(/[ ,|]/)[1].replace(/^--?/,``)].join(`_`).replaceAll(/[- ]/g,`_`).toUpperCase()})();return l.env(u),(0,B.isDefined)(o)&&l.default(o),e.addOption(l),l}function ae(e){return(typeof e==`object`&&!!e||typeof e==`function`)&&typeof e.then==`function`}function oe(e){switch(typeof e){case`string`:case`symbol`:return e.toString();case`function`:return e.name;default:throw Error(`Unexpected ${typeof e} service id type`)}}const se=Symbol.for(`@inversifyjs/common/islazyServiceIdentifier`);var ce=class{[se];#e;constructor(e){this.#e=e,this[se]=!0}static is(e){return typeof e==`object`&&!!e&&!0===e[se]}unwrap(){return this.#e()}};function le(e,t,n){return Reflect.getOwnMetadata(t,e,n)}function ue(e,t,n,r){Reflect.defineMetadata(t,n,e,r)}function de(e,t,n,r,i){let a=r(le(e,t,i)??n());Reflect.defineMetadata(t,a,e,i)}function fe(e){return Object.getPrototypeOf(e.prototype)?.constructor}const pe=`@inversifyjs/container/bindingId`;function me(){let e=le(Object,pe)??0;return e===2**53-1?ue(Object,pe,-(2**53-1)):de(Object,pe,()=>e,e=>e+1),e}const he={Request:`Request`,Singleton:`Singleton`,Transient:`Transient`},ge={ConstantValue:`ConstantValue`,DynamicValue:`DynamicValue`,Factory:`Factory`,Instance:`Instance`,Provider:`Provider`,ResolvedValue:`ResolvedValue`,ServiceRedirection:`ServiceRedirection`};function*_e(...e){for(let t of e)yield*t}var ve=class e{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(let t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#a(e).push(t);for(let n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){let e=this.#r(),t=this.#i(),n=Reflect.ownKeys(this.#n),r=this._buildNewInstance(this.#n);this.#u(this.#e,r.#e,e,t);for(let t of n)this.#l(this.#t[t],r.#t[t],e);return r}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){let n=this.get(e,t);if(n===void 0)return;let r=new Set(n);for(let n of r){let r=this.#e.get(n);if(r===void 0)throw Error(`Expecting model relation, none found`);for(let i of r)i[e]===t&&this.#d(n,i);this.#e.delete(n)}}_buildNewInstance(t){return new e(t)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){let e=new Map;for(let t of this.#e.keys()){let n=this._cloneModel(t);e.set(t,n)}return e}#i(){let e=new Map;for(let t of this.#e.values())for(let n of t){let t=this._cloneRelation(n);e.set(n,t)}return e}#a(e){let t=this.#e.get(e);return t===void 0&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return n===void 0&&(n=[],this.#t[e].set(t,n)),n}#s(e,t){let n=t.get(e);if(n===void 0)throw Error(`Expecting model to be cloned, none found`);return n}#c(e,t){let n=t.get(e);if(n===void 0)throw Error(`Expecting relation to be cloned, none found`);return n}#l(e,t,n){for(let[r,i]of e){let e=[];for(let t of i)e.push(this.#s(t,n));t.set(r,e)}}#u(e,t,n,r){for(let[i,a]of e){let e=[];for(let t of a)e.push(this.#c(t,r));t.set(this.#s(i,n),e)}}#d(e,t){for(let n of Reflect.ownKeys(t))this.#f(e,n,t[n])}#f(e,t,n){let r=this.#t[t].get(n);if(r!==void 0){let i=r.indexOf(e);i!==-1&&r.splice(i,1),r.length===0&&this.#t[t].delete(n)}}},ye;(function(e){e.moduleId=`moduleId`,e.serviceId=`serviceId`})(ye||={});var be=class e{#e;#t;constructor(e,t){this.#e=t??new ve({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#t=e}static build(t){return new e(t)}add(e,t){this.#e.add(e,t)}clone(){return new e(this.#t,this.#e.clone())}get(e){let t=[],n=this.#e.get(ye.serviceId,e);n!==void 0&&t.push(n);let r=this.#t()?.get(e);if(r!==void 0&&t.push(r),t.length!==0)return _e(...t)}removeAllByModuleId(e){this.#e.removeByRelation(ye.moduleId,e)}removeAllByServiceId(e){this.#e.removeByRelation(ye.serviceId,e)}};const xe=`@inversifyjs/core/classMetadataReflectKey`;function Se(){return{constructorArguments:[],lifecycle:{postConstructMethodNames:new Set,preDestroyMethodNames:new Set},properties:new Map,scope:void 0}}const Ce=`@inversifyjs/core/pendingClassMetadataCountReflectKey`,we=Symbol.for(`@inversifyjs/core/InversifyCoreError`);var Te=class e extends Error{[we];kind;constructor(e,t,n){super(t,n),this[we]=!0,this.kind=e}static is(e){return typeof e==`object`&&!!e&&!0===e[we]}static isErrorOfKind(t,n){return e.is(t)&&t.kind===n}},Ee,De,Oe,ke,Ae;function je(e){let t=le(e,xe)??Se();if(!function(e){let t=le(e,Ce);return t!==void 0&&t!==0}(e))return function(e,t){let n=[];if(t.length<e.length)throw new Te(Ee.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<t.length;++e)t[e]===void 0&&n.push(e);if(n.length>0)throw new Te(Ee.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join(`", "`)}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,t.constructorArguments),t;(function(e,t){let n=[];for(let r=0;r<t.constructorArguments.length;++r){let i=t.constructorArguments[r];i!==void 0&&i.kind!==De.unknown||n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${r.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(let[r,i]of t.properties)i.kind===De.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${r.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);throw n.length===0?new Te(Ee.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`):new Te(Ee.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\n\n${n.join(`
|
|
21
21
|
|
|
22
22
|
`)}`)})(e,t)}function Me(e,t){let n=je(t).scope??e.scope;return{cache:{isRight:!1,value:void 0},id:me(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:n,serviceIdentifier:t,type:ge.Instance}}function Ne(e){return e.isRight?{isRight:!0,value:e.value}:e}function Pe(e){switch(e.type){case ge.ConstantValue:case ge.DynamicValue:return function(e){return{cache:Ne(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case ge.Factory:return function(e){return{cache:Ne(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case ge.Instance:return function(e){return{cache:Ne(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case ge.Provider:return function(e){return{cache:Ne(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case ge.ResolvedValue:return function(e){return{cache:Ne(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case ge.ServiceRedirection:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}(function(e){e[e.injectionDecoratorConflict=0]=`injectionDecoratorConflict`,e[e.missingInjectionDecorator=1]=`missingInjectionDecorator`,e[e.planning=2]=`planning`,e[e.resolution=3]=`resolution`,e[e.unknown=4]=`unknown`})(Ee||={}),function(e){e[e.unknown=32]=`unknown`}(De||={}),function(e){e.id=`id`,e.moduleId=`moduleId`,e.serviceId=`serviceId`}(Oe||={});var Fe=class e extends ve{_buildNewInstance(t){return new e(t)}_cloneModel(e){return Pe(e)}},Ie=class e{#e;#t;#n;constructor(e,t,n){this.#t=n??new Fe({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#n=e,this.#e=t}static build(t,n){return new e(t,n)}clone(){return new e(this.#n,this.#e,this.#t.clone())}get(e){let t=this.getNonParentBindings(e)??this.#n()?.get(e);if(t!==void 0)return t;let n=this.#r(e);return n===void 0?n:[n]}*getChained(e){let t=this.getNonParentBindings(e);t!==void 0&&(yield*t);let n=this.#n();if(n===void 0){if(t===void 0){let t=this.#r(e);t!==void 0&&(yield t)}}else yield*n.getChained(e)}getBoundServices(){let e=new Set(this.#t.getAllKeys(Oe.serviceId)),t=this.#n();if(t!==void 0)for(let n of t.getBoundServices())e.add(n);return e}getById(e){return this.#t.get(Oe.id,e)??this.#n()?.getById(e)}getByModuleId(e){return this.#t.get(Oe.moduleId,e)??this.#n()?.getByModuleId(e)}getNonParentBindings(e){return this.#t.get(Oe.serviceId,e)}getNonParentBoundServices(){return this.#t.getAllKeys(Oe.serviceId)}removeById(e){this.#t.removeByRelation(Oe.id,e)}removeAllByModuleId(e){this.#t.removeByRelation(Oe.moduleId,e)}removeAllByServiceId(e){this.#t.removeByRelation(Oe.serviceId,e)}set(e){let t={[Oe.id]:e.id,[Oe.serviceId]:e.serviceIdentifier};e.moduleId!==void 0&&(t[Oe.moduleId]=e.moduleId),this.#t.add(e,t)}#r(e){if(this.#e===void 0||typeof e!=`function`)return;let t=Me(this.#e,e);return this.set(t),t}};(function(e){e.moduleId=`moduleId`,e.serviceId=`serviceId`})(ke||={});var Le=class e{#e;#t;constructor(e,t){this.#e=t??new ve({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#t=e}static build(t){return new e(t)}add(e,t){this.#e.add(e,t)}clone(){return new e(this.#t,this.#e.clone())}get(e){let t=[],n=this.#e.get(ke.serviceId,e);n!==void 0&&t.push(n);let r=this.#t()?.get(e);if(r!==void 0&&t.push(r),t.length!==0)return _e(...t)}removeAllByModuleId(e){this.#e.removeByRelation(ke.moduleId,e)}removeAllByServiceId(e){this.#e.removeByRelation(ke.serviceId,e)}};function Re(){return 0}function ze(e){return t=>{t!==void 0&&t.kind===De.unknown&&de(e,Ce,Re,e=>e-1)}}function Be(e,t){return(...n)=>r=>{if(r===void 0)return e(...n);if(r.kind===Ae.unmanaged)throw new Te(Ee.injectionDecoratorConflict,`Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found`);return t(r,...n)}}function Ve(e){if(e.kind!==De.unknown&&!0!==e.isFromTypescriptParamType)throw new Te(Ee.injectionDecoratorConflict,`Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found`)}(function(e){e[e.multipleInjection=0]=`multipleInjection`,e[e.singleInjection=1]=`singleInjection`,e[e.unmanaged=2]=`unmanaged`})(Ae||={});const H=Be(function(e,t,n){return e===Ae.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,r){return Ve(e),t===Ae.multipleInjection?{...e,chained:r?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function He(e,t){return n=>{let r=n.properties.get(t);return n.properties.set(t,e(r)),n}}var Ue;function We(e,t,n,r){if(Te.isErrorOfKind(r,Ee.injectionDecoratorConflict)){let i=function(e,t,n){if(n===void 0){if(t===void 0)throw new Te(Ee.unknown,`Unexpected undefined property and index values`);return{kind:Ue.property,property:t,targetClass:e.constructor}}return typeof n==`number`?{index:n,kind:Ue.parameter,targetClass:e}:{kind:Ue.method,method:t,targetClass:e}}(e,t,n);throw new Te(Ee.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${r.message}\n\nDetails\n\n${function(e){switch(e.kind){case Ue.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case Ue.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case Ue.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(i)}`,{cause:r})}throw r}function Ge(e,t){return(n,r,i)=>{try{i===void 0?function(e,t){let n=Ke(e,t);return(e,t)=>{de(e.constructor,xe,Se,He(n(e),t))}}(e,t)(n,r):typeof i==`number`?function(e,t){let n=Ke(e,t);return(e,t,r)=>{if(!function(e,t){return typeof e==`function`&&t===void 0}(e,t))throw new Te(Ee.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${t?.toString()??``}" at class "${e.constructor.name}"`);de(e,xe,Se,function(e,t){return n=>{let r=n.constructorArguments[t];return n.constructorArguments[t]=e(r),n}}(n(e),r))}}(e,t)(n,r,i):function(e,t){let n=Ke(e,t);return(e,t,r)=>{if(!function(e){return e.set!==void 0}(r))throw new Te(Ee.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${t.toString()}" at class "${e.constructor.name}"`);de(e.constructor,xe,Se,He(n(e),t))}}(e,t)(n,r,i)}catch(e){We(n,r,i,e)}}}function Ke(e,t){return n=>{let r=t(n);return t=>(r(t),e(t))}}function qe(e){return Ge(H(Ae.singleInjection,e),ze)}(function(e){e[e.method=0]=`method`,e[e.parameter=1]=`parameter`,e[e.property=2]=`property`})(Ue||={});const Je=`@inversifyjs/core/classIsInjectableFlagReflectKey`,Ye=[Array,BigInt,Boolean,Function,Number,Object,String];function Xe(e){let t=le(e,`design:paramtypes`);t!==void 0&&de(e,xe,Se,function(e){return t=>(e.forEach((e,n)=>{var r;t.constructorArguments[n]!==void 0||(r=e,Ye.includes(r))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:Ae.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))}),t)}(t))}function Ze(e){return t=>{(function(e){if(le(e,Je)!==void 0)throw new Te(Ee.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${e.name}"`);ue(e,Je,!0)})(t),Xe(t),e!==void 0&&de(t,xe,Se,t=>({...t,scope:e}))}}function Qe(e,t,n){let r;return e.extendConstructorArguments??!0?(r=[...t.constructorArguments],n.constructorArguments.map((e,t)=>{r[t]=e})):r=n.constructorArguments,r}function $e(e,t,n){return e?new Set([...t,...n]):n}function et(e,t,n){let r=e.lifecycle?.extendPostConstructMethods??!0,i=$e(e.lifecycle?.extendPreDestroyMethods??!0,t.lifecycle.preDestroyMethodNames,n.lifecycle.preDestroyMethodNames);return{postConstructMethodNames:$e(r,t.lifecycle.postConstructMethodNames,n.lifecycle.postConstructMethodNames),preDestroyMethodNames:i}}function tt(e,t,n){let r;return r=e.extendProperties??!0?new Map(_e(t.properties,n.properties)):n.properties,r}function nt(e){return t=>{de(t,xe,Se,function(e,t){return n=>({constructorArguments:Qe(e,t,n),lifecycle:et(e,t,n),properties:tt(e,t,n),scope:n.scope})}(e,je(e.type)))}}function rt(e){return t=>{let n=fe(t);if(n===void 0)throw new Te(Ee.injectionDecoratorConflict,`Expected base type for type "${t.name}", none found.`);nt({...e,type:n})(t)}}function it(e){return t=>{let n=[],r=fe(t);for(;r!==void 0&&r!==Object;){let e=r;n.push(e),r=fe(e)}n.reverse();for(let r of n)nt({...e,type:r})(t)}}function at(e){return t=>{t===void 0&&de(e,Ce,Re,e=>e+1)}}function ot(e){return t=>{let n=t??{kind:De.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===Ae.unmanaged)throw new Te(Ee.injectionDecoratorConflict,`Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections`);return e(n)}}function st(e){if(e.optional)throw new Te(Ee.injectionDecoratorConflict,`Unexpected duplicated optional decorator`);return e.optional=!0,e}function U(){return Ge(ot(st),at)}var ct;function lt(e){return e instanceof Error?e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||e.name===`InternalError`&&/too much recursion/.test(e.message):!1}function ut(e,t){if(lt(t)){let n=function(e){let t=[...e];return t.length===0?`(No dependency trace)`:t.map(oe).join(` -> `)}(function(e){let t=new Set;for(let n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new Te(Ee.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}(function(e){e[e.multipleInjection=0]=`multipleInjection`,e[e.singleInjection=1]=`singleInjection`})(ct||={});const dt=Symbol.for(`@inversifyjs/core/LazyPlanServiceNode`);var ft=class{[dt];_serviceIdentifier;_serviceNode;constructor(e,t){this[dt]=!0,this._serviceNode=e,this._serviceIdentifier=t}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return typeof e==`object`&&!!e&&!0===e[dt]}invalidate(){this._serviceNode=void 0}isExpanded(){return this._serviceNode!==void 0}_getNode(){return this._serviceNode===void 0&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}},pt=class e{#e;constructor(e){this.#e=e}get name(){return this.#e.elem.name}get serviceIdentifier(){return this.#e.elem.serviceIdentifier}get tags(){return this.#e.elem.tags}getAncestor(){if(this.#e.elem.getAncestorsCalled=!0,this.#e.previous!==void 0)return new e(this.#e.previous)}};function mt(e,t,n){let r=n?.customServiceIdentifier??t.serviceIdentifier,i=(!0===n?.chained?[...e.operations.getBindingsChained(r)]:[...e.operations.getBindings(r)??[]]).filter(e=>e.isSatisfiedBy(t));if(i.length===0&&e.autobindOptions!==void 0&&typeof r==`function`){let n=Me(e.autobindOptions,r);e.operations.setBinding(n),n.isSatisfiedBy(t)&&i.push(n)}return i}var ht=class e{last;constructor(e){this.last=e}concat(t){return new e({elem:t,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(e===void 0)return{done:!0,value:void 0};let t=e.elem;return e=e.previous,{done:!1,value:t}}}}};function gt(e){let t=new Map;return e.rootConstraints.tag!==void 0&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new ht({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}function _t(e){return e.redirections!==void 0}function vt(e,t,n,r){let i=n.elem.serviceIdentifier,a=n.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,n,r,i,a){if(e.length!==0){let t=`Ambiguous bindings found for service: "${oe(a[a.length-1]??n)}".${St(a)}\n\nRegistered bindings:\n\n${e.map(e=>function(e){switch(e.type){case ge.Instance:return`[ type: "${e.type}", serviceIdentifier: "${oe(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case ge.ServiceRedirection:return`[ type: "${e.type}", serviceIdentifier: "${oe(e.serviceIdentifier)}", redirection: "${oe(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${oe(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding)).join(`
|
|
23
23
|
`)}\n\nTrying to resolve bindings for "${bt(n,r)}".${xt(i)}`;throw new Te(Ee.planning,t)}t||yt(n,r,i,a)}(e,t,i,a,n.elem,r):function(e,t,n,r,i,a){e!==void 0||t||yt(n,r,i,a)}(e,t,i,a,n.elem,r)}function yt(e,t,n,r){let i=`No bindings found for service: "${oe(r[r.length-1]??e)}".\n\nTrying to resolve bindings for "${bt(e,t)}".${St(r)}${xt(n)}`;throw new Te(Ee.planning,i)}function bt(e,t){return t===void 0?`${oe(e)} (Root service)`:oe(t)}function xt(e){let t=e.tags.size===0?``:`\n- tags:\n - ${[...e.tags.keys()].map(e=>e.toString()).join(`
|
|
@@ -115,18 +115,18 @@ Binding constraints:
|
|
|
115
115
|
To resolve the conflict:`,(0,r.getConflictResolutionRecipe)(i,e))),a=o):n.diag.warn(`A view or instrument with the name `,e.name,` has already been registered and is incompatible with another registered view.
|
|
116
116
|
`,`Details:
|
|
117
117
|
`,(0,r.getIncompatibilityDetails)(i,e),`To resolve the conflict:
|
|
118
|
-
`,(0,r.getConflictResolutionRecipe)(i,e))}return a}}})),AI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MultiMetricStorage=void 0,e.MultiMetricStorage=class{_backingStorages;constructor(e){this._backingStorages=e}record(e,t,n,r){this._backingStorages.forEach(i=>{i.record(e,t,n,r)})}}})),jI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchObservableResultImpl=e.ObservableResultImpl=void 0;let t=(Jd(),d(Kd)),n=wI(),r=xI();e.ObservableResultImpl=class{_instrumentName;_valueType;_buffer=new n.AttributeHashMap;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,n={}){if(typeof e!=`number`){t.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===t.ValueType.INT&&!Number.isInteger(e)&&(t.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(n,e)}},e.BatchObservableResultImpl=class{_buffer=new Map;observe(e,i,a={}){if(!(0,r.isObservableInstrument)(e))return;let o=this._buffer.get(e);if(o??(o=new n.AttributeHashMap,this._buffer.set(e,o)),typeof i!=`number`){t.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${i}`);return}e._descriptor.valueType===t.ValueType.INT&&!Number.isInteger(i)&&(t.diag.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),i=Math.trunc(i),!Number.isInteger(i))||o.set(a,i)}}})),MI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ObservableRegistry=void 0;let t=(Jd(),d(Kd)),n=xI(),r=jI(),i=ZF();e.ObservableRegistry=class{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,r){let i=new Set(r.filter(n.isObservableInstrument));if(i.size===0){t.diag.error(`BatchObservableCallback is not associated with valid instruments`,r);return}this._findBatchCallback(e,i)>=0||this._batchCallbacks.push({callback:e,instruments:i})}removeBatchCallback(e,t){let r=new Set(t.filter(n.isObservableInstrument)),i=this._findBatchCallback(e,r);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let n=this._observeCallbacks(e,t),r=this._observeBatchCallbacks(e,t);return(await(0,i.PromiseAllSettled)([...n,...r])).filter(i.isPromiseAllSettledRejectionResult).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:a})=>{let o=new r.ObservableResultImpl(a._descriptor.name,a._descriptor.valueType),s=Promise.resolve(n(o));t!=null&&(s=(0,i.callWithTimeout)(s,t)),await s,a._metricStorages.forEach(t=>{t.record(o._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:a})=>{let o=new r.BatchObservableResultImpl,s=Promise.resolve(n(o));t!=null&&(s=(0,i.callWithTimeout)(s,t)),await s,a.forEach(t=>{let n=o._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&(0,i.setEquals)(n.instruments,t))}}})),NI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SyncMetricStorage=void 0;let t=CI(),n=TI(),r=EI();e.SyncMetricStorage=class extends t.MetricStorage{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(e,t,i,a,o){super(e),this._attributesProcessor=i,this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new n.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new r.TemporalMetricProcessor(t,a)}record(e,t,n,r){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}})),PI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDenyListAttributesProcessor=e.createAllowListAttributesProcessor=e.createMultiAttributesProcessor=e.createNoopAttributesProcessor=void 0;var t=class{process(e,t){return e}},n=class{_processors;constructor(e){this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}},r=class{_allowedAttributeNames;constructor(e){this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(e=>this._allowedAttributeNames.includes(e)).forEach(t=>n[t]=e[t]),n}},i=class{_deniedAttributeNames;constructor(e){this._deniedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(e=>!this._deniedAttributeNames.includes(e)).forEach(t=>n[t]=e[t]),n}};function a(){return l}e.createNoopAttributesProcessor=a;function o(e){return new n(e)}e.createMultiAttributesProcessor=o;function s(e){return new r(e)}e.createAllowListAttributesProcessor=s;function c(e){return new i(e)}e.createDenyListAttributesProcessor=c;let l=new t})),FI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSharedState=void 0;let t=bI(),n=SI(),r=ZF(),i=DI(),a=kI(),o=AI(),s=MI(),c=NI(),l=PI();e.MeterSharedState=class{_meterProviderSharedState;_instrumentationScope;metricStorageRegistry=new a.MetricStorageRegistry;observableRegistry=new s.ObservableRegistry;meter;constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.meter=new n.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,c.SyncMetricStorage);return t.length===1?t[0]:new o.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,i.AsyncMetricStorage)}async collect(e,t,n){let i=await this.observableRegistry.observe(t,n?.timeoutMillis),a=this.metricStorageRegistry.getStorages(e);if(a.length===0)return null;let o=a.map(n=>n.collect(e,t)).filter(r.isNotNullish);return o.length===0?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:o},errors:i}}_registerMetricStorage(e,n){let r=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(r=>{let i=(0,t.createInstrumentDescriptorWithView)(r,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(a!=null)return a;let o=new n(i,r.aggregation.createAggregator(i),r.attributesProcessor,this._meterProviderSharedState.metricCollectors,r.aggregationCardinalityLimit);return this.metricStorageRegistry.register(o),o});if(r.length===0){let t=this._meterProviderSharedState.selectAggregations(e.type).map(([t,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(t,e);if(i!=null)return i;let a=r.createAggregator(e),o=t.selectCardinalityLimit(e.type),s=new n(e,a,(0,l.createNoopAttributesProcessor)(),[t],o);return this.metricStorageRegistry.registerForCollector(t,s),s});r=r.concat(t)}return r}}})),II=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterProviderSharedState=void 0;let t=ZF(),n=yI(),r=FI(),i=pI();e.MeterProviderSharedState=class{resource;viewRegistry=new n.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;constructor(e){this.resource=e}getMeterSharedState(e){let n=(0,t.instrumentationScopeId)(e),i=this.meterSharedStates.get(n);return i??(i=new r.MeterSharedState(this,e),this.meterSharedStates.set(n,i)),i}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,(0,i.toAggregation)(n.selectAggregation(e))]);return t}}})),LI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricCollector=void 0;let t=tj();e.MetricCollector=class{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let n=(0,t.millisToHrTime)(Date.now()),r=[],i=[],a=Array.from(this._sharedState.meterSharedStates.values()).map(async t=>{let a=await t.collect(this,n,e);a?.scopeMetrics!=null&&r.push(a.scopeMetrics),a?.errors!=null&&i.push(...a.errors)});return await Promise.all(a),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:r},errors:i}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}}})),RI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExactPredicate=e.PatternPredicate=void 0;let t=/[\^$\\.+?()[\]{}|]/g;e.PatternPredicate=class e{_matchAll;_regexp;constructor(t){t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(t,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},e.ExactPredicate=class{_matchAll;_pattern;constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}}})),aee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InstrumentSelector=void 0;let t=RI();e.InstrumentSelector=class{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new t.PatternPredicate(e?.name??`*`),this._type=e?.type,this._unitFilter=new t.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}})),zI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSelector=void 0;let t=RI();e.MeterSelector=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new t.ExactPredicate(e?.name),this._versionFilter=new t.ExactPredicate(e?.version),this._schemaUrlFilter=new t.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}})),BI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.View=void 0;let t=RI(),n=PI(),r=aee(),i=zI(),a=pI();function o(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function s(e){if(o(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||t.PatternPredicate.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}e.View=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){s(e),e.attributesProcessors==null?this.attributesProcessor=(0,n.createNoopAttributesProcessor)():this.attributesProcessor=(0,n.createMultiAttributesProcessor)(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=(0,a.toAggregation)(e.aggregation??{type:a.AggregationType.DEFAULT}),this.instrumentSelector=new r.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new i.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}}})),VI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterProvider=void 0;let t=(Jd(),d(Kd)),n=bj(),r=II(),i=LI(),a=BI();e.MeterProvider=class{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new r.MeterProviderSharedState(e?.resource??(0,n.defaultResource)()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new a.View(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let e=new i.MetricCollector(this._sharedState,t);t.setMetricProducer(e),this._sharedState.metricCollectors.push(e)}}getMeter(e,n=``,r={}){return this._shutdown?(t.diag.warn(`A shutdown MeterProvider cannot provide a Meter`),(0,t.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:n,schemaUrl:r.schemaUrl}).meter}async shutdown(e){if(this._shutdown){t.diag.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){t.diag.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}}})),HI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TimeoutError=e.createDenyListAttributesProcessor=e.createAllowListAttributesProcessor=e.AggregationType=e.MeterProvider=e.ConsoleMetricExporter=e.InMemoryMetricExporter=e.PeriodicExportingMetricReader=e.MetricReader=e.InstrumentType=e.DataPointType=e.AggregationTemporality=void 0;var t=YF();Object.defineProperty(e,`AggregationTemporality`,{enumerable:!0,get:function(){return t.AggregationTemporality}});var n=XF();Object.defineProperty(e,`DataPointType`,{enumerable:!0,get:function(){return n.DataPointType}}),Object.defineProperty(e,`InstrumentType`,{enumerable:!0,get:function(){return n.InstrumentType}});var r=hI();Object.defineProperty(e,`MetricReader`,{enumerable:!0,get:function(){return r.MetricReader}});var i=gI();Object.defineProperty(e,`PeriodicExportingMetricReader`,{enumerable:!0,get:function(){return i.PeriodicExportingMetricReader}});var a=_I();Object.defineProperty(e,`InMemoryMetricExporter`,{enumerable:!0,get:function(){return a.InMemoryMetricExporter}});var o=vI();Object.defineProperty(e,`ConsoleMetricExporter`,{enumerable:!0,get:function(){return o.ConsoleMetricExporter}});var s=VI();Object.defineProperty(e,`MeterProvider`,{enumerable:!0,get:function(){return s.MeterProvider}});var c=pI();Object.defineProperty(e,`AggregationType`,{enumerable:!0,get:function(){return c.AggregationType}});var l=PI();Object.defineProperty(e,`createAllowListAttributesProcessor`,{enumerable:!0,get:function(){return l.createAllowListAttributesProcessor}}),Object.defineProperty(e,`createDenyListAttributesProcessor`,{enumerable:!0,get:function(){return l.createDenyListAttributesProcessor}});var u=ZF();Object.defineProperty(e,`TimeoutError`,{enumerable:!0,get:function(){return u.TimeoutError}})})),UI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.StatsbeatFeatureType=e.EU_ENDPOINTS=e.EU_CONNECTION_STRING=e.NON_EU_CONNECTION_STRING=e.AIMS_FORMAT=e.AIMS_API_VERSION=e.AIMS_URI=e.StatsbeatCounter=e.AttachTypeName=e.StatsbeatResourceProvider=e.MAX_STATSBEAT_FAILURES=e.AZURE_MONITOR_AUTO_ATTACH=e.STATSBEAT_LANGUAGE=e.NetworkStatsbeat=void 0,e.isStatsbeatShutdownStatus=i,e.NetworkStatsbeat=class{constructor(e,t){this.endpoint=e,this.host=t,this.totalRequestCount=0,this.totalSuccessfulRequestCount=0,this.totalReadFailureCount=0,this.totalWriteFailureCount=0,this.totalFailedRequestCount=[],this.retryCount=[],this.exceptionCount=[],this.throttleCount=[],this.intervalRequestExecutionTime=0,this.lastIntervalRequestExecutionTime=0,this.lastTime=+new Date,this.lastRequestCount=0,this.averageRequestExecutionTime=0}},e.STATSBEAT_LANGUAGE=`node`,e.AZURE_MONITOR_AUTO_ATTACH=`AZURE_MONITOR_AUTO_ATTACH`,e.MAX_STATSBEAT_FAILURES=3,e.StatsbeatResourceProvider={appsvc:`appsvc`,aks:`aks`,functions:`functions`,vm:`vm`,unknown:`unknown`};var t;(function(e){e.INTEGRATED_AUTO=`IntegratedAuto`,e.MANUAL=`Manual`})(t||(e.AttachTypeName=t={}));var n;(function(e){e.SUCCESS_COUNT=`Request_Success_Count`,e.FAILURE_COUNT=`Request_Failure_Count`,e.RETRY_COUNT=`Retry_Count`,e.THROTTLE_COUNT=`Throttle_Count`,e.EXCEPTION_COUNT=`Exception_Count`,e.AVERAGE_DURATION=`Request_Duration`,e.READ_FAILURE_COUNT=`Read_Failure_Count`,e.WRITE_FAILURE_COUNT=`Write_Failure_Count`,e.ATTACH=`Attach`,e.FEATURE=`Feature`})(n||(e.StatsbeatCounter=n={})),e.AIMS_URI=`http://169.254.169.254/metadata/instance/compute`,e.AIMS_API_VERSION=`api-version=2017-12-01`,e.AIMS_FORMAT=`format=json`,e.NON_EU_CONNECTION_STRING=`InstrumentationKey=c4a29126-a7cb-47e5-b348-11414998b11e;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com`,e.EU_CONNECTION_STRING=`InstrumentationKey=7dc56bab-3c0c-4e9f-9ebb-d1acadee8d0f;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com`,e.EU_ENDPOINTS=[`westeurope`,`northeurope`,`francecentral`,`francesouth`,`germanywestcentral`,`norwayeast`,`norwaywest`,`swedencentral`,`switzerlandnorth`,`switzerlandwest`,`uksouth`,`ukwest`];var r;(function(e){e[e.FEATURE=0]=`FEATURE`,e[e.INSTRUMENTATION=1]=`INSTRUMENTATION`})(r||(e.StatsbeatFeatureType=r={}));function i(e){return e===401||e===403||e===503}})),WI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.StatsbeatMetrics=void 0;let t=(kM(),d(Gj)),n=DF(),r=(Jd(),d(Kd)),i=UI(),a=t.__importStar(require(`node:os`));e.StatsbeatMetrics=class{constructor(){this.resourceProvider=i.StatsbeatResourceProvider.unknown,this.vmInfo={},this.os=a.type(),this.resourceIdentifier=``}async getResourceProvider(){this.resourceProvider=i.StatsbeatResourceProvider.unknown,process.env.AKS_ARM_NAMESPACE_ID?(this.resourceProvider=i.StatsbeatResourceProvider.aks,this.resourceIdentifier=process.env.AKS_ARM_NAMESPACE_ID):process.env.WEBSITE_SITE_NAME?(this.resourceProvider=i.StatsbeatResourceProvider.appsvc,this.resourceIdentifier=process.env.WEBSITE_SITE_NAME,process.env.WEBSITE_HOME_STAMPNAME&&(this.resourceIdentifier+=`/`+process.env.WEBSITE_HOME_STAMPNAME)):process.env.FUNCTIONS_WORKER_RUNTIME?(this.resourceProvider=i.StatsbeatResourceProvider.functions,process.env.WEBSITE_HOSTNAME&&(this.resourceIdentifier=process.env.WEBSITE_HOSTNAME)):await this.getAzureComputeMetadata()?(this.resourceProvider=i.StatsbeatResourceProvider.vm,this.resourceIdentifier=this.vmInfo.id+`/`+this.vmInfo.subscriptionId,this.vmInfo.osType&&(this.os=this.vmInfo.osType)):this.resourceProvider=i.StatsbeatResourceProvider.unknown}async getAzureComputeMetadata(){let e=(0,n.createDefaultHttpClient)(),t={url:`${i.AIMS_URI}?${i.AIMS_API_VERSION}&${i.AIMS_FORMAT}`,timeout:5e3,method:`GET`,allowInsecureConnection:!0},a=(0,n.createPipelineRequest)(t);return await e.sendRequest(a).then(e=>{if(e.status===200){this.vmInfo.isVM=!0;let t=``;return e.on(`data`,e=>{t+=e}),e.on(`end`,()=>{try{let e=JSON.parse(t);this.vmInfo.id=e.vmId||``,this.vmInfo.subscriptionId=e.subscriptionId||``,this.vmInfo.osType=e.osType||``}catch(e){r.diag.debug(`Failed to parse JSON: `,e)}}),!0}else return!1}).catch(()=>!1),!1}getConnectionString(e){let t=e;for(let e=0;e<i.EU_ENDPOINTS.length;e++)if(t.includes(i.EU_ENDPOINTS[e]))return i.EU_CONNECTION_STRING;return i.NON_EU_CONNECTION_STRING}}})),GI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resourceMetricsToEnvelope=l,e.isAksAttach=u,e.shouldSendToOtlp=d,e.isStandardMetric=f,e.getAttachType=p;let t=HI(),n=nL(),r=dN(),i=AM(),a=UI(),o=tL(),s=new Map([[r.OTelPerformanceCounterNames.PRIVATE_BYTES,r.BreezePerformanceCounterNames.PRIVATE_BYTES],[r.OTelPerformanceCounterNames.AVAILABLE_BYTES,r.BreezePerformanceCounterNames.AVAILABLE_BYTES],[r.OTelPerformanceCounterNames.PROCESSOR_TIME,r.BreezePerformanceCounterNames.PROCESSOR_TIME],[r.OTelPerformanceCounterNames.PROCESS_TIME_STANDARD,r.BreezePerformanceCounterNames.PROCESS_TIME_STANDARD],[r.OTelPerformanceCounterNames.PROCESS_TIME_NORMALIZED,r.BreezePerformanceCounterNames.PROCESS_TIME_NORMALIZED],[r.OTelPerformanceCounterNames.REQUEST_RATE,r.BreezePerformanceCounterNames.REQUEST_RATE],[r.OTelPerformanceCounterNames.REQUEST_DURATION,r.BreezePerformanceCounterNames.REQUEST_DURATION],[r.OTelPerformanceCounterNames.EXCEPTION_RATE,r.BreezePerformanceCounterNames.EXCEPTION_RATE]]);function c(e){let t={};if(e)for(let n of Object.keys(e))t[n]=e[n];return t}function l(e,r,a){let l=[],p=new Date,m=r,h,g;if(a){g=`Microsoft.ApplicationInsights.Statsbeat`;let e=(0,o.getInstance)();h=Object.assign({},e.tags)}else g=`Microsoft.ApplicationInsights.Metric`,h=(0,n.createTagsFromResource)(e.resource);return e.scopeMetrics.forEach(e=>{e.metrics.forEach(e=>{e.dataPoints.forEach(n=>{let r={metrics:[],version:2,properties:{}};if(r.properties=c(n.attributes),d()&&u()&&!f(n)&&process.env[i.ENV_APPLICATIONINSIGHTS_METRICS_TO_LOGANALYTICS_ENABLED]===`false`&&!a)return;d()&&u()&&!a?r.properties[`_MS.SentToAMW`]=`True`:u()&&!a&&(r.properties[`_MS.SentToAMW`]=`False`);let o;s.has(e.descriptor.name)&&(o=s.get(e.descriptor.name));let _={name:o||e.descriptor.name,value:0,dataPointType:`Aggregation`};e.dataPointType===t.DataPointType.SUM||e.dataPointType===t.DataPointType.GAUGE?(_.value=n.value,_.count=1):(_.value=n.value.sum||0,_.count=n.value.count,_.max=n.value.max,_.min=n.value.min),r.metrics.push(_);let v={name:g,time:p,sampleRate:100,instrumentationKey:m,tags:h,version:1,data:{baseType:`MetricData`,baseData:Object.assign({},r)}};l.push(v)})})}),l}function u(){return!!(process.env[i.ENV_AZURE_MONITOR_AUTO_ATTACH]===`true`&&process.env.AKS_ARM_NAMESPACE_ID)}function d(){return!!(process.env[i.ENV_OTLP_METRICS_ENDPOINT]&&process.env[i.ENV_OTEL_METRICS_EXPORTER]?.includes(`otlp`))}function f(e){return e.attributes?.[`_MS.IsAutocollected`]===`True`}function p(){return process.env[a.AZURE_MONITOR_AUTO_ATTACH]===`true`?a.AttachTypeName.INTEGRATED_AUTO:a.AttachTypeName.MANUAL}})),KI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AzureMonitorStatsbeatExporter=void 0;let t=(Jd(),d(Kd)),n=uN(),r=GI(),i=MM(),a=tL();e.AzureMonitorStatsbeatExporter=class extends i.AzureMonitorBaseExporter{constructor(e){super(e,!0),this._isShutdown=!1,this._sender=new a.HttpSender({endpointUrl:this.endpointUrl,instrumentationKey:this.instrumentationKey,trackStatsbeat:this.trackStatsbeat,exporterOptions:e,isStatsbeatSender:!0})}async export(e,i){if(this._isShutdown){setTimeout(()=>i({code:n.ExportResultCode.FAILED}),0);return}let a=(0,r.resourceMetricsToEnvelope)(e,this.instrumentationKey,!0);t.context.with((0,n.suppressTracing)(t.context.active()),async()=>{i(await this._sender.exportEnvelopes(a))})}async shutdown(){return this._isShutdown=!0,this._sender.shutdown()}async forceFlush(){return Promise.resolve()}}})),qI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NetworkStatsbeatMetrics=void 0;let t=(kM(),d(Gj)),n=(Jd(),d(Kd)),r=HI(),i=t.__importStar(Uj()),a=WI(),o=UI(),s=KI(),c=AM(),l=GI();var u=class e extends a.StatsbeatMetrics{constructor(e){super(),this.disableNonEssentialStatsbeat=!!process.env[c.ENV_DISABLE_STATSBEAT],this.isInitialized=!1,this.statsCollectionShortInterval=9e5,this.networkStatsbeatCollection=[],this.attach=(0,l.getAttachType)(),this.connectionString=super.getConnectionString(e.endpointUrl);let t={connectionString:this.connectionString};this.networkAzureExporter=new s.AzureMonitorStatsbeatExporter(t);let n={exporter:this.networkAzureExporter,exportIntervalMillis:e.networkCollectionInterval||this.statsCollectionShortInterval};this.networkStatsbeatMeterProvider=new r.MeterProvider({readers:[new r.PeriodicExportingMetricReader(n)]}),this.networkStatsbeatMeter=this.networkStatsbeatMeterProvider.getMeter(`Azure Monitor Network Statsbeat`),this.endpointUrl=e.endpointUrl,this.runtimeVersion=process.version,this.language=o.STATSBEAT_LANGUAGE,this.version=i.packageVersion,this.host=this.getShortHost(e.endpointUrl),this.cikey=e.instrumentationKey,this.successCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.SUCCESS_COUNT),this.failureCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.FAILURE_COUNT),this.retryCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.RETRY_COUNT),this.throttleCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.THROTTLE_COUNT),this.exceptionCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.EXCEPTION_COUNT),this.averageDurationGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.AVERAGE_DURATION),this.disableNonEssentialStatsbeat||(this.readFailureGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.READ_FAILURE_COUNT),this.writeFailureGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.WRITE_FAILURE_COUNT)),this.isInitialized=!0,this.initialize(),this.commonProperties={os:this.os,rp:this.resourceProvider,cikey:this.cikey,runtimeVersion:this.runtimeVersion,language:this.language,version:this.version,attach:this.attach},this.networkProperties={endpoint:this.endpointUrl,host:this.host}}shutdown(){return this.networkStatsbeatMeterProvider.shutdown()}async initialize(){var e,t;try{await super.getResourceProvider(),this.successCountGauge.addCallback(this.successCallback.bind(this)),this.networkStatsbeatMeter.addBatchObservableCallback(this.failureCallback.bind(this),[this.failureCountGauge]),this.networkStatsbeatMeter.addBatchObservableCallback(this.retryCallback.bind(this),[this.retryCountGauge]),this.networkStatsbeatMeter.addBatchObservableCallback(this.throttleCallback.bind(this),[this.throttleCountGauge]),this.networkStatsbeatMeter.addBatchObservableCallback(this.exceptionCallback.bind(this),[this.exceptionCountGauge]),this.disableNonEssentialStatsbeat||((e=this.readFailureGauge)==null||e.addCallback(this.readFailureCallback.bind(this)),(t=this.writeFailureGauge)==null||t.addCallback(this.writeFailureCallback.bind(this))),this.averageDurationGauge.addCallback(this.durationCallback.bind(this))}catch{n.diag.debug(`Call to get the resource provider failed.`)}}successCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);if(t.totalSuccessfulRequestCount>0){let n=Object.assign(Object.assign({},this.commonProperties),this.networkProperties);e.observe(t.totalSuccessfulRequestCount,n),t.totalSuccessfulRequestCount=0}}failureCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign(Object.assign({},this.networkProperties),this.commonProperties),{statusCode:0});for(let r=0;r<t.totalFailedRequestCount.length;r++)t.totalFailedRequestCount[r].count>0&&(n.statusCode=t.totalFailedRequestCount[r].statusCode,e.observe(this.failureCountGauge,t.totalFailedRequestCount[r].count,Object.assign({},n)),t.totalFailedRequestCount[r].count=0)}retryCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign(Object.assign({},this.networkProperties),this.commonProperties),{statusCode:0});for(let r=0;r<t.retryCount.length;r++)t.retryCount[r].count>0&&(n.statusCode=t.retryCount[r].statusCode,e.observe(this.retryCountGauge,t.retryCount[r].count,Object.assign({},n)),t.retryCount[r].count=0)}throttleCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign(Object.assign({},this.networkProperties),this.commonProperties),{statusCode:0});for(let r=0;r<t.throttleCount.length;r++)t.throttleCount[r].count>0&&(n.statusCode=t.throttleCount[r].statusCode,e.observe(this.throttleCountGauge,t.throttleCount[r].count,Object.assign({},n)),t.throttleCount[r].count=0)}exceptionCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign(Object.assign({},this.networkProperties),this.commonProperties),{exceptionType:``});for(let r=0;r<t.exceptionCount.length;r++)t.exceptionCount[r].count>0&&(n.exceptionType=t.exceptionCount[r].exceptionType,e.observe(this.exceptionCountGauge,t.exceptionCount[r].count,Object.assign({},n)),t.exceptionCount[r].count=0)}durationCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign({},this.networkProperties),this.commonProperties);for(let e=0;e<this.networkStatsbeatCollection.length;e++){let t=this.networkStatsbeatCollection[e];t.time=Number(new Date);let n=t.totalRequestCount-t.lastRequestCount||0;n>0?t.averageRequestExecutionTime=(t.intervalRequestExecutionTime-t.lastIntervalRequestExecutionTime)/n||0:t.averageRequestExecutionTime=0,t.lastIntervalRequestExecutionTime=t.intervalRequestExecutionTime,t.lastRequestCount=t.totalRequestCount,t.lastTime=t.time}t.averageRequestExecutionTime>0&&(e.observe(t.averageRequestExecutionTime,n),t.averageRequestExecutionTime=0)}readFailureCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);if(t.totalReadFailureCount>0){let n=Object.assign(Object.assign({},this.commonProperties),this.networkProperties);e.observe(t.totalReadFailureCount,n),t.totalReadFailureCount=0}}writeFailureCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);if(t.totalWriteFailureCount>0){let n=Object.assign(Object.assign({},this.commonProperties),this.networkProperties);e.observe(t.totalWriteFailureCount,n),t.totalWriteFailureCount=0}}countSuccess(e){if(!this.isInitialized)return;let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);t.totalRequestCount++,t.totalSuccessfulRequestCount++,t.intervalRequestExecutionTime+=e}countFailure(e,t){if(!this.isInitialized)return;let n=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),r=n.totalFailedRequestCount.find(e=>t===e.statusCode);r?r.count++:n.totalFailedRequestCount.push({statusCode:t,count:1}),n.totalRequestCount++,n.intervalRequestExecutionTime+=e}countRetry(e){if(!this.isInitialized)return;let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=t.retryCount.find(t=>e===t.statusCode);n?n.count++:t.retryCount.push({statusCode:e,count:1})}countThrottle(e){if(!this.isInitialized)return;let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=t.throttleCount.find(t=>e===t.statusCode);n?n.count++:t.throttleCount.push({statusCode:e,count:1})}countReadFailure(){if(!this.isInitialized||this.disableNonEssentialStatsbeat)return;let e=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);e.totalReadFailureCount++}countWriteFailure(){if(!this.isInitialized||this.disableNonEssentialStatsbeat)return;let e=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);e.totalWriteFailureCount++}countException(e){if(!this.isInitialized)return;let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=t.exceptionCount.find(t=>e.name===t.exceptionType);n?n.count++:t.exceptionCount.push({exceptionType:e.name,count:1})}getNetworkStatsbeatCounter(e,t){for(let n=0;n<this.networkStatsbeatCollection.length;n++)if(e===this.networkStatsbeatCollection[n].endpoint&&t===this.networkStatsbeatCollection[n].host)return this.networkStatsbeatCollection[n];let n=new o.NetworkStatsbeat(e,t);return this.networkStatsbeatCollection.push(n),n}getShortHost(e){let t=e;try{let n=new RegExp(/^https?:\/\/(?:www\.)?([^/.-]+)/).exec(e);n!==null&&n.length>1&&(t=n[1]),t=t.replace(`.in.applicationinsights.azure.com`,``)}catch{n.diag.debug(`Failed to get the short host name.`)}return t}static getInstance(t){return e.instance||=new e(t),e.instance}};e.NetworkStatsbeatMetrics=u,u.instance=null})),JI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LongIntervalStatsbeatMetrics=void 0;let t=(kM(),d(Gj)),n=(Jd(),d(Kd)),r=uN(),i=HI(),a=t.__importStar(Uj()),o=WI(),s=UI(),c=KI(),l=GI();var u=class e extends o.StatsbeatMetrics{constructor(e){super(),this.statsCollectionLongInterval=864e5,this.attach=(0,l.getAttachType)(),this.feature=0,this.instrumentation=0,this.isInitialized=!1,this.connectionString=super.getConnectionString(e.endpointUrl);let t={connectionString:this.connectionString,disableOfflineStorage:e.disableOfflineStorage};this.setFeatures(),this.longIntervalAzureExporter=new c.AzureMonitorStatsbeatExporter(t);let n={exporter:this.longIntervalAzureExporter,exportIntervalMillis:Number(process.env.LONG_INTERVAL_EXPORT_MILLIS)||this.statsCollectionLongInterval};this.longIntervalMetricReader=new i.PeriodicExportingMetricReader(n),this.longIntervalStatsbeatMeterProvider=new i.MeterProvider({readers:[this.longIntervalMetricReader]}),this.longIntervalStatsbeatMeter=this.longIntervalStatsbeatMeterProvider.getMeter(`Azure Monitor Long Interval Statsbeat`),this.runtimeVersion=process.version,this.language=s.STATSBEAT_LANGUAGE,this.version=a.packageVersion,this.cikey=e.instrumentationKey,this.featureStatsbeatGauge=this.longIntervalStatsbeatMeter.createObservableGauge(s.StatsbeatCounter.FEATURE),this.attachStatsbeatGauge=this.longIntervalStatsbeatMeter.createObservableGauge(s.StatsbeatCounter.ATTACH),this.isInitialized=!0,this.initialize(),this.commonProperties={os:this.os,rp:this.resourceProvider,cikey:this.cikey,runtimeVersion:this.runtimeVersion,language:this.language,version:this.version,attach:this.attach},this.attachProperties={rpId:this.resourceIdentifier}}async initialize(){try{await this.getResourceProvider(),this.attachStatsbeatGauge.addCallback(this.attachCallback.bind(this)),this.longIntervalStatsbeatMeter.addBatchObservableCallback(this.getEnvironmentStatus.bind(this),[this.featureStatsbeatGauge]),setTimeout(async()=>{try{let e=await this.longIntervalMetricReader.collect();e?this.longIntervalAzureExporter.export(e.resourceMetrics,e=>{e.code!==r.ExportResultCode.SUCCESS&&n.diag.debug(`LongIntervalStatsbeat: metrics export failed (error ${e.error})`)}):n.diag.debug(`LongIntervalStatsbeat: No metrics collected`)}catch(e){n.diag.debug(`LongIntervalStatsbeat: Error collecting metrics: ${e}`)}},15e3)}catch{n.diag.debug(`Call to get the resource provider failed.`)}}getEnvironmentStatus(e){this.setFeatures();let t;this.instrumentation>0&&(t=Object.assign(Object.assign({},this.commonProperties),{feature:this.instrumentation,type:s.StatsbeatFeatureType.INSTRUMENTATION}),e.observe(this.featureStatsbeatGauge,1,Object.assign({},t))),this.feature>0&&(t=Object.assign(Object.assign({},this.commonProperties),{feature:this.feature,type:s.StatsbeatFeatureType.FEATURE}),e.observe(this.featureStatsbeatGauge,1,Object.assign({},t)))}setFeatures(){let e=process.env.AZURE_MONITOR_STATSBEAT_FEATURES;if(e)try{this.feature=JSON.parse(e).feature,this.instrumentation=JSON.parse(e).instrumentation}catch(e){n.diag.debug(`LongIntervalStatsbeat: Failed to parse features/instrumentations (error ${e})`)}}attachCallback(e){let t=Object.assign(Object.assign({},this.commonProperties),this.attachProperties);e.observe(1,t)}shutdown(){return this.longIntervalStatsbeatMeterProvider.shutdown()}static getInstance(t){return e.instance||=new e(t),e.instance}};e.LongIntervalStatsbeatMetrics=u,u.instance=null})),YI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isRetriable=t,e.msToTimeSpan=n;function t(e){return e===206||e===401||e===403||e===408||e===429||e===439||e===500||e===502||e===503||e===504}function n(e){(isNaN(e)||e<0)&&(e=0);let t=(e/1e3%60).toFixed(7).replace(/0{0,4}$/,``),n=``+Math.floor(e/(1e3*60))%60,r=``+Math.floor(e/(1e3*60*60))%24,i=Math.floor(e/(1e3*60*60*24));return t=t.indexOf(`.`)<2?`0`+t:t,n=n.length<2?`0`+n:n,r=r.length<2?`0`+r:r,(i>0?i+`.`:``)+r+`:`+n+`:`+t}})),XI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BaseSender=void 0;let t=(Jd(),d(Kd)),n=gN(),r=uN(),i=qI(),a=JI(),o=UI(),s=YI(),c=AM();e.BaseSender=class{constructor(e){this.statsbeatFailureCount=0,this.batchSendRetryIntervalMs=6e4,this.numConsecutiveRedirects=0,this.disableOfflineStorage=e.exporterOptions.disableOfflineStorage||!1,this.persister=new n.FileSystemPersist(e.instrumentationKey,e.exporterOptions),e.trackStatsbeat&&(this.networkStatsbeatMetrics=i.NetworkStatsbeatMetrics.getInstance({instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl,disableOfflineStorage:this.disableOfflineStorage}),this.longIntervalStatsbeatMetrics=a.LongIntervalStatsbeatMetrics.getInstance({instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl,disableOfflineStorage:this.disableOfflineStorage})),this.retryTimer=null,this.isStatsbeatSender=e.isStatsbeatSender||!1}async exportEnvelopes(e){var n,i,a,c,l,u,d,f,p,m;if(t.diag.info(`Exporting ${e.length} envelope(s)`),e.length<1)return{code:r.ExportResultCode.SUCCESS};try{let o=new Date().getTime(),{result:d,statusCode:f}=await this.send(e),p=new Date().getTime()-o;if(this.numConsecutiveRedirects=0,f===200)return this.retryTimer||(this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.sendFirstPersistedFile()},this.batchSendRetryIntervalMs),this.retryTimer.unref()),this.isStatsbeatSender||(n=this.networkStatsbeatMetrics)==null||n.countSuccess(p),{code:r.ExportResultCode.SUCCESS};if(f&&(0,s.isRetriable)(f)){if(f===429||f===439)return this.isStatsbeatSender||(i=this.networkStatsbeatMetrics)==null||i.countThrottle(f),{code:r.ExportResultCode.SUCCESS};if(d){t.diag.info(d);let n=JSON.parse(d),i=[];return n.itemsAccepted>0&&f===206&&!this.isStatsbeatSender&&((a=this.networkStatsbeatMetrics)==null||a.countSuccess(p)),n.errors&&n.errors.forEach(t=>{t.statusCode&&(0,s.isRetriable)(t.statusCode)&&i.push(e[t.index])}),i.length>0?(this.isStatsbeatSender||(c=this.networkStatsbeatMetrics)==null||c.countRetry(f),await this.persist(i)):(this.isStatsbeatSender||(l=this.networkStatsbeatMetrics)==null||l.countFailure(p,f),{code:r.ExportResultCode.FAILED})}else return this.isStatsbeatSender||(u=this.networkStatsbeatMetrics)==null||u.countRetry(f),await this.persist(e)}else return this.networkStatsbeatMetrics&&!this.isStatsbeatSender?f&&this.networkStatsbeatMetrics.countFailure(p,f):this.incrementStatsbeatFailure(),{code:r.ExportResultCode.FAILED}}catch(n){let i=n;if(i.statusCode&&(i.statusCode===307||i.statusCode===308))if(this.numConsecutiveRedirects++,this.numConsecutiveRedirects<10){if(i.response&&i.response.headers){let t=i.response.headers.get(`location`);if(t)return this.handlePermanentRedirect(t),this.exportEnvelopes(e)}}else{let e=Error(`Circular redirect`);return this.isStatsbeatSender||(d=this.networkStatsbeatMetrics)==null||d.countException(e),{code:r.ExportResultCode.FAILED,error:e}}else if(i.statusCode&&(0,s.isRetriable)(i.statusCode)&&!this.isStatsbeatSender)return(f=this.networkStatsbeatMetrics)==null||f.countRetry(i.statusCode),this.persist(e);else if(i.statusCode===400&&i.message.includes(`Invalid instrumentation key`))return this.shutdownStatsbeat(),{code:r.ExportResultCode.SUCCESS};else if(i.statusCode&&this.isStatsbeatSender&&(0,o.isStatsbeatShutdownStatus)(i.statusCode))return this.incrementStatsbeatFailure(),{code:r.ExportResultCode.SUCCESS};return this.isRetriableRestError(i)?(i.statusCode&&!this.isStatsbeatSender&&((p=this.networkStatsbeatMetrics)==null||p.countRetry(i.statusCode)),this.isStatsbeatSender||t.diag.error(`Retrying due to transient client side error. Error message:`,i.message),this.persist(e)):(this.isStatsbeatSender||(m=this.networkStatsbeatMetrics)==null||m.countException(i),this.isStatsbeatSender||t.diag.error(`Envelopes could not be exported and are not retriable. Error message:`,i.message),{code:r.ExportResultCode.FAILED,error:i})}}async persist(e){var t;try{return await this.persister.push(e)?{code:r.ExportResultCode.SUCCESS}:{code:r.ExportResultCode.FAILED,error:Error(`Failed to persist envelope in disk.`)}}catch(e){return this.isStatsbeatSender||(t=this.networkStatsbeatMetrics)==null||t.countWriteFailure(),{code:r.ExportResultCode.FAILED,error:e}}}incrementStatsbeatFailure(){this.statsbeatFailureCount++,this.statsbeatFailureCount>o.MAX_STATSBEAT_FAILURES&&this.shutdownStatsbeat()}shutdownStatsbeat(){var e;this.networkStatsbeatMetrics&&this.networkStatsbeatMetrics.shutdown(),(e=this.longIntervalStatsbeatMetrics)==null||e.shutdown(),this.statsbeatFailureCount=0}async sendFirstPersistedFile(){var e;try{let e=await this.persister.shift();e&&await this.send(e)}catch(n){this.isStatsbeatSender||(e=this.networkStatsbeatMetrics)==null||e.countReadFailure(),t.diag.warn(`Failed to fetch persisted file`,n)}}isRetriableRestError(e){let t=Object.values(c.RetriableRestErrorTypes);return!!(e&&e.code&&t.includes(e.code))}}})),ZI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HttpSender=void 0;let t=(kM(),d(Gj)).__importDefault(require(`node:url`)),n=(Jd(),d(Kd)),r=DF(),i=JF(),a=XI();e.HttpSender=class extends a.BaseSender{constructor(e){super(e),this.appInsightsClientOptions=Object.assign({host:e.endpointUrl},e.exporterOptions),this.appInsightsClientOptions.credential&&(e.aadAudience?this.appInsightsClientOptions.credentialScopes=[e.aadAudience]:this.appInsightsClientOptions.credentialScopes=[`https://monitor.azure.com//.default`]),this.appInsightsClient=new i.ApplicationInsightsClient(this.appInsightsClientOptions),this.appInsightsClient.pipeline.removePolicy({name:r.redirectPolicyName})}async send(e){let t={},n;function r(e,r){n=e,t.onResponse&&t.onResponse(e,r)}return await this.appInsightsClient.track(e,Object.assign(Object.assign({},t),{onResponse:r})),{statusCode:n?.status,result:n?.bodyAsText??``}}async shutdown(){n.diag.info(`HttpSender shutting down`)}handlePermanentRedirect(e){if(e){let n=new t.default.URL(e);n&&n.host&&(this.appInsightsClient.host=`https://`+n.host)}}}})),QI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Context=void 0,e.getInstance=u;let t=(kM(),d(Gj)),n=t.__importStar(require(`node:os`)),r=uN(),i=(PA(),d(NA)),a=JF(),o=t.__importStar(Uj()),s=AM(),c=null;var l=class e{constructor(){this.tags={},this._loadDeviceContext(),this._loadInternalContext()}_loadDeviceContext(){this.tags[a.KnownContextTagKeys.AiDeviceOsVersion]=n&&`${n.type()} ${n.release()}`}_loadInternalContext(){let{node:t}=process.versions;[e.nodeVersion]=t.split(`.`),e.opentelemetryVersion=r.SDK_INFO[i.ATTR_TELEMETRY_SDK_VERSION],e.sdkVersion=o.packageVersion;let n=process.env[s.ENV_AZURE_MONITOR_PREFIX]?process.env[s.ENV_AZURE_MONITOR_PREFIX]:``,c=this._getVersion(),l=`${n}node${e.nodeVersion}:otel${e.opentelemetryVersion}:${c}`;this.tags[a.KnownContextTagKeys.AiInternalSdkVersion]=l}_getVersion(){return process.env[s.ENV_APPLICATIONINSIGHTS_SHIM_VERSION]?`sha${process.env[s.ENV_APPLICATIONINSIGHTS_SHIM_VERSION]}`:process.env[s.ENV_AZURE_MONITOR_DISTRO_VERSION]?`dst${process.env[s.ENV_AZURE_MONITOR_DISTRO_VERSION]}`:`ext${e.sdkVersion}`}};e.Context=l,l.sdkVersion=null,l.opentelemetryVersion=null,l.nodeVersion=``;function u(){return c||=new l,c}})),$I=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),(kM(),d(Gj)).__exportStar(QI(),e)})),eL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=(kM(),d(Gj));t.__exportStar(fN(),e),t.__exportStar(gN(),e),t.__exportStar(ZI(),e),t.__exportStar($I(),e)})),tL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),(kM(),d(Gj)).__exportStar(eL(),e)})),nL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hrTimeToDate=l,e.createTagsFromResource=u,e.isSqlDB=m,e.getUrl=h,e.getDependencyTarget=g,e.createResourceMetricEnvelope=_,e.serializeAttribute=v,e.shouldCreateResourceMetric=y,e.isSyntheticSource=b;let t=(kM(),d(Gj)).__importDefault(require(`node:os`)),n=(PA(),d(NA)),r=dN(),i=tL(),a=JF(),o=uN(),s=AM(),c=aL();function l(e){return new Date((0,o.hrTimeToNanoseconds)(e)/1e6)}function u(e){let t=(0,i.getInstance)(),r=Object.assign({},t.tags);return e&&e.attributes&&(r[a.KnownContextTagKeys.AiCloudRole]=f(e),r[a.KnownContextTagKeys.AiCloudRoleInstance]=p(e),e.attributes[n.SEMRESATTRS_DEVICE_ID]&&(r[a.KnownContextTagKeys.AiDeviceId]=String(e.attributes[n.SEMRESATTRS_DEVICE_ID])),e.attributes[n.SEMRESATTRS_DEVICE_MODEL_NAME]&&(r[a.KnownContextTagKeys.AiDeviceModel]=String(e.attributes[n.SEMRESATTRS_DEVICE_MODEL_NAME])),e.attributes[n.SEMRESATTRS_SERVICE_VERSION]&&(r[a.KnownContextTagKeys.AiApplicationVer]=String(e.attributes[n.SEMRESATTRS_SERVICE_VERSION]))),r}function f(e){let t=``,r=e.attributes[n.SEMRESATTRS_SERVICE_NAME],i=e.attributes[n.SEMRESATTRS_SERVICE_NAMESPACE];if(r)if(String(r).startsWith(`unknown_service`))t=i?`${i}.${r}`:String(r);else return i?`${i}.${r}`:String(r);let a=e.attributes[n.SEMRESATTRS_K8S_DEPLOYMENT_NAME];if(a)return String(a);let o=e.attributes[n.SEMRESATTRS_K8S_REPLICASET_NAME];if(o)return String(o);let s=e.attributes[n.SEMRESATTRS_K8S_STATEFULSET_NAME];if(s)return String(s);let c=e.attributes[n.SEMRESATTRS_K8S_JOB_NAME];if(c)return String(c);let l=e.attributes[n.SEMRESATTRS_K8S_CRONJOB_NAME];if(l)return String(l);let u=e.attributes[n.SEMRESATTRS_K8S_DAEMONSET_NAME];return u?String(u):t}function p(e){let r=e.attributes[n.SEMRESATTRS_K8S_POD_NAME];if(r)return String(r);let i=e.attributes[n.SEMRESATTRS_SERVICE_INSTANCE_ID];return i?String(i):t.default&&t.default.hostname()}function m(e){return e===n.DBSYSTEMVALUES_DB2||e===n.DBSYSTEMVALUES_DERBY||e===n.DBSYSTEMVALUES_MARIADB||e===n.DBSYSTEMVALUES_MSSQL||e===n.DBSYSTEMVALUES_ORACLE||e===n.DBSYSTEMVALUES_SQLITE||e===n.DBSYSTEMVALUES_OTHER_SQL||e===n.DBSYSTEMVALUES_HSQLDB||e===n.DBSYSTEMVALUES_H2}function h(e){if(!e)return``;if((0,c.getHttpMethod)(e)){let t=(0,c.getHttpUrl)(e);if(t)return String(t);{let t=(0,c.getHttpScheme)(e),n=(0,c.getHttpTarget)(e);if(t&&n){let r=(0,c.getHttpHost)(e);if(r)return`${t}://${r}${n}`;{let r=(0,c.getNetPeerPort)(e);if(r){let i=(0,c.getNetPeerName)(e);if(i)return`${t}://${i}:${r}${n}`;{let i=(0,c.getPeerIp)(e);if(i)return`${t}://${i}:${r}${n}`}}}}}}return``}function g(e){if(!e)return``;let t=e[n.SEMATTRS_PEER_SERVICE],r=(0,c.getHttpHost)(e),i=(0,c.getHttpUrl)(e),a=(0,c.getNetPeerName)(e),o=(0,c.getPeerIp)(e);return t?String(t):r?String(r):i?String(i):a?String(a):o?String(o):``}function _(e,t){if(e&&e.attributes){let r=u(e),i={};for(let t of Object.keys(e.attributes))t.startsWith(`_MS.`)||t===n.ATTR_TELEMETRY_SDK_VERSION||t===n.ATTR_TELEMETRY_SDK_LANGUAGE||t===n.ATTR_TELEMETRY_SDK_NAME||(i[t]=e.attributes[t]);if(Object.keys(i).length>0){let e={version:2,metrics:[{name:`_OTELRESOURCE_`,value:1}],properties:i};return{name:`Microsoft.ApplicationInsights.Metric`,time:new Date,sampleRate:100,instrumentationKey:t,version:1,data:{baseType:`MetricData`,baseData:e},tags:r}}}}function v(e){if(typeof e==`object`)if(e instanceof Error)try{return JSON.stringify(e,Object.getOwnPropertyNames(e))}catch{return String(e)}else if(e instanceof Uint8Array)return String(e);else try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function y(){return process.env[s.ENV_OPENTELEMETRY_RESOURCE_METRIC_DISABLED]?.toLowerCase()!==`true`}function b(e){return!!e[r.experimentalOpenTelemetryValues.SYNTHETIC_TYPE]}})),rL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MessageBusDestination=e.MicrosoftEventHub=e.AzNamespace=void 0,e.AzNamespace=`az.namespace`,e.MicrosoftEventHub=`Microsoft.EventHub`,e.MessageBusDestination=`message_bus.destination`})),iL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseEventHubSpan=void 0;let t=(Jd(),d(Kd)),n=uN(),r=(PA(),d(NA)),i=Uj(),a=rL(),o=e=>{let t=0,r=0,a=(0,n.hrTimeToMilliseconds)(e.startTime);return e.links.forEach(({attributes:e})=>{let n=e?.[i.ENQUEUED_TIME];n&&(t+=1,r+=a-(parseFloat(n.toString())||0))}),Math.max(r/(t||1),0)};e.parseEventHubSpan=(e,n)=>{let s=e.attributes[a.AzNamespace],c=(e.attributes[r.SEMATTRS_NET_PEER_NAME]||e.attributes[`peer.address`]||`unknown`).replace(/\/$/g,``),l=e.attributes[a.MessageBusDestination]||`unknown`;switch(e.kind){case t.SpanKind.CLIENT:n.type=s,n.target=`${c}/${l}`;break;case t.SpanKind.PRODUCER:n.type=`Queue Message | ${s}`,n.target=`${c}/${l}`;break;case t.SpanKind.CONSUMER:n.type=`Queue Message | ${s}`,n.source=`${c}/${l}`,n.measurements=Object.assign(Object.assign({},n.measurements),{[i.TIME_SINCE_ENQUEUED]:o(e)});break;default:}}})),aL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.readableSpanToEnvelope=_,e.spanEventsToEnvelopes=v,e.getPeerIp=y,e.getLocationIp=b,e.getHttpClientIp=x,e.getUserAgent=S,e.getHttpUrl=C,e.getHttpMethod=w,e.getHttpStatusCode=T,e.getHttpScheme=E,e.getHttpTarget=D,e.getHttpHost=O,e.getNetPeerName=k,e.getNetPeerPort=A;let t=uN(),n=(Jd(),d(Kd)),r=(PA(),d(NA)),i=nL(),a=dN(),o=iL(),s=Uj(),c=rL(),l=JF(),u=YI();function f(e){let t=(0,i.createTagsFromResource)(e.resource);t[l.KnownContextTagKeys.AiOperationId]=e.spanContext().traceId,e.parentSpanContext?.spanId&&(t[l.KnownContextTagKeys.AiOperationParentId]=e.parentSpanContext.spanId);let o=e.attributes[r.SEMATTRS_ENDUSER_ID];o&&(t[l.KnownContextTagKeys.AiUserId]=String(o));let s=S(e.attributes);if(s&&(t[`ai.user.userAgent`]=String(s)),(0,i.isSyntheticSource)(e.attributes)&&(t[l.KnownContextTagKeys.AiOperationSyntheticSource]=`True`),e.kind===n.SpanKind.SERVER){let n=w(e.attributes);if(b(t,e.attributes),n){let i=e.attributes[r.ATTR_HTTP_ROUTE],o=C(e.attributes);if(t[l.KnownContextTagKeys.AiOperationName]=e.name,i)t[l.KnownContextTagKeys.AiOperationName]=String(`${n} ${i}`).substring(0,a.MaxPropertyLengths.TEN_BIT);else if(o)try{let e=new URL(String(o));t[l.KnownContextTagKeys.AiOperationName]=String(`${n} ${e.pathname}`).substring(0,a.MaxPropertyLengths.TEN_BIT)}catch{}}else t[l.KnownContextTagKeys.AiOperationName]=e.name}else e.attributes[l.KnownContextTagKeys.AiOperationName]&&(t[l.KnownContextTagKeys.AiOperationName]=e.attributes[l.KnownContextTagKeys.AiOperationName]);return t}function p(e){let t={};if(e)for(let n of Object.keys(e))n.startsWith(`_MS.`)&&!a.internalMicrosoftAttributes.includes(n)||n.startsWith(`microsoft.`)||a.legacySemanticValues.includes(n)||a.httpSemanticValues.includes(n)||n===l.KnownContextTagKeys.AiOperationName||(t[n]=(0,i.serializeAttribute)(e[n]));return t}function m(e){let t=p(e.attributes),n={},r=e.links.map(e=>({operation_Id:e.context.traceId,id:e.context.spanId}));return r.length>0&&(t[s.MS_LINKS]=JSON.stringify(r)),[t,n]}function h(e){let a={name:e.name,id:`${e.spanContext().spanId}`,success:e.status?.code!==n.SpanStatusCode.ERROR,resultCode:`0`,type:`Dependency`,duration:(0,u.msToTimeSpan)((0,t.hrTimeToMilliseconds)(e.duration)),version:2};e.kind===n.SpanKind.PRODUCER&&(a.type=s.DependencyTypes.QueueMessage),e.kind===n.SpanKind.INTERNAL&&e.parentSpanContext&&(a.type=s.DependencyTypes.InProc);let o=w(e.attributes),c=e.attributes[r.SEMATTRS_DB_SYSTEM],l=e.attributes[r.SEMATTRS_RPC_SYSTEM];if(o){let t=C(e.attributes);if(t)try{a.name=`${o} ${new URL(String(t)).pathname}`}catch{}a.type=s.DependencyTypes.Http,a.data=(0,i.getUrl)(e.attributes);let n=T(e.attributes);n&&(a.resultCode=String(n));let r=(0,i.getDependencyTarget)(e.attributes);if(r){try{let e=new RegExp(/(https?)(:\/\/.*)(:\d+)(\S*)/).exec(r);if(e!==null){let t=e[1],n=e[3];(t===`https`&&n===`:443`||t===`http`&&n===`:80`)&&(r=e[1]+e[2]+e[4])}}catch{}a.target=`${r}`}}else if(c){String(c)===r.DBSYSTEMVALUES_MYSQL?a.type=`mysql`:String(c)===r.DBSYSTEMVALUES_POSTGRESQL?a.type=`postgresql`:String(c)===r.DBSYSTEMVALUES_MONGODB?a.type=`mongodb`:String(c)===r.DBSYSTEMVALUES_REDIS?a.type=`redis`:(0,i.isSqlDB)(String(c))?a.type=`SQL`:a.type=String(c);let t=e.attributes[r.SEMATTRS_DB_STATEMENT],n=e.attributes[r.SEMATTRS_DB_OPERATION];t?a.data=String(t):n&&(a.data=String(n));let o=(0,i.getDependencyTarget)(e.attributes),s=e.attributes[r.SEMATTRS_DB_NAME];o?a.target=s?`${o}|${s}`:`${o}`:a.target=s?`${s}`:`${c}`}else if(l){l===s.DependencyTypes.Wcf?a.type=s.DependencyTypes.Wcf:a.type=s.DependencyTypes.Grpc;let t=e.attributes[r.SEMATTRS_RPC_GRPC_STATUS_CODE];t&&(a.resultCode=String(t));let n=(0,i.getDependencyTarget)(e.attributes);n?a.target=`${n}`:l&&(a.target=String(l))}return a}function g(e){let a={id:`${e.spanContext().spanId}`,success:e.status.code!==n.SpanStatusCode.ERROR&&(Number(T(e.attributes))||0)<400,responseCode:`0`,duration:(0,u.msToTimeSpan)((0,t.hrTimeToMilliseconds)(e.duration)),version:2,source:void 0},o=w(e.attributes),s=e.attributes[r.SEMATTRS_RPC_GRPC_STATUS_CODE];if(o){a.url=(0,i.getUrl)(e.attributes);let t=T(e.attributes);t&&(a.responseCode=String(t))}else s&&(a.responseCode=String(s));return a}function _(e,t){let r,u,d,p=(0,i.hrTimeToDate)(e.startTime),_=t,v=f(e),[y,b]=m(e);switch(e.kind){case n.SpanKind.CLIENT:case n.SpanKind.PRODUCER:case n.SpanKind.INTERNAL:r=`Microsoft.ApplicationInsights.RemoteDependency`,u=`RemoteDependencyData`,d=h(e);break;case n.SpanKind.SERVER:case n.SpanKind.CONSUMER:r=`Microsoft.ApplicationInsights.Request`,u=`RequestData`,d=g(e),d.name=v[l.KnownContextTagKeys.AiOperationName];break;default:throw n.diag.error(`Unsupported span kind ${e.kind}`),Error(`Unsupported span kind ${e.kind}`)}let x=100;if(e.attributes[s.AzureMonitorSampleRate]&&(x=Number(e.attributes[s.AzureMonitorSampleRate])),e.attributes[c.AzNamespace]&&(e.kind===n.SpanKind.INTERNAL&&(d.type=`${s.DependencyTypes.InProc} | ${e.attributes[c.AzNamespace]}`),e.attributes[c.AzNamespace]===c.MicrosoftEventHub&&(0,o.parseEventHubSpan)(e,d)),d.id&&=d.id.substring(0,a.MaxPropertyLengths.NINE_BIT),d.name&&=d.name.substring(0,a.MaxPropertyLengths.TEN_BIT),d.resultCode&&=String(d.resultCode).substring(0,a.MaxPropertyLengths.TEN_BIT),d.data&&=String(d.data).substring(0,a.MaxPropertyLengths.THIRTEEN_BIT),d.type&&=String(d.type).substring(0,a.MaxPropertyLengths.TEN_BIT),d.target&&=String(d.target).substring(0,a.MaxPropertyLengths.TEN_BIT),d.properties)for(let e of Object.keys(d.properties))d.properties[e]=d.properties[e].substring(0,a.MaxPropertyLengths.THIRTEEN_BIT);return{name:r,sampleRate:x,time:p,instrumentationKey:_,tags:v,version:1,data:{baseType:u,baseData:Object.assign(Object.assign({},d),{properties:y,measurements:b})}}}function v(e,t){let n=[];return e.events&&e.events.forEach(o=>{let c,u=(0,i.hrTimeToDate)(o.time),d=``,f,m=p(o.attributes),h=(0,i.createTagsFromResource)(e.resource);h[l.KnownContextTagKeys.AiOperationId]=e.spanContext().traceId;let g=e.spanContext().spanId;if(g&&(h[l.KnownContextTagKeys.AiOperationParentId]=g),o.name===`exception`){d=`Microsoft.ApplicationInsights.Exception`,c=`ExceptionData`;let e=``,t=`Exception`,n=``,i=!1;if(o.attributes){e=String(o.attributes[r.SEMATTRS_EXCEPTION_TYPE]),n=String(o.attributes[r.SEMATTRS_EXCEPTION_STACKTRACE]),n&&(i=!0);let a=o.attributes[r.SEMATTRS_EXCEPTION_MESSAGE];a&&(t=String(a));let s=o.attributes[r.SEMATTRS_EXCEPTION_ESCAPED];s!==void 0&&(m[r.SEMATTRS_EXCEPTION_ESCAPED]=String(s))}f={exceptions:[{typeName:e,message:t,stack:n,hasFullStack:i}],version:2,properties:m}}else d=`Microsoft.ApplicationInsights.Message`,c=`MessageData`,f={message:o.name,version:2,properties:m};let _=100;if(e.attributes[s.AzureMonitorSampleRate]&&(_=Number(e.attributes[s.AzureMonitorSampleRate])),f.message&&=String(f.message).substring(0,a.MaxPropertyLengths.FIFTEEN_BIT),f.properties)for(let e of Object.keys(f.properties))f.properties[e]=f.properties[e].substring(0,a.MaxPropertyLengths.THIRTEEN_BIT);let v={name:d,time:u,instrumentationKey:t,version:1,sampleRate:_,data:{baseType:c,baseData:f},tags:h};n.push(v)}),n}function y(e){if(e)return e[r.ATTR_NETWORK_PEER_ADDRESS]||e[r.SEMATTRS_NET_PEER_IP]}function b(e,t){if(t){let n=x(t),r=y(t);n?e[l.KnownContextTagKeys.AiLocationIp]=String(n):r&&(e[l.KnownContextTagKeys.AiLocationIp]=String(r))}}function x(e){if(e)return e[r.ATTR_CLIENT_ADDRESS]||e[r.SEMATTRS_HTTP_CLIENT_IP]}function S(e){if(e)return e[r.ATTR_USER_AGENT_ORIGINAL]||e[r.SEMATTRS_HTTP_USER_AGENT]}function C(e){if(e)return e[r.ATTR_URL_FULL]||e[r.SEMATTRS_HTTP_URL]}function w(e){if(e)return e[r.ATTR_HTTP_REQUEST_METHOD]||e[r.SEMATTRS_HTTP_METHOD]}function T(e){if(e)return e[r.ATTR_HTTP_RESPONSE_STATUS_CODE]||e[r.SEMATTRS_HTTP_STATUS_CODE]}function E(e){if(e)return e[r.ATTR_URL_SCHEME]||e[r.SEMATTRS_HTTP_SCHEME]}function D(e){if(e)return e[r.ATTR_URL_PATH]?e[r.ATTR_URL_PATH]:e[r.ATTR_URL_QUERY]?e[r.ATTR_URL_QUERY]:e[r.SEMATTRS_HTTP_TARGET]}function O(e){if(e)return e[r.ATTR_SERVER_ADDRESS]||e[r.SEMATTRS_HTTP_HOST]}function k(e){if(e)return e[r.ATTR_CLIENT_ADDRESS]||e[r.SEMATTRS_NET_PEER_NAME]}function A(e){if(e)return e[r.ATTR_CLIENT_PORT]||e[r.ATTR_SERVER_PORT]||e[r.SEMATTRS_NET_PEER_PORT]}})),oL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AzureMonitorTraceExporter=void 0;let t=(Jd(),d(Kd)),n=uN(),r=MM(),i=aL(),a=nL(),o=tL();e.AzureMonitorTraceExporter=class extends r.AzureMonitorBaseExporter{constructor(e={}){super(e),this.isShutdown=!1,this.shouldCreateResourceMetric=(0,a.shouldCreateResourceMetric)(),this.sender=new o.HttpSender({endpointUrl:this.endpointUrl,instrumentationKey:this.instrumentationKey,trackStatsbeat:this.trackStatsbeat,exporterOptions:e,aadAudience:this.aadAudience}),t.diag.debug(`AzureMonitorTraceExporter was successfully setup`)}async export(e,r){if(this.isShutdown){t.diag.info(`Exporter shut down. Failed to export spans.`),setTimeout(()=>r({code:n.ExportResultCode.FAILED}),0);return}if(t.diag.info(`Exporting ${e.length} span(s). Converting to envelopes...`),e.length>0){let t=[],n=(0,a.createResourceMetricEnvelope)(e[0].resource,this.instrumentationKey);n&&this.shouldCreateResourceMetric&&t.push(n),e.forEach(e=>{t.push((0,i.readableSpanToEnvelope)(e,this.instrumentationKey));let n=(0,i.spanEventsToEnvelopes)(e,this.instrumentationKey);n.length>0&&t.push(...n)}),r(await this.sender.exportEnvelopes(t))}r({code:n.ExportResultCode.SUCCESS})}async shutdown(){return this.isShutdown=!0,t.diag.info(`AzureMonitorTraceExporter shutting down`),this.sender.shutdown()}}})),sL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AzureMonitorMetricExporter=void 0;let t=(Jd(),d(Kd)),n=HI(),r=uN(),i=MM(),a=GI(),o=tL();e.AzureMonitorMetricExporter=class extends i.AzureMonitorBaseExporter{constructor(e={}){super(e),this._isShutdown=!1,this._sender=new o.HttpSender({endpointUrl:this.endpointUrl,instrumentationKey:this.instrumentationKey,trackStatsbeat:this.trackStatsbeat,exporterOptions:e,aadAudience:this.aadAudience}),t.diag.debug(`AzureMonitorMetricExporter was successfully setup`)}async export(e,n){if(this._isShutdown){t.diag.info(`Exporter shut down. Failed to export spans.`),setTimeout(()=>n({code:r.ExportResultCode.FAILED}),0);return}t.diag.info(`Exporting ${e.scopeMetrics.length} metrics(s). Converting to envelopes...`);let i=(0,a.resourceMetricsToEnvelope)(e,this.instrumentationKey);await t.context.with((0,r.suppressTracing)(t.context.active()),async()=>{n(await this._sender.exportEnvelopes(i))})}async shutdown(){return this._isShutdown=!0,t.diag.info(`AzureMonitorMetricExporter shutting down`),this._sender.shutdown()}selectAggregationTemporality(e){return e===n.InstrumentType.UP_DOWN_COUNTER||e===n.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER?n.AggregationTemporality.CUMULATIVE:n.AggregationTemporality.DELTA}async forceFlush(){return Promise.resolve()}}})),cL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.logToEnvelope=c;let t=JF(),n=nL(),r=(PA(),d(NA)),i=dN(),a=(Jd(),d(Kd)),o=Uj(),s=aL();function c(e,t){let a=(0,n.hrTimeToDate)(e.hrTime),s=t,c=l(e),[d,g]=u(e),_,v,y,b=e.attributes[r.ATTR_EXCEPTION_STACKTRACE],x=e.attributes[r.ATTR_EXCEPTION_TYPE],S=!!(x&&b)||!1,C=!e.attributes[o.ApplicationInsightsBaseType]&&!e.attributes[o.ApplicationInsightsCustomEventName]&&!x;if(S){let t=e.attributes[r.ATTR_EXCEPTION_MESSAGE];_=o.ApplicationInsightsExceptionName,v=o.ApplicationInsightsExceptionBaseType,y={exceptions:[{typeName:String(x),message:String(t),hasFullStack:!!b,stack:String(b)}],severityLevel:String(f(e.severityNumber)),version:2}}else if(e.attributes[o.ApplicationInsightsCustomEventName])_=o.ApplicationInsightsEventName,v=o.ApplicationInsightsEventBaseType,y={name:String(e.attributes[o.ApplicationInsightsCustomEventName]),version:2},g=m(e);else if(C)_=o.ApplicationInsightsMessageName,v=o.ApplicationInsightsMessageBaseType,y={message:String(e.body),severityLevel:String(f(e.severityNumber)),version:2};else if(v=String(e.attributes[o.ApplicationInsightsBaseType]),_=p(e),y=h(e),g=m(e),!y)return;if(y.message&&=String(y.message).substring(0,i.MaxPropertyLengths.FIFTEEN_BIT),d)for(let e of Object.keys(d))d[e]=String(d[e]).substring(0,i.MaxPropertyLengths.THIRTEEN_BIT);return{name:_,sampleRate:100,time:a,instrumentationKey:s,tags:c,version:1,data:{baseType:v,baseData:Object.assign(Object.assign({},y),{properties:d,measurements:g})}}}function l(e){let r=(0,n.createTagsFromResource)(e.resource);return e.spanContext?.traceId&&(r[t.KnownContextTagKeys.AiOperationId]=e.spanContext.traceId),e.spanContext?.spanId&&(r[t.KnownContextTagKeys.AiOperationParentId]=e.spanContext.spanId),e.attributes[t.KnownContextTagKeys.AiOperationName]&&(r[t.KnownContextTagKeys.AiOperationName]=e.attributes[t.KnownContextTagKeys.AiOperationName]),(0,n.isSyntheticSource)(e.attributes)&&(r[t.KnownContextTagKeys.AiOperationSyntheticSource]=`True`),(0,s.getLocationIp)(r,e.attributes),r}function u(e){let r={},a={};if(e.attributes)for(let r of Object.keys(e.attributes))r.startsWith(`_MS.`)||r.startsWith(`microsoft`)||i.legacySemanticValues.includes(r)||i.httpSemanticValues.includes(r)||r===t.KnownContextTagKeys.AiOperationName||(a[r]=(0,n.serializeAttribute)(e.attributes[r]));return[a,r]}function f(e){if(e){if(e>0&&e<9)return t.KnownSeverityLevel.Verbose;if(e>=9&&e<13)return t.KnownSeverityLevel.Information;if(e>=13&&e<17)return t.KnownSeverityLevel.Warning;if(e>=17&&e<21)return t.KnownSeverityLevel.Error;if(e>=21&&e<25)return t.KnownSeverityLevel.Critical}}function p(e){let t=``;switch(e.attributes[o.ApplicationInsightsBaseType]){case o.ApplicationInsightsAvailabilityBaseType:t=o.ApplicationInsightsAvailabilityName;break;case o.ApplicationInsightsExceptionBaseType:t=o.ApplicationInsightsExceptionName;break;case o.ApplicationInsightsMessageBaseType:t=o.ApplicationInsightsMessageName;break;case o.ApplicationInsightsPageViewBaseType:t=o.ApplicationInsightsPageViewName;break;case o.ApplicationInsightsEventBaseType:t=o.ApplicationInsightsEventName;break}return t}function m(e){let t={};return e.body?.measurements&&(t=Object.assign({},e.body.measurements)),t}function h(e){let t={version:2};if(e.body)try{switch(e.attributes[o.ApplicationInsightsBaseType]){case o.ApplicationInsightsAvailabilityBaseType:t=e.body;break;case o.ApplicationInsightsExceptionBaseType:t=e.body;break;case o.ApplicationInsightsMessageBaseType:t=e.body;break;case o.ApplicationInsightsPageViewBaseType:t=e.body;break;case o.ApplicationInsightsEventBaseType:t=e.body;break}typeof t?.message==`object`&&(t.message=JSON.stringify(t.message))}catch{a.diag.error(`AzureMonitorLogExporter failed to parse Application Insights Telemetry`)}return t}})),lL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AzureMonitorLogExporter=void 0;let t=(Jd(),d(Kd)),n=uN(),r=MM(),i=cL(),a=tL();e.AzureMonitorLogExporter=class extends r.AzureMonitorBaseExporter{constructor(e={}){super(e),this._isShutdown=!1,this._sender=new a.HttpSender({endpointUrl:this.endpointUrl,instrumentationKey:this.instrumentationKey,trackStatsbeat:this.trackStatsbeat,exporterOptions:e,aadAudience:this.aadAudience}),t.diag.debug(`AzureMonitorLogExporter was successfully setup`)}async export(e,r){if(this._isShutdown){t.diag.info(`Exporter shut down. Failed to export spans.`),setTimeout(()=>r({code:n.ExportResultCode.FAILED}),0);return}t.diag.info(`Exporting ${e.length} logs(s). Converting to envelopes...`);let a=[];e.forEach(e=>{let t=(0,i.logToEnvelope)(e,this.instrumentationKey);t&&a.push(t)}),await t.context.with((0,n.suppressTracing)(t.context.active()),async()=>{r(await this._sender.exportEnvelopes(a))})}async shutdown(){return this._isShutdown=!0,t.diag.info(`AzureMonitorLogExporter shutting down`),this._sender.shutdown()}}})),uL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AI_OPERATION_NAME=e.ServiceApiVersion=e.AzureMonitorLogExporter=e.AzureMonitorMetricExporter=e.AzureMonitorTraceExporter=e.AzureMonitorBaseExporter=e.ApplicationInsightsSampler=void 0;var t=Wj();Object.defineProperty(e,`ApplicationInsightsSampler`,{enumerable:!0,get:function(){return t.ApplicationInsightsSampler}});var n=MM();Object.defineProperty(e,`AzureMonitorBaseExporter`,{enumerable:!0,get:function(){return n.AzureMonitorBaseExporter}});var r=oL();Object.defineProperty(e,`AzureMonitorTraceExporter`,{enumerable:!0,get:function(){return r.AzureMonitorTraceExporter}});var i=sL();Object.defineProperty(e,`AzureMonitorMetricExporter`,{enumerable:!0,get:function(){return i.AzureMonitorMetricExporter}});var a=lL();Object.defineProperty(e,`AzureMonitorLogExporter`,{enumerable:!0,get:function(){return a.AzureMonitorLogExporter}});var o=AM();Object.defineProperty(e,`ServiceApiVersion`,{enumerable:!0,get:function(){return o.ServiceApiVersion}});var s=AM();Object.defineProperty(e,`AI_OPERATION_NAME`,{enumerable:!0,get:function(){return s.AI_OPERATION_NAME}})})),dL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isTracingSuppressed=e.unsuppressTracing=e.suppressTracing=void 0;let t=(0,(Jd(),d(Kd)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function n(e){return e.setValue(t,!0)}e.suppressTracing=n;function r(e){return e.deleteValue(t)}e.unsuppressTracing=r;function i(e){return e.getValue(t)===!0}e.isTracingSuppressed=i})),fL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BAGGAGE_MAX_TOTAL_LENGTH=e.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=e.BAGGAGE_MAX_NAME_VALUE_PAIRS=e.BAGGAGE_HEADER=e.BAGGAGE_ITEMS_SEPARATOR=e.BAGGAGE_PROPERTIES_SEPARATOR=e.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,e.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,e.BAGGAGE_PROPERTIES_SEPARATOR=`;`,e.BAGGAGE_ITEMS_SEPARATOR=`,`,e.BAGGAGE_HEADER=`baggage`,e.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,e.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,e.BAGGAGE_MAX_TOTAL_LENGTH=8192})),pL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseKeyPairsIntoRecord=e.parsePairKeyValue=e.getKeyPairs=e.serializeKeyPairs=void 0;let t=(Jd(),d(Kd)),n=fL();function r(e){return e.reduce((e,t)=>{let r=`${e}${e===``?``:n.BAGGAGE_ITEMS_SEPARATOR}${t}`;return r.length>n.BAGGAGE_MAX_TOTAL_LENGTH?e:r},``)}e.serializeKeyPairs=r;function i(e){return e.getAllEntries().map(([e,t])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(r+=n.BAGGAGE_PROPERTIES_SEPARATOR+t.metadata.toString()),r})}e.getKeyPairs=i;function a(e){let r=e.split(n.BAGGAGE_PROPERTIES_SEPARATOR);if(r.length<=0)return;let i=r.shift();if(!i)return;let a=i.indexOf(n.BAGGAGE_KEY_PAIR_SEPARATOR);if(a<=0)return;let o=decodeURIComponent(i.substring(0,a).trim()),s=decodeURIComponent(i.substring(a+1).trim()),c;return r.length>0&&(c=(0,t.baggageEntryMetadataFromString)(r.join(n.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:c}}e.parsePairKeyValue=a;function o(e){let t={};return typeof e==`string`&&e.length>0&&e.split(n.BAGGAGE_ITEMS_SEPARATOR).forEach(e=>{let n=a(e);n!==void 0&&n.value.length>0&&(t[n.key]=n.value)}),t}e.parseKeyPairsIntoRecord=o})),mL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.W3CBaggagePropagator=void 0;let t=(Jd(),d(Kd)),n=dL(),r=fL(),i=pL();e.W3CBaggagePropagator=class{inject(e,a,o){let s=t.propagation.getBaggage(e);if(!s||(0,n.isTracingSuppressed)(e))return;let c=(0,i.getKeyPairs)(s).filter(e=>e.length<=r.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,r.BAGGAGE_MAX_NAME_VALUE_PAIRS),l=(0,i.serializeKeyPairs)(c);l.length>0&&o.set(a,r.BAGGAGE_HEADER,l)}extract(e,n,a){let o=a.get(n,r.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(r.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let c={};return s.length===0||(s.split(r.BAGGAGE_ITEMS_SEPARATOR).forEach(e=>{let t=(0,i.parsePairKeyValue)(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),c[t.key]=e}}),Object.entries(c).length===0)?e:t.propagation.setBaggage(e,t.propagation.createBaggage(c))}fields(){return[r.BAGGAGE_HEADER]}}})),hL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AnchoredClock=void 0,e.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,t){this._monotonicClock=t,this._epochMillis=e.now(),this._performanceMillis=t.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}}})),gL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isAttributeValue=e.isAttributeKey=e.sanitizeAttributes=void 0;let t=(Jd(),d(Kd));function n(e){let n={};if(typeof e!=`object`||!e)return n;for(let[a,o]of Object.entries(e)){if(!r(a)){t.diag.warn(`Invalid attribute key: ${a}`);continue}if(!i(o)){t.diag.warn(`Invalid attribute value set for key: ${a}`);continue}Array.isArray(o)?n[a]=o.slice():n[a]=o}return n}e.sanitizeAttributes=n;function r(e){return typeof e==`string`&&e.length>0}e.isAttributeKey=r;function i(e){return e==null?!0:Array.isArray(e)?a(e):o(e)}e.isAttributeValue=i;function a(e){let t;for(let n of e)if(n!=null){if(!t){if(o(n)){t=typeof n;continue}return!1}if(typeof n!==t)return!1}return!0}function o(e){switch(typeof e){case`number`:case`boolean`:case`string`:return!0}return!1}})),_L=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.loggingErrorHandler=void 0;let t=(Jd(),d(Kd));function n(){return e=>{t.diag.error(r(e))}}e.loggingErrorHandler=n;function r(e){return typeof e==`string`?e:JSON.stringify(i(e))}function i(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}})),vL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.globalErrorHandler=e.setGlobalErrorHandler=void 0;let t=(0,_L().loggingErrorHandler)();function n(e){t=e}e.setGlobalErrorHandler=n;function r(e){try{t(e)}catch{}}e.globalErrorHandler=r})),oee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getStringListFromEnv=e.getBooleanFromEnv=e.getStringFromEnv=e.getNumberFromEnv=void 0;let t=(Jd(),d(Kd)),n=require(`util`);function r(e){let r=process.env[e];if(r==null||r.trim()===``)return;let i=Number(r);if(isNaN(i)){t.diag.warn(`Unknown value ${(0,n.inspect)(r)} for ${e}, expected a number, using defaults`);return}return i}e.getNumberFromEnv=r;function i(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}e.getStringFromEnv=i;function a(e){let r=process.env[e]?.trim().toLowerCase();return r==null||r===``?!1:r===`true`?!0:(r===`false`||t.diag.warn(`Unknown value ${(0,n.inspect)(r)} for ${e}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}e.getBooleanFromEnv=a;function o(e){return i(e)?.split(`,`).map(e=>e.trim()).filter(e=>e!==``)}e.getStringListFromEnv=o})),yL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._globalThis=void 0,e._globalThis=typeof globalThis==`object`?globalThis:global})),bL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.otperformance=void 0,e.otperformance=require(`perf_hooks`).performance})),xL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`2.1.0`})),SL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_PROCESS_RUNTIME_NAME=void 0,e.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),CL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SDK_INFO=void 0;let t=xL(),n=(PA(),d(NA)),r=SL();e.SDK_INFO={[n.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[r.ATTR_PROCESS_RUNTIME_NAME]:`node`,[n.ATTR_TELEMETRY_SDK_LANGUAGE]:n.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[n.ATTR_TELEMETRY_SDK_VERSION]:t.VERSION}})),wL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.unrefTimer=void 0;function t(e){e.unref()}e.unrefTimer=t})),TL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.unrefTimer=e.SDK_INFO=e.otperformance=e._globalThis=e.getStringListFromEnv=e.getNumberFromEnv=e.getBooleanFromEnv=e.getStringFromEnv=void 0;var t=oee();Object.defineProperty(e,`getStringFromEnv`,{enumerable:!0,get:function(){return t.getStringFromEnv}}),Object.defineProperty(e,`getBooleanFromEnv`,{enumerable:!0,get:function(){return t.getBooleanFromEnv}}),Object.defineProperty(e,`getNumberFromEnv`,{enumerable:!0,get:function(){return t.getNumberFromEnv}}),Object.defineProperty(e,`getStringListFromEnv`,{enumerable:!0,get:function(){return t.getStringListFromEnv}});var n=yL();Object.defineProperty(e,`_globalThis`,{enumerable:!0,get:function(){return n._globalThis}});var r=bL();Object.defineProperty(e,`otperformance`,{enumerable:!0,get:function(){return r.otperformance}});var i=CL();Object.defineProperty(e,`SDK_INFO`,{enumerable:!0,get:function(){return i.SDK_INFO}});var a=wL();Object.defineProperty(e,`unrefTimer`,{enumerable:!0,get:function(){return a.unrefTimer}})})),EL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getStringListFromEnv=e.getNumberFromEnv=e.getStringFromEnv=e.getBooleanFromEnv=e.unrefTimer=e.otperformance=e._globalThis=e.SDK_INFO=void 0;var t=TL();Object.defineProperty(e,`SDK_INFO`,{enumerable:!0,get:function(){return t.SDK_INFO}}),Object.defineProperty(e,`_globalThis`,{enumerable:!0,get:function(){return t._globalThis}}),Object.defineProperty(e,`otperformance`,{enumerable:!0,get:function(){return t.otperformance}}),Object.defineProperty(e,`unrefTimer`,{enumerable:!0,get:function(){return t.unrefTimer}}),Object.defineProperty(e,`getBooleanFromEnv`,{enumerable:!0,get:function(){return t.getBooleanFromEnv}}),Object.defineProperty(e,`getStringFromEnv`,{enumerable:!0,get:function(){return t.getStringFromEnv}}),Object.defineProperty(e,`getNumberFromEnv`,{enumerable:!0,get:function(){return t.getNumberFromEnv}}),Object.defineProperty(e,`getStringListFromEnv`,{enumerable:!0,get:function(){return t.getStringListFromEnv}})})),DL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.addHrTimes=e.isTimeInput=e.isTimeInputHrTime=e.hrTimeToMicroseconds=e.hrTimeToMilliseconds=e.hrTimeToNanoseconds=e.hrTimeToTimeStamp=e.hrTimeDuration=e.timeInputToHrTime=e.hrTime=e.getTimeOrigin=e.millisToHrTime=void 0;let t=EL(),n=10**6,r=10**9;function i(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*n)]}e.millisToHrTime=i;function a(){let e=t.otperformance.timeOrigin;if(typeof e!=`number`){let n=t.otperformance;e=n.timing&&n.timing.fetchStart}return e}e.getTimeOrigin=a;function o(e){return h(i(a()),i(typeof e==`number`?e:t.otperformance.now()))}e.hrTime=o;function s(e){if(p(e))return e;if(typeof e==`number`)return e<a()?o(e):i(e);if(e instanceof Date)return i(e.getTime());throw TypeError(`Invalid input type`)}e.timeInputToHrTime=s;function c(e,t){let n=t[0]-e[0],i=t[1]-e[1];return i<0&&(--n,i+=r),[n,i]}e.hrTimeDuration=c;function l(e){let t=`${`0`.repeat(9)}${e[1]}Z`,n=t.substring(t.length-9-1);return new Date(e[0]*1e3).toISOString().replace(`000Z`,n)}e.hrTimeToTimeStamp=l;function u(e){return e[0]*r+e[1]}e.hrTimeToNanoseconds=u;function d(e){return e[0]*1e3+e[1]/1e6}e.hrTimeToMilliseconds=d;function f(e){return e[0]*1e6+e[1]/1e3}e.hrTimeToMicroseconds=f;function p(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}e.isTimeInputHrTime=p;function m(e){return p(e)||typeof e==`number`||e instanceof Date}e.isTimeInput=m;function h(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=r&&(n[1]-=r,n[0]+=1),n}e.addHrTimes=h})),OL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExportResultCode=void 0,(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(e.ExportResultCode||={})})),kL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CompositePropagator=void 0;let t=(Jd(),d(Kd));e.CompositePropagator=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(e=>typeof e.fields==`function`?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,n,r){for(let i of this._propagators)try{i.inject(e,n,r)}catch(e){t.diag.warn(`Failed to inject with ${i.constructor.name}. Err: ${e.message}`)}}extract(e,n,r){return this._propagators.reduce((e,i)=>{try{return i.extract(e,n,r)}catch(e){t.diag.warn(`Failed to extract with ${i.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}})),AL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateValue=e.validateKey=void 0;let t=`[_0-9a-z-*/]`,n=`[a-z]${t}{0,255}`,r=`[a-z0-9]${t}{0,240}@[a-z]${t}{0,13}`,i=RegExp(`^(?:${n}|${r})$`),a=/^[ -~]{0,255}[!-~]$/,o=/,|=/;function s(e){return i.test(e)}e.validateKey=s;function c(e){return a.test(e)&&!o.test(e)}e.validateValue=c})),jL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TraceState=void 0;let t=AL();e.TraceState=class e{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+`=`+this.get(t)),e),[]).join(`,`)}_parse(e){e.length>512||(this._internalState=e.split(`,`).reverse().reduce((e,n)=>{let r=n.trim(),i=r.indexOf(`=`);if(i!==-1){let a=r.slice(0,i),o=r.slice(i+1,n.length);(0,t.validateKey)(a)&&(0,t.validateValue)(o)&&e.set(a,o)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}}})),ML=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.W3CTraceContextPropagator=e.parseTraceParent=e.TRACE_STATE_HEADER=e.TRACE_PARENT_HEADER=void 0;let t=(Jd(),d(Kd)),n=dL(),r=jL();e.TRACE_PARENT_HEADER=`traceparent`,e.TRACE_STATE_HEADER=`tracestate`;let i=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function a(e){let t=i.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}e.parseTraceParent=a,e.W3CTraceContextPropagator=class{inject(r,i,a){let o=t.trace.getSpanContext(r);if(!o||(0,n.isTracingSuppressed)(r)||!(0,t.isSpanContextValid)(o))return;let s=`00-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||t.TraceFlags.NONE).toString(16)}`;a.set(i,e.TRACE_PARENT_HEADER,s),o.traceState&&a.set(i,e.TRACE_STATE_HEADER,o.traceState.serialize())}extract(n,i,o){let s=o.get(i,e.TRACE_PARENT_HEADER);if(!s)return n;let c=Array.isArray(s)?s[0]:s;if(typeof c!=`string`)return n;let l=a(c);if(!l)return n;l.isRemote=!0;let u=o.get(i,e.TRACE_STATE_HEADER);if(u){let e=Array.isArray(u)?u.join(`,`):u;l.traceState=new r.TraceState(typeof e==`string`?e:void 0)}return t.trace.setSpanContext(n,l)}fields(){return[e.TRACE_PARENT_HEADER,e.TRACE_STATE_HEADER]}}})),NL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRPCMetadata=e.deleteRPCMetadata=e.setRPCMetadata=e.RPCType=void 0;let t=(0,(Jd(),d(Kd)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(e){e.HTTP=`http`})(e.RPCType||={});function n(e,n){return e.setValue(t,n)}e.setRPCMetadata=n;function r(e){return e.deleteValue(t)}e.deleteRPCMetadata=r;function i(e){return e.getValue(t)}e.getRPCMetadata=i})),PL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isPlainObject=void 0;let t=Function.prototype.toString,n=t.call(Object),r=Object.getPrototypeOf,i=Object.prototype,a=i.hasOwnProperty,o=Symbol?Symbol.toStringTag:void 0,s=i.toString;function c(e){if(!l(e)||u(e)!==`[object Object]`)return!1;let i=r(e);if(i===null)return!0;let o=a.call(i,`constructor`)&&i.constructor;return typeof o==`function`&&o instanceof o&&t.call(o)===n}e.isPlainObject=c;function l(e){return typeof e==`object`&&!!e}function u(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:o&&o in Object(e)?d(e):f(e)}function d(e){let t=a.call(e,o),n=e[o],r=!1;try{e[o]=void 0,r=!0}catch{}let i=s.call(e);return r&&(t?e[o]=n:delete e[o]),i}function f(e){return s.call(e)}})),FL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.merge=void 0;let t=PL();function n(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=i(t,e.shift(),0,n);return t}e.merge=n;function r(e){return o(e)?e.slice():e}function i(e,t,n=0,d){let f;if(!(n>20)){if(n++,l(e)||l(t)||s(t))f=r(t);else if(o(e)){if(f=e.slice(),o(t))for(let e=0,n=t.length;e<n;e++)f.push(r(t[e]));else if(c(t)){let e=Object.keys(t);for(let n=0,i=e.length;n<i;n++){let i=e[n];f[i]=r(t[i])}}}else if(c(e))if(c(t)){if(!u(e,t))return t;f=Object.assign({},e);let r=Object.keys(t);for(let o=0,s=r.length;o<s;o++){let s=r[o],u=t[s];if(l(u))u===void 0?delete f[s]:f[s]=u;else{let r=f[s],o=u;if(a(e,s,d)||a(t,s,d))delete f[s];else{if(c(r)&&c(o)){let n=d.get(r)||[],i=d.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),d.set(r,n),d.set(o,i)}f[s]=i(f[s],u,n,d)}}}}else f=t;return f}}function a(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function o(e){return Array.isArray(e)}function s(e){return typeof e==`function`}function c(e){return!l(e)&&!o(e)&&!s(e)&&typeof e==`object`}function l(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function u(e,n){return!(!(0,t.isPlainObject)(e)||!(0,t.isPlainObject)(n))}})),IL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callWithTimeout=e.TimeoutError=void 0;var t=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};e.TimeoutError=t;function n(e,n){let r,i=new Promise(function(e,i){r=setTimeout(function(){i(new t(`Operation timed out.`))},n)});return Promise.race([e,i]).then(e=>(clearTimeout(r),e),e=>{throw clearTimeout(r),e})}e.callWithTimeout=n})),LL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isUrlIgnored=e.urlMatches=void 0;function t(e,t){return typeof t==`string`?e===t:!!e.match(t)}e.urlMatches=t;function n(e,n){if(!n)return!1;for(let r of n)if(t(e,r))return!0;return!1}e.isUrlIgnored=n})),RL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Deferred=void 0,e.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),zL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BindOnceFuture=void 0;let t=RL();e.BindOnceFuture=class{_callback;_that;_isCalled=!1;_deferred=new t.Deferred;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}})),BL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.diagLogLevelFromString=void 0;let t=(Jd(),d(Kd)),n={ALL:t.DiagLogLevel.ALL,VERBOSE:t.DiagLogLevel.VERBOSE,DEBUG:t.DiagLogLevel.DEBUG,INFO:t.DiagLogLevel.INFO,WARN:t.DiagLogLevel.WARN,ERROR:t.DiagLogLevel.ERROR,NONE:t.DiagLogLevel.NONE};function r(e){return e==null?void 0:n[e.toUpperCase()]??(t.diag.warn(`Unknown log level "${e}", expected one of ${Object.keys(n)}, using default`),t.DiagLogLevel.INFO)}e.diagLogLevelFromString=r})),VL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._export=void 0;let t=(Jd(),d(Kd)),n=dL();function r(e,r){return new Promise(i=>{t.context.with((0,n.suppressTracing)(t.context.active()),()=>{e.export(r,e=>{i(e)})})})}e._export=r})),HL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.internal=e.diagLogLevelFromString=e.BindOnceFuture=e.urlMatches=e.isUrlIgnored=e.callWithTimeout=e.TimeoutError=e.merge=e.TraceState=e.unsuppressTracing=e.suppressTracing=e.isTracingSuppressed=e.setRPCMetadata=e.getRPCMetadata=e.deleteRPCMetadata=e.RPCType=e.parseTraceParent=e.W3CTraceContextPropagator=e.TRACE_STATE_HEADER=e.TRACE_PARENT_HEADER=e.CompositePropagator=e.unrefTimer=e.otperformance=e.getStringListFromEnv=e.getNumberFromEnv=e.getBooleanFromEnv=e.getStringFromEnv=e._globalThis=e.SDK_INFO=e.parseKeyPairsIntoRecord=e.ExportResultCode=e.timeInputToHrTime=e.millisToHrTime=e.isTimeInputHrTime=e.isTimeInput=e.hrTimeToTimeStamp=e.hrTimeToNanoseconds=e.hrTimeToMilliseconds=e.hrTimeToMicroseconds=e.hrTimeDuration=e.hrTime=e.getTimeOrigin=e.addHrTimes=e.loggingErrorHandler=e.setGlobalErrorHandler=e.globalErrorHandler=e.sanitizeAttributes=e.isAttributeValue=e.AnchoredClock=e.W3CBaggagePropagator=void 0;var t=mL();Object.defineProperty(e,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return t.W3CBaggagePropagator}});var n=hL();Object.defineProperty(e,`AnchoredClock`,{enumerable:!0,get:function(){return n.AnchoredClock}});var r=gL();Object.defineProperty(e,`isAttributeValue`,{enumerable:!0,get:function(){return r.isAttributeValue}}),Object.defineProperty(e,`sanitizeAttributes`,{enumerable:!0,get:function(){return r.sanitizeAttributes}});var i=vL();Object.defineProperty(e,`globalErrorHandler`,{enumerable:!0,get:function(){return i.globalErrorHandler}}),Object.defineProperty(e,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return i.setGlobalErrorHandler}});var a=_L();Object.defineProperty(e,`loggingErrorHandler`,{enumerable:!0,get:function(){return a.loggingErrorHandler}});var o=DL();Object.defineProperty(e,`addHrTimes`,{enumerable:!0,get:function(){return o.addHrTimes}}),Object.defineProperty(e,`getTimeOrigin`,{enumerable:!0,get:function(){return o.getTimeOrigin}}),Object.defineProperty(e,`hrTime`,{enumerable:!0,get:function(){return o.hrTime}}),Object.defineProperty(e,`hrTimeDuration`,{enumerable:!0,get:function(){return o.hrTimeDuration}}),Object.defineProperty(e,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return o.hrTimeToMicroseconds}}),Object.defineProperty(e,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return o.hrTimeToMilliseconds}}),Object.defineProperty(e,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return o.hrTimeToNanoseconds}}),Object.defineProperty(e,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return o.hrTimeToTimeStamp}}),Object.defineProperty(e,`isTimeInput`,{enumerable:!0,get:function(){return o.isTimeInput}}),Object.defineProperty(e,`isTimeInputHrTime`,{enumerable:!0,get:function(){return o.isTimeInputHrTime}}),Object.defineProperty(e,`millisToHrTime`,{enumerable:!0,get:function(){return o.millisToHrTime}}),Object.defineProperty(e,`timeInputToHrTime`,{enumerable:!0,get:function(){return o.timeInputToHrTime}});var s=OL();Object.defineProperty(e,`ExportResultCode`,{enumerable:!0,get:function(){return s.ExportResultCode}});var c=pL();Object.defineProperty(e,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return c.parseKeyPairsIntoRecord}});var l=EL();Object.defineProperty(e,`SDK_INFO`,{enumerable:!0,get:function(){return l.SDK_INFO}}),Object.defineProperty(e,`_globalThis`,{enumerable:!0,get:function(){return l._globalThis}}),Object.defineProperty(e,`getStringFromEnv`,{enumerable:!0,get:function(){return l.getStringFromEnv}}),Object.defineProperty(e,`getBooleanFromEnv`,{enumerable:!0,get:function(){return l.getBooleanFromEnv}}),Object.defineProperty(e,`getNumberFromEnv`,{enumerable:!0,get:function(){return l.getNumberFromEnv}}),Object.defineProperty(e,`getStringListFromEnv`,{enumerable:!0,get:function(){return l.getStringListFromEnv}}),Object.defineProperty(e,`otperformance`,{enumerable:!0,get:function(){return l.otperformance}}),Object.defineProperty(e,`unrefTimer`,{enumerable:!0,get:function(){return l.unrefTimer}});var u=kL();Object.defineProperty(e,`CompositePropagator`,{enumerable:!0,get:function(){return u.CompositePropagator}});var d=ML();Object.defineProperty(e,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return d.TRACE_PARENT_HEADER}}),Object.defineProperty(e,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return d.TRACE_STATE_HEADER}}),Object.defineProperty(e,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return d.W3CTraceContextPropagator}}),Object.defineProperty(e,`parseTraceParent`,{enumerable:!0,get:function(){return d.parseTraceParent}});var f=NL();Object.defineProperty(e,`RPCType`,{enumerable:!0,get:function(){return f.RPCType}}),Object.defineProperty(e,`deleteRPCMetadata`,{enumerable:!0,get:function(){return f.deleteRPCMetadata}}),Object.defineProperty(e,`getRPCMetadata`,{enumerable:!0,get:function(){return f.getRPCMetadata}}),Object.defineProperty(e,`setRPCMetadata`,{enumerable:!0,get:function(){return f.setRPCMetadata}});var p=dL();Object.defineProperty(e,`isTracingSuppressed`,{enumerable:!0,get:function(){return p.isTracingSuppressed}}),Object.defineProperty(e,`suppressTracing`,{enumerable:!0,get:function(){return p.suppressTracing}}),Object.defineProperty(e,`unsuppressTracing`,{enumerable:!0,get:function(){return p.unsuppressTracing}});var m=jL();Object.defineProperty(e,`TraceState`,{enumerable:!0,get:function(){return m.TraceState}});var h=FL();Object.defineProperty(e,`merge`,{enumerable:!0,get:function(){return h.merge}});var g=IL();Object.defineProperty(e,`TimeoutError`,{enumerable:!0,get:function(){return g.TimeoutError}}),Object.defineProperty(e,`callWithTimeout`,{enumerable:!0,get:function(){return g.callWithTimeout}});var _=LL();Object.defineProperty(e,`isUrlIgnored`,{enumerable:!0,get:function(){return _.isUrlIgnored}}),Object.defineProperty(e,`urlMatches`,{enumerable:!0,get:function(){return _.urlMatches}});var v=zL();Object.defineProperty(e,`BindOnceFuture`,{enumerable:!0,get:function(){return v.BindOnceFuture}});var y=BL();Object.defineProperty(e,`diagLogLevelFromString`,{enumerable:!0,get:function(){return y.diagLogLevelFromString}}),e.internal={_export:VL()._export}})),UL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=void 0;function t(){return`unknown_service:${process.argv0}`}e.defaultServiceName=t})),WL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=void 0;var t=UL();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return t.defaultServiceName}})})),GL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=void 0;var t=WL();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return t.defaultServiceName}})})),KL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.identity=e.isPromiseLike=void 0,e.isPromiseLike=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;function t(e){return e}e.identity=t})),qL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultResource=e.emptyResource=e.resourceFromDetectedResource=e.resourceFromAttributes=void 0;let t=(Jd(),d(Kd)),n=HL(),r=(PA(),d(NA)),i=GL(),a=KL();var o=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=f(t),r._asyncAttributesPending=t.filter(([e,t])=>(0,a.isPromiseLike)(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>((0,a.isPromiseLike)(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=f(this._rawAttributes),this._schemaUrl=p(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,(0,a.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&t.diag.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[n,r]of this._rawAttributes){if((0,a.isPromiseLike)(r)){t.diag.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=m(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function s(e,t){return o.FromAttributeList(Object.entries(e),t)}e.resourceFromAttributes=s;function c(e,t){return new o(e,t)}e.resourceFromDetectedResource=c;function l(){return s({})}e.emptyResource=l;function u(){return s({[r.ATTR_SERVICE_NAME]:(0,i.defaultServiceName)(),[r.ATTR_TELEMETRY_SDK_LANGUAGE]:n.SDK_INFO[r.ATTR_TELEMETRY_SDK_LANGUAGE],[r.ATTR_TELEMETRY_SDK_NAME]:n.SDK_INFO[r.ATTR_TELEMETRY_SDK_NAME],[r.ATTR_TELEMETRY_SDK_VERSION]:n.SDK_INFO[r.ATTR_TELEMETRY_SDK_VERSION]})}e.defaultResource=u;function f(e){return e.map(([e,n])=>(0,a.isPromiseLike)(n)?[e,n.catch(n=>{t.diag.debug(`promise rejection for resource attribute: %s - %s`,e,n)})]:[e,n])}function p(e){if(typeof e==`string`||e===void 0)return e;t.diag.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function m(e,n){let r=e?.schemaUrl,i=n?.schemaUrl,a=r===void 0||r===``,o=i===void 0||i===``;if(a)return i;if(o||r===i)return r;t.diag.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,r,i)}})),JL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.detectResources=void 0;let t=(Jd(),d(Kd)),n=qL();e.detectResources=(e={})=>(e.detectors||[]).map(r=>{try{let i=(0,n.resourceFromDetectedResource)(r.detect(e));return t.diag.debug(`${r.constructor.name} found resource.`,i),i}catch(e){return t.diag.debug(`${r.constructor.name} failed: ${e.message}`),(0,n.emptyResource)()}}).reduce((e,t)=>e.merge(t),(0,n.emptyResource)())})),YL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.envDetector=void 0;let t=(Jd(),d(Kd)),n=(PA(),d(NA)),r=HL();e.envDetector=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;_ERROR_MESSAGE_INVALID_CHARS=`should be a ASCII string with a length greater than 0 and not exceed `+this._MAX_LENGTH+` characters.`;_ERROR_MESSAGE_INVALID_VALUE=`should be a ASCII string with a length not exceed `+this._MAX_LENGTH+` characters.`;detect(e){let i={},a=(0,r.getStringFromEnv)(`OTEL_RESOURCE_ATTRIBUTES`),o=(0,r.getStringFromEnv)(`OTEL_SERVICE_NAME`);if(a)try{let e=this._parseResourceAttributes(a);Object.assign(i,e)}catch(e){t.diag.debug(`EnvDetector failed: ${e.message}`)}return o&&(i[n.ATTR_SERVICE_NAME]=o),{attributes:i}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR,-1);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(n.length!==2)continue;let[r,i]=n;if(r=r.trim(),i=i.trim().split(/^"|"$/).join(``),!this._isValidAndNotEmpty(r))throw Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(i))throw Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);t[r]=decodeURIComponent(i)}return t}_isValid(e){return e.length<=this._MAX_LENGTH&&this._isBaggageOctetString(e)}_isBaggageOctetString(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<33||n===44||n===59||n===92||n>126)return!1}return!0}_isValidAndNotEmpty(e){return e.length>0&&this._isValid(e)}}})),XL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_WEBENGINE_VERSION=e.ATTR_WEBENGINE_NAME=e.ATTR_WEBENGINE_DESCRIPTION=e.ATTR_SERVICE_NAMESPACE=e.ATTR_SERVICE_INSTANCE_ID=e.ATTR_PROCESS_RUNTIME_VERSION=e.ATTR_PROCESS_RUNTIME_NAME=e.ATTR_PROCESS_RUNTIME_DESCRIPTION=e.ATTR_PROCESS_PID=e.ATTR_PROCESS_OWNER=e.ATTR_PROCESS_EXECUTABLE_PATH=e.ATTR_PROCESS_EXECUTABLE_NAME=e.ATTR_PROCESS_COMMAND_ARGS=e.ATTR_PROCESS_COMMAND=e.ATTR_OS_VERSION=e.ATTR_OS_TYPE=e.ATTR_K8S_POD_NAME=e.ATTR_K8S_NAMESPACE_NAME=e.ATTR_K8S_DEPLOYMENT_NAME=e.ATTR_K8S_CLUSTER_NAME=e.ATTR_HOST_TYPE=e.ATTR_HOST_NAME=e.ATTR_HOST_IMAGE_VERSION=e.ATTR_HOST_IMAGE_NAME=e.ATTR_HOST_IMAGE_ID=e.ATTR_HOST_ID=e.ATTR_HOST_ARCH=e.ATTR_CONTAINER_NAME=e.ATTR_CONTAINER_IMAGE_TAGS=e.ATTR_CONTAINER_IMAGE_NAME=e.ATTR_CONTAINER_ID=e.ATTR_CLOUD_REGION=e.ATTR_CLOUD_PROVIDER=e.ATTR_CLOUD_AVAILABILITY_ZONE=e.ATTR_CLOUD_ACCOUNT_ID=void 0,e.ATTR_CLOUD_ACCOUNT_ID=`cloud.account.id`,e.ATTR_CLOUD_AVAILABILITY_ZONE=`cloud.availability_zone`,e.ATTR_CLOUD_PROVIDER=`cloud.provider`,e.ATTR_CLOUD_REGION=`cloud.region`,e.ATTR_CONTAINER_ID=`container.id`,e.ATTR_CONTAINER_IMAGE_NAME=`container.image.name`,e.ATTR_CONTAINER_IMAGE_TAGS=`container.image.tags`,e.ATTR_CONTAINER_NAME=`container.name`,e.ATTR_HOST_ARCH=`host.arch`,e.ATTR_HOST_ID=`host.id`,e.ATTR_HOST_IMAGE_ID=`host.image.id`,e.ATTR_HOST_IMAGE_NAME=`host.image.name`,e.ATTR_HOST_IMAGE_VERSION=`host.image.version`,e.ATTR_HOST_NAME=`host.name`,e.ATTR_HOST_TYPE=`host.type`,e.ATTR_K8S_CLUSTER_NAME=`k8s.cluster.name`,e.ATTR_K8S_DEPLOYMENT_NAME=`k8s.deployment.name`,e.ATTR_K8S_NAMESPACE_NAME=`k8s.namespace.name`,e.ATTR_K8S_POD_NAME=`k8s.pod.name`,e.ATTR_OS_TYPE=`os.type`,e.ATTR_OS_VERSION=`os.version`,e.ATTR_PROCESS_COMMAND=`process.command`,e.ATTR_PROCESS_COMMAND_ARGS=`process.command_args`,e.ATTR_PROCESS_EXECUTABLE_NAME=`process.executable.name`,e.ATTR_PROCESS_EXECUTABLE_PATH=`process.executable.path`,e.ATTR_PROCESS_OWNER=`process.owner`,e.ATTR_PROCESS_PID=`process.pid`,e.ATTR_PROCESS_RUNTIME_DESCRIPTION=`process.runtime.description`,e.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,e.ATTR_PROCESS_RUNTIME_VERSION=`process.runtime.version`,e.ATTR_SERVICE_INSTANCE_ID=`service.instance.id`,e.ATTR_SERVICE_NAMESPACE=`service.namespace`,e.ATTR_WEBENGINE_DESCRIPTION=`webengine.description`,e.ATTR_WEBENGINE_NAME=`webengine.name`,e.ATTR_WEBENGINE_VERSION=`webengine.version`})),ZL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getMachineId=void 0;let t=require(`process`),n;async function r(){if(!n)switch(t.platform){case`darwin`:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-darwin-qxG7FDMy.cjs`).default))).getMachineId;break;case`linux`:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-linux-Dnsx6XjV.cjs`).default))).getMachineId;break;case`freebsd`:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-bsd-C6vJ2MI6.cjs`).default))).getMachineId;break;case`win32`:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-win-BDuHxVob.cjs`).default))).getMachineId;break;default:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-unsupported-BE5onnLI.cjs`).default))).getMachineId;break}return n()}e.getMachineId=r})),QL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.normalizeType=e.normalizeArch=void 0,e.normalizeArch=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},e.normalizeType=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),$L=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hostDetector=void 0;let t=XL(),n=require(`os`),r=ZL(),i=QL();e.hostDetector=new class{detect(e){return{attributes:{[t.ATTR_HOST_NAME]:(0,n.hostname)(),[t.ATTR_HOST_ARCH]:(0,i.normalizeArch)((0,n.arch)()),[t.ATTR_HOST_ID]:(0,r.getMachineId)()}}}}})),eR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.osDetector=void 0;let t=XL(),n=require(`os`),r=QL();e.osDetector=new class{detect(e){return{attributes:{[t.ATTR_OS_TYPE]:(0,r.normalizeType)((0,n.platform)()),[t.ATTR_OS_VERSION]:(0,n.release)()}}}}})),tR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.processDetector=void 0;let t=(Jd(),d(Kd)),n=XL(),r=require(`os`);e.processDetector=new class{detect(e){let i={[n.ATTR_PROCESS_PID]:process.pid,[n.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[n.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[n.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[n.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[n.ATTR_PROCESS_RUNTIME_NAME]:`nodejs`,[n.ATTR_PROCESS_RUNTIME_DESCRIPTION]:`Node.js`};process.argv.length>1&&(i[n.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let e=r.userInfo();i[n.ATTR_PROCESS_OWNER]=e.username}catch(e){t.diag.debug(`error obtaining process owner: ${e}`)}return{attributes:i}}}})),nR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=void 0;let t=XL(),n=require(`crypto`);e.serviceInstanceIdDetector=new class{detect(e){return{attributes:{[t.ATTR_SERVICE_INSTANCE_ID]:(0,n.randomUUID)()}}}}})),rR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=$L();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}});var n=eR();Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}});var r=tR();Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return r.processDetector}});var i=nR();Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return i.serviceInstanceIdDetector}})})),iR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=rR();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return t.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return t.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return t.serviceInstanceIdDetector}})})),aR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.NoopDetector=void 0;var t=class{detect(){return{attributes:{}}}};e.NoopDetector=t,e.noopDetector=new t})),oR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=void 0;var t=YL();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return t.envDetector}});var n=iR();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return n.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return n.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return n.serviceInstanceIdDetector}});var r=aR();Object.defineProperty(e,`noopDetector`,{enumerable:!0,get:function(){return r.noopDetector}})})),sR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=e.emptyResource=e.defaultResource=e.resourceFromAttributes=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=e.detectResources=void 0;var t=JL();Object.defineProperty(e,`detectResources`,{enumerable:!0,get:function(){return t.detectResources}});var n=oR();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return n.envDetector}}),Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return n.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return n.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return n.serviceInstanceIdDetector}});var r=qL();Object.defineProperty(e,`resourceFromAttributes`,{enumerable:!0,get:function(){return r.resourceFromAttributes}}),Object.defineProperty(e,`defaultResource`,{enumerable:!0,get:function(){return r.defaultResource}}),Object.defineProperty(e,`emptyResource`,{enumerable:!0,get:function(){return r.emptyResource}});var i=GL();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return i.defaultServiceName}})})),cR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LogRecordImpl=void 0;let t=(Jd(),d(Kd)),n=HL();e.LogRecordImpl=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,r,i){let{timestamp:a,observedTimestamp:o,eventName:s,severityNumber:c,severityText:l,body:u,attributes:d={},context:f}=i,p=Date.now();if(this.hrTime=(0,n.timeInputToHrTime)(a??p),this.hrTimeObserved=(0,n.timeInputToHrTime)(o??p),f){let e=t.trace.getSpanContext(f);e&&t.isSpanContextValid(e)&&(this.spanContext=e)}this.severityNumber=c,this.severityText=l,this.body=u,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=s,this.setAttributes(d)}setAttribute(e,r){return this._isLogRecordReadonly()||r===null?this:e.length===0?(t.diag.warn(`Invalid attribute key: ${e}`),this):!(0,n.isAttributeValue)(r)&&!(typeof r==`object`&&!Array.isArray(r)&&Object.keys(r).length>0)?(t.diag.warn(`Invalid attribute value set for key: ${e}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&t.diag.warn(`Dropping extra attributes.`),this):((0,n.isAttributeValue)(r)?this.attributes[e]=this._truncateToSize(r):this.attributes[e]=r,this))}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let n=this._logRecordLimits.attributeValueLengthLimit;return n<=0?(t.diag.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e==`string`?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,n):e):e}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&t.diag.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),lR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Logger=void 0;let t=(Jd(),d(Kd)),n=cR();e.Logger=class{instrumentationScope;_sharedState;constructor(e,t){this.instrumentationScope=e,this._sharedState=t}emit(e){let r=e.context||t.context.active(),i=new n.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(i,r),i._makeReadonly()}}})),uR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reconfigureLimits=e.loadDefaultConfig=void 0;let t=HL();function n(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,t.getNumberFromEnv)(`OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,t.getNumberFromEnv)(`OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT`)??128},includeTraceContext:!0}}e.loadDefaultConfig=n;function r(e){return{attributeCountLimit:e.attributeCountLimit??(0,t.getNumberFromEnv)(`OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT`)??(0,t.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,attributeValueLengthLimit:e.attributeValueLengthLimit??(0,t.getNumberFromEnv)(`OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,t.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0}}e.reconfigureLimits=r})),dR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NoopLogRecordProcessor=void 0,e.NoopLogRecordProcessor=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}}})),fR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MultiLogRecordProcessor=void 0;let t=HL();e.MultiLogRecordProcessor=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(n=>(0,t.callWithTimeout)(n.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}}})),pR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LoggerProviderSharedState=void 0;let t=dR(),n=fR();e.LoggerProviderSharedState=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=i,this.processors=a,a.length>0?(this.registeredLogRecordProcessors=a,this.activeProcessor=new n.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new t.NoopLogRecordProcessor}}})),mR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LoggerProvider=e.DEFAULT_LOGGER_NAME=void 0;let t=(Jd(),d(Kd)),n=Li(),r=sR(),i=HL(),a=lR(),o=uR(),s=pR();e.DEFAULT_LOGGER_NAME=`unknown`,e.LoggerProvider=class{_shutdownOnce;_sharedState;constructor(e={}){let t=(0,i.merge)({},(0,o.loadDefaultConfig)(),e),n=e.resource??(0,r.defaultResource)();this._sharedState=new s.LoggerProviderSharedState(n,t.forceFlushTimeoutMillis,(0,o.reconfigureLimits)(t.logRecordLimits),e?.processors??[]),this._shutdownOnce=new i.BindOnceFuture(this._shutdown,this)}getLogger(r,i,o){if(this._shutdownOnce.isCalled)return t.diag.warn(`A shutdown LoggerProvider cannot provide a Logger`),n.NOOP_LOGGER;r||t.diag.warn(`Logger requested without instrumentation scope name.`);let s=r||e.DEFAULT_LOGGER_NAME,c=`${s}@${i||``}:${o?.schemaUrl||``}`;return this._sharedState.loggers.has(c)||this._sharedState.loggers.set(c,new a.Logger({name:s,version:i,schemaUrl:o?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(c)}forceFlush(){return this._shutdownOnce.isCalled?(t.diag.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(t.diag.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),hR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConsoleLogRecordExporter=void 0;let t=HL();e.ConsoleLogRecordExporter=class{export(e,t){this._sendLogRecords(e,t)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:(0,t.hrTimeToMicroseconds)(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes}}_sendLogRecords(e,n){for(let t of e)console.dir(this._exportInfo(t),{depth:3});n?.({code:t.ExportResultCode.SUCCESS})}}})),see=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SimpleLogRecordProcessor=void 0;let t=HL();e.SimpleLogRecordProcessor=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new t.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let n=()=>t.internal._export(this._exporter,[e]).then(e=>{e.code!==t.ExportResultCode.SUCCESS&&(0,t.globalErrorHandler)(e.error??Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(t.globalErrorHandler);if(e.resource.asyncAttributesPending){let r=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(r),n()),t.globalErrorHandler);r!=null&&this._unresolvedExports.add(r)}else n()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),gR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InMemoryLogRecordExporter=void 0;let t=HL();e.InMemoryLogRecordExporter=class{_finishedLogRecords=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:t.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedLogRecords.push(...e),n({code:t.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}}})),cee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessorBase=void 0;let t=(Jd(),d(Kd)),n=HL();e.BatchLogRecordProcessorBase=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,n.getNumberFromEnv)(`OTEL_BLRP_MAX_EXPORT_BATCH_SIZE`)??512,this._maxQueueSize=r?.maxQueueSize??(0,n.getNumberFromEnv)(`OTEL_BLRP_MAX_QUEUE_SIZE`)??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,n.getNumberFromEnv)(`OTEL_BLRP_SCHEDULE_DELAY`)??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,n.getNumberFromEnv)(`OTEL_BLRP_EXPORT_TIMEOUT`)??3e4,this._shutdownOnce=new n.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(t.diag.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<r;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((e,t)=>{(0,n.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(t)})}_maybeStartTimer(){this._timer===void 0&&(this._timer=setTimeout(()=>{this._flushOneBatch().then(()=>{this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{(0,n.globalErrorHandler)(e)})},this._scheduledDelayMillis),(0,n.unrefTimer)(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let t=()=>n.internal._export(this._exporter,e).then(e=>{e.code!==n.ExportResultCode.SUCCESS&&(0,n.globalErrorHandler)(e.error??Error(`BatchLogRecordProcessor: log record export failed (status ${e})`))}).catch(n.globalErrorHandler),r=e.map(e=>e.resource).filter(e=>e.asyncAttributesPending);return r.length===0?t():Promise.all(r.map(e=>e.waitForAsyncAttributes?.())).then(t,n.globalErrorHandler)}}})),lee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessor=void 0;let t=cee();e.BatchLogRecordProcessor=class extends t.BatchLogRecordProcessorBase{onShutdown(){}}})),_R=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessor=void 0;var t=lee();Object.defineProperty(e,`BatchLogRecordProcessor`,{enumerable:!0,get:function(){return t.BatchLogRecordProcessor}})})),vR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessor=void 0;var t=_R();Object.defineProperty(e,`BatchLogRecordProcessor`,{enumerable:!0,get:function(){return t.BatchLogRecordProcessor}})})),yR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessor=e.InMemoryLogRecordExporter=e.SimpleLogRecordProcessor=e.ConsoleLogRecordExporter=e.NoopLogRecordProcessor=e.LoggerProvider=void 0;var t=mR();Object.defineProperty(e,`LoggerProvider`,{enumerable:!0,get:function(){return t.LoggerProvider}});var n=dR();Object.defineProperty(e,`NoopLogRecordProcessor`,{enumerable:!0,get:function(){return n.NoopLogRecordProcessor}});var r=hR();Object.defineProperty(e,`ConsoleLogRecordExporter`,{enumerable:!0,get:function(){return r.ConsoleLogRecordExporter}});var i=see();Object.defineProperty(e,`SimpleLogRecordProcessor`,{enumerable:!0,get:function(){return i.SimpleLogRecordProcessor}});var a=gR();Object.defineProperty(e,`InMemoryLogRecordExporter`,{enumerable:!0,get:function(){return a.InMemoryLogRecordExporter}});var o=vR();Object.defineProperty(e,`BatchLogRecordProcessor`,{enumerable:!0,get:function(){return o.BatchLogRecordProcessor}})})),bR=s((e=>{let t=ur(),n=t.__toESM(Ei()),r=t.__toESM(require(`node:async_hooks`)),i=t.__toESM(ie()),a=t.__toESM(Li()),o=t.__toESM(Fc()),s=t.__toESM(require(`node:process`)),c=t.__toESM(require(`node:os`)),l=t.__toESM(require(`node:tty`)),u=t.__toESM(require(`node:crypto`)),f=t.__toESM(uL()),p=t.__toESM(bj()),m=t.__toESM(yR()),h=t.__toESM((PA(),d(NA))),g={DELETE:`delete`,COMMENT_OUT:`comment out`,KEEP:`keep`,SKIP:`skip`},_={GREEN:`Green`,GREY:`Grey`,RED:`Red`,NA:`NA`},v={GREEN:`Green`,GREY:`Grey`,RUNTIME_ERROR:`RuntimeError`},y=function(e){return e.IDE=`IDE`,e.CLI=`CLI`,e}({}),b=function(e){return e.SIBLING_FOLDER=`siblingFolder`,e.ROOT_FOLDER=`rootFolder`,e}({}),x=function(e){return e.JEST=`jest`,e.MOCHA=`mocha`,e.VITEST=`vitest`,e.PYTEST=`pytest`,e}({}),S=function(e){return e.SPEC=`spec`,e.TEST=`test`,e}({}),C=function(e){return e.CAMEL_CASE=`camelCase`,e.KEBAB_CASE=`kebabCase`,e}({}),w=function(e){return e.NONE=`none`,e.CATEGORIES=`categories`,e}({}),T=function(e){return e.NEW_CODE_FILE=`newCodeFile`,e.OVERRIDE_CODE_FILE=`overrideCodeFile`,e}({}),E=function(e){return e.ON=`on`,e.OFF=`off`,e}({}),D={DEFAULT:0,MIN:0,MAX:100},O={DEFAULT:5,MIN:1,MAX:50};n.z.object({rootPath:n.z.string().default(process.cwd()),testStructure:n.z.enum(b).optional(),testFramework:n.z.enum(x).optional(),testSuffix:n.z.enum(S).optional(),testFileName:n.z.enum(C).optional(),calculateCoverage:n.z.enum(E).optional(),coverageThreshold:n.z.number().min(D.MIN).max(D.MAX).default(D.DEFAULT),requestSource:n.z.enum(y).optional(),concurrency:n.z.number().min(O.MIN).max(O.MAX).default(O.DEFAULT),backendURL:n.z.string().optional(),secretToken:n.z.string().optional(),modelName:n.z.string().optional(),context:n.z.object({git:n.z.object({ref_name:n.z.string(),anchorBranch:n.z.string(),compareBranch:n.z.string(),repository:n.z.string(),owner:n.z.string(),sha:n.z.string(),workflowRunId:n.z.string(),remoteUrl:n.z.string(),topLevel:n.z.string()}).partial().optional()}).optional(),testCommand:n.z.string().optional(),coverageCommand:n.z.string().optional(),lintCommand:n.z.string().optional(),prettierCommand:n.z.string().optional(),disableLintRules:n.z.boolean().optional(),ignoreAsAnyLintErrors:n.z.boolean().optional(),includeEarlyTests:n.z.boolean().optional(),greyTestBehaviour:n.z.enum(g).optional(),redTestBehaviour:n.z.enum(g).optional(),keepErrorTests:n.z.boolean().optional(),keepFailedTests:n.z.boolean().optional(),conditionalKeep:n.z.boolean().optional(),continueOnTestErrors:n.z.boolean().optional(),perFunctionTimeout:n.z.number().positive().optional(),dynamicPromptIterations:n.z.number().min(0).max(10).optional(),removeComments:n.z.boolean().optional(),experimentalAgentSdk:n.z.boolean().optional(),compressOutput:n.z.boolean().optional(),agentSdkModel:n.z.string().optional(),agentSdkBudget:n.z.number().positive().optional(),pluginPath:n.z.string().optional(),claudeCodeExecutablePath:n.z.string().optional(),catalogId:n.z.string().optional(),label:n.z.string().optional(),debug:n.z.boolean().optional(),verbose:n.z.boolean().optional(),progressLogger:n.z.custom().optional(),onTokenRefresh:n.z.custom().optional()});var k=`@earlyai/ts-agent`,A=`0.97.0`;let ee={VSCODE:`vscode`,GITHUB_ACTION:`github-action`,UNKNOWN:`unknown`},j=`$early_filename`,te=`npx jest ${j} --no-coverage --silent --json --forceExit --maxWorkers=1`,M=`npx --no eslint ${j}`,N=`npx --no prettier ${j} --write`,P={rootPath:process.cwd(),isSiblingFolderStructured:!0,gitURL:`https://github.com/your-owner/your-repo`,testFramework:x.JEST,greyTestBehaviour:g.DELETE,redTestBehaviour:g.DELETE,keepErrorTests:!1,keepFailedTests:!1,conditionalKeep:!1,continueOnTestErrors:!0,generatedTestStructure:w.CATEGORIES,isRootFolderStructured:!1,clientSource:ee.GITHUB_ACTION,backendURL:`https://api.startearly.ai`,requestSource:y.CLI,userPrompt:``,testLocation:`__tests__`,coverageThreshold:D.DEFAULT,concurrency:5,testFileFormat:`ts`,outputType:T.NEW_CODE_FILE,shouldRefreshCoverage:!0,kebabCaseFileName:!1,earlyTestFilenameSuffix:`.early.${S.TEST}`,testSuffix:S.TEST,isAppendPrompt:!1,dynamicPromptIterations:3,wsServerEndpoint:`wss://api.startearly.ai`,secretToken:``,loggerConfig:{consoleEnabled:!1,azureEnabled:!0,azureConnectionString:`InstrumentationKey=8b9b0d6a-5400-44a3-ada6-3cd026de6cfe;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/;ApplicationId=d6e130b6-4aaa-4dcc-8d26-c1fa25d4656a`},context:void 0,includeEarlyTests:!1,lintCommand:M,prettierCommand:N,disableLintRules:!1,ignoreAsAnyLintErrors:!0,allowUndefinedLintErrors:!0,perFunctionTimeout:42e4,removeComments:!0,experimentalAgentSdk:!1,compressOutput:!1,agentSdkModel:void 0,agentSdkBudget:void 0,debug:!1,verbose:!1},F=e=>{let t=`testFramework.testSuffix.backendURL.requestSource.secretToken.concurrency.coverageThreshold.context.rootPath.testCommand.coverageCommand.lintCommand.prettierCommand.disableLintRules.greyTestBehaviour.redTestBehaviour.keepErrorTests.keepFailedTests.conditionalKeep.continueOnTestErrors.perFunctionTimeout.dynamicPromptIterations.removeComments.experimentalAgentSdk.compressOutput.agentSdkModel.agentSdkBudget.pluginPath.claudeCodeExecutablePath.label.catalogId.debug.verbose.progressLogger.onTokenRefresh`.split(`.`).reduce((t,n)=>(0,i.isDefined)(e[n])?{...t,[n]:e[n]}:t,{}),n={...(0,i.isDefined)(e.testStructure)&&{isSiblingFolderStructured:e.testStructure===b.SIBLING_FOLDER,isRootFolderStructured:e.testStructure===b.ROOT_FOLDER},...(0,i.isDefined)(e.testFileName)&&{kebabCaseFileName:e.testFileName===C.KEBAB_CASE},...(0,i.isDefined)(e.calculateCoverage)&&{shouldRefreshCoverage:e.calculateCoverage===E.ON},...(0,i.isDefined)(e.modelName)&&{fixTestsLLMModelName:e.modelName,generateTestsLLMModelName:e.modelName},...(0,i.isDefined)(e.testSuffix)&&{earlyTestFilenameSuffix:`.early.${e.testSuffix}`},...(0,i.isDefined)(e.requestSource)&&{clientSource:e.requestSource===y.IDE?ee.VSCODE:ee.GITHUB_ACTION}};return{...t,...n}},I=(e=0)=>t=>`\u001B[${t+e}m`,L=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,ne=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,R={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(R.modifier);let z=Object.keys(R.color),re=Object.keys(R.bgColor);[...z,...re];function B(){let e=new Map;for(let[t,n]of Object.entries(R)){for(let[t,r]of Object.entries(n))R[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=R[t],e.set(r[0],r[1]);Object.defineProperty(R,t,{value:n,enumerable:!1})}return Object.defineProperty(R,`codes`,{value:e,enumerable:!1}),R.color.close=`\x1B[39m`,R.bgColor.close=`\x1B[49m`,R.color.ansi=I(),R.color.ansi256=L(),R.color.ansi16m=ne(),R.bgColor.ansi=I(10),R.bgColor.ansi256=L(10),R.bgColor.ansi16m=ne(10),Object.defineProperties(R,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>R.rgbToAnsi256(...R.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>R.ansi256ToAnsi(R.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>R.ansi256ToAnsi(R.hexToAnsi256(e)),enumerable:!1}}),R}var V=B();function ae(e,t=globalThis.Deno?globalThis.Deno.args:s.default.argv){let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}let{env:oe}=s.default,se;ae(`no-color`)||ae(`no-colors`)||ae(`color=false`)||ae(`color=never`)?se=0:(ae(`color`)||ae(`colors`)||ae(`color=true`)||ae(`color=always`))&&(se=1);function ce(){if(`FORCE_COLOR`in oe)return oe.FORCE_COLOR===`true`?1:oe.FORCE_COLOR===`false`?0:oe.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(oe.FORCE_COLOR,10),3)}function le(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ue(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=ce();r!==void 0&&(se=r);let i=n?se:r;if(i===0)return 0;if(n){if(ae(`color=16m`)||ae(`color=full`)||ae(`color=truecolor`))return 3;if(ae(`color=256`))return 2}if(`TF_BUILD`in oe&&`AGENT_NAME`in oe)return 1;if(e&&!t&&i===void 0)return 0;let a=i||0;if(oe.TERM===`dumb`)return a;if(s.default.platform===`win32`){let e=c.default.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in oe)return[`GITHUB_ACTIONS`,`GITEA_ACTIONS`,`CIRCLECI`].some(e=>e in oe)?3:[`TRAVIS`,`APPVEYOR`,`GITLAB_CI`,`BUILDKITE`,`DRONE`].some(e=>e in oe)||oe.CI_NAME===`codeship`?1:a;if(`TEAMCITY_VERSION`in oe)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(oe.TEAMCITY_VERSION)?1:0;if(oe.COLORTERM===`truecolor`||oe.TERM===`xterm-kitty`||oe.TERM===`xterm-ghostty`||oe.TERM===`wezterm`)return 3;if(`TERM_PROGRAM`in oe){let e=Number.parseInt((oe.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(oe.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(oe.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(oe.TERM)||`COLORTERM`in oe?1:a}function de(e,t={}){return le(ue(e,{streamIsTTY:e&&e.isTTY,...t}))}var fe={stdout:de({isTTY:l.default.isatty(1)}),stderr:de({isTTY:l.default.isatty(2)})};function pe(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let i=t.length,a=0,o=``;do o+=e.slice(a,r)+t+n,a=r+i,r=e.indexOf(t,a);while(r!==-1);return o+=e.slice(a),o}function me(e,t,n,r){let i=0,a=``;do{let o=e[r-1]===`\r`;a+=e.slice(i,o?r-1:r)+t+(o?`\r
|
|
118
|
+
`,(0,r.getConflictResolutionRecipe)(i,e))}return a}}})),AI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MultiMetricStorage=void 0,e.MultiMetricStorage=class{_backingStorages;constructor(e){this._backingStorages=e}record(e,t,n,r){this._backingStorages.forEach(i=>{i.record(e,t,n,r)})}}})),jI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchObservableResultImpl=e.ObservableResultImpl=void 0;let t=(Jd(),d(Kd)),n=wI(),r=xI();e.ObservableResultImpl=class{_instrumentName;_valueType;_buffer=new n.AttributeHashMap;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,n={}){if(typeof e!=`number`){t.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===t.ValueType.INT&&!Number.isInteger(e)&&(t.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(n,e)}},e.BatchObservableResultImpl=class{_buffer=new Map;observe(e,i,a={}){if(!(0,r.isObservableInstrument)(e))return;let o=this._buffer.get(e);if(o??(o=new n.AttributeHashMap,this._buffer.set(e,o)),typeof i!=`number`){t.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${i}`);return}e._descriptor.valueType===t.ValueType.INT&&!Number.isInteger(i)&&(t.diag.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),i=Math.trunc(i),!Number.isInteger(i))||o.set(a,i)}}})),MI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ObservableRegistry=void 0;let t=(Jd(),d(Kd)),n=xI(),r=jI(),i=ZF();e.ObservableRegistry=class{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,r){let i=new Set(r.filter(n.isObservableInstrument));if(i.size===0){t.diag.error(`BatchObservableCallback is not associated with valid instruments`,r);return}this._findBatchCallback(e,i)>=0||this._batchCallbacks.push({callback:e,instruments:i})}removeBatchCallback(e,t){let r=new Set(t.filter(n.isObservableInstrument)),i=this._findBatchCallback(e,r);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let n=this._observeCallbacks(e,t),r=this._observeBatchCallbacks(e,t);return(await(0,i.PromiseAllSettled)([...n,...r])).filter(i.isPromiseAllSettledRejectionResult).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:a})=>{let o=new r.ObservableResultImpl(a._descriptor.name,a._descriptor.valueType),s=Promise.resolve(n(o));t!=null&&(s=(0,i.callWithTimeout)(s,t)),await s,a._metricStorages.forEach(t=>{t.record(o._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:a})=>{let o=new r.BatchObservableResultImpl,s=Promise.resolve(n(o));t!=null&&(s=(0,i.callWithTimeout)(s,t)),await s,a.forEach(t=>{let n=o._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&(0,i.setEquals)(n.instruments,t))}}})),NI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SyncMetricStorage=void 0;let t=CI(),n=TI(),r=EI();e.SyncMetricStorage=class extends t.MetricStorage{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(e,t,i,a,o){super(e),this._attributesProcessor=i,this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new n.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new r.TemporalMetricProcessor(t,a)}record(e,t,n,r){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}})),PI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDenyListAttributesProcessor=e.createAllowListAttributesProcessor=e.createMultiAttributesProcessor=e.createNoopAttributesProcessor=void 0;var t=class{process(e,t){return e}},n=class{_processors;constructor(e){this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}},r=class{_allowedAttributeNames;constructor(e){this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(e=>this._allowedAttributeNames.includes(e)).forEach(t=>n[t]=e[t]),n}},i=class{_deniedAttributeNames;constructor(e){this._deniedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(e=>!this._deniedAttributeNames.includes(e)).forEach(t=>n[t]=e[t]),n}};function a(){return l}e.createNoopAttributesProcessor=a;function o(e){return new n(e)}e.createMultiAttributesProcessor=o;function s(e){return new r(e)}e.createAllowListAttributesProcessor=s;function c(e){return new i(e)}e.createDenyListAttributesProcessor=c;let l=new t})),FI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSharedState=void 0;let t=bI(),n=SI(),r=ZF(),i=DI(),a=kI(),o=AI(),s=MI(),c=NI(),l=PI();e.MeterSharedState=class{_meterProviderSharedState;_instrumentationScope;metricStorageRegistry=new a.MetricStorageRegistry;observableRegistry=new s.ObservableRegistry;meter;constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.meter=new n.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,c.SyncMetricStorage);return t.length===1?t[0]:new o.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,i.AsyncMetricStorage)}async collect(e,t,n){let i=await this.observableRegistry.observe(t,n?.timeoutMillis),a=this.metricStorageRegistry.getStorages(e);if(a.length===0)return null;let o=a.map(n=>n.collect(e,t)).filter(r.isNotNullish);return o.length===0?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:o},errors:i}}_registerMetricStorage(e,n){let r=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(r=>{let i=(0,t.createInstrumentDescriptorWithView)(r,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(a!=null)return a;let o=new n(i,r.aggregation.createAggregator(i),r.attributesProcessor,this._meterProviderSharedState.metricCollectors,r.aggregationCardinalityLimit);return this.metricStorageRegistry.register(o),o});if(r.length===0){let t=this._meterProviderSharedState.selectAggregations(e.type).map(([t,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(t,e);if(i!=null)return i;let a=r.createAggregator(e),o=t.selectCardinalityLimit(e.type),s=new n(e,a,(0,l.createNoopAttributesProcessor)(),[t],o);return this.metricStorageRegistry.registerForCollector(t,s),s});r=r.concat(t)}return r}}})),II=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterProviderSharedState=void 0;let t=ZF(),n=yI(),r=FI(),i=pI();e.MeterProviderSharedState=class{resource;viewRegistry=new n.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;constructor(e){this.resource=e}getMeterSharedState(e){let n=(0,t.instrumentationScopeId)(e),i=this.meterSharedStates.get(n);return i??(i=new r.MeterSharedState(this,e),this.meterSharedStates.set(n,i)),i}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,(0,i.toAggregation)(n.selectAggregation(e))]);return t}}})),LI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MetricCollector=void 0;let t=tj();e.MetricCollector=class{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let n=(0,t.millisToHrTime)(Date.now()),r=[],i=[],a=Array.from(this._sharedState.meterSharedStates.values()).map(async t=>{let a=await t.collect(this,n,e);a?.scopeMetrics!=null&&r.push(a.scopeMetrics),a?.errors!=null&&i.push(...a.errors)});return await Promise.all(a),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:r},errors:i}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}}})),RI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExactPredicate=e.PatternPredicate=void 0;let t=/[\^$\\.+?()[\]{}|]/g;e.PatternPredicate=class e{_matchAll;_regexp;constructor(t){t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(t,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},e.ExactPredicate=class{_matchAll;_pattern;constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}}})),aee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InstrumentSelector=void 0;let t=RI();e.InstrumentSelector=class{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new t.PatternPredicate(e?.name??`*`),this._type=e?.type,this._unitFilter=new t.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}})),zI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterSelector=void 0;let t=RI();e.MeterSelector=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new t.ExactPredicate(e?.name),this._versionFilter=new t.ExactPredicate(e?.version),this._schemaUrlFilter=new t.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}})),BI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.View=void 0;let t=RI(),n=PI(),r=aee(),i=zI(),a=pI();function o(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function s(e){if(o(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||t.PatternPredicate.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}e.View=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){s(e),e.attributesProcessors==null?this.attributesProcessor=(0,n.createNoopAttributesProcessor)():this.attributesProcessor=(0,n.createMultiAttributesProcessor)(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=(0,a.toAggregation)(e.aggregation??{type:a.AggregationType.DEFAULT}),this.instrumentSelector=new r.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new i.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}}})),VI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MeterProvider=void 0;let t=(Jd(),d(Kd)),n=bj(),r=II(),i=LI(),a=BI();e.MeterProvider=class{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new r.MeterProviderSharedState(e?.resource??(0,n.defaultResource)()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new a.View(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let e=new i.MetricCollector(this._sharedState,t);t.setMetricProducer(e),this._sharedState.metricCollectors.push(e)}}getMeter(e,n=``,r={}){return this._shutdown?(t.diag.warn(`A shutdown MeterProvider cannot provide a Meter`),(0,t.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:n,schemaUrl:r.schemaUrl}).meter}async shutdown(e){if(this._shutdown){t.diag.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){t.diag.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}}})),HI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TimeoutError=e.createDenyListAttributesProcessor=e.createAllowListAttributesProcessor=e.AggregationType=e.MeterProvider=e.ConsoleMetricExporter=e.InMemoryMetricExporter=e.PeriodicExportingMetricReader=e.MetricReader=e.InstrumentType=e.DataPointType=e.AggregationTemporality=void 0;var t=YF();Object.defineProperty(e,`AggregationTemporality`,{enumerable:!0,get:function(){return t.AggregationTemporality}});var n=XF();Object.defineProperty(e,`DataPointType`,{enumerable:!0,get:function(){return n.DataPointType}}),Object.defineProperty(e,`InstrumentType`,{enumerable:!0,get:function(){return n.InstrumentType}});var r=hI();Object.defineProperty(e,`MetricReader`,{enumerable:!0,get:function(){return r.MetricReader}});var i=gI();Object.defineProperty(e,`PeriodicExportingMetricReader`,{enumerable:!0,get:function(){return i.PeriodicExportingMetricReader}});var a=_I();Object.defineProperty(e,`InMemoryMetricExporter`,{enumerable:!0,get:function(){return a.InMemoryMetricExporter}});var o=vI();Object.defineProperty(e,`ConsoleMetricExporter`,{enumerable:!0,get:function(){return o.ConsoleMetricExporter}});var s=VI();Object.defineProperty(e,`MeterProvider`,{enumerable:!0,get:function(){return s.MeterProvider}});var c=pI();Object.defineProperty(e,`AggregationType`,{enumerable:!0,get:function(){return c.AggregationType}});var l=PI();Object.defineProperty(e,`createAllowListAttributesProcessor`,{enumerable:!0,get:function(){return l.createAllowListAttributesProcessor}}),Object.defineProperty(e,`createDenyListAttributesProcessor`,{enumerable:!0,get:function(){return l.createDenyListAttributesProcessor}});var u=ZF();Object.defineProperty(e,`TimeoutError`,{enumerable:!0,get:function(){return u.TimeoutError}})})),UI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.StatsbeatFeatureType=e.EU_ENDPOINTS=e.EU_CONNECTION_STRING=e.NON_EU_CONNECTION_STRING=e.AIMS_FORMAT=e.AIMS_API_VERSION=e.AIMS_URI=e.StatsbeatCounter=e.AttachTypeName=e.StatsbeatResourceProvider=e.MAX_STATSBEAT_FAILURES=e.AZURE_MONITOR_AUTO_ATTACH=e.STATSBEAT_LANGUAGE=e.NetworkStatsbeat=void 0,e.isStatsbeatShutdownStatus=i,e.NetworkStatsbeat=class{constructor(e,t){this.endpoint=e,this.host=t,this.totalRequestCount=0,this.totalSuccessfulRequestCount=0,this.totalReadFailureCount=0,this.totalWriteFailureCount=0,this.totalFailedRequestCount=[],this.retryCount=[],this.exceptionCount=[],this.throttleCount=[],this.intervalRequestExecutionTime=0,this.lastIntervalRequestExecutionTime=0,this.lastTime=+new Date,this.lastRequestCount=0,this.averageRequestExecutionTime=0}},e.STATSBEAT_LANGUAGE=`node`,e.AZURE_MONITOR_AUTO_ATTACH=`AZURE_MONITOR_AUTO_ATTACH`,e.MAX_STATSBEAT_FAILURES=3,e.StatsbeatResourceProvider={appsvc:`appsvc`,aks:`aks`,functions:`functions`,vm:`vm`,unknown:`unknown`};var t;(function(e){e.INTEGRATED_AUTO=`IntegratedAuto`,e.MANUAL=`Manual`})(t||(e.AttachTypeName=t={}));var n;(function(e){e.SUCCESS_COUNT=`Request_Success_Count`,e.FAILURE_COUNT=`Request_Failure_Count`,e.RETRY_COUNT=`Retry_Count`,e.THROTTLE_COUNT=`Throttle_Count`,e.EXCEPTION_COUNT=`Exception_Count`,e.AVERAGE_DURATION=`Request_Duration`,e.READ_FAILURE_COUNT=`Read_Failure_Count`,e.WRITE_FAILURE_COUNT=`Write_Failure_Count`,e.ATTACH=`Attach`,e.FEATURE=`Feature`})(n||(e.StatsbeatCounter=n={})),e.AIMS_URI=`http://169.254.169.254/metadata/instance/compute`,e.AIMS_API_VERSION=`api-version=2017-12-01`,e.AIMS_FORMAT=`format=json`,e.NON_EU_CONNECTION_STRING=`InstrumentationKey=c4a29126-a7cb-47e5-b348-11414998b11e;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com`,e.EU_CONNECTION_STRING=`InstrumentationKey=7dc56bab-3c0c-4e9f-9ebb-d1acadee8d0f;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com`,e.EU_ENDPOINTS=[`westeurope`,`northeurope`,`francecentral`,`francesouth`,`germanywestcentral`,`norwayeast`,`norwaywest`,`swedencentral`,`switzerlandnorth`,`switzerlandwest`,`uksouth`,`ukwest`];var r;(function(e){e[e.FEATURE=0]=`FEATURE`,e[e.INSTRUMENTATION=1]=`INSTRUMENTATION`})(r||(e.StatsbeatFeatureType=r={}));function i(e){return e===401||e===403||e===503}})),WI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.StatsbeatMetrics=void 0;let t=(kM(),d(Gj)),n=DF(),r=(Jd(),d(Kd)),i=UI(),a=t.__importStar(require(`node:os`));e.StatsbeatMetrics=class{constructor(){this.resourceProvider=i.StatsbeatResourceProvider.unknown,this.vmInfo={},this.os=a.type(),this.resourceIdentifier=``}async getResourceProvider(){this.resourceProvider=i.StatsbeatResourceProvider.unknown,process.env.AKS_ARM_NAMESPACE_ID?(this.resourceProvider=i.StatsbeatResourceProvider.aks,this.resourceIdentifier=process.env.AKS_ARM_NAMESPACE_ID):process.env.WEBSITE_SITE_NAME?(this.resourceProvider=i.StatsbeatResourceProvider.appsvc,this.resourceIdentifier=process.env.WEBSITE_SITE_NAME,process.env.WEBSITE_HOME_STAMPNAME&&(this.resourceIdentifier+=`/`+process.env.WEBSITE_HOME_STAMPNAME)):process.env.FUNCTIONS_WORKER_RUNTIME?(this.resourceProvider=i.StatsbeatResourceProvider.functions,process.env.WEBSITE_HOSTNAME&&(this.resourceIdentifier=process.env.WEBSITE_HOSTNAME)):await this.getAzureComputeMetadata()?(this.resourceProvider=i.StatsbeatResourceProvider.vm,this.resourceIdentifier=this.vmInfo.id+`/`+this.vmInfo.subscriptionId,this.vmInfo.osType&&(this.os=this.vmInfo.osType)):this.resourceProvider=i.StatsbeatResourceProvider.unknown}async getAzureComputeMetadata(){let e=(0,n.createDefaultHttpClient)(),t={url:`${i.AIMS_URI}?${i.AIMS_API_VERSION}&${i.AIMS_FORMAT}`,timeout:5e3,method:`GET`,allowInsecureConnection:!0},a=(0,n.createPipelineRequest)(t);return await e.sendRequest(a).then(e=>{if(e.status===200){this.vmInfo.isVM=!0;let t=``;return e.on(`data`,e=>{t+=e}),e.on(`end`,()=>{try{let e=JSON.parse(t);this.vmInfo.id=e.vmId||``,this.vmInfo.subscriptionId=e.subscriptionId||``,this.vmInfo.osType=e.osType||``}catch(e){r.diag.debug(`Failed to parse JSON: `,e)}}),!0}else return!1}).catch(()=>!1),!1}getConnectionString(e){let t=e;for(let e=0;e<i.EU_ENDPOINTS.length;e++)if(t.includes(i.EU_ENDPOINTS[e]))return i.EU_CONNECTION_STRING;return i.NON_EU_CONNECTION_STRING}}})),GI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resourceMetricsToEnvelope=l,e.isAksAttach=u,e.shouldSendToOtlp=d,e.isStandardMetric=f,e.getAttachType=p;let t=HI(),n=nL(),r=dN(),i=AM(),a=UI(),o=tL(),s=new Map([[r.OTelPerformanceCounterNames.PRIVATE_BYTES,r.BreezePerformanceCounterNames.PRIVATE_BYTES],[r.OTelPerformanceCounterNames.AVAILABLE_BYTES,r.BreezePerformanceCounterNames.AVAILABLE_BYTES],[r.OTelPerformanceCounterNames.PROCESSOR_TIME,r.BreezePerformanceCounterNames.PROCESSOR_TIME],[r.OTelPerformanceCounterNames.PROCESS_TIME_STANDARD,r.BreezePerformanceCounterNames.PROCESS_TIME_STANDARD],[r.OTelPerformanceCounterNames.PROCESS_TIME_NORMALIZED,r.BreezePerformanceCounterNames.PROCESS_TIME_NORMALIZED],[r.OTelPerformanceCounterNames.REQUEST_RATE,r.BreezePerformanceCounterNames.REQUEST_RATE],[r.OTelPerformanceCounterNames.REQUEST_DURATION,r.BreezePerformanceCounterNames.REQUEST_DURATION],[r.OTelPerformanceCounterNames.EXCEPTION_RATE,r.BreezePerformanceCounterNames.EXCEPTION_RATE]]);function c(e){let t={};if(e)for(let n of Object.keys(e))t[n]=e[n];return t}function l(e,r,a){let l=[],p=new Date,m=r,h,g;if(a){g=`Microsoft.ApplicationInsights.Statsbeat`;let e=(0,o.getInstance)();h=Object.assign({},e.tags)}else g=`Microsoft.ApplicationInsights.Metric`,h=(0,n.createTagsFromResource)(e.resource);return e.scopeMetrics.forEach(e=>{e.metrics.forEach(e=>{e.dataPoints.forEach(n=>{let r={metrics:[],version:2,properties:{}};if(r.properties=c(n.attributes),d()&&u()&&!f(n)&&process.env[i.ENV_APPLICATIONINSIGHTS_METRICS_TO_LOGANALYTICS_ENABLED]===`false`&&!a)return;d()&&u()&&!a?r.properties[`_MS.SentToAMW`]=`True`:u()&&!a&&(r.properties[`_MS.SentToAMW`]=`False`);let o;s.has(e.descriptor.name)&&(o=s.get(e.descriptor.name));let _={name:o||e.descriptor.name,value:0,dataPointType:`Aggregation`};e.dataPointType===t.DataPointType.SUM||e.dataPointType===t.DataPointType.GAUGE?(_.value=n.value,_.count=1):(_.value=n.value.sum||0,_.count=n.value.count,_.max=n.value.max,_.min=n.value.min),r.metrics.push(_);let v={name:g,time:p,sampleRate:100,instrumentationKey:m,tags:h,version:1,data:{baseType:`MetricData`,baseData:Object.assign({},r)}};l.push(v)})})}),l}function u(){return!!(process.env[i.ENV_AZURE_MONITOR_AUTO_ATTACH]===`true`&&process.env.AKS_ARM_NAMESPACE_ID)}function d(){return!!(process.env[i.ENV_OTLP_METRICS_ENDPOINT]&&process.env[i.ENV_OTEL_METRICS_EXPORTER]?.includes(`otlp`))}function f(e){return e.attributes?.[`_MS.IsAutocollected`]===`True`}function p(){return process.env[a.AZURE_MONITOR_AUTO_ATTACH]===`true`?a.AttachTypeName.INTEGRATED_AUTO:a.AttachTypeName.MANUAL}})),KI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AzureMonitorStatsbeatExporter=void 0;let t=(Jd(),d(Kd)),n=uN(),r=GI(),i=MM(),a=tL();e.AzureMonitorStatsbeatExporter=class extends i.AzureMonitorBaseExporter{constructor(e){super(e,!0),this._isShutdown=!1,this._sender=new a.HttpSender({endpointUrl:this.endpointUrl,instrumentationKey:this.instrumentationKey,trackStatsbeat:this.trackStatsbeat,exporterOptions:e,isStatsbeatSender:!0})}async export(e,i){if(this._isShutdown){setTimeout(()=>i({code:n.ExportResultCode.FAILED}),0);return}let a=(0,r.resourceMetricsToEnvelope)(e,this.instrumentationKey,!0);t.context.with((0,n.suppressTracing)(t.context.active()),async()=>{i(await this._sender.exportEnvelopes(a))})}async shutdown(){return this._isShutdown=!0,this._sender.shutdown()}async forceFlush(){return Promise.resolve()}}})),qI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NetworkStatsbeatMetrics=void 0;let t=(kM(),d(Gj)),n=(Jd(),d(Kd)),r=HI(),i=t.__importStar(Uj()),a=WI(),o=UI(),s=KI(),c=AM(),l=GI();var u=class e extends a.StatsbeatMetrics{constructor(e){super(),this.disableNonEssentialStatsbeat=!!process.env[c.ENV_DISABLE_STATSBEAT],this.isInitialized=!1,this.statsCollectionShortInterval=9e5,this.networkStatsbeatCollection=[],this.attach=(0,l.getAttachType)(),this.connectionString=super.getConnectionString(e.endpointUrl);let t={connectionString:this.connectionString};this.networkAzureExporter=new s.AzureMonitorStatsbeatExporter(t);let n={exporter:this.networkAzureExporter,exportIntervalMillis:e.networkCollectionInterval||this.statsCollectionShortInterval};this.networkStatsbeatMeterProvider=new r.MeterProvider({readers:[new r.PeriodicExportingMetricReader(n)]}),this.networkStatsbeatMeter=this.networkStatsbeatMeterProvider.getMeter(`Azure Monitor Network Statsbeat`),this.endpointUrl=e.endpointUrl,this.runtimeVersion=process.version,this.language=o.STATSBEAT_LANGUAGE,this.version=i.packageVersion,this.host=this.getShortHost(e.endpointUrl),this.cikey=e.instrumentationKey,this.successCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.SUCCESS_COUNT),this.failureCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.FAILURE_COUNT),this.retryCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.RETRY_COUNT),this.throttleCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.THROTTLE_COUNT),this.exceptionCountGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.EXCEPTION_COUNT),this.averageDurationGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.AVERAGE_DURATION),this.disableNonEssentialStatsbeat||(this.readFailureGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.READ_FAILURE_COUNT),this.writeFailureGauge=this.networkStatsbeatMeter.createObservableGauge(o.StatsbeatCounter.WRITE_FAILURE_COUNT)),this.isInitialized=!0,this.initialize(),this.commonProperties={os:this.os,rp:this.resourceProvider,cikey:this.cikey,runtimeVersion:this.runtimeVersion,language:this.language,version:this.version,attach:this.attach},this.networkProperties={endpoint:this.endpointUrl,host:this.host}}shutdown(){return this.networkStatsbeatMeterProvider.shutdown()}async initialize(){var e,t;try{await super.getResourceProvider(),this.successCountGauge.addCallback(this.successCallback.bind(this)),this.networkStatsbeatMeter.addBatchObservableCallback(this.failureCallback.bind(this),[this.failureCountGauge]),this.networkStatsbeatMeter.addBatchObservableCallback(this.retryCallback.bind(this),[this.retryCountGauge]),this.networkStatsbeatMeter.addBatchObservableCallback(this.throttleCallback.bind(this),[this.throttleCountGauge]),this.networkStatsbeatMeter.addBatchObservableCallback(this.exceptionCallback.bind(this),[this.exceptionCountGauge]),this.disableNonEssentialStatsbeat||((e=this.readFailureGauge)==null||e.addCallback(this.readFailureCallback.bind(this)),(t=this.writeFailureGauge)==null||t.addCallback(this.writeFailureCallback.bind(this))),this.averageDurationGauge.addCallback(this.durationCallback.bind(this))}catch{n.diag.debug(`Call to get the resource provider failed.`)}}successCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);if(t.totalSuccessfulRequestCount>0){let n=Object.assign(Object.assign({},this.commonProperties),this.networkProperties);e.observe(t.totalSuccessfulRequestCount,n),t.totalSuccessfulRequestCount=0}}failureCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign(Object.assign({},this.networkProperties),this.commonProperties),{statusCode:0});for(let r=0;r<t.totalFailedRequestCount.length;r++)t.totalFailedRequestCount[r].count>0&&(n.statusCode=t.totalFailedRequestCount[r].statusCode,e.observe(this.failureCountGauge,t.totalFailedRequestCount[r].count,Object.assign({},n)),t.totalFailedRequestCount[r].count=0)}retryCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign(Object.assign({},this.networkProperties),this.commonProperties),{statusCode:0});for(let r=0;r<t.retryCount.length;r++)t.retryCount[r].count>0&&(n.statusCode=t.retryCount[r].statusCode,e.observe(this.retryCountGauge,t.retryCount[r].count,Object.assign({},n)),t.retryCount[r].count=0)}throttleCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign(Object.assign({},this.networkProperties),this.commonProperties),{statusCode:0});for(let r=0;r<t.throttleCount.length;r++)t.throttleCount[r].count>0&&(n.statusCode=t.throttleCount[r].statusCode,e.observe(this.throttleCountGauge,t.throttleCount[r].count,Object.assign({},n)),t.throttleCount[r].count=0)}exceptionCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign(Object.assign({},this.networkProperties),this.commonProperties),{exceptionType:``});for(let r=0;r<t.exceptionCount.length;r++)t.exceptionCount[r].count>0&&(n.exceptionType=t.exceptionCount[r].exceptionType,e.observe(this.exceptionCountGauge,t.exceptionCount[r].count,Object.assign({},n)),t.exceptionCount[r].count=0)}durationCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=Object.assign(Object.assign({},this.networkProperties),this.commonProperties);for(let e=0;e<this.networkStatsbeatCollection.length;e++){let t=this.networkStatsbeatCollection[e];t.time=Number(new Date);let n=t.totalRequestCount-t.lastRequestCount||0;n>0?t.averageRequestExecutionTime=(t.intervalRequestExecutionTime-t.lastIntervalRequestExecutionTime)/n||0:t.averageRequestExecutionTime=0,t.lastIntervalRequestExecutionTime=t.intervalRequestExecutionTime,t.lastRequestCount=t.totalRequestCount,t.lastTime=t.time}t.averageRequestExecutionTime>0&&(e.observe(t.averageRequestExecutionTime,n),t.averageRequestExecutionTime=0)}readFailureCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);if(t.totalReadFailureCount>0){let n=Object.assign(Object.assign({},this.commonProperties),this.networkProperties);e.observe(t.totalReadFailureCount,n),t.totalReadFailureCount=0}}writeFailureCallback(e){let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);if(t.totalWriteFailureCount>0){let n=Object.assign(Object.assign({},this.commonProperties),this.networkProperties);e.observe(t.totalWriteFailureCount,n),t.totalWriteFailureCount=0}}countSuccess(e){if(!this.isInitialized)return;let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);t.totalRequestCount++,t.totalSuccessfulRequestCount++,t.intervalRequestExecutionTime+=e}countFailure(e,t){if(!this.isInitialized)return;let n=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),r=n.totalFailedRequestCount.find(e=>t===e.statusCode);r?r.count++:n.totalFailedRequestCount.push({statusCode:t,count:1}),n.totalRequestCount++,n.intervalRequestExecutionTime+=e}countRetry(e){if(!this.isInitialized)return;let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=t.retryCount.find(t=>e===t.statusCode);n?n.count++:t.retryCount.push({statusCode:e,count:1})}countThrottle(e){if(!this.isInitialized)return;let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=t.throttleCount.find(t=>e===t.statusCode);n?n.count++:t.throttleCount.push({statusCode:e,count:1})}countReadFailure(){if(!this.isInitialized||this.disableNonEssentialStatsbeat)return;let e=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);e.totalReadFailureCount++}countWriteFailure(){if(!this.isInitialized||this.disableNonEssentialStatsbeat)return;let e=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host);e.totalWriteFailureCount++}countException(e){if(!this.isInitialized)return;let t=this.getNetworkStatsbeatCounter(this.endpointUrl,this.host),n=t.exceptionCount.find(t=>e.name===t.exceptionType);n?n.count++:t.exceptionCount.push({exceptionType:e.name,count:1})}getNetworkStatsbeatCounter(e,t){for(let n=0;n<this.networkStatsbeatCollection.length;n++)if(e===this.networkStatsbeatCollection[n].endpoint&&t===this.networkStatsbeatCollection[n].host)return this.networkStatsbeatCollection[n];let n=new o.NetworkStatsbeat(e,t);return this.networkStatsbeatCollection.push(n),n}getShortHost(e){let t=e;try{let n=new RegExp(/^https?:\/\/(?:www\.)?([^/.-]+)/).exec(e);n!==null&&n.length>1&&(t=n[1]),t=t.replace(`.in.applicationinsights.azure.com`,``)}catch{n.diag.debug(`Failed to get the short host name.`)}return t}static getInstance(t){return e.instance||=new e(t),e.instance}};e.NetworkStatsbeatMetrics=u,u.instance=null})),JI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LongIntervalStatsbeatMetrics=void 0;let t=(kM(),d(Gj)),n=(Jd(),d(Kd)),r=uN(),i=HI(),a=t.__importStar(Uj()),o=WI(),s=UI(),c=KI(),l=GI();var u=class e extends o.StatsbeatMetrics{constructor(e){super(),this.statsCollectionLongInterval=864e5,this.attach=(0,l.getAttachType)(),this.feature=0,this.instrumentation=0,this.isInitialized=!1,this.connectionString=super.getConnectionString(e.endpointUrl);let t={connectionString:this.connectionString,disableOfflineStorage:e.disableOfflineStorage};this.setFeatures(),this.longIntervalAzureExporter=new c.AzureMonitorStatsbeatExporter(t);let n={exporter:this.longIntervalAzureExporter,exportIntervalMillis:Number(process.env.LONG_INTERVAL_EXPORT_MILLIS)||this.statsCollectionLongInterval};this.longIntervalMetricReader=new i.PeriodicExportingMetricReader(n),this.longIntervalStatsbeatMeterProvider=new i.MeterProvider({readers:[this.longIntervalMetricReader]}),this.longIntervalStatsbeatMeter=this.longIntervalStatsbeatMeterProvider.getMeter(`Azure Monitor Long Interval Statsbeat`),this.runtimeVersion=process.version,this.language=s.STATSBEAT_LANGUAGE,this.version=a.packageVersion,this.cikey=e.instrumentationKey,this.featureStatsbeatGauge=this.longIntervalStatsbeatMeter.createObservableGauge(s.StatsbeatCounter.FEATURE),this.attachStatsbeatGauge=this.longIntervalStatsbeatMeter.createObservableGauge(s.StatsbeatCounter.ATTACH),this.isInitialized=!0,this.initialize(),this.commonProperties={os:this.os,rp:this.resourceProvider,cikey:this.cikey,runtimeVersion:this.runtimeVersion,language:this.language,version:this.version,attach:this.attach},this.attachProperties={rpId:this.resourceIdentifier}}async initialize(){try{await this.getResourceProvider(),this.attachStatsbeatGauge.addCallback(this.attachCallback.bind(this)),this.longIntervalStatsbeatMeter.addBatchObservableCallback(this.getEnvironmentStatus.bind(this),[this.featureStatsbeatGauge]),setTimeout(async()=>{try{let e=await this.longIntervalMetricReader.collect();e?this.longIntervalAzureExporter.export(e.resourceMetrics,e=>{e.code!==r.ExportResultCode.SUCCESS&&n.diag.debug(`LongIntervalStatsbeat: metrics export failed (error ${e.error})`)}):n.diag.debug(`LongIntervalStatsbeat: No metrics collected`)}catch(e){n.diag.debug(`LongIntervalStatsbeat: Error collecting metrics: ${e}`)}},15e3)}catch{n.diag.debug(`Call to get the resource provider failed.`)}}getEnvironmentStatus(e){this.setFeatures();let t;this.instrumentation>0&&(t=Object.assign(Object.assign({},this.commonProperties),{feature:this.instrumentation,type:s.StatsbeatFeatureType.INSTRUMENTATION}),e.observe(this.featureStatsbeatGauge,1,Object.assign({},t))),this.feature>0&&(t=Object.assign(Object.assign({},this.commonProperties),{feature:this.feature,type:s.StatsbeatFeatureType.FEATURE}),e.observe(this.featureStatsbeatGauge,1,Object.assign({},t)))}setFeatures(){let e=process.env.AZURE_MONITOR_STATSBEAT_FEATURES;if(e)try{this.feature=JSON.parse(e).feature,this.instrumentation=JSON.parse(e).instrumentation}catch(e){n.diag.debug(`LongIntervalStatsbeat: Failed to parse features/instrumentations (error ${e})`)}}attachCallback(e){let t=Object.assign(Object.assign({},this.commonProperties),this.attachProperties);e.observe(1,t)}shutdown(){return this.longIntervalStatsbeatMeterProvider.shutdown()}static getInstance(t){return e.instance||=new e(t),e.instance}};e.LongIntervalStatsbeatMetrics=u,u.instance=null})),YI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isRetriable=t,e.msToTimeSpan=n;function t(e){return e===206||e===401||e===403||e===408||e===429||e===439||e===500||e===502||e===503||e===504}function n(e){(isNaN(e)||e<0)&&(e=0);let t=(e/1e3%60).toFixed(7).replace(/0{0,4}$/,``),n=``+Math.floor(e/(1e3*60))%60,r=``+Math.floor(e/(1e3*60*60))%24,i=Math.floor(e/(1e3*60*60*24));return t=t.indexOf(`.`)<2?`0`+t:t,n=n.length<2?`0`+n:n,r=r.length<2?`0`+r:r,(i>0?i+`.`:``)+r+`:`+n+`:`+t}})),XI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BaseSender=void 0;let t=(Jd(),d(Kd)),n=gN(),r=uN(),i=qI(),a=JI(),o=UI(),s=YI(),c=AM();e.BaseSender=class{constructor(e){this.statsbeatFailureCount=0,this.batchSendRetryIntervalMs=6e4,this.numConsecutiveRedirects=0,this.disableOfflineStorage=e.exporterOptions.disableOfflineStorage||!1,this.persister=new n.FileSystemPersist(e.instrumentationKey,e.exporterOptions),e.trackStatsbeat&&(this.networkStatsbeatMetrics=i.NetworkStatsbeatMetrics.getInstance({instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl,disableOfflineStorage:this.disableOfflineStorage}),this.longIntervalStatsbeatMetrics=a.LongIntervalStatsbeatMetrics.getInstance({instrumentationKey:e.instrumentationKey,endpointUrl:e.endpointUrl,disableOfflineStorage:this.disableOfflineStorage})),this.retryTimer=null,this.isStatsbeatSender=e.isStatsbeatSender||!1}async exportEnvelopes(e){var n,i,a,c,l,u,d,f,p,m;if(t.diag.info(`Exporting ${e.length} envelope(s)`),e.length<1)return{code:r.ExportResultCode.SUCCESS};try{let o=new Date().getTime(),{result:d,statusCode:f}=await this.send(e),p=new Date().getTime()-o;if(this.numConsecutiveRedirects=0,f===200)return this.retryTimer||(this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.sendFirstPersistedFile()},this.batchSendRetryIntervalMs),this.retryTimer.unref()),this.isStatsbeatSender||(n=this.networkStatsbeatMetrics)==null||n.countSuccess(p),{code:r.ExportResultCode.SUCCESS};if(f&&(0,s.isRetriable)(f)){if(f===429||f===439)return this.isStatsbeatSender||(i=this.networkStatsbeatMetrics)==null||i.countThrottle(f),{code:r.ExportResultCode.SUCCESS};if(d){t.diag.info(d);let n=JSON.parse(d),i=[];return n.itemsAccepted>0&&f===206&&!this.isStatsbeatSender&&((a=this.networkStatsbeatMetrics)==null||a.countSuccess(p)),n.errors&&n.errors.forEach(t=>{t.statusCode&&(0,s.isRetriable)(t.statusCode)&&i.push(e[t.index])}),i.length>0?(this.isStatsbeatSender||(c=this.networkStatsbeatMetrics)==null||c.countRetry(f),await this.persist(i)):(this.isStatsbeatSender||(l=this.networkStatsbeatMetrics)==null||l.countFailure(p,f),{code:r.ExportResultCode.FAILED})}else return this.isStatsbeatSender||(u=this.networkStatsbeatMetrics)==null||u.countRetry(f),await this.persist(e)}else return this.networkStatsbeatMetrics&&!this.isStatsbeatSender?f&&this.networkStatsbeatMetrics.countFailure(p,f):this.incrementStatsbeatFailure(),{code:r.ExportResultCode.FAILED}}catch(n){let i=n;if(i.statusCode&&(i.statusCode===307||i.statusCode===308))if(this.numConsecutiveRedirects++,this.numConsecutiveRedirects<10){if(i.response&&i.response.headers){let t=i.response.headers.get(`location`);if(t)return this.handlePermanentRedirect(t),this.exportEnvelopes(e)}}else{let e=Error(`Circular redirect`);return this.isStatsbeatSender||(d=this.networkStatsbeatMetrics)==null||d.countException(e),{code:r.ExportResultCode.FAILED,error:e}}else if(i.statusCode&&(0,s.isRetriable)(i.statusCode)&&!this.isStatsbeatSender)return(f=this.networkStatsbeatMetrics)==null||f.countRetry(i.statusCode),this.persist(e);else if(i.statusCode===400&&i.message.includes(`Invalid instrumentation key`))return this.shutdownStatsbeat(),{code:r.ExportResultCode.SUCCESS};else if(i.statusCode&&this.isStatsbeatSender&&(0,o.isStatsbeatShutdownStatus)(i.statusCode))return this.incrementStatsbeatFailure(),{code:r.ExportResultCode.SUCCESS};return this.isRetriableRestError(i)?(i.statusCode&&!this.isStatsbeatSender&&((p=this.networkStatsbeatMetrics)==null||p.countRetry(i.statusCode)),this.isStatsbeatSender||t.diag.error(`Retrying due to transient client side error. Error message:`,i.message),this.persist(e)):(this.isStatsbeatSender||(m=this.networkStatsbeatMetrics)==null||m.countException(i),this.isStatsbeatSender||t.diag.error(`Envelopes could not be exported and are not retriable. Error message:`,i.message),{code:r.ExportResultCode.FAILED,error:i})}}async persist(e){var t;try{return await this.persister.push(e)?{code:r.ExportResultCode.SUCCESS}:{code:r.ExportResultCode.FAILED,error:Error(`Failed to persist envelope in disk.`)}}catch(e){return this.isStatsbeatSender||(t=this.networkStatsbeatMetrics)==null||t.countWriteFailure(),{code:r.ExportResultCode.FAILED,error:e}}}incrementStatsbeatFailure(){this.statsbeatFailureCount++,this.statsbeatFailureCount>o.MAX_STATSBEAT_FAILURES&&this.shutdownStatsbeat()}shutdownStatsbeat(){var e;this.networkStatsbeatMetrics&&this.networkStatsbeatMetrics.shutdown(),(e=this.longIntervalStatsbeatMetrics)==null||e.shutdown(),this.statsbeatFailureCount=0}async sendFirstPersistedFile(){var e;try{let e=await this.persister.shift();e&&await this.send(e)}catch(n){this.isStatsbeatSender||(e=this.networkStatsbeatMetrics)==null||e.countReadFailure(),t.diag.warn(`Failed to fetch persisted file`,n)}}isRetriableRestError(e){let t=Object.values(c.RetriableRestErrorTypes);return!!(e&&e.code&&t.includes(e.code))}}})),ZI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HttpSender=void 0;let t=(kM(),d(Gj)).__importDefault(require(`node:url`)),n=(Jd(),d(Kd)),r=DF(),i=JF(),a=XI();e.HttpSender=class extends a.BaseSender{constructor(e){super(e),this.appInsightsClientOptions=Object.assign({host:e.endpointUrl},e.exporterOptions),this.appInsightsClientOptions.credential&&(e.aadAudience?this.appInsightsClientOptions.credentialScopes=[e.aadAudience]:this.appInsightsClientOptions.credentialScopes=[`https://monitor.azure.com//.default`]),this.appInsightsClient=new i.ApplicationInsightsClient(this.appInsightsClientOptions),this.appInsightsClient.pipeline.removePolicy({name:r.redirectPolicyName})}async send(e){let t={},n;function r(e,r){n=e,t.onResponse&&t.onResponse(e,r)}return await this.appInsightsClient.track(e,Object.assign(Object.assign({},t),{onResponse:r})),{statusCode:n?.status,result:n?.bodyAsText??``}}async shutdown(){n.diag.info(`HttpSender shutting down`)}handlePermanentRedirect(e){if(e){let n=new t.default.URL(e);n&&n.host&&(this.appInsightsClient.host=`https://`+n.host)}}}})),QI=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Context=void 0,e.getInstance=u;let t=(kM(),d(Gj)),n=t.__importStar(require(`node:os`)),r=uN(),i=(PA(),d(NA)),a=JF(),o=t.__importStar(Uj()),s=AM(),c=null;var l=class e{constructor(){this.tags={},this._loadDeviceContext(),this._loadInternalContext()}_loadDeviceContext(){this.tags[a.KnownContextTagKeys.AiDeviceOsVersion]=n&&`${n.type()} ${n.release()}`}_loadInternalContext(){let{node:t}=process.versions;[e.nodeVersion]=t.split(`.`),e.opentelemetryVersion=r.SDK_INFO[i.ATTR_TELEMETRY_SDK_VERSION],e.sdkVersion=o.packageVersion;let n=process.env[s.ENV_AZURE_MONITOR_PREFIX]?process.env[s.ENV_AZURE_MONITOR_PREFIX]:``,c=this._getVersion(),l=`${n}node${e.nodeVersion}:otel${e.opentelemetryVersion}:${c}`;this.tags[a.KnownContextTagKeys.AiInternalSdkVersion]=l}_getVersion(){return process.env[s.ENV_APPLICATIONINSIGHTS_SHIM_VERSION]?`sha${process.env[s.ENV_APPLICATIONINSIGHTS_SHIM_VERSION]}`:process.env[s.ENV_AZURE_MONITOR_DISTRO_VERSION]?`dst${process.env[s.ENV_AZURE_MONITOR_DISTRO_VERSION]}`:`ext${e.sdkVersion}`}};e.Context=l,l.sdkVersion=null,l.opentelemetryVersion=null,l.nodeVersion=``;function u(){return c||=new l,c}})),$I=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),(kM(),d(Gj)).__exportStar(QI(),e)})),eL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=(kM(),d(Gj));t.__exportStar(fN(),e),t.__exportStar(gN(),e),t.__exportStar(ZI(),e),t.__exportStar($I(),e)})),tL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),(kM(),d(Gj)).__exportStar(eL(),e)})),nL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hrTimeToDate=l,e.createTagsFromResource=u,e.isSqlDB=m,e.getUrl=h,e.getDependencyTarget=g,e.createResourceMetricEnvelope=_,e.serializeAttribute=v,e.shouldCreateResourceMetric=y,e.isSyntheticSource=b;let t=(kM(),d(Gj)).__importDefault(require(`node:os`)),n=(PA(),d(NA)),r=dN(),i=tL(),a=JF(),o=uN(),s=AM(),c=aL();function l(e){return new Date((0,o.hrTimeToNanoseconds)(e)/1e6)}function u(e){let t=(0,i.getInstance)(),r=Object.assign({},t.tags);return e&&e.attributes&&(r[a.KnownContextTagKeys.AiCloudRole]=f(e),r[a.KnownContextTagKeys.AiCloudRoleInstance]=p(e),e.attributes[n.SEMRESATTRS_DEVICE_ID]&&(r[a.KnownContextTagKeys.AiDeviceId]=String(e.attributes[n.SEMRESATTRS_DEVICE_ID])),e.attributes[n.SEMRESATTRS_DEVICE_MODEL_NAME]&&(r[a.KnownContextTagKeys.AiDeviceModel]=String(e.attributes[n.SEMRESATTRS_DEVICE_MODEL_NAME])),e.attributes[n.SEMRESATTRS_SERVICE_VERSION]&&(r[a.KnownContextTagKeys.AiApplicationVer]=String(e.attributes[n.SEMRESATTRS_SERVICE_VERSION]))),r}function f(e){let t=``,r=e.attributes[n.SEMRESATTRS_SERVICE_NAME],i=e.attributes[n.SEMRESATTRS_SERVICE_NAMESPACE];if(r)if(String(r).startsWith(`unknown_service`))t=i?`${i}.${r}`:String(r);else return i?`${i}.${r}`:String(r);let a=e.attributes[n.SEMRESATTRS_K8S_DEPLOYMENT_NAME];if(a)return String(a);let o=e.attributes[n.SEMRESATTRS_K8S_REPLICASET_NAME];if(o)return String(o);let s=e.attributes[n.SEMRESATTRS_K8S_STATEFULSET_NAME];if(s)return String(s);let c=e.attributes[n.SEMRESATTRS_K8S_JOB_NAME];if(c)return String(c);let l=e.attributes[n.SEMRESATTRS_K8S_CRONJOB_NAME];if(l)return String(l);let u=e.attributes[n.SEMRESATTRS_K8S_DAEMONSET_NAME];return u?String(u):t}function p(e){let r=e.attributes[n.SEMRESATTRS_K8S_POD_NAME];if(r)return String(r);let i=e.attributes[n.SEMRESATTRS_SERVICE_INSTANCE_ID];return i?String(i):t.default&&t.default.hostname()}function m(e){return e===n.DBSYSTEMVALUES_DB2||e===n.DBSYSTEMVALUES_DERBY||e===n.DBSYSTEMVALUES_MARIADB||e===n.DBSYSTEMVALUES_MSSQL||e===n.DBSYSTEMVALUES_ORACLE||e===n.DBSYSTEMVALUES_SQLITE||e===n.DBSYSTEMVALUES_OTHER_SQL||e===n.DBSYSTEMVALUES_HSQLDB||e===n.DBSYSTEMVALUES_H2}function h(e){if(!e)return``;if((0,c.getHttpMethod)(e)){let t=(0,c.getHttpUrl)(e);if(t)return String(t);{let t=(0,c.getHttpScheme)(e),n=(0,c.getHttpTarget)(e);if(t&&n){let r=(0,c.getHttpHost)(e);if(r)return`${t}://${r}${n}`;{let r=(0,c.getNetPeerPort)(e);if(r){let i=(0,c.getNetPeerName)(e);if(i)return`${t}://${i}:${r}${n}`;{let i=(0,c.getPeerIp)(e);if(i)return`${t}://${i}:${r}${n}`}}}}}}return``}function g(e){if(!e)return``;let t=e[n.SEMATTRS_PEER_SERVICE],r=(0,c.getHttpHost)(e),i=(0,c.getHttpUrl)(e),a=(0,c.getNetPeerName)(e),o=(0,c.getPeerIp)(e);return t?String(t):r?String(r):i?String(i):a?String(a):o?String(o):``}function _(e,t){if(e&&e.attributes){let r=u(e),i={};for(let t of Object.keys(e.attributes))t.startsWith(`_MS.`)||t===n.ATTR_TELEMETRY_SDK_VERSION||t===n.ATTR_TELEMETRY_SDK_LANGUAGE||t===n.ATTR_TELEMETRY_SDK_NAME||(i[t]=e.attributes[t]);if(Object.keys(i).length>0){let e={version:2,metrics:[{name:`_OTELRESOURCE_`,value:1}],properties:i};return{name:`Microsoft.ApplicationInsights.Metric`,time:new Date,sampleRate:100,instrumentationKey:t,version:1,data:{baseType:`MetricData`,baseData:e},tags:r}}}}function v(e){if(typeof e==`object`)if(e instanceof Error)try{return JSON.stringify(e,Object.getOwnPropertyNames(e))}catch{return String(e)}else if(e instanceof Uint8Array)return String(e);else try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function y(){return process.env[s.ENV_OPENTELEMETRY_RESOURCE_METRIC_DISABLED]?.toLowerCase()!==`true`}function b(e){return!!e[r.experimentalOpenTelemetryValues.SYNTHETIC_TYPE]}})),rL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MessageBusDestination=e.MicrosoftEventHub=e.AzNamespace=void 0,e.AzNamespace=`az.namespace`,e.MicrosoftEventHub=`Microsoft.EventHub`,e.MessageBusDestination=`message_bus.destination`})),iL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseEventHubSpan=void 0;let t=(Jd(),d(Kd)),n=uN(),r=(PA(),d(NA)),i=Uj(),a=rL(),o=e=>{let t=0,r=0,a=(0,n.hrTimeToMilliseconds)(e.startTime);return e.links.forEach(({attributes:e})=>{let n=e?.[i.ENQUEUED_TIME];n&&(t+=1,r+=a-(parseFloat(n.toString())||0))}),Math.max(r/(t||1),0)};e.parseEventHubSpan=(e,n)=>{let s=e.attributes[a.AzNamespace],c=(e.attributes[r.SEMATTRS_NET_PEER_NAME]||e.attributes[`peer.address`]||`unknown`).replace(/\/$/g,``),l=e.attributes[a.MessageBusDestination]||`unknown`;switch(e.kind){case t.SpanKind.CLIENT:n.type=s,n.target=`${c}/${l}`;break;case t.SpanKind.PRODUCER:n.type=`Queue Message | ${s}`,n.target=`${c}/${l}`;break;case t.SpanKind.CONSUMER:n.type=`Queue Message | ${s}`,n.source=`${c}/${l}`,n.measurements=Object.assign(Object.assign({},n.measurements),{[i.TIME_SINCE_ENQUEUED]:o(e)});break;default:}}})),aL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.readableSpanToEnvelope=_,e.spanEventsToEnvelopes=v,e.getPeerIp=y,e.getLocationIp=b,e.getHttpClientIp=x,e.getUserAgent=S,e.getHttpUrl=C,e.getHttpMethod=w,e.getHttpStatusCode=T,e.getHttpScheme=E,e.getHttpTarget=D,e.getHttpHost=O,e.getNetPeerName=k,e.getNetPeerPort=A;let t=uN(),n=(Jd(),d(Kd)),r=(PA(),d(NA)),i=nL(),a=dN(),o=iL(),s=Uj(),c=rL(),l=JF(),u=YI();function f(e){let t=(0,i.createTagsFromResource)(e.resource);t[l.KnownContextTagKeys.AiOperationId]=e.spanContext().traceId,e.parentSpanContext?.spanId&&(t[l.KnownContextTagKeys.AiOperationParentId]=e.parentSpanContext.spanId);let o=e.attributes[r.SEMATTRS_ENDUSER_ID];o&&(t[l.KnownContextTagKeys.AiUserId]=String(o));let s=S(e.attributes);if(s&&(t[`ai.user.userAgent`]=String(s)),(0,i.isSyntheticSource)(e.attributes)&&(t[l.KnownContextTagKeys.AiOperationSyntheticSource]=`True`),e.kind===n.SpanKind.SERVER){let n=w(e.attributes);if(b(t,e.attributes),n){let i=e.attributes[r.ATTR_HTTP_ROUTE],o=C(e.attributes);if(t[l.KnownContextTagKeys.AiOperationName]=e.name,i)t[l.KnownContextTagKeys.AiOperationName]=String(`${n} ${i}`).substring(0,a.MaxPropertyLengths.TEN_BIT);else if(o)try{let e=new URL(String(o));t[l.KnownContextTagKeys.AiOperationName]=String(`${n} ${e.pathname}`).substring(0,a.MaxPropertyLengths.TEN_BIT)}catch{}}else t[l.KnownContextTagKeys.AiOperationName]=e.name}else e.attributes[l.KnownContextTagKeys.AiOperationName]&&(t[l.KnownContextTagKeys.AiOperationName]=e.attributes[l.KnownContextTagKeys.AiOperationName]);return t}function p(e){let t={};if(e)for(let n of Object.keys(e))n.startsWith(`_MS.`)&&!a.internalMicrosoftAttributes.includes(n)||n.startsWith(`microsoft.`)||a.legacySemanticValues.includes(n)||a.httpSemanticValues.includes(n)||n===l.KnownContextTagKeys.AiOperationName||(t[n]=(0,i.serializeAttribute)(e[n]));return t}function m(e){let t=p(e.attributes),n={},r=e.links.map(e=>({operation_Id:e.context.traceId,id:e.context.spanId}));return r.length>0&&(t[s.MS_LINKS]=JSON.stringify(r)),[t,n]}function h(e){let a={name:e.name,id:`${e.spanContext().spanId}`,success:e.status?.code!==n.SpanStatusCode.ERROR,resultCode:`0`,type:`Dependency`,duration:(0,u.msToTimeSpan)((0,t.hrTimeToMilliseconds)(e.duration)),version:2};e.kind===n.SpanKind.PRODUCER&&(a.type=s.DependencyTypes.QueueMessage),e.kind===n.SpanKind.INTERNAL&&e.parentSpanContext&&(a.type=s.DependencyTypes.InProc);let o=w(e.attributes),c=e.attributes[r.SEMATTRS_DB_SYSTEM],l=e.attributes[r.SEMATTRS_RPC_SYSTEM];if(o){let t=C(e.attributes);if(t)try{a.name=`${o} ${new URL(String(t)).pathname}`}catch{}a.type=s.DependencyTypes.Http,a.data=(0,i.getUrl)(e.attributes);let n=T(e.attributes);n&&(a.resultCode=String(n));let r=(0,i.getDependencyTarget)(e.attributes);if(r){try{let e=new RegExp(/(https?)(:\/\/.*)(:\d+)(\S*)/).exec(r);if(e!==null){let t=e[1],n=e[3];(t===`https`&&n===`:443`||t===`http`&&n===`:80`)&&(r=e[1]+e[2]+e[4])}}catch{}a.target=`${r}`}}else if(c){String(c)===r.DBSYSTEMVALUES_MYSQL?a.type=`mysql`:String(c)===r.DBSYSTEMVALUES_POSTGRESQL?a.type=`postgresql`:String(c)===r.DBSYSTEMVALUES_MONGODB?a.type=`mongodb`:String(c)===r.DBSYSTEMVALUES_REDIS?a.type=`redis`:(0,i.isSqlDB)(String(c))?a.type=`SQL`:a.type=String(c);let t=e.attributes[r.SEMATTRS_DB_STATEMENT],n=e.attributes[r.SEMATTRS_DB_OPERATION];t?a.data=String(t):n&&(a.data=String(n));let o=(0,i.getDependencyTarget)(e.attributes),s=e.attributes[r.SEMATTRS_DB_NAME];o?a.target=s?`${o}|${s}`:`${o}`:a.target=s?`${s}`:`${c}`}else if(l){l===s.DependencyTypes.Wcf?a.type=s.DependencyTypes.Wcf:a.type=s.DependencyTypes.Grpc;let t=e.attributes[r.SEMATTRS_RPC_GRPC_STATUS_CODE];t&&(a.resultCode=String(t));let n=(0,i.getDependencyTarget)(e.attributes);n?a.target=`${n}`:l&&(a.target=String(l))}return a}function g(e){let a={id:`${e.spanContext().spanId}`,success:e.status.code!==n.SpanStatusCode.ERROR&&(Number(T(e.attributes))||0)<400,responseCode:`0`,duration:(0,u.msToTimeSpan)((0,t.hrTimeToMilliseconds)(e.duration)),version:2,source:void 0},o=w(e.attributes),s=e.attributes[r.SEMATTRS_RPC_GRPC_STATUS_CODE];if(o){a.url=(0,i.getUrl)(e.attributes);let t=T(e.attributes);t&&(a.responseCode=String(t))}else s&&(a.responseCode=String(s));return a}function _(e,t){let r,u,d,p=(0,i.hrTimeToDate)(e.startTime),_=t,v=f(e),[y,b]=m(e);switch(e.kind){case n.SpanKind.CLIENT:case n.SpanKind.PRODUCER:case n.SpanKind.INTERNAL:r=`Microsoft.ApplicationInsights.RemoteDependency`,u=`RemoteDependencyData`,d=h(e);break;case n.SpanKind.SERVER:case n.SpanKind.CONSUMER:r=`Microsoft.ApplicationInsights.Request`,u=`RequestData`,d=g(e),d.name=v[l.KnownContextTagKeys.AiOperationName];break;default:throw n.diag.error(`Unsupported span kind ${e.kind}`),Error(`Unsupported span kind ${e.kind}`)}let x=100;if(e.attributes[s.AzureMonitorSampleRate]&&(x=Number(e.attributes[s.AzureMonitorSampleRate])),e.attributes[c.AzNamespace]&&(e.kind===n.SpanKind.INTERNAL&&(d.type=`${s.DependencyTypes.InProc} | ${e.attributes[c.AzNamespace]}`),e.attributes[c.AzNamespace]===c.MicrosoftEventHub&&(0,o.parseEventHubSpan)(e,d)),d.id&&=d.id.substring(0,a.MaxPropertyLengths.NINE_BIT),d.name&&=d.name.substring(0,a.MaxPropertyLengths.TEN_BIT),d.resultCode&&=String(d.resultCode).substring(0,a.MaxPropertyLengths.TEN_BIT),d.data&&=String(d.data).substring(0,a.MaxPropertyLengths.THIRTEEN_BIT),d.type&&=String(d.type).substring(0,a.MaxPropertyLengths.TEN_BIT),d.target&&=String(d.target).substring(0,a.MaxPropertyLengths.TEN_BIT),d.properties)for(let e of Object.keys(d.properties))d.properties[e]=d.properties[e].substring(0,a.MaxPropertyLengths.THIRTEEN_BIT);return{name:r,sampleRate:x,time:p,instrumentationKey:_,tags:v,version:1,data:{baseType:u,baseData:Object.assign(Object.assign({},d),{properties:y,measurements:b})}}}function v(e,t){let n=[];return e.events&&e.events.forEach(o=>{let c,u=(0,i.hrTimeToDate)(o.time),d=``,f,m=p(o.attributes),h=(0,i.createTagsFromResource)(e.resource);h[l.KnownContextTagKeys.AiOperationId]=e.spanContext().traceId;let g=e.spanContext().spanId;if(g&&(h[l.KnownContextTagKeys.AiOperationParentId]=g),o.name===`exception`){d=`Microsoft.ApplicationInsights.Exception`,c=`ExceptionData`;let e=``,t=`Exception`,n=``,i=!1;if(o.attributes){e=String(o.attributes[r.SEMATTRS_EXCEPTION_TYPE]),n=String(o.attributes[r.SEMATTRS_EXCEPTION_STACKTRACE]),n&&(i=!0);let a=o.attributes[r.SEMATTRS_EXCEPTION_MESSAGE];a&&(t=String(a));let s=o.attributes[r.SEMATTRS_EXCEPTION_ESCAPED];s!==void 0&&(m[r.SEMATTRS_EXCEPTION_ESCAPED]=String(s))}f={exceptions:[{typeName:e,message:t,stack:n,hasFullStack:i}],version:2,properties:m}}else d=`Microsoft.ApplicationInsights.Message`,c=`MessageData`,f={message:o.name,version:2,properties:m};let _=100;if(e.attributes[s.AzureMonitorSampleRate]&&(_=Number(e.attributes[s.AzureMonitorSampleRate])),f.message&&=String(f.message).substring(0,a.MaxPropertyLengths.FIFTEEN_BIT),f.properties)for(let e of Object.keys(f.properties))f.properties[e]=f.properties[e].substring(0,a.MaxPropertyLengths.THIRTEEN_BIT);let v={name:d,time:u,instrumentationKey:t,version:1,sampleRate:_,data:{baseType:c,baseData:f},tags:h};n.push(v)}),n}function y(e){if(e)return e[r.ATTR_NETWORK_PEER_ADDRESS]||e[r.SEMATTRS_NET_PEER_IP]}function b(e,t){if(t){let n=x(t),r=y(t);n?e[l.KnownContextTagKeys.AiLocationIp]=String(n):r&&(e[l.KnownContextTagKeys.AiLocationIp]=String(r))}}function x(e){if(e)return e[r.ATTR_CLIENT_ADDRESS]||e[r.SEMATTRS_HTTP_CLIENT_IP]}function S(e){if(e)return e[r.ATTR_USER_AGENT_ORIGINAL]||e[r.SEMATTRS_HTTP_USER_AGENT]}function C(e){if(e)return e[r.ATTR_URL_FULL]||e[r.SEMATTRS_HTTP_URL]}function w(e){if(e)return e[r.ATTR_HTTP_REQUEST_METHOD]||e[r.SEMATTRS_HTTP_METHOD]}function T(e){if(e)return e[r.ATTR_HTTP_RESPONSE_STATUS_CODE]||e[r.SEMATTRS_HTTP_STATUS_CODE]}function E(e){if(e)return e[r.ATTR_URL_SCHEME]||e[r.SEMATTRS_HTTP_SCHEME]}function D(e){if(e)return e[r.ATTR_URL_PATH]?e[r.ATTR_URL_PATH]:e[r.ATTR_URL_QUERY]?e[r.ATTR_URL_QUERY]:e[r.SEMATTRS_HTTP_TARGET]}function O(e){if(e)return e[r.ATTR_SERVER_ADDRESS]||e[r.SEMATTRS_HTTP_HOST]}function k(e){if(e)return e[r.ATTR_CLIENT_ADDRESS]||e[r.SEMATTRS_NET_PEER_NAME]}function A(e){if(e)return e[r.ATTR_CLIENT_PORT]||e[r.ATTR_SERVER_PORT]||e[r.SEMATTRS_NET_PEER_PORT]}})),oL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AzureMonitorTraceExporter=void 0;let t=(Jd(),d(Kd)),n=uN(),r=MM(),i=aL(),a=nL(),o=tL();e.AzureMonitorTraceExporter=class extends r.AzureMonitorBaseExporter{constructor(e={}){super(e),this.isShutdown=!1,this.shouldCreateResourceMetric=(0,a.shouldCreateResourceMetric)(),this.sender=new o.HttpSender({endpointUrl:this.endpointUrl,instrumentationKey:this.instrumentationKey,trackStatsbeat:this.trackStatsbeat,exporterOptions:e,aadAudience:this.aadAudience}),t.diag.debug(`AzureMonitorTraceExporter was successfully setup`)}async export(e,r){if(this.isShutdown){t.diag.info(`Exporter shut down. Failed to export spans.`),setTimeout(()=>r({code:n.ExportResultCode.FAILED}),0);return}if(t.diag.info(`Exporting ${e.length} span(s). Converting to envelopes...`),e.length>0){let t=[],n=(0,a.createResourceMetricEnvelope)(e[0].resource,this.instrumentationKey);n&&this.shouldCreateResourceMetric&&t.push(n),e.forEach(e=>{t.push((0,i.readableSpanToEnvelope)(e,this.instrumentationKey));let n=(0,i.spanEventsToEnvelopes)(e,this.instrumentationKey);n.length>0&&t.push(...n)}),r(await this.sender.exportEnvelopes(t))}r({code:n.ExportResultCode.SUCCESS})}async shutdown(){return this.isShutdown=!0,t.diag.info(`AzureMonitorTraceExporter shutting down`),this.sender.shutdown()}}})),sL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AzureMonitorMetricExporter=void 0;let t=(Jd(),d(Kd)),n=HI(),r=uN(),i=MM(),a=GI(),o=tL();e.AzureMonitorMetricExporter=class extends i.AzureMonitorBaseExporter{constructor(e={}){super(e),this._isShutdown=!1,this._sender=new o.HttpSender({endpointUrl:this.endpointUrl,instrumentationKey:this.instrumentationKey,trackStatsbeat:this.trackStatsbeat,exporterOptions:e,aadAudience:this.aadAudience}),t.diag.debug(`AzureMonitorMetricExporter was successfully setup`)}async export(e,n){if(this._isShutdown){t.diag.info(`Exporter shut down. Failed to export spans.`),setTimeout(()=>n({code:r.ExportResultCode.FAILED}),0);return}t.diag.info(`Exporting ${e.scopeMetrics.length} metrics(s). Converting to envelopes...`);let i=(0,a.resourceMetricsToEnvelope)(e,this.instrumentationKey);await t.context.with((0,r.suppressTracing)(t.context.active()),async()=>{n(await this._sender.exportEnvelopes(i))})}async shutdown(){return this._isShutdown=!0,t.diag.info(`AzureMonitorMetricExporter shutting down`),this._sender.shutdown()}selectAggregationTemporality(e){return e===n.InstrumentType.UP_DOWN_COUNTER||e===n.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER?n.AggregationTemporality.CUMULATIVE:n.AggregationTemporality.DELTA}async forceFlush(){return Promise.resolve()}}})),cL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.logToEnvelope=c;let t=JF(),n=nL(),r=(PA(),d(NA)),i=dN(),a=(Jd(),d(Kd)),o=Uj(),s=aL();function c(e,t){let a=(0,n.hrTimeToDate)(e.hrTime),s=t,c=l(e),[d,g]=u(e),_,v,y,b=e.attributes[r.ATTR_EXCEPTION_STACKTRACE],x=e.attributes[r.ATTR_EXCEPTION_TYPE],S=!!(x&&b)||!1,C=!e.attributes[o.ApplicationInsightsBaseType]&&!e.attributes[o.ApplicationInsightsCustomEventName]&&!x;if(S){let t=e.attributes[r.ATTR_EXCEPTION_MESSAGE];_=o.ApplicationInsightsExceptionName,v=o.ApplicationInsightsExceptionBaseType,y={exceptions:[{typeName:String(x),message:String(t),hasFullStack:!!b,stack:String(b)}],severityLevel:String(f(e.severityNumber)),version:2}}else if(e.attributes[o.ApplicationInsightsCustomEventName])_=o.ApplicationInsightsEventName,v=o.ApplicationInsightsEventBaseType,y={name:String(e.attributes[o.ApplicationInsightsCustomEventName]),version:2},g=m(e);else if(C)_=o.ApplicationInsightsMessageName,v=o.ApplicationInsightsMessageBaseType,y={message:String(e.body),severityLevel:String(f(e.severityNumber)),version:2};else if(v=String(e.attributes[o.ApplicationInsightsBaseType]),_=p(e),y=h(e),g=m(e),!y)return;if(y.message&&=String(y.message).substring(0,i.MaxPropertyLengths.FIFTEEN_BIT),d)for(let e of Object.keys(d))d[e]=String(d[e]).substring(0,i.MaxPropertyLengths.THIRTEEN_BIT);return{name:_,sampleRate:100,time:a,instrumentationKey:s,tags:c,version:1,data:{baseType:v,baseData:Object.assign(Object.assign({},y),{properties:d,measurements:g})}}}function l(e){let r=(0,n.createTagsFromResource)(e.resource);return e.spanContext?.traceId&&(r[t.KnownContextTagKeys.AiOperationId]=e.spanContext.traceId),e.spanContext?.spanId&&(r[t.KnownContextTagKeys.AiOperationParentId]=e.spanContext.spanId),e.attributes[t.KnownContextTagKeys.AiOperationName]&&(r[t.KnownContextTagKeys.AiOperationName]=e.attributes[t.KnownContextTagKeys.AiOperationName]),(0,n.isSyntheticSource)(e.attributes)&&(r[t.KnownContextTagKeys.AiOperationSyntheticSource]=`True`),(0,s.getLocationIp)(r,e.attributes),r}function u(e){let r={},a={};if(e.attributes)for(let r of Object.keys(e.attributes))r.startsWith(`_MS.`)||r.startsWith(`microsoft`)||i.legacySemanticValues.includes(r)||i.httpSemanticValues.includes(r)||r===t.KnownContextTagKeys.AiOperationName||(a[r]=(0,n.serializeAttribute)(e.attributes[r]));return[a,r]}function f(e){if(e){if(e>0&&e<9)return t.KnownSeverityLevel.Verbose;if(e>=9&&e<13)return t.KnownSeverityLevel.Information;if(e>=13&&e<17)return t.KnownSeverityLevel.Warning;if(e>=17&&e<21)return t.KnownSeverityLevel.Error;if(e>=21&&e<25)return t.KnownSeverityLevel.Critical}}function p(e){let t=``;switch(e.attributes[o.ApplicationInsightsBaseType]){case o.ApplicationInsightsAvailabilityBaseType:t=o.ApplicationInsightsAvailabilityName;break;case o.ApplicationInsightsExceptionBaseType:t=o.ApplicationInsightsExceptionName;break;case o.ApplicationInsightsMessageBaseType:t=o.ApplicationInsightsMessageName;break;case o.ApplicationInsightsPageViewBaseType:t=o.ApplicationInsightsPageViewName;break;case o.ApplicationInsightsEventBaseType:t=o.ApplicationInsightsEventName;break}return t}function m(e){let t={};return e.body?.measurements&&(t=Object.assign({},e.body.measurements)),t}function h(e){let t={version:2};if(e.body)try{switch(e.attributes[o.ApplicationInsightsBaseType]){case o.ApplicationInsightsAvailabilityBaseType:t=e.body;break;case o.ApplicationInsightsExceptionBaseType:t=e.body;break;case o.ApplicationInsightsMessageBaseType:t=e.body;break;case o.ApplicationInsightsPageViewBaseType:t=e.body;break;case o.ApplicationInsightsEventBaseType:t=e.body;break}typeof t?.message==`object`&&(t.message=JSON.stringify(t.message))}catch{a.diag.error(`AzureMonitorLogExporter failed to parse Application Insights Telemetry`)}return t}})),lL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AzureMonitorLogExporter=void 0;let t=(Jd(),d(Kd)),n=uN(),r=MM(),i=cL(),a=tL();e.AzureMonitorLogExporter=class extends r.AzureMonitorBaseExporter{constructor(e={}){super(e),this._isShutdown=!1,this._sender=new a.HttpSender({endpointUrl:this.endpointUrl,instrumentationKey:this.instrumentationKey,trackStatsbeat:this.trackStatsbeat,exporterOptions:e,aadAudience:this.aadAudience}),t.diag.debug(`AzureMonitorLogExporter was successfully setup`)}async export(e,r){if(this._isShutdown){t.diag.info(`Exporter shut down. Failed to export spans.`),setTimeout(()=>r({code:n.ExportResultCode.FAILED}),0);return}t.diag.info(`Exporting ${e.length} logs(s). Converting to envelopes...`);let a=[];e.forEach(e=>{let t=(0,i.logToEnvelope)(e,this.instrumentationKey);t&&a.push(t)}),await t.context.with((0,n.suppressTracing)(t.context.active()),async()=>{r(await this._sender.exportEnvelopes(a))})}async shutdown(){return this._isShutdown=!0,t.diag.info(`AzureMonitorLogExporter shutting down`),this._sender.shutdown()}}})),uL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AI_OPERATION_NAME=e.ServiceApiVersion=e.AzureMonitorLogExporter=e.AzureMonitorMetricExporter=e.AzureMonitorTraceExporter=e.AzureMonitorBaseExporter=e.ApplicationInsightsSampler=void 0;var t=Wj();Object.defineProperty(e,`ApplicationInsightsSampler`,{enumerable:!0,get:function(){return t.ApplicationInsightsSampler}});var n=MM();Object.defineProperty(e,`AzureMonitorBaseExporter`,{enumerable:!0,get:function(){return n.AzureMonitorBaseExporter}});var r=oL();Object.defineProperty(e,`AzureMonitorTraceExporter`,{enumerable:!0,get:function(){return r.AzureMonitorTraceExporter}});var i=sL();Object.defineProperty(e,`AzureMonitorMetricExporter`,{enumerable:!0,get:function(){return i.AzureMonitorMetricExporter}});var a=lL();Object.defineProperty(e,`AzureMonitorLogExporter`,{enumerable:!0,get:function(){return a.AzureMonitorLogExporter}});var o=AM();Object.defineProperty(e,`ServiceApiVersion`,{enumerable:!0,get:function(){return o.ServiceApiVersion}});var s=AM();Object.defineProperty(e,`AI_OPERATION_NAME`,{enumerable:!0,get:function(){return s.AI_OPERATION_NAME}})})),dL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isTracingSuppressed=e.unsuppressTracing=e.suppressTracing=void 0;let t=(0,(Jd(),d(Kd)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function n(e){return e.setValue(t,!0)}e.suppressTracing=n;function r(e){return e.deleteValue(t)}e.unsuppressTracing=r;function i(e){return e.getValue(t)===!0}e.isTracingSuppressed=i})),fL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BAGGAGE_MAX_TOTAL_LENGTH=e.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=e.BAGGAGE_MAX_NAME_VALUE_PAIRS=e.BAGGAGE_HEADER=e.BAGGAGE_ITEMS_SEPARATOR=e.BAGGAGE_PROPERTIES_SEPARATOR=e.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,e.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,e.BAGGAGE_PROPERTIES_SEPARATOR=`;`,e.BAGGAGE_ITEMS_SEPARATOR=`,`,e.BAGGAGE_HEADER=`baggage`,e.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,e.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,e.BAGGAGE_MAX_TOTAL_LENGTH=8192})),pL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseKeyPairsIntoRecord=e.parsePairKeyValue=e.getKeyPairs=e.serializeKeyPairs=void 0;let t=(Jd(),d(Kd)),n=fL();function r(e){return e.reduce((e,t)=>{let r=`${e}${e===``?``:n.BAGGAGE_ITEMS_SEPARATOR}${t}`;return r.length>n.BAGGAGE_MAX_TOTAL_LENGTH?e:r},``)}e.serializeKeyPairs=r;function i(e){return e.getAllEntries().map(([e,t])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(r+=n.BAGGAGE_PROPERTIES_SEPARATOR+t.metadata.toString()),r})}e.getKeyPairs=i;function a(e){let r=e.split(n.BAGGAGE_PROPERTIES_SEPARATOR);if(r.length<=0)return;let i=r.shift();if(!i)return;let a=i.indexOf(n.BAGGAGE_KEY_PAIR_SEPARATOR);if(a<=0)return;let o=decodeURIComponent(i.substring(0,a).trim()),s=decodeURIComponent(i.substring(a+1).trim()),c;return r.length>0&&(c=(0,t.baggageEntryMetadataFromString)(r.join(n.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:c}}e.parsePairKeyValue=a;function o(e){let t={};return typeof e==`string`&&e.length>0&&e.split(n.BAGGAGE_ITEMS_SEPARATOR).forEach(e=>{let n=a(e);n!==void 0&&n.value.length>0&&(t[n.key]=n.value)}),t}e.parseKeyPairsIntoRecord=o})),mL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.W3CBaggagePropagator=void 0;let t=(Jd(),d(Kd)),n=dL(),r=fL(),i=pL();e.W3CBaggagePropagator=class{inject(e,a,o){let s=t.propagation.getBaggage(e);if(!s||(0,n.isTracingSuppressed)(e))return;let c=(0,i.getKeyPairs)(s).filter(e=>e.length<=r.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,r.BAGGAGE_MAX_NAME_VALUE_PAIRS),l=(0,i.serializeKeyPairs)(c);l.length>0&&o.set(a,r.BAGGAGE_HEADER,l)}extract(e,n,a){let o=a.get(n,r.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(r.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let c={};return s.length===0||(s.split(r.BAGGAGE_ITEMS_SEPARATOR).forEach(e=>{let t=(0,i.parsePairKeyValue)(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),c[t.key]=e}}),Object.entries(c).length===0)?e:t.propagation.setBaggage(e,t.propagation.createBaggage(c))}fields(){return[r.BAGGAGE_HEADER]}}})),hL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AnchoredClock=void 0,e.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,t){this._monotonicClock=t,this._epochMillis=e.now(),this._performanceMillis=t.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}}})),gL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isAttributeValue=e.isAttributeKey=e.sanitizeAttributes=void 0;let t=(Jd(),d(Kd));function n(e){let n={};if(typeof e!=`object`||!e)return n;for(let[a,o]of Object.entries(e)){if(!r(a)){t.diag.warn(`Invalid attribute key: ${a}`);continue}if(!i(o)){t.diag.warn(`Invalid attribute value set for key: ${a}`);continue}Array.isArray(o)?n[a]=o.slice():n[a]=o}return n}e.sanitizeAttributes=n;function r(e){return typeof e==`string`&&e.length>0}e.isAttributeKey=r;function i(e){return e==null?!0:Array.isArray(e)?a(e):o(e)}e.isAttributeValue=i;function a(e){let t;for(let n of e)if(n!=null){if(!t){if(o(n)){t=typeof n;continue}return!1}if(typeof n!==t)return!1}return!0}function o(e){switch(typeof e){case`number`:case`boolean`:case`string`:return!0}return!1}})),_L=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.loggingErrorHandler=void 0;let t=(Jd(),d(Kd));function n(){return e=>{t.diag.error(r(e))}}e.loggingErrorHandler=n;function r(e){return typeof e==`string`?e:JSON.stringify(i(e))}function i(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}})),vL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.globalErrorHandler=e.setGlobalErrorHandler=void 0;let t=(0,_L().loggingErrorHandler)();function n(e){t=e}e.setGlobalErrorHandler=n;function r(e){try{t(e)}catch{}}e.globalErrorHandler=r})),oee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getStringListFromEnv=e.getBooleanFromEnv=e.getStringFromEnv=e.getNumberFromEnv=void 0;let t=(Jd(),d(Kd)),n=require(`util`);function r(e){let r=process.env[e];if(r==null||r.trim()===``)return;let i=Number(r);if(isNaN(i)){t.diag.warn(`Unknown value ${(0,n.inspect)(r)} for ${e}, expected a number, using defaults`);return}return i}e.getNumberFromEnv=r;function i(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}e.getStringFromEnv=i;function a(e){let r=process.env[e]?.trim().toLowerCase();return r==null||r===``?!1:r===`true`?!0:(r===`false`||t.diag.warn(`Unknown value ${(0,n.inspect)(r)} for ${e}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}e.getBooleanFromEnv=a;function o(e){return i(e)?.split(`,`).map(e=>e.trim()).filter(e=>e!==``)}e.getStringListFromEnv=o})),yL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._globalThis=void 0,e._globalThis=typeof globalThis==`object`?globalThis:global})),bL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.otperformance=void 0,e.otperformance=require(`perf_hooks`).performance})),xL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.VERSION=void 0,e.VERSION=`2.1.0`})),SL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_PROCESS_RUNTIME_NAME=void 0,e.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),CL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SDK_INFO=void 0;let t=xL(),n=(PA(),d(NA)),r=SL();e.SDK_INFO={[n.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[r.ATTR_PROCESS_RUNTIME_NAME]:`node`,[n.ATTR_TELEMETRY_SDK_LANGUAGE]:n.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[n.ATTR_TELEMETRY_SDK_VERSION]:t.VERSION}})),wL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.unrefTimer=void 0;function t(e){e.unref()}e.unrefTimer=t})),TL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.unrefTimer=e.SDK_INFO=e.otperformance=e._globalThis=e.getStringListFromEnv=e.getNumberFromEnv=e.getBooleanFromEnv=e.getStringFromEnv=void 0;var t=oee();Object.defineProperty(e,`getStringFromEnv`,{enumerable:!0,get:function(){return t.getStringFromEnv}}),Object.defineProperty(e,`getBooleanFromEnv`,{enumerable:!0,get:function(){return t.getBooleanFromEnv}}),Object.defineProperty(e,`getNumberFromEnv`,{enumerable:!0,get:function(){return t.getNumberFromEnv}}),Object.defineProperty(e,`getStringListFromEnv`,{enumerable:!0,get:function(){return t.getStringListFromEnv}});var n=yL();Object.defineProperty(e,`_globalThis`,{enumerable:!0,get:function(){return n._globalThis}});var r=bL();Object.defineProperty(e,`otperformance`,{enumerable:!0,get:function(){return r.otperformance}});var i=CL();Object.defineProperty(e,`SDK_INFO`,{enumerable:!0,get:function(){return i.SDK_INFO}});var a=wL();Object.defineProperty(e,`unrefTimer`,{enumerable:!0,get:function(){return a.unrefTimer}})})),EL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getStringListFromEnv=e.getNumberFromEnv=e.getStringFromEnv=e.getBooleanFromEnv=e.unrefTimer=e.otperformance=e._globalThis=e.SDK_INFO=void 0;var t=TL();Object.defineProperty(e,`SDK_INFO`,{enumerable:!0,get:function(){return t.SDK_INFO}}),Object.defineProperty(e,`_globalThis`,{enumerable:!0,get:function(){return t._globalThis}}),Object.defineProperty(e,`otperformance`,{enumerable:!0,get:function(){return t.otperformance}}),Object.defineProperty(e,`unrefTimer`,{enumerable:!0,get:function(){return t.unrefTimer}}),Object.defineProperty(e,`getBooleanFromEnv`,{enumerable:!0,get:function(){return t.getBooleanFromEnv}}),Object.defineProperty(e,`getStringFromEnv`,{enumerable:!0,get:function(){return t.getStringFromEnv}}),Object.defineProperty(e,`getNumberFromEnv`,{enumerable:!0,get:function(){return t.getNumberFromEnv}}),Object.defineProperty(e,`getStringListFromEnv`,{enumerable:!0,get:function(){return t.getStringListFromEnv}})})),DL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.addHrTimes=e.isTimeInput=e.isTimeInputHrTime=e.hrTimeToMicroseconds=e.hrTimeToMilliseconds=e.hrTimeToNanoseconds=e.hrTimeToTimeStamp=e.hrTimeDuration=e.timeInputToHrTime=e.hrTime=e.getTimeOrigin=e.millisToHrTime=void 0;let t=EL(),n=10**6,r=10**9;function i(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*n)]}e.millisToHrTime=i;function a(){let e=t.otperformance.timeOrigin;if(typeof e!=`number`){let n=t.otperformance;e=n.timing&&n.timing.fetchStart}return e}e.getTimeOrigin=a;function o(e){return h(i(a()),i(typeof e==`number`?e:t.otperformance.now()))}e.hrTime=o;function s(e){if(p(e))return e;if(typeof e==`number`)return e<a()?o(e):i(e);if(e instanceof Date)return i(e.getTime());throw TypeError(`Invalid input type`)}e.timeInputToHrTime=s;function c(e,t){let n=t[0]-e[0],i=t[1]-e[1];return i<0&&(--n,i+=r),[n,i]}e.hrTimeDuration=c;function l(e){let t=`${`0`.repeat(9)}${e[1]}Z`,n=t.substring(t.length-9-1);return new Date(e[0]*1e3).toISOString().replace(`000Z`,n)}e.hrTimeToTimeStamp=l;function u(e){return e[0]*r+e[1]}e.hrTimeToNanoseconds=u;function d(e){return e[0]*1e3+e[1]/1e6}e.hrTimeToMilliseconds=d;function f(e){return e[0]*1e6+e[1]/1e3}e.hrTimeToMicroseconds=f;function p(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}e.isTimeInputHrTime=p;function m(e){return p(e)||typeof e==`number`||e instanceof Date}e.isTimeInput=m;function h(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=r&&(n[1]-=r,n[0]+=1),n}e.addHrTimes=h})),OL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ExportResultCode=void 0,(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(e.ExportResultCode||={})})),kL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CompositePropagator=void 0;let t=(Jd(),d(Kd));e.CompositePropagator=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(e=>typeof e.fields==`function`?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,n,r){for(let i of this._propagators)try{i.inject(e,n,r)}catch(e){t.diag.warn(`Failed to inject with ${i.constructor.name}. Err: ${e.message}`)}}extract(e,n,r){return this._propagators.reduce((e,i)=>{try{return i.extract(e,n,r)}catch(e){t.diag.warn(`Failed to extract with ${i.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}})),AL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateValue=e.validateKey=void 0;let t=`[_0-9a-z-*/]`,n=`[a-z]${t}{0,255}`,r=`[a-z0-9]${t}{0,240}@[a-z]${t}{0,13}`,i=RegExp(`^(?:${n}|${r})$`),a=/^[ -~]{0,255}[!-~]$/,o=/,|=/;function s(e){return i.test(e)}e.validateKey=s;function c(e){return a.test(e)&&!o.test(e)}e.validateValue=c})),jL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TraceState=void 0;let t=AL();e.TraceState=class e{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+`=`+this.get(t)),e),[]).join(`,`)}_parse(e){e.length>512||(this._internalState=e.split(`,`).reverse().reduce((e,n)=>{let r=n.trim(),i=r.indexOf(`=`);if(i!==-1){let a=r.slice(0,i),o=r.slice(i+1,n.length);(0,t.validateKey)(a)&&(0,t.validateValue)(o)&&e.set(a,o)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}}})),ML=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.W3CTraceContextPropagator=e.parseTraceParent=e.TRACE_STATE_HEADER=e.TRACE_PARENT_HEADER=void 0;let t=(Jd(),d(Kd)),n=dL(),r=jL();e.TRACE_PARENT_HEADER=`traceparent`,e.TRACE_STATE_HEADER=`tracestate`;let i=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function a(e){let t=i.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}e.parseTraceParent=a,e.W3CTraceContextPropagator=class{inject(r,i,a){let o=t.trace.getSpanContext(r);if(!o||(0,n.isTracingSuppressed)(r)||!(0,t.isSpanContextValid)(o))return;let s=`00-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||t.TraceFlags.NONE).toString(16)}`;a.set(i,e.TRACE_PARENT_HEADER,s),o.traceState&&a.set(i,e.TRACE_STATE_HEADER,o.traceState.serialize())}extract(n,i,o){let s=o.get(i,e.TRACE_PARENT_HEADER);if(!s)return n;let c=Array.isArray(s)?s[0]:s;if(typeof c!=`string`)return n;let l=a(c);if(!l)return n;l.isRemote=!0;let u=o.get(i,e.TRACE_STATE_HEADER);if(u){let e=Array.isArray(u)?u.join(`,`):u;l.traceState=new r.TraceState(typeof e==`string`?e:void 0)}return t.trace.setSpanContext(n,l)}fields(){return[e.TRACE_PARENT_HEADER,e.TRACE_STATE_HEADER]}}})),NL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRPCMetadata=e.deleteRPCMetadata=e.setRPCMetadata=e.RPCType=void 0;let t=(0,(Jd(),d(Kd)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(e){e.HTTP=`http`})(e.RPCType||={});function n(e,n){return e.setValue(t,n)}e.setRPCMetadata=n;function r(e){return e.deleteValue(t)}e.deleteRPCMetadata=r;function i(e){return e.getValue(t)}e.getRPCMetadata=i})),PL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isPlainObject=void 0;let t=Function.prototype.toString,n=t.call(Object),r=Object.getPrototypeOf,i=Object.prototype,a=i.hasOwnProperty,o=Symbol?Symbol.toStringTag:void 0,s=i.toString;function c(e){if(!l(e)||u(e)!==`[object Object]`)return!1;let i=r(e);if(i===null)return!0;let o=a.call(i,`constructor`)&&i.constructor;return typeof o==`function`&&o instanceof o&&t.call(o)===n}e.isPlainObject=c;function l(e){return typeof e==`object`&&!!e}function u(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:o&&o in Object(e)?d(e):f(e)}function d(e){let t=a.call(e,o),n=e[o],r=!1;try{e[o]=void 0,r=!0}catch{}let i=s.call(e);return r&&(t?e[o]=n:delete e[o]),i}function f(e){return s.call(e)}})),FL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.merge=void 0;let t=PL();function n(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=i(t,e.shift(),0,n);return t}e.merge=n;function r(e){return o(e)?e.slice():e}function i(e,t,n=0,d){let f;if(!(n>20)){if(n++,l(e)||l(t)||s(t))f=r(t);else if(o(e)){if(f=e.slice(),o(t))for(let e=0,n=t.length;e<n;e++)f.push(r(t[e]));else if(c(t)){let e=Object.keys(t);for(let n=0,i=e.length;n<i;n++){let i=e[n];f[i]=r(t[i])}}}else if(c(e))if(c(t)){if(!u(e,t))return t;f=Object.assign({},e);let r=Object.keys(t);for(let o=0,s=r.length;o<s;o++){let s=r[o],u=t[s];if(l(u))u===void 0?delete f[s]:f[s]=u;else{let r=f[s],o=u;if(a(e,s,d)||a(t,s,d))delete f[s];else{if(c(r)&&c(o)){let n=d.get(r)||[],i=d.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),d.set(r,n),d.set(o,i)}f[s]=i(f[s],u,n,d)}}}}else f=t;return f}}function a(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function o(e){return Array.isArray(e)}function s(e){return typeof e==`function`}function c(e){return!l(e)&&!o(e)&&!s(e)&&typeof e==`object`}function l(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function u(e,n){return!(!(0,t.isPlainObject)(e)||!(0,t.isPlainObject)(n))}})),IL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callWithTimeout=e.TimeoutError=void 0;var t=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};e.TimeoutError=t;function n(e,n){let r,i=new Promise(function(e,i){r=setTimeout(function(){i(new t(`Operation timed out.`))},n)});return Promise.race([e,i]).then(e=>(clearTimeout(r),e),e=>{throw clearTimeout(r),e})}e.callWithTimeout=n})),LL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isUrlIgnored=e.urlMatches=void 0;function t(e,t){return typeof t==`string`?e===t:!!e.match(t)}e.urlMatches=t;function n(e,n){if(!n)return!1;for(let r of n)if(t(e,r))return!0;return!1}e.isUrlIgnored=n})),RL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Deferred=void 0,e.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),zL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BindOnceFuture=void 0;let t=RL();e.BindOnceFuture=class{_callback;_that;_isCalled=!1;_deferred=new t.Deferred;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}})),BL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.diagLogLevelFromString=void 0;let t=(Jd(),d(Kd)),n={ALL:t.DiagLogLevel.ALL,VERBOSE:t.DiagLogLevel.VERBOSE,DEBUG:t.DiagLogLevel.DEBUG,INFO:t.DiagLogLevel.INFO,WARN:t.DiagLogLevel.WARN,ERROR:t.DiagLogLevel.ERROR,NONE:t.DiagLogLevel.NONE};function r(e){return e==null?void 0:n[e.toUpperCase()]??(t.diag.warn(`Unknown log level "${e}", expected one of ${Object.keys(n)}, using default`),t.DiagLogLevel.INFO)}e.diagLogLevelFromString=r})),VL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._export=void 0;let t=(Jd(),d(Kd)),n=dL();function r(e,r){return new Promise(i=>{t.context.with((0,n.suppressTracing)(t.context.active()),()=>{e.export(r,e=>{i(e)})})})}e._export=r})),HL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.internal=e.diagLogLevelFromString=e.BindOnceFuture=e.urlMatches=e.isUrlIgnored=e.callWithTimeout=e.TimeoutError=e.merge=e.TraceState=e.unsuppressTracing=e.suppressTracing=e.isTracingSuppressed=e.setRPCMetadata=e.getRPCMetadata=e.deleteRPCMetadata=e.RPCType=e.parseTraceParent=e.W3CTraceContextPropagator=e.TRACE_STATE_HEADER=e.TRACE_PARENT_HEADER=e.CompositePropagator=e.unrefTimer=e.otperformance=e.getStringListFromEnv=e.getNumberFromEnv=e.getBooleanFromEnv=e.getStringFromEnv=e._globalThis=e.SDK_INFO=e.parseKeyPairsIntoRecord=e.ExportResultCode=e.timeInputToHrTime=e.millisToHrTime=e.isTimeInputHrTime=e.isTimeInput=e.hrTimeToTimeStamp=e.hrTimeToNanoseconds=e.hrTimeToMilliseconds=e.hrTimeToMicroseconds=e.hrTimeDuration=e.hrTime=e.getTimeOrigin=e.addHrTimes=e.loggingErrorHandler=e.setGlobalErrorHandler=e.globalErrorHandler=e.sanitizeAttributes=e.isAttributeValue=e.AnchoredClock=e.W3CBaggagePropagator=void 0;var t=mL();Object.defineProperty(e,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return t.W3CBaggagePropagator}});var n=hL();Object.defineProperty(e,`AnchoredClock`,{enumerable:!0,get:function(){return n.AnchoredClock}});var r=gL();Object.defineProperty(e,`isAttributeValue`,{enumerable:!0,get:function(){return r.isAttributeValue}}),Object.defineProperty(e,`sanitizeAttributes`,{enumerable:!0,get:function(){return r.sanitizeAttributes}});var i=vL();Object.defineProperty(e,`globalErrorHandler`,{enumerable:!0,get:function(){return i.globalErrorHandler}}),Object.defineProperty(e,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return i.setGlobalErrorHandler}});var a=_L();Object.defineProperty(e,`loggingErrorHandler`,{enumerable:!0,get:function(){return a.loggingErrorHandler}});var o=DL();Object.defineProperty(e,`addHrTimes`,{enumerable:!0,get:function(){return o.addHrTimes}}),Object.defineProperty(e,`getTimeOrigin`,{enumerable:!0,get:function(){return o.getTimeOrigin}}),Object.defineProperty(e,`hrTime`,{enumerable:!0,get:function(){return o.hrTime}}),Object.defineProperty(e,`hrTimeDuration`,{enumerable:!0,get:function(){return o.hrTimeDuration}}),Object.defineProperty(e,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return o.hrTimeToMicroseconds}}),Object.defineProperty(e,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return o.hrTimeToMilliseconds}}),Object.defineProperty(e,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return o.hrTimeToNanoseconds}}),Object.defineProperty(e,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return o.hrTimeToTimeStamp}}),Object.defineProperty(e,`isTimeInput`,{enumerable:!0,get:function(){return o.isTimeInput}}),Object.defineProperty(e,`isTimeInputHrTime`,{enumerable:!0,get:function(){return o.isTimeInputHrTime}}),Object.defineProperty(e,`millisToHrTime`,{enumerable:!0,get:function(){return o.millisToHrTime}}),Object.defineProperty(e,`timeInputToHrTime`,{enumerable:!0,get:function(){return o.timeInputToHrTime}});var s=OL();Object.defineProperty(e,`ExportResultCode`,{enumerable:!0,get:function(){return s.ExportResultCode}});var c=pL();Object.defineProperty(e,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return c.parseKeyPairsIntoRecord}});var l=EL();Object.defineProperty(e,`SDK_INFO`,{enumerable:!0,get:function(){return l.SDK_INFO}}),Object.defineProperty(e,`_globalThis`,{enumerable:!0,get:function(){return l._globalThis}}),Object.defineProperty(e,`getStringFromEnv`,{enumerable:!0,get:function(){return l.getStringFromEnv}}),Object.defineProperty(e,`getBooleanFromEnv`,{enumerable:!0,get:function(){return l.getBooleanFromEnv}}),Object.defineProperty(e,`getNumberFromEnv`,{enumerable:!0,get:function(){return l.getNumberFromEnv}}),Object.defineProperty(e,`getStringListFromEnv`,{enumerable:!0,get:function(){return l.getStringListFromEnv}}),Object.defineProperty(e,`otperformance`,{enumerable:!0,get:function(){return l.otperformance}}),Object.defineProperty(e,`unrefTimer`,{enumerable:!0,get:function(){return l.unrefTimer}});var u=kL();Object.defineProperty(e,`CompositePropagator`,{enumerable:!0,get:function(){return u.CompositePropagator}});var d=ML();Object.defineProperty(e,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return d.TRACE_PARENT_HEADER}}),Object.defineProperty(e,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return d.TRACE_STATE_HEADER}}),Object.defineProperty(e,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return d.W3CTraceContextPropagator}}),Object.defineProperty(e,`parseTraceParent`,{enumerable:!0,get:function(){return d.parseTraceParent}});var f=NL();Object.defineProperty(e,`RPCType`,{enumerable:!0,get:function(){return f.RPCType}}),Object.defineProperty(e,`deleteRPCMetadata`,{enumerable:!0,get:function(){return f.deleteRPCMetadata}}),Object.defineProperty(e,`getRPCMetadata`,{enumerable:!0,get:function(){return f.getRPCMetadata}}),Object.defineProperty(e,`setRPCMetadata`,{enumerable:!0,get:function(){return f.setRPCMetadata}});var p=dL();Object.defineProperty(e,`isTracingSuppressed`,{enumerable:!0,get:function(){return p.isTracingSuppressed}}),Object.defineProperty(e,`suppressTracing`,{enumerable:!0,get:function(){return p.suppressTracing}}),Object.defineProperty(e,`unsuppressTracing`,{enumerable:!0,get:function(){return p.unsuppressTracing}});var m=jL();Object.defineProperty(e,`TraceState`,{enumerable:!0,get:function(){return m.TraceState}});var h=FL();Object.defineProperty(e,`merge`,{enumerable:!0,get:function(){return h.merge}});var g=IL();Object.defineProperty(e,`TimeoutError`,{enumerable:!0,get:function(){return g.TimeoutError}}),Object.defineProperty(e,`callWithTimeout`,{enumerable:!0,get:function(){return g.callWithTimeout}});var _=LL();Object.defineProperty(e,`isUrlIgnored`,{enumerable:!0,get:function(){return _.isUrlIgnored}}),Object.defineProperty(e,`urlMatches`,{enumerable:!0,get:function(){return _.urlMatches}});var v=zL();Object.defineProperty(e,`BindOnceFuture`,{enumerable:!0,get:function(){return v.BindOnceFuture}});var y=BL();Object.defineProperty(e,`diagLogLevelFromString`,{enumerable:!0,get:function(){return y.diagLogLevelFromString}}),e.internal={_export:VL()._export}})),UL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=void 0;function t(){return`unknown_service:${process.argv0}`}e.defaultServiceName=t})),WL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=void 0;var t=UL();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return t.defaultServiceName}})})),GL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=void 0;var t=WL();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return t.defaultServiceName}})})),KL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.identity=e.isPromiseLike=void 0,e.isPromiseLike=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;function t(e){return e}e.identity=t})),qL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultResource=e.emptyResource=e.resourceFromDetectedResource=e.resourceFromAttributes=void 0;let t=(Jd(),d(Kd)),n=HL(),r=(PA(),d(NA)),i=GL(),a=KL();var o=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=f(t),r._asyncAttributesPending=t.filter(([e,t])=>(0,a.isPromiseLike)(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>((0,a.isPromiseLike)(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=f(this._rawAttributes),this._schemaUrl=p(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,(0,a.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&t.diag.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[n,r]of this._rawAttributes){if((0,a.isPromiseLike)(r)){t.diag.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=m(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function s(e,t){return o.FromAttributeList(Object.entries(e),t)}e.resourceFromAttributes=s;function c(e,t){return new o(e,t)}e.resourceFromDetectedResource=c;function l(){return s({})}e.emptyResource=l;function u(){return s({[r.ATTR_SERVICE_NAME]:(0,i.defaultServiceName)(),[r.ATTR_TELEMETRY_SDK_LANGUAGE]:n.SDK_INFO[r.ATTR_TELEMETRY_SDK_LANGUAGE],[r.ATTR_TELEMETRY_SDK_NAME]:n.SDK_INFO[r.ATTR_TELEMETRY_SDK_NAME],[r.ATTR_TELEMETRY_SDK_VERSION]:n.SDK_INFO[r.ATTR_TELEMETRY_SDK_VERSION]})}e.defaultResource=u;function f(e){return e.map(([e,n])=>(0,a.isPromiseLike)(n)?[e,n.catch(n=>{t.diag.debug(`promise rejection for resource attribute: %s - %s`,e,n)})]:[e,n])}function p(e){if(typeof e==`string`||e===void 0)return e;t.diag.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function m(e,n){let r=e?.schemaUrl,i=n?.schemaUrl,a=r===void 0||r===``,o=i===void 0||i===``;if(a)return i;if(o||r===i)return r;t.diag.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,r,i)}})),JL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.detectResources=void 0;let t=(Jd(),d(Kd)),n=qL();e.detectResources=(e={})=>(e.detectors||[]).map(r=>{try{let i=(0,n.resourceFromDetectedResource)(r.detect(e));return t.diag.debug(`${r.constructor.name} found resource.`,i),i}catch(e){return t.diag.debug(`${r.constructor.name} failed: ${e.message}`),(0,n.emptyResource)()}}).reduce((e,t)=>e.merge(t),(0,n.emptyResource)())})),YL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.envDetector=void 0;let t=(Jd(),d(Kd)),n=(PA(),d(NA)),r=HL();e.envDetector=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;_ERROR_MESSAGE_INVALID_CHARS=`should be a ASCII string with a length greater than 0 and not exceed `+this._MAX_LENGTH+` characters.`;_ERROR_MESSAGE_INVALID_VALUE=`should be a ASCII string with a length not exceed `+this._MAX_LENGTH+` characters.`;detect(e){let i={},a=(0,r.getStringFromEnv)(`OTEL_RESOURCE_ATTRIBUTES`),o=(0,r.getStringFromEnv)(`OTEL_SERVICE_NAME`);if(a)try{let e=this._parseResourceAttributes(a);Object.assign(i,e)}catch(e){t.diag.debug(`EnvDetector failed: ${e.message}`)}return o&&(i[n.ATTR_SERVICE_NAME]=o),{attributes:i}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR,-1);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(n.length!==2)continue;let[r,i]=n;if(r=r.trim(),i=i.trim().split(/^"|"$/).join(``),!this._isValidAndNotEmpty(r))throw Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(i))throw Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);t[r]=decodeURIComponent(i)}return t}_isValid(e){return e.length<=this._MAX_LENGTH&&this._isBaggageOctetString(e)}_isBaggageOctetString(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<33||n===44||n===59||n===92||n>126)return!1}return!0}_isValidAndNotEmpty(e){return e.length>0&&this._isValid(e)}}})),XL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ATTR_WEBENGINE_VERSION=e.ATTR_WEBENGINE_NAME=e.ATTR_WEBENGINE_DESCRIPTION=e.ATTR_SERVICE_NAMESPACE=e.ATTR_SERVICE_INSTANCE_ID=e.ATTR_PROCESS_RUNTIME_VERSION=e.ATTR_PROCESS_RUNTIME_NAME=e.ATTR_PROCESS_RUNTIME_DESCRIPTION=e.ATTR_PROCESS_PID=e.ATTR_PROCESS_OWNER=e.ATTR_PROCESS_EXECUTABLE_PATH=e.ATTR_PROCESS_EXECUTABLE_NAME=e.ATTR_PROCESS_COMMAND_ARGS=e.ATTR_PROCESS_COMMAND=e.ATTR_OS_VERSION=e.ATTR_OS_TYPE=e.ATTR_K8S_POD_NAME=e.ATTR_K8S_NAMESPACE_NAME=e.ATTR_K8S_DEPLOYMENT_NAME=e.ATTR_K8S_CLUSTER_NAME=e.ATTR_HOST_TYPE=e.ATTR_HOST_NAME=e.ATTR_HOST_IMAGE_VERSION=e.ATTR_HOST_IMAGE_NAME=e.ATTR_HOST_IMAGE_ID=e.ATTR_HOST_ID=e.ATTR_HOST_ARCH=e.ATTR_CONTAINER_NAME=e.ATTR_CONTAINER_IMAGE_TAGS=e.ATTR_CONTAINER_IMAGE_NAME=e.ATTR_CONTAINER_ID=e.ATTR_CLOUD_REGION=e.ATTR_CLOUD_PROVIDER=e.ATTR_CLOUD_AVAILABILITY_ZONE=e.ATTR_CLOUD_ACCOUNT_ID=void 0,e.ATTR_CLOUD_ACCOUNT_ID=`cloud.account.id`,e.ATTR_CLOUD_AVAILABILITY_ZONE=`cloud.availability_zone`,e.ATTR_CLOUD_PROVIDER=`cloud.provider`,e.ATTR_CLOUD_REGION=`cloud.region`,e.ATTR_CONTAINER_ID=`container.id`,e.ATTR_CONTAINER_IMAGE_NAME=`container.image.name`,e.ATTR_CONTAINER_IMAGE_TAGS=`container.image.tags`,e.ATTR_CONTAINER_NAME=`container.name`,e.ATTR_HOST_ARCH=`host.arch`,e.ATTR_HOST_ID=`host.id`,e.ATTR_HOST_IMAGE_ID=`host.image.id`,e.ATTR_HOST_IMAGE_NAME=`host.image.name`,e.ATTR_HOST_IMAGE_VERSION=`host.image.version`,e.ATTR_HOST_NAME=`host.name`,e.ATTR_HOST_TYPE=`host.type`,e.ATTR_K8S_CLUSTER_NAME=`k8s.cluster.name`,e.ATTR_K8S_DEPLOYMENT_NAME=`k8s.deployment.name`,e.ATTR_K8S_NAMESPACE_NAME=`k8s.namespace.name`,e.ATTR_K8S_POD_NAME=`k8s.pod.name`,e.ATTR_OS_TYPE=`os.type`,e.ATTR_OS_VERSION=`os.version`,e.ATTR_PROCESS_COMMAND=`process.command`,e.ATTR_PROCESS_COMMAND_ARGS=`process.command_args`,e.ATTR_PROCESS_EXECUTABLE_NAME=`process.executable.name`,e.ATTR_PROCESS_EXECUTABLE_PATH=`process.executable.path`,e.ATTR_PROCESS_OWNER=`process.owner`,e.ATTR_PROCESS_PID=`process.pid`,e.ATTR_PROCESS_RUNTIME_DESCRIPTION=`process.runtime.description`,e.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,e.ATTR_PROCESS_RUNTIME_VERSION=`process.runtime.version`,e.ATTR_SERVICE_INSTANCE_ID=`service.instance.id`,e.ATTR_SERVICE_NAMESPACE=`service.namespace`,e.ATTR_WEBENGINE_DESCRIPTION=`webengine.description`,e.ATTR_WEBENGINE_NAME=`webengine.name`,e.ATTR_WEBENGINE_VERSION=`webengine.version`})),ZL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getMachineId=void 0;let t=require(`process`),n;async function r(){if(!n)switch(t.platform){case`darwin`:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-darwin-qxG7FDMy.cjs`).default))).getMachineId;break;case`linux`:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-linux-Dnsx6XjV.cjs`).default))).getMachineId;break;case`freebsd`:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-bsd-C6vJ2MI6.cjs`).default))).getMachineId;break;case`win32`:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-win-BDuHxVob.cjs`).default))).getMachineId;break;default:n=(await Promise.resolve().then(()=>u(require(`./getMachineId-unsupported-BE5onnLI.cjs`).default))).getMachineId;break}return n()}e.getMachineId=r})),QL=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.normalizeType=e.normalizeArch=void 0,e.normalizeArch=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},e.normalizeType=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),$L=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hostDetector=void 0;let t=XL(),n=require(`os`),r=ZL(),i=QL();e.hostDetector=new class{detect(e){return{attributes:{[t.ATTR_HOST_NAME]:(0,n.hostname)(),[t.ATTR_HOST_ARCH]:(0,i.normalizeArch)((0,n.arch)()),[t.ATTR_HOST_ID]:(0,r.getMachineId)()}}}}})),eR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.osDetector=void 0;let t=XL(),n=require(`os`),r=QL();e.osDetector=new class{detect(e){return{attributes:{[t.ATTR_OS_TYPE]:(0,r.normalizeType)((0,n.platform)()),[t.ATTR_OS_VERSION]:(0,n.release)()}}}}})),tR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.processDetector=void 0;let t=(Jd(),d(Kd)),n=XL(),r=require(`os`);e.processDetector=new class{detect(e){let i={[n.ATTR_PROCESS_PID]:process.pid,[n.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[n.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[n.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[n.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[n.ATTR_PROCESS_RUNTIME_NAME]:`nodejs`,[n.ATTR_PROCESS_RUNTIME_DESCRIPTION]:`Node.js`};process.argv.length>1&&(i[n.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let e=r.userInfo();i[n.ATTR_PROCESS_OWNER]=e.username}catch(e){t.diag.debug(`error obtaining process owner: ${e}`)}return{attributes:i}}}})),nR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=void 0;let t=XL(),n=require(`crypto`);e.serviceInstanceIdDetector=new class{detect(e){return{attributes:{[t.ATTR_SERVICE_INSTANCE_ID]:(0,n.randomUUID)()}}}}})),rR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=$L();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}});var n=eR();Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}});var r=tR();Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return r.processDetector}});var i=nR();Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return i.serviceInstanceIdDetector}})})),iR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=void 0;var t=rR();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return t.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return t.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return t.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return t.serviceInstanceIdDetector}})})),aR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.NoopDetector=void 0;var t=class{detect(){return{attributes:{}}}};e.NoopDetector=t,e.noopDetector=new t})),oR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noopDetector=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=void 0;var t=YL();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return t.envDetector}});var n=iR();Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return n.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return n.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return n.serviceInstanceIdDetector}});var r=aR();Object.defineProperty(e,`noopDetector`,{enumerable:!0,get:function(){return r.noopDetector}})})),sR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultServiceName=e.emptyResource=e.defaultResource=e.resourceFromAttributes=e.serviceInstanceIdDetector=e.processDetector=e.osDetector=e.hostDetector=e.envDetector=e.detectResources=void 0;var t=JL();Object.defineProperty(e,`detectResources`,{enumerable:!0,get:function(){return t.detectResources}});var n=oR();Object.defineProperty(e,`envDetector`,{enumerable:!0,get:function(){return n.envDetector}}),Object.defineProperty(e,`hostDetector`,{enumerable:!0,get:function(){return n.hostDetector}}),Object.defineProperty(e,`osDetector`,{enumerable:!0,get:function(){return n.osDetector}}),Object.defineProperty(e,`processDetector`,{enumerable:!0,get:function(){return n.processDetector}}),Object.defineProperty(e,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return n.serviceInstanceIdDetector}});var r=qL();Object.defineProperty(e,`resourceFromAttributes`,{enumerable:!0,get:function(){return r.resourceFromAttributes}}),Object.defineProperty(e,`defaultResource`,{enumerable:!0,get:function(){return r.defaultResource}}),Object.defineProperty(e,`emptyResource`,{enumerable:!0,get:function(){return r.emptyResource}});var i=GL();Object.defineProperty(e,`defaultServiceName`,{enumerable:!0,get:function(){return i.defaultServiceName}})})),cR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LogRecordImpl=void 0;let t=(Jd(),d(Kd)),n=HL();e.LogRecordImpl=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,r,i){let{timestamp:a,observedTimestamp:o,eventName:s,severityNumber:c,severityText:l,body:u,attributes:d={},context:f}=i,p=Date.now();if(this.hrTime=(0,n.timeInputToHrTime)(a??p),this.hrTimeObserved=(0,n.timeInputToHrTime)(o??p),f){let e=t.trace.getSpanContext(f);e&&t.isSpanContextValid(e)&&(this.spanContext=e)}this.severityNumber=c,this.severityText=l,this.body=u,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=s,this.setAttributes(d)}setAttribute(e,r){return this._isLogRecordReadonly()||r===null?this:e.length===0?(t.diag.warn(`Invalid attribute key: ${e}`),this):!(0,n.isAttributeValue)(r)&&!(typeof r==`object`&&!Array.isArray(r)&&Object.keys(r).length>0)?(t.diag.warn(`Invalid attribute value set for key: ${e}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&t.diag.warn(`Dropping extra attributes.`),this):((0,n.isAttributeValue)(r)?this.attributes[e]=this._truncateToSize(r):this.attributes[e]=r,this))}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let n=this._logRecordLimits.attributeValueLengthLimit;return n<=0?(t.diag.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e==`string`?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,n):e):e}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&t.diag.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),lR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Logger=void 0;let t=(Jd(),d(Kd)),n=cR();e.Logger=class{instrumentationScope;_sharedState;constructor(e,t){this.instrumentationScope=e,this._sharedState=t}emit(e){let r=e.context||t.context.active(),i=new n.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(i,r),i._makeReadonly()}}})),uR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reconfigureLimits=e.loadDefaultConfig=void 0;let t=HL();function n(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,t.getNumberFromEnv)(`OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,t.getNumberFromEnv)(`OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT`)??128},includeTraceContext:!0}}e.loadDefaultConfig=n;function r(e){return{attributeCountLimit:e.attributeCountLimit??(0,t.getNumberFromEnv)(`OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT`)??(0,t.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,attributeValueLengthLimit:e.attributeValueLengthLimit??(0,t.getNumberFromEnv)(`OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,t.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0}}e.reconfigureLimits=r})),dR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NoopLogRecordProcessor=void 0,e.NoopLogRecordProcessor=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}}})),fR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MultiLogRecordProcessor=void 0;let t=HL();e.MultiLogRecordProcessor=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(n=>(0,t.callWithTimeout)(n.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}}})),pR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LoggerProviderSharedState=void 0;let t=dR(),n=fR();e.LoggerProviderSharedState=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=i,this.processors=a,a.length>0?(this.registeredLogRecordProcessors=a,this.activeProcessor=new n.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new t.NoopLogRecordProcessor}}})),mR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LoggerProvider=e.DEFAULT_LOGGER_NAME=void 0;let t=(Jd(),d(Kd)),n=Li(),r=sR(),i=HL(),a=lR(),o=uR(),s=pR();e.DEFAULT_LOGGER_NAME=`unknown`,e.LoggerProvider=class{_shutdownOnce;_sharedState;constructor(e={}){let t=(0,i.merge)({},(0,o.loadDefaultConfig)(),e),n=e.resource??(0,r.defaultResource)();this._sharedState=new s.LoggerProviderSharedState(n,t.forceFlushTimeoutMillis,(0,o.reconfigureLimits)(t.logRecordLimits),e?.processors??[]),this._shutdownOnce=new i.BindOnceFuture(this._shutdown,this)}getLogger(r,i,o){if(this._shutdownOnce.isCalled)return t.diag.warn(`A shutdown LoggerProvider cannot provide a Logger`),n.NOOP_LOGGER;r||t.diag.warn(`Logger requested without instrumentation scope name.`);let s=r||e.DEFAULT_LOGGER_NAME,c=`${s}@${i||``}:${o?.schemaUrl||``}`;return this._sharedState.loggers.has(c)||this._sharedState.loggers.set(c,new a.Logger({name:s,version:i,schemaUrl:o?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(c)}forceFlush(){return this._shutdownOnce.isCalled?(t.diag.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(t.diag.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),hR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConsoleLogRecordExporter=void 0;let t=HL();e.ConsoleLogRecordExporter=class{export(e,t){this._sendLogRecords(e,t)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:(0,t.hrTimeToMicroseconds)(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes}}_sendLogRecords(e,n){for(let t of e)console.dir(this._exportInfo(t),{depth:3});n?.({code:t.ExportResultCode.SUCCESS})}}})),see=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SimpleLogRecordProcessor=void 0;let t=HL();e.SimpleLogRecordProcessor=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new t.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let n=()=>t.internal._export(this._exporter,[e]).then(e=>{e.code!==t.ExportResultCode.SUCCESS&&(0,t.globalErrorHandler)(e.error??Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(t.globalErrorHandler);if(e.resource.asyncAttributesPending){let r=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(r),n()),t.globalErrorHandler);r!=null&&this._unresolvedExports.add(r)}else n()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),gR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InMemoryLogRecordExporter=void 0;let t=HL();e.InMemoryLogRecordExporter=class{_finishedLogRecords=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:t.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedLogRecords.push(...e),n({code:t.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}}})),cee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessorBase=void 0;let t=(Jd(),d(Kd)),n=HL();e.BatchLogRecordProcessorBase=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,n.getNumberFromEnv)(`OTEL_BLRP_MAX_EXPORT_BATCH_SIZE`)??512,this._maxQueueSize=r?.maxQueueSize??(0,n.getNumberFromEnv)(`OTEL_BLRP_MAX_QUEUE_SIZE`)??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,n.getNumberFromEnv)(`OTEL_BLRP_SCHEDULE_DELAY`)??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,n.getNumberFromEnv)(`OTEL_BLRP_EXPORT_TIMEOUT`)??3e4,this._shutdownOnce=new n.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(t.diag.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<r;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((e,t)=>{(0,n.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(t)})}_maybeStartTimer(){this._timer===void 0&&(this._timer=setTimeout(()=>{this._flushOneBatch().then(()=>{this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{(0,n.globalErrorHandler)(e)})},this._scheduledDelayMillis),(0,n.unrefTimer)(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let t=()=>n.internal._export(this._exporter,e).then(e=>{e.code!==n.ExportResultCode.SUCCESS&&(0,n.globalErrorHandler)(e.error??Error(`BatchLogRecordProcessor: log record export failed (status ${e})`))}).catch(n.globalErrorHandler),r=e.map(e=>e.resource).filter(e=>e.asyncAttributesPending);return r.length===0?t():Promise.all(r.map(e=>e.waitForAsyncAttributes?.())).then(t,n.globalErrorHandler)}}})),lee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessor=void 0;let t=cee();e.BatchLogRecordProcessor=class extends t.BatchLogRecordProcessorBase{onShutdown(){}}})),_R=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessor=void 0;var t=lee();Object.defineProperty(e,`BatchLogRecordProcessor`,{enumerable:!0,get:function(){return t.BatchLogRecordProcessor}})})),vR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessor=void 0;var t=_R();Object.defineProperty(e,`BatchLogRecordProcessor`,{enumerable:!0,get:function(){return t.BatchLogRecordProcessor}})})),yR=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BatchLogRecordProcessor=e.InMemoryLogRecordExporter=e.SimpleLogRecordProcessor=e.ConsoleLogRecordExporter=e.NoopLogRecordProcessor=e.LoggerProvider=void 0;var t=mR();Object.defineProperty(e,`LoggerProvider`,{enumerable:!0,get:function(){return t.LoggerProvider}});var n=dR();Object.defineProperty(e,`NoopLogRecordProcessor`,{enumerable:!0,get:function(){return n.NoopLogRecordProcessor}});var r=hR();Object.defineProperty(e,`ConsoleLogRecordExporter`,{enumerable:!0,get:function(){return r.ConsoleLogRecordExporter}});var i=see();Object.defineProperty(e,`SimpleLogRecordProcessor`,{enumerable:!0,get:function(){return i.SimpleLogRecordProcessor}});var a=gR();Object.defineProperty(e,`InMemoryLogRecordExporter`,{enumerable:!0,get:function(){return a.InMemoryLogRecordExporter}});var o=vR();Object.defineProperty(e,`BatchLogRecordProcessor`,{enumerable:!0,get:function(){return o.BatchLogRecordProcessor}})})),bR=s((e=>{let t=ur(),n=t.__toESM(Ei()),r=t.__toESM(require(`node:async_hooks`)),i=t.__toESM(ie()),a=t.__toESM(Li()),o=t.__toESM(Fc()),s=t.__toESM(require(`node:process`)),c=t.__toESM(require(`node:os`)),l=t.__toESM(require(`node:tty`)),u=t.__toESM(require(`node:crypto`)),f=t.__toESM(uL()),p=t.__toESM(bj()),m=t.__toESM(yR()),h=t.__toESM((PA(),d(NA))),g={DELETE:`delete`,COMMENT_OUT:`comment out`,KEEP:`keep`,SKIP:`skip`},_={GREEN:`Green`,GREY:`Grey`,RED:`Red`,NA:`NA`},v={GREEN:`Green`,GREY:`Grey`,RUNTIME_ERROR:`RuntimeError`},y=function(e){return e.IDE=`IDE`,e.CLI=`CLI`,e}({}),b=function(e){return e.SIBLING_FOLDER=`siblingFolder`,e.ROOT_FOLDER=`rootFolder`,e}({}),x=function(e){return e.JEST=`jest`,e.MOCHA=`mocha`,e.VITEST=`vitest`,e.PYTEST=`pytest`,e}({}),S=function(e){return e.SPEC=`spec`,e.TEST=`test`,e}({}),C=function(e){return e.CAMEL_CASE=`camelCase`,e.KEBAB_CASE=`kebabCase`,e}({}),w=function(e){return e.NONE=`none`,e.CATEGORIES=`categories`,e}({}),T=function(e){return e.NEW_CODE_FILE=`newCodeFile`,e.OVERRIDE_CODE_FILE=`overrideCodeFile`,e}({}),E=function(e){return e.ON=`on`,e.OFF=`off`,e}({}),D={DEFAULT:0,MIN:0,MAX:100},O={DEFAULT:5,MIN:1,MAX:50};n.z.object({rootPath:n.z.string().default(process.cwd()),testStructure:n.z.enum(b).optional(),testFramework:n.z.enum(x).optional(),testSuffix:n.z.enum(S).optional(),testFileName:n.z.enum(C).optional(),calculateCoverage:n.z.enum(E).optional(),coverageThreshold:n.z.number().min(D.MIN).max(D.MAX).default(D.DEFAULT),requestSource:n.z.enum(y).optional(),concurrency:n.z.number().min(O.MIN).max(O.MAX).default(O.DEFAULT),backendURL:n.z.string().optional(),secretToken:n.z.string().optional(),modelName:n.z.string().optional(),context:n.z.object({git:n.z.object({ref_name:n.z.string(),anchorBranch:n.z.string(),compareBranch:n.z.string(),repository:n.z.string(),owner:n.z.string(),sha:n.z.string(),workflowRunId:n.z.string(),remoteUrl:n.z.string(),topLevel:n.z.string()}).partial().optional()}).optional(),testCommand:n.z.string().optional(),coverageCommand:n.z.string().optional(),lintCommand:n.z.string().optional(),prettierCommand:n.z.string().optional(),disableLintRules:n.z.boolean().optional(),ignoreAsAnyLintErrors:n.z.boolean().optional(),includeEarlyTests:n.z.boolean().optional(),greyTestBehaviour:n.z.enum(g).optional(),redTestBehaviour:n.z.enum(g).optional(),keepErrorTests:n.z.boolean().optional(),keepFailedTests:n.z.boolean().optional(),conditionalKeep:n.z.boolean().optional(),continueOnTestErrors:n.z.boolean().optional(),perFunctionTimeout:n.z.number().positive().optional(),dynamicPromptIterations:n.z.number().min(0).max(10).optional(),removeComments:n.z.boolean().optional(),experimentalAgentSdk:n.z.boolean().optional(),compressOutput:n.z.boolean().optional(),agentSdkModel:n.z.string().optional(),agentSdkBudget:n.z.number().positive().optional(),pluginPath:n.z.string().optional(),claudeCodeExecutablePath:n.z.string().optional(),catalogId:n.z.string().optional(),label:n.z.string().optional(),debug:n.z.boolean().optional(),verbose:n.z.boolean().optional(),progressLogger:n.z.custom().optional(),onTokenRefresh:n.z.custom().optional()});var k=`@earlyai/ts-agent`,A=`0.98.0`;let ee={VSCODE:`vscode`,GITHUB_ACTION:`github-action`,UNKNOWN:`unknown`},j=`$early_filename`,te=`npx jest ${j} --no-coverage --silent --json --forceExit --maxWorkers=1`,M=`npx --no eslint ${j}`,N=`npx --no prettier ${j} --write`,P={rootPath:process.cwd(),isSiblingFolderStructured:!0,gitURL:`https://github.com/your-owner/your-repo`,testFramework:x.JEST,greyTestBehaviour:g.DELETE,redTestBehaviour:g.DELETE,keepErrorTests:!1,keepFailedTests:!1,conditionalKeep:!1,continueOnTestErrors:!0,generatedTestStructure:w.CATEGORIES,isRootFolderStructured:!1,clientSource:ee.GITHUB_ACTION,backendURL:`https://api.startearly.ai`,requestSource:y.CLI,userPrompt:``,testLocation:`__tests__`,coverageThreshold:D.DEFAULT,concurrency:5,testFileFormat:`ts`,outputType:T.NEW_CODE_FILE,shouldRefreshCoverage:!0,kebabCaseFileName:!1,earlyTestFilenameSuffix:`.early.${S.TEST}`,testSuffix:S.TEST,isAppendPrompt:!1,dynamicPromptIterations:3,wsServerEndpoint:`wss://api.startearly.ai`,secretToken:``,loggerConfig:{consoleEnabled:!1,azureEnabled:!0,azureConnectionString:`InstrumentationKey=8b9b0d6a-5400-44a3-ada6-3cd026de6cfe;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/;ApplicationId=d6e130b6-4aaa-4dcc-8d26-c1fa25d4656a`},context:void 0,includeEarlyTests:!1,lintCommand:M,prettierCommand:N,disableLintRules:!1,ignoreAsAnyLintErrors:!0,allowUndefinedLintErrors:!0,perFunctionTimeout:42e4,removeComments:!0,experimentalAgentSdk:!1,compressOutput:!1,agentSdkModel:void 0,agentSdkBudget:void 0,debug:!1,verbose:!1},F=e=>{let t=`testFramework.testSuffix.backendURL.requestSource.secretToken.concurrency.coverageThreshold.context.rootPath.testCommand.coverageCommand.lintCommand.prettierCommand.disableLintRules.greyTestBehaviour.redTestBehaviour.keepErrorTests.keepFailedTests.conditionalKeep.continueOnTestErrors.perFunctionTimeout.dynamicPromptIterations.removeComments.experimentalAgentSdk.compressOutput.agentSdkModel.agentSdkBudget.pluginPath.claudeCodeExecutablePath.label.catalogId.debug.verbose.progressLogger.onTokenRefresh`.split(`.`).reduce((t,n)=>(0,i.isDefined)(e[n])?{...t,[n]:e[n]}:t,{}),n={...(0,i.isDefined)(e.testStructure)&&{isSiblingFolderStructured:e.testStructure===b.SIBLING_FOLDER,isRootFolderStructured:e.testStructure===b.ROOT_FOLDER},...(0,i.isDefined)(e.testFileName)&&{kebabCaseFileName:e.testFileName===C.KEBAB_CASE},...(0,i.isDefined)(e.calculateCoverage)&&{shouldRefreshCoverage:e.calculateCoverage===E.ON},...(0,i.isDefined)(e.modelName)&&{fixTestsLLMModelName:e.modelName,generateTestsLLMModelName:e.modelName},...(0,i.isDefined)(e.testSuffix)&&{earlyTestFilenameSuffix:`.early.${e.testSuffix}`},...(0,i.isDefined)(e.requestSource)&&{clientSource:e.requestSource===y.IDE?ee.VSCODE:ee.GITHUB_ACTION}};return{...t,...n}},I=(e=0)=>t=>`\u001B[${t+e}m`,L=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,ne=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,R={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(R.modifier);let z=Object.keys(R.color),re=Object.keys(R.bgColor);[...z,...re];function B(){let e=new Map;for(let[t,n]of Object.entries(R)){for(let[t,r]of Object.entries(n))R[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=R[t],e.set(r[0],r[1]);Object.defineProperty(R,t,{value:n,enumerable:!1})}return Object.defineProperty(R,`codes`,{value:e,enumerable:!1}),R.color.close=`\x1B[39m`,R.bgColor.close=`\x1B[49m`,R.color.ansi=I(),R.color.ansi256=L(),R.color.ansi16m=ne(),R.bgColor.ansi=I(10),R.bgColor.ansi256=L(10),R.bgColor.ansi16m=ne(10),Object.defineProperties(R,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>R.rgbToAnsi256(...R.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>R.ansi256ToAnsi(R.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>R.ansi256ToAnsi(R.hexToAnsi256(e)),enumerable:!1}}),R}var V=B();function ae(e,t=globalThis.Deno?globalThis.Deno.args:s.default.argv){let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}let{env:oe}=s.default,se;ae(`no-color`)||ae(`no-colors`)||ae(`color=false`)||ae(`color=never`)?se=0:(ae(`color`)||ae(`colors`)||ae(`color=true`)||ae(`color=always`))&&(se=1);function ce(){if(`FORCE_COLOR`in oe)return oe.FORCE_COLOR===`true`?1:oe.FORCE_COLOR===`false`?0:oe.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(oe.FORCE_COLOR,10),3)}function le(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ue(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=ce();r!==void 0&&(se=r);let i=n?se:r;if(i===0)return 0;if(n){if(ae(`color=16m`)||ae(`color=full`)||ae(`color=truecolor`))return 3;if(ae(`color=256`))return 2}if(`TF_BUILD`in oe&&`AGENT_NAME`in oe)return 1;if(e&&!t&&i===void 0)return 0;let a=i||0;if(oe.TERM===`dumb`)return a;if(s.default.platform===`win32`){let e=c.default.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in oe)return[`GITHUB_ACTIONS`,`GITEA_ACTIONS`,`CIRCLECI`].some(e=>e in oe)?3:[`TRAVIS`,`APPVEYOR`,`GITLAB_CI`,`BUILDKITE`,`DRONE`].some(e=>e in oe)||oe.CI_NAME===`codeship`?1:a;if(`TEAMCITY_VERSION`in oe)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(oe.TEAMCITY_VERSION)?1:0;if(oe.COLORTERM===`truecolor`||oe.TERM===`xterm-kitty`||oe.TERM===`xterm-ghostty`||oe.TERM===`wezterm`)return 3;if(`TERM_PROGRAM`in oe){let e=Number.parseInt((oe.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(oe.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(oe.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(oe.TERM)||`COLORTERM`in oe?1:a}function de(e,t={}){return le(ue(e,{streamIsTTY:e&&e.isTTY,...t}))}var fe={stdout:de({isTTY:l.default.isatty(1)}),stderr:de({isTTY:l.default.isatty(2)})};function pe(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let i=t.length,a=0,o=``;do o+=e.slice(a,r)+t+n,a=r+i,r=e.indexOf(t,a);while(r!==-1);return o+=e.slice(a),o}function me(e,t,n,r){let i=0,a=``;do{let o=e[r-1]===`\r`;a+=e.slice(i,o?r-1:r)+t+(o?`\r
|
|
119
119
|
`:`
|
|
120
120
|
`)+n,i=r+1,r=e.indexOf(`
|
|
121
121
|
`,i)}while(r!==-1);return a+=e.slice(i),a}let{stdout:he,stderr:ge}=fe,_e=Symbol(`GENERATOR`),ve=Symbol(`STYLER`),ye=Symbol(`IS_EMPTY`),be=[`ansi`,`ansi`,`ansi256`,`ansi16m`],xe=Object.create(null),Se=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let n=he?he.level:0;e.level=t.level===void 0?n:t.level},Ce=e=>{let t=(...e)=>e.join(` `);return Se(t,e),Object.setPrototypeOf(t,we.prototype),t};function we(e){return Ce(e)}Object.setPrototypeOf(we.prototype,Function.prototype);for(let[e,t]of Object.entries(V))xe[e]={get(){let n=Oe(this,De(t.open,t.close,this[ve]),this[ye]);return Object.defineProperty(this,e,{value:n}),n}};xe.visible={get(){let e=Oe(this,this[ve],!0);return Object.defineProperty(this,`visible`,{value:e}),e}};let Te=(e,t,n,...r)=>e===`rgb`?t===`ansi16m`?V[n].ansi16m(...r):t===`ansi256`?V[n].ansi256(V.rgbToAnsi256(...r)):V[n].ansi(V.rgbToAnsi(...r)):e===`hex`?Te(`rgb`,t,n,...V.hexToRgb(...r)):V[n][e](...r);for(let e of[`rgb`,`hex`,`ansi256`]){xe[e]={get(){let{level:t}=this;return function(...n){let r=De(Te(e,be[t],`color`,...n),V.color.close,this[ve]);return Oe(this,r,this[ye])}}};let t=`bg`+e[0].toUpperCase()+e.slice(1);xe[t]={get(){let{level:t}=this;return function(...n){let r=De(Te(e,be[t],`bgColor`,...n),V.bgColor.close,this[ve]);return Oe(this,r,this[ye])}}}}let Ee=Object.defineProperties(()=>{},{...xe,level:{enumerable:!0,get(){return this[_e].level},set(e){this[_e].level=e}}}),De=(e,t,n)=>{let r,i;return n===void 0?(r=e,i=t):(r=n.openAll+e,i=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:n}},Oe=(e,t,n)=>{let r=(...e)=>ke(r,e.length===1?``+e[0]:e.join(` `));return Object.setPrototypeOf(r,Ee),r[_e]=e,r[ve]=t,r[ye]=n,r},ke=(e,t)=>{if(e.level<=0||!t)return e[ye]?``:t;let n=e[ve];if(n===void 0)return t;let{openAll:r,closeAll:i}=n;if(t.includes(`\x1B`))for(;n!==void 0;)t=pe(t,n.close,n.open),n=n.parent;let a=t.indexOf(`
|
|
122
|
-
`);return a!==-1&&(t=me(t,i,r,a)),r+t+i};Object.defineProperties(we.prototype,xe);let Ae=we();we({level:ge?ge.level:0});var je=Ae;let Me=()=>{},Ne={info:Me,verbose:Me,debug:Me},Pe=[je.cyan,je.magenta,je.green,je.blue,je.redBright,je.cyanBright,je.magentaBright,je.greenBright];function Fe(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.codePointAt(n)??0,t=Math.imul(t,16777619);return Pe[Math.abs(t)%Pe.length]}function Ie(e,t){let n=(0,i.isDefined)(t.parentName)?`${t.parentName}.${t.methodName}`:t.methodName,r=Fe(n)(`[${n}]`);return{info:(...t)=>e.info(r,...t),verbose:(...t)=>e.verbose(r,...t),debug:(...t)=>e.debug(r,...t)}}var Le=t.__commonJSMin(((e,t)=>{function n(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Re=t.__commonJSMin(((e,t)=>{function n(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),ze=t.__toESM(Le()),Be=t.__toESM(Re()),Ve,H;let He=class{config;constructor(e,t={}){if(!(0,i.isDefined)(e)){this.config=P;return}let n=F(e);this.config=(0,i.merge)(P,n,t)}getRootPath=()=>this.config.rootPath;isSiblingFolderStructured=()=>this.config.isSiblingFolderStructured;getGitURL=()=>this.config.context?.git?.remoteUrl??this.config.gitURL;getGitTopLevel=()=>this.config.context?.git?.topLevel??this.getRootPath();getTestFramework=()=>this.config.testFramework;getGreyTestBehaviour=()=>this.config.greyTestBehaviour;getRedTestBehaviour=()=>this.config.redTestBehaviour;shouldKeepErrorTests=()=>this.config.keepErrorTests;shouldKeepFailedTests=()=>this.config.keepFailedTests;shouldConditionalKeep=()=>this.config.conditionalKeep;getGeneratedTestStructure=()=>this.config.generatedTestStructure;getGenerateTestsLLMModelName=()=>this.config.generateTestsLLMModelName;isRootFolderStructured=()=>this.config.isRootFolderStructured;getLLMTemperature=()=>this.config.llmTemperature;getLLMTopP=()=>this.config.llmTopP;getClientSource=()=>this.config.clientSource;getBackendURL=()=>this.config.backendURL;getRequestSource=()=>this.config.requestSource;getUserPrompt=()=>this.config.userPrompt;getTestLocation=()=>this.config.testLocation;getCoverageThreshold=()=>this.config.coverageThreshold;getConcurrency=()=>this.config.concurrency;getTestFileFormat=()=>this.config.testFileFormat;getOutputType=()=>this.config.outputType;getShouldRefreshCoverage=()=>this.config.shouldRefreshCoverage;isKebabCaseFileName=()=>this.config.kebabCaseFileName;getEarlyTestFilenameSuffix=()=>this.config.earlyTestFilenameSuffix;getTestSuffix=()=>this.config.testSuffix;getIsAppendPrompt=()=>this.config.isAppendPrompt;getFixTestsLLMModelName=()=>this.config.fixTestsLLMModelName;getDynamicPromptIterations=()=>this.config.dynamicPromptIterations;getWSServerEndpoint=()=>this.config.backendURL.replace(`http://`,`ws://`).replace(`https://`,`wss://`);getAnthropicProxyUrl=()=>new URL(`/anthropic`,this.config.backendURL).href;getSecretToken=()=>this.config.secretToken;getLoggerConfig=()=>this.config.loggerConfig;getContext=()=>this.config.context;getTestCommand=()=>this.config.testCommand;getCoverageCommand=()=>this.config.coverageCommand;getLintCommand=()=>this.config.lintCommand;getPrettierCommand=()=>this.config.prettierCommand;shouldDisableLintRules=()=>this.config.disableLintRules;shouldIgnoreAsAnyLintErrors=()=>this.config.ignoreAsAnyLintErrors;allowUndefinedLintErrors=()=>this.config.allowUndefinedLintErrors;getIncludeEarlyTests=()=>this.config.includeEarlyTests??!1;shouldContinueOnTestErrors=()=>this.config.continueOnTestErrors;getPerFunctionTimeout=()=>this.config.perFunctionTimeout;shouldRemoveComments=()=>this.config.removeComments;getExperimentalAgentSdk=()=>this.config.experimentalAgentSdk;shouldCompressOutput=()=>this.config.compressOutput;getAgentSdkModel=()=>this.config.agentSdkModel;getAgentSdkBudget=()=>this.config.agentSdkBudget;getPluginPath=()=>this.config.pluginPath;getClaudeCodeExecutablePath=()=>this.config.claudeCodeExecutablePath;getLabel=()=>this.config.label;getCatalogId=()=>this.config.catalogId;updateContext=e=>{this.config.context=(0,i.merge)(this.config.context??{},e??{})};updateRootPath=e=>{this.config.rootPath=e};isDebug=()=>this.config.debug??!1;isVerbose=()=>this.config.verbose??!1;getOnTokenRefresh=()=>this.config.onTokenRefresh;getProgressLogger=e=>{let t=this.config.progressLogger??Ne;return(0,i.isDefined)(e)?Ie(t,e):t}};He=(0,Be.default)([(0,o.injectable)(`Singleton`),(0,ze.default)(`design:paramtypes`,[typeof(Ve=typeof Partial<`u`&&Partial)==`function`?Ve:Object,typeof(H=typeof Partial<`u`&&Partial)==`function`?H:Object])],He);var Ue=new o.Container({autobind:!0,defaultScope:`Singleton`});let We=()=>Ue.get(He);var Ge=class{storage=new r.AsyncLocalStorage;isConsoleEnabled;constructor(e){this.isConsoleEnabled=e}orderedFlush={nextOrder:1,pending:new Map};resetOrder(){this.orderedFlush={nextOrder:1,pending:new Map}}async withBufferedPrinting(e,t){let n=[];try{return await this.storage.run(n,e)}finally{this.flushInOrder(t,n)}}printOrBuffer(e,t){let n=this.storage.getStore();if((0,i.isDefined)(n)){n.push({method:e,message:t});return}this.isConsoleEnabled&&console[e](t)}async flushInOrder(e,t){if(this.orderedFlush.nextOrder===e){this.flushBuffer(t),this.orderedFlush.nextOrder++,this.drainPendingFlushes();return}return new Promise(n=>{this.orderedFlush.pending.set(e,{buffer:t,resolve:n})})}drainPendingFlushes(){let e=this.orderedFlush.pending.get(this.orderedFlush.nextOrder);for(;(0,i.isDefined)(e);)this.orderedFlush.pending.delete(this.orderedFlush.nextOrder),this.flushBuffer(e.buffer),this.orderedFlush.nextOrder++,e.resolve(),e=this.orderedFlush.pending.get(this.orderedFlush.nextOrder)}flushBuffer(e){if(this.isConsoleEnabled)for(let t of e)console[t.method](t.message)}};let Ke=function(e){return e.DEFAULT=`default`,e.VERBOSE=`verbose`,e.DEBUG=`debug`,e}({}),qe=function(e){return e.INFO=`info`,e.WARN=`warn`,e}({});function Je(){return(0,u.randomUUID)()}function Ye(){let e=``;for(let t=0;t<8;t++)e+=`abcdefghijklmnopqrstuvwxyz0123456789`.charAt(Math.floor(Math.random()*36));return e}var Xe=t.__toESM(Le()),Ze=t.__toESM(Re()),Qe=class{export(e,t){for(let t of e){let e=t.body;if((0,i.isString)(e))console.info(e);else try{console.info(JSON.stringify(e))}catch{console.info(String(e))}}t({code:0})}shutdown(){return Promise.resolve()}};let $e=class{loggerProvider;config;constructor(e){this.config=e,this.loggerProvider=new m.LoggerProvider({resource:(0,p.resourceFromAttributes)({[h.ATTR_SERVICE_NAME]:k,[h.ATTR_SERVICE_VERSION]:A})}),this.initializeExporters(),this.setGlobalLoggerProvider()}getLogger(e){return this.loggerProvider.getLogger(e)}initializeExporters(){let e=[];if(this.config.consoleEnabled){let t=new Qe;e.push(new m.SimpleLogRecordProcessor(t))}if(this.config.azureEnabled&&(0,i.isDefined)(this.config.azureConnectionString)){let t=new f.AzureMonitorLogExporter({connectionString:this.config.azureConnectionString});e.push(new m.BatchLogRecordProcessor(t))}this.loggerProvider=new m.LoggerProvider({processors:e})}setGlobalLoggerProvider(){a.logs.setGlobalLoggerProvider(this.loggerProvider)}};$e=(0,Ze.default)([(0,o.injectable)(),(0,Xe.default)(`design:paramtypes`,[Object])],$e),t.__toESM(Le()),t.__toESM(Re());let et=new class{storage;otelService;otelLogger;isConsoleEnabled;printBuffer;default=this.createLogObject(Ke.DEFAULT);verbose=this.createLogObject(Ke.VERBOSE);constructor(e){this.storage=new r.AsyncLocalStorage,this.otelService=new $e(e),this.otelLogger=this.otelService.getLogger(`ts-agent`),this.isConsoleEnabled=e.consoleEnabled,this.printBuffer=new Ge(e.consoleEnabled)}resetPrintOrder(){this.printBuffer.resetOrder()}async withBufferedPrinting(e,t){return this.printBuffer.withBufferedPrinting(e,t)}info={startLog:(e,...t)=>this.log(a.SeverityNumber.INFO,`Start ${e}`,...t),endLog:(e,...t)=>this.log(a.SeverityNumber.INFO,`End ${e}`,...t),failedLog:(e,...t)=>this.log(a.SeverityNumber.INFO,`Failed ${e}`,...t),defaultLog:(e,...t)=>this.log(a.SeverityNumber.INFO,e,...t)};debug={startLog:(e,...t)=>this.log(a.SeverityNumber.DEBUG,`Start ${e}`,...t),endLog:(e,...t)=>this.log(a.SeverityNumber.DEBUG,`End ${e}`,...t),failedLog:(e,...t)=>this.log(a.SeverityNumber.DEBUG,`Failed ${e}`,...t),defaultLog:(e,...t)=>this.log(a.SeverityNumber.DEBUG,e,...t)};error(e,t,...n){let r=t instanceof Error?`${e} ${t.message} ${t.stack}`:`${e} ${JSON.stringify(t)}`;this.log(a.SeverityNumber.ERROR,r,...n)}getRequestId(){return this.storage.getStore()?.requestId??``}getTraceId(){return this.storage.getStore()?.traceId??``}log(e,t,...n){let r=this.formatMessage(t,...n);this.logToOpenTelemetry(e,r),!(!this.isConsoleEnabled||!this.isLevelEnabled(Ke.DEBUG))&&console.info(r)}logToOpenTelemetry(e,t){let n=this.storage.getStore(),r={service:k,version:A};(0,i.isDefined)(n)&&((0,i.isDefined)(n.traceId)&&(r.traceId=n.traceId),(0,i.isDefined)(n.requestId)&&(r.requestId=n.requestId),(0,i.isDefined)(n.category)&&(r.category=n.category),(0,i.isDefined)(n.subCategory)&&(r.subCategory=n.subCategory),(0,i.isDefined)(n.testedMethodClass)&&(r.testedMethodClass=n.testedMethodClass),(0,i.isDefined)(n.testedFunction)&&(r.testedFunction=n.testedFunction),(0,i.isDefined)(n.userId)&&(r.userId=n.userId.toString())),this.otelLogger.emit({severityNumber:e,severityText:this.getSeverityText(e),body:t,attributes:r})}getSeverityText(e){switch(e){case a.SeverityNumber.TRACE:return`TRACE`;case a.SeverityNumber.DEBUG:return`DEBUG`;case a.SeverityNumber.INFO:return`INFO`;case a.SeverityNumber.WARN:return`WARN`;case a.SeverityNumber.ERROR:return`ERROR`;case a.SeverityNumber.FATAL:return`FATAL`;default:return`INFO`}}formatMessage(e,...t){let n=this.formatPrefix(),r=(0,i.isDefined)(n)?`${n} ${e}`:e;return this.formatPrint(r,...t)}formatPrint(e,...t){return(0,i.isEmpty)(t)?e:`${e} ${t.map(e=>JSON.stringify(e)).join(` `)}`}withContext=(e,t,n)=>{let r=n.value,i=this.storage;return n.value=function(...e){let t=i.getStore();if(t){let n={...t};return i.run(n,()=>r.apply(this,e))}let n={traceId:Ye(),requestId:Je()};return i.run(n,()=>r.apply(this,e))},n};addContext(e){let t=this.storage.getStore();(0,i.isDefined)(t)&&(t.category=e.category??t.category,t.subCategory=e.subCategory??t.subCategory,t.testedMethodClass=e.testedMethodClass??t.testedMethodClass,t.testedFunction=e.testedFunction??t.testedFunction,t.userId=e.userId??t.userId)}captureContext({withNewRequestId:e=!1}={}){let t=this.storage.getStore();return t?{...t,...e&&{requestId:Je()}}:void 0}async runWithContext(e,t){return(0,i.isDefined)(e)?this.storage.run(e,t):t()}isLevelEnabled(e){switch(e){case Ke.DEFAULT:return!0;case Ke.VERBOSE:return We().isVerbose()||We().isDebug();case Ke.DEBUG:return We().isDebug()}}createLogObject(e){return{info:(t,...n)=>{this.isLevelEnabled(e)&&this.printOrBuffer(qe.INFO,this.formatPrint(t,...n))},warn:(t,...n)=>{this.isLevelEnabled(e)&&this.printOrBuffer(qe.WARN,this.formatPrint(t,...n))}}}printOrBuffer(e,t){this.printBuffer.printOrBuffer(e,t)}formatPrefix(){let e=this.storage.getStore();if(!(0,i.isDefined)(e))return``;let t=[];return(0,i.isDefined)(e.traceId)&&t.push(`[${e.traceId}]`),(0,i.isDefined)(e.requestId)&&t.push(`[${e.requestId}]`),(0,i.isDefined)(e.category)&&t.push(`[${e.category}]`),(0,i.isDefined)(e.subCategory)&&t.push(`[${e.subCategory}]`),(0,i.isDefined)(e.testedMethodClass)&&t.push(`[${e.testedMethodClass}]`),(0,i.isDefined)(e.testedFunction)&&t.push(`[${e.testedFunction}]`),t.join(` `)}}({consoleEnabled:!1,azureEnabled:!0,azureConnectionString:`InstrumentationKey=c18a3332-f844-498f-98e0-d818996cf526;IngestionEndpoint=https://eastus2-3.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus2.livediagnostics.monitor.azure.com/;ApplicationId=2150ffe0-cb0f-4b00-9562-d3385b383d74`});function tt(e){return function(t,n,r){return(0,i.isDefined)(e)&&et.addContext(e),et.withContext(t,n,r)}}let nt={type:`object`,additionalProperties:!1,required:[`flows`,`projectSummary`,`projectType`,`detectedEntryCount`],properties:{flows:{type:`array`,items:{type:`object`}},projectSummary:{type:`string`},projectType:{type:`string`},detectedEntryCount:{type:`number`}}},rt={type:`object`,additionalProperties:!1,required:[`sourceFiles`],properties:{sourceFiles:{type:`array`,items:{type:`string`}}}},it={type:`object`,additionalProperties:!1,required:[`techChanges`,`productChanges`],properties:{techChanges:{type:`array`,items:{type:`object`}},productChanges:{type:`array`,items:{type:`object`}},affectedSteps:{type:`array`,items:{type:`object`}}}},at={type:`object`,additionalProperties:!1,required:[`fileFlowMapping`],properties:{fileFlowMapping:{type:`array`,items:{type:`object`}}}},ot={type:`object`,additionalProperties:!1,required:[`score`,`reasoning`],properties:{score:{type:`integer`,minimum:1,maximum:10},reasoning:{type:`string`},criticalOverride:{type:`boolean`},signalsThatFired:{type:`object`,properties:{bug:{type:`array`,items:{type:`integer`}},intentional:{type:`array`,items:{type:`integer`}}}},changeFromOriginal:{type:`object`,properties:{changed:{type:`boolean`},delta:{type:`integer`},reason:{type:`string`}}}}},st={type:`object`,additionalProperties:!1,required:[`calledModules`],properties:{calledModules:{type:`array`,items:{type:`string`}}}};Object.defineProperty(e,`CATALOG_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,`CONCURRENCY`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,`COVERAGE_THRESHOLD`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,`CalculateCoverageOption`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,`DEFAULT_LINT_COMMAND`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,`DEFAULT_PRETTIER_COMMAND`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,`DEFAULT_TEST_COMMAND`,{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,`DEPENDENCY_TRACER_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return st}}),Object.defineProperty(e,`DESCRIBE_STATUS`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,`EARLY_COVERAGE_DIR`,{enumerable:!0,get:function(){return`$early_coverage_dir`}}),Object.defineProperty(e,`EARLY_FILENAME_VAR`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,`EARLY_TEST_FILES_VAR`,{enumerable:!0,get:function(){return`$early_test_files`}}),Object.defineProperty(e,`FILE_FLOW_MAPPING_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return at}}),Object.defineProperty(e,`GenerateTestsOutputType`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,`GeneratedTestStructure`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,`GlobalConfigService`,{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,`NOOP_PROGRESS_LOGGER`,{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(e,`PRE_FILTER_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return rt}}),Object.defineProperty(e,`REGRESSION_CATALOG_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return 4}}),Object.defineProperty(e,`REGRESSION_CATALOG_MAX_TURNS`,{enumerable:!0,get:function(){return 100}}),Object.defineProperty(e,`REGRESSION_CATALOG_MODEL`,{enumerable:!0,get:function(){return`claude-sonnet-4-6`}}),Object.defineProperty(e,`REGRESSION_CATALOG_TARGET_COUNT`,{enumerable:!0,get:function(){return 20}}),Object.defineProperty(e,`REGRESSION_IMPACT_AGENTIC_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return 2}}),Object.defineProperty(e,`REGRESSION_IMPACT_AGENTIC_MAX_TURNS`,{enumerable:!0,get:function(){return 30}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATION_ENABLED`,{enumerable:!0,get:function(){return!1}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATION_RANGE_MAX`,{enumerable:!0,get:function(){return 8}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATION_RANGE_MIN`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATOR_CONCURRENCY`,{enumerable:!0,get:function(){return 8}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATOR_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return .3}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATOR_MAX_TURNS`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATOR_MODEL`,{enumerable:!0,get:function(){return`claude-sonnet-4-6`}}),Object.defineProperty(e,`REGRESSION_IMPACT_DEEP_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return 1}}),Object.defineProperty(e,`REGRESSION_IMPACT_DEEP_MAX_TURNS`,{enumerable:!0,get:function(){return 25}}),Object.defineProperty(e,`REGRESSION_IMPACT_DEEP_MODEL`,{enumerable:!0,get:function(){return`claude-sonnet-4-6`}}),Object.defineProperty(e,`REGRESSION_IMPACT_HAIKU_MODEL`,{enumerable:!0,get:function(){return`claude-haiku-4-5-20251001`}}),Object.defineProperty(e,`REGRESSION_IMPACT_MAPPING_BATCH_SIZE`,{enumerable:!0,get:function(){return 10}}),Object.defineProperty(e,`REGRESSION_IMPACT_MAPPING_CONCURRENCY`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(e,`REGRESSION_IMPACT_SONNET_MODEL`,{enumerable:!0,get:function(){return`claude-sonnet-4-6`}}),Object.defineProperty(e,`REGRESSION_LOG_COST`,{enumerable:!0,get:function(){return!1}}),Object.defineProperty(e,`REGRESSION_PERMISSION_MODE`,{enumerable:!0,get:function(){return`bypassPermissions`}}),Object.defineProperty(e,`REGRESSION_SAVE_REPORT_FILES`,{enumerable:!0,get:function(){return!1}}),Object.defineProperty(e,`REGRESSION_TRACER_CONCURRENCY`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(e,`REGRESSION_TRACER_ENABLED`,{enumerable:!0,get:function(){return!1}}),Object.defineProperty(e,`REGRESSION_TRACER_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return .5}}),Object.defineProperty(e,`REGRESSION_TRACER_MAX_TURNS`,{enumerable:!0,get:function(){return 30}}),Object.defineProperty(e,`REGRESSION_TRACER_MODEL`,{enumerable:!0,get:function(){return`claude-haiku-4-5-20251001`}}),Object.defineProperty(e,`RequestSource`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,`SONNET_DEEP_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return it}}),Object.defineProperty(e,`TEST_BEHAVIOR`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,`TEST_STATUS`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,`TestFileName`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,`TestFramework`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,`TestStructureVariant`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,`TestSuffix`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,`VERDICT_CALIBRATOR_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,`WithLoggerContext`,{enumerable:!0,get:function(){return tt}}),Object.defineProperty(e,`getGlobalConfig`,{enumerable:!0,get:function(){return We}}),Object.defineProperty(e,`inversify_default`,{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(e,`logger`,{enumerable:!0,get:function(){return et}}),Object.defineProperty(e,`require_decorate`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,`require_decorateMetadata`,{enumerable:!0,get:function(){return Le}}),Object.defineProperty(e,`version`,{enumerable:!0,get:function(){return A}})})),xR=s((e=>{ur().__toESM(require(`@anthropic-ai/claude-agent-sdk`));function t(e){return e.hook_event_name===`PreToolUse`}function n(e){return e.hook_event_name===`PostToolUse`}function r(e){return e.type===`result`}function i(e){return e.subtype!==`success`}function a(e){let t=e.tool_input?.file_path;return typeof t==`string`?t:``}function o(e){let t=e.tool_input?.command;return typeof t==`string`?t:``}let s=/(\u009B|\u001B\[)[0-?]*[ -/]*[@-~]/g;function c(e){return e.replaceAll(s,``)}function l(e){let t=e;return c(((t.stdout??``)+(t.stderr??``)).trim())}function u(e){let t=e;return Array.isArray(t.message?.content)?t.message.content:void 0}function d(e){return e}Object.defineProperty(e,`getExecOutput`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,`getMessageContentBlocks`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,`getSystemInitData`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,`getToolInputCommand`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,`getToolInputFilePath`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,`isErrorResult`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,`isPostToolUseInput`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,`isPreToolUseInput`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,`isResultMessage`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,`stripAnsi`,{enumerable:!0,get:function(){return c}})})),SR=s((e=>{function t(e){return`You are a senior software engineer mapping changed files to the critical flows they affect by tracing import chains. The project type is: ${e}.
|
|
122
|
+
`);return a!==-1&&(t=me(t,i,r,a)),r+t+i};Object.defineProperties(we.prototype,xe);let Ae=we();we({level:ge?ge.level:0});var je=Ae;let Me=()=>{},Ne={info:Me,verbose:Me,debug:Me},Pe=[je.cyan,je.magenta,je.green,je.blue,je.redBright,je.cyanBright,je.magentaBright,je.greenBright];function Fe(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.codePointAt(n)??0,t=Math.imul(t,16777619);return Pe[Math.abs(t)%Pe.length]}function Ie(e,t){let n=(0,i.isDefined)(t.parentName)?`${t.parentName}.${t.methodName}`:t.methodName,r=Fe(n)(`[${n}]`);return{info:(...t)=>e.info(r,...t),verbose:(...t)=>e.verbose(r,...t),debug:(...t)=>e.debug(r,...t)}}var Le=t.__commonJSMin(((e,t)=>{function n(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Re=t.__commonJSMin(((e,t)=>{function n(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),ze=t.__toESM(Le()),Be=t.__toESM(Re()),Ve,H;let He=class{config;constructor(e,t={}){if(!(0,i.isDefined)(e)){this.config=P;return}let n=F(e);this.config=(0,i.merge)(P,n,t)}getRootPath=()=>this.config.rootPath;isSiblingFolderStructured=()=>this.config.isSiblingFolderStructured;getGitURL=()=>this.config.context?.git?.remoteUrl??this.config.gitURL;getGitTopLevel=()=>this.config.context?.git?.topLevel??this.getRootPath();getTestFramework=()=>this.config.testFramework;getGreyTestBehaviour=()=>this.config.greyTestBehaviour;getRedTestBehaviour=()=>this.config.redTestBehaviour;shouldKeepErrorTests=()=>this.config.keepErrorTests;shouldKeepFailedTests=()=>this.config.keepFailedTests;shouldConditionalKeep=()=>this.config.conditionalKeep;getGeneratedTestStructure=()=>this.config.generatedTestStructure;getGenerateTestsLLMModelName=()=>this.config.generateTestsLLMModelName;isRootFolderStructured=()=>this.config.isRootFolderStructured;getLLMTemperature=()=>this.config.llmTemperature;getLLMTopP=()=>this.config.llmTopP;getClientSource=()=>this.config.clientSource;getBackendURL=()=>this.config.backendURL;getRequestSource=()=>this.config.requestSource;getUserPrompt=()=>this.config.userPrompt;getTestLocation=()=>this.config.testLocation;getCoverageThreshold=()=>this.config.coverageThreshold;getConcurrency=()=>this.config.concurrency;getTestFileFormat=()=>this.config.testFileFormat;getOutputType=()=>this.config.outputType;getShouldRefreshCoverage=()=>this.config.shouldRefreshCoverage;isKebabCaseFileName=()=>this.config.kebabCaseFileName;getEarlyTestFilenameSuffix=()=>this.config.earlyTestFilenameSuffix;getTestSuffix=()=>this.config.testSuffix;getIsAppendPrompt=()=>this.config.isAppendPrompt;getFixTestsLLMModelName=()=>this.config.fixTestsLLMModelName;getDynamicPromptIterations=()=>this.config.dynamicPromptIterations;getWSServerEndpoint=()=>this.config.backendURL.replace(`http://`,`ws://`).replace(`https://`,`wss://`);getAnthropicProxyUrl=()=>new URL(`/anthropic`,this.config.backendURL).href;getSecretToken=()=>this.config.secretToken;getLoggerConfig=()=>this.config.loggerConfig;getContext=()=>this.config.context;getTestCommand=()=>this.config.testCommand;getCoverageCommand=()=>this.config.coverageCommand;getLintCommand=()=>this.config.lintCommand;getPrettierCommand=()=>this.config.prettierCommand;shouldDisableLintRules=()=>this.config.disableLintRules;shouldIgnoreAsAnyLintErrors=()=>this.config.ignoreAsAnyLintErrors;allowUndefinedLintErrors=()=>this.config.allowUndefinedLintErrors;getIncludeEarlyTests=()=>this.config.includeEarlyTests??!1;shouldContinueOnTestErrors=()=>this.config.continueOnTestErrors;getPerFunctionTimeout=()=>this.config.perFunctionTimeout;shouldRemoveComments=()=>this.config.removeComments;getExperimentalAgentSdk=()=>this.config.experimentalAgentSdk;shouldCompressOutput=()=>this.config.compressOutput;getAgentSdkModel=()=>this.config.agentSdkModel;getAgentSdkBudget=()=>this.config.agentSdkBudget;getPluginPath=()=>this.config.pluginPath;getClaudeCodeExecutablePath=()=>this.config.claudeCodeExecutablePath;getLabel=()=>this.config.label;getCatalogId=()=>this.config.catalogId;updateContext=e=>{this.config.context=(0,i.merge)(this.config.context??{},e??{})};updateRootPath=e=>{this.config.rootPath=e};isDebug=()=>this.config.debug??!1;isVerbose=()=>this.config.verbose??!1;getOnTokenRefresh=()=>this.config.onTokenRefresh;getProgressLogger=e=>{let t=this.config.progressLogger??Ne;return(0,i.isDefined)(e)?Ie(t,e):t}};He=(0,Be.default)([(0,o.injectable)(`Singleton`),(0,ze.default)(`design:paramtypes`,[typeof(Ve=typeof Partial<`u`&&Partial)==`function`?Ve:Object,typeof(H=typeof Partial<`u`&&Partial)==`function`?H:Object])],He);var Ue=new o.Container({autobind:!0,defaultScope:`Singleton`});let We=()=>Ue.get(He);var Ge=class{storage=new r.AsyncLocalStorage;isConsoleEnabled;constructor(e){this.isConsoleEnabled=e}orderedFlush={nextOrder:1,pending:new Map};resetOrder(){this.orderedFlush={nextOrder:1,pending:new Map}}async withBufferedPrinting(e,t){let n=[];try{return await this.storage.run(n,e)}finally{this.flushInOrder(t,n)}}printOrBuffer(e,t){let n=this.storage.getStore();if((0,i.isDefined)(n)){n.push({method:e,message:t});return}this.isConsoleEnabled&&console[e](t)}async flushInOrder(e,t){if(this.orderedFlush.nextOrder===e){this.flushBuffer(t),this.orderedFlush.nextOrder++,this.drainPendingFlushes();return}return new Promise(n=>{this.orderedFlush.pending.set(e,{buffer:t,resolve:n})})}drainPendingFlushes(){let e=this.orderedFlush.pending.get(this.orderedFlush.nextOrder);for(;(0,i.isDefined)(e);)this.orderedFlush.pending.delete(this.orderedFlush.nextOrder),this.flushBuffer(e.buffer),this.orderedFlush.nextOrder++,e.resolve(),e=this.orderedFlush.pending.get(this.orderedFlush.nextOrder)}flushBuffer(e){if(this.isConsoleEnabled)for(let t of e)console[t.method](t.message)}};let Ke=function(e){return e.DEFAULT=`default`,e.VERBOSE=`verbose`,e.DEBUG=`debug`,e}({}),qe=function(e){return e.INFO=`info`,e.WARN=`warn`,e}({});function Je(){return(0,u.randomUUID)()}function Ye(){let e=``;for(let t=0;t<8;t++)e+=`abcdefghijklmnopqrstuvwxyz0123456789`.charAt(Math.floor(Math.random()*36));return e}var Xe=t.__toESM(Le()),Ze=t.__toESM(Re()),Qe=class{export(e,t){for(let t of e){let e=t.body;if((0,i.isString)(e))console.info(e);else try{console.info(JSON.stringify(e))}catch{console.info(String(e))}}t({code:0})}shutdown(){return Promise.resolve()}};let $e=class{loggerProvider;config;constructor(e){this.config=e,this.loggerProvider=new m.LoggerProvider({resource:(0,p.resourceFromAttributes)({[h.ATTR_SERVICE_NAME]:k,[h.ATTR_SERVICE_VERSION]:A})}),this.initializeExporters(),this.setGlobalLoggerProvider()}getLogger(e){return this.loggerProvider.getLogger(e)}initializeExporters(){let e=[];if(this.config.consoleEnabled){let t=new Qe;e.push(new m.SimpleLogRecordProcessor(t))}if(this.config.azureEnabled&&(0,i.isDefined)(this.config.azureConnectionString)){let t=new f.AzureMonitorLogExporter({connectionString:this.config.azureConnectionString});e.push(new m.BatchLogRecordProcessor(t))}this.loggerProvider=new m.LoggerProvider({processors:e})}setGlobalLoggerProvider(){a.logs.setGlobalLoggerProvider(this.loggerProvider)}};$e=(0,Ze.default)([(0,o.injectable)(),(0,Xe.default)(`design:paramtypes`,[Object])],$e),t.__toESM(Le()),t.__toESM(Re());let et=new class{storage;otelService;otelLogger;isConsoleEnabled;printBuffer;default=this.createLogObject(Ke.DEFAULT);verbose=this.createLogObject(Ke.VERBOSE);constructor(e){this.storage=new r.AsyncLocalStorage,this.otelService=new $e(e),this.otelLogger=this.otelService.getLogger(`ts-agent`),this.isConsoleEnabled=e.consoleEnabled,this.printBuffer=new Ge(e.consoleEnabled)}resetPrintOrder(){this.printBuffer.resetOrder()}async withBufferedPrinting(e,t){return this.printBuffer.withBufferedPrinting(e,t)}info={startLog:(e,...t)=>this.log(a.SeverityNumber.INFO,`Start ${e}`,...t),endLog:(e,...t)=>this.log(a.SeverityNumber.INFO,`End ${e}`,...t),failedLog:(e,...t)=>this.log(a.SeverityNumber.INFO,`Failed ${e}`,...t),defaultLog:(e,...t)=>this.log(a.SeverityNumber.INFO,e,...t)};debug={startLog:(e,...t)=>this.log(a.SeverityNumber.DEBUG,`Start ${e}`,...t),endLog:(e,...t)=>this.log(a.SeverityNumber.DEBUG,`End ${e}`,...t),failedLog:(e,...t)=>this.log(a.SeverityNumber.DEBUG,`Failed ${e}`,...t),defaultLog:(e,...t)=>this.log(a.SeverityNumber.DEBUG,e,...t)};error(e,t,...n){let r=t instanceof Error?`${e} ${t.message} ${t.stack}`:`${e} ${JSON.stringify(t)}`;this.log(a.SeverityNumber.ERROR,r,...n)}getRequestId(){return this.storage.getStore()?.requestId??``}getTraceId(){return this.storage.getStore()?.traceId??``}log(e,t,...n){let r=this.formatMessage(t,...n);this.logToOpenTelemetry(e,r),!(!this.isConsoleEnabled||!this.isLevelEnabled(Ke.DEBUG))&&console.info(r)}logToOpenTelemetry(e,t){let n=this.storage.getStore(),r={service:k,version:A};(0,i.isDefined)(n)&&((0,i.isDefined)(n.traceId)&&(r.traceId=n.traceId),(0,i.isDefined)(n.requestId)&&(r.requestId=n.requestId),(0,i.isDefined)(n.category)&&(r.category=n.category),(0,i.isDefined)(n.subCategory)&&(r.subCategory=n.subCategory),(0,i.isDefined)(n.testedMethodClass)&&(r.testedMethodClass=n.testedMethodClass),(0,i.isDefined)(n.testedFunction)&&(r.testedFunction=n.testedFunction),(0,i.isDefined)(n.userId)&&(r.userId=n.userId.toString())),this.otelLogger.emit({severityNumber:e,severityText:this.getSeverityText(e),body:t,attributes:r})}getSeverityText(e){switch(e){case a.SeverityNumber.TRACE:return`TRACE`;case a.SeverityNumber.DEBUG:return`DEBUG`;case a.SeverityNumber.INFO:return`INFO`;case a.SeverityNumber.WARN:return`WARN`;case a.SeverityNumber.ERROR:return`ERROR`;case a.SeverityNumber.FATAL:return`FATAL`;default:return`INFO`}}formatMessage(e,...t){let n=this.formatPrefix(),r=(0,i.isDefined)(n)?`${n} ${e}`:e;return this.formatPrint(r,...t)}formatPrint(e,...t){return(0,i.isEmpty)(t)?e:`${e} ${t.map(e=>JSON.stringify(e)).join(` `)}`}withContext=(e,t,n)=>{let r=n.value,i=this.storage;return n.value=function(...e){let t=i.getStore();if(t){let n={...t};return i.run(n,()=>r.apply(this,e))}let n={traceId:Ye(),requestId:Je()};return i.run(n,()=>r.apply(this,e))},n};addContext(e){let t=this.storage.getStore();(0,i.isDefined)(t)&&(t.category=e.category??t.category,t.subCategory=e.subCategory??t.subCategory,t.testedMethodClass=e.testedMethodClass??t.testedMethodClass,t.testedFunction=e.testedFunction??t.testedFunction,t.userId=e.userId??t.userId)}captureContext({withNewRequestId:e=!1}={}){let t=this.storage.getStore();return t?{...t,...e&&{requestId:Je()}}:void 0}async runWithContext(e,t){return(0,i.isDefined)(e)?this.storage.run(e,t):t()}isLevelEnabled(e){switch(e){case Ke.DEFAULT:return!0;case Ke.VERBOSE:return We().isVerbose()||We().isDebug();case Ke.DEBUG:return We().isDebug()}}createLogObject(e){return{info:(t,...n)=>{this.isLevelEnabled(e)&&this.printOrBuffer(qe.INFO,this.formatPrint(t,...n))},warn:(t,...n)=>{this.isLevelEnabled(e)&&this.printOrBuffer(qe.WARN,this.formatPrint(t,...n))}}}printOrBuffer(e,t){this.printBuffer.printOrBuffer(e,t)}formatPrefix(){let e=this.storage.getStore();if(!(0,i.isDefined)(e))return``;let t=[];return(0,i.isDefined)(e.traceId)&&t.push(`[${e.traceId}]`),(0,i.isDefined)(e.requestId)&&t.push(`[${e.requestId}]`),(0,i.isDefined)(e.category)&&t.push(`[${e.category}]`),(0,i.isDefined)(e.subCategory)&&t.push(`[${e.subCategory}]`),(0,i.isDefined)(e.testedMethodClass)&&t.push(`[${e.testedMethodClass}]`),(0,i.isDefined)(e.testedFunction)&&t.push(`[${e.testedFunction}]`),t.join(` `)}}({consoleEnabled:!1,azureEnabled:!0,azureConnectionString:`InstrumentationKey=c18a3332-f844-498f-98e0-d818996cf526;IngestionEndpoint=https://eastus2-3.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus2.livediagnostics.monitor.azure.com/;ApplicationId=2150ffe0-cb0f-4b00-9562-d3385b383d74`});function tt(e){return function(t,n,r){return(0,i.isDefined)(e)&&et.addContext(e),et.withContext(t,n,r)}}let nt={type:`object`,additionalProperties:!1,required:[`flows`,`projectSummary`,`projectType`,`detectedEntryCount`],properties:{flows:{type:`array`,items:{type:`object`}},projectSummary:{type:`string`},projectType:{type:`string`},detectedEntryCount:{type:`number`}}},rt={type:`object`,additionalProperties:!1,required:[`sourceFiles`],properties:{sourceFiles:{type:`array`,items:{type:`string`}}}},it={type:`object`,additionalProperties:!1,required:[`techChanges`,`productChanges`],properties:{techChanges:{type:`array`,items:{type:`object`}},productChanges:{type:`array`,items:{type:`object`}},affectedSteps:{type:`array`,items:{type:`object`}}}},at={type:`object`,additionalProperties:!1,required:[`fileFlowMapping`],properties:{fileFlowMapping:{type:`array`,items:{type:`object`}}}},ot={type:`object`,additionalProperties:!1,required:[`score`,`reasoning`],properties:{score:{type:`integer`,minimum:1,maximum:10},reasoning:{type:`string`},criticalOverride:{type:`boolean`},signalsThatFired:{type:`object`,properties:{bug:{type:`array`,items:{type:`integer`}},intentional:{type:`array`,items:{type:`integer`}}}},changeFromOriginal:{type:`object`,properties:{changed:{type:`boolean`},delta:{type:`integer`},reason:{type:`string`}}}}},st={type:`object`,additionalProperties:!1,required:[`calledModules`],properties:{calledModules:{type:`array`,items:{type:`string`}}}};Object.defineProperty(e,`CATALOG_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,`CONCURRENCY`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,`COVERAGE_THRESHOLD`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,`CalculateCoverageOption`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,`DEFAULT_LINT_COMMAND`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,`DEFAULT_PRETTIER_COMMAND`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,`DEFAULT_TEST_COMMAND`,{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,`DEPENDENCY_TRACER_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return st}}),Object.defineProperty(e,`DESCRIBE_STATUS`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,`EARLY_COVERAGE_DIR`,{enumerable:!0,get:function(){return`$early_coverage_dir`}}),Object.defineProperty(e,`EARLY_FILENAME_VAR`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,`EARLY_TEST_FILES_VAR`,{enumerable:!0,get:function(){return`$early_test_files`}}),Object.defineProperty(e,`FILE_FLOW_MAPPING_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return at}}),Object.defineProperty(e,`GenerateTestsOutputType`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,`GeneratedTestStructure`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,`GlobalConfigService`,{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,`NOOP_PROGRESS_LOGGER`,{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(e,`PRE_FILTER_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return rt}}),Object.defineProperty(e,`REGRESSION_CATALOG_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return 4}}),Object.defineProperty(e,`REGRESSION_CATALOG_MAX_TURNS`,{enumerable:!0,get:function(){return 100}}),Object.defineProperty(e,`REGRESSION_CATALOG_MODEL`,{enumerable:!0,get:function(){return`claude-sonnet-4-6`}}),Object.defineProperty(e,`REGRESSION_CATALOG_TARGET_COUNT`,{enumerable:!0,get:function(){return 20}}),Object.defineProperty(e,`REGRESSION_IMPACT_AGENTIC_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return 2}}),Object.defineProperty(e,`REGRESSION_IMPACT_AGENTIC_MAX_TURNS`,{enumerable:!0,get:function(){return 30}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATION_ENABLED`,{enumerable:!0,get:function(){return!1}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATION_RANGE_MAX`,{enumerable:!0,get:function(){return 8}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATION_RANGE_MIN`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATOR_CONCURRENCY`,{enumerable:!0,get:function(){return 8}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATOR_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return .3}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATOR_MAX_TURNS`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(e,`REGRESSION_IMPACT_CALIBRATOR_MODEL`,{enumerable:!0,get:function(){return`claude-sonnet-4-6`}}),Object.defineProperty(e,`REGRESSION_IMPACT_DEEP_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return 1}}),Object.defineProperty(e,`REGRESSION_IMPACT_DEEP_MAX_TURNS`,{enumerable:!0,get:function(){return 25}}),Object.defineProperty(e,`REGRESSION_IMPACT_DEEP_MODEL`,{enumerable:!0,get:function(){return`claude-sonnet-4-6`}}),Object.defineProperty(e,`REGRESSION_IMPACT_HAIKU_MODEL`,{enumerable:!0,get:function(){return`claude-haiku-4-5-20251001`}}),Object.defineProperty(e,`REGRESSION_IMPACT_MAPPING_BATCH_SIZE`,{enumerable:!0,get:function(){return 10}}),Object.defineProperty(e,`REGRESSION_IMPACT_MAPPING_CONCURRENCY`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(e,`REGRESSION_IMPACT_SONNET_MODEL`,{enumerable:!0,get:function(){return`claude-sonnet-4-6`}}),Object.defineProperty(e,`REGRESSION_LOG_COST`,{enumerable:!0,get:function(){return!1}}),Object.defineProperty(e,`REGRESSION_PERMISSION_MODE`,{enumerable:!0,get:function(){return`bypassPermissions`}}),Object.defineProperty(e,`REGRESSION_SAVE_REPORT_FILES`,{enumerable:!0,get:function(){return!1}}),Object.defineProperty(e,`REGRESSION_TRACER_CONCURRENCY`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(e,`REGRESSION_TRACER_ENABLED`,{enumerable:!0,get:function(){return!1}}),Object.defineProperty(e,`REGRESSION_TRACER_MAX_BUDGET_USD`,{enumerable:!0,get:function(){return .5}}),Object.defineProperty(e,`REGRESSION_TRACER_MAX_TURNS`,{enumerable:!0,get:function(){return 30}}),Object.defineProperty(e,`REGRESSION_TRACER_MODEL`,{enumerable:!0,get:function(){return`claude-haiku-4-5-20251001`}}),Object.defineProperty(e,`RequestSource`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,`SONNET_DEEP_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return it}}),Object.defineProperty(e,`TEST_BEHAVIOR`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,`TEST_STATUS`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,`TestFileName`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,`TestFramework`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,`TestStructureVariant`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,`TestSuffix`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,`VERDICT_CALIBRATOR_OUTPUT_SCHEMA`,{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,`WithLoggerContext`,{enumerable:!0,get:function(){return tt}}),Object.defineProperty(e,`getGlobalConfig`,{enumerable:!0,get:function(){return We}}),Object.defineProperty(e,`inversify_default`,{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(e,`logger`,{enumerable:!0,get:function(){return et}}),Object.defineProperty(e,`require_decorate`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,`require_decorateMetadata`,{enumerable:!0,get:function(){return Le}}),Object.defineProperty(e,`version`,{enumerable:!0,get:function(){return A}})})),xR=s((e=>{ur().__toESM(require(`@anthropic-ai/claude-agent-sdk`));function t(e){return e.hook_event_name===`PreToolUse`}function n(e){return e.hook_event_name===`PostToolUse`}function r(e){return e.type===`result`}function i(e){return e.subtype!==`success`}function a(e){let t=e.tool_input?.file_path;return typeof t==`string`?t:``}function o(e){let t=e.tool_input?.command;return typeof t==`string`?t:``}let s=/(\u009B|\u001B\[)[0-?]*[ -/]*[@-~]/g;function c(e){return e.replaceAll(s,``)}function l(e){let t=e;return c(((t.stdout??``)+(t.stderr??``)).trim())}function u(e){let t=e;return Array.isArray(t.message?.content)?t.message.content:void 0}function d(e){return e}Object.defineProperty(e,`getExecOutput`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,`getMessageContentBlocks`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,`getSystemInitData`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,`getToolInputCommand`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,`getToolInputFilePath`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,`isErrorResult`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,`isPostToolUseInput`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,`isPreToolUseInput`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,`isResultMessage`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,`stripAnsi`,{enumerable:!0,get:function(){return c}})})),SR=s((e=>{function t(e){return`You are a senior software engineer mapping changed files to the critical flows they affect by tracing dependency chains. The project type is: ${e}.
|
|
123
123
|
|
|
124
124
|
## Your task:
|
|
125
|
-
For each changed file, determine which flows it belongs to by tracing the
|
|
125
|
+
For each changed file, determine which flows it belongs to by tracing the reference chain from the file UP to each flow's entry files.
|
|
126
126
|
|
|
127
127
|
## How to trace:
|
|
128
|
-
1. For each changed file, use Grep to find which files
|
|
129
|
-
2. Follow the
|
|
128
|
+
1. For each changed file, use Grep to find which files reference it — use the syntax appropriate for this project's language and ecosystem (imports / requires / using / include / use / package references — whatever this project uses)
|
|
129
|
+
2. Follow the reference chain upward until you reach a flow's entryFiles
|
|
130
130
|
3. If the chain reaches a flow's entry file — that file affects that flow
|
|
131
131
|
4. A file can affect multiple flows
|
|
132
132
|
5. A file can affect zero flows (not connected to any cataloged flow)
|
|
@@ -135,16 +135,16 @@ For each changed file, determine which flows it belongs to by tracing the import
|
|
|
135
135
|
- Do NOT use \`find\` commands — use Glob to locate files
|
|
136
136
|
- Do NOT spawn sub-agents (Task tool) — read files directly with Read/Grep/Glob
|
|
137
137
|
- Use the Read tool to read files, not Bash with cat
|
|
138
|
-
- Be thorough — trace at least 3 levels of
|
|
138
|
+
- Be thorough — trace at least 3 levels of references
|
|
139
139
|
- Batch grep commands where possible for efficiency
|
|
140
140
|
|
|
141
|
-
Output your result in this shape:
|
|
141
|
+
Output your result in this shape (the path/extension below is a placeholder — emit the actual paths from this project):
|
|
142
142
|
{
|
|
143
143
|
"fileFlowMapping": [
|
|
144
144
|
{
|
|
145
|
-
"file": "relative/path/to/changed-file.
|
|
145
|
+
"file": "<relative/path/to/changed-file.ext>",
|
|
146
146
|
"flowIds": ["flowId-1", "flowId-2"],
|
|
147
|
-
"reason": "brief explanation of the
|
|
147
|
+
"reason": "brief explanation of the reference chain"
|
|
148
148
|
}
|
|
149
149
|
]
|
|
150
150
|
}
|
|
@@ -250,11 +250,11 @@ ${a}`}function r(){return`You are a senior software engineer tracing how a code
|
|
|
250
250
|
|
|
251
251
|
## Output format
|
|
252
252
|
|
|
253
|
-
Output your result in this shape:
|
|
253
|
+
Output your result in this shape (paths in the example are placeholders — emit the actual relative paths from this project, with this project's real file extensions):
|
|
254
254
|
{
|
|
255
255
|
"techChanges": [
|
|
256
256
|
{
|
|
257
|
-
"file": "relative/path/to/changed-file.
|
|
257
|
+
"file": "<relative/path/to/changed-file.ext>",
|
|
258
258
|
"confidence": "high|low",
|
|
259
259
|
"techBefore": "technical: what the function/file did before the change (for developers)",
|
|
260
260
|
"techAfter": "technical: what the function/file does after the change (for developers)"
|
|
@@ -469,12 +469,12 @@ Apply the strict scoring rules from the system prompt. Re-score this productChan
|
|
|
469
469
|
Output the JSON described in the system prompt. No prose outside the JSON.`}Object.defineProperty(e,`PRE_FILTER_SYSTEM_PROMPT`,{enumerable:!0,get:function(){return`You classify file paths as SOURCE or NON_SOURCE.
|
|
470
470
|
|
|
471
471
|
NON_SOURCE: tests, test helpers, test fixtures, config files, migration files, lock files, documentation, build artifacts, IDE settings, CI configs.
|
|
472
|
-
SOURCE: everything else — application code, services,
|
|
472
|
+
SOURCE: everything else — application code in any language (handlers, services, models, modules, utilities, types, data structures, headers, etc.).
|
|
473
473
|
|
|
474
474
|
Output a JSON object with a single "sourceFiles" array containing ONLY the SOURCE file paths.
|
|
475
475
|
|
|
476
|
-
Example:
|
|
477
|
-
{"sourceFiles": ["
|
|
476
|
+
Example (paths are illustrative — use this project's actual paths and file extensions):
|
|
477
|
+
{"sourceFiles": ["<path/to/auth/service.ext>", "<path/to/payments/handler.ext>"]}`}}),Object.defineProperty(e,`buildFileToFlowMappingPrompt`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,`buildFileToFlowMappingSystemPrompt`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,`buildSonnetDeepPrompt`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,`buildSonnetDeepSystemPrompt`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,`buildVerdictCalibratorPrompt`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,`buildVerdictCalibratorSystemPrompt`,{enumerable:!0,get:function(){return a}})})),CR=s((e=>{var t=`2.0.1`,n,r,i,a,o,s,c,l,u,d,f,p=[].slice,m=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},h={}.hasOwnProperty;for(l in c=require(`path`),i=function(e){return typeof e==`function`},a=function(e){return typeof e==`string`||!!e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object String]`},f=e,f.VERSION=t??`NO-VERSION`,d=function(e){return e=e.replace(/\\/g,`/`),e=e.replace(/(?<!^)\/+/g,`/`),e},c)u=c[l],i(u)?f[l]=function(e){return function(){var t=1<=arguments.length?p.call(arguments,0):[],n;return t=t.map(function(e){return a(e)?d(e):e}),n=c[e].apply(c,t),a(n)?d(n):n}}(l):f[l]=u;for(s in f.sep=`/`,r={toUnix:d,normalizeSafe:function(e){var t;return e=d(e),t=f.normalize(e),e.startsWith(`./`)&&!t.startsWith(`./`)&&!t.startsWith(`..`)?t=`./`+t:e.startsWith(`//`)&&!t.startsWith(`//`)&&(t=e.startsWith(`//./`)?`//.`+t:`/`+t),t},normalizeTrim:function(e){return e=f.normalizeSafe(e),e.endsWith(`/`)?e.slice(0,+(e.length-2)+1||9e9):e},joinSafe:function(){var e=1<=arguments.length?p.call(arguments,0):[],t,n=f.join.apply(null,e);return e.length>0&&(t=d(e[0]),t.startsWith(`./`)&&!n.startsWith(`./`)&&!n.startsWith(`..`)?n=`./`+n:t.startsWith(`//`)&&!n.startsWith(`//`)&&(n=t.startsWith(`//./`)?`//.`+n:`/`+n)),n},addExt:function(e,t){return t?(t[0]!==`.`&&(t=`.`+t),e+(e.endsWith(t)?``:t)):e},trimExt:function(e,t,n){var r;return n??=7,r=f.extname(e),o(r,t,n)?e.slice(0,+(e.length-r.length-1)+1||9e9):e},removeExt:function(e,t){return t?(t=t[0]===`.`?t:`.`+t,f.extname(e)===t?f.trimExt(e,[],t.length):e):e},changeExt:function(e,t,n,r){return r??=7,f.trimExt(e,n,r)+(t?t[0]===`.`?t:`.`+t:``)},defaultExt:function(e,t,n,r){var i;return r??=7,i=f.extname(e),o(i,n,r)?e:f.addExt(e,t)}},o=function(e,t,n){return t??=[],e&&e.length<=n&&m.call(t.map(function(e){return(e&&e[0]!==`.`?`.`:``)+e}),e)<0},r)if(h.call(r,s)){if(n=r[s],f[s]!==void 0)throw Error(`path.`+s+` already exists.`);f[s]=n}})),wR=s(((e,t)=>{
|
|
478
478
|
/*!
|
|
479
479
|
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
480
480
|
*
|
|
@@ -32737,11 +32737,11 @@ Start the workflow now with Phase 0 (read the provided project commands), then p
|
|
|
32737
32737
|
`).filter(e=>e.length>0):[]}catch{return[]}}function Qm(e,t,n){let r={cwd:e,encoding:`utf8`,timeout:1e4};try{return n?(0,g.execSync)(`git config user.email`,r).trim():(0,g.execSync)(`git log -1 --format=%ae ${t}`,r).trim()}catch{return``}}function $m(e,t,n){let r={cwd:e,encoding:`utf8`,timeout:1e4};try{let e=(0,g.execSync)(`git log -1 --format=%ci ${n} -- "${t}"`,r).trim();return e.length===0?0:Math.floor((Date.now()-new Date(e).getTime())/(1e3*60*60*24))}catch{return 0}}function eh(e,t,n,r){let i={cwd:e,encoding:`utf8`,timeout:1e4};try{let e=(0,g.execSync)(`git log --oneline --since="90 days ago" ${n} ${r} -- "${t}"`,i).trim();return e.length===0?0:e.split(`
|
|
32738
32738
|
`).length}catch{return 0}}function th(e,t,r,i,a){let o=i!==void 0&&i.length>0,s=o?i:a;o||n.logger.info.defaultLog(`[regression-impact] anchorSha missing — git signals computed against branch '${a}' (may include commits past catalog snapshot)`);let c={};for(let n of t){let t=r.length>0?`--author="${r}"`:``;c[n]={fileAgeDays:$m(e,n,s),authorCommits:r.length>0?eh(e,n,s,t):0,bugFixCommits:eh(e,n,s,`--grep="fix:"`),revertCommits:eh(e,n,s,`--grep="revert"`)}}return c}function nh(e,t){let{name:n,flowType:r,entryPoints:i,importanceReason:a,description:o,trace:s,scoring:c}=e,l=c===void 0?[]:[``,`**Scoring:**`,`- Risk Score: ${c.riskScore} — ${c.riskReason}`,`- Blast Radius: ${c.blastRadius} — ${c.blastReason}`,`- Final Score: ${c.finalScore}`],u=e.productFlow===void 0?[]:[``,`**Product Flow:**`,`- **Trigger:** ${e.productFlow.trigger}`,...e.productFlow.steps.map((e,t)=>`- ${t+1}. **${e.actor}** → ${e.action} → _${e.outcome}_`),`- **Outcome:** ${e.productFlow.outcome}`];return[`### ${t+1}. ${n} (${r})`,`**Entry points:** ${i.join(`, `)||`none`}`,`**Why important:** ${a}`,`**Description:** ${o}`,...u,``,`**Trace:**`,`- Entry files: ${s.entryFiles.join(`, `)||`none`}`,`- Entry symbols: ${s.entrySymbols.join(`, `)||`none`}`,`- Called modules: ${s.calledModules.join(`, `)||`none`}`,...l,``,`**Code snippet:**`,"```",s.codeSnippet??`(empty)`,"```"].join(`
|
|
32739
32739
|
`)}function rh(e){return[`## Flow Identity Reconciliation`,``,`| Category | Count | Flow IDs |`,`|---|---|---|`,`| ✅ Kept | ${e.kept.length} | ${e.kept.join(`, `)||`—`} |`,`| 🔁 Revived | ${e.revived.length} | ${e.revived.join(`, `)||`—`} |`,`| 🆕 Added | ${e.added.length} | ${e.added.join(`, `)||`—`} |`,`| ❌ Gone | ${e.gone.length} | ${e.gone.join(`, `)||`—`} |`].join(`
|
|
32740
|
-
`)}function ih(e,t,r,i,a,o,s){(0,p.mkdirSync)(e,{recursive:!0});let
|
|
32740
|
+
`)}function ih(e,t,r,i,a,o,s,l){(0,p.mkdirSync)(e,{recursive:!0});let u=new Date().toISOString().replaceAll(/[:.]/g,`-`),d=j.default.basename(t),f=`${u}-${d}.md`,m=j.default.join(e,f),h=i.flows.map((e,t)=>nh(e,t)).join(`
|
|
32741
32741
|
|
|
32742
32742
|
---
|
|
32743
32743
|
|
|
32744
|
-
`),
|
|
32744
|
+
`),g=`# Regression Catalog Report: ${t}
|
|
32745
32745
|
|
|
32746
32746
|
**Date:** ${new Date().toISOString()}
|
|
32747
32747
|
**Anchor branch:** ${r}
|
|
@@ -32749,21 +32749,22 @@ Start the workflow now with Phase 0 (read the provided project commands), then p
|
|
|
32749
32749
|
**Project summary:** ${i.projectSummary}
|
|
32750
32750
|
**Detected entry count:** ${i.detectedEntryCount}
|
|
32751
32751
|
**Cost:** $${a?.toFixed(4)??`unknown`}
|
|
32752
|
+
**Duration:** ${o===void 0?`unknown`:`${o}s`}
|
|
32752
32753
|
|
|
32753
|
-
${rh(
|
|
32754
|
+
${rh(l)}
|
|
32754
32755
|
|
|
32755
32756
|
## Top ${i.flows.length} Critical Flows
|
|
32756
32757
|
|
|
32757
|
-
${
|
|
32758
|
+
${h}
|
|
32758
32759
|
|
|
32759
32760
|
## Raw JSON
|
|
32760
32761
|
|
|
32761
32762
|
\`\`\`json
|
|
32762
32763
|
${JSON.stringify(i,null,2)}
|
|
32763
32764
|
\`\`\`
|
|
32764
|
-
`;if((0,p.writeFileSync)(
|
|
32765
|
+
`;if((0,p.writeFileSync)(m,g,`utf8`),n.logger.info.defaultLog(`[regression-catalog] Report saved to: ${m}`),(0,c.isDefined)(s)&&s.length>0){let t=j.default.join(e,`${u}-${d}.prompt.md`);(0,p.writeFileSync)(t,`# Generated Prompt\n\n${s}\n`,`utf8`),n.logger.info.defaultLog(`[regression-catalog] Prompt saved to: ${t}`)}let _=j.default.join(e,`${u}-${d}.json`);(0,p.writeFileSync)(_,JSON.stringify({rootPath:t,anchorBranch:r,result:i,diff:l},null,2),`utf8`),n.logger.info.defaultLog(`[regression-catalog] JSON report saved to: ${_}`)}function ah(e,t,r){n.logger.info.defaultLog(`[regression-catalog] ${e.flows.length} flow(s) identified:`);for(let t of e.flows){let e=t.scoring===void 0?``:` (score: ${t.scoring.finalScore})`;n.logger.info.defaultLog(`[regression-catalog] [${t.rank}] ${t.name}${e}`),n.logger.info.defaultLog(`[regression-catalog] ${t.importanceReason.slice(0,150)}`)}if(t!==void 0&&n.REGRESSION_LOG_COST){let e=r===void 0?``:` Duration: ${r}s`;n.logger.info.defaultLog(`[regression-catalog] Cost: $${t.toFixed(4)}${e}`)}}function oh(e,t,r){if(r.length===0)return;let i=new Date().toISOString().replaceAll(/[:.]/g,`-`),a=j.default.basename(t),o=j.default.join(e,`${i}-${a}.toollog.md`);(0,p.writeFileSync)(o,`# Agentic Tool Call Log\n\n**Date:** ${new Date().toISOString()}\n**Turns:** ${r.length}\n\n---\n\n${r.join(`
|
|
32765
32766
|
|
|
32766
|
-
`)}\n`,`utf8`),n.logger.info.defaultLog(`[regression-catalog] Tool log saved to: ${o}`)}async function sh(e,t,r){let i=r.getContext();return!(0,c.isDefined)(i?.git?.owner)||!(0,c.isDefined)(i?.git?.repository)?(n.logger.info.defaultLog(`[regression-catalog] No git context available, skipping prior flows fetch`),{activeFlows:[],dormantFlows:[]}):t.get(`/api/v1/regression/catalogs/prior-flows`,{params:{owner:i.git.owner,repo:i.git.repository,anchorBranch:e}})}async function ch(e,t,r,i,a,o,s){try{let l
|
|
32767
|
+
`)}\n`,`utf8`),n.logger.info.defaultLog(`[regression-catalog] Tool log saved to: ${o}`)}async function sh(e,t,r){let i=r.getContext();return!(0,c.isDefined)(i?.git?.owner)||!(0,c.isDefined)(i?.git?.repository)?(n.logger.info.defaultLog(`[regression-catalog] No git context available, skipping prior flows fetch`),{activeFlows:[],dormantFlows:[]}):t.get(`/api/v1/regression/catalogs/prior-flows`,{params:{owner:i.git.owner,repo:i.git.repository,anchorBranch:e}})}async function ch(e,t,r,i,a,o,s,l){try{let u=l.getContext();if(!(0,c.isDefined)(u?.git?.owner)||!(0,c.isDefined)(u?.git?.repository)){n.logger.info.defaultLog(`[regression-catalog] No git context available, skipping backend sync`);return}let d;try{d=Um(e)}catch{n.logger.info.defaultLog(`[regression-catalog] Could not resolve anchorSha`)}let f={owner:u.git.owner,repo:u.git.repository,rootPath:e,anchorBranch:t,anchorSha:d,projectSummary:r.projectSummary,projectType:r.projectType,detectedEntryCount:r.detectedEntryCount,flows:r.flows,costUsd:i,totalDurationSeconds:a,keptCount:o.kept.length,revivedCount:o.revived.length,addedCount:o.added.length,goneCount:o.gone.length,agentVersion:Bm},p=await s.post(`/api/v1/regression/catalogs`,f);return n.logger.info.defaultLog(`[regression-catalog] Catalog synced to backend`),p?.catalogId}catch(e){n.logger.info.defaultLog(`[regression-catalog] Failed to sync catalog to backend: ${String(e)}`);return}}async function lh(e,t,r,i,a,o,s){n.logger.info.defaultLog(`[regression-catalog] Building regression catalog for: ${i}`),n.logger.info.defaultLog(`[regression-catalog] Anchor branch: ${a}`);let c=await sh(a,o,s),{result:l,costUsd:u,durationSeconds:d,generatedPrompt:f}=await t.run({rootPath:i,anchorBranch:a,priorFlows:c});ah(l,u,d);let m=Vm(c,l.flows);n.logger.info.defaultLog(`[regression-catalog] reconciliation: kept=${m.kept.length} revived=${m.revived.length} added=${m.added.length} gone=${m.gone.length}`);let{result:h,costUsd:g}=n.REGRESSION_TRACER_ENABLED?await r.run(l,i):{result:l,costUsd:0},_=(u??0)+g;n.REGRESSION_SAVE_REPORT_FILES&&((0,p.mkdirSync)(e,{recursive:!0}),ih(e,i,a,h,_,d,f,m),oh(e,i,t.getAgenticToolLog()));let v=await ch(i,a,h,_,d,m,o,s);return n.logger.info.defaultLog(`[regression-catalog] Job complete. ${h.flows.length} flows identified.`),{catalogId:v}}function uh(){return`You are a senior software architect building a regression flow catalog for a software project.
|
|
32767
32768
|
|
|
32768
32769
|
HARD STOP RULES — you MUST follow these or the task fails:
|
|
32769
32770
|
- You have a maximum of ${n.REGRESSION_CATALOG_MAX_TURNS} assistant turns total
|
|
@@ -32776,25 +32777,27 @@ HARD STOP RULES — you MUST follow these or the task fails:
|
|
|
32776
32777
|
|
|
32777
32778
|
## Step 1: Detect Project Type
|
|
32778
32779
|
|
|
32779
|
-
Start by understanding what kind of project this is:
|
|
32780
|
-
-
|
|
32781
|
-
-
|
|
32782
|
-
-
|
|
32783
|
-
-
|
|
32780
|
+
Start by understanding what kind of project this is. Do this in a language- and framework-agnostic way:
|
|
32781
|
+
- Identify the project's manifest / build descriptor files at or near the root and read them. Manifest files describe the project's identity, dependencies, build system, and entry points — every ecosystem has them (package manifests like \`package.json\`, build descriptors, workspace configs, project files, makefiles, and equivalents in other ecosystems).
|
|
32782
|
+
- If no manifest is obvious, glob the root for common patterns (e.g. \`*.json\`, \`*.toml\`, \`*.yaml\`, \`*.xml\`, \`*.gradle\`, \`*.sbt\`, \`*.cabal\`, \`*.csproj\`, \`*.sln\`, \`Makefile\`, \`CMakeLists.txt\`, \`Package.swift\`, \`go.mod\`, \`Gemfile\`, \`mix.exs\`, \`composer.json\`) and read whatever you find.
|
|
32783
|
+
- Look for framework-specific config files and conventional entry-point files for whichever stack the project uses — do not assume a specific language or framework.
|
|
32784
|
+
- Scan the top 2–3 levels of directories to understand the project structure (single project, workspace, monorepo, mixed-language repo).
|
|
32785
|
+
- Determine the project's nature: is it a service/API, a CLI tool, a frontend app, a library, a worker/job runner, a monorepo, a mixed-language repo, or something else?
|
|
32784
32786
|
|
|
32785
32787
|
## Step 2: Explore the Codebase on the Anchor Branch
|
|
32786
32788
|
|
|
32787
32789
|
You are cataloging flows on the anchor branch — this is the stable baseline.
|
|
32788
|
-
|
|
32789
|
-
-
|
|
32790
|
-
-
|
|
32791
|
-
-
|
|
32792
|
-
-
|
|
32793
|
-
-
|
|
32794
|
-
-
|
|
32790
|
+
Look for entry points in these language-neutral categories. Each project will have some, not all:
|
|
32791
|
+
- **Externally-invoked handlers** — anything the outside world can call: HTTP routes, RPC endpoints, GraphQL resolvers, message/queue consumers, webhook receivers, gRPC services
|
|
32792
|
+
- **User-facing surfaces** — pages, screens, forms, exported UI components, server actions
|
|
32793
|
+
- **Public API surface** — exported functions, public classes, library entry points, CLI commands, executable binaries (\`main\` / entry symbols), public headers, exported native symbols
|
|
32794
|
+
- **Scheduled / background work** — cron jobs, periodic tasks, background workers, queue processors, event handlers
|
|
32795
|
+
- **Cross-cutting concerns** — middleware, interceptors, guards, filters, authentication / authorization layers
|
|
32796
|
+
- **External integrations** — payment providers, auth services, email, databases, queues, third-party APIs
|
|
32797
|
+
- **For any project** — follow the most-changed files in git history; high churn often indicates a critical or fragile area
|
|
32795
32798
|
|
|
32796
32799
|
Use git history to find the hottest files:
|
|
32797
|
-
- \`git log --oneline --since="90 days ago" --
|
|
32800
|
+
- \`git log --oneline --since="90 days ago" -- <project source dirs>\` to see what's changed recently (use the actual source directories you discovered in Step 1)
|
|
32798
32801
|
- Batch multiple paths in a single git command — never one command per file
|
|
32799
32802
|
- Maximum 10 git commands total
|
|
32800
32803
|
- Do NOT use \`--follow\` flag
|
|
@@ -32842,12 +32845,16 @@ Consider any signals you find relevant:
|
|
|
32842
32845
|
|
|
32843
32846
|
## Output Format
|
|
32844
32847
|
|
|
32845
|
-
When you have completed your analysis, output your structured result.
|
|
32848
|
+
When you have completed your analysis, output your structured result.
|
|
32849
|
+
|
|
32850
|
+
**Use this codebase's idiomatic conventions for paths and symbols.** Copy what you see in the codebase verbatim — do not normalize. File paths, symbol names, and module identifiers should match how this codebase writes them (\`snake_case.py\`, \`PascalCase.java\`, \`kebab-case.ts\`, dotted packages like \`com.acme.Foo\`, slashed paths, header includes, etc.). The example below uses placeholder paths and symbols — substitute the real ones from this project.
|
|
32851
|
+
|
|
32852
|
+
Here is an example of a well-formed flow entry (paths/symbols are placeholders — use this project's actual conventions):
|
|
32846
32853
|
|
|
32847
32854
|
\`\`\`json
|
|
32848
32855
|
{
|
|
32849
32856
|
"projectSummary": "One sentence describing what this project does",
|
|
32850
|
-
"projectType": "describe the project type freely (e.g. '
|
|
32857
|
+
"projectType": "describe the project type freely in this project's terms (e.g. 'REST API', 'web app', 'CLI tool', 'background worker', 'native library', 'mixed-language monorepo')",
|
|
32851
32858
|
"detectedEntryCount": 47,
|
|
32852
32859
|
"flows": [
|
|
32853
32860
|
{
|
|
@@ -32855,12 +32862,12 @@ When you have completed your analysis, output your structured result. Here is an
|
|
|
32855
32862
|
"flowId": "monthly-subscription-renewal--abc12345",
|
|
32856
32863
|
"name": "Monthly Subscription Renewal",
|
|
32857
32864
|
"flowType": "ENDPOINT",
|
|
32858
|
-
"entryPoints": ["payment webhook handler", "subscription expiry
|
|
32865
|
+
"entryPoints": ["payment webhook handler", "subscription expiry scheduled job", "manual renewal endpoint"],
|
|
32859
32866
|
"description": "Handles automatic and manual subscription renewals. When a payment notification arrives or a subscription expires, the system charges the saved payment method, updates the subscription status, emails the user, and enables or disables their access accordingly.",
|
|
32860
32867
|
"trace": {
|
|
32861
|
-
"entryFiles": ["
|
|
32862
|
-
"entrySymbols": ["
|
|
32863
|
-
"calledModules": ["
|
|
32868
|
+
"entryFiles": ["<path/to/payments/handler.ext>", "<path/to/jobs/subscription-expiry.ext>"],
|
|
32869
|
+
"entrySymbols": ["<PaymentsHandler.handleWebhook>", "<subscription_expiry_job.run>"],
|
|
32870
|
+
"calledModules": ["<path/to/payments/service.ext>", "<path/to/integrations/stripe.ext>", "<path/to/mail/service.ext>"],
|
|
32864
32871
|
"codeSnippet": "optional short snippet of the most critical code path"
|
|
32865
32872
|
},
|
|
32866
32873
|
"scoring": {
|
|
@@ -32939,7 +32946,7 @@ Never emit two flows with the same \`flowId\` in a single response.
|
|
|
32939
32946
|
|
|
32940
32947
|
- Always use \`--since="90 days ago"\` — never scan full history
|
|
32941
32948
|
- Do NOT use \`--follow\` flag — it is extremely slow on large repos
|
|
32942
|
-
- Batch multiple file paths in a single git command
|
|
32949
|
+
- Batch multiple file paths in a single git command — use the actual source directories you discovered in Step 1 (e.g. \`src/\`, \`lib/\`, \`app/\`, \`src/main/java/\`, package directories — whatever this project uses)
|
|
32943
32950
|
- Maximum 10 git commands total — spend your turns reading code, not git logs
|
|
32944
32951
|
`}function dh(e,t){return`Project path: ${e}
|
|
32945
32952
|
Anchor branch: ${t}`}let fh=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`);function ph(e){let{activeFlows:t,dormantFlows:n}=e;if(t.length===0&&n.length===0)return``;let r=e=>{let t=e.productFlow?[` trigger: ${fh(e.productFlow.trigger)}`,` steps:`,...e.productFlow.steps.map(e=>` - actor: ${fh(e.actor)} · action: ${fh(e.action)} · outcome: ${fh(e.outcome)}`),` outcome: ${fh(e.productFlow.outcome)}`].join(`
|
|
@@ -32947,24 +32954,24 @@ Anchor branch: ${t}`}let fh=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).
|
|
|
32947
32954
|
`)},i=[`<previous-catalog>`];return t.length>0&&i.push(` <active-flows>`,t.map(r).join(`
|
|
32948
32955
|
`),` </active-flows>`),n.length>0&&i.push(` <dormant-flows>`,n.map(r).join(`
|
|
32949
32956
|
`),` </dormant-flows>`),i.push(`</previous-catalog>`),i.join(`
|
|
32950
|
-
`)}var mh=t.__toESM(n.require_decorateMetadata()),hh=t.__toESM(yn()),gh=t.__toESM(n.require_decorate()),_h;let vh=[`Read`,`Glob`,`Grep`,`Bash`];function yh(e,t){let n=e.toLowerCase().replaceAll(/\s+/g,`-`).replaceAll(/[^a-z0-9-]/g,``),r=[...t].sort((e,t)=>e.localeCompare(t)).join(`|`);return`${n}--${r.length>0?(0,f.createHash)(`sha256`).update(r).digest(`hex`).slice(0,8):(0,f.createHash)(`sha256`).update(n).digest(`hex`).slice(0,8)}`}let bh=class{constructor(e,t){this.globalConfigService=e,this.authStorage=t}agenticToolLog=[];async run(e){let{rootPath:t,anchorBranch:r}=e,i=await this.authStorage.getJWTToken();n.logger.info.defaultLog(`[regression-agent] Starting catalog sync for ${t} on branch "${r}"`);let{query:a,getMessageContentBlocks:o,isResultMessage:s,isErrorResult:c}=await Promise.resolve().then(()=>wU()),l=uh(),u=dh(t,r),d=e.priorFlows?ph(e.priorFlows):``,p=d?`${d}\n\n${u}`:u,m=a({prompt:p,options:{model:n.REGRESSION_CATALOG_MODEL,systemPrompt:l,allowedTools:[...vh],permissionMode:n.REGRESSION_PERMISSION_MODE,allowDangerouslySkipPermissions:!0,maxBudgetUsd:n.REGRESSION_CATALOG_MAX_BUDGET_USD,maxTurns:n.REGRESSION_CATALOG_MAX_TURNS,outputFormat:{type:`json_schema`,schema:n.CATALOG_OUTPUT_SCHEMA},cwd:t,sessionId:(0,f.randomUUID)(),env:{...process.env,ANTHROPIC_BASE_URL:this.globalConfigService.getAnthropicProxyUrl(),ANTHROPIC_AUTH_TOKEN:i??``},stderr:e=>{n.logger.info.defaultLog(`[regression-agent] STDERR: ${e}`)}}}),h,g=0,
|
|
32957
|
+
`)}var mh=t.__toESM(n.require_decorateMetadata()),hh=t.__toESM(yn()),gh=t.__toESM(n.require_decorate()),_h;let vh=[`Read`,`Glob`,`Grep`,`Bash`];function yh(e,t){let n=e.toLowerCase().replaceAll(/\s+/g,`-`).replaceAll(/[^a-z0-9-]/g,``),r=[...t].sort((e,t)=>e.localeCompare(t)).join(`|`);return`${n}--${r.length>0?(0,f.createHash)(`sha256`).update(r).digest(`hex`).slice(0,8):(0,f.createHash)(`sha256`).update(n).digest(`hex`).slice(0,8)}`}let bh=class{constructor(e,t){this.globalConfigService=e,this.authStorage=t}agenticToolLog=[];async run(e){let{rootPath:t,anchorBranch:r}=e,i=await this.authStorage.getJWTToken();n.logger.info.defaultLog(`[regression-agent] Starting catalog sync for ${t} on branch "${r}"`);let{query:a,getMessageContentBlocks:o,isResultMessage:s,isErrorResult:c}=await Promise.resolve().then(()=>wU()),l=uh(),u=dh(t,r),d=e.priorFlows?ph(e.priorFlows):``,p=d?`${d}\n\n${u}`:u,m=a({prompt:p,options:{model:n.REGRESSION_CATALOG_MODEL,systemPrompt:l,allowedTools:[...vh],permissionMode:n.REGRESSION_PERMISSION_MODE,allowDangerouslySkipPermissions:!0,maxBudgetUsd:n.REGRESSION_CATALOG_MAX_BUDGET_USD,maxTurns:n.REGRESSION_CATALOG_MAX_TURNS,outputFormat:{type:`json_schema`,schema:n.CATALOG_OUTPUT_SCHEMA},cwd:t,sessionId:(0,f.randomUUID)(),env:{...process.env,ANTHROPIC_BASE_URL:this.globalConfigService.getAnthropicProxyUrl(),ANTHROPIC_AUTH_TOKEN:i??``},stderr:e=>{n.logger.info.defaultLog(`[regression-agent] STDERR: ${e}`)}}}),h,g,_=0,v;for await(let e of m){let t=o(e);if(t!==void 0&&t.length>0&&(_++,this.logAgenticTurn(_,t)),s(e)){if(c(e))throw new hf(e.subtype,e.errors,e.total_cost_usd);h=e.total_cost_usd,typeof e.duration_ms==`number`&&(g=Math.round(e.duration_ms/1e3)),v=xh(e.structured_output),n.REGRESSION_LOG_COST&&n.logger.info.defaultLog(`[regression-agent] Result received. Cost: $${h?.toFixed(4)} Duration: ${g??`—`}s`);break}}n.REGRESSION_LOG_COST&&n.logger.info.defaultLog(`[regression-agent] Catalog sync done. ${_} turns. Cost: $${h?.toFixed(4)} Duration: ${g??`—`}s`);let y=v?{flows:v.flows,projectSummary:v.projectSummary,projectType:v.projectType,detectedEntryCount:v.detectedEntryCount}:{flows:[],projectSummary:``,projectType:`unknown`,detectedEntryCount:0};return this.normalizeFlowTypes(y.flows),this.normalizeFlowIds(y.flows),this.assignStepIds(y.flows),this.assignRanks(y.flows),n.REGRESSION_LOG_COST&&n.logger.info.defaultLog(`[regression-agent] Done. ${y.flows.length} flows found. Cost: $${h?.toFixed(4)}`),{result:y,costUsd:h,durationSeconds:g,generatedPrompt:p}}getAgenticToolLog(){return this.agenticToolLog}logAgenticTurn(e,t){for(let r of t){let t=r,i=String(t.type??``);if(i===`tool_use`){let r=String(t.name??``),i=t.input,a=i===void 0?``:JSON.stringify(i),o=a.length>200?a.slice(0,200)+`...`:a;n.logger.info.defaultLog(`[regression-agent] Turn ${e} — tool: ${r} ${o}`),this.agenticToolLog.push(`[Turn ${e}] TOOL: ${r}\n Input: ${a.slice(0,500)}`)}else if(i===`tool_result`){let e=typeof t.content==`string`?t.content:JSON.stringify(t.content??``),n=e.slice(0,300).replaceAll(`
|
|
32951
32958
|
`,` `);this.agenticToolLog.push(` Result: ${n}${e.length>300?`...`:``}`)}else if(i===`text`&&typeof t.text==`string`){let r=t.text.slice(0,200).replaceAll(`
|
|
32952
|
-
`,` `);n.logger.info.defaultLog(`[regression-agent] Turn ${e} — text: ${r}`),this.agenticToolLog.push(`[Turn ${e}] TEXT: ${r}${t.text.length>200?`...`:``}`)}}}normalizeFlowTypes(e){let t=new Set([`ENDPOINT`,`COMMAND`,`PAGE`,`EXPORT`,`HANDLER`,`JOB`,`JOURNEY`,`OTHER`]),n={endpoint:`ENDPOINT`,"api-endpoint":`ENDPOINT`,"api-group":`ENDPOINT`,"rest-api":`ENDPOINT`,api:`ENDPOINT`,route:`ENDPOINT`,http:`ENDPOINT`,rest:`ENDPOINT`,command:`COMMAND`,"cli-command":`COMMAND`,cli:`COMMAND`,cmd:`COMMAND`,page:`PAGE`,"web-page":`PAGE`,screen:`PAGE`,view:`PAGE`,export:`EXPORT`,"library-export":`EXPORT`,"public-api":`EXPORT`,handler:`HANDLER`,"event-handler":`HANDLER`,"real-time-stream":`HANDLER`,"real-time":`HANDLER`,webhook:`HANDLER`,event:`HANDLER`,stream:`HANDLER`,job:`JOB`,"background-job":`JOB`,cron:`JOB`,scheduled:`JOB`,worker:`JOB`,task:`JOB`,queue:`JOB`,journey:`JOURNEY`,"user-journey":`JOURNEY`,"business-process":`JOURNEY`,workflow:`JOURNEY`,pipeline:`JOURNEY`,process:`JOURNEY`};for(let r of e){let e=String(r.flowType??``).trim(),i=e.toUpperCase();t.has(i)?r.flowType=i:r.flowType=n[e.toLowerCase()]??`OTHER`}}normalizeFlowIds(e){let t=new Set;for(let n of e){let e=n,r;typeof e.flowId==`string`&&e.flowId.length>0?r=e.flowId:typeof e.flow_id==`string`&&e.flow_id.length>0&&(r=e.flow_id);let i=r??yh(n.name,n.trace.entryFiles);t.has(i)&&(i=`${i}-${n.rank}`),t.add(i),n.flowId=i}}assignStepIds(e){for(let t of e)if(t.productFlow!==void 0)for(let e of t.productFlow.steps)e.stepId=(0,f.randomUUID)().slice(0,8)}assignRanks(e){e.sort((e,t)=>{let n=e.scoring?.finalScore??0;return(t.scoring?.finalScore??0)-n});for(let[t,n]of e.entries())n.rank=t+1}};bh=(0,gh.default)([(0,l.injectable)(),(0,hh.default)(0,(0,l.inject)(n.GlobalConfigService)),(0,hh.default)(1,(0,l.inject)(vn)),(0,mh.default)(`design:paramtypes`,[Object,typeof(_h=vn!==void 0&&vn)==`function`?_h:Object])],bh);function xh(e){if(typeof e!=`object`||!e)return;let t=e;if(Array.isArray(t.flows))return{flows:t.flows,projectSummary:typeof t.projectSummary==`string`?t.projectSummary:``,projectType:typeof t.projectType==`string`?t.projectType:`unknown`,detectedEntryCount:typeof t.detectedEntryCount==`number`?t.detectedEntryCount:0}}function Sh(){return`You are a dependency tracer. Your only job is to find all local source files reachable from a set of entry files by following
|
|
32959
|
+
`,` `);n.logger.info.defaultLog(`[regression-agent] Turn ${e} — text: ${r}`),this.agenticToolLog.push(`[Turn ${e}] TEXT: ${r}${t.text.length>200?`...`:``}`)}}}normalizeFlowTypes(e){let t=new Set([`ENDPOINT`,`COMMAND`,`PAGE`,`EXPORT`,`HANDLER`,`JOB`,`JOURNEY`,`OTHER`]),n={endpoint:`ENDPOINT`,"api-endpoint":`ENDPOINT`,"api-group":`ENDPOINT`,"rest-api":`ENDPOINT`,api:`ENDPOINT`,route:`ENDPOINT`,http:`ENDPOINT`,rest:`ENDPOINT`,command:`COMMAND`,"cli-command":`COMMAND`,cli:`COMMAND`,cmd:`COMMAND`,page:`PAGE`,"web-page":`PAGE`,screen:`PAGE`,view:`PAGE`,export:`EXPORT`,"library-export":`EXPORT`,"public-api":`EXPORT`,handler:`HANDLER`,"event-handler":`HANDLER`,"real-time-stream":`HANDLER`,"real-time":`HANDLER`,webhook:`HANDLER`,event:`HANDLER`,stream:`HANDLER`,job:`JOB`,"background-job":`JOB`,cron:`JOB`,scheduled:`JOB`,worker:`JOB`,task:`JOB`,queue:`JOB`,journey:`JOURNEY`,"user-journey":`JOURNEY`,"business-process":`JOURNEY`,workflow:`JOURNEY`,pipeline:`JOURNEY`,process:`JOURNEY`};for(let r of e){let e=String(r.flowType??``).trim(),i=e.toUpperCase();t.has(i)?r.flowType=i:r.flowType=n[e.toLowerCase()]??`OTHER`}}normalizeFlowIds(e){let t=new Set;for(let n of e){let e=n,r;typeof e.flowId==`string`&&e.flowId.length>0?r=e.flowId:typeof e.flow_id==`string`&&e.flow_id.length>0&&(r=e.flow_id);let i=r??yh(n.name,n.trace.entryFiles);t.has(i)&&(i=`${i}-${n.rank}`),t.add(i),n.flowId=i}}assignStepIds(e){for(let t of e)if(t.productFlow!==void 0)for(let e of t.productFlow.steps)e.stepId=(0,f.randomUUID)().slice(0,8)}assignRanks(e){e.sort((e,t)=>{let n=e.scoring?.finalScore??0;return(t.scoring?.finalScore??0)-n});for(let[t,n]of e.entries())n.rank=t+1}};bh=(0,gh.default)([(0,l.injectable)(),(0,hh.default)(0,(0,l.inject)(n.GlobalConfigService)),(0,hh.default)(1,(0,l.inject)(vn)),(0,mh.default)(`design:paramtypes`,[Object,typeof(_h=vn!==void 0&&vn)==`function`?_h:Object])],bh);function xh(e){if(typeof e!=`object`||!e)return;let t=e;if(Array.isArray(t.flows))return{flows:t.flows,projectSummary:typeof t.projectSummary==`string`?t.projectSummary:``,projectType:typeof t.projectType==`string`?t.projectType:`unknown`,detectedEntryCount:typeof t.detectedEntryCount==`number`?t.detectedEntryCount:0}}function Sh(){return`You are a dependency tracer. Your only job is to find all local source files reachable from a set of entry files by following the project's dependency / reference chains. Be language- and framework-agnostic — adapt to whatever ecosystem this project uses.
|
|
32953
32960
|
|
|
32954
32961
|
HARD STOP RULES:
|
|
32955
|
-
- Do NOT analyze what the code does — only trace
|
|
32956
|
-
- Do NOT include node_modules
|
|
32962
|
+
- Do NOT analyze what the code does — only trace references
|
|
32963
|
+
- Do NOT include third-party / vendored dependencies (anything that is not part of this project's own source). Examples (use the equivalent for whichever ecosystem this project uses): \`node_modules\` for JS/TS, site-packages or vendored dirs for Python, \`vendor/\` for Go/PHP, \`target/dependency\` for Java/Scala, \`.cargo/registry\` for Rust, system include paths for C/C++ — skip all of them.
|
|
32957
32964
|
- Do NOT include files outside the project root
|
|
32958
|
-
- Only follow
|
|
32965
|
+
- Only follow LOCAL references — code that resolves to a file inside this project. Use whatever mechanism the language uses: relative imports (\`./foo\`, \`../bar\`), package/module references that map to in-project files, path aliases configured in the project (e.g. \`@/...\`, custom resolvers, \`paths\` in tsconfig, Python package roots, Java/Scala packages under the project's source tree, Go module-internal paths, Rust \`crate::...\`, C/C++ \`#include "..."\` quoted includes that resolve into the repo, etc.).
|
|
32959
32966
|
- Stop when you have found all reachable files — do not explore indefinitely
|
|
32960
32967
|
- OUTPUT YOUR JSON IMMEDIATELY once you have no new files to trace
|
|
32961
32968
|
|
|
32962
32969
|
## What to do
|
|
32963
32970
|
|
|
32964
32971
|
1. Read each entry file provided
|
|
32965
|
-
2. Extract all local
|
|
32966
|
-
3. Resolve those
|
|
32967
|
-
4. Read those files and extract their
|
|
32972
|
+
2. Extract all local references from each file using the syntax appropriate to this project's language (imports, requires, uses, includes, package declarations, etc.)
|
|
32973
|
+
3. Resolve those references to actual file paths within the project
|
|
32974
|
+
4. Read those files and extract their references
|
|
32968
32975
|
5. Continue until no new local files are discovered
|
|
32969
32976
|
6. Return all discovered files as calledModules
|
|
32970
32977
|
|
|
@@ -32974,10 +32981,10 @@ Use Read to read files. Use Glob to resolve path patterns if needed. Do NOT use
|
|
|
32974
32981
|
|
|
32975
32982
|
## Output
|
|
32976
32983
|
|
|
32977
|
-
Output your result in this shape:
|
|
32984
|
+
Output your result in this shape (paths in the example are placeholders — emit the actual relative paths from this project, with this project's real file extensions):
|
|
32978
32985
|
|
|
32979
32986
|
\`\`\`json
|
|
32980
|
-
{ "calledModules": ["
|
|
32987
|
+
{ "calledModules": ["<relative/path/to/foo.ext>", "<relative/path/to/bar.ext>"] }
|
|
32981
32988
|
\`\`\`
|
|
32982
32989
|
|
|
32983
32990
|
- Include ALL files you discovered, including the entry files themselves if they are local
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earlyai/cli",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.4",
|
|
4
4
|
"description": "early cli",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"bin": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@earlyai/core": "^1.5.0",
|
|
58
|
-
"@earlyai/ts-agent": "^0.
|
|
58
|
+
"@earlyai/ts-agent": "^0.98.0",
|
|
59
59
|
"@eslint/compat": "^1.3.2",
|
|
60
60
|
"@eslint/eslintrc": "^3.3.1",
|
|
61
61
|
"@eslint/js": "^9.34.0",
|