@vercel/otel 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/edge/index.js +2 -2
- package/dist/edge/index.js.map +3 -3
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +3 -3
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -20,5 +20,5 @@ import{a as N,b as qe,c as _,d as YP,e as Bi,f as Re,g as R,h as E,i as m}from".
|
|
|
20
20
|
To resolve the conflict:`,(0,ii.getConflictResolutionRecipe)(s,e))),n=o):PR.diag.warn("A view or instrument with the name ",e.name,` has already been registered and is incompatible with another registered view.
|
|
21
21
|
`,`Details:
|
|
22
22
|
`,(0,ii.getIncompatibilityDetails)(s,e),`To resolve the conflict:
|
|
23
|
-
`,(0,ii.getConflictResolutionRecipe)(s,e))}return n}};ai.MetricStorageRegistry=Ou});var NR=_(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.MultiMetricStorage=void 0;var Pu=class{_backingStorages;constructor(e){this._backingStorages=e}record(e,t,n,o){this._backingStorages.forEach(s=>{s.record(e,t,n,o)})}};ci.MultiMetricStorage=Pu});var IR=_(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.BatchObservableResultImpl=Vr.ObservableResultImpl=void 0;var wr=(m(),R(E)),CR=bn(),uF=Zs(),Mu=class{_instrumentName;_valueType;_buffer=new CR.AttributeHashMap;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!="number"){wr.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===wr.ValueType.INT&&!Number.isInteger(e)&&(wr.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}};Vr.ObservableResultImpl=Mu;var Nu=class{_buffer=new Map;observe(e,t,n={}){if(!(0,uF.isObservableInstrument)(e))return;let o=this._buffer.get(e);if(o==null&&(o=new CR.AttributeHashMap,this._buffer.set(e,o)),typeof t!="number"){wr.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===wr.ValueType.INT&&!Number.isInteger(t)&&(wr.diag.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||o.set(n,t)}};Vr.BatchObservableResultImpl=Nu});var yR=_(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.ObservableRegistry=void 0;var _F=(m(),R(E)),LR=Zs(),bR=IR(),yn=we(),Cu=class{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(LR.isObservableInstrument));if(n.size===0){_F.diag.error("BatchObservableCallback is not associated with valid instruments",t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(LR.isObservableInstrument)),o=this._findBatchCallback(e,n);o<0||this._batchCallbacks.splice(o,1)}async observe(e,t){let n=this._observeCallbacks(e,t),o=this._observeBatchCallbacks(e,t);return(await(0,yn.PromiseAllSettled)([...n,...o])).filter(yn.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:o})=>{let s=new bR.ObservableResultImpl(o._descriptor.name,o._descriptor.valueType),i=Promise.resolve(n(s));t!=null&&(i=(0,yn.callWithTimeout)(i,t)),await i,o._metricStorages.forEach(a=>{a.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let s=new bR.BatchObservableResultImpl,i=Promise.resolve(n(s));t!=null&&(i=(0,yn.callWithTimeout)(i,t)),await i,o.forEach(a=>{let c=s._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&(0,yn.setEquals)(n.instruments,t))}};ui.ObservableRegistry=Cu});var vR=_(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.SyncMetricStorage=void 0;var lF=Tu(),EF=hu(),pF=gu(),Iu=class extends lF.MetricStorage{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(e,t,n,o,s){super(e),this._attributesProcessor=n,this._aggregationCardinalityLimit=s,this._deltaMetricStorage=new EF.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new pF.TemporalMetricProcessor(t,o)}record(e,t,n,o){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,o)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};_i.SyncMetricStorage=Iu});var li=_(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createDenyListAttributesProcessor=Ze.createAllowListAttributesProcessor=Ze.createMultiAttributesProcessor=Ze.createNoopAttributesProcessor=void 0;var Lu=class{process(e,t){return e}},bu=class{_processors;constructor(e){this._processors=e}process(e,t){let n=e;for(let o of this._processors)n=o.process(n,t);return n}},yu=class{_allowedAttributeNames;constructor(e){this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(o=>this._allowedAttributeNames.includes(o)).forEach(o=>n[o]=e[o]),n}},vu=class{_deniedAttributeNames;constructor(e){this._deniedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(o=>!this._deniedAttributeNames.includes(o)).forEach(o=>n[o]=e[o]),n}};function dF(){return AF}Ze.createNoopAttributesProcessor=dF;function TF(r){return new bu(r)}Ze.createMultiAttributesProcessor=TF;function SF(r){return new yu(r)}Ze.createAllowListAttributesProcessor=SF;function fF(r){return new vu(r)}Ze.createDenyListAttributesProcessor=fF;var AF=new Lu});var xR=_(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.MeterSharedState=void 0;var hF=Ln(),mF=fR(),gF=we(),RF=AR(),OF=MR(),PF=NR(),MF=yR(),NF=vR(),CF=li(),xu=class{_meterProviderSharedState;_instrumentationScope;metricStorageRegistry=new OF.MetricStorageRegistry;observableRegistry=new MF.ObservableRegistry;meter;constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.meter=new mF.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,NF.SyncMetricStorage);return t.length===1?t[0]:new PF.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,RF.AsyncMetricStorage)}async collect(e,t,n){let o=await this.observableRegistry.observe(t,n?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(s.length===0)return null;let i=s.map(a=>a.collect(e,t)).filter(gF.isNotNullish);return i.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:i},errors:o}}_registerMetricStorage(e,t){let o=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(s=>{let i=(0,hF.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(a!=null)return a;let c=s.aggregation.createAggregator(i),u=new t(i,c,s.attributesProcessor,this._meterProviderSharedState.metricCollectors,s.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let i=this._meterProviderSharedState.selectAggregations(e.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(u!=null)return u;let l=c.createAggregator(e),p=a.selectCardinalityLimit(e.type),T=new t(e,l,(0,CF.createNoopAttributesProcessor)(),[a],p);return this.metricStorageRegistry.registerForCollector(a,T),T});o=o.concat(i)}return o}};Ei.MeterSharedState=xu});var DR=_(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.MeterProviderSharedState=void 0;var IF=we(),LF=dR(),bF=xR(),yF=Cn(),Du=class{resource;viewRegistry=new LF.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;constructor(e){this.resource=e}getMeterSharedState(e){let t=(0,IF.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new bF.MeterSharedState(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,(0,yF.toAggregation)(n.selectAggregation(e))]);return t}};pi.MeterProviderSharedState=Du});var UR=_(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.MetricCollector=void 0;var vF=y(),Uu=class{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,vF.millisToHrTime)(Date.now()),n=[],o=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async i=>{let a=await i.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}};di.MetricCollector=Uu});var Ti=_(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ExactPredicate=Br.PatternPredicate=void 0;var xF=/[\^$\\.+?()[\]{}|]/g,wu=class r{_matchAll;_regexp;constructor(e){e==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(r.escapePattern(e)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(xF,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};Br.PatternPredicate=wu;var Vu=class{_matchAll;_pattern;constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};Br.ExactPredicate=Vu});var VR=_(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.InstrumentSelector=void 0;var wR=Ti(),Bu=class{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new wR.PatternPredicate(e?.name??"*"),this._type=e?.type,this._unitFilter=new wR.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};Si.InstrumentSelector=Bu});var BR=_(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.MeterSelector=void 0;var Gu=Ti(),Hu=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new Gu.ExactPredicate(e?.name),this._versionFilter=new Gu.ExactPredicate(e?.version),this._schemaUrlFilter=new Gu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};fi.MeterSelector=Hu});var FR=_(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.View=void 0;var DF=Ti(),GR=li(),UF=VR(),wF=BR(),HR=Cn();function VF(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}function BF(r){if(VF(r))throw new Error("Cannot create view with no selector arguments supplied");if(r.name!=null&&(r?.instrumentName==null||DF.PatternPredicate.hasWildcard(r.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}var Fu=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){BF(e),e.attributesProcessors!=null?this.attributesProcessor=(0,GR.createMultiAttributesProcessor)(e.attributesProcessors):this.attributesProcessor=(0,GR.createNoopAttributesProcessor)(),this.name=e.name,this.description=e.description,this.aggregation=(0,HR.toAggregation)(e.aggregation??{type:HR.AggregationType.DEFAULT}),this.instrumentSelector=new UF.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new wF.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};Ai.View=Fu});var qR=_(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.MeterProvider=void 0;var hi=(m(),R(E)),GF=sn(),HF=DR(),FF=UR(),qF=FR(),qu=class{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new HF.MeterProviderSharedState(e?.resource??(0,GF.defaultResource)()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new qF.View(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new FF.MetricCollector(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(e,t="",n={}){return this._shutdown?(hi.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,hi.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}async shutdown(e){if(this._shutdown){hi.diag.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){hi.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};mi.MeterProvider=qu});var YR=_(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.TimeoutError=w.createDenyListAttributesProcessor=w.createAllowListAttributesProcessor=w.AggregationType=w.MeterProvider=w.ConsoleMetricExporter=w.InMemoryMetricExporter=w.PeriodicExportingMetricReader=w.MetricReader=w.InstrumentType=w.DataPointType=w.AggregationTemporality=void 0;var jF=Ls();Object.defineProperty(w,"AggregationTemporality",{enumerable:!0,get:function(){return jF.AggregationTemporality}});var jR=At();Object.defineProperty(w,"DataPointType",{enumerable:!0,get:function(){return jR.DataPointType}});Object.defineProperty(w,"InstrumentType",{enumerable:!0,get:function(){return jR.InstrumentType}});var kF=eu();Object.defineProperty(w,"MetricReader",{enumerable:!0,get:function(){return kF.MetricReader}});var YF=uR();Object.defineProperty(w,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return YF.PeriodicExportingMetricReader}});var $F=lR();Object.defineProperty(w,"InMemoryMetricExporter",{enumerable:!0,get:function(){return $F.InMemoryMetricExporter}});var KF=pR();Object.defineProperty(w,"ConsoleMetricExporter",{enumerable:!0,get:function(){return KF.ConsoleMetricExporter}});var WF=qR();Object.defineProperty(w,"MeterProvider",{enumerable:!0,get:function(){return WF.MeterProvider}});var zF=Cn();Object.defineProperty(w,"AggregationType",{enumerable:!0,get:function(){return zF.AggregationType}});var kR=li();Object.defineProperty(w,"createAllowListAttributesProcessor",{enumerable:!0,get:function(){return kR.createAllowListAttributesProcessor}});Object.defineProperty(w,"createDenyListAttributesProcessor",{enumerable:!0,get:function(){return kR.createDenyListAttributesProcessor}});var XF=we();Object.defineProperty(w,"TimeoutError",{enumerable:!0,get:function(){return XF.TimeoutError}})});var ku=_(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.AbstractAsyncHooksContextManager=void 0;var QF=N("events"),JF=["addListener","on","once","prependListener","prependOnceListener"],ju=class{bind(e,t){return t instanceof QF.EventEmitter?this._bindEventEmitter(e,t):typeof t=="function"?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,o=function(...s){return n.with(e,()=>t.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),o}_bindEventEmitter(e,t){return this._getPatchMap(t)!==void 0||(this._createPatchMap(t),JF.forEach(o=>{t[o]!==void 0&&(t[o]=this._patchAddListener(t,t[o],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}_patchRemoveListener(e,t){let n=this;return function(o,s){let i=n._getPatchMap(e)?.[o];if(i===void 0)return t.call(this,o,s);let a=i.get(s);return t.call(this,o,a||s)}}_patchRemoveAllListeners(e,t){let n=this;return function(o){let s=n._getPatchMap(e);return s!==void 0&&(arguments.length===0?n._createPatchMap(e):s[o]!==void 0&&delete s[o]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let o=this;return function(s,i){if(o._wrapped)return t.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let u=o.bind(n,i);c.set(i,u),o._wrapped=!0;try{return t.call(this,s,u)}finally{o._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};gi.AbstractAsyncHooksContextManager=ju});var $R=_(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.AsyncHooksContextManager=void 0;var ZF=(m(),R(E)),eq=N("async_hooks"),tq=ku(),Yu=class extends tq.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=eq.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]??ZF.ROOT_CONTEXT}with(e,t,n,...o){this._enterContext(e);try{return t.call(n,...o)}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()}};Ri.AsyncHooksContextManager=Yu});var KR=_(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.AsyncLocalStorageContextManager=void 0;var rq=(m(),R(E)),nq=N("async_hooks"),oq=ku(),$u=class extends oq.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new nq.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??rq.ROOT_CONTEXT}with(e,t,n,...o){let s=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Oi.AsyncLocalStorageContextManager=$u});var WR=_(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.AsyncLocalStorageContextManager=Gr.AsyncHooksContextManager=void 0;var sq=$R();Object.defineProperty(Gr,"AsyncHooksContextManager",{enumerable:!0,get:function(){return sq.AsyncHooksContextManager}});var iq=KR();Object.defineProperty(Gr,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return iq.AsyncLocalStorageContextManager}})});var AO=_(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.toAnyValue=ye.toKeyValue=ye.toAttributes=ye.createInstrumentationScope=ye.createResource=void 0;function Eq(r){let e={attributes:fO(r.attributes),droppedAttributesCount:0},t=r.schemaUrl;return t&&t!==""&&(e.schemaUrl=t),e}ye.createResource=Eq;function pq(r){return{name:r.name,version:r.version}}ye.createInstrumentationScope=pq;function fO(r){return Object.keys(r).map(e=>Xu(e,r[e]))}ye.toAttributes=fO;function Xu(r,e){return{key:r,value:Qu(e)}}ye.toKeyValue=Xu;function Qu(r){let e=typeof r;return e==="string"?{stringValue:r}:e==="number"?Number.isInteger(r)?{intValue:r}:{doubleValue:r}:e==="boolean"?{boolValue:r}:r instanceof Uint8Array?{bytesValue:r}:Array.isArray(r)?{arrayValue:{values:r.map(Qu)}}:e==="object"&&r!=null?{kvlistValue:{values:Object.entries(r).map(([t,n])=>Xu(t,n))}}:{}}ye.toAnyValue=Qu});var mO=_(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.hexToBinary=void 0;function hO(r){return r>=48&&r<=57?r-48:r>=97&&r<=102?r-87:r-55}function dq(r){let e=new Uint8Array(r.length/2),t=0;for(let n=0;n<r.length;n+=2){let o=hO(r.charCodeAt(n)),s=hO(r.charCodeAt(n+1));e[t++]=o<<4|s}return e}Ni.hexToBinary=dq});var MO=_(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.getOtlpEncoder=ve.encodeAsString=ve.encodeAsLongBits=ve.toLongBits=ve.hrTimeToNanos=void 0;var Tq=y(),Ju=mO();function Zu(r){let e=BigInt(1e9);return BigInt(r[0])*e+BigInt(r[1])}ve.hrTimeToNanos=Zu;function RO(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}ve.toLongBits=RO;function e_(r){let e=Zu(r);return RO(e)}ve.encodeAsLongBits=e_;function OO(r){return Zu(r).toString()}ve.encodeAsString=OO;var Sq=typeof BigInt<"u"?OO:Tq.hrTimeToNanoseconds;function gO(r){return r}function PO(r){if(r!==void 0)return(0,Ju.hexToBinary)(r)}var fq={encodeHrTime:e_,encodeSpanContext:Ju.hexToBinary,encodeOptionalSpanContext:PO};function Aq(r){if(r===void 0)return fq;let e=r.useLongBits??!0,t=r.useHex??!1;return{encodeHrTime:e?e_:Sq,encodeSpanContext:t?gO:Ju.hexToBinary,encodeOptionalSpanContext:t?gO:PO}}ve.getOtlpEncoder=Aq});var t_=_(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.createExportTraceServiceRequest=et.toOtlpSpanEvent=et.toOtlpLink=et.sdkSpanToOtlpSpan=void 0;var vn=AO(),hq=MO();function NO(r,e){let t=r.spanContext(),n=r.status,o=r.parentSpanContext?.spanId?e.encodeSpanContext(r.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(t.traceId),spanId:e.encodeSpanContext(t.spanId),parentSpanId:o,traceState:t.traceState?.serialize(),name:r.name,kind:r.kind==null?0:r.kind+1,startTimeUnixNano:e.encodeHrTime(r.startTime),endTimeUnixNano:e.encodeHrTime(r.endTime),attributes:(0,vn.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>IO(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:n.code,message:n.message},links:r.links.map(s=>CO(s,e)),droppedLinksCount:r.droppedLinksCount}}et.sdkSpanToOtlpSpan=NO;function CO(r,e){return{attributes:r.attributes?(0,vn.toAttributes)(r.attributes):[],spanId:e.encodeSpanContext(r.context.spanId),traceId:e.encodeSpanContext(r.context.traceId),traceState:r.context.traceState?.serialize(),droppedAttributesCount:r.droppedAttributesCount||0}}et.toOtlpLink=CO;function IO(r,e){return{attributes:r.attributes?(0,vn.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}et.toOtlpSpanEvent=IO;function mq(r,e){let t=(0,hq.getOtlpEncoder)(e);return{resourceSpans:Rq(r,t)}}et.createExportTraceServiceRequest=mq;function gq(r){let e=new Map;for(let t of r){let n=e.get(t.resource);n||(n=new Map,e.set(t.resource,n));let o=`${t.instrumentationScope.name}@${t.instrumentationScope.version||""}:${t.instrumentationScope.schemaUrl||""}`,s=n.get(o);s||(s=[],n.set(o,s)),s.push(t)}return e}function Rq(r,e){let t=gq(r),n=[],o=t.entries(),s=o.next();for(;!s.done;){let[i,a]=s.value,c=[],u=a.values(),l=u.next();for(;!l.done;){let A=l.value;if(A.length>0){let M=A.map(g=>NO(g,e));c.push({scope:(0,vn.createInstrumentationScope)(A[0].instrumentationScope),spans:M,schemaUrl:A[0].instrumentationScope.schemaUrl})}l=u.next()}let p=(0,vn.createResource)(i),T={resource:p,scopeSpans:c,schemaUrl:p.schemaUrl};n.push(T),s=o.next()}return n}});var r_=_(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.JsonTraceSerializer=void 0;var Oq=t_();Ci.JsonTraceSerializer={serializeRequest:r=>{let e=(0,Oq.createExportTraceServiceRequest)(r,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:r=>{if(r.length===0)return{};let e=new TextDecoder;return JSON.parse(e.decode(r))}}});var yO=_((P3,bO)=>{"use strict";bO.exports=Nq;function Nq(r,e){for(var t=new Array(arguments.length-1),n=0,o=2,s=!0;o<arguments.length;)t[n++]=arguments[o++];return new Promise(function(a,c){t[n]=function(l){if(s)if(s=!1,l)c(l);else{for(var p=new Array(arguments.length-1),T=0;T<p.length;)p[T++]=arguments[T];a.apply(null,p)}};try{r.apply(e||null,t)}catch(u){s&&(s=!1,c(u))}})}});var UO=_(DO=>{"use strict";var Li=DO;Li.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&e.charAt(t)==="=";)++n;return Math.ceil(e.length*3)/4-n};var jr=new Array(64),xO=new Array(123);for(Ve=0;Ve<64;)xO[jr[Ve]=Ve<26?Ve+65:Ve<52?Ve+71:Ve<62?Ve-4:Ve-59|43]=Ve++;var Ve;Li.encode=function(e,t,n){for(var o=null,s=[],i=0,a=0,c;t<n;){var u=e[t++];switch(a){case 0:s[i++]=jr[u>>2],c=(u&3)<<4,a=1;break;case 1:s[i++]=jr[c|u>>4],c=(u&15)<<2,a=2;break;case 2:s[i++]=jr[c|u>>6],s[i++]=jr[u&63],a=0;break}i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=jr[c],s[i++]=61,a===1&&(s[i++]=61)),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var vO="invalid encoding";Li.decode=function(e,t,n){for(var o=n,s=0,i,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&s>1)break;if((c=xO[c])===void 0)throw Error(vO);switch(s){case 0:i=c,s=1;break;case 1:t[n++]=i<<2|(c&48)>>4,i=c,s=2;break;case 2:t[n++]=(i&15)<<4|(c&60)>>2,i=c,s=3;break;case 3:t[n++]=(i&3)<<6|c,s=0;break}}if(s===1)throw Error(vO);return n-o};Li.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var VO=_((N3,wO)=>{"use strict";wO.exports=bi;function bi(){this._listeners={}}bi.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};bi.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],o=0;o<n.length;)n[o].fn===t?n.splice(o,1):++o;return this};bi.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<t.length;)t[o].fn.apply(t[o++].ctx,n)}return this}});var kO=_((C3,jO)=>{"use strict";jO.exports=BO(BO);function BO(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function o(c,u,l){e[0]=c,u[l]=t[0],u[l+1]=t[1],u[l+2]=t[2],u[l+3]=t[3]}function s(c,u,l){e[0]=c,u[l]=t[3],u[l+1]=t[2],u[l+2]=t[1],u[l+3]=t[0]}r.writeFloatLE=n?o:s,r.writeFloatBE=n?s:o;function i(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],e[0]}function a(c,u){return t[3]=c[u],t[2]=c[u+1],t[1]=c[u+2],t[0]=c[u+3],e[0]}r.readFloatLE=n?i:a,r.readFloatBE=n?a:i}():function(){function e(n,o,s,i){var a=o<0?1:0;if(a&&(o=-o),o===0)n(1/o>0?0:2147483648,s,i);else if(isNaN(o))n(2143289344,s,i);else if(o>34028234663852886e22)n((a<<31|2139095040)>>>0,s,i);else if(o<11754943508222875e-54)n((a<<31|Math.round(o/1401298464324817e-60))>>>0,s,i);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|u)>>>0,s,i)}}r.writeFloatLE=e.bind(null,GO),r.writeFloatBE=e.bind(null,HO);function t(n,o,s){var i=n(o,s),a=(i>>31)*2+1,c=i>>>23&255,u=i&8388607;return c===255?u?NaN:a*(1/0):c===0?a*1401298464324817e-60*u:a*Math.pow(2,c-150)*(u+8388608)}r.readFloatLE=t.bind(null,FO),r.readFloatBE=t.bind(null,qO)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function o(c,u,l){e[0]=c,u[l]=t[0],u[l+1]=t[1],u[l+2]=t[2],u[l+3]=t[3],u[l+4]=t[4],u[l+5]=t[5],u[l+6]=t[6],u[l+7]=t[7]}function s(c,u,l){e[0]=c,u[l]=t[7],u[l+1]=t[6],u[l+2]=t[5],u[l+3]=t[4],u[l+4]=t[3],u[l+5]=t[2],u[l+6]=t[1],u[l+7]=t[0]}r.writeDoubleLE=n?o:s,r.writeDoubleBE=n?s:o;function i(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],t[4]=c[u+4],t[5]=c[u+5],t[6]=c[u+6],t[7]=c[u+7],e[0]}function a(c,u){return t[7]=c[u],t[6]=c[u+1],t[5]=c[u+2],t[4]=c[u+3],t[3]=c[u+4],t[2]=c[u+5],t[1]=c[u+6],t[0]=c[u+7],e[0]}r.readDoubleLE=n?i:a,r.readDoubleBE=n?a:i}():function(){function e(n,o,s,i,a,c){var u=i<0?1:0;if(u&&(i=-i),i===0)n(0,a,c+o),n(1/i>0?0:2147483648,a,c+s);else if(isNaN(i))n(0,a,c+o),n(2146959360,a,c+s);else if(i>17976931348623157e292)n(0,a,c+o),n((u<<31|2146435072)>>>0,a,c+s);else{var l;if(i<22250738585072014e-324)l=i/5e-324,n(l>>>0,a,c+o),n((u<<31|l/4294967296)>>>0,a,c+s);else{var p=Math.floor(Math.log(i)/Math.LN2);p===1024&&(p=1023),l=i*Math.pow(2,-p),n(l*4503599627370496>>>0,a,c+o),n((u<<31|p+1023<<20|l*1048576&1048575)>>>0,a,c+s)}}}r.writeDoubleLE=e.bind(null,GO,0,4),r.writeDoubleBE=e.bind(null,HO,4,0);function t(n,o,s,i,a){var c=n(i,a+o),u=n(i,a+s),l=(u>>31)*2+1,p=u>>>20&2047,T=4294967296*(u&1048575)+c;return p===2047?T?NaN:l*(1/0):p===0?l*5e-324*T:l*Math.pow(2,p-1075)*(T+4503599627370496)}r.readDoubleLE=t.bind(null,FO,0,4),r.readDoubleBE=t.bind(null,qO,4,0)}(),r}function GO(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function HO(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function FO(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function qO(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var YO=_((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var KO=_($O=>{"use strict";var o_=$O;o_.length=function(e){for(var t=0,n=0,o=0;o<e.length;++o)n=e.charCodeAt(o),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320?(++o,t+=4):t+=3;return t};o_.read=function(e,t,n){var o=n-t;if(o<1)return"";for(var s=null,i=[],a=0,c;t<n;)c=e[t++],c<128?i[a++]=c:c>191&&c<224?i[a++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,i[a++]=55296+(c>>10),i[a++]=56320+(c&1023)):i[a++]=(c&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,i)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,i.slice(0,a))),s.join("")):String.fromCharCode.apply(String,i.slice(0,a))};o_.write=function(e,t,n){for(var o=n,s,i,a=0;a<e.length;++a)s=e.charCodeAt(a),s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):(s&64512)===55296&&((i=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++a,t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128);return n-o}});var zO=_((L3,WO)=>{"use strict";WO.exports=Cq;function Cq(r,e,t){var n=t||8192,o=n>>>1,s=null,i=n;return function(c){if(c<1||c>o)return r(c);i+c>n&&(s=r(n),i=0);var u=e.call(s,i,i+=c);return i&7&&(i=(i|7)+1),u}}});var QO=_((b3,XO)=>{"use strict";XO.exports=oe;var xn=gt();function oe(r,e){this.lo=r>>>0,this.hi=e>>>0}var Wt=oe.zero=new oe(0,0);Wt.toNumber=function(){return 0};Wt.zzEncode=Wt.zzDecode=function(){return this};Wt.length=function(){return 1};var Iq=oe.zeroHash="\0\0\0\0\0\0\0\0";oe.fromNumber=function(e){if(e===0)return Wt;var t=e<0;t&&(e=-e);var n=e>>>0,o=(e-n)/4294967296>>>0;return t&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new oe(n,o)};oe.from=function(e){if(typeof e=="number")return oe.fromNumber(e);if(xn.isString(e))if(xn.Long)e=xn.Long.fromString(e);else return oe.fromNumber(parseInt(e,10));return e.low||e.high?new oe(e.low>>>0,e.high>>>0):Wt};oe.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296};oe.prototype.toLong=function(e){return xn.Long?new xn.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var mt=String.prototype.charCodeAt;oe.fromHash=function(e){return e===Iq?Wt:new oe((mt.call(e,0)|mt.call(e,1)<<8|mt.call(e,2)<<16|mt.call(e,3)<<24)>>>0,(mt.call(e,4)|mt.call(e,5)<<8|mt.call(e,6)<<16|mt.call(e,7)<<24)>>>0)};oe.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};oe.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};oe.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};oe.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}});var gt=_(s_=>{"use strict";var f=s_;f.asPromise=yO();f.base64=UO();f.EventEmitter=VO();f.float=kO();f.inquire=YO();f.utf8=KO();f.pool=zO();f.LongBits=QO();f.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);f.global=f.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||s_;f.emptyArray=Object.freeze?Object.freeze([]):[];f.emptyObject=Object.freeze?Object.freeze({}):{};f.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};f.isString=function(e){return typeof e=="string"||e instanceof String};f.isObject=function(e){return e&&typeof e=="object"};f.isset=f.isSet=function(e,t){var n=e[t];return n!=null&&e.hasOwnProperty(t)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};f.Buffer=function(){try{var r=f.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();f._Buffer_from=null;f._Buffer_allocUnsafe=null;f.newBuffer=function(e){return typeof e=="number"?f.Buffer?f._Buffer_allocUnsafe(e):new f.Array(e):f.Buffer?f._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};f.Array=typeof Uint8Array<"u"?Uint8Array:Array;f.Long=f.global.dcodeIO&&f.global.dcodeIO.Long||f.global.Long||f.inquire("long");f.key2Re=/^true|false|0|1$/;f.key32Re=/^-?(?:0|[1-9][0-9]*)$/;f.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;f.longToHash=function(e){return e?f.LongBits.from(e).toHash():f.LongBits.zeroHash};f.longFromHash=function(e,t){var n=f.LongBits.fromHash(e);return f.Long?f.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function JO(r,e,t){for(var n=Object.keys(e),o=0;o<n.length;++o)(r[n[o]]===void 0||!t)&&(r[n[o]]=e[n[o]]);return r}f.merge=JO;f.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function ZO(r){function e(t,n){if(!(this instanceof e))return new e(t,n);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&JO(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}f.newError=ZO;f.ProtocolError=ZO("ProtocolError");f.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var o=Object.keys(this),s=o.length-1;s>-1;--s)if(t[o[s]]===1&&this[o[s]]!==void 0&&this[o[s]]!==null)return o[s]}};f.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};f.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};f._configure=function(){var r=f.Buffer;if(!r){f._Buffer_from=f._Buffer_allocUnsafe=null;return}f._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},f._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var E_=_((v3,nP)=>{"use strict";nP.exports=b;var xe=gt(),i_,yi=xe.LongBits,eP=xe.base64,tP=xe.utf8;function Dn(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function c_(){}function Lq(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function b(){this.len=0,this.head=new Dn(c_,0,0),this.tail=this.head,this.states=null}var rP=function(){return xe.Buffer?function(){return(b.create=function(){return new i_})()}:function(){return new b}};b.create=rP();b.alloc=function(e){return new xe.Array(e)};xe.Array!==Array&&(b.alloc=xe.pool(b.alloc,xe.Array.prototype.subarray));b.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Dn(e,t,n),this.len+=t,this};function u_(r,e,t){e[t]=r&255}function bq(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function __(r,e){this.len=r,this.next=void 0,this.val=e}__.prototype=Object.create(Dn.prototype);__.prototype.fn=bq;b.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new __((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};b.prototype.int32=function(e){return e<0?this._push(l_,10,yi.fromNumber(e)):this.uint32(e)};b.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function l_(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}b.prototype.uint64=function(e){var t=yi.from(e);return this._push(l_,t.length(),t)};b.prototype.int64=b.prototype.uint64;b.prototype.sint64=function(e){var t=yi.from(e).zzEncode();return this._push(l_,t.length(),t)};b.prototype.bool=function(e){return this._push(u_,1,e?1:0)};function a_(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}b.prototype.fixed32=function(e){return this._push(a_,4,e>>>0)};b.prototype.sfixed32=b.prototype.fixed32;b.prototype.fixed64=function(e){var t=yi.from(e);return this._push(a_,4,t.lo)._push(a_,4,t.hi)};b.prototype.sfixed64=b.prototype.fixed64;b.prototype.float=function(e){return this._push(xe.float.writeFloatLE,4,e)};b.prototype.double=function(e){return this._push(xe.float.writeDoubleLE,8,e)};var yq=xe.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var o=0;o<e.length;++o)t[n+o]=e[o]};b.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(u_,1,0);if(xe.isString(e)){var n=b.alloc(t=eP.length(e));eP.decode(e,n,0),e=n}return this.uint32(t)._push(yq,t,e)};b.prototype.string=function(e){var t=tP.length(e);return t?this.uint32(t)._push(tP.write,t,e):this._push(u_,1,0)};b.prototype.fork=function(){return this.states=new Lq(this),this.head=this.tail=new Dn(c_,0,0),this.len=0,this};b.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Dn(c_,0,0),this.len=0),this};b.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this};b.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t};b._configure=function(r){i_=r,b.create=rP(),i_._configure()}});var iP=_((x3,sP)=>{"use strict";sP.exports=tt;var oP=E_();(tt.prototype=Object.create(oP.prototype)).constructor=tt;var Rt=gt();function tt(){oP.call(this)}tt._configure=function(){tt.alloc=Rt._Buffer_allocUnsafe,tt.writeBytesBuffer=Rt.Buffer&&Rt.Buffer.prototype instanceof Uint8Array&&Rt.Buffer.prototype.set.name==="set"?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var o=0;o<e.length;)t[n++]=e[o++]}};tt.prototype.bytes=function(e){Rt.isString(e)&&(e=Rt._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(tt.writeBytesBuffer,t,e),this};function vq(r,e,t){r.length<40?Rt.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}tt.prototype.string=function(e){var t=Rt.Buffer.byteLength(e);return this.uint32(t),t&&this._push(vq,t,e),this};tt._configure()});var T_=_((D3,lP)=>{"use strict";lP.exports=X;var Be=gt(),d_,uP=Be.LongBits,xq=Be.utf8;function Ge(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function X(r){this.buf=r,this.pos=0,this.len=r.length}var aP=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new X(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new X(e);throw Error("illegal buffer")},_P=function(){return Be.Buffer?function(t){return(X.create=function(o){return Be.Buffer.isBuffer(o)?new d_(o):aP(o)})(t)}:aP};X.create=_P();X.prototype._slice=Be.Array.prototype.subarray||Be.Array.prototype.slice;X.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Ge(this,10);return e}}();X.prototype.int32=function(){return this.uint32()|0};X.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function p_(){var r=new uP(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Ge(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw Ge(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}X.prototype.bool=function(){return this.uint32()!==0};function vi(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}X.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return vi(this.buf,this.pos+=4)};X.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return vi(this.buf,this.pos+=4)|0};function cP(){if(this.pos+8>this.len)throw Ge(this,8);return new uP(vi(this.buf,this.pos+=4),vi(this.buf,this.pos+=4))}X.prototype.float=function(){if(this.pos+4>this.len)throw Ge(this,4);var e=Be.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};X.prototype.double=function(){if(this.pos+8>this.len)throw Ge(this,4);var e=Be.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};X.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Ge(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var o=Be.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};X.prototype.string=function(){var e=this.bytes();return xq.read(e,0,e.length)};X.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ge(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ge(this);while(this.buf[this.pos++]&128);return this};X.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};X._configure=function(r){d_=r,X.create=_P(),d_._configure();var e=Be.Long?"toLong":"toNumber";Be.merge(X.prototype,{int64:function(){return p_.call(this)[e](!1)},uint64:function(){return p_.call(this)[e](!0)},sint64:function(){return p_.call(this).zzDecode()[e](!1)},fixed64:function(){return cP.call(this)[e](!0)},sfixed64:function(){return cP.call(this)[e](!1)}})}});var TP=_((U3,dP)=>{"use strict";dP.exports=zt;var pP=T_();(zt.prototype=Object.create(pP.prototype)).constructor=zt;var EP=gt();function zt(r){pP.call(this,r)}zt._configure=function(){EP.Buffer&&(zt.prototype._slice=EP.Buffer.prototype.slice)};zt.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};zt._configure()});var fP=_((w3,SP)=>{"use strict";SP.exports=Un;var S_=gt();(Un.prototype=Object.create(S_.EventEmitter.prototype)).constructor=Un;function Un(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");S_.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Un.prototype.rpcCall=function r(e,t,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return S_.asPromise(r,i,e,t,n,o);if(!i.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return i.rpcImpl(e,t[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return i.emit("error",c,e),s(c);if(u===null){i.end(!0);return}if(!(u instanceof n))try{u=n[i.responseDelimited?"decodeDelimited":"decode"](u)}catch(l){return i.emit("error",l,e),s(l)}return i.emit("data",u,e),s(null,u)})}catch(a){i.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Un.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var hP=_(AP=>{"use strict";var Dq=AP;Dq.Service=fP()});var gP=_((B3,mP)=>{"use strict";mP.exports={}});var PP=_(OP=>{"use strict";var ge=OP;ge.build="minimal";ge.Writer=E_();ge.BufferWriter=iP();ge.Reader=T_();ge.BufferReader=TP();ge.util=gt();ge.rpc=hP();ge.roots=gP();ge.configure=RP;function RP(){ge.util._configure(),ge.Writer._configure(ge.BufferWriter),ge.Reader._configure(ge.BufferReader)}RP()});var NP=_((H3,MP)=>{"use strict";MP.exports=PP()});var H=Re(Gh(),1);m();un();var HP=Re(hg(),1),Kr=Re(sn(),1),FP=Re(Vg(),1),qP=Re(YR(),1),jP=Re(WR(),1),Ot=Re(y(),1);m();var aq=Symbol.for("@vercel/request-context");function be(){return globalThis[aq]?.get()}var zR="http.method",XR="http.url",Pi="http.host",QR="http.scheme",Ku="http.status_code",JR="http.user_agent",Wu="http.response_content_length_uncompressed",ZR="net.peer.port",eO="net.peer.name",tO="cloud.region";var rO="deployment.environment.name",nO="deployment.id",oO="cloud.provider",sO="process.runtime.name",iO="vcs.ref.head.name",aO="vcs.ref.head.revision",cO="vcs.repository.name",uO="vcs.repository.ref.revision";var _O="service.name",lO="service.version";function zu(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function pO({attributes:r,env:e=process.env,runtime:t,serviceName:n}){let o=e.VERCEL_ENV,s=e.VERCEL_DEPLOYMENT_ID,i=e.VERCEL_GIT_COMMIT_SHA,a=e.VERCEL_REGION,c=e.VERCEL_GIT_COMMIT_REF,u=e.VERCEL_GIT_REPO_SLUG;return zu({[_O]:n,"node.ci":e.CI?!0:void 0,"node.env":e.NODE_ENV,[rO]:o,env:o,[oO]:"vercel",[tO]:a,"vercel.region":a,[sO]:t,"vercel.runtime":t,[iO]:c,[aO]:i,[cO]:u,[uO]:i,"vercel.sha":i,"vercel.host":e.VERCEL_URL||void 0,"vercel.branch_host":e.VERCEL_BRANCH_URL||void 0,[nO]:s,"vercel.deployment_id":s,[lO]:s,"vercel.project_id":e.VERCEL_PROJECT_ID||void 0,...r})}function dO(r){return r?r.split("::").at(-1):void 0}function TO(r=be(),e){if(!r)return;let t=e?uq(e,r.headers):void 0;return zu({[Pi]:r.headers.host,[JR]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":dO(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":process.env.VERCEL_REGION,...t})}var cq={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function uq(r,e){if(typeof r=="function")return r(e,cq);let t={};for(let[n,o]of Object.entries(r)){let s=e[o.toLocaleLowerCase()];s!==void 0&&(t[n]=s)}return t}m();function Hr(r){return(r&E.TraceFlags.SAMPLED)!==0}var Mi=class{constructor(e,t){this.processors=e;this.attributesFromHeaders=t;this.rootSpanIds=new Map;this.waitSpanEnd=new Map}forceFlush(){return Promise.all(this.processors.map(e=>e.forceFlush().catch(t=>{E.diag.error("@vercel/otel: forceFlush failed:",t)}))).then(()=>{})}shutdown(){return Promise.all(this.processors.map(e=>e.shutdown().catch(()=>{}))).then(()=>{})}onStart(e,t){let{traceId:n,spanId:o,traceFlags:s}=e.spanContext(),i=!e.parentSpanContext?.spanId||!this.rootSpanIds.has(n);if(i?this.rootSpanIds.set(n,{rootSpanId:o,open:[]}):this.rootSpanIds.get(n)?.open.push(e),i&&Hr(s)){let a=be(),c=TO(a,this.attributesFromHeaders);c&&e.setAttributes(c),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let u=new Promise(p=>{this.waitSpanEnd.set(n,p)}),l;await Promise.race([u,new Promise(p=>{l=setTimeout(()=>{this.waitSpanEnd.delete(n),p(void 0)},50)})]),l&&clearTimeout(l)}return this.forceFlush()})}for(let a of this.processors)a.onStart(e,t)}onEnd(e){let{traceId:t,spanId:n,traceFlags:o}=e.spanContext(),s=Hr(o),i=this.rootSpanIds.get(t),a=i?.rootSpanId===n;if(s){let c=lq(e);c&&Object.assign(e.attributes,c)}if(a){if(this.rootSpanIds.delete(t),i.open.length>0){for(let c of i.open)if(!c.ended&&c.spanContext().spanId!==n)try{c.end()}catch(u){E.diag.error("@vercel/otel: onEnd failed:",u)}}}else if(i)for(let c=0;c<i.open.length;c++)i.open[c]?.spanContext().spanId===n&&i.open.splice(c,1);for(let c of this.processors)c.onEnd(e);if(a){let c=this.waitSpanEnd.get(t);c&&(this.waitSpanEnd.delete(t),c())}}},_q={[E.SpanKind.INTERNAL]:"internal",[E.SpanKind.SERVER]:"server",[E.SpanKind.CLIENT]:"client",[E.SpanKind.PRODUCER]:"producer",[E.SpanKind.CONSUMER]:"consumer"};function lq(r){let{kind:e,attributes:t}=r,{"operation.name":n,"resource.name":o,"span.type":s,"next.span_type":i,"http.method":a,"http.route":c}=t;if(n)return;let u=o??(a&&typeof a=="string"&&c&&typeof c=="string"?`${a} ${c}`:c);if(r.kind===E.SpanKind.SERVER&&a&&c&&typeof a=="string"&&typeof c=="string")return{"operation.name":"web.request","resource.name":u};let l=r.instrumentationScope.name,p=i??s;if(p&&typeof p=="string"){let T=SO(l,p);return c?{"operation.name":T,"resource.name":u}:{"operation.name":T}}return{"operation.name":SO(l,e===E.SpanKind.INTERNAL?"":_q[e])}}function SO(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var LO=Re(r_(),1);m();var Fr=class{constructor(e={}){this._shutdownOnce={isCalled:!1};this._sendingPromises=[];this.url=e.url||this.getDefaultUrl(e),e.headers&&(this._headers=e.headers),this.onInit()}onShutdown(){E.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){E.diag.debug("@vercel/otel/otlp: onInit")}export(e,t){if(this._shutdownOnce.isCalled){E.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}this.send(e,()=>t({code:0}),n=>t({code:1,error:n}))}async forceFlush(){await Promise.all(this._sendingPromises)}async shutdown(){this._shutdownOnce.isCalled=!0,this.onShutdown(),await this.forceFlush()}send(e,t,n){if(this._shutdownOnce.isCalled){E.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}let o=this.convert(e),s,i,a;try{({body:s,contentType:i,headers:a}=this.toMessage(o))}catch(u){E.diag.warn("@vercel/otel/otlp: no proto",u);return}let c=fetch(this.url,{method:"POST",body:s,headers:{...this._headers,...a,"Content-Type":i,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(u=>{E.diag.debug("@vercel/otel/otlp: onSuccess",u.status,u.statusText),t(),u.arrayBuffer().catch(()=>{})}).catch(u=>{E.diag.error("@vercel/otel/otlp: onError",u),n(u)}).finally(()=>{let u=this._sendingPromises.indexOf(c);this._sendingPromises.splice(u,1)});this._sendingPromises.push(c)}};var Pq="v1/traces",Mq=`http://localhost:4318/${Pq}`;function Ii(r){return typeof r.url=="string"?r.url:Mq}var qr=class{constructor(e={}){this.impl=new n_(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},n_=class extends Fr{convert(e){return e}toMessage(e){let t=LO.JsonTraceSerializer.serializeRequest(e);return{body:new TextDecoder().decode(t),contentType:"application/json"}}getDefaultUrl(e){return Ii(e)}};var bP=Re(t_(),1);var CP=Re(NP(),1);function IP(r){let e=new CP.Writer;return Uq(r,e),e.finish()}function Uq(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)wq(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function wq(r,e){if(r.resource!=null&&Vq(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)Bq(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function Vq(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function Bq(r,e){if(r.scope!=null&&Fq(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)qq(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function kr(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&LP(r.value,e.uint32(18).fork()).ldelim(),e}function LP(r,e){return r.stringValue!=null&&e.uint32(10).string(r.stringValue),r.boolValue!=null&&e.uint32(16).bool(r.boolValue),r.intValue!=null&&e.uint32(24).int64(r.intValue),r.doubleValue!=null&&e.uint32(33).double(r.doubleValue),r.arrayValue!=null&&Gq(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&Hq(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function Gq(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)LP(r.values[t],e.uint32(10).fork()).ldelim();return e}function Hq(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)kr(r.values[t],e.uint32(10).fork()).ldelim();return e}function Fq(r,e){if(r.name!=null&&e.uint32(10).string(r.name),r.version!=null&&e.uint32(18).string(r.version),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function qq(r,e){if(r.traceId!=null&&e.uint32(10).bytes(r.traceId),r.spanId!=null&&e.uint32(18).bytes(r.spanId),r.traceState!=null&&e.uint32(26).string(r.traceState),r.parentSpanId!=null&&e.uint32(34).bytes(r.parentSpanId),r.name!=null&&e.uint32(42).string(r.name),r.kind!=null&&e.uint32(48).int32(r.kind),r.startTimeUnixNano!=null&&e.uint32(57).fixed64(r.startTimeUnixNano),r.endTimeUnixNano!=null&&e.uint32(65).fixed64(r.endTimeUnixNano),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(74).fork()).ldelim();if(r.droppedAttributesCount!=null&&e.uint32(80).uint32(r.droppedAttributesCount),r.events!=null&&r.events.length)for(let t=0;t<r.events.length;++t)kq(r.events[t],e.uint32(90).fork()).ldelim();if(r.droppedEventsCount!=null&&e.uint32(96).uint32(r.droppedEventsCount),r.links!=null&&r.links.length)for(let t=0;t<r.links.length;++t)Yq(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&jq(r.status,e.uint32(122).fork()).ldelim(),e}function jq(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function kq(r,e){if(r.timeUnixNano!=null&&e.uint32(9).fixed64(r.timeUnixNano),r.name!=null&&e.uint32(18).string(r.name),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function Yq(r,e){if(r.traceId!=null&&e.uint32(10).bytes(r.traceId),r.spanId!=null&&e.uint32(18).bytes(r.spanId),r.traceState!=null&&e.uint32(26).string(r.traceState),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var Xt=class{constructor(e={}){this.impl=new f_(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},f_=class extends Fr{convert(e){return(0,bP.createExportTraceServiceRequest)(e)}toMessage(e){return{body:IP(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Ii(e)}};m();function yP(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let o=e[n];return o!==void 0?String(o):t})}var Yr=class{constructor(e={}){this.instrumentationName="@vercel/otel/fetch";this.instrumentationVersion="1.0.0";this.config=e}getConfig(){return this.config}setConfig(){}setTracerProvider(e){this.tracerProvider=e}setMeterProvider(){}shouldIgnore(e,t){let n=this.config.ignoreUrls??[];if(t?.opentelemetry?.ignore!==void 0)return t.opentelemetry.ignore;if(n.length===0)return!1;let o=e.toString();return n.some(s=>typeof s=="string"?s==="*"?!0:o.startsWith(s):s.test(o))}shouldPropagate(e,t){let n=process.env.VERCEL_URL||null,o=process.env.VERCEL_BRANCH_URL||null,s=this.config.propagateContextUrls??[],i=this.config.dontPropagateContextUrls??[];if(t?.opentelemetry?.propagateContext)return t.opentelemetry.propagateContext;let a=e.toString();return i.length>0&&i.some(c=>typeof c=="string"?c==="*"?!0:a.startsWith(c):c.test(a))?!1:n&&e.protocol==="https:"&&(e.host===n||e.host===o||e.host===be()?.headers.host)||!n&&e.protocol==="http:"&&e.hostname==="localhost"?!0:s.some(c=>typeof c=="string"?c==="*"?!0:a.startsWith(c):c.test(a))}startSpan({tracer:e,url:t,fetchType:n,method:o="GET",name:s,attributes:i={}}){let a=this.config.resourceNameTemplate,c={[zR]:o,[XR]:t.toString(),[Pi]:t.host,[QR]:t.protocol.replace(":",""),[eO]:t.hostname,[ZR]:t.port},u=a?yP(a,c):Wq(t.toString()),l=s??`${n} ${o} ${t.toString()}`,p=E.context.active();return e.startSpan(l,{kind:E.SpanKind.CLIENT,attributes:{...c,"operation.name":`${n}.${o}`,"http.client.name":n,"resource.name":u,...i}},p)}instrumentHttp(e,t){let{tracerProvider:n}=this;if(!n)return;let o=n.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:s,attributesFromResponseHeaders:i}=this.config,a=e.request,c=e.get,u=l=>(p,T,A)=>{let M,g={},O;if(typeof p=="string"||p instanceof URL?(M=new URL(p.toString()),typeof T=="function"?O=T:T&&typeof A=="function"?(g=T,O=A):T&&(g=T)):(g=p,typeof T=="function"&&(O=T),M=Xq(g,t)),this.shouldIgnore(M))return l.apply(this,[M,g,O]);let P=this.startSpan({tracer:o,url:M,fetchType:"http",method:g.method||"GET"});if(!P.isRecording()||!Hr(P.spanContext().traceFlags))return P.end(),l.apply(this,[M,g,O]);if(this.shouldPropagate(M)){let F=E.context.active(),$=E.trace.setSpan(F,P);E.propagation.inject($,g.headers||{},Kq)}s&&xi(P,s,g.headers||{},xP);try{let F=Date.now(),$=l.apply(this,[M,g,O]);return $.prependListener("response",V=>{let rt=Date.now()-F;P.setAttribute("http.response_time",rt),V.statusCode!==void 0?(P.setAttribute(Ku,V.statusCode),V.statusCode>=500&&Qt(P,`Status: ${V.statusCode}`)):Qt(P,"Response status code is undefined"),i&&xi(P,i,V.headers,xP),$.listenerCount("response")<=1&&V.resume(),V.on("end",()=>{let ee,I=V.statusCode;V.aborted&&!V.complete?ee={code:E.SpanStatusCode.ERROR}:I&&I>=100&&I<500?ee={code:E.SpanStatusCode.UNSET}:ee={code:E.SpanStatusCode.ERROR},P.setStatus(ee),P.isRecording()&&(V.headers["content-length"]&&P.setAttribute(Wu,V.headers["content-length"]),P.end())})}),$.on("error",V=>{P.isRecording()&&(Qt(P,V),P.end())}),$.on("close",()=>{P.isRecording()&&P.end()}),$}catch(F){throw Qt(P,F),P.end(),F}};e.request=u(a),e.get=u(c)}instrumentFetch(){let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:n,attributesFromResponseHeaders:o}=this.config;process.env.NEXT_OTEL_FETCH_DISABLED="1";let s=globalThis.fetch;this.originalFetch=s;let i=async(a,c)=>{let u=c;if(u?.next?.internal)return s(a,u);let l=new Request(a instanceof Request?a.clone():a,u),p=new URL(l.url);if(this.shouldIgnore(p,u))return s(a,u);let T=this.startSpan({tracer:t,url:p,fetchType:"fetch",method:l.method,name:u?.opentelemetry?.spanName,attributes:u?.opentelemetry?.attributes});if(!T.isRecording()||!Hr(T.spanContext().traceFlags))return T.end(),s(a,u);if(this.shouldPropagate(p,u)){let A=E.context.active(),M=E.trace.setSpan(A,T);E.propagation.inject(M,l.headers,$q)}n&&xi(T,n,l.headers,vP);try{let A=Date.now();u?.body&&u.body instanceof FormData&&l.headers.delete("content-type");let M=await s(a,{...u,headers:l.headers}),g=Date.now()-A;return T.setAttribute(Ku,M.status),T.setAttribute("http.response_time",g),o&&xi(T,o,M.headers,vP),M.status>=500&&Qt(T,`Status: ${M.status} (${M.statusText})`),M.body?zq(M).then(O=>{T.isRecording()&&(T.setAttribute(Wu,O),T.end())},O=>{T.isRecording()&&(Qt(T,O),T.end())}):T.end(),M}catch(A){throw Qt(T,A),T.end(),A}};globalThis.fetch=i}enable(){this.disable(),this.instrumentFetch();try{let e=N("node:http"),t=N("node:https");this.instrumentHttp(e,"http:"),this.instrumentHttp(t,"https:")}catch{}}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},$q={set(r,e,t){r.set(e,t)}},vP={get(r,e){let t=r.get(e);if(t!==null)return t.includes(",")?t.split(",").map(n=>n.trimStart()):t},keys(r){let e=[];return r.forEach((t,n)=>{e.push(n)}),e}},Kq={set(r,e,t){r[e.toLowerCase()]=t}},xP={get(r,e){return r[e.toLowerCase()]},keys(r){return Object.keys(r)}};function Wq(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function zq(r){let e=0,n=r.clone().body?.getReader();if(!n)return Promise.resolve(0);let o=()=>n.read().then(({done:s,value:i})=>{if(!s)return e+=i.byteLength,o()});return o().then(()=>e)}function Qt(r,e){if(e instanceof Error)r.recordException(e),r.setStatus({code:E.SpanStatusCode.ERROR,message:e.message});else{let t=String(e);r.setStatus({code:E.SpanStatusCode.ERROR,message:t})}}function xi(r,e,t,n){for(let[o,s]of Object.entries(e)){let i=n.get(t,s);i!==void 0&&r.setAttribute(o,i)}}function Xq(r,e){if(r.socketPath)throw new Error("Cannot construct a network URL: options.socketPath is specified, indicating a Unix domain socket.");let t=r.protocol??e;t&&!t.endsWith(":")&&(t+=":");let n=r.hostname,o=r.port??r.defaultPort;if(!n&&r.host){let u=r.host.split(":");n=u[0];let l=u[1];if(u.length>1&&l&&o===void 0){let p=parseInt(l,10);isNaN(p)||(o=p)}}n||(n="localhost");let s;if(o!==void 0&&o!==""){let u=parseInt(String(o),10);isNaN(u)?s=t==="https:"?443:80:s=u}else s=t==="https:"?443:80;let i=r.path||"/",a=`${t}//${n}:${s}`,c=new URL(i,a);if(r.auth){let u=r.auth.split(":");c.username=decodeURIComponent(u[0]||""),u.length>1&&(c.password=decodeURIComponent(u[1]||""))}return c}m();var DP=Re(y(),1),Qq="00",A_="traceparent",h_="tracestate",wn=class{fields(){return[A_,h_]}inject(e,t,n){let o=E.trace.getSpanContext(e);if(!o||(0,DP.isTracingSuppressed)(e)||!(0,E.isSpanContextValid)(o))return;let s=`${Qq}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||0).toString(16)}`;n.set(t,A_,s),o.traceState&&n.set(t,h_,o.traceState.serialize())}extract(e,t,n){let o=n.get(t,A_);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Jq(s);if(!i)return e;i.isRemote=!0;let a=n.get(t,h_);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=(0,E.createTraceState)(typeof c=="string"?c:void 0)}return E.trace.setSpanContext(e,i)}};function Jq(r){let[e,t,n,o,s]=r.split("-");return!e||!t||!n||!o||e.length!==2||t.length!==32||n.length!==16||o.length!==2||e==="00"&&s?null:{traceId:t,spanId:n,traceFlags:parseInt(o,16)}}m();var Di=class{fields(){return[]}inject(){}extract(e){let t=be();if(!t?.telemetry)return E.diag.warn("@vercel/otel: Vercel telemetry extension not found."),e;let{rootSpanContext:n}=t.telemetry;return n?(E.diag.debug("@vercel/otel: Extracted root SpanContext from Vercel request context.",n),E.trace.setSpanContext(e,{...n,isRemote:!0,traceFlags:n.traceFlags||E.TraceFlags.SAMPLED})):e}};m();var Ui=Re(y(),1),UP=Re(r_(),1);var wi=class{export(e,t){let n=be();if(!n?.telemetry){E.diag.warn("@vercel/otel: no telemetry context found"),t({code:Ui.ExportResultCode.SUCCESS,error:void 0});return}try{let o=UP.JsonTraceSerializer.serializeRequest(e);if(!o)throw new Error("Failed to serialize spans");let s=JSON.parse(new TextDecoder().decode(o));n.telemetry.reportSpans(s),t({code:Ui.ExportResultCode.SUCCESS,error:void 0})}catch(o){t({code:Ui.ExportResultCode.FAILED,error:o instanceof Error?o:new Error(String(o))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};function De(r){let e=process.env[r];if(!(!e||e.trim()===""))return e}function wP(r){return De(r)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}m();function m_(){return!!be()?.telemetry?.traceDrains?.length}var VP=!1,Vn=class{constructor(e){this.processor=e}forceFlush(){return this.processor.forceFlush()}shutdown(){return this.processor.shutdown()}onStart(e,t){if(m_()){VP||(VP=!0,E.diag.debug("@vercel/otel: skipping automatic exporter due to configured trace drains"));return}this.processor.onStart(e,t)}onEnd(e){m_()||this.processor.onEnd(e)}};var Zq={ALL:E.DiagLogLevel.ALL,VERBOSE:E.DiagLogLevel.VERBOSE,DEBUG:E.DiagLogLevel.DEBUG,INFO:E.DiagLogLevel.INFO,WARN:E.DiagLogLevel.WARN,ERROR:E.DiagLogLevel.ERROR,NONE:E.DiagLogLevel.NONE},Vi=class{constructor(e={}){this.configuration=e}start(){let e=e2(),t=this.configuration,n=process.env.NEXT_RUNTIME||"nodejs",o=!!e.OTEL_SDK_DISABLED;if(process.env.OTEL_LOG_LEVEL&&E.diag.setLogger(new E.DiagConsoleLogger,{logLevel:Zq[process.env.OTEL_LOG_LEVEL.toUpperCase()]}),o)return;let s=t.idGenerator??new H.RandomIdGenerator;this.contextManager=u2(t.contextManager);let i=e.OTEL_SERVICE_NAME||t.serviceName||"app",a=(0,Kr.resourceFromAttributes)(pO({attributes:t.attributes,runtime:n,serviceName:i})),c=t.resourceDetectors??[Kr.envDetector];if(t.autoDetectResources??!0){let P=(0,Kr.detectResources)({detectors:c});a=a.merge(P)}let l=r2(t.propagators,t,e),p=n2(t.traceSampler,e),T=o2(t.spanProcessors,t,e);T.length===0&&E.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let A=t.spanLimits,M=new H.BasicTracerProvider({resource:a,idGenerator:s,sampler:p,spanLimits:A,spanProcessors:[new Mi(T,t.attributesFromHeaders)]});if(E.trace.setGlobalTracerProvider(M),E.propagation.setGlobalPropagator(new Ot.CompositePropagator({propagators:l})),this.tracerProvider=M,t.logRecordProcessors){let O=new FP.LoggerProvider({resource:a,processors:t.logRecordProcessors});this.loggerProvider=O,at.logs.setGlobalLoggerProvider(O)}if(t.metricReaders||t.views){let O=new qP.MeterProvider({resource:a,views:t.views??[],readers:t.metricReaders??[]});E.metrics.setGlobalMeterProvider(O),this.meterProvider=O}let g=t2(t.instrumentations,t.instrumentationConfig);this.disableInstrumentations=(0,HP.registerInstrumentations)({instrumentations:g}),E.diag.info("@vercel/otel: started",i,n)}async shutdown(){let e=[];this.tracerProvider&&e.push(this.tracerProvider.shutdown()),this.loggerProvider&&e.push(this.loggerProvider.shutdown()),this.meterProvider&&e.push(this.meterProvider.shutdown()),E.diag.info("@vercel/otel: shutting down",e.length,process.env.NEXT_RUNTIME),await Promise.all(e),this.contextManager&&this.contextManager.disable();let{disableInstrumentations:t}=this;t&&t()}};function e2(){return{OTEL_SDK_DISABLED:De("OTEL_SDK_DISABLED"),OTEL_SERVICE_NAME:De("OTEL_SERVICE_NAME"),OTEL_PROPAGATORS:wP("OTEL_PROPAGATORS"),OTEL_TRACES_SAMPLER:De("OTEL_TRACES_SAMPLER"),OTEL_TRACES_SAMPLER_ARG:De("OTEL_TRACES_SAMPLER_ARG"),OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:De("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"),OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:De("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL"),OTEL_EXPORTER_OTLP_PROTOCOL:De("OTEL_EXPORTER_OTLP_PROTOCOL"),OTEL_EXPORTER_OTLP_ENDPOINT:De("OTEL_EXPORTER_OTLP_ENDPOINT"),OTEL_EXPORTER_OTLP_HEADERS:De("OTEL_EXPORTER_OTLP_HEADERS"),OTEL_EXPORTER_OTLP_TRACES_HEADERS:De("OTEL_EXPORTER_OTLP_TRACES_HEADERS")}}function t2(r,e){return(r??["auto"]).map(t=>t==="auto"?(E.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new Yr(e?.fetch)]):t==="fetch"?(E.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new Yr(e?.fetch)):t).flat()}function r2(r,e,t){let n=process.env.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS.length>0?t.OTEL_PROPAGATORS:void 0;return(r??n??["auto"]).map(o=>{if(o==="none")return[];if(o==="auto"){let s=[];return s.push({name:"tracecontext",propagator:new wn}),s.push({name:"baggage",propagator:new Ot.W3CBaggagePropagator}),s.push({name:"vercel-runtime",propagator:new Di}),E.diag.debug(`@vercel/otel: Configure propagators: ${s.map(i=>i.name).join(", ")}`),s.map(i=>i.propagator)}if(o==="tracecontext")return E.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new wn;if(o==="baggage")return E.diag.debug("@vercel/otel: Configure propagator: baggage"),new Ot.W3CBaggagePropagator;if(typeof o=="string")throw new Error(`Unknown propagator: "${o}"`);return o}).flat()}var BP="always_on",$r=1;function n2(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||BP;switch(E.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new H.AlwaysOnSampler;case"always_off":return new H.AlwaysOffSampler;case"parentbased_always_on":return new H.ParentBasedSampler({root:new H.AlwaysOnSampler});case"parentbased_always_off":return new H.ParentBasedSampler({root:new H.AlwaysOffSampler});case"traceidratio":return new H.TraceIdRatioBasedSampler(GP(e));case"parentbased_traceidratio":return new H.ParentBasedSampler({root:new H.TraceIdRatioBasedSampler(GP(e))});default:return E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${BP}".`),new H.AlwaysOnSampler}}function GP(r){if(r.OTEL_TRACES_SAMPLER_ARG===void 0||r.OTEL_TRACES_SAMPLER_ARG==="")return E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$r}.`),$r;E.diag.debug("@vercel/otel: Configure sampler probability: ",r.OTEL_TRACES_SAMPLER_ARG);let e=Number(r.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${$r}.`),$r):e<0||e>1?(E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${$r}.`),$r):e}function o2(r,e,t){return[...(r??["auto"]).flatMap(n=>{if(n==="auto"){let o=[new H.BatchSpanProcessor(new wi)];if(process.env.VERCEL_OTEL_ENDPOINTS){let s=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",i=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";E.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",s,i);let a={url:`http://localhost:${s}/v1/traces`,headers:{}},c=i==="http/protobuf"?new Xt(a):new qr(a);o.push(new Vn(new H.BatchSpanProcessor(c)))}else(!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT)&&o.push(new Vn(new H.BatchSpanProcessor(s2(t))));return o}return n}).filter(c2),...e.traceExporter&&e.traceExporter!=="auto"?[new H.BatchSpanProcessor(e.traceExporter)]:[]]}function s2(r){let e=r.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??r.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=a2(r),n={...r.OTEL_EXPORTER_OTLP_HEADERS?(0,Ot.parseKeyPairsIntoRecord)(r.OTEL_EXPORTER_OTLP_HEADERS):{},...r.OTEL_EXPORTER_OTLP_TRACES_HEADERS?(0,Ot.parseKeyPairsIntoRecord)(r.OTEL_EXPORTER_OTLP_TRACES_HEADERS):{}};switch(E.diag.debug("@vercel/otel: Configure trace exporter: ",e,t,`headers: ${Object.keys(n).join(",")||"<none>"}`),e){case"http/json":return new qr({url:t,headers:n});case"http/protobuf":return new Xt({url:t,headers:n});default:return E.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new Xt}}var kP="v1/traces",i2=`http://localhost:4318/${kP}`;function a2(r){let e=r.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;if(e&&typeof e=="string")return e;let t=r.OTEL_EXPORTER_OTLP_ENDPOINT;return t&&typeof t=="string"?`${t}/${kP}`:i2}function c2(r){return r!=null}function u2(r){if(r===void 0){E.diag.debug("@vercel/otel: Configure context manager: default");let e=new jP.AsyncLocalStorageContextManager;return e.enable(),E.context.setGlobalContextManager(e),e}return E.diag.debug("@vercel/otel: Configure context manager: from configuration"),r.enable(),E.context.setGlobalContextManager(r),r}function N8(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new Vi(e).start()}export{Yr as FetchInstrumentation,qr as OTLPHttpJsonTraceExporter,Xt as OTLPHttpProtoTraceExporter,N8 as registerOTel};
|
|
23
|
+
`,(0,ii.getConflictResolutionRecipe)(s,e))}return n}};ai.MetricStorageRegistry=Ou});var NR=_(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.MultiMetricStorage=void 0;var Pu=class{_backingStorages;constructor(e){this._backingStorages=e}record(e,t,n,o){this._backingStorages.forEach(s=>{s.record(e,t,n,o)})}};ci.MultiMetricStorage=Pu});var IR=_(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.BatchObservableResultImpl=Vr.ObservableResultImpl=void 0;var wr=(m(),R(E)),CR=bn(),uF=Zs(),Mu=class{_instrumentName;_valueType;_buffer=new CR.AttributeHashMap;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!="number"){wr.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===wr.ValueType.INT&&!Number.isInteger(e)&&(wr.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}};Vr.ObservableResultImpl=Mu;var Nu=class{_buffer=new Map;observe(e,t,n={}){if(!(0,uF.isObservableInstrument)(e))return;let o=this._buffer.get(e);if(o==null&&(o=new CR.AttributeHashMap,this._buffer.set(e,o)),typeof t!="number"){wr.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===wr.ValueType.INT&&!Number.isInteger(t)&&(wr.diag.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||o.set(n,t)}};Vr.BatchObservableResultImpl=Nu});var yR=_(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.ObservableRegistry=void 0;var _F=(m(),R(E)),LR=Zs(),bR=IR(),yn=we(),Cu=class{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(LR.isObservableInstrument));if(n.size===0){_F.diag.error("BatchObservableCallback is not associated with valid instruments",t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(LR.isObservableInstrument)),o=this._findBatchCallback(e,n);o<0||this._batchCallbacks.splice(o,1)}async observe(e,t){let n=this._observeCallbacks(e,t),o=this._observeBatchCallbacks(e,t);return(await(0,yn.PromiseAllSettled)([...n,...o])).filter(yn.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:o})=>{let s=new bR.ObservableResultImpl(o._descriptor.name,o._descriptor.valueType),i=Promise.resolve(n(s));t!=null&&(i=(0,yn.callWithTimeout)(i,t)),await i,o._metricStorages.forEach(a=>{a.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let s=new bR.BatchObservableResultImpl,i=Promise.resolve(n(s));t!=null&&(i=(0,yn.callWithTimeout)(i,t)),await i,o.forEach(a=>{let c=s._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&(0,yn.setEquals)(n.instruments,t))}};ui.ObservableRegistry=Cu});var vR=_(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.SyncMetricStorage=void 0;var lF=Tu(),EF=hu(),pF=gu(),Iu=class extends lF.MetricStorage{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(e,t,n,o,s){super(e),this._attributesProcessor=n,this._aggregationCardinalityLimit=s,this._deltaMetricStorage=new EF.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new pF.TemporalMetricProcessor(t,o)}record(e,t,n,o){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,o)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};_i.SyncMetricStorage=Iu});var li=_(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createDenyListAttributesProcessor=Ze.createAllowListAttributesProcessor=Ze.createMultiAttributesProcessor=Ze.createNoopAttributesProcessor=void 0;var Lu=class{process(e,t){return e}},bu=class{_processors;constructor(e){this._processors=e}process(e,t){let n=e;for(let o of this._processors)n=o.process(n,t);return n}},yu=class{_allowedAttributeNames;constructor(e){this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(o=>this._allowedAttributeNames.includes(o)).forEach(o=>n[o]=e[o]),n}},vu=class{_deniedAttributeNames;constructor(e){this._deniedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(o=>!this._deniedAttributeNames.includes(o)).forEach(o=>n[o]=e[o]),n}};function dF(){return AF}Ze.createNoopAttributesProcessor=dF;function TF(r){return new bu(r)}Ze.createMultiAttributesProcessor=TF;function SF(r){return new yu(r)}Ze.createAllowListAttributesProcessor=SF;function fF(r){return new vu(r)}Ze.createDenyListAttributesProcessor=fF;var AF=new Lu});var xR=_(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.MeterSharedState=void 0;var hF=Ln(),mF=fR(),gF=we(),RF=AR(),OF=MR(),PF=NR(),MF=yR(),NF=vR(),CF=li(),xu=class{_meterProviderSharedState;_instrumentationScope;metricStorageRegistry=new OF.MetricStorageRegistry;observableRegistry=new MF.ObservableRegistry;meter;constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.meter=new mF.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,NF.SyncMetricStorage);return t.length===1?t[0]:new PF.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,RF.AsyncMetricStorage)}async collect(e,t,n){let o=await this.observableRegistry.observe(t,n?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(s.length===0)return null;let i=s.map(a=>a.collect(e,t)).filter(gF.isNotNullish);return i.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:i},errors:o}}_registerMetricStorage(e,t){let o=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(s=>{let i=(0,hF.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(a!=null)return a;let c=s.aggregation.createAggregator(i),u=new t(i,c,s.attributesProcessor,this._meterProviderSharedState.metricCollectors,s.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let i=this._meterProviderSharedState.selectAggregations(e.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(u!=null)return u;let l=c.createAggregator(e),p=a.selectCardinalityLimit(e.type),T=new t(e,l,(0,CF.createNoopAttributesProcessor)(),[a],p);return this.metricStorageRegistry.registerForCollector(a,T),T});o=o.concat(i)}return o}};Ei.MeterSharedState=xu});var DR=_(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.MeterProviderSharedState=void 0;var IF=we(),LF=dR(),bF=xR(),yF=Cn(),Du=class{resource;viewRegistry=new LF.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;constructor(e){this.resource=e}getMeterSharedState(e){let t=(0,IF.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new bF.MeterSharedState(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,(0,yF.toAggregation)(n.selectAggregation(e))]);return t}};pi.MeterProviderSharedState=Du});var UR=_(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.MetricCollector=void 0;var vF=y(),Uu=class{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,vF.millisToHrTime)(Date.now()),n=[],o=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async i=>{let a=await i.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}};di.MetricCollector=Uu});var Ti=_(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ExactPredicate=Br.PatternPredicate=void 0;var xF=/[\^$\\.+?()[\]{}|]/g,wu=class r{_matchAll;_regexp;constructor(e){e==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(r.escapePattern(e)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(xF,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};Br.PatternPredicate=wu;var Vu=class{_matchAll;_pattern;constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};Br.ExactPredicate=Vu});var VR=_(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.InstrumentSelector=void 0;var wR=Ti(),Bu=class{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new wR.PatternPredicate(e?.name??"*"),this._type=e?.type,this._unitFilter=new wR.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};Si.InstrumentSelector=Bu});var BR=_(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.MeterSelector=void 0;var Gu=Ti(),Hu=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new Gu.ExactPredicate(e?.name),this._versionFilter=new Gu.ExactPredicate(e?.version),this._schemaUrlFilter=new Gu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};fi.MeterSelector=Hu});var FR=_(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.View=void 0;var DF=Ti(),GR=li(),UF=VR(),wF=BR(),HR=Cn();function VF(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}function BF(r){if(VF(r))throw new Error("Cannot create view with no selector arguments supplied");if(r.name!=null&&(r?.instrumentName==null||DF.PatternPredicate.hasWildcard(r.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}var Fu=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){BF(e),e.attributesProcessors!=null?this.attributesProcessor=(0,GR.createMultiAttributesProcessor)(e.attributesProcessors):this.attributesProcessor=(0,GR.createNoopAttributesProcessor)(),this.name=e.name,this.description=e.description,this.aggregation=(0,HR.toAggregation)(e.aggregation??{type:HR.AggregationType.DEFAULT}),this.instrumentSelector=new UF.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new wF.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};Ai.View=Fu});var qR=_(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.MeterProvider=void 0;var hi=(m(),R(E)),GF=sn(),HF=DR(),FF=UR(),qF=FR(),qu=class{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new HF.MeterProviderSharedState(e?.resource??(0,GF.defaultResource)()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new qF.View(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new FF.MetricCollector(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(e,t="",n={}){return this._shutdown?(hi.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,hi.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}async shutdown(e){if(this._shutdown){hi.diag.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){hi.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};mi.MeterProvider=qu});var YR=_(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.TimeoutError=w.createDenyListAttributesProcessor=w.createAllowListAttributesProcessor=w.AggregationType=w.MeterProvider=w.ConsoleMetricExporter=w.InMemoryMetricExporter=w.PeriodicExportingMetricReader=w.MetricReader=w.InstrumentType=w.DataPointType=w.AggregationTemporality=void 0;var jF=Ls();Object.defineProperty(w,"AggregationTemporality",{enumerable:!0,get:function(){return jF.AggregationTemporality}});var jR=At();Object.defineProperty(w,"DataPointType",{enumerable:!0,get:function(){return jR.DataPointType}});Object.defineProperty(w,"InstrumentType",{enumerable:!0,get:function(){return jR.InstrumentType}});var kF=eu();Object.defineProperty(w,"MetricReader",{enumerable:!0,get:function(){return kF.MetricReader}});var YF=uR();Object.defineProperty(w,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return YF.PeriodicExportingMetricReader}});var $F=lR();Object.defineProperty(w,"InMemoryMetricExporter",{enumerable:!0,get:function(){return $F.InMemoryMetricExporter}});var KF=pR();Object.defineProperty(w,"ConsoleMetricExporter",{enumerable:!0,get:function(){return KF.ConsoleMetricExporter}});var WF=qR();Object.defineProperty(w,"MeterProvider",{enumerable:!0,get:function(){return WF.MeterProvider}});var zF=Cn();Object.defineProperty(w,"AggregationType",{enumerable:!0,get:function(){return zF.AggregationType}});var kR=li();Object.defineProperty(w,"createAllowListAttributesProcessor",{enumerable:!0,get:function(){return kR.createAllowListAttributesProcessor}});Object.defineProperty(w,"createDenyListAttributesProcessor",{enumerable:!0,get:function(){return kR.createDenyListAttributesProcessor}});var XF=we();Object.defineProperty(w,"TimeoutError",{enumerable:!0,get:function(){return XF.TimeoutError}})});var ku=_(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.AbstractAsyncHooksContextManager=void 0;var QF=N("events"),JF=["addListener","on","once","prependListener","prependOnceListener"],ju=class{bind(e,t){return t instanceof QF.EventEmitter?this._bindEventEmitter(e,t):typeof t=="function"?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,o=function(...s){return n.with(e,()=>t.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),o}_bindEventEmitter(e,t){return this._getPatchMap(t)!==void 0||(this._createPatchMap(t),JF.forEach(o=>{t[o]!==void 0&&(t[o]=this._patchAddListener(t,t[o],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}_patchRemoveListener(e,t){let n=this;return function(o,s){let i=n._getPatchMap(e)?.[o];if(i===void 0)return t.call(this,o,s);let a=i.get(s);return t.call(this,o,a||s)}}_patchRemoveAllListeners(e,t){let n=this;return function(o){let s=n._getPatchMap(e);return s!==void 0&&(arguments.length===0?n._createPatchMap(e):s[o]!==void 0&&delete s[o]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let o=this;return function(s,i){if(o._wrapped)return t.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let u=o.bind(n,i);c.set(i,u),o._wrapped=!0;try{return t.call(this,s,u)}finally{o._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};gi.AbstractAsyncHooksContextManager=ju});var $R=_(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.AsyncHooksContextManager=void 0;var ZF=(m(),R(E)),eq=N("async_hooks"),tq=ku(),Yu=class extends tq.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=eq.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]??ZF.ROOT_CONTEXT}with(e,t,n,...o){this._enterContext(e);try{return t.call(n,...o)}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()}};Ri.AsyncHooksContextManager=Yu});var KR=_(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.AsyncLocalStorageContextManager=void 0;var rq=(m(),R(E)),nq=N("async_hooks"),oq=ku(),$u=class extends oq.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new nq.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??rq.ROOT_CONTEXT}with(e,t,n,...o){let s=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Oi.AsyncLocalStorageContextManager=$u});var WR=_(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.AsyncLocalStorageContextManager=Gr.AsyncHooksContextManager=void 0;var sq=$R();Object.defineProperty(Gr,"AsyncHooksContextManager",{enumerable:!0,get:function(){return sq.AsyncHooksContextManager}});var iq=KR();Object.defineProperty(Gr,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return iq.AsyncLocalStorageContextManager}})});var AO=_(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.toAnyValue=ye.toKeyValue=ye.toAttributes=ye.createInstrumentationScope=ye.createResource=void 0;function Eq(r){let e={attributes:fO(r.attributes),droppedAttributesCount:0},t=r.schemaUrl;return t&&t!==""&&(e.schemaUrl=t),e}ye.createResource=Eq;function pq(r){return{name:r.name,version:r.version}}ye.createInstrumentationScope=pq;function fO(r){return Object.keys(r).map(e=>Xu(e,r[e]))}ye.toAttributes=fO;function Xu(r,e){return{key:r,value:Qu(e)}}ye.toKeyValue=Xu;function Qu(r){let e=typeof r;return e==="string"?{stringValue:r}:e==="number"?Number.isInteger(r)?{intValue:r}:{doubleValue:r}:e==="boolean"?{boolValue:r}:r instanceof Uint8Array?{bytesValue:r}:Array.isArray(r)?{arrayValue:{values:r.map(Qu)}}:e==="object"&&r!=null?{kvlistValue:{values:Object.entries(r).map(([t,n])=>Xu(t,n))}}:{}}ye.toAnyValue=Qu});var mO=_(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.hexToBinary=void 0;function hO(r){return r>=48&&r<=57?r-48:r>=97&&r<=102?r-87:r-55}function dq(r){let e=new Uint8Array(r.length/2),t=0;for(let n=0;n<r.length;n+=2){let o=hO(r.charCodeAt(n)),s=hO(r.charCodeAt(n+1));e[t++]=o<<4|s}return e}Ni.hexToBinary=dq});var MO=_(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.getOtlpEncoder=ve.encodeAsString=ve.encodeAsLongBits=ve.toLongBits=ve.hrTimeToNanos=void 0;var Tq=y(),Ju=mO();function Zu(r){let e=BigInt(1e9);return BigInt(r[0])*e+BigInt(r[1])}ve.hrTimeToNanos=Zu;function RO(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}ve.toLongBits=RO;function e_(r){let e=Zu(r);return RO(e)}ve.encodeAsLongBits=e_;function OO(r){return Zu(r).toString()}ve.encodeAsString=OO;var Sq=typeof BigInt<"u"?OO:Tq.hrTimeToNanoseconds;function gO(r){return r}function PO(r){if(r!==void 0)return(0,Ju.hexToBinary)(r)}var fq={encodeHrTime:e_,encodeSpanContext:Ju.hexToBinary,encodeOptionalSpanContext:PO};function Aq(r){if(r===void 0)return fq;let e=r.useLongBits??!0,t=r.useHex??!1;return{encodeHrTime:e?e_:Sq,encodeSpanContext:t?gO:Ju.hexToBinary,encodeOptionalSpanContext:t?gO:PO}}ve.getOtlpEncoder=Aq});var t_=_(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.createExportTraceServiceRequest=et.toOtlpSpanEvent=et.toOtlpLink=et.sdkSpanToOtlpSpan=void 0;var vn=AO(),hq=MO();function NO(r,e){let t=r.spanContext(),n=r.status,o=r.parentSpanContext?.spanId?e.encodeSpanContext(r.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(t.traceId),spanId:e.encodeSpanContext(t.spanId),parentSpanId:o,traceState:t.traceState?.serialize(),name:r.name,kind:r.kind==null?0:r.kind+1,startTimeUnixNano:e.encodeHrTime(r.startTime),endTimeUnixNano:e.encodeHrTime(r.endTime),attributes:(0,vn.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>IO(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:n.code,message:n.message},links:r.links.map(s=>CO(s,e)),droppedLinksCount:r.droppedLinksCount}}et.sdkSpanToOtlpSpan=NO;function CO(r,e){return{attributes:r.attributes?(0,vn.toAttributes)(r.attributes):[],spanId:e.encodeSpanContext(r.context.spanId),traceId:e.encodeSpanContext(r.context.traceId),traceState:r.context.traceState?.serialize(),droppedAttributesCount:r.droppedAttributesCount||0}}et.toOtlpLink=CO;function IO(r,e){return{attributes:r.attributes?(0,vn.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}et.toOtlpSpanEvent=IO;function mq(r,e){let t=(0,hq.getOtlpEncoder)(e);return{resourceSpans:Rq(r,t)}}et.createExportTraceServiceRequest=mq;function gq(r){let e=new Map;for(let t of r){let n=e.get(t.resource);n||(n=new Map,e.set(t.resource,n));let o=`${t.instrumentationScope.name}@${t.instrumentationScope.version||""}:${t.instrumentationScope.schemaUrl||""}`,s=n.get(o);s||(s=[],n.set(o,s)),s.push(t)}return e}function Rq(r,e){let t=gq(r),n=[],o=t.entries(),s=o.next();for(;!s.done;){let[i,a]=s.value,c=[],u=a.values(),l=u.next();for(;!l.done;){let A=l.value;if(A.length>0){let M=A.map(g=>NO(g,e));c.push({scope:(0,vn.createInstrumentationScope)(A[0].instrumentationScope),spans:M,schemaUrl:A[0].instrumentationScope.schemaUrl})}l=u.next()}let p=(0,vn.createResource)(i),T={resource:p,scopeSpans:c,schemaUrl:p.schemaUrl};n.push(T),s=o.next()}return n}});var r_=_(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.JsonTraceSerializer=void 0;var Oq=t_();Ci.JsonTraceSerializer={serializeRequest:r=>{let e=(0,Oq.createExportTraceServiceRequest)(r,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:r=>{if(r.length===0)return{};let e=new TextDecoder;return JSON.parse(e.decode(r))}}});var yO=_((P3,bO)=>{"use strict";bO.exports=Nq;function Nq(r,e){for(var t=new Array(arguments.length-1),n=0,o=2,s=!0;o<arguments.length;)t[n++]=arguments[o++];return new Promise(function(a,c){t[n]=function(l){if(s)if(s=!1,l)c(l);else{for(var p=new Array(arguments.length-1),T=0;T<p.length;)p[T++]=arguments[T];a.apply(null,p)}};try{r.apply(e||null,t)}catch(u){s&&(s=!1,c(u))}})}});var UO=_(DO=>{"use strict";var Li=DO;Li.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&e.charAt(t)==="=";)++n;return Math.ceil(e.length*3)/4-n};var jr=new Array(64),xO=new Array(123);for(Ve=0;Ve<64;)xO[jr[Ve]=Ve<26?Ve+65:Ve<52?Ve+71:Ve<62?Ve-4:Ve-59|43]=Ve++;var Ve;Li.encode=function(e,t,n){for(var o=null,s=[],i=0,a=0,c;t<n;){var u=e[t++];switch(a){case 0:s[i++]=jr[u>>2],c=(u&3)<<4,a=1;break;case 1:s[i++]=jr[c|u>>4],c=(u&15)<<2,a=2;break;case 2:s[i++]=jr[c|u>>6],s[i++]=jr[u&63],a=0;break}i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=jr[c],s[i++]=61,a===1&&(s[i++]=61)),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var vO="invalid encoding";Li.decode=function(e,t,n){for(var o=n,s=0,i,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&s>1)break;if((c=xO[c])===void 0)throw Error(vO);switch(s){case 0:i=c,s=1;break;case 1:t[n++]=i<<2|(c&48)>>4,i=c,s=2;break;case 2:t[n++]=(i&15)<<4|(c&60)>>2,i=c,s=3;break;case 3:t[n++]=(i&3)<<6|c,s=0;break}}if(s===1)throw Error(vO);return n-o};Li.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var VO=_((N3,wO)=>{"use strict";wO.exports=bi;function bi(){this._listeners={}}bi.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};bi.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],o=0;o<n.length;)n[o].fn===t?n.splice(o,1):++o;return this};bi.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<t.length;)t[o].fn.apply(t[o++].ctx,n)}return this}});var kO=_((C3,jO)=>{"use strict";jO.exports=BO(BO);function BO(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function o(c,u,l){e[0]=c,u[l]=t[0],u[l+1]=t[1],u[l+2]=t[2],u[l+3]=t[3]}function s(c,u,l){e[0]=c,u[l]=t[3],u[l+1]=t[2],u[l+2]=t[1],u[l+3]=t[0]}r.writeFloatLE=n?o:s,r.writeFloatBE=n?s:o;function i(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],e[0]}function a(c,u){return t[3]=c[u],t[2]=c[u+1],t[1]=c[u+2],t[0]=c[u+3],e[0]}r.readFloatLE=n?i:a,r.readFloatBE=n?a:i}():function(){function e(n,o,s,i){var a=o<0?1:0;if(a&&(o=-o),o===0)n(1/o>0?0:2147483648,s,i);else if(isNaN(o))n(2143289344,s,i);else if(o>34028234663852886e22)n((a<<31|2139095040)>>>0,s,i);else if(o<11754943508222875e-54)n((a<<31|Math.round(o/1401298464324817e-60))>>>0,s,i);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|u)>>>0,s,i)}}r.writeFloatLE=e.bind(null,GO),r.writeFloatBE=e.bind(null,HO);function t(n,o,s){var i=n(o,s),a=(i>>31)*2+1,c=i>>>23&255,u=i&8388607;return c===255?u?NaN:a*(1/0):c===0?a*1401298464324817e-60*u:a*Math.pow(2,c-150)*(u+8388608)}r.readFloatLE=t.bind(null,FO),r.readFloatBE=t.bind(null,qO)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function o(c,u,l){e[0]=c,u[l]=t[0],u[l+1]=t[1],u[l+2]=t[2],u[l+3]=t[3],u[l+4]=t[4],u[l+5]=t[5],u[l+6]=t[6],u[l+7]=t[7]}function s(c,u,l){e[0]=c,u[l]=t[7],u[l+1]=t[6],u[l+2]=t[5],u[l+3]=t[4],u[l+4]=t[3],u[l+5]=t[2],u[l+6]=t[1],u[l+7]=t[0]}r.writeDoubleLE=n?o:s,r.writeDoubleBE=n?s:o;function i(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],t[4]=c[u+4],t[5]=c[u+5],t[6]=c[u+6],t[7]=c[u+7],e[0]}function a(c,u){return t[7]=c[u],t[6]=c[u+1],t[5]=c[u+2],t[4]=c[u+3],t[3]=c[u+4],t[2]=c[u+5],t[1]=c[u+6],t[0]=c[u+7],e[0]}r.readDoubleLE=n?i:a,r.readDoubleBE=n?a:i}():function(){function e(n,o,s,i,a,c){var u=i<0?1:0;if(u&&(i=-i),i===0)n(0,a,c+o),n(1/i>0?0:2147483648,a,c+s);else if(isNaN(i))n(0,a,c+o),n(2146959360,a,c+s);else if(i>17976931348623157e292)n(0,a,c+o),n((u<<31|2146435072)>>>0,a,c+s);else{var l;if(i<22250738585072014e-324)l=i/5e-324,n(l>>>0,a,c+o),n((u<<31|l/4294967296)>>>0,a,c+s);else{var p=Math.floor(Math.log(i)/Math.LN2);p===1024&&(p=1023),l=i*Math.pow(2,-p),n(l*4503599627370496>>>0,a,c+o),n((u<<31|p+1023<<20|l*1048576&1048575)>>>0,a,c+s)}}}r.writeDoubleLE=e.bind(null,GO,0,4),r.writeDoubleBE=e.bind(null,HO,4,0);function t(n,o,s,i,a){var c=n(i,a+o),u=n(i,a+s),l=(u>>31)*2+1,p=u>>>20&2047,T=4294967296*(u&1048575)+c;return p===2047?T?NaN:l*(1/0):p===0?l*5e-324*T:l*Math.pow(2,p-1075)*(T+4503599627370496)}r.readDoubleLE=t.bind(null,FO,0,4),r.readDoubleBE=t.bind(null,qO,4,0)}(),r}function GO(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function HO(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function FO(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function qO(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var YO=_((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var KO=_($O=>{"use strict";var o_=$O;o_.length=function(e){for(var t=0,n=0,o=0;o<e.length;++o)n=e.charCodeAt(o),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320?(++o,t+=4):t+=3;return t};o_.read=function(e,t,n){var o=n-t;if(o<1)return"";for(var s=null,i=[],a=0,c;t<n;)c=e[t++],c<128?i[a++]=c:c>191&&c<224?i[a++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,i[a++]=55296+(c>>10),i[a++]=56320+(c&1023)):i[a++]=(c&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,i)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,i.slice(0,a))),s.join("")):String.fromCharCode.apply(String,i.slice(0,a))};o_.write=function(e,t,n){for(var o=n,s,i,a=0;a<e.length;++a)s=e.charCodeAt(a),s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):(s&64512)===55296&&((i=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++a,t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128);return n-o}});var zO=_((L3,WO)=>{"use strict";WO.exports=Cq;function Cq(r,e,t){var n=t||8192,o=n>>>1,s=null,i=n;return function(c){if(c<1||c>o)return r(c);i+c>n&&(s=r(n),i=0);var u=e.call(s,i,i+=c);return i&7&&(i=(i|7)+1),u}}});var QO=_((b3,XO)=>{"use strict";XO.exports=oe;var xn=gt();function oe(r,e){this.lo=r>>>0,this.hi=e>>>0}var Wt=oe.zero=new oe(0,0);Wt.toNumber=function(){return 0};Wt.zzEncode=Wt.zzDecode=function(){return this};Wt.length=function(){return 1};var Iq=oe.zeroHash="\0\0\0\0\0\0\0\0";oe.fromNumber=function(e){if(e===0)return Wt;var t=e<0;t&&(e=-e);var n=e>>>0,o=(e-n)/4294967296>>>0;return t&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new oe(n,o)};oe.from=function(e){if(typeof e=="number")return oe.fromNumber(e);if(xn.isString(e))if(xn.Long)e=xn.Long.fromString(e);else return oe.fromNumber(parseInt(e,10));return e.low||e.high?new oe(e.low>>>0,e.high>>>0):Wt};oe.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296};oe.prototype.toLong=function(e){return xn.Long?new xn.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var mt=String.prototype.charCodeAt;oe.fromHash=function(e){return e===Iq?Wt:new oe((mt.call(e,0)|mt.call(e,1)<<8|mt.call(e,2)<<16|mt.call(e,3)<<24)>>>0,(mt.call(e,4)|mt.call(e,5)<<8|mt.call(e,6)<<16|mt.call(e,7)<<24)>>>0)};oe.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};oe.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};oe.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};oe.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}});var gt=_(s_=>{"use strict";var f=s_;f.asPromise=yO();f.base64=UO();f.EventEmitter=VO();f.float=kO();f.inquire=YO();f.utf8=KO();f.pool=zO();f.LongBits=QO();f.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);f.global=f.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||s_;f.emptyArray=Object.freeze?Object.freeze([]):[];f.emptyObject=Object.freeze?Object.freeze({}):{};f.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};f.isString=function(e){return typeof e=="string"||e instanceof String};f.isObject=function(e){return e&&typeof e=="object"};f.isset=f.isSet=function(e,t){var n=e[t];return n!=null&&e.hasOwnProperty(t)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};f.Buffer=function(){try{var r=f.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();f._Buffer_from=null;f._Buffer_allocUnsafe=null;f.newBuffer=function(e){return typeof e=="number"?f.Buffer?f._Buffer_allocUnsafe(e):new f.Array(e):f.Buffer?f._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};f.Array=typeof Uint8Array<"u"?Uint8Array:Array;f.Long=f.global.dcodeIO&&f.global.dcodeIO.Long||f.global.Long||f.inquire("long");f.key2Re=/^true|false|0|1$/;f.key32Re=/^-?(?:0|[1-9][0-9]*)$/;f.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;f.longToHash=function(e){return e?f.LongBits.from(e).toHash():f.LongBits.zeroHash};f.longFromHash=function(e,t){var n=f.LongBits.fromHash(e);return f.Long?f.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function JO(r,e,t){for(var n=Object.keys(e),o=0;o<n.length;++o)(r[n[o]]===void 0||!t)&&(r[n[o]]=e[n[o]]);return r}f.merge=JO;f.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function ZO(r){function e(t,n){if(!(this instanceof e))return new e(t,n);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&JO(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}f.newError=ZO;f.ProtocolError=ZO("ProtocolError");f.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var o=Object.keys(this),s=o.length-1;s>-1;--s)if(t[o[s]]===1&&this[o[s]]!==void 0&&this[o[s]]!==null)return o[s]}};f.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};f.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};f._configure=function(){var r=f.Buffer;if(!r){f._Buffer_from=f._Buffer_allocUnsafe=null;return}f._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},f._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var E_=_((v3,nP)=>{"use strict";nP.exports=b;var xe=gt(),i_,yi=xe.LongBits,eP=xe.base64,tP=xe.utf8;function Dn(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function c_(){}function Lq(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function b(){this.len=0,this.head=new Dn(c_,0,0),this.tail=this.head,this.states=null}var rP=function(){return xe.Buffer?function(){return(b.create=function(){return new i_})()}:function(){return new b}};b.create=rP();b.alloc=function(e){return new xe.Array(e)};xe.Array!==Array&&(b.alloc=xe.pool(b.alloc,xe.Array.prototype.subarray));b.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Dn(e,t,n),this.len+=t,this};function u_(r,e,t){e[t]=r&255}function bq(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function __(r,e){this.len=r,this.next=void 0,this.val=e}__.prototype=Object.create(Dn.prototype);__.prototype.fn=bq;b.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new __((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};b.prototype.int32=function(e){return e<0?this._push(l_,10,yi.fromNumber(e)):this.uint32(e)};b.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function l_(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}b.prototype.uint64=function(e){var t=yi.from(e);return this._push(l_,t.length(),t)};b.prototype.int64=b.prototype.uint64;b.prototype.sint64=function(e){var t=yi.from(e).zzEncode();return this._push(l_,t.length(),t)};b.prototype.bool=function(e){return this._push(u_,1,e?1:0)};function a_(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}b.prototype.fixed32=function(e){return this._push(a_,4,e>>>0)};b.prototype.sfixed32=b.prototype.fixed32;b.prototype.fixed64=function(e){var t=yi.from(e);return this._push(a_,4,t.lo)._push(a_,4,t.hi)};b.prototype.sfixed64=b.prototype.fixed64;b.prototype.float=function(e){return this._push(xe.float.writeFloatLE,4,e)};b.prototype.double=function(e){return this._push(xe.float.writeDoubleLE,8,e)};var yq=xe.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var o=0;o<e.length;++o)t[n+o]=e[o]};b.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(u_,1,0);if(xe.isString(e)){var n=b.alloc(t=eP.length(e));eP.decode(e,n,0),e=n}return this.uint32(t)._push(yq,t,e)};b.prototype.string=function(e){var t=tP.length(e);return t?this.uint32(t)._push(tP.write,t,e):this._push(u_,1,0)};b.prototype.fork=function(){return this.states=new Lq(this),this.head=this.tail=new Dn(c_,0,0),this.len=0,this};b.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Dn(c_,0,0),this.len=0),this};b.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this};b.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t};b._configure=function(r){i_=r,b.create=rP(),i_._configure()}});var iP=_((x3,sP)=>{"use strict";sP.exports=tt;var oP=E_();(tt.prototype=Object.create(oP.prototype)).constructor=tt;var Rt=gt();function tt(){oP.call(this)}tt._configure=function(){tt.alloc=Rt._Buffer_allocUnsafe,tt.writeBytesBuffer=Rt.Buffer&&Rt.Buffer.prototype instanceof Uint8Array&&Rt.Buffer.prototype.set.name==="set"?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var o=0;o<e.length;)t[n++]=e[o++]}};tt.prototype.bytes=function(e){Rt.isString(e)&&(e=Rt._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(tt.writeBytesBuffer,t,e),this};function vq(r,e,t){r.length<40?Rt.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}tt.prototype.string=function(e){var t=Rt.Buffer.byteLength(e);return this.uint32(t),t&&this._push(vq,t,e),this};tt._configure()});var T_=_((D3,lP)=>{"use strict";lP.exports=X;var Be=gt(),d_,uP=Be.LongBits,xq=Be.utf8;function Ge(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function X(r){this.buf=r,this.pos=0,this.len=r.length}var aP=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new X(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new X(e);throw Error("illegal buffer")},_P=function(){return Be.Buffer?function(t){return(X.create=function(o){return Be.Buffer.isBuffer(o)?new d_(o):aP(o)})(t)}:aP};X.create=_P();X.prototype._slice=Be.Array.prototype.subarray||Be.Array.prototype.slice;X.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Ge(this,10);return e}}();X.prototype.int32=function(){return this.uint32()|0};X.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function p_(){var r=new uP(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Ge(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw Ge(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}X.prototype.bool=function(){return this.uint32()!==0};function vi(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}X.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return vi(this.buf,this.pos+=4)};X.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return vi(this.buf,this.pos+=4)|0};function cP(){if(this.pos+8>this.len)throw Ge(this,8);return new uP(vi(this.buf,this.pos+=4),vi(this.buf,this.pos+=4))}X.prototype.float=function(){if(this.pos+4>this.len)throw Ge(this,4);var e=Be.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};X.prototype.double=function(){if(this.pos+8>this.len)throw Ge(this,4);var e=Be.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};X.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Ge(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var o=Be.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};X.prototype.string=function(){var e=this.bytes();return xq.read(e,0,e.length)};X.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ge(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ge(this);while(this.buf[this.pos++]&128);return this};X.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};X._configure=function(r){d_=r,X.create=_P(),d_._configure();var e=Be.Long?"toLong":"toNumber";Be.merge(X.prototype,{int64:function(){return p_.call(this)[e](!1)},uint64:function(){return p_.call(this)[e](!0)},sint64:function(){return p_.call(this).zzDecode()[e](!1)},fixed64:function(){return cP.call(this)[e](!0)},sfixed64:function(){return cP.call(this)[e](!1)}})}});var TP=_((U3,dP)=>{"use strict";dP.exports=zt;var pP=T_();(zt.prototype=Object.create(pP.prototype)).constructor=zt;var EP=gt();function zt(r){pP.call(this,r)}zt._configure=function(){EP.Buffer&&(zt.prototype._slice=EP.Buffer.prototype.slice)};zt.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};zt._configure()});var fP=_((w3,SP)=>{"use strict";SP.exports=Un;var S_=gt();(Un.prototype=Object.create(S_.EventEmitter.prototype)).constructor=Un;function Un(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");S_.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Un.prototype.rpcCall=function r(e,t,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return S_.asPromise(r,i,e,t,n,o);if(!i.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return i.rpcImpl(e,t[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return i.emit("error",c,e),s(c);if(u===null){i.end(!0);return}if(!(u instanceof n))try{u=n[i.responseDelimited?"decodeDelimited":"decode"](u)}catch(l){return i.emit("error",l,e),s(l)}return i.emit("data",u,e),s(null,u)})}catch(a){i.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Un.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var hP=_(AP=>{"use strict";var Dq=AP;Dq.Service=fP()});var gP=_((B3,mP)=>{"use strict";mP.exports={}});var PP=_(OP=>{"use strict";var ge=OP;ge.build="minimal";ge.Writer=E_();ge.BufferWriter=iP();ge.Reader=T_();ge.BufferReader=TP();ge.util=gt();ge.rpc=hP();ge.roots=gP();ge.configure=RP;function RP(){ge.util._configure(),ge.Writer._configure(ge.BufferWriter),ge.Reader._configure(ge.BufferReader)}RP()});var NP=_((H3,MP)=>{"use strict";MP.exports=PP()});var H=Re(Gh(),1);m();un();var HP=Re(hg(),1),Kr=Re(sn(),1),FP=Re(Vg(),1),qP=Re(YR(),1),jP=Re(WR(),1),Ot=Re(y(),1);m();var aq=Symbol.for("@vercel/request-context");function be(){return globalThis[aq]?.get()}var zR="http.method",XR="http.url",Pi="http.host",QR="http.scheme",Ku="http.status_code",JR="http.user_agent",Wu="http.response_content_length_uncompressed",ZR="net.peer.port",eO="net.peer.name",tO="cloud.region";var rO="deployment.environment.name",nO="deployment.id",oO="cloud.provider",sO="process.runtime.name",iO="vcs.ref.head.name",aO="vcs.ref.head.revision",cO="vcs.repository.name",uO="vcs.repository.ref.revision";var _O="service.name",lO="service.version";function zu(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function pO({attributes:r,env:e=process.env,runtime:t,serviceName:n}){let o=e.VERCEL_ENV,s=e.VERCEL_DEPLOYMENT_ID,i=e.VERCEL_GIT_COMMIT_SHA,a=e.VERCEL_REGION,c=e.VERCEL_GIT_COMMIT_REF,u=e.VERCEL_GIT_REPO_SLUG;return zu({[_O]:n,"node.ci":e.CI?!0:void 0,"node.env":e.NODE_ENV,[rO]:o,env:o,[oO]:"vercel",[tO]:a,"vercel.region":a,[sO]:t,"vercel.runtime":t,[iO]:c,[aO]:i,[cO]:u,[uO]:i,"vercel.sha":i,"vercel.host":e.VERCEL_URL||void 0,"vercel.branch_host":e.VERCEL_BRANCH_URL||void 0,[nO]:s,"vercel.deployment_id":s,[lO]:s,"vercel.project_id":e.VERCEL_PROJECT_ID||void 0,...r})}function dO(r){return r?r.split("::").at(-1):void 0}function TO(r=be(),e){if(!r)return;let t=e?uq(e,r.headers):void 0;return zu({[Pi]:r.headers.host,[JR]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":dO(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":process.env.VERCEL_REGION,...t})}var cq={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function uq(r,e){if(typeof r=="function")return r(e,cq);let t={};for(let[n,o]of Object.entries(r)){let s=e[o.toLocaleLowerCase()];s!==void 0&&(t[n]=s)}return t}m();function Hr(r){return(r&E.TraceFlags.SAMPLED)!==0}var Mi=class{constructor(e,t){this.processors=e;this.attributesFromHeaders=t;this.rootSpanIds=new Map;this.waitSpanEnd=new Map}forceFlush(){return Promise.all(this.processors.map(e=>e.forceFlush().catch(t=>{E.diag.error("@vercel/otel: forceFlush failed:",t)}))).then(()=>{})}shutdown(){return Promise.all(this.processors.map(e=>e.shutdown().catch(()=>{}))).then(()=>{})}onStart(e,t){let{traceId:n,spanId:o,traceFlags:s}=e.spanContext(),i=!e.parentSpanContext?.spanId||!this.rootSpanIds.has(n);if(i?this.rootSpanIds.set(n,{rootSpanId:o,open:[]}):this.rootSpanIds.get(n)?.open.push(e),i&&Hr(s)){let a=be(),c=TO(a,this.attributesFromHeaders);c&&e.setAttributes(c),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let u=new Promise(p=>{this.waitSpanEnd.set(n,p)}),l;await Promise.race([u,new Promise(p=>{l=setTimeout(()=>{this.waitSpanEnd.delete(n),p(void 0)},50)})]),l&&clearTimeout(l)}return this.forceFlush()})}for(let a of this.processors)a.onStart(e,t)}onEnd(e){let{traceId:t,spanId:n,traceFlags:o}=e.spanContext(),s=Hr(o),i=this.rootSpanIds.get(t),a=i?.rootSpanId===n;if(s){let c=lq(e);c&&Object.assign(e.attributes,c)}if(a){if(this.rootSpanIds.delete(t),i.open.length>0){for(let c of i.open)if(!c.ended&&c.spanContext().spanId!==n)try{c.end()}catch(u){E.diag.error("@vercel/otel: onEnd failed:",u)}}}else if(i)for(let c=0;c<i.open.length;c++)i.open[c]?.spanContext().spanId===n&&i.open.splice(c,1);for(let c of this.processors)c.onEnd(e);if(a){let c=this.waitSpanEnd.get(t);c&&(this.waitSpanEnd.delete(t),c())}}},_q={[E.SpanKind.INTERNAL]:"internal",[E.SpanKind.SERVER]:"server",[E.SpanKind.CLIENT]:"client",[E.SpanKind.PRODUCER]:"producer",[E.SpanKind.CONSUMER]:"consumer"};function lq(r){let{kind:e,attributes:t}=r,{"operation.name":n,"resource.name":o,"span.type":s,"next.span_type":i,"http.method":a,"http.route":c}=t;if(n)return;let u=o??(a&&typeof a=="string"&&c&&typeof c=="string"?`${a} ${c}`:c);if(r.kind===E.SpanKind.SERVER&&a&&c&&typeof a=="string"&&typeof c=="string")return{"operation.name":"web.request","resource.name":u};let l=r.instrumentationScope.name,p=i??s;if(p&&typeof p=="string"){let T=SO(l,p);return c?{"operation.name":T,"resource.name":u}:{"operation.name":T}}return{"operation.name":SO(l,e===E.SpanKind.INTERNAL?"":_q[e])}}function SO(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var LO=Re(r_(),1);m();var Fr=class{constructor(e={}){this._shutdownOnce={isCalled:!1};this._sendingPromises=[];this.url=e.url||this.getDefaultUrl(e),e.headers&&(this._headers=e.headers),this.onInit()}onShutdown(){E.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){E.diag.debug("@vercel/otel/otlp: onInit")}export(e,t){if(this._shutdownOnce.isCalled){E.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}this.send(e,()=>t({code:0}),n=>t({code:1,error:n}))}async forceFlush(){await Promise.all(this._sendingPromises)}async shutdown(){this._shutdownOnce.isCalled=!0,this.onShutdown(),await this.forceFlush()}send(e,t,n){if(this._shutdownOnce.isCalled){E.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}let o=this.convert(e),s,i,a;try{({body:s,contentType:i,headers:a}=this.toMessage(o))}catch(u){E.diag.warn("@vercel/otel/otlp: no proto",u);return}let c=fetch(this.url,{method:"POST",body:s,headers:{...this._headers,...a,"Content-Type":i,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(u=>{E.diag.debug("@vercel/otel/otlp: onSuccess",u.status,u.statusText),t(),u.arrayBuffer().catch(()=>{})}).catch(u=>{E.diag.error("@vercel/otel/otlp: onError",u),n(u)}).finally(()=>{let u=this._sendingPromises.indexOf(c);this._sendingPromises.splice(u,1)});this._sendingPromises.push(c)}};var Pq="v1/traces",Mq=`http://localhost:4318/${Pq}`;function Ii(r){return typeof r.url=="string"?r.url:Mq}var qr=class{constructor(e={}){this.impl=new n_(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},n_=class extends Fr{convert(e){return e}toMessage(e){let t=LO.JsonTraceSerializer.serializeRequest(e);return{body:new TextDecoder().decode(t),contentType:"application/json"}}getDefaultUrl(e){return Ii(e)}};var bP=Re(t_(),1);var CP=Re(NP(),1);function IP(r){let e=new CP.Writer;return Uq(r,e),e.finish()}function Uq(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)wq(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function wq(r,e){if(r.resource!=null&&Vq(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)Bq(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function Vq(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function Bq(r,e){if(r.scope!=null&&Fq(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)qq(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function kr(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&LP(r.value,e.uint32(18).fork()).ldelim(),e}function LP(r,e){return r.stringValue!=null&&e.uint32(10).string(r.stringValue),r.boolValue!=null&&e.uint32(16).bool(r.boolValue),r.intValue!=null&&e.uint32(24).int64(r.intValue),r.doubleValue!=null&&e.uint32(33).double(r.doubleValue),r.arrayValue!=null&&Gq(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&Hq(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function Gq(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)LP(r.values[t],e.uint32(10).fork()).ldelim();return e}function Hq(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)kr(r.values[t],e.uint32(10).fork()).ldelim();return e}function Fq(r,e){if(r.name!=null&&e.uint32(10).string(r.name),r.version!=null&&e.uint32(18).string(r.version),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function qq(r,e){if(r.traceId!=null&&e.uint32(10).bytes(r.traceId),r.spanId!=null&&e.uint32(18).bytes(r.spanId),r.traceState!=null&&e.uint32(26).string(r.traceState),r.parentSpanId!=null&&e.uint32(34).bytes(r.parentSpanId),r.name!=null&&e.uint32(42).string(r.name),r.kind!=null&&e.uint32(48).int32(r.kind),r.startTimeUnixNano!=null&&e.uint32(57).fixed64(r.startTimeUnixNano),r.endTimeUnixNano!=null&&e.uint32(65).fixed64(r.endTimeUnixNano),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(74).fork()).ldelim();if(r.droppedAttributesCount!=null&&e.uint32(80).uint32(r.droppedAttributesCount),r.events!=null&&r.events.length)for(let t=0;t<r.events.length;++t)kq(r.events[t],e.uint32(90).fork()).ldelim();if(r.droppedEventsCount!=null&&e.uint32(96).uint32(r.droppedEventsCount),r.links!=null&&r.links.length)for(let t=0;t<r.links.length;++t)Yq(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&jq(r.status,e.uint32(122).fork()).ldelim(),e}function jq(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function kq(r,e){if(r.timeUnixNano!=null&&e.uint32(9).fixed64(r.timeUnixNano),r.name!=null&&e.uint32(18).string(r.name),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function Yq(r,e){if(r.traceId!=null&&e.uint32(10).bytes(r.traceId),r.spanId!=null&&e.uint32(18).bytes(r.spanId),r.traceState!=null&&e.uint32(26).string(r.traceState),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var Xt=class{constructor(e={}){this.impl=new f_(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},f_=class extends Fr{convert(e){return(0,bP.createExportTraceServiceRequest)(e)}toMessage(e){return{body:IP(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Ii(e)}};m();function yP(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let o=e[n];return o!==void 0?String(o):t})}var Yr=class{constructor(e={}){this.instrumentationName="@vercel/otel/fetch";this.instrumentationVersion="1.0.0";this.config=e}getConfig(){return this.config}setConfig(){}setTracerProvider(e){this.tracerProvider=e}setMeterProvider(){}shouldIgnore(e,t){let n=this.config.ignoreUrls??[];if(t?.opentelemetry?.ignore!==void 0)return t.opentelemetry.ignore;if(n.length===0)return!1;let o=e.toString();return n.some(s=>typeof s=="string"?s==="*"?!0:o.startsWith(s):s.test(o))}shouldPropagate(e,t){let n=process.env.VERCEL_URL||null,o=process.env.VERCEL_BRANCH_URL||null,s=this.config.propagateContextUrls??[],i=this.config.dontPropagateContextUrls??[];if(t?.opentelemetry?.propagateContext)return t.opentelemetry.propagateContext;let a=e.toString();return i.length>0&&i.some(c=>typeof c=="string"?c==="*"?!0:a.startsWith(c):c.test(a))?!1:n&&e.protocol==="https:"&&(e.host===n||e.host===o||e.host===be()?.headers.host)||!n&&e.protocol==="http:"&&e.hostname==="localhost"?!0:s.some(c=>typeof c=="string"?c==="*"?!0:a.startsWith(c):c.test(a))}startSpan({tracer:e,url:t,fetchType:n,method:o="GET",name:s,attributes:i={}}){let a=this.config.resourceNameTemplate,c={[zR]:o,[XR]:t.toString(),[Pi]:t.host,[QR]:t.protocol.replace(":",""),[eO]:t.hostname,[ZR]:t.port},u=a?yP(a,c):Wq(t.toString()),l=s??`${n} ${o} ${t.toString()}`,p=E.context.active();return e.startSpan(l,{kind:E.SpanKind.CLIENT,attributes:{...c,"operation.name":`${n}.${o}`,"http.client.name":n,"resource.name":u,...i}},p)}instrumentHttp(e,t){let{tracerProvider:n}=this;if(!n)return;let o=n.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:s,attributesFromResponseHeaders:i}=this.config,a=e.request,u=(l=>(p,T,A)=>{let M,g={},O;if(typeof p=="string"||p instanceof URL?(M=new URL(p.toString()),typeof T=="function"?O=T:T&&typeof A=="function"?(g=T,O=A):T&&(g=T)):(g=p,typeof T=="function"&&(O=T),M=Xq(g,t)),this.shouldIgnore(M))return l.apply(this,[M,g,O]);let P=this.startSpan({tracer:o,url:M,fetchType:"http",method:g.method||"GET"});if(!P.isRecording()||!Hr(P.spanContext().traceFlags))return P.end(),l.apply(this,[M,g,O]);if(this.shouldPropagate(M)){let F=E.context.active(),$=E.trace.setSpan(F,P);E.propagation.inject($,g.headers||{},Kq)}s&&xi(P,s,g.headers||{},xP);try{let F=Date.now(),$=l.apply(this,[M,g,O]);return $.prependListener("response",V=>{let rt=Date.now()-F;P.setAttribute("http.response_time",rt),V.statusCode!==void 0?(P.setAttribute(Ku,V.statusCode),V.statusCode>=500&&Qt(P,`Status: ${V.statusCode}`)):Qt(P,"Response status code is undefined"),i&&xi(P,i,V.headers,xP),$.listenerCount("response")<=1&&V.resume(),V.on("end",()=>{let ee,I=V.statusCode;V.aborted&&!V.complete?ee={code:E.SpanStatusCode.ERROR}:I&&I>=100&&I<500?ee={code:E.SpanStatusCode.UNSET}:ee={code:E.SpanStatusCode.ERROR},P.setStatus(ee),P.isRecording()&&(V.headers["content-length"]&&P.setAttribute(Wu,V.headers["content-length"]),P.end())})}),$.on("error",V=>{P.isRecording()&&(Qt(P,V),P.end())}),$.on("close",()=>{P.isRecording()&&P.end()}),$}catch(F){throw Qt(P,F),P.end(),F}})(a);e.request=u,e.get=(...l)=>{let p=u(...l);return p.end(),p}}instrumentFetch(){let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:n,attributesFromResponseHeaders:o}=this.config;process.env.NEXT_OTEL_FETCH_DISABLED="1";let s=globalThis.fetch;this.originalFetch=s;let i=async(a,c)=>{let u=c;if(u?.next?.internal)return s(a,u);let l=new Request(a instanceof Request?a.clone():a,u),p=new URL(l.url);if(this.shouldIgnore(p,u))return s(a,u);let T=this.startSpan({tracer:t,url:p,fetchType:"fetch",method:l.method,name:u?.opentelemetry?.spanName,attributes:u?.opentelemetry?.attributes});if(!T.isRecording()||!Hr(T.spanContext().traceFlags))return T.end(),s(a,u);if(this.shouldPropagate(p,u)){let A=E.context.active(),M=E.trace.setSpan(A,T);E.propagation.inject(M,l.headers,$q)}n&&xi(T,n,l.headers,vP);try{let A=Date.now();u?.body&&u.body instanceof FormData&&l.headers.delete("content-type");let M=await s(a,{...u,headers:l.headers}),g=Date.now()-A;return T.setAttribute(Ku,M.status),T.setAttribute("http.response_time",g),o&&xi(T,o,M.headers,vP),M.status>=500&&Qt(T,`Status: ${M.status} (${M.statusText})`),M.body?zq(M).then(O=>{T.isRecording()&&(T.setAttribute(Wu,O),T.end())},O=>{T.isRecording()&&(Qt(T,O),T.end())}):T.end(),M}catch(A){throw Qt(T,A),T.end(),A}};globalThis.fetch=i}enable(){this.disable(),this.instrumentFetch();try{let e=N("node:http"),t=N("node:https");this.instrumentHttp(e,"http:"),this.instrumentHttp(t,"https:")}catch{}}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},$q={set(r,e,t){r.set(e,t)}},vP={get(r,e){let t=r.get(e);if(t!==null)return t.includes(",")?t.split(",").map(n=>n.trimStart()):t},keys(r){let e=[];return r.forEach((t,n)=>{e.push(n)}),e}},Kq={set(r,e,t){r[e.toLowerCase()]=t}},xP={get(r,e){return r[e.toLowerCase()]},keys(r){return Object.keys(r)}};function Wq(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function zq(r){let e=0,n=r.clone().body?.getReader();if(!n)return Promise.resolve(0);let o=()=>n.read().then(({done:s,value:i})=>{if(!s)return e+=i.byteLength,o()});return o().then(()=>e)}function Qt(r,e){if(e instanceof Error)r.recordException(e),r.setStatus({code:E.SpanStatusCode.ERROR,message:e.message});else{let t=String(e);r.setStatus({code:E.SpanStatusCode.ERROR,message:t})}}function xi(r,e,t,n){for(let[o,s]of Object.entries(e)){let i=n.get(t,s);i!==void 0&&r.setAttribute(o,i)}}function Xq(r,e){if(r.socketPath)throw new Error("Cannot construct a network URL: options.socketPath is specified, indicating a Unix domain socket.");let t=r.protocol??e;t&&!t.endsWith(":")&&(t+=":");let n=r.hostname,o=r.port??r.defaultPort;if(!n&&r.host){let u=r.host.split(":");n=u[0];let l=u[1];if(u.length>1&&l&&o===void 0){let p=parseInt(l,10);isNaN(p)||(o=p)}}n||(n="localhost");let s;if(o!==void 0&&o!==""){let u=parseInt(String(o),10);isNaN(u)?s=t==="https:"?443:80:s=u}else s=t==="https:"?443:80;let i=r.path||"/",a=`${t}//${n}:${s}`,c=new URL(i,a);if(r.auth){let u=r.auth.split(":");c.username=decodeURIComponent(u[0]||""),u.length>1&&(c.password=decodeURIComponent(u[1]||""))}return c}m();var DP=Re(y(),1),Qq="00",A_="traceparent",h_="tracestate",wn=class{fields(){return[A_,h_]}inject(e,t,n){let o=E.trace.getSpanContext(e);if(!o||(0,DP.isTracingSuppressed)(e)||!(0,E.isSpanContextValid)(o))return;let s=`${Qq}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||0).toString(16)}`;n.set(t,A_,s),o.traceState&&n.set(t,h_,o.traceState.serialize())}extract(e,t,n){let o=n.get(t,A_);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Jq(s);if(!i)return e;i.isRemote=!0;let a=n.get(t,h_);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=(0,E.createTraceState)(typeof c=="string"?c:void 0)}return E.trace.setSpanContext(e,i)}};function Jq(r){let[e,t,n,o,s]=r.split("-");return!e||!t||!n||!o||e.length!==2||t.length!==32||n.length!==16||o.length!==2||e==="00"&&s?null:{traceId:t,spanId:n,traceFlags:parseInt(o,16)}}m();var Di=class{fields(){return[]}inject(){}extract(e){let t=be();if(!t?.telemetry)return E.diag.warn("@vercel/otel: Vercel telemetry extension not found."),e;let{rootSpanContext:n}=t.telemetry;return n?(E.diag.debug("@vercel/otel: Extracted root SpanContext from Vercel request context.",n),E.trace.setSpanContext(e,{...n,isRemote:!0,traceFlags:n.traceFlags||E.TraceFlags.SAMPLED})):e}};m();var Ui=Re(y(),1),UP=Re(r_(),1);var wi=class{export(e,t){let n=be();if(!n?.telemetry){E.diag.warn("@vercel/otel: no telemetry context found"),t({code:Ui.ExportResultCode.SUCCESS,error:void 0});return}try{let o=UP.JsonTraceSerializer.serializeRequest(e);if(!o)throw new Error("Failed to serialize spans");let s=JSON.parse(new TextDecoder().decode(o));n.telemetry.reportSpans(s),t({code:Ui.ExportResultCode.SUCCESS,error:void 0})}catch(o){t({code:Ui.ExportResultCode.FAILED,error:o instanceof Error?o:new Error(String(o))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};function De(r){let e=process.env[r];if(!(!e||e.trim()===""))return e}function wP(r){return De(r)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}m();function m_(){return!!be()?.telemetry?.traceDrains?.length}var VP=!1,Vn=class{constructor(e){this.processor=e}forceFlush(){return this.processor.forceFlush()}shutdown(){return this.processor.shutdown()}onStart(e,t){if(m_()){VP||(VP=!0,E.diag.debug("@vercel/otel: skipping automatic exporter due to configured trace drains"));return}this.processor.onStart(e,t)}onEnd(e){m_()||this.processor.onEnd(e)}};var Zq={ALL:E.DiagLogLevel.ALL,VERBOSE:E.DiagLogLevel.VERBOSE,DEBUG:E.DiagLogLevel.DEBUG,INFO:E.DiagLogLevel.INFO,WARN:E.DiagLogLevel.WARN,ERROR:E.DiagLogLevel.ERROR,NONE:E.DiagLogLevel.NONE},Vi=class{constructor(e={}){this.configuration=e}start(){let e=e2(),t=this.configuration,n=process.env.NEXT_RUNTIME||"nodejs",o=!!e.OTEL_SDK_DISABLED;if(process.env.OTEL_LOG_LEVEL&&E.diag.setLogger(new E.DiagConsoleLogger,{logLevel:Zq[process.env.OTEL_LOG_LEVEL.toUpperCase()]}),o)return;let s=t.idGenerator??new H.RandomIdGenerator;this.contextManager=u2(t.contextManager);let i=e.OTEL_SERVICE_NAME||t.serviceName||"app",a=(0,Kr.resourceFromAttributes)(pO({attributes:t.attributes,runtime:n,serviceName:i})),c=t.resourceDetectors??[Kr.envDetector];if(t.autoDetectResources??!0){let P=(0,Kr.detectResources)({detectors:c});a=a.merge(P)}let l=r2(t.propagators,t,e),p=n2(t.traceSampler,e),T=o2(t.spanProcessors,t,e);T.length===0&&E.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let A=t.spanLimits,M=new H.BasicTracerProvider({resource:a,idGenerator:s,sampler:p,spanLimits:A,spanProcessors:[new Mi(T,t.attributesFromHeaders)]});if(E.trace.setGlobalTracerProvider(M),E.propagation.setGlobalPropagator(new Ot.CompositePropagator({propagators:l})),this.tracerProvider=M,t.logRecordProcessors){let O=new FP.LoggerProvider({resource:a,processors:t.logRecordProcessors});this.loggerProvider=O,at.logs.setGlobalLoggerProvider(O)}if(t.metricReaders||t.views){let O=new qP.MeterProvider({resource:a,views:t.views??[],readers:t.metricReaders??[]});E.metrics.setGlobalMeterProvider(O),this.meterProvider=O}let g=t2(t.instrumentations,t.instrumentationConfig);this.disableInstrumentations=(0,HP.registerInstrumentations)({instrumentations:g}),E.diag.info("@vercel/otel: started",i,n)}async shutdown(){let e=[];this.tracerProvider&&e.push(this.tracerProvider.shutdown()),this.loggerProvider&&e.push(this.loggerProvider.shutdown()),this.meterProvider&&e.push(this.meterProvider.shutdown()),E.diag.info("@vercel/otel: shutting down",e.length,process.env.NEXT_RUNTIME),await Promise.all(e),this.contextManager&&this.contextManager.disable();let{disableInstrumentations:t}=this;t&&t()}};function e2(){return{OTEL_SDK_DISABLED:De("OTEL_SDK_DISABLED"),OTEL_SERVICE_NAME:De("OTEL_SERVICE_NAME"),OTEL_PROPAGATORS:wP("OTEL_PROPAGATORS"),OTEL_TRACES_SAMPLER:De("OTEL_TRACES_SAMPLER"),OTEL_TRACES_SAMPLER_ARG:De("OTEL_TRACES_SAMPLER_ARG"),OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:De("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"),OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:De("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL"),OTEL_EXPORTER_OTLP_PROTOCOL:De("OTEL_EXPORTER_OTLP_PROTOCOL"),OTEL_EXPORTER_OTLP_ENDPOINT:De("OTEL_EXPORTER_OTLP_ENDPOINT"),OTEL_EXPORTER_OTLP_HEADERS:De("OTEL_EXPORTER_OTLP_HEADERS"),OTEL_EXPORTER_OTLP_TRACES_HEADERS:De("OTEL_EXPORTER_OTLP_TRACES_HEADERS")}}function t2(r,e){return(r??["auto"]).map(t=>t==="auto"?(E.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new Yr(e?.fetch)]):t==="fetch"?(E.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new Yr(e?.fetch)):t).flat()}function r2(r,e,t){let n=process.env.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS.length>0?t.OTEL_PROPAGATORS:void 0;return(r??n??["auto"]).map(o=>{if(o==="none")return[];if(o==="auto"){let s=[];return s.push({name:"tracecontext",propagator:new wn}),s.push({name:"baggage",propagator:new Ot.W3CBaggagePropagator}),s.push({name:"vercel-runtime",propagator:new Di}),E.diag.debug(`@vercel/otel: Configure propagators: ${s.map(i=>i.name).join(", ")}`),s.map(i=>i.propagator)}if(o==="tracecontext")return E.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new wn;if(o==="baggage")return E.diag.debug("@vercel/otel: Configure propagator: baggage"),new Ot.W3CBaggagePropagator;if(typeof o=="string")throw new Error(`Unknown propagator: "${o}"`);return o}).flat()}var BP="always_on",$r=1;function n2(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||BP;switch(E.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new H.AlwaysOnSampler;case"always_off":return new H.AlwaysOffSampler;case"parentbased_always_on":return new H.ParentBasedSampler({root:new H.AlwaysOnSampler});case"parentbased_always_off":return new H.ParentBasedSampler({root:new H.AlwaysOffSampler});case"traceidratio":return new H.TraceIdRatioBasedSampler(GP(e));case"parentbased_traceidratio":return new H.ParentBasedSampler({root:new H.TraceIdRatioBasedSampler(GP(e))});default:return E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${BP}".`),new H.AlwaysOnSampler}}function GP(r){if(r.OTEL_TRACES_SAMPLER_ARG===void 0||r.OTEL_TRACES_SAMPLER_ARG==="")return E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$r}.`),$r;E.diag.debug("@vercel/otel: Configure sampler probability: ",r.OTEL_TRACES_SAMPLER_ARG);let e=Number(r.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${$r}.`),$r):e<0||e>1?(E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${$r}.`),$r):e}function o2(r,e,t){return[...(r??["auto"]).flatMap(n=>{if(n==="auto"){let o=[new H.BatchSpanProcessor(new wi)];if(process.env.VERCEL_OTEL_ENDPOINTS){let s=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",i=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";E.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",s,i);let a={url:`http://localhost:${s}/v1/traces`,headers:{}},c=i==="http/protobuf"?new Xt(a):new qr(a);o.push(new Vn(new H.BatchSpanProcessor(c)))}else(!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT)&&o.push(new Vn(new H.BatchSpanProcessor(s2(t))));return o}return n}).filter(c2),...e.traceExporter&&e.traceExporter!=="auto"?[new H.BatchSpanProcessor(e.traceExporter)]:[]]}function s2(r){let e=r.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??r.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=a2(r),n={...r.OTEL_EXPORTER_OTLP_HEADERS?(0,Ot.parseKeyPairsIntoRecord)(r.OTEL_EXPORTER_OTLP_HEADERS):{},...r.OTEL_EXPORTER_OTLP_TRACES_HEADERS?(0,Ot.parseKeyPairsIntoRecord)(r.OTEL_EXPORTER_OTLP_TRACES_HEADERS):{}};switch(E.diag.debug("@vercel/otel: Configure trace exporter: ",e,t,`headers: ${Object.keys(n).join(",")||"<none>"}`),e){case"http/json":return new qr({url:t,headers:n});case"http/protobuf":return new Xt({url:t,headers:n});default:return E.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new Xt}}var kP="v1/traces",i2=`http://localhost:4318/${kP}`;function a2(r){let e=r.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;if(e&&typeof e=="string")return e;let t=r.OTEL_EXPORTER_OTLP_ENDPOINT;return t&&typeof t=="string"?`${t}/${kP}`:i2}function c2(r){return r!=null}function u2(r){if(r===void 0){E.diag.debug("@vercel/otel: Configure context manager: default");let e=new jP.AsyncLocalStorageContextManager;return e.enable(),E.context.setGlobalContextManager(e),e}return E.diag.debug("@vercel/otel: Configure context manager: from configuration"),r.enable(),E.context.setGlobalContextManager(r),r}function N8(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new Vi(e).start()}export{Yr as FetchInstrumentation,qr as OTLPHttpJsonTraceExporter,Xt as OTLPHttpProtoTraceExporter,N8 as registerOTel};
|
|
24
24
|
//# sourceMappingURL=index.js.map
|