@vercel/otel 1.13.0 → 1.13.1
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 +1 -1
- package/dist/edge/index.js.map +2 -2
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +2 -2
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -17,5 +17,5 @@ var _f=Object.create;var js=Object.defineProperty;var pf=Object.getOwnPropertyDe
|
|
|
17
17
|
To resolve the conflict:`,(0,is.getConflictResolutionRecipe)(s,e))),n=i):j_.diag.warn("A view or instrument with the name ",e.name,` has already been registered and is incompatible with another registered view.
|
|
18
18
|
`,`Details:
|
|
19
19
|
`,(0,is.getIncompatibilityDetails)(s,e),`To resolve the conflict:
|
|
20
|
-
`,(0,is.getConflictResolutionRecipe)(s,e))}return n}};ss.MetricStorageRegistry=fu});var k_=l(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.MultiMetricStorage=void 0;var Eu=class{constructor(e){this._backingStorages=e}record(e,t,n,i){this._backingStorages.forEach(s=>{s.record(e,t,n,i)})}};os.MultiMetricStorage=Eu});var X_=l(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.BatchObservableResultImpl=Zt.ObservableResultImpl=void 0;var Qt=(h(),m(d)),$_=wr(),MS=Qi(),mu=class{constructor(e,t){this._instrumentName=e,this._valueType=t,this._buffer=new $_.AttributeHashMap}observe(e,t={}){if(typeof e!="number"){Qt.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===Qt.ValueType.INT&&!Number.isInteger(e)&&(Qt.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)}};Zt.ObservableResultImpl=mu;var gu=class{constructor(){this._buffer=new Map}observe(e,t,n={}){if(!(0,MS.isObservableInstrument)(e))return;let i=this._buffer.get(e);if(i==null&&(i=new $_.AttributeHashMap,this._buffer.set(e,i)),typeof t!="number"){Qt.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===Qt.ValueType.INT&&!Number.isInteger(t)&&(Qt.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))||i.set(n,t)}};Zt.BatchObservableResultImpl=gu});var z_=l(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.ObservableRegistry=void 0;var NS=(h(),m(d)),W_=Qi(),K_=X_(),xr=fe(),Tu=class{constructor(){this._callbacks=[],this._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(W_.isObservableInstrument));if(n.size===0){NS.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(W_.isObservableInstrument)),i=this._findBatchCallback(e,n);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let n=this._observeCallbacks(e,t),i=this._observeBatchCallbacks(e,t);return(await(0,xr.PromiseAllSettled)([...n,...i])).filter(xr.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:i})=>{let s=new K_.ObservableResultImpl(i._descriptor.name,i._descriptor.valueType),o=Promise.resolve(n(s));t!=null&&(o=(0,xr.callWithTimeout)(o,t)),await o,i._metricStorages.forEach(a=>{a.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:i})=>{let s=new K_.BatchObservableResultImpl,o=Promise.resolve(n(s));t!=null&&(o=(0,xr.callWithTimeout)(o,t)),await o,i.forEach(a=>{let u=s._buffer.get(a);u!=null&&a._metricStorages.forEach(c=>{c.record(u,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,xr.setEquals)(n.instruments,t))}};as.ObservableRegistry=Tu});var Y_=l(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.SyncMetricStorage=void 0;var CS=au(),wS=du(),xS=pu(),Su=class extends CS.MetricStorage{constructor(e,t,n,i){super(e),this._attributesProcessor=n,this._deltaMetricStorage=new wS.DeltaMetricProcessor(t),this._temporalMetricStorage=new xS.TemporalMetricProcessor(t,i)}record(e,t,n,i){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,i)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};us.SyncMetricStorage=Su});var Ou=l(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.FilteringAttributesProcessor=we.NoopAttributesProcessor=we.AttributesProcessor=void 0;var Dr=class{static Noop(){return DS}};we.AttributesProcessor=Dr;var cs=class extends Dr{process(e,t){return e}};we.NoopAttributesProcessor=cs;var Au=class extends Dr{constructor(e){super(),this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(i=>this._allowedAttributeNames.includes(i)).forEach(i=>n[i]=e[i]),n}};we.FilteringAttributesProcessor=Au;var DS=new cs});var Q_=l(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.MeterSharedState=void 0;var US=be(),BS=D_(),qS=fe(),GS=U_(),VS=F_(),HS=k_(),jS=z_(),FS=Y_(),kS=Ou(),Ru=class{constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.metricStorageRegistry=new VS.MetricStorageRegistry,this.observableRegistry=new jS.ObservableRegistry,this.meter=new BS.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,FS.SyncMetricStorage);return t.length===1?t[0]:new HS.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,GS.AsyncMetricStorage)}async collect(e,t,n){let i=await this.observableRegistry.observe(t,n?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(s.length===0)return null;let o=s.map(a=>a.collect(e,t)).filter(qS.isNotNullish);return o.length===0?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:o},errors:i}}_registerMetricStorage(e,t){let i=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(s=>{let o=(0,US.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(o);if(a!=null)return a;let u=s.aggregation.createAggregator(o),c=new t(o,u,s.attributesProcessor,this._meterProviderSharedState.metricCollectors);return this.metricStorageRegistry.register(c),c});if(i.length===0){let o=this._meterProviderSharedState.selectAggregations(e.type).map(([a,u])=>{let c=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(c!=null)return c;let _=u.createAggregator(e),p=new t(e,_,kS.AttributesProcessor.Noop(),[a]);return this.metricStorageRegistry.registerForCollector(a,p),p});i=i.concat(o)}return i}};ls.MeterSharedState=Ru});var Z_=l(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.MeterProviderSharedState=void 0;var $S=fe(),XS=x_(),WS=Q_(),bu=class{constructor(e){this.resource=e,this.viewRegistry=new XS.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(e){let t=(0,$S.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new WS.MeterSharedState(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,n.selectAggregation(e)]);return t}};ds.MeterProviderSharedState=bu});var J_=l(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.MetricCollector=void 0;var KS=A(),Pu=class{constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,KS.millisToHrTime)(Date.now()),n=[],i=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async o=>{let a=await o.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&i.push(...a.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:i}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}};_s.MetricCollector=Pu});var tp=l(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.MeterProvider=void 0;var ps=(h(),m(d)),ep=rt(),zS=Z_(),YS=J_(),yu=class{constructor(e){var t;this._shutdown=!1;let n=ep.Resource.default().merge((t=e?.resource)!==null&&t!==void 0?t:ep.Resource.empty());if(this._sharedState=new zS.MeterProviderSharedState(n),e?.views!=null&&e.views.length>0)for(let i of e.views)this._sharedState.viewRegistry.addView(i)}getMeter(e,t="",n={}){return this._shutdown?(ps.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,ps.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}addMetricReader(e){let t=new YS.MetricCollector(this._sharedState,e);e.setMetricProducer(t),this._sharedState.metricCollectors.push(t)}async shutdown(e){if(this._shutdown){ps.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){ps.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};hs.MeterProvider=yu});var fs=l(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.ExactPredicate=Jt.PatternPredicate=void 0;var QS=/[\^$\\.+?()[\]{}|]/g,vu=class r{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(QS,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};Jt.PatternPredicate=vu;var Iu=class{constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};Jt.ExactPredicate=Iu});var np=l(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.InstrumentSelector=void 0;var rp=fs(),Lu=class{constructor(e){var t;this._nameFilter=new rp.PatternPredicate((t=e?.name)!==null&&t!==void 0?t:"*"),this._type=e?.type,this._unitFilter=new rp.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};Es.InstrumentSelector=Lu});var ip=l(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.MeterSelector=void 0;var Mu=fs(),Nu=class{constructor(e){this._nameFilter=new Mu.ExactPredicate(e?.name),this._versionFilter=new Mu.ExactPredicate(e?.version),this._schemaUrlFilter=new Mu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};ms.MeterSelector=Nu});var op=l(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.View=void 0;var ZS=fs(),sp=Ou(),JS=np(),eA=ip(),tA=Fi();function rA(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}var Cu=class{constructor(e){var t;if(rA(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||ZS.PatternPredicate.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");e.attributeKeys!=null?this.attributesProcessor=new sp.FilteringAttributesProcessor(e.attributeKeys):this.attributesProcessor=sp.AttributesProcessor.Noop(),this.name=e.name,this.description=e.description,this.aggregation=(t=e.aggregation)!==null&&t!==void 0?t:tA.Aggregation.Default(),this.instrumentSelector=new JS.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new eA.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl})}};gs.View=Cu});var wu=l(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.TimeoutError=g.View=g.Aggregation=g.SumAggregation=g.LastValueAggregation=g.HistogramAggregation=g.DropAggregation=g.ExponentialHistogramAggregation=g.ExplicitBucketHistogramAggregation=g.DefaultAggregation=g.MeterProvider=g.InstrumentType=g.ConsoleMetricExporter=g.InMemoryMetricExporter=g.PeriodicExportingMetricReader=g.MetricReader=g.DataPointType=g.AggregationTemporality=void 0;var nA=Li();Object.defineProperty(g,"AggregationTemporality",{enumerable:!0,get:function(){return nA.AggregationTemporality}});var iA=wt();Object.defineProperty(g,"DataPointType",{enumerable:!0,get:function(){return iA.DataPointType}});var sA=Ka();Object.defineProperty(g,"MetricReader",{enumerable:!0,get:function(){return sA.MetricReader}});var oA=L_();Object.defineProperty(g,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return oA.PeriodicExportingMetricReader}});var aA=N_();Object.defineProperty(g,"InMemoryMetricExporter",{enumerable:!0,get:function(){return aA.InMemoryMetricExporter}});var uA=w_();Object.defineProperty(g,"ConsoleMetricExporter",{enumerable:!0,get:function(){return uA.ConsoleMetricExporter}});var cA=be();Object.defineProperty(g,"InstrumentType",{enumerable:!0,get:function(){return cA.InstrumentType}});var lA=tp();Object.defineProperty(g,"MeterProvider",{enumerable:!0,get:function(){return lA.MeterProvider}});var xe=Fi();Object.defineProperty(g,"DefaultAggregation",{enumerable:!0,get:function(){return xe.DefaultAggregation}});Object.defineProperty(g,"ExplicitBucketHistogramAggregation",{enumerable:!0,get:function(){return xe.ExplicitBucketHistogramAggregation}});Object.defineProperty(g,"ExponentialHistogramAggregation",{enumerable:!0,get:function(){return xe.ExponentialHistogramAggregation}});Object.defineProperty(g,"DropAggregation",{enumerable:!0,get:function(){return xe.DropAggregation}});Object.defineProperty(g,"HistogramAggregation",{enumerable:!0,get:function(){return xe.HistogramAggregation}});Object.defineProperty(g,"LastValueAggregation",{enumerable:!0,get:function(){return xe.LastValueAggregation}});Object.defineProperty(g,"SumAggregation",{enumerable:!0,get:function(){return xe.SumAggregation}});Object.defineProperty(g,"Aggregation",{enumerable:!0,get:function(){return xe.Aggregation}});var dA=op();Object.defineProperty(g,"View",{enumerable:!0,get:function(){return dA.View}});var _A=fe();Object.defineProperty(g,"TimeoutError",{enumerable:!0,get:function(){return _A.TimeoutError}})});var ap=l(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.AbstractAsyncHooksContextManager=void 0;var pA=z("events"),hA=["addListener","on","once","prependListener","prependOnceListener"],xu=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(e,t){return t instanceof pA.EventEmitter?this._bindEventEmitter(e,t):typeof t=="function"?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,i=function(...s){return n.with(e,()=>t.apply(this,s))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),i}_bindEventEmitter(e,t){return this._getPatchMap(t)!==void 0||(this._createPatchMap(t),hA.forEach(i=>{t[i]!==void 0&&(t[i]=this._patchAddListener(t,t[i],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(i,s){var o;let a=(o=n._getPatchMap(e))===null||o===void 0?void 0:o[i];if(a===void 0)return t.call(this,i,s);let u=a.get(s);return t.call(this,i,u||s)}}_patchRemoveAllListeners(e,t){let n=this;return function(i){let s=n._getPatchMap(e);return s!==void 0&&(arguments.length===0?n._createPatchMap(e):s[i]!==void 0&&delete s[i]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let i=this;return function(s,o){if(i._wrapped)return t.call(this,s,o);let a=i._getPatchMap(e);a===void 0&&(a=i._createPatchMap(e));let u=a[s];u===void 0&&(u=new WeakMap,a[s]=u);let c=i.bind(n,o);u.set(o,c),i._wrapped=!0;try{return t.call(this,s,c)}finally{i._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}};Ts.AbstractAsyncHooksContextManager=xu});var up=l(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.AsyncLocalStorageContextManager=void 0;var fA=(h(),m(d)),EA=z("async_hooks"),mA=ap(),Du=class extends mA.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new EA.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:fA.ROOT_CONTEXT}with(e,t,n,...i){let s=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Ss.AsyncLocalStorageContextManager=Du});var Ur=l(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.toAnyValue=De.toKeyValue=De.toAttributes=void 0;function RA(r){return Object.keys(r).map(e=>Gu(e,r[e]))}De.toAttributes=RA;function Gu(r,e){return{key:r,value:Vu(e)}}De.toKeyValue=Gu;function Vu(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(Vu)}}:e==="object"&&r!=null?{kvlistValue:{values:Object.entries(r).map(([t,n])=>Gu(t,n))}}:{}}De.toAnyValue=Vu});var Op=l(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.toOtlpSpanEvent=Ue.toOtlpLink=Ue.sdkSpanToOtlpSpan=void 0;var Hu=Ur();function bA(r,e){var t;let n=r.spanContext(),i=r.status;return{traceId:e.encodeSpanContext(n.traceId),spanId:e.encodeSpanContext(n.spanId),parentSpanId:e.encodeOptionalSpanContext(r.parentSpanId),traceState:(t=n.traceState)===null||t===void 0?void 0:t.serialize(),name:r.name,kind:r.kind==null?0:r.kind+1,startTimeUnixNano:e.encodeHrTime(r.startTime),endTimeUnixNano:e.encodeHrTime(r.endTime),attributes:(0,Hu.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>Ap(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:i.code,message:i.message},links:r.links.map(s=>Sp(s,e)),droppedLinksCount:r.droppedLinksCount}}Ue.sdkSpanToOtlpSpan=bA;function Sp(r,e){var t;return{attributes:r.attributes?(0,Hu.toAttributes)(r.attributes):[],spanId:e.encodeSpanContext(r.context.spanId),traceId:e.encodeSpanContext(r.context.traceId),traceState:(t=r.context.traceState)===null||t===void 0?void 0:t.serialize(),droppedAttributesCount:r.droppedAttributesCount||0}}Ue.toOtlpLink=Sp;function Ap(r,e){return{attributes:r.attributes?(0,Hu.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}Ue.toOtlpSpanEvent=Ap});var Br=l(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.getOtlpEncoder=se.encodeAsString=se.encodeAsLongBits=se.toLongBits=se.hrTimeToNanos=void 0;var bs=A(),PA=BigInt(1e9);function ju(r){return BigInt(r[0])*PA+BigInt(r[1])}se.hrTimeToNanos=ju;function bp(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}se.toLongBits=bp;function Fu(r){let e=ju(r);return bp(e)}se.encodeAsLongBits=Fu;function Pp(r){return ju(r).toString()}se.encodeAsString=Pp;var yA=typeof BigInt<"u"?Pp:bs.hrTimeToNanoseconds;function Rp(r){return r}function yp(r){if(r!==void 0)return(0,bs.hexToBase64)(r)}var vA={encodeHrTime:Fu,encodeSpanContext:bs.hexToBase64,encodeOptionalSpanContext:yp};function IA(r){var e,t;if(r===void 0)return vA;let n=(e=r.useLongBits)!==null&&e!==void 0?e:!0,i=(t=r.useHex)!==null&&t!==void 0?t:!1;return{encodeHrTime:n?Fu:yA,encodeSpanContext:i?Rp:bs.hexToBase64,encodeOptionalSpanContext:i?Rp:yp}}se.getOtlpEncoder=IA});var ys=l(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.createExportTraceServiceRequest=void 0;var LA=Ur(),MA=Op(),NA=Br();function CA(r,e){let t=(0,NA.getOtlpEncoder)(e);return{resourceSpans:xA(r,t)}}Ps.createExportTraceServiceRequest=CA;function wA(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 i=`${t.instrumentationLibrary.name}@${t.instrumentationLibrary.version||""}:${t.instrumentationLibrary.schemaUrl||""}`,s=n.get(i);s||(s=[],n.set(i,s)),s.push(t)}return e}function xA(r,e){let t=wA(r),n=[],i=t.entries(),s=i.next();for(;!s.done;){let[o,a]=s.value,u=[],c=a.values(),_=c.next();for(;!_.done;){let f=_.value;if(f.length>0){let{name:L,version:R,schemaUrl:w}=f[0].instrumentationLibrary,U=f.map(S=>(0,MA.sdkSpanToOtlpSpan)(S,e));u.push({scope:{name:L,version:R},spans:U,schemaUrl:w})}_=c.next()}let p={resource:{attributes:(0,LA.toAttributes)(o.attributes),droppedAttributesCount:0},scopeSpans:u,schemaUrl:void 0};n.push(p),s=i.next()}return n}});var Lp=l(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.parseRetryAfterToMills=N.isExportRetryable=N.invalidTimeout=N.configureExporterTimeout=N.appendRootPathToUrlIfNeeded=N.appendResourcePathToUrl=N.parseHeaders=N.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=N.DEFAULT_EXPORT_MAX_BACKOFF=N.DEFAULT_EXPORT_INITIAL_BACKOFF=N.DEFAULT_EXPORT_MAX_ATTEMPTS=void 0;var ku=(h(),m(d)),vp=A(),Ip=1e4;N.DEFAULT_EXPORT_MAX_ATTEMPTS=5;N.DEFAULT_EXPORT_INITIAL_BACKOFF=1e3;N.DEFAULT_EXPORT_MAX_BACKOFF=5e3;N.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=1.5;function DA(r={}){let e={};return Object.entries(r).forEach(([t,n])=>{typeof n<"u"?e[t]=String(n):ku.diag.warn(`Header "${t}" has wrong value and will be ignored`)}),e}N.parseHeaders=DA;function UA(r,e){return r.endsWith("/")||(r=r+"/"),r+e}N.appendResourcePathToUrl=UA;function BA(r){try{let e=new URL(r);return e.pathname===""&&(e.pathname=e.pathname+"/"),e.toString()}catch{return ku.diag.warn(`Could not parse export URL: '${r}'`),r}}N.appendRootPathToUrlIfNeeded=BA;function qA(r){return typeof r=="number"?r<=0?$u(r,Ip):r:GA()}N.configureExporterTimeout=qA;function GA(){var r;let e=Number((r=(0,vp.getEnv)().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT)!==null&&r!==void 0?r:(0,vp.getEnv)().OTEL_EXPORTER_OTLP_TIMEOUT);return e<=0?$u(e,Ip):e}function $u(r,e){return ku.diag.warn("Timeout must be greater than 0",r),e}N.invalidTimeout=$u;function VA(r){return[429,502,503,504].includes(r)}N.isExportRetryable=VA;function HA(r){if(r==null)return-1;let e=Number.parseInt(r,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let t=new Date(r).getTime()-Date.now();return t>=0?t:0}N.parseRetryAfterToMills=HA});var Np=l(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.OTLPExporterBase=void 0;var Mp=(h(),m(d)),qr=A(),jA=Lp(),Xu=class{constructor(e={}){this._sendingPromises=[],this.url=this.getDefaultUrl(e),typeof e.hostname=="string"&&(this.hostname=e.hostname),this.shutdown=this.shutdown.bind(this),this._shutdownOnce=new qr.BindOnceFuture(this._shutdown,this),this._concurrencyLimit=typeof e.concurrencyLimit=="number"?e.concurrencyLimit:30,this.timeoutMillis=(0,jA.configureExporterTimeout)(e.timeoutMillis),this.onInit(e)}export(e,t){if(this._shutdownOnce.isCalled){t({code:qr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")});return}if(this._sendingPromises.length>=this._concurrencyLimit){t({code:qr.ExportResultCode.FAILED,error:new Error("Concurrent export limit reached")});return}this._export(e).then(()=>{t({code:qr.ExportResultCode.SUCCESS})}).catch(n=>{t({code:qr.ExportResultCode.FAILED,error:n})})}_export(e){return new Promise((t,n)=>{try{Mp.diag.debug("items to be sent",e),this.send(e,t,n)}catch(i){n(i)}})}shutdown(){return this._shutdownOnce.call()}forceFlush(){return Promise.all(this._sendingPromises).then(()=>{})}_shutdown(){return Mp.diag.debug("shutdown started"),this.onShutdown(),this.forceFlush()}};vs.OTLPExporterBase=Xu});var Dp=l((Ny,xp)=>{"use strict";xp.exports=$A;function $A(r,e){for(var t=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)t[n++]=arguments[i++];return new Promise(function(a,u){t[n]=function(_){if(s)if(s=!1,_)u(_);else{for(var p=new Array(arguments.length-1),f=0;f<p.length;)p[f++]=arguments[f];a.apply(null,p)}};try{r.apply(e||null,t)}catch(c){s&&(s=!1,u(c))}})}});var Gp=l(qp=>{"use strict";var Ls=qp;Ls.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 nr=new Array(64),Bp=new Array(123);for(ce=0;ce<64;)Bp[nr[ce]=ce<26?ce+65:ce<52?ce+71:ce<62?ce-4:ce-59|43]=ce++;var ce;Ls.encode=function(e,t,n){for(var i=null,s=[],o=0,a=0,u;t<n;){var c=e[t++];switch(a){case 0:s[o++]=nr[c>>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=nr[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=nr[u|c>>6],s[o++]=nr[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=nr[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var Up="invalid encoding";Ls.decode=function(e,t,n){for(var i=n,s=0,o,a=0;a<e.length;){var u=e.charCodeAt(a++);if(u===61&&s>1)break;if((u=Bp[u])===void 0)throw Error(Up);switch(s){case 0:o=u,s=1;break;case 1:t[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(Up);return n-i};Ls.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Hp=l((wy,Vp)=>{"use strict";Vp.exports=Ms;function Ms(){this._listeners={}}Ms.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};Ms.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],i=0;i<n.length;)n[i].fn===t?n.splice(i,1):++i;return this};Ms.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,n)}return this}});var Kp=l((xy,Wp)=>{"use strict";Wp.exports=jp(jp);function jp(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function i(u,c,_){e[0]=u,c[_]=t[0],c[_+1]=t[1],c[_+2]=t[2],c[_+3]=t[3]}function s(u,c,_){e[0]=u,c[_]=t[3],c[_+1]=t[2],c[_+2]=t[1],c[_+3]=t[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function o(u,c){return t[0]=u[c],t[1]=u[c+1],t[2]=u[c+2],t[3]=u[c+3],e[0]}function a(u,c){return t[3]=u[c],t[2]=u[c+1],t[1]=u[c+2],t[0]=u[c+3],e[0]}r.readFloatLE=n?o:a,r.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}r.writeFloatLE=e.bind(null,Fp),r.writeFloatBE=e.bind(null,kp);function t(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}r.readFloatLE=t.bind(null,$p),r.readFloatBE=t.bind(null,Xp)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function i(u,c,_){e[0]=u,c[_]=t[0],c[_+1]=t[1],c[_+2]=t[2],c[_+3]=t[3],c[_+4]=t[4],c[_+5]=t[5],c[_+6]=t[6],c[_+7]=t[7]}function s(u,c,_){e[0]=u,c[_]=t[7],c[_+1]=t[6],c[_+2]=t[5],c[_+3]=t[4],c[_+4]=t[3],c[_+5]=t[2],c[_+6]=t[1],c[_+7]=t[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function o(u,c){return t[0]=u[c],t[1]=u[c+1],t[2]=u[c+2],t[3]=u[c+3],t[4]=u[c+4],t[5]=u[c+5],t[6]=u[c+6],t[7]=u[c+7],e[0]}function a(u,c){return t[7]=u[c],t[6]=u[c+1],t[5]=u[c+2],t[4]=u[c+3],t[3]=u[c+4],t[2]=u[c+5],t[1]=u[c+6],t[0]=u[c+7],e[0]}r.readDoubleLE=n?o:a,r.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((c<<31|2146435072)>>>0,a,u+s);else{var _;if(o<22250738585072014e-324)_=o/5e-324,n(_>>>0,a,u+i),n((c<<31|_/4294967296)>>>0,a,u+s);else{var p=Math.floor(Math.log(o)/Math.LN2);p===1024&&(p=1023),_=o*Math.pow(2,-p),n(_*4503599627370496>>>0,a,u+i),n((c<<31|p+1023<<20|_*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,Fp,0,4),r.writeDoubleBE=e.bind(null,kp,4,0);function t(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),_=(c>>31)*2+1,p=c>>>20&2047,f=4294967296*(c&1048575)+u;return p===2047?f?NaN:_*(1/0):p===0?_*5e-324*f:_*Math.pow(2,p-1075)*(f+4503599627370496)}r.readDoubleLE=t.bind(null,$p,0,4),r.readDoubleBE=t.bind(null,Xp,4,0)}(),r}function Fp(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 kp(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 $p(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function Xp(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var zp=l((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 Qp=l(Yp=>{"use strict";var Ku=Yp;Ku.length=function(e){for(var t=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,t+=4):t+=3;return t};Ku.read=function(e,t,n){var i=n-t;if(i<1)return"";for(var s=null,o=[],a=0,u;t<n;)u=e[t++],u<128?o[a++]=u:u>191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};Ku.write=function(e,t,n){for(var i=n,s,o,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&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&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-i}});var Jp=l((Uy,Zp)=>{"use strict";Zp.exports=XA;function XA(r,e,t){var n=t||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return r(u);o+u>n&&(s=r(n),o=0);var c=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var th=l((By,eh)=>{"use strict";eh.exports=G;var Gr=qe();function G(r,e){this.lo=r>>>0,this.hi=e>>>0}var ct=G.zero=new G(0,0);ct.toNumber=function(){return 0};ct.zzEncode=ct.zzDecode=function(){return this};ct.length=function(){return 1};var WA=G.zeroHash="\0\0\0\0\0\0\0\0";G.fromNumber=function(e){if(e===0)return ct;var t=e<0;t&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new G(n,i)};G.from=function(e){if(typeof e=="number")return G.fromNumber(e);if(Gr.isString(e))if(Gr.Long)e=Gr.Long.fromString(e);else return G.fromNumber(parseInt(e,10));return e.low||e.high?new G(e.low>>>0,e.high>>>0):ct};G.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};G.prototype.toLong=function(e){return Gr.Long?new Gr.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Be=String.prototype.charCodeAt;G.fromHash=function(e){return e===WA?ct:new G((Be.call(e,0)|Be.call(e,1)<<8|Be.call(e,2)<<16|Be.call(e,3)<<24)>>>0,(Be.call(e,4)|Be.call(e,5)<<8|Be.call(e,6)<<16|Be.call(e,7)<<24)>>>0)};G.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)};G.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};G.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};G.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 qe=l(zu=>{"use strict";var E=zu;E.asPromise=Dp();E.base64=Gp();E.EventEmitter=Hp();E.float=Kp();E.inquire=zp();E.utf8=Qp();E.pool=Jp();E.LongBits=th();E.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);E.global=E.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||zu;E.emptyArray=Object.freeze?Object.freeze([]):[];E.emptyObject=Object.freeze?Object.freeze({}):{};E.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};E.isString=function(e){return typeof e=="string"||e instanceof String};E.isObject=function(e){return e&&typeof e=="object"};E.isset=E.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};E.Buffer=function(){try{var r=E.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();E._Buffer_from=null;E._Buffer_allocUnsafe=null;E.newBuffer=function(e){return typeof e=="number"?E.Buffer?E._Buffer_allocUnsafe(e):new E.Array(e):E.Buffer?E._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};E.Array=typeof Uint8Array<"u"?Uint8Array:Array;E.Long=E.global.dcodeIO&&E.global.dcodeIO.Long||E.global.Long||E.inquire("long");E.key2Re=/^true|false|0|1$/;E.key32Re=/^-?(?:0|[1-9][0-9]*)$/;E.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;E.longToHash=function(e){return e?E.LongBits.from(e).toHash():E.LongBits.zeroHash};E.longFromHash=function(e,t){var n=E.LongBits.fromHash(e);return E.Long?E.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function rh(r,e,t){for(var n=Object.keys(e),i=0;i<n.length;++i)(r[n[i]]===void 0||!t)&&(r[n[i]]=e[n[i]]);return r}E.merge=rh;E.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function nh(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&&rh(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}E.newError=nh;E.ProtocolError=nh("ProtocolError");E.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(t[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};E.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};E.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};E._configure=function(){var r=E.Buffer;if(!r){E._Buffer_from=E._Buffer_allocUnsafe=null;return}E._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},E._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var rc=l((Gy,ah)=>{"use strict";ah.exports=O;var oe=qe(),Yu,Ns=oe.LongBits,ih=oe.base64,sh=oe.utf8;function Vr(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Zu(){}function KA(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function O(){this.len=0,this.head=new Vr(Zu,0,0),this.tail=this.head,this.states=null}var oh=function(){return oe.Buffer?function(){return(O.create=function(){return new Yu})()}:function(){return new O}};O.create=oh();O.alloc=function(e){return new oe.Array(e)};oe.Array!==Array&&(O.alloc=oe.pool(O.alloc,oe.Array.prototype.subarray));O.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Vr(e,t,n),this.len+=t,this};function Ju(r,e,t){e[t]=r&255}function zA(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function ec(r,e){this.len=r,this.next=void 0,this.val=e}ec.prototype=Object.create(Vr.prototype);ec.prototype.fn=zA;O.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new ec((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};O.prototype.int32=function(e){return e<0?this._push(tc,10,Ns.fromNumber(e)):this.uint32(e)};O.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function tc(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}O.prototype.uint64=function(e){var t=Ns.from(e);return this._push(tc,t.length(),t)};O.prototype.int64=O.prototype.uint64;O.prototype.sint64=function(e){var t=Ns.from(e).zzEncode();return this._push(tc,t.length(),t)};O.prototype.bool=function(e){return this._push(Ju,1,e?1:0)};function Qu(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}O.prototype.fixed32=function(e){return this._push(Qu,4,e>>>0)};O.prototype.sfixed32=O.prototype.fixed32;O.prototype.fixed64=function(e){var t=Ns.from(e);return this._push(Qu,4,t.lo)._push(Qu,4,t.hi)};O.prototype.sfixed64=O.prototype.fixed64;O.prototype.float=function(e){return this._push(oe.float.writeFloatLE,4,e)};O.prototype.double=function(e){return this._push(oe.float.writeDoubleLE,8,e)};var YA=oe.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var i=0;i<e.length;++i)t[n+i]=e[i]};O.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(Ju,1,0);if(oe.isString(e)){var n=O.alloc(t=ih.length(e));ih.decode(e,n,0),e=n}return this.uint32(t)._push(YA,t,e)};O.prototype.string=function(e){var t=sh.length(e);return t?this.uint32(t)._push(sh.write,t,e):this._push(Ju,1,0)};O.prototype.fork=function(){return this.states=new KA(this),this.head=this.tail=new Vr(Zu,0,0),this.len=0,this};O.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 Vr(Zu,0,0),this.len=0),this};O.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};O.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};O._configure=function(r){Yu=r,O.create=oh(),Yu._configure()}});var lh=l((Vy,ch)=>{"use strict";ch.exports=ge;var uh=rc();(ge.prototype=Object.create(uh.prototype)).constructor=ge;var Ge=qe();function ge(){uh.call(this)}ge._configure=function(){ge.alloc=Ge._Buffer_allocUnsafe,ge.writeBytesBuffer=Ge.Buffer&&Ge.Buffer.prototype instanceof Uint8Array&&Ge.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 i=0;i<e.length;)t[n++]=e[i++]}};ge.prototype.bytes=function(e){Ge.isString(e)&&(e=Ge._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(ge.writeBytesBuffer,t,e),this};function QA(r,e,t){r.length<40?Ge.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}ge.prototype.string=function(e){var t=Ge.Buffer.byteLength(e);return this.uint32(t),t&&this._push(QA,t,e),this};ge._configure()});var sc=l((Hy,fh)=>{"use strict";fh.exports=x;var le=qe(),ic,ph=le.LongBits,ZA=le.utf8;function de(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 dh=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")},hh=function(){return le.Buffer?function(t){return(x.create=function(i){return le.Buffer.isBuffer(i)?new ic(i):dh(i)})(t)}:dh};x.create=hh();x.prototype._slice=le.Array.prototype.subarray||le.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,de(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 nc(){var r=new ph(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 de(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 de(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 Cs(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 de(this,4);return Cs(this.buf,this.pos+=4)};x.prototype.sfixed32=function(){if(this.pos+4>this.len)throw de(this,4);return Cs(this.buf,this.pos+=4)|0};function _h(){if(this.pos+8>this.len)throw de(this,8);return new ph(Cs(this.buf,this.pos+=4),Cs(this.buf,this.pos+=4))}x.prototype.float=function(){if(this.pos+4>this.len)throw de(this,4);var e=le.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};x.prototype.double=function(){if(this.pos+8>this.len)throw de(this,4);var e=le.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 de(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var i=le.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};x.prototype.string=function(){var e=this.bytes();return ZA.read(e,0,e.length)};x.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw de(this,e);this.pos+=e}else do if(this.pos>=this.len)throw de(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){ic=r,x.create=hh(),ic._configure();var e=le.Long?"toLong":"toNumber";le.merge(x.prototype,{int64:function(){return nc.call(this)[e](!1)},uint64:function(){return nc.call(this)[e](!0)},sint64:function(){return nc.call(this).zzDecode()[e](!1)},fixed64:function(){return _h.call(this)[e](!0)},sfixed64:function(){return _h.call(this)[e](!1)}})}});var Th=l((jy,gh)=>{"use strict";gh.exports=lt;var mh=sc();(lt.prototype=Object.create(mh.prototype)).constructor=lt;var Eh=qe();function lt(r){mh.call(this,r)}lt._configure=function(){Eh.Buffer&&(lt.prototype._slice=Eh.Buffer.prototype.slice)};lt.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))};lt._configure()});var Ah=l((Fy,Sh)=>{"use strict";Sh.exports=Hr;var oc=qe();(Hr.prototype=Object.create(oc.EventEmitter.prototype)).constructor=Hr;function Hr(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");oc.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Hr.prototype.rpcCall=function r(e,t,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return oc.asPromise(r,o,e,t,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,c){if(u)return o.emit("error",u,e),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(_){return o.emit("error",_,e),s(_)}return o.emit("data",c,e),s(null,c)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Hr.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Rh=l(Oh=>{"use strict";var JA=Oh;JA.Service=Ah()});var Ph=l(($y,bh)=>{"use strict";bh.exports={}});var Ih=l(vh=>{"use strict";var J=vh;J.build="minimal";J.Writer=rc();J.BufferWriter=lh();J.Reader=sc();J.BufferReader=Th();J.util=qe();J.rpc=Rh();J.roots=Ph();J.configure=yh;function yh(){J.util._configure(),J.Writer._configure(J.BufferWriter),J.Reader._configure(J.BufferReader)}yh()});var Mh=l((Wy,Lh)=>{"use strict";Lh.exports=Ih()});var Vh=l(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0})});var jh=l(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0})});var kh=l(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0})});var $h=l(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.ESpanKind=void 0;var gO;(function(r){r[r.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",r[r.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",r[r.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",r[r.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",r[r.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",r[r.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"})(gO=Fr.ESpanKind||(Fr.ESpanKind={}))});var Wh=l(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0})});var Zh=l(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.toMetric=Ve.toScopeMetrics=Ve.toResourceMetrics=void 0;var Kh=(h(),m(d)),or=wu(),Ds=Ur(),TO=Br();function SO(r,e){let t=(0,TO.getOtlpEncoder)(e);return{resource:{attributes:(0,Ds.toAttributes)(r.resource.attributes),droppedAttributesCount:0},schemaUrl:void 0,scopeMetrics:Yh(r.scopeMetrics,t)}}Ve.toResourceMetrics=SO;function Yh(r,e){return Array.from(r.map(t=>({scope:{name:t.scope.name,version:t.scope.version},metrics:t.metrics.map(n=>Qh(n,e)),schemaUrl:t.scope.schemaUrl})))}Ve.toScopeMetrics=Yh;function Qh(r,e){let t={name:r.descriptor.name,description:r.descriptor.description,unit:r.descriptor.unit},n=bO(r.aggregationTemporality);switch(r.dataPointType){case or.DataPointType.SUM:t.sum={aggregationTemporality:n,isMonotonic:r.isMonotonic,dataPoints:zh(r,e)};break;case or.DataPointType.GAUGE:t.gauge={dataPoints:zh(r,e)};break;case or.DataPointType.HISTOGRAM:t.histogram={aggregationTemporality:n,dataPoints:OO(r,e)};break;case or.DataPointType.EXPONENTIAL_HISTOGRAM:t.exponentialHistogram={aggregationTemporality:n,dataPoints:RO(r,e)};break}return t}Ve.toMetric=Qh;function AO(r,e,t){let n={attributes:(0,Ds.toAttributes)(r.attributes),startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)};switch(e){case Kh.ValueType.INT:n.asInt=r.value;break;case Kh.ValueType.DOUBLE:n.asDouble=r.value;break}return n}function zh(r,e){return r.dataPoints.map(t=>AO(t,r.descriptor.valueType,e))}function OO(r,e){return r.dataPoints.map(t=>{let n=t.value;return{attributes:(0,Ds.toAttributes)(t.attributes),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(t.startTime),timeUnixNano:e.encodeHrTime(t.endTime)}})}function RO(r,e){return r.dataPoints.map(t=>{let n=t.value;return{attributes:(0,Ds.toAttributes)(t.attributes),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(t.startTime),timeUnixNano:e.encodeHrTime(t.endTime)}})}function bO(r){switch(r){case or.AggregationTemporality.DELTA:return 1;case or.AggregationTemporality.CUMULATIVE:return 2}}});var Jh=l(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.createExportMetricsServiceRequest=void 0;var PO=Zh();function yO(r,e){return{resourceMetrics:r.map(t=>(0,PO.toResourceMetrics)(t,e))}}Us.createExportMetricsServiceRequest=yO});var tf=l(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.toLogAttributes=ar.createExportLogsServiceRequest=void 0;var vO=Br(),lc=Ur();function IO(r,e){let t=(0,vO.getOtlpEncoder)(e);return{resourceLogs:MO(r,t)}}ar.createExportLogsServiceRequest=IO;function LO(r){let e=new Map;for(let t of r){let{resource:n,instrumentationScope:{name:i,version:s="",schemaUrl:o=""}}=t,a=e.get(n);a||(a=new Map,e.set(n,a));let u=`${i}@${s}:${o}`,c=a.get(u);c||(c=[],a.set(u,c)),c.push(t)}return e}function MO(r,e){let t=LO(r);return Array.from(t,([n,i])=>({resource:{attributes:(0,lc.toAttributes)(n.attributes),droppedAttributesCount:0},scopeLogs:Array.from(i,([,s])=>{let{instrumentationScope:{name:o,version:a,schemaUrl:u}}=s[0];return{scope:{name:o,version:a},logRecords:s.map(c=>NO(c,e)),schemaUrl:u}}),schemaUrl:void 0}))}function NO(r,e){var t,n,i;return{timeUnixNano:e.encodeHrTime(r.hrTime),observedTimeUnixNano:e.encodeHrTime(r.hrTimeObserved),severityNumber:r.severityNumber,severityText:r.severityText,body:(0,lc.toAnyValue)(r.body),attributes:ef(r.attributes),droppedAttributesCount:r.droppedAttributesCount,flags:(t=r.spanContext)===null||t===void 0?void 0:t.traceFlags,traceId:e.encodeOptionalSpanContext((n=r.spanContext)===null||n===void 0?void 0:n.traceId),spanId:e.encodeOptionalSpanContext((i=r.spanContext)===null||i===void 0?void 0:i.spanId)}}function ef(r){return Object.keys(r).map(e=>(0,lc.toKeyValue)(e,r[e]))}ar.toLogAttributes=ef});var rf=l(V=>{"use strict";var CO=V&&V.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),ur=V&&V.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&CO(e,r,t)};Object.defineProperty(V,"__esModule",{value:!0});V.createExportLogsServiceRequest=V.createExportMetricsServiceRequest=V.createExportTraceServiceRequest=void 0;ur(Vh(),V);ur(Br(),V);ur(jh(),V);ur(kh(),V);ur($h(),V);ur(Wh(),V);var wO=ys();Object.defineProperty(V,"createExportTraceServiceRequest",{enumerable:!0,get:function(){return wO.createExportTraceServiceRequest}});var xO=Jh();Object.defineProperty(V,"createExportMetricsServiceRequest",{enumerable:!0,get:function(){return xO.createExportMetricsServiceRequest}});var DO=tf();Object.defineProperty(V,"createExportLogsServiceRequest",{enumerable:!0,get:function(){return DO.createExportLogsServiceRequest}})});var C=Y(la(),1);h();fa();var af=Y(Gd(),1),lr=Y(rt(),1),uf=Y(t_(),1),cf=Y(wu(),1),Vs=Y(Yr(),1),lf=Y(up(),1),He=Y(A(),1);var cp="http.method",lp="http.url",As="http.host",dp="http.scheme",Uu="http.status_code",_p="http.user_agent",Bu="http.response_content_length_uncompressed",pp="net.peer.port",hp="net.peer.name";var fp="service.name",Ep="service.version";h();var gA=Symbol.for("@vercel/request-context");function me(){return globalThis[gA]?.get()}function Os(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function mp(r){return r?r.split("::").at(-1):void 0}function gp(r=me(),e){if(!r)return;let t=e?SA(e,r.headers):void 0;return Os({[As]:r.headers.host,[_p]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":mp(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":process.env.VERCEL_REGION,...t})}var TA={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function SA(r,e){if(typeof r=="function")return r(e,TA);let t={};for(let[n,i]of Object.entries(r)){let s=e[i.toLocaleLowerCase()];s!==void 0&&(t[n]=s)}return t}h();function er(r){return(r&d.TraceFlags.SAMPLED)!==0}var Rs=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=>{d.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:i,traceFlags:s}=e.spanContext(),o=!e.parentSpanId||!this.rootSpanIds.has(n);if(o?this.rootSpanIds.set(n,{rootSpanId:i,open:[]}):this.rootSpanIds.get(n)?.open.push(e),o&&er(s)){let a=me(),u=gp(a,this.attributesFromHeaders);u&&e.setAttributes(u),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let c=new Promise(p=>{this.waitSpanEnd.set(n,p)}),_;await Promise.race([c,new Promise(p=>{_=setTimeout(()=>{this.waitSpanEnd.delete(n),p(void 0)},50)})]),_&&clearTimeout(_)}return this.forceFlush()})}for(let a of this.processors)a.onStart(e,t)}onEnd(e){let{traceId:t,spanId:n,traceFlags:i}=e.spanContext(),s=er(i),o=this.rootSpanIds.get(t),a=o?.rootSpanId===n;if(s){let u=OA(e);u&&Object.assign(e.attributes,u)}if(a){if(this.rootSpanIds.delete(t),o.open.length>0){for(let u of o.open)if(!u.ended&&u.spanContext().spanId!==n)try{u.end()}catch(c){d.diag.error("@vercel/otel: onEnd failed:",c)}}}else if(o)for(let u=0;u<o.open.length;u++)o.open[u]?.spanContext().spanId===n&&o.open.splice(u,1);for(let u of this.processors)u.onEnd(e);if(a){let u=this.waitSpanEnd.get(t);u&&(this.waitSpanEnd.delete(t),u())}}},AA={[d.SpanKind.INTERNAL]:"internal",[d.SpanKind.SERVER]:"server",[d.SpanKind.CLIENT]:"client",[d.SpanKind.PRODUCER]:"producer",[d.SpanKind.CONSUMER]:"consumer"};function OA(r){let{kind:e,attributes:t}=r,{"operation.name":n,"resource.name":i,"span.type":s,"next.span_type":o,"http.method":a,"http.route":u}=t;if(n)return;let c=i??(a&&typeof a=="string"&&u&&typeof u=="string"?`${a} ${u}`:u);if(r.kind===d.SpanKind.SERVER&&a&&u&&typeof a=="string"&&typeof u=="string")return{"operation.name":"web.request","resource.name":c};let _=r.instrumentationLibrary.name,p=o??s;if(p&&typeof p=="string"){let f=Tp(_,p);return u?{"operation.name":f,"resource.name":c}:{"operation.name":f}}return{"operation.name":Tp(_,e===d.SpanKind.INTERNAL?"":AA[e])}}function Tp(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var wp=Y(ys(),1);var Cp=Y(Np(),1);h();var tr=class extends Cp.OTLPExporterBase{constructor(e={}){super(e),e.headers&&(this._headers=e.headers)}onShutdown(){d.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){d.diag.debug("@vercel/otel/otlp: onInit")}send(e,t,n){if(this._shutdownOnce.isCalled){d.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}let i=this.convert(e),s,o,a;try{({body:s,contentType:o,headers:a}=this.toMessage(i))}catch(c){d.diag.warn("@vercel/otel/otlp: no proto",c);return}let u=fetch(this.url,{method:"POST",body:s,headers:{...this._headers,...a,"Content-Type":o,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(c=>{d.diag.debug("@vercel/otel/otlp: onSuccess",c.status,c.statusText),t(),c.arrayBuffer().catch(()=>{})}).catch(c=>{d.diag.error("@vercel/otel/otlp: onError",c),n(c)}).finally(()=>{let c=this._sendingPromises.indexOf(u);this._sendingPromises.splice(c,1)});this._sendingPromises.push(u)}getDefaultUrl(e){throw new Error("Method not implemented.")}};var FA="v1/traces",kA=`http://localhost:4318/${FA}`;function Is(r){return typeof r.url=="string"?r.url:kA}var rr=class{constructor(e={}){this.impl=new Wu(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},Wu=class extends tr{convert(e){return(0,wp.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1})}toMessage(e){return{body:JSON.stringify(e),contentType:"application/json"}}getDefaultUrl(e){return Is(e)}};var xh=Y(ys(),1);var Nh=Y(Mh(),1);function Ch(r){let e=new Nh.Writer;return eO(r,e),e.finish()}function eO(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)tO(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function tO(r,e){if(r.resource!=null&&rO(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)nO(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function rO(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)ir(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function nO(r,e){if(r.scope!=null&&oO(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)aO(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function ir(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&wh(r.value,e.uint32(18).fork()).ldelim(),e}function wh(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&&iO(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&sO(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function iO(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)wh(r.values[t],e.uint32(10).fork()).ldelim();return e}function sO(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)ir(r.values[t],e.uint32(10).fork()).ldelim();return e}function oO(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)ir(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function aO(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)ir(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)cO(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)lO(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&uO(r.status,e.uint32(122).fork()).ldelim(),e}function uO(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function cO(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)ir(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function lO(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)ir(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var dt=class{constructor(e={}){this.impl=new ac(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},ac=class extends tr{convert(e){return(0,xh.createExportTraceServiceRequest)(e,void 0)}toMessage(e){return{body:Ch(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Is(e)}};h();function Dh(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let i=e[n];return i!==void 0?String(i):t})}var sr=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 i=e.toString();return n.some(s=>typeof s=="string"?s==="*"?!0:i.startsWith(s):s.test(i))}shouldPropagate(e,t){let n=process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||null,i=process.env.VERCEL_BRANCH_URL||process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL||null,s=this.config.propagateContextUrls??[],o=this.config.dontPropagateContextUrls??[];if(t?.opentelemetry?.propagateContext)return t.opentelemetry.propagateContext;let a=e.toString();return o.length>0&&o.some(u=>typeof u=="string"?u==="*"?!0:a.startsWith(u):u.test(a))?!1:n&&e.protocol==="https:"&&(e.host===n||e.host===i||e.host===me()?.headers.host)||!n&&e.protocol==="http:"&&e.hostname==="localhost"?!0:s.some(u=>typeof u=="string"?u==="*"?!0:a.startsWith(u):u.test(a))}startSpan({tracer:e,url:t,fetchType:n,method:i="GET",name:s,attributes:o={}}){let a=this.config.resourceNameTemplate,u={[cp]:i,[lp]:t.toString(),[As]:t.host,[dp]:t.protocol.replace(":",""),[hp]:t.hostname,[pp]:t.port},c=a?Dh(a,u):pO(t.toString()),_=s??`${n} ${i} ${t.toString()}`,p=d.context.active();return e.startSpan(_,{kind:d.SpanKind.CLIENT,attributes:{...u,"operation.name":`${n}.${i}`,"http.client.name":n,"resource.name":c,...o}},p)}instrumentHttp(e,t){let{tracerProvider:n}=this;if(!n)return;let i=n.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:s,attributesFromResponseHeaders:o}=this.config,a=e.request,u=e.get,c=_=>(p,f,L)=>{let R,w={},U;if(typeof p=="string"||p instanceof URL?(R=new URL(p.toString()),typeof f=="function"?U=f:f&&typeof L=="function"?(w=f,U=L):f&&(w=f)):(w=p,typeof f=="function"&&(U=f),R=fO(w,t)),this.shouldIgnore(R))return _.apply(this,[R,w,U]);let S=this.startSpan({tracer:i,url:R,fetchType:"http",method:w.method||"GET"});if(!S.isRecording()||!er(S.spanContext().traceFlags))return S.end(),_.apply(this,[R,w,U]);if(this.shouldPropagate(R)){let Te=d.context.active(),Se=d.trace.setSpan(Te,S);d.propagation.inject(Se,w.headers||{},_O)}s&&ws(S,s,w.headers||{},Bh);try{let Te=Date.now(),Se=_.apply(this,[R,w,U]);return Se.prependListener("response",K=>{let pt=Date.now()-Te;S.setAttribute("http.response_time",pt),K.statusCode!==void 0?(S.setAttribute(Uu,K.statusCode),K.statusCode>=500&&_t(S,`Status: ${K.statusCode}`)):_t(S,"Response status code is undefined"),o&&ws(S,o,K.headers,Bh),Se.listenerCount("response")<=1&&K.resume(),K.on("end",()=>{let kr,Hs=K.statusCode;K.aborted&&!K.complete?kr={code:d.SpanStatusCode.ERROR}:Hs&&Hs>=100&&Hs<500?kr={code:d.SpanStatusCode.UNSET}:kr={code:d.SpanStatusCode.ERROR},S.setStatus(kr),S.isRecording()&&(K.headers["content-length"]&&S.setAttribute(Bu,K.headers["content-length"]),S.end())})}),Se.on("error",K=>{S.isRecording()&&(_t(S,K),S.end())}),Se.on("close",()=>{S.isRecording()&&S.end()}),Se}catch(Te){throw _t(S,Te),S.end(),Te}};e.request=c(a),e.get=c(u)}instrumentFetch(){let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:n,attributesFromResponseHeaders:i}=this.config;process.env.NEXT_OTEL_FETCH_DISABLED="1";let s=globalThis.fetch;this.originalFetch=s;let o=async(a,u)=>{let c=u;if(c?.next?.internal)return s(a,c);let _=new Request(a instanceof Request?a.clone():a,c),p=new URL(_.url);if(this.shouldIgnore(p,c))return s(a,c);let f=this.startSpan({tracer:t,url:p,fetchType:"fetch",method:_.method,name:c?.opentelemetry?.spanName,attributes:c?.opentelemetry?.attributes});if(!f.isRecording()||!er(f.spanContext().traceFlags))return f.end(),s(a,c);if(this.shouldPropagate(p,c)){let L=d.context.active(),R=d.trace.setSpan(L,f);d.propagation.inject(R,_.headers,dO)}n&&ws(f,n,_.headers,Uh);try{let L=Date.now();c?.body&&c.body instanceof FormData&&_.headers.delete("content-type");let R=await s(a,{...c,headers:_.headers}),w=Date.now()-L;return f.setAttribute(Uu,R.status),f.setAttribute("http.response_time",w),i&&ws(f,i,R.headers,Uh),R.status>=500&&_t(f,`Status: ${R.status} (${R.statusText})`),R.body?hO(R).then(U=>{f.isRecording()&&(f.setAttribute(Bu,U),f.end())},U=>{f.isRecording()&&(_t(f,U),f.end())}):f.end(),R}catch(L){throw _t(f,L),f.end(),L}};globalThis.fetch=o}enable(){this.disable(),this.instrumentFetch();try{let e=z("node:http"),t=z("node:https");this.instrumentHttp(e,"http:"),this.instrumentHttp(t,"https:")}catch{}}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},dO={set(r,e,t){r.set(e,t)}},Uh={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}},_O={set(r,e,t){r[e.toLowerCase()]=t}},Bh={get(r,e){return r[e.toLowerCase()]},keys(r){return Object.keys(r)}};function pO(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function hO(r){let e=0,n=r.clone().body?.getReader();if(!n)return Promise.resolve(0);let i=()=>n.read().then(({done:s,value:o})=>{if(!s)return e+=o.byteLength,i()});return i().then(()=>e)}function _t(r,e){if(e instanceof Error)r.recordException(e),r.setStatus({code:d.SpanStatusCode.ERROR,message:e.message});else{let t=String(e);r.setStatus({code:d.SpanStatusCode.ERROR,message:t})}}function ws(r,e,t,n){for(let[i,s]of Object.entries(e)){let o=n.get(t,s);o!==void 0&&r.setAttribute(i,o)}}function fO(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,i=r.port??r.defaultPort;if(!n&&r.host){let c=r.host.split(":");n=c[0];let _=c[1];if(c.length>1&&_&&i===void 0){let p=parseInt(_,10);isNaN(p)||(i=p)}}n||(n="localhost");let s;if(i!==void 0&&i!==""){let c=parseInt(String(i),10);isNaN(c)?s=t==="https:"?443:80:s=c}else s=t==="https:"?443:80;let o=r.path||"/",a=`${t}//${n}:${s}`,u=new URL(o,a);if(r.auth){let c=r.auth.split(":");u.username=decodeURIComponent(c[0]||""),c.length>1&&(u.password=decodeURIComponent(c[1]||""))}return u}h();var qh=Y(A(),1),EO="00",uc="traceparent",cc="tracestate",jr=class{fields(){return[uc,cc]}inject(e,t,n){let i=d.trace.getSpanContext(e);if(!i||(0,qh.isTracingSuppressed)(e)||!(0,d.isSpanContextValid)(i))return;let s=`${EO}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||0).toString(16)}`;n.set(t,uc,s),i.traceState&&n.set(t,cc,i.traceState.serialize())}extract(e,t,n){let i=n.get(t,uc);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=mO(s);if(!o)return e;o.isRemote=!0;let a=n.get(t,cc);if(a){let u=Array.isArray(a)?a.join(","):a;o.traceState=(0,d.createTraceState)(typeof u=="string"?u:void 0)}return d.trace.setSpanContext(e,o)}};function mO(r){let[e,t,n,i,s]=r.split("-");return!e||!t||!n||!i||e.length!==2||t.length!==32||n.length!==16||i.length!==2||e==="00"&&s?null:{traceId:t,spanId:n,traceFlags:parseInt(i,16)}}h();var xs=class{fields(){return[]}inject(){}extract(e){let t=me();if(!t?.telemetry)return d.diag.warn("@vercel/otel: Vercel telemetry extension not found."),e;let{rootSpanContext:n}=t.telemetry;return n?(d.diag.debug("@vercel/otel: Extracted root SpanContext from Vercel request context.",n),d.trace.setSpanContext(e,{...n,isRemote:!0,traceFlags:n.traceFlags||d.TraceFlags.SAMPLED})):e}};h();var Bs=Y(A(),1),nf=Y(rf(),1);var qs=class{export(e,t){let n=me();if(!n?.telemetry){d.diag.warn("@vercel/otel: no telemetry context found"),t({code:Bs.ExportResultCode.SUCCESS,error:void 0});return}try{let i=(0,nf.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1});n.telemetry.reportSpans(i),t({code:Bs.ExportResultCode.SUCCESS,error:void 0})}catch(i){t({code:Bs.ExportResultCode.FAILED,error:i instanceof Error?i:new Error(String(i))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};var UO={ALL:d.DiagLogLevel.ALL,VERBOSE:d.DiagLogLevel.VERBOSE,DEBUG:d.DiagLogLevel.DEBUG,INFO:d.DiagLogLevel.INFO,WARN:d.DiagLogLevel.WARN,ERROR:d.DiagLogLevel.ERROR,NONE:d.DiagLogLevel.NONE},Gs=class{constructor(e={}){this.configuration=e}start(){let e=BO(),t=this.configuration,n=process.env.NEXT_RUNTIME||"nodejs",i=!!e.OTEL_SDK_DISABLED;if(process.env.OTEL_LOG_LEVEL&&d.diag.setLogger(new d.DiagConsoleLogger,{logLevel:UO[process.env.OTEL_LOG_LEVEL.toUpperCase()]}),i)return;let s=t.idGenerator??new C.RandomIdGenerator,o=t.contextManager??new lf.AsyncLocalStorageContextManager;o.enable(),this.contextManager=o;let a=e.OTEL_SERVICE_NAME||t.serviceName||"app",u=new lr.Resource(Os({[fp]:a,"node.ci":process.env.CI?!0:void 0,"node.env":process.env.NODE_ENV,env:process.env.VERCEL_ENV||process.env.NEXT_PUBLIC_VERCEL_ENV,"vercel.region":process.env.VERCEL_REGION,"vercel.runtime":n,"vercel.sha":process.env.VERCEL_GIT_COMMIT_SHA||process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,"vercel.host":process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||void 0,"vercel.branch_host":process.env.VERCEL_BRANCH_URL||process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL||void 0,"vercel.deployment_id":process.env.VERCEL_DEPLOYMENT_ID||void 0,[Ep]:process.env.VERCEL_DEPLOYMENT_ID,...t.attributes})),c=t.resourceDetectors??[lr.envDetectorSync];if(t.autoDetectResources??!0){let S={detectors:c};u=u.merge((0,lr.detectResourcesSync)(S))}let p=GO(t.propagators,t,e),f=VO(t.traceSampler,e),L=HO(t.spanProcessors,t,e);L.length===0&&d.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let R=t.spanLimits,w=new C.BasicTracerProvider({resource:u,idGenerator:s,sampler:f,spanLimits:R});if(w.addSpanProcessor(new Rs(L,t.attributesFromHeaders)),w.register({contextManager:o,propagator:new He.CompositePropagator({propagators:p})}),this.tracerProvider=w,t.logRecordProcessor){let S=new uf.LoggerProvider({resource:u});this.loggerProvider=S,S.addLogRecordProcessor(t.logRecordProcessor),st.logs.setGlobalLoggerProvider(S)}if(t.metricReader||t.views){let S=new cf.MeterProvider({resource:u,views:t.views??[]});t.metricReader&&S.addMetricReader(t.metricReader),d.metrics.setGlobalMeterProvider(S),this.meterProvider=S}let U=qO(t.instrumentations,t.instrumentationConfig);this.disableInstrumentations=(0,af.registerInstrumentations)({instrumentations:U}),d.diag.info("@vercel/otel: started",a,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()),d.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 BO(){let r=(0,Vs.parseEnvironment)(process.env);return{...Vs.DEFAULT_ENVIRONMENT,...r}}function qO(r,e){return(r??["auto"]).map(t=>t==="auto"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new sr(e?.fetch)]):t==="fetch"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new sr(e?.fetch)):t).flat()}function GO(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(i=>{if(i==="none")return[];if(i==="auto"){let s=[];return s.push({name:"tracecontext",propagator:new jr}),s.push({name:"baggage",propagator:new He.W3CBaggagePropagator}),s.push({name:"vercel-runtime",propagator:new xs}),d.diag.debug(`@vercel/otel: Configure propagators: ${s.map(o=>o.name).join(", ")}`),s.map(o=>o.propagator)}if(i==="tracecontext")return d.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new jr;if(i==="baggage")return d.diag.debug("@vercel/otel: Configure propagator: baggage"),new He.W3CBaggagePropagator;if(typeof i=="string")throw new Error(`Unknown propagator: "${i}"`);return i}).flat()}var sf="always_on",cr=1;function VO(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||sf;switch(d.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new C.AlwaysOnSampler;case"always_off":return new C.AlwaysOffSampler;case"parentbased_always_on":return new C.ParentBasedSampler({root:new C.AlwaysOnSampler});case"parentbased_always_off":return new C.ParentBasedSampler({root:new C.AlwaysOffSampler});case"traceidratio":return new C.TraceIdRatioBasedSampler(of(e));case"parentbased_traceidratio":return new C.ParentBasedSampler({root:new C.TraceIdRatioBasedSampler(of(e))});default:return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${sf}".`),new C.AlwaysOnSampler}}function of(r){if(r.OTEL_TRACES_SAMPLER_ARG===void 0||r.OTEL_TRACES_SAMPLER_ARG==="")return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${cr}.`),cr;d.diag.debug("@vercel/otel: Configure sampler probability: ",r.OTEL_TRACES_SAMPLER_ARG);let e=Number(r.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${cr}.`),cr):e<0||e>1?(d.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 ${cr}.`),cr):e}function HO(r,e,t){return[...(r??["auto"]).flatMap(n=>{if(n==="auto"){let i=[new C.BatchSpanProcessor(new qs)];if(process.env.VERCEL_OTEL_ENDPOINTS){let s=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",o=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";d.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",s,o);let a={url:`http://localhost:${s}/v1/traces`,headers:{}},u=o==="http/protobuf"?new dt(a):new rr(a);i.push(new C.BatchSpanProcessor(u))}else(!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT)&&i.push(new C.BatchSpanProcessor(jO(t)));return i}return n}).filter($O),...e.traceExporter&&e.traceExporter!=="auto"?[new C.BatchSpanProcessor(e.traceExporter)]:[]]}function jO(r){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??process.env.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=kO(r),n={...He.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_HEADERS),...He.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_TRACES_HEADERS)};switch(d.diag.debug("@vercel/otel: Configure trace exporter: ",e,t,`headers: ${Object.keys(n).join(",")||"<none>"}`),e){case"http/json":return new rr({url:t,headers:n});case"http/protobuf":return new dt({url:t,headers:n});default:return d.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new dt}}var df="v1/traces",FO=`http://localhost:4318/${df}`;function kO(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}/${df}`:FO}function $O(r){return r!=null}function xv(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new Gs(e).start()}export{sr as FetchInstrumentation,rr as OTLPHttpJsonTraceExporter,dt as OTLPHttpProtoTraceExporter,xv as registerOTel};
|
|
20
|
+
`,(0,is.getConflictResolutionRecipe)(s,e))}return n}};ss.MetricStorageRegistry=fu});var k_=l(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.MultiMetricStorage=void 0;var Eu=class{constructor(e){this._backingStorages=e}record(e,t,n,i){this._backingStorages.forEach(s=>{s.record(e,t,n,i)})}};os.MultiMetricStorage=Eu});var X_=l(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.BatchObservableResultImpl=Zt.ObservableResultImpl=void 0;var Qt=(h(),m(d)),$_=wr(),MS=Qi(),mu=class{constructor(e,t){this._instrumentName=e,this._valueType=t,this._buffer=new $_.AttributeHashMap}observe(e,t={}){if(typeof e!="number"){Qt.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===Qt.ValueType.INT&&!Number.isInteger(e)&&(Qt.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)}};Zt.ObservableResultImpl=mu;var gu=class{constructor(){this._buffer=new Map}observe(e,t,n={}){if(!(0,MS.isObservableInstrument)(e))return;let i=this._buffer.get(e);if(i==null&&(i=new $_.AttributeHashMap,this._buffer.set(e,i)),typeof t!="number"){Qt.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===Qt.ValueType.INT&&!Number.isInteger(t)&&(Qt.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))||i.set(n,t)}};Zt.BatchObservableResultImpl=gu});var z_=l(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.ObservableRegistry=void 0;var NS=(h(),m(d)),W_=Qi(),K_=X_(),xr=fe(),Tu=class{constructor(){this._callbacks=[],this._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(W_.isObservableInstrument));if(n.size===0){NS.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(W_.isObservableInstrument)),i=this._findBatchCallback(e,n);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let n=this._observeCallbacks(e,t),i=this._observeBatchCallbacks(e,t);return(await(0,xr.PromiseAllSettled)([...n,...i])).filter(xr.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:i})=>{let s=new K_.ObservableResultImpl(i._descriptor.name,i._descriptor.valueType),o=Promise.resolve(n(s));t!=null&&(o=(0,xr.callWithTimeout)(o,t)),await o,i._metricStorages.forEach(a=>{a.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:i})=>{let s=new K_.BatchObservableResultImpl,o=Promise.resolve(n(s));t!=null&&(o=(0,xr.callWithTimeout)(o,t)),await o,i.forEach(a=>{let u=s._buffer.get(a);u!=null&&a._metricStorages.forEach(c=>{c.record(u,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,xr.setEquals)(n.instruments,t))}};as.ObservableRegistry=Tu});var Y_=l(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.SyncMetricStorage=void 0;var CS=au(),wS=du(),xS=pu(),Su=class extends CS.MetricStorage{constructor(e,t,n,i){super(e),this._attributesProcessor=n,this._deltaMetricStorage=new wS.DeltaMetricProcessor(t),this._temporalMetricStorage=new xS.TemporalMetricProcessor(t,i)}record(e,t,n,i){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,i)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};us.SyncMetricStorage=Su});var Ou=l(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.FilteringAttributesProcessor=we.NoopAttributesProcessor=we.AttributesProcessor=void 0;var Dr=class{static Noop(){return DS}};we.AttributesProcessor=Dr;var cs=class extends Dr{process(e,t){return e}};we.NoopAttributesProcessor=cs;var Au=class extends Dr{constructor(e){super(),this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(i=>this._allowedAttributeNames.includes(i)).forEach(i=>n[i]=e[i]),n}};we.FilteringAttributesProcessor=Au;var DS=new cs});var Q_=l(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.MeterSharedState=void 0;var US=be(),BS=D_(),qS=fe(),GS=U_(),VS=F_(),HS=k_(),jS=z_(),FS=Y_(),kS=Ou(),Ru=class{constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.metricStorageRegistry=new VS.MetricStorageRegistry,this.observableRegistry=new jS.ObservableRegistry,this.meter=new BS.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,FS.SyncMetricStorage);return t.length===1?t[0]:new HS.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,GS.AsyncMetricStorage)}async collect(e,t,n){let i=await this.observableRegistry.observe(t,n?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(s.length===0)return null;let o=s.map(a=>a.collect(e,t)).filter(qS.isNotNullish);return o.length===0?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:o},errors:i}}_registerMetricStorage(e,t){let i=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(s=>{let o=(0,US.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(o);if(a!=null)return a;let u=s.aggregation.createAggregator(o),c=new t(o,u,s.attributesProcessor,this._meterProviderSharedState.metricCollectors);return this.metricStorageRegistry.register(c),c});if(i.length===0){let o=this._meterProviderSharedState.selectAggregations(e.type).map(([a,u])=>{let c=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(c!=null)return c;let _=u.createAggregator(e),p=new t(e,_,kS.AttributesProcessor.Noop(),[a]);return this.metricStorageRegistry.registerForCollector(a,p),p});i=i.concat(o)}return i}};ls.MeterSharedState=Ru});var Z_=l(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.MeterProviderSharedState=void 0;var $S=fe(),XS=x_(),WS=Q_(),bu=class{constructor(e){this.resource=e,this.viewRegistry=new XS.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(e){let t=(0,$S.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new WS.MeterSharedState(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,n.selectAggregation(e)]);return t}};ds.MeterProviderSharedState=bu});var J_=l(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.MetricCollector=void 0;var KS=A(),Pu=class{constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,KS.millisToHrTime)(Date.now()),n=[],i=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async o=>{let a=await o.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&i.push(...a.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:i}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}};_s.MetricCollector=Pu});var tp=l(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.MeterProvider=void 0;var ps=(h(),m(d)),ep=rt(),zS=Z_(),YS=J_(),yu=class{constructor(e){var t;this._shutdown=!1;let n=ep.Resource.default().merge((t=e?.resource)!==null&&t!==void 0?t:ep.Resource.empty());if(this._sharedState=new zS.MeterProviderSharedState(n),e?.views!=null&&e.views.length>0)for(let i of e.views)this._sharedState.viewRegistry.addView(i)}getMeter(e,t="",n={}){return this._shutdown?(ps.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,ps.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}addMetricReader(e){let t=new YS.MetricCollector(this._sharedState,e);e.setMetricProducer(t),this._sharedState.metricCollectors.push(t)}async shutdown(e){if(this._shutdown){ps.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){ps.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};hs.MeterProvider=yu});var fs=l(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.ExactPredicate=Jt.PatternPredicate=void 0;var QS=/[\^$\\.+?()[\]{}|]/g,vu=class r{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(QS,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};Jt.PatternPredicate=vu;var Iu=class{constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};Jt.ExactPredicate=Iu});var np=l(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.InstrumentSelector=void 0;var rp=fs(),Lu=class{constructor(e){var t;this._nameFilter=new rp.PatternPredicate((t=e?.name)!==null&&t!==void 0?t:"*"),this._type=e?.type,this._unitFilter=new rp.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};Es.InstrumentSelector=Lu});var ip=l(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.MeterSelector=void 0;var Mu=fs(),Nu=class{constructor(e){this._nameFilter=new Mu.ExactPredicate(e?.name),this._versionFilter=new Mu.ExactPredicate(e?.version),this._schemaUrlFilter=new Mu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};ms.MeterSelector=Nu});var op=l(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.View=void 0;var ZS=fs(),sp=Ou(),JS=np(),eA=ip(),tA=Fi();function rA(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}var Cu=class{constructor(e){var t;if(rA(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||ZS.PatternPredicate.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");e.attributeKeys!=null?this.attributesProcessor=new sp.FilteringAttributesProcessor(e.attributeKeys):this.attributesProcessor=sp.AttributesProcessor.Noop(),this.name=e.name,this.description=e.description,this.aggregation=(t=e.aggregation)!==null&&t!==void 0?t:tA.Aggregation.Default(),this.instrumentSelector=new JS.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new eA.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl})}};gs.View=Cu});var wu=l(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.TimeoutError=g.View=g.Aggregation=g.SumAggregation=g.LastValueAggregation=g.HistogramAggregation=g.DropAggregation=g.ExponentialHistogramAggregation=g.ExplicitBucketHistogramAggregation=g.DefaultAggregation=g.MeterProvider=g.InstrumentType=g.ConsoleMetricExporter=g.InMemoryMetricExporter=g.PeriodicExportingMetricReader=g.MetricReader=g.DataPointType=g.AggregationTemporality=void 0;var nA=Li();Object.defineProperty(g,"AggregationTemporality",{enumerable:!0,get:function(){return nA.AggregationTemporality}});var iA=wt();Object.defineProperty(g,"DataPointType",{enumerable:!0,get:function(){return iA.DataPointType}});var sA=Ka();Object.defineProperty(g,"MetricReader",{enumerable:!0,get:function(){return sA.MetricReader}});var oA=L_();Object.defineProperty(g,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return oA.PeriodicExportingMetricReader}});var aA=N_();Object.defineProperty(g,"InMemoryMetricExporter",{enumerable:!0,get:function(){return aA.InMemoryMetricExporter}});var uA=w_();Object.defineProperty(g,"ConsoleMetricExporter",{enumerable:!0,get:function(){return uA.ConsoleMetricExporter}});var cA=be();Object.defineProperty(g,"InstrumentType",{enumerable:!0,get:function(){return cA.InstrumentType}});var lA=tp();Object.defineProperty(g,"MeterProvider",{enumerable:!0,get:function(){return lA.MeterProvider}});var xe=Fi();Object.defineProperty(g,"DefaultAggregation",{enumerable:!0,get:function(){return xe.DefaultAggregation}});Object.defineProperty(g,"ExplicitBucketHistogramAggregation",{enumerable:!0,get:function(){return xe.ExplicitBucketHistogramAggregation}});Object.defineProperty(g,"ExponentialHistogramAggregation",{enumerable:!0,get:function(){return xe.ExponentialHistogramAggregation}});Object.defineProperty(g,"DropAggregation",{enumerable:!0,get:function(){return xe.DropAggregation}});Object.defineProperty(g,"HistogramAggregation",{enumerable:!0,get:function(){return xe.HistogramAggregation}});Object.defineProperty(g,"LastValueAggregation",{enumerable:!0,get:function(){return xe.LastValueAggregation}});Object.defineProperty(g,"SumAggregation",{enumerable:!0,get:function(){return xe.SumAggregation}});Object.defineProperty(g,"Aggregation",{enumerable:!0,get:function(){return xe.Aggregation}});var dA=op();Object.defineProperty(g,"View",{enumerable:!0,get:function(){return dA.View}});var _A=fe();Object.defineProperty(g,"TimeoutError",{enumerable:!0,get:function(){return _A.TimeoutError}})});var ap=l(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.AbstractAsyncHooksContextManager=void 0;var pA=z("events"),hA=["addListener","on","once","prependListener","prependOnceListener"],xu=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(e,t){return t instanceof pA.EventEmitter?this._bindEventEmitter(e,t):typeof t=="function"?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,i=function(...s){return n.with(e,()=>t.apply(this,s))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),i}_bindEventEmitter(e,t){return this._getPatchMap(t)!==void 0||(this._createPatchMap(t),hA.forEach(i=>{t[i]!==void 0&&(t[i]=this._patchAddListener(t,t[i],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(i,s){var o;let a=(o=n._getPatchMap(e))===null||o===void 0?void 0:o[i];if(a===void 0)return t.call(this,i,s);let u=a.get(s);return t.call(this,i,u||s)}}_patchRemoveAllListeners(e,t){let n=this;return function(i){let s=n._getPatchMap(e);return s!==void 0&&(arguments.length===0?n._createPatchMap(e):s[i]!==void 0&&delete s[i]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let i=this;return function(s,o){if(i._wrapped)return t.call(this,s,o);let a=i._getPatchMap(e);a===void 0&&(a=i._createPatchMap(e));let u=a[s];u===void 0&&(u=new WeakMap,a[s]=u);let c=i.bind(n,o);u.set(o,c),i._wrapped=!0;try{return t.call(this,s,c)}finally{i._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}};Ts.AbstractAsyncHooksContextManager=xu});var up=l(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.AsyncLocalStorageContextManager=void 0;var fA=(h(),m(d)),EA=z("async_hooks"),mA=ap(),Du=class extends mA.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new EA.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:fA.ROOT_CONTEXT}with(e,t,n,...i){let s=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Ss.AsyncLocalStorageContextManager=Du});var Ur=l(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.toAnyValue=De.toKeyValue=De.toAttributes=void 0;function RA(r){return Object.keys(r).map(e=>Gu(e,r[e]))}De.toAttributes=RA;function Gu(r,e){return{key:r,value:Vu(e)}}De.toKeyValue=Gu;function Vu(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(Vu)}}:e==="object"&&r!=null?{kvlistValue:{values:Object.entries(r).map(([t,n])=>Gu(t,n))}}:{}}De.toAnyValue=Vu});var Op=l(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.toOtlpSpanEvent=Ue.toOtlpLink=Ue.sdkSpanToOtlpSpan=void 0;var Hu=Ur();function bA(r,e){var t;let n=r.spanContext(),i=r.status;return{traceId:e.encodeSpanContext(n.traceId),spanId:e.encodeSpanContext(n.spanId),parentSpanId:e.encodeOptionalSpanContext(r.parentSpanId),traceState:(t=n.traceState)===null||t===void 0?void 0:t.serialize(),name:r.name,kind:r.kind==null?0:r.kind+1,startTimeUnixNano:e.encodeHrTime(r.startTime),endTimeUnixNano:e.encodeHrTime(r.endTime),attributes:(0,Hu.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>Ap(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:i.code,message:i.message},links:r.links.map(s=>Sp(s,e)),droppedLinksCount:r.droppedLinksCount}}Ue.sdkSpanToOtlpSpan=bA;function Sp(r,e){var t;return{attributes:r.attributes?(0,Hu.toAttributes)(r.attributes):[],spanId:e.encodeSpanContext(r.context.spanId),traceId:e.encodeSpanContext(r.context.traceId),traceState:(t=r.context.traceState)===null||t===void 0?void 0:t.serialize(),droppedAttributesCount:r.droppedAttributesCount||0}}Ue.toOtlpLink=Sp;function Ap(r,e){return{attributes:r.attributes?(0,Hu.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}Ue.toOtlpSpanEvent=Ap});var Br=l(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.getOtlpEncoder=se.encodeAsString=se.encodeAsLongBits=se.toLongBits=se.hrTimeToNanos=void 0;var bs=A(),PA=BigInt(1e9);function ju(r){return BigInt(r[0])*PA+BigInt(r[1])}se.hrTimeToNanos=ju;function bp(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}se.toLongBits=bp;function Fu(r){let e=ju(r);return bp(e)}se.encodeAsLongBits=Fu;function Pp(r){return ju(r).toString()}se.encodeAsString=Pp;var yA=typeof BigInt<"u"?Pp:bs.hrTimeToNanoseconds;function Rp(r){return r}function yp(r){if(r!==void 0)return(0,bs.hexToBase64)(r)}var vA={encodeHrTime:Fu,encodeSpanContext:bs.hexToBase64,encodeOptionalSpanContext:yp};function IA(r){var e,t;if(r===void 0)return vA;let n=(e=r.useLongBits)!==null&&e!==void 0?e:!0,i=(t=r.useHex)!==null&&t!==void 0?t:!1;return{encodeHrTime:n?Fu:yA,encodeSpanContext:i?Rp:bs.hexToBase64,encodeOptionalSpanContext:i?Rp:yp}}se.getOtlpEncoder=IA});var ys=l(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.createExportTraceServiceRequest=void 0;var LA=Ur(),MA=Op(),NA=Br();function CA(r,e){let t=(0,NA.getOtlpEncoder)(e);return{resourceSpans:xA(r,t)}}Ps.createExportTraceServiceRequest=CA;function wA(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 i=`${t.instrumentationLibrary.name}@${t.instrumentationLibrary.version||""}:${t.instrumentationLibrary.schemaUrl||""}`,s=n.get(i);s||(s=[],n.set(i,s)),s.push(t)}return e}function xA(r,e){let t=wA(r),n=[],i=t.entries(),s=i.next();for(;!s.done;){let[o,a]=s.value,u=[],c=a.values(),_=c.next();for(;!_.done;){let f=_.value;if(f.length>0){let{name:L,version:R,schemaUrl:w}=f[0].instrumentationLibrary,U=f.map(S=>(0,MA.sdkSpanToOtlpSpan)(S,e));u.push({scope:{name:L,version:R},spans:U,schemaUrl:w})}_=c.next()}let p={resource:{attributes:(0,LA.toAttributes)(o.attributes),droppedAttributesCount:0},scopeSpans:u,schemaUrl:void 0};n.push(p),s=i.next()}return n}});var Lp=l(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.parseRetryAfterToMills=N.isExportRetryable=N.invalidTimeout=N.configureExporterTimeout=N.appendRootPathToUrlIfNeeded=N.appendResourcePathToUrl=N.parseHeaders=N.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=N.DEFAULT_EXPORT_MAX_BACKOFF=N.DEFAULT_EXPORT_INITIAL_BACKOFF=N.DEFAULT_EXPORT_MAX_ATTEMPTS=void 0;var ku=(h(),m(d)),vp=A(),Ip=1e4;N.DEFAULT_EXPORT_MAX_ATTEMPTS=5;N.DEFAULT_EXPORT_INITIAL_BACKOFF=1e3;N.DEFAULT_EXPORT_MAX_BACKOFF=5e3;N.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=1.5;function DA(r={}){let e={};return Object.entries(r).forEach(([t,n])=>{typeof n<"u"?e[t]=String(n):ku.diag.warn(`Header "${t}" has wrong value and will be ignored`)}),e}N.parseHeaders=DA;function UA(r,e){return r.endsWith("/")||(r=r+"/"),r+e}N.appendResourcePathToUrl=UA;function BA(r){try{let e=new URL(r);return e.pathname===""&&(e.pathname=e.pathname+"/"),e.toString()}catch{return ku.diag.warn(`Could not parse export URL: '${r}'`),r}}N.appendRootPathToUrlIfNeeded=BA;function qA(r){return typeof r=="number"?r<=0?$u(r,Ip):r:GA()}N.configureExporterTimeout=qA;function GA(){var r;let e=Number((r=(0,vp.getEnv)().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT)!==null&&r!==void 0?r:(0,vp.getEnv)().OTEL_EXPORTER_OTLP_TIMEOUT);return e<=0?$u(e,Ip):e}function $u(r,e){return ku.diag.warn("Timeout must be greater than 0",r),e}N.invalidTimeout=$u;function VA(r){return[429,502,503,504].includes(r)}N.isExportRetryable=VA;function HA(r){if(r==null)return-1;let e=Number.parseInt(r,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let t=new Date(r).getTime()-Date.now();return t>=0?t:0}N.parseRetryAfterToMills=HA});var Np=l(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.OTLPExporterBase=void 0;var Mp=(h(),m(d)),qr=A(),jA=Lp(),Xu=class{constructor(e={}){this._sendingPromises=[],this.url=this.getDefaultUrl(e),typeof e.hostname=="string"&&(this.hostname=e.hostname),this.shutdown=this.shutdown.bind(this),this._shutdownOnce=new qr.BindOnceFuture(this._shutdown,this),this._concurrencyLimit=typeof e.concurrencyLimit=="number"?e.concurrencyLimit:30,this.timeoutMillis=(0,jA.configureExporterTimeout)(e.timeoutMillis),this.onInit(e)}export(e,t){if(this._shutdownOnce.isCalled){t({code:qr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")});return}if(this._sendingPromises.length>=this._concurrencyLimit){t({code:qr.ExportResultCode.FAILED,error:new Error("Concurrent export limit reached")});return}this._export(e).then(()=>{t({code:qr.ExportResultCode.SUCCESS})}).catch(n=>{t({code:qr.ExportResultCode.FAILED,error:n})})}_export(e){return new Promise((t,n)=>{try{Mp.diag.debug("items to be sent",e),this.send(e,t,n)}catch(i){n(i)}})}shutdown(){return this._shutdownOnce.call()}forceFlush(){return Promise.all(this._sendingPromises).then(()=>{})}_shutdown(){return Mp.diag.debug("shutdown started"),this.onShutdown(),this.forceFlush()}};vs.OTLPExporterBase=Xu});var Dp=l((Ny,xp)=>{"use strict";xp.exports=$A;function $A(r,e){for(var t=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)t[n++]=arguments[i++];return new Promise(function(a,u){t[n]=function(_){if(s)if(s=!1,_)u(_);else{for(var p=new Array(arguments.length-1),f=0;f<p.length;)p[f++]=arguments[f];a.apply(null,p)}};try{r.apply(e||null,t)}catch(c){s&&(s=!1,u(c))}})}});var Gp=l(qp=>{"use strict";var Ls=qp;Ls.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 nr=new Array(64),Bp=new Array(123);for(ce=0;ce<64;)Bp[nr[ce]=ce<26?ce+65:ce<52?ce+71:ce<62?ce-4:ce-59|43]=ce++;var ce;Ls.encode=function(e,t,n){for(var i=null,s=[],o=0,a=0,u;t<n;){var c=e[t++];switch(a){case 0:s[o++]=nr[c>>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=nr[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=nr[u|c>>6],s[o++]=nr[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=nr[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var Up="invalid encoding";Ls.decode=function(e,t,n){for(var i=n,s=0,o,a=0;a<e.length;){var u=e.charCodeAt(a++);if(u===61&&s>1)break;if((u=Bp[u])===void 0)throw Error(Up);switch(s){case 0:o=u,s=1;break;case 1:t[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(Up);return n-i};Ls.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Hp=l((wy,Vp)=>{"use strict";Vp.exports=Ms;function Ms(){this._listeners={}}Ms.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};Ms.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],i=0;i<n.length;)n[i].fn===t?n.splice(i,1):++i;return this};Ms.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,n)}return this}});var Kp=l((xy,Wp)=>{"use strict";Wp.exports=jp(jp);function jp(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function i(u,c,_){e[0]=u,c[_]=t[0],c[_+1]=t[1],c[_+2]=t[2],c[_+3]=t[3]}function s(u,c,_){e[0]=u,c[_]=t[3],c[_+1]=t[2],c[_+2]=t[1],c[_+3]=t[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function o(u,c){return t[0]=u[c],t[1]=u[c+1],t[2]=u[c+2],t[3]=u[c+3],e[0]}function a(u,c){return t[3]=u[c],t[2]=u[c+1],t[1]=u[c+2],t[0]=u[c+3],e[0]}r.readFloatLE=n?o:a,r.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}r.writeFloatLE=e.bind(null,Fp),r.writeFloatBE=e.bind(null,kp);function t(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}r.readFloatLE=t.bind(null,$p),r.readFloatBE=t.bind(null,Xp)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function i(u,c,_){e[0]=u,c[_]=t[0],c[_+1]=t[1],c[_+2]=t[2],c[_+3]=t[3],c[_+4]=t[4],c[_+5]=t[5],c[_+6]=t[6],c[_+7]=t[7]}function s(u,c,_){e[0]=u,c[_]=t[7],c[_+1]=t[6],c[_+2]=t[5],c[_+3]=t[4],c[_+4]=t[3],c[_+5]=t[2],c[_+6]=t[1],c[_+7]=t[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function o(u,c){return t[0]=u[c],t[1]=u[c+1],t[2]=u[c+2],t[3]=u[c+3],t[4]=u[c+4],t[5]=u[c+5],t[6]=u[c+6],t[7]=u[c+7],e[0]}function a(u,c){return t[7]=u[c],t[6]=u[c+1],t[5]=u[c+2],t[4]=u[c+3],t[3]=u[c+4],t[2]=u[c+5],t[1]=u[c+6],t[0]=u[c+7],e[0]}r.readDoubleLE=n?o:a,r.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((c<<31|2146435072)>>>0,a,u+s);else{var _;if(o<22250738585072014e-324)_=o/5e-324,n(_>>>0,a,u+i),n((c<<31|_/4294967296)>>>0,a,u+s);else{var p=Math.floor(Math.log(o)/Math.LN2);p===1024&&(p=1023),_=o*Math.pow(2,-p),n(_*4503599627370496>>>0,a,u+i),n((c<<31|p+1023<<20|_*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,Fp,0,4),r.writeDoubleBE=e.bind(null,kp,4,0);function t(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),_=(c>>31)*2+1,p=c>>>20&2047,f=4294967296*(c&1048575)+u;return p===2047?f?NaN:_*(1/0):p===0?_*5e-324*f:_*Math.pow(2,p-1075)*(f+4503599627370496)}r.readDoubleLE=t.bind(null,$p,0,4),r.readDoubleBE=t.bind(null,Xp,4,0)}(),r}function Fp(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 kp(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 $p(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function Xp(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var zp=l((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 Qp=l(Yp=>{"use strict";var Ku=Yp;Ku.length=function(e){for(var t=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,t+=4):t+=3;return t};Ku.read=function(e,t,n){var i=n-t;if(i<1)return"";for(var s=null,o=[],a=0,u;t<n;)u=e[t++],u<128?o[a++]=u:u>191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};Ku.write=function(e,t,n){for(var i=n,s,o,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&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&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-i}});var Jp=l((Uy,Zp)=>{"use strict";Zp.exports=XA;function XA(r,e,t){var n=t||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return r(u);o+u>n&&(s=r(n),o=0);var c=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var th=l((By,eh)=>{"use strict";eh.exports=G;var Gr=qe();function G(r,e){this.lo=r>>>0,this.hi=e>>>0}var ct=G.zero=new G(0,0);ct.toNumber=function(){return 0};ct.zzEncode=ct.zzDecode=function(){return this};ct.length=function(){return 1};var WA=G.zeroHash="\0\0\0\0\0\0\0\0";G.fromNumber=function(e){if(e===0)return ct;var t=e<0;t&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new G(n,i)};G.from=function(e){if(typeof e=="number")return G.fromNumber(e);if(Gr.isString(e))if(Gr.Long)e=Gr.Long.fromString(e);else return G.fromNumber(parseInt(e,10));return e.low||e.high?new G(e.low>>>0,e.high>>>0):ct};G.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};G.prototype.toLong=function(e){return Gr.Long?new Gr.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Be=String.prototype.charCodeAt;G.fromHash=function(e){return e===WA?ct:new G((Be.call(e,0)|Be.call(e,1)<<8|Be.call(e,2)<<16|Be.call(e,3)<<24)>>>0,(Be.call(e,4)|Be.call(e,5)<<8|Be.call(e,6)<<16|Be.call(e,7)<<24)>>>0)};G.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)};G.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};G.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};G.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 qe=l(zu=>{"use strict";var E=zu;E.asPromise=Dp();E.base64=Gp();E.EventEmitter=Hp();E.float=Kp();E.inquire=zp();E.utf8=Qp();E.pool=Jp();E.LongBits=th();E.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);E.global=E.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||zu;E.emptyArray=Object.freeze?Object.freeze([]):[];E.emptyObject=Object.freeze?Object.freeze({}):{};E.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};E.isString=function(e){return typeof e=="string"||e instanceof String};E.isObject=function(e){return e&&typeof e=="object"};E.isset=E.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};E.Buffer=function(){try{var r=E.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();E._Buffer_from=null;E._Buffer_allocUnsafe=null;E.newBuffer=function(e){return typeof e=="number"?E.Buffer?E._Buffer_allocUnsafe(e):new E.Array(e):E.Buffer?E._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};E.Array=typeof Uint8Array<"u"?Uint8Array:Array;E.Long=E.global.dcodeIO&&E.global.dcodeIO.Long||E.global.Long||E.inquire("long");E.key2Re=/^true|false|0|1$/;E.key32Re=/^-?(?:0|[1-9][0-9]*)$/;E.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;E.longToHash=function(e){return e?E.LongBits.from(e).toHash():E.LongBits.zeroHash};E.longFromHash=function(e,t){var n=E.LongBits.fromHash(e);return E.Long?E.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function rh(r,e,t){for(var n=Object.keys(e),i=0;i<n.length;++i)(r[n[i]]===void 0||!t)&&(r[n[i]]=e[n[i]]);return r}E.merge=rh;E.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function nh(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&&rh(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}E.newError=nh;E.ProtocolError=nh("ProtocolError");E.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(t[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};E.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};E.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};E._configure=function(){var r=E.Buffer;if(!r){E._Buffer_from=E._Buffer_allocUnsafe=null;return}E._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},E._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var rc=l((Gy,ah)=>{"use strict";ah.exports=O;var oe=qe(),Yu,Ns=oe.LongBits,ih=oe.base64,sh=oe.utf8;function Vr(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Zu(){}function KA(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function O(){this.len=0,this.head=new Vr(Zu,0,0),this.tail=this.head,this.states=null}var oh=function(){return oe.Buffer?function(){return(O.create=function(){return new Yu})()}:function(){return new O}};O.create=oh();O.alloc=function(e){return new oe.Array(e)};oe.Array!==Array&&(O.alloc=oe.pool(O.alloc,oe.Array.prototype.subarray));O.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Vr(e,t,n),this.len+=t,this};function Ju(r,e,t){e[t]=r&255}function zA(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function ec(r,e){this.len=r,this.next=void 0,this.val=e}ec.prototype=Object.create(Vr.prototype);ec.prototype.fn=zA;O.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new ec((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};O.prototype.int32=function(e){return e<0?this._push(tc,10,Ns.fromNumber(e)):this.uint32(e)};O.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function tc(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}O.prototype.uint64=function(e){var t=Ns.from(e);return this._push(tc,t.length(),t)};O.prototype.int64=O.prototype.uint64;O.prototype.sint64=function(e){var t=Ns.from(e).zzEncode();return this._push(tc,t.length(),t)};O.prototype.bool=function(e){return this._push(Ju,1,e?1:0)};function Qu(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}O.prototype.fixed32=function(e){return this._push(Qu,4,e>>>0)};O.prototype.sfixed32=O.prototype.fixed32;O.prototype.fixed64=function(e){var t=Ns.from(e);return this._push(Qu,4,t.lo)._push(Qu,4,t.hi)};O.prototype.sfixed64=O.prototype.fixed64;O.prototype.float=function(e){return this._push(oe.float.writeFloatLE,4,e)};O.prototype.double=function(e){return this._push(oe.float.writeDoubleLE,8,e)};var YA=oe.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var i=0;i<e.length;++i)t[n+i]=e[i]};O.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(Ju,1,0);if(oe.isString(e)){var n=O.alloc(t=ih.length(e));ih.decode(e,n,0),e=n}return this.uint32(t)._push(YA,t,e)};O.prototype.string=function(e){var t=sh.length(e);return t?this.uint32(t)._push(sh.write,t,e):this._push(Ju,1,0)};O.prototype.fork=function(){return this.states=new KA(this),this.head=this.tail=new Vr(Zu,0,0),this.len=0,this};O.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 Vr(Zu,0,0),this.len=0),this};O.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};O.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};O._configure=function(r){Yu=r,O.create=oh(),Yu._configure()}});var lh=l((Vy,ch)=>{"use strict";ch.exports=ge;var uh=rc();(ge.prototype=Object.create(uh.prototype)).constructor=ge;var Ge=qe();function ge(){uh.call(this)}ge._configure=function(){ge.alloc=Ge._Buffer_allocUnsafe,ge.writeBytesBuffer=Ge.Buffer&&Ge.Buffer.prototype instanceof Uint8Array&&Ge.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 i=0;i<e.length;)t[n++]=e[i++]}};ge.prototype.bytes=function(e){Ge.isString(e)&&(e=Ge._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(ge.writeBytesBuffer,t,e),this};function QA(r,e,t){r.length<40?Ge.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}ge.prototype.string=function(e){var t=Ge.Buffer.byteLength(e);return this.uint32(t),t&&this._push(QA,t,e),this};ge._configure()});var sc=l((Hy,fh)=>{"use strict";fh.exports=x;var le=qe(),ic,ph=le.LongBits,ZA=le.utf8;function de(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 dh=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")},hh=function(){return le.Buffer?function(t){return(x.create=function(i){return le.Buffer.isBuffer(i)?new ic(i):dh(i)})(t)}:dh};x.create=hh();x.prototype._slice=le.Array.prototype.subarray||le.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,de(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 nc(){var r=new ph(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 de(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 de(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 Cs(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 de(this,4);return Cs(this.buf,this.pos+=4)};x.prototype.sfixed32=function(){if(this.pos+4>this.len)throw de(this,4);return Cs(this.buf,this.pos+=4)|0};function _h(){if(this.pos+8>this.len)throw de(this,8);return new ph(Cs(this.buf,this.pos+=4),Cs(this.buf,this.pos+=4))}x.prototype.float=function(){if(this.pos+4>this.len)throw de(this,4);var e=le.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};x.prototype.double=function(){if(this.pos+8>this.len)throw de(this,4);var e=le.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 de(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var i=le.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};x.prototype.string=function(){var e=this.bytes();return ZA.read(e,0,e.length)};x.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw de(this,e);this.pos+=e}else do if(this.pos>=this.len)throw de(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){ic=r,x.create=hh(),ic._configure();var e=le.Long?"toLong":"toNumber";le.merge(x.prototype,{int64:function(){return nc.call(this)[e](!1)},uint64:function(){return nc.call(this)[e](!0)},sint64:function(){return nc.call(this).zzDecode()[e](!1)},fixed64:function(){return _h.call(this)[e](!0)},sfixed64:function(){return _h.call(this)[e](!1)}})}});var Th=l((jy,gh)=>{"use strict";gh.exports=lt;var mh=sc();(lt.prototype=Object.create(mh.prototype)).constructor=lt;var Eh=qe();function lt(r){mh.call(this,r)}lt._configure=function(){Eh.Buffer&&(lt.prototype._slice=Eh.Buffer.prototype.slice)};lt.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))};lt._configure()});var Ah=l((Fy,Sh)=>{"use strict";Sh.exports=Hr;var oc=qe();(Hr.prototype=Object.create(oc.EventEmitter.prototype)).constructor=Hr;function Hr(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");oc.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Hr.prototype.rpcCall=function r(e,t,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return oc.asPromise(r,o,e,t,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,c){if(u)return o.emit("error",u,e),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(_){return o.emit("error",_,e),s(_)}return o.emit("data",c,e),s(null,c)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Hr.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Rh=l(Oh=>{"use strict";var JA=Oh;JA.Service=Ah()});var Ph=l(($y,bh)=>{"use strict";bh.exports={}});var Ih=l(vh=>{"use strict";var J=vh;J.build="minimal";J.Writer=rc();J.BufferWriter=lh();J.Reader=sc();J.BufferReader=Th();J.util=qe();J.rpc=Rh();J.roots=Ph();J.configure=yh;function yh(){J.util._configure(),J.Writer._configure(J.BufferWriter),J.Reader._configure(J.BufferReader)}yh()});var Mh=l((Wy,Lh)=>{"use strict";Lh.exports=Ih()});var Vh=l(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0})});var jh=l(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0})});var kh=l(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0})});var $h=l(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.ESpanKind=void 0;var gO;(function(r){r[r.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",r[r.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",r[r.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",r[r.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",r[r.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",r[r.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"})(gO=Fr.ESpanKind||(Fr.ESpanKind={}))});var Wh=l(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0})});var Zh=l(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.toMetric=Ve.toScopeMetrics=Ve.toResourceMetrics=void 0;var Kh=(h(),m(d)),or=wu(),Ds=Ur(),TO=Br();function SO(r,e){let t=(0,TO.getOtlpEncoder)(e);return{resource:{attributes:(0,Ds.toAttributes)(r.resource.attributes),droppedAttributesCount:0},schemaUrl:void 0,scopeMetrics:Yh(r.scopeMetrics,t)}}Ve.toResourceMetrics=SO;function Yh(r,e){return Array.from(r.map(t=>({scope:{name:t.scope.name,version:t.scope.version},metrics:t.metrics.map(n=>Qh(n,e)),schemaUrl:t.scope.schemaUrl})))}Ve.toScopeMetrics=Yh;function Qh(r,e){let t={name:r.descriptor.name,description:r.descriptor.description,unit:r.descriptor.unit},n=bO(r.aggregationTemporality);switch(r.dataPointType){case or.DataPointType.SUM:t.sum={aggregationTemporality:n,isMonotonic:r.isMonotonic,dataPoints:zh(r,e)};break;case or.DataPointType.GAUGE:t.gauge={dataPoints:zh(r,e)};break;case or.DataPointType.HISTOGRAM:t.histogram={aggregationTemporality:n,dataPoints:OO(r,e)};break;case or.DataPointType.EXPONENTIAL_HISTOGRAM:t.exponentialHistogram={aggregationTemporality:n,dataPoints:RO(r,e)};break}return t}Ve.toMetric=Qh;function AO(r,e,t){let n={attributes:(0,Ds.toAttributes)(r.attributes),startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)};switch(e){case Kh.ValueType.INT:n.asInt=r.value;break;case Kh.ValueType.DOUBLE:n.asDouble=r.value;break}return n}function zh(r,e){return r.dataPoints.map(t=>AO(t,r.descriptor.valueType,e))}function OO(r,e){return r.dataPoints.map(t=>{let n=t.value;return{attributes:(0,Ds.toAttributes)(t.attributes),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(t.startTime),timeUnixNano:e.encodeHrTime(t.endTime)}})}function RO(r,e){return r.dataPoints.map(t=>{let n=t.value;return{attributes:(0,Ds.toAttributes)(t.attributes),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(t.startTime),timeUnixNano:e.encodeHrTime(t.endTime)}})}function bO(r){switch(r){case or.AggregationTemporality.DELTA:return 1;case or.AggregationTemporality.CUMULATIVE:return 2}}});var Jh=l(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.createExportMetricsServiceRequest=void 0;var PO=Zh();function yO(r,e){return{resourceMetrics:r.map(t=>(0,PO.toResourceMetrics)(t,e))}}Us.createExportMetricsServiceRequest=yO});var tf=l(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.toLogAttributes=ar.createExportLogsServiceRequest=void 0;var vO=Br(),lc=Ur();function IO(r,e){let t=(0,vO.getOtlpEncoder)(e);return{resourceLogs:MO(r,t)}}ar.createExportLogsServiceRequest=IO;function LO(r){let e=new Map;for(let t of r){let{resource:n,instrumentationScope:{name:i,version:s="",schemaUrl:o=""}}=t,a=e.get(n);a||(a=new Map,e.set(n,a));let u=`${i}@${s}:${o}`,c=a.get(u);c||(c=[],a.set(u,c)),c.push(t)}return e}function MO(r,e){let t=LO(r);return Array.from(t,([n,i])=>({resource:{attributes:(0,lc.toAttributes)(n.attributes),droppedAttributesCount:0},scopeLogs:Array.from(i,([,s])=>{let{instrumentationScope:{name:o,version:a,schemaUrl:u}}=s[0];return{scope:{name:o,version:a},logRecords:s.map(c=>NO(c,e)),schemaUrl:u}}),schemaUrl:void 0}))}function NO(r,e){var t,n,i;return{timeUnixNano:e.encodeHrTime(r.hrTime),observedTimeUnixNano:e.encodeHrTime(r.hrTimeObserved),severityNumber:r.severityNumber,severityText:r.severityText,body:(0,lc.toAnyValue)(r.body),attributes:ef(r.attributes),droppedAttributesCount:r.droppedAttributesCount,flags:(t=r.spanContext)===null||t===void 0?void 0:t.traceFlags,traceId:e.encodeOptionalSpanContext((n=r.spanContext)===null||n===void 0?void 0:n.traceId),spanId:e.encodeOptionalSpanContext((i=r.spanContext)===null||i===void 0?void 0:i.spanId)}}function ef(r){return Object.keys(r).map(e=>(0,lc.toKeyValue)(e,r[e]))}ar.toLogAttributes=ef});var rf=l(V=>{"use strict";var CO=V&&V.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),ur=V&&V.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&CO(e,r,t)};Object.defineProperty(V,"__esModule",{value:!0});V.createExportLogsServiceRequest=V.createExportMetricsServiceRequest=V.createExportTraceServiceRequest=void 0;ur(Vh(),V);ur(Br(),V);ur(jh(),V);ur(kh(),V);ur($h(),V);ur(Wh(),V);var wO=ys();Object.defineProperty(V,"createExportTraceServiceRequest",{enumerable:!0,get:function(){return wO.createExportTraceServiceRequest}});var xO=Jh();Object.defineProperty(V,"createExportMetricsServiceRequest",{enumerable:!0,get:function(){return xO.createExportMetricsServiceRequest}});var DO=tf();Object.defineProperty(V,"createExportLogsServiceRequest",{enumerable:!0,get:function(){return DO.createExportLogsServiceRequest}})});var C=Y(la(),1);h();fa();var af=Y(Gd(),1),lr=Y(rt(),1),uf=Y(t_(),1),cf=Y(wu(),1),Vs=Y(Yr(),1),lf=Y(up(),1),He=Y(A(),1);var cp="http.method",lp="http.url",As="http.host",dp="http.scheme",Uu="http.status_code",_p="http.user_agent",Bu="http.response_content_length_uncompressed",pp="net.peer.port",hp="net.peer.name";var fp="service.name",Ep="service.version";h();var gA=Symbol.for("@vercel/request-context");function me(){return globalThis[gA]?.get()}function Os(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function mp(r){return r?r.split("::").at(-1):void 0}function gp(r=me(),e){if(!r)return;let t=e?SA(e,r.headers):void 0;return Os({[As]:r.headers.host,[_p]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":mp(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":process.env.VERCEL_REGION,...t})}var TA={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function SA(r,e){if(typeof r=="function")return r(e,TA);let t={};for(let[n,i]of Object.entries(r)){let s=e[i.toLocaleLowerCase()];s!==void 0&&(t[n]=s)}return t}h();function er(r){return(r&d.TraceFlags.SAMPLED)!==0}var Rs=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=>{d.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:i,traceFlags:s}=e.spanContext(),o=!e.parentSpanId||!this.rootSpanIds.has(n);if(o?this.rootSpanIds.set(n,{rootSpanId:i,open:[]}):this.rootSpanIds.get(n)?.open.push(e),o&&er(s)){let a=me(),u=gp(a,this.attributesFromHeaders);u&&e.setAttributes(u),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let c=new Promise(p=>{this.waitSpanEnd.set(n,p)}),_;await Promise.race([c,new Promise(p=>{_=setTimeout(()=>{this.waitSpanEnd.delete(n),p(void 0)},50)})]),_&&clearTimeout(_)}return this.forceFlush()})}for(let a of this.processors)a.onStart(e,t)}onEnd(e){let{traceId:t,spanId:n,traceFlags:i}=e.spanContext(),s=er(i),o=this.rootSpanIds.get(t),a=o?.rootSpanId===n;if(s){let u=OA(e);u&&Object.assign(e.attributes,u)}if(a){if(this.rootSpanIds.delete(t),o.open.length>0){for(let u of o.open)if(!u.ended&&u.spanContext().spanId!==n)try{u.end()}catch(c){d.diag.error("@vercel/otel: onEnd failed:",c)}}}else if(o)for(let u=0;u<o.open.length;u++)o.open[u]?.spanContext().spanId===n&&o.open.splice(u,1);for(let u of this.processors)u.onEnd(e);if(a){let u=this.waitSpanEnd.get(t);u&&(this.waitSpanEnd.delete(t),u())}}},AA={[d.SpanKind.INTERNAL]:"internal",[d.SpanKind.SERVER]:"server",[d.SpanKind.CLIENT]:"client",[d.SpanKind.PRODUCER]:"producer",[d.SpanKind.CONSUMER]:"consumer"};function OA(r){let{kind:e,attributes:t}=r,{"operation.name":n,"resource.name":i,"span.type":s,"next.span_type":o,"http.method":a,"http.route":u}=t;if(n)return;let c=i??(a&&typeof a=="string"&&u&&typeof u=="string"?`${a} ${u}`:u);if(r.kind===d.SpanKind.SERVER&&a&&u&&typeof a=="string"&&typeof u=="string")return{"operation.name":"web.request","resource.name":c};let _=r.instrumentationLibrary.name,p=o??s;if(p&&typeof p=="string"){let f=Tp(_,p);return u?{"operation.name":f,"resource.name":c}:{"operation.name":f}}return{"operation.name":Tp(_,e===d.SpanKind.INTERNAL?"":AA[e])}}function Tp(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var wp=Y(ys(),1);var Cp=Y(Np(),1);h();var tr=class extends Cp.OTLPExporterBase{constructor(e={}){super(e),e.headers&&(this._headers=e.headers)}onShutdown(){d.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){d.diag.debug("@vercel/otel/otlp: onInit")}send(e,t,n){if(this._shutdownOnce.isCalled){d.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}let i=this.convert(e),s,o,a;try{({body:s,contentType:o,headers:a}=this.toMessage(i))}catch(c){d.diag.warn("@vercel/otel/otlp: no proto",c);return}let u=fetch(this.url,{method:"POST",body:s,headers:{...this._headers,...a,"Content-Type":o,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(c=>{d.diag.debug("@vercel/otel/otlp: onSuccess",c.status,c.statusText),t(),c.arrayBuffer().catch(()=>{})}).catch(c=>{d.diag.error("@vercel/otel/otlp: onError",c),n(c)}).finally(()=>{let c=this._sendingPromises.indexOf(u);this._sendingPromises.splice(c,1)});this._sendingPromises.push(u)}getDefaultUrl(e){throw new Error("Method not implemented.")}};var FA="v1/traces",kA=`http://localhost:4318/${FA}`;function Is(r){return typeof r.url=="string"?r.url:kA}var rr=class{constructor(e={}){this.impl=new Wu(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},Wu=class extends tr{convert(e){return(0,wp.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1})}toMessage(e){return{body:JSON.stringify(e),contentType:"application/json"}}getDefaultUrl(e){return Is(e)}};var xh=Y(ys(),1);var Nh=Y(Mh(),1);function Ch(r){let e=new Nh.Writer;return eO(r,e),e.finish()}function eO(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)tO(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function tO(r,e){if(r.resource!=null&&rO(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)nO(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function rO(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)ir(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function nO(r,e){if(r.scope!=null&&oO(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)aO(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function ir(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&wh(r.value,e.uint32(18).fork()).ldelim(),e}function wh(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&&iO(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&sO(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function iO(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)wh(r.values[t],e.uint32(10).fork()).ldelim();return e}function sO(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)ir(r.values[t],e.uint32(10).fork()).ldelim();return e}function oO(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)ir(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function aO(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)ir(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)cO(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)lO(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&uO(r.status,e.uint32(122).fork()).ldelim(),e}function uO(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function cO(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)ir(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function lO(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)ir(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var dt=class{constructor(e={}){this.impl=new ac(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},ac=class extends tr{convert(e){return(0,xh.createExportTraceServiceRequest)(e,void 0)}toMessage(e){return{body:Ch(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Is(e)}};h();function Dh(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let i=e[n];return i!==void 0?String(i):t})}var sr=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 i=e.toString();return n.some(s=>typeof s=="string"?s==="*"?!0:i.startsWith(s):s.test(i))}shouldPropagate(e,t){let n=process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||null,i=process.env.VERCEL_BRANCH_URL||process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL||null,s=this.config.propagateContextUrls??[],o=this.config.dontPropagateContextUrls??[];if(t?.opentelemetry?.propagateContext)return t.opentelemetry.propagateContext;let a=e.toString();return o.length>0&&o.some(u=>typeof u=="string"?u==="*"?!0:a.startsWith(u):u.test(a))?!1:n&&e.protocol==="https:"&&(e.host===n||e.host===i||e.host===me()?.headers.host)||!n&&e.protocol==="http:"&&e.hostname==="localhost"?!0:s.some(u=>typeof u=="string"?u==="*"?!0:a.startsWith(u):u.test(a))}startSpan({tracer:e,url:t,fetchType:n,method:i="GET",name:s,attributes:o={}}){let a=this.config.resourceNameTemplate,u={[cp]:i,[lp]:t.toString(),[As]:t.host,[dp]:t.protocol.replace(":",""),[hp]:t.hostname,[pp]:t.port},c=a?Dh(a,u):pO(t.toString()),_=s??`${n} ${i} ${t.toString()}`,p=d.context.active();return e.startSpan(_,{kind:d.SpanKind.CLIENT,attributes:{...u,"operation.name":`${n}.${i}`,"http.client.name":n,"resource.name":c,...o}},p)}instrumentHttp(e,t){let{tracerProvider:n}=this;if(!n)return;let i=n.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:s,attributesFromResponseHeaders:o}=this.config,a=e.request,u=e.get,c=_=>(p,f,L)=>{let R,w={},U;if(typeof p=="string"||p instanceof URL?(R=new URL(p.toString()),typeof f=="function"?U=f:f&&typeof L=="function"?(w=f,U=L):f&&(w=f)):(w=p,typeof f=="function"&&(U=f),R=fO(w,t)),this.shouldIgnore(R))return _.apply(this,[R,w,U]);let S=this.startSpan({tracer:i,url:R,fetchType:"http",method:w.method||"GET"});if(!S.isRecording()||!er(S.spanContext().traceFlags))return S.end(),_.apply(this,[R,w,U]);if(this.shouldPropagate(R)){let Te=d.context.active(),Se=d.trace.setSpan(Te,S);d.propagation.inject(Se,w.headers||{},_O)}s&&ws(S,s,w.headers||{},Bh);try{let Te=Date.now(),Se=_.apply(this,[R,w,U]);return Se.prependListener("response",K=>{let pt=Date.now()-Te;S.setAttribute("http.response_time",pt),K.statusCode!==void 0?(S.setAttribute(Uu,K.statusCode),K.statusCode>=500&&_t(S,`Status: ${K.statusCode}`)):_t(S,"Response status code is undefined"),o&&ws(S,o,K.headers,Bh),Se.listenerCount("response")<=1&&K.resume(),K.on("end",()=>{let kr,Hs=K.statusCode;K.aborted&&!K.complete?kr={code:d.SpanStatusCode.ERROR}:Hs&&Hs>=100&&Hs<500?kr={code:d.SpanStatusCode.UNSET}:kr={code:d.SpanStatusCode.ERROR},S.setStatus(kr),S.isRecording()&&(K.headers["content-length"]&&S.setAttribute(Bu,K.headers["content-length"]),S.end())})}),Se.on("error",K=>{S.isRecording()&&(_t(S,K),S.end())}),Se.on("close",()=>{S.isRecording()&&S.end()}),Se}catch(Te){throw _t(S,Te),S.end(),Te}};e.request=c(a),e.get=c(u)}instrumentFetch(){let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:n,attributesFromResponseHeaders:i}=this.config;process.env.NEXT_OTEL_FETCH_DISABLED="1";let s=globalThis.fetch;this.originalFetch=s;let o=async(a,u)=>{let c=u;if(c?.next?.internal)return s(a,c);let _=new Request(a instanceof Request?a.clone():a,c),p=new URL(_.url);if(this.shouldIgnore(p,c))return s(a,c);let f=this.startSpan({tracer:t,url:p,fetchType:"fetch",method:_.method,name:c?.opentelemetry?.spanName,attributes:c?.opentelemetry?.attributes});if(!f.isRecording()||!er(f.spanContext().traceFlags))return f.end(),s(a,c);if(this.shouldPropagate(p,c)){let L=d.context.active(),R=d.trace.setSpan(L,f);d.propagation.inject(R,_.headers,dO)}n&&ws(f,n,_.headers,Uh);try{let L=Date.now();c?.body&&c.body instanceof FormData&&_.headers.delete("content-type");let R=await s(a,{...c,headers:_.headers}),w=Date.now()-L;return f.setAttribute(Uu,R.status),f.setAttribute("http.response_time",w),i&&ws(f,i,R.headers,Uh),R.status>=500&&_t(f,`Status: ${R.status} (${R.statusText})`),R.body?hO(R).then(U=>{f.isRecording()&&(f.setAttribute(Bu,U),f.end())},U=>{f.isRecording()&&(_t(f,U),f.end())}):f.end(),R}catch(L){throw _t(f,L),f.end(),L}};globalThis.fetch=o}enable(){this.disable(),this.instrumentFetch();try{let e=z("node:http"),t=z("node:https");this.instrumentHttp(e,"http:"),this.instrumentHttp(t,"https:")}catch{}}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},dO={set(r,e,t){r.set(e,t)}},Uh={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}},_O={set(r,e,t){r[e.toLowerCase()]=t}},Bh={get(r,e){return r[e.toLowerCase()]},keys(r){return Object.keys(r)}};function pO(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function hO(r){let e=0,n=r.clone().body?.getReader();if(!n)return Promise.resolve(0);let i=()=>n.read().then(({done:s,value:o})=>{if(!s)return e+=o.byteLength,i()});return i().then(()=>e)}function _t(r,e){if(e instanceof Error)r.recordException(e),r.setStatus({code:d.SpanStatusCode.ERROR,message:e.message});else{let t=String(e);r.setStatus({code:d.SpanStatusCode.ERROR,message:t})}}function ws(r,e,t,n){for(let[i,s]of Object.entries(e)){let o=n.get(t,s);o!==void 0&&r.setAttribute(i,o)}}function fO(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,i=r.port??r.defaultPort;if(!n&&r.host){let c=r.host.split(":");n=c[0];let _=c[1];if(c.length>1&&_&&i===void 0){let p=parseInt(_,10);isNaN(p)||(i=p)}}n||(n="localhost");let s;if(i!==void 0&&i!==""){let c=parseInt(String(i),10);isNaN(c)?s=t==="https:"?443:80:s=c}else s=t==="https:"?443:80;let o=r.path||"/",a=`${t}//${n}:${s}`,u=new URL(o,a);if(r.auth){let c=r.auth.split(":");u.username=decodeURIComponent(c[0]||""),c.length>1&&(u.password=decodeURIComponent(c[1]||""))}return u}h();var qh=Y(A(),1),EO="00",uc="traceparent",cc="tracestate",jr=class{fields(){return[uc,cc]}inject(e,t,n){let i=d.trace.getSpanContext(e);if(!i||(0,qh.isTracingSuppressed)(e)||!(0,d.isSpanContextValid)(i))return;let s=`${EO}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||0).toString(16)}`;n.set(t,uc,s),i.traceState&&n.set(t,cc,i.traceState.serialize())}extract(e,t,n){let i=n.get(t,uc);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=mO(s);if(!o)return e;o.isRemote=!0;let a=n.get(t,cc);if(a){let u=Array.isArray(a)?a.join(","):a;o.traceState=(0,d.createTraceState)(typeof u=="string"?u:void 0)}return d.trace.setSpanContext(e,o)}};function mO(r){let[e,t,n,i,s]=r.split("-");return!e||!t||!n||!i||e.length!==2||t.length!==32||n.length!==16||i.length!==2||e==="00"&&s?null:{traceId:t,spanId:n,traceFlags:parseInt(i,16)}}h();var xs=class{fields(){return[]}inject(){}extract(e){let t=me();if(!t?.telemetry)return d.diag.warn("@vercel/otel: Vercel telemetry extension not found."),e;let{rootSpanContext:n}=t.telemetry;return n?(d.diag.debug("@vercel/otel: Extracted root SpanContext from Vercel request context.",n),d.trace.setSpanContext(e,{...n,isRemote:!0,traceFlags:n.traceFlags||d.TraceFlags.SAMPLED})):e}};h();var Bs=Y(A(),1),nf=Y(rf(),1);var qs=class{export(e,t){let n=me();if(!n?.telemetry){d.diag.warn("@vercel/otel: no telemetry context found"),t({code:Bs.ExportResultCode.SUCCESS,error:void 0});return}try{let i=(0,nf.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1});n.telemetry.reportSpans(i),t({code:Bs.ExportResultCode.SUCCESS,error:void 0})}catch(i){t({code:Bs.ExportResultCode.FAILED,error:i instanceof Error?i:new Error(String(i))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};var UO={ALL:d.DiagLogLevel.ALL,VERBOSE:d.DiagLogLevel.VERBOSE,DEBUG:d.DiagLogLevel.DEBUG,INFO:d.DiagLogLevel.INFO,WARN:d.DiagLogLevel.WARN,ERROR:d.DiagLogLevel.ERROR,NONE:d.DiagLogLevel.NONE},Gs=class{constructor(e={}){this.configuration=e}start(){let e=BO(),t=this.configuration,n=process.env.NEXT_RUNTIME||"nodejs",i=!!e.OTEL_SDK_DISABLED;if(process.env.OTEL_LOG_LEVEL&&d.diag.setLogger(new d.DiagConsoleLogger,{logLevel:UO[process.env.OTEL_LOG_LEVEL.toUpperCase()]}),i)return;let s=t.idGenerator??new C.RandomIdGenerator,o=t.contextManager??new lf.AsyncLocalStorageContextManager;o.enable(),this.contextManager=o;let a=e.OTEL_SERVICE_NAME||t.serviceName||"app",u=new lr.Resource(Os({[fp]:a,"node.ci":process.env.CI?!0:void 0,"node.env":process.env.NODE_ENV,env:process.env.VERCEL_ENV||process.env.NEXT_PUBLIC_VERCEL_ENV,"vercel.region":process.env.VERCEL_REGION,"vercel.runtime":n,"vercel.sha":process.env.VERCEL_GIT_COMMIT_SHA||process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,"vercel.host":process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||void 0,"vercel.branch_host":process.env.VERCEL_BRANCH_URL||process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL||void 0,"vercel.deployment_id":process.env.VERCEL_DEPLOYMENT_ID||void 0,[Ep]:process.env.VERCEL_DEPLOYMENT_ID,"vercel.project_id":process.env.VERCEL_PROJECT_ID||void 0,...t.attributes})),c=t.resourceDetectors??[lr.envDetectorSync];if(t.autoDetectResources??!0){let S={detectors:c};u=u.merge((0,lr.detectResourcesSync)(S))}let p=GO(t.propagators,t,e),f=VO(t.traceSampler,e),L=HO(t.spanProcessors,t,e);L.length===0&&d.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let R=t.spanLimits,w=new C.BasicTracerProvider({resource:u,idGenerator:s,sampler:f,spanLimits:R});if(w.addSpanProcessor(new Rs(L,t.attributesFromHeaders)),w.register({contextManager:o,propagator:new He.CompositePropagator({propagators:p})}),this.tracerProvider=w,t.logRecordProcessor){let S=new uf.LoggerProvider({resource:u});this.loggerProvider=S,S.addLogRecordProcessor(t.logRecordProcessor),st.logs.setGlobalLoggerProvider(S)}if(t.metricReader||t.views){let S=new cf.MeterProvider({resource:u,views:t.views??[]});t.metricReader&&S.addMetricReader(t.metricReader),d.metrics.setGlobalMeterProvider(S),this.meterProvider=S}let U=qO(t.instrumentations,t.instrumentationConfig);this.disableInstrumentations=(0,af.registerInstrumentations)({instrumentations:U}),d.diag.info("@vercel/otel: started",a,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()),d.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 BO(){let r=(0,Vs.parseEnvironment)(process.env);return{...Vs.DEFAULT_ENVIRONMENT,...r}}function qO(r,e){return(r??["auto"]).map(t=>t==="auto"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new sr(e?.fetch)]):t==="fetch"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new sr(e?.fetch)):t).flat()}function GO(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(i=>{if(i==="none")return[];if(i==="auto"){let s=[];return s.push({name:"tracecontext",propagator:new jr}),s.push({name:"baggage",propagator:new He.W3CBaggagePropagator}),s.push({name:"vercel-runtime",propagator:new xs}),d.diag.debug(`@vercel/otel: Configure propagators: ${s.map(o=>o.name).join(", ")}`),s.map(o=>o.propagator)}if(i==="tracecontext")return d.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new jr;if(i==="baggage")return d.diag.debug("@vercel/otel: Configure propagator: baggage"),new He.W3CBaggagePropagator;if(typeof i=="string")throw new Error(`Unknown propagator: "${i}"`);return i}).flat()}var sf="always_on",cr=1;function VO(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||sf;switch(d.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new C.AlwaysOnSampler;case"always_off":return new C.AlwaysOffSampler;case"parentbased_always_on":return new C.ParentBasedSampler({root:new C.AlwaysOnSampler});case"parentbased_always_off":return new C.ParentBasedSampler({root:new C.AlwaysOffSampler});case"traceidratio":return new C.TraceIdRatioBasedSampler(of(e));case"parentbased_traceidratio":return new C.ParentBasedSampler({root:new C.TraceIdRatioBasedSampler(of(e))});default:return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${sf}".`),new C.AlwaysOnSampler}}function of(r){if(r.OTEL_TRACES_SAMPLER_ARG===void 0||r.OTEL_TRACES_SAMPLER_ARG==="")return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${cr}.`),cr;d.diag.debug("@vercel/otel: Configure sampler probability: ",r.OTEL_TRACES_SAMPLER_ARG);let e=Number(r.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${cr}.`),cr):e<0||e>1?(d.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 ${cr}.`),cr):e}function HO(r,e,t){return[...(r??["auto"]).flatMap(n=>{if(n==="auto"){let i=[new C.BatchSpanProcessor(new qs)];if(process.env.VERCEL_OTEL_ENDPOINTS){let s=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",o=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";d.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",s,o);let a={url:`http://localhost:${s}/v1/traces`,headers:{}},u=o==="http/protobuf"?new dt(a):new rr(a);i.push(new C.BatchSpanProcessor(u))}else(!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT)&&i.push(new C.BatchSpanProcessor(jO(t)));return i}return n}).filter($O),...e.traceExporter&&e.traceExporter!=="auto"?[new C.BatchSpanProcessor(e.traceExporter)]:[]]}function jO(r){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??process.env.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=kO(r),n={...He.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_HEADERS),...He.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_TRACES_HEADERS)};switch(d.diag.debug("@vercel/otel: Configure trace exporter: ",e,t,`headers: ${Object.keys(n).join(",")||"<none>"}`),e){case"http/json":return new rr({url:t,headers:n});case"http/protobuf":return new dt({url:t,headers:n});default:return d.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new dt}}var df="v1/traces",FO=`http://localhost:4318/${df}`;function kO(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}/${df}`:FO}function $O(r){return r!=null}function xv(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new Gs(e).start()}export{sr as FetchInstrumentation,rr as OTLPHttpJsonTraceExporter,dt as OTLPHttpProtoTraceExporter,xv as registerOTel};
|
|
21
21
|
//# sourceMappingURL=index.js.map
|