@elastic/opentelemetry-browser 0.1.0 → 0.2.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.
@@ -1,14 +1,14 @@
1
- (()=>{var as=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};var St="1.9.0";var cs=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Du(e){var t=new Set([e]),r=new Set,n=e.match(cs);if(!n)return function(){return!1};var o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===e};function i(a){return r.add(a),!1}function s(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;var u=c.match(cs);if(!u)return i(c);var p={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var us=Du(St);var Uu=St.split(".")[0],Ge=Symbol.for("opentelemetry.js.api."+Uu),He=as;function st(e,t,r,n){var o;n===void 0&&(n=!1);var i=He[Ge]=(o=He[Ge])!==null&&o!==void 0?o:{version:St};if(!n&&i[e]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(s.stack||s.message),!1}if(i.version!==St){var s=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+e+" does not match previously registered API v"+St);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+St+"."),!0}function X(e){var t,r,n=(t=He[Ge])===null||t===void 0?void 0:t.version;if(!(!n||!us(n)))return(r=He[Ge])===null||r===void 0?void 0:r[e]}function at(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+St+".");var r=He[Ge];r&&delete r[e]}var Bu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},Gu=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},ps=(function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("verbose",this._namespace,t)},e})();function Ve(e,t,r){var n=X("diag");if(n)return r.unshift(t),n[e].apply(n,Gu([],Bu(r),!1))}var w;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(w||(w={}));function ls(e,t){e<w.NONE?e=w.NONE:e>w.ALL&&(e=w.ALL),t=t||{};function r(n,o){var i=t[n];return typeof i=="function"&&e>=o?i.bind(t):function(){}}return{error:r("error",w.ERROR),warn:r("warn",w.WARN),info:r("info",w.INFO),debug:r("debug",w.DEBUG),verbose:r("verbose",w.VERBOSE)}}var Hu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},Vu=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},ku="diag",H=(function(){function e(){function t(o){return function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var a=X("diag");if(a)return a[o].apply(a,Vu([],Hu(i),!1))}}var r=this,n=function(o,i){var s,a,c;if(i===void 0&&(i={logLevel:w.INFO}),o===r){var u=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=u.stack)!==null&&s!==void 0?s:u.message),!1}typeof i=="number"&&(i={logLevel:i});var p=X("diag"),_=ls((a=i.logLevel)!==null&&a!==void 0?a:w.INFO,o);if(p&&!i.suppressOverrideMessage){var d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+d),_.warn("Current logger will overwrite one already registered from "+d)}return st("diag",_,r,!0)};r.setLogger=n,r.disable=function(){at(ku,r)},r.createComponentLogger=function(o){return new ps(o)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})();var Fu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},zu=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ms=(function(){function e(t){this._entries=t?new Map(t):new Map}return e.prototype.getEntry=function(t){var r=this._entries.get(t);if(r)return Object.assign({},r)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(t){var r=Fu(t,2),n=r[0],o=r[1];return[n,o]})},e.prototype.setEntry=function(t,r){var n=new e(this._entries);return n._entries.set(t,r),n},e.prototype.removeEntry=function(t){var r=new e(this._entries);return r._entries.delete(t),r},e.prototype.removeEntries=function(){for(var t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=new e(this._entries);try{for(var s=zu(n),a=s.next();!a.done;a=s.next()){var c=a.value;i._entries.delete(c)}}catch(u){t={error:u}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},e.prototype.clear=function(){return new e},e})();var _s=Symbol("BaggageEntryMetadata");var $u=H.instance();function hs(e){return e===void 0&&(e={}),new ms(new Map(Object.entries(e)))}function Ho(e){return typeof e!="string"&&($u.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:_s,toString:function(){return e}}}function Ft(e){return Symbol.for(e)}var Wu=(function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,o){var i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=function(n){var o=new e(r._currentContext);return o._currentContext.delete(n),o}}return e})(),V=new Wu;var zt=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),ju=(function(){function e(){}return e.prototype.createGauge=function(t,r){return ep},e.prototype.createHistogram=function(t,r){return rp},e.prototype.createCounter=function(t,r){return tp},e.prototype.createUpDownCounter=function(t,r){return np},e.prototype.createObservableGauge=function(t,r){return ip},e.prototype.createObservableCounter=function(t,r){return op},e.prototype.createObservableUpDownCounter=function(t,r){return sp},e.prototype.addBatchObservableCallback=function(t,r){},e.prototype.removeBatchObservableCallback=function(t){},e})();var $r=(function(){function e(){}return e})();var Ku=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})($r);var Xu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})($r);var Yu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})($r);var qu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})($r);var Vo=(function(){function e(){}return e.prototype.addCallback=function(t){},e.prototype.removeCallback=function(t){},e})();var Qu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo);var Ju=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo);var Zu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo);var ko=new ju,tp=new Ku,ep=new Yu,rp=new qu,np=new Xu,op=new Qu,ip=new Ju,sp=new Zu;function ke(){return ko}var Y;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(Y||(Y={}));var ds={get:function(e,t){if(e!=null)return e[t]},keys:function(e){return e==null?[]:Object.keys(e)}},fs={set:function(e,t,r){e!=null&&(e[t]=r)}};var ap=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},cp=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Ts=(function(){function e(){}return e.prototype.active=function(){return V},e.prototype.with=function(t,r,n){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return r.call.apply(r,cp([n],ap(o),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})();var up=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},pp=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Fo="context",lp=new Ts,Lt=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return st(Fo,t,H.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var o,i=[],s=3;s<arguments.length;s++)i[s-3]=arguments[s];return(o=this._getContextManager()).with.apply(o,pp([t,r,n],up(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return X(Fo)||lp},e.prototype.disable=function(){this._getContextManager().disable(),at(Fo,H.instance())},e})();var M;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(M||(M={}));var Wr="0000000000000000",jr="00000000000000000000000000000000",Fe={traceId:jr,spanId:Wr,traceFlags:M.NONE};var vt=(function(){function e(t){t===void 0&&(t=Fe),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e})();var zo=Ft("OpenTelemetry Context Key SPAN");function Kr(e){return e.getValue(zo)||void 0}function gs(){return Kr(Lt.getInstance().active())}function ze(e,t){return e.setValue(zo,t)}function Es(e){return e.deleteValue(zo)}function Ss(e,t){return ze(e,new vt(t))}function Xr(e){var t;return(t=Kr(e))===null||t===void 0?void 0:t.spanContext()}var mp=/^([0-9a-f]{32})$/i,_p=/^[0-9a-f]{16}$/i;function Yr(e){return mp.test(e)&&e!==jr}function As(e){return _p.test(e)&&e!==Wr}function q(e){return Yr(e.traceId)&&As(e.spanId)}function Rs(e){return new vt(e)}var $o=Lt.getInstance(),qr=(function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=$o.active());var o=!!r?.root;if(o)return new vt;var i=n&&Xr(n);return hp(i)&&q(i)?new vt(i):new vt},e.prototype.startActiveSpan=function(t,r,n,o){var i,s,a;if(!(arguments.length<2)){arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);var c=s??$o.active(),u=this.startSpan(t,i,c),p=ze(c,u);return $o.with(p,a,void 0,u)}},e})();function hp(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var dp=new qr,xs=(function(){function e(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,o){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):dp},e})();var Os=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new qr},e})();var fp=new Os,Wo=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new xs(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:fp},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)},e})();var oe;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(oe||(oe={}));var At;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(At||(At={}));var ct;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(ct||(ct={}));var E=Lt.getInstance();var l=H.instance();var Tp=(function(){function e(){}return e.prototype.getMeter=function(t,r,n){return ko},e})();var ys=new Tp;var jo="metrics",bs=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(t){return st(jo,t,H.instance())},e.prototype.getMeterProvider=function(){return X(jo)||ys},e.prototype.getMeter=function(t,r,n){return this.getMeterProvider().getMeter(t,r,n)},e.prototype.disable=function(){at(jo,H.instance())},e})();var $t=bs.getInstance();var ws=(function(){function e(){}return e.prototype.inject=function(t,r){},e.prototype.extract=function(t,r){return t},e.prototype.fields=function(){return[]},e})();var Ko=Ft("OpenTelemetry Baggage Key");function Xo(e){return e.getValue(Ko)||void 0}function Ns(){return Xo(Lt.getInstance().active())}function Ls(e,t){return e.setValue(Ko,t)}function vs(e){return e.deleteValue(Ko)}var Yo="propagation",gp=new ws,Ps=(function(){function e(){this.createBaggage=hs,this.getBaggage=Xo,this.getActiveBaggage=Ns,this.setBaggage=Ls,this.deleteBaggage=vs}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(t){return st(Yo,t,H.instance())},e.prototype.inject=function(t,r,n){return n===void 0&&(n=fs),this._getGlobalPropagator().inject(t,r,n)},e.prototype.extract=function(t,r,n){return n===void 0&&(n=ds),this._getGlobalPropagator().extract(t,r,n)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){at(Yo,H.instance())},e.prototype._getGlobalPropagator=function(){return X(Yo)||gp},e})();var B=Ps.getInstance();var qo="trace",Cs=(function(){function e(){this._proxyTracerProvider=new Wo,this.wrapSpanContext=Rs,this.isSpanContextValid=q,this.deleteSpan=Es,this.getSpan=Kr,this.getActiveSpan=gs,this.getSpanContext=Xr,this.setSpan=ze,this.setSpanContext=Ss}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=st(qo,this._proxyTracerProvider,H.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return X(qo)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){at(qo,H.instance()),this._proxyTracerProvider=new Wo},e})();var R=Cs.getInstance();var J;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(J||(J={}));var ie=class{emit(t){}},$e=new ie;var We=Symbol.for("io.opentelemetry.js.api.logs"),se=globalThis;function Ms(e,t,r){return n=>n===e?t:r}var Qo=1;var Jo=class{getLogger(t,r,n){return new ie}},Qr=new Jo;var Jr=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):$e}};var je=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new Jr(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Qr}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};var Zr=class e{constructor(){this._proxyLoggerProvider=new je}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return se[We]?this.getLoggerProvider():(se[We]=Ms(Qo,t,Qr),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=se[We])===null||t===void 0?void 0:t.call(se,Qo))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete se[We],this._proxyLoggerProvider=new je}};var Pt=Zr.getInstance();var xt=class{_delegate;constructor(t){this._delegate=t}export(t,r){this._delegate.export(t,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};var Ke=class extends Error{code;name="OTLPExporterError";data;constructor(t,r,n){super(t),this.data=n,this.code=r}};function Ep(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Is(e){if(e!=null)return async()=>e}function Ds(e,t,r){return{timeoutMillis:Ep(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function Us(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Zo=class{_concurrencyLimit;_sendingPromises=[];constructor(t){this._concurrencyLimit=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);let r=()=>{let n=this._sendingPromises.indexOf(t);this._sendingPromises.splice(n,1)};t.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function Bs(e){return new Zo(e.concurrencyLimit)}var Gs=Ft("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Xe(e){return e.setValue(Gs,!0)}function Wt(e){return e.getValue(Gs)===!0}var tn="baggage";function Hs(e){return e.reduce((t,r)=>{let n=`${t}${t!==""?",":""}${r}`;return n.length>8192?t:n},"")}function Vs(e){return e.getAllEntries().map(([t,r])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function ks(e){if(!e)return;let t=e.indexOf(";"),r=t===-1?e:e.substring(0,t),n=r.indexOf("=");if(n<=0)return;let o=r.substring(0,n).trim(),i=r.substring(n+1).trim();if(!o||!i)return;let s,a;try{s=decodeURIComponent(o),a=decodeURIComponent(i)}catch{return}let c;if(t!==-1&&t<e.length-1){let u=e.substring(t+1);c=Ho(u)}return{key:s,value:a,metadata:c}}var Ye=class{inject(t,r,n){let o=B.getBaggage(t);if(!o||Wt(t))return;let i=Vs(o).filter(a=>a.length<=4096).slice(0,180),s=Hs(i);s.length>0&&n.set(r,tn,s)}extract(t,r,n){let o=n.get(r,tn),i=Array.isArray(o)?o.join(","):o;if(!i)return t;let s={};return i.length===0||(i.split(",").forEach(c=>{let u=ks(c);if(u){let p={value:u.value};u.metadata&&(p.metadata=u.metadata),s[u.key]=p}}),Object.entries(s).length===0)?t:B.setBaggage(t,B.createBaggage(s))}fields(){return[tn]}};function jt(e){let t={};if(typeof e!="object"||e==null)return t;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!xp(r)){l.warn(`Invalid attribute key: ${r}`);continue}let n=e[r];if(!en(n)){l.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function xp(e){return typeof e=="string"&&e!==""}function en(e){return e==null?!0:Array.isArray(e)?Op(e):Fs(typeof e)}function Op(e){let t;for(let r of e){if(r==null)continue;let n=typeof r;if(n!==t){if(!t){if(Fs(n)){t=n;continue}return!1}return!1}}return!0}function Fs(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function zs(){return e=>{l.error(yp(e))}}function yp(e){return typeof e=="string"?e:JSON.stringify(bp(e))}function bp(e){let t={},r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;let o=r[n];o&&(t[n]=String(o))}),r=Object.getPrototypeOf(r);return t}var wp=zs();function P(e){try{wp(e)}catch{}}var $s="2.6.0";var qe="error.type";var Z="exception.message",Kt="exception.stacktrace",nt="exception.type";var rn="http.request.method";var nn="http.request.method_original";var on="http.response.status_code";var sn="server.address",an="server.port",Ws="service.name";var Qe="telemetry.sdk.language";var js="webjs",Je="telemetry.sdk.name",Ze="telemetry.sdk.version";var Ct="url.full";var Ks="user_agent.original";var Xs="process.runtime.name";var Mt={[Je]:"opentelemetry",[Xs]:"browser",[Qe]:js,[Ze]:$s};var C=performance;var Np=9,Lp=6,vp=Math.pow(10,Lp),cn=Math.pow(10,Np);function I(e){let t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*vp);return[r,n]}function D(e){let t=I(C.timeOrigin),r=I(typeof e=="number"?e:C.now());return pn(t,r)}function ut(e){if(tr(e))return e;if(typeof e=="number")return e<C.timeOrigin?D(e):I(e);if(e instanceof Date)return I(e.getTime());throw TypeError("Invalid input type")}function ei(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=cn),[r,n]}function tt(e){return e[0]*cn+e[1]}function ae(e){return e[0]*1e6+e[1]/1e3}function tr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function un(e){return tr(e)||typeof e=="number"||e instanceof Date}function pn(e,t){let r=[e[0]+t[0],e[1]+t[1]];return r[1]>=cn&&(r[1]-=cn,r[0]+=1),r}var G;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(G||(G={}));var er=class{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(t,r,n){for(let o of this._propagators)try{o.inject(t,r,n)}catch(i){l.warn(`Failed to inject with ${o.constructor.name}. Err: ${i.message}`)}}extract(t,r,n){return this._propagators.reduce((o,i)=>{try{return i.extract(o,r,n)}catch(s){l.warn(`Failed to extract with ${i.constructor.name}. Err: ${s.message}`)}return o},t)}fields(){return this._fields.slice()}};var ri="[_0-9a-z-*/]",Pp=`[a-z]${ri}{0,255}`,Cp=`[a-z0-9]${ri}{0,240}@[a-z]${ri}{0,13}`,Mp=new RegExp(`^(?:${Pp}|${Cp})$`),Ip=/^[ -~]{0,255}[!-~]$/,Dp=/,|=/;function Ys(e){return Mp.test(e)}function qs(e){return Ip.test(e)&&!Dp.test(e)}var Qs=32,Up=512,Js=",",Zs="=",ln=class e{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,r){let n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,r),n}unset(t){let r=this._clone();return r._internalState.delete(t),r}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce((t,r)=>(t.push(r+Zs+this.get(r)),t),[]).join(Js)}_parse(t){t.length>Up||(this._internalState=t.split(Js).reverse().reduce((r,n)=>{let o=n.trim(),i=o.indexOf(Zs);if(i!==-1){let s=o.slice(0,i),a=o.slice(i+1,n.length);Ys(s)&&qs(a)&&r.set(s,a)}return r},new Map),this._internalState.size>Qs&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Qs))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};var ce="traceparent",mn="tracestate",Bp="00",Gp="(?!ff)[\\da-f]{2}",Hp="(?![0]{32})[\\da-f]{32}",Vp="(?![0]{16})[\\da-f]{16}",kp="[\\da-f]{2}",Fp=new RegExp(`^\\s?(${Gp})-(${Hp})-(${Vp})-(${kp})(-.*)?\\s?$`);function ta(e){let t=Fp.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var rr=class{inject(t,r,n){let o=R.getSpanContext(t);if(!o||Wt(t)||!q(o))return;let i=`${Bp}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||M.NONE).toString(16)}`;n.set(r,ce,i),o.traceState&&n.set(r,mn,o.traceState.serialize())}extract(t,r,n){let o=n.get(r,ce);if(!o)return t;let i=Array.isArray(o)?o[0]:o;if(typeof i!="string")return t;let s=ta(i);if(!s)return t;s.isRemote=!0;let a=n.get(r,mn);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new ln(typeof c=="string"?c:void 0)}return R.setSpanContext(t,s)}fields(){return[ce,mn]}};var zp="[object Object]",$p="[object Null]",Wp="[object Undefined]",jp=Function.prototype,ea=jp.toString,Kp=ea.call(Object),Xp=Object.getPrototypeOf,ra=Object.prototype,na=ra.hasOwnProperty,Xt=Symbol?Symbol.toStringTag:void 0,oa=ra.toString;function ni(e){if(!Yp(e)||qp(e)!==zp)return!1;let t=Xp(e);if(t===null)return!0;let r=na.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ea.call(r)===Kp}function Yp(e){return e!=null&&typeof e=="object"}function qp(e){return e==null?e===void 0?Wp:$p:Xt&&Xt in Object(e)?Qp(e):Jp(e)}function Qp(e){let t=na.call(e,Xt),r=e[Xt],n=!1;try{e[Xt]=void 0,n=!0}catch{}let o=oa.call(e);return n&&(t?e[Xt]=r:delete e[Xt]),o}function Jp(e){return oa.call(e)}var Zp=20;function ii(...e){let t=e.shift(),r=new WeakMap;for(;e.length>0;)t=sa(t,e.shift(),0,r);return t}function oi(e){return hn(e)?e.slice():e}function sa(e,t,r=0,n){let o;if(!(r>Zp)){if(r++,_n(e)||_n(t)||aa(t))o=oi(t);else if(hn(e)){if(o=e.slice(),hn(t))for(let i=0,s=t.length;i<s;i++)o.push(oi(t[i]));else if(nr(t)){let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];o[c]=oi(t[c])}}}else if(nr(e))if(nr(t)){if(!tl(e,t))return t;o=Object.assign({},e);let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s],u=t[c];if(_n(u))typeof u>"u"?delete o[c]:o[c]=u;else{let p=o[c],_=u;if(ia(e,c,n)||ia(t,c,n))delete o[c];else{if(nr(p)&&nr(_)){let d=n.get(p)||[],m=n.get(_)||[];d.push({obj:e,key:c}),m.push({obj:t,key:c}),n.set(p,d),n.set(_,m)}o[c]=sa(o[c],u,r,n)}}}}else o=t;return o}}function ia(e,t,r){let n=r.get(e[t])||[];for(let o=0,i=n.length;o<i;o++){let s=n[o];if(s.key===t&&s.obj===e)return!0}return!1}function hn(e){return Array.isArray(e)}function aa(e){return typeof e=="function"}function nr(e){return!_n(e)&&!hn(e)&&!aa(e)&&typeof e=="object"}function _n(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function tl(e,t){return!(!ni(e)||!ni(t))}var dn=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function or(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new dn("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function fn(e,t){return typeof t=="string"?e===t:!!e.match(t)}function ir(e,t){if(!t)return!1;for(let r of t)if(fn(e,r))return!0;return!1}var Tn=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}};var Ot=class{_isCalled=!1;_deferred=new Tn;_callback;_that;constructor(t,r){this._callback=t,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};function ca(e,t){return new Promise(r=>{E.with(Xe(E.active()),()=>{e.export(t,r)})})}var gn={_export:ca};function nl(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function ua(){return{handleResponse(e){e==null||!nl(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||l.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}var si=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(t,r,n,o,i){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=o,this._timeout=i,this._diagLogger=l.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:G.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(t);if(n==null){r({code:G.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(o=>{if(o.status==="success"){if(o.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(o.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,o.data)}r({code:G.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:G.FAILED,error:o.error});return}else o.status==="retryable"?r({code:G.FAILED,error:o.error??new Ke("Export failed with retryable status")}):r({code:G.FAILED,error:new Ke("Export failed with unknown error")})},o=>r({code:G.FAILED,error:o})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}};function pa(e,t){return new si(e.transport,e.serializer,ua(),e.promiseHandler,t.timeout)}function la(e,t,r){return pa({transport:r,serializer:t,promiseHandler:Bs(e)},{timeout:e.timeoutMillis})}function ue(e,t){let r={attributes:yt(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function pe(e){return{name:e.name,version:e.version}}function yt(e,t){return Object.keys(e).map(r=>ai(r,e[r],t))}function ai(e,t,r){return{key:e,value:sr(t,r)}}function sr(e,t){let r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=sr(e[o],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){let n=Object.keys(e),o=new Array(n.length);for(let i=0;i<n.length;i++)o[i]={key:n[i],value:sr(e[n[i]],t)};return{kvlistValue:{values:o}}}return{}}function ma(e,t){return{resourceLogs:il(e,t)}}function ol(e){let t=new Map;for(let r of e){let{resource:n,instrumentationScope:{name:o,version:i="",schemaUrl:s=""}}=r,a=t.get(n);a||(a=new Map,t.set(n,a));let c=`${o}@${i}:${s}`,u=a.get(c);u||(u=[],a.set(c,u)),u.push(r)}return t}function il(e,t){let r=ol(e);return Array.from(r,([n,o])=>{let i=ue(n,t);return{resource:i,scopeLogs:Array.from(o,([,s])=>({scope:pe(s[0].instrumentationScope),logRecords:s.map(a=>sl(a,t)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:i.schemaUrl}})}function sl(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:sr(e.body,t),eventName:e.eventName,attributes:al(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function al(e,t){return Object.keys(e).map(r=>ai(r,e[r],t))}function cl(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function ul(e){return cl(e).toString()}var pl=typeof BigInt<"u"?ul:tt;function _a(e){return e}var le={encodeHrTime:pl,encodeSpanContext:_a,encodeOptionalSpanContext:_a,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}};var k;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(k||(k={}));var g;(function(e){e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(g||(g={}));var F;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(F||(F={}));function En(e){let t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(r=>[r,e[r]])))}function ha(e){return`${e.name}:${e.version??""}:${e.schemaUrl??""}`}var ar=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function It(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new ar("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function da(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}function fa(e,t){let r=0,n=e.length-1,o=e.length;for(;n>=r;){let i=r+Math.trunc((n-r)/2);e[i]<t?r=i+1:(o=i,n=i-1)}return o}function Ta(e,t){return e.toLowerCase()===t.toLowerCase()}var et;(function(e){e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(et||(et={}));var cr=class{kind=et.DROP;createAccumulation(){}merge(t,r){}diff(t,r){}toMetricData(t,r,n,o){}};function ll(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var me=class{startTime;_boundaries;_recordMinMax;_current;constructor(t,r,n=!0,o=ll(r)){this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=o}record(t){if(Number.isNaN(t))return;this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);let r=fa(this._boundaries,t);this._current.buckets.counts[r]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},_e=class{kind=et.HISTOGRAM;_boundaries;_recordMinMax;constructor(t,r){this._boundaries=t,this._recordMinMax=r}createAccumulation(t){return new me(t,this._boundaries,this._recordMinMax)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let p=0;p<i.length;p++)a[p]=i[p]+s[p];let c=1/0,u=-1/0;return this._recordMinMax&&(n.hasMinMax&&o.hasMinMax?(c=Math.min(n.min,o.min),u=Math.max(n.max,o.max)):n.hasMinMax?(c=n.min,u=n.max):o.hasMinMax&&(c=o.min,u=o.max)),new me(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:n.count+o.count,sum:n.sum+o.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||o.hasMinMax),min:c,max:u})}diff(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let c=0;c<i.length;c++)a[c]=s[c]-i[c];return new me(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:o.count-n.count,sum:o.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:F.HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===g.GAUGE||t.type===g.UP_DOWN_COUNTER||t.type===g.OBSERVABLE_GAUGE||t.type===g.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}};var ur=class e{backing;indexBase;indexStart;indexEnd;constructor(t=new ci,r=0,n=0,o=0){this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=o}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(t,r)=>this.at(r))}at(t){let r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)}incrementBucket(t,r){this.backing.increment(t,r)}decrementBucket(t,r){this.backing.decrement(t,r)}trim(){for(let t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()}downscale(t){this._rotate();let r=1+this.indexEnd-this.indexStart,n=1<<t,o=0,i=0;for(let s=this.indexStart;s<=this.indexEnd;){let a=s%n;a<0&&(a+=n);for(let c=a;c<n&&o<r;c++)this._relocateBucket(i,o),o++,s++;i++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)}_relocateBucket(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))}},ci=class e{_counts;constructor(t=[0]){this._counts=t}get length(){return this._counts.length}countAt(t){return this._counts[t]}growTo(t,r,n){let o=new Array(t).fill(0);o.splice(n,this._counts.length-r,...this._counts.slice(r)),o.splice(0,r,...this._counts.slice(0,r)),this._counts=o}reverse(t,r){let n=Math.floor((t+r)/2)-t;for(let o=0;o<n;o++){let i=this._counts[t+o];this._counts[t+o]=this._counts[r-o-1],this._counts[r-o-1]=i}}emptyBucket(t){let r=this._counts[t];return this._counts[t]=0,r}increment(t,r){this._counts[t]+=r}decrement(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0}clone(){return new e([...this._counts])}};var pr=Math.pow(2,-1022);function Sn(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&2146435072)>>20)-1023}function An(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let r=t.getUint32(0),n=t.getUint32(4);return(r&1048575)*Math.pow(2,32)+n}function lr(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function Ea(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var pt=class extends Error{};var Rn=class{_shift;constructor(t){this._shift=-t}mapToIndex(t){if(t<pr)return this._minNormalLowerBoundaryIndex();let r=Sn(t),n=this._rightShift(An(t)-1,52);return r+n>>this._shift}lowerBoundary(t){let r=this._minNormalLowerBoundaryIndex();if(t<r)throw new pt(`underflow: ${t} is < minimum lower boundary: ${r}`);let n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new pt(`overflow: ${t} is > maximum lower boundary: ${n}`);return lr(1,t<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let t=-1022>>this._shift;return this._shift<2&&t--,t}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}_rightShift(t,r){return Math.floor(t*Math.pow(2,-r))}};var xn=class{_scale;_scaleFactor;_inverseFactor;constructor(t){this._scale=t,this._scaleFactor=lr(Math.LOG2E,t),this._inverseFactor=lr(Math.LN2,-t)}mapToIndex(t){if(t<=pr)return this._minNormalLowerBoundaryIndex()-1;if(An(t)===0)return(Sn(t)<<this._scale)-1;let r=Math.floor(Math.log(t)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return r>=n?n:r}lowerBoundary(t){let r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new pt(`overflow: ${t} is > maximum lower boundary: ${r}`)}let n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return pr;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new pt(`overflow: ${t} is < minimum lower boundary: ${n}`)}return Math.exp(t*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}};var Aa=-10,Ra=20,_l=Array.from({length:31},(e,t)=>t>10?new xn(t-10):new Rn(t-10));function li(e){if(e>Ra||e<Aa)throw new pt(`expected scale >= ${Aa} && <= ${Ra}, got: ${e}`);return _l[e+10]}var he=class e{static combine(t,r){return new e(Math.min(t.low,r.low),Math.max(t.high,r.high))}low;high;constructor(t,r){this.low=t,this.high=r}},hl=20,dl=160,mi=2,On=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(t,r=dl,n=!0,o=0,i=0,s=0,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=new ur,p=new ur,_=li(hl)){this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=o,this._count=i,this._zeroCount=s,this._min=a,this._max=c,this._positive=u,this._negative=p,this._mapping=_,this._maxSize<mi&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${mi}`),this._maxSize=mi)}record(t){this.updateByIncrement(t,1)}setStartTime(t){this.startTime=t}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}}merge(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)}diff(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(t,r,n){let o=this._mapping.mapToIndex(r),i=!1,s=0,a=0;if(t.length===0?(t.indexStart=o,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):o<t.indexStart&&t.indexEnd-o>=this._maxSize?(i=!0,a=o,s=t.indexEnd):o>t.indexEnd&&o-t.indexStart>=this._maxSize&&(i=!0,a=t.indexStart,s=o),i){let c=this._changeScale(s,a);this._downscale(c),o=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,o,n)}_incrementIndexBy(t,r,n){if(n===0)return;if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){let i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){let i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}let o=r-t.indexBase;o<0&&(o+=t.backing.length),t.incrementBucket(o,n)}_grow(t,r){let n=t.backing.length,o=t.indexBase-t.indexStart,i=n-o,s=Ea(r);s>this._maxSize&&(s=this._maxSize);let a=s-o;t.backing.growTo(s,i,a)}_changeScale(t,r){let n=0;for(;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n}_downscale(t){if(t===0)return;if(t<0)throw new Error(`impossible change of scale: ${this.scale}`);let r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=li(r)}_minScale(t){let r=Math.min(this.scale,t.scale),n=he.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),o=he.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(o.high,o.low))}_highLowAtScale(t,r,n){if(t.length===0)return new he(0,-1);let o=r-n;return new he(t.indexStart>>o,t.indexEnd>>o)}_mergeBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++)this._incrementIndexBy(t,i+a>>s,n.at(a))}_diffBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++){let u=(i+a>>s)-t.indexBase;u<0&&(u+=t.backing.length),t.decrementBucket(u,n.at(a))}t.trim()}},mr=class{kind=et.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(t,r){this._maxSize=t,this._recordMinMax=r}createAccumulation(t){return new On(t,this._maxSize,this._recordMinMax)}merge(t,r){let n=r.clone();return n.merge(t),n}diff(t,r){let n=r.clone();return n.diff(t),n}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:F.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===g.GAUGE||t.type===g.UP_DOWN_COUNTER||t.type===g.OBSERVABLE_GAUGE||t.type===g.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}};var de=class{startTime;_current;sampleTime;constructor(t,r=0,n=[0,0]){this.startTime=t,this._current=r,this.sampleTime=n}record(t){this._current=t,this.sampleTime=I(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},_r=class{kind=et.LAST_VALUE;createAccumulation(t){return new de(t)}merge(t,r){let n=ae(r.sampleTime)>=ae(t.sampleTime)?r:t;return new de(t.startTime,n.toPointValue(),n.sampleTime)}diff(t,r){let n=ae(r.sampleTime)>=ae(t.sampleTime)?r:t;return new de(r.startTime,n.toPointValue(),n.sampleTime)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:F.GAUGE,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()}))}}};var Dt=class{startTime;monotonic;_current;reset;constructor(t,r,n=0,o=!1){this.startTime=t,this.monotonic=r,this._current=n,this.reset=o}record(t){this.monotonic&&t<0||(this._current+=t)}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},fe=class{kind=et.SUM;monotonic;constructor(t){this.monotonic=t}createAccumulation(t){return new Dt(t,this.monotonic)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue();return r.reset?new Dt(r.startTime,this.monotonic,o,r.reset):new Dt(t.startTime,this.monotonic,n+o)}diff(t,r){let n=t.toPointValue(),o=r.toPointValue();return this.monotonic&&n>o?new Dt(r.startTime,this.monotonic,o,!0):new Dt(r.startTime,this.monotonic,o-n)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:F.SUM,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()})),isMonotonic:this.monotonic}}};var _i=class e{static DEFAULT_INSTANCE=new cr;createAggregator(t){return e.DEFAULT_INSTANCE}};var hi=class e{static MONOTONIC_INSTANCE=new fe(!0);static NON_MONOTONIC_INSTANCE=new fe(!1);createAggregator(t){switch(t.type){case g.COUNTER:case g.OBSERVABLE_COUNTER:case g.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};var di=class e{static DEFAULT_INSTANCE=new _r;createAggregator(t){return e.DEFAULT_INSTANCE}};var fi=class e{static DEFAULT_INSTANCE=new _e([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}};var hr=class{_boundaries;_recordMinMax;constructor(t,r=!0){if(t==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");t=t.concat(),t=t.sort((i,s)=>i-s);let n=t.lastIndexOf(-1/0),o=t.indexOf(1/0);o===-1&&(o=void 0),this._boundaries=t.slice(n+1,o),this._recordMinMax=r}createAggregator(t){return new _e(this._boundaries,this._recordMinMax)}},dr=class{_maxSize;_recordMinMax;constructor(t=160,r=!0){this._maxSize=t,this._recordMinMax=r}createAggregator(t){return new mr(this._maxSize,this._recordMinMax)}},Ti=class{_resolve(t){switch(t.type){case g.COUNTER:case g.UP_DOWN_COUNTER:case g.OBSERVABLE_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:return Ei;case g.GAUGE:case g.OBSERVABLE_GAUGE:return Si;case g.HISTOGRAM:return t.advice.explicitBucketBoundaries?new hr(t.advice.explicitBucketBoundaries):Ai}return l.warn(`Unable to recognize instrument type: ${t.type}`),gi}createAggregator(t){return this._resolve(t).createAggregator(t)}},gi=new _i,Ei=new hi,Si=new di,Ai=new fi,zT=new dr,xa=new Ti;var $;(function(e){e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})($||($={}));function yn(e){switch(e.type){case $.DEFAULT:return xa;case $.DROP:return gi;case $.SUM:return Ei;case $.LAST_VALUE:return Si;case $.EXPONENTIAL_HISTOGRAM:{let t=e;return new dr(t.options?.maxSize,t.options?.recordMinMax)}case $.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Ai:new hr(t.options?.boundaries,t.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var Oa=e=>({type:$.DEFAULT}),ya=e=>k.CUMULATIVE;var bn=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;constructor(t){this._aggregationSelector=t?.aggregationSelector??Oa,this._aggregationTemporalitySelector=t?.aggregationTemporalitySelector??ya,this._metricProducers=t?.metricProducers??[],this._cardinalitySelector=t?.cardinalitySelector}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}selectCardinalityLimit(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3}onInitialized(){}async collect(t){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let[r,...n]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis}),...this._metricProducers.map(a=>a.collect({timeoutMillis:t?.timeoutMillis}))]),o=r.errors.concat(n.flatMap(a=>a.errors)),i=r.resourceMetrics.resource,s=r.resourceMetrics.scopeMetrics.concat(n.flatMap(a=>a.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:i,scopeMetrics:s},errors:o}}async shutdown(t){if(this._shutdown){l.error("Cannot call shutdown twice.");return}t?.timeoutMillis==null?await this.onShutdown():await It(this.onShutdown(),t.timeoutMillis),this._shutdown=!0}async forceFlush(t){if(this._shutdown){l.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(t?.timeoutMillis==null){await this.onForceFlush();return}await It(this.onForceFlush(),t.timeoutMillis)}};var fr=class extends bn{_interval;_exporter;_exportInterval;_exportTimeout;constructor(t){let{exporter:r,exportIntervalMillis:n=6e4,metricProducers:o}=t,{exportTimeoutMillis:i=3e4}=t;if(super({aggregationSelector:r.selectAggregation?.bind(r),aggregationTemporalitySelector:r.selectAggregationTemporality?.bind(r),metricProducers:o}),n<=0)throw Error("exportIntervalMillis must be greater than 0");if(i<=0)throw Error("exportTimeoutMillis must be greater than 0");if(n<i){if("exportIntervalMillis"in t&&"exportTimeoutMillis"in t)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");l.info(`Timeout of ${i} exceeds the interval of ${n}. Clamping timeout to interval duration.`),i=n}this._exportInterval=n,this._exportTimeout=i,this._exporter=r}async _runOnce(){try{await It(this._doRun(),this._exportTimeout)}catch(t){if(t instanceof ar){l.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout);return}P(t)}}async _doRun(){let{resourceMetrics:t,errors:r}=await this.collect({timeoutMillis:this._exportTimeout});if(r.length>0&&l.error("PeriodicExportingMetricReader: metrics collection errors",...r),t.resource.asyncAttributesPending)try{await t.resource.waitForAsyncAttributes?.()}catch(o){l.debug("Error while resolving async portion of resource: ",o),P(o)}if(t.scopeMetrics.length===0)return;let n=await gn._export(this._exporter,t);if(n.code!==G.SUCCESS)throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${n.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};var wn;function ba(){if(wn===void 0)try{let e=globalThis.process.argv0;wn=e?`unknown_service:${e}`:"unknown_service"}catch{wn="unknown_service"}return wn}var Te=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";var Ri=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,r){let n=new e({},r);return n._rawAttributes=wa(t),n._asyncAttributesPending=t.filter(([o,i])=>Te(i)).length>0,n}constructor(t,r){let n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([o,i])=>(Te(i)&&(this._asyncAttributesPending=!0),[o,i])),this._rawAttributes=wa(this._rawAttributes),this._schemaUrl=fl(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){let[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,Te(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&l.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let t={};for(let[r,n]of this._rawAttributes){if(Te(n)){l.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(t[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let r=Tl(this,t),n=r?{schemaUrl:r}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}};function Nn(e,t){return Ri.FromAttributeList(Object.entries(e),t)}function Yt(){return Nn({[Ws]:ba(),[Qe]:Mt[Qe],[Je]:Mt[Je],[Ze]:Mt[Ze]})}function wa(e){return e.map(([t,r])=>Te(r)?[t,r.catch(n=>{l.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function fl(e){if(typeof e=="string"||e===void 0)return e;l.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function Tl(e,t){let r=e?.schemaUrl,n=t?.schemaUrl,o=r===void 0||r==="",i=n===void 0||n==="";if(o)return n;if(i||r===n)return r;l.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var Ln=class{_registeredViews=[];addView(t){this._registeredViews.push(t)}findViews(t,r){return this._registeredViews.filter(o=>this._matchInstrument(o.instrumentSelector,t)&&this._matchMeter(o.meterSelector,r))}_matchInstrument(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)}_matchMeter(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))}};function lt(e,t,r){return El(e)||l.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:r?.description??"",unit:r?.unit??"",valueType:r?.valueType??Y.DOUBLE,advice:r?.advice??{}}}function Na(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function La(e,t){return Ta(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var gl=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function El(e){return gl.test(e)}var ge=class{_writableMetricStorage;_descriptor;constructor(t,r){this._writableMetricStorage=t,this._descriptor=r}_record(t,r={},n=E.active()){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===Y.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,I(Date.now()))}},vn=class extends ge{add(t,r,n){this._record(t,r,n)}},Pn=class extends ge{add(t,r,n){if(t<0){l.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},Cn=class extends ge{record(t,r,n){this._record(t,r,n)}},Mn=class extends ge{record(t,r,n){if(t<0){l.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},Ee=class{_metricStorages;_descriptor;_observableRegistry;constructor(t,r,n){this._descriptor=t,this._metricStorages=r,this._observableRegistry=n}addCallback(t){this._observableRegistry.addCallback(t,this)}removeCallback(t){this._observableRegistry.removeCallback(t,this)}},In=class extends Ee{},Dn=class extends Ee{},Un=class extends Ee{};function Tr(e){return e instanceof Ee}var Bn=class{_meterSharedState;constructor(t){this._meterSharedState=t}createGauge(t,r){let n=lt(t,g.GAUGE,r),o=this._meterSharedState.registerMetricStorage(n);return new Cn(o,n)}createHistogram(t,r){let n=lt(t,g.HISTOGRAM,r),o=this._meterSharedState.registerMetricStorage(n);return new Mn(o,n)}createCounter(t,r){let n=lt(t,g.COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new Pn(o,n)}createUpDownCounter(t,r){let n=lt(t,g.UP_DOWN_COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new vn(o,n)}createObservableGauge(t,r){let n=lt(t,g.OBSERVABLE_GAUGE,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Dn(n,o,this._meterSharedState.observableRegistry)}createObservableCounter(t,r){let n=lt(t,g.OBSERVABLE_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new In(n,o,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,r){let n=lt(t,g.OBSERVABLE_UP_DOWN_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Un(n,o,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)}removeBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)}};var Se=class{_instrumentDescriptor;constructor(t){this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=lt(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};var xi=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(t){this._hash=t}get(t,r){return r??=this._hash(t),this._valueMap.get(r)}getOrDefault(t,r){let n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);let o=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,o),o}set(t,r,n){n??=this._hash(t),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)}has(t,r){return r??=this._hash(t),this._valueMap.has(r)}*keys(){let t=this._keyMap.entries(),r=t.next();for(;r.done!==!0;)yield[r.value[1],r.value[0]],r=t.next()}*entries(){let t=this._valueMap.entries(),r=t.next();for(;r.done!==!0;)yield[this._keyMap.get(r.value[0]),r.value[1],r.value[0]],r=t.next()}get size(){return this._valueMap.size}},Q=class extends xi{constructor(){super(En)}};var Ae=class{_activeCollectionStorage=new Q;_cumulativeMemoStorage=new Q;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(t,r){this._aggregator=t,this._cardinalityLimit=(r??2e3)-1,this._overflowHashCode=En(this._overflowAttributes)}record(t,r,n,o){let i=this._activeCollectionStorage.get(r);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(o))?.record(t);return}i=this._aggregator.createAccumulation(o),this._activeCollectionStorage.set(r,i)}i?.record(t)}batchCumulate(t,r){Array.from(t.entries()).forEach(([n,o,i])=>{let s=this._aggregator.createAccumulation(r);s?.record(o);let a=s;if(this._cumulativeMemoStorage.has(n,i)){let c=this._cumulativeMemoStorage.get(n,i);a=this._aggregator.diff(c,s)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(n=this._overflowAttributes,i=this._overflowHashCode,this._cumulativeMemoStorage.has(n,i))){let c=this._cumulativeMemoStorage.get(n,i);a=this._aggregator.diff(c,s)}if(this._activeCollectionStorage.has(n,i)){let c=this._activeCollectionStorage.get(n,i);a=this._aggregator.merge(c,a)}this._cumulativeMemoStorage.set(n,s,i),this._activeCollectionStorage.set(n,a,i)})}collect(){let t=this._activeCollectionStorage;return this._activeCollectionStorage=new Q,t}};var Re=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(t,r){this._aggregator=t,r.forEach(n=>{this._unreportedAccumulations.set(n,[])})}buildMetrics(t,r,n,o){this._stashAccumulations(n);let i=this._getMergedUnreportedAccumulations(t),s=i,a;if(this._reportHistory.has(t)){let u=this._reportHistory.get(t),p=u.collectionTime;a=u.aggregationTemporality,a===k.CUMULATIVE?s=e.merge(u.accumulations,i,this._aggregator):s=e.calibrateStartTime(u.accumulations,i,p)}else a=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:o,aggregationTemporality:a});let c=Sl(s);if(c.length!==0)return this._aggregator.toMetricData(r,a,c,o)}_stashAccumulations(t){let r=this._unreportedAccumulations.keys();for(let n of r){let o=this._unreportedAccumulations.get(n);o===void 0&&(o=[],this._unreportedAccumulations.set(n,o)),o.push(t)}}_getMergedUnreportedAccumulations(t){let r=new Q,n=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),n===void 0)return r;for(let o of n)r=e.merge(r,o,this._aggregator);return r}static merge(t,r,n){let o=t,i=r.entries(),s=i.next();for(;s.done!==!0;){let[a,c,u]=s.value;if(t.has(a,u)){let p=t.get(a,u),_=n.merge(p,c);o.set(a,_,u)}else o.set(a,c,u);s=i.next()}return o}static calibrateStartTime(t,r,n){for(let[o,i]of t.keys())r.get(o,i)?.setStartTime(n);return r}};function Sl(e){return Array.from(e.entries())}var Gn=class extends Se{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ae(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Re(r,o),this._attributesProcessor=n}record(t,r){let n=new Q;Array.from(t.entries()).forEach(([o,i])=>{n.set(this._attributesProcessor.process(o),i)}),this._deltaMetricStorage.batchCumulate(n,r)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};function Oi(e,t){let r="";return e.unit!==t.unit&&(r+=` - Unit '${e.unit}' does not match '${t.unit}'
1
+ (()=>{var gt="1.9.1";var Ls=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function qu(e){let t=new Set([e]),r=new Set,n=e.match(Ls);if(!n)return()=>!1;let o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===e};function i(a){return r.add(a),!1}function s(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;let u=c.match(Ls);if(!u)return i(c);let p={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var Ns=qu(gt);var Qu=gt.split(".")[0],Be=Symbol.for(`opentelemetry.js.api.${Qu}`),Ge=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function ot(e,t,r,n=!1){var o;let i=Ge[Be]=(o=Ge[Be])!==null&&o!==void 0?o:{version:gt};if(!n&&i[e]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(i.version!==gt){let s=new Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${gt}`);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${gt}.`),!0}function j(e){var t,r;let n=(t=Ge[Be])===null||t===void 0?void 0:t.version;if(!(!n||!Ns(n)))return(r=Ge[Be])===null||r===void 0?void 0:r[e]}function it(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${gt}.`);let r=Ge[Be];r&&delete r[e]}var kr=class{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return He("debug",this._namespace,t)}error(...t){return He("error",this._namespace,t)}info(...t){return He("info",this._namespace,t)}warn(...t){return He("warn",this._namespace,t)}verbose(...t){return He("verbose",this._namespace,t)}};function He(e,t,r){let n=j("diag");if(n)return n[e](t,...r)}var O;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(O||(O={}));function ys(e,t){e<O.NONE?e=O.NONE:e>O.ALL&&(e=O.ALL),t=t||{};function r(n,o){let i=t[n];return typeof i=="function"&&e>=o?i.bind(t):function(){}}return{error:r("error",O.ERROR),warn:r("warn",O.WARN),info:r("info",O.INFO),debug:r("debug",O.DEBUG),verbose:r("verbose",O.VERBOSE)}}var Ju="diag",y=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(o){return function(...i){let s=j("diag");if(s)return s[o](...i)}}let r=this,n=(o,i={logLevel:O.INFO})=>{var s,a,c;if(o===r){let _=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=_.stack)!==null&&s!==void 0?s:_.message),!1}typeof i=="number"&&(i={logLevel:i});let u=j("diag"),p=ys((a=i.logLevel)!==null&&a!==void 0?a:O.INFO,o);if(u&&!i.suppressOverrideMessage){let _=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn(`Current logger will be overwritten from ${_}`),p.warn(`Current logger will overwrite one already registered from ${_}`)}return ot("diag",p,r,!0)};r.setLogger=n,r.disable=()=>{it(Ju,r)},r.createComponentLogger=o=>new kr(o),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}};var Fr=class e{constructor(t){this._entries=t?new Map(t):new Map}getEntry(t){let r=this._entries.get(t);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,r){let n=new e(this._entries);return n._entries.set(t,r),n}removeEntry(t){let r=new e(this._entries);return r._entries.delete(t),r}removeEntries(...t){let r=new e(this._entries);for(let n of t)r._entries.delete(n);return r}clear(){return new e}};var Cs=Symbol("BaggageEntryMetadata");var Zu=y.instance();function Ps(e={}){return new Fr(new Map(Object.entries(e)))}function Yo(e){return typeof e!="string"&&(Zu.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:Cs,toString(){return e}}}function kt(e){return Symbol.for(e)}var qo=class e{constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,o)=>{let i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=n=>{let o=new e(r._currentContext);return o._currentContext.delete(n),o}}},B=new qo;var Qo=class{constructor(){}createGauge(t,r){return el}createHistogram(t,r){return rl}createCounter(t,r){return tl}createUpDownCounter(t,r){return nl}createObservableGauge(t,r){return il}createObservableCounter(t,r){return ol}createObservableUpDownCounter(t,r){return sl}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}},re=class{},Jo=class extends re{add(t,r){}},Zo=class extends re{add(t,r){}},ti=class extends re{record(t,r){}},ei=class extends re{record(t,r){}},Ve=class{addCallback(t){}removeCallback(t){}},ri=class extends Ve{},ni=class extends Ve{},oi=class extends Ve{},ii=new Qo,tl=new Jo,el=new ti,rl=new ei,nl=new Zo,ol=new ri,il=new ni,sl=new oi;function Ft(){return ii}var K;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(K||(K={}));var Is={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},Ms={set(e,t,r){e!=null&&(e[t]=r)}};var $r=class{active(){return B}with(t,r,n,...o){return r.call(n,...o)}bind(t,r){return r}enable(){return this}disable(){return this}};var si="context",al=new $r,st=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return ot(si,t,y.instance())}active(){return this._getContextManager().active()}with(t,r,n,...o){return this._getContextManager().with(t,r,n,...o)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return j(si)||al}disable(){this._getContextManager().disable(),it(si,y.instance())}};var w;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(w||(w={}));var zr="0000000000000000",Wr="00000000000000000000000000000000",ke={traceId:Wr,spanId:zr,traceFlags:w.NONE};var at=class{constructor(t=ke){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}};var ai=kt("OpenTelemetry Context Key SPAN");function jr(e){return e.getValue(ai)||void 0}function vs(){return jr(st.getInstance().active())}function Fe(e,t){return e.setValue(ai,t)}function Ds(e){return e.deleteValue(ai)}function Us(e,t){return Fe(e,new at(t))}function Kr(e){var t;return(t=jr(e))===null||t===void 0?void 0:t.spanContext()}var Xr=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 Bs(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(Xr[e.charCodeAt(n)]|0)+(Xr[e.charCodeAt(n+1)]|0)+(Xr[e.charCodeAt(n+2)]|0)+(Xr[e.charCodeAt(n+3)]|0);return r===t}function Yr(e){return Bs(e,32)&&e!==Wr}function Gs(e){return Bs(e,16)&&e!==zr}function z(e){return Yr(e.traceId)&&Gs(e.spanId)}function Hs(e){return new at(e)}var ci=st.getInstance(),ne=class{startSpan(t,r,n=ci.active()){if(!!r?.root)return new at;let i=n&&Kr(n);return cl(i)&&z(i)?new at(i):new at}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??ci.active(),u=this.startSpan(t,i,c),p=Fe(c,u);return ci.with(p,a,void 0,u)}};function cl(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var ul=new ne,qr=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,o){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):ul}};var Qr=class{getTracer(t,r,n){return new ne}};var ll=new Qr,$e=class{getTracer(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new qr(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ll}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)}};var oe;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(oe||(oe={}));var Et;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(Et||(Et={}));var X;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(X||(X={}));var E=st.getInstance();var l=y.instance();var ui=class{getMeter(t,r,n){return ii}},Vs=new ui;var li="metrics",Jr=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(t){return ot(li,t,y.instance())}getMeterProvider(){return j(li)||Vs}getMeter(t,r,n){return this.getMeterProvider().getMeter(t,r,n)}disable(){it(li,y.instance())}};var $t=Jr.getInstance();var Zr=class{inject(t,r){}extract(t,r){return t}fields(){return[]}};var pi=kt("OpenTelemetry Baggage Key");function mi(e){return e.getValue(pi)||void 0}function ks(){return mi(st.getInstance().active())}function Fs(e,t){return e.setValue(pi,t)}function $s(e){return e.deleteValue(pi)}var _i="propagation",pl=new Zr,tn=class e{constructor(){this.createBaggage=Ps,this.getBaggage=mi,this.getActiveBaggage=ks,this.setBaggage=Fs,this.deleteBaggage=$s}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(t){return ot(_i,t,y.instance())}inject(t,r,n=Ms){return this._getGlobalPropagator().inject(t,r,n)}extract(t,r,n=Is){return this._getGlobalPropagator().extract(t,r,n)}fields(){return this._getGlobalPropagator().fields()}disable(){it(_i,y.instance())}_getGlobalPropagator(){return j(_i)||pl}};var D=tn.getInstance();var di="trace",en=class e{constructor(){this._proxyTracerProvider=new $e,this.wrapSpanContext=Hs,this.isSpanContextValid=z,this.deleteSpan=Ds,this.getSpan=jr,this.getActiveSpan=vs,this.getSpanContext=Kr,this.setSpan=Fe,this.setSpanContext=Us}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=ot(di,this._proxyTracerProvider,y.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return j(di)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){it(di,y.instance()),this._proxyTracerProvider=new $e}};var A=en.getInstance();var Y;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(Y||(Y={}));var ie=class{emit(t){}enabled(){return!1}},ze=new ie;var We=Symbol.for("io.opentelemetry.js.api.logs"),se=globalThis;function zs(e,t,r){return n=>n===e?t:r}var hi=1;var fi=class{getLogger(t,r,n){return new ie}},rn=new fi;var nn=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):ze}};var je=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new nn(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:rn}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};var on=class e{constructor(){this._proxyLoggerProvider=new je}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return se[We]?this.getLoggerProvider():(se[We]=zs(hi,t,rn),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=se[We])===null||t===void 0?void 0:t.call(se,hi))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete se[We],this._proxyLoggerProvider=new je}};var Ct=on.getInstance();var At=class{_delegate;constructor(t){this._delegate=t}export(t,r){this._delegate.export(t,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};var Ke=class extends Error{code;name="OTLPExporterError";data;constructor(t,r,n){super(t),this.data=n,this.code=r}};function ml(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Ws(e){if(e!=null)return async()=>e}function js(e,t,r){return{timeoutMillis:ml(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function Ks(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Ti=class{_concurrencyLimit;_sendingPromises=[];constructor(t){this._concurrencyLimit=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);let r=()=>{let n=this._sendingPromises.indexOf(t);this._sendingPromises.splice(n,1)};t.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function Xs(e){return new Ti(e.concurrencyLimit)}var Ys=kt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function zt(e){return e.setValue(Ys,!0)}function Wt(e){return e.getValue(Ys)===!0}var sn="baggage";function qs(e){return e.reduce((t,r)=>{let n=`${t}${t!==""?",":""}${r}`;return n.length>8192?t:n},"")}function Qs(e){return e.getAllEntries().map(([t,r])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function Js(e){if(!e)return;let t=e.indexOf(";"),r=t===-1?e:e.substring(0,t),n=r.indexOf("=");if(n<=0)return;let o=r.substring(0,n).trim(),i=r.substring(n+1).trim();if(!o||!i)return;let s,a;try{s=decodeURIComponent(o),a=decodeURIComponent(i)}catch{return}let c;if(t!==-1&&t<e.length-1){let u=e.substring(t+1);c=Yo(u)}return{key:s,value:a,metadata:c}}var Xe=class{inject(t,r,n){let o=D.getBaggage(t);if(!o||Wt(t))return;let i=Qs(o).filter(a=>a.length<=4096).slice(0,180),s=qs(i);s.length>0&&n.set(r,sn,s)}extract(t,r,n){let o=n.get(r,sn),i=Array.isArray(o)?o.join(","):o;if(!i)return t;let s={};return i.length===0||(i.split(",").forEach(c=>{let u=Js(c);if(u){let p={value:u.value};u.metadata&&(p.metadata=u.metadata),s[u.key]=p}}),Object.entries(s).length===0)?t:D.setBaggage(t,D.createBaggage(s))}fields(){return[sn]}};function Pt(e){let t={};if(typeof e!="object"||e==null)return t;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!fl(r)){l.warn(`Invalid attribute key: ${r}`);continue}let n=e[r];if(!an(n)){l.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function fl(e){return typeof e=="string"&&e!==""}function an(e){return e==null?!0:Array.isArray(e)?Tl(e):Zs(typeof e)}function Tl(e){let t;for(let r of e){if(r==null)continue;let n=typeof r;if(n!==t){if(!t){if(Zs(n)){t=n;continue}return!1}return!1}}return!0}function Zs(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function ta(){return e=>{l.error(gl(e))}}function gl(e){return typeof e=="string"?e:JSON.stringify(El(e))}function El(e){let t={},r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;let o=r[n];o&&(t[n]=String(o))}),r=Object.getPrototypeOf(r);return t}var Sl=ta();function C(e){try{Sl(e)}catch{}}var ea="2.7.0";var Ye="error.type";var Q="exception.message",jt="exception.stacktrace",et="exception.type";var cn="http.request.method";var un="http.request.method_original";var ln="http.response.status_code";var pn="server.address",mn="server.port",ra="service.name";var qe="telemetry.sdk.language";var na="webjs",Qe="telemetry.sdk.name",Je="telemetry.sdk.version";var It="url.full";var oa="user_agent.original";var ia="process.runtime.name";var Mt={[Qe]:"opentelemetry",[ia]:"browser",[qe]:na,[Je]:ea};var N=performance;var Al=9,Rl=6,xl=Math.pow(10,Rl),_n=Math.pow(10,Al);function P(e){let t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*xl);return[r,n]}function I(e){let t=P(N.timeOrigin),r=P(typeof e=="number"?e:N.now());return hn(t,r)}function ct(e){if(Ze(e))return e;if(typeof e=="number")return e<N.timeOrigin?I(e):P(e);if(e instanceof Date)return P(e.getTime());throw TypeError("Invalid input type")}function Ei(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=_n),[r,n]}function J(e){return e[0]*_n+e[1]}function ae(e){return e[0]*1e6+e[1]/1e3}function Ze(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function dn(e){return Ze(e)||typeof e=="number"||e instanceof Date}function hn(e,t){let r=[e[0]+t[0],e[1]+t[1]];return r[1]>=_n&&(r[1]-=_n,r[0]+=1),r}var U;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(U||(U={}));var tr=class{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(t,r,n){for(let o of this._propagators)try{o.inject(t,r,n)}catch(i){l.warn(`Failed to inject with ${o.constructor.name}. Err: ${i.message}`)}}extract(t,r,n){return this._propagators.reduce((o,i)=>{try{return i.extract(o,r,n)}catch(s){l.warn(`Failed to extract with ${i.constructor.name}. Err: ${s.message}`)}return o},t)}fields(){return this._fields.slice()}};var Si="[_0-9a-z-*/]",Ol=`[a-z]${Si}{0,255}`,bl=`[a-z0-9]${Si}{0,240}@[a-z]${Si}{0,13}`,wl=new RegExp(`^(?:${Ol}|${bl})$`),Ll=/^[ -~]{0,255}[!-~]$/,Nl=/,|=/;function sa(e){return wl.test(e)}function aa(e){return Ll.test(e)&&!Nl.test(e)}var ca=32,yl=512,ua=",",la="=",fn=class e{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,r){let n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,r),n}unset(t){let r=this._clone();return r._internalState.delete(t),r}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce((t,r)=>(t.push(r+la+this.get(r)),t),[]).join(ua)}_parse(t){t.length>yl||(this._internalState=t.split(ua).reverse().reduce((r,n)=>{let o=n.trim(),i=o.indexOf(la);if(i!==-1){let s=o.slice(0,i),a=o.slice(i+1,n.length);sa(s)&&aa(a)&&r.set(s,a)}return r},new Map),this._internalState.size>ca&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ca))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};var ce="traceparent",Tn="tracestate",Cl="00",Pl="(?!ff)[\\da-f]{2}",Il="(?![0]{32})[\\da-f]{32}",Ml="(?![0]{16})[\\da-f]{16}",vl="[\\da-f]{2}",Dl=new RegExp(`^\\s?(${Pl})-(${Il})-(${Ml})-(${vl})(-.*)?\\s?$`);function pa(e){let t=Dl.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var er=class{inject(t,r,n){let o=A.getSpanContext(t);if(!o||Wt(t)||!z(o))return;let i=`${Cl}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||w.NONE).toString(16)}`;n.set(r,ce,i),o.traceState&&n.set(r,Tn,o.traceState.serialize())}extract(t,r,n){let o=n.get(r,ce);if(!o)return t;let i=Array.isArray(o)?o[0]:o;if(typeof i!="string")return t;let s=pa(i);if(!s)return t;s.isRemote=!0;let a=n.get(r,Tn);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new fn(typeof c=="string"?c:void 0)}return A.setSpanContext(t,s)}fields(){return[ce,Tn]}};var Ul="[object Object]",Bl="[object Null]",Gl="[object Undefined]",Hl=Function.prototype,ma=Hl.toString,Vl=ma.call(Object),kl=Object.getPrototypeOf,_a=Object.prototype,da=_a.hasOwnProperty,Kt=Symbol?Symbol.toStringTag:void 0,ha=_a.toString;function Ai(e){if(!Fl(e)||$l(e)!==Ul)return!1;let t=kl(e);if(t===null)return!0;let r=da.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ma.call(r)===Vl}function Fl(e){return e!=null&&typeof e=="object"}function $l(e){return e==null?e===void 0?Gl:Bl:Kt&&Kt in Object(e)?zl(e):Wl(e)}function zl(e){let t=da.call(e,Kt),r=e[Kt],n=!1;try{e[Kt]=void 0,n=!0}catch{}let o=ha.call(e);return n&&(t?e[Kt]=r:delete e[Kt]),o}function Wl(e){return ha.call(e)}var jl=20;function xi(...e){let t=e.shift(),r=new WeakMap;for(;e.length>0;)t=Ta(t,e.shift(),0,r);return t}function Ri(e){return En(e)?e.slice():e}function Ta(e,t,r=0,n){let o;if(!(r>jl)){if(r++,gn(e)||gn(t)||ga(t))o=Ri(t);else if(En(e)){if(o=e.slice(),En(t))for(let i=0,s=t.length;i<s;i++)o.push(Ri(t[i]));else if(rr(t)){let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];c==="__proto__"||c==="constructor"||c==="prototype"||(o[c]=Ri(t[c]))}}}else if(rr(e))if(rr(t)){if(!Kl(e,t))return t;o=Object.assign({},e);let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;let u=t[c];if(gn(u))typeof u>"u"?delete o[c]:o[c]=u;else{let p=o[c],_=u;if(fa(e,c,n)||fa(t,c,n))delete o[c];else{if(rr(p)&&rr(_)){let f=n.get(p)||[],m=n.get(_)||[];f.push({obj:e,key:c}),m.push({obj:t,key:c}),n.set(p,f),n.set(_,m)}o[c]=Ta(o[c],u,r,n)}}}}else o=t;return o}}function fa(e,t,r){let n=r.get(e[t])||[];for(let o=0,i=n.length;o<i;o++){let s=n[o];if(s.key===t&&s.obj===e)return!0}return!1}function En(e){return Array.isArray(e)}function ga(e){return typeof e=="function"}function rr(e){return!gn(e)&&!En(e)&&!ga(e)&&typeof e=="object"}function gn(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function Kl(e,t){return!(!Ai(e)||!Ai(t))}var Sn=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Oi(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new Sn("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function An(e,t){return typeof t=="string"?e===t:!!e.match(t)}function nr(e,t){if(!t)return!1;for(let r of t)if(An(e,r))return!0;return!1}var Rn=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}};var Rt=class{_isCalled=!1;_deferred=new Rn;_callback;_that;constructor(t,r){this._callback=t,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};function Ea(e,t){return new Promise(r=>{E.with(zt(E.active()),()=>{e.export(t,r)})})}var Sa={_export:Ea};function ql(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function Aa(){return{handleResponse(e){e==null||!ql(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||l.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}var bi=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(t,r,n,o,i){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=o,this._timeout=i,this._diagLogger=l.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:U.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(t);if(n==null){r({code:U.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(o=>{if(o.status==="success"){if(o.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(o.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,o.data)}r({code:U.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:U.FAILED,error:o.error});return}else o.status==="retryable"?r({code:U.FAILED,error:o.error??new Ke("Export failed with retryable status")}):r({code:U.FAILED,error:new Ke("Export failed with unknown error")})},o=>r({code:U.FAILED,error:o})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}};function Ra(e,t){return new bi(e.transport,e.serializer,Aa(),e.promiseHandler,t.timeout)}function xa(e,t,r){return Ra({transport:r,serializer:t,promiseHandler:Xs(e)},{timeout:e.timeoutMillis})}var G;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(G||(G={}));var T;(function(e){e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(T||(T={}));var H;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(H||(H={}));function xn(e){let t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(r=>[r,e[r]])))}function Oa(e){return`${e.name}:${e.version??""}:${e.schemaUrl??""}`}var or=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function vt(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new or("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function ba(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}function wa(e,t){let r=0,n=e.length-1,o=e.length;for(;n>=r;){let i=r+Math.trunc((n-r)/2);e[i]<t?r=i+1:(o=i,n=i-1)}return o}function La(e,t){return e.toLowerCase()===t.toLowerCase()}var Z;(function(e){e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(Z||(Z={}));var ir=class{kind=Z.DROP;createAccumulation(){}merge(t,r){}diff(t,r){}toMetricData(t,r,n,o){}};function Ql(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var ue=class{startTime;_boundaries;_recordMinMax;_current;constructor(t,r,n=!0,o=Ql(r)){this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=o}record(t){if(Number.isNaN(t))return;this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);let r=wa(this._boundaries,t);this._current.buckets.counts[r]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},le=class{kind=Z.HISTOGRAM;_boundaries;_recordMinMax;constructor(t,r){this._boundaries=t,this._recordMinMax=r}createAccumulation(t){return new ue(t,this._boundaries,this._recordMinMax)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let p=0;p<i.length;p++)a[p]=i[p]+s[p];let c=1/0,u=-1/0;return this._recordMinMax&&(n.hasMinMax&&o.hasMinMax?(c=Math.min(n.min,o.min),u=Math.max(n.max,o.max)):n.hasMinMax?(c=n.min,u=n.max):o.hasMinMax&&(c=o.min,u=o.max)),new ue(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:n.count+o.count,sum:n.sum+o.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||o.hasMinMax),min:c,max:u})}diff(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let c=0;c<i.length;c++)a[c]=s[c]-i[c];return new ue(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:o.count-n.count,sum:o.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===T.GAUGE||t.type===T.UP_DOWN_COUNTER||t.type===T.OBSERVABLE_GAUGE||t.type===T.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}};var sr=class e{backing;indexBase;indexStart;indexEnd;constructor(t=new wi,r=0,n=0,o=0){this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=o}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(t,r)=>this.at(r))}at(t){let r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)}incrementBucket(t,r){this.backing.increment(t,r)}decrementBucket(t,r){this.backing.decrement(t,r)}trim(){for(let t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()}downscale(t){this._rotate();let r=1+this.indexEnd-this.indexStart,n=1<<t,o=0,i=0;for(let s=this.indexStart;s<=this.indexEnd;){let a=s%n;a<0&&(a+=n);for(let c=a;c<n&&o<r;c++)this._relocateBucket(i,o),o++,s++;i++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)}_relocateBucket(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))}},wi=class e{_counts;constructor(t=[0]){this._counts=t}get length(){return this._counts.length}countAt(t){return this._counts[t]}growTo(t,r,n){let o=new Array(t).fill(0);o.splice(n,this._counts.length-r,...this._counts.slice(r)),o.splice(0,r,...this._counts.slice(0,r)),this._counts=o}reverse(t,r){let n=Math.floor((t+r)/2)-t;for(let o=0;o<n;o++){let i=this._counts[t+o];this._counts[t+o]=this._counts[r-o-1],this._counts[r-o-1]=i}}emptyBucket(t){let r=this._counts[t];return this._counts[t]=0,r}increment(t,r){this._counts[t]+=r}decrement(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0}clone(){return new e([...this._counts])}};var ar=Math.pow(2,-1022);function On(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&2146435072)>>20)-1023}function bn(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let r=t.getUint32(0),n=t.getUint32(4);return(r&1048575)*Math.pow(2,32)+n}function cr(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function ya(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var ut=class extends Error{};var wn=class{_shift;constructor(t){this._shift=-t}mapToIndex(t){if(t<ar)return this._minNormalLowerBoundaryIndex();let r=On(t),n=this._rightShift(bn(t)-1,52);return r+n>>this._shift}lowerBoundary(t){let r=this._minNormalLowerBoundaryIndex();if(t<r)throw new ut(`underflow: ${t} is < minimum lower boundary: ${r}`);let n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new ut(`overflow: ${t} is > maximum lower boundary: ${n}`);return cr(1,t<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let t=-1022>>this._shift;return this._shift<2&&t--,t}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}_rightShift(t,r){return Math.floor(t*Math.pow(2,-r))}};var Ln=class{_scale;_scaleFactor;_inverseFactor;constructor(t){this._scale=t,this._scaleFactor=cr(Math.LOG2E,t),this._inverseFactor=cr(Math.LN2,-t)}mapToIndex(t){if(t<=ar)return this._minNormalLowerBoundaryIndex()-1;if(bn(t)===0)return(On(t)<<this._scale)-1;let r=Math.floor(Math.log(t)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return r>=n?n:r}lowerBoundary(t){let r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new ut(`overflow: ${t} is > maximum lower boundary: ${r}`)}let n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return ar;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new ut(`overflow: ${t} is < minimum lower boundary: ${n}`)}return Math.exp(t*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}};var Pa=-10,Ia=20,Zl=Array.from({length:31},(e,t)=>t>10?new Ln(t-10):new wn(t-10));function yi(e){if(e>Ia||e<Pa)throw new ut(`expected scale >= ${Pa} && <= ${Ia}, got: ${e}`);return Zl[e+10]}var pe=class e{static combine(t,r){return new e(Math.min(t.low,r.low),Math.max(t.high,r.high))}low;high;constructor(t,r){this.low=t,this.high=r}},tp=20,ep=160,Ci=2,Nn=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(t,r=ep,n=!0,o=0,i=0,s=0,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=new sr,p=new sr,_=yi(tp)){this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=o,this._count=i,this._zeroCount=s,this._min=a,this._max=c,this._positive=u,this._negative=p,this._mapping=_,this._maxSize<Ci&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${Ci}`),this._maxSize=Ci)}record(t){this.updateByIncrement(t,1)}setStartTime(t){this.startTime=t}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}}merge(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)}diff(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(t,r,n){let o=this._mapping.mapToIndex(r),i=!1,s=0,a=0;if(t.length===0?(t.indexStart=o,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):o<t.indexStart&&t.indexEnd-o>=this._maxSize?(i=!0,a=o,s=t.indexEnd):o>t.indexEnd&&o-t.indexStart>=this._maxSize&&(i=!0,a=t.indexStart,s=o),i){let c=this._changeScale(s,a);this._downscale(c),o=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,o,n)}_incrementIndexBy(t,r,n){if(n===0)return;if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){let i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){let i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}let o=r-t.indexBase;o<0&&(o+=t.backing.length),t.incrementBucket(o,n)}_grow(t,r){let n=t.backing.length,o=t.indexBase-t.indexStart,i=n-o,s=ya(r);s>this._maxSize&&(s=this._maxSize);let a=s-o;t.backing.growTo(s,i,a)}_changeScale(t,r){let n=0;for(;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n}_downscale(t){if(t===0)return;if(t<0)throw new Error(`impossible change of scale: ${this.scale}`);let r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=yi(r)}_minScale(t){let r=Math.min(this.scale,t.scale),n=pe.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),o=pe.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(o.high,o.low))}_highLowAtScale(t,r,n){if(t.length===0)return new pe(0,-1);let o=r-n;return new pe(t.indexStart>>o,t.indexEnd>>o)}_mergeBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++)this._incrementIndexBy(t,i+a>>s,n.at(a))}_diffBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++){let u=(i+a>>s)-t.indexBase;u<0&&(u+=t.backing.length),t.decrementBucket(u,n.at(a))}t.trim()}},ur=class{kind=Z.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(t,r){this._maxSize=t,this._recordMinMax=r}createAccumulation(t){return new Nn(t,this._maxSize,this._recordMinMax)}merge(t,r){let n=r.clone();return n.merge(t),n}diff(t,r){let n=r.clone();return n.diff(t),n}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===T.GAUGE||t.type===T.UP_DOWN_COUNTER||t.type===T.OBSERVABLE_GAUGE||t.type===T.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}};var me=class{startTime;_current;sampleTime;constructor(t,r=0,n=[0,0]){this.startTime=t,this._current=r,this.sampleTime=n}record(t){this._current=t,this.sampleTime=P(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},lr=class{kind=Z.LAST_VALUE;createAccumulation(t){return new me(t)}merge(t,r){let n=ae(r.sampleTime)>=ae(t.sampleTime)?r:t;return new me(t.startTime,n.toPointValue(),n.sampleTime)}diff(t,r){let n=ae(r.sampleTime)>=ae(t.sampleTime)?r:t;return new me(r.startTime,n.toPointValue(),n.sampleTime)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.GAUGE,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()}))}}};var Dt=class{startTime;monotonic;_current;reset;constructor(t,r,n=0,o=!1){this.startTime=t,this.monotonic=r,this._current=n,this.reset=o}record(t){this.monotonic&&t<0||(this._current+=t)}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},_e=class{kind=Z.SUM;monotonic;constructor(t){this.monotonic=t}createAccumulation(t){return new Dt(t,this.monotonic)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue();return r.reset?new Dt(r.startTime,this.monotonic,o,r.reset):new Dt(t.startTime,this.monotonic,n+o)}diff(t,r){let n=t.toPointValue(),o=r.toPointValue();return this.monotonic&&n>o?new Dt(r.startTime,this.monotonic,o,!0):new Dt(r.startTime,this.monotonic,o-n)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.SUM,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()})),isMonotonic:this.monotonic}}};var Pi=class e{static DEFAULT_INSTANCE=new ir;createAggregator(t){return e.DEFAULT_INSTANCE}};var Ii=class e{static MONOTONIC_INSTANCE=new _e(!0);static NON_MONOTONIC_INSTANCE=new _e(!1);createAggregator(t){switch(t.type){case T.COUNTER:case T.OBSERVABLE_COUNTER:case T.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};var Mi=class e{static DEFAULT_INSTANCE=new lr;createAggregator(t){return e.DEFAULT_INSTANCE}};var vi=class e{static DEFAULT_INSTANCE=new le([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}};var pr=class{_boundaries;_recordMinMax;constructor(t,r=!0){if(t==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");t=t.concat(),t=t.sort((i,s)=>i-s);let n=t.lastIndexOf(-1/0),o=t.indexOf(1/0);o===-1&&(o=void 0),this._boundaries=t.slice(n+1,o),this._recordMinMax=r}createAggregator(t){return new le(this._boundaries,this._recordMinMax)}},mr=class{_maxSize;_recordMinMax;constructor(t=160,r=!0){this._maxSize=t,this._recordMinMax=r}createAggregator(t){return new ur(this._maxSize,this._recordMinMax)}},Di=class{_resolve(t){switch(t.type){case T.COUNTER:case T.UP_DOWN_COUNTER:case T.OBSERVABLE_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:return Bi;case T.GAUGE:case T.OBSERVABLE_GAUGE:return Gi;case T.HISTOGRAM:return t.advice.explicitBucketBoundaries?new pr(t.advice.explicitBucketBoundaries):Hi}return l.warn(`Unable to recognize instrument type: ${t.type}`),Ui}createAggregator(t){return this._resolve(t).createAggregator(t)}},Ui=new Pi,Bi=new Ii,Gi=new Mi,Hi=new vi,CT=new mr,Ma=new Di;var k;(function(e){e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(k||(k={}));function yn(e){switch(e.type){case k.DEFAULT:return Ma;case k.DROP:return Ui;case k.SUM:return Bi;case k.LAST_VALUE:return Gi;case k.EXPONENTIAL_HISTOGRAM:{let t=e;return new mr(t.options?.maxSize,t.options?.recordMinMax)}case k.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Hi:new pr(t.options?.boundaries,t.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var va=e=>({type:k.DEFAULT}),Da=e=>G.CUMULATIVE;var Cn=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;constructor(t){this._aggregationSelector=t?.aggregationSelector??va,this._aggregationTemporalitySelector=t?.aggregationTemporalitySelector??Da,this._metricProducers=t?.metricProducers??[],this._cardinalitySelector=t?.cardinalitySelector}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}selectCardinalityLimit(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3}onInitialized(){}async collect(t){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let[r,...n]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis}),...this._metricProducers.map(a=>a.collect({timeoutMillis:t?.timeoutMillis}))]),o=r.errors.concat(n.flatMap(a=>a.errors)),i=r.resourceMetrics.resource,s=r.resourceMetrics.scopeMetrics.concat(n.flatMap(a=>a.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:i,scopeMetrics:s},errors:o}}async shutdown(t){if(this._shutdown){l.error("Cannot call shutdown twice.");return}t?.timeoutMillis==null?await this.onShutdown():await vt(this.onShutdown(),t.timeoutMillis),this._shutdown=!0}async forceFlush(t){if(this._shutdown){l.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(t?.timeoutMillis==null){await this.onForceFlush();return}await vt(this.onForceFlush(),t.timeoutMillis)}};var _r=class extends Cn{_interval;_exporter;_exportInterval;_exportTimeout;constructor(t){let{exporter:r,exportIntervalMillis:n=6e4,metricProducers:o,cardinalityLimits:i}=t,{exportTimeoutMillis:s=3e4}=t;if(super({aggregationSelector:r.selectAggregation?.bind(r),aggregationTemporalitySelector:r.selectAggregationTemporality?.bind(r),metricProducers:o,cardinalitySelector:a=>{let c={default:2e3,...i};switch(a){case T.COUNTER:return c.counter??c.default;case T.GAUGE:return c.gauge??c.default;case T.HISTOGRAM:return c.histogram??c.default;case T.OBSERVABLE_COUNTER:return c.observableCounter??c.default;case T.OBSERVABLE_UP_DOWN_COUNTER:return c.observableUpDownCounter??c.default;case T.OBSERVABLE_GAUGE:return c.observableGauge??c.default;case T.UP_DOWN_COUNTER:return c.upDownCounter??c.default;default:return c.default}}}),n<=0)throw Error("exportIntervalMillis must be greater than 0");if(s<=0)throw Error("exportTimeoutMillis must be greater than 0");if(n<s){if("exportIntervalMillis"in t&&"exportTimeoutMillis"in t)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");l.info(`Timeout of ${s} exceeds the interval of ${n}. Clamping timeout to interval duration.`),s=n}this._exportInterval=n,this._exportTimeout=s,this._exporter=r}async _runOnce(){try{await vt(this._doRun(),this._exportTimeout)}catch(t){if(t instanceof or){l.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout);return}C(t)}}async _doRun(){let{resourceMetrics:t,errors:r}=await this.collect({timeoutMillis:this._exportTimeout});if(r.length>0&&l.error("PeriodicExportingMetricReader: metrics collection errors",...r),t.resource.asyncAttributesPending)try{await t.resource.waitForAsyncAttributes?.()}catch(o){l.debug("Error while resolving async portion of resource: ",o),C(o)}if(t.scopeMetrics.length===0)return;let n=await Sa._export(this._exporter,t);if(n.code!==U.SUCCESS)throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${n.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};var Pn;function Ua(){if(Pn===void 0)try{let e=globalThis.process.argv0;Pn=e?`unknown_service:${e}`:"unknown_service"}catch{Pn="unknown_service"}return Pn}var de=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";var Vi=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,r){let n=new e({},r);return n._rawAttributes=Ba(t),n._asyncAttributesPending=t.filter(([o,i])=>de(i)).length>0,n}constructor(t,r){let n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([o,i])=>(de(i)&&(this._asyncAttributesPending=!0),[o,i])),this._rawAttributes=Ba(this._rawAttributes),this._schemaUrl=rp(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){let[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,de(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&l.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let t={};for(let[r,n]of this._rawAttributes){if(de(n)){l.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(t[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let r=np(this,t),n=r?{schemaUrl:r}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}};function In(e,t){return Vi.FromAttributeList(Object.entries(e),t)}function Xt(){return In({[ra]:Ua(),[qe]:Mt[qe],[Qe]:Mt[Qe],[Je]:Mt[Je]})}function Ba(e){return e.map(([t,r])=>de(r)?[t,r.catch(n=>{l.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function rp(e){if(typeof e=="string"||e===void 0)return e;l.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function np(e,t){let r=e?.schemaUrl,n=t?.schemaUrl,o=r===void 0||r==="",i=n===void 0||n==="";if(o)return n;if(i||r===n)return r;l.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var Mn=class{_registeredViews=[];addView(t){this._registeredViews.push(t)}findViews(t,r){return this._registeredViews.filter(o=>this._matchInstrument(o.instrumentSelector,t)&&this._matchMeter(o.meterSelector,r))}_matchInstrument(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)}_matchMeter(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))}};function lt(e,t,r){return ip(e)||l.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:r?.description??"",unit:r?.unit??"",valueType:r?.valueType??K.DOUBLE,advice:r?.advice??{}}}function Ga(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Ha(e,t){return La(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var op=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function ip(e){return op.test(e)}var he=class{_writableMetricStorage;_descriptor;constructor(t,r){this._writableMetricStorage=t,this._descriptor=r}_record(t,r={},n=E.active()){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===K.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,P(Date.now()))}},vn=class extends he{add(t,r,n){this._record(t,r,n)}},Dn=class extends he{add(t,r,n){if(t<0){l.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},Un=class extends he{record(t,r,n){this._record(t,r,n)}},Bn=class extends he{record(t,r,n){if(t<0){l.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},fe=class{_metricStorages;_descriptor;_observableRegistry;constructor(t,r,n){this._descriptor=t,this._metricStorages=r,this._observableRegistry=n}addCallback(t){this._observableRegistry.addCallback(t,this)}removeCallback(t){this._observableRegistry.removeCallback(t,this)}},Gn=class extends fe{},Hn=class extends fe{},Vn=class extends fe{};function dr(e){return e instanceof fe}var kn=class{_meterSharedState;constructor(t){this._meterSharedState=t}createGauge(t,r){let n=lt(t,T.GAUGE,r),o=this._meterSharedState.registerMetricStorage(n);return new Un(o,n)}createHistogram(t,r){let n=lt(t,T.HISTOGRAM,r),o=this._meterSharedState.registerMetricStorage(n);return new Bn(o,n)}createCounter(t,r){let n=lt(t,T.COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new Dn(o,n)}createUpDownCounter(t,r){let n=lt(t,T.UP_DOWN_COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new vn(o,n)}createObservableGauge(t,r){let n=lt(t,T.OBSERVABLE_GAUGE,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Hn(n,o,this._meterSharedState.observableRegistry)}createObservableCounter(t,r){let n=lt(t,T.OBSERVABLE_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Gn(n,o,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,r){let n=lt(t,T.OBSERVABLE_UP_DOWN_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Vn(n,o,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)}removeBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)}};var Te=class{_instrumentDescriptor;constructor(t){this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=lt(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};var ki=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(t){this._hash=t}get(t,r){return r??=this._hash(t),this._valueMap.get(r)}getOrDefault(t,r){let n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);let o=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,o),o}set(t,r,n){n??=this._hash(t),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)}has(t,r){return r??=this._hash(t),this._valueMap.has(r)}*keys(){let t=this._keyMap.entries(),r=t.next();for(;r.done!==!0;)yield[r.value[1],r.value[0]],r=t.next()}*entries(){let t=this._valueMap.entries(),r=t.next();for(;r.done!==!0;)yield[this._keyMap.get(r.value[0]),r.value[1],r.value[0]],r=t.next()}get size(){return this._valueMap.size}},q=class extends ki{constructor(){super(xn)}};var ge=class{_activeCollectionStorage=new q;_cumulativeMemoStorage=new q;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(t,r){this._aggregator=t,this._cardinalityLimit=(r??2e3)-1,this._overflowHashCode=xn(this._overflowAttributes)}record(t,r,n,o){let i=this._activeCollectionStorage.get(r);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(o))?.record(t);return}i=this._aggregator.createAccumulation(o),this._activeCollectionStorage.set(r,i)}i?.record(t)}batchCumulate(t,r){Array.from(t.entries()).forEach(([n,o,i])=>{let s=this._aggregator.createAccumulation(r);s?.record(o);let a=s;if(this._cumulativeMemoStorage.has(n,i)){let c=this._cumulativeMemoStorage.get(n,i);a=this._aggregator.diff(c,s)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(n=this._overflowAttributes,i=this._overflowHashCode,this._cumulativeMemoStorage.has(n,i))){let c=this._cumulativeMemoStorage.get(n,i);a=this._aggregator.diff(c,s)}if(this._activeCollectionStorage.has(n,i)){let c=this._activeCollectionStorage.get(n,i);a=this._aggregator.merge(c,a)}this._cumulativeMemoStorage.set(n,s,i),this._activeCollectionStorage.set(n,a,i)})}collect(){let t=this._activeCollectionStorage;return this._activeCollectionStorage=new q,t}};var Ee=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(t,r){this._aggregator=t,r.forEach(n=>{this._unreportedAccumulations.set(n,[])})}buildMetrics(t,r,n,o){this._stashAccumulations(n);let i=this._getMergedUnreportedAccumulations(t),s=i,a;if(this._reportHistory.has(t)){let u=this._reportHistory.get(t),p=u.collectionTime;a=u.aggregationTemporality,a===G.CUMULATIVE?s=e.merge(u.accumulations,i,this._aggregator):s=e.calibrateStartTime(u.accumulations,i,p)}else a=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:o,aggregationTemporality:a});let c=sp(s);if(c.length!==0)return this._aggregator.toMetricData(r,a,c,o)}_stashAccumulations(t){let r=this._unreportedAccumulations.keys();for(let n of r){let o=this._unreportedAccumulations.get(n);o===void 0&&(o=[],this._unreportedAccumulations.set(n,o)),o.push(t)}}_getMergedUnreportedAccumulations(t){let r=new q,n=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),n===void 0)return r;for(let o of n)r=e.merge(r,o,this._aggregator);return r}static merge(t,r,n){let o=t,i=r.entries(),s=i.next();for(;s.done!==!0;){let[a,c,u]=s.value;if(t.has(a,u)){let p=t.get(a,u),_=n.merge(p,c);o.set(a,_,u)}else o.set(a,c,u);s=i.next()}return o}static calibrateStartTime(t,r,n){for(let[o,i]of t.keys())r.get(o,i)?.setStartTime(n);return r}};function sp(e){return Array.from(e.entries())}var Fn=class extends Te{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new ge(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ee(r,o),this._attributesProcessor=n}record(t,r){let n=new q;Array.from(t.entries()).forEach(([o,i])=>{n.set(this._attributesProcessor.process(o),i)}),this._deltaMetricStorage.batchCumulate(n,r)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};function Fi(e,t){let r="";return e.unit!==t.unit&&(r+=` - Unit '${e.unit}' does not match '${t.unit}'
2
2
  `),e.type!==t.type&&(r+=` - Type '${e.type}' does not match '${t.type}'
3
3
  `),e.valueType!==t.valueType&&(r+=` - Value Type '${e.valueType}' does not match '${t.valueType}'
4
4
  `),e.description!==t.description&&(r+=` - Description '${e.description}' does not match '${t.description}'
5
- `),r}function Al(e,t){return` - use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Rl(e,t){return` - use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function xl(e,t){let r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return` - create a new view with a name other than '${e.name}' and InstrumentSelector '${n}'`}function Ol(e,t){let r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return` - create a new view with a name other than '${e.name}' and InstrumentSelector '${n}'
5
+ `),r}function ap(e,t){return` - use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function cp(e,t){return` - use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function up(e,t){let r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return` - create a new view with a name other than '${e.name}' and InstrumentSelector '${n}'`}function lp(e,t){let r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return` - create a new view with a name other than '${e.name}' and InstrumentSelector '${n}'
6
6
  - OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${n}
7
- - OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${n}`}function yi(e,t){return e.valueType!==t.valueType?Al(e,t):e.unit!==t.unit?Rl(e,t):e.type!==t.type?xl(e,t):e.description!==t.description?Ol(e,t):""}var Hn=class e{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new e}getStorages(t){let r=[];for(let o of this._sharedRegistry.values())r=r.concat(o);let n=this._perCollectorRegistry.get(t);if(n!=null)for(let o of n.values())r=r.concat(o);return r}register(t){this._registerStorage(t,this._sharedRegistry)}registerForCollector(t,r){let n=this._perCollectorRegistry.get(t);n==null&&(n=new Map,this._perCollectorRegistry.set(t,n)),this._registerStorage(r,n)}findOrUpdateCompatibleStorage(t){let r=this._sharedRegistry.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}findOrUpdateCompatibleCollectorStorage(t,r){let n=this._perCollectorRegistry.get(t);if(n===void 0)return null;let o=n.get(r.name);return o===void 0?null:this._findOrUpdateCompatibleStorage(r,o)}_registerStorage(t,r){let n=t.getInstrumentDescriptor(),o=r.get(n.name);if(o===void 0){r.set(n.name,[t]);return}o.push(t)}_findOrUpdateCompatibleStorage(t,r){let n=null;for(let o of r){let i=o.getInstrumentDescriptor();La(i,t)?(i.description!==t.description&&(t.description.length>i.description.length&&o.updateDescription(t.description),l.warn("A view or instrument with the name ",t.name,` has already been registered, but has a different description and is incompatible with another registered view.
7
+ - OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${n}`}function $i(e,t){return e.valueType!==t.valueType?ap(e,t):e.unit!==t.unit?cp(e,t):e.type!==t.type?up(e,t):e.description!==t.description?lp(e,t):""}var $n=class e{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new e}getStorages(t){let r=[];for(let o of this._sharedRegistry.values())r=r.concat(o);let n=this._perCollectorRegistry.get(t);if(n!=null)for(let o of n.values())r=r.concat(o);return r}register(t){this._registerStorage(t,this._sharedRegistry)}registerForCollector(t,r){let n=this._perCollectorRegistry.get(t);n==null&&(n=new Map,this._perCollectorRegistry.set(t,n)),this._registerStorage(r,n)}findOrUpdateCompatibleStorage(t){let r=this._sharedRegistry.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}findOrUpdateCompatibleCollectorStorage(t,r){let n=this._perCollectorRegistry.get(t);if(n===void 0)return null;let o=n.get(r.name);return o===void 0?null:this._findOrUpdateCompatibleStorage(r,o)}_registerStorage(t,r){let n=t.getInstrumentDescriptor(),o=r.get(n.name);if(o===void 0){r.set(n.name,[t]);return}o.push(t)}_findOrUpdateCompatibleStorage(t,r){let n=null;for(let o of r){let i=o.getInstrumentDescriptor();Ha(i,t)?(i.description!==t.description&&(t.description.length>i.description.length&&o.updateDescription(t.description),l.warn("A view or instrument with the name ",t.name,` has already been registered, but has a different description and is incompatible with another registered view.
8
8
  `,`Details:
9
- `,Oi(i,t),`The longer description will be used.
10
- To resolve the conflict:`,yi(i,t))),n=o):l.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
9
+ `,Fi(i,t),`The longer description will be used.
10
+ To resolve the conflict:`,$i(i,t))),n=o):l.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
11
11
  `,`Details:
12
- `,Oi(i,t),`To resolve the conflict:
13
- `,yi(i,t))}return n}};var Vn=class{_backingStorages;constructor(t){this._backingStorages=t}record(t,r,n,o){this._backingStorages.forEach(i=>{i.record(t,r,n,o)})}};var kn=class{_buffer=new Q;_instrumentName;_valueType;constructor(t,r){this._instrumentName=t,this._valueType=r}observe(t,r={}){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===Y.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}},Fn=class{_buffer=new Map;observe(t,r,n={}){if(!Tr(t))return;let o=this._buffer.get(t);if(o==null&&(o=new Q,this._buffer.set(t,o)),typeof r!="number"){l.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===Y.INT&&!Number.isInteger(r)&&(l.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||o.set(n,r)}};var zn=class{_callbacks=[];_batchCallbacks=[];addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){let n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)}addBatchCallback(t,r){let n=new Set(r.filter(Tr));if(n.size===0){l.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,n)>=0||this._batchCallbacks.push({callback:t,instruments:n})}removeBatchCallback(t,r){let n=new Set(r.filter(Tr)),o=this._findBatchCallback(t,n);o<0||this._batchCallbacks.splice(o,1)}async observe(t,r){let n=this._observeCallbacks(t,r),o=this._observeBatchCallbacks(t,r);return(await Promise.allSettled([...n,...o])).filter(a=>a.status==="rejected").map(a=>a.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:n,instrument:o})=>{let i=new kn(o._descriptor.name,o._descriptor.valueType),s=Promise.resolve(n(i));r!=null&&(s=It(s,r)),await s,o._metricStorages.forEach(a=>{a.record(i._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let i=new Fn,s=Promise.resolve(n(i));r!=null&&(s=It(s,r)),await s,o.forEach(a=>{let c=i._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(n=>n.callback===t&&n.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(n=>n.callback===t&&da(n.instruments,r))}};var $n=class extends Se{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ae(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Re(r,o),this._attributesProcessor=n}record(t,r,n,o){r=this._attributesProcessor.process(r,n),this._deltaMetricStorage.record(t,r,n,o)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};var bi=class{process(t,r){return t}},wi=class{_processors;constructor(t){this._processors=t}process(t,r){let n=t;for(let o of this._processors)n=o.process(n,r);return n}};function Wn(){return yl}function va(e){return new wi(e)}var yl=new bi;var jn=class{metricStorageRegistry=new Hn;observableRegistry=new zn;meter;_meterProviderSharedState;_instrumentationScope;constructor(t,r){this.meter=new Bn(this),this._meterProviderSharedState=t,this._instrumentationScope=r}registerMetricStorage(t){let r=this._registerMetricStorage(t,$n);return r.length===1?r[0]:new Vn(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,Gn)}async collect(t,r,n){let o=await this.observableRegistry.observe(r,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(t);if(i.length===0)return null;let s=[];return i.forEach(a=>{let c=a.collect(t,r);c!=null&&s.push(c)}),s.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:s},errors:o}}_registerMetricStorage(t,r){let o=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(i=>{let s=Na(i,t),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(s);if(a!=null)return a;let c=i.aggregation.createAggregator(s),u=new r(s,c,i.attributesProcessor,this._meterProviderSharedState.metricCollectors,i.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let s=this._meterProviderSharedState.selectAggregations(t.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,t);if(u!=null)return u;let p=c.createAggregator(t),_=a.selectCardinalityLimit(t.type),d=new r(t,p,Wn(),[a],_);return this.metricStorageRegistry.registerForCollector(a,d),d});o=o.concat(s)}return o}};var Kn=class{viewRegistry=new Ln;metricCollectors=[];meterSharedStates=new Map;resource;constructor(t){this.resource=t}getMeterSharedState(t){let r=ha(t),n=this.meterSharedStates.get(r);return n==null&&(n=new jn(this,t),this.meterSharedStates.set(r,n)),n}selectAggregations(t){let r=[];for(let n of this.metricCollectors)r.push([n,yn(n.selectAggregation(t))]);return r}};var Xn=class{_sharedState;_metricReader;constructor(t,r){this._sharedState=t,this._metricReader=r}async collect(t){let r=I(Date.now()),n=[],o=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async s=>{let a=await s.collect(this,r,t);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}selectCardinalityLimit(t){return this._metricReader.selectCardinalityLimit?.(t)??2e3}};var bl=/[\^$\\.+?()[\]{}|]/g,xe=class e{_matchAll;_regexp;constructor(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(bl,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}},Ut=class{_matchAll;_pattern;constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}};var Yn=class{_nameFilter;_type;_unitFilter;constructor(t){this._nameFilter=new xe(t?.name??"*"),this._type=t?.type,this._unitFilter=new Ut(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};var qn=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(t){this._nameFilter=new Ut(t?.name),this._versionFilter=new Ut(t?.version),this._schemaUrlFilter=new Ut(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};function wl(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function Nl(e){if(wl(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||xe.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}var Qn=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(t){Nl(t),t.attributesProcessors!=null?this.attributesProcessor=va(t.attributesProcessors):this.attributesProcessor=Wn(),this.name=t.name,this.description=t.description,this.aggregation=yn(t.aggregation??{type:$.DEFAULT}),this.instrumentSelector=new Yn({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new qn({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}};var gr=class{_sharedState;_shutdown=!1;constructor(t){if(this._sharedState=new Kn(t?.resource??Yt()),t?.views!=null&&t.views.length>0)for(let r of t.views)this._sharedState.viewRegistry.addView(new Qn(r));if(t?.readers!=null&&t.readers.length>0)for(let r of t.readers){let n=new Xn(this._sharedState,r);r.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(t,r="",n={}){return this._shutdown?(l.warn("A shutdown MeterProvider cannot provide a Meter"),ke()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter}async shutdown(t){if(this._shutdown){l.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){l.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}};var Er;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(Er||(Er={}));function Ll(e,t){let r=ue(e.resource,t);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:vl(e.scopeMetrics,t)}}function vl(e,t){return Array.from(e.map(r=>({scope:pe(r.scope),metrics:r.metrics.map(n=>Pl(n,t)),schemaUrl:r.scope.schemaUrl})))}function Pl(e,t){let r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=Dl(e.aggregationTemporality);switch(e.dataPointType){case F.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:Pa(e,t)};break;case F.GAUGE:r.gauge={dataPoints:Pa(e,t)};break;case F.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:Ml(e,t)};break;case F.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:Il(e,t)};break}return r}function Cl(e,t,r){let n={attributes:yt(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case Y.INT:n.asInt=e.value;break;case Y.DOUBLE:n.asDouble=e.value;break}return n}function Pa(e,t){return e.dataPoints.map(r=>Cl(r,e.descriptor.valueType,t))}function Ml(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:yt(r.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Il(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:yt(r.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Dl(e){switch(e){case k.DELTA:return Er.AGGREGATION_TEMPORALITY_DELTA;case k.CUMULATIVE:return Er.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Ca(e,t){return{resourceMetrics:e.map(r=>Ll(r,t))}}var Ul=256,Bl=512;function Ma(e,t){let r=e&255|Ul;return t&&(r|=Bl),r}function Gl(e,t){let r=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:o,traceState:r.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:yt(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(i=>Vl(i,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(i=>Hl(i,t)),droppedLinksCount:e.droppedLinksCount,flags:Ma(r.traceFlags,e.parentSpanContext?.isRemote)}}function Hl(e,t){return{attributes:e.attributes?yt(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Ma(e.context.traceFlags,e.context.isRemote)}}function Vl(e,t){return{attributes:e.attributes?yt(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ia(e,t){return{resourceSpans:Fl(e,t)}}function kl(e){let t=new Map;for(let r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));let o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,i=n.get(o);i||(i=[],n.set(o,i)),i.push(r)}return t}function Fl(e,t){let r=kl(e),n=[],o=r.entries(),i=o.next();for(;!i.done;){let[s,a]=i.value,c=[],u=a.values(),p=u.next();for(;!p.done;){let m=p.value;if(m.length>0){let h=m.map(S=>Gl(S,t));c.push({scope:pe(m[0].instrumentationScope),spans:h,schemaUrl:m[0].instrumentationScope.schemaUrl})}p=u.next()}let _=ue(s,t),d={resource:_,scopeSpans:c,schemaUrl:_.schemaUrl};n.push(d),i=o.next()}return n}var Jn={serializeRequest:e=>{let t=ma(e,le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var Zn={serializeRequest:e=>{let t=Ca([e],le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var to={serializeRequest:e=>{let t=Ia(e,le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var Ni=5,zl=1e3,$l=5e3,Wl=1.5,Da=.2;function jl(){return Math.random()*(2*Da)-Da}var Li=class{_transport;constructor(t){this._transport=t}retry(t,r,n){return new Promise((o,i)=>{setTimeout(()=>{this._transport.send(t,r).then(o,i)},n)})}async send(t,r){let n=Ni,o=zl,i=Date.now()+r,s=await this._transport.send(t,r);for(;s.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(o*(1+jl()),$l),0);o=o*Wl;let c=s.retryInMillis??a,u=i-Date.now();if(c>u)return l.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(u)}ms, not retrying further.`),s;l.verbose(`Scheduling export retry in ${Math.round(c)}ms`),s=await this.retry(t,u,c)}return s.status==="success"?l.verbose(`Export succeeded after ${Ni-n} retry attempts.`):s.status==="retryable"?l.info(`Export failed after maximum retry attempts (${Ni}).`):l.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}};function Ua(e){return new Li(e.transport)}function Ba(e){return e===429||e===502||e===503||e===504}function Ga(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let r=new Date(e).getTime()-Date.now();return r>=0?r:0}var Kl=60*1024,Xl=9,vi=0,eo=0,Pi=class{_parameters;constructor(t){this._parameters=t}async send(t,r){let n=new AbortController,o=setTimeout(()=>n.abort(),r),i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);let s=t.byteLength,a=vi+s>Kl,c=eo>=Xl,u=!a&&!c;if(u)vi+=s,eo++;else{let p=a?"size limit":"count limit";l.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${eo} pending (${p})`)}try{let p=new URL(this._parameters.url),_=await i(p.href,{method:"POST",headers:await this._parameters.headers(),body:t,signal:n.signal,keepalive:u,mode:globalThis.location?globalThis.location.origin===p.origin?"same-origin":"cors":"no-cors"});if(_.status>=200&&_.status<=299)return l.debug(`export response success (status: ${_.status})`),{status:"success"};if(Ba(_.status)){l.warn(`export response retryable (status: ${_.status})`);let d=_.headers.get("Retry-After");return{status:"retryable",retryInMillis:Ga(d)}}return l.error(`export response failure (status: ${_.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${_.status}`)}}catch(p){return Yl(p)?(l.warn(`export request retryable (network error: ${p})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:p})}):(l.error(`export request failure (error: ${p})`),{status:"failure",error:new Error("Fetch request errored",{cause:p})})}finally{clearTimeout(o),u&&(vi-=s,eo--)}}shutdown(){}};function Ha(e){return new Pi(e)}function Yl(e){return e instanceof TypeError&&!e.cause}function Va(e,t){return la(e,t,Ua({transport:Ha(e)}))}function ka(e){let t={};return Object.entries(e??{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):l.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}function ql(e,t,r){return async()=>{let n={...await r()},o={};return t!=null&&Object.assign(o,await t()),e!=null&&Object.assign(o,ka(await e())),Object.assign(o,n)}}function Ql(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Fa(e,t,r){return{...Ds(e,t,r),headers:ql(e.headers,t.headers,r.headers),url:Ql(e.url)??t.url??r.url}}function za(e,t){return{...Us(),headers:async()=>e,url:"http://localhost:4318/"+t}}function $a(e){return typeof e.headers=="function"?e.headers:Is(e.headers)}function Wa(e,t,r){return Fa({url:e.url,timeoutMillis:e.timeoutMillis,headers:$a(e),concurrencyLimit:e.concurrencyLimit},{},za(r,t))}function qt(e,t,r,n){let o=Wa(e,r,n);return Va(o,t)}var Oe=class extends xt{constructor(t={}){super(qt(t,Jn,"v1/logs",{"Content-Type":"application/json"}))}};var Sr;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(Sr||(Sr={}));var Ci=()=>k.CUMULATIVE,ja=e=>{switch(e){case g.COUNTER:case g.OBSERVABLE_COUNTER:case g.GAUGE:case g.HISTOGRAM:case g.OBSERVABLE_GAUGE:return k.DELTA;case g.UP_DOWN_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:return k.CUMULATIVE}},Ka=e=>{switch(e){case g.COUNTER:case g.HISTOGRAM:return k.DELTA;case g.GAUGE:case g.UP_DOWN_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:case g.OBSERVABLE_COUNTER:case g.OBSERVABLE_GAUGE:return k.CUMULATIVE}};function Jl(){let e=(void 0??"cumulative").toLowerCase();return e==="cumulative"?Ci:e==="delta"?ja:e==="lowmemory"?Ka:(l.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Ci)}function Zl(e){return e!=null?e===Sr.DELTA?ja:e===Sr.LOWMEMORY?Ka:Ci:Jl()}var tm=Object.freeze({type:$.DEFAULT});function em(e){return e?.aggregationPreference??(()=>tm)}var ro=class extends xt{_aggregationTemporalitySelector;_aggregationSelector;constructor(t,r){super(t),this._aggregationSelector=em(r),this._aggregationTemporalitySelector=Zl(r?.temporalityPreference)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}};var ye=class extends ro{constructor(t){super(qt(t??{},Zn,"v1/metrics",{"Content-Type":"application/json"}),t)}};var be=class extends xt{constructor(t={}){super(qt(t,to,"v1/traces",{"Content-Type":"application/json"}))}};function Xa(e){return Mi(e,new WeakSet)}function Mi(e,t){if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Uint8Array)return!0;if(typeof e=="object"){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(n=>Mi(n,t));let r=e;return r.constructor!==Object&&r.constructor!==void 0?!1:Object.values(r).every(n=>Mi(n,t))}return!1}var no=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(t){this._isLogRecordReadonly()||(this._severityText=t)}get severityText(){return this._severityText}set severityNumber(t){this._isLogRecordReadonly()||(this._severityNumber=t)}get severityNumber(){return this._severityNumber}set body(t){this._isLogRecordReadonly()||(this._body=t)}get body(){return this._body}get eventName(){return this._eventName}set eventName(t){this._isLogRecordReadonly()||(this._eventName=t)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(t,r,n){let{timestamp:o,observedTimestamp:i,eventName:s,severityNumber:a,severityText:c,body:u,attributes:p={},exception:_,context:d}=n,m=Date.now();if(this.hrTime=ut(o??m),this.hrTimeObserved=ut(i??m),d){let h=R.getSpanContext(d);h&&q(h)&&(this.spanContext=h)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this._eventName=s,this.setAttributes(p),_!=null&&this._setException(_)}setAttribute(t,r){return this._isLogRecordReadonly()?this:t.length===0?(l.warn(`Invalid attribute key: ${t}`),this):Xa(r)?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this.droppedAttributesCount===1&&l.warn("Dropping extra attributes."),this):(this.attributes[t]=this._truncateToSize(r),this)):(l.warn(`Invalid attribute value set for key: ${t}`),this)}setAttributes(t){for(let[r,n]of Object.entries(t))this.setAttribute(r,n);return this}setBody(t){return this.body=t,this}setEventName(t){return this.eventName=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(t){let r=this._logRecordLimits.attributeValueLengthLimit;if(r<=0)return l.warn(`Attribute value limit must be positive, got ${r}`),t;if(t==null)return t;if(typeof t=="string")return this._truncateToLimitUtil(t,r);if(t instanceof Uint8Array)return t;if(Array.isArray(t))return t.map(n=>this._truncateToSize(n));if(typeof t=="object"){let n={};for(let[o,i]of Object.entries(t))n[o]=this._truncateToSize(i);return n}return t}_setException(t){let r=!1;if(typeof t=="string"||typeof t=="number")Object.hasOwn(this.attributes,Z)||this.setAttribute(Z,String(t)),r=!0;else if(t&&typeof t=="object"){let n=t;n.code?(Object.hasOwn(this.attributes,nt)||this.setAttribute(nt,n.code.toString()),r=!0):n.name&&(Object.hasOwn(this.attributes,nt)||this.setAttribute(nt,n.name),r=!0),n.message&&(Object.hasOwn(this.attributes,Z)||this.setAttribute(Z,n.message),r=!0),n.stack&&(Object.hasOwn(this.attributes,Kt)||this.setAttribute(Kt,n.stack),r=!0)}r||l.warn(`Failed to record an exception ${t}`)}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&l.warn("Can not execute the operation on emitted log record"),this._isReadonly}};var oo=class{instrumentationScope;_sharedState;_loggerConfig;constructor(t,r){this.instrumentationScope=t,this._sharedState=r,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(t){let r=this._loggerConfig,n=t.context||E.active(),o=t.severityNumber??J.UNSPECIFIED;if(o!==J.UNSPECIFIED&&o<r.minimumSeverity)return;if(r.traceBased){let s=R.getSpanContext(n);if(s&&q(s)&&!((s.traceFlags&M.SAMPLED)===M.SAMPLED))return}let i=new no(this._sharedState,this.instrumentationScope,{context:n,...t});this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}};var io=class{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}};var so=class{processors;forceFlushTimeoutMillis;constructor(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>or(r.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(n=>n.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(t=>t.shutdown()))}};function Ya(e){return`${e.name}@${e.version||""}:${e.schemaUrl||""}`}var rm={disabled:!1,minimumSeverity:J.UNSPECIFIED,traceBased:!1},Ii=()=>({...rm}),ao=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;_loggerConfigurator;_loggerConfigs=new Map;constructor(t,r,n,o,i){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new so(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new io,this._loggerConfigurator=i??Ii}getLoggerConfig(t){let r=Ya(t),n=this._loggerConfigs.get(r);return n||(n=this._loggerConfigurator(t),this._loggerConfigs.set(r,n),n)}};var nm="unknown",Ar=class{_shutdownOnce;_sharedState;constructor(t={}){let r={resource:t.resource??Yt(),forceFlushTimeoutMillis:t.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:t.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:t.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:t.loggerConfigurator??Ii,processors:t.processors??[]};this._sharedState=new ao(r.resource,r.forceFlushTimeoutMillis,r.logRecordLimits,r.processors,r.loggerConfigurator),this._shutdownOnce=new Ot(this._shutdown,this)}getLogger(t,r,n){if(this._shutdownOnce.isCalled)return l.warn("A shutdown LoggerProvider cannot provide a Logger"),$e;t||l.warn("Logger requested without instrumentation scope name.");let o=t||nm,i=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new oo({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(l.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(l.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};var co=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(t,r){this._exporter=t,this._maxExportBatchSize=r?.maxExportBatchSize??512,this._maxQueueSize=r?.maxQueueSize??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??3e4,this._shutdownOnce=new Ot(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(t){this._shutdownOnce.isCalled||this._addToBuffer(t)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())}_flushAll(){return new Promise((t,r)=>{let n=[],o=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let i=0;i<o;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():or(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis)}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,P(r)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(t){let r=()=>gn._export(this._exporter,t).then(o=>{o.code!==G.SUCCESS&&P(o.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${o})`))}).catch(P),n=[];for(let o=0;o<t.length;o++){let i=t[o].resource;i.asyncAttributesPending&&typeof i.waitForAsyncAttributes=="function"&&n.push(i.waitForAsyncAttributes())}return n.length===0?r():Promise.all(n).then(r,P)}};var we=class extends co{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this._onInit(r)}onShutdown(){typeof document>"u"||(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}_onInit(t){t?.disableAutoFlushOnDocumentHide===!0||typeof document>"u"||(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}};var qa="exception";var uo=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:ct.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let r=Date.now();this._spanContext=t.spanContext,this._performanceStartTime=C.now(),this._performanceOffset=r-(this._performanceStartTime+C.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,this.links=t.links||[],this.startTime=this._getTime(t.startTime??r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return l.warn(`Invalid attribute key: ${t}`),this;if(!en(r))return l.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:n}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&o?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),o&&this._attributesCount++,this)}setAttributes(t){for(let[r,n]of Object.entries(t))this.setAttribute(r,n);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return l.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&l.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),un(r)&&(un(n)||(n=r),r=void 0);let i=jt(r);return this.events.push({name:t,attributes:i,time:this._getTime(n),droppedAttributesCount:0}),this}addLink(t){return this.links.push(t),this}addLinks(t){return this.links.push(...t),this}setStatus(t){return this._isSpanEnded()?this:(this.status={...t},this.status.message!=null&&typeof t.message!="string"&&(l.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`),delete this.status.message),this)}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){l.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=ei(this.startTime,this.endTime),this._duration[0]<0&&(l.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&&l.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=C.now())return D(t+this._performanceOffset);if(typeof t=="number")return I(t);if(t instanceof Date)return I(t.getTime());if(tr(t))return t;if(this._startTimeProvided)return I(Date.now());let r=C.now()-this._performanceStartTime;return pn(this.startTime,I(r))}isRecording(){return this._ended===!1}recordException(t,r){let n={};typeof t=="string"?n[Z]=t:t&&(t.code?n[nt]=t.code.toString():t.name&&(n[nt]=t.name),t.message&&(n[Z]=t.message),t.stack&&(n[Kt]=t.stack)),n[nt]||n[Z]?this.addEvent(qa,n,r):l.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);l.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_truncateToSize(t){let r=this._attributeValueLengthLimit;return r<=0?(l.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):t}};var K;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(K||(K={}));var Bt=class{shouldSample(){return{decision:K.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};var mt=class{shouldSample(){return{decision:K.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};var Qt=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(P(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new mt),this._remoteParentSampled=t.remoteParentSampled??new mt,this._remoteParentNotSampled=t.remoteParentNotSampled??new Bt,this._localParentSampled=t.localParentSampled??new mt,this._localParentNotSampled=t.localParentNotSampled??new Bt}shouldSample(t,r,n,o,i,s){let a=R.getSpanContext(t);return!a||!q(a)?this._root.shouldSample(t,r,n,o,i,s):a.isRemote?a.traceFlags&M.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,o,i,s):this._remoteParentNotSampled.shouldSample(t,r,n,o,i,s):a.traceFlags&M.SAMPLED?this._localParentSampled.shouldSample(t,r,n,o,i,s):this._localParentNotSampled.shouldSample(t,r,n,o,i,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};var Gt=class{_ratio;_upperBound;constructor(t=0){this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:Yr(r)&&this._accumulate(r)<this._upperBound?K.RECORD_AND_SAMPLED:K.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<t.length/8;n++){let o=n*8,i=parseInt(t.slice(o,o+8),16);r=(r^i)>>>0}return r}};var _t;(function(e){e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(_t||(_t={}));var po=1;function lo(){return{sampler:Di(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128},spanLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128,linkCountLimit:void 0??128,eventCountLimit:void 0??128,attributePerEventCountLimit:void 0??128,attributePerLinkCountLimit:void 0??128}}}function Di(){let e=void 0??_t.ParentBasedAlwaysOn;switch(e){case _t.AlwaysOn:return new mt;case _t.AlwaysOff:return new Bt;case _t.ParentBasedAlwaysOn:return new Qt({root:new mt});case _t.ParentBasedAlwaysOff:return new Qt({root:new Bt});case _t.TraceIdRatio:return new Gt(Qa());case _t.ParentBasedTraceIdRatio:return new Qt({root:new Gt(Qa())});default:return l.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${_t.ParentBasedAlwaysOn}".`),new Qt({root:new mt})}}function Qa(){let e=void 0;return e==null?(l.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${po}.`),po):e<0||e>1?(l.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${po}.`),po):e}var om=128,im=1/0;function Ja(e){let t={sampler:Di()},r=lo(),n=Object.assign({},r,t,e);return n.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),n}function Za(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??om,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??im,Object.assign({},e,{spanLimits:t})}var mo=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,r){this._exporter=t,this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:void 0??512,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:void 0??2048,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:void 0??5e3,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:void 0??3e4,this._shutdownOnce=new Ot(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&M.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&l.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(l.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{let n=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,s=o;i<s;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{let n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);E.with(Xe(E.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(o,a=>{clearTimeout(n),a.code===G.SUCCESS?t():r(a.error??new Error("BatchSpanProcessor: span export failed"))}),s=null;for(let a=0,c=o.length;a<c;a++){let u=o[a];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(s??=[],s.push(u.resource.waitForAsyncAttributes()))}s===null?i():Promise.all(s).then(i,a=>{P(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,P(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};var Ne=class extends mo{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this.onInit(r)}onInit(t){t?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(r=>{P(r)})},this._pageHideListener=()=>{this.forceFlush().catch(r=>{P(r)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}};var tc=new Uint8Array(16),ec=new Uint8Array(8),sm=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function rc(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function nc(e){let t="";for(let r=0;r<e.length;r++)t+=sm[e[r]];return t}var Le=class{generateTraceId(){return rc(tc),nc(tc)}generateSpanId(){return rc(ec),nc(ec)}};var oc="otel.span.parent.origin",Ui="otel.span.sampling_result",ic="otel.sdk.span.live",sc="otel.sdk.span.started";var _o=class{startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(sc,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(ic,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){let n=cm(r);if(this.startedSpans.add(1,{[oc]:am(t),[Ui]:n}),r===K.NOT_RECORD)return()=>{};let o={[Ui]:n};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};function am(e){return e?e.isRemote?"remote":"local":"none"}function cm(e){switch(e){case K.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case K.RECORD:return"RECORD_ONLY";case K.NOT_RECORD:return"DROP"}}var ac="2.6.0";var ho=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,r,n,o){let i=Ja(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new Le,this._resource=n,this._spanProcessor=o,this.instrumentationScope=t;let s=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",ac):ke();this._tracerMetrics=new _o(s)}startSpan(t,r={},n=E.active()){r.root&&(n=R.deleteSpan(n));let o=R.getSpan(n);if(Wt(n))return l.debug("Instrumentation suppressed, returning Noop Span"),R.wrapSpanContext(Fe);let i=o?.spanContext(),s=this._idGenerator.generateSpanId(),a,c,u;!i||!R.isSpanContextValid(i)?c=this._idGenerator.generateTraceId():(c=i.traceId,u=i.traceState,a=i);let p=r.kind??At.INTERNAL,_=(r.links??[]).map(x=>({context:x.context,attributes:jt(x.attributes)})),d=jt(r.attributes),m=this._sampler.shouldSample(n,c,t,p,d,_),h=this._tracerMetrics.startSpan(i,m.decision);u=m.traceState??u;let S=m.decision===oe.RECORD_AND_SAMPLED?M.SAMPLED:M.NONE,A={traceId:c,spanId:s,traceFlags:S,traceState:u};if(m.decision===oe.NOT_RECORD)return l.debug("Recording is off, propagating context in a non-recording span"),R.wrapSpanContext(A);let f=jt(Object.assign(d,m.attributes));return new uo({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:A,name:t,kind:p,links:_,parentSpanContext:a,attributes:f,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??E.active(),u=this.startSpan(t,i,c),p=R.setSpan(c,u);return E.with(p,a,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};var fo=class{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(n=>{P(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(let n of this._spanProcessors)n.onStart(t,r)}onEnding(t){for(let r of this._spanProcessors)r.onEnding&&r.onEnding(t)}onEnd(t){for(let r of this._spanProcessors)r.onEnd(t)}shutdown(){let t=[];for(let r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,n)=>{Promise.all(t).then(()=>{r()},n)})}};var Jt;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Jt||(Jt={}));var Rr=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){let r=ii({},lo(),Za(t));this._resource=r.resource??Yt(),this._config=Object.assign({},r,{resource:this._resource});let n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new fo(n)}getTracer(t,r,n){let o=`${t}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new ho({name:t,version:r,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let t=this._config.forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(o=>{let i,s=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${t} ms`)),i=Jt.timeout},t);n.forceFlush().then(()=>{clearTimeout(s),i!==Jt.timeout&&(i=Jt.resolved,o(i))}).catch(a=>{clearTimeout(s),i=Jt.error,o(a)})}));return new Promise((n,o)=>{Promise.all(r).then(i=>{let s=i.filter(a=>a!==Jt.resolved);s.length>0?o(s):n()}).catch(i=>o([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};var To=class{_enabled=!1;_currentContext=V;_bindFunction(t=V,r){let n=this,o=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),o}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=V,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=V,this)}with(t,r,n,...o){let i=this._currentContext;this._currentContext=t||V;try{return r.call(n,...o)}finally{this._currentContext=i}}};function um(e){if(e!==null){if(e===void 0){let t=new To;t.enable(),E.setGlobalContextManager(t);return}e.enable(),E.setGlobalContextManager(e)}}function pm(e){if(e!==null){if(e===void 0){B.setGlobalPropagator(new er({propagators:[new rr,new Ye]}));return}B.setGlobalPropagator(e)}}var xr=class extends Rr{constructor(t={}){super(t)}register(t={}){R.setGlobalTracerProvider(this),pm(t.propagator),um(t.contextManager)}};var T;(function(e){e.CONNECT_END="connectEnd",e.CONNECT_START="connectStart",e.DECODED_BODY_SIZE="decodedBodySize",e.DOM_COMPLETE="domComplete",e.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",e.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",e.DOM_INTERACTIVE="domInteractive",e.DOMAIN_LOOKUP_END="domainLookupEnd",e.DOMAIN_LOOKUP_START="domainLookupStart",e.ENCODED_BODY_SIZE="encodedBodySize",e.FETCH_START="fetchStart",e.LOAD_EVENT_END="loadEventEnd",e.LOAD_EVENT_START="loadEventStart",e.NAVIGATION_START="navigationStart",e.REDIRECT_END="redirectEnd",e.REDIRECT_START="redirectStart",e.REQUEST_START="requestStart",e.RESPONSE_END="responseEnd",e.RESPONSE_START="responseStart",e.SECURE_CONNECTION_START="secureConnectionStart",e.START_TIME="startTime",e.UNLOAD_EVENT_END="unloadEventEnd",e.UNLOAD_EVENT_START="unloadEventStart"})(T||(T={}));var cc="http.response_content_length",uc="http.response_content_length_uncompressed";var Bi;function lm(){return Bi||(Bi=document.createElement("a")),Bi}function bt(e,t){return t in e}function v(e,t,r,n=!0){if(bt(r,t)&&typeof r[t]=="number"&&!(n&&r[t]===0))return e.addEvent(t,r[t])}function ht(e,t,r=!1,n,o){if(n===void 0&&(n=t[T.START_TIME]!==0),r||(v(e,T.FETCH_START,t,n),v(e,T.DOMAIN_LOOKUP_START,t,n),v(e,T.DOMAIN_LOOKUP_END,t,n),v(e,T.CONNECT_START,t,n),v(e,T.SECURE_CONNECTION_START,t,n),v(e,T.CONNECT_END,t,n),v(e,T.REQUEST_START,t,n),v(e,T.RESPONSE_START,t,n),v(e,T.RESPONSE_END,t,n)),!o){let i=t[T.ENCODED_BODY_SIZE];i!==void 0&&e.setAttribute(cc,i);let s=t[T.DECODED_BODY_SIZE];s!==void 0&&i!==s&&e.setAttribute(uc,s)}}function pc(e){return e.slice().sort((t,r)=>{let n=t[T.FETCH_START],o=r[T.FETCH_START];return n>o?1:n<o?-1:0})}function lc(){return typeof location<"u"?location.origin:void 0}function Or(e,t,r,n,o=new WeakSet,i){let s=rt(e);e=s.toString();let a=_m(e,t,r,n,o,i);if(a.length===0)return{mainRequest:void 0};if(a.length===1)return{mainRequest:a[0]};let c=pc(a);if(s.origin!==lc()&&c.length>1){let u=c[0],p=mm(c,u[T.RESPONSE_END],r),_=u[T.RESPONSE_END];return p[T.FETCH_START]<_&&(p=u,u=void 0),{corsPreFlightRequest:u,mainRequest:p}}else return{mainRequest:a[0]}}function mm(e,t,r){let n=tt(r),o=tt(ut(t)),i=e[1],s,a=e.length;for(let c=1;c<a;c++){let u=e[c],p=tt(ut(u[T.FETCH_START])),_=tt(ut(u[T.RESPONSE_END])),d=n-_;p>=o&&(!s||d<s)&&(s=d,i=u)}return i}function _m(e,t,r,n,o,i){let s=tt(t),a=tt(r),c=n.filter(u=>{let p=tt(ut(u[T.FETCH_START])),_=tt(ut(u[T.RESPONSE_END]));return u.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&u.name===e&&p>=s&&_<=a});return c.length>0&&(c=c.filter(u=>!o.has(u))),c}function rt(e){if(typeof URL=="function")return new URL(e,typeof document<"u"?document.baseURI:typeof location<"u"?location.href:void 0);let t=lm();return t.href=e,t}function go(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return"/";let r=dm(e,t);if(t&&r.indexOf("@id")>0)return r;let n="";return e.parentNode&&(n+=go(e.parentNode,t)),n+=r,n}function hm(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let r=Array.from(e.parentNode.childNodes);return r=r.filter(n=>{let o=n.localName;return t.indexOf(n.nodeType)>=0&&o===e.localName}),r.length>=1?r.indexOf(e)+1:0}function dm(e,t){let r=e.nodeType,n=hm(e),o="";if(r===Node.ELEMENT_NODE){let i=e.getAttribute("id");if(t&&i)return`//*[@id="${i}"]`;o=e.localName}else if(r===Node.TEXT_NODE||r===Node.CDATA_SECTION_NODE)o="text()";else if(r===Node.COMMENT_NODE)o="comment()";else return"";return o&&n>1?`/${o}[${n}]`:`/${o}`}function yr(e,t){let r=t||[];return(typeof r=="string"||r instanceof RegExp)&&(r=[r]),rt(e).origin===lc()?!0:r.some(o=>fn(e,o))}function mc(e,t,r,n){for(let o=0,i=e.length;o<i;o++){let s=e[o];t&&s.setTracerProvider(t),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function _c(e){e.forEach(t=>t.disable())}function Gi(e){let t=e.tracerProvider||R.getTracerProvider(),r=e.meterProvider||$t.getMeterProvider(),n=e.loggerProvider||Pt.getLoggerProvider(),o=e.instrumentations?.flat()??[];return mc(o,t,r,n),()=>{_c(o)}}var W=console.error.bind(console);function br(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var Eo=(e,t,r)=>{if(!e||!e[t]){W("no original function "+String(t)+" to wrap");return}if(!r){W("no wrapper function"),W(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){W("original object and wrapper must be functions");return}let o=r(n,t);return br(o,"__original",n),br(o,"__unwrap",()=>{e[t]===o&&br(e,t,n)}),br(o,"__wrapped",!0),br(e,t,o),o},Hi=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{W("must provide one or more modules to patch"),W(new Error().stack);return}if(!(t&&Array.isArray(t))){W("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(o=>{Eo(n,o,r)})})},So=(e,t)=>{if(!e||!e[t]){W("no function to unwrap."),W(new Error().stack);return}let r=e[t];if(!r.__unwrap)W("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},Vi=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{W("must provide one or more modules to patch"),W(new Error().stack);return}if(!(t&&Array.isArray(t))){W("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{So(r,n)})})};function wr(e){e&&e.logger&&(typeof e.logger!="function"?W("new logger isn't a function, not replacing"):W=e.logger)}wr.wrap=Eo;wr.massWrap=Hi;wr.unwrap=So;wr.massUnwrap=Vi;var Ao=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,r,n){this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=l.createComponentLogger({namespace:t}),this._tracer=R.getTracer(t,r),this._meter=$t.getMeter(t,r),this._logger=Pt.getLogger(t,r),this._updateMetricInstruments()}_wrap=Eo;_unwrap=So;_massWrap=Hi;_massUnwrap=Vi;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,o){if(t)try{t(n,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}};var U=class extends Ao{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}};function ot(e,t,r){let n,o;try{o=e()}catch(i){n=i}finally{if(t(n,o),n&&!r)throw n;return o}}function N(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var b;(function(e){e[e.STABLE=1]="STABLE",e[e.OLD=2]="OLD",e[e.DUPLICATE=3]="DUPLICATE"})(b||(b={}));function Zt(e,t){let r=b.OLD,n=t?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of n??[])if(o.toLowerCase()===e+"/dup"){r=b.DUPLICATE;break}else o.toLowerCase()===e&&(r=b.STABLE);return r}var te;(function(e){e.DOCUMENT_LOAD="documentLoad",e.DOCUMENT_FETCH="documentFetch",e.RESOURCE_FETCH="resourceFetch"})(te||(te={}));var hc="0.58.0",dc="@opentelemetry/instrumentation-document-load";var Ro="http.url",fc="http.user_agent";var Nr;(function(e){e.FIRST_PAINT="firstPaint",e.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"})(Nr||(Nr={}));var gc=()=>{let e={},t=C.getEntriesByType?.("navigation")[0];if(t)Object.values(T).forEach(n=>{if(bt(t,n)){let o=t[n];typeof o=="number"&&(e[n]=o)}});else{let n=C.timing;n&&Object.values(T).forEach(i=>{if(bt(n,i)){let s=n[i];typeof s=="number"&&(e[i]=s)}})}return e},Tc={"first-paint":Nr.FIRST_PAINT,"first-contentful-paint":Nr.FIRST_CONTENTFUL_PAINT},Ec=e=>{let t=C.getEntriesByType?.("paint");t&&t.forEach(({name:r,startTime:n})=>{bt(Tc,r)&&e.addEvent(Tc[r],n)})};var Lr=class extends U{component="document-load";version="1";moduleName=this.component;_semconvStability;constructor(t={}){super(dc,hc,t),this._semconvStability=Zt("http",t?.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(t){let r=C.getEntriesByType?.("resource");r&&r.forEach(n=>{this._initResourceSpan(n,t)})}_collectPerformance(){let t=Array.from(document.getElementsByTagName("meta")).find(o=>o.getAttribute("name")===ce),r=gc(),n=t&&t.content||"";E.with(B.extract(V,{traceparent:n}),()=>{let o=this._startSpan(te.DOCUMENT_LOAD,T.FETCH_START,r);o&&(E.with(R.setSpan(E.active(),o),()=>{let i=this._startSpan(te.DOCUMENT_FETCH,T.FETCH_START,r);i&&(this._semconvStability&b.OLD&&i.setAttribute(Ro,location.href),this._semconvStability&b.STABLE&&i.setAttribute(Ct,location.href),E.with(R.setSpan(E.active(),i),()=>{let s=!(this._semconvStability&b.OLD);ht(i,r,this.getConfig().ignoreNetworkEvents,void 0,s),this._addCustomAttributesOnSpan(i,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(i,T.RESPONSE_END,r)}))}),this._semconvStability&b.OLD&&(o.setAttribute(Ro,location.href),o.setAttribute(fc,navigator.userAgent)),this._semconvStability&b.STABLE&&(o.setAttribute(Ct,location.href),o.setAttribute(Ks,navigator.userAgent)),this._addResourcesSpans(o),this.getConfig().ignoreNetworkEvents||(v(o,T.FETCH_START,r),v(o,T.UNLOAD_EVENT_START,r),v(o,T.UNLOAD_EVENT_END,r),v(o,T.DOM_INTERACTIVE,r),v(o,T.DOM_CONTENT_LOADED_EVENT_START,r),v(o,T.DOM_CONTENT_LOADED_EVENT_END,r),v(o,T.DOM_COMPLETE,r),v(o,T.LOAD_EVENT_START,r),v(o,T.LOAD_EVENT_END,r)),this.getConfig().ignorePerformancePaintEvents||Ec(o),this._addCustomAttributesOnSpan(o,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(o,T.LOAD_EVENT_END,r))})}_endSpan(t,r,n){t&&(bt(n,r)?t.end(n[r]):t.end())}_initResourceSpan(t,r){let n=this._startSpan(te.RESOURCE_FETCH,T.FETCH_START,t,r);if(n){this._semconvStability&b.OLD&&n.setAttribute(Ro,t.name),this._semconvStability&b.STABLE&&n.setAttribute(Ct,t.name);let o=!(this._semconvStability&b.OLD);ht(n,t,this.getConfig().ignoreNetworkEvents,void 0,o),this._addCustomAttributesOnResourceSpan(n,t,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,T.RESPONSE_END,t)}}_startSpan(t,r,n,o){if(bt(n,r)&&typeof n[r]=="number")return this.tracer.startSpan(t,{startTime:n[r]},o?R.setSpan(E.active(),o):void 0)}_waitForPageLoad(){window.document.readyState==="complete"?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(t,r){r&&ot(()=>r(t),n=>{n&&this._diag.error("addCustomAttributesOnSpan",n)},!0)}_addCustomAttributesOnResourceSpan(t,r,n){n&&ot(()=>n(t,r),o=>{o&&this._diag.error("addCustomAttributesOnResourceSpan",o)},!0)}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}};var vr;(function(e){e.COMPONENT="component",e.HTTP_STATUS_TEXT="http.status_text"})(vr||(vr={}));var Sc="http.host",Ac="http.method",Rc="http.request.body.size",xc="http.request_content_length_uncompressed";var Oc="http.scheme",yc="http.status_code",bc="http.url",wc="http.user_agent";var Nc=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Lc(...e){if(e[0]instanceof URL||typeof e[0]=="string"){let t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){let{body:r,length:n}=gm(t.body);return t.body=r,n}else return Promise.resolve(Sm(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(r=>ki(r)):Promise.resolve()}}function gm(e){if(!e.pipeThrough)return Nc.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t=0,r,n=new Promise(i=>{r=i}),o=new TransformStream({start(){},async transform(i,s){let a=await i;t+=a.byteLength,s.enqueue(i)},flush(){r(t)}});return{body:e.pipeThrough(o),length:n}}function Em(e){return typeof Document<"u"&&e instanceof Document}function Sm(e){if(Em(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return ki(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Rm(e);if(e instanceof URLSearchParams)return ki(e.toString());if(e.byteLength!==void 0)return e.byteLength;Nc.warn("unknown body type")}var Am=new TextEncoder;function ki(e){return Am.encode(e).byteLength}function Rm(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function vc(e){let t=Om(),r=e.toUpperCase();return r in t?r:"_OTHER"}var xm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Pr;function Om(){if(Pr===void 0){let e=void 0;e&&e.length>0?(Pr={},e.forEach(t=>{Pr[t]=!0})):Pr=xm}return Pr}var ym={"https:":"443","http:":"80"};function Pc(e){let t=Number(e.port||ym[e.protocol]);if(t&&!isNaN(t))return t}var Fi="0.213.0";var bm=300,Cc=typeof PerformanceObserver<"u",Cr=class extends U{component="fetch";version=Fi;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-fetch",Fi,t),this._semconvStability=Zt("http",t?.semconvStabilityOptIn)}init(){}_addChildSpan(t,r){let n=this.tracer.startSpan("CORS Preflight",{startTime:r[T.FETCH_START]},R.setSpan(E.active(),t)),o=!(this._semconvStability&b.OLD);ht(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[T.RESPONSE_END])}_addFinalSpanAttributes(t,r){let n=rt(r.url);if(this._semconvStability&b.OLD&&(t.setAttribute(yc,r.status),r.statusText!=null&&t.setAttribute(vr.HTTP_STATUS_TEXT,r.statusText),t.setAttribute(Sc,n.host),t.setAttribute(Oc,n.protocol.replace(":","")),typeof navigator<"u"&&t.setAttribute(wc,navigator.userAgent)),this._semconvStability&b.STABLE){t.setAttribute(on,r.status),t.setAttribute(sn,n.hostname);let o=Pc(n);o&&t.setAttribute(an,o)}}_addHeaders(t,r){if(!yr(r,this.getConfig().propagateTraceHeaderCorsUrls)){let n={};B.inject(E.active(),n),Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}if(t instanceof Request)B.inject(E.active(),t.headers,{set:(n,o,i)=>n.set(o,typeof i=="string"?i:String(i))});else{let n=new Headers(t.headers);B.inject(E.active(),n,{set:(o,i,s)=>o.set(i,typeof s=="string"?s:String(s))}),t.headers=n}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,r={}){if(ir(t,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let n="",o={};if(this._semconvStability&b.OLD){let i=(r.method||"GET").toUpperCase();n=`HTTP ${i}`,o[vr.COMPONENT]=this.moduleName,o[Ac]=i,o[bc]=t}if(this._semconvStability&b.STABLE){let i=r.method,s=vc(r.method||"GET");n||(n=s),o[rn]=s,s!==i&&(o[nn]=i),o[Ct]=t}return this.tracer.startSpan(n,{kind:At.CLIENT,attributes:o})}_findResourceAndAddNetworkEvents(t,r,n){let o=r.entries;if(!o.length){if(!performance.getEntriesByType)return;o=performance.getEntriesByType("resource")}let i=Or(r.spanUrl,r.startTime,n,o,this._usedResources,"fetch");if(i.mainRequest){let s=i.mainRequest;this._markResourceAsUsed(s);let a=i.corsPreFlightRequest;a&&(this._addChildSpan(t,a),this._markResourceAsUsed(a));let c=!(this._semconvStability&b.OLD);ht(t,s,this.getConfig().ignoreNetworkEvents,void 0,c)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,r,n){let o=I(Date.now()),i=D();this._addFinalSpanAttributes(t,n),this._semconvStability&b.STABLE&&n.status>=400&&(t.setStatus({code:ct.ERROR}),t.setAttribute(qe,String(n.status))),setTimeout(()=>{r.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,r,i),this._tasksCount--,this._clearResources(),t.end(o)},bm)}_patchConstructor(){return t=>{let r=this,n=new Set(["url","type","redirected"]);function o(i,s){return new Proxy(i,{get(a,c,u){if(typeof c=="string"&&n.has(c))return Reflect.get(s,c);if(c==="clone")return function(){return o(a.clone(),s)};let p=Reflect.get(a,c,a);return typeof p=="function"?p.bind(a):p}})}return function(...s){let a=this,c=rt(s[0]instanceof Request?s[0].url:String(s[0])).href,u=s[0]instanceof Request?s[0]:s[1]||{},p=r._createSpan(c,u);if(!p)return t.apply(this,s);let _=r._prepareSpanData(c);r.getConfig().measureRequestSize&&Lc(...s).then(f=>{f&&(r._semconvStability&b.OLD&&p.setAttribute(xc,f),r._semconvStability&b.STABLE&&p.setAttribute(Rc,f))}).catch(f=>{r._diag.warn("getFetchBodyLength",f)});function d(f,O){r._applyAttributesAfterFetch(f,u,O),r._endSpan(f,_,{status:O.status||0,statusText:O.message,url:c})}function m(f,O){r._applyAttributesAfterFetch(f,u,O),O.status>=200&&O.status<400?r._endSpan(f,_,O):r._endSpan(f,_,{status:O.status,statusText:O.statusText,url:c})}function h(f,O){if(!f)return null;let x=f.getReader();return new ReadableStream({async pull(y){try{let{value:z,done:j}=await x.read();j?(x.releaseLock(),y.close()):y.enqueue(z)}catch(z){y.error(z),x.cancel(z).catch(j=>{});try{x.releaseLock()}catch{}}},cancel(y){return O.cancel(y).catch(z=>{}),x.cancel(y)}})}function S(f,O,x){let y=null;try{let j=x.clone().body;if(j){let L=j.getReader(),Ue=x.status===204||x.status===205||x.status===304?null:h(x.body,L),kr=new Response(Ue,{status:x.status,statusText:x.statusText,headers:x.headers});y=o(kr,x);let ne=()=>{L.read().then(({done:kt})=>{kt?m(f,x):ne()},kt=>{d(f,kt)})};ne()}else m(f,x)}finally{O(y??x)}}function A(f,O,x){try{d(f,x)}finally{O(x)}}return new Promise((f,O)=>E.with(R.setSpan(E.active(),p),()=>(r._callRequestHook(p,u),r._addHeaders(u,c),r._tasksCount++,t.apply(a,u instanceof Request?[u]:[c,u]).then(S.bind(a,p,f),A.bind(a,p,O)))))}}}_applyAttributesAfterFetch(t,r,n){let o=this.getConfig().applyCustomAttributesOnSpan;o&&ot(()=>o(t,r,n),i=>{i&&this._diag.error("applyCustomAttributesOnSpan",i)},!0)}_callRequestHook(t,r){let n=this.getConfig().requestHook;n&&ot(()=>n(t,r),o=>{o&&this._diag.error("requestHook",o)},!0)}_prepareSpanData(t){let r=D(),n=[];if(typeof PerformanceObserver!="function")return{entries:n,startTime:r,spanUrl:t};let o=new PerformanceObserver(i=>{i.getEntries().forEach(a=>{a.initiatorType==="fetch"&&a.name===t&&n.push(a)})});return o.observe({entryTypes:["resource"]}),{entries:n,observer:o,startTime:r,spanUrl:t}}enable(){if(!Cc){this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()");return}N(fetch)&&(this._unwrap(globalThis,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(globalThis,"fetch",this._patchConstructor())}disable(){Cc&&(this._unwrap(globalThis,"fetch"),this._usedResources=new WeakSet)}};var zi="0.57.0",Mc="@opentelemetry/instrumentation-long-task";var $i="longtask",Mr=class extends U{version=zi;_observer;constructor(t={}){super(Mc,zi,t)}init(){}isSupported(){return typeof PerformanceObserver>"u"||!PerformanceObserver.supportedEntryTypes?!1:PerformanceObserver.supportedEntryTypes.includes($i)}_createSpanFromEntry(t){let r=this.tracer.startSpan($i,{startTime:D(t.startTime)}),{observerCallback:n}=this.getConfig();if(n)try{n(r,{longtaskEntry:t})}catch(o){l.error("longtask instrumentation: observer callback failed",o)}r.setAttribute("longtask.name",t.name),r.setAttribute("longtask.entry_type",t.entryType),r.setAttribute("longtask.duration",t.duration),Array.isArray(t.attribution)&&t.attribution.forEach((o,i)=>{let s=t.attribution.length>1?`longtask.attribution[${i}]`:"longtask.attribution";r.setAttribute(`${s}.name`,o.name),r.setAttribute(`${s}.entry_type`,o.entryType),r.setAttribute(`${s}.start_time`,o.startTime),r.setAttribute(`${s}.duration`,o.duration),r.setAttribute(`${s}.container_type`,o.containerType),r.setAttribute(`${s}.container_src`,o.containerSrc),r.setAttribute(`${s}.container_id`,o.containerId),r.setAttribute(`${s}.container_name`,o.containerName)}),r.end(D(t.startTime+t.duration))}enable(){if(!this.isSupported()){this._diag.debug("Environment not supported");return}this._observer||(this._observer=new PerformanceObserver(t=>{t.getEntries().forEach(r=>this._createSpanFromEntry(r))}),this._observer.observe({type:$i,buffered:!0}))}disable(){this._observer&&(this._observer.disconnect(),this._observer=void 0)}};var ee;(function(e){e.EVENT_TYPE="event_type",e.TARGET_ELEMENT="target_element",e.TARGET_XPATH="target_xpath",e.HTTP_URL="http.url"})(ee||(ee={}));var Wi="0.57.0",Ic="@opentelemetry/instrumentation-user-interaction";var wm="OT_ZONE_CONTEXT",Nm="Navigation:",Lm=["click"];function vm(){return!1}var Ir=class extends U{version=Wi;moduleName="user-interaction";_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(t={}){super(Ic,Wi,t),this._eventNames=new Set(t?.eventNames??Lm),this._shouldPreventSpanCreation=typeof t?.shouldPreventSpanCreation=="function"?t.shouldPreventSpanCreation:vm}init(){}_checkForTimeout(t,r){let n=this._spansData.get(r);n&&(t.source==="setTimeout"?n.hrTimeLastTimeout=D():t.source!=="Promise.then"&&t.source!=="setTimeout"&&(n.hrTimeLastTimeout=void 0))}_allowEventName(t){return this._eventNames.has(t)}_createSpan(t,r,n){if(!(t instanceof HTMLElement)||!t.getAttribute||t.hasAttribute("disabled")||!this._allowEventName(r))return;let o=go(t,!0);try{let i=this.tracer.startSpan(r,{attributes:{[ee.EVENT_TYPE]:r,[ee.TARGET_ELEMENT]:t.tagName,[ee.TARGET_XPATH]:o,[ee.HTTP_URL]:window.location.href}},n?R.setSpan(E.active(),n):void 0);return this._shouldPreventSpanCreation(r,t,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(i){this._diag.error("failed to start create new user interaction span",i)}}_decrementTask(t){let r=this._spansData.get(t);r&&(r.taskCount--,r.taskCount===0&&this._tryToEndSpan(t,r.hrTimeLastTimeout))}_getCurrentSpan(t){let r=t.get(wm);return r&&R.getSpan(r)}_incrementTask(t){let r=this._spansData.get(t);r&&r.taskCount++}addPatchedListener(t,r,n,o){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let s=i.get(r);return s||(s=new Map,i.set(r,s)),s.has(t)?!1:(s.set(t,o),!0)}removePatchedListener(t,r,n){let o=this._wrappedListeners.get(n);if(!o)return;let i=o.get(r);if(!i)return;let s=i.get(t);return s&&(i.delete(t),i.size===0&&(o.delete(r),o.size===0&&this._wrappedListeners.delete(n))),s}_invokeListener(t,r,n){return typeof t=="function"?t.apply(r,n):t.handleEvent(n[0])}_patchAddEventListener(){let t=this;return r=>function(o,i,s){if(!i)return r.call(this,o,i,s);let a=s&&typeof s=="object"&&s.once,c=function(...u){let p,_=u[0],d=_?.target;_&&(p=t._eventsSpanMap.get(_)),a&&t.removePatchedListener(this,o,i);let m=t._createSpan(d,o,p);return m?(_&&t._eventsSpanMap.set(_,m),E.with(R.setSpan(E.active(),m),()=>{let h=t._invokeListener(i,this,u);return m.end(),h})):t._invokeListener(i,this,u)};if(t.addPatchedListener(this,o,i,c))return r.call(this,o,c,s)}}_patchRemoveEventListener(){let t=this;return r=>function(o,i,s){let a=t.removePatchedListener(this,o,i);return a?r.call(this,o,a,s):r.call(this,o,i,s)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._unpatchHistoryApi(),this._wrap(history,"replaceState",this._patchHistoryMethod()),this._wrap(history,"pushState",this._patchHistoryMethod()),this._wrap(history,"back",this._patchHistoryMethod()),this._wrap(history,"forward",this._patchHistoryMethod()),this._wrap(history,"go",this._patchHistoryMethod())}_patchHistoryMethod(){let t=this;return r=>function(...o){let i=`${location.pathname}${location.hash}${location.search}`,s=r.apply(this,o),a=`${location.pathname}${location.hash}${location.search}`;return i!==a&&t._updateInteractionName(a),s}}_unpatchHistoryApi(){N(history.replaceState)&&this._unwrap(history,"replaceState"),N(history.pushState)&&this._unwrap(history,"pushState"),N(history.back)&&this._unwrap(history,"back"),N(history.forward)&&this._unwrap(history,"forward"),N(history.go)&&this._unwrap(history,"go")}_updateInteractionName(t){let r=R.getSpan(E.active());r&&typeof r.updateName=="function"&&r.updateName(`${Nm} ${t}`)}_patchZoneCancelTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&t._decrementTask(s),r.call(this,o)}}_patchZoneScheduleTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&(t._incrementTask(s),t._checkForTimeout(o,s)),r.call(this,o)}}_patchZoneRunTask(){let t=this;return r=>function(o,i,s){let c=(Array.isArray(s)&&s[0]instanceof Event?s[0]:void 0)?.target,u,p=this;if(c){if(u=t._createSpan(c,o.eventName),u)return t._incrementTask(u),p.run(()=>{try{return E.with(R.setSpan(E.active(),u),()=>{let _=Zone.current;return o._zone=_,r.call(_,o,i,s)})}finally{t._decrementTask(u)}})}else u=t._getCurrentSpan(p);try{return r.call(p,o,i,s)}finally{u&&t._shouldCountTask(o,p)&&t._decrementTask(u)}}}_shouldCountTask(t,r){if(t._zone&&(r=t._zone),!r||!t.data||t.data.isPeriodic)return!1;let n=this._getCurrentSpan(r);return!n||!this._spansData.get(n)?!1:t.type==="macroTask"||t.type==="microTask"}_tryToEndSpan(t,r){t&&this._spansData.get(t)&&(t.end(r),this._spansData.delete(t))}enable(){let t=this._getZoneWithPrototype();this._diag.debug("applying patch to",this.moduleName,this.version,"zone:",!!t),t?(N(t.prototype.runTask)&&(this._unwrap(t.prototype,"runTask"),this._diag.debug("removing previous patch from method runTask")),N(t.prototype.scheduleTask)&&(this._unwrap(t.prototype,"scheduleTask"),this._diag.debug("removing previous patch from method scheduleTask")),N(t.prototype.cancelTask)&&(this._unwrap(t.prototype,"cancelTask"),this._diag.debug("removing previous patch from method cancelTask")),this._zonePatched=!0,this._wrap(t.prototype,"runTask",this._patchZoneRunTask()),this._wrap(t.prototype,"scheduleTask",this._patchZoneScheduleTask()),this._wrap(t.prototype,"cancelTask",this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(n=>{N(n.addEventListener)&&(this._unwrap(n,"addEventListener"),this._diag.debug("removing previous patch from method addEventListener")),N(n.removeEventListener)&&(this._unwrap(n,"removeEventListener"),this._diag.debug("removing previous patch from method removeEventListener")),this._wrap(n,"addEventListener",this._patchAddEventListener()),this._wrap(n,"removeEventListener",this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){let t=this._getZoneWithPrototype();this._diag.debug("removing patch from",this.moduleName,this.version,"zone:",!!t),t&&this._zonePatched?(N(t.prototype.runTask)&&this._unwrap(t.prototype,"runTask"),N(t.prototype.scheduleTask)&&this._unwrap(t.prototype,"scheduleTask"),N(t.prototype.cancelTask)&&this._unwrap(t.prototype,"cancelTask")):this._getPatchableEventTargets().forEach(n=>{N(n.addEventListener)&&this._unwrap(n,"addEventListener"),N(n.removeEventListener)&&this._unwrap(n,"removeEventListener")}),this._unpatchHistoryApi()}_getZoneWithPrototype(){return window.Zone}};var Dc="http.host",Uc="http.method",Bc="http.request.body.size",Gc="http.request_content_length_uncompressed";var Hc="http.scheme",Vc="http.status_code",kc="http.url",Fc="http.user_agent";var dt;(function(e){e.METHOD_OPEN="open",e.METHOD_SEND="send",e.EVENT_ABORT="abort",e.EVENT_ERROR="error",e.EVENT_LOAD="loaded",e.EVENT_TIMEOUT="timeout"})(dt||(dt={}));var Pm=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function Cm(e){return typeof Document<"u"&&e instanceof Document}function $c(e){if(Cm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return zc(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Im(e);if(e instanceof URLSearchParams)return zc(e.toString());if(e.byteLength!==void 0)return e.byteLength;Pm.warn("unknown body type")}var Mm=new TextEncoder;function zc(e){return Mm.encode(e).byteLength}function Im(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function Wc(e){let t=Um(),r=e.toUpperCase();return r in t?r:"_OTHER"}var Dm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Dr;function Um(){if(Dr===void 0){let e=void 0;e&&e.length>0?(Dr={},e.forEach(t=>{Dr[t]=!0})):Dr=Dm}return Dr}var Bm={"https:":"443","http:":"80"};function jc(e){let t=Number(e.port||Bm[e.protocol]);if(t&&!isNaN(t))return t}var ji="0.213.0";var xo;(function(e){e.HTTP_STATUS_TEXT="http.status_text"})(xo||(xo={}));var Gm=300,Ur=class extends U{component="xml-http-request";version=ji;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",ji,t),this._semconvStability=Zt("http",t?.semconvStabilityOptIn)}init(){}_addHeaders(t,r){let n=rt(r).href;if(!yr(n,this.getConfig().propagateTraceHeaderCorsUrls)){let i={};B.inject(E.active(),i),Object.keys(i).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}let o={};B.inject(E.active(),o),Object.keys(o).forEach(i=>{t.setRequestHeader(i,String(o[i]))})}_addChildSpan(t,r){E.with(R.setSpan(E.active(),t),()=>{let n=this.tracer.startSpan("CORS Preflight",{startTime:r[T.FETCH_START]}),o=!(this._semconvStability&b.OLD);ht(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[T.RESPONSE_END])})}_addFinalSpanAttributes(t,r,n){if(this._semconvStability&b.OLD){if(r.status!==void 0&&t.setAttribute(Vc,r.status),r.statusText!==void 0&&t.setAttribute(xo.HTTP_STATUS_TEXT,r.statusText),typeof n=="string"){let o=rt(n);t.setAttribute(Dc,o.host),t.setAttribute(Hc,o.protocol.replace(":",""))}t.setAttribute(Fc,navigator.userAgent)}this._semconvStability&b.STABLE&&r.status&&t.setAttribute(on,r.status)}_applyAttributesAfterXHR(t,r){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n=="function"&&ot(()=>n(t,r),o=>{o&&this._diag.error("applyCustomAttributesOnSpan",o)},!0)}_addResourceObserver(t,r){let n=this._xhrMem.get(t);!n||typeof PerformanceObserver!="function"||typeof PerformanceResourceTiming!="function"||(n.createdResources={observer:new PerformanceObserver(o=>{let i=o.getEntries(),s=rt(r);i.forEach(a=>{a.initiatorType==="xmlhttprequest"&&a.name===s.href&&n.createdResources&&n.createdResources.entries.push(a)})}),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(C.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,r,n,o,i){if(!n||!o||!i||!t.createdResources)return;let s=t.createdResources.entries;(!s||!s.length)&&(s=C.getEntriesByType("resource"));let a=Or(rt(n).href,o,i,s,this._usedResources);if(a.mainRequest){let c=a.mainRequest;this._markResourceAsUsed(c);let u=a.corsPreFlightRequest;u&&(this._addChildSpan(r,u),this._markResourceAsUsed(u));let p=!(this._semconvStability&b.OLD);ht(r,c,this.getConfig().ignoreNetworkEvents,void 0,p)}}_cleanPreviousSpanInformation(t){let r=this._xhrMem.get(t);if(r){let n=r.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,r,n){if(ir(r,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let o="",i=rt(r),s={};if(this._semconvStability&b.OLD&&(o=n.toUpperCase(),s[Uc]=n,s[kc]=i.toString()),this._semconvStability&b.STABLE){let c=n,u=Wc(n);o||(o=u),s[rn]=u,u!==c&&(s[nn]=c),s[Ct]=i.toString(),s[sn]=i.hostname;let p=jc(i);p&&(s[an]=p)}let a=this.tracer.startSpan(o,{kind:At.CLIENT,attributes:s});return a.addEvent(dt.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:a,spanUrl:r}),a}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{let r=this;return function(...o){let i=o[0],s=o[1];return r._createSpan(this,s,i),t.apply(this,o)}}}_patchSend(){let t=this;function r(u,p,_,d){let m=p.callbackToRemoveEvents;typeof m=="function"&&m();let{span:h,spanUrl:S,sendStartTime:A}=p;h&&(t._findResourceAndAddNetworkEvents(p,h,S,A,_),h.addEvent(u,d),t._addFinalSpanAttributes(h,p,S),h.end(d),t._tasksCount--),t._clearResources()}function n(u,p,_,d){let m=t._xhrMem.get(p);if(!m)return;if(m.status=p.status,m.statusText=p.statusText,t._xhrMem.delete(p),m.span){let A=m.span;t._applyAttributesAfterXHR(A,p),t._semconvStability&b.STABLE&&(_?d&&(A.setStatus({code:ct.ERROR,message:d}),A.setAttribute(qe,d)):m.status&&m.status>=400&&(A.setStatus({code:ct.ERROR}),A.setAttribute(qe,String(m.status))))}let h=D(),S=Date.now();setTimeout(()=>{r(u,m,h,S)},Gm)}function o(){n(dt.EVENT_ERROR,this,!0,"error")}function i(){n(dt.EVENT_ABORT,this,!1)}function s(){n(dt.EVENT_TIMEOUT,this,!0,"timeout")}function a(){this.status<299?n(dt.EVENT_LOAD,this,!1):n(dt.EVENT_ERROR,this,!1)}function c(u){u.removeEventListener("abort",i),u.removeEventListener("error",o),u.removeEventListener("load",a),u.removeEventListener("timeout",s);let p=t._xhrMem.get(u);p&&(p.callbackToRemoveEvents=void 0)}return u=>function(..._){let d=t._xhrMem.get(this);if(!d)return u.apply(this,_);let m=d.span,h=d.spanUrl;if(m&&h){if(t.getConfig().measureRequestSize&&_?.[0]){let S=_[0],A=$c(S);A!==void 0&&(t._semconvStability&b.OLD&&m.setAttribute(Gc,A),t._semconvStability&b.STABLE&&m.setAttribute(Bc,A))}E.with(R.setSpan(E.active(),m),()=>{t._tasksCount++,d.sendStartTime=D(),m.addEvent(dt.METHOD_SEND),this.addEventListener("abort",i),this.addEventListener("error",o),this.addEventListener("load",a),this.addEventListener("timeout",s),d.callbackToRemoveEvents=()=>{c(this),d.createdResources&&d.createdResources.observer.disconnect()},t._addHeaders(this,h),t._addResourceObserver(this,h)})}return u.apply(this,_)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),N(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),N(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}};var Kc="0.6.0",Xc="@opentelemetry/instrumentation-web-exception";var Br=class extends U{constructor(t={}){super(Xc,Kc,t)}init(){}onError(t){let r="exception",n="reason"in t?t.reason:t.error;if(n===void 0)return;let o=Pt.getLoggerProvider().getLogger(this.instrumentationName,this.instrumentationVersion),i=this.getConfig(),s=i.applyCustomAttributes?i.applyCustomAttributes(n):{},a={};typeof n=="string"?a={[Z]:n}:a={[nt]:n.name,[Z]:n.message,[Kt]:n.stack};let c={eventName:r,severityNumber:J.ERROR,attributes:{...a,...s},timestamp:D(),observedTimestamp:D()};o.emit(c)}disable(){this._onErrorHandler&&(window.removeEventListener("error",this._onErrorHandler),window.removeEventListener("unhandledrejection",this._onErrorHandler))}enable(){this._onErrorHandler||(this._onErrorHandler=this.onError.bind(this)),window.addEventListener("error",this._onErrorHandler),window.addEventListener("unhandledrejection",this._onErrorHandler)}};var Yc="browser.web_vital",qc="browser.web_vital.name",Qc="browser.web_vital.value",Jc="browser.web_vital.rating",Zc="browser.web_vital.delta",tu="browser.web_vital.id",eu="browser.web_vital.navigation_type";var yo=class{t;o=0;i=[];u(t){if(t.hadRecentInput)return;let r=this.i[0],n=this.i.at(-1);this.o&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),this.t?.(t)}},Me=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},bo=e=>{if(document.readyState==="loading")return"loading";{let t=Me();if(t){if(e<t.domInteractive)return"loading";if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return"dom-interactive";if(t.domComplete===0||e<t.domComplete)return"dom-content-loaded"}}return"complete"},Hm=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Zi=e=>{let t="";try{for(;e?.nodeType!==9;){let r=e,n=r.id?"#"+r.id:[Hm(r),...Array.from(r.classList).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,r.id)break;e=r.parentNode}}catch{}return t},Ki=new WeakMap;function Pe(e,t){return Ki.get(e)||Ki.set(e,new t),Ki.get(e)}var lu=-1,mu=()=>lu,Ie=e=>{addEventListener("pageshow",(t=>{t.persisted&&(lu=t.timeStamp,e(t))}),!0)},ft=(e,t,r,n)=>{let o,i;return s=>{t.value>=0&&(s||n)&&(i=t.value-(o??0),(i||o===void 0)&&(o=t.value,t.delta=i,t.rating=((a,c)=>a>c[1]?"poor":a>c[0]?"needs-improvement":"good")(t.value,r),e(t)))}},ts=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Gr=()=>Me()?.activationStart??0,Tt=(e,t=-1)=>{let r=Me(),n="navigate";return mu()>=0?n="back-forward-cache":r&&(document.prerendering||Gr()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},Ce=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver((o=>{Promise.resolve().then((()=>{t(o.getEntries())}))}));return n.observe({type:e,buffered:!0,...r}),n}}catch{}},es=e=>{let t=!1;return()=>{t||(e(),t=!0)}},ve=-1,_u=new Set,ru=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Yi=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of _u)t();isFinite(ve)||(ve=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",Yi,!0))}},Lo=()=>{if(ve<0){let e=Gr();ve=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((r=>r.name==="hidden"&&r.startTime>e))[0]?.startTime)??ru(),addEventListener("visibilitychange",Yi,!0),addEventListener("prerenderingchange",Yi,!0),Ie((()=>{setTimeout((()=>{ve=ru()}))}))}return{get firstHiddenTime(){return ve},onHidden(e){_u.add(e)}}},vo=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},nu=[1800,3e3],hu=(e,t={})=>{vo((()=>{let r=Lo(),n,o=Tt("FCP"),i=Ce("paint",(s=>{for(let a of s)a.name==="first-contentful-paint"&&(i.disconnect(),a.startTime<r.firstHiddenTime&&(o.value=Math.max(a.startTime-Gr(),0),o.entries.push(a),n(!0)))}));i&&(n=ft(e,o,nu,t.reportAllChanges),Ie((s=>{o=Tt("FCP"),n=ft(e,o,nu,t.reportAllChanges),ts((()=>{o.value=performance.now()-s.timeStamp,n(!0)}))})))}))},ou=[.1,.25],iu=e=>e.find((t=>t.node?.nodeType===1))||e[0],du=(e,t={})=>{let r=Pe(t=Object.assign({},t),yo),n=new WeakMap;r.t=o=>{if(o?.sources?.length){let i=iu(o.sources),s=i?.node;if(s){let a=t.generateTarget?.(s)??Zi(s);n.set(i,a)}}},((o,i={})=>{let s=Lo();hu(es((()=>{let a,c=Tt("CLS",0),u=Pe(i,yo),p=d=>{for(let m of d)u.u(m);u.o>c.value&&(c.value=u.o,c.entries=u.i,a())},_=Ce("layout-shift",p);_&&(a=ft(o,c,ou,i.reportAllChanges),s.onHidden((()=>{p(_.takeRecords()),a(!0)})),Ie((()=>{u.o=0,c=Tt("CLS",0),a=ft(o,c,ou,i.reportAllChanges),ts((()=>a()))})),setTimeout(a))})))})((o=>{let i=(s=>{let a={};if(s.entries.length){let c=s.entries.reduce(((u,p)=>u.value>p.value?u:p));if(c?.sources?.length){let u=iu(c.sources);u&&(a={largestShiftTarget:n.get(u),largestShiftTime:c.startTime,largestShiftValue:c.value,largestShiftSource:u,largestShiftEntry:c,loadState:bo(c.startTime)})}}return Object.assign(s,{attribution:a})})(o);e(i)}),t)},fu=(e,t={})=>{hu((r=>{let n=(o=>{let i={timeToFirstByte:0,firstByteToFCP:o.value,loadState:bo(mu())};if(o.entries.length){let s=Me(),a=o.entries.at(-1);if(s){let c=s.activationStart||0,u=Math.max(0,s.responseStart-c);i={timeToFirstByte:u,firstByteToFCP:o.value-u,loadState:bo(o.entries[0].startTime),navigationEntry:s,fcpEntry:a}}}return Object.assign(o,{attribution:i})})(r);e(n)}),t)},Tu=0,Xi=1/0,Oo=0,Vm=e=>{for(let t of e)t.interactionId&&(Xi=Math.min(Xi,t.interactionId),Oo=Math.max(Oo,t.interactionId),Tu=Oo?(Oo-Xi)/7+1:0)},qi,su=()=>qi?Tu:performance.interactionCount??0,km=()=>{"interactionCount"in performance||qi||(qi=Ce("event",Vm,{type:"event",buffered:!0,durationThreshold:0}))},au=0,wo=class{l=[];h=new Map;m;p;v(){au=su(),this.l.length=0,this.h.clear()}M(){let t=Math.min(this.l.length-1,Math.floor((su()-au)/50));return this.l[t]}u(t){if(this.m?.(t),!t.interactionId&&t.entryType!=="first-input")return;let r=this.l.at(-1),n=this.h.get(t.interactionId);if(n||this.l.length<10||t.duration>r.T){if(n?t.duration>n.T?(n.entries=[t],n.T=t.duration):t.duration===n.T&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],T:t.duration},this.h.set(n.id,n),this.l.push(n)),this.l.sort(((o,i)=>i.T-o.T)),this.l.length>10){let o=this.l.splice(10);for(let i of o)this.h.delete(i.id)}this.p?.(n)}}},Qi=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?e():(e=es(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})})))},cu=[200,500],gu=(e,t={})=>{let r=Pe(t=Object.assign({},t),wo),n=[],o=[],i=0,s=new WeakMap,a=new WeakMap,c=!1,u=()=>{c||(Qi(p),c=!0)},p=()=>{let m=r.l.map((f=>s.get(f.entries[0]))),h=o.length-50;o=o.filter(((f,O)=>O>=h||m.includes(f)));let S=new Set;for(let f of o){let O=_(f.startTime,f.processingEnd);for(let x of O)S.add(x)}let A=n.length-1-50;n=n.filter(((f,O)=>f.startTime>i&&O>A||S.has(f))),c=!1};r.m=m=>{let h=m.startTime+m.duration,S;i=Math.max(i,m.processingEnd);for(let A=o.length-1;A>=0;A--){let f=o[A];if(Math.abs(h-f.renderTime)<=8){S=f,S.startTime=Math.min(m.startTime,S.startTime),S.processingStart=Math.min(m.processingStart,S.processingStart),S.processingEnd=Math.max(m.processingEnd,S.processingEnd),S.entries.push(m);break}}S||(S={startTime:m.startTime,processingStart:m.processingStart,processingEnd:m.processingEnd,renderTime:h,entries:[m]},o.push(S)),(m.interactionId||m.entryType==="first-input")&&s.set(m,S),u()},r.p=m=>{if(!a.get(m)){let h=m.entries[0].target;if(h){let S=t.generateTarget?.(h)??Zi(h);a.set(m,S)}}};let _=(m,h)=>{let S=[];for(let A of n)if(!(A.startTime+A.duration<m)){if(A.startTime>h)break;S.push(A)}return S},d=m=>{let h=m.entries[0],S=s.get(h),A=h.processingStart,f=Math.max(h.startTime+h.duration,A),O=Math.min(S.processingEnd,f),x=S.entries.sort(((L,gt)=>L.processingStart-gt.processingStart)),y=_(h.startTime,O),z=r.h.get(h.interactionId),j={interactionTarget:a.get(z),interactionType:h.name.startsWith("key")?"keyboard":"pointer",interactionTime:h.startTime,nextPaintTime:f,processedEventEntries:x,longAnimationFrameEntries:y,inputDelay:A-h.startTime,processingDuration:O-A,presentationDelay:f-O,loadState:bo(h.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(L=>{if(!L.longAnimationFrameEntries?.length)return;let gt=L.interactionTime,Ue=L.inputDelay,kr=L.processingDuration,ne,kt,Do=0,Be=0,Uo=0,Bo=0;for(let Fr of L.longAnimationFrameEntries){Be=Be+Fr.startTime+Fr.duration-Fr.styleAndLayoutStart;for(let Et of Fr.scripts){let is=Et.startTime+Et.duration;if(is<gt)continue;let zr=is-Math.max(gt,Et.startTime),ss=Et.duration?zr/Et.duration*Et.forcedStyleAndLayoutDuration:0;Do+=zr-ss,Be+=ss,zr>Bo&&(kt=Et.startTime<gt+Ue?"input-delay":Et.startTime>=gt+Ue+kr?"presentation-delay":"processing-duration",ne=Et,Bo=zr)}}let Go=L.longAnimationFrameEntries.at(-1),os=Go?Go.startTime+Go.duration:0;os>=gt+Ue+kr&&(Uo=L.nextPaintTime-os),ne&&kt&&(L.longestScript={entry:ne,subpart:kt,intersectingDuration:Bo}),L.totalScriptDuration=Do,L.totalStyleAndLayoutDuration=Be,L.totalPaintDuration=Uo,L.totalUnattributedDuration=L.nextPaintTime-gt-Do-Be-Uo})(j),Object.assign(m,{attribution:j})};Ce("long-animation-frame",(m=>{n=n.concat(m),u()})),((m,h={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let S=Lo();vo((()=>{km();let A,f=Tt("INP"),O=Pe(h,wo),x=z=>{Qi((()=>{for(let L of z)O.u(L);let j=O.M();j&&j.T!==f.value&&(f.value=j.T,f.entries=j.entries,A())}))},y=Ce("event",x,{durationThreshold:h.durationThreshold??40});A=ft(m,f,cu,h.reportAllChanges),y&&(y.observe({type:"first-input",buffered:!0}),S.onHidden((()=>{x(y.takeRecords()),A(!0)})),Ie((()=>{O.v(),f=Tt("INP"),A=ft(m,f,cu,h.reportAllChanges)})))}))})((m=>{let h=d(m);e(h)}),t)},No=class{m;u(t){this.m?.(t)}},uu=[2500,4e3],Eu=(e,t={})=>{let r=Pe(t=Object.assign({},t),No),n=new WeakMap;r.m=o=>{let i=o.element;if(i){let s=t.generateTarget?.(i)??Zi(i);n.set(o,s)}},((o,i={})=>{vo((()=>{let s=Lo(),a,c=Tt("LCP"),u=Pe(i,No),p=d=>{i.reportAllChanges||(d=d.slice(-1));for(let m of d)u.u(m),m.startTime<s.firstHiddenTime&&(c.value=Math.max(m.startTime-Gr(),0),c.entries=[m],a())},_=Ce("largest-contentful-paint",p);if(_){a=ft(o,c,uu,i.reportAllChanges);let d=es((()=>{p(_.takeRecords()),_.disconnect(),a(!0)})),m=h=>{h.isTrusted&&(Qi(d),removeEventListener(h.type,m,{capture:!0}))};for(let h of["keydown","click","visibilitychange"])addEventListener(h,m,{capture:!0});Ie((h=>{c=Tt("LCP"),a=ft(o,c,uu,i.reportAllChanges),ts((()=>{c.value=performance.now()-h.timeStamp,a(!0)}))}))}}))})((o=>{let i=(s=>{let a={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:s.value};if(s.entries.length){let c=Me();if(c){let u=c.activationStart||0,p=s.entries.at(-1),_=p.url&&performance.getEntriesByType("resource").filter((S=>S.name===p.url))[0],d=Math.max(0,c.responseStart-u),m=Math.max(d,_?(_.requestStart||_.startTime)-u:0),h=Math.min(s.value,Math.max(m,_?_.responseEnd-u:0));a={target:n.get(p),timeToFirstByte:d,resourceLoadDelay:m-d,resourceLoadDuration:h-m,elementRenderDelay:s.value-h,navigationEntry:c,lcpEntry:p},p.url&&(a.url=p.url),_&&(a.lcpResourceEntry=_)}}return Object.assign(s,{attribution:a})})(o);e(i)}),t)},pu=[800,1800],Ji=e=>{document.prerendering?vo((()=>Ji(e))):document.readyState!=="complete"?addEventListener("load",(()=>Ji(e)),!0):setTimeout(e)},Su=(e,t={})=>{((r,n={})=>{let o=Tt("TTFB"),i=ft(r,o,pu,n.reportAllChanges);Ji((()=>{let s=Me();s&&(o.value=Math.max(s.responseStart-Gr(),0),o.entries=[s],i(!0),Ie((()=>{o=Tt("TTFB",0),i=ft(r,o,pu,n.reportAllChanges),i(!0)})))}))})((r=>{let n=(o=>{let i={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(o.entries.length){let s=o.entries[0],a=s.activationStart||0,c=Math.max((s.workerStart||s.fetchStart)-a,0),u=Math.max(s.domainLookupStart-a,0),p=Math.max(s.connectStart-a,0),_=Math.max(s.connectEnd-a,0);i={waitingDuration:c,cacheDuration:u-c,dnsDuration:p-u,connectionDuration:_-p,requestDuration:o.value-_,navigationEntry:s}}return Object.assign(o,{attribution:i})})(r);e(n)}),t)};var rs=class extends U{_applyCustomLogRecordData;_includeRawAttribution;constructor(e={}){super("@opentelemetry/instrumentation-web-vitals","0.1.0",e),this._applyCustomLogRecordData=e.applyCustomLogRecordData,this._includeRawAttribution=e.includeRawAttribution??!1}init(){return[]}enable(){if(typeof PerformanceObserver>"u"){this._diag.debug("PerformanceObserver not supported, web vitals will not be collected");return}if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug("Listeners already registered, resuming emission");return}this._listenersRegistered=!0,this._diag.debug("Registering listeners"),du(e=>this._emitWebVital(e)),gu(e=>this._emitWebVital(e)),Eu(e=>this._emitWebVital(e)),fu(e=>this._emitWebVital(e)),Su(e=>this._emitWebVital(e))}disable(){this._isEnabled=!1,this._diag.debug("Instrumentation disabled, pausing emission")}_getTimestampForMetric(e){if(e.name==="CLS"){let{attribution:t}=e;return t.largestShiftTime!==void 0?t.largestShiftTime:void 0}if(e.name==="INP"){let{attribution:t}=e;return t.interactionTime}return e.value}_emitWebVital(e){if(!this._isEnabled)return;let t={[qc]:e.name.toLowerCase(),[Qc]:e.value,[Zc]:e.delta,[Jc]:e.rating,[tu]:e.id,[eu]:e.navigationType},r=this._getTimestampForMetric(e),n={eventName:Yc,severityNumber:J.INFO,attributes:t,...this._includeRawAttribution?{body:JSON.stringify(e.attribution)}:{},...r!==void 0?{timestamp:r}:{}};this._applyCustomLogRecordData&&ot(()=>this._applyCustomLogRecordData?.(n),o=>{o&&this._diag.error("applyCustomLogRecordData hook failed",o)},!0),this.logger.emit(n)}};var Po=w.INFO,Ht={ALL:w.ALL,VERBOSE:w.VERBOSE,DEBUG:w.DEBUG,INFO:w.INFO,WARN:w.WARN,ERROR:w.ERROR,NONE:w.NONE};function Co(e){return Po=Ht[e.logLevel.toUpperCase()],Po==null&&(console.warn(`Unknown log level "${e.logLevel}", expected one of ${Object.keys(Ht)}, using default`),Po=Ht.INFO),{error:Hr(Ht.ERROR,console.error.bind(console)),warn:Hr(Ht.WARN,console.error.bind(console)),info:Hr(Ht.INFO,console.log.bind(console)),debug:Hr(Ht.DEBUG,console.log.bind(console)),verbose:Hr(Ht.VERBOSE,console.trace.bind(console))}}function Hr(e,t){return function(...n){let o=Po>=e;if(n.length===0)return o;o&&t(...n)}}var re=Co({logLevel:"warn"}),De=V,Mo=!1,Ru={active:function(){return De},with:function(e,t,r,...n){let o=De;De=e||V;try{return t.call(r,...n)}finally{De=o}},bind:function(e,t){return typeof t=="function"?wt(t,this,e):t},enable:function(){if(Mo)return this;let e=this;return Nt(window,"setTimeout",t=>function(...r){let n=Number(r[1]);return(isNaN(n)||n<=50)&&(r[0]=wt(r[0],e,e.active())),t.apply(this,r)}),Nt(window,"setImmediate",t=>function(...r){return r[0]=wt(r[0],e,e.active()),t.apply(this,r)}),$m(e),window.Promise&&Fm(e),De=V,Mo=!0,e},disable:function(){return Mo&&(it(window,"setTimeout"),it(window,"setImmediate"),Wm(),window.Promise&&zm(),De=V,Mo=!1),this}};function wt(e,t,r){if(typeof e!="function")return e;let n=r||t.active();function o(...i){return t.with(n,()=>e.apply(this,i))}return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),o}function Fm(e){Nt(Promise.prototype,"then",t=>function(r,n){return t.call(this,wt(r,e,e.active()),wt(n,e,e.active()))}),Nt(Promise.prototype,"catch",t=>function(r){return t.call(this,wt(r,e,e.active()))}),Nt(Promise.prototype,"finally",t=>function(r){return t.call(this,wt(r,e,e.active()))})}function zm(){it(Promise.prototype,"then"),it(Promise.prototype,"catch"),it(Promise.prototype,"finally")}var xu=["onreadystatechange"],Vt=globalThis.XMLHttpRequest.prototype,Ou=["onabort","onerror","onload","onloadend","onloadstart","onprogress","ontimeout"],Io=globalThis.XMLHttpRequestEventTarget.prototype;function $m(e){Nt(Vt,"addEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){n.__bound=n.__bound||new Map;let o=r[1],i=n.__bound.get(o);r[1]=i||wt(o,e,e.active()),n.__bound.set(o,r[1])}return t.apply(n,r)}}),Nt(Vt,"removeEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){let o=r[1],i=n.__bound?.get(o);i&&(r[1]=i)}return t.apply(n,r)}});for(let t of xu){let r=Object.getOwnPropertyDescriptor(Vt,t);r&&(Au(r,e),Object.defineProperty(Vt,t,r))}for(let t of Ou){let r=Object.getOwnPropertyDescriptor(Io,t);r&&(Au(r,e),Object.defineProperty(Io,t,r))}}function Wm(){it(Vt,"addEventListener"),it(Vt,"removeEventListener");for(let e of xu){let t=Object.getOwnPropertyDescriptor(Vt,e);t&&(it(t,"set"),it(t,"get"),Object.defineProperty(Vt,e,t))}for(let e of Ou){let t=Object.getOwnPropertyDescriptor(Io,e);t&&(it(t,"set"),it(t,"get"),Object.defineProperty(Io,e,t))}}function Nt(e,t,r){if(!e||!e[t]){re.warn("no original function "+String(t)+" to wrap");return}if(!r){re.warn("no wrapper function"),re.warn(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){re.warn("original object and wrapper must be functions");return}let o=r(n,t);return typeof n.toString=="function"&&(o.toString=n.toString.bind(n)),Vr(o,"__original",n),Vr(o,"__unwrap",()=>{e[t]===o&&Vr(e,t,n)}),Vr(o,"__wrapped",!0),Vr(e,t,o),o}function it(e,t){if(!e||!e[t]){re.warn("no function to unwrap."),re.warn(new Error().stack);return}let r=e[t];if(!r.__unwrap)re.warn(`no original to unwrap to -- has ${String(t)} already been unwrapped?`);else{r.__unwrap();return}}function Au(e,t){Nt(e,"set",function(r){return function(n){if(typeof n=="function"){let o=n;n=wt(o,t,t.active()),n.__original=o}return r.call(this,n)}}),Nt(e,"get",function(r){return function(){let n=r.call(this);return typeof n=="function"&&n.__original?n.__original:n}})}function Vr(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var yu="browser.brands",bu="browser.language",wu="browser.mobile",Nu="browser.platform";var Lu="user_agent.original";var vu="0.1.0";function Pu(e,t,r){typeof t=="string"&&t&&(e["service.name"]=t),typeof r=="string"&&r&&(e["service.version"]=r);let{userAgent:n,userAgentData:o}=navigator,i=Km(n),s;return o?(s={name:o.platform,version:""},e[yu]=o.brands.map(a=>`${a.brand} ${a.version}`)):s=jm(n),i&&(e["browser.name"]=i.name,i.version&&(e["browser.version"]=i.version)),s&&(e[Nu]=s.name),e[wu]=navigator.userAgent.includes("Mobi"),e[bu]=navigator.language,e[Lu]=n,e["telemetry.distro.name"]="elastic",e["telemetry.distro.version"]=vu,Nn({...e,...Mt})}function jm(e){let t=[["Symbian",[/SymbianOS\/([\w\.]+)/i]],["Windows Phone",[/Windows Phone ([\w\.]+)/i]],["Xbox",[/Xbox?/i]],["Windows",[/Windows (\d+)/i]],["Windows RT",[/Windows NT ([\w\.]+).+ARM;/i]],["Windows",[/Windows NT (\d+\.\d+)/i]],["Windows IoT",[/Windows IoT (\d+\.\d+)/i]],["iOS",[/iPhone OS (\d+(_\d+)*)/i,/iPad;.+CPU OS (\d+(_\d+)*)/i]],["macOS",[/Mac OS (\d+(_\d+)*)/i,/Mac OS X ([\w\.]+)/i,/Intel Mac OS X/]],["Ubuntu Touch",[/Ubuntu ([\w\.]+).+Mobile/i]],["Android",[/Android ([\w\.]+)/i,/Android;/i]],["Linux",[/Linux ([\w_]+)/i,/Linux;/]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}function Km(e){let t=[["AliPay",[/AliPayClient\/([\w\.]+)/i]],["Baidu",[/bd(?:browser|spark)\/([\w\.]+)/i,/baidu(?:boxapp|hd)\/([\w\.]+)/i,/BIDUBrowser\/([\w\.]+)/i]],["Bing",[/Bing(?:Web|Sapphire)\/([\w\.]+)/i]],["Camino",[/Camino\/([\w\.]+)/i]],["Coc Coc",[/coc_coc_browser\/([\w\.]+)/i]],["Dragon",[/(?:Dragon|Comodo_Dragon)\/([\w\.]+)/i]],["DuckDuckGo",[/(?:Ddg|DuckDuckGo)\/([\w\.]+)/i]],["Electron",[/Electron\/([\w\.]+)/i]],["Facebook",[/;fbav\/([\w\.]+);/i,/(?:fban\/fbios|fb_iab\/fb4a)/i]],["GSA",[/GSA\/([\w\.]+)/i]],["Huawei Browser",[/HuaweiBrowser\/([\w\.]+)/i]],["Iron",[/(?:Iron|Iron Safari)\/([\w\.]+)/i]],["LG Browser",[/LG Browser\/([\w\.]+)/i]],["Lunascape",[/Lunascape\/([\w\.]+)/i]],["Maxthon",[/Maxthon\/([\w\.]+)/i,/Mx(?:Browser|iOS)\/([\w\.]+)/i]],["MIUI Browser",[/MiuiBrowser\/([\w\.]+)/i]],["NokiaBrowser",[/NokiaBrowser\/([\w\.]+)/i]],["Oculus Browser",[/OculusBrowser\/([\w\.]+)/i]],["Pico Browser",[/PicoBrowser\/([\w\.]+)/i]],["Qwant",[/Qwant(?:Mobile|Browser|iOS)\/([\w\.]+)/i]],["Samsung Internet",[/SamsungBrowser\/([\w\.]+)/i]],["Silk",[/Silk\/([\w\.]+)/i]],["Smart Lenovo Browser",[/SLBrowser\/([\w\.]+)/i]],["Snapchat",[/Snapchat\/([\w\.]+)/i]],["Steam",[/Valve Steam/i]],["TikTok",[/musical_ly.+app_version\/([\w\.]+)/i]],["Twitter",[/Twitter/i]],["Vivaldi",[/Vivaldi\/([\w\.]+)/i]],["Yandex",[/Ya(?:SearchBrowser|Browser)\/([\w\.]+)/i]],["WeChat",[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i]],["QQBrowser",[/M?QQbrowser\/([\w\.]+)/i]],["Brave",[/Brave\/([\w\.]+)/i]],["Edge",[/(?:Edg|Edge|EdgA|EdgW|EdgiOS)\/([\w\.]+)/i]],["Opera",[/(?:OPR|OPT|OPiOS|Opera)\/([\w\.]+)/i,/Coast\/([\w\.]+)/i]],["Chromium",[/Chromium\/([\w\.]+)/i]],["Chrome Headless",[/HeadlessChrome\/([\w\.]+)/i,/HeadlessChrome Safari\/([\w\.]+)/i]],["Chrome",[/Chrome\/([\w\.]+)/i,/Cr(?:iOS|Mo)\/([\w\.]+)/i]],["Android Browser",[/Android \d.+Safari\/([\w\.]+)/i]],["Firefox",[/(?:Firefox|FxiOS)\/([\w\.]+)/i]],["Safari",[/Safari\/([\w\.]+)/i]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}var Cu=!1,Mu={logLevel:"info",sampleRate:1,serviceName:"unknown_service:web",resourceAttributes:{},otlpEndpoint:"http://localhost:4318",exportHeaders:{}};function Iu(e={}){if(Cu||e.disabled)return;let t=e.logLevel??Mu.logLevel;l.setLogger(Co({logLevel:t}),{logLevel:w.ALL}),l.debug("Browser SDK intialization",e);let{serviceName:r,serviceVersion:n}=e,o={...Mu,...e},i;try{i=new URL(o.otlpEndpoint)}catch{l.error(`The value "${o.otlpEndpoint}" for "otlpEndpoint" configuration is not an URL. SDK won't start.`);return}let s=Pu(o.resourceAttributes,r,n),a=ns(i,"v1/traces").href,c=new Ne(new be({url:a,headers:o.exportHeaders})),u=new xr({resource:s,sampler:new Gt(o.sampleRate),spanProcessors:[c]});u.register({contextManager:Ru});let p=ns(i,"v1/metrics").href,_=new fr({exporter:new ye({url:p,headers:o.exportHeaders})}),d=new gr({resource:s,readers:[_]});$t.setGlobalMeterProvider(d);let m=ns(i,"v1/logs").href,h=new we(new Oe({url:m,headers:o.exportHeaders})),S=new Ar({resource:s,processors:[h]});Pt.setGlobalLoggerProvider(S);let A={"@opentelemetry/instrumentation-document-load":y=>new Lr(y),"@opentelemetry/instrumentation-fetch":y=>new Cr(y),"@opentelemetry/instrumentation-long-task":y=>new Mr(y),"@opentelemetry/instrumentation-user-interaction":y=>new Ir(y),"@opentelemetry/instrumentation-xml-http-request":y=>new Ur(y),"@opentelemetry/instrumentation-web-exception":y=>new Br(y),"@opentelemetry/instrumentation-web-vitals":y=>new rs(y)},f={semconvStabilityOptIn:"http"},O=o.instrumentations||{},x=[];for(let y of Object.keys(A)){let z=O[y];(y==="@opentelemetry/instrumentation-fetch"||y==="@opentelemetry/instrumentation-xml-http-request")&&(z={...f,...z}),z?.enabled===!1||x.push(A[y](z))}return Gi({instrumentations:x}),Cu=!0,{forceFlush(){return Promise.all([u.forceFlush(),d.forceFlush(),S.forceFlush()]).then(()=>{})}}}function ns(e,t){let r=new URL(e.href);return r.pathname=(r.pathname+t).replace("//","/"),r}globalThis.startBrowserSdk=Iu;})();
12
+ `,Fi(i,t),`To resolve the conflict:
13
+ `,$i(i,t))}return n}};var zn=class{_backingStorages;constructor(t){this._backingStorages=t}record(t,r,n,o){this._backingStorages.forEach(i=>{i.record(t,r,n,o)})}};var Wn=class{_buffer=new q;_instrumentName;_valueType;constructor(t,r){this._instrumentName=t,this._valueType=r}observe(t,r={}){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===K.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}},jn=class{_buffer=new Map;observe(t,r,n={}){if(!dr(t))return;let o=this._buffer.get(t);if(o==null&&(o=new q,this._buffer.set(t,o)),typeof r!="number"){l.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===K.INT&&!Number.isInteger(r)&&(l.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||o.set(n,r)}};var Kn=class{_callbacks=[];_batchCallbacks=[];addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){let n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)}addBatchCallback(t,r){let n=new Set(r.filter(dr));if(n.size===0){l.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,n)>=0||this._batchCallbacks.push({callback:t,instruments:n})}removeBatchCallback(t,r){let n=new Set(r.filter(dr)),o=this._findBatchCallback(t,n);o<0||this._batchCallbacks.splice(o,1)}async observe(t,r){let n=this._observeCallbacks(t,r),o=this._observeBatchCallbacks(t,r);return(await Promise.allSettled([...n,...o])).filter(a=>a.status==="rejected").map(a=>a.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:n,instrument:o})=>{let i=new Wn(o._descriptor.name,o._descriptor.valueType),s=Promise.resolve(n(i));r!=null&&(s=vt(s,r)),await s,o._metricStorages.forEach(a=>{a.record(i._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let i=new jn,s=Promise.resolve(n(i));r!=null&&(s=vt(s,r)),await s,o.forEach(a=>{let c=i._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(n=>n.callback===t&&n.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(n=>n.callback===t&&ba(n.instruments,r))}};var Xn=class extends Te{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new ge(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ee(r,o),this._attributesProcessor=n}record(t,r,n,o){r=this._attributesProcessor.process(r,n),this._deltaMetricStorage.record(t,r,n,o)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};var zi=class{process(t,r){return t}},Wi=class{_processors;constructor(t){this._processors=t}process(t,r){let n=t;for(let o of this._processors)n=o.process(n,r);return n}};function Yn(){return pp}function Va(e){return new Wi(e)}var pp=new zi;var qn=class{metricStorageRegistry=new $n;observableRegistry=new Kn;meter;_meterProviderSharedState;_instrumentationScope;constructor(t,r){this.meter=new kn(this),this._meterProviderSharedState=t,this._instrumentationScope=r}registerMetricStorage(t){let r=this._registerMetricStorage(t,Xn);return r.length===1?r[0]:new zn(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,Fn)}async collect(t,r,n){let o=await this.observableRegistry.observe(r,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(t);if(i.length===0)return null;let s=[];return i.forEach(a=>{let c=a.collect(t,r);c!=null&&s.push(c)}),s.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:s},errors:o}}_registerMetricStorage(t,r){let o=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(i=>{let s=Ga(i,t),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(s);if(a!=null)return a;let c=i.aggregation.createAggregator(s),u=new r(s,c,i.attributesProcessor,this._meterProviderSharedState.metricCollectors,i.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let s=this._meterProviderSharedState.selectAggregations(t.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,t);if(u!=null)return u;let p=c.createAggregator(t),_=a.selectCardinalityLimit(t.type),f=new r(t,p,Yn(),[a],_);return this.metricStorageRegistry.registerForCollector(a,f),f});o=o.concat(s)}return o}};var Qn=class{viewRegistry=new Mn;metricCollectors=[];meterSharedStates=new Map;resource;constructor(t){this.resource=t}getMeterSharedState(t){let r=Oa(t),n=this.meterSharedStates.get(r);return n==null&&(n=new qn(this,t),this.meterSharedStates.set(r,n)),n}selectAggregations(t){let r=[];for(let n of this.metricCollectors)r.push([n,yn(n.selectAggregation(t))]);return r}};var Jn=class{_sharedState;_metricReader;constructor(t,r){this._sharedState=t,this._metricReader=r}async collect(t){let r=P(Date.now()),n=[],o=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async s=>{let a=await s.collect(this,r,t);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}selectCardinalityLimit(t){return this._metricReader.selectCardinalityLimit?.(t)??2e3}};var mp=/[\^$\\.+?()[\]{}|]/g,Se=class e{_matchAll;_regexp;constructor(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(mp,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}},Ut=class{_matchAll;_pattern;constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}};var Zn=class{_nameFilter;_type;_unitFilter;constructor(t){this._nameFilter=new Se(t?.name??"*"),this._type=t?.type,this._unitFilter=new Ut(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};var to=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(t){this._nameFilter=new Ut(t?.name),this._versionFilter=new Ut(t?.version),this._schemaUrlFilter=new Ut(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};function _p(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function dp(e){if(_p(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||Se.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}var eo=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(t){dp(t),t.attributesProcessors!=null?this.attributesProcessor=Va(t.attributesProcessors):this.attributesProcessor=Yn(),this.name=t.name,this.description=t.description,this.aggregation=yn(t.aggregation??{type:k.DEFAULT}),this.instrumentSelector=new Zn({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new to({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}};var hr=class{_sharedState;_shutdown=!1;constructor(t){if(this._sharedState=new Qn(t?.resource??Xt()),t?.views!=null&&t.views.length>0)for(let r of t.views)this._sharedState.viewRegistry.addView(new eo(r));if(t?.readers!=null&&t.readers.length>0)for(let r of t.readers){let n=new Jn(this._sharedState,r);r.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(t,r="",n={}){return this._shutdown?(l.warn("A shutdown MeterProvider cannot provide a Meter"),Ft()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter}async shutdown(t){if(this._shutdown){l.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){l.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}};var fr;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(fr||(fr={}));function Ae(e,t){let r={attributes:xt(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function Re(e){return{name:e.name,version:e.version}}function xt(e,t){return Object.keys(e).map(r=>ji(r,e[r],t))}function ji(e,t,r){return{key:e,value:Tr(t,r)}}function Tr(e,t){let r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=Tr(e[o],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){let n=Object.keys(e),o=new Array(n.length);for(let i=0;i<n.length;i++)o[i]={key:n[i],value:Tr(e[n[i]],t)};return{kvlistValue:{values:o}}}return{}}function hp(e,t){let r=Ae(e.resource,t);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:fp(e.scopeMetrics,t)}}function fp(e,t){return Array.from(e.map(r=>({scope:Re(r.scope),metrics:r.metrics.map(n=>Tp(n,t)),schemaUrl:r.scope.schemaUrl})))}function Tp(e,t){let r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=Ap(e.aggregationTemporality);switch(e.dataPointType){case H.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:ka(e,t)};break;case H.GAUGE:r.gauge={dataPoints:ka(e,t)};break;case H.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:Ep(e,t)};break;case H.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:Sp(e,t)};break}return r}function gp(e,t,r){let n={attributes:xt(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case K.INT:n.asInt=e.value;break;case K.DOUBLE:n.asDouble=e.value;break}return n}function ka(e,t){return e.dataPoints.map(r=>gp(r,e.descriptor.valueType,t))}function Ep(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:xt(r.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Sp(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:xt(r.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Ap(e){switch(e){case G.DELTA:return fr.AGGREGATION_TEMPORALITY_DELTA;case G.CUMULATIVE:return fr.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Fa(e,t){return{resourceMetrics:e.map(r=>hp(r,t))}}function Rp(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function xp(e){return Rp(e).toString()}var Op=typeof BigInt<"u"?xp:J;function $a(e){return e}var xe={encodeHrTime:Op,encodeSpanContext:$a,encodeOptionalSpanContext:$a,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}};var bp=256,wp=512;function za(e,t){let r=e&255|bp;return t&&(r|=wp),r}function Lp(e,t){let r=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:o,traceState:r.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:xt(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(i=>yp(i,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(i=>Np(i,t)),droppedLinksCount:e.droppedLinksCount,flags:za(r.traceFlags,e.parentSpanContext?.isRemote)}}function Np(e,t){return{attributes:e.attributes?xt(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:za(e.context.traceFlags,e.context.isRemote)}}function yp(e,t){return{attributes:e.attributes?xt(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Wa(e,t){return{resourceSpans:Pp(e,t)}}function Cp(e){let t=new Map;for(let r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));let o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,i=n.get(o);i||(i=[],n.set(o,i)),i.push(r)}return t}function Pp(e,t){let r=Cp(e),n=[],o=r.entries(),i=o.next();for(;!i.done;){let[s,a]=i.value,c=[],u=a.values(),p=u.next();for(;!p.done;){let m=p.value;if(m.length>0){let d=m.map(h=>Lp(h,t));c.push({scope:Re(m[0].instrumentationScope),spans:d,schemaUrl:m[0].instrumentationScope.schemaUrl})}p=u.next()}let _=Ae(s,t),f={resource:_,scopeSpans:c,schemaUrl:_.schemaUrl};n.push(f),i=o.next()}return n}function ja(e,t){return{resourceLogs:Mp(e,t)}}function Ip(e){let t=new Map;for(let r of e){let{resource:n,instrumentationScope:{name:o,version:i="",schemaUrl:s=""}}=r,a=t.get(n);a||(a=new Map,t.set(n,a));let c=`${o}@${i}:${s}`,u=a.get(c);u||(u=[],a.set(c,u)),u.push(r)}return t}function Mp(e,t){let r=Ip(e);return Array.from(r,([n,o])=>{let i=Ae(n,t);return{resource:i,scopeLogs:Array.from(o,([,s])=>({scope:Re(s[0].instrumentationScope),logRecords:s.map(a=>vp(a,t)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:i.schemaUrl}})}function vp(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:Tr(e.body,t),eventName:e.eventName,attributes:Dp(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function Dp(e,t){return Object.keys(e).map(r=>ji(r,e[r],t))}var ro={serializeRequest:e=>{let t=ja(e,xe);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return l.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}};var no={serializeRequest:e=>{let t=Fa([e],xe);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return l.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}};var oo={serializeRequest:e=>{let t=Wa(e,xe);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return l.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}};var Ki=5,Up=1e3,Bp=5e3,Gp=1.5,Ka=.2;function Hp(){return Math.random()*(2*Ka)-Ka}var Xi=class{_transport;constructor(t){this._transport=t}retry(t,r,n){return new Promise((o,i)=>{setTimeout(()=>{this._transport.send(t,r).then(o,i)},n)})}async send(t,r){let n=Ki,o=Up,i=Date.now()+r,s=await this._transport.send(t,r);for(;s.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(o*(1+Hp()),Bp),0);o=o*Gp;let c=s.retryInMillis??a,u=i-Date.now();if(c>u)return l.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(u)}ms, not retrying further.`),s;l.verbose(`Scheduling export retry in ${Math.round(c)}ms`),s=await this.retry(t,u,c)}return s.status==="success"?l.verbose(`Export succeeded after ${Ki-n} retry attempts.`):s.status==="retryable"?l.info(`Export failed after maximum retry attempts (${Ki}).`):l.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}};function Xa(e){return new Xi(e.transport)}function Ya(e){return e===429||e===502||e===503||e===504}function qa(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let r=new Date(e).getTime()-Date.now();return r>=0?r:0}var Vp=60*1024,kp=9,Yi=0,io=0,qi=class{_parameters;constructor(t){this._parameters=t}async send(t,r){let n=new AbortController,o=setTimeout(()=>n.abort(),r),i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);let s=t.byteLength,a=Yi+s>Vp,c=io>=kp,u=!a&&!c;if(u)Yi+=s,io++;else{let p=a?"size limit":"count limit";l.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${io} pending (${p})`)}try{let p=new URL(this._parameters.url),_=await i(p.href,{method:"POST",headers:await this._parameters.headers(),body:t,signal:n.signal,keepalive:u,mode:globalThis.location?globalThis.location.origin===p.origin?"same-origin":"cors":"no-cors"});if(_.status>=200&&_.status<=299)return l.debug(`export response success (status: ${_.status})`),{status:"success"};if(Ya(_.status)){l.warn(`export response retryable (status: ${_.status})`);let f=_.headers.get("Retry-After");return{status:"retryable",retryInMillis:qa(f)}}return l.error(`export response failure (status: ${_.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${_.status}`)}}catch(p){return Fp(p)?(l.warn(`export request retryable (network error: ${p})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:p})}):(l.error(`export request failure (error: ${p})`),{status:"failure",error:new Error("Fetch request errored",{cause:p})})}finally{clearTimeout(o),u&&(Yi-=s,io--)}}shutdown(){}};function Qa(e){return new qi(e)}function Fp(e){return e instanceof TypeError&&!e.cause}function Ja(e,t){return xa(e,t,Xa({transport:Qa(e)}))}function Za(e){let t={};return Object.entries(e??{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):l.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}function $p(e,t,r){return async()=>{let n={...await r()},o={};return t!=null&&Object.assign(o,await t()),e!=null&&Object.assign(o,Za(await e())),Object.assign(o,n)}}function zp(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function tc(e,t,r){return{...js(e,t,r),headers:$p(e.headers,t.headers,r.headers),url:zp(e.url)??t.url??r.url}}function ec(e,t){return{...Ks(),headers:async()=>e,url:"http://localhost:4318/"+t}}function rc(e){return typeof e.headers=="function"?e.headers:Ws(e.headers)}function nc(e,t,r){return tc({url:e.url,timeoutMillis:e.timeoutMillis,headers:rc(e),concurrencyLimit:e.concurrencyLimit},{},ec(r,t))}function Yt(e,t,r,n){let o=nc(e,r,n);return Ja(o,t)}var Oe=class extends At{constructor(t={}){super(Yt(t,ro,"v1/logs",{"Content-Type":"application/json"}))}};var gr;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(gr||(gr={}));var Qi=()=>G.CUMULATIVE,oc=e=>{switch(e){case T.COUNTER:case T.OBSERVABLE_COUNTER:case T.GAUGE:case T.HISTOGRAM:case T.OBSERVABLE_GAUGE:return G.DELTA;case T.UP_DOWN_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:return G.CUMULATIVE}},ic=e=>{switch(e){case T.COUNTER:case T.HISTOGRAM:return G.DELTA;case T.GAUGE:case T.UP_DOWN_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:case T.OBSERVABLE_COUNTER:case T.OBSERVABLE_GAUGE:return G.CUMULATIVE}};function Wp(){let e=(void 0??"cumulative").toLowerCase();return e==="cumulative"?Qi:e==="delta"?oc:e==="lowmemory"?ic:(l.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Qi)}function jp(e){return e!=null?e===gr.DELTA?oc:e===gr.LOWMEMORY?ic:Qi:Wp()}var Kp=Object.freeze({type:k.DEFAULT});function Xp(e){return e?.aggregationPreference??(()=>Kp)}var so=class extends At{_aggregationTemporalitySelector;_aggregationSelector;constructor(t,r){super(t),this._aggregationSelector=Xp(r),this._aggregationTemporalitySelector=jp(r?.temporalityPreference)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}};var be=class extends so{constructor(t){super(Yt(t??{},no,"v1/metrics",{"Content-Type":"application/json"}),t)}};var we=class extends At{constructor(t={}){super(Yt(t,oo,"v1/traces",{"Content-Type":"application/json"}))}};function sc(e){return Ji(e,new WeakSet)}function Ji(e,t){if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Uint8Array)return!0;if(typeof e=="object"){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(n=>Ji(n,t));let r=e;return r.constructor!==Object&&r.constructor!==void 0?!1:Object.values(r).every(n=>Ji(n,t))}return!1}var ao=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(t){this._isLogRecordReadonly()||(this._severityText=t)}get severityText(){return this._severityText}set severityNumber(t){this._isLogRecordReadonly()||(this._severityNumber=t)}get severityNumber(){return this._severityNumber}set body(t){this._isLogRecordReadonly()||(this._body=t)}get body(){return this._body}get eventName(){return this._eventName}set eventName(t){this._isLogRecordReadonly()||(this._eventName=t)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(t,r,n){let{timestamp:o,observedTimestamp:i,eventName:s,severityNumber:a,severityText:c,body:u,attributes:p={},exception:_,context:f}=n,m=Date.now();if(this.hrTime=ct(o??m),this.hrTimeObserved=ct(i??m),f){let d=A.getSpanContext(f);d&&z(d)&&(this.spanContext=d)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this._eventName=s,this.setAttributes(p),_!=null&&this._setException(_)}setAttribute(t,r){if(this._isLogRecordReadonly())return this;if(t.length===0)return l.warn(`Invalid attribute key: ${t}`),this;if(!sc(r))return l.warn(`Invalid attribute value set for key: ${t}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&l.warn("Dropping extra attributes."),this):(this.attributes[t]=this._truncateToSize(r),n&&this._attributesCount++,this)}setAttributes(t){for(let[r,n]of Object.entries(t))this.setAttribute(r,n);return this}setBody(t){return this.body=t,this}setEventName(t){return this.eventName=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(t){let r=this._logRecordLimits.attributeValueLengthLimit;if(r<=0)return l.warn(`Attribute value limit must be positive, got ${r}`),t;if(t==null)return t;if(typeof t=="string")return this._truncateToLimitUtil(t,r);if(t instanceof Uint8Array)return t;if(Array.isArray(t))return t.map(n=>this._truncateToSize(n));if(typeof t=="object"){let n={};for(let[o,i]of Object.entries(t))n[o]=this._truncateToSize(i);return n}return t}_setException(t){let r=!1;if(typeof t=="string"||typeof t=="number")Object.hasOwn(this.attributes,Q)||this.setAttribute(Q,String(t)),r=!0;else if(t&&typeof t=="object"){let n=t;n.code?(Object.hasOwn(this.attributes,et)||this.setAttribute(et,n.code.toString()),r=!0):n.name&&(Object.hasOwn(this.attributes,et)||this.setAttribute(et,n.name),r=!0),n.message&&(Object.hasOwn(this.attributes,Q)||this.setAttribute(Q,n.message),r=!0),n.stack&&(Object.hasOwn(this.attributes,jt)||this.setAttribute(jt,n.stack),r=!0)}r||l.warn(`Failed to record an exception ${t}`)}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&l.warn("Can not execute the operation on emitted log record"),this._isReadonly}};var co=class{instrumentationScope;_sharedState;_loggerConfig;constructor(t,r){this.instrumentationScope=t,this._sharedState=r,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(t){let r=this._loggerConfig,n=t.context||E.active(),o=t.severityNumber??Y.UNSPECIFIED;if(o!==Y.UNSPECIFIED&&o<r.minimumSeverity)return;if(r.traceBased){let s=A.getSpanContext(n);if(s&&z(s)&&!((s.traceFlags&w.SAMPLED)===w.SAMPLED))return}let i=new ao(this._sharedState,this.instrumentationScope,{context:n,...t});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(t){let r=this._loggerConfig;if(r.disabled)return!1;let n=t?.severityNumber;if(typeof n=="number"&&n!==Y.UNSPECIFIED&&n<r.minimumSeverity)return!1;let o=t?.context||E.active();if(r.traceBased){let s=A.getSpanContext(o);if(s&&z(s)&&!((s.traceFlags&w.SAMPLED)===w.SAMPLED))return!1}let i={context:o,instrumentationScope:this.instrumentationScope,severityNumber:t?.severityNumber,eventName:t?.eventName};for(let s of this._sharedState.processors)if(!s.enabled||s.enabled(i))return!0;return!1}};var uo=class{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}enabled(t){return!1}};var lo=class{processors;forceFlushTimeoutMillis;constructor(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>Oi(r.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(n=>n.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(t=>t.shutdown()))}enabled(t){for(let r of this.processors)if(!r.enabled||r.enabled(t))return!0;return!1}};function ac(e){return`${e.name}@${e.version||""}:${e.schemaUrl||""}`}var cc="otel.sdk.log.created";var po=class{createdLogs;constructor(t){this.createdLogs=t.createCounter(cc,{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}};var uc="0.215.0";var Yp={disabled:!1,minimumSeverity:Y.UNSPECIFIED,traceBased:!1},Zi=()=>({...Yp}),mo=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(t,r,n,o,i,s){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new lo(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new uo,this._loggerConfigurator=i??Zi;let a=s?s.getMeter("@opentelemetry/sdk-logs",uc):Ft();this.loggerMetrics=new po(a)}getLoggerConfig(t){let r=ac(t),n=this._loggerConfigs.get(r);return n||(n=this._loggerConfigurator(t),this._loggerConfigs.set(r,n),n)}};var qp="unknown",Er=class{_shutdownOnce;_sharedState;constructor(t={}){let r={resource:t.resource??Xt(),forceFlushTimeoutMillis:t.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:t.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:t.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:t.loggerConfigurator??Zi,processors:t.processors??[],meterProvider:t.meterProvider};this._sharedState=new mo(r.resource,r.forceFlushTimeoutMillis,r.logRecordLimits,r.processors,r.loggerConfigurator,r.meterProvider),this._shutdownOnce=new Rt(this._shutdown,this)}getLogger(t,r,n){if(this._shutdownOnce.isCalled)return l.warn("A shutdown LoggerProvider cannot provide a Logger"),ze;t||l.warn("Logger requested without instrumentation scope name.");let o=t||qp,i=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new co({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(l.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(l.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};async function Qp(e){let t=[];for(let r=0,n=e.length;r<n;r++){let o=e[r];o.resource.asyncAttributesPending&&o.resource.waitForAsyncAttributes&&t.push(o.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var _o=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(t,r,n){this._exportScheduledPromise=new Promise(o=>{this._exportScheduledResolve=o}),this._exportCompleted=this._executeExport(t,r,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(t,r,n){try{await Qp(r),await E.with(zt(E.active()),async()=>this._exportWithTimeout(t,r,n))}catch(o){C(o),this._exportScheduledResolve()}}async _exportWithTimeout(t,r,n){return new Promise((o,i)=>{let s=setTimeout(()=>{i(new Error("Timeout"))},n);t.export(r,a=>{clearTimeout(s),a.code===U.SUCCESS?o():i(a.error??new Error("BatchLogRecordProcessor: log record export failed"))}),this._exportScheduledResolve()})}},ho=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(t,r){this._exporter=t,this._maxExportBatchSize=r?.maxExportBatchSize??512,this._maxQueueSize=r?.maxQueueSize??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??3e4,this._shutdownOnce=new Rt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(t){this._shutdownOnce.isCalled||this._addToBuffer(t)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),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 t=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);t.length>0;){let r;t.length<=this._maxExportBatchSize?(r=t,t=[]):r=t.splice(0,this._maxExportBatchSize);let n=new _o(this._exporter,r,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(o){C(o)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let t=this._finishedLogRecords;return this._finishedLogRecords=[],t}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let t=this._extractBatch();if(t===null)return;let r=new _o(this._exporter,t,this._exportTimeoutMillis);this._currentExport=r,r.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(n=>{this._currentExport=null,C(n),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};var Le=class extends ho{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this._onInit(r)}onShutdown(){typeof document>"u"||(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}_onInit(t){t?.disableAutoFlushOnDocumentHide===!0||typeof document>"u"||(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}};var lc="exception";var fo=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:X.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let r=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=N.now(),this._performanceOffset=r-(this._performanceStartTime+N.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let n of t.links)this.addLink(n);this.startTime=this._getTime(t.startTime??r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return l.warn(`Invalid attribute key: ${t}`),this;if(!an(r))return l.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:n}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&o?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),o&&this._attributesCount++,this)}setAttributes(t){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.setAttribute(r,t[r]);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return l.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&l.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),dn(r)&&(dn(n)||(n=r),r=void 0);let i=Pt(r),{attributePerEventCountLimit:s}=this._spanLimits,a={},c=0,u=0;for(let p in i){if(!Object.prototype.hasOwnProperty.call(i,p))continue;let _=i[p];if(s!==void 0&&u>=s){c++;continue}a[p]=this._truncateToSize(_),u++}return this.events.push({name:t,attributes:a,time:this._getTime(n),droppedAttributesCount:c}),this}addLink(t){if(this._isSpanEnded())return this;let{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&l.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,o=Pt(t.attributes),i={},s=0,a=0;for(let u in o){if(!Object.prototype.hasOwnProperty.call(o,u))continue;let p=o[u];if(n!==void 0&&a>=n){s++;continue}i[u]=this._truncateToSize(p),a++}let c={context:t.context};return a>0&&(c.attributes=i),s>0&&(c.droppedAttributesCount=s),this.links.push(c),this}addLinks(t){for(let r of t)this.addLink(r);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===X.UNSET)return this;if(this.status.code===X.OK)return this;let r={code:t.code};return t.code===X.ERROR&&(typeof t.message=="string"?r.message=t.message:t.message!=null&&l.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=r,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){l.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=Ei(this.startTime,this.endTime),this._duration[0]<0&&(l.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&&l.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&l.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(t){if(typeof t=="number"&&t<=N.now())return I(t+this._performanceOffset);if(typeof t=="number")return P(t);if(t instanceof Date)return P(t.getTime());if(Ze(t))return t;if(this._startTimeProvided)return P(Date.now());let r=N.now()-this._performanceStartTime;return hn(this.startTime,P(r))}isRecording(){return this._ended===!1}recordException(t,r){let n={};typeof t=="string"?n[Q]=t:t&&(t.code?n[et]=t.code.toString():t.name&&(n[et]=t.name),t.message&&(n[Q]=t.message),t.stack&&(n[jt]=t.stack)),n[et]||n[Q]?this.addEvent(lc,n,r):l.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);l.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_truncateToSize(t){let r=this._attributeValueLengthLimit;return r<=0?(l.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):t}};var W;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(W||(W={}));var Bt=class{shouldSample(){return{decision:W.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};var pt=class{shouldSample(){return{decision:W.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};var qt=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(C(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new pt),this._remoteParentSampled=t.remoteParentSampled??new pt,this._remoteParentNotSampled=t.remoteParentNotSampled??new Bt,this._localParentSampled=t.localParentSampled??new pt,this._localParentNotSampled=t.localParentNotSampled??new Bt}shouldSample(t,r,n,o,i,s){let a=A.getSpanContext(t);return!a||!z(a)?this._root.shouldSample(t,r,n,o,i,s):a.isRemote?a.traceFlags&w.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,o,i,s):this._remoteParentNotSampled.shouldSample(t,r,n,o,i,s):a.traceFlags&w.SAMPLED?this._localParentSampled.shouldSample(t,r,n,o,i,s):this._localParentNotSampled.shouldSample(t,r,n,o,i,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};var Gt=class{_ratio;_upperBound;constructor(t=0){this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:Yr(r)&&this._accumulate(r)<this._upperBound?W.RECORD_AND_SAMPLED:W.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<t.length/8;n++){let o=n*8,i=parseInt(t.slice(o,o+8),16);r=(r^i)>>>0}return r}};var mt;(function(e){e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(mt||(mt={}));var To=1;function go(){return{sampler:ts(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128},spanLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128,linkCountLimit:void 0??128,eventCountLimit:void 0??128,attributePerEventCountLimit:void 0??128,attributePerLinkCountLimit:void 0??128}}}function ts(){let e=void 0??mt.ParentBasedAlwaysOn;switch(e){case mt.AlwaysOn:return new pt;case mt.AlwaysOff:return new Bt;case mt.ParentBasedAlwaysOn:return new qt({root:new pt});case mt.ParentBasedAlwaysOff:return new qt({root:new Bt});case mt.TraceIdRatio:return new Gt(pc());case mt.ParentBasedTraceIdRatio:return new qt({root:new Gt(pc())});default:return l.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${mt.ParentBasedAlwaysOn}".`),new qt({root:new pt})}}function pc(){let e=void 0;return e==null?(l.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${To}.`),To):e<0||e>1?(l.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${To}.`),To):e}var Jp=128,Zp=1/0;function mc(e){let t={sampler:ts()},r=go(),n=Object.assign({},r,t,e);return n.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),n}function _c(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??Jp,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??Zp,Object.assign({},e,{spanLimits:t})}var Eo=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,r){this._exporter=t,this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:void 0??512,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:void 0??2048,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:void 0??5e3,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:void 0??3e4,this._shutdownOnce=new Rt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&w.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&l.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(l.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{let n=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,s=o;i<s;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{let n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);E.with(zt(E.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(o,a=>{clearTimeout(n),a.code===U.SUCCESS?t():r(a.error??new Error("BatchSpanProcessor: span export failed"))}),s=null;for(let a=0,c=o.length;a<c;a++){let u=o[a];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(s??=[],s.push(u.resource.waitForAsyncAttributes()))}s===null?i():Promise.all(s).then(i,a=>{C(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,C(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};var Ne=class extends Eo{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this.onInit(r)}onInit(t){t?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(r=>{C(r)})},this._pageHideListener=()=>{this.forceFlush().catch(r=>{C(r)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}};var dc=new Uint8Array(16),hc=new Uint8Array(8),tm=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function fc(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Tc(e){let t="";for(let r=0;r<e.length;r++)t+=tm[e[r]];return t}var ye=class{generateTraceId(){return fc(dc),Tc(dc)}generateSpanId(){return fc(hc),Tc(hc)}};var gc="otel.span.parent.origin",es="otel.span.sampling_result",Ec="otel.sdk.span.live",Sc="otel.sdk.span.started";var So=class{startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(Sc,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(Ec,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){let n=rm(r);if(this.startedSpans.add(1,{[gc]:em(t),[es]:n}),r===W.NOT_RECORD)return()=>{};let o={[es]:n};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};function em(e){return e?e.isRemote?"remote":"local":"none"}function rm(e){switch(e){case W.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case W.RECORD:return"RECORD_ONLY";case W.NOT_RECORD:return"DROP"}}var Ac="2.7.0";var Ao=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,r,n,o){let i=mc(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new ye,this._resource=n,this._spanProcessor=o,this.instrumentationScope=t;let s=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",Ac):Ft();this._tracerMetrics=new So(s)}startSpan(t,r={},n=E.active()){r.root&&(n=A.deleteSpan(n));let o=A.getSpan(n);if(Wt(n))return l.debug("Instrumentation suppressed, returning Noop Span"),A.wrapSpanContext(ke);let i=o?.spanContext(),s=this._idGenerator.generateSpanId(),a,c,u;!i||!A.isSpanContextValid(i)?c=this._idGenerator.generateTraceId():(c=i.traceId,u=i.traceState,a=i);let p=r.kind??Et.INTERNAL,_=(r.links??[]).map(V=>({context:V.context,attributes:Pt(V.attributes)})),f=Pt(r.attributes),m=this._sampler.shouldSample(n,c,t,p,f,_),d=this._tracerMetrics.startSpan(i,m.decision);u=m.traceState??u;let h=m.decision===oe.RECORD_AND_SAMPLED?w.SAMPLED:w.NONE,g={traceId:c,spanId:s,traceFlags:h,traceState:u};if(m.decision===oe.NOT_RECORD)return l.debug("Recording is off, propagating context in a non-recording span"),A.wrapSpanContext(g);let b=Pt(Object.assign(f,m.attributes));return new fo({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:g,name:t,kind:p,links:_,parentSpanContext:a,attributes:b,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:d})}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??E.active(),u=this.startSpan(t,i,c),p=A.setSpan(c,u);return E.with(p,a,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};var Ro=class{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(n=>{C(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(let n of this._spanProcessors)n.onStart(t,r)}onEnding(t){for(let r of this._spanProcessors)r.onEnding&&r.onEnding(t)}onEnd(t){for(let r of this._spanProcessors)r.onEnd(t)}shutdown(){let t=[];for(let r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,n)=>{Promise.all(t).then(()=>{r()},n)})}};var Qt;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Qt||(Qt={}));var Sr=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){let r=xi({},go(),_c(t));this._resource=r.resource??Xt(),this._config=Object.assign({},r,{resource:this._resource});let n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new Ro(n)}getTracer(t,r,n){let o=`${t}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new Ao({name:t,version:r,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let t=this._config.forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(o=>{let i,s=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${t} ms`)),i=Qt.timeout},t);n.forceFlush().then(()=>{clearTimeout(s),i!==Qt.timeout&&(i=Qt.resolved,o(i))}).catch(a=>{clearTimeout(s),i=Qt.error,o(a)})}));return new Promise((n,o)=>{Promise.all(r).then(i=>{let s=i.filter(a=>a!==Qt.resolved);s.length>0?o(s):n()}).catch(i=>o([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};var xo=class{_enabled=!1;_currentContext=B;_bindFunction(t=B,r){let n=this,o=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),o}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=B,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=B,this)}with(t,r,n,...o){let i=this._currentContext;this._currentContext=t||B;try{return r.call(n,...o)}finally{this._currentContext=i}}};function nm(e){if(e!==null){if(e===void 0){let t=new xo;t.enable(),E.setGlobalContextManager(t);return}e.enable(),E.setGlobalContextManager(e)}}function om(e){if(e!==null){if(e===void 0){D.setGlobalPropagator(new tr({propagators:[new er,new Xe]}));return}D.setGlobalPropagator(e)}}var Ar=class extends Sr{constructor(t={}){super(t)}register(t={}){A.setGlobalTracerProvider(this),om(t.propagator),nm(t.contextManager)}};var S;(function(e){e.CONNECT_END="connectEnd",e.CONNECT_START="connectStart",e.DECODED_BODY_SIZE="decodedBodySize",e.DOM_COMPLETE="domComplete",e.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",e.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",e.DOM_INTERACTIVE="domInteractive",e.DOMAIN_LOOKUP_END="domainLookupEnd",e.DOMAIN_LOOKUP_START="domainLookupStart",e.ENCODED_BODY_SIZE="encodedBodySize",e.FETCH_START="fetchStart",e.LOAD_EVENT_END="loadEventEnd",e.LOAD_EVENT_START="loadEventStart",e.NAVIGATION_START="navigationStart",e.REDIRECT_END="redirectEnd",e.REDIRECT_START="redirectStart",e.REQUEST_START="requestStart",e.RESPONSE_END="responseEnd",e.RESPONSE_START="responseStart",e.SECURE_CONNECTION_START="secureConnectionStart",e.START_TIME="startTime",e.UNLOAD_EVENT_END="unloadEventEnd",e.UNLOAD_EVENT_START="unloadEventStart"})(S||(S={}));var Rc="http.response_content_length",xc="http.response_content_length_uncompressed";var rs;function im(){return rs||(rs=document.createElement("a")),rs}function Ot(e,t){return t in e}function L(e,t,r,n=!0){if(Ot(r,t)&&typeof r[t]=="number"&&!(n&&r[t]===0))return e.addEvent(t,r[t])}function _t(e,t,r=!1,n,o){if(n===void 0&&(n=t[S.START_TIME]!==0),r||(L(e,S.FETCH_START,t,n),L(e,S.DOMAIN_LOOKUP_START,t,n),L(e,S.DOMAIN_LOOKUP_END,t,n),L(e,S.CONNECT_START,t,n),L(e,S.SECURE_CONNECTION_START,t,n),L(e,S.CONNECT_END,t,n),L(e,S.REQUEST_START,t,n),L(e,S.RESPONSE_START,t,n),L(e,S.RESPONSE_END,t,n)),!o){let i=t[S.ENCODED_BODY_SIZE];i!==void 0&&e.setAttribute(Rc,i);let s=t[S.DECODED_BODY_SIZE];s!==void 0&&i!==s&&e.setAttribute(xc,s)}}function Oc(e){return e.slice().sort((t,r)=>{let n=t[S.FETCH_START],o=r[S.FETCH_START];return n>o?1:n<o?-1:0})}function bc(){return typeof location<"u"?location.origin:void 0}function Rr(e,t,r,n,o=new WeakSet,i){let s=tt(e);e=s.toString();let a=am(e,t,r,n,o,i);if(a.length===0)return{mainRequest:void 0};if(a.length===1)return{mainRequest:a[0]};let c=Oc(a);if(s.origin!==bc()&&c.length>1){let u=c[0],p=sm(c,u[S.RESPONSE_END],r),_=u[S.RESPONSE_END];return p[S.FETCH_START]<_&&(p=u,u=void 0),{corsPreFlightRequest:u,mainRequest:p}}else return{mainRequest:a[0]}}function sm(e,t,r){let n=J(r),o=J(ct(t)),i=e[1],s,a=e.length;for(let c=1;c<a;c++){let u=e[c],p=J(ct(u[S.FETCH_START])),_=J(ct(u[S.RESPONSE_END])),f=n-_;p>=o&&(!s||f<s)&&(s=f,i=u)}return i}function am(e,t,r,n,o,i){let s=J(t),a=J(r),c=n.filter(u=>{let p=J(ct(u[S.FETCH_START])),_=J(ct(u[S.RESPONSE_END]));return u.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&u.name===e&&p>=s&&_<=a});return c.length>0&&(c=c.filter(u=>!o.has(u))),c}function tt(e){if(typeof URL=="function")return new URL(e,typeof document<"u"?document.baseURI:typeof location<"u"?location.href:void 0);let t=im();return t.href=e,t}function Oo(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return"/";let r=um(e,t);if(t&&r.indexOf("@id")>0)return r;let n="";return e.parentNode&&(n+=Oo(e.parentNode,t)),n+=r,n}function cm(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let r=Array.from(e.parentNode.childNodes);return r=r.filter(n=>{let o=n.localName;return t.indexOf(n.nodeType)>=0&&o===e.localName}),r.length>=1?r.indexOf(e)+1:0}function um(e,t){let r=e.nodeType,n=cm(e),o="";if(r===Node.ELEMENT_NODE){let i=e.getAttribute("id");if(t&&i)return`//*[@id="${i}"]`;o=e.localName}else if(r===Node.TEXT_NODE||r===Node.CDATA_SECTION_NODE)o="text()";else if(r===Node.COMMENT_NODE)o="comment()";else return"";return o&&n>1?`/${o}[${n}]`:`/${o}`}function xr(e,t){let r=t||[];return(typeof r=="string"||r instanceof RegExp)&&(r=[r]),tt(e).origin===bc()?!0:r.some(o=>An(e,o))}function wc(e,t,r,n){for(let o=0,i=e.length;o<i;o++){let s=e[o];t&&s.setTracerProvider(t),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function Lc(e){e.forEach(t=>t.disable())}function ns(e){let t=e.tracerProvider||A.getTracerProvider(),r=e.meterProvider||$t.getMeterProvider(),n=e.loggerProvider||Ct.getLoggerProvider(),o=e.instrumentations?.flat()??[];return wc(o,t,r,n),()=>{Lc(o)}}var F=console.error.bind(console);function Or(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var bo=(e,t,r)=>{if(!e||!e[t]){F("no original function "+String(t)+" to wrap");return}if(!r){F("no wrapper function"),F(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){F("original object and wrapper must be functions");return}let o=r(n,t);return Or(o,"__original",n),Or(o,"__unwrap",()=>{e[t]===o&&Or(e,t,n)}),Or(o,"__wrapped",!0),Or(e,t,o),o},os=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{F("must provide one or more modules to patch"),F(new Error().stack);return}if(!(t&&Array.isArray(t))){F("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(o=>{bo(n,o,r)})})},wo=(e,t)=>{if(!e||!e[t]){F("no function to unwrap."),F(new Error().stack);return}let r=e[t];if(!r.__unwrap)F("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},is=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{F("must provide one or more modules to patch"),F(new Error().stack);return}if(!(t&&Array.isArray(t))){F("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{wo(r,n)})})};function br(e){e&&e.logger&&(typeof e.logger!="function"?F("new logger isn't a function, not replacing"):F=e.logger)}br.wrap=bo;br.massWrap=os;br.unwrap=wo;br.massUnwrap=is;var Lo=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,r,n){this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=l.createComponentLogger({namespace:t}),this._tracer=A.getTracer(t,r),this._meter=$t.getMeter(t,r),this._logger=Ct.getLogger(t,r),this._updateMetricInstruments()}_wrap=bo;_unwrap=wo;_massWrap=os;_massUnwrap=is;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,o){if(t)try{t(n,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}};var M=class extends Lo{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}};function rt(e,t,r){let n,o;try{o=e()}catch(i){n=i}finally{if(t(n,o),n&&!r)throw n;return o}}function No(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var R;(function(e){e[e.STABLE=1]="STABLE",e[e.OLD=2]="OLD",e[e.DUPLICATE=3]="DUPLICATE"})(R||(R={}));function Jt(e,t){let r=R.OLD,n=t?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of n??[])if(o.toLowerCase()===e+"/dup"){r=R.DUPLICATE;break}else o.toLowerCase()===e&&(r=R.STABLE);return r}var Zt;(function(e){e.DOCUMENT_LOAD="documentLoad",e.DOCUMENT_FETCH="documentFetch",e.RESOURCE_FETCH="resourceFetch"})(Zt||(Zt={}));var Nc="0.60.0",yc="@opentelemetry/instrumentation-document-load";var yo="http.url",Cc="http.user_agent";var wr;(function(e){e.FIRST_PAINT="firstPaint",e.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"})(wr||(wr={}));var Ic=()=>{let e={},t=N.getEntriesByType?.("navigation")[0];if(t)Object.values(S).forEach(n=>{if(Ot(t,n)){let o=t[n];typeof o=="number"&&(e[n]=o)}});else{let n=N.timing;n&&Object.values(S).forEach(i=>{if(Ot(n,i)){let s=n[i];typeof s=="number"&&(e[i]=s)}})}return e},Pc={"first-paint":wr.FIRST_PAINT,"first-contentful-paint":wr.FIRST_CONTENTFUL_PAINT},Mc=e=>{let t=N.getEntriesByType?.("paint");t&&t.forEach(({name:r,startTime:n})=>{Ot(Pc,r)&&e.addEvent(Pc[r],n)})};var Lr=class extends M{component="document-load";version="1";moduleName=this.component;_semconvStability;constructor(t={}){super(yc,Nc,t),this._semconvStability=Jt("http",t?.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(t){let r=N.getEntriesByType?.("resource");r&&r.forEach(n=>{this._initResourceSpan(n,t)})}_collectPerformance(){let t=Array.from(document.getElementsByTagName("meta")).find(o=>o.getAttribute("name")===ce),r=Ic(),n=t&&t.content||"";E.with(D.extract(B,{traceparent:n}),()=>{let o=this._startSpan(Zt.DOCUMENT_LOAD,S.FETCH_START,r);o&&(E.with(A.setSpan(E.active(),o),()=>{let i=this._startSpan(Zt.DOCUMENT_FETCH,S.FETCH_START,r);i&&(this._semconvStability&R.OLD&&i.setAttribute(yo,location.href),this._semconvStability&R.STABLE&&i.setAttribute(It,location.href),E.with(A.setSpan(E.active(),i),()=>{let s=!(this._semconvStability&R.OLD);_t(i,r,this.getConfig().ignoreNetworkEvents,void 0,s),this._addCustomAttributesOnSpan(i,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(i,S.RESPONSE_END,r)}))}),this._semconvStability&R.OLD&&(o.setAttribute(yo,location.href),o.setAttribute(Cc,navigator.userAgent)),this._semconvStability&R.STABLE&&(o.setAttribute(It,location.href),o.setAttribute(oa,navigator.userAgent)),this._addResourcesSpans(o),this.getConfig().ignoreNetworkEvents||(L(o,S.FETCH_START,r),L(o,S.UNLOAD_EVENT_START,r),L(o,S.UNLOAD_EVENT_END,r),L(o,S.DOM_INTERACTIVE,r),L(o,S.DOM_CONTENT_LOADED_EVENT_START,r),L(o,S.DOM_CONTENT_LOADED_EVENT_END,r),L(o,S.DOM_COMPLETE,r),L(o,S.LOAD_EVENT_START,r),L(o,S.LOAD_EVENT_END,r)),this.getConfig().ignorePerformancePaintEvents||Mc(o),this._addCustomAttributesOnSpan(o,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(o,S.LOAD_EVENT_END,r))})}_endSpan(t,r,n){t&&(Ot(n,r)?t.end(n[r]):t.end())}_initResourceSpan(t,r){let n=this._startSpan(Zt.RESOURCE_FETCH,S.FETCH_START,t,r);if(n){this._semconvStability&R.OLD&&n.setAttribute(yo,t.name),this._semconvStability&R.STABLE&&n.setAttribute(It,t.name);let o=!(this._semconvStability&R.OLD);_t(n,t,this.getConfig().ignoreNetworkEvents,void 0,o),this._addCustomAttributesOnResourceSpan(n,t,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,S.RESPONSE_END,t)}}_startSpan(t,r,n,o){if(Ot(n,r)&&typeof n[r]=="number")return this.tracer.startSpan(t,{startTime:n[r]},o?A.setSpan(E.active(),o):void 0)}_waitForPageLoad(){window.document.readyState==="complete"?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(t,r){r&&rt(()=>r(t),n=>{n&&this._diag.error("addCustomAttributesOnSpan",n)},!0)}_addCustomAttributesOnResourceSpan(t,r,n){n&&rt(()=>n(t,r),o=>{o&&this._diag.error("addCustomAttributesOnResourceSpan",o)},!0)}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}};var Nr;(function(e){e.COMPONENT="component",e.HTTP_STATUS_TEXT="http.status_text"})(Nr||(Nr={}));var vc="http.host",Dc="http.method",Uc="http.request.body.size",Bc="http.request_content_length_uncompressed";var Gc="http.scheme",Hc="http.status_code",Vc="http.url",kc="http.user_agent";var Fc=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function $c(...e){if(e[0]instanceof URL||typeof e[0]=="string"){let t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){let{body:r,length:n}=mm(t.body);return t.body=r,n}else return Promise.resolve(dm(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(r=>ss(r)):Promise.resolve()}}function mm(e){if(!e.pipeThrough)return Fc.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t=0,r,n=new Promise(i=>{r=i}),o=new TransformStream({start(){},async transform(i,s){let a=await i;t+=a.byteLength,s.enqueue(i)},flush(){r(t)}});return{body:e.pipeThrough(o),length:n}}function _m(e){return typeof Document<"u"&&e instanceof Document}function dm(e){if(_m(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return ss(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return fm(e);if(e instanceof URLSearchParams)return ss(e.toString());if(e.byteLength!==void 0)return e.byteLength;Fc.warn("unknown body type")}var hm=new TextEncoder;function ss(e){return hm.encode(e).byteLength}function fm(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function zc(e){let t=gm(),r=e.toUpperCase();return r in t?r:"_OTHER"}var Tm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},yr;function gm(){if(yr===void 0){let e=void 0;e&&e.length>0?(yr={},e.forEach(t=>{yr[t]=!0})):yr=Tm}return yr}var Em={"https:":"443","http:":"80"};function Wc(e){let t=Number(e.port||Em[e.protocol]);if(t&&!isNaN(t))return t}var as="0.215.0";var Sm=300,jc=typeof PerformanceObserver<"u",Cr=class extends M{component="fetch";version=as;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-fetch",as,t),this._semconvStability=Jt("http",t?.semconvStabilityOptIn)}init(){}_addChildSpan(t,r){let n=this.tracer.startSpan("CORS Preflight",{startTime:r[S.FETCH_START]},A.setSpan(E.active(),t)),o=!(this._semconvStability&R.OLD);_t(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[S.RESPONSE_END])}_addFinalSpanAttributes(t,r){let n=tt(r.url);if(this._semconvStability&R.OLD&&(t.setAttribute(Hc,r.status),r.statusText!=null&&t.setAttribute(Nr.HTTP_STATUS_TEXT,r.statusText),t.setAttribute(vc,n.host),t.setAttribute(Gc,n.protocol.replace(":","")),typeof navigator<"u"&&t.setAttribute(kc,navigator.userAgent)),this._semconvStability&R.STABLE){t.setAttribute(ln,r.status),t.setAttribute(pn,n.hostname);let o=Wc(n);o&&t.setAttribute(mn,o)}}_addHeaders(t,r){if(!xr(r,this.getConfig().propagateTraceHeaderCorsUrls)){let n={};D.inject(E.active(),n),Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}if(t instanceof Request)D.inject(E.active(),t.headers,{set:(n,o,i)=>n.set(o,typeof i=="string"?i:String(i))});else{let n=new Headers(t.headers);D.inject(E.active(),n,{set:(o,i,s)=>o.set(i,typeof s=="string"?s:String(s))}),t.headers=n}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,r={}){if(nr(t,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let n="",o={};if(this._semconvStability&R.OLD){let i=(r.method||"GET").toUpperCase();n=`HTTP ${i}`,o[Nr.COMPONENT]=this.moduleName,o[Dc]=i,o[Vc]=t}if(this._semconvStability&R.STABLE){let i=r.method,s=zc(r.method||"GET");n||(n=s),o[cn]=s,s!==i&&(o[un]=i),o[It]=t}return this.tracer.startSpan(n,{kind:Et.CLIENT,attributes:o})}_findResourceAndAddNetworkEvents(t,r,n){let o=r.entries;if(!o.length){if(!performance.getEntriesByType)return;o=performance.getEntriesByType("resource")}let i=Rr(r.spanUrl,r.startTime,n,o,this._usedResources,"fetch");if(i.mainRequest){let s=i.mainRequest;this._markResourceAsUsed(s);let a=i.corsPreFlightRequest;a&&(this._addChildSpan(t,a),this._markResourceAsUsed(a));let c=!(this._semconvStability&R.OLD);_t(t,s,this.getConfig().ignoreNetworkEvents,void 0,c)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,r,n){let o=P(Date.now()),i=I();this._addFinalSpanAttributes(t,n),this._semconvStability&R.STABLE&&n.status>=400&&(t.setStatus({code:X.ERROR}),t.setAttribute(Ye,String(n.status))),setTimeout(()=>{r.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,r,i),this._tasksCount--,this._clearResources(),t.end(o)},Sm)}_patchConstructor(){return t=>{let r=this;return function(...o){if(!r._isEnabled)return t.apply(this,o);let i=this,s=tt(o[0]instanceof Request?o[0].url:String(o[0])).href,a;o[0]instanceof Request?a=o[1]!=null?new Request(o[0],o[1]):o[0]:a=o[1]||{};let c=r._createSpan(s,a);if(!c)return t.apply(this,o);let u=r._prepareSpanData(s);r.getConfig().measureRequestSize&&$c(...o).then(d=>{d&&(r._semconvStability&R.OLD&&c.setAttribute(Bc,d),r._semconvStability&R.STABLE&&c.setAttribute(Uc,d))}).catch(d=>{r._diag.warn("getFetchBodyLength",d)});function p(d,h){r._applyAttributesAfterFetch(d,a,h),r._endSpan(d,u,{status:h.status||0,statusText:h.message,url:s})}function _(d,h){r._applyAttributesAfterFetch(d,a,h),h.status>=200&&h.status<400?r._endSpan(d,u,h):r._endSpan(d,u,{status:h.status,statusText:h.statusText,url:s})}function f(d,h){try{let b=h.clone().body;if(b){let $=b.getReader(),V=()=>{$.read().then(({done:x})=>{x?_(d,h):V()},x=>{p(d,x)})};V()}else _(d,h)}catch(g){r._diag.error("Failed to read fetch response body",g),r._endSpan(d,u,{status:0,url:s})}return h}function m(d,h){try{p(d,h)}catch(g){r._diag.error("Failed to end span on fetch error",g),r._endSpan(d,u,{status:h.status||0,url:s})}throw h}return E.with(A.setSpan(E.active(),c),()=>(r._callRequestHook(c,a),r._addHeaders(a,s),r._tasksCount++,t.apply(i,a instanceof Request?[a]:[s,a]).then(f.bind(i,c),m.bind(i,c))))}}}_applyAttributesAfterFetch(t,r,n){let o=this.getConfig().applyCustomAttributesOnSpan;o&&rt(()=>o(t,r,n),i=>{i&&this._diag.error("applyCustomAttributesOnSpan",i)},!0)}_callRequestHook(t,r){let n=this.getConfig().requestHook;n&&rt(()=>n(t,r),o=>{o&&this._diag.error("requestHook",o)},!0)}_prepareSpanData(t){let r=I(),n=[];if(typeof PerformanceObserver!="function")return{entries:n,startTime:r,spanUrl:t};let o=new PerformanceObserver(i=>{i.getEntries().forEach(a=>{a.initiatorType==="fetch"&&a.name===t&&n.push(a)})});return o.observe({entryTypes:["resource"]}),{entries:n,observer:o,startTime:r,spanUrl:t}}enable(){if(!jc){this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()");return}if(!this._isEnabled){if(this._isEnabled=!0,this._isFetchPatched){this._diag.debug("fetch constructor already patched");return}this._isFetchPatched=!0,this._wrap(globalThis,"fetch",this._patchConstructor())}}disable(){jc&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}};var cs="0.59.0",Kc="@opentelemetry/instrumentation-long-task";var us="longtask",Pr=class extends M{version=cs;_observer;constructor(t={}){super(Kc,cs,t)}init(){}isSupported(){return typeof PerformanceObserver>"u"||!PerformanceObserver.supportedEntryTypes?!1:PerformanceObserver.supportedEntryTypes.includes(us)}_createSpanFromEntry(t){let r=this.tracer.startSpan(us,{startTime:I(t.startTime)}),{observerCallback:n}=this.getConfig();if(n)try{n(r,{longtaskEntry:t})}catch(o){l.error("longtask instrumentation: observer callback failed",o)}r.setAttribute("longtask.name",t.name),r.setAttribute("longtask.entry_type",t.entryType),r.setAttribute("longtask.duration",t.duration),Array.isArray(t.attribution)&&t.attribution.forEach((o,i)=>{let s=t.attribution.length>1?`longtask.attribution[${i}]`:"longtask.attribution";r.setAttribute(`${s}.name`,o.name),r.setAttribute(`${s}.entry_type`,o.entryType),r.setAttribute(`${s}.start_time`,o.startTime),r.setAttribute(`${s}.duration`,o.duration),r.setAttribute(`${s}.container_type`,o.containerType),r.setAttribute(`${s}.container_src`,o.containerSrc),r.setAttribute(`${s}.container_id`,o.containerId),r.setAttribute(`${s}.container_name`,o.containerName)}),r.end(I(t.startTime+t.duration))}enable(){if(!this.isSupported()){this._diag.debug("Environment not supported");return}this._observer||(this._observer=new PerformanceObserver(t=>{t.getEntries().forEach(r=>this._createSpanFromEntry(r))}),this._observer.observe({type:us,buffered:!0}))}disable(){this._observer&&(this._observer.disconnect(),this._observer=void 0)}};var te;(function(e){e.EVENT_TYPE="event_type",e.TARGET_ELEMENT="target_element",e.TARGET_XPATH="target_xpath",e.HTTP_URL="http.url"})(te||(te={}));var ls="0.59.0",Xc="@opentelemetry/instrumentation-user-interaction";var Am="OT_ZONE_CONTEXT",Rm="Navigation:",xm=["click"];function Om(){return!1}var Ir=class extends M{version=ls;moduleName="user-interaction";_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(t={}){super(Xc,ls,t),this._eventNames=new Set(t?.eventNames??xm),this._shouldPreventSpanCreation=typeof t?.shouldPreventSpanCreation=="function"?t.shouldPreventSpanCreation:Om}init(){}_checkForTimeout(t,r){let n=this._spansData.get(r);n&&(t.source==="setTimeout"?n.hrTimeLastTimeout=I():t.source!=="Promise.then"&&t.source!=="setTimeout"&&(n.hrTimeLastTimeout=void 0))}_allowEventName(t){return this._eventNames.has(t)}_createSpan(t,r,n){if(!this._isEnabled||!(t instanceof HTMLElement)||!t.getAttribute||t.hasAttribute("disabled")||!this._allowEventName(r))return;let o=Oo(t,!0);try{let i=this.tracer.startSpan(r,{attributes:{[te.EVENT_TYPE]:r,[te.TARGET_ELEMENT]:t.tagName,[te.TARGET_XPATH]:o,[te.HTTP_URL]:window.location.href}},n?A.setSpan(E.active(),n):void 0);return this._shouldPreventSpanCreation(r,t,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(i){this._diag.error("failed to start create new user interaction span",i)}}_decrementTask(t){let r=this._spansData.get(t);r&&(r.taskCount--,r.taskCount===0&&this._tryToEndSpan(t,r.hrTimeLastTimeout))}_getCurrentSpan(t){let r=t.get(Am);return r&&A.getSpan(r)}_incrementTask(t){let r=this._spansData.get(t);r&&r.taskCount++}addPatchedListener(t,r,n,o){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let s=i.get(r);return s||(s=new Map,i.set(r,s)),s.has(t)?!1:(s.set(t,o),!0)}removePatchedListener(t,r,n){let o=this._wrappedListeners.get(n);if(!o)return;let i=o.get(r);if(!i)return;let s=i.get(t);return s&&(i.delete(t),i.size===0&&(o.delete(r),o.size===0&&this._wrappedListeners.delete(n))),s}_invokeListener(t,r,n){return typeof t=="function"?t.apply(r,n):t.handleEvent(n[0])}_patchAddEventListener(){let t=this;return r=>function(o,i,s){if(!i)return r.call(this,o,i,s);let a=s&&typeof s=="object"&&s.once,c=function(...u){let p,_=u[0],f=_?.target;_&&(p=t._eventsSpanMap.get(_)),a&&t.removePatchedListener(this,o,i);let m=t._createSpan(f,o,p);return m?(_&&t._eventsSpanMap.set(_,m),E.with(A.setSpan(E.active(),m),()=>{let d=t._invokeListener(i,this,u);return m.end(),d})):t._invokeListener(i,this,u)};if(t.addPatchedListener(this,o,i,c))return r.call(this,o,c,s)}}_patchRemoveEventListener(){let t=this;return r=>function(o,i,s){let a=t.removePatchedListener(this,o,i);return a?r.call(this,o,a,s):r.call(this,o,i,s)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._isEnabled&&(this._wrap(history,"replaceState",this._patchHistoryMethod()),this._wrap(history,"pushState",this._patchHistoryMethod()),this._wrap(history,"back",this._patchHistoryMethod()),this._wrap(history,"forward",this._patchHistoryMethod()),this._wrap(history,"go",this._patchHistoryMethod()))}_patchHistoryMethod(){let t=this;return r=>function(...o){if(!t._isEnabled)return r.apply(this,o);let i=`${location.pathname}${location.hash}${location.search}`,s=r.apply(this,o),a=`${location.pathname}${location.hash}${location.search}`;return i!==a&&t._updateInteractionName(a),s}}_updateInteractionName(t){let r=A.getSpan(E.active());r&&typeof r.updateName=="function"&&r.updateName(`${Rm} ${t}`)}_patchZoneCancelTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&t._decrementTask(s),r.call(this,o)}}_patchZoneScheduleTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&(t._incrementTask(s),t._checkForTimeout(o,s)),r.call(this,o)}}_patchZoneRunTask(){let t=this;return r=>function(o,i,s){let c=(Array.isArray(s)&&s[0]instanceof Event?s[0]:void 0)?.target,u,p=this;if(c){if(u=t._createSpan(c,o.eventName),u)return t._incrementTask(u),p.run(()=>{try{return E.with(A.setSpan(E.active(),u),()=>{let _=Zone.current;return o._zone=_,r.call(_,o,i,s)})}finally{t._decrementTask(u)}})}else u=t._getCurrentSpan(p);try{return r.call(p,o,i,s)}finally{u&&t._shouldCountTask(o,p)&&t._decrementTask(u)}}}_shouldCountTask(t,r){if(t._zone&&(r=t._zone),!r||!t.data||t.data.isPeriodic)return!1;let n=this._getCurrentSpan(r);return!n||!this._spansData.get(n)?!1:t.type==="macroTask"||t.type==="microTask"}_tryToEndSpan(t,r){t&&this._spansData.get(t)&&(t.end(r),this._spansData.delete(t))}enable(){if(this._isEnabled||(this._isEnabled=!0,typeof this._zonePatched=="boolean"))return;let t=this._getZoneWithPrototype();this._diag.debug("applying patch to",this.moduleName,this.version,"zone:",!!t),t?(this._zonePatched=!0,this._wrap(t.prototype,"runTask",this._patchZoneRunTask()),this._wrap(t.prototype,"scheduleTask",this._patchZoneScheduleTask()),this._wrap(t.prototype,"cancelTask",this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(n=>{this._wrap(n,"addEventListener",this._patchAddEventListener()),this._wrap(n,"removeEventListener",this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){this._isEnabled&&(this._isEnabled=!1)}_getZoneWithPrototype(){return window.Zone}};var Yc="http.host",qc="http.method",Qc="http.request.body.size",Jc="http.request_content_length_uncompressed";var Zc="http.scheme",tu="http.status_code",eu="http.url",ru="http.user_agent";var dt;(function(e){e.METHOD_OPEN="open",e.METHOD_SEND="send",e.EVENT_ABORT="abort",e.EVENT_ERROR="error",e.EVENT_LOAD="loaded",e.EVENT_TIMEOUT="timeout"})(dt||(dt={}));var bm=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function wm(e){return typeof Document<"u"&&e instanceof Document}function ou(e){if(wm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return nu(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Nm(e);if(e instanceof URLSearchParams)return nu(e.toString());if(e.byteLength!==void 0)return e.byteLength;bm.warn("unknown body type")}var Lm=new TextEncoder;function nu(e){return Lm.encode(e).byteLength}function Nm(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function iu(e){let t=Cm(),r=e.toUpperCase();return r in t?r:"_OTHER"}var ym={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Mr;function Cm(){if(Mr===void 0){let e=void 0;e&&e.length>0?(Mr={},e.forEach(t=>{Mr[t]=!0})):Mr=ym}return Mr}var Pm={"https:":"443","http:":"80"};function su(e){let t=Number(e.port||Pm[e.protocol]);if(t&&!isNaN(t))return t}var ps="0.215.0";var Co;(function(e){e.HTTP_STATUS_TEXT="http.status_text"})(Co||(Co={}));var Im=300,vr=class extends M{component="xml-http-request";version=ps;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",ps,t),this._semconvStability=Jt("http",t?.semconvStabilityOptIn)}init(){}_addHeaders(t,r){let n=tt(r).href;if(!xr(n,this.getConfig().propagateTraceHeaderCorsUrls)){let i={};D.inject(E.active(),i),Object.keys(i).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}let o={};D.inject(E.active(),o),Object.keys(o).forEach(i=>{t.setRequestHeader(i,String(o[i]))})}_addChildSpan(t,r){E.with(A.setSpan(E.active(),t),()=>{let n=this.tracer.startSpan("CORS Preflight",{startTime:r[S.FETCH_START]}),o=!(this._semconvStability&R.OLD);_t(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[S.RESPONSE_END])})}_addFinalSpanAttributes(t,r,n){if(this._semconvStability&R.OLD){if(r.status!==void 0&&t.setAttribute(tu,r.status),r.statusText!==void 0&&t.setAttribute(Co.HTTP_STATUS_TEXT,r.statusText),typeof n=="string"){let o=tt(n);t.setAttribute(Yc,o.host),t.setAttribute(Zc,o.protocol.replace(":",""))}t.setAttribute(ru,navigator.userAgent)}this._semconvStability&R.STABLE&&r.status&&t.setAttribute(ln,r.status)}_applyAttributesAfterXHR(t,r){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n=="function"&&rt(()=>n(t,r),o=>{o&&this._diag.error("applyCustomAttributesOnSpan",o)},!0)}_addResourceObserver(t,r){let n=this._xhrMem.get(t);!n||typeof PerformanceObserver!="function"||typeof PerformanceResourceTiming!="function"||(n.createdResources={observer:new PerformanceObserver(o=>{let i=o.getEntries(),s=tt(r);i.forEach(a=>{a.initiatorType==="xmlhttprequest"&&a.name===s.href&&n.createdResources&&n.createdResources.entries.push(a)})}),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(N.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,r,n,o,i){if(!n||!o||!i||!t.createdResources)return;let s=t.createdResources.entries;(!s||!s.length)&&(s=N.getEntriesByType("resource"));let a=Rr(tt(n).href,o,i,s,this._usedResources);if(a.mainRequest){let c=a.mainRequest;this._markResourceAsUsed(c);let u=a.corsPreFlightRequest;u&&(this._addChildSpan(r,u),this._markResourceAsUsed(u));let p=!(this._semconvStability&R.OLD);_t(r,c,this.getConfig().ignoreNetworkEvents,void 0,p)}}_cleanPreviousSpanInformation(t){let r=this._xhrMem.get(t);if(r){let n=r.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,r,n){if(nr(r,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let o="",i=tt(r),s={};if(this._semconvStability&R.OLD&&(o=n.toUpperCase(),s[qc]=n,s[eu]=i.toString()),this._semconvStability&R.STABLE){let c=n,u=iu(n);o||(o=u),s[cn]=u,u!==c&&(s[un]=c),s[It]=i.toString(),s[pn]=i.hostname;let p=su(i);p&&(s[mn]=p)}let a=this.tracer.startSpan(o,{kind:Et.CLIENT,attributes:s});return a.addEvent(dt.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:a,spanUrl:r}),a}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{let r=this;return function(...o){let i=o[0],s=o[1];return r._createSpan(this,s,i),t.apply(this,o)}}}_patchSend(){let t=this;function r(u,p,_,f){let m=p.callbackToRemoveEvents;typeof m=="function"&&m();let{span:d,spanUrl:h,sendStartTime:g}=p;d&&(t._findResourceAndAddNetworkEvents(p,d,h,g,_),d.addEvent(u,f),t._addFinalSpanAttributes(d,p,h),d.end(f),t._tasksCount--),t._clearResources()}function n(u,p,_,f){let m=t._xhrMem.get(p);if(!m)return;if(m.status=p.status,m.statusText=p.statusText,t._xhrMem.delete(p),m.span){let g=m.span;t._applyAttributesAfterXHR(g,p),t._semconvStability&R.STABLE&&(_?f&&(g.setStatus({code:X.ERROR,message:f}),g.setAttribute(Ye,f)):m.status&&m.status>=400&&(g.setStatus({code:X.ERROR}),g.setAttribute(Ye,String(m.status))))}let d=I(),h=Date.now();setTimeout(()=>{r(u,m,d,h)},Im)}function o(){n(dt.EVENT_ERROR,this,!0,"error")}function i(){n(dt.EVENT_ABORT,this,!1)}function s(){n(dt.EVENT_TIMEOUT,this,!0,"timeout")}function a(){this.status<299?n(dt.EVENT_LOAD,this,!1):n(dt.EVENT_ERROR,this,!1)}function c(u){u.removeEventListener("abort",i),u.removeEventListener("error",o),u.removeEventListener("load",a),u.removeEventListener("timeout",s);let p=t._xhrMem.get(u);p&&(p.callbackToRemoveEvents=void 0)}return u=>function(..._){let f=t._xhrMem.get(this);if(!f)return u.apply(this,_);let m=f.span,d=f.spanUrl;if(m&&d){if(t.getConfig().measureRequestSize&&_?.[0]){let h=_[0],g=ou(h);g!==void 0&&(t._semconvStability&R.OLD&&m.setAttribute(Jc,g),t._semconvStability&R.STABLE&&m.setAttribute(Qc,g))}E.with(A.setSpan(E.active(),m),()=>{t._tasksCount++,f.sendStartTime=I(),m.addEvent(dt.METHOD_SEND),this.addEventListener("abort",i),this.addEventListener("error",o),this.addEventListener("load",a),this.addEventListener("timeout",s),f.callbackToRemoveEvents=()=>{c(this),f.createdResources&&f.createdResources.observer.disconnect()},t._addHeaders(this,d),t._addResourceObserver(this,d)})}return u.apply(this,_)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),No(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),No(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}};var au="0.8.0",cu="@opentelemetry/instrumentation-web-exception";var Dr=class extends M{constructor(t={}){super(cu,au,t)}init(){}onError(t){let r="exception",n="reason"in t?t.reason:t.error;if(n===void 0)return;let o=Ct.getLoggerProvider().getLogger(this.instrumentationName,this.instrumentationVersion),i=this.getConfig(),s=i.applyCustomAttributes?i.applyCustomAttributes(n):{},a={};typeof n=="string"?a={[Q]:n}:a={[et]:n.name,[Q]:n.message,[jt]:n.stack};let c={eventName:r,severityNumber:Y.ERROR,attributes:{...a,...s},timestamp:I(),observedTimestamp:I()};o.emit(c)}disable(){this._onErrorHandler&&(window.removeEventListener("error",this._onErrorHandler),window.removeEventListener("unhandledrejection",this._onErrorHandler))}enable(){this._onErrorHandler||(this._onErrorHandler=this.onError.bind(this)),window.addEventListener("error",this._onErrorHandler),window.addEventListener("unhandledrejection",this._onErrorHandler)}};var uu="0.3.0";var lu="browser.web_vital",pu="browser.web_vital.name",mu="browser.web_vital.value",_u="browser.web_vital.rating",du="browser.web_vital.delta",hu="browser.web_vital.id",fu="browser.web_vital.navigation_type";var Io=class{t;o=0;i=[];u(t){if(t.hadRecentInput)return;let r=this.i[0],n=this.i.at(-1);this.o&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),this.t?.(t)}},Me=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Mo=e=>{if(document.readyState==="loading")return"loading";let t=Me();if(t){if(e<t.domInteractive)return"loading";if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return"dom-interactive";if(t.domComplete===0||e<t.domComplete)return"dom-content-loaded"}return"complete"},Mm=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},gs=e=>{let t="";try{for(;e?.nodeType!==9;){let r=e,n=r.id?"#"+r.id:[Mm(r),...Array.from(r.classList).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,r.id)break;e=r.parentNode}}catch{}return t},ms=new WeakMap;function Pe(e,t){return ms.get(e)||ms.set(e,new t),ms.get(e)}var wu=-1,Lu=()=>wu,ve=e=>{addEventListener("pageshow",t=>{t.persisted&&(wu=t.timeStamp,e(t))},!0)},ht=(e,t,r,n)=>{let o,i;return s=>{t.value>=0&&(s||n)&&(i=t.value-(o??0),(i||o===void 0)&&(o=t.value,t.delta=i,t.rating=((a,c)=>a>c[1]?"poor":a>c[0]?"needs-improvement":"good")(t.value,r),e(t)))}},Es=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Ur=()=>Me()?.activationStart??0,ft=(e,t=-1)=>{let r=Me(),n="navigate";return Lu()>=0?n="back-forward-cache":r&&(document.prerendering||Ur()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},Ie=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver(o=>{queueMicrotask(()=>{t(o.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},Ss=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Ce=-1,Nu=new Set,Tu=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,ds=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of Nu)t();isFinite(Ce)||(Ce=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",ds,!0))}},Uo=()=>{if(Ce<0){let e=Ur();Ce=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(r=>r.name==="hidden"&&r.startTime>=e)?.startTime)??Tu(),addEventListener("visibilitychange",ds,!0),addEventListener("prerenderingchange",ds,!0),ve(()=>{setTimeout(()=>{Ce=Tu()})})}return{get firstHiddenTime(){return Ce},onHidden(e){Nu.add(e)}}},Bo=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},gu=[1800,3e3],yu=(e,t={})=>{Bo(()=>{let r=Uo(),n,o=ft("FCP"),i=Ie("paint",s=>{for(let a of s)a.name==="first-contentful-paint"&&(i.disconnect(),a.startTime<r.firstHiddenTime&&(o.value=Math.max(a.startTime-Ur(),0),o.entries.push(a),n(!0)))});i&&(n=ht(e,o,gu,t.reportAllChanges),ve(s=>{o=ft("FCP"),n=ht(e,o,gu,t.reportAllChanges),Es(()=>{o.value=performance.now()-s.timeStamp,n(!0)})}))})},Eu=[.1,.25],Su=e=>e.find(t=>t.node?.nodeType===1)||e[0],Cu=(e,t={})=>{let r=Pe(t=Object.assign({},t),Io),n=new WeakMap;r.t=o=>{if(o?.sources?.length){let i=Su(o.sources),s=i?.node;if(s){let a=t.generateTarget?.(s)??gs(s);n.set(i,a)}}},((o,i={})=>{let s=Uo();yu(Ss(()=>{let a,c=ft("CLS",0),u=Pe(i,Io),p=f=>{for(let m of f)u.u(m);u.o>c.value&&(c.value=u.o,c.entries=u.i,a())},_=Ie("layout-shift",p);_&&(a=ht(o,c,Eu,i.reportAllChanges),s.onHidden(()=>{p(_.takeRecords()),a(!0)}),ve(()=>{u.o=0,c=ft("CLS",0),a=ht(o,c,Eu,i.reportAllChanges),Es(a)}),setTimeout(a))}))})(o=>{e((i=>{let s={};if(i.entries.length){let a=i.entries.reduce((c,u)=>c.value>u.value?c:u);if(a?.sources?.length){let c=Su(a.sources);c&&(s={largestShiftTarget:n.get(c),largestShiftTime:a.startTime,largestShiftValue:a.value,largestShiftSource:c,largestShiftEntry:a,loadState:Mo(a.startTime)})}}return Object.assign(i,{attribution:s})})(o))},t)},Pu=(e,t={})=>{yu(r=>{e((n=>{let o={timeToFirstByte:0,firstByteToFCP:n.value,loadState:Mo(Lu())};if(n.entries.length){let i=Me(),s=n.entries.at(-1);if(i){let a=i.activationStart||0,c=Math.max(0,i.responseStart-a);o={timeToFirstByte:c,firstByteToFCP:n.value-c,loadState:Mo(n.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}return Object.assign(n,{attribution:o})})(r))},t)},Iu=0,_s=1/0,Po=0,vm=e=>{for(let t of e)t.interactionId&&(_s=Math.min(_s,t.interactionId),Po=Math.max(Po,t.interactionId),Iu=Po?(Po-_s)/7+1:0)},hs,Au=()=>hs?Iu:performance.interactionCount??0,Dm=()=>{"interactionCount"in performance||hs||(hs=Ie("event",vm,{durationThreshold:0}))},Ru=0,vo=class{l=[];h=new Map;m;p;v(){Ru=Au(),this.l.length=0,this.h.clear()}M(){let t=Math.min(this.l.length-1,Math.floor((Au()-Ru)/50));return this.l[t]}u(t){if(this.m?.(t),!t.interactionId&&t.entryType!=="first-input")return;let r=this.l.at(-1),n=this.h.get(t.interactionId);if(n||this.l.length<10||t.duration>r.T){if(n?t.duration>n.T?(n.entries=[t],n.T=t.duration):t.duration===n.T&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],T:t.duration},this.h.set(n.id,n),this.l.push(n)),this.l.sort((o,i)=>i.T-o.T),this.l.length>10){let o=this.l.splice(10);for(let i of o)this.h.delete(i.id)}this.p?.(n)}}},fs=e=>{let t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let n=Ss(e),o=-1,i=()=>{r(o),n()};addEventListener("visibilitychange",i,{once:!0,capture:!0}),o=t(()=>{removeEventListener("visibilitychange",i,{capture:!0}),n()})}},xu=[200,500],Mu=(e,t={})=>{let r=Pe(t=Object.assign({},t),vo),n=[],o=[],i=0,s=new WeakMap,a=new WeakMap,c=!1,u=()=>{c||(fs(p),c=!0)},p=()=>{let m=new Set(r.l.map(g=>s.get(g.entries[0]))),d=o.length-10;o=o.filter((g,b)=>b>=d||m.has(g));let h=new Set;for(let g of o){let b=_(g.startTime,g.processingEnd);for(let $ of b)h.add($)}n=n.filter(g=>g.startTime>i||h.has(g)),c=!1};r.m=m=>{let d=m.startTime+m.duration,h;i=Math.max(i,m.processingEnd);for(let g=o.length-1;g>=0;g--){let b=o[g];if(Math.abs(d-b.renderTime)<=8){h=b,h.startTime=Math.min(m.startTime,h.startTime),h.processingStart=Math.min(m.processingStart,h.processingStart),h.processingEnd=Math.max(m.processingEnd,h.processingEnd),t.includeProcessedEventEntries!==!1&&h.entries.push(m);break}}h||(h={startTime:m.startTime,processingStart:m.processingStart,processingEnd:m.processingEnd,renderTime:d,entries:t.includeProcessedEventEntries!==!1?[m]:[]},o.push(h)),(m.interactionId||m.entryType==="first-input")&&s.set(m,h),u()},r.p=m=>{if(!a.get(m)){let d=m.entries[0].target;if(d){let h=t.generateTarget?.(d)??gs(d);a.set(m,h)}}};let _=(m,d)=>{let h=[];for(let g of n)if(!(g.startTime+g.duration<m)){if(g.startTime>d)break;h.push(g)}return h},f=m=>{let d=m.entries[0],h=s.get(d),g=d.processingStart,b=Math.max(d.startTime+d.duration,g),$=Math.min(h.processingEnd,b),V=h.entries.sort((v,yt)=>v.processingStart-yt.processingStart),x=_(d.startTime,$),Lt=r.h.get(d.interactionId),Nt={interactionTarget:a.get(Lt),interactionType:d.name.startsWith("key")?"keyboard":"pointer",interactionTime:d.startTime,nextPaintTime:b,processedEventEntries:V,longAnimationFrameEntries:x,inputDelay:g-d.startTime,processingDuration:$-g,presentationDelay:b-$,loadState:Mo(d.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(v=>{if(!v.longAnimationFrameEntries?.length)return;let yt=v.interactionTime,Fo=v.inputDelay,xs=v.processingDuration,$o,zo,Wo=0,Ue=0,jo=0,Ko=0;for(let Hr of v.longAnimationFrameEntries){Ue=Ue+Hr.startTime+Hr.duration-Hr.styleAndLayoutStart;for(let Tt of Hr.scripts){let bs=Tt.startTime+Tt.duration;if(bs<yt)continue;let Vr=bs-Math.max(yt,Tt.startTime),ws=Tt.duration?Vr/Tt.duration*Tt.forcedStyleAndLayoutDuration:0;Wo+=Vr-ws,Ue+=ws,Vr>Ko&&(zo=Tt.startTime<yt+Fo?"input-delay":Tt.startTime>=yt+Fo+xs?"presentation-delay":"processing-duration",$o=Tt,Ko=Vr)}}let Xo=v.longAnimationFrameEntries.at(-1),Os=Xo?Xo.startTime+Xo.duration:0;Os>=yt+Fo+xs&&(jo=v.nextPaintTime-Os),$o&&zo&&(v.longestScript={entry:$o,subpart:zo,intersectingDuration:Ko}),v.totalScriptDuration=Wo,v.totalStyleAndLayoutDuration=Ue,v.totalPaintDuration=jo,v.totalUnattributedDuration=v.nextPaintTime-yt-Wo-Ue-jo})(Nt),Object.assign(m,{attribution:Nt})};Ie("long-animation-frame",m=>{n=n.concat(m),u()}),((m,d={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let h=Uo();Bo(()=>{Dm();let g,b=ft("INP"),$=Pe(d,vo),V=Lt=>{fs(()=>{for(let v of Lt)$.u(v);let Nt=$.M();Nt&&Nt.T!==b.value&&(b.value=Nt.T,b.entries=Nt.entries,g())})},x=Ie("event",V,{durationThreshold:d.durationThreshold??40});g=ht(m,b,xu,d.reportAllChanges),x&&(x.observe({type:"first-input",buffered:!0}),h.onHidden(()=>{V(x.takeRecords()),g(!0)}),ve(()=>{$.v(),b=ft("INP"),g=ht(m,b,xu,d.reportAllChanges)}))})})(m=>{e(f(m))},t)},Do=class{m;u(t){this.m?.(t)}},Ou=[2500,4e3],vu=(e,t={})=>{let r=Pe(t=Object.assign({},t),Do),n=new WeakMap;r.m=o=>{let i=o.element;if(i){let s=t.generateTarget?.(i)??gs(i);n.set(o,s)}else o.id&&n.set(o,`#${o.id}`)},((o,i={})=>{Bo(()=>{let s=Uo(),a,c=ft("LCP"),u=Pe(i,Do),p=f=>{i.reportAllChanges||(f=f.slice(-1));for(let m of f)u.u(m),m.startTime<s.firstHiddenTime&&(c.value=Math.max(m.startTime-Ur(),0),c.entries=[m],a())},_=Ie("largest-contentful-paint",p);if(_){a=ht(o,c,Ou,i.reportAllChanges);let f=Ss(()=>{p(_.takeRecords()),_.disconnect(),a(!0)}),m=d=>{d.isTrusted&&(fs(f),removeEventListener(d.type,m,{capture:!0}))};for(let d of["keydown","click","visibilitychange"])addEventListener(d,m,{capture:!0});ve(d=>{c=ft("LCP"),a=ht(o,c,Ou,i.reportAllChanges),Es(()=>{c.value=performance.now()-d.timeStamp,a(!0)})})}})})(o=>{e((i=>{let s={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:i.value};if(i.entries.length){let a=i.entries.at(-1),c=a.url&&performance.getEntriesByType("resource").find(p=>p.name===a.url);s.target=n.get(a),s.lcpEntry=a,a.url&&(s.url=a.url),c&&(s.lcpResourceEntry=c);let u=Me();if(u){let p=u.activationStart||0,_=Math.max(0,u.responseStart-p),f=Math.max(_,c?(c.requestStart||c.startTime)-p:0),m=Math.min(i.value,Math.max(f,c?c.responseEnd-p:0));s={...s,timeToFirstByte:_,resourceLoadDelay:f-_,resourceLoadDuration:m-f,elementRenderDelay:i.value-m,navigationEntry:u}}}return Object.assign(i,{attribution:s})})(o))},t)},bu=[800,1800],Ts=e=>{document.prerendering?Bo(()=>Ts(e)):document.readyState!=="complete"?addEventListener("load",()=>Ts(e),!0):setTimeout(e)},Du=(e,t={})=>{((r,n={})=>{let o=ft("TTFB"),i=ht(r,o,bu,n.reportAllChanges);Ts(()=>{let s=Me();s&&(o.value=Math.max(s.responseStart-Ur(),0),o.entries=[s],i(!0),ve(()=>{o=ft("TTFB",0),i=ht(r,o,bu,n.reportAllChanges),i(!0)}))})})(r=>{e((n=>{let o={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(n.entries.length){let i=n.entries[0],s=i.activationStart||0,a=Math.max((i.workerStart||i.fetchStart)-s,0),c=Math.max(i.domainLookupStart-s,0),u=Math.max(i.connectStart-s,0),p=Math.max(i.connectEnd-s,0);o={waitingDuration:a,cacheDuration:c-a,dnsDuration:u-c,connectionDuration:p-u,requestDuration:n.value-p,navigationEntry:i}}return Object.assign(n,{attribution:o})})(r))},t)};var As=class extends M{_applyCustomLogRecordData;_includeRawAttribution;constructor(e={}){super("@opentelemetry/browser-instrumentation/web-vitals",uu,e),this._applyCustomLogRecordData=e.applyCustomLogRecordData,this._includeRawAttribution=e.includeRawAttribution??!1}init(){return[]}enable(){if(typeof PerformanceObserver>"u"){this._diag.debug("PerformanceObserver not supported, web vitals will not be collected");return}if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug("Listeners already registered, resuming emission");return}this._listenersRegistered=!0,this._diag.debug("Registering listeners"),Cu(e=>this._emitWebVital(e)),Mu(e=>this._emitWebVital(e)),vu(e=>this._emitWebVital(e)),Pu(e=>this._emitWebVital(e)),Du(e=>this._emitWebVital(e))}disable(){this._isEnabled=!1,this._diag.debug("Instrumentation disabled, pausing emission")}_getTimestampForMetric(e){if(e.name==="CLS"){let{attribution:t}=e;return t.largestShiftTime!==void 0?t.largestShiftTime:void 0}if(e.name==="INP"){let{attribution:t}=e;return t.interactionTime}return e.value}_emitWebVital(e){if(!this._isEnabled)return;let t={[pu]:e.name.toLowerCase(),[mu]:e.value,[du]:e.delta,[_u]:e.rating,[hu]:e.id,[fu]:e.navigationType},r=this._getTimestampForMetric(e),n={eventName:lu,severityNumber:Y.INFO,attributes:t,...this._includeRawAttribution?{body:JSON.stringify(e.attribution)}:{},...r!==void 0?{timestamp:r}:{}};this._applyCustomLogRecordData&&rt(()=>this._applyCustomLogRecordData?.(n),o=>{o&&this._diag.error("applyCustomLogRecordData hook failed",o)},!0),this.logger.emit(n)}};var Go=O.INFO,Ht={ALL:O.ALL,VERBOSE:O.VERBOSE,DEBUG:O.DEBUG,INFO:O.INFO,WARN:O.WARN,ERROR:O.ERROR,NONE:O.NONE};function Ho(e){return Go=Ht[e.logLevel.toUpperCase()],Go==null&&(console.warn(`Unknown log level "${e.logLevel}", expected one of ${Object.keys(Ht)}, using default`),Go=Ht.INFO),{error:Br(Ht.ERROR,console.error.bind(console)),warn:Br(Ht.WARN,console.error.bind(console)),info:Br(Ht.INFO,console.log.bind(console)),debug:Br(Ht.DEBUG,console.log.bind(console)),verbose:Br(Ht.VERBOSE,console.trace.bind(console))}}function Br(e,t){return function(...n){let o=Go>=e;if(n.length===0)return o;o&&t(...n)}}var ee=Ho({logLevel:"warn"}),De=B,Vo=!1,Bu={active:function(){return De},with:function(e,t,r,...n){let o=De;De=e||B;try{return t.call(r,...n)}finally{De=o}},bind:function(e,t){return typeof t=="function"?bt(t,this,e):t},enable:function(){if(Vo)return this;let e=this;return wt(window,"setTimeout",t=>function(...r){let n=Number(r[1]);return(isNaN(n)||n<=50)&&(r[0]=bt(r[0],e,e.active())),t.apply(this,r)}),wt(window,"setImmediate",t=>function(...r){return r[0]=bt(r[0],e,e.active()),t.apply(this,r)}),Gm(e),window.Promise&&Um(e),De=B,Vo=!0,e},disable:function(){return Vo&&(nt(window,"setTimeout"),nt(window,"setImmediate"),Hm(),window.Promise&&Bm(),De=B,Vo=!1),this}};function bt(e,t,r){if(typeof e!="function")return e;let n=r||t.active();function o(...i){return t.with(n,()=>e.apply(this,i))}return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),o}function Um(e){wt(Promise.prototype,"then",t=>function(r,n){return t.call(this,bt(r,e,e.active()),bt(n,e,e.active()))}),wt(Promise.prototype,"catch",t=>function(r){return t.call(this,bt(r,e,e.active()))}),wt(Promise.prototype,"finally",t=>function(r){return t.call(this,bt(r,e,e.active()))})}function Bm(){nt(Promise.prototype,"then"),nt(Promise.prototype,"catch"),nt(Promise.prototype,"finally")}var Gu=["onreadystatechange"],Vt=globalThis.XMLHttpRequest.prototype,Hu=["onabort","onerror","onload","onloadend","onloadstart","onprogress","ontimeout"],ko=globalThis.XMLHttpRequestEventTarget.prototype;function Gm(e){wt(Vt,"addEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){n.__bound=n.__bound||new Map;let o=r[1],i=n.__bound.get(o);r[1]=i||bt(o,e,e.active()),n.__bound.set(o,r[1])}return t.apply(n,r)}}),wt(Vt,"removeEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){let o=r[1],i=n.__bound?.get(o);i&&(r[1]=i)}return t.apply(n,r)}});for(let t of Gu){let r=Object.getOwnPropertyDescriptor(Vt,t);r&&(Uu(r,e),Object.defineProperty(Vt,t,r))}for(let t of Hu){let r=Object.getOwnPropertyDescriptor(ko,t);r&&(Uu(r,e),Object.defineProperty(ko,t,r))}}function Hm(){nt(Vt,"addEventListener"),nt(Vt,"removeEventListener");for(let e of Gu){let t=Object.getOwnPropertyDescriptor(Vt,e);t&&(nt(t,"set"),nt(t,"get"),Object.defineProperty(Vt,e,t))}for(let e of Hu){let t=Object.getOwnPropertyDescriptor(ko,e);t&&(nt(t,"set"),nt(t,"get"),Object.defineProperty(ko,e,t))}}function wt(e,t,r){if(!e||!e[t]){ee.warn("no original function "+String(t)+" to wrap");return}if(!r){ee.warn("no wrapper function"),ee.warn(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){ee.warn("original object and wrapper must be functions");return}let o=r(n,t);return typeof n.toString=="function"&&(o.toString=n.toString.bind(n)),Gr(o,"__original",n),Gr(o,"__unwrap",()=>{e[t]===o&&Gr(e,t,n)}),Gr(o,"__wrapped",!0),Gr(e,t,o),o}function nt(e,t){if(!e||!e[t]){ee.warn("no function to unwrap."),ee.warn(new Error().stack);return}let r=e[t];if(!r.__unwrap)ee.warn(`no original to unwrap to -- has ${String(t)} already been unwrapped?`);else{r.__unwrap();return}}function Uu(e,t){wt(e,"set",function(r){return function(n){if(typeof n=="function"){let o=n;n=bt(o,t,t.active()),n.__original=o}return r.call(this,n)}}),wt(e,"get",function(r){return function(){let n=r.call(this);return typeof n=="function"&&n.__original?n.__original:n}})}function Gr(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var Vu="browser.brands",ku="browser.language",Fu="browser.mobile",$u="browser.platform";var zu="user_agent.original";var Wu="0.2.0";function ju(e,t,r){typeof t=="string"&&t&&(e["service.name"]=t),typeof r=="string"&&r&&(e["service.version"]=r);let{userAgent:n,userAgentData:o}=navigator,i=km(n),s;return o?(s={name:o.platform,version:""},e[Vu]=o.brands.map(a=>`${a.brand} ${a.version}`)):s=Vm(n),i&&(e["browser.name"]=i.name,i.version&&(e["browser.version"]=i.version)),s&&(e[$u]=s.name),e[Fu]=navigator.userAgent.includes("Mobi"),e[ku]=navigator.language,e[zu]=n,e["telemetry.distro.name"]="elastic",e["telemetry.distro.version"]=Wu,In({...e,...Mt})}function Vm(e){let t=[["Symbian",[/SymbianOS\/([\w\.]+)/i]],["Windows Phone",[/Windows Phone ([\w\.]+)/i]],["Xbox",[/Xbox?/i]],["Windows",[/Windows (\d+)/i]],["Windows RT",[/Windows NT ([\w\.]+).+ARM;/i]],["Windows",[/Windows NT (\d+\.\d+)/i]],["Windows IoT",[/Windows IoT (\d+\.\d+)/i]],["iOS",[/iPhone OS (\d+(_\d+)*)/i,/iPad;.+CPU OS (\d+(_\d+)*)/i]],["macOS",[/Mac OS (\d+(_\d+)*)/i,/Mac OS X ([\w\.]+)/i,/Intel Mac OS X/]],["Ubuntu Touch",[/Ubuntu ([\w\.]+).+Mobile/i]],["Android",[/Android ([\w\.]+)/i,/Android;/i]],["Linux",[/Linux ([\w_]+)/i,/Linux;/]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}function km(e){let t=[["AliPay",[/AliPayClient\/([\w\.]+)/i]],["Baidu",[/bd(?:browser|spark)\/([\w\.]+)/i,/baidu(?:boxapp|hd)\/([\w\.]+)/i,/BIDUBrowser\/([\w\.]+)/i]],["Bing",[/Bing(?:Web|Sapphire)\/([\w\.]+)/i]],["Camino",[/Camino\/([\w\.]+)/i]],["Coc Coc",[/coc_coc_browser\/([\w\.]+)/i]],["Dragon",[/(?:Dragon|Comodo_Dragon)\/([\w\.]+)/i]],["DuckDuckGo",[/(?:Ddg|DuckDuckGo)\/([\w\.]+)/i]],["Electron",[/Electron\/([\w\.]+)/i]],["Facebook",[/;fbav\/([\w\.]+);/i,/(?:fban\/fbios|fb_iab\/fb4a)/i]],["GSA",[/GSA\/([\w\.]+)/i]],["Huawei Browser",[/HuaweiBrowser\/([\w\.]+)/i]],["Iron",[/(?:Iron|Iron Safari)\/([\w\.]+)/i]],["LG Browser",[/LG Browser\/([\w\.]+)/i]],["Lunascape",[/Lunascape\/([\w\.]+)/i]],["Maxthon",[/Maxthon\/([\w\.]+)/i,/Mx(?:Browser|iOS)\/([\w\.]+)/i]],["MIUI Browser",[/MiuiBrowser\/([\w\.]+)/i]],["NokiaBrowser",[/NokiaBrowser\/([\w\.]+)/i]],["Oculus Browser",[/OculusBrowser\/([\w\.]+)/i]],["Pico Browser",[/PicoBrowser\/([\w\.]+)/i]],["Qwant",[/Qwant(?:Mobile|Browser|iOS)\/([\w\.]+)/i]],["Samsung Internet",[/SamsungBrowser\/([\w\.]+)/i]],["Silk",[/Silk\/([\w\.]+)/i]],["Smart Lenovo Browser",[/SLBrowser\/([\w\.]+)/i]],["Snapchat",[/Snapchat\/([\w\.]+)/i]],["Steam",[/Valve Steam/i]],["TikTok",[/musical_ly.+app_version\/([\w\.]+)/i]],["Twitter",[/Twitter/i]],["Vivaldi",[/Vivaldi\/([\w\.]+)/i]],["Yandex",[/Ya(?:SearchBrowser|Browser)\/([\w\.]+)/i]],["WeChat",[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i]],["QQBrowser",[/M?QQbrowser\/([\w\.]+)/i]],["Brave",[/Brave\/([\w\.]+)/i]],["Edge",[/(?:Edg|Edge|EdgA|EdgW|EdgiOS)\/([\w\.]+)/i]],["Opera",[/(?:OPR|OPT|OPiOS|Opera)\/([\w\.]+)/i,/Coast\/([\w\.]+)/i]],["Chromium",[/Chromium\/([\w\.]+)/i]],["Chrome Headless",[/HeadlessChrome\/([\w\.]+)/i,/HeadlessChrome Safari\/([\w\.]+)/i]],["Chrome",[/Chrome\/([\w\.]+)/i,/Cr(?:iOS|Mo)\/([\w\.]+)/i]],["Android Browser",[/Android \d.+Safari\/([\w\.]+)/i]],["Firefox",[/(?:Firefox|FxiOS)\/([\w\.]+)/i]],["Safari",[/Safari\/([\w\.]+)/i]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}var Ku=!1,Xu={logLevel:"info",sampleRate:1,serviceName:"unknown_service:web",resourceAttributes:{},otlpEndpoint:"http://localhost:4318",exportHeaders:{}};function Yu(e={}){if(Ku||e.disabled)return;let t=e.logLevel??Xu.logLevel;l.setLogger(Ho({logLevel:t}),{logLevel:O.ALL}),l.debug("Browser SDK intialization",e);let{serviceName:r,serviceVersion:n}=e,o={...Xu,...e},i;try{i=new URL(o.otlpEndpoint)}catch{l.error(`The value "${o.otlpEndpoint}" for "otlpEndpoint" configuration is not an URL. SDK won't start.`);return}let s=ju(o.resourceAttributes,r,n),a=Rs(i,"v1/traces").href,c=new Ne(new we({url:a,headers:o.exportHeaders})),u=new Ar({resource:s,sampler:new Gt(o.sampleRate),spanProcessors:[c]});u.register({contextManager:Bu});let p=Rs(i,"v1/metrics").href,_=new _r({exporter:new be({url:p,headers:o.exportHeaders})}),f=new hr({resource:s,readers:[_]});$t.setGlobalMeterProvider(f);let m=Rs(i,"v1/logs").href,d=new Le(new Oe({url:m,headers:o.exportHeaders})),h=new Er({resource:s,processors:[d]});Ct.setGlobalLoggerProvider(h);let g={"@opentelemetry/instrumentation-document-load":x=>new Lr(x),"@opentelemetry/instrumentation-fetch":x=>new Cr(x),"@opentelemetry/instrumentation-long-task":x=>new Pr(x),"@opentelemetry/instrumentation-user-interaction":x=>new Ir(x),"@opentelemetry/instrumentation-xml-http-request":x=>new vr(x),"@opentelemetry/instrumentation-web-exception":x=>new Dr(x),"@opentelemetry/instrumentation-web-vitals":x=>new As(x)},b={semconvStabilityOptIn:"http"},$=o.instrumentations||{},V=[];for(let x of Object.keys(g)){let Lt=$[x];(x==="@opentelemetry/instrumentation-fetch"||x==="@opentelemetry/instrumentation-xml-http-request")&&(Lt={...b,...Lt}),Lt?.enabled===!1||V.push(g[x](Lt))}return ns({instrumentations:V}),Ku=!0,{forceFlush(){return Promise.all([u.forceFlush(),f.forceFlush(),h.forceFlush()]).then(()=>{})}}}function Rs(e,t){let r=new URL(e.href);return r.pathname=(r.pathname+t).replace("//","/"),r}globalThis.startBrowserSdk=Yu;})();
14
14
  //# sourceMappingURL=elastic-otel-browser.min.js.map