@vercel/otel 1.9.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/dist/types/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -17,5 +17,5 @@ var Ip=Object.create;var Is=Object.defineProperty;var Lp=Object.getOwnPropertyDe
|
|
|
17
17
|
To resolve the conflict:`,(0,Zi.getConflictResolutionRecipe)(s,e))),n=i):L_.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,Zi.getIncompatibilityDetails)(s,e),`To resolve the conflict:
|
|
20
|
-
`,(0,Zi.getConflictResolutionRecipe)(s,e))}return n}};Ji.MetricStorageRegistry=tu});var C_=c(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.MultiMetricStorage=void 0;var ru=class{constructor(e){this._backingStorages=e}record(e,t,n,i){this._backingStorages.forEach(s=>{s.record(e,t,n,i)})}};es.MultiMetricStorage=ru});var w_=c(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.BatchObservableResultImpl=Qt.ObservableResultImpl=void 0;var Yt=(h(),f(d)),N_=Mr(),WT=Xi(),nu=class{constructor(e,t){this._instrumentName=e,this._valueType=t,this._buffer=new N_.AttributeHashMap}observe(e,t={}){if(typeof e!="number"){Yt.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===Yt.ValueType.INT&&!Number.isInteger(e)&&(Yt.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)}};Qt.ObservableResultImpl=nu;var iu=class{constructor(){this._buffer=new Map}observe(e,t,n={}){if(!(0,WT.isObservableInstrument)(e))return;let i=this._buffer.get(e);if(i==null&&(i=new N_.AttributeHashMap,this._buffer.set(e,i)),typeof t!="number"){Yt.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===Yt.ValueType.INT&&!Number.isInteger(t)&&(Yt.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)}};Qt.BatchObservableResultImpl=iu});var B_=c(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.ObservableRegistry=void 0;var KT=(h(),f(d)),x_=Xi(),D_=w_(),Cr=Ee(),su=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(x_.isObservableInstrument));if(n.size===0){KT.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(x_.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,Cr.PromiseAllSettled)([...n,...i])).filter(Cr.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:i})=>{let s=new D_.ObservableResultImpl(i._descriptor.name,i._descriptor.valueType),o=Promise.resolve(n(s));t!=null&&(o=(0,Cr.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 D_.BatchObservableResultImpl,o=Promise.resolve(n(s));t!=null&&(o=(0,Cr.callWithTimeout)(o,t)),await o,i.forEach(a=>{let u=s._buffer.get(a);u!=null&&a._metricStorages.forEach(l=>{l.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,Cr.setEquals)(n.instruments,t))}};ts.ObservableRegistry=su});var U_=c(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.SyncMetricStorage=void 0;var zT=Wa(),YT=Qa(),QT=Ja(),ou=class extends zT.MetricStorage{constructor(e,t,n,i){super(e),this._attributesProcessor=n,this._deltaMetricStorage=new YT.DeltaMetricProcessor(t),this._temporalMetricStorage=new QT.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)}};rs.SyncMetricStorage=ou});var uu=c(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.FilteringAttributesProcessor=we.NoopAttributesProcessor=we.AttributesProcessor=void 0;var Nr=class{static Noop(){return ZT}};we.AttributesProcessor=Nr;var ns=class extends Nr{process(e,t){return e}};we.NoopAttributesProcessor=ns;var au=class extends Nr{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 ZT=new ns});var q_=c(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.MeterSharedState=void 0;var JT=Ae(),eS=O_(),tS=Ee(),rS=R_(),nS=M_(),iS=C_(),sS=B_(),oS=U_(),aS=uu(),cu=class{constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.metricStorageRegistry=new nS.MetricStorageRegistry,this.observableRegistry=new sS.ObservableRegistry,this.meter=new eS.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,oS.SyncMetricStorage);return t.length===1?t[0]:new iS.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,rS.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(tS.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,JT.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(o);if(a!=null)return a;let u=s.aggregation.createAggregator(o),l=new t(o,u,s.attributesProcessor,this._meterProviderSharedState.metricCollectors);return this.metricStorageRegistry.register(l),l});if(i.length===0){let o=this._meterProviderSharedState.selectAggregations(e.type).map(([a,u])=>{let l=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(l!=null)return l;let _=u.createAggregator(e),E=new t(e,_,aS.AttributesProcessor.Noop(),[a]);return this.metricStorageRegistry.registerForCollector(a,E),E});i=i.concat(o)}return i}};is.MeterSharedState=cu});var G_=c(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.MeterProviderSharedState=void 0;var uS=Ee(),cS=A_(),lS=q_(),lu=class{constructor(e){this.resource=e,this.viewRegistry=new cS.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(e){let t=(0,uS.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new lS.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}};ss.MeterProviderSharedState=lu});var V_=c(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.MetricCollector=void 0;var dS=S(),du=class{constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,dS.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)}};os.MetricCollector=du});var F_=c(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.MeterProvider=void 0;var as=(h(),f(d)),j_=tt(),_S=G_(),hS=V_(),_u=class{constructor(e){var t;this._shutdown=!1;let n=j_.Resource.default().merge((t=e?.resource)!==null&&t!==void 0?t:j_.Resource.empty());if(this._sharedState=new _S.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?(as.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,as.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}addMetricReader(e){let t=new hS.MetricCollector(this._sharedState,e);e.setMetricProducer(t),this._sharedState.metricCollectors.push(t)}async shutdown(e){if(this._shutdown){as.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){as.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};us.MeterProvider=_u});var cs=c(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.ExactPredicate=Zt.PatternPredicate=void 0;var pS=/[\^$\\.+?()[\]{}|]/g,hu=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(pS,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};Zt.PatternPredicate=hu;var pu=class{constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};Zt.ExactPredicate=pu});var k_=c(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.InstrumentSelector=void 0;var H_=cs(),fu=class{constructor(e){var t;this._nameFilter=new H_.PatternPredicate((t=e?.name)!==null&&t!==void 0?t:"*"),this._type=e?.type,this._unitFilter=new H_.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};ls.InstrumentSelector=fu});var X_=c(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.MeterSelector=void 0;var Eu=cs(),mu=class{constructor(e){this._nameFilter=new Eu.ExactPredicate(e?.name),this._versionFilter=new Eu.ExactPredicate(e?.version),this._schemaUrlFilter=new Eu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};ds.MeterSelector=mu});var W_=c(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.View=void 0;var fS=cs(),$_=uu(),ES=k_(),mS=X_(),gS=Ui();function TS(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}var gu=class{constructor(e){var t;if(TS(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||fS.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 $_.FilteringAttributesProcessor(e.attributeKeys):this.attributesProcessor=$_.AttributesProcessor.Noop(),this.name=e.name,this.description=e.description,this.aggregation=(t=e.aggregation)!==null&&t!==void 0?t:gS.Aggregation.Default(),this.instrumentSelector=new ES.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new mS.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl})}};_s.View=gu});var K_=c(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 SS=Ri();Object.defineProperty(g,"AggregationTemporality",{enumerable:!0,get:function(){return SS.AggregationTemporality}});var AS=Nt();Object.defineProperty(g,"DataPointType",{enumerable:!0,get:function(){return AS.DataPointType}});var OS=xa();Object.defineProperty(g,"MetricReader",{enumerable:!0,get:function(){return OS.MetricReader}});var RS=E_();Object.defineProperty(g,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return RS.PeriodicExportingMetricReader}});var bS=g_();Object.defineProperty(g,"InMemoryMetricExporter",{enumerable:!0,get:function(){return bS.InMemoryMetricExporter}});var PS=S_();Object.defineProperty(g,"ConsoleMetricExporter",{enumerable:!0,get:function(){return PS.ConsoleMetricExporter}});var yS=Ae();Object.defineProperty(g,"InstrumentType",{enumerable:!0,get:function(){return yS.InstrumentType}});var vS=F_();Object.defineProperty(g,"MeterProvider",{enumerable:!0,get:function(){return vS.MeterProvider}});var xe=Ui();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 IS=W_();Object.defineProperty(g,"View",{enumerable:!0,get:function(){return IS.View}});var LS=Ee();Object.defineProperty(g,"TimeoutError",{enumerable:!0,get:function(){return LS.TimeoutError}})});var z_=c(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.AbstractAsyncHooksContextManager=void 0;var MS=J("events"),CS=["addListener","on","once","prependListener","prependOnceListener"],Tu=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(e,t){return t instanceof MS.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),CS.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 l=i.bind(n,o);u.set(o,l),i._wrapped=!0;try{return t.call(this,s,l)}finally{i._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}};hs.AbstractAsyncHooksContextManager=Tu});var Y_=c(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.AsyncLocalStorageContextManager=void 0;var NS=(h(),f(d)),wS=J("async_hooks"),xS=z_(),Su=class extends xS.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new wS.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:NS.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}};ps.AsyncLocalStorageContextManager=Su});var bu=c(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.toAnyValue=De.toKeyValue=De.toAttributes=void 0;function VS(r){return Object.keys(r).map(e=>Ou(e,r[e]))}De.toAttributes=VS;function Ou(r,e){return{key:r,value:Ru(e)}}De.toKeyValue=Ou;function Ru(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(Ru)}}:e==="object"&&r!=null?{kvlistValue:{values:Object.entries(r).map(([t,n])=>Ou(t,n))}}:{}}De.toAnyValue=Ru});var rh=c(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.toOtlpSpanEvent=Be.toOtlpLink=Be.sdkSpanToOtlpSpan=void 0;var Pu=bu();function jS(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,Pu.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>th(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:i.code,message:i.message},links:r.links.map(s=>eh(s,e)),droppedLinksCount:r.droppedLinksCount}}Be.sdkSpanToOtlpSpan=jS;function eh(r,e){var t;return{attributes:r.attributes?(0,Pu.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}}Be.toOtlpLink=eh;function th(r,e){return{attributes:r.attributes?(0,Pu.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}Be.toOtlpSpanEvent=th});var ah=c(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.getOtlpEncoder=oe.encodeAsString=oe.encodeAsLongBits=oe.toLongBits=oe.hrTimeToNanos=void 0;var ms=S(),FS=BigInt(1e9);function yu(r){return BigInt(r[0])*FS+BigInt(r[1])}oe.hrTimeToNanos=yu;function ih(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}oe.toLongBits=ih;function vu(r){let e=yu(r);return ih(e)}oe.encodeAsLongBits=vu;function sh(r){return yu(r).toString()}oe.encodeAsString=sh;var HS=typeof BigInt<"u"?sh:ms.hrTimeToNanoseconds;function nh(r){return r}function oh(r){if(r!==void 0)return(0,ms.hexToBase64)(r)}var kS={encodeHrTime:vu,encodeSpanContext:ms.hexToBase64,encodeOptionalSpanContext:oh};function XS(r){var e,t;if(r===void 0)return kS;let n=(e=r.useLongBits)!==null&&e!==void 0?e:!0,i=(t=r.useHex)!==null&&t!==void 0?t:!1;return{encodeHrTime:n?vu:HS,encodeSpanContext:i?nh:ms.hexToBase64,encodeOptionalSpanContext:i?nh:oh}}oe.getOtlpEncoder=XS});var Iu=c(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.createExportTraceServiceRequest=void 0;var $S=bu(),WS=rh(),KS=ah();function zS(r,e){let t=(0,KS.getOtlpEncoder)(e);return{resourceSpans:QS(r,t)}}gs.createExportTraceServiceRequest=zS;function YS(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 QS(r,e){let t=YS(r),n=[],i=t.entries(),s=i.next();for(;!s.done;){let[o,a]=s.value,u=[],l=a.values(),_=l.next();for(;!_.done;){let O=_.value;if(O.length>0){let{name:D,version:z,schemaUrl:I}=O[0].instrumentationLibrary,U=O.map(L=>(0,WS.sdkSpanToOtlpSpan)(L,e));u.push({scope:{name:D,version:z},spans:U,schemaUrl:I})}_=l.next()}let E={resource:{attributes:(0,$S.toAttributes)(o.attributes),droppedAttributesCount:0},scopeSpans:u,schemaUrl:void 0};n.push(E),s=i.next()}return n}});var lh=c(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.parseRetryAfterToMills=C.isExportRetryable=C.invalidTimeout=C.configureExporterTimeout=C.appendRootPathToUrlIfNeeded=C.appendResourcePathToUrl=C.parseHeaders=C.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=C.DEFAULT_EXPORT_MAX_BACKOFF=C.DEFAULT_EXPORT_INITIAL_BACKOFF=C.DEFAULT_EXPORT_MAX_ATTEMPTS=void 0;var Lu=(h(),f(d)),uh=S(),ch=1e4;C.DEFAULT_EXPORT_MAX_ATTEMPTS=5;C.DEFAULT_EXPORT_INITIAL_BACKOFF=1e3;C.DEFAULT_EXPORT_MAX_BACKOFF=5e3;C.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=1.5;function ZS(r={}){let e={};return Object.entries(r).forEach(([t,n])=>{typeof n<"u"?e[t]=String(n):Lu.diag.warn(`Header "${t}" has wrong value and will be ignored`)}),e}C.parseHeaders=ZS;function JS(r,e){return r.endsWith("/")||(r=r+"/"),r+e}C.appendResourcePathToUrl=JS;function eA(r){try{let e=new URL(r);return e.pathname===""&&(e.pathname=e.pathname+"/"),e.toString()}catch{return Lu.diag.warn(`Could not parse export URL: '${r}'`),r}}C.appendRootPathToUrlIfNeeded=eA;function tA(r){return typeof r=="number"?r<=0?Mu(r,ch):r:rA()}C.configureExporterTimeout=tA;function rA(){var r;let e=Number((r=(0,uh.getEnv)().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT)!==null&&r!==void 0?r:(0,uh.getEnv)().OTEL_EXPORTER_OTLP_TIMEOUT);return e<=0?Mu(e,ch):e}function Mu(r,e){return Lu.diag.warn("Timeout must be greater than 0",r),e}C.invalidTimeout=Mu;function nA(r){return[429,502,503,504].includes(r)}C.isExportRetryable=nA;function iA(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}C.parseRetryAfterToMills=iA});var _h=c(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.OTLPExporterBase=void 0;var dh=(h(),f(d)),xr=S(),sA=lh(),Cu=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 xr.BindOnceFuture(this._shutdown,this),this._concurrencyLimit=typeof e.concurrencyLimit=="number"?e.concurrencyLimit:30,this.timeoutMillis=(0,sA.configureExporterTimeout)(e.timeoutMillis),this.onInit(e)}export(e,t){if(this._shutdownOnce.isCalled){t({code:xr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")});return}if(this._sendingPromises.length>=this._concurrencyLimit){t({code:xr.ExportResultCode.FAILED,error:new Error("Concurrent export limit reached")});return}this._export(e).then(()=>{t({code:xr.ExportResultCode.SUCCESS})}).catch(n=>{t({code:xr.ExportResultCode.FAILED,error:n})})}_export(e){return new Promise((t,n)=>{try{dh.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 dh.diag.debug("shutdown started"),this.onShutdown(),this.forceFlush()}};Ts.OTLPExporterBase=Cu});var Eh=c((vP,fh)=>{"use strict";fh.exports=uA;function uA(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 E=new Array(arguments.length-1),O=0;O<E.length;)E[O++]=arguments[O];a.apply(null,E)}};try{r.apply(e||null,t)}catch(l){s&&(s=!1,u(l))}})}});var Sh=c(Th=>{"use strict";var As=Th;As.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 rr=new Array(64),gh=new Array(123);for(le=0;le<64;)gh[rr[le]=le<26?le+65:le<52?le+71:le<62?le-4:le-59|43]=le++;var le;As.encode=function(e,t,n){for(var i=null,s=[],o=0,a=0,u;t<n;){var l=e[t++];switch(a){case 0:s[o++]=rr[l>>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=rr[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=rr[u|l>>6],s[o++]=rr[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=rr[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 mh="invalid encoding";As.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=gh[u])===void 0)throw Error(mh);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(mh);return n-i};As.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Oh=c((LP,Ah)=>{"use strict";Ah.exports=Os;function Os(){this._listeners={}}Os.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};Os.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};Os.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 Lh=c((MP,Ih)=>{"use strict";Ih.exports=Rh(Rh);function Rh(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function i(u,l,_){e[0]=u,l[_]=t[0],l[_+1]=t[1],l[_+2]=t[2],l[_+3]=t[3]}function s(u,l,_){e[0]=u,l[_]=t[3],l[_+1]=t[2],l[_+2]=t[1],l[_+3]=t[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function o(u,l){return t[0]=u[l],t[1]=u[l+1],t[2]=u[l+2],t[3]=u[l+3],e[0]}function a(u,l){return t[3]=u[l],t[2]=u[l+1],t[1]=u[l+2],t[0]=u[l+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),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}r.writeFloatLE=e.bind(null,bh),r.writeFloatBE=e.bind(null,Ph);function t(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}r.readFloatLE=t.bind(null,yh),r.readFloatBE=t.bind(null,vh)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function i(u,l,_){e[0]=u,l[_]=t[0],l[_+1]=t[1],l[_+2]=t[2],l[_+3]=t[3],l[_+4]=t[4],l[_+5]=t[5],l[_+6]=t[6],l[_+7]=t[7]}function s(u,l,_){e[0]=u,l[_]=t[7],l[_+1]=t[6],l[_+2]=t[5],l[_+3]=t[4],l[_+4]=t[3],l[_+5]=t[2],l[_+6]=t[1],l[_+7]=t[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function o(u,l){return t[0]=u[l],t[1]=u[l+1],t[2]=u[l+2],t[3]=u[l+3],t[4]=u[l+4],t[5]=u[l+5],t[6]=u[l+6],t[7]=u[l+7],e[0]}function a(u,l){return t[7]=u[l],t[6]=u[l+1],t[5]=u[l+2],t[4]=u[l+3],t[3]=u[l+4],t[2]=u[l+5],t[1]=u[l+6],t[0]=u[l+7],e[0]}r.readDoubleLE=n?o:a,r.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(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((l<<31|2146435072)>>>0,a,u+s);else{var _;if(o<22250738585072014e-324)_=o/5e-324,n(_>>>0,a,u+i),n((l<<31|_/4294967296)>>>0,a,u+s);else{var E=Math.floor(Math.log(o)/Math.LN2);E===1024&&(E=1023),_=o*Math.pow(2,-E),n(_*4503599627370496>>>0,a,u+i),n((l<<31|E+1023<<20|_*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,bh,0,4),r.writeDoubleBE=e.bind(null,Ph,4,0);function t(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),_=(l>>31)*2+1,E=l>>>20&2047,O=4294967296*(l&1048575)+u;return E===2047?O?NaN:_*(1/0):E===0?_*5e-324*O:_*Math.pow(2,E-1075)*(O+4503599627370496)}r.readDoubleLE=t.bind(null,yh,0,4),r.readDoubleBE=t.bind(null,vh,4,0)}(),r}function bh(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 Ph(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 yh(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function vh(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var Mh=c((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 Nh=c(Ch=>{"use strict";var wu=Ch;wu.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};wu.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))};wu.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 xh=c((NP,wh)=>{"use strict";wh.exports=cA;function cA(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 l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var Bh=c((wP,Dh)=>{"use strict";Dh.exports=V;var Dr=qe();function V(r,e){this.lo=r>>>0,this.hi=e>>>0}var ut=V.zero=new V(0,0);ut.toNumber=function(){return 0};ut.zzEncode=ut.zzDecode=function(){return this};ut.length=function(){return 1};var lA=V.zeroHash="\0\0\0\0\0\0\0\0";V.fromNumber=function(e){if(e===0)return ut;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 V(n,i)};V.from=function(e){if(typeof e=="number")return V.fromNumber(e);if(Dr.isString(e))if(Dr.Long)e=Dr.Long.fromString(e);else return V.fromNumber(parseInt(e,10));return e.low||e.high?new V(e.low>>>0,e.high>>>0):ut};V.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};V.prototype.toLong=function(e){return Dr.Long?new Dr.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ue=String.prototype.charCodeAt;V.fromHash=function(e){return e===lA?ut:new V((Ue.call(e,0)|Ue.call(e,1)<<8|Ue.call(e,2)<<16|Ue.call(e,3)<<24)>>>0,(Ue.call(e,4)|Ue.call(e,5)<<8|Ue.call(e,6)<<16|Ue.call(e,7)<<24)>>>0)};V.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)};V.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};V.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};V.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=c(xu=>{"use strict";var p=xu;p.asPromise=Eh();p.base64=Sh();p.EventEmitter=Oh();p.float=Lh();p.inquire=Mh();p.utf8=Nh();p.pool=xh();p.LongBits=Bh();p.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);p.global=p.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||xu;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};p.isString=function(e){return typeof e=="string"||e instanceof String};p.isObject=function(e){return e&&typeof e=="object"};p.isset=p.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};p.Buffer=function(){try{var r=p.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();p._Buffer_from=null;p._Buffer_allocUnsafe=null;p.newBuffer=function(e){return typeof e=="number"?p.Buffer?p._Buffer_allocUnsafe(e):new p.Array(e):p.Buffer?p._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};p.Array=typeof Uint8Array<"u"?Uint8Array:Array;p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long");p.key2Re=/^true|false|0|1$/;p.key32Re=/^-?(?:0|[1-9][0-9]*)$/;p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;p.longToHash=function(e){return e?p.LongBits.from(e).toHash():p.LongBits.zeroHash};p.longFromHash=function(e,t){var n=p.LongBits.fromHash(e);return p.Long?p.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function Uh(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}p.merge=Uh;p.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function qh(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&&Uh(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}p.newError=qh;p.ProtocolError=qh("ProtocolError");p.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]}};p.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};p._configure=function(){var r=p.Buffer;if(!r){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},p._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var ju=c((DP,Fh)=>{"use strict";Fh.exports=A;var ae=qe(),Du,Rs=ae.LongBits,Gh=ae.base64,Vh=ae.utf8;function Br(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Uu(){}function dA(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function A(){this.len=0,this.head=new Br(Uu,0,0),this.tail=this.head,this.states=null}var jh=function(){return ae.Buffer?function(){return(A.create=function(){return new Du})()}:function(){return new A}};A.create=jh();A.alloc=function(e){return new ae.Array(e)};ae.Array!==Array&&(A.alloc=ae.pool(A.alloc,ae.Array.prototype.subarray));A.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Br(e,t,n),this.len+=t,this};function qu(r,e,t){e[t]=r&255}function _A(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function Gu(r,e){this.len=r,this.next=void 0,this.val=e}Gu.prototype=Object.create(Br.prototype);Gu.prototype.fn=_A;A.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Gu((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};A.prototype.int32=function(e){return e<0?this._push(Vu,10,Rs.fromNumber(e)):this.uint32(e)};A.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Vu(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}A.prototype.uint64=function(e){var t=Rs.from(e);return this._push(Vu,t.length(),t)};A.prototype.int64=A.prototype.uint64;A.prototype.sint64=function(e){var t=Rs.from(e).zzEncode();return this._push(Vu,t.length(),t)};A.prototype.bool=function(e){return this._push(qu,1,e?1:0)};function Bu(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}A.prototype.fixed32=function(e){return this._push(Bu,4,e>>>0)};A.prototype.sfixed32=A.prototype.fixed32;A.prototype.fixed64=function(e){var t=Rs.from(e);return this._push(Bu,4,t.lo)._push(Bu,4,t.hi)};A.prototype.sfixed64=A.prototype.fixed64;A.prototype.float=function(e){return this._push(ae.float.writeFloatLE,4,e)};A.prototype.double=function(e){return this._push(ae.float.writeDoubleLE,8,e)};var hA=ae.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]};A.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(qu,1,0);if(ae.isString(e)){var n=A.alloc(t=Gh.length(e));Gh.decode(e,n,0),e=n}return this.uint32(t)._push(hA,t,e)};A.prototype.string=function(e){var t=Vh.length(e);return t?this.uint32(t)._push(Vh.write,t,e):this._push(qu,1,0)};A.prototype.fork=function(){return this.states=new dA(this),this.head=this.tail=new Br(Uu,0,0),this.len=0,this};A.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 Br(Uu,0,0),this.len=0),this};A.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};A.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};A._configure=function(r){Du=r,A.create=jh(),Du._configure()}});var Xh=c((BP,kh)=>{"use strict";kh.exports=ge;var Hh=ju();(ge.prototype=Object.create(Hh.prototype)).constructor=ge;var Ge=qe();function ge(){Hh.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 pA(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(pA,t,e),this};ge._configure()});var ku=c((UP,Yh)=>{"use strict";Yh.exports=w;var de=qe(),Hu,Kh=de.LongBits,fA=de.utf8;function _e(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function w(r){this.buf=r,this.pos=0,this.len=r.length}var $h=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new w(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new w(e);throw Error("illegal buffer")},zh=function(){return de.Buffer?function(t){return(w.create=function(i){return de.Buffer.isBuffer(i)?new Hu(i):$h(i)})(t)}:$h};w.create=zh();w.prototype._slice=de.Array.prototype.subarray||de.Array.prototype.slice;w.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,_e(this,10);return e}}();w.prototype.int32=function(){return this.uint32()|0};w.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Fu(){var r=new Kh(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 _e(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 _e(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")}w.prototype.bool=function(){return this.uint32()!==0};function bs(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}w.prototype.fixed32=function(){if(this.pos+4>this.len)throw _e(this,4);return bs(this.buf,this.pos+=4)};w.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _e(this,4);return bs(this.buf,this.pos+=4)|0};function Wh(){if(this.pos+8>this.len)throw _e(this,8);return new Kh(bs(this.buf,this.pos+=4),bs(this.buf,this.pos+=4))}w.prototype.float=function(){if(this.pos+4>this.len)throw _e(this,4);var e=de.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};w.prototype.double=function(){if(this.pos+8>this.len)throw _e(this,4);var e=de.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};w.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw _e(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var i=de.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};w.prototype.string=function(){var e=this.bytes();return fA.read(e,0,e.length)};w.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw _e(this,e);this.pos+=e}else do if(this.pos>=this.len)throw _e(this);while(this.buf[this.pos++]&128);return this};w.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};w._configure=function(r){Hu=r,w.create=zh(),Hu._configure();var e=de.Long?"toLong":"toNumber";de.merge(w.prototype,{int64:function(){return Fu.call(this)[e](!1)},uint64:function(){return Fu.call(this)[e](!0)},sint64:function(){return Fu.call(this).zzDecode()[e](!1)},fixed64:function(){return Wh.call(this)[e](!0)},sfixed64:function(){return Wh.call(this)[e](!1)}})}});var ep=c((qP,Jh)=>{"use strict";Jh.exports=ct;var Zh=ku();(ct.prototype=Object.create(Zh.prototype)).constructor=ct;var Qh=qe();function ct(r){Zh.call(this,r)}ct._configure=function(){Qh.Buffer&&(ct.prototype._slice=Qh.Buffer.prototype.slice)};ct.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))};ct._configure()});var rp=c((GP,tp)=>{"use strict";tp.exports=Ur;var Xu=qe();(Ur.prototype=Object.create(Xu.EventEmitter.prototype)).constructor=Ur;function Ur(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Xu.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Ur.prototype.rpcCall=function r(e,t,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Xu.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,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(_){return o.emit("error",_,e),s(_)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Ur.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var ip=c(np=>{"use strict";var EA=np;EA.Service=rp()});var op=c((jP,sp)=>{"use strict";sp.exports={}});var cp=c(up=>{"use strict";var Z=up;Z.build="minimal";Z.Writer=ju();Z.BufferWriter=Xh();Z.Reader=ku();Z.BufferReader=ep();Z.util=qe();Z.rpc=ip();Z.roots=op();Z.configure=ap;function ap(){Z.util._configure(),Z.Writer._configure(Z.BufferWriter),Z.Reader._configure(Z.BufferReader)}ap()});var dp=c((HP,lp)=>{"use strict";lp.exports=cp()});var N=H(Yo(),1);h();ta();var Ap=H(yd(),1),or=H(tt(),1),Op=H(Fd(),1),Rp=H(K_(),1),Yu=H(ie(),1),ar=H(kr(),1),bp=H(Y_(),1),Ve=H(S(),1);h();var DS=Symbol.for("@vercel/request-context");function Jt(){return globalThis[DS]?.get()}var Au=H(ie(),1);function fs(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function Q_(r){return r?r.split("::").at(-1):void 0}function Z_(r=Jt(),e){if(!r)return;let t=e?US(e,r.headers):void 0;return fs({[Au.SemanticAttributes.HTTP_HOST]:r.headers.host,[Au.SemanticAttributes.HTTP_USER_AGENT]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":Q_(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":r.headers["x-vercel-edge-region"],...t})}var BS={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function US(r,e){if(typeof r=="function")return r(e,BS);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 wr(r){return(r&d.TraceFlags.SAMPLED)!==0}var Es=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&&wr(s)){let a=Jt(),u=Z_(a,this.attributesFromHeaders);u&&e.setAttributes(u),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let l=new Promise(E=>{this.waitSpanEnd.set(n,E)}),_;await Promise.race([l,new Promise(E=>{_=setTimeout(()=>{this.waitSpanEnd.delete(n),E(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=wr(i),o=this.rootSpanIds.get(t),a=o?.rootSpanId===n;if(s){let u=GS(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(l){d.diag.error("@vercel/otel: onEnd failed:",l)}}}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())}}},qS={[d.SpanKind.INTERNAL]:"internal",[d.SpanKind.SERVER]:"server",[d.SpanKind.CLIENT]:"client",[d.SpanKind.PRODUCER]:"producer",[d.SpanKind.CONSUMER]:"consumer"};function GS(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 l=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":l};let _=r.instrumentationLibrary.name,E=o??s;if(E&&typeof E=="string"){let O=J_(_,E);return u?{"operation.name":O,"resource.name":l}:{"operation.name":O}}return{"operation.name":J_(_,e===d.SpanKind.INTERNAL?"":qS[e])}}function J_(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var ph=H(Iu(),1);var hh=H(_h(),1);h();var er=class extends hh.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(l){d.diag.warn("@vercel/otel/otlp: no proto",l);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(l=>{d.diag.debug("@vercel/otel/otlp: onSuccess",l.status,l.statusText),t(),l.arrayBuffer().catch(()=>{})}).catch(l=>{d.diag.error("@vercel/otel/otlp: onError",l),n(l)}).finally(()=>{let l=this._sendingPromises.indexOf(u);this._sendingPromises.splice(l,1)});this._sendingPromises.push(u)}getDefaultUrl(e){throw new Error("Method not implemented.")}};var oA="v1/traces",aA=`http://localhost:4318/${oA}`;function Ss(r){return typeof r.url=="string"?r.url:aA}var tr=class{constructor(e={}){this.impl=new Nu(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},Nu=class extends er{convert(e){return(0,ph.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1})}toMessage(e){return{body:JSON.stringify(e),contentType:"application/json"}}getDefaultUrl(e){return Ss(e)}};var fp=H(Iu(),1);var _p=H(dp(),1);function hp(r){let e=new _p.Writer;return mA(r,e),e.finish()}function mA(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)gA(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function gA(r,e){if(r.resource!=null&&TA(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)SA(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function TA(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)nr(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function SA(r,e){if(r.scope!=null&&RA(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)bA(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function nr(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&pp(r.value,e.uint32(18).fork()).ldelim(),e}function pp(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&&AA(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&OA(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function AA(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)pp(r.values[t],e.uint32(10).fork()).ldelim();return e}function OA(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)nr(r.values[t],e.uint32(10).fork()).ldelim();return e}function RA(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)nr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function bA(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)nr(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)yA(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)vA(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&PA(r.status,e.uint32(122).fork()).ldelim(),e}function PA(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function yA(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)nr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function vA(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)nr(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var lt=class{constructor(e={}){this.impl=new $u(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},$u=class extends er{convert(e){return(0,fp.createExportTraceServiceRequest)(e,void 0)}toMessage(e){return{body:hp(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Ss(e)}};h();var Re=H(ie(),1);function Ep(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let i=e[n];return i!==void 0?String(i):t})}var ir=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(){}enable(){this.disable();let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),n=this.config.ignoreUrls??[],i=(I,U)=>{if(U?.opentelemetry?.ignore!==void 0)return U.opentelemetry.ignore;if(n.length===0)return!1;let L=I.toString();return n.some(m=>typeof m=="string"?m==="*"?!0:L.startsWith(m):m.test(L))},s=process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||null,o=process.env.VERCEL_BRANCH_URL||process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL||null,a=this.config.propagateContextUrls??[],u=this.config.dontPropagateContextUrls??[],l=this.config.resourceNameTemplate,{attributesFromRequestHeaders:_,attributesFromResponseHeaders:E}=this.config,O=(I,U)=>{if(U?.opentelemetry?.propagateContext)return U.opentelemetry.propagateContext;let L=I.toString();return u.length>0&&u.some(m=>typeof m=="string"?m==="*"?!0:L.startsWith(m):m.test(L))?!1:s&&I.protocol==="https:"&&(I.host===s||I.host===o||I.host===Jt()?.headers.host)||!s&&I.protocol==="http:"&&I.hostname==="localhost"?!0:a.some(m=>typeof m=="string"?m==="*"?!0:L.startsWith(m):m.test(L))};process.env.NEXT_OTEL_FETCH_DISABLED="1";let D=globalThis.fetch;this.originalFetch=D;let z=async(I,U)=>{let L=U;if(L?.next?.internal)return D(I,L);let m=new Request(I instanceof Request?I.clone():I,L),be=new URL(m.url);if(i(be,L))return D(I,L);let ys={[Re.SemanticAttributes.HTTP_METHOD]:m.method,[Re.SemanticAttributes.HTTP_URL]:m.url,[Re.SemanticAttributes.HTTP_HOST]:be.host,[Re.SemanticAttributes.HTTP_SCHEME]:be.protocol.replace(":",""),[Re.SemanticAttributes.NET_PEER_NAME]:be.hostname,[Re.SemanticAttributes.NET_PEER_PORT]:be.port},dt=l?Ep(l,ys):LA(m.url),yp=L?.opentelemetry?.spanName??`fetch ${m.method} ${m.url}`,Qu=d.context.active(),q=t.startSpan(yp,{kind:d.SpanKind.CLIENT,attributes:{...ys,"operation.name":`fetch.${m.method}`,"resource.name":dt,...L?.opentelemetry?.attributes}},Qu);if(!q.isRecording()||!wr(q.spanContext().traceFlags))return q.end(),D(I,L);if(O(be,L)){let _t=d.trace.setSpan(Qu,q);d.propagation.inject(_t,m.headers,IA)}_&&mp(q,_,m.headers);try{let _t=Date.now(),Pe=await D(I,{...L,headers:m.headers}),vp=Date.now()-_t;return q.setAttribute(Re.SemanticAttributes.HTTP_STATUS_CODE,Pe.status),q.setAttribute("http.response_time",vp),E&&mp(q,E,Pe.headers),Pe.status>=500&&Wu(q,`Status: ${Pe.status} (${Pe.statusText})`),Pe.body?MA(Pe).then(vs=>{q.isRecording()&&(q.setAttribute(Re.SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,vs),q.end())},vs=>{q.isRecording()&&(Wu(q,vs),q.end())}):q.end(),Pe}catch(_t){throw Wu(q,_t),q.end(),_t}};globalThis.fetch=z}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},IA={set(r,e,t){r.set(e,t)}};function LA(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function MA(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 Wu(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 mp(r,e,t){for(let[n,i]of Object.entries(e)){let s=t.get(i);s!==null&&r.setAttribute(n,s)}}h();var gp=H(S(),1),CA="00",Ku="traceparent",zu="tracestate",qr=class{fields(){return[Ku,zu]}inject(e,t,n){let i=d.trace.getSpanContext(e);if(!i||(0,gp.isTracingSuppressed)(e)||!(0,d.isSpanContextValid)(i))return;let s=`${CA}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||0).toString(16)}`;n.set(t,Ku,s),i.traceState&&n.set(t,zu,i.traceState.serialize())}extract(e,t,n){let i=n.get(t,Ku);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=NA(s);if(!o)return e;o.isRemote=!0;let a=n.get(t,zu);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 NA(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)}}var Ps=class{constructor(e={}){this.configuration=e}start(){let e=wA(),t=(0,ar.getEnvWithoutDefaults)(),n=this.configuration,i=process.env.NEXT_RUNTIME||"nodejs",s=!!e.OTEL_SDK_DISABLED;if(t.OTEL_LOG_LEVEL&&d.diag.setLogger(new d.DiagConsoleLogger,{logLevel:t.OTEL_LOG_LEVEL}),s)return;let o=n.idGenerator??new N.RandomIdGenerator,a=n.contextManager??new bp.AsyncLocalStorageContextManager;a.enable(),this.contextManager=a;let u=e.OTEL_SERVICE_NAME||n.serviceName||"app",l=new or.Resource(fs({[Yu.SemanticResourceAttributes.SERVICE_NAME]:u,"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":i,"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,[Yu.SemanticResourceAttributes.SERVICE_VERSION]:process.env.VERCEL_DEPLOYMENT_ID,...n.attributes})),_=n.resourceDetectors??[or.envDetectorSync];if(n.autoDetectResources??!0){let m={detectors:_};l=l.merge((0,or.detectResourcesSync)(m))}let O=DA(n.propagators,e),D=BA(n.traceSampler,e),z=UA(n.spanProcessors,n,e);z.length===0&&d.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let I=n.spanLimits,U=new N.BasicTracerProvider({resource:l,idGenerator:o,sampler:D,spanLimits:I});if(U.addSpanProcessor(new Es(z,n.attributesFromHeaders)),U.register({contextManager:a,propagator:new Ve.CompositePropagator({propagators:O})}),this.tracerProvider=U,n.logRecordProcessor){let m=new Op.LoggerProvider({resource:l});this.loggerProvider=m,m.addLogRecordProcessor(n.logRecordProcessor),it.logs.setGlobalLoggerProvider(m)}if(n.metricReader||n.views){let m=new Rp.MeterProvider({resource:l,views:n.views??[]});n.metricReader&&m.addMetricReader(n.metricReader),d.metrics.setGlobalMeterProvider(m),this.meterProvider=m}let L=xA(n.instrumentations,n.instrumentationConfig);this.disableInstrumentations=(0,Ap.registerInstrumentations)({instrumentations:L}),d.diag.info("@vercel/otel: started",u,i)}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 wA(){let r=(0,ar.parseEnvironment)(process.env);return{...ar.DEFAULT_ENVIRONMENT,...r}}function xA(r,e){return(r??["auto"]).map(t=>t==="auto"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new ir(e?.fetch)]):t==="fetch"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new ir(e?.fetch)):t).flat()}function DA(r,e){let t=e.OTEL_PROPAGATORS&&e.OTEL_PROPAGATORS.length>0?e.OTEL_PROPAGATORS:void 0;return(r??t??["auto"]).map(n=>{if(n==="none")return[];if(n==="auto")return d.diag.debug("@vercel/otel: Configure propagators: tracecontext, baggage"),[new qr,new Ve.W3CBaggagePropagator];if(n==="tracecontext")return d.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new qr;if(n==="baggage")return d.diag.debug("@vercel/otel: Configure propagator: baggage"),new Ve.W3CBaggagePropagator;if(typeof n=="string")throw new Error(`Unknown propagator: "${n}"`);return n}).flat()}var Tp="always_on",sr=1;function BA(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||Tp;switch(d.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new N.AlwaysOnSampler;case"always_off":return new N.AlwaysOffSampler;case"parentbased_always_on":return new N.ParentBasedSampler({root:new N.AlwaysOnSampler});case"parentbased_always_off":return new N.ParentBasedSampler({root:new N.AlwaysOffSampler});case"traceidratio":return new N.TraceIdRatioBasedSampler(Sp(e));case"parentbased_traceidratio":return new N.ParentBasedSampler({root:new N.TraceIdRatioBasedSampler(Sp(e))});default:return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${Tp}".`),new N.AlwaysOnSampler}}function Sp(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 ${sr}.`),sr;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 ${sr}.`),sr):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 ${sr}.`),sr):e}function UA(r,e,t){return[...(r??["auto"]).map(n=>{if(n==="auto"){if(process.env.VERCEL_OTEL_ENDPOINTS){let i=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",s=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";d.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",i,s);let o={url:`http://localhost:${i}/v1/traces`,headers:{}},a=s==="http/protobuf"?new lt(o):new tr(o);return new N.BatchSpanProcessor(a)}return!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT?new N.BatchSpanProcessor(qA(t)):void 0}return n}).filter(jA),...e.traceExporter&&e.traceExporter!=="auto"?[new N.BatchSpanProcessor(e.traceExporter)]:[]]}function qA(r){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??process.env.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=VA(r),n={...Ve.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_HEADERS),...Ve.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 tr({url:t,headers:n});case"http/protobuf":return new lt({url:t,headers:n});default:return d.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new lt}}var Pp="v1/traces",GA=`http://localhost:4318/${Pp}`;function VA(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}/${Pp}`:GA}function jA(r){return r!=null}function hy(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new Ps(e).start()}export{ir as FetchInstrumentation,tr as OTLPHttpJsonTraceExporter,lt as OTLPHttpProtoTraceExporter,hy as registerOTel};
|
|
20
|
+
`,(0,Zi.getConflictResolutionRecipe)(s,e))}return n}};Ji.MetricStorageRegistry=tu});var C_=c(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.MultiMetricStorage=void 0;var ru=class{constructor(e){this._backingStorages=e}record(e,t,n,i){this._backingStorages.forEach(s=>{s.record(e,t,n,i)})}};es.MultiMetricStorage=ru});var w_=c(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.BatchObservableResultImpl=Qt.ObservableResultImpl=void 0;var Yt=(h(),f(d)),N_=Mr(),WT=Xi(),nu=class{constructor(e,t){this._instrumentName=e,this._valueType=t,this._buffer=new N_.AttributeHashMap}observe(e,t={}){if(typeof e!="number"){Yt.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===Yt.ValueType.INT&&!Number.isInteger(e)&&(Yt.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)}};Qt.ObservableResultImpl=nu;var iu=class{constructor(){this._buffer=new Map}observe(e,t,n={}){if(!(0,WT.isObservableInstrument)(e))return;let i=this._buffer.get(e);if(i==null&&(i=new N_.AttributeHashMap,this._buffer.set(e,i)),typeof t!="number"){Yt.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===Yt.ValueType.INT&&!Number.isInteger(t)&&(Yt.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)}};Qt.BatchObservableResultImpl=iu});var B_=c(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.ObservableRegistry=void 0;var KT=(h(),f(d)),x_=Xi(),D_=w_(),Cr=Ee(),su=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(x_.isObservableInstrument));if(n.size===0){KT.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(x_.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,Cr.PromiseAllSettled)([...n,...i])).filter(Cr.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:i})=>{let s=new D_.ObservableResultImpl(i._descriptor.name,i._descriptor.valueType),o=Promise.resolve(n(s));t!=null&&(o=(0,Cr.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 D_.BatchObservableResultImpl,o=Promise.resolve(n(s));t!=null&&(o=(0,Cr.callWithTimeout)(o,t)),await o,i.forEach(a=>{let u=s._buffer.get(a);u!=null&&a._metricStorages.forEach(l=>{l.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,Cr.setEquals)(n.instruments,t))}};ts.ObservableRegistry=su});var U_=c(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.SyncMetricStorage=void 0;var zT=Wa(),YT=Qa(),QT=Ja(),ou=class extends zT.MetricStorage{constructor(e,t,n,i){super(e),this._attributesProcessor=n,this._deltaMetricStorage=new YT.DeltaMetricProcessor(t),this._temporalMetricStorage=new QT.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)}};rs.SyncMetricStorage=ou});var uu=c(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.FilteringAttributesProcessor=we.NoopAttributesProcessor=we.AttributesProcessor=void 0;var Nr=class{static Noop(){return ZT}};we.AttributesProcessor=Nr;var ns=class extends Nr{process(e,t){return e}};we.NoopAttributesProcessor=ns;var au=class extends Nr{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 ZT=new ns});var q_=c(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.MeterSharedState=void 0;var JT=Ae(),eS=O_(),tS=Ee(),rS=R_(),nS=M_(),iS=C_(),sS=B_(),oS=U_(),aS=uu(),cu=class{constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.metricStorageRegistry=new nS.MetricStorageRegistry,this.observableRegistry=new sS.ObservableRegistry,this.meter=new eS.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,oS.SyncMetricStorage);return t.length===1?t[0]:new iS.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,rS.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(tS.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,JT.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(o);if(a!=null)return a;let u=s.aggregation.createAggregator(o),l=new t(o,u,s.attributesProcessor,this._meterProviderSharedState.metricCollectors);return this.metricStorageRegistry.register(l),l});if(i.length===0){let o=this._meterProviderSharedState.selectAggregations(e.type).map(([a,u])=>{let l=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(l!=null)return l;let _=u.createAggregator(e),E=new t(e,_,aS.AttributesProcessor.Noop(),[a]);return this.metricStorageRegistry.registerForCollector(a,E),E});i=i.concat(o)}return i}};is.MeterSharedState=cu});var G_=c(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.MeterProviderSharedState=void 0;var uS=Ee(),cS=A_(),lS=q_(),lu=class{constructor(e){this.resource=e,this.viewRegistry=new cS.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(e){let t=(0,uS.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new lS.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}};ss.MeterProviderSharedState=lu});var V_=c(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.MetricCollector=void 0;var dS=S(),du=class{constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,dS.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)}};os.MetricCollector=du});var F_=c(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.MeterProvider=void 0;var as=(h(),f(d)),j_=tt(),_S=G_(),hS=V_(),_u=class{constructor(e){var t;this._shutdown=!1;let n=j_.Resource.default().merge((t=e?.resource)!==null&&t!==void 0?t:j_.Resource.empty());if(this._sharedState=new _S.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?(as.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,as.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}addMetricReader(e){let t=new hS.MetricCollector(this._sharedState,e);e.setMetricProducer(t),this._sharedState.metricCollectors.push(t)}async shutdown(e){if(this._shutdown){as.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){as.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};us.MeterProvider=_u});var cs=c(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.ExactPredicate=Zt.PatternPredicate=void 0;var pS=/[\^$\\.+?()[\]{}|]/g,hu=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(pS,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};Zt.PatternPredicate=hu;var pu=class{constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};Zt.ExactPredicate=pu});var k_=c(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.InstrumentSelector=void 0;var H_=cs(),fu=class{constructor(e){var t;this._nameFilter=new H_.PatternPredicate((t=e?.name)!==null&&t!==void 0?t:"*"),this._type=e?.type,this._unitFilter=new H_.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};ls.InstrumentSelector=fu});var X_=c(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.MeterSelector=void 0;var Eu=cs(),mu=class{constructor(e){this._nameFilter=new Eu.ExactPredicate(e?.name),this._versionFilter=new Eu.ExactPredicate(e?.version),this._schemaUrlFilter=new Eu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};ds.MeterSelector=mu});var W_=c(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.View=void 0;var fS=cs(),$_=uu(),ES=k_(),mS=X_(),gS=Ui();function TS(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}var gu=class{constructor(e){var t;if(TS(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||fS.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 $_.FilteringAttributesProcessor(e.attributeKeys):this.attributesProcessor=$_.AttributesProcessor.Noop(),this.name=e.name,this.description=e.description,this.aggregation=(t=e.aggregation)!==null&&t!==void 0?t:gS.Aggregation.Default(),this.instrumentSelector=new ES.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new mS.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl})}};_s.View=gu});var K_=c(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 SS=Ri();Object.defineProperty(g,"AggregationTemporality",{enumerable:!0,get:function(){return SS.AggregationTemporality}});var AS=Nt();Object.defineProperty(g,"DataPointType",{enumerable:!0,get:function(){return AS.DataPointType}});var OS=xa();Object.defineProperty(g,"MetricReader",{enumerable:!0,get:function(){return OS.MetricReader}});var RS=E_();Object.defineProperty(g,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return RS.PeriodicExportingMetricReader}});var bS=g_();Object.defineProperty(g,"InMemoryMetricExporter",{enumerable:!0,get:function(){return bS.InMemoryMetricExporter}});var PS=S_();Object.defineProperty(g,"ConsoleMetricExporter",{enumerable:!0,get:function(){return PS.ConsoleMetricExporter}});var yS=Ae();Object.defineProperty(g,"InstrumentType",{enumerable:!0,get:function(){return yS.InstrumentType}});var vS=F_();Object.defineProperty(g,"MeterProvider",{enumerable:!0,get:function(){return vS.MeterProvider}});var xe=Ui();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 IS=W_();Object.defineProperty(g,"View",{enumerable:!0,get:function(){return IS.View}});var LS=Ee();Object.defineProperty(g,"TimeoutError",{enumerable:!0,get:function(){return LS.TimeoutError}})});var z_=c(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.AbstractAsyncHooksContextManager=void 0;var MS=J("events"),CS=["addListener","on","once","prependListener","prependOnceListener"],Tu=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(e,t){return t instanceof MS.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),CS.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 l=i.bind(n,o);u.set(o,l),i._wrapped=!0;try{return t.call(this,s,l)}finally{i._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}};hs.AbstractAsyncHooksContextManager=Tu});var Y_=c(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.AsyncLocalStorageContextManager=void 0;var NS=(h(),f(d)),wS=J("async_hooks"),xS=z_(),Su=class extends xS.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new wS.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:NS.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}};ps.AsyncLocalStorageContextManager=Su});var bu=c(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.toAnyValue=De.toKeyValue=De.toAttributes=void 0;function VS(r){return Object.keys(r).map(e=>Ou(e,r[e]))}De.toAttributes=VS;function Ou(r,e){return{key:r,value:Ru(e)}}De.toKeyValue=Ou;function Ru(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(Ru)}}:e==="object"&&r!=null?{kvlistValue:{values:Object.entries(r).map(([t,n])=>Ou(t,n))}}:{}}De.toAnyValue=Ru});var rh=c(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.toOtlpSpanEvent=Be.toOtlpLink=Be.sdkSpanToOtlpSpan=void 0;var Pu=bu();function jS(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,Pu.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>th(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:i.code,message:i.message},links:r.links.map(s=>eh(s,e)),droppedLinksCount:r.droppedLinksCount}}Be.sdkSpanToOtlpSpan=jS;function eh(r,e){var t;return{attributes:r.attributes?(0,Pu.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}}Be.toOtlpLink=eh;function th(r,e){return{attributes:r.attributes?(0,Pu.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}Be.toOtlpSpanEvent=th});var ah=c(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.getOtlpEncoder=oe.encodeAsString=oe.encodeAsLongBits=oe.toLongBits=oe.hrTimeToNanos=void 0;var ms=S(),FS=BigInt(1e9);function yu(r){return BigInt(r[0])*FS+BigInt(r[1])}oe.hrTimeToNanos=yu;function ih(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}oe.toLongBits=ih;function vu(r){let e=yu(r);return ih(e)}oe.encodeAsLongBits=vu;function sh(r){return yu(r).toString()}oe.encodeAsString=sh;var HS=typeof BigInt<"u"?sh:ms.hrTimeToNanoseconds;function nh(r){return r}function oh(r){if(r!==void 0)return(0,ms.hexToBase64)(r)}var kS={encodeHrTime:vu,encodeSpanContext:ms.hexToBase64,encodeOptionalSpanContext:oh};function XS(r){var e,t;if(r===void 0)return kS;let n=(e=r.useLongBits)!==null&&e!==void 0?e:!0,i=(t=r.useHex)!==null&&t!==void 0?t:!1;return{encodeHrTime:n?vu:HS,encodeSpanContext:i?nh:ms.hexToBase64,encodeOptionalSpanContext:i?nh:oh}}oe.getOtlpEncoder=XS});var Iu=c(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.createExportTraceServiceRequest=void 0;var $S=bu(),WS=rh(),KS=ah();function zS(r,e){let t=(0,KS.getOtlpEncoder)(e);return{resourceSpans:QS(r,t)}}gs.createExportTraceServiceRequest=zS;function YS(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 QS(r,e){let t=YS(r),n=[],i=t.entries(),s=i.next();for(;!s.done;){let[o,a]=s.value,u=[],l=a.values(),_=l.next();for(;!_.done;){let O=_.value;if(O.length>0){let{name:D,version:z,schemaUrl:I}=O[0].instrumentationLibrary,U=O.map(L=>(0,WS.sdkSpanToOtlpSpan)(L,e));u.push({scope:{name:D,version:z},spans:U,schemaUrl:I})}_=l.next()}let E={resource:{attributes:(0,$S.toAttributes)(o.attributes),droppedAttributesCount:0},scopeSpans:u,schemaUrl:void 0};n.push(E),s=i.next()}return n}});var lh=c(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.parseRetryAfterToMills=C.isExportRetryable=C.invalidTimeout=C.configureExporterTimeout=C.appendRootPathToUrlIfNeeded=C.appendResourcePathToUrl=C.parseHeaders=C.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=C.DEFAULT_EXPORT_MAX_BACKOFF=C.DEFAULT_EXPORT_INITIAL_BACKOFF=C.DEFAULT_EXPORT_MAX_ATTEMPTS=void 0;var Lu=(h(),f(d)),uh=S(),ch=1e4;C.DEFAULT_EXPORT_MAX_ATTEMPTS=5;C.DEFAULT_EXPORT_INITIAL_BACKOFF=1e3;C.DEFAULT_EXPORT_MAX_BACKOFF=5e3;C.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=1.5;function ZS(r={}){let e={};return Object.entries(r).forEach(([t,n])=>{typeof n<"u"?e[t]=String(n):Lu.diag.warn(`Header "${t}" has wrong value and will be ignored`)}),e}C.parseHeaders=ZS;function JS(r,e){return r.endsWith("/")||(r=r+"/"),r+e}C.appendResourcePathToUrl=JS;function eA(r){try{let e=new URL(r);return e.pathname===""&&(e.pathname=e.pathname+"/"),e.toString()}catch{return Lu.diag.warn(`Could not parse export URL: '${r}'`),r}}C.appendRootPathToUrlIfNeeded=eA;function tA(r){return typeof r=="number"?r<=0?Mu(r,ch):r:rA()}C.configureExporterTimeout=tA;function rA(){var r;let e=Number((r=(0,uh.getEnv)().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT)!==null&&r!==void 0?r:(0,uh.getEnv)().OTEL_EXPORTER_OTLP_TIMEOUT);return e<=0?Mu(e,ch):e}function Mu(r,e){return Lu.diag.warn("Timeout must be greater than 0",r),e}C.invalidTimeout=Mu;function nA(r){return[429,502,503,504].includes(r)}C.isExportRetryable=nA;function iA(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}C.parseRetryAfterToMills=iA});var _h=c(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.OTLPExporterBase=void 0;var dh=(h(),f(d)),xr=S(),sA=lh(),Cu=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 xr.BindOnceFuture(this._shutdown,this),this._concurrencyLimit=typeof e.concurrencyLimit=="number"?e.concurrencyLimit:30,this.timeoutMillis=(0,sA.configureExporterTimeout)(e.timeoutMillis),this.onInit(e)}export(e,t){if(this._shutdownOnce.isCalled){t({code:xr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")});return}if(this._sendingPromises.length>=this._concurrencyLimit){t({code:xr.ExportResultCode.FAILED,error:new Error("Concurrent export limit reached")});return}this._export(e).then(()=>{t({code:xr.ExportResultCode.SUCCESS})}).catch(n=>{t({code:xr.ExportResultCode.FAILED,error:n})})}_export(e){return new Promise((t,n)=>{try{dh.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 dh.diag.debug("shutdown started"),this.onShutdown(),this.forceFlush()}};Ts.OTLPExporterBase=Cu});var Eh=c((vP,fh)=>{"use strict";fh.exports=uA;function uA(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 E=new Array(arguments.length-1),O=0;O<E.length;)E[O++]=arguments[O];a.apply(null,E)}};try{r.apply(e||null,t)}catch(l){s&&(s=!1,u(l))}})}});var Sh=c(Th=>{"use strict";var As=Th;As.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 rr=new Array(64),gh=new Array(123);for(le=0;le<64;)gh[rr[le]=le<26?le+65:le<52?le+71:le<62?le-4:le-59|43]=le++;var le;As.encode=function(e,t,n){for(var i=null,s=[],o=0,a=0,u;t<n;){var l=e[t++];switch(a){case 0:s[o++]=rr[l>>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=rr[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=rr[u|l>>6],s[o++]=rr[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=rr[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 mh="invalid encoding";As.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=gh[u])===void 0)throw Error(mh);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(mh);return n-i};As.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Oh=c((LP,Ah)=>{"use strict";Ah.exports=Os;function Os(){this._listeners={}}Os.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};Os.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};Os.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 Lh=c((MP,Ih)=>{"use strict";Ih.exports=Rh(Rh);function Rh(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function i(u,l,_){e[0]=u,l[_]=t[0],l[_+1]=t[1],l[_+2]=t[2],l[_+3]=t[3]}function s(u,l,_){e[0]=u,l[_]=t[3],l[_+1]=t[2],l[_+2]=t[1],l[_+3]=t[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function o(u,l){return t[0]=u[l],t[1]=u[l+1],t[2]=u[l+2],t[3]=u[l+3],e[0]}function a(u,l){return t[3]=u[l],t[2]=u[l+1],t[1]=u[l+2],t[0]=u[l+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),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}r.writeFloatLE=e.bind(null,bh),r.writeFloatBE=e.bind(null,Ph);function t(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}r.readFloatLE=t.bind(null,yh),r.readFloatBE=t.bind(null,vh)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function i(u,l,_){e[0]=u,l[_]=t[0],l[_+1]=t[1],l[_+2]=t[2],l[_+3]=t[3],l[_+4]=t[4],l[_+5]=t[5],l[_+6]=t[6],l[_+7]=t[7]}function s(u,l,_){e[0]=u,l[_]=t[7],l[_+1]=t[6],l[_+2]=t[5],l[_+3]=t[4],l[_+4]=t[3],l[_+5]=t[2],l[_+6]=t[1],l[_+7]=t[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function o(u,l){return t[0]=u[l],t[1]=u[l+1],t[2]=u[l+2],t[3]=u[l+3],t[4]=u[l+4],t[5]=u[l+5],t[6]=u[l+6],t[7]=u[l+7],e[0]}function a(u,l){return t[7]=u[l],t[6]=u[l+1],t[5]=u[l+2],t[4]=u[l+3],t[3]=u[l+4],t[2]=u[l+5],t[1]=u[l+6],t[0]=u[l+7],e[0]}r.readDoubleLE=n?o:a,r.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(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((l<<31|2146435072)>>>0,a,u+s);else{var _;if(o<22250738585072014e-324)_=o/5e-324,n(_>>>0,a,u+i),n((l<<31|_/4294967296)>>>0,a,u+s);else{var E=Math.floor(Math.log(o)/Math.LN2);E===1024&&(E=1023),_=o*Math.pow(2,-E),n(_*4503599627370496>>>0,a,u+i),n((l<<31|E+1023<<20|_*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,bh,0,4),r.writeDoubleBE=e.bind(null,Ph,4,0);function t(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),_=(l>>31)*2+1,E=l>>>20&2047,O=4294967296*(l&1048575)+u;return E===2047?O?NaN:_*(1/0):E===0?_*5e-324*O:_*Math.pow(2,E-1075)*(O+4503599627370496)}r.readDoubleLE=t.bind(null,yh,0,4),r.readDoubleBE=t.bind(null,vh,4,0)}(),r}function bh(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 Ph(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 yh(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function vh(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var Mh=c((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 Nh=c(Ch=>{"use strict";var wu=Ch;wu.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};wu.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))};wu.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 xh=c((NP,wh)=>{"use strict";wh.exports=cA;function cA(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 l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var Bh=c((wP,Dh)=>{"use strict";Dh.exports=V;var Dr=qe();function V(r,e){this.lo=r>>>0,this.hi=e>>>0}var ut=V.zero=new V(0,0);ut.toNumber=function(){return 0};ut.zzEncode=ut.zzDecode=function(){return this};ut.length=function(){return 1};var lA=V.zeroHash="\0\0\0\0\0\0\0\0";V.fromNumber=function(e){if(e===0)return ut;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 V(n,i)};V.from=function(e){if(typeof e=="number")return V.fromNumber(e);if(Dr.isString(e))if(Dr.Long)e=Dr.Long.fromString(e);else return V.fromNumber(parseInt(e,10));return e.low||e.high?new V(e.low>>>0,e.high>>>0):ut};V.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};V.prototype.toLong=function(e){return Dr.Long?new Dr.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ue=String.prototype.charCodeAt;V.fromHash=function(e){return e===lA?ut:new V((Ue.call(e,0)|Ue.call(e,1)<<8|Ue.call(e,2)<<16|Ue.call(e,3)<<24)>>>0,(Ue.call(e,4)|Ue.call(e,5)<<8|Ue.call(e,6)<<16|Ue.call(e,7)<<24)>>>0)};V.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)};V.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};V.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};V.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=c(xu=>{"use strict";var p=xu;p.asPromise=Eh();p.base64=Sh();p.EventEmitter=Oh();p.float=Lh();p.inquire=Mh();p.utf8=Nh();p.pool=xh();p.LongBits=Bh();p.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);p.global=p.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||xu;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};p.isString=function(e){return typeof e=="string"||e instanceof String};p.isObject=function(e){return e&&typeof e=="object"};p.isset=p.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};p.Buffer=function(){try{var r=p.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();p._Buffer_from=null;p._Buffer_allocUnsafe=null;p.newBuffer=function(e){return typeof e=="number"?p.Buffer?p._Buffer_allocUnsafe(e):new p.Array(e):p.Buffer?p._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};p.Array=typeof Uint8Array<"u"?Uint8Array:Array;p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long");p.key2Re=/^true|false|0|1$/;p.key32Re=/^-?(?:0|[1-9][0-9]*)$/;p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;p.longToHash=function(e){return e?p.LongBits.from(e).toHash():p.LongBits.zeroHash};p.longFromHash=function(e,t){var n=p.LongBits.fromHash(e);return p.Long?p.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function Uh(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}p.merge=Uh;p.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function qh(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&&Uh(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}p.newError=qh;p.ProtocolError=qh("ProtocolError");p.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]}};p.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};p._configure=function(){var r=p.Buffer;if(!r){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},p._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var ju=c((DP,Fh)=>{"use strict";Fh.exports=A;var ae=qe(),Du,Rs=ae.LongBits,Gh=ae.base64,Vh=ae.utf8;function Br(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Uu(){}function dA(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function A(){this.len=0,this.head=new Br(Uu,0,0),this.tail=this.head,this.states=null}var jh=function(){return ae.Buffer?function(){return(A.create=function(){return new Du})()}:function(){return new A}};A.create=jh();A.alloc=function(e){return new ae.Array(e)};ae.Array!==Array&&(A.alloc=ae.pool(A.alloc,ae.Array.prototype.subarray));A.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Br(e,t,n),this.len+=t,this};function qu(r,e,t){e[t]=r&255}function _A(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function Gu(r,e){this.len=r,this.next=void 0,this.val=e}Gu.prototype=Object.create(Br.prototype);Gu.prototype.fn=_A;A.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Gu((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};A.prototype.int32=function(e){return e<0?this._push(Vu,10,Rs.fromNumber(e)):this.uint32(e)};A.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Vu(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}A.prototype.uint64=function(e){var t=Rs.from(e);return this._push(Vu,t.length(),t)};A.prototype.int64=A.prototype.uint64;A.prototype.sint64=function(e){var t=Rs.from(e).zzEncode();return this._push(Vu,t.length(),t)};A.prototype.bool=function(e){return this._push(qu,1,e?1:0)};function Bu(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}A.prototype.fixed32=function(e){return this._push(Bu,4,e>>>0)};A.prototype.sfixed32=A.prototype.fixed32;A.prototype.fixed64=function(e){var t=Rs.from(e);return this._push(Bu,4,t.lo)._push(Bu,4,t.hi)};A.prototype.sfixed64=A.prototype.fixed64;A.prototype.float=function(e){return this._push(ae.float.writeFloatLE,4,e)};A.prototype.double=function(e){return this._push(ae.float.writeDoubleLE,8,e)};var hA=ae.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]};A.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(qu,1,0);if(ae.isString(e)){var n=A.alloc(t=Gh.length(e));Gh.decode(e,n,0),e=n}return this.uint32(t)._push(hA,t,e)};A.prototype.string=function(e){var t=Vh.length(e);return t?this.uint32(t)._push(Vh.write,t,e):this._push(qu,1,0)};A.prototype.fork=function(){return this.states=new dA(this),this.head=this.tail=new Br(Uu,0,0),this.len=0,this};A.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 Br(Uu,0,0),this.len=0),this};A.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};A.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};A._configure=function(r){Du=r,A.create=jh(),Du._configure()}});var Xh=c((BP,kh)=>{"use strict";kh.exports=ge;var Hh=ju();(ge.prototype=Object.create(Hh.prototype)).constructor=ge;var Ge=qe();function ge(){Hh.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 pA(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(pA,t,e),this};ge._configure()});var ku=c((UP,Yh)=>{"use strict";Yh.exports=w;var de=qe(),Hu,Kh=de.LongBits,fA=de.utf8;function _e(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function w(r){this.buf=r,this.pos=0,this.len=r.length}var $h=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new w(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new w(e);throw Error("illegal buffer")},zh=function(){return de.Buffer?function(t){return(w.create=function(i){return de.Buffer.isBuffer(i)?new Hu(i):$h(i)})(t)}:$h};w.create=zh();w.prototype._slice=de.Array.prototype.subarray||de.Array.prototype.slice;w.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,_e(this,10);return e}}();w.prototype.int32=function(){return this.uint32()|0};w.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Fu(){var r=new Kh(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 _e(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 _e(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")}w.prototype.bool=function(){return this.uint32()!==0};function bs(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}w.prototype.fixed32=function(){if(this.pos+4>this.len)throw _e(this,4);return bs(this.buf,this.pos+=4)};w.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _e(this,4);return bs(this.buf,this.pos+=4)|0};function Wh(){if(this.pos+8>this.len)throw _e(this,8);return new Kh(bs(this.buf,this.pos+=4),bs(this.buf,this.pos+=4))}w.prototype.float=function(){if(this.pos+4>this.len)throw _e(this,4);var e=de.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};w.prototype.double=function(){if(this.pos+8>this.len)throw _e(this,4);var e=de.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};w.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw _e(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var i=de.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};w.prototype.string=function(){var e=this.bytes();return fA.read(e,0,e.length)};w.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw _e(this,e);this.pos+=e}else do if(this.pos>=this.len)throw _e(this);while(this.buf[this.pos++]&128);return this};w.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};w._configure=function(r){Hu=r,w.create=zh(),Hu._configure();var e=de.Long?"toLong":"toNumber";de.merge(w.prototype,{int64:function(){return Fu.call(this)[e](!1)},uint64:function(){return Fu.call(this)[e](!0)},sint64:function(){return Fu.call(this).zzDecode()[e](!1)},fixed64:function(){return Wh.call(this)[e](!0)},sfixed64:function(){return Wh.call(this)[e](!1)}})}});var ep=c((qP,Jh)=>{"use strict";Jh.exports=ct;var Zh=ku();(ct.prototype=Object.create(Zh.prototype)).constructor=ct;var Qh=qe();function ct(r){Zh.call(this,r)}ct._configure=function(){Qh.Buffer&&(ct.prototype._slice=Qh.Buffer.prototype.slice)};ct.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))};ct._configure()});var rp=c((GP,tp)=>{"use strict";tp.exports=Ur;var Xu=qe();(Ur.prototype=Object.create(Xu.EventEmitter.prototype)).constructor=Ur;function Ur(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Xu.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Ur.prototype.rpcCall=function r(e,t,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Xu.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,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(_){return o.emit("error",_,e),s(_)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Ur.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var ip=c(np=>{"use strict";var EA=np;EA.Service=rp()});var op=c((jP,sp)=>{"use strict";sp.exports={}});var cp=c(up=>{"use strict";var Z=up;Z.build="minimal";Z.Writer=ju();Z.BufferWriter=Xh();Z.Reader=ku();Z.BufferReader=ep();Z.util=qe();Z.rpc=ip();Z.roots=op();Z.configure=ap;function ap(){Z.util._configure(),Z.Writer._configure(Z.BufferWriter),Z.Reader._configure(Z.BufferReader)}ap()});var dp=c((HP,lp)=>{"use strict";lp.exports=cp()});var N=H(Yo(),1);h();ta();var Ap=H(yd(),1),or=H(tt(),1),Op=H(Fd(),1),Rp=H(K_(),1),Yu=H(ie(),1),ar=H(kr(),1),bp=H(Y_(),1),Ve=H(S(),1);h();var DS=Symbol.for("@vercel/request-context");function Jt(){return globalThis[DS]?.get()}var Au=H(ie(),1);function fs(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function Q_(r){return r?r.split("::").at(-1):void 0}function Z_(r=Jt(),e){if(!r)return;let t=e?US(e,r.headers):void 0;return fs({[Au.SemanticAttributes.HTTP_HOST]:r.headers.host,[Au.SemanticAttributes.HTTP_USER_AGENT]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":Q_(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":r.headers["x-vercel-edge-region"],...t})}var BS={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function US(r,e){if(typeof r=="function")return r(e,BS);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 wr(r){return(r&d.TraceFlags.SAMPLED)!==0}var Es=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&&wr(s)){let a=Jt(),u=Z_(a,this.attributesFromHeaders);u&&e.setAttributes(u),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let l=new Promise(E=>{this.waitSpanEnd.set(n,E)}),_;await Promise.race([l,new Promise(E=>{_=setTimeout(()=>{this.waitSpanEnd.delete(n),E(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=wr(i),o=this.rootSpanIds.get(t),a=o?.rootSpanId===n;if(s){let u=GS(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(l){d.diag.error("@vercel/otel: onEnd failed:",l)}}}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())}}},qS={[d.SpanKind.INTERNAL]:"internal",[d.SpanKind.SERVER]:"server",[d.SpanKind.CLIENT]:"client",[d.SpanKind.PRODUCER]:"producer",[d.SpanKind.CONSUMER]:"consumer"};function GS(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 l=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":l};let _=r.instrumentationLibrary.name,E=o??s;if(E&&typeof E=="string"){let O=J_(_,E);return u?{"operation.name":O,"resource.name":l}:{"operation.name":O}}return{"operation.name":J_(_,e===d.SpanKind.INTERNAL?"":qS[e])}}function J_(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var ph=H(Iu(),1);var hh=H(_h(),1);h();var er=class extends hh.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(l){d.diag.warn("@vercel/otel/otlp: no proto",l);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(l=>{d.diag.debug("@vercel/otel/otlp: onSuccess",l.status,l.statusText),t(),l.arrayBuffer().catch(()=>{})}).catch(l=>{d.diag.error("@vercel/otel/otlp: onError",l),n(l)}).finally(()=>{let l=this._sendingPromises.indexOf(u);this._sendingPromises.splice(l,1)});this._sendingPromises.push(u)}getDefaultUrl(e){throw new Error("Method not implemented.")}};var oA="v1/traces",aA=`http://localhost:4318/${oA}`;function Ss(r){return typeof r.url=="string"?r.url:aA}var tr=class{constructor(e={}){this.impl=new Nu(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},Nu=class extends er{convert(e){return(0,ph.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1})}toMessage(e){return{body:JSON.stringify(e),contentType:"application/json"}}getDefaultUrl(e){return Ss(e)}};var fp=H(Iu(),1);var _p=H(dp(),1);function hp(r){let e=new _p.Writer;return mA(r,e),e.finish()}function mA(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)gA(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function gA(r,e){if(r.resource!=null&&TA(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)SA(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function TA(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)nr(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function SA(r,e){if(r.scope!=null&&RA(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)bA(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function nr(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&pp(r.value,e.uint32(18).fork()).ldelim(),e}function pp(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&&AA(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&OA(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function AA(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)pp(r.values[t],e.uint32(10).fork()).ldelim();return e}function OA(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)nr(r.values[t],e.uint32(10).fork()).ldelim();return e}function RA(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)nr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function bA(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)nr(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)yA(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)vA(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&PA(r.status,e.uint32(122).fork()).ldelim(),e}function PA(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function yA(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)nr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function vA(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)nr(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var lt=class{constructor(e={}){this.impl=new $u(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},$u=class extends er{convert(e){return(0,fp.createExportTraceServiceRequest)(e,void 0)}toMessage(e){return{body:hp(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Ss(e)}};h();var Re=H(ie(),1);function Ep(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let i=e[n];return i!==void 0?String(i):t})}var ir=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(){}enable(){this.disable();let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),n=this.config.ignoreUrls??[],i=(I,U)=>{if(U?.opentelemetry?.ignore!==void 0)return U.opentelemetry.ignore;if(n.length===0)return!1;let L=I.toString();return n.some(m=>typeof m=="string"?m==="*"?!0:L.startsWith(m):m.test(L))},s=process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||null,o=process.env.VERCEL_BRANCH_URL||process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL||null,a=this.config.propagateContextUrls??[],u=this.config.dontPropagateContextUrls??[],l=this.config.resourceNameTemplate,{attributesFromRequestHeaders:_,attributesFromResponseHeaders:E}=this.config,O=(I,U)=>{if(U?.opentelemetry?.propagateContext)return U.opentelemetry.propagateContext;let L=I.toString();return u.length>0&&u.some(m=>typeof m=="string"?m==="*"?!0:L.startsWith(m):m.test(L))?!1:s&&I.protocol==="https:"&&(I.host===s||I.host===o||I.host===Jt()?.headers.host)||!s&&I.protocol==="http:"&&I.hostname==="localhost"?!0:a.some(m=>typeof m=="string"?m==="*"?!0:L.startsWith(m):m.test(L))};process.env.NEXT_OTEL_FETCH_DISABLED="1";let D=globalThis.fetch;this.originalFetch=D;let z=async(I,U)=>{let L=U;if(L?.next?.internal)return D(I,L);let m=new Request(I instanceof Request?I.clone():I,L),be=new URL(m.url);if(i(be,L))return D(I,L);let ys={[Re.SemanticAttributes.HTTP_METHOD]:m.method,[Re.SemanticAttributes.HTTP_URL]:m.url,[Re.SemanticAttributes.HTTP_HOST]:be.host,[Re.SemanticAttributes.HTTP_SCHEME]:be.protocol.replace(":",""),[Re.SemanticAttributes.NET_PEER_NAME]:be.hostname,[Re.SemanticAttributes.NET_PEER_PORT]:be.port},dt=l?Ep(l,ys):LA(m.url),yp=L?.opentelemetry?.spanName??`fetch ${m.method} ${m.url}`,Qu=d.context.active(),q=t.startSpan(yp,{kind:d.SpanKind.CLIENT,attributes:{...ys,"operation.name":`fetch.${m.method}`,"resource.name":dt,...L?.opentelemetry?.attributes}},Qu);if(!q.isRecording()||!wr(q.spanContext().traceFlags))return q.end(),D(I,L);if(O(be,L)){let _t=d.trace.setSpan(Qu,q);d.propagation.inject(_t,m.headers,IA)}_&&mp(q,_,m.headers);try{let _t=Date.now(),Pe=await D(I,{...L,headers:m.headers}),vp=Date.now()-_t;return q.setAttribute(Re.SemanticAttributes.HTTP_STATUS_CODE,Pe.status),q.setAttribute("http.response_time",vp),E&&mp(q,E,Pe.headers),Pe.status>=500&&Wu(q,`Status: ${Pe.status} (${Pe.statusText})`),Pe.body?MA(Pe).then(vs=>{q.isRecording()&&(q.setAttribute(Re.SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,vs),q.end())},vs=>{q.isRecording()&&(Wu(q,vs),q.end())}):q.end(),Pe}catch(_t){throw Wu(q,_t),q.end(),_t}};globalThis.fetch=z}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},IA={set(r,e,t){r.set(e,t)}};function LA(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function MA(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 Wu(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 mp(r,e,t){for(let[n,i]of Object.entries(e)){let s=t.get(i);s!==null&&r.setAttribute(n,s)}}h();var gp=H(S(),1),CA="00",Ku="traceparent",zu="tracestate",qr=class{fields(){return[Ku,zu]}inject(e,t,n){let i=d.trace.getSpanContext(e);if(!i||(0,gp.isTracingSuppressed)(e)||!(0,d.isSpanContextValid)(i))return;let s=`${CA}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||0).toString(16)}`;n.set(t,Ku,s),i.traceState&&n.set(t,zu,i.traceState.serialize())}extract(e,t,n){let i=n.get(t,Ku);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=NA(s);if(!o)return e;o.isRemote=!0;let a=n.get(t,zu);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 NA(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)}}var Ps=class{constructor(e={}){this.configuration=e}start(){let e=wA(),t=(0,ar.getEnvWithoutDefaults)(),n=this.configuration,i=process.env.NEXT_RUNTIME||"nodejs",s=!!e.OTEL_SDK_DISABLED;if(t.OTEL_LOG_LEVEL&&d.diag.setLogger(new d.DiagConsoleLogger,{logLevel:t.OTEL_LOG_LEVEL}),s)return;let o=n.idGenerator??new N.RandomIdGenerator,a=n.contextManager??new bp.AsyncLocalStorageContextManager;a.enable(),this.contextManager=a;let u=e.OTEL_SERVICE_NAME||n.serviceName||"app",l=new or.Resource(fs({[Yu.SemanticResourceAttributes.SERVICE_NAME]:u,"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":i,"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,[Yu.SemanticResourceAttributes.SERVICE_VERSION]:process.env.VERCEL_DEPLOYMENT_ID,...n.attributes})),_=n.resourceDetectors??[or.envDetectorSync];if(n.autoDetectResources??!0){let m={detectors:_};l=l.merge((0,or.detectResourcesSync)(m))}let O=DA(n.propagators,e),D=BA(n.traceSampler,e),z=UA(n.spanProcessors,n,e);z.length===0&&d.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let I=n.spanLimits,U=new N.BasicTracerProvider({resource:l,idGenerator:o,sampler:D,spanLimits:I});if(U.addSpanProcessor(new Es(z,n.attributesFromHeaders)),U.register({contextManager:a,propagator:new Ve.CompositePropagator({propagators:O})}),this.tracerProvider=U,n.logRecordProcessor){let m=new Op.LoggerProvider({resource:l});this.loggerProvider=m,m.addLogRecordProcessor(n.logRecordProcessor),it.logs.setGlobalLoggerProvider(m)}if(n.metricReader||n.views){let m=new Rp.MeterProvider({resource:l,views:n.views??[]});n.metricReader&&m.addMetricReader(n.metricReader),d.metrics.setGlobalMeterProvider(m),this.meterProvider=m}let L=xA(n.instrumentations,n.instrumentationConfig);this.disableInstrumentations=(0,Ap.registerInstrumentations)({instrumentations:L}),d.diag.info("@vercel/otel: started",u,i)}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 wA(){let r=(0,ar.parseEnvironment)(process.env);return{...ar.DEFAULT_ENVIRONMENT,...r}}function xA(r,e){return(r??["auto"]).map(t=>t==="auto"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new ir(e?.fetch)]):t==="fetch"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new ir(e?.fetch)):t).flat()}function DA(r,e){let t=e.OTEL_PROPAGATORS&&e.OTEL_PROPAGATORS.length>0?e.OTEL_PROPAGATORS:void 0;return(r??t??["auto"]).map(n=>{if(n==="none")return[];if(n==="auto")return d.diag.debug("@vercel/otel: Configure propagators: tracecontext, baggage"),[new qr,new Ve.W3CBaggagePropagator];if(n==="tracecontext")return d.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new qr;if(n==="baggage")return d.diag.debug("@vercel/otel: Configure propagator: baggage"),new Ve.W3CBaggagePropagator;if(typeof n=="string")throw new Error(`Unknown propagator: "${n}"`);return n}).flat()}var Tp="always_on",sr=1;function BA(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||Tp;switch(d.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new N.AlwaysOnSampler;case"always_off":return new N.AlwaysOffSampler;case"parentbased_always_on":return new N.ParentBasedSampler({root:new N.AlwaysOnSampler});case"parentbased_always_off":return new N.ParentBasedSampler({root:new N.AlwaysOffSampler});case"traceidratio":return new N.TraceIdRatioBasedSampler(Sp(e));case"parentbased_traceidratio":return new N.ParentBasedSampler({root:new N.TraceIdRatioBasedSampler(Sp(e))});default:return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${Tp}".`),new N.AlwaysOnSampler}}function Sp(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 ${sr}.`),sr;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 ${sr}.`),sr):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 ${sr}.`),sr):e}function UA(r,e,t){return[...(r??["auto"]).map(n=>{if(n==="auto"){if(process.env.VERCEL_OTEL_ENDPOINTS){let i=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",s=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";d.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",i,s);let o={url:`http://localhost:${i}/v1/traces`,headers:{}},a=s==="http/protobuf"?new lt(o):new tr(o);return new N.BatchSpanProcessor(a)}return!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT?new N.BatchSpanProcessor(qA(t)):void 0}return n}).filter(jA),...e.traceExporter&&e.traceExporter!=="auto"?[new N.BatchSpanProcessor(e.traceExporter)]:[]]}function qA(r){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??process.env.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=VA(r),n={...Ve.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_HEADERS),...Ve.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 tr({url:t,headers:n});case"http/protobuf":return new lt({url:t,headers:n});default:return d.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new lt}}var Pp="v1/traces",GA=`http://localhost:4318/${Pp}`;function VA(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}/${Pp}`:GA}function jA(r){return r!=null}function hy(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new Ps(e).start()}export{ir as FetchInstrumentation,tr as OTLPHttpJsonTraceExporter,lt as OTLPHttpProtoTraceExporter,hy as registerOTel};
|
|
21
21
|
//# sourceMappingURL=index.js.map
|