eve 0.79.2 → 0.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/src/compiled/.vendor-stamp.json +6 -6
- package/dist/src/compiled/@chat-adapter/slack/api.d.ts +6 -0
- package/dist/src/compiled/@chat-adapter/slack/api.js +1 -1
- package/dist/src/compiled/@chat-adapter/slack/blocks.js +1 -1
- package/dist/src/compiled/@chat-adapter/slack/format.js +1 -1
- package/dist/src/compiled/@chat-adapter/slack/index.d.ts +14 -8
- package/dist/src/compiled/@chat-adapter/slack/index.js +33 -32
- package/dist/src/compiled/@chat-adapter/twilio/index.d.ts +37 -1
- package/dist/src/compiled/@chat-adapter/twilio/index.js +2 -2
- package/dist/src/compiled/@linqapp/chat-sdk-adapter/index.js +1 -1
- package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +1 -1
- package/dist/src/compiled/@vercel/connect/index.js +5 -5
- package/dist/src/compiled/@vercel/connect/token.d.ts +11 -1
- package/dist/src/compiled/_chunks/node/chunk-NBSLXVG3-Bt7pDfyn.js +12 -0
- package/dist/src/compiled/_chunks/node/dist-BKsV21Vu.js +6 -0
- package/dist/src/compiled/_chunks/node/dist-CO_n_hUa.js +98 -0
- package/dist/src/compiled/chat/index.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +6 -6
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +8 -4
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-connection.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/context/schedule-collection-tools.js +1 -1
- package/dist/src/execution/catalog/connection-auth.d.ts +4 -2
- package/dist/src/execution/catalog/connection-auth.js +1 -1
- package/dist/src/execution/catalog/connection-entry.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session-event-stream.js +1 -1
- package/dist/src/execution/stable-workflow-names.d.ts +2 -0
- package/dist/src/execution/stable-workflow-names.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/web-fetch/execute.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +6 -0
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/extensions/git/extension/extension.d.ts +3 -1
- package/dist/src/extensions/git/extension/extension.js +1 -1
- package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-shell.d.ts +14 -0
- package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
- package/dist/src/harness/model-call/call.js +1 -1
- package/dist/src/harness/model-call/errors.d.ts +2 -2
- package/dist/src/harness/model-call/recovery.d.ts +2 -3
- package/dist/src/instrumentation/session-init.d.ts +2 -1
- package/dist/src/instrumentation/session-init.js +1 -1
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/authored-definition/schedule-collection.js +1 -1
- package/dist/src/internal/nitro/host/application-route-registry.d.ts +7 -2
- package/dist/src/internal/nitro/host/application-route-registry.js +1 -1
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +1 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +3 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/internal/nitro/routes/connection-events.d.ts +5 -0
- package/dist/src/internal/nitro/routes/connection-events.js +1 -0
- package/dist/src/internal/workflow-bundle/builder.js +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.js +1 -1
- package/dist/src/public/channels/slack/blocks.js +2 -2
- package/dist/src/public/connections/index.d.ts +1 -0
- package/dist/src/public/definitions/connections/events.d.ts +43 -0
- package/dist/src/public/definitions/connections/events.js +1 -0
- package/dist/src/public/definitions/connections/mcp.d.ts +3 -0
- package/dist/src/public/schedules/subscription.d.ts +4 -3
- package/dist/src/runtime/connections/events/actions.d.ts +17 -0
- package/dist/src/runtime/connections/events/actions.js +1 -0
- package/dist/src/runtime/connections/events/delivery.d.ts +10 -0
- package/dist/src/runtime/connections/events/delivery.js +1 -0
- package/dist/src/runtime/connections/events/dispatch-step.d.ts +20 -0
- package/dist/src/runtime/connections/events/dispatch-step.js +1 -0
- package/dist/src/runtime/connections/events/lifecycle-step.d.ts +42 -0
- package/dist/src/runtime/connections/events/lifecycle-step.js +1 -0
- package/dist/src/runtime/connections/events/owner.d.ts +38 -0
- package/dist/src/runtime/connections/events/owner.js +1 -0
- package/dist/src/runtime/connections/events/path.d.ts +4 -0
- package/dist/src/runtime/connections/events/path.js +1 -0
- package/dist/src/runtime/connections/events/state.d.ts +37 -0
- package/dist/src/runtime/connections/events/state.js +1 -0
- package/dist/src/runtime/connections/events/workflow.d.ts +28 -0
- package/dist/src/runtime/connections/events/workflow.js +1 -0
- package/dist/src/runtime/connections/mcp-client.d.ts +4 -2
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/connections/scoped-authorization.js +1 -1
- package/dist/src/runtime/resolve-connection.js +1 -1
- package/dist/src/runtime/schedules/collection-client.d.ts +0 -2
- package/dist/src/runtime/schedules/collection-client.js +1 -1
- package/dist/src/runtime/types.d.ts +11 -0
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/update/channels.js +1 -1
- package/dist/src/setup/scaffold/update/connections.js +2 -2
- package/dist/src/setup/scaffold/version-tokens.d.ts +1 -1
- package/dist/src/setup/scaffold/version-tokens.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +12 -4
- package/dist/src/shared/connection-events.d.ts +84 -0
- package/dist/src/shared/connection-events.js +1 -0
- package/dist/src/shared/connection-types.d.ts +10 -0
- package/dist/src/shared/validate-authorization.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/no-reply.d.ts +5 -0
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tracing/eve/connection-events.d.ts +25 -0
- package/dist/src/tracing/eve/connection-events.js +1 -0
- package/dist/src/tracing/eve/install-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/eve/mcp.d.ts +1 -0
- package/dist/src/tracing/eve/mcp.js +1 -1
- package/dist/src/tracing/eve/otel-declaration.d.ts +5 -0
- package/docs/agent-config.md +38 -13
- package/docs/code-extension.mdx +28 -0
- package/docs/concepts/built-in-tools.md +2 -0
- package/docs/connections/mcp.mdx +105 -0
- package/docs/guides/instrumentation/otel.mdx +10 -0
- package/docs/sandbox/vercel.mdx +46 -0
- package/package.json +7 -7
- package/dist/src/compiled/_chunks/node/chunk-6QHBXN7B-gl4n6nmi.js +0 -12
- package/dist/src/compiled/_chunks/node/dist-DYDVZ-FS.js +0 -98
- package/dist/src/compiled/_chunks/node/dist-iEFkK9qw.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"../../_chunks/node/rolldown-runtime-tZXQYakl.js";import{At as o,Et as s,L as c,Nt as l,St as u,X as d,Y as f,_t as p,at as m,bt as h,dt as g,gt as _,ht as v,mt as y,pt as b,q as x,ut as S,vt as C,xt as w,yt as T}from"../../_chunks/node/dist-DYDVZ-FS.js";import{f as E,i as D}from"../../_chunks/node/dist-iEFkK9qw.js";import{t as ee}from"../../_chunks/node/undici-B61sz6UT.js";import{createRequire as te}from"node:module";import{basename as O,join as ne}from"node:path";import{createHmac as re,timingSafeEqual as ie}from"crypto";import{Readable as ae}from"stream";import*as oe from"zlib";import{tmpdir as k}from"node:os";import{inspect as se}from"util";import*as ce from"path";import*as le from"fs";import{createReadStream as ue}from"node:fs";import{Readable as de}from"node:stream";import{mkdtemp as A,readFile as fe,rm as pe,stat as me,writeFile as he}from"node:fs/promises";import j from"#compiled/zod/index.js";import{Buffer as ge}from"node:buffer";import{createHmac as _e,randomUUID as ve,timingSafeEqual as ye}from"node:crypto";import{channel as be,tracingChannel as xe}from"node:diagnostics_channel";import{spawn as Se}from"node:child_process";var Ce,we=n((()=>{Ce=`1.9.1`}));function Te(e){let t=new Set([e]),n=new Set,r=e.match(Ee);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(Ee);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var Ee,De,Oe=n((()=>{we(),Ee=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,De=Te(Ce)}));function ke(e,t,n,r=!1){let i=Pe[Ne]=Pe[Ne]??{version:Ce};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Ce}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Ce}.`),!0}function Ae(e){let t=Pe[Ne]?.version;if(t&&De(t))return Pe[Ne]?.[e]}function je(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Ce}.`);let n=Pe[Ne];n&&delete n[e]}var Me,Ne,Pe,Fe=n((()=>{we(),Oe(),Me=Ce.split(`.`)[0],Ne=Symbol.for(`opentelemetry.js.api.${Me}`),Pe=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function Ie(e,t,n){let r=Ae(`diag`);if(r)return r[e](t,...n)}var Le,Re=n((()=>{Fe(),Le=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return Ie(`debug`,this._namespace,e)}error(...e){return Ie(`error`,this._namespace,e)}info(...e){return Ie(`info`,this._namespace,e)}warn(...e){return Ie(`warn`,this._namespace,e)}verbose(...e){return Ie(`verbose`,this._namespace,e)}}})),ze,Be=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(ze||={})}));function Ve(e,t){e<ze.NONE?e=ze.NONE:e>ze.ALL&&(e=ze.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,ze.ERROR),warn:n(`warn`,ze.WARN),info:n(`info`,ze.INFO),debug:n(`debug`,ze.DEBUG),verbose:n(`verbose`,ze.VERBOSE)}}var He=n((()=>{Be()})),Ue,We,Ge=n((()=>{Re(),He(),Be(),Fe(),Ue=`diag`,We=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=Ae(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:ze.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=Ae(`diag`),i=Ve(n.logLevel??ze.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return ke(`diag`,i,t,!0)},t.disable=()=>{je(Ue,t)},t.createComponentLogger=e=>new Le(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),Ke,qe=n((()=>{Ke=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}})),Je,Ye=n((()=>{Je=Symbol(`BaggageEntryMetadata`)}));function Xe(e={}){return new Ke(new Map(Object.entries(e)))}function Ze(e){return typeof e!=`string`&&(Qe.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:Je,toString(){return e}}}var Qe,$e=n((()=>{Ge(),qe(),Ye(),Qe=We.instance()}));function et(e){return Symbol.for(e)}var tt,nt,rt=n((()=>{tt=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},nt=new tt})),it,at,ot,st=n((()=>{if(it=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],at={},typeof console<`u`)for(let e of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[e]==`function`&&(at[e]=console[e]);ot=class{constructor(){function e(e){return function(...t){let n=at[e];if(typeof n!=`function`&&(n=at.log),typeof n!=`function`&&console&&(n=console[e],typeof n!=`function`&&(n=console.log)),typeof n==`function`)return n.apply(console,t)}}for(let t=0;t<it.length;t++)this[it[t].n]=e(it[t].c)}}}));function ct(){return yt}var lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt,xt,St,Ct,wt,Tt,Et,Dt=n((()=>{lt=class{constructor(){}createGauge(e,t){return xt}createHistogram(e,t){return St}createCounter(e,t){return bt}createUpDownCounter(e,t){return Ct}createObservableGauge(e,t){return Tt}createObservableCounter(e,t){return wt}createObservableUpDownCounter(e,t){return Et}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},ut=class{},dt=class extends ut{add(e,t){}},ft=class extends ut{add(e,t){}},pt=class extends ut{record(e,t){}},mt=class extends ut{record(e,t){}},ht=class{addCallback(e){}removeCallback(e){}},gt=class extends ht{},_t=class extends ht{},vt=class extends ht{},yt=new lt,bt=new dt,xt=new pt,St=new mt,Ct=new ft,wt=new gt,Tt=new _t,Et=new vt})),Ot,kt=n((()=>{(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(Ot||={})})),At,jt,Mt=n((()=>{At={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},jt={set(e,t,n){e!=null&&(e[t]=n)}}})),Nt,Pt=n((()=>{rt(),Nt=class{active(){return nt}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Ft,It,Lt,Rt=n((()=>{Pt(),Fe(),Ge(),Ft=`context`,It=new Nt,Lt=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return ke(Ft,e,We.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return Ae(Ft)||It}disable(){this._getContextManager().disable(),je(Ft,We.instance())}}})),zt,Bt=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(zt||={})})),Vt,Ht,Ut,Wt=n((()=>{Bt(),Vt=`0000000000000000`,Ht=`00000000000000000000000000000000`,Ut={traceId:Ht,spanId:Vt,traceFlags:zt.NONE}})),Gt,Kt=n((()=>{Wt(),Gt=class{constructor(e=Ut){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function qt(e){return e.getValue($t)||void 0}function Jt(){return qt(Lt.getInstance().active())}function Yt(e,t){return e.setValue($t,t)}function Xt(e){return e.deleteValue($t)}function Zt(e,t){return Yt(e,new Gt(t))}function Qt(e){return qt(e)?.spanContext()}var $t,en=n((()=>{rt(),Kt(),Rt(),$t=et(`OpenTelemetry Context Key SPAN`)}));function tn(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(sn[e.charCodeAt(t)]|0)+(sn[e.charCodeAt(t+1)]|0)+(sn[e.charCodeAt(t+2)]|0)+(sn[e.charCodeAt(t+3)]|0);return n===t}function nn(e){return tn(e,32)&&e!==`00000000000000000000000000000000`}function rn(e){return tn(e,16)&&e!==`0000000000000000`}function an(e){return nn(e.traceId)&&rn(e.spanId)}function on(e){return new Gt(e)}var sn,cn=n((()=>{Wt(),Kt(),sn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function ln(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var un,dn,fn=n((()=>{Rt(),en(),Kt(),cn(),un=Lt.getInstance(),dn=class{startSpan(e,t,n=un.active()){if(t?.root)return new Gt;let r=n&&Qt(n);return ln(r)&&an(r)?new Gt(r):new Gt}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??un.active(),c=this.startSpan(e,i,s),l=Yt(s,c);return un.with(l,o,void 0,c)}}})),pn,mn,hn=n((()=>{fn(),pn=new dn,mn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):pn}}})),gn,_n=n((()=>{fn(),gn=class{getTracer(e,t,n){return new dn}}})),vn,yn,bn=n((()=>{hn(),_n(),vn=new gn,yn=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new mn(this,e,t,n)}getDelegate(){return this._delegate??vn}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),xn,Sn=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(xn||={})})),Cn,wn=n((()=>{(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(Cn||={})})),Tn,En=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Tn||={})}));function Dn(e){return An.test(e)}function On(e){return jn.test(e)&&!Mn.test(e)}var kn,An,jn,Mn,Nn=n((()=>{kn=`[_0-9a-z-*/]`,An=RegExp(`^(?:${`[a-z]${kn}{0,255}`}|${`[a-z0-9]${kn}{0,240}@[a-z]${kn}{0,13}`})$`),jn=/^[ -~]{0,255}[!-~]$/,Mn=/,|=/})),Pn,Fn,In,Ln,Rn,zn=n((()=>{Nn(),Pn=32,Fn=512,In=`,`,Ln=`=`,Rn=class e{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,t)=>(e.push(t+Ln+this.get(t)),e),[]).join(In)}_parse(e){e.length>Fn||(this._internalState=e.split(In).reduceRight((e,t)=>{let n=t.trim(),r=n.indexOf(Ln);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Dn(i)&&On(a)&&e.set(i,a)}return e},new Map),this._internalState.size>Pn&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Pn))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}}}));function Bn(e){return new Rn(e)}var Vn=n((()=>{zn()})),Hn,Un=n((()=>{Rt(),Hn=Lt.getInstance()})),M,Wn=n((()=>{Ge(),M=We.instance()})),Gn,Kn,qn=n((()=>{Dt(),Gn=class{getMeter(e,t,n){return yt}},Kn=new Gn})),Jn,Yn,Xn=n((()=>{qn(),Fe(),Ge(),Jn=`metrics`,Yn=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalMeterProvider(e){return ke(Jn,e,We.instance())}getMeterProvider(){return Ae(Jn)||Kn}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){je(Jn,We.instance())}}})),Zn,Qn=n((()=>{Xn(),Zn=Yn.getInstance()})),$n,er=n((()=>{$n=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function tr(e){return e.getValue(ar)||void 0}function nr(){return tr(Lt.getInstance().active())}function rr(e,t){return e.setValue(ar,t)}function ir(e){return e.deleteValue(ar)}var ar,or=n((()=>{Rt(),rt(),ar=et(`OpenTelemetry Baggage Key`)})),sr,cr,lr,ur=n((()=>{Fe(),er(),Mt(),or(),$e(),Ge(),sr=`propagation`,cr=new $n,lr=class e{constructor(){this.createBaggage=Xe,this.getBaggage=tr,this.getActiveBaggage=nr,this.setBaggage=rr,this.deleteBaggage=ir}static getInstance(){return this._instance||=new e,this._instance}setGlobalPropagator(e){return ke(sr,e,We.instance())}inject(e,t,n=jt){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=At){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){je(sr,We.instance())}_getGlobalPropagator(){return Ae(sr)||cr}}})),dr,fr=n((()=>{ur(),dr=lr.getInstance()})),pr,mr,hr=n((()=>{Fe(),bn(),cn(),en(),Ge(),pr=`trace`,mr=class e{constructor(){this._proxyTracerProvider=new yn,this.wrapSpanContext=on,this.isSpanContextValid=an,this.deleteSpan=Xt,this.getSpan=qt,this.getActiveSpan=Jt,this.getSpanContext=Qt,this.setSpan=Yt,this.setSpanContext=Zt}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=ke(pr,this._proxyTracerProvider,We.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return Ae(pr)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){je(pr,We.instance()),this._proxyTracerProvider=new yn}}})),gr,_r=n((()=>{hr(),gr=mr.getInstance()})),vr=i({DiagConsoleLogger:()=>ot,DiagLogLevel:()=>ze,INVALID_SPANID:()=>Vt,INVALID_SPAN_CONTEXT:()=>Ut,INVALID_TRACEID:()=>Ht,ProxyTracer:()=>mn,ProxyTracerProvider:()=>yn,ROOT_CONTEXT:()=>nt,SamplingDecision:()=>xn,SpanKind:()=>Cn,SpanStatusCode:()=>Tn,TraceFlags:()=>zt,ValueType:()=>Ot,baggageEntryMetadataFromString:()=>Ze,context:()=>Hn,createContextKey:()=>et,createNoopMeter:()=>ct,createTraceState:()=>Bn,default:()=>yr,defaultTextMapGetter:()=>At,defaultTextMapSetter:()=>jt,diag:()=>M,isSpanContextValid:()=>an,isValidSpanId:()=>rn,isValidTraceId:()=>nn,metrics:()=>Zn,propagation:()=>dr,trace:()=>gr}),yr,N=n((()=>{$e(),rt(),st(),Be(),Dt(),kt(),Mt(),hn(),bn(),Sn(),wn(),En(),Bt(),Vn(),cn(),Wt(),Un(),Wn(),Qn(),fr(),_r(),yr={context:Hn,diag:M,metrics:Zn,propagation:dr,trace:gr}}));N();var br;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(br||={});var xr=class{emit(e){}enabled(){return!1}};const Sr=new xr,Cr=Symbol.for(`io.opentelemetry.js.api.logs`),wr=globalThis;function Tr(e,t,n){return r=>r===e?t:n}const Er=new class{getLogger(e,t,n){return new xr}};var Dr=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Sr}},Or=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Dr(this,e,t,n)}_getDelegate(){return this._delegate??Er}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}};const kr=class e{constructor(){this._proxyLoggerProvider=new Or}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return wr[Cr]?this.getLoggerProvider():(wr[Cr]=Tr(1,e,Er),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return wr[Cr]?.call(wr,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete wr[Cr],this._proxyLoggerProvider=new Or}}.getInstance(),Ar=et(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function jr(e){return e.setValue(Ar,!0)}function Mr(e){return e.getValue(Ar)===!0}const Nr=`baggage`;N();function Pr(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Fr(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Ir(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=Ze(e.substring(t+1))),{key:o,value:s,metadata:c}}function Lr(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=Ir(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}function Rr(e){let t={};return typeof e==`string`&&e.length>0&&e.split(`,`).forEach(e=>{let n=Ir(e);n!==void 0&&n.value.length>0&&(t[n.key]=n.value)}),t}N();var zr=class{inject(e,t,n){let r=dr.getBaggage(e);if(!r||Mr(e))return;let i=Pr(Fr(r).filter(e=>e.length<=4096).slice(0,180));i.length>0&&n.set(t,Nr,i)}extract(e,t,n){let r=n.get(t,Nr);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=Lr(r[e],i,a,o);else[a]=Lr(r,i,a,o);return a===0?e:dr.setBaggage(e,dr.createBaggage(i))}fields(){return[Nr]}};N();function Br(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Vr(n)){M.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Hr(r)){M.warn(`Invalid attribute value set for key: ${n}`);continue}t[n]=Array.isArray(r)?r.slice():r}return t}function Vr(e){return typeof e==`string`&&e!==``}function Hr(e){return e==null?!0:Array.isArray(e)?Ur(e):Wr(typeof e)}function Ur(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Wr(e)){t=e;continue}return!1}return!1}}return!0}function Wr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}N();function Gr(){return e=>{M.error(Kr(e))}}function Kr(e){return typeof e==`string`?e:JSON.stringify(qr(e))}function qr(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}let Jr=Gr();function Yr(e){try{Jr(e)}catch{}}N();function Xr(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){M.warn(`Unknown value ${se(t)} for ${e}, expected a number, using defaults`);return}return n}function Zr(e){let t=process.env[e];if(t!=null&&t.trim()!==``)return t}const Qr=`error.type`,$r=`exception.message`,ei=`exception.stacktrace`,ti=`exception.type`,ni=`service.name`,ri=`telemetry.sdk.language`,ii=`nodejs`,ai=`telemetry.sdk.name`,oi=`telemetry.sdk.version`,si={[ai]:`opentelemetry`,"process.runtime.name":`node`,[ri]:ii,[oi]:`2.11.0`},ci=performance,li=10**6,ui=10**9;function di(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*li)]}function fi(e){return vi(di(ci.timeOrigin),di(typeof e==`number`?e:ci.now()))}function pi(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ui),[n,r]}function mi(e){return e[0]*1e6+e[1]/1e3}function hi(e){return e[0]+e[1]/ui}function gi(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function _i(e){return gi(e)||typeof e==`number`||e instanceof Date}function vi(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=ui&&(n[1]-=ui,n[0]+=1),n}var yi;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(yi||={}),N();var bi=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let t=new Set;for(let e of this._propagators){let n=typeof e.fields==`function`?e.fields():[];for(let e of n)t.add(e)}this._fields=Array.from(t)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){M.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){M.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}};const xi=`[_0-9a-z-*/]`,Si=RegExp(`^(?:${`[a-z]${xi}{0,255}`}|${`[a-z0-9]${xi}{0,240}@[a-z]${xi}{0,13}`})$`),Ci=/^[ -~]{0,255}[!-~]$/,wi=/,|=/;function Ti(e){return Si.test(e)}function Ei(e){return Ci.test(e)&&!wi.test(e)}var Di=class e{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Ti(e)||!Ei(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(i+=typeof r==`string`?t.length-r.length:e.length+t.length+(n.size>0?2:1),i>512)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=`,`+e),e=`${n[0]}=${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(`,`),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(`=`);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Ti(a)||!Ei(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>512)&&(t.set(a,o),n=s,t.size>=32))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}};N();const Oi=`traceparent`,ki=`tracestate`,Ai=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function ji(e){let t=Ai.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Mi=class{inject(e,t,n){let r=gr.getSpanContext(e);if(!r||Mr(e)||!an(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||zt.NONE).toString(16)}`;n.set(t,Oi,i),r.traceState&&n.set(t,ki,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Oi);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=ji(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,ki);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Di(typeof e==`string`?e:void 0)}return gr.setSpanContext(e,a)}fields(){return[Oi,ki]}};const Ni=Function.prototype.toString,Pi=Ni.call(Object),Fi=Object.getPrototypeOf,Ii=Object.prototype,Li=Ii.hasOwnProperty,Ri=Symbol?Symbol.toStringTag:void 0,zi=Ii.toString;function Bi(e){if(!Vi(e)||Hi(e)!==`[object Object]`)return!1;let t=Fi(e);if(t===null)return!0;let n=Li.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Ni.call(n)===Pi}function Vi(e){return typeof e==`object`&&!!e}function Hi(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Ri&&Ri in Object(e)?Ui(e):Wi(e)}function Ui(e){let t=Li.call(e,Ri),n=e[Ri],r=!1;try{e[Ri]=void 0,r=!0}catch{}let i=zi.call(e);return r&&(t?e[Ri]=n:delete e[Ri]),i}function Wi(e){return zi.call(e)}function Gi(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=qi(t,e.shift(),0,n);return t}function Ki(e){return Yi(e)?e.slice():e}function qi(e,t,n=0,r){let i;if(!(n>20)){if(n++,Qi(e)||Qi(t)||Xi(t))i=Ki(t);else if(Yi(e)){if(i=e.slice(),Yi(t))for(let e=0,n=t.length;e<n;e++)i.push(Ki(t[e]));else if(Zi(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r!==`__proto__`&&r!==`constructor`&&r!==`prototype`&&(i[r]=Ki(t[r]))}}}else if(Zi(e)){if(Zi(t)){if(!$i(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Qi(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Ji(e,s,r)||Ji(t,s,r))delete i[s];else{if(Zi(a)&&Zi(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=qi(i[s],c,n,r)}}}}else i=t}return i}}function Ji(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function Yi(e){return Array.isArray(e)}function Xi(e){return typeof e==`function`}function Zi(e){return!Qi(e)&&!Yi(e)&&!Xi(e)&&typeof e==`object`}function Qi(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function $i(e,t){return!(!Bi(e)||!Bi(t))}var ea=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},ta=class{_isCalled=!1;_deferred=new ea;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};N();function na(e,t){return new Promise(n=>{Hn.with(jr(Hn.active()),()=>{e.export(t,n)})})}const ra={_export:na};var ia=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractAsyncHooksContextManager=void 0;let n=t(`events`),r=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`];e.AbstractAsyncHooksContextManager=class{bind(e,t){return t instanceof n.EventEmitter?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindEventEmitter(e,t){return this._getPatchMap(t)===void 0?(this._createPatchMap(t),r.forEach(n=>{t[n]!==void 0&&(t[n]=this._patchAddListener(t,t[n],e))}),typeof t.removeListener==`function`&&(t.removeListener=this._patchRemoveListener(t,t.removeListener)),typeof t.off==`function`&&(t.off=this._patchRemoveListener(t,t.off)),typeof t.removeAllListeners==`function`&&(t.removeAllListeners=this._patchRemoveAllListeners(t,t.removeAllListeners)),t):t}_patchRemoveListener(e,t){let n=this;return function(r,i){let a=n._getPatchMap(e)?.[r];if(a===void 0)return t.call(this,r,i);let o=a.get(i);return t.call(this,r,o||i)}}_patchRemoveAllListeners(e,t){let n=this;return function(r){let i=n._getPatchMap(e);return i!==void 0&&(arguments.length===0?n._createPatchMap(e):i[r]!==void 0&&delete i[r]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let r=this;return function(i,a){if(r._wrapped)return t.call(this,i,a);let o=r._getPatchMap(e);o===void 0&&(o=r._createPatchMap(e));let s=o[i];s===void 0&&(s=new WeakMap,o[i]=s);let c=r.bind(n,a);s.set(a,c),r._wrapped=!0;try{return t.call(this,i,c)}finally{r._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol(`OtListeners`);_wrapped=!1}})),aa=a((n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AsyncHooksContextManager=void 0;let r=(N(),e(vr)),i=t(`async_hooks`),a=ia();n.AsyncHooksContextManager=class extends a.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=i.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??r.ROOT_CONTEXT}with(e,t,n,...r){this._enterContext(e);try{return t.call(n,...r)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,t){if(t===`TIMERWRAP`)return;let n=this._stack[this._stack.length-1];n!==void 0&&this._contexts.set(e,n)}_destroy(e){this._contexts.delete(e)}_before(e){let t=this._contexts.get(e);t!==void 0&&this._enterContext(t)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}}})),oa=a((n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AsyncLocalStorageContextManager=void 0;let r=(N(),e(vr)),i=t(`async_hooks`),a=ia();var o=class{_isDisposed=!1;_previousContext;_asyncLocalStorage;constructor(e,t){this._previousContext=e,this._asyncLocalStorage=t}dispose(){this._isDisposed||=(this._asyncLocalStorage.enterWith(this._previousContext),!0)}};n.AsyncLocalStorageContextManager=class extends a.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new i.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??r.ROOT_CONTEXT}with(e,t,n,...r){let i=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,i,...r)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}attach(e){let t=this._asyncLocalStorage.withScope;if(t)return t.call(this._asyncLocalStorage,e);let n=this.active();return this._asyncLocalStorage.enterWith(e),new o(n,this._asyncLocalStorage)}}})),sa=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncLocalStorageContextManager=e.AsyncHooksContextManager=void 0;var t=aa();Object.defineProperty(e,"AsyncHooksContextManager",{enumerable:!0,get:function(){return t.AsyncHooksContextManager}});var n=oa();Object.defineProperty(e,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return n.AsyncLocalStorageContextManager}})})),ca=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},la=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function ua(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function da(e){if(e!=null)return async()=>e}function fa(e,t,n){return{timeoutMillis:ua(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function pa(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var ma=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function ha(e){return new ma(e.concurrencyLimit)}N();const ga=et(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function _a(e){return e.setValue(ga,!0)}N();function va(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=Ze(e.substring(t+1))),{key:o,value:s,metadata:c}}function ya(e){let t={};return typeof e==`string`&&e.length>0&&e.split(`,`).forEach(e=>{let n=va(e);n!==void 0&&n.value.length>0&&(t[n.key]=n.value)}),t}N();function ba(){return e=>{M.error(xa(e))}}function xa(e){return typeof e==`string`?e:JSON.stringify(Sa(e))}function Sa(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}let Ca=ba();function wa(e){try{Ca(e)}catch{}}N();function Ta(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){M.warn(`Unknown value ${se(t)} for ${e}, expected a number, using defaults`);return}return n}function Ea(e){let t=process.env[e];if(t!=null&&t.trim()!==``)return t}const Da={[ai]:`opentelemetry`,"process.runtime.name":`node`,[ri]:ii,[oi]:`2.7.1`},Oa=performance,ka=10**6,Aa=10**9;function ja(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*ka)]}function Ma(e){return Ia(ja(Oa.timeOrigin),ja(typeof e==`number`?e:Oa.now()))}function Na(e){if(Fa(e))return e;if(typeof e==`number`)return e<Oa.timeOrigin?Ma(e):ja(e);if(e instanceof Date)return ja(e.getTime());throw TypeError(`Invalid input type`)}function Pa(e){return e[0]*Aa+e[1]}function Fa(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Ia(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Aa&&(n[1]-=Aa,n[0]+=1),n}var La;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(La||={});var Ra=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function za(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Ra(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Ba=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},Va=class{_isCalled=!1;_deferred=new Ba;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};N();function Ha(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Ua(){return{handleResponse(e){e!=null&&Ha(e)&&e.partialSuccess!=null&&Object.keys(e.partialSuccess).length!==0&&M.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}N();var Wa=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=M.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:La.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:La.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:La.SUCCESS});return}if(e.status===`failure`&&e.error){t({code:La.FAILED,error:e.error});return}e.status===`retryable`?t({code:La.FAILED,error:e.error??new la(`Export failed with retryable status`)}):t({code:La.FAILED,error:new la(`Export failed with unknown error`)})},e=>t({code:La.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function Ga(e,t){return new Wa(e.transport,e.serializer,Ua(),e.promiseHandler,t.timeout)}var Ka;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Ka||={});var qa;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(qa||={});var Ja;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Ja||={});var Ya;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(Ya||={});let Xa;function Za(){if(Xa===void 0)try{let e=globalThis.process.argv0;Xa=e?`unknown_service:${e}`:`unknown_service`}catch{Xa=`unknown_service`}return Xa}const Qa=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;N();var $a=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=no(t),r._asyncAttributesPending=t.filter(([e,t])=>Qa(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Qa(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=no(this._rawAttributes),this._schemaUrl=ro(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Qa(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&M.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Qa(n)){M.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=io(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function eo(e,t){return $a.FromAttributeList(Object.entries(e),t)}function to(){return eo({[ni]:Za(),[ri]:Da[ri],[ai]:Da[ai],[oi]:Da[oi]})}function no(e){return e.map(([e,t])=>Qa(t)?[e,t.catch(t=>{M.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ro(e){if(typeof e==`string`||e===void 0)return e;M.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function io(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;M.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function ao(e,t){let n={attributes:so(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function oo(e){return{name:e.name,version:e.version}}function so(e,t){return Object.keys(e).map(n=>co(n,e[n],t))}function co(e,t,n){return{key:e,value:lo(t,n)}}function lo(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=lo(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:lo(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function uo(e,t){return{resourceLogs:po(e,t)}}function fo(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function po(e,t){let n=fo(e);return Array.from(n,([e,n])=>{let r=ao(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:oo(e[0].instrumentationScope),logRecords:e.map(e=>mo(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function mo(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:ho(e.severityNumber),severityText:e.severityText,body:lo(e.body,t),eventName:e.eventName,attributes:go(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function ho(e){return e}function go(e,t){return Object.keys(e).map(n=>co(n,e[n],t))}function _o(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function vo(e){return _o(e).toString()}const yo=typeof BigInt<`u`?vo:Pa;function bo(e){return e}const xo={encodeHrTime:yo,encodeSpanContext:bo,encodeOptionalSpanContext:bo,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};N();const So={serializeRequest:e=>{let t=uo(e,xo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return M.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};var Co;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]=`AGGREGATION_TEMPORALITY_UNSPECIFIED`,e[e.AGGREGATION_TEMPORALITY_DELTA=1]=`AGGREGATION_TEMPORALITY_DELTA`,e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]=`AGGREGATION_TEMPORALITY_CUMULATIVE`})(Co||={}),N();function wo(e,t){let n=ao(e.resource,t);return{resource:n,schemaUrl:n.schemaUrl,scopeMetrics:To(e.scopeMetrics,t)}}function To(e,t){return Array.from(e.map(e=>({scope:oo(e.scope),metrics:e.metrics.map(e=>Eo(e,t)),schemaUrl:e.scope.schemaUrl})))}function Eo(e,t){let n={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},r=jo(e.aggregationTemporality);switch(e.dataPointType){case Ja.SUM:n.sum={aggregationTemporality:r,isMonotonic:e.isMonotonic,dataPoints:Oo(e,t)};break;case Ja.GAUGE:n.gauge={dataPoints:Oo(e,t)};break;case Ja.HISTOGRAM:n.histogram={aggregationTemporality:r,dataPoints:ko(e,t)};break;case Ja.EXPONENTIAL_HISTOGRAM:n.exponentialHistogram={aggregationTemporality:r,dataPoints:Ao(e,t)}}return n}function Do(e,t,n){let r={attributes:so(e.attributes,n),startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)};switch(t){case Ot.INT:r.asInt=e.value;break;case Ot.DOUBLE:r.asDouble=e.value}return r}function Oo(e,t){return e.dataPoints.map(n=>Do(n,e.descriptor.valueType,t))}function ko(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:so(e.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function Ao(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:so(e.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function jo(e){switch(e){case Ka.DELTA:return Co.AGGREGATION_TEMPORALITY_DELTA;case Ka.CUMULATIVE:return Co.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Mo(e,t){return{resourceMetrics:e.map(e=>wo(e,t))}}N();const No={serializeRequest:e=>{let t=Mo([e],xo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return M.warn(`Failed to parse metrics export response: ${e.message}. Returning empty response`),{}}}};function Po(e,t){let n=e&255|256;return t&&(n|=512),n}function Fo(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:so(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Lo(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Io(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Po(n.traceFlags,e.parentSpanContext?.isRemote)}}function Io(e,t){return{attributes:e.attributes?so(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Po(e.context.traceFlags,e.context.isRemote)}}function Lo(e,t){return{attributes:e.attributes?so(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ro(e,t){return{resourceSpans:Bo(e,t)}}function zo(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Bo(e,t){let n=zo(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Fo(e,t));o.push({scope:oo(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=ao(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}N();const Vo={serializeRequest:e=>{let t=Ro(e,xo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return M.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};N();function Ho(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{n===void 0?M.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}function Uo(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,Ho(await e())),Object.assign(i,r)}}function Wo(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Go(e,t,n){return{...fa(e,t,n),headers:Uo(e.headers,t.headers,n.headers),url:Wo(e.url)??t.url??n.url}}function Ko(e,t){return{...pa(),headers:async()=>e,url:`http://localhost:4318/`+t}}function qo(e){return async t=>{let n=t===`http:`,{Agent:r}=await(n?import(`http`):import(`https`));if(n){let{ca:t,cert:n,key:i,...a}=e;return new r(a)}return new r(e)}}function Jo(e,t,n){return{...Go(e,t,n),agentFactory:e.agentFactory??t.agentFactory??n.agentFactory,userAgent:e.userAgent}}function Yo(e,t){return{...Ko(e,t),agentFactory:qo({keepAlive:!0})}}function Xo(e){return e===429||e===502||e===503||e===504}function Zo(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}const Qo=`OTel-OTLP-Exporter-JavaScript/0.218.0`;function $o(e,t,n,r,i,a,o,s){return new Promise(c=>{let l=new URL(t);n[`User-Agent`]=i?`${i} ${Qo}`:Qo;let u=e(l,{method:`POST`,headers:n,agent:a},e=>{let t=[],n=0;e.on(`data`,r=>{if(n+=r.length,n>4194304){c({status:`failure`,error:Error(`OTLP export response body exceeded size limit of 4194304 bytes`)}),e.destroy();return}t.push(r)}),e.on(`end`,()=>{e.statusCode&&e.statusCode<=299?c({status:`success`,data:Buffer.concat(t)}):e.statusCode&&Xo(e.statusCode)?c({status:`retryable`,retryInMillis:Zo(e.headers[`retry-after`])}):c({status:`failure`,error:new la(e.statusMessage,e.statusCode,Buffer.concat(t).toString())})}),e.on(`error`,t=>{e.statusCode&&e.statusCode<=299?c({status:`success`}):e.statusCode&&Xo(e.statusCode)?c({status:`retryable`,error:t,retryInMillis:Zo(e.headers[`retry-after`])}):c({status:`failure`,error:t})})});u.setTimeout(s,()=>{u.destroy(),c({status:`retryable`,error:Error(`Request timed out`)})}),u.on(`error`,e=>{ns(e)?c({status:`retryable`,error:e}):c({status:`failure`,error:e})}),es(u,r,o,e=>{c({status:`failure`,error:e})})})}function es(e,t,n,r){let i=ts(n);t===`gzip`&&(e.setHeader(`Content-Encoding`,`gzip`),i=i.on(`error`,r).pipe(oe.createGzip()).on(`error`,r)),i.pipe(e).on(`error`,r)}function ts(e){let t=new ae;return t.push(e),t.push(null),t}function ns(e){let t=new Set([`ECONNRESET`,`ECONNREFUSED`,`EPIPE`,`ETIMEDOUT`,`EAI_AGAIN`,`ENOTFOUND`,`ENETUNREACH`,`EHOSTUNREACH`]);return`code`in e&&typeof e.code==`string`&&t.has(e.code)}var rs=class{_utils=null;_parameters;constructor(e){this._parameters=e}async send(e,t){let{agent:n,request:r}=await this._loadUtils(),i=await this._parameters.headers();return $o(r,this._parameters.url,i,this._parameters.compression,this._parameters.userAgent,n,e,t)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let t=new URL(this._parameters.url).protocol,[n,r]=await Promise.all([this._parameters.agentFactory(t),is(t)]);e=this._utils={agent:n,request:r}}return e}};async function is(e){let{request:t}=await(e===`http:`?import(`http`):import(`https`));return t}function as(e){return new rs(e)}N();const os=.2;function ss(){return 2*os*Math.random()-os}var cs=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=5,r=1e3,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+ss()),5e3),0);r*=1.5;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return M.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;M.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?M.verbose(`Export succeeded after ${5-n} retry attempts.`):a.status===`retryable`?M.info(`Export failed after maximum retry attempts (5).`):M.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}};function ls(e){return new cs(e.transport)}function us(e,t){return Ga({transport:ls({transport:as(e)}),serializer:t,promiseHandler:ha(e)},{timeout:e.timeoutMillis})}N();function ds(e){let t=Ta(e);if(t!=null){if(Number.isFinite(t)&&t>0)return t;M.warn(`Configuration: ${e} is invalid, expected number greater than 0 (actual: ${t})`)}}function fs(e){let t=ds(`OTEL_EXPORTER_OTLP_${e}_TIMEOUT`),n=ds(`OTEL_EXPORTER_OTLP_TIMEOUT`);return t??n}function ps(e){let t=Ea(e)?.trim();if(t==null||t===`none`||t===`gzip`)return t;M.warn(`Configuration: ${e} is invalid, expected 'none' or 'gzip' (actual: '${t}')`)}function ms(e){let t=ps(`OTEL_EXPORTER_OTLP_${e}_COMPRESSION`),n=ps(`OTEL_EXPORTER_OTLP_COMPRESSION`);return t??n}function hs(e){return{timeoutMillis:fs(e),compression:ms(e)}}N();function gs(e){let t=Ea(`OTEL_EXPORTER_OTLP_${e}_HEADERS`),n=Ea(`OTEL_EXPORTER_OTLP_HEADERS`),r=ya(t),i=ya(n);if(Object.keys(r).length!==0||Object.keys(i).length!==0)return Object.assign({},ya(n),ya(t))}function _s(e){try{return new URL(e).toString()}catch{M.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}}function vs(e,t){try{new URL(e)}catch{M.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}e.endsWith(`/`)||(e+=`/`),e+=t;try{new URL(e)}catch{M.warn(`Configuration: Provided URL appended with '${t}' is not a valid URL, using 'undefined' instead of '${e}'`);return}return e}function ys(e){let t=Ea(`OTEL_EXPORTER_OTLP_ENDPOINT`);if(t!==void 0)return vs(t,e)}function bs(e){let t=Ea(`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`);if(t!==void 0)return _s(t)}function xs(e,t,n){let r=Ea(e),i=Ea(t),a=r??i;if(a!=null)try{return le.readFileSync(ce.resolve(process.cwd(),a))}catch{M.warn(n);return}}function Ss(e){return xs(`OTEL_EXPORTER_OTLP_${e}_CLIENT_CERTIFICATE`,`OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE`,`Failed to read client certificate chain file`)}function Cs(e){return xs(`OTEL_EXPORTER_OTLP_${e}_CLIENT_KEY`,`OTEL_EXPORTER_OTLP_CLIENT_KEY`,`Failed to read client certificate private key file`)}function ws(e){return xs(`OTEL_EXPORTER_OTLP_${e}_CERTIFICATE`,`OTEL_EXPORTER_OTLP_CERTIFICATE`,`Failed to read root certificate file`)}function Ts(e,t){return{...hs(e),url:bs(e)??ys(t),headers:da(gs(e)),agentFactory:qo({keepAlive:!0,ca:ws(e),cert:Ss(e),key:Cs(e)})}}function Es(e){return typeof e.headers==`function`?e.headers:da(e.headers)}N();function Ds(e){if(typeof e.httpAgentOptions==`function`)return e.httpAgentOptions;let t=e.httpAgentOptions;if(e.keepAlive!=null&&(t={keepAlive:e.keepAlive,...t}),t!=null)return qo(t)}function Os(e,t,n,r){return e.metadata&&M.warn(`Metadata cannot be set when using http`),Jo({url:e.url,headers:Es(e),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentFactory:Ds(e),userAgent:e.userAgent},Ts(t,n),Yo(r,n))}var ks=class extends ca{constructor(e={}){super(us(Os(e,`LOGS`,`v1/logs`,{"Content-Type":`application/json`}),So))}},As=class extends ca{constructor(e={}){super(us(Os(e,`TRACES`,`v1/traces`,{"Content-Type":`application/json`}),Vo))}};let js;function Ms(){if(js===void 0)try{let e=globalThis.process.argv0;js=e?`unknown_service:${e}`:`unknown_service`}catch{js=`unknown_service`}return js}const Ns=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;N();var Ps=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Ls(t),r._asyncAttributesPending=t.filter(([e,t])=>Ns(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Ns(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Ls(this._rawAttributes),this._schemaUrl=Rs(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Ns(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&M.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Ns(n)){M.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=zs(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Fs(e,t){return Ps.FromAttributeList(Object.entries(e),t)}function Is(){return Fs({[ni]:Ms(),[ri]:si[ri],[ai]:si[ai],[oi]:si[oi]})}function Ls(e){return e.map(([e,t])=>Ns(t)?[e,t.catch(t=>{M.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Rs(e){if(typeof e==`string`||e===void 0)return e;M.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function zs(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;M.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Bs(e){return Vs(e,new WeakSet)}function Vs(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Vs(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Vs(e,t))}return!1}N();var Hs=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=Na(r??f),this.hrTimeObserved=Na(i??f),d){let e=gr.getSpanContext(d);e&&an(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return M.warn(`Invalid attribute key: ${e}`),this;if(!Bs(t))return M.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&M.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return M.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute($r,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ti,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ti,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute($r,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ei,n.stack),t=!0)}t||M.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&M.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};N();var Us=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=e.context||Hn.active();if(!this.enabled(e))return;let n=new Hs(this._sharedState,this.instrumentationScope,{context:t,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,t),n._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==br.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||Hn.active();if(t.traceBased){let e=gr.getSpanContext(r);if(e&&an(e)&&(e.traceFlags&zt.SAMPLED)!==zt.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},Ws=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}},Gs=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>za(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function Ks(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var qs=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(`otel.sdk.log.created`,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}};N();const Js={disabled:!1,minimumSeverity:br.UNSPECIFIED,traceBased:!1},Ys=()=>({...Js});var Xs=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,n,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Gs(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Ws,this._loggerConfigurator=i??Ys;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,`0.218.0`):ct();this.loggerMetrics=new qs(o)}getLoggerConfig(e){let t=Ks(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};N();var Zs=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??to(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Ys,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Xs(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Va(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return M.warn(`A shutdown LoggerProvider cannot provide a Logger`),Sr;e||M.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Us({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(M.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(M.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};N();async function Qs(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var $s=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(e,t,n){this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await Qs(t),await Hn.with(_a(Hn.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){wa(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===La.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},ec=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new Va(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(M.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new $s(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){wa(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new $s(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,wa(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},tc=class extends ec{onShutdown(){}};const nc=Symbol.for(`nodejs.util.inspect.custom`);function rc(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function ic(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}N();var ac=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Tn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=ci.now(),this._performanceOffset=t-(this._performanceStartTime+ci.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return M.warn(`Invalid attribute key: ${e}`),this;if(!Hr(t))return M.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return M.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&M.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),_i(t)&&(_i(n)||(n=t),t=void 0);let i=Br(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&M.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=Br(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Tn.UNSET||this.status.code===Tn.OK)return this;let t={code:e.code};return e.code===Tn.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&M.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){M.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=pi(this.startTime,this.endTime),this._duration[0]<0&&(M.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&M.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&M.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=ci.now())return fi(e+this._performanceOffset);if(typeof e==`number`)return di(e);if(e instanceof Date)return di(e.getTime());if(gi(e))return e;if(this._startTimeProvided)return di(Date.now());let t=ci.now()-this._performanceStartTime;return vi(this.startTime,di(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[$r]=e:e&&(e.code?n[ti]=e.code.toString():e.name&&(n[ti]=e.name),e.message&&(n[$r]=e.message),e.stack&&(n[ei]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(`exception`,n,t):M.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);M.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(M.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[nc](e,t,n){return ic(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:rc(this.resource)}},e,t,n)}},oc;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(oc||={});const sc=`otel.span.sampling_result`;var cc=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(`otel.sdk.span.started`,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(`otel.sdk.span.live`,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=uc(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":lc(e),[sc]:n}),t===oc.NOT_RECORD)return()=>{};let r={[sc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function lc(e){return e?e.isRemote?`remote`:`local`:`none`}function uc(e){switch(e){case oc.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case oc.RECORD:return`RECORD_ONLY`;case oc.NOT_RECORD:return`DROP`}}N();var dc=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,`2.11.0`);this._tracerMetrics=new cc(n)}startSpan(e,t={},n=Hn.active()){t.root&&(n=gr.deleteSpan(n));let r=gr.getSpan(n);if(Mr(n))return M.debug(`Instrumentation suppressed, returning Noop Span`),gr.wrapSpanContext(Ut);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!gr.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??Cn.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:Br(e.attributes)})),d=Br(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===xn.RECORD_AND_SAMPLED?zt.SAMPLED:zt.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===xn.NOT_RECORD)return M.debug(`Recording is off, propagating context in a non-recording span`),gr.wrapSpanContext(h);let g=Br(Object.assign(d,f.attributes));return new ac({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:g,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Hn.active(),c=this.startSpan(e,i,s),l=gr.setSpan(s,c);return Hn.with(l,o,void 0,c)}[nc](e,t,n){return ic(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:rc(this._resource)},spanLimits:this._spanLimits},e,t,n)}},fc=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Yr(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},pc=class{shouldSample(){return{decision:oc.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},mc=class{shouldSample(){return{decision:oc.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};N();var hc=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(Yr(Error(`ParentBasedSampler must have a root sampler configured`)),new mc),this._remoteParentSampled=e.remoteParentSampled??new mc,this._remoteParentNotSampled=e.remoteParentNotSampled??new pc,this._localParentSampled=e.localParentSampled??new mc,this._localParentNotSampled=e.localParentNotSampled??new pc}shouldSample(e,t,n,r,i,a){let o=gr.getSpanContext(e);return!o||!an(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&zt.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&zt.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};const gc=new Map;var _c=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=gc.get(e)??0;if(gc.set(e,r+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[Qr]:`queue_full`},this.processedSpans=t.createCounter(`otel.sdk.processor.span.processed`,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(`otel.sdk.processor.span.queue.capacity`,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(`otel.sdk.processor.span.queue.size`,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[Qr]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};N();var vc=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new ta(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(M.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):ct();this._metrics=new _c(`batching_span_processor`,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&zt.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&M.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(M.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);Hn.with(jr(Hn.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===yi.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{Yr(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Yr(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},yc=class extends vc{onShutdown(){}},bc=class{generateTraceId=Sc(16);generateSpanId=Sc(8)};const xc=Buffer.allocUnsafe(16);function Sc(e){return function(){for(let t=0;t<e/4;t++)xc.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(xc[t]>0);t++)t===e-1&&(xc[e-1]=1);return xc.toString(`hex`,0,e)}}N();var Cc;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Cc||={});var wc=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??Is();let t=e.spanProcessors??[];this._activeSpanProcessor=new fc(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new hc({root:new mc}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new bc,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return ct()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new dc({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(e){let t=e?.timeoutMillis??this._forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${t} ms`)),r=Cc.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==Cc.timeout&&(r=Cc.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Cc.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==Cc.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[nc](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return ic(`TracerProvider`,{resource:{attributes:rc(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};N();var Tc=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:nn(t)&&this._accumulate(t)<this._upperBound?oc.RECORD_AND_SAMPLED:oc.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};N();var Ec;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Ec||={});function Dc(){return{sampler:Oc(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:Xr(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:Xr(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:Xr(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:Xr(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:Xr(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:Xr(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:Xr(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:Xr(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function Oc(){let e=Zr(`OTEL_TRACES_SAMPLER`)??Ec.ParentBasedAlwaysOn;switch(e){case Ec.AlwaysOn:return new mc;case Ec.AlwaysOff:return new pc;case Ec.ParentBasedAlwaysOn:return new hc({root:new mc});case Ec.ParentBasedAlwaysOff:return new hc({root:new pc});case Ec.TraceIdRatio:return new Tc(kc());case Ec.ParentBasedTraceIdRatio:return new hc({root:new Tc(kc())});default:return M.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Ec.ParentBasedAlwaysOn}".`),new hc({root:new mc})}}function kc(){let e=Xr(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(M.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):e<0||e>1?(M.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to 1.`),1):e}function Ac(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??Xr(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??Xr(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??Xr(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??Xr(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}var jc=class extends wc{constructor(e={}){let t=Gi({},Dc(),Ac(e));delete t.generalLimits,super(t)}},Mc=class extends yc{constructor(e,t){t||={};for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(t[e]===void 0){let r=Xr(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}},Nc;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e[e.LOWMEMORY=2]=`LOWMEMORY`})(Nc||={}),N();const Pc=()=>Ka.CUMULATIVE,Fc=e=>{switch(e){case qa.COUNTER:case qa.OBSERVABLE_COUNTER:case qa.GAUGE:case qa.HISTOGRAM:case qa.OBSERVABLE_GAUGE:return Ka.DELTA;case qa.UP_DOWN_COUNTER:case qa.OBSERVABLE_UP_DOWN_COUNTER:return Ka.CUMULATIVE}},Ic=e=>{switch(e){case qa.COUNTER:case qa.HISTOGRAM:return Ka.DELTA;case qa.GAUGE:case qa.UP_DOWN_COUNTER:case qa.OBSERVABLE_UP_DOWN_COUNTER:case qa.OBSERVABLE_COUNTER:case qa.OBSERVABLE_GAUGE:return Ka.CUMULATIVE}};function Lc(){let e=(Ea(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`)??`cumulative`).toLowerCase();return e===`cumulative`?Pc:e===`delta`?Fc:e===`lowmemory`?Ic:(M.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Pc)}function Rc(e){return e==null?Lc():e===Nc.DELTA?Fc:e===Nc.LOWMEMORY?Ic:Pc}const zc=Object.freeze({type:Ya.DEFAULT});function Bc(e){return e?.aggregationPreference??(()=>zc)}var Vc=class extends ca{_aggregationTemporalitySelector;_aggregationSelector;constructor(e,t){super(e),this._aggregationSelector=Bc(t),this._aggregationTemporalitySelector=Rc(t?.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}},Hc=class extends Vc{constructor(e){super(us(Os(e??{},`METRICS`,`v1/metrics`,{"Content-Type":`application/json`}),No),e)}},Uc;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Uc||={});var P;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(P||={});var Wc;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Wc||={});function Gc(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Kc(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}var qc=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Jc(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new qc(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Yc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xc(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Zc(e,t){return e.toLowerCase()===t.toLowerCase()}var Qc;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(Qc||={});var $c=class{kind=Qc.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};function el(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var tl=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=el(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Xc(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},nl=class{kind=Qc.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new tl(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new tl(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new tl(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wc.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===P.GAUGE||e.type===P.UP_DOWN_COUNTER||e.type===P.OBSERVABLE_GAUGE||e.type===P.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}},rl=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new il,t=0,n=0,r=0){this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},il=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}};const al=-1022,ol=2**-1022,sl=new DataView(new ArrayBuffer(8));function cl(e){return sl.setFloat64(0,e),{hi:sl.getUint32(0),lo:sl.getUint32(4)}}function ll(e){let{hi:t}=cl(e);return((t&2146435072)>>20)-1023}function ul(e){let{hi:t,lo:n}=cl(e);return!(t&1048575)&&n===0}function dl(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function fl(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var pl=class extends Error{},ml=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<ol?this._minNormalLowerBoundaryIndex():ll(e)+(ul(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new pl(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new pl(`overflow: ${e} is > maximum lower boundary: ${n}`);return dl(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=al>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}},hl=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=dl(Math.LOG2E,e),this._inverseFactor=dl(Math.LN2,-e)}mapToIndex(e){if(e<=ol)return this._minNormalLowerBoundaryIndex()-1;if(ul(e))return(ll(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new pl(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return ol;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new pl(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return al<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}};const gl=Array.from({length:31},(e,t)=>t>10?new hl(t-10):new ml(t-10));function _l(e){if(e>20||e<-10)throw new pl(`expected scale >= -10 && <= 20, got: ${e}`);return gl[e+10]}N();var vl=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},yl=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=160,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new rl,l=new rl,u=_l(20)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<2&&(M.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"../../_chunks/node/rolldown-runtime-tZXQYakl.js";import{At as o,Et as s,L as c,Nt as l,St as u,X as d,Y as f,_t as p,at as m,bt as h,dt as g,gt as _,ht as v,mt as y,pt as b,q as x,ut as S,vt as C,xt as w,yt as T}from"../../_chunks/node/dist-CO_n_hUa.js";import{f as E,i as D}from"../../_chunks/node/dist-BKsV21Vu.js";import{t as ee}from"../../_chunks/node/undici-B61sz6UT.js";import{createRequire as te}from"node:module";import{basename as O,join as ne}from"node:path";import{createHmac as re,timingSafeEqual as ie}from"crypto";import{Readable as ae}from"stream";import*as oe from"zlib";import{tmpdir as k}from"node:os";import{inspect as se}from"util";import*as ce from"path";import*as le from"fs";import{createReadStream as ue}from"node:fs";import{Readable as de}from"node:stream";import{mkdtemp as A,readFile as fe,rm as pe,stat as me,writeFile as he}from"node:fs/promises";import j from"#compiled/zod/index.js";import{Buffer as ge}from"node:buffer";import{createHmac as _e,randomUUID as ve,timingSafeEqual as ye}from"node:crypto";import{channel as be,tracingChannel as xe}from"node:diagnostics_channel";import{spawn as Se}from"node:child_process";var Ce,we=n((()=>{Ce=`1.9.1`}));function Te(e){let t=new Set([e]),n=new Set,r=e.match(Ee);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(Ee);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var Ee,De,Oe=n((()=>{we(),Ee=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,De=Te(Ce)}));function ke(e,t,n,r=!1){let i=Pe[Ne]=Pe[Ne]??{version:Ce};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Ce}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Ce}.`),!0}function Ae(e){let t=Pe[Ne]?.version;if(t&&De(t))return Pe[Ne]?.[e]}function je(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Ce}.`);let n=Pe[Ne];n&&delete n[e]}var Me,Ne,Pe,Fe=n((()=>{we(),Oe(),Me=Ce.split(`.`)[0],Ne=Symbol.for(`opentelemetry.js.api.${Me}`),Pe=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function Ie(e,t,n){let r=Ae(`diag`);if(r)return r[e](t,...n)}var Le,Re=n((()=>{Fe(),Le=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return Ie(`debug`,this._namespace,e)}error(...e){return Ie(`error`,this._namespace,e)}info(...e){return Ie(`info`,this._namespace,e)}warn(...e){return Ie(`warn`,this._namespace,e)}verbose(...e){return Ie(`verbose`,this._namespace,e)}}})),ze,Be=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(ze||={})}));function Ve(e,t){e<ze.NONE?e=ze.NONE:e>ze.ALL&&(e=ze.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,ze.ERROR),warn:n(`warn`,ze.WARN),info:n(`info`,ze.INFO),debug:n(`debug`,ze.DEBUG),verbose:n(`verbose`,ze.VERBOSE)}}var He=n((()=>{Be()})),Ue,We,Ge=n((()=>{Re(),He(),Be(),Fe(),Ue=`diag`,We=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=Ae(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:ze.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=Ae(`diag`),i=Ve(n.logLevel??ze.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return ke(`diag`,i,t,!0)},t.disable=()=>{je(Ue,t)},t.createComponentLogger=e=>new Le(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),Ke,qe=n((()=>{Ke=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}})),Je,Ye=n((()=>{Je=Symbol(`BaggageEntryMetadata`)}));function Xe(e={}){return new Ke(new Map(Object.entries(e)))}function Ze(e){return typeof e!=`string`&&(Qe.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:Je,toString(){return e}}}var Qe,$e=n((()=>{Ge(),qe(),Ye(),Qe=We.instance()}));function et(e){return Symbol.for(e)}var tt,nt,rt=n((()=>{tt=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},nt=new tt})),it,at,ot,st=n((()=>{if(it=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],at={},typeof console<`u`)for(let e of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[e]==`function`&&(at[e]=console[e]);ot=class{constructor(){function e(e){return function(...t){let n=at[e];if(typeof n!=`function`&&(n=at.log),typeof n!=`function`&&console&&(n=console[e],typeof n!=`function`&&(n=console.log)),typeof n==`function`)return n.apply(console,t)}}for(let t=0;t<it.length;t++)this[it[t].n]=e(it[t].c)}}}));function ct(){return yt}var lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt,xt,St,Ct,wt,Tt,Et,Dt=n((()=>{lt=class{constructor(){}createGauge(e,t){return xt}createHistogram(e,t){return St}createCounter(e,t){return bt}createUpDownCounter(e,t){return Ct}createObservableGauge(e,t){return Tt}createObservableCounter(e,t){return wt}createObservableUpDownCounter(e,t){return Et}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},ut=class{},dt=class extends ut{add(e,t){}},ft=class extends ut{add(e,t){}},pt=class extends ut{record(e,t){}},mt=class extends ut{record(e,t){}},ht=class{addCallback(e){}removeCallback(e){}},gt=class extends ht{},_t=class extends ht{},vt=class extends ht{},yt=new lt,bt=new dt,xt=new pt,St=new mt,Ct=new ft,wt=new gt,Tt=new _t,Et=new vt})),Ot,kt=n((()=>{(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(Ot||={})})),At,jt,Mt=n((()=>{At={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},jt={set(e,t,n){e!=null&&(e[t]=n)}}})),Nt,Pt=n((()=>{rt(),Nt=class{active(){return nt}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Ft,It,Lt,Rt=n((()=>{Pt(),Fe(),Ge(),Ft=`context`,It=new Nt,Lt=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return ke(Ft,e,We.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return Ae(Ft)||It}disable(){this._getContextManager().disable(),je(Ft,We.instance())}}})),zt,Bt=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(zt||={})})),Vt,Ht,Ut,Wt=n((()=>{Bt(),Vt=`0000000000000000`,Ht=`00000000000000000000000000000000`,Ut={traceId:Ht,spanId:Vt,traceFlags:zt.NONE}})),Gt,Kt=n((()=>{Wt(),Gt=class{constructor(e=Ut){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function qt(e){return e.getValue($t)||void 0}function Jt(){return qt(Lt.getInstance().active())}function Yt(e,t){return e.setValue($t,t)}function Xt(e){return e.deleteValue($t)}function Zt(e,t){return Yt(e,new Gt(t))}function Qt(e){return qt(e)?.spanContext()}var $t,en=n((()=>{rt(),Kt(),Rt(),$t=et(`OpenTelemetry Context Key SPAN`)}));function tn(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(sn[e.charCodeAt(t)]|0)+(sn[e.charCodeAt(t+1)]|0)+(sn[e.charCodeAt(t+2)]|0)+(sn[e.charCodeAt(t+3)]|0);return n===t}function nn(e){return tn(e,32)&&e!==`00000000000000000000000000000000`}function rn(e){return tn(e,16)&&e!==`0000000000000000`}function an(e){return nn(e.traceId)&&rn(e.spanId)}function on(e){return new Gt(e)}var sn,cn=n((()=>{Wt(),Kt(),sn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function ln(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var un,dn,fn=n((()=>{Rt(),en(),Kt(),cn(),un=Lt.getInstance(),dn=class{startSpan(e,t,n=un.active()){if(t?.root)return new Gt;let r=n&&Qt(n);return ln(r)&&an(r)?new Gt(r):new Gt}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??un.active(),c=this.startSpan(e,i,s),l=Yt(s,c);return un.with(l,o,void 0,c)}}})),pn,mn,hn=n((()=>{fn(),pn=new dn,mn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):pn}}})),gn,_n=n((()=>{fn(),gn=class{getTracer(e,t,n){return new dn}}})),vn,yn,bn=n((()=>{hn(),_n(),vn=new gn,yn=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new mn(this,e,t,n)}getDelegate(){return this._delegate??vn}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),xn,Sn=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(xn||={})})),Cn,wn=n((()=>{(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(Cn||={})})),Tn,En=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Tn||={})}));function Dn(e){return An.test(e)}function On(e){return jn.test(e)&&!Mn.test(e)}var kn,An,jn,Mn,Nn=n((()=>{kn=`[_0-9a-z-*/]`,An=RegExp(`^(?:${`[a-z]${kn}{0,255}`}|${`[a-z0-9]${kn}{0,240}@[a-z]${kn}{0,13}`})$`),jn=/^[ -~]{0,255}[!-~]$/,Mn=/,|=/})),Pn,Fn,In,Ln,Rn,zn=n((()=>{Nn(),Pn=32,Fn=512,In=`,`,Ln=`=`,Rn=class e{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,t)=>(e.push(t+Ln+this.get(t)),e),[]).join(In)}_parse(e){e.length>Fn||(this._internalState=e.split(In).reduceRight((e,t)=>{let n=t.trim(),r=n.indexOf(Ln);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Dn(i)&&On(a)&&e.set(i,a)}return e},new Map),this._internalState.size>Pn&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Pn))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}}}));function Bn(e){return new Rn(e)}var Vn=n((()=>{zn()})),Hn,Un=n((()=>{Rt(),Hn=Lt.getInstance()})),M,Wn=n((()=>{Ge(),M=We.instance()})),Gn,Kn,qn=n((()=>{Dt(),Gn=class{getMeter(e,t,n){return yt}},Kn=new Gn})),Jn,Yn,Xn=n((()=>{qn(),Fe(),Ge(),Jn=`metrics`,Yn=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalMeterProvider(e){return ke(Jn,e,We.instance())}getMeterProvider(){return Ae(Jn)||Kn}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){je(Jn,We.instance())}}})),Zn,Qn=n((()=>{Xn(),Zn=Yn.getInstance()})),$n,er=n((()=>{$n=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function tr(e){return e.getValue(ar)||void 0}function nr(){return tr(Lt.getInstance().active())}function rr(e,t){return e.setValue(ar,t)}function ir(e){return e.deleteValue(ar)}var ar,or=n((()=>{Rt(),rt(),ar=et(`OpenTelemetry Baggage Key`)})),sr,cr,lr,ur=n((()=>{Fe(),er(),Mt(),or(),$e(),Ge(),sr=`propagation`,cr=new $n,lr=class e{constructor(){this.createBaggage=Xe,this.getBaggage=tr,this.getActiveBaggage=nr,this.setBaggage=rr,this.deleteBaggage=ir}static getInstance(){return this._instance||=new e,this._instance}setGlobalPropagator(e){return ke(sr,e,We.instance())}inject(e,t,n=jt){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=At){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){je(sr,We.instance())}_getGlobalPropagator(){return Ae(sr)||cr}}})),dr,fr=n((()=>{ur(),dr=lr.getInstance()})),pr,mr,hr=n((()=>{Fe(),bn(),cn(),en(),Ge(),pr=`trace`,mr=class e{constructor(){this._proxyTracerProvider=new yn,this.wrapSpanContext=on,this.isSpanContextValid=an,this.deleteSpan=Xt,this.getSpan=qt,this.getActiveSpan=Jt,this.getSpanContext=Qt,this.setSpan=Yt,this.setSpanContext=Zt}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=ke(pr,this._proxyTracerProvider,We.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return Ae(pr)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){je(pr,We.instance()),this._proxyTracerProvider=new yn}}})),gr,_r=n((()=>{hr(),gr=mr.getInstance()})),vr=i({DiagConsoleLogger:()=>ot,DiagLogLevel:()=>ze,INVALID_SPANID:()=>Vt,INVALID_SPAN_CONTEXT:()=>Ut,INVALID_TRACEID:()=>Ht,ProxyTracer:()=>mn,ProxyTracerProvider:()=>yn,ROOT_CONTEXT:()=>nt,SamplingDecision:()=>xn,SpanKind:()=>Cn,SpanStatusCode:()=>Tn,TraceFlags:()=>zt,ValueType:()=>Ot,baggageEntryMetadataFromString:()=>Ze,context:()=>Hn,createContextKey:()=>et,createNoopMeter:()=>ct,createTraceState:()=>Bn,default:()=>yr,defaultTextMapGetter:()=>At,defaultTextMapSetter:()=>jt,diag:()=>M,isSpanContextValid:()=>an,isValidSpanId:()=>rn,isValidTraceId:()=>nn,metrics:()=>Zn,propagation:()=>dr,trace:()=>gr}),yr,N=n((()=>{$e(),rt(),st(),Be(),Dt(),kt(),Mt(),hn(),bn(),Sn(),wn(),En(),Bt(),Vn(),cn(),Wt(),Un(),Wn(),Qn(),fr(),_r(),yr={context:Hn,diag:M,metrics:Zn,propagation:dr,trace:gr}}));N();var br;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(br||={});var xr=class{emit(e){}enabled(){return!1}};const Sr=new xr,Cr=Symbol.for(`io.opentelemetry.js.api.logs`),wr=globalThis;function Tr(e,t,n){return r=>r===e?t:n}const Er=new class{getLogger(e,t,n){return new xr}};var Dr=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Sr}},Or=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Dr(this,e,t,n)}_getDelegate(){return this._delegate??Er}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}};const kr=class e{constructor(){this._proxyLoggerProvider=new Or}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return wr[Cr]?this.getLoggerProvider():(wr[Cr]=Tr(1,e,Er),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return wr[Cr]?.call(wr,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete wr[Cr],this._proxyLoggerProvider=new Or}}.getInstance(),Ar=et(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function jr(e){return e.setValue(Ar,!0)}function Mr(e){return e.getValue(Ar)===!0}const Nr=`baggage`;N();function Pr(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Fr(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Ir(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=Ze(e.substring(t+1))),{key:o,value:s,metadata:c}}function Lr(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=Ir(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}function Rr(e){let t={};return typeof e==`string`&&e.length>0&&e.split(`,`).forEach(e=>{let n=Ir(e);n!==void 0&&n.value.length>0&&(t[n.key]=n.value)}),t}N();var zr=class{inject(e,t,n){let r=dr.getBaggage(e);if(!r||Mr(e))return;let i=Pr(Fr(r).filter(e=>e.length<=4096).slice(0,180));i.length>0&&n.set(t,Nr,i)}extract(e,t,n){let r=n.get(t,Nr);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=Lr(r[e],i,a,o);else[a]=Lr(r,i,a,o);return a===0?e:dr.setBaggage(e,dr.createBaggage(i))}fields(){return[Nr]}};N();function Br(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Vr(n)){M.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Hr(r)){M.warn(`Invalid attribute value set for key: ${n}`);continue}t[n]=Array.isArray(r)?r.slice():r}return t}function Vr(e){return typeof e==`string`&&e!==``}function Hr(e){return e==null?!0:Array.isArray(e)?Ur(e):Wr(typeof e)}function Ur(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Wr(e)){t=e;continue}return!1}return!1}}return!0}function Wr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}N();function Gr(){return e=>{M.error(Kr(e))}}function Kr(e){return typeof e==`string`?e:JSON.stringify(qr(e))}function qr(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}let Jr=Gr();function Yr(e){try{Jr(e)}catch{}}N();function Xr(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){M.warn(`Unknown value ${se(t)} for ${e}, expected a number, using defaults`);return}return n}function Zr(e){let t=process.env[e];if(t!=null&&t.trim()!==``)return t}const Qr=`error.type`,$r=`exception.message`,ei=`exception.stacktrace`,ti=`exception.type`,ni=`service.name`,ri=`telemetry.sdk.language`,ii=`nodejs`,ai=`telemetry.sdk.name`,oi=`telemetry.sdk.version`,si={[ai]:`opentelemetry`,"process.runtime.name":`node`,[ri]:ii,[oi]:`2.11.0`},ci=performance,li=10**6,ui=10**9;function di(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*li)]}function fi(e){return vi(di(ci.timeOrigin),di(typeof e==`number`?e:ci.now()))}function pi(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ui),[n,r]}function mi(e){return e[0]*1e6+e[1]/1e3}function hi(e){return e[0]+e[1]/ui}function gi(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function _i(e){return gi(e)||typeof e==`number`||e instanceof Date}function vi(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=ui&&(n[1]-=ui,n[0]+=1),n}var yi;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(yi||={}),N();var bi=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let t=new Set;for(let e of this._propagators){let n=typeof e.fields==`function`?e.fields():[];for(let e of n)t.add(e)}this._fields=Array.from(t)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){M.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){M.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}};const xi=`[_0-9a-z-*/]`,Si=RegExp(`^(?:${`[a-z]${xi}{0,255}`}|${`[a-z0-9]${xi}{0,240}@[a-z]${xi}{0,13}`})$`),Ci=/^[ -~]{0,255}[!-~]$/,wi=/,|=/;function Ti(e){return Si.test(e)}function Ei(e){return Ci.test(e)&&!wi.test(e)}var Di=class e{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Ti(e)||!Ei(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(i+=typeof r==`string`?t.length-r.length:e.length+t.length+(n.size>0?2:1),i>512)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=`,`+e),e=`${n[0]}=${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(`,`),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(`=`);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Ti(a)||!Ei(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>512)&&(t.set(a,o),n=s,t.size>=32))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}};N();const Oi=`traceparent`,ki=`tracestate`,Ai=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function ji(e){let t=Ai.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Mi=class{inject(e,t,n){let r=gr.getSpanContext(e);if(!r||Mr(e)||!an(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||zt.NONE).toString(16)}`;n.set(t,Oi,i),r.traceState&&n.set(t,ki,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Oi);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=ji(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,ki);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Di(typeof e==`string`?e:void 0)}return gr.setSpanContext(e,a)}fields(){return[Oi,ki]}};const Ni=Function.prototype.toString,Pi=Ni.call(Object),Fi=Object.getPrototypeOf,Ii=Object.prototype,Li=Ii.hasOwnProperty,Ri=Symbol?Symbol.toStringTag:void 0,zi=Ii.toString;function Bi(e){if(!Vi(e)||Hi(e)!==`[object Object]`)return!1;let t=Fi(e);if(t===null)return!0;let n=Li.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Ni.call(n)===Pi}function Vi(e){return typeof e==`object`&&!!e}function Hi(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Ri&&Ri in Object(e)?Ui(e):Wi(e)}function Ui(e){let t=Li.call(e,Ri),n=e[Ri],r=!1;try{e[Ri]=void 0,r=!0}catch{}let i=zi.call(e);return r&&(t?e[Ri]=n:delete e[Ri]),i}function Wi(e){return zi.call(e)}function Gi(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=qi(t,e.shift(),0,n);return t}function Ki(e){return Yi(e)?e.slice():e}function qi(e,t,n=0,r){let i;if(!(n>20)){if(n++,Qi(e)||Qi(t)||Xi(t))i=Ki(t);else if(Yi(e)){if(i=e.slice(),Yi(t))for(let e=0,n=t.length;e<n;e++)i.push(Ki(t[e]));else if(Zi(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r!==`__proto__`&&r!==`constructor`&&r!==`prototype`&&(i[r]=Ki(t[r]))}}}else if(Zi(e)){if(Zi(t)){if(!$i(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Qi(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Ji(e,s,r)||Ji(t,s,r))delete i[s];else{if(Zi(a)&&Zi(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=qi(i[s],c,n,r)}}}}else i=t}return i}}function Ji(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function Yi(e){return Array.isArray(e)}function Xi(e){return typeof e==`function`}function Zi(e){return!Qi(e)&&!Yi(e)&&!Xi(e)&&typeof e==`object`}function Qi(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function $i(e,t){return!(!Bi(e)||!Bi(t))}var ea=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},ta=class{_isCalled=!1;_deferred=new ea;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};N();function na(e,t){return new Promise(n=>{Hn.with(jr(Hn.active()),()=>{e.export(t,n)})})}const ra={_export:na};var ia=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractAsyncHooksContextManager=void 0;let n=t(`events`),r=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`];e.AbstractAsyncHooksContextManager=class{bind(e,t){return t instanceof n.EventEmitter?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindEventEmitter(e,t){return this._getPatchMap(t)===void 0?(this._createPatchMap(t),r.forEach(n=>{t[n]!==void 0&&(t[n]=this._patchAddListener(t,t[n],e))}),typeof t.removeListener==`function`&&(t.removeListener=this._patchRemoveListener(t,t.removeListener)),typeof t.off==`function`&&(t.off=this._patchRemoveListener(t,t.off)),typeof t.removeAllListeners==`function`&&(t.removeAllListeners=this._patchRemoveAllListeners(t,t.removeAllListeners)),t):t}_patchRemoveListener(e,t){let n=this;return function(r,i){let a=n._getPatchMap(e)?.[r];if(a===void 0)return t.call(this,r,i);let o=a.get(i);return t.call(this,r,o||i)}}_patchRemoveAllListeners(e,t){let n=this;return function(r){let i=n._getPatchMap(e);return i!==void 0&&(arguments.length===0?n._createPatchMap(e):i[r]!==void 0&&delete i[r]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let r=this;return function(i,a){if(r._wrapped)return t.call(this,i,a);let o=r._getPatchMap(e);o===void 0&&(o=r._createPatchMap(e));let s=o[i];s===void 0&&(s=new WeakMap,o[i]=s);let c=r.bind(n,a);s.set(a,c),r._wrapped=!0;try{return t.call(this,i,c)}finally{r._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol(`OtListeners`);_wrapped=!1}})),aa=a((n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AsyncHooksContextManager=void 0;let r=(N(),e(vr)),i=t(`async_hooks`),a=ia();n.AsyncHooksContextManager=class extends a.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=i.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??r.ROOT_CONTEXT}with(e,t,n,...r){this._enterContext(e);try{return t.call(n,...r)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,t){if(t===`TIMERWRAP`)return;let n=this._stack[this._stack.length-1];n!==void 0&&this._contexts.set(e,n)}_destroy(e){this._contexts.delete(e)}_before(e){let t=this._contexts.get(e);t!==void 0&&this._enterContext(t)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}}})),oa=a((n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AsyncLocalStorageContextManager=void 0;let r=(N(),e(vr)),i=t(`async_hooks`),a=ia();var o=class{_isDisposed=!1;_previousContext;_asyncLocalStorage;constructor(e,t){this._previousContext=e,this._asyncLocalStorage=t}dispose(){this._isDisposed||=(this._asyncLocalStorage.enterWith(this._previousContext),!0)}};n.AsyncLocalStorageContextManager=class extends a.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new i.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??r.ROOT_CONTEXT}with(e,t,n,...r){let i=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,i,...r)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}attach(e){let t=this._asyncLocalStorage.withScope;if(t)return t.call(this._asyncLocalStorage,e);let n=this.active();return this._asyncLocalStorage.enterWith(e),new o(n,this._asyncLocalStorage)}}})),sa=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncLocalStorageContextManager=e.AsyncHooksContextManager=void 0;var t=aa();Object.defineProperty(e,"AsyncHooksContextManager",{enumerable:!0,get:function(){return t.AsyncHooksContextManager}});var n=oa();Object.defineProperty(e,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return n.AsyncLocalStorageContextManager}})})),ca=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},la=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function ua(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function da(e){if(e!=null)return async()=>e}function fa(e,t,n){return{timeoutMillis:ua(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function pa(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var ma=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function ha(e){return new ma(e.concurrencyLimit)}N();const ga=et(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function _a(e){return e.setValue(ga,!0)}N();function va(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=Ze(e.substring(t+1))),{key:o,value:s,metadata:c}}function ya(e){let t={};return typeof e==`string`&&e.length>0&&e.split(`,`).forEach(e=>{let n=va(e);n!==void 0&&n.value.length>0&&(t[n.key]=n.value)}),t}N();function ba(){return e=>{M.error(xa(e))}}function xa(e){return typeof e==`string`?e:JSON.stringify(Sa(e))}function Sa(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}let Ca=ba();function wa(e){try{Ca(e)}catch{}}N();function Ta(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){M.warn(`Unknown value ${se(t)} for ${e}, expected a number, using defaults`);return}return n}function Ea(e){let t=process.env[e];if(t!=null&&t.trim()!==``)return t}const Da={[ai]:`opentelemetry`,"process.runtime.name":`node`,[ri]:ii,[oi]:`2.7.1`},Oa=performance,ka=10**6,Aa=10**9;function ja(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*ka)]}function Ma(e){return Ia(ja(Oa.timeOrigin),ja(typeof e==`number`?e:Oa.now()))}function Na(e){if(Fa(e))return e;if(typeof e==`number`)return e<Oa.timeOrigin?Ma(e):ja(e);if(e instanceof Date)return ja(e.getTime());throw TypeError(`Invalid input type`)}function Pa(e){return e[0]*Aa+e[1]}function Fa(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Ia(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Aa&&(n[1]-=Aa,n[0]+=1),n}var La;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(La||={});var Ra=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function za(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Ra(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Ba=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},Va=class{_isCalled=!1;_deferred=new Ba;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};N();function Ha(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Ua(){return{handleResponse(e){e!=null&&Ha(e)&&e.partialSuccess!=null&&Object.keys(e.partialSuccess).length!==0&&M.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}N();var Wa=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=M.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:La.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:La.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:La.SUCCESS});return}if(e.status===`failure`&&e.error){t({code:La.FAILED,error:e.error});return}e.status===`retryable`?t({code:La.FAILED,error:e.error??new la(`Export failed with retryable status`)}):t({code:La.FAILED,error:new la(`Export failed with unknown error`)})},e=>t({code:La.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function Ga(e,t){return new Wa(e.transport,e.serializer,Ua(),e.promiseHandler,t.timeout)}var Ka;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Ka||={});var qa;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(qa||={});var Ja;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Ja||={});var Ya;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(Ya||={});let Xa;function Za(){if(Xa===void 0)try{let e=globalThis.process.argv0;Xa=e?`unknown_service:${e}`:`unknown_service`}catch{Xa=`unknown_service`}return Xa}const Qa=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;N();var $a=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=no(t),r._asyncAttributesPending=t.filter(([e,t])=>Qa(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Qa(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=no(this._rawAttributes),this._schemaUrl=ro(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Qa(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&M.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Qa(n)){M.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=io(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function eo(e,t){return $a.FromAttributeList(Object.entries(e),t)}function to(){return eo({[ni]:Za(),[ri]:Da[ri],[ai]:Da[ai],[oi]:Da[oi]})}function no(e){return e.map(([e,t])=>Qa(t)?[e,t.catch(t=>{M.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ro(e){if(typeof e==`string`||e===void 0)return e;M.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function io(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;M.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function ao(e,t){let n={attributes:so(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function oo(e){return{name:e.name,version:e.version}}function so(e,t){return Object.keys(e).map(n=>co(n,e[n],t))}function co(e,t,n){return{key:e,value:lo(t,n)}}function lo(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=lo(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:lo(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function uo(e,t){return{resourceLogs:po(e,t)}}function fo(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function po(e,t){let n=fo(e);return Array.from(n,([e,n])=>{let r=ao(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:oo(e[0].instrumentationScope),logRecords:e.map(e=>mo(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function mo(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:ho(e.severityNumber),severityText:e.severityText,body:lo(e.body,t),eventName:e.eventName,attributes:go(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function ho(e){return e}function go(e,t){return Object.keys(e).map(n=>co(n,e[n],t))}function _o(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function vo(e){return _o(e).toString()}const yo=typeof BigInt<`u`?vo:Pa;function bo(e){return e}const xo={encodeHrTime:yo,encodeSpanContext:bo,encodeOptionalSpanContext:bo,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};N();const So={serializeRequest:e=>{let t=uo(e,xo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return M.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};var Co;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]=`AGGREGATION_TEMPORALITY_UNSPECIFIED`,e[e.AGGREGATION_TEMPORALITY_DELTA=1]=`AGGREGATION_TEMPORALITY_DELTA`,e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]=`AGGREGATION_TEMPORALITY_CUMULATIVE`})(Co||={}),N();function wo(e,t){let n=ao(e.resource,t);return{resource:n,schemaUrl:n.schemaUrl,scopeMetrics:To(e.scopeMetrics,t)}}function To(e,t){return Array.from(e.map(e=>({scope:oo(e.scope),metrics:e.metrics.map(e=>Eo(e,t)),schemaUrl:e.scope.schemaUrl})))}function Eo(e,t){let n={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},r=jo(e.aggregationTemporality);switch(e.dataPointType){case Ja.SUM:n.sum={aggregationTemporality:r,isMonotonic:e.isMonotonic,dataPoints:Oo(e,t)};break;case Ja.GAUGE:n.gauge={dataPoints:Oo(e,t)};break;case Ja.HISTOGRAM:n.histogram={aggregationTemporality:r,dataPoints:ko(e,t)};break;case Ja.EXPONENTIAL_HISTOGRAM:n.exponentialHistogram={aggregationTemporality:r,dataPoints:Ao(e,t)}}return n}function Do(e,t,n){let r={attributes:so(e.attributes,n),startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)};switch(t){case Ot.INT:r.asInt=e.value;break;case Ot.DOUBLE:r.asDouble=e.value}return r}function Oo(e,t){return e.dataPoints.map(n=>Do(n,e.descriptor.valueType,t))}function ko(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:so(e.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function Ao(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:so(e.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function jo(e){switch(e){case Ka.DELTA:return Co.AGGREGATION_TEMPORALITY_DELTA;case Ka.CUMULATIVE:return Co.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Mo(e,t){return{resourceMetrics:e.map(e=>wo(e,t))}}N();const No={serializeRequest:e=>{let t=Mo([e],xo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return M.warn(`Failed to parse metrics export response: ${e.message}. Returning empty response`),{}}}};function Po(e,t){let n=e&255|256;return t&&(n|=512),n}function Fo(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:so(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Lo(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Io(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Po(n.traceFlags,e.parentSpanContext?.isRemote)}}function Io(e,t){return{attributes:e.attributes?so(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Po(e.context.traceFlags,e.context.isRemote)}}function Lo(e,t){return{attributes:e.attributes?so(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ro(e,t){return{resourceSpans:Bo(e,t)}}function zo(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Bo(e,t){let n=zo(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Fo(e,t));o.push({scope:oo(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=ao(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}N();const Vo={serializeRequest:e=>{let t=Ro(e,xo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return M.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};N();function Ho(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{n===void 0?M.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}function Uo(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,Ho(await e())),Object.assign(i,r)}}function Wo(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Go(e,t,n){return{...fa(e,t,n),headers:Uo(e.headers,t.headers,n.headers),url:Wo(e.url)??t.url??n.url}}function Ko(e,t){return{...pa(),headers:async()=>e,url:`http://localhost:4318/`+t}}function qo(e){return async t=>{let n=t===`http:`,{Agent:r}=await(n?import(`http`):import(`https`));if(n){let{ca:t,cert:n,key:i,...a}=e;return new r(a)}return new r(e)}}function Jo(e,t,n){return{...Go(e,t,n),agentFactory:e.agentFactory??t.agentFactory??n.agentFactory,userAgent:e.userAgent}}function Yo(e,t){return{...Ko(e,t),agentFactory:qo({keepAlive:!0})}}function Xo(e){return e===429||e===502||e===503||e===504}function Zo(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}const Qo=`OTel-OTLP-Exporter-JavaScript/0.218.0`;function $o(e,t,n,r,i,a,o,s){return new Promise(c=>{let l=new URL(t);n[`User-Agent`]=i?`${i} ${Qo}`:Qo;let u=e(l,{method:`POST`,headers:n,agent:a},e=>{let t=[],n=0;e.on(`data`,r=>{if(n+=r.length,n>4194304){c({status:`failure`,error:Error(`OTLP export response body exceeded size limit of 4194304 bytes`)}),e.destroy();return}t.push(r)}),e.on(`end`,()=>{e.statusCode&&e.statusCode<=299?c({status:`success`,data:Buffer.concat(t)}):e.statusCode&&Xo(e.statusCode)?c({status:`retryable`,retryInMillis:Zo(e.headers[`retry-after`])}):c({status:`failure`,error:new la(e.statusMessage,e.statusCode,Buffer.concat(t).toString())})}),e.on(`error`,t=>{e.statusCode&&e.statusCode<=299?c({status:`success`}):e.statusCode&&Xo(e.statusCode)?c({status:`retryable`,error:t,retryInMillis:Zo(e.headers[`retry-after`])}):c({status:`failure`,error:t})})});u.setTimeout(s,()=>{u.destroy(),c({status:`retryable`,error:Error(`Request timed out`)})}),u.on(`error`,e=>{ns(e)?c({status:`retryable`,error:e}):c({status:`failure`,error:e})}),es(u,r,o,e=>{c({status:`failure`,error:e})})})}function es(e,t,n,r){let i=ts(n);t===`gzip`&&(e.setHeader(`Content-Encoding`,`gzip`),i=i.on(`error`,r).pipe(oe.createGzip()).on(`error`,r)),i.pipe(e).on(`error`,r)}function ts(e){let t=new ae;return t.push(e),t.push(null),t}function ns(e){let t=new Set([`ECONNRESET`,`ECONNREFUSED`,`EPIPE`,`ETIMEDOUT`,`EAI_AGAIN`,`ENOTFOUND`,`ENETUNREACH`,`EHOSTUNREACH`]);return`code`in e&&typeof e.code==`string`&&t.has(e.code)}var rs=class{_utils=null;_parameters;constructor(e){this._parameters=e}async send(e,t){let{agent:n,request:r}=await this._loadUtils(),i=await this._parameters.headers();return $o(r,this._parameters.url,i,this._parameters.compression,this._parameters.userAgent,n,e,t)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let t=new URL(this._parameters.url).protocol,[n,r]=await Promise.all([this._parameters.agentFactory(t),is(t)]);e=this._utils={agent:n,request:r}}return e}};async function is(e){let{request:t}=await(e===`http:`?import(`http`):import(`https`));return t}function as(e){return new rs(e)}N();const os=.2;function ss(){return 2*os*Math.random()-os}var cs=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=5,r=1e3,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+ss()),5e3),0);r*=1.5;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return M.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;M.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?M.verbose(`Export succeeded after ${5-n} retry attempts.`):a.status===`retryable`?M.info(`Export failed after maximum retry attempts (5).`):M.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}};function ls(e){return new cs(e.transport)}function us(e,t){return Ga({transport:ls({transport:as(e)}),serializer:t,promiseHandler:ha(e)},{timeout:e.timeoutMillis})}N();function ds(e){let t=Ta(e);if(t!=null){if(Number.isFinite(t)&&t>0)return t;M.warn(`Configuration: ${e} is invalid, expected number greater than 0 (actual: ${t})`)}}function fs(e){let t=ds(`OTEL_EXPORTER_OTLP_${e}_TIMEOUT`),n=ds(`OTEL_EXPORTER_OTLP_TIMEOUT`);return t??n}function ps(e){let t=Ea(e)?.trim();if(t==null||t===`none`||t===`gzip`)return t;M.warn(`Configuration: ${e} is invalid, expected 'none' or 'gzip' (actual: '${t}')`)}function ms(e){let t=ps(`OTEL_EXPORTER_OTLP_${e}_COMPRESSION`),n=ps(`OTEL_EXPORTER_OTLP_COMPRESSION`);return t??n}function hs(e){return{timeoutMillis:fs(e),compression:ms(e)}}N();function gs(e){let t=Ea(`OTEL_EXPORTER_OTLP_${e}_HEADERS`),n=Ea(`OTEL_EXPORTER_OTLP_HEADERS`),r=ya(t),i=ya(n);if(Object.keys(r).length!==0||Object.keys(i).length!==0)return Object.assign({},ya(n),ya(t))}function _s(e){try{return new URL(e).toString()}catch{M.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}}function vs(e,t){try{new URL(e)}catch{M.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}e.endsWith(`/`)||(e+=`/`),e+=t;try{new URL(e)}catch{M.warn(`Configuration: Provided URL appended with '${t}' is not a valid URL, using 'undefined' instead of '${e}'`);return}return e}function ys(e){let t=Ea(`OTEL_EXPORTER_OTLP_ENDPOINT`);if(t!==void 0)return vs(t,e)}function bs(e){let t=Ea(`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`);if(t!==void 0)return _s(t)}function xs(e,t,n){let r=Ea(e),i=Ea(t),a=r??i;if(a!=null)try{return le.readFileSync(ce.resolve(process.cwd(),a))}catch{M.warn(n);return}}function Ss(e){return xs(`OTEL_EXPORTER_OTLP_${e}_CLIENT_CERTIFICATE`,`OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE`,`Failed to read client certificate chain file`)}function Cs(e){return xs(`OTEL_EXPORTER_OTLP_${e}_CLIENT_KEY`,`OTEL_EXPORTER_OTLP_CLIENT_KEY`,`Failed to read client certificate private key file`)}function ws(e){return xs(`OTEL_EXPORTER_OTLP_${e}_CERTIFICATE`,`OTEL_EXPORTER_OTLP_CERTIFICATE`,`Failed to read root certificate file`)}function Ts(e,t){return{...hs(e),url:bs(e)??ys(t),headers:da(gs(e)),agentFactory:qo({keepAlive:!0,ca:ws(e),cert:Ss(e),key:Cs(e)})}}function Es(e){return typeof e.headers==`function`?e.headers:da(e.headers)}N();function Ds(e){if(typeof e.httpAgentOptions==`function`)return e.httpAgentOptions;let t=e.httpAgentOptions;if(e.keepAlive!=null&&(t={keepAlive:e.keepAlive,...t}),t!=null)return qo(t)}function Os(e,t,n,r){return e.metadata&&M.warn(`Metadata cannot be set when using http`),Jo({url:e.url,headers:Es(e),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentFactory:Ds(e),userAgent:e.userAgent},Ts(t,n),Yo(r,n))}var ks=class extends ca{constructor(e={}){super(us(Os(e,`LOGS`,`v1/logs`,{"Content-Type":`application/json`}),So))}},As=class extends ca{constructor(e={}){super(us(Os(e,`TRACES`,`v1/traces`,{"Content-Type":`application/json`}),Vo))}};let js;function Ms(){if(js===void 0)try{let e=globalThis.process.argv0;js=e?`unknown_service:${e}`:`unknown_service`}catch{js=`unknown_service`}return js}const Ns=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;N();var Ps=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Ls(t),r._asyncAttributesPending=t.filter(([e,t])=>Ns(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Ns(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Ls(this._rawAttributes),this._schemaUrl=Rs(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Ns(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&M.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Ns(n)){M.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=zs(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Fs(e,t){return Ps.FromAttributeList(Object.entries(e),t)}function Is(){return Fs({[ni]:Ms(),[ri]:si[ri],[ai]:si[ai],[oi]:si[oi]})}function Ls(e){return e.map(([e,t])=>Ns(t)?[e,t.catch(t=>{M.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Rs(e){if(typeof e==`string`||e===void 0)return e;M.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function zs(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;M.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Bs(e){return Vs(e,new WeakSet)}function Vs(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Vs(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Vs(e,t))}return!1}N();var Hs=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=Na(r??f),this.hrTimeObserved=Na(i??f),d){let e=gr.getSpanContext(d);e&&an(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return M.warn(`Invalid attribute key: ${e}`),this;if(!Bs(t))return M.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&M.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return M.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute($r,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ti,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ti,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute($r,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ei,n.stack),t=!0)}t||M.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&M.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};N();var Us=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=e.context||Hn.active();if(!this.enabled(e))return;let n=new Hs(this._sharedState,this.instrumentationScope,{context:t,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,t),n._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==br.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||Hn.active();if(t.traceBased){let e=gr.getSpanContext(r);if(e&&an(e)&&(e.traceFlags&zt.SAMPLED)!==zt.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},Ws=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}},Gs=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>za(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function Ks(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var qs=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(`otel.sdk.log.created`,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}};N();const Js={disabled:!1,minimumSeverity:br.UNSPECIFIED,traceBased:!1},Ys=()=>({...Js});var Xs=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,n,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Gs(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Ws,this._loggerConfigurator=i??Ys;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,`0.218.0`):ct();this.loggerMetrics=new qs(o)}getLoggerConfig(e){let t=Ks(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};N();var Zs=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??to(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Ys,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Xs(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Va(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return M.warn(`A shutdown LoggerProvider cannot provide a Logger`),Sr;e||M.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Us({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(M.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(M.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};N();async function Qs(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var $s=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(e,t,n){this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await Qs(t),await Hn.with(_a(Hn.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){wa(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===La.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},ec=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new Va(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(M.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new $s(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){wa(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new $s(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,wa(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},tc=class extends ec{onShutdown(){}};const nc=Symbol.for(`nodejs.util.inspect.custom`);function rc(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function ic(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}N();var ac=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Tn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=ci.now(),this._performanceOffset=t-(this._performanceStartTime+ci.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return M.warn(`Invalid attribute key: ${e}`),this;if(!Hr(t))return M.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return M.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&M.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),_i(t)&&(_i(n)||(n=t),t=void 0);let i=Br(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&M.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=Br(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Tn.UNSET||this.status.code===Tn.OK)return this;let t={code:e.code};return e.code===Tn.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&M.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){M.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=pi(this.startTime,this.endTime),this._duration[0]<0&&(M.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&M.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&M.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=ci.now())return fi(e+this._performanceOffset);if(typeof e==`number`)return di(e);if(e instanceof Date)return di(e.getTime());if(gi(e))return e;if(this._startTimeProvided)return di(Date.now());let t=ci.now()-this._performanceStartTime;return vi(this.startTime,di(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[$r]=e:e&&(e.code?n[ti]=e.code.toString():e.name&&(n[ti]=e.name),e.message&&(n[$r]=e.message),e.stack&&(n[ei]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(`exception`,n,t):M.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);M.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(M.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[nc](e,t,n){return ic(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:rc(this.resource)}},e,t,n)}},oc;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(oc||={});const sc=`otel.span.sampling_result`;var cc=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(`otel.sdk.span.started`,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(`otel.sdk.span.live`,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=uc(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":lc(e),[sc]:n}),t===oc.NOT_RECORD)return()=>{};let r={[sc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function lc(e){return e?e.isRemote?`remote`:`local`:`none`}function uc(e){switch(e){case oc.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case oc.RECORD:return`RECORD_ONLY`;case oc.NOT_RECORD:return`DROP`}}N();var dc=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,`2.11.0`);this._tracerMetrics=new cc(n)}startSpan(e,t={},n=Hn.active()){t.root&&(n=gr.deleteSpan(n));let r=gr.getSpan(n);if(Mr(n))return M.debug(`Instrumentation suppressed, returning Noop Span`),gr.wrapSpanContext(Ut);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!gr.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??Cn.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:Br(e.attributes)})),d=Br(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===xn.RECORD_AND_SAMPLED?zt.SAMPLED:zt.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===xn.NOT_RECORD)return M.debug(`Recording is off, propagating context in a non-recording span`),gr.wrapSpanContext(h);let g=Br(Object.assign(d,f.attributes));return new ac({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:g,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Hn.active(),c=this.startSpan(e,i,s),l=gr.setSpan(s,c);return Hn.with(l,o,void 0,c)}[nc](e,t,n){return ic(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:rc(this._resource)},spanLimits:this._spanLimits},e,t,n)}},fc=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Yr(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},pc=class{shouldSample(){return{decision:oc.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},mc=class{shouldSample(){return{decision:oc.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};N();var hc=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(Yr(Error(`ParentBasedSampler must have a root sampler configured`)),new mc),this._remoteParentSampled=e.remoteParentSampled??new mc,this._remoteParentNotSampled=e.remoteParentNotSampled??new pc,this._localParentSampled=e.localParentSampled??new mc,this._localParentNotSampled=e.localParentNotSampled??new pc}shouldSample(e,t,n,r,i,a){let o=gr.getSpanContext(e);return!o||!an(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&zt.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&zt.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};const gc=new Map;var _c=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=gc.get(e)??0;if(gc.set(e,r+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[Qr]:`queue_full`},this.processedSpans=t.createCounter(`otel.sdk.processor.span.processed`,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(`otel.sdk.processor.span.queue.capacity`,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(`otel.sdk.processor.span.queue.size`,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[Qr]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};N();var vc=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new ta(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(M.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):ct();this._metrics=new _c(`batching_span_processor`,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&zt.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&M.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(M.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);Hn.with(jr(Hn.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===yi.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{Yr(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Yr(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},yc=class extends vc{onShutdown(){}},bc=class{generateTraceId=Sc(16);generateSpanId=Sc(8)};const xc=Buffer.allocUnsafe(16);function Sc(e){return function(){for(let t=0;t<e/4;t++)xc.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(xc[t]>0);t++)t===e-1&&(xc[e-1]=1);return xc.toString(`hex`,0,e)}}N();var Cc;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Cc||={});var wc=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??Is();let t=e.spanProcessors??[];this._activeSpanProcessor=new fc(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new hc({root:new mc}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new bc,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return ct()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new dc({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(e){let t=e?.timeoutMillis??this._forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${t} ms`)),r=Cc.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==Cc.timeout&&(r=Cc.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Cc.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==Cc.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[nc](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return ic(`TracerProvider`,{resource:{attributes:rc(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};N();var Tc=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:nn(t)&&this._accumulate(t)<this._upperBound?oc.RECORD_AND_SAMPLED:oc.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};N();var Ec;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Ec||={});function Dc(){return{sampler:Oc(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:Xr(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:Xr(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:Xr(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:Xr(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:Xr(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:Xr(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:Xr(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:Xr(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function Oc(){let e=Zr(`OTEL_TRACES_SAMPLER`)??Ec.ParentBasedAlwaysOn;switch(e){case Ec.AlwaysOn:return new mc;case Ec.AlwaysOff:return new pc;case Ec.ParentBasedAlwaysOn:return new hc({root:new mc});case Ec.ParentBasedAlwaysOff:return new hc({root:new pc});case Ec.TraceIdRatio:return new Tc(kc());case Ec.ParentBasedTraceIdRatio:return new hc({root:new Tc(kc())});default:return M.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Ec.ParentBasedAlwaysOn}".`),new hc({root:new mc})}}function kc(){let e=Xr(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(M.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):e<0||e>1?(M.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to 1.`),1):e}function Ac(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??Xr(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??Xr(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??Xr(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??Xr(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}var jc=class extends wc{constructor(e={}){let t=Gi({},Dc(),Ac(e));delete t.generalLimits,super(t)}},Mc=class extends yc{constructor(e,t){t||={};for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(t[e]===void 0){let r=Xr(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}},Nc;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e[e.LOWMEMORY=2]=`LOWMEMORY`})(Nc||={}),N();const Pc=()=>Ka.CUMULATIVE,Fc=e=>{switch(e){case qa.COUNTER:case qa.OBSERVABLE_COUNTER:case qa.GAUGE:case qa.HISTOGRAM:case qa.OBSERVABLE_GAUGE:return Ka.DELTA;case qa.UP_DOWN_COUNTER:case qa.OBSERVABLE_UP_DOWN_COUNTER:return Ka.CUMULATIVE}},Ic=e=>{switch(e){case qa.COUNTER:case qa.HISTOGRAM:return Ka.DELTA;case qa.GAUGE:case qa.UP_DOWN_COUNTER:case qa.OBSERVABLE_UP_DOWN_COUNTER:case qa.OBSERVABLE_COUNTER:case qa.OBSERVABLE_GAUGE:return Ka.CUMULATIVE}};function Lc(){let e=(Ea(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`)??`cumulative`).toLowerCase();return e===`cumulative`?Pc:e===`delta`?Fc:e===`lowmemory`?Ic:(M.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Pc)}function Rc(e){return e==null?Lc():e===Nc.DELTA?Fc:e===Nc.LOWMEMORY?Ic:Pc}const zc=Object.freeze({type:Ya.DEFAULT});function Bc(e){return e?.aggregationPreference??(()=>zc)}var Vc=class extends ca{_aggregationTemporalitySelector;_aggregationSelector;constructor(e,t){super(e),this._aggregationSelector=Bc(t),this._aggregationTemporalitySelector=Rc(t?.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}},Hc=class extends Vc{constructor(e){super(us(Os(e??{},`METRICS`,`v1/metrics`,{"Content-Type":`application/json`}),No),e)}},Uc;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Uc||={});var P;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(P||={});var Wc;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Wc||={});function Gc(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Kc(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}var qc=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Jc(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new qc(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Yc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xc(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Zc(e,t){return e.toLowerCase()===t.toLowerCase()}var Qc;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(Qc||={});var $c=class{kind=Qc.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};function el(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var tl=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=el(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Xc(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},nl=class{kind=Qc.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new tl(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new tl(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new tl(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wc.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===P.GAUGE||e.type===P.UP_DOWN_COUNTER||e.type===P.OBSERVABLE_GAUGE||e.type===P.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}},rl=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new il,t=0,n=0,r=0){this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},il=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}};const al=-1022,ol=2**-1022,sl=new DataView(new ArrayBuffer(8));function cl(e){return sl.setFloat64(0,e),{hi:sl.getUint32(0),lo:sl.getUint32(4)}}function ll(e){let{hi:t}=cl(e);return((t&2146435072)>>20)-1023}function ul(e){let{hi:t,lo:n}=cl(e);return!(t&1048575)&&n===0}function dl(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function fl(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var pl=class extends Error{},ml=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<ol?this._minNormalLowerBoundaryIndex():ll(e)+(ul(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new pl(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new pl(`overflow: ${e} is > maximum lower boundary: ${n}`);return dl(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=al>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}},hl=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=dl(Math.LOG2E,e),this._inverseFactor=dl(Math.LN2,-e)}mapToIndex(e){if(e<=ol)return this._minNormalLowerBoundaryIndex()-1;if(ul(e))return(ll(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new pl(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return ol;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new pl(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return al<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}};const gl=Array.from({length:31},(e,t)=>t>10?new hl(t-10):new ml(t-10));function _l(e){if(e>20||e<-10)throw new pl(`expected scale >= -10 && <= 20, got: ${e}`);return gl[e+10]}N();var vl=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},yl=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=160,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new rl,l=new rl,u=_l(20)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<2&&(M.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
2
2
|
changing to the minimum size of: 2`),this._maxSize=2)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(Number.isFinite(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=fl(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=_l(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=vl.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=vl.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new vl(0,-1);let r=t-n;return new vl(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},bl=class{kind=Qc.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(e,t){this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new yl(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wc.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===P.GAUGE||e.type===P.UP_DOWN_COUNTER||e.type===P.OBSERVABLE_GAUGE||e.type===P.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}},xl=class{startTime;_current;sampleTime;constructor(e,t=0,n=[0,0]){this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=di(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Sl=class{kind=Qc.LAST_VALUE;createAccumulation(e){return new xl(e)}merge(e,t){let n=mi(t.sampleTime)>=mi(e.sampleTime)?t:e;return new xl(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=mi(t.sampleTime)>=mi(e.sampleTime)?t:e;return new xl(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wc.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}},Cl=class{startTime;monotonic;_current;reset;constructor(e,t,n=0,r=!1){this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},wl=class{kind=Qc.SUM;monotonic;constructor(e){this.monotonic=e}createAccumulation(e){return new Cl(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new Cl(t.startTime,this.monotonic,r,t.reset):new Cl(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new Cl(t.startTime,this.monotonic,r,!0):new Cl(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wc.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};N();var Tl=class e{static DEFAULT_INSTANCE=new $c;createAggregator(t){return e.DEFAULT_INSTANCE}},El=class e{static MONOTONIC_INSTANCE=new wl(!0);static NON_MONOTONIC_INSTANCE=new wl(!1);createAggregator(t){switch(t.type){case P.COUNTER:case P.OBSERVABLE_COUNTER:case P.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}},Dl=class e{static DEFAULT_INSTANCE=new Sl;createAggregator(t){return e.DEFAULT_INSTANCE}},Ol=class e{static DEFAULT_INSTANCE=new nl([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}},kl=class{_boundaries;_recordMinMax;constructor(e,t=!0){if(e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new nl(this._boundaries,this._recordMinMax)}},Al=class{_maxSize;_recordMinMax;constructor(e=160,t=!0){this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new bl(this._maxSize,this._recordMinMax)}},jl=class{_resolve(e){switch(e.type){case P.COUNTER:case P.UP_DOWN_COUNTER:case P.OBSERVABLE_COUNTER:case P.OBSERVABLE_UP_DOWN_COUNTER:return Nl;case P.GAUGE:case P.OBSERVABLE_GAUGE:return Pl;case P.HISTOGRAM:return e.advice.explicitBucketBoundaries?new kl(e.advice.explicitBucketBoundaries):Fl}return M.warn(`Unable to recognize instrument type: ${e.type}`),Ml}createAggregator(e){return this._resolve(e).createAggregator(e)}};const Ml=new Tl,Nl=new El,Pl=new Dl,Fl=new Ol;new Al;const Il=new jl;var Ll;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(Ll||={});function Rl(e){switch(e.type){case Ll.DEFAULT:return Il;case Ll.DROP:return Ml;case Ll.SUM:return Nl;case Ll.LAST_VALUE:return Pl;case Ll.EXPONENTIAL_HISTOGRAM:{let t=e;return new Al(t.options?.maxSize,t.options?.recordMinMax)}case Ll.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Fl:new kl(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}const zl=e=>({type:Ll.DEFAULT}),Bl=e=>Uc.CUMULATIVE,Vl=new Map;var Hl=class{collectionDuration;standardAttrs;constructor(e,t){let n=Vl.get(e)??0;Vl.set(e,n+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${n}`},this.collectionDuration=t.createHistogram(`otel.sdk.metric_reader.collection.duration`,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,"error.type":t}:this.standardAttrs;this.collectionDuration.record(e,n)}};N();var Ul=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(e){this._aggregationSelector=e?.aggregationSelector??zl,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??Bl,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new Hl(this._otelComponentType,ct())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,`2.11.0`);this._selfObsMetrics=new Hl(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=fi(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=fi(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=hi(pi(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){M.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await Jc(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){M.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await Jc(this.onForceFlush(),e.timeoutMillis)}};function Wl(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}N();var Gl=class extends Ul{_interval;_exporter;_exportInterval;_exportTimeout;_maxExportBatchSize;_ongoingExportPromise=null;constructor(e){let{exporter:t,exportIntervalMillis:n=6e4,metricProducers:r,cardinalityLimits:i,maxExportBatchSize:a}=e,{exportTimeoutMillis:o=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:`periodic_metric_reader`,metricProducers:r,cardinalitySelector:e=>{let t={default:2e3,...i};switch(e){case P.COUNTER:return t.counter??t.default;case P.GAUGE:return t.gauge??t.default;case P.HISTOGRAM:return t.histogram??t.default;case P.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case P.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case P.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case P.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),n<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(o<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(n<o){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);M.info(`Timeout of ${o} exceeds the interval of ${n}. Clamping timeout to interval duration.`),o=n}this._exportInterval=n,this._exportTimeout=o,this._exporter=t,this._maxExportBatchSize=a}async _runOnce(){try{await this._doRun()}catch(e){Yr(e)}}async _doRun(){if(this._ongoingExportPromise){M.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&M.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){M.debug(`Error while resolving async portion of resource: `,e),Yr(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?Wl(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await Jc(ra._export(this._exporter,e),this._exportTimeout);t.code!==yi.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof qc){M.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}M.error(`PeriodicExportingMetricReader: metrics export threw error`,e),r=e instanceof Error?e:Error(String(e))}if(r)throw r};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){M.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}},Kl=class{_registeredViews=[];addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};N();function ql(e,t,n){return Zl(e)||M.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:n?.description??``,unit:n?.unit??``,valueType:n?.valueType??Ot.DOUBLE,advice:n?.advice??{}}}function Jl(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Yl(e,t){return Zc(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}const Xl=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function Zl(e){return Xl.test(e)}N();var Ql=class{_writableMetricStorage;_descriptor;constructor(e,t){this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){M.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===Ot.INT&&!Number.isInteger(e)&&(M.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},$l=class extends Ql{add(e,t,n){this._record(e,t,n)}},eu=class extends Ql{add(e,t,n){if(e<0){M.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},tu=class extends Ql{record(e,t,n){this._record(e,t,n)}},nu=class extends Ql{record(e,t,n){if(e<0){M.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},ru=class{_metricStorages;_descriptor;_observableRegistry;constructor(e,t,n){this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},iu=class extends ru{},au=class extends ru{},ou=class extends ru{};function su(e){return e instanceof ru}var cu=class{_meterSharedState;constructor(e){this._meterSharedState=e}createGauge(e,t){let n=ql(e,P.GAUGE,t);return new tu(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=ql(e,P.HISTOGRAM,t);return new nu(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=ql(e,P.COUNTER,t);return new eu(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=ql(e,P.UP_DOWN_COUNTER,t);return new $l(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=ql(e,P.OBSERVABLE_GAUGE,t);return new au(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=ql(e,P.OBSERVABLE_COUNTER,t);return new iu(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=ql(e,P.OBSERVABLE_UP_DOWN_COUNTER,t);return new ou(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}},lu=class{_instrumentDescriptor;constructor(e){this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=ql(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}},uu=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(e){this._hash=e}get(e,t){return t??=this._hash(e),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??=this._hash(e),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??=this._hash(e),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},du=class extends uu{constructor(){super(Gc)}},fu=class{_activeCollectionStorage=new du;_cumulativeMemoStorage=new du;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(e,t){this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=Gc(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=di(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}r=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,r)}r?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new du,e}},pu=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(e,t){this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===Uc.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=mu(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new du,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}};function mu(e){return Array.from(e.entries())}var hu=class extends lu{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,n,r,i){super(e),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new fu(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new pu(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new du;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function gu(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function _u(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function vu(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function yu(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function bu(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
|
|
3
3
|
\t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
|
|
4
4
|
\t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function xu(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:bu(e,t):yu(e,t):vu(e,t):_u(e,t)}N();var Su=class e{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n??(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();Yl(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),M.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
|