hud-sdk 1.6.10 → 1.6.11

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(global,()=>(()=>{var e={336:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(2822),s=r(8949),i=r(8901),a=r(714);class c extends a.FrameworkPatcher{_patch(e){return this._patchSendRequest(e),o.instrument_logger.info("Patched @codegenie/serverless-express/src/frameworks/express.js successfully"),e}_patchSendRequest(e){const t=e.sendRequest;e.sendRequest=function(e){let r,s;const a=i.HttpEndpointMetric.createUsableMetric();try{if(r=e.request,s=e.response,!r||!s)return t.call(this,e);a.start(),a.setRequestAttributes(r),r[o.hudConfig.metricSymbol]=a}catch(e){o.instrument_logger.error("Failed to start flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const c=(0,n.runWithInvestigation)(()=>t.call(this,e));try{s.once("finish",function(){try{(0,n.finishHttpInvestigation)(r,s,a),a.setResponseAttributes(s),a.end()}catch(e){o.instrument_logger.error("Failed to end flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}})}catch(e){o.instrument_logger.error("Failed to end flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return c},(0,s.copyPropertiesToTarget)(t,e.sendRequest)}}t.default=c},486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8269),n=r(2546),s=r(8949),i=r(828),a=r(714);class c extends a.FrameworkPatcher{_patch(e){return this._patchConsumer(e),n.instrument_logger.info("Patched KafkaJS successfully"),e}_patchConsumer(e){const t=e.Kafka.prototype.consumer;e.Kafka.prototype.consumer=function(...e){const r=t.apply(this,e);try{const t=new Map,o=[],a=[];!function(e,t){const r=e.subscribe;e.subscribe=async function(...e){const o=await r.apply(this,e);try{const r=e[0].topics;r?r.forEach(e=>{t.push(e)}):e[0].topic?t.push(e[0].topic):n.instrument_logger.warn("No topic found in KafkaJS.Consumer.subscribe",{args:e[0]})}catch(e){n.instrument_logger.error("Error in patching KafkaJS.Consumer.subscribe",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o},(0,s.copyPropertiesToTarget)(r,e.subscribe)}(r,a),function(e,t,r,o,a){const c=e.run;function g(e,c){const g="eachBatch"===c;for(const e of a)f(e,o,t,r,c);const p=function(e,t,r){return o=>{const s=o[0],i=r?s.batch.topic:s.topic;return function(e,t,r,o){const s=e.get(d(r,o));if(s)return s;for(const e of t)if(e.isBatch===o&&e.pattern.test(r))return e.flowId;n.instrument_logger.warn("No flowId found for topic",{topicName:r,isBatch:o})}(e,t,i,r)}}(t,r,g),h=function(e){return(t,r,o)=>{const s=i.KafkaJSMetric.createUsableMetric();s.start(),s.setFlowId(t);const a=o[0];void 0!==a&&void 0!==a.message&&(a.message[n.hudConfig.metricSymbol]=s);const c=e?a.batch.partition:a.partition,u=e?a.batch.messages[0]?.timestamp:a.message?.timestamp;s.addPartition(c),s.addProducedTimestamp(u),r.flowMetric=s}}(g),m=(0,s.wrapFlow)(p,e[c],h,u,l);e[c]=m}e.run=async function(...e){try{const t=e[0];t.eachMessage&&g(t,"eachMessage"),t.eachBatch&&g(t,"eachBatch")}catch(e){n.instrument_logger.error("Error in patching KafkaJS.Consumer.run",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return await c.apply(this,e)},(0,s.copyPropertiesToTarget)(c,e.run)}(r,t,o,e[0].groupId,a)}catch(e){n.instrument_logger.error("Error in patching KafkaJS.Consumer",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r},(0,s.copyPropertiesToTarget)(t,e.Kafka.prototype.consumer)}}function u(e,t){const r=t.flowMetric;r?r.end():n.instrument_logger.warn("No flowMetric found for message",{flowId:e})}function l(e,t,r){const o=t.flowMetric;o?(o.setError(r),o.end()):n.instrument_logger.warn("No flowMetric found for message",{flowId:e})}function d(e,t){return e+"|"+t}function f(e,t,r,s,i){const a=(0,n.generateKafkaFlowId)(e,t,i),c={flow_id:a,topic_name:e.toString(),group_id:t,pulling_type:i};(0,o.storeKafkaJSTopicDeclaration)(c),function(e,t,r,o,n){"string"==typeof r?e.set(d(r,o),n):t.push({pattern:r,isBatch:o,flowId:n})}(r,s,e,"eachBatch"===i,a)}t.default=c},646:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(8949),s=r(714),i=r(3531);class a extends s.FrameworkPatcher{_patch(e){return this._patchCreate(e),o.instrument_logger.info("Patched NestJS RouterExecutionContext successfully"),e}_patchCreate(e){const t=e.RouterExecutionContext.prototype.create;e.RouterExecutionContext.prototype.create=function(...e){try{const t=e[0],r=e[1];if("function"==typeof t.constructor&&"function"==typeof r){const s=(0,i.generateKey)(t,r);s&&(e[1]=(0,n.wrapFlow)(()=>{try{const e=(0,i.getRequestByCallback)(s);if(!e)return void o.instrument_logger.error("No request object found for key",{key:s});const t=function(e){if(e&&!e.raw&&e.socket)return e[o.hudConfig.metricSymbol]?e[o.hudConfig.metricSymbol].getFlowId?e[o.hudConfig.metricSymbol].getFlowId():void o.instrument_logger.error("No getFlowId function found on metric object"):void o.instrument_logger.error("No metric found on nestjs request object")}(e);return t||o.instrument_logger.error("No flow id found for key",{key:s}),t}catch(e){o.instrument_logger.error("Error in NestJS getFlowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}},r))}else o.instrument_logger.error("Invalid args in NestJS RouterExecutionContext.create",{args:e})}catch(e){o.instrument_logger.error("Error in NestJS RouterExecutionContext patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,e)},(0,n.copyPropertiesToTarget)(t,e.RouterExecutionContext.prototype.create)}}t.default=a},714:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getFrameworkPatcher=t.extractModuleVersion=t.isSupportedVersion=t.FrameworkPatcher=void 0;const i=r(2546),a=r(9896),c=s(r(6928)),u=r(8064);function l(e,t){return""===e||u.satisfies(u.coerce(e),t)}function d(e){try{const t=(0,a.readFileSync)(c.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(t).version;return"string"==typeof r?r:""}catch(t){i.instrument_logger.info("Failed extracting version",{baseDir:e})}return""}t.FrameworkPatcher=class{patch(e,t,r,o,n=this.constructor.name){try{if(this.isSupported(t,n,r,o))return this._patch(e)}catch(e){i.instrument_logger.error("Unhandeled error during patching framework",{framework:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}isSupported(e,t,r,o){const n=d(e);return!!l(n,r)||(i.instrument_logger.warn("Unsupported version",{framework:t,version:n,supportedVersion:r,basedir:e}),i.customer_logger.log(i.UserErrorLogs.UnsupportedFrameworkVersion(t)),!1)}},t.isSupportedVersion=l,t.extractModuleVersion=d,t.getFrameworkPatcher=function(e){return new(r(2828)(`./${e}`).default)}},828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KafkaJSMetric=void 0;const o=r(2546),n=r(7131),s=r(9873);class i extends s.FlowMetric{partition;error;producedTimestamp;totalConsumeDuration;constructor(e){super(e)}_createUsableMetric(e){return this}end(){this.producedTimestamp&&(this.totalConsumeDuration=Number(Date.now()-this.producedTimestamp)*Number(1e6)),super.end()}addProducedTimestamp(e){void 0!==e&&(this.producedTimestamp=Number(e))}addPartition(e){this.partition=e}setError(e){this.error=(0,n.extractName)(e)}toRaw(){if(void 0!==this.partition)return{flow_id:this.flowId,type:"KafkaJSMetric",duration:this.duration,partition:this.partition,error:this.error,total_consume_duration:this.totalConsumeDuration};o.instrument_logger.warn("No partition found for message",{flowId:this.flowId})}}t.KafkaJSMetric=i},857:e=>{"use strict";e.exports=require("os")},932:e=>{"use strict";e.exports=require("process")},1427:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSystemInfo=void 0;const n=o(r(9896)),s=o(r(857));t.getSystemInfo=function(){return{pod_name:u(),node_name:l()}};const i=Symbol("not found");let a,c;function u(){if(a!==i){if(a)return a;try{return a=s.default.hostname(),a}catch(e){return void(a=i)}}}function l(){if(c!==i){if(c)return c;try{const e=n.default.readFileSync("/etc/machine-id","utf8").trim();return c=e,c}catch(e){return void(c=i)}}}},1502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8528),n=r(8269),s=r(2546),i=r(8949),a=r(714);class c extends a.FrameworkPatcher{static koaModuleName="koa";static koaPatchedSymbol=Symbol.for(s.hudConfig.hudPatchedName);_patch(e){return this._patchAppUse(e),s.instrument_logger.info("Patched koa successfully"),e}_patchAppUse(e){const t=e.prototype.use;e.prototype.use=function(e){const r=t.apply(this,arguments);try{if(!arguments[0].router)return r;const e=arguments[0].router.stack;for(let t=0;t<e.length;t++)c._wrapRoute(e[t])}catch(e){s.instrument_logger.error("Failed to patch koa.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r},(0,i.copyPropertiesToTarget)(t,e.prototype.use)}static _wrapRoute(e){if(e.methods&&0===e.methods.length)return;if(!e.stack[0][c.koaPatchedSymbol]){const t=(0,i.wrapFlow)(g,e.stack[0],u);e.stack[0]=t,e.stack[0][c.koaPatchedSymbol]=!0}const t=(0,s.generateEndpointFlowId)(e.path,e.methods);(0,n.storeKoaEndpointDeclaration)(new o.EndpointDeclaration(t,e.methods,"koa",void 0,e.path));for(const r of e.methods)f(t,e.path,r)}}function u(e,t,r){if(!r[0])return void s.instrument_logger.error("No ctx object found in koa");const o=r[0].req;if(!o)return void s.instrument_logger.error("No req found in koa ctx");const n=o[s.hudConfig.metricSymbol];n?n.setFlowId(e):s.instrument_logger.error("No endpoint metric found in koa req")}function l(e,t){return e+"|"+t}t.default=c;const d=new Map;function f(e,t,r){d.set(l(t,r),e)}function g(e){if(0===e.length)return;const t=e[0]._matchedRoute,r=e[0].req?.method;return function(e,t){return d.get(l(e,t))}(t,r)}},2080:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SqsMetric=void 0;const o=r(9873);class n extends o.FlowMetric{errors;msgCount;e2eEpocStartTimeMS;e2eDurationNS;_finishedMessageCount;constructor(e){super(e),this._finishedMessageCount=0,this.errors=new Map}addError(e,t=1){this.errors.set(e,(this.errors.get(e)??0)+t)}increaseAndShouldEnd(e=1){return this._finishedMessageCount+=e,!(this.msgCount&&this._finishedMessageCount<this.msgCount)}end(){this.e2eEpocStartTimeMS&&(this.e2eDurationNS=Number(Date.now()-this.e2eEpocStartTimeMS)*Number(1e6)),super.end()}_createUsableMetric(e){return this}toRaw(){return{flow_id:this.flowId,type:"SqsMetric",duration:this.duration,e2e_duration:this.e2eDurationNS,msg_count:this.msgCount,errors:this.errors}}}t.SqsMetric=n},2197:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)},i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.koa=t.express=t.safeLog=t.registerHook=t.hudRITM=void 0;var a=r(5688);Object.defineProperty(t,"hudRITM",{enumerable:!0,get:function(){return a.hudRITM}}),Object.defineProperty(t,"registerHook",{enumerable:!0,get:function(){return a.registerHook}}),Object.defineProperty(t,"safeLog",{enumerable:!0,get:function(){return a.safeLog}}),s(r(3901),t),t.express=i(r(7127)),s(r(714),t),t.koa=i(r(1502)),s(r(7166),t)},2546:e=>{"use strict";e.exports=require("./lib")},2729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(2822),s=r(8949),i=r(8901),a=r(714);class c extends a.FrameworkPatcher{_patch(e){const t=this._patchGetFramework(e);return o.instrument_logger.info("Patched serverless-http/lib/framework/get-framework.js successfully"),t}_patchGetFramework(e){const t=e;return e=function(...e){const r=t.apply(t.this,e);async function a(e,...t){const s=i.HttpEndpointMetric.createUsableMetric();try{s.start(),s.setRequestAttributes(e),e[o.hudConfig.metricSymbol]=s}catch(e){o.instrument_logger.error("Failed to start flowMetric during framework serverless request handler patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const a=await(0,n.runWithInvestigation)(()=>r.apply(r.this,[e,...t]));return a.once("finish",function(){try{(0,n.finishHttpInvestigation)(e,a,s),s.setResponseAttributes(a),s.end()}catch(e){o.instrument_logger.error("Failed to end flowMetric during framework serverless request handler patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),a}return(0,s.copyPropertiesToTarget)(r,a),a},(0,s.copyPropertiesToTarget)(t,e),e}}t.default=c},2741:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(6730),s=r(4815),i=r(7225),a=r(714);class c extends a.FrameworkPatcher{_patch(e){return i.isVerboseLoggingEnabled?((0,n.patchMethods)(e,"application_export"),(0,s.patchUse)(e,"application",!1),(0,i.logLazyRouter)(e),o.instrument_logger.info("Patched express.Application successfully"),e):(o.instrument_logger.info("Skipping express.Application patching, verbose logging is not enabled"),e)}}t.default=c},2784:e=>{"use strict";e.exports=require("../native/_index")},2822:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.finishSqsInvestigation=t.finishHttpInvestigation=t.getStacktraceUniqString=t.storeInvestigation=t.closeInvestigation=t.runWithInvestigation=t.createNewInvestigation=t.getBaseInvestigationStorage=t.serializableInvestigation=void 0;const o=r(8528),n=r(8269),s=r(2546),i=r(7131),a=r(7808),c=r(7603),u=r(1427),l=/(?:\n\s*at.*)+$/,d={};function f(e,...t){let r="debug";(void 0===d[e]||d[e]<s.hudConfig.dynamicConfig.investigationRateLimits.maxUniqLogs)&&(r="warn",d[e]=d[e]+1||1),s.app_logger.log(r,e,...t)}function g(e){return{status:e.status,context:e.context,exceptions:Array.from(Array.from(e.exceptions?.values()??[]).map(({exception:e,executionFlow:t})=>{return{name:(0,i.extractNameOptional)(e),message:(0,i.extractMessage)(e),stackTrace:(r=e,r?.stack?.match(l)?.[0]),executionFlow:t};var r})??[])}}function p(){return{status:o.InvestigationStatus.Open}}function h(){if(!globalThis.hudEnableInvestigation)return;const e=(0,i.getStorage)().getStore();return void 0!==e&&e.status===o.InvestigationStatus.Open?(e.status=o.InvestigationStatus.Closed,e):void 0}function m(e,t){e.context=t,(0,n.storeClosedInvestigation)(g(e))}t.serializableInvestigation=g,t.getBaseInvestigationStorage=p,t.createNewInvestigation=function(){globalThis.hudEnableInvestigation&&(0,i.getStorage)().enterWith(p())},t.runWithInvestigation=function(e){return globalThis.hudEnableInvestigation?(0,i.getStorage)().run(p(),e):e()},t.closeInvestigation=h,t.storeInvestigation=m;const _=/.*\((.*):(\d+):(\d+)\)/,y=/.*?(\S*):(\d+):(\d+)/;function v(e){const t=Error.prepareStackTrace;if(void 0===t||"function"!=typeof t)return void f("getStacktraceUniqString: prepareStackTrace is undefined or not a function");let r,o;try{Error.prepareStackTrace=(e,t)=>{r=t[0],o=t};const n=e.stack;if(void 0!==n&&void 0===r){const t=function(e,t){const r=function(e){let t=0;for(let r=0;r<e.length;r++)"\n"===e[r]&&t++;return t}(t)+1;let o=-1;for(let t=0;t<r;t++)if(o=e.indexOf("\n",o+1),-1===o)return;if(-1===o)return;const n=e.indexOf("\n",o+1);return e.slice(o+1,-1===n?void 0:n)}(n,e.message);if(!t)return void f("getStacktraceUniqString: firstStackTraceLine is undefined",{stack:n,message:e.message});const r=t.match(_);if(r&&r[1]&&r[2]&&r[3])return`${e.name}@${r[1]}:${r[2]}:${r[3]}`;const o=t.match(y);return o&&o[1]&&o[2]&&o[3]?`${e.name}@${o[1]}:${o[2]}:${o[3]}`:void f("getStacktraceUniqString: no match found in regex",{stack:n,message:e.message})}if(void 0===r||void 0===o)return void f("getStacktraceUniqString: result or globCallSites is undefined",{result:void 0===r,globCallSites:void 0===o});Object.defineProperty(e,"stack",{configurable:!0,enumerable:!1,get:()=>t(e,o)})}finally{Error.prepareStackTrace=t}try{return`${e.name}@${r.getFileName()}:${r.getLineNumber()}:${r.getColumnNumber()}`}catch{}}function b(e,t=s.hudConfig.investigation.maxObjectDepth){try{if("string"==typeof e)return e.length>s.hudConfig.investigation.maxStringLength?e.slice(0,s.hudConfig.investigation.maxStringLength)+"...":e;if(Array.isArray(e))return e.slice(0,s.hudConfig.investigation.maxArrayLength).map(e=>b(e,t-1));if(null===e||["number","boolean"].includes(typeof e))return e;if("bigint"==typeof e)return e.toString();if("object"==typeof e){const r={...e};for(const o in e)r[o]=b(e[o],t-1);return r}}catch{}}function w(e){const t=h();if(void 0===t)return void f("finishBaseInvestigation: investigation is undefined");if(void 0===t.firstException)return void f("finishBaseInvestigation: firstException is undefined");if(n.globalInvestigationTracking>=s.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations)return void f("finishBaseInvestigation: globalInvestigationTracking is greater than maxTotalInvestigations",{globalInvestigationTracking:n.globalInvestigationTracking,maxTotalInvestigations:s.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations});const r=e.getFlowId();if(void 0===r)return void f("finishBaseInvestigation: flowId is undefined");const o=v(t.firstException);if(void 0===o)return void f("finishBaseInvestigation: exceptionUniqString is undefined");const i=((0,n.getInvestigationDedupingCache)(r).get(o)??0)+1;if(!(i>s.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations))return(0,n.increaseGlobalInvestigationTracking)(),(0,n.increaseInvestigationDedupingCache)(r,o),t;f("finishBaseInvestigation: investigationCount is greater than maxSameInvestigations",{investigationCount:i,maxSameInvestigations:s.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations})}t.getStacktraceUniqString=v,t.finishHttpInvestigation=function(e,t,r){if(t.statusCode<500)return;const o=w(r);if(void 0===o)return void f("finishHttpInvestigation: base investigation return undefined");const n=r.getFlowId(),s=r.getMsStartTime();void 0!==n&&void 0!==r.route&&void 0!==r.method&&void 0!==s?m(o,{type:"http",endpoint_uuid:n,route:r.route,method:r.method,timestamp:s,params:e.params,query:e.query,request_body:b(e.body),status_code:t.statusCode,machine_metrics:(0,a.getMachineMetrics)(),observability_identifiers:(0,c.getObservabilityIdentifiers)(e),system_info:(0,u.getSystemInfo)()}):f("route, method, or reqTimestamp is undefined even though they shouldn't",{flowId:n,route:r.route,method:r.method,reqTimestamp:s})},t.finishSqsInvestigation=function(e,t){if(0===t.errors.size)return;const r=w(t);if(void 0===r)return void f("finishSqsInvestigation: investigation is undefined");const o=t.getFlowId(),n=t.getMsStartTime();void 0!==n&&void 0!==o?m(r,{type:"sqs",timestamp:n,flow_id:o,messages:b(e),machine_metrics:(0,a.getMachineMetrics)(),system_info:(0,u.getSystemInfo)()}):f("reqTimestamp is undefined even though it shouldn't",{flowId:o})}},2828:(e,t,r)=>{var o={"./codeGenieServerlessExpress":336,"./codeGenieServerlessExpress.ts":336,"./express":7127,"./express.ts":7127,"./express/methods":6730,"./express/methods.ts":6730,"./express/route":2977,"./express/route.ts":2977,"./express/router":4815,"./express/router.ts":4815,"./express/verbosity":7225,"./express/verbosity.ts":7225,"./expressApplication":2741,"./expressApplication.ts":2741,"./flows/endpoints/metrics":8901,"./flows/endpoints/metrics.ts":8901,"./flows/flow":9873,"./flows/flow.ts":9873,"./flows/graphql":6504,"./flows/graphql.ts":6504,"./flows/kafkajs":828,"./flows/kafkajs.ts":828,"./flows/sqs":2080,"./flows/sqs.ts":2080,"./frameworkPatcher":714,"./frameworkPatcher.ts":714,"./graphql":7214,"./graphql.ts":7214,"./http":5459,"./http.ts":5459,"./kafkajs":486,"./kafkajs.ts":486,"./koa":1502,"./koa.ts":1502,"./nestjsInterceptor":3531,"./nestjsInterceptor.ts":3531,"./nestjsRouterExecutionContext":646,"./nestjsRouterExecutionContext.ts":646,"./nestjsRpcContextCreator":4290,"./nestjsRpcContextCreator.ts":4290,"./router":5946,"./router.ts":5946,"./serverlessHttp":2729,"./serverlessHttp.ts":2729,"./sqsConsumer":5150,"./sqsConsumer.ts":5150};function n(e){var t=s(e);return r(t)}function s(e){if(!r.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}n.keys=function(){return Object.keys(o)},n.resolve=s,e.exports=n,n.id=2828},2977:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.patchRoute=void 0;const i=r(8528),a=r(8269),c=r(2546),u=s(r(6982)),l=r(8949),d=r(6730),f=r(5673);function g(e,t,r,o){!function(e,t,r,o){e[c.hudConfig.express.layerStateSymbol]||(e[c.hudConfig.express.layerStateSymbol]={}),e[c.hudConfig.express.layerStateSymbol][t]?e[c.hudConfig.express.layerStateSymbol][t].methods.push(r):e[c.hudConfig.express.layerStateSymbol][t]={layerPath:o,methods:[r]}}(e,t,r,o),function(e,t,r){const o=new i.EndpointDeclaration(e,[t],"express",void 0,void 0,r);(0,a.storePartialEndpointDeclaration)(o),(0,a.storeExpressEndpointDeclaration)(o)}(t,r,o)}function p(e,t,r){const o=new i.EndpointDeclaration(e,t,"express",void 0,r,void 0);(0,a.storeExpressEndpointDeclaration)(o)}function h(e,t){if(e&&!(e.length<1)){if(c.hudConfig.express.wrapAllCallbacks)for(let r=0;r<e.length;r++){const o=(0,l.wrapFlow)(_(t),e[r],y);e[r]=o}else{const r=(0,l.wrapFlow)(_(t),e[e.length-1],y);e[e.length-1]=r}return t}}function m(e){return(0,a.getLinkedConsistentFlowId)(e,!1)||(c.instrument_logger.warn("No consistent flowId found, returning temporary flow id",{flowId:e}),e)}function _(e){return e?function(){return m(e)}:function(e){const t=e[0]?.route[c.hudConfig.express.layerStateSymbol],r=e[0]?.url;if(t)for(const[e,o]of Object.entries(t)){if(o.layerPath instanceof RegExp&&o.layerPath.test(r))return m(e);if(r.includes(o.layerPath))return m(e)}c.instrument_logger.warn("No flowId found for path",{states:t,url:r.split("?")[0]})}}function y(e,t,r){let o=0;if(4===r.length)o=1;else if(3!==r.length)return void c.instrument_logger.error("Invalid number of arguments in express request",{length:r.length});if(!r[o])return void c.instrument_logger.error("No request object in express request");const n=r[o][c.hudConfig.metricSymbol];n?n.setFlowId(e):c.instrument_logger.error("No endpoint metric found in express request")}t.patchRoute=function(e){const t=(0,d.getMethods)();t.concat("all").forEach(function(r){const o=e.prototype[r];e.prototype[r]=function(){let e;try{e=f(Array.prototype.slice.call(arguments));let o=function(e){const t=e[0][c.hudConfig.express.layerStateSymbol];if(t)return t.flowId}(e);const n=function(e){const t=e[0][c.hudConfig.express.layerStateSymbol];if(t)return t.kind}(e),s=function(e){const t=e[0][c.hudConfig.express.layerStateSymbol];return!!t&&t.allMethod}(e);if(o||(o=[u.randomUUID()]),"application"===n)if(Array.isArray(this.path)){h(e,void 0);for(let e=0;e<this.path.length;e++)p(o[e],s?t:[r],this.path[e])}else h(e,o[0]),p(o[0],s?t:[r],this.path);else if("router"===n)if(Array.isArray(this.path)){h(e,void 0);for(let e=0;e<this.path.length;e++)g(this,o[e],r,this.path[e])}else h(e,o[0]),g(this,o[0],r,this.path);else h(e,o[0]),g(this,o[0],r,this.path)}catch(e){c.instrument_logger.error("Failed to patch express.Route.route",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o.apply(this,e||arguments)}})}},2987:e=>{"use strict";e.exports=require("perf_hooks")},3176:e=>{"use strict";e.exports=require("buffer-crc32")},3339:e=>{"use strict";e.exports=require("module")},3531:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateKey=t.getRequestByCallback=void 0;const o=r(2546);r(3702);const n=r(8949),s=r(714),i=new Map;function a(e,t){const r=Reflect.getMetadata("path",t)??Reflect.getMetadata("microservices:pattern",t);if(!r)return void o.instrument_logger.error("No callback path found on callback",{callback:t});const n=e.constructor.CONTROLLER_ID;if(n)return`${n}.${r}`;o.instrument_logger.error("No controller id found on controller",{controller:e})}t.getRequestByCallback=function(e){const t=i.get(e);return t&&i.delete(e),t},t.generateKey=a;class c extends s.FrameworkPatcher{_patch(e){return this._patchIntercept(e),o.instrument_logger.info("Patched NestJS intercept successfully"),e}_patchIntercept(e){const t=e.InterceptorsConsumer.prototype.intercept;e.InterceptorsConsumer.prototype.intercept=async function(...e){return function(e){try{const t=e[2],r=e[3];if("function"==typeof t.constructor&&"function"==typeof r){let o;if("rpc"===e[5]){if("win32"===process.platform)return;o=e[1][1].args[0]}else if(o=e[1][0],!o||o.raw)return;const n=a(t,r);if(!n)return;i.set(n,o)}else o.instrument_logger.error("Invalid args in NestJS InterceptorsConsumer.intercept",{args:e})}catch(e){o.instrument_logger.error("Error in NestJS intercept patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(e),await t.apply(this,e)},(0,n.copyPropertiesToTarget)(t,e.InterceptorsConsumer.prototype.intercept)}}t.default=c},3702:e=>{"use strict";e.exports=require("reflect-metadata")},3868:e=>{"use strict";e.exports=require("@jridgewell/sourcemap-codec")},3901:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.incrementInstrumentedFunctionsCount=t.edit=t.editInSplits=t.splitCode=t.getFunctionWrapperTemplate=void 0;const a=i(r(3176)),c=r(3903),u=r(2546),l=r(8528),d=r(8269),f=r(2546),g=r(3868),p=s(r(2784)),h=/([0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12})/;function m(e,t,r=!1){const o=`${e}_hudTemp`,n="BODY_PLACEHOLDER",s="FUNCTION_ID_PLACEHOLDER",i="AWAITABLE_PLACEHOLDER",a="EXCEPTION_VARIABLE_PLACEHOLDER",c=function(e,t,r=!1){const o=[];if(r)return o;let n;t===l.Format.cjs?n="require":t===l.Format.esm&&(o.push(`import { createRequire as ${e}_createRequire } from "module";`,`const ${e}_require = ${e}_createRequire(import.meta.url);`),n=`${e}_require`);const s=f.myRequire.resolve(u.SDK_MODULE_NAME+"/wrap");return o.push(`let ${e}_temp;`,`try { ${e}_temp = ${n}(String.raw\`${s}\`); } catch (e) { ${e}_temp = { wrapperInitial: () => {}, wrapperCatch: () => {}, wrapperFinally: () => {}, fixStack: () => {}, wrapperUserCatch: () => {} }; }`,`const { wrapperInitial: ${e}_wi, wrapperCatch: ${e}_wc, wrapperFinally: ${e}_wf, fixStack: ${e}_fs, asyncIteratorWrapper: ${e}_aiw, wrapperUserCatch: ${e}_wuc } = ${e}_temp;`),o}(e,t,r);return{functionWrapper:`{\n let ${o};\n const ${u.hudConfig.functionIdVarName} = ${s};\n const ${e}_cc = {};\n try {\n ${e}_wi(${u.hudConfig.functionIdVarName}, ${e}_cc);\n } catch (e) {\n globalThis._hud_SI = { value: 0 };\n globalThis._hud_S = [];\n }\n try {\n ${n}\n } catch (e) {\n try {\n ${e}_wc(${u.hudConfig.functionIdVarName}, ${e}_cc, e);\n } catch (e) {}\n throw e;\n } finally {\n try {\n ${e}_wf(${u.hudConfig.functionIdVarName}, ${e}_cc);\n } catch (e) {}\n }\n }`,awaitWrapper:`(${o} = ${i}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = await ${o}, _hud_S[++_hud_SI.value] = ${u.hudConfig.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})`,yieldWrapper:`\n function* ${e}_generatorWrapper() {\n return (${o} = ${i}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = yield ${o}, _hud_S[++_hud_SI.value] = ${u.hudConfig.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})\n }`,yieldStarWrapper:`\n function* ${e}_generatorWrapper() {\n return (${o} = ${i}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = yield* ${o}, _hud_S[++_hud_SI.value] = ${u.hudConfig.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})\n }`,initialStatements:c,bodyPlaceholder:n,functionIdPlaceholder:s,awaitablePlaceholder:i,fixStackFunction:`\n try{\n ${e}_fs(${u.hudConfig.functionIdVarName}, ${e}_cc)\n }catch(e){};`,exceptionVariablePlaceholder:a,wrapperUserCatch:`\n try {\n ${e}_wuc(${u.hudConfig.functionIdVarName}, ${e}_cc, ${a});\n } catch(e){};`,asyncIteratorWrapper:`${e}_aiw`,awaitableVariable:o}}function _(e,t,r=!0,o=!1){const n=Error.prepareStackTrace;let s=!1,i=function(e){const t=e.match(`${u.hudConfig.bundlerBuildIdVarName}="${h.source}"`);if(t&&t.length>0)return t[1]}(e);i||(i=function(e){return(0,c.v5)(e,u.hudConfig.bundlerBuildUuidNamespace)}(e),s=!0);const l=(0,c.v5)(e,u.hudConfig.functionUuidNamespace),d=(0,a.default)(t.filename).readUInt32BE(),f=(0,a.default)(e).readUInt32BE(),g={data:t,bundlerBuildId:i,prefix:u.hudConfig.wrapVarPrefix,...m(u.hudConfig.wrapVarPrefix,t.format,o),uuidNamespace:u.hudConfig.functionUuidNamespace,fileHash:l,useInputSourcemap:r},_=p.transform(e,g);return I(_.functionsIds.length),Error.prepareStackTrace=n,u.instrument_logger.debug(`Successfully transformed ${t.filename}`),{code:_.code,map:_.map,functionIds:_.functionsIds,filename:t.filename,hasInputMap:_.isInputSourcemap,bundlerBuildId:i,bundlerBuildIdGenerated:s,file_path_checksum:d,file_checksum:f,sourceCodeHash:l,moduleBase:_.moduleBase}}t.getFunctionWrapperTemplate=m;class y extends Error{}function v(e,t){if(e&&t)throw new y("Start mark found inside mark");if(!e&&!t)throw new y("End mark found outside mark")}function b(e,t,r,o){const n=e.split("\n");let s=r,i=o;return s+=n.length-1,s+=t.split("\n").length-1,s===r?i+=n.pop()?.length||0:i=n.pop()?.length||0,{lineOffset:s,columnOffset:i}}function*w(e){let t=!1,r=0,o=0,n=!1,s=0,i=0;const a=new RegExp(`globalThis\\s*?&&\\s*?\\(globalThis\\.${u.hudConfig.esbuildGlobalVar}\\s*?=\\s*?"(Start|End):(?<fileName>.*?)"\\);?`,"g");for(const c of e.matchAll(a)){if(n=!0,!c.groups)throw new y("No groups found in match");const{fileName:a}=c.groups,[u,l]=c,d="Start"===l;v(d,t);let f="";if(t){const t=c.index+u.length;f=e.slice(r,t);const n=o+Buffer.byteLength(f,"utf8");yield{edit:!0,code:f,fileName:a,lineOffset:s,columnOffset:i,indexOffset:o,indexOffsetEnd:n},r=t,o=n}else{const t=c.index;f=e.slice(r,t),o+=Buffer.byteLength(f,"utf8"),r=t,yield{edit:!1,code:f}}t=!!d,({lineOffset:s,columnOffset:i}=b(f,u,s,i))}if(t)throw new y("End mark found outside mark");n?r<e.length&&(yield{edit:!1,code:e.slice(r)}):yield{edit:!1,code:e}}function k(e,t,r){u.instrument_logger.debug("Edit chunk",{fileName:e.fileName,size:e.code.length,edit:t}),r?.push({fileName:e.fileName,size:e.code.length,edit:t})}function S(e,t,r){const o=_(e.code,{filename:t,format:r},!1,!0),n=o.code;return o.mapRelativeToChunk=o.map,o.map=function(e,t,r){"string"==typeof e&&(e=JSON.parse(e));const o=(0,g.decode)(e.mappings);return o.forEach(e=>{e.forEach(e=>{e.length>=4&&"number"==typeof e[2]&&("number"==typeof e[3]&&0===e[2]&&(e[3]+=r),e[2]+=t)})}),JSON.stringify({...e,mappings:(0,g.encode)(o),sourcesContent:void 0})}(o.map,e.lineOffset,e.columnOffset),{codeToAppend:n,metadata:{...o,filename:t,lineOffset:e.lineOffset,columnOffset:e.columnOffset}}}function E(e,t,r,o=!1,n=()=>!0){let s="",i=0,a=0;const c=[];let l=0;const d=o?[]:void 0,f=m(u.hudConfig.wrapVarPrefix,r).initialStatements.join("\n"),g=function(e){return e.slice(u.hudConfig.esbuildMark.length,u.hudConfig.esbuildMark.length+36)}(e);for(const o of w(e)){l++;try{let e="",u=!1;if(o.edit&&(u=n(o.fileName),d&&k(o,u,d)),o.edit&&u){const n=S(o,t,r);e=n.codeToAppend,c.push({...n.metadata,bundlerBuildId:g,transformedLineOffset:i,transformedColumnOffset:a,indexOffset:o.indexOffset,indexOffsetEnd:o.indexOffsetEnd})}else e=0===s.length?M(o.code,f):o.code;({transformedCodeLineOffset:i,transformedCodeColumnOffset:a}=C(e,i,a)),s+=e}catch(r){return u.instrument_logger.error("Failed to patch index",{index:l,filename:t,msg:r instanceof Error?r.message:void 0,stack:r instanceof Error?r.stack:void 0}),{transformedCode:e,metadatas:[],editedChunksSizes:d}}}return{transformedCode:s,metadatas:c,editedChunksSizes:d}}function M(e,t){let r="";return e.startsWith('"use strict";')?(r+='"use strict";',r+=t,r+=e.slice(13),r):(r+=t,r+=e,r)}function C(e,t,r){const o=e.split("\n");return o.length>1?(t+=o.length-1,r=o.pop()?.length||0):r+=e.length,{transformedCodeLineOffset:t,transformedCodeColumnOffset:r}}t.splitCode=w,t.editInSplits=E,t.edit=function(e,t,r){if(e.startsWith(u.hudConfig.esbuildMark))return u.instrument_logger.info("Editing in splits"),E(e,t,r,!1);{const o=_(e,{filename:t,format:r},u.hudConfig.userConfig.disableSourceMapsResolution?.value??!0);return{transformedCode:o.code,metadatas:[o]}}};let x=0;function I(e){x+=e;const t=u.hudConfig.userConfig?.maxMappedFunctions?.value??0;x>=t&&(u.customer_logger.log(u.UserErrorLogs.InstrumentedFunctionCountExceeded(t)),u.app_logger.error("Instrumented function count exceeded",{instrumentedFunctionsCount:x,maxMappedFunctions:t}),(0,d.detachHud)(!1,!1))}t.incrementInstrumentedFunctionsCount=I},3903:e=>{"use strict";e.exports=require("uuid")},4290:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(8949),s=r(714),i=r(3531);class a extends s.FrameworkPatcher{_patch(e){return this._patchCreate(e),o.instrument_logger.info("Patched NestJS RpcContextCreator successfully"),e}_patchCreate(e){const t=e.RpcContextCreator.prototype.create;e.RpcContextCreator.prototype.create=function(...e){try{const t=e[0],r=e[1];if("function"==typeof t.constructor&&"function"==typeof r){const s=(0,i.generateKey)(t,r);s&&(e[1]=(0,n.wrapFlow)(()=>{try{const e=(0,i.getRequestByCallback)(s);if(!e)return void o.instrument_logger.error("No msg object found for key",{key:s});const t=function(e){if(e)return e[o.hudConfig.metricSymbol]?e[o.hudConfig.metricSymbol].getFlowId?e[o.hudConfig.metricSymbol].getFlowId():void o.instrument_logger.error("No getFlowId function found on metric object"):void o.instrument_logger.error("No metric found on nestjs msg object")}(e);return t||o.instrument_logger.error("No flow id found for key",{key:s}),t}catch(e){o.instrument_logger.error("Error in NestJS getFlowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}},r))}else o.instrument_logger.error("Invalid args in NestJS RpcContextCreator.create",{args:e})}catch(e){o.instrument_logger.error("Error in NestJS RpcContextCreator patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,e)},(0,n.copyPropertiesToTarget)(t,e.RpcContextCreator.prototype.create)}}t.default=a},4815:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.extractEndpointsFromRouter=t.patchUse=void 0;const i=r(8528),a=r(2546),c=s(r(6982)),u=r(8949),l=r(7225),d=r(5673);function f(e){e[a.hudConfig.express.markedSymbol]||(globalThis.hudExpressState.push(e),e[a.hudConfig.express.markedSymbol]=!0)}function g(e,t){const r=[];for(const[o,n]of Object.entries(e.route[a.hudConfig.express.layerStateSymbol]))r.push(new i.EndpointDeclaration(o,n.methods,"express",t,n.layerPath));return Array.from(r.values())}t.patchUse=function(e,t,r=!0){const o=e.use;e.use=function(e){const n=o.apply(this,arguments);try{let o=this[l.uuidSymbol];!o&&l.isVerboseLoggingEnabled&&(o=c.randomUUID(),this[l.uuidSymbol]=o,a.instrument_logger.info("Express use setting uuid",{kind:t,uuid:o})),"application"===t?function(e,t,r,o){try{r&&(e._router?f(e._router):e.router?f(e.router):a.instrument_logger.warn("Express application doesn't have router or _router")),o&&l.isVerboseLoggingEnabled&&a.instrument_logger.info("Express use app",{parent:o,child:t[1]?.[l.uuidSymbol]||"no uuid",path:t[0]})}catch(e){a.instrument_logger.error("Failed to save express app router",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(this,arguments,r,o):"router"===t&&function(e,t,r,o,n){try{if(!e.stack)return void a.instrument_logger.error("Express router without stack");if(0===e.stack.length)return void a.instrument_logger.warn("Express router with an empty stack");"query"===e.stack[0].name?f(e):l.isVerboseLoggingEnabled&&!l.skipLayerNamesLogs.has(e.stack[0].name)&&(l.skipLayerNamesLogs.add(e.stack[0].name),a.instrument_logger.warn("Found unknown stack name",{stack:e.stack[0].name}));const{path:s,offset:i}=function(e){let t=0,r="/";if("function"!=typeof e){let o=e;for(;Array.isArray(o)&&0!==o.length;)o=o[0];"function"!=typeof o&&(t=1,r=e)}return{path:r,offset:t}}(n),u=d(Array.prototype.slice.call(t,i));for(let t=0;t<u.length&&t<e.stack.length;t++){const n=e.stack[e.stack.length-t-1],i=u[u.length-t-1];"router"===n.name?(i&&!i[l.uuidSymbol]&&l.isVerboseLoggingEnabled&&(i[l.uuidSymbol]=c.randomUUID(),a.instrument_logger.info("Express handle router setting uuid",{uuid:i[l.uuidSymbol]})),r&&(n[a.hudConfig.express.routeNamesSymbol]=s)):l.isVerboseLoggingEnabled&&!l.skipLayerNamesLogs.has(n.name)&&(l.skipLayerNamesLogs.add(n.name),a.instrument_logger.warn("Found unknown layer name",{layer:n.name,parent:o,child:i[l.uuidSymbol]||"no uuid",path:s}))}}catch(e){a.instrument_logger.error("Failed to patch router.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(this,arguments,r,o,e)}catch(e){a.instrument_logger.error("Failed to patch express.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return n},(0,u.copyPropertiesToTarget)(o,e.use)},t.extractEndpointsFromRouter=function e(t,r){let o=[];if(!r.stack)return a.instrument_logger.error("Router without stack - bad OTEL version",{router:r}),o;for(const n of r.stack)if("router"===n.name){if(!n[a.hudConfig.express.routeNamesSymbol]){a.instrument_logger.error("Router layer without routes",{layer:n});continue}const r=t+n[a.hudConfig.express.routeNamesSymbol];o=o.concat(e(r,n.handle))}else n.route&&n.route[a.hudConfig.express.layerStateSymbol]?o=o.concat(g(n,t)):l.isVerboseLoggingEnabled&&!l.skipLayerNamesLogs.has(n.name)&&(l.skipLayerNamesLogs.add(n.name),a.instrument_logger.warn("Found unknown layer name when extracting endpoints",{layer:n.name}));return o}},5150:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8269),n=r(2546),s=r(7131),i=r(2822),a=r(8949),c=r(2080),u=r(714);class l extends u.FrameworkPatcher{isSupported(e,t,r,o){const s=n.hudConfig.userConfig.enableDapulse?.value?o.mondayVersion:o.bbcVersion,i=(0,u.extractModuleVersion)(e);return!!(0,u.isSupportedVersion)(i,s)||(n.instrument_logger.warn("Unsupported sqs-consumer version",{framework:"SqsConsumer",version:i,supportedVersion:s,basedir:e,isDapulse:n.hudConfig.userConfig.enableDapulse?.value}),n.customer_logger.log(n.UserErrorLogs.UnsupportedFrameworkVersion("sqs-consumer")),!1)}_patch(e){return function(e){const t=e.Consumer.create;e.Consumer.create=function(...e){const r=t.apply(this,e);try{!function(e){const t=e.queueUrl;if(!t)throw new n.HudNoQueueUrlInSqsConsumer;const r=g(t);if(e.handleMessageBatch&&"function"==typeof e.handleMessageBatch){const t="handleMessageBatch",s=(0,n.generateSqsFlowId)(r,t);(0,o.storeSqsQueueDeclaration)({flow_id:s,queue_name:r,handle_type:t,batch_size:e.batchSize});const i=e.handleMessageBatch,c=(0,a.wrapFlow)(()=>s,i,p);return void(e.handleMessageBatch=c)}if(e.handleMessage&&"function"==typeof e.handleMessage){const t="handleMessage",s=(0,n.generateSqsFlowId)(r,t);(0,o.storeSqsQueueDeclaration)({flow_id:s,queue_name:r,handle_type:t});const i=e.handleMessage,c=(0,a.wrapFlow)(()=>s,i,p);return void(e.handleMessage=c)}n.instrument_logger.warn("Unable to getFlowId - No handleMessage or handleMessageBatch found in SqsConsumer.Consumer",{queueName:r})}(r),function(e){const t=e.on;e.on=function(...r){try{const t=r[0];if(!t||"string"!=typeof t)throw new n.HudNoEventTypeInSqsConsumerOn;const s=r[1];if(!s||"function"!=typeof s)throw new n.HudNoCallbackInSqsConsumerOn;const i=g(e.queueUrl),c="event",u=(0,n.generateSqsFlowId)(i,c,t);(0,o.storeSqsQueueDeclaration)({flow_id:u,queue_name:i,handle_type:c,event_type:t}),r[1]=(0,a.wrapFlow)(()=>u,s,h,m,_)}catch(e){n.instrument_logger.error("Error in SqsConsumer.Consumer.on patched logic",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,r)},(0,a.copyPropertiesToTarget)(t,e.on)}(r),function(e){const t=e.emit;e.emit=function(...e){return function(e){try{const t=e[0];if(!t||"string"!=typeof t)throw new n.HudNoEventTypeInSqsConsumerEmit;let r,o;if("message_processed"===t&&(r=1),["error","timeout_error","processing_error"].includes(t)&&(o=1,r=2),void 0===r)return;const a=e[r];if(!a)throw new n.HudNoMessageInSqsConsumerEmit;let c;if(void 0!==o){const t=e[o];if(!(t&&t instanceof Error))throw new n.HudNoErrorInSqsConsumerEmit;c=(0,s.extractName)(t),"StandardError"===c&&t.cause&&t.cause instanceof Error&&(c=(0,s.extractName)(t.cause))}const u=(e,t)=>{const r=e[n.hudConfig.metricSymbol];r?(c&&r.addError(c,t),r.increaseAndShouldEnd(t)&&(r.end(),(0,i.finishSqsInvestigation)(Array.isArray(a)?a:[a],r))):f||(f=!0,n.instrument_logger.warn("No metric found for message"))};Array.isArray(a)&&a.length>=1?u(a[0],a.length):u(a,1)}catch(e){d||(d=!0,n.instrument_logger.error("Error in SqsConsumer.Consumer.emit patched logic",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}))}}(e),t.apply(this,e)},(0,a.copyPropertiesToTarget)(t,e.emit)}(r)}catch(e){n.instrument_logger.error("Error in patching SqsConsumer.Consumer",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r},(0,a.copyPropertiesToTarget)(t,e.Consumer.create)}(e),n.instrument_logger.info("Patched sqs-consumer successfully",{isDapulse:n.hudConfig.userConfig.enableDapulse?.value}),e}}t.default=l;let d=!1,f=!1;function g(e){const t=e.split("/").pop();if(!t)throw new n.HudFailExtractSqsQueueName(`Url: ${e}`);return t}function p(e,t,r){const o=c.SqsMetric.createUsableMetric(e);o.start();const s=r[0];if(!s)return n.instrument_logger.warn("No messages pass to sqs handler",{flowId:e}),void(t.flowMetric=o);if(Array.isArray(s)){if(o.msgCount=s.length,s.forEach(e=>{e[n.hudConfig.metricSymbol]=o}),s[0]?.Attributes?.SentTimestamp){const t=s.reduce((e,t)=>{const r=Number.parseInt(t?.Attributes?.SentTimestamp);return isNaN(r)?e:Math.min(e,r)},1/0);t!==1/0?o.e2eEpocStartTimeMS=t:n.instrument_logger.warn("No valid SentTimestamp found eventhough the first element had SentTimestamp",{flowId:e})}}else o.msgCount=1,s[n.hudConfig.metricSymbol]=o,s?.Attributes?.SentTimestamp&&(o.e2eEpocStartTimeMS=s.Attributes.SentTimestamp);t.flowMetric=o,(0,i.createNewInvestigation)()}function h(e,t,r){const o=c.SqsMetric.createUsableMetric(e);o.start(),t.flowMetric=o}function m(e,t){const r=t.flowMetric;r?r.end():n.instrument_logger.warn("No flowMetric found for message during catch",{flowId:e})}function _(e,t,r){const o=t.flowMetric;o?(o.addError((0,s.extractName)(r)),o.end()):n.instrument_logger.warn("No flowMetric found for message during catch",{flowId:e})}},5459:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(2822),s=r(8949),i=r(8901),a=r(714);class c extends a.FrameworkPatcher{_patch(e){return this._patchEmit(e),o.instrument_logger.info("Patched http successfully"),e}_patchEmit(e){const t=e.Server.prototype.emit;e.Server.prototype.emit=function(e,...r){if("request"!==e)return t.apply(this,[e,...r]);try{const e=r[0],t=r[1],s=i.HttpEndpointMetric.createUsableMetric();s.start(),(0,n.createNewInvestigation)(),s.setRequestAttributes(e),t.once("finish",function(){try{(0,n.finishHttpInvestigation)(e,t,s),s.setResponseAttributes(t),s.end()}catch(e){o.instrument_logger.error("Failed to set response attributes",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),e[o.hudConfig.metricSymbol]=s}catch(e){o.instrument_logger.error("Failed to patch http.Server.prototype.emit",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,[e,...r])},(0,s.copyPropertiesToTarget)(t,e.Server.prototype.emit)}}t.default=c},5673:e=>{"use strict";e.exports=require("array-flatten")},5688:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerHook=t.safeLog=t.hudRITM=void 0;const o=r(8269),n=r(2546),s=r(7166);function i(){n.instrument_logger.warn("Init timeout disabling hud!"),n.customer_logger.log(n.UserErrorLogs.InitTimeout(globalThis.hudIsRunningFromSetup)),(0,o.detachHud)(!1)}t.hudRITM=s.onRequireFn,t.safeLog=function(e){try{n.app_logger.debug(e)}catch(e){return}},t.registerHook=function(){if(n.app_logger.info("HUD is required"),process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE){if(n.app_logger.info("Running in Lambda environment"),parseInt(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE)<n.hudConfig.lambdaMinimunMemory){const e=process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE;return n.app_logger.warn("Lambda function memory size is less than required, Hud will not run",{memorySize:e}),n.customer_logger.log(n.UserErrorLogs.UnsupportedLambdaMemory()),!1}globalThis.hudRuningInsideLambda=!0}return(0,o.initGlobals)(),n.app_logger.debug("InitGlobals done"),!(globalThis.hudStartFromAutoInit&&!(0,o.validateAndGetUserInput)()||(n.instrument_logger.isValid()?globalThis.hudRanOnRequire?(n.instrument_logger.warn("Already ran onRequire!"),1):(globalThis.hudRanOnRequire=!0,n.instrument_logger.info("Using module",{name:n.SDK_MODULE_NAME}),(0,s.onRequire)(),n.instrument_logger.debug("onRequire done"),globalThis.hudInitGuard=setTimeout(i,n.hudConfig.userConfig.maxTimeUntilInitSessionMs?.value??0),globalThis.hudInitGuard.unref(),0):((0,o.detachHud)(!1),1)))}},5946:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(6730),s=r(4815),i=r(714);class a extends i.FrameworkPatcher{_patch(e){return(0,s.patchUse)(e.prototype,"router"),(0,n.patchMethods)(e.prototype,"router"),o.instrument_logger.info("Patched router successfully"),e}}t.default=a},6093:e=>{"use strict";e.exports=require("@cspotcode/source-map-support")},6504:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLMetric=void 0;const o=r(9873);class n extends o.FlowMetric{constructor(e){super(e)}_createUsableMetric(e){return this}toRaw(){return{flow_id:this.flowId,type:"GraphQLMetric",duration:this.duration}}}t.GraphQLMetric=n},6730:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.patchMethods=t.getMethods=void 0;const i=r(2546),a=s(r(6982)),c=r(8949),u=r(7225);function l(){const e=r(8611);return e.METHODS&&e.METHODS.map(function(e){return e.toLowerCase()})||["get","post","put","head","delete","options","trace","copy","lock","mkcol","move","purge","propfind","proppatch","unlock","report","mkactivity","checkout","merge","m-search","notify","subscribe","unsubscribe","patch","search","connect"]}t.getMethods=l,t.patchMethods=function(e,t){l().concat("all").forEach(function(r){const o=e[r];if(!o)return void(u.isVerboseLoggingEnabled&&i.instrument_logger.warn("Method not found",{method:r}));const n="all"===r;e[r]=function(){try{if(arguments.length<2)return o.apply(this,arguments);let e=this[u.uuidSymbol];u.isVerboseLoggingEnabled&&(e||(e=a.randomUUID(),this[u.uuidSymbol]=e,i.instrument_logger.info("Express method setting uuid",{uuid:e,kind:t})),i.instrument_logger.info("Express added new method",{method:r,uuid:e,path:arguments[0]}));const s=Array.prototype.slice.call(arguments);if(s[1][i.hudConfig.express.layerStateSymbol]={flowId:[],kind:t,allMethod:n},Array.isArray(s[0]))for(const e of s[0]){const e=a.randomUUID();s[1][i.hudConfig.express.layerStateSymbol].flowId.push(e)}else s[1][i.hudConfig.express.layerStateSymbol].flowId.push(a.randomUUID());const c=o.apply(this,s);try{delete s[1][i.hudConfig.express.layerStateSymbol]}catch(e){}return c}catch(e){i.instrument_logger.error("Failed to patch method",{kind:t,method:r,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o.apply(this,arguments)},(0,c.copyPropertiesToTarget)(o,e[r])})}},6928:e=>{"use strict";e.exports=require("path")},6982:e=>{"use strict";e.exports=require("crypto")},7127:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(6730),s=r(2977),i=r(4815),a=r(7225),c=r(714);class u extends c.FrameworkPatcher{_patch(e){return(0,s.patchRoute)(e.Route),(0,i.patchUse)(e.application,"application"),(0,n.patchMethods)(e.application,"application"),a.isVerboseLoggingEnabled&&(0,a.logLazyRouter)(e.application),e.Router.use?((0,i.patchUse)(e.Router,"router"),(0,n.patchMethods)(e.Router,"router")):o.instrument_logger.warn("Skipping express.Router patching"),o.instrument_logger.info("Patched express successfully"),e}}t.default=u},7131:e=>{"use strict";e.exports=require("./wrap")},7166:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.onRequire=t.skip=t.updateModuleChecker=t.createCheckers=t.patchRequire=t.onRequireFn=t.patchCompile=t.patch=t.supportSourceMapInstall=void 0;const i=s(r(9896)),a=s(r(6928)),c=r(8528),u=r(2546),l=r(3901),d=r(8528),f=r(8269),g=r(2546),p=r(9063),h=r(714),m=function(){const e=g.SDK_MODULE_NAME;try{return a.dirname(a.dirname(g.myRequire.resolve(e)))}catch(t){return u.instrument_logger.error("Failed to resolve own path",{moduleName:e,msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0}),null}}();function _(e){const t=globalThis.HudSourceMapCache.get(e);return t?{map:JSON.parse(t)}:null}function y(){r(6093).install({handleUncaughtExceptions:!1,hookRequire:!1,environment:"node",retrieveSourceMap:_})}function v(e,t,r,o){const n={code:e,map:void 0};try{if(globalThis.hudRunningMode===d.HudRunningMode.detached)return n;if(r===c.Format.esm&&!o)throw new g.HudError("MessagePort is required for patching ESM modules");if(T(t));else if(e.length>(g.hudConfig.userConfig.maxFileSizeBytes?.value??0)&&!e.startsWith(g.hudConfig.esbuildMark))u.instrument_logger.info("Skipping large file",{filename:t,size:e.length});else{const s=Date.now(),c=(0,l.edit)(e,t,r),d=c.metadatas;if(n.code=c.transformedCode,n.map=d,u.instrument_logger.debug("Patched",{filename:t,time:Date.now()-s}),o)for(const e of d)o.postMessage({key:"HudModulePatch",hudPatched:t,hudProcessedFiles:e});else globalThis.hudPatched.add(t),globalThis.hudProcessedFiles.push(...d),globalThis.hudDeclarationsFound=!0,globalThis.hudInstrumentationIndicator&&(clearTimeout(globalThis.hudInstrumentationIndicator),globalThis.hudInstrumentationIndicator=void 0);g.hudConfig.writePatched&&function(e,t){const r=a.parse(e);let o=`${r.dir}/patched.${r.base}`;r.dir.includes("dist")&&(o=a.join(`${r.dir.replace("dist","patched")}`,r.base)),i.existsSync(a.dirname(o))||i.mkdirSync(a.dirname(o),{recursive:!0}),i.writeFileSync(o,t,"utf8"),u.instrument_logger.debug("Dumped patched file",{filename:e,patchedPath:o})}(t,c.transformedCode)}}catch(e){u.instrument_logger.error("Failed to patch",{filename:t,format:r,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return n}t.supportSourceMapInstall=y,t.patch=v;let b="",w=!0,k=!1;function S(){if(!(0,g.isSupportedNative)())return;const e=r(3339),t=(0,u.shouldSupportSourceMap)();k&&u.instrument_logger.warn("PatchCompile ran twice"),0===Object.keys(globalThis.hudLoadedModules).length&&(globalThis.hudLoadedModules=Object.keys(g.myRequire.cache));const o=e.prototype._compile;e.prototype._compile=function(e,r){if(r===b){try{const e=w?u.instrument_logger.warn.bind(u.instrument_logger):u.instrument_logger.debug.bind(u.instrument_logger);w=!1,e("Skipping compile since already ran",{filename:r})}catch{}return o.call(this,e,r)}b=r,u.instrument_logger.verbose("Compiling requirement",{filename:r});const n=v(e,r,c.Format.cjs);try{if(t&&n.map){const e=(0,u.combineSourceMaps)(n.map,r);e&&globalThis.HudSourceMapCache.set(r,e)}}catch(e){u.instrument_logger.error("Failed to combine source maps",{filename:r,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const s=o.call(this,n.code,r);return b="",s},k=!0,u.instrument_logger.debug("Patched _compile")}function E(e,t,r){try{const o=g.hudConfig.frameworksToPatch.get(t);return o?.patcher&&o.version?(0,h.getFrameworkPatcher)(o.patcher).patch(e,r,o.version,o.extraInfo,t):e}catch(e){u.instrument_logger.error("Failed to patch framework",{name:t,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}function M(){new p.Hook(Array.from(g.hudConfig.frameworksToPatch.keys()),{internals:!0},E)}function C(e){const t=a.sep.replace(/\\/g,"\\\\"),r=a.join(e),o=t+"node_modules"+t;return{isAllowdModule:new RegExp(o+r.split(".").join("\\.").split("*").join(".*?")+t,""),isAllowdModuleSubModule:new RegExp(o+r.split("*").join(".*?")+o,"")}}function x(e,t){return!!t.isAllowdModule.test(e)&&!t.isAllowdModuleSubModule.test(e)}function I(e,t){return e.includes(`node_modules${a.sep}${t}${a.sep}`)&&!e.includes(`node_modules${a.sep}${t}${a.sep}node_modules`)}function O(e){const t=[];for(const r of e){let e;if(r.includes("*")){const t=C(r);e=e=>x(e,t)}else e=e=>I(e,r);t.push(e)}return t}t.patchCompile=S,t.onRequireFn=E,t.patchRequire=M,t.createCheckers=O;let P=[];function F(){P=O(g.hudConfig.userConfig.includeModules?.value??[])}function T(e,t){if(!g.hudConfig.allowedEditExtensions.includes(a.extname(e)))return u.instrument_logger.warn("Skipping non-allowed extension",{filename:e}),!0;const r=t??P;return"/var/runtime/index.mjs"===e?(u.instrument_logger.debug("Skipping lambda runtime",{filename:e}),!0):e.includes("node_modules")&&!function(e,t){for(const r of t)if(r(e))return!0;return!1}(e,r)||e.includes(".yarn")?(u.instrument_logger.debug("Skipping non-monitored imported module",{filename:e}),!0):!(m&&!e.includes(m)||(u.instrument_logger.debug("Skipping hud internal module",{filename:e}),0))}t.updateModuleChecker=F,t.skip=T,t.onRequire=function(){try{F();try{S()}catch(e){u.instrument_logger.error("Failed to patch compile",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{(0,u.shouldSupportSourceMap)()&&y()}catch(e){u.instrument_logger.error("Failed to install source map support",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{M()}catch(e){u.instrument_logger.error("Failed to patch require",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}catch(e){u.instrument_logger.error("Something went wrong in onRequire",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{(0,f.saveMachineMetric)()}catch(e){u.instrument_logger.error("Failed to add metric",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}},7214:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8528),n=r(8269),s=r(2546),i=r(8949),a=r(6504),c=r(714);class u extends c.FrameworkPatcher{static graphQLPatchedSymbol=Symbol.for(s.hudConfig.hudPatchedName);_patch(e){return this.patchGraphql(e),s.instrument_logger.info("Patched GraphQL successfully"),e}patchGraphql(e){const t=e.execute;e.execute=function(e){!function(e){try{e&&!e[u.graphQLPatchedSymbol]&&(l(e._queryType),l(e._mutationType),e[u.graphQLPatchedSymbol]=!0,s.instrument_logger.info("Patched GraphQL schema successfully"))}catch(e){s.instrument_logger.error("Failed to patch GraphQL schema",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(e.schema);const r=process.hrtime.bigint();return function(e,t,r){return"function"==typeof e.then?e.then(e=>(p(t,r),e)):(p(t,r),e)}(t.apply(this,arguments),e.document,r)},(0,i.copyPropertiesToTarget)(t,e.execute)}}function l(e){if(!e)return;const t=e._fields;Object.keys(t).forEach(r=>{const c=t[r];!function(e,t,r){if(e.resolve&&!e.resolve[u.graphQLPatchedSymbol]){const o=(0,s.generateGraphqlFlowId)(r,t);(0,n.storeResolverDeclaration)({id:o,operation:t,name:r});const c=e.resolve;e.resolve=(0,i.wrapFlow)(g,c,(e,t)=>{const r=a.GraphQLMetric.createUsableMetric();r.start(),r.setFlowId(e),t.flowMetric=r},(e,t)=>{const r=t.flowMetric;r?r.end():s.instrument_logger.warn("No flowMetric found for resolver",{flowId:e})},(e,t)=>{const r=t.flowMetric;r?r.end():s.instrument_logger.warn("No flowMetric found for resolver",{flowId:e})}),e.resolve[u.graphQLPatchedSymbol]=!0,(0,n.storeResolverIdBySelectionName)(o,r)}}(c,o.GraphQLSupportedOperations[e.name.toLowerCase()],r),c.type._fields&&f(c.type)})}t.default=u;const d=new WeakSet;function f(e){e&&e._fields&&!d.has(e)&&(d.add(e),Object.keys(e._fields).forEach(t=>{const r=e._fields[t];if(!r||!r.type)return;!function(e){const t=e.resolve;t&&!e.resolve[u.graphQLPatchedSymbol]&&(e.resolve=(0,i.wrapFlow)(g,t),e.resolve[u.graphQLPatchedSymbol]=!0)}(r);let o=r.type;for(;o.ofType;)o=o.ofType;f(o)}))}function g(e){if(void 0===e[2]||void 0===e[3])return void s.instrument_logger.warn("GraphQL resolver arguments are unknown",{args:e});const t=e[3].path;if(t&&!t.prev){const r=t.key,o=(0,n.getResolverIdBySelectionName)(r);return e[2][u.graphQLPatchedSymbol]=o,o}if(e[2][u.graphQLPatchedSymbol])return e[2][u.graphQLPatchedSymbol];s.instrument_logger.warn("GraphQL No functionId found for resolver",{args:e})}function p(e,t){try{new n.GraphQLDocumentMetadata(e,Number(process.hrtime.bigint()-t)).save()}catch(e){s.instrument_logger.error("Failed to save document metadata",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}},7225:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.logLazyRouter=t.skipStackNamesLogs=t.skipLayerNamesLogs=t.isVerboseLoggingEnabled=t.uuidSymbol=void 0;const i=r(2546),a=s(r(6982)),c=r(932),u=r(8949);t.uuidSymbol=Symbol.for("__hud_uuid__"),t.isVerboseLoggingEnabled="true"===c.env.HUD_LOG_EXPRESS,t.skipLayerNamesLogs=new Set(["query","expressInit","mounted_app"]),t.skipStackNamesLogs=new Set(["router"]),t.logLazyRouter=function(e){const r=e.lazyrouter;e.lazyrouter=function(){let e=!1;try{this._router||(e=!0)}catch(e){i.instrument_logger.error("Failed to check this._router",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const o=r.apply(this,arguments);try{if(e){let e=this[t.uuidSymbol];e||(e=a.randomUUID(),this[t.uuidSymbol]=e,i.instrument_logger.info("Express lazy router setting uuid",{uuid:e})),i.instrument_logger.info("Express lazy router",{parent:e,child:this._router?.[t.uuidSymbol]})}}catch(e){i.instrument_logger.error("Failed to patch express.lazyRouter function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o},(0,u.copyPropertiesToTarget)(r,e.lazyrouter)}},7603:(e,t)=>{"use strict";function r(e){try{return e.headers["x-amzn-trace-id"]}catch{return}}function o(e){try{return e.headers.traceparent}catch{return}}function n(e){try{return e.headers["x-datadog-trace-id"]}catch{return}}Object.defineProperty(t,"__esModule",{value:!0}),t.getObservabilityIdentifiers=void 0,t.getObservabilityIdentifiers=function(e){return{datadog_trace_id:n(e),otel_trace_id:o(e),amazon_trace_id:r(e)}}},7707:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncFunction=void 0,t.AsyncFunction=(async()=>{}).constructor},7808:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getCpuUsage=t.getMachineMetrics=void 0;const n=r(8269),s=r(2546),i=o(r(857)),a=r(2987);function c(e){try{return a.performance.eventLoopUtilization(e).utilization}catch(e){return void s.app_logger.error("Error getting event loop utilization",e)}}function u(){try{const e=process.memoryUsage(),t=i.default.totalmem();return{rss:e.rss,heap_total:e.heapTotal,heap_used:e.heapUsed,external:e.external,system_memory:t,rss_percentage:e.rss/t*100}}catch(e){return void s.app_logger.error("Error getting memory usage",e)}}function l(e,t){try{const r=process.cpuUsage(),o=1e3*(Date.now()-t),n=(0,s.getCpuLimit)(s.app_logger),i=(r.user-e.user)/o,a=(r.system-e.system)/o;return{user_time:i,system_time:a,limit:n,user_percent_of_limit:"number"==typeof n?i/n*100:void 0,system_percent_of_limit:"number"==typeof n?a/n*100:void 0}}catch(e){return void s.app_logger.error("Error getting cpu usage",e)}}t.getMachineMetrics=function(){try{const e=(0,n.getLastMetrics)();return{cpu_usage:e.cpuUsage?l(e.cpuUsage,e.timestamp):void 0,memory_usage:u(),event_loop_utilization:e.elu?c(e.elu):void 0}}catch(e){return void s.app_logger.error("Error getting machine metrics",e)}},t.getCpuUsage=l},8064:e=>{"use strict";e.exports=require("semver")},8269:e=>{"use strict";e.exports=require("./globalstate")},8528:e=>{"use strict";e.exports=require("./dto")},8611:e=>{"use strict";e.exports=require("http")},8901:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpEndpointMetric=void 0;const o=r(9873);class n extends o.FlowMetric{statusCode;route;method;constructor(e){super(e)}_createUsableMetric(e){return this}setRequestAttributes(e){const t=e.url||e.path;this.route=t?.split("?")[0],this.method=e.method}setResponseAttributes(e){this.statusCode=e.statusCode}toRaw(){if(this.statusCode&&this.route&&this.method)return{flow_id:this.flowId,type:"EndpointMetric",duration:this.duration,status_code:this.statusCode,route:this.route,method:this.method}}}t.HttpEndpointMetric=n},8949:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.copyPropertiesToTarget=t.wrapFlow=void 0;const o=r(8528),n=r(2546),s=r(7707);function i(e,t){const r=Object.getOwnPropertyDescriptors(e),o=Reflect.ownKeys(r);Object.setPrototypeOf(t,e),o.forEach(e=>{try{Object.defineProperty(t,e,r[e])}catch(e){}})}t.wrapFlow=function(e,t,r,a,c){let u;return u=t instanceof s.AsyncFunction?async function(...s){let i;try{i=e(s)}catch(e){n.instrument_logger.error("Failed to get flowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}if(!i||hudRunningMode!==o.HudRunningMode.enabled)return await t.apply(this,s);_hud_F=i,hudShouldLinkFunction=!0;const u={};if(r)try{r(i,u,s)}catch(e){n.instrument_logger.error("Failed to execute beforeCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{const e=t.apply(this,s);_hud_F="";const r=await e;if(a)try{a(i,u)}catch(e){n.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r}catch(e){if(c)try{c(i,u,e)}catch(e){n.instrument_logger.error("Failed to execute catchCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}throw e}finally{_hud_F="",hudShouldLinkFunction=!1}}:function(...s){let i;try{i=e(s)}catch(e){n.instrument_logger.error("Failed to get flowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}if(!i||hudRunningMode!==o.HudRunningMode.enabled)return t.apply(this,s);_hud_F=i,hudShouldLinkFunction=!0;const u={};if(r)try{r(i,u,s)}catch(e){n.instrument_logger.error("Failed to execute beforeCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{const e=t.apply(this,s);if(a)if(e instanceof Promise)e.then(()=>{try{a(i,u)}catch(e){n.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}});else try{a(i,u)}catch(e){n.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}catch(e){if(c)try{c(i,u,e)}catch(e){n.instrument_logger.error("Failed to execute catchCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}throw e}finally{_hud_F="",hudShouldLinkFunction=!1}},i(t,u),u},t.copyPropertiesToTarget=i},9063:e=>{"use strict";e.exports=require("require-in-the-middle")},9873:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FlowMetric=void 0;const n=r(8528),s=r(8269),i=o(r(932));t.FlowMetric=class{_state;flowId;duration;_startTime;_msStartTime;constructor(e){this.flowId=e,this.duration=0,this._state="usable"}static createUsableMetric(e){return new this(e)._createUsableMetric(e)}setFlowId(e){this.flowId=e}getFlowId(){return this.flowId}getMsStartTime(){return this._msStartTime}start(){this._startTime=i.default.hrtime.bigint(),this._msStartTime=Date.now()}end(){this._startTime&&(this.duration=Number(i.default.hrtime.bigint()-this._startTime)),this.#e(),this._state="unusable"}#e(){if(hudRunningMode===n.HudRunningMode.enabled){const e=this.toRaw();e&&(0,s.storeFlowMetric)(e)}}}},9896:e=>{"use strict";e.exports=require("fs")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}return r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r(2197)})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(global,()=>(()=>{var e={336:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(2822),s=r(8949),i=r(8901),a=r(714);class c extends a.FrameworkPatcher{_patch(e){return this._patchSendRequest(e),o.instrument_logger.info("Patched @codegenie/serverless-express/src/frameworks/express.js successfully"),e}_patchSendRequest(e){const t=e.sendRequest;e.sendRequest=function(e){let r,s;const a=i.HttpEndpointMetric.createUsableMetric();try{if(r=e.request,s=e.response,!r||!s)return t.call(this,e);a.start(),a.setRequestAttributes(r),r[o.hudConfig.metricSymbol]=a}catch(e){o.instrument_logger.error("Failed to start flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const c=(0,n.runWithInvestigation)(()=>t.call(this,e));try{s.once("finish",function(){try{(0,n.finishHttpInvestigation)(r,s,a),a.setResponseAttributes(s),a.end()}catch(e){o.instrument_logger.error("Failed to end flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}})}catch(e){o.instrument_logger.error("Failed to end flowMetric during sendRequest patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return c},(0,s.copyPropertiesToTarget)(t,e.sendRequest)}}t.default=c},486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8269),n=r(2546),s=r(8949),i=r(828),a=r(714);class c extends a.FrameworkPatcher{_patch(e){return this._patchConsumer(e),n.instrument_logger.info("Patched KafkaJS successfully"),e}_patchConsumer(e){const t=e.Kafka.prototype.consumer;e.Kafka.prototype.consumer=function(...e){const r=t.apply(this,e);try{const t=new Map,o=[],a=[];!function(e,t){const r=e.subscribe;e.subscribe=async function(...e){const o=await r.apply(this,e);try{const r=e[0].topics;r?r.forEach(e=>{t.push(e)}):e[0].topic?t.push(e[0].topic):n.instrument_logger.warn("No topic found in KafkaJS.Consumer.subscribe",{args:e[0]})}catch(e){n.instrument_logger.error("Error in patching KafkaJS.Consumer.subscribe",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o},(0,s.copyPropertiesToTarget)(r,e.subscribe)}(r,a),function(e,t,r,o,a){const c=e.run;function g(e,c){const g="eachBatch"===c;for(const e of a)f(e,o,t,r,c);const p=function(e,t,r){return o=>{const s=o[0],i=r?s.batch.topic:s.topic;return function(e,t,r,o){const s=e.get(d(r,o));if(s)return s;for(const e of t)if(e.isBatch===o&&e.pattern.test(r))return e.flowId;n.instrument_logger.warn("No flowId found for topic",{topicName:r,isBatch:o})}(e,t,i,r)}}(t,r,g),h=function(e){return(t,r,o)=>{const s=i.KafkaJSMetric.createUsableMetric();s.start(),s.setFlowId(t);const a=o[0];void 0!==a&&void 0!==a.message&&(a.message[n.hudConfig.metricSymbol]=s);const c=e?a.batch.partition:a.partition,u=e?a.batch.messages[0]?.timestamp:a.message?.timestamp;s.addPartition(c),s.addProducedTimestamp(u),r.flowMetric=s}}(g),m=(0,s.wrapFlow)(p,e[c],h,u,l);e[c]=m}e.run=async function(...e){try{const t=e[0];t.eachMessage&&g(t,"eachMessage"),t.eachBatch&&g(t,"eachBatch")}catch(e){n.instrument_logger.error("Error in patching KafkaJS.Consumer.run",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return await c.apply(this,e)},(0,s.copyPropertiesToTarget)(c,e.run)}(r,t,o,e[0].groupId,a)}catch(e){n.instrument_logger.error("Error in patching KafkaJS.Consumer",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r},(0,s.copyPropertiesToTarget)(t,e.Kafka.prototype.consumer)}}function u(e,t){const r=t.flowMetric;r?r.end():n.instrument_logger.warn("No flowMetric found for message",{flowId:e})}function l(e,t,r){const o=t.flowMetric;o?(o.setError(r),o.end()):n.instrument_logger.warn("No flowMetric found for message",{flowId:e})}function d(e,t){return e+"|"+t}function f(e,t,r,s,i){const a=(0,n.generateKafkaFlowId)(e,t,i),c={flow_id:a,topic_name:e.toString(),group_id:t,pulling_type:i};(0,o.storeKafkaJSTopicDeclaration)(c),function(e,t,r,o,n){"string"==typeof r?e.set(d(r,o),n):t.push({pattern:r,isBatch:o,flowId:n})}(r,s,e,"eachBatch"===i,a)}t.default=c},646:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(8949),s=r(714),i=r(3531);class a extends s.FrameworkPatcher{_patch(e){return this._patchCreate(e),o.instrument_logger.info("Patched NestJS RouterExecutionContext successfully"),e}_patchCreate(e){const t=e.RouterExecutionContext.prototype.create;e.RouterExecutionContext.prototype.create=function(...e){try{const t=e[0],r=e[1];if("function"==typeof t.constructor&&"function"==typeof r){const s=(0,i.generateKey)(t,r);s&&(e[1]=(0,n.wrapFlow)(()=>{try{const e=(0,i.getRequestByCallback)(s);if(!e)return void o.instrument_logger.error("No request object found for key",{key:s});const t=function(e){if(e&&!e.raw&&e.socket)return e[o.hudConfig.metricSymbol]?e[o.hudConfig.metricSymbol].getFlowId?e[o.hudConfig.metricSymbol].getFlowId():void o.instrument_logger.error("No getFlowId function found on metric object"):void o.instrument_logger.error("No metric found on nestjs request object")}(e);return t||o.instrument_logger.error("No flow id found for key",{key:s}),t}catch(e){o.instrument_logger.error("Error in NestJS getFlowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}},r))}else o.instrument_logger.error("Invalid args in NestJS RouterExecutionContext.create",{args:e})}catch(e){o.instrument_logger.error("Error in NestJS RouterExecutionContext patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,e)},(0,n.copyPropertiesToTarget)(t,e.RouterExecutionContext.prototype.create)}}t.default=a},714:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getFrameworkPatcher=t.extractModuleVersion=t.isSupportedVersion=t.FrameworkPatcher=void 0;const i=r(2546),a=r(9896),c=s(r(6928)),u=r(8064);function l(e,t){return""===e||u.satisfies(u.coerce(e),t)}function d(e){try{const t=(0,a.readFileSync)(c.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(t).version;return"string"==typeof r?r:""}catch(t){i.instrument_logger.info("Failed extracting version",{baseDir:e})}return""}t.FrameworkPatcher=class{patch(e,t,r,o,n=this.constructor.name){try{if(this.isSupported(t,n,r,o))return this._patch(e)}catch(e){i.instrument_logger.error("Unhandeled error during patching framework",{framework:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}isSupported(e,t,r,o){const n=d(e);return!!l(n,r)||(i.instrument_logger.warn("Unsupported version",{framework:t,version:n,supportedVersion:r,basedir:e}),i.customer_logger.log(i.UserErrorLogs.UnsupportedFrameworkVersion(t)),!1)}},t.isSupportedVersion=l,t.extractModuleVersion=d,t.getFrameworkPatcher=function(e){return new(r(2828)(`./${e}`).default)}},828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KafkaJSMetric=void 0;const o=r(2546),n=r(7131),s=r(9873);class i extends s.FlowMetric{partition;error;producedTimestamp;totalConsumeDuration;constructor(e){super(e)}_createUsableMetric(e){return this}end(){this.producedTimestamp&&(this.totalConsumeDuration=Number(Date.now()-this.producedTimestamp)*Number(1e6)),super.end()}addProducedTimestamp(e){void 0!==e&&(this.producedTimestamp=Number(e))}addPartition(e){this.partition=e}setError(e){this.error=(0,n.extractName)(e)}toRaw(){if(void 0!==this.partition)return{flow_id:this.flowId,type:"KafkaJSMetric",duration:this.duration,partition:this.partition,error:this.error,total_consume_duration:this.totalConsumeDuration};o.instrument_logger.warn("No partition found for message",{flowId:this.flowId})}}t.KafkaJSMetric=i},857:e=>{"use strict";e.exports=require("os")},932:e=>{"use strict";e.exports=require("process")},1427:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSystemInfo=void 0;const n=o(r(9896)),s=o(r(857));t.getSystemInfo=function(){return{pod_name:u(),node_name:l()}};const i=Symbol("not found");let a,c;function u(){if(a!==i){if(a)return a;try{return a=s.default.hostname(),a}catch(e){return void(a=i)}}}function l(){if(c!==i){if(c)return c;try{const e=n.default.readFileSync("/etc/machine-id","utf8").trim();return c=e,c}catch(e){return void(c=i)}}}},1502:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8528),n=r(8269),s=r(2546),i=r(8949),a=r(714);class c extends a.FrameworkPatcher{static koaModuleName="koa";static koaPatchedSymbol=Symbol.for(s.hudConfig.hudPatchedName);_patch(e){return this._patchAppUse(e),s.instrument_logger.info("Patched koa successfully"),e}_patchAppUse(e){const t=e.prototype.use;e.prototype.use=function(e){const r=t.apply(this,arguments);try{if(!arguments[0].router)return r;const e=arguments[0].router.stack;for(let t=0;t<e.length;t++)c._wrapRoute(e[t])}catch(e){s.instrument_logger.error("Failed to patch koa.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r},(0,i.copyPropertiesToTarget)(t,e.prototype.use)}static _wrapRoute(e){if(e.methods&&0===e.methods.length)return;if(!e.stack[0][c.koaPatchedSymbol]){const t=(0,i.wrapFlow)(g,e.stack[0],u);e.stack[0]=t,e.stack[0][c.koaPatchedSymbol]=!0}const t=(0,s.generateEndpointFlowId)(e.path,e.methods);(0,n.storeKoaEndpointDeclaration)(new o.EndpointDeclaration(t,e.methods,"koa",void 0,e.path));for(const r of e.methods)f(t,e.path,r)}}function u(e,t,r){if(!r[0])return void s.instrument_logger.error("No ctx object found in koa");const o=r[0].req;if(!o)return void s.instrument_logger.error("No req found in koa ctx");const n=o[s.hudConfig.metricSymbol];n?n.setFlowId(e):s.instrument_logger.error("No endpoint metric found in koa req")}function l(e,t){return e+"|"+t}t.default=c;const d=new Map;function f(e,t,r){d.set(l(t,r),e)}function g(e){if(0===e.length)return;const t=e[0]._matchedRoute,r=e[0].req?.method;return function(e,t){return d.get(l(e,t))}(t,r)}},2080:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SqsMetric=void 0;const o=r(9873);class n extends o.FlowMetric{errors;msgCount;e2eEpocStartTimeMS;e2eDurationNS;_finishedMessageCount;constructor(e){super(e),this._finishedMessageCount=0,this.errors=new Map}addError(e,t=1){this.errors.set(e,(this.errors.get(e)??0)+t)}increaseAndShouldEnd(e=1){return this._finishedMessageCount+=e,!(this.msgCount&&this._finishedMessageCount<this.msgCount)}end(){this.e2eEpocStartTimeMS&&(this.e2eDurationNS=Number(Date.now()-this.e2eEpocStartTimeMS)*Number(1e6)),super.end()}_createUsableMetric(e){return this}toRaw(){return{flow_id:this.flowId,type:"SqsMetric",duration:this.duration,e2e_duration:this.e2eDurationNS,msg_count:this.msgCount,errors:this.errors}}}t.SqsMetric=n},2197:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)},i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.koa=t.express=t.safeLog=t.registerHook=t.hudRITM=void 0;var a=r(5688);Object.defineProperty(t,"hudRITM",{enumerable:!0,get:function(){return a.hudRITM}}),Object.defineProperty(t,"registerHook",{enumerable:!0,get:function(){return a.registerHook}}),Object.defineProperty(t,"safeLog",{enumerable:!0,get:function(){return a.safeLog}}),s(r(3901),t),t.express=i(r(7127)),s(r(714),t),t.koa=i(r(1502)),s(r(7166),t)},2546:e=>{"use strict";e.exports=require("./lib")},2729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(2822),s=r(8949),i=r(8901),a=r(714);class c extends a.FrameworkPatcher{_patch(e){const t=this._patchGetFramework(e);return o.instrument_logger.info("Patched serverless-http/lib/framework/get-framework.js successfully"),t}_patchGetFramework(e){const t=e;return e=function(...e){const r=t.apply(t.this,e);async function a(e,...t){const s=i.HttpEndpointMetric.createUsableMetric();try{s.start(),s.setRequestAttributes(e),e[o.hudConfig.metricSymbol]=s}catch(e){o.instrument_logger.error("Failed to start flowMetric during framework serverless request handler patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const a=await(0,n.runWithInvestigation)(()=>r.apply(r.this,[e,...t]));return a.once("finish",function(){try{(0,n.finishHttpInvestigation)(e,a,s),s.setResponseAttributes(a),s.end()}catch(e){o.instrument_logger.error("Failed to end flowMetric during framework serverless request handler patching",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),a}return(0,s.copyPropertiesToTarget)(r,a),a},(0,s.copyPropertiesToTarget)(t,e),e}}t.default=c},2741:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(6730),s=r(4815),i=r(7225),a=r(714);class c extends a.FrameworkPatcher{_patch(e){return i.isVerboseLoggingEnabled?((0,n.patchMethods)(e,"application_export"),(0,s.patchUse)(e,"application",!1),(0,i.logLazyRouter)(e),o.instrument_logger.info("Patched express.Application successfully"),e):(o.instrument_logger.info("Skipping express.Application patching, verbose logging is not enabled"),e)}}t.default=c},2784:e=>{"use strict";e.exports=require("../native/_index")},2822:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.finishSqsInvestigation=t.finishHttpInvestigation=t.getStacktraceUniqString=t.storeInvestigation=t.closeInvestigation=t.runWithInvestigation=t.createNewInvestigation=t.getBaseInvestigationStorage=t.serializableInvestigation=void 0;const o=r(8528),n=r(8269),s=r(2546),i=r(7131),a=r(7808),c=r(7603),u=r(1427),l=/(?:\n\s*at.*)+$/,d={};function f(e,...t){let r="debug";(void 0===d[e]||d[e]<s.hudConfig.dynamicConfig.investigationRateLimits.maxUniqLogs)&&(r="warn",d[e]=d[e]+1||1),s.app_logger.log(r,e,...t)}function g(e){return{status:e.status,context:e.context,exceptions:Array.from(Array.from(e.exceptions?.values()??[]).map(({exception:e,executionFlow:t})=>{return{name:(0,i.extractNameOptional)(e),message:(0,i.extractMessage)(e),stackTrace:(r=e,r?.stack?.match(l)?.[0]),executionFlow:t};var r})??[])}}function p(){return{status:o.InvestigationStatus.Open}}function h(){if(!globalThis.hudEnableInvestigation)return;const e=(0,i.getStorage)().getStore();return void 0!==e&&e.status===o.InvestigationStatus.Open?(e.status=o.InvestigationStatus.Closed,e):void 0}function m(e,t){e.context=t,(0,n.storeClosedInvestigation)(g(e))}t.serializableInvestigation=g,t.getBaseInvestigationStorage=p,t.createNewInvestigation=function(){globalThis.hudEnableInvestigation&&(0,i.getStorage)().enterWith(p())},t.runWithInvestigation=function(e){return globalThis.hudEnableInvestigation?(0,i.getStorage)().run(p(),e):e()},t.closeInvestigation=h,t.storeInvestigation=m;const _=/.*\((.*):(\d+):(\d+)\)/,y=/.*?(\S*):(\d+):(\d+)/;function v(e){const t=Error.prepareStackTrace;if(void 0===t||"function"!=typeof t)return void f("getStacktraceUniqString: prepareStackTrace is undefined or not a function");let r,o;try{Error.prepareStackTrace=(e,t)=>{r=t[0],o=t};const n=e.stack;if(void 0!==n&&void 0===r){const t=function(e,t){const r=function(e){let t=0;for(let r=0;r<e.length;r++)"\n"===e[r]&&t++;return t}(t)+1;let o=-1;for(let t=0;t<r;t++)if(o=e.indexOf("\n",o+1),-1===o)return;if(-1===o)return;const n=e.indexOf("\n",o+1);return e.slice(o+1,-1===n?void 0:n)}(n,e.message);if(!t)return void f("getStacktraceUniqString: firstStackTraceLine is undefined",{stack:n,message:e.message});const r=t.match(_);if(r&&r[1]&&r[2]&&r[3])return`${e.name}@${r[1]}:${r[2]}:${r[3]}`;const o=t.match(y);return o&&o[1]&&o[2]&&o[3]?`${e.name}@${o[1]}:${o[2]}:${o[3]}`:void f("getStacktraceUniqString: no match found in regex",{stack:n,message:e.message})}if(void 0===r||void 0===o)return void f("getStacktraceUniqString: result or globCallSites is undefined",{result:void 0===r,globCallSites:void 0===o});Object.defineProperty(e,"stack",{configurable:!0,enumerable:!1,get:()=>t(e,o)})}finally{Error.prepareStackTrace=t}try{return`${e.name}@${r.getFileName()}:${r.getLineNumber()}:${r.getColumnNumber()}`}catch{}}function b(e,t=s.hudConfig.investigation.maxObjectDepth){try{if("string"==typeof e)return e.length>s.hudConfig.investigation.maxStringLength?e.slice(0,s.hudConfig.investigation.maxStringLength)+"...":e;if(Array.isArray(e))return e.slice(0,s.hudConfig.investigation.maxArrayLength).map(e=>b(e,t-1));if(null===e||["number","boolean"].includes(typeof e))return e;if("bigint"==typeof e)return e.toString();if("object"==typeof e){const r={...e};for(const o in e)r[o]=b(e[o],t-1);return r}}catch{}}function w(e){const t=h();if(void 0===t)return void f("finishBaseInvestigation: investigation is undefined");if(void 0===t.firstException)return void f("finishBaseInvestigation: firstException is undefined");if(n.globalInvestigationTracking>=s.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations)return void f("finishBaseInvestigation: globalInvestigationTracking is greater than maxTotalInvestigations",{globalInvestigationTracking:n.globalInvestigationTracking,maxTotalInvestigations:s.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations});const r=e.getFlowId();if(void 0===r)return void f("finishBaseInvestigation: flowId is undefined");const o=v(t.firstException);if(void 0===o)return void f("finishBaseInvestigation: exceptionUniqString is undefined");const i=((0,n.getInvestigationDedupingCache)(r).get(o)??0)+1;if(!(i>s.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations))return(0,n.increaseGlobalInvestigationTracking)(),(0,n.increaseInvestigationDedupingCache)(r,o),t;f("finishBaseInvestigation: investigationCount is greater than maxSameInvestigations",{investigationCount:i,maxSameInvestigations:s.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations})}t.getStacktraceUniqString=v,t.finishHttpInvestigation=function(e,t,r){if(t.statusCode<500)return;const o=w(r);if(void 0===o)return void f("finishHttpInvestigation: base investigation return undefined");const n=r.getFlowId(),s=r.getMsStartTime();void 0!==n&&void 0!==r.route&&void 0!==r.method&&void 0!==s?m(o,{type:"http",endpoint_uuid:n,route:r.route,method:r.method,timestamp:s,params:e.params,query:e.query,request_body:b(e.body),status_code:t.statusCode,machine_metrics:(0,a.getMachineMetrics)(),observability_identifiers:(0,c.getObservabilityIdentifiers)(e),system_info:(0,u.getSystemInfo)()}):f("route, method, or reqTimestamp is undefined even though they shouldn't",{flowId:n,route:r.route,method:r.method,reqTimestamp:s})},t.finishSqsInvestigation=function(e,t){if(0===t.errors.size)return;const r=w(t);if(void 0===r)return void f("finishSqsInvestigation: investigation is undefined");const o=t.getFlowId(),n=t.getMsStartTime();void 0!==n&&void 0!==o?m(r,{type:"sqs",timestamp:n,flow_id:o,messages:b(e),machine_metrics:(0,a.getMachineMetrics)(),system_info:(0,u.getSystemInfo)()}):f("reqTimestamp is undefined even though it shouldn't",{flowId:o})}},2828:(e,t,r)=>{var o={"./codeGenieServerlessExpress":336,"./codeGenieServerlessExpress.ts":336,"./express":7127,"./express.ts":7127,"./express/methods":6730,"./express/methods.ts":6730,"./express/route":2977,"./express/route.ts":2977,"./express/router":4815,"./express/router.ts":4815,"./express/verbosity":7225,"./express/verbosity.ts":7225,"./expressApplication":2741,"./expressApplication.ts":2741,"./flows/endpoints/metrics":8901,"./flows/endpoints/metrics.ts":8901,"./flows/flow":9873,"./flows/flow.ts":9873,"./flows/graphql":6504,"./flows/graphql.ts":6504,"./flows/kafkajs":828,"./flows/kafkajs.ts":828,"./flows/sqs":2080,"./flows/sqs.ts":2080,"./frameworkPatcher":714,"./frameworkPatcher.ts":714,"./graphql":7214,"./graphql.ts":7214,"./http":5459,"./http.ts":5459,"./kafkajs":486,"./kafkajs.ts":486,"./koa":1502,"./koa.ts":1502,"./nestjsInterceptor":3531,"./nestjsInterceptor.ts":3531,"./nestjsRouterExecutionContext":646,"./nestjsRouterExecutionContext.ts":646,"./nestjsRpcContextCreator":4290,"./nestjsRpcContextCreator.ts":4290,"./router":5946,"./router.ts":5946,"./serverlessHttp":2729,"./serverlessHttp.ts":2729,"./sqsConsumer":5150,"./sqsConsumer.ts":5150};function n(e){var t=s(e);return r(t)}function s(e){if(!r.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}n.keys=function(){return Object.keys(o)},n.resolve=s,e.exports=n,n.id=2828},2977:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.patchRoute=void 0;const i=r(8528),a=r(8269),c=r(2546),u=s(r(6982)),l=r(8949),d=r(6730),f=r(5673);function g(e,t,r,o){!function(e,t,r,o){e[c.hudConfig.express.layerStateSymbol]||(e[c.hudConfig.express.layerStateSymbol]={}),e[c.hudConfig.express.layerStateSymbol][t]?e[c.hudConfig.express.layerStateSymbol][t].methods.push(r):e[c.hudConfig.express.layerStateSymbol][t]={layerPath:o,methods:[r]}}(e,t,r,o),function(e,t,r){const o=new i.EndpointDeclaration(e,[t],"express",void 0,void 0,r);(0,a.storePartialEndpointDeclaration)(o),(0,a.storeExpressEndpointDeclaration)(o)}(t,r,o)}function p(e,t,r){const o=new i.EndpointDeclaration(e,t,"express",void 0,r,void 0);(0,a.storeExpressEndpointDeclaration)(o)}function h(e,t){if(e&&!(e.length<1)){if(c.hudConfig.express.wrapAllCallbacks)for(let r=0;r<e.length;r++){const o=(0,l.wrapFlow)(_(t),e[r],y);e[r]=o}else{const r=(0,l.wrapFlow)(_(t),e[e.length-1],y);e[e.length-1]=r}return t}}function m(e){return(0,a.getLinkedConsistentFlowId)(e,!1)||(c.instrument_logger.warn("No consistent flowId found, returning temporary flow id",{flowId:e}),e)}function _(e){return e?function(){return m(e)}:function(e){const t=e[0]?.route[c.hudConfig.express.layerStateSymbol],r=e[0]?.url;if(t)for(const[e,o]of Object.entries(t)){if(o.layerPath instanceof RegExp&&o.layerPath.test(r))return m(e);if(r.includes(o.layerPath))return m(e)}c.instrument_logger.warn("No flowId found for path",{states:t,url:r.split("?")[0]})}}function y(e,t,r){let o=0;if(4===r.length)o=1;else if(3!==r.length)return void c.instrument_logger.error("Invalid number of arguments in express request",{length:r.length});if(!r[o])return void c.instrument_logger.error("No request object in express request");const n=r[o][c.hudConfig.metricSymbol];n?n.setFlowId(e):c.instrument_logger.error("No endpoint metric found in express request")}t.patchRoute=function(e){const t=(0,d.getMethods)();t.concat("all").forEach(function(r){const o=e.prototype[r];e.prototype[r]=function(){let e;try{e=f(Array.prototype.slice.call(arguments));let o=function(e){const t=e[0][c.hudConfig.express.layerStateSymbol];if(t)return t.flowId}(e);const n=function(e){const t=e[0][c.hudConfig.express.layerStateSymbol];if(t)return t.kind}(e),s=function(e){const t=e[0][c.hudConfig.express.layerStateSymbol];return!!t&&t.allMethod}(e);if(o||(o=[u.randomUUID()]),"application"===n)if(Array.isArray(this.path)){h(e,void 0);for(let e=0;e<this.path.length;e++)p(o[e],s?t:[r],this.path[e])}else h(e,o[0]),p(o[0],s?t:[r],this.path);else if("router"===n)if(Array.isArray(this.path)){h(e,void 0);for(let e=0;e<this.path.length;e++)g(this,o[e],r,this.path[e])}else h(e,o[0]),g(this,o[0],r,this.path);else h(e,o[0]),g(this,o[0],r,this.path)}catch(e){c.instrument_logger.error("Failed to patch express.Route.route",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o.apply(this,e||arguments)}})}},2987:e=>{"use strict";e.exports=require("perf_hooks")},3176:e=>{"use strict";e.exports=require("buffer-crc32")},3339:e=>{"use strict";e.exports=require("module")},3531:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateKey=t.getRequestByCallback=void 0;const o=r(2546);r(3702);const n=r(8949),s=r(714),i=new Map;function a(e,t){const r=Reflect.getMetadata("path",t)??Reflect.getMetadata("microservices:pattern",t);if(!r)return void o.instrument_logger.error("No callback path found on callback",{callback:t});const n=e.constructor.CONTROLLER_ID;if(n)return`${n}.${r}`;o.instrument_logger.error("No controller id found on controller",{controller:e})}t.getRequestByCallback=function(e){const t=i.get(e);return t&&i.delete(e),t},t.generateKey=a;class c extends s.FrameworkPatcher{_patch(e){return this._patchIntercept(e),o.instrument_logger.info("Patched NestJS intercept successfully"),e}_patchIntercept(e){const t=e.InterceptorsConsumer.prototype.intercept;e.InterceptorsConsumer.prototype.intercept=async function(...e){return function(e){try{const t=e[2],r=e[3];if("function"==typeof t.constructor&&"function"==typeof r){let o;if("rpc"===e[5]){if("win32"===process.platform)return;o=e[1][1].args[0]}else if(o=e[1][0],!o||o.raw)return;const n=a(t,r);if(!n)return;i.set(n,o)}else o.instrument_logger.error("Invalid args in NestJS InterceptorsConsumer.intercept",{args:e})}catch(e){o.instrument_logger.error("Error in NestJS intercept patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(e),await t.apply(this,e)},(0,n.copyPropertiesToTarget)(t,e.InterceptorsConsumer.prototype.intercept)}}t.default=c},3702:e=>{"use strict";e.exports=require("reflect-metadata")},3868:e=>{"use strict";e.exports=require("@jridgewell/sourcemap-codec")},3901:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.incrementInstrumentedFunctionsCount=t.edit=t.editInSplits=t.splitCode=t.getFunctionWrapperTemplate=void 0;const a=i(r(3176)),c=r(3903),u=r(2546),l=r(8528),d=r(8269),f=r(2546),g=r(3868),p=s(r(2784)),h=/([0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12})/;function m(e,t,r=!1){const o=`${e}_hudTemp`,n="BODY_PLACEHOLDER",s="FUNCTION_ID_PLACEHOLDER",i="AWAITABLE_PLACEHOLDER",a="EXCEPTION_VARIABLE_PLACEHOLDER",c=function(e,t,r=!1){const o=[];if(r)return o;let n;t===l.Format.cjs?n="require":t===l.Format.esm&&(o.push(`import { createRequire as ${e}_createRequire } from "module";`,`const ${e}_require = ${e}_createRequire(import.meta.url);`),n=`${e}_require`);const s=f.myRequire.resolve(u.SDK_MODULE_NAME+"/wrap");return o.push(`let ${e}_temp;`,`try { ${e}_temp = ${n}(String.raw\`${s}\`); } catch (e) { ${e}_temp = { wrapperInitial: () => {}, wrapperCatch: () => {}, wrapperFinally: () => {}, fixStack: () => {}, wrapperUserCatch: () => {} }; }`,`const { wrapperInitial: ${e}_wi, wrapperCatch: ${e}_wc, wrapperFinally: ${e}_wf, fixStack: ${e}_fs, asyncIteratorWrapper: ${e}_aiw, wrapperUserCatch: ${e}_wuc } = ${e}_temp;`),o}(e,t,r);return{functionWrapper:`{\n let ${o};\n const ${u.hudConfig.functionIdVarName} = ${s};\n const ${e}_cc = {};\n try {\n ${e}_wi(${u.hudConfig.functionIdVarName}, ${e}_cc);\n } catch (e) {\n globalThis._hud_SI = { value: 0 };\n globalThis._hud_S = [];\n }\n try {\n ${n}\n } catch (e) {\n try {\n ${e}_wc(${u.hudConfig.functionIdVarName}, ${e}_cc, e);\n } catch (e) {}\n throw e;\n } finally {\n try {\n ${e}_wf(${u.hudConfig.functionIdVarName}, ${e}_cc);\n } catch (e) {}\n }\n }`,awaitWrapper:`(${o} = ${i}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = await ${o}, _hud_S[++_hud_SI.value] = ${u.hudConfig.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})`,yieldWrapper:`\n function* ${e}_generatorWrapper() {\n return (${o} = ${i}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = yield ${o}, _hud_S[++_hud_SI.value] = ${u.hudConfig.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})\n }`,yieldStarWrapper:`\n function* ${e}_generatorWrapper() {\n return (${o} = ${i}, _hud_SI.value--, _hud_F = "", ${e}_cc.ff = true, ${o} = yield* ${o}, _hud_S[++_hud_SI.value] = ${u.hudConfig.functionIdVarName}, _hud_F = ${e}_cc.currentFlowId, ${e}_cc.ff= false, ${o})\n }`,initialStatements:c,bodyPlaceholder:n,functionIdPlaceholder:s,awaitablePlaceholder:i,fixStackFunction:`\n try{\n ${e}_fs(${u.hudConfig.functionIdVarName}, ${e}_cc)\n }catch(e){};`,exceptionVariablePlaceholder:a,wrapperUserCatch:`\n try {\n ${e}_wuc(${u.hudConfig.functionIdVarName}, ${e}_cc, ${a});\n } catch(e){};`,asyncIteratorWrapper:`${e}_aiw`,awaitableVariable:o}}function _(e,t,r=!0,o=!1){const n=Error.prepareStackTrace;let s=!1,i=function(e){const t=e.match(`${u.hudConfig.bundlerBuildIdVarName}="${h.source}"`);if(t&&t.length>0)return t[1]}(e);i||(i=function(e){return(0,c.v5)(e,u.hudConfig.bundlerBuildUuidNamespace)}(e),s=!0);const l=(0,c.v5)(e,u.hudConfig.functionUuidNamespace),d=(0,a.default)(t.filename).readUInt32BE(),f=(0,a.default)(e).readUInt32BE(),g={data:t,bundlerBuildId:i,prefix:u.hudConfig.wrapVarPrefix,...m(u.hudConfig.wrapVarPrefix,t.format,o),uuidNamespace:u.hudConfig.functionUuidNamespace,fileHash:l,useInputSourcemap:r},_=p.transform(e,g);return I(_.functionsIds.length),Error.prepareStackTrace=n,u.instrument_logger.debug(`Successfully transformed ${t.filename}`),{code:_.code,map:_.map,functionIds:_.functionsIds,filename:t.filename,hasInputMap:_.isInputSourcemap,bundlerBuildId:i,bundlerBuildIdGenerated:s,file_path_checksum:d,file_checksum:f,sourceCodeHash:l,moduleBase:_.moduleBase}}t.getFunctionWrapperTemplate=m;class y extends Error{}function v(e,t){if(e&&t)throw new y("Start mark found inside mark");if(!e&&!t)throw new y("End mark found outside mark")}function b(e,t,r,o){const n=e.split("\n");let s=r,i=o;return s+=n.length-1,s+=t.split("\n").length-1,s===r?i+=n.pop()?.length||0:i=n.pop()?.length||0,{lineOffset:s,columnOffset:i}}function*w(e){let t=!1,r=0,o=0,n=!1,s=0,i=0;const a=new RegExp(`globalThis\\s*?&&\\s*?\\(globalThis\\.${u.hudConfig.esbuildGlobalVar}\\s*?=\\s*?"(Start|End):(?<fileName>.*?)"\\);?`,"g");for(const c of e.matchAll(a)){if(n=!0,!c.groups)throw new y("No groups found in match");const{fileName:a}=c.groups,[u,l]=c,d="Start"===l;v(d,t);let f="";if(t){const t=c.index+u.length;f=e.slice(r,t);const n=o+Buffer.byteLength(f,"utf8");yield{edit:!0,code:f,fileName:a,lineOffset:s,columnOffset:i,indexOffset:o,indexOffsetEnd:n},r=t,o=n}else{const t=c.index;f=e.slice(r,t),o+=Buffer.byteLength(f,"utf8"),r=t,yield{edit:!1,code:f}}t=!!d,({lineOffset:s,columnOffset:i}=b(f,u,s,i))}if(t)throw new y("End mark found outside mark");n?r<e.length&&(yield{edit:!1,code:e.slice(r)}):yield{edit:!1,code:e}}function k(e,t,r){u.instrument_logger.debug("Edit chunk",{fileName:e.fileName,size:e.code.length,edit:t}),r?.push({fileName:e.fileName,size:e.code.length,edit:t})}function S(e,t,r){const o=_(e.code,{filename:t,format:r},!1,!0),n=o.code;return o.mapRelativeToChunk=o.map,o.map=function(e,t,r){"string"==typeof e&&(e=JSON.parse(e));const o=(0,g.decode)(e.mappings);return o.forEach(e=>{e.forEach(e=>{e.length>=4&&"number"==typeof e[2]&&("number"==typeof e[3]&&0===e[2]&&(e[3]+=r),e[2]+=t)})}),JSON.stringify({...e,mappings:(0,g.encode)(o),sourcesContent:void 0})}(o.map,e.lineOffset,e.columnOffset),{codeToAppend:n,metadata:{...o,filename:t,lineOffset:e.lineOffset,columnOffset:e.columnOffset}}}function E(e,t,r,o=!1,n=()=>!0){let s="",i=0,a=0;const c=[];let l=0;const d=o?[]:void 0,f=m(u.hudConfig.wrapVarPrefix,r).initialStatements.join("\n"),g=function(e){return e.slice(u.hudConfig.esbuildMark.length,u.hudConfig.esbuildMark.length+36)}(e);for(const o of w(e)){l++;try{let e="",u=!1;if(o.edit&&(u=n(o.fileName),d&&k(o,u,d)),o.edit&&u){const n=S(o,t,r);e=n.codeToAppend,c.push({...n.metadata,bundlerBuildId:g,transformedLineOffset:i,transformedColumnOffset:a,indexOffset:o.indexOffset,indexOffsetEnd:o.indexOffsetEnd})}else e=0===s.length?M(o.code,f):o.code;({transformedCodeLineOffset:i,transformedCodeColumnOffset:a}=C(e,i,a)),s+=e}catch(r){return u.instrument_logger.error("Failed to patch index",{index:l,filename:t,msg:r instanceof Error?r.message:void 0,stack:r instanceof Error?r.stack:void 0}),{transformedCode:e,metadatas:[],editedChunksSizes:d}}}return{transformedCode:s,metadatas:c,editedChunksSizes:d}}function M(e,t){let r="";return e.startsWith('"use strict";')?(r+='"use strict";',r+=t,r+=e.slice(13),r):(r+=t,r+=e,r)}function C(e,t,r){const o=e.split("\n");return o.length>1?(t+=o.length-1,r=o.pop()?.length||0):r+=e.length,{transformedCodeLineOffset:t,transformedCodeColumnOffset:r}}t.splitCode=w,t.editInSplits=E,t.edit=function(e,t,r){if(e.startsWith(u.hudConfig.esbuildMark))return u.instrument_logger.info("Editing in splits"),E(e,t,r,!1);{const o=_(e,{filename:t,format:r},u.hudConfig.userConfig.disableSourceMapsResolution?.value??!0);return{transformedCode:o.code,metadatas:[o]}}};let x=0;function I(e){x+=e;const t=u.hudConfig.userConfig?.maxMappedFunctions?.value??0;x>=t&&(u.customer_logger.log(u.UserErrorLogs.InstrumentedFunctionCountExceeded(t)),u.app_logger.error("Instrumented function count exceeded",{instrumentedFunctionsCount:x,maxMappedFunctions:t}),(0,d.detachHud)(!1,!1))}t.incrementInstrumentedFunctionsCount=I},3903:e=>{"use strict";e.exports=require("uuid")},4290:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(8949),s=r(714),i=r(3531);class a extends s.FrameworkPatcher{_patch(e){return this._patchCreate(e),o.instrument_logger.info("Patched NestJS RpcContextCreator successfully"),e}_patchCreate(e){const t=e.RpcContextCreator.prototype.create;e.RpcContextCreator.prototype.create=function(...e){try{const t=e[0],r=e[1];if("function"==typeof t.constructor&&"function"==typeof r){const s=(0,i.generateKey)(t,r);s&&(e[1]=(0,n.wrapFlow)(()=>{try{const e=(0,i.getRequestByCallback)(s);if(!e)return void o.instrument_logger.error("No msg object found for key",{key:s});const t=function(e){if(e)return e[o.hudConfig.metricSymbol]?e[o.hudConfig.metricSymbol].getFlowId?e[o.hudConfig.metricSymbol].getFlowId():void o.instrument_logger.error("No getFlowId function found on metric object"):void o.instrument_logger.error("No metric found on nestjs msg object")}(e);return t||o.instrument_logger.error("No flow id found for key",{key:s}),t}catch(e){o.instrument_logger.error("Error in NestJS getFlowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}},r))}else o.instrument_logger.error("Invalid args in NestJS RpcContextCreator.create",{args:e})}catch(e){o.instrument_logger.error("Error in NestJS RpcContextCreator patcher",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,e)},(0,n.copyPropertiesToTarget)(t,e.RpcContextCreator.prototype.create)}}t.default=a},4815:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.extractEndpointsFromRouter=t.patchUse=void 0;const i=r(8528),a=r(2546),c=s(r(6982)),u=r(8949),l=r(7225),d=r(5673);function f(e){e[a.hudConfig.express.markedSymbol]||(globalThis.hudExpressState.push(e),e[a.hudConfig.express.markedSymbol]=!0)}function g(e,t){const r=[];for(const[o,n]of Object.entries(e.route[a.hudConfig.express.layerStateSymbol]))r.push(new i.EndpointDeclaration(o,n.methods,"express",t,n.layerPath));return Array.from(r.values())}t.patchUse=function(e,t,r=!0){const o=e.use;e.use=function(e){const n=o.apply(this,arguments);try{let o=this[l.uuidSymbol];!o&&l.isVerboseLoggingEnabled&&(o=c.randomUUID(),this[l.uuidSymbol]=o,a.instrument_logger.info("Express use setting uuid",{kind:t,uuid:o})),"application"===t?function(e,t,r,o){try{r&&(e._router?f(e._router):e.router?f(e.router):a.instrument_logger.warn("Express application doesn't have router or _router")),o&&l.isVerboseLoggingEnabled&&a.instrument_logger.info("Express use app",{parent:o,child:t[1]?.[l.uuidSymbol]||"no uuid",path:t[0]})}catch(e){a.instrument_logger.error("Failed to save express app router",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(this,arguments,r,o):"router"===t&&function(e,t,r,o,n){try{if(!e.stack)return void a.instrument_logger.error("Express router without stack");if(0===e.stack.length)return void a.instrument_logger.warn("Express router with an empty stack");"query"===e.stack[0].name?f(e):l.isVerboseLoggingEnabled&&!l.skipLayerNamesLogs.has(e.stack[0].name)&&(l.skipLayerNamesLogs.add(e.stack[0].name),a.instrument_logger.warn("Found unknown stack name",{stack:e.stack[0].name}));const{path:s,offset:i}=function(e){let t=0,r="/";if("function"!=typeof e){let o=e;for(;Array.isArray(o)&&0!==o.length;)o=o[0];"function"!=typeof o&&(t=1,r=e)}return{path:r,offset:t}}(n),u=d(Array.prototype.slice.call(t,i));for(let t=0;t<u.length&&t<e.stack.length;t++){const n=e.stack[e.stack.length-t-1],i=u[u.length-t-1];"router"===n.name?(i&&!i[l.uuidSymbol]&&l.isVerboseLoggingEnabled&&(i[l.uuidSymbol]=c.randomUUID(),a.instrument_logger.info("Express handle router setting uuid",{uuid:i[l.uuidSymbol]})),r&&(n[a.hudConfig.express.routeNamesSymbol]=s)):l.isVerboseLoggingEnabled&&!l.skipLayerNamesLogs.has(n.name)&&(l.skipLayerNamesLogs.add(n.name),a.instrument_logger.warn("Found unknown layer name",{layer:n.name,parent:o,child:i[l.uuidSymbol]||"no uuid",path:s}))}}catch(e){a.instrument_logger.error("Failed to patch router.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(this,arguments,r,o,e)}catch(e){a.instrument_logger.error("Failed to patch express.use function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return n},(0,u.copyPropertiesToTarget)(o,e.use)},t.extractEndpointsFromRouter=function e(t,r){let o=[];if(!r.stack)return a.instrument_logger.error("Router without stack - bad OTEL version",{router:r}),o;for(const n of r.stack)if("router"===n.name){if(!n[a.hudConfig.express.routeNamesSymbol]){a.instrument_logger.error("Router layer without routes",{layer:n});continue}const r=t+n[a.hudConfig.express.routeNamesSymbol];o=o.concat(e(r,n.handle))}else n.route&&n.route[a.hudConfig.express.layerStateSymbol]?o=o.concat(g(n,t)):l.isVerboseLoggingEnabled&&!l.skipLayerNamesLogs.has(n.name)&&(l.skipLayerNamesLogs.add(n.name),a.instrument_logger.warn("Found unknown layer name when extracting endpoints",{layer:n.name}));return o}},5150:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8269),n=r(2546),s=r(7131),i=r(2822),a=r(8949),c=r(2080),u=r(714);class l extends u.FrameworkPatcher{isSupported(e,t,r,o){const s=n.hudConfig.userConfig.enableDapulse?.value?o.mondayVersion:o.bbcVersion,i=(0,u.extractModuleVersion)(e);return!!(0,u.isSupportedVersion)(i,s)||(n.instrument_logger.warn("Unsupported sqs-consumer version",{framework:"SqsConsumer",version:i,supportedVersion:s,basedir:e,isDapulse:n.hudConfig.userConfig.enableDapulse?.value}),n.customer_logger.log(n.UserErrorLogs.UnsupportedFrameworkVersion("sqs-consumer")),!1)}_patch(e){return function(e){const t=e.Consumer.create;e.Consumer.create=function(...e){const r=t.apply(this,e);try{!function(e){const t=e.queueUrl;if(!t)throw new n.HudNoQueueUrlInSqsConsumer;const r=g(t);if(e.handleMessageBatch&&"function"==typeof e.handleMessageBatch){const t="handleMessageBatch",s=(0,n.generateSqsFlowId)(r,t);(0,o.storeSqsQueueDeclaration)({flow_id:s,queue_name:r,handle_type:t,batch_size:e.batchSize});const i=e.handleMessageBatch,c=(0,a.wrapFlow)(()=>s,i,p);return void(e.handleMessageBatch=c)}if(e.handleMessage&&"function"==typeof e.handleMessage){const t="handleMessage",s=(0,n.generateSqsFlowId)(r,t);(0,o.storeSqsQueueDeclaration)({flow_id:s,queue_name:r,handle_type:t});const i=e.handleMessage,c=(0,a.wrapFlow)(()=>s,i,p);return void(e.handleMessage=c)}n.instrument_logger.warn("Unable to getFlowId - No handleMessage or handleMessageBatch found in SqsConsumer.Consumer",{queueName:r})}(r),function(e){const t=e.on;e.on=function(...r){try{const t=r[0];if(!t||"string"!=typeof t)throw new n.HudNoEventTypeInSqsConsumerOn;const s=r[1];if(!s||"function"!=typeof s)throw new n.HudNoCallbackInSqsConsumerOn;const i=g(e.queueUrl),c="event",u=(0,n.generateSqsFlowId)(i,c,t);(0,o.storeSqsQueueDeclaration)({flow_id:u,queue_name:i,handle_type:c,event_type:t}),r[1]=(0,a.wrapFlow)(()=>u,s,h,m,_)}catch(e){n.instrument_logger.error("Error in SqsConsumer.Consumer.on patched logic",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,r)},(0,a.copyPropertiesToTarget)(t,e.on)}(r),function(e){const t=e.emit;e.emit=function(...e){return function(e){try{const t=e[0];if(!t||"string"!=typeof t)throw new n.HudNoEventTypeInSqsConsumerEmit;let r,o;if("message_processed"===t&&(r=1),["error","timeout_error","processing_error"].includes(t)&&(o=1,r=2),void 0===r)return;const a=e[r];if(!a)throw new n.HudNoMessageInSqsConsumerEmit;let c;if(void 0!==o){const t=e[o];if(!(t&&t instanceof Error))throw new n.HudNoErrorInSqsConsumerEmit;c=(0,s.extractName)(t),"StandardError"===c&&t.cause&&t.cause instanceof Error&&(c=(0,s.extractName)(t.cause))}const u=(e,t)=>{const r=e[n.hudConfig.metricSymbol];r?(c&&r.addError(c,t),r.increaseAndShouldEnd(t)&&(r.end(),(0,i.finishSqsInvestigation)(Array.isArray(a)?a:[a],r))):f||(f=!0,n.instrument_logger.warn("No metric found for message"))};Array.isArray(a)&&a.length>=1?u(a[0],a.length):u(a,1)}catch(e){d||(d=!0,n.instrument_logger.error("Error in SqsConsumer.Consumer.emit patched logic",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}))}}(e),t.apply(this,e)},(0,a.copyPropertiesToTarget)(t,e.emit)}(r)}catch(e){n.instrument_logger.error("Error in patching SqsConsumer.Consumer",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r},(0,a.copyPropertiesToTarget)(t,e.Consumer.create)}(e),n.instrument_logger.info("Patched sqs-consumer successfully",{isDapulse:n.hudConfig.userConfig.enableDapulse?.value}),e}}t.default=l;let d=!1,f=!1;function g(e){const t=e.split("/").pop();if(!t)throw new n.HudFailExtractSqsQueueName(`Url: ${e}`);return t}function p(e,t,r){const o=c.SqsMetric.createUsableMetric(e);o.start();const s=r[0];if(!s)return n.instrument_logger.warn("No messages pass to sqs handler",{flowId:e}),void(t.flowMetric=o);if(Array.isArray(s)){if(o.msgCount=s.length,s.forEach(e=>{e[n.hudConfig.metricSymbol]=o}),s[0]?.Attributes?.SentTimestamp){const t=s.reduce((e,t)=>{const r=Number.parseInt(t?.Attributes?.SentTimestamp);return isNaN(r)?e:Math.min(e,r)},1/0);t!==1/0?o.e2eEpocStartTimeMS=t:n.instrument_logger.warn("No valid SentTimestamp found eventhough the first element had SentTimestamp",{flowId:e})}}else o.msgCount=1,s[n.hudConfig.metricSymbol]=o,s?.Attributes?.SentTimestamp&&(o.e2eEpocStartTimeMS=s.Attributes.SentTimestamp);t.flowMetric=o,(0,i.createNewInvestigation)()}function h(e,t,r){const o=c.SqsMetric.createUsableMetric(e);o.start(),t.flowMetric=o}function m(e,t){const r=t.flowMetric;r?r.end():n.instrument_logger.warn("No flowMetric found for message during catch",{flowId:e})}function _(e,t,r){const o=t.flowMetric;o?(o.addError((0,s.extractName)(r)),o.end()):n.instrument_logger.warn("No flowMetric found for message during catch",{flowId:e})}},5459:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(2822),s=r(8949),i=r(8901),a=r(714);class c extends a.FrameworkPatcher{_patch(e){return this._patchEmit(e),o.instrument_logger.info("Patched http successfully"),e}_patchEmit(e){const t=e.Server.prototype.emit;e.Server.prototype.emit=function(e,...r){if("request"!==e)return t.apply(this,[e,...r]);try{const e=r[0],t=r[1],s=i.HttpEndpointMetric.createUsableMetric();s.start(),(0,n.createNewInvestigation)(),s.setRequestAttributes(e),t.once("finish",function(){try{(0,n.finishHttpInvestigation)(e,t,s),s.setResponseAttributes(t),s.end()}catch(e){o.instrument_logger.error("Failed to set response attributes",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),e[o.hudConfig.metricSymbol]=s}catch(e){o.instrument_logger.error("Failed to patch http.Server.prototype.emit",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return t.apply(this,[e,...r])},(0,s.copyPropertiesToTarget)(t,e.Server.prototype.emit)}}t.default=c},5673:e=>{"use strict";e.exports=require("array-flatten")},5688:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerHook=t.safeLog=t.hudRITM=void 0;const o=r(8269),n=r(2546),s=r(7166);function i(){n.instrument_logger.warn("Init timeout disabling hud!"),n.customer_logger.log(n.UserErrorLogs.InitTimeout(globalThis.hudIsRunningFromSetup)),(0,o.detachHud)(!1)}t.hudRITM=s.onRequireFn,t.safeLog=function(e){try{n.app_logger.debug(e)}catch(e){return}},t.registerHook=function(){if(n.app_logger.info("HUD is required"),process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE){if(n.app_logger.info("Running in Lambda environment"),parseInt(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE)<n.hudConfig.lambdaMinimunMemory){const e=process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE;return n.app_logger.warn("Lambda function memory size is less than required, Hud will not run",{memorySize:e}),n.customer_logger.log(n.UserErrorLogs.UnsupportedLambdaMemory()),!1}globalThis.hudRuningInsideLambda=!0}return(0,o.initGlobals)(),n.app_logger.debug("InitGlobals done"),!(globalThis.hudStartFromAutoInit&&!(0,o.validateAndGetUserInput)()||(n.instrument_logger.isValid()?globalThis.hudRanOnRequire?(n.instrument_logger.warn("Already ran onRequire!"),1):(globalThis.hudRanOnRequire=!0,n.instrument_logger.info("Using module",{name:n.SDK_MODULE_NAME}),(0,s.onRequire)(),n.instrument_logger.debug("onRequire done"),globalThis.hudInitGuard=setTimeout(i,n.hudConfig.userConfig.maxTimeUntilInitSessionMs?.value??0),globalThis.hudInitGuard.unref(),0):((0,o.detachHud)(!1),1)))}},5946:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(6730),s=r(4815),i=r(714);class a extends i.FrameworkPatcher{_patch(e){return(0,s.patchUse)(e.prototype,"router"),(0,n.patchMethods)(e.prototype,"router"),o.instrument_logger.info("Patched router successfully"),e}}t.default=a},6093:e=>{"use strict";e.exports=require("@cspotcode/source-map-support")},6504:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLMetric=void 0;const o=r(9873);class n extends o.FlowMetric{constructor(e){super(e)}_createUsableMetric(e){return this}toRaw(){return{flow_id:this.flowId,type:"GraphQLMetric",duration:this.duration}}}t.GraphQLMetric=n},6730:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.patchMethods=t.getMethods=void 0;const i=r(2546),a=s(r(6982)),c=r(8949),u=r(7225);function l(){const e=r(8611);return e.METHODS&&e.METHODS.map(function(e){return e.toLowerCase()})||["get","post","put","head","delete","options","trace","copy","lock","mkcol","move","purge","propfind","proppatch","unlock","report","mkactivity","checkout","merge","m-search","notify","subscribe","unsubscribe","patch","search","connect"]}t.getMethods=l,t.patchMethods=function(e,t){l().concat("all").forEach(function(r){const o=e[r];if(!o)return void(u.isVerboseLoggingEnabled&&i.instrument_logger.warn("Method not found",{method:r}));const n="all"===r;e[r]=function(){try{if(arguments.length<2)return o.apply(this,arguments);let e=this[u.uuidSymbol];u.isVerboseLoggingEnabled&&(e||(e=a.randomUUID(),this[u.uuidSymbol]=e,i.instrument_logger.info("Express method setting uuid",{uuid:e,kind:t})),i.instrument_logger.info("Express added new method",{method:r,uuid:e,path:arguments[0]}));const s=Array.prototype.slice.call(arguments);if(s[1][i.hudConfig.express.layerStateSymbol]={flowId:[],kind:t,allMethod:n},Array.isArray(s[0]))for(const e of s[0]){const e=a.randomUUID();s[1][i.hudConfig.express.layerStateSymbol].flowId.push(e)}else s[1][i.hudConfig.express.layerStateSymbol].flowId.push(a.randomUUID());const c=o.apply(this,s);try{delete s[1][i.hudConfig.express.layerStateSymbol]}catch(e){}return c}catch(e){i.instrument_logger.error("Failed to patch method",{kind:t,method:r,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o.apply(this,arguments)},(0,c.copyPropertiesToTarget)(o,e[r])})}},6928:e=>{"use strict";e.exports=require("path")},6982:e=>{"use strict";e.exports=require("crypto")},7127:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(2546),n=r(6730),s=r(2977),i=r(4815),a=r(7225),c=r(714);class u extends c.FrameworkPatcher{_patch(e){return(0,s.patchRoute)(e.Route),(0,i.patchUse)(e.application,"application"),(0,n.patchMethods)(e.application,"application"),a.isVerboseLoggingEnabled&&(0,a.logLazyRouter)(e.application),e.Router.use?((0,i.patchUse)(e.Router,"router"),(0,n.patchMethods)(e.Router,"router")):o.instrument_logger.warn("Skipping express.Router patching"),o.instrument_logger.info("Patched express successfully"),e}}t.default=u},7131:e=>{"use strict";e.exports=require("./wrap")},7166:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.onRequire=t.skip=t.updateModuleChecker=t.createCheckers=t.patchRequire=t.onRequireFn=t.patchCompile=t.patch=t.supportSourceMapInstall=void 0;const i=s(r(9896)),a=s(r(6928)),c=r(8528),u=r(2546),l=r(3901),d=r(8528),f=r(8269),g=r(2546),p=r(9063),h=r(714),m=function(){const e=g.SDK_MODULE_NAME;try{return a.dirname(a.dirname(g.myRequire.resolve(e)))}catch(t){return u.instrument_logger.error("Failed to resolve own path",{moduleName:e,msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0}),null}}();function _(e){const t=globalThis.HudSourceMapCache.get(e);return t?{map:JSON.parse(t)}:null}function y(){r(6093).install({handleUncaughtExceptions:!1,hookRequire:!1,environment:"node",retrieveSourceMap:_})}function v(e,t,r,o){const n={code:e,map:void 0};try{if(globalThis.hudRunningMode===d.HudRunningMode.detached)return n;if(r===c.Format.esm&&!o)throw new g.HudError("MessagePort is required for patching ESM modules");if(T(t));else if(e.length>(g.hudConfig.userConfig.maxFileSizeBytes?.value??0)&&!e.startsWith(g.hudConfig.esbuildMark))u.instrument_logger.info("Skipping large file",{filename:t,size:e.length});else{const s=Date.now(),c=(0,l.edit)(e,t,r),d=c.metadatas;if(n.code=c.transformedCode,n.map=d,u.instrument_logger.debug("Patched",{filename:t,time:Date.now()-s}),o)for(const e of d)o.postMessage({key:"HudModulePatch",hudPatched:t,hudProcessedFiles:e});else globalThis.hudPatched.add(t),globalThis.hudProcessedFiles.push(...d),globalThis.hudDeclarationsFound=!0,globalThis.hudInstrumentationIndicator&&(clearTimeout(globalThis.hudInstrumentationIndicator),globalThis.hudInstrumentationIndicator=void 0);g.hudConfig.writePatched&&function(e,t){const r=a.parse(e);let o=`${r.dir}/patched.${r.base}`;r.dir.includes("dist")&&(o=a.join(`${r.dir.replace("dist","patched")}`,r.base)),i.existsSync(a.dirname(o))||i.mkdirSync(a.dirname(o),{recursive:!0}),i.writeFileSync(o,t,"utf8"),u.instrument_logger.debug("Dumped patched file",{filename:e,patchedPath:o})}(t,c.transformedCode)}}catch(e){u.instrument_logger.error("Failed to patch",{filename:t,format:r,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return n}t.supportSourceMapInstall=y,t.patch=v;let b="",w=!0,k=!1;function S(){if(!(0,g.isSupportedNative)())return;const e=r(3339),t=(0,u.shouldSupportSourceMap)();k&&u.instrument_logger.warn("PatchCompile ran twice"),0===Object.keys(globalThis.hudLoadedModules).length&&(globalThis.hudLoadedModules=Object.keys(g.myRequire.cache));const o=e.prototype._compile;e.prototype._compile=function(e,r){if(r===b){try{const e=w?u.instrument_logger.warn.bind(u.instrument_logger):u.instrument_logger.debug.bind(u.instrument_logger);w=!1,e("Skipping compile since already ran",{filename:r})}catch{}return o.call(this,e,r)}b=r,u.instrument_logger.verbose("Compiling requirement",{filename:r});const n=v(e,r,c.Format.cjs);try{if(t&&n.map){const e=(0,u.combineSourceMaps)(n.map,r);e&&globalThis.HudSourceMapCache.set(r,e)}}catch(e){u.instrument_logger.error("Failed to combine source maps",{filename:r,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const s=o.call(this,n.code,r);return b="",s},k=!0,u.instrument_logger.debug("Patched _compile")}function E(e,t,r){try{const o=g.hudConfig.frameworksToPatch.get(t);return o?.patcher&&o.version?(0,h.getFrameworkPatcher)(o.patcher).patch(e,r,o.version,o.extraInfo,t):e}catch(e){u.instrument_logger.error("Failed to patch framework",{name:t,msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}function M(){new p.Hook(Array.from(g.hudConfig.frameworksToPatch.keys()),{internals:!0},E)}function C(e){const t=a.sep.replace(/\\/g,"\\\\"),r=a.join(e),o=t+"node_modules"+t;return{isAllowdModule:new RegExp(o+r.split(".").join("\\.").split("*").join(".*?")+t,""),isAllowdModuleSubModule:new RegExp(o+r.split("*").join(".*?")+o,"")}}function x(e,t){return!!t.isAllowdModule.test(e)&&!t.isAllowdModuleSubModule.test(e)}function I(e,t){return e.includes(`node_modules${a.sep}${t}${a.sep}`)&&!e.includes(`node_modules${a.sep}${t}${a.sep}node_modules`)}function O(e){const t=[];for(const r of e){let e;if(r.includes("*")){const t=C(r);e=e=>x(e,t)}else e=e=>I(e,r);t.push(e)}return t}t.patchCompile=S,t.onRequireFn=E,t.patchRequire=M,t.createCheckers=O;let P=[];function F(){P=O(g.hudConfig.userConfig.includeModules?.value??[])}function T(e,t){if(!g.hudConfig.allowedEditExtensions.includes(a.extname(e)))return u.instrument_logger.warn("Skipping non-allowed extension",{filename:e}),!0;const r=t??P;return"/var/runtime/index.mjs"===e?(u.instrument_logger.debug("Skipping lambda runtime",{filename:e}),!0):e.includes("node_modules")&&!function(e,t){for(const r of t)if(r(e))return!0;return!1}(e,r)||e.includes(".yarn")?(u.instrument_logger.debug("Skipping non-monitored imported module",{filename:e}),!0):!(m&&!e.includes(m)||(u.instrument_logger.debug("Skipping hud internal module",{filename:e}),0))}t.updateModuleChecker=F,t.skip=T,t.onRequire=function(){try{F();try{S()}catch(e){u.instrument_logger.error("Failed to patch compile",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{(0,u.shouldSupportSourceMap)()&&y()}catch(e){u.instrument_logger.error("Failed to install source map support",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{M()}catch(e){u.instrument_logger.error("Failed to patch require",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}catch(e){u.instrument_logger.error("Something went wrong in onRequire",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{(0,f.saveMachineMetric)()}catch(e){u.instrument_logger.error("Failed to add metric",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}},7214:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8528),n=r(8269),s=r(2546),i=r(8949),a=r(6504),c=r(714);class u extends c.FrameworkPatcher{static graphQLPatchedSymbol=Symbol.for(s.hudConfig.hudPatchedName);_patch(e){return this.patchGraphql(e),s.instrument_logger.info("Patched GraphQL successfully"),e}patchGraphql(e){const t=e.execute;e.execute=function(e){!function(e){try{e&&!e[u.graphQLPatchedSymbol]&&(l(e._queryType),l(e._mutationType),e[u.graphQLPatchedSymbol]=!0,s.instrument_logger.info("Patched GraphQL schema successfully"))}catch(e){s.instrument_logger.error("Failed to patch GraphQL schema",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(e.schema);const r=process.hrtime.bigint();return function(e,t,r){return"function"==typeof e.then?e.then(e=>(p(t,r),e)):(p(t,r),e)}(t.apply(this,arguments),e.document,r)},(0,i.copyPropertiesToTarget)(t,e.execute)}}function l(e){if(!e)return;const t=e._fields;Object.keys(t).forEach(r=>{const c=t[r];!function(e,t,r){if(e.resolve&&!e.resolve[u.graphQLPatchedSymbol]){const o=(0,s.generateGraphqlFlowId)(r,t);(0,n.storeResolverDeclaration)({id:o,operation:t,name:r});const c=e.resolve;e.resolve=(0,i.wrapFlow)(g,c,(e,t)=>{const r=a.GraphQLMetric.createUsableMetric();r.start(),r.setFlowId(e),t.flowMetric=r},(e,t)=>{const r=t.flowMetric;r?r.end():s.instrument_logger.warn("No flowMetric found for resolver",{flowId:e})},(e,t)=>{const r=t.flowMetric;r?r.end():s.instrument_logger.warn("No flowMetric found for resolver",{flowId:e})}),e.resolve[u.graphQLPatchedSymbol]=!0,(0,n.storeResolverIdBySelectionName)(o,r)}}(c,o.GraphQLSupportedOperations[e.name.toLowerCase()],r),c.type._fields&&f(c.type)})}t.default=u;const d=new WeakSet;function f(e){e&&e._fields&&!d.has(e)&&(d.add(e),Object.keys(e._fields).forEach(t=>{const r=e._fields[t];if(!r||!r.type)return;!function(e){const t=e.resolve;t&&!e.resolve[u.graphQLPatchedSymbol]&&(e.resolve=(0,i.wrapFlow)(g,t),e.resolve[u.graphQLPatchedSymbol]=!0)}(r);let o=r.type;for(;o.ofType;)o=o.ofType;f(o)}))}function g(e){if(void 0===e[2]||void 0===e[3])return void s.instrument_logger.warn("GraphQL resolver arguments are unknown");const t=e[3].path;if(t&&!t.prev){const r=t.key,o=(0,n.getResolverIdBySelectionName)(r);return e[2][u.graphQLPatchedSymbol]=o,o}if(e[2][u.graphQLPatchedSymbol])return e[2][u.graphQLPatchedSymbol];s.instrument_logger.warn("GraphQL No functionId found for resolver")}function p(e,t){try{new n.GraphQLDocumentMetadata(e,Number(process.hrtime.bigint()-t)).save()}catch(e){s.instrument_logger.error("Failed to save document metadata",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}},7225:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.logLazyRouter=t.skipStackNamesLogs=t.skipLayerNamesLogs=t.isVerboseLoggingEnabled=t.uuidSymbol=void 0;const i=r(2546),a=s(r(6982)),c=r(932),u=r(8949);t.uuidSymbol=Symbol.for("__hud_uuid__"),t.isVerboseLoggingEnabled="true"===c.env.HUD_LOG_EXPRESS,t.skipLayerNamesLogs=new Set(["query","expressInit","mounted_app"]),t.skipStackNamesLogs=new Set(["router"]),t.logLazyRouter=function(e){const r=e.lazyrouter;e.lazyrouter=function(){let e=!1;try{this._router||(e=!0)}catch(e){i.instrument_logger.error("Failed to check this._router",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const o=r.apply(this,arguments);try{if(e){let e=this[t.uuidSymbol];e||(e=a.randomUUID(),this[t.uuidSymbol]=e,i.instrument_logger.info("Express lazy router setting uuid",{uuid:e})),i.instrument_logger.info("Express lazy router",{parent:e,child:this._router?.[t.uuidSymbol]})}}catch(e){i.instrument_logger.error("Failed to patch express.lazyRouter function",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return o},(0,u.copyPropertiesToTarget)(r,e.lazyrouter)}},7603:(e,t)=>{"use strict";function r(e){try{return e.headers["x-amzn-trace-id"]}catch{return}}function o(e){try{return e.headers.traceparent}catch{return}}function n(e){try{return e.headers["x-datadog-trace-id"]}catch{return}}Object.defineProperty(t,"__esModule",{value:!0}),t.getObservabilityIdentifiers=void 0,t.getObservabilityIdentifiers=function(e){return{datadog_trace_id:n(e),otel_trace_id:o(e),amazon_trace_id:r(e)}}},7707:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncFunction=void 0,t.AsyncFunction=(async()=>{}).constructor},7808:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getCpuUsage=t.getMachineMetrics=void 0;const n=r(8269),s=r(2546),i=o(r(857)),a=r(2987);function c(e){try{return a.performance.eventLoopUtilization(e).utilization}catch(e){return void s.app_logger.error("Error getting event loop utilization",e)}}function u(){try{const e=process.memoryUsage(),t=i.default.totalmem();return{rss:e.rss,heap_total:e.heapTotal,heap_used:e.heapUsed,external:e.external,system_memory:t,rss_percentage:e.rss/t*100}}catch(e){return void s.app_logger.error("Error getting memory usage",e)}}function l(e,t){try{const r=process.cpuUsage(),o=1e3*(Date.now()-t),n=(0,s.getCpuLimit)(s.app_logger),i=(r.user-e.user)/o,a=(r.system-e.system)/o;return{user_time:i,system_time:a,limit:n,user_percent_of_limit:"number"==typeof n?i/n*100:void 0,system_percent_of_limit:"number"==typeof n?a/n*100:void 0}}catch(e){return void s.app_logger.error("Error getting cpu usage",e)}}t.getMachineMetrics=function(){try{const e=(0,n.getLastMetrics)();return{cpu_usage:e.cpuUsage?l(e.cpuUsage,e.timestamp):void 0,memory_usage:u(),event_loop_utilization:e.elu?c(e.elu):void 0}}catch(e){return void s.app_logger.error("Error getting machine metrics",e)}},t.getCpuUsage=l},8064:e=>{"use strict";e.exports=require("semver")},8269:e=>{"use strict";e.exports=require("./globalstate")},8528:e=>{"use strict";e.exports=require("./dto")},8611:e=>{"use strict";e.exports=require("http")},8901:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpEndpointMetric=void 0;const o=r(9873);class n extends o.FlowMetric{statusCode;route;method;constructor(e){super(e)}_createUsableMetric(e){return this}setRequestAttributes(e){const t=e.url||e.path;this.route=t?.split("?")[0],this.method=e.method}setResponseAttributes(e){this.statusCode=e.statusCode}toRaw(){if(this.statusCode&&this.route&&this.method)return{flow_id:this.flowId,type:"EndpointMetric",duration:this.duration,status_code:this.statusCode,route:this.route,method:this.method}}}t.HttpEndpointMetric=n},8949:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.copyPropertiesToTarget=t.wrapFlow=void 0;const o=r(8528),n=r(2546),s=r(7707);function i(e,t){const r=Object.getOwnPropertyDescriptors(e),o=Reflect.ownKeys(r);Object.setPrototypeOf(t,e),o.forEach(e=>{try{Object.defineProperty(t,e,r[e])}catch(e){}})}t.wrapFlow=function(e,t,r,a,c){let u;return u=t instanceof s.AsyncFunction?async function(...s){let i;try{i=e(s)}catch(e){n.instrument_logger.error("Failed to get flowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}if(!i||hudRunningMode!==o.HudRunningMode.enabled)return await t.apply(this,s);_hud_F=i,hudShouldLinkFunction=!0;const u={};if(r)try{r(i,u,s)}catch(e){n.instrument_logger.error("Failed to execute beforeCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{const e=t.apply(this,s);_hud_F="";const r=await e;if(a)try{a(i,u)}catch(e){n.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return r}catch(e){if(c)try{c(i,u,e)}catch(e){n.instrument_logger.error("Failed to execute catchCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}throw e}finally{_hud_F="",hudShouldLinkFunction=!1}}:function(...s){let i;try{i=e(s)}catch(e){n.instrument_logger.error("Failed to get flowId",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}if(!i||hudRunningMode!==o.HudRunningMode.enabled)return t.apply(this,s);_hud_F=i,hudShouldLinkFunction=!0;const u={};if(r)try{r(i,u,s)}catch(e){n.instrument_logger.error("Failed to execute beforeCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}try{const e=t.apply(this,s);if(a)if(e instanceof Promise)e.then(()=>{try{a(i,u)}catch(e){n.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}});else try{a(i,u)}catch(e){n.instrument_logger.error("Failed to execute afterCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return e}catch(e){if(c)try{c(i,u,e)}catch(e){n.instrument_logger.error("Failed to execute catchCallbackHook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}throw e}finally{_hud_F="",hudShouldLinkFunction=!1}},i(t,u),u},t.copyPropertiesToTarget=i},9063:e=>{"use strict";e.exports=require("require-in-the-middle")},9873:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FlowMetric=void 0;const n=r(8528),s=r(8269),i=o(r(932));t.FlowMetric=class{_state;flowId;duration;_startTime;_msStartTime;constructor(e){this.flowId=e,this.duration=0,this._state="usable"}static createUsableMetric(e){return new this(e)._createUsableMetric(e)}setFlowId(e){this.flowId=e}getFlowId(){return this.flowId}getMsStartTime(){return this._msStartTime}start(){this._startTime=i.default.hrtime.bigint(),this._msStartTime=Date.now()}end(){this._startTime&&(this.duration=Number(i.default.hrtime.bigint()-this._startTime)),this.#e(),this._state="unusable"}#e(){if(hudRunningMode===n.HudRunningMode.enabled){const e=this.toRaw();e&&(0,s.storeFlowMetric)(e)}}}},9896:e=>{"use strict";e.exports=require("fs")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}return r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r(2197)})());
2
2
  //# sourceMappingURL=instrument.js.map
package/dist/cjs/lib.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(global,()=>(()=>{"use strict";var e={363:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateUserConfigFromInitOptions=t.updateUserConfigFromEnv=t.updateUserConfigFromFile=t.updateUserConfigFromInit=void 0;const o=r(8528),n=r(1569),i=r(8138),s=r(2794),a=r(3073),l=r(9100),u=o.HudInitOptionsSchema.omit({customOptions:!0}).extend({key:n.z.string().optional(),service:n.z.string().optional(),enable:n.z.boolean().optional(),enableDapulse:n.z.boolean().optional()});t.updateUserConfigFromInit=function(e,t){void 0!==e&&(l.hudConfig.userConfig.key={value:e,source:"INIT"}),void 0!==t&&(l.hudConfig.userConfig.service={value:t,source:"INIT"})},t.updateUserConfigFromFile=function(){let e;try{e=(0,s.getConfigContent)()}catch(e){throw e instanceof s.HudFailedReadConfigError&&"EACCES"===e.code&&a.customer_logger.log(i.UserErrorLogs.ConfigInaccessible(e.path)),e}if(e)try{const t=u.partial().parse(JSON.parse(e.content));Object.entries(t).forEach(([t,r])=>{!function(e,t,r){e[t]=r}(l.hudConfig.userConfig,t,{value:r,source:"HUD_CONFIG"===e.source?"CONFIG_ENV":"CONFIG_FILE"})})}catch(t){throw t instanceof n.ZodError?t.errors.forEach(t=>{const r=t.path.join(".");a.customer_logger.log(i.UserErrorLogs.ZodErrorInUserConfig(e.source,r))}):a.customer_logger.log(i.UserErrorLogs.JSONErrorInUserConfig(e.source,t.message)),t}},t.updateUserConfigFromEnv=function(){const e=process.env.HUD_KEY,t=process.env.HUD_SERVICE,r=process.env.HUD_ENABLE_DAPULSE,o=(0,l.getModulesToTraceFromEnv)(),n=process.env.HUD_MAX_INSTRUMENTED_FUNCTIONS,i=process.env.HUD_MIN_POD_MEMORY_MB;e&&(l.hudConfig.userConfig.key={value:e,source:"ENV"}),t&&(l.hudConfig.userConfig.service={value:t,source:"ENV"}),r&&(l.hudConfig.userConfig.enableDapulse={value:"true"===r,source:"ENV"}),o&&(l.hudConfig.userConfig.includeModules={value:o,source:"ENV"}),n&&(l.hudConfig.userConfig.maxMappedFunctions={value:parseInt(n),source:"ENV"}),i&&(l.hudConfig.userConfig.minPodMemoryMB={value:parseInt(i),source:"ENV"})},t.updateUserConfigFromInitOptions=function(e,t){e.includeModules&&Array.isArray(e.includeModules)&&(l.hudConfig.userConfig.includeModules={value:e.includeModules,source:t}),e.customOptions&&e.customOptions.dapulseSqsConsumer&&(l.hudConfig.userConfig.enableDapulse={value:"true"===e.customOptions.dapulseSqsConsumer,source:t}),e.maxMappedFunctions&&"number"==typeof e.maxMappedFunctions&&(l.hudConfig.userConfig.maxMappedFunctions={value:e.maxMappedFunctions,source:t}),e.minPodMemoryMB&&"number"==typeof e.minPodMemoryMB&&(l.hudConfig.userConfig.minPodMemoryMB={value:e.minPodMemoryMB,source:t}),e.maxFileSizeBytes&&"number"==typeof e.maxFileSizeBytes&&(l.hudConfig.userConfig.maxFileSizeBytes={value:e.maxFileSizeBytes,source:t}),e.maxTimeUntilInitSessionMs&&"number"==typeof e.maxTimeUntilInitSessionMs&&(l.hudConfig.userConfig.maxTimeUntilInitSessionMs={value:e.maxTimeUntilInitSessionMs,source:t})}},669:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UserLogs=void 0,t.UserLogs={HudInitSuccess:()=>({level:"info",message:"Session started"}),FirstDecalarationSent:()=>({level:"info",message:"First code mapping sent successfully"}),FirstInvocationSent:()=>({level:"info",message:"First invocation sent successfully"}),HappyFlowCompleted:()=>({level:"info",message:"Your service is sending data successfully"}),FilesLoadedBeforeRegister:()=>({level:"info",message:"Files loaded before register():"}),FileBeforeRegisterTemplate:(e,t)=>({level:"info",message:`${e}. ${t}`}),InitIdleMode:()=>({level:"info",message:"Initialized successfully in idle mode."})}},857:e=>{e.exports=require("os")},1012:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=t.SDK_MODULE_NAME=void 0,n(r(9100),t),n(r(4627),t);var i=r(8809);Object.defineProperty(t,"SDK_MODULE_NAME",{enumerable:!0,get:function(){return i.SDK_MODULE_NAME}}),n(r(2684),t),n(r(363),t);var s=r(3312);Object.defineProperty(t,"SDK_VERSION",{enumerable:!0,get:function(){return s.SDK_VERSION}})},1493:e=>{e.exports=require("v8")},1569:e=>{e.exports=require("zod")},1620:e=>{e.exports=require("winston-transport")},1622:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodKind=t.getContextualData=t.getContextSymbol=t.getFunctionIdentifier=void 0;const s=i(r(6346)),a=r(6346),l=r(8528),u=r(8138),c=r(3073),d=r(2213),p=r(1974);function m(e,t){return{name:t,sourcemap_location_hints:(0,p.getLocationList)(e,t),format:"%s"}}function f(e){if(a.types.isIdentifier(e))return{name:e.name,sourcemap_location_hints:e.loc?[{name:e.name,line:e.loc.start.line,column:e.loc.start.column,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column}]:[],format:"%s"};if(a.types.isMemberExpression(e)||a.types.isOptionalMemberExpression(e)){let t;t=a.types.isThisExpression(e.object)?{name:"this",sourcemap_location_hints:(0,p.getLocationList)(e.object,"this")}:f(e.object);const r=f(e.property),o=e.computed?t.name+"["+r.name+"]":t.name+"."+r.name,n=t.format??"%s",i=r.format??"%s",s=e.computed?`${n}[${i}]`:`${n}.${i}`;return{name:o,sourcemap_location_hints:[...t.sourcemap_location_hints,...r.sourcemap_location_hints],format:s}}if(a.types.isOptionalCallExpression(e)||a.types.isCallExpression(e))return f(e.callee);if(a.types.isSequenceExpression(e))return(0,d.isHudAwaitSequence)(e)?f((0,d.getHudAwaitSequenceElement)(e)):f(e.expressions[e.expressions.length-1]);if(a.types.isArrayExpression(e))return{name:"[]",sourcemap_location_hints:(0,p.getLocationList)(e,"[]"),format:"%s"};if(a.types.isObjectExpression(e))return{name:"{}",sourcemap_location_hints:(0,p.getLocationList)(e,"{}"),format:"%s"};if(a.types.isStringLiteral(e))return{name:`"${e.value}"`,sourcemap_location_hints:(0,p.getLocationList)(e,e.value),format:'"%s"'};throw new u.HudUnsupportedError("Unsupported left side of assignment - "+e.type+"loc - "+JSON.stringify(e.loc))}function g(e){const{node:t}=e;if(e.isExpression())try{return function(e){const{parent:t}=e;if(a.types.isVariableDeclarator(t)&&a.types.isIdentifier(t.id))return m(t,t.id.name);if(a.types.isObjectProperty(t)&&a.types.isIdentifier(t.key))return m(t,t.key.name);if(a.types.isClassProperty(t)&&a.types.isIdentifier(t.key))return m(t,t.key.name);if(a.types.isAssignmentExpression(t))return f(t.left);if(a.types.isAssignmentPattern(t))return f(t.left);throw new u.HudUnsupportedError(`Unsupported parent type - ${t.type} for me ${e.node.type}`)}(e)}catch(e){if(e instanceof u.HudUnsupportedError)return;throw e}c.worker_logger.debug("getContextSymbol; Unsupported node type",{type:t.type})}function y(e){const t=[];return e.arguments.forEach((e,r)=>{let o,n;a.types.isStringLiteral(e)?(o=l.ArgumentTypes.StringLiteral,n=e.value):a.types.isTemplateLiteral(e)?(o=l.ArgumentTypes.TemplateString,n=function(e){let t="";const r=e.quasis,o=e.expressions;for(let e=0;e<r.length;e++)t+=r[e].value.cooked,e<o.length&&(t+=`\${${h(o[e])}}`);return t=`\`${t}\``,t}(e)):a.types.isIdentifier(e)&&(o=l.ArgumentTypes.Identifier,n=e.name),o&&n&&t.push({index:r,type:o,value:n})}),t}function h(e){if(a.types.isIdentifier(e))return e.name;if(a.types.isStringLiteral(e))return e.value;if(a.types.isCallExpression(e)||a.types.isOptionalCallExpression(e)){const t=e;if(a.types.isIdentifier(t.callee))return t.callee.name;if(a.types.isMemberExpression(t.callee)||a.types.isOptionalMemberExpression(t.callee)){let e="";const r=t.callee;if(a.types.isThisExpression(r.object)?e+="this.":a.types.isIdentifier(r.object)&&(e+=`${r.object.name}.`),""!==e&&a.types.isIdentifier(r.property))return e+=`${r.property.name}`,e}}return""}t.getFunctionIdentifier=function(e){const{node:t}=e;if(a.types.isFunctionDeclaration(t)||a.types.isFunctionExpression(t)){if(a.types.isIdentifier(t.id))return t.id}else if(a.types.isClassMethod(t)){if(a.types.isIdentifier(t.key))return t.key}else if(a.types.isClassPrivateMethod(t)){if(a.types.isIdentifier(t.key.id))return t.key.id}else if(a.types.isObjectMethod(t)&&a.types.isIdentifier(t.key))return t.key},t.getContextSymbol=g,t.getContextualData=function(e){let t,r=!1;return(e.isFunctionExpression()||e.isArrowFunctionExpression())&&(t=function(e){const t=e.parentPath;if(t.isCallExpression())for(const[r,o]of t.node.arguments.entries())if(o===e.node){const e=t.node.callee;let o;try{o=f(e)}catch(t){if(!(t instanceof u.HudUnsupportedError))throw t;c.worker_logger.debug("could not get callee symbol recursively",{error:t,type:e.type})}const n=y(t.node);return{callee:{symbol:o,argsCount:t.node.arguments.length,args:n},index:r}}}(e),r=function(e){const t=e.parentPath;return!!t.isCallExpression()&&t.node.callee===e.node}(e)),{symbol:g(e),callback:t,immediatelyInvoked:r}},t.getMethodKind=function(e){if(s.types.isClassMethod(e)||s.types.isObjectMethod(e)||s.types.isClassPrivateMethod(e))return e.kind}},1974:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getNodeLocation=t.resolveScopeSymbols=t.resolveSymbol=t.getLocationList=void 0;const n=o(r(9023)),i=r(3073);function s(e,t){let r=t.name;const o=t.sourcemap_location_hints.map(t=>{const r=e({line:t.line,column:t.column});if(null===r.line||null===r.column)return{name:t.name,line:-1,column:-1,line_on_server:t.line_on_server,column_on_server:t.column_on_server};let o=r.name??t.name??void 0;return o?.startsWith("#")&&(o=o.slice(1)),{name:o,line:r.line,column:r.column,line_on_server:t.line_on_server,column_on_server:t.column_on_server,resolved:!0}});return o.length>0&&o.every(e=>e.name)&&(t.format?Array.from(t.format.matchAll(/%s/g)).length!==o.length?i.worker_logger.warn("Format string does not match number of location hints",{format:t.format,locationHints:o}):r=n.default.format(t.format,...o.map(e=>e.name)):r=o.map(e=>e.name).join(".")),{name:r,sourcemap_location_hints:o}}t.getLocationList=function(e,t){return e.loc?[{line:e.loc.start.line,column:e.loc.start.column,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column,name:t}]:[]},t.resolveSymbol=s,t.resolveScopeSymbols=function(e,t){const{context:r}=t,o=r.symbol?s(e,r.symbol):void 0,n=s(e,t.symbol);return{...t,context:{...r,symbol:o},symbol:n}},t.getNodeLocation=function(e,t,r=void 0){const o=e.loc?.start,n=e.loc?.end;if(!o||!n)return i.worker_logger.info("Node without location",{filename:r,type:e.type}),{start:{source:null,line:-1,column:-1},end:{source:null,line:-1,column:-1}};const s=t({line:o.line,column:o.column}),a=t({line:n.line,column:n.column});return null!==s.line&&null!==s.column&&null!==a.line&&null!==a.column||(i.worker_logger.debug("Could not find location for function",{filename:r,type:e.type,locStart:o,locEnd:n}),s.line=-1,s.column=-1,a.line=-1,a.column=-1),{start:{source:s.source,line:s.line,column:s.column},end:{source:a.source,line:a.line,column:a.column}}}},2213:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getHudAwaitSequenceElement=t.isHudAwaitSequence=void 0;const o=r(6346),n=r(1012),i=r(8138);t.isHudAwaitSequence=function(e){if(e.expressions.length<2)return!1;const t=e.expressions[e.expressions.length-1];return!!o.types.isIdentifier(t)&&!!t.name.startsWith(n.hudConfig.wrapVarPrefix)},t.getHudAwaitSequenceElement=function(e){const t=e.expressions[0];if(!o.types.isAssignmentExpression(t))throw new i.HudUnsupportedError("Expected assignment expression");const{left:r,right:s}=t;if(!o.types.isIdentifier(r)||!r.name.startsWith(n.hudConfig.wrapVarPrefix))throw new i.HudUnsupportedError("Expected identifier starting with "+n.hudConfig.wrapVarPrefix);return s}},2241:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1012),t),n(r(8287),t),n(r(8138),t),n(r(8808),t),n(r(2794),t),n(r(7582),t),n(r(3073),t),n(r(5290),t),n(r(5822),t),n(r(3699),t),n(r(4219),t),n(r(4451),t),n(r(2908),t),n(r(2451),t),n(r(3431),t),n(r(669),t),n(r(8066),t)},2298:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNamespaceScopeable=t.isHudScopeable=t.NamespaceScopeAlias=t.ScopableAlias=void 0;const o=r(6346);t.ScopableAlias="ArrowFunctionExpression|BlockStatement|CatchClause|ClassMethod|ClassPrivateMethod|DeclareModule|DoExpression|DoWhileStatement|ForInStatement|ForOfStatement|ForStatement|FunctionDeclaration|FunctionExpression|IfStatement|LabeledStatement|ObjectMethod|StaticBlock|SwitchCase|TSModuleBlock|TryStatement|WhileStatement|WithStatement|ClassDeclaration|ClassExpression|ObjectExpression|SwitchStatement",t.NamespaceScopeAlias="FunctionDeclaration|FunctionExpression|ArrowFunctionExpression|ObjectMethod|ClassMethod|ClassPrivateMethod|ClassDeclaration|ClassExpression|ObjectExpression",t.isHudScopeable=function(e){return o.types.isArrowFunctionExpression(e)||o.types.isBlockStatement(e)||o.types.isCatchClause(e)||o.types.isClassMethod(e)||o.types.isClassPrivateMethod(e)||o.types.isDeclareModule(e)||o.types.isDoExpression(e)||o.types.isDoWhileStatement(e)||o.types.isForInStatement(e)||o.types.isForOfStatement(e)||o.types.isForStatement(e)||o.types.isFunctionDeclaration(e)||o.types.isFunctionExpression(e)||o.types.isIfStatement(e)||o.types.isLabeledStatement(e)||o.types.isObjectMethod(e)||o.types.isProgram(e)||o.types.isStaticBlock(e)||o.types.isSwitchCase(e)||o.types.isTSModuleBlock(e)||o.types.isTryStatement(e)||o.types.isWhileStatement(e)||o.types.isWithStatement(e)||o.types.isClassDeclaration(e)||o.types.isClassExpression(e)||o.types.isObjectExpression(e)||o.types.isSwitchStatement(e)},t.isNamespaceScopeable=function(e){return o.types.isFunction(e)||o.types.isClass(e)||o.types.isObjectExpression(e)}},2451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUserTsNodeConfig=void 0;const o=r(8138),n=r(3073),i=r(8066);t.getUserTsNodeConfig=function(e=!0){const t=function(){try{const e=i.myRequire.resolve("ts-node");if(!e)return;if(!i.myRequire.cache[e])return;const t=(0,i.myRequire)("ts-node"),r=process[t.REGISTER_INSTANCE];if(!r)return;return r.options}catch(e){return}}();if(t){if(!t.transpileOnly)throw e&&n.customer_logger.log(o.UserErrorLogs.TsNodeNotTranspileOnly()),n.app_logger.warn("ts-node is used but not configured to transpile only"),new o.HudNoTranspileOnlyError;return{cwd:t.cwd,project:t.project,projectSearchDir:t.projectSearchDir}}if(process.argv[0].endsWith("ts-node"))throw e&&n.customer_logger.log(o.UserErrorLogs.TsNodeNotFoundEvenThoughRunWithTsNode()),n.app_logger.info("ts-node not found even run with ts-node"),new o.HudTsNodeNotFoundButUsed}},2684:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectStoreConfigSchema=void 0;const o=r(1569),n=o.z.object({type:o.z.literal("s3")}),i=o.z.object({type:o.z.literal("disk"),path:o.z.string()});t.ObjectStoreConfigSchema=o.z.union([n,i])},2784:e=>{e.exports=require("../native/_index")},2794:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getConfigContent=t.HudFailedReadConfigError=t.isHudEnabled=void 0;const s=i(r(9896)),a=i(r(6928)),l=r(8138),u=r(3073);t.isHudEnabled=function(){if("false"===process.env.HUD_ENABLE)return!1;if(globalThis.forceHudEnable)return!0;let e,t;try{if(e=d(),e&&(t=JSON.parse(e.content),!1===t.enable))return!1}catch(t){throw t instanceof c&&"EACCES"===t.code?u.customer_logger.log(l.UserErrorLogs.ConfigInaccessible(t.path)):e&&u.customer_logger.log(l.UserErrorLogs.JSONErrorInUserConfig(e.source,t instanceof Error?t.message:void 0)),t}return"true"===process.env.HUD_ENABLE||!0===t?.enable};class c extends Error{path;code;constructor(e,t){super(),this.path=e,this.code=t}}function d(){if(process.env.HUD_CONFIG)return{content:process.env.HUD_CONFIG,source:"HUD_CONFIG"};const e=function(){try{const e=process.env.HUD_CONFIG_PATH;if(e)return s.existsSync(e)?e:void 0;let t=__dirname,r=0;for(;"/"!==t&&r<10;){const e=`${t}/hud.config`;if(s.existsSync(e))return e;t=a.dirname(t),r++}}catch(e){return}}();if(e)try{return{content:s.readFileSync(e,"utf8"),source:e}}catch(t){throw new c(e,t.code)}}t.HudFailedReadConfigError=c,t.getConfigContent=d},2908:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.suppressTraces=void 0;const o=r(1012),n=r(3073),i=r(8066);let s,a;try{const e=(0,i.myRequire)("@opentelemetry/api"),t=(0,i.myRequire)("@opentelemetry/core");s=e.context,a=t.suppressTracing,n.app_logger.info("OpenTelemetry exists",{suppressConfig:o.hudConfig.suppressTraces})}catch(e){n.app_logger.info("OpenTelemetry api/core does not exist")}t.suppressTraces=function(e){return function(...t){return o.hudConfig.suppressTraces&&s&&a?(n.app_logger.debug("Running with Suppressed traces"),s.with(a(s.active()),()=>e(...t))):e(...t)}}},2987:e=>{e.exports=require("perf_hooks")},3073:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.worker_logger=t.instrument_logger=t.app_logger=t.customer_logger=t.formatLogMessage=t.SafeLogger=t.renewFileTransports=t.getSavedLogs=t.getLogPath=t.WorkerPortTransport=void 0;const a=i(r(6982)),l=i(r(9896)),u=i(r(857)),c=i(r(6928)),d=i(r(5124)),p=s(r(1620)),m=r(9100),f={...process.env.HUD_DEBUG?m.hudConfig.logger.debug:m.hudConfig.logger.default,console:!!process.env.HUD_VERBOSE};class g extends p.default{_messeagesToSend=[];messagesLimit=m.hudConfig.loggerWorkerPortSizeLimit;messageDropCount=0;getMessagesToSend(){if(!this._messeagesToSend.length)return!1;const e=this._messeagesToSend;this.clearMessagesToSend();const t=this.messageDropCount;return this.messageDropCount=0,{logsBuf:this.formatMessagesToSend(e),messageDropCount:t}}clearMessagesToSend(){this._messeagesToSend=[]}formatMessagesToSend(e){return e.map(e=>JSON.stringify(e)).join("\n")}log(e,t){this._messeagesToSend.length>=this.messagesLimit?this.messageDropCount++:this._messeagesToSend.push(e),t()}}t.WorkerPortTransport=g;const y=d.format.combine(d.format.timestamp({format:"HH:mm:ss.SSS"}),d.format.printf(({level:e,message:t,timestamp:r,label:o,...n})=>{try{const i=Object.keys(n).length;let s;if(i)if(1===i){const e=Object.keys(n)[0];s=`${t} ${e}: ${JSON.stringify(n[e],null,2)}`}else s=`${t}\n${JSON.stringify(n,null,2)}`;else s=t;const a=d.format.colorize().colorize(e,e.toUpperCase());return`[${r}]${(o?`(${o})`:"").padEnd(8," ")} ${a}: ${s}`}catch(e){return t}}));function h(e){return d.format.combine(d.format.label({label:e}),d.format.timestamp({format:()=>(new Date).toISOString()}),d.format.json())}function v(e){return{filename:E(),level:f.levels[e],format:h(e),lazy:!1}}function _(){if(m.hudConfig.logDirectory)return m.hudConfig.logDirectory;const e=u.homedir();switch(u.platform()){case"darwin":return c.join(e,"Library","Logs","hud");case"win32":return c.join(e,"AppData","hud","Logs");default:return c.join(e,".hud","logs")}}let b;function E(){return b??=c.join(_(),`${a.randomUUID()}.log`)}t.getLogPath=E,t.getSavedLogs=function(){const e=[];for(const[t,r]of Object.entries(S))for(const t of r.transports)try{if(t instanceof g){const o=t.getMessagesToSend();if(!o)continue;const{logsBuf:n,messageDropCount:i}=o;i&&r.info(`Dropped ${i} messages`),e.push(n)}}catch(e){r.error("Failed to get saved logs",e)}return e},t.renewFileTransports=function(){const e=new Date,t=new Set;for(const[r,o]of Object.entries(S)){const r=[],n=[];for(const i of o.transports)if(i instanceof d.transports.File){r.push(i),n.push(new d.transports.File({level:i.level,format:i.format,filename:c.join(i.dirname,i.filename),lazy:!1}));const o=c.join(_(),`${a.randomUUID()}-${e.toISOString().replaceAll(":","")}.log`);l.existsSync(c.join(i.dirname,i.filename))&&(l.renameSync(c.join(i.dirname,i.filename),o),t.add(o))}for(const e of r)o.remove(e),e.close&&e.close();for(const e of n)o.add(e)}return t};const S={};class C{name;logger;constructor(e){this.name=e;try{this.logger=function(e){const t=[];f.console&&t.push(new d.transports.Console({format:d.format.combine(d.format.label({label:e}),y)}));let r=!1;if(!m.hudConfig.fileless)try{t.push(function(e){const t=v(e),r=c.dirname(t.filename);return l.mkdirSync(r,{recursive:!0}),l.writeFileSync(t.filename,"",{flag:"w"}),new d.transports.File(t)}(e))}catch{r=!0}(m.hudConfig.fileless||r)&&t.push(function(e){const t=h(e);return new g({format:t})}(e));const o=d.createLogger({level:f.levels[e],transports:t});return S[e]=o,r&&o.info("Could not create file transport, fallback succesfully to worker port"),m.hudConfig.fileless&&o.info("Fileless mode is enabled"),o}(e)}catch(e){this.logger=void 0}}isValid(){return!!this.logger}log(e,t,...r){if(this.logger)try{this.logger.log(e,t,...r)}catch{}}error(e,...t){this.log("error",e,...t)}warn(e,...t){this.log("warn",e,...t)}info(e,...t){this.log("info",e,...t)}http(e,...t){this.log("http",e,...t)}verbose(e,...t){this.log("verbose",e,...t)}debug(e,...t){this.log("debug",e,...t)}silly(e,...t){this.log("silly",e,...t)}}function w(e,t,r){let o=`Hud: ${e}`;return r&&(o+=" For more information visit https://docs.hud.io/docs/node-sdk-ie."),void 0!==t&&(o+=` ${t}`),o}t.SafeLogger=C,t.formatLogMessage=w,t.customer_logger=d.createLogger({level:m.hudConfig.customerLoggerLevel,transports:[new d.transports.Console({})],format:d.format.printf(({message:e,errCode:t,moreInfo:r})=>{try{return w(e,t,r)}catch(t){return e}})}),t.app_logger=new C("app"),t.instrument_logger=new C("instrument"),t.worker_logger=new C("worker")},3176:e=>{e.exports=require("buffer-crc32")},3312:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=void 0,t.SDK_VERSION="1.6.10"},3431:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.unrefSetInterval=t.unrefSetTimeout=t.unrefSetImmediate=void 0;const s=i(r(6460));t.unrefSetImmediate=function(e,t){return s.setImmediate(e,{...t,ref:!1})},t.unrefSetTimeout=function(e,t,r){return s.setTimeout(e,t,{...r,ref:!1})},t.unrefSetInterval=function(e,t,r){return s.setInterval(e,t,{...r,ref:!1})}},3699:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.shouldRunHud=t.isSupportedNative=t.isDebuggerAttached=void 0;const s=i(r(6592)),a=r(5919),l=r(1012),u=r(8138),c=r(4715),d=r(2794),p=r(3073);function m(){if("true"===process.env.HUD_ALLOW_DEBUGGER)return!1;if(process.execArgv.some(e=>e.includes("--inspect")||e.includes("--debug")||e.includes("--inspect-brk")||e.includes("--debug-brk")))return!0;try{return"string"==typeof s.url()}catch(e){return!1}}function f(){return void 0!==r(2784).transform}t.isDebuggerAttached=m,t.isSupportedNative=f,t.shouldRunHud=function(){return"false"===process.env.HUD_ENABLE?{shouldRun:!1,error:u.UserErrorLogs.HudEnableIsFalse()}:a.isMainThread?(0,d.isHudEnabled)()?process.versions.bun?{shouldRun:!1,error:u.UserErrorLogs.RunningInBun()}:function(){const e=process.versions.node.split(".")[0];return!!l.hudConfig.supportedNodeVersions.includes(e)}()?process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE&&!function(){try{return"1"===process.env.HUD_INTERNAL_EXEC_WRAPPER_USED}catch(e){return!1}}()?{shouldRun:!1,error:u.UserErrorLogs.LambdaNotViaLayer()}:m()?{shouldRun:!1,error:u.UserErrorLogs.DebuggerAttached()}:function(){const e=(0,c.getMemoryLimitInfo)();return!!(0,c.isMemoryLimitBigEnough)(e)}()?f()?{shouldRun:!0}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNativeBuild()}:{shouldRun:!1,error:u.UserErrorLogs.PodMemoryLimitTooLow(l.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER)}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNodeVersion()}:{shouldRun:!1,error:u.UserErrorLogs.HudEnableNotSet(process.env.HUD_ENABLE)}:(p.app_logger.info("required not from main thread"),{shouldRun:!1,error:null})}},3903:e=>{e.exports=require("uuid")},4219:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.safeCall=void 0;const o=r(8138);t.safeCall=function(e,t){return t.catch(t=>{(0,o.isAbortError)(t)||e.error("Unhandled exception on async task",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})})}},4451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineSourceMaps=t.shouldSupportSourceMap=void 0;const o=r(1012),n=r(3073);t.shouldSupportSourceMap=function(){return!!o.hudConfig.supportSourceMap&&(process.execArgv.includes("--enable-source-maps")&&n.instrument_logger.warn("--enable-source-maps is set, enabling custom source-map-support anyway"),!0)},t.combineSourceMaps=function(e,t){if(0===e.length)return;if(1===e.length&&void 0===e[0].lineOffset)return e[0].map;const r=e.map(e=>({offset:{line:e.transformedLineOffset,column:e.transformedColumnOffset},map:{..."string"==typeof e.map?JSON.parse(e.map):e.map,file:t}})),o={version:3,file:t,sections:r};return JSON.stringify(o)}},4627:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateDynamicConfig=void 0;const o=r(9100);function n(e,t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(e)&&Array.isArray(t))return t;const r={...e};for(const o in t){const i=e[o],s=t[o];r[o]=n(i,s)}return r}t.updateDynamicConfig=function(e,t,r){const i=o.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!i.success)return r.error("Dynamic configuration not updated - Invalid configuration override",{remoteConfigParseResult:i,remoteConfig:e}),t.dynamicConfig;const s=n(t.dynamicConfig,i.data);return void 0!==s.enableInvestigation&&s.enableInvestigation!==t.dynamicConfig.enableInvestigation&&(r.info("Dynamic configuration updated - enableInvestigation",{hudEnableInvestigation:s.enableInvestigation}),t.isInvestigationEnabledByEnv||(globalThis.hudEnableInvestigation=s.enableInvestigation)),s}},4634:e=>{e.exports=require("source-map")},4715:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isMemoryLimitBigEnough=t.getMemoryLimitInfo=void 0;const o=r(1012),n=r(3073),i=r(5290);t.getMemoryLimitInfo=function(){const e=(0,i.getPodMemoryLimit)(n.app_logger);return n.app_logger.info(`Pod memory limit: ${null===e.podMemoryLimitMB?"unknown":e.podMemoryLimitMB+"MB"} from ${e.source}, minimum required: ${o.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER}MB`),e},t.isMemoryLimitBigEnough=function(e){return null===e.podMemoryLimitMB||e.podMemoryLimitMB>=(o.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER)}},5124:e=>{e.exports=require("winston")},5290:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPodMemoryLimit=void 0;const n=r(9896),i=o(r(857));let s=null;function a(e,t){const r=parseInt(e);if(isNaN(r))return null;const o=Math.floor(r/1048576);return o<=0||o>=131072?(t.debug(`Treating memory value (${e} bytes) as unlimited.`),null):o}function l(e,t,r){if(!e)return{podMemoryLimitMB:null,source:null};const o=a(e,r);return null!==o?{podMemoryLimitMB:o,source:t}:{podMemoryLimitMB:null,source:null}}function u(e){try{return(0,n.readFileSync)(e,"utf8")}catch{return null}}function c(){const e=i.default.totalmem();return{podMemoryLimitMB:Math.floor(e/1048576),source:"system-memory"}}t.getPodMemoryLimit=function(e){if(null!==s)return s;if("linux"!==i.default.platform())return s=c(),s;let t=function(e,t){for(const e of["/sys/fs/cgroup/memory.max","/sys/fs/cgroup/memory.high"]){const r=u(e);if(!r)continue;const o=r.trim();if("max"===o){t.debug(`Found 'max' value in ${e}, will use system memory instead`);continue}const n=a(o,t);if(null!==n)return{podMemoryLimitMB:n,source:e}}return{podMemoryLimitMB:null,source:null}}(0,e);return null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=function(e,t){for(const e of["/sys/fs/cgroup/memory/memory.stat","/sys/fs/cgroup/memory/memory.limit_in_bytes"]){const r=u(e);if(r)if(e.endsWith("memory.stat")){const o=["hierarchical_memory_limit","memory.limit_in_bytes","limit_in_bytes"],n=r.split("\n");for(const r of o){const o=n.find(e=>e.startsWith(r));if(o){const n=l(o.split(" ")[1],`${e}:${r}`,t);if(null!==n.podMemoryLimitMB)return n}}}else{const o=l(r.trim(),e,t);if(null!==o.podMemoryLimitMB)return o}}return{podMemoryLimitMB:null,source:null}}(0,e),null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=c(),e.info(`No container memory limit found, using system memory: ${t.podMemoryLimitMB}MB`),s=t,t))}},5595:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getParameterInfo=void 0;const s=i(r(6346)),a=r(8528),l=r(3073);function u(e,t=0){if(void 0!==e.loc&&null!==e.loc)return{line:e.loc.start.line,column:e.loc.start.column+t,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column+t}}function c(e){return s.types.isIdentifier(e.argument)?{name:e.argument.name,type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e,e.argument.name.length+3)}:(l.worker_logger.warn("Unsupported rest element",{type:e.argument.type}),{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e)})}function d(e){var t;if(e)switch(e?.type){case"Identifier":return{name:(t=e).name,type:a.ParameterTypes[t.type],sourcemap_location_hint:u(t,t.name.length)};case"AssignmentPattern":return function(e,t,r){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),left:t,right:r}}(e,d(e.left),function(e){switch(e.type){case"StringLiteral":case"NumericLiteral":case"BooleanLiteral":case"BigIntLiteral":case"DecimalLiteral":return{type:e.type,value:e.value};case"RegExpLiteral":return{type:e.type,value:e.pattern}}return{type:e.type}}(e.right));case"ArrayPattern":return function(e,t){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),elements:t}}(e,e.elements.map(e=>d(e)).filter(e=>void 0!==e));case"RestElement":return c(e);case"ObjectPattern":{const t=[];return e.properties.forEach(e=>{if(s.types.isObjectProperty(e)){const r=s.types.isIdentifier(e.key)&&s.types.isIdentifier(e.value)||s.types.isAssignmentPattern(e.value)?void 0:d(e.key);t.push(function(e,t,r){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),key:t,value:r}}(e,r,d(e.value)))}else s.types.isRestElement(e)&&t.push(c(e))}),function(e,t){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),properties:t}}(e,t)}default:l.worker_logger.warn("Unsupported parameter type",{type:e.type})}}t.getParameterInfo=function(e,t){return e.node.params.map(e=>{try{return d(e)}catch(e){return}}).filter(e=>void 0!==e).map(e=>{let r;if(void 0!==e.sourcemap_location_hint){const{name:o,line:n,column:i}=t({line:e.sourcemap_location_hint.line,column:e.sourcemap_location_hint.column}),s={line_on_server:e.sourcemap_location_hint.line_on_server,column_on_server:e.sourcemap_location_hint.column_on_server};null===n||null===i?(l.worker_logger.debug("Could not find location for parameter",{type:e.type}),r={name:o??void 0,line:-1,column:-1,...s}):r={name:o??void 0,line:n,column:i,...s}}return{...e,name:r?.name??e.name,type:e.type,sourcemap_location_hint:r??e.sourcemap_location_hint}})}},5822:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.loopLogProcessPerformance=t.getCpuLimit=t.getCpuLimitUnsafe=t.loopLogThreadPerformance=void 0;const a=r(9896),l=s(r(857)),u=r(2987),c=i(r(1493)),d=r(2908),p=r(3431);function m(e){e.info("Trying to detect CPU limit");try{const t=(0,a.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_quota_us","utf8"),r=(0,a.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_period_us","utf8");return e.info("CPU limit detected for cgroups v1",{cpuQuota:t,cpuPeriod:r}),"-1"===t?"unlimited":parseInt(t.toString())/parseInt(r.toString())}catch(t){try{const t=(0,a.readFileSync)("/sys/fs/cgroup/cpu.max","utf8"),[r,o,n]=t.trim().split(" ");return e.info("CPU limit detected for cgroups v2",{max:r,period:o}),r&&o?"max"===r?"unlimited":parseInt(r)/parseInt(o):void e.info("cpu.max file is not in the expected format",t)}catch(r){return void e.info("Failed to detect CPU limit",{e:t,e2:r})}}}let f;t.loopLogThreadPerformance=async function(e,t,r){let o=u.performance.eventLoopUtilization(),n=u.performance.nodeTiming.toJSON();for await(const i of(0,p.unrefSetInterval)(t,void 0,{signal:r}))try{const t=u.performance.eventLoopUtilization(),r=u.performance.eventLoopUtilization(t,o);o=t;const i=c.getHeapStatistics(),s=u.performance.nodeTiming.toJSON(),a=s.idleTime-n.idleTime,l=s.duration-n.duration,d=a/l;n=s,e.info("thread performance statistics",{thread_elu_percentage:100*r.utilization,memory:{thread_heap_utilization_percentage:i.total_heap_size/i.heap_size_limit*100},idleTime:a,totalTime:l,idleTimePercentage:d})}catch(t){e.error("Failed logging thread performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}},t.getCpuLimitUnsafe=m;let g=!1;t.getCpuLimit=e=>(g||(f=(0,d.suppressTraces)(m)(e),g=!0),f),t.loopLogProcessPerformance=async function(e,r,o){const n=l.default.totalmem(),i=(0,t.getCpuLimit)(e);let s=process.cpuUsage();for await(const t of(0,p.unrefSetInterval)(r,void 0,{signal:o}))try{const t=process.memoryUsage(),o=process.uptime(),a=process.cpuUsage(),l={user:a.user-s.user,system:a.system-s.system};s=a;let u=(l.user+l.system)/(1e3*r);i&&"number"==typeof i&&(u/=i),e.info("process performance statistics",{memory:{process_memory_rss:t.rss,process_memory_utilization_percentage:t.rss/n*100},cpu:100*u,cpuStats:{limit:i,usagePercentage:100*u},uptime:o})}catch(t){e.error("Failed logging process performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}}},5919:e=>{e.exports=require("node:worker_threads")},6346:e=>{e.exports=require("@babel/core")},6460:e=>{e.exports=require("timers/promises")},6592:e=>{e.exports=require("node:inspector")},6760:e=>{e.exports=require("node:path")},6827:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseDeclarations=t.readFile=t.getRealPositionFunc=t.fixSourceMap=void 0;const a=i(r(6346)),l=r(8528),u=s(r(9896)),c=r(4634),d=r(1622),p=s(r(6760)),m=r(1012),f=r(8528),g=s(r(3176)),y=r(2784),h=r(3903),v=r(3073),_=r(8066),b=r(7064),E=r(5595),S=r(7087),C=r(1974),w=r(2298),I={babelrc:!1,configFile:!1};function M(e){let t;return t="string"==typeof e?JSON.parse(e):e,t.sources=t.sources.map(e=>e.replace(/^webpack:\/\/(?:@[^/]+?[/])?[^/]+\//,"")),t}function x(e,t,r){return o=>{const n=e?.originalPositionFor({line:o.line,column:o.column})??{line:o.line,column:o.column,source:null,name:null},i=null!==n.line?n.line+(t||0):null,s=null!==n.column?n.column+(1===n.line&&r||0):null;return{...n,line:i,column:s}}}let O;t.fixSourceMap=M,t.getRealPositionFunc=x,t.readFile=async function(e,t,r){try{if(t&&r){const o=Buffer.alloc(r-t),n=await u.default.promises.open(e,"r");return await n.read(o,0,r-t,t),await n.close(),o.toString("utf-8")}return await u.default.promises.readFile(e,"utf-8")}catch(t){return void v.worker_logger.error("Failed to read file",{filename:e,msg:t instanceof Error?t.message:t})}},t.parseDeclarations=async function(e,t,r=null,o){const{filename:n,bundlerBuildId:i,bundlerBuildIdGenerated:s,lineOffset:u,columnOffset:T,file_path_checksum:k,file_checksum:D,functionIds:F,sourceCodeHash:P,moduleBase:L}=e;if(v.worker_logger.debug("Parsing code",{filename:n}),o)try{if(!O){const e=(0,_.myRequire)("ts-node");O=e.create({...o,transpileOnly:!0,typeCheck:!1})}const e=function(e,t,r){try{return r.compile(e,t)}catch(e){return void v.worker_logger.warn("ts file pass, but failed to compile with ts-node",{filename:t,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(t,n,O);if(!e)return{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}};t=e}catch(e){return v.worker_logger.error("Failed to require and compile ts file",{filename:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}}}else if(n.endsWith(".ts")||n.endsWith(".mts"))return v.worker_logger.error("ts file pass, but not found ts-options"),{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}};const H=(0,g.default)(t).readUInt32BE();if(H!==D)return v.worker_logger.warn("File checksum mismatch",{filename:n,file_path_checksum:k,diskFileChecksum:H,file_checksum:D,functionIds:F}),{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}};const U=u?null:(0,y.getSourceMap)(n,t);let N,j;try{null!==U&&(j=(0,g.default)(U).readUInt32BE(),m.hudConfig.userConfig.disableSourceMapsResolution?.value||(N=JSON.parse(U)))}catch(e){v.worker_logger.error("Failed to parse source map",{filename:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const B=x(N?await new c.SourceMapConsumer(M(N)):void 0,u,T);v.worker_logger.debug("Parsing code",{filename:n});const A=[],R=await a.parseAsync(t,I);if(null===R)return v.worker_logger.warn("Failed parsing code to tree",{filename:n,file_path_checksum:k,diskFileChecksum:H,file_checksum:D,functionIds:F}),{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}};v.worker_logger.debug("Parsed code to tree",{filename:n});const q=[{type:l.EntityType.Program,symbol:{sourcemap_location_hints:[]},context:{},childrenCount:{},siblingIndex:0}],$=new Set;v.worker_logger.debug("Traversing declarations",{filename:n}),r?.postMessage("eventlooptime"),a.traverse(R,{[w.NamespaceScopeAlias]:{enter(e){const{node:r}=e;if(!(0,w.isNamespaceScopeable)(r))return;const o=q[q.length-1];let i=(0,S.getScope)(e);if(!i)return;i=(0,C.resolveScopeSymbols)(B,i);const s=o.childrenCount[i.type]||0,a={...i,childrenCount:{},siblingIndex:s};if(o.childrenCount[i.type]=s+1,q.push(a),$.add(r),e.isFunction()){const r=function(e,t,r,o,n,i,s){try{const l=e;let u=e.node.body.loc?.start?.index;if(void 0===u)throw new Error("Function node has no block start location");if(void 0===e.node.start||null===e.node.start||void 0===e.node.end||null===e.node.end)throw new Error("Function node has no start or end location");"ArrowFunctionExpression"===l.node.type&&l.node.body.extra?.parenthesized&&l.node.body.extra?.parenStart&&Number.isInteger(l.node.body.extra.parenStart)&&(u=l.node.body.extra.parenStart);const c=function(e,t,r,o){const n=o.slice(0,r),i=`${e}_${t}_${Buffer.byteLength(n,"utf8")}`;return(0,h.v5)(i,m.hudConfig.functionUuidNamespace).toString()}(t,r,u-(n-1),i),y=(a=i.slice(e.node.start,e.node.end),(0,g.default)(a).readUInt32BE().toString());if(!y)return void v.worker_logger.warn("Function hash not found",{functionID:c,filename:r});const _=l.node.async||!1,S=(0,C.getNodeLocation)(l.node,s),w=S.start.source??r,I=(0,b.getEntityType)(l),M=(0,d.getMethodKind)(l.node),x=(0,d.getContextualData)(l);x.symbol&&(x.symbol=(0,C.resolveSymbol)(s,x.symbol)),x.callback?.callee.symbol&&(x.callback.callee.symbol=(0,C.resolveSymbol)(s,x.callback.callee.symbol));const O=(0,E.getParameterInfo)(l,s),{siblingIndex:T,childrenCount:k}=o[o.length-1],D=o.slice(0,-1),F=(0,d.getFunctionIdentifier)(l),P=(0,C.resolveSymbol)(s,{name:F?.name,sourcemap_location_hints:F?(0,C.getLocationList)(F,F.name):(0,C.getLocationList)(l.node,void 0),format:F?"%s":void 0});return{module:p.default.parse(w).name,symbol:P,context:x,file:w,type:I,format:f.Format.cjs,parameters:O,async:_,start_line:S.start.line,end_line:S.end.line,start_column:S.start.column,source_code_hash:y,runtime_function_id:c,scope_chain:D,declarations_count:0,methodKind:M,siblingIndex:T,childrenCount:k,original_location:{file:r,start_line:e.node.loc?.start?.line,end_line:e.node.loc?.end?.line,start_column:e.node.loc?.start?.column,end_column:e.node.loc?.end?.column}}}catch(e){v.worker_logger.error("Failed to handle function",{filename:r,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}var a}(e,P,n,q,L,t,B);r&&A.push(r)}},exit(e){$.has(e.node)&&(q.pop(),$.delete(e.node))}}}),v.worker_logger.debug("Traversed declarations",{filename:n});const K=new Set(A.map(e=>e.runtime_function_id)),z=[],W=[];A.forEach(e=>{K.has(e.runtime_function_id)?z.push({...e,declarations_count:A.length,bundler_build_id:i,was_bundler_build_id_generated:s,has_input_map:void 0!==N,sourcemap_crc:j,file_path_checksum:k,file_checksum:D}):W.push(e)}),W.length>0&&v.worker_logger.warn("Function IDs mismatch, missing instrumentation",{filename:n,runtimeFunctionIds:F,missingInstrumentation:W}),new Set(F).forEach(e=>{K.has(e)&&K.delete(e)});const V=K.size>0;return V&&v.worker_logger.error("Function IDs mismatch, missing declerations",{filename:n,missingRuntimeFunctionIds:[...K]}),{declarations:z,blacklist:V?{file_path_checksum:k,file_checksum:D,uuids:[...K]}:void 0}}},6928:e=>{e.exports=require("path")},6982:e=>{e.exports=require("crypto")},7064:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getEntityIdentity=t.getEntityType=void 0;const o=r(6346),n=r(8528),i=r(3073);t.getEntityType=function(e){const{node:t}=e;return o.types.isFunctionDeclaration(t)?n.EntityType.FunctionDeclaration:o.types.isFunctionExpression(t)?n.EntityType.FunctionExpression:o.types.isArrowFunctionExpression(t)?n.EntityType.FunctionArrow:o.types.isObjectMethod(t)?n.EntityType.ObjectMethod:o.types.isStaticBlock(t)||o.types.isClassMethod(t)?n.EntityType.ClassMethod:o.types.isClassPrivateMethod(t)?n.EntityType.ClassPrivateMethod:o.types.isClassDeclaration(t)?n.EntityType.ClassDeclaration:o.types.isClassExpression(t)?n.EntityType.ClassExpression:o.types.isForInStatement(t)||o.types.isForOfStatement(t)||o.types.isForStatement(t)?n.EntityType.ForLoop:o.types.isBlockStatement(t)?function(e){const t=e.parentPath.node;if(!(o.types.isFunctionDeclaration(t)||o.types.isFunctionExpression(t)||o.types.isArrowFunctionExpression(t)||o.types.isClassMethod(t)||o.types.isObjectMethod(t)||o.types.isClassPrivateMethod(t)))if(o.types.isIfStatement(t)){if("consequent"===e.parentKey)return n.EntityType.IfConsequent;if("alternate"===e.parentKey)return n.EntityType.IfAlternate;if("test"===e.parentKey)return n.EntityType.IfTest}else{if(o.types.isBlockStatement(t)||o.types.isProgram(t))return n.EntityType.Block;if(o.types.isTryStatement(t)){if("block"===e.parentKey)return n.EntityType.Try;if("finalizer"===e.parentKey)return n.EntityType.Finally}else{if(o.types.isCatchClause(t))return;if(o.types.isWhileStatement(t))return"test"===e.parentKey?n.EntityType.WhileTest:n.EntityType.Do;if(o.types.isDoWhileStatement(t))return"test"===e.parentKey?n.EntityType.WhileTest:n.EntityType.Do;if(!(o.types.isForStatement(t)||o.types.isForInStatement(t)||o.types.isForOfStatement(t)))return;if("test"===e.parentKey)return n.EntityType.ForTest;if("body"===e.parentKey)return n.EntityType.ForBlock}}}(e):o.types.isProgram(t)?n.EntityType.Program:o.types.isDoWhileStatement(t)?n.EntityType.DoWhile:o.types.isWhileStatement(t)?n.EntityType.While:o.types.isCatchClause(t)?n.EntityType.Catch:o.types.isObjectExpression(t)?n.EntityType.ObjectExpression:o.types.isWithStatement(t)?n.EntityType.With:o.types.isSwitchStatement(t)?n.EntityType.Switch:o.types.isSwitchCase(t)?n.EntityType.SwitchCase:o.types.isTryStatement(t)?n.EntityType.TryCatch:o.types.isIfStatement(t)?n.EntityType.If:n.EntityType.Other},t.getEntityIdentity=function(e){return o.types.isFunctionDeclaration(e)?o.types.isIdentifier(e.id)?e.id:void i.worker_logger.info("Function declaration without an identifier"):o.types.isClassDeclaration(e)?o.types.isIdentifier(e.id)?e.id:void i.worker_logger.info("Class declaration without an identifier"):o.types.isFunctionExpression(e)||o.types.isClassExpression(e)?o.types.isIdentifier(e.id)?e.id:void 0:o.types.isClassMethod(e)?o.types.isIdentifier(e.key)?e.key:void i.worker_logger.info("Class method without an identifier"):o.types.isObjectMethod(e)?o.types.isIdentifier(e.key)?e.key:void i.worker_logger.info("Object method without an identifier"):o.types.isClassPrivateMethod(e)?o.types.isIdentifier(e.key.id)?e.key.id:void i.worker_logger.info("Class private method without an identifier"):void 0}},7087:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getScope=void 0;const o=r(7064),n=r(1974),i=r(1622);t.getScope=function(e){const t=(0,o.getEntityType)(e);if(t){const r=(0,o.getEntityIdentity)(e.node),s=r?.name;return{type:t,context:(0,i.getContextualData)(e),symbol:{name:s,sourcemap_location_hints:r?(0,n.getLocationList)(r,s):(0,n.getLocationList)(e.node,void 0),format:r?"%s":void 0},methodKind:(0,i.getMethodKind)(e.node)}}}},7582:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.nextLoopDummy=void 0;const r=`http://${process.env.AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension`;async function o(e){return await fetch(`${r}/event/next`,{method:"get",headers:{"Content-Type":"application/json","Lambda-Extension-Identifier":e}})}t.nextLoopDummy=async function(e){for(;;)try{(await o(e)).ok||await new Promise(e=>setTimeout(e,50))}catch(e){await new Promise(e=>setTimeout(e,50))}}},8066:(e,t)=>{let r;Object.defineProperty(t,"__esModule",{value:!0}),t.myRequire=void 0;try{r=require}catch(e){r=void 0}t.myRequire=r},8138:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getNetworkError=t.UserErrorLogs=t.setFirstError=t.getFirstError=t.isAbortError=t.HudNoMessageInSqsConsumerEmit=t.HudNoErrorInSqsConsumerEmit=t.HudNoEventTypeInSqsConsumerEmit=t.HudFailExtractSqsQueueName=t.HudNoCallbackInSqsConsumerOn=t.HudNoEventTypeInSqsConsumerOn=t.HudNoQueueUrlInSqsConsumer=t.HudSqsError=t.HudExtensionNextFailedError=t.HudExtensionRegisterError=t.HudExtnensionError=t.HudBadLoggerError=t.HudInitNetworkError=t.HudTsNodeNotFoundButUsed=t.HudSessionThrottle=t.HudNoTranspileOnlyError=t.HudClientExceededMaxRetries=t.HudClientUnauthorizedError=t.HudTimeoutError=t.HudWorkloadCollectorError=t.HudAssert=t.HudUnsupportedError=t.HudEditError=t.HudWorkerError=t.HudClientError=t.HudInitError=t.HudError=void 0;const o=r(1012);class n extends Error{code=9e3;name=this.constructor.name;constructor(e){super(e)}}t.HudError=n;class i extends n{code=9001}t.HudInitError=i,t.HudClientError=class extends n{code=9002;originalAxiosErrorCode;constructor(e,t){super(e),this.originalAxiosErrorCode=t}},t.HudWorkerError=class extends n{code=9003};class s extends n{code=9004}t.HudEditError=s,t.HudUnsupportedError=class extends s{code=9005},t.HudAssert=class extends s{code=9006},t.HudWorkloadCollectorError=class extends n{code=9007},t.HudTimeoutError=class extends n{code=9008},t.HudClientUnauthorizedError=class extends n{code=9009},t.HudClientExceededMaxRetries=class extends n{code=9010},t.HudNoTranspileOnlyError=class extends n{code=9011},t.HudSessionThrottle=class extends i{code=9012},t.HudTsNodeNotFoundButUsed=class extends n{code=9013},t.HudInitNetworkError=class extends n{code=9014;originalAxiosErrorCode;constructor(e,t){super(e),this.originalAxiosErrorCode=t}},t.HudBadLoggerError=class extends n{code=9101};class a extends n{code=9200}t.HudExtnensionError=a,t.HudExtensionRegisterError=class extends a{code=9201},t.HudExtensionNextFailedError=class extends a{code=9202};class l extends n{code=9250}t.HudSqsError=l,t.HudNoQueueUrlInSqsConsumer=class extends l{code=9251},t.HudNoEventTypeInSqsConsumerOn=class extends l{code=9252},t.HudNoCallbackInSqsConsumerOn=class extends l{code=9253},t.HudFailExtractSqsQueueName=class extends l{code=9254},t.HudNoEventTypeInSqsConsumerEmit=class extends l{code=9255},t.HudNoErrorInSqsConsumerEmit=class extends l{code=9256},t.HudNoMessageInSqsConsumerEmit=class extends l{code=9257},t.isAbortError=function(e){return e instanceof Error&&"AbortError"===e.name};let u=9999;t.getFirstError=function(){return u},t.setFirstError=function(e){e&&9999===u&&(u=e)},t.UserErrorLogs={HudServiceNotSet:()=>({level:"error",errCode:"E1001",moreInfo:!0,message:"Can't load Hud, HUD_SERVICE was not set. Please set service name using the environment variable HUD_SERVICE."}),HudServiceInvalid:()=>({level:"error",errCode:"E1002",moreInfo:!0,message:"Can't load Hud, HUD_SERVICE value has invalid service name. Please set service name using the environment variable HUD_SERVICE."}),HudApiKeyNotSet:()=>({level:"error",errCode:"E1004",moreInfo:!0,message:"Can't load Hud, HUD_KEY was not set. Please set API key using the environment variable HUD_KEY."}),HudApiKeyInvalid:()=>({level:"error",errCode:"E1005",moreInfo:!0,message:"Can't load Hud, HUD_KEY value has invalid API key. Please set a valid key in environment variable HUD_KEY."}),BothApiKeyAndServiceNotSet:()=>({level:"error",errCode:"E1007",moreInfo:!0,message:"Can't load Hud, HUD_KEY and HUD_SERVICE were not set. Please set API key using the environment variable HUD_KEY and service name using the environment variable HUD_SERVICE."}),InvalidTag:()=>({level:"warn",errCode:"E1008",moreInfo:!0,message:"HUD_TAGS should be of type Key-Value Object, defaulting to empty tags. Please set valid tags in environment variable HUD_TAGS."}),TagWithDots:()=>({level:"warn",errCode:"E1009",moreInfo:!0,message:"HUD_TAGS keys can't contain dots; they have been replaced with underscores."}),TagsInvalidJson:()=>({level:"warn",errCode:"E1010",moreInfo:!0,message:"Can't load Hud, HUD_TAGS is not a valid JSON, defaulting to empty tags. Please set valid tags in environment variable HUD_TAGS."}),ApiKeyDenied:e=>({level:"error",errCode:"E1011",moreInfo:!0,message:`Can't load Hud, the provided key is invalid. Please provide a valid HUD_KEY in your ${{ENV:"environment variable",CONFIG_FILE:"file",CONFIG_ENV:"HUD_CONFIG",INIT:"init function",SETUP:"setup function"}[e]}.`}),ShutdownGracefully:e=>({level:"error",errCode:`E${e}`,message:"SDK has initiated a graceful shutdown. Your application remains unaffected"}),UnsupportedNodeVersion:()=>({level:"error",errCode:"E1012",moreInfo:!0,message:"Can't load Hud due to an unsupported node version."}),UnsupportedSyntax:()=>({level:"error",errCode:"E1014",moreInfo:!0,message:"Can't load Hud due to an unsupported syntax version."}),UnsupportedLambdaMemory:()=>({level:"error",errCode:"E1015",moreInfo:!0,message:`Can't load Hud as lambda function memory size is less than ${o.hudConfig.lambdaMinimunMemory}MB.`}),JSONErrorInUserConfig:(e,t)=>({level:"error",errCode:"E1016",moreInfo:!0,message:`Can't load Hud, the config file contains an invalid JSON. Please set a valid json in Hud's config ${e}`+(t?`, Error: ${t}.`:".")}),ZodErrorInUserConfig:(e,t)=>({level:"error",errCode:"E1017",moreInfo:!0,message:`Can't load Hud, the config file contains an invalid value for field: ${t}. Please set a valid value for ${t} in the config ${e}.`}),ConfigInaccessible:e=>({level:"error",errCode:"E1018",moreInfo:!0,message:`Can't load Hud, the config file is inaccessible. Please make sure your node application has read permissions to the Hud config file, ${e}.`}),SetupCalledWithoutKey:()=>({level:"error",errCode:"E1019",moreInfo:!0,message:"API key not found or invalid. SDK has initiated a graceful shutdown. Your application remains unaffected."}),SetupCalledWithoutService:()=>({level:"error",errCode:"E1020",moreInfo:!0,message:"Service name parameter not found or invalid. SDK has initiated a graceful shutdown. Your application remains unaffected."}),HudEnableIsFalse:()=>({level:"warn",errCode:"E1021",moreInfo:!0,message:"HUD_ENABLE is set to false. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InstrumentedFunctionCountExceeded:e=>({level:"error",errCode:"E1022",moreInfo:!0,message:`SDK limit of ${e} instrumented functions exceeded. SDK has initiated a graceful shutdown. Your application remains unaffected.`}),PodMemoryLimitTooLow:e=>({level:"error",errCode:"E1023",moreInfo:!0,message:`Insufficient memory available. Minimum required:(${e}MB). SDK has initiated a graceful shutdown. Your application remains unaffected.`}),DebuggerAttached:()=>({level:"error",errCode:"E1024",message:"Did not load as debugger is attached."}),InitSessionBeforeRegister:()=>({level:"error",errCode:"E1025",moreInfo:!0,message:"register() was not called, or called after initSession() - please call register() before initSession() and run again. Your application continues normally without Hud."}),RegisterMisplacedNoDeclarations:()=>({level:"warn",errCode:"E1026",moreInfo:!0,message:"Warning - No code has been mapped so far. This probably means register() was called too late — after your code was already loaded. Move it to the top of your entry file to enable proper mapping. Your application continues normally without Hud data."}),UnsupportedFrameworkVersion:e=>({level:"warn",errCode:"E1029",message:`Warning - Unsupported version of ${e} framework(s). This means Hud won't track your framework invocations. Your application continues normally, but with partial Hud data. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node#/`}),UninstrumentedFilesLogThresholdExceeded:e=>({level:"warn",errCode:"E1027",message:`Warning - ${e} of your code files were imported before register(). This means Hud won't track all of your functions. Please move register() call to an earlier location. To view the list of files use register({verbose: true}). Your application continues normally, but with partial Hud data.`,moreInfo:!0}),UninstrumentedFrameworks:e=>({level:"warn",errCode:"E1028",message:`Warning - The framework(s): ${e.map(e=>`"${e}"`).join(", ")} was imported before register(). This means Hud won't track your framework invocations. Please move register() call to an earlier location. Your application continues normally, but with partial Hud data.`}),YesDeclarationsNoMetrics:()=>({level:"warn",errCode:"E1032",moreInfo:!0,message:"Warning - Code mapped successfully, but no function activity was tracked. Make sure your service is running and actively handling requests."}),HudEnableNotSet:e=>({level:"error",moreInfo:!0,message:`Did not load as HUD_ENABLE is ${void 0===e?"undefined":"set to a non-true value"}. Please set HUD_ENABLE=true to run Hud.`}),LambdaNotViaLayer:()=>({level:"error",errCode:"E1034",message:"Can't load Hud, lambda support is currently in beta. Contact Hud to get early access."}),RunningInBun:()=>({level:"error",errCode:"E1035",message:"Hud does not support Bun yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),RunningOnWindows:()=>({level:"error",errCode:"E1036",message:"Hud does not support Windows yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),UnsupportedNativeBuild:()=>({level:"error",errCode:"E1037",message:"Hud does not support this platform yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),TsNodeNotTranspileOnly:()=>({level:"error",errCode:"E1038",message:"detected ts-node is used without the transpileOnly flag, which is not supported yet. SDK has initiated a graceful shutdown. Your application remains unaffected.",moreInfo:!0}),TsNodeNotFoundEvenThoughRunWithTsNode:()=>({level:"error",errCode:"E1039",message:"'ts-node' was detected but could not be resolved by Hud. This may happen if 'ts-node' is installed globally. Try installing it locally in your project. The SDK has initiated a graceful shutdown. Your application remains unaffected.",moreInfo:!0}),InitFailedDueGenericNetworkError:()=>({level:"error",moreInfo:!0,errCode:"E1040",message:"A network error occurred during SDK initialization. Please check your internet connection and try again. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueNetworkTimeout:()=>({level:"error",moreInfo:!0,errCode:"E1041",message:"The SDK failed to connect to Hud's backend due to a timeout during SDK initialization. Please verify your firewall settings to ensure outbound connections are allowed. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueNetworkRST:()=>({level:"error",moreInfo:!0,errCode:"E1042",message:"The SDK connection to Hud's backend was reset unexpectedly (RST) during SDK initialization. Please check your firewall or network security settings. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueSelfSignedCert:()=>({level:"error",moreInfo:!0,errCode:"E1043",message:"SSL certificate verification failed during SDK initialization. If your organization uses a self-signed certificate, set the NODE_EXTRA_CA_CERTS environment variable to the path of your CA certificate file. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueDnsFailed:()=>({level:"error",moreInfo:!0,errCode:"E1044",message:"The SDK failed to resolve DNS when attempting to connect to Hud's backend during SDK initialization. If the problem persists, please contact support. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueBackendError:()=>({level:"error",moreInfo:!0,errCode:"E1045",message:"Hud: The SDK was unable to complete initialization due to a temporary issue with Hud’s backend. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitTimeout:e=>({moreInfo:!0,level:"error",message:`SDK imported but not initialized. Please ensure to call '${e?"hud.initSession(KEY, SERVICE)":"hud.init()"}' to initialize the SDK.`}),RehookCalledBeforeRegister:()=>({level:"error",errCode:"E1046",moreInfo:!0,message:"register() was not called, or called after rehook() - please call register() before rehook() and run again. Your application continues normally with partial hud data."}),EsbuildMissingKey:()=>({level:"error",errCode:"ES0001",moreInfo:!0,message:"missing HUD_KEY, skipping Hud plugin, your build is unaffected."}),EsbuildFailedProcessingFile:e=>({level:"error",errCode:"ES0002",moreInfo:!0,message:`failed processing file "${e}", reverting to original loader.`}),EsbuildFailedBundling:()=>({level:"error",errCode:"ES0003",moreInfo:!0,message:"encountered unexpected file bundling, build aborted."}),EsbuildFailedParsingSourcemap:()=>({level:"error",errCode:"ES0004",moreInfo:!0,message:"failed parsing source maps, skipping upload, Hud will run without source maps."}),EsbuildFailedUploadingSourcemap:e=>({level:"error",errCode:"ES0005",moreInfo:!0,message:`failed uploading source map: ${e}, Hud will run without source maps.`}),EsbuildFailedUploadingSourcemapUnauthorized:()=>({level:"error",errCode:"ES0006",moreInfo:!0,message:"failed uploading source map: unauthorized, Hud will run without source maps."}),EsbuildUnsupportedPlatform:()=>({level:"error",errCode:"ES0007",message:'Can\'t load Hud, as our esbuild plugin supports "node" mode only. Your app remains unaffected. For more information visit docs.hud.io/docs/support-matrix'}),EsbuildUnsupportedWindows:()=>({level:"error",errCode:"ES0008",message:"Can't load Hud, as our esbuild plugin does not supports windows. Your app remains unaffected. For more information visit docs.hud.io/docs/support-matrix"})},t.getNetworkError=function(e){return{ECONNABORTED:t.UserErrorLogs.InitFailedDueNetworkTimeout(),ECONNREFUSED:t.UserErrorLogs.InitFailedDueNetworkRST(),ENOTFOUND:t.UserErrorLogs.InitFailedDueDnsFailed(),SELF_SIGNED_CERT_IN_CHAIN:t.UserErrorLogs.InitFailedDueSelfSignedCert(),ERR_BAD_RESPONSE:t.UserErrorLogs.InitFailedDueBackendError()}[e]??t.UserErrorLogs.InitFailedDueGenericNetworkError()}},8287:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(6827),t)},8528:e=>{e.exports=require("./dto")},8808:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateSqsFlowId=t.generateKafkaFlowId=t.generateGraphqlFlowId=t.generateEndpointFlowId=void 0;const o=r(3903),n="fa79d8b7-069c-4bbf-9c00-34bfc8b3a5a6";t.generateEndpointFlowId=function(e,t){return(0,o.v5)(`${e.toString()}|${Array.from(t).sort().join(",")}`,n)},t.generateGraphqlFlowId=function(e,t){return(0,o.v5)(`${e}|${t}`,n)},t.generateKafkaFlowId=function(e,t,r){return(0,o.v5)(`${e.toString()}|${t}|${r}`,n)},t.generateSqsFlowId=function(e,t,r=""){const i=`${e}|${t}|${r}`;return(0,o.v5)(i,n)}},8809:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_MODULE_NAME=void 0,t.SDK_MODULE_NAME="hud-sdk"},9023:e=>{e.exports=require("util")},9100:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.updateInvestigationRateLimitGlobals=t.hudConfig=t.isValidParam=t.getModulesToTraceFromEnv=t.HudDynamicConfigSchema=void 0;const n=o(r(6928)),i=r(1569);t.HudDynamicConfigSchema=i.z.object({aggregationInterval:i.z.number(),flowMetricInterval:i.z.number(),graphqlInterval:i.z.number(),aggregationFirstSendTimeout:i.z.number(),flowMetricFirstSendTimeout:i.z.number(),enableInvestigation:i.z.boolean(),investigationRateLimits:i.z.object({maxSameInvestigations:i.z.number().int().positive(),sameInvestigationTimeWindowMs:i.z.number().int().positive(),maxTotalInvestigations:i.z.number().int().positive(),totalInvestigationTimeWindowMs:i.z.number().int().positive(),maxUniqLogs:i.z.number().int().positive()}),machineMetricsInterval:i.z.number().int().positive(),blacklistParams:i.z.array(i.z.string()),censorshipRegexes:i.z.array(i.z.object({regex:i.z.string(),replacement:i.z.string()}))}),t.getModulesToTraceFromEnv=function(){const e=process.env.HUD_MONITOR_MODULES||process.env.HUD_INCLUDE_MODULES;if(e)return e.split(",")},t.isValidParam=function(e){return null!=e&&""!==e&&"string"==typeof e};const s=process.env.HUD_ENABLE_INVESTIGATION,a=process.env.HUD_HOST||"https://api-prod.hud.io",l=process.env.HUD_LOG_DIR,u="_HUD",c=process.env.HUD_LOG_TO_FILE,d={sink:{url:a,timeout:5e3,session_attr:"X-Session-ID"},endpoints:{init:"sink/init",send:"sink/send",batch:"sink/batch",logs:"sink/logs",fatalError:"sink/redline",getMode:"sink/getMode",getRemoteConfig:"sink/remote-config/get",fileDeclarations:"sink/file-declarations",sourceMap:"sink/sourcemap",storeObject:"sink/objects/store"},logger:{default:{levels:{app:"warn",worker:"warn",instrument:"warn"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},investigation:{objectVersion:"1.0.1",store:{type:"s3"},limits:{executionFlowMaxLength:100,exceptionMaxLength:100},maxStringLength:1024,maxArrayLength:100,maxObjectDepth:10},userConfig:{minPodMemoryMB:{value:250,source:"DEFAULT"},maxMappedFunctions:{value:5e4,source:"DEFAULT"},maxFileSizeBytes:{value:2831155,source:"DEFAULT"},maxTimeUntilInitSessionMs:{value:3e4,source:"DEFAULT"},includeModules:{value:[],source:"DEFAULT"}},loggerWorkerPortSizeLimit:1e4,customerLoggerLevel:"info",logDirectory:l,invocationSampling:new Map([[[300n,null],100],[[200n,300n],50],[[100n,200n],25],[[0n,100n],10]]),callerResetInterval:36e5,modeInterval:3e5,logsSendInterval:6e4,logPerfInterval:3e5,endpointsInterval:18e5,endpointsFirstSendWaitTime:12e4,huddBinWidth:1.2,workerGrace:6e4,workerTimeout:2e4,timeoutOnRegister:6e4,timeoutOnMetrics:6e4,workerMessageTimeout:1e4,communicationBatchSize:100,writePatched:!1,defaultOff:!0,disableOnBadApiKey:!0,disableOnBadServiceName:!0,cpuTimeCollection:!1,workloadMetadata:{sendInterval:3e5,aws:{imds:{baseURL:"http://169.254.169.254/latest",tokenURI:"/api/token",identityURI:"/dynamic/instance-identity/document",lifeCycleURI:"/meta-data/instance-life-cycle",requestTimeout:5e3},metadataFile:"/run/cloud-init/instance-data.json"},kubernetes:{namespaceFile:"/var/run/secrets/kubernetes.io/serviceaccount/namespace",uuidFile:"/sys/class/dmi/id/product_uuid",podMemoryLimitFile:"/sys/fs/cgroup/memory/memory.stat",podCPULimitFile:"/sys/fs/cgroup/cpuacct/cpu.shares"}},deleteLogsAfterSending:!0,supportSourceMap:!0,editInline:!0,bundlerBuildIdVarName:"hudFileBuildID",bundlerBuildUuidNamespace:"00c1e90b-af75-4d8e-9935-68485877f759",functionUuidNamespace:"94a210f3-861c-4e18-ab27-6b6c19437c9d",wrapVarPrefix:u,functionIdVarName:`${u}_fid`,frameworksToPatch:new Map([["express",{version:"<=5",patcher:"express",enableEsbuild:!0}],[n.default.join("express","lib","application.js"),{version:"<=5",patcher:"expressApplication",enableEsbuild:!0}],["router",{version:"^2.0.0",patcher:"router",enableEsbuild:!0}],["koa",{version:"^2.0.0",patcher:"koa"}],["graphql/execution/execute",{version:"14 - 16",patcher:"graphql"}],["http",{version:"*",patcher:"http"}],["https",{version:"*",patcher:"http"}],["@nestjs/core/interceptors/interceptors-consumer",{version:"*",patcher:"nestjsInterceptor"}],["@nestjs/core/router/router-execution-context",{version:"*",patcher:"nestjsRouterExecutionContext"}],..."win32"!==process.platform?[["kafkajs",{version:">=1.4.0",patcher:"kafkajs"}],["@nestjs/microservices/context/rpc-context-creator",{version:">=7.0.0",patcher:"nestjsRpcContextCreator"}]]:[],[["@codegenie/serverless-express","src","frameworks","express.js"].join(n.default.sep),{version:"^4.1.0",patcher:"codeGenieServerlessExpress",enableEsbuild:!0}],["@codegenie/serverless-express",{enableEsbuild:!0}],["sqs-consumer",{version:"*",patcher:"sqsConsumer",extraInfo:{mondayVersion:">=6.1.0",bbcVersion:">=7.5.0"}}],["serverless-http",{enableEsbuild:!0}],[n.default.join("serverless-http","lib","framework","get-framework.js"),{version:"^2.7.0",patcher:"serverlessHttp",enableEsbuild:!0}]]),communicationKeepalive:!1,communicationKeepaliveGrace:5e3,express:{routeNamesSymbol:Symbol.for("hudRoutes"),layerStateSymbol:Symbol.for("hudState"),markedSymbol:Symbol.for("hudMarked"),wrapAllCallbacks:!0},supportedNodeVersions:["18","20","21","22","24"],hudPatchedName:"hudPatched",metricSymbol:Symbol.for("hudMetric"),dynamicConfig:{aggregationInterval:3e5,flowMetricInterval:3e5,graphqlInterval:3e4,aggregationFirstSendTimeout:3e4,flowMetricFirstSendTimeout:3e4,enableInvestigation:"true"===s,investigationRateLimits:{maxSameInvestigations:2,sameInvestigationTimeWindowMs:36e5,maxTotalInvestigations:25,totalInvestigationTimeWindowMs:216e5,maxUniqLogs:2},machineMetricsInterval:1e4,blacklistParams:[],censorshipRegexes:[]},machineMetricsSavedLength:2,isInvestigationEnabledByEnv:void 0!==s,suppressTraces:!0,lambdaMinimunMemory:1024,lambdaBaseGivenTime:400,lambdaExtraGivenTimePerRequest:50,lambdaMaxGivenTime:700,throttleStatusCode:202,esbuildGlobalVar:"hudSGV",esbuildPluginMessagePrefix:"ESBuild plugin ",esbuildMark:"/*modifiedByHudESBuildPlugin-",esbuildMarkLength:67,esbuildUploadSourceMapTimeout:15e3,esbuildPluginLogsChunkSize:100,esbuildPluginLogsBatchSize:10,pluginsLogEndpoint:"https://yqp37dddrsewm6wdwwpwfraxqm0shdmx.lambda-url.eu-central-1.on.aws/",fileless:"true"!==c,uninstrumentedFilesLogThreshold:2,tsNodeConfigTimeout:1e4,allowedEditExtensions:[".ts",".cts",".mts",".js",".cjs",".mjs"]};t.hudConfig=function(e={}){return{...d,...e}}({logger:{default:{levels:{app:"info",worker:"info",instrument:"info"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},deleteLogsAfterSending:!1,communicationKeepalive:!0}),t.default=t.hudConfig,t.updateInvestigationRateLimitGlobals=function(){globalThis.hudMaxSameInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations,globalThis.hudMaxTotalInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations,globalThis.hudSameInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.sameInvestigationTimeWindowMs)*BigInt(1e6),globalThis.hudTotalInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.totalInvestigationTimeWindowMs)*BigInt(1e6)}},9896:e=>{e.exports=require("fs")}},t={};return function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(2241)})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(global,()=>(()=>{"use strict";var e={363:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateUserConfigFromInitOptions=t.updateUserConfigFromEnv=t.updateUserConfigFromFile=t.updateUserConfigFromInit=void 0;const o=r(8528),n=r(1569),i=r(8138),s=r(2794),a=r(3073),l=r(9100),u=o.HudInitOptionsSchema.omit({customOptions:!0}).extend({key:n.z.string().optional(),service:n.z.string().optional(),enable:n.z.boolean().optional(),enableDapulse:n.z.boolean().optional()});t.updateUserConfigFromInit=function(e,t){void 0!==e&&(l.hudConfig.userConfig.key={value:e,source:"INIT"}),void 0!==t&&(l.hudConfig.userConfig.service={value:t,source:"INIT"})},t.updateUserConfigFromFile=function(){let e;try{e=(0,s.getConfigContent)()}catch(e){throw e instanceof s.HudFailedReadConfigError&&"EACCES"===e.code&&a.customer_logger.log(i.UserErrorLogs.ConfigInaccessible(e.path)),e}if(e)try{const t=u.partial().parse(JSON.parse(e.content));Object.entries(t).forEach(([t,r])=>{!function(e,t,r){e[t]=r}(l.hudConfig.userConfig,t,{value:r,source:"HUD_CONFIG"===e.source?"CONFIG_ENV":"CONFIG_FILE"})})}catch(t){throw t instanceof n.ZodError?t.errors.forEach(t=>{const r=t.path.join(".");a.customer_logger.log(i.UserErrorLogs.ZodErrorInUserConfig(e.source,r))}):a.customer_logger.log(i.UserErrorLogs.JSONErrorInUserConfig(e.source,t.message)),t}},t.updateUserConfigFromEnv=function(){const e=process.env.HUD_KEY,t=process.env.HUD_SERVICE,r=process.env.HUD_ENABLE_DAPULSE,o=(0,l.getModulesToTraceFromEnv)(),n=process.env.HUD_MAX_INSTRUMENTED_FUNCTIONS,i=process.env.HUD_MIN_POD_MEMORY_MB;e&&(l.hudConfig.userConfig.key={value:e,source:"ENV"}),t&&(l.hudConfig.userConfig.service={value:t,source:"ENV"}),r&&(l.hudConfig.userConfig.enableDapulse={value:"true"===r,source:"ENV"}),o&&(l.hudConfig.userConfig.includeModules={value:o,source:"ENV"}),n&&(l.hudConfig.userConfig.maxMappedFunctions={value:parseInt(n),source:"ENV"}),i&&(l.hudConfig.userConfig.minPodMemoryMB={value:parseInt(i),source:"ENV"})},t.updateUserConfigFromInitOptions=function(e,t){e.includeModules&&Array.isArray(e.includeModules)&&(l.hudConfig.userConfig.includeModules={value:e.includeModules,source:t}),e.customOptions&&e.customOptions.dapulseSqsConsumer&&(l.hudConfig.userConfig.enableDapulse={value:"true"===e.customOptions.dapulseSqsConsumer,source:t}),e.maxMappedFunctions&&"number"==typeof e.maxMappedFunctions&&(l.hudConfig.userConfig.maxMappedFunctions={value:e.maxMappedFunctions,source:t}),e.minPodMemoryMB&&"number"==typeof e.minPodMemoryMB&&(l.hudConfig.userConfig.minPodMemoryMB={value:e.minPodMemoryMB,source:t}),e.maxFileSizeBytes&&"number"==typeof e.maxFileSizeBytes&&(l.hudConfig.userConfig.maxFileSizeBytes={value:e.maxFileSizeBytes,source:t}),e.maxTimeUntilInitSessionMs&&"number"==typeof e.maxTimeUntilInitSessionMs&&(l.hudConfig.userConfig.maxTimeUntilInitSessionMs={value:e.maxTimeUntilInitSessionMs,source:t})}},669:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UserLogs=void 0,t.UserLogs={HudInitSuccess:()=>({level:"info",message:"Session started"}),FirstDecalarationSent:()=>({level:"info",message:"First code mapping sent successfully"}),FirstInvocationSent:()=>({level:"info",message:"First invocation sent successfully"}),HappyFlowCompleted:()=>({level:"info",message:"Your service is sending data successfully"}),FilesLoadedBeforeRegister:()=>({level:"info",message:"Files loaded before register():"}),FileBeforeRegisterTemplate:(e,t)=>({level:"info",message:`${e}. ${t}`}),InitIdleMode:()=>({level:"info",message:"Initialized successfully in idle mode."})}},857:e=>{e.exports=require("os")},1012:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=t.SDK_MODULE_NAME=void 0,n(r(9100),t),n(r(4627),t);var i=r(8809);Object.defineProperty(t,"SDK_MODULE_NAME",{enumerable:!0,get:function(){return i.SDK_MODULE_NAME}}),n(r(2684),t),n(r(363),t);var s=r(3312);Object.defineProperty(t,"SDK_VERSION",{enumerable:!0,get:function(){return s.SDK_VERSION}})},1493:e=>{e.exports=require("v8")},1569:e=>{e.exports=require("zod")},1620:e=>{e.exports=require("winston-transport")},1622:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodKind=t.getContextualData=t.getContextSymbol=t.getFunctionIdentifier=void 0;const s=i(r(6346)),a=r(6346),l=r(8528),u=r(8138),c=r(3073),d=r(2213),p=r(1974);function m(e,t){return{name:t,sourcemap_location_hints:(0,p.getLocationList)(e,t),format:"%s"}}function f(e){if(a.types.isIdentifier(e))return{name:e.name,sourcemap_location_hints:e.loc?[{name:e.name,line:e.loc.start.line,column:e.loc.start.column,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column}]:[],format:"%s"};if(a.types.isMemberExpression(e)||a.types.isOptionalMemberExpression(e)){let t;t=a.types.isThisExpression(e.object)?{name:"this",sourcemap_location_hints:(0,p.getLocationList)(e.object,"this")}:f(e.object);const r=f(e.property),o=e.computed?t.name+"["+r.name+"]":t.name+"."+r.name,n=t.format??"%s",i=r.format??"%s",s=e.computed?`${n}[${i}]`:`${n}.${i}`;return{name:o,sourcemap_location_hints:[...t.sourcemap_location_hints,...r.sourcemap_location_hints],format:s}}if(a.types.isOptionalCallExpression(e)||a.types.isCallExpression(e))return f(e.callee);if(a.types.isSequenceExpression(e))return(0,d.isHudAwaitSequence)(e)?f((0,d.getHudAwaitSequenceElement)(e)):f(e.expressions[e.expressions.length-1]);if(a.types.isArrayExpression(e))return{name:"[]",sourcemap_location_hints:(0,p.getLocationList)(e,"[]"),format:"%s"};if(a.types.isObjectExpression(e))return{name:"{}",sourcemap_location_hints:(0,p.getLocationList)(e,"{}"),format:"%s"};if(a.types.isStringLiteral(e))return{name:`"${e.value}"`,sourcemap_location_hints:(0,p.getLocationList)(e,e.value),format:'"%s"'};throw new u.HudUnsupportedError("Unsupported left side of assignment - "+e.type+"loc - "+JSON.stringify(e.loc))}function g(e){const{node:t}=e;if(e.isExpression())try{return function(e){const{parent:t}=e;if(a.types.isVariableDeclarator(t)&&a.types.isIdentifier(t.id))return m(t,t.id.name);if(a.types.isObjectProperty(t)&&a.types.isIdentifier(t.key))return m(t,t.key.name);if(a.types.isClassProperty(t)&&a.types.isIdentifier(t.key))return m(t,t.key.name);if(a.types.isAssignmentExpression(t))return f(t.left);if(a.types.isAssignmentPattern(t))return f(t.left);throw new u.HudUnsupportedError(`Unsupported parent type - ${t.type} for me ${e.node.type}`)}(e)}catch(e){if(e instanceof u.HudUnsupportedError)return;throw e}c.worker_logger.debug("getContextSymbol; Unsupported node type",{type:t.type})}function y(e){const t=[];return e.arguments.forEach((e,r)=>{let o,n;a.types.isStringLiteral(e)?(o=l.ArgumentTypes.StringLiteral,n=e.value):a.types.isTemplateLiteral(e)?(o=l.ArgumentTypes.TemplateString,n=function(e){let t="";const r=e.quasis,o=e.expressions;for(let e=0;e<r.length;e++)t+=r[e].value.cooked,e<o.length&&(t+=`\${${h(o[e])}}`);return t=`\`${t}\``,t}(e)):a.types.isIdentifier(e)&&(o=l.ArgumentTypes.Identifier,n=e.name),o&&n&&t.push({index:r,type:o,value:n})}),t}function h(e){if(a.types.isIdentifier(e))return e.name;if(a.types.isStringLiteral(e))return e.value;if(a.types.isCallExpression(e)||a.types.isOptionalCallExpression(e)){const t=e;if(a.types.isIdentifier(t.callee))return t.callee.name;if(a.types.isMemberExpression(t.callee)||a.types.isOptionalMemberExpression(t.callee)){let e="";const r=t.callee;if(a.types.isThisExpression(r.object)?e+="this.":a.types.isIdentifier(r.object)&&(e+=`${r.object.name}.`),""!==e&&a.types.isIdentifier(r.property))return e+=`${r.property.name}`,e}}return""}t.getFunctionIdentifier=function(e){const{node:t}=e;if(a.types.isFunctionDeclaration(t)||a.types.isFunctionExpression(t)){if(a.types.isIdentifier(t.id))return t.id}else if(a.types.isClassMethod(t)){if(a.types.isIdentifier(t.key))return t.key}else if(a.types.isClassPrivateMethod(t)){if(a.types.isIdentifier(t.key.id))return t.key.id}else if(a.types.isObjectMethod(t)&&a.types.isIdentifier(t.key))return t.key},t.getContextSymbol=g,t.getContextualData=function(e){let t,r=!1;return(e.isFunctionExpression()||e.isArrowFunctionExpression())&&(t=function(e){const t=e.parentPath;if(t.isCallExpression())for(const[r,o]of t.node.arguments.entries())if(o===e.node){const e=t.node.callee;let o;try{o=f(e)}catch(t){if(!(t instanceof u.HudUnsupportedError))throw t;c.worker_logger.debug("could not get callee symbol recursively",{error:t,type:e.type})}const n=y(t.node);return{callee:{symbol:o,argsCount:t.node.arguments.length,args:n},index:r}}}(e),r=function(e){const t=e.parentPath;return!!t.isCallExpression()&&t.node.callee===e.node}(e)),{symbol:g(e),callback:t,immediatelyInvoked:r}},t.getMethodKind=function(e){if(s.types.isClassMethod(e)||s.types.isObjectMethod(e)||s.types.isClassPrivateMethod(e))return e.kind}},1974:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getNodeLocation=t.resolveScopeSymbols=t.resolveSymbol=t.getLocationList=void 0;const n=o(r(9023)),i=r(3073);function s(e,t){let r=t.name;const o=t.sourcemap_location_hints.map(t=>{const r=e({line:t.line,column:t.column});if(null===r.line||null===r.column)return{name:t.name,line:-1,column:-1,line_on_server:t.line_on_server,column_on_server:t.column_on_server};let o=r.name??t.name??void 0;return o?.startsWith("#")&&(o=o.slice(1)),{name:o,line:r.line,column:r.column,line_on_server:t.line_on_server,column_on_server:t.column_on_server,resolved:!0}});return o.length>0&&o.every(e=>e.name)&&(t.format?Array.from(t.format.matchAll(/%s/g)).length!==o.length?i.worker_logger.warn("Format string does not match number of location hints",{format:t.format,locationHints:o}):r=n.default.format(t.format,...o.map(e=>e.name)):r=o.map(e=>e.name).join(".")),{name:r,sourcemap_location_hints:o}}t.getLocationList=function(e,t){return e.loc?[{line:e.loc.start.line,column:e.loc.start.column,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column,name:t}]:[]},t.resolveSymbol=s,t.resolveScopeSymbols=function(e,t){const{context:r}=t,o=r.symbol?s(e,r.symbol):void 0,n=s(e,t.symbol);return{...t,context:{...r,symbol:o},symbol:n}},t.getNodeLocation=function(e,t,r=void 0){const o=e.loc?.start,n=e.loc?.end;if(!o||!n)return i.worker_logger.info("Node without location",{filename:r,type:e.type}),{start:{source:null,line:-1,column:-1},end:{source:null,line:-1,column:-1}};const s=t({line:o.line,column:o.column}),a=t({line:n.line,column:n.column});return null!==s.line&&null!==s.column&&null!==a.line&&null!==a.column||(i.worker_logger.debug("Could not find location for function",{filename:r,type:e.type,locStart:o,locEnd:n}),s.line=-1,s.column=-1,a.line=-1,a.column=-1),{start:{source:s.source,line:s.line,column:s.column},end:{source:a.source,line:a.line,column:a.column}}}},2213:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getHudAwaitSequenceElement=t.isHudAwaitSequence=void 0;const o=r(6346),n=r(1012),i=r(8138);t.isHudAwaitSequence=function(e){if(e.expressions.length<2)return!1;const t=e.expressions[e.expressions.length-1];return!!o.types.isIdentifier(t)&&!!t.name.startsWith(n.hudConfig.wrapVarPrefix)},t.getHudAwaitSequenceElement=function(e){const t=e.expressions[0];if(!o.types.isAssignmentExpression(t))throw new i.HudUnsupportedError("Expected assignment expression");const{left:r,right:s}=t;if(!o.types.isIdentifier(r)||!r.name.startsWith(n.hudConfig.wrapVarPrefix))throw new i.HudUnsupportedError("Expected identifier starting with "+n.hudConfig.wrapVarPrefix);return s}},2241:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1012),t),n(r(8287),t),n(r(8138),t),n(r(8808),t),n(r(2794),t),n(r(7582),t),n(r(3073),t),n(r(5290),t),n(r(5822),t),n(r(3699),t),n(r(4219),t),n(r(4451),t),n(r(2908),t),n(r(2451),t),n(r(3431),t),n(r(669),t),n(r(8066),t)},2298:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNamespaceScopeable=t.isHudScopeable=t.NamespaceScopeAlias=t.ScopableAlias=void 0;const o=r(6346);t.ScopableAlias="ArrowFunctionExpression|BlockStatement|CatchClause|ClassMethod|ClassPrivateMethod|DeclareModule|DoExpression|DoWhileStatement|ForInStatement|ForOfStatement|ForStatement|FunctionDeclaration|FunctionExpression|IfStatement|LabeledStatement|ObjectMethod|StaticBlock|SwitchCase|TSModuleBlock|TryStatement|WhileStatement|WithStatement|ClassDeclaration|ClassExpression|ObjectExpression|SwitchStatement",t.NamespaceScopeAlias="FunctionDeclaration|FunctionExpression|ArrowFunctionExpression|ObjectMethod|ClassMethod|ClassPrivateMethod|ClassDeclaration|ClassExpression|ObjectExpression",t.isHudScopeable=function(e){return o.types.isArrowFunctionExpression(e)||o.types.isBlockStatement(e)||o.types.isCatchClause(e)||o.types.isClassMethod(e)||o.types.isClassPrivateMethod(e)||o.types.isDeclareModule(e)||o.types.isDoExpression(e)||o.types.isDoWhileStatement(e)||o.types.isForInStatement(e)||o.types.isForOfStatement(e)||o.types.isForStatement(e)||o.types.isFunctionDeclaration(e)||o.types.isFunctionExpression(e)||o.types.isIfStatement(e)||o.types.isLabeledStatement(e)||o.types.isObjectMethod(e)||o.types.isProgram(e)||o.types.isStaticBlock(e)||o.types.isSwitchCase(e)||o.types.isTSModuleBlock(e)||o.types.isTryStatement(e)||o.types.isWhileStatement(e)||o.types.isWithStatement(e)||o.types.isClassDeclaration(e)||o.types.isClassExpression(e)||o.types.isObjectExpression(e)||o.types.isSwitchStatement(e)},t.isNamespaceScopeable=function(e){return o.types.isFunction(e)||o.types.isClass(e)||o.types.isObjectExpression(e)}},2451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUserTsNodeConfig=void 0;const o=r(8138),n=r(3073),i=r(8066);t.getUserTsNodeConfig=function(e=!0){const t=function(){try{const e=i.myRequire.resolve("ts-node");if(!e)return;if(!i.myRequire.cache[e])return;const t=(0,i.myRequire)("ts-node"),r=process[t.REGISTER_INSTANCE];if(!r)return;return r.options}catch(e){return}}();if(t){if(!t.transpileOnly)throw e&&n.customer_logger.log(o.UserErrorLogs.TsNodeNotTranspileOnly()),n.app_logger.warn("ts-node is used but not configured to transpile only"),new o.HudNoTranspileOnlyError;return{cwd:t.cwd,project:t.project,projectSearchDir:t.projectSearchDir}}if(process.argv[0].endsWith("ts-node"))throw e&&n.customer_logger.log(o.UserErrorLogs.TsNodeNotFoundEvenThoughRunWithTsNode()),n.app_logger.info("ts-node not found even run with ts-node"),new o.HudTsNodeNotFoundButUsed}},2684:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectStoreConfigSchema=void 0;const o=r(1569),n=o.z.object({type:o.z.literal("s3")}),i=o.z.object({type:o.z.literal("disk"),path:o.z.string()});t.ObjectStoreConfigSchema=o.z.union([n,i])},2784:e=>{e.exports=require("../native/_index")},2794:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getConfigContent=t.HudFailedReadConfigError=t.isHudEnabled=void 0;const s=i(r(9896)),a=i(r(6928)),l=r(8138),u=r(3073);t.isHudEnabled=function(){if("false"===process.env.HUD_ENABLE)return!1;if(globalThis.forceHudEnable)return!0;let e,t;try{if(e=d(),e&&(t=JSON.parse(e.content),!1===t.enable))return!1}catch(t){throw t instanceof c&&"EACCES"===t.code?u.customer_logger.log(l.UserErrorLogs.ConfigInaccessible(t.path)):e&&u.customer_logger.log(l.UserErrorLogs.JSONErrorInUserConfig(e.source,t instanceof Error?t.message:void 0)),t}return"true"===process.env.HUD_ENABLE||!0===t?.enable};class c extends Error{path;code;constructor(e,t){super(),this.path=e,this.code=t}}function d(){if(process.env.HUD_CONFIG)return{content:process.env.HUD_CONFIG,source:"HUD_CONFIG"};const e=function(){try{const e=process.env.HUD_CONFIG_PATH;if(e)return s.existsSync(e)?e:void 0;let t=__dirname,r=0;for(;"/"!==t&&r<10;){const e=`${t}/hud.config`;if(s.existsSync(e))return e;t=a.dirname(t),r++}}catch(e){return}}();if(e)try{return{content:s.readFileSync(e,"utf8"),source:e}}catch(t){throw new c(e,t.code)}}t.HudFailedReadConfigError=c,t.getConfigContent=d},2908:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.suppressTraces=void 0;const o=r(1012),n=r(3073),i=r(8066);let s,a;try{const e=(0,i.myRequire)("@opentelemetry/api"),t=(0,i.myRequire)("@opentelemetry/core");s=e.context,a=t.suppressTracing,n.app_logger.info("OpenTelemetry exists",{suppressConfig:o.hudConfig.suppressTraces})}catch(e){n.app_logger.info("OpenTelemetry api/core does not exist")}t.suppressTraces=function(e){return function(...t){return o.hudConfig.suppressTraces&&s&&a?(n.app_logger.debug("Running with Suppressed traces"),s.with(a(s.active()),()=>e(...t))):e(...t)}}},2987:e=>{e.exports=require("perf_hooks")},3073:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.worker_logger=t.instrument_logger=t.app_logger=t.customer_logger=t.formatLogMessage=t.SafeLogger=t.renewFileTransports=t.getSavedLogs=t.getLogPath=t.WorkerPortTransport=void 0;const a=i(r(6982)),l=i(r(9896)),u=i(r(857)),c=i(r(6928)),d=i(r(5124)),p=s(r(1620)),m=r(9100),f={...process.env.HUD_DEBUG?m.hudConfig.logger.debug:m.hudConfig.logger.default,console:!!process.env.HUD_VERBOSE};class g extends p.default{_messeagesToSend=[];messagesLimit=m.hudConfig.loggerWorkerPortSizeLimit;messageDropCount=0;getMessagesToSend(){if(!this._messeagesToSend.length)return!1;const e=this._messeagesToSend;this.clearMessagesToSend();const t=this.messageDropCount;return this.messageDropCount=0,{logsBuf:this.formatMessagesToSend(e),messageDropCount:t}}clearMessagesToSend(){this._messeagesToSend=[]}formatMessagesToSend(e){return e.map(e=>JSON.stringify(e)).join("\n")}log(e,t){this._messeagesToSend.length>=this.messagesLimit?this.messageDropCount++:this._messeagesToSend.push(e),t()}}t.WorkerPortTransport=g;const y=d.format.combine(d.format.timestamp({format:"HH:mm:ss.SSS"}),d.format.printf(({level:e,message:t,timestamp:r,label:o,...n})=>{try{const i=Object.keys(n).length;let s;if(i)if(1===i){const e=Object.keys(n)[0];s=`${t} ${e}: ${JSON.stringify(n[e],null,2)}`}else s=`${t}\n${JSON.stringify(n,null,2)}`;else s=t;const a=d.format.colorize().colorize(e,e.toUpperCase());return`[${r}]${(o?`(${o})`:"").padEnd(8," ")} ${a}: ${s}`}catch(e){return t}}));function h(e){return d.format.combine(d.format.label({label:e}),d.format.timestamp({format:()=>(new Date).toISOString()}),d.format.json())}function v(e){return{filename:E(),level:f.levels[e],format:h(e),lazy:!1}}function _(){if(m.hudConfig.logDirectory)return m.hudConfig.logDirectory;const e=u.homedir();switch(u.platform()){case"darwin":return c.join(e,"Library","Logs","hud");case"win32":return c.join(e,"AppData","hud","Logs");default:return c.join(e,".hud","logs")}}let b;function E(){return b??=c.join(_(),`${a.randomUUID()}.log`)}t.getLogPath=E,t.getSavedLogs=function(){const e=[];for(const[t,r]of Object.entries(S))for(const t of r.transports)try{if(t instanceof g){const o=t.getMessagesToSend();if(!o)continue;const{logsBuf:n,messageDropCount:i}=o;i&&r.info(`Dropped ${i} messages`),e.push(n)}}catch(e){r.error("Failed to get saved logs",e)}return e},t.renewFileTransports=function(){const e=new Date,t=new Set;for(const[r,o]of Object.entries(S)){const r=[],n=[];for(const i of o.transports)if(i instanceof d.transports.File){r.push(i),n.push(new d.transports.File({level:i.level,format:i.format,filename:c.join(i.dirname,i.filename),lazy:!1}));const o=c.join(_(),`${a.randomUUID()}-${e.toISOString().replaceAll(":","")}.log`);l.existsSync(c.join(i.dirname,i.filename))&&(l.renameSync(c.join(i.dirname,i.filename),o),t.add(o))}for(const e of r)o.remove(e),e.close&&e.close();for(const e of n)o.add(e)}return t};const S={};class C{name;logger;constructor(e){this.name=e;try{this.logger=function(e){const t=[];f.console&&t.push(new d.transports.Console({format:d.format.combine(d.format.label({label:e}),y)}));let r=!1;if(!m.hudConfig.fileless)try{t.push(function(e){const t=v(e),r=c.dirname(t.filename);return l.mkdirSync(r,{recursive:!0}),l.writeFileSync(t.filename,"",{flag:"w"}),new d.transports.File(t)}(e))}catch{r=!0}(m.hudConfig.fileless||r)&&t.push(function(e){const t=h(e);return new g({format:t})}(e));const o=d.createLogger({level:f.levels[e],transports:t});return S[e]=o,r&&o.info("Could not create file transport, fallback succesfully to worker port"),m.hudConfig.fileless&&o.info("Fileless mode is enabled"),o}(e)}catch(e){this.logger=void 0}}isValid(){return!!this.logger}log(e,t,...r){if(this.logger)try{this.logger.log(e,t,...r)}catch{}}error(e,...t){this.log("error",e,...t)}warn(e,...t){this.log("warn",e,...t)}info(e,...t){this.log("info",e,...t)}http(e,...t){this.log("http",e,...t)}verbose(e,...t){this.log("verbose",e,...t)}debug(e,...t){this.log("debug",e,...t)}silly(e,...t){this.log("silly",e,...t)}}function w(e,t,r){let o=`Hud: ${e}`;return r&&(o+=" For more information visit https://docs.hud.io/docs/node-sdk-ie."),void 0!==t&&(o+=` ${t}`),o}t.SafeLogger=C,t.formatLogMessage=w,t.customer_logger=d.createLogger({level:m.hudConfig.customerLoggerLevel,transports:[new d.transports.Console({})],format:d.format.printf(({message:e,errCode:t,moreInfo:r})=>{try{return w(e,t,r)}catch(t){return e}})}),t.app_logger=new C("app"),t.instrument_logger=new C("instrument"),t.worker_logger=new C("worker")},3176:e=>{e.exports=require("buffer-crc32")},3312:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=void 0,t.SDK_VERSION="1.6.11"},3431:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.unrefSetInterval=t.unrefSetTimeout=t.unrefSetImmediate=void 0;const s=i(r(6460));t.unrefSetImmediate=function(e,t){return s.setImmediate(e,{...t,ref:!1})},t.unrefSetTimeout=function(e,t,r){return s.setTimeout(e,t,{...r,ref:!1})},t.unrefSetInterval=function(e,t,r){return s.setInterval(e,t,{...r,ref:!1})}},3699:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.shouldRunHud=t.isSupportedNative=t.isDebuggerAttached=void 0;const s=i(r(6592)),a=r(5919),l=r(1012),u=r(8138),c=r(4715),d=r(2794),p=r(3073);function m(){if("true"===process.env.HUD_ALLOW_DEBUGGER)return!1;if(process.execArgv.some(e=>e.includes("--inspect")||e.includes("--debug")||e.includes("--inspect-brk")||e.includes("--debug-brk")))return!0;try{return"string"==typeof s.url()}catch(e){return!1}}function f(){return void 0!==r(2784).transform}t.isDebuggerAttached=m,t.isSupportedNative=f,t.shouldRunHud=function(){return"false"===process.env.HUD_ENABLE?{shouldRun:!1,error:u.UserErrorLogs.HudEnableIsFalse()}:a.isMainThread?(0,d.isHudEnabled)()?process.versions.bun?{shouldRun:!1,error:u.UserErrorLogs.RunningInBun()}:function(){const e=process.versions.node.split(".")[0];return!!l.hudConfig.supportedNodeVersions.includes(e)}()?process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE&&!function(){try{return"1"===process.env.HUD_INTERNAL_EXEC_WRAPPER_USED}catch(e){return!1}}()?{shouldRun:!1,error:u.UserErrorLogs.LambdaNotViaLayer()}:m()?{shouldRun:!1,error:u.UserErrorLogs.DebuggerAttached()}:function(){const e=(0,c.getMemoryLimitInfo)();return!!(0,c.isMemoryLimitBigEnough)(e)}()?f()?{shouldRun:!0}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNativeBuild()}:{shouldRun:!1,error:u.UserErrorLogs.PodMemoryLimitTooLow(l.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER)}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNodeVersion()}:{shouldRun:!1,error:u.UserErrorLogs.HudEnableNotSet(process.env.HUD_ENABLE)}:(p.app_logger.info("required not from main thread"),{shouldRun:!1,error:null})}},3903:e=>{e.exports=require("uuid")},4219:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.safeCall=void 0;const o=r(8138);t.safeCall=function(e,t){return t.catch(t=>{(0,o.isAbortError)(t)||e.error("Unhandled exception on async task",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})})}},4451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineSourceMaps=t.shouldSupportSourceMap=void 0;const o=r(1012),n=r(3073);t.shouldSupportSourceMap=function(){return!!o.hudConfig.supportSourceMap&&(process.execArgv.includes("--enable-source-maps")&&n.instrument_logger.warn("--enable-source-maps is set, enabling custom source-map-support anyway"),!0)},t.combineSourceMaps=function(e,t){if(0===e.length)return;if(1===e.length&&void 0===e[0].lineOffset)return e[0].map;const r=e.map(e=>({offset:{line:e.transformedLineOffset,column:e.transformedColumnOffset},map:{..."string"==typeof e.map?JSON.parse(e.map):e.map,file:t}})),o={version:3,file:t,sections:r};return JSON.stringify(o)}},4627:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateDynamicConfig=void 0;const o=r(9100);function n(e,t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(e)&&Array.isArray(t))return t;const r={...e};for(const o in t){const i=e[o],s=t[o];r[o]=n(i,s)}return r}t.updateDynamicConfig=function(e,t,r){const i=o.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!i.success)return r.error("Dynamic configuration not updated - Invalid configuration override",{remoteConfigParseResult:i,remoteConfig:e}),t.dynamicConfig;const s=n(t.dynamicConfig,i.data);return void 0!==s.enableInvestigation&&s.enableInvestigation!==t.dynamicConfig.enableInvestigation&&(r.info("Dynamic configuration updated - enableInvestigation",{hudEnableInvestigation:s.enableInvestigation}),t.isInvestigationEnabledByEnv||(globalThis.hudEnableInvestigation=s.enableInvestigation)),s}},4634:e=>{e.exports=require("source-map")},4715:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isMemoryLimitBigEnough=t.getMemoryLimitInfo=void 0;const o=r(1012),n=r(3073),i=r(5290);t.getMemoryLimitInfo=function(){const e=(0,i.getPodMemoryLimit)(n.app_logger);return n.app_logger.info(`Pod memory limit: ${null===e.podMemoryLimitMB?"unknown":e.podMemoryLimitMB+"MB"} from ${e.source}, minimum required: ${o.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER}MB`),e},t.isMemoryLimitBigEnough=function(e){return null===e.podMemoryLimitMB||e.podMemoryLimitMB>=(o.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER)}},5124:e=>{e.exports=require("winston")},5290:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPodMemoryLimit=void 0;const n=r(9896),i=o(r(857));let s=null;function a(e,t){const r=parseInt(e);if(isNaN(r))return null;const o=Math.floor(r/1048576);return o<=0||o>=131072?(t.debug(`Treating memory value (${e} bytes) as unlimited.`),null):o}function l(e,t,r){if(!e)return{podMemoryLimitMB:null,source:null};const o=a(e,r);return null!==o?{podMemoryLimitMB:o,source:t}:{podMemoryLimitMB:null,source:null}}function u(e){try{return(0,n.readFileSync)(e,"utf8")}catch{return null}}function c(){const e=i.default.totalmem();return{podMemoryLimitMB:Math.floor(e/1048576),source:"system-memory"}}t.getPodMemoryLimit=function(e){if(null!==s)return s;if("linux"!==i.default.platform())return s=c(),s;let t=function(e,t){for(const e of["/sys/fs/cgroup/memory.max","/sys/fs/cgroup/memory.high"]){const r=u(e);if(!r)continue;const o=r.trim();if("max"===o){t.debug(`Found 'max' value in ${e}, will use system memory instead`);continue}const n=a(o,t);if(null!==n)return{podMemoryLimitMB:n,source:e}}return{podMemoryLimitMB:null,source:null}}(0,e);return null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=function(e,t){for(const e of["/sys/fs/cgroup/memory/memory.stat","/sys/fs/cgroup/memory/memory.limit_in_bytes"]){const r=u(e);if(r)if(e.endsWith("memory.stat")){const o=["hierarchical_memory_limit","memory.limit_in_bytes","limit_in_bytes"],n=r.split("\n");for(const r of o){const o=n.find(e=>e.startsWith(r));if(o){const n=l(o.split(" ")[1],`${e}:${r}`,t);if(null!==n.podMemoryLimitMB)return n}}}else{const o=l(r.trim(),e,t);if(null!==o.podMemoryLimitMB)return o}}return{podMemoryLimitMB:null,source:null}}(0,e),null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=c(),e.info(`No container memory limit found, using system memory: ${t.podMemoryLimitMB}MB`),s=t,t))}},5595:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getParameterInfo=void 0;const s=i(r(6346)),a=r(8528),l=r(3073);function u(e,t=0){if(void 0!==e.loc&&null!==e.loc)return{line:e.loc.start.line,column:e.loc.start.column+t,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column+t}}function c(e){return s.types.isIdentifier(e.argument)?{name:e.argument.name,type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e,e.argument.name.length+3)}:(l.worker_logger.warn("Unsupported rest element",{type:e.argument.type}),{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e)})}function d(e){var t;if(e)switch(e?.type){case"Identifier":return{name:(t=e).name,type:a.ParameterTypes[t.type],sourcemap_location_hint:u(t,t.name.length)};case"AssignmentPattern":return function(e,t,r){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),left:t,right:r}}(e,d(e.left),function(e){switch(e.type){case"StringLiteral":case"NumericLiteral":case"BooleanLiteral":case"BigIntLiteral":case"DecimalLiteral":return{type:e.type,value:e.value};case"RegExpLiteral":return{type:e.type,value:e.pattern}}return{type:e.type}}(e.right));case"ArrayPattern":return function(e,t){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),elements:t}}(e,e.elements.map(e=>d(e)).filter(e=>void 0!==e));case"RestElement":return c(e);case"ObjectPattern":{const t=[];return e.properties.forEach(e=>{if(s.types.isObjectProperty(e)){const r=s.types.isIdentifier(e.key)&&s.types.isIdentifier(e.value)||s.types.isAssignmentPattern(e.value)?void 0:d(e.key);t.push(function(e,t,r){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),key:t,value:r}}(e,r,d(e.value)))}else s.types.isRestElement(e)&&t.push(c(e))}),function(e,t){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),properties:t}}(e,t)}default:l.worker_logger.warn("Unsupported parameter type",{type:e.type})}}t.getParameterInfo=function(e,t){return e.node.params.map(e=>{try{return d(e)}catch(e){return}}).filter(e=>void 0!==e).map(e=>{let r;if(void 0!==e.sourcemap_location_hint){const{name:o,line:n,column:i}=t({line:e.sourcemap_location_hint.line,column:e.sourcemap_location_hint.column}),s={line_on_server:e.sourcemap_location_hint.line_on_server,column_on_server:e.sourcemap_location_hint.column_on_server};null===n||null===i?(l.worker_logger.debug("Could not find location for parameter",{type:e.type}),r={name:o??void 0,line:-1,column:-1,...s}):r={name:o??void 0,line:n,column:i,...s}}return{...e,name:r?.name??e.name,type:e.type,sourcemap_location_hint:r??e.sourcemap_location_hint}})}},5822:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.loopLogProcessPerformance=t.getCpuLimit=t.getCpuLimitUnsafe=t.loopLogThreadPerformance=void 0;const a=r(9896),l=s(r(857)),u=r(2987),c=i(r(1493)),d=r(2908),p=r(3431);function m(e){e.info("Trying to detect CPU limit");try{const t=(0,a.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_quota_us","utf8"),r=(0,a.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_period_us","utf8");return e.info("CPU limit detected for cgroups v1",{cpuQuota:t,cpuPeriod:r}),"-1"===t?"unlimited":parseInt(t.toString())/parseInt(r.toString())}catch(t){try{const t=(0,a.readFileSync)("/sys/fs/cgroup/cpu.max","utf8"),[r,o,n]=t.trim().split(" ");return e.info("CPU limit detected for cgroups v2",{max:r,period:o}),r&&o?"max"===r?"unlimited":parseInt(r)/parseInt(o):void e.info("cpu.max file is not in the expected format",t)}catch(r){return void e.info("Failed to detect CPU limit",{e:t,e2:r})}}}let f;t.loopLogThreadPerformance=async function(e,t,r){let o=u.performance.eventLoopUtilization(),n=u.performance.nodeTiming.toJSON();for await(const i of(0,p.unrefSetInterval)(t,void 0,{signal:r}))try{const t=u.performance.eventLoopUtilization(),r=u.performance.eventLoopUtilization(t,o);o=t;const i=c.getHeapStatistics(),s=u.performance.nodeTiming.toJSON(),a=s.idleTime-n.idleTime,l=s.duration-n.duration,d=a/l;n=s,e.info("thread performance statistics",{thread_elu_percentage:100*r.utilization,memory:{thread_heap_utilization_percentage:i.total_heap_size/i.heap_size_limit*100},idleTime:a,totalTime:l,idleTimePercentage:d})}catch(t){e.error("Failed logging thread performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}},t.getCpuLimitUnsafe=m;let g=!1;t.getCpuLimit=e=>(g||(f=(0,d.suppressTraces)(m)(e),g=!0),f),t.loopLogProcessPerformance=async function(e,r,o){const n=l.default.totalmem(),i=(0,t.getCpuLimit)(e);let s=process.cpuUsage();for await(const t of(0,p.unrefSetInterval)(r,void 0,{signal:o}))try{const t=process.memoryUsage(),o=process.uptime(),a=process.cpuUsage(),l={user:a.user-s.user,system:a.system-s.system};s=a;let u=(l.user+l.system)/(1e3*r);i&&"number"==typeof i&&(u/=i),e.info("process performance statistics",{memory:{process_memory_rss:t.rss,process_memory_utilization_percentage:t.rss/n*100},cpu:100*u,cpuStats:{limit:i,usagePercentage:100*u},uptime:o})}catch(t){e.error("Failed logging process performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}}},5919:e=>{e.exports=require("node:worker_threads")},6346:e=>{e.exports=require("@babel/core")},6460:e=>{e.exports=require("timers/promises")},6592:e=>{e.exports=require("node:inspector")},6760:e=>{e.exports=require("node:path")},6827:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseDeclarations=t.readFile=t.getRealPositionFunc=t.fixSourceMap=void 0;const a=i(r(6346)),l=r(8528),u=s(r(9896)),c=r(4634),d=r(1622),p=s(r(6760)),m=r(1012),f=r(8528),g=s(r(3176)),y=r(2784),h=r(3903),v=r(3073),_=r(8066),b=r(7064),E=r(5595),S=r(7087),C=r(1974),w=r(2298),I={babelrc:!1,configFile:!1};function M(e){let t;return t="string"==typeof e?JSON.parse(e):e,t.sources=t.sources.map(e=>e.replace(/^webpack:\/\/(?:@[^/]+?[/])?[^/]+\//,"")),t}function x(e,t,r){return o=>{const n=e?.originalPositionFor({line:o.line,column:o.column})??{line:o.line,column:o.column,source:null,name:null},i=null!==n.line?n.line+(t||0):null,s=null!==n.column?n.column+(1===n.line&&r||0):null;return{...n,line:i,column:s}}}let O;t.fixSourceMap=M,t.getRealPositionFunc=x,t.readFile=async function(e,t,r){try{if(t&&r){const o=Buffer.alloc(r-t),n=await u.default.promises.open(e,"r");return await n.read(o,0,r-t,t),await n.close(),o.toString("utf-8")}return await u.default.promises.readFile(e,"utf-8")}catch(t){return void v.worker_logger.error("Failed to read file",{filename:e,msg:t instanceof Error?t.message:t})}},t.parseDeclarations=async function(e,t,r=null,o){const{filename:n,bundlerBuildId:i,bundlerBuildIdGenerated:s,lineOffset:u,columnOffset:T,file_path_checksum:k,file_checksum:D,functionIds:F,sourceCodeHash:P,moduleBase:L}=e;if(v.worker_logger.debug("Parsing code",{filename:n}),o)try{if(!O){const e=(0,_.myRequire)("ts-node");O=e.create({...o,transpileOnly:!0,typeCheck:!1})}const e=function(e,t,r){try{return r.compile(e,t)}catch(e){return void v.worker_logger.warn("ts file pass, but failed to compile with ts-node",{filename:t,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(t,n,O);if(!e)return{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}};t=e}catch(e){return v.worker_logger.error("Failed to require and compile ts file",{filename:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}}}else if(n.endsWith(".ts")||n.endsWith(".mts"))return v.worker_logger.error("ts file pass, but not found ts-options"),{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}};const H=(0,g.default)(t).readUInt32BE();if(H!==D)return v.worker_logger.warn("File checksum mismatch",{filename:n,file_path_checksum:k,diskFileChecksum:H,file_checksum:D,functionIds:F}),{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}};const U=u?null:(0,y.getSourceMap)(n,t);let N,j;try{null!==U&&(j=(0,g.default)(U).readUInt32BE(),m.hudConfig.userConfig.disableSourceMapsResolution?.value||(N=JSON.parse(U)))}catch(e){v.worker_logger.error("Failed to parse source map",{filename:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const B=x(N?await new c.SourceMapConsumer(M(N)):void 0,u,T);v.worker_logger.debug("Parsing code",{filename:n});const A=[],R=await a.parseAsync(t,I);if(null===R)return v.worker_logger.warn("Failed parsing code to tree",{filename:n,file_path_checksum:k,diskFileChecksum:H,file_checksum:D,functionIds:F}),{declarations:[],blacklist:{file_path_checksum:k,file_checksum:D,uuids:F}};v.worker_logger.debug("Parsed code to tree",{filename:n});const $=[{type:l.EntityType.Program,symbol:{sourcemap_location_hints:[]},context:{},childrenCount:{},siblingIndex:0}],q=new Set;v.worker_logger.debug("Traversing declarations",{filename:n}),r?.postMessage("eventlooptime"),a.traverse(R,{[w.NamespaceScopeAlias]:{enter(e){const{node:r}=e;if(!(0,w.isNamespaceScopeable)(r))return;const o=$[$.length-1];let i=(0,S.getScope)(e);if(!i)return;i=(0,C.resolveScopeSymbols)(B,i);const s=o.childrenCount[i.type]||0,a={...i,childrenCount:{},siblingIndex:s};if(o.childrenCount[i.type]=s+1,$.push(a),q.add(r),e.isFunction()){const r=function(e,t,r,o,n,i,s){try{const l=e;let u=e.node.body.loc?.start?.index;if(void 0===u)throw new Error("Function node has no block start location");if(void 0===e.node.start||null===e.node.start||void 0===e.node.end||null===e.node.end)throw new Error("Function node has no start or end location");"ArrowFunctionExpression"===l.node.type&&l.node.body.extra?.parenthesized&&l.node.body.extra?.parenStart&&Number.isInteger(l.node.body.extra.parenStart)&&(u=l.node.body.extra.parenStart);const c=function(e,t,r,o){const n=o.slice(0,r),i=`${e}_${t}_${Buffer.byteLength(n,"utf8")}`;return(0,h.v5)(i,m.hudConfig.functionUuidNamespace).toString()}(t,r,u-(n-1),i),y=(a=i.slice(e.node.start,e.node.end),(0,g.default)(a).readUInt32BE().toString());if(!y)return void v.worker_logger.warn("Function hash not found",{functionID:c,filename:r});const _=l.node.async||!1,S=(0,C.getNodeLocation)(l.node,s),w=S.start.source??r,I=(0,b.getEntityType)(l),M=(0,d.getMethodKind)(l.node),x=(0,d.getContextualData)(l);x.symbol&&(x.symbol=(0,C.resolveSymbol)(s,x.symbol)),x.callback?.callee.symbol&&(x.callback.callee.symbol=(0,C.resolveSymbol)(s,x.callback.callee.symbol));const O=(0,E.getParameterInfo)(l,s),{siblingIndex:T,childrenCount:k}=o[o.length-1],D=o.slice(0,-1),F=(0,d.getFunctionIdentifier)(l),P=(0,C.resolveSymbol)(s,{name:F?.name,sourcemap_location_hints:F?(0,C.getLocationList)(F,F.name):(0,C.getLocationList)(l.node,void 0),format:F?"%s":void 0});return{module:p.default.parse(w).name,symbol:P,context:x,file:w,type:I,format:f.Format.cjs,parameters:O,async:_,start_line:S.start.line,end_line:S.end.line,start_column:S.start.column,source_code_hash:y,runtime_function_id:c,scope_chain:D,declarations_count:0,methodKind:M,siblingIndex:T,childrenCount:k,original_location:{file:r,start_line:e.node.loc?.start?.line,end_line:e.node.loc?.end?.line,start_column:e.node.loc?.start?.column,end_column:e.node.loc?.end?.column}}}catch(e){v.worker_logger.error("Failed to handle function",{filename:r,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}var a}(e,P,n,$,L,t,B);r&&A.push(r)}},exit(e){q.has(e.node)&&($.pop(),q.delete(e.node))}}}),v.worker_logger.debug("Traversed declarations",{filename:n});const K=new Set(A.map(e=>e.runtime_function_id)),z=[],W=[];A.forEach(e=>{K.has(e.runtime_function_id)?z.push({...e,declarations_count:A.length,bundler_build_id:i,was_bundler_build_id_generated:s,has_input_map:void 0!==N,sourcemap_crc:j,file_path_checksum:k,file_checksum:D}):W.push(e)}),W.length>0&&v.worker_logger.warn("Function IDs mismatch, missing instrumentation",{filename:n,runtimeFunctionIds:F,missingInstrumentation:W}),new Set(F).forEach(e=>{K.has(e)&&K.delete(e)});const V=K.size>0;return V&&v.worker_logger.error("Function IDs mismatch, missing declerations",{filename:n,missingRuntimeFunctionIds:[...K]}),{declarations:z,blacklist:V?{file_path_checksum:k,file_checksum:D,uuids:[...K]}:void 0}}},6928:e=>{e.exports=require("path")},6982:e=>{e.exports=require("crypto")},7064:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getEntityIdentity=t.getEntityType=void 0;const o=r(6346),n=r(8528),i=r(3073);t.getEntityType=function(e){const{node:t}=e;return o.types.isFunctionDeclaration(t)?n.EntityType.FunctionDeclaration:o.types.isFunctionExpression(t)?n.EntityType.FunctionExpression:o.types.isArrowFunctionExpression(t)?n.EntityType.FunctionArrow:o.types.isObjectMethod(t)?n.EntityType.ObjectMethod:o.types.isStaticBlock(t)||o.types.isClassMethod(t)?n.EntityType.ClassMethod:o.types.isClassPrivateMethod(t)?n.EntityType.ClassPrivateMethod:o.types.isClassDeclaration(t)?n.EntityType.ClassDeclaration:o.types.isClassExpression(t)?n.EntityType.ClassExpression:o.types.isForInStatement(t)||o.types.isForOfStatement(t)||o.types.isForStatement(t)?n.EntityType.ForLoop:o.types.isBlockStatement(t)?function(e){const t=e.parentPath.node;if(!(o.types.isFunctionDeclaration(t)||o.types.isFunctionExpression(t)||o.types.isArrowFunctionExpression(t)||o.types.isClassMethod(t)||o.types.isObjectMethod(t)||o.types.isClassPrivateMethod(t)))if(o.types.isIfStatement(t)){if("consequent"===e.parentKey)return n.EntityType.IfConsequent;if("alternate"===e.parentKey)return n.EntityType.IfAlternate;if("test"===e.parentKey)return n.EntityType.IfTest}else{if(o.types.isBlockStatement(t)||o.types.isProgram(t))return n.EntityType.Block;if(o.types.isTryStatement(t)){if("block"===e.parentKey)return n.EntityType.Try;if("finalizer"===e.parentKey)return n.EntityType.Finally}else{if(o.types.isCatchClause(t))return;if(o.types.isWhileStatement(t))return"test"===e.parentKey?n.EntityType.WhileTest:n.EntityType.Do;if(o.types.isDoWhileStatement(t))return"test"===e.parentKey?n.EntityType.WhileTest:n.EntityType.Do;if(!(o.types.isForStatement(t)||o.types.isForInStatement(t)||o.types.isForOfStatement(t)))return;if("test"===e.parentKey)return n.EntityType.ForTest;if("body"===e.parentKey)return n.EntityType.ForBlock}}}(e):o.types.isProgram(t)?n.EntityType.Program:o.types.isDoWhileStatement(t)?n.EntityType.DoWhile:o.types.isWhileStatement(t)?n.EntityType.While:o.types.isCatchClause(t)?n.EntityType.Catch:o.types.isObjectExpression(t)?n.EntityType.ObjectExpression:o.types.isWithStatement(t)?n.EntityType.With:o.types.isSwitchStatement(t)?n.EntityType.Switch:o.types.isSwitchCase(t)?n.EntityType.SwitchCase:o.types.isTryStatement(t)?n.EntityType.TryCatch:o.types.isIfStatement(t)?n.EntityType.If:n.EntityType.Other},t.getEntityIdentity=function(e){return o.types.isFunctionDeclaration(e)?o.types.isIdentifier(e.id)?e.id:void i.worker_logger.info("Function declaration without an identifier"):o.types.isClassDeclaration(e)?o.types.isIdentifier(e.id)?e.id:void i.worker_logger.info("Class declaration without an identifier"):o.types.isFunctionExpression(e)||o.types.isClassExpression(e)?o.types.isIdentifier(e.id)?e.id:void 0:o.types.isClassMethod(e)?o.types.isIdentifier(e.key)?e.key:void i.worker_logger.info("Class method without an identifier"):o.types.isObjectMethod(e)?o.types.isIdentifier(e.key)?e.key:void i.worker_logger.info("Object method without an identifier"):o.types.isClassPrivateMethod(e)?o.types.isIdentifier(e.key.id)?e.key.id:void i.worker_logger.info("Class private method without an identifier"):void 0}},7087:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getScope=void 0;const o=r(7064),n=r(1974),i=r(1622);t.getScope=function(e){const t=(0,o.getEntityType)(e);if(t){const r=(0,o.getEntityIdentity)(e.node),s=r?.name;return{type:t,context:(0,i.getContextualData)(e),symbol:{name:s,sourcemap_location_hints:r?(0,n.getLocationList)(r,s):(0,n.getLocationList)(e.node,void 0),format:r?"%s":void 0},methodKind:(0,i.getMethodKind)(e.node)}}}},7582:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.nextLoopDummy=void 0;const r=`http://${process.env.AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension`;async function o(e){return await fetch(`${r}/event/next`,{method:"get",headers:{"Content-Type":"application/json","Lambda-Extension-Identifier":e}})}t.nextLoopDummy=async function(e){for(;;)try{(await o(e)).ok||await new Promise(e=>setTimeout(e,50))}catch(e){await new Promise(e=>setTimeout(e,50))}}},8066:(e,t)=>{let r;Object.defineProperty(t,"__esModule",{value:!0}),t.myRequire=void 0;try{r=require}catch(e){r=void 0}t.myRequire=r},8138:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getNetworkError=t.UserErrorLogs=t.setFirstError=t.getFirstError=t.isAbortError=t.HudNoMessageInSqsConsumerEmit=t.HudNoErrorInSqsConsumerEmit=t.HudNoEventTypeInSqsConsumerEmit=t.HudFailExtractSqsQueueName=t.HudNoCallbackInSqsConsumerOn=t.HudNoEventTypeInSqsConsumerOn=t.HudNoQueueUrlInSqsConsumer=t.HudSqsError=t.HudExtensionNextFailedError=t.HudExtensionRegisterError=t.HudExtnensionError=t.HudBadLoggerError=t.HudInitNetworkError=t.HudTsNodeNotFoundButUsed=t.HudSessionThrottle=t.HudNoTranspileOnlyError=t.HudClientExceededMaxRetries=t.HudClientUnauthorizedError=t.HudTimeoutError=t.HudWorkloadCollectorError=t.HudAssert=t.HudUnsupportedError=t.HudEditError=t.HudWorkerError=t.HudClientError=t.HudInitError=t.HudError=void 0;const o=r(1012);class n extends Error{code=9e3;name=this.constructor.name;constructor(e){super(e)}}t.HudError=n;class i extends n{code=9001}t.HudInitError=i,t.HudClientError=class extends n{code=9002;originalAxiosErrorCode;constructor(e,t){super(e),this.originalAxiosErrorCode=t}},t.HudWorkerError=class extends n{code=9003};class s extends n{code=9004}t.HudEditError=s,t.HudUnsupportedError=class extends s{code=9005},t.HudAssert=class extends s{code=9006},t.HudWorkloadCollectorError=class extends n{code=9007},t.HudTimeoutError=class extends n{code=9008},t.HudClientUnauthorizedError=class extends n{code=9009},t.HudClientExceededMaxRetries=class extends n{code=9010},t.HudNoTranspileOnlyError=class extends n{code=9011},t.HudSessionThrottle=class extends i{code=9012},t.HudTsNodeNotFoundButUsed=class extends n{code=9013},t.HudInitNetworkError=class extends n{code=9014;originalAxiosErrorCode;constructor(e,t){super(e),this.originalAxiosErrorCode=t}},t.HudBadLoggerError=class extends n{code=9101};class a extends n{code=9200}t.HudExtnensionError=a,t.HudExtensionRegisterError=class extends a{code=9201},t.HudExtensionNextFailedError=class extends a{code=9202};class l extends n{code=9250}t.HudSqsError=l,t.HudNoQueueUrlInSqsConsumer=class extends l{code=9251},t.HudNoEventTypeInSqsConsumerOn=class extends l{code=9252},t.HudNoCallbackInSqsConsumerOn=class extends l{code=9253},t.HudFailExtractSqsQueueName=class extends l{code=9254},t.HudNoEventTypeInSqsConsumerEmit=class extends l{code=9255},t.HudNoErrorInSqsConsumerEmit=class extends l{code=9256},t.HudNoMessageInSqsConsumerEmit=class extends l{code=9257},t.isAbortError=function(e){return e instanceof Error&&"AbortError"===e.name};let u=9999;t.getFirstError=function(){return u},t.setFirstError=function(e){e&&9999===u&&(u=e)},t.UserErrorLogs={HudServiceNotSet:()=>({level:"error",errCode:"E1001",moreInfo:!0,message:"Can't load Hud, HUD_SERVICE was not set. Please set service name using the environment variable HUD_SERVICE."}),HudServiceInvalid:()=>({level:"error",errCode:"E1002",moreInfo:!0,message:"Can't load Hud, HUD_SERVICE value has invalid service name. Please set service name using the environment variable HUD_SERVICE."}),HudApiKeyNotSet:()=>({level:"error",errCode:"E1004",moreInfo:!0,message:"Can't load Hud, HUD_KEY was not set. Please set API key using the environment variable HUD_KEY."}),HudApiKeyInvalid:()=>({level:"error",errCode:"E1005",moreInfo:!0,message:"Can't load Hud, HUD_KEY value has invalid API key. Please set a valid key in environment variable HUD_KEY."}),BothApiKeyAndServiceNotSet:()=>({level:"error",errCode:"E1007",moreInfo:!0,message:"Can't load Hud, HUD_KEY and HUD_SERVICE were not set. Please set API key using the environment variable HUD_KEY and service name using the environment variable HUD_SERVICE."}),InvalidTag:()=>({level:"warn",errCode:"E1008",moreInfo:!0,message:"HUD_TAGS should be of type Key-Value Object, defaulting to empty tags. Please set valid tags in environment variable HUD_TAGS."}),TagWithDots:()=>({level:"warn",errCode:"E1009",moreInfo:!0,message:"HUD_TAGS keys can't contain dots; they have been replaced with underscores."}),TagsInvalidJson:()=>({level:"warn",errCode:"E1010",moreInfo:!0,message:"Can't load Hud, HUD_TAGS is not a valid JSON, defaulting to empty tags. Please set valid tags in environment variable HUD_TAGS."}),ApiKeyDenied:e=>({level:"error",errCode:"E1011",moreInfo:!0,message:`Can't load Hud, the provided key is invalid. Please provide a valid HUD_KEY in your ${{ENV:"environment variable",CONFIG_FILE:"file",CONFIG_ENV:"HUD_CONFIG",INIT:"init function",SETUP:"setup function"}[e]}.`}),ShutdownGracefully:e=>({level:"error",errCode:`E${e}`,message:"SDK has initiated a graceful shutdown. Your application remains unaffected"}),UnsupportedNodeVersion:()=>({level:"error",errCode:"E1012",moreInfo:!0,message:"Can't load Hud due to an unsupported node version."}),UnsupportedSyntax:()=>({level:"error",errCode:"E1014",moreInfo:!0,message:"Can't load Hud due to an unsupported syntax version."}),UnsupportedLambdaMemory:()=>({level:"error",errCode:"E1015",moreInfo:!0,message:`Can't load Hud as lambda function memory size is less than ${o.hudConfig.lambdaMinimunMemory}MB.`}),JSONErrorInUserConfig:(e,t)=>({level:"error",errCode:"E1016",moreInfo:!0,message:`Can't load Hud, the config file contains an invalid JSON. Please set a valid json in Hud's config ${e}`+(t?`, Error: ${t}.`:".")}),ZodErrorInUserConfig:(e,t)=>({level:"error",errCode:"E1017",moreInfo:!0,message:`Can't load Hud, the config file contains an invalid value for field: ${t}. Please set a valid value for ${t} in the config ${e}.`}),ConfigInaccessible:e=>({level:"error",errCode:"E1018",moreInfo:!0,message:`Can't load Hud, the config file is inaccessible. Please make sure your node application has read permissions to the Hud config file, ${e}.`}),SetupCalledWithoutKey:()=>({level:"error",errCode:"E1019",moreInfo:!0,message:"API key not found or invalid. SDK has initiated a graceful shutdown. Your application remains unaffected."}),SetupCalledWithoutService:()=>({level:"error",errCode:"E1020",moreInfo:!0,message:"Service name parameter not found or invalid. SDK has initiated a graceful shutdown. Your application remains unaffected."}),HudEnableIsFalse:()=>({level:"warn",errCode:"E1021",moreInfo:!0,message:"HUD_ENABLE is set to false. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InstrumentedFunctionCountExceeded:e=>({level:"error",errCode:"E1022",moreInfo:!0,message:`SDK limit of ${e} instrumented functions exceeded. SDK has initiated a graceful shutdown. Your application remains unaffected.`}),PodMemoryLimitTooLow:e=>({level:"error",errCode:"E1023",moreInfo:!0,message:`Insufficient memory available. Minimum required:(${e}MB). SDK has initiated a graceful shutdown. Your application remains unaffected.`}),DebuggerAttached:()=>({level:"error",errCode:"E1024",message:"Did not load as debugger is attached."}),InitSessionBeforeRegister:()=>({level:"error",errCode:"E1025",moreInfo:!0,message:"register() was not called, or called after initSession() - please call register() before initSession() and run again. Your application continues normally without Hud."}),RegisterMisplacedNoDeclarations:()=>({level:"warn",errCode:"E1026",moreInfo:!0,message:"Warning - No code has been mapped so far. This probably means register() was called too late — after your code was already loaded. Move it to the top of your entry file to enable proper mapping. Your application continues normally without Hud data."}),UnsupportedFrameworkVersion:e=>({level:"warn",errCode:"E1029",message:`Warning - Unsupported version of ${e} framework(s). This means Hud won't track your framework invocations. Your application continues normally, but with partial Hud data. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node#/`}),UninstrumentedFilesLogThresholdExceeded:e=>({level:"warn",errCode:"E1027",message:`Warning - ${e} of your code files were imported before register(). This means Hud won't track all of your functions. Please move register() call to an earlier location. To view the list of files use register({verbose: true}). Your application continues normally, but with partial Hud data.`,moreInfo:!0}),UninstrumentedFrameworks:e=>({level:"warn",errCode:"E1028",message:`Warning - The framework(s): ${e.map(e=>`"${e}"`).join(", ")} was imported before register(). This means Hud won't track your framework invocations. Please move register() call to an earlier location. Your application continues normally, but with partial Hud data.`}),YesDeclarationsNoMetrics:()=>({level:"warn",errCode:"E1032",moreInfo:!0,message:"Warning - Code mapped successfully, but no function activity was tracked. Make sure your service is running and actively handling requests."}),HudEnableNotSet:e=>({level:"error",moreInfo:!0,message:`Did not load as HUD_ENABLE is ${void 0===e?"undefined":"set to a non-true value"}. Please set HUD_ENABLE=true to run Hud.`}),LambdaNotViaLayer:()=>({level:"error",errCode:"E1034",message:"Can't load Hud, lambda support is currently in beta. Contact Hud to get early access."}),RunningInBun:()=>({level:"error",errCode:"E1035",message:"Hud does not support Bun yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),RunningOnWindows:()=>({level:"error",errCode:"E1036",message:"Hud does not support Windows yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),UnsupportedNativeBuild:()=>({level:"error",errCode:"E1037",message:"Hud does not support this platform yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),TsNodeNotTranspileOnly:()=>({level:"error",errCode:"E1038",message:"detected ts-node is used without the transpileOnly flag, which is not supported yet. SDK has initiated a graceful shutdown. Your application remains unaffected.",moreInfo:!0}),TsNodeNotFoundEvenThoughRunWithTsNode:()=>({level:"error",errCode:"E1039",message:"'ts-node' was detected but could not be resolved by Hud. This may happen if 'ts-node' is installed globally. Try installing it locally in your project. The SDK has initiated a graceful shutdown. Your application remains unaffected.",moreInfo:!0}),InitFailedDueGenericNetworkError:()=>({level:"error",moreInfo:!0,errCode:"E1040",message:"A network error occurred during SDK initialization. Please check your internet connection and try again. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueNetworkTimeout:()=>({level:"error",moreInfo:!0,errCode:"E1041",message:"The SDK failed to connect to Hud's backend due to a timeout during SDK initialization. Please verify your firewall settings to ensure outbound connections are allowed. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueNetworkRST:()=>({level:"error",moreInfo:!0,errCode:"E1042",message:"The SDK connection to Hud's backend was reset unexpectedly (RST) during SDK initialization. Please check your firewall or network security settings. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueSelfSignedCert:()=>({level:"error",moreInfo:!0,errCode:"E1043",message:"SSL certificate verification failed during SDK initialization. If your organization uses a self-signed certificate, set the NODE_EXTRA_CA_CERTS environment variable to the path of your CA certificate file. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueDnsFailed:()=>({level:"error",moreInfo:!0,errCode:"E1044",message:"The SDK failed to resolve DNS when attempting to connect to Hud's backend during SDK initialization. If the problem persists, please contact support. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueBackendError:()=>({level:"error",moreInfo:!0,errCode:"E1045",message:"Hud: The SDK was unable to complete initialization due to a temporary issue with Hud’s backend. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitTimeout:e=>({moreInfo:!0,level:"error",message:`SDK imported but not initialized. Please ensure to call '${e?"hud.initSession(KEY, SERVICE)":"hud.init()"}' to initialize the SDK.`}),RehookCalledBeforeRegister:()=>({level:"error",errCode:"E1046",moreInfo:!0,message:"register() was not called, or called after rehook() - please call register() before rehook() and run again. Your application continues normally with partial hud data."}),EsbuildMissingKey:()=>({level:"error",errCode:"ES0001",moreInfo:!0,message:"missing HUD_KEY, skipping Hud plugin, your build is unaffected."}),EsbuildFailedProcessingFile:e=>({level:"error",errCode:"ES0002",moreInfo:!0,message:`failed processing file "${e}", reverting to original loader.`}),EsbuildFailedBundling:()=>({level:"error",errCode:"ES0003",moreInfo:!0,message:"encountered unexpected file bundling, build aborted."}),EsbuildFailedParsingSourcemap:()=>({level:"error",errCode:"ES0004",moreInfo:!0,message:"failed parsing source maps, skipping upload, Hud will run without source maps."}),EsbuildFailedUploadingSourcemap:e=>({level:"error",errCode:"ES0005",moreInfo:!0,message:`failed uploading source map: ${e}, Hud will run without source maps.`}),EsbuildFailedUploadingSourcemapUnauthorized:()=>({level:"error",errCode:"ES0006",moreInfo:!0,message:"failed uploading source map: unauthorized, Hud will run without source maps."}),EsbuildUnsupportedPlatform:()=>({level:"error",errCode:"ES0007",message:'Can\'t load Hud, as our esbuild plugin supports "node" mode only. Your app remains unaffected. For more information visit docs.hud.io/docs/support-matrix'}),EsbuildUnsupportedWindows:()=>({level:"error",errCode:"ES0008",message:"Can't load Hud, as our esbuild plugin does not supports windows. Your app remains unaffected. For more information visit docs.hud.io/docs/support-matrix"})},t.getNetworkError=function(e){return{ECONNABORTED:t.UserErrorLogs.InitFailedDueNetworkTimeout(),ECONNREFUSED:t.UserErrorLogs.InitFailedDueNetworkRST(),ENOTFOUND:t.UserErrorLogs.InitFailedDueDnsFailed(),SELF_SIGNED_CERT_IN_CHAIN:t.UserErrorLogs.InitFailedDueSelfSignedCert(),ERR_BAD_RESPONSE:t.UserErrorLogs.InitFailedDueBackendError()}[e]??t.UserErrorLogs.InitFailedDueGenericNetworkError()}},8287:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(6827),t)},8528:e=>{e.exports=require("./dto")},8808:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateSqsFlowId=t.generateKafkaFlowId=t.generateGraphqlFlowId=t.generateEndpointFlowId=void 0;const o=r(3903),n="fa79d8b7-069c-4bbf-9c00-34bfc8b3a5a6";t.generateEndpointFlowId=function(e,t){return(0,o.v5)(`${e.toString()}|${Array.from(t).sort().join(",")}`,n)},t.generateGraphqlFlowId=function(e,t){return(0,o.v5)(`${e}|${t}`,n)},t.generateKafkaFlowId=function(e,t,r){return(0,o.v5)(`${e.toString()}|${t}|${r}`,n)},t.generateSqsFlowId=function(e,t,r=""){const i=`${e}|${t}|${r}`;return(0,o.v5)(i,n)}},8809:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_MODULE_NAME=void 0,t.SDK_MODULE_NAME="hud-sdk"},9023:e=>{e.exports=require("util")},9100:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.updateInvestigationRateLimitGlobals=t.hudConfig=t.isValidParam=t.getModulesToTraceFromEnv=t.HudDynamicConfigSchema=void 0;const n=o(r(6928)),i=r(1569);t.HudDynamicConfigSchema=i.z.object({aggregationInterval:i.z.number(),flowMetricInterval:i.z.number(),graphqlInterval:i.z.number(),aggregationFirstSendTimeout:i.z.number(),flowMetricFirstSendTimeout:i.z.number(),enableInvestigation:i.z.boolean(),investigationRateLimits:i.z.object({maxSameInvestigations:i.z.number().int().positive(),sameInvestigationTimeWindowMs:i.z.number().int().positive(),maxTotalInvestigations:i.z.number().int().positive(),totalInvestigationTimeWindowMs:i.z.number().int().positive(),maxUniqLogs:i.z.number().int().positive()}),machineMetricsInterval:i.z.number().int().positive(),blacklistParams:i.z.array(i.z.string()),censorshipRegexes:i.z.array(i.z.object({regex:i.z.string(),replacement:i.z.string()}))}),t.getModulesToTraceFromEnv=function(){const e=process.env.HUD_MONITOR_MODULES||process.env.HUD_INCLUDE_MODULES;if(e)return e.split(",")},t.isValidParam=function(e){return null!=e&&""!==e&&"string"==typeof e};const s=process.env.HUD_ENABLE_INVESTIGATION,a=process.env.HUD_HOST||"https://api-prod.hud.io",l=process.env.HUD_LOG_DIR,u="_HUD",c=process.env.HUD_LOG_TO_FILE,d={sink:{url:a,timeout:5e3,session_attr:"X-Session-ID"},endpoints:{init:"sink/init",send:"sink/send",batch:"sink/batch",logs:"sink/logs",fatalError:"sink/redline",getMode:"sink/getMode",getRemoteConfig:"sink/remote-config/get",fileDeclarations:"sink/file-declarations",sourceMap:"sink/sourcemap",storeObject:"sink/objects/store"},logger:{default:{levels:{app:"warn",worker:"warn",instrument:"warn"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},investigation:{objectVersion:"1.0.1",store:{type:"s3"},limits:{executionFlowMaxLength:100,exceptionMaxLength:100},maxStringLength:1024,maxArrayLength:100,maxObjectDepth:10},userConfig:{minPodMemoryMB:{value:250,source:"DEFAULT"},maxMappedFunctions:{value:5e4,source:"DEFAULT"},maxFileSizeBytes:{value:2831155,source:"DEFAULT"},maxTimeUntilInitSessionMs:{value:3e4,source:"DEFAULT"},includeModules:{value:[],source:"DEFAULT"}},loggerWorkerPortSizeLimit:1e4,customerLoggerLevel:"info",logDirectory:l,invocationSampling:new Map([[[300n,null],100],[[200n,300n],50],[[100n,200n],25],[[0n,100n],10]]),callerResetInterval:36e5,modeInterval:3e5,logsSendInterval:6e4,logPerfInterval:3e5,endpointsInterval:18e5,endpointsFirstSendWaitTime:12e4,huddBinWidth:1.2,workerGrace:6e4,workerTimeout:2e4,timeoutOnRegister:6e4,timeoutOnMetrics:6e4,workerMessageTimeout:1e4,communicationBatchSize:100,writePatched:!1,defaultOff:!0,disableOnBadApiKey:!0,disableOnBadServiceName:!0,cpuTimeCollection:!1,workloadMetadata:{sendInterval:3e5,aws:{imds:{baseURL:"http://169.254.169.254/latest",tokenURI:"/api/token",identityURI:"/dynamic/instance-identity/document",lifeCycleURI:"/meta-data/instance-life-cycle",requestTimeout:5e3},metadataFile:"/run/cloud-init/instance-data.json"},kubernetes:{namespaceFile:"/var/run/secrets/kubernetes.io/serviceaccount/namespace",uuidFile:"/sys/class/dmi/id/product_uuid",podMemoryLimitFile:"/sys/fs/cgroup/memory/memory.stat",podCPULimitFile:"/sys/fs/cgroup/cpuacct/cpu.shares"}},deleteLogsAfterSending:!0,supportSourceMap:!0,editInline:!0,bundlerBuildIdVarName:"hudFileBuildID",bundlerBuildUuidNamespace:"00c1e90b-af75-4d8e-9935-68485877f759",functionUuidNamespace:"94a210f3-861c-4e18-ab27-6b6c19437c9d",wrapVarPrefix:u,functionIdVarName:`${u}_fid`,frameworksToPatch:new Map([["express",{version:"<=5",patcher:"express",enableEsbuild:!0}],[n.default.join("express","lib","application.js"),{version:"<=5",patcher:"expressApplication",enableEsbuild:!0}],["router",{version:"^2.0.0",patcher:"router",enableEsbuild:!0}],["koa",{version:"^2.0.0",patcher:"koa"}],["http",{version:"*",patcher:"http"}],["https",{version:"*",patcher:"http"}],["@nestjs/core/interceptors/interceptors-consumer",{version:"*",patcher:"nestjsInterceptor"}],["@nestjs/core/router/router-execution-context",{version:"*",patcher:"nestjsRouterExecutionContext"}],..."win32"!==process.platform?[["kafkajs",{version:">=1.4.0",patcher:"kafkajs"}],["@nestjs/microservices/context/rpc-context-creator",{version:">=7.0.0",patcher:"nestjsRpcContextCreator"}]]:[],[["@codegenie/serverless-express","src","frameworks","express.js"].join(n.default.sep),{version:"^4.1.0",patcher:"codeGenieServerlessExpress",enableEsbuild:!0}],["@codegenie/serverless-express",{enableEsbuild:!0}],["sqs-consumer",{version:"*",patcher:"sqsConsumer",extraInfo:{mondayVersion:">=6.1.0",bbcVersion:">=7.5.0"}}],["serverless-http",{enableEsbuild:!0}],[n.default.join("serverless-http","lib","framework","get-framework.js"),{version:"^2.7.0",patcher:"serverlessHttp",enableEsbuild:!0}]]),communicationKeepalive:!1,communicationKeepaliveGrace:5e3,express:{routeNamesSymbol:Symbol.for("hudRoutes"),layerStateSymbol:Symbol.for("hudState"),markedSymbol:Symbol.for("hudMarked"),wrapAllCallbacks:!0},supportedNodeVersions:["18","20","21","22","24"],hudPatchedName:"hudPatched",metricSymbol:Symbol.for("hudMetric"),dynamicConfig:{aggregationInterval:3e5,flowMetricInterval:3e5,graphqlInterval:3e4,aggregationFirstSendTimeout:3e4,flowMetricFirstSendTimeout:3e4,enableInvestigation:"true"===s,investigationRateLimits:{maxSameInvestigations:2,sameInvestigationTimeWindowMs:36e5,maxTotalInvestigations:25,totalInvestigationTimeWindowMs:216e5,maxUniqLogs:2},machineMetricsInterval:1e4,blacklistParams:[],censorshipRegexes:[]},machineMetricsSavedLength:2,isInvestigationEnabledByEnv:void 0!==s,suppressTraces:!0,lambdaMinimunMemory:1024,lambdaBaseGivenTime:400,lambdaExtraGivenTimePerRequest:50,lambdaMaxGivenTime:700,throttleStatusCode:202,esbuildGlobalVar:"hudSGV",esbuildPluginMessagePrefix:"ESBuild plugin ",esbuildMark:"/*modifiedByHudESBuildPlugin-",esbuildMarkLength:67,esbuildUploadSourceMapTimeout:15e3,esbuildPluginLogsChunkSize:100,esbuildPluginLogsBatchSize:10,pluginsLogEndpoint:"https://yqp37dddrsewm6wdwwpwfraxqm0shdmx.lambda-url.eu-central-1.on.aws/",fileless:"true"!==c,uninstrumentedFilesLogThreshold:2,tsNodeConfigTimeout:1e4,allowedEditExtensions:[".ts",".cts",".mts",".js",".cjs",".mjs"]};t.hudConfig=function(e={}){return{...d,...e}}({logger:{default:{levels:{app:"info",worker:"info",instrument:"info"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},deleteLogsAfterSending:!1,communicationKeepalive:!0}),t.default=t.hudConfig,t.updateInvestigationRateLimitGlobals=function(){globalThis.hudMaxSameInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations,globalThis.hudMaxTotalInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations,globalThis.hudSameInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.sameInvestigationTimeWindowMs)*BigInt(1e6),globalThis.hudTotalInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.totalInvestigationTimeWindowMs)*BigInt(1e6)}},9896:e=>{e.exports=require("fs")}},t={};return function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(2241)})());
2
2
  //# sourceMappingURL=lib.js.map
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(global,()=>(()=>{"use strict";var e={363:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateUserConfigFromInitOptions=t.updateUserConfigFromEnv=t.updateUserConfigFromFile=t.updateUserConfigFromInit=void 0;const o=r(8528),n=r(1569),i=r(8138),s=r(2794),a=r(3073),l=r(9100),u=o.HudInitOptionsSchema.omit({customOptions:!0}).extend({key:n.z.string().optional(),service:n.z.string().optional(),enable:n.z.boolean().optional(),enableDapulse:n.z.boolean().optional()});t.updateUserConfigFromInit=function(e,t){void 0!==e&&(l.hudConfig.userConfig.key={value:e,source:"INIT"}),void 0!==t&&(l.hudConfig.userConfig.service={value:t,source:"INIT"})},t.updateUserConfigFromFile=function(){let e;try{e=(0,s.getConfigContent)()}catch(e){throw e instanceof s.HudFailedReadConfigError&&"EACCES"===e.code&&a.customer_logger.log(i.UserErrorLogs.ConfigInaccessible(e.path)),e}if(e)try{const t=u.partial().parse(JSON.parse(e.content));Object.entries(t).forEach(([t,r])=>{!function(e,t,r){e[t]=r}(l.hudConfig.userConfig,t,{value:r,source:"HUD_CONFIG"===e.source?"CONFIG_ENV":"CONFIG_FILE"})})}catch(t){throw t instanceof n.ZodError?t.errors.forEach(t=>{const r=t.path.join(".");a.customer_logger.log(i.UserErrorLogs.ZodErrorInUserConfig(e.source,r))}):a.customer_logger.log(i.UserErrorLogs.JSONErrorInUserConfig(e.source,t.message)),t}},t.updateUserConfigFromEnv=function(){const e=process.env.HUD_KEY,t=process.env.HUD_SERVICE,r=process.env.HUD_ENABLE_DAPULSE,o=(0,l.getModulesToTraceFromEnv)(),n=process.env.HUD_MAX_INSTRUMENTED_FUNCTIONS,i=process.env.HUD_MIN_POD_MEMORY_MB;e&&(l.hudConfig.userConfig.key={value:e,source:"ENV"}),t&&(l.hudConfig.userConfig.service={value:t,source:"ENV"}),r&&(l.hudConfig.userConfig.enableDapulse={value:"true"===r,source:"ENV"}),o&&(l.hudConfig.userConfig.includeModules={value:o,source:"ENV"}),n&&(l.hudConfig.userConfig.maxMappedFunctions={value:parseInt(n),source:"ENV"}),i&&(l.hudConfig.userConfig.minPodMemoryMB={value:parseInt(i),source:"ENV"})},t.updateUserConfigFromInitOptions=function(e,t){e.includeModules&&Array.isArray(e.includeModules)&&(l.hudConfig.userConfig.includeModules={value:e.includeModules,source:t}),e.customOptions&&e.customOptions.dapulseSqsConsumer&&(l.hudConfig.userConfig.enableDapulse={value:"true"===e.customOptions.dapulseSqsConsumer,source:t}),e.maxMappedFunctions&&"number"==typeof e.maxMappedFunctions&&(l.hudConfig.userConfig.maxMappedFunctions={value:e.maxMappedFunctions,source:t}),e.minPodMemoryMB&&"number"==typeof e.minPodMemoryMB&&(l.hudConfig.userConfig.minPodMemoryMB={value:e.minPodMemoryMB,source:t}),e.maxFileSizeBytes&&"number"==typeof e.maxFileSizeBytes&&(l.hudConfig.userConfig.maxFileSizeBytes={value:e.maxFileSizeBytes,source:t}),e.maxTimeUntilInitSessionMs&&"number"==typeof e.maxTimeUntilInitSessionMs&&(l.hudConfig.userConfig.maxTimeUntilInitSessionMs={value:e.maxTimeUntilInitSessionMs,source:t})}},669:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UserLogs=void 0,t.UserLogs={HudInitSuccess:()=>({level:"info",message:"Session started"}),FirstDecalarationSent:()=>({level:"info",message:"First code mapping sent successfully"}),FirstInvocationSent:()=>({level:"info",message:"First invocation sent successfully"}),HappyFlowCompleted:()=>({level:"info",message:"Your service is sending data successfully"}),FilesLoadedBeforeRegister:()=>({level:"info",message:"Files loaded before register():"}),FileBeforeRegisterTemplate:(e,t)=>({level:"info",message:`${e}. ${t}`}),InitIdleMode:()=>({level:"info",message:"Initialized successfully in idle mode."})}},857:e=>{e.exports=require("os")},1012:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=t.SDK_MODULE_NAME=void 0,n(r(9100),t),n(r(4627),t);var i=r(8809);Object.defineProperty(t,"SDK_MODULE_NAME",{enumerable:!0,get:function(){return i.SDK_MODULE_NAME}}),n(r(2684),t),n(r(363),t);var s=r(3312);Object.defineProperty(t,"SDK_VERSION",{enumerable:!0,get:function(){return s.SDK_VERSION}})},1256:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.logRegisterInRightLocation=t.filterFilesInsideFrameworks=void 0;const o=r(2030),n=r(2241);function i(e,t){return t.filter(t=>{if(t.endsWith(".js"))return!1;const r=`/node_modules/${t}/`;for(const t of e)if(t.includes(r))return!0;return!1})}t.filterFilesInsideFrameworks=i,t.logRegisterInRightLocation=function(e){try{!function(e){const t=globalThis.hudLoadedModules;if(!t)return;const r=t.filter(e=>!(0,o.skip)(e));if(r.length>n.hudConfig.uninstrumentedFilesLogThreshold&&n.customer_logger.log(n.UserErrorLogs.UninstrumentedFilesLogThresholdExceeded(r.length)),e){n.instrument_logger.info("Files loaded before register()",{count:r.length}),n.customer_logger.info(n.UserLogs.FilesLoadedBeforeRegister());let e=0;for(const t of r)n.customer_logger.info(n.UserLogs.FileBeforeRegisterTemplate(e,t)),e++}}(e)}catch(e){n.instrument_logger.error("Error in logRegisterInRightLocation",{error:e,stack:e instanceof Error?e.stack:void 0})}try{!function(){const e=globalThis.hudLoadedModules;if(!e)return;const t=i(e,Array.from(n.hudConfig.frameworksToPatch.keys()));t.length>0&&(n.instrument_logger.info("Missing frameworks",{count:t.length}),n.customer_logger.log(n.UserErrorLogs.UninstrumentedFrameworks(t)))}()}catch(e){n.instrument_logger.error("Error in logPreLoadedFrameworks",{error:e,stack:e instanceof Error?e.stack:void 0})}}},1493:e=>{e.exports=require("v8")},1569:e=>{e.exports=require("zod")},1620:e=>{e.exports=require("winston-transport")},1622:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodKind=t.getContextualData=t.getContextSymbol=t.getFunctionIdentifier=void 0;const s=i(r(6346)),a=r(6346),l=r(8528),u=r(8138),c=r(3073),d=r(2213),p=r(1974);function m(e,t){return{name:t,sourcemap_location_hints:(0,p.getLocationList)(e,t),format:"%s"}}function f(e){if(a.types.isIdentifier(e))return{name:e.name,sourcemap_location_hints:e.loc?[{name:e.name,line:e.loc.start.line,column:e.loc.start.column,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column}]:[],format:"%s"};if(a.types.isMemberExpression(e)||a.types.isOptionalMemberExpression(e)){let t;t=a.types.isThisExpression(e.object)?{name:"this",sourcemap_location_hints:(0,p.getLocationList)(e.object,"this")}:f(e.object);const r=f(e.property),o=e.computed?t.name+"["+r.name+"]":t.name+"."+r.name,n=t.format??"%s",i=r.format??"%s",s=e.computed?`${n}[${i}]`:`${n}.${i}`;return{name:o,sourcemap_location_hints:[...t.sourcemap_location_hints,...r.sourcemap_location_hints],format:s}}if(a.types.isOptionalCallExpression(e)||a.types.isCallExpression(e))return f(e.callee);if(a.types.isSequenceExpression(e))return(0,d.isHudAwaitSequence)(e)?f((0,d.getHudAwaitSequenceElement)(e)):f(e.expressions[e.expressions.length-1]);if(a.types.isArrayExpression(e))return{name:"[]",sourcemap_location_hints:(0,p.getLocationList)(e,"[]"),format:"%s"};if(a.types.isObjectExpression(e))return{name:"{}",sourcemap_location_hints:(0,p.getLocationList)(e,"{}"),format:"%s"};if(a.types.isStringLiteral(e))return{name:`"${e.value}"`,sourcemap_location_hints:(0,p.getLocationList)(e,e.value),format:'"%s"'};throw new u.HudUnsupportedError("Unsupported left side of assignment - "+e.type+"loc - "+JSON.stringify(e.loc))}function g(e){const{node:t}=e;if(e.isExpression())try{return function(e){const{parent:t}=e;if(a.types.isVariableDeclarator(t)&&a.types.isIdentifier(t.id))return m(t,t.id.name);if(a.types.isObjectProperty(t)&&a.types.isIdentifier(t.key))return m(t,t.key.name);if(a.types.isClassProperty(t)&&a.types.isIdentifier(t.key))return m(t,t.key.name);if(a.types.isAssignmentExpression(t))return f(t.left);if(a.types.isAssignmentPattern(t))return f(t.left);throw new u.HudUnsupportedError(`Unsupported parent type - ${t.type} for me ${e.node.type}`)}(e)}catch(e){if(e instanceof u.HudUnsupportedError)return;throw e}c.worker_logger.debug("getContextSymbol; Unsupported node type",{type:t.type})}function y(e){const t=[];return e.arguments.forEach((e,r)=>{let o,n;a.types.isStringLiteral(e)?(o=l.ArgumentTypes.StringLiteral,n=e.value):a.types.isTemplateLiteral(e)?(o=l.ArgumentTypes.TemplateString,n=function(e){let t="";const r=e.quasis,o=e.expressions;for(let e=0;e<r.length;e++)t+=r[e].value.cooked,e<o.length&&(t+=`\${${h(o[e])}}`);return t=`\`${t}\``,t}(e)):a.types.isIdentifier(e)&&(o=l.ArgumentTypes.Identifier,n=e.name),o&&n&&t.push({index:r,type:o,value:n})}),t}function h(e){if(a.types.isIdentifier(e))return e.name;if(a.types.isStringLiteral(e))return e.value;if(a.types.isCallExpression(e)||a.types.isOptionalCallExpression(e)){const t=e;if(a.types.isIdentifier(t.callee))return t.callee.name;if(a.types.isMemberExpression(t.callee)||a.types.isOptionalMemberExpression(t.callee)){let e="";const r=t.callee;if(a.types.isThisExpression(r.object)?e+="this.":a.types.isIdentifier(r.object)&&(e+=`${r.object.name}.`),""!==e&&a.types.isIdentifier(r.property))return e+=`${r.property.name}`,e}}return""}t.getFunctionIdentifier=function(e){const{node:t}=e;if(a.types.isFunctionDeclaration(t)||a.types.isFunctionExpression(t)){if(a.types.isIdentifier(t.id))return t.id}else if(a.types.isClassMethod(t)){if(a.types.isIdentifier(t.key))return t.key}else if(a.types.isClassPrivateMethod(t)){if(a.types.isIdentifier(t.key.id))return t.key.id}else if(a.types.isObjectMethod(t)&&a.types.isIdentifier(t.key))return t.key},t.getContextSymbol=g,t.getContextualData=function(e){let t,r=!1;return(e.isFunctionExpression()||e.isArrowFunctionExpression())&&(t=function(e){const t=e.parentPath;if(t.isCallExpression())for(const[r,o]of t.node.arguments.entries())if(o===e.node){const e=t.node.callee;let o;try{o=f(e)}catch(t){if(!(t instanceof u.HudUnsupportedError))throw t;c.worker_logger.debug("could not get callee symbol recursively",{error:t,type:e.type})}const n=y(t.node);return{callee:{symbol:o,argsCount:t.node.arguments.length,args:n},index:r}}}(e),r=function(e){const t=e.parentPath;return!!t.isCallExpression()&&t.node.callee===e.node}(e)),{symbol:g(e),callback:t,immediatelyInvoked:r}},t.getMethodKind=function(e){if(s.types.isClassMethod(e)||s.types.isObjectMethod(e)||s.types.isClassPrivateMethod(e))return e.kind}},1974:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getNodeLocation=t.resolveScopeSymbols=t.resolveSymbol=t.getLocationList=void 0;const n=o(r(9023)),i=r(3073);function s(e,t){let r=t.name;const o=t.sourcemap_location_hints.map(t=>{const r=e({line:t.line,column:t.column});if(null===r.line||null===r.column)return{name:t.name,line:-1,column:-1,line_on_server:t.line_on_server,column_on_server:t.column_on_server};let o=r.name??t.name??void 0;return o?.startsWith("#")&&(o=o.slice(1)),{name:o,line:r.line,column:r.column,line_on_server:t.line_on_server,column_on_server:t.column_on_server,resolved:!0}});return o.length>0&&o.every(e=>e.name)&&(t.format?Array.from(t.format.matchAll(/%s/g)).length!==o.length?i.worker_logger.warn("Format string does not match number of location hints",{format:t.format,locationHints:o}):r=n.default.format(t.format,...o.map(e=>e.name)):r=o.map(e=>e.name).join(".")),{name:r,sourcemap_location_hints:o}}t.getLocationList=function(e,t){return e.loc?[{line:e.loc.start.line,column:e.loc.start.column,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column,name:t}]:[]},t.resolveSymbol=s,t.resolveScopeSymbols=function(e,t){const{context:r}=t,o=r.symbol?s(e,r.symbol):void 0,n=s(e,t.symbol);return{...t,context:{...r,symbol:o},symbol:n}},t.getNodeLocation=function(e,t,r=void 0){const o=e.loc?.start,n=e.loc?.end;if(!o||!n)return i.worker_logger.info("Node without location",{filename:r,type:e.type}),{start:{source:null,line:-1,column:-1},end:{source:null,line:-1,column:-1}};const s=t({line:o.line,column:o.column}),a=t({line:n.line,column:n.column});return null!==s.line&&null!==s.column&&null!==a.line&&null!==a.column||(i.worker_logger.debug("Could not find location for function",{filename:r,type:e.type,locStart:o,locEnd:n}),s.line=-1,s.column=-1,a.line=-1,a.column=-1),{start:{source:s.source,line:s.line,column:s.column},end:{source:a.source,line:a.line,column:a.column}}}},2030:e=>{e.exports=require("./instrument")},2213:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getHudAwaitSequenceElement=t.isHudAwaitSequence=void 0;const o=r(6346),n=r(1012),i=r(8138);t.isHudAwaitSequence=function(e){if(e.expressions.length<2)return!1;const t=e.expressions[e.expressions.length-1];return!!o.types.isIdentifier(t)&&!!t.name.startsWith(n.hudConfig.wrapVarPrefix)},t.getHudAwaitSequenceElement=function(e){const t=e.expressions[0];if(!o.types.isAssignmentExpression(t))throw new i.HudUnsupportedError("Expected assignment expression");const{left:r,right:s}=t;if(!o.types.isIdentifier(r)||!r.name.startsWith(n.hudConfig.wrapVarPrefix))throw new i.HudUnsupportedError("Expected identifier starting with "+n.hudConfig.wrapVarPrefix);return s}},2240:e=>{e.exports=require("./core")},2241:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1012),t),n(r(8287),t),n(r(8138),t),n(r(8808),t),n(r(2794),t),n(r(7582),t),n(r(3073),t),n(r(5290),t),n(r(5822),t),n(r(3699),t),n(r(4219),t),n(r(4451),t),n(r(2908),t),n(r(2451),t),n(r(3431),t),n(r(669),t),n(r(8066),t)},2298:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNamespaceScopeable=t.isHudScopeable=t.NamespaceScopeAlias=t.ScopableAlias=void 0;const o=r(6346);t.ScopableAlias="ArrowFunctionExpression|BlockStatement|CatchClause|ClassMethod|ClassPrivateMethod|DeclareModule|DoExpression|DoWhileStatement|ForInStatement|ForOfStatement|ForStatement|FunctionDeclaration|FunctionExpression|IfStatement|LabeledStatement|ObjectMethod|StaticBlock|SwitchCase|TSModuleBlock|TryStatement|WhileStatement|WithStatement|ClassDeclaration|ClassExpression|ObjectExpression|SwitchStatement",t.NamespaceScopeAlias="FunctionDeclaration|FunctionExpression|ArrowFunctionExpression|ObjectMethod|ClassMethod|ClassPrivateMethod|ClassDeclaration|ClassExpression|ObjectExpression",t.isHudScopeable=function(e){return o.types.isArrowFunctionExpression(e)||o.types.isBlockStatement(e)||o.types.isCatchClause(e)||o.types.isClassMethod(e)||o.types.isClassPrivateMethod(e)||o.types.isDeclareModule(e)||o.types.isDoExpression(e)||o.types.isDoWhileStatement(e)||o.types.isForInStatement(e)||o.types.isForOfStatement(e)||o.types.isForStatement(e)||o.types.isFunctionDeclaration(e)||o.types.isFunctionExpression(e)||o.types.isIfStatement(e)||o.types.isLabeledStatement(e)||o.types.isObjectMethod(e)||o.types.isProgram(e)||o.types.isStaticBlock(e)||o.types.isSwitchCase(e)||o.types.isTSModuleBlock(e)||o.types.isTryStatement(e)||o.types.isWhileStatement(e)||o.types.isWithStatement(e)||o.types.isClassDeclaration(e)||o.types.isClassExpression(e)||o.types.isObjectExpression(e)||o.types.isSwitchStatement(e)},t.isNamespaceScopeable=function(e){return o.types.isFunction(e)||o.types.isClass(e)||o.types.isObjectExpression(e)}},2451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUserTsNodeConfig=void 0;const o=r(8138),n=r(3073),i=r(8066);t.getUserTsNodeConfig=function(e=!0){const t=function(){try{const e=i.myRequire.resolve("ts-node");if(!e)return;if(!i.myRequire.cache[e])return;const t=(0,i.myRequire)("ts-node"),r=process[t.REGISTER_INSTANCE];if(!r)return;return r.options}catch(e){return}}();if(t){if(!t.transpileOnly)throw e&&n.customer_logger.log(o.UserErrorLogs.TsNodeNotTranspileOnly()),n.app_logger.warn("ts-node is used but not configured to transpile only"),new o.HudNoTranspileOnlyError;return{cwd:t.cwd,project:t.project,projectSearchDir:t.projectSearchDir}}if(process.argv[0].endsWith("ts-node"))throw e&&n.customer_logger.log(o.UserErrorLogs.TsNodeNotFoundEvenThoughRunWithTsNode()),n.app_logger.info("ts-node not found even run with ts-node"),new o.HudTsNodeNotFoundButUsed}},2546:e=>{e.exports=require("./lib")},2684:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectStoreConfigSchema=void 0;const o=r(1569),n=o.z.object({type:o.z.literal("s3")}),i=o.z.object({type:o.z.literal("disk"),path:o.z.string()});t.ObjectStoreConfigSchema=o.z.union([n,i])},2784:e=>{e.exports=require("../native/_index")},2794:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getConfigContent=t.HudFailedReadConfigError=t.isHudEnabled=void 0;const s=i(r(9896)),a=i(r(6928)),l=r(8138),u=r(3073);t.isHudEnabled=function(){if("false"===process.env.HUD_ENABLE)return!1;if(globalThis.forceHudEnable)return!0;let e,t;try{if(e=d(),e&&(t=JSON.parse(e.content),!1===t.enable))return!1}catch(t){throw t instanceof c&&"EACCES"===t.code?u.customer_logger.log(l.UserErrorLogs.ConfigInaccessible(t.path)):e&&u.customer_logger.log(l.UserErrorLogs.JSONErrorInUserConfig(e.source,t instanceof Error?t.message:void 0)),t}return"true"===process.env.HUD_ENABLE||!0===t?.enable};class c extends Error{path;code;constructor(e,t){super(),this.path=e,this.code=t}}function d(){if(process.env.HUD_CONFIG)return{content:process.env.HUD_CONFIG,source:"HUD_CONFIG"};const e=function(){try{const e=process.env.HUD_CONFIG_PATH;if(e)return s.existsSync(e)?e:void 0;let t=__dirname,r=0;for(;"/"!==t&&r<10;){const e=`${t}/hud.config`;if(s.existsSync(e))return e;t=a.dirname(t),r++}}catch(e){return}}();if(e)try{return{content:s.readFileSync(e,"utf8"),source:e}}catch(t){throw new c(e,t.code)}}t.HudFailedReadConfigError=c,t.getConfigContent=d},2908:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.suppressTraces=void 0;const o=r(1012),n=r(3073),i=r(8066);let s,a;try{const e=(0,i.myRequire)("@opentelemetry/api"),t=(0,i.myRequire)("@opentelemetry/core");s=e.context,a=t.suppressTracing,n.app_logger.info("OpenTelemetry exists",{suppressConfig:o.hudConfig.suppressTraces})}catch(e){n.app_logger.info("OpenTelemetry api/core does not exist")}t.suppressTraces=function(e){return function(...t){return o.hudConfig.suppressTraces&&s&&a?(n.app_logger.debug("Running with Suppressed traces"),s.with(a(s.active()),()=>e(...t))):e(...t)}}},2987:e=>{e.exports=require("perf_hooks")},3073:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.worker_logger=t.instrument_logger=t.app_logger=t.customer_logger=t.formatLogMessage=t.SafeLogger=t.renewFileTransports=t.getSavedLogs=t.getLogPath=t.WorkerPortTransport=void 0;const a=i(r(6982)),l=i(r(9896)),u=i(r(857)),c=i(r(6928)),d=i(r(5124)),p=s(r(1620)),m=r(9100),f={...process.env.HUD_DEBUG?m.hudConfig.logger.debug:m.hudConfig.logger.default,console:!!process.env.HUD_VERBOSE};class g extends p.default{_messeagesToSend=[];messagesLimit=m.hudConfig.loggerWorkerPortSizeLimit;messageDropCount=0;getMessagesToSend(){if(!this._messeagesToSend.length)return!1;const e=this._messeagesToSend;this.clearMessagesToSend();const t=this.messageDropCount;return this.messageDropCount=0,{logsBuf:this.formatMessagesToSend(e),messageDropCount:t}}clearMessagesToSend(){this._messeagesToSend=[]}formatMessagesToSend(e){return e.map(e=>JSON.stringify(e)).join("\n")}log(e,t){this._messeagesToSend.length>=this.messagesLimit?this.messageDropCount++:this._messeagesToSend.push(e),t()}}t.WorkerPortTransport=g;const y=d.format.combine(d.format.timestamp({format:"HH:mm:ss.SSS"}),d.format.printf(({level:e,message:t,timestamp:r,label:o,...n})=>{try{const i=Object.keys(n).length;let s;if(i)if(1===i){const e=Object.keys(n)[0];s=`${t} ${e}: ${JSON.stringify(n[e],null,2)}`}else s=`${t}\n${JSON.stringify(n,null,2)}`;else s=t;const a=d.format.colorize().colorize(e,e.toUpperCase());return`[${r}]${(o?`(${o})`:"").padEnd(8," ")} ${a}: ${s}`}catch(e){return t}}));function h(e){return d.format.combine(d.format.label({label:e}),d.format.timestamp({format:()=>(new Date).toISOString()}),d.format.json())}function v(e){return{filename:E(),level:f.levels[e],format:h(e),lazy:!1}}function _(){if(m.hudConfig.logDirectory)return m.hudConfig.logDirectory;const e=u.homedir();switch(u.platform()){case"darwin":return c.join(e,"Library","Logs","hud");case"win32":return c.join(e,"AppData","hud","Logs");default:return c.join(e,".hud","logs")}}let b;function E(){return b??=c.join(_(),`${a.randomUUID()}.log`)}t.getLogPath=E,t.getSavedLogs=function(){const e=[];for(const[t,r]of Object.entries(S))for(const t of r.transports)try{if(t instanceof g){const o=t.getMessagesToSend();if(!o)continue;const{logsBuf:n,messageDropCount:i}=o;i&&r.info(`Dropped ${i} messages`),e.push(n)}}catch(e){r.error("Failed to get saved logs",e)}return e},t.renewFileTransports=function(){const e=new Date,t=new Set;for(const[r,o]of Object.entries(S)){const r=[],n=[];for(const i of o.transports)if(i instanceof d.transports.File){r.push(i),n.push(new d.transports.File({level:i.level,format:i.format,filename:c.join(i.dirname,i.filename),lazy:!1}));const o=c.join(_(),`${a.randomUUID()}-${e.toISOString().replaceAll(":","")}.log`);l.existsSync(c.join(i.dirname,i.filename))&&(l.renameSync(c.join(i.dirname,i.filename),o),t.add(o))}for(const e of r)o.remove(e),e.close&&e.close();for(const e of n)o.add(e)}return t};const S={};class C{name;logger;constructor(e){this.name=e;try{this.logger=function(e){const t=[];f.console&&t.push(new d.transports.Console({format:d.format.combine(d.format.label({label:e}),y)}));let r=!1;if(!m.hudConfig.fileless)try{t.push(function(e){const t=v(e),r=c.dirname(t.filename);return l.mkdirSync(r,{recursive:!0}),l.writeFileSync(t.filename,"",{flag:"w"}),new d.transports.File(t)}(e))}catch{r=!0}(m.hudConfig.fileless||r)&&t.push(function(e){const t=h(e);return new g({format:t})}(e));const o=d.createLogger({level:f.levels[e],transports:t});return S[e]=o,r&&o.info("Could not create file transport, fallback succesfully to worker port"),m.hudConfig.fileless&&o.info("Fileless mode is enabled"),o}(e)}catch(e){this.logger=void 0}}isValid(){return!!this.logger}log(e,t,...r){if(this.logger)try{this.logger.log(e,t,...r)}catch{}}error(e,...t){this.log("error",e,...t)}warn(e,...t){this.log("warn",e,...t)}info(e,...t){this.log("info",e,...t)}http(e,...t){this.log("http",e,...t)}verbose(e,...t){this.log("verbose",e,...t)}debug(e,...t){this.log("debug",e,...t)}silly(e,...t){this.log("silly",e,...t)}}function w(e,t,r){let o=`Hud: ${e}`;return r&&(o+=" For more information visit https://docs.hud.io/docs/node-sdk-ie."),void 0!==t&&(o+=` ${t}`),o}t.SafeLogger=C,t.formatLogMessage=w,t.customer_logger=d.createLogger({level:m.hudConfig.customerLoggerLevel,transports:[new d.transports.Console({})],format:d.format.printf(({message:e,errCode:t,moreInfo:r})=>{try{return w(e,t,r)}catch(t){return e}})}),t.app_logger=new C("app"),t.instrument_logger=new C("instrument"),t.worker_logger=new C("worker")},3176:e=>{e.exports=require("buffer-crc32")},3312:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=void 0,t.SDK_VERSION="1.6.10"},3431:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.unrefSetInterval=t.unrefSetTimeout=t.unrefSetImmediate=void 0;const s=i(r(6460));t.unrefSetImmediate=function(e,t){return s.setImmediate(e,{...t,ref:!1})},t.unrefSetTimeout=function(e,t,r){return s.setTimeout(e,t,{...r,ref:!1})},t.unrefSetInterval=function(e,t,r){return s.setInterval(e,t,{...r,ref:!1})}},3699:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.shouldRunHud=t.isSupportedNative=t.isDebuggerAttached=void 0;const s=i(r(6592)),a=r(5919),l=r(1012),u=r(8138),c=r(4715),d=r(2794),p=r(3073);function m(){if("true"===process.env.HUD_ALLOW_DEBUGGER)return!1;if(process.execArgv.some(e=>e.includes("--inspect")||e.includes("--debug")||e.includes("--inspect-brk")||e.includes("--debug-brk")))return!0;try{return"string"==typeof s.url()}catch(e){return!1}}function f(){return void 0!==r(2784).transform}t.isDebuggerAttached=m,t.isSupportedNative=f,t.shouldRunHud=function(){return"false"===process.env.HUD_ENABLE?{shouldRun:!1,error:u.UserErrorLogs.HudEnableIsFalse()}:a.isMainThread?(0,d.isHudEnabled)()?process.versions.bun?{shouldRun:!1,error:u.UserErrorLogs.RunningInBun()}:function(){const e=process.versions.node.split(".")[0];return!!l.hudConfig.supportedNodeVersions.includes(e)}()?process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE&&!function(){try{return"1"===process.env.HUD_INTERNAL_EXEC_WRAPPER_USED}catch(e){return!1}}()?{shouldRun:!1,error:u.UserErrorLogs.LambdaNotViaLayer()}:m()?{shouldRun:!1,error:u.UserErrorLogs.DebuggerAttached()}:function(){const e=(0,c.getMemoryLimitInfo)();return!!(0,c.isMemoryLimitBigEnough)(e)}()?f()?{shouldRun:!0}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNativeBuild()}:{shouldRun:!1,error:u.UserErrorLogs.PodMemoryLimitTooLow(l.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER)}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNodeVersion()}:{shouldRun:!1,error:u.UserErrorLogs.HudEnableNotSet(process.env.HUD_ENABLE)}:(p.app_logger.info("required not from main thread"),{shouldRun:!1,error:null})}},3903:e=>{e.exports=require("uuid")},4219:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.safeCall=void 0;const o=r(8138);t.safeCall=function(e,t){return t.catch(t=>{(0,o.isAbortError)(t)||e.error("Unhandled exception on async task",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})})}},4451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineSourceMaps=t.shouldSupportSourceMap=void 0;const o=r(1012),n=r(3073);t.shouldSupportSourceMap=function(){return!!o.hudConfig.supportSourceMap&&(process.execArgv.includes("--enable-source-maps")&&n.instrument_logger.warn("--enable-source-maps is set, enabling custom source-map-support anyway"),!0)},t.combineSourceMaps=function(e,t){if(0===e.length)return;if(1===e.length&&void 0===e[0].lineOffset)return e[0].map;const r=e.map(e=>({offset:{line:e.transformedLineOffset,column:e.transformedColumnOffset},map:{..."string"==typeof e.map?JSON.parse(e.map):e.map,file:t}})),o={version:3,file:t,sections:r};return JSON.stringify(o)}},4627:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateDynamicConfig=void 0;const o=r(9100);function n(e,t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(e)&&Array.isArray(t))return t;const r={...e};for(const o in t){const i=e[o],s=t[o];r[o]=n(i,s)}return r}t.updateDynamicConfig=function(e,t,r){const i=o.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!i.success)return r.error("Dynamic configuration not updated - Invalid configuration override",{remoteConfigParseResult:i,remoteConfig:e}),t.dynamicConfig;const s=n(t.dynamicConfig,i.data);return void 0!==s.enableInvestigation&&s.enableInvestigation!==t.dynamicConfig.enableInvestigation&&(r.info("Dynamic configuration updated - enableInvestigation",{hudEnableInvestigation:s.enableInvestigation}),t.isInvestigationEnabledByEnv||(globalThis.hudEnableInvestigation=s.enableInvestigation)),s}},4634:e=>{e.exports=require("source-map")},4715:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isMemoryLimitBigEnough=t.getMemoryLimitInfo=void 0;const o=r(1012),n=r(3073),i=r(5290);t.getMemoryLimitInfo=function(){const e=(0,i.getPodMemoryLimit)(n.app_logger);return n.app_logger.info(`Pod memory limit: ${null===e.podMemoryLimitMB?"unknown":e.podMemoryLimitMB+"MB"} from ${e.source}, minimum required: ${o.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER}MB`),e},t.isMemoryLimitBigEnough=function(e){return null===e.podMemoryLimitMB||e.podMemoryLimitMB>=(o.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER)}},5124:e=>{e.exports=require("winston")},5290:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPodMemoryLimit=void 0;const n=r(9896),i=o(r(857));let s=null;function a(e,t){const r=parseInt(e);if(isNaN(r))return null;const o=Math.floor(r/1048576);return o<=0||o>=131072?(t.debug(`Treating memory value (${e} bytes) as unlimited.`),null):o}function l(e,t,r){if(!e)return{podMemoryLimitMB:null,source:null};const o=a(e,r);return null!==o?{podMemoryLimitMB:o,source:t}:{podMemoryLimitMB:null,source:null}}function u(e){try{return(0,n.readFileSync)(e,"utf8")}catch{return null}}function c(){const e=i.default.totalmem();return{podMemoryLimitMB:Math.floor(e/1048576),source:"system-memory"}}t.getPodMemoryLimit=function(e){if(null!==s)return s;if("linux"!==i.default.platform())return s=c(),s;let t=function(e,t){for(const e of["/sys/fs/cgroup/memory.max","/sys/fs/cgroup/memory.high"]){const r=u(e);if(!r)continue;const o=r.trim();if("max"===o){t.debug(`Found 'max' value in ${e}, will use system memory instead`);continue}const n=a(o,t);if(null!==n)return{podMemoryLimitMB:n,source:e}}return{podMemoryLimitMB:null,source:null}}(0,e);return null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=function(e,t){for(const e of["/sys/fs/cgroup/memory/memory.stat","/sys/fs/cgroup/memory/memory.limit_in_bytes"]){const r=u(e);if(r)if(e.endsWith("memory.stat")){const o=["hierarchical_memory_limit","memory.limit_in_bytes","limit_in_bytes"],n=r.split("\n");for(const r of o){const o=n.find(e=>e.startsWith(r));if(o){const n=l(o.split(" ")[1],`${e}:${r}`,t);if(null!==n.podMemoryLimitMB)return n}}}else{const o=l(r.trim(),e,t);if(null!==o.podMemoryLimitMB)return o}}return{podMemoryLimitMB:null,source:null}}(0,e),null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=c(),e.info(`No container memory limit found, using system memory: ${t.podMemoryLimitMB}MB`),s=t,t))}},5595:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getParameterInfo=void 0;const s=i(r(6346)),a=r(8528),l=r(3073);function u(e,t=0){if(void 0!==e.loc&&null!==e.loc)return{line:e.loc.start.line,column:e.loc.start.column+t,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column+t}}function c(e){return s.types.isIdentifier(e.argument)?{name:e.argument.name,type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e,e.argument.name.length+3)}:(l.worker_logger.warn("Unsupported rest element",{type:e.argument.type}),{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e)})}function d(e){var t;if(e)switch(e?.type){case"Identifier":return{name:(t=e).name,type:a.ParameterTypes[t.type],sourcemap_location_hint:u(t,t.name.length)};case"AssignmentPattern":return function(e,t,r){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),left:t,right:r}}(e,d(e.left),function(e){switch(e.type){case"StringLiteral":case"NumericLiteral":case"BooleanLiteral":case"BigIntLiteral":case"DecimalLiteral":return{type:e.type,value:e.value};case"RegExpLiteral":return{type:e.type,value:e.pattern}}return{type:e.type}}(e.right));case"ArrayPattern":return function(e,t){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),elements:t}}(e,e.elements.map(e=>d(e)).filter(e=>void 0!==e));case"RestElement":return c(e);case"ObjectPattern":{const t=[];return e.properties.forEach(e=>{if(s.types.isObjectProperty(e)){const r=s.types.isIdentifier(e.key)&&s.types.isIdentifier(e.value)||s.types.isAssignmentPattern(e.value)?void 0:d(e.key);t.push(function(e,t,r){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),key:t,value:r}}(e,r,d(e.value)))}else s.types.isRestElement(e)&&t.push(c(e))}),function(e,t){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),properties:t}}(e,t)}default:l.worker_logger.warn("Unsupported parameter type",{type:e.type})}}t.getParameterInfo=function(e,t){return e.node.params.map(e=>{try{return d(e)}catch(e){return}}).filter(e=>void 0!==e).map(e=>{let r;if(void 0!==e.sourcemap_location_hint){const{name:o,line:n,column:i}=t({line:e.sourcemap_location_hint.line,column:e.sourcemap_location_hint.column}),s={line_on_server:e.sourcemap_location_hint.line_on_server,column_on_server:e.sourcemap_location_hint.column_on_server};null===n||null===i?(l.worker_logger.debug("Could not find location for parameter",{type:e.type}),r={name:o??void 0,line:-1,column:-1,...s}):r={name:o??void 0,line:n,column:i,...s}}return{...e,name:r?.name??e.name,type:e.type,sourcemap_location_hint:r??e.sourcemap_location_hint}})}},5822:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.loopLogProcessPerformance=t.getCpuLimit=t.getCpuLimitUnsafe=t.loopLogThreadPerformance=void 0;const a=r(9896),l=s(r(857)),u=r(2987),c=i(r(1493)),d=r(2908),p=r(3431);function m(e){e.info("Trying to detect CPU limit");try{const t=(0,a.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_quota_us","utf8"),r=(0,a.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_period_us","utf8");return e.info("CPU limit detected for cgroups v1",{cpuQuota:t,cpuPeriod:r}),"-1"===t?"unlimited":parseInt(t.toString())/parseInt(r.toString())}catch(t){try{const t=(0,a.readFileSync)("/sys/fs/cgroup/cpu.max","utf8"),[r,o,n]=t.trim().split(" ");return e.info("CPU limit detected for cgroups v2",{max:r,period:o}),r&&o?"max"===r?"unlimited":parseInt(r)/parseInt(o):void e.info("cpu.max file is not in the expected format",t)}catch(r){return void e.info("Failed to detect CPU limit",{e:t,e2:r})}}}let f;t.loopLogThreadPerformance=async function(e,t,r){let o=u.performance.eventLoopUtilization(),n=u.performance.nodeTiming.toJSON();for await(const i of(0,p.unrefSetInterval)(t,void 0,{signal:r}))try{const t=u.performance.eventLoopUtilization(),r=u.performance.eventLoopUtilization(t,o);o=t;const i=c.getHeapStatistics(),s=u.performance.nodeTiming.toJSON(),a=s.idleTime-n.idleTime,l=s.duration-n.duration,d=a/l;n=s,e.info("thread performance statistics",{thread_elu_percentage:100*r.utilization,memory:{thread_heap_utilization_percentage:i.total_heap_size/i.heap_size_limit*100},idleTime:a,totalTime:l,idleTimePercentage:d})}catch(t){e.error("Failed logging thread performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}},t.getCpuLimitUnsafe=m;let g=!1;t.getCpuLimit=e=>(g||(f=(0,d.suppressTraces)(m)(e),g=!0),f),t.loopLogProcessPerformance=async function(e,r,o){const n=l.default.totalmem(),i=(0,t.getCpuLimit)(e);let s=process.cpuUsage();for await(const t of(0,p.unrefSetInterval)(r,void 0,{signal:o}))try{const t=process.memoryUsage(),o=process.uptime(),a=process.cpuUsage(),l={user:a.user-s.user,system:a.system-s.system};s=a;let u=(l.user+l.system)/(1e3*r);i&&"number"==typeof i&&(u/=i),e.info("process performance statistics",{memory:{process_memory_rss:t.rss,process_memory_utilization_percentage:t.rss/n*100},cpu:100*u,cpuStats:{limit:i,usagePercentage:100*u},uptime:o})}catch(t){e.error("Failed logging process performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}}},5919:e=>{e.exports=require("node:worker_threads")},6346:e=>{e.exports=require("@babel/core")},6460:e=>{e.exports=require("timers/promises")},6592:e=>{e.exports=require("node:inspector")},6760:e=>{e.exports=require("node:path")},6827:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseDeclarations=t.readFile=t.getRealPositionFunc=t.fixSourceMap=void 0;const a=i(r(6346)),l=r(8528),u=s(r(9896)),c=r(4634),d=r(1622),p=s(r(6760)),m=r(1012),f=r(8528),g=s(r(3176)),y=r(2784),h=r(3903),v=r(3073),_=r(8066),b=r(7064),E=r(5595),S=r(7087),C=r(1974),w=r(2298),I={babelrc:!1,configFile:!1};function M(e){let t;return t="string"==typeof e?JSON.parse(e):e,t.sources=t.sources.map(e=>e.replace(/^webpack:\/\/(?:@[^/]+?[/])?[^/]+\//,"")),t}function x(e,t,r){return o=>{const n=e?.originalPositionFor({line:o.line,column:o.column})??{line:o.line,column:o.column,source:null,name:null},i=null!==n.line?n.line+(t||0):null,s=null!==n.column?n.column+(1===n.line&&r||0):null;return{...n,line:i,column:s}}}let O;t.fixSourceMap=M,t.getRealPositionFunc=x,t.readFile=async function(e,t,r){try{if(t&&r){const o=Buffer.alloc(r-t),n=await u.default.promises.open(e,"r");return await n.read(o,0,r-t,t),await n.close(),o.toString("utf-8")}return await u.default.promises.readFile(e,"utf-8")}catch(t){return void v.worker_logger.error("Failed to read file",{filename:e,msg:t instanceof Error?t.message:t})}},t.parseDeclarations=async function(e,t,r=null,o){const{filename:n,bundlerBuildId:i,bundlerBuildIdGenerated:s,lineOffset:u,columnOffset:k,file_path_checksum:T,file_checksum:D,functionIds:F,sourceCodeHash:L,moduleBase:P}=e;if(v.worker_logger.debug("Parsing code",{filename:n}),o)try{if(!O){const e=(0,_.myRequire)("ts-node");O=e.create({...o,transpileOnly:!0,typeCheck:!1})}const e=function(e,t,r){try{return r.compile(e,t)}catch(e){return void v.worker_logger.warn("ts file pass, but failed to compile with ts-node",{filename:t,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(t,n,O);if(!e)return{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}};t=e}catch(e){return v.worker_logger.error("Failed to require and compile ts file",{filename:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}}}else if(n.endsWith(".ts")||n.endsWith(".mts"))return v.worker_logger.error("ts file pass, but not found ts-options"),{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}};const H=(0,g.default)(t).readUInt32BE();if(H!==D)return v.worker_logger.warn("File checksum mismatch",{filename:n,file_path_checksum:T,diskFileChecksum:H,file_checksum:D,functionIds:F}),{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}};const U=u?null:(0,y.getSourceMap)(n,t);let j,N;try{null!==U&&(N=(0,g.default)(U).readUInt32BE(),m.hudConfig.userConfig.disableSourceMapsResolution?.value||(j=JSON.parse(U)))}catch(e){v.worker_logger.error("Failed to parse source map",{filename:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const B=x(j?await new c.SourceMapConsumer(M(j)):void 0,u,k);v.worker_logger.debug("Parsing code",{filename:n});const A=[],R=await a.parseAsync(t,I);if(null===R)return v.worker_logger.warn("Failed parsing code to tree",{filename:n,file_path_checksum:T,diskFileChecksum:H,file_checksum:D,functionIds:F}),{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}};v.worker_logger.debug("Parsed code to tree",{filename:n});const q=[{type:l.EntityType.Program,symbol:{sourcemap_location_hints:[]},context:{},childrenCount:{},siblingIndex:0}],$=new Set;v.worker_logger.debug("Traversing declarations",{filename:n}),r?.postMessage("eventlooptime"),a.traverse(R,{[w.NamespaceScopeAlias]:{enter(e){const{node:r}=e;if(!(0,w.isNamespaceScopeable)(r))return;const o=q[q.length-1];let i=(0,S.getScope)(e);if(!i)return;i=(0,C.resolveScopeSymbols)(B,i);const s=o.childrenCount[i.type]||0,a={...i,childrenCount:{},siblingIndex:s};if(o.childrenCount[i.type]=s+1,q.push(a),$.add(r),e.isFunction()){const r=function(e,t,r,o,n,i,s){try{const l=e;let u=e.node.body.loc?.start?.index;if(void 0===u)throw new Error("Function node has no block start location");if(void 0===e.node.start||null===e.node.start||void 0===e.node.end||null===e.node.end)throw new Error("Function node has no start or end location");"ArrowFunctionExpression"===l.node.type&&l.node.body.extra?.parenthesized&&l.node.body.extra?.parenStart&&Number.isInteger(l.node.body.extra.parenStart)&&(u=l.node.body.extra.parenStart);const c=function(e,t,r,o){const n=o.slice(0,r),i=`${e}_${t}_${Buffer.byteLength(n,"utf8")}`;return(0,h.v5)(i,m.hudConfig.functionUuidNamespace).toString()}(t,r,u-(n-1),i),y=(a=i.slice(e.node.start,e.node.end),(0,g.default)(a).readUInt32BE().toString());if(!y)return void v.worker_logger.warn("Function hash not found",{functionID:c,filename:r});const _=l.node.async||!1,S=(0,C.getNodeLocation)(l.node,s),w=S.start.source??r,I=(0,b.getEntityType)(l),M=(0,d.getMethodKind)(l.node),x=(0,d.getContextualData)(l);x.symbol&&(x.symbol=(0,C.resolveSymbol)(s,x.symbol)),x.callback?.callee.symbol&&(x.callback.callee.symbol=(0,C.resolveSymbol)(s,x.callback.callee.symbol));const O=(0,E.getParameterInfo)(l,s),{siblingIndex:k,childrenCount:T}=o[o.length-1],D=o.slice(0,-1),F=(0,d.getFunctionIdentifier)(l),L=(0,C.resolveSymbol)(s,{name:F?.name,sourcemap_location_hints:F?(0,C.getLocationList)(F,F.name):(0,C.getLocationList)(l.node,void 0),format:F?"%s":void 0});return{module:p.default.parse(w).name,symbol:L,context:x,file:w,type:I,format:f.Format.cjs,parameters:O,async:_,start_line:S.start.line,end_line:S.end.line,start_column:S.start.column,source_code_hash:y,runtime_function_id:c,scope_chain:D,declarations_count:0,methodKind:M,siblingIndex:k,childrenCount:T,original_location:{file:r,start_line:e.node.loc?.start?.line,end_line:e.node.loc?.end?.line,start_column:e.node.loc?.start?.column,end_column:e.node.loc?.end?.column}}}catch(e){v.worker_logger.error("Failed to handle function",{filename:r,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}var a}(e,L,n,q,P,t,B);r&&A.push(r)}},exit(e){$.has(e.node)&&(q.pop(),$.delete(e.node))}}}),v.worker_logger.debug("Traversed declarations",{filename:n});const K=new Set(A.map(e=>e.runtime_function_id)),z=[],W=[];A.forEach(e=>{K.has(e.runtime_function_id)?z.push({...e,declarations_count:A.length,bundler_build_id:i,was_bundler_build_id_generated:s,has_input_map:void 0!==j,sourcemap_crc:N,file_path_checksum:T,file_checksum:D}):W.push(e)}),W.length>0&&v.worker_logger.warn("Function IDs mismatch, missing instrumentation",{filename:n,runtimeFunctionIds:F,missingInstrumentation:W}),new Set(F).forEach(e=>{K.has(e)&&K.delete(e)});const V=K.size>0;return V&&v.worker_logger.error("Function IDs mismatch, missing declerations",{filename:n,missingRuntimeFunctionIds:[...K]}),{declarations:z,blacklist:V?{file_path_checksum:T,file_checksum:D,uuids:[...K]}:void 0}}},6928:e=>{e.exports=require("path")},6982:e=>{e.exports=require("crypto")},7064:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getEntityIdentity=t.getEntityType=void 0;const o=r(6346),n=r(8528),i=r(3073);t.getEntityType=function(e){const{node:t}=e;return o.types.isFunctionDeclaration(t)?n.EntityType.FunctionDeclaration:o.types.isFunctionExpression(t)?n.EntityType.FunctionExpression:o.types.isArrowFunctionExpression(t)?n.EntityType.FunctionArrow:o.types.isObjectMethod(t)?n.EntityType.ObjectMethod:o.types.isStaticBlock(t)||o.types.isClassMethod(t)?n.EntityType.ClassMethod:o.types.isClassPrivateMethod(t)?n.EntityType.ClassPrivateMethod:o.types.isClassDeclaration(t)?n.EntityType.ClassDeclaration:o.types.isClassExpression(t)?n.EntityType.ClassExpression:o.types.isForInStatement(t)||o.types.isForOfStatement(t)||o.types.isForStatement(t)?n.EntityType.ForLoop:o.types.isBlockStatement(t)?function(e){const t=e.parentPath.node;if(!(o.types.isFunctionDeclaration(t)||o.types.isFunctionExpression(t)||o.types.isArrowFunctionExpression(t)||o.types.isClassMethod(t)||o.types.isObjectMethod(t)||o.types.isClassPrivateMethod(t)))if(o.types.isIfStatement(t)){if("consequent"===e.parentKey)return n.EntityType.IfConsequent;if("alternate"===e.parentKey)return n.EntityType.IfAlternate;if("test"===e.parentKey)return n.EntityType.IfTest}else{if(o.types.isBlockStatement(t)||o.types.isProgram(t))return n.EntityType.Block;if(o.types.isTryStatement(t)){if("block"===e.parentKey)return n.EntityType.Try;if("finalizer"===e.parentKey)return n.EntityType.Finally}else{if(o.types.isCatchClause(t))return;if(o.types.isWhileStatement(t))return"test"===e.parentKey?n.EntityType.WhileTest:n.EntityType.Do;if(o.types.isDoWhileStatement(t))return"test"===e.parentKey?n.EntityType.WhileTest:n.EntityType.Do;if(!(o.types.isForStatement(t)||o.types.isForInStatement(t)||o.types.isForOfStatement(t)))return;if("test"===e.parentKey)return n.EntityType.ForTest;if("body"===e.parentKey)return n.EntityType.ForBlock}}}(e):o.types.isProgram(t)?n.EntityType.Program:o.types.isDoWhileStatement(t)?n.EntityType.DoWhile:o.types.isWhileStatement(t)?n.EntityType.While:o.types.isCatchClause(t)?n.EntityType.Catch:o.types.isObjectExpression(t)?n.EntityType.ObjectExpression:o.types.isWithStatement(t)?n.EntityType.With:o.types.isSwitchStatement(t)?n.EntityType.Switch:o.types.isSwitchCase(t)?n.EntityType.SwitchCase:o.types.isTryStatement(t)?n.EntityType.TryCatch:o.types.isIfStatement(t)?n.EntityType.If:n.EntityType.Other},t.getEntityIdentity=function(e){return o.types.isFunctionDeclaration(e)?o.types.isIdentifier(e.id)?e.id:void i.worker_logger.info("Function declaration without an identifier"):o.types.isClassDeclaration(e)?o.types.isIdentifier(e.id)?e.id:void i.worker_logger.info("Class declaration without an identifier"):o.types.isFunctionExpression(e)||o.types.isClassExpression(e)?o.types.isIdentifier(e.id)?e.id:void 0:o.types.isClassMethod(e)?o.types.isIdentifier(e.key)?e.key:void i.worker_logger.info("Class method without an identifier"):o.types.isObjectMethod(e)?o.types.isIdentifier(e.key)?e.key:void i.worker_logger.info("Object method without an identifier"):o.types.isClassPrivateMethod(e)?o.types.isIdentifier(e.key.id)?e.key.id:void i.worker_logger.info("Class private method without an identifier"):void 0}},7087:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getScope=void 0;const o=r(7064),n=r(1974),i=r(1622);t.getScope=function(e){const t=(0,o.getEntityType)(e);if(t){const r=(0,o.getEntityIdentity)(e.node),s=r?.name;return{type:t,context:(0,i.getContextualData)(e),symbol:{name:s,sourcemap_location_hints:r?(0,n.getLocationList)(r,s):(0,n.getLocationList)(e.node,void 0),format:r?"%s":void 0},methodKind:(0,i.getMethodKind)(e.node)}}}},7582:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.nextLoopDummy=void 0;const r=`http://${process.env.AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension`;async function o(e){return await fetch(`${r}/event/next`,{method:"get",headers:{"Content-Type":"application/json","Lambda-Extension-Identifier":e}})}t.nextLoopDummy=async function(e){for(;;)try{(await o(e)).ok||await new Promise(e=>setTimeout(e,50))}catch(e){await new Promise(e=>setTimeout(e,50))}}},8066:(e,t)=>{let r;Object.defineProperty(t,"__esModule",{value:!0}),t.myRequire=void 0;try{r=require}catch(e){r=void 0}t.myRequire=r},8138:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getNetworkError=t.UserErrorLogs=t.setFirstError=t.getFirstError=t.isAbortError=t.HudNoMessageInSqsConsumerEmit=t.HudNoErrorInSqsConsumerEmit=t.HudNoEventTypeInSqsConsumerEmit=t.HudFailExtractSqsQueueName=t.HudNoCallbackInSqsConsumerOn=t.HudNoEventTypeInSqsConsumerOn=t.HudNoQueueUrlInSqsConsumer=t.HudSqsError=t.HudExtensionNextFailedError=t.HudExtensionRegisterError=t.HudExtnensionError=t.HudBadLoggerError=t.HudInitNetworkError=t.HudTsNodeNotFoundButUsed=t.HudSessionThrottle=t.HudNoTranspileOnlyError=t.HudClientExceededMaxRetries=t.HudClientUnauthorizedError=t.HudTimeoutError=t.HudWorkloadCollectorError=t.HudAssert=t.HudUnsupportedError=t.HudEditError=t.HudWorkerError=t.HudClientError=t.HudInitError=t.HudError=void 0;const o=r(1012);class n extends Error{code=9e3;name=this.constructor.name;constructor(e){super(e)}}t.HudError=n;class i extends n{code=9001}t.HudInitError=i,t.HudClientError=class extends n{code=9002;originalAxiosErrorCode;constructor(e,t){super(e),this.originalAxiosErrorCode=t}},t.HudWorkerError=class extends n{code=9003};class s extends n{code=9004}t.HudEditError=s,t.HudUnsupportedError=class extends s{code=9005},t.HudAssert=class extends s{code=9006},t.HudWorkloadCollectorError=class extends n{code=9007},t.HudTimeoutError=class extends n{code=9008},t.HudClientUnauthorizedError=class extends n{code=9009},t.HudClientExceededMaxRetries=class extends n{code=9010},t.HudNoTranspileOnlyError=class extends n{code=9011},t.HudSessionThrottle=class extends i{code=9012},t.HudTsNodeNotFoundButUsed=class extends n{code=9013},t.HudInitNetworkError=class extends n{code=9014;originalAxiosErrorCode;constructor(e,t){super(e),this.originalAxiosErrorCode=t}},t.HudBadLoggerError=class extends n{code=9101};class a extends n{code=9200}t.HudExtnensionError=a,t.HudExtensionRegisterError=class extends a{code=9201},t.HudExtensionNextFailedError=class extends a{code=9202};class l extends n{code=9250}t.HudSqsError=l,t.HudNoQueueUrlInSqsConsumer=class extends l{code=9251},t.HudNoEventTypeInSqsConsumerOn=class extends l{code=9252},t.HudNoCallbackInSqsConsumerOn=class extends l{code=9253},t.HudFailExtractSqsQueueName=class extends l{code=9254},t.HudNoEventTypeInSqsConsumerEmit=class extends l{code=9255},t.HudNoErrorInSqsConsumerEmit=class extends l{code=9256},t.HudNoMessageInSqsConsumerEmit=class extends l{code=9257},t.isAbortError=function(e){return e instanceof Error&&"AbortError"===e.name};let u=9999;t.getFirstError=function(){return u},t.setFirstError=function(e){e&&9999===u&&(u=e)},t.UserErrorLogs={HudServiceNotSet:()=>({level:"error",errCode:"E1001",moreInfo:!0,message:"Can't load Hud, HUD_SERVICE was not set. Please set service name using the environment variable HUD_SERVICE."}),HudServiceInvalid:()=>({level:"error",errCode:"E1002",moreInfo:!0,message:"Can't load Hud, HUD_SERVICE value has invalid service name. Please set service name using the environment variable HUD_SERVICE."}),HudApiKeyNotSet:()=>({level:"error",errCode:"E1004",moreInfo:!0,message:"Can't load Hud, HUD_KEY was not set. Please set API key using the environment variable HUD_KEY."}),HudApiKeyInvalid:()=>({level:"error",errCode:"E1005",moreInfo:!0,message:"Can't load Hud, HUD_KEY value has invalid API key. Please set a valid key in environment variable HUD_KEY."}),BothApiKeyAndServiceNotSet:()=>({level:"error",errCode:"E1007",moreInfo:!0,message:"Can't load Hud, HUD_KEY and HUD_SERVICE were not set. Please set API key using the environment variable HUD_KEY and service name using the environment variable HUD_SERVICE."}),InvalidTag:()=>({level:"warn",errCode:"E1008",moreInfo:!0,message:"HUD_TAGS should be of type Key-Value Object, defaulting to empty tags. Please set valid tags in environment variable HUD_TAGS."}),TagWithDots:()=>({level:"warn",errCode:"E1009",moreInfo:!0,message:"HUD_TAGS keys can't contain dots; they have been replaced with underscores."}),TagsInvalidJson:()=>({level:"warn",errCode:"E1010",moreInfo:!0,message:"Can't load Hud, HUD_TAGS is not a valid JSON, defaulting to empty tags. Please set valid tags in environment variable HUD_TAGS."}),ApiKeyDenied:e=>({level:"error",errCode:"E1011",moreInfo:!0,message:`Can't load Hud, the provided key is invalid. Please provide a valid HUD_KEY in your ${{ENV:"environment variable",CONFIG_FILE:"file",CONFIG_ENV:"HUD_CONFIG",INIT:"init function",SETUP:"setup function"}[e]}.`}),ShutdownGracefully:e=>({level:"error",errCode:`E${e}`,message:"SDK has initiated a graceful shutdown. Your application remains unaffected"}),UnsupportedNodeVersion:()=>({level:"error",errCode:"E1012",moreInfo:!0,message:"Can't load Hud due to an unsupported node version."}),UnsupportedSyntax:()=>({level:"error",errCode:"E1014",moreInfo:!0,message:"Can't load Hud due to an unsupported syntax version."}),UnsupportedLambdaMemory:()=>({level:"error",errCode:"E1015",moreInfo:!0,message:`Can't load Hud as lambda function memory size is less than ${o.hudConfig.lambdaMinimunMemory}MB.`}),JSONErrorInUserConfig:(e,t)=>({level:"error",errCode:"E1016",moreInfo:!0,message:`Can't load Hud, the config file contains an invalid JSON. Please set a valid json in Hud's config ${e}`+(t?`, Error: ${t}.`:".")}),ZodErrorInUserConfig:(e,t)=>({level:"error",errCode:"E1017",moreInfo:!0,message:`Can't load Hud, the config file contains an invalid value for field: ${t}. Please set a valid value for ${t} in the config ${e}.`}),ConfigInaccessible:e=>({level:"error",errCode:"E1018",moreInfo:!0,message:`Can't load Hud, the config file is inaccessible. Please make sure your node application has read permissions to the Hud config file, ${e}.`}),SetupCalledWithoutKey:()=>({level:"error",errCode:"E1019",moreInfo:!0,message:"API key not found or invalid. SDK has initiated a graceful shutdown. Your application remains unaffected."}),SetupCalledWithoutService:()=>({level:"error",errCode:"E1020",moreInfo:!0,message:"Service name parameter not found or invalid. SDK has initiated a graceful shutdown. Your application remains unaffected."}),HudEnableIsFalse:()=>({level:"warn",errCode:"E1021",moreInfo:!0,message:"HUD_ENABLE is set to false. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InstrumentedFunctionCountExceeded:e=>({level:"error",errCode:"E1022",moreInfo:!0,message:`SDK limit of ${e} instrumented functions exceeded. SDK has initiated a graceful shutdown. Your application remains unaffected.`}),PodMemoryLimitTooLow:e=>({level:"error",errCode:"E1023",moreInfo:!0,message:`Insufficient memory available. Minimum required:(${e}MB). SDK has initiated a graceful shutdown. Your application remains unaffected.`}),DebuggerAttached:()=>({level:"error",errCode:"E1024",message:"Did not load as debugger is attached."}),InitSessionBeforeRegister:()=>({level:"error",errCode:"E1025",moreInfo:!0,message:"register() was not called, or called after initSession() - please call register() before initSession() and run again. Your application continues normally without Hud."}),RegisterMisplacedNoDeclarations:()=>({level:"warn",errCode:"E1026",moreInfo:!0,message:"Warning - No code has been mapped so far. This probably means register() was called too late — after your code was already loaded. Move it to the top of your entry file to enable proper mapping. Your application continues normally without Hud data."}),UnsupportedFrameworkVersion:e=>({level:"warn",errCode:"E1029",message:`Warning - Unsupported version of ${e} framework(s). This means Hud won't track your framework invocations. Your application continues normally, but with partial Hud data. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node#/`}),UninstrumentedFilesLogThresholdExceeded:e=>({level:"warn",errCode:"E1027",message:`Warning - ${e} of your code files were imported before register(). This means Hud won't track all of your functions. Please move register() call to an earlier location. To view the list of files use register({verbose: true}). Your application continues normally, but with partial Hud data.`,moreInfo:!0}),UninstrumentedFrameworks:e=>({level:"warn",errCode:"E1028",message:`Warning - The framework(s): ${e.map(e=>`"${e}"`).join(", ")} was imported before register(). This means Hud won't track your framework invocations. Please move register() call to an earlier location. Your application continues normally, but with partial Hud data.`}),YesDeclarationsNoMetrics:()=>({level:"warn",errCode:"E1032",moreInfo:!0,message:"Warning - Code mapped successfully, but no function activity was tracked. Make sure your service is running and actively handling requests."}),HudEnableNotSet:e=>({level:"error",moreInfo:!0,message:`Did not load as HUD_ENABLE is ${void 0===e?"undefined":"set to a non-true value"}. Please set HUD_ENABLE=true to run Hud.`}),LambdaNotViaLayer:()=>({level:"error",errCode:"E1034",message:"Can't load Hud, lambda support is currently in beta. Contact Hud to get early access."}),RunningInBun:()=>({level:"error",errCode:"E1035",message:"Hud does not support Bun yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),RunningOnWindows:()=>({level:"error",errCode:"E1036",message:"Hud does not support Windows yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),UnsupportedNativeBuild:()=>({level:"error",errCode:"E1037",message:"Hud does not support this platform yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),TsNodeNotTranspileOnly:()=>({level:"error",errCode:"E1038",message:"detected ts-node is used without the transpileOnly flag, which is not supported yet. SDK has initiated a graceful shutdown. Your application remains unaffected.",moreInfo:!0}),TsNodeNotFoundEvenThoughRunWithTsNode:()=>({level:"error",errCode:"E1039",message:"'ts-node' was detected but could not be resolved by Hud. This may happen if 'ts-node' is installed globally. Try installing it locally in your project. The SDK has initiated a graceful shutdown. Your application remains unaffected.",moreInfo:!0}),InitFailedDueGenericNetworkError:()=>({level:"error",moreInfo:!0,errCode:"E1040",message:"A network error occurred during SDK initialization. Please check your internet connection and try again. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueNetworkTimeout:()=>({level:"error",moreInfo:!0,errCode:"E1041",message:"The SDK failed to connect to Hud's backend due to a timeout during SDK initialization. Please verify your firewall settings to ensure outbound connections are allowed. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueNetworkRST:()=>({level:"error",moreInfo:!0,errCode:"E1042",message:"The SDK connection to Hud's backend was reset unexpectedly (RST) during SDK initialization. Please check your firewall or network security settings. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueSelfSignedCert:()=>({level:"error",moreInfo:!0,errCode:"E1043",message:"SSL certificate verification failed during SDK initialization. If your organization uses a self-signed certificate, set the NODE_EXTRA_CA_CERTS environment variable to the path of your CA certificate file. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueDnsFailed:()=>({level:"error",moreInfo:!0,errCode:"E1044",message:"The SDK failed to resolve DNS when attempting to connect to Hud's backend during SDK initialization. If the problem persists, please contact support. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueBackendError:()=>({level:"error",moreInfo:!0,errCode:"E1045",message:"Hud: The SDK was unable to complete initialization due to a temporary issue with Hud’s backend. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitTimeout:e=>({moreInfo:!0,level:"error",message:`SDK imported but not initialized. Please ensure to call '${e?"hud.initSession(KEY, SERVICE)":"hud.init()"}' to initialize the SDK.`}),RehookCalledBeforeRegister:()=>({level:"error",errCode:"E1046",moreInfo:!0,message:"register() was not called, or called after rehook() - please call register() before rehook() and run again. Your application continues normally with partial hud data."}),EsbuildMissingKey:()=>({level:"error",errCode:"ES0001",moreInfo:!0,message:"missing HUD_KEY, skipping Hud plugin, your build is unaffected."}),EsbuildFailedProcessingFile:e=>({level:"error",errCode:"ES0002",moreInfo:!0,message:`failed processing file "${e}", reverting to original loader.`}),EsbuildFailedBundling:()=>({level:"error",errCode:"ES0003",moreInfo:!0,message:"encountered unexpected file bundling, build aborted."}),EsbuildFailedParsingSourcemap:()=>({level:"error",errCode:"ES0004",moreInfo:!0,message:"failed parsing source maps, skipping upload, Hud will run without source maps."}),EsbuildFailedUploadingSourcemap:e=>({level:"error",errCode:"ES0005",moreInfo:!0,message:`failed uploading source map: ${e}, Hud will run without source maps.`}),EsbuildFailedUploadingSourcemapUnauthorized:()=>({level:"error",errCode:"ES0006",moreInfo:!0,message:"failed uploading source map: unauthorized, Hud will run without source maps."}),EsbuildUnsupportedPlatform:()=>({level:"error",errCode:"ES0007",message:'Can\'t load Hud, as our esbuild plugin supports "node" mode only. Your app remains unaffected. For more information visit docs.hud.io/docs/support-matrix'}),EsbuildUnsupportedWindows:()=>({level:"error",errCode:"ES0008",message:"Can't load Hud, as our esbuild plugin does not supports windows. Your app remains unaffected. For more information visit docs.hud.io/docs/support-matrix"})},t.getNetworkError=function(e){return{ECONNABORTED:t.UserErrorLogs.InitFailedDueNetworkTimeout(),ECONNREFUSED:t.UserErrorLogs.InitFailedDueNetworkRST(),ENOTFOUND:t.UserErrorLogs.InitFailedDueDnsFailed(),SELF_SIGNED_CERT_IN_CHAIN:t.UserErrorLogs.InitFailedDueSelfSignedCert(),ERR_BAD_RESPONSE:t.UserErrorLogs.InitFailedDueBackendError()}[e]??t.UserErrorLogs.InitFailedDueGenericNetworkError()}},8269:e=>{e.exports=require("./globalstate")},8287:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(6827),t)},8528:e=>{e.exports=require("./dto")},8808:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateSqsFlowId=t.generateKafkaFlowId=t.generateGraphqlFlowId=t.generateEndpointFlowId=void 0;const o=r(3903),n="fa79d8b7-069c-4bbf-9c00-34bfc8b3a5a6";t.generateEndpointFlowId=function(e,t){return(0,o.v5)(`${e.toString()}|${Array.from(t).sort().join(",")}`,n)},t.generateGraphqlFlowId=function(e,t){return(0,o.v5)(`${e}|${t}`,n)},t.generateKafkaFlowId=function(e,t,r){return(0,o.v5)(`${e.toString()}|${t}|${r}`,n)},t.generateSqsFlowId=function(e,t,r=""){const i=`${e}|${t}|${r}`;return(0,o.v5)(i,n)}},8809:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_MODULE_NAME=void 0,t.SDK_MODULE_NAME="hud-sdk"},9023:e=>{e.exports=require("util")},9100:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.updateInvestigationRateLimitGlobals=t.hudConfig=t.isValidParam=t.getModulesToTraceFromEnv=t.HudDynamicConfigSchema=void 0;const n=o(r(6928)),i=r(1569);t.HudDynamicConfigSchema=i.z.object({aggregationInterval:i.z.number(),flowMetricInterval:i.z.number(),graphqlInterval:i.z.number(),aggregationFirstSendTimeout:i.z.number(),flowMetricFirstSendTimeout:i.z.number(),enableInvestigation:i.z.boolean(),investigationRateLimits:i.z.object({maxSameInvestigations:i.z.number().int().positive(),sameInvestigationTimeWindowMs:i.z.number().int().positive(),maxTotalInvestigations:i.z.number().int().positive(),totalInvestigationTimeWindowMs:i.z.number().int().positive(),maxUniqLogs:i.z.number().int().positive()}),machineMetricsInterval:i.z.number().int().positive(),blacklistParams:i.z.array(i.z.string()),censorshipRegexes:i.z.array(i.z.object({regex:i.z.string(),replacement:i.z.string()}))}),t.getModulesToTraceFromEnv=function(){const e=process.env.HUD_MONITOR_MODULES||process.env.HUD_INCLUDE_MODULES;if(e)return e.split(",")},t.isValidParam=function(e){return null!=e&&""!==e&&"string"==typeof e};const s=process.env.HUD_ENABLE_INVESTIGATION,a=process.env.HUD_HOST||"https://api-prod.hud.io",l=process.env.HUD_LOG_DIR,u="_HUD",c=process.env.HUD_LOG_TO_FILE,d={sink:{url:a,timeout:5e3,session_attr:"X-Session-ID"},endpoints:{init:"sink/init",send:"sink/send",batch:"sink/batch",logs:"sink/logs",fatalError:"sink/redline",getMode:"sink/getMode",getRemoteConfig:"sink/remote-config/get",fileDeclarations:"sink/file-declarations",sourceMap:"sink/sourcemap",storeObject:"sink/objects/store"},logger:{default:{levels:{app:"warn",worker:"warn",instrument:"warn"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},investigation:{objectVersion:"1.0.1",store:{type:"s3"},limits:{executionFlowMaxLength:100,exceptionMaxLength:100},maxStringLength:1024,maxArrayLength:100,maxObjectDepth:10},userConfig:{minPodMemoryMB:{value:250,source:"DEFAULT"},maxMappedFunctions:{value:5e4,source:"DEFAULT"},maxFileSizeBytes:{value:2831155,source:"DEFAULT"},maxTimeUntilInitSessionMs:{value:3e4,source:"DEFAULT"},includeModules:{value:[],source:"DEFAULT"}},loggerWorkerPortSizeLimit:1e4,customerLoggerLevel:"info",logDirectory:l,invocationSampling:new Map([[[300n,null],100],[[200n,300n],50],[[100n,200n],25],[[0n,100n],10]]),callerResetInterval:36e5,modeInterval:3e5,logsSendInterval:6e4,logPerfInterval:3e5,endpointsInterval:18e5,endpointsFirstSendWaitTime:12e4,huddBinWidth:1.2,workerGrace:6e4,workerTimeout:2e4,timeoutOnRegister:6e4,timeoutOnMetrics:6e4,workerMessageTimeout:1e4,communicationBatchSize:100,writePatched:!1,defaultOff:!0,disableOnBadApiKey:!0,disableOnBadServiceName:!0,cpuTimeCollection:!1,workloadMetadata:{sendInterval:3e5,aws:{imds:{baseURL:"http://169.254.169.254/latest",tokenURI:"/api/token",identityURI:"/dynamic/instance-identity/document",lifeCycleURI:"/meta-data/instance-life-cycle",requestTimeout:5e3},metadataFile:"/run/cloud-init/instance-data.json"},kubernetes:{namespaceFile:"/var/run/secrets/kubernetes.io/serviceaccount/namespace",uuidFile:"/sys/class/dmi/id/product_uuid",podMemoryLimitFile:"/sys/fs/cgroup/memory/memory.stat",podCPULimitFile:"/sys/fs/cgroup/cpuacct/cpu.shares"}},deleteLogsAfterSending:!0,supportSourceMap:!0,editInline:!0,bundlerBuildIdVarName:"hudFileBuildID",bundlerBuildUuidNamespace:"00c1e90b-af75-4d8e-9935-68485877f759",functionUuidNamespace:"94a210f3-861c-4e18-ab27-6b6c19437c9d",wrapVarPrefix:u,functionIdVarName:`${u}_fid`,frameworksToPatch:new Map([["express",{version:"<=5",patcher:"express",enableEsbuild:!0}],[n.default.join("express","lib","application.js"),{version:"<=5",patcher:"expressApplication",enableEsbuild:!0}],["router",{version:"^2.0.0",patcher:"router",enableEsbuild:!0}],["koa",{version:"^2.0.0",patcher:"koa"}],["graphql/execution/execute",{version:"14 - 16",patcher:"graphql"}],["http",{version:"*",patcher:"http"}],["https",{version:"*",patcher:"http"}],["@nestjs/core/interceptors/interceptors-consumer",{version:"*",patcher:"nestjsInterceptor"}],["@nestjs/core/router/router-execution-context",{version:"*",patcher:"nestjsRouterExecutionContext"}],..."win32"!==process.platform?[["kafkajs",{version:">=1.4.0",patcher:"kafkajs"}],["@nestjs/microservices/context/rpc-context-creator",{version:">=7.0.0",patcher:"nestjsRpcContextCreator"}]]:[],[["@codegenie/serverless-express","src","frameworks","express.js"].join(n.default.sep),{version:"^4.1.0",patcher:"codeGenieServerlessExpress",enableEsbuild:!0}],["@codegenie/serverless-express",{enableEsbuild:!0}],["sqs-consumer",{version:"*",patcher:"sqsConsumer",extraInfo:{mondayVersion:">=6.1.0",bbcVersion:">=7.5.0"}}],["serverless-http",{enableEsbuild:!0}],[n.default.join("serverless-http","lib","framework","get-framework.js"),{version:"^2.7.0",patcher:"serverlessHttp",enableEsbuild:!0}]]),communicationKeepalive:!1,communicationKeepaliveGrace:5e3,express:{routeNamesSymbol:Symbol.for("hudRoutes"),layerStateSymbol:Symbol.for("hudState"),markedSymbol:Symbol.for("hudMarked"),wrapAllCallbacks:!0},supportedNodeVersions:["18","20","21","22","24"],hudPatchedName:"hudPatched",metricSymbol:Symbol.for("hudMetric"),dynamicConfig:{aggregationInterval:3e5,flowMetricInterval:3e5,graphqlInterval:3e4,aggregationFirstSendTimeout:3e4,flowMetricFirstSendTimeout:3e4,enableInvestigation:"true"===s,investigationRateLimits:{maxSameInvestigations:2,sameInvestigationTimeWindowMs:36e5,maxTotalInvestigations:25,totalInvestigationTimeWindowMs:216e5,maxUniqLogs:2},machineMetricsInterval:1e4,blacklistParams:[],censorshipRegexes:[]},machineMetricsSavedLength:2,isInvestigationEnabledByEnv:void 0!==s,suppressTraces:!0,lambdaMinimunMemory:1024,lambdaBaseGivenTime:400,lambdaExtraGivenTimePerRequest:50,lambdaMaxGivenTime:700,throttleStatusCode:202,esbuildGlobalVar:"hudSGV",esbuildPluginMessagePrefix:"ESBuild plugin ",esbuildMark:"/*modifiedByHudESBuildPlugin-",esbuildMarkLength:67,esbuildUploadSourceMapTimeout:15e3,esbuildPluginLogsChunkSize:100,esbuildPluginLogsBatchSize:10,pluginsLogEndpoint:"https://yqp37dddrsewm6wdwwpwfraxqm0shdmx.lambda-url.eu-central-1.on.aws/",fileless:"true"!==c,uninstrumentedFilesLogThreshold:2,tsNodeConfigTimeout:1e4,allowedEditExtensions:[".ts",".cts",".mts",".js",".cjs",".mjs"]};t.hudConfig=function(e={}){return{...d,...e}}({logger:{default:{levels:{app:"info",worker:"info",instrument:"info"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},deleteLogsAfterSending:!1,communicationKeepalive:!0}),t.default=t.hudConfig,t.updateInvestigationRateLimitGlobals=function(){globalThis.hudMaxSameInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations,globalThis.hudMaxTotalInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations,globalThis.hudSameInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.sameInvestigationTimeWindowMs)*BigInt(1e6),globalThis.hudTotalInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.totalInvestigationTimeWindowMs)*BigInt(1e6)}},9896:e=>{e.exports=require("fs")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}var o={};return(()=>{var e=o;Object.defineProperty(e,"__esModule",{value:!0}),e.rehook=e.register=e.initSession=void 0;let t=!1,n=!1;function i(){const{customer_logger:e,app_logger:t,UserErrorLogs:o}=r(2546);t.warn("No declarations found, register() was called too late"),e.log(o.RegisterMisplacedNoDeclarations())}e.initSession=async function(e,o){try{const{customer_logger:i}=r(2546),{UserErrorLogs:s}=r(2546),{clearInitGuard:a}=r(8269),{init:l}=r(2240);if(a(),!t)return void i.log(s.InitSessionBeforeRegister());if(!n)return;return e&&""!==e&&"string"==typeof e?o&&""!==o&&"string"==typeof o?await l(e,o):void i.log(s.SetupCalledWithoutService()):void i.log(s.SetupCalledWithoutKey())}catch(e){"true"!==process.env.HUD_VERBOSE&&"true"!==process.env.HUD_DEBUG||console.log(e)}},e.register=function(e){try{const{forceHudEnable:o,saveInstrumentationIndicator:s,saveHudRunningFromSetup:a}=r(8269);t=!0,o();const{updateUserConfigFromInitOptions:l,hudConfig:u,customer_logger:c,shouldRunHud:d,updateUserConfigFromFile:p}=r(2546),{registerHook:m}=r(2030),{logRegisterInRightLocation:f}=r(1256);e&&l(e,"SETUP"),p();const g=d();if(!g.shouldRun)return void(null!==g.error&&c.log(g.error));m()&&(n=!0,f(e?.verbose??!1)),s(setTimeout(i,u.timeoutOnRegister)),a()}catch{}},e.rehook=function(){const{patchCompile:e}=r(2030),{customer_logger:o,UserErrorLogs:i}=r(2546);t?n&&e():o.log(i.RehookCalledBeforeRegister())}})(),o})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(global,()=>(()=>{"use strict";var e={363:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateUserConfigFromInitOptions=t.updateUserConfigFromEnv=t.updateUserConfigFromFile=t.updateUserConfigFromInit=void 0;const o=r(8528),n=r(1569),i=r(8138),s=r(2794),a=r(3073),l=r(9100),u=o.HudInitOptionsSchema.omit({customOptions:!0}).extend({key:n.z.string().optional(),service:n.z.string().optional(),enable:n.z.boolean().optional(),enableDapulse:n.z.boolean().optional()});t.updateUserConfigFromInit=function(e,t){void 0!==e&&(l.hudConfig.userConfig.key={value:e,source:"INIT"}),void 0!==t&&(l.hudConfig.userConfig.service={value:t,source:"INIT"})},t.updateUserConfigFromFile=function(){let e;try{e=(0,s.getConfigContent)()}catch(e){throw e instanceof s.HudFailedReadConfigError&&"EACCES"===e.code&&a.customer_logger.log(i.UserErrorLogs.ConfigInaccessible(e.path)),e}if(e)try{const t=u.partial().parse(JSON.parse(e.content));Object.entries(t).forEach(([t,r])=>{!function(e,t,r){e[t]=r}(l.hudConfig.userConfig,t,{value:r,source:"HUD_CONFIG"===e.source?"CONFIG_ENV":"CONFIG_FILE"})})}catch(t){throw t instanceof n.ZodError?t.errors.forEach(t=>{const r=t.path.join(".");a.customer_logger.log(i.UserErrorLogs.ZodErrorInUserConfig(e.source,r))}):a.customer_logger.log(i.UserErrorLogs.JSONErrorInUserConfig(e.source,t.message)),t}},t.updateUserConfigFromEnv=function(){const e=process.env.HUD_KEY,t=process.env.HUD_SERVICE,r=process.env.HUD_ENABLE_DAPULSE,o=(0,l.getModulesToTraceFromEnv)(),n=process.env.HUD_MAX_INSTRUMENTED_FUNCTIONS,i=process.env.HUD_MIN_POD_MEMORY_MB;e&&(l.hudConfig.userConfig.key={value:e,source:"ENV"}),t&&(l.hudConfig.userConfig.service={value:t,source:"ENV"}),r&&(l.hudConfig.userConfig.enableDapulse={value:"true"===r,source:"ENV"}),o&&(l.hudConfig.userConfig.includeModules={value:o,source:"ENV"}),n&&(l.hudConfig.userConfig.maxMappedFunctions={value:parseInt(n),source:"ENV"}),i&&(l.hudConfig.userConfig.minPodMemoryMB={value:parseInt(i),source:"ENV"})},t.updateUserConfigFromInitOptions=function(e,t){e.includeModules&&Array.isArray(e.includeModules)&&(l.hudConfig.userConfig.includeModules={value:e.includeModules,source:t}),e.customOptions&&e.customOptions.dapulseSqsConsumer&&(l.hudConfig.userConfig.enableDapulse={value:"true"===e.customOptions.dapulseSqsConsumer,source:t}),e.maxMappedFunctions&&"number"==typeof e.maxMappedFunctions&&(l.hudConfig.userConfig.maxMappedFunctions={value:e.maxMappedFunctions,source:t}),e.minPodMemoryMB&&"number"==typeof e.minPodMemoryMB&&(l.hudConfig.userConfig.minPodMemoryMB={value:e.minPodMemoryMB,source:t}),e.maxFileSizeBytes&&"number"==typeof e.maxFileSizeBytes&&(l.hudConfig.userConfig.maxFileSizeBytes={value:e.maxFileSizeBytes,source:t}),e.maxTimeUntilInitSessionMs&&"number"==typeof e.maxTimeUntilInitSessionMs&&(l.hudConfig.userConfig.maxTimeUntilInitSessionMs={value:e.maxTimeUntilInitSessionMs,source:t})}},669:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UserLogs=void 0,t.UserLogs={HudInitSuccess:()=>({level:"info",message:"Session started"}),FirstDecalarationSent:()=>({level:"info",message:"First code mapping sent successfully"}),FirstInvocationSent:()=>({level:"info",message:"First invocation sent successfully"}),HappyFlowCompleted:()=>({level:"info",message:"Your service is sending data successfully"}),FilesLoadedBeforeRegister:()=>({level:"info",message:"Files loaded before register():"}),FileBeforeRegisterTemplate:(e,t)=>({level:"info",message:`${e}. ${t}`}),InitIdleMode:()=>({level:"info",message:"Initialized successfully in idle mode."})}},857:e=>{e.exports=require("os")},1012:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=t.SDK_MODULE_NAME=void 0,n(r(9100),t),n(r(4627),t);var i=r(8809);Object.defineProperty(t,"SDK_MODULE_NAME",{enumerable:!0,get:function(){return i.SDK_MODULE_NAME}}),n(r(2684),t),n(r(363),t);var s=r(3312);Object.defineProperty(t,"SDK_VERSION",{enumerable:!0,get:function(){return s.SDK_VERSION}})},1256:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.logRegisterInRightLocation=t.filterFilesInsideFrameworks=void 0;const o=r(2030),n=r(2241);function i(e,t){return t.filter(t=>{if(t.endsWith(".js"))return!1;const r=`/node_modules/${t}/`;for(const t of e)if(t.includes(r))return!0;return!1})}t.filterFilesInsideFrameworks=i,t.logRegisterInRightLocation=function(e){try{!function(e){const t=globalThis.hudLoadedModules;if(!t)return;const r=t.filter(e=>!(0,o.skip)(e));if(r.length>n.hudConfig.uninstrumentedFilesLogThreshold&&n.customer_logger.log(n.UserErrorLogs.UninstrumentedFilesLogThresholdExceeded(r.length)),e){n.instrument_logger.info("Files loaded before register()",{count:r.length}),n.customer_logger.info(n.UserLogs.FilesLoadedBeforeRegister());let e=0;for(const t of r)n.customer_logger.info(n.UserLogs.FileBeforeRegisterTemplate(e,t)),e++}}(e)}catch(e){n.instrument_logger.error("Error in logRegisterInRightLocation",{error:e,stack:e instanceof Error?e.stack:void 0})}try{!function(){const e=globalThis.hudLoadedModules;if(!e)return;const t=i(e,Array.from(n.hudConfig.frameworksToPatch.keys()));t.length>0&&(n.instrument_logger.info("Missing frameworks",{count:t.length}),n.customer_logger.log(n.UserErrorLogs.UninstrumentedFrameworks(t)))}()}catch(e){n.instrument_logger.error("Error in logPreLoadedFrameworks",{error:e,stack:e instanceof Error?e.stack:void 0})}}},1493:e=>{e.exports=require("v8")},1569:e=>{e.exports=require("zod")},1620:e=>{e.exports=require("winston-transport")},1622:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodKind=t.getContextualData=t.getContextSymbol=t.getFunctionIdentifier=void 0;const s=i(r(6346)),a=r(6346),l=r(8528),u=r(8138),c=r(3073),d=r(2213),p=r(1974);function m(e,t){return{name:t,sourcemap_location_hints:(0,p.getLocationList)(e,t),format:"%s"}}function f(e){if(a.types.isIdentifier(e))return{name:e.name,sourcemap_location_hints:e.loc?[{name:e.name,line:e.loc.start.line,column:e.loc.start.column,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column}]:[],format:"%s"};if(a.types.isMemberExpression(e)||a.types.isOptionalMemberExpression(e)){let t;t=a.types.isThisExpression(e.object)?{name:"this",sourcemap_location_hints:(0,p.getLocationList)(e.object,"this")}:f(e.object);const r=f(e.property),o=e.computed?t.name+"["+r.name+"]":t.name+"."+r.name,n=t.format??"%s",i=r.format??"%s",s=e.computed?`${n}[${i}]`:`${n}.${i}`;return{name:o,sourcemap_location_hints:[...t.sourcemap_location_hints,...r.sourcemap_location_hints],format:s}}if(a.types.isOptionalCallExpression(e)||a.types.isCallExpression(e))return f(e.callee);if(a.types.isSequenceExpression(e))return(0,d.isHudAwaitSequence)(e)?f((0,d.getHudAwaitSequenceElement)(e)):f(e.expressions[e.expressions.length-1]);if(a.types.isArrayExpression(e))return{name:"[]",sourcemap_location_hints:(0,p.getLocationList)(e,"[]"),format:"%s"};if(a.types.isObjectExpression(e))return{name:"{}",sourcemap_location_hints:(0,p.getLocationList)(e,"{}"),format:"%s"};if(a.types.isStringLiteral(e))return{name:`"${e.value}"`,sourcemap_location_hints:(0,p.getLocationList)(e,e.value),format:'"%s"'};throw new u.HudUnsupportedError("Unsupported left side of assignment - "+e.type+"loc - "+JSON.stringify(e.loc))}function g(e){const{node:t}=e;if(e.isExpression())try{return function(e){const{parent:t}=e;if(a.types.isVariableDeclarator(t)&&a.types.isIdentifier(t.id))return m(t,t.id.name);if(a.types.isObjectProperty(t)&&a.types.isIdentifier(t.key))return m(t,t.key.name);if(a.types.isClassProperty(t)&&a.types.isIdentifier(t.key))return m(t,t.key.name);if(a.types.isAssignmentExpression(t))return f(t.left);if(a.types.isAssignmentPattern(t))return f(t.left);throw new u.HudUnsupportedError(`Unsupported parent type - ${t.type} for me ${e.node.type}`)}(e)}catch(e){if(e instanceof u.HudUnsupportedError)return;throw e}c.worker_logger.debug("getContextSymbol; Unsupported node type",{type:t.type})}function y(e){const t=[];return e.arguments.forEach((e,r)=>{let o,n;a.types.isStringLiteral(e)?(o=l.ArgumentTypes.StringLiteral,n=e.value):a.types.isTemplateLiteral(e)?(o=l.ArgumentTypes.TemplateString,n=function(e){let t="";const r=e.quasis,o=e.expressions;for(let e=0;e<r.length;e++)t+=r[e].value.cooked,e<o.length&&(t+=`\${${h(o[e])}}`);return t=`\`${t}\``,t}(e)):a.types.isIdentifier(e)&&(o=l.ArgumentTypes.Identifier,n=e.name),o&&n&&t.push({index:r,type:o,value:n})}),t}function h(e){if(a.types.isIdentifier(e))return e.name;if(a.types.isStringLiteral(e))return e.value;if(a.types.isCallExpression(e)||a.types.isOptionalCallExpression(e)){const t=e;if(a.types.isIdentifier(t.callee))return t.callee.name;if(a.types.isMemberExpression(t.callee)||a.types.isOptionalMemberExpression(t.callee)){let e="";const r=t.callee;if(a.types.isThisExpression(r.object)?e+="this.":a.types.isIdentifier(r.object)&&(e+=`${r.object.name}.`),""!==e&&a.types.isIdentifier(r.property))return e+=`${r.property.name}`,e}}return""}t.getFunctionIdentifier=function(e){const{node:t}=e;if(a.types.isFunctionDeclaration(t)||a.types.isFunctionExpression(t)){if(a.types.isIdentifier(t.id))return t.id}else if(a.types.isClassMethod(t)){if(a.types.isIdentifier(t.key))return t.key}else if(a.types.isClassPrivateMethod(t)){if(a.types.isIdentifier(t.key.id))return t.key.id}else if(a.types.isObjectMethod(t)&&a.types.isIdentifier(t.key))return t.key},t.getContextSymbol=g,t.getContextualData=function(e){let t,r=!1;return(e.isFunctionExpression()||e.isArrowFunctionExpression())&&(t=function(e){const t=e.parentPath;if(t.isCallExpression())for(const[r,o]of t.node.arguments.entries())if(o===e.node){const e=t.node.callee;let o;try{o=f(e)}catch(t){if(!(t instanceof u.HudUnsupportedError))throw t;c.worker_logger.debug("could not get callee symbol recursively",{error:t,type:e.type})}const n=y(t.node);return{callee:{symbol:o,argsCount:t.node.arguments.length,args:n},index:r}}}(e),r=function(e){const t=e.parentPath;return!!t.isCallExpression()&&t.node.callee===e.node}(e)),{symbol:g(e),callback:t,immediatelyInvoked:r}},t.getMethodKind=function(e){if(s.types.isClassMethod(e)||s.types.isObjectMethod(e)||s.types.isClassPrivateMethod(e))return e.kind}},1974:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getNodeLocation=t.resolveScopeSymbols=t.resolveSymbol=t.getLocationList=void 0;const n=o(r(9023)),i=r(3073);function s(e,t){let r=t.name;const o=t.sourcemap_location_hints.map(t=>{const r=e({line:t.line,column:t.column});if(null===r.line||null===r.column)return{name:t.name,line:-1,column:-1,line_on_server:t.line_on_server,column_on_server:t.column_on_server};let o=r.name??t.name??void 0;return o?.startsWith("#")&&(o=o.slice(1)),{name:o,line:r.line,column:r.column,line_on_server:t.line_on_server,column_on_server:t.column_on_server,resolved:!0}});return o.length>0&&o.every(e=>e.name)&&(t.format?Array.from(t.format.matchAll(/%s/g)).length!==o.length?i.worker_logger.warn("Format string does not match number of location hints",{format:t.format,locationHints:o}):r=n.default.format(t.format,...o.map(e=>e.name)):r=o.map(e=>e.name).join(".")),{name:r,sourcemap_location_hints:o}}t.getLocationList=function(e,t){return e.loc?[{line:e.loc.start.line,column:e.loc.start.column,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column,name:t}]:[]},t.resolveSymbol=s,t.resolveScopeSymbols=function(e,t){const{context:r}=t,o=r.symbol?s(e,r.symbol):void 0,n=s(e,t.symbol);return{...t,context:{...r,symbol:o},symbol:n}},t.getNodeLocation=function(e,t,r=void 0){const o=e.loc?.start,n=e.loc?.end;if(!o||!n)return i.worker_logger.info("Node without location",{filename:r,type:e.type}),{start:{source:null,line:-1,column:-1},end:{source:null,line:-1,column:-1}};const s=t({line:o.line,column:o.column}),a=t({line:n.line,column:n.column});return null!==s.line&&null!==s.column&&null!==a.line&&null!==a.column||(i.worker_logger.debug("Could not find location for function",{filename:r,type:e.type,locStart:o,locEnd:n}),s.line=-1,s.column=-1,a.line=-1,a.column=-1),{start:{source:s.source,line:s.line,column:s.column},end:{source:a.source,line:a.line,column:a.column}}}},2030:e=>{e.exports=require("./instrument")},2213:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getHudAwaitSequenceElement=t.isHudAwaitSequence=void 0;const o=r(6346),n=r(1012),i=r(8138);t.isHudAwaitSequence=function(e){if(e.expressions.length<2)return!1;const t=e.expressions[e.expressions.length-1];return!!o.types.isIdentifier(t)&&!!t.name.startsWith(n.hudConfig.wrapVarPrefix)},t.getHudAwaitSequenceElement=function(e){const t=e.expressions[0];if(!o.types.isAssignmentExpression(t))throw new i.HudUnsupportedError("Expected assignment expression");const{left:r,right:s}=t;if(!o.types.isIdentifier(r)||!r.name.startsWith(n.hudConfig.wrapVarPrefix))throw new i.HudUnsupportedError("Expected identifier starting with "+n.hudConfig.wrapVarPrefix);return s}},2240:e=>{e.exports=require("./core")},2241:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1012),t),n(r(8287),t),n(r(8138),t),n(r(8808),t),n(r(2794),t),n(r(7582),t),n(r(3073),t),n(r(5290),t),n(r(5822),t),n(r(3699),t),n(r(4219),t),n(r(4451),t),n(r(2908),t),n(r(2451),t),n(r(3431),t),n(r(669),t),n(r(8066),t)},2298:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNamespaceScopeable=t.isHudScopeable=t.NamespaceScopeAlias=t.ScopableAlias=void 0;const o=r(6346);t.ScopableAlias="ArrowFunctionExpression|BlockStatement|CatchClause|ClassMethod|ClassPrivateMethod|DeclareModule|DoExpression|DoWhileStatement|ForInStatement|ForOfStatement|ForStatement|FunctionDeclaration|FunctionExpression|IfStatement|LabeledStatement|ObjectMethod|StaticBlock|SwitchCase|TSModuleBlock|TryStatement|WhileStatement|WithStatement|ClassDeclaration|ClassExpression|ObjectExpression|SwitchStatement",t.NamespaceScopeAlias="FunctionDeclaration|FunctionExpression|ArrowFunctionExpression|ObjectMethod|ClassMethod|ClassPrivateMethod|ClassDeclaration|ClassExpression|ObjectExpression",t.isHudScopeable=function(e){return o.types.isArrowFunctionExpression(e)||o.types.isBlockStatement(e)||o.types.isCatchClause(e)||o.types.isClassMethod(e)||o.types.isClassPrivateMethod(e)||o.types.isDeclareModule(e)||o.types.isDoExpression(e)||o.types.isDoWhileStatement(e)||o.types.isForInStatement(e)||o.types.isForOfStatement(e)||o.types.isForStatement(e)||o.types.isFunctionDeclaration(e)||o.types.isFunctionExpression(e)||o.types.isIfStatement(e)||o.types.isLabeledStatement(e)||o.types.isObjectMethod(e)||o.types.isProgram(e)||o.types.isStaticBlock(e)||o.types.isSwitchCase(e)||o.types.isTSModuleBlock(e)||o.types.isTryStatement(e)||o.types.isWhileStatement(e)||o.types.isWithStatement(e)||o.types.isClassDeclaration(e)||o.types.isClassExpression(e)||o.types.isObjectExpression(e)||o.types.isSwitchStatement(e)},t.isNamespaceScopeable=function(e){return o.types.isFunction(e)||o.types.isClass(e)||o.types.isObjectExpression(e)}},2451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUserTsNodeConfig=void 0;const o=r(8138),n=r(3073),i=r(8066);t.getUserTsNodeConfig=function(e=!0){const t=function(){try{const e=i.myRequire.resolve("ts-node");if(!e)return;if(!i.myRequire.cache[e])return;const t=(0,i.myRequire)("ts-node"),r=process[t.REGISTER_INSTANCE];if(!r)return;return r.options}catch(e){return}}();if(t){if(!t.transpileOnly)throw e&&n.customer_logger.log(o.UserErrorLogs.TsNodeNotTranspileOnly()),n.app_logger.warn("ts-node is used but not configured to transpile only"),new o.HudNoTranspileOnlyError;return{cwd:t.cwd,project:t.project,projectSearchDir:t.projectSearchDir}}if(process.argv[0].endsWith("ts-node"))throw e&&n.customer_logger.log(o.UserErrorLogs.TsNodeNotFoundEvenThoughRunWithTsNode()),n.app_logger.info("ts-node not found even run with ts-node"),new o.HudTsNodeNotFoundButUsed}},2546:e=>{e.exports=require("./lib")},2684:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectStoreConfigSchema=void 0;const o=r(1569),n=o.z.object({type:o.z.literal("s3")}),i=o.z.object({type:o.z.literal("disk"),path:o.z.string()});t.ObjectStoreConfigSchema=o.z.union([n,i])},2784:e=>{e.exports=require("../native/_index")},2794:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getConfigContent=t.HudFailedReadConfigError=t.isHudEnabled=void 0;const s=i(r(9896)),a=i(r(6928)),l=r(8138),u=r(3073);t.isHudEnabled=function(){if("false"===process.env.HUD_ENABLE)return!1;if(globalThis.forceHudEnable)return!0;let e,t;try{if(e=d(),e&&(t=JSON.parse(e.content),!1===t.enable))return!1}catch(t){throw t instanceof c&&"EACCES"===t.code?u.customer_logger.log(l.UserErrorLogs.ConfigInaccessible(t.path)):e&&u.customer_logger.log(l.UserErrorLogs.JSONErrorInUserConfig(e.source,t instanceof Error?t.message:void 0)),t}return"true"===process.env.HUD_ENABLE||!0===t?.enable};class c extends Error{path;code;constructor(e,t){super(),this.path=e,this.code=t}}function d(){if(process.env.HUD_CONFIG)return{content:process.env.HUD_CONFIG,source:"HUD_CONFIG"};const e=function(){try{const e=process.env.HUD_CONFIG_PATH;if(e)return s.existsSync(e)?e:void 0;let t=__dirname,r=0;for(;"/"!==t&&r<10;){const e=`${t}/hud.config`;if(s.existsSync(e))return e;t=a.dirname(t),r++}}catch(e){return}}();if(e)try{return{content:s.readFileSync(e,"utf8"),source:e}}catch(t){throw new c(e,t.code)}}t.HudFailedReadConfigError=c,t.getConfigContent=d},2908:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.suppressTraces=void 0;const o=r(1012),n=r(3073),i=r(8066);let s,a;try{const e=(0,i.myRequire)("@opentelemetry/api"),t=(0,i.myRequire)("@opentelemetry/core");s=e.context,a=t.suppressTracing,n.app_logger.info("OpenTelemetry exists",{suppressConfig:o.hudConfig.suppressTraces})}catch(e){n.app_logger.info("OpenTelemetry api/core does not exist")}t.suppressTraces=function(e){return function(...t){return o.hudConfig.suppressTraces&&s&&a?(n.app_logger.debug("Running with Suppressed traces"),s.with(a(s.active()),()=>e(...t))):e(...t)}}},2987:e=>{e.exports=require("perf_hooks")},3073:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.worker_logger=t.instrument_logger=t.app_logger=t.customer_logger=t.formatLogMessage=t.SafeLogger=t.renewFileTransports=t.getSavedLogs=t.getLogPath=t.WorkerPortTransport=void 0;const a=i(r(6982)),l=i(r(9896)),u=i(r(857)),c=i(r(6928)),d=i(r(5124)),p=s(r(1620)),m=r(9100),f={...process.env.HUD_DEBUG?m.hudConfig.logger.debug:m.hudConfig.logger.default,console:!!process.env.HUD_VERBOSE};class g extends p.default{_messeagesToSend=[];messagesLimit=m.hudConfig.loggerWorkerPortSizeLimit;messageDropCount=0;getMessagesToSend(){if(!this._messeagesToSend.length)return!1;const e=this._messeagesToSend;this.clearMessagesToSend();const t=this.messageDropCount;return this.messageDropCount=0,{logsBuf:this.formatMessagesToSend(e),messageDropCount:t}}clearMessagesToSend(){this._messeagesToSend=[]}formatMessagesToSend(e){return e.map(e=>JSON.stringify(e)).join("\n")}log(e,t){this._messeagesToSend.length>=this.messagesLimit?this.messageDropCount++:this._messeagesToSend.push(e),t()}}t.WorkerPortTransport=g;const y=d.format.combine(d.format.timestamp({format:"HH:mm:ss.SSS"}),d.format.printf(({level:e,message:t,timestamp:r,label:o,...n})=>{try{const i=Object.keys(n).length;let s;if(i)if(1===i){const e=Object.keys(n)[0];s=`${t} ${e}: ${JSON.stringify(n[e],null,2)}`}else s=`${t}\n${JSON.stringify(n,null,2)}`;else s=t;const a=d.format.colorize().colorize(e,e.toUpperCase());return`[${r}]${(o?`(${o})`:"").padEnd(8," ")} ${a}: ${s}`}catch(e){return t}}));function h(e){return d.format.combine(d.format.label({label:e}),d.format.timestamp({format:()=>(new Date).toISOString()}),d.format.json())}function v(e){return{filename:E(),level:f.levels[e],format:h(e),lazy:!1}}function _(){if(m.hudConfig.logDirectory)return m.hudConfig.logDirectory;const e=u.homedir();switch(u.platform()){case"darwin":return c.join(e,"Library","Logs","hud");case"win32":return c.join(e,"AppData","hud","Logs");default:return c.join(e,".hud","logs")}}let b;function E(){return b??=c.join(_(),`${a.randomUUID()}.log`)}t.getLogPath=E,t.getSavedLogs=function(){const e=[];for(const[t,r]of Object.entries(S))for(const t of r.transports)try{if(t instanceof g){const o=t.getMessagesToSend();if(!o)continue;const{logsBuf:n,messageDropCount:i}=o;i&&r.info(`Dropped ${i} messages`),e.push(n)}}catch(e){r.error("Failed to get saved logs",e)}return e},t.renewFileTransports=function(){const e=new Date,t=new Set;for(const[r,o]of Object.entries(S)){const r=[],n=[];for(const i of o.transports)if(i instanceof d.transports.File){r.push(i),n.push(new d.transports.File({level:i.level,format:i.format,filename:c.join(i.dirname,i.filename),lazy:!1}));const o=c.join(_(),`${a.randomUUID()}-${e.toISOString().replaceAll(":","")}.log`);l.existsSync(c.join(i.dirname,i.filename))&&(l.renameSync(c.join(i.dirname,i.filename),o),t.add(o))}for(const e of r)o.remove(e),e.close&&e.close();for(const e of n)o.add(e)}return t};const S={};class C{name;logger;constructor(e){this.name=e;try{this.logger=function(e){const t=[];f.console&&t.push(new d.transports.Console({format:d.format.combine(d.format.label({label:e}),y)}));let r=!1;if(!m.hudConfig.fileless)try{t.push(function(e){const t=v(e),r=c.dirname(t.filename);return l.mkdirSync(r,{recursive:!0}),l.writeFileSync(t.filename,"",{flag:"w"}),new d.transports.File(t)}(e))}catch{r=!0}(m.hudConfig.fileless||r)&&t.push(function(e){const t=h(e);return new g({format:t})}(e));const o=d.createLogger({level:f.levels[e],transports:t});return S[e]=o,r&&o.info("Could not create file transport, fallback succesfully to worker port"),m.hudConfig.fileless&&o.info("Fileless mode is enabled"),o}(e)}catch(e){this.logger=void 0}}isValid(){return!!this.logger}log(e,t,...r){if(this.logger)try{this.logger.log(e,t,...r)}catch{}}error(e,...t){this.log("error",e,...t)}warn(e,...t){this.log("warn",e,...t)}info(e,...t){this.log("info",e,...t)}http(e,...t){this.log("http",e,...t)}verbose(e,...t){this.log("verbose",e,...t)}debug(e,...t){this.log("debug",e,...t)}silly(e,...t){this.log("silly",e,...t)}}function w(e,t,r){let o=`Hud: ${e}`;return r&&(o+=" For more information visit https://docs.hud.io/docs/node-sdk-ie."),void 0!==t&&(o+=` ${t}`),o}t.SafeLogger=C,t.formatLogMessage=w,t.customer_logger=d.createLogger({level:m.hudConfig.customerLoggerLevel,transports:[new d.transports.Console({})],format:d.format.printf(({message:e,errCode:t,moreInfo:r})=>{try{return w(e,t,r)}catch(t){return e}})}),t.app_logger=new C("app"),t.instrument_logger=new C("instrument"),t.worker_logger=new C("worker")},3176:e=>{e.exports=require("buffer-crc32")},3312:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=void 0,t.SDK_VERSION="1.6.11"},3431:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.unrefSetInterval=t.unrefSetTimeout=t.unrefSetImmediate=void 0;const s=i(r(6460));t.unrefSetImmediate=function(e,t){return s.setImmediate(e,{...t,ref:!1})},t.unrefSetTimeout=function(e,t,r){return s.setTimeout(e,t,{...r,ref:!1})},t.unrefSetInterval=function(e,t,r){return s.setInterval(e,t,{...r,ref:!1})}},3699:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.shouldRunHud=t.isSupportedNative=t.isDebuggerAttached=void 0;const s=i(r(6592)),a=r(5919),l=r(1012),u=r(8138),c=r(4715),d=r(2794),p=r(3073);function m(){if("true"===process.env.HUD_ALLOW_DEBUGGER)return!1;if(process.execArgv.some(e=>e.includes("--inspect")||e.includes("--debug")||e.includes("--inspect-brk")||e.includes("--debug-brk")))return!0;try{return"string"==typeof s.url()}catch(e){return!1}}function f(){return void 0!==r(2784).transform}t.isDebuggerAttached=m,t.isSupportedNative=f,t.shouldRunHud=function(){return"false"===process.env.HUD_ENABLE?{shouldRun:!1,error:u.UserErrorLogs.HudEnableIsFalse()}:a.isMainThread?(0,d.isHudEnabled)()?process.versions.bun?{shouldRun:!1,error:u.UserErrorLogs.RunningInBun()}:function(){const e=process.versions.node.split(".")[0];return!!l.hudConfig.supportedNodeVersions.includes(e)}()?process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE&&!function(){try{return"1"===process.env.HUD_INTERNAL_EXEC_WRAPPER_USED}catch(e){return!1}}()?{shouldRun:!1,error:u.UserErrorLogs.LambdaNotViaLayer()}:m()?{shouldRun:!1,error:u.UserErrorLogs.DebuggerAttached()}:function(){const e=(0,c.getMemoryLimitInfo)();return!!(0,c.isMemoryLimitBigEnough)(e)}()?f()?{shouldRun:!0}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNativeBuild()}:{shouldRun:!1,error:u.UserErrorLogs.PodMemoryLimitTooLow(l.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER)}:{shouldRun:!1,error:u.UserErrorLogs.UnsupportedNodeVersion()}:{shouldRun:!1,error:u.UserErrorLogs.HudEnableNotSet(process.env.HUD_ENABLE)}:(p.app_logger.info("required not from main thread"),{shouldRun:!1,error:null})}},3903:e=>{e.exports=require("uuid")},4219:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.safeCall=void 0;const o=r(8138);t.safeCall=function(e,t){return t.catch(t=>{(0,o.isAbortError)(t)||e.error("Unhandled exception on async task",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})})}},4451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineSourceMaps=t.shouldSupportSourceMap=void 0;const o=r(1012),n=r(3073);t.shouldSupportSourceMap=function(){return!!o.hudConfig.supportSourceMap&&(process.execArgv.includes("--enable-source-maps")&&n.instrument_logger.warn("--enable-source-maps is set, enabling custom source-map-support anyway"),!0)},t.combineSourceMaps=function(e,t){if(0===e.length)return;if(1===e.length&&void 0===e[0].lineOffset)return e[0].map;const r=e.map(e=>({offset:{line:e.transformedLineOffset,column:e.transformedColumnOffset},map:{..."string"==typeof e.map?JSON.parse(e.map):e.map,file:t}})),o={version:3,file:t,sections:r};return JSON.stringify(o)}},4627:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateDynamicConfig=void 0;const o=r(9100);function n(e,t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(e)&&Array.isArray(t))return t;const r={...e};for(const o in t){const i=e[o],s=t[o];r[o]=n(i,s)}return r}t.updateDynamicConfig=function(e,t,r){const i=o.HudDynamicConfigSchema.deepPartial().safeParse(e);if(!i.success)return r.error("Dynamic configuration not updated - Invalid configuration override",{remoteConfigParseResult:i,remoteConfig:e}),t.dynamicConfig;const s=n(t.dynamicConfig,i.data);return void 0!==s.enableInvestigation&&s.enableInvestigation!==t.dynamicConfig.enableInvestigation&&(r.info("Dynamic configuration updated - enableInvestigation",{hudEnableInvestigation:s.enableInvestigation}),t.isInvestigationEnabledByEnv||(globalThis.hudEnableInvestigation=s.enableInvestigation)),s}},4634:e=>{e.exports=require("source-map")},4715:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isMemoryLimitBigEnough=t.getMemoryLimitInfo=void 0;const o=r(1012),n=r(3073),i=r(5290);t.getMemoryLimitInfo=function(){const e=(0,i.getPodMemoryLimit)(n.app_logger);return n.app_logger.info(`Pod memory limit: ${null===e.podMemoryLimitMB?"unknown":e.podMemoryLimitMB+"MB"} from ${e.source}, minimum required: ${o.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER}MB`),e},t.isMemoryLimitBigEnough=function(e){return null===e.podMemoryLimitMB||e.podMemoryLimitMB>=(o.hudConfig.userConfig.minPodMemoryMB?.value??Number.MAX_SAFE_INTEGER)}},5124:e=>{e.exports=require("winston")},5290:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPodMemoryLimit=void 0;const n=r(9896),i=o(r(857));let s=null;function a(e,t){const r=parseInt(e);if(isNaN(r))return null;const o=Math.floor(r/1048576);return o<=0||o>=131072?(t.debug(`Treating memory value (${e} bytes) as unlimited.`),null):o}function l(e,t,r){if(!e)return{podMemoryLimitMB:null,source:null};const o=a(e,r);return null!==o?{podMemoryLimitMB:o,source:t}:{podMemoryLimitMB:null,source:null}}function u(e){try{return(0,n.readFileSync)(e,"utf8")}catch{return null}}function c(){const e=i.default.totalmem();return{podMemoryLimitMB:Math.floor(e/1048576),source:"system-memory"}}t.getPodMemoryLimit=function(e){if(null!==s)return s;if("linux"!==i.default.platform())return s=c(),s;let t=function(e,t){for(const e of["/sys/fs/cgroup/memory.max","/sys/fs/cgroup/memory.high"]){const r=u(e);if(!r)continue;const o=r.trim();if("max"===o){t.debug(`Found 'max' value in ${e}, will use system memory instead`);continue}const n=a(o,t);if(null!==n)return{podMemoryLimitMB:n,source:e}}return{podMemoryLimitMB:null,source:null}}(0,e);return null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=function(e,t){for(const e of["/sys/fs/cgroup/memory/memory.stat","/sys/fs/cgroup/memory/memory.limit_in_bytes"]){const r=u(e);if(r)if(e.endsWith("memory.stat")){const o=["hierarchical_memory_limit","memory.limit_in_bytes","limit_in_bytes"],n=r.split("\n");for(const r of o){const o=n.find(e=>e.startsWith(r));if(o){const n=l(o.split(" ")[1],`${e}:${r}`,t);if(null!==n.podMemoryLimitMB)return n}}}else{const o=l(r.trim(),e,t);if(null!==o.podMemoryLimitMB)return o}}return{podMemoryLimitMB:null,source:null}}(0,e),null!==t.podMemoryLimitMB?(e.info(`Found pod memory limit: ${t.podMemoryLimitMB}MB from ${t.source}`),t):(t=c(),e.info(`No container memory limit found, using system memory: ${t.podMemoryLimitMB}MB`),s=t,t))}},5595:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getParameterInfo=void 0;const s=i(r(6346)),a=r(8528),l=r(3073);function u(e,t=0){if(void 0!==e.loc&&null!==e.loc)return{line:e.loc.start.line,column:e.loc.start.column+t,line_on_server:e.loc.start.line,column_on_server:e.loc.start.column+t}}function c(e){return s.types.isIdentifier(e.argument)?{name:e.argument.name,type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e,e.argument.name.length+3)}:(l.worker_logger.warn("Unsupported rest element",{type:e.argument.type}),{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e)})}function d(e){var t;if(e)switch(e?.type){case"Identifier":return{name:(t=e).name,type:a.ParameterTypes[t.type],sourcemap_location_hint:u(t,t.name.length)};case"AssignmentPattern":return function(e,t,r){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),left:t,right:r}}(e,d(e.left),function(e){switch(e.type){case"StringLiteral":case"NumericLiteral":case"BooleanLiteral":case"BigIntLiteral":case"DecimalLiteral":return{type:e.type,value:e.value};case"RegExpLiteral":return{type:e.type,value:e.pattern}}return{type:e.type}}(e.right));case"ArrayPattern":return function(e,t){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),elements:t}}(e,e.elements.map(e=>d(e)).filter(e=>void 0!==e));case"RestElement":return c(e);case"ObjectPattern":{const t=[];return e.properties.forEach(e=>{if(s.types.isObjectProperty(e)){const r=s.types.isIdentifier(e.key)&&s.types.isIdentifier(e.value)||s.types.isAssignmentPattern(e.value)?void 0:d(e.key);t.push(function(e,t,r){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),key:t,value:r}}(e,r,d(e.value)))}else s.types.isRestElement(e)&&t.push(c(e))}),function(e,t){return{type:a.ParameterTypes[e.type],sourcemap_location_hint:u(e),properties:t}}(e,t)}default:l.worker_logger.warn("Unsupported parameter type",{type:e.type})}}t.getParameterInfo=function(e,t){return e.node.params.map(e=>{try{return d(e)}catch(e){return}}).filter(e=>void 0!==e).map(e=>{let r;if(void 0!==e.sourcemap_location_hint){const{name:o,line:n,column:i}=t({line:e.sourcemap_location_hint.line,column:e.sourcemap_location_hint.column}),s={line_on_server:e.sourcemap_location_hint.line_on_server,column_on_server:e.sourcemap_location_hint.column_on_server};null===n||null===i?(l.worker_logger.debug("Could not find location for parameter",{type:e.type}),r={name:o??void 0,line:-1,column:-1,...s}):r={name:o??void 0,line:n,column:i,...s}}return{...e,name:r?.name??e.name,type:e.type,sourcemap_location_hint:r??e.sourcemap_location_hint}})}},5822:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.loopLogProcessPerformance=t.getCpuLimit=t.getCpuLimitUnsafe=t.loopLogThreadPerformance=void 0;const a=r(9896),l=s(r(857)),u=r(2987),c=i(r(1493)),d=r(2908),p=r(3431);function m(e){e.info("Trying to detect CPU limit");try{const t=(0,a.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_quota_us","utf8"),r=(0,a.readFileSync)("/sys/fs/cgroup/cpu/cpu.cfs_period_us","utf8");return e.info("CPU limit detected for cgroups v1",{cpuQuota:t,cpuPeriod:r}),"-1"===t?"unlimited":parseInt(t.toString())/parseInt(r.toString())}catch(t){try{const t=(0,a.readFileSync)("/sys/fs/cgroup/cpu.max","utf8"),[r,o,n]=t.trim().split(" ");return e.info("CPU limit detected for cgroups v2",{max:r,period:o}),r&&o?"max"===r?"unlimited":parseInt(r)/parseInt(o):void e.info("cpu.max file is not in the expected format",t)}catch(r){return void e.info("Failed to detect CPU limit",{e:t,e2:r})}}}let f;t.loopLogThreadPerformance=async function(e,t,r){let o=u.performance.eventLoopUtilization(),n=u.performance.nodeTiming.toJSON();for await(const i of(0,p.unrefSetInterval)(t,void 0,{signal:r}))try{const t=u.performance.eventLoopUtilization(),r=u.performance.eventLoopUtilization(t,o);o=t;const i=c.getHeapStatistics(),s=u.performance.nodeTiming.toJSON(),a=s.idleTime-n.idleTime,l=s.duration-n.duration,d=a/l;n=s,e.info("thread performance statistics",{thread_elu_percentage:100*r.utilization,memory:{thread_heap_utilization_percentage:i.total_heap_size/i.heap_size_limit*100},idleTime:a,totalTime:l,idleTimePercentage:d})}catch(t){e.error("Failed logging thread performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}},t.getCpuLimitUnsafe=m;let g=!1;t.getCpuLimit=e=>(g||(f=(0,d.suppressTraces)(m)(e),g=!0),f),t.loopLogProcessPerformance=async function(e,r,o){const n=l.default.totalmem(),i=(0,t.getCpuLimit)(e);let s=process.cpuUsage();for await(const t of(0,p.unrefSetInterval)(r,void 0,{signal:o}))try{const t=process.memoryUsage(),o=process.uptime(),a=process.cpuUsage(),l={user:a.user-s.user,system:a.system-s.system};s=a;let u=(l.user+l.system)/(1e3*r);i&&"number"==typeof i&&(u/=i),e.info("process performance statistics",{memory:{process_memory_rss:t.rss,process_memory_utilization_percentage:t.rss/n*100},cpu:100*u,cpuStats:{limit:i,usagePercentage:100*u},uptime:o})}catch(t){e.error("Failed logging process performance statistics",{msg:t instanceof Error?t.message:void 0,stack:t instanceof Error?t.stack:void 0})}}},5919:e=>{e.exports=require("node:worker_threads")},6346:e=>{e.exports=require("@babel/core")},6460:e=>{e.exports=require("timers/promises")},6592:e=>{e.exports=require("node:inspector")},6760:e=>{e.exports=require("node:path")},6827:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseDeclarations=t.readFile=t.getRealPositionFunc=t.fixSourceMap=void 0;const a=i(r(6346)),l=r(8528),u=s(r(9896)),c=r(4634),d=r(1622),p=s(r(6760)),m=r(1012),f=r(8528),g=s(r(3176)),y=r(2784),h=r(3903),v=r(3073),_=r(8066),b=r(7064),E=r(5595),S=r(7087),C=r(1974),w=r(2298),I={babelrc:!1,configFile:!1};function M(e){let t;return t="string"==typeof e?JSON.parse(e):e,t.sources=t.sources.map(e=>e.replace(/^webpack:\/\/(?:@[^/]+?[/])?[^/]+\//,"")),t}function x(e,t,r){return o=>{const n=e?.originalPositionFor({line:o.line,column:o.column})??{line:o.line,column:o.column,source:null,name:null},i=null!==n.line?n.line+(t||0):null,s=null!==n.column?n.column+(1===n.line&&r||0):null;return{...n,line:i,column:s}}}let O;t.fixSourceMap=M,t.getRealPositionFunc=x,t.readFile=async function(e,t,r){try{if(t&&r){const o=Buffer.alloc(r-t),n=await u.default.promises.open(e,"r");return await n.read(o,0,r-t,t),await n.close(),o.toString("utf-8")}return await u.default.promises.readFile(e,"utf-8")}catch(t){return void v.worker_logger.error("Failed to read file",{filename:e,msg:t instanceof Error?t.message:t})}},t.parseDeclarations=async function(e,t,r=null,o){const{filename:n,bundlerBuildId:i,bundlerBuildIdGenerated:s,lineOffset:u,columnOffset:k,file_path_checksum:T,file_checksum:D,functionIds:F,sourceCodeHash:L,moduleBase:P}=e;if(v.worker_logger.debug("Parsing code",{filename:n}),o)try{if(!O){const e=(0,_.myRequire)("ts-node");O=e.create({...o,transpileOnly:!0,typeCheck:!1})}const e=function(e,t,r){try{return r.compile(e,t)}catch(e){return void v.worker_logger.warn("ts file pass, but failed to compile with ts-node",{filename:t,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}(t,n,O);if(!e)return{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}};t=e}catch(e){return v.worker_logger.error("Failed to require and compile ts file",{filename:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0}),{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}}}else if(n.endsWith(".ts")||n.endsWith(".mts"))return v.worker_logger.error("ts file pass, but not found ts-options"),{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}};const H=(0,g.default)(t).readUInt32BE();if(H!==D)return v.worker_logger.warn("File checksum mismatch",{filename:n,file_path_checksum:T,diskFileChecksum:H,file_checksum:D,functionIds:F}),{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}};const U=u?null:(0,y.getSourceMap)(n,t);let j,N;try{null!==U&&(N=(0,g.default)(U).readUInt32BE(),m.hudConfig.userConfig.disableSourceMapsResolution?.value||(j=JSON.parse(U)))}catch(e){v.worker_logger.error("Failed to parse source map",{filename:n,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}const B=x(j?await new c.SourceMapConsumer(M(j)):void 0,u,k);v.worker_logger.debug("Parsing code",{filename:n});const A=[],R=await a.parseAsync(t,I);if(null===R)return v.worker_logger.warn("Failed parsing code to tree",{filename:n,file_path_checksum:T,diskFileChecksum:H,file_checksum:D,functionIds:F}),{declarations:[],blacklist:{file_path_checksum:T,file_checksum:D,uuids:F}};v.worker_logger.debug("Parsed code to tree",{filename:n});const q=[{type:l.EntityType.Program,symbol:{sourcemap_location_hints:[]},context:{},childrenCount:{},siblingIndex:0}],$=new Set;v.worker_logger.debug("Traversing declarations",{filename:n}),r?.postMessage("eventlooptime"),a.traverse(R,{[w.NamespaceScopeAlias]:{enter(e){const{node:r}=e;if(!(0,w.isNamespaceScopeable)(r))return;const o=q[q.length-1];let i=(0,S.getScope)(e);if(!i)return;i=(0,C.resolveScopeSymbols)(B,i);const s=o.childrenCount[i.type]||0,a={...i,childrenCount:{},siblingIndex:s};if(o.childrenCount[i.type]=s+1,q.push(a),$.add(r),e.isFunction()){const r=function(e,t,r,o,n,i,s){try{const l=e;let u=e.node.body.loc?.start?.index;if(void 0===u)throw new Error("Function node has no block start location");if(void 0===e.node.start||null===e.node.start||void 0===e.node.end||null===e.node.end)throw new Error("Function node has no start or end location");"ArrowFunctionExpression"===l.node.type&&l.node.body.extra?.parenthesized&&l.node.body.extra?.parenStart&&Number.isInteger(l.node.body.extra.parenStart)&&(u=l.node.body.extra.parenStart);const c=function(e,t,r,o){const n=o.slice(0,r),i=`${e}_${t}_${Buffer.byteLength(n,"utf8")}`;return(0,h.v5)(i,m.hudConfig.functionUuidNamespace).toString()}(t,r,u-(n-1),i),y=(a=i.slice(e.node.start,e.node.end),(0,g.default)(a).readUInt32BE().toString());if(!y)return void v.worker_logger.warn("Function hash not found",{functionID:c,filename:r});const _=l.node.async||!1,S=(0,C.getNodeLocation)(l.node,s),w=S.start.source??r,I=(0,b.getEntityType)(l),M=(0,d.getMethodKind)(l.node),x=(0,d.getContextualData)(l);x.symbol&&(x.symbol=(0,C.resolveSymbol)(s,x.symbol)),x.callback?.callee.symbol&&(x.callback.callee.symbol=(0,C.resolveSymbol)(s,x.callback.callee.symbol));const O=(0,E.getParameterInfo)(l,s),{siblingIndex:k,childrenCount:T}=o[o.length-1],D=o.slice(0,-1),F=(0,d.getFunctionIdentifier)(l),L=(0,C.resolveSymbol)(s,{name:F?.name,sourcemap_location_hints:F?(0,C.getLocationList)(F,F.name):(0,C.getLocationList)(l.node,void 0),format:F?"%s":void 0});return{module:p.default.parse(w).name,symbol:L,context:x,file:w,type:I,format:f.Format.cjs,parameters:O,async:_,start_line:S.start.line,end_line:S.end.line,start_column:S.start.column,source_code_hash:y,runtime_function_id:c,scope_chain:D,declarations_count:0,methodKind:M,siblingIndex:k,childrenCount:T,original_location:{file:r,start_line:e.node.loc?.start?.line,end_line:e.node.loc?.end?.line,start_column:e.node.loc?.start?.column,end_column:e.node.loc?.end?.column}}}catch(e){v.worker_logger.error("Failed to handle function",{filename:r,error:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}var a}(e,L,n,q,P,t,B);r&&A.push(r)}},exit(e){$.has(e.node)&&(q.pop(),$.delete(e.node))}}}),v.worker_logger.debug("Traversed declarations",{filename:n});const K=new Set(A.map(e=>e.runtime_function_id)),z=[],W=[];A.forEach(e=>{K.has(e.runtime_function_id)?z.push({...e,declarations_count:A.length,bundler_build_id:i,was_bundler_build_id_generated:s,has_input_map:void 0!==j,sourcemap_crc:N,file_path_checksum:T,file_checksum:D}):W.push(e)}),W.length>0&&v.worker_logger.warn("Function IDs mismatch, missing instrumentation",{filename:n,runtimeFunctionIds:F,missingInstrumentation:W}),new Set(F).forEach(e=>{K.has(e)&&K.delete(e)});const V=K.size>0;return V&&v.worker_logger.error("Function IDs mismatch, missing declerations",{filename:n,missingRuntimeFunctionIds:[...K]}),{declarations:z,blacklist:V?{file_path_checksum:T,file_checksum:D,uuids:[...K]}:void 0}}},6928:e=>{e.exports=require("path")},6982:e=>{e.exports=require("crypto")},7064:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getEntityIdentity=t.getEntityType=void 0;const o=r(6346),n=r(8528),i=r(3073);t.getEntityType=function(e){const{node:t}=e;return o.types.isFunctionDeclaration(t)?n.EntityType.FunctionDeclaration:o.types.isFunctionExpression(t)?n.EntityType.FunctionExpression:o.types.isArrowFunctionExpression(t)?n.EntityType.FunctionArrow:o.types.isObjectMethod(t)?n.EntityType.ObjectMethod:o.types.isStaticBlock(t)||o.types.isClassMethod(t)?n.EntityType.ClassMethod:o.types.isClassPrivateMethod(t)?n.EntityType.ClassPrivateMethod:o.types.isClassDeclaration(t)?n.EntityType.ClassDeclaration:o.types.isClassExpression(t)?n.EntityType.ClassExpression:o.types.isForInStatement(t)||o.types.isForOfStatement(t)||o.types.isForStatement(t)?n.EntityType.ForLoop:o.types.isBlockStatement(t)?function(e){const t=e.parentPath.node;if(!(o.types.isFunctionDeclaration(t)||o.types.isFunctionExpression(t)||o.types.isArrowFunctionExpression(t)||o.types.isClassMethod(t)||o.types.isObjectMethod(t)||o.types.isClassPrivateMethod(t)))if(o.types.isIfStatement(t)){if("consequent"===e.parentKey)return n.EntityType.IfConsequent;if("alternate"===e.parentKey)return n.EntityType.IfAlternate;if("test"===e.parentKey)return n.EntityType.IfTest}else{if(o.types.isBlockStatement(t)||o.types.isProgram(t))return n.EntityType.Block;if(o.types.isTryStatement(t)){if("block"===e.parentKey)return n.EntityType.Try;if("finalizer"===e.parentKey)return n.EntityType.Finally}else{if(o.types.isCatchClause(t))return;if(o.types.isWhileStatement(t))return"test"===e.parentKey?n.EntityType.WhileTest:n.EntityType.Do;if(o.types.isDoWhileStatement(t))return"test"===e.parentKey?n.EntityType.WhileTest:n.EntityType.Do;if(!(o.types.isForStatement(t)||o.types.isForInStatement(t)||o.types.isForOfStatement(t)))return;if("test"===e.parentKey)return n.EntityType.ForTest;if("body"===e.parentKey)return n.EntityType.ForBlock}}}(e):o.types.isProgram(t)?n.EntityType.Program:o.types.isDoWhileStatement(t)?n.EntityType.DoWhile:o.types.isWhileStatement(t)?n.EntityType.While:o.types.isCatchClause(t)?n.EntityType.Catch:o.types.isObjectExpression(t)?n.EntityType.ObjectExpression:o.types.isWithStatement(t)?n.EntityType.With:o.types.isSwitchStatement(t)?n.EntityType.Switch:o.types.isSwitchCase(t)?n.EntityType.SwitchCase:o.types.isTryStatement(t)?n.EntityType.TryCatch:o.types.isIfStatement(t)?n.EntityType.If:n.EntityType.Other},t.getEntityIdentity=function(e){return o.types.isFunctionDeclaration(e)?o.types.isIdentifier(e.id)?e.id:void i.worker_logger.info("Function declaration without an identifier"):o.types.isClassDeclaration(e)?o.types.isIdentifier(e.id)?e.id:void i.worker_logger.info("Class declaration without an identifier"):o.types.isFunctionExpression(e)||o.types.isClassExpression(e)?o.types.isIdentifier(e.id)?e.id:void 0:o.types.isClassMethod(e)?o.types.isIdentifier(e.key)?e.key:void i.worker_logger.info("Class method without an identifier"):o.types.isObjectMethod(e)?o.types.isIdentifier(e.key)?e.key:void i.worker_logger.info("Object method without an identifier"):o.types.isClassPrivateMethod(e)?o.types.isIdentifier(e.key.id)?e.key.id:void i.worker_logger.info("Class private method without an identifier"):void 0}},7087:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getScope=void 0;const o=r(7064),n=r(1974),i=r(1622);t.getScope=function(e){const t=(0,o.getEntityType)(e);if(t){const r=(0,o.getEntityIdentity)(e.node),s=r?.name;return{type:t,context:(0,i.getContextualData)(e),symbol:{name:s,sourcemap_location_hints:r?(0,n.getLocationList)(r,s):(0,n.getLocationList)(e.node,void 0),format:r?"%s":void 0},methodKind:(0,i.getMethodKind)(e.node)}}}},7582:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.nextLoopDummy=void 0;const r=`http://${process.env.AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension`;async function o(e){return await fetch(`${r}/event/next`,{method:"get",headers:{"Content-Type":"application/json","Lambda-Extension-Identifier":e}})}t.nextLoopDummy=async function(e){for(;;)try{(await o(e)).ok||await new Promise(e=>setTimeout(e,50))}catch(e){await new Promise(e=>setTimeout(e,50))}}},8066:(e,t)=>{let r;Object.defineProperty(t,"__esModule",{value:!0}),t.myRequire=void 0;try{r=require}catch(e){r=void 0}t.myRequire=r},8138:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getNetworkError=t.UserErrorLogs=t.setFirstError=t.getFirstError=t.isAbortError=t.HudNoMessageInSqsConsumerEmit=t.HudNoErrorInSqsConsumerEmit=t.HudNoEventTypeInSqsConsumerEmit=t.HudFailExtractSqsQueueName=t.HudNoCallbackInSqsConsumerOn=t.HudNoEventTypeInSqsConsumerOn=t.HudNoQueueUrlInSqsConsumer=t.HudSqsError=t.HudExtensionNextFailedError=t.HudExtensionRegisterError=t.HudExtnensionError=t.HudBadLoggerError=t.HudInitNetworkError=t.HudTsNodeNotFoundButUsed=t.HudSessionThrottle=t.HudNoTranspileOnlyError=t.HudClientExceededMaxRetries=t.HudClientUnauthorizedError=t.HudTimeoutError=t.HudWorkloadCollectorError=t.HudAssert=t.HudUnsupportedError=t.HudEditError=t.HudWorkerError=t.HudClientError=t.HudInitError=t.HudError=void 0;const o=r(1012);class n extends Error{code=9e3;name=this.constructor.name;constructor(e){super(e)}}t.HudError=n;class i extends n{code=9001}t.HudInitError=i,t.HudClientError=class extends n{code=9002;originalAxiosErrorCode;constructor(e,t){super(e),this.originalAxiosErrorCode=t}},t.HudWorkerError=class extends n{code=9003};class s extends n{code=9004}t.HudEditError=s,t.HudUnsupportedError=class extends s{code=9005},t.HudAssert=class extends s{code=9006},t.HudWorkloadCollectorError=class extends n{code=9007},t.HudTimeoutError=class extends n{code=9008},t.HudClientUnauthorizedError=class extends n{code=9009},t.HudClientExceededMaxRetries=class extends n{code=9010},t.HudNoTranspileOnlyError=class extends n{code=9011},t.HudSessionThrottle=class extends i{code=9012},t.HudTsNodeNotFoundButUsed=class extends n{code=9013},t.HudInitNetworkError=class extends n{code=9014;originalAxiosErrorCode;constructor(e,t){super(e),this.originalAxiosErrorCode=t}},t.HudBadLoggerError=class extends n{code=9101};class a extends n{code=9200}t.HudExtnensionError=a,t.HudExtensionRegisterError=class extends a{code=9201},t.HudExtensionNextFailedError=class extends a{code=9202};class l extends n{code=9250}t.HudSqsError=l,t.HudNoQueueUrlInSqsConsumer=class extends l{code=9251},t.HudNoEventTypeInSqsConsumerOn=class extends l{code=9252},t.HudNoCallbackInSqsConsumerOn=class extends l{code=9253},t.HudFailExtractSqsQueueName=class extends l{code=9254},t.HudNoEventTypeInSqsConsumerEmit=class extends l{code=9255},t.HudNoErrorInSqsConsumerEmit=class extends l{code=9256},t.HudNoMessageInSqsConsumerEmit=class extends l{code=9257},t.isAbortError=function(e){return e instanceof Error&&"AbortError"===e.name};let u=9999;t.getFirstError=function(){return u},t.setFirstError=function(e){e&&9999===u&&(u=e)},t.UserErrorLogs={HudServiceNotSet:()=>({level:"error",errCode:"E1001",moreInfo:!0,message:"Can't load Hud, HUD_SERVICE was not set. Please set service name using the environment variable HUD_SERVICE."}),HudServiceInvalid:()=>({level:"error",errCode:"E1002",moreInfo:!0,message:"Can't load Hud, HUD_SERVICE value has invalid service name. Please set service name using the environment variable HUD_SERVICE."}),HudApiKeyNotSet:()=>({level:"error",errCode:"E1004",moreInfo:!0,message:"Can't load Hud, HUD_KEY was not set. Please set API key using the environment variable HUD_KEY."}),HudApiKeyInvalid:()=>({level:"error",errCode:"E1005",moreInfo:!0,message:"Can't load Hud, HUD_KEY value has invalid API key. Please set a valid key in environment variable HUD_KEY."}),BothApiKeyAndServiceNotSet:()=>({level:"error",errCode:"E1007",moreInfo:!0,message:"Can't load Hud, HUD_KEY and HUD_SERVICE were not set. Please set API key using the environment variable HUD_KEY and service name using the environment variable HUD_SERVICE."}),InvalidTag:()=>({level:"warn",errCode:"E1008",moreInfo:!0,message:"HUD_TAGS should be of type Key-Value Object, defaulting to empty tags. Please set valid tags in environment variable HUD_TAGS."}),TagWithDots:()=>({level:"warn",errCode:"E1009",moreInfo:!0,message:"HUD_TAGS keys can't contain dots; they have been replaced with underscores."}),TagsInvalidJson:()=>({level:"warn",errCode:"E1010",moreInfo:!0,message:"Can't load Hud, HUD_TAGS is not a valid JSON, defaulting to empty tags. Please set valid tags in environment variable HUD_TAGS."}),ApiKeyDenied:e=>({level:"error",errCode:"E1011",moreInfo:!0,message:`Can't load Hud, the provided key is invalid. Please provide a valid HUD_KEY in your ${{ENV:"environment variable",CONFIG_FILE:"file",CONFIG_ENV:"HUD_CONFIG",INIT:"init function",SETUP:"setup function"}[e]}.`}),ShutdownGracefully:e=>({level:"error",errCode:`E${e}`,message:"SDK has initiated a graceful shutdown. Your application remains unaffected"}),UnsupportedNodeVersion:()=>({level:"error",errCode:"E1012",moreInfo:!0,message:"Can't load Hud due to an unsupported node version."}),UnsupportedSyntax:()=>({level:"error",errCode:"E1014",moreInfo:!0,message:"Can't load Hud due to an unsupported syntax version."}),UnsupportedLambdaMemory:()=>({level:"error",errCode:"E1015",moreInfo:!0,message:`Can't load Hud as lambda function memory size is less than ${o.hudConfig.lambdaMinimunMemory}MB.`}),JSONErrorInUserConfig:(e,t)=>({level:"error",errCode:"E1016",moreInfo:!0,message:`Can't load Hud, the config file contains an invalid JSON. Please set a valid json in Hud's config ${e}`+(t?`, Error: ${t}.`:".")}),ZodErrorInUserConfig:(e,t)=>({level:"error",errCode:"E1017",moreInfo:!0,message:`Can't load Hud, the config file contains an invalid value for field: ${t}. Please set a valid value for ${t} in the config ${e}.`}),ConfigInaccessible:e=>({level:"error",errCode:"E1018",moreInfo:!0,message:`Can't load Hud, the config file is inaccessible. Please make sure your node application has read permissions to the Hud config file, ${e}.`}),SetupCalledWithoutKey:()=>({level:"error",errCode:"E1019",moreInfo:!0,message:"API key not found or invalid. SDK has initiated a graceful shutdown. Your application remains unaffected."}),SetupCalledWithoutService:()=>({level:"error",errCode:"E1020",moreInfo:!0,message:"Service name parameter not found or invalid. SDK has initiated a graceful shutdown. Your application remains unaffected."}),HudEnableIsFalse:()=>({level:"warn",errCode:"E1021",moreInfo:!0,message:"HUD_ENABLE is set to false. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InstrumentedFunctionCountExceeded:e=>({level:"error",errCode:"E1022",moreInfo:!0,message:`SDK limit of ${e} instrumented functions exceeded. SDK has initiated a graceful shutdown. Your application remains unaffected.`}),PodMemoryLimitTooLow:e=>({level:"error",errCode:"E1023",moreInfo:!0,message:`Insufficient memory available. Minimum required:(${e}MB). SDK has initiated a graceful shutdown. Your application remains unaffected.`}),DebuggerAttached:()=>({level:"error",errCode:"E1024",message:"Did not load as debugger is attached."}),InitSessionBeforeRegister:()=>({level:"error",errCode:"E1025",moreInfo:!0,message:"register() was not called, or called after initSession() - please call register() before initSession() and run again. Your application continues normally without Hud."}),RegisterMisplacedNoDeclarations:()=>({level:"warn",errCode:"E1026",moreInfo:!0,message:"Warning - No code has been mapped so far. This probably means register() was called too late — after your code was already loaded. Move it to the top of your entry file to enable proper mapping. Your application continues normally without Hud data."}),UnsupportedFrameworkVersion:e=>({level:"warn",errCode:"E1029",message:`Warning - Unsupported version of ${e} framework(s). This means Hud won't track your framework invocations. Your application continues normally, but with partial Hud data. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node#/`}),UninstrumentedFilesLogThresholdExceeded:e=>({level:"warn",errCode:"E1027",message:`Warning - ${e} of your code files were imported before register(). This means Hud won't track all of your functions. Please move register() call to an earlier location. To view the list of files use register({verbose: true}). Your application continues normally, but with partial Hud data.`,moreInfo:!0}),UninstrumentedFrameworks:e=>({level:"warn",errCode:"E1028",message:`Warning - The framework(s): ${e.map(e=>`"${e}"`).join(", ")} was imported before register(). This means Hud won't track your framework invocations. Please move register() call to an earlier location. Your application continues normally, but with partial Hud data.`}),YesDeclarationsNoMetrics:()=>({level:"warn",errCode:"E1032",moreInfo:!0,message:"Warning - Code mapped successfully, but no function activity was tracked. Make sure your service is running and actively handling requests."}),HudEnableNotSet:e=>({level:"error",moreInfo:!0,message:`Did not load as HUD_ENABLE is ${void 0===e?"undefined":"set to a non-true value"}. Please set HUD_ENABLE=true to run Hud.`}),LambdaNotViaLayer:()=>({level:"error",errCode:"E1034",message:"Can't load Hud, lambda support is currently in beta. Contact Hud to get early access."}),RunningInBun:()=>({level:"error",errCode:"E1035",message:"Hud does not support Bun yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),RunningOnWindows:()=>({level:"error",errCode:"E1036",message:"Hud does not support Windows yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),UnsupportedNativeBuild:()=>({level:"error",errCode:"E1037",message:"Hud does not support this platform yet. The SDK has initiated a graceful shutdown. Your application remains unaffected. See the compatibility matrix for details: https://docs.hud.io/docs/hud-sdk-compatibility-matrix-for-node"}),TsNodeNotTranspileOnly:()=>({level:"error",errCode:"E1038",message:"detected ts-node is used without the transpileOnly flag, which is not supported yet. SDK has initiated a graceful shutdown. Your application remains unaffected.",moreInfo:!0}),TsNodeNotFoundEvenThoughRunWithTsNode:()=>({level:"error",errCode:"E1039",message:"'ts-node' was detected but could not be resolved by Hud. This may happen if 'ts-node' is installed globally. Try installing it locally in your project. The SDK has initiated a graceful shutdown. Your application remains unaffected.",moreInfo:!0}),InitFailedDueGenericNetworkError:()=>({level:"error",moreInfo:!0,errCode:"E1040",message:"A network error occurred during SDK initialization. Please check your internet connection and try again. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueNetworkTimeout:()=>({level:"error",moreInfo:!0,errCode:"E1041",message:"The SDK failed to connect to Hud's backend due to a timeout during SDK initialization. Please verify your firewall settings to ensure outbound connections are allowed. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueNetworkRST:()=>({level:"error",moreInfo:!0,errCode:"E1042",message:"The SDK connection to Hud's backend was reset unexpectedly (RST) during SDK initialization. Please check your firewall or network security settings. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueSelfSignedCert:()=>({level:"error",moreInfo:!0,errCode:"E1043",message:"SSL certificate verification failed during SDK initialization. If your organization uses a self-signed certificate, set the NODE_EXTRA_CA_CERTS environment variable to the path of your CA certificate file. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueDnsFailed:()=>({level:"error",moreInfo:!0,errCode:"E1044",message:"The SDK failed to resolve DNS when attempting to connect to Hud's backend during SDK initialization. If the problem persists, please contact support. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitFailedDueBackendError:()=>({level:"error",moreInfo:!0,errCode:"E1045",message:"Hud: The SDK was unable to complete initialization due to a temporary issue with Hud’s backend. SDK has initiated a graceful shutdown. Your application remains unaffected."}),InitTimeout:e=>({moreInfo:!0,level:"error",message:`SDK imported but not initialized. Please ensure to call '${e?"hud.initSession(KEY, SERVICE)":"hud.init()"}' to initialize the SDK.`}),RehookCalledBeforeRegister:()=>({level:"error",errCode:"E1046",moreInfo:!0,message:"register() was not called, or called after rehook() - please call register() before rehook() and run again. Your application continues normally with partial hud data."}),EsbuildMissingKey:()=>({level:"error",errCode:"ES0001",moreInfo:!0,message:"missing HUD_KEY, skipping Hud plugin, your build is unaffected."}),EsbuildFailedProcessingFile:e=>({level:"error",errCode:"ES0002",moreInfo:!0,message:`failed processing file "${e}", reverting to original loader.`}),EsbuildFailedBundling:()=>({level:"error",errCode:"ES0003",moreInfo:!0,message:"encountered unexpected file bundling, build aborted."}),EsbuildFailedParsingSourcemap:()=>({level:"error",errCode:"ES0004",moreInfo:!0,message:"failed parsing source maps, skipping upload, Hud will run without source maps."}),EsbuildFailedUploadingSourcemap:e=>({level:"error",errCode:"ES0005",moreInfo:!0,message:`failed uploading source map: ${e}, Hud will run without source maps.`}),EsbuildFailedUploadingSourcemapUnauthorized:()=>({level:"error",errCode:"ES0006",moreInfo:!0,message:"failed uploading source map: unauthorized, Hud will run without source maps."}),EsbuildUnsupportedPlatform:()=>({level:"error",errCode:"ES0007",message:'Can\'t load Hud, as our esbuild plugin supports "node" mode only. Your app remains unaffected. For more information visit docs.hud.io/docs/support-matrix'}),EsbuildUnsupportedWindows:()=>({level:"error",errCode:"ES0008",message:"Can't load Hud, as our esbuild plugin does not supports windows. Your app remains unaffected. For more information visit docs.hud.io/docs/support-matrix"})},t.getNetworkError=function(e){return{ECONNABORTED:t.UserErrorLogs.InitFailedDueNetworkTimeout(),ECONNREFUSED:t.UserErrorLogs.InitFailedDueNetworkRST(),ENOTFOUND:t.UserErrorLogs.InitFailedDueDnsFailed(),SELF_SIGNED_CERT_IN_CHAIN:t.UserErrorLogs.InitFailedDueSelfSignedCert(),ERR_BAD_RESPONSE:t.UserErrorLogs.InitFailedDueBackendError()}[e]??t.UserErrorLogs.InitFailedDueGenericNetworkError()}},8269:e=>{e.exports=require("./globalstate")},8287:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(6827),t)},8528:e=>{e.exports=require("./dto")},8808:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateSqsFlowId=t.generateKafkaFlowId=t.generateGraphqlFlowId=t.generateEndpointFlowId=void 0;const o=r(3903),n="fa79d8b7-069c-4bbf-9c00-34bfc8b3a5a6";t.generateEndpointFlowId=function(e,t){return(0,o.v5)(`${e.toString()}|${Array.from(t).sort().join(",")}`,n)},t.generateGraphqlFlowId=function(e,t){return(0,o.v5)(`${e}|${t}`,n)},t.generateKafkaFlowId=function(e,t,r){return(0,o.v5)(`${e.toString()}|${t}|${r}`,n)},t.generateSqsFlowId=function(e,t,r=""){const i=`${e}|${t}|${r}`;return(0,o.v5)(i,n)}},8809:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_MODULE_NAME=void 0,t.SDK_MODULE_NAME="hud-sdk"},9023:e=>{e.exports=require("util")},9100:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.updateInvestigationRateLimitGlobals=t.hudConfig=t.isValidParam=t.getModulesToTraceFromEnv=t.HudDynamicConfigSchema=void 0;const n=o(r(6928)),i=r(1569);t.HudDynamicConfigSchema=i.z.object({aggregationInterval:i.z.number(),flowMetricInterval:i.z.number(),graphqlInterval:i.z.number(),aggregationFirstSendTimeout:i.z.number(),flowMetricFirstSendTimeout:i.z.number(),enableInvestigation:i.z.boolean(),investigationRateLimits:i.z.object({maxSameInvestigations:i.z.number().int().positive(),sameInvestigationTimeWindowMs:i.z.number().int().positive(),maxTotalInvestigations:i.z.number().int().positive(),totalInvestigationTimeWindowMs:i.z.number().int().positive(),maxUniqLogs:i.z.number().int().positive()}),machineMetricsInterval:i.z.number().int().positive(),blacklistParams:i.z.array(i.z.string()),censorshipRegexes:i.z.array(i.z.object({regex:i.z.string(),replacement:i.z.string()}))}),t.getModulesToTraceFromEnv=function(){const e=process.env.HUD_MONITOR_MODULES||process.env.HUD_INCLUDE_MODULES;if(e)return e.split(",")},t.isValidParam=function(e){return null!=e&&""!==e&&"string"==typeof e};const s=process.env.HUD_ENABLE_INVESTIGATION,a=process.env.HUD_HOST||"https://api-prod.hud.io",l=process.env.HUD_LOG_DIR,u="_HUD",c=process.env.HUD_LOG_TO_FILE,d={sink:{url:a,timeout:5e3,session_attr:"X-Session-ID"},endpoints:{init:"sink/init",send:"sink/send",batch:"sink/batch",logs:"sink/logs",fatalError:"sink/redline",getMode:"sink/getMode",getRemoteConfig:"sink/remote-config/get",fileDeclarations:"sink/file-declarations",sourceMap:"sink/sourcemap",storeObject:"sink/objects/store"},logger:{default:{levels:{app:"warn",worker:"warn",instrument:"warn"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},investigation:{objectVersion:"1.0.1",store:{type:"s3"},limits:{executionFlowMaxLength:100,exceptionMaxLength:100},maxStringLength:1024,maxArrayLength:100,maxObjectDepth:10},userConfig:{minPodMemoryMB:{value:250,source:"DEFAULT"},maxMappedFunctions:{value:5e4,source:"DEFAULT"},maxFileSizeBytes:{value:2831155,source:"DEFAULT"},maxTimeUntilInitSessionMs:{value:3e4,source:"DEFAULT"},includeModules:{value:[],source:"DEFAULT"}},loggerWorkerPortSizeLimit:1e4,customerLoggerLevel:"info",logDirectory:l,invocationSampling:new Map([[[300n,null],100],[[200n,300n],50],[[100n,200n],25],[[0n,100n],10]]),callerResetInterval:36e5,modeInterval:3e5,logsSendInterval:6e4,logPerfInterval:3e5,endpointsInterval:18e5,endpointsFirstSendWaitTime:12e4,huddBinWidth:1.2,workerGrace:6e4,workerTimeout:2e4,timeoutOnRegister:6e4,timeoutOnMetrics:6e4,workerMessageTimeout:1e4,communicationBatchSize:100,writePatched:!1,defaultOff:!0,disableOnBadApiKey:!0,disableOnBadServiceName:!0,cpuTimeCollection:!1,workloadMetadata:{sendInterval:3e5,aws:{imds:{baseURL:"http://169.254.169.254/latest",tokenURI:"/api/token",identityURI:"/dynamic/instance-identity/document",lifeCycleURI:"/meta-data/instance-life-cycle",requestTimeout:5e3},metadataFile:"/run/cloud-init/instance-data.json"},kubernetes:{namespaceFile:"/var/run/secrets/kubernetes.io/serviceaccount/namespace",uuidFile:"/sys/class/dmi/id/product_uuid",podMemoryLimitFile:"/sys/fs/cgroup/memory/memory.stat",podCPULimitFile:"/sys/fs/cgroup/cpuacct/cpu.shares"}},deleteLogsAfterSending:!0,supportSourceMap:!0,editInline:!0,bundlerBuildIdVarName:"hudFileBuildID",bundlerBuildUuidNamespace:"00c1e90b-af75-4d8e-9935-68485877f759",functionUuidNamespace:"94a210f3-861c-4e18-ab27-6b6c19437c9d",wrapVarPrefix:u,functionIdVarName:`${u}_fid`,frameworksToPatch:new Map([["express",{version:"<=5",patcher:"express",enableEsbuild:!0}],[n.default.join("express","lib","application.js"),{version:"<=5",patcher:"expressApplication",enableEsbuild:!0}],["router",{version:"^2.0.0",patcher:"router",enableEsbuild:!0}],["koa",{version:"^2.0.0",patcher:"koa"}],["http",{version:"*",patcher:"http"}],["https",{version:"*",patcher:"http"}],["@nestjs/core/interceptors/interceptors-consumer",{version:"*",patcher:"nestjsInterceptor"}],["@nestjs/core/router/router-execution-context",{version:"*",patcher:"nestjsRouterExecutionContext"}],..."win32"!==process.platform?[["kafkajs",{version:">=1.4.0",patcher:"kafkajs"}],["@nestjs/microservices/context/rpc-context-creator",{version:">=7.0.0",patcher:"nestjsRpcContextCreator"}]]:[],[["@codegenie/serverless-express","src","frameworks","express.js"].join(n.default.sep),{version:"^4.1.0",patcher:"codeGenieServerlessExpress",enableEsbuild:!0}],["@codegenie/serverless-express",{enableEsbuild:!0}],["sqs-consumer",{version:"*",patcher:"sqsConsumer",extraInfo:{mondayVersion:">=6.1.0",bbcVersion:">=7.5.0"}}],["serverless-http",{enableEsbuild:!0}],[n.default.join("serverless-http","lib","framework","get-framework.js"),{version:"^2.7.0",patcher:"serverlessHttp",enableEsbuild:!0}]]),communicationKeepalive:!1,communicationKeepaliveGrace:5e3,express:{routeNamesSymbol:Symbol.for("hudRoutes"),layerStateSymbol:Symbol.for("hudState"),markedSymbol:Symbol.for("hudMarked"),wrapAllCallbacks:!0},supportedNodeVersions:["18","20","21","22","24"],hudPatchedName:"hudPatched",metricSymbol:Symbol.for("hudMetric"),dynamicConfig:{aggregationInterval:3e5,flowMetricInterval:3e5,graphqlInterval:3e4,aggregationFirstSendTimeout:3e4,flowMetricFirstSendTimeout:3e4,enableInvestigation:"true"===s,investigationRateLimits:{maxSameInvestigations:2,sameInvestigationTimeWindowMs:36e5,maxTotalInvestigations:25,totalInvestigationTimeWindowMs:216e5,maxUniqLogs:2},machineMetricsInterval:1e4,blacklistParams:[],censorshipRegexes:[]},machineMetricsSavedLength:2,isInvestigationEnabledByEnv:void 0!==s,suppressTraces:!0,lambdaMinimunMemory:1024,lambdaBaseGivenTime:400,lambdaExtraGivenTimePerRequest:50,lambdaMaxGivenTime:700,throttleStatusCode:202,esbuildGlobalVar:"hudSGV",esbuildPluginMessagePrefix:"ESBuild plugin ",esbuildMark:"/*modifiedByHudESBuildPlugin-",esbuildMarkLength:67,esbuildUploadSourceMapTimeout:15e3,esbuildPluginLogsChunkSize:100,esbuildPluginLogsBatchSize:10,pluginsLogEndpoint:"https://yqp37dddrsewm6wdwwpwfraxqm0shdmx.lambda-url.eu-central-1.on.aws/",fileless:"true"!==c,uninstrumentedFilesLogThreshold:2,tsNodeConfigTimeout:1e4,allowedEditExtensions:[".ts",".cts",".mts",".js",".cjs",".mjs"]};t.hudConfig=function(e={}){return{...d,...e}}({logger:{default:{levels:{app:"info",worker:"info",instrument:"info"}},debug:{levels:{app:"debug",worker:"debug",instrument:"debug"}}},deleteLogsAfterSending:!1,communicationKeepalive:!0}),t.default=t.hudConfig,t.updateInvestigationRateLimitGlobals=function(){globalThis.hudMaxSameInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxSameInvestigations,globalThis.hudMaxTotalInvestigations=t.hudConfig.dynamicConfig.investigationRateLimits.maxTotalInvestigations,globalThis.hudSameInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.sameInvestigationTimeWindowMs)*BigInt(1e6),globalThis.hudTotalInvestigationTimeWindowNs=BigInt(t.hudConfig.dynamicConfig.investigationRateLimits.totalInvestigationTimeWindowMs)*BigInt(1e6)}},9896:e=>{e.exports=require("fs")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}var o={};return(()=>{var e=o;Object.defineProperty(e,"__esModule",{value:!0}),e.rehook=e.register=e.initSession=void 0;let t=!1,n=!1;function i(){const{customer_logger:e,app_logger:t,UserErrorLogs:o}=r(2546);t.warn("No declarations found, register() was called too late"),e.log(o.RegisterMisplacedNoDeclarations())}e.initSession=async function(e,o){try{const{customer_logger:i}=r(2546),{UserErrorLogs:s}=r(2546),{clearInitGuard:a}=r(8269),{init:l}=r(2240);if(a(),!t)return void i.log(s.InitSessionBeforeRegister());if(!n)return;return e&&""!==e&&"string"==typeof e?o&&""!==o&&"string"==typeof o?await l(e,o):void i.log(s.SetupCalledWithoutService()):void i.log(s.SetupCalledWithoutKey())}catch(e){"true"!==process.env.HUD_VERBOSE&&"true"!==process.env.HUD_DEBUG||console.log(e)}},e.register=function(e){try{const{forceHudEnable:o,saveInstrumentationIndicator:s,saveHudRunningFromSetup:a}=r(8269);t=!0,o();const{updateUserConfigFromInitOptions:l,hudConfig:u,customer_logger:c,shouldRunHud:d,updateUserConfigFromFile:p}=r(2546),{registerHook:m}=r(2030),{logRegisterInRightLocation:f}=r(1256);e&&l(e,"SETUP"),p();const g=d();if(!g.shouldRun)return void(null!==g.error&&c.log(g.error));m()&&(n=!0,f(e?.verbose??!1)),s(setTimeout(i,u.timeoutOnRegister)),a()}catch{}},e.rehook=function(){const{patchCompile:e}=r(2030),{customer_logger:o,UserErrorLogs:i}=r(2546);t?n&&e():o.log(i.RehookCalledBeforeRegister())}})(),o})());
2
2
  //# sourceMappingURL=on_setup.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hud-sdk",
3
- "version": "1.6.10",
3
+ "version": "1.6.11",
4
4
  "description": "Hud's Node SDK",
5
5
  "homepage": "https://www.hud.io/",
6
6
  "keywords": [