@elastic/opentelemetry-browser 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/LICENSE +202 -0
- package/NOTICE.md +5765 -0
- package/README.md +22 -0
- package/build/elastic-otel-browser.js +11593 -0
- package/build/elastic-otel-browser.js.map +7 -0
- package/build/elastic-otel-browser.min.js +14 -0
- package/build/elastic-otel-browser.min.js.map +7 -0
- package/lib/bundle.js +8 -0
- package/lib/context.js +347 -0
- package/lib/detector.js +226 -0
- package/lib/index.js +6 -0
- package/lib/logging.js +67 -0
- package/lib/sdk.js +232 -0
- package/lib/semconv.js +68 -0
- package/lib/version.js +6 -0
- package/package.json +81 -0
- package/types/bundle.d.ts +1 -0
- package/types/context.d.ts +2 -0
- package/types/detector.d.ts +47 -0
- package/types/index.d.ts +1 -0
- package/types/logging.d.ts +9 -0
- package/types/sdk.d.ts +32 -0
- package/types/semconv.d.ts +58 -0
- package/types/version.d.ts +1 -0
|
@@ -0,0 +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}'
|
|
2
|
+
`),e.type!==t.type&&(r+=` - Type '${e.type}' does not match '${t.type}'
|
|
3
|
+
`),e.valueType!==t.valueType&&(r+=` - Value Type '${e.valueType}' does not match '${t.valueType}'
|
|
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}'
|
|
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.
|
|
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.
|
|
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;})();
|
|
14
|
+
//# sourceMappingURL=elastic-otel-browser.min.js.map
|