!function(t){"use strict";const e="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},n="1.1.0",r=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;const s=function(t){const e=new Set([t]),n=new Set,s=t.match(r);if(!s)return()=>!1;const i=+s[1],o=+s[2],a=+s[3];if(null!=s[4])return function(e){return e===t};function c(t){return n.add(t),!1}function u(t){return e.add(t),!0}return function(t){if(e.has(t))return!0;if(n.has(t))return!1;const s=t.match(r);if(!s)return c(t);const l=+s[1],d=+s[2],h=+s[3];return null!=s[4]||i!==l?c(t):0===i?o===d&&a<=h?u(t):c(t):o<=d?u(t):c(t)}}(n),i=n.split(".")[0],o=Symbol.for(`opentelemetry.js.api.${i}`),a=e;function c(t,e,r,s=!1){var i;const c=a[o]=null!==(i=a[o])&&void 0!==i?i:{version:n};if(!s&&c[t]){const e=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return r.error(e.stack||e.message),!1}if(c.version!==n){const t=new Error("@opentelemetry/api: All API registration versions must match");return r.error(t.stack||t.message),!1}return c[t]=e,r.debug(`@opentelemetry/api: Registered a global for ${t} v1.1.0.`),!0}function u(t){var e,n;const r=null===(e=a[o])||void 0===e?void 0:e.version;if(r&&s(r))return null===(n=a[o])||void 0===n?void 0:n[t]}function l(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v1.1.0.`);const n=a[o];n&&delete n[t]}class d{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return h("debug",this._namespace,t)}error(...t){return h("error",this._namespace,t)}info(...t){return h("info",this._namespace,t)}warn(...t){return h("warn",this._namespace,t)}verbose(...t){return h("verbose",this._namespace,t)}}function h(t,e,n){const r=u("diag");if(r)return n.unshift(e),r[t](...n)}var p;!function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"}(p||(p={}));class _{constructor(){function t(t){return function(...e){const n=u("diag");if(n)return n[t](...e)}}const e=this;e.setLogger=(t,n=p.INFO)=>{var r,s;if(t===e){const t=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error(null!==(r=t.stack)&&void 0!==r?r:t.message),!1}const i=u("diag"),o=function(t,e){function n(n,r){const s=e[n];return"function"==typeof s&&t>=r?s.bind(e):function(){}}return t
p.ALL&&(t=p.ALL),e=e||{},{error:n("error",p.ERROR),warn:n("warn",p.WARN),info:n("info",p.INFO),debug:n("debug",p.DEBUG),verbose:n("verbose",p.VERBOSE)}}(n,t);if(i){const t=null!==(s=(new Error).stack)&&void 0!==s?s:"";i.warn(`Current logger will be overwritten from ${t}`),o.warn(`Current logger will overwrite one already registered from ${t}`)}return c("diag",o,e,!0)},e.disable=()=>{l("diag",e)},e.createComponentLogger=t=>new d(t),e.verbose=t("verbose"),e.debug=t("debug"),e.info=t("info"),e.warn=t("warn"),e.error=t("error")}static instance(){return this._instance||(this._instance=new _),this._instance}}class E{constructor(t){this._entries=t?new Map(t):new Map}getEntry(t){const e=this._entries.get(t);if(e)return Object.assign({},e)}getAllEntries(){return Array.from(this._entries.entries()).map((([t,e])=>[t,e]))}setEntry(t,e){const n=new E(this._entries);return n._entries.set(t,e),n}removeEntry(t){const e=new E(this._entries);return e._entries.delete(t),e}removeEntries(...t){const e=new E(this._entries);for(const n of t)e._entries.delete(n);return e}clear(){return new E}}const m=Symbol("BaggageEntryMetadata"),f=_.instance();function g(t={}){return new E(new Map(Object.entries(t)))}function T(t){return"string"!=typeof t&&(f.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:m,toString:()=>t}}const S=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];const v={get(t,e){if(null!=t)return t[e]},keys:t=>null==t?[]:Object.keys(t)},b={set(t,e,n){null!=t&&(t[e]=n)}};function R(t){return Symbol.for(t)}class A{constructor(t){const e=this;e._currentContext=t?new Map(t):new Map,e.getValue=t=>e._currentContext.get(t),e.setValue=(t,n)=>{const r=new A(e._currentContext);return r._currentContext.set(t,n),r},e.deleteValue=t=>{const n=new A(e._currentContext);return n._currentContext.delete(t),n}}}const y=new A;const O="context",N=new class{active(){return y}with(t,e,n,...r){return e.call(n,...r)}bind(t,e){return e}enable(){return this}disable(){return this}};class w{constructor(){}static getInstance(){return this._instance||(this._instance=new w),this._instance}setGlobalContextManager(t){return c(O,t,_.instance())}active(){return this._getContextManager().active()}with(t,e,n,...r){return this._getContextManager().with(t,e,n,...r)}bind(t,e){return this._getContextManager().bind(t,e)}_getContextManager(){return u(O)||N}disable(){this._getContextManager().disable(),l(O,_.instance())}}var L;!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(L||(L={}));const P="0000000000000000",I="00000000000000000000000000000000",C={traceId:I,spanId:P,traceFlags:L.NONE};class M{constructor(t=C){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,e){return this}setAttributes(t){return this}addEvent(t,e){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,e){}}const D=R("OpenTelemetry Context Key SPAN");function U(t){return t.getValue(D)||void 0}function x(t,e){return t.setValue(D,e)}function B(t){return t.deleteValue(D)}function k(t,e){return x(t,new M(e))}function V(t){var e;return null===(e=U(t))||void 0===e?void 0:e.spanContext()}const F=/^([0-9a-f]{32})$/i,j=/^[0-9a-f]{16}$/i;function H(t){return F.test(t)&&t!==I}function G(t){return j.test(t)&&t!==P}function Y(t){return H(t.traceId)&&G(t.spanId)}function $(t){return new M(t)}const X=w.getInstance();class z{startSpan(t,e,n){if(Boolean(null==e?void 0:e.root))return new M;const r=n&&V(n);return"object"==typeof(s=r)&&"string"==typeof s.spanId&&"string"==typeof s.traceId&&"number"==typeof s.traceFlags&&Y(r)?new M(r):new M;var s}startActiveSpan(t,e,n,r){let s,i,o;if(arguments.length<2)return;2===arguments.length?o=e:3===arguments.length?(s=e,o=n):(s=e,i=n,o=r);const a=null!=i?i:X.active(),c=this.startSpan(t,s,a),u=x(a,c);return X.with(u,o,void 0,c)}}const W=new z;class q{constructor(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}startSpan(t,e,n){return this._getTracer().startSpan(t,e,n)}startActiveSpan(t,e,n,r){const s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;const t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):W}}const K=new class{getTracer(t,e,n){return new z}};class Q{getTracer(t,e,n){var r;return null!==(r=this.getDelegateTracer(t,e,n))&&void 0!==r?r:new q(this,t,e,n)}getDelegate(){var t;return null!==(t=this._delegate)&&void 0!==t?t:K}setDelegate(t){this._delegate=t}getDelegateTracer(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getTracer(t,e,n)}}var Z,J,tt;!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(Z||(Z={})),function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"}(J||(J={})),function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"}(tt||(tt={}));const et=new RegExp("^(?:[a-z][_0-9a-z-*/]{0,255}|[a-z0-9][_0-9a-z-*/]{0,240}@[a-z][_0-9a-z-*/]{0,13})$"),nt=/^[ -~]{0,255}[!-~]$/,rt=/,|=/;class st{constructor(t){this._internalState=new Map,t&&this._parse(t)}set(t,e){const n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n}unset(t){const e=this._clone();return e._internalState.delete(t),e}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce(((t,e)=>(t.push(e+"="+this.get(e)),t)),[]).join(",")}_parse(t){t.length>512||(this._internalState=t.split(",").reverse().reduce(((t,e)=>{const n=e.trim(),r=n.indexOf("=");if(-1!==r){const s=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return et.test(t)})(s)&&function(t){return nt.test(t)&&!rt.test(t)}(i)&&t.set(s,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const t=new st;return t._internalState=new Map(this._internalState),t}}const it="trace";class ot{constructor(){this._proxyTracerProvider=new Q,this.wrapSpanContext=$,this.isSpanContextValid=Y,this.deleteSpan=B,this.getSpan=U,this.getSpanContext=V,this.setSpan=x,this.setSpanContext=k}static getInstance(){return this._instance||(this._instance=new ot),this._instance}setGlobalTracerProvider(t){const e=c(it,this._proxyTracerProvider,_.instance());return e&&this._proxyTracerProvider.setDelegate(t),e}getTracerProvider(){return u(it)||this._proxyTracerProvider}getTracer(t,e){return this.getTracerProvider().getTracer(t,e)}disable(){l(it,_.instance()),this._proxyTracerProvider=new Q}}const at=R("OpenTelemetry Baggage Key");function ct(t){return t.getValue(at)||void 0}function ut(t,e){return t.setValue(at,e)}function lt(t){return t.deleteValue(at)}const dt="propagation",ht=new class{inject(t,e){}extract(t,e){return t}fields(){return[]}};class pt{constructor(){this.createBaggage=g,this.getBaggage=ct,this.setBaggage=ut,this.deleteBaggage=lt}static getInstance(){return this._instance||(this._instance=new pt),this._instance}setGlobalPropagator(t){return c(dt,t,_.instance())}inject(t,e,n=b){return this._getGlobalPropagator().inject(t,e,n)}extract(t,e,n=v){return this._getGlobalPropagator().extract(t,e,n)}fields(){return this._getGlobalPropagator().fields()}disable(){l(dt,_.instance())}_getGlobalPropagator(){return u(dt)||ht}}const _t=w.getInstance(),Et=ot.getInstance(),mt=pt.getInstance(),ft=_.instance();var gt={trace:Et,context:_t,propagation:mt,diag:ft},Tt=Object.freeze({__proto__:null,context:_t,trace:Et,propagation:mt,diag:ft,default:gt,baggageEntryMetadataFromString:T,createTraceState:function(t){return new st(t)},isSpanContextValid:Y,isValidTraceId:H,isValidSpanId:G,INVALID_SPANID:P,INVALID_TRACEID:I,INVALID_SPAN_CONTEXT:C,DiagConsoleLogger:class{constructor(){function t(t){return function(...e){if(console){let n=console[t];if("function"!=typeof n&&(n=console.log),"function"==typeof n)return n.apply(console,e)}}}for(let e=0;e0&&(o=T(e.join(";"))),{key:s,value:i,metadata:o}}function At(t){return"string"!=typeof t||0===t.length?{}:t.split(",").map((t=>Rt(t))).filter((t=>void 0!==t&&t.value.length>0)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}class yt{inject(t,e,n){const r=mt.getBaggage(t);if(!r||vt(t))return;const s=function(t){return t.reduce(((t,e)=>{const n=`${t}${""!==t?",":""}${e}`;return n.length>8192?t:n}),"")}(function(t){return t.getAllEntries().map((([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e.value)}`))}(r).filter((t=>t.length<=4096)).slice(0,180));s.length>0&&n.set(e,bt,s)}extract(t,e,n){const r=n.get(e,bt);if(!r)return t;const s={};if(0===r.length)return t;return r.split(",").forEach((t=>{const e=Rt(t);if(e){const t={value:e.value};e.metadata&&(t.metadata=e.metadata),s[e.key]=t}})),0===Object.entries(s).length?t:mt.setBaggage(t,mt.createBaggage(s))}fields(){return[bt]}}function Ot(t){return null==t||(Array.isArray(t)?function(t){let e;for(const n of t)if(null!=n){if(!e){if(Nt(n)){e=typeof n;continue}return!1}if(typeof n!==e)return!1}return!0}(t):Nt(t))}function Nt(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}let wt=t=>{ft.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){const e={};let n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach((t=>{if(e[t])return;const r=n[t];r&&(e[t]=String(r))})),n=Object.getPrototypeOf(n);return e}(t))}(t))};function Lt(t){try{wt(t)}catch(t){}}var Pt;!function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"}(Pt||(Pt={}));const It=["OTEL_BSP_EXPORT_TIMEOUT","OTEL_BSP_MAX_EXPORT_BATCH_SIZE","OTEL_BSP_MAX_QUEUE_SIZE","OTEL_BSP_SCHEDULE_DELAY","OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_EVENT_COUNT_LIMIT","OTEL_SPAN_LINK_COUNT_LIMIT"];function Ct(t){return It.indexOf(t)>-1}const Mt=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS"];function Dt(t){return Mt.indexOf(t)>-1}const Ut=1/0,xt=128,Bt={CONTAINER_NAME:"",ECS_CONTAINER_METADATA_URI_V4:"",ECS_CONTAINER_METADATA_URI:"",HOSTNAME:"",KUBERNETES_SERVICE_HOST:"",NAMESPACE:"",OTEL_BSP_EXPORT_TIMEOUT:3e4,OTEL_BSP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BSP_MAX_QUEUE_SIZE:2048,OTEL_BSP_SCHEDULE_DELAY:5e3,OTEL_EXPORTER_JAEGER_AGENT_HOST:"",OTEL_EXPORTER_JAEGER_ENDPOINT:"",OTEL_EXPORTER_JAEGER_PASSWORD:"",OTEL_EXPORTER_JAEGER_USER:"",OTEL_EXPORTER_OTLP_ENDPOINT:"",OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:"",OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:"",OTEL_EXPORTER_OTLP_HEADERS:"",OTEL_EXPORTER_OTLP_TRACES_HEADERS:"",OTEL_EXPORTER_OTLP_METRICS_HEADERS:"",OTEL_EXPORTER_ZIPKIN_ENDPOINT:"http://localhost:9411/api/v2/spans",OTEL_LOG_LEVEL:p.INFO,OTEL_NO_PATCH_MODULES:[],OTEL_PROPAGATORS:["tracecontext","baggage"],OTEL_RESOURCE_ATTRIBUTES:"",OTEL_SERVICE_NAME:"",OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:Ut,OTEL_ATTRIBUTE_COUNT_LIMIT:xt,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:Ut,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:xt,OTEL_SPAN_EVENT_COUNT_LIMIT:128,OTEL_SPAN_LINK_COUNT_LIMIT:128,OTEL_TRACES_EXPORTER:"none",OTEL_TRACES_SAMPLER:Pt.ParentBasedAlwaysOn,OTEL_TRACES_SAMPLER_ARG:""};function kt(t,e,n,r=-1/0,s=1/0){if(void 0!==n[t]){const i=Number(n[t]);isNaN(i)||(e[t]=is?s:i)}}function Vt(t,e,n,r=","){const s=n[t];"string"==typeof s&&(e[t]=s.split(r).map((t=>t.trim())))}const Ft={ALL:p.ALL,VERBOSE:p.VERBOSE,DEBUG:p.DEBUG,INFO:p.INFO,WARN:p.WARN,ERROR:p.ERROR,NONE:p.NONE};function jt(t,e,n){const r=n[t];if("string"==typeof r){const n=Ft[r.toUpperCase()];null!=n&&(e[t]=n)}}const Ht="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{};function Gt(){const t=function(t){const e={};for(const n in Bt){const r=n;switch(r){case"OTEL_LOG_LEVEL":jt(r,e,t);break;default:if(Ct(r))kt(r,e,t);else if(Dt(r))Vt(r,e,t);else{const n=t[r];null!=n&&(e[r]=String(n))}}}return e}(Ht);return Object.assign({},Bt,t)}function Yt(t){const e=t.length;let n="";for(let r=0;r=58&&(Xt[e]+=39);return String.fromCharCode.apply(null,Xt.slice(0,2*t))}}const Wt=performance,qt="exception.type",Kt="exception.message",Qt="exception.stacktrace",Zt="http.method",Jt="http.url",te="http.host",ee="http.scheme",ne="http.status_code",re="http.user_agent",se="http.response_content_length",ie="http.response_content_length_uncompressed",oe="deployment.environment",ae="service.name",ce="telemetry.sdk.name",ue="telemetry.sdk.language",le="telemetry.sdk.version",de={[ce]:"opentelemetry",["process.runtime.name"]:"browser",[ue]:"webjs",[le]:"1.0.1"};const he=Math.pow(10,9);function pe(t){const e=t/1e3,n=Math.trunc(e);return[n,Number((e-n).toFixed(9))*he]}function _e(){let t=Wt.timeOrigin;if("number"!=typeof t){const e=Wt;t=e.timing&&e.timing.fetchStart}return t}function Ee(t){const e=pe(_e()),n=pe("number"==typeof t?t:Wt.now());let r=e[0]+n[0],s=e[1]+n[1];return s>he&&(s-=he,r+=1),[r,s]}function me(t){if(ge(t))return t;if("number"==typeof t)return t<_e()?Ee(t):pe(t);if(t instanceof Date)return pe(t.getTime());throw TypeError("Invalid input type")}function fe(t){return t[0]*he+t[1]}function ge(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}var Te;!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(Te||(Te={}));class Se{constructor(t={}){var e;this._propagators=null!==(e=t.propagators)&&void 0!==e?e:[],this._fields=Array.from(new Set(this._propagators.map((t=>"function"==typeof t.fields?t.fields():[])).reduce(((t,e)=>t.concat(e)),[])))}inject(t,e,n){for(const r of this._propagators)try{r.inject(t,e,n)}catch(t){ft.warn(`Failed to inject with ${r.constructor.name}. Err: ${t.message}`)}}extract(t,e,n){return this._propagators.reduce(((t,r)=>{try{return r.extract(t,e,n)}catch(t){ft.warn(`Failed to inject with ${r.constructor.name}. Err: ${t.message}`)}return t}),t)}fields(){return this._fields.slice()}}const ve=new RegExp("^(?:[a-z][_0-9a-z-*/]{0,255}|[a-z0-9][_0-9a-z-*/]{0,240}@[a-z][_0-9a-z-*/]{0,13})$"),be=/^[ -~]{0,255}[!-~]$/,Re=/,|=/;class Ae{constructor(t){this._internalState=new Map,t&&this._parse(t)}set(t,e){const n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n}unset(t){const e=this._clone();return e._internalState.delete(t),e}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce(((t,e)=>(t.push(e+"="+this.get(e)),t)),[]).join(",")}_parse(t){t.length>512||(this._internalState=t.split(",").reverse().reduce(((t,e)=>{const n=e.trim(),r=n.indexOf("=");if(-1!==r){const s=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return ve.test(t)})(s)&&function(t){return be.test(t)&&!Re.test(t)}(i)&&t.set(s,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const t=new Ae;return t._internalState=new Map(this._internalState),t}}const ye="traceparent",Oe="tracestate",Ne=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");class we{inject(t,e,n){const r=Et.getSpanContext(t);if(!r||vt(t)||!Y(r))return;const s=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||L.NONE).toString(16)}`;n.set(e,ye,s),r.traceState&&n.set(e,Oe,r.traceState.serialize())}extract(t,e,n){const r=n.get(e,ye);if(!r)return t;const s=Array.isArray(r)?r[0]:r;if("string"!=typeof s)return t;const i=function(t){const e=Ne.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}(s);if(!i)return t;i.isRemote=!0;const o=n.get(e,Oe);if(o){const t=Array.isArray(o)?o.join(","):o;i.traceState=new Ae("string"==typeof t?t:void 0)}return Et.setSpanContext(t,i)}fields(){return[ye,Oe]}}var Le;!function(t){t.HTTP="http"}(Le||(Le={}));class Pe{shouldSample(){return{decision:Z.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class Ie{shouldSample(){return{decision:Z.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class Ce{constructor(t){var e,n,r,s;this._root=t.root,this._root||(Lt(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Ie),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new Ie,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new Pe,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new Ie,this._localParentNotSampled=null!==(s=t.localParentNotSampled)&&void 0!==s?s:new Pe}shouldSample(t,e,n,r,s,i){const o=Et.getSpanContext(t);return o&&Y(o)?o.isRemote?o.traceFlags&L.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,s,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,s,i):o.traceFlags&L.SAMPLED?this._localParentSampled.shouldSample(t,e,n,r,s,i):this._localParentNotSampled.shouldSample(t,e,n,r,s,i):this._root.shouldSample(t,e,n,r,s,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class Me{constructor(t=0){this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(t,e){return{decision:H(e)&&this._accumulate(e)=1?1:t<=0?0:t}_accumulate(t){let e=0;for(let n=0;n>>0}return e}}const De="[object Null]",Ue="[object Undefined]",xe=Function.prototype.toString,Be=xe.call(Object),ke=(Ve=Object.getPrototypeOf,Fe=Object,function(t){return Ve(Fe(t))});var Ve,Fe;const je=Object.prototype,He=je.hasOwnProperty,Ge=Symbol?Symbol.toStringTag:void 0,Ye=je.toString;function $e(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!==function(t){if(null==t)return void 0===t?Ue:De;return Ge&&Ge in Object(t)?function(t){const e=He.call(t,Ge),n=t[Ge];let r=!1;try{t[Ge]=void 0,r=!0}catch(t){}const s=Ye.call(t);r&&(e?t[Ge]=n:delete t[Ge]);return s}(t):function(t){return Ye.call(t)}(t)}(t))return!1;const e=ke(t);if(null===e)return!0;const n=He.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&xe.call(n)===Be}function Xe(t){return qe(t)?t.slice():t}function ze(t,e,n=0,r){let s;if(!(n>20)){if(n++,Ze(t)||Ze(e)||Ke(e))s=Xe(e);else if(qe(t)){if(s=t.slice(),qe(e))for(let t=0,n=e.length;t=this._spanLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)||(this.attributes[t]=this._truncateToSize(e)),this):(ft.warn(`Invalid attribute value set for key: ${t}`),this)}setAttributes(t){for(const[e,n]of Object.entries(t))this.setAttribute(e,n);return this}addEvent(t,e,n){return this._isSpanEnded()||(this.events.length>=this._spanLimits.eventCountLimit&&(ft.warn("Dropping extra events."),this.events.shift()),(ge(r=e)||"number"==typeof r||r instanceof Date)&&(void 0===n&&(n=e),e=void 0),void 0===n&&(n=Ee()),this.events.push({name:t,attributes:e,time:me(n)})),this;var r}setStatus(t){return this._isSpanEnded()||(this.status=t),this}updateName(t){return this._isSpanEnded()||(this.name=t),this}end(t=Ee()){this._isSpanEnded()?ft.error("You can only call end() on a span once."):(this._ended=!0,this.endTime=me(t),this._duration=function(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=he),[n,r]}(this.startTime,this.endTime),this._duration[0]<0&&ft.warn("Inconsistent start and end time, startTime > endTime",this.startTime,this.endTime),this._spanProcessor.onEnd(this))}isRecording(){return!1===this._ended}recordException(t,e=Ee()){const n={};"string"==typeof t?n[Kt]=t:t&&(t.code?n[qt]=t.code.toString():t.name&&(n[qt]=t.name),t.message&&(n[Kt]=t.message),t.stack&&(n[Qt]=t.stack)),n[qt]||n[Kt]?this.addEvent("exception",n,e):ft.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}_isSpanEnded(){return this._ended&&ft.warn(`Can not execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`),this._ended}_truncateToLimitUtil(t,e){return t.length<=e?t:t.substr(0,e)}_truncateToSize(t){const e=this._attributeValueLengthLimit;return e<=0?(ft.warn(`Attribute value limit must be positive, got ${e}`),t):"string"==typeof t?this._truncateToLimitUtil(t,e):Array.isArray(t)?t.map((t=>"string"==typeof t?this._truncateToLimitUtil(t,e):t)):t}}const nn=Gt(),rn=Pt.AlwaysOn,sn={sampler:on(nn),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:Gt().OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:Gt().OTEL_ATTRIBUTE_COUNT_LIMIT},spanLimits:{attributeValueLengthLimit:Gt().OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:Gt().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,linkCountLimit:Gt().OTEL_SPAN_LINK_COUNT_LIMIT,eventCountLimit:Gt().OTEL_SPAN_EVENT_COUNT_LIMIT}};function on(t=Gt()){switch(t.OTEL_TRACES_SAMPLER){case Pt.AlwaysOn:return new Ie;case Pt.AlwaysOff:return new Pe;case Pt.ParentBasedAlwaysOn:return new Ce({root:new Ie});case Pt.ParentBasedAlwaysOff:return new Ce({root:new Pe});case Pt.TraceIdRatio:return new Me(an(t));case Pt.ParentBasedTraceIdRatio:return new Ce({root:new Me(an(t))});default:return ft.error(`OTEL_TRACES_SAMPLER value "${t.OTEL_TRACES_SAMPLER} invalid, defaulting to ${rn}".`),new Ie}}function an(t){if(void 0===t.OTEL_TRACES_SAMPLER_ARG||""===t.OTEL_TRACES_SAMPLER_ARG)return ft.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."),1;const e=Number(t.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(ft.error(`OTEL_TRACES_SAMPLER_ARG=${t.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to 1.`),1):e<0||e>1?(ft.error(`OTEL_TRACES_SAMPLER_ARG=${t.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to 1.`),1):e}class cn{constructor(t,e,n){this._tracerProvider=n;const r=function(t){const e={sampler:on()},n=Object.assign({},sn,e,t);return n.generalLimits=Object.assign({},sn.generalLimits,t.generalLimits||{}),n.spanLimits=Object.assign({},sn.spanLimits,t.spanLimits||{}),n.spanLimits.attributeCountLimit===xt&&n.generalLimits.attributeCountLimit!==xt&&(n.spanLimits.attributeCountLimit=n.generalLimits.attributeCountLimit),n.spanLimits.attributeValueLengthLimit===Ut&&n.generalLimits.attributeValueLengthLimit!==Ut&&(n.spanLimits.attributeValueLengthLimit=n.generalLimits.attributeValueLengthLimit),n}(e);this._sampler=r.sampler,this._generalLimits=r.generalLimits,this._spanLimits=r.spanLimits,this._idGenerator=e.idGenerator||new $t,this.resource=n.resource,this.instrumentationLibrary=t}startSpan(t,e={},n=_t.active()){var r,s;if(vt(n))return ft.debug("Instrumentation suppressed, returning Noop Span"),Et.wrapSpanContext(C);const i=function(t,e){return t.root?void 0:Et.getSpanContext(e)}(e,n),o=this._idGenerator.generateSpanId();let a,c,u;i&&Et.isSpanContextValid(i)?(a=i.traceId,c=i.traceState,u=i.spanId):a=this._idGenerator.generateTraceId();const l=null!==(r=e.kind)&&void 0!==r?r:J.INTERNAL,d=null!==(s=e.links)&&void 0!==s?s:[],h=function(t){const e={};if(null==t||"object"!=typeof t)return e;for(const[n,r]of Object.entries(t))Ot(r)&&(Array.isArray(r)?e[n]=r.slice():e[n]=r);return e}(e.attributes),p=this._sampler.shouldSample(e.root?Et.setSpanContext(n,C):n,a,t,l,h,d),_={traceId:a,spanId:o,traceFlags:p.decision===Z.RECORD_AND_SAMPLED?L.SAMPLED:L.NONE,traceState:c};if(p.decision===Z.NOT_RECORD)return ft.debug("Recording is off, propagating context in a non-recording span"),Et.wrapSpanContext(_);const E=new en(this,n,t,_,l,u,d,e.startTime);return E.setAttributes(Object.assign(h,p.attributes)),E}startActiveSpan(t,e,n,r){let s,i,o;if(arguments.length<2)return;2===arguments.length?o=e:3===arguments.length?(s=e,o=n):(s=e,i=n,o=r);const a=null!=i?i:_t.active(),c=this.startSpan(t,s,a),u=Et.setSpan(a,c);return _t.with(u,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}getActiveSpanProcessor(){return this._tracerProvider.getActiveSpanProcessor()}}function un(t,e,n,r){return new(n||(n=Promise))((function(s,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))}class ln{constructor(t){this.attributes=t}static empty(){return ln.EMPTY}static default(){return new ln({[ae]:"unknown_service",[ue]:de[ue],[ce]:de[ce],[le]:de[le]})}merge(t){if(!t||!Object.keys(t.attributes).length)return this;const e=Object.assign({},this.attributes,t.attributes);return new ln(e)}}ln.EMPTY=new ln({});class dn{constructor(t){this._spanProcessors=t}forceFlush(){const t=[];for(const e of this._spanProcessors)t.push(e.forceFlush());return new Promise((e=>{Promise.all(t).then((()=>{e()})).catch((t=>{Lt(t||new Error("MultiSpanProcessor: forceFlush failed")),e()}))}))}onStart(t,e){for(const n of this._spanProcessors)n.onStart(t,e)}onEnd(t){for(const e of this._spanProcessors)e.onEnd(t)}shutdown(){const t=[];for(const e of this._spanProcessors)t.push(e.shutdown());return new Promise(((e,n)=>{Promise.all(t).then((()=>{e()}),n)}))}}class hn{onStart(t,e){}onEnd(t){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}class pn extends class{constructor(t,e){this._exporter=t,this._finishedSpans=[],this._isShutdown=!1,this._shuttingDownPromise=Promise.resolve();const n=Gt();this._maxExportBatchSize="number"==typeof(null==e?void 0:e.maxExportBatchSize)?e.maxExportBatchSize:n.OTEL_BSP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize="number"==typeof(null==e?void 0:e.maxQueueSize)?e.maxQueueSize:n.OTEL_BSP_MAX_QUEUE_SIZE,this._scheduledDelayMillis="number"==typeof(null==e?void 0:e.scheduledDelayMillis)?e.scheduledDelayMillis:n.OTEL_BSP_SCHEDULE_DELAY,this._exportTimeoutMillis="number"==typeof(null==e?void 0:e.exportTimeoutMillis)?e.exportTimeoutMillis:n.OTEL_BSP_EXPORT_TIMEOUT}forceFlush(){return this._isShutdown?this._shuttingDownPromise:this._flushAll()}onStart(t){}onEnd(t){this._isShutdown||0!=(t.spanContext().traceFlags&L.SAMPLED)&&this._addToBuffer(t)}shutdown(){return this._isShutdown||(this._isShutdown=!0,this._shuttingDownPromise=new Promise(((t,e)=>{Promise.resolve().then((()=>this.onShutdown())).then((()=>this._flushAll())).then((()=>this._exporter.shutdown())).then(t).catch((t=>{e(t)}))}))),this._shuttingDownPromise}_addToBuffer(t){this._finishedSpans.length>=this._maxQueueSize||(this._finishedSpans.push(t),this._maybeStartTimer())}_flushAll(){return new Promise(((t,e)=>{const n=[];for(let t=0,e=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);t{t()})).catch(e)}))}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise(((t,e)=>{const n=setTimeout((()=>{e(new Error("Timeout"))}),this._exportTimeoutMillis);_t.with(function(t){return t.setValue(St,!0)}(_t.active()),(()=>{this._exporter.export(this._finishedSpans.splice(0,this._maxExportBatchSize),(r=>{var s;clearTimeout(n),r.code===Te.SUCCESS?t():e(null!==(s=r.error)&&void 0!==s?s:new Error("BatchSpanProcessor: span export failed"))}))}))}))}_maybeStartTimer(){void 0===this._timer&&(this._timer=setTimeout((()=>{this._flushOneBatch().then((()=>{this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())})).catch((t=>{Lt(t)}))}),this._scheduledDelayMillis),this._timer)}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}{constructor(t,e){super(t,e),this.onInit(e)}onInit(t){!0!==(null==t?void 0:t.disableAutoFlushOnDocumentHide)&&null!=document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener)}}var _n,En;!function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"}(_n||(_n={}));class mn{constructor(t={}){var e;this._registeredSpanProcessors=[],this._tracers=new Map;const n=function(...t){let e=t.shift();const n=new WeakMap;for(;t.length>0;)e=ze(e,t.shift(),0,n);return e}({},sn,t);this.resource=null!==(e=n.resource)&&void 0!==e?e:ln.empty(),this.resource=ln.default().merge(this.resource),this._config=Object.assign({},n,{resource:this.resource});const r=this._buildExporterFromEnv();if(void 0!==r){const t=new pn(r);this.activeSpanProcessor=t}else this.activeSpanProcessor=new hn}getTracer(t,e){const n=`${t}@${e||""}`;return this._tracers.has(n)||this._tracers.set(n,new cn({name:t,version:e},this._config,this)),this._tracers.get(n)}addSpanProcessor(t){0===this._registeredSpanProcessors.length&&this.activeSpanProcessor.shutdown().catch((t=>ft.error("Error while trying to shutdown current span processor",t))),this._registeredSpanProcessors.push(t),this.activeSpanProcessor=new dn(this._registeredSpanProcessors)}getActiveSpanProcessor(){return this.activeSpanProcessor}register(t={}){Et.setGlobalTracerProvider(this),void 0===t.propagator&&(t.propagator=this._buildPropagatorFromEnv()),t.contextManager&&_t.setGlobalContextManager(t.contextManager),t.propagator&&mt.setGlobalPropagator(t.propagator)}forceFlush(){const t=this._config.forceFlushTimeoutMillis,e=this._registeredSpanProcessors.map((e=>new Promise((n=>{let r;const s=setTimeout((()=>{n(new Error(`Span processor did not completed within timeout period of ${t} ms`)),r=_n.timeout}),t);e.forceFlush().then((()=>{clearTimeout(s),r!==_n.timeout&&(r=_n.resolved,n(r))})).catch((t=>{clearTimeout(s),r=_n.error,n(t)}))}))));return new Promise(((t,n)=>{Promise.all(e).then((e=>{const r=e.filter((t=>t!==_n.resolved));r.length>0?n(r):t()})).catch((t=>n([t])))}))}shutdown(){return this.activeSpanProcessor.shutdown()}_getPropagator(t){var e;return null===(e=mn._registeredPropagators.get(t))||void 0===e?void 0:e()}_getSpanExporter(t){var e;return null===(e=mn._registeredExporters.get(t))||void 0===e?void 0:e()}_buildPropagatorFromEnv(){const t=Array.from(new Set(Gt().OTEL_PROPAGATORS)),e=t.map((t=>{const e=this._getPropagator(t);return e||ft.warn(`Propagator "${t}" requested through environment variable is unavailable.`),e})).reduce(((t,e)=>(e&&t.push(e),t)),[]);return 0===e.length?void 0:1===t.length?e[0]:new Se({propagators:e})}_buildExporterFromEnv(){const t=Gt().OTEL_TRACES_EXPORTER;if("none"===t)return;const e=this._getSpanExporter(t);return e||ft.error(`Exporter "${t}" requested through environment variable is unavailable.`),e}}mn._registeredPropagators=new Map([["tracecontext",()=>new we],["baggage",()=>new yt]]),mn._registeredExporters=new Map;class fn{constructor(){this._enabled=!1,this._currentContext=y}_bindFunction(t=y,e){const n=this,r=function(...r){return n.with(t,(()=>e.apply(this,r)))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),r}active(){return this._currentContext}bind(t,e){return void 0===t&&(t=this.active()),"function"==typeof e?this._bindFunction(t,e):e}disable(){return this._currentContext=y,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=y),this}with(t,e,n,...r){const s=this._currentContext;this._currentContext=t||y;try{return e.call(n,...r)}finally{this._currentContext=s}}}class gn extends mn{constructor(t={}){if(super(t),t.contextManager)throw"contextManager should be defined in register method not in constructor";if(t.propagator)throw"propagator should be defined in register method not in constructor"}register(t={}){void 0===t.contextManager&&(t.contextManager=new fn),t.contextManager&&t.contextManager.enable(),super.register(t)}}let Tn;function Sn(){return Tn||(Tn=document.createElement("a")),Tn}function vn(t,e){return e in t}function bn(t,e,n){if(vn(n,e)&&"number"==typeof n[e])return t.addEvent(e,n[e]),t}function Rn(t,e){bn(t,En.FETCH_START,e),bn(t,En.DOMAIN_LOOKUP_START,e),bn(t,En.DOMAIN_LOOKUP_END,e),bn(t,En.CONNECT_START,e),bn(t,En.SECURE_CONNECTION_START,e),bn(t,En.CONNECT_END,e),bn(t,En.REQUEST_START,e),bn(t,En.RESPONSE_START,e),bn(t,En.RESPONSE_END,e);const n=e[En.ENCODED_BODY_SIZE];void 0!==n&&t.setAttribute(se,n);const r=e[En.DECODED_BODY_SIZE];void 0!==r&&n!==r&&t.setAttribute(ie,r)}function An(t,e,n,r,s=new WeakSet,i){const o=Sn();o.href=t;const a=function(t,e,n,r,s,i){const o=fe(e),a=fe(n);let c=r.filter((e=>{const n=fe(me(e[En.FETCH_START])),r=fe(me(e[En.RESPONSE_END]));return e.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&e.name===t&&n>=o&&r<=a}));c.length>0&&(c=c.filter((t=>!s.has(t))));return c}(t=o.href,e,n,r,s,i);if(0===a.length)return{mainRequest:void 0};if(1===a.length)return{mainRequest:a[0]};const c=function(t){return t.slice().sort(((t,e)=>{const n=t[En.FETCH_START],r=e[En.FETCH_START];return n>r?1:n1){let t=c[0],e=function(t,e,n){const r=fe(n),s=fe(me(e));let i,o=t[1];const a=t.length;for(let e=1;e=s&&(!i||c{const r=n.localName;return e.indexOf(n.nodeType)>=0&&r===t.localName})),n.length>=1)return n.indexOf(t)+1;return 0}(t);let s="";if(n===Node.ELEMENT_NODE){const n=t.getAttribute("id");if(e&&n)return`//*[@id="${n}"]`;s=t.localName}else if(n===Node.TEXT_NODE||n===Node.CDATA_SECTION_NODE)s="text()";else{if(n!==Node.COMMENT_NODE)return"";s="comment()"}if(s&&r>1)return`/${s}[${r}]`;return`/${s}`}(t,e);if(e&&n.indexOf("@id")>0)return n;let r="";return t.parentNode&&(r+=On(t.parentNode,!1)),r+=n,r}function Nn(t,e){let n=e||[];("string"==typeof n||n instanceof RegExp)&&(n=[n]);return yn(t).origin===window.location.origin||n.some((e=>Je(t,e)))}!function(t){t.CONNECT_END="connectEnd",t.CONNECT_START="connectStart",t.DECODED_BODY_SIZE="decodedBodySize",t.DOM_COMPLETE="domComplete",t.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",t.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",t.DOM_INTERACTIVE="domInteractive",t.DOMAIN_LOOKUP_END="domainLookupEnd",t.DOMAIN_LOOKUP_START="domainLookupStart",t.ENCODED_BODY_SIZE="encodedBodySize",t.FETCH_START="fetchStart",t.LOAD_EVENT_END="loadEventEnd",t.LOAD_EVENT_START="loadEventStart",t.NAVIGATION_START="navigationStart",t.REDIRECT_END="redirectEnd",t.REDIRECT_START="redirectStart",t.REQUEST_START="requestStart",t.RESPONSE_END="responseEnd",t.RESPONSE_START="responseStart",t.SECURE_CONNECTION_START="secureConnectionStart",t.UNLOAD_EVENT_END="unloadEventEnd",t.UNLOAD_EVENT_START="unloadEventStart"}(En||(En={}));class wn{}class Ln extends wn{observation(){return{observable:this,value:0}}}const Pn=new class{constructor(){}createHistogram(t,e){return Cn}createCounter(t,e){return In}createUpDownCounter(t,e){return Mn}createObservableGauge(t,e,n){return Un}createObservableCounter(t,e,n){return Dn}createObservableUpDownCounter(t,e,n){return xn}},In=new class extends wn{add(t,e){}},Cn=new class extends wn{record(t,e){}},Mn=new class extends wn{add(t,e){}},Dn=new Ln,Un=new Ln,xn=new Ln;const Bn=new class{getMeter(t,e,n){return Pn}};var kn,Vn;!function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"}(kn||(kn={})),function(t){t[t.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",t[t.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",t[t.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"}(Vn||(Vn={}));const Fn="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},jn=Symbol.for("io.opentelemetry.js.api.metrics"),Hn=Fn;class Gn{constructor(){}static getInstance(){return this._instance||(this._instance=new Gn),this._instance}setGlobalMeterProvider(t){return Hn[jn]?this.getMeterProvider():(Hn[jn]=(e=4,n=t,r=Bn,t=>t===e?n:r),t);var e,n,r}getMeterProvider(){var t,e;return null!==(e=null===(t=Hn[jn])||void 0===t?void 0:t.call(Hn,4))&&void 0!==e?e:Bn}getMeter(t,e,n){return this.getMeterProvider().getMeter(t,e,n)}disable(){delete Hn[jn]}}const Yn=Gn.getInstance();function $n(t=[]){let e=[];for(let n=0,r=t.length;n{!function(t){t.forEach((t=>t.disable()))}(e)}}function zn(t){return"function"==typeof t}var Wn=console.error.bind(console);function qn(t,e,n){var r=!!t[e]&&t.propertyIsEnumerable(e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}function Kn(t){t&&t.logger&&(zn(t.logger)?Wn=t.logger:Wn("new logger isn't a function, not replacing"))}function Qn(t,e,n){if(t&&t[e]){if(!n)return Wn("no wrapper function"),void Wn((new Error).stack);if(zn(t[e])&&zn(n)){var r=t[e],s=n(r,e);return qn(s,"__original",r),qn(s,"__unwrap",(function(){t[e]===s&&qn(t,e,r)})),qn(s,"__wrapped",!0),qn(t,e,s),s}Wn("original object and wrapper must be functions")}else Wn("no original function "+e+" to wrap")}function Zn(t,e){return t&&t[e]?t[e].__unwrap?t[e].__unwrap():void Wn("no original to unwrap to -- has "+e+" already been unwrapped?"):(Wn("no function to unwrap."),void Wn((new Error).stack))}Kn.wrap=Qn,Kn.massWrap=function(t,e,n){if(!t)return Wn("must provide one or more modules to patch"),void Wn((new Error).stack);Array.isArray(t)||(t=[t]),e&&Array.isArray(e)?t.forEach((function(t){e.forEach((function(e){Qn(t,e,n)}))})):Wn("must provide one or more functions to wrap on modules")},Kn.unwrap=Zn,Kn.massUnwrap=function(t,e){if(!t)return Wn("must provide one or more modules to patch"),void Wn((new Error).stack);Array.isArray(t)||(t=[t]),e&&Array.isArray(e)?t.forEach((function(t){e.forEach((function(e){Zn(t,e)}))})):Wn("must provide one or more functions to unwrap on modules")};var Jn,tr=Kn;class er extends class{constructor(t,e,n={}){this.instrumentationName=t,this.instrumentationVersion=e,this._wrap=tr.wrap,this._unwrap=tr.unwrap,this._massWrap=tr.massWrap,this._massUnwrap=tr.massUnwrap,this._config=Object.assign({enabled:!0},n),this._diag=ft.createComponentLogger({namespace:t}),this._tracer=Et.getTracer(t,e),this._meter=Yn.getMeter(t,e)}get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion)}getConfig(){return this._config}setConfig(t={}){this._config=Object.assign({},t)}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}}{constructor(t,e,n={}){super(t,e,n),this._config.enabled&&this.enable()}}function nr(t,e,n){let r,s;try{s=t()}catch(t){r=t}finally{if(e(r,s),r&&!n)throw r;return s}}function rr(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped}!function(t){t.METHOD_OPEN="open",t.METHOD_SEND="send",t.EVENT_ABORT="abort",t.EVENT_ERROR="error",t.EVENT_LOAD="loaded",t.EVENT_TIMEOUT="timeout"}(Jn||(Jn={}));const sr="0.27.0";var ir;!function(t){t.HTTP_STATUS_TEXT="http.status_text"}(ir||(ir={}));class or extends er{constructor(t){super("@opentelemetry/instrumentation-xml-http-request",sr,t),this.component="xml-http-request",this.version=sr,this.moduleName=this.component,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}init(){}_getConfig(){return this._config}_addHeaders(t,e){if(!Nn(e,this._getConfig().propagateTraceHeaderCorsUrls)){const t={};return mt.inject(_t.active(),t),void(Object.keys(t).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}const n={};mt.inject(_t.active(),n),Object.keys(n).forEach((e=>{t.setRequestHeader(e,String(n[e]))}))}_addChildSpan(t,e){_t.with(Et.setSpan(_t.active(),t),(()=>{const t=this.tracer.startSpan("CORS Preflight",{startTime:e[En.FETCH_START]});Rn(t,e),t.end(e[En.RESPONSE_END])}))}_addFinalSpanAttributes(t,e,n){if("string"==typeof n){const r=yn(n);void 0!==e.status&&t.setAttribute(ne,e.status),void 0!==e.statusText&&t.setAttribute(ir.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(te,r.host),t.setAttribute(ee,r.protocol.replace(":","")),t.setAttribute(re,navigator.userAgent)}}_applyAttributesAfterXHR(t,e){const n=this._getConfig().applyCustomAttributesOnSpan;"function"==typeof n&&nr((()=>n(t,e)),(t=>{t&&this._diag.error("applyCustomAttributesOnSpan",t)}),!0)}_addResourceObserver(t,e){const n=this._xhrMem.get(t);n&&void 0!==window.PerformanceObserver&&void 0!==window.PerformanceResourceTiming&&(n.createdResources={observer:new PerformanceObserver((t=>{const r=t.getEntries(),s=Sn();s.href=e,r.forEach((t=>{"xmlhttprequest"===t.initiatorType&&t.name===s.href&&n.createdResources&&n.createdResources.entries.push(t)}))})),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){0===this._tasksCount&&this._getConfig().clearTimingResources&&(Wt.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,e,n,r,s){if(!(n&&r&&s&&t.createdResources))return;let i=t.createdResources.entries;i&&i.length||(i=Wt.getEntriesByType("resource"));const o=An(n,r,s,i,this._usedResources);if(o.mainRequest){const t=o.mainRequest;this._markResourceAsUsed(t);const n=o.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n)),Rn(e,t)}}_cleanPreviousSpanInformation(t){const e=this._xhrMem.get(t);if(e){const n=e.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,e,n){if(tn(e,this._getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");const r=`HTTP ${n.toUpperCase()}`,s=this.tracer.startSpan(r,{kind:J.CLIENT,attributes:{[Zt]:n,[Jt]:e}});return s.addEvent(Jn.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:s,spanUrl:e}),s}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{const e=this;return function(...n){const r=n[0],s=n[1];return e._createSpan(this,s,r),t.apply(this,n)}}}_patchSend(){const t=this;function e(e,n){const r=t._xhrMem.get(n);if(!r)return;r.status=n.status,r.statusText=n.statusText,t._xhrMem.delete(n),r.span&&t._applyAttributesAfterXHR(r.span,n);const s=Ee();setTimeout((()=>{!function(e,n,r){const s=n.callbackToRemoveEvents;"function"==typeof s&&s();const{span:i,spanUrl:o,sendStartTime:a}=n;i&&(t._findResourceAndAddNetworkEvents(n,i,o,a,r),i.addEvent(e,r),t._addFinalSpanAttributes(i,n,o),i.end(r),t._tasksCount--),t._clearResources()}(e,r,s)}),300)}function n(){e(Jn.EVENT_ERROR,this)}function r(){e(Jn.EVENT_ABORT,this)}function s(){e(Jn.EVENT_TIMEOUT,this)}function i(){this.status<299?e(Jn.EVENT_LOAD,this):e(Jn.EVENT_ERROR,this)}return e=>function(...o){const a=t._xhrMem.get(this);if(!a)return e.apply(this,o);const c=a.span,u=a.spanUrl;return c&&u&&_t.with(Et.setSpan(_t.active(),c),(()=>{t._tasksCount++,a.sendStartTime=Ee(),c.addEvent(Jn.METHOD_SEND),this.addEventListener("abort",r),this.addEventListener("error",n),this.addEventListener("load",i),this.addEventListener("timeout",s),a.callbackToRemoveEvents=()=>{!function(e){e.removeEventListener("abort",r),e.removeEventListener("error",n),e.removeEventListener("load",i),e.removeEventListener("timeout",s);const o=t._xhrMem.get(e);o&&(o.callbackToRemoveEvents=void 0)}(this),a.createdResources&&a.createdResources.observer.disconnect()},t._addHeaders(this,u),t._addResourceObserver(this,u)})),e.apply(this,o)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),rr(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),rr(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 ar;!function(t){t.COMPONENT="component",t.HTTP_ERROR_NAME="http.error_name",t.HTTP_STATUS_TEXT="http.status_text"}(ar||(ar={}));const cr="0.27.0";class ur extends er{constructor(t){super("@opentelemetry/instrumentation-fetch",cr,t),this.component="fetch",this.version=cr,this.moduleName=this.component,this._usedResources=new WeakSet,this._tasksCount=0}init(){}_getConfig(){return this._config}_addChildSpan(t,e){const n=this.tracer.startSpan("CORS Preflight",{startTime:e[En.FETCH_START]},Et.setSpan(_t.active(),t));Rn(n,e),n.end(e[En.RESPONSE_END])}_addFinalSpanAttributes(t,e){const n=yn(e.url);t.setAttribute(ne,e.status),null!=e.statusText&&t.setAttribute(ar.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(te,n.host),t.setAttribute(ee,n.protocol.replace(":","")),t.setAttribute(re,navigator.userAgent)}_addHeaders(t,e){if(!Nn(e,this._getConfig().propagateTraceHeaderCorsUrls)){const t={};return mt.inject(_t.active(),t),void(Object.keys(t).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(t instanceof Request)mt.inject(_t.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else if(t.headers instanceof Headers)mt.inject(_t.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else{const e={};mt.inject(_t.active(),e),t.headers=Object.assign({},e,t.headers||{})}}_clearResources(){0===this._tasksCount&&this._getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,e={}){if(tn(t,this._getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");const n=(e.method||"GET").toUpperCase(),r=`HTTP ${n}`;return this.tracer.startSpan(r,{kind:J.CLIENT,attributes:{[ar.COMPONENT]:this.moduleName,[Zt]:n,[Jt]:t}})}_findResourceAndAddNetworkEvents(t,e,n){let r=e.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType("resource")}const s=An(e.spanUrl,e.startTime,n,r,this._usedResources,"fetch");if(s.mainRequest){const e=s.mainRequest;this._markResourceAsUsed(e);const n=s.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n)),Rn(t,e)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,e,n){const r=Ee();this._addFinalSpanAttributes(t,n),setTimeout((()=>{var n;null===(n=e.observer)||void 0===n||n.disconnect(),this._findResourceAndAddNetworkEvents(t,e,r),this._tasksCount--,this._clearResources(),t.end(r)}),300)}_patchConstructor(){return t=>{const e=this;return function(...n){const r=n[0]instanceof Request?n[0].url:n[0],s=n[0]instanceof Request?n[0]:n[1]||{},i=e._createSpan(r,s);if(!i)return t.apply(this,n);const o=e._prepareSpanData(r);function a(t,n){e._applyAttributesAfterFetch(t,s,n),e._endSpan(t,o,{status:n.status||0,statusText:n.message,url:r})}function c(t,n){e._applyAttributesAfterFetch(t,s,n),n.status>=200&&n.status<400?e._endSpan(t,o,n):e._endSpan(t,o,{status:n.status,statusText:n.statusText,url:r})}function u(t,e,n){try{const r=n.clone(),s=n.clone(),i=r.body;if(i){const e=i.getReader(),n=()=>{e.read().then((({done:e})=>{e?c(t,s):n()}),(e=>{a(t,e)}))};n()}else c(t,n)}finally{e(n)}}function l(t,e,n){try{a(t,n)}finally{e(n)}}return new Promise(((n,o)=>_t.with(Et.setSpan(_t.active(),i),(()=>(e._addHeaders(s,r),e._tasksCount++,t.apply(this,s instanceof Request?[s]:[r,s]).then(u.bind(this,i,n),l.bind(this,i,o)))))))}}}_applyAttributesAfterFetch(t,e,n){const r=this._getConfig().applyCustomAttributesOnSpan;r&&nr((()=>r(t,e,n)),(t=>{t&&this._diag.error("applyCustomAttributesOnSpan",t)}),!0)}_prepareSpanData(t){const e=Ee(),n=[];if(void 0===window.PerformanceObserver)return{entries:n,startTime:e,spanUrl:t};const r=new PerformanceObserver((e=>{const r=e.getEntries(),s=Sn();s.href=t,r.forEach((t=>{"fetch"===t.initiatorType&&t.name===s.href&&n.push(t)}))}));return r.observe({entryTypes:["resource"]}),{entries:n,observer:r,startTime:e,spanUrl:t}}enable(){rr(window.fetch)&&(this._unwrap(window,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(window,"fetch",this._patchConstructor())}disable(){this._unwrap(window,"fetch"),this._usedResources=new WeakSet}}const lr=(t,e,n)=>{const r=t[e];return"function"!=typeof r?r:(tr.wrap(t,e,n),dr(t[e],r),t[e])},dr=(t,e)=>{const n=e.toString;Object.defineProperty(t,"toString",{enumerable:!1,configurable:!0,writable:!0,value(){return n.call(this===t?e:this)}})},hr=new WeakMap,pr=(t,e)=>hr.set(t,e);var _r,Er,mr,fr,gr,Tr,Sr,vr,br,Rr;const Ar=new Map([[[null===(_r=globalThis.XMLHttpRequest)||void 0===_r?void 0:_r.prototype],["abort","error","load","loadend","loadstart","progress","readystatechange","timeout"]],[[null===(Er=globalThis.MessagePort)||void 0===Er?void 0:Er.prototype],["message","messageerror"]],[[null===(mr=globalThis.WebSocket)||void 0===mr?void 0:mr.prototype],["close","error","open","message"]],[[null===(fr=globalThis.Worker)||void 0===fr?void 0:fr.prototype],["error","message"]],[[null===(gr=globalThis.IDBIndex)||void 0===gr?void 0:gr.prototype,null===(Tr=globalThis.IDBRequest)||void 0===Tr?void 0:Tr.prototype,null===(Sr=globalThis.IDBOpenDBRequest)||void 0===Sr?void 0:Sr.prototype,null===(vr=globalThis.IDBDatabase)||void 0===vr?void 0:vr.prototype,null===(br=globalThis.IDBTransaction)||void 0===br?void 0:br.prototype,null===(Rr=globalThis.IDBCursor)||void 0===Rr?void 0:Rr.prototype],["abort","blocked","close","complete","error","success","upgradeneeded","versionchange"]]]),yr=t=>{const e=new WeakMap,n=(r,s)=>{const i=Object.getOwnPropertyDescriptor(r,s);if(!i){const t=Object.getPrototypeOf(r);if(!t)return;return n(t,s)}lr(i,"get",(t=>function(){var n;const r=null==t?void 0:t.call(this);return null!==(n=e.get(r))&&void 0!==n?n:r})),lr(i,"set",(n=>function(r){let s=null;r&&(s=t.bind(t.active(),r),e.set(s,r)),n.call(this,s)})),Object.defineProperty(r,s,i)},r=new WeakMap;lr(EventTarget.prototype,"addEventListener",(e=>function(...n){const s=n[1];if(s){let e=r.get(s);e||("function"==typeof s?e=t.bind(t.active(),s):s&&"function"==typeof s.handleEvent&&(e=Object.assign(Object.assign({},s),{handleEvent:t.bind(t.active(),s.handleEvent)}))),e&&(r.set(s,e),n[1]=e)}return e.apply(this,n)})),lr(EventTarget.prototype,"removeEventListener",(t=>function(...e){const n=e[1];if(n){const t=r.get(n);t&&(e[1]=t)}return t.apply(this,e)})),Ar.forEach(((t,e)=>{e.forEach((e=>{e&&((t,e)=>{e.forEach((e=>{n(t,`on${e}`)}))})(e,t)}))}))},Or=()=>{const t=(t,e)=>{e.forEach((e=>{((t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);n&&(tr.unwrap(n,"get"),tr.unwrap(n,"set"),Object.defineProperty(t,e,n))})(t,`on${e}`)}))};tr.unwrap(EventTarget.prototype,"addEventListener"),tr.unwrap(EventTarget.prototype,"removeEventListener"),Ar.forEach(((e,n)=>{n.forEach((n=>{n&&t(n,e)}))}))},Nr=t=>{if(!self.MessageChannel||!self.MessagePort)return;const e=new WeakMap;lr(window,"MessageChannel",(t=>class extends t{constructor(...t){super(...t),e.set(this.port1,this.port2),e.set(this.port2,this.port1)}})),lr(MessagePort.prototype,"postMessage",(n=>function(...r){const s=e.get(this);return t.active()&&s&&pr(s,t.active()),n.apply(this,r)}))},wr=["MutationObserver","IntersectionObserver","ResizeObserver"],Lr=t=>{wr.forEach((e=>{globalThis[e]&&lr(globalThis,e,(n=>{const r=class extends n{constructor(...e){e[0]=t.bind(t.active(),e[0]),super(...e),setTimeout((()=>{pr(this,y)}),300)}};return Object.defineProperty(r,"name",{enumerable:!1,configurable:!0,writable:!1,value:e}),dr(r,n),r}))}))},Pr=t=>{window.Promise&&lr(window,"Promise",(e=>{const n=class extends e{};return dr(n,e),lr(n.prototype,"then",(e=>function(...n){return n[0]=t.bind(t.active(),n[0]),n[1]=t.bind(t.active(),n[1]),e.apply(this,n)})),lr(n.prototype,"catch",(e=>function(...n){return n[0]=t.bind(t.active(),n[0]),e.apply(this,n)})),lr(n.prototype,"finally",(e=>function(...n){return n[0]=t.bind(t.active(),n[0]),e.apply(this,n)})),n}))},Ir=t=>"number"!=typeof t||t<=1500,Cr=t=>{lr(window,"setTimeout",(e=>function(...n){return Ir(n[1])&&(n[0]=t.bind(t.active(),n[0])),e.apply(this,n)})),lr(window,"setInterval",(e=>function(...n){return Ir(n[1])&&(n[0]=t.bind(t.active(),n[0])),e.apply(this,n)})),lr(window,"setImmediate",(e=>function(...n){return n[0]=t.bind(t.active(),n[0]),e.apply(this,n)})),lr(window,"requestAnimationFrame",(e=>function(...n){return n[0]=t.bind(t.active(),n[0]),e.apply(this,n)})),lr(window,"queueMicrotask",(e=>function(...n){return n[0]=t.bind(t.active(),n[0]),e.apply(this,n)}))},Mr=t=>t?(t=>hr.get(t))(t):void 0;var Dr;!function(t){t.COMPONENT="component",t.DOCUMENT_LOAD="documentLoad",t.DOCUMENT_FETCH="documentFetch",t.RESOURCE_FETCH="resourceFetch",t.PAGE_TITLE="page_title"}(Dr||(Dr={}));var Ur,xr,Br,kr,Vr,Fr=function(t,e){return{name:t,value:void 0===e?-1:e,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},jr=function(t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){if("first-input"===t&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(t){return t.getEntries().map(e)}));return n.observe({type:t,buffered:!0}),n}}catch(t){}},Hr=function(t,e){var n=function n(r){"pagehide"!==r.type&&"hidden"!==document.visibilityState||(t(r),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Gr=function(t){addEventListener("pageshow",(function(e){e.persisted&&t(e)}),!0)},Yr=function(t,e,n){var r;return function(s){e.value>=0&&(s||n)&&(e.delta=e.value-(r||0),(e.delta||void 0===r)&&(r=e.value,t(e)))}},$r=-1,Xr=function(){return"hidden"===document.visibilityState?0:1/0},zr=function(){Hr((function(t){var e=t.timeStamp;$r=e}),!0)},Wr=function(){return $r<0&&($r=Xr(),zr(),Gr((function(){setTimeout((function(){$r=Xr(),zr()}),0)}))),{get firstHiddenTime(){return $r}}},qr=function(t,e){var n,r=Wr(),s=Fr("FCP"),i=function(t){"first-contentful-paint"===t.name&&(a&&a.disconnect(),t.startTime=0&&xr1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,e){var n=function(){ts(t,e),s()},r=function(){s()},s=function(){removeEventListener("pointerup",n,Zr),removeEventListener("pointercancel",r,Zr)};addEventListener("pointerup",n,Zr),addEventListener("pointercancel",r,Zr)}(e,t):ts(e,t)}},rs=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach((function(e){return t(e,ns,Zr)}))},ss={};!function(t){t.FIRST_PAINT="firstPaint",t.FIRST_CONTENTFUL_PAINT="firstContentfulPaint",t.LARGEST_CONTENTFUL_PAINT="largestContentfulPaint",t.CUMULATIVE_LAYOUT_SHIFT="cumulativeLayoutShift",t.FIRST_INPUT_DELAY="firstInputDelay",t.TIME_TO_FIRST_BYTE="timeToFirstByte"}(Vr||(Vr={}));const is={FCP:Vr.FIRST_CONTENTFUL_PAINT,FID:Vr.FIRST_INPUT_DELAY,TTFB:Vr.TIME_TO_FIRST_BYTE,LCP:Vr.LARGEST_CONTENTFUL_PAINT,CLS:Vr.CUMULATIVE_LAYOUT_SHIFT},os={"first-paint":Vr.FIRST_PAINT},as=new Set([Vr.CUMULATIVE_LAYOUT_SHIFT]),cs=(t,e)=>{const n={},r=new Set(["FCP","FID","TTFB"]);"chrome"in globalThis&&(r.add("LCP"),r.add("CLS"));let s=!1;const i=()=>{var r,o;if(document.removeEventListener("visibilitychange",i),globalThis.removeEventListener("pagehide",i),!s){const i=null===(o=(r=Wt).getEntriesByType)||void 0===o?void 0:o.call(r,"paint");i&&i.forEach((({name:t,startTime:e})=>{vn(os,t)&&(n[os[t]]=e)})),s=!0,Object.entries(n).forEach((([e,n])=>{t[as.has(e)?"setAttribute":"addEvent"](e,n)})),e()}},o=t=>{r.delete(t.name),n[is[t.name]]=t.value,r.size||i()};if(document.addEventListener("visibilitychange",i),globalThis.addEventListener("pagehide",i),function(t,e){Kr||(qr((function(t){Qr=t.value})),Kr=!0);var n,r=function(e){Qr>-1&&t(e)},s=Fr("CLS",0),i=0,o=[],a=function(t){if(!t.hadRecentInput){var e=o[0],r=o[o.length-1];i&&t.startTime-r.startTime<1e3&&t.startTime-e.startTime<5e3?(i+=t.value,o.push(t)):(i=t.value,o=[t]),i>s.value&&(s.value=i,s.entries=o,n())}},c=jr("layout-shift",a);c&&(n=Yr(r,s,e),Hr((function(){c.takeRecords().map(a),n(!0)})),Gr((function(){i=0,Qr=-1,s=Fr("CLS",0),n=Yr(r,s,e)})))}(o),qr(o),function(t,e){var n,r=Wr(),s=Fr("FID"),i=function(t){t.startTimeperformance.now())return;n.entries=[e],t(n)}catch(t){}},"complete"===document.readyState?setTimeout(e,0):addEventListener("load",(function(){return setTimeout(e,0)}))}(o),"function"==typeof PerformanceObserver){const t=new PerformanceObserver((()=>{}));if(t.observe({type:"largest-contentful-paint",buffered:!0}),"function"==typeof t.takeRecords){const[e]=t.takeRecords();e&&(r.delete("LCP"),n[Vr.LARGEST_CONTENTFUL_PAINT]=e.startTime)}}};class us extends er{constructor(t={}){super("@opentelemetry/instrumentation-document-load","0.27.1",t),this.component="document-load",this.version="1",this.moduleName=this.component,this._enabled=!1}init(){}_onDocumentLoaded(){window.setTimeout((()=>{this._collectPerformance()}))}_addResourcesSpans(t){var e,n;const r=null===(n=(e=Wt).getEntriesByType)||void 0===n?void 0:n.call(e,"resource");r&&r.forEach((e=>{this._initResourceSpan(e,t)}))}_collectPerformance(){const t=Array.from(document.getElementsByTagName("meta")).find((t=>t.getAttribute("name")===ye)),e=(()=>{var t,e;const n={},r=null===(e=(t=Wt).getEntriesByType)||void 0===e?void 0:e.call(t,"navigation")[0];if(r)Object.values(En).forEach((t=>{if(vn(r,t)){const e=r[t];"number"==typeof e&&(n[t]=e)}}));else{const t=Wt.timing;t&&Object.values(En).forEach((e=>{if(vn(t,e)){const r=t[e];"number"==typeof r&&(n[e]=r)}}))}return n})(),n=t&&t.content||"";_t.with(mt.extract(y,{traceparent:n}),(()=>{const t=this._startSpan(Dr.DOCUMENT_LOAD,En.FETCH_START,e);t&&(_t.with(Et.setSpan(_t.active(),t),(()=>{const t=this._startSpan(Dr.DOCUMENT_FETCH,En.FETCH_START,e);t&&(t.setAttribute(Jt,location.href),t.setAttribute(re,navigator.userAgent),_t.with(Et.setSpan(_t.active(),t),(()=>{Rn(t,e),this._endSpan(t,En.RESPONSE_END,e)})))})),t.setAttribute(Jt,location.href),t.setAttribute(re,navigator.userAgent),t.setAttribute(Dr.PAGE_TITLE,document.title),this._addResourcesSpans(t),bn(t,En.FETCH_START,e),bn(t,En.UNLOAD_EVENT_START,e),bn(t,En.UNLOAD_EVENT_END,e),bn(t,En.DOM_INTERACTIVE,e),bn(t,En.DOM_CONTENT_LOADED_EVENT_START,e),bn(t,En.DOM_CONTENT_LOADED_EVENT_END,e),bn(t,En.DOM_COMPLETE,e),bn(t,En.LOAD_EVENT_START,e),bn(t,En.LOAD_EVENT_END,e),cs(t,(()=>{this._endSpan(t,En.LOAD_EVENT_END,e)})))}))}_endSpan(t,e,n){t&&(vn(n,e)?t.end(n[e]):t.end())}_initResourceSpan(t,e){const n=this._startSpan(Dr.RESOURCE_FETCH,En.FETCH_START,t,e);n&&(n.setAttribute(Jt,t.name),Rn(n,t),this._endSpan(n,En.RESPONSE_END,t))}_startSpan(t,e,n,r){if(vn(n,e)&&"number"==typeof n[e]){const s=this.tracer.startSpan(t,{startTime:n[e]},r?Et.setSpan(_t.active(),r):void 0);return s.setAttribute(Dr.COMPONENT,this.component),s}}_waitForPageLoad(){"complete"!==window.document.readyState||this._enabled?(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded)):(this._enabled=!0,this._onDocumentLoaded())}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}}var ls;!function(t){t.COMPONENT="component",t.EVENT_TYPE="event_type",t.TARGET_ELEMENT="target_element",t.TARGET_XPATH="target_xpath",t.HTTP_URL="http.url",t.HTTP_USER_AGENT="http.user_agent"}(ls||(ls={}));const ds="0.28.1",hs=["click"];function ps(){return!1}const _s=()=>`${location.pathname}${location.search}${location.hash}`;class Es extends er{constructor(t){var e;super("@opentelemetry/instrumentation-user-interaction",ds,t),this.component="user-interaction",this.version=ds,this.moduleName=this.component,this._spansData=new WeakMap,this._isEnabled=!1,this._wrappedListeners=new WeakMap,this._eventsSpanMap=new WeakMap,this._eventNames=new Set(null!==(e=null==t?void 0:t.eventNames)&&void 0!==e?e:hs),this._shouldPreventSpanCreation="function"==typeof(null==t?void 0:t.shouldPreventSpanCreation)?t.shouldPreventSpanCreation:ps}init(){}_allowEventName(t){return this._eventNames.has(t)}_createSpan(t,e){if(!(t instanceof HTMLElement))return;if(!t.getAttribute)return;if(t.hasAttribute("disabled"))return;if(!this._allowEventName(e))return;const n=On(t,!0);try{const r=this.tracer.startSpan(e,{attributes:{[ls.COMPONENT]:this.component,[ls.EVENT_TYPE]:e,[ls.TARGET_ELEMENT]:t.tagName,[ls.TARGET_XPATH]:n,[ls.HTTP_URL]:window.location.href,[ls.HTTP_USER_AGENT]:navigator.userAgent}},y);if(this.lastCreatedSpan=r,!0===this._shouldPreventSpanCreation(e,t,r))return;return this._spansData.set(r,{taskCount:0}),r}catch(t){ft.error(this.component,t)}}addPatchedListener(t,e,n,r){let s=this._wrappedListeners.get(n);s||(s=new Map,this._wrappedListeners.set(n,s));let i=s.get(e);return i||(i=new Map,s.set(e,i)),!i.has(t)&&(i.set(t,r),!0)}removePatchedListener(t,e,n){const r=this._wrappedListeners.get(n);if(!r)return;const s=r.get(e);if(!s)return;const i=s.get(t);return i&&(s.delete(t),0===s.size&&(r.delete(e),0===r.size&&this._wrappedListeners.delete(n))),i}_invokeListener(t,e,n){return"function"==typeof t?t.apply(e,n):t.handleEvent(n[0])}_patchAddEventListener(){const t=this;return e=>function(n,r,s){if(!r)return e.call(this,n,r,s);const i="object"==typeof s&&s.once,o=this,a=function(...e){const s=e[0],a=null==s?void 0:s.target;i&&t.removePatchedListener(o,n,r);const c=s&&t._eventsSpanMap.get(s),u=c||t._createSpan(a,n);if(u){s&&!c&&t._eventsSpanMap.set(s,u);const n=t._spansData.get(u),i=_t.with(Et.setSpan(_t.active(),u),(()=>{const s=t._invokeListener(r,this,e);return n.lastListenerEndHrTime=Ee(),s}));return s&&!c&&setTimeout((()=>{u.end(n.lastListenerEndHrTime)}),100),i}return s instanceof UIEvent&&s.isTrusted?_t.with(y,(()=>t._invokeListener(r,this,e))):t._invokeListener(r,this,e)};return t.addPatchedListener(this,n,r,a)?e.call(this,n,a,s):void 0}}_patchRemoveEventListener(){const t=this;return e=>function(n,r,s){const i=t.removePatchedListener(this,n,r);return i?e.call(this,n,i,s):e.call(this,n,r,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(){const t=this;return e=>function(...n){const r=_s(),s=e.apply(this,n);return r!==_s()&&t._updateSpanAsNavigation(Et.getSpan(_t.active())),s}}_unpatchHistoryApi(){rr(history.replaceState)&&this._unwrap(history,"replaceState"),rr(history.pushState)&&this._unwrap(history,"pushState"),rr(history.back)&&this._unwrap(history,"back"),rr(history.forward)&&this._unwrap(history,"forward"),rr(history.go)&&this._unwrap(history,"go")}_updateSpanAsNavigation(t){t&&"function"==typeof t.updateName&&(t.updateName(`Navigation: ${_s()}`),t.setAttribute("new.location.href",location.href))}enable(){if(this._isEnabled)return;this._isEnabled=!0,ft.debug("applying patch to",this.moduleName,this.version),this.__hashChangeHandler=()=>{this._updateSpanAsNavigation(this.lastCreatedSpan)},window.addEventListener("hashchange",this.__hashChangeHandler);this._getPatchableEventTargets().forEach((t=>{this._wrap(t,"addEventListener",this._patchAddEventListener()),this._wrap(t,"removeEventListener",this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){if(!this._isEnabled)return;this._isEnabled=!1,ft.debug("removing patch from",this.moduleName,this.version),window.removeEventListener("hashchange",this.__hashChangeHandler);this._getPatchableEventTargets().forEach((t=>{rr(t.addEventListener)&&this._unwrap(t,"addEventListener"),rr(t.removeEventListener)&&this._unwrap(t,"removeEventListener")})),this._unpatchHistoryApi()}}var ms;!function(t){var e,n;!function(t){var e;(function(t){t[t.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",t[t.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",t[t.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})((e=t.v1||(t.v1={})).AggregationTemporality||(e.AggregationTemporality={}))}(t.metrics||(t.metrics={})),function(t){var e,n,r;e=t.v1||(t.v1={}),n=e.ConstantSampler||(e.ConstantSampler={}),(r=n.ConstantDecision||(n.ConstantDecision={}))[r.ALWAYS_OFF=0]="ALWAYS_OFF",r[r.ALWAYS_ON=1]="ALWAYS_ON",r[r.ALWAYS_PARENT=2]="ALWAYS_PARENT",function(t){!function(t){t[t.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",t[t.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",t[t.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",t[t.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",t[t.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",t[t.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"}(t.SpanKind||(t.SpanKind={}))}(e.Span||(e.Span={}))}(t.trace||(t.trace={})),e=t.common||(t.common={}),function(t){t[t.STRING=0]="STRING",t[t.INT=1]="INT",t[t.DOUBLE=2]="DOUBLE",t[t.BOOL=3]="BOOL"}((n=e.v1||(e.v1={})).ValueType||(n.ValueType={}))}(ms||(ms={}));class fs extends Error{constructor(t,e,n){super(t),this.name="OTLPExporterError",this.data=n,this.code=e}}const gs={[J.INTERNAL]:ms.trace.v1.Span.SpanKind.SPAN_KIND_INTERNAL,[J.SERVER]:ms.trace.v1.Span.SpanKind.SPAN_KIND_SERVER,[J.CLIENT]:ms.trace.v1.Span.SpanKind.SPAN_KIND_CLIENT,[J.PRODUCER]:ms.trace.v1.Span.SpanKind.SPAN_KIND_PRODUCER,[J.CONSUMER]:ms.trace.v1.Span.SpanKind.SPAN_KIND_CONSUMER};let Ts=1/0;function Ss(t){return Object.keys(t).map((e=>function(t,e){const n=vs(e);return{key:t,value:n}}(e,t[e])))}function vs(t){const e={};return"string"==typeof t?e.stringValue=t:"boolean"==typeof t?e.boolValue=t:"number"==typeof t&&t<=2147483647&&t>=-2147483648&&Number.isInteger(t)?e.intValue=t:"number"==typeof t?e.doubleValue=t:Array.isArray(t)?e.arrayValue={values:t.map((t=>vs(t)))}:t&&(e.kvlistValue={values:Ss(t)}),e}function bs(t,e){return t.links.map((t=>({traceId:e?t.context.traceId:Yt(t.context.traceId),spanId:e?t.context.spanId:Yt(t.context.spanId),attributes:Ss(t.attributes||{}),droppedAttributesCount:0})))}function Rs(t){const e={code:t.code};return void 0!==t.message&&(e.message=t.message),e}function As(t,e={}){return{attributes:Ss(Object.assign({},e,t?t.attributes:{})),droppedAttributesCount:0}}function ys(t){const e=gs[t];return"number"==typeof e?e:ms.trace.v1.Span.SpanKind.SPAN_KIND_UNSPECIFIED}function Os(t){if(t)return t.serialize()}function Ns(t,e,n){return{resourceSpans:Ls(function(t){return t.reduce(((t,e)=>{let n=t.get(e.resource);n||(n=new Map,t.set(e.resource,n));let r=n.get(e.instrumentationLibrary);return r||(r=new Array,n.set(e.instrumentationLibrary,r)),r.push(e),t}),new Map)}(t),Object.assign({},e.attributes),n)}}function ws(t,e,n){return{spans:e.map((t=>function(t,e){return{traceId:e?t.spanContext().traceId:Yt(t.spanContext().traceId),spanId:e?t.spanContext().spanId:Yt(t.spanContext().spanId),parentSpanId:t.parentSpanId?e?t.parentSpanId:Yt(t.parentSpanId):void 0,traceState:Os(t.spanContext().traceState),name:t.name,kind:ys(t.kind),startTimeUnixNano:fe(t.startTime),endTimeUnixNano:fe(t.endTime),attributes:Ss(t.attributes),droppedAttributesCount:0,events:(n=t.events,n.map((t=>({timeUnixNano:fe(t.time),name:t.name,attributes:Ss(t.attributes||{}),droppedAttributesCount:0})))),droppedEventsCount:0,status:Rs(t.status),links:bs(t,e),droppedLinksCount:0};var n}(t,n))),instrumentationLibrary:t}}function Ls(t,e,n){return Array.from(t,(([t,r])=>({resource:As(t,e),instrumentationLibrarySpans:Array.from(r,(([t,e])=>ws(t,e,n)))})))}const Ps="/v1/traces";class Is extends class extends class{constructor(t={}){this._isShutdown=!1,this._shuttingDownPromise=Promise.resolve(),this._sendingPromises=[],this.url=this.getDefaultUrl(t),"string"==typeof t.hostname&&(this.hostname=t.hostname),this.attributes=t.attributes,this.shutdown=this.shutdown.bind(this),this._concurrencyLimit="number"==typeof t.concurrencyLimit?t.concurrencyLimit:1/0,this.onInit(t)}export(t,e){this._isShutdown?e({code:Te.FAILED,error:new Error("Exporter has been shutdown")}):this._sendingPromises.length>=this._concurrencyLimit?e({code:Te.FAILED,error:new Error("Concurrent export limit reached")}):this._export(t).then((()=>{e({code:Te.SUCCESS})})).catch((t=>{e({code:Te.FAILED,error:t})}))}_export(t){return new Promise(((e,n)=>{try{ft.debug("items to be sent",t),this.send(t,e,n)}catch(t){n(t)}}))}shutdown(){return this._isShutdown?(ft.debug("shutdown already started"),this._shuttingDownPromise):(this._isShutdown=!0,ft.debug("shutdown started"),this._shuttingDownPromise=new Promise(((t,e)=>{Promise.resolve().then((()=>this.onShutdown())).then((()=>Promise.all(this._sendingPromises))).then((()=>{t()})).catch((t=>{e(t)}))})),this._shuttingDownPromise)}}{constructor(t={}){super(t),this._useXHR=!1,this._useXHR=!!t.headers||"function"!=typeof navigator.sendBeacon,this._useXHR?this._headers=Object.assign({},function(t={}){const e={};return Object.entries(t).forEach((([t,n])=>{void 0!==n?e[t]=String(n):ft.warn(`Header "${t}" has wrong value and will be ignored`)})),e}(t.headers),At(Gt().OTEL_EXPORTER_OTLP_HEADERS)):this._headers={}}onInit(){window.addEventListener("unload",this.shutdown)}onShutdown(){window.removeEventListener("unload",this.shutdown)}send(t,e,n){if(this._isShutdown)return void ft.debug("Shutdown already started. Cannot send objects");const r=this.convert(t),s=JSON.stringify(r),i=new Promise(((t,e)=>{!this._useXHR&&function(t,e,n){const r=new Blob([t],n);return r.size{i.setRequestHeader(t,e)})),i.send(t),i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE)if(i.status>=200&&i.status<=299)ft.debug("xhr success",t),r();else{const t=new fs(`Failed to export with XHR (status: ${i.status})`,i.status);s(t)}}}(s,this.url,this._headers,t,e)})).then(e,n);this._sendingPromises.push(i);const o=()=>{const t=this._sendingPromises.indexOf(i);this._sendingPromises.splice(t,1)};i.then(o,o)}}{constructor(t={}){super(t),this._headers=Object.assign(this._headers,At(Gt().OTEL_EXPORTER_OTLP_TRACES_HEADERS))}convert(t){return Ns(t,this,!0)}getDefaultUrl(t){return"string"==typeof t.url?t.url:Gt().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length>0?Gt().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:Gt().OTEL_EXPORTER_OTLP_ENDPOINT.length>0?(e=Gt().OTEL_EXPORTER_OTLP_ENDPOINT,n=Ps,e.match(/v\d\/(traces|metrics)$/)?e:e+n):"http://localhost:55681/v1/traces";var e,n}}class Cs{constructor(t){this._exporter=t}export(t,e){const n=(r=Ee(),Math.round(1e3*r[0]+r[1]/1e6));var r;t.forEach((t=>{t.resource.attributes["sumologic.telemetry.sdk.export_timestamp"]=n})),this._exporter.export(t,e)}shutdown(){return un(this,void 0,void 0,(function*(){return this._exporter.shutdown()}))}}const Ms="document.visibilityState",Ds={visible:"pageshow",hidden:"pagehide"},Us=[];let xs=document.visibilityState,Bs=xs;const ks=()=>{const t=document.visibilityState;if(Bs!==t){Bs=t;const e=Ee();Us.push({timestampInNanoseconds:fe(e),timestampInHrTime:e,state:t}),Us.length>100&&Us.shift()}};document.addEventListener("visibilitychange",(()=>{ks()})),window.addEventListener("pagehide",(()=>{ks()})),window.addEventListener("pageshow",(()=>{ks()}));const Vs=1e7;let Fs=[],js=[];const Hs=(t,e,n)=>t+Vs>=e&&t-Vs<=n,Gs=(t,e)=>{t.parentSpanId=e.spanContext().spanId,t.spanContext().traceId=e.spanContext().traceId},Ys=(t,e)=>{if("@opentelemetry/instrumentation-long-task"===t.instrumentationLibrary.name){if(!t.parentSpanId){const e=(t=>{const e=fe(t);for(let t=Fs.length-1;t>=0;t-=1){const n=Fs[t];if(Hs(e,fe(n.startTime),fe(n.endTime)))return n}})(t.startTime);if(!e)return js.push(t),void(js.length>10&&js.shift());Gs(t,e)}}else Fs.push(t),Fs.length>100&&Fs.shift(),((t,e)=>{const n=fe(t.startTime),r=fe(t.endTime);for(let s=js.length-1;s>=0;s-=1){const i=js[s];Hs(fe(i.startTime),n,r)&&(js.splice(s,1),Gs(i,t),e(i))}})(t,e);e(t)},$s=["click","dblclick","submit","reset","pause","play","dragstart","dragend","drop"],Xs="root_span.operation",zs="root_span.http.url",Ws="xhr.is_root_span",qs="http.action_type",Ks=t=>t.name.startsWith("HTTP ")&&t.kind===J.CLIENT,Qs=t=>{var e;if(t)return"documentLoad"===(e=t).name&&"@opentelemetry/instrumentation-document-load"===e.instrumentationLibrary.name?"document_loads":t.attributes[Ws]?(t=>t.name.startsWith("Navigation: ")&&"@opentelemetry/instrumentation-user-interaction"===t.instrumentationLibrary.name)(t)?"route_changes":"xhr_requests":void 0},Zs=t=>t.attributes["new.location.href"]||t.attributes["location.href"],Js={},ti=[],ei=new WeakMap,ni=t=>Js[t.spanContext().traceId],ri=t=>t.name.startsWith("HTTP ")&&t.kind===J.CLIENT,si=(t,e)=>{const n=Zs(e);t.attributes[Xs]=e.name,n&&(t.attributes[zs]=n)};var ii;!function(t){t[t.DROP_ROOT_SPAN=0]="DROP_ROOT_SPAN"}(ii||(ii={}));const oi=[(t,e,n)=>{if(n.shouldDropSingleUserInteractionTraces&&"@opentelemetry/instrumentation-user-interaction"===t.instrumentationLibrary.name&&1===e.length)return ii.DROP_ROOT_SPAN},(t,e)=>{const n=e.filter((t=>"@opentelemetry/instrumentation-long-task"===t.instrumentationLibrary.name&&"longtask"===t.name));if(n.length>0){const e=n.map((t=>fe(t.duration))).reduce(((t,e)=>t+e),0);t.attributes["http.longtasks_sum"]=e}},(t,e)=>{const n=e.filter(Ks).sort(((t,e)=>fe(t.startTime)-fe(e.startTime)));if(!n.length)return;const[r]=n,s=n[n.length-1];t.attributes["http.time_to_first_xhr"]=fe(r.startTime)-fe(t.startTime),t.attributes["http.time_to_last_xhr"]=fe(s.endTime)-fe(t.startTime);const i=Math.max(...e.map((t=>fe(t.endTime))));t.attributes["http.time_to_xhr_processing_end"]=i-fe(t.startTime);const o=[];n.forEach((t=>{const e=fe(t.startTime),n=fe(t.endTime),r=o[o.length-1];!r||e>r[1]?o.push([e,n]):n>r[1]&&(r[1]=n)})),t.attributes["http.time_in_xhr_calls"]=o.reduce(((t,[e,n])=>t+(n-e)),0)}],ai={},ci="sumoLogicOpenTelemetryRumSessionId",ui=({sessionId:t,lastActivityTimestamp:e})=>{document.cookie=`${ci}=${t}-${e}; path=/`},li=new $t;let di=(()=>{const t=document.cookie.split("; ").find((t=>t.startsWith(`${ci}=`)));if(!t)return;const[e,n]=t.split("=")[1].split("-");return{sessionId:e,lastActivityTimestamp:parseInt(n,10)}})();const hi=()=>{const t=Date.now();if(di){const e=t-di.lastActivityTimestamp;e>3e5?di=void 0:e>3e4&&(di.lastActivityTimestamp=t,ui(di))}return di||(di={sessionId:li.generateTraceId(),lastActivityTimestamp:t},ui(di)),di.sessionId};class pi extends pn{constructor(t,e){var n,r;super(t,e),this.shouldCollectSessionId=null===(n=null==e?void 0:e.collectSessionId)||void 0===n||n,this.shouldDropSingleUserInteractionTraces=null===(r=null==e?void 0:e.dropSingleUserInteractionTraces)||void 0===r||r,this.traceProcessor=(t=>{const e=()=>{Object.values(ai).forEach((t=>{n(t)}))};document.addEventListener("visibilitychange",(()=>{e()})),window.addEventListener("pagehide",(()=>{e()}));const n=({traceId:e,rootSpan:n,send:r,spans:s})=>{if(delete ai[e],!n||!r)return;let i=!0;oi.forEach((e=>{e(n,s,t)===ii.DROP_ROOT_SPAN&&(i=!1)})),i&&r()},r=t=>{clearTimeout(t.timeout),t.timeout=setTimeout((()=>{n(t)}),3e4)};return{onStart:(t,e)=>{const n=t.spanContext().traceId;let s=ai[n];s||(s={traceId:n,timeout:-1,spans:[]},ai[n]=s),t.parentSpanId||s.rootSpan||(s.rootSpan=t),r(s)},onEnd:(t,e)=>{let n=!0;const s=t,i=s.spanContext().traceId,o=ai[i];o&&(o.spans.push(s),o.rootSpan===s&&(n=!1,o.send=()=>{e(t)}),r(o)),n&&e(t)}}})(this)}onStart(t,e){((t,e)=>{t.setAttribute(Ms,xs);const n=fe(t.startTime);for(let e=Us.length-1;e>=0;e-=1){const{timestampInNanoseconds:r,state:s}=Us[e];if(r<=n){t.setAttribute(Ms,s);break}}})(t),((t,e)=>{const{parentSpanId:n}=t;if(ri(t)&&n){const e=ni(t);e&&(e.attributes[Ws]=!0)}if(!n){const{traceId:e}=t.spanContext();if(Js[e]=t,ti.push(e),ti.length>50){const t=ti.shift();delete Js[t]}}})(t),this.traceProcessor.onStart(t,e),this.shouldCollectSessionId&&((t,e)=>{t.setAttribute("rum.session_id",hi())})(t),t.setAttribute("location.href",location.href),super.onStart(t)}onEnd(t){(t=>{const e=t,n=fe(e.startTime),r=t.parentSpanId?fe(e.endTime):1/0;for(let t=Us.length-1;t>=0;t-=1){const{timestampInNanoseconds:s,timestampInHrTime:i,state:o}=Us[t];if(s=n&&s<=r&&(e.events.push({name:Ds[o],attributes:void 0,time:i}),"hidden"===o&&(e.attributes[Ms]=o))}})(t),Ys(t,(t=>{(t=>{const e=t,n=ei.get(e);n&&n.forEach((t=>si(t,e)));const r=ri(e),s=(t=>"@opentelemetry/instrumentation-long-task"===t.instrumentationLibrary.name)(e);if(t.parentSpanId&&(r||s)){const n=ni(e);if(n){if(s){const e=Qs(n);e&&(t.attributes[qs]=e)}if(n.ended)si(e,n);else{const t=ei.get(n);t?t.push(e):ei.set(n,[e])}}}})(t),this.traceProcessor.onEnd(t,(t=>{super.onEnd(t)}))}))}}const _i="0.27.0",Ei="longtask";class mi extends er{constructor(t={}){super("@opentelemetry/instrumentation-long-task",_i,t),this.component="long-task",this.version=_i,this.moduleName=this.component}init(){}isSupported(){return!("undefined"==typeof PerformanceObserver||!PerformanceObserver.supportedEntryTypes)&&PerformanceObserver.supportedEntryTypes.includes(Ei)}_createSpanFromEntry(t){const e=this.tracer.startSpan(Ei,{startTime:Ee(t.startTime)});e.setAttribute("component",this.component),e.setAttribute("http.url",location.href),e.setAttribute("longtask.name",t.name),e.setAttribute("longtask.entry_type",t.entryType),e.setAttribute("longtask.duration",t.duration),Array.isArray(t.attribution)&&t.attribution.forEach(((n,r)=>{const s=t.attribution.length>1?`longtask.attribution[${r}]`:"longtask.attribution";e.setAttribute(`${s}.name`,n.name),e.setAttribute(`${s}.entry_type`,n.entryType),e.setAttribute(`${s}.start_time`,n.startTime),e.setAttribute(`${s}.duration`,n.duration),e.setAttribute(`${s}.container_type`,n.containerType),e.setAttribute(`${s}.container_src`,n.containerSrc),e.setAttribute(`${s}.container_id`,n.containerId),e.setAttribute(`${s}.container_name`,n.containerName)})),e.end(Ee(t.startTime+t.duration))}enable(){this.isSupported()?this._observer||(this._observer=new PerformanceObserver((t=>{t.getEntries().forEach((t=>this._createSpanFromEntry(t)))})),this._observer.observe({type:Ei,buffered:!0})):this._diag.debug("Environment not supported")}disable(){this._observer&&(this._observer.disconnect(),this._observer=void 0)}}var fi,gi="4.0.0";!function(t){t[t.SEVERITY_NUMBER_UNSPECIFIED=0]="SEVERITY_NUMBER_UNSPECIFIED",t[t.SEVERITY_NUMBER_TRACE=1]="SEVERITY_NUMBER_TRACE",t[t.SEVERITY_NUMBER_TRACE2=2]="SEVERITY_NUMBER_TRACE2",t[t.SEVERITY_NUMBER_TRACE3=3]="SEVERITY_NUMBER_TRACE3",t[t.SEVERITY_NUMBER_TRACE4=4]="SEVERITY_NUMBER_TRACE4",t[t.SEVERITY_NUMBER_DEBUG=5]="SEVERITY_NUMBER_DEBUG",t[t.SEVERITY_NUMBER_DEBUG2=6]="SEVERITY_NUMBER_DEBUG2",t[t.SEVERITY_NUMBER_DEBUG3=7]="SEVERITY_NUMBER_DEBUG3",t[t.SEVERITY_NUMBER_DEBUG4=8]="SEVERITY_NUMBER_DEBUG4",t[t.SEVERITY_NUMBER_INFO=9]="SEVERITY_NUMBER_INFO",t[t.SEVERITY_NUMBER_INFO2=10]="SEVERITY_NUMBER_INFO2",t[t.SEVERITY_NUMBER_INFO3=11]="SEVERITY_NUMBER_INFO3",t[t.SEVERITY_NUMBER_INFO4=12]="SEVERITY_NUMBER_INFO4",t[t.SEVERITY_NUMBER_WARN=13]="SEVERITY_NUMBER_WARN",t[t.SEVERITY_NUMBER_WARN2=14]="SEVERITY_NUMBER_WARN2",t[t.SEVERITY_NUMBER_WARN3=15]="SEVERITY_NUMBER_WARN3",t[t.SEVERITY_NUMBER_WARN4=16]="SEVERITY_NUMBER_WARN4",t[t.SEVERITY_NUMBER_ERROR=17]="SEVERITY_NUMBER_ERROR",t[t.SEVERITY_NUMBER_ERROR2=18]="SEVERITY_NUMBER_ERROR2",t[t.SEVERITY_NUMBER_ERROR3=19]="SEVERITY_NUMBER_ERROR3",t[t.SEVERITY_NUMBER_ERROR4=20]="SEVERITY_NUMBER_ERROR4",t[t.SEVERITY_NUMBER_FATAL=21]="SEVERITY_NUMBER_FATAL",t[t.SEVERITY_NUMBER_FATAL2=22]="SEVERITY_NUMBER_FATAL2",t[t.SEVERITY_NUMBER_FATAL3=23]="SEVERITY_NUMBER_FATAL3",t[t.SEVERITY_NUMBER_FATAL4=24]="SEVERITY_NUMBER_FATAL4"}(fi||(fi={}));const Ti=t=>{switch(typeof t){case"number":return Number.isInteger(t)?{intValue:t}:{doubleValue:t};case"boolean":return{boolValue:t};case"object":if(Array.isArray(t))return{arrayValue:{values:t.map((t=>Ti(t)))}};if(null!=t)return{kvlistValue:{values:Object.entries(t).map((([t,e])=>Si(t,e)))}};default:return{stringValue:String(t)}}},Si=(t,e)=>({key:t,value:Ti(e)}),vi=t=>Object.entries(t).map((([t,e])=>Si(t,e)));let bi=1/0;class Ri{constructor({resource:t,attributes:e,collectorUrl:n,maxQueueSize:r,scheduledDelayMillis:s}){this.onVisibilityChange=()=>{"hidden"===document.visibilityState&&this.export()},this.onPageHide=()=>{this.export()},this.recordCustomError=(t,e)=>{this.recordLog({type:"customError",message:t,attributes:e})},this.resource=t,this.defaultAttributes=e,this.collectorUrl=n,this.maxQueueSize=r,this.scheduledDelayMillis=s,this.logs=[]}enable(){null!=document&&(this.disable(),document.addEventListener("visibilitychange",this.onVisibilityChange),document.addEventListener("pagehide",this.onPageHide))}disable(){document.removeEventListener("visibilitychange",this.onVisibilityChange),document.removeEventListener("pagehide",this.onPageHide)}exportWhenNeeded(){this.logs.length>=this.maxQueueSize?this.export():void 0===this.timer&&(this.timer=Number(setTimeout((()=>this.export()),this.scheduledDelayMillis)))}recordLog(t){var e;const n=[...vi(this.defaultAttributes),Si("type",t.type),Si("http.url",location.href)],r=Et.getSpan(_t.active());if(r&&(t=>"name"in t&&"instrumentationLibrary"in t)(r)){const t=null===(e=(t=>{const e=ai[t];if(e){const{rootSpan:t,spans:n}=e;return{rootSpan:t,spans:n}}})(r.spanContext().traceId))||void 0===e?void 0:e.rootSpan;if(t){n.push(Si(Xs,t.name));const e=Zs(t);e&&n.push(Si(zs,e));const r=Qs(t);r&&n.push(Si(qs,r))}}t.element&&n.push(Si("element.xpath",t.element.xpath)),t.error&&(n.push(Si("error.name",t.error.name)),n.push(Si("error.message",t.error.message)),t.error.stack&&n.push(Si("error.stack",t.error.stack))),t.arguments&&n.push(Si("arguments",t.arguments)),t.attributes&&Object.entries(t.attributes).forEach((([t,e])=>{n.push(Si(t,e))})),this.logs.push({timeUnixNano:fe(Ee()),severityNumber:fi.SEVERITY_NUMBER_ERROR,body:{stringValue:t.message},attributes:n,droppedAttributesCount:0,traceId:null==r?void 0:r.spanContext().traceId,spanId:null==r?void 0:r.spanContext().spanId}),this.exportWhenNeeded()}export(){clearTimeout(this.timer),this.timer=void 0;const{logs:t}=this;if(!t.length)return;this.logs=[];const e=JSON.stringify({resourceLogs:[{resource:{attributes:vi(this.resource.attributes)},instrumentationLibraryLogs:[{instrumentationLibrary:{name:"@sumologic/opentelemetry-rum",version:gi},logs:t}]}]});((t,e)=>{const n=new Blob([e],{type:"application/json"});(n.size>=bi||!navigator.sendBeacon(t,n))&&(bi=n.size,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:e}))})(this.collectorUrl,e)}}const Ai=(t,e)=>t.length>e?`${t.slice(0,e)}...`:t,yi=t=>t instanceof Error?{name:t.name,message:t.message,stack:t.stack?Ai(t.stack,5e3):void 0}:void 0,Oi=(t,e=0)=>{if("string"==typeof t){const n=Ai(t,500);return e>0?`"${n}"`:n}return Array.isArray(t)?e>0?"...":`[${t.map((t=>Oi(t,e+1))).join(", ")}]`:t instanceof Error?Oi({name:t.name,message:t.message},e):null!=t&&"object"==typeof t?e>0?"...":`{ ${Object.getOwnPropertyNames(t).map((n=>`${n}: ${Oi(t[n],e+1)}`)).join(", ")} }`:String(t)},Ni=(t,e=new Set)=>{const n=!e.has(t);if(e.add(t),Array.isArray(t))return t.map((t=>Ni(t,e)));if(null!=t&&"object"==typeof t){const r={};return Object.getOwnPropertyNames(t).forEach((s=>{const i=t[s];r[s]=e.has(i)&&(i!==t||n)?"[Circular]":Ni(i)})),r}return t};class wi{constructor({exporter:t}){this.isEnabled=!1,this.onError=t=>{this.exporter.recordLog({type:"uncaughtException",message:t.message,error:yi(t.error)})},this.onUnhandledRejection=({reason:t})=>{if(!t)return;const e=yi(t);this.exporter.recordLog({type:"unhandledRejection",message:e?`Unhandled rejection ${t}`:String(t),error:e})},this.onDocumentError=({target:t})=>{if(!t)return;const e=On(t);e&&this.exporter.recordLog({type:"documentError",message:`Uncaught error in element ${e}`,element:{xpath:e}})},this.onConsoleError=t=>{const e=t.find(yi),n=t.length>3||t.find((t=>null!=t&&"object"==typeof t&&!(t instanceof Error)))?t.map((t=>Ni(t))):void 0;this.exporter.recordLog({type:"consoleError",message:t.map((t=>Oi(t))).join(" "),arguments:n,error:e})},this.exporter=t;const e=console.error;console.error=(...t)=>{this.isEnabled&&this.onConsoleError(t),e.apply(console,t)}}enable(){this.disable(),window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),document.documentElement.addEventListener("error",this.onDocumentError,{capture:!0}),this.isEnabled=!0}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),document.documentElement.removeEventListener("error",this.onDocumentError,{capture:!0}),this.isEnabled=!1}}const Li=t=>"number"==typeof t?t:null!=t&&Number.isFinite(+t)?+t:void 0;var Pi;const Ii="object"==typeof window&&null!=window;Ii&&(window.sumoLogicOpenTelemetryRum=window.sumoLogicOpenTelemetryRum||{});const Ci=new class{constructor(){this._enabled=!1,this._currentContext=y}_bindFunction(t=y,e){const n=this,r=function(...r){var s;return n.with(null!==(s=Mr(this))&&void 0!==s?s:t,(()=>e.apply(this,r)))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),r}active(){return this._currentContext}bind(t=this.active(),e){return"function"==typeof e?this._bindFunction(t,e):e}disable(){return this._enabled?(tr.unwrap(window,"Promise"),tr.unwrap(window,"setTimeout"),tr.unwrap(window,"setInterval"),null!=window.setImmediate&&tr.unwrap(window,"setImmediate"),tr.unwrap(window,"requestAnimationFrame"),null!=window.queueMicrotask&&tr.unwrap(window,"queueMicrotask"),Or(),self.MessageChannel&&self.MessagePort&&(tr.unwrap(window,"MessageChannel"),tr.unwrap(MessagePort.prototype,"postMessage")),wr.forEach((t=>{globalThis[t]&&tr.unwrap(globalThis,t)})),this._currentContext=y,this._enabled=!1,this):this}enable(){return this._enabled||(Pr(this),Cr(this),yr(this),Nr(this),Lr(this),this._enabled=!0,this._currentContext=y),this}with(t,e,n,...r){const s=this._currentContext;this._currentContext=null!=t?t:y;try{return e.apply(n,r)}finally{this._currentContext=s}}};Ci.enable();const Mi=({collectionSourceUrl:t,authorizationToken:e,serviceName:n,applicationName:r,deploymentEnvironment:s,defaultAttributes:i,samplingProbability:o=1,bufferMaxSpans:a=2048,maxExportBatchSize:c=50,bufferTimeout:u=2e3,ignoreUrls:l=[],propagateTraceHeaderCorsUrls:d=[],collectSessionId:h,dropSingleUserInteractionTraces:p,collectErrors:_=!0})=>{var E;if(!t)throw new Error("collectionSourceUrl needs to be defined to initialize Sumo Logic OpenTelemetry RUM");const m=null!==(E=Li(o))&&void 0!==E?E:1,f={[ae]:null!=n?n:"unknown","sumologic.rum.version":gi};r&&(f.application=r),s&&(f[oe]=s);const g=new ln(f),T=g.merge(new ln({"sampling.probability":m})),S=new gn({resource:T,sampler:new Me(m)});S.register({contextManager:Ci,propagator:new we});const v=Object.assign({},i),b=(t=>{const e=new URL(t);return e.pathname=e.pathname.replace(/\/v1\/(traces|metrics|logs)\/?$/,""),e.pathname.endsWith("/")||(e.pathname+="/"),e.href})(t),R=new Is({url:`${b}v1/traces`,attributes:v,headers:e?{Authorization:e}:void 0}),A=new Cs(R);S.addSpanProcessor(new pi(A,{maxQueueSize:a,maxExportBatchSize:c,scheduledDelayMillis:u,collectSessionId:h,dropSingleUserInteractionTraces:p}));const y=g.merge(new ln({[re]:navigator.userAgent})),O=new Ri({resource:y,attributes:v,collectorUrl:`${b}v1/logs`,maxQueueSize:a,scheduledDelayMillis:u}),N=_?new wi({exporter:O}):void 0;let w;const L=()=>{w&&(w(),null==N||N.disable(),O.disable(),w=void 0)},P=()=>{L(),O.enable(),null==N||N.enable(),w=Xn({tracerProvider:S,instrumentations:[new mi({enabled:!1}),new us({enabled:!1}),new Es({enabled:!1,eventNames:$s,shouldPreventSpanCreation:(t,e,n)=>{const r=((t,e)=>{let n="",r=e;for(;r&&!n;)n=r.getAttribute("aria-label")||r.id||r.textContent||"",n=n.trim(),r=r.parentElement;if(n)return n.length>20&&(n=`${n.slice(0,17)}...`),`${t} on '${n}'`})(t,e);return r&&n.updateName(r),!1}}),new or({enabled:!1,propagateTraceHeaderCorsUrls:d,ignoreUrls:[t,...l]}),new ur({enabled:!1,propagateTraceHeaderCorsUrls:d,ignoreUrls:l})]})},I=S.getTracer("@sumologic/opentelemetry-rum");P();const C={readyListeners:[],onReady:t=>{t()},api:Tt,tracer:I,registerInstrumentations:P,disableInstrumentations:L,setDefaultAttribute:(t,e)=>{v[t]=e},getCurrentSessionId:hi,recordError:O.recordCustomError};return Ii&&Object.assign(window.sumoLogicOpenTelemetryRum,C),C};if(Ii){window.sumoLogicOpenTelemetryRum.initialize=Mi;const t=null===(Pi=window.sumoLogicOpenTelemetryRum)||void 0===Pi?void 0:Pi.readyListeners;Array.isArray(t)&&t.forEach((t=>t()))}const Di=t=>{if(t)try{return JSON.parse(t)}catch(t){return}},Ui=t=>{var e;return null===(e=Di(t)||(t=>{if("string"==typeof t)return t.split(",").map((t=>t.trim()))})(t))||void 0===e?void 0:e.map((t=>new RegExp(t)))};if("object"==typeof document&&null!=document&&document.currentScript&&document.currentScript.dataset.collectionSourceUrl){const{collectionSourceUrl:t,authorizationToken:e,serviceName:n,applicationName:r,defaultAttributes:s,samplingProbability:i,bufferMaxSpans:o,bufferTimeout:a,ignoreUrls:c,propagateTraceHeaderCorsUrls:u}=document.currentScript.dataset;window.opentelemetry=Mi({collectionSourceUrl:t,authorizationToken:e,serviceName:n,applicationName:r,defaultAttributes:Di(s),samplingProbability:Li(i),bufferMaxSpans:Li(o),bufferTimeout:Li(a),ignoreUrls:Ui(c),propagateTraceHeaderCorsUrls:Ui(u)||[/.*/]})}t.initialize=Mi,Object.defineProperty(t,"__esModule",{value:!0})}({});
//# sourceMappingURL=browser.js.map