firebase 13.3.0 → 13.4.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.
Files changed (49) hide show
  1. package/app/dist/esm/index.esm.js +1 -1
  2. package/app/dist/index.cjs.js +1 -1
  3. package/app/dist/index.mjs +1 -1
  4. package/compat/app/dist/esm/index.esm.js +1 -1
  5. package/compat/app/dist/index.cjs.js +1 -1
  6. package/compat/app/dist/index.mjs +1 -1
  7. package/compat/dist/esm/index.esm.js +2 -2
  8. package/compat/dist/index.node.cjs +2 -2
  9. package/compat/dist/index.rn.cjs.js +2 -2
  10. package/firebase-ai.js +1 -1
  11. package/firebase-analytics-compat.js +1 -1
  12. package/firebase-analytics-compat.js.map +1 -1
  13. package/firebase-analytics.js +1 -1
  14. package/firebase-analytics.js.map +1 -1
  15. package/firebase-app-check-compat.js +1 -1
  16. package/firebase-app-check-compat.js.map +1 -1
  17. package/firebase-app-check.js +1 -1
  18. package/firebase-app-check.js.map +1 -1
  19. package/firebase-app-compat.js +3 -3
  20. package/firebase-app-compat.js.map +1 -1
  21. package/firebase-app.js +134 -6
  22. package/firebase-app.js.map +1 -1
  23. package/firebase-auth-compat.js +1 -1
  24. package/firebase-auth-compat.js.map +1 -1
  25. package/firebase-auth-cordova.js +1 -1
  26. package/firebase-auth-web-extension.js +1 -1
  27. package/firebase-auth.js +1 -1
  28. package/firebase-auth.js.map +1 -1
  29. package/firebase-compat.js +11 -11
  30. package/firebase-compat.js.map +1 -1
  31. package/firebase-crashlytics.js +1 -1
  32. package/firebase-crashlytics.js.map +1 -1
  33. package/firebase-data-connect.js +1 -1
  34. package/firebase-database.js +1 -1
  35. package/firebase-firestore-compat.js +1 -1
  36. package/firebase-firestore-lite-pipelines.js +1 -1
  37. package/firebase-firestore-lite.js +1 -1
  38. package/firebase-firestore-pipelines.js +1 -1
  39. package/firebase-firestore.js +1 -1
  40. package/firebase-functions.js +1 -1
  41. package/firebase-installations.js +1 -1
  42. package/firebase-messaging-sw.js +1 -1
  43. package/firebase-messaging.js +1 -1
  44. package/firebase-performance-standalone-compat.js +64 -46
  45. package/firebase-performance-standalone-compat.js.map +1 -1
  46. package/firebase-performance.js +1 -1
  47. package/firebase-remote-config.js +1 -1
  48. package/firebase-storage.js +1 -1
  49. package/package.json +10 -10
@@ -1,3 +1,3 @@
1
- import{registerVersion as _,_registerComponent as E,_getProvider,getApp as w}from"https://www.gstatic.com/firebasejs/13.3.0/firebase-app.js";class FirebaseError extends Error{constructor(_,E,w){super(E),this.code=_,this.customData=w,this.name="FirebaseError",Object.setPrototypeOf(this,FirebaseError.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ErrorFactory.prototype.create)}}class ErrorFactory{constructor(_,E,w){this.service=_,this.serviceName=E,this.errors=w}create(_,...E){const w=E[0]||{},C=`${this.service}/${_}`,L=this.errors[_],R=L?function replaceTemplate(_,E){try{let w=0,C="";for(;w<_.length;){const L=_.indexOf("{$",w);if(-1===L){C+=_.substring(w);break}const R=_.indexOf("}",L+2);if(-1===R){C+=_.substring(w);break}const P=_.substring(L+2,R),I=E[P];C+=_.substring(w,L)+(null!=I?String(I):`<${P}?>`),w=R+1}return C}catch(E){return _}}(L,w):"Error",P=`${this.serviceName}: ${R} (${C}).`;return new FirebaseError(C,P,w)}}function deepEqual(_,E){if(_===E)return!0;const w=Object.keys(_),C=Object.keys(E);for(const L of w){if(!C.includes(L))return!1;const w=_[L],R=E[L];if(isObject$1(w)&&isObject$1(R)){if(!deepEqual(w,R))return!1}else if(w!==R)return!1}for(const _ of C)if(!w.includes(_))return!1;return!0}function isObject$1(_){return null!==_&&"object"==typeof _}class Component{constructor(_,E,w){this.name=_,this.instanceFactory=E,this.type=w,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(_){return this.instantiationMode=_,this}setMultipleInstances(_){return this.multipleInstances=_,this}setServiceProps(_){return this.serviceProps=_,this}setInstanceCreatedCallback(_){return this.onInstanceCreated=_,this}}var C,L,R;!function(_){_.LAZY="LAZY",_.EAGER="EAGER",_.EXPLICIT="EXPLICIT"}(C||(C={})),function(_){_.PUBLIC="PUBLIC",_.PRIVATE="PRIVATE",_.VERSION="VERSION"}(L||(L={})),function(_){_[_.UNSPECIFIED=0]="UNSPECIFIED",_[_.TRACE=1]="TRACE",_[_.TRACE2=2]="TRACE2",_[_.TRACE3=3]="TRACE3",_[_.TRACE4=4]="TRACE4",_[_.DEBUG=5]="DEBUG",_[_.DEBUG2=6]="DEBUG2",_[_.DEBUG3=7]="DEBUG3",_[_.DEBUG4=8]="DEBUG4",_[_.INFO=9]="INFO",_[_.INFO2=10]="INFO2",_[_.INFO3=11]="INFO3",_[_.INFO4=12]="INFO4",_[_.WARN=13]="WARN",_[_.WARN2=14]="WARN2",_[_.WARN3=15]="WARN3",_[_.WARN4=16]="WARN4",_[_.ERROR=17]="ERROR",_[_.ERROR2=18]="ERROR2",_[_.ERROR3=19]="ERROR3",_[_.ERROR4=20]="ERROR4",_[_.FATAL=21]="FATAL",_[_.FATAL2=22]="FATAL2",_[_.FATAL3=23]="FATAL3",_[_.FATAL4=24]="FATAL4"}(R||(R={}));class NoopLogger{emit(_){}enabled(){return!1}}const P=new NoopLogger;const I=Symbol.for("io.opentelemetry.js.api.logs"),k=globalThis;const F=new class NoopLoggerProvider{getLogger(_,E,w){return new NoopLogger}};class ProxyLogger{constructor(_,E,w,C){this._provider=_,this.name=E,this.version=w,this.options=C}emit(_){this._getLogger().emit(_)}enabled(_){return this._getLogger().enabled(_)}_getLogger(){if(this._delegate)return this._delegate;const _=this._provider._getDelegateLogger(this.name,this.version,this.options);return _?(this._delegate=_,this._delegate):P}}class ProxyLoggerProvider{getLogger(_,E,w){var C;return null!==(C=this._getDelegateLogger(_,E,w))&&void 0!==C?C:new ProxyLogger(this,_,E,w)}_getDelegate(){var _;return null!==(_=this._delegate)&&void 0!==_?_:F}_setDelegate(_){this._delegate=_}_getDelegateLogger(_,E,w){var C;return null===(C=this._delegate)||void 0===C?void 0:C.getLogger(_,E,w)}}class LogsAPI{constructor(){this._proxyLoggerProvider=new ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new LogsAPI),this._instance}setGlobalLoggerProvider(_){return k[I]?this.getLoggerProvider():(k[I]=function makeGetter(_,E,w){return C=>C===_?E:w}(1,_,F),this._proxyLoggerProvider._setDelegate(_),_)}getLoggerProvider(){var _,E;return null!==(E=null===(_=k[I])||void 0===_?void 0:_.call(k,1))&&void 0!==E?E:this._proxyLoggerProvider}getLogger(_,E,w){return this.getLoggerProvider().getLogger(_,E,w)}disable(){delete k[I],this._proxyLoggerProvider=new ProxyLoggerProvider}}const $=LogsAPI.getInstance(),V="1.9.1",H=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;const j=function _makeCompatibilityCheck(_){const E=new Set([_]),w=new Set,C=_.match(H);if(!C)return()=>!1;const L=+C[1],R=+C[2],P=+C[3];if(null!=C[4])return function isExactmatch(E){return E===_};function _reject(_){return w.add(_),!1}function _accept(_){return E.add(_),!0}return function isCompatible(_){if(E.has(_))return!0;if(w.has(_))return!1;const C=_.match(H);if(!C)return _reject(_);const I=+C[1],k=+C[2],F=+C[3];return null!=C[4]||L!==I?_reject(_):0===L?R===k&&P<=F?_accept(_):_reject(_):R<=k?_accept(_):_reject(_)}}(V),z=V.split(".")[0],q=Symbol.for(`opentelemetry.js.api.${z}`),G="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{};function registerGlobal(_,E,w,C=!1){var L;const R=G[q]=null!==(L=G[q])&&void 0!==L?L:{version:V};if(!C&&R[_]){const E=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${_}`);return w.error(E.stack||E.message),!1}if(R.version!==V){const E=new Error(`@opentelemetry/api: Registration of version v${R.version} for ${_} does not match previously registered API v${V}`);return w.error(E.stack||E.message),!1}return R[_]=E,w.debug(`@opentelemetry/api: Registered a global for ${_} v${V}.`),!0}function getGlobal(_){var E,w;const C=null===(E=G[q])||void 0===E?void 0:E.version;if(C&&j(C))return null===(w=G[q])||void 0===w?void 0:w[_]}function unregisterGlobal(_,E){E.debug(`@opentelemetry/api: Unregistering a global for ${_} v${V}.`);const w=G[q];w&&delete w[_]}class DiagComponentLogger{constructor(_){this._namespace=_.namespace||"DiagComponentLogger"}debug(..._){return logProxy("debug",this._namespace,_)}error(..._){return logProxy("error",this._namespace,_)}info(..._){return logProxy("info",this._namespace,_)}warn(..._){return logProxy("warn",this._namespace,_)}verbose(..._){return logProxy("verbose",this._namespace,_)}}function logProxy(_,E,w){const C=getGlobal("diag");if(C)return C[_](E,...w)}var K;!function(_){_[_.NONE=0]="NONE",_[_.ERROR=30]="ERROR",_[_.WARN=50]="WARN",_[_.INFO=60]="INFO",_[_.DEBUG=70]="DEBUG",_[_.VERBOSE=80]="VERBOSE",_[_.ALL=9999]="ALL"}(K||(K={}));class DiagAPI{static instance(){return this._instance||(this._instance=new DiagAPI),this._instance}constructor(){function _logProxy(_){return function(...E){const w=getGlobal("diag");if(w)return w[_](...E)}}const _=this;_.setLogger=(E,w={logLevel:K.INFO})=>{var C,L,R;if(E===_){const E=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return _.error(null!==(C=E.stack)&&void 0!==C?C:E.message),!1}"number"==typeof w&&(w={logLevel:w});const P=getGlobal("diag"),I=function createLogLevelDiagLogger(_,E){function _filterFunc(w,C){const L=E[w];return"function"==typeof L&&_>=C?L.bind(E):function(){}}return _<K.NONE?_=K.NONE:_>K.ALL&&(_=K.ALL),E=E||{},{error:_filterFunc("error",K.ERROR),warn:_filterFunc("warn",K.WARN),info:_filterFunc("info",K.INFO),debug:_filterFunc("debug",K.DEBUG),verbose:_filterFunc("verbose",K.VERBOSE)}}(null!==(L=w.logLevel)&&void 0!==L?L:K.INFO,E);if(P&&!w.suppressOverrideMessage){const _=null!==(R=(new Error).stack)&&void 0!==R?R:"<failed to generate stacktrace>";P.warn(`Current logger will be overwritten from ${_}`),I.warn(`Current logger will overwrite one already registered from ${_}`)}return registerGlobal("diag",I,_,!0)},_.disable=()=>{unregisterGlobal("diag",_)},_.createComponentLogger=_=>new DiagComponentLogger(_),_.verbose=_logProxy("verbose"),_.debug=_logProxy("debug"),_.info=_logProxy("info"),_.warn=_logProxy("warn"),_.error=_logProxy("error")}}class BaggageImpl{constructor(_){this._entries=_?new Map(_):new Map}getEntry(_){const E=this._entries.get(_);if(E)return Object.assign({},E)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(_,E){const w=new BaggageImpl(this._entries);return w._entries.set(_,E),w}removeEntry(_){const E=new BaggageImpl(this._entries);return E._entries.delete(_),E}removeEntries(..._){const E=new BaggageImpl(this._entries);for(const w of _)E._entries.delete(w);return E}clear(){return new BaggageImpl}}const Q=Symbol("BaggageEntryMetadata"),X=DiagAPI.instance();function createBaggage(_={}){return new BaggageImpl(new Map(Object.entries(_)))}function createContextKey(_){return Symbol.for(_)}class BaseContext{constructor(_){const E=this;E._currentContext=_?new Map(_):new Map,E.getValue=_=>E._currentContext.get(_),E.setValue=(_,w)=>{const C=new BaseContext(E._currentContext);return C._currentContext.set(_,w),C},E.deleteValue=_=>{const w=new BaseContext(E._currentContext);return w._currentContext.delete(_),w}}}const Y=new BaseContext;class NoopMetric{}class NoopObservableMetric{addCallback(_){}removeCallback(_){}}const Z=new class NoopMeter{constructor(){}createGauge(_,E){return tt}createHistogram(_,E){return et}createCounter(_,E){return J}createUpDownCounter(_,E){return rt}createObservableGauge(_,E){return st}createObservableCounter(_,E){return nt}createObservableUpDownCounter(_,E){return it}addBatchObservableCallback(_,E){}removeBatchObservableCallback(_){}},J=new class NoopCounterMetric extends NoopMetric{add(_,E){}},tt=new class NoopGaugeMetric extends NoopMetric{record(_,E){}},et=new class NoopHistogramMetric extends NoopMetric{record(_,E){}},rt=new class NoopUpDownCounterMetric extends NoopMetric{add(_,E){}},nt=new class NoopObservableCounterMetric extends NoopObservableMetric{},st=new class NoopObservableGaugeMetric extends NoopObservableMetric{},it=new class NoopObservableUpDownCounterMetric extends NoopObservableMetric{};function createNoopMeter(){return Z}const ot={get(_,E){if(null!=_)return _[E]},keys:_=>null==_?[]:Object.keys(_)},at={set(_,E,w){null!=_&&(_[E]=w)}};const ct="context",ut=new class NoopContextManager{active(){return Y}with(_,E,w,...C){return E.call(w,...C)}bind(_,E){return E}enable(){return this}disable(){return this}};class ContextAPI{constructor(){}static getInstance(){return this._instance||(this._instance=new ContextAPI),this._instance}setGlobalContextManager(_){return registerGlobal(ct,_,DiagAPI.instance())}active(){return this._getContextManager().active()}with(_,E,w,...C){return this._getContextManager().with(_,E,w,...C)}bind(_,E){return this._getContextManager().bind(_,E)}_getContextManager(){return getGlobal(ct)||ut}disable(){this._getContextManager().disable(),unregisterGlobal(ct,DiagAPI.instance())}}var lt;!function(_){_[_.NONE=0]="NONE",_[_.SAMPLED=1]="SAMPLED"}(lt||(lt={}));const dt="0000000000000000",ht="00000000000000000000000000000000",pt={traceId:ht,spanId:dt,traceFlags:lt.NONE};class NonRecordingSpan{constructor(_=pt){this._spanContext=_}spanContext(){return this._spanContext}setAttribute(_,E){return this}setAttributes(_){return this}addEvent(_,E){return this}addLink(_){return this}addLinks(_){return this}setStatus(_){return this}updateName(_){return this}end(_){}isRecording(){return!1}recordException(_,E){}}const gt=createContextKey("OpenTelemetry Context Key SPAN");function getSpan(_){return _.getValue(gt)||void 0}function getActiveSpan(){return getSpan(ContextAPI.getInstance().active())}function setSpan(_,E){return _.setValue(gt,E)}function deleteSpan(_){return _.deleteValue(gt)}function setSpanContext(_,E){return setSpan(_,new NonRecordingSpan(E))}function getSpanContext(_){var E;return null===(E=getSpan(_))||void 0===E?void 0:E.spanContext()}const mt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function isValidHex(_,E){if("string"!=typeof _||_.length!==E)return!1;let w=0;for(let E=0;E<_.length;E+=4)w+=(0|mt[_.charCodeAt(E)])+(0|mt[_.charCodeAt(E+1)])+(0|mt[_.charCodeAt(E+2)])+(0|mt[_.charCodeAt(E+3)]);return w===E}function isValidTraceId(_){return isValidHex(_,32)&&_!==ht}function isSpanContextValid(_){return isValidTraceId(_.traceId)&&function isValidSpanId(_){return isValidHex(_,16)&&_!==dt}(_.spanId)}function wrapSpanContext(_){return new NonRecordingSpan(_)}const ft=ContextAPI.getInstance();class NoopTracer{startSpan(_,E,w=ft.active()){if(Boolean(null==E?void 0:E.root))return new NonRecordingSpan;const C=w&&getSpanContext(w);return function isSpanContext(_){return null!==_&&"object"==typeof _&&"spanId"in _&&"string"==typeof _.spanId&&"traceId"in _&&"string"==typeof _.traceId&&"traceFlags"in _&&"number"==typeof _.traceFlags}(C)&&isSpanContextValid(C)?new NonRecordingSpan(C):new NonRecordingSpan}startActiveSpan(_,E,w,C){let L,R,P;if(arguments.length<2)return;2===arguments.length?P=E:3===arguments.length?(L=E,P=w):(L=E,R=w,P=C);const I=null!=R?R:ft.active(),k=this.startSpan(_,L,I),F=setSpan(I,k);return ft.with(F,P,void 0,k)}}const _t=new NoopTracer;class ProxyTracer{constructor(_,E,w,C){this._provider=_,this.name=E,this.version=w,this.options=C}startSpan(_,E,w){return this._getTracer().startSpan(_,E,w)}startActiveSpan(_,E,w,C){const L=this._getTracer();return Reflect.apply(L.startActiveSpan,L,arguments)}_getTracer(){if(this._delegate)return this._delegate;const _=this._provider.getDelegateTracer(this.name,this.version,this.options);return _?(this._delegate=_,this._delegate):_t}}const bt=new class NoopTracerProvider{getTracer(_,E,w){return new NoopTracer}};class ProxyTracerProvider{getTracer(_,E,w){var C;return null!==(C=this.getDelegateTracer(_,E,w))&&void 0!==C?C:new ProxyTracer(this,_,E,w)}getDelegate(){var _;return null!==(_=this._delegate)&&void 0!==_?_:bt}setDelegate(_){this._delegate=_}getDelegateTracer(_,E,w){var C;return null===(C=this._delegate)||void 0===C?void 0:C.getTracer(_,E,w)}}var yt,St,Et;!function(_){_[_.NOT_RECORD=0]="NOT_RECORD",_[_.RECORD=1]="RECORD",_[_.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(yt||(yt={})),function(_){_[_.INTERNAL=0]="INTERNAL",_[_.SERVER=1]="SERVER",_[_.CLIENT=2]="CLIENT",_[_.PRODUCER=3]="PRODUCER",_[_.CONSUMER=4]="CONSUMER"}(St||(St={})),function(_){_[_.UNSET=0]="UNSET",_[_.OK=1]="OK",_[_.ERROR=2]="ERROR"}(Et||(Et={}));const Tt=ContextAPI.getInstance(),vt=DiagAPI.instance();const wt=new class NoopMeterProvider{getMeter(_,E,w){return Z}},At="metrics";class MetricsAPI{constructor(){}static getInstance(){return this._instance||(this._instance=new MetricsAPI),this._instance}setGlobalMeterProvider(_){return registerGlobal(At,_,DiagAPI.instance())}getMeterProvider(){return getGlobal(At)||wt}getMeter(_,E,w){return this.getMeterProvider().getMeter(_,E,w)}disable(){unregisterGlobal(At,DiagAPI.instance())}}const Ct=MetricsAPI.getInstance();const Lt=createContextKey("OpenTelemetry Baggage Key");function getBaggage(_){return _.getValue(Lt)||void 0}function getActiveBaggage(){return getBaggage(ContextAPI.getInstance().active())}function setBaggage(_,E){return _.setValue(Lt,E)}function deleteBaggage(_){return _.deleteValue(Lt)}const Rt="propagation",Pt=new class NoopTextMapPropagator{inject(_,E){}extract(_,E){return _}fields(){return[]}};class PropagationAPI{constructor(){this.createBaggage=createBaggage,this.getBaggage=getBaggage,this.getActiveBaggage=getActiveBaggage,this.setBaggage=setBaggage,this.deleteBaggage=deleteBaggage}static getInstance(){return this._instance||(this._instance=new PropagationAPI),this._instance}setGlobalPropagator(_){return registerGlobal(Rt,_,DiagAPI.instance())}inject(_,E,w=at){return this._getGlobalPropagator().inject(_,E,w)}extract(_,E,w=ot){return this._getGlobalPropagator().extract(_,E,w)}fields(){return this._getGlobalPropagator().fields()}disable(){unregisterGlobal(Rt,DiagAPI.instance())}_getGlobalPropagator(){return getGlobal(Rt)||Pt}}const Ot=PropagationAPI.getInstance(),xt="trace";class TraceAPI{constructor(){this._proxyTracerProvider=new ProxyTracerProvider,this.wrapSpanContext=wrapSpanContext,this.isSpanContextValid=isSpanContextValid,this.deleteSpan=deleteSpan,this.getSpan=getSpan,this.getActiveSpan=getActiveSpan,this.getSpanContext=getSpanContext,this.setSpan=setSpan,this.setSpanContext=setSpanContext}static getInstance(){return this._instance||(this._instance=new TraceAPI),this._instance}setGlobalTracerProvider(_){const E=registerGlobal(xt,this._proxyTracerProvider,DiagAPI.instance());return E&&this._proxyTracerProvider.setDelegate(_),E}getTracerProvider(){return getGlobal(xt)||this._proxyTracerProvider}getTracer(_,E){return this.getTracerProvider().getTracer(_,E)}disable(){unregisterGlobal(xt,DiagAPI.instance()),this._proxyTracerProvider=new ProxyTracerProvider}}const It=TraceAPI.getInstance(),Nt=createContextKey("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function suppressTracing$2(_){return _.setValue(Nt,!0)}function isTracingSuppressed$1(_){return!0===_.getValue(Nt)}const Dt="baggage";function parsePairKeyValue(_){if(!_)return;const E=_.indexOf(";"),w=-1===E?_:_.substring(0,E),C=w.indexOf("=");if(C<=0)return;const L=w.substring(0,C).trim(),R=w.substring(C+1).trim();if(!L||!R)return;let P,I,k;try{P=decodeURIComponent(L),I=decodeURIComponent(R)}catch{return}if(-1!==E&&E<_.length-1){k=function baggageEntryMetadataFromString(_){return"string"!=typeof _&&(X.error("Cannot create baggage metadata from unknown type: "+typeof _),_=""),{__TYPE__:Q,toString:()=>_}}(_.substring(E+1))}return{key:P,value:I,metadata:k}}function parseBaggageHeaderString(_,E,w,C){let L=0;for(;L<_.length&&w<180;){const R=_.indexOf(",",L),P=-1===R?_.length:R,I=P-L;if(I<=4096){const R=parsePairKeyValue(_.substring(L,P));if(R){const _=(0===w?0:1)+I;if(C+_>8192)break;E[R.key]=R.metadata?{value:R.value,metadata:R.metadata}:{value:R.value},w++,C+=_}}if(-1===R)break;L=R+1}return[w,C]}class W3CBaggagePropagator{inject(_,E,w){const C=Ot.getBaggage(_);if(!C||isTracingSuppressed$1(_))return;const L=function getKeyPairs(_){return _.getAllEntries().map((([_,E])=>{let w=`${encodeURIComponent(_)}=${encodeURIComponent(E.value)}`;return void 0!==E.metadata&&(w+=";"+E.metadata.toString()),w}))}(C).filter((_=>_.length<=4096)).slice(0,180),R=function serializeKeyPairs(_){return _.reduce(((_,E)=>{const w=`${_}${""!==_?",":""}${E}`;return w.length>8192?_:w}),"")}(L);R.length>0&&w.set(E,Dt,R)}extract(_,E,w){const C=w.get(E,Dt);if(!C)return _;const L={};let R=0,P=0;if(Array.isArray(C))for(let _=0;_<C.length;_++)[R,P]=parseBaggageHeaderString(C[_],L,R,P);else[R]=parseBaggageHeaderString(C,L,R,P);return 0===R?_:Ot.setBaggage(_,Ot.createBaggage(L))}fields(){return[Dt]}}var kt;!function(_){_[_.SUCCESS=0]="SUCCESS",_[_.FAILED=1]="FAILED"}(kt||(kt={}));class CompositePropagator{constructor(_={}){this._propagators=_.propagators??[];const E=new Set;for(const _ of this._propagators){const w="function"==typeof _.fields?_.fields():[];for(const _ of w)E.add(_)}this._fields=Array.from(E)}inject(_,E,w){for(const C of this._propagators)try{C.inject(_,E,w)}catch(_){vt.warn(`Failed to inject with ${C.constructor.name}. Err: ${_.message}`)}}extract(_,E,w){return this._propagators.reduce(((_,C)=>{try{return C.extract(_,E,w)}catch(_){vt.warn(`Failed to extract with ${C.constructor.name}. Err: ${_.message}`)}return _}),_)}fields(){return this._fields.slice()}}const Mt="[_0-9a-z-*/]",Ft=new RegExp(`^(?:${`[a-z]${Mt}{0,255}`}|${`[a-z0-9]${Mt}{0,240}@[a-z]${Mt}{0,13}`})$`),Bt=/^[ -~]{0,255}[!-~]$/,Ut=/,|=/;function validateKey(_){return Ft.test(_)}function validateValue(_){return Bt.test(_)&&!Ut.test(_)}class TraceState{constructor(_){this._rawTraceState="string"==typeof _?_:"",this._length=this._rawTraceState.length}set(_,E){if(!validateKey(_)||!validateValue(E))return this;const w=this._getState(),C=w.get(_);let L=this._length;if(L+="string"==typeof C?E.length-C.length:_.length+E.length+(w.size>0?2:1),L>512)return this;const R=new Map(w);return R.delete(_),R.set(_,E),this._fromState(R,L)}unset(_){const E=this._getState(),w=E.get(_);if("string"!=typeof w)return this;let C=this._length-(_.length+w.length+1);E.size>1&&(C-=1);const L=new Map(E);return L.delete(_),this._fromState(L,C)}get(_){return this._getState().get(_)}serialize(){let _="",E=0;for(const w of this._getState())E>0&&(_=","+_),_=`${w[0]}=${w[1]}`+_,E++;return _}_getState(){if(this._internalState)return this._internalState;const _=this._rawTraceState.split(","),E=new Map;let w=0;for(const C of _){const _=C.trim(),L=_.indexOf("=");if(-1===L)continue;const R=_.slice(0,L),P=_.slice(L+1);if(!validateKey(R)||!validateValue(P))continue;const I=w+_.length+(E.size>0?1:0);if(!(I>512)&&(E.set(R,P),w=I,E.size>=32))break}return this._length=w,this._internalState=new Map(Array.from(E.entries()).reverse()),this._internalState}_fromState(_,E){const w=Object.create(TraceState.prototype);return w._internalState=_,w._length=E,w}}const $t="traceparent",Vt="tracestate",Ht=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");class W3CTraceContextPropagator{inject(_,E,w){const C=It.getSpanContext(_);if(!C||isTracingSuppressed$1(_)||!isSpanContextValid(C))return;const L=`00-${C.traceId}-${C.spanId}-0${Number(C.traceFlags||lt.NONE).toString(16)}`;w.set(E,$t,L),C.traceState&&w.set(E,Vt,C.traceState.serialize())}extract(_,E,w){const C=w.get(E,$t);if(!C)return _;const L=Array.isArray(C)?C[0]:C;if("string"!=typeof L)return _;const R=function parseTraceParent(_){const E=Ht.exec(_);return E?"00"===E[1]&&E[5]?null:{traceId:E[2],spanId:E[3],traceFlags:parseInt(E[4],16)}:null}(L);if(!R)return _;R.isRemote=!0;const P=w.get(E,Vt);if(P){const _=Array.isArray(P)?P.join(","):P;R.traceState=new TraceState("string"==typeof _?_:void 0)}return It.setSpanContext(_,R)}fields(){return[$t,Vt]}}const jt={},zt=createContextKey("OpenTelemetry SDK Context Key SUPPRESS_TRACING");let qt=function loggingErrorHandler$1(){return _=>{vt.error(function stringifyException$1(_){return"string"==typeof _?_:JSON.stringify(function flattenException$1(_){const E={};let w=_;for(;null!==w;)Object.getOwnPropertyNames(w).forEach((_=>{if(E[_])return;const C=w[_];C&&(E[_]=String(C))})),w=Object.getPrototypeOf(w);return E}(_))}(_))}}();function globalErrorHandler$1(_){try{qt(_)}catch{}}const Gt="error.type",Wt="exception.message",Kt="exception.stacktrace",Qt="exception.type",Xt="http.request.method",Yt="http.request.method_original",Zt="http.response.status_code",Jt="server.address",te="server.port",ee="service.name",re="telemetry.sdk.language",ne="webjs",se="telemetry.sdk.name",ie="telemetry.sdk.version",oe="url.full",ae="process.runtime.name",ce={[se]:"opentelemetry",[ae]:"browser",[re]:ne,[ie]:"2.9.0"},ue=performance,le=Math.pow(10,6),de=Math.pow(10,9);function millisToHrTime$1(_){const E=_/1e3;return[Math.trunc(E),Math.round(_%1e3*le)]}function hrTime$1(_){return function addHrTimes$1(_,E){const w=[_[0]+E[0],_[1]+E[1]];w[1]>=de&&(w[1]-=de,w[0]+=1);return w}(millisToHrTime$1(ue.timeOrigin),millisToHrTime$1("number"==typeof _?_:ue.now()))}function timeInputToHrTime(_){if(function isTimeInputHrTime$1(_){return Array.isArray(_)&&2===_.length&&"number"==typeof _[0]&&"number"==typeof _[1]}(_))return _;if("number"==typeof _)return _<ue.timeOrigin/2?hrTime$1(_):millisToHrTime$1(_);if(_ instanceof Date)return millisToHrTime$1(_.getTime());throw TypeError("Invalid input type")}function hrTimeToNanoseconds(_){return _[0]*de+_[1]}var he;!function(_){_[_.SUCCESS=0]="SUCCESS",_[_.FAILED=1]="FAILED"}(he||(he={}));class TimeoutError extends Error{constructor(_){super(_),Object.setPrototypeOf(this,TimeoutError.prototype)}}function urlMatches(_,E){return"string"==typeof E?_===E:!!_.match(E)}function isUrlIgnored(_,E){if(!E)return!1;for(const w of E)if(urlMatches(_,w))return!0;return!1}let pe,ge=class Deferred{constructor(){this._promise=new Promise(((_,E)=>{this._resolve=_,this._reject=E}))}get promise(){return this._promise}resolve(_){this._resolve(_)}reject(_){this._reject(_)}},me=class BindOnceFuture{constructor(_,E){this._isCalled=!1,this._deferred=new ge,this._callback=_,this._that=E}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(..._){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,..._)).then((_=>this._deferred.resolve(_)),(_=>this._deferred.reject(_)))}catch(_){this._deferred.reject(_)}}return this._deferred.promise}};function defaultServiceName$1(){if(void 0===pe)try{const _=globalThis.process.argv0;pe=_?`unknown_service:${_}`:"unknown_service"}catch{pe="unknown_service"}return pe}const isPromiseLike$2=_=>null!==_&&"object"==typeof _&&"function"==typeof _.then;let fe=class ResourceImpl{static FromAttributeList(_,E){const w=new ResourceImpl({},E);return w._rawAttributes=guardedRawAttributes$2(_),w._asyncAttributesPending=_.filter((([_,E])=>isPromiseLike$2(E))).length>0,w}constructor(_,E){this._asyncAttributesPending=!1;const w=_.attributes??{};this._rawAttributes=Object.entries(w).map((([_,E])=>(isPromiseLike$2(E)&&(this._asyncAttributesPending=!0),[_,E]))),this._rawAttributes=guardedRawAttributes$2(this._rawAttributes),this._schemaUrl=function validateSchemaUrl$2(_){if("string"==typeof _||void 0===_)return _;return void vt.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",_)}(E?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let _=0;_<this._rawAttributes.length;_++){const[E,w]=this._rawAttributes[_];this._rawAttributes[_]=[E,isPromiseLike$2(w)?await w:w]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&vt.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const _={};for(const[E,w]of this._rawAttributes)isPromiseLike$2(w)?vt.debug(`Unsettled resource attribute ${E} skipped`):null!=w&&(_[E]??(_[E]=w));return this._asyncAttributesPending||(this._memoizedAttributes=_),_}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(_){if(null==_)return this;const E=function mergeSchemaUrl$2(_,E){const w=_?.schemaUrl,C=E?.schemaUrl,L=void 0===w||""===w,R=void 0===C||""===C;if(L)return C;if(R)return w;if(w===C)return w;return void vt.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',w,C)}(this,_),w=E?{schemaUrl:E}:void 0;return ResourceImpl.FromAttributeList([..._.getRawAttributes(),...this.getRawAttributes()],w)}};function defaultResource$1(){return function resourceFromAttributes$2(_,E){return fe.FromAttributeList(Object.entries(_),E)}({[ee]:defaultServiceName$1(),[re]:ce[re],[se]:ce[se],[ie]:ce[ie]})}function guardedRawAttributes$2(_){return _.map((([_,E])=>isPromiseLike$2(E)?[_,E.catch((E=>{vt.debug("promise rejection for resource attribute: %s - %s",_,E)}))]:[_,E]))}function isLogAttributeValue(_){return isLogAttributeValueInternal(_,new WeakSet)}function isLogAttributeValueInternal(_,E){if(null==_)return!0;if("string"==typeof _||"number"==typeof _||"boolean"==typeof _)return!0;if(_ instanceof Uint8Array)return!0;if("object"==typeof _){if(E.has(_))return!1;if(E.add(_),Array.isArray(_)){for(const w of _)if(!isLogAttributeValueInternal(w,E))return!1;return!0}const w=_;if(w.constructor!==Object&&void 0!==w.constructor)return!1;for(const _ in w)if(Object.prototype.hasOwnProperty.call(w,_)&&!isLogAttributeValueInternal(w[_],E))return!1;return!0}return!1}var _e;function addAttribute(_,E,w,C,L){if(0===C.length)return vt.warn(`Invalid attribute key: ${C}`),_e.DROP_INVALID;if(!isLogAttributeValue(L))return vt.warn(`Invalid attribute value set for key: ${C}`),_e.DROP_INVALID;const R=!Object.prototype.hasOwnProperty.call(_,C);return R&&w>=E.attributeCountLimit?_e.DROP_LIMIT_REACHED:(_[C]=truncateToSize(L,E.attributeValueLengthLimit),R?_e.ADD_NEW:_e.ADD_OVERWRITE_EXISTING)}function truncateToSize(_,E){if(E<=0)return vt.warn(`Attribute value limit must be positive, got ${E}`),_;if(null==_)return _;if("string"==typeof _)return _.length<=E?_:_.substring(0,E);if(_ instanceof Uint8Array)return _;if(Array.isArray(_))return _.map((_=>truncateToSize(_,E)));if("object"==typeof _){const w={};for(const[C,L]of Object.entries(_))w[C]=truncateToSize(L,E);return w}return _}function normalizeScopeAttributes(_,E){if(null==E)return{};const w={};let C=0,L=0;for(const[R,P]of Object.entries(E)){const E=addAttribute(w,_,C,R,P);E===_e.ADD_NEW?C+=1:(E===_e.DROP_INVALID||E===_e.DROP_LIMIT_REACHED)&&(L+=1)}return{attributes:C>0?w:void 0,droppedAttributesCount:L}}!function(_){_[_.DROP_INVALID=0]="DROP_INVALID",_[_.DROP_LIMIT_REACHED=1]="DROP_LIMIT_REACHED",_[_.ADD_NEW=2]="ADD_NEW",_[_.ADD_OVERWRITE_EXISTING=3]="ADD_OVERWRITE_EXISTING"}(_e||(_e={}));class LogRecordImpl{set severityText(_){this._isLogRecordReadonly()||(this._severityText=_)}get severityText(){return this._severityText}set severityNumber(_){this._isLogRecordReadonly()||(this._severityNumber=_)}get severityNumber(){return this._severityNumber}set body(_){this._isLogRecordReadonly()||(this._body=_)}get body(){return this._body}get eventName(){return this._eventName}set eventName(_){this._isLogRecordReadonly()||(this._eventName=_)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(_,E,w){this.attributes={},this._attributesCount=0,this._droppedAttributesCount=0,this._isReadonly=!1;const{timestamp:C,observedTimestamp:L,eventName:R,severityNumber:P,severityText:I,body:k,attributes:F={},exception:$,context:V}=w,H=Date.now();if(this.hrTime=timeInputToHrTime(C??H),this.hrTimeObserved=timeInputToHrTime(L??H),V){const _=It.getSpanContext(V);_&&isSpanContextValid(_)&&(this.spanContext=_)}this.severityNumber=P,this.severityText=I,this.body=k,this.resource=_.resource,this.instrumentationScope=E,this._logRecordLimits=_.logRecordLimits,this._eventName=R,this.setAttributes(F),null!=$&&this._setException($)}setAttribute(_,E){if(this._isLogRecordReadonly())return this;const w=addAttribute(this.attributes,this._logRecordLimits,this._attributesCount,_,E);return w===_e.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,1===this._droppedAttributesCount&&vt.warn("Dropping extra attributes.")):w===_e.ADD_NEW&&this._attributesCount++,this}setAttributes(_){for(const[E,w]of Object.entries(_))this.setAttribute(E,w);return this}setBody(_){return this.body=_,this}setEventName(_){return this.eventName=_,this}setSeverityNumber(_){return this.severityNumber=_,this}setSeverityText(_){return this.severityText=_,this}_makeReadonly(){this._isReadonly=!0}_setException(_){let E=!1;if("string"==typeof _||"number"==typeof _)Object.hasOwn(this.attributes,Wt)||this.setAttribute(Wt,String(_)),E=!0;else if(_&&"object"==typeof _){const w=_;w.code?(Object.hasOwn(this.attributes,Qt)||this.setAttribute(Qt,w.code.toString()),E=!0):w.name&&(Object.hasOwn(this.attributes,Qt)||this.setAttribute(Qt,w.name),E=!0),w.message&&(Object.hasOwn(this.attributes,Wt)||this.setAttribute(Wt,w.message),E=!0),w.stack&&(Object.hasOwn(this.attributes,Kt)||this.setAttribute(Kt,w.stack),E=!0)}E||vt.warn(`Failed to record an exception ${_}`)}_isLogRecordReadonly(){return this._isReadonly&&vt.warn("Can not execute the operation on emitted log record"),this._isReadonly}}class Logger{constructor(_,E){this._instrumentationScope=_,this._sharedState=E,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(_){const E=_.context||Tt.active();if(!this.enabled(_))return;const w=new LogRecordImpl(this._sharedState,this._instrumentationScope,{context:E,..._});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(w,E),w._makeReadonly()}enabled(_){if(this._sharedState.hasShutdown)return!1;const E=this._loggerConfig;if(E.disabled)return!1;const w=_?.severityNumber;if("number"==typeof w&&w!==R.UNSPECIFIED&&w<E.minimumSeverity)return!1;const C=_?.context||Tt.active();if(E.traceBased){const _=It.getSpanContext(C);if(_&&isSpanContextValid(_)){if(!((_.traceFlags&lt.SAMPLED)===lt.SAMPLED))return!1}}const L={context:C,instrumentationScope:this._instrumentationScope,severityNumber:_?.severityNumber,eventName:_?.eventName};for(const _ of this._sharedState.processors)if(!_.enabled||_.enabled(L))return!0;return!1}}class NoopLogRecordProcessor{forceFlush(){return Promise.resolve()}onEmit(_,E){}shutdown(){return Promise.resolve()}enabled(_){return!1}}class MultiLogRecordProcessor{constructor(_,E){this.processors=_,this.forceFlushTimeoutMillis=E}async forceFlush(){const _=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map((E=>function callWithTimeout(_,E){let w;const C=new Promise((function timeoutFunction(_,C){w=setTimeout((function timeoutHandler(){C(new TimeoutError("Operation timed out."))}),E)}));return Promise.race([_,C]).then((_=>(clearTimeout(w),_)),(_=>{throw clearTimeout(w),_}))}(E.forceFlush(),_))))}onEmit(_,E){this.processors.forEach((w=>w.onEmit(_,E)))}async shutdown(){await Promise.all(this.processors.map((_=>_.shutdown())))}enabled(_){for(const E of this.processors)if(!E.enabled||E.enabled(_))return!0;return!1}}function normalizeAnyValue(_){if(void 0===_)return["u",null];if(null===_)return["n",null];const E=typeof _;return"string"===E?["s",_]:"boolean"===E?["b",_]:"number"===E?Number.isNaN(_)?["nan",null]:_===1/0?["inf",null]:_===-1/0?["-inf",null]:Object.is(_,-0)?["n0",null]:["d",_]:_ instanceof Uint8Array?["bytes",Array.from(_)]:Array.isArray(_)?["arr",_.map(normalizeAnyValue)]:["map",Object.entries(_).sort((([_],[E])=>_.localeCompare(E))).map((([_,E])=>[_,normalizeAnyValue(E)]))]}function getInstrumentationScopeKey(_){return JSON.stringify([_.name,_.version||"",_.schemaUrl||"",normalizeAnyValue(_.attributes),_.droppedAttributesCount??0])}class LoggerMetrics{constructor(_){this.createdLogs=_.createCounter("otel.sdk.log.created",{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}}const be={disabled:!1,minimumSeverity:R.UNSPECIFIED,traceBased:!1},DEFAULT_LOGGER_CONFIGURATOR=()=>({...be});class LoggerProviderSharedState{constructor(_,E,w,C,L,R){this.loggers=new Map,this.registeredLogRecordProcessors=[],this.hasShutdown=!1,this._loggerConfigs=new Map,this.resource=_,this.forceFlushTimeoutMillis=E,this.logRecordLimits=w,this.processors=C,C.length>0?(this.registeredLogRecordProcessors=C,this.activeProcessor=new MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new NoopLogRecordProcessor,this._loggerConfigurator=L??DEFAULT_LOGGER_CONFIGURATOR;const P=R?R.getMeter("@opentelemetry/sdk-logs","0.220.0"):createNoopMeter();this.loggerMetrics=new LoggerMetrics(P)}getLoggerConfig(_){const E=getInstrumentationScopeKey(_);let w=this._loggerConfigs.get(E);return w||(w=this._loggerConfigurator(_),this._loggerConfigs.set(E,w),w)}}class LoggerProvider{constructor(_={}){const E={resource:_.resource??defaultResource$1(),forceFlushTimeoutMillis:_.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:_.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:_.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:_.loggerConfigurator??DEFAULT_LOGGER_CONFIGURATOR,processors:_.processors??[],meterProvider:_.meterProvider};this._sharedState=new LoggerProviderSharedState(E.resource,E.forceFlushTimeoutMillis,E.logRecordLimits,E.processors,E.loggerConfigurator,E.meterProvider),this._shutdownOnce=new me(this._shutdown,this)}getLogger(_,E,w){if(this._shutdownOnce.isCalled)return vt.warn("A shutdown LoggerProvider cannot provide a Logger"),function createNoopLogger(){return P}();_||vt.warn("Logger requested without instrumentation scope name.");const C={name:_||"unknown",version:E,schemaUrl:w?.schemaUrl,...normalizeScopeAttributes(this._sharedState.logRecordLimits,w?.attributes)},L=getInstrumentationScopeKey(C);return this._sharedState.loggers.has(L)||this._sharedState.loggers.set(L,new Logger(C,this._sharedState)),this._sharedState.loggers.get(L)}forceFlush(){return this._shutdownOnce.isCalled?(vt.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(vt.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.hasShutdown=!0,this._sharedState.activeProcessor.shutdown()}}class ExportOperation{constructor(_,E,w){this._exportScheduledPromise=new Promise((_=>{this._exportScheduledResolve=_})),this._exportCompleted=this._executeExport(_,E,w)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(_,E,w){try{await async function waitForResources(_){const E=[];for(let w=0,C=_.length;w<C;w++){const C=_[w];C.resource.asyncAttributesPending&&C.resource.waitForAsyncAttributes&&E.push(C.resource.waitForAsyncAttributes())}null!=E&&E.length>0&&await Promise.all(E)}(E),await Tt.with(function suppressTracing$1(_){return _.setValue(zt,!0)}(Tt.active()),(async()=>this._exportWithTimeout(_,E,w)))}catch(_){globalErrorHandler$1(_),this._exportScheduledResolve()}}async _exportWithTimeout(_,E,w){return new Promise(((C,L)=>{const R=setTimeout((()=>{L(new Error("Timeout"))}),w);_.export(E,(_=>{clearTimeout(R),_.code===he.SUCCESS?C():L(_.error??new Error("BatchLogRecordProcessor: log record export failed"))})),this._exportScheduledResolve()}))}}class BatchLogRecordProcessorBase{constructor(_){this._currentExport=null,this._finishedLogRecords=[],this._flushing=!1,this._exporter=_.exporter,this._maxExportBatchSize=_.maxExportBatchSize??512,this._maxQueueSize=_.maxQueueSize??2048,this._scheduledDelayMillis=_.scheduledDelayMillis??1e3,this._exportTimeoutMillis=_.exportTimeoutMillis??3e4,this._shutdownOnce=new me(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(vt.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(_){this._shutdownOnce.isCalled||this._addToBuffer(_)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(_){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(_),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let _=this._finishedLogRecords;this._finishedLogRecords=[],this._clearTimer();const E=this._currentExport;for(null!==E&&(await this._exporter.forceFlush(),await E.exportCompleted,this._currentExport=null);_.length>0;){let E;_.length<=this._maxExportBatchSize?(E=_,_=[]):E=_.splice(0,this._maxExportBatchSize);const w=new ExportOperation(this._exporter,E,this._exportTimeoutMillis);this._currentExport=w;try{await w.exportScheduled,await this._exporter.forceFlush(),await w.exportCompleted}catch(_){globalErrorHandler$1(_)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(0===this._finishedLogRecords.length)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){const _=this._finishedLogRecords;return this._finishedLogRecords=[],_}return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();const _=this._extractBatch();if(null===_)return;const E=new ExportOperation(this._exporter,_,this._exportTimeoutMillis);this._currentExport=E,E.exportCompleted.then((()=>{this._currentExport=null,this._maybeStartTimer()})).catch((_=>{this._currentExport=null,globalErrorHandler$1(_),this._maybeStartTimer()}))}_maybeStartTimer(){this._shutdownOnce.isCalled||this._flushing||0!==this._finishedLogRecords.length&&null===this._currentExport&&(this._finishedLogRecords.length>=this._maxExportBatchSize?this._exportOneBatch():void 0===this._timer&&(this._timer=setTimeout((()=>{this._timer=void 0,this._exportOneBatch()}),this._scheduledDelayMillis),"number"!=typeof this._timer&&this._timer.unref()))}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class BatchLogRecordProcessor extends BatchLogRecordProcessorBase{constructor(_){super(_),this._onInit(_)}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}_onInit(_){!0!==_.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}}const ye="service.name",isPromiseLike$1=_=>null!==_&&"object"==typeof _&&"function"==typeof _.then;let Se=class ResourceImpl{static FromAttributeList(_,E){const w=new ResourceImpl({},E);return w._rawAttributes=guardedRawAttributes$1(_),w._asyncAttributesPending=_.filter((([_,E])=>isPromiseLike$1(E))).length>0,w}constructor(_,E){this._asyncAttributesPending=!1;const w=_.attributes??{};this._rawAttributes=Object.entries(w).map((([_,E])=>(isPromiseLike$1(E)&&(this._asyncAttributesPending=!0),[_,E]))),this._rawAttributes=guardedRawAttributes$1(this._rawAttributes),this._schemaUrl=function validateSchemaUrl$1(_){if("string"==typeof _||void 0===_)return _;return void vt.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",_)}(E?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let _=0;_<this._rawAttributes.length;_++){const[E,w]=this._rawAttributes[_];this._rawAttributes[_]=[E,isPromiseLike$1(w)?await w:w]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&vt.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const _={};for(const[E,w]of this._rawAttributes)isPromiseLike$1(w)?vt.debug(`Unsettled resource attribute ${E} skipped`):null!=w&&(_[E]??(_[E]=w));return this._asyncAttributesPending||(this._memoizedAttributes=_),_}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(_){if(null==_)return this;const E=function mergeSchemaUrl$1(_,E){const w=_?.schemaUrl,C=E?.schemaUrl,L=void 0===w||""===w,R=void 0===C||""===C;if(L)return C;if(R)return w;if(w===C)return w;return void vt.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',w,C)}(this,_),w=E?{schemaUrl:E}:void 0;return ResourceImpl.FromAttributeList([..._.getRawAttributes(),...this.getRawAttributes()],w)}};function resourceFromAttributes$1(_,E){return Se.FromAttributeList(Object.entries(_),E)}function guardedRawAttributes$1(_){return _.map((([_,E])=>isPromiseLike$1(E)?[_,E.catch((E=>{vt.debug("promise rejection for resource attribute: %s - %s",_,E)}))]:[_,E]))}function estimateVarintSize(_){return _<0?10:_<128?1:_<16384?2:_<2097152?3:_<268435456?4:_<34359738368?5:_<4398046511104?6:_<562949953421312?7:_<72057594037927940?8:9}class ProtobufWriter{constructor(_=65536){this.pos=0,this._buffer=new Uint8Array(_),this._textEncoder=new TextEncoder,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}_ensureCapacity(_){const E=this.pos+_;if(E<=this._buffer.length)return;vt.debug("ProtobufWriter: estimated size was too small, growing buffer.");let w=2*this._buffer.length;for(;w<E;)w*=2;const C=new Uint8Array(w);C.set(this._buffer),this._buffer=C,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}finish(){return this._buffer.subarray(0,this.pos)}startLengthDelimited(){const _=this.pos;return this._ensureCapacity(1),this.pos+=1,_}finishLengthDelimited(_,E){const w=E>>>0,C=estimateVarintSize(w);if(C>1){const E=C-1;this._ensureCapacity(E),this._buffer.copyWithin(_+C,_+1,this.pos),this.pos+=E}let L=_;w<128?this._buffer[L]=w:w<16384?(this._buffer[L++]=127&w|128,this._buffer[L]=w>>>7):w<2097152?(this._buffer[L++]=127&w|128,this._buffer[L++]=w>>>7&127|128,this._buffer[L]=w>>>14):w<268435456?(this._buffer[L++]=127&w|128,this._buffer[L++]=w>>>7&127|128,this._buffer[L++]=w>>>14&127|128,this._buffer[L]=w>>>21):(this._buffer[L++]=127&w|128,this._buffer[L++]=w>>>7&127|128,this._buffer[L++]=w>>>14&127|128,this._buffer[L++]=w>>>21&127|128,this._buffer[L]=w>>>28)}writeSint32(_){this.writeVarint((_<<1^_>>31)>>>0)}writeSfixed64(_){let E,w;if(_>=0)E=_>>>0,w=_/4294967296>>>0;else{const C=Math.abs(_);E=C>>>0,w=C/4294967296>>>0,E=~E>>>0,w=~w>>>0,E=E+1>>>0,0===E&&(w=w+1>>>0)}this.writeFixed64(E,w)}writeVarint(_){if(this._ensureCapacity(estimateVarintSize(_)),_>=0&&_<=4294967295){let E=_>>>0;for(;E>127;)this._buffer[this.pos++]=127&E|128,E>>>=7;this._buffer[this.pos++]=E}else{let E,w;if(_>=0)E=_>>>0,w=_/4294967296>>>0;else{const C=Math.abs(_);E=C>>>0,w=C/4294967296>>>0,E=~E>>>0,w=~w>>>0,E=E+1>>>0,0===E&&(w=w+1>>>0)}for(;w>0||E>127;)this._buffer[this.pos++]=127&E|128,E=(E>>>7|w<<25)>>>0,w>>>=7;this._buffer[this.pos++]=127&E}}writeFixed32(_){this._ensureCapacity(4);const E=_>>>0;this._buffer[this.pos++]=255&E,this._buffer[this.pos++]=E>>>8&255,this._buffer[this.pos++]=E>>>16&255,this._buffer[this.pos++]=E>>>24&255}writeFixed64(_,E){this._ensureCapacity(8);const w=_>>>0,C=E>>>0;this._buffer[this.pos++]=255&w,this._buffer[this.pos++]=w>>>8&255,this._buffer[this.pos++]=w>>>16&255,this._buffer[this.pos++]=w>>>24&255,this._buffer[this.pos++]=255&C,this._buffer[this.pos++]=C>>>8&255,this._buffer[this.pos++]=C>>>16&255,this._buffer[this.pos++]=C>>>24&255}writeBytes(_){this.writeVarint(_.length),this._ensureCapacity(_.length),this._buffer.set(_,this.pos),this.pos+=_.length}writeTag(_,E){this.writeVarint(_<<3|E)}writeDouble(_){this._ensureCapacity(8),this._dataView.setFloat64(this.pos,_,!0),this.pos+=8}writeString(_){let E=!0;const w=_.length;for(let C=0;C<w;C++)if(_.charCodeAt(C)>127){E=!1;break}if(E){this.writeVarint(w),this._ensureCapacity(w);for(let E=0;E<w;E++)this._buffer[this.pos++]=_.charCodeAt(E)}else{const E=this._textEncoder.encode(_);this.writeBytes(E)}}}function intValue(_){return _>=48&&_<=57?_-48:_>=97&&_<=102?_-87:_-55}function hexToBinary(_){const E=new Uint8Array(_.length/2);let w=0;for(let C=0;C<_.length;C+=2){const L=intValue(_.charCodeAt(C)),R=intValue(_.charCodeAt(C+1));E[w++]=L<<4|R}return E}function writeHrTimeAsFixed64(_,E){const w=E[0],C=1e9,L=(65535&w)*C,R=(w/65536>>>0)*C,P=(L>>>0)+(65536*(65535&R)>>>0)+E[1],I=P>>>0,k=Math.floor(L/4294967296)+(R/65536>>>0)+Math.floor(P/4294967296)>>>0;_.writeFixed64(I,k)}function writeAttributes(_,E,w){for(const C in E){if(!Object.prototype.hasOwnProperty.call(E,C))continue;const L=E[C];_.writeTag(w,2);const R=_.startLengthDelimited(),P=_.pos;writeKeyValue(_,C,L),_.finishLengthDelimited(R,_.pos-P)}}function writeKeyValue(_,E,w){_.writeTag(1,2),_.writeString(E),_.writeTag(2,2);const C=_.startLengthDelimited(),L=_.pos;writeAnyValue(_,w),_.finishLengthDelimited(C,_.pos-L)}const Ee=-0x8000000000000000,Te=2**63;function writeAnyValue(_,E){const w=typeof E;if("string"===w)_.writeTag(1,2),_.writeString(E);else if("boolean"===w)_.writeTag(2,0),_.writeVarint(E?1:0);else if("number"===w){const w=E;Number.isInteger(w)&&w>=Ee&&w<Te?(_.writeTag(3,0),_.writeVarint(w)):(_.writeTag(4,1),_.writeDouble(w))}else if(E instanceof Uint8Array)_.writeTag(7,2),_.writeBytes(E);else if(Array.isArray(E)){_.writeTag(5,2);const w=_.startLengthDelimited(),C=_.pos;for(const w of E){_.writeTag(1,2);const E=_.startLengthDelimited(),C=_.pos;writeAnyValue(_,w),_.finishLengthDelimited(E,_.pos-C)}_.finishLengthDelimited(w,_.pos-C)}else if("object"===w&&null!=E){_.writeTag(6,2);const w=_.startLengthDelimited(),C=_.pos,L=E;for(const E in L){if(!Object.prototype.hasOwnProperty.call(L,E))continue;const w=L[E];_.writeTag(1,2);const C=_.startLengthDelimited(),R=_.pos;_.writeTag(1,2),_.writeString(E),_.writeTag(2,2);const P=_.startLengthDelimited(),I=_.pos;writeAnyValue(_,w),_.finishLengthDelimited(P,_.pos-I),_.finishLengthDelimited(C,_.pos-R)}_.finishLengthDelimited(w,_.pos-C)}}class ProtobufSizeEstimator{constructor(){this.pos=0}startLengthDelimited(){return this.pos}finishLengthDelimited(_,E){this.pos+=estimateVarintSize(E)}writeVarint(_){this.pos+=estimateVarintSize(_)}writeSint32(_){this.pos+=estimateVarintSize((_<<1^_>>31)>>>0)}writeSfixed64(_){this.pos+=8}writeFixed32(_){this.pos+=4}writeFixed64(_,E){this.pos+=8}writeBytes(_){this.pos+=estimateVarintSize(_.length),this.pos+=_.length}writeTag(_,E){this.writeVarint(_<<3|E)}writeDouble(_){this.pos+=8}writeString(_){const E=function utf8ByteLength(_){const E=_.length;let w=0;for(let C=0;C<E;C++){const E=_.charCodeAt(C);E<128?w+=1:E<2048?w+=2:E<55296||E>=57344?w+=3:(C++,w+=4)}return w}(_);this.pos+=estimateVarintSize(E),this.pos+=E}}class ProtobufReader{constructor(_){this.pos=0,this._buf=_,this._textDecoder=new TextDecoder}isAtEnd(){return this.pos>=this._buf.length}readTag(){const _=this.readVarint();return{fieldNumber:_>>>3,wireType:7&_}}readVarint(){let _=0,E=0,w=!1;for(;this.pos<this._buf.length;){const C=this._buf[this.pos++];if(_+=(127&C)*Math.pow(2,E),E+=7,!(128&C)){w=!0;break}}if(!w)throw new Error("Truncated buffer: unexpected end of data while reading varint");return _}readBytes(){const _=this.readVarint();if(this.pos+_>this._buf.length)throw new Error(`Truncated buffer: expected ${_} bytes at position ${this.pos}, but only ${this._buf.length-this.pos} available`);const E=this._buf.subarray(this.pos,this.pos+_);return this.pos+=_,E}readString(){return this._textDecoder.decode(this.readBytes())}skip(_){switch(_){case 0:this.readVarint();break;case 1:this.pos+=8;break;case 2:this.readBytes();break;case 5:this.pos+=4;break;default:throw new Error(`Unknown wire type ${_}, cannot safely skip`)}}}function buildSpanFlags(_,E){let w=255&_|256;return E&&(w|=512),w}function serializeEvent(_,E){const w=_.startLengthDelimited(),C=_.pos;_.writeTag(1,1),writeHrTimeAsFixed64(_,E.time),_.writeTag(2,2),_.writeString(E.name),E.attributes&&writeAttributes(_,E.attributes,3),_.writeTag(4,0),_.writeVarint(E.droppedAttributesCount||0),_.finishLengthDelimited(w,_.pos-C)}function serializeLink(_,E){const w=_.startLengthDelimited(),C=_.pos,L=E.context;_.writeTag(1,2),_.writeBytes(hexToBinary(L.traceId)),_.writeTag(2,2),_.writeBytes(hexToBinary(L.spanId));const R=L.traceState?.serialize();R&&(_.writeTag(3,2),_.writeString(R)),E.attributes&&writeAttributes(_,E.attributes,4),_.writeTag(5,0),_.writeVarint(E.droppedAttributesCount||0);const P=buildSpanFlags(L.traceFlags,L.isRemote);P&&(_.writeTag(6,5),_.writeFixed32(P)),_.finishLengthDelimited(w,_.pos-C)}function serializeSpan(_,E){const w=_.startLengthDelimited(),C=_.pos,L=E.spanContext();_.writeTag(1,2),_.writeBytes(hexToBinary(L.traceId)),_.writeTag(2,2),_.writeBytes(hexToBinary(L.spanId));const R=L.traceState?.serialize();R&&(_.writeTag(3,2),_.writeString(R)),E.parentSpanContext?.spanId&&(_.writeTag(4,2),_.writeBytes(hexToBinary(E.parentSpanContext.spanId))),_.writeTag(5,2),_.writeString(E.name);const P=null==E.kind?0:E.kind+1;0!==P&&(_.writeTag(6,0),_.writeVarint(P)),_.writeTag(7,1),writeHrTimeAsFixed64(_,E.startTime),_.writeTag(8,1),writeHrTimeAsFixed64(_,E.endTime),E.attributes&&writeAttributes(_,E.attributes,9),_.writeTag(10,0),_.writeVarint(E.droppedAttributesCount);for(const w of E.events)_.writeTag(11,2),serializeEvent(_,w);_.writeTag(12,0),_.writeVarint(E.droppedEventsCount);for(const w of E.links)_.writeTag(13,2),serializeLink(_,w);_.writeTag(14,0),_.writeVarint(E.droppedLinksCount),_.writeTag(15,2),function serializeStatus(_,E){const w=_.startLengthDelimited(),C=_.pos;E.message&&(_.writeTag(2,2),_.writeString(E.message)),_.writeTag(3,0),_.writeVarint(E.code),_.finishLengthDelimited(w,_.pos-C)}(_,E.status);const I=buildSpanFlags(L.traceFlags,E.parentSpanContext?.isRemote);I&&(_.writeTag(16,5),_.writeFixed32(I)),_.finishLengthDelimited(w,_.pos-C)}function serializeScopeSpans(_,E,w){const C=_.startLengthDelimited(),L=_.pos;!function writeInstrumentationScope(_,E,w){_.writeTag(w,2);const C=_.startLengthDelimited(),L=_.pos;_.writeTag(1,2),_.writeString(E.name),E.version&&(_.writeTag(2,2),_.writeString(E.version)),E.attributes&&writeAttributes(_,E.attributes,3),E.droppedAttributesCount&&(_.writeTag(4,0),_.writeVarint(E.droppedAttributesCount)),_.finishLengthDelimited(C,_.pos-L)}(_,E,1);for(const E of w)_.writeTag(2,2),serializeSpan(_,E);E.schemaUrl&&(_.writeTag(3,2),_.writeString(E.schemaUrl)),_.finishLengthDelimited(C,_.pos-L)}function serializeResourceSpans(_,E,w){const C=_.startLengthDelimited(),L=_.pos;!function writeResource(_,E,w){_.writeTag(w,2);const C=_.startLengthDelimited(),L=_.pos;E.attributes&&writeAttributes(_,E.attributes,1),_.writeTag(2,0),_.writeVarint(0),_.finishLengthDelimited(C,_.pos-L)}(_,E,1);for(const E of w.values()){_.writeTag(2,2);serializeScopeSpans(_,E[0].instrumentationScope,E)}E.schemaUrl&&(_.writeTag(3,2),_.writeString(E.schemaUrl)),_.finishLengthDelimited(C,_.pos-L)}function serializeTraceExportRequest(_){const E=function createResourceMap$2(_){const E=new Map;for(const w of _){const _=w.resource,C=w.instrumentationScope;let L=E.get(_);L||(L=new Map,E.set(_,L));let R=L.get(C);R||(R=[],L.set(C,R)),R.push(w)}return E}(_),w=new ProtobufSizeEstimator;for(const[_,C]of E)w.writeTag(1,2),serializeResourceSpans(w,_,C);const C=new ProtobufWriter(w.pos);for(const[_,w]of E)C.writeTag(1,2),serializeResourceSpans(C,_,w);return C.finish()}function deserializePartialSuccess(_){const E=new ProtobufReader(_),w={};for(;!E.isAtEnd();){const{fieldNumber:_,wireType:C}=E.readTag();switch(_){case 1:0===C?w.rejectedSpans=E.readVarint():E.skip(C);break;case 2:2===C?w.errorMessage=E.readString():E.skip(C);break;default:E.skip(C)}}return w}const ve={serializeRequest:_=>serializeTraceExportRequest(_),deserializeResponse:_=>function deserializeExportTraceServiceResponse(_){const E=new ProtobufReader(_),w={};for(;!E.isAtEnd();){const{fieldNumber:_,wireType:C}=E.readTag();1===_&&2===C?w.partialSuccess=deserializePartialSuccess(E.readBytes()):E.skip(C)}return w}(_)};function createResource(_,E){const w={attributes:toAttributes(_.attributes,E),droppedAttributesCount:0},C=_.schemaUrl;return C&&""!==C&&(w.schemaUrl=C),w}function createInstrumentationScope(_,E){const w={name:_.name,version:_.version};return _.attributes&&Object.keys(_.attributes).length>0&&(w.attributes=toAttributes(_.attributes,E),w.droppedAttributesCount=_.droppedAttributesCount??0),w}function toAttributes(_,E){return Object.keys(_).map((w=>function toKeyValue(_,E,w){return{key:_,value:toAnyValue(E,w)}}(w,_[w],E)))}function toAnyValue(_,E){const w=typeof _;if("string"===w)return{stringValue:_};if("number"===w)return Number.isInteger(_)?{intValue:_}:{doubleValue:_};if("boolean"===w)return{boolValue:_};if(_ instanceof Uint8Array)return{bytesValue:E.encodeUint8Array(_)};if(Array.isArray(_)){const w=new Array(_.length);for(let C=0;C<_.length;C++)w[C]=toAnyValue(_[C],E);return{arrayValue:{values:w}}}if("object"===w&&null!=_){const w=Object.keys(_),C=new Array(w.length);for(let L=0;L<w.length;L++)C[L]={key:w[L],value:toAnyValue(_[w[L]],E)};return{kvlistValue:{values:C}}}return{}}function logRecordsToResourceLogs(_,E){const w=function createResourceMap$1(_){const E=new Map;for(const w of _){const{resource:_,instrumentationScope:C}=w;let L=E.get(_);L||(L=new Map,E.set(_,L));let R=L.get(C);R||(R=[],L.set(C,R)),R.push(w)}return E}(_);return Array.from(w,(([_,w])=>{const C=createResource(_,E);return{resource:C,scopeLogs:Array.from(w,(([,_])=>({scope:createInstrumentationScope(_[0].instrumentationScope,E),logRecords:_.map((_=>function toLogRecord(_,E){return{timeUnixNano:E.encodeHrTime(_.hrTime),observedTimeUnixNano:E.encodeHrTime(_.hrTimeObserved),severityNumber:_.severityNumber,severityText:_.severityText,body:toAnyValue(_.body,E),eventName:_.eventName,attributes:toAttributes(_.attributes,E),droppedAttributesCount:_.droppedAttributesCount,flags:_.spanContext?.traceFlags,traceId:E.encodeOptionalSpanContext(_.spanContext?.traceId),spanId:E.encodeOptionalSpanContext(_.spanContext?.spanId)}}(_,E))),schemaUrl:_[0].instrumentationScope.schemaUrl}))),schemaUrl:C.schemaUrl}}))}const we="undefined"!=typeof BigInt?function encodeAsString(_){const E=function hrTimeToNanos(_){const E=BigInt(1e9);return BigInt(Math.trunc(_[0]))*E+BigInt(Math.trunc(_[1]))}(_);return E.toString()}:hrTimeToNanoseconds;function identity(_){return _}const Ae={encodeHrTime:we,encodeSpanContext:identity,encodeOptionalSpanContext:identity,encodeUint8Array:_=>{if("undefined"!=typeof Buffer)return Buffer.from(_).toString("base64");const E=new Array(_.length);for(let w=0;w<_.length;w++)E[w]=String.fromCharCode(_[w]);return btoa(E.join(""))}},Ce={serializeRequest:_=>{const E=function createExportLogsServiceRequest(_,E){return{resourceLogs:logRecordsToResourceLogs(_,E)}}(_,Ae);return(new TextEncoder).encode(JSON.stringify(E))},deserializeResponse:_=>{if(0===_.length)return{};const E=new TextDecoder;try{return JSON.parse(E.decode(_))}catch(_){return vt.warn(`Failed to parse logs export response: ${_.message}. Returning empty response`),{}}}};function buildSpanFlagsFrom(_,E){let w=255&_|256;return E&&(w|=512),w}function sdkSpanToOtlpSpan(_,E){const w=_.spanContext(),C=_.status,L=_.parentSpanContext?.spanId?E.encodeSpanContext(_.parentSpanContext?.spanId):void 0;return{traceId:E.encodeSpanContext(w.traceId),spanId:E.encodeSpanContext(w.spanId),parentSpanId:L,traceState:w.traceState?.serialize(),name:_.name,kind:null==_.kind?0:_.kind+1,startTimeUnixNano:E.encodeHrTime(_.startTime),endTimeUnixNano:E.encodeHrTime(_.endTime),attributes:toAttributes(_.attributes,E),droppedAttributesCount:_.droppedAttributesCount,events:_.events.map((_=>function toOtlpSpanEvent(_,E){return{attributes:_.attributes?toAttributes(_.attributes,E):[],name:_.name,timeUnixNano:E.encodeHrTime(_.time),droppedAttributesCount:_.droppedAttributesCount||0}}(_,E))),droppedEventsCount:_.droppedEventsCount,status:{code:C.code,message:C.message},links:_.links.map((_=>function toOtlpLink(_,E){return{attributes:_.attributes?toAttributes(_.attributes,E):[],spanId:E.encodeSpanContext(_.context.spanId),traceId:E.encodeSpanContext(_.context.traceId),traceState:_.context.traceState?.serialize(),droppedAttributesCount:_.droppedAttributesCount||0,flags:buildSpanFlagsFrom(_.context.traceFlags,_.context.isRemote)}}(_,E))),droppedLinksCount:_.droppedLinksCount,flags:buildSpanFlagsFrom(w.traceFlags,_.parentSpanContext?.isRemote)}}function spanRecordsToResourceSpans(_,E){const w=function createResourceMap(_){const E=new Map;for(const w of _){let _=E.get(w.resource);_||(_=new Map,E.set(w.resource,_));const C=`${w.instrumentationScope.name}@${w.instrumentationScope.version||""}:${w.instrumentationScope.schemaUrl||""}`;let L=_.get(C);L||(L=[],_.set(C,L)),L.push(w)}return E}(_),C=[],L=w.entries();let R=L.next();for(;!R.done;){const[_,w]=R.value,P=[],I=w.values();let k=I.next();for(;!k.done;){const _=k.value;if(_.length>0){const w=_.map((_=>sdkSpanToOtlpSpan(_,E)));P.push({scope:createInstrumentationScope(_[0].instrumentationScope,E),spans:w,schemaUrl:_[0].instrumentationScope.schemaUrl})}k=I.next()}const F=createResource(_,E),$={resource:F,scopeSpans:P,schemaUrl:F.schemaUrl};C.push($),R=L.next()}return C}const Le={serializeRequest:_=>{const E=function createExportTraceServiceRequest(_,E){return{resourceSpans:spanRecordsToResourceSpans(_,E)}}(_,Ae);return(new TextEncoder).encode(JSON.stringify(E))},deserializeResponse:_=>{if(0===_.length)return{};const E=new TextDecoder;try{return JSON.parse(E.decode(_))}catch(_){return vt.warn(`Failed to parse trace export response: ${_.message}. Returning empty response`),{}}}};class OTLPExporterBase{constructor(_){this._delegate=_}export(_,E){this._delegate.export(_,E)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class OTLPExporterError extends Error{constructor(_,E,w){super(_),this.name="OTLPExporterError",this.data=w,this.code=E}}function validateTimeoutMillis(_){if(Number.isFinite(_)&&_>0)return _;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${_}')`)}function mergeOtlpSharedConfigurationWithDefaults(_,E,w){return{timeoutMillis:validateTimeoutMillis(_.timeoutMillis??E.timeoutMillis??w.timeoutMillis),concurrencyLimit:_.concurrencyLimit??E.concurrencyLimit??w.concurrencyLimit,compression:_.compression??E.compression??w.compression}}class BoundedQueueExportPromiseHandler{constructor(_){this._sendingPromises=[],this._concurrencyLimit=_}pushPromise(_){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(_);const popPromise=()=>{const E=this._sendingPromises.indexOf(_);this._sendingPromises.splice(E,1)};_.then(popPromise,popPromise)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function createBoundedQueueExportPromiseHandler(_){return new BoundedQueueExportPromiseHandler(_.concurrencyLimit)}function createLoggingPartialSuccessResponseHandler(){return{handleResponse(_){null!=_&&function isPartialSuccessResponse(_){return Object.prototype.hasOwnProperty.call(_,"partialSuccess")}(_)&&null!=_.partialSuccess&&0!==Object.keys(_.partialSuccess).length&&vt.warn("Received Partial Success response:",JSON.stringify(_.partialSuccess))}}}class OTLPExportDelegate{constructor(_,E,w,C,L){this._transport=_,this._serializer=E,this._responseHandler=w,this._promiseQueue=C,this._timeout=L,this._diagLogger=vt.createComponentLogger({namespace:"OTLPExportDelegate"})}export(_,E){if(this._diagLogger.debug("items to be sent",_),this._promiseQueue.hasReachedLimit())return void E({code:he.FAILED,error:new Error("Concurrent export limit reached")});const w=this._serializer.serializeRequest(_);null!=w?this._promiseQueue.pushPromise(this._transport.send(w,this._timeout).then((_=>{if("success"!==_.status)"failure"===_.status&&_.error?E({code:he.FAILED,error:_.error}):"retryable"===_.status?E({code:he.FAILED,error:_.error??new OTLPExporterError("Export failed with retryable status")}):E({code:he.FAILED,error:new OTLPExporterError("Export failed with unknown error")});else{if(null!=_.data)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(_.data))}catch(E){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",E,_.data)}E({code:he.SUCCESS})}}),(_=>E({code:he.FAILED,error:_})))):E({code:he.FAILED,error:new Error("Nothing to send")})}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function createOtlpNetworkExportDelegate(_,E,w){return function createOtlpExportDelegate(_,E){return new OTLPExportDelegate(_.transport,_.serializer,createLoggingPartialSuccessResponseHandler(),_.promiseHandler,E.timeout)}({transport:w,serializer:E,promiseHandler:createBoundedQueueExportPromiseHandler(_)},{timeout:_.timeoutMillis})}let Re,Pe;const Oe=new WeakMap,xe=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,De=new WeakMap;let ke={get(_,E,w){if(_ instanceof IDBTransaction){if("done"===E)return xe.get(_);if("objectStoreNames"===E)return _.objectStoreNames||Ie.get(_);if("store"===E)return w.objectStoreNames[1]?void 0:w.objectStore(w.objectStoreNames[0])}return wrap$1(_[E])},set:(_,E,w)=>(_[E]=w,!0),has:(_,E)=>_ instanceof IDBTransaction&&("done"===E||"store"===E)||E in _};function wrapFunction(_){return _!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?function getCursorAdvanceMethods(){return Pe||(Pe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}().includes(_)?function(...E){return _.apply(unwrap$1(this),E),wrap$1(Oe.get(this))}:function(...E){return wrap$1(_.apply(unwrap$1(this),E))}:function(E,...w){const C=_.call(unwrap$1(this),E,...w);return Ie.set(C,E.sort?E.sort():[E]),wrap$1(C)}}function transformCachableValue(_){return"function"==typeof _?wrapFunction(_):(_ instanceof IDBTransaction&&function cacheDonePromiseForTransaction(_){if(xe.has(_))return;const E=new Promise(((E,w)=>{const unlisten=()=>{_.removeEventListener("complete",complete),_.removeEventListener("error",error),_.removeEventListener("abort",error)},complete=()=>{E(),unlisten()},error=()=>{w(_.error||new DOMException("AbortError","AbortError")),unlisten()};_.addEventListener("complete",complete),_.addEventListener("error",error),_.addEventListener("abort",error)}));xe.set(_,E)}(_),E=_,function getIdbProxyableTypes(){return Re||(Re=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}().some((_=>E instanceof _))?new Proxy(_,ke):_);var E}function wrap$1(_){if(_ instanceof IDBRequest)return function promisifyRequest(_){const E=new Promise(((E,w)=>{const unlisten=()=>{_.removeEventListener("success",success),_.removeEventListener("error",error)},success=()=>{E(wrap$1(_.result)),unlisten()},error=()=>{w(_.error),unlisten()};_.addEventListener("success",success),_.addEventListener("error",error)}));return E.then((E=>{E instanceof IDBCursor&&Oe.set(E,_)})).catch((()=>{})),De.set(E,_),E}(_);if(Ne.has(_))return Ne.get(_);const E=transformCachableValue(_);return E!==_&&(Ne.set(_,E),De.set(E,_)),E}const unwrap$1=_=>De.get(_);const Me=["get","getKey","getAll","getAllKeys","count"],Fe=["put","add","delete","clear"],Be=new Map;function getMethod(_,E){if(!(_ instanceof IDBDatabase)||E in _||"string"!=typeof E)return;if(Be.get(E))return Be.get(E);const w=E.replace(/FromIndex$/,""),C=E!==w,L=Fe.includes(w);if(!(w in(C?IDBIndex:IDBObjectStore).prototype)||!L&&!Me.includes(w))return;const method=async function(_,...E){const R=this.transaction(_,L?"readwrite":"readonly");let P=R.store;return C&&(P=P.index(E.shift())),(await Promise.all([P[w](...E),L&&R.done]))[0]};return Be.set(E,method),method}!function replaceTraps(_){ke=_(ke)}((_=>({..._,get:(E,w,C)=>getMethod(E,w)||_.get(E,w,C),has:(E,w)=>!!getMethod(E,w)||_.has(E,w)})));const Ue="@firebase/installations",$e="0.6.24",Ve=1e4,He=`w:${$e}`,je="FIS_v2",ze=36e5,qe=new ErrorFactory("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function isServerError(_){return _ instanceof FirebaseError&&_.code.includes("request-failed")}function getInstallationsEndpoint({projectId:_}){return`https://firebaseinstallations.googleapis.com/v1/projects/${_}/installations`}function extractAuthTokenInfoFromResponse(_){return{token:_.token,requestStatus:2,expiresIn:(E=_.expiresIn,Number(E.replace("s","000"))),creationTime:Date.now()};var E}async function getErrorFromResponse(_,E){const w=(await E.json()).error;return qe.create("request-failed",{requestName:_,serverCode:w.code,serverMessage:w.message,serverStatus:w.status})}function getHeaders({apiKey:_}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":_})}function getHeadersWithAuth(_,{refreshToken:E}){const w=getHeaders(_);return w.append("Authorization",function getAuthorizationHeader(_){return`${je} ${_}`}(E)),w}async function retryIfServerError(_){const E=await _();return E.status>=500&&E.status<600?_():E}function sleep(_){return new Promise((E=>{setTimeout(E,_)}))}const Ge=/^[cdef][\w-]{21}$/;function generateFid(){try{const _=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(_),_[0]=112+_[0]%16;const E=function encode(_){const E=function bufferToBase64UrlSafe(_){return btoa(String.fromCharCode(..._)).replace(/\+/g,"-").replace(/\//g,"_")}(_);return E.substr(0,22)}(_);return Ge.test(E)?E:""}catch{return""}}function getKey(_){return`${_.appName}!${_.appId}`}const We=new Map;function fidChanged(_,E){const w=getKey(_);callFidChangeCallbacks(w,E),function broadcastFidChange(_,E){const w=function getBroadcastChannel(){!Ke&&"BroadcastChannel"in self&&(Ke=new BroadcastChannel("[Firebase] FID Change"),Ke.onmessage=_=>{callFidChangeCallbacks(_.data.key,_.data.fid)});return Ke}();w&&w.postMessage({key:_,fid:E});!function closeBroadcastChannel(){0===We.size&&Ke&&(Ke.close(),Ke=null)}()}(w,E)}function callFidChangeCallbacks(_,E){const w=We.get(_);if(w)for(const _ of w)_(E)}let Ke=null;const Qe="firebase-installations-store";let Xe=null;function getDbPromise(){return Xe||(Xe=function openDB(_,E,{blocked:w,upgrade:C,blocking:L,terminated:R}={}){const P=indexedDB.open(_,E),I=wrap$1(P);return C&&P.addEventListener("upgradeneeded",(_=>{C(wrap$1(P.result),_.oldVersion,_.newVersion,wrap$1(P.transaction),_)})),w&&P.addEventListener("blocked",(_=>w(_.oldVersion,_.newVersion,_))),I.then((_=>{R&&_.addEventListener("close",(()=>R())),L&&_.addEventListener("versionchange",(_=>L(_.oldVersion,_.newVersion,_)))})).catch((()=>{})),I}("firebase-installations-database",1,{upgrade:(_,E)=>{if(0===E)_.createObjectStore(Qe)}})),Xe}async function set(_,E){const w=getKey(_),C=(await getDbPromise()).transaction(Qe,"readwrite"),L=C.objectStore(Qe),R=await L.get(w);return await L.put(E,w),await C.done,R&&R.fid===E.fid||fidChanged(_,E.fid),E}async function remove(_){const E=getKey(_),w=(await getDbPromise()).transaction(Qe,"readwrite");await w.objectStore(Qe).delete(E),await w.done}async function update(_,E){const w=getKey(_),C=(await getDbPromise()).transaction(Qe,"readwrite"),L=C.objectStore(Qe),R=await L.get(w),P=E(R);return void 0===P?await L.delete(w):await L.put(P,w),await C.done,!P||R&&R.fid===P.fid||fidChanged(_,P.fid),P}async function getInstallationEntry(_){let E;const w=await update(_.appConfig,(w=>{const C=function updateOrCreateInstallationEntry(_){const E=_||{fid:generateFid(),registrationStatus:0};return clearTimedOutRequest(E)}(w),L=function triggerRegistrationIfNecessary(_,E){if(0===E.registrationStatus){if(!navigator.onLine){return{installationEntry:E,registrationPromise:Promise.reject(qe.create("app-offline"))}}const w={fid:E.fid,registrationStatus:1,registrationTime:Date.now()},C=async function registerInstallation(_,E){try{const w=await async function createInstallationRequest({appConfig:_,heartbeatServiceProvider:E},{fid:w}){const C=getInstallationsEndpoint(_),L=getHeaders(_),R=E.getImmediate({optional:!0});if(R){const _=await R.getHeartbeatsHeader();_&&L.append("x-firebase-client",_)}const P={fid:w,authVersion:je,appId:_.appId,sdkVersion:He},I={method:"POST",headers:L,body:JSON.stringify(P)},k=await retryIfServerError((()=>fetch(C,I)));if(k.ok){const _=await k.json();return{fid:_.fid||w,registrationStatus:2,refreshToken:_.refreshToken,authToken:extractAuthTokenInfoFromResponse(_.authToken)}}throw await getErrorFromResponse("Create Installation",k)}(_,E);return set(_.appConfig,w)}catch(w){throw isServerError(w)&&409===w.customData.serverCode?await remove(_.appConfig):await set(_.appConfig,{fid:E.fid,registrationStatus:0}),w}}(_,w);return{installationEntry:w,registrationPromise:C}}return 1===E.registrationStatus?{installationEntry:E,registrationPromise:waitUntilFidRegistration(_)}:{installationEntry:E}}(_,C);return E=L.registrationPromise,L.installationEntry}));return""===w.fid?{installationEntry:await E}:{installationEntry:w,registrationPromise:E}}async function waitUntilFidRegistration(_){let E=await updateInstallationRequest(_.appConfig);for(;1===E.registrationStatus;)await sleep(100),E=await updateInstallationRequest(_.appConfig);if(0===E.registrationStatus){const{installationEntry:E,registrationPromise:w}=await getInstallationEntry(_);return w||E}return E}function updateInstallationRequest(_){return update(_,(_=>{if(!_)throw qe.create("installation-not-found");return clearTimedOutRequest(_)}))}function clearTimedOutRequest(_){return function hasInstallationRequestTimedOut(_){return 1===_.registrationStatus&&_.registrationTime+Ve<Date.now()}(_)?{fid:_.fid,registrationStatus:0}:_}async function generateAuthTokenRequest({appConfig:_,heartbeatServiceProvider:E},w){const C=function getGenerateAuthTokenEndpoint(_,{fid:E}){return`${getInstallationsEndpoint(_)}/${E}/authTokens:generate`}(_,w),L=getHeadersWithAuth(_,w),R=E.getImmediate({optional:!0});if(R){const _=await R.getHeartbeatsHeader();_&&L.append("x-firebase-client",_)}const P={installation:{sdkVersion:He,appId:_.appId}},I={method:"POST",headers:L,body:JSON.stringify(P)},k=await retryIfServerError((()=>fetch(C,I)));if(k.ok){return extractAuthTokenInfoFromResponse(await k.json())}throw await getErrorFromResponse("Generate Auth Token",k)}async function refreshAuthToken(_,E=!1){let w;const C=await update(_.appConfig,(C=>{if(!isEntryRegistered(C))throw qe.create("not-registered");const L=C.authToken;if(!E&&function isAuthTokenValid(_){return 2===_.requestStatus&&!function isAuthTokenExpired(_){const E=Date.now();return E<_.creationTime||_.creationTime+_.expiresIn<E+ze}(_)}(L))return C;if(1===L.requestStatus)return w=async function waitUntilAuthTokenRequest(_,E){let w=await updateAuthTokenRequest(_.appConfig);for(;1===w.authToken.requestStatus;)await sleep(100),w=await updateAuthTokenRequest(_.appConfig);const C=w.authToken;return 0===C.requestStatus?refreshAuthToken(_,E):C}(_,E),C;{if(!navigator.onLine)throw qe.create("app-offline");const E=function makeAuthTokenRequestInProgressEntry(_){const E={requestStatus:1,requestTime:Date.now()};return{..._,authToken:E}}(C);return w=async function fetchAuthTokenFromServer(_,E){try{const w=await generateAuthTokenRequest(_,E),C={...E,authToken:w};return await set(_.appConfig,C),w}catch(w){if(!isServerError(w)||401!==w.customData.serverCode&&404!==w.customData.serverCode){const w={...E,authToken:{requestStatus:0}};await set(_.appConfig,w)}else await remove(_.appConfig);throw w}}(_,E),E}}));return w?await w:C.authToken}function updateAuthTokenRequest(_){return update(_,(_=>{if(!isEntryRegistered(_))throw qe.create("not-registered");return function hasAuthTokenRequestTimedOut(_){return 1===_.requestStatus&&_.requestTime+Ve<Date.now()}(_.authToken)?{..._,authToken:{requestStatus:0}}:_}))}function isEntryRegistered(_){return void 0!==_&&2===_.registrationStatus}async function getToken(_,E=!1){const w=_;await async function completeInstallationRegistration(_){const{registrationPromise:E}=await getInstallationEntry(_);E&&await E}(w);return(await refreshAuthToken(w,E)).token}function getMissingValueError(_){return qe.create("missing-app-config-values",{valueName:_})}const Ye="installations",publicFactory=_=>{const E=_.getProvider("app").getImmediate(),w=function extractAppConfig(_){if(!_||!_.options)throw getMissingValueError("App Configuration");if(!_.name)throw getMissingValueError("App Name");const E=["projectId","apiKey","appId"];for(const w of E)if(!_.options[w])throw getMissingValueError(w);return{appName:_.name,projectId:_.options.projectId,apiKey:_.options.apiKey,appId:_.options.appId}}(E);return{app:E,appConfig:w,heartbeatServiceProvider:_getProvider(E,"heartbeat"),_delete:()=>Promise.resolve()}},internalFactory=_=>{const E=_.getProvider("app").getImmediate(),w=_getProvider(E,Ye).getImmediate();return{getId:()=>async function getId(_){const E=_,{installationEntry:w,registrationPromise:C}=await getInstallationEntry(E);return C?C.catch(console.error):refreshAuthToken(E).catch(console.error),w.fid}(w),getToken:_=>getToken(w,_)}};function registerInstrumentations(_){const E=_.tracerProvider||It.getTracerProvider(),w=_.meterProvider||Ct.getMeterProvider(),C=_.loggerProvider||$.getLoggerProvider(),L=_.instrumentations?.flat()??[];return function enableInstrumentations(_,E,w,C){for(let L=0,R=_.length;L<R;L++){const R=_[L];E&&R.setTracerProvider(E),w&&R.setMeterProvider(w),C&&R.setLoggerProvider&&R.setLoggerProvider(C),R.getConfig().enabled||R.enable()}}(L,E,w,C),()=>{!function disableInstrumentations(_){_.forEach((_=>_.disable()))}(L)}}!function registerInstallations(){E(new Component(Ye,publicFactory,"PUBLIC")),E(new Component("installations-internal",internalFactory,"PRIVATE"))}(),_(Ue,$e),_(Ue,$e,"esm2020");let Ze=console.error.bind(console);function defineProperty(_,E,w){const C=!!_[E]&&Object.prototype.propertyIsEnumerable.call(_,E);Object.defineProperty(_,E,{configurable:!0,enumerable:C,writable:!0,value:w})}const wrap=(_,E,w)=>{if(!_||!_[E])return void Ze("no original function "+String(E)+" to wrap");if(!w)return Ze("no wrapper function"),void Ze((new Error).stack);const C=_[E];if("function"!=typeof C||"function"!=typeof w)return void Ze("original object and wrapper must be functions");const L=w(C,E);return defineProperty(L,"__original",C),defineProperty(L,"__unwrap",(()=>{_[E]===L&&defineProperty(_,E,C)})),defineProperty(L,"__wrapped",!0),defineProperty(_,E,L),L},massWrap=(_,E,w)=>{if(!_)return Ze("must provide one or more modules to patch"),void Ze((new Error).stack);Array.isArray(_)||(_=[_]),E&&Array.isArray(E)?_.forEach((_=>{E.forEach((E=>{wrap(_,E,w)}))})):Ze("must provide one or more functions to wrap on modules")},unwrap=(_,E)=>{if(!_||!_[E])return Ze("no function to unwrap."),void Ze((new Error).stack);const w=_[E];w.__unwrap?w.__unwrap():Ze("no original to unwrap to -- has "+String(E)+" already been unwrapped?")},massUnwrap=(_,E)=>{if(!_)return Ze("must provide one or more modules to patch"),void Ze((new Error).stack);Array.isArray(_)||(_=[_]),E&&Array.isArray(E)?_.forEach((_=>{E.forEach((E=>{unwrap(_,E)}))})):Ze("must provide one or more functions to unwrap on modules")};class InstrumentationAbstract{constructor(_,E,w){this._config={},this._wrap=wrap,this._unwrap=unwrap,this._massWrap=massWrap,this._massUnwrap=massUnwrap,this.instrumentationName=_,this.instrumentationVersion=E,this.setConfig(w),this._diag=vt.createComponentLogger({namespace:_}),this._tracer=It.getTracer(_,E),this._meter=Ct.getMeter(_,E),this._logger=$.getLogger(_,E),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(_){this._meter=_.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(_){this._logger=_.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const _=this.init()??[];return Array.isArray(_)?_:[_]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(_){this._config={enabled:!0,..._}}setTracerProvider(_){this._tracer=_.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(_,E,w,C){if(_)try{_(w,C)}catch(_){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:E},_)}}}class InstrumentationBase extends InstrumentationAbstract{constructor(_,E,w){super(_,E,w),this._config.enabled&&this.enable()}}function safeExecuteInTheMiddle(_,E,w){let C,L;try{L=_()}catch(_){C=_}finally{return E(C,L),L}}var Je;function semconvStabilityFromStr(_,E){let w=Je.OLD;const C=E?.split(",").map((_=>_.trim())).filter((_=>""!==_));for(const E of C??[]){if(E.toLowerCase()===_+"/dup"){w=Je.DUPLICATE;break}E.toLowerCase()===_&&(w=Je.STABLE)}return w}!function(_){_[_.STABLE=1]="STABLE",_[_.OLD=2]="OLD",_[_.DUPLICATE=3]="DUPLICATE"}(Je||(Je={}));var tr="0.6.0";const er="browser.navigation_timing.type",rr="url.full",nr="browser.navigation_timing.dom_complete",sr="browser.navigation_timing.dom_content_loaded_event_end",ir="browser.navigation_timing.dom_content_loaded_event_start",or="browser.navigation_timing.dom_interactive",ar="browser.navigation_timing.load_event_end",cr="browser.navigation_timing.load_event_start",ur="browser.navigation_timing.redirect_count",lr="browser.navigation_timing.unload_event_end",dr="browser.navigation_timing.unload_event_start",hr="browser.resource_timing.duration",pr="browser.resource_timing.fetch_start",gr="browser.resource_timing.domain_lookup_start",mr="browser.resource_timing.domain_lookup_end",fr="browser.resource_timing.connect_start",_r="browser.resource_timing.connect_end",br="browser.resource_timing.secure_connection_start",yr="browser.resource_timing.request_start",Sr="browser.resource_timing.response_start",Er="browser.resource_timing.response_end",Tr="browser.resource_timing.transfer_size",vr="browser.resource_timing.encoded_body_size",wr="browser.resource_timing.decoded_body_size";var Ar=class extends InstrumentationBase{constructor(_={}){super("@opentelemetry/browser-instrumentation/navigation-timing",tr,_),this._retryCount=0,this._didEmit=!1}init(){return[]}enable(){this._isEnabled||(this._isEnabled=!0,this._onLoad=()=>this._tryEmitOrSchedule(),this._onPageHide=()=>this._handleUnload(),this._tryEmitOrSchedule(),this._didEmit||window.addEventListener("pagehide",this._onPageHide))}disable(){this._isEnabled=!1,this._unsubscribeAll(),this._lastEntry=void 0,this._didEmit=!1,this._retryCount=0}_getLatestNavigationEntry(){const _=performance?.getEntriesByType?.("navigation");if(_&&0!==_.length)return _[_.length-1]}_calculateBackoffDelay(){return 50*this._retryCount}_tryEmitOrSchedule(){if(this._didEmit)return;const _=this._getLatestNavigationEntry();if(_&&(this._lastEntry=_),_&&_.loadEventEnd>0)return void this._emitAndCleanup(_);if("complete"!==document.readyState)return void window.addEventListener("load",this._onLoad,{once:!0});if(void 0!==this._completeDelayTimeoutId)return;if(this._retryCount>5)return void(this._lastEntry?(this._diag.warn("Navigation timing: retries exhausted, emitting incomplete entry"),this._emitAndCleanup(this._lastEntry)):(this._diag.warn("Navigation timing: retries exhausted with no entry available"),this._unsubscribeAll()));const E=this._calculateBackoffDelay();this._retryCount++,this._completeDelayTimeoutId=window.setTimeout((()=>{this._completeDelayTimeoutId=void 0,this._tryEmitOrSchedule()}),E)}_handleUnload(){if(this._didEmit)return;const _=this._getLatestNavigationEntry()??this._lastEntry;_?this._emitAndCleanup(_):(this._diag.warn("Navigation timing: no entry available at unload"),this._unsubscribeAll())}_emitAndCleanup(_){this._didEmit||(this._didEmit=!0,this._emitNavigationTiming(_),this._lastEntry=void 0,this._unsubscribeAll())}_emitNavigationTiming(_){_&&this.logger.emit({eventName:"browser.navigation_timing",severityNumber:R.INFO,attributes:{[er]:_.type,[rr]:_.name,[hr]:_.duration,[nr]:_.domComplete,[sr]:_.domContentLoadedEventEnd,[ir]:_.domContentLoadedEventStart,[or]:_.domInteractive,[ar]:_.loadEventEnd,[cr]:_.loadEventStart,[ur]:_.redirectCount,[lr]:_.unloadEventEnd,[dr]:_.unloadEventStart,[pr]:_.fetchStart,[gr]:_.domainLookupStart,[mr]:_.domainLookupEnd,[fr]:_.connectStart,[_r]:_.connectEnd,[br]:_.secureConnectionStart,[yr]:_.requestStart,[Sr]:_.responseStart,[Er]:_.responseEnd,[Tr]:_.transferSize,[vr]:_.encodedBodySize,[wr]:_.decodedBodySize}})}_unsubscribeAll(){this._completeDelayTimeoutId&&(clearTimeout(this._completeDelayTimeoutId),this._completeDelayTimeoutId=void 0),this._onLoad&&window.removeEventListener("load",this._onLoad),this._onPageHide&&window.removeEventListener("pagehide",this._onPageHide)}};const getElementCSSSelector=(_,{useIdForTargetElement:E=!1,useIdForAncestors:w=!1}={})=>{if(_.nodeType===Node.DOCUMENT_NODE)return"";const C=_,L=getNodeSelector(C,E||w);if(L.startsWith("#"))return L;const R=C.parentElement,P=R?getElementCSSSelector(R,{useIdForAncestors:w,useIdForTargetElement:!1}):"";return P?`${P} > ${L}`:L},getNodeSelector=(_,E=!1)=>{if(_.nodeType!==Node.ELEMENT_NODE)return"";const w=_,C=w.getAttribute("id");if(E&&C&&1===w.ownerDocument.querySelectorAll(`#${CSS.escape(C)}`).length)return`#${CSS.escape(C)}`;let L=getFullClassSelector(w);const R=getNthChild(w);return R>0&&(L+=`:nth-child(${R})`),L},getNthChild=_=>{if(!_.parentElement)return 0;const E=getFullClassSelector(_),w=Array.from(_.parentElement.children).filter((_=>getFullClassSelector(_)===E));return w.length>1?w.indexOf(_)+1:0},getFullClassSelector=_=>_.localName+(_.classList.length>0?Array.from(_.classList).map((_=>`.${CSS.escape(_)}`)).join(""):""),Cr="browser.mouse_event.button",Lr="browser.page.x",Rr="browser.page.y",Pr="browser.tag_name",Or="browser.element.attributes",xr="browser.css_selector",Ir=["click"];var Nr=class extends InstrumentationBase{constructor(_={}){super("@opentelemetry/browser-instrumentation/user-action",tr,_)}init(){return[]}_getMouseButtonFromMouseEvent(_){switch(_.button){case 0:default:return"left";case 1:return"middle";case 2:return"right"}}onClick(_){const E=_.target;if(!(E instanceof HTMLElement))return;if(E.hasAttribute("disabled"))return;const w=getElementCSSSelector(E,{useIdForTargetElement:!0,useIdForAncestors:!0}),C={};for(const _ of E.attributes)_.name.startsWith("data-otel-")&&(C[_.name.slice(10)]=_.value);this.logger.emit({severityNumber:R.INFO,eventName:"browser.user_action.click",attributes:{[Lr]:_.pageX,[Rr]:_.pageY,[Pr]:E.tagName,[Or]:C,[Cr]:this._getMouseButtonFromMouseEvent(_),[xr]:w}})}enable(){const _=this._config.autoCapturedActions??Ir;this._onClickHandler||(this._onClickHandler=this.onClick.bind(this)),_.includes("click")&&document.addEventListener("click",this._onClickHandler,!0)}disable(){this._onClickHandler&&document.removeEventListener("click",this._onClickHandler,!0)}};const Dr="browser.web_vital.name",kr="browser.web_vital.value",Mr="browser.web_vital.rating",Fr="browser.web_vital.delta",Br="browser.web_vital.id",Ur="browser.web_vital.navigation_type";class t{constructor(){this.o=0,this.i=[]}u(_){if(_.hadRecentInput)return;const E=this.i[0],w=this.i.at(-1);this.o&&E&&w&&_.startTime-w.startTime<1e3&&_.startTime-E.startTime<5e3?(this.o+=_.value,this.i.push(_)):(this.o=_.value,this.i=[_]),this.t?.(_)}}const e=()=>{const _=performance.getEntriesByType("navigation")[0];if(_&&_.responseStart>0&&_.responseStart<performance.now())return _},n=_=>{if("loading"===document.readyState)return"loading";const E=e();if(E){if(_<E.domInteractive)return"loading";if(0===E.domContentLoadedEventStart||_<E.domContentLoadedEventStart)return"dom-interactive";if(0===E.domComplete||_<E.domComplete)return"dom-content-loaded"}return"complete"},o=_=>{const E=_.nodeName;return 1===_.nodeType?E.toLowerCase():E.toUpperCase().replace(/^#/,"")},i=_=>{let E="";try{for(;9!==_?.nodeType;){const w=_,C=w.id?"#"+w.id:[o(w),...Array.from(w.classList).sort()].join(".");if(E.length+C.length>99)return E||C;if(E=E?C+">"+E:C,w.id)break;_=w.parentNode}}catch{}return E},$r=new WeakMap;function s(_,E){let w=$r.get(E);return w||(w=new WeakMap,$r.set(E,w)),w.get(_)||w.set(_,new E),w.get(_)}let Vr=-1;const c=()=>Vr,u=_=>{addEventListener("pageshow",(E=>{E.persisted&&(Vr=E.timeStamp,_(E))}),!0)},f=(_,E,w,C)=>{let L,R;return P=>{E.value>=0&&(P||C)&&(R=E.value-(L??0),(R||void 0===L)&&(L=E.value,E.delta=R,E.rating=((_,E)=>_>E[1]?"poor":_>E[0]?"needs-improvement":"good")(E.value,w),_(E)))}},l=_=>{requestAnimationFrame((()=>requestAnimationFrame(_)))},d=()=>e()?.activationStart??0,h=(_,E=-1)=>{const w=e();let C="navigate";return c()>=0?C="back-forward-cache":w&&(document.prerendering||d()>0?C="prerender":document.wasDiscarded?C="restore":w.type&&(C=w.type.replace(/_/g,"-"))),{name:_,value:E,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:C}},m=(_,E,w={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(_)){const C=new PerformanceObserver((_=>{queueMicrotask((()=>{E(_.getEntries())}))}));return C.observe({type:_,buffered:!0,...w}),C}}catch{}},g=_=>{let E=!1;return()=>{E||(_(),E=!0)}};let Hr=-1;const jr=new Set,v=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,b=_=>{if("hidden"===document.visibilityState){if("visibilitychange"===_.type)for(const _ of jr)_();isFinite(Hr)||(Hr="visibilitychange"===_.type?_.timeStamp:0,removeEventListener("prerenderingchange",b,!0))}},M=()=>{if(Hr<0){const _=d(),E=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find((E=>"hidden"===E.name&&E.startTime>=_))?.startTime;Hr=E??v(),addEventListener("visibilitychange",b,!0),addEventListener("prerenderingchange",b,!0),u((()=>{setTimeout((()=>{Hr=v()}))}))}return{get firstHiddenTime(){return Hr},onHidden(_){jr.add(_)}}},T=_=>{document.prerendering?addEventListener("prerenderingchange",_,!0):_()},zr=[1800,3e3],D=(_,E={})=>{T((()=>{const w=M();let C,L=h("FCP");const R=m("paint",(_=>{for(const E of _)"first-contentful-paint"===E.name&&(R.disconnect(),E.startTime<w.firstHiddenTime&&(L.value=Math.max(E.startTime-d(),0),L.entries.push(E),C(!0)))}));R&&(C=f(_,L,zr,E.reportAllChanges),u((w=>{L=h("FCP"),C=f(_,L,zr,E.reportAllChanges),l((()=>{L.value=performance.now()-w.timeStamp,C(!0)}))})))}))},qr=[.1,.25],S=_=>_.find((_=>1===_.node?.nodeType))||_[0];let Gr=0,Wr=1/0,Kr=0;const B=_=>{for(const E of _)E.interactionId&&(Wr=Math.min(Wr,E.interactionId),Kr=Math.max(Kr,E.interactionId),Gr=Kr?(Kr-Wr)/7+1:0)};let Qr;const O=()=>Qr?Gr:performance.interactionCount??0;let Xr=0;class A{constructor(){this.l=[],this.h=new Map}v(){Xr=O(),this.l.length=0,this.h.clear()}M(){const _=Math.min(this.l.length-1,Math.floor((O()-Xr)/50));return this.l[_]}u(_){if(this.m?.(_),!_.interactionId&&"first-input"!==_.entryType)return;const E=this.l.at(-1);let w=this.h.get(_.interactionId);if(w||this.l.length<10||_.duration>E.T){if(w?_.duration>w.T?(w.entries=[_],w.T=_.duration):_.duration===w.T&&_.startTime===w.entries[0].startTime&&w.entries.push(_):(w={id:_.interactionId,entries:[_],T:_.duration},this.h.set(w.id,w),this.l.push(w)),this.l.sort(((_,E)=>E.T-_.T)),this.l.length>10){const _=this.l.splice(10);for(const E of _)this.h.delete(E.id)}this.p?.(w)}}}const W=_=>{const E=globalThis.requestIdleCallback||setTimeout,w=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)_();else{const C=g(_);let L=-1;const r=()=>{w(L),C()};addEventListener("visibilitychange",r,{once:!0,capture:!0}),L=E((()=>{removeEventListener("visibilitychange",r,{capture:!0}),C()}))}},Yr=[200,500],x=(_,E={})=>{const w=s(E=Object.assign({},E),A);let C=[],L=[],R=0;const P=new WeakMap,I=new WeakMap;let k=!1;const p=()=>{k||(W(y),k=!0)},y=()=>{const _=new Set(w.l.map((_=>P.get(_.entries[0])))),E=L.length-10;L=L.filter(((w,C)=>C>=E||_.has(w)));const I=new Set;for(const _ of L){const E=v(_.startTime,_.processingEnd);for(const _ of E)I.add(_)}C=C.filter((_=>_.startTime>R||I.has(_))),k=!1};w.m=_=>{const w=_.startTime+_.duration;let C;R=Math.max(R,_.processingEnd);for(let R=L.length-1;R>=0;R--){const P=L[R];if(Math.abs(w-P.renderTime)<=8){C=P,C.startTime=Math.min(_.startTime,C.startTime),C.processingStart=Math.min(_.processingStart,C.processingStart),C.processingEnd=Math.max(_.processingEnd,C.processingEnd),!1!==E.includeProcessedEventEntries&&C.entries.push(_);break}}C||(C={startTime:_.startTime,processingStart:_.processingStart,processingEnd:_.processingEnd,renderTime:w,entries:!1!==E.includeProcessedEventEntries?[_]:[]},L.push(C)),(_.interactionId||"first-input"===_.entryType)&&P.set(_,C),p()},w.p=_=>{if(!I.get(_)){const w=_.entries.find((_=>_.target))?.target;if(w){const C=E.generateTarget?.(w)??i(w);I.set(_,C)}else{const E=_.entries.find((_=>_.targetSelector))?.targetSelector;E&&I.set(_,E)}}};const v=(_,E)=>{const w=[];for(const L of C)if(!(L.startTime+L.duration<_)){if(L.startTime>E)break;w.push(L)}return w};m("long-animation-frame",(_=>{C=C.concat(_),p()})),((_,E={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const w=M();T((()=>{"interactionCount"in performance||Qr||(Qr=m("event",B,{durationThreshold:0}));let C,L=h("INP");const R=s(E,A),a=_=>{W((()=>{for(const E of _)R.u(E);const E=R.M();E&&E.T!==L.value&&(L.value=E.T,L.entries=E.entries,C())}))},P=m("event",a,{durationThreshold:E.durationThreshold??40});C=f(_,L,Yr,E.reportAllChanges),P&&(P.observe({type:"first-input",buffered:!0}),w.onHidden((()=>{a(P.takeRecords()),C(!0)})),u((()=>{R.v(),L=h("INP"),C=f(_,L,Yr,E.reportAllChanges)})))}))})((E=>{_((_=>{const E=_.entries[0],C=P.get(E),L=E.processingStart,R=Math.max(E.startTime+E.duration,L),k=Math.min(C.processingEnd,R),F=C.entries.sort(((_,E)=>_.processingStart-E.processingStart)),$=v(E.startTime,k),V=w.h.get(E.interactionId),H={interactionTarget:I.get(V),interactionType:E.name.startsWith("key")?"keyboard":"pointer",interactionTime:E.startTime,nextPaintTime:R,processedEventEntries:F,longAnimationFrameEntries:$,inputDelay:L-E.startTime,processingDuration:k-L,presentationDelay:R-k,loadState:n(E.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(_=>{if(!_.longAnimationFrameEntries?.length)return;const E=_.interactionTime,w=_.inputDelay,C=_.processingDuration;let L,R,P=0,I=0,k=0,F=0;for(const k of _.longAnimationFrameEntries){I=I+k.startTime+k.duration-k.styleAndLayoutStart;for(const _ of k.scripts){const k=_.startTime+_.duration;if(k<E)continue;const $=k-Math.max(E,_.startTime),V=_.duration?$/_.duration*_.forcedStyleAndLayoutDuration:0;P+=$-V,I+=V,$>F&&(R=_.startTime<E+w?"input-delay":_.startTime>=E+w+C?"presentation-delay":"processing-duration",L=_,F=$)}}const $=_.longAnimationFrameEntries.at(-1),V=$?$.startTime+$.duration:0;V>=E+w+C&&(k=_.nextPaintTime-V),L&&R&&(_.longestScript={entry:L,subpart:R,intersectingDuration:F}),_.totalScriptDuration=P,_.totalStyleAndLayoutDuration=I,_.totalPaintDuration=k,_.totalUnattributedDuration=_.nextPaintTime-E-P-I-k})(H),Object.assign(_,{attribution:H})})(E))}),E)};class N{u(_){this.m?.(_)}}const Zr=[2500,4e3],Jr=[800,1800],U=_=>{document.prerendering?T((()=>U(_))):"complete"!==document.readyState?addEventListener("load",(()=>U(_)),!0):setTimeout(_)};var tn=class extends InstrumentationBase{constructor(_={}){super("@opentelemetry/browser-instrumentation/web-vitals",tr,_),this._applyCustomLogRecordData=_.applyCustomLogRecordData,this._includeRawAttribution=_.includeRawAttribution??!1}init(){return[]}enable(){"undefined"!=typeof PerformanceObserver?(this._isEnabled=!0,this._listenersRegistered?this._diag.debug("Listeners already registered, resuming emission"):(this._listenersRegistered=!0,this._diag.debug("Registering listeners"),((_,E={})=>{const w=s(E=Object.assign({},E),t),C=new WeakMap;w.t=_=>{if(_?.sources?.length){const w=S(_.sources),L=w?.node;if(L){const _=E.generateTarget?.(L)??i(L);C.set(w,_)}}},((_,E={})=>{const w=M();D(g((()=>{let C,L=h("CLS",0);const R=s(E,t),c=_=>{for(const E of _)R.u(E);R.o>L.value&&(L.value=R.o,L.entries=R.i,C())},P=m("layout-shift",c);P&&(C=f(_,L,qr,E.reportAllChanges),w.onHidden((()=>{c(P.takeRecords()),C(!0)})),u((()=>{R.o=0,L=h("CLS",0),C=f(_,L,qr,E.reportAllChanges),l(C)})),setTimeout(C))})))})((E=>{_((_=>{let E={};if(_.entries.length){const w=_.entries.reduce(((_,E)=>_.value>E.value?_:E));if(w?.sources?.length){const _=S(w.sources);_&&(E={largestShiftTarget:C.get(_),largestShiftTime:w.startTime,largestShiftValue:w.value,largestShiftSource:_,largestShiftEntry:w,loadState:n(w.startTime)})}}return Object.assign(_,{attribution:E})})(E))}),E)})((_=>this._emitWebVital(_))),x((_=>this._emitWebVital(_))),((_,E={})=>{const w=s(E=Object.assign({},E),N),C=new WeakMap;w.m=_=>{const w=_.element;if(w){const L=E.generateTarget?.(w)??i(w);C.set(_,L)}else _.id&&C.set(_,`#${_.id}`)},((_,E={})=>{T((()=>{const w=M();let C,L=h("LCP");const R=s(E,N),a=_=>{E.reportAllChanges||(_=_.slice(-1));for(const E of _)R.u(E),E.startTime<w.firstHiddenTime&&(L.value=Math.max(E.startTime-d(),0),L.entries=[E],C())},P=m("largest-contentful-paint",a);if(P){C=f(_,L,Zr,E.reportAllChanges);const w=g((()=>{a(P.takeRecords()),P.disconnect(),C(!0)})),r=_=>{_.isTrusted&&(W(w),removeEventListener(_.type,r,{capture:!0}))};for(const _ of["keydown","click","visibilitychange"])addEventListener(_,r,{capture:!0});u((w=>{L=h("LCP"),C=f(_,L,Zr,E.reportAllChanges),l((()=>{L.value=performance.now()-w.timeStamp,C(!0)}))}))}}))})((E=>{_((_=>{let E={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:_.value};if(_.entries.length){const w=_.entries.at(-1),L=w.url&&performance.getEntriesByType("resource").find((_=>_.name===w.url));E.target=C.get(w),E.lcpEntry=w,w.url&&(E.url=w.url),L&&(E.lcpResourceEntry=L);const R=e();if(R){const w=R.activationStart||0,C=Math.max(0,R.responseStart-w),P=Math.max(C,L?(L.requestStart||L.startTime)-w:0),I=Math.min(_.value,Math.max(P,L?L.responseEnd-w:0));E={...E,timeToFirstByte:C,resourceLoadDelay:P-C,resourceLoadDuration:I-P,elementRenderDelay:_.value-I,navigationEntry:R}}}return Object.assign(_,{attribution:E})})(E))}),E)})((_=>this._emitWebVital(_))),((_,E={})=>{D((E=>{_((_=>{let E={timeToFirstByte:0,firstByteToFCP:_.value,loadState:n(c())};if(_.entries.length){const w=e(),C=_.entries.at(-1);if(w){const L=w.activationStart||0,R=Math.max(0,w.responseStart-L);E={timeToFirstByte:R,firstByteToFCP:_.value-R,loadState:n(_.entries[0].startTime),navigationEntry:w,fcpEntry:C}}}return Object.assign(_,{attribution:E})})(E))}),E)})((_=>this._emitWebVital(_))),((_,E={})=>{((_,E={})=>{let w=h("TTFB"),C=f(_,w,Jr,E.reportAllChanges);U((()=>{const L=e();L&&(w.value=Math.max(L.responseStart-d(),0),w.entries=[L],C(!0),u((()=>{w=h("TTFB",0),C=f(_,w,Jr,E.reportAllChanges),C(!0)})))}))})((E=>{_((_=>{let E={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(_.entries.length){const w=_.entries[0],C=w.activationStart||0,L=Math.max((w.workerStart||w.fetchStart)-C,0),R=Math.max(w.domainLookupStart-C,0),P=Math.max(w.connectStart-C,0),I=Math.max(w.connectEnd-C,0);E={waitingDuration:L,cacheDuration:R-L,dnsDuration:P-R,connectionDuration:I-P,requestDuration:_.value-I,navigationEntry:w}}return Object.assign(_,{attribution:E})})(E))}),E)})((_=>this._emitWebVital(_))))):this._diag.debug("PerformanceObserver not supported, web vitals will not be collected")}disable(){this._isEnabled=!1,this._diag.debug("Instrumentation disabled, pausing emission")}_getTimestampForMetric(_){if("CLS"===_.name){const{attribution:E}=_;return void 0!==E.largestShiftTime?E.largestShiftTime:void 0}if("INP"===_.name){const{attribution:E}=_;return E.interactionTime}return _.value}_emitWebVital(_){if(!this._isEnabled)return;const E={[Dr]:_.name.toLowerCase(),[kr]:_.value,[Fr]:_.delta,[Mr]:_.rating,[Br]:_.id,[Ur]:_.navigationType},w=this._getTimestampForMetric(_),C={eventName:"browser.web_vital",severityNumber:R.INFO,attributes:E,...this._includeRawAttribution?{body:JSON.stringify(_.attribution)}:{},...void 0!==w?{timestamp:w}:{}};this._applyCustomLogRecordData&&safeExecuteInTheMiddle((()=>this._applyCustomLogRecordData?.(C)),(_=>{_&&this._diag.error("applyCustomLogRecordData hook failed",_)})),this.logger.emit(C)}};const en=createContextKey("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function sanitizeAttributes(_){const E={};if("object"!=typeof _||null==_)return E;for(const w in _){if(!Object.prototype.hasOwnProperty.call(_,w))continue;if(!isAttributeKey(w)){vt.warn(`Invalid attribute key: ${w}`);continue}const C=_[w];isAttributeValue(C)?Array.isArray(C)?E[w]=C.slice():E[w]=C:vt.warn(`Invalid attribute value set for key: ${w}`)}return E}function isAttributeKey(_){return"string"==typeof _&&""!==_}function isAttributeValue(_){return null==_||(Array.isArray(_)?function isHomogeneousAttributeValueArray(_){let E;for(const w of _){if(null==w)continue;const _=typeof w;if(_!==E){if(!E){if(isValidPrimitiveAttributeValueType(_)){E=_;continue}return!1}return!1}}return!0}(_):isValidPrimitiveAttributeValueType(typeof _))}function isValidPrimitiveAttributeValueType(_){switch(_){case"number":case"boolean":case"string":return!0}return!1}let rn=function loggingErrorHandler(){return _=>{vt.error(function stringifyException(_){return"string"==typeof _?_:JSON.stringify(function flattenException(_){const E={};let w=_;for(;null!==w;)Object.getOwnPropertyNames(w).forEach((_=>{if(E[_])return;const C=w[_];C&&(E[_]=String(C))})),w=Object.getPrototypeOf(w);return E}(_))}(_))}}();function globalErrorHandler(_){try{rn(_)}catch{}}const nn="process.runtime.name",sn={[se]:"opentelemetry",[nn]:"browser",[re]:ne,[ie]:"2.10.0"},on=performance,an=Math.pow(10,6),cn=Math.pow(10,9);function millisToHrTime(_){const E=_/1e3;return[Math.trunc(E),Math.round(_%1e3*an)]}function isTimeInputHrTime(_){return Array.isArray(_)&&2===_.length&&"number"==typeof _[0]&&"number"==typeof _[1]}function isTimeInput(_){return isTimeInputHrTime(_)||"number"==typeof _||_ instanceof Date}function addHrTimes(_,E){const w=[_[0]+E[0],_[1]+E[1]];return w[1]>=cn&&(w[1]-=cn,w[0]+=1),w}var un;!function(_){_[_.SUCCESS=0]="SUCCESS",_[_.FAILED=1]="FAILED"}(un||(un={}));const ln="[object Null]",dn="[object Undefined]",hn=Function.prototype.toString,pn=hn.call(Object),gn=Object.getPrototypeOf,mn=Object.prototype,fn=mn.hasOwnProperty,_n=Symbol?Symbol.toStringTag:void 0,bn=mn.toString;function isPlainObject(_){if(!function isObjectLike(_){return null!=_&&"object"==typeof _}(_)||"[object Object]"!==function baseGetTag(_){if(null==_)return void 0===_?dn:ln;return _n&&_n in Object(_)?function getRawTag(_){const E=fn.call(_,_n),w=_[_n];let C=!1;try{_[_n]=void 0,C=!0}catch{}const L=bn.call(_);C&&(E?_[_n]=w:delete _[_n]);return L}(_):function objectToString(_){return bn.call(_)}(_)}(_))return!1;const E=gn(_);if(null===E)return!0;const w=fn.call(E,"constructor")&&E.constructor;return"function"==typeof w&&w instanceof w&&hn.call(w)===pn}function takeValue(_){return isArray(_)?_.slice():_}function mergeTwoObjects(_,E,w=0,C){let L;if(!(w>20)){if(w++,isPrimitive(_)||isPrimitive(E)||isFunction(E))L=takeValue(E);else if(isArray(_)){if(L=_.slice(),isArray(E))for(let _=0,w=E.length;_<w;_++)L.push(takeValue(E[_]));else if(isObject(E)){const _=Object.keys(E);for(let w=0,C=_.length;w<C;w++){const C=_[w];"__proto__"!==C&&"constructor"!==C&&"prototype"!==C&&(L[C]=takeValue(E[C]))}}}else if(isObject(_))if(isObject(E)){if(!function shouldMerge(_,E){if(!isPlainObject(_)||!isPlainObject(E))return!1;return!0}(_,E))return E;L=Object.assign({},_);const R=Object.keys(E);for(let P=0,I=R.length;P<I;P++){const I=R[P];if("__proto__"===I||"constructor"===I||"prototype"===I)continue;const k=E[I];if(isPrimitive(k))void 0===k?delete L[I]:L[I]=k;else{const R=L[I],P=k;if(wasObjectReferenced(_,I,C)||wasObjectReferenced(E,I,C))delete L[I];else{if(isObject(R)&&isObject(P)){const w=C.get(R)||[],L=C.get(P)||[];w.push({obj:_,key:I}),L.push({obj:E,key:I}),C.set(R,w),C.set(P,L)}L[I]=mergeTwoObjects(L[I],k,w,C)}}}}else L=E;return L}}function wasObjectReferenced(_,E,w){const C=w.get(_[E])||[];for(let w=0,L=C.length;w<L;w++){const L=C[w];if(L.key===E&&L.obj===_)return!0}return!1}function isArray(_){return Array.isArray(_)}function isFunction(_){return"function"==typeof _}function isObject(_){return!isPrimitive(_)&&!isArray(_)&&!isFunction(_)&&"object"==typeof _}function isPrimitive(_){return"string"==typeof _||"number"==typeof _||"boolean"==typeof _||void 0===_||_ instanceof Date||_ instanceof RegExp||null===_}class Deferred{constructor(){this._promise=new Promise(((_,E)=>{this._resolve=_,this._reject=E}))}get promise(){return this._promise}resolve(_){this._resolve(_)}reject(_){this._reject(_)}}class BindOnceFuture{constructor(_,E){this._isCalled=!1,this._deferred=new Deferred,this._callback=_,this._that=E}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(..._){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,..._)).then((_=>this._deferred.resolve(_)),(_=>this._deferred.reject(_)))}catch(_){this._deferred.reject(_)}}return this._deferred.promise}}let yn;function defaultServiceName(){if(void 0===yn)try{const _=globalThis.process.argv0;yn=_?`unknown_service:${_}`:"unknown_service"}catch{yn="unknown_service"}return yn}const isPromiseLike=_=>null!==_&&"object"==typeof _&&"function"==typeof _.then;class ResourceImpl{static FromAttributeList(_,E){const w=new ResourceImpl({},E);return w._rawAttributes=guardedRawAttributes(_),w._asyncAttributesPending=_.filter((([_,E])=>isPromiseLike(E))).length>0,w}constructor(_,E){this._asyncAttributesPending=!1;const w=_.attributes??{};this._rawAttributes=Object.entries(w).map((([_,E])=>(isPromiseLike(E)&&(this._asyncAttributesPending=!0),[_,E]))),this._rawAttributes=guardedRawAttributes(this._rawAttributes),this._schemaUrl=function validateSchemaUrl(_){if("string"==typeof _||void 0===_)return _;return void vt.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",_)}(E?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let _=0;_<this._rawAttributes.length;_++){const[E,w]=this._rawAttributes[_];this._rawAttributes[_]=[E,isPromiseLike(w)?await w:w]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&vt.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const _={};for(const[E,w]of this._rawAttributes)isPromiseLike(w)?vt.debug(`Unsettled resource attribute ${E} skipped`):null!=w&&(_[E]??(_[E]=w));return this._asyncAttributesPending||(this._memoizedAttributes=_),_}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(_){if(null==_)return this;const E=function mergeSchemaUrl(_,E){const w=_?.schemaUrl,C=E?.schemaUrl,L=void 0===w||""===w,R=void 0===C||""===C;if(L)return C;if(R)return w;if(w===C)return w;return void vt.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',w,C)}(this,_),w=E?{schemaUrl:E}:void 0;return ResourceImpl.FromAttributeList([..._.getRawAttributes(),...this.getRawAttributes()],w)}}function defaultResource(){return function resourceFromAttributes(_,E){return ResourceImpl.FromAttributeList(Object.entries(_),E)}({[ee]:defaultServiceName(),[re]:sn[re],[se]:sn[se],[ie]:sn[ie]})}function guardedRawAttributes(_){return _.map((([_,E])=>isPromiseLike(E)?[_,E.catch((E=>{vt.debug("promise rejection for resource attribute: %s - %s",_,E)}))]:[_,E]))}const Sn=Symbol.for("nodejs.util.inspect.custom");function settledResourceAttributes(_){const E={};for(const[w,C]of _.getRawAttributes())"function"!=typeof C?.then&&null!=C&&(E[w]??(E[w]=C));return E}function formatInspect(_,E,w,C,L){if("number"==typeof w&&w<0){const E=`[${_}]`;return C?.stylize?C.stylize(E,"special"):E}if("function"!=typeof L||!C)return E;return`${_} ${L(E,{...C,depth:null==C.depth?C.depth:C.depth-1})}`}class SpanImpl{constructor(_){this.attributes={},this.links=[],this.events=[],this._droppedAttributesCount=0,this._droppedEventsCount=0,this._droppedLinksCount=0,this._attributesCount=0,this.status={code:Et.UNSET},this.endTime=[0,0],this._ended=!1,this._duration=[-1,-1];const E=Date.now();if(this._spanContext=_.spanContext,this._performanceStartTime=on.now(),this._performanceOffset=E-(this._performanceStartTime+on.timeOrigin),this._startTimeProvided=null!=_.startTime,this._spanLimits=_.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=_.spanProcessor,this.name=_.name,this.parentSpanContext=_.parentSpanContext,this.kind=_.kind,_.links)for(const E of _.links)this.addLink(E);this.startTime=this._getTime(_.startTime??E),this.resource=_.resource,this.instrumentationScope=_.scope,this._recordEndMetrics=_.recordEndMetrics,null!=_.attributes&&this.setAttributes(_.attributes),this._spanProcessor.onStart(this,_.context)}spanContext(){return this._spanContext}setAttribute(_,E){if(null==E||this._isSpanEnded())return this;if(0===_.length)return vt.warn(`Invalid attribute key: ${_}`),this;if(!isAttributeValue(E))return vt.warn(`Invalid attribute value set for key: ${_}`),this;const{attributeCountLimit:w}=this._spanLimits,C=!Object.prototype.hasOwnProperty.call(this.attributes,_);return void 0!==w&&this._attributesCount>=w&&C?(this._droppedAttributesCount++,this):(this.attributes[_]=this._truncateToSize(E),C&&this._attributesCount++,this)}setAttributes(_){for(const E in _)Object.prototype.hasOwnProperty.call(_,E)&&this.setAttribute(E,_[E]);return this}addEvent(_,E,w){if(this._isSpanEnded())return this;const{eventCountLimit:C}=this._spanLimits;if(0===C)return vt.warn("No events allowed."),this._droppedEventsCount++,this;void 0!==C&&this.events.length>=C&&(0===this._droppedEventsCount&&vt.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),isTimeInput(E)&&(isTimeInput(w)||(w=E),E=void 0);const L=sanitizeAttributes(E),{attributePerEventCountLimit:R}=this._spanLimits,P={};let I=0,k=0;for(const _ in L){if(!Object.prototype.hasOwnProperty.call(L,_))continue;const E=L[_];void 0!==R&&k>=R?I++:(P[_]=this._truncateToSize(E),k++)}return this.events.push({name:_,attributes:P,time:this._getTime(w),droppedAttributesCount:I}),this}addLink(_){if(this._isSpanEnded())return this;const{linkCountLimit:E}=this._spanLimits;if(0===E)return this._droppedLinksCount++,this;void 0!==E&&this.links.length>=E&&(0===this._droppedLinksCount&&vt.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);const{attributePerLinkCountLimit:w}=this._spanLimits,C=sanitizeAttributes(_.attributes),L={};let R=0,P=0;for(const _ in C){if(!Object.prototype.hasOwnProperty.call(C,_))continue;const E=C[_];void 0!==w&&P>=w?R++:(L[_]=this._truncateToSize(E),P++)}const I={context:_.context};return P>0&&(I.attributes=L),R>0&&(I.droppedAttributesCount=R),this.links.push(I),this}addLinks(_){for(const E of _)this.addLink(E);return this}setStatus(_){if(this._isSpanEnded())return this;if(_.code===Et.UNSET)return this;if(this.status.code===Et.OK)return this;const E={code:_.code};return _.code===Et.ERROR&&("string"==typeof _.message?E.message=_.message:null!=_.message&&vt.warn(`Dropping invalid status.message of type '${typeof _.message}', expected 'string'`)),this.status=E,this}updateName(_){return this._isSpanEnded()||(this.name=_),this}end(_){this._isSpanEnded()?vt.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(_),this._duration=function hrTimeDuration(_,E){let w=E[0]-_[0],C=E[1]-_[1];return C<0&&(w-=1,C+=cn),[w,C]}(this.startTime,this.endTime),this._duration[0]<0&&(vt.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&vt.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&vt.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(_){if("number"==typeof _&&_<=on.now())return function hrTime(_){return addHrTimes(millisToHrTime(on.timeOrigin),millisToHrTime("number"==typeof _?_:on.now()))}(_+this._performanceOffset);if("number"==typeof _)return millisToHrTime(_);if(_ instanceof Date)return millisToHrTime(_.getTime());if(isTimeInputHrTime(_))return _;if(this._startTimeProvided)return millisToHrTime(Date.now());const E=on.now()-this._performanceStartTime;return addHrTimes(this.startTime,millisToHrTime(E))}isRecording(){return!1===this._ended}recordException(_,E){const w={};"string"==typeof _?w[Wt]=_:_&&(_.code?w[Qt]=_.code.toString():_.name&&(w[Qt]=_.name),_.message&&(w[Wt]=_.message),_.stack&&(w[Kt]=_.stack)),w[Qt]||w[Wt]?this.addEvent("exception",w,E):vt.warn(`Failed to record an exception ${_}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const _=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);vt.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,_)}return this._ended}_truncateToLimitUtil(_,E){return _.length<=E?_:_.substring(0,E)}_truncateToSize(_){const E=this._attributeValueLengthLimit;return E<=0?(vt.warn(`Attribute value limit must be positive, got ${E}`),_):"string"==typeof _?this._truncateToLimitUtil(_,E):Array.isArray(_)?_.map((_=>"string"==typeof _?this._truncateToLimitUtil(_,E):_)):_}[Sn](_,E,w){return formatInspect("SpanImpl",{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:settledResourceAttributes(this.resource)}},_,E,w)}}var En;!function(_){_[_.NOT_RECORD=0]="NOT_RECORD",_[_.RECORD=1]="RECORD",_[_.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(En||(En={}));const Tn="otel.component.name",vn="otel.component.type",wn="otel.span.parent.origin",An="otel.span.sampling_result";class TracerMetrics{constructor(_){this.startedSpans=_.createCounter("otel.sdk.span.started",{unit:"{span}",description:"The number of created spans."}),this.liveSpans=_.createUpDownCounter("otel.sdk.span.live",{unit:"{span}",description:"The number of currently live spans."})}startSpan(_,E){const w=function samplingDecisionToString(_){switch(_){case En.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case En.RECORD:return"RECORD_ONLY";case En.NOT_RECORD:return"DROP"}}(E);if(this.startedSpans.add(1,{[wn]:parentOrigin(_),[An]:w}),E===En.NOT_RECORD)return()=>{};const C={[An]:w};return this.liveSpans.add(1,C),()=>{this.liveSpans.add(-1,C)}}}function parentOrigin(_){return _?_.isRemote?"remote":"local":"none"}class Tracer{constructor(_,E){this.instrumentationScope=_,this._sampler=E.sampler,this._spanLimits=E.spanLimits,this._resource=E.resource,this._idGenerator=E.idGenerator,this._spanProcessor=E.spanProcessor;const w=E.meterProvider.getMeter("@opentelemetry/sdk-trace","2.10.0");this._tracerMetrics=new TracerMetrics(w)}startSpan(_,E={},w=Tt.active()){E.root&&(w=It.deleteSpan(w));const C=It.getSpan(w);if(function isTracingSuppressed(_){return!0===_.getValue(en)}(w)){vt.debug("Instrumentation suppressed, returning Noop Span");return It.wrapSpanContext(pt)}const L=C?.spanContext(),R=this._idGenerator.generateSpanId();let P,I,k;L&&It.isSpanContextValid(L)?(I=L.traceId,k=L.traceState,P=L):I=this._idGenerator.generateTraceId();const F=E.kind??St.INTERNAL,$=(E.links??[]).map((_=>({context:_.context,attributes:sanitizeAttributes(_.attributes)}))),V=sanitizeAttributes(E.attributes),H=this._sampler.shouldSample(w,I,_,F,V,$),j=this._tracerMetrics.startSpan(L,H.decision);k=H.traceState??k;const z={traceId:I,spanId:R,traceFlags:H.decision===yt.RECORD_AND_SAMPLED?lt.SAMPLED:lt.NONE,traceState:k};if(H.decision===yt.NOT_RECORD){vt.debug("Recording is off, propagating context in a non-recording span");return It.wrapSpanContext(z)}const q=sanitizeAttributes(Object.assign(V,H.attributes));return new SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:w,spanContext:z,name:_,kind:F,links:$,parentSpanContext:P,attributes:q,startTime:E.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:j})}startActiveSpan(_,E,w,C){let L,R,P;if(arguments.length<2)return;2===arguments.length?P=E:3===arguments.length?(L=E,P=w):(L=E,R=w,P=C);const I=R??Tt.active(),k=this.startSpan(_,L,I),F=It.setSpan(I,k);return Tt.with(F,P,void 0,k)}[Sn](_,E,w){return formatInspect("Tracer",{instrumentationScope:this.instrumentationScope,resource:{attributes:settledResourceAttributes(this._resource)},spanLimits:this._spanLimits},_,E,w)}}class MultiSpanProcessor{constructor(_){this._spanProcessors=_}forceFlush(){const _=[];for(const E of this._spanProcessors)_.push(E.forceFlush());return new Promise((E=>{Promise.all(_).then((()=>{E()})).catch((_=>{globalErrorHandler(_||new Error("MultiSpanProcessor: forceFlush failed")),E()}))}))}onStart(_,E){for(const w of this._spanProcessors)w.onStart(_,E)}onEnding(_){for(const E of this._spanProcessors)E.onEnding&&E.onEnding(_)}onEnd(_){for(const E of this._spanProcessors)E.onEnd(_)}shutdown(){const _=[];for(const E of this._spanProcessors)_.push(E.shutdown());return new Promise(((E,w)=>{Promise.all(_).then((()=>{E()}),w)}))}}class AlwaysOffSampler{shouldSample(){return{decision:En.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class AlwaysOnSampler{shouldSample(){return{decision:En.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class ParentBasedSampler{constructor(_){this._root=_.root,this._root||(globalErrorHandler(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new AlwaysOnSampler),this._remoteParentSampled=_.remoteParentSampled??new AlwaysOnSampler,this._remoteParentNotSampled=_.remoteParentNotSampled??new AlwaysOffSampler,this._localParentSampled=_.localParentSampled??new AlwaysOnSampler,this._localParentNotSampled=_.localParentNotSampled??new AlwaysOffSampler}shouldSample(_,E,w,C,L,R){const P=It.getSpanContext(_);return P&&isSpanContextValid(P)?P.isRemote?P.traceFlags&lt.SAMPLED?this._remoteParentSampled.shouldSample(_,E,w,C,L,R):this._remoteParentNotSampled.shouldSample(_,E,w,C,L,R):P.traceFlags&lt.SAMPLED?this._localParentSampled.shouldSample(_,E,w,C,L,R):this._localParentNotSampled.shouldSample(_,E,w,C,L,R):this._root.shouldSample(_,E,w,C,L,R)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}const Cn=new Map;class SpanProcessorMetrics{constructor(_,E,w){const C=Cn.get(_)??0;if(Cn.set(_,C+1),this.standardAttrs={[vn]:_,[Tn]:`${_}/${C}`},this.droppedAttrs={...this.standardAttrs,[Gt]:"queue_full"},this.processedSpans=E.createCounter("otel.sdk.processor.span.processed",{unit:"{span}",description:"The number of spans for which the processing has finished, either successful or failed."}),w){const{capacity:_,getQueueSize:C}=w;E.createUpDownCounter("otel.sdk.processor.span.queue.capacity",{unit:"{span}",description:"The maximum number of spans the queue of a given instance of an SDK span processor can hold."}).add(_,this.standardAttrs),this.queueSize=E.createObservableUpDownCounter("otel.sdk.processor.span.queue.size",{unit:"{span}",description:"The number of spans in the queue of a given instance of an SDK span processor."}),this.queueSizeCallback=_=>_.observe(C(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(_){this.processedSpans.add(_,this.droppedAttrs)}finishSpans(_,E){if(!E)return void this.processedSpans.add(_,this.standardAttrs);const w={...this.standardAttrs,[Gt]:E.name};this.processedSpans.add(_,w)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}class BatchSpanProcessorBase{constructor(_){this._isExporting=!1,this._finishedSpans=[],this._droppedSpansCount=0,this._exporter=_.exporter,this._maxExportBatchSize=_.maxExportBatchSize??512,this._maxQueueSize=_.maxQueueSize??2048,this._scheduledDelayMillis=_.scheduledDelayMillis??5e3,this._exportTimeoutMillis=_.exportTimeoutMillis??3e4,this._shutdownOnce=new BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(vt.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);const E=_.selfObsMeterProvider?_.selfObsMeterProvider.getMeter("@opentelemetry/sdk-trace"):createNoopMeter();this._metrics=new SpanProcessorMetrics("batching_span_processor",E,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(_,E){}onEnd(_){this._shutdownOnce.isCalled||_.spanContext().traceFlags&lt.SAMPLED&&this._addToBuffer(_)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then((()=>this.onShutdown())).then((()=>this._flushAll())).then((()=>(this._metrics.shutdown(),this._exporter.shutdown())))}_addToBuffer(_){if(this._finishedSpans.length>=this._maxQueueSize)return 0===this._droppedSpansCount&&vt.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++,void this._metrics.dropSpans(1);this._droppedSpansCount>0&&(vt.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(_),this._maybeStartTimer()}_flushAll(){return new Promise(((_,E)=>{const w=[];for(let _=0,E=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);_<E;_++)w.push(this._flushOneBatch());Promise.all(w).then((()=>{_()})).catch(E)}))}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise(((_,E)=>{const w=setTimeout((()=>{E(new Error("Timeout"))}),this._exportTimeoutMillis);Tt.with(function suppressTracing(_){return _.setValue(en,!0)}(Tt.active()),(()=>{let C;this._finishedSpans.length<=this._maxExportBatchSize?(C=this._finishedSpans,this._finishedSpans=[]):C=this._finishedSpans.splice(0,this._maxExportBatchSize);const doExport=()=>this._exporter.export(C,(L=>{clearTimeout(w),this._metrics.finishSpans(C.length,L.error),L.code===un.SUCCESS?_():E(L.error??new Error("BatchSpanProcessor: span export failed"))}));let L=null;for(let _=0,E=C.length;_<E;_++){const E=C[_];E.resource.asyncAttributesPending&&E.resource.waitForAsyncAttributes&&(L??(L=[]),L.push(E.resource.waitForAsyncAttributes()))}null===L?doExport():Promise.all(L).then(doExport,(_=>{globalErrorHandler(_),E(_)}))}))}))}_maybeStartTimer(){if(this._isExporting)return;const flush=()=>{this._isExporting=!0,this._flushOneBatch().finally((()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())})).catch((_=>{this._isExporting=!1,globalErrorHandler(_)}))};if(this._finishedSpans.length>=this._maxExportBatchSize)return flush();void 0===this._timer&&(this._timer=setTimeout((()=>flush()),this._scheduledDelayMillis),"number"!=typeof this._timer&&this._timer.unref())}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}let Ln=class BatchSpanProcessor extends BatchSpanProcessorBase{constructor(_){super(_),this.onInit(_)}onInit(_){!0!==_.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch((_=>{globalErrorHandler(_)}))},this._pageHideListener=()=>{this.forceFlush().catch((_=>{globalErrorHandler(_)}))},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}};const Rn=new Uint8Array(16),Pn=new Uint8Array(8),On=Array.from({length:256},((_,E)=>E.toString(16).padStart(2,"0")));function randomFill(_){for(let E=0;E<_.length;E++)_[E]=256*Math.random()>>>0;for(let E=0;E<_.length;E++)if(_[E]>0)return;_[_.length-1]=1}function toHex(_){let E="";for(let w=0;w<_.length;w++)E+=On[_[w]];return E}class RandomIdGenerator{generateTraceId(){return randomFill(Rn),toHex(Rn)}generateSpanId(){return randomFill(Pn),toHex(Pn)}}var xn,In;!function(_){_[_.resolved=0]="resolved",_[_.timeout=1]="timeout",_[_.error=2]="error",_[_.unresolved=3]="unresolved"}(xn||(xn={}));class TracerProvider{constructor(_={}){this._tracers=new Map,this._forceFlushTimeoutMillis=_.forceFlushTimeoutMillis??3e4,this._resource=_.resource??defaultResource();const E=_.spanProcessors??[];this._activeSpanProcessor=new MultiSpanProcessor(E),this._tracerOptions={resource:this._resource,sampler:_.sampler??new ParentBasedSampler({root:new AlwaysOnSampler}),spanLimits:{attributeCountLimit:_.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:_.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:_.spanLimits?.eventCountLimit??128,linkCountLimit:_.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:_.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:_.spanLimits?.attributePerLinkCountLimit??128},idGenerator:_.idGenerator||new RandomIdGenerator,spanProcessor:this._activeSpanProcessor,meterProvider:_.meterProvider??{getMeter:()=>createNoopMeter()}}}getTracer(_,E,w){const C=`${_}@${E||""}:${w?.schemaUrl||""}`;return this._tracers.has(C)||this._tracers.set(C,new Tracer({name:_,version:E,schemaUrl:w?.schemaUrl},this._tracerOptions)),this._tracers.get(C)}forceFlush(){const _=this._forceFlushTimeoutMillis,E=this._activeSpanProcessor._spanProcessors.map((E=>new Promise((w=>{let C;const L=setTimeout((()=>{w(new Error(`Span processor did not completed within timeout period of ${_} ms`)),C=xn.timeout}),_);E.forceFlush().then((()=>{clearTimeout(L),C!==xn.timeout&&(C=xn.resolved,w(C))})).catch((_=>{clearTimeout(L),C=xn.error,w(_)}))}))));return new Promise(((_,w)=>{Promise.all(E).then((E=>{const C=E.filter((_=>_!==xn.resolved));C.length>0?w(C):_()})).catch((_=>w([_])))}))}shutdown(){return this._activeSpanProcessor.shutdown()}[Sn](_,E,w){const C=this._activeSpanProcessor._spanProcessors,L={resource:{attributes:settledResourceAttributes(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:C.map((_=>_.constructor?.name??"SpanProcessor"))};return formatInspect("TracerProvider",L,_,E,w)}}class TraceIdRatioBasedSampler{constructor(_=0){this._ratio=this._normalize(_),this._upperBound=1===this._ratio?4294967296:Math.floor(4294967295*this._ratio)}shouldSample(_,E){return{decision:isValidTraceId(E)&&this._accumulate(E)<this._upperBound?En.RECORD_AND_SAMPLED:En.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(_){return"number"!=typeof _||isNaN(_)?0:_>=1?1:_<=0?0:_}_accumulate(_){let E=0;for(let w=0;w<32;w+=8){let C=0;for(let E=0;E<8;E++){const L=_.charCodeAt(w+E);C=C<<4|(L<58?L-48:L<71?L-55:L-87)}E=(E^C)>>>0}return E}}!function(_){_.AlwaysOff="always_off",_.AlwaysOn="always_on",_.ParentBasedAlwaysOff="parentbased_always_off",_.ParentBasedAlwaysOn="parentbased_always_on",_.ParentBasedTraceIdRatio="parentbased_traceidratio",_.TraceIdRatio="traceidratio"}(In||(In={}));function buildSamplerFromEnv(){const _=In.ParentBasedAlwaysOn;switch(_){case In.AlwaysOn:return new AlwaysOnSampler;case In.AlwaysOff:return new AlwaysOffSampler;case In.ParentBasedAlwaysOn:return new ParentBasedSampler({root:new AlwaysOnSampler});case In.ParentBasedAlwaysOff:return new ParentBasedSampler({root:new AlwaysOffSampler});case In.TraceIdRatio:return new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv());case In.ParentBasedTraceIdRatio:return new ParentBasedSampler({root:new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv())});default:return vt.error(`OTEL_TRACES_SAMPLER value "${_}" invalid, defaulting to "${In.ParentBasedAlwaysOn}".`),new ParentBasedSampler({root:new AlwaysOnSampler})}}function getSamplerProbabilityFromEnv(){return vt.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."),1}const Nn=1/0;class BasicTracerProvider extends TracerProvider{constructor(_={}){const E=function merge(..._){let E=_.shift();const w=new WeakMap;for(;_.length>0;)E=mergeTwoObjects(E,_.shift(),0,w);return E}({},function loadDefaultConfig(){return{sampler:buildSamplerFromEnv(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}(),function reconfigureLimits(_){const E=Object.assign({},_.spanLimits);return E.attributeCountLimit=_.spanLimits?.attributeCountLimit??_.generalLimits?.attributeCountLimit??void 0??void 0??128,E.attributeValueLengthLimit=_.spanLimits?.attributeValueLengthLimit??_.generalLimits?.attributeValueLengthLimit??void 0??void 0??Nn,Object.assign({},_,{spanLimits:E})}(_));delete E.generalLimits,super(E)}}class BatchSpanProcessor extends Ln{constructor(_,E){E||(E={});const w=[["maxExportBatchSize","OTEL_BSP_MAX_EXPORT_BATCH_SIZE"],["maxQueueSize","OTEL_BSP_MAX_QUEUE_SIZE"],["scheduledDelayMillis","OTEL_BSP_SCHEDULE_DELAY"],["exportTimeoutMillis","OTEL_BSP_EXPORT_TIMEOUT"]];for(const[_,C]of w)E[_];super({exporter:_,...E})}}class StackContextManager{constructor(){this._enabled=!1,this._currentContext=Y}_bindFunction(_=Y,E){const w=this,contextWrapper=function(...C){return w.with(_,(()=>E.apply(this,C)))};return Object.defineProperty(contextWrapper,"length",{enumerable:!1,configurable:!0,writable:!1,value:E.length}),contextWrapper}active(){return this._currentContext}bind(_,E){return void 0===_&&(_=this.active()),"function"==typeof E?this._bindFunction(_,E):E}disable(){return this._currentContext=Y,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=Y),this}with(_,E,w,...C){const L=this._currentContext;this._currentContext=_||Y;try{return E.call(w,...C)}finally{this._currentContext=L}}}class WebTracerProvider extends BasicTracerProvider{constructor(_={}){super(_)}register(_={}){It.setGlobalTracerProvider(this),function setupPropagator(_){null!==_&&(void 0!==_?Ot.setGlobalPropagator(_):Ot.setGlobalPropagator(new CompositePropagator({propagators:[new W3CTraceContextPropagator,new W3CBaggagePropagator]})))}(_.propagator),function setupContextManager(_){if(null!==_){if(void 0===_){const _=new StackContextManager;return _.enable(),void Tt.setGlobalContextManager(_)}_.enable(),Tt.setGlobalContextManager(_)}}(_.contextManager)}}var Dn;!function(_){_.CONNECT_END="connectEnd",_.CONNECT_START="connectStart",_.DECODED_BODY_SIZE="decodedBodySize",_.DOM_COMPLETE="domComplete",_.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",_.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",_.DOM_INTERACTIVE="domInteractive",_.DOMAIN_LOOKUP_END="domainLookupEnd",_.DOMAIN_LOOKUP_START="domainLookupStart",_.ENCODED_BODY_SIZE="encodedBodySize",_.FETCH_START="fetchStart",_.LOAD_EVENT_END="loadEventEnd",_.LOAD_EVENT_START="loadEventStart",_.NAVIGATION_START="navigationStart",_.REDIRECT_END="redirectEnd",_.REDIRECT_START="redirectStart",_.REQUEST_START="requestStart",_.RESPONSE_END="responseEnd",_.RESPONSE_START="responseStart",_.SECURE_CONNECTION_START="secureConnectionStart",_.START_TIME="startTime",_.UNLOAD_EVENT_END="unloadEventEnd",_.UNLOAD_EVENT_START="unloadEventStart"}(Dn||(Dn={}));let kn;function addSpanNetworkEvent$1(_,E,w,C=!0){if(function hasKey$1(_,E){return E in _}(w,E)&&"number"==typeof w[E]&&(!C||0!==w[E]))return _.addEvent(E,w[E])}function addSpanNetworkEvents$1(_,E,w=!1,C,L){if(void 0===C&&(C=0!==E[Dn.START_TIME]),w||(addSpanNetworkEvent$1(_,Dn.FETCH_START,E,C),addSpanNetworkEvent$1(_,Dn.DOMAIN_LOOKUP_START,E,C),addSpanNetworkEvent$1(_,Dn.DOMAIN_LOOKUP_END,E,C),addSpanNetworkEvent$1(_,Dn.CONNECT_START,E,C),addSpanNetworkEvent$1(_,Dn.SECURE_CONNECTION_START,E,C),addSpanNetworkEvent$1(_,Dn.CONNECT_END,E,C),addSpanNetworkEvent$1(_,Dn.REQUEST_START,E,C),addSpanNetworkEvent$1(_,Dn.RESPONSE_START,E,C),addSpanNetworkEvent$1(_,Dn.RESPONSE_END,E,C)),!L){const w=E[Dn.ENCODED_BODY_SIZE];void 0!==w&&_.setAttribute("http.response_content_length",w);const C=E[Dn.DECODED_BODY_SIZE];void 0!==C&&w!==C&&_.setAttribute("http.response_content_length_uncompressed",C)}}function getOrigin(){return"undefined"!=typeof location?location.origin:void 0}function getResource(_,E,w,C,L=new WeakSet,R){const P=parseUrl(_),I=function filterResourcesForSpan(_,E,w,C,L,R){const P=hrTimeToNanoseconds(E),I=hrTimeToNanoseconds(w);let k=C.filter((E=>{const w=hrTimeToNanoseconds(timeInputToHrTime(E[Dn.FETCH_START])),C=hrTimeToNanoseconds(timeInputToHrTime(E[Dn.RESPONSE_END]));return E.initiatorType.toLowerCase()===(R||"xmlhttprequest")&&E.name===_&&w>=P&&C<=I}));k.length>0&&(k=k.filter((_=>!L.has(_))));return k}(_=P.toString(),E,w,C,L,R);if(0===I.length)return{mainRequest:void 0};if(1===I.length)return{mainRequest:I[0]};const k=function sortResources(_){return _.slice().sort(((_,E)=>{const w=_[Dn.FETCH_START],C=E[Dn.FETCH_START];return w>C?1:w<C?-1:0}))}(I);if(P.origin!==getOrigin()&&k.length>1){let _=k[0],E=function findMainRequest(_,E,w){const C=hrTimeToNanoseconds(w),L=hrTimeToNanoseconds(timeInputToHrTime(E));let R,P=_[1];const I=_.length;for(let E=1;E<I;E++){const w=_[E],I=hrTimeToNanoseconds(timeInputToHrTime(w[Dn.FETCH_START])),k=C-hrTimeToNanoseconds(timeInputToHrTime(w[Dn.RESPONSE_END]));I>=L&&(!R||k<R)&&(R=k,P=w)}return P}(k,_[Dn.RESPONSE_END],w);const C=_[Dn.RESPONSE_END];return E[Dn.FETCH_START]<C&&(E=_,_=void 0),{corsPreFlightRequest:_,mainRequest:E}}return{mainRequest:I[0]}}function parseUrl(_){if("function"==typeof URL)return new URL(_,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0);const E=function getUrlNormalizingAnchor(){return kn||(kn=document.createElement("a")),kn}();return E.href=_,E}function shouldPropagateTraceHeaders(_,E){let w=E||[];("string"==typeof w||w instanceof RegExp)&&(w=[w]);return parseUrl(_).origin===getOrigin()||w.some((E=>urlMatches(_,E)))}var Mn;!function(_){_.METHOD_OPEN="open",_.METHOD_SEND="send",_.EVENT_ABORT="abort",_.EVENT_ERROR="error",_.EVENT_LOAD="loaded",_.EVENT_TIMEOUT="timeout"}(Mn||(Mn={}));const Fn=vt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function getXHRBodyLength$1(_){return function isDocument$1(_){return"undefined"!=typeof Document&&_ instanceof Document}(_)?(new XMLSerializer).serializeToString(document).length:"string"==typeof _?getByteLength$1(_):_ instanceof Blob?_.size:_ instanceof FormData?function getFormDataSize$1(_){let E=0;for(const[w,C]of _.entries())E+=w.length,C instanceof Blob?E+=C.size:E+=C.length;return E}(_):_ instanceof URLSearchParams?getByteLength$1(_.toString()):void 0!==_.byteLength?_.byteLength:void Fn.warn("unknown body type")}const Bn=new TextEncoder;function getByteLength$1(_){return Bn.encode(_).byteLength}function normalizeHttpRequestMethod$1(_){const E=function getKnownMethods$1(){void 0===$n&&($n=Un);return $n}(),w=_.toUpperCase();return w in E?w:"_OTHER"}const Un={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let $n;const Vn={"https:":"443","http:":"80"};const Hn="0.220.0";var jn;(jn||(jn={})).HTTP_STATUS_TEXT="http.status_text";class XMLHttpRequestInstrumentation extends InstrumentationBase{constructor(_={}){super("@opentelemetry/instrumentation-xml-http-request",Hn,_),this.component="xml-http-request",this.version=Hn,this.moduleName=this.component,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet,this._semconvStability=semconvStabilityFromStr("http",_?.semconvStabilityOptIn)}init(){}_addHeaders(_,E){if(!shouldPropagateTraceHeaders(parseUrl(E).href,this.getConfig().propagateTraceHeaderCorsUrls)){const _={};return Ot.inject(Tt.active(),_),void(Object.keys(_).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}const w={};Ot.inject(Tt.active(),w),Object.keys(w).forEach((E=>{_.setRequestHeader(E,String(w[E]))}))}_addChildSpan(_,E){Tt.with(It.setSpan(Tt.active(),_),(()=>{const _=this.tracer.startSpan("CORS Preflight",{startTime:E[Dn.FETCH_START]}),w=!(this._semconvStability&Je.OLD);addSpanNetworkEvents$1(_,E,this.getConfig().ignoreNetworkEvents,void 0,w),_.end(E[Dn.RESPONSE_END])}))}_addFinalSpanAttributes(_,E,w){if(this._semconvStability&Je.OLD){if(void 0!==E.status&&_.setAttribute("http.status_code",E.status),void 0!==E.statusText&&_.setAttribute(jn.HTTP_STATUS_TEXT,E.statusText),"string"==typeof w){const E=parseUrl(w);_.setAttribute("http.host",E.host),_.setAttribute("http.scheme",E.protocol.replace(":",""))}_.setAttribute("http.user_agent",navigator.userAgent)}this._semconvStability&Je.STABLE&&E.status&&_.setAttribute(Zt,E.status)}_applyAttributesAfterXHR(_,E){const w=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof w&&safeExecuteInTheMiddle((()=>w(_,E)),(_=>{_&&this._diag.error("applyCustomAttributesOnSpan",_)}))}_addResourceObserver(_,E){const w=this._xhrMem.get(_);w&&"function"==typeof PerformanceObserver&&"function"==typeof PerformanceResourceTiming&&(w.createdResources={observer:new PerformanceObserver((_=>{const C=_.getEntries(),L=parseUrl(E);C.forEach((_=>{"xmlhttprequest"===_.initiatorType&&_.name===L.href&&w.createdResources&&w.createdResources.entries.push(_)}))})),entries:[]},w.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(ue.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(_,E,w,C,L){if(!(w&&C&&L&&_.createdResources))return;let R=_.createdResources.entries;R&&R.length||(R=ue.getEntriesByType("resource"));const P=getResource(parseUrl(w).href,C,L,R,this._usedResources);if(P.mainRequest){const _=P.mainRequest;this._markResourceAsUsed(_);const w=P.corsPreFlightRequest;w&&(this._addChildSpan(E,w),this._markResourceAsUsed(w));const C=!(this._semconvStability&Je.OLD);addSpanNetworkEvents$1(E,_,this.getConfig().ignoreNetworkEvents,void 0,C)}}_cleanPreviousSpanInformation(_){const E=this._xhrMem.get(_);if(E){const w=E.callbackToRemoveEvents;w&&w(),this._xhrMem.delete(_)}}_createSpan(_,E,w){const C=parseUrl(E);if(isUrlIgnored(C.href,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");let L="";const R={};if(this._semconvStability&Je.OLD&&(L=w.toUpperCase(),R["http.method"]=w,R["http.url"]=C.toString()),this._semconvStability&Je.STABLE){const _=w,E=normalizeHttpRequestMethod$1(w);L||(L=E),R[Xt]=E,E!==_&&(R[Yt]=_),R[oe]=C.toString(),R[Jt]=C.hostname;const P=function serverPortFromUrl$1(_){const E=Number(_.port||Vn[_.protocol]);return E&&!isNaN(E)?E:void 0}(C);P&&(R[te]=P)}const P=this.tracer.startSpan(L,{kind:St.CLIENT,attributes:R});return P.addEvent(Mn.METHOD_OPEN),this._cleanPreviousSpanInformation(_),this._xhrMem.set(_,{span:P,spanUrl:E}),P}_markResourceAsUsed(_){this._usedResources.add(_)}_patchOpen(){return _=>{const E=this;return function patchOpen(...w){if(!E._isEnabled)return _.apply(this,w);const C=w[0],L=w[1];return E._createSpan(this,L,C),_.apply(this,w)}}}_patchSend(){const _=this;function endSpan(E,w,C,L){const R=_._xhrMem.get(w);if(!R)return;if(R.status=w.status,R.statusText=w.statusText,_._xhrMem.delete(w),R.span){const E=R.span;_._applyAttributesAfterXHR(E,w),_._semconvStability&Je.STABLE&&(C?L&&(E.setStatus({code:Et.ERROR,message:L}),E.setAttribute(Gt,L)):R.status&&R.status>=400&&(E.setStatus({code:Et.ERROR}),E.setAttribute(Gt,String(R.status))))}const P=hrTime$1(),I=Date.now();setTimeout((()=>{!function endSpanTimeout(E,w,C,L){const R=w.callbackToRemoveEvents;"function"==typeof R&&R();const{span:P,spanUrl:I,sendStartTime:k}=w;P&&(_._findResourceAndAddNetworkEvents(w,P,I,k,C),P.addEvent(E,L),_._addFinalSpanAttributes(P,w,I),P.end(L),_._tasksCount--),_._clearResources()}(E,R,P,I)}),300)}function onError(){endSpan(Mn.EVENT_ERROR,this,!0,"error")}function onAbort(){endSpan(Mn.EVENT_ABORT,this,!1)}function onTimeout(){endSpan(Mn.EVENT_TIMEOUT,this,!0,"timeout")}function onLoad(){this.status<299?endSpan(Mn.EVENT_LOAD,this,!1):endSpan(Mn.EVENT_ERROR,this,!1)}return E=>function patchSend(...w){if(!_._isEnabled)return E.apply(this,w);const C=_._xhrMem.get(this);if(!C)return E.apply(this,w);const L=C.span,R=C.spanUrl;if(L&&R){if(_.getConfig().measureRequestSize&&w?.[0]){const E=getXHRBodyLength$1(w[0]);void 0!==E&&(_._semconvStability&Je.OLD&&L.setAttribute("http.request_content_length_uncompressed",E),_._semconvStability&Je.STABLE&&L.setAttribute("http.request.body.size",E))}Tt.with(It.setSpan(Tt.active(),L),(()=>{_._tasksCount++,C.sendStartTime=hrTime$1(),L.addEvent(Mn.METHOD_SEND),this.addEventListener("abort",onAbort),this.addEventListener("error",onError),this.addEventListener("load",onLoad),this.addEventListener("timeout",onTimeout),C.callbackToRemoveEvents=()=>{!function unregister(E){E.removeEventListener("abort",onAbort),E.removeEventListener("error",onError),E.removeEventListener("load",onLoad),E.removeEventListener("timeout",onTimeout);const w=_._xhrMem.get(E);w&&(w.callbackToRemoveEvents=void 0)}(this),C.createdResources&&C.createdResources.observer.disconnect()},_._addHeaders(this,R),_._addResourceObserver(this,R)}))}return E.apply(this,w)}}enable(){if(!this._isEnabled){if(this._isXhrPatched)return this._diag.debug("reactivating existing patch on",this.moduleName,this.version),void(this._isEnabled=!0);try{this._diag.debug("applying patch to",this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(_){this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.warn("Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.",_)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}var zn;!function(_){_.COMPONENT="component",_.HTTP_STATUS_TEXT="http.status_text"}(zn||(zn={}));const qn=vt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function getFetchBodyLength(..._){if(_[0]instanceof URL||"string"==typeof _[0]){const E=_[1];if(!E?.body)return Promise.resolve();if(E.body instanceof ReadableStream){const{body:_,length:w}=function _getBodyNonDestructively(_){if(!_.pipeThrough)return qn.warn("Platform has ReadableStream but not pipeThrough!"),{body:_,length:Promise.resolve(void 0)};let E,w=0;const C=new Promise((_=>{E=_})),L=new TransformStream({start(){},async transform(_,E){const C=await _;w+=C.byteLength,E.enqueue(_)},flush(){E(w)}});return{body:_.pipeThrough(L),length:C}}(E.body);return E.body=_,w}return Promise.resolve(function getXHRBodyLength(_){if(function isDocument(_){return"undefined"!=typeof Document&&_ instanceof Document}(_))return(new XMLSerializer).serializeToString(document).length;if("string"==typeof _)return getByteLength(_);if(_ instanceof Blob)return _.size;if(_ instanceof FormData)return function getFormDataSize(_){let E=0;for(const[w,C]of _.entries())E+=w.length,C instanceof Blob?E+=C.size:E+=C.length;return E}(_);if(_ instanceof URLSearchParams)return getByteLength(_.toString());if(void 0!==_.byteLength)return _.byteLength;return void qn.warn("unknown body type")}(E.body))}{const E=_[0];return E?.body?E.clone().text().then((_=>getByteLength(_))):Promise.resolve()}}const Gn=new TextEncoder;function getByteLength(_){return Gn.encode(_).byteLength}const Wn={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let Kn;function getKnownMethods(){return void 0===Kn&&(Kn=Wn),Kn}const Qn={"https:":"443","http:":"80"};const Xn="0.220.0",Yn="undefined"!=typeof PerformanceObserver;class FetchInstrumentation extends InstrumentationBase{constructor(_={}){super("@opentelemetry/instrumentation-fetch",Xn,_),this.component="fetch",this.version=Xn,this.moduleName=this.component,this._usedResources=new WeakSet,this._tasksCount=0,this._semconvStability=semconvStabilityFromStr("http",_?.semconvStabilityOptIn)}init(){}_addChildSpan(_,E){const w=this.tracer.startSpan("CORS Preflight",{startTime:E[Dn.FETCH_START]},It.setSpan(Tt.active(),_)),C=!(this._semconvStability&Je.OLD);addSpanNetworkEvents$1(w,E,this.getConfig().ignoreNetworkEvents,void 0,C),w.end(E[Dn.RESPONSE_END])}_addFinalSpanAttributes(_,E){const w=parseUrl(E.url);if(this._semconvStability&Je.OLD&&(_.setAttribute("http.status_code",E.status),null!=E.statusText&&_.setAttribute(zn.HTTP_STATUS_TEXT,E.statusText),_.setAttribute("http.host",w.host),_.setAttribute("http.scheme",w.protocol.replace(":","")),"undefined"!=typeof navigator&&_.setAttribute("http.user_agent",navigator.userAgent)),this._semconvStability&Je.STABLE){_.setAttribute(Zt,E.status),_.setAttribute(Jt,w.hostname);const C=function serverPortFromUrl(_){const E=Number(_.port||Qn[_.protocol]);return E&&!isNaN(E)?E:void 0}(w);C&&_.setAttribute(te,C)}}_addHeaders(_,E){if(!shouldPropagateTraceHeaders(E,this.getConfig().propagateTraceHeaderCorsUrls)){const _={};return Ot.inject(Tt.active(),_),void(Object.keys(_).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(_ instanceof Request)Ot.inject(Tt.active(),_.headers,{set:(_,E,w)=>_.set(E,"string"==typeof w?w:String(w))});else{const E=new Headers(_.headers);Ot.inject(Tt.active(),E,{set:(_,E,w)=>_.set(E,"string"==typeof w?w:String(w))}),_.headers=E}}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(_,E={}){if(isUrlIgnored(_,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");let w="";const C={};if(this._semconvStability&Je.OLD){const L=(E.method||"GET").toUpperCase();w=`HTTP ${L}`,C[zn.COMPONENT]=this.moduleName,C["http.method"]=L,C["http.url"]=_}if(this._semconvStability&Je.STABLE){const L=E.method,R=function normalizeHttpRequestMethod(_){const E=getKnownMethods(),w=_.toUpperCase();return w in E?w:"_OTHER"}(E.method||"GET");w||(w=R),C[Xt]=R,R!==L&&(C[Yt]=L),C[oe]=_}return this.tracer.startSpan(w,{kind:St.CLIENT,attributes:C})}_findResourceAndAddNetworkEvents(_,E,w){let C=E.entries;if(!C.length){if(!performance.getEntriesByType)return;C=performance.getEntriesByType("resource")}const L=getResource(E.spanUrl,E.startTime,w,C,this._usedResources,"fetch");if(L.mainRequest){const E=L.mainRequest;this._markResourceAsUsed(E);const w=L.corsPreFlightRequest;w&&(this._addChildSpan(_,w),this._markResourceAsUsed(w));const C=!(this._semconvStability&Je.OLD);addSpanNetworkEvents$1(_,E,this.getConfig().ignoreNetworkEvents,void 0,C)}}_markResourceAsUsed(_){this._usedResources.add(_)}_endSpan(_,E,w){const C=millisToHrTime$1(Date.now()),L=hrTime$1();this._addFinalSpanAttributes(_,w),this._semconvStability&Je.STABLE&&w.status>=400&&(_.setStatus({code:Et.ERROR}),_.setAttribute(Gt,String(w.status))),setTimeout((()=>{E.observer?.disconnect(),this._findResourceAndAddNetworkEvents(_,E,L),this._tasksCount--,this._clearResources(),_.end(C)}),300)}_patchConstructor(){return _=>{const E=this;return function patchConstructor(...w){if(!E._isEnabled)return _.apply(this,w);const C=this,L=parseUrl(w[0]instanceof Request?w[0].url:String(w[0])).href;let R;R=w[0]instanceof Request?null!=w[1]?new Request(w[0],w[1]):w[0]:w[1]||{};const P=E._createSpan(L,R);if(!P)return _.apply(this,w);const I=E._prepareSpanData(L);function endSpanOnError(_,w){E._applyAttributesAfterFetch(_,R,w),E._endSpan(_,I,{status:w.status||0,statusText:w.message,url:L})}function endSpanOnSuccess(_,w){E._applyAttributesAfterFetch(_,R,w),w.status>=200&&w.status<400?E._endSpan(_,I,w):E._endSpan(_,I,{status:w.status,statusText:w.statusText,url:L})}function onSuccess(_,w){try{const E=w.clone().body;if(E){const C=E.getReader(),read=()=>{C.read().then((({done:E})=>{E?endSpanOnSuccess(_,w):read()}),(E=>{endSpanOnError(_,E)}))};read()}else endSpanOnSuccess(_,w)}catch(w){E._diag.error("Failed to read fetch response body",w),E._endSpan(_,I,{status:0,url:L})}return w}function onError(_,w){try{endSpanOnError(_,w)}catch(C){E._diag.error("Failed to end span on fetch error",C),E._endSpan(_,I,{status:w.status||0,url:L})}throw w}return E.getConfig().measureRequestSize&&getFetchBodyLength(...w).then((_=>{_&&(E._semconvStability&Je.OLD&&P.setAttribute("http.request_content_length_uncompressed",_),E._semconvStability&Je.STABLE&&P.setAttribute("http.request.body.size",_))})).catch((_=>{E._diag.warn("getFetchBodyLength",_)})),Tt.with(It.setSpan(Tt.active(),P),(()=>(E._callRequestHook(P,R),E._addHeaders(R,L),E._tasksCount++,_.apply(C,R instanceof Request?[R]:[L,R]).then(onSuccess.bind(C,P),onError.bind(C,P)))))}}}_applyAttributesAfterFetch(_,E,w){const C=this.getConfig().applyCustomAttributesOnSpan;C&&safeExecuteInTheMiddle((()=>C(_,E,w)),(_=>{_&&this._diag.error("applyCustomAttributesOnSpan",_)}))}_callRequestHook(_,E){const w=this.getConfig().requestHook;w&&safeExecuteInTheMiddle((()=>w(_,E)),(_=>{_&&this._diag.error("requestHook",_)}))}_prepareSpanData(_){const E=hrTime$1(),w=[];if("function"!=typeof PerformanceObserver)return{entries:w,startTime:E,spanUrl:_};const C=new PerformanceObserver((E=>{E.getEntries().forEach((E=>{"fetch"===E.initiatorType&&E.name===_&&w.push(E)}))}));return C.observe({entryTypes:["resource"]}),{entries:w,observer:C,startTime:E,spanUrl:_}}enable(){if(Yn){if(!this._isEnabled){if(this._isFetchPatched)return this._diag.debug("fetch constructor already patched"),void(this._isEnabled=!0);try{this._wrap(globalThis,"fetch",this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(_){this._diag.warn("Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.",_)}}}else this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()")}disable(){Yn&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}const Zn=performance;var Jn;!function(_){_.CONNECT_END="connectEnd",_.CONNECT_START="connectStart",_.DECODED_BODY_SIZE="decodedBodySize",_.DOM_COMPLETE="domComplete",_.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",_.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",_.DOM_INTERACTIVE="domInteractive",_.DOMAIN_LOOKUP_END="domainLookupEnd",_.DOMAIN_LOOKUP_START="domainLookupStart",_.ENCODED_BODY_SIZE="encodedBodySize",_.FETCH_START="fetchStart",_.LOAD_EVENT_END="loadEventEnd",_.LOAD_EVENT_START="loadEventStart",_.NAVIGATION_START="navigationStart",_.REDIRECT_END="redirectEnd",_.REDIRECT_START="redirectStart",_.REQUEST_START="requestStart",_.RESPONSE_END="responseEnd",_.RESPONSE_START="responseStart",_.SECURE_CONNECTION_START="secureConnectionStart",_.START_TIME="startTime",_.UNLOAD_EVENT_END="unloadEventEnd",_.UNLOAD_EVENT_START="unloadEventStart"}(Jn||(Jn={}));function hasKey(_,E){return E in _}function addSpanNetworkEvent(_,E,w,C=!0){if(hasKey(w,E)&&"number"==typeof w[E]&&(!C||0!==w[E]))return _.addEvent(E,w[E])}function addSpanNetworkEvents(_,E,w=!1,C,L){if(void 0===C&&(C=0!==E[Jn.START_TIME]),w||(addSpanNetworkEvent(_,Jn.FETCH_START,E,C),addSpanNetworkEvent(_,Jn.DOMAIN_LOOKUP_START,E,C),addSpanNetworkEvent(_,Jn.DOMAIN_LOOKUP_END,E,C),addSpanNetworkEvent(_,Jn.CONNECT_START,E,C),addSpanNetworkEvent(_,Jn.SECURE_CONNECTION_START,E,C),addSpanNetworkEvent(_,Jn.CONNECT_END,E,C),addSpanNetworkEvent(_,Jn.REQUEST_START,E,C),addSpanNetworkEvent(_,Jn.RESPONSE_START,E,C),addSpanNetworkEvent(_,Jn.RESPONSE_END,E,C)),!L){const w=E[Jn.ENCODED_BODY_SIZE];void 0!==w&&_.setAttribute("http.response_content_length",w);const C=E[Jn.DECODED_BODY_SIZE];void 0!==C&&w!==C&&_.setAttribute("http.response_content_length_uncompressed",C)}}var ts;!function(_){_.DOCUMENT_LOAD="documentLoad",_.DOCUMENT_FETCH="documentFetch",_.RESOURCE_FETCH="resourceFetch"}(ts||(ts={}));const es="http.url";var rs;!function(_){_.FIRST_PAINT="firstPaint",_.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"}(rs||(rs={}));const ns={"first-paint":rs.FIRST_PAINT,"first-contentful-paint":rs.FIRST_CONTENTFUL_PAINT};class DocumentLoadInstrumentation extends InstrumentationBase{constructor(_={}){super("@opentelemetry/instrumentation-document-load","0.65.0",_),this.component="document-load",this.version="1",this.moduleName=this.component,this._semconvStability=semconvStabilityFromStr("http",_?.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout((()=>{this._collectPerformance()}))}_addResourcesSpans(_){const E=Zn.getEntriesByType?.("resource");E&&E.forEach((E=>{this._initResourceSpan(E,_)}))}_collectPerformance(){const _=Array.from(document.getElementsByTagName("meta")).find((_=>"traceparent"===_.getAttribute("name"))),E=(()=>{const _={},E=Zn.getEntriesByType?.("navigation")[0];if(E)Object.values(Jn).forEach((w=>{if(hasKey(E,w)){const C=E[w];"number"==typeof C&&(_[w]=C)}}));else{const E=Zn.timing;E&&Object.values(Jn).forEach((w=>{if(hasKey(E,w)){const C=E[w];"number"==typeof C&&(_[w]=C)}}))}return _})(),w=_&&_.content||"";Tt.with(Ot.extract(Y,{traceparent:w}),(()=>{const _=this._startSpan(ts.DOCUMENT_LOAD,Jn.FETCH_START,E);_&&(Tt.with(It.setSpan(Tt.active(),_),(()=>{const _=this._startSpan(ts.DOCUMENT_FETCH,Jn.FETCH_START,E);_&&(this._semconvStability&Je.OLD&&_.setAttribute(es,location.href),this._semconvStability&Je.STABLE&&_.setAttribute(oe,location.href),Tt.with(It.setSpan(Tt.active(),_),(()=>{const w=!(this._semconvStability&Je.OLD);addSpanNetworkEvents(_,E,this.getConfig().ignoreNetworkEvents,void 0,w),this._addCustomAttributesOnSpan(_,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(_,Jn.RESPONSE_END,E)})))})),this._semconvStability&Je.OLD&&(_.setAttribute(es,location.href),_.setAttribute("http.user_agent",navigator.userAgent)),this._semconvStability&Je.STABLE&&(_.setAttribute(oe,location.href),_.setAttribute("user_agent.original",navigator.userAgent)),this._addResourcesSpans(_),this.getConfig().ignoreNetworkEvents||(addSpanNetworkEvent(_,Jn.FETCH_START,E),addSpanNetworkEvent(_,Jn.UNLOAD_EVENT_START,E),addSpanNetworkEvent(_,Jn.UNLOAD_EVENT_END,E),addSpanNetworkEvent(_,Jn.DOM_INTERACTIVE,E),addSpanNetworkEvent(_,Jn.DOM_CONTENT_LOADED_EVENT_START,E),addSpanNetworkEvent(_,Jn.DOM_CONTENT_LOADED_EVENT_END,E),addSpanNetworkEvent(_,Jn.DOM_COMPLETE,E),addSpanNetworkEvent(_,Jn.LOAD_EVENT_START,E),addSpanNetworkEvent(_,Jn.LOAD_EVENT_END,E)),this.getConfig().ignorePerformancePaintEvents||(_=>{const E=Zn.getEntriesByType?.("paint");E&&E.forEach((({name:E,startTime:w})=>{hasKey(ns,E)&&_.addEvent(ns[E],w)}))})(_),this._addCustomAttributesOnSpan(_,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(_,Jn.LOAD_EVENT_END,E))}))}_endSpan(_,E,w){_&&(hasKey(w,E)?_.end(w[E]):_.end())}_initResourceSpan(_,E){const w=this._startSpan(ts.RESOURCE_FETCH,Jn.FETCH_START,_,E);if(w){this._semconvStability&Je.OLD&&w.setAttribute(es,_.name),this._semconvStability&Je.STABLE&&w.setAttribute(oe,_.name);const E=!(this._semconvStability&Je.OLD);addSpanNetworkEvents(w,_,this.getConfig().ignoreNetworkEvents,void 0,E),this._addCustomAttributesOnResourceSpan(w,_,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(w,Jn.RESPONSE_END,_)}}_startSpan(_,E,w,C){if(hasKey(w,E)&&"number"==typeof w[E]){return this.tracer.startSpan(_,{startTime:w[E]},C?It.setSpan(Tt.active(),C):void 0)}}_waitForPageLoad(){"complete"===window.document.readyState?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(_,E){E&&safeExecuteInTheMiddle((()=>E(_)),(_=>{_&&this._diag.error("addCustomAttributesOnSpan",_)}))}_addCustomAttributesOnResourceSpan(_,E,w){w&&safeExecuteInTheMiddle((()=>w(_,E)),(_=>{_&&this._diag.error("addCustomAttributesOnResourceSpan",_)}))}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}}class RetryingTransport{constructor(_){this._transport=_}retry(_,E,w){return new Promise(((C,L)=>{setTimeout((()=>{this._transport.send(_,E).then(C,L)}),w)}))}async send(_,E){let w=5,C=1e3;const L=Date.now()+E;let R=await this._transport.send(_,E);for(;"retryable"===R.status&&w>0;){w--;const E=Math.max(Math.min(C*(.4*Math.random()-.2+1),5e3),0);C*=1.5;const P=R.retryInMillis??E,I=L-Date.now();if(P>I)return vt.info(`Export retry time ${Math.round(P)}ms exceeds remaining timeout ${Math.round(I)}ms, not retrying further.`),R;vt.verbose(`Scheduling export retry in ${Math.round(P)}ms`),R=await this.retry(_,I,P)}return"success"===R.status?vt.verbose(`Export succeeded after ${5-w} retry attempts.`):"retryable"===R.status?vt.info("Export failed after maximum retry attempts (5)."):vt.info(`Export failed with non-retryable error: ${R.error}`),R}shutdown(){return this._transport.shutdown()}}let ss=0,is=0,os=class FetchTransport{constructor(_){this._parameters=_}async send(_,E){const w=new AbortController,C=setTimeout((()=>w.abort()),E);let L=globalThis.fetch;"function"==typeof L.__original&&(L=L.__original);const R=_.byteLength,P=ss+R>61440,I=!P&&!(is>=9);if(I)ss+=R,is++;else{const _=P?"size limit":"count limit";vt.debug(`keepalive disabled: ${(R/1024).toFixed(1)}KB payload, ${is} pending (${_})`)}try{const E=new URL(this._parameters.url),C=await L(E.href,{method:"POST",headers:await this._parameters.headers(),body:_,signal:w.signal,keepalive:I,mode:globalThis.location?globalThis.location.origin===E.origin?"same-origin":"cors":"no-cors"});if(C.status>=200&&C.status<=299)return vt.debug(`export response success (status: ${C.status})`),{status:"success"};if(function isExportHTTPErrorRetryable(_){return 429===_||502===_||503===_||504===_}(C.status)){vt.warn(`export response retryable (status: ${C.status})`);const _=function parseRetryAfterToMills$2(_){if(null==_)return;const E=Number.parseInt(_,10);if(Number.isInteger(E))return E>0?1e3*E:-1;const w=new Date(_).getTime()-Date.now();return w>=0?w:0}(C.headers.get("Retry-After"));return{status:"retryable",retryInMillis:_}}return vt.error(`export response failure (status: ${C.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${C.status}`)}}catch(_){return function isFetchNetworkErrorRetryable(_){return _ instanceof TypeError&&!_.cause}(_)?(vt.warn(`export request retryable (network error: ${_})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:_})}):(vt.error(`export request failure (error: ${_})`),{status:"failure",error:new Error("Fetch request errored",{cause:_})})}finally{clearTimeout(C),I&&(ss-=R,is--)}}shutdown(){}};function createOtlpFetchExportDelegate(_,E){return createOtlpNetworkExportDelegate(_,E,function createRetryingTransport(_){return new RetryingTransport(_.transport)}({transport:(w=_,new os(w))}));var w}function mergeHeaders(_,E,w){return async()=>{const C={...await w()},L={};return null!=E&&Object.assign(L,await E()),null!=_&&Object.assign(L,function validateAndNormalizeHeaders(_){const E={};return Object.entries(_??{}).forEach((([_,w])=>{void 0!==w?E[_]=String(w):vt.warn(`Header "${_}" has invalid value (${w}) and will be ignored`)})),E}(await _())),Object.assign(L,C)}}function validateUserProvidedUrl(_){if(null!=_)try{const E=globalThis.location?.href;return new URL(_,E).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${_}'`)}}function convertLegacyHeaders(_){return"function"==typeof _.headers?_.headers:function wrapStaticHeadersInFunction(_){if(null!=_)return async()=>_}(_.headers)}function convertLegacyBrowserHttpOptions(_,E,w){return function mergeOtlpHttpConfigurationWithDefaults(_,E,w){return{...mergeOtlpSharedConfigurationWithDefaults(_,E,w),headers:mergeHeaders(_.headers,E.headers,w.headers),url:validateUserProvidedUrl(_.url)??E.url??w.url}}({url:_.url,timeoutMillis:_.timeoutMillis,headers:convertLegacyHeaders(_),concurrencyLimit:_.concurrencyLimit},{},function getHttpConfigurationDefaults(_,E){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:async()=>_,url:"http://localhost:4318/"+E}}(w,E))}let as=class OTLPTraceExporter extends OTLPExporterBase{constructor(_={}){super(function createLegacyOtlpBrowserExportDelegate(_,E,w,C){return createOtlpFetchExportDelegate(convertLegacyBrowserHttpOptions(_,w,C),E)}(_,ve,"v1/traces",{"Content-Type":"application/x-protobuf"}))}};const cs="global",us="gcp.project_id",ls="gcp.firebase.app_id",ds="cloud.region",hs="gcp.firebase.domain";var ps;function isSpan(_){return"function"==typeof _.spanContext}function getSpanId(_){return _.spanContext().spanId}function isRootEvent(_){return isSpan(_)?void 0===_.parentSpanContext:void 0===_.spanContext?.traceId}!function(_){_[_.RootSpan=0]="RootSpan",_[_.RootLog=1]="RootLog",_[_.ChildSpan=2]="ChildSpan",_[_.ChildLog=3]="ChildLog"}(ps||(ps={}));class TraceEvents{constructor(){this.logs=new Set,this.spans=new Map,this.isTraceQueuedForExport=!1}add(_){isSpan(_)?this.spans.set(getSpanId(_),_):this.logs.add(_)}has(_){return isSpan(_)?this.spans.has(getSpanId(_)):this.logs.has(_)}}class TelemetryStore{constructor(_=TelemetryStore.DEFAULT_BUFFER_LIMIT,E){this._telemetryBufferMap=new Map,this._totalTelemetryCount=0,this._shouldAddLimitLog=!1,this._bufferLimit=_,this._rootTelemetryQueue=new RootTelemetryQueue(E)}get totalTelemetryCount(){return this._totalTelemetryCount}add(_){const E=this._getEventId(_);if(isRootEvent(_)&&this._telemetryBufferMap.has(E))return;if(!isRootEvent(_)&&!this._telemetryBufferMap.has(E))return;if(!this._bufferHasCapacity()){if(this._isQueueEmpty())return void(this._shouldAddLimitLog=!0);this._evictOldest()}const w=function getEventType(_){return isSpan(_)?isRootEvent(_)?ps.RootSpan:ps.ChildSpan:isRootEvent(_)?ps.RootLog:ps.ChildLog}(_);switch(w){case ps.RootSpan:{const w=new TraceEvents;return w.add(_),this._telemetryBufferMap.set(E,w),void this._totalTelemetryCount++}case ps.RootLog:return this._telemetryBufferMap.set(E,_),this._rootTelemetryQueue.isFull()&&this._evictOldest(),this._rootTelemetryQueue.enqueue(E),void this._totalTelemetryCount++;case ps.ChildSpan:case ps.ChildLog:{const w=this._telemetryBufferMap.get(E);return void(w&&w instanceof TraceEvents&&!w.has(_)&&(w.add(_),this._totalTelemetryCount++))}}}update(_){if(!isRootEvent(_))return;const E=this._getEventId(_),w=this._telemetryBufferMap.get(E);if(w&&w instanceof TraceEvents){if(w.isTraceQueuedForExport)return;this._rootTelemetryQueue.isFull()&&this._evictOldest(),this._rootTelemetryQueue.enqueue(E),w.isTraceQueuedForExport=!0}}getSpansToExport(){const _=[];for(const E of this._rootTelemetryQueue.getValues()){const w=this._telemetryBufferMap.get(E);w instanceof TraceEvents&&_.push(...w.spans.values())}return _}getLogsToExport(){const _=[];if(this._shouldAddLimitLog){const E={severityNumber:R.INFO,body:"Telemetry buffer limit reached. Some telemetry events were dropped."};_.push(E)}for(const E of this._rootTelemetryQueue.getValues()){const w=this._telemetryBufferMap.get(E);w instanceof TraceEvents?_.push(...w.logs):w&&_.push(w)}return _}clear(){this._rootTelemetryQueue.clear(),this._telemetryBufferMap.clear(),this._totalTelemetryCount=0,this._shouldAddLimitLog=!1}_getEventId(_){return isSpan(_)?_.spanContext().traceId:_.spanContext?.traceId??function generateUuid$1(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues){const _=new Uint8Array(16);crypto.getRandomValues(_),_[6]=15&_[6]|64,_[8]=63&_[8]|128;const E=Array.from(_,(_=>_.toString(16).padStart(2,"0"))).join("");return`${E.slice(0,8)}-${E.slice(8,12)}-${E.slice(12,16)}-${E.slice(16,20)}-${E.slice(20,32)}`}throw new Error("Web Crypto API is not available to generate a UUID.")}()}_bufferHasCapacity(){return this._totalTelemetryCount<this._bufferLimit}_isQueueEmpty(){return 0===this._rootTelemetryQueue.size}_evictOldest(){const _=this._rootTelemetryQueue.dequeue();_&&this._maybeEvictIdFromBuffer(_)}_maybeEvictIdFromBuffer(_){const E=this._telemetryBufferMap.get(_);E&&(this._totalTelemetryCount-=E instanceof TraceEvents?E.spans.size+E.logs.size:1,this._telemetryBufferMap.delete(_))}}TelemetryStore.DEFAULT_BUFFER_LIMIT=1e3;class RootTelemetryQueue{constructor(_=RootTelemetryQueue.DEFAULT_LIMIT){if(this._limit=_,this._head=0,this._tail=0,this._size=0,_<=0)throw new Error("Limit must be a positive integer greater than 0");this._items=new Array(this._limit).fill(void 0)}get size(){return this._size}isFull(){return this._size===this._limit}enqueue(_){this._size!==this._limit&&(this._items[this._tail]=_,this._tail=(this._tail+1)%this._limit,this._size++)}dequeue(){if(0===this._size)return;const _=this._items[this._head];return this._items[this._head]=void 0,this._head=(this._head+1)%this._limit,this._size--,_}peek(){if(0!==this._size)return this._items[this._head]}getValues(){const _=[];for(let E=0;E<this._size;E++){const w=(this._head+E)%this._items.length;this._items[w]&&_.push(this._items[w])}return _}clear(){this._items.fill(void 0),this._head=0,this._tail=0,this._size=0}}RootTelemetryQueue.DEFAULT_LIMIT=100;class OnErrorLogRecordProcessor extends BatchLogRecordProcessor{constructor(_,E){super({exporter:_,disableAutoFlushOnDocumentHide:!0}),this._store=E}onEmit(_){"good"!==_.attributes?.["browser.web_vital.rating"]&&this._store.add(_)}shutdown(){return this._store.clear(),super.shutdown()}onErrorOccurred(){const _=this._store.getLogsToExport();for(const E of _)super.onEmit(E)}}class OnErrorSpanProcessor extends BatchSpanProcessor{constructor(_,E){super(_),this._store=E}onStart(_,E){this._store.add(_)}onEnd(_){this._store.update(_)}shutdown(){return this._store.clear(),super.shutdown()}onErrorOccurred(){const _=this._store.getSpansToExport();for(const E of _)super.onEnd(E)}}class FirebaseAttributesSpanProcessor{constructor(_){this.attributesStore=_}onStart(_,E){const w=this.attributesStore.getSpanAttributes();for(const[E,C]of Object.entries(w))void 0!==C&&void 0===_.attributes?.[E]&&_.setAttribute(E,C)}onEnd(_){_.attributes&&delete _.attributes["user_agent.original"]}async forceFlush(){}async shutdown(){}}let gs,ms=class FetchTransport{constructor(_){this.parameters=_}async send(_,E){const w=new AbortController,C=setTimeout((()=>w.abort()),E);try{const E=new Headers(this.parameters.headers);if(this.parameters.dynamicHeaderProviders&&this.parameters.dynamicHeaderProviders.length>0){const _=this.parameters.dynamicHeaderProviders.map((async _=>{try{return await _.getHeader()}catch(_){return vt.debug(`Failed to retrieve dynamic header: ${_}`),null}})),w=await Promise.all(_);for(const _ of w)_&&E.append(..._)}const C=_.byteLength<6e4,L={method:"POST",headers:E,signal:w.signal,keepalive:C,mode:"cors",body:_},R=await Tt.with(suppressTracing$2(Tt.active()),(()=>fetch(this.parameters.url,L)));if(R.status>=200&&R.status<=299)return vt.debug("response success"),{status:"success"};if(function isExportRetryable$1(_){return[429,502,503,504].includes(_)}(R.status)){const _=function parseRetryAfterToMills$1(_){if(null==_)return;const E=Number.parseInt(_,10);if(Number.isInteger(E))return E>0?1e3*E:-1;const w=new Date(_).getTime()-Date.now();return w>=0?w:0}(R.headers.get("Retry-After"));return{status:"retryable",retryInMillis:_}}return{status:"failure",error:new Error("Fetch request failed with non-retryable status")}}catch(_){return _ instanceof Error?{status:"failure",error:_}:{status:"failure",error:new Error(`Fetch request errored: ${_}`)}}finally{clearTimeout(C)}}shutdown(){}};function createTracingProvider(_,E,w,C,L=[]){if("undefined"==typeof window)return{tracingProvider:It.getTracerProvider()};const R=function getTelemetryEndpointUrl$1(_={}){const E=_||{};if(E.endpointUrl){let _=E.endpointUrl.length;for(;_>0&&"/"===E.endpointUrl[_-1];)_--;return E.endpointUrl.slice(0,_)}const w=E.region||cs;return w!==cs?`https://clienttelemetry.${w}.rep.googleapis.com`:"https://clienttelemetry.googleapis.com"}(E),{projectId:P,appId:I,apiKey:k}=_.options,F=E.region||cs,$={[hs]:window.location.hostname};P&&($[us]=P),I&&($[ls]=I),F!==cs&&($[ds]=F);const V=resourceFromAttributes$1($),H=`${R}/v1/traces`;let j;j="http://localhost:4318"===R?new as({url:H,headers:{"X-Goog-User-Project":P||"",...k?{"X-Goog-Api-Key":k}:{}}}):new OTLPTraceExporter({url:H,headers:{"Content-Type":"application/json",...k?{"X-Goog-Api-Key":k}:{}}},L,w);const z=new OnErrorSpanProcessor(j,C),q=new WebTracerProvider({resource:V,spanProcessors:[new FirebaseAttributesSpanProcessor(w),z]});q.register({propagator:new CompositePropagator({propagators:[new W3CTraceContextPropagator]})});const G=`^${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,K={ignoreUrls:[new RegExp(G)],semconvStabilityOptIn:"http"};return gs&&gs(),gs=registerInstrumentations({instrumentations:[new FetchInstrumentation(K),new XMLHttpRequestInstrumentation(K),new DocumentLoadInstrumentation({semconvStabilityOptIn:"http"})]}),{tracingProvider:q,onErrorSpanProcessor:z}}class OTLPTraceExporter extends OTLPExporterBase{constructor(_={},E=[],w){super(createOtlpNetworkExportDelegate({timeoutMillis:1e4,concurrencyLimit:5},Le,new ms({url:_.url,headers:new Headers("object"==typeof _.headers?_.headers:{}),dynamicHeaderProviders:E}))),this.attributesStore=w}async export(_,E){const w=await(this.attributesStore?.getInstallationIdAttribute());w&&_.forEach((_=>{Object.assign(_.attributes,w)})),super.export(_,E)}}const fs=new Set;function unregisterLoggerInstrumentations(){for(const _ of fs)_();fs.clear()}class BreadcrumbsFeatureImpl{constructor(){this.name="breadcrumbs"}createTelemetryStore(){return new TelemetryStore}createLogRecordProcessor(_,E){return new OnErrorLogRecordProcessor(_,E)}initializeLoggerInstrumentations(_){if("undefined"==typeof window)return;const E=new Ar({enabled:!1}),w=new tn({enabled:!1,includeRawAttribution:!0});this._unregisterLoggerInstrumentationsFn&&(this._unregisterLoggerInstrumentationsFn(),fs.delete(this._unregisterLoggerInstrumentationsFn));const C=registerInstrumentations({loggerProvider:_,instrumentations:[E,w,new Nr({autoCapturedActions:["click"]})]});Object.defineProperty(this,"_unregisterLoggerInstrumentationsFn",{value:C,writable:!0,configurable:!0,enumerable:!1}),fs.add(C)}createTracingProvider(_,E,w,C,L=[]){return createTracingProvider(_,E,w,C,L)}unregisterInstrumentations(){this._unregisterLoggerInstrumentationsFn&&(this._unregisterLoggerInstrumentationsFn(),fs.delete(this._unregisterLoggerInstrumentationsFn),this._unregisterLoggerInstrumentationsFn=void 0),function unregisterTracingInstrumentations(){gs&&(gs(),gs=void 0)}()}}function breadcrumbs(){return new BreadcrumbsFeatureImpl}var _s="@firebase/crashlytics",bs="0.1.1";const ys="crashlytics",Ss="global",Es="gcp.project_id",Ts="gcp.firebase.app_id",vs="cloud.region",ws=Symbol("firebase_crashlytics_logged"),As="app.installation.id",Cs="firebasecrashlytics.sessionid",Ls="app.build_id",Rs="session.id",Ps="app.screen.id",Os="logging.googleapis.com/trace",xs="logging.googleapis.com/spanId",Is="gcp.resource.name",Ns="session.id",Ds="service.version",ks="app.screen.id";class AttributesStore{constructor(_,E,w){this._projectId=_.projectId,this._region=E?.region||Ss,this.updateOptions(E);const C=this.getSessionIdFromStorage();C&&(this._sessionId=C),this._installations=w?.getImmediate({optional:!0})??null,this._installations||w?.get().then((_=>this._installations=_)).catch((()=>{}))}updateOptions(_){const E=_?.appVersion?_.appVersion:jt?.appVersion?jt.appVersion:"unset";this._appVersion=E,this._customAttributes=_?.customAttributes?{..._.customAttributes}:void 0}get sessionId(){return this._sessionId}setSessionId(_){if(this._sessionId=_,"undefined"!=typeof sessionStorage)try{sessionStorage.setItem(Cs,_)}catch(_){}}setRoutePathProvider(_){this._routePathProvider=_}getLogAttributes(_){const E={};this._customAttributes&&Object.assign(E,this._customAttributes),this._appVersion&&(E[Ls]=this._appVersion),this._sessionId&&(E[Rs]=this._sessionId);const w=this._routePathProvider?.();return w&&(E[Ps]=w),_?{...E,..._}:E}getSpanAttributes(){const _={};this._projectId&&(_[Is]=`//clienttelemetry.googleapis.com/projects/${this._projectId}/locations/${this._region}/`),this._appVersion&&(_[Ds]=this._appVersion),this._sessionId&&(_[Ns]=this._sessionId);const E=this._routePathProvider?.();return E&&(_[ks]=E),_}async getInstallationIdAttribute(){if(!this._installations)return null;if(this._iid)return{[As]:this._iid};const _=await this._installations.getId();return _?(this._iid=_,{[As]:_}):null}getSessionIdFromStorage(){if("undefined"!=typeof sessionStorage)try{return sessionStorage.getItem(Cs)||void 0}catch(_){}}}function getCrashlytics(_=w(),E){const C=_getProvider(_,ys);if(C.isInitialized()){const _=C.getImmediate();if(deepEqual(E||{},C.getOptions()))return _;throw new Error("getCrashlytics() cannot be called with different options")}const L=C.initialize({options:E});return E&&(L.options=E),L}function recordError(_,E,w){if(!_)return;if(E&&"object"==typeof E)try{E[ws]=!0}catch(_){}const{loggerProvider:C,telemetryStore:L,onErrorSpanProcessor:P,onErrorLogRecordProcessor:I}=_,k=C.getLogger("error-logger"),F=w?{...w}:{};E instanceof Error?k.emit({severityNumber:R.ERROR,body:E.message,attributes:{"exception.type":E.name||"Error","exception.stacktrace":E.stack||"No stack trace available","exception.message":E.message,...F}}):"string"==typeof E?k.emit({severityNumber:R.ERROR,body:E,attributes:F}):k.emit({severityNumber:R.ERROR,body:"Unknown error type: "+typeof E,attributes:F}),P&&P.onErrorOccurred(),I&&I.onErrorOccurred(),L&&L.clear()}function log(_,E,w){if(!_)return;const{loggerProvider:C}=_,L=C.getLogger("custom-logger"),P=w?{...w}:{};L.emit({severityNumber:R.INFO,body:E,attributes:P})}function logViewBoundary(_,E,w){const{loggerProvider:C,attributesStore:L,options:P}=_;if(!getBreadcrumbsFeature(P))return;const I=C.getLogger("view-boundary-logger"),k=L.getLogAttributes({[Ps]:E,...w});I.emit({severityNumber:R.INFO,body:"Navigation event",attributes:k})}function getBreadcrumbsFeature(_){return _?.features?.find((_=>Boolean(_&&"breadcrumbs"===_.name)))}function startNewSession(_){const{loggerProvider:E,attributesStore:w}=_;if("undefined"!=typeof sessionStorage)try{const _=function generateUuid(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues){const _=new Uint8Array(16);crypto.getRandomValues(_),_[6]=15&_[6]|64,_[8]=63&_[8]|128;const E=Array.from(_,(_=>_.toString(16).padStart(2,"0"))).join("");return`${E.slice(0,8)}-${E.slice(8,12)}-${E.slice(12,16)}-${E.slice(16,20)}-${E.slice(20,32)}`}throw new Error("Web Crypto API is not available to generate a UUID.")}();w.setSessionId(_);const C=w.getLogAttributes();E.getLogger("session-logger").emit({severityNumber:R.DEBUG,body:"Session created",attributes:C})}catch(_){}}function registerListeners(_){if("undefined"!=typeof window&&"undefined"!=typeof document){const onVisibilityChange=async()=>{!getBreadcrumbsFeature(_.options)||"visible"!==document.visibilityState&&"hidden"!==document.visibilityState||function logVisibilityEvent(_,E){const{loggerProvider:w,attributesStore:C}=_,L=w.getLogger("visibility-logger"),P=C.getLogAttributes(),I="hidden"===E?"Background lifecycle event":"Foreground lifecycle event";L.emit({severityNumber:R.INFO,body:I,attributes:P})}(_,document.visibilityState),"hidden"===document.visibilityState&&await flush(_)},onPageHide=async()=>{await flush(_)};return window.addEventListener("visibilitychange",onVisibilityChange),window.addEventListener("pagehide",onPageHide),()=>{window.removeEventListener("visibilitychange",onVisibilityChange),window.removeEventListener("pagehide",onPageHide)}}return()=>{}}let Ms=null;function flush(_){return _.loggerProvider.forceFlush().catch((_=>{console.error("Error flushing logs from Firebase Crashlytics:",_)}))}class CrashlyticsService{constructor(_,E,w,C,L,R,P){this.app=_,this.loggerProvider=E,this.tracingProvider=w,this.attributesStore=C,this.telemetryStore=L,this.onErrorLogRecordProcessor=R,this.onErrorSpanProcessor=P}unsubscribeListeners(_){this._unsubscribeListeners=_}async _delete(){this._unsubscribeListeners&&this._unsubscribeListeners(),getBreadcrumbsFeature(this._options)?.unregisterInstrumentations();const _=[];if(this.loggerProvider&&"function"==typeof this.loggerProvider.shutdown&&_.push(this.loggerProvider.shutdown().catch((_=>{console.warn("Error shutting down logger provider:",_)}))),this.tracingProvider){const E=this.tracingProvider;"function"==typeof E.shutdown&&_.push(E.shutdown().catch((_=>{console.warn("Error shutting down tracing provider:",_)})))}await Promise.all(_)}set options(_){this._options=_,this.attributesStore.updateOptions(_)}get options(){return this._options}}class FetchTransport{constructor(_){this.parameters=_}async send(_,E){const w=new AbortController,C=setTimeout((()=>w.abort()),E);try{const E=new Headers(this.parameters.headers);if(this.parameters.dynamicHeaderProviders&&this.parameters.dynamicHeaderProviders.length>0){const _=this.parameters.dynamicHeaderProviders.map((async _=>{try{return await _.getHeader()}catch(_){return vt.debug(`Failed to retrieve dynamic header: ${_}`),null}})),w=await Promise.all(_);for(const _ of w)_&&E.append(..._)}const C=_.byteLength<6e4,L={method:"POST",headers:E,signal:w.signal,keepalive:C,mode:"cors",body:_},R=await Tt.with(suppressTracing$2(Tt.active()),(()=>fetch(this.parameters.url,L)));if(R.status>=200&&R.status<=299)return vt.debug("response success"),{status:"success"};if(function isExportRetryable(_){return[429,502,503,504].includes(_)}(R.status)){const _=function parseRetryAfterToMills(_){if(null==_)return;const E=Number.parseInt(_,10);if(Number.isInteger(E))return E>0?1e3*E:-1;const w=new Date(_).getTime()-Date.now();return w>=0?w:0}(R.headers.get("Retry-After"));return{status:"retryable",retryInMillis:_}}return{status:"failure",error:new Error("Fetch request failed with non-retryable status")}}catch(_){return _ instanceof Error?{status:"failure",error:_}:{status:"failure",error:new Error(`Fetch request errored: ${_}`)}}finally{clearTimeout(C)}}shutdown(){}}class FirebaseAttributesLogProcessor{constructor(_,E){this.attributesStore=_,this.projectId=E}onEmit(_,E){var w,C,L,R,P;_.attributes||(_.attributes={});const I=this.attributesStore.getLogAttributes();for(const[E,C]of Object.entries(I))void 0!==C&&((w=_.attributes)[E]??(w[E]=C));const k=_.spanContext??(E?It.getSpanContext(E):void 0)??It.getActiveSpan()?.spanContext();k?.traceId&&k?.spanId&&this.projectId&&((C=_.attributes)[L=Os]??(C[L]=`projects/${this.projectId}/traces/${k.traceId}`),(R=_.attributes)[P=xs]??(R[P]=k.spanId))}async forceFlush(){}async shutdown(){}}function createLoggerProvider(_,E={},w,C,L=[]){const R=function getTelemetryEndpointUrl(_={}){const E=_||{};if(E.endpointUrl){let _=E.endpointUrl.length;for(;_>0&&"/"===E.endpointUrl[_-1];)_--;return E.endpointUrl.slice(0,_)}const w=E.region||Ss;return w!==Ss?`https://clienttelemetry.${w}.rep.googleapis.com`:"https://clienttelemetry.googleapis.com"}(E),{projectId:P,appId:I,apiKey:k}=_.options,F=E.region||Ss,V=`${R}/v1/logs`,H={[ye]:"firebase_telemetry_service"};P&&(H[Es]=P),I&&(H[Ts]=I),F!==Ss&&(H[vs]=F);const j=resourceFromAttributes$1(H),z=new OTLPLogExporter({url:V,headers:{"Content-Type":"application/json",...k?{"X-Goog-Api-Key":k}:{}}},L,w);let q;const G=[new FirebaseAttributesLogProcessor(w,P)],K=getBreadcrumbsFeature(E);K?(q=K.createLogRecordProcessor(z,C??K.createTelemetryStore()),G.push(q)):G.push(new BatchLogRecordProcessor({exporter:z,disableAutoFlushOnDocumentHide:!0}));const Q=new LoggerProvider({resource:j,processors:G,logRecordLimits:{}});return E.registerGlobalLoggerProvider&&$.setGlobalLoggerProvider(Q),K&&"undefined"!=typeof window&&K.initializeLoggerInstrumentations(Q),{loggerProvider:Q,onErrorLogRecordProcessor:q}}class OTLPLogExporter extends OTLPExporterBase{constructor(_={},E=[],w){super(createOtlpNetworkExportDelegate({timeoutMillis:1e4,concurrencyLimit:5},Ce,new FetchTransport({url:_.url,headers:new Headers("object"==typeof _.headers?_.headers:{}),dynamicHeaderProviders:E}))),this.attributesStore=w,this.endpointUrl=_.url}async export(_,E){const w=_.filter((_=>!function isTelemetryUrl(_,E){return!!("string"==typeof _&&_&&(/^https?:\/\/clienttelemetry\.(googleapis\.com|[a-z0-9-]+\.rep\.googleapis\.com)(\/|$)/.test(_)||E&&_.startsWith(E)))}(_.attributes?.["url.full"]||_.attributes?.["http.url"]||_.attributes?.["resource.url"],this.endpointUrl)));if(0===w.length)return void E({code:kt.SUCCESS});const C=await this.attributesStore.getInstallationIdAttribute();C&&w.forEach((_=>{Object.assign(_.attributes,C)})),super.export(w,E)}}class AppCheckProvider{constructor(_){this.appCheck=_?.getImmediate({optional:!0}),this.appCheck||_?.get().then((_=>this.appCheck=_)).catch()}async getHeader(){if(!this.appCheck)return null;const _=await this.appCheck.getToken();return!_||_.error?null:["X-Firebase-AppCheck",_.token]}}!function registerCrashlytics(){E(new Component(ys,((_,{options:E})=>{const w=E||{},C=_.getProvider("app").getImmediate(),L=_.getProvider("app-check-internal"),R=_.getProvider("installations-internal"),P=new AttributesStore(C.options,w,R),I=getBreadcrumbsFeature(w),k=I?.createTelemetryStore(),F=[new AppCheckProvider(L)],{loggerProvider:$,onErrorLogRecordProcessor:V}=createLoggerProvider(C,w,P,k,F),{tracingProvider:H,onErrorSpanProcessor:j}=I&&k?I.createTracingProvider(C,w,P,k,F):{tracingProvider:null,onErrorSpanProcessor:void 0},z=new CrashlyticsService(C,$,H,P,k,V,j);E&&(z.options=w),P.sessionId||startNewSession(z);const q=registerListeners(z),G=!1!==w.captureUnhandledErrors?function registerGlobalErrorListeners(_){if("undefined"==typeof window||!1===_.options?.captureUnhandledErrors)return()=>{};if(Ms){if(Ms.crashlytics===_)return()=>{};Ms.unsubscribe()}const errorListener=E=>{E.error&&E.error[ws]||recordError(_,E.error)},unhandledRejectionListener=E=>{E.reason&&E.reason[ws]||recordError(_,E.reason)};try{window.addEventListener("error",errorListener),window.addEventListener("unhandledrejection",unhandledRejectionListener)}catch(_){return console.warn("Firebase Crashlytics was not initialized:\n",_),()=>{}}let E=!1;const unsubscribe=()=>{E||(E=!0,Ms?.unsubscribe===unsubscribe&&(Ms=null),window.removeEventListener("error",errorListener),window.removeEventListener("unhandledrejection",unhandledRejectionListener))};return Ms={crashlytics:_,unsubscribe:unsubscribe},unsubscribe}(z):()=>{};return z.unsubscribeListeners((()=>{q(),G()})),z}),"PUBLIC").setMultipleInstances(!0)),_(_s,bs),_(_s,bs,"esm2020")}();export{breadcrumbs,flush,getCrashlytics,log,logViewBoundary,recordError,unregisterLoggerInstrumentations};
1
+ import{registerVersion as a,_registerComponent as S,_getProvider,getApp as C}from"https://www.gstatic.com/firebasejs/13.4.0/firebase-app.js";class FirebaseError extends Error{constructor(a,S,C){super(S),this.code=a,this.customData=C,this.name="FirebaseError",Object.setPrototypeOf(this,FirebaseError.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ErrorFactory.prototype.create)}}class ErrorFactory{constructor(a,S,C){this.service=a,this.serviceName=S,this.errors=C}create(a,...S){const C=S[0]||{},L=`${this.service}/${a}`,x=this.errors[a],I=x?function replaceTemplate(a,S){try{let C=0,L="";for(;C<a.length;){const x=a.indexOf("{$",C);if(-1===x){L+=a.substring(C);break}const I=a.indexOf("}",x+2);if(-1===I){L+=a.substring(C);break}const N=a.substring(x+2,I),B=S[N];L+=a.substring(C,x)+(null!=B?String(B):`<${N}?>`),C=I+1}return L}catch(S){return a}}(x,C):"Error",N=`${this.serviceName}: ${I} (${L}).`;return new FirebaseError(L,N,C)}}function deepEqual(a,S){if(a===S)return!0;const C=Object.keys(a),L=Object.keys(S);for(const x of C){if(!L.includes(x))return!1;const C=a[x],I=S[x];if(isObject(C)&&isObject(I)){if(!deepEqual(C,I))return!1}else if(C!==I)return!1}for(const a of L)if(!C.includes(a))return!1;return!0}function isObject(a){return null!==a&&"object"==typeof a}class Component{constructor(a,S,C){this.name=a,this.instanceFactory=S,this.type=C,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(a){return this.instantiationMode=a,this}setMultipleInstances(a){return this.multipleInstances=a,this}setServiceProps(a){return this.serviceProps=a,this}setInstanceCreatedCallback(a){return this.onInstanceCreated=a,this}}var L,x;!function(a){a.LAZY="LAZY",a.EAGER="EAGER",a.EXPLICIT="EXPLICIT"}(L||(L={})),function(a){a.PUBLIC="PUBLIC",a.PRIVATE="PRIVATE",a.VERSION="VERSION"}(x||(x={}));const I="1.10.0",N=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;const B=function _makeCompatibilityCheck(a){const S=new Set([a]),C=new Set,L=a.match(N);if(!L)return()=>!1;const x=+L[1],I=+L[2],B=+L[3];if(null!=L[4])return function isExactmatch(S){return S===a};function _reject(a){return C.add(a),!1}function _accept(a){return S.add(a),!0}return function isCompatible(a){if(S.has(a))return!0;if(C.has(a))return!1;const L=a.match(N);if(!L)return _reject(a);const $=+L[1],V=+L[2],H=+L[3];return null!=L[4]||x!==$?_reject(a):0===x?I===V&&B<=H?_accept(a):_reject(a):I<=V?_accept(a):_reject(a)}}(I),$=I.split(".")[0],V=Symbol.for(`opentelemetry.js.api.${$}`),H="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{};function registerGlobal(a,S,C,L=!1){var x;const N=H[V]=null!==(x=H[V])&&void 0!==x?x:function _makeGlobalApi(){return Object.defineProperty({},"version",{value:I,enumerable:!0,writable:!1,configurable:!1})}();if(!L&&N[a]){const S=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${a}`);return C.error(S.stack||S.message),!1}if("1.10.0"!==N.version){const S=new Error(`@opentelemetry/api: Registration of version v${N.version} for ${a} does not match previously registered API v${I}`);return C.error(S.stack||S.message),!1}return N[a]=S,C.debug(`@opentelemetry/api: Registered a global for ${a} v${I}.`),!0}let j;function getGlobal(a){const S=H[V];if(null!=S){if(S!==j){if(!S.version||!B(S.version))return;j=S}return S[a]}}function unregisterGlobal(a,S){S.debug(`@opentelemetry/api: Unregistering a global for ${a} v${I}.`);const C=H[V];C&&delete C[a]}var G=class{constructor(a){this._namespace=a.namespace||"DiagComponentLogger"}debug(...a){return logProxy("debug",this._namespace,a)}error(...a){return logProxy("error",this._namespace,a)}info(...a){return logProxy("info",this._namespace,a)}warn(...a){return logProxy("warn",this._namespace,a)}verbose(...a){return logProxy("verbose",this._namespace,a)}};function logProxy(a,S,C){const L=getGlobal("diag");if(L)return L[a](S,...C)}var Q=class DiagAPI{static instance(){return this._instance||(this._instance=new DiagAPI),this._instance}constructor(){function _logProxy(a){return function(...S){const C=getGlobal("diag");if(C)return C[a](...S)}}const a=this;a.setLogger=(S,C={logLevel:60})=>{var L;if(S===a){var x;const S=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return a.error(null!==(x=S.stack)&&void 0!==x?x:S.message),!1}"number"==typeof C&&(C={logLevel:C});const I=getGlobal("diag"),N=function createLogLevelDiagLogger(a,S){function _filterFunc(C,L){const x=S[C];return"function"==typeof x&&a>=L?x.bind(S):function(){}}return a<0?a=0:a>9999&&(a=9999),S=S||{},{error:_filterFunc("error",30),warn:_filterFunc("warn",50),info:_filterFunc("info",60),debug:_filterFunc("debug",70),verbose:_filterFunc("verbose",80)}}(null!==(L=C.logLevel)&&void 0!==L?L:60,S);if(I&&!C.suppressOverrideMessage){var B;const a=null!==(B=(new Error).stack)&&void 0!==B?B:"<failed to generate stacktrace>";I.warn(`Current logger will be overwritten from ${a}`),N.warn(`Current logger will overwrite one already registered from ${a}`)}return registerGlobal("diag",N,a,!0)},a.disable=()=>{unregisterGlobal("diag",a)},a.createComponentLogger=a=>new G(a),a.verbose=_logProxy("verbose"),a.debug=_logProxy("debug"),a.info=_logProxy("info"),a.warn=_logProxy("warn"),a.error=_logProxy("error")}},X=class BaggageImpl{constructor(a){this._entries=a?new Map(a):new Map}getEntry(a){const S=this._entries.get(a);if(S)return Object.assign({},S)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(a,S){const C=new BaggageImpl(this._entries);return C._entries.set(a,S),C}removeEntry(a){const S=new BaggageImpl(this._entries);return S._entries.delete(a),S}removeEntries(...a){const S=new BaggageImpl(this._entries);for(const C of a)S._entries.delete(C);return S}clear(){return new BaggageImpl}};function createBaggage(a={}){return new X(new Map(Object.entries(a)))}function createContextKey(a){return Symbol.for(a)}Q.instance();const Y=new class BaseContext{constructor(a){const S=this;S._currentContext=a?new Map(a):new Map,S.getValue=a=>S._currentContext.get(a),S.setValue=(a,C)=>{const L=new BaseContext(S._currentContext);return L._currentContext.set(a,C),L},S.deleteValue=a=>{const C=new BaseContext(S._currentContext);return C._currentContext.delete(a),C}}};var Z=class{},tt=class{addCallback(a){}removeCallback(a){}};const et=new class{constructor(){}createGauge(a,S){return nt}createHistogram(a,S){return st}createCounter(a,S){return rt}createUpDownCounter(a,S){return it}createObservableGauge(a,S){return at}createObservableCounter(a,S){return ot}createObservableUpDownCounter(a,S){return ct}addBatchObservableCallback(a,S){}removeBatchObservableCallback(a){}},rt=new class extends Z{add(a,S){}},nt=new class extends Z{record(a,S){}},st=new class extends Z{record(a,S){}},it=new class extends Z{add(a,S){}},ot=new class extends tt{},at=new class extends tt{},ct=new class extends tt{};function createNoopMeter(){return et}var ut=class NoopLogger{emit(a){}enabled(){return!1}};const lt=new ut;let dt=function(a){return a[a.UNSPECIFIED=0]="UNSPECIFIED",a[a.TRACE=1]="TRACE",a[a.TRACE2=2]="TRACE2",a[a.TRACE3=3]="TRACE3",a[a.TRACE4=4]="TRACE4",a[a.DEBUG=5]="DEBUG",a[a.DEBUG2=6]="DEBUG2",a[a.DEBUG3=7]="DEBUG3",a[a.DEBUG4=8]="DEBUG4",a[a.INFO=9]="INFO",a[a.INFO2=10]="INFO2",a[a.INFO3=11]="INFO3",a[a.INFO4=12]="INFO4",a[a.WARN=13]="WARN",a[a.WARN2=14]="WARN2",a[a.WARN3=15]="WARN3",a[a.WARN4=16]="WARN4",a[a.ERROR=17]="ERROR",a[a.ERROR2=18]="ERROR2",a[a.ERROR3=19]="ERROR3",a[a.ERROR4=20]="ERROR4",a[a.FATAL=21]="FATAL",a[a.FATAL2=22]="FATAL2",a[a.FATAL3=23]="FATAL3",a[a.FATAL4=24]="FATAL4",a}({});const ht={get(a,S){if(null!=a)return a[S]},keys:a=>null==a?[]:Object.keys(a)},pt={set(a,S,C){null!=a&&(a[S]=C)}};let gt=function(a){return a[a.NONE=0]="NONE",a[a.SAMPLED=1]="SAMPLED",a}({});const mt={traceId:"00000000000000000000000000000000",spanId:"0000000000000000",traceFlags:0};var ft=class{constructor(a=mt){this._spanContext=a}spanContext(){return this._spanContext}setAttribute(a,S){return this}setAttributes(a){return this}addEvent(a,S){return this}addLink(a){return this}addLinks(a){return this}setStatus(a){return this}updateName(a){return this}end(a){}isRecording(){return!1}recordException(a,S){}};const _t=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function isValidHex(a,S){if("string"!=typeof a||a.length!==S)return!1;let C=0;for(let S=0;S<a.length;S+=4)C+=(0|_t[a.charCodeAt(S)])+(0|_t[a.charCodeAt(S+1)])+(0|_t[a.charCodeAt(S+2)])+(0|_t[a.charCodeAt(S+3)]);return C===S}function isSpanContextValid(a){return function isValidTraceId(a){return isValidHex(a,32)&&"00000000000000000000000000000000"!==a}(a.traceId)&&function isValidSpanId(a){return isValidHex(a,16)&&"0000000000000000"!==a}(a.spanId)}function wrapSpanContext(a){return new ft(a)}const bt="context",yt=new class{active(){return Y}with(a,S,C,...L){return S.call(C,...L)}bind(a,S){return S}enable(){return this}disable(){return this}attach(a){return{dispose(){}}}},vt=Object.freeze({dispose:()=>{}});var wt=class ContextAPI{constructor(){this._attachUnsupportedWarned=!1}static getInstance(){return this._instance||(this._instance=new ContextAPI),this._instance}setGlobalContextManager(a){return registerGlobal(bt,a,Q.instance())}active(){return this._getContextManager().active()}with(a,S,C,...L){return this._getContextManager().with(a,S,C,...L)}bind(a,S){return this._getContextManager().bind(a,S)}attach(a){const S=this._getContextManager();return S.attach?S.attach(a):(this._attachUnsupportedWarned||(this._attachUnsupportedWarned=!0,Q.instance().warn("The current ContextManager does not implement attach(). The context will not be attached. Use a ContextManager that supports attach() (e.g. AsyncLocalStorageContextManager) or use with()/bind() instead.")),vt)}_getContextManager(){return getGlobal(bt)||yt}disable(){this._getContextManager().disable(),unregisterGlobal(bt,Q.instance())}};const St=createContextKey("OpenTelemetry Context Key SPAN");function getSpan(a){return a.getValue(St)||void 0}function getActiveSpan(){return getSpan(wt.getInstance().active())}function setSpan(a,S){return a.setValue(St,S)}function deleteSpan(a){return a.deleteValue(St)}function setSpanContext(a,S){return setSpan(a,new ft(S))}function getSpanContext(a){var S;return null===(S=getSpan(a))||void 0===S?void 0:S.spanContext()}const Tt=wt.getInstance();var Et=class{startSpan(a,S,C=Tt.active()){if(Boolean(null==S?void 0:S.root))return new ft;const L=C&&getSpanContext(C);return function isSpanContext(a){return null!==a&&"object"==typeof a&&"spanId"in a&&"string"==typeof a.spanId&&"traceId"in a&&"string"==typeof a.traceId&&"traceFlags"in a&&"number"==typeof a.traceFlags}(L)&&isSpanContextValid(L)?new ft(L):new ft}startActiveSpan(a,S,C,L){var x;let I,N,B;if(arguments.length<2)return;2===arguments.length?B=S:3===arguments.length?(I=S,B=C):(I=S,N=C,B=L);const $=null!==(x=N)&&void 0!==x?x:Tt.active(),V=this.startSpan(a,I,$),H=setSpan($,V);return Tt.with(H,B,void 0,V)}};const Ct=new Et;var At=class{constructor(a,S,C,L){this._provider=a,this.name=S,this.version=C,this.options=L}startSpan(a,S,C){return this._getTracer().startSpan(a,S,C)}startActiveSpan(a,S,C,L){const x=this._getTracer();return Reflect.apply(x.startActiveSpan,x,arguments)}_getTracer(){if(this._delegate)return this._delegate;const a=this._provider.getDelegateTracer(this.name,this.version,this.options);return a?(this._delegate=a,this._delegate):Ct}};let Lt=function(a){return a[a.INTERNAL=0]="INTERNAL",a[a.SERVER=1]="SERVER",a[a.CLIENT=2]="CLIENT",a[a.PRODUCER=3]="PRODUCER",a[a.CONSUMER=4]="CONSUMER",a}({}),xt=function(a){return a[a.UNSET=0]="UNSET",a[a.OK=1]="OK",a[a.ERROR=2]="ERROR",a}({});const Rt=new class{getTracer(a,S,C){return new Et}};var It=class{getTracer(a,S,C){var L;return null!==(L=this.getDelegateTracer(a,S,C))&&void 0!==L?L:new At(this,a,S,C)}getDelegate(){var a;return null!==(a=this._delegate)&&void 0!==a?a:Rt}setDelegate(a){this._delegate=a}getDelegateTracer(a,S,C){var L;return null===(L=this._delegate)||void 0===L?void 0:L.getTracer(a,S,C)}};let Pt=function(a){return a[a.NOT_RECORD=0]="NOT_RECORD",a[a.RECORD=1]="RECORD",a[a.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED",a}({});const Ot=wt.getInstance(),kt=Q.instance();const Dt=new class NoopLoggerProvider{getLogger(a,S,C){return new ut}};var Nt=class ProxyLogger{constructor(a,S,C,L){this._provider=a,this.name=S,this.version=C,this.options=L}emit(a){this._getLogger().emit(a)}enabled(a){return this._getLogger().enabled(a)}_getLogger(){if(this._delegate)return this._delegate;const a=this._provider._getDelegateLogger(this.name,this.version,this.options);return a?(this._delegate=a,this._delegate):lt}},Ft=class ProxyLoggerProvider{getLogger(a,S,C){var L;return null!==(L=this._getDelegateLogger(a,S,C))&&void 0!==L?L:new Nt(this,a,S,C)}_getDelegate(){var a;return null!==(a=this._delegate)&&void 0!==a?a:Dt}_setDelegate(a){this._delegate=a}_getDelegateLogger(a,S,C){var L;return null===(L=this._delegate)||void 0===L?void 0:L.getLogger(a,S,C)}};const Mt="logs";const Ut=class LogsAPI{constructor(){this._proxyLoggerProvider=new Ft}static getInstance(){return this._instance||(this._instance=new LogsAPI),this._instance}setGlobalLoggerProvider(a){const S=registerGlobal(Mt,a,Q.instance());return S&&this._proxyLoggerProvider._setDelegate(a),S}getLoggerProvider(){return getGlobal(Mt)||this._proxyLoggerProvider}getLogger(a,S,C){return this.getLoggerProvider().getLogger(a,S,C)}disable(){unregisterGlobal(Mt,Q.instance()),this._proxyLoggerProvider=new Ft}}.getInstance();const Bt=new class{getMeter(a,S,C){return et}},$t="metrics";const Vt=class MetricsAPI{constructor(){}static getInstance(){return this._instance||(this._instance=new MetricsAPI),this._instance}setGlobalMeterProvider(a){return registerGlobal($t,a,Q.instance())}getMeterProvider(){return getGlobal($t)||Bt}getMeter(a,S,C){return this.getMeterProvider().getMeter(a,S,C)}disable(){unregisterGlobal($t,Q.instance())}}.getInstance();const zt=createContextKey("OpenTelemetry Baggage Key");function getBaggage(a){return a.getValue(zt)||void 0}function getActiveBaggage(){return getBaggage(wt.getInstance().active())}function setBaggage(a,S){return a.setValue(zt,S)}function deleteBaggage(a){return a.deleteValue(zt)}const Ht="propagation",jt=new class{inject(a,S){}extract(a,S){return a}fields(){return[]}};const qt=class PropagationAPI{constructor(){this.createBaggage=createBaggage,this.getBaggage=getBaggage,this.getActiveBaggage=getActiveBaggage,this.setBaggage=setBaggage,this.deleteBaggage=deleteBaggage}static getInstance(){return this._instance||(this._instance=new PropagationAPI),this._instance}setGlobalPropagator(a){return registerGlobal(Ht,a,Q.instance())}inject(a,S,C=pt){return this._getGlobalPropagator().inject(a,S,C)}extract(a,S,C=ht){return this._getGlobalPropagator().extract(a,S,C)}fields(){return this._getGlobalPropagator().fields()}disable(){unregisterGlobal(Ht,Q.instance())}_getGlobalPropagator(){return getGlobal(Ht)||jt}}.getInstance(),Gt="trace";const Wt=class TraceAPI{constructor(){this._proxyTracerProvider=new It,this.wrapSpanContext=wrapSpanContext,this.isSpanContextValid=isSpanContextValid,this.deleteSpan=deleteSpan,this.getSpan=getSpan,this.getActiveSpan=getActiveSpan,this.getSpanContext=getSpanContext,this.setSpan=setSpan,this.setSpanContext=setSpanContext}static getInstance(){return this._instance||(this._instance=new TraceAPI),this._instance}setGlobalTracerProvider(a){const S=registerGlobal(Gt,this._proxyTracerProvider,Q.instance());return S&&this._proxyTracerProvider.setDelegate(a),S}getTracerProvider(){return getGlobal(Gt)||this._proxyTracerProvider}getTracer(a,S){return this.getTracerProvider().getTracer(a,S)}disable(){unregisterGlobal(Gt,Q.instance()),this._proxyTracerProvider=new It}}.getInstance(),Kt=createContextKey("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function suppressTracing(a){return a.setValue(Kt,!0)}function isTracingSuppressed(a){return!0===a.getValue(Kt)}let Qt=function(a){return a[a.DROP_UNDEFINED=0]="DROP_UNDEFINED",a[a.DROP_INVALID=1]="DROP_INVALID",a[a.DROP_LIMIT_REACHED=2]="DROP_LIMIT_REACHED",a[a.ADD_NEW=3]="ADD_NEW",a[a.ADD_OVERWRITE_EXISTING=4]="ADD_OVERWRITE_EXISTING",a}({});function maybeAddAttribute(a){return function maybeAddAttributeInternal(a,S){if(void 0===a.value)return 0;if(0===a.key.length)return kt.warn(`Invalid attribute key: ${a.key}`),1;const C=!Object.hasOwn(a.attributes,a.key);if(C&&a.currentAttributesCount>=a.limits.attributeCountLimit)return 2;if(!S(a.value))return kt.warn(`Invalid attribute value set for key: ${a.key}`),1;let L=a.limits.attributeValueLengthLimit;L<=0&&(kt.warn(`Invalid attributeValueLengthLimit: must be positive, got ${L} (ignoring)`),L=1/0);return a.attributes[a.key]=copyAndTruncAnyValue(a.value,L),C?3:4}(a,isAnyValue)}function cleanAttributes(a,S){return cleanAttributesInternal(a,S,isAnyValue)}function cleanSimpleAttributes(a,S){return cleanAttributesInternal(a,S,isSimpleAttributeValue)}function cleanAttributesInternal(a,S,C){if("object"!=typeof a||null==a)return{};const L={};let x=0,I=S.attributeValueLengthLimit;I<=0&&(kt.warn(`Invalid attributeValueLengthLimit: must be positive, got ${I} (ignoring)`),I=1/0);let N=0;for(const[B,$]of Object.entries(a))void 0!==$&&(N>=S.attributeCountLimit?x++:0!==B.length?C($)?(L[B]=copyAndTruncAnyValue($,I),N++):(kt.warn(`Invalid attribute value set for key: ${B}`),x++):(kt.warn(`Invalid attribute key: ${B}`),x++));return{attributes:L,droppedAttributesCount:x}}function isAnyValue(a){return isAnyValueInternal(a,new WeakSet)}function isAnyValueInternal(a,S){switch(typeof a){case"undefined":case"bigint":case"symbol":case"function":default:return!1;case"string":case"number":case"boolean":return!0;case"object":}if(null===a)return!0;if(a instanceof Uint8Array)return!0;if(S.has(a))return!1;S.add(a);const C=function isAnyValueObject(a,S){if(Array.isArray(a)){for(const C of a)if(void 0!==C&&!isAnyValueInternal(C,S))return!1;return!0}const C=a;if(C.constructor!==Object&&void 0!==C.constructor)return!1;for(const a of Object.keys(C)){const L=C[a];if(void 0!==L&&!isAnyValueInternal(L,S))return!1}return!0}(a,S);return S.delete(a),C}function copyAndTruncAnyValue(a,S){switch(typeof a){case"number":case"boolean":case"undefined":case"bigint":case"symbol":case"function":default:return a;case"string":return a.length<=S?a:a.substring(0,S);case"object":}if(null===a)return a;if(a instanceof Uint8Array)return a.length<=S?a:a.slice(0,S);if(Array.isArray(a))return a.map((a=>copyAndTruncAnyValue(a,S)));const C={},L=a;for(const a of Object.keys(L))void 0!==L[a]&&(C[a]=copyAndTruncAnyValue(L[a],S));return C}function isSimpleAttributeValue(a){return Array.isArray(a)?function isHomogeneousAttributeValueArray(a){let S;for(const C of a){if(null==C)continue;const a=typeof C;if(a!==S){if(!S){if(isValidPrimitiveAttributeValueType(a)){S=a;continue}return!1}return!1}}return!0}(a):isValidPrimitiveAttributeValueType(typeof a)}function isValidPrimitiveAttributeValueType(a){switch(a){case"number":case"boolean":case"string":return!0}return!1}let Xt=function loggingErrorHandler(){return a=>{kt.error(function stringifyException(a){return"string"==typeof a?a:JSON.stringify(function flattenException(a){const S={};let C=a;for(;null!==C;)Object.getOwnPropertyNames(C).forEach((a=>{if(S[a])return;const L=C[a];L&&(S[a]=String(L))})),C=Object.getPrototypeOf(C);return S}(a))}(a))}}();function globalErrorHandler(a){try{Xt(a)}catch{}}const Jt=Math.pow(10,6),Yt=Math.pow(10,9);function millisToHrTime(a){const S=a/1e3;return[Math.trunc(S),Math.round(a%1e3*Jt)]}function hrTime(a){return addHrTimes(millisToHrTime(performance.timeOrigin),millisToHrTime("number"==typeof a?a:performance.now()))}function timeInputToHrTime(a){if(isTimeInputHrTime(a))return a;if("number"==typeof a)return a<performance.timeOrigin/2?hrTime(a):millisToHrTime(a);if(a instanceof Date)return millisToHrTime(a.getTime());throw TypeError("Invalid input type")}function hrTimeDuration(a,S){let C=S[0]-a[0],L=S[1]-a[1];return L<0&&(C-=1,L+=Yt),[C,L]}function hrTimeToNanoseconds(a){return a[0]*Yt+a[1]}function isTimeInputHrTime(a){return Array.isArray(a)&&2===a.length&&"number"==typeof a[0]&&"number"==typeof a[1]}function isTimeInput(a){return isTimeInputHrTime(a)||"number"==typeof a||a instanceof Date}function addHrTimes(a,S){const C=[a[0]+S[0],a[1]+S[1]];return C[1]>=Yt&&(C[1]-=Yt,C[0]+=1),C}let Zt=function(a){return a[a.SUCCESS=0]="SUCCESS",a[a.FAILED=1]="FAILED",a}({});var te=class{constructor(a={}){this._propagators=a.propagators??[];const S=new Set;for(const a of this._propagators){const C="function"==typeof a.fields?a.fields():[];for(const a of C)S.add(a)}this._fields=Array.from(S)}inject(a,S,C){for(const L of this._propagators)try{L.inject(a,S,C)}catch(a){kt.warn(`Failed to inject with ${L.constructor.name}. Err: ${a.message}`)}}extract(a,S,C){return this._propagators.reduce(((a,L)=>{try{return L.extract(a,S,C)}catch(a){kt.warn(`Failed to extract with ${L.constructor.name}. Err: ${a.message}`)}return a}),a)}fields(){return this._fields.slice()}};const ee="[_0-9a-z-*/]",re=new RegExp(`^(?:[a-z]${ee}{0,255}|[a-z0-9]${ee}{0,240}@[a-z]${ee}{0,13})$`),ne=/^[ -~]{0,255}[!-~]$/,se=/,|=/;function validateKey(a){return re.test(a)}function validateValue(a){return ne.test(a)&&!se.test(a)}var ie=class TraceState{constructor(a){this._rawTraceState="string"==typeof a?a:"",this._length=this._rawTraceState.length}set(a,S){if(!validateKey(a)||!validateValue(S))return this;const C=this._getState(),L=C.get(a);let x=this._length;if("string"==typeof L)x+=S.length-L.length;else{if(C.size>=32)return this;x+=a.length+S.length+(C.size>0?2:1)}if(x>512)return this;const I=new Map(C);return I.delete(a),I.set(a,S),this._fromState(I,x)}unset(a){const S=this._getState(),C=S.get(a);if("string"!=typeof C)return this;let L=this._length-(a.length+C.length+1);S.size>1&&(L-=1);const x=new Map(S);return x.delete(a),this._fromState(x,L)}get(a){return this._getState().get(a)}serialize(){let a="",S=0;for(const C of this._getState())S>0&&(a=","+a),a=`${C[0]}=${C[1]}`+a,S++;return a}_getState(){if(this._internalState)return this._internalState;const a=this._rawTraceState.split(","),S=new Map;let C=0;for(const L of a){const a=L.trim(),x=a.indexOf("=");if(-1===x)continue;const I=a.slice(0,x),N=a.slice(x+1);if(!validateKey(I)||!validateValue(N))continue;const B=C+a.length+(S.size>0?1:0);if(!(B>512)&&(S.set(I,N),C=B,S.size>=32))break}return this._length=C,this._internalState=new Map(Array.from(S.entries()).reverse()),this._internalState}_fromState(a,S){const C=Object.create(TraceState.prototype);return C._internalState=a,C._length=S,C}};const oe="traceparent",ae="tracestate",ce=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");var ue=class{inject(a,S,C){const L=Wt.getSpanContext(a);if(!L||isTracingSuppressed(a)||!isSpanContextValid(L))return;const x=`00-${L.traceId}-${L.spanId}-0${Number(L.traceFlags||gt.NONE).toString(16)}`;C.set(S,oe,x),L.traceState&&C.set(S,ae,L.traceState.serialize())}extract(a,S,C){const L=C.get(S,oe);if(!L)return a;const x=Array.isArray(L)?L[0]:L;if("string"!=typeof x)return a;const I=function parseTraceParent(a){const S=ce.exec(a);return S?"00"===S[1]&&S[5]?null:{traceId:S[2],spanId:S[3],traceFlags:parseInt(S[4],16)}:null}(x);if(!I)return a;I.isRemote=!0;const N=C.get(S,ae);if(N){const a=Array.isArray(N)?N.join(","):N;I.traceState=new ie("string"==typeof a?a:void 0)}return Wt.setSpanContext(a,I)}fields(){return[oe,ae]}},le=class TimeoutError extends Error{constructor(a){super(a),Object.setPrototypeOf(this,TimeoutError.prototype)}};function urlMatches(a,S){return"string"==typeof S?a===S:!!a.match(S)}function isUrlIgnored(a,S){if(!S)return!1;for(const C of S)if(urlMatches(a,C))return!0;return!1}var de=class{constructor(){this._promise=new Promise(((a,S)=>{this._resolve=a,this._reject=S}))}get promise(){return this._promise}resolve(a){this._resolve(a)}reject(a){this._reject(a)}},he=class{constructor(a,S){this._isCalled=!1,this._deferred=new de,this._callback=a,this._that=S}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...a){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...a)).then((a=>this._deferred.resolve(a)),(a=>this._deferred.reject(a)))}catch(a){this._deferred.reject(a)}}return this._deferred.promise}};const pe="process.runtime.name",ge="error.type",me="exception.message",fe="exception.stacktrace",_e="exception.type",be="http.request.method",ye="http.request.method_original",ve="http.response.status_code",we="server.address",Se="server.port",Te="service.name",Ee="telemetry.sdk.language",Ce="telemetry.sdk.name",Ae="telemetry.sdk.version",Le="url.full",xe={[Ce]:"opentelemetry",[pe]:"browser",[Ee]:"webjs",[Ae]:"3.1.1"},Re={};var Ie=class{get hrTime(){return this._hrTime}set hrTime(a){this._isLogRecordReadonly()||(this._hrTime=a)}get hrTimeObserved(){return this._hrTimeObserved}set hrTimeObserved(a){this._isLogRecordReadonly()||(this._hrTimeObserved=a)}get spanContext(){return this._spanContext}set spanContext(a){this._isLogRecordReadonly()||(this._spanContext=a)}set severityText(a){this._isLogRecordReadonly()||(this._severityText=a)}get severityText(){return this._severityText}set severityNumber(a){this._isLogRecordReadonly()||(this._severityNumber=a)}get severityNumber(){return this._severityNumber}set body(a){this._isLogRecordReadonly()||(this._body=a)}get body(){return this._body}get eventName(){return this._eventName}set eventName(a){this._isLogRecordReadonly()||(this._eventName=a)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(a,S,C){this.attributes={},this._attributesCount=0,this._droppedAttributesCount=0,this._isReadonly=!1;const{timestamp:L,observedTimestamp:x,eventName:I,severityNumber:N,severityText:B,body:$,attributes:V={},exception:H,context:j}=C,G=Date.now();if(this._hrTime=timeInputToHrTime(L??G),this._hrTimeObserved=timeInputToHrTime(x??G),j){const a=Wt.getSpanContext(j);a&&isSpanContextValid(a)&&(this._spanContext=a)}this.severityNumber=N,this.severityText=B,this.body=$,this.resource=a.resource,this.instrumentationScope=S,this._logRecordLimits=a.logRecordLimits,this._eventName=I,this.setAttributes(V),null!=H&&this._setException(H)}setAttribute(a,S){if(this._isLogRecordReadonly())return this;const C=maybeAddAttribute({key:a,value:S,attributes:this.attributes,limits:this._logRecordLimits,currentAttributesCount:this._attributesCount});return C===Qt.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,1===this._droppedAttributesCount&&kt.warn("Dropping extra attributes.")):C===Qt.ADD_NEW&&this._attributesCount++,this}setAttributes(a){for(const[S,C]of Object.entries(a))this.setAttribute(S,C);return this}setBody(a){return this.body=a,this}setEventName(a){return this.eventName=a,this}setSeverityNumber(a){return this.severityNumber=a,this}setSeverityText(a){return this.severityText=a,this}_makeReadonly(){this._isReadonly=!0}_setException(a){let S=!1;if("string"==typeof a||"number"==typeof a)Object.hasOwn(this.attributes,me)||this.setAttribute(me,String(a)),S=!0;else if(a&&"object"==typeof a){const C=a;C.code?(Object.hasOwn(this.attributes,_e)||this.setAttribute(_e,C.code.toString()),S=!0):C.name&&(Object.hasOwn(this.attributes,_e)||this.setAttribute(_e,C.name),S=!0),C.message&&(Object.hasOwn(this.attributes,me)||this.setAttribute(me,C.message),S=!0),C.stack&&(Object.hasOwn(this.attributes,fe)||this.setAttribute(fe,C.stack),S=!0)}S||kt.warn(`Failed to record an exception ${a}`)}_isLogRecordReadonly(){return this._isReadonly&&kt.warn("Can not execute the operation on emitted log record"),this._isReadonly}},Pe=class{constructor(a,S){this._instrumentationScope=a,this._sharedState=S,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(a){const S=a.context||Ot.active();if(!this.enabled(a))return;const C=new Ie(this._sharedState,this._instrumentationScope,{context:S,...a});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(C,S),C._makeReadonly()}enabled(a){if(this._sharedState.hasShutdown)return!1;const S=this._loggerConfig;if(!S.enabled)return!1;const C=a?.severityNumber;if("number"==typeof C&&C!==dt.UNSPECIFIED&&C<S.minimumSeverity)return!1;const L=a?.context||Ot.active();if(S.traceBased){const a=Wt.getSpanContext(L);if(a&&isSpanContextValid(a)&&(a.traceFlags&gt.SAMPLED)!==gt.SAMPLED)return!1}const x={context:L,instrumentationScope:this._instrumentationScope,severityNumber:a?.severityNumber,eventName:a?.eventName};for(const a of this._sharedState.processors)if(!a.enabled||a.enabled(x))return!0;return!1}};function normalizeAnyValue(a){if(void 0===a)return["u",null];if(null===a)return["n",null];const S=typeof a;return"string"===S?["s",a]:"boolean"===S?["b",a]:"number"===S?Number.isNaN(a)?["nan",null]:a===1/0?["inf",null]:a===-1/0?["-inf",null]:Object.is(a,-0)?["n0",null]:["d",a]:a instanceof Uint8Array?["bytes",Array.from(a)]:Array.isArray(a)?["arr",a.map(normalizeAnyValue)]:["map",Object.entries(a).sort((([a],[S])=>a.localeCompare(S))).map((([a,S])=>[a,normalizeAnyValue(S)]))]}function getInstrumentationScopeKey(a){return JSON.stringify([a.name,a.version||"",a.schemaUrl||"",normalizeAnyValue(a.attributes??{}),a.droppedAttributesCount??0])}var Oe=class{forceFlush(){return Promise.resolve()}onEmit(a,S){}shutdown(){return Promise.resolve()}enabled(a){return!1}},ke=class{constructor(a){this.processors=a}async forceFlush(a){const S=a?.timeoutMillis??3e4;await Promise.all(this.processors.map((a=>function callWithTimeout(a,S){let C;const L=new Promise((function timeoutFunction(a,L){C=setTimeout((function timeoutHandler(){L(new le("Operation timed out."))}),S)}));return Promise.race([a,L]).then((a=>(clearTimeout(C),a)),(a=>{throw clearTimeout(C),a}))}(a.forceFlush(),S))))}onEmit(a,S){this.processors.forEach((C=>C.onEmit(a,S)))}async shutdown(){await Promise.all(this.processors.map((a=>a.shutdown())))}enabled(a){for(const S of this.processors)if(!S.enabled||S.enabled(a))return!0;return!1}};const De="otel.component.name",Ne="otel.component.type",Fe="error.type";var Me=class{constructor(a){this.createdLogs=a.createCounter("otel.sdk.log.created",{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}};const Ue={enabled:!0,minimumSeverity:dt.UNSPECIFIED,traceBased:!1},DEFAULT_LOGGER_CONFIGURATOR=()=>({...Ue});var Be=class{constructor(a,S,C,L,x){this.loggers=new Map,this.registeredLogRecordProcessors=[],this.hasShutdown=!1,this._loggerConfigs=new Map,this.resource=a,this.logRecordLimits=S,this.processors=C,C.length>0?(this.registeredLogRecordProcessors=C,this.activeProcessor=new ke(this.registeredLogRecordProcessors)):this.activeProcessor=new Oe,this._loggerConfigurator=L??DEFAULT_LOGGER_CONFIGURATOR;const I=x?x.getMeter("@opentelemetry/sdk-logs","3.1.1"):createNoopMeter();this.loggerMetrics=new Me(I)}getLoggerConfig(a){const S=getInstrumentationScopeKey(a);let C=this._loggerConfigs.get(S);return C||(C=this._loggerConfigurator(a),this._loggerConfigs.set(S,C),C)}};const isPromiseLike=a=>null!==a&&"object"==typeof a&&"function"==typeof a.then;var $e=class ResourceImpl{static FromAttributeList(a,S){const C=new ResourceImpl({},S);return C._rawAttributes=guardedRawAttributes(a),C._asyncAttributesPending=a.filter((([a,S])=>isPromiseLike(S))).length>0,C}constructor(a,S){this._asyncAttributesPending=!1;const C=a.attributes??{};this._rawAttributes=Object.entries(C).map((([a,S])=>(isPromiseLike(S)&&(this._asyncAttributesPending=!0),[a,S]))),this._rawAttributes=guardedRawAttributes(this._rawAttributes),this._schemaUrl=function validateSchemaUrl(a){if("string"==typeof a||void 0===a)return a;kt.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",a)}(S?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let a=0;a<this._rawAttributes.length;a++){const[S,C]=this._rawAttributes[a];this._rawAttributes[a]=[S,isPromiseLike(C)?await C:C]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&kt.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const a={};for(const[S,C]of this._rawAttributes)isPromiseLike(C)?kt.debug(`Unsettled resource attribute ${S} skipped`):Object.hasOwn(a,S)||(0===S.length?kt.warn("dropping invalid resource attribute key: <empty string>"):isSimpleAttributeValue(C)?a[S]=C:kt.warn(`dropping invalid resource attribute value for key "${S}"`));return this._asyncAttributesPending||(this._memoizedAttributes=a),a}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(a){if(null==a)return this;const S=function mergeSchemaUrl(a,S){const C=a?.schemaUrl,L=S?.schemaUrl,x=void 0===L||""===L;if(void 0===C||""===C)return L;if(x)return C;if(C===L)return C;kt.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',C,L)}(this,a),C=S?{schemaUrl:S}:void 0;return ResourceImpl.FromAttributeList([...a.getRawAttributes(),...this.getRawAttributes()],C)}};function resourceFromAttributes(a,S){return $e.FromAttributeList(Object.entries(a),S)}function defaultResource(){return resourceFromAttributes({[Te]:"unknown_service",[Ee]:xe[Ee],[Ce]:xe[Ce],[Ae]:xe[Ae]})}function guardedRawAttributes(a){return a.map((([a,S])=>isPromiseLike(S)?[a,S.then((a=>a),(S=>{kt.debug("promise rejection for resource attribute: %s - %s",a,S)}))]:[a,S]))}var Ve=class{constructor(a={}){const S={resource:a.resource??defaultResource(),logRecordLimits:{attributeCountLimit:a.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:a.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:a.loggerConfigurator??DEFAULT_LOGGER_CONFIGURATOR,processors:a.processors??[],meterProvider:a.meterProvider};this._sharedState=new Be(S.resource,S.logRecordLimits,S.processors,S.loggerConfigurator,S.meterProvider),this._shutdownOnce=new he(this._shutdown,this)}getLogger(a,S,C){if(this._shutdownOnce.isCalled)return kt.warn("A shutdown LoggerProvider cannot provide a Logger"),function createNoopLogger(){return lt}();a||kt.warn("Logger requested without instrumentation scope name.");const L={name:a||"unknown",version:S,schemaUrl:C?.schemaUrl,...cleanSimpleAttributes(C?.attributes,this._sharedState.logRecordLimits)},x=getInstrumentationScopeKey(L);return this._sharedState.loggers.has(x)||this._sharedState.loggers.set(x,new Pe(L,this._sharedState)),this._sharedState.loggers.get(x)}forceFlush(a){return this._shutdownOnce.isCalled?(kt.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush(a)}shutdown(){return this._shutdownOnce.isCalled?(kt.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.hasShutdown=!0,this._sharedState.activeProcessor.shutdown()}};const ze=new Map;var He=class{constructor(a,S,C){const L=ze.get(a)??0;if(ze.set(a,L+1),this.standardAttrs={[Ne]:a,[De]:`${a}/${L}`},this.droppedAttrs={...this.standardAttrs,[Fe]:"queue_full"},this.processedLogs=S.createCounter("otel.sdk.processor.log.processed",{unit:"{log_record}",description:"The number of log records for which the processing has finished, either successful or failed."}),C){const{capacity:a,getQueueSize:L}=C;S.createUpDownCounter("otel.sdk.processor.log.queue.capacity",{unit:"{log_record}",description:"The maximum number of log records the queue of a given instance of an SDK log processor can hold."}).add(a,this.standardAttrs),this.queueSize=S.createObservableUpDownCounter("otel.sdk.processor.log.queue.size",{unit:"{log_record}",description:"The number of log records in the queue of a given instance of an SDK log processor."}),this.queueSizeCallback=a=>a.observe(L(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropLogs(a){this.processedLogs.add(a,this.droppedAttrs)}finishLogs(a,S){if(!S)return void this.processedLogs.add(a,this.standardAttrs);const C={...this.standardAttrs,[Fe]:S.name};this.processedLogs.add(a,C)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};var je=class{constructor(a,S,C,L){this._exportScheduledPromise=new Promise((a=>{this._exportScheduledResolve=a})),this._exportCompleted=this._executeExport(a,S,C),this._metrics=L}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(a,S,C){try{await async function waitForResources(a){let S=null;for(let C=0,L=a.length;C<L;C++){const L=a[C].resource;L.asyncAttributesPending&&L.waitForAsyncAttributes&&(S??(S=new Set),S.add(L))}null!==S&&await Promise.all(Array.from(S,(a=>a.waitForAsyncAttributes?.())))}(S),await Ot.with(suppressTracing(Ot.active()),(async()=>this._exportWithTimeout(a,S,C)))}catch(a){globalErrorHandler(a),this._exportScheduledResolve()}}async _exportWithTimeout(a,S,C){return new Promise(((L,x)=>{const I=setTimeout((()=>{x(new Error("Timeout"))}),C);a.export(S,(a=>{this._metrics.finishLogs(S.length,a.error),clearTimeout(I),a.code===Zt.SUCCESS?L():x(a.error??new Error("BatchLogRecordProcessor: log record export failed"))})),this._exportScheduledResolve()}))}},qe=class{constructor(a){this._currentExport=null,this._finishedLogRecords=[],this._flushing=!1,this._exporter=a.exporter,this._maxExportBatchSize=a.maxExportBatchSize??512,this._maxQueueSize=a.maxQueueSize??2048,this._scheduledDelayMillis=a.scheduledDelayMillis??1e3,this._exportTimeoutMillis=a.exportTimeoutMillis??3e4,this._shutdownOnce=new he(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(kt.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);const S=a?.selfObsMeterProvider?a.selfObsMeterProvider.getMeter("@opentelemetry/sdk-logs"):createNoopMeter();this._metrics=new He("batching_log_processor",S,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedLogRecords.length})}onEmit(a){this._shutdownOnce.isCalled||this._addToBuffer(a)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(a){this._finishedLogRecords.length>=this._maxQueueSize?this._metrics.dropLogs(1):(this._finishedLogRecords.push(a),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),this._metrics.shutdown(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let a=this._finishedLogRecords;this._finishedLogRecords=[],this._clearTimer();const S=this._currentExport;for(null!==S&&(await this._exporter.forceFlush(),await S.exportCompleted,this._currentExport=null);a.length>0;){let S;a.length<=this._maxExportBatchSize?(S=a,a=[]):S=a.splice(0,this._maxExportBatchSize);const C=new je(this._exporter,S,this._exportTimeoutMillis,this._metrics);this._currentExport=C;try{await C.exportScheduled,await this._exporter.forceFlush(),await C.exportCompleted}catch(a){globalErrorHandler(a)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(0===this._finishedLogRecords.length)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){const a=this._finishedLogRecords;return this._finishedLogRecords=[],a}return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();const a=this._extractBatch();if(null===a)return;const S=new je(this._exporter,a,this._exportTimeoutMillis,this._metrics);this._currentExport=S,S.exportCompleted.then((()=>{this._currentExport=null,this._maybeStartTimer()})).catch((a=>{this._currentExport=null,globalErrorHandler(a),this._maybeStartTimer()}))}_maybeStartTimer(){this._shutdownOnce.isCalled||this._flushing||0!==this._finishedLogRecords.length&&null===this._currentExport&&(this._finishedLogRecords.length>=this._maxExportBatchSize?this._exportOneBatch():void 0===this._timer&&(this._timer=setTimeout((()=>{this._timer=void 0,this._exportOneBatch()}),this._scheduledDelayMillis),function unrefTimer$1(a){const S=a;"number"!=typeof S&&S.unref?.()}(this._timer)))}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}};var Ge=class extends qe{constructor(a){super(a),this._onInit(a)}onShutdown(){"undefined"!=typeof document&&this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener)}_onInit(a){!0!==a.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch((a=>{globalErrorHandler(a)}))},document.addEventListener("visibilitychange",this._visibilityChangeListener))}};const We="service.name",Ke={name:"span",countItems:a=>a.length},Qe={name:"log",countItems:a=>a.length};function estimateVarintSize(a){return a<0?10:a<128?1:a<16384?2:a<2097152?3:a<268435456?4:a<34359738368?5:a<4398046511104?6:a<562949953421312?7:a<72057594037927940?8:9}function utf8ByteLength(a){let S=0;for(let C=0;C<a.length;C++){const L=a.charCodeAt(C);L<128?S++:L<2048?S+=2:L>=55296&&L<=56319&&a.charCodeAt(C+1)>=56320&&a.charCodeAt(C+1)<=57343?(S+=4,C++):S+=3}return S}var Xe=class{constructor(a=65536){this.pos=0,this._buffer=new Uint8Array(a),this._textEncoder=new TextEncoder,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}_ensureCapacity(a){const S=this.pos+a;if(S<=this._buffer.length)return;kt.debug("ProtobufWriter: estimated size was too small, growing buffer.");let C=2*this._buffer.length;for(;C<S;)C*=2;const L=new Uint8Array(C);L.set(this._buffer),this._buffer=L,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}finish(){return this._buffer.subarray(0,this.pos)}startLengthDelimited(){const a=this.pos;return this._ensureCapacity(1),this.pos+=1,a}finishLengthDelimited(a,S){const C=S>>>0,L=estimateVarintSize(C);if(L>1){const S=L-1;this._ensureCapacity(S),this._buffer.copyWithin(a+L,a+1,this.pos),this.pos+=S}let x=a;C<128?this._buffer[x]=C:C<16384?(this._buffer[x++]=127&C|128,this._buffer[x]=C>>>7):C<2097152?(this._buffer[x++]=127&C|128,this._buffer[x++]=C>>>7&127|128,this._buffer[x]=C>>>14):C<268435456?(this._buffer[x++]=127&C|128,this._buffer[x++]=C>>>7&127|128,this._buffer[x++]=C>>>14&127|128,this._buffer[x]=C>>>21):(this._buffer[x++]=127&C|128,this._buffer[x++]=C>>>7&127|128,this._buffer[x++]=C>>>14&127|128,this._buffer[x++]=C>>>21&127|128,this._buffer[x]=C>>>28)}writeSint32(a){this.writeVarint((a<<1^a>>31)>>>0)}writeSfixed64(a){let S,C;if(a>=0)S=a>>>0,C=a/4294967296>>>0;else{const L=Math.abs(a);S=L>>>0,C=L/4294967296>>>0,S=~S>>>0,C=~C>>>0,S=S+1>>>0,0===S&&(C=C+1>>>0)}this.writeFixed64(S,C)}writeVarint(a){if(this._ensureCapacity(estimateVarintSize(a)),a>=0&&a<=4294967295){let S=a>>>0;for(;S>127;)this._buffer[this.pos++]=127&S|128,S>>>=7;this._buffer[this.pos++]=S}else{let S,C;if(a>=0)S=a>>>0,C=a/4294967296>>>0;else{const L=Math.abs(a);S=L>>>0,C=L/4294967296>>>0,S=~S>>>0,C=~C>>>0,S=S+1>>>0,0===S&&(C=C+1>>>0)}for(;C>0||S>127;)this._buffer[this.pos++]=127&S|128,S=(S>>>7|C<<25)>>>0,C>>>=7;this._buffer[this.pos++]=127&S}}writeFixed32(a){this._ensureCapacity(4);const S=a>>>0;this._buffer[this.pos++]=255&S,this._buffer[this.pos++]=S>>>8&255,this._buffer[this.pos++]=S>>>16&255,this._buffer[this.pos++]=S>>>24&255}writeFixed64(a,S){this._ensureCapacity(8);const C=a>>>0,L=S>>>0;this._buffer[this.pos++]=255&C,this._buffer[this.pos++]=C>>>8&255,this._buffer[this.pos++]=C>>>16&255,this._buffer[this.pos++]=C>>>24&255,this._buffer[this.pos++]=255&L,this._buffer[this.pos++]=L>>>8&255,this._buffer[this.pos++]=L>>>16&255,this._buffer[this.pos++]=L>>>24&255}writeBytes(a){this.writeVarint(a.length),this._ensureCapacity(a.length),this._buffer.set(a,this.pos),this.pos+=a.length}writeTag(a,S){this.writeVarint(a<<3|S)}writeDouble(a){this._ensureCapacity(8),this._dataView.setFloat64(this.pos,a,!0),this.pos+=8}writeString(a){const S=a.length;if(S<128){let C=0;for(;C<S&&a.charCodeAt(C)<128;)C++;if(C===S){for(this.writeVarint(S),this._ensureCapacity(S),C=0;C<S;C++)this._buffer[this.pos++]=a.charCodeAt(C);return}}const C=utf8ByteLength(a);this.writeVarint(C),this._ensureCapacity(C),this.pos+=this._textEncoder.encodeInto(a,this._buffer.subarray(this.pos)).written}};function intValue(a){return a>=48&&a<=57?a-48:a>=97&&a<=102?a-87:a-55}function hexToBinary(a){const S=new Uint8Array(a.length/2);let C=0;for(let L=0;L<a.length;L+=2){const x=intValue(a.charCodeAt(L)),I=intValue(a.charCodeAt(L+1));S[C++]=x<<4|I}return S}function writeHrTimeAsFixed64(a,S){const C=S[0],L=1e9,x=(65535&C)*L,I=(C/65536>>>0)*L,N=(x>>>0)+(65536*(65535&I)>>>0)+S[1],B=N>>>0,$=Math.floor(x/4294967296)+(I/65536>>>0)+Math.floor(N/4294967296)>>>0;a.writeFixed64(B,$)}function writeAttributes(a,S,C){for(const L in S){if(!Object.prototype.hasOwnProperty.call(S,L))continue;const x=S[L];a.writeTag(C,2);const I=a.startLengthDelimited(),N=a.pos;writeKeyValue(a,L,x),a.finishLengthDelimited(I,a.pos-N)}}function writeKeyValue(a,S,C){a.writeTag(1,2),a.writeString(S),a.writeTag(2,2);const L=a.startLengthDelimited(),x=a.pos;writeAnyValue(a,C),a.finishLengthDelimited(L,a.pos-x)}const Je=-0x8000000000000000,Ye=2**63;function writeAnyValue(a,S){const C=typeof S;if("string"===C)a.writeTag(1,2),a.writeString(S);else if("boolean"===C)a.writeTag(2,0),a.writeVarint(S?1:0);else if("number"===C){const C=S;Number.isInteger(C)&&C>=Je&&C<Ye?(a.writeTag(3,0),a.writeVarint(C)):(a.writeTag(4,1),a.writeDouble(C))}else if(S instanceof Uint8Array)a.writeTag(7,2),a.writeBytes(S);else if(Array.isArray(S)){a.writeTag(5,2);const C=a.startLengthDelimited(),L=a.pos;for(const C of S){a.writeTag(1,2);const S=a.startLengthDelimited(),L=a.pos;writeAnyValue(a,C),a.finishLengthDelimited(S,a.pos-L)}a.finishLengthDelimited(C,a.pos-L)}else if("object"===C&&null!=S){a.writeTag(6,2);const C=a.startLengthDelimited(),L=a.pos,x=S;for(const S in x){if(!Object.prototype.hasOwnProperty.call(x,S))continue;const C=x[S];a.writeTag(1,2);const L=a.startLengthDelimited(),I=a.pos;a.writeTag(1,2),a.writeString(S),a.writeTag(2,2);const N=a.startLengthDelimited(),B=a.pos;writeAnyValue(a,C),a.finishLengthDelimited(N,a.pos-B),a.finishLengthDelimited(L,a.pos-I)}a.finishLengthDelimited(C,a.pos-L)}}var Ze=class{constructor(){this.pos=0}startLengthDelimited(){return this.pos}finishLengthDelimited(a,S){this.pos+=estimateVarintSize(S)}writeVarint(a){this.pos+=estimateVarintSize(a)}writeSint32(a){this.pos+=estimateVarintSize((a<<1^a>>31)>>>0)}writeSfixed64(a){this.pos+=8}writeFixed32(a){this.pos+=4}writeFixed64(a,S){this.pos+=8}writeBytes(a){this.pos+=estimateVarintSize(a.length),this.pos+=a.length}writeTag(a,S){this.writeVarint(a<<3|S)}writeDouble(a){this.pos+=8}writeString(a){const S=utf8ByteLength(a);this.pos+=estimateVarintSize(S),this.pos+=S}},tr=class{constructor(a){this.pos=0,this._buf=a,this._textDecoder=new TextDecoder}isAtEnd(){return this.pos>=this._buf.length}readTag(){const a=this.readVarint();return{fieldNumber:a>>>3,wireType:7&a}}readVarint(){let a=0,S=0,C=!1;for(;this.pos<this._buf.length;){const L=this._buf[this.pos++];if(a+=(127&L)*Math.pow(2,S),S+=7,!(128&L)){C=!0;break}}if(!C)throw new Error("Truncated buffer: unexpected end of data while reading varint");return a}readBytes(){const a=this.readVarint();if(this.pos+a>this._buf.length)throw new Error(`Truncated buffer: expected ${a} bytes at position ${this.pos}, but only ${this._buf.length-this.pos} available`);const S=this._buf.subarray(this.pos,this.pos+a);return this.pos+=a,S}readString(){return this._textDecoder.decode(this.readBytes())}skip(a){switch(a){case 0:this.readVarint();break;case 1:this.pos+=8;break;case 2:this.readBytes();break;case 5:this.pos+=4;break;default:throw new Error(`Unknown wire type ${a}, cannot safely skip`)}}};function buildSpanFlags(a,S){let C=255&a|256;return S&&(C|=512),C}function serializeEvent(a,S){const C=a.startLengthDelimited(),L=a.pos;a.writeTag(1,1),writeHrTimeAsFixed64(a,S.time),a.writeTag(2,2),a.writeString(S.name),S.attributes&&writeAttributes(a,S.attributes,3),a.writeTag(4,0),a.writeVarint(S.droppedAttributesCount||0),a.finishLengthDelimited(C,a.pos-L)}function serializeLink(a,S){const C=a.startLengthDelimited(),L=a.pos,x=S.context;a.writeTag(1,2),a.writeBytes(hexToBinary(x.traceId)),a.writeTag(2,2),a.writeBytes(hexToBinary(x.spanId));const I=x.traceState?.serialize();I&&(a.writeTag(3,2),a.writeString(I)),S.attributes&&writeAttributes(a,S.attributes,4),a.writeTag(5,0),a.writeVarint(S.droppedAttributesCount||0);const N=buildSpanFlags(x.traceFlags,x.isRemote);N&&(a.writeTag(6,5),a.writeFixed32(N)),a.finishLengthDelimited(C,a.pos-L)}function serializeSpan(a,S){const C=a.startLengthDelimited(),L=a.pos,x=S.spanContext();a.writeTag(1,2),a.writeBytes(hexToBinary(x.traceId)),a.writeTag(2,2),a.writeBytes(hexToBinary(x.spanId));const I=x.traceState?.serialize();I&&(a.writeTag(3,2),a.writeString(I)),S.parentSpanContext?.spanId&&(a.writeTag(4,2),a.writeBytes(hexToBinary(S.parentSpanContext.spanId))),a.writeTag(5,2),a.writeString(S.name);const N=null==S.kind?0:S.kind+1;0!==N&&(a.writeTag(6,0),a.writeVarint(N)),a.writeTag(7,1),writeHrTimeAsFixed64(a,S.startTime),a.writeTag(8,1),writeHrTimeAsFixed64(a,S.endTime),S.attributes&&writeAttributes(a,S.attributes,9),a.writeTag(10,0),a.writeVarint(S.droppedAttributesCount);for(const C of S.events)a.writeTag(11,2),serializeEvent(a,C);a.writeTag(12,0),a.writeVarint(S.droppedEventsCount);for(const C of S.links)a.writeTag(13,2),serializeLink(a,C);a.writeTag(14,0),a.writeVarint(S.droppedLinksCount),a.writeTag(15,2),function serializeStatus(a,S){const C=a.startLengthDelimited(),L=a.pos;S.message&&(a.writeTag(2,2),a.writeString(S.message)),a.writeTag(3,0),a.writeVarint(S.code),a.finishLengthDelimited(C,a.pos-L)}(a,S.status);const B=buildSpanFlags(x.traceFlags,S.parentSpanContext?.isRemote);B&&(a.writeTag(16,5),a.writeFixed32(B)),a.finishLengthDelimited(C,a.pos-L)}function serializeScopeSpans(a,S,C){const L=a.startLengthDelimited(),x=a.pos;!function writeInstrumentationScope(a,S,C){a.writeTag(C,2);const L=a.startLengthDelimited(),x=a.pos;a.writeTag(1,2),a.writeString(S.name),S.version&&(a.writeTag(2,2),a.writeString(S.version)),S.attributes&&writeAttributes(a,S.attributes,3),S.droppedAttributesCount&&(a.writeTag(4,0),a.writeVarint(S.droppedAttributesCount)),a.finishLengthDelimited(L,a.pos-x)}(a,S,1);for(const S of C)a.writeTag(2,2),serializeSpan(a,S);S.schemaUrl&&(a.writeTag(3,2),a.writeString(S.schemaUrl)),a.finishLengthDelimited(L,a.pos-x)}function serializeResourceSpans(a,S,C){const L=a.startLengthDelimited(),x=a.pos;!function writeResource(a,S,C){a.writeTag(C,2);const L=a.startLengthDelimited(),x=a.pos;S.attributes&&writeAttributes(a,S.attributes,1),a.writeTag(2,0),a.writeVarint(0),a.finishLengthDelimited(L,a.pos-x)}(a,S,1);for(const S of C.values()){a.writeTag(2,2);serializeScopeSpans(a,S[0].instrumentationScope,S)}S.schemaUrl&&(a.writeTag(3,2),a.writeString(S.schemaUrl)),a.finishLengthDelimited(L,a.pos-x)}function serializeTraceExportRequest(a){const S=function createResourceMap$2(a){const S=new Map;for(const C of a){const a=C.resource,L=C.instrumentationScope;let x=S.get(a);x||(x=new Map,S.set(a,x));let I=x.get(L);I||(I=[],x.set(L,I)),I.push(C)}return S}(a),C=new Ze;for(const[a,L]of S)C.writeTag(1,2),serializeResourceSpans(C,a,L);const L=new Xe(C.pos);for(const[a,C]of S)L.writeTag(1,2),serializeResourceSpans(L,a,C);return L.finish()}function deserializePartialSuccess(a){const S=new tr(a),C={};for(;!S.isAtEnd();){const{fieldNumber:a,wireType:L}=S.readTag();switch(a){case 1:0===L?C.rejectedSpans=S.readVarint():S.skip(L);break;case 2:2===L?C.errorMessage=S.readString():S.skip(L);break;default:S.skip(L)}}return C}const er={serializeRequest:a=>serializeTraceExportRequest(a),deserializeResponse:a=>function deserializeExportTraceServiceResponse(a){const S=new tr(a),C={};for(;!S.isAtEnd();){const{fieldNumber:a,wireType:L}=S.readTag();1===a&&2===L?C.partialSuccess=deserializePartialSuccess(S.readBytes()):S.skip(L)}return C}(a)};function createResource(a,S){const C={attributes:toAttributes(a.attributes,S),droppedAttributesCount:0},L=a.schemaUrl;return L&&""!==L&&(C.schemaUrl=L),C}function createInstrumentationScope(a,S){const C={name:a.name,version:a.version};return a.attributes&&Object.keys(a.attributes).length>0&&(C.attributes=toAttributes(a.attributes,S),C.droppedAttributesCount=a.droppedAttributesCount??0),C}function toAttributes(a,S){return Object.keys(a).map((C=>function toKeyValue(a,S,C){return{key:a,value:toAnyValue(S,C)}}(C,a[C],S)))}function toAnyValue(a,S){const C=typeof a;if("string"===C)return{stringValue:a};if("number"===C)return Number.isInteger(a)?{intValue:a}:{doubleValue:a};if("boolean"===C)return{boolValue:a};if(a instanceof Uint8Array)return{bytesValue:S.encodeUint8Array(a)};if(Array.isArray(a)){const C=new Array(a.length);for(let L=0;L<a.length;L++)C[L]=toAnyValue(a[L],S);return{arrayValue:{values:C}}}if("object"===C&&null!=a){const C=Object.keys(a),L=new Array(C.length);for(let x=0;x<C.length;x++)L[x]={key:C[x],value:toAnyValue(a[C[x]],S)};return{kvlistValue:{values:L}}}return{}}function logRecordsToResourceLogs(a,S){const C=function createResourceMap$1(a){const S=new Map;for(const C of a){const{resource:a,instrumentationScope:L}=C;let x=S.get(a);x||(x=new Map,S.set(a,x));let I=x.get(L);I||(I=[],x.set(L,I)),I.push(C)}return S}(a);return Array.from(C,(([a,C])=>{const L=createResource(a,S);return{resource:L,scopeLogs:Array.from(C,(([,a])=>({scope:createInstrumentationScope(a[0].instrumentationScope,S),logRecords:a.map((a=>function toLogRecord(a,S){return{timeUnixNano:S.encodeHrTime(a.hrTime),observedTimeUnixNano:S.encodeHrTime(a.hrTimeObserved),severityNumber:a.severityNumber,severityText:a.severityText,body:toAnyValue(a.body,S),eventName:a.eventName,attributes:toAttributes(a.attributes,S),droppedAttributesCount:a.droppedAttributesCount,flags:a.spanContext?.traceFlags,traceId:S.encodeOptionalSpanContext(a.spanContext?.traceId),spanId:S.encodeOptionalSpanContext(a.spanContext?.spanId)}}(a,S))),schemaUrl:a[0].instrumentationScope.schemaUrl}))),schemaUrl:L.schemaUrl}}))}const rr="undefined"!=typeof BigInt?function encodeAsString(a){return function hrTimeToNanos(a){const S=BigInt(1e9);return BigInt(Math.trunc(a[0]))*S+BigInt(Math.trunc(a[1]))}(a).toString()}:hrTimeToNanoseconds;function identity(a){return a}const nr={encodeHrTime:rr,encodeSpanContext:identity,encodeOptionalSpanContext:identity,encodeUint8Array:function encodeBase64(a){const S=new Array(a.length);for(let C=0;C<a.length;C++)S[C]=String.fromCharCode(a[C]);return btoa(S.join(""))}},sr={serializeRequest:a=>{const S=function createExportLogsServiceRequest(a,S){return{resourceLogs:logRecordsToResourceLogs(a,S)}}(a,nr);return(new TextEncoder).encode(JSON.stringify(S))},deserializeResponse:a=>{if(0===a.length)return{};const S=new TextDecoder;try{return JSON.parse(S.decode(a))}catch(a){return kt.warn(`Failed to parse logs export response: ${a.message}. Returning empty response`),{}}}};function buildSpanFlagsFrom(a,S){let C=255&a|256;return S&&(C|=512),C}function sdkSpanToOtlpSpan(a,S){const C=a.spanContext(),L=a.status,x=a.parentSpanContext?.spanId?S.encodeSpanContext(a.parentSpanContext?.spanId):void 0;return{traceId:S.encodeSpanContext(C.traceId),spanId:S.encodeSpanContext(C.spanId),parentSpanId:x,traceState:C.traceState?.serialize(),name:a.name,kind:null==a.kind?0:a.kind+1,startTimeUnixNano:S.encodeHrTime(a.startTime),endTimeUnixNano:S.encodeHrTime(a.endTime),attributes:toAttributes(a.attributes,S),droppedAttributesCount:a.droppedAttributesCount,events:a.events.map((a=>function toOtlpSpanEvent(a,S){return{attributes:a.attributes?toAttributes(a.attributes,S):[],name:a.name,timeUnixNano:S.encodeHrTime(a.time),droppedAttributesCount:a.droppedAttributesCount||0}}(a,S))),droppedEventsCount:a.droppedEventsCount,status:{code:L.code,message:L.message},links:a.links.map((a=>function toOtlpLink(a,S){return{attributes:a.attributes?toAttributes(a.attributes,S):[],spanId:S.encodeSpanContext(a.context.spanId),traceId:S.encodeSpanContext(a.context.traceId),traceState:a.context.traceState?.serialize(),droppedAttributesCount:a.droppedAttributesCount||0,flags:buildSpanFlagsFrom(a.context.traceFlags,a.context.isRemote)}}(a,S))),droppedLinksCount:a.droppedLinksCount,flags:buildSpanFlagsFrom(C.traceFlags,a.parentSpanContext?.isRemote)}}function spanRecordsToResourceSpans(a,S){const C=function createResourceMap(a){const S=new Map;for(const C of a){let a=S.get(C.resource);a||(a=new Map,S.set(C.resource,a));const L=`${C.instrumentationScope.name}@${C.instrumentationScope.version||""}:${C.instrumentationScope.schemaUrl||""}`;let x=a.get(L);x||(x=[],a.set(L,x)),x.push(C)}return S}(a),L=[],x=C.entries();let I=x.next();for(;!I.done;){const[a,C]=I.value,N=[],B=C.values();let $=B.next();for(;!$.done;){const a=$.value;if(a.length>0){const C=a.map((a=>sdkSpanToOtlpSpan(a,S)));N.push({scope:createInstrumentationScope(a[0].instrumentationScope,S),spans:C,schemaUrl:a[0].instrumentationScope.schemaUrl})}$=B.next()}const V=createResource(a,S),H={resource:V,scopeSpans:N,schemaUrl:V.schemaUrl};L.push(H),I=x.next()}return L}const ir={serializeRequest:a=>{const S=function createExportTraceServiceRequest(a,S){return{resourceSpans:spanRecordsToResourceSpans(a,S)}}(a,nr);return(new TextEncoder).encode(JSON.stringify(S))},deserializeResponse:a=>{if(0===a.length)return{};const S=new TextDecoder;try{return JSON.parse(S.decode(a))}catch(a){return kt.warn(`Failed to parse trace export response: ${a.message}. Returning empty response`),{}}}};var or=class{constructor(a){this._delegate=a}export(a,S){this._delegate.export(a,S)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}setMetrics(a){this._delegate.setMetrics(a)}},ar=class extends Error{constructor(a,S,C){super(a),this.name="OTLPExporterError",this.data=C,this.code=S}};function validateTimeoutMillis(a){if(Number.isFinite(a)&&a>0)return a;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${a}')`)}function mergeOtlpSharedConfigurationWithDefaults(a,S,C){return{timeoutMillis:validateTimeoutMillis(a.timeoutMillis??S.timeoutMillis??C.timeoutMillis),concurrencyLimit:a.concurrencyLimit??S.concurrencyLimit??C.concurrencyLimit,compression:a.compression??S.compression??C.compression}}var cr=class{constructor(a){this._sendingPromises=[],this._concurrencyLimit=a}pushPromise(a){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(a);const popPromise=()=>{const S=this._sendingPromises.indexOf(a);this._sendingPromises.splice(S,1)};a.then(popPromise,popPromise)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function createBoundedQueueExportPromiseHandler(a){return new cr(a.concurrencyLimit)}function createLoggingPartialSuccessResponseHandler(){return{handleResponse(a){null!=a&&function isPartialSuccessResponse(a){return Object.prototype.hasOwnProperty.call(a,"partialSuccess")}(a)&&null!=a.partialSuccess&&0!==Object.keys(a.partialSuccess).length&&kt.warn("Received Partial Success response:",JSON.stringify(a.partialSuccess))}}}var ur=class{constructor(a,S,C,L,x,I){this._transport=a,this._serializer=S,this._responseHandler=C,this._promiseQueue=L,this._timeout=I,this._diagLogger=kt.createComponentLogger({namespace:"OTLPExportDelegate"}),this._metrics=x}export(a,S){if(this._diagLogger.debug("items to be sent",a),this._promiseQueue.hasReachedLimit())return void S({code:Zt.FAILED,error:new Error("Concurrent export limit reached")});const C=this._serializer.serializeRequest(a);if(null==C)return void S({code:Zt.FAILED,error:new Error("Nothing to send")});const L=this._metrics.startExport(a);this._promiseQueue.pushPromise(this._transport.send(C,this._timeout).then((a=>{if("success"!==a.status){if("failure"===a.status&&a.error)return L(a.error),void S({code:Zt.FAILED,error:a.error});"retryable"===a.status?(L("export_max_retries"),S({code:Zt.FAILED,error:a.error??new ar("Export failed with retryable status")})):(L("export_failed"),S({code:Zt.FAILED,error:new ar("Export failed with unknown error")}))}else{if(L(void 0),null!=a.data)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(a.data))}catch(S){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",S,a.data)}S({code:Zt.SUCCESS})}}),(a=>{L(a),S({code:Zt.FAILED,error:a})})))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(a){this._metrics=a}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}};function createOtlpNetworkExportDelegate(a,S,C,L){return function createOtlpExportDelegate(a,S){return new ur(a.transport,a.serializer,createLoggingPartialSuccessResponseHandler(),a.promiseHandler,a.metrics,S.timeout)}({transport:L,serializer:S,promiseHandler:createBoundedQueueExportPromiseHandler(a),metrics:C},{timeout:a.timeoutMillis})}const lr="http.response.status_code",dr="otel.component.name",hr="otel.component.type",pr="error.type",gr=new Map;var mr=class{constructor(a){const{componentType:S,metricsHelper:C,meterProvider:L,url:x,responseAttributesFromError:I}=a;this.responseAttributesFromError=I;const N=L?L.getMeter("@opentelemetry/otlp-exporter","0.301.2"):createNoopMeter(),B=gr.get(S)??0;if(gr.set(S,B+1),this.standardAttrs={[hr]:S,[dr]:`${S}/${B}`},x){let a=x;x.includes("://")||(a=`http://${x}`);try{const S=new URL(a);let C;this.standardAttrs["server.address"]=S.hostname,S.port?C=Number(S.port):"http:"===S.protocol?C=80:"https:"===S.protocol&&(C=443),"number"==typeof C&&(this.standardAttrs["server.port"]=C)}catch{}}this.helper=C,this.inflight=N.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`}),this.exported=N.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s for which the export has finished, either successful or failed.`}),this.duration=N.createHistogram("otel.sdk.exporter.operation.duration",{unit:"s",description:"The duration of exporting a batch of telemetry records.",advice:{explicitBucketBoundaries:[]}})}startExport(a){const S=this.helper.countItems(a),C=hrTime();return this.inflight.add(S,this.standardAttrs),a=>{const L=hrTime();this.inflight.add(-S,this.standardAttrs);const x=a?{...this.standardAttrs,[pr]:a instanceof Error?a.name:"export_failed"}:this.standardAttrs;this.exported.add(S,x);const I={...x,...this.responseAttributesFromError(a)},N=function hrTimeToMilliseconds(a){return 1e3*a[0]+a[1]/1e6}(hrTimeDuration(C,L))/1e3;this.duration.record(N,I)}}};let fr,_r;const br=new WeakMap,yr=new WeakMap,vr=new WeakMap,wr=new WeakMap,Sr=new WeakMap;let Tr={get(a,S,C){if(a instanceof IDBTransaction){if("done"===S)return yr.get(a);if("objectStoreNames"===S)return a.objectStoreNames||vr.get(a);if("store"===S)return C.objectStoreNames[1]?void 0:C.objectStore(C.objectStoreNames[0])}return wrap$1(a[S])},set:(a,S,C)=>(a[S]=C,!0),has:(a,S)=>a instanceof IDBTransaction&&("done"===S||"store"===S)||S in a};function wrapFunction(a){return a!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?function getCursorAdvanceMethods(){return _r||(_r=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}().includes(a)?function(...S){return a.apply(unwrap$1(this),S),wrap$1(br.get(this))}:function(...S){return wrap$1(a.apply(unwrap$1(this),S))}:function(S,...C){const L=a.call(unwrap$1(this),S,...C);return vr.set(L,S.sort?S.sort():[S]),wrap$1(L)}}function transformCachableValue(a){return"function"==typeof a?wrapFunction(a):(a instanceof IDBTransaction&&function cacheDonePromiseForTransaction(a){if(yr.has(a))return;const S=new Promise(((S,C)=>{const unlisten=()=>{a.removeEventListener("complete",complete),a.removeEventListener("error",error),a.removeEventListener("abort",error)},complete=()=>{S(),unlisten()},error=()=>{C(a.error||new DOMException("AbortError","AbortError")),unlisten()};a.addEventListener("complete",complete),a.addEventListener("error",error),a.addEventListener("abort",error)}));yr.set(a,S)}(a),S=a,function getIdbProxyableTypes(){return fr||(fr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}().some((a=>S instanceof a))?new Proxy(a,Tr):a);var S}function wrap$1(a){if(a instanceof IDBRequest)return function promisifyRequest(a){const S=new Promise(((S,C)=>{const unlisten=()=>{a.removeEventListener("success",success),a.removeEventListener("error",error)},success=()=>{S(wrap$1(a.result)),unlisten()},error=()=>{C(a.error),unlisten()};a.addEventListener("success",success),a.addEventListener("error",error)}));return S.then((S=>{S instanceof IDBCursor&&br.set(S,a)})).catch((()=>{})),Sr.set(S,a),S}(a);if(wr.has(a))return wr.get(a);const S=transformCachableValue(a);return S!==a&&(wr.set(a,S),Sr.set(S,a)),S}const unwrap$1=a=>Sr.get(a);const Er=["get","getKey","getAll","getAllKeys","count"],Cr=["put","add","delete","clear"],Ar=new Map;function getMethod(a,S){if(!(a instanceof IDBDatabase)||S in a||"string"!=typeof S)return;if(Ar.get(S))return Ar.get(S);const C=S.replace(/FromIndex$/,""),L=S!==C,x=Cr.includes(C);if(!(C in(L?IDBIndex:IDBObjectStore).prototype)||!x&&!Er.includes(C))return;const method=async function(a,...S){const I=this.transaction(a,x?"readwrite":"readonly");let N=I.store;return L&&(N=N.index(S.shift())),(await Promise.all([N[C](...S),x&&I.done]))[0]};return Ar.set(S,method),method}!function replaceTraps(a){Tr=a(Tr)}((a=>({...a,get:(S,C,L)=>getMethod(S,C)||a.get(S,C,L),has:(S,C)=>!!getMethod(S,C)||a.has(S,C)})));const Lr="@firebase/installations",xr="0.6.24",Rr=1e4,Ir=`w:${xr}`,Pr="FIS_v2",Or=36e5,kr=new ErrorFactory("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function isServerError(a){return a instanceof FirebaseError&&a.code.includes("request-failed")}function getInstallationsEndpoint({projectId:a}){return`https://firebaseinstallations.googleapis.com/v1/projects/${a}/installations`}function extractAuthTokenInfoFromResponse(a){return{token:a.token,requestStatus:2,expiresIn:(S=a.expiresIn,Number(S.replace("s","000"))),creationTime:Date.now()};var S}async function getErrorFromResponse(a,S){const C=(await S.json()).error;return kr.create("request-failed",{requestName:a,serverCode:C.code,serverMessage:C.message,serverStatus:C.status})}function getHeaders({apiKey:a}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":a})}function getHeadersWithAuth(a,{refreshToken:S}){const C=getHeaders(a);return C.append("Authorization",function getAuthorizationHeader(a){return`${Pr} ${a}`}(S)),C}async function retryIfServerError(a){const S=await a();return S.status>=500&&S.status<600?a():S}function sleep(a){return new Promise((S=>{setTimeout(S,a)}))}const Dr=/^[cdef][\w-]{21}$/;function generateFid(){try{const a=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(a),a[0]=112+a[0]%16;const S=function encode(a){const S=function bufferToBase64UrlSafe(a){return btoa(String.fromCharCode(...a)).replace(/\+/g,"-").replace(/\//g,"_")}(a);return S.substr(0,22)}(a);return Dr.test(S)?S:""}catch{return""}}function getKey(a){return`${a.appName}!${a.appId}`}const Nr=new Map;function fidChanged(a,S){const C=getKey(a);callFidChangeCallbacks(C,S),function broadcastFidChange(a,S){const C=function getBroadcastChannel(){!Fr&&"BroadcastChannel"in self&&(Fr=new BroadcastChannel("[Firebase] FID Change"),Fr.onmessage=a=>{callFidChangeCallbacks(a.data.key,a.data.fid)});return Fr}();C&&C.postMessage({key:a,fid:S});!function closeBroadcastChannel(){0===Nr.size&&Fr&&(Fr.close(),Fr=null)}()}(C,S)}function callFidChangeCallbacks(a,S){const C=Nr.get(a);if(C)for(const a of C)a(S)}let Fr=null;const Mr="firebase-installations-store";let Ur=null;function getDbPromise(){return Ur||(Ur=function openDB(a,S,{blocked:C,upgrade:L,blocking:x,terminated:I}={}){const N=indexedDB.open(a,S),B=wrap$1(N);return L&&N.addEventListener("upgradeneeded",(a=>{L(wrap$1(N.result),a.oldVersion,a.newVersion,wrap$1(N.transaction),a)})),C&&N.addEventListener("blocked",(a=>C(a.oldVersion,a.newVersion,a))),B.then((a=>{I&&a.addEventListener("close",(()=>I())),x&&a.addEventListener("versionchange",(a=>x(a.oldVersion,a.newVersion,a)))})).catch((()=>{})),B}("firebase-installations-database",1,{upgrade:(a,S)=>{if(0===S)a.createObjectStore(Mr)}})),Ur}async function set(a,S){const C=getKey(a),L=(await getDbPromise()).transaction(Mr,"readwrite"),x=L.objectStore(Mr),I=await x.get(C);return await x.put(S,C),await L.done,I&&I.fid===S.fid||fidChanged(a,S.fid),S}async function remove(a){const S=getKey(a),C=(await getDbPromise()).transaction(Mr,"readwrite");await C.objectStore(Mr).delete(S),await C.done}async function update(a,S){const C=getKey(a),L=(await getDbPromise()).transaction(Mr,"readwrite"),x=L.objectStore(Mr),I=await x.get(C),N=S(I);return void 0===N?await x.delete(C):await x.put(N,C),await L.done,!N||I&&I.fid===N.fid||fidChanged(a,N.fid),N}async function getInstallationEntry(a){let S;const C=await update(a.appConfig,(C=>{const L=function updateOrCreateInstallationEntry(a){const S=a||{fid:generateFid(),registrationStatus:0};return clearTimedOutRequest(S)}(C),x=function triggerRegistrationIfNecessary(a,S){if(0===S.registrationStatus){if(!navigator.onLine){return{installationEntry:S,registrationPromise:Promise.reject(kr.create("app-offline"))}}const C={fid:S.fid,registrationStatus:1,registrationTime:Date.now()},L=async function registerInstallation(a,S){try{const C=await async function createInstallationRequest({appConfig:a,heartbeatServiceProvider:S},{fid:C}){const L=getInstallationsEndpoint(a),x=getHeaders(a),I=S.getImmediate({optional:!0});if(I){const a=await I.getHeartbeatsHeader();a&&x.append("x-firebase-client",a)}const N={fid:C,authVersion:Pr,appId:a.appId,sdkVersion:Ir},B={method:"POST",headers:x,body:JSON.stringify(N)},$=await retryIfServerError((()=>fetch(L,B)));if($.ok){const a=await $.json();return{fid:a.fid||C,registrationStatus:2,refreshToken:a.refreshToken,authToken:extractAuthTokenInfoFromResponse(a.authToken)}}throw await getErrorFromResponse("Create Installation",$)}(a,S);return set(a.appConfig,C)}catch(C){throw isServerError(C)&&409===C.customData.serverCode?await remove(a.appConfig):await set(a.appConfig,{fid:S.fid,registrationStatus:0}),C}}(a,C);return{installationEntry:C,registrationPromise:L}}return 1===S.registrationStatus?{installationEntry:S,registrationPromise:waitUntilFidRegistration(a)}:{installationEntry:S}}(a,L);return S=x.registrationPromise,x.installationEntry}));return""===C.fid?{installationEntry:await S}:{installationEntry:C,registrationPromise:S}}async function waitUntilFidRegistration(a){let S=await updateInstallationRequest(a.appConfig);for(;1===S.registrationStatus;)await sleep(100),S=await updateInstallationRequest(a.appConfig);if(0===S.registrationStatus){const{installationEntry:S,registrationPromise:C}=await getInstallationEntry(a);return C||S}return S}function updateInstallationRequest(a){return update(a,(a=>{if(!a)throw kr.create("installation-not-found");return clearTimedOutRequest(a)}))}function clearTimedOutRequest(a){return function hasInstallationRequestTimedOut(a){return 1===a.registrationStatus&&a.registrationTime+Rr<Date.now()}(a)?{fid:a.fid,registrationStatus:0}:a}async function generateAuthTokenRequest({appConfig:a,heartbeatServiceProvider:S},C){const L=function getGenerateAuthTokenEndpoint(a,{fid:S}){return`${getInstallationsEndpoint(a)}/${S}/authTokens:generate`}(a,C),x=getHeadersWithAuth(a,C),I=S.getImmediate({optional:!0});if(I){const a=await I.getHeartbeatsHeader();a&&x.append("x-firebase-client",a)}const N={installation:{sdkVersion:Ir,appId:a.appId}},B={method:"POST",headers:x,body:JSON.stringify(N)},$=await retryIfServerError((()=>fetch(L,B)));if($.ok){return extractAuthTokenInfoFromResponse(await $.json())}throw await getErrorFromResponse("Generate Auth Token",$)}async function refreshAuthToken(a,S=!1){let C;const L=await update(a.appConfig,(L=>{if(!isEntryRegistered(L))throw kr.create("not-registered");const x=L.authToken;if(!S&&function isAuthTokenValid(a){return 2===a.requestStatus&&!function isAuthTokenExpired(a){const S=Date.now();return S<a.creationTime||a.creationTime+a.expiresIn<S+Or}(a)}(x))return L;if(1===x.requestStatus)return C=async function waitUntilAuthTokenRequest(a,S){let C=await updateAuthTokenRequest(a.appConfig);for(;1===C.authToken.requestStatus;)await sleep(100),C=await updateAuthTokenRequest(a.appConfig);const L=C.authToken;return 0===L.requestStatus?refreshAuthToken(a,S):L}(a,S),L;{if(!navigator.onLine)throw kr.create("app-offline");const S=function makeAuthTokenRequestInProgressEntry(a){const S={requestStatus:1,requestTime:Date.now()};return{...a,authToken:S}}(L);return C=async function fetchAuthTokenFromServer(a,S){try{const C=await generateAuthTokenRequest(a,S),L={...S,authToken:C};return await set(a.appConfig,L),C}catch(C){if(!isServerError(C)||401!==C.customData.serverCode&&404!==C.customData.serverCode){const C={...S,authToken:{requestStatus:0}};await set(a.appConfig,C)}else await remove(a.appConfig);throw C}}(a,S),S}}));return C?await C:L.authToken}function updateAuthTokenRequest(a){return update(a,(a=>{if(!isEntryRegistered(a))throw kr.create("not-registered");return function hasAuthTokenRequestTimedOut(a){return 1===a.requestStatus&&a.requestTime+Rr<Date.now()}(a.authToken)?{...a,authToken:{requestStatus:0}}:a}))}function isEntryRegistered(a){return void 0!==a&&2===a.registrationStatus}async function getToken(a,S=!1){const C=a;await async function completeInstallationRegistration(a){const{registrationPromise:S}=await getInstallationEntry(a);S&&await S}(C);return(await refreshAuthToken(C,S)).token}function getMissingValueError(a){return kr.create("missing-app-config-values",{valueName:a})}const Br="installations",publicFactory=a=>{const S=a.getProvider("app").getImmediate(),C=function extractAppConfig(a){if(!a||!a.options)throw getMissingValueError("App Configuration");if(!a.name)throw getMissingValueError("App Name");const S=["projectId","apiKey","appId"];for(const C of S)if(!a.options[C])throw getMissingValueError(C);return{appName:a.name,projectId:a.options.projectId,apiKey:a.options.apiKey,appId:a.options.appId}}(S);return{app:S,appConfig:C,heartbeatServiceProvider:_getProvider(S,"heartbeat"),_delete:()=>Promise.resolve()}},internalFactory=a=>{const S=a.getProvider("app").getImmediate(),C=_getProvider(S,Br).getImmediate();return{getId:()=>async function getId(a){const S=a,{installationEntry:C,registrationPromise:L}=await getInstallationEntry(S);return L?L.catch(console.error):refreshAuthToken(S).catch(console.error),C.fid}(C),getToken:a=>getToken(C,a)}};!function registerInstallations(){S(new Component(Br,publicFactory,"PUBLIC")),S(new Component("installations-internal",internalFactory,"PRIVATE"))}(),a(Lr,xr),a(Lr,xr,"esm2020");var $r="0.11.0";const Vr="browser.navigation_timing.type",zr="url.full",Hr="browser.navigation_timing.dom_complete",jr="browser.navigation_timing.dom_content_loaded_event_end",qr="browser.navigation_timing.dom_content_loaded_event_start",Gr="browser.navigation_timing.dom_interactive",Wr="browser.navigation_timing.load_event_end",Kr="browser.navigation_timing.load_event_start",Qr="browser.navigation_timing.redirect_count",Xr="browser.navigation_timing.unload_event_end",Jr="browser.navigation_timing.unload_event_start",Yr="browser.resource_timing.duration",Zr="browser.resource_timing.fetch_start",tn="browser.resource_timing.domain_lookup_start",en="browser.resource_timing.domain_lookup_end",rn="browser.resource_timing.connect_start",nn="browser.resource_timing.connect_end",sn="browser.resource_timing.secure_connection_start",on="browser.resource_timing.request_start",an="browser.resource_timing.response_start",cn="browser.resource_timing.response_end",un="browser.resource_timing.transfer_size",ln="browser.resource_timing.encoded_body_size",dn="browser.resource_timing.decoded_body_size";var hn;!function(a){a[a.UNSPECIFIED=0]="UNSPECIFIED",a[a.TRACE=1]="TRACE",a[a.TRACE2=2]="TRACE2",a[a.TRACE3=3]="TRACE3",a[a.TRACE4=4]="TRACE4",a[a.DEBUG=5]="DEBUG",a[a.DEBUG2=6]="DEBUG2",a[a.DEBUG3=7]="DEBUG3",a[a.DEBUG4=8]="DEBUG4",a[a.INFO=9]="INFO",a[a.INFO2=10]="INFO2",a[a.INFO3=11]="INFO3",a[a.INFO4=12]="INFO4",a[a.WARN=13]="WARN",a[a.WARN2=14]="WARN2",a[a.WARN3=15]="WARN3",a[a.WARN4=16]="WARN4",a[a.ERROR=17]="ERROR",a[a.ERROR2=18]="ERROR2",a[a.ERROR3=19]="ERROR3",a[a.ERROR4=20]="ERROR4",a[a.FATAL=21]="FATAL",a[a.FATAL2=22]="FATAL2",a[a.FATAL3=23]="FATAL3",a[a.FATAL4=24]="FATAL4"}(hn||(hn={}));class NoopLogger{emit(a){}enabled(){return!1}}const pn=new NoopLogger,gn=Symbol.for("io.opentelemetry.js.api.logs"),mn=globalThis;const fn=new class NoopLoggerProvider{getLogger(a,S,C){return new NoopLogger}};class ProxyLogger{constructor(a,S,C,L){this._provider=a,this.name=S,this.version=C,this.options=L}emit(a){this._getLogger().emit(a)}enabled(a){return this._getLogger().enabled(a)}_getLogger(){if(this._delegate)return this._delegate;const a=this._provider._getDelegateLogger(this.name,this.version,this.options);return a?(this._delegate=a,this._delegate):pn}}class ProxyLoggerProvider{getLogger(a,S,C){var L;return null!==(L=this._getDelegateLogger(a,S,C))&&void 0!==L?L:new ProxyLogger(this,a,S,C)}_getDelegate(){var a;return null!==(a=this._delegate)&&void 0!==a?a:fn}_setDelegate(a){this._delegate=a}_getDelegateLogger(a,S,C){var L;return null===(L=this._delegate)||void 0===L?void 0:L.getLogger(a,S,C)}}class LogsAPI{constructor(){this._proxyLoggerProvider=new ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new LogsAPI),this._instance}setGlobalLoggerProvider(a){return mn[gn]?this.getLoggerProvider():(mn[gn]=function makeGetter(a,S,C){return L=>L===a?S:C}(1,a,fn),this._proxyLoggerProvider._setDelegate(a),a)}getLoggerProvider(){var a,S;return null!==(S=null===(a=mn[gn])||void 0===a?void 0:a.call(mn,1))&&void 0!==S?S:this._proxyLoggerProvider}getLogger(a,S,C){return this.getLoggerProvider().getLogger(a,S,C)}disable(){delete mn[gn],this._proxyLoggerProvider=new ProxyLoggerProvider}}const _n=LogsAPI.getInstance();function toError(a){try{return a instanceof Error?a:new Error(function describe(a){try{return String(a)}catch{return Object.prototype.toString.call(a)}}(a),{cause:a})}catch{return new Error("thrown value could not be described",{cause:a})}}var bn=class InstrumentationBase{constructor(a,S,C){this._state="new",this.instrumentationName=a,this.instrumentationVersion=S,this._config=C,this._diag=kt.createComponentLogger({namespace:a})}isEnabled(){return"enabled"===this._state}enable(a){if("new"!==this._state)"failed"!==this._state?(a&&this._reportIgnoredDeps(a),"disabled"===this._state&&this._runOnEnable()):this._diag.debug("enable() ignored: this instrumentation failed earlier");else{try{this._resolve(a)}catch(a){return void this._markFailed({reason:"could not set up the tracer and logger",cause:a})}try{this._init()}catch(a){return void this._markFailed({reason:"init failed",cause:a})}this._runOnEnable()}}disable(){"enabled"===this._state&&(this._state="disabled",this._runOnDisable())}_markFailed({reason:a,cause:S}){this._state="failed";const C=toError(S);this._diag.error(`${a}, so this instrumentation stays off: ${C.message}`,C)}_resolve(a){const S=this.instrumentationName,C=this.instrumentationVersion,L=a?.tracerProvider??Wt.getTracerProvider(),x=a?.loggerProvider??_n.getLoggerProvider();this._resolved={deps:a&&{...a},tracer:L.getTracer(S,C),logger:x.getLogger(S,C),propagator:a?.propagator??qt}}_reportIgnoredDeps(a){const S=this._resolved?.deps??{},C=Object.entries(a).filter((([a,C])=>C!==Reflect.get(S,a))).map((([a])=>a));C.length>0?this._diag.warn(`enable() ignores deps after the first call; ignored: ${C.join(", ")}`):this._diag.debug("enable() ignores deps after the first call")}_runOnEnable(){this._state="enabled";try{this._onEnable()}catch(a){const S=toError(a);this._diag.error(`enable failed: ${S.message}`,S),this.disable()}}_runOnDisable(){try{this._onDisable()}catch(a){this._state="failed";const S=toError(a);this._diag.error(`disable failed, so this instrumentation stays off; some listeners may still be attached: ${S.message}`,S)}}_requireResolved(a){if(!this._resolved)throw new Error(`${this.instrumentationName}: ${a} is not available until enable() succeeds`);return this._resolved}get tracer(){return this._requireResolved("tracer").tracer}get logger(){return this._requireResolved("logger").logger}get propagator(){return this._requireResolved("propagator").propagator}_wrap(a,S,C){const L=a[S];if("function"!=typeof L)throw new Error(`_wrap: "${String(S)}" is not a function; nothing to wrap`);const x=C(L);Object.defineProperty(x,"__original",{value:L,enumerable:!1,writable:!0,configurable:!0}),Object.defineProperty(a,S,{value:x,enumerable:Object.prototype.propertyIsEnumerable.call(a,S),writable:!0,configurable:!0})}_safeExecute(a,S){const onError=S=>{this._diag.error(a,toError(S))};try{const a=S(),C=a?.then;return"function"==typeof C&&C.call(a,void 0,onError),a}catch(a){return onError(a)}}_toError(a){return toError(a)}_init(){}_onEnable(){}_onDisable(){}};var yn=class extends bn{constructor(a={}){super("@opentelemetry/browser-instrumentation/navigation-timing",$r,a),this._retryCount=0,this._didEmit=!1,this._onLoad=()=>this._tryEmitOrSchedule(),this._onPageHide=()=>this._handleUnload()}_onEnable(){this._retryCount=0,this._tryEmitOrSchedule(),this._didEmit||window.addEventListener("pagehide",this._onPageHide)}_onDisable(){this._unsubscribeAll()}_getLatestNavigationEntry(){const a=performance?.getEntriesByType?.("navigation");if(a&&0!==a.length)return a[a.length-1]}_calculateBackoffDelay(){return 50*this._retryCount}_tryEmitOrSchedule(){if(this._didEmit)return;const a=this._getLatestNavigationEntry();if(a&&(this._lastEntry=a),a&&a.loadEventEnd>0)return void this._emitAndCleanup(a);if("complete"!==document.readyState)return void window.addEventListener("load",this._onLoad,{once:!0});if(void 0!==this._completeDelayTimeoutId)return;if(this._retryCount>5)return void(this._lastEntry?(this._diag.warn("Navigation timing: retries exhausted, emitting incomplete entry"),this._emitAndCleanup(this._lastEntry)):(this._diag.warn("Navigation timing: retries exhausted with no entry available"),this._unsubscribeAll()));const S=this._calculateBackoffDelay();this._retryCount++,this._completeDelayTimeoutId=window.setTimeout((()=>{this._completeDelayTimeoutId=void 0,this._tryEmitOrSchedule()}),S)}_handleUnload(){if(this._didEmit)return;const a=this._getLatestNavigationEntry()??this._lastEntry;a?this._emitAndCleanup(a):(this._diag.warn("Navigation timing: no entry available at unload"),this._unsubscribeAll())}_emitAndCleanup(a){this._didEmit||(this._didEmit=!0,this._safeExecute("failed to record navigation timing",(()=>this._emitNavigationTiming(a))),this._lastEntry=void 0,this._unsubscribeAll())}_emitNavigationTiming(a){a&&this.logger.emit({eventName:"browser.navigation_timing",timestamp:a.startTime,severityNumber:hn.INFO,attributes:{[Vr]:a.type,[zr]:a.name,[Yr]:a.duration,[Hr]:a.domComplete,[jr]:a.domContentLoadedEventEnd,[qr]:a.domContentLoadedEventStart,[Gr]:a.domInteractive,[Wr]:a.loadEventEnd,[Kr]:a.loadEventStart,[Qr]:a.redirectCount,[Xr]:a.unloadEventEnd,[Jr]:a.unloadEventStart,[Zr]:a.fetchStart,[tn]:a.domainLookupStart,[en]:a.domainLookupEnd,[rn]:a.connectStart,[nn]:a.connectEnd,[sn]:a.secureConnectionStart,[on]:a.requestStart,[an]:a.responseStart,[cn]:a.responseEnd,[un]:a.transferSize,[ln]:a.encodedBodySize,[dn]:a.decodedBodySize}})}_unsubscribeAll(){this._completeDelayTimeoutId&&(clearTimeout(this._completeDelayTimeoutId),this._completeDelayTimeoutId=void 0),this._onLoad&&window.removeEventListener("load",this._onLoad),this._onPageHide&&window.removeEventListener("pagehide",this._onPageHide)}};const getElementCSSSelector=(a,{useIdForTargetElement:S=!1,useIdForAncestors:C=!1}={})=>{if(a.nodeType===Node.DOCUMENT_NODE)return"";const L=a,x=getNodeSelector(L,S||C);if(x.startsWith("#"))return x;const I=L.parentElement,N=I?getElementCSSSelector(I,{useIdForAncestors:C,useIdForTargetElement:!1}):"";return N?`${N} > ${x}`:x},getNodeSelector=(a,S=!1)=>{if(a.nodeType!==Node.ELEMENT_NODE)return"";const C=a,L=C.getAttribute("id");if(S&&L&&1===C.ownerDocument.querySelectorAll(`#${CSS.escape(L)}`).length)return`#${CSS.escape(L)}`;let x=getFullClassSelector(C);const I=getNthChild(C);return I>0&&(x+=`:nth-child(${I})`),x},getNthChild=a=>{if(!a.parentElement)return 0;const S=Array.from(a.classList),C=Array.from(a.parentElement.children);return C.some((C=>C!==a&&C.localName===a.localName&&S.every((a=>C.classList.contains(a)))))?C.indexOf(a)+1:0},getFullClassSelector=a=>a.localName+(a.classList.length>0?Array.from(a.classList).map((a=>`.${CSS.escape(a)}`)).join(""):""),vn="browser.mouse_event.button",wn="browser.page.x",Sn="browser.page.y",Tn="browser.tag_name",En="browser.element.attributes",Cn="browser.css_selector",An=["click"];var Ln=class extends bn{constructor(a={}){super("@opentelemetry/browser-instrumentation/user-action",$r,a),this._hasWarnedApplyCustomLogRecordData=!1}_getMouseButtonFromMouseEvent(a){switch(a.button){case 0:return"left";case 1:return"middle";case 2:return"right";default:return}}onClick(a){if("click"===a.type&&0!==a.button||"auxclick"===a.type&&1!==a.button||"contextmenu"===a.type&&2!==a.button)return;const S=this._getMouseButtonFromMouseEvent(a);if(!S)return;const C=a.target;if(!(C instanceof HTMLElement))return;if(C.hasAttribute("disabled"))return;const L=getElementCSSSelector(C,{useIdForTargetElement:!0,useIdForAncestors:!0}),x={};for(const a of C.attributes)a.name.startsWith("data-otel-")&&(x[a.name.slice(10)]=a.value);const I={severityNumber:hn.INFO,eventName:"browser.user_action.click",attributes:{[wn]:a.pageX,[Sn]:a.pageY,[Tn]:C.tagName,[En]:x,[vn]:S,[Cn]:L}};this._applyCustomLogRecordData(I),this.logger.emit(I)}_applyCustomLogRecordData(a){const S=this._config.applyCustomLogRecordData;S&&(this._hasWarnedApplyCustomLogRecordData||(this._hasWarnedApplyCustomLogRecordData=!0,this._diag.warn("applyCustomLogRecordData is deprecated. Use a custom LogRecordProcessor registered with LoggerProvider instead.")),this._safeExecute("applyCustomLogRecordData hook failed",(()=>S(a))))}_onEnable(){(this._config.autoCapturedActions??An).includes("click")&&(this._onClickHandler=a=>this._safeExecute("failed to record a click",(()=>this.onClick(a))),document.addEventListener("click",this._onClickHandler,!0),document.addEventListener("auxclick",this._onClickHandler,!0),document.addEventListener("contextmenu",this._onClickHandler,!0))}_onDisable(){this._onClickHandler&&(document.removeEventListener("click",this._onClickHandler,!0),document.removeEventListener("auxclick",this._onClickHandler,!0),document.removeEventListener("contextmenu",this._onClickHandler,!0),this._onClickHandler=void 0)}};const xn="browser.web_vital.name",Rn="browser.web_vital.value",In="browser.web_vital.rating",Pn="browser.web_vital.delta",On="browser.web_vital.id",kn="browser.web_vital.navigation_type";class t{constructor(){this.o=0,this.i=[]}l(a){if(a.hadRecentInput)return;const S=this.i[0],C=this.i.at(-1);this.o&&S&&C&&a.startTime-C.startTime<1e3&&a.startTime-S.startTime<5e3?(this.o+=a.value,this.i.push(a)):(this.o=a.value,this.i=[a]),this.t?.(a)}}const n=()=>{const a=performance.getEntriesByType("navigation")[0];if(a&&a.responseStart>0&&a.responseStart<performance.now())return a},e=a=>{if("loading"===document.readyState)return"loading";const S=n();if(S){if(a<S.domInteractive)return"loading";if(0===S.domContentLoadedEventStart||a<S.domContentLoadedEventStart)return"dom-interactive";if(0===S.domComplete||a<S.domComplete)return"dom-content-loaded"}return"complete"},o=a=>{const S=a.nodeName;return 1===a.nodeType?S.toLowerCase():S.toUpperCase().replace(/^#/,"")},i=a=>{let S="";try{for(;9!==a?.nodeType;){const C=a,L=C.id?"#"+C.id:[o(C),...Array.from(C.classList??[]).sort()].join(".");if(S.length+L.length>99)return S||L;if(S=S?L+">"+S:L,C.id)break;a=C.parentNode}}catch{}return S},Dn=new WeakMap;function r(a,S){let C=Dn.get(S);return C||(C=new WeakMap,Dn.set(S,C)),C.get(a)||C.set(a,new S),C.get(a)}let Nn=-1;const c=()=>Nn,f=a=>{addEventListener("pageshow",(S=>{S.persisted&&(Nn=S.timeStamp,a(S))}),!0)},l=(a,S,C,L)=>{let x,I;return N=>{S.value>=0&&(N||L)&&(I=S.value-(x??0),(I||void 0===x)&&(x=S.value,S.delta=I,S.rating=((a,S)=>a>S[1]?"poor":a>S[0]?"needs-improvement":"good")(S.value,C),a(S)))}},u=a=>{requestAnimationFrame((()=>requestAnimationFrame((()=>a()))))},d=()=>n()?.activationStart??0;let Fn=-1;const Mn=new Set,v=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,p=a=>{if("hidden"===document.visibilityState){if("visibilitychange"===a.type)for(const a of Mn)a();isFinite(Fn)||(Fn="visibilitychange"===a.type?a.timeStamp:0,removeEventListener("prerenderingchange",p,!0))}},m=(a=!1)=>{if(a&&(Fn=1/0),Fn<0){const a=d(),S=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find((S=>"hidden"===S.name&&S.startTime>=a))?.startTime;Fn=S??v(),addEventListener("visibilitychange",p,!0),addEventListener("prerenderingchange",p,!0),f((()=>{setTimeout((()=>{Fn=v()}))}))}return{get firstHiddenTime(){return Fn},onHidden(a){Mn.add(a)}}},y=(a,S=-1,C,L=0,x,I,N)=>{const B=n(),$=B?.navigationId||0;let V="navigate";return C?V=C:c()>=0?V="back-forward-cache":B&&(document.prerendering||d()>0?V="prerender":document.wasDiscarded?V="restore":B.type&&(V=B.type.replace(/_/g,"-"))),{name:a,value:S,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:V,navigationId:L||$,navigationInteractionId:x,navigationURL:I||B?.name,navigationStartTime:N||0}},b=(a,S,C={})=>{try{const L=a.filter((a=>PerformanceObserver.supportedEntryTypes.includes(a)));if(L.length>0){const a=new PerformanceObserver((a=>{queueMicrotask((()=>{const C=a.getEntries();L.length>1&&C.sort(((a,S)=>a.startTime+a.duration-(S.startTime+S.duration))),S(C)}))}));for(const S of L)a.observe({type:S,buffered:!0,...C});return a}}catch{}},M=a=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&a&&a.reportSoftNavs,T=(a,S)=>{if(a.set(S.navigationId,S),a.size>2){const S=a.keys().next().value;void 0!==S&&a.delete(S)}},E=a=>{let S=!1;return()=>{S||(a(),S=!0)}};class D{}const w=a=>{document.prerendering?addEventListener("prerenderingchange",a,!0):a()},Un=[1800,3e3],k=(a,S={})=>{const C=M(S);w((()=>{const L=r(S,D),x=m();let I,N=y("FCP");const B=b(["paint"],(a=>{for(const S of a)"first-contentful-paint"===S.name&&(B.disconnect(),S.startTime<x.firstHiddenTime&&(N.value=Math.max(S.startTime-d(),0),N.entries.push(S),N.navigationId=S.navigationId||N.navigationId,I(!0)))}));B&&(I=l(a,N,Un,S.reportAllChanges),f((C=>{N=y("FCP",-1,"back-forward-cache",N.navigationId,N.navigationInteractionId,N.navigationURL,c()),I=l(a,N,Un,S.reportAllChanges),u((()=>{N.value=performance.now()-C.timeStamp,I(!0)}))}))),C&&b(["soft-navigation"],(C=>{C.forEach((C=>{L.u&&C.navigationId&&T(L.u,C);const x=Math.max((C.presentationTime||C.paintTime||0)-C.startTime,0);N=y("FCP",x,"soft-navigation",C.navigationId,C.interactionId,C.name,C.startTime),I=l(a,N,Un,S.reportAllChanges),I(!0)}))}),S)}))},Bn=[.1,.25],P=a=>a.find((a=>1===a.node?.nodeType))||a[0],F=(a,S={})=>{const C=r(S=Object.assign({},S),t),L=new WeakMap;C.t=a=>{if(a?.sources?.length){const C=P(a.sources),x=C?.node;if(x){const a=S.generateTarget?.(x)??i(x);L.set(C,a)}}},((a,S={})=>{const C=m();k(E((()=>{let L,x=y("CLS",0);const I=r(S,t),d=(C,N,B,$,V)=>{x=y("CLS",0,C,N,B,$,V),I.o=0,L=l(a,x,Bn,S.reportAllChanges)},h=(a=!1)=>{I.o>x.value&&(x.value=I.o,x.entries=I.i),L(a)},g=a=>{h(!0),d("soft-navigation",a.navigationId,a.interactionId,a.name,a.startTime)},v=a=>{for(const S of a)"soft-navigation"!==S.entryType?I.l(S):g(S);h()},N=["layout-shift"];M(S)&&N.push("soft-navigation");const B=b(N,v);B&&(L=l(a,x,Bn,S.reportAllChanges),C.onHidden((()=>{v(B.takeRecords()),L(!0)})),f((()=>{d("back-forward-cache",x.navigationId,x.navigationInteractionId,x.navigationURL,c()),u(L)})),setTimeout(L))})))})((S=>{a((a=>{let S={};if(a.entries.length){const C=a.entries.reduce(((a,S)=>a.value>S.value?a:S));if(C?.sources?.length){const a=P(C.sources);a&&(S={largestShiftTarget:L.get(a),largestShiftTime:C.startTime,largestShiftValue:C.value,largestShiftSource:a,largestShiftEntry:C,loadState:e(C.startTime)})}}return Object.assign(a,{attribution:S})})(S))}),S)},_=(a,S={})=>{const C=r(S=Object.assign({},S),D);M(S)&&(C.u=new Map),k((S=>{a((a=>{let S={timeToFirstByte:0,firstByteToFCP:a.value,loadState:e(c())};if("soft-navigation"!==a.navigationType){if(a.entries.length){const C=n(),L=a.entries.at(-1);if(C){const x=C.responseStart,I=C.activationStart||0,N=Math.max(0,x-I);S={timeToFirstByte:N,firstByteToFCP:a.value-N,loadState:e(a.entries[0].startTime),navigationEntry:C,fcpEntry:L}}}}else{const L=C.u?.get(a.navigationId);L&&(S={timeToFirstByte:0,firstByteToFCP:a.value,loadState:"complete",navigationEntry:L})}return Object.assign(a,{attribution:S})})(S))}),S)};let $n=0,Vn=1/0,zn=0;const O=a=>{for(const S of a)S.interactionId&&(Vn=Math.min(Vn,S.interactionId),zn=Math.max(zn,S.interactionId),$n=zn?(zn-Vn)/7+1:0)};let Hn;const A=()=>Hn?$n:performance.interactionCount??0;class q{constructor(){this.h=0,this.v=[],this.p=new Map}T(){return A()-this.h}D(){this.h=A(),this.v.length=0,this.p.clear()}S(a){const S=this.T(),C=Math.min(this.v.length-1,Math.floor(S/50));return!S||-1!==C||"soft-navigation"!==a&&"back-forward-cache"!==a?this.v[C]:{k:8,id:-1,entries:[]}}l(a){if(this.m?.(a),!a.interactionId)return;const S=this.v.at(-1);let C=this.p.get(a.interactionId);if(C||this.v.length<10||a.duration>S.k){if(C?a.duration>C.k?(C.entries=[a],C.k=a.duration):a.duration===C.k&&a.startTime===C.entries[0].startTime&&C.entries.push(a):(C={id:a.interactionId,entries:[a],k:a.duration},this.p.set(C.id,C),this.v.push(C)),this.v.sort(((a,S)=>S.k-a.k)),this.v.length>10){const a=this.v.splice(10);for(const S of a)this.p.delete(S.id)}this.M?.(C)}}}const W=a=>{const S="requestIdleCallback"in globalThis?1e3:0,C=globalThis.requestIdleCallback||setTimeout,L=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)a();else{const x=E(a);let I=-1;const r=()=>{L(I),x()};addEventListener("visibilitychange",r,{once:!0,capture:!0}),I=C((()=>{removeEventListener("visibilitychange",r,{capture:!0}),x()}),{timeout:S})}},jn=[200,500],R=(a,S={})=>{const C=r(S=Object.assign({},S),q);let L=[],x=[],I=0;const N=new WeakMap,B=new WeakMap;let $=!1;const v=()=>{$||($=!0,W(p))},p=()=>{const a=new Set(C.v.map((a=>N.get(a.entries[0])))),S=x.length-10;x=x.filter(((C,L)=>L>=S||a.has(C)));const B=new Set;for(const a of x){const S=T(a.startTime,a.processingEnd);for(const a of S)B.add(a)}const V=L.length-10;L=L.filter(((a,S)=>B.has(a)||S>=V&&a.startTime>I)),$=!1};C.m=a=>{const C=a.startTime+a.duration;let L;I=Math.max(I,a.processingEnd);for(let I=x.length-1;I>=0;I--){const N=x[I];if(Math.abs(C-N.renderTime)<=8){L=N,L.startTime=Math.min(a.startTime,L.startTime),L.processingStart=Math.min(a.processingStart,L.processingStart),L.processingEnd=Math.max(a.processingEnd,L.processingEnd),S.includeProcessedEventEntries&&L.entries.push(a);break}}L||(L={startTime:a.startTime,processingStart:a.processingStart,processingEnd:a.processingEnd,renderTime:C,entries:S.includeProcessedEventEntries?[a]:[]},x.push(L)),a.interactionId&&N.set(a,L),v()},C.M=a=>{if(!B.get(a)){const C=a.entries.find((a=>a.target))?.target;if(C){const L=S.generateTarget?.(C)??i(C);B.set(a,L)}else{const S=a.entries.find((a=>a.targetSelector))?.targetSelector;S&&B.set(a,S)}}};const T=(a,S)=>{const C=[];for(const x of L)if(!(x.startTime+x.duration<a)){if(x.startTime>S)break;C.push(x)}return C};b(["long-animation-frame"],(a=>{L=L.concat(a),v()}),S),((a,S={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const C=m();w((()=>{"interactionCount"in performance||Hn||(Hn=b(["event"],O,{durationThreshold:0}));let L,x=y("INP");const I=r(S,q),s=(C,N,B,$,V)=>{I.D(),x=y("INP",-1,C,N,B,$,V),L=l(a,x,jn,S.reportAllChanges)},u=()=>{const a=I.S(x.navigationType);a&&a.k!==x.value&&(x.value=a.k,x.entries=a.entries,L())},d=a=>{u(),L(!0),s("soft-navigation",a.navigationId,a.interactionId,a.name,a.startTime)},h=(a,S=!1)=>{W((()=>{for(const S of a)"soft-navigation"!==S.entryType?I.l(S):d(S);u(),S&&L(!0)}))},N=["event","first-input"];M(S)&&N.push("soft-navigation");const B=b(N,h,{...S,durationThreshold:S.durationThreshold??40});L=l(a,x,jn,S.reportAllChanges),B&&(C.onHidden((()=>{h(B.takeRecords(),!0)})),f((()=>{s("back-forward-cache",x.navigationId,x.navigationInteractionId,x.navigationURL,c())})))}))})((S=>{a((a=>{if(0===a.entries.length){const S=a.navigationStartTime||0,C={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:a.value,loadState:e(S)};return Object.assign(a,{attribution:C})}const S=a.entries[0],L=N.get(S),x=Math.max(L.processingStart,S.startTime),I=Math.max(S.startTime+S.duration,x),$=Math.min(L.processingEnd,I),V=L.entries.sort(((a,S)=>a.processingStart-S.processingStart)),H=T(S.startTime,$),j=C.p.get(S.interactionId),G={interactionTarget:B.get(j),interactionType:S.name.startsWith("key")?"keyboard":"pointer",interactionTime:S.startTime,nextPaintTime:I,processedEventEntries:V,longAnimationFrameEntries:H,inputDelay:x-S.startTime,processingDuration:$-x,presentationDelay:I-$,loadState:e(S.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(a=>{const S=a.interactionTime,C=a.nextPaintTime;if(!a.longAnimationFrameEntries?.length||!S||!C)return;const L=a.inputDelay,x=a.processingDuration;let I,N,B=0,$=0,V=0,H=0;for(const C of a.longAnimationFrameEntries){$=$+C.startTime+C.duration-C.styleAndLayoutStart;for(const a of C.scripts){const C=a.startTime+a.duration;if(C<S)continue;const V=C-Math.max(S,a.startTime),j=a.duration?V/a.duration*a.forcedStyleAndLayoutDuration:0;B+=V-j,$+=j,V>H&&(N=a.startTime<S+L?"input-delay":a.startTime>=S+L+x?"presentation-delay":"processing-duration",I=a,H=V)}}const j=a.longAnimationFrameEntries.at(-1),G=j?j.startTime+j.duration:0;G>=S+L+x&&(V=C-G),I&&N&&(a.longestScript={entry:I,subpart:N,intersectingDuration:H}),a.totalScriptDuration=B,a.totalStyleAndLayoutDuration=$,a.totalPaintDuration=V,a.totalUnattributedDuration=C-S-B-$-V})(G),Object.assign(a,{attribution:G})})(S))}),S)};class U{l(a){this.m?.(a)}}const qn=[2500,4e3];let Gn=50;const Wn=[];b(["resource"],(a=>{for(const S of a)Wn.push(S),Wn.length>Gn&&Wn.shift()}));const z=(a,S={})=>{null!=(S=Object.assign({},S)).resourceBufferSize&&(Gn=S.resourceBufferSize);const C=r(S,U),L=new WeakMap;M(S)&&(C.u=new Map),C.m=a=>{const C=a.element;if(C){const x=S.generateTarget?.(C)??i(C);L.set(a,x)}else a.id&&L.set(a,`#${a.id}`)},((a,S={})=>{let C=!1;const L=M(S);w((()=>{let x,I=m(),N=y("LCP");const B=r(S,U),g=(L,B,$,V,H)=>{N=y("LCP",-1,L,B,$,V,H),x=l(a,N,qn,S.reportAllChanges),C=!1,"soft-navigation"===L&&(I=m(!0))},v=a=>{B.u&&a.navigationId&&T(B.u,a),C||x(!0),g("soft-navigation",a.navigationId,a.interactionId,a.name,a.startTime);const S=a.getLargestInteractionContentfulPaint?.();S&&p([S])},p=a=>{S.reportAllChanges||L||(a=a.slice(-1));for(const S of a){if(!S)continue;if("soft-navigation"===S.entryType){v(S);continue}let a=0,C=[],L=S.startTime;if("largest-contentful-paint"===S.entryType)a=Math.max(S.startTime-d(),0),B.l(S),C=[S];else if("interaction-contentful-paint"===S.entryType){const x=S;if(!N.navigationId)continue;if("interactionId"in x&&x.interactionId!=N.navigationInteractionId)continue;L=x.largestContentfulPaint?.renderTime||0,a=Math.max(L-S.startTime,0),x.largestContentfulPaint&&(B.l(x.largestContentfulPaint),C=[x.largestContentfulPaint])}L<I.firstHiddenTime&&(N.value=a,N.entries=C,x())}},$=["largest-contentful-paint"];L&&$.push("interaction-contentful-paint","soft-navigation");const V=b($,p);if(V){x=l(a,N,qn,S.reportAllChanges);const I=["keydown","click","visibilitychange"],r=a=>{if(a.isTrusted&&!C){const a=N.id;W((()=>{if(!C){if(!L){V.disconnect();for(const a of I)removeEventListener(a,r,{capture:!0})}a===N.id&&(C=!0,x(!0))}}))}};for(const a of I)addEventListener(a,r,{capture:!0});f((L=>{g("back-forward-cache",N.navigationId,N.navigationInteractionId,N.navigationURL,c()),x=l(a,N,qn,S.reportAllChanges),u((()=>{N.value=performance.now()-L.timeStamp,C=!0,x(!0)}))}))}}))})((S=>{a((a=>{let S={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:a.value};if(a.entries.length){const x=a.entries.at(-1),r=a=>a.name===x.url&&(a.requestStart||a.startTime)<=x.startTime,I=x.url&&(Wn.findLast(r)||performance.getEntriesByType("resource").findLast(r));let N;S.target=L.get(x),S.lcpEntry=x,x.url&&(S.url=x.url),I&&(S.lcpResourceEntry=I);let B=0,$=0;if("soft-navigation"!==a.navigationType?(N=n(),B=N?.activationStart??0,$=N?.responseStart??0):(B=a.navigationStartTime||0,N=C.u?.get(a.navigationId)),N){const C=Math.max(0,$-B),L=Math.max(C,I?(I.requestStart||I.startTime)-B:0),x=Math.min(a.value,Math.max(L,I?I.responseEnd-B:0));S={...S,timeToFirstByte:C,resourceLoadDelay:L-C,resourceLoadDuration:x-L,elementRenderDelay:a.value-x,navigationEntry:N}}}return Object.assign(a,{attribution:S})})(S))}),S)},Kn=[800,1800],J=a=>{document.prerendering?w((()=>J(a))):"complete"!==document.readyState?addEventListener("load",(()=>J(a)),!0):setTimeout(a)},K=(a,S={})=>{((a,S={})=>{const C=M(S);let L=y("TTFB"),x=l(a,L,Kn,S.reportAllChanges);J((()=>{const I=n();if(I){const N=I.responseStart;L.value=Math.max(N-d(),0),L.entries=[I],x(!0),f((()=>{L=y("TTFB",0,"back-forward-cache",L.navigationId,L.navigationInteractionId,L.navigationURL,c()),x=l(a,L,Kn,S.reportAllChanges),x(!0)})),C&&b(["soft-navigation"],(C=>{C.forEach((C=>{C.navigationId&&(L=y("TTFB",0,"soft-navigation",C.navigationId,C.interactionId,C.name,C.startTime),L.entries=[C],x=l(a,L,Kn,S.reportAllChanges),x(!0))}))}),S)}}))})((S=>{a((a=>{const S=a.entries[0];let C={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0,navigationEntry:S};if(a.entries.length&&S instanceof PerformanceNavigationTiming){const L=S.activationStart||0,x=Math.max((S.workerStart||S.fetchStart||0)-L,0),I=Math.max(S.domainLookupStart-L,0),N=Math.max(S.connectStart-L,0),B=Math.max(S.connectEnd-L,0);C={waitingDuration:x,cacheDuration:I-x,dnsDuration:N-I,connectionDuration:B-N,requestDuration:a.value-B,navigationEntry:S}}return Object.assign(a,{attribution:C})})(S))}),S)};var Qn=class extends bn{constructor(a={}){super("@opentelemetry/browser-instrumentation/web-vitals",$r,a),this._hasSubscribed=!1,this._hasWarnedApplyCustomLogRecordData=!1,this._softNavsActive=!1}_onEnable(){if(this._hasSubscribed)return;this._diag.debug("Subscribing listeners");const{reportAllChanges:a,reportSoftNavs:S}=this._config;this._softNavsActive=(S??!1)&&isSoftNavSupported();const C={reportAllChanges:a??!1,reportSoftNavs:S??!1},L={...C,reportSoftNavs:!1},x=[["CLS",F],["INP",R],["LCP",z],["FCP",_],["TTFB",K]];for(const[a,S]of x)try{S((a=>this._emitWebVital(a)),"TTFB"===a?L:C)}catch(S){this._diag.warn(`could not subscribe to ${a}`,this._toError(S))}this._hasSubscribed=!0}_getTimestampForMetric(a){if("CLS"===a.name){const{attribution:S}=a;return void 0!==S.largestShiftTime?S.largestShiftTime:void 0}if("INP"===a.name){const{attribution:S}=a;return S.interactionTime??(a.navigationStartTime||void 0)}return(a.navigationStartTime??0)+a.value}_emitWebVital(a){this.isEnabled()&&this._safeExecute("failed to record a web vital",(()=>this._recordWebVital(a)))}_recordWebVital(a){const S={[xn]:a.name.toLowerCase(),[Rn]:a.value,[Pn]:a.delta,[In]:a.rating,[On]:a.id,[kn]:a.navigationType};a.navigationId&&(S["browser.web_vital.navigation_id"]=a.navigationId);const{applyCustomLogRecordData:C,includeRawAttribution:L,sanitizeUrl:x}=this._config;this._softNavsActive&&void 0!==a.navigationURL&&(S["browser.web_vital.navigation_url"]=x?x(a.navigationURL):a.navigationURL);const I=this._getTimestampForMetric(a),N={eventName:"browser.web_vital",severityNumber:hn.INFO,attributes:S,...L?{body:JSON.stringify(a.attribution)}:{},...void 0!==I?{timestamp:I}:{}};C&&(this._hasWarnedApplyCustomLogRecordData||(this._hasWarnedApplyCustomLogRecordData=!0,this._diag.warn("applyCustomLogRecordData is deprecated. Use a custom LogRecordProcessor registered with LoggerProvider instead.")),this._safeExecute("applyCustomLogRecordData hook failed",(()=>C(N)))),this.logger.emit(N)}};const isSoftNavSupported=()=>PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint;var Xn=class{constructor(){this._enabled=!1,this._currentContext=Y}_bindFunction(a=Y,S){const C=this,contextWrapper=function(...L){return C.with(a,(()=>S.apply(this,L)))};return Object.defineProperty(contextWrapper,"length",{enumerable:!1,configurable:!0,writable:!1,value:S.length}),contextWrapper}active(){return this._currentContext}bind(a,S){return void 0===a&&(a=this.active()),"function"==typeof S?this._bindFunction(a,S):S}disable(){return this._currentContext=Y,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=Y),this}with(a,S,C,...L){const x=this._currentContext;this._currentContext=a||Y;try{return S.call(C,...L)}finally{this._currentContext=x}}},Jn=class{shouldSample(){return{decision:0}}toString(){return"AlwaysOffSampler"}},Yn=class{shouldSample(){return{decision:2}}toString(){return"AlwaysOnSampler"}},Zn=class{constructor(a){this._root=a.root,this._root||(globalErrorHandler(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Yn),this._remoteParentSampled=a.remoteParentSampled??new Yn,this._remoteParentNotSampled=a.remoteParentNotSampled??new Jn,this._localParentSampled=a.localParentSampled??new Yn,this._localParentNotSampled=a.localParentNotSampled??new Jn}shouldSample(a,S,C,L,x,I){const N=Wt.getSpanContext(a);return N&&isSpanContextValid(N)?N.isRemote?N.traceFlags&gt.SAMPLED?this._remoteParentSampled.shouldSample(a,S,C,L,x,I):this._remoteParentNotSampled.shouldSample(a,S,C,L,x,I):N.traceFlags&gt.SAMPLED?this._localParentSampled.shouldSample(a,S,C,L,x,I):this._localParentNotSampled.shouldSample(a,S,C,L,x,I):this._root.shouldSample(a,S,C,L,x,I)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};const ts=Symbol.for("nodejs.util.inspect.custom");function settledResourceAttributes(a){const S={};for(const[C,L]of a.getRawAttributes())"function"!=typeof L?.then&&null!=L&&(S[C]??(S[C]=L));return S}function formatInspect(a,S,C,L,x){if("number"==typeof C&&C<0){const S=`[${a}]`;return L?.stylize?L.stylize(S,"special"):S}return"function"==typeof x&&L?`${a} ${x(S,{...L,depth:null==L.depth?L.depth:L.depth-1})}`:S}var es=class{constructor(a){this.links=[],this.events=[],this._droppedAttributesCount=0,this._droppedEventsCount=0,this._droppedLinksCount=0,this._attributesCount=0,this.status={code:xt.UNSET},this.endTime=[0,0],this._ended=!1,this._duration=[-1,-1];const S=Date.now();if(this._spanContext=a.spanContext,this._performanceStartTime=performance.now(),this._performanceOffset=S-(this._performanceStartTime+performance.timeOrigin),this._startTimeProvided=null!=a.startTime,this._spanLimits=a.spanLimits,this._spanProcessor=a.spanProcessor,this.name=a.name,this.parentSpanContext=a.parentSpanContext,this.kind=a.kind,this.startTime=this._getTime(a.startTime??S),this.resource=a.resource,this.instrumentationScope=a.scope,this._recordEndMetrics=a.recordEndMetrics,a.links){const{linkCountLimit:S}=this._spanLimits;a.links.length>S?(this.links=a.links.slice(a.links.length-S,a.links.length),this._droppedLinksCount=a.links.length-S):(this.links=a.links,this._droppedLinksCount=0)}this.attributes=a.attributes??{},this._attributesCount=Object.keys(this.attributes).length,this._droppedAttributesCount=a.droppedAttributesCount??0,this._spanProcessor.onStart(this,a.context)}spanContext(){return this._spanContext}setAttribute(a,S){if(this._isSpanEnded())return this;const C=maybeAddAttribute({key:a,value:S,attributes:this.attributes,limits:this._spanLimits,currentAttributesCount:this._attributesCount});return C===Qt.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,1===this._droppedAttributesCount&&kt.warn("Dropping extra attributes.")):C===Qt.ADD_NEW&&this._attributesCount++,this}setAttributes(a){for(const S in a)Object.prototype.hasOwnProperty.call(a,S)&&this.setAttribute(S,a[S]);return this}addEvent(a,S,C){if(this._isSpanEnded())return this;const{eventCountLimit:L}=this._spanLimits;return 0===L?(kt.warn("No events allowed."),this._droppedEventsCount++,this):(void 0!==L&&this.events.length>=L&&(0===this._droppedEventsCount&&kt.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),isTimeInput(S)&&(isTimeInput(C)||(C=S),S=void 0),this.events.push({name:a,time:this._getTime(C),...cleanSimpleAttributes(S,{attributeCountLimit:this._spanLimits.attributePerEventCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit})}),this)}addLink(a){if(this._isSpanEnded())return this;const{linkCountLimit:S}=this._spanLimits;return 0===S?(this._droppedLinksCount++,this):(void 0!==S&&this.links.length>=S&&(0===this._droppedLinksCount&&kt.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++),this.links.push({context:a.context,...cleanAttributes(a.attributes,{attributeCountLimit:this._spanLimits.attributePerLinkCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit})}),this)}addLinks(a){for(const S of a)this.addLink(S);return this}setStatus(a){if(this._isSpanEnded())return this;if(a.code===xt.UNSET)return this;if(this.status.code===xt.OK)return this;const S={code:a.code};return a.code===xt.ERROR&&("string"==typeof a.message?S.message=a.message:null!=a.message&&kt.warn(`Dropping invalid status.message of type '${typeof a.message}', expected 'string'`)),this.status=S,this}updateName(a){return this._isSpanEnded()||(this.name=a),this}end(a){this._isSpanEnded()?kt.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(a),this._duration=hrTimeDuration(this.startTime,this.endTime),this._duration[0]<0&&(kt.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&kt.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&kt.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(a){if("number"==typeof a&&a<=performance.now())return hrTime(a+this._performanceOffset);if("number"==typeof a)return millisToHrTime(a);if(a instanceof Date)return millisToHrTime(a.getTime());if(isTimeInputHrTime(a))return a;if(this._startTimeProvided)return millisToHrTime(Date.now());const S=performance.now()-this._performanceStartTime;return addHrTimes(this.startTime,millisToHrTime(S))}isRecording(){return!1===this._ended}recordException(a,S){const C={};"string"==typeof a?C[me]=a:a&&(a.code?C[_e]=a.code.toString():a.name&&(C[_e]=a.name),a.message&&(C[me]=a.message),a.stack&&(C[fe]=a.stack)),C[_e]||C[me]?this.addEvent("exception",C,S):kt.warn(`Failed to record an exception ${a}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const a=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);kt.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,a)}return this._ended}[ts](a,S,C){return formatInspect("SpanImpl",{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:settledResourceAttributes(this.resource)}},a,S,C)}};const rs="otel.component.name",ns="otel.component.type",ss="otel.span.parent.origin",is="otel.span.sampling_result";var os=class{constructor(a){this.startedSpans=a.createCounter("otel.sdk.span.started",{unit:"{span}",description:"The number of created spans."}),this.liveSpans=a.createUpDownCounter("otel.sdk.span.live",{unit:"{span}",description:"The number of currently live spans."})}startSpan(a,S){const C=function samplingDecisionToString(a){switch(a){case 2:return"RECORD_AND_SAMPLE";case 1:return"RECORD_ONLY";case 0:return"DROP"}}(S);if(this.startedSpans.add(1,{[ss]:parentOrigin(a),[is]:C}),0===S)return()=>{};const L={[is]:C};return this.liveSpans.add(1,L),()=>{this.liveSpans.add(-1,L)}}};function parentOrigin(a){return a?a.isRemote?"remote":"local":"none"}const as={attributeCountLimit:1/0,attributeValueLengthLimit:1/0};var cs=class{constructor(a,S){this.instrumentationScope=a,this._sampler=S.sampler,this._spanLimits=S.spanLimits,this._resource=S.resource,this._idGenerator=S.idGenerator,this._spanProcessor=S.spanProcessor;const C=S.meterProvider.getMeter("@opentelemetry/sdk-trace","3.1.1");this._tracerMetrics=new os(C)}startSpan(a,S={},C=Ot.active()){S.root&&(C=Wt.deleteSpan(C));const L=Wt.getSpan(C);if(isTracingSuppressed(C))return kt.debug("Instrumentation suppressed, returning Noop Span"),Wt.wrapSpanContext(mt);const x=L?.spanContext(),I=this._idGenerator.generateSpanId();let N,B,$;x&&Wt.isSpanContextValid(x)?(B=x.traceId,$=x.traceState,N=x):B=this._idGenerator.generateTraceId();const V=S.kind??Lt.INTERNAL,H=(S.links??[]).map((a=>({context:a.context,...cleanAttributes(a.attributes,{attributeCountLimit:this._spanLimits.attributePerLinkCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit})}))),j=cleanAttributes(S.attributes,as),G=j.attributes??{},Q=this._sampler.shouldSample(C,B,a,V,G,H),X=this._tracerMetrics.startSpan(x,Q.decision);$=Q.traceState??$;const Y={traceId:B,spanId:I,traceFlags:Q.decision===Pt.RECORD_AND_SAMPLED?gt.SAMPLED:gt.NONE,traceState:$};if(Q.decision===Pt.NOT_RECORD)return kt.debug("Recording is off, propagating context in a non-recording span"),Wt.wrapSpanContext(Y);const Z=cleanAttributes(Object.assign(G,Q.attributes),this._spanLimits);return new es({resource:this._resource,scope:this.instrumentationScope,context:C,spanContext:Y,name:a,kind:V,links:H,parentSpanContext:N,attributes:Z.attributes,droppedAttributesCount:(j.droppedAttributesCount??0)+(Z.droppedAttributesCount??0),startTime:S.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:X})}startActiveSpan(a,S,C,L){let x,I,N;if(arguments.length<2)return;2===arguments.length?N=S:3===arguments.length?(x=S,N=C):(x=S,I=C,N=L);const B=I??Ot.active(),$=this.startSpan(a,x,B),V=Wt.setSpan(B,$);return Ot.with(V,N,void 0,$)}[ts](a,S,C){return formatInspect("Tracer",{instrumentationScope:this.instrumentationScope,resource:{attributes:settledResourceAttributes(this._resource)},spanLimits:this._spanLimits},a,S,C)}},us=class{constructor(a){this._spanProcessors=a}forceFlush(){const a=[];for(const S of this._spanProcessors)a.push(S.forceFlush());return new Promise((S=>{Promise.all(a).then((()=>{S()})).catch((a=>{globalErrorHandler(a||new Error("MultiSpanProcessor: forceFlush failed")),S()}))}))}onStart(a,S){for(const C of this._spanProcessors)C.onStart(a,S)}onEnding(a){for(const S of this._spanProcessors)S.onEnding&&S.onEnding(a)}onEnd(a){for(const S of this._spanProcessors)S.onEnd(a)}shutdown(){const a=[];for(const S of this._spanProcessors)a.push(S.shutdown());return new Promise(((S,C)=>{Promise.all(a).then((()=>{S()}),C)}))}};const ls=new Map;var ds=class{constructor(a,S,C){const L=ls.get(a)??0;if(ls.set(a,L+1),this.standardAttrs={[ns]:a,[rs]:`${a}/${L}`},this.droppedAttrs={...this.standardAttrs,[ge]:"queue_full"},this.processedSpans=S.createCounter("otel.sdk.processor.span.processed",{unit:"{span}",description:"The number of spans for which the processing has finished, either successful or failed."}),C){const{capacity:a,getQueueSize:L}=C;S.createUpDownCounter("otel.sdk.processor.span.queue.capacity",{unit:"{span}",description:"The maximum number of spans the queue of a given instance of an SDK span processor can hold."}).add(a,this.standardAttrs),this.queueSize=S.createObservableUpDownCounter("otel.sdk.processor.span.queue.size",{unit:"{span}",description:"The number of spans in the queue of a given instance of an SDK span processor."}),this.queueSizeCallback=a=>a.observe(L(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(a){this.processedSpans.add(a,this.droppedAttrs)}finishSpans(a,S){if(!S)return void this.processedSpans.add(a,this.standardAttrs);const C={...this.standardAttrs,[ge]:S.name};this.processedSpans.add(a,C)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}},hs=class{constructor(a){this._isExporting=!1,this._finishedSpans=[],this._droppedSpansCount=0,this._exporter=a.exporter,this._maxExportBatchSize=a.maxExportBatchSize??512,this._maxQueueSize=a.maxQueueSize??2048,this._scheduledDelayMillis=a.scheduledDelayMillis??5e3,this._exportTimeoutMillis=a.exportTimeoutMillis??3e4,this._shutdownOnce=new he(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(kt.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);const S=a.selfObsMeterProvider?a.selfObsMeterProvider.getMeter("@opentelemetry/sdk-trace"):createNoopMeter();this._metrics=new ds("batching_span_processor",S,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(a,S){}onEnd(a){this._shutdownOnce.isCalled||a.spanContext().traceFlags&gt.SAMPLED&&this._addToBuffer(a)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then((()=>this.onShutdown())).then((()=>this._flushAll())).then((()=>(this._metrics.shutdown(),this._exporter.shutdown())))}_addToBuffer(a){if(this._finishedSpans.length>=this._maxQueueSize)return 0===this._droppedSpansCount&&kt.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++,void this._metrics.dropSpans(1);this._droppedSpansCount>0&&(kt.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(a),this._maybeStartTimer()}_flushAll(){return new Promise(((a,S)=>{const C=[];for(let a=0,S=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);a<S;a++)C.push(this._flushOneBatch());Promise.all(C).then((()=>{a()})).catch(S)}))}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise(((a,S)=>{const C=setTimeout((()=>{S(new Error("Timeout"))}),this._exportTimeoutMillis);Ot.with(suppressTracing(Ot.active()),(()=>{let L;this._finishedSpans.length<=this._maxExportBatchSize?(L=this._finishedSpans,this._finishedSpans=[]):L=this._finishedSpans.splice(0,this._maxExportBatchSize);const doExport=()=>this._exporter.export(L,(x=>{clearTimeout(C),this._metrics.finishSpans(L.length,x.error),x.code===Zt.SUCCESS?a():S(x.error??new Error("BatchSpanProcessor: span export failed"))}));let x=null;for(let a=0,S=L.length;a<S;a++){const S=L[a].resource;S.asyncAttributesPending&&S.waitForAsyncAttributes&&(x??(x=new Set),x.add(S))}null===x?doExport():Promise.all(Array.from(x,(a=>a.waitForAsyncAttributes?.()))).then(doExport,(a=>{globalErrorHandler(a),S(a)}))}))}))}_maybeStartTimer(){if(this._isExporting)return;const flush=()=>{this._isExporting=!0,this._flushOneBatch().finally((()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())})).catch((a=>{this._isExporting=!1,globalErrorHandler(a)}))};if(this._finishedSpans.length>=this._maxExportBatchSize)return flush();void 0===this._timer&&(this._timer=setTimeout((()=>flush()),this._scheduledDelayMillis),function unrefTimer(a){const S=a;"number"!=typeof S&&S.unref?.()}(this._timer))}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}};var ps=class extends hs{constructor(a){super(a),this.onInit(a)}onInit(a){!0!==a.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch((a=>{globalErrorHandler(a)}))},document.addEventListener("visibilitychange",this._visibilityChangeListener))}onShutdown(){"undefined"!=typeof document&&this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener)}};const gs=new Uint8Array(16),ms=new Uint8Array(8),fs=Array.from({length:256},((a,S)=>S.toString(16).padStart(2,"0")));function randomFill(a){for(let S=0;S<a.length;S++)a[S]=256*Math.random()>>>0;for(let S=0;S<a.length;S++)if(a[S]>0)return;a[a.length-1]=1}function toHex(a){let S="";for(let C=0;C<a.length;C++)S+=fs[a[C]];return S}var _s=class{generateTraceId(){return randomFill(gs),toHex(gs)}generateSpanId(){return randomFill(ms),toHex(ms)}},bs=class{constructor(a={}){this._tracers=new Map,this._resource=a.resource??defaultResource();const S=a.spanProcessors??[];this._activeSpanProcessor=new us(S),this._tracerOptions={resource:this._resource,sampler:a.sampler??new Zn({root:new Yn}),spanLimits:{attributeCountLimit:a.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:a.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:a.spanLimits?.eventCountLimit??128,linkCountLimit:a.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:a.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:a.spanLimits?.attributePerLinkCountLimit??128},idGenerator:a.idGenerator||new _s,spanProcessor:this._activeSpanProcessor,meterProvider:a.meterProvider??{getMeter:()=>createNoopMeter()}}}getTracer(a,S,C){const L=`${a}@${S||""}:${C?.schemaUrl||""}`;return this._tracers.has(L)||this._tracers.set(L,new cs({name:a,version:S,schemaUrl:C?.schemaUrl},this._tracerOptions)),this._tracers.get(L)}forceFlush(a){const S=a?.timeoutMillis??3e4,C=this._activeSpanProcessor._spanProcessors.map((a=>new Promise((C=>{let L;const x=setTimeout((()=>{C(new Error(`Span processor did not completed within timeout period of ${S} ms`)),L=1}),S);a.forceFlush().then((()=>{clearTimeout(x),1!==L&&(L=0,C(L))})).catch((a=>{clearTimeout(x),L=2,C(a)}))}))));return new Promise(((a,S)=>{Promise.all(C).then((C=>{const L=C.filter((a=>0!==a));L.length>0?S(L):a()})).catch((a=>S([a])))}))}shutdown(){return this._activeSpanProcessor.shutdown()}[ts](a,S,C){const L=this._activeSpanProcessor._spanProcessors,x={resource:{attributes:settledResourceAttributes(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:L.map((a=>a.constructor?.name??"SpanProcessor"))};return formatInspect("TracerProvider",x,a,S,C)}};function safeExecuteInTheMiddle(a,S,C){let L,x;try{x=a()}catch(a){L=a}finally{return S(L,x),x}}let ys=console.error.bind(console);function defineProperty(a,S,C){const L=!!a[S]&&Object.prototype.propertyIsEnumerable.call(a,S);Object.defineProperty(a,S,{configurable:!0,enumerable:L,writable:!0,value:C})}const wrap=(a,S,C)=>{if(!a||!a[S])return void ys("no original function "+String(S)+" to wrap");if(!C)return ys("no wrapper function"),void ys((new Error).stack);const L=a[S];if("function"!=typeof L||"function"!=typeof C)return void ys("original object and wrapper must be functions");const x=C(L,S);return defineProperty(x,"__original",L),defineProperty(x,"__unwrap",(()=>{a[S]===x&&defineProperty(a,S,L)})),defineProperty(x,"__wrapped",!0),defineProperty(a,S,x),x},massWrap=(a,S,C)=>{if(!a)return ys("must provide one or more modules to patch"),void ys((new Error).stack);Array.isArray(a)||(a=[a]),S&&Array.isArray(S)?a.forEach((a=>{S.forEach((S=>{wrap(a,S,C)}))})):ys("must provide one or more functions to wrap on modules")},unwrap=(a,S)=>{if(!a||!a[S])return ys("no function to unwrap."),void ys((new Error).stack);const C=a[S];C.__unwrap?C.__unwrap():ys("no original to unwrap to -- has "+String(S)+" already been unwrapped?")},massUnwrap=(a,S)=>{if(!a)return ys("must provide one or more modules to patch"),void ys((new Error).stack);Array.isArray(a)||(a=[a]),S&&Array.isArray(S)?a.forEach((a=>{S.forEach((S=>{unwrap(a,S)}))})):ys("must provide one or more functions to unwrap on modules")};var vs=class{constructor(a,S,C){this._config={},this._wrap=wrap,this._unwrap=unwrap,this._massWrap=massWrap,this._massUnwrap=massUnwrap,this.instrumentationName=a,this.instrumentationVersion=S,this.setConfig(C),this._diag=kt.createComponentLogger({namespace:a}),this._tracer=Wt.getTracer(a,S),this._meter=Vt.getMeter(a,S),this._logger=Ut.getLogger(a,S),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(a){this._meter=a.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(a){this._logger=a.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const a=this.init()??[];return Array.isArray(a)?a:[a]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(a){this._config={enabled:!0,...a}}setTracerProvider(a){this._tracer=a.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(a,S,C,L){if(a)try{a(C,L)}catch(a){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:S},a)}}},ws=class extends vs{constructor(a,S,C){super(a,S,C),this._enabled=!1,this._config.enabled&&this.enable()}isEnabled(){return this._enabled}};const Ss=kt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function getXHRBodyLength$1(a){return function isDocument$1(a){return"undefined"!=typeof Document&&a instanceof Document}(a)?(new XMLSerializer).serializeToString(document).length:"string"==typeof a?getByteLength$1(a):a instanceof Blob?a.size:a instanceof FormData?function getFormDataSize$1(a){let S=0;for(const[C,L]of a.entries())S+=C.length,L instanceof Blob?S+=L.size:S+=L.length;return S}(a):a instanceof URLSearchParams?getByteLength$1(a.toString()):void 0!==a.byteLength?a.byteLength:void Ss.warn("unknown body type")}const Ts=new TextEncoder;function getByteLength$1(a){return Ts.encode(a).byteLength}function normalizeHttpRequestMethod$1(a){const S=function getKnownMethods$1(){if(void 0===Cs){const a=void 0;a&&a.length>0?(Cs={},a.forEach((a=>{Cs[a]=!0}))):Cs=Es}return Cs}(),C=a.toUpperCase();return C in S?C:"_OTHER"}const Es={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let Cs;const As={"https:":"443","http:":"80"};const Ls="REDACTED",xs=["sig","Signature","AWSAccessKeyId","X-Goog-Signature","X-Amz-Signature","X-Amz-Credential","X-Amz-Security-Token"];function redactUrl$1(a){let S;try{S=new URL(a)}catch{return a}let C=!1;if((S.username||S.password)&&(S.username=Ls,S.password=Ls,C=!0),S.search.length>1){let a=!1;const L=S.search.slice(1).split("&").map((S=>{const C=S.indexOf("="),L=-1===C?S:S.slice(0,C);return xs.includes(function decodeQueryKey$1(a){try{return decodeURIComponent(a.replace(/\+/g," "))}catch{return a}}(L))?(a=!0,`${L}=${Ls}`):S}));a&&(S.search=`?${L.join("&")}`,C=!0)}return C?S.href:a}const Rs="0.301.2";let Is,Ps=function(a){return a.CONNECT_END="connectEnd",a.CONNECT_START="connectStart",a.DECODED_BODY_SIZE="decodedBodySize",a.DOM_COMPLETE="domComplete",a.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",a.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",a.DOM_INTERACTIVE="domInteractive",a.DOMAIN_LOOKUP_END="domainLookupEnd",a.DOMAIN_LOOKUP_START="domainLookupStart",a.ENCODED_BODY_SIZE="encodedBodySize",a.FETCH_START="fetchStart",a.LOAD_EVENT_END="loadEventEnd",a.LOAD_EVENT_START="loadEventStart",a.NAVIGATION_START="navigationStart",a.REDIRECT_END="redirectEnd",a.REDIRECT_START="redirectStart",a.REQUEST_START="requestStart",a.RESPONSE_END="responseEnd",a.RESPONSE_START="responseStart",a.SECURE_CONNECTION_START="secureConnectionStart",a.START_TIME="startTime",a.UNLOAD_EVENT_END="unloadEventEnd",a.UNLOAD_EVENT_START="unloadEventStart",a}({});function hasKey(a,S){return S in a}function addSpanNetworkEvent(a,S,C,L=!0){if(hasKey(C,S)&&"number"==typeof C[S]&&(!L||0!==C[S]))return a.addEvent(S,C[S])}function addSpanNetworkEvents(a,S,C=!1,L){void 0===L&&(L=0!==S.startTime),C||(addSpanNetworkEvent(a,"fetchStart",S,L),addSpanNetworkEvent(a,"domainLookupStart",S,L),addSpanNetworkEvent(a,"domainLookupEnd",S,L),addSpanNetworkEvent(a,"connectStart",S,L),addSpanNetworkEvent(a,"secureConnectionStart",S,L),addSpanNetworkEvent(a,"connectEnd",S,L),addSpanNetworkEvent(a,"requestStart",S,L),addSpanNetworkEvent(a,"responseStart",S,L),addSpanNetworkEvent(a,"responseEnd",S,L))}function getOrigin(){return"undefined"!=typeof location?location.origin:void 0}function getResource(a,S,C,L,x=new WeakSet,I){const N=parseUrl(a),B=function filterResourcesForSpan(a,S,C,L,x,I){const N=hrTimeToNanoseconds(S),B=hrTimeToNanoseconds(C);let $=L.filter((S=>{const C=hrTimeToNanoseconds(timeInputToHrTime(S.fetchStart)),L=hrTimeToNanoseconds(timeInputToHrTime(S.responseEnd));return S.initiatorType.toLowerCase()===(I||"xmlhttprequest")&&S.name===a&&C>=N&&L<=B}));$.length>0&&($=$.filter((a=>!x.has(a))));return $}(a=N.toString(),S,C,L,x,I);if(0===B.length)return{mainRequest:void 0};if(1===B.length)return{mainRequest:B[0]};const $=function sortResources(a){return a.slice().sort(((a,S)=>{const C=a.fetchStart,L=S.fetchStart;return C>L?1:C<L?-1:0}))}(B);if(N.origin!==getOrigin()&&$.length>1){let a=$[0],S=function findMainRequest(a,S,C){const L=hrTimeToNanoseconds(C),x=hrTimeToNanoseconds(timeInputToHrTime(S));let I,N=a[1];const B=a.length;for(let S=1;S<B;S++){const C=a[S],B=hrTimeToNanoseconds(timeInputToHrTime(C.fetchStart)),$=L-hrTimeToNanoseconds(timeInputToHrTime(C.responseEnd));B>=x&&(!I||$<I)&&(I=$,N=C)}return N}($,a.responseEnd,C);const L=a.responseEnd;return S.fetchStart<L&&(S=a,a=void 0),{corsPreFlightRequest:a,mainRequest:S}}return{mainRequest:B[0]}}function parseUrl(a){if("function"==typeof URL)return new URL(a,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0);const S=function getUrlNormalizingAnchor(){return Is||(Is=document.createElement("a")),Is}();return S.href=a,S}function shouldPropagateTraceHeaders(a,S){let C=S||[];return("string"==typeof C||C instanceof RegExp)&&(C=[C]),parseUrl(a).origin===getOrigin()||C.some((S=>urlMatches(a,S)))}var Os=class extends ws{constructor(a={}){super("@opentelemetry/instrumentation-xml-http-request",Rs,a),this.component="xml-http-request",this.version=Rs,this.moduleName=this.component,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}init(){}_addHeaders(a,S){if(!shouldPropagateTraceHeaders(parseUrl(S).href,this.getConfig().propagateTraceHeaderCorsUrls)){const a={};return qt.inject(Ot.active(),a),void(Object.keys(a).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}const C={};qt.inject(Ot.active(),C),Object.keys(C).forEach((S=>{a.setRequestHeader(S,String(C[S]))}))}_addChildSpan(a,S){Ot.with(Wt.setSpan(Ot.active(),a),(()=>{const a=this.tracer.startSpan("CORS Preflight",{startTime:S[Ps.FETCH_START]});addSpanNetworkEvents(a,S,this.getConfig().ignoreNetworkEvents,void 0),a.end(S[Ps.RESPONSE_END])}))}_addFinalSpanAttributes(a,S){S.status&&a.setAttribute(ve,S.status)}_applyAttributesAfterXHR(a,S){const C=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof C&&safeExecuteInTheMiddle((()=>C(a,S)),(a=>{a&&this._diag.error("applyCustomAttributesOnSpan",a)}))}_addResourceObserver(a,S){const C=this._xhrMem.get(a);C&&"function"==typeof PerformanceObserver&&"function"==typeof PerformanceResourceTiming&&(C.createdResources={observer:new PerformanceObserver((a=>{const L=a.getEntries(),x=parseUrl(S);L.forEach((a=>{"xmlhttprequest"===a.initiatorType&&a.name===x.href&&C.createdResources&&C.createdResources.entries.push(a)}))})),entries:[]},C.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(a,S,C,L,x){if(!(C&&L&&x&&a.createdResources))return;let I=a.createdResources.entries;I&&I.length||(I=performance.getEntriesByType("resource"));const N=getResource(parseUrl(C).href,L,x,I,this._usedResources);if(N.mainRequest){const a=N.mainRequest;this._markResourceAsUsed(a);const C=N.corsPreFlightRequest;C&&(this._addChildSpan(S,C),this._markResourceAsUsed(C)),addSpanNetworkEvents(S,a,this.getConfig().ignoreNetworkEvents,void 0)}}_cleanPreviousSpanInformation(a){const S=this._xhrMem.get(a);if(S){const C=S.callbackToRemoveEvents;C&&C(),this._xhrMem.delete(a)}}_createSpan(a,S,C){const L=parseUrl(S);if(isUrlIgnored(L.href,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");const x={},I=C,N=normalizeHttpRequestMethod$1(C),B=N;x[be]=N,N!==I&&(x[ye]=I),x[Le]=redactUrl$1(L.toString()),x[we]=L.hostname;const $=function serverPortFromUrl$1(a){const S=Number(a.port||As[a.protocol]);return S&&!isNaN(S)?S:void 0}(L);$&&(x[Se]=$);const V=this.tracer.startSpan(B,{kind:Lt.CLIENT,attributes:x});return V.addEvent("open"),this._cleanPreviousSpanInformation(a),this._xhrMem.set(a,{span:V,spanUrl:S}),V}_markResourceAsUsed(a){this._usedResources.add(a)}_patchOpen(){return a=>{const S=this;return function patchOpen(...C){if(!S._enabled)return a.apply(this,C);const L=C[0],x=C[1];return S._createSpan(this,x,L),a.apply(this,C)}}}_patchSend(){const a=this;function endSpan(S,C,L,x){const I=a._xhrMem.get(C);if(!I)return;if(I.status=C.status,I.statusText=C.statusText,a._xhrMem.delete(C),I.span){const S=I.span;a._applyAttributesAfterXHR(S,C),L?x&&(S.setStatus({code:xt.ERROR,message:x}),S.setAttribute(ge,x)):I.status&&I.status>=400&&(S.setStatus({code:xt.ERROR}),S.setAttribute(ge,String(I.status)))}const N=hrTime(),B=Date.now();setTimeout((()=>{!function endSpanTimeout(S,C,L,x){const I=C.callbackToRemoveEvents;"function"==typeof I&&I();const{span:N,spanUrl:B,sendStartTime:$}=C;N&&(a._findResourceAndAddNetworkEvents(C,N,B,$,L),N.addEvent(S,x),a._addFinalSpanAttributes(N,C),N.end(x),a._tasksCount--),a._clearResources()}(S,I,N,B)}),300)}function onError(){endSpan("error",this,!0,"error")}function onAbort(){endSpan("abort",this,!1)}function onTimeout(){endSpan("timeout",this,!0,"timeout")}function onLoad(){this.status<299?endSpan("loaded",this,!1):endSpan("error",this,!1)}return S=>function patchSend(...C){if(!a._enabled)return S.apply(this,C);const L=a._xhrMem.get(this);if(!L)return S.apply(this,C);const x=L.span,I=L.spanUrl;if(x&&I){if(a.getConfig().measureRequestSize&&C?.[0]){const a=getXHRBodyLength$1(C[0]);void 0!==a&&x.setAttribute("http.request.body.size",a)}Ot.with(Wt.setSpan(Ot.active(),x),(()=>{a._tasksCount++,L.sendStartTime=hrTime(),x.addEvent("send"),this.addEventListener("abort",onAbort),this.addEventListener("error",onError),this.addEventListener("load",onLoad),this.addEventListener("timeout",onTimeout),L.callbackToRemoveEvents=()=>{!function unregister(S){S.removeEventListener("abort",onAbort),S.removeEventListener("error",onError),S.removeEventListener("load",onLoad),S.removeEventListener("timeout",onTimeout);const C=a._xhrMem.get(S);C&&(C.callbackToRemoveEvents=void 0)}(this),L.createdResources&&L.createdResources.observer.disconnect()},a._addHeaders(this,I),a._addResourceObserver(this,I)}))}return S.apply(this,C)}}enable(){if(!this._enabled){if(this._isXhrPatched)return this._diag.debug("reactivating existing patch on",this.moduleName,this.version),void(this._enabled=!0);try{this._diag.debug("applying patch to",this.moduleName,this.version);const a=XMLHttpRequest.prototype;for(const S of["open","send"])if("function"!=typeof a[S])return void this._diag.warn(`XMLHttpRequest.prototype.${S} is missing or not a function; instrumentation will not be enabled. Register the instrumentation after any XMLHttpRequest polyfill, or call enable() once it is available.`);this._wrap(a,"open",this._patchOpen()),this._wrap(a,"send",this._patchSend()),this._isXhrPatched=!0,this._enabled=!0}catch(a){this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.warn("Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.",a)}}}disable(){this._enabled&&(this._enabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}};const ks=kt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function getFetchBodyLength(...a){if(a[0]instanceof URL||"string"==typeof a[0]){const S=a[1];if(!S?.body)return Promise.resolve();if(S.body instanceof ReadableStream){const{body:a,length:C}=function _getBodyNonDestructively(a){if(!a.pipeThrough)return ks.warn("Platform has ReadableStream but not pipeThrough!"),{body:a,length:Promise.resolve(void 0)};let S,C=0;const L=new Promise((a=>{S=a})),x=new TransformStream({start(){},async transform(a,S){const L=await a;C+=L.byteLength,S.enqueue(a)},flush(){S(C)}});return{body:a.pipeThrough(x),length:L}}(S.body);return S.body=a,C}return Promise.resolve(function getXHRBodyLength(a){if(function isDocument(a){return"undefined"!=typeof Document&&a instanceof Document}(a))return(new XMLSerializer).serializeToString(document).length;if("string"==typeof a)return getByteLength(a);if(a instanceof Blob)return a.size;if(a instanceof FormData)return function getFormDataSize(a){let S=0;for(const[C,L]of a.entries())S+=C.length,L instanceof Blob?S+=L.size:S+=L.length;return S}(a);if(a instanceof URLSearchParams)return getByteLength(a.toString());if(void 0!==a.byteLength)return a.byteLength;ks.warn("unknown body type")}(S.body))}{const S=a[0];return S?.body?S.clone().text().then((a=>getByteLength(a))):Promise.resolve()}}const Ds=new TextEncoder;function getByteLength(a){return Ds.encode(a).byteLength}const Ns={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let Fs;function getKnownMethods(){if(void 0===Fs){const a=void 0;a&&a.length>0?(Fs={},a.forEach((a=>{Fs[a]=!0}))):Fs=Ns}return Fs}const Ms={"https:":"443","http:":"80"};const Us="REDACTED",Bs=["sig","Signature","AWSAccessKeyId","X-Goog-Signature","X-Amz-Signature","X-Amz-Credential","X-Amz-Security-Token"];function redactUrl(a){let S;try{S=new URL(a)}catch{return a}let C=!1;if((S.username||S.password)&&(S.username=Us,S.password=Us,C=!0),S.search.length>1){let a=!1;const L=S.search.slice(1).split("&").map((S=>{const C=S.indexOf("="),L=-1===C?S:S.slice(0,C);return Bs.includes(function decodeQueryKey(a){try{return decodeURIComponent(a.replace(/\+/g," "))}catch{return a}}(L))?(a=!0,`${L}=${Us}`):S}));a&&(S.search=`?${L.join("&")}`,C=!0)}return C?S.href:a}const $s="0.301.2",Vs="undefined"!=typeof PerformanceObserver;var zs=class extends ws{constructor(a={}){super("@opentelemetry/instrumentation-fetch",$s,a),this.component="fetch",this.version=$s,this.moduleName=this.component,this._usedResources=new WeakSet,this._tasksCount=0}init(){}_addChildSpan(a,S){const C=this.tracer.startSpan("CORS Preflight",{startTime:S[Ps.FETCH_START]},Wt.setSpan(Ot.active(),a));addSpanNetworkEvents(C,S,this.getConfig().ignoreNetworkEvents,void 0),C.end(S[Ps.RESPONSE_END])}_addFinalSpanAttributes(a,S){const C=parseUrl(S.url);a.setAttribute(ve,S.status),a.setAttribute(we,C.hostname);const L=function serverPortFromUrl(a){const S=Number(a.port||Ms[a.protocol]);return S&&!isNaN(S)?S:void 0}(C);L&&a.setAttribute(Se,L)}_addHeaders(a,S){if(!shouldPropagateTraceHeaders(S,this.getConfig().propagateTraceHeaderCorsUrls)){const a={};return qt.inject(Ot.active(),a),void(Object.keys(a).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(a instanceof Request)qt.inject(Ot.active(),a.headers,{set:(a,S,C)=>a.set(S,"string"==typeof C?C:String(C))});else{const S=new Headers(a.headers);qt.inject(Ot.active(),S,{set:(a,S,C)=>a.set(S,"string"==typeof C?C:String(C))}),a.headers=S}}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(a,S={}){if(isUrlIgnored(a,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");const C={},L=S.method,x=function normalizeHttpRequestMethod(a){const S=getKnownMethods(),C=a.toUpperCase();return C in S?C:"_OTHER"}(S.method||"GET"),I=x;return C[be]=x,x!==L&&(C[ye]=L),C[Le]=redactUrl(a),this.tracer.startSpan(I,{kind:Lt.CLIENT,attributes:C})}_findResourceAndAddNetworkEvents(a,S,C){let L=S.entries;if(!L.length){if(!performance.getEntriesByType)return;L=performance.getEntriesByType("resource")}const x=getResource(S.spanUrl,S.startTime,C,L,this._usedResources,"fetch");if(x.mainRequest){const S=x.mainRequest;this._markResourceAsUsed(S);const C=x.corsPreFlightRequest;C&&(this._addChildSpan(a,C),this._markResourceAsUsed(C)),addSpanNetworkEvents(a,S,this.getConfig().ignoreNetworkEvents,void 0)}}_markResourceAsUsed(a){this._usedResources.add(a)}_endSpan(a,S,C){const L=millisToHrTime(Date.now()),x=hrTime();this._addFinalSpanAttributes(a,C),C.status>=400&&(a.setStatus({code:xt.ERROR}),a.setAttribute(ge,String(C.status))),setTimeout((()=>{S.observer?.disconnect(),this._findResourceAndAddNetworkEvents(a,S,x),this._tasksCount--,this._clearResources(),a.end(L)}),300)}_patchConstructor(){return a=>{const S=this;return function patchConstructor(...C){if(!S._enabled)return a.apply(this,C);const L=this,x=parseUrl(C[0]instanceof Request?C[0].url:String(C[0])).href;let I;I=C[0]instanceof Request?null!=C[1]?new Request(C[0],C[1]):C[0]:C[1]||{};const N=S._createSpan(x,I);if(!N)return a.apply(this,C);const B=S._prepareSpanData(x);function endSpanOnError(a,C){S._applyAttributesAfterFetch(a,I,C),S._endSpan(a,B,{status:C.status||0,statusText:C.message,url:x})}function endSpanOnSuccess(a,C){S._applyAttributesAfterFetch(a,I,C),C.status>=200&&C.status<400?S._endSpan(a,B,C):S._endSpan(a,B,{status:C.status,statusText:C.statusText,url:x})}function onSuccess(a,C){try{const S=C.clone().body;if(S){const L=S.getReader(),read=()=>{L.read().then((({done:S})=>{S?endSpanOnSuccess(a,C):read()}),(S=>{endSpanOnError(a,S)}))};read()}else endSpanOnSuccess(a,C)}catch(C){S._diag.error("Failed to read fetch response body",C),S._endSpan(a,B,{status:0,url:x})}return C}function onError(a,C){try{endSpanOnError(a,C)}catch(L){S._diag.error("Failed to end span on fetch error",L),S._endSpan(a,B,{status:C.status||0,url:x})}throw C}return S.getConfig().measureRequestSize&&getFetchBodyLength(...C).then((a=>{a&&N.setAttribute("http.request.body.size",a)})).catch((a=>{S._diag.warn("getFetchBodyLength",a)})),Ot.with(Wt.setSpan(Ot.active(),N),(()=>(S._callRequestHook(N,I),S._addHeaders(I,x),S._tasksCount++,a.apply(L,I instanceof Request?[I]:[x,I]).then(onSuccess.bind(L,N),onError.bind(L,N)))))}}}_applyAttributesAfterFetch(a,S,C){const L=this.getConfig().applyCustomAttributesOnSpan;L&&safeExecuteInTheMiddle((()=>L(a,S,C)),(a=>{a&&this._diag.error("applyCustomAttributesOnSpan",a)}))}_callRequestHook(a,S){const C=this.getConfig().requestHook;C&&safeExecuteInTheMiddle((()=>C(a,S)),(a=>{a&&this._diag.error("requestHook",a)}))}_prepareSpanData(a){const S=hrTime(),C=[];if("function"!=typeof PerformanceObserver)return{entries:C,startTime:S,spanUrl:a};const L=new PerformanceObserver((S=>{S.getEntries().forEach((S=>{"fetch"===S.initiatorType&&S.name===a&&C.push(S)}))}));return L.observe({entryTypes:["resource"]}),{entries:C,observer:L,startTime:S,spanUrl:a}}enable(){if(Vs){if(!this._enabled){if(this._isFetchPatched)return this._diag.debug("fetch constructor already patched"),void(this._enabled=!0);if("function"==typeof globalThis.fetch)try{this._wrap(globalThis,"fetch",this._patchConstructor()),this._isFetchPatched=!0,this._enabled=!0}catch(a){this._diag.warn("Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.",a)}else this._diag.warn("globalThis.fetch is missing or not a function; instrumentation will not be enabled. Register the instrumentation after any fetch polyfill, or call enable() once fetch is available.")}}else this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()")}disable(){Vs&&this._enabled&&(this._enabled=!1,this._usedResources=new WeakSet)}};const Hs={"first-paint":"firstPaint","first-contentful-paint":"firstContentfulPaint"};var js=class extends ws{constructor(a={}){super("@opentelemetry/instrumentation-document-load","0.70.0",a),this.component="document-load",this.version="1",this.moduleName=this.component}init(){}_onDocumentLoaded(){window.setTimeout((()=>{this._collectPerformance()}))}_addResourcesSpans(a){const S=performance.getEntriesByType?.("resource");S&&S.forEach((S=>{this._initResourceSpan(S,a)}))}_collectPerformance(){const a=Array.from(document.getElementsByTagName("meta")).find((a=>a.getAttribute("name")===oe)),S=(()=>{const a={},S=performance.getEntriesByType?.("navigation")[0];if(S)Object.values(Ps).forEach((C=>{if(hasKey(S,C)){const L=S[C];"number"==typeof L&&(a[C]=L)}}));else{const S=performance.timing;S&&Object.values(Ps).forEach((C=>{if(hasKey(S,C)){const L=S[C];"number"==typeof L&&(a[C]=L)}}))}return a})(),C=a&&a.content||"";Ot.with(qt.extract(Y,{traceparent:C}),(()=>{const a=this._startSpan("documentLoad",Ps.FETCH_START,S);a&&(Ot.with(Wt.setSpan(Ot.active(),a),(()=>{const a=this._startSpan("documentFetch",Ps.FETCH_START,S);a&&(a.setAttribute(Le,location.href),Ot.with(Wt.setSpan(Ot.active(),a),(()=>{addSpanNetworkEvents(a,S,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(a,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(a,Ps.RESPONSE_END,S)})))})),a.setAttribute(Le,location.href),a.setAttribute("user_agent.original",navigator.userAgent),this._addResourcesSpans(a),this.getConfig().ignoreNetworkEvents||(addSpanNetworkEvent(a,Ps.FETCH_START,S),addSpanNetworkEvent(a,Ps.UNLOAD_EVENT_START,S),addSpanNetworkEvent(a,Ps.UNLOAD_EVENT_END,S),addSpanNetworkEvent(a,Ps.DOM_INTERACTIVE,S),addSpanNetworkEvent(a,Ps.DOM_CONTENT_LOADED_EVENT_START,S),addSpanNetworkEvent(a,Ps.DOM_CONTENT_LOADED_EVENT_END,S),addSpanNetworkEvent(a,Ps.DOM_COMPLETE,S),addSpanNetworkEvent(a,Ps.LOAD_EVENT_START,S),addSpanNetworkEvent(a,Ps.LOAD_EVENT_END,S)),this.getConfig().ignorePerformancePaintEvents||(a=>{const S=performance.getEntriesByType?.("paint");S&&S.forEach((({name:S,startTime:C})=>{hasKey(Hs,S)&&a.addEvent(Hs[S],C)}))})(a),this._addCustomAttributesOnSpan(a,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(a,Ps.LOAD_EVENT_END,S))}))}_endSpan(a,S,C){a&&(hasKey(C,S)?a.end(C[S]):a.end())}_initResourceSpan(a,S){const C=this._startSpan("resourceFetch",Ps.FETCH_START,a,S);C&&(C.setAttribute(Le,a.name),addSpanNetworkEvents(C,a,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnResourceSpan(C,a,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(C,Ps.RESPONSE_END,a))}_startSpan(a,S,C,L){if(hasKey(C,S)&&"number"==typeof C[S])return this.tracer.startSpan(a,{startTime:C[S]},L?Wt.setSpan(Ot.active(),L):void 0)}_waitForPageLoad(){"complete"===window.document.readyState?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(a,S){S&&safeExecuteInTheMiddle((()=>S(a)),(a=>{a&&this._diag.error("addCustomAttributesOnSpan",a)}))}_addCustomAttributesOnResourceSpan(a,S,C){C&&safeExecuteInTheMiddle((()=>C(a,S)),(a=>{a&&this._diag.error("addCustomAttributesOnResourceSpan",a)}))}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}};var qs=class{constructor(a){this._transport=a}retry(a,S,C){return new Promise(((L,x)=>{setTimeout((()=>{this._transport.send(a,S).then(L,x)}),C)}))}async send(a,S){let C=5,L=1e3;const x=Date.now()+S;let I=await this._transport.send(a,S);for(;"retryable"===I.status&&C>0;){C--;const S=Math.max(Math.min(L*(.4*Math.random()-.2+1),5e3),0);L*=1.5;const N=I.retryInMillis??S,B=x-Date.now();if(N>B)return kt.info(`Export retry time ${Math.round(N)}ms exceeds remaining timeout ${Math.round(B)}ms, not retrying further.`),I;kt.verbose(`Scheduling export retry in ${Math.round(N)}ms`),I=await this.retry(a,B,N)}return"success"===I.status?kt.verbose(`Export succeeded after ${5-C} retry attempts.`):"retryable"===I.status?kt.info("Export failed after maximum retry attempts (5)."):kt.info(`Export failed with non-retryable error: ${I.error}`),I}shutdown(){return this._transport.shutdown()}};function parseRetryAfterToMills$2(a){if(null==a)return;const S=Number.parseInt(a,10);if(Number.isInteger(S))return S>0?1e3*S:-1;const C=new Date(a).getTime()-Date.now();return C>=0?C:0}let Gs=0,Ws=0;var Ks=class FetchTransport{constructor(a){this._parameters=a}async send(a,S){const C=new AbortController,L=setTimeout((()=>C.abort()),S);let x=globalThis.fetch;"function"==typeof x.__original&&(x=x.__original);const I=a.byteLength,N=Gs+I>61440,B=!(N||Ws>=9);if(B)Gs+=I,Ws++;else{const a=N?"size limit":"count limit";kt.debug(`keepalive disabled: ${(I/1024).toFixed(1)}KB payload, ${Ws} pending (${a})`)}const $=suppressTracing(Ot.active());let V=!1;const release=()=>{V||(V=!0,B&&(Gs-=I,Ws--),clearTimeout(L))};let H=!1;try{const S=new URL(this._parameters.url),L=await this._parameters.headers(),I=await Ot.with($,(()=>x(S.href,{method:"POST",headers:L,body:a,signal:C.signal,keepalive:B,mode:globalThis.location?globalThis.origin===S.origin?"same-origin":"cors":"no-cors"})));if(async function drainResponseBody(a){try{const S=a.body;if(null==S)return;const C=S.getReader();try{let a=await C.read();for(;!a.done;)a=await C.read()}finally{C.releaseLock()}}catch(a){kt.debug(`error reading export response body: ${a}`)}}(I).then(release,release),H=!0,I.status>=200&&I.status<=299)return kt.debug(`export response success (status: ${I.status})`),{status:"success"};if(function isExportHTTPErrorRetryable(a){return 429===a||502===a||503===a||504===a}(I.status)){kt.warn(`export response retryable (status: ${I.status})`);return{status:"retryable",retryInMillis:parseRetryAfterToMills$2(I.headers.get("Retry-After"))}}return kt.error(`export response failure (status: ${I.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${I.status}`)}}catch(a){return function isFetchNetworkErrorRetryable(a){return a instanceof TypeError&&!a.cause}(a)?(kt.warn(`export request retryable (network error: ${a})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:a})}):(kt.error(`export request failure (error: ${a})`),{status:"failure",error:new Error("Fetch request errored",{cause:a})})}finally{H||release()}}shutdown(){}};function createOtlpFetchExportDelegate(a,S,C){return createOtlpNetworkExportDelegate(a,S,C,function createRetryingTransport(a){return new qs(a.transport)}({transport:(L=a,new Ks(L))}));var L}function mergeHeaders(a,S,C){return async()=>{const L={...await C()},x={};return null!=S&&Object.assign(x,await S()),null!=a&&Object.assign(x,function validateAndNormalizeHeaders(a){const S={};return Object.entries(a??{}).forEach((([a,C])=>{void 0!==C?S[a]=String(C):kt.warn(`Header "${a}" has invalid value (${C}) and will be ignored`)})),S}(await a())),Object.assign(x,L)}}function validateUserProvidedUrl(a){if(null!=a)try{const S=globalThis.location?.href;return new URL(a,S).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${a}'`)}}function convertLegacyHeaders(a){return"function"==typeof a.headers?a.headers:function wrapStaticHeadersInFunction(a){if(null!=a)return async()=>a}(a.headers)}function convertLegacyBrowserHttpOptions(a,S,C){return function mergeOtlpHttpConfigurationWithDefaults(a,S,C){return{...mergeOtlpSharedConfigurationWithDefaults(a,S,C),headers:mergeHeaders(a.headers,S.headers,C.headers),url:validateUserProvidedUrl(a.url)??S.url??C.url}}({url:a.url,timeoutMillis:a.timeoutMillis,headers:convertLegacyHeaders(a),concurrencyLimit:a.concurrencyLimit},{},function getHttpConfigurationDefaults(a,S){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:async()=>a,url:"http://localhost:4318/"+S}}(C,S))}function createLegacyOtlpBrowserExportDelegate(a,S,C,L,x,I,N){const B=convertLegacyBrowserHttpOptions(a,I,N);return createOtlpFetchExportDelegate(B,S,function createLegacyOtlpBrowserExporterMetrics(a,S,C,L){return new mr({componentType:a,metricsHelper:S,url:C,meterProvider:L,responseAttributesFromError:a=>{if(!a)return{[lr]:200};if(!(a instanceof Error))return{};if(a.message.startsWith("Fetch request failed with non-retryable status ")){const S=a.message.substring(47);return{[lr]:Number(S)}}return{}}})}(C,L,B.url,a.selfObsMeterProvider))}var Qs=class OTLPTraceExporter extends or{constructor(a={}){super(createLegacyOtlpBrowserExportDelegate(a,er,"otlp_http_span_exporter",Ke,a.selfObsMeterProvider,"v1/traces",{"Content-Type":"application/x-protobuf"}))}};const Xs="global",Js="gcp.project_id",Ys="gcp.firebase.app_id",Zs="cloud.region",ti="gcp.firebase.domain";var ei;function isSpan(a){return"function"==typeof a.spanContext}function getSpanId(a){return a.spanContext().spanId}function isRootEvent(a){return isSpan(a)?void 0===a.parentSpanContext:void 0===a.spanContext?.traceId}!function(a){a[a.RootSpan=0]="RootSpan",a[a.RootLog=1]="RootLog",a[a.ChildSpan=2]="ChildSpan",a[a.ChildLog=3]="ChildLog"}(ei||(ei={}));class TraceEvents{constructor(){this.logs=new Set,this.spans=new Map,this.isTraceQueuedForExport=!1}add(a){isSpan(a)?this.spans.set(getSpanId(a),a):this.logs.add(a)}has(a){return isSpan(a)?this.spans.has(getSpanId(a)):this.logs.has(a)}}class TelemetryStore{constructor(a=TelemetryStore.DEFAULT_BUFFER_LIMIT,S){this._telemetryBufferMap=new Map,this._totalTelemetryCount=0,this._shouldAddLimitLog=!1,this._bufferLimit=a,this._rootTelemetryQueue=new RootTelemetryQueue(S)}get totalTelemetryCount(){return this._totalTelemetryCount}add(a){const S=this._getEventId(a);if(isRootEvent(a)&&this._telemetryBufferMap.has(S))return;if(!isRootEvent(a)&&!this._telemetryBufferMap.has(S))return;if(!this._bufferHasCapacity()){if(this._isQueueEmpty())return void(this._shouldAddLimitLog=!0);this._evictOldest()}const C=function getEventType(a){return isSpan(a)?isRootEvent(a)?ei.RootSpan:ei.ChildSpan:isRootEvent(a)?ei.RootLog:ei.ChildLog}(a);switch(C){case ei.RootSpan:{const C=new TraceEvents;return C.add(a),this._telemetryBufferMap.set(S,C),void this._totalTelemetryCount++}case ei.RootLog:return this._telemetryBufferMap.set(S,a),this._rootTelemetryQueue.isFull()&&this._evictOldest(),this._rootTelemetryQueue.enqueue(S),void this._totalTelemetryCount++;case ei.ChildSpan:case ei.ChildLog:{const C=this._telemetryBufferMap.get(S);return void(C&&C instanceof TraceEvents&&!C.has(a)&&(C.add(a),this._totalTelemetryCount++))}}}update(a){if(!isRootEvent(a))return;const S=this._getEventId(a),C=this._telemetryBufferMap.get(S);if(C&&C instanceof TraceEvents){if(C.isTraceQueuedForExport)return;this._rootTelemetryQueue.isFull()&&this._evictOldest(),this._rootTelemetryQueue.enqueue(S),C.isTraceQueuedForExport=!0}}getSpansToExport(){const a=[];for(const S of this._rootTelemetryQueue.getValues()){const C=this._telemetryBufferMap.get(S);C instanceof TraceEvents&&a.push(...C.spans.values())}return a}getLogsToExport(){const a=[];if(this._shouldAddLimitLog){const S={severityNumber:dt.INFO,body:"Telemetry buffer limit reached. Some telemetry events were dropped."};a.push(S)}for(const S of this._rootTelemetryQueue.getValues()){const C=this._telemetryBufferMap.get(S);C instanceof TraceEvents?a.push(...C.logs):C&&a.push(C)}return a}clear(){this._rootTelemetryQueue.clear(),this._telemetryBufferMap.clear(),this._totalTelemetryCount=0,this._shouldAddLimitLog=!1}_getEventId(a){return isSpan(a)?a.spanContext().traceId:a.spanContext?.traceId??function generateUuid$1(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues){const a=new Uint8Array(16);crypto.getRandomValues(a),a[6]=15&a[6]|64,a[8]=63&a[8]|128;const S=Array.from(a,(a=>a.toString(16).padStart(2,"0"))).join("");return`${S.slice(0,8)}-${S.slice(8,12)}-${S.slice(12,16)}-${S.slice(16,20)}-${S.slice(20,32)}`}throw new Error("Web Crypto API is not available to generate a UUID.")}()}_bufferHasCapacity(){return this._totalTelemetryCount<this._bufferLimit}_isQueueEmpty(){return 0===this._rootTelemetryQueue.size}_evictOldest(){const a=this._rootTelemetryQueue.dequeue();a&&this._maybeEvictIdFromBuffer(a)}_maybeEvictIdFromBuffer(a){const S=this._telemetryBufferMap.get(a);S&&(this._totalTelemetryCount-=S instanceof TraceEvents?S.spans.size+S.logs.size:1,this._telemetryBufferMap.delete(a))}}TelemetryStore.DEFAULT_BUFFER_LIMIT=1e3;class RootTelemetryQueue{constructor(a=RootTelemetryQueue.DEFAULT_LIMIT){if(this._limit=a,this._head=0,this._tail=0,this._size=0,a<=0)throw new Error("Limit must be a positive integer greater than 0");this._items=new Array(this._limit).fill(void 0)}get size(){return this._size}isFull(){return this._size===this._limit}enqueue(a){this._size!==this._limit&&(this._items[this._tail]=a,this._tail=(this._tail+1)%this._limit,this._size++)}dequeue(){if(0===this._size)return;const a=this._items[this._head];return this._items[this._head]=void 0,this._head=(this._head+1)%this._limit,this._size--,a}peek(){if(0!==this._size)return this._items[this._head]}getValues(){const a=[];for(let S=0;S<this._size;S++){const C=(this._head+S)%this._items.length;this._items[C]&&a.push(this._items[C])}return a}clear(){this._items.fill(void 0),this._head=0,this._tail=0,this._size=0}}RootTelemetryQueue.DEFAULT_LIMIT=100;class OnErrorLogRecordProcessor extends Ge{constructor(a,S){super({exporter:a,disableAutoFlushOnDocumentHide:!0}),this._store=S}onEmit(a){"good"!==a.attributes?.["browser.web_vital.rating"]&&this._store.add(a)}shutdown(){return this._store.clear(),super.shutdown()}onErrorOccurred(){const a=this._store.getLogsToExport();for(const S of a)super.onEmit(S)}}class OnErrorSpanProcessor extends ps{constructor(a,S){super({exporter:a}),this._store=S}onStart(a,S){this._store.add(a)}onEnd(a){this._store.update(a)}shutdown(){return this._store.clear(),super.shutdown()}onErrorOccurred(){const a=this._store.getSpansToExport();for(const S of a)super.onEnd(S)}}class FirebaseAttributesSpanProcessor{constructor(a){this.attributesStore=a}onStart(a,S){const C=this.attributesStore.getSpanAttributes();for(const[S,L]of Object.entries(C))void 0!==L&&void 0===a.attributes?.[S]&&a.setAttribute(S,L)}onEnd(a){a.attributes&&delete a.attributes["user_agent.original"]}async forceFlush(){}async shutdown(){}}let ri,ni=class FetchTransport{constructor(a){this.parameters=a}async send(a,S){const C=new AbortController,L=setTimeout((()=>C.abort()),S);try{const S=new Headers(this.parameters.headers);if(this.parameters.dynamicHeaderProviders&&this.parameters.dynamicHeaderProviders.length>0){const a=this.parameters.dynamicHeaderProviders.map((async a=>{try{return await a.getHeader()}catch(a){return kt.debug(`Failed to retrieve dynamic header: ${a}`),null}})),C=await Promise.all(a);for(const a of C)a&&S.append(...a)}const L=a.byteLength<6e4,x={method:"POST",headers:S,signal:C.signal,keepalive:L,mode:"cors",body:a},I=await Ot.with(suppressTracing(Ot.active()),(()=>fetch(this.parameters.url,x)));if(I.status>=200&&I.status<=299)return kt.debug("response success"),{status:"success"};if(function isExportRetryable$1(a){return[429,502,503,504].includes(a)}(I.status)){const a=function parseRetryAfterToMills$1(a){if(null==a)return;const S=Number.parseInt(a,10);if(Number.isInteger(S))return S>0?1e3*S:-1;const C=new Date(a).getTime()-Date.now();return C>=0?C:0}(I.headers.get("Retry-After"));return{status:"retryable",retryInMillis:a}}return{status:"failure",error:new Error("Fetch request failed with non-retryable status")}}catch(a){return a instanceof Error?{status:"failure",error:a}:{status:"failure",error:new Error(`Fetch request errored: ${a}`)}}finally{clearTimeout(L)}}shutdown(){}};function createTracingProvider(a,S,C,L,x=[]){if("undefined"==typeof window)return{tracingProvider:Wt.getTracerProvider()};const I=function getTelemetryEndpointUrl$1(a={}){const S=a||{};if(S.endpointUrl){let a=S.endpointUrl.length;for(;a>0&&"/"===S.endpointUrl[a-1];)a--;return S.endpointUrl.slice(0,a)}const C=S.region||Xs;return C!==Xs?`https://clienttelemetry.${C}.rep.googleapis.com`:"https://clienttelemetry.googleapis.com"}(S),{projectId:N,appId:B,apiKey:$}=a.options,V=S.region||Xs,H={[ti]:window.location.hostname};N&&(H[Js]=N),B&&(H[Ys]=B),V!==Xs&&(H[Zs]=V);const j=resourceFromAttributes(H),G=`${I}/v1/traces`;let Q;Q="http://localhost:4318"===I?new Qs({url:G,headers:{"X-Goog-User-Project":N||"",...$?{"X-Goog-Api-Key":$}:{}}}):new OTLPTraceExporter({url:G,headers:{"Content-Type":"application/json",...$?{"X-Goog-Api-Key":$}:{}}},x,C);const X=new OnErrorSpanProcessor(Q,L),Y=new bs({resource:j,spanProcessors:[new FirebaseAttributesSpanProcessor(C),X]});Wt.setGlobalTracerProvider(Y),qt.setGlobalPropagator(new te({propagators:[new ue]}));const Z=new Xn;Z.enable(),Ot.setGlobalContextManager(Z);const tt=`^${I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,et={ignoreUrls:[new RegExp(tt)]};return ri&&ri(),ri=function registerInstrumentations(a){const S=a.tracerProvider||Wt.getTracerProvider(),C=a.meterProvider||Vt.getMeterProvider(),L=a.loggerProvider||Ut.getLoggerProvider(),x=a.instrumentations?.flat()??[];return function enableInstrumentations(a,S,C,L){for(let x=0,I=a.length;x<I;x++){const I=a[x];S&&I.setTracerProvider(S),C&&I.setMeterProvider(C),L&&I.setLoggerProvider&&I.setLoggerProvider(L),I.getConfig().enabled||I.enable()}}(x,S,C,L),()=>{!function disableInstrumentations(a){a.forEach((a=>a.disable()))}(x)}}({instrumentations:[new zs(et),new Os(et),new js]}),{tracingProvider:Y,onErrorSpanProcessor:X}}class OTLPTraceExporter extends or{constructor(a={},S=[],C){super(createOtlpNetworkExportDelegate({timeoutMillis:1e4,concurrencyLimit:5},ir,new mr({componentType:"otlp_http_span_exporter",metricsHelper:Ke,url:a.url,meterProvider:void 0,responseAttributesFromError:()=>({})}),new ni({url:a.url,headers:new Headers("object"==typeof a.headers?a.headers:{}),dynamicHeaderProviders:S}))),this.attributesStore=C}async export(a,S){const C=await(this.attributesStore?.getInstallationIdAttribute());C&&a.forEach((a=>{Object.assign(a.attributes,C)})),super.export(a,S)}}const si=new Set;function unregisterLoggerInstrumentations(){for(const a of si)a();si.clear()}class BreadcrumbsFeatureImpl{constructor(){this.name="breadcrumbs"}createTelemetryStore(){return new TelemetryStore}createLogRecordProcessor(a,S){return new OnErrorLogRecordProcessor(a,S)}initializeLoggerInstrumentations(a){if("undefined"==typeof window)return;const S=new yn,C=new Qn({includeRawAttribution:!0}),L=new Ln({autoCapturedActions:["click"]});this._unregisterLoggerInstrumentationsFn&&(this._unregisterLoggerInstrumentationsFn(),si.delete(this._unregisterLoggerInstrumentationsFn));const x=[S,C,L];for(const S of x)S.enable({loggerProvider:a});const unregister=()=>{for(const a of x)a.disable()};Object.defineProperty(this,"_unregisterLoggerInstrumentationsFn",{value:unregister,writable:!0,configurable:!0,enumerable:!1}),si.add(unregister)}createTracingProvider(a,S,C,L,x=[]){return createTracingProvider(a,S,C,L,x)}unregisterInstrumentations(){this._unregisterLoggerInstrumentationsFn&&(this._unregisterLoggerInstrumentationsFn(),si.delete(this._unregisterLoggerInstrumentationsFn),this._unregisterLoggerInstrumentationsFn=void 0),function unregisterTracingInstrumentations(){ri&&(ri(),ri=void 0)}()}}function breadcrumbs(){return new BreadcrumbsFeatureImpl}var ii="@firebase/crashlytics",oi="0.2.0";const ai="crashlytics",ci="global",ui="gcp.project_id",li="gcp.firebase.app_id",di="cloud.region",hi=Symbol("firebase_crashlytics_logged"),pi="app.installation.id",gi="firebasecrashlytics.sessionid",mi="app.build_id",fi="session.id",_i="app.screen.id",bi="logging.googleapis.com/trace",yi="logging.googleapis.com/spanId",vi="gcp.resource.name",wi="session.id",Si="service.version",Ti="app.screen.id";class AttributesStore{constructor(a,S,C){this._projectId=a.projectId,this._region=S?.region||ci,this.updateOptions(S);const L=this.getSessionIdFromStorage();L&&(this._sessionId=L),this._installations=C?.getImmediate({optional:!0})??null,this._installations||C?.get().then((a=>this._installations=a)).catch((()=>{}))}updateOptions(a){const S=a?.appVersion?a.appVersion:Re?.appVersion?Re.appVersion:"unset";this._appVersion=S,this._customAttributes=a?.customAttributes?{...a.customAttributes}:void 0}get sessionId(){return this._sessionId}setSessionId(a){if(this._sessionId=a,"undefined"!=typeof sessionStorage)try{sessionStorage.setItem(gi,a)}catch(a){}}setRoutePathProvider(a){this._routePathProvider=a}getLogAttributes(a){const S={};this._customAttributes&&Object.assign(S,this._customAttributes),this._appVersion&&(S[mi]=this._appVersion),this._sessionId&&(S[fi]=this._sessionId);const C=this._routePathProvider?.();return C&&(S[_i]=C),a?{...S,...a}:S}getSpanAttributes(){const a={};this._projectId&&(a[vi]=`//clienttelemetry.googleapis.com/projects/${this._projectId}/locations/${this._region}/`),this._appVersion&&(a[Si]=this._appVersion),this._sessionId&&(a[wi]=this._sessionId);const S=this._routePathProvider?.();return S&&(a[Ti]=S),a}async getInstallationIdAttribute(){if(!this._installations)return null;if(this._iid)return{[pi]:this._iid};let a;try{a=await this._installations.getId()}catch(a){return kt.debug("Failed to retrieve installation id",a),null}return a?(this._iid=a,{[pi]:a}):null}getSessionIdFromStorage(){if("undefined"!=typeof sessionStorage)try{return sessionStorage.getItem(gi)||void 0}catch(a){}}}function getCrashlytics(a=C(),S){const L=_getProvider(a,ai);if(L.isInitialized()){const a=L.getImmediate();if(deepEqual(S||{},L.getOptions()))return a;throw new Error("getCrashlytics() cannot be called with different options")}const x=L.initialize({options:S});return S&&(x.options=S),x}function recordError(a,S,C){if(!a)return;if(S&&"object"==typeof S)try{S[hi]=!0}catch(a){}const{loggerProvider:L,telemetryStore:x,onErrorSpanProcessor:I,onErrorLogRecordProcessor:N}=a,B=L.getLogger("error-logger"),$=C?{...C}:{};S instanceof Error?B.emit({severityNumber:dt.ERROR,body:S.message,attributes:{"exception.type":S.name||"Error","exception.stacktrace":S.stack||"No stack trace available","exception.message":S.message,...$}}):"string"==typeof S?B.emit({severityNumber:dt.ERROR,body:S,attributes:$}):B.emit({severityNumber:dt.ERROR,body:"Unknown error type: "+typeof S,attributes:$}),I&&I.onErrorOccurred(),N&&N.onErrorOccurred(),x&&x.clear()}function log(a,S,C){if(!a)return;const{loggerProvider:L}=a,x=L.getLogger("custom-logger"),I=C?{...C}:{};x.emit({severityNumber:dt.INFO,body:S,attributes:I})}function logViewBoundary(a,S,C){const{loggerProvider:L,attributesStore:x,options:I}=a;if(!getBreadcrumbsFeature(I))return;const N=L.getLogger("view-boundary-logger"),B=x.getLogAttributes({[_i]:S,...C});N.emit({severityNumber:dt.INFO,body:"Navigation event",attributes:B})}function getBreadcrumbsFeature(a){return a?.features?.find((a=>Boolean(a&&"breadcrumbs"===a.name)))}function startNewSession(a){const{loggerProvider:S,attributesStore:C}=a;if("undefined"!=typeof sessionStorage)try{const a=function generateUuid(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues){const a=new Uint8Array(16);crypto.getRandomValues(a),a[6]=15&a[6]|64,a[8]=63&a[8]|128;const S=Array.from(a,(a=>a.toString(16).padStart(2,"0"))).join("");return`${S.slice(0,8)}-${S.slice(8,12)}-${S.slice(12,16)}-${S.slice(16,20)}-${S.slice(20,32)}`}throw new Error("Web Crypto API is not available to generate a UUID.")}();C.setSessionId(a);const L=C.getLogAttributes();S.getLogger("session-logger").emit({severityNumber:dt.DEBUG,body:"Session created",attributes:L})}catch(a){}}function registerListeners(a){if("undefined"!=typeof window&&"undefined"!=typeof document){const onVisibilityChange=async()=>{!getBreadcrumbsFeature(a.options)||"visible"!==document.visibilityState&&"hidden"!==document.visibilityState||function logVisibilityEvent(a,S){const{loggerProvider:C,attributesStore:L}=a,x=C.getLogger("visibility-logger"),I=L.getLogAttributes(),N="hidden"===S?"Background lifecycle event":"Foreground lifecycle event";x.emit({severityNumber:dt.INFO,body:N,attributes:I})}(a,document.visibilityState),"hidden"===document.visibilityState&&await flush(a)},onPageHide=async()=>{await flush(a)};return window.addEventListener("visibilitychange",onVisibilityChange),window.addEventListener("pagehide",onPageHide),()=>{window.removeEventListener("visibilitychange",onVisibilityChange),window.removeEventListener("pagehide",onPageHide)}}return()=>{}}let Ei=null;function flush(a){return a.loggerProvider.forceFlush().catch((a=>{console.error("Error flushing logs from Firebase Crashlytics:",a)}))}class CrashlyticsService{constructor(a,S,C,L,x,I,N){this.app=a,this.loggerProvider=S,this.tracingProvider=C,this.attributesStore=L,this.telemetryStore=x,this.onErrorLogRecordProcessor=I,this.onErrorSpanProcessor=N}unsubscribeListeners(a){this._unsubscribeListeners=a}async _delete(){this._unsubscribeListeners&&this._unsubscribeListeners(),getBreadcrumbsFeature(this._options)?.unregisterInstrumentations();const a=[];if(this.loggerProvider&&"function"==typeof this.loggerProvider.shutdown&&a.push(this.loggerProvider.shutdown().catch((a=>{console.warn("Error shutting down logger provider:",a)}))),this.tracingProvider){const S=this.tracingProvider;"function"==typeof S.shutdown&&a.push(S.shutdown().catch((a=>{console.warn("Error shutting down tracing provider:",a)})))}await Promise.all(a)}set options(a){this._options=a,this.attributesStore.updateOptions(a)}get options(){return this._options}}class FetchTransport{constructor(a){this.parameters=a}async send(a,S){const C=new AbortController,L=setTimeout((()=>C.abort()),S);try{const S=new Headers(this.parameters.headers);if(this.parameters.dynamicHeaderProviders&&this.parameters.dynamicHeaderProviders.length>0){const a=this.parameters.dynamicHeaderProviders.map((async a=>{try{return await a.getHeader()}catch(a){return kt.debug(`Failed to retrieve dynamic header: ${a}`),null}})),C=await Promise.all(a);for(const a of C)a&&S.append(...a)}const L=a.byteLength<6e4,x={method:"POST",headers:S,signal:C.signal,keepalive:L,mode:"cors",body:a},I=await Ot.with(suppressTracing(Ot.active()),(()=>fetch(this.parameters.url,x)));if(I.status>=200&&I.status<=299)return kt.debug("response success"),{status:"success"};if(function isExportRetryable(a){return[429,502,503,504].includes(a)}(I.status)){const a=function parseRetryAfterToMills(a){if(null==a)return;const S=Number.parseInt(a,10);if(Number.isInteger(S))return S>0?1e3*S:-1;const C=new Date(a).getTime()-Date.now();return C>=0?C:0}(I.headers.get("Retry-After"));return{status:"retryable",retryInMillis:a}}return{status:"failure",error:new Error("Fetch request failed with non-retryable status")}}catch(a){return a instanceof Error?{status:"failure",error:a}:{status:"failure",error:new Error(`Fetch request errored: ${a}`)}}finally{clearTimeout(L)}}shutdown(){}}class FirebaseAttributesLogProcessor{constructor(a,S){this.attributesStore=a,this.projectId=S}onEmit(a,S){var C,L,x,I,N;a.attributes||(a.attributes={});const B=this.attributesStore.getLogAttributes();for(const[S,L]of Object.entries(B))void 0!==L&&((C=a.attributes)[S]??(C[S]=L));const $=a.spanContext??(S?Wt.getSpanContext(S):void 0)??Wt.getActiveSpan()?.spanContext();$?.traceId&&$?.spanId&&this.projectId&&((L=a.attributes)[x=bi]??(L[x]=`projects/${this.projectId}/traces/${$.traceId}`),(I=a.attributes)[N=yi]??(I[N]=$.spanId))}async forceFlush(){}async shutdown(){}}function createLoggerProvider(a,S={},C,L,x=[]){const I=function getTelemetryEndpointUrl(a={}){const S=a||{};if(S.endpointUrl){let a=S.endpointUrl.length;for(;a>0&&"/"===S.endpointUrl[a-1];)a--;return S.endpointUrl.slice(0,a)}const C=S.region||ci;return C!==ci?`https://clienttelemetry.${C}.rep.googleapis.com`:"https://clienttelemetry.googleapis.com"}(S),{projectId:N,appId:B,apiKey:$}=a.options,V=S.region||ci,H=`${I}/v1/logs`,j={[We]:"firebase_telemetry_service"};N&&(j[ui]=N),B&&(j[li]=B),V!==ci&&(j[di]=V);const G=resourceFromAttributes(j),Q=new OTLPLogExporter({url:H,headers:{"Content-Type":"application/json",...$?{"X-Goog-Api-Key":$}:{}}},x,C);let X;const Y=[new FirebaseAttributesLogProcessor(C,N)],Z=getBreadcrumbsFeature(S);Z?(X=Z.createLogRecordProcessor(Q,L??Z.createTelemetryStore()),Y.push(X)):Y.push(new Ge({exporter:Q,disableAutoFlushOnDocumentHide:!0}));const tt=new Ve({resource:G,processors:Y,logRecordLimits:{}});return S.registerGlobalLoggerProvider&&Ut.setGlobalLoggerProvider(tt),Z&&"undefined"!=typeof window&&Z.initializeLoggerInstrumentations(tt),{loggerProvider:tt,onErrorLogRecordProcessor:X}}class OTLPLogExporter extends or{constructor(a={},S=[],C){super(createOtlpNetworkExportDelegate({timeoutMillis:1e4,concurrencyLimit:5},sr,new mr({componentType:"otlp_http_log_exporter",metricsHelper:Qe,url:a.url,meterProvider:void 0,responseAttributesFromError:()=>({})}),new FetchTransport({url:a.url,headers:new Headers("object"==typeof a.headers?a.headers:{}),dynamicHeaderProviders:S}))),this.attributesStore=C,this.endpointUrl=a.url}async export(a,S){const C=a.filter((a=>!function isTelemetryUrl(a,S){return!!("string"==typeof a&&a&&(/^https?:\/\/clienttelemetry\.(googleapis\.com|[a-z0-9-]+\.rep\.googleapis\.com)(\/|$)/.test(a)||S&&a.startsWith(S)))}(a.attributes?.["url.full"]||a.attributes?.["http.url"]||a.attributes?.["resource.url"],this.endpointUrl)));if(0===C.length)return void S({code:Zt.SUCCESS});const L=await this.attributesStore.getInstallationIdAttribute();L&&C.forEach((a=>{Object.assign(a.attributes,L)})),super.export(C,S)}}class AppCheckProvider{constructor(a){this.appCheck=a?.getImmediate({optional:!0}),this.appCheck||a?.get().then((a=>this.appCheck=a)).catch()}async getHeader(){if(!this.appCheck)return null;const a=await this.appCheck.getToken();return!a||a.error?null:["X-Firebase-AppCheck",a.token]}}!function registerCrashlytics(){S(new Component(ai,((a,{options:S})=>{const C=S||{},L=a.getProvider("app").getImmediate(),x=a.getProvider("app-check-internal"),I=a.getProvider("installations-internal"),N=new AttributesStore(L.options,C,I),B=getBreadcrumbsFeature(C),$=B?.createTelemetryStore(),V=[new AppCheckProvider(x)],{loggerProvider:H,onErrorLogRecordProcessor:j}=createLoggerProvider(L,C,N,$,V),{tracingProvider:G,onErrorSpanProcessor:Q}=B&&$?B.createTracingProvider(L,C,N,$,V):{tracingProvider:null,onErrorSpanProcessor:void 0},X=new CrashlyticsService(L,H,G,N,$,j,Q);S&&(X.options=C),N.sessionId||startNewSession(X);const Y=registerListeners(X),Z=!1!==C.captureUnhandledErrors?function registerGlobalErrorListeners(a){if("undefined"==typeof window||!1===a.options?.captureUnhandledErrors)return()=>{};if(Ei){if(Ei.crashlytics===a)return()=>{};Ei.unsubscribe()}const errorListener=S=>{S.error&&S.error[hi]||recordError(a,S.error)},unhandledRejectionListener=S=>{S.reason&&S.reason[hi]||recordError(a,S.reason)};try{window.addEventListener("error",errorListener),window.addEventListener("unhandledrejection",unhandledRejectionListener)}catch(a){return console.warn("Firebase Crashlytics was not initialized:\n",a),()=>{}}let S=!1;const unsubscribe=()=>{S||(S=!0,Ei?.unsubscribe===unsubscribe&&(Ei=null),window.removeEventListener("error",errorListener),window.removeEventListener("unhandledrejection",unhandledRejectionListener))};return Ei={crashlytics:a,unsubscribe:unsubscribe},unsubscribe}(X):()=>{};return X.unsubscribeListeners((()=>{Y(),Z()})),X}),"PUBLIC").setMultipleInstances(!0)),a(ii,oi),a(ii,oi,"esm2020")}();export{breadcrumbs,flush,getCrashlytics,log,logViewBoundary,recordError,unregisterLoggerInstrumentations};
2
2
 
3
3
  //# sourceMappingURL=firebase-crashlytics.js.map