@elastic/opentelemetry-browser 0.1.0 → 0.3.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/NOTICE.md +607 -602
- package/README.md +5 -8
- package/build/elastic-otel-browser.js +2955 -1869
- package/build/elastic-otel-browser.js.map +4 -4
- package/build/elastic-otel-browser.min.js +7 -7
- package/build/elastic-otel-browser.min.js.map +4 -4
- package/lib/sdk.js +4 -0
- package/lib/version.js +1 -1
- package/package.json +15 -14
- package/types/sdk.d.ts +1 -0
- package/types/version.d.ts +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(()=>{var as=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};var St="1.9.0";var cs=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Du(e){var t=new Set([e]),r=new Set,n=e.match(cs);if(!n)return function(){return!1};var o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===e};function i(a){return r.add(a),!1}function s(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;var u=c.match(cs);if(!u)return i(c);var p={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var us=Du(St);var Uu=St.split(".")[0],Ge=Symbol.for("opentelemetry.js.api."+Uu),He=as;function st(e,t,r,n){var o;n===void 0&&(n=!1);var i=He[Ge]=(o=He[Ge])!==null&&o!==void 0?o:{version:St};if(!n&&i[e]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(s.stack||s.message),!1}if(i.version!==St){var s=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+e+" does not match previously registered API v"+St);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+St+"."),!0}function X(e){var t,r,n=(t=He[Ge])===null||t===void 0?void 0:t.version;if(!(!n||!us(n)))return(r=He[Ge])===null||r===void 0?void 0:r[e]}function at(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+St+".");var r=He[Ge];r&&delete r[e]}var Bu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},Gu=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},ps=(function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Ve("verbose",this._namespace,t)},e})();function Ve(e,t,r){var n=X("diag");if(n)return r.unshift(t),n[e].apply(n,Gu([],Bu(r),!1))}var w;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(w||(w={}));function ls(e,t){e<w.NONE?e=w.NONE:e>w.ALL&&(e=w.ALL),t=t||{};function r(n,o){var i=t[n];return typeof i=="function"&&e>=o?i.bind(t):function(){}}return{error:r("error",w.ERROR),warn:r("warn",w.WARN),info:r("info",w.INFO),debug:r("debug",w.DEBUG),verbose:r("verbose",w.VERBOSE)}}var Hu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},Vu=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},ku="diag",H=(function(){function e(){function t(o){return function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var a=X("diag");if(a)return a[o].apply(a,Vu([],Hu(i),!1))}}var r=this,n=function(o,i){var s,a,c;if(i===void 0&&(i={logLevel:w.INFO}),o===r){var u=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=u.stack)!==null&&s!==void 0?s:u.message),!1}typeof i=="number"&&(i={logLevel:i});var p=X("diag"),_=ls((a=i.logLevel)!==null&&a!==void 0?a:w.INFO,o);if(p&&!i.suppressOverrideMessage){var d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+d),_.warn("Current logger will overwrite one already registered from "+d)}return st("diag",_,r,!0)};r.setLogger=n,r.disable=function(){at(ku,r)},r.createComponentLogger=function(o){return new ps(o)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})();var Fu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},zu=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ms=(function(){function e(t){this._entries=t?new Map(t):new Map}return e.prototype.getEntry=function(t){var r=this._entries.get(t);if(r)return Object.assign({},r)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(t){var r=Fu(t,2),n=r[0],o=r[1];return[n,o]})},e.prototype.setEntry=function(t,r){var n=new e(this._entries);return n._entries.set(t,r),n},e.prototype.removeEntry=function(t){var r=new e(this._entries);return r._entries.delete(t),r},e.prototype.removeEntries=function(){for(var t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=new e(this._entries);try{for(var s=zu(n),a=s.next();!a.done;a=s.next()){var c=a.value;i._entries.delete(c)}}catch(u){t={error:u}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},e.prototype.clear=function(){return new e},e})();var _s=Symbol("BaggageEntryMetadata");var $u=H.instance();function hs(e){return e===void 0&&(e={}),new ms(new Map(Object.entries(e)))}function Ho(e){return typeof e!="string"&&($u.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:_s,toString:function(){return e}}}function Ft(e){return Symbol.for(e)}var Wu=(function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,o){var i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=function(n){var o=new e(r._currentContext);return o._currentContext.delete(n),o}}return e})(),V=new Wu;var zt=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),ju=(function(){function e(){}return e.prototype.createGauge=function(t,r){return ep},e.prototype.createHistogram=function(t,r){return rp},e.prototype.createCounter=function(t,r){return tp},e.prototype.createUpDownCounter=function(t,r){return np},e.prototype.createObservableGauge=function(t,r){return ip},e.prototype.createObservableCounter=function(t,r){return op},e.prototype.createObservableUpDownCounter=function(t,r){return sp},e.prototype.addBatchObservableCallback=function(t,r){},e.prototype.removeBatchObservableCallback=function(t){},e})();var $r=(function(){function e(){}return e})();var Ku=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})($r);var Xu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})($r);var Yu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})($r);var qu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})($r);var Vo=(function(){function e(){}return e.prototype.addCallback=function(t){},e.prototype.removeCallback=function(t){},e})();var Qu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo);var Ju=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo);var Zu=(function(e){zt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo);var ko=new ju,tp=new Ku,ep=new Yu,rp=new qu,np=new Xu,op=new Qu,ip=new Ju,sp=new Zu;function ke(){return ko}var Y;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(Y||(Y={}));var ds={get:function(e,t){if(e!=null)return e[t]},keys:function(e){return e==null?[]:Object.keys(e)}},fs={set:function(e,t,r){e!=null&&(e[t]=r)}};var ap=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},cp=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Ts=(function(){function e(){}return e.prototype.active=function(){return V},e.prototype.with=function(t,r,n){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return r.call.apply(r,cp([n],ap(o),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})();var up=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},pp=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Fo="context",lp=new Ts,Lt=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return st(Fo,t,H.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var o,i=[],s=3;s<arguments.length;s++)i[s-3]=arguments[s];return(o=this._getContextManager()).with.apply(o,pp([t,r,n],up(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return X(Fo)||lp},e.prototype.disable=function(){this._getContextManager().disable(),at(Fo,H.instance())},e})();var M;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(M||(M={}));var Wr="0000000000000000",jr="00000000000000000000000000000000",Fe={traceId:jr,spanId:Wr,traceFlags:M.NONE};var vt=(function(){function e(t){t===void 0&&(t=Fe),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e})();var zo=Ft("OpenTelemetry Context Key SPAN");function Kr(e){return e.getValue(zo)||void 0}function gs(){return Kr(Lt.getInstance().active())}function ze(e,t){return e.setValue(zo,t)}function Es(e){return e.deleteValue(zo)}function Ss(e,t){return ze(e,new vt(t))}function Xr(e){var t;return(t=Kr(e))===null||t===void 0?void 0:t.spanContext()}var mp=/^([0-9a-f]{32})$/i,_p=/^[0-9a-f]{16}$/i;function Yr(e){return mp.test(e)&&e!==jr}function As(e){return _p.test(e)&&e!==Wr}function q(e){return Yr(e.traceId)&&As(e.spanId)}function Rs(e){return new vt(e)}var $o=Lt.getInstance(),qr=(function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=$o.active());var o=!!r?.root;if(o)return new vt;var i=n&&Xr(n);return hp(i)&&q(i)?new vt(i):new vt},e.prototype.startActiveSpan=function(t,r,n,o){var i,s,a;if(!(arguments.length<2)){arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);var c=s??$o.active(),u=this.startSpan(t,i,c),p=ze(c,u);return $o.with(p,a,void 0,u)}},e})();function hp(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var dp=new qr,xs=(function(){function e(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,o){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):dp},e})();var Os=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new qr},e})();var fp=new Os,Wo=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new xs(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:fp},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)},e})();var oe;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(oe||(oe={}));var At;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(At||(At={}));var ct;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(ct||(ct={}));var E=Lt.getInstance();var l=H.instance();var Tp=(function(){function e(){}return e.prototype.getMeter=function(t,r,n){return ko},e})();var ys=new Tp;var jo="metrics",bs=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(t){return st(jo,t,H.instance())},e.prototype.getMeterProvider=function(){return X(jo)||ys},e.prototype.getMeter=function(t,r,n){return this.getMeterProvider().getMeter(t,r,n)},e.prototype.disable=function(){at(jo,H.instance())},e})();var $t=bs.getInstance();var ws=(function(){function e(){}return e.prototype.inject=function(t,r){},e.prototype.extract=function(t,r){return t},e.prototype.fields=function(){return[]},e})();var Ko=Ft("OpenTelemetry Baggage Key");function Xo(e){return e.getValue(Ko)||void 0}function Ns(){return Xo(Lt.getInstance().active())}function Ls(e,t){return e.setValue(Ko,t)}function vs(e){return e.deleteValue(Ko)}var Yo="propagation",gp=new ws,Ps=(function(){function e(){this.createBaggage=hs,this.getBaggage=Xo,this.getActiveBaggage=Ns,this.setBaggage=Ls,this.deleteBaggage=vs}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(t){return st(Yo,t,H.instance())},e.prototype.inject=function(t,r,n){return n===void 0&&(n=fs),this._getGlobalPropagator().inject(t,r,n)},e.prototype.extract=function(t,r,n){return n===void 0&&(n=ds),this._getGlobalPropagator().extract(t,r,n)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){at(Yo,H.instance())},e.prototype._getGlobalPropagator=function(){return X(Yo)||gp},e})();var B=Ps.getInstance();var qo="trace",Cs=(function(){function e(){this._proxyTracerProvider=new Wo,this.wrapSpanContext=Rs,this.isSpanContextValid=q,this.deleteSpan=Es,this.getSpan=Kr,this.getActiveSpan=gs,this.getSpanContext=Xr,this.setSpan=ze,this.setSpanContext=Ss}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=st(qo,this._proxyTracerProvider,H.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return X(qo)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){at(qo,H.instance()),this._proxyTracerProvider=new Wo},e})();var R=Cs.getInstance();var J;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(J||(J={}));var ie=class{emit(t){}},$e=new ie;var We=Symbol.for("io.opentelemetry.js.api.logs"),se=globalThis;function Ms(e,t,r){return n=>n===e?t:r}var Qo=1;var Jo=class{getLogger(t,r,n){return new ie}},Qr=new Jo;var Jr=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):$e}};var je=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new Jr(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Qr}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};var Zr=class e{constructor(){this._proxyLoggerProvider=new je}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return se[We]?this.getLoggerProvider():(se[We]=Ms(Qo,t,Qr),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=se[We])===null||t===void 0?void 0:t.call(se,Qo))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete se[We],this._proxyLoggerProvider=new je}};var Pt=Zr.getInstance();var xt=class{_delegate;constructor(t){this._delegate=t}export(t,r){this._delegate.export(t,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};var Ke=class extends Error{code;name="OTLPExporterError";data;constructor(t,r,n){super(t),this.data=n,this.code=r}};function Ep(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Is(e){if(e!=null)return async()=>e}function Ds(e,t,r){return{timeoutMillis:Ep(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function Us(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Zo=class{_concurrencyLimit;_sendingPromises=[];constructor(t){this._concurrencyLimit=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);let r=()=>{let n=this._sendingPromises.indexOf(t);this._sendingPromises.splice(n,1)};t.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function Bs(e){return new Zo(e.concurrencyLimit)}var Gs=Ft("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Xe(e){return e.setValue(Gs,!0)}function Wt(e){return e.getValue(Gs)===!0}var tn="baggage";function Hs(e){return e.reduce((t,r)=>{let n=`${t}${t!==""?",":""}${r}`;return n.length>8192?t:n},"")}function Vs(e){return e.getAllEntries().map(([t,r])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function ks(e){if(!e)return;let t=e.indexOf(";"),r=t===-1?e:e.substring(0,t),n=r.indexOf("=");if(n<=0)return;let o=r.substring(0,n).trim(),i=r.substring(n+1).trim();if(!o||!i)return;let s,a;try{s=decodeURIComponent(o),a=decodeURIComponent(i)}catch{return}let c;if(t!==-1&&t<e.length-1){let u=e.substring(t+1);c=Ho(u)}return{key:s,value:a,metadata:c}}var Ye=class{inject(t,r,n){let o=B.getBaggage(t);if(!o||Wt(t))return;let i=Vs(o).filter(a=>a.length<=4096).slice(0,180),s=Hs(i);s.length>0&&n.set(r,tn,s)}extract(t,r,n){let o=n.get(r,tn),i=Array.isArray(o)?o.join(","):o;if(!i)return t;let s={};return i.length===0||(i.split(",").forEach(c=>{let u=ks(c);if(u){let p={value:u.value};u.metadata&&(p.metadata=u.metadata),s[u.key]=p}}),Object.entries(s).length===0)?t:B.setBaggage(t,B.createBaggage(s))}fields(){return[tn]}};function jt(e){let t={};if(typeof e!="object"||e==null)return t;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!xp(r)){l.warn(`Invalid attribute key: ${r}`);continue}let n=e[r];if(!en(n)){l.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function xp(e){return typeof e=="string"&&e!==""}function en(e){return e==null?!0:Array.isArray(e)?Op(e):Fs(typeof e)}function Op(e){let t;for(let r of e){if(r==null)continue;let n=typeof r;if(n!==t){if(!t){if(Fs(n)){t=n;continue}return!1}return!1}}return!0}function Fs(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function zs(){return e=>{l.error(yp(e))}}function yp(e){return typeof e=="string"?e:JSON.stringify(bp(e))}function bp(e){let t={},r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;let o=r[n];o&&(t[n]=String(o))}),r=Object.getPrototypeOf(r);return t}var wp=zs();function P(e){try{wp(e)}catch{}}var $s="2.6.0";var qe="error.type";var Z="exception.message",Kt="exception.stacktrace",nt="exception.type";var rn="http.request.method";var nn="http.request.method_original";var on="http.response.status_code";var sn="server.address",an="server.port",Ws="service.name";var Qe="telemetry.sdk.language";var js="webjs",Je="telemetry.sdk.name",Ze="telemetry.sdk.version";var Ct="url.full";var Ks="user_agent.original";var Xs="process.runtime.name";var Mt={[Je]:"opentelemetry",[Xs]:"browser",[Qe]:js,[Ze]:$s};var C=performance;var Np=9,Lp=6,vp=Math.pow(10,Lp),cn=Math.pow(10,Np);function I(e){let t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*vp);return[r,n]}function D(e){let t=I(C.timeOrigin),r=I(typeof e=="number"?e:C.now());return pn(t,r)}function ut(e){if(tr(e))return e;if(typeof e=="number")return e<C.timeOrigin?D(e):I(e);if(e instanceof Date)return I(e.getTime());throw TypeError("Invalid input type")}function ei(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=cn),[r,n]}function tt(e){return e[0]*cn+e[1]}function ae(e){return e[0]*1e6+e[1]/1e3}function tr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function un(e){return tr(e)||typeof e=="number"||e instanceof Date}function pn(e,t){let r=[e[0]+t[0],e[1]+t[1]];return r[1]>=cn&&(r[1]-=cn,r[0]+=1),r}var G;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(G||(G={}));var er=class{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(t,r,n){for(let o of this._propagators)try{o.inject(t,r,n)}catch(i){l.warn(`Failed to inject with ${o.constructor.name}. Err: ${i.message}`)}}extract(t,r,n){return this._propagators.reduce((o,i)=>{try{return i.extract(o,r,n)}catch(s){l.warn(`Failed to extract with ${i.constructor.name}. Err: ${s.message}`)}return o},t)}fields(){return this._fields.slice()}};var ri="[_0-9a-z-*/]",Pp=`[a-z]${ri}{0,255}`,Cp=`[a-z0-9]${ri}{0,240}@[a-z]${ri}{0,13}`,Mp=new RegExp(`^(?:${Pp}|${Cp})$`),Ip=/^[ -~]{0,255}[!-~]$/,Dp=/,|=/;function Ys(e){return Mp.test(e)}function qs(e){return Ip.test(e)&&!Dp.test(e)}var Qs=32,Up=512,Js=",",Zs="=",ln=class e{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,r){let n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,r),n}unset(t){let r=this._clone();return r._internalState.delete(t),r}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce((t,r)=>(t.push(r+Zs+this.get(r)),t),[]).join(Js)}_parse(t){t.length>Up||(this._internalState=t.split(Js).reverse().reduce((r,n)=>{let o=n.trim(),i=o.indexOf(Zs);if(i!==-1){let s=o.slice(0,i),a=o.slice(i+1,n.length);Ys(s)&&qs(a)&&r.set(s,a)}return r},new Map),this._internalState.size>Qs&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Qs))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};var ce="traceparent",mn="tracestate",Bp="00",Gp="(?!ff)[\\da-f]{2}",Hp="(?![0]{32})[\\da-f]{32}",Vp="(?![0]{16})[\\da-f]{16}",kp="[\\da-f]{2}",Fp=new RegExp(`^\\s?(${Gp})-(${Hp})-(${Vp})-(${kp})(-.*)?\\s?$`);function ta(e){let t=Fp.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var rr=class{inject(t,r,n){let o=R.getSpanContext(t);if(!o||Wt(t)||!q(o))return;let i=`${Bp}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||M.NONE).toString(16)}`;n.set(r,ce,i),o.traceState&&n.set(r,mn,o.traceState.serialize())}extract(t,r,n){let o=n.get(r,ce);if(!o)return t;let i=Array.isArray(o)?o[0]:o;if(typeof i!="string")return t;let s=ta(i);if(!s)return t;s.isRemote=!0;let a=n.get(r,mn);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new ln(typeof c=="string"?c:void 0)}return R.setSpanContext(t,s)}fields(){return[ce,mn]}};var zp="[object Object]",$p="[object Null]",Wp="[object Undefined]",jp=Function.prototype,ea=jp.toString,Kp=ea.call(Object),Xp=Object.getPrototypeOf,ra=Object.prototype,na=ra.hasOwnProperty,Xt=Symbol?Symbol.toStringTag:void 0,oa=ra.toString;function ni(e){if(!Yp(e)||qp(e)!==zp)return!1;let t=Xp(e);if(t===null)return!0;let r=na.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ea.call(r)===Kp}function Yp(e){return e!=null&&typeof e=="object"}function qp(e){return e==null?e===void 0?Wp:$p:Xt&&Xt in Object(e)?Qp(e):Jp(e)}function Qp(e){let t=na.call(e,Xt),r=e[Xt],n=!1;try{e[Xt]=void 0,n=!0}catch{}let o=oa.call(e);return n&&(t?e[Xt]=r:delete e[Xt]),o}function Jp(e){return oa.call(e)}var Zp=20;function ii(...e){let t=e.shift(),r=new WeakMap;for(;e.length>0;)t=sa(t,e.shift(),0,r);return t}function oi(e){return hn(e)?e.slice():e}function sa(e,t,r=0,n){let o;if(!(r>Zp)){if(r++,_n(e)||_n(t)||aa(t))o=oi(t);else if(hn(e)){if(o=e.slice(),hn(t))for(let i=0,s=t.length;i<s;i++)o.push(oi(t[i]));else if(nr(t)){let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];o[c]=oi(t[c])}}}else if(nr(e))if(nr(t)){if(!tl(e,t))return t;o=Object.assign({},e);let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s],u=t[c];if(_n(u))typeof u>"u"?delete o[c]:o[c]=u;else{let p=o[c],_=u;if(ia(e,c,n)||ia(t,c,n))delete o[c];else{if(nr(p)&&nr(_)){let d=n.get(p)||[],m=n.get(_)||[];d.push({obj:e,key:c}),m.push({obj:t,key:c}),n.set(p,d),n.set(_,m)}o[c]=sa(o[c],u,r,n)}}}}else o=t;return o}}function ia(e,t,r){let n=r.get(e[t])||[];for(let o=0,i=n.length;o<i;o++){let s=n[o];if(s.key===t&&s.obj===e)return!0}return!1}function hn(e){return Array.isArray(e)}function aa(e){return typeof e=="function"}function nr(e){return!_n(e)&&!hn(e)&&!aa(e)&&typeof e=="object"}function _n(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function tl(e,t){return!(!ni(e)||!ni(t))}var dn=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function or(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new dn("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function fn(e,t){return typeof t=="string"?e===t:!!e.match(t)}function ir(e,t){if(!t)return!1;for(let r of t)if(fn(e,r))return!0;return!1}var Tn=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}};var Ot=class{_isCalled=!1;_deferred=new Tn;_callback;_that;constructor(t,r){this._callback=t,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};function ca(e,t){return new Promise(r=>{E.with(Xe(E.active()),()=>{e.export(t,r)})})}var gn={_export:ca};function nl(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function ua(){return{handleResponse(e){e==null||!nl(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||l.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}var si=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(t,r,n,o,i){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=o,this._timeout=i,this._diagLogger=l.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:G.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(t);if(n==null){r({code:G.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(o=>{if(o.status==="success"){if(o.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(o.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,o.data)}r({code:G.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:G.FAILED,error:o.error});return}else o.status==="retryable"?r({code:G.FAILED,error:o.error??new Ke("Export failed with retryable status")}):r({code:G.FAILED,error:new Ke("Export failed with unknown error")})},o=>r({code:G.FAILED,error:o})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}};function pa(e,t){return new si(e.transport,e.serializer,ua(),e.promiseHandler,t.timeout)}function la(e,t,r){return pa({transport:r,serializer:t,promiseHandler:Bs(e)},{timeout:e.timeoutMillis})}function ue(e,t){let r={attributes:yt(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function pe(e){return{name:e.name,version:e.version}}function yt(e,t){return Object.keys(e).map(r=>ai(r,e[r],t))}function ai(e,t,r){return{key:e,value:sr(t,r)}}function sr(e,t){let r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=sr(e[o],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){let n=Object.keys(e),o=new Array(n.length);for(let i=0;i<n.length;i++)o[i]={key:n[i],value:sr(e[n[i]],t)};return{kvlistValue:{values:o}}}return{}}function ma(e,t){return{resourceLogs:il(e,t)}}function ol(e){let t=new Map;for(let r of e){let{resource:n,instrumentationScope:{name:o,version:i="",schemaUrl:s=""}}=r,a=t.get(n);a||(a=new Map,t.set(n,a));let c=`${o}@${i}:${s}`,u=a.get(c);u||(u=[],a.set(c,u)),u.push(r)}return t}function il(e,t){let r=ol(e);return Array.from(r,([n,o])=>{let i=ue(n,t);return{resource:i,scopeLogs:Array.from(o,([,s])=>({scope:pe(s[0].instrumentationScope),logRecords:s.map(a=>sl(a,t)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:i.schemaUrl}})}function sl(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:sr(e.body,t),eventName:e.eventName,attributes:al(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function al(e,t){return Object.keys(e).map(r=>ai(r,e[r],t))}function cl(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function ul(e){return cl(e).toString()}var pl=typeof BigInt<"u"?ul:tt;function _a(e){return e}var le={encodeHrTime:pl,encodeSpanContext:_a,encodeOptionalSpanContext:_a,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}};var k;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(k||(k={}));var g;(function(e){e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(g||(g={}));var F;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(F||(F={}));function En(e){let t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(r=>[r,e[r]])))}function ha(e){return`${e.name}:${e.version??""}:${e.schemaUrl??""}`}var ar=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function It(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new ar("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function da(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}function fa(e,t){let r=0,n=e.length-1,o=e.length;for(;n>=r;){let i=r+Math.trunc((n-r)/2);e[i]<t?r=i+1:(o=i,n=i-1)}return o}function Ta(e,t){return e.toLowerCase()===t.toLowerCase()}var et;(function(e){e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(et||(et={}));var cr=class{kind=et.DROP;createAccumulation(){}merge(t,r){}diff(t,r){}toMetricData(t,r,n,o){}};function ll(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var me=class{startTime;_boundaries;_recordMinMax;_current;constructor(t,r,n=!0,o=ll(r)){this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=o}record(t){if(Number.isNaN(t))return;this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);let r=fa(this._boundaries,t);this._current.buckets.counts[r]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},_e=class{kind=et.HISTOGRAM;_boundaries;_recordMinMax;constructor(t,r){this._boundaries=t,this._recordMinMax=r}createAccumulation(t){return new me(t,this._boundaries,this._recordMinMax)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let p=0;p<i.length;p++)a[p]=i[p]+s[p];let c=1/0,u=-1/0;return this._recordMinMax&&(n.hasMinMax&&o.hasMinMax?(c=Math.min(n.min,o.min),u=Math.max(n.max,o.max)):n.hasMinMax?(c=n.min,u=n.max):o.hasMinMax&&(c=o.min,u=o.max)),new me(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:n.count+o.count,sum:n.sum+o.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||o.hasMinMax),min:c,max:u})}diff(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let c=0;c<i.length;c++)a[c]=s[c]-i[c];return new me(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:o.count-n.count,sum:o.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:F.HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===g.GAUGE||t.type===g.UP_DOWN_COUNTER||t.type===g.OBSERVABLE_GAUGE||t.type===g.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}};var ur=class e{backing;indexBase;indexStart;indexEnd;constructor(t=new ci,r=0,n=0,o=0){this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=o}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(t,r)=>this.at(r))}at(t){let r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)}incrementBucket(t,r){this.backing.increment(t,r)}decrementBucket(t,r){this.backing.decrement(t,r)}trim(){for(let t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()}downscale(t){this._rotate();let r=1+this.indexEnd-this.indexStart,n=1<<t,o=0,i=0;for(let s=this.indexStart;s<=this.indexEnd;){let a=s%n;a<0&&(a+=n);for(let c=a;c<n&&o<r;c++)this._relocateBucket(i,o),o++,s++;i++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)}_relocateBucket(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))}},ci=class e{_counts;constructor(t=[0]){this._counts=t}get length(){return this._counts.length}countAt(t){return this._counts[t]}growTo(t,r,n){let o=new Array(t).fill(0);o.splice(n,this._counts.length-r,...this._counts.slice(r)),o.splice(0,r,...this._counts.slice(0,r)),this._counts=o}reverse(t,r){let n=Math.floor((t+r)/2)-t;for(let o=0;o<n;o++){let i=this._counts[t+o];this._counts[t+o]=this._counts[r-o-1],this._counts[r-o-1]=i}}emptyBucket(t){let r=this._counts[t];return this._counts[t]=0,r}increment(t,r){this._counts[t]+=r}decrement(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0}clone(){return new e([...this._counts])}};var pr=Math.pow(2,-1022);function Sn(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&2146435072)>>20)-1023}function An(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let r=t.getUint32(0),n=t.getUint32(4);return(r&1048575)*Math.pow(2,32)+n}function lr(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function Ea(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var pt=class extends Error{};var Rn=class{_shift;constructor(t){this._shift=-t}mapToIndex(t){if(t<pr)return this._minNormalLowerBoundaryIndex();let r=Sn(t),n=this._rightShift(An(t)-1,52);return r+n>>this._shift}lowerBoundary(t){let r=this._minNormalLowerBoundaryIndex();if(t<r)throw new pt(`underflow: ${t} is < minimum lower boundary: ${r}`);let n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new pt(`overflow: ${t} is > maximum lower boundary: ${n}`);return lr(1,t<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let t=-1022>>this._shift;return this._shift<2&&t--,t}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}_rightShift(t,r){return Math.floor(t*Math.pow(2,-r))}};var xn=class{_scale;_scaleFactor;_inverseFactor;constructor(t){this._scale=t,this._scaleFactor=lr(Math.LOG2E,t),this._inverseFactor=lr(Math.LN2,-t)}mapToIndex(t){if(t<=pr)return this._minNormalLowerBoundaryIndex()-1;if(An(t)===0)return(Sn(t)<<this._scale)-1;let r=Math.floor(Math.log(t)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return r>=n?n:r}lowerBoundary(t){let r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new pt(`overflow: ${t} is > maximum lower boundary: ${r}`)}let n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return pr;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new pt(`overflow: ${t} is < minimum lower boundary: ${n}`)}return Math.exp(t*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}};var Aa=-10,Ra=20,_l=Array.from({length:31},(e,t)=>t>10?new xn(t-10):new Rn(t-10));function li(e){if(e>Ra||e<Aa)throw new pt(`expected scale >= ${Aa} && <= ${Ra}, got: ${e}`);return _l[e+10]}var he=class e{static combine(t,r){return new e(Math.min(t.low,r.low),Math.max(t.high,r.high))}low;high;constructor(t,r){this.low=t,this.high=r}},hl=20,dl=160,mi=2,On=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(t,r=dl,n=!0,o=0,i=0,s=0,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=new ur,p=new ur,_=li(hl)){this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=o,this._count=i,this._zeroCount=s,this._min=a,this._max=c,this._positive=u,this._negative=p,this._mapping=_,this._maxSize<mi&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${mi}`),this._maxSize=mi)}record(t){this.updateByIncrement(t,1)}setStartTime(t){this.startTime=t}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}}merge(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)}diff(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(t,r,n){let o=this._mapping.mapToIndex(r),i=!1,s=0,a=0;if(t.length===0?(t.indexStart=o,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):o<t.indexStart&&t.indexEnd-o>=this._maxSize?(i=!0,a=o,s=t.indexEnd):o>t.indexEnd&&o-t.indexStart>=this._maxSize&&(i=!0,a=t.indexStart,s=o),i){let c=this._changeScale(s,a);this._downscale(c),o=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,o,n)}_incrementIndexBy(t,r,n){if(n===0)return;if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){let i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){let i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}let o=r-t.indexBase;o<0&&(o+=t.backing.length),t.incrementBucket(o,n)}_grow(t,r){let n=t.backing.length,o=t.indexBase-t.indexStart,i=n-o,s=Ea(r);s>this._maxSize&&(s=this._maxSize);let a=s-o;t.backing.growTo(s,i,a)}_changeScale(t,r){let n=0;for(;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n}_downscale(t){if(t===0)return;if(t<0)throw new Error(`impossible change of scale: ${this.scale}`);let r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=li(r)}_minScale(t){let r=Math.min(this.scale,t.scale),n=he.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),o=he.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(o.high,o.low))}_highLowAtScale(t,r,n){if(t.length===0)return new he(0,-1);let o=r-n;return new he(t.indexStart>>o,t.indexEnd>>o)}_mergeBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++)this._incrementIndexBy(t,i+a>>s,n.at(a))}_diffBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++){let u=(i+a>>s)-t.indexBase;u<0&&(u+=t.backing.length),t.decrementBucket(u,n.at(a))}t.trim()}},mr=class{kind=et.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(t,r){this._maxSize=t,this._recordMinMax=r}createAccumulation(t){return new On(t,this._maxSize,this._recordMinMax)}merge(t,r){let n=r.clone();return n.merge(t),n}diff(t,r){let n=r.clone();return n.diff(t),n}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:F.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===g.GAUGE||t.type===g.UP_DOWN_COUNTER||t.type===g.OBSERVABLE_GAUGE||t.type===g.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}};var de=class{startTime;_current;sampleTime;constructor(t,r=0,n=[0,0]){this.startTime=t,this._current=r,this.sampleTime=n}record(t){this._current=t,this.sampleTime=I(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},_r=class{kind=et.LAST_VALUE;createAccumulation(t){return new de(t)}merge(t,r){let n=ae(r.sampleTime)>=ae(t.sampleTime)?r:t;return new de(t.startTime,n.toPointValue(),n.sampleTime)}diff(t,r){let n=ae(r.sampleTime)>=ae(t.sampleTime)?r:t;return new de(r.startTime,n.toPointValue(),n.sampleTime)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:F.GAUGE,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()}))}}};var Dt=class{startTime;monotonic;_current;reset;constructor(t,r,n=0,o=!1){this.startTime=t,this.monotonic=r,this._current=n,this.reset=o}record(t){this.monotonic&&t<0||(this._current+=t)}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},fe=class{kind=et.SUM;monotonic;constructor(t){this.monotonic=t}createAccumulation(t){return new Dt(t,this.monotonic)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue();return r.reset?new Dt(r.startTime,this.monotonic,o,r.reset):new Dt(t.startTime,this.monotonic,n+o)}diff(t,r){let n=t.toPointValue(),o=r.toPointValue();return this.monotonic&&n>o?new Dt(r.startTime,this.monotonic,o,!0):new Dt(r.startTime,this.monotonic,o-n)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:F.SUM,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()})),isMonotonic:this.monotonic}}};var _i=class e{static DEFAULT_INSTANCE=new cr;createAggregator(t){return e.DEFAULT_INSTANCE}};var hi=class e{static MONOTONIC_INSTANCE=new fe(!0);static NON_MONOTONIC_INSTANCE=new fe(!1);createAggregator(t){switch(t.type){case g.COUNTER:case g.OBSERVABLE_COUNTER:case g.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};var di=class e{static DEFAULT_INSTANCE=new _r;createAggregator(t){return e.DEFAULT_INSTANCE}};var fi=class e{static DEFAULT_INSTANCE=new _e([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}};var hr=class{_boundaries;_recordMinMax;constructor(t,r=!0){if(t==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");t=t.concat(),t=t.sort((i,s)=>i-s);let n=t.lastIndexOf(-1/0),o=t.indexOf(1/0);o===-1&&(o=void 0),this._boundaries=t.slice(n+1,o),this._recordMinMax=r}createAggregator(t){return new _e(this._boundaries,this._recordMinMax)}},dr=class{_maxSize;_recordMinMax;constructor(t=160,r=!0){this._maxSize=t,this._recordMinMax=r}createAggregator(t){return new mr(this._maxSize,this._recordMinMax)}},Ti=class{_resolve(t){switch(t.type){case g.COUNTER:case g.UP_DOWN_COUNTER:case g.OBSERVABLE_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:return Ei;case g.GAUGE:case g.OBSERVABLE_GAUGE:return Si;case g.HISTOGRAM:return t.advice.explicitBucketBoundaries?new hr(t.advice.explicitBucketBoundaries):Ai}return l.warn(`Unable to recognize instrument type: ${t.type}`),gi}createAggregator(t){return this._resolve(t).createAggregator(t)}},gi=new _i,Ei=new hi,Si=new di,Ai=new fi,zT=new dr,xa=new Ti;var $;(function(e){e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})($||($={}));function yn(e){switch(e.type){case $.DEFAULT:return xa;case $.DROP:return gi;case $.SUM:return Ei;case $.LAST_VALUE:return Si;case $.EXPONENTIAL_HISTOGRAM:{let t=e;return new dr(t.options?.maxSize,t.options?.recordMinMax)}case $.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Ai:new hr(t.options?.boundaries,t.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var Oa=e=>({type:$.DEFAULT}),ya=e=>k.CUMULATIVE;var bn=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;constructor(t){this._aggregationSelector=t?.aggregationSelector??Oa,this._aggregationTemporalitySelector=t?.aggregationTemporalitySelector??ya,this._metricProducers=t?.metricProducers??[],this._cardinalitySelector=t?.cardinalitySelector}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}selectCardinalityLimit(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3}onInitialized(){}async collect(t){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let[r,...n]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis}),...this._metricProducers.map(a=>a.collect({timeoutMillis:t?.timeoutMillis}))]),o=r.errors.concat(n.flatMap(a=>a.errors)),i=r.resourceMetrics.resource,s=r.resourceMetrics.scopeMetrics.concat(n.flatMap(a=>a.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:i,scopeMetrics:s},errors:o}}async shutdown(t){if(this._shutdown){l.error("Cannot call shutdown twice.");return}t?.timeoutMillis==null?await this.onShutdown():await It(this.onShutdown(),t.timeoutMillis),this._shutdown=!0}async forceFlush(t){if(this._shutdown){l.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(t?.timeoutMillis==null){await this.onForceFlush();return}await It(this.onForceFlush(),t.timeoutMillis)}};var fr=class extends bn{_interval;_exporter;_exportInterval;_exportTimeout;constructor(t){let{exporter:r,exportIntervalMillis:n=6e4,metricProducers:o}=t,{exportTimeoutMillis:i=3e4}=t;if(super({aggregationSelector:r.selectAggregation?.bind(r),aggregationTemporalitySelector:r.selectAggregationTemporality?.bind(r),metricProducers:o}),n<=0)throw Error("exportIntervalMillis must be greater than 0");if(i<=0)throw Error("exportTimeoutMillis must be greater than 0");if(n<i){if("exportIntervalMillis"in t&&"exportTimeoutMillis"in t)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");l.info(`Timeout of ${i} exceeds the interval of ${n}. Clamping timeout to interval duration.`),i=n}this._exportInterval=n,this._exportTimeout=i,this._exporter=r}async _runOnce(){try{await It(this._doRun(),this._exportTimeout)}catch(t){if(t instanceof ar){l.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout);return}P(t)}}async _doRun(){let{resourceMetrics:t,errors:r}=await this.collect({timeoutMillis:this._exportTimeout});if(r.length>0&&l.error("PeriodicExportingMetricReader: metrics collection errors",...r),t.resource.asyncAttributesPending)try{await t.resource.waitForAsyncAttributes?.()}catch(o){l.debug("Error while resolving async portion of resource: ",o),P(o)}if(t.scopeMetrics.length===0)return;let n=await gn._export(this._exporter,t);if(n.code!==G.SUCCESS)throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${n.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};var wn;function ba(){if(wn===void 0)try{let e=globalThis.process.argv0;wn=e?`unknown_service:${e}`:"unknown_service"}catch{wn="unknown_service"}return wn}var Te=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";var Ri=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,r){let n=new e({},r);return n._rawAttributes=wa(t),n._asyncAttributesPending=t.filter(([o,i])=>Te(i)).length>0,n}constructor(t,r){let n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([o,i])=>(Te(i)&&(this._asyncAttributesPending=!0),[o,i])),this._rawAttributes=wa(this._rawAttributes),this._schemaUrl=fl(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){let[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,Te(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&l.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let t={};for(let[r,n]of this._rawAttributes){if(Te(n)){l.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(t[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let r=Tl(this,t),n=r?{schemaUrl:r}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}};function Nn(e,t){return Ri.FromAttributeList(Object.entries(e),t)}function Yt(){return Nn({[Ws]:ba(),[Qe]:Mt[Qe],[Je]:Mt[Je],[Ze]:Mt[Ze]})}function wa(e){return e.map(([t,r])=>Te(r)?[t,r.catch(n=>{l.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function fl(e){if(typeof e=="string"||e===void 0)return e;l.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function Tl(e,t){let r=e?.schemaUrl,n=t?.schemaUrl,o=r===void 0||r==="",i=n===void 0||n==="";if(o)return n;if(i||r===n)return r;l.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var Ln=class{_registeredViews=[];addView(t){this._registeredViews.push(t)}findViews(t,r){return this._registeredViews.filter(o=>this._matchInstrument(o.instrumentSelector,t)&&this._matchMeter(o.meterSelector,r))}_matchInstrument(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)}_matchMeter(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))}};function lt(e,t,r){return El(e)||l.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:r?.description??"",unit:r?.unit??"",valueType:r?.valueType??Y.DOUBLE,advice:r?.advice??{}}}function Na(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function La(e,t){return Ta(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var gl=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function El(e){return gl.test(e)}var ge=class{_writableMetricStorage;_descriptor;constructor(t,r){this._writableMetricStorage=t,this._descriptor=r}_record(t,r={},n=E.active()){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===Y.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,I(Date.now()))}},vn=class extends ge{add(t,r,n){this._record(t,r,n)}},Pn=class extends ge{add(t,r,n){if(t<0){l.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},Cn=class extends ge{record(t,r,n){this._record(t,r,n)}},Mn=class extends ge{record(t,r,n){if(t<0){l.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},Ee=class{_metricStorages;_descriptor;_observableRegistry;constructor(t,r,n){this._descriptor=t,this._metricStorages=r,this._observableRegistry=n}addCallback(t){this._observableRegistry.addCallback(t,this)}removeCallback(t){this._observableRegistry.removeCallback(t,this)}},In=class extends Ee{},Dn=class extends Ee{},Un=class extends Ee{};function Tr(e){return e instanceof Ee}var Bn=class{_meterSharedState;constructor(t){this._meterSharedState=t}createGauge(t,r){let n=lt(t,g.GAUGE,r),o=this._meterSharedState.registerMetricStorage(n);return new Cn(o,n)}createHistogram(t,r){let n=lt(t,g.HISTOGRAM,r),o=this._meterSharedState.registerMetricStorage(n);return new Mn(o,n)}createCounter(t,r){let n=lt(t,g.COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new Pn(o,n)}createUpDownCounter(t,r){let n=lt(t,g.UP_DOWN_COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new vn(o,n)}createObservableGauge(t,r){let n=lt(t,g.OBSERVABLE_GAUGE,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Dn(n,o,this._meterSharedState.observableRegistry)}createObservableCounter(t,r){let n=lt(t,g.OBSERVABLE_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new In(n,o,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,r){let n=lt(t,g.OBSERVABLE_UP_DOWN_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Un(n,o,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)}removeBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)}};var Se=class{_instrumentDescriptor;constructor(t){this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=lt(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};var xi=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(t){this._hash=t}get(t,r){return r??=this._hash(t),this._valueMap.get(r)}getOrDefault(t,r){let n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);let o=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,o),o}set(t,r,n){n??=this._hash(t),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)}has(t,r){return r??=this._hash(t),this._valueMap.has(r)}*keys(){let t=this._keyMap.entries(),r=t.next();for(;r.done!==!0;)yield[r.value[1],r.value[0]],r=t.next()}*entries(){let t=this._valueMap.entries(),r=t.next();for(;r.done!==!0;)yield[this._keyMap.get(r.value[0]),r.value[1],r.value[0]],r=t.next()}get size(){return this._valueMap.size}},Q=class extends xi{constructor(){super(En)}};var Ae=class{_activeCollectionStorage=new Q;_cumulativeMemoStorage=new Q;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(t,r){this._aggregator=t,this._cardinalityLimit=(r??2e3)-1,this._overflowHashCode=En(this._overflowAttributes)}record(t,r,n,o){let i=this._activeCollectionStorage.get(r);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(o))?.record(t);return}i=this._aggregator.createAccumulation(o),this._activeCollectionStorage.set(r,i)}i?.record(t)}batchCumulate(t,r){Array.from(t.entries()).forEach(([n,o,i])=>{let s=this._aggregator.createAccumulation(r);s?.record(o);let a=s;if(this._cumulativeMemoStorage.has(n,i)){let c=this._cumulativeMemoStorage.get(n,i);a=this._aggregator.diff(c,s)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(n=this._overflowAttributes,i=this._overflowHashCode,this._cumulativeMemoStorage.has(n,i))){let c=this._cumulativeMemoStorage.get(n,i);a=this._aggregator.diff(c,s)}if(this._activeCollectionStorage.has(n,i)){let c=this._activeCollectionStorage.get(n,i);a=this._aggregator.merge(c,a)}this._cumulativeMemoStorage.set(n,s,i),this._activeCollectionStorage.set(n,a,i)})}collect(){let t=this._activeCollectionStorage;return this._activeCollectionStorage=new Q,t}};var Re=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(t,r){this._aggregator=t,r.forEach(n=>{this._unreportedAccumulations.set(n,[])})}buildMetrics(t,r,n,o){this._stashAccumulations(n);let i=this._getMergedUnreportedAccumulations(t),s=i,a;if(this._reportHistory.has(t)){let u=this._reportHistory.get(t),p=u.collectionTime;a=u.aggregationTemporality,a===k.CUMULATIVE?s=e.merge(u.accumulations,i,this._aggregator):s=e.calibrateStartTime(u.accumulations,i,p)}else a=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:o,aggregationTemporality:a});let c=Sl(s);if(c.length!==0)return this._aggregator.toMetricData(r,a,c,o)}_stashAccumulations(t){let r=this._unreportedAccumulations.keys();for(let n of r){let o=this._unreportedAccumulations.get(n);o===void 0&&(o=[],this._unreportedAccumulations.set(n,o)),o.push(t)}}_getMergedUnreportedAccumulations(t){let r=new Q,n=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),n===void 0)return r;for(let o of n)r=e.merge(r,o,this._aggregator);return r}static merge(t,r,n){let o=t,i=r.entries(),s=i.next();for(;s.done!==!0;){let[a,c,u]=s.value;if(t.has(a,u)){let p=t.get(a,u),_=n.merge(p,c);o.set(a,_,u)}else o.set(a,c,u);s=i.next()}return o}static calibrateStartTime(t,r,n){for(let[o,i]of t.keys())r.get(o,i)?.setStartTime(n);return r}};function Sl(e){return Array.from(e.entries())}var Gn=class extends Se{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ae(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Re(r,o),this._attributesProcessor=n}record(t,r){let n=new Q;Array.from(t.entries()).forEach(([o,i])=>{n.set(this._attributesProcessor.process(o),i)}),this._deltaMetricStorage.batchCumulate(n,r)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};function Oi(e,t){let r="";return e.unit!==t.unit&&(r+=` - Unit '${e.unit}' does not match '${t.unit}'
|
|
1
|
+
(()=>{var At="1.9.1";var sa=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Fl(e){let t=new Set([e]),r=new Set,n=e.match(sa);if(!n)return()=>!1;let o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===e};function i(a){return r.add(a),!1}function s(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;let u=c.match(sa);if(!u)return i(c);let p={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var aa=Fl(At);var zl=At.split(".")[0],$e=Symbol.for(`opentelemetry.js.api.${zl}`),We=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function st(e,t,r,n=!1){var o;let i=We[$e]=(o=We[$e])!==null&&o!==void 0?o:{version:At};if(!n&&i[e]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(i.version!==At){let s=new Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${At}`);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${At}.`),!0}function j(e){var t,r;let n=(t=We[$e])===null||t===void 0?void 0:t.version;if(!(!n||!aa(n)))return(r=We[$e])===null||r===void 0?void 0:r[e]}function at(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${At}.`);let r=We[$e];r&&delete r[e]}var on=class{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return je("debug",this._namespace,t)}error(...t){return je("error",this._namespace,t)}info(...t){return je("info",this._namespace,t)}warn(...t){return je("warn",this._namespace,t)}verbose(...t){return je("verbose",this._namespace,t)}};function je(e,t,r){let n=j("diag");if(n)return n[e](t,...r)}var O;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(O||(O={}));function ca(e,t){e<O.NONE?e=O.NONE:e>O.ALL&&(e=O.ALL),t=t||{};function r(n,o){let i=t[n];return typeof i=="function"&&e>=o?i.bind(t):function(){}}return{error:r("error",O.ERROR),warn:r("warn",O.WARN),info:r("info",O.INFO),debug:r("debug",O.DEBUG),verbose:r("verbose",O.VERBOSE)}}var $l="diag",y=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(o){return function(...i){let s=j("diag");if(s)return s[o](...i)}}let r=this,n=(o,i={logLevel:O.INFO})=>{var s,a,c;if(o===r){let m=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=m.stack)!==null&&s!==void 0?s:m.message),!1}typeof i=="number"&&(i={logLevel:i});let u=j("diag"),p=ca((a=i.logLevel)!==null&&a!==void 0?a:O.INFO,o);if(u&&!i.suppressOverrideMessage){let m=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn(`Current logger will be overwritten from ${m}`),p.warn(`Current logger will overwrite one already registered from ${m}`)}return st("diag",p,r,!0)};r.setLogger=n,r.disable=()=>{at($l,r)},r.createComponentLogger=o=>new on(o),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}};var sn=class e{constructor(t){this._entries=t?new Map(t):new Map}getEntry(t){let r=this._entries.get(t);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,r){let n=new e(this._entries);return n._entries.set(t,r),n}removeEntry(t){let r=new e(this._entries);return r._entries.delete(t),r}removeEntries(...t){let r=new e(this._entries);for(let n of t)r._entries.delete(n);return r}clear(){return new e}};var ua=Symbol("BaggageEntryMetadata");var Wl=y.instance();function la(e={}){return new sn(new Map(Object.entries(e)))}function fi(e){return typeof e!="string"&&(Wl.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:ua,toString(){return e}}}function Wt(e){return Symbol.for(e)}var Ti=class e{constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,o)=>{let i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=n=>{let o=new e(r._currentContext);return o._currentContext.delete(n),o}}},B=new Ti;var gi=class{constructor(){}createGauge(t,r){return Kl}createHistogram(t,r){return Xl}createCounter(t,r){return jl}createUpDownCounter(t,r){return Yl}createObservableGauge(t,r){return Ql}createObservableCounter(t,r){return ql}createObservableUpDownCounter(t,r){return Jl}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}},oe=class{},Ei=class extends oe{add(t,r){}},Ai=class extends oe{add(t,r){}},Si=class extends oe{record(t,r){}},Ri=class extends oe{record(t,r){}},Ke=class{addCallback(t){}removeCallback(t){}},xi=class extends Ke{},Oi=class extends Ke{},Li=class extends Ke{},bi=new gi,jl=new Ei,Kl=new Si,Xl=new Ri,Yl=new Ai,ql=new xi,Ql=new Oi,Jl=new Li;function St(){return bi}var K;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(K||(K={}));var pa={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},_a={set(e,t,r){e!=null&&(e[t]=r)}};var an=class{active(){return B}with(t,r,n,...o){return r.call(n,...o)}bind(t,r){return r}enable(){return this}disable(){return this}};var wi="context",Zl=new an,ct=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return st(wi,t,y.instance())}active(){return this._getContextManager().active()}with(t,r,n,...o){return this._getContextManager().with(t,r,n,...o)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return j(wi)||Zl}disable(){this._getContextManager().disable(),at(wi,y.instance())}};var C;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(C||(C={}));var cn="0000000000000000",un="00000000000000000000000000000000",Xe={traceId:un,spanId:cn,traceFlags:C.NONE};var ut=class{constructor(t=Xe){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}};var Ni=Wt("OpenTelemetry Context Key SPAN");function ln(e){return e.getValue(Ni)||void 0}function ma(){return ln(ct.getInstance().active())}function Ye(e,t){return e.setValue(Ni,t)}function da(e){return e.deleteValue(Ni)}function ha(e,t){return Ye(e,new ut(t))}function pn(e){var t;return(t=ln(e))===null||t===void 0?void 0:t.spanContext()}var _n=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function fa(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(_n[e.charCodeAt(n)]|0)+(_n[e.charCodeAt(n+1)]|0)+(_n[e.charCodeAt(n+2)]|0)+(_n[e.charCodeAt(n+3)]|0);return r===t}function mn(e){return fa(e,32)&&e!==un}function Ta(e){return fa(e,16)&&e!==cn}function X(e){return mn(e.traceId)&&Ta(e.spanId)}function ga(e){return new ut(e)}var yi=ct.getInstance(),ie=class{startSpan(t,r,n=yi.active()){if(!!r?.root)return new ut;let i=n&&pn(n);return tp(i)&&X(i)?new ut(i):new ut}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??yi.active(),u=this.startSpan(t,i,c),p=Ye(c,u);return yi.with(p,a,void 0,u)}};function tp(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var ep=new ie,dn=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,o){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):ep}};var hn=class{getTracer(t,r,n){return new ie}};var rp=new hn,qe=class{getTracer(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new dn(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:rp}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)}};var se;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(se||(se={}));var Rt;(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"})(Rt||(Rt={}));var Y;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Y||(Y={}));var E=ct.getInstance();var l=y.instance();var Ci=class{getMeter(t,r,n){return bi}},Ea=new Ci;var Pi="metrics",fn=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(t){return st(Pi,t,y.instance())}getMeterProvider(){return j(Pi)||Ea}getMeter(t,r,n){return this.getMeterProvider().getMeter(t,r,n)}disable(){at(Pi,y.instance())}};var xt=fn.getInstance();var Tn=class{inject(t,r){}extract(t,r){return t}fields(){return[]}};var Ii=Wt("OpenTelemetry Baggage Key");function Mi(e){return e.getValue(Ii)||void 0}function Aa(){return Mi(ct.getInstance().active())}function Sa(e,t){return e.setValue(Ii,t)}function Ra(e){return e.deleteValue(Ii)}var vi="propagation",np=new Tn,gn=class e{constructor(){this.createBaggage=la,this.getBaggage=Mi,this.getActiveBaggage=Aa,this.setBaggage=Sa,this.deleteBaggage=Ra}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(t){return st(vi,t,y.instance())}inject(t,r,n=_a){return this._getGlobalPropagator().inject(t,r,n)}extract(t,r,n=pa){return this._getGlobalPropagator().extract(t,r,n)}fields(){return this._getGlobalPropagator().fields()}disable(){at(vi,y.instance())}_getGlobalPropagator(){return j(vi)||np}};var D=gn.getInstance();var Di="trace",En=class e{constructor(){this._proxyTracerProvider=new qe,this.wrapSpanContext=ga,this.isSpanContextValid=X,this.deleteSpan=da,this.getSpan=ln,this.getActiveSpan=ma,this.getSpanContext=pn,this.setSpan=Ye,this.setSpanContext=ha}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=st(Di,this._proxyTracerProvider,y.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return j(Di)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){at(Di,y.instance()),this._proxyTracerProvider=new qe}};var S=En.getInstance();var Lt;(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"})(Lt||(Lt={}));var Qe=class{emit(t){}enabled(){return!1}},Ui=new Qe;function Bi(){return Ui}var Je=Symbol.for("io.opentelemetry.js.api.logs"),ae=globalThis;function xa(e,t,r){return n=>n===e?t:r}var Gi=1;var Hi=class{getLogger(t,r,n){return new Qe}},An=new Hi;var Sn=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Ui}};var Ze=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new Sn(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:An}_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 Rn=class e{constructor(){this._proxyLoggerProvider=new Ze}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return ae[Je]?this.getLoggerProvider():(ae[Je]=xa(Gi,t,An),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=ae[Je])===null||t===void 0?void 0:t.call(ae,Gi))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete ae[Je],this._proxyLoggerProvider=new Ze}};var Dt=Rn.getInstance();var bt=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 tr=class extends Error{code;name="OTLPExporterError";data;constructor(t,r,n){super(t),this.data=n,this.code=r}};function op(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Oa(e){if(e!=null)return async()=>e}function La(e,t,r){return{timeoutMillis:op(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function ba(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Vi=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 wa(e){return new Vi(e.concurrencyLimit)}var Na=Wt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function jt(e){return e.setValue(Na,!0)}function Kt(e){return e.getValue(Na)===!0}var xn="baggage";function Pa(e){return e.reduce((t,r)=>{let n=`${t}${t!==""?",":""}${r}`;return n.length>8192?t:n},"")}function Ia(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 cp(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=fi(u)}return{key:s,value:a,metadata:c}}function ki(e,t,r,n){let o=0;for(;o<e.length&&r<180;){let i=e.indexOf(",",o),s=i===-1?e.length:i,a=s-o;if(a<=4096){let c=cp(e.substring(o,s));if(c){let u=(r===0?0:1)+a;if(n+u>8192)break;t[c.key]=c.metadata?{value:c.value,metadata:c.metadata}:{value:c.value},r++,n+=u}}if(i===-1)break;o=i+1}return[r,n]}var er=class{inject(t,r,n){let o=D.getBaggage(t);if(!o||Kt(t))return;let i=Ia(o).filter(a=>a.length<=4096).slice(0,180),s=Pa(i);s.length>0&&n.set(r,xn,s)}extract(t,r,n){let o=n.get(r,xn);if(!o)return t;let i={},s=0,a=0;if(Array.isArray(o))for(let c=0;c<o.length;c++)[s,a]=ki(o[c],i,s,a);else[s]=ki(o,i,s,a);return s===0?t:D.setBaggage(t,D.createBaggage(i))}fields(){return[xn]}};function Ut(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(!up(r)){l.warn(`Invalid attribute key: ${r}`);continue}let n=e[r];if(!On(n)){l.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function up(e){return typeof e=="string"&&e!==""}function On(e){return e==null?!0:Array.isArray(e)?lp(e):Ma(typeof e)}function lp(e){let t;for(let r of e){if(r==null)continue;let n=typeof r;if(n!==t){if(!t){if(Ma(n)){t=n;continue}return!1}return!1}}return!0}function Ma(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function va(){return e=>{l.error(pp(e))}}function pp(e){return typeof e=="string"?e:JSON.stringify(_p(e))}function _p(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 mp=va();function P(e){try{mp(e)}catch{}}var Da="2.8.0";var rr="error.type";var J="exception.message",Xt="exception.stacktrace",nt="exception.type";var Ln="http.request.method";var bn="http.request.method_original";var wn="http.response.status_code";var Nn="server.address",yn="server.port";var Ua="service.name";var nr="telemetry.sdk.language";var Ba="webjs",or="telemetry.sdk.name",ir="telemetry.sdk.version";var ot="url.full";var Ga="user_agent.original";var Ha="process.runtime.name";var Bt={[or]:"opentelemetry",[Ha]:"browser",[nr]:Ba,[ir]:Da};var N=performance;var dp=9,hp=6,fp=Math.pow(10,hp),sr=Math.pow(10,dp);function I(e){let t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*fp);return[r,n]}function b(e){let t=I(N.timeOrigin),r=I(typeof e=="number"?e:N.now());return Pn(t,r)}function lt(e){if(cr(e))return e;if(typeof e=="number")return e<N.timeOrigin?b(e):I(e);if(e instanceof Date)return I(e.getTime());throw TypeError("Invalid input type")}function ar(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=sr),[r,n]}function Z(e){return e[0]*sr+e[1]}function ce(e){return e[0]*1e6+e[1]/1e3}function Fi(e){return e[0]+e[1]/sr}function cr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function Cn(e){return cr(e)||typeof e=="number"||e instanceof Date}function Pn(e,t){let r=[e[0]+t[0],e[1]+t[1]];return r[1]>=sr&&(r[1]-=sr,r[0]+=1),r}var U;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(U||(U={}));var ur=class{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[];let r=new Set;for(let n of this._propagators){let o=typeof n.fields=="function"?n.fields():[];for(let i of o)r.add(i)}this._fields=Array.from(r)}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 zi="[_0-9a-z-*/]",Tp=`[a-z]${zi}{0,255}`,gp=`[a-z0-9]${zi}{0,240}@[a-z]${zi}{0,13}`,Ep=new RegExp(`^(?:${Tp}|${gp})$`),Ap=/^[ -~]{0,255}[!-~]$/,Sp=/,|=/;function $i(e){return Ep.test(e)}function Wi(e){return Ap.test(e)&&!Sp.test(e)}var Rp=32,Va=512,ka=",",Fa="=",In=class e{_length;_rawTraceState;_internalState;constructor(t){this._rawTraceState=typeof t=="string"?t:"",this._length=this._rawTraceState.length}set(t,r){if(!$i(t)||!Wi(r))return this;let n=this._getState(),o=n.get(t),i=this._length;if(typeof o=="string"?i+=r.length-o.length:i+=t.length+r.length+(n.size>0?2:1),i>Va)return this;let s=new Map(n);return s.delete(t),s.set(t,r),this._fromState(s,i)}unset(t){let r=this._getState(),n=r.get(t);if(typeof n!="string")return this;let o=this._length-(t.length+n.length+1);r.size>1&&(o=o-1);let i=new Map(r);return i.delete(t),this._fromState(i,o)}get(t){return this._getState().get(t)}serialize(){let t="",r=0;for(let n of this._getState())r>0&&(t=ka+t),t=`${n[0]}${Fa}${n[1]}`+t,r++;return t}_getState(){if(this._internalState)return this._internalState;let t=this._rawTraceState.split(ka),r=new Map,n=0;for(let o of t){let i=o.trim(),s=i.indexOf(Fa);if(s===-1)continue;let a=i.slice(0,s),c=i.slice(s+1);if(!$i(a)||!Wi(c))continue;let u=n+i.length+(r.size>0?1:0);if(!(u>Va)&&(r.set(a,c),n=u,r.size>=Rp))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(t,r){let n=Object.create(e.prototype);return n._internalState=t,n._length=r,n}};var ue="traceparent",Mn="tracestate",xp="00",Op="(?!ff)[\\da-f]{2}",Lp="(?![0]{32})[\\da-f]{32}",bp="(?![0]{16})[\\da-f]{16}",wp="[\\da-f]{2}",Np=new RegExp(`^\\s?(${Op})-(${Lp})-(${bp})-(${wp})(-.*)?\\s?$`);function za(e){let t=Np.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var lr=class{inject(t,r,n){let o=S.getSpanContext(t);if(!o||Kt(t)||!X(o))return;let i=`${xp}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||C.NONE).toString(16)}`;n.set(r,ue,i),o.traceState&&n.set(r,Mn,o.traceState.serialize())}extract(t,r,n){let o=n.get(r,ue);if(!o)return t;let i=Array.isArray(o)?o[0]:o;if(typeof i!="string")return t;let s=za(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 In(typeof c=="string"?c:void 0)}return S.setSpanContext(t,s)}fields(){return[ue,Mn]}};var yp="[object Object]",Cp="[object Null]",Pp="[object Undefined]",Ip=Function.prototype,$a=Ip.toString,Mp=$a.call(Object),vp=Object.getPrototypeOf,Wa=Object.prototype,ja=Wa.hasOwnProperty,Yt=Symbol?Symbol.toStringTag:void 0,Ka=Wa.toString;function ji(e){if(!Dp(e)||Up(e)!==yp)return!1;let t=vp(e);if(t===null)return!0;let r=ja.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&$a.call(r)===Mp}function Dp(e){return e!=null&&typeof e=="object"}function Up(e){return e==null?e===void 0?Pp:Cp:Yt&&Yt in Object(e)?Bp(e):Gp(e)}function Bp(e){let t=ja.call(e,Yt),r=e[Yt],n=!1;try{e[Yt]=void 0,n=!0}catch{}let o=Ka.call(e);return n&&(t?e[Yt]=r:delete e[Yt]),o}function Gp(e){return Ka.call(e)}var Hp=20;function Xi(...e){let t=e.shift(),r=new WeakMap;for(;e.length>0;)t=Ya(t,e.shift(),0,r);return t}function Ki(e){return Dn(e)?e.slice():e}function Ya(e,t,r=0,n){let o;if(!(r>Hp)){if(r++,vn(e)||vn(t)||qa(t))o=Ki(t);else if(Dn(e)){if(o=e.slice(),Dn(t))for(let i=0,s=t.length;i<s;i++)o.push(Ki(t[i]));else if(pr(t)){let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];c==="__proto__"||c==="constructor"||c==="prototype"||(o[c]=Ki(t[c]))}}}else if(pr(e))if(pr(t)){if(!Vp(e,t))return t;o=Object.assign({},e);let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;let u=t[c];if(vn(u))typeof u>"u"?delete o[c]:o[c]=u;else{let p=o[c],m=u;if(Xa(e,c,n)||Xa(t,c,n))delete o[c];else{if(pr(p)&&pr(m)){let f=n.get(p)||[],_=n.get(m)||[];f.push({obj:e,key:c}),_.push({obj:t,key:c}),n.set(p,f),n.set(m,_)}o[c]=Ya(o[c],u,r,n)}}}}else o=t;return o}}function Xa(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 Dn(e){return Array.isArray(e)}function qa(e){return typeof e=="function"}function pr(e){return!vn(e)&&!Dn(e)&&!qa(e)&&typeof e=="object"}function vn(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function Vp(e,t){return!(!ji(e)||!ji(t))}var Un=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Yi(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new Un("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function Bn(e,t){return typeof t=="string"?e===t:!!e.match(t)}function _r(e,t){if(!t)return!1;for(let r of t)if(Bn(e,r))return!0;return!1}var Gn=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 wt=class{_isCalled=!1;_deferred=new Gn;_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 Qa(e,t){return new Promise(r=>{E.with(jt(E.active()),()=>{e.export(t,r)})})}var Ja={_export:Qa};function zp(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function Za(){return{handleResponse(e){e==null||!zp(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||l.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}var qi=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(t,r,n,o,i){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=o,this._timeout=i,this._diagLogger=l.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:U.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(t);if(n==null){r({code:U.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(o=>{if(o.status==="success"){if(o.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(o.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,o.data)}r({code:U.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:U.FAILED,error:o.error});return}else o.status==="retryable"?r({code:U.FAILED,error:o.error??new tr("Export failed with retryable status")}):r({code:U.FAILED,error:new tr("Export failed with unknown error")})},o=>r({code:U.FAILED,error:o})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}};function tc(e,t){return new qi(e.transport,e.serializer,Za(),e.promiseHandler,t.timeout)}function ec(e,t,r){return tc({transport:r,serializer:t,promiseHandler:wa(e)},{timeout:e.timeoutMillis})}var G;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(G||(G={}));var T;(function(e){e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(T||(T={}));var H;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(H||(H={}));function Hn(e){let t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(r=>[r,e[r]])))}function rc(e){return`${e.name}:${e.version??""}:${e.schemaUrl??""}`}var mr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Gt(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new mr("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function nc(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}function oc(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 ic(e,t){return e.toLowerCase()===t.toLowerCase()}var tt;(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"})(tt||(tt={}));var dr=class{kind=tt.DROP;createAccumulation(){}merge(t,r){}diff(t,r){}toMetricData(t,r,n,o){}};function $p(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 le=class{startTime;_boundaries;_recordMinMax;_current;constructor(t,r,n=!0,o=$p(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=oc(this._boundaries,t);this._current.buckets.counts[r]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},pe=class{kind=tt.HISTOGRAM;_boundaries;_recordMinMax;constructor(t,r){this._boundaries=t,this._recordMinMax=r}createAccumulation(t){return new le(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 le(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 le(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:o.count-n.count,sum:o.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===T.GAUGE||t.type===T.UP_DOWN_COUNTER||t.type===T.OBSERVABLE_GAUGE||t.type===T.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}};var hr=class e{backing;indexBase;indexStart;indexEnd;constructor(t=new Qi,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))}},Qi=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 fr=Math.pow(2,-1022);function Vn(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&2146435072)>>20)-1023}function kn(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 Tr(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function ac(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 Fn=class{_shift;constructor(t){this._shift=-t}mapToIndex(t){if(t<fr)return this._minNormalLowerBoundaryIndex();let r=Vn(t),n=this._rightShift(kn(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 Tr(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 zn=class{_scale;_scaleFactor;_inverseFactor;constructor(t){this._scale=t,this._scaleFactor=Tr(Math.LOG2E,t),this._inverseFactor=Tr(Math.LN2,-t)}mapToIndex(t){if(t<=fr)return this._minNormalLowerBoundaryIndex()-1;if(kn(t)===0)return(Vn(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 fr;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 uc=-10,lc=20,jp=Array.from({length:31},(e,t)=>t>10?new zn(t-10):new Fn(t-10));function ts(e){if(e>lc||e<uc)throw new pt(`expected scale >= ${uc} && <= ${lc}, got: ${e}`);return jp[e+10]}var _e=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}},Kp=20,Xp=160,es=2,$n=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(t,r=Xp,n=!0,o=0,i=0,s=0,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=new hr,p=new hr,m=ts(Kp)){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=m,this._maxSize<es&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${es}`),this._maxSize=es)}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=ac(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=ts(r)}_minScale(t){let r=Math.min(this.scale,t.scale),n=_e.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),o=_e.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 _e(0,-1);let o=r-n;return new _e(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()}},gr=class{kind=tt.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(t,r){this._maxSize=t,this._recordMinMax=r}createAccumulation(t){return new $n(t,this._maxSize,this._recordMinMax)}merge(t,r){let n=r.clone();return n.merge(t),n}diff(t,r){let n=r.clone();return n.diff(t),n}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===T.GAUGE||t.type===T.UP_DOWN_COUNTER||t.type===T.OBSERVABLE_GAUGE||t.type===T.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}};var me=class{startTime;_current;sampleTime;constructor(t,r=0,n=[0,0]){this.startTime=t,this._current=r,this.sampleTime=n}record(t){this._current=t,this.sampleTime=I(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},Er=class{kind=tt.LAST_VALUE;createAccumulation(t){return new me(t)}merge(t,r){let n=ce(r.sampleTime)>=ce(t.sampleTime)?r:t;return new me(t.startTime,n.toPointValue(),n.sampleTime)}diff(t,r){let n=ce(r.sampleTime)>=ce(t.sampleTime)?r:t;return new me(r.startTime,n.toPointValue(),n.sampleTime)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.GAUGE,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()}))}}};var Ht=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}},de=class{kind=tt.SUM;monotonic;constructor(t){this.monotonic=t}createAccumulation(t){return new Ht(t,this.monotonic)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue();return r.reset?new Ht(r.startTime,this.monotonic,o,r.reset):new Ht(t.startTime,this.monotonic,n+o)}diff(t,r){let n=t.toPointValue(),o=r.toPointValue();return this.monotonic&&n>o?new Ht(r.startTime,this.monotonic,o,!0):new Ht(r.startTime,this.monotonic,o-n)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.SUM,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()})),isMonotonic:this.monotonic}}};var rs=class e{static DEFAULT_INSTANCE=new dr;createAggregator(t){return e.DEFAULT_INSTANCE}};var ns=class e{static MONOTONIC_INSTANCE=new de(!0);static NON_MONOTONIC_INSTANCE=new de(!1);createAggregator(t){switch(t.type){case T.COUNTER:case T.OBSERVABLE_COUNTER:case T.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};var os=class e{static DEFAULT_INSTANCE=new Er;createAggregator(t){return e.DEFAULT_INSTANCE}};var is=class e{static DEFAULT_INSTANCE=new pe([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}};var Ar=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 pe(this._boundaries,this._recordMinMax)}},Sr=class{_maxSize;_recordMinMax;constructor(t=160,r=!0){this._maxSize=t,this._recordMinMax=r}createAggregator(t){return new gr(this._maxSize,this._recordMinMax)}},ss=class{_resolve(t){switch(t.type){case T.COUNTER:case T.UP_DOWN_COUNTER:case T.OBSERVABLE_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:return cs;case T.GAUGE:case T.OBSERVABLE_GAUGE:return us;case T.HISTOGRAM:return t.advice.explicitBucketBoundaries?new Ar(t.advice.explicitBucketBoundaries):ls}return l.warn(`Unable to recognize instrument type: ${t.type}`),as}createAggregator(t){return this._resolve(t).createAggregator(t)}},as=new rs,cs=new ns,us=new os,ls=new is,Lg=new Sr,pc=new ss;var k;(function(e){e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(k||(k={}));function Wn(e){switch(e.type){case k.DEFAULT:return pc;case k.DROP:return as;case k.SUM:return cs;case k.LAST_VALUE:return us;case k.EXPONENTIAL_HISTOGRAM:{let t=e;return new Sr(t.options?.maxSize,t.options?.recordMinMax)}case k.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?ls:new Ar(t.options?.boundaries,t.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var _c=e=>({type:k.DEFAULT}),mc=e=>G.CUMULATIVE;var dc="otel.component.name",hc="otel.component.type",fc="periodic_metric_reader",Tc="otel.sdk.metric_reader.collection.duration",gc="error.type";var Ec=new Map,Rr=class{collectionDuration;standardAttrs;constructor(t,r){let n=Ec.get(t)??0;Ec.set(t,n+1),this.standardAttrs={[hc]:t,[dc]:`${t}/${n}`},this.collectionDuration=r.createHistogram(Tc,{unit:"s",description:"The duration of the collect operation of the metric reader.",advice:{explicitBucketBoundaries:[]}})}recordCollection(t,r){let n=r?{...this.standardAttrs,[gc]:r}:this.standardAttrs;this.collectionDuration.record(t,n)}};var Ac="2.8.0";var he=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(t){this._aggregationSelector=t?.aggregationSelector??_c,this._aggregationTemporalitySelector=t?.aggregationTemporalitySelector??mc,this._metricProducers=t?.metricProducers??[],this._cardinalitySelector=t?.cardinalitySelector,this._otelComponentType=t?.otelComponentType??this.constructor.name,this._selfObsMetrics=new Rr(this._otelComponentType,St())}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}_setSelfObsMeterProvider(t){let r=t.getMeter("@opentelemetry/sdk-metrics",Ac);this._selfObsMetrics=new Rr(this._otelComponentType,r)}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=b(),[n,...o]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis}),...this._metricProducers.map(p=>p.collect({timeoutMillis:t?.timeoutMillis}))]),i=b(),s=n.errors.concat(o.flatMap(p=>p.errors)),a=Fi(ar(r,i));this._selfObsMetrics.recordCollection(a,s.length>0?s[0].name??"collect_error":void 0);let c=n.resourceMetrics.resource,u=n.resourceMetrics.scopeMetrics.concat(o.flatMap(p=>p.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:c,scopeMetrics:u},errors:s}}async shutdown(t){if(this._shutdown){l.error("Cannot call shutdown twice.");return}t?.timeoutMillis==null?await this.onShutdown():await Gt(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 Gt(this.onForceFlush(),t.timeoutMillis)}};var xr=class extends he{_interval;_exporter;_exportInterval;_exportTimeout;constructor(t){let{exporter:r,exportIntervalMillis:n=6e4,metricProducers:o,cardinalityLimits:i}=t,{exportTimeoutMillis:s=3e4}=t;if(super({aggregationSelector:r.selectAggregation?.bind(r),aggregationTemporalitySelector:r.selectAggregationTemporality?.bind(r),otelComponentType:fc,metricProducers:o,cardinalitySelector:a=>{let c={default:2e3,...i};switch(a){case T.COUNTER:return c.counter??c.default;case T.GAUGE:return c.gauge??c.default;case T.HISTOGRAM:return c.histogram??c.default;case T.OBSERVABLE_COUNTER:return c.observableCounter??c.default;case T.OBSERVABLE_UP_DOWN_COUNTER:return c.observableUpDownCounter??c.default;case T.OBSERVABLE_GAUGE:return c.observableGauge??c.default;case T.UP_DOWN_COUNTER:return c.upDownCounter??c.default;default:return c.default}}}),n<=0)throw Error("exportIntervalMillis must be greater than 0");if(s<=0)throw Error("exportTimeoutMillis must be greater than 0");if(n<s){if("exportIntervalMillis"in t&&"exportTimeoutMillis"in t)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");l.info(`Timeout of ${s} exceeds the interval of ${n}. Clamping timeout to interval duration.`),s=n}this._exportInterval=n,this._exportTimeout=s,this._exporter=r}async _runOnce(){try{await Gt(this._doRun(),this._exportTimeout)}catch(t){if(t instanceof mr){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 Ja._export(this._exporter,t);if(n.code!==U.SUCCESS)throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${n.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};var jn;function Sc(){if(jn===void 0)try{let e=globalThis.process.argv0;jn=e?`unknown_service:${e}`:"unknown_service"}catch{jn="unknown_service"}return jn}var fe=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";var ps=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,r){let n=new e({},r);return n._rawAttributes=Rc(t),n._asyncAttributesPending=t.filter(([o,i])=>fe(i)).length>0,n}constructor(t,r){let n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([o,i])=>(fe(i)&&(this._asyncAttributesPending=!0),[o,i])),this._rawAttributes=Rc(this._rawAttributes),this._schemaUrl=Yp(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,fe(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(fe(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=qp(this,t),n=r?{schemaUrl:r}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}};function Kn(e,t){return ps.FromAttributeList(Object.entries(e),t)}function qt(){return Kn({[Ua]:Sc(),[nr]:Bt[nr],[or]:Bt[or],[ir]:Bt[ir]})}function Rc(e){return e.map(([t,r])=>fe(r)?[t,r.catch(n=>{l.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function Yp(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 qp(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 Xn=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 _t(e,t,r){return Jp(e)||l.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:r?.description??"",unit:r?.unit??"",valueType:r?.valueType??K.DOUBLE,advice:r?.advice??{}}}function xc(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 Oc(e,t){return ic(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var Qp=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function Jp(e){return Qp.test(e)}var Te=class{_writableMetricStorage;_descriptor;constructor(t,r){this._writableMetricStorage=t,this._descriptor=r}_record(t,r={},n=E.active()){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===K.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,I(Date.now()))}},Yn=class extends Te{add(t,r,n){this._record(t,r,n)}},qn=class extends Te{add(t,r,n){if(t<0){l.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},Qn=class extends Te{record(t,r,n){this._record(t,r,n)}},Jn=class extends Te{record(t,r,n){if(t<0){l.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},ge=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)}},Zn=class extends ge{},to=class extends ge{},eo=class extends ge{};function Or(e){return e instanceof ge}var ro=class{_meterSharedState;constructor(t){this._meterSharedState=t}createGauge(t,r){let n=_t(t,T.GAUGE,r),o=this._meterSharedState.registerMetricStorage(n);return new Qn(o,n)}createHistogram(t,r){let n=_t(t,T.HISTOGRAM,r),o=this._meterSharedState.registerMetricStorage(n);return new Jn(o,n)}createCounter(t,r){let n=_t(t,T.COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new qn(o,n)}createUpDownCounter(t,r){let n=_t(t,T.UP_DOWN_COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new Yn(o,n)}createObservableGauge(t,r){let n=_t(t,T.OBSERVABLE_GAUGE,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new to(n,o,this._meterSharedState.observableRegistry)}createObservableCounter(t,r){let n=_t(t,T.OBSERVABLE_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Zn(n,o,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,r){let n=_t(t,T.OBSERVABLE_UP_DOWN_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new eo(n,o,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)}removeBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)}};var Ee=class{_instrumentDescriptor;constructor(t){this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=_t(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};var _s=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 _s{constructor(){super(Hn)}};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=Hn(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){for(let[n,o,i]of t.entries()){let s=n,a=i,c=this._aggregator.createAccumulation(r);c?.record(o);let u=c;if(this._cumulativeMemoStorage.has(s,a)){let p=this._cumulativeMemoStorage.get(s,a);u=this._aggregator.diff(p,c)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(s=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(s,a))){let p=this._cumulativeMemoStorage.get(s,a);u=this._aggregator.diff(p,c)}if(this._activeCollectionStorage.has(s,a)){let p=this._activeCollectionStorage.get(s,a);u=this._aggregator.merge(p,u)}this._cumulativeMemoStorage.set(s,c,a),this._activeCollectionStorage.set(s,u,a)}}collect(){let t=this._activeCollectionStorage;return this._activeCollectionStorage=new q,t}};var Se=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(t,r){this._aggregator=t,r.forEach(n=>{this._unreportedAccumulations.set(n,[])})}buildMetrics(t,r,n,o){this._stashAccumulations(n);let i=this._getMergedUnreportedAccumulations(t),s=i,a;if(this._reportHistory.has(t)){let u=this._reportHistory.get(t),p=u.collectionTime;a=u.aggregationTemporality,a===G.CUMULATIVE?s=e.merge(u.accumulations,i,this._aggregator):s=e.calibrateStartTime(u.accumulations,i,p)}else a=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:o,aggregationTemporality:a});let c=Zp(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),m=n.merge(p,c);o.set(a,m,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 Zp(e){return Array.from(e.entries())}var no=class extends Ee{_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 Se(r,o),this._attributesProcessor=n}record(t,r){let n=new q;for(let[o,i]of t.entries())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 ms(e,t){let r="";return e.unit!==t.unit&&(r+=` - Unit '${e.unit}' does not match '${t.unit}'
|
|
2
2
|
`),e.type!==t.type&&(r+=` - Type '${e.type}' does not match '${t.type}'
|
|
3
3
|
`),e.valueType!==t.valueType&&(r+=` - Value Type '${e.valueType}' does not match '${t.valueType}'
|
|
4
4
|
`),e.description!==t.description&&(r+=` - Description '${e.description}' does not match '${t.description}'
|
|
5
|
-
`),r}function
|
|
5
|
+
`),r}function t_(e,t){return` - use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function e_(e,t){return` - use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function r_(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 n_(e,t){let r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return` - create a new view with a name other than '${e.name}' and InstrumentSelector '${n}'
|
|
6
6
|
- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${n}
|
|
7
|
-
- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${n}`}function
|
|
7
|
+
- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${n}`}function ds(e,t){return e.valueType!==t.valueType?t_(e,t):e.unit!==t.unit?e_(e,t):e.type!==t.type?r_(e,t):e.description!==t.description?n_(e,t):""}var oo=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();Oc(i,t)?(i.description!==t.description&&(t.description.length>i.description.length&&o.updateDescription(t.description),l.warn("A view or instrument with the name ",t.name,` has already been registered, but has a different description and is incompatible with another registered view.
|
|
8
8
|
`,`Details:
|
|
9
|
-
`,
|
|
10
|
-
To resolve the conflict:`,
|
|
9
|
+
`,ms(i,t),`The longer description will be used.
|
|
10
|
+
To resolve the conflict:`,ds(i,t))),n=o):l.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
|
|
11
11
|
`,`Details:
|
|
12
|
-
`,
|
|
13
|
-
`,yi(i,t))}return n}};var Vn=class{_backingStorages;constructor(t){this._backingStorages=t}record(t,r,n,o){this._backingStorages.forEach(i=>{i.record(t,r,n,o)})}};var kn=class{_buffer=new Q;_instrumentName;_valueType;constructor(t,r){this._instrumentName=t,this._valueType=r}observe(t,r={}){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===Y.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}},Fn=class{_buffer=new Map;observe(t,r,n={}){if(!Tr(t))return;let o=this._buffer.get(t);if(o==null&&(o=new Q,this._buffer.set(t,o)),typeof r!="number"){l.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===Y.INT&&!Number.isInteger(r)&&(l.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||o.set(n,r)}};var zn=class{_callbacks=[];_batchCallbacks=[];addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){let n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)}addBatchCallback(t,r){let n=new Set(r.filter(Tr));if(n.size===0){l.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,n)>=0||this._batchCallbacks.push({callback:t,instruments:n})}removeBatchCallback(t,r){let n=new Set(r.filter(Tr)),o=this._findBatchCallback(t,n);o<0||this._batchCallbacks.splice(o,1)}async observe(t,r){let n=this._observeCallbacks(t,r),o=this._observeBatchCallbacks(t,r);return(await Promise.allSettled([...n,...o])).filter(a=>a.status==="rejected").map(a=>a.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:n,instrument:o})=>{let i=new kn(o._descriptor.name,o._descriptor.valueType),s=Promise.resolve(n(i));r!=null&&(s=It(s,r)),await s,o._metricStorages.forEach(a=>{a.record(i._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let i=new Fn,s=Promise.resolve(n(i));r!=null&&(s=It(s,r)),await s,o.forEach(a=>{let c=i._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(n=>n.callback===t&&n.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(n=>n.callback===t&&da(n.instruments,r))}};var $n=class extends Se{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ae(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Re(r,o),this._attributesProcessor=n}record(t,r,n,o){r=this._attributesProcessor.process(r,n),this._deltaMetricStorage.record(t,r,n,o)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};var bi=class{process(t,r){return t}},wi=class{_processors;constructor(t){this._processors=t}process(t,r){let n=t;for(let o of this._processors)n=o.process(n,r);return n}};function Wn(){return yl}function va(e){return new wi(e)}var yl=new bi;var jn=class{metricStorageRegistry=new Hn;observableRegistry=new zn;meter;_meterProviderSharedState;_instrumentationScope;constructor(t,r){this.meter=new Bn(this),this._meterProviderSharedState=t,this._instrumentationScope=r}registerMetricStorage(t){let r=this._registerMetricStorage(t,$n);return r.length===1?r[0]:new Vn(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,Gn)}async collect(t,r,n){let o=await this.observableRegistry.observe(r,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(t);if(i.length===0)return null;let s=[];return i.forEach(a=>{let c=a.collect(t,r);c!=null&&s.push(c)}),s.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:s},errors:o}}_registerMetricStorage(t,r){let o=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(i=>{let s=Na(i,t),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(s);if(a!=null)return a;let c=i.aggregation.createAggregator(s),u=new r(s,c,i.attributesProcessor,this._meterProviderSharedState.metricCollectors,i.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let s=this._meterProviderSharedState.selectAggregations(t.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,t);if(u!=null)return u;let p=c.createAggregator(t),_=a.selectCardinalityLimit(t.type),d=new r(t,p,Wn(),[a],_);return this.metricStorageRegistry.registerForCollector(a,d),d});o=o.concat(s)}return o}};var Kn=class{viewRegistry=new Ln;metricCollectors=[];meterSharedStates=new Map;resource;constructor(t){this.resource=t}getMeterSharedState(t){let r=ha(t),n=this.meterSharedStates.get(r);return n==null&&(n=new jn(this,t),this.meterSharedStates.set(r,n)),n}selectAggregations(t){let r=[];for(let n of this.metricCollectors)r.push([n,yn(n.selectAggregation(t))]);return r}};var Xn=class{_sharedState;_metricReader;constructor(t,r){this._sharedState=t,this._metricReader=r}async collect(t){let r=I(Date.now()),n=[],o=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async s=>{let a=await s.collect(this,r,t);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}selectCardinalityLimit(t){return this._metricReader.selectCardinalityLimit?.(t)??2e3}};var bl=/[\^$\\.+?()[\]{}|]/g,xe=class e{_matchAll;_regexp;constructor(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(bl,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}},Ut=class{_matchAll;_pattern;constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}};var Yn=class{_nameFilter;_type;_unitFilter;constructor(t){this._nameFilter=new xe(t?.name??"*"),this._type=t?.type,this._unitFilter=new Ut(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};var qn=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(t){this._nameFilter=new Ut(t?.name),this._versionFilter=new Ut(t?.version),this._schemaUrlFilter=new Ut(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};function wl(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function Nl(e){if(wl(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||xe.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}var Qn=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(t){Nl(t),t.attributesProcessors!=null?this.attributesProcessor=va(t.attributesProcessors):this.attributesProcessor=Wn(),this.name=t.name,this.description=t.description,this.aggregation=yn(t.aggregation??{type:$.DEFAULT}),this.instrumentSelector=new Yn({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new qn({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}};var gr=class{_sharedState;_shutdown=!1;constructor(t){if(this._sharedState=new Kn(t?.resource??Yt()),t?.views!=null&&t.views.length>0)for(let r of t.views)this._sharedState.viewRegistry.addView(new Qn(r));if(t?.readers!=null&&t.readers.length>0)for(let r of t.readers){let n=new Xn(this._sharedState,r);r.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(t,r="",n={}){return this._shutdown?(l.warn("A shutdown MeterProvider cannot provide a Meter"),ke()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter}async shutdown(t){if(this._shutdown){l.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){l.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}};var Er;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(Er||(Er={}));function Ll(e,t){let r=ue(e.resource,t);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:vl(e.scopeMetrics,t)}}function vl(e,t){return Array.from(e.map(r=>({scope:pe(r.scope),metrics:r.metrics.map(n=>Pl(n,t)),schemaUrl:r.scope.schemaUrl})))}function Pl(e,t){let r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=Dl(e.aggregationTemporality);switch(e.dataPointType){case F.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:Pa(e,t)};break;case F.GAUGE:r.gauge={dataPoints:Pa(e,t)};break;case F.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:Ml(e,t)};break;case F.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:Il(e,t)};break}return r}function Cl(e,t,r){let n={attributes:yt(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case Y.INT:n.asInt=e.value;break;case Y.DOUBLE:n.asDouble=e.value;break}return n}function Pa(e,t){return e.dataPoints.map(r=>Cl(r,e.descriptor.valueType,t))}function Ml(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:yt(r.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Il(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:yt(r.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Dl(e){switch(e){case k.DELTA:return Er.AGGREGATION_TEMPORALITY_DELTA;case k.CUMULATIVE:return Er.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Ca(e,t){return{resourceMetrics:e.map(r=>Ll(r,t))}}var Ul=256,Bl=512;function Ma(e,t){let r=e&255|Ul;return t&&(r|=Bl),r}function Gl(e,t){let r=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:o,traceState:r.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:yt(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(i=>Vl(i,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(i=>Hl(i,t)),droppedLinksCount:e.droppedLinksCount,flags:Ma(r.traceFlags,e.parentSpanContext?.isRemote)}}function Hl(e,t){return{attributes:e.attributes?yt(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Ma(e.context.traceFlags,e.context.isRemote)}}function Vl(e,t){return{attributes:e.attributes?yt(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ia(e,t){return{resourceSpans:Fl(e,t)}}function kl(e){let t=new Map;for(let r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));let o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,i=n.get(o);i||(i=[],n.set(o,i)),i.push(r)}return t}function Fl(e,t){let r=kl(e),n=[],o=r.entries(),i=o.next();for(;!i.done;){let[s,a]=i.value,c=[],u=a.values(),p=u.next();for(;!p.done;){let m=p.value;if(m.length>0){let h=m.map(S=>Gl(S,t));c.push({scope:pe(m[0].instrumentationScope),spans:h,schemaUrl:m[0].instrumentationScope.schemaUrl})}p=u.next()}let _=ue(s,t),d={resource:_,scopeSpans:c,schemaUrl:_.schemaUrl};n.push(d),i=o.next()}return n}var Jn={serializeRequest:e=>{let t=ma(e,le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var Zn={serializeRequest:e=>{let t=Ca([e],le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var to={serializeRequest:e=>{let t=Ia(e,le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var Ni=5,zl=1e3,$l=5e3,Wl=1.5,Da=.2;function jl(){return Math.random()*(2*Da)-Da}var Li=class{_transport;constructor(t){this._transport=t}retry(t,r,n){return new Promise((o,i)=>{setTimeout(()=>{this._transport.send(t,r).then(o,i)},n)})}async send(t,r){let n=Ni,o=zl,i=Date.now()+r,s=await this._transport.send(t,r);for(;s.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(o*(1+jl()),$l),0);o=o*Wl;let c=s.retryInMillis??a,u=i-Date.now();if(c>u)return l.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(u)}ms, not retrying further.`),s;l.verbose(`Scheduling export retry in ${Math.round(c)}ms`),s=await this.retry(t,u,c)}return s.status==="success"?l.verbose(`Export succeeded after ${Ni-n} retry attempts.`):s.status==="retryable"?l.info(`Export failed after maximum retry attempts (${Ni}).`):l.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}};function Ua(e){return new Li(e.transport)}function Ba(e){return e===429||e===502||e===503||e===504}function Ga(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let r=new Date(e).getTime()-Date.now();return r>=0?r:0}var Kl=60*1024,Xl=9,vi=0,eo=0,Pi=class{_parameters;constructor(t){this._parameters=t}async send(t,r){let n=new AbortController,o=setTimeout(()=>n.abort(),r),i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);let s=t.byteLength,a=vi+s>Kl,c=eo>=Xl,u=!a&&!c;if(u)vi+=s,eo++;else{let p=a?"size limit":"count limit";l.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${eo} pending (${p})`)}try{let p=new URL(this._parameters.url),_=await i(p.href,{method:"POST",headers:await this._parameters.headers(),body:t,signal:n.signal,keepalive:u,mode:globalThis.location?globalThis.location.origin===p.origin?"same-origin":"cors":"no-cors"});if(_.status>=200&&_.status<=299)return l.debug(`export response success (status: ${_.status})`),{status:"success"};if(Ba(_.status)){l.warn(`export response retryable (status: ${_.status})`);let d=_.headers.get("Retry-After");return{status:"retryable",retryInMillis:Ga(d)}}return l.error(`export response failure (status: ${_.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${_.status}`)}}catch(p){return Yl(p)?(l.warn(`export request retryable (network error: ${p})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:p})}):(l.error(`export request failure (error: ${p})`),{status:"failure",error:new Error("Fetch request errored",{cause:p})})}finally{clearTimeout(o),u&&(vi-=s,eo--)}}shutdown(){}};function Ha(e){return new Pi(e)}function Yl(e){return e instanceof TypeError&&!e.cause}function Va(e,t){return la(e,t,Ua({transport:Ha(e)}))}function ka(e){let t={};return Object.entries(e??{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):l.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}function ql(e,t,r){return async()=>{let n={...await r()},o={};return t!=null&&Object.assign(o,await t()),e!=null&&Object.assign(o,ka(await e())),Object.assign(o,n)}}function Ql(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Fa(e,t,r){return{...Ds(e,t,r),headers:ql(e.headers,t.headers,r.headers),url:Ql(e.url)??t.url??r.url}}function za(e,t){return{...Us(),headers:async()=>e,url:"http://localhost:4318/"+t}}function $a(e){return typeof e.headers=="function"?e.headers:Is(e.headers)}function Wa(e,t,r){return Fa({url:e.url,timeoutMillis:e.timeoutMillis,headers:$a(e),concurrencyLimit:e.concurrencyLimit},{},za(r,t))}function qt(e,t,r,n){let o=Wa(e,r,n);return Va(o,t)}var Oe=class extends xt{constructor(t={}){super(qt(t,Jn,"v1/logs",{"Content-Type":"application/json"}))}};var Sr;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(Sr||(Sr={}));var Ci=()=>k.CUMULATIVE,ja=e=>{switch(e){case g.COUNTER:case g.OBSERVABLE_COUNTER:case g.GAUGE:case g.HISTOGRAM:case g.OBSERVABLE_GAUGE:return k.DELTA;case g.UP_DOWN_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:return k.CUMULATIVE}},Ka=e=>{switch(e){case g.COUNTER:case g.HISTOGRAM:return k.DELTA;case g.GAUGE:case g.UP_DOWN_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:case g.OBSERVABLE_COUNTER:case g.OBSERVABLE_GAUGE:return k.CUMULATIVE}};function Jl(){let e=(void 0??"cumulative").toLowerCase();return e==="cumulative"?Ci:e==="delta"?ja:e==="lowmemory"?Ka:(l.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Ci)}function Zl(e){return e!=null?e===Sr.DELTA?ja:e===Sr.LOWMEMORY?Ka:Ci:Jl()}var tm=Object.freeze({type:$.DEFAULT});function em(e){return e?.aggregationPreference??(()=>tm)}var ro=class extends xt{_aggregationTemporalitySelector;_aggregationSelector;constructor(t,r){super(t),this._aggregationSelector=em(r),this._aggregationTemporalitySelector=Zl(r?.temporalityPreference)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}};var ye=class extends ro{constructor(t){super(qt(t??{},Zn,"v1/metrics",{"Content-Type":"application/json"}),t)}};var be=class extends xt{constructor(t={}){super(qt(t,to,"v1/traces",{"Content-Type":"application/json"}))}};function Xa(e){return Mi(e,new WeakSet)}function Mi(e,t){if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Uint8Array)return!0;if(typeof e=="object"){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(n=>Mi(n,t));let r=e;return r.constructor!==Object&&r.constructor!==void 0?!1:Object.values(r).every(n=>Mi(n,t))}return!1}var no=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(t){this._isLogRecordReadonly()||(this._severityText=t)}get severityText(){return this._severityText}set severityNumber(t){this._isLogRecordReadonly()||(this._severityNumber=t)}get severityNumber(){return this._severityNumber}set body(t){this._isLogRecordReadonly()||(this._body=t)}get body(){return this._body}get eventName(){return this._eventName}set eventName(t){this._isLogRecordReadonly()||(this._eventName=t)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(t,r,n){let{timestamp:o,observedTimestamp:i,eventName:s,severityNumber:a,severityText:c,body:u,attributes:p={},exception:_,context:d}=n,m=Date.now();if(this.hrTime=ut(o??m),this.hrTimeObserved=ut(i??m),d){let h=R.getSpanContext(d);h&&q(h)&&(this.spanContext=h)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this._eventName=s,this.setAttributes(p),_!=null&&this._setException(_)}setAttribute(t,r){return this._isLogRecordReadonly()?this:t.length===0?(l.warn(`Invalid attribute key: ${t}`),this):Xa(r)?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this.droppedAttributesCount===1&&l.warn("Dropping extra attributes."),this):(this.attributes[t]=this._truncateToSize(r),this)):(l.warn(`Invalid attribute value set for key: ${t}`),this)}setAttributes(t){for(let[r,n]of Object.entries(t))this.setAttribute(r,n);return this}setBody(t){return this.body=t,this}setEventName(t){return this.eventName=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(t){let r=this._logRecordLimits.attributeValueLengthLimit;if(r<=0)return l.warn(`Attribute value limit must be positive, got ${r}`),t;if(t==null)return t;if(typeof t=="string")return this._truncateToLimitUtil(t,r);if(t instanceof Uint8Array)return t;if(Array.isArray(t))return t.map(n=>this._truncateToSize(n));if(typeof t=="object"){let n={};for(let[o,i]of Object.entries(t))n[o]=this._truncateToSize(i);return n}return t}_setException(t){let r=!1;if(typeof t=="string"||typeof t=="number")Object.hasOwn(this.attributes,Z)||this.setAttribute(Z,String(t)),r=!0;else if(t&&typeof t=="object"){let n=t;n.code?(Object.hasOwn(this.attributes,nt)||this.setAttribute(nt,n.code.toString()),r=!0):n.name&&(Object.hasOwn(this.attributes,nt)||this.setAttribute(nt,n.name),r=!0),n.message&&(Object.hasOwn(this.attributes,Z)||this.setAttribute(Z,n.message),r=!0),n.stack&&(Object.hasOwn(this.attributes,Kt)||this.setAttribute(Kt,n.stack),r=!0)}r||l.warn(`Failed to record an exception ${t}`)}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&l.warn("Can not execute the operation on emitted log record"),this._isReadonly}};var oo=class{instrumentationScope;_sharedState;_loggerConfig;constructor(t,r){this.instrumentationScope=t,this._sharedState=r,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(t){let r=this._loggerConfig,n=t.context||E.active(),o=t.severityNumber??J.UNSPECIFIED;if(o!==J.UNSPECIFIED&&o<r.minimumSeverity)return;if(r.traceBased){let s=R.getSpanContext(n);if(s&&q(s)&&!((s.traceFlags&M.SAMPLED)===M.SAMPLED))return}let i=new no(this._sharedState,this.instrumentationScope,{context:n,...t});this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}};var io=class{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}};var so=class{processors;forceFlushTimeoutMillis;constructor(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>or(r.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(n=>n.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(t=>t.shutdown()))}};function Ya(e){return`${e.name}@${e.version||""}:${e.schemaUrl||""}`}var rm={disabled:!1,minimumSeverity:J.UNSPECIFIED,traceBased:!1},Ii=()=>({...rm}),ao=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;_loggerConfigurator;_loggerConfigs=new Map;constructor(t,r,n,o,i){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new so(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new io,this._loggerConfigurator=i??Ii}getLoggerConfig(t){let r=Ya(t),n=this._loggerConfigs.get(r);return n||(n=this._loggerConfigurator(t),this._loggerConfigs.set(r,n),n)}};var nm="unknown",Ar=class{_shutdownOnce;_sharedState;constructor(t={}){let r={resource:t.resource??Yt(),forceFlushTimeoutMillis:t.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:t.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:t.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:t.loggerConfigurator??Ii,processors:t.processors??[]};this._sharedState=new ao(r.resource,r.forceFlushTimeoutMillis,r.logRecordLimits,r.processors,r.loggerConfigurator),this._shutdownOnce=new Ot(this._shutdown,this)}getLogger(t,r,n){if(this._shutdownOnce.isCalled)return l.warn("A shutdown LoggerProvider cannot provide a Logger"),$e;t||l.warn("Logger requested without instrumentation scope name.");let o=t||nm,i=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new oo({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(l.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(l.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};var co=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(t,r){this._exporter=t,this._maxExportBatchSize=r?.maxExportBatchSize??512,this._maxQueueSize=r?.maxQueueSize??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??3e4,this._shutdownOnce=new Ot(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(t){this._shutdownOnce.isCalled||this._addToBuffer(t)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())}_flushAll(){return new Promise((t,r)=>{let n=[],o=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let i=0;i<o;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():or(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis)}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,P(r)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(t){let r=()=>gn._export(this._exporter,t).then(o=>{o.code!==G.SUCCESS&&P(o.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${o})`))}).catch(P),n=[];for(let o=0;o<t.length;o++){let i=t[o].resource;i.asyncAttributesPending&&typeof i.waitForAsyncAttributes=="function"&&n.push(i.waitForAsyncAttributes())}return n.length===0?r():Promise.all(n).then(r,P)}};var we=class extends co{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this._onInit(r)}onShutdown(){typeof document>"u"||(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}_onInit(t){t?.disableAutoFlushOnDocumentHide===!0||typeof document>"u"||(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}};var qa="exception";var uo=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:ct.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let r=Date.now();this._spanContext=t.spanContext,this._performanceStartTime=C.now(),this._performanceOffset=r-(this._performanceStartTime+C.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,this.links=t.links||[],this.startTime=this._getTime(t.startTime??r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return l.warn(`Invalid attribute key: ${t}`),this;if(!en(r))return l.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:n}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&o?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),o&&this._attributesCount++,this)}setAttributes(t){for(let[r,n]of Object.entries(t))this.setAttribute(r,n);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return l.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&l.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),un(r)&&(un(n)||(n=r),r=void 0);let i=jt(r);return this.events.push({name:t,attributes:i,time:this._getTime(n),droppedAttributesCount:0}),this}addLink(t){return this.links.push(t),this}addLinks(t){return this.links.push(...t),this}setStatus(t){return this._isSpanEnded()?this:(this.status={...t},this.status.message!=null&&typeof t.message!="string"&&(l.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`),delete this.status.message),this)}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){l.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=ei(this.startTime,this.endTime),this._duration[0]<0&&(l.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&l.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=C.now())return D(t+this._performanceOffset);if(typeof t=="number")return I(t);if(t instanceof Date)return I(t.getTime());if(tr(t))return t;if(this._startTimeProvided)return I(Date.now());let r=C.now()-this._performanceStartTime;return pn(this.startTime,I(r))}isRecording(){return this._ended===!1}recordException(t,r){let n={};typeof t=="string"?n[Z]=t:t&&(t.code?n[nt]=t.code.toString():t.name&&(n[nt]=t.name),t.message&&(n[Z]=t.message),t.stack&&(n[Kt]=t.stack)),n[nt]||n[Z]?this.addEvent(qa,n,r):l.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);l.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_truncateToSize(t){let r=this._attributeValueLengthLimit;return r<=0?(l.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):t}};var K;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(K||(K={}));var Bt=class{shouldSample(){return{decision:K.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};var mt=class{shouldSample(){return{decision:K.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};var Qt=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(P(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new mt),this._remoteParentSampled=t.remoteParentSampled??new mt,this._remoteParentNotSampled=t.remoteParentNotSampled??new Bt,this._localParentSampled=t.localParentSampled??new mt,this._localParentNotSampled=t.localParentNotSampled??new Bt}shouldSample(t,r,n,o,i,s){let a=R.getSpanContext(t);return!a||!q(a)?this._root.shouldSample(t,r,n,o,i,s):a.isRemote?a.traceFlags&M.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,o,i,s):this._remoteParentNotSampled.shouldSample(t,r,n,o,i,s):a.traceFlags&M.SAMPLED?this._localParentSampled.shouldSample(t,r,n,o,i,s):this._localParentNotSampled.shouldSample(t,r,n,o,i,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};var Gt=class{_ratio;_upperBound;constructor(t=0){this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:Yr(r)&&this._accumulate(r)<this._upperBound?K.RECORD_AND_SAMPLED:K.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<t.length/8;n++){let o=n*8,i=parseInt(t.slice(o,o+8),16);r=(r^i)>>>0}return r}};var _t;(function(e){e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(_t||(_t={}));var po=1;function lo(){return{sampler:Di(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128},spanLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128,linkCountLimit:void 0??128,eventCountLimit:void 0??128,attributePerEventCountLimit:void 0??128,attributePerLinkCountLimit:void 0??128}}}function Di(){let e=void 0??_t.ParentBasedAlwaysOn;switch(e){case _t.AlwaysOn:return new mt;case _t.AlwaysOff:return new Bt;case _t.ParentBasedAlwaysOn:return new Qt({root:new mt});case _t.ParentBasedAlwaysOff:return new Qt({root:new Bt});case _t.TraceIdRatio:return new Gt(Qa());case _t.ParentBasedTraceIdRatio:return new Qt({root:new Gt(Qa())});default:return l.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${_t.ParentBasedAlwaysOn}".`),new Qt({root:new mt})}}function Qa(){let e=void 0;return e==null?(l.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${po}.`),po):e<0||e>1?(l.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${po}.`),po):e}var om=128,im=1/0;function Ja(e){let t={sampler:Di()},r=lo(),n=Object.assign({},r,t,e);return n.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),n}function Za(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??om,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??im,Object.assign({},e,{spanLimits:t})}var mo=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,r){this._exporter=t,this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:void 0??512,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:void 0??2048,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:void 0??5e3,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:void 0??3e4,this._shutdownOnce=new Ot(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&M.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&l.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(l.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{let n=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,s=o;i<s;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{let n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);E.with(Xe(E.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(o,a=>{clearTimeout(n),a.code===G.SUCCESS?t():r(a.error??new Error("BatchSpanProcessor: span export failed"))}),s=null;for(let a=0,c=o.length;a<c;a++){let u=o[a];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(s??=[],s.push(u.resource.waitForAsyncAttributes()))}s===null?i():Promise.all(s).then(i,a=>{P(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,P(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};var Ne=class extends mo{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this.onInit(r)}onInit(t){t?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(r=>{P(r)})},this._pageHideListener=()=>{this.forceFlush().catch(r=>{P(r)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}};var tc=new Uint8Array(16),ec=new Uint8Array(8),sm=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function rc(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function nc(e){let t="";for(let r=0;r<e.length;r++)t+=sm[e[r]];return t}var Le=class{generateTraceId(){return rc(tc),nc(tc)}generateSpanId(){return rc(ec),nc(ec)}};var oc="otel.span.parent.origin",Ui="otel.span.sampling_result",ic="otel.sdk.span.live",sc="otel.sdk.span.started";var _o=class{startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(sc,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(ic,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){let n=cm(r);if(this.startedSpans.add(1,{[oc]:am(t),[Ui]:n}),r===K.NOT_RECORD)return()=>{};let o={[Ui]:n};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};function am(e){return e?e.isRemote?"remote":"local":"none"}function cm(e){switch(e){case K.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case K.RECORD:return"RECORD_ONLY";case K.NOT_RECORD:return"DROP"}}var ac="2.6.0";var ho=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,r,n,o){let i=Ja(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new Le,this._resource=n,this._spanProcessor=o,this.instrumentationScope=t;let s=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",ac):ke();this._tracerMetrics=new _o(s)}startSpan(t,r={},n=E.active()){r.root&&(n=R.deleteSpan(n));let o=R.getSpan(n);if(Wt(n))return l.debug("Instrumentation suppressed, returning Noop Span"),R.wrapSpanContext(Fe);let i=o?.spanContext(),s=this._idGenerator.generateSpanId(),a,c,u;!i||!R.isSpanContextValid(i)?c=this._idGenerator.generateTraceId():(c=i.traceId,u=i.traceState,a=i);let p=r.kind??At.INTERNAL,_=(r.links??[]).map(x=>({context:x.context,attributes:jt(x.attributes)})),d=jt(r.attributes),m=this._sampler.shouldSample(n,c,t,p,d,_),h=this._tracerMetrics.startSpan(i,m.decision);u=m.traceState??u;let S=m.decision===oe.RECORD_AND_SAMPLED?M.SAMPLED:M.NONE,A={traceId:c,spanId:s,traceFlags:S,traceState:u};if(m.decision===oe.NOT_RECORD)return l.debug("Recording is off, propagating context in a non-recording span"),R.wrapSpanContext(A);let f=jt(Object.assign(d,m.attributes));return new uo({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:A,name:t,kind:p,links:_,parentSpanContext:a,attributes:f,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??E.active(),u=this.startSpan(t,i,c),p=R.setSpan(c,u);return E.with(p,a,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};var fo=class{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(n=>{P(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(let n of this._spanProcessors)n.onStart(t,r)}onEnding(t){for(let r of this._spanProcessors)r.onEnding&&r.onEnding(t)}onEnd(t){for(let r of this._spanProcessors)r.onEnd(t)}shutdown(){let t=[];for(let r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,n)=>{Promise.all(t).then(()=>{r()},n)})}};var Jt;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Jt||(Jt={}));var Rr=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){let r=ii({},lo(),Za(t));this._resource=r.resource??Yt(),this._config=Object.assign({},r,{resource:this._resource});let n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new fo(n)}getTracer(t,r,n){let o=`${t}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new ho({name:t,version:r,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let t=this._config.forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(o=>{let i,s=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${t} ms`)),i=Jt.timeout},t);n.forceFlush().then(()=>{clearTimeout(s),i!==Jt.timeout&&(i=Jt.resolved,o(i))}).catch(a=>{clearTimeout(s),i=Jt.error,o(a)})}));return new Promise((n,o)=>{Promise.all(r).then(i=>{let s=i.filter(a=>a!==Jt.resolved);s.length>0?o(s):n()}).catch(i=>o([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};var To=class{_enabled=!1;_currentContext=V;_bindFunction(t=V,r){let n=this,o=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),o}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=V,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=V,this)}with(t,r,n,...o){let i=this._currentContext;this._currentContext=t||V;try{return r.call(n,...o)}finally{this._currentContext=i}}};function um(e){if(e!==null){if(e===void 0){let t=new To;t.enable(),E.setGlobalContextManager(t);return}e.enable(),E.setGlobalContextManager(e)}}function pm(e){if(e!==null){if(e===void 0){B.setGlobalPropagator(new er({propagators:[new rr,new Ye]}));return}B.setGlobalPropagator(e)}}var xr=class extends Rr{constructor(t={}){super(t)}register(t={}){R.setGlobalTracerProvider(this),pm(t.propagator),um(t.contextManager)}};var T;(function(e){e.CONNECT_END="connectEnd",e.CONNECT_START="connectStart",e.DECODED_BODY_SIZE="decodedBodySize",e.DOM_COMPLETE="domComplete",e.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",e.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",e.DOM_INTERACTIVE="domInteractive",e.DOMAIN_LOOKUP_END="domainLookupEnd",e.DOMAIN_LOOKUP_START="domainLookupStart",e.ENCODED_BODY_SIZE="encodedBodySize",e.FETCH_START="fetchStart",e.LOAD_EVENT_END="loadEventEnd",e.LOAD_EVENT_START="loadEventStart",e.NAVIGATION_START="navigationStart",e.REDIRECT_END="redirectEnd",e.REDIRECT_START="redirectStart",e.REQUEST_START="requestStart",e.RESPONSE_END="responseEnd",e.RESPONSE_START="responseStart",e.SECURE_CONNECTION_START="secureConnectionStart",e.START_TIME="startTime",e.UNLOAD_EVENT_END="unloadEventEnd",e.UNLOAD_EVENT_START="unloadEventStart"})(T||(T={}));var cc="http.response_content_length",uc="http.response_content_length_uncompressed";var Bi;function lm(){return Bi||(Bi=document.createElement("a")),Bi}function bt(e,t){return t in e}function v(e,t,r,n=!0){if(bt(r,t)&&typeof r[t]=="number"&&!(n&&r[t]===0))return e.addEvent(t,r[t])}function ht(e,t,r=!1,n,o){if(n===void 0&&(n=t[T.START_TIME]!==0),r||(v(e,T.FETCH_START,t,n),v(e,T.DOMAIN_LOOKUP_START,t,n),v(e,T.DOMAIN_LOOKUP_END,t,n),v(e,T.CONNECT_START,t,n),v(e,T.SECURE_CONNECTION_START,t,n),v(e,T.CONNECT_END,t,n),v(e,T.REQUEST_START,t,n),v(e,T.RESPONSE_START,t,n),v(e,T.RESPONSE_END,t,n)),!o){let i=t[T.ENCODED_BODY_SIZE];i!==void 0&&e.setAttribute(cc,i);let s=t[T.DECODED_BODY_SIZE];s!==void 0&&i!==s&&e.setAttribute(uc,s)}}function pc(e){return e.slice().sort((t,r)=>{let n=t[T.FETCH_START],o=r[T.FETCH_START];return n>o?1:n<o?-1:0})}function lc(){return typeof location<"u"?location.origin:void 0}function Or(e,t,r,n,o=new WeakSet,i){let s=rt(e);e=s.toString();let a=_m(e,t,r,n,o,i);if(a.length===0)return{mainRequest:void 0};if(a.length===1)return{mainRequest:a[0]};let c=pc(a);if(s.origin!==lc()&&c.length>1){let u=c[0],p=mm(c,u[T.RESPONSE_END],r),_=u[T.RESPONSE_END];return p[T.FETCH_START]<_&&(p=u,u=void 0),{corsPreFlightRequest:u,mainRequest:p}}else return{mainRequest:a[0]}}function mm(e,t,r){let n=tt(r),o=tt(ut(t)),i=e[1],s,a=e.length;for(let c=1;c<a;c++){let u=e[c],p=tt(ut(u[T.FETCH_START])),_=tt(ut(u[T.RESPONSE_END])),d=n-_;p>=o&&(!s||d<s)&&(s=d,i=u)}return i}function _m(e,t,r,n,o,i){let s=tt(t),a=tt(r),c=n.filter(u=>{let p=tt(ut(u[T.FETCH_START])),_=tt(ut(u[T.RESPONSE_END]));return u.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&u.name===e&&p>=s&&_<=a});return c.length>0&&(c=c.filter(u=>!o.has(u))),c}function rt(e){if(typeof URL=="function")return new URL(e,typeof document<"u"?document.baseURI:typeof location<"u"?location.href:void 0);let t=lm();return t.href=e,t}function go(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return"/";let r=dm(e,t);if(t&&r.indexOf("@id")>0)return r;let n="";return e.parentNode&&(n+=go(e.parentNode,t)),n+=r,n}function hm(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let r=Array.from(e.parentNode.childNodes);return r=r.filter(n=>{let o=n.localName;return t.indexOf(n.nodeType)>=0&&o===e.localName}),r.length>=1?r.indexOf(e)+1:0}function dm(e,t){let r=e.nodeType,n=hm(e),o="";if(r===Node.ELEMENT_NODE){let i=e.getAttribute("id");if(t&&i)return`//*[@id="${i}"]`;o=e.localName}else if(r===Node.TEXT_NODE||r===Node.CDATA_SECTION_NODE)o="text()";else if(r===Node.COMMENT_NODE)o="comment()";else return"";return o&&n>1?`/${o}[${n}]`:`/${o}`}function yr(e,t){let r=t||[];return(typeof r=="string"||r instanceof RegExp)&&(r=[r]),rt(e).origin===lc()?!0:r.some(o=>fn(e,o))}function mc(e,t,r,n){for(let o=0,i=e.length;o<i;o++){let s=e[o];t&&s.setTracerProvider(t),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function _c(e){e.forEach(t=>t.disable())}function Gi(e){let t=e.tracerProvider||R.getTracerProvider(),r=e.meterProvider||$t.getMeterProvider(),n=e.loggerProvider||Pt.getLoggerProvider(),o=e.instrumentations?.flat()??[];return mc(o,t,r,n),()=>{_c(o)}}var W=console.error.bind(console);function br(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var Eo=(e,t,r)=>{if(!e||!e[t]){W("no original function "+String(t)+" to wrap");return}if(!r){W("no wrapper function"),W(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){W("original object and wrapper must be functions");return}let o=r(n,t);return br(o,"__original",n),br(o,"__unwrap",()=>{e[t]===o&&br(e,t,n)}),br(o,"__wrapped",!0),br(e,t,o),o},Hi=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{W("must provide one or more modules to patch"),W(new Error().stack);return}if(!(t&&Array.isArray(t))){W("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(o=>{Eo(n,o,r)})})},So=(e,t)=>{if(!e||!e[t]){W("no function to unwrap."),W(new Error().stack);return}let r=e[t];if(!r.__unwrap)W("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},Vi=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{W("must provide one or more modules to patch"),W(new Error().stack);return}if(!(t&&Array.isArray(t))){W("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{So(r,n)})})};function wr(e){e&&e.logger&&(typeof e.logger!="function"?W("new logger isn't a function, not replacing"):W=e.logger)}wr.wrap=Eo;wr.massWrap=Hi;wr.unwrap=So;wr.massUnwrap=Vi;var Ao=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,r,n){this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=l.createComponentLogger({namespace:t}),this._tracer=R.getTracer(t,r),this._meter=$t.getMeter(t,r),this._logger=Pt.getLogger(t,r),this._updateMetricInstruments()}_wrap=Eo;_unwrap=So;_massWrap=Hi;_massUnwrap=Vi;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,o){if(t)try{t(n,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}};var U=class extends Ao{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}};function ot(e,t,r){let n,o;try{o=e()}catch(i){n=i}finally{if(t(n,o),n&&!r)throw n;return o}}function N(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var b;(function(e){e[e.STABLE=1]="STABLE",e[e.OLD=2]="OLD",e[e.DUPLICATE=3]="DUPLICATE"})(b||(b={}));function Zt(e,t){let r=b.OLD,n=t?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of n??[])if(o.toLowerCase()===e+"/dup"){r=b.DUPLICATE;break}else o.toLowerCase()===e&&(r=b.STABLE);return r}var te;(function(e){e.DOCUMENT_LOAD="documentLoad",e.DOCUMENT_FETCH="documentFetch",e.RESOURCE_FETCH="resourceFetch"})(te||(te={}));var hc="0.58.0",dc="@opentelemetry/instrumentation-document-load";var Ro="http.url",fc="http.user_agent";var Nr;(function(e){e.FIRST_PAINT="firstPaint",e.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"})(Nr||(Nr={}));var gc=()=>{let e={},t=C.getEntriesByType?.("navigation")[0];if(t)Object.values(T).forEach(n=>{if(bt(t,n)){let o=t[n];typeof o=="number"&&(e[n]=o)}});else{let n=C.timing;n&&Object.values(T).forEach(i=>{if(bt(n,i)){let s=n[i];typeof s=="number"&&(e[i]=s)}})}return e},Tc={"first-paint":Nr.FIRST_PAINT,"first-contentful-paint":Nr.FIRST_CONTENTFUL_PAINT},Ec=e=>{let t=C.getEntriesByType?.("paint");t&&t.forEach(({name:r,startTime:n})=>{bt(Tc,r)&&e.addEvent(Tc[r],n)})};var Lr=class extends U{component="document-load";version="1";moduleName=this.component;_semconvStability;constructor(t={}){super(dc,hc,t),this._semconvStability=Zt("http",t?.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(t){let r=C.getEntriesByType?.("resource");r&&r.forEach(n=>{this._initResourceSpan(n,t)})}_collectPerformance(){let t=Array.from(document.getElementsByTagName("meta")).find(o=>o.getAttribute("name")===ce),r=gc(),n=t&&t.content||"";E.with(B.extract(V,{traceparent:n}),()=>{let o=this._startSpan(te.DOCUMENT_LOAD,T.FETCH_START,r);o&&(E.with(R.setSpan(E.active(),o),()=>{let i=this._startSpan(te.DOCUMENT_FETCH,T.FETCH_START,r);i&&(this._semconvStability&b.OLD&&i.setAttribute(Ro,location.href),this._semconvStability&b.STABLE&&i.setAttribute(Ct,location.href),E.with(R.setSpan(E.active(),i),()=>{let s=!(this._semconvStability&b.OLD);ht(i,r,this.getConfig().ignoreNetworkEvents,void 0,s),this._addCustomAttributesOnSpan(i,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(i,T.RESPONSE_END,r)}))}),this._semconvStability&b.OLD&&(o.setAttribute(Ro,location.href),o.setAttribute(fc,navigator.userAgent)),this._semconvStability&b.STABLE&&(o.setAttribute(Ct,location.href),o.setAttribute(Ks,navigator.userAgent)),this._addResourcesSpans(o),this.getConfig().ignoreNetworkEvents||(v(o,T.FETCH_START,r),v(o,T.UNLOAD_EVENT_START,r),v(o,T.UNLOAD_EVENT_END,r),v(o,T.DOM_INTERACTIVE,r),v(o,T.DOM_CONTENT_LOADED_EVENT_START,r),v(o,T.DOM_CONTENT_LOADED_EVENT_END,r),v(o,T.DOM_COMPLETE,r),v(o,T.LOAD_EVENT_START,r),v(o,T.LOAD_EVENT_END,r)),this.getConfig().ignorePerformancePaintEvents||Ec(o),this._addCustomAttributesOnSpan(o,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(o,T.LOAD_EVENT_END,r))})}_endSpan(t,r,n){t&&(bt(n,r)?t.end(n[r]):t.end())}_initResourceSpan(t,r){let n=this._startSpan(te.RESOURCE_FETCH,T.FETCH_START,t,r);if(n){this._semconvStability&b.OLD&&n.setAttribute(Ro,t.name),this._semconvStability&b.STABLE&&n.setAttribute(Ct,t.name);let o=!(this._semconvStability&b.OLD);ht(n,t,this.getConfig().ignoreNetworkEvents,void 0,o),this._addCustomAttributesOnResourceSpan(n,t,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,T.RESPONSE_END,t)}}_startSpan(t,r,n,o){if(bt(n,r)&&typeof n[r]=="number")return this.tracer.startSpan(t,{startTime:n[r]},o?R.setSpan(E.active(),o):void 0)}_waitForPageLoad(){window.document.readyState==="complete"?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(t,r){r&&ot(()=>r(t),n=>{n&&this._diag.error("addCustomAttributesOnSpan",n)},!0)}_addCustomAttributesOnResourceSpan(t,r,n){n&&ot(()=>n(t,r),o=>{o&&this._diag.error("addCustomAttributesOnResourceSpan",o)},!0)}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}};var vr;(function(e){e.COMPONENT="component",e.HTTP_STATUS_TEXT="http.status_text"})(vr||(vr={}));var Sc="http.host",Ac="http.method",Rc="http.request.body.size",xc="http.request_content_length_uncompressed";var Oc="http.scheme",yc="http.status_code",bc="http.url",wc="http.user_agent";var Nc=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Lc(...e){if(e[0]instanceof URL||typeof e[0]=="string"){let t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){let{body:r,length:n}=gm(t.body);return t.body=r,n}else return Promise.resolve(Sm(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(r=>ki(r)):Promise.resolve()}}function gm(e){if(!e.pipeThrough)return Nc.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t=0,r,n=new Promise(i=>{r=i}),o=new TransformStream({start(){},async transform(i,s){let a=await i;t+=a.byteLength,s.enqueue(i)},flush(){r(t)}});return{body:e.pipeThrough(o),length:n}}function Em(e){return typeof Document<"u"&&e instanceof Document}function Sm(e){if(Em(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return ki(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Rm(e);if(e instanceof URLSearchParams)return ki(e.toString());if(e.byteLength!==void 0)return e.byteLength;Nc.warn("unknown body type")}var Am=new TextEncoder;function ki(e){return Am.encode(e).byteLength}function Rm(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function vc(e){let t=Om(),r=e.toUpperCase();return r in t?r:"_OTHER"}var xm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Pr;function Om(){if(Pr===void 0){let e=void 0;e&&e.length>0?(Pr={},e.forEach(t=>{Pr[t]=!0})):Pr=xm}return Pr}var ym={"https:":"443","http:":"80"};function Pc(e){let t=Number(e.port||ym[e.protocol]);if(t&&!isNaN(t))return t}var Fi="0.213.0";var bm=300,Cc=typeof PerformanceObserver<"u",Cr=class extends U{component="fetch";version=Fi;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-fetch",Fi,t),this._semconvStability=Zt("http",t?.semconvStabilityOptIn)}init(){}_addChildSpan(t,r){let n=this.tracer.startSpan("CORS Preflight",{startTime:r[T.FETCH_START]},R.setSpan(E.active(),t)),o=!(this._semconvStability&b.OLD);ht(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[T.RESPONSE_END])}_addFinalSpanAttributes(t,r){let n=rt(r.url);if(this._semconvStability&b.OLD&&(t.setAttribute(yc,r.status),r.statusText!=null&&t.setAttribute(vr.HTTP_STATUS_TEXT,r.statusText),t.setAttribute(Sc,n.host),t.setAttribute(Oc,n.protocol.replace(":","")),typeof navigator<"u"&&t.setAttribute(wc,navigator.userAgent)),this._semconvStability&b.STABLE){t.setAttribute(on,r.status),t.setAttribute(sn,n.hostname);let o=Pc(n);o&&t.setAttribute(an,o)}}_addHeaders(t,r){if(!yr(r,this.getConfig().propagateTraceHeaderCorsUrls)){let n={};B.inject(E.active(),n),Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}if(t instanceof Request)B.inject(E.active(),t.headers,{set:(n,o,i)=>n.set(o,typeof i=="string"?i:String(i))});else{let n=new Headers(t.headers);B.inject(E.active(),n,{set:(o,i,s)=>o.set(i,typeof s=="string"?s:String(s))}),t.headers=n}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,r={}){if(ir(t,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let n="",o={};if(this._semconvStability&b.OLD){let i=(r.method||"GET").toUpperCase();n=`HTTP ${i}`,o[vr.COMPONENT]=this.moduleName,o[Ac]=i,o[bc]=t}if(this._semconvStability&b.STABLE){let i=r.method,s=vc(r.method||"GET");n||(n=s),o[rn]=s,s!==i&&(o[nn]=i),o[Ct]=t}return this.tracer.startSpan(n,{kind:At.CLIENT,attributes:o})}_findResourceAndAddNetworkEvents(t,r,n){let o=r.entries;if(!o.length){if(!performance.getEntriesByType)return;o=performance.getEntriesByType("resource")}let i=Or(r.spanUrl,r.startTime,n,o,this._usedResources,"fetch");if(i.mainRequest){let s=i.mainRequest;this._markResourceAsUsed(s);let a=i.corsPreFlightRequest;a&&(this._addChildSpan(t,a),this._markResourceAsUsed(a));let c=!(this._semconvStability&b.OLD);ht(t,s,this.getConfig().ignoreNetworkEvents,void 0,c)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,r,n){let o=I(Date.now()),i=D();this._addFinalSpanAttributes(t,n),this._semconvStability&b.STABLE&&n.status>=400&&(t.setStatus({code:ct.ERROR}),t.setAttribute(qe,String(n.status))),setTimeout(()=>{r.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,r,i),this._tasksCount--,this._clearResources(),t.end(o)},bm)}_patchConstructor(){return t=>{let r=this,n=new Set(["url","type","redirected"]);function o(i,s){return new Proxy(i,{get(a,c,u){if(typeof c=="string"&&n.has(c))return Reflect.get(s,c);if(c==="clone")return function(){return o(a.clone(),s)};let p=Reflect.get(a,c,a);return typeof p=="function"?p.bind(a):p}})}return function(...s){let a=this,c=rt(s[0]instanceof Request?s[0].url:String(s[0])).href,u=s[0]instanceof Request?s[0]:s[1]||{},p=r._createSpan(c,u);if(!p)return t.apply(this,s);let _=r._prepareSpanData(c);r.getConfig().measureRequestSize&&Lc(...s).then(f=>{f&&(r._semconvStability&b.OLD&&p.setAttribute(xc,f),r._semconvStability&b.STABLE&&p.setAttribute(Rc,f))}).catch(f=>{r._diag.warn("getFetchBodyLength",f)});function d(f,O){r._applyAttributesAfterFetch(f,u,O),r._endSpan(f,_,{status:O.status||0,statusText:O.message,url:c})}function m(f,O){r._applyAttributesAfterFetch(f,u,O),O.status>=200&&O.status<400?r._endSpan(f,_,O):r._endSpan(f,_,{status:O.status,statusText:O.statusText,url:c})}function h(f,O){if(!f)return null;let x=f.getReader();return new ReadableStream({async pull(y){try{let{value:z,done:j}=await x.read();j?(x.releaseLock(),y.close()):y.enqueue(z)}catch(z){y.error(z),x.cancel(z).catch(j=>{});try{x.releaseLock()}catch{}}},cancel(y){return O.cancel(y).catch(z=>{}),x.cancel(y)}})}function S(f,O,x){let y=null;try{let j=x.clone().body;if(j){let L=j.getReader(),Ue=x.status===204||x.status===205||x.status===304?null:h(x.body,L),kr=new Response(Ue,{status:x.status,statusText:x.statusText,headers:x.headers});y=o(kr,x);let ne=()=>{L.read().then(({done:kt})=>{kt?m(f,x):ne()},kt=>{d(f,kt)})};ne()}else m(f,x)}finally{O(y??x)}}function A(f,O,x){try{d(f,x)}finally{O(x)}}return new Promise((f,O)=>E.with(R.setSpan(E.active(),p),()=>(r._callRequestHook(p,u),r._addHeaders(u,c),r._tasksCount++,t.apply(a,u instanceof Request?[u]:[c,u]).then(S.bind(a,p,f),A.bind(a,p,O)))))}}}_applyAttributesAfterFetch(t,r,n){let o=this.getConfig().applyCustomAttributesOnSpan;o&&ot(()=>o(t,r,n),i=>{i&&this._diag.error("applyCustomAttributesOnSpan",i)},!0)}_callRequestHook(t,r){let n=this.getConfig().requestHook;n&&ot(()=>n(t,r),o=>{o&&this._diag.error("requestHook",o)},!0)}_prepareSpanData(t){let r=D(),n=[];if(typeof PerformanceObserver!="function")return{entries:n,startTime:r,spanUrl:t};let o=new PerformanceObserver(i=>{i.getEntries().forEach(a=>{a.initiatorType==="fetch"&&a.name===t&&n.push(a)})});return o.observe({entryTypes:["resource"]}),{entries:n,observer:o,startTime:r,spanUrl:t}}enable(){if(!Cc){this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()");return}N(fetch)&&(this._unwrap(globalThis,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(globalThis,"fetch",this._patchConstructor())}disable(){Cc&&(this._unwrap(globalThis,"fetch"),this._usedResources=new WeakSet)}};var zi="0.57.0",Mc="@opentelemetry/instrumentation-long-task";var $i="longtask",Mr=class extends U{version=zi;_observer;constructor(t={}){super(Mc,zi,t)}init(){}isSupported(){return typeof PerformanceObserver>"u"||!PerformanceObserver.supportedEntryTypes?!1:PerformanceObserver.supportedEntryTypes.includes($i)}_createSpanFromEntry(t){let r=this.tracer.startSpan($i,{startTime:D(t.startTime)}),{observerCallback:n}=this.getConfig();if(n)try{n(r,{longtaskEntry:t})}catch(o){l.error("longtask instrumentation: observer callback failed",o)}r.setAttribute("longtask.name",t.name),r.setAttribute("longtask.entry_type",t.entryType),r.setAttribute("longtask.duration",t.duration),Array.isArray(t.attribution)&&t.attribution.forEach((o,i)=>{let s=t.attribution.length>1?`longtask.attribution[${i}]`:"longtask.attribution";r.setAttribute(`${s}.name`,o.name),r.setAttribute(`${s}.entry_type`,o.entryType),r.setAttribute(`${s}.start_time`,o.startTime),r.setAttribute(`${s}.duration`,o.duration),r.setAttribute(`${s}.container_type`,o.containerType),r.setAttribute(`${s}.container_src`,o.containerSrc),r.setAttribute(`${s}.container_id`,o.containerId),r.setAttribute(`${s}.container_name`,o.containerName)}),r.end(D(t.startTime+t.duration))}enable(){if(!this.isSupported()){this._diag.debug("Environment not supported");return}this._observer||(this._observer=new PerformanceObserver(t=>{t.getEntries().forEach(r=>this._createSpanFromEntry(r))}),this._observer.observe({type:$i,buffered:!0}))}disable(){this._observer&&(this._observer.disconnect(),this._observer=void 0)}};var ee;(function(e){e.EVENT_TYPE="event_type",e.TARGET_ELEMENT="target_element",e.TARGET_XPATH="target_xpath",e.HTTP_URL="http.url"})(ee||(ee={}));var Wi="0.57.0",Ic="@opentelemetry/instrumentation-user-interaction";var wm="OT_ZONE_CONTEXT",Nm="Navigation:",Lm=["click"];function vm(){return!1}var Ir=class extends U{version=Wi;moduleName="user-interaction";_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(t={}){super(Ic,Wi,t),this._eventNames=new Set(t?.eventNames??Lm),this._shouldPreventSpanCreation=typeof t?.shouldPreventSpanCreation=="function"?t.shouldPreventSpanCreation:vm}init(){}_checkForTimeout(t,r){let n=this._spansData.get(r);n&&(t.source==="setTimeout"?n.hrTimeLastTimeout=D():t.source!=="Promise.then"&&t.source!=="setTimeout"&&(n.hrTimeLastTimeout=void 0))}_allowEventName(t){return this._eventNames.has(t)}_createSpan(t,r,n){if(!(t instanceof HTMLElement)||!t.getAttribute||t.hasAttribute("disabled")||!this._allowEventName(r))return;let o=go(t,!0);try{let i=this.tracer.startSpan(r,{attributes:{[ee.EVENT_TYPE]:r,[ee.TARGET_ELEMENT]:t.tagName,[ee.TARGET_XPATH]:o,[ee.HTTP_URL]:window.location.href}},n?R.setSpan(E.active(),n):void 0);return this._shouldPreventSpanCreation(r,t,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(i){this._diag.error("failed to start create new user interaction span",i)}}_decrementTask(t){let r=this._spansData.get(t);r&&(r.taskCount--,r.taskCount===0&&this._tryToEndSpan(t,r.hrTimeLastTimeout))}_getCurrentSpan(t){let r=t.get(wm);return r&&R.getSpan(r)}_incrementTask(t){let r=this._spansData.get(t);r&&r.taskCount++}addPatchedListener(t,r,n,o){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let s=i.get(r);return s||(s=new Map,i.set(r,s)),s.has(t)?!1:(s.set(t,o),!0)}removePatchedListener(t,r,n){let o=this._wrappedListeners.get(n);if(!o)return;let i=o.get(r);if(!i)return;let s=i.get(t);return s&&(i.delete(t),i.size===0&&(o.delete(r),o.size===0&&this._wrappedListeners.delete(n))),s}_invokeListener(t,r,n){return typeof t=="function"?t.apply(r,n):t.handleEvent(n[0])}_patchAddEventListener(){let t=this;return r=>function(o,i,s){if(!i)return r.call(this,o,i,s);let a=s&&typeof s=="object"&&s.once,c=function(...u){let p,_=u[0],d=_?.target;_&&(p=t._eventsSpanMap.get(_)),a&&t.removePatchedListener(this,o,i);let m=t._createSpan(d,o,p);return m?(_&&t._eventsSpanMap.set(_,m),E.with(R.setSpan(E.active(),m),()=>{let h=t._invokeListener(i,this,u);return m.end(),h})):t._invokeListener(i,this,u)};if(t.addPatchedListener(this,o,i,c))return r.call(this,o,c,s)}}_patchRemoveEventListener(){let t=this;return r=>function(o,i,s){let a=t.removePatchedListener(this,o,i);return a?r.call(this,o,a,s):r.call(this,o,i,s)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._unpatchHistoryApi(),this._wrap(history,"replaceState",this._patchHistoryMethod()),this._wrap(history,"pushState",this._patchHistoryMethod()),this._wrap(history,"back",this._patchHistoryMethod()),this._wrap(history,"forward",this._patchHistoryMethod()),this._wrap(history,"go",this._patchHistoryMethod())}_patchHistoryMethod(){let t=this;return r=>function(...o){let i=`${location.pathname}${location.hash}${location.search}`,s=r.apply(this,o),a=`${location.pathname}${location.hash}${location.search}`;return i!==a&&t._updateInteractionName(a),s}}_unpatchHistoryApi(){N(history.replaceState)&&this._unwrap(history,"replaceState"),N(history.pushState)&&this._unwrap(history,"pushState"),N(history.back)&&this._unwrap(history,"back"),N(history.forward)&&this._unwrap(history,"forward"),N(history.go)&&this._unwrap(history,"go")}_updateInteractionName(t){let r=R.getSpan(E.active());r&&typeof r.updateName=="function"&&r.updateName(`${Nm} ${t}`)}_patchZoneCancelTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&t._decrementTask(s),r.call(this,o)}}_patchZoneScheduleTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&(t._incrementTask(s),t._checkForTimeout(o,s)),r.call(this,o)}}_patchZoneRunTask(){let t=this;return r=>function(o,i,s){let c=(Array.isArray(s)&&s[0]instanceof Event?s[0]:void 0)?.target,u,p=this;if(c){if(u=t._createSpan(c,o.eventName),u)return t._incrementTask(u),p.run(()=>{try{return E.with(R.setSpan(E.active(),u),()=>{let _=Zone.current;return o._zone=_,r.call(_,o,i,s)})}finally{t._decrementTask(u)}})}else u=t._getCurrentSpan(p);try{return r.call(p,o,i,s)}finally{u&&t._shouldCountTask(o,p)&&t._decrementTask(u)}}}_shouldCountTask(t,r){if(t._zone&&(r=t._zone),!r||!t.data||t.data.isPeriodic)return!1;let n=this._getCurrentSpan(r);return!n||!this._spansData.get(n)?!1:t.type==="macroTask"||t.type==="microTask"}_tryToEndSpan(t,r){t&&this._spansData.get(t)&&(t.end(r),this._spansData.delete(t))}enable(){let t=this._getZoneWithPrototype();this._diag.debug("applying patch to",this.moduleName,this.version,"zone:",!!t),t?(N(t.prototype.runTask)&&(this._unwrap(t.prototype,"runTask"),this._diag.debug("removing previous patch from method runTask")),N(t.prototype.scheduleTask)&&(this._unwrap(t.prototype,"scheduleTask"),this._diag.debug("removing previous patch from method scheduleTask")),N(t.prototype.cancelTask)&&(this._unwrap(t.prototype,"cancelTask"),this._diag.debug("removing previous patch from method cancelTask")),this._zonePatched=!0,this._wrap(t.prototype,"runTask",this._patchZoneRunTask()),this._wrap(t.prototype,"scheduleTask",this._patchZoneScheduleTask()),this._wrap(t.prototype,"cancelTask",this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(n=>{N(n.addEventListener)&&(this._unwrap(n,"addEventListener"),this._diag.debug("removing previous patch from method addEventListener")),N(n.removeEventListener)&&(this._unwrap(n,"removeEventListener"),this._diag.debug("removing previous patch from method removeEventListener")),this._wrap(n,"addEventListener",this._patchAddEventListener()),this._wrap(n,"removeEventListener",this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){let t=this._getZoneWithPrototype();this._diag.debug("removing patch from",this.moduleName,this.version,"zone:",!!t),t&&this._zonePatched?(N(t.prototype.runTask)&&this._unwrap(t.prototype,"runTask"),N(t.prototype.scheduleTask)&&this._unwrap(t.prototype,"scheduleTask"),N(t.prototype.cancelTask)&&this._unwrap(t.prototype,"cancelTask")):this._getPatchableEventTargets().forEach(n=>{N(n.addEventListener)&&this._unwrap(n,"addEventListener"),N(n.removeEventListener)&&this._unwrap(n,"removeEventListener")}),this._unpatchHistoryApi()}_getZoneWithPrototype(){return window.Zone}};var Dc="http.host",Uc="http.method",Bc="http.request.body.size",Gc="http.request_content_length_uncompressed";var Hc="http.scheme",Vc="http.status_code",kc="http.url",Fc="http.user_agent";var dt;(function(e){e.METHOD_OPEN="open",e.METHOD_SEND="send",e.EVENT_ABORT="abort",e.EVENT_ERROR="error",e.EVENT_LOAD="loaded",e.EVENT_TIMEOUT="timeout"})(dt||(dt={}));var Pm=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function Cm(e){return typeof Document<"u"&&e instanceof Document}function $c(e){if(Cm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return zc(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Im(e);if(e instanceof URLSearchParams)return zc(e.toString());if(e.byteLength!==void 0)return e.byteLength;Pm.warn("unknown body type")}var Mm=new TextEncoder;function zc(e){return Mm.encode(e).byteLength}function Im(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function Wc(e){let t=Um(),r=e.toUpperCase();return r in t?r:"_OTHER"}var Dm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Dr;function Um(){if(Dr===void 0){let e=void 0;e&&e.length>0?(Dr={},e.forEach(t=>{Dr[t]=!0})):Dr=Dm}return Dr}var Bm={"https:":"443","http:":"80"};function jc(e){let t=Number(e.port||Bm[e.protocol]);if(t&&!isNaN(t))return t}var ji="0.213.0";var xo;(function(e){e.HTTP_STATUS_TEXT="http.status_text"})(xo||(xo={}));var Gm=300,Ur=class extends U{component="xml-http-request";version=ji;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",ji,t),this._semconvStability=Zt("http",t?.semconvStabilityOptIn)}init(){}_addHeaders(t,r){let n=rt(r).href;if(!yr(n,this.getConfig().propagateTraceHeaderCorsUrls)){let i={};B.inject(E.active(),i),Object.keys(i).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}let o={};B.inject(E.active(),o),Object.keys(o).forEach(i=>{t.setRequestHeader(i,String(o[i]))})}_addChildSpan(t,r){E.with(R.setSpan(E.active(),t),()=>{let n=this.tracer.startSpan("CORS Preflight",{startTime:r[T.FETCH_START]}),o=!(this._semconvStability&b.OLD);ht(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[T.RESPONSE_END])})}_addFinalSpanAttributes(t,r,n){if(this._semconvStability&b.OLD){if(r.status!==void 0&&t.setAttribute(Vc,r.status),r.statusText!==void 0&&t.setAttribute(xo.HTTP_STATUS_TEXT,r.statusText),typeof n=="string"){let o=rt(n);t.setAttribute(Dc,o.host),t.setAttribute(Hc,o.protocol.replace(":",""))}t.setAttribute(Fc,navigator.userAgent)}this._semconvStability&b.STABLE&&r.status&&t.setAttribute(on,r.status)}_applyAttributesAfterXHR(t,r){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n=="function"&&ot(()=>n(t,r),o=>{o&&this._diag.error("applyCustomAttributesOnSpan",o)},!0)}_addResourceObserver(t,r){let n=this._xhrMem.get(t);!n||typeof PerformanceObserver!="function"||typeof PerformanceResourceTiming!="function"||(n.createdResources={observer:new PerformanceObserver(o=>{let i=o.getEntries(),s=rt(r);i.forEach(a=>{a.initiatorType==="xmlhttprequest"&&a.name===s.href&&n.createdResources&&n.createdResources.entries.push(a)})}),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(C.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,r,n,o,i){if(!n||!o||!i||!t.createdResources)return;let s=t.createdResources.entries;(!s||!s.length)&&(s=C.getEntriesByType("resource"));let a=Or(rt(n).href,o,i,s,this._usedResources);if(a.mainRequest){let c=a.mainRequest;this._markResourceAsUsed(c);let u=a.corsPreFlightRequest;u&&(this._addChildSpan(r,u),this._markResourceAsUsed(u));let p=!(this._semconvStability&b.OLD);ht(r,c,this.getConfig().ignoreNetworkEvents,void 0,p)}}_cleanPreviousSpanInformation(t){let r=this._xhrMem.get(t);if(r){let n=r.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,r,n){if(ir(r,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let o="",i=rt(r),s={};if(this._semconvStability&b.OLD&&(o=n.toUpperCase(),s[Uc]=n,s[kc]=i.toString()),this._semconvStability&b.STABLE){let c=n,u=Wc(n);o||(o=u),s[rn]=u,u!==c&&(s[nn]=c),s[Ct]=i.toString(),s[sn]=i.hostname;let p=jc(i);p&&(s[an]=p)}let a=this.tracer.startSpan(o,{kind:At.CLIENT,attributes:s});return a.addEvent(dt.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:a,spanUrl:r}),a}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{let r=this;return function(...o){let i=o[0],s=o[1];return r._createSpan(this,s,i),t.apply(this,o)}}}_patchSend(){let t=this;function r(u,p,_,d){let m=p.callbackToRemoveEvents;typeof m=="function"&&m();let{span:h,spanUrl:S,sendStartTime:A}=p;h&&(t._findResourceAndAddNetworkEvents(p,h,S,A,_),h.addEvent(u,d),t._addFinalSpanAttributes(h,p,S),h.end(d),t._tasksCount--),t._clearResources()}function n(u,p,_,d){let m=t._xhrMem.get(p);if(!m)return;if(m.status=p.status,m.statusText=p.statusText,t._xhrMem.delete(p),m.span){let A=m.span;t._applyAttributesAfterXHR(A,p),t._semconvStability&b.STABLE&&(_?d&&(A.setStatus({code:ct.ERROR,message:d}),A.setAttribute(qe,d)):m.status&&m.status>=400&&(A.setStatus({code:ct.ERROR}),A.setAttribute(qe,String(m.status))))}let h=D(),S=Date.now();setTimeout(()=>{r(u,m,h,S)},Gm)}function o(){n(dt.EVENT_ERROR,this,!0,"error")}function i(){n(dt.EVENT_ABORT,this,!1)}function s(){n(dt.EVENT_TIMEOUT,this,!0,"timeout")}function a(){this.status<299?n(dt.EVENT_LOAD,this,!1):n(dt.EVENT_ERROR,this,!1)}function c(u){u.removeEventListener("abort",i),u.removeEventListener("error",o),u.removeEventListener("load",a),u.removeEventListener("timeout",s);let p=t._xhrMem.get(u);p&&(p.callbackToRemoveEvents=void 0)}return u=>function(..._){let d=t._xhrMem.get(this);if(!d)return u.apply(this,_);let m=d.span,h=d.spanUrl;if(m&&h){if(t.getConfig().measureRequestSize&&_?.[0]){let S=_[0],A=$c(S);A!==void 0&&(t._semconvStability&b.OLD&&m.setAttribute(Gc,A),t._semconvStability&b.STABLE&&m.setAttribute(Bc,A))}E.with(R.setSpan(E.active(),m),()=>{t._tasksCount++,d.sendStartTime=D(),m.addEvent(dt.METHOD_SEND),this.addEventListener("abort",i),this.addEventListener("error",o),this.addEventListener("load",a),this.addEventListener("timeout",s),d.callbackToRemoveEvents=()=>{c(this),d.createdResources&&d.createdResources.observer.disconnect()},t._addHeaders(this,h),t._addResourceObserver(this,h)})}return u.apply(this,_)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),N(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),N(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}};var Kc="0.6.0",Xc="@opentelemetry/instrumentation-web-exception";var Br=class extends U{constructor(t={}){super(Xc,Kc,t)}init(){}onError(t){let r="exception",n="reason"in t?t.reason:t.error;if(n===void 0)return;let o=Pt.getLoggerProvider().getLogger(this.instrumentationName,this.instrumentationVersion),i=this.getConfig(),s=i.applyCustomAttributes?i.applyCustomAttributes(n):{},a={};typeof n=="string"?a={[Z]:n}:a={[nt]:n.name,[Z]:n.message,[Kt]:n.stack};let c={eventName:r,severityNumber:J.ERROR,attributes:{...a,...s},timestamp:D(),observedTimestamp:D()};o.emit(c)}disable(){this._onErrorHandler&&(window.removeEventListener("error",this._onErrorHandler),window.removeEventListener("unhandledrejection",this._onErrorHandler))}enable(){this._onErrorHandler||(this._onErrorHandler=this.onError.bind(this)),window.addEventListener("error",this._onErrorHandler),window.addEventListener("unhandledrejection",this._onErrorHandler)}};var Yc="browser.web_vital",qc="browser.web_vital.name",Qc="browser.web_vital.value",Jc="browser.web_vital.rating",Zc="browser.web_vital.delta",tu="browser.web_vital.id",eu="browser.web_vital.navigation_type";var yo=class{t;o=0;i=[];u(t){if(t.hadRecentInput)return;let r=this.i[0],n=this.i.at(-1);this.o&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),this.t?.(t)}},Me=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},bo=e=>{if(document.readyState==="loading")return"loading";{let t=Me();if(t){if(e<t.domInteractive)return"loading";if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return"dom-interactive";if(t.domComplete===0||e<t.domComplete)return"dom-content-loaded"}}return"complete"},Hm=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Zi=e=>{let t="";try{for(;e?.nodeType!==9;){let r=e,n=r.id?"#"+r.id:[Hm(r),...Array.from(r.classList).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,r.id)break;e=r.parentNode}}catch{}return t},Ki=new WeakMap;function Pe(e,t){return Ki.get(e)||Ki.set(e,new t),Ki.get(e)}var lu=-1,mu=()=>lu,Ie=e=>{addEventListener("pageshow",(t=>{t.persisted&&(lu=t.timeStamp,e(t))}),!0)},ft=(e,t,r,n)=>{let o,i;return s=>{t.value>=0&&(s||n)&&(i=t.value-(o??0),(i||o===void 0)&&(o=t.value,t.delta=i,t.rating=((a,c)=>a>c[1]?"poor":a>c[0]?"needs-improvement":"good")(t.value,r),e(t)))}},ts=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Gr=()=>Me()?.activationStart??0,Tt=(e,t=-1)=>{let r=Me(),n="navigate";return mu()>=0?n="back-forward-cache":r&&(document.prerendering||Gr()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},Ce=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver((o=>{Promise.resolve().then((()=>{t(o.getEntries())}))}));return n.observe({type:e,buffered:!0,...r}),n}}catch{}},es=e=>{let t=!1;return()=>{t||(e(),t=!0)}},ve=-1,_u=new Set,ru=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Yi=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of _u)t();isFinite(ve)||(ve=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",Yi,!0))}},Lo=()=>{if(ve<0){let e=Gr();ve=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((r=>r.name==="hidden"&&r.startTime>e))[0]?.startTime)??ru(),addEventListener("visibilitychange",Yi,!0),addEventListener("prerenderingchange",Yi,!0),Ie((()=>{setTimeout((()=>{ve=ru()}))}))}return{get firstHiddenTime(){return ve},onHidden(e){_u.add(e)}}},vo=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},nu=[1800,3e3],hu=(e,t={})=>{vo((()=>{let r=Lo(),n,o=Tt("FCP"),i=Ce("paint",(s=>{for(let a of s)a.name==="first-contentful-paint"&&(i.disconnect(),a.startTime<r.firstHiddenTime&&(o.value=Math.max(a.startTime-Gr(),0),o.entries.push(a),n(!0)))}));i&&(n=ft(e,o,nu,t.reportAllChanges),Ie((s=>{o=Tt("FCP"),n=ft(e,o,nu,t.reportAllChanges),ts((()=>{o.value=performance.now()-s.timeStamp,n(!0)}))})))}))},ou=[.1,.25],iu=e=>e.find((t=>t.node?.nodeType===1))||e[0],du=(e,t={})=>{let r=Pe(t=Object.assign({},t),yo),n=new WeakMap;r.t=o=>{if(o?.sources?.length){let i=iu(o.sources),s=i?.node;if(s){let a=t.generateTarget?.(s)??Zi(s);n.set(i,a)}}},((o,i={})=>{let s=Lo();hu(es((()=>{let a,c=Tt("CLS",0),u=Pe(i,yo),p=d=>{for(let m of d)u.u(m);u.o>c.value&&(c.value=u.o,c.entries=u.i,a())},_=Ce("layout-shift",p);_&&(a=ft(o,c,ou,i.reportAllChanges),s.onHidden((()=>{p(_.takeRecords()),a(!0)})),Ie((()=>{u.o=0,c=Tt("CLS",0),a=ft(o,c,ou,i.reportAllChanges),ts((()=>a()))})),setTimeout(a))})))})((o=>{let i=(s=>{let a={};if(s.entries.length){let c=s.entries.reduce(((u,p)=>u.value>p.value?u:p));if(c?.sources?.length){let u=iu(c.sources);u&&(a={largestShiftTarget:n.get(u),largestShiftTime:c.startTime,largestShiftValue:c.value,largestShiftSource:u,largestShiftEntry:c,loadState:bo(c.startTime)})}}return Object.assign(s,{attribution:a})})(o);e(i)}),t)},fu=(e,t={})=>{hu((r=>{let n=(o=>{let i={timeToFirstByte:0,firstByteToFCP:o.value,loadState:bo(mu())};if(o.entries.length){let s=Me(),a=o.entries.at(-1);if(s){let c=s.activationStart||0,u=Math.max(0,s.responseStart-c);i={timeToFirstByte:u,firstByteToFCP:o.value-u,loadState:bo(o.entries[0].startTime),navigationEntry:s,fcpEntry:a}}}return Object.assign(o,{attribution:i})})(r);e(n)}),t)},Tu=0,Xi=1/0,Oo=0,Vm=e=>{for(let t of e)t.interactionId&&(Xi=Math.min(Xi,t.interactionId),Oo=Math.max(Oo,t.interactionId),Tu=Oo?(Oo-Xi)/7+1:0)},qi,su=()=>qi?Tu:performance.interactionCount??0,km=()=>{"interactionCount"in performance||qi||(qi=Ce("event",Vm,{type:"event",buffered:!0,durationThreshold:0}))},au=0,wo=class{l=[];h=new Map;m;p;v(){au=su(),this.l.length=0,this.h.clear()}M(){let t=Math.min(this.l.length-1,Math.floor((su()-au)/50));return this.l[t]}u(t){if(this.m?.(t),!t.interactionId&&t.entryType!=="first-input")return;let r=this.l.at(-1),n=this.h.get(t.interactionId);if(n||this.l.length<10||t.duration>r.T){if(n?t.duration>n.T?(n.entries=[t],n.T=t.duration):t.duration===n.T&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],T:t.duration},this.h.set(n.id,n),this.l.push(n)),this.l.sort(((o,i)=>i.T-o.T)),this.l.length>10){let o=this.l.splice(10);for(let i of o)this.h.delete(i.id)}this.p?.(n)}}},Qi=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?e():(e=es(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})})))},cu=[200,500],gu=(e,t={})=>{let r=Pe(t=Object.assign({},t),wo),n=[],o=[],i=0,s=new WeakMap,a=new WeakMap,c=!1,u=()=>{c||(Qi(p),c=!0)},p=()=>{let m=r.l.map((f=>s.get(f.entries[0]))),h=o.length-50;o=o.filter(((f,O)=>O>=h||m.includes(f)));let S=new Set;for(let f of o){let O=_(f.startTime,f.processingEnd);for(let x of O)S.add(x)}let A=n.length-1-50;n=n.filter(((f,O)=>f.startTime>i&&O>A||S.has(f))),c=!1};r.m=m=>{let h=m.startTime+m.duration,S;i=Math.max(i,m.processingEnd);for(let A=o.length-1;A>=0;A--){let f=o[A];if(Math.abs(h-f.renderTime)<=8){S=f,S.startTime=Math.min(m.startTime,S.startTime),S.processingStart=Math.min(m.processingStart,S.processingStart),S.processingEnd=Math.max(m.processingEnd,S.processingEnd),S.entries.push(m);break}}S||(S={startTime:m.startTime,processingStart:m.processingStart,processingEnd:m.processingEnd,renderTime:h,entries:[m]},o.push(S)),(m.interactionId||m.entryType==="first-input")&&s.set(m,S),u()},r.p=m=>{if(!a.get(m)){let h=m.entries[0].target;if(h){let S=t.generateTarget?.(h)??Zi(h);a.set(m,S)}}};let _=(m,h)=>{let S=[];for(let A of n)if(!(A.startTime+A.duration<m)){if(A.startTime>h)break;S.push(A)}return S},d=m=>{let h=m.entries[0],S=s.get(h),A=h.processingStart,f=Math.max(h.startTime+h.duration,A),O=Math.min(S.processingEnd,f),x=S.entries.sort(((L,gt)=>L.processingStart-gt.processingStart)),y=_(h.startTime,O),z=r.h.get(h.interactionId),j={interactionTarget:a.get(z),interactionType:h.name.startsWith("key")?"keyboard":"pointer",interactionTime:h.startTime,nextPaintTime:f,processedEventEntries:x,longAnimationFrameEntries:y,inputDelay:A-h.startTime,processingDuration:O-A,presentationDelay:f-O,loadState:bo(h.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(L=>{if(!L.longAnimationFrameEntries?.length)return;let gt=L.interactionTime,Ue=L.inputDelay,kr=L.processingDuration,ne,kt,Do=0,Be=0,Uo=0,Bo=0;for(let Fr of L.longAnimationFrameEntries){Be=Be+Fr.startTime+Fr.duration-Fr.styleAndLayoutStart;for(let Et of Fr.scripts){let is=Et.startTime+Et.duration;if(is<gt)continue;let zr=is-Math.max(gt,Et.startTime),ss=Et.duration?zr/Et.duration*Et.forcedStyleAndLayoutDuration:0;Do+=zr-ss,Be+=ss,zr>Bo&&(kt=Et.startTime<gt+Ue?"input-delay":Et.startTime>=gt+Ue+kr?"presentation-delay":"processing-duration",ne=Et,Bo=zr)}}let Go=L.longAnimationFrameEntries.at(-1),os=Go?Go.startTime+Go.duration:0;os>=gt+Ue+kr&&(Uo=L.nextPaintTime-os),ne&&kt&&(L.longestScript={entry:ne,subpart:kt,intersectingDuration:Bo}),L.totalScriptDuration=Do,L.totalStyleAndLayoutDuration=Be,L.totalPaintDuration=Uo,L.totalUnattributedDuration=L.nextPaintTime-gt-Do-Be-Uo})(j),Object.assign(m,{attribution:j})};Ce("long-animation-frame",(m=>{n=n.concat(m),u()})),((m,h={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let S=Lo();vo((()=>{km();let A,f=Tt("INP"),O=Pe(h,wo),x=z=>{Qi((()=>{for(let L of z)O.u(L);let j=O.M();j&&j.T!==f.value&&(f.value=j.T,f.entries=j.entries,A())}))},y=Ce("event",x,{durationThreshold:h.durationThreshold??40});A=ft(m,f,cu,h.reportAllChanges),y&&(y.observe({type:"first-input",buffered:!0}),S.onHidden((()=>{x(y.takeRecords()),A(!0)})),Ie((()=>{O.v(),f=Tt("INP"),A=ft(m,f,cu,h.reportAllChanges)})))}))})((m=>{let h=d(m);e(h)}),t)},No=class{m;u(t){this.m?.(t)}},uu=[2500,4e3],Eu=(e,t={})=>{let r=Pe(t=Object.assign({},t),No),n=new WeakMap;r.m=o=>{let i=o.element;if(i){let s=t.generateTarget?.(i)??Zi(i);n.set(o,s)}},((o,i={})=>{vo((()=>{let s=Lo(),a,c=Tt("LCP"),u=Pe(i,No),p=d=>{i.reportAllChanges||(d=d.slice(-1));for(let m of d)u.u(m),m.startTime<s.firstHiddenTime&&(c.value=Math.max(m.startTime-Gr(),0),c.entries=[m],a())},_=Ce("largest-contentful-paint",p);if(_){a=ft(o,c,uu,i.reportAllChanges);let d=es((()=>{p(_.takeRecords()),_.disconnect(),a(!0)})),m=h=>{h.isTrusted&&(Qi(d),removeEventListener(h.type,m,{capture:!0}))};for(let h of["keydown","click","visibilitychange"])addEventListener(h,m,{capture:!0});Ie((h=>{c=Tt("LCP"),a=ft(o,c,uu,i.reportAllChanges),ts((()=>{c.value=performance.now()-h.timeStamp,a(!0)}))}))}}))})((o=>{let i=(s=>{let a={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:s.value};if(s.entries.length){let c=Me();if(c){let u=c.activationStart||0,p=s.entries.at(-1),_=p.url&&performance.getEntriesByType("resource").filter((S=>S.name===p.url))[0],d=Math.max(0,c.responseStart-u),m=Math.max(d,_?(_.requestStart||_.startTime)-u:0),h=Math.min(s.value,Math.max(m,_?_.responseEnd-u:0));a={target:n.get(p),timeToFirstByte:d,resourceLoadDelay:m-d,resourceLoadDuration:h-m,elementRenderDelay:s.value-h,navigationEntry:c,lcpEntry:p},p.url&&(a.url=p.url),_&&(a.lcpResourceEntry=_)}}return Object.assign(s,{attribution:a})})(o);e(i)}),t)},pu=[800,1800],Ji=e=>{document.prerendering?vo((()=>Ji(e))):document.readyState!=="complete"?addEventListener("load",(()=>Ji(e)),!0):setTimeout(e)},Su=(e,t={})=>{((r,n={})=>{let o=Tt("TTFB"),i=ft(r,o,pu,n.reportAllChanges);Ji((()=>{let s=Me();s&&(o.value=Math.max(s.responseStart-Gr(),0),o.entries=[s],i(!0),Ie((()=>{o=Tt("TTFB",0),i=ft(r,o,pu,n.reportAllChanges),i(!0)})))}))})((r=>{let n=(o=>{let i={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(o.entries.length){let s=o.entries[0],a=s.activationStart||0,c=Math.max((s.workerStart||s.fetchStart)-a,0),u=Math.max(s.domainLookupStart-a,0),p=Math.max(s.connectStart-a,0),_=Math.max(s.connectEnd-a,0);i={waitingDuration:c,cacheDuration:u-c,dnsDuration:p-u,connectionDuration:_-p,requestDuration:o.value-_,navigationEntry:s}}return Object.assign(o,{attribution:i})})(r);e(n)}),t)};var rs=class extends U{_applyCustomLogRecordData;_includeRawAttribution;constructor(e={}){super("@opentelemetry/instrumentation-web-vitals","0.1.0",e),this._applyCustomLogRecordData=e.applyCustomLogRecordData,this._includeRawAttribution=e.includeRawAttribution??!1}init(){return[]}enable(){if(typeof PerformanceObserver>"u"){this._diag.debug("PerformanceObserver not supported, web vitals will not be collected");return}if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug("Listeners already registered, resuming emission");return}this._listenersRegistered=!0,this._diag.debug("Registering listeners"),du(e=>this._emitWebVital(e)),gu(e=>this._emitWebVital(e)),Eu(e=>this._emitWebVital(e)),fu(e=>this._emitWebVital(e)),Su(e=>this._emitWebVital(e))}disable(){this._isEnabled=!1,this._diag.debug("Instrumentation disabled, pausing emission")}_getTimestampForMetric(e){if(e.name==="CLS"){let{attribution:t}=e;return t.largestShiftTime!==void 0?t.largestShiftTime:void 0}if(e.name==="INP"){let{attribution:t}=e;return t.interactionTime}return e.value}_emitWebVital(e){if(!this._isEnabled)return;let t={[qc]:e.name.toLowerCase(),[Qc]:e.value,[Zc]:e.delta,[Jc]:e.rating,[tu]:e.id,[eu]:e.navigationType},r=this._getTimestampForMetric(e),n={eventName:Yc,severityNumber:J.INFO,attributes:t,...this._includeRawAttribution?{body:JSON.stringify(e.attribution)}:{},...r!==void 0?{timestamp:r}:{}};this._applyCustomLogRecordData&&ot(()=>this._applyCustomLogRecordData?.(n),o=>{o&&this._diag.error("applyCustomLogRecordData hook failed",o)},!0),this.logger.emit(n)}};var Po=w.INFO,Ht={ALL:w.ALL,VERBOSE:w.VERBOSE,DEBUG:w.DEBUG,INFO:w.INFO,WARN:w.WARN,ERROR:w.ERROR,NONE:w.NONE};function Co(e){return Po=Ht[e.logLevel.toUpperCase()],Po==null&&(console.warn(`Unknown log level "${e.logLevel}", expected one of ${Object.keys(Ht)}, using default`),Po=Ht.INFO),{error:Hr(Ht.ERROR,console.error.bind(console)),warn:Hr(Ht.WARN,console.error.bind(console)),info:Hr(Ht.INFO,console.log.bind(console)),debug:Hr(Ht.DEBUG,console.log.bind(console)),verbose:Hr(Ht.VERBOSE,console.trace.bind(console))}}function Hr(e,t){return function(...n){let o=Po>=e;if(n.length===0)return o;o&&t(...n)}}var re=Co({logLevel:"warn"}),De=V,Mo=!1,Ru={active:function(){return De},with:function(e,t,r,...n){let o=De;De=e||V;try{return t.call(r,...n)}finally{De=o}},bind:function(e,t){return typeof t=="function"?wt(t,this,e):t},enable:function(){if(Mo)return this;let e=this;return Nt(window,"setTimeout",t=>function(...r){let n=Number(r[1]);return(isNaN(n)||n<=50)&&(r[0]=wt(r[0],e,e.active())),t.apply(this,r)}),Nt(window,"setImmediate",t=>function(...r){return r[0]=wt(r[0],e,e.active()),t.apply(this,r)}),$m(e),window.Promise&&Fm(e),De=V,Mo=!0,e},disable:function(){return Mo&&(it(window,"setTimeout"),it(window,"setImmediate"),Wm(),window.Promise&&zm(),De=V,Mo=!1),this}};function wt(e,t,r){if(typeof e!="function")return e;let n=r||t.active();function o(...i){return t.with(n,()=>e.apply(this,i))}return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),o}function Fm(e){Nt(Promise.prototype,"then",t=>function(r,n){return t.call(this,wt(r,e,e.active()),wt(n,e,e.active()))}),Nt(Promise.prototype,"catch",t=>function(r){return t.call(this,wt(r,e,e.active()))}),Nt(Promise.prototype,"finally",t=>function(r){return t.call(this,wt(r,e,e.active()))})}function zm(){it(Promise.prototype,"then"),it(Promise.prototype,"catch"),it(Promise.prototype,"finally")}var xu=["onreadystatechange"],Vt=globalThis.XMLHttpRequest.prototype,Ou=["onabort","onerror","onload","onloadend","onloadstart","onprogress","ontimeout"],Io=globalThis.XMLHttpRequestEventTarget.prototype;function $m(e){Nt(Vt,"addEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){n.__bound=n.__bound||new Map;let o=r[1],i=n.__bound.get(o);r[1]=i||wt(o,e,e.active()),n.__bound.set(o,r[1])}return t.apply(n,r)}}),Nt(Vt,"removeEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){let o=r[1],i=n.__bound?.get(o);i&&(r[1]=i)}return t.apply(n,r)}});for(let t of xu){let r=Object.getOwnPropertyDescriptor(Vt,t);r&&(Au(r,e),Object.defineProperty(Vt,t,r))}for(let t of Ou){let r=Object.getOwnPropertyDescriptor(Io,t);r&&(Au(r,e),Object.defineProperty(Io,t,r))}}function Wm(){it(Vt,"addEventListener"),it(Vt,"removeEventListener");for(let e of xu){let t=Object.getOwnPropertyDescriptor(Vt,e);t&&(it(t,"set"),it(t,"get"),Object.defineProperty(Vt,e,t))}for(let e of Ou){let t=Object.getOwnPropertyDescriptor(Io,e);t&&(it(t,"set"),it(t,"get"),Object.defineProperty(Io,e,t))}}function Nt(e,t,r){if(!e||!e[t]){re.warn("no original function "+String(t)+" to wrap");return}if(!r){re.warn("no wrapper function"),re.warn(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){re.warn("original object and wrapper must be functions");return}let o=r(n,t);return typeof n.toString=="function"&&(o.toString=n.toString.bind(n)),Vr(o,"__original",n),Vr(o,"__unwrap",()=>{e[t]===o&&Vr(e,t,n)}),Vr(o,"__wrapped",!0),Vr(e,t,o),o}function it(e,t){if(!e||!e[t]){re.warn("no function to unwrap."),re.warn(new Error().stack);return}let r=e[t];if(!r.__unwrap)re.warn(`no original to unwrap to -- has ${String(t)} already been unwrapped?`);else{r.__unwrap();return}}function Au(e,t){Nt(e,"set",function(r){return function(n){if(typeof n=="function"){let o=n;n=wt(o,t,t.active()),n.__original=o}return r.call(this,n)}}),Nt(e,"get",function(r){return function(){let n=r.call(this);return typeof n=="function"&&n.__original?n.__original:n}})}function Vr(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var yu="browser.brands",bu="browser.language",wu="browser.mobile",Nu="browser.platform";var Lu="user_agent.original";var vu="0.1.0";function Pu(e,t,r){typeof t=="string"&&t&&(e["service.name"]=t),typeof r=="string"&&r&&(e["service.version"]=r);let{userAgent:n,userAgentData:o}=navigator,i=Km(n),s;return o?(s={name:o.platform,version:""},e[yu]=o.brands.map(a=>`${a.brand} ${a.version}`)):s=jm(n),i&&(e["browser.name"]=i.name,i.version&&(e["browser.version"]=i.version)),s&&(e[Nu]=s.name),e[wu]=navigator.userAgent.includes("Mobi"),e[bu]=navigator.language,e[Lu]=n,e["telemetry.distro.name"]="elastic",e["telemetry.distro.version"]=vu,Nn({...e,...Mt})}function jm(e){let t=[["Symbian",[/SymbianOS\/([\w\.]+)/i]],["Windows Phone",[/Windows Phone ([\w\.]+)/i]],["Xbox",[/Xbox?/i]],["Windows",[/Windows (\d+)/i]],["Windows RT",[/Windows NT ([\w\.]+).+ARM;/i]],["Windows",[/Windows NT (\d+\.\d+)/i]],["Windows IoT",[/Windows IoT (\d+\.\d+)/i]],["iOS",[/iPhone OS (\d+(_\d+)*)/i,/iPad;.+CPU OS (\d+(_\d+)*)/i]],["macOS",[/Mac OS (\d+(_\d+)*)/i,/Mac OS X ([\w\.]+)/i,/Intel Mac OS X/]],["Ubuntu Touch",[/Ubuntu ([\w\.]+).+Mobile/i]],["Android",[/Android ([\w\.]+)/i,/Android;/i]],["Linux",[/Linux ([\w_]+)/i,/Linux;/]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}function Km(e){let t=[["AliPay",[/AliPayClient\/([\w\.]+)/i]],["Baidu",[/bd(?:browser|spark)\/([\w\.]+)/i,/baidu(?:boxapp|hd)\/([\w\.]+)/i,/BIDUBrowser\/([\w\.]+)/i]],["Bing",[/Bing(?:Web|Sapphire)\/([\w\.]+)/i]],["Camino",[/Camino\/([\w\.]+)/i]],["Coc Coc",[/coc_coc_browser\/([\w\.]+)/i]],["Dragon",[/(?:Dragon|Comodo_Dragon)\/([\w\.]+)/i]],["DuckDuckGo",[/(?:Ddg|DuckDuckGo)\/([\w\.]+)/i]],["Electron",[/Electron\/([\w\.]+)/i]],["Facebook",[/;fbav\/([\w\.]+);/i,/(?:fban\/fbios|fb_iab\/fb4a)/i]],["GSA",[/GSA\/([\w\.]+)/i]],["Huawei Browser",[/HuaweiBrowser\/([\w\.]+)/i]],["Iron",[/(?:Iron|Iron Safari)\/([\w\.]+)/i]],["LG Browser",[/LG Browser\/([\w\.]+)/i]],["Lunascape",[/Lunascape\/([\w\.]+)/i]],["Maxthon",[/Maxthon\/([\w\.]+)/i,/Mx(?:Browser|iOS)\/([\w\.]+)/i]],["MIUI Browser",[/MiuiBrowser\/([\w\.]+)/i]],["NokiaBrowser",[/NokiaBrowser\/([\w\.]+)/i]],["Oculus Browser",[/OculusBrowser\/([\w\.]+)/i]],["Pico Browser",[/PicoBrowser\/([\w\.]+)/i]],["Qwant",[/Qwant(?:Mobile|Browser|iOS)\/([\w\.]+)/i]],["Samsung Internet",[/SamsungBrowser\/([\w\.]+)/i]],["Silk",[/Silk\/([\w\.]+)/i]],["Smart Lenovo Browser",[/SLBrowser\/([\w\.]+)/i]],["Snapchat",[/Snapchat\/([\w\.]+)/i]],["Steam",[/Valve Steam/i]],["TikTok",[/musical_ly.+app_version\/([\w\.]+)/i]],["Twitter",[/Twitter/i]],["Vivaldi",[/Vivaldi\/([\w\.]+)/i]],["Yandex",[/Ya(?:SearchBrowser|Browser)\/([\w\.]+)/i]],["WeChat",[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i]],["QQBrowser",[/M?QQbrowser\/([\w\.]+)/i]],["Brave",[/Brave\/([\w\.]+)/i]],["Edge",[/(?:Edg|Edge|EdgA|EdgW|EdgiOS)\/([\w\.]+)/i]],["Opera",[/(?:OPR|OPT|OPiOS|Opera)\/([\w\.]+)/i,/Coast\/([\w\.]+)/i]],["Chromium",[/Chromium\/([\w\.]+)/i]],["Chrome Headless",[/HeadlessChrome\/([\w\.]+)/i,/HeadlessChrome Safari\/([\w\.]+)/i]],["Chrome",[/Chrome\/([\w\.]+)/i,/Cr(?:iOS|Mo)\/([\w\.]+)/i]],["Android Browser",[/Android \d.+Safari\/([\w\.]+)/i]],["Firefox",[/(?:Firefox|FxiOS)\/([\w\.]+)/i]],["Safari",[/Safari\/([\w\.]+)/i]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}var Cu=!1,Mu={logLevel:"info",sampleRate:1,serviceName:"unknown_service:web",resourceAttributes:{},otlpEndpoint:"http://localhost:4318",exportHeaders:{}};function Iu(e={}){if(Cu||e.disabled)return;let t=e.logLevel??Mu.logLevel;l.setLogger(Co({logLevel:t}),{logLevel:w.ALL}),l.debug("Browser SDK intialization",e);let{serviceName:r,serviceVersion:n}=e,o={...Mu,...e},i;try{i=new URL(o.otlpEndpoint)}catch{l.error(`The value "${o.otlpEndpoint}" for "otlpEndpoint" configuration is not an URL. SDK won't start.`);return}let s=Pu(o.resourceAttributes,r,n),a=ns(i,"v1/traces").href,c=new Ne(new be({url:a,headers:o.exportHeaders})),u=new xr({resource:s,sampler:new Gt(o.sampleRate),spanProcessors:[c]});u.register({contextManager:Ru});let p=ns(i,"v1/metrics").href,_=new fr({exporter:new ye({url:p,headers:o.exportHeaders})}),d=new gr({resource:s,readers:[_]});$t.setGlobalMeterProvider(d);let m=ns(i,"v1/logs").href,h=new we(new Oe({url:m,headers:o.exportHeaders})),S=new Ar({resource:s,processors:[h]});Pt.setGlobalLoggerProvider(S);let A={"@opentelemetry/instrumentation-document-load":y=>new Lr(y),"@opentelemetry/instrumentation-fetch":y=>new Cr(y),"@opentelemetry/instrumentation-long-task":y=>new Mr(y),"@opentelemetry/instrumentation-user-interaction":y=>new Ir(y),"@opentelemetry/instrumentation-xml-http-request":y=>new Ur(y),"@opentelemetry/instrumentation-web-exception":y=>new Br(y),"@opentelemetry/instrumentation-web-vitals":y=>new rs(y)},f={semconvStabilityOptIn:"http"},O=o.instrumentations||{},x=[];for(let y of Object.keys(A)){let z=O[y];(y==="@opentelemetry/instrumentation-fetch"||y==="@opentelemetry/instrumentation-xml-http-request")&&(z={...f,...z}),z?.enabled===!1||x.push(A[y](z))}return Gi({instrumentations:x}),Cu=!0,{forceFlush(){return Promise.all([u.forceFlush(),d.forceFlush(),S.forceFlush()]).then(()=>{})}}}function ns(e,t){let r=new URL(e.href);return r.pathname=(r.pathname+t).replace("//","/"),r}globalThis.startBrowserSdk=Iu;})();
|
|
12
|
+
`,ms(i,t),`To resolve the conflict:
|
|
13
|
+
`,ds(i,t))}return n}};var io=class{_backingStorages;constructor(t){this._backingStorages=t}record(t,r,n,o){let i=this._backingStorages;for(let s=0;s<i.length;s++)i[s].record(t,r,n,o)}};var so=class{_buffer=new q;_instrumentName;_valueType;constructor(t,r){this._instrumentName=t,this._valueType=r}observe(t,r={}){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===K.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}},ao=class{_buffer=new Map;observe(t,r,n={}){if(!Or(t))return;let o=this._buffer.get(t);if(o==null&&(o=new q,this._buffer.set(t,o)),typeof r!="number"){l.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===K.INT&&!Number.isInteger(r)&&(l.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||o.set(n,r)}};var co=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(Or));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(Or)),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 so(o._descriptor.name,o._descriptor.valueType),s=Promise.resolve(n(i));r!=null&&(s=Gt(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 ao,s=Promise.resolve(n(i));r!=null&&(s=Gt(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&&nc(n.instruments,r))}};var uo=class extends Ee{_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 Se(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 hs=class{process(t,r){return t}},fs=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 lo(){return o_}function Lc(e){return new fs(e)}var o_=new hs;var po=class{metricStorageRegistry=new oo;observableRegistry=new co;meter;_meterProviderSharedState;_instrumentationScope;constructor(t,r){this.meter=new ro(this),this._meterProviderSharedState=t,this._instrumentationScope=r}registerMetricStorage(t){let r=this._registerMetricStorage(t,uo);return r.length===1?r[0]:new io(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,no)}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=xc(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),m=a.selectCardinalityLimit(t.type),f=new r(t,p,lo(),[a],m);return this.metricStorageRegistry.registerForCollector(a,f),f});o=o.concat(s)}return o}};var _o=class{viewRegistry=new Xn;metricCollectors=[];meterSharedStates=new Map;resource;constructor(t){this.resource=t}getMeterSharedState(t){let r=rc(t),n=this.meterSharedStates.get(r);return n==null&&(n=new po(this,t),this.meterSharedStates.set(r,n)),n}selectAggregations(t){let r=[];for(let n of this.metricCollectors)r.push([n,Wn(n.selectAggregation(t))]);return r}};var mo=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 i_=/[\^$\\.+?()[\]{}|]/g,Re=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(i_,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}},Vt=class{_matchAll;_pattern;constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}};var ho=class{_nameFilter;_type;_unitFilter;constructor(t){this._nameFilter=new Re(t?.name??"*"),this._type=t?.type,this._unitFilter=new Vt(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};var fo=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(t){this._nameFilter=new Vt(t?.name),this._versionFilter=new Vt(t?.version),this._schemaUrlFilter=new Vt(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};function s_(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function a_(e){if(s_(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||Re.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 To=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(t){a_(t),t.attributesProcessors!=null?this.attributesProcessor=Lc(t.attributesProcessors):this.attributesProcessor=lo(),this.name=t.name,this.description=t.description,this.aggregation=Wn(t.aggregation??{type:k.DEFAULT}),this.instrumentSelector=new ho({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new fo({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}};var Lr=class{_sharedState;_shutdown=!1;constructor(t){if(this._sharedState=new _o(t?.resource??qt()),t?.views!=null&&t.views.length>0)for(let r of t.views)this._sharedState.viewRegistry.addView(new To(r));if(t?.readers!=null&&t.readers.length>0)for(let r of t.readers){let n=new mo(this._sharedState,r);r.setMetricProducer(n),this._sharedState.metricCollectors.push(n),t.sdkMetricsEnabled&&r instanceof he&&r._setSelfObsMeterProvider(this)}}getMeter(t,r="",n={}){return this._shutdown?(l.warn("A shutdown MeterProvider cannot provide a Meter"),St()):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)))}};function xe(e,t){let r={attributes:et(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function Oe(e,t){let r={name:e.name,version:e.version};return e.attributes&&Object.keys(e.attributes).length>0&&(r.attributes=et(e.attributes,t),r.droppedAttributesCount=e.droppedAttributesCount??0),r}function et(e,t){return Object.keys(e).map(r=>c_(r,e[r],t))}function c_(e,t,r){return{key:e,value:br(t,r)}}function br(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]=br(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:br(e[n[i]],t)};return{kvlistValue:{values:o}}}return{}}function bc(e,t){return{resourceLogs:l_(e,t)}}function u_(e){let t=new Map;for(let r of e){let{resource:n,instrumentationScope:o}=r,i=t.get(n);i||(i=new Map,t.set(n,i));let s=i.get(o);s||(s=[],i.set(o,s)),s.push(r)}return t}function l_(e,t){let r=u_(e);return Array.from(r,([n,o])=>{let i=xe(n,t);return{resource:i,scopeLogs:Array.from(o,([,s])=>({scope:Oe(s[0].instrumentationScope,t),logRecords:s.map(a=>p_(a,t)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:i.schemaUrl}})}function p_(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:br(e.body,t),eventName:e.eventName,attributes:et(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function __(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function m_(e){return __(e).toString()}var d_=typeof BigInt<"u"?m_:Z;function wc(e){return e}var Le={encodeHrTime:d_,encodeSpanContext:wc,encodeOptionalSpanContext:wc,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 go={serializeRequest:e=>{let t=bc(e,Le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return l.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}};var wr;(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"})(wr||(wr={}));function h_(e,t){let r=xe(e.resource,t);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:f_(e.scopeMetrics,t)}}function f_(e,t){return Array.from(e.map(r=>({scope:Oe(r.scope,t),metrics:r.metrics.map(n=>T_(n,t)),schemaUrl:r.scope.schemaUrl})))}function T_(e,t){let r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=S_(e.aggregationTemporality);switch(e.dataPointType){case H.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:Nc(e,t)};break;case H.GAUGE:r.gauge={dataPoints:Nc(e,t)};break;case H.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:E_(e,t)};break;case H.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:A_(e,t)};break}return r}function g_(e,t,r){let n={attributes:et(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case K.INT:n.asInt=e.value;break;case K.DOUBLE:n.asDouble=e.value;break}return n}function Nc(e,t){return e.dataPoints.map(r=>g_(r,e.descriptor.valueType,t))}function E_(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:et(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 A_(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:et(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 S_(e){switch(e){case G.DELTA:return wr.AGGREGATION_TEMPORALITY_DELTA;case G.CUMULATIVE:return wr.AGGREGATION_TEMPORALITY_CUMULATIVE}}function yc(e,t){return{resourceMetrics:e.map(r=>h_(r,t))}}var Eo={serializeRequest:e=>{let t=yc([e],Le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return l.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}};var R_=256,x_=512;function Cc(e,t){let r=e&255|R_;return t&&(r|=x_),r}function O_(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:et(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(i=>b_(i,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(i=>L_(i,t)),droppedLinksCount:e.droppedLinksCount,flags:Cc(r.traceFlags,e.parentSpanContext?.isRemote)}}function L_(e,t){return{attributes:e.attributes?et(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:Cc(e.context.traceFlags,e.context.isRemote)}}function b_(e,t){return{attributes:e.attributes?et(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Pc(e,t){return{resourceSpans:N_(e,t)}}function w_(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 N_(e,t){let r=w_(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 _=p.value;if(_.length>0){let d=_.map(h=>O_(h,t));c.push({scope:Oe(_[0].instrumentationScope,t),spans:d,schemaUrl:_[0].instrumentationScope.schemaUrl})}p=u.next()}let m=xe(s,t),f={resource:m,scopeSpans:c,schemaUrl:m.schemaUrl};n.push(f),i=o.next()}return n}var Ao={serializeRequest:e=>{let t=Pc(e,Le);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return l.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}};var Ts=5,y_=1e3,C_=5e3,P_=1.5,Ic=.2;function I_(){return Math.random()*(2*Ic)-Ic}var gs=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=Ts,o=y_,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+I_()),C_),0);o=o*P_;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 ${Ts-n} retry attempts.`):s.status==="retryable"?l.info(`Export failed after maximum retry attempts (${Ts}).`):l.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}};function Mc(e){return new gs(e.transport)}function vc(e){return e===429||e===502||e===503||e===504}function Dc(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 M_=60*1024,v_=9,Es=0,So=0,As=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=Es+s>M_,c=So>=v_,u=!a&&!c;if(u)Es+=s,So++;else{let p=a?"size limit":"count limit";l.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${So} pending (${p})`)}try{let p=new URL(this._parameters.url),m=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(m.status>=200&&m.status<=299)return l.debug(`export response success (status: ${m.status})`),{status:"success"};if(vc(m.status)){l.warn(`export response retryable (status: ${m.status})`);let f=m.headers.get("Retry-After");return{status:"retryable",retryInMillis:Dc(f)}}return l.error(`export response failure (status: ${m.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${m.status}`)}}catch(p){return D_(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&&(Es-=s,So--)}}shutdown(){}};function Uc(e){return new As(e)}function D_(e){return e instanceof TypeError&&!e.cause}function Bc(e,t){return ec(e,t,Mc({transport:Uc(e)}))}function Gc(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 U_(e,t,r){return async()=>{let n={...await r()},o={};return t!=null&&Object.assign(o,await t()),e!=null&&Object.assign(o,Gc(await e())),Object.assign(o,n)}}function B_(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 Hc(e,t,r){return{...La(e,t,r),headers:U_(e.headers,t.headers,r.headers),url:B_(e.url)??t.url??r.url}}function Vc(e,t){return{...ba(),headers:async()=>e,url:"http://localhost:4318/"+t}}function kc(e){return typeof e.headers=="function"?e.headers:Oa(e.headers)}function Fc(e,t,r){return Hc({url:e.url,timeoutMillis:e.timeoutMillis,headers:kc(e),concurrencyLimit:e.concurrencyLimit},{},Vc(r,t))}function Qt(e,t,r,n){let o=Fc(e,r,n);return Bc(o,t)}var be=class extends bt{constructor(t={}){super(Qt(t,go,"v1/logs",{"Content-Type":"application/json"}))}};var Nr;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(Nr||(Nr={}));var Ss=()=>G.CUMULATIVE,zc=e=>{switch(e){case T.COUNTER:case T.OBSERVABLE_COUNTER:case T.GAUGE:case T.HISTOGRAM:case T.OBSERVABLE_GAUGE:return G.DELTA;case T.UP_DOWN_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:return G.CUMULATIVE}},$c=e=>{switch(e){case T.COUNTER:case T.HISTOGRAM:return G.DELTA;case T.GAUGE:case T.UP_DOWN_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:case T.OBSERVABLE_COUNTER:case T.OBSERVABLE_GAUGE:return G.CUMULATIVE}};function G_(){let e=(void 0??"cumulative").toLowerCase();return e==="cumulative"?Ss:e==="delta"?zc:e==="lowmemory"?$c:(l.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Ss)}function H_(e){return e!=null?e===Nr.DELTA?zc:e===Nr.LOWMEMORY?$c:Ss:G_()}var V_=Object.freeze({type:k.DEFAULT});function k_(e){return e?.aggregationPreference??(()=>V_)}var Ro=class extends bt{_aggregationTemporalitySelector;_aggregationSelector;constructor(t,r){super(t),this._aggregationSelector=k_(r),this._aggregationTemporalitySelector=H_(r?.temporalityPreference)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}};var we=class extends Ro{constructor(t){super(Qt(t??{},Eo,"v1/metrics",{"Content-Type":"application/json"}),t)}};var Ne=class extends bt{constructor(t={}){super(Qt(t,Ao,"v1/traces",{"Content-Type":"application/json"}))}};function F_(e){return Rs(e,new WeakSet)}function Rs(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)){for(let n of e)if(!Rs(n,t))return!1;return!0}let r=e;if(r.constructor!==Object&&r.constructor!==void 0)return!1;for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&!Rs(r[n],t))return!1;return!0}return!1}var Q;(function(e){e[e.DROP_INVALID=0]="DROP_INVALID",e[e.DROP_LIMIT_REACHED=1]="DROP_LIMIT_REACHED",e[e.ADD_NEW=2]="ADD_NEW",e[e.ADD_OVERWRITE_EXISTING=3]="ADD_OVERWRITE_EXISTING"})(Q||(Q={}));function Os(e,t,r,n,o){if(n.length===0)return l.warn(`Invalid attribute key: ${n}`),Q.DROP_INVALID;if(!F_(o))return l.warn(`Invalid attribute value set for key: ${n}`),Q.DROP_INVALID;let i=!Object.prototype.hasOwnProperty.call(e,n);return i&&r>=t.attributeCountLimit?Q.DROP_LIMIT_REACHED:(e[n]=xs(o,t.attributeValueLengthLimit),i?Q.ADD_NEW:Q.ADD_OVERWRITE_EXISTING)}function xs(e,t){if(t<=0)return l.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e=="string")return e.length<=t?e:e.substring(0,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(r=>xs(r,t));if(typeof e=="object"){let r={};for(let[n,o]of Object.entries(e))r[n]=xs(o,t);return r}return e}function Wc(e,t){if(t==null)return{};let r={},n=0,o=0;for(let[i,s]of Object.entries(t)){let a=Os(r,e,n,i,s);a===Q.ADD_NEW?n+=1:(a===Q.DROP_INVALID||a===Q.DROP_LIMIT_REACHED)&&(o+=1)}return{attributes:n>0?r:void 0,droppedAttributesCount:o}}var xo=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(t){this._isLogRecordReadonly()||(this._severityText=t)}get severityText(){return this._severityText}set severityNumber(t){this._isLogRecordReadonly()||(this._severityNumber=t)}get severityNumber(){return this._severityNumber}set body(t){this._isLogRecordReadonly()||(this._body=t)}get body(){return this._body}get eventName(){return this._eventName}set eventName(t){this._isLogRecordReadonly()||(this._eventName=t)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(t,r,n){let{timestamp:o,observedTimestamp:i,eventName:s,severityNumber:a,severityText:c,body:u,attributes:p={},exception:m,context:f}=n,_=Date.now();if(this.hrTime=lt(o??_),this.hrTimeObserved=lt(i??_),f){let d=S.getSpanContext(f);d&&X(d)&&(this.spanContext=d)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this._eventName=s,this.setAttributes(p),m!=null&&this._setException(m)}setAttribute(t,r){if(this._isLogRecordReadonly())return this;let n=Os(this.attributes,this._logRecordLimits,this._attributesCount,t,r);return n===Q.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&l.warn("Dropping extra attributes.")):n===Q.ADD_NEW&&this._attributesCount++,this}setAttributes(t){for(let[r,n]of Object.entries(t))this.setAttribute(r,n);return this}setBody(t){return this.body=t,this}setEventName(t){return this.eventName=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}_makeReadonly(){this._isReadonly=!0}_setException(t){let r=!1;if(typeof t=="string"||typeof t=="number")Object.hasOwn(this.attributes,J)||this.setAttribute(J,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,J)||this.setAttribute(J,n.message),r=!0),n.stack&&(Object.hasOwn(this.attributes,Xt)||this.setAttribute(Xt,n.stack),r=!0)}r||l.warn(`Failed to record an exception ${t}`)}_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=t.context||E.active();if(!this.enabled(t))return;let n=new xo(this._sharedState,this._instrumentationScope,{context:r,...t});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}enabled(t){let r=this._loggerConfig;if(r.disabled)return!1;let n=t?.severityNumber;if(typeof n=="number"&&n!==Lt.UNSPECIFIED&&n<r.minimumSeverity)return!1;let o=t?.context||E.active();if(r.traceBased){let s=S.getSpanContext(o);if(s&&X(s)&&!((s.traceFlags&C.SAMPLED)===C.SAMPLED))return!1}let i={context:o,instrumentationScope:this._instrumentationScope,severityNumber:t?.severityNumber,eventName:t?.eventName};for(let s of this._sharedState.processors)if(!s.enabled||s.enabled(i))return!0;return!1}};var Lo=class{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}enabled(t){return!1}};var bo=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=>Yi(r.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(n=>n.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(t=>t.shutdown()))}enabled(t){for(let r of this.processors)if(!r.enabled||r.enabled(t))return!0;return!1}};function Ls(e){if(e===void 0)return["u",null];if(e===null)return["n",null];let t=typeof e;return t==="string"?["s",e]:t==="boolean"?["b",e]:t==="number"?Number.isNaN(e)?["nan",null]:e===1/0?["inf",null]:e===-1/0?["-inf",null]:Object.is(e,-0)?["n0",null]:["d",e]:e instanceof Uint8Array?["bytes",Array.from(e)]:Array.isArray(e)?["arr",e.map(Ls)]:["map",Object.entries(e).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>[r,Ls(n)])]}function wo(e){return JSON.stringify([e.name,e.version||"",e.schemaUrl||"",Ls(e.attributes),e.droppedAttributesCount??0])}var jc="otel.sdk.log.created";var No=class{createdLogs;constructor(t){this.createdLogs=t.createCounter(jc,{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}};var Kc="0.219.0";var z_={disabled:!1,minimumSeverity:Lt.UNSPECIFIED,traceBased:!1},bs=()=>({...z_}),yo=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(t,r,n,o,i,s){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new bo(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Lo,this._loggerConfigurator=i??bs;let a=s?s.getMeter("@opentelemetry/sdk-logs",Kc):St();this.loggerMetrics=new No(a)}getLoggerConfig(t){let r=wo(t),n=this._loggerConfigs.get(r);return n||(n=this._loggerConfigurator(t),this._loggerConfigs.set(r,n),n)}};var $_="unknown",yr=class{_shutdownOnce;_sharedState;constructor(t={}){let r={resource:t.resource??qt(),forceFlushTimeoutMillis:t.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:t.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:t.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:t.loggerConfigurator??bs,processors:t.processors??[],meterProvider:t.meterProvider};this._sharedState=new yo(r.resource,r.forceFlushTimeoutMillis,r.logRecordLimits,r.processors,r.loggerConfigurator,r.meterProvider),this._shutdownOnce=new wt(this._shutdown,this)}getLogger(t,r,n){if(this._shutdownOnce.isCalled)return l.warn("A shutdown LoggerProvider cannot provide a Logger"),Bi();t||l.warn("Logger requested without instrumentation scope name.");let i={name:t||$_,version:r,schemaUrl:n?.schemaUrl,...Wc(this._sharedState.logRecordLimits,n?.attributes)},s=wo(i);return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new Oo(i,this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(l.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(l.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};async function W_(e){let t=[];for(let r=0,n=e.length;r<n;r++){let o=e[r];o.resource.asyncAttributesPending&&o.resource.waitForAsyncAttributes&&t.push(o.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var Co=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(t,r,n){this._exportScheduledPromise=new Promise(o=>{this._exportScheduledResolve=o}),this._exportCompleted=this._executeExport(t,r,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(t,r,n){try{await W_(r),await E.with(jt(E.active()),async()=>this._exportWithTimeout(t,r,n))}catch(o){P(o),this._exportScheduledResolve()}}async _exportWithTimeout(t,r,n){return new Promise((o,i)=>{let s=setTimeout(()=>{i(new Error("Timeout"))},n);t.export(r,a=>{clearTimeout(s),a.code===U.SUCCESS?o():i(a.error??new Error("BatchLogRecordProcessor: log record export failed"))}),this._exportScheduledResolve()})}},Po=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(t,r){this._exporter=t,this._maxExportBatchSize=r?.maxExportBatchSize??512,this._maxQueueSize=r?.maxQueueSize??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??3e4,this._shutdownOnce=new wt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(t){this._shutdownOnce.isCalled||this._addToBuffer(t)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let t=this._finishedLogRecords;this._finishedLogRecords=[],this._clearTimer();let r=this._currentExport;for(r!==null&&(await this._exporter.forceFlush(),await r.exportCompleted,this._currentExport=null);t.length>0;){let n;t.length<=this._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,this._maxExportBatchSize);let o=new Co(this._exporter,n,this._exportTimeoutMillis);this._currentExport=o;try{await o.exportScheduled,await this._exporter.forceFlush(),await o.exportCompleted}catch(i){P(i)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let t=this._finishedLogRecords;return this._finishedLogRecords=[],t}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let t=this._extractBatch();if(t===null)return;let r=new Co(this._exporter,t,this._exportTimeoutMillis);this._currentExport=r,r.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(n=>{this._currentExport=null,P(n),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};var ye=class extends Po{_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 Xc="exception";var Ce=Symbol.for("nodejs.util.inspect.custom");function Pe(e){let t={};for(let[r,n]of e.getRawAttributes())typeof n?.then!="function"&&n!=null&&(t[r]??=n);return t}function Ie(e,t,r,n,o){if(typeof r=="number"&&r<0){let s=`[${e}]`;return n?.stylize?n.stylize(s,"special"):s}if(typeof o!="function"||!n)return t;let i={...n,depth:n.depth==null?n.depth:n.depth-1};return`${e} ${o(t,i)}`}var Io=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Y.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let r=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=N.now(),this._performanceOffset=r-(this._performanceStartTime+N.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let n of t.links)this.addLink(n);this.startTime=this._getTime(t.startTime??r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return l.warn(`Invalid attribute key: ${t}`),this;if(!On(r))return l.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:n}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&o?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),o&&this._attributesCount++,this)}setAttributes(t){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.setAttribute(r,t[r]);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return l.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&l.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Cn(r)&&(Cn(n)||(n=r),r=void 0);let i=Ut(r),{attributePerEventCountLimit:s}=this._spanLimits,a={},c=0,u=0;for(let p in i){if(!Object.prototype.hasOwnProperty.call(i,p))continue;let m=i[p];if(s!==void 0&&u>=s){c++;continue}a[p]=this._truncateToSize(m),u++}return this.events.push({name:t,attributes:a,time:this._getTime(n),droppedAttributesCount:c}),this}addLink(t){if(this._isSpanEnded())return this;let{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&l.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,o=Ut(t.attributes),i={},s=0,a=0;for(let u in o){if(!Object.prototype.hasOwnProperty.call(o,u))continue;let p=o[u];if(n!==void 0&&a>=n){s++;continue}i[u]=this._truncateToSize(p),a++}let c={context:t.context};return a>0&&(c.attributes=i),s>0&&(c.droppedAttributesCount=s),this.links.push(c),this}addLinks(t){for(let r of t)this.addLink(r);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===Y.UNSET)return this;if(this.status.code===Y.OK)return this;let r={code:t.code};return t.code===Y.ERROR&&(typeof t.message=="string"?r.message=t.message:t.message!=null&&l.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=r,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){l.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=ar(this.startTime,this.endTime),this._duration[0]<0&&(l.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&l.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&l.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=N.now())return b(t+this._performanceOffset);if(typeof t=="number")return I(t);if(t instanceof Date)return I(t.getTime());if(cr(t))return t;if(this._startTimeProvided)return I(Date.now());let r=N.now()-this._performanceStartTime;return Pn(this.startTime,I(r))}isRecording(){return this._ended===!1}recordException(t,r){let n={};typeof t=="string"?n[J]=t:t&&(t.code?n[nt]=t.code.toString():t.name&&(n[nt]=t.name),t.message&&(n[J]=t.message),t.stack&&(n[Xt]=t.stack)),n[nt]||n[J]?this.addEvent(Xc,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}[Ce](t,r,n){let o={name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Pe(this.resource)}};return Ie("SpanImpl",o,t,r,n)}};var W;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(W||(W={}));var kt=class{shouldSample(){return{decision:W.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};var mt=class{shouldSample(){return{decision:W.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};var Jt=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 kt,this._localParentSampled=t.localParentSampled??new mt,this._localParentNotSampled=t.localParentNotSampled??new kt}shouldSample(t,r,n,o,i,s){let a=S.getSpanContext(t);return!a||!X(a)?this._root.shouldSample(t,r,n,o,i,s):a.isRemote?a.traceFlags&C.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,o,i,s):this._remoteParentNotSampled.shouldSample(t,r,n,o,i,s):a.traceFlags&C.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 Ft=class{_ratio;_upperBound;constructor(t=0){this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:mn(r)&&this._accumulate(r)<this._upperBound?W.RECORD_AND_SAMPLED:W.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<32;n+=8){let o=0;for(let i=0;i<8;i++){let s=t.charCodeAt(n+i),a=s<58?s-48:s<71?s-55:s-87;o=o<<4|a}r=(r^o)>>>0}return r}};var dt;(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"})(dt||(dt={}));var Mo=1;function vo(){return{sampler:ws(),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 ws(){let e=void 0??dt.ParentBasedAlwaysOn;switch(e){case dt.AlwaysOn:return new mt;case dt.AlwaysOff:return new kt;case dt.ParentBasedAlwaysOn:return new Jt({root:new mt});case dt.ParentBasedAlwaysOff:return new Jt({root:new kt});case dt.TraceIdRatio:return new Ft(Yc());case dt.ParentBasedTraceIdRatio:return new Jt({root:new Ft(Yc())});default:return l.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${dt.ParentBasedAlwaysOn}".`),new Jt({root:new mt})}}function Yc(){let e=void 0;return e==null?(l.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Mo}.`),Mo):e<0||e>1?(l.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${Mo}.`),Mo):e}var j_=128,K_=1/0;function qc(e){let t={sampler:ws()},r=vo(),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 Qc(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??j_,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??K_,Object.assign({},e,{spanLimits:t})}var Do=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 wt(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&C.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(jt(E.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(o,a=>{clearTimeout(n),a.code===U.SUCCESS?t():r(a.error??new Error("BatchSpanProcessor: span export failed"))}),s=null;for(let a=0,c=o.length;a<c;a++){let u=o[a];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(s??=[],s.push(u.resource.waitForAsyncAttributes()))}s===null?i():Promise.all(s).then(i,a=>{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 Me=class extends Do{_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 Jc=new Uint8Array(16),Zc=new Uint8Array(8),X_=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tu(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 eu(e){let t="";for(let r=0;r<e.length;r++)t+=X_[e[r]];return t}var ve=class{generateTraceId(){return tu(Jc),eu(Jc)}generateSpanId(){return tu(Zc),eu(Zc)}};var ru="otel.span.parent.origin",Ns="otel.span.sampling_result",nu="otel.sdk.span.live",ou="otel.sdk.span.started";var Uo=class{startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(ou,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(nu,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){let n=q_(r);if(this.startedSpans.add(1,{[ru]:Y_(t),[Ns]:n}),r===W.NOT_RECORD)return()=>{};let o={[Ns]:n};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};function Y_(e){return e?e.isRemote?"remote":"local":"none"}function q_(e){switch(e){case W.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case W.RECORD:return"RECORD_ONLY";case W.NOT_RECORD:return"DROP"}}var iu="2.8.0";var Bo=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,r,n,o){let i=qc(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new ve,this._resource=n,this._spanProcessor=o,this.instrumentationScope=t;let s=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",iu):St();this._tracerMetrics=new Uo(s)}startSpan(t,r={},n=E.active()){r.root&&(n=S.deleteSpan(n));let o=S.getSpan(n);if(Kt(n))return l.debug("Instrumentation suppressed, returning Noop Span"),S.wrapSpanContext(Xe);let i=o?.spanContext(),s=this._idGenerator.generateSpanId(),a,c,u;!i||!S.isSpanContextValid(i)?c=this._idGenerator.generateTraceId():(c=i.traceId,u=i.traceState,a=i);let p=r.kind??Rt.INTERNAL,m=(r.links??[]).map(V=>({context:V.context,attributes:Ut(V.attributes)})),f=Ut(r.attributes),_=this._sampler.shouldSample(n,c,t,p,f,m),d=this._tracerMetrics.startSpan(i,_.decision);u=_.traceState??u;let h=_.decision===se.RECORD_AND_SAMPLED?C.SAMPLED:C.NONE,g={traceId:c,spanId:s,traceFlags:h,traceState:u};if(_.decision===se.NOT_RECORD)return l.debug("Recording is off, propagating context in a non-recording span"),S.wrapSpanContext(g);let L=Ut(Object.assign(f,_.attributes));return new Io({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:g,name:t,kind:p,links:m,parentSpanContext:a,attributes:L,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:d})}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??E.active(),u=this.startSpan(t,i,c),p=S.setSpan(c,u);return E.with(p,a,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}[Ce](t,r,n){let o={instrumentationScope:this.instrumentationScope,resource:{attributes:Pe(this._resource)},spanLimits:this._spanLimits,generalLimits:this._generalLimits};return Ie("Tracer",o,t,r,n)}};var Go=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 Zt;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Zt||(Zt={}));var Cr=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){let r=Xi({},vo(),Qc(t));this._resource=r.resource??qt(),this._config=Object.assign({},r,{resource:this._resource});let n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new Go(n)}getTracer(t,r,n){let o=`${t}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new Bo({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=Zt.timeout},t);n.forceFlush().then(()=>{clearTimeout(s),i!==Zt.timeout&&(i=Zt.resolved,o(i))}).catch(a=>{clearTimeout(s),i=Zt.error,o(a)})}));return new Promise((n,o)=>{Promise.all(r).then(i=>{let s=i.filter(a=>a!==Zt.resolved);s.length>0?o(s):n()}).catch(i=>o([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Ce](t,r,n){let o=this._activeSpanProcessor._spanProcessors,i={resource:{attributes:Pe(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:o.map(s=>s.constructor?.name??"SpanProcessor")};return Ie("BasicTracerProvider",i,t,r,n)}};var Ho=class{_enabled=!1;_currentContext=B;_bindFunction(t=B,r){let n=this,o=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),o}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=B,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=B,this)}with(t,r,n,...o){let i=this._currentContext;this._currentContext=t||B;try{return r.call(n,...o)}finally{this._currentContext=i}}};function Q_(e){if(e!==null){if(e===void 0){let t=new Ho;t.enable(),E.setGlobalContextManager(t);return}e.enable(),E.setGlobalContextManager(e)}}function J_(e){if(e!==null){if(e===void 0){D.setGlobalPropagator(new ur({propagators:[new lr,new er]}));return}D.setGlobalPropagator(e)}}var Pr=class extends Cr{constructor(t={}){super(t)}register(t={}){S.setGlobalTracerProvider(this),J_(t.propagator),Q_(t.contextManager)}};var A;(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"})(A||(A={}));var su="http.response_content_length",au="http.response_content_length_uncompressed";var ys;function Z_(){return ys||(ys=document.createElement("a")),ys}function Nt(e,t){return t in e}function w(e,t,r,n=!0){if(Nt(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[A.START_TIME]!==0),r||(w(e,A.FETCH_START,t,n),w(e,A.DOMAIN_LOOKUP_START,t,n),w(e,A.DOMAIN_LOOKUP_END,t,n),w(e,A.CONNECT_START,t,n),w(e,A.SECURE_CONNECTION_START,t,n),w(e,A.CONNECT_END,t,n),w(e,A.REQUEST_START,t,n),w(e,A.RESPONSE_START,t,n),w(e,A.RESPONSE_END,t,n)),!o){let i=t[A.ENCODED_BODY_SIZE];i!==void 0&&e.setAttribute(su,i);let s=t[A.DECODED_BODY_SIZE];s!==void 0&&i!==s&&e.setAttribute(au,s)}}function cu(e){return e.slice().sort((t,r)=>{let n=t[A.FETCH_START],o=r[A.FETCH_START];return n>o?1:n<o?-1:0})}function uu(){return typeof location<"u"?location.origin:void 0}function Ir(e,t,r,n,o=new WeakSet,i){let s=rt(e);e=s.toString();let a=em(e,t,r,n,o,i);if(a.length===0)return{mainRequest:void 0};if(a.length===1)return{mainRequest:a[0]};let c=cu(a);if(s.origin!==uu()&&c.length>1){let u=c[0],p=tm(c,u[A.RESPONSE_END],r),m=u[A.RESPONSE_END];return p[A.FETCH_START]<m&&(p=u,u=void 0),{corsPreFlightRequest:u,mainRequest:p}}else return{mainRequest:a[0]}}function tm(e,t,r){let n=Z(r),o=Z(lt(t)),i=e[1],s,a=e.length;for(let c=1;c<a;c++){let u=e[c],p=Z(lt(u[A.FETCH_START])),m=Z(lt(u[A.RESPONSE_END])),f=n-m;p>=o&&(!s||f<s)&&(s=f,i=u)}return i}function em(e,t,r,n,o,i){let s=Z(t),a=Z(r),c=n.filter(u=>{let p=Z(lt(u[A.FETCH_START])),m=Z(lt(u[A.RESPONSE_END]));return u.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&u.name===e&&p>=s&&m<=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=Z_();return t.href=e,t}function Vo(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return"/";let r=nm(e,t);if(t&&r.indexOf("@id")>0)return r;let n="";return e.parentNode&&(n+=Vo(e.parentNode,t)),n+=r,n}function rm(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 nm(e,t){let r=e.nodeType,n=rm(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 Mr(e,t){let r=t||[];return(typeof r=="string"||r instanceof RegExp)&&(r=[r]),rt(e).origin===uu()?!0:r.some(o=>Bn(e,o))}function lu(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 pu(e){e.forEach(t=>t.disable())}function Cs(e){let t=e.tracerProvider||S.getTracerProvider(),r=e.meterProvider||xt.getMeterProvider(),n=e.loggerProvider||Dt.getLoggerProvider(),o=e.instrumentations?.flat()??[];return lu(o,t,r,n),()=>{pu(o)}}var F=console.error.bind(console);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 ko=(e,t,r)=>{if(!e||!e[t]){F("no original function "+String(t)+" to wrap");return}if(!r){F("no wrapper function"),F(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){F("original object and wrapper must be functions");return}let o=r(n,t);return vr(o,"__original",n),vr(o,"__unwrap",()=>{e[t]===o&&vr(e,t,n)}),vr(o,"__wrapped",!0),vr(e,t,o),o},Ps=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{F("must provide one or more modules to patch"),F(new Error().stack);return}if(!(t&&Array.isArray(t))){F("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(o=>{ko(n,o,r)})})},Fo=(e,t)=>{if(!e||!e[t]){F("no function to unwrap."),F(new Error().stack);return}let r=e[t];if(!r.__unwrap)F("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},Is=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{F("must provide one or more modules to patch"),F(new Error().stack);return}if(!(t&&Array.isArray(t))){F("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{Fo(r,n)})})};function Dr(e){e&&e.logger&&(typeof e.logger!="function"?F("new logger isn't a function, not replacing"):F=e.logger)}Dr.wrap=ko;Dr.massWrap=Ps;Dr.unwrap=Fo;Dr.massUnwrap=Is;var zo=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=S.getTracer(t,r),this._meter=xt.getMeter(t,r),this._logger=Dt.getLogger(t,r),this._updateMetricInstruments()}_wrap=ko;_unwrap=Fo;_massWrap=Ps;_massUnwrap=Is;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,o){if(t)try{t(n,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}};var M=class extends zo{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}};function yt(e,t,r){let n,o;try{o=e()}catch(i){n=i}finally{if(t(n,o),n&&!r)throw n;return o}}var R;(function(e){e[e.STABLE=1]="STABLE",e[e.OLD=2]="OLD",e[e.DUPLICATE=3]="DUPLICATE"})(R||(R={}));function te(e,t){let r=R.OLD,n=t?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of n??[])if(o.toLowerCase()===e+"/dup"){r=R.DUPLICATE;break}else o.toLowerCase()===e&&(r=R.STABLE);return r}var _u="0.12.0",mu="@opentelemetry/instrumentation-browser-navigation";function Ms(e,t){try{let r=new URL(e,window.location.origin),n=new URL(t,window.location.origin),o=r.origin===n.origin&&r.pathname===n.pathname&&r.search===n.search,i=r.hash!=="",s=n.hash!=="",a=r.hash!==n.hash;return o&&a&&(i&&s||!i&&s)}catch{let r=e.split("#")[0],n=t.split("#")[0],o=e.split("#")[1]||"",i=t.split("#")[1]||"";return r===n&&o!==i&&i!==""}}var du="browser.navigation",hu="browser.navigation.same_document",fu="browser.navigation.hash_change",sm="browser.navigation.type",Ur=class extends M{applyCustomLogRecordData=void 0;_lastUrl=location.href;_hasProcessedInitialLoad=!1;constructor(t){super(mu,_u,t),this.applyCustomLogRecordData=t?.applyCustomLogRecordData,this.sanitizeUrl=t?.sanitizeUrl}init(){}_onHardNavigation(){let t={eventName:du,attributes:{[ot]:this.sanitizeUrl?this.sanitizeUrl(document.documentURI):document.documentURI,[hu]:!1,[fu]:!1}};this._applyCustomLogRecordData(t,this.applyCustomLogRecordData),this.logger.emit(t)}_onSoftNavigation(t,r){let n=this._lastUrl,o=t==="currententrychange"&&r?.target?.currentEntry?.url?r.target.currentEntry.url:location.href;if(n===o)return;let i=this._mapChangeStateToType(t,r),s=this._determineSameDocument(t,r,n,o),a=this._determineHashChange(t,r,n,o),c={eventName:du,attributes:{[ot]:this.sanitizeUrl?this.sanitizeUrl(o):o,[hu]:s,[fu]:a,...i?{[sm]:i}:{}}};this._applyCustomLogRecordData(c,this.applyCustomLogRecordData),this.logger.emit(c),this._lastUrl=o}_waitForPageLoad(){if(document.readyState==="complete"&&!this._hasProcessedInitialLoad){this._hasProcessedInitialLoad=!0,this._onHardNavigation();return}this._onLoadHandler&&document.removeEventListener("DOMContentLoaded",this._onLoadHandler),this._onLoadHandler=()=>{this._hasProcessedInitialLoad||(this._hasProcessedInitialLoad=!0,this._onHardNavigation())},document.addEventListener("DOMContentLoaded",this._onLoadHandler)}enable(){if(this._isEnabled)return;this._isEnabled=!0;let n=!!this.getConfig().useNavigationApiIfAvailable&&window.navigation;!n&&!this._isHistoryPatched&&(this._patchHistoryApi(),this._isHistoryPatched=!0),this._waitForPageLoad(),n?(this._onNavigateHandler&&(n.removeEventListener("currententrychange",this._onNavigateHandler),this._onNavigateHandler=void 0),this._onNavigateHandler=o=>{this._onSoftNavigation("currententrychange",o)},n.addEventListener("currententrychange",this._onNavigateHandler)):(this._onPopStateHandler&&(window.removeEventListener("popstate",this._onPopStateHandler),this._onPopStateHandler=void 0),this._onPopStateHandler=()=>{this._onSoftNavigation("popstate")},window.addEventListener("popstate",this._onPopStateHandler))}disable(){if(this._isEnabled){if(this._isEnabled=!1,this._onLoadHandler&&(document.removeEventListener("DOMContentLoaded",this._onLoadHandler),this._onLoadHandler=void 0),this._onPopStateHandler&&(window.removeEventListener("popstate",this._onPopStateHandler),this._onPopStateHandler=void 0),this._onNavigateHandler){try{window.navigation?.removeEventListener?.("currententrychange",this._onNavigateHandler)}catch{}this._onNavigateHandler=void 0}this._hasProcessedInitialLoad=!1}}_patchHistoryMethod(t){let r=this;return n=>function(...i){if(!r._isEnabled)return n.apply(this,i);let s=n.apply(this,i);return location.href!==r._lastUrl&&r._onSoftNavigation(t),s}}_patchHistoryApi(){this._wrap(history,"replaceState",this._patchHistoryMethod("replaceState")),this._wrap(history,"pushState",this._patchHistoryMethod("pushState"))}_applyCustomLogRecordData(t,r){r&&r(t)}_determineSameDocument(t,r,n,o){if(t==="currententrychange"){if(n&&o)try{let i=new URL(n),s=new URL(o);return i.origin===s.origin}catch{return!0}return!0}if(n&&o)try{let i=new URL(n),s=new URL(o);return i.origin===s.origin}catch{return!0}return!0}_determineHashChange(t,r,n,o){return t==="currententrychange"?n&&o?Ms(n,o):!1:n&&o?Ms(n,o):!1}_mapChangeStateToType(t,r){if(t==="currententrychange"){if(r?.navigationType)switch(r.navigationType){case"traverse":return"traverse";case"replace":return"replace";case"reload":return"reload";case"push":default:return"push"}return"push"}switch(t){case"pushState":return"push";case"replaceState":return"replace";case"popstate":return"traverse";case"hashchange":return"push";case"navigate":return"push";default:return}}};var ee;(function(e){e.DOCUMENT_LOAD="documentLoad",e.DOCUMENT_FETCH="documentFetch",e.RESOURCE_FETCH="resourceFetch"})(ee||(ee={}));var Tu="0.64.0",gu="@opentelemetry/instrumentation-document-load";var $o="http.url",Eu="http.user_agent";var Br;(function(e){e.FIRST_PAINT="firstPaint",e.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"})(Br||(Br={}));var Su=()=>{let e={},t=N.getEntriesByType?.("navigation")[0];if(t)Object.values(A).forEach(n=>{if(Nt(t,n)){let o=t[n];typeof o=="number"&&(e[n]=o)}});else{let n=N.timing;n&&Object.values(A).forEach(i=>{if(Nt(n,i)){let s=n[i];typeof s=="number"&&(e[i]=s)}})}return e},Au={"first-paint":Br.FIRST_PAINT,"first-contentful-paint":Br.FIRST_CONTENTFUL_PAINT},Ru=e=>{let t=N.getEntriesByType?.("paint");t&&t.forEach(({name:r,startTime:n})=>{Nt(Au,r)&&e.addEvent(Au[r],n)})};var Gr=class extends M{component="document-load";version="1";moduleName=this.component;_semconvStability;constructor(t={}){super(gu,Tu,t),this._semconvStability=te("http",t?.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(t){let r=N.getEntriesByType?.("resource");r&&r.forEach(n=>{this._initResourceSpan(n,t)})}_collectPerformance(){let t=Array.from(document.getElementsByTagName("meta")).find(o=>o.getAttribute("name")===ue),r=Su(),n=t&&t.content||"";E.with(D.extract(B,{traceparent:n}),()=>{let o=this._startSpan(ee.DOCUMENT_LOAD,A.FETCH_START,r);o&&(E.with(S.setSpan(E.active(),o),()=>{let i=this._startSpan(ee.DOCUMENT_FETCH,A.FETCH_START,r);i&&(this._semconvStability&R.OLD&&i.setAttribute($o,location.href),this._semconvStability&R.STABLE&&i.setAttribute(ot,location.href),E.with(S.setSpan(E.active(),i),()=>{let s=!(this._semconvStability&R.OLD);ht(i,r,this.getConfig().ignoreNetworkEvents,void 0,s),this._addCustomAttributesOnSpan(i,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(i,A.RESPONSE_END,r)}))}),this._semconvStability&R.OLD&&(o.setAttribute($o,location.href),o.setAttribute(Eu,navigator.userAgent)),this._semconvStability&R.STABLE&&(o.setAttribute(ot,location.href),o.setAttribute(Ga,navigator.userAgent)),this._addResourcesSpans(o),this.getConfig().ignoreNetworkEvents||(w(o,A.FETCH_START,r),w(o,A.UNLOAD_EVENT_START,r),w(o,A.UNLOAD_EVENT_END,r),w(o,A.DOM_INTERACTIVE,r),w(o,A.DOM_CONTENT_LOADED_EVENT_START,r),w(o,A.DOM_CONTENT_LOADED_EVENT_END,r),w(o,A.DOM_COMPLETE,r),w(o,A.LOAD_EVENT_START,r),w(o,A.LOAD_EVENT_END,r)),this.getConfig().ignorePerformancePaintEvents||Ru(o),this._addCustomAttributesOnSpan(o,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(o,A.LOAD_EVENT_END,r))})}_endSpan(t,r,n){t&&(Nt(n,r)?t.end(n[r]):t.end())}_initResourceSpan(t,r){let n=this._startSpan(ee.RESOURCE_FETCH,A.FETCH_START,t,r);if(n){this._semconvStability&R.OLD&&n.setAttribute($o,t.name),this._semconvStability&R.STABLE&&n.setAttribute(ot,t.name);let o=!(this._semconvStability&R.OLD);ht(n,t,this.getConfig().ignoreNetworkEvents,void 0,o),this._addCustomAttributesOnResourceSpan(n,t,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,A.RESPONSE_END,t)}}_startSpan(t,r,n,o){if(Nt(n,r)&&typeof n[r]=="number")return this.tracer.startSpan(t,{startTime:n[r]},o?S.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&&yt(()=>r(t),n=>{n&&this._diag.error("addCustomAttributesOnSpan",n)},!0)}_addCustomAttributesOnResourceSpan(t,r,n){n&&yt(()=>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 Hr;(function(e){e.COMPONENT="component",e.HTTP_STATUS_TEXT="http.status_text"})(Hr||(Hr={}));var xu="http.host",Ou="http.method",Lu="http.request.body.size",bu="http.request_content_length_uncompressed";var wu="http.scheme",Nu="http.status_code",yu="http.url",Cu="http.user_agent";var Pu=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Iu(...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}=am(t.body);return t.body=r,n}else return Promise.resolve(um(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(r=>vs(r)):Promise.resolve()}}function am(e){if(!e.pipeThrough)return Pu.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 cm(e){return typeof Document<"u"&&e instanceof Document}function um(e){if(cm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return vs(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return pm(e);if(e instanceof URLSearchParams)return vs(e.toString());if(e.byteLength!==void 0)return e.byteLength;Pu.warn("unknown body type")}var lm=new TextEncoder;function vs(e){return lm.encode(e).byteLength}function pm(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 Mu(e){let t=mm(),r=e.toUpperCase();return r in t?r:"_OTHER"}var _m={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Vr;function mm(){if(Vr===void 0){let e=void 0;e&&e.length>0?(Vr={},e.forEach(t=>{Vr[t]=!0})):Vr=_m}return Vr}var dm={"https:":"443","http:":"80"};function vu(e){let t=Number(e.port||dm[e.protocol]);if(t&&!isNaN(t))return t}var Ds="0.219.0";var hm=300,Du=typeof PerformanceObserver<"u",kr=class extends M{component="fetch";version=Ds;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-fetch",Ds,t),this._semconvStability=te("http",t?.semconvStabilityOptIn)}init(){}_addChildSpan(t,r){let n=this.tracer.startSpan("CORS Preflight",{startTime:r[A.FETCH_START]},S.setSpan(E.active(),t)),o=!(this._semconvStability&R.OLD);ht(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[A.RESPONSE_END])}_addFinalSpanAttributes(t,r){let n=rt(r.url);if(this._semconvStability&R.OLD&&(t.setAttribute(Nu,r.status),r.statusText!=null&&t.setAttribute(Hr.HTTP_STATUS_TEXT,r.statusText),t.setAttribute(xu,n.host),t.setAttribute(wu,n.protocol.replace(":","")),typeof navigator<"u"&&t.setAttribute(Cu,navigator.userAgent)),this._semconvStability&R.STABLE){t.setAttribute(wn,r.status),t.setAttribute(Nn,n.hostname);let o=vu(n);o&&t.setAttribute(yn,o)}}_addHeaders(t,r){if(!Mr(r,this.getConfig().propagateTraceHeaderCorsUrls)){let n={};D.inject(E.active(),n),Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}if(t instanceof Request)D.inject(E.active(),t.headers,{set:(n,o,i)=>n.set(o,typeof i=="string"?i:String(i))});else{let n=new Headers(t.headers);D.inject(E.active(),n,{set:(o,i,s)=>o.set(i,typeof s=="string"?s:String(s))}),t.headers=n}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,r={}){if(_r(t,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let n="",o={};if(this._semconvStability&R.OLD){let i=(r.method||"GET").toUpperCase();n=`HTTP ${i}`,o[Hr.COMPONENT]=this.moduleName,o[Ou]=i,o[yu]=t}if(this._semconvStability&R.STABLE){let i=r.method,s=Mu(r.method||"GET");n||(n=s),o[Ln]=s,s!==i&&(o[bn]=i),o[ot]=t}return this.tracer.startSpan(n,{kind:Rt.CLIENT,attributes:o})}_findResourceAndAddNetworkEvents(t,r,n){let o=r.entries;if(!o.length){if(!performance.getEntriesByType)return;o=performance.getEntriesByType("resource")}let i=Ir(r.spanUrl,r.startTime,n,o,this._usedResources,"fetch");if(i.mainRequest){let s=i.mainRequest;this._markResourceAsUsed(s);let a=i.corsPreFlightRequest;a&&(this._addChildSpan(t,a),this._markResourceAsUsed(a));let c=!(this._semconvStability&R.OLD);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=b();this._addFinalSpanAttributes(t,n),this._semconvStability&R.STABLE&&n.status>=400&&(t.setStatus({code:Y.ERROR}),t.setAttribute(rr,String(n.status))),setTimeout(()=>{r.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,r,i),this._tasksCount--,this._clearResources(),t.end(o)},hm)}_patchConstructor(){return t=>{let r=this;return function(...o){if(!r._isEnabled)return t.apply(this,o);let i=this,s=rt(o[0]instanceof Request?o[0].url:String(o[0])).href,a;o[0]instanceof Request?a=o[1]!=null?new Request(o[0],o[1]):o[0]:a=o[1]||{};let c=r._createSpan(s,a);if(!c)return t.apply(this,o);let u=r._prepareSpanData(s);r.getConfig().measureRequestSize&&Iu(...o).then(d=>{d&&(r._semconvStability&R.OLD&&c.setAttribute(bu,d),r._semconvStability&R.STABLE&&c.setAttribute(Lu,d))}).catch(d=>{r._diag.warn("getFetchBodyLength",d)});function p(d,h){r._applyAttributesAfterFetch(d,a,h),r._endSpan(d,u,{status:h.status||0,statusText:h.message,url:s})}function m(d,h){r._applyAttributesAfterFetch(d,a,h),h.status>=200&&h.status<400?r._endSpan(d,u,h):r._endSpan(d,u,{status:h.status,statusText:h.statusText,url:s})}function f(d,h){try{let L=h.clone().body;if(L){let $=L.getReader(),V=()=>{$.read().then(({done:x})=>{x?m(d,h):V()},x=>{p(d,x)})};V()}else m(d,h)}catch(g){r._diag.error("Failed to read fetch response body",g),r._endSpan(d,u,{status:0,url:s})}return h}function _(d,h){try{p(d,h)}catch(g){r._diag.error("Failed to end span on fetch error",g),r._endSpan(d,u,{status:h.status||0,url:s})}throw h}return E.with(S.setSpan(E.active(),c),()=>(r._callRequestHook(c,a),r._addHeaders(a,s),r._tasksCount++,t.apply(i,a instanceof Request?[a]:[s,a]).then(f.bind(i,c),_.bind(i,c))))}}}_applyAttributesAfterFetch(t,r,n){let o=this.getConfig().applyCustomAttributesOnSpan;o&&yt(()=>o(t,r,n),i=>{i&&this._diag.error("applyCustomAttributesOnSpan",i)},!0)}_callRequestHook(t,r){let n=this.getConfig().requestHook;n&&yt(()=>n(t,r),o=>{o&&this._diag.error("requestHook",o)},!0)}_prepareSpanData(t){let r=b(),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(!Du){this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()");return}if(!this._isEnabled){if(this._isFetchPatched){this._diag.debug("fetch constructor already patched"),this._isEnabled=!0;return}try{this._wrap(globalThis,"fetch",this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(t){this._diag.warn("Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.",t)}}}disable(){Du&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}};var Us="0.63.0",Uu="@opentelemetry/instrumentation-long-task";var Bs="longtask",Fr=class extends M{version=Us;_observer;constructor(t={}){super(Uu,Us,t)}init(){}isSupported(){return typeof PerformanceObserver>"u"||!PerformanceObserver.supportedEntryTypes?!1:PerformanceObserver.supportedEntryTypes.includes(Bs)}_createSpanFromEntry(t){let r=this.tracer.startSpan(Bs,{startTime:b(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(b(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:Bs,buffered:!0}))}disable(){this._observer&&(this._observer.disconnect(),this._observer=void 0)}};var re;(function(e){e.EVENT_TYPE="event_type",e.TARGET_ELEMENT="target_element",e.TARGET_XPATH="target_xpath",e.HTTP_URL="http.url"})(re||(re={}));var Gs="0.63.0",Bu="@opentelemetry/instrumentation-user-interaction";var fm="OT_ZONE_CONTEXT",Tm="Navigation:",gm=["click"];function Em(){return!1}var zr=class extends M{version=Gs;moduleName="user-interaction";_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(t={}){super(Bu,Gs,t),this._eventNames=new Set(t?.eventNames??gm),this._shouldPreventSpanCreation=typeof t?.shouldPreventSpanCreation=="function"?t.shouldPreventSpanCreation:Em}init(){}_checkForTimeout(t,r){let n=this._spansData.get(r);n&&(t.source==="setTimeout"?n.hrTimeLastTimeout=b():t.source!=="Promise.then"&&t.source!=="setTimeout"&&(n.hrTimeLastTimeout=void 0))}_allowEventName(t){return this._eventNames.has(t)}_createSpan(t,r,n){if(!this._isEnabled||!(t instanceof HTMLElement)||!t.getAttribute||t.hasAttribute("disabled")||!this._allowEventName(r))return;let o=Vo(t,!0);try{let i=this.tracer.startSpan(r,{attributes:{[re.EVENT_TYPE]:r,[re.TARGET_ELEMENT]:t.tagName,[re.TARGET_XPATH]:o,[re.HTTP_URL]:window.location.href}},n?S.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(fm);return r&&S.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,m=u[0],f=m?.target;m&&(p=t._eventsSpanMap.get(m)),a&&t.removePatchedListener(this,o,i);let _=t._createSpan(f,o,p);return _?(m&&t._eventsSpanMap.set(m,_),E.with(S.setSpan(E.active(),_),()=>{let d=t._invokeListener(i,this,u);return _.end(),d})):t._invokeListener(i,this,u)};if(t.addPatchedListener(this,o,i,c))return r.call(this,o,c,s)}}_patchRemoveEventListener(){let t=this;return r=>function(o,i,s){let a=t.removePatchedListener(this,o,i);return a?r.call(this,o,a,s):r.call(this,o,i,s)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._isEnabled&&(this._wrap(history,"replaceState",this._patchHistoryMethod()),this._wrap(history,"pushState",this._patchHistoryMethod()),this._wrap(history,"back",this._patchHistoryMethod()),this._wrap(history,"forward",this._patchHistoryMethod()),this._wrap(history,"go",this._patchHistoryMethod()))}_patchHistoryMethod(){let t=this;return r=>function(...o){if(!t._isEnabled)return r.apply(this,o);let i=`${location.pathname}${location.hash}${location.search}`,s=r.apply(this,o),a=`${location.pathname}${location.hash}${location.search}`;return i!==a&&t._updateInteractionName(a),s}}_updateInteractionName(t){let r=S.getSpan(E.active());r&&typeof r.updateName=="function"&&r.updateName(`${Tm} ${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(S.setSpan(E.active(),u),()=>{let m=Zone.current;return o._zone=m,r.call(m,o,i,s)})}finally{t._decrementTask(u)}})}else u=t._getCurrentSpan(p);try{return r.call(p,o,i,s)}finally{u&&t._shouldCountTask(o,p)&&t._decrementTask(u)}}}_shouldCountTask(t,r){if(t._zone&&(r=t._zone),!r||!t.data||t.data.isPeriodic)return!1;let n=this._getCurrentSpan(r);return!n||!this._spansData.get(n)?!1:t.type==="macroTask"||t.type==="microTask"}_tryToEndSpan(t,r){t&&this._spansData.get(t)&&(t.end(r),this._spansData.delete(t))}enable(){if(this._isEnabled||(this._isEnabled=!0,typeof this._zonePatched=="boolean"))return;let t=this._getZoneWithPrototype();this._diag.debug("applying patch to",this.moduleName,this.version,"zone:",!!t),t?(this._zonePatched=!0,this._wrap(t.prototype,"runTask",this._patchZoneRunTask()),this._wrap(t.prototype,"scheduleTask",this._patchZoneScheduleTask()),this._wrap(t.prototype,"cancelTask",this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(n=>{this._wrap(n,"addEventListener",this._patchAddEventListener()),this._wrap(n,"removeEventListener",this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){this._isEnabled&&(this._isEnabled=!1)}_getZoneWithPrototype(){return window.Zone}};var Gu="http.host",Hu="http.method",Vu="http.request.body.size",ku="http.request_content_length_uncompressed";var Fu="http.scheme",zu="http.status_code",$u="http.url",Wu="http.user_agent";var ft;(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"})(ft||(ft={}));var Am=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function Sm(e){return typeof Document<"u"&&e instanceof Document}function Ku(e){if(Sm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return ju(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return xm(e);if(e instanceof URLSearchParams)return ju(e.toString());if(e.byteLength!==void 0)return e.byteLength;Am.warn("unknown body type")}var Rm=new TextEncoder;function ju(e){return Rm.encode(e).byteLength}function xm(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 Xu(e){let t=Lm(),r=e.toUpperCase();return r in t?r:"_OTHER"}var Om={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},$r;function Lm(){if($r===void 0){let e=void 0;e&&e.length>0?($r={},e.forEach(t=>{$r[t]=!0})):$r=Om}return $r}var bm={"https:":"443","http:":"80"};function Yu(e){let t=Number(e.port||bm[e.protocol]);if(t&&!isNaN(t))return t}var Hs="0.219.0";var Wo;(function(e){e.HTTP_STATUS_TEXT="http.status_text"})(Wo||(Wo={}));var wm=300,Wr=class extends M{component="xml-http-request";version=Hs;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",Hs,t),this._semconvStability=te("http",t?.semconvStabilityOptIn)}init(){}_addHeaders(t,r){let n=rt(r).href;if(!Mr(n,this.getConfig().propagateTraceHeaderCorsUrls)){let i={};D.inject(E.active(),i),Object.keys(i).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}let o={};D.inject(E.active(),o),Object.keys(o).forEach(i=>{t.setRequestHeader(i,String(o[i]))})}_addChildSpan(t,r){E.with(S.setSpan(E.active(),t),()=>{let n=this.tracer.startSpan("CORS Preflight",{startTime:r[A.FETCH_START]}),o=!(this._semconvStability&R.OLD);ht(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[A.RESPONSE_END])})}_addFinalSpanAttributes(t,r,n){if(this._semconvStability&R.OLD){if(r.status!==void 0&&t.setAttribute(zu,r.status),r.statusText!==void 0&&t.setAttribute(Wo.HTTP_STATUS_TEXT,r.statusText),typeof n=="string"){let o=rt(n);t.setAttribute(Gu,o.host),t.setAttribute(Fu,o.protocol.replace(":",""))}t.setAttribute(Wu,navigator.userAgent)}this._semconvStability&R.STABLE&&r.status&&t.setAttribute(wn,r.status)}_applyAttributesAfterXHR(t,r){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n=="function"&&yt(()=>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&&(N.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,r,n,o,i){if(!n||!o||!i||!t.createdResources)return;let s=t.createdResources.entries;(!s||!s.length)&&(s=N.getEntriesByType("resource"));let a=Ir(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&R.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){let o=rt(r);if(_r(o.href,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let i="",s={};if(this._semconvStability&R.OLD&&(i=n.toUpperCase(),s[Hu]=n,s[$u]=o.toString()),this._semconvStability&R.STABLE){let c=n,u=Xu(n);i||(i=u),s[Ln]=u,u!==c&&(s[bn]=c),s[ot]=o.toString(),s[Nn]=o.hostname;let p=Yu(o);p&&(s[yn]=p)}let a=this.tracer.startSpan(i,{kind:Rt.CLIENT,attributes:s});return a.addEvent(ft.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){if(!r._isEnabled)return t.apply(this,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,m,f){let _=p.callbackToRemoveEvents;typeof _=="function"&&_();let{span:d,spanUrl:h,sendStartTime:g}=p;d&&(t._findResourceAndAddNetworkEvents(p,d,h,g,m),d.addEvent(u,f),t._addFinalSpanAttributes(d,p,h),d.end(f),t._tasksCount--),t._clearResources()}function n(u,p,m,f){let _=t._xhrMem.get(p);if(!_)return;if(_.status=p.status,_.statusText=p.statusText,t._xhrMem.delete(p),_.span){let g=_.span;t._applyAttributesAfterXHR(g,p),t._semconvStability&R.STABLE&&(m?f&&(g.setStatus({code:Y.ERROR,message:f}),g.setAttribute(rr,f)):_.status&&_.status>=400&&(g.setStatus({code:Y.ERROR}),g.setAttribute(rr,String(_.status))))}let d=b(),h=Date.now();setTimeout(()=>{r(u,_,d,h)},wm)}function o(){n(ft.EVENT_ERROR,this,!0,"error")}function i(){n(ft.EVENT_ABORT,this,!1)}function s(){n(ft.EVENT_TIMEOUT,this,!0,"timeout")}function a(){this.status<299?n(ft.EVENT_LOAD,this,!1):n(ft.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(...m){if(!t._isEnabled)return u.apply(this,m);let f=t._xhrMem.get(this);if(!f)return u.apply(this,m);let _=f.span,d=f.spanUrl;if(_&&d){if(t.getConfig().measureRequestSize&&m?.[0]){let h=m[0],g=Ku(h);g!==void 0&&(t._semconvStability&R.OLD&&_.setAttribute(ku,g),t._semconvStability&R.STABLE&&_.setAttribute(Vu,g))}E.with(S.setSpan(E.active(),_),()=>{t._tasksCount++,f.sendStartTime=b(),_.addEvent(ft.METHOD_SEND),this.addEventListener("abort",i),this.addEventListener("error",o),this.addEventListener("load",a),this.addEventListener("timeout",s),f.callbackToRemoveEvents=()=>{c(this),f.createdResources&&f.createdResources.observer.disconnect()},t._addHeaders(this,d),t._addResourceObserver(this,d)})}return u.apply(this,m)}}enable(){if(!this._isEnabled){if(this._isXhrPatched){this._diag.debug("reactivating existing patch on",this.moduleName,this.version),this._isEnabled=!0;return}try{this._diag.debug("applying patch to",this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(t){this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.warn("Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.",t)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}};var qu="0.12.0",Qu="@opentelemetry/instrumentation-web-exception";var jr=class extends M{constructor(t={}){super(Qu,qu,t)}init(){}onError(t){let r="exception",n="reason"in t?t.reason:t.error;if(n===void 0)return;let o=Dt.getLoggerProvider().getLogger(this.instrumentationName,this.instrumentationVersion),i=this.getConfig(),s=i.applyCustomAttributes?i.applyCustomAttributes(n):{},a={};typeof n=="string"?a={[J]:n}:a={[nt]:n.name,[J]:n.message,[Xt]:n.stack};let c={eventName:r,severityNumber:Lt.ERROR,attributes:{...a,...s},timestamp:b(),observedTimestamp:b()};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 Ju="0.5.2";var Zu="browser.web_vital",tl="browser.web_vital.name",el="browser.web_vital.value",rl="browser.web_vital.rating",nl="browser.web_vital.delta",ol="browser.web_vital.id",il="browser.web_vital.navigation_type";var Kr;(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"})(Kr||(Kr={}));var Xr=class{emit(t){}enabled(){return!1}},sl=new Xr;var Yr=Symbol.for("io.opentelemetry.js.api.logs"),De=globalThis;function al(e,t,r){return n=>n===e?t:r}var Vs=1;var ks=class{getLogger(t,r,n){return new Xr}},jo=new ks;var Ko=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):sl}};var qr=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new Ko(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:jo}_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 Xo=class e{constructor(){this._proxyLoggerProvider=new qr}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return De[Yr]?this.getLoggerProvider():(De[Yr]=al(Vs,t,jo),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=De[Yr])===null||t===void 0?void 0:t.call(De,Vs))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete De[Yr],this._proxyLoggerProvider=new qr}};var cl=Xo.getInstance();var z=console.error.bind(console);function Qr(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 Yo=(e,t,r)=>{if(!e||!e[t]){z("no original function "+String(t)+" to wrap");return}if(!r){z("no wrapper function"),z(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){z("original object and wrapper must be functions");return}let o=r(n,t);return Qr(o,"__original",n),Qr(o,"__unwrap",()=>{e[t]===o&&Qr(e,t,n)}),Qr(o,"__wrapped",!0),Qr(e,t,o),o},Fs=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{z("must provide one or more modules to patch"),z(new Error().stack);return}if(!(t&&Array.isArray(t))){z("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(o=>{Yo(n,o,r)})})},qo=(e,t)=>{if(!e||!e[t]){z("no function to unwrap."),z(new Error().stack);return}let r=e[t];if(!r.__unwrap)z("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},zs=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{z("must provide one or more modules to patch"),z(new Error().stack);return}if(!(t&&Array.isArray(t))){z("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{qo(r,n)})})};function Jr(e){e&&e.logger&&(typeof e.logger!="function"?z("new logger isn't a function, not replacing"):z=e.logger)}Jr.wrap=Yo;Jr.massWrap=Fs;Jr.unwrap=qo;Jr.massUnwrap=zs;var Qo=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=S.getTracer(t,r),this._meter=xt.getMeter(t,r),this._logger=cl.getLogger(t,r),this._updateMetricInstruments()}_wrap=Yo;_unwrap=qo;_massWrap=Fs;_massUnwrap=zs;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 Ue=class extends Qo{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}};function $s(e,t,r){let n,o;try{o=e()}catch(i){n=i}finally{if(t(n,o),n&&!r)throw n;return o}}var Zo=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)}},Ve=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ti=e=>{if(document.readyState==="loading")return"loading";let t=Ve();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"},ym=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Qs=e=>{let t="";try{for(;e?.nodeType!==9;){let r=e,n=r.id?"#"+r.id:[ym(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},Ws=new WeakMap;function Ge(e,t){return Ws.get(e)||Ws.set(e,new t),Ws.get(e)}var gl=-1,El=()=>gl,ke=e=>{addEventListener("pageshow",t=>{t.persisted&&(gl=t.timeStamp,e(t))},!0)},Tt=(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)))}},Js=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Zr=()=>Ve()?.activationStart??0,gt=(e,t=-1)=>{let r=Ve(),n="navigate";return El()>=0?n="back-forward-cache":r&&(document.prerendering||Zr()>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}},He=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver(o=>{queueMicrotask(()=>{t(o.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},Zs=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Be=-1,Al=new Set,ul=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Ks=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of Al)t();isFinite(Be)||(Be=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",Ks,!0))}},ni=()=>{if(Be<0){let e=Zr();Be=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(r=>r.name==="hidden"&&r.startTime>=e)?.startTime)??ul(),addEventListener("visibilitychange",Ks,!0),addEventListener("prerenderingchange",Ks,!0),ke(()=>{setTimeout(()=>{Be=ul()})})}return{get firstHiddenTime(){return Be},onHidden(e){Al.add(e)}}},oi=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},ll=[1800,3e3],Sl=(e,t={})=>{oi(()=>{let r=ni(),n,o=gt("FCP"),i=He("paint",s=>{for(let a of s)a.name==="first-contentful-paint"&&(i.disconnect(),a.startTime<r.firstHiddenTime&&(o.value=Math.max(a.startTime-Zr(),0),o.entries.push(a),n(!0)))});i&&(n=Tt(e,o,ll,t.reportAllChanges),ke(s=>{o=gt("FCP"),n=Tt(e,o,ll,t.reportAllChanges),Js(()=>{o.value=performance.now()-s.timeStamp,n(!0)})}))})},pl=[.1,.25],_l=e=>e.find(t=>t.node?.nodeType===1)||e[0],Rl=(e,t={})=>{let r=Ge(t=Object.assign({},t),Zo),n=new WeakMap;r.t=o=>{if(o?.sources?.length){let i=_l(o.sources),s=i?.node;if(s){let a=t.generateTarget?.(s)??Qs(s);n.set(i,a)}}},((o,i={})=>{let s=ni();Sl(Zs(()=>{let a,c=gt("CLS",0),u=Ge(i,Zo),p=f=>{for(let _ of f)u.u(_);u.o>c.value&&(c.value=u.o,c.entries=u.i,a())},m=He("layout-shift",p);m&&(a=Tt(o,c,pl,i.reportAllChanges),s.onHidden(()=>{p(m.takeRecords()),a(!0)}),ke(()=>{u.o=0,c=gt("CLS",0),a=Tt(o,c,pl,i.reportAllChanges),Js(a)}),setTimeout(a))}))})(o=>{e((i=>{let s={};if(i.entries.length){let a=i.entries.reduce((c,u)=>c.value>u.value?c:u);if(a?.sources?.length){let c=_l(a.sources);c&&(s={largestShiftTarget:n.get(c),largestShiftTime:a.startTime,largestShiftValue:a.value,largestShiftSource:c,largestShiftEntry:a,loadState:ti(a.startTime)})}}return Object.assign(i,{attribution:s})})(o))},t)},xl=(e,t={})=>{Sl(r=>{e((n=>{let o={timeToFirstByte:0,firstByteToFCP:n.value,loadState:ti(El())};if(n.entries.length){let i=Ve(),s=n.entries.at(-1);if(i){let a=i.activationStart||0,c=Math.max(0,i.responseStart-a);o={timeToFirstByte:c,firstByteToFCP:n.value-c,loadState:ti(n.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}return Object.assign(n,{attribution:o})})(r))},t)},Ol=0,js=1/0,Jo=0,Cm=e=>{for(let t of e)t.interactionId&&(js=Math.min(js,t.interactionId),Jo=Math.max(Jo,t.interactionId),Ol=Jo?(Jo-js)/7+1:0)},Xs,ml=()=>Xs?Ol:performance.interactionCount??0,Pm=()=>{"interactionCount"in performance||Xs||(Xs=He("event",Cm,{durationThreshold:0}))},dl=0,ei=class{l=[];h=new Map;m;p;v(){dl=ml(),this.l.length=0,this.h.clear()}M(){let t=Math.min(this.l.length-1,Math.floor((ml()-dl)/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)}}},Ys=e=>{let t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let n=Zs(e),o=-1,i=()=>{r(o),n()};addEventListener("visibilitychange",i,{once:!0,capture:!0}),o=t(()=>{removeEventListener("visibilitychange",i,{capture:!0}),n()})}},hl=[200,500],Ll=(e,t={})=>{let r=Ge(t=Object.assign({},t),ei),n=[],o=[],i=0,s=new WeakMap,a=new WeakMap,c=!1,u=()=>{c||(Ys(p),c=!0)},p=()=>{let _=new Set(r.l.map(g=>s.get(g.entries[0]))),d=o.length-10;o=o.filter((g,L)=>L>=d||_.has(g));let h=new Set;for(let g of o){let L=m(g.startTime,g.processingEnd);for(let $ of L)h.add($)}n=n.filter(g=>g.startTime>i||h.has(g)),c=!1};r.m=_=>{let d=_.startTime+_.duration,h;i=Math.max(i,_.processingEnd);for(let g=o.length-1;g>=0;g--){let L=o[g];if(Math.abs(d-L.renderTime)<=8){h=L,h.startTime=Math.min(_.startTime,h.startTime),h.processingStart=Math.min(_.processingStart,h.processingStart),h.processingEnd=Math.max(_.processingEnd,h.processingEnd),t.includeProcessedEventEntries!==!1&&h.entries.push(_);break}}h||(h={startTime:_.startTime,processingStart:_.processingStart,processingEnd:_.processingEnd,renderTime:d,entries:t.includeProcessedEventEntries!==!1?[_]:[]},o.push(h)),(_.interactionId||_.entryType==="first-input")&&s.set(_,h),u()},r.p=_=>{if(!a.get(_)){let d=_.entries[0].target;if(d){let h=t.generateTarget?.(d)??Qs(d);a.set(_,h)}}};let m=(_,d)=>{let h=[];for(let g of n)if(!(g.startTime+g.duration<_)){if(g.startTime>d)break;h.push(g)}return h},f=_=>{let d=_.entries[0],h=s.get(d),g=d.processingStart,L=Math.max(d.startTime+d.duration,g),$=Math.min(h.processingEnd,L),V=h.entries.sort((v,vt)=>v.processingStart-vt.processingStart),x=m(d.startTime,$),It=r.h.get(d.interactionId),Mt={interactionTarget:a.get(It),interactionType:d.name.startsWith("key")?"keyboard":"pointer",interactionTime:d.startTime,nextPaintTime:L,processedEventEntries:V,longAnimationFrameEntries:x,inputDelay:g-d.startTime,processingDuration:$-g,presentationDelay:L-$,loadState:ti(d.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(v=>{if(!v.longAnimationFrameEntries?.length)return;let vt=v.interactionTime,ui=v.inputDelay,ra=v.processingDuration,li,pi,_i=0,ze=0,mi=0,di=0;for(let rn of v.longAnimationFrameEntries){ze=ze+rn.startTime+rn.duration-rn.styleAndLayoutStart;for(let Et of rn.scripts){let oa=Et.startTime+Et.duration;if(oa<vt)continue;let nn=oa-Math.max(vt,Et.startTime),ia=Et.duration?nn/Et.duration*Et.forcedStyleAndLayoutDuration:0;_i+=nn-ia,ze+=ia,nn>di&&(pi=Et.startTime<vt+ui?"input-delay":Et.startTime>=vt+ui+ra?"presentation-delay":"processing-duration",li=Et,di=nn)}}let hi=v.longAnimationFrameEntries.at(-1),na=hi?hi.startTime+hi.duration:0;na>=vt+ui+ra&&(mi=v.nextPaintTime-na),li&&pi&&(v.longestScript={entry:li,subpart:pi,intersectingDuration:di}),v.totalScriptDuration=_i,v.totalStyleAndLayoutDuration=ze,v.totalPaintDuration=mi,v.totalUnattributedDuration=v.nextPaintTime-vt-_i-ze-mi})(Mt),Object.assign(_,{attribution:Mt})};He("long-animation-frame",_=>{n=n.concat(_),u()}),((_,d={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let h=ni();oi(()=>{Pm();let g,L=gt("INP"),$=Ge(d,ei),V=It=>{Ys(()=>{for(let v of It)$.u(v);let Mt=$.M();Mt&&Mt.T!==L.value&&(L.value=Mt.T,L.entries=Mt.entries,g())})},x=He("event",V,{durationThreshold:d.durationThreshold??40});g=Tt(_,L,hl,d.reportAllChanges),x&&(x.observe({type:"first-input",buffered:!0}),h.onHidden(()=>{V(x.takeRecords()),g(!0)}),ke(()=>{$.v(),L=gt("INP"),g=Tt(_,L,hl,d.reportAllChanges)}))})})(_=>{e(f(_))},t)},ri=class{m;u(t){this.m?.(t)}},fl=[2500,4e3],bl=(e,t={})=>{let r=Ge(t=Object.assign({},t),ri),n=new WeakMap;r.m=o=>{let i=o.element;if(i){let s=t.generateTarget?.(i)??Qs(i);n.set(o,s)}else o.id&&n.set(o,`#${o.id}`)},((o,i={})=>{oi(()=>{let s=ni(),a,c=gt("LCP"),u=Ge(i,ri),p=f=>{i.reportAllChanges||(f=f.slice(-1));for(let _ of f)u.u(_),_.startTime<s.firstHiddenTime&&(c.value=Math.max(_.startTime-Zr(),0),c.entries=[_],a())},m=He("largest-contentful-paint",p);if(m){a=Tt(o,c,fl,i.reportAllChanges);let f=Zs(()=>{p(m.takeRecords()),m.disconnect(),a(!0)}),_=d=>{d.isTrusted&&(Ys(f),removeEventListener(d.type,_,{capture:!0}))};for(let d of["keydown","click","visibilitychange"])addEventListener(d,_,{capture:!0});ke(d=>{c=gt("LCP"),a=Tt(o,c,fl,i.reportAllChanges),Js(()=>{c.value=performance.now()-d.timeStamp,a(!0)})})}})})(o=>{e((i=>{let s={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:i.value};if(i.entries.length){let a=i.entries.at(-1),c=a.url&&performance.getEntriesByType("resource").find(p=>p.name===a.url);s.target=n.get(a),s.lcpEntry=a,a.url&&(s.url=a.url),c&&(s.lcpResourceEntry=c);let u=Ve();if(u){let p=u.activationStart||0,m=Math.max(0,u.responseStart-p),f=Math.max(m,c?(c.requestStart||c.startTime)-p:0),_=Math.min(i.value,Math.max(f,c?c.responseEnd-p:0));s={...s,timeToFirstByte:m,resourceLoadDelay:f-m,resourceLoadDuration:_-f,elementRenderDelay:i.value-_,navigationEntry:u}}}return Object.assign(i,{attribution:s})})(o))},t)},Tl=[800,1800],qs=e=>{document.prerendering?oi(()=>qs(e)):document.readyState!=="complete"?addEventListener("load",()=>qs(e),!0):setTimeout(e)},wl=(e,t={})=>{((r,n={})=>{let o=gt("TTFB"),i=Tt(r,o,Tl,n.reportAllChanges);qs(()=>{let s=Ve();s&&(o.value=Math.max(s.responseStart-Zr(),0),o.entries=[s],i(!0),ke(()=>{o=gt("TTFB",0),i=Tt(r,o,Tl,n.reportAllChanges),i(!0)}))})})(r=>{e((n=>{let o={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(n.entries.length){let i=n.entries[0],s=i.activationStart||0,a=Math.max((i.workerStart||i.fetchStart)-s,0),c=Math.max(i.domainLookupStart-s,0),u=Math.max(i.connectStart-s,0),p=Math.max(i.connectEnd-s,0);o={waitingDuration:a,cacheDuration:c-a,dnsDuration:u-c,connectionDuration:p-u,requestDuration:n.value-p,navigationEntry:i}}return Object.assign(n,{attribution:o})})(r))},t)};var ta=class extends Ue{_applyCustomLogRecordData;_includeRawAttribution;constructor(e={}){super("@opentelemetry/browser-instrumentation/web-vitals",Ju,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"),Rl(e=>this._emitWebVital(e)),Ll(e=>this._emitWebVital(e)),bl(e=>this._emitWebVital(e)),xl(e=>this._emitWebVital(e)),wl(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={[tl]:e.name.toLowerCase(),[el]:e.value,[nl]:e.delta,[rl]:e.rating,[ol]:e.id,[il]:e.navigationType},r=this._getTimestampForMetric(e),n={eventName:Zu,severityNumber:Kr.INFO,attributes:t,...this._includeRawAttribution?{body:JSON.stringify(e.attribution)}:{},...r!==void 0?{timestamp:r}:{}};this._applyCustomLogRecordData&&$s(()=>this._applyCustomLogRecordData?.(n),o=>{o&&this._diag.error("applyCustomLogRecordData hook failed",o)},!0),this.logger.emit(n)}};var ii=O.INFO,zt={ALL:O.ALL,VERBOSE:O.VERBOSE,DEBUG:O.DEBUG,INFO:O.INFO,WARN:O.WARN,ERROR:O.ERROR,NONE:O.NONE};function si(e){return ii=zt[e.logLevel.toUpperCase()],ii==null&&(console.warn(`Unknown log level "${e.logLevel}", expected one of ${Object.keys(zt)}, using default`),ii=zt.INFO),{error:tn(zt.ERROR,console.error.bind(console)),warn:tn(zt.WARN,console.error.bind(console)),info:tn(zt.INFO,console.log.bind(console)),debug:tn(zt.DEBUG,console.log.bind(console)),verbose:tn(zt.VERBOSE,console.trace.bind(console))}}function tn(e,t){return function(...n){let o=ii>=e;if(n.length===0)return o;o&&t(...n)}}var ne=si({logLevel:"warn"}),Fe=B,ai=!1,yl={active:function(){return Fe},with:function(e,t,r,...n){let o=Fe;Fe=e||B;try{return t.call(r,...n)}finally{Fe=o}},bind:function(e,t){return typeof t=="function"?Ct(t,this,e):t},enable:function(){if(ai)return this;let e=this;return Pt(window,"setTimeout",t=>function(...r){let n=Number(r[1]);return(isNaN(n)||n<=50)&&(r[0]=Ct(r[0],e,e.active())),t.apply(this,r)}),Pt(window,"setImmediate",t=>function(...r){return r[0]=Ct(r[0],e,e.active()),t.apply(this,r)}),vm(e),window.Promise&&Im(e),Fe=B,ai=!0,e},disable:function(){return ai&&(it(window,"setTimeout"),it(window,"setImmediate"),Dm(),window.Promise&&Mm(),Fe=B,ai=!1),this}};function Ct(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 Im(e){Pt(Promise.prototype,"then",t=>function(r,n){return t.call(this,Ct(r,e,e.active()),Ct(n,e,e.active()))}),Pt(Promise.prototype,"catch",t=>function(r){return t.call(this,Ct(r,e,e.active()))}),Pt(Promise.prototype,"finally",t=>function(r){return t.call(this,Ct(r,e,e.active()))})}function Mm(){it(Promise.prototype,"then"),it(Promise.prototype,"catch"),it(Promise.prototype,"finally")}var Cl=["onreadystatechange"],$t=globalThis.XMLHttpRequest.prototype,Pl=["onabort","onerror","onload","onloadend","onloadstart","onprogress","ontimeout"],ci=globalThis.XMLHttpRequestEventTarget.prototype;function vm(e){Pt($t,"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||Ct(o,e,e.active()),n.__bound.set(o,r[1])}return t.apply(n,r)}}),Pt($t,"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 Cl){let r=Object.getOwnPropertyDescriptor($t,t);r&&(Nl(r,e),Object.defineProperty($t,t,r))}for(let t of Pl){let r=Object.getOwnPropertyDescriptor(ci,t);r&&(Nl(r,e),Object.defineProperty(ci,t,r))}}function Dm(){it($t,"addEventListener"),it($t,"removeEventListener");for(let e of Cl){let t=Object.getOwnPropertyDescriptor($t,e);t&&(it(t,"set"),it(t,"get"),Object.defineProperty($t,e,t))}for(let e of Pl){let t=Object.getOwnPropertyDescriptor(ci,e);t&&(it(t,"set"),it(t,"get"),Object.defineProperty(ci,e,t))}}function Pt(e,t,r){if(!e||!e[t]){ne.warn("no original function "+String(t)+" to wrap");return}if(!r){ne.warn("no wrapper function"),ne.warn(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){ne.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)),en(o,"__original",n),en(o,"__unwrap",()=>{e[t]===o&&en(e,t,n)}),en(o,"__wrapped",!0),en(e,t,o),o}function it(e,t){if(!e||!e[t]){ne.warn("no function to unwrap."),ne.warn(new Error().stack);return}let r=e[t];if(!r.__unwrap)ne.warn(`no original to unwrap to -- has ${String(t)} already been unwrapped?`);else{r.__unwrap();return}}function Nl(e,t){Pt(e,"set",function(r){return function(n){if(typeof n=="function"){let o=n;n=Ct(o,t,t.active()),n.__original=o}return r.call(this,n)}}),Pt(e,"get",function(r){return function(){let n=r.call(this);return typeof n=="function"&&n.__original?n.__original:n}})}function en(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 Il="browser.brands",Ml="browser.language",vl="browser.mobile",Dl="browser.platform";var Ul="user_agent.original";var Bl="0.3.0";function Gl(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=Bm(n),s;return o?(s={name:o.platform,version:""},e[Il]=o.brands.map(a=>`${a.brand} ${a.version}`)):s=Um(n),i&&(e["browser.name"]=i.name,i.version&&(e["browser.version"]=i.version)),s&&(e[Dl]=s.name),e[vl]=navigator.userAgent.includes("Mobi"),e[Ml]=navigator.language,e[Ul]=n,e["telemetry.distro.name"]="elastic",e["telemetry.distro.version"]=Bl,Kn({...e,...Bt})}function Um(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 Bm(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 Hl=!1,Vl={logLevel:"info",sampleRate:1,serviceName:"unknown_service:web",resourceAttributes:{},otlpEndpoint:"http://localhost:4318",exportHeaders:{}};function kl(e={}){if(Hl||e.disabled)return;let t=e.logLevel??Vl.logLevel;l.setLogger(si({logLevel:t}),{logLevel:O.ALL}),l.debug("Browser SDK intialization",e);let{serviceName:r,serviceVersion:n}=e,o={...Vl,...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=Gl(o.resourceAttributes,r,n),a=ea(i,"v1/traces").href,c=new Me(new Ne({url:a,headers:o.exportHeaders})),u=new Pr({resource:s,sampler:new Ft(o.sampleRate),spanProcessors:[c]});u.register({contextManager:yl});let p=ea(i,"v1/metrics").href,m=new xr({exporter:new we({url:p,headers:o.exportHeaders})}),f=new Lr({resource:s,readers:[m]});xt.setGlobalMeterProvider(f);let _=ea(i,"v1/logs").href,d=new ye(new be({url:_,headers:o.exportHeaders})),h=new yr({resource:s,processors:[d]});Dt.setGlobalLoggerProvider(h);let g={"@opentelemetry/instrumentation-browser-navigation":x=>new Ur(x),"@opentelemetry/instrumentation-document-load":x=>new Gr(x),"@opentelemetry/instrumentation-fetch":x=>new kr(x),"@opentelemetry/instrumentation-long-task":x=>new Fr(x),"@opentelemetry/instrumentation-user-interaction":x=>new zr(x),"@opentelemetry/instrumentation-xml-http-request":x=>new Wr(x),"@opentelemetry/instrumentation-web-exception":x=>new jr(x),"@opentelemetry/instrumentation-web-vitals":x=>new ta(x)},L={semconvStabilityOptIn:"http"},$=o.instrumentations||{},V=[];for(let x of Object.keys(g)){let It=$[x];(x==="@opentelemetry/instrumentation-fetch"||x==="@opentelemetry/instrumentation-xml-http-request")&&(It={...L,...It}),It?.enabled===!1||V.push(g[x](It))}return Cs({instrumentations:V}),Hl=!0,{forceFlush(){return Promise.all([u.forceFlush(),f.forceFlush(),h.forceFlush()]).then(()=>{})}}}function ea(e,t){let r=new URL(e.href);return r.pathname=(r.pathname+t).replace("//","/"),r}globalThis.startBrowserSdk=kl;})();
|
|
14
14
|
//# sourceMappingURL=elastic-otel-browser.min.js.map
|