@safaricom-mxl/web-sdk 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.cjs +21 -20
  2. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.cjs.map +1 -1
  3. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.js +17 -16
  4. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.js.map +1 -1
  5. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.cjs +32 -0
  6. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.cjs.map +1 -0
  7. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.d.cts +29 -0
  8. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.d.cts.map +1 -0
  9. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.d.ts +29 -0
  10. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.d.ts.map +1 -0
  11. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.js +31 -0
  12. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.js.map +1 -0
  13. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.cjs +34 -0
  14. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.cjs.map +1 -0
  15. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.cts +34 -0
  16. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.cts.map +1 -0
  17. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts +34 -0
  18. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts.map +1 -0
  19. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.js +31 -0
  20. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.js.map +1 -0
  21. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.cjs +5 -5
  22. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.cjs.map +1 -1
  23. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.cts +1 -1
  24. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.cts.map +1 -1
  25. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.ts +1 -1
  26. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.ts.map +1 -1
  27. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.js +2 -1
  28. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.js.map +1 -1
  29. package/dist/mxl-web-sdk.js +2 -2
  30. package/dist/mxl-web-sdk.js.map +1 -1
  31. package/dist/resources/sdkConstants.cjs +1 -1
  32. package/dist/resources/sdkConstants.cjs.map +1 -1
  33. package/dist/resources/sdkConstants.d.cts +1 -1
  34. package/dist/resources/sdkConstants.d.ts +1 -1
  35. package/dist/resources/sdkConstants.js +1 -1
  36. package/dist/resources/sdkConstants.js.map +1 -1
  37. package/dist/sdk/initSDK.cjs +1 -2
  38. package/dist/sdk/initSDK.cjs.map +1 -1
  39. package/dist/sdk/initSDK.d.cts.map +1 -1
  40. package/dist/sdk/initSDK.d.ts.map +1 -1
  41. package/dist/sdk/initSDK.js +1 -2
  42. package/dist/sdk/initSDK.js.map +1 -1
  43. package/package.json +14 -15
@@ -1,3 +1,3 @@
1
- "use strict";window.MXLWebSdk=window.MXLWebSdk||(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i,a=n((()=>{i=`1.9.1`}));function o(e){let t=new Set([e]),n=new Set,r=e.match(s);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(s);if(!r)return a(e);let c={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return c.prerelease!=null||i.major!==c.major?a(e):i.major===0?i.minor===c.minor&&i.patch<=c.patch?o(e):a(e):i.minor<=c.minor?o(e):a(e)}}var s,c,l=n((()=>{a(),s=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,c=o(i)}));function u(e,t,n,r=!1){var a;let o=h[m]=(a=h[m])==null?{version:i}:a;if(!r&&o[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(o.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${i}`);return n.error(t.stack||t.message),!1}return o[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${i}.`),!0}function d(e){var t,n;let r=(t=h[m])==null?void 0:t.version;if(!(!r||!c(r)))return(n=h[m])==null?void 0:n[e]}function f(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${i}.`);let n=h[m];n&&delete n[e]}var p,m,h,g=n((()=>{a(),l(),p=i.split(`.`)[0],m=Symbol.for(`opentelemetry.js.api.${p}`),h=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function _(e,t,n){let r=d(`diag`);if(r)return r[e](t,...n)}var v,ee=n((()=>{g(),v=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return _(`debug`,this._namespace,e)}error(...e){return _(`error`,this._namespace,e)}info(...e){return _(`info`,this._namespace,e)}warn(...e){return _(`warn`,this._namespace,e)}verbose(...e){return _(`verbose`,this._namespace,e)}}})),y,b=n((()=>{(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`})(y||(y={}))}));function te(e,t){e<y.NONE?e=y.NONE:e>y.ALL&&(e=y.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,y.ERROR),warn:n(`warn`,y.WARN),info:n(`info`,y.INFO),debug:n(`debug`,y.DEBUG),verbose:n(`verbose`,y.VERBOSE)}}var ne=n((()=>{b()})),x,S,C=n((()=>{ee(),ne(),b(),g(),x=`diag`,S=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=d(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:y.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=d(`diag`),s=te((i=n.logLevel)==null?y.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return u(`diag`,s,t,!0)},t.disable=()=>{f(x,t)},t.createComponentLogger=e=>new v(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),w,re=n((()=>{w=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}}));function ie(e={}){return new w(new Map(Object.entries(e)))}var ae=n((()=>{C(),re(),S.instance()}));function oe(e){return Symbol.for(e)}var se,T,ce=n((()=>{se=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},T=new se})),le,E,ue,de=n((()=>{if(le=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],E={},typeof console<`u`)for(let e of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[e]==`function`&&(E[e]=console[e]);ue=class{constructor(){function e(e){return function(...t){let n=E[e];if(typeof n!=`function`&&(n=E.log),typeof n!=`function`&&console&&(n=console[e],typeof n!=`function`&&(n=console.log)),typeof n==`function`)return n.apply(console,t)}}for(let t=0;t<le.length;t++)this[le[t].n]=e(le[t].c)}}}));function D(){return xe}var fe,pe,me,he,ge,O,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke=n((()=>{fe=class{constructor(){}createGauge(e,t){return Ce}createHistogram(e,t){return we}createCounter(e,t){return Se}createUpDownCounter(e,t){return Te}createObservableGauge(e,t){return De}createObservableCounter(e,t){return Ee}createObservableUpDownCounter(e,t){return Oe}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},pe=class{},me=class extends pe{add(e,t){}},he=class extends pe{add(e,t){}},ge=class extends pe{record(e,t){}},O=class extends pe{record(e,t){}},_e=class{addCallback(e){}removeCallback(e){}},ve=class extends _e{},ye=class extends _e{},be=class extends _e{},xe=new fe,Se=new me,Ce=new ge,we=new O,Te=new he,Ee=new ve,De=new ye,Oe=new be})),Ae,je,Me=n((()=>{Ae={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},je={set(e,t,n){e!=null&&(e[t]=n)}}})),Ne,Pe=n((()=>{ce(),Ne=class{active(){return T}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Fe,Ie,Le,Re=n((()=>{Pe(),g(),C(),Fe=`context`,Ie=new Ne,Le=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return u(Fe,e,S.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return d(Fe)||Ie}disable(){this._getContextManager().disable(),f(Fe,S.instance())}}})),k,ze=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(k||(k={}))})),Be,Ve,He,Ue=n((()=>{ze(),Be=`0000000000000000`,Ve=`00000000000000000000000000000000`,He={traceId:Ve,spanId:Be,traceFlags:k.NONE}})),We,Ge=n((()=>{Ue(),We=class{constructor(e=He){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Ke(e){return e.getValue(Qe)||void 0}function qe(){return Ke(Le.getInstance().active())}function Je(e,t){return e.setValue(Qe,t)}function Ye(e){return e.deleteValue(Qe)}function Xe(e,t){return Je(e,new We(t))}function Ze(e){var t;return(t=Ke(e))==null?void 0:t.spanContext()}var Qe,$e=n((()=>{ce(),Ge(),Re(),Qe=oe(`OpenTelemetry Context Key SPAN`)}));function et(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(at[e.charCodeAt(t)]|0)+(at[e.charCodeAt(t+1)]|0)+(at[e.charCodeAt(t+2)]|0)+(at[e.charCodeAt(t+3)]|0);return n===t}function tt(e){return et(e,32)&&e!==`00000000000000000000000000000000`}function nt(e){return et(e,16)&&e!==`0000000000000000`}function rt(e){return tt(e.traceId)&&nt(e.spanId)}function it(e){return new We(e)}var at,ot=n((()=>{Ue(),Ge(),at=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 st(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var ct,lt,ut=n((()=>{Re(),$e(),Ge(),ot(),ct=Le.getInstance(),lt=class{startSpan(e,t,n=ct.active()){if(t!=null&&t.root)return new We;let r=n&&Ze(n);return st(r)&&rt(r)?new We(r):new We}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a==null?ct.active():a,c=this.startSpan(e,i,s),l=Je(s,c);return ct.with(l,o,void 0,c)}}})),dt,ft,pt=n((()=>{ut(),dt=new lt,ft=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):dt}}})),mt,ht=n((()=>{ut(),mt=class{getTracer(e,t,n){return new lt}}})),gt,_t,vt=n((()=>{pt(),ht(),gt=new mt,_t=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new ft(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?gt:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),yt,bt=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(yt||(yt={}))})),xt,St=n((()=>{(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`})(xt||(xt={}))})),Ct,wt=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Ct||(Ct={}))})),A,Tt=n((()=>{Re(),A=Le.getInstance()})),j,Et=n((()=>{C(),j=S.instance()})),Dt,Ot,kt=n((()=>{ke(),Dt=class{getMeter(e,t,n){return xe}},Ot=new Dt})),At,jt,Mt=n((()=>{kt(),g(),C(),At=`metrics`,jt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return u(At,e,S.instance())}getMeterProvider(){return d(At)||Ot}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){f(At,S.instance())}}})),Nt,Pt=n((()=>{Mt(),Nt=jt.getInstance()})),Ft,It=n((()=>{Ft=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function Lt(e){return e.getValue(Vt)||void 0}function Rt(){return Lt(Le.getInstance().active())}function zt(e,t){return e.setValue(Vt,t)}function Bt(e){return e.deleteValue(Vt)}var Vt,Ht=n((()=>{Re(),ce(),Vt=oe(`OpenTelemetry Baggage Key`)})),Ut,Wt,Gt,Kt=n((()=>{g(),It(),Me(),Ht(),ae(),C(),Ut=`propagation`,Wt=new Ft,Gt=class e{constructor(){this.createBaggage=ie,this.getBaggage=Lt,this.getActiveBaggage=Rt,this.setBaggage=zt,this.deleteBaggage=Bt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return u(Ut,e,S.instance())}inject(e,t,n=je){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Ae){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){f(Ut,S.instance())}_getGlobalPropagator(){return d(Ut)||Wt}}})),qt,Jt=n((()=>{Kt(),qt=Gt.getInstance()})),Yt,Xt,Zt=n((()=>{g(),vt(),ot(),$e(),C(),Yt=`trace`,Xt=class e{constructor(){this._proxyTracerProvider=new _t,this.wrapSpanContext=it,this.isSpanContextValid=rt,this.deleteSpan=Ye,this.getSpan=Ke,this.getActiveSpan=qe,this.getSpanContext=Ze,this.setSpan=Je,this.setSpanContext=Xe}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=u(Yt,this._proxyTracerProvider,S.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return d(Yt)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){f(Yt,S.instance()),this._proxyTracerProvider=new _t}}})),M,Qt=n((()=>{Zt(),M=Xt.getInstance()})),N=n((()=>{ae(),ce(),de(),b(),ke(),Me(),pt(),vt(),bt(),St(),wt(),ze(),ot(),Ue(),Tt(),Et(),Pt(),Jt(),Qt()}));N();function $t(e,t,n,r=new Set){return new Proxy(e,{get(e,i,a){let o=Reflect.get(e,i,a);return typeof o!=`function`||r.has(i)?o:(...r)=>{try{return o.apply(e,r)}catch(e){let a=e instanceof Error?e.message:`Unknown error`;n.error(`${String(i)}: ${a}`);let o=t[i];return typeof o==`function`?o.apply(t,r):void 0}}}})}var en=class{logException(e,t){}captureException(e,t){}addExceptionFilter(e){}message(e,t,n){}};function tn(e){"@babel/helpers - typeof";return tn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},tn(e)}var nn=n((()=>{}));function rn(e,t){if(tn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(tn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var an=n((()=>{nn()}));function on(e){var t=rn(e,`string`);return tn(t)==`symbol`?t:t+``}var sn=n((()=>{nn(),an()}));function P(e,t,n){return(t=on(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=n((()=>{sn()}));F();let cn=new en;var ln=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?cn:e}setDelegate(e){this._delegate=e}logException(e,t){this.getDelegate().logException(e,t)}captureException(e,t){this.logException(e,t)}addExceptionFilter(e){this.getDelegate().addExceptionFilter(e)}message(e,t,n){this.getDelegate().message(e,t,n)}};F();let un=new en,dn=new Set([`setDelegate`,`getDelegate`]);var fn=class e{static getInstance(){if(!e._instance){let t=new ln,n=$t(t,un,j.createComponentLogger({namespace:`LogAPI`}),dn);e._instance=Object.assign(n,{getLogManager(){return t},setGlobalLogManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(fn,`_instance`,void 0);let pn=fn.getInstance();var mn=class{track(){}identify(){}increment(){}decrement(){}clear(){}screenView(){}};let hn=(e,t,n,r=100)=>{e.length>=r&&(e.shift(),n()),e.push(t)};N(),F();let gn=new mn;var _n=class{constructor(e){P(this,`_delegate`,void 0),P(this,`_queue`,[]),P(this,`_diag`,void 0),this._diag=e==null?j.createComponentLogger({namespace:`ProxyAnalyticsManager`}):e}getDelegate(){var e;return(e=this._delegate)==null?gn:e}setDelegate(e){this._delegate=e;let t=this._queue;if(this._queue=null,t)for(let n of t)n.op===`track`?e.track(n.name,n.options):e.identify(n.options)}track(e,t){if(this._queue){this._enqueue({op:`track`,name:e,options:t});return}this.getDelegate().track(e,t)}identify(e){if(this._queue){this._enqueue({op:`identify`,options:e});return}this.getDelegate().identify(e)}increment(e){this.getDelegate().increment(e)}decrement(e){this.getDelegate().decrement(e)}clear(){this.getDelegate().clear()}screenView(){this.getDelegate().screenView()}_enqueue(e){let t=this._queue;t&&hn(t,e,()=>{this._diag.warn(`dropping oldest queued analytics call; pre-init queue is full`)})}};N(),F();let vn=new mn,yn=new Set([`setDelegate`,`getDelegate`]);var bn=class e{static getInstance(){if(!e._instance){let t=new _n,n=$t(t,vn,j.createComponentLogger({namespace:`AnalyticsAPI`}),yn);e._instance=Object.assign(n,{getAnalyticsManager(){return t},setGlobalAnalyticsManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(bn,`_instance`,void 0);let xn=bn.getInstance();var Sn=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}addRouteChangedListener(e){return()=>{}}};F();let Cn=new Sn;var wn=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Cn:e}setDelegate(e){this._delegate=e}setCurrentRoute(e){this.getDelegate().setCurrentRoute(e)}getCurrentRoute(){return this.getDelegate().getCurrentRoute()}getCurrentPageId(){return this.getDelegate().getCurrentPageId()}setPageLabel(e){this.getDelegate().setPageLabel(e)}getPageLabel(){return this.getDelegate().getPageLabel()}clearCurrentRoute(){this.getDelegate().clearCurrentRoute()}addRouteChangedListener(e){return this.getDelegate().addRouteChangedListener(e)}};N(),F();let Tn=new Sn,En=new Set([`setDelegate`,`getDelegate`]);var Dn=class e{static getInstance(){if(!e._instance){let t=new wn,n=$t(t,Tn,j.createComponentLogger({namespace:`PageAPI`}),En);e._instance=Object.assign(n,{getPageManager(){return t},setGlobalPageManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Dn,`_instance`,void 0);let On=Dn.getInstance();var kn=class{addBreadcrumb(e){}addProperty(e,t,n){}removeProperty(e){}getUserSessionId(){return null}getPreviousUserSessionId(){return null}getUserSessionStartTime(){return null}endUserSession(){}getUserSessionAttributes(){return null}getSessionPartProperties(){return{}}getSessionPartId(){return null}getSessionPartIdAt(e){return null}getSessionPartSpan(){return null}startSessionPartInternal(e){}endSessionPartInternal(e){}rolloverSessionPartInternal(e){}incrSessionPartCountForKey(e){}incrNextSessionPartCountForKey(e){}addSessionPartStartedListener(e){return()=>{}}addSessionPartEndedListener(e){return()=>{}}setTracerProvider(){}setAnalyticsManager(e){}recordSDKStartupDuration(e){}claimReplaySample(e){return!1}nextReplayMetaVersion(){return 0}_clearMaxDurationTimer(){}_shutdown(){}};F();let An=new kn;var jn=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?An:e}setDelegate(e){let t=this._delegate;t&&t!==e&&t._shutdown(),this._delegate=e}addBreadcrumb(e){this.getDelegate().addBreadcrumb(e)}addProperty(e,t,n){this.getDelegate().addProperty(e,t,n)}removeProperty(e){this.getDelegate().removeProperty(e)}getUserSessionId(){return this.getDelegate().getUserSessionId()}getPreviousUserSessionId(){return this.getDelegate().getPreviousUserSessionId()}getUserSessionStartTime(){return this.getDelegate().getUserSessionStartTime()}endUserSession(){this.getDelegate().endUserSession()}getUserSessionAttributes(){return this.getDelegate().getUserSessionAttributes()}getSessionPartProperties(){return this.getDelegate().getSessionPartProperties()}getSessionPartId(){return this.getDelegate().getSessionPartId()}getSessionPartIdAt(e){return this.getDelegate().getSessionPartIdAt(e)}getSessionPartSpan(){return this.getDelegate().getSessionPartSpan()}startSessionPartInternal(e){this.getDelegate().startSessionPartInternal(e)}endSessionPartInternal(e){this.getDelegate().endSessionPartInternal(e)}rolloverSessionPartInternal(e){this.getDelegate().rolloverSessionPartInternal(e)}incrSessionPartCountForKey(e){this.getDelegate().incrSessionPartCountForKey(e)}incrNextSessionPartCountForKey(e){this.getDelegate().incrNextSessionPartCountForKey(e)}addSessionPartStartedListener(e){return this.getDelegate().addSessionPartStartedListener(e)}addSessionPartEndedListener(e){return this.getDelegate().addSessionPartEndedListener(e)}setTracerProvider(e){this.getDelegate().setTracerProvider(e)}setAnalyticsManager(e){this.getDelegate().setAnalyticsManager(e)}recordSDKStartupDuration(e){this.getDelegate().recordSDKStartupDuration(e)}claimReplaySample(e){return this.getDelegate().claimReplaySample(e)}nextReplayMetaVersion(){return this.getDelegate().nextReplayMetaVersion()}_clearMaxDurationTimer(){this.getDelegate()._clearMaxDurationTimer()}_shutdown(){this.getDelegate()._shutdown()}};N(),F();let Mn=new kn,Nn=new Set([`setDelegate`,`getDelegate`]);var Pn=class e{static getInstance(){if(!e._instance){let t=new jn,n=$t(t,Mn,j.createComponentLogger({namespace:`SessionAPI`}),Nn);e._instance=Object.assign(n,{getUserSessionManager(){return t},setGlobalUserSessionManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Pn,`_instance`,void 0);let Fn=Pn.getInstance();N(),F();var In=class{constructor(e=He){P(this,`_spanContext`,void 0),P(this,`attributes`,{}),this._spanContext=e}fail(e){}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}removeAttribute(e){return this}addEvent(e,t,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}};N();var Ln=class{startSpan(e,t){return new In}setSpan(e,t){return T}getSpan(e){}};F();let Rn=new Ln;var zn=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Rn:e}setDelegate(e){this._delegate=e}startSpan(e,t,n){return this.getDelegate().startSpan(e,t,n)}setSpan(e,t){return this.getDelegate().setSpan(e,t)}getSpan(e){return this.getDelegate().getSpan(e)}};N(),F();let Bn=new Ln,Vn=new Set([`setDelegate`,`getDelegate`]);var Hn=class e{static getInstance(){if(!e._instance){let t=new zn,n=$t(t,Bn,j.createComponentLogger({namespace:`TraceAPI`}),Vn);e._instance=Object.assign(n,{getTraceManager(){return t},setGlobalTraceManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Hn,`_instance`,void 0);let Un=Hn.getInstance();var Wn=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};N(),F();let Gn=new Wn;var Kn=class{constructor(e){P(this,`_delegate`,void 0),P(this,`_queue`,[]),P(this,`_diag`,void 0),this._diag=e==null?j.createComponentLogger({namespace:`ProxyUserManager`}):e}getDelegate(){var e;return(e=this._delegate)==null?Gn:e}setDelegate(e){this._delegate=e;let t=this._queue;if(this._queue=null,t)for(let n of t)e.setUserId(n.userId)}getMXLUserId(){return this.getDelegate().getMXLUserId()}getUserId(){return this.getDelegate().getUserId()}setUserId(e){if(this._queue){hn(this._queue,{op:`setUserId`,userId:e},()=>{this._diag.warn(`dropping oldest queued setUserId; pre-init queue is full`)});return}this.getDelegate().setUserId(e)}clearUserId(){this.getDelegate().clearUserId()}};N(),F();let qn=new Wn,Jn=new Set([`setDelegate`,`getDelegate`]);var Yn=class e{static getInstance(){if(!e._instance){let t=new Kn,n=$t(t,qn,j.createComponentLogger({namespace:`UserAPI`}),Jn);e._instance=Object.assign(n,{getUserManager(){return t},setGlobalUserManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Yn,`_instance`,void 0);let Xn=Yn.getInstance(),I=`mxl.type`,Zn=`mxl.state`,Qn=`react.component_stack`,$n=`mxl.instrumentation`,er=`mxl.js_file_bundle_ids`,tr=`browser.url.full`,nr=`browser.navigation_timing.not_restored_reasons`,rr=`app.surface.name`,ir=`app.surface.id`,ar=`app.surface.label`,or=`mxl.session_part_id`,sr=`mxl.user_session_id`,cr=`mxl.user_session_previous_id`,lr=`mxl.user_session_number`,ur=`mxl.application.id`,L=`mxl.session_prev.`,dr={pageLabel:ar};function fr(e){return e.setValue(mr,!0)}function pr(e){return e.getValue(mr)===!0}var mr,hr=n((()=>{N(),mr=oe(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function gr(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!_r(n)){j.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!vr(r)){j.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function _r(e){return typeof e==`string`&&e!==``}function vr(e){return e==null?!0:Array.isArray(e)?yr(e):br(typeof e)}function yr(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(br(e)){t=e;continue}return!1}return!1}}return!0}function br(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var xr=n((()=>{N()}));function Sr(){return e=>{j.error(Cr(e))}}function Cr(e){return typeof e==`string`?e:JSON.stringify(wr(e))}function wr(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Tr=n((()=>{N()}));function Er(e){try{Dr(e)}catch(e){}}var Dr,Or=n((()=>{Tr(),Dr=Sr()})),kr=n((()=>{})),Ar,jr=n((()=>{Ar=`2.11.0`})),Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr=n((()=>{Mr=`http.method`,Nr=`http.url`,Pr=`http.status_code`,Fr=`http.request_content_length`,Ir=`http.response_content_length`,Lr=Mr,Rr=Nr,zr=Pr,Br=Fr,Vr=Ir})),Ur=n((()=>{Hr()})),Wr=n((()=>{})),Gr=n((()=>{Wr()})),Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui=n((()=>{Kr=`error.type`,qr=`exception.message`,Jr=`exception.stacktrace`,Yr=`exception.type`,Xr=`http.request.method`,Zr=`http.request.method_original`,Qr=`http.response.status_code`,$r=`server.address`,ei=`server.port`,ti=`service.name`,ni=`telemetry.sdk.language`,ri=`webjs`,ii=`telemetry.sdk.name`,ai=`telemetry.sdk.version`,oi=`url.full`,si=`url.path`,ci=`url.query`,li=`user_agent.original`})),di=n((()=>{})),fi=n((()=>{})),R=n((()=>{Ur(),Gr(),ui(),di(),fi()})),pi,mi=n((()=>{pi=`process.runtime.name`})),hi,gi=n((()=>{jr(),R(),mi(),hi={[ii]:`opentelemetry`,[pi]:`browser`,[ni]:ri,[ai]:Ar}})),_i,vi=n((()=>{kr(),gi(),_i=performance}));function yi(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*ki)]}function bi(e){return Di(yi(_i.timeOrigin),yi(typeof e==`number`?e:_i.now()))}function xi(e){if(Ti(e))return e;if(typeof e==`number`)return e<_i.timeOrigin/2?bi(e):yi(e);if(e instanceof Date)return yi(e.getTime());throw TypeError(`Invalid input type`)}function Si(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Ai),[n,r]}function Ci(e){return e[0]*Ai+e[1]}function wi(e){return e[0]*1e3+e[1]/1e6}function Ti(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Ei(e){return Ti(e)||typeof e==`number`||e instanceof Date}function Di(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Ai&&(n[1]-=Ai,n[0]+=1),n}var Oi,ki,Ai,ji=n((()=>{vi(),Oi=9,ki=Math.pow(10,6),Ai=Math.pow(10,Oi)})),z,Mi=n((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(z||(z={}))}));function Ni(e){return Ri.test(e)}function Pi(e){return zi.test(e)&&!Bi.test(e)}var Fi,Ii,Li,Ri,zi,Bi,Vi=n((()=>{Fi=`[_0-9a-z-*/]`,Ii=`[a-z]${Fi}{0,255}`,Li=`[a-z0-9]${Fi}{0,240}@[a-z]${Fi}{0,13}`,Ri=RegExp(`^(?:${Ii}|${Li})$`),zi=/^[ -~]{0,255}[!-~]$/,Bi=/,|=/})),Hi,Ui,Wi,Gi,Ki,qi=n((()=>{Vi(),F(),Hi=32,Ui=512,Wi=`,`,Gi=`=`,Ki=class e{constructor(e){P(this,`_length`,void 0),P(this,`_rawTraceState`,void 0),P(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Ni(e)||!Pi(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>Ui)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=Wi+e),e=`${n[0]}${Gi}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Wi),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Gi);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Ni(a)||!Pi(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Ui)&&(t.set(a,o),n=s,t.size>=Hi))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}}}));function Ji(e){let t=Qi.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Yi,Xi,Zi,Qi,$i,ea=n((()=>{N(),hr(),qi(),Yi=`traceparent`,Xi=`tracestate`,Zi=`00`,Qi=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),$i=class{inject(e,t,n){let r=M.getSpanContext(e);if(!r||pr(e)||!rt(r))return;let i=`${Zi}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||k.NONE).toString(16)}`;n.set(t,Yi,i),r.traceState&&n.set(t,Xi,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Yi);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Ji(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Xi);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Ki(typeof e==`string`?e:void 0)}return M.setSpanContext(e,a)}fields(){return[Yi,Xi]}}}));function ta(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new na(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var na,ra=n((()=>{na=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}));function ia(e,t){return typeof t==`string`?e===t:!!e.match(t)}function aa(e,t){if(!t)return!1;for(let n of t)if(ia(e,n))return!0;return!1}var oa=n((()=>{})),sa,ca=n((()=>{F(),sa=class{constructor(){P(this,`_promise`,void 0),P(this,`_resolve`,void 0),P(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),la,ua=n((()=>{ca(),F(),la=class{constructor(e,t){P(this,`_isCalled`,!1),P(this,`_deferred`,new sa),P(this,`_callback`,void 0),P(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function da(e,t){return new Promise(n=>{A.with(fr(A.active()),()=>{e.export(t,n)})})}var fa=n((()=>{N(),hr()})),pa,B=n((()=>{N(),hr(),F(),xr(),Or(),Tr(),ji(),Mi(),vi(),ea(),qi(),ra(),oa(),ua(),fa(),pa={_export:da}}));B(),F();let ma;function ha(e){ma=e}var ga=class{constructor(e=window.performance){P(this,`_clock`,void 0),P(this,`navigationEntry`,null),P(this,`epochMillisFromOriginOffset`,e=>this._clock.timeOrigin+e),P(this,`getNowHRTime`,()=>yi(this.getNowMillis())),P(this,`getNowMillis`,()=>this.epochMillisFromOriginOffset(this._clock.now())),P(this,`millisSinceHRTime`,e=>this.getNowMillis()-wi(e)),P(this,`getZeroTime`,()=>{var e;return Math.max(this._clock.timeOrigin+this._getNavigationActivationStart(),(e=ma)==null?0:e)}),P(this,`getNavigationEntry`,()=>{var e,t,n;if(this.navigationEntry)return this.navigationEntry;let[r]=(e=(t=(n=this._clock).getEntriesByType)==null?void 0:t.call(n,`navigation`))==null?[]:e;return r?(this.navigationEntry=r,this.navigationEntry):null}),P(this,`millisFromZeroTime`,e=>Math.max(0,e-(this.getZeroTime()-this._clock.timeOrigin))),P(this,`millisFromZeroTimeEpoch`,e=>Math.max(0,e-this.getZeroTime())),this._clock=e}_getNavigationActivationStart(){var e;let t=this.getNavigationEntry();return(e=t==null?void 0:t.activationStart)==null?0:e}},V,_a=n((()=>{(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`})(V||(V={}))}));function va(){return ba}var ya,ba,xa=n((()=>{ya=class{emit(e){}enabled(){return!1}},ba=new ya}));function Sa(e,t,n){return r=>r===e?t:n}var Ca,wa,Ta=n((()=>{Ca=Symbol.for(`io.opentelemetry.js.api.logs`),wa=globalThis})),Ea,Da,Oa=n((()=>{xa(),Ea=class{getLogger(e,t,n){return new ya}},Da=new Ea})),ka,Aa=n((()=>{xa(),ka=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ba}}})),ja,Ma=n((()=>{Oa(),Aa(),ja=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new ka(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?Da:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),Na,Pa=n((()=>{Ta(),Oa(),Ma(),Na=class e{constructor(){this._proxyLoggerProvider=new ja}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return wa[Ca]?this.getLoggerProvider():(wa[Ca]=Sa(1,e,Da),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=wa[Ca])==null?void 0:e.call(wa,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete wa[Ca],this._proxyLoggerProvider=new ja}}})),Fa,H=n((()=>{_a(),xa(),Pa(),Fa=Na.getInstance()}));function Ia(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ia(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ia(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var W=n((()=>{F()}));N(),H(),F(),W();var La=class{constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,P(this,`_config`,{}),P(this,`_diag`,void 0),P(this,`_tracer`,void 0),P(this,`_meter`,void 0),P(this,`_logger`,void 0),this.setConfig(n),this._diag=j.createComponentLogger({namespace:e}),this._tracer=M.getTracer(e,t),this._meter=Nt.getMeter(e,t),this._logger=Fa.getLogger(e,t),this._updateMetricInstruments()}get tracer(){return this._tracer}get meter(){return this._meter}get logger(){return this._logger}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}getConfig(){return this._config}setConfig(e){this._config=U({enabled:!0},e)}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}_updateMetricInstruments(){}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}};F();var G=class extends La{constructor({instrumentationName:e,instrumentationVersion:t,config:n,diag:r,perf:i,limitManager:a}){super(e,t,n),P(this,`_userSessionManager`,void 0),P(this,`_logManager`,void 0),P(this,`_limitManager`,void 0),P(this,`_perf`,void 0),P(this,`_isEnabled`,!1),P(this,`_removeSessionPartListeners`,{}),P(this,`_sessionPartListeners`,{}),r&&(this._diag=r),this._perf=i==null?new ga:i,this._userSessionManager=Fn.getUserSessionManager(),this._logManager=pn.getLogManager(),this._limitManager=a}get limitManager(){return this._limitManager}get userSessionManager(){return this._userSessionManager}get logManager(){return this._logManager}get perf(){return this._perf}init(){}setLimitManager(e){this._limitManager=e}setLogManager(e){this._logManager=e}setUserSessionManager(e){this._userSessionManager=e,this._registerSessionPartListeners()}setSessionPartListeners(e){this._sessionPartListeners=e,this._registerSessionPartListeners()}unregisterSessionPartListeners(){var e,t,n,r;(e=(t=this._removeSessionPartListeners).start)==null||e.call(t),(n=(r=this._removeSessionPartListeners).end)==null||n.call(r),this._removeSessionPartListeners={}}_registerSessionPartListeners(){this._isEnabled&&(this.unregisterSessionPartListeners(),this._sessionPartListeners.start&&(this._removeSessionPartListeners.start=this.userSessionManager.addSessionPartStartedListener(()=>{var e,t;return(e=(t=this._sessionPartListeners).start)==null?void 0:e.call(t)})),this._sessionPartListeners.end&&(this._removeSessionPartListeners.end=this.userSessionManager.addSessionPartEndedListener(()=>{var e,t;return(e=(t=this._sessionPartListeners).end)==null?void 0:e.call(t)})))}disable(){this._isEnabled&&(this._isEnabled=!1,this.onDisable(),this.unregisterSessionPartListeners())}enable(){this._isEnabled||(this._isEnabled=!0,this.onEnable())}};F();let Ra=/\([^()]+\)/g;var za=class extends G{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0}){super({config:{},diag:e,instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`}),P(this,`_shouldCleanupPathOptionsFromRouteName`,!0),P(this,`_currentRouteSpan`,null),P(this,`_instrumentationType`,`manual`),P(this,`_removeSessionStartedFn`,null),P(this,`_removeSessionEndedFn`,null),P(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),P(this,`setCurrentRoute`,e=>{if(!this._config.enabled)return;let t=On.getCurrentRoute(),n=e.url!==(t==null?void 0:t.url);if(On.setCurrentRoute(e),n){this._endRouteSpan(t),this._startRouteSpan(e),xn.screenView();return}if(!this._currentRouteSpan){this._startRouteSpan(e);return}(t==null?void 0:t.path)!==e.path&&(this._endRouteSpan(t),this._startRouteSpan(e))}),P(this,`_setupSessionListeners`,()=>{this._removeSessionStartedFn||(this._removeSessionStartedFn=this.userSessionManager.addSessionPartStartedListener(({reason:e})=>{if(e===`web_soft_navigation`)return;let t=On.getCurrentRoute();t&&!this._currentRouteSpan&&(this._diag.debug(`Session started, starting route span.`),this._startRouteSpan(t))})),this._removeSessionEndedFn||(this._removeSessionEndedFn=this.userSessionManager.addSessionPartEndedListener(()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan(On.getCurrentRoute()))}))}),P(this,`_cleanUpSessionListeners`,()=>{this._removeSessionStartedFn&&(this._removeSessionStartedFn(),this._removeSessionStartedFn=null),this._removeSessionEndedFn&&(this._removeSessionEndedFn(),this._removeSessionEndedFn=null)}),P(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`),this._setupSessionListeners();let t=this._shouldCleanupPathOptionsFromRouteName?e.path.replace(Ra,``):e.path;return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[I]:`ux.surface`,[rr]:t,[ir]:On.getCurrentPageId()||void 0}}),this._currentRouteSpan.setAttribute($n,this._instrumentationType),this._currentRouteSpan}),P(this,`_endRouteSpan`,e=>{this._currentRouteSpan&&(e&&this._diag.debug(`Ending route span for url: ${e.url}`),this._currentRouteSpan.end(),this._currentRouteSpan=null)}),this._shouldCleanupPathOptionsFromRouteName=t,this._config.enabled&&this.enable()}onEnable(){this.setConfig({enabled:!0}),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}onDisable(){this._cleanUpSessionListeners(),this.setConfig({enabled:!1}),this._diag.debug(`NavigationInstrumentation disabled, stopped listening for navigation events.`)}};let Ba,Va=(e={})=>(Ba||(Ba=new za(e)),Ba);function Ha(e){let t=(e,t=2)=>String(e).padStart(t,`0`);return`${e.getUTCFullYear()}-${t(e.getUTCMonth()+1)}-${t(e.getUTCDate())} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}.${t(e.getUTCMilliseconds(),3)}`}function Ua(e){let t=/edg/i.test(e)?`Edge`:/opr|opera/i.test(e)?`Opera`:/chrome|crios/i.test(e)?`Chrome`:/firefox|fxios/i.test(e)?`Firefox`:/safari/i.test(e)?`Safari`:`Unknown`,n=/windows/i.test(e)?`Windows`:/mac os|macintosh/i.test(e)?`macOS`:/android/i.test(e)?`Android`:/iphone|ipad|ios/i.test(e)?`iOS`:/linux/i.test(e)?`Linux`:`Unknown`;return{browserName:t,deviceType:/mobile|iphone|android.*mobile/i.test(e)?`mobile`:/ipad|tablet/i.test(e)?`tablet`:`desktop`,osName:n}}function Wa(e,t){if(e<=0)return()=>void 0;let n,r=setInterval(()=>{if(typeof requestIdleCallback!=`function`){t();return}n===void 0&&(n=requestIdleCallback(()=>{n=void 0,t()},{timeout:2e3}))},e);return()=>{clearInterval(r),n!==void 0&&typeof cancelIdleCallback==`function`&&cancelIdleCallback(n),n=void 0}}function Ga(e){try{return JSON.stringify(e).length}catch(e){return 64}}function Ka(e,t){try{e(t)}catch(e){}}let qa=[`log`,`info`,`warn`,`error`,`debug`],Ja=2e3;function Ya(e){let t={};for(let n of qa){let r=console[n];t[n]=r,console[n]=(...t)=>{Ka(e,{level:n,message:Xa(t),type:`console`}),r.apply(console,t)}}return()=>{for(let e of qa){let n=t[e];n&&(console[e]=n)}}}function Xa(e){let t=e.map(e=>{if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch(t){return String(e)}}).join(` `);return t.length>Ja?`${t.slice(0,Ja)}…`:t}N();function Za(){var e;let t=(e=M.getActiveSpan())==null?void 0:e.spanContext().traceId;return t&&t!==`00000000000000000000000000000000`?t:void 0}let Qa=4e3;function $a(e){let t=t=>{var n,r;Ka(e,{errorStack:eo((n=t.error)==null?void 0:n.stack),level:`error`,message:t.message||String((r=t.error)==null?`Error`:r),traceId:Za(),type:`error`})},n=t=>{var n;let r=t.reason,i=typeof r==`string`?r:(n=r==null?void 0:r.message)==null?`Unhandled promise rejection`:n;Ka(e,{errorStack:eo(typeof r==`object`?r==null?void 0:r.stack:void 0),level:`error`,message:i,traceId:Za(),type:`error`})};return window.addEventListener(`error`,t),window.addEventListener(`unhandledrejection`,n),()=>{window.removeEventListener(`error`,t),window.removeEventListener(`unhandledrejection`,n)}}function eo(e){if(e)return e.length>Qa?`${e.slice(0,Qa)}…`:e}function to(e,t){let n=n=>{let r=n.target;r instanceof Element&&Ka(e,{targetSelector:no(r),targetText:t?void 0:ro(r),type:`click`})},r=t=>{let n=t.target;n instanceof Element&&Ka(e,{targetSelector:no(n),type:`input`})};return document.addEventListener(`click`,n,!0),document.addEventListener(`input`,r,!0),()=>{document.removeEventListener(`click`,n,!0),document.removeEventListener(`input`,r,!0)}}function no(e){return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:``}${typeof e.className==`string`&&e.className.trim()?`.${e.className.trim().split(/\s+/)[0]}`:``}`}function ro(e){var t;let n=((t=e.textContent)==null?``:t).trim().replace(/\s+/g,` `);if(n)return n.length>120?`${n.slice(0,120)}…`:n}function io(e){let t=``,n=()=>{let n=location.href;n!==t&&(t=n,Ka(e,{type:`navigation`,url:n}))};n();let r=history.pushState,i=history.replaceState;return history.pushState=function(...e){let t=r.apply(this,e);return n(),t},history.replaceState=function(...e){let t=i.apply(this,e);return n(),t},window.addEventListener(`popstate`,n),window.addEventListener(`hashchange`,n),()=>{history.pushState=r,history.replaceState=i,window.removeEventListener(`popstate`,n),window.removeEventListener(`hashchange`,n)}}function ao(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function K(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){ao(a,r,i,o,s,`next`,e)}function s(e){ao(a,r,i,o,s,`throw`,e)}o(void 0)})}}var q=n((()=>{}));q(),W();function oo(e,t){let n=typeof window<`u`?window.fetch.bind(window):void 0;n&&(window.fetch=function(){var e=K(function*(e,t){let i=so(e),a=co(e,t),o=Za(),s=performance.now();try{let c=yield n(e,t);return r(i,a,c.status,s,o),c}catch(e){throw r(i,a,0,s,o,String(e)),e}});return function(t,n){return e.apply(this,arguments)}}());let r=(n,r,i,a,o,s)=>{t(n)||Ka(e,U({net:{durationMs:Math.round(performance.now()-a),method:r,status:i,url:n},traceId:o,type:`network`},s?{attrs:{error:s}}:{}))},i=typeof window<`u`?window.XMLHttpRequest:void 0,a=i==null?void 0:i.prototype.open,o=i==null?void 0:i.prototype.send;return i&&a&&o&&(i.prototype.open=function(e,t,...n){return this.__mxlMethod=String(e).toUpperCase(),this.__mxlUrl=typeof t==`string`?t:t.href,a.apply(this,[e,t,...n])},i.prototype.send=function(...e){let t=this,n=performance.now(),i=Za();return this.addEventListener(`loadend`,()=>{var e,a;r((e=t.__mxlUrl)==null?``:e,(a=t.__mxlMethod)==null?`GET`:a,this.status,n,i)}),o.apply(this,e)}),()=>{n&&(window.fetch=n),i&&a&&(i.prototype.open=a),i&&o&&(i.prototype.send=o)}}function so(e){return typeof e==`string`?e:e instanceof URL?e.href:e.url}function co(e,t){var n;let r=(n=t==null?void 0:t.method)==null?typeof e==`object`&&`method`in e?e.method:void 0:n;return(r==null?`GET`:r).toUpperCase()}q();function lo({config:e,sessionId:t,transport:n,onActivity:r,flushIntervalMs:i=5e3,flushBytes:a=65536}){let o=[],s=0,c=0,l=!1,u=e=>{l||(o.push({ev:e,seq:c++}),s+=Ga(e),s>=a&&d())},d=function(){var i=K(function*(i=!1){if(o.length===0||l)return;r==null||r();let a=o;o=[],s=0;let c=a.map(({ev:n,seq:r})=>uo(t,n,r,e.redactUrl));yield n.postSessionEvents(c,i)});return function(){return i.apply(this,arguments)}}(),f=[io(u),to(u,e.maskAllText),Ya(u),oo(u,e=>n.shouldIgnoreUrl(e)),$a(u)],p=Wa(i,()=>{d()});return{flush:d,pause:()=>{l=!0},resume:()=>{l=!1},stop:()=>{p();for(let e of f)e()}}}function uo(e,t,n,r){var i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,ee,y;let b=(i=t.net)==null?void 0:i.url,te=(a=t.url)==null?typeof location<`u`?location.href:``:a;return{attributes:(o=t.attrs)==null?{}:o,error_stack:(s=t.errorStack)==null?``:s,level:(c=t.level)==null?``:c,message:(l=t.message)==null?``:l,net_duration_ms:(u=(d=t.net)==null?void 0:d.durationMs)==null?0:u,net_method:(f=(p=t.net)==null?void 0:p.method)==null?``:f,net_status:(m=(h=t.net)==null?void 0:h.status)==null?0:m,net_url:b?r(b):``,seq:n,session_id:e,target_selector:(g=t.targetSelector)==null?``:g,target_text:(_=t.targetText)==null?``:_,timestamp:Ha(new Date((v=t.timestamp)==null?Date.now():v)),trace_id:(ee=(y=t.traceId)==null?Za():y)==null?``:ee,type:t.type,url:te?r(te):``}}q();function fo(e){return po.apply(this,arguments)}function po(){return po=K(function*(e){let t=new CompressionStream(`gzip`),n=t.writable.getWriter(),r=n.write(e).then(()=>n.close()),[i]=yield Promise.all([new Response(t.readable).arrayBuffer(),r]),a=new Uint8Array(i);if(a.length<18||a[0]!==31||a[1]!==139||a[2]!==8)throw Error(`gzip produced ${a.length} bytes, not a complete gzip stream`);return a}),po.apply(this,arguments)}q(),W();let mo=4*1024*1024,ho=0;function go(e,t){let n=Date.now();n-ho<3e4||(ho=n,console.warn(`[mxl] session replay ${e}`,...t?[t]:[]))}function _o({config:e,sessionId:t,transport:n,chunkSeqStore:r,rrwebModule:i,onActivity:a,flushIntervalMs:o=5e3,flushBytes:s=102400}){let c=[],l=0,u=!1,d=0,f=0,p=!1,m=!1,h=0,g=!1,_=Promise.resolve(),v=()=>{c=[],l=0,u=!1,d=0,f=0},ee=()=>void 0,y=function(){var e=K(function*(e,r,i){let a;try{a=yield fo(new TextEncoder().encode(e))}catch(e){go(`chunk compression failed (dropping chunk)`,e);return}(yield n.postSessionBlob(r,a,i))===`exhausted`&&!m&&(m=!0,go(`replay ${t} reached its maximum recorded size; recording stopped for this session`),ee())});return function(t,n,r){return e.apply(this,arguments)}}(),b=(e=!1)=>{if(m||c.length===0)return _;a==null||a();let n=`[${c.join(`,`)}]`,i={chunkSeq:r.nextChunkSeq(t),durationMs:Math.max(0,f-d),eventCount:c.length,isCheckpoint:u,sessionId:t};v();let o=_.then(()=>y(n,i,e));return _=o.catch(()=>void 0),o},{record:te}=i,ne=te(U(U({checkoutEveryNms:3e5,emit:(t,n)=>{var r,i;if(g||m)return;let a=t;a.type===4&&typeof((r=a.data)==null?void 0:r.href)==`string`&&(a.data.href=e.redactUrl(a.data.href));let o=n===!0||a.type===2;if(a.type===3&&((i=a.data)==null?void 0:i.source)===2&&a.data.type===2&&h++,p&&!o)return;let _;try{_=JSON.stringify(a)}catch(e){return}if(l+_.length>mo){go(`buffer exceeded ${mo} bytes (dropping ${l+_.length} bytes until the next full snapshot)`),v(),p=!0;return}p=!1,o&&(u=!0),c.length===0&&(d=a.timestamp),f=a.timestamp,c.push(_),l+=_.length,l>=s&&b()},maskAllInputs:e.maskAllInputs},e.maskAllText?{maskTextSelector:`*`}:{}),e.rrwebOptions)),x=Wa(o,()=>{b()}),S=!1;return ee=()=>{S||(S=!0,x(),v(),ne==null||ne())},{flush:b,getClickCount:()=>h,pause:()=>{g=!0},resume:()=>{g=!1},stop:ee}}q();let vo=`https://unpkg.com/rrweb@2.0.0-alpha.20/dist/rrweb.umd.cjs`,yo,bo,xo=vo;function So(e){xo=e,yo=void 0}function Co(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.async=!0,r.onload=()=>t(),r.onerror=n,document.head.appendChild(r)})}function wo(){return To.apply(this,arguments)}function To(){return To=K(function*(){if(typeof window>`u`)throw Error(`no browser`);if(window.rrweb)return window.rrweb;if(yield Co(xo),!window.rrweb)throw Error(`no rrweb`);return window.rrweb}),To.apply(this,arguments)}function Eo(){return bo?bo():(yo===void 0&&(yo=wo()),yo)}function Do(){yo=void 0,bo=void 0,xo=vo}function Oo(e){bo=e,yo=void 0}let ko=new Set;function Ao(e){!e||e===`00000000000000000000000000000000`||ko.add(e)}function jo(){return Array.from(ko)}function Mo(){ko.clear()}let No=`__MXL_REPLAY_SESSION__`;function Po(e){globalThis[No]={recordTraceId:Ao,sessionId:e}}function Fo(){delete globalThis[No]}function Io(e){let t=e=>`replay.chunkSeq.${e}`;return{nextChunkSeq(n){let r=e.getItem(t(n)),i=r===null?0:Number.parseInt(r,10),a=Number.isFinite(i)?i:0;return e.setItem(t(n),String(a+1)),a}}}R();let Lo=/\/\/(.+):(.+)@(.+)\//,Ro=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],zo=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(Lo,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},Bo=e=>{let t=[...Ro,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:oi,scrub:e=>zo({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:Rr,scrub:e=>zo({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:si,scrub:e=>zo({queryParamRegex:n,scrubPath:!0,scrubQuery:!1,value:e})},{key:ci,scrub:e=>zo({queryParamRegex:n,scrubPath:!1,scrubQuery:!0,value:e})}]},Vo=e=>{let t=e.filter(({key:e})=>e===oi);return e=>t.reduce((e,{scrub:t})=>t(e),e)};function Ho(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Uo(e,t){if(e==null)return{};var n,r,i=Ho(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let Wo=[`debug`,`sampleRate`,`maskAllInputs`,`maskAllText`,`flushIntervalMs`,`omitRedundantInstrumentations`];function Go(e,t){var n;let r=t==null?{}:t,{debug:i=!1,sampleRate:a,maskAllInputs:o=!0,maskAllText:s=!0,flushIntervalMs:c=5e3,omitRedundantInstrumentations:l}=r,u=Uo(r,Wo);return{appId:e.appId,appVersion:e.appVersion,debug:i,environment:void 0,flushIntervalMs:c,maskAllInputs:o,maskAllText:s,redactUrl:(n=e.redactUrl)==null?Vo(Bo()):n,replaySampleRate:a==null?1:a,rrwebOptions:u,serviceName:e.serviceName,userID:e.userID}}W();function Ko(e){var t;let n=(t=e.visibilityDoc)==null?document:t,r=!1,i=setInterval(()=>{n.visibilityState===`visible`&&e.transport.postSessionMeta(qo(e.config,e.sessionId,e.startedAt,e.nextMetaVersion(),`active`,null))},6e4),a=()=>{var t;r||(r=!0,clearInterval(i),e.recorder.flush(!0),e.events.flush(!0),e.transport.postSessionMeta(qo(e.config,e.sessionId,e.startedAt,e.nextMetaVersion(),`ended`,e.recorder.getClickCount()),!0),e.recorder.stop(),e.events.stop(),Mo(),(t=e.onFinalize)==null||t.call(e))},o=()=>{n.visibilityState===`hidden`&&a()};return n.addEventListener(`visibilitychange`,o),window.addEventListener(`pagehide`,a),()=>{clearInterval(i),n.removeEventListener(`visibilitychange`,o),window.removeEventListener(`pagehide`,a)}}function qo(e,t,n,r,i,a){var o;let s=Ua(navigator.userAgent),c=new Date,l={browser_name:s.browserName,device_type:s.deviceType,os_name:s.osName,resource_attributes:U(U({},e.environment?{"deployment.environment":e.environment,"deployment.environment.name":e.environment}:{}),e.appVersion?{"deployment.commit_sha":e.appVersion}:{}),service_name:(o=e.serviceName)==null?``:o,session_id:t,start_time:Ha(n),status:i,url_initial:e.redactUrl(window.location.href),user_agent:navigator.userAgent,user_id:Yo(),version:r};return i===`ended`&&(l.click_count=a==null?0:a,l.duration_ms=Math.max(0,c.getTime()-n.getTime()),l.end_time=Ha(c),l.trace_ids=jo()),l}function Jo(e){let t=e.getUserSessionStartTime();return new Date(t==null?Date.now():t)}function Yo(){var e;return(e=Xn.getUserId())==null?``:e}F(),q();var Xo=class{constructor({context:e,userSessionManager:t,sessionStorage:n,rrwebOptions:r,autoStart:i=!0,diag:a,visibilityDoc:o}){P(this,`_context`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_chunkSeqStore`,void 0),P(this,`_config`,void 0),P(this,`_diag`,void 0),P(this,`_autoStart`,void 0),P(this,`_visibilityDoc`,void 0),P(this,`_active`,void 0),P(this,`_paused`,!1),P(this,`_enableRequested`,!1),P(this,`_startInProgress`,!1),P(this,`_stopInProgress`,!1),P(this,`_removeSessionStartedListener`,void 0),P(this,`_removeResumeListener`,void 0),this._context=e,this._userSessionManager=t,this._visibilityDoc=o,this._chunkSeqStore=Io(n),this._autoStart=i,this._config=Go(e,r),this._diag=a==null?{debug:()=>void 0,error:()=>void 0,info:()=>void 0,verbose:()=>void 0,warn:()=>void 0}:a}isRecording(){return!!this._active&&!this._paused}enable(e){if(!this._autoStart&&!(e!=null&&e.force)){this._diag.debug(`replay.enabled is false, waiting for manual enable`);return}this._enableRequested=!0,this._paused=!1,this._tryStart()}pause(){this._active&&(this._enableRequested=!1,this._paused=!0,this._active.recorder.pause(),this._active.events.pause())}resume(){if(!this._active){this.enable();return}let e=this._paused;this._enableRequested=!0,this._paused=!1,this._active.recorder.resume(),this._active.events.resume(),e&&this._active.rrwebModule.record.takeFullSnapshot()}stop(){var e=this;return K(function*(){var t,n;if(e._enableRequested=!1,e._paused=!1,(t=e._removeSessionStartedListener)==null||t.call(e),e._removeSessionStartedListener=void 0,(n=e._removeResumeListener)==null||n.call(e),e._removeResumeListener=void 0,!e._active){Fo(),Mo();return}if(e._stopInProgress)return;e._stopInProgress=!0;let r=e._active;e._active=void 0;try{var i;(i=r.removeSessionEndListener)==null||i.call(r),r.removeLifecycle(),yield r.recorder.flush(!0),yield r.events.flush(!0),r.recorder.stop(),r.events.stop()}finally{Fo(),Mo(),e._stopInProgress=!1}})()}_tryStart(){var e=this;return K(function*(){if(!e._enableRequested||e._active||e._startInProgress||e._stopInProgress)return;if(typeof window>`u`){e._diag.warn(`session replay cannot run in non-browser environments`);return}let t=e._userSessionManager.getUserSessionId();if(t===null){e._removeSessionStartedListener||(e._removeSessionStartedListener=e._userSessionManager.addSessionPartStartedListener(()=>{var t;(t=e._removeSessionStartedListener)==null||t.call(e),e._removeSessionStartedListener=void 0,e._tryStart()}));return}if(!e._userSessionManager.claimReplaySample(e._config.replaySampleRate)){e._diag.debug(`session replay skipped by sample rate`);return}e._startInProgress=!0;try{let n=yield Eo();if(!e._enableRequested||e._active)return;Po(t),Mo();let r=Jo(e._userSessionManager),i=()=>{},a=_o({chunkSeqStore:e._chunkSeqStore,config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,rrwebModule:n,sessionId:t,transport:e._context.transport}),o=lo({config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,sessionId:t,transport:e._context.transport}),s=()=>e._userSessionManager.nextReplayMetaVersion();e._context.transport.postReplay(),e._context.transport.postSessionMeta(qo(e._config,t,r,s(),`active`,null)),e._active={events:o,recorder:a,removeLifecycle:globalThis.__MXL_TEST_SKIP_REPLAY_LIFECYCLE__===!0?()=>void 0:Ko({config:e._config,events:o,nextMetaVersion:s,onFinalize:()=>{var t,n,r;(t=e._active)==null||t.removeLifecycle(),(n=e._active)==null||(r=n.removeSessionEndListener)==null||r.call(n),e._active=void 0,Fo(),Mo(),e._resumeWhenVisible()},recorder:a,sessionId:t,startedAt:r,transport:e._context.transport,visibilityDoc:e._visibilityDoc}),removeSessionEndListener:e._userSessionManager.addSessionPartEndedListener(()=>{a.flush(!0),o.flush(!0)}),rrwebModule:n},e._diag.debug(`session recording started`)}catch(t){e._diag.error(`failed to start session recording`,t)}finally{e._startInProgress=!1}})()}_resumeWhenVisible(){var e;if(this._removeResumeListener)return;let t=(e=this._visibilityDoc)==null?document:e,n=()=>{var e;t.visibilityState===`visible`&&((e=this._removeResumeListener)==null||e.call(this),this._removeResumeListener=void 0,this._tryStart())};t.addEventListener(`visibilitychange`,n),this._removeResumeListener=()=>{t.removeEventListener(`visibilitychange`,n)}}};F(),q();var Zo=class extends G{constructor(e={}){super({config:{},diag:e.diag,instrumentationName:`ReplayInstrumentation`,instrumentationVersion:`2.0.0`,perf:e.perf}),P(this,`_args`,void 0),P(this,`_sessionRecording`,void 0),P(this,`_wasPaused`,!1),P(this,`_stopPromise`,void 0),this._args=e,(!e.replayContext||!e.sessionStorage)&&this._diag.warn(`replayContext and sessionStorage are required for session recording`),this._config.enabled||this._diag.debug(`disabled, not starting`)}setUserSessionManager(e){super.setUserSessionManager(e),this._ensureSessionRecording(),this._config.enabled&&this._args.autoStart!==!1&&this._args.replayContext&&this._args.sessionStorage&&this.enable()}_ensureSessionRecording(){if(this._sessionRecording)return this._sessionRecording;let{replayContext:e,sessionStorage:t,autoStart:n,rrwebOptions:r,visibilityDoc:i}=this._args;if(!(!e||!t))return this._sessionRecording=new Xo({context:e,diag:this._diag,autoStart:n,rrwebOptions:r,sessionStorage:t,userSessionManager:this.userSessionManager,visibilityDoc:i}),this._sessionRecording}isRecording(){var e,t;return(e=(t=this._sessionRecording)==null?void 0:t.isRecording())==null?!1:e}enable(e){this._isEnabled=!0,this._startRecording(e)}onEnable(){this._startRecording()}_startRecording(e){this._wasPaused=!1,this._afterPendingStop(()=>{var t;(t=this._ensureSessionRecording())==null||t.enable(e)})}pause(){var e;this._wasPaused=!0,(e=this._sessionRecording)==null||e.pause()}resume(){if(!this._wasPaused){this.enable({force:!0});return}this._afterPendingStop(()=>{var e;(e=this._sessionRecording)==null||e.resume(),this._wasPaused=!1})}_afterPendingStop(e){if(this._stopPromise){this._stopPromise.then(e);return}e()}onDisable(){let e=this._sessionRecording;e&&(this._stopPromise=e.stop().finally(()=>{this._sessionRecording===e&&(this._sessionRecording=void 0),this._stopPromise=void 0}))}waitForDisable(){var e=this;return K(function*(){yield e._stopPromise})()}};function Qo(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function $o(e){e.forEach(e=>e.disable())}var es=n((()=>{}));function ts(e){var t,n;let r=e.tracerProvider||M.getTracerProvider(),i=e.meterProvider||Nt.getMeterProvider(),a=e.loggerProvider||Fa.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return Qo(o,r,i,a),()=>{$o(o)}}var ns=n((()=>{N(),H(),es()}));function rs(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function is(e){e&&e.logger&&(typeof e.logger==`function`?J=e.logger:J(`new logger isn't a function, not replacing`))}var J,as,os,ss,cs,ls=n((()=>{J=console.error.bind(console),as=(e,t,n)=>{if(!e||!e[t]){J(`no original function `+String(t)+` to wrap`);return}if(!n){J(`no wrapper function`),J(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){J(`original object and wrapper must be functions`);return}let i=n(r,t);return rs(i,`__original`,r),rs(i,`__unwrap`,()=>{e[t]===i&&rs(e,t,r)}),rs(i,`__wrapped`,!0),rs(e,t,i),i},os=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{J(`must provide one or more modules to patch`),J(Error().stack);return}if(!(t&&Array.isArray(t))){J(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{as(e,t,n)})})},ss=(e,t)=>{if(!e||!e[t]){J(`no function to unwrap.`),J(Error().stack);return}let n=e[t];if(!n.__unwrap)J(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},cs=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{J(`must provide one or more modules to patch`),J(Error().stack);return}if(!(t&&Array.isArray(t))){J(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{ss(e,t)})})},is.wrap=as,is.massWrap=os,is.unwrap=ss,is.massUnwrap=cs})),us,ds=n((()=>{N(),H(),ls(),F(),W(),us=class{constructor(e,t,n){P(this,`_config`,{}),P(this,`_tracer`,void 0),P(this,`_meter`,void 0),P(this,`_logger`,void 0),P(this,`_diag`,void 0),P(this,`instrumentationName`,void 0),P(this,`instrumentationVersion`,void 0),P(this,`_wrap`,as),P(this,`_unwrap`,ss),P(this,`_massWrap`,os),P(this,`_massUnwrap`,cs),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=j.createComponentLogger({namespace:e}),this._tracer=M.getTracer(e,t),this._meter=Nt.getMeter(e,t),this._logger=Fa.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=U({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}}})),fs,ps=n((()=>{ds(),fs=class extends us{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}}})),ms=n((()=>{ps(),N()}));function hs(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}var gs=n((()=>{})),_s=n((()=>{ns(),ms(),F(),gs()}));function vs(){if(ys===void 0)try{let e=globalThis.process.argv0;ys=e?`unknown_service:${e}`:`unknown_service`}catch(e){ys=`unknown_service`}return ys}var ys,bs=n((()=>{})),xs,Ss=n((()=>{xs=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function Cs(e,t){return ks.FromAttributeList(Object.entries(e),t)}function ws(){return Cs({})}function Ts(){return Cs({[ti]:vs(),[ni]:hi[ni],[ii]:hi[ii],[ai]:hi[ai]})}function Es(e){return e.map(([e,t])=>xs(t)?[e,t.catch(t=>{j.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Ds(e){if(typeof e==`string`||e===void 0)return e;j.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Os(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;j.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var ks,As=n((()=>{N(),B(),R(),bs(),Ss(),F(),q(),ks=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Es(t),r._asyncAttributesPending=t.filter(([e,t])=>xs(t)).length>0,r}constructor(e,t){var n;P(this,`_rawAttributes`,void 0),P(this,`_asyncAttributesPending`,!1),P(this,`_schemaUrl`,void 0),P(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(xs(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Es(this._rawAttributes),this._schemaUrl=Ds(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return K(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,xs(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&j.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(xs(n)){j.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Os(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),js=n((()=>{N(),As(),R(),B(),F(),bs()}));N();function Ms(e){return Ns(e,new WeakSet)}function Ns(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(!Ns(n,t))return!1;return!0}let n=e;if(n.constructor!==Object&&n.constructor!==void 0)return!1;for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&!Ns(n[e],t))return!1;return!0}return!1}var Y;(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`})(Y||(Y={}));function Ps(e,t,n,r,i){if(r.length===0)return j.warn(`Invalid attribute key: ${r}`),Y.DROP_INVALID;if(!Ms(i))return j.warn(`Invalid attribute value set for key: ${r}`),Y.DROP_INVALID;let a=!Object.prototype.hasOwnProperty.call(e,r);return a&&n>=t.attributeCountLimit?Y.DROP_LIMIT_REACHED:(e[r]=Fs(i,t.attributeValueLengthLimit),a?Y.ADD_NEW:Y.ADD_OVERWRITE_EXISTING)}function Fs(e,t){if(t<=0)return j.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(e=>Fs(e,t));if(typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=Fs(i,t);return n}return e}function Is(e,t){if(t==null)return{};let n={},r=0,i=0;for(let[a,o]of Object.entries(t)){let t=Ps(n,e,r,a,o);t===Y.ADD_NEW?r+=1:(t===Y.DROP_INVALID||t===Y.DROP_LIMIT_REACHED)&&(i+=1)}return{attributes:r>0?n:void 0,droppedAttributesCount:i}}N(),B(),R(),F();var Ls=class{get hrTime(){return this._hrTime}set hrTime(e){this._isLogRecordReadonly()||(this._hrTime=e)}get hrTimeObserved(){return this._hrTimeObserved}set hrTimeObserved(e){this._isLogRecordReadonly()||(this._hrTimeObserved=e)}get spanContext(){return this._spanContext}set spanContext(e){this._isLogRecordReadonly()||(this._spanContext=e)}set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`attributes`,{}),P(this,`_hrTime`,void 0),P(this,`_hrTimeObserved`,void 0),P(this,`_spanContext`,void 0),P(this,`_severityText`,void 0),P(this,`_severityNumber`,void 0),P(this,`_body`,void 0),P(this,`_eventName`,void 0),P(this,`_attributesCount`,0),P(this,`_droppedAttributesCount`,0),P(this,`_isReadonly`,!1),P(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this._hrTime=xi(r==null?f:r),this._hrTimeObserved=xi(i==null?f:i),d){let e=M.getSpanContext(d);e&&rt(e)&&(this._spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;let n=Ps(this.attributes,this._logRecordLimits,this._attributesCount,e,t);return n===Y.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&j.warn(`Dropping extra attributes.`)):n===Y.ADD_NEW&&this._attributesCount++,this}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(qr,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Yr,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Yr,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(qr,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Jr,n.stack),t=!0)}t||j.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&j.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};H(),N(),F(),W();var Rs=class{constructor(e,t){P(this,`_instrumentationScope`,void 0),P(this,`_sharedState`,void 0),P(this,`_loggerConfig`,void 0),this._instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let t=e.context||A.active();if(!this.enabled(e))return;let n=new Ls(this._sharedState,this._instrumentationScope,U({context:t},e));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,t),n._makeReadonly()}enabled(e){if(this._sharedState.hasShutdown)return!1;let t=this._loggerConfig;if(t.disabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==V.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||A.active();if(t.traceBased){let e=M.getSpanContext(r);if(e&&rt(e)&&(e.traceFlags&k.SAMPLED)!==k.SAMPLED)return!1}let i={context:r,instrumentationScope:this._instrumentationScope,severityNumber:e==null?void 0:e.severityNumber,eventName:e==null?void 0:e.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},zs=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};B(),F(),q();var Bs=class{constructor(e){P(this,`processors`,void 0),this.processors=e}forceFlush(e){var t=this;return K(function*(){var n;let r=(n=e==null?void 0:e.timeoutMillis)==null?3e4:n;yield Promise.all(t.processors.map(e=>ta(e.forceFlush(),r)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return K(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function Vs(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(Vs)]:[`map`,Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,Vs(t)])]}function Hs(e){var t;return JSON.stringify([e.name,e.version||``,e.schemaUrl||``,Vs(e.attributes),(t=e.droppedAttributesCount)==null?0:t])}let Us=`error.type`;F();var Ws=class{constructor(e){P(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(`otel.sdk.log.created`,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}};N(),H(),W(),F();let Gs={disabled:!1,minimumSeverity:V.UNSPECIFIED,traceBased:!1},Ks=()=>U({},Gs);var qs=class{constructor(e,t,n,r,i){P(this,`loggers`,new Map),P(this,`activeProcessor`,void 0),P(this,`registeredLogRecordProcessors`,[]),P(this,`resource`,void 0),P(this,`logRecordLimits`,void 0),P(this,`processors`,void 0),P(this,`loggerMetrics`,void 0),P(this,`hasShutdown`,!1),P(this,`_loggerConfigurator`,void 0),P(this,`_loggerConfigs`,new Map),this.resource=e,this.logRecordLimits=t,this.processors=n,n.length>0?(this.registeredLogRecordProcessors=n,this.activeProcessor=new Bs(this.registeredLogRecordProcessors)):this.activeProcessor=new zs,this._loggerConfigurator=r==null?Ks:r;let a=i?i.getMeter(`@opentelemetry/sdk-logs`,`0.222.0`):D();this.loggerMetrics=new Ws(a)}getLoggerConfig(e){let t=Hs(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};N(),H(),js(),B(),F(),W();var Js=class{constructor(e={}){var t,n,r,i,a,o,s;P(this,`_shutdownOnce`,void 0),P(this,`_sharedState`,void 0);let c={resource:(t=e.resource)==null?Ts():t,logRecordLimits:{attributeCountLimit:(n=(r=e.logRecordLimits)==null?void 0:r.attributeCountLimit)==null?128:n,attributeValueLengthLimit:(i=(a=e.logRecordLimits)==null?void 0:a.attributeValueLengthLimit)==null?1/0:i},loggerConfigurator:(o=e.loggerConfigurator)==null?Ks:o,processors:(s=e.processors)==null?[]:s,meterProvider:e.meterProvider};this._sharedState=new qs(c.resource,c.logRecordLimits,c.processors,c.loggerConfigurator,c.meterProvider),this._shutdownOnce=new la(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return j.warn(`A shutdown LoggerProvider cannot provide a Logger`),va();e||j.warn(`Logger requested without instrumentation scope name.`);let r=U({name:e||`unknown`,version:t,schemaUrl:n==null?void 0:n.schemaUrl},Is(this._sharedState.logRecordLimits,n==null?void 0:n.attributes)),i=Hs(r);return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Rs(r,this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(e){return this._shutdownOnce.isCalled?(j.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush(e)}shutdown(){return this._shutdownOnce.isCalled?(j.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.hasShutdown=!0,this._sharedState.activeProcessor.shutdown()}};F(),W();let Ys=new Map;var Xs=class{constructor(e,t,n){var r;P(this,`processedLogs`,void 0),P(this,`queueSize`,void 0),P(this,`queueSizeCallback`,void 0),P(this,`standardAttrs`,void 0),P(this,`droppedAttrs`,void 0);let i=(r=Ys.get(e))==null?0:r;if(Ys.set(e,i+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${i}`},this.droppedAttrs=U(U({},this.standardAttrs),{},{[Us]:`queue_full`}),this.processedLogs=t.createCounter(`otel.sdk.processor.log.processed`,{unit:`{log_record}`,description:`The number of log records for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(`otel.sdk.processor.log.queue.capacity`,{unit:`{log_record}`,description:`The maximum number of log records the queue of a given instance of an SDK log processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(`otel.sdk.processor.log.queue.size`,{unit:`{log_record}`,description:`The number of log records in the queue of a given instance of an SDK log processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropLogs(e){this.processedLogs.add(e,this.droppedAttrs)}finishLogs(e,t){if(!t){this.processedLogs.add(e,this.standardAttrs);return}let n=U(U({},this.standardAttrs),{},{[Us]:t.name});this.processedLogs.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};N(),B(),q(),F();function Zs(e){return Qs.apply(this,arguments)}function Qs(){return Qs=K(function*(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&(yield Promise.all(t))}),Qs.apply(this,arguments)}var $s=class{constructor(e,t,n,r){P(this,`_exportCompleted`,void 0),P(this,`_exportScheduledPromise`,void 0),P(this,`_metrics`,void 0),P(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n),this._metrics=r}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(e,t,n){var r=this;return K(function*(){try{yield Zs(t),yield A.with(fr(A.active()),K(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){Er(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return K(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{if(r._metrics.finishLogs(t.length,e.error),clearTimeout(o),e.code===z.SUCCESS)i();else{var n;a((n=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):n)}}),r._exportScheduledResolve()})})()}},ec=class{constructor(e){var t,n,r,i;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_metrics`,void 0),P(this,`_currentExport`,null),P(this,`_finishedLogRecords`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_flushing`,!1),this._exporter=e.exporter,this._maxExportBatchSize=(t=e.maxExportBatchSize)==null?512:t,this._maxQueueSize=(n=e.maxQueueSize)==null?2048:n,this._scheduledDelayMillis=(r=e.scheduledDelayMillis)==null?1e3:r,this._exportTimeoutMillis=(i=e.exportTimeoutMillis)==null?3e4:i,this._shutdownOnce=new la(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(j.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let a=e!=null&&e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-logs`):D();this._metrics=new Xs(`batching_log_processor`,a,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedLogRecords.length})}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){if(this._finishedLogRecords.length>=this._maxQueueSize){this._metrics.dropLogs(1);return}this._finishedLogRecords.push(e),this._maybeStartTimer()}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return K(function*(){e.onShutdown(),yield e._flushAll(),e._metrics.shutdown(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return K(function*(){if(e._flushing)return;e._flushing=!0;let t=e._finishedLogRecords;e._finishedLogRecords=[],e._clearTimer();let n=e._currentExport;for(n!==null&&(yield e._exporter.forceFlush(),yield n.exportCompleted,e._currentExport=null);t.length>0;){let n;t.length<=e._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,e._maxExportBatchSize);let r=new $s(e._exporter,n,e._exportTimeoutMillis,e._metrics);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){Er(e)}finally{e._currentExport=null}}e._flushing=!1,e._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new $s(this._exporter,e,this._exportTimeoutMillis,this._metrics);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,Er(e),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)}};F();var tc=class extends ec{constructor(e){super(e),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this._onInit(e)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){e.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))}},nc,rc=n((()=>{nc=`exception`}));function ic(e){let t={};for(let[n,r]of e.getRawAttributes())typeof(r==null?void 0:r.then)!=`function`&&r!=null&&(t[n]!=null||(t[n]=r));return t}function ac(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r!=null&&r.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,U(U({},r),{},{depth:r.depth==null?r.depth:r.depth-1}))}`}var oc,sc=n((()=>{W(),oc=Symbol.for(`nodejs.util.inspect.custom`)})),cc,lc=n((()=>{N(),B(),R(),rc(),sc(),F(),cc=class{constructor(e){var t,n;P(this,`_spanContext`,void 0),P(this,`kind`,void 0),P(this,`parentSpanContext`,void 0),P(this,`attributes`,{}),P(this,`links`,[]),P(this,`events`,[]),P(this,`startTime`,void 0),P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_droppedAttributesCount`,0),P(this,`_droppedEventsCount`,0),P(this,`_droppedLinksCount`,0),P(this,`_attributesCount`,0),P(this,`name`,void 0),P(this,`status`,{code:Ct.UNSET}),P(this,`endTime`,[0,0]),P(this,`_ended`,!1),P(this,`_duration`,[-1,-1]),P(this,`_spanProcessor`,void 0),P(this,`_spanLimits`,void 0),P(this,`_attributeValueLengthLimit`,void 0),P(this,`_recordEndMetrics`,void 0),P(this,`_performanceStartTime`,void 0),P(this,`_performanceOffset`,void 0),P(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=_i.now(),this._performanceOffset=r-(this._performanceStartTime+_i.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return j.warn(`Invalid attribute key: ${e}`),this;if(!vr(t))return j.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return j.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&j.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Ei(t)&&(Ei(n)||(n=t),t=void 0);let i=gr(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&j.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=gr(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Ct.UNSET||this.status.code===Ct.OK)return this;let t={code:e.code};return e.code===Ct.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&j.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){j.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=Si(this.startTime,this.endTime),this._duration[0]<0&&(j.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&&j.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&j.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=_i.now())return bi(e+this._performanceOffset);if(typeof e==`number`)return yi(e);if(e instanceof Date)return yi(e.getTime());if(Ti(e))return e;if(this._startTimeProvided)return yi(Date.now());let t=_i.now()-this._performanceStartTime;return Di(this.startTime,yi(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[qr]=e:e&&(e.code?n[Yr]=e.code.toString():e.name&&(n[Yr]=e.name),e.message&&(n[qr]=e.message),e.stack&&(n[Jr]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(nc,n,t):j.warn(`Failed to record an exception ${e}`)}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 e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);j.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(j.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[oc](e,t,n){return ac(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:ic(this.resource)}},e,t,n)}}})),uc,dc=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(uc||(uc={}))})),fc,pc,mc,hc,gc,_c,vc,yc,bc,xc,Sc=n((()=>{fc=`otel.component.name`,pc=`otel.component.type`,mc=`otel.span.parent.origin`,hc=`otel.span.sampling_result`,gc=`otel.sdk.processor.span.processed`,_c=`otel.sdk.processor.span.queue.capacity`,vc=`otel.sdk.processor.span.queue.size`,yc=`otel.sdk.span.live`,bc=`otel.sdk.span.started`,xc=`batching_span_processor`}));function Cc(e){return e?e.isRemote?`remote`:`local`:`none`}function wc(e){switch(e){case uc.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case uc.RECORD:return`RECORD_ONLY`;case uc.NOT_RECORD:return`DROP`}}var Tc,Ec=n((()=>{dc(),Sc(),F(),Tc=class{constructor(e){P(this,`startedSpans`,void 0),P(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(bc,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(yc,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=wc(t);if(this.startedSpans.add(1,{[mc]:Cc(e),[hc]:n}),t===uc.NOT_RECORD)return()=>{};let r={[hc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}})),Dc,Oc=n((()=>{Dc=`2.11.0`})),kc,Ac=n((()=>{N(),B(),lc(),Ec(),Oc(),sc(),F(),kc=class{constructor(e,t){P(this,`_sampler`,void 0),P(this,`_spanLimits`,void 0),P(this,`_idGenerator`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_resource`,void 0),P(this,`_spanProcessor`,void 0),P(this,`_tracerMetrics`,void 0),this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,Dc);this._tracerMetrics=new Tc(n)}startSpan(e,t={},n=A.active()){var r,i,a;t.root&&(n=M.deleteSpan(n));let o=M.getSpan(n);if(pr(n))return j.debug(`Instrumentation suppressed, returning Noop Span`),M.wrapSpanContext(He);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!M.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?xt.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:gr(e.attributes)})),m=gr(t.attributes),h=this._sampler.shouldSample(n,u,e,f,m,p),g=this._tracerMetrics.startSpan(s,h.decision);d=(a=h.traceState)==null?d:a;let _=h.decision===yt.RECORD_AND_SAMPLED?k.SAMPLED:k.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===yt.NOT_RECORD)return j.debug(`Recording is off, propagating context in a non-recording span`),M.wrapSpanContext(v);let ee=gr(Object.assign(m,h.attributes));return new cc({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:v,name:e,kind:f,links:p,parentSpanContext:l,attributes:ee,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}startActiveSpan(e,t,n,r){var i;let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=r);let c=(i=o)==null?A.active():i,l=this.startSpan(e,a,c),u=M.setSpan(c,l);return A.with(u,s,void 0,l)}[oc](e,t,n){return ac(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:ic(this._resource)},spanLimits:this._spanLimits},e,t,n)}}})),jc,Mc=n((()=>{B(),F(),jc=class{constructor(e){P(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Er(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}})),Nc,Pc=n((()=>{dc(),Nc=class{shouldSample(){return{decision:uc.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),Fc,Ic=n((()=>{dc(),Fc=class{shouldSample(){return{decision:uc.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),Lc,Rc=n((()=>{N(),B(),Pc(),Ic(),F(),Lc=class{constructor(e){var t,n,r,i;P(this,`_root`,void 0),P(this,`_remoteParentSampled`,void 0),P(this,`_remoteParentNotSampled`,void 0),P(this,`_localParentSampled`,void 0),P(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Er(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Fc),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Fc:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new Nc:n,this._localParentSampled=(r=e.localParentSampled)==null?new Fc:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new Nc:i}shouldSample(e,t,n,r,i,a){let o=M.getSpanContext(e);return!o||!rt(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&k.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&k.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),zc,Bc,Vc=n((()=>{R(),Sc(),F(),W(),zc=new Map,Bc=class{constructor(e,t,n){var r;P(this,`processedSpans`,void 0),P(this,`queueSize`,void 0),P(this,`queueSizeCallback`,void 0),P(this,`standardAttrs`,void 0),P(this,`droppedAttrs`,void 0);let i=(r=zc.get(e))==null?0:r;if(zc.set(e,i+1),this.standardAttrs={[pc]:e,[fc]:`${e}/${i}`},this.droppedAttrs=U(U({},this.standardAttrs),{},{[Kr]:`queue_full`}),this.processedSpans=t.createCounter(gc,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(_c,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(vc,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n=U(U({},this.standardAttrs),{},{[Kr]:t.name});this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}})),Hc,Uc=n((()=>{N(),B(),Vc(),Sc(),F(),Hc=class{constructor(e){var t,n,r,i;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_metrics`,void 0),P(this,`_isExporting`,!1),P(this,`_finishedSpans`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_droppedSpansCount`,0),this._exporter=e.exporter,this._maxExportBatchSize=(t=e.maxExportBatchSize)==null?512:t,this._maxQueueSize=(n=e.maxQueueSize)==null?2048:n,this._scheduledDelayMillis=(r=e.scheduledDelayMillis)==null?5e3:r,this._exportTimeoutMillis=(i=e.exportTimeoutMillis)==null?3e4:i,this._shutdownOnce=new la(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(j.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let a=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):D();this._metrics=new Bc(xc,a,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&k.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&j.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(j.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);A.with(fr(A.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{if(clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===z.SUCCESS)e();else{var a;t((a=i.error)==null?Error(`BatchSpanProcessor: span export failed`):a)}}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a!=null||(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{Er(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Er(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),Wc,Gc=n((()=>{Uc(),B(),F(),Wc=class extends Hc{constructor(e){super(e),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{Er(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Er(e)})},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))}}}));function Kc(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 qc(e){let t=``;for(let n=0;n<e.length;n++)t+=Qc[e[n]];return t}var Jc,Yc,Xc,Zc,Qc,$c,el=n((()=>{Jc=16,Yc=8,Xc=new Uint8Array(Jc),Zc=new Uint8Array(Yc),Qc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),$c=class{generateTraceId(){return Kc(Xc),qc(Xc)}generateSpanId(){return Kc(Zc),qc(Zc)}}})),tl=n((()=>{Gc(),el()})),nl,rl,il=n((()=>{N(),js(),Ac(),Mc(),Rc(),Ic(),tl(),sc(),F(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(nl||(nl={})),rl=class{constructor(e={}){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;P(this,`_resource`,void 0),P(this,`_activeSpanProcessor`,void 0),P(this,`_forceFlushTimeoutMillis`,void 0),P(this,`_tracerOptions`,void 0),P(this,`_tracers`,new Map),this._forceFlushTimeoutMillis=(t=e.forceFlushTimeoutMillis)==null?3e4:t,this._resource=(n=e.resource)==null?Ts():n;let v=(r=e.spanProcessors)==null?[]:r;this._activeSpanProcessor=new jc(v),this._tracerOptions={resource:this._resource,sampler:(i=e.sampler)==null?new Lc({root:new Fc}):i,spanLimits:{attributeCountLimit:(a=(o=e.spanLimits)==null?void 0:o.attributeCountLimit)==null?128:a,attributeValueLengthLimit:(s=(c=e.spanLimits)==null?void 0:c.attributeValueLengthLimit)==null?1/0:s,eventCountLimit:(l=(u=e.spanLimits)==null?void 0:u.eventCountLimit)==null?128:l,linkCountLimit:(d=(f=e.spanLimits)==null?void 0:f.linkCountLimit)==null?128:d,attributePerEventCountLimit:(p=(m=e.spanLimits)==null?void 0:m.attributePerEventCountLimit)==null?128:p,attributePerLinkCountLimit:(h=(g=e.spanLimits)==null?void 0:g.attributePerLinkCountLimit)==null?128:h},idGenerator:e.idGenerator||new $c,spanProcessor:this._activeSpanProcessor,meterProvider:(_=e.meterProvider)==null?{getMeter(){return D()}}:_}}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new kc({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(e){var t;let n=(t=e==null?void 0:e.timeoutMillis)==null?this._forceFlushTimeoutMillis:t,r=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(t=>{let r,i=setTimeout(()=>{t(Error(`Span processor did not completed within timeout period of ${n} ms`)),r=nl.timeout},n);e.forceFlush().then(()=>{clearTimeout(i),r!==nl.timeout&&(r=nl.resolved,t(r))}).catch(e=>{clearTimeout(i),r=nl.error,t(e)})}));return new Promise((e,t)=>{Promise.all(r).then(n=>{let r=n.filter(e=>e!==nl.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[oc](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return ac(`TracerProvider`,{resource:{attributes:ic(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>{var t,n;return(t=(n=e.constructor)==null?void 0:n.name)==null?`SpanProcessor`:t})},e,t,n)}}})),al=n((()=>{il(),tl(),B(),F(),N(),Vc(),Sc(),q(),Pc(),Ic(),dc(),Rc()})),ol,sl=n((()=>{N(),F(),ol=class{constructor(){P(this,`_enabled`,!1),P(this,`_currentContext`,T)}_bindFunction(e=T,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=T,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=T,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||T;try{return t.call(n,...r)}finally{this._currentContext=i}}}})),X,cl=n((()=>{(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`})(X||(X={}))})),ll,ul,dl=n((()=>{ll=`http.response_content_length`,ul=`http.response_content_length_uncompressed`}));function fl(){return Sl||(Sl=document.createElement(`a`)),Sl}function pl(e,t){return t in e}function Z(e,t,n,r=!0){if(pl(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function ml(e,t,n=!1,r,i){if(r===void 0&&(r=t[X.START_TIME]!==0),n||(Z(e,X.FETCH_START,t,r),Z(e,X.DOMAIN_LOOKUP_START,t,r),Z(e,X.DOMAIN_LOOKUP_END,t,r),Z(e,X.CONNECT_START,t,r),Z(e,X.SECURE_CONNECTION_START,t,r),Z(e,X.CONNECT_END,t,r),Z(e,X.REQUEST_START,t,r),Z(e,X.RESPONSE_START,t,r),Z(e,X.RESPONSE_END,t,r)),!i){let n=t[X.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(ll,n);let r=t[X.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(ul,r)}}function hl(e){return e.slice().sort((e,t)=>{let n=e[X.FETCH_START],r=t[X.FETCH_START];return n>r?1:n<r?-1:0})}function gl(){return typeof location<`u`?location.origin:void 0}function _l(e,t,n,r,i=new WeakSet,a){let o=bl(e);e=o.toString();let s=yl(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=hl(s);if(o.origin!==gl()&&c.length>1){let e=c[0],t=vl(c,e[X.RESPONSE_END],n),r=e[X.RESPONSE_END];return t[X.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function vl(e,t,n){let r=Ci(n),i=Ci(xi(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=Ci(xi(n[X.FETCH_START])),c=r-Ci(xi(n[X.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function yl(e,t,n,r,i,a){let o=Ci(t),s=Ci(n),c=r.filter(t=>{let n=Ci(xi(t[X.FETCH_START])),r=Ci(xi(t[X.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function bl(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=fl();return t.href=e,t}function xl(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),bl(e).origin===gl()?!0:n.some(t=>ia(e,t))}var Sl,Cl=n((()=>{cl(),B(),dl()})),wl=n((()=>{B(),N(),al(),W(),sl(),cl(),Cl()}));_s(),al(),wl();let Tl={compression:`gzip`,concurrencyLimit:5,keepalive:!0,timeoutMillis:30*1e3},El=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t}),Dl={name:`span`,countItems:e=>e.length},Ol={name:`log`,countItems:e=>e.length};function kl(e,t){let n={attributes:jl(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Al(e,t){let n={name:e.name,version:e.version};if(e.attributes&&Object.keys(e.attributes).length>0){var r;n.attributes=jl(e.attributes,t),n.droppedAttributesCount=(r=e.droppedAttributesCount)==null?0:r}return n}function jl(e,t){return Object.keys(e).map(n=>Ml(n,e[n],t))}function Ml(e,t,n){return{key:e,value:Nl(t,n)}}function Nl(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=Nl(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:Nl(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function Pl(e,t){return{resourceLogs:Il(e,t)}}function Fl(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:r}=n,i=t.get(e);i||(i=new Map,t.set(e,i));let a=i.get(r);a||(a=[],i.set(r,a)),a.push(n)}return t}function Il(e,t){let n=Fl(e);return Array.from(n,([e,n])=>{let r=kl(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:Al(e[0].instrumentationScope,t),logRecords:e.map(e=>Ll(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Ll(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Rl(e.severityNumber),severityText:e.severityText,body:Nl(e.body,t),eventName:e.eventName,attributes:jl(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:(n=e.spanContext)==null?void 0:n.traceFlags,traceId:t.encodeOptionalSpanContext((r=e.spanContext)==null?void 0:r.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)==null?void 0:i.spanId)}}function Rl(e){return e}B();function zl(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Bl(e){return zl(e).toString()}let Vl=typeof BigInt<`u`?Bl:Ci;function Hl(e){return e}let Ul={encodeHrTime:Vl,encodeSpanContext:Hl,encodeOptionalSpanContext:Hl,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};N();let Wl={serializeRequest:e=>{let t=Pl(e,Ul);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(e){return j.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};function Gl(e,t){let n=e&255|256;return t&&(n|=512),n}function Kl(e,t){var n,r,i,a;let o=e.spanContext(),s=e.status,c=(n=e.parentSpanContext)!=null&&n.spanId?t.encodeSpanContext((r=e.parentSpanContext)==null?void 0:r.spanId):void 0;return{traceId:t.encodeSpanContext(o.traceId),spanId:t.encodeSpanContext(o.spanId),parentSpanId:c,traceState:(i=o.traceState)==null?void 0:i.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:jl(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Jl(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>ql(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Gl(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function ql(e,t){var n;return{attributes:e.attributes?jl(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(n=e.context.traceState)==null?void 0:n.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Gl(e.context.traceFlags,e.context.isRemote)}}function Jl(e,t){return{attributes:e.attributes?jl(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Yl(e,t){return{resourceSpans:Zl(e,t)}}function Xl(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Zl(e,t){let n=Xl(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Kl(e,t));o.push({scope:Al(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=kl(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}N();let Ql={serializeRequest:e=>{let t=Yl(e,Ul);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(e){return j.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};var $l=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};F();var eu=class extends Error{constructor(e,t,n){super(e),P(this,`code`,void 0),P(this,`name`,`OTLPExporterError`),P(this,`data`,void 0),this.data=n,this.code=t}};F(),q();var tu=class{constructor(e){P(this,`_concurrencyLimit`,void 0),P(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var e=this;return K(function*(){yield Promise.all(e._sendingPromises)})()}};function nu(e){return new tu(e.concurrencyLimit)}N();function ru(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function iu(){return{handleResponse(e){e==null||!ru(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||j.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}B(),N(),F(),q();var au=class{constructor(e,t,n,r,i,a){P(this,`_metrics`,void 0),P(this,`_diagLogger`,void 0),P(this,`_transport`,void 0),P(this,`_serializer`,void 0),P(this,`_responseHandler`,void 0),P(this,`_promiseQueue`,void 0),P(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=a,this._diagLogger=j.createComponentLogger({namespace:`OTLPExportDelegate`}),this._metrics=i}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:z.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:z.FAILED,error:Error(`Nothing to send`)});return}let r=this._metrics.startExport(e);this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(r(void 0),e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:z.SUCCESS});return}else if(e.status===`failure`&&e.error){r(e.error),t({code:z.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;r(`export_max_retries`),t({code:z.FAILED,error:(n=e.error)==null?new eu(`Export failed with retryable status`):n})}else r(`export_failed`),t({code:z.FAILED,error:new eu(`Export failed with unknown error`)})},e=>{r(e),t({code:z.FAILED,error:e})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(e){this._metrics=e}shutdown(){var e=this;return K(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function ou(e,t){return new au(e.transport,e.serializer,iu(),e.promiseHandler,e.metrics,t.timeout)}function su(e,t,n,r){return ou({transport:r,serializer:t,promiseHandler:nu(e),metrics:n},{timeout:e.timeoutMillis})}N(),B(),F(),W();let cu=new Map;var lu=class{constructor(e){var t;P(this,`inflight`,void 0),P(this,`exported`,void 0),P(this,`duration`,void 0),P(this,`standardAttrs`,void 0),P(this,`responseAttributesFromError`,void 0),P(this,`helper`,void 0);let{componentType:n,metricsHelper:r,meterProvider:i,url:a,responseAttributesFromError:o}=e;this.responseAttributesFromError=o;let s=i?i.getMeter(`@opentelemetry/otlp-exporter`,`0.222.0`):D(),c=(t=cu.get(n))==null?0:t;if(cu.set(n,c+1),this.standardAttrs={"otel.component.type":n,"otel.component.name":`${n}/${c}`},a){let e=a;a.includes(`://`)||(e=`http://${a}`);try{let t=new URL(e);this.standardAttrs[`server.address`]=t.hostname;let n;t.port?n=Number(t.port):t.protocol===`http:`?n=80:t.protocol===`https:`&&(n=443),typeof n==`number`&&(this.standardAttrs[`server.port`]=n)}catch(e){}}this.helper=r,this.inflight=s.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`}),this.exported=s.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s for which the export has finished, either successful or failed.`}),this.duration=s.createHistogram(`otel.sdk.exporter.operation.duration`,{unit:`s`,description:`The duration of exporting a batch of telemetry records.`,advice:{explicitBucketBoundaries:[]}})}startExport(e){let t=this.helper.countItems(e),n=bi();return this.inflight.add(t,this.standardAttrs),e=>{let r=bi();this.inflight.add(-t,this.standardAttrs);let i=e?U(U({},this.standardAttrs),{},{"error.type":e instanceof Error?e.name:`export_failed`}):this.standardAttrs;this.exported.add(t,i);let a=U(U({},i),this.responseAttributesFromError(e)),o=wi(Si(n,r))/1e3;this.duration.record(o,a)}}};N(),q();let uu=49152,du=0,fu=0,pu=e=>typeof e==`string`?new TextEncoder().encode(e).byteLength:e.byteLength;function mu(e){return hu.apply(this,arguments)}function hu(){return hu=K(function*(e){try{let{body:t}=e;if(!t)return;let n=t.getReader();try{let e=yield n.read();for(;!e.done;)e=yield n.read()}finally{n.releaseLock()}}catch(e){let t=e instanceof Error?e:Error(String(e));j.debug(`Fetch transport failed to drain response body: ${t.message}`)}}),hu.apply(this,arguments)}function gu(e,t){return _u.apply(this,arguments)}function _u(){return _u=K(function*(e,t){let n,r;if(`timeout`in AbortSignal)n=AbortSignal.timeout(t.timeoutMillis);else{let e=new AbortController;({signal:n}=e),r=setTimeout(()=>{e.abort(new DOMException(`TimeoutError`,`TimeoutError`))},t.timeoutMillis)}let i=pu(t.body),a=!1;if(t.keepalive){let e=du+i>uu;if(a=!e&&!(fu>=9),a)du+=i,fu++;else{let t=e?`inflight bytes (${du} + ${i}) would exceed ${uu}B budget`:`concurrent count (${fu}) at limit of 9`;j.debug(`Sending without keepalive: ${t}`)}}let o=()=>{r!==void 0&&clearTimeout(r)},s=a?()=>{o(),du-=i,fu--}:o,c;try{c=yield fetch(e,{body:t.body,headers:t.headers,keepalive:a,method:`POST`,signal:n})}catch(e){throw s(),e}return mu(c).finally(s),{keepalive:a,response:c}}),_u.apply(this,arguments)}N(),q(),W();var vu=class e{constructor(e){this._config=e}static _compressRequest(e){return K(function*(){let t=new CompressionStream(`gzip`),n=t.writable.getWriter();n.write(e),n.close();let r=[],i=t.readable.getReader(),a=!1;for(;!a;){let e=yield i.read();e.value&&r.push(e.value),{done:a}=e}let o=new Uint8Array(r.reduce((e,t)=>e+t.length,0)),s=0;for(let e of r)o.set(e,s),s+=e.length;return o})()}send(e,t){return this._asyncSend(e,t)}shutdown(){}_asyncSend(t,n){var r=this;return K(function*(){let i=t,a=U({"Content-Type":`application/json`},r._config.headers),o=!1;try{if(r._config.compression===`gzip`){try{i=yield e._compressRequest(t)}catch(e){let t=e instanceof Error?e:Error(String(e));return j.warn(`Fetch transport gzip compression failed: ${t.message}`),{error:t,status:`failure`}}a[`Content-Encoding`]=`gzip`,a[`Content-Length`]=i.length.toString()}let s=yield gu(r._config.url,{body:i,headers:a,keepalive:!0,timeoutMillis:n});({keepalive:o}=s);let{response:c}=s;if(c.ok)return{status:`success`};let l=Error(`${c.status} Fetch request failed`),u=`Fetch transport received HTTP ${c.status} (keepalive=${o})`;return c.status>=500?(j.debug(u),{error:l,status:`retryable`}):(j.warn(u),{error:l,status:`failure`})}catch(e){let t=e instanceof Error?e:Error(String(e)),n=t instanceof TypeError||t instanceof DOMException&&t.name===`TimeoutError`,r=`Fetch transport failed (keepalive=${o}): ${t.message}`;return n?j.debug(r):j.warn(r),{error:t,status:n?`retryable`:`failure`}}})()}};let yu=e=>new vu(e);q();let bu=()=>Math.random()*40-20;var xu=class{constructor(e,t=new ga){this._transport=e,this._perf=t}send(e,t){var n=this;return K(function*(){let r=n._perf.getNowMillis()+t,i=yield n._transport.send(e,t),a=5,o=1e3;for(;i.status===`retryable`&&a>0;){var s;a--;let t=Math.max(Math.min(o,5e3)+bu(),0);o*=1.5;let c=(s=i.retryInMillis)==null?t:s,l=r-n._perf.getNowMillis();if(c>l)return i;i=yield n._retry(e,l,c)}return i})()}shutdown(){this._transport.shutdown()}_retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}};let Su=e=>{var t;return new xu(e.transport,(t=e.perf)==null?new ga:t)},Cu=`http.response.status_code`;function wu(e){if(!e)return{[Cu]:200};if(!(e instanceof Error))return{};if(e.message.startsWith(`Fetch request failed with non-retryable status `)){let t=e.message.substring(47);return{[Cu]:Number(t)}}return{}}function Tu(e,t,n){return new lu({componentType:e,metricsHelper:t,url:n,meterProvider:void 0,responseAttributesFromError:wu})}let Eu=(e,t,n,r)=>su(e,t,Tu(n,r,e.url),Su({transport:yu(e)}));var Du=class extends $l{constructor(e){super(Eu(e,Wl,`otlp_http_log_exporter`,Ol))}};W();var Ou=class extends Du{constructor({appId:e,userID:t,collectorUrl:n}){super(U(U({},Tl),{},{headers:El(e,t),url:`${n}/v1/logs`}))}};W();var ku=class extends $l{constructor(e){super(Eu(U(U({},e),{},{compression:`gzip`}),Ql,`otlp_http_span_exporter`,Dl))}};W();var Au=class extends ku{constructor({appId:e,userID:t,collectorUrl:n}){super(U(U({},Tl),{},{headers:El(e,t),url:`${n}/v1/traces`}))}};function ju(e){return{isRecording:()=>e.isRecording(),setEnabled:t=>{if(t){e.resume();return}e.pause()}}}W(),q();let Mu=e=>({"mxl-client-id":e}),Nu=0;function Pu(e,t){let n=Date.now();n-Nu<3e4||(Nu=n,console.warn(`[mxl] session replay ${e} failed (dropping; will retry on next chunk):`,t))}function Fu(e){let t=Mu(e.appId),n=e.configUrl,{collectorUrl:r}=e,i=[`${n}/sessionReplays/`,`${n}/sessionEvents`,`${n}/replay`,`${r}/v1/logs`,`${r}/v1/traces`],a=e=>i.some(t=>e.startsWith(t)),o=function(){var e=K(function*(e,r,i,a,o){try{let{response:s}=yield gu(`${n}${r}`,{body:i,headers:U(U({},t),a),keepalive:o,timeoutMillis:1e4});return s.ok?`accepted`:(Pu(e,Error(`HTTP ${s.status}`)),s.status===413?`exhausted`:`rejected`)}catch(t){return Pu(e,t),`failed`}});return function(t,n,r,i,a){return e.apply(this,arguments)}}(),s=function(){var t=K(function*(t=!1){e.apiKey&&(yield o(`replay POST`,`/replay`,`null`,{"content-type":`application/json`,"mxl-api-key":e.apiKey},t))});return function(){return t.apply(this,arguments)}}(),c=function(){var e=K(function*(e,t=!1){yield o(`metadata POST`,`/sessionReplays/meta`,`${JSON.stringify(e)}\n`,{"content-type":`application/x-ndjson`},t)});return function(t){return e.apply(this,arguments)}}();return{postReplay:s,postSessionBlob:(e,t,n=!1)=>o(`blob POST`,`/sessionReplays/blob`,t,{"content-type":`application/octet-stream`,"x-mxl-chunk-seq":String(e.chunkSeq),"x-mxl-duration-ms":String(e.durationMs),"x-mxl-event-count":String(e.eventCount),"x-mxl-is-checkpoint":e.isCheckpoint?`1`:`0`,"x-mxl-session-id":e.sessionId},n),postSessionEvents:function(){var e=K(function*(e,t=!1){e.length!==0&&(yield o(`events POST`,`/sessionEvents`,`${e.map(e=>JSON.stringify(e)).join(`
2
- `)}\n`,{"content-type":`application/x-ndjson`},t))});return function(t){return e.apply(this,arguments)}}(),postSessionMeta:c,shouldIgnoreUrl:a}}let Iu=`mxl_user`,Lu=`mxl_user_id`,Ru=`mxl_external_user_id`,zu=`mxl_profile_snapshot`,Bu=`mxl_session_analytics_prev`;W();let Vu=()=>({avatar:``,email:``,firstName:``,lastName:``,profileId:``,properties:{}});function Hu(e){try{let t=e.getItem(zu);if(!t)return null;let n=JSON.parse(t);if(typeof n==`object`&&n&&typeof n.profileId==`string`)return n}catch(e){}return null}function Uu(e,t){try{return e.setItem(zu,JSON.stringify(t)),!0}catch(e){return!1}}function Wu(e){try{e.removeItem(zu)}catch(e){}}function Gu(e,t){let n=e==null?Vu():e,r=U(U({},n.properties),t.properties);return{avatar:t.avatar===void 0?n.avatar:t.avatar,email:t.email===void 0?n.email:t.email,firstName:t.firstName===void 0?n.firstName:t.firstName,lastName:t.lastName===void 0?n.lastName:t.lastName,profileId:t.profileId,properties:r}}function Ku(e){let t=U({},e.properties);return e.firstName&&(t.first_name=e.firstName),e.lastName&&(t.last_name=e.lastName),e.email&&(t.email=e.email),e.avatar&&(t.avatar=e.avatar),t}F(),W();var qu=class{constructor(){P(this,`_screenViewCount`,0),P(this,`_eventCount`,0),P(this,`_entry`,null),P(this,`_exit`,null),P(this,`_referrer`,``),P(this,`_utm`,{utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``})}recordScreenView(e){this._screenViewCount+=1,this._eventCount+=1,this._entry||(this._entry=U({},e),this._referrer=e.referrer,this._utm={utmCampaign:e.utmCampaign,utmContent:e.utmContent,utmMedium:e.utmMedium,utmSource:e.utmSource,utmTerm:e.utmTerm}),this._exit=U({},e)}recordTrackEvent(){this._eventCount+=1}buildSpanAttributes(e,t){var n,r,i,a,o,s,c,l;let u={"mxl.session.screen_view_count":this._screenViewCount,"mxl.session.event_count":this._eventCount,"mxl.session.profile_id":e,"mxl.session.entry_origin":(n=(r=this._entry)==null?void 0:r.origin)==null?``:n,"mxl.session.entry_path":(i=(a=this._entry)==null?void 0:a.path)==null?``:i,"mxl.session.exit_origin":(o=(s=this._exit)==null?void 0:s.origin)==null?``:o,"mxl.session.exit_path":(c=(l=this._exit)==null?void 0:l.path)==null?``:c,"mxl.session.referrer":this._referrer,"mxl.session.utm_medium":this._utm.utmMedium,"mxl.session.utm_source":this._utm.utmSource,"mxl.session.utm_campaign":this._utm.utmCampaign,"mxl.session.utm_content":this._utm.utmContent,"mxl.session.utm_term":this._utm.utmTerm};return t&&(u[`${L}profile_id`]=t.profileId,u[`${L}screen_view_count`]=t.screenViewCount,u[`${L}event_count`]=t.eventCount,u[`${L}entry_origin`]=t.entryOrigin,u[`${L}entry_path`]=t.entryPath,u[`${L}exit_origin`]=t.exitOrigin,u[`${L}exit_path`]=t.exitPath,u[`${L}referrer`]=t.referrer,u[`${L}utm_medium`]=t.utmMedium,u[`${L}utm_source`]=t.utmSource,u[`${L}utm_campaign`]=t.utmCampaign,u[`${L}utm_content`]=t.utmContent,u[`${L}utm_term`]=t.utmTerm),u}toRowSnapshot(e,t,n){var r,i,a,o,s,c,l,u;return{appId:e,deviceId:n,entryOrigin:(r=(i=this._entry)==null?void 0:i.origin)==null?``:r,entryPath:(a=(o=this._entry)==null?void 0:o.path)==null?``:a,eventCount:this._eventCount,exitOrigin:(s=(c=this._exit)==null?void 0:c.origin)==null?``:s,exitPath:(l=(u=this._exit)==null?void 0:u.path)==null?``:l,profileId:t,referrer:this._referrer,screenViewCount:this._screenViewCount,utmCampaign:this._utm.utmCampaign,utmContent:this._utm.utmContent,utmMedium:this._utm.utmMedium,utmSource:this._utm.utmSource,utmTerm:this._utm.utmTerm}}reset(){this._screenViewCount=0,this._eventCount=0,this._entry=null,this._exit=null,this._referrer=``,this._utm={utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``}}};function Ju(e){try{let t=e.getItem(Bu);return t?JSON.parse(t):null}catch(e){return null}}function Yu(e,t){try{e.setItem(Bu,JSON.stringify(t))}catch(e){}}function Xu(e){try{e.removeItem(Bu)}catch(e){}}function Zu(e,t=document.referrer){let n=``,r=e,i=``,a=``,o=``,s=``,c=``;try{var l,u,d,f,p;let t=new URL(e,window.location.origin);n=t.origin,r=`${t.pathname}${t.search}${t.hash}`,i=(l=t.searchParams.get(`utm_medium`))==null?``:l,a=(u=t.searchParams.get(`utm_source`))==null?``:u,o=(d=t.searchParams.get(`utm_campaign`))==null?``:d,s=(f=t.searchParams.get(`utm_content`))==null?``:f,c=(p=t.searchParams.get(`utm_term`))==null?``:p}catch(e){}return{origin:n,path:r,referrer:t,utmCampaign:o,utmContent:s,utmMedium:i,utmSource:a,utmTerm:c}}N(),H(),F(),W();var Qu=class{constructor({appId:e,diag:t,loggerProvider:n,pageManager:r,storage:i=window.localStorage,userManager:a,userSessionManager:o}){P(this,`_diag`,void 0),P(this,`_logger`,void 0),P(this,`_appId`,void 0),P(this,`_userManager`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_pageManager`,void 0),P(this,`_storage`,void 0),P(this,`_sessionAnalytics`,new qu),P(this,`_lastScreenViewPath`,null),P(this,`_screenViewTimer`,null);let s=n==null?Fa:n;this._diag=t==null?j.createComponentLogger({namespace:`MXLAnalyticsManager`}):t,this._appId=e,this._userManager=a,this._userSessionManager=o,this._pageManager=r,this._storage=i,this._logger=s.getLogger(`mxl-web-sdk-analytics`)}getSessionAnalyticsState(){return this._sessionAnalytics}track(e,t={}){if(typeof e!=`string`||!e.trim()){this._diag.warn(`track name must be a non-empty string`);return}this._sessionAnalytics.recordTrackEvent(),this._emitAnalyticsLog(`track`,e.trim(),t.properties)}identify(e){var t,n,r,i,a,o;if(!((t=e.profileId)!=null&&t.trim())){this._diag.warn(`identify requires profileId`);return}let s=Gu(Hu(this._storage),{avatar:(n=e.avatar)==null?``:n,email:(r=e.email)==null?``:r,firstName:(i=e.firstName)==null?``:i,lastName:(a=e.lastName)==null?``:a,profileId:e.profileId.trim(),properties:(o=e.properties)==null?{}:o});Uu(this._storage,s)||this._diag.warn(`Failed to persist profile snapshot`),this._userManager.setUserId(s.profileId);let c=Ku(s);this._emitAnalyticsLog(`identify`,`identify`,c,s.profileId)}increment({property:e,value:t=1}){var n;let r=this._resolveProfileId();if(!r){this._diag.warn(`increment requires an identified profile`);return}let i=Hu(this._storage),a=Number.parseFloat((n=i==null?void 0:i.properties[e])==null?`0`:n),o=Number.isFinite(a)?a+t:t,s=Gu(i,{profileId:r,properties:U(U({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});Uu(this._storage,s),this._emitAnalyticsLog(`increment`,e,{counter_name:e,counter_value:String(o)},r)}decrement({property:e,value:t=1}){var n;let r=this._resolveProfileId();if(!r){this._diag.warn(`decrement requires an identified profile`);return}let i=Hu(this._storage),a=Number.parseFloat((n=i==null?void 0:i.properties[e])==null?`0`:n),o=Number.isFinite(a)?a-Math.abs(t):-Math.abs(t),s=Gu(i,{profileId:r,properties:U(U({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});Uu(this._storage,s),this._emitAnalyticsLog(`decrement`,e,{counter_name:e,counter_value:String(o)},r)}clear(){Wu(this._storage),this._userManager.clearUserId()}screenView(){this._screenViewTimer&&clearTimeout(this._screenViewTimer),this._screenViewTimer=setTimeout(()=>{this._screenViewTimer=null,this._emitScreenView()},50)}buildSessionPartAnalyticsAttributes(){var e,t;let n=Ju(this._storage),r=this._userManager.getMXLUserId(),i=(e=this._resolveProfileId())==null?r:e,a=this._sessionAnalytics.buildSpanAttributes(i,n);return a[`mxl.visitor.is_new`]=((t=this._userSessionManager.getUserSessionAttributes())==null?void 0:t[lr])===1,a[`browser.language`]=navigator.language||``,a}finalizeSessionPartAnalytics(){var e;let t=this._userManager.getMXLUserId(),n=(e=this._resolveProfileId())==null?t:e,r=this._sessionAnalytics.toRowSnapshot(this._appId,n,t);Yu(this._storage,r)}resetSessionAnalyticsForNewUserSession(){this._sessionAnalytics.reset(),Xu(this._storage),this._lastScreenViewPath=null}_emitScreenView(){var e,t;let n=this._pageManager.getCurrentRoute(),r=(e=n==null?void 0:n.url)==null?window.location.href:e,i=(t=n==null?void 0:n.path)==null?window.location.pathname:t;if(this._lastScreenViewPath===i)return;this._lastScreenViewPath=i;let a=Zu(r);this._sessionAnalytics.recordScreenView(a),this._emitAnalyticsLog(`screen_view`,`screen_view`)}_emitAnalyticsLog(e,t,n={},r){var i,a,o,s,c,l;let u=this._pageManager.getCurrentRoute(),d=(i=u==null?void 0:u.url)==null?window.location.href:i,f=(a=u==null?void 0:u.path)==null?window.location.pathname:a,p=(o=(s=this._pageManager.getPageLabel())==null?document.title:s)==null?``:o,m=``;try{m=new URL(d,window.location.origin).origin}catch(e){m=window.location.origin}let h=this._userManager.getMXLUserId(),g=(c=r==null?this._resolveProfileId():r)==null?h:c,_=(l=this._userSessionManager.getUserSessionId())==null?``:l,v={"mxl.analytics.kind":e,"mxl.analytics.name":t,[ur]:this._appId,"mxl.device.id":h,"mxl.profile.id":g,"mxl.session.id":_,[rr]:f,"mxl.page.url":d,"mxl.page.origin":m,"mxl.page.title":p,"mxl.page.referrer":document.referrer};for(let[e,t]of Object.entries(n))t!=null&&(v[`mxl.event.property.${e}`]=String(t));this._logger.emit({attributes:v,body:t,severityNumber:V.INFO,severityText:`INFO`})}_resolveProfileId(){let e=this._userManager.getUserId();if(e)return e;let t=Hu(this._storage);return(t==null?void 0:t.profileId)||null}};let $u=`http.response.body.size`,ed=`log.record.uid`,td=`user.id`,nd=new Uint8Array(16),rd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),id=()=>{crypto.getRandomValues(nd);let e=``;for(let t=0;t<16;t++)e+=rd[nd[t]];return e},ad=`0.1.1`,od=`mxl_app_instance_id`,sd=(e,t)=>{let n=null;try{n=e.getItem(od)}catch(e){t.warn(`Failed to retrieve app instance ID from session storage`,e)}if(!n){t.debug(`No existing app instance ID found in session storage, creating a new one`),n=id();try{e.setItem(od,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n};js(),R(),W();let cd=`unknown_service`,ld=({serviceName:e})=>Cs({[ti]:e}),ud=({diagLogger:e,appVersion:t,pageSessionStorage:n,appId:r,enduserPseudoId:i})=>{var a;let o=window.navigator;return Cs(U(U({[ii]:`mxl-web-sdk`,app_version:t,app_framework:1,sdk_version:ad,[ai]:ad,sdk_simple_version:1,sdk_platform:`web`,[ni]:`webjs`,"mxl.app_instance_id":sd(n,e),[li]:o.userAgent,screen_resolution:`${window.screen.width}x${window.screen.height}`,viewport_resolution:`${window.innerWidth}x${window.innerHeight}`,network_effective_type:(a=o.connection)==null?void 0:a.effectiveType,device_memory:o.deviceMemory,webdriver:o.webdriver},i?{"enduser.pseudo.id":i}:{}),r?{[ur]:r}:{}))},dd={networkSpansForwardingThreshold:0,samplingPct:100},fd=`mxl_remote_config`,pd=(e,t,{osVersion:n,appVersion:r,deviceId:i})=>`${e}/config?${new URLSearchParams({appId:t,osVersion:n,appVersion:r,deviceId:i}).toString()}`,md=e=>typeof e==`object`&&!!e&&!Array.isArray(e),hd=(e,t,n)=>{let r=e[t];if(typeof r==`number`)return r;let i=e[n];if(typeof i==`number`)return i},gd=(e,t,n)=>{let r=e[t];if(typeof r==`boolean`)return r;let i=e[n];if(typeof i==`boolean`)return i},_d=(e,t,n)=>{let r=e[t];if(typeof r==`string`)return r;let i=e[n];if(typeof i==`string`)return i},vd=e=>{if(!md(e))return;let t={},n=hd(e,`maxDurationSeconds`,`max_duration_seconds`);n!==void 0&&(t.maxDurationSeconds=n);let r=hd(e,`inactivityTimeoutSeconds`,`inactivity_timeout_seconds`);r!==void 0&&(t.inactivityTimeoutSeconds=r);let i=hd(e,`foregroundInactivityTimeoutSeconds`,`foreground_inactivity_timeout_seconds`);return i!==void 0&&(t.foregroundInactivityTimeoutSeconds=i),t},yd=e=>{if(!md(e))return;let t={},n=hd(e,`pctEnabled`,`pct_enabled`);n!==void 0&&(t.pctEnabled=n);let r=hd(e,`sampleRate`,`sample_rate`);r!==void 0&&(t.sampleRate=r);let i=gd(e,`maskAllInputs`,`mask_all_inputs`);i!==void 0&&(t.maskAllInputs=i);let a=gd(e,`maskAllText`,`mask_all_text`);a!==void 0&&(t.maskAllText=a);let o=hd(e,`flushIntervalMs`,`flush_interval_ms`);o!==void 0&&(t.flushIntervalMs=o);let s=gd(e,`omitRedundantInstrumentations`,`omit_redundant_instrumentations`);s!==void 0&&(t.omitRedundantInstrumentations=s);let c=gd(e,`debug`,`debug`);return c!==void 0&&(t.debug=c),Object.keys(t).length>0?t:void 0},bd=e=>{var t,n,r;if(!md(e))throw TypeError(`Remote config must be an object`);let i=e.threshold;if(typeof i!=`number`)throw TypeError(`Remote config threshold must be a number`);let a={threshold:i},o=(t=e.networkSpanForwarding)==null?e.network_span_forwarding:t;if(md(o)){let e=hd(o,`pctEnabled`,`pct_enabled`);e!==void 0&&(a.networkSpanForwarding={pctEnabled:e})}let s=hd(e,`emptySessionAvoidanceEnabledPct`,`empty_session_avoidance_enabled_pct`);s!==void 0&&(a.emptySessionAvoidanceEnabledPct=s);let c=_d(e,`serviceName`,`service_name`);c!==void 0&&(a.serviceName=c);let l=yd((n=e.sessionReplay)==null?e.session_replay:n);l!==void 0&&(a.sessionReplay=l);let u=vd((r=e.userSession)==null?e.user_session:r);return u!==void 0&&(a.userSession=u),a};N(),W(),F(),q();let xd=e=>{var t,n,r;let i={samplingPct:e.threshold};return e.networkSpanForwarding!==void 0&&(i.networkSpansForwardingThreshold=e.networkSpanForwarding.pctEnabled),e.serviceName!==void 0&&e.serviceName!==``&&(i.serviceName=e.serviceName),e.emptySessionAvoidanceEnabledPct!==void 0&&(i.emptySessionAvoidanceEnabledPct=e.emptySessionAvoidanceEnabledPct),e.sessionReplay!==void 0&&(i.replay=U({},e.sessionReplay)),((t=e.userSession)==null?void 0:t.maxDurationSeconds)!==void 0&&(i.userSessionMaxDurationSeconds=e.userSession.maxDurationSeconds),((n=e.userSession)==null?void 0:n.inactivityTimeoutSeconds)!==void 0&&(i.userSessionInactivityTimeoutSeconds=e.userSession.inactivityTimeoutSeconds),((r=e.userSession)==null?void 0:r.foregroundInactivityTimeoutSeconds)!==void 0&&(i.userSessionForegroundInactivityTimeoutSeconds=e.userSession.foregroundInactivityTimeoutSeconds),i};var Sd=class{constructor({appId:e,appVersion:t,deviceId:n,diag:r=j.createComponentLogger({namespace:`mxl-config-manager`}),storage:i,defaultConfig:a={},configUrl:o}){P(this,`_remoteConfigURL`,null),P(this,`_diag`,void 0),P(this,`_storage`,void 0),P(this,`_baseConfig`,void 0),P(this,`_sdkConfig`,void 0),P(this,`_etag`,null),P(this,`_remoteSourceServiceName`,void 0),e&&t&&n&&o&&(this._remoteConfigURL=pd(o,e,{appVersion:t,deviceId:n,osVersion:`1`})),this._diag=r,this._storage=i;let s=this._getRemoteConfigFromStorage();s&&(this._etag=s.etag,this._captureRemoteServiceName(s.config)),this._baseConfig=U(U({},dd),a),this._sdkConfig=U(U({},this._baseConfig),s?xd(s.config):{})}setConfig(e){this._sdkConfig=U(U({},this._sdkConfig),e)}getConfig(){return this._sdkConfig}resolveApplicationServiceName(e){var t,n;return((t=this._remoteSourceServiceName)==null?void 0:t.trim())||(e==null?void 0:e.trim())||((n=this._baseConfig.serviceName)==null?void 0:n.trim())||cd}_captureRemoteServiceName(e){if(e.serviceName===void 0)return;let t=e.serviceName.trim();this._remoteSourceServiceName=t.length>0?t:void 0}refreshRemoteConfig(){var e=this;return K(function*(){if(e._remoteConfigURL)try{let t=yield e._fetchRemoteConfig(e._remoteConfigURL);if(!t){e._diag.debug(`No changes in remote config, skipping update`);return}let[n,r]=t;e._captureRemoteServiceName(n),e._storage.setItem(fd,JSON.stringify({config:n,etag:r})),e._sdkConfig=U(U({},e._baseConfig),xd(n)),e._etag=r}catch(t){e._diag.warn(`Failed to refresh remote config: ${t instanceof Error?t.message:String(t)}`)}})()}_getRemoteConfigFromStorage(){try{let e=this._storage.getItem(fd);if(e){let t=JSON.parse(e);return{config:bd(t.config),etag:t.etag}}return null}catch(e){return this._diag.warn(`Failed to parse remote config from storage: ${e instanceof Error?e.message:String(e)}`),null}}_fetchRemoteConfig(e){var t=this;return K(function*(){let n=yield fetch(e,{headers:t._etag?{"If-None-Match":t._etag}:{}}),r=n.headers.get(`etag`);return n.status===304?null:n.ok?[bd(yield n.json()),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};W();function Cd({autoStart:e,replay:t,dynamicConfig:n,isSessionReplayEnabled:r}){if(!r)return{autoStart:!1,replay:t};let i=n.replay;if(!i)return{autoStart:e,replay:t};let a=U({},t);return i.sampleRate!==void 0&&(a.sampleRate=i.sampleRate),i.maskAllInputs!==void 0&&(a.maskAllInputs=i.maskAllInputs),i.maskAllText!==void 0&&(a.maskAllText=i.maskAllText),i.flushIntervalMs!==void 0&&(a.flushIntervalMs=i.flushIntervalMs),i.omitRedundantInstrumentations!==void 0&&(a.omitRedundantInstrumentations=i.omitRedundantInstrumentations),i.debug!==void 0&&(a.debug=i.debug),{autoStart:e,replay:a}}let wd={maxAllowed:{breadcrumb:100,element_timing:500,error_log:500,exception:500,info_log:100,network_request:1e4,server_timing:500,session_property:100,span:1e3,user_timing_mark:500,user_timing_measure:500,soft_navigation:100,warning_log:200},maxAttributes:{error_log:50,exception:50,info_log:50,warning_log:50},maxLength:{breadcrumb:256,error_log:4e3,exception:1024,exception_attribute_key:128,exception_attribute_value:256,info_log:4e3,log_attribute_key:128,log_attribute_value:256,session_property_key:128,session_property_value:256,warning_log:4e3}};N(),F();let Td={error:`error_log`,info:`info_log`,warning:`warning_log`};var Ed=class{constructor({diag:e,maxAllowed:t,maxLength:n,maxAttributes:r}){P(this,`_diag`,void 0),P(this,`_diagnosticCounts`,{}),P(this,`_currentCount`,{breadcrumb:0,element_timing:0,error_log:0,exception:0,info_log:0,network_request:0,server_timing:0,session_property:0,span:0,user_timing_mark:0,user_timing_measure:0,soft_navigation:0,warning_log:0}),P(this,`_maxAllowed`,void 0),P(this,`_maxLength`,void 0),P(this,`_maxAttributes`,void 0),this._diag=e==null?j.createComponentLogger({namespace:`MXLLimitManager`}):e,this._maxAllowed=t,this._maxLength=n,this._maxAttributes=r}_dropIfMaxReached(e){return this._currentCount[e]>=this._maxAllowed[e]?(this._diag.warn(`disallowing ${e} because the maximum number of ${this._maxAllowed[e].toString()} has already been reached for this session`),this._incrDiagnosticCount(e,`drop`),!0):(this._currentCount[e]=(this._currentCount[e]||0)+1,!1)}truncateString(e,t){return t.length>this._maxLength[e]?(this._diag.warn(`truncating ${e} because it is longer than ${this._maxLength[e].toString()} characters: "${t}"`),this._incrDiagnosticCount(e,`truncate_string`),t.substring(0,this._maxLength[e])):t}_truncateAttributes(e,t,n,r){let i=Object.keys(t);i.length>this._maxAttributes[e]&&(this._diag.warn(`truncating ${e} attributes because there are more than ${this._maxAttributes[e].toString()} set`),this._incrDiagnosticCount(e,`truncate_attributes`));let a={};for(let s=0;s<Math.min(i.length,this._maxAttributes[e]);s++){var o;let e=this.truncateString(n,i[s]);a[e]=this.truncateString(r,((o=t[i[s]])==null?void 0:o.toString())||``)}return a}limitBreadcrumb(e){return this._dropIfMaxReached(`breadcrumb`)?`dropped`:{name:this.truncateString(`breadcrumb`,e)}}limitException(e,t){return this._dropIfMaxReached(`exception`)?`dropped`:{attributes:this._truncateAttributes(`exception`,t,`exception_attribute_key`,`exception_attribute_value`),message:this.truncateString(`exception`,e)}}limitLog(e,t,n){let r=Td[t];return this._dropIfMaxReached(r)?`dropped`:{attributes:this._truncateAttributes(r,n,`log_attribute_key`,`log_attribute_value`),message:this.truncateString(r,e)}}limitSessionProperty(e,t){return this._dropIfMaxReached(`session_property`)?`dropped`:{key:this.truncateString(`session_property_key`,e),value:this.truncateString(`session_property_value`,t)}}limitElementTimingEntry(){return this._dropIfMaxReached(`element_timing`)}limitServerTimingEntry(){return this._dropIfMaxReached(`server_timing`)}limitUserTimingEntry(e){return this._dropIfMaxReached(e===`mark`?`user_timing_mark`:`user_timing_measure`)}limitSoftNavigationEntry(){return this._dropIfMaxReached(`soft_navigation`)}dropReadableSpan(e){let t=e.attributes[`mxl.type`]===`perf.network_request`?`network_request`:`span`;return this._dropIfMaxReached(t)}reset(){this._diagnosticCounts={},this._currentCount={breadcrumb:0,element_timing:0,error_log:0,exception:0,info_log:0,network_request:0,server_timing:0,session_property:0,span:0,user_timing_mark:0,user_timing_measure:0,soft_navigation:0,warning_log:0}}_incrDiagnosticCount(e,t){let n=`mxl.app.applied_limit.${e}.${t}.count`;this._diagnosticCounts[n]=(this._diagnosticCounts[n]||0)+1}getDiagnosticCounts(){return this._diagnosticCounts}};let Dd=(e,t,n)=>{try{let r=e.getItem(t),i=r?parseInt(r,10):0;return Number.isNaN(i)&&(n.warn(`Non-numeric value stored at ${t} (${String(r)}); resetting counter.`),i=0),i++,e.setItem(t,i.toString()),i}catch(e){return n.warn(`Failed to retrieve ${t} from storage: `,e),1}},Od=e=>e.visibilityState===`hidden`?`background`:`foreground`,kd=globalThis;N(),H(),R(),F(),sn(),W();let Ad=()=>JSON.stringify(kd._MXLFileBundleIDs||{}),jd=(e,t,n)=>`${e}\n${t}\n${n}`,Md=e=>{if(!(e instanceof Error)||e.cause==null)return``;let t=[],n=new Set,r=e.cause,i=0;for(;r!=null&&i<5&&!n.has(r);){if(n.add(r),r instanceof Error)t.push(`${r.name}: ${r.message}`),r=r.cause;else{t.push(String(r));break}i+=1}return t.join(`, `)};var Nd=class e{constructor({diag:e,perf:t,userSessionManager:n,limitManager:r,loggerProvider:i,visibilityDoc:a,storage:o,exception:s}){var c,l;P(this,`_diag`,void 0),P(this,`_perf`,void 0),P(this,`_logger`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_limitManager`,void 0),P(this,`_visibilityDoc`,void 0),P(this,`_storage`,void 0),P(this,`_filters`,void 0),P(this,`_dedupWindowMs`,void 0),P(this,`_dedupLastSeen`,new Map);let u=i==null?Fa:i;this._diag=e==null?j.createComponentLogger({namespace:`MXLLogManager`}):e,this._perf=t,this._logger=u.getLogger(`mxl-web-sdk-logs`),this._userSessionManager=n,this._limitManager=r,this._visibilityDoc=a,this._storage=o,this._filters=[...(c=s==null?void 0:s.filters)==null?[]:c],this._dedupWindowMs=(l=s==null?void 0:s.dedupWindowMs)==null?1e3:l}addExceptionFilter(e){this._filters.push(e)}captureException(e,t){this.logException(e,t)}_validateAttributes(e){return Object.prototype.toString.call(e)===`[object Object]`?e:(this._diag.warn(`attributes must be a plain object`,e),{})}static _logSeverityToSeverityNumber(e){switch(e){case`info`:return V.INFO;case`warning`:return V.WARN;default:return V.ERROR}}logException(t,{handled:n=!0,attributes:r={},timestamp:i=this._perf.getNowMillis(),handler:a=`manual`}={}){var o;if(!this._passesFilters(t))return;let s=this._validateAttributes(r),c=(t==null||(o=t.constructor)==null?void 0:o.name)||typeof t,l=``,u=c,d=``;if(t instanceof Error)l=String(t.message||``).trim(),u=t.name||``,d=t.stack||``;else if(t&&typeof t==`object`)try{l=JSON.stringify(t)}catch(e){l=String(t).trim()}else l=String(t).trim();if(this._isDuplicate(u,l,d,i))return;n||this._userSessionManager.incrSessionPartCountForKey(`mxl.unhandled_exceptions_count`);let{[Qn]:f}=s,p=Uo(s,[Qn].map(on)),m=this._limitManager.limitException(l,p);m!==`dropped`&&this._logger.emit({attributes:U(U(U({},m.attributes),f===void 0?{}:{[Qn]:String(f)}),{},{[I]:`sys.exception`,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":Md(t),[Yr]:c,"exception.name":u,[qr]:m.message,[Jr]:d,[er]:Ad(),[Zn]:Od(this._visibilityDoc),"mxl.exception_number":Dd(this._storage,`mxl_exception_number`,this._diag)}),body:m.message,eventName:`mxl-exception`,severityNumber:V.ERROR,severityText:`ERROR`,timestamp:i})}message(e,t,{attributes:n={},includeStacktrace:r=!0,stacktrace:i}={}){if(typeof e!=`string`||!e.trim()){this._diag.warn(`Message must be a non-empty string`);return}if(![`info`,`warning`,`error`].includes(t)){this._diag.warn(`Severity must be info, warning, or error`);return}let a=this._validateAttributes(n);t===`error`&&this._userSessionManager.incrSessionPartCountForKey(`mxl.error_log_count`);let o=``;t!==`info`&&(typeof i==`string`?o=i:r&&(o=Error().stack||``)),this._logMessage({attributes:a,message:e.trim(),severity:t,stack:o,timestamp:this._perf.getNowMillis()})}_logMessage({message:t,severity:n,timestamp:r,attributes:i={},stack:a}){let o=this._limitManager.limitLog(t,n,i);o!==`dropped`&&this._logger.emit({attributes:U(U(U({},o.attributes),{},{[I]:`sys.log`},a?{"mxl.stacktrace.js":a,[er]:Ad()}:{}),{},{[Zn]:Od(this._visibilityDoc)}),body:o.message,eventName:`mxl-log`,severityNumber:e._logSeverityToSeverityNumber(n),severityText:n.toUpperCase(),timestamp:r})}_passesFilters(e){for(let t of this._filters)try{if(!t(e))return!1}catch(e){this._diag.warn(`exception filter threw`,e instanceof Error?e.message:e)}return!0}_isDuplicate(e,t,n,r){if(this._dedupWindowMs<=0)return!1;let i=jd(e,t,n),a=this._dedupLastSeen.get(i);return a!==void 0&&r-a<this._dedupWindowMs?!0:(this._dedupLastSeen.set(i,r),!1)}static _exceptionHandlingType(e,t){return e?`handled`:t===`global_exception`?`unhandled_error`:t===`promise_rejection`?`unhandled_rejection`:`unhandled`}};N(),F();var Pd=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document,diag:n,navigationHost:r=window,userSessionManager:i,perf:a=new ga}={}){var o;P(this,`_currentRoute`,null),P(this,`_currentPageId`,null),P(this,`_pageLabel`,null),P(this,`_titleDocument`,void 0),P(this,`_useDocumentTitleAsPageLabel`,void 0),P(this,`_routeChangedListeners`,[]),P(this,`_diag`,void 0),P(this,`_navigationHost`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_perf`,void 0),P(this,`getCurrentPageId`,()=>this._currentPageId),P(this,`getCurrentRoute`,()=>this._currentRoute),P(this,`setPageLabel`,e=>{this._pageLabel=e}),P(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),P(this,`setCurrentRoute`,e=>{(!this._currentRoute||this._currentRoute.url!==e.url)&&(this._currentPageId=id()),this._currentRoute=e,e.label?this._pageLabel=e.label:this._pageLabel=null;for(let t of this._routeChangedListeners)try{t(e)}catch(e){this._diag.warn(`Error while executing route changed listener`,e)}}),P(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),P(this,`addRouteChangedListener`,e=>(this._routeChangedListeners.push(e),()=>{let t=this._routeChangedListeners.indexOf(e);t!==-1&&this._routeChangedListeners.splice(t,1)})),P(this,`_onSoftNavigation`,e=>{var t;e.from.url!==this._navigationHost.location.href&&(ha(this._perf.epochMillisFromOriginOffset(e.timeStamp)),(t=this._userSessionManager)==null||t.rolloverSessionPartInternal({endReason:`web_soft_navigation`,startReason:`web_soft_navigation`}),this._setRouteFromCurrentLocation(),xn.screenView())}),P(this,`_setRouteFromCurrentLocation`,()=>{let e=this._navigationHost.location.pathname;this.setCurrentRoute({path:e,url:e})}),this._useDocumentTitleAsPageLabel=e,this._titleDocument=t,this._diag=n==null?j.createComponentLogger({namespace:`MXLPageManager`}):n,this._navigationHost=r,this._userSessionManager=i,this._perf=a,(o=this._navigationHost.navigation)==null||o.addEventListener(`currententrychange`,this._onSoftNavigation),this._setRouteFromCurrentLocation()}};let Fd=(e,t)=>!t||t<=0||t>100?!1:t>=Id(e),Id=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100};F();var Ld=class{constructor({dynamicConfigManager:e,deviceId:t,blockNetworkSpanForwarding:n}){P(this,`_dynamicConfigManager`,void 0),P(this,`_deviceId`,void 0),P(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=e,this._deviceId=t,this._blockNetworkSpanForwarding=n}isSDKEnabled(){let e=this._dynamicConfigManager.getConfig();return Fd(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return Fd(this._deviceId,e.networkSpansForwardingThreshold)}isSessionReplayEnabled(){var e,t;let n=(e=(t=this._dynamicConfigManager.getConfig().replay)==null?void 0:t.pctEnabled)==null?100:e;return Fd(this._deviceId,n)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return Fd(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};F(),sn();var Rd=class{constructor(e){P(this,`_span`,void 0),this._span=e}get attributes(){return this._span.attributes}addEvent(e,t,n){return this._span.addEvent(e,t,n),this}addLink(e){return this._span.addLink(e),this}addLinks(e){return this._span.addLinks(e),this}end(e){this._span.end(e)}isRecording(){return this._span.isRecording()}recordException(e,t){this._span.recordException(e,t)}setAttribute(e,t){return this._span.setAttribute(e,t),this}setAttributes(e){return this._span.setAttributes(e),this}removeAttribute(e){let t=this._span.attributes,{[e]:n}=t,r=Uo(t,[e].map(on));return this._span.attributes=r,this}setStatus(e){return this._span.setStatus(e),this}spanContext(){return this._span.spanContext()}updateName(e){return this._span.updateName(e),this}fail(e={code:`failure`}){e.code&&this._span.setAttribute(`mxl.error_code`,e.code.toUpperCase()),this._span.end(e.endTime)}};N(),F();var zd=class{constructor({tracerProvider:e}={}){P(this,`_tracer`,void 0),P(this,`setSpan`,M.setSpan);let t=e==null?M:e;this._tracer=t.getTracer(`mxl-web-sdk-traces`)}startSpan(e,t={},n){t.attributes=t.attributes?t.attributes:{},t.attributes[I]=`perf`;let r=t.parentSpan?M.setSpan(A.active(),t.parentSpan):n;return new Rd(this._tracer.startSpan(e,t,r))}getSpan(e){let t=M.getSpan(e);if(t)return new Rd(t)}};let Bd=e=>typeof e[`enduser.pseudo.id`]==`string`&&e[`enduser.pseudo.id`].length===32,Vd=e=>typeof e==`string`&&e.length===32;N(),F();var Hd=class{constructor({diag:e,storage:t}){P(this,`_diag`,void 0),P(this,`_storage`,void 0),P(this,`_mxlUserId`,null),this._diag=e==null?j.createComponentLogger({namespace:`MXLUserManager`}):e,this._storage=t,this._migrateOldLocalStorageKey(),this._initialSetup()}getMXLUserId(){return this._mxlUserId||this._generateNewMXLUserId()}setMXLUserId(e){this._mxlUserId=e;try{this._storage.setItem(Lu,e)}catch(e){this._diag.warn(`Failed to persist user object for storage, keeping it in-memory only`,e)}}clearMXLUserId(){this._mxlUserId=null;try{this._storage.removeItem(Lu)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(Iu);if(e){let t=JSON.parse(e);Bd(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(Lu,t[`enduser.pseudo.id`]),this._storage.removeItem(Iu)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(Iu))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(Lu);e?Vd(e)?this._mxlUserId=e:(this._diag.warn(`Invalid mxl user id, generating a new one`),this.clearMXLUserId()):this._diag.debug(`No existing user found in storage, creating a new one`)}catch(e){this._diag.warn(`Failed to get mxl user id from storage, defaulting to a new one`,e)}this._mxlUserId||(this._mxlUserId=this._generateNewMXLUserId())}_generateNewMXLUserId(){let e=id();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(Ru)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(Ru,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(Ru)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let Ud=({diag:e,value:t,defaultValue:n,min:r,max:i})=>t===void 0?n:Number.isFinite(t)?t<r||t>i?(e==null||e.warn(`value (${t.toString()}) is outside the allowed range [${r.toString()}, ${i.toString()}]; falling back to default (${n.toString()}).`),n):t:(e==null||e.warn(`value is not a finite number; falling back to default (${n.toString()}).`),n),Wd=e=>e.visibilityState===`visible`&&e.hasFocus(),Gd=(e,t=1e3)=>{let n=!1,r=null,i=((...i)=>{n||(e(...i),n=!0,r=setTimeout(()=>{n=!1,r=null},t))});return i.cancel=()=>{r!==null&&(clearTimeout(r),r=null),n=!1},i},Kd=`mxl_user_session_state`,qd=`mxl_permanent_properties`,Jd=`mxl_last_end_user_session_ts`,Yd=`mxl_tab`,Xd=`mxl_tab_activity`,Zd=1800,Qd=new Set([`user_session_ended`,`web_foreground_inactivity`]),$d=[`keydown`,`mousedown`,`mousemove`,`scroll`],ef=({target:e,visibilityDoc:t,activityEvents:n,onActivity:r,onVisibilityChange:i,onFocus:a,onBlur:o,onPageShow:s,onPageHide:c})=>{var l;for(let t of n)e.addEventListener(t,r);(l=t.addEventListener)==null||l.call(t,`visibilitychange`,i),e.addEventListener(`focus`,a),e.addEventListener(`blur`,o),e.addEventListener(`pageshow`,s),e.addEventListener(`pagehide`,c)},tf=({target:e,visibilityDoc:t,activityEvents:n,onActivity:r,onVisibilityChange:i,onFocus:a,onBlur:o,onPageShow:s,onPageHide:c})=>{var l;for(let t of n)e.removeEventListener(t,r);(l=t.removeEventListener)==null||l.call(t,`visibilitychange`,i),e.removeEventListener(`focus`,a),e.removeEventListener(`blur`,o),e.removeEventListener(`pageshow`,s),e.removeEventListener(`pagehide`,c)};W();let nf=(e,t)=>t<e.userSessionStartTs||t>=e.userSessionMaxEndTs||e.inactivityDeadlineTs!==null&&t>=e.inactivityDeadlineTs,rf=({now:e,previousUserSessionId:t,maxUserSessionDurationSeconds:n,inactivityTimeoutSeconds:r,foregroundInactivityTimeoutSeconds:i,userSessionNumber:a})=>({foregroundInactivityTimeoutSeconds:i,inactivityDeadlineTs:null,inactivityTimeoutSeconds:r,maxUserSessionDurationSeconds:n,previousUserSessionId:t,replayMetaVersion:0,replaySampled:null,schemaVersion:3,userSessionId:id(),userSessionMaxEndTs:e+n*1e3,userSessionNumber:a,userSessionPartIndex:0,userSessionProperties:{},userSessionStartTs:e}),af=e=>typeof e==`object`&&e?e.schemaVersion:void 0,of=e=>U(U({},e),{},{foregroundInactivityTimeoutSeconds:e.inactivityTimeoutSeconds,schemaVersion:3}),sf=e=>of(U(U({},e),{},{replayMetaVersion:2,replaySampled:null})),cf=e=>{switch(af(e)){case 3:return e;case 2:return of(e);case 1:return sf(e);default:return null}},lf=(e,t)=>{let n=e.getItem(Kd);if(!n)return null;try{let e=cf(JSON.parse(n));if(!e)throw Error(`stored user session state failed structural validation`);return e}catch(n){return t.error(`User session state in storage is corrupt; discarding it`,n),e.removeItem(Kd),null}},uf=(e,t)=>{let n=e.getItem(qd);if(!n)return{};try{let e=JSON.parse(n);if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`permanent properties blob is not a plain object`);let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}catch(n){return t.error(`Permanent properties in storage are corrupt; discarding`,n),e.removeItem(qd),{}}},df=(e,t)=>Object.keys(t).length===0?e.removeItem(qd):e.setItem(qd,JSON.stringify(t)),ff=e=>{if(!e)return{isSameOrigin:!1,isValid:!1};try{let t=new URL(e),n=window.location.origin;return{isSameOrigin:t.origin===n,isValid:!0,scrubbedUrl:t.origin+t.pathname}}catch(e){return{isSameOrigin:!1,isValid:!1}}},pf=(e,t,n)=>{try{let e=t.getEntriesByType(`navigation`);if(e.length>0&&e[0]){let t=e[0];if(t.type===`reload`)return`reload`;if(t.type===`back_forward`)return`back_forward`}}catch(e){n.warn(`Failed to get navigation type`,e)}return e.isValid?e.isSameOrigin?`same_origin`:`external`:`direct`},mf=(e,t)=>{try{let t=e.getItem(Xd);return t?JSON.parse(t):null}catch(e){return t.warn(`Failed to retrieve tab activity`,e),null}},hf=(e,t,n,r)=>{let i=sd(t,r),a,o;if(e===`same_origin`){let e=mf(n,r);e&&Date.now()-e.lastActivityMs<=1e4&&(a=e.tabId,{experienceId:o}=e)}return o===void 0&&(o=id()),{navigationSource:e,tab:{experienceId:o,sourceTabId:a,tabId:i}}},gf=({sessionStorage:e,localStorage:t,referrer:n,navigationPerformance:r,diag:i})=>{let a=ff(n),o=pf(a,r,i);try{let t=e.getItem(Yd);if(t)return{navigationSource:o,referrerScrubbedUrl:a.isValid&&a.scrubbedUrl?a.scrubbedUrl:void 0,tab:JSON.parse(t)}}catch(e){i.warn(`Failed to retrieve tab data`,e)}let s=hf(o,e,t,i);try{e.setItem(Yd,JSON.stringify(s.tab))}catch(e){i.warn(`Failed to store tab data`,e)}return{navigationSource:s.navigationSource,referrerScrubbedUrl:a.isValid&&a.scrubbedUrl?a.scrubbedUrl:void 0,tab:s.tab}},_f=(e,t,n)=>{let r={experienceId:t.experienceId,lastActivityMs:Date.now(),tabId:t.tabId};try{e.setItem(Xd,JSON.stringify(r))}catch(e){n.warn(`Failed to save tab activity`,e)}},vf=(e,t,n)=>{let r=r=>{var i;if(r.button===1||r.ctrlKey||r.metaKey||r.shiftKey){_f(t,e,n);return}(i=r.target)!=null&&i.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&_f(t,e,n)},i={capture:!0,passive:!0};document.addEventListener(`auxclick`,r,i),document.addEventListener(`click`,r,i)};N(),F(),W();var yf=class e{static shutdownAllTestInstances(){for(let t of e._testInstances)t._shutdown();e._testInstances.clear()}constructor({config:t={},dynamicConfigManager:n,diag:r,perf:i,visibilityDoc:a,storage:o,limitManager:s,target:c=window,activityThrottleMs:l=3e4,activityEvents:u=$d,tabStorage:d,referrer:f=typeof document<`u`?document.referrer:``,navigationPerformance:p=typeof window<`u`?window.performance:{getEntriesByType:()=>[]}}){P(this,`_state`,null),P(this,`_previousUserSessionId`,null),P(this,`_config`,void 0),P(this,`_dynamicConfigManager`,void 0),P(this,`_maxDurationTimeout`,null),P(this,`_isShutdown`,!1),P(this,`_permanentProperties`,{}),P(this,`_hasStoredState`,!1),P(this,`_activeSessionPartId`,null),P(this,`_sessionPartHistory`,[]),P(this,`_currentSessionPartNumber`,null),P(this,`_sessionPartSpan`,null),P(this,`_activeSessionPartCounts`,null),P(this,`_coldStart`,!0),P(this,`_nextSessionPartCounts`,{}),P(this,`_sdkStartupDuration`,0),P(this,`_sessionPartStartedListeners`,[]),P(this,`_sessionPartEndedListeners`,[]),P(this,`_tracer`,void 0),P(this,`_diag`,void 0),P(this,`_perf`,void 0),P(this,`_storage`,void 0),P(this,`_visibilityDoc`,void 0),P(this,`_limitManager`,void 0),P(this,`_target`,void 0),P(this,`_activityEvents`,void 0),P(this,`_onActivityThrottled`,void 0),P(this,`_sessionPartInactivityTimer`,null),P(this,`_tab`,void 0),P(this,`_navigationSource`,void 0),P(this,`_referrerScrubbedUrl`,void 0),P(this,`_analyticsManager`,null),P(this,`_onActivity`,()=>{try{if(!Wd(this._visibilityDoc))return;if(this._activeSessionPartId===null){this.startSessionPartInternal({reason:`web_activity`});return}this._startSessionPartInactivityTimer()}catch(e){this._diag.warn(`Error handling activity event`,e)}}),P(this,`_onVisibilityChange`,()=>{this._handleEngagementTransition(`visibilitychange`)}),P(this,`_onFocus`,()=>{this._handleEngagementTransition(`focus`)}),P(this,`_onBlur`,()=>{this._handleEngagementTransition(`blur`)}),P(this,`_onPageShow`,e=>{this._handleEngagementTransition(e.persisted?`pageshow-bfcache`:`pageshow-initial`)}),P(this,`_onPageHide`,e=>{try{if(this._activeSessionPartId===null)return;let t=e.persisted?`web_background`:`web_hard_navigation`;this._diag.debug(`page hiding (persisted=${e.persisted}); ending current part as ${t}`),this.endSessionPartInternal({reason:t})}catch(t){this._diag.error(`Error ending session part on pagehide (persisted=${e.persisted})`,t)}}),P(this,`_onSessionPartInactivity`,()=>{this._sessionPartInactivityTimer=null;try{if(this._activeSessionPartId===null)return;this._diag.debug(`inactivity timer fired; ending current part and user session`),this.endSessionPartInternal({reason:`web_foreground_inactivity`,userSessionEndReason:`inactivity`})}catch(e){this._diag.warn(`Error handling inactivity timer`,e)}}),this._diag=r==null?j.createComponentLogger({namespace:`MXLUserSessionManager`}):r,this._perf=i,this._visibilityDoc=a,this._storage=o,this._limitManager=s,this._permanentProperties=uf(this._storage,this._diag),this._tracer=M.getTracer(`mxl-web-sdk-session-parts`),this._target=c,this._activityEvents=u,this._onActivityThrottled=Gd(this._onActivity,l),this._config=t,this._dynamicConfigManager=n;let m=gf({diag:this._diag,localStorage:o,navigationPerformance:p,referrer:f,sessionStorage:d});this._tab=m.tab,this._navigationSource=m.navigationSource,this._referrerScrubbedUrl=m.referrerScrubbedUrl,vf(this._tab,o,this._diag),e._testInstances.add(this)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-session-parts`),ef({activityEvents:this._activityEvents,onActivity:this._onActivityThrottled,onBlur:this._onBlur,onFocus:this._onFocus,onPageHide:this._onPageHide,onPageShow:this._onPageShow,onVisibilityChange:this._onVisibilityChange,target:this._target,visibilityDoc:this._visibilityDoc});let{state:t,created:n}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());this._state=t,n&&this._storeState()}recordSDKStartupDuration(e){this._sdkStartupDuration=Math.max(1,Math.ceil(e))}claimReplaySample(e){let{state:t}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());if(t.replaySampled!==null)return this._state=t,t.replaySampled;let n=Math.random()<e;return this._state=U(U({},t),{},{replaySampled:n}),this._storeState(),n}nextReplayMetaVersion(){let{state:e}=this._loadOrCreateUserSessionState(this._perf.getNowMillis()),t=e.replayMetaVersion+1;return this._state=U(U({},e),{},{replayMetaVersion:t}),this._storeState(),t}setAnalyticsManager(e){this._analyticsManager=e}getUserSessionId(){var e,t;return(e=(t=this._state)==null?void 0:t.userSessionId)==null?null:e}getPreviousUserSessionId(){var e,t;return(e=(t=this._state)==null?void 0:t.previousUserSessionId)==null?this._previousUserSessionId:e}getUserSessionStartTime(){var e,t;return(e=(t=this._state)==null?void 0:t.userSessionStartTs)==null?null:e}getUserSessionAttributes(){var e,t;if(!this._state)return null;let n=(e=this.getPreviousUserSessionId())==null?``:e;return{[sr]:this._state.userSessionId,[cr]:n,[lr]:this._state.userSessionNumber,"mxl.user_session_part_index":this._state.userSessionPartIndex,"mxl.session_part_number":(t=this._currentSessionPartNumber)==null?0:t,"mxl.user_session_start_ts":this._state.userSessionStartTs,"mxl.user_session_max_duration_seconds":this._state.maxUserSessionDurationSeconds,"mxl.user_session_inactivity_timeout_seconds":this._state.inactivityTimeoutSeconds,"mxl.user_session_foreground_inactivity_timeout_seconds":this._state.foregroundInactivityTimeoutSeconds}}endUserSession(){if(!this._state){this._diag.debug(`Trying to end user session, but there is no active session. This is a no-op.`);return}let e=this._perf.getNowMillis(),t=this._storage.getItem(Jd),n=t===null?NaN:Number(t);if(Number.isFinite(n)&&e-n<5e3){this._diag.warn(`endUserSession called within cooldown period, ignoring.`);return}this._rolloverUserSession(`manual`),this._storage.setItem(Jd,String(e))}getSessionPartId(){return this._activeSessionPartId}getSessionPartIdAt(e){for(let t=this._sessionPartHistory.length-1;t>=0;t--)if(this._sessionPartHistory[t].startTimeEpochMillis<=e)return this._sessionPartHistory[t].id;return this._sessionPartHistory.length>0?this._sessionPartHistory[0].id:this.getSessionPartId()}getSessionPartSpan(){return this._sessionPartSpan}startSessionPartInternal({reason:e,timestamp:t}){if(this._sessionPartSpan){this._diag.warn(`startSessionPartInternal called while a part is active (reason: ${e}); ignoring`);return}if(Od(this._visibilityDoc)===`background`||!this._visibilityDoc.hasFocus()){this._diag.debug(`skipping session part start (reason: ${e}) because the tab is not engaged`);return}let n=id(),r=this._nextSessionPartCounts;this._beginUserSessionForPartStart();let i=U(U({},this.getUserSessionAttributes()),{},{[I]:`ux.session_part`,[Zn]:`foreground`,[or]:n,"mxl.session_part_start_reason":e,"mxl.cold_start":this._coldStart,"mxl.experience_id":this._tab.experienceId,"mxl.tab_id":this._tab.tabId,"mxl.navigation_source":this._navigationSource},r);this._referrerScrubbedUrl&&(i[`mxl.referrer_url`]=this._referrerScrubbedUrl),this._tab.sourceTabId&&(i[`mxl.source_tab_id`]=this._tab.sourceTabId),this._activeSessionPartId=n;let a;try{a=new Rd(this._tracer.startSpan(`mxl-session-part`,{attributes:i,startTime:t}))}catch(e){this._activeSessionPartId=null,this._diag.error(`Error starting session part span`,e);return}this._activeSessionPartCounts={},this._nextSessionPartCounts={},this._sessionPartSpan=a,this._sessionPartHistory.push({id:n,startTimeEpochMillis:t==null?this._perf.getNowMillis():t}),this._startSessionPartInactivityTimer(),this._fireListeners(this._sessionPartStartedListeners,`started`,{reason:e})}endSessionPartInternal({reason:e,userSessionEndReason:t,timestamp:n}){if(!this._sessionPartSpan){this._diag.debug(`trying to end a session part, but there is no session part in progress. This is a no-op.`);return}this._clearSessionPartInactivityTimer();let r=Qd.has(e),i=this._perf.getNowMillis(),a=n==null?i:n,o=this._sessionPartSpan;try{let n=U(U(U({"mxl.session_part_end_reason":e},this._activeSessionPartCounts),this._limitManager.getDiagnosticCounts()),{},{"mxl.sdk_startup_duration":this._sdkStartupDuration});this._coldStart&&(n[`mxl.page_load`]=this._visibilityDoc.readyState===`complete`),r&&(n[`mxl.is_final_session_part`]=1,t&&(n[`mxl.user_session_termination_reason`]=t)),this._analyticsManager&&(Object.assign(n,this._analyticsManager.buildSessionPartAnalyticsAttributes()),this._analyticsManager.finalizeSessionPartAnalytics());let i={};for(let[e,t]of Object.entries(this.getSessionPartProperties()))i[`mxl.properties.`+e]=t;try{o.setAttributes(U(U({},i),n))}catch(e){this._diag.warn(`Error setting end attributes on session part span; ending span without them`,e)}}finally{this._fireListeners(this._sessionPartEndedListeners,`ended`);try{o.end(a)}catch(e){this._diag.warn(`Error ending session part span`,e)}this._sessionPartSpan=null,this._coldStart=!1,this._activeSessionPartId=null,this._activeSessionPartCounts=null,this._currentSessionPartNumber=null,this._limitManager.reset()}if(r){var s,c;this._previousUserSessionId=(s=(c=this._state)==null?void 0:c.userSessionId)==null?null:s,this._state=null,this._storage.removeItem(Kd),this._clearMaxDurationTimer(),this._sessionPartHistory=[]}else this._continueUserSessionAfterPartEnd(i)}rolloverSessionPartInternal({endReason:e,startReason:t,timestamp:n}){if(!this._sessionPartSpan)return;let r=n==null?this._perf.getNowMillis():n;this.endSessionPartInternal({reason:e,timestamp:r}),this.startSessionPartInternal({reason:t,timestamp:r})}addBreadcrumb(e){if(!this._sessionPartSpan){this._diag.debug(`trying to add breadcrumb, but there is no session part in progress. This is a no-op.`);return}let t=this._limitManager.limitBreadcrumb(e);t!==`dropped`&&this._sessionPartSpan.addEvent(`mxl-breadcrumb`,{message:t.name},this._perf.getNowMillis())}addProperty(e,t,n){let r=this._limitManager.limitSessionProperty(e,t);if(r===`dropped`)return;let i=r.key,a=r.value;if((n==null?void 0:n.lifespan)===`permanent`){let e=U(U({},this._permanentProperties),{},{[i]:a});if(!df(this._storage,e)){this._diag.warn(`Storage unavailable; rejecting permanent property write.`);return}this._permanentProperties=e,this._removeFromUserSessionProperties(i);return}let{state:o}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());this._state=U(U({},o),{},{userSessionProperties:U(U({},o.userSessionProperties),{},{[i]:a})}),this._storeState()||(this._state=o,this._diag.warn(`Storage unavailable; rejecting user-session property write.`))}removeProperty(e){let t=this._limitManager.truncateString(`session_property_key`,e);this._removeFromPermanentProperties(t),this._removeFromUserSessionProperties(t)}getSessionPartProperties(){var e;return U(U({},this._permanentProperties),(e=this._state)==null?void 0:e.userSessionProperties)}incrSessionPartCountForKey(e){if(!this._sessionPartSpan||!this._activeSessionPartCounts){this._diag.debug(`trying to increment a count for the active session part, but there is no session part in progress. This is a no-op.`);return}this._activeSessionPartCounts[e]=(this._activeSessionPartCounts[e]||0)+1}incrNextSessionPartCountForKey(e){this._nextSessionPartCounts[e]=(this._nextSessionPartCounts[e]||0)+1}addSessionPartStartedListener(e){return this._addListener(this._sessionPartStartedListeners,e)}addSessionPartEndedListener(e){return this._addListener(this._sessionPartEndedListeners,e)}_loadOrCreateUserSessionState(e){let t=lf(this._storage,this._diag);!t&&!this._hasStoredState&&this._state&&(t=this._state);let n=!1;if(!t||nf(t,e)){var r;t&&(this._previousUserSessionId=t.userSessionId);let i=Dd(this._storage,`mxl_user_session_number`,this._diag);t=rf(U(U({},this._resolveUserSessionDurations()),{},{now:e,previousUserSessionId:this._previousUserSessionId,userSessionNumber:i})),n=!0,(r=this._analyticsManager)==null||r.resetSessionAnalyticsForNewUserSession()}return(n||this._maxDurationTimeout===null)&&this._setupMaxDurationTimer(t,e),{created:n,state:t}}_beginUserSessionForPartStart(){let e=this._perf.getNowMillis(),{state:t}=this._loadOrCreateUserSessionState(e);this._currentSessionPartNumber=Dd(this._storage,`mxl_session_part_number`,this._diag),this._state=U(U({},t),{},{userSessionPartIndex:t.userSessionPartIndex+1,inactivityDeadlineTs:null}),this._storeState()}_continueUserSessionAfterPartEnd(e){if(!this._state){this._clearMaxDurationTimer();return}if(this._hasStoredState&&this._storage.getItem(`mxl_user_session_state`)===null){this._previousUserSessionId=this._state.userSessionId,this._state=null,this._clearMaxDurationTimer();return}this._state=U(U({},this._state),{},{inactivityDeadlineTs:e+this._state.inactivityTimeoutSeconds*1e3}),this._storeState()}_rolloverUserSession(e){var t,n;if(this._sessionPartSpan){let t=this._perf.getNowMillis();this.endSessionPartInternal({reason:`user_session_ended`,userSessionEndReason:e,timestamp:t}),this.startSessionPartInternal({reason:`user_session_rollover`,timestamp:t});return}this._previousUserSessionId=(t=(n=this._state)==null?void 0:n.userSessionId)==null?null:t,this._state=null,this._storage.removeItem(Kd),this._clearMaxDurationTimer()}_setupMaxDurationTimer(e,t){this._clearMaxDurationTimer();let n=e.userSessionMaxEndTs-t;n<=0||(this._maxDurationTimeout=setTimeout(()=>{this._maxDurationTimeout=null,this._rolloverUserSession(`max_duration_reached`)},n))}_clearMaxDurationTimer(){this._maxDurationTimeout!==null&&(clearTimeout(this._maxDurationTimeout),this._maxDurationTimeout=null)}_shutdown(){this._isShutdown||(this._isShutdown=!0,e._testInstances.delete(this),this._onActivityThrottled.cancel(),tf({activityEvents:this._activityEvents,onActivity:this._onActivityThrottled,onBlur:this._onBlur,onFocus:this._onFocus,onPageHide:this._onPageHide,onPageShow:this._onPageShow,onVisibilityChange:this._onVisibilityChange,target:this._target,visibilityDoc:this._visibilityDoc}),this._clearSessionPartInactivityTimer(),this._clearMaxDurationTimer())}_handleEngagementTransition(e){try{let t=Wd(this._visibilityDoc),n=this._activeSessionPartId!==null;if(!t&&n){this._diag.debug(`tab disengaged via ${e}; ending current part`),this.endSessionPartInternal({reason:`web_background`});return}if(t&&!n){this._diag.debug(`tab engaged via ${e}; starting new part`),this.startSessionPartInternal({reason:`web_foreground`});return}t&&n&&this._startSessionPartInactivityTimer()}catch(e){this._diag.warn(`Error handling engagement change`,e)}}_resolveUserSessionDurations(){var e,t,n,r;let i=(e=this._dynamicConfigManager)==null?void 0:e.getConfig(),a=Ud({defaultValue:43200,diag:this._diag,max:86400,min:3600,value:(t=this._config.maxDurationSeconds)==null?i==null?void 0:i.userSessionMaxDurationSeconds:t}),o=this._withinMaxDuration(`session.inactivityTimeoutSeconds`,Ud({defaultValue:Zd,diag:this._diag,max:86400,min:30,value:(n=this._config.inactivityTimeoutSeconds)==null?i==null?void 0:i.userSessionInactivityTimeoutSeconds:n}),a,Zd);return{foregroundInactivityTimeoutSeconds:this._withinMaxDuration(`session.foregroundInactivityTimeoutSeconds`,Ud({defaultValue:o,diag:this._diag,max:86400,min:30,value:(r=this._config.foregroundInactivityTimeoutSeconds)==null?i==null?void 0:i.userSessionForegroundInactivityTimeoutSeconds:r}),a,o),inactivityTimeoutSeconds:o,maxUserSessionDurationSeconds:a}}_withinMaxDuration(e,t,n,r){return t<=n?t:(this._diag.warn(`${e} (${t.toString()}s) exceeds session.maxDurationSeconds (${n.toString()}s); falling back to ${r.toString()}s.`),r)}_startSessionPartInactivityTimer(){this._clearSessionPartInactivityTimer(),this._state&&(this._sessionPartInactivityTimer=setTimeout(this._onSessionPartInactivity,this._state.foregroundInactivityTimeoutSeconds*1e3))}_clearSessionPartInactivityTimer(){this._sessionPartInactivityTimer!==null&&(clearTimeout(this._sessionPartInactivityTimer),this._sessionPartInactivityTimer=null)}_addListener(e,t){return e.push(t),()=>{let n=e.indexOf(t);n!==-1&&e.splice(n,1)}}_fireListeners(e,t,n){for(let r of e)try{r(n)}catch(e){this._diag.warn(`Error while executing session part ${t} listener`,e)}}_storeState(){if(!this._state)return!1;let e=this._storage.setItem(Kd,JSON.stringify(this._state));return e&&(this._hasStoredState=!0),e}_removeFromPermanentProperties(e){if(!(e in this._permanentProperties))return;let t=U({},this._permanentProperties);delete t[e],this._permanentProperties=t,df(this._storage,t)}_removeFromUserSessionProperties(e){if(!this._state||!(e in this._state.userSessionProperties))return;let t=U({},this._state.userSessionProperties);delete t[e],this._state=U(U({},this._state),{},{userSessionProperties:t}),this._storeState()}};P(yf,`_testInstances`,new Set),F();var bf=class{constructor({urlDocument:e=window.document}={}){P(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`browser.url.full`]||e.setAttribute(tr,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};F();var xf=class{constructor({urlDocument:e=window.document}={}){P(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){e.attributes[`browser.url.full`]||(e.attributes[tr]=this._urlDocument.URL)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var Sf=class{constructor({attributeScrubbers:e}){P(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&e.setAttribute(t.key,t.scrub(n))})}shutdown(){return Promise.resolve(void 0)}};R(),F();var Cf=class{constructor({urlDocument:e=window.document,visibilityDocument:t=window.document}={}){P(this,`_urlDocument`,void 0),P(this,`_visibilityDocument`,void 0),this._urlDocument=e,this._visibilityDocument=t}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`mxl.type`]||e.setAttribute(I,`sys.log`),e.setAttribute(oi,this._urlDocument.URL),e.attributes[`mxl.is_tab_engaged`]===void 0&&e.setAttribute(`mxl.is_tab_engaged`,Wd(this._visibilityDocument))}shutdown(){return Promise.resolve(void 0)}};R();let wf=e=>{if((e.attributes[`http.request.method`]||e.attributes[`http.method`])&&(typeof e.attributes[`http.response.status_code`]==`number`||typeof e.attributes[`http.status_code`]==`number`)){var t;let n=(t=e.attributes[`url.full`])==null?e.attributes[Rr]:t;return typeof n==`string`&&n.includes(`://`)}return!1};R();var Tf=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){Ao(e.spanContext().traceId)}onEnding(e){wf(e)&&(e.attributes[I]=`perf.network_request`,e.attributes[`url.full`]===void 0&&(e.attributes[oi]=e.attributes[Rr]),e.attributes[`http.response.status_code`]===void 0&&(e.attributes[Qr]=e.attributes[zr]),e.attributes[`http.request.method`]===void 0&&(e.attributes[Xr]=e.attributes[Lr]),e.attributes[`http.response.body.size`]===void 0&&(e.attributes[$u]=e.attributes[Vr]),e.attributes[`http.request.body.size`]===void 0&&(e.attributes[`http.request.body.size`]=e.attributes[Br]))}onStart(){}shutdown(){return Promise.resolve(void 0)}};let Ef=`Soft Navigation`,Df=`mxl.soft_navigation.source`,Of=`mxl.soft_navigation.interaction_id`,kf=`mxl.soft_navigation.start_time`,Af=`mxl.soft_navigation.duration`,jf={performanceObserver:`performance_observer`,polyfill:`polyfill`},Mf=e=>e.attributes[I]===`ux.session_part`,Nf=e=>e.attributes[Df]!==void 0;N(),B(),F();let Pf=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var Ff=class{constructor({exporter:e,limitManager:t,userSessionManager:n,emptySessionAvoidanceEnabled:r=!1,diag:i=j.createComponentLogger({namespace:`MXLSessionPartBatchedSpanProcessor`})}){P(this,`_shutdownOnce`,void 0),P(this,`_pendingSpans`,[]),P(this,`_exporter`,void 0),P(this,`_limitManager`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_emptySessionAvoidanceEnabled`,void 0),P(this,`_diag`,void 0),P(this,`_shutdown`,()=>this._exporter.shutdown()),this._diag=i,this._exporter=e,this._shutdownOnce=new la(this._shutdown,this),this._limitManager=t,this._userSessionManager=n,this._emptySessionAvoidanceEnabled=r}forceFlush(){return this._diag.debug(`forceFlush called for MXLSessionPartBatchedSpanProcessor. This is a no op`),Promise.resolve(void 0)}onEnd(e){if(this._shutdownOnce.isCalled){this._diag.debug(`span ended after processor shutdown. Ignoring span.`);return}if(Mf(e))this._diag.debug(`session part span ended. Exporting all pending spans.`),this._exportSpans([e,...this._pendingSpans]),this._pendingSpans=[];else{if(this._diag.debug(`non-session-part span ended. Adding to pending spans queue.`),this._limitManager.dropReadableSpan(e))return;this._pendingSpans.push(e)}}_isEmptySessionExport(e){return e.length===1&&Mf(e[0])}_exportSpans(e){if(this._emptySessionAvoidanceEnabled&&this._isEmptySessionExport(e)){this._diag.debug(`Skipping export of empty session part`);return}pa._export(this._exporter,e).then(e=>{if(e.code===z.FAILED){var t;let n=((t=e.error)==null?void 0:t.message)||`unknown error`,r=`unknown`;n===`Concurrent export limit reached`?r=`concurrent_limit`:n===`Fetch request errored`&&(r=`fetch_error`),this._userSessionManager.incrSessionPartCountForKey(Pf(r,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(Pf(r,`previous`)),this._diag.error(`spans failed to export: ${n}`)}}).catch(e=>{let t=`unknown error`;e&&e instanceof Error?t=e.message:typeof e==`string`&&(t=e),this._userSessionManager.incrSessionPartCountForKey(Pf(`unknown`,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(Pf(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}shutdown(){return this._shutdownOnce.call()}};F();var If=class{constructor({pageManager:e}){P(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){if(!e.attributes[`app.surface.name`]||!e.attributes[`app.surface.id`]){let t=this._pageManager.getCurrentRoute();t&&(e.setAttribute(rr,t.path),e.setAttribute(ir,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&e.setAttribute(ar,t)}shutdown(){return Promise.resolve(void 0)}};F();var Lf=class{constructor({pageManager:e}){P(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){if(!e.attributes[`app.surface.name`]||!e.attributes[`app.surface.id`]){let t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.attributes[rr]=t.path,e.attributes[ir]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&(e.attributes[ar]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};N(),B(),F();var Rf=class{constructor({buffer:e}){P(this,`_buffer`,void 0),this._buffer=e}onEmit(e){try{let t=e.attributes[ed];typeof t==`string`&&t.length>0&&this._buffer.record({kind:`log`,id:t,startTime:wi(e.hrTime),type:e.attributes[I]})}catch(e){j.error(`failed to record log for signal correlation`,e)}}forceFlush(){return Promise.resolve(void 0)}shutdown(){return Promise.resolve(void 0)}};N(),B(),F();var zf=class{constructor({buffer:e}){P(this,`_buffer`,void 0),this._buffer=e}forceFlush(){return Promise.resolve(void 0)}onStart(e){try{if(Nf(e)||Mf(e))return;this._buffer.record({kind:`span`,id:e.spanContext().spanId,startTime:wi(e.startTime),type:e.attributes[I]})}catch(e){j.error(`failed to record span for correlation`,e)}}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var Bf=class{constructor({attributeScrubbers:e}){P(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&(e.attributes[t.key]=t.scrub(n))})}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var Vf=class{constructor({userManager:e}){P(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._userManager.getUserId()&&e.setAttributes({[td]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}};F();var Hf=class{constructor({userSessionManager:e}){P(this,`_userSessionManager`,void 0),this._userSessionManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){var t,n,r,i,a,o;let s=(t=(n=e.attributes[`mxl.user_session_id`])==null?this._userSessionManager.getUserSessionId():n)==null?``:t,c=(r=(i=e.attributes[`mxl.user_session_previous_id`])==null?this._userSessionManager.getPreviousUserSessionId():i)==null?``:r,l=(a=(o=e.attributes[`mxl.session_part_id`])==null?this._userSessionManager.getSessionPartId():o)==null?``:a;e.setAttributes({[ed]:id(),[sr]:s,[cr]:c,[or]:l})}shutdown(){return Promise.resolve(void 0)}};F();var Uf=class{constructor({userManager:e}){P(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){let t=this._userManager.getUserId();t&&(e.attributes[td]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var Wf=class{constructor({maxAgeMillis:e=6e4,maxEntries:t=4096}={}){P(this,`_maxAgeMillis`,void 0),P(this,`_maxEntries`,void 0),P(this,`_entries`,[]),P(this,`_latestStartTime`,0),this._maxAgeMillis=e,this._maxEntries=t}record(e){this._entries.push(e),e.startTime>this._latestStartTime&&(this._latestStartTime=e.startTime),this._evict()}collectWindow(e,t){let n=this._entries.filter(n=>n.startTime>=e&&n.startTime<=t),r=n.filter(e=>e.kind===`span`),i=n.filter(e=>e.kind===`log`);return{spanIds:r.map(e=>e.id),spanTypes:r.map(e=>{var t;return(t=e.type)==null?``:t}),logIds:i.map(e=>e.id),logTypes:i.map(e=>{var t;return(t=e.type)==null?``:t})}}_evict(){let e=this._latestStartTime-this._maxAgeMillis;for(;this._entries.length>0&&this._entries[0].startTime<e;)this._entries.shift();for(;this._entries.length>this._maxEntries;)this._entries.shift()}};N(),B();var Gf=class extends $i{inject(e,t,n){super.inject(e,t,n);let r=M.getSpan(e);if(r){let e=t instanceof Headers?t.get(`traceparent`):Ae.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};N(),F();var Kf=class{constructor({namespace:e,storage:t,diag:n}){P(this,`_diag`,void 0),P(this,`_keyPrefix`,void 0),P(this,`_storage`,void 0),P(this,`_writeDisabled`,!1),this._diag=n==null?j.createComponentLogger({namespace:`NamespacedStorage`}):n,this._keyPrefix=e?`${e}__`:``,this._storage=t}keys(){let e;try{({length:e}=this._storage)}catch(e){return this._diag.warn(`failed to read storage length`,String(e)),[]}let t=[];for(let n=0;n<e;n++)try{let e=this._storage.key(n);if(e===null)continue;this._keyPrefix?e.startsWith(this._keyPrefix)&&t.push(e.substring(this._keyPrefix.length)):t.push(e)}catch(e){this._diag.warn(`failed to read storage key at index ${n.toString()}`,String(e))}return t}get length(){return this.keys().length}clear(){let e=!0;for(let t of this.keys())this._safeRemove(this._keyName(t))||(e=!1);return e}getItem(e){try{return this._storage.getItem(this._keyName(e))}catch(t){return this._diag.warn(`failed to read ${e}`,String(t)),null}}key(e){var t;return(t=this.keys()[e])==null?null:t}removeItem(e){return this._safeRemove(this._keyName(e))}setItem(e,t){if(this._writeDisabled)return!1;try{return this._storage.setItem(this._keyName(e),t),!0}catch(e){return this._disableWrites(e),!1}}getStorageEventKey(e){return this._keyName(e)}_keyName(e){return`${this._keyPrefix}${e}`}_safeRemove(e){try{return this._storage.removeItem(e),!0}catch(t){return this._diag.warn(`failed to remove ${e}`,String(t)),!1}}_disableWrites(e){if(this._writeDisabled)return;this._writeDisabled=!0;let t=e instanceof Error?e.name:`UnknownError`;this._diag.error(`writes disabled after failure; continuing in-memory only`,t)}};let qf=({diag:e,featureManager:t,registerGlobally:n,propagator:r,defaultInstrumentationConfig:i})=>{var a;if(!t.isNetworkSpanForwardingEnabled())return!1;let o=[];return n||o.push("Network span forwarding cannot be used when `registerGlobally` is set to false. Turning off network span forwarding."),r&&o.push("Network span forwarding cannot be used alongside a custom `propagator`. Turning off network span forwarding."),!(i==null||(a=i.omit)==null)&&a.has(`@opentelemetry/instrumentation-xml-http-request`)&&i.omit.has(`@opentelemetry/instrumentation-fetch`)&&o.push(`Network span forwarding cannot be used when both '@opentelemetry/instrumentation-xml-http-request' and '@opentelemetry/instrumentation-fetch' are omitted. Turning off network span forwarding.`),o.forEach(t=>{e.warn(t)}),o.length===0},Jf=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Yf=({collectorUrl:e,configUrl:t})=>[RegExp(`^${Jf(e)}/v1/(traces|logs)(\\?|$)`),RegExp(`^${Jf(t)}/((config|replay)(\\?|$)|sessionReplays/)`)];var Xf,Zf=n((()=>{Xf=`http.request.body.size`}));function Qf(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=$f(t.body);return t.body=e,n}else return Promise.resolve(tp(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>np(e)):Promise.resolve()}}function $f(e){if(!e.pipeThrough)return sp.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},transform(e,n){return K(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function ep(e){return typeof Document<`u`&&e instanceof Document}function tp(e){if(ep(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return np(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return rp(e);if(e instanceof URLSearchParams)return np(e.toString());if(e.byteLength!==void 0)return e.byteLength;sp.warn(`unknown body type`)}function np(e){return cp.encode(e).byteLength}function rp(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function ip(e){let t=ap(),n=e.toUpperCase();return n in t?n:`_OTHER`}function ap(){return up===void 0&&(up=lp),up}function op(e){let t=Number(e.port||dp[e.protocol]);if(t&&!isNaN(t))return t}var sp,cp,lp,up,dp,fp=n((()=>{N(),B(),q(),sp=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),cp=new TextEncoder,lp={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},dp={"https:":`443`,"http:":`80`}})),pp,mp=n((()=>{pp=`0.222.0`})),hp,gp,_p,vp=n((()=>{N(),B(),Zf(),R(),fp(),mp(),F(),hp=300,gp=typeof PerformanceObserver<`u`,_p=class extends fs{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,pp,e),P(this,`component`,`fetch`),P(this,`version`,pp),P(this,`moduleName`,this.component),P(this,`_usedResources`,new WeakSet),P(this,`_tasksCount`,0)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[X.FETCH_START]},M.setSpan(A.active(),e));ml(n,t,this.getConfig().ignoreNetworkEvents,void 0,!0),n.end(t[X.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=bl(t.url);e.setAttribute(Qr,t.status),e.setAttribute($r,n.hostname);let r=op(n);r&&e.setAttribute(ei,r)}_addHeaders(e,t){if(!xl(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};qt.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)qt.inject(A.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);qt.inject(A.active(),t,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))}),e.headers=t}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(aa(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n={},r=t.method,i=ip(t.method||`GET`),a=i;return n[Xr]=i,i!==r&&(n[Zr]=r),n[oi]=e,this.tracer.startSpan(a,{kind:xt.CLIENT,attributes:n})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=_l(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n)),ml(e,t,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=yi(Date.now()),i=bi();this._addFinalSpanAttributes(e,n),n.status>=400&&(e.setStatus({code:Ct.ERROR}),e.setAttribute(Kr,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},hp)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=this,i=bl(n[0]instanceof Request?n[0].url:String(n[0])).href,a;a=n[0]instanceof Request?n[1]==null?n[0]:new Request(n[0],n[1]):n[1]||{};let o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&Qf(...n).then(e=>{e&&o.setAttribute(Xf,e)}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}catch(n){t._diag.error(`Failed to read fetch response body`,n),t._endSpan(e,s,{status:0,url:i})}return n}function d(e,n){try{c(e,n)}catch(r){t._diag.error(`Failed to end span on fetch error`,r),t._endSpan(e,s,{status:n.status||0,url:i})}throw n}return A.with(M.setSpan(A.active(),o),()=>(t._callRequestHook(o,a),t._addHeaders(a,i),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o),d.bind(r,o))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&hs(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&hs(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=bi(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(!gp){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(e){this._diag.warn(`Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.`,e)}}}disable(){gp&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}})),yp=n((()=>{vp()})),bp,xp=n((()=>{bp=`http.request.body.size`})),Sp,Cp=n((()=>{(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`})(Sp||(Sp={}))}));function wp(e){return typeof Document<`u`&&e instanceof Document}function Tp(e){if(wp(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Ep(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Dp(e);if(e instanceof URLSearchParams)return Ep(e.toString());if(e.byteLength!==void 0)return e.byteLength;jp.warn(`unknown body type`)}function Ep(e){return Mp.encode(e).byteLength}function Dp(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Op(e){let t=kp(),n=e.toUpperCase();return n in t?n:`_OTHER`}function kp(){return Pp===void 0&&(Pp=Np),Pp}function Ap(e){let t=Number(e.port||Fp[e.protocol]);if(t&&!isNaN(t))return t}var jp,Mp,Np,Pp,Fp,Ip=n((()=>{N(),B(),jp=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),Mp=new TextEncoder,Np={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Fp={"https:":`443`,"http:":`80`}})),Lp,Rp=n((()=>{Lp=`0.222.0`})),zp,Bp,Vp=n((()=>{N(),_s(),B(),wl(),R(),xp(),Cp(),Ip(),Rp(),F(),zp=300,Bp=class extends fs{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,Lp,e),P(this,`component`,`xml-http-request`),P(this,`version`,Lp),P(this,`moduleName`,this.component),P(this,`_tasksCount`,0),P(this,`_xhrMem`,new WeakMap),P(this,`_usedResources`,new WeakSet)}init(){}_addHeaders(e,t){let n=bl(t).href;if(!xl(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};qt.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};qt.inject(A.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){A.with(M.setSpan(A.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[X.FETCH_START]});ml(e,t,this.getConfig().ignoreNetworkEvents,void 0,!0),e.end(t[X.RESPONSE_END])})}_addFinalSpanAttributes(e,t){t.status&&e.setAttribute(Qr,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&hs(()=>n(e,t),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_addResourceObserver(e,t){let n=this._xhrMem.get(e);!n||typeof PerformanceObserver!=`function`||typeof PerformanceResourceTiming!=`function`||(n.createdResources={observer:new PerformanceObserver(e=>{let r=e.getEntries(),i=bl(t);r.forEach(e=>{e.initiatorType===`xmlhttprequest`&&e.name===i.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:[`resource`]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(_i.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,i){if(!n||!r||!i||!e.createdResources)return;let a=e.createdResources.entries;(!a||!a.length)&&(a=_i.getEntriesByType(`resource`));let o=_l(bl(n).href,r,i,a,this._usedResources);if(o.mainRequest){let e=o.mainRequest;this._markResourceAsUsed(e);let n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n)),ml(t,e,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){let r=bl(t);if(aa(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i={},a=n,o=Op(n),s=o;i[Xr]=o,o!==a&&(i[Zr]=a),i[oi]=r.toString(),i[$r]=r.hostname;let c=Ap(r);c&&(i[ei]=c);let l=this.tracer.startSpan(s,{kind:xt.CLIENT,attributes:i});return l.addEvent(Sp.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:l,spanUrl:t}),l}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=n[0],i=n[1];return t._createSpan(this,i,r),e.apply(this,n)}}}_patchSend(){let e=this;function t(t,n,r,i){let a=n.callbackToRemoveEvents;typeof a==`function`&&a();let{span:o,spanUrl:s,sendStartTime:c}=n;o&&(e._findResourceAndAddNetworkEvents(n,o,s,c,r),o.addEvent(t,i),e._addFinalSpanAttributes(o,n),o.end(i),e._tasksCount--),e._clearResources()}function n(n,r,i,a){let o=e._xhrMem.get(r);if(!o)return;if(o.status=r.status,o.statusText=r.statusText,e._xhrMem.delete(r),o.span){let t=o.span;e._applyAttributesAfterXHR(t,r),i?a&&(t.setStatus({code:Ct.ERROR,message:a}),t.setAttribute(Kr,a)):o.status&&o.status>=400&&(t.setStatus({code:Ct.ERROR}),t.setAttribute(Kr,String(o.status)))}let s=bi(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},zp)}function r(){n(Sp.EVENT_ERROR,this,!0,`error`)}function i(){n(Sp.EVENT_ABORT,this,!1)}function a(){n(Sp.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(Sp.EVENT_LOAD,this,!1):n(Sp.EVENT_ERROR,this,!1)}function s(t){t.removeEventListener(`abort`,i),t.removeEventListener(`error`,r),t.removeEventListener(`load`,o),t.removeEventListener(`timeout`,a);let n=e._xhrMem.get(t);n&&(n.callbackToRemoveEvents=void 0)}return t=>function(...n){if(!e._isEnabled)return t.apply(this,n);let c=e._xhrMem.get(this);if(!c)return t.apply(this,n);let l=c.span,u=c.spanUrl;if(l&&u){if(e.getConfig().measureRequestSize&&n!=null&&n[0]){let e=n[0],t=Tp(e);t!==void 0&&l.setAttribute(bp,t)}A.with(M.setSpan(A.active(),l),()=>{e._tasksCount++,c.sendStartTime=bi(),l.addEvent(Sp.METHOD_SEND),this.addEventListener(`abort`,i),this.addEventListener(`error`,r),this.addEventListener(`load`,o),this.addEventListener(`timeout`,a),c.callbackToRemoveEvents=()=>{s(this),c.createdResources&&c.createdResources.observer.disconnect()},e._addHeaders(this,u),e._addResourceObserver(this,u)})}return t.apply(this,n)}}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(e){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.`,e)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),Hp=n((()=>{Vp()})),Up=r({FetchInstrumentation:()=>_p,XMLHttpRequestInstrumentation:()=>Bp}),Wp=n((()=>{yp(),Hp()}));W(),q();let Gp=function(){var e=K(function*(e,t){var n,r;let i=[],a=!((n=e.omit)!=null&&n.has(`@opentelemetry/instrumentation-fetch`)),o=!((r=e.omit)!=null&&r.has(`@opentelemetry/instrumentation-xml-http-request`));if(!a&&!o)return i;let{FetchInstrumentation:s,XMLHttpRequestInstrumentation:c}=yield Promise.resolve().then(()=>(Wp(),Up));if(a){var l,u,d,f;i.push(new s(U(U({},e[`@opentelemetry/instrumentation-fetch`]),{},{ignoreUrls:[...(l=(u=e.network)==null?void 0:u.ignoreUrls)==null?[]:l,...(d=(f=e[`@opentelemetry/instrumentation-fetch`])==null?void 0:f.ignoreUrls)==null?[]:d,...t],enabled:!1})))}if(o){var p,m,h,g;i.push(new c(U(U({},e[`@opentelemetry/instrumentation-xml-http-request`]),{},{ignoreUrls:[...(p=(m=e.network)==null?void 0:m.ignoreUrls)==null?[]:p,...(h=(g=e[`@opentelemetry/instrumentation-xml-http-request`])==null?void 0:g.ignoreUrls)==null?[]:h,...t],enabled:!1})))}return i});return function(t,n){return e.apply(this,arguments)}}();Promise.resolve();let Kp=(e={},t=[])=>Gp(e,t),qp={isRecording:()=>!1,setEnabled:()=>{}};N(),F();let Jp=new class{constructor({diagLogger:e=j.createComponentLogger({namespace:`mxl-registry`})}={}){P(this,`_sdk`,null),P(this,`_diag`,void 0),P(this,`register`,e=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=e}),P(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),P(this,`registered`,()=>this._sdk),this._diag=e}};W();let Yp=[`enabled`,`apiKey`],Xp={additionalQueryParamsToScrub:`scrubbing.queryParams`,apiKey:`replay.apiKey`,apiURL:`configUrl`,appID:`appId`,applicationId:`appId`,attributeScrubbers:`scrubbing.scrubbers`,enableDefaultAttributeScrubbing:`scrubbing.defaults`,inactivityTimeoutSeconds:`session.inactivityTimeoutSeconds`,maxUserSessionDurationSeconds:`session.maxDurationSeconds`,otelCollectorURL:`collectorUrl`,recordUserSessions:`replay.enabled`},Zp=e=>{let t=Object.keys(Xp).filter(t=>t in e),n=e.defaultInstrumentationConfig,r=t.map(e=>`'${e}' was removed, use '${Xp[e]}' instead`);if(n&&`replay`in n&&r.push(`'defaultInstrumentationConfig.replay' was removed, use 'replay' instead`),r.length>0)throw Error(`${r.join(`; `)}. See UPGRADING.md.`)},Qp=e=>{if(e===void 0)return;if(typeof e!=`string`)throw Error(`appId must be a string, or omitted if not using MXL. Received ${String(e)}`);let t=e.trim();if(t===``)throw Error(`appId cannot be an empty string, omit it if not using MXL.`);return t},$p=e=>{if(e===void 0){let e=`MXLAppVersionX.X.X`;return e===``?`unspecified`:e}if(typeof e!=`string`)throw Error(`if appVersion is specified, it must be a string. Received ${String(e)}`);let t=e.trim();if(t===``)throw Error(`if appVersion is specified, it cannot be an empty string.`);return t},em=(e,t,n)=>{if(t===void 0)return n;let r=typeof t==`string`?t.trim():``,i;try{i=new URL(r).protocol}catch(e){i=void 0}if(i!==`http:`&&i!==`https:`)throw Error(`${e} must be an absolute http(s) URL, or omitted to use the default. Received ${JSON.stringify(t)}`);return r.replace(/\/+$/,``)},tm=e=>{var t,n;Zp(e);let r=(t=e.replay)==null?{}:t,{enabled:i=!0,apiKey:a}=r,o=Uo(r,Yp),{defaults:s=!0,queryParams:c=[],scrubbers:l=[]}=(n=e.scrubbing)==null?{}:n;return{appId:Qp(e.appId),appVersion:$p(e.appVersion),attributeScrubbers:[...s?Bo(c):[],...l],collectorUrl:em(`collectorUrl`,e.collectorUrl,`http://mxl-otelcol.apps.ocpthikadev01.safaricom.net`),configUrl:em(`configUrl`,e.configUrl,`http://mxl-basket.apps.ocpthikadev01.safaricom.net`),replay:{apiKey:a,enabled:i,options:o},session:U({},e.session)}},nm=(e,t)=>{let n=e.nodeName.toLowerCase(),r=t.substring(0,30),i=t.length>30?`...`:``;return`<${n}${e.className?` class="${e.className}"`:``}>${r}${i}</${n}>`};F();var rm=class extends G{constructor({diag:e,perf:t,shouldTrack:n,innerTextForElement:r}={}){super({config:{},diag:e,instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onClickHandler`,void 0),this._onClickHandler=e=>{let t=e.target;if(t instanceof HTMLElement&&!t.hasAttribute(`disabled`)&&!(n&&!n(t)))try{let n=this.userSessionManager.getSessionPartSpan();n&&n.addEvent(`click`,{"mxl.type":`ux.tap`,"tap.coords":`${e.x.toString()},${e.y.toString()}`,"view.name":nm(t,r?r(t):t.textContent)},this.perf.epochMillisFromOriginOffset(e.timeStamp))}catch(e){this._diag.error(`failed to create new user interaction span event`,e)}},this._config.enabled&&this.enable()}onDisable(){document.removeEventListener(`click`,this._onClickHandler)}onEnable(){document.addEventListener(`click`,this._onClickHandler)}};W();let im=[`diag`];function am(e){var t,n;return typeof PerformanceObserver<`u`&&((t=(n=PerformanceObserver.supportedEntryTypes)==null?void 0:n.includes(e))==null?!1:t)}function om(e,t,n){let r=n==null?{}:n,{diag:i}=r,a=Uo(r,im);if(!am(e))return i==null||i.debug(`${e} not supported, skipping observer`),null;try{let n=new PerformanceObserver(n=>{for(let r of n.getEntries())try{t(r)}catch(t){i==null||i.error(`error processing ${e} entry`,t)}});return n.observe(U({buffered:!0,type:e},a)),n}catch(e){return null}}let sm=()=>window.performance.getEntriesByType(`navigation`)[0],cm=(e=sm())=>{var t;let n=e==null?void 0:e.notRestoredReasons;return n==null||(t=n.reasons)==null?void 0:t.map(e=>e.reason)};wl();let lm=()=>{let e={},t=sm();return t?(Object.values(X).forEach(n=>{if(pl(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}}),e.transferSize=t.transferSize,e.initiatorType=t.initiatorType,e.responseStatus=t.responseStatus,e.deliveryType=t.deliveryType,e.renderBlockingStatus=t.renderBlockingStatus,e.type=t.type,e.notRestoredReasons=cm(t),e):e},um={"first-contentful-paint":`firstContentfulPaint`,"first-paint":`firstPaint`},dm=(e,t)=>{window.performance.getEntriesByType(`paint`).forEach(({name:n,startTime:r})=>{pl(um,n)&&e.addEvent(um[n],t.epochMillisFromOriginOffset(r))})};N(),B(),_s(),wl(),R(),F();var fm=class extends G{constructor({diag:e,perf:t,enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i=!1,ignoreNetworkEvents:a=!1}={}){super({config:{applyCustomAttributesOnSpan:r,enabled:n,ignoreNetworkEvents:a,ignorePerformancePaintEvents:i},diag:e,instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_navigationObserver`,null),P(this,`_performanceCollected`,!1),this._config.enabled&&this.enable()}_addResourcesSpans(e){performance.getEntriesByType(`resource`).forEach(t=>{this._initResourceSpan(t,e)})}_collectIfLoadEventFinished(){if(!(this._performanceCollected||!this._isLoadEventFinished())){this._performanceCollected=!0;try{this._collectPerformance()}catch(e){this._diag.error(`failed to collect the document load`,e)}finally{this._disconnectObserver()}}}_isLoadEventFinished(){var e;let[t]=performance.getEntriesByType(`navigation`);return((e=t==null?void 0:t.loadEventEnd)==null?0:e)>0}_disconnectObserver(){var e;(e=this._navigationObserver)==null||e.disconnect(),this._navigationObserver=null}_collectPerformance(){let e=[...document.getElementsByTagName(`meta`)].find(e=>e.getAttribute(`name`)===Yi),t=lm(),n=(e==null?void 0:e.content)||``;A.with(qt.extract(T,{traceparent:n}),()=>{var e;let n=this._startSpan(`documentLoad`,X.FETCH_START,t);if(!n){this._diag.warn(`navigation entry has no fetchStart, document load will not be collected`);return}A.with(M.setSpan(A.active(),n),()=>{let e=this._startSpan(`documentFetch`,X.FETCH_START,t);e&&(e.setAttribute(oi,location.href),A.with(M.setSpan(A.active(),e),()=>{var n;ml(e,t,this.getConfig().ignoreNetworkEvents),this._addResourceAttributesToSpan(e,t),this._addNavigationTimingAttributesToSpan(e,t),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,X.RESPONSE_END,t)}))}),n.setAttribute(I,`ux.document_load`),n.setAttribute(oi,location.href),n.setAttribute(li,navigator.userAgent),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(Z(n,X.FETCH_START,t),Z(n,X.UNLOAD_EVENT_START,t),Z(n,X.UNLOAD_EVENT_END,t),Z(n,X.DOM_INTERACTIVE,t),Z(n,X.DOM_CONTENT_LOADED_EVENT_START,t),Z(n,X.DOM_CONTENT_LOADED_EVENT_END,t),Z(n,X.DOM_COMPLETE,t),Z(n,X.LOAD_EVENT_START,t),Z(n,X.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||dm(n,this.perf),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,X.LOAD_EVENT_END,t)})}_endSpan(e,t,n){e&&(pl(n,t)&&typeof n[t]==`number`?e.end(this.perf.epochMillisFromOriginOffset(n[t])):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(`resourceFetch`,X.FETCH_START,e,t);r&&(r.setAttribute(oi,e.name),ml(r,e,this.getConfig().ignoreNetworkEvents),this._addResourceAttributesToSpan(r,e),this._addResourceDiagnosticAttributes(r,e),this._addCustomAttributesOnResourceSpan(r,e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.resourceFetch),this._endSpan(r,X.RESPONSE_END,e))}_startSpan(e,t,n,r){if(pl(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:this.perf.epochMillisFromOriginOffset(n[t])},r?M.setSpan(A.active(),r):void 0)}_addCustomAttributesOnSpan(e,t){t&&hs(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addResourceAttributesToSpan(e,t){e.setAttribute(I,`ux.resource_fetch`),t.deliveryType&&e.setAttribute(`http.response.delivery_type`,t.deliveryType),t.initiatorType&&e.setAttribute(`http.request.initiator_type`,t.initiatorType),t.renderBlockingStatus&&e.setAttribute(`http.request.render_blocking_status`,t.renderBlockingStatus),t.responseStatus&&e.setAttribute(Qr,t.responseStatus),t.encodedBodySize!==void 0&&e.setAttribute($u,t.encodedBodySize),t.transferSize!==void 0&&e.setAttribute(`http.response.size`,t.transferSize),t.decodedBodySize!==void 0&&e.setAttribute(`http.response.decoded_body_size`,t.decodedBodySize)}_addNavigationTimingAttributesToSpan(e,t){var n;t.type&&e.setAttribute(`browser.navigation_timing.type`,t.type),(n=t.notRestoredReasons)!=null&&n.length&&e.setAttribute(nr,t.notRestoredReasons)}_addCustomAttributesOnResourceSpan(e,t,n){n&&hs(()=>{n(e,t)},e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}_hasNoSizeData(e){return e.transferSize===0&&e.decodedBodySize===0&&e.encodedBodySize===0}_hasTimingData(e){return e.fetchStart>0&&e.responseEnd>0}_isCorsRestricted(e){return this._hasNoSizeData(e)&&this._hasTimingData(e)}_isFetchIncomplete(e){return this._hasNoSizeData(e)&&e.fetchStart>0&&e.responseEnd===0}_isFetchPrevented(e){return this._hasNoSizeData(e)&&e.fetchStart===0}_isCacheValidated(e){return e.transferSize===300&&e.deliveryType!==`cache`}_addResourceDiagnosticAttributes(e,t){this._isCorsRestricted(t)?e.setAttribute(`http.response.cors_opaque`,!0):this._isFetchIncomplete(t)?e.setAttribute(`http.request.incomplete`,!0):this._isFetchPrevented(t)&&e.setAttribute(`http.request.prevented`,!0),this._isCacheValidated(t)&&e.setAttribute(`http.response.cache_revalidated`,!0)}onEnable(){if(this._isLoadEventFinished()){queueMicrotask(()=>{this._isEnabled&&this._collectIfLoadEventFinished()});return}this._navigationObserver=om(`navigation`,()=>{this._collectIfLoadEventFinished()},{buffered:!1,diag:this._diag}),this._navigationObserver||this._diag.warn(`navigation entries are not observable, document load will not be collected`)}onDisable(){this._disconnectObserver()}};F();var pm=class extends G{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ElementTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_observer`,null),this._config.enabled&&this.enable()}onEnable(){if(!am(`element`)){this._isEnabled=!1,this._diag.debug(`element not supported, skipping`);return}if(this._observer&&this._observer.disconnect(),this._observer=om(`element`,e=>this._processEntry(e),{diag:this._diag}),!this._observer){this._isEnabled=!1,this._diag.error(`failed to enable`);return}}onDisable(){this._observer&&(this._observer.disconnect(),this._observer=null)}_processEntry(e){var t,n;if(!this._isEnabled||(t=this.limitManager)!=null&&t.limitElementTimingEntry())return;let r=this.tracer.startSpan(e.identifier,{attributes:{[I]:`ux.element_timing`,"mxl.element_timing.identifier":e.identifier,"mxl.element_timing.element":(n=e.element)==null||(n=n.tagName)==null?void 0:n.toLowerCase(),"mxl.element_timing.render_time":e.renderTime,"mxl.element_timing.load_time":e.loadTime,"mxl.element_timing.start_time":e.startTime,"mxl.element_timing.url":e.url,"mxl.element_timing.natural_width":e.naturalWidth,"mxl.element_timing.natural_height":e.naturalHeight},startTime:this.perf.epochMillisFromOriginOffset(0)});e.loadTime>0&&r.addEvent(`load`,this.perf.epochMillisFromOriginOffset(e.loadTime)),r.end(this.perf.epochMillisFromOriginOffset(e.startTime))}};F();var mm=class extends G{constructor({diag:e,perf:t,rootNode:n,emptyCheckDelayMs:r=500}){super({config:{},diag:e,instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_observer`,void 0),P(this,`_emptyCheckDelayMs`,void 0),P(this,`_rootNode`,void 0),this._rootNode=n,this._emptyCheckDelayMs=r,this._observer=new MutationObserver((e,t)=>{this._observerCallback(e)}),this._config.enabled&&this._rootNode?this.enable():this._rootNode||this._diag.warn(`supplied root node was null, this instrumentation won't be enabled`)}onDisable(){this._observer.disconnect()}onEnable(){this._rootNode&&this._observer.observe(this._rootNode,{childList:!0})}_observerCallback(e){let t=!1,n=!1;for(let r of e)r.target===this._rootNode&&(r.removedNodes.length>0&&(t=!0),r.addedNodes.length>0&&(n=!0));t&&!n&&(this._diag.debug(`root node had child nodes removed without new ones being added, checking if it's empty in ${this._emptyCheckDelayMs}ms`),window.setTimeout(()=>{this._checkForEmptyRootNode()},this._emptyCheckDelayMs))}_checkForEmptyRootNode(){var e;if(((e=this._rootNode)==null?void 0:e.childNodes.length)===0){this._diag.debug(`root node was found to be empty`);let e=this.userSessionManager.getSessionPartSpan();e?e.addEvent(`empty-root-node`,{"mxl.type":`ux.empty_root_node`}):this._diag.debug(`no active session found to emit event on`)}}};F();var hm=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onErrorHandler`,void 0),P(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=e=>{this.logManager.logException(e.error||e.message,{handled:!1,handler:`global_exception`,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp)})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,handler:`promise_rejection`,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp)})},this._config.enabled&&this.enable()}onDisable(){window.removeEventListener(`error`,this._onErrorHandler),window.removeEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}onEnable(){window.addEventListener(`error`,this._onErrorHandler),window.addEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}};let gm=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},_m=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#${n.id}`:[gm(n),...Array.from(n.classList).sort()].join(`.`);if(t.length+r.length>99)return t||r;if(t=t?`${r}>${t}`:r,n.id)break;e=n.parentNode}}catch(e){}return t};H(),F();var vm=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`FirstInteractionInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onClick`,void 0),P(this,`_onKeyDown`,void 0),P(this,`_onScroll`,void 0),P(this,`_listenersAttached`,!1),this._onClick=e=>{this._handle({interactionType:e.pointerType===`touch`?`tap`:`click`,target:e.target instanceof Element?e.target:null,timestamp:e.timeStamp,x:e.clientX,y:e.clientY})},this._onKeyDown=e=>{this._handle({interactionType:`keypress`,target:e.target instanceof Element?e.target:null,timestamp:e.timeStamp})},this._onScroll=e=>{this._handle({interactionType:`scroll`,target:null,timestamp:e.timeStamp})},this._config.enabled&&this.enable()}onEnable(){this._attachListeners(),this.setSessionPartListeners({start:()=>{this._attachListeners()}})}onDisable(){this._detachListeners()}_handle(e){if(this._listenersAttached){this._detachListeners();try{this._emit(e)}catch(e){this._diag.error(`failed to process first-interaction candidate`,e)}}}_attachListeners(){if(this._listenersAttached)return;let e={capture:!0,passive:!0};document.addEventListener(`click`,this._onClick,e),document.addEventListener(`keydown`,this._onKeyDown,e),document.addEventListener(`scroll`,this._onScroll,e),this._listenersAttached=!0}_detachListeners(){if(!this._listenersAttached)return;let e={capture:!0};document.removeEventListener(`click`,this._onClick,e),document.removeEventListener(`keydown`,this._onKeyDown,e),document.removeEventListener(`scroll`,this._onScroll,e),this._listenersAttached=!1}_emit(e){let t=`document`,n=``;e.interactionType!==`scroll`&&e.target&&(t=e.target.tagName.toLowerCase(),n=_m(e.target));let r={[I]:`mxl.otel_log`,"first_interaction.interaction_type":e.interactionType,"first_interaction.element_type":t,"first_interaction.element_selector":n,"first_interaction.time":this.perf.millisFromZeroTime(e.timestamp)};e.x!==void 0&&e.y!==void 0&&(r[`first_interaction.x`]=e.x,r[`first_interaction.y`]=e.y),this.logger.emit({timestamp:this.perf.epochMillisFromOriginOffset(e.timestamp),eventName:`first-interaction`,severityNumber:V.INFO,attributes:r})}};let ym=()=>`mxlv2-${Date.now()}-${Math.floor(Math.random()*8999999999999)+0xe8d4a51000}`;H(),F();var bm=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`LoafInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_observer`,null),P(this,`_isFirstEntry`,!0),P(this,`_totalDuration`,0),P(this,`_workDuration`,0),P(this,`_styleLayoutDuration`,0),P(this,`_count`,0),P(this,`_longestDuration`,0),P(this,`_longestDurationExcludingFirst`,0),P(this,`_totalBlockingDuration`,0),P(this,`_scriptSummaries`,new Map),this._config.enabled&&this.enable()}onEnable(){if(!am(`long-animation-frame`)){this._isEnabled=!1,this._diag.debug(`long-animation-frame not supported, skipping`);return}if(this._observer&&this._observer.disconnect(),this._observer=om(`long-animation-frame`,e=>this._processEntry(e),{diag:this._diag}),!this._observer){this._isEnabled=!1,this._diag.error(`failed to enable`);return}this.setSessionPartListeners({end:()=>{try{this._flushReport()}catch(e){this._diag.error(`error flushing report`,e)}}})}onDisable(){this._resetAccumulators(),this._observer&&(this._observer.disconnect(),this._observer=null)}_processEntry(e){if(this._isEnabled){this._count++,this._totalDuration+=e.duration,this._workDuration+=e.renderStart?e.renderStart-e.startTime:e.duration,e.styleAndLayoutStart&&(this._styleLayoutDuration+=Math.max(0,e.startTime+e.duration-e.styleAndLayoutStart)),this._longestDuration=Math.max(this._longestDuration,e.duration),this._isFirstEntry&&this._count===1?this._isFirstEntry=!1:(this._longestDurationExcludingFirst=Math.max(this._longestDurationExcludingFirst,e.duration),e.firstUIEventTimestamp===0&&(this._totalBlockingDuration+=e.blockingDuration));try{for(let t of e.scripts){let e=t.sourceURL||`(inline)`;e.length>2048&&(e=`${e.substring(0,2048)}...`);let n=this._scriptSummaries.get(e);n?(n.totalDuration+=t.duration,n.styleAndLayoutDuration+=t.forcedStyleAndLayoutDuration,n.count++):this._scriptSummaries.set(e,{count:1,styleAndLayoutDuration:t.forcedStyleAndLayoutDuration,totalDuration:t.duration})}}catch(e){this._diag.error(`error processing scripts for entry`,e)}}}_flushReport(){if(this._count===0)return;let e;e=this._totalBlockingDuration<=200?`good`:this._totalBlockingDuration<=600?`needs-improvement`:`poor`;let t={[I]:`ux.web_vital`,"mxl.web_vital.id":ym(),"mxl.web_vital.name":`TBD`,"mxl.web_vital.value":Math.round(this._totalBlockingDuration),"mxl.web_vital.rating":e,"mxl.tbd.loaf_total_duration":Math.round(this._totalDuration),"mxl.tbd.loaf_work_duration":Math.round(this._workDuration),"mxl.tbd.loaf_style_and_layout_duration":Math.round(this._styleLayoutDuration),"mxl.tbd.loaf_count":this._count,"mxl.tbd.loaf_longest_duration":Math.round(this._longestDuration),"mxl.tbd.loaf_longest_duration_excluding_first":Math.round(this._longestDurationExcludingFirst)};try{this.logger.emit({attributes:t,eventName:`mxl-loaf-report`,severityNumber:V.INFO})}catch(e){this._diag.error(`error emitting loaf report`,e)}try{if(this._scriptSummaries.size>0){let e=[...this._scriptSummaries].sort((e,t)=>t[1].totalDuration-e[1].totalDuration).slice(0,250).map(([e,t])=>[e,{count:t.count,style_and_layout_duration:Math.round(t.styleAndLayoutDuration),total_duration:Math.round(t.totalDuration)}]);this.logger.emit({attributes:{[I]:`ux.loaf_scripts`},body:JSON.stringify(Object.fromEntries(e)),eventName:`mxl-loaf-scripts`,severityNumber:V.INFO})}}catch(e){this._diag.error(`error emitting loaf script summary`,e)}this._resetAccumulators()}_resetAccumulators(){this._totalDuration=0,this._workDuration=0,this._styleLayoutDuration=0,this._count=0,this._longestDuration=0,this._longestDurationExcludingFirst=0,this._totalBlockingDuration=0,this._scriptSummaries=new Map}};let xm=(e=document)=>{var t,n;let r=e.defaultView;if(!r)return null;let i=e.scrollingElement,a=i==null?e.documentElement:i;if(!a)return null;let o=a.scrollHeight,s=a.scrollWidth,c=(t=i==null?void 0:i.clientHeight)==null?r.innerHeight:t,l=(n=i==null?void 0:i.clientWidth)==null?r.innerWidth:n;return!o||!s||!c||!l?null:{documentHeight:o,documentWidth:s,scrollableHeight:Math.max(0,o-c),viewportHeight:c,viewportWidth:l}};H(),F(),W();var Sm=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`MaxScrollDepthInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onScrollHandler`,void 0),P(this,`_hasScrolled`,!1),P(this,`_maxScrollY`,0),this._onScrollHandler=()=>{try{let e=window.scrollY;e>this._maxScrollY&&(this._maxScrollY=e),this._hasScrolled=!0}catch(e){this._diag.error(`failed to process scroll`,e)}},this._config.enabled&&this.enable()}onEnable(){this._resetTracking(null),window.addEventListener(`scroll`,this._onScrollHandler,{passive:!0}),this.setSessionPartListeners({end:()=>{try{this._emit()}catch(e){this._diag.error(`failed to emit max-scroll-depth log`,e)}}})}onDisable(){window.removeEventListener(`scroll`,this._onScrollHandler)}_emit(){let e=null;try{this._maxScrollY=Math.max(this._maxScrollY,window.scrollY),e=xm();let t=e?this._scrollPercent(e):void 0;e&&t!==void 0&&(this._maxScrollY=Math.min(this._maxScrollY,e.scrollableHeight)),this.logger.emit({eventName:`max-scroll-depth`,severityNumber:V.INFO,attributes:U({[I]:`mxl.otel_log`,"max_scroll_depth.pixels":this._maxScrollY,"max_scroll_depth.did_scroll":this._hasScrolled},e?U(U({},t===void 0?{}:{"max_scroll_depth.percent":t}),{},{"max_scroll_depth.document_height":e.documentHeight}):{})})}finally{this._resetTracking(e)}}_resetTracking(e){let t=window.scrollY;this._maxScrollY=e?Math.max(0,Math.min(t,e.scrollableHeight)):Math.max(0,t),this._hasScrolled=!1}_scrollPercent({documentHeight:e,scrollableHeight:t}){let n=t===0?0:e;if(this._maxScrollY>n){this._diag.debug(`omitting max-scroll-depth percent, range is stale: reached ${String(this._maxScrollY)} past a bound of ${String(n)}`);return}return t===0?0:Math.min(100,Math.round(this._maxScrollY/t*100))}};H(),F();var Cm=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`RageClickInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onClickHandler`,void 0),P(this,`_eventWindow`,null),this._onClickHandler=e=>{try{this._handleClick(e)}catch(e){this._diag.error(`failed to process rage-click candidate`,e)}},this._config.enabled&&this.enable()}onDisable(){document.removeEventListener(`click`,this._onClickHandler),this._flush()}onEnable(){document.addEventListener(`click`,this._onClickHandler)}_handleClick(e){if(!(e.target instanceof Element))return;let t=e.target,n=e instanceof PointerEvent&&e.pointerType===`touch`?`tap`:`click`;if(this._eventWindow===null){this._eventWindow={target:t,x:e.clientX,y:e.clientY,count:1,interactionType:n,timestamp:e.timeStamp,timeoutId:window.setTimeout(()=>{try{this._flush()}catch(e){this._diag.error(`failed to emit rage-click log`,e)}},500)};return}let r=t===this._eventWindow.target,i=Math.abs(e.clientX-this._eventWindow.x),a=Math.abs(e.clientY-this._eventWindow.y);(r||i<=50&&a<=50)&&(this._eventWindow.count+=1)}_flush(){if(this._eventWindow===null)return;let e=this._eventWindow;window.clearTimeout(e.timeoutId),this._eventWindow=null,!(e.count<3)&&this.logger.emit({timestamp:this.perf.epochMillisFromOriginOffset(e.timestamp),eventName:`rage-click`,severityNumber:V.INFO,attributes:{[I]:`mxl.otel_log`,"rage_click.element_type":e.target.tagName.toLowerCase(),"rage_click.element_selector":_m(e.target),"rage_click.x":e.x,"rage_click.y":e.y,"rage_click.count":e.count,"rage_click.interaction_type":e.interactionType}})}};H(),F();var wm=class extends G{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ServerTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_navigationObserver`,null),P(this,`_performanceCollected`,!1),this._config.enabled&&this.enable()}_disconnectObserver(){var e;(e=this._navigationObserver)==null||e.disconnect(),this._navigationObserver=null}onEnable(){this._performanceCollected||(this._navigationObserver=om(`navigation`,()=>{this._disconnectObserver(),this._readServerTiming()},{diag:this._diag}),this._navigationObserver||this._diag.warn(`navigation entries are not observable, server timings will not be collected`))}onDisable(){this._disconnectObserver()}_readServerTiming(){var e,t;if(this._performanceCollected)return;this._performanceCollected=!0;let n=(e=(t=performance.getEntriesByType(`navigation`)[0])==null?void 0:t.serverTiming)==null?[]:e;for(let e of n){var r;if((r=this.limitManager)!=null&&r.limitServerTimingEntry())return;this.logger.emit({attributes:{[I]:`ux.server_timing`,"mxl.server_timing.name":e.name,"mxl.server_timing.duration":e.duration,"mxl.server_timing.description":e.description},eventName:`mxl-server-timing`,severityNumber:V.INFO})}}};F(),W();function Tm(e,t){return t.startTime<=e&&e<=t.startTime+t.duration?t:null}var Em=class extends G{constructor({diag:e,perf:t,limitManager:n,navigationHost:r=window,signalBuffer:i}={}){super({config:{},diag:e,instrumentationName:`SoftNavigationPerformanceInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_observer`,null),P(this,`_eventObserver`,null),P(this,`_pendingNavigations`,[]),P(this,`_usePolyfill`,!1),P(this,`_navigationHost`,void 0),P(this,`_signalBuffer`,void 0),P(this,`_handleCurrentEntryChange`,e=>{var t;let n=(t=this._navigationHost.navigation)==null||(t=t.currentEntry)==null?void 0:t.url;if(!n){this._diag.debug(`currententrychange fired with no URL, skipping`);return}this._pendingNavigations.push({timestamp:e.timeStamp,url:n})}),this._navigationHost=r,this._signalBuffer=i,this._config.enabled&&this.enable()}enable(){am(`soft-navigation`)?(this._usePolyfill=!1,super.enable()):this._navigationHost.navigation&&am(`event`)?(this._usePolyfill=!0,super.enable()):this._diag.debug(`soft-navigation and navigation API not supported, skipping`)}onEnable(){this._usePolyfill?this._enablePolyfill():this._enableNative()}_enableNative(){this._observer&&this._observer.disconnect(),this._observer=om(`soft-navigation`,e=>this._processEntry(e),{diag:this._diag}),this._observer||(this._isEnabled=!1,this._diag.error(`failed to enable`))}_enablePolyfill(){this._eventObserver&&this._eventObserver.disconnect();let e=this._navigationHost.navigation;if(!e){this._isEnabled=!1,this._diag.error(`failed to enable polyfill`);return}if(e.addEventListener(`currententrychange`,this._handleCurrentEntryChange),this._eventObserver=om(`event`,e=>this._processClickEntry(e),{diag:this._diag,durationThreshold:16}),!this._eventObserver){var t;(t=e.removeEventListener)==null||t.call(e,`currententrychange`,this._handleCurrentEntryChange),this._isEnabled=!1,this._diag.error(`failed to enable polyfill`)}}onDisable(){var e,t;this._observer&&(this._observer.disconnect(),this._observer=null),this._eventObserver&&(this._eventObserver.disconnect(),this._eventObserver=null),(e=this._navigationHost.navigation)==null||(t=e.removeEventListener)==null||t.call(e,`currententrychange`,this._handleCurrentEntryChange),this._pendingNavigations.length=0}_correlationAttributes(e,t){if(!this._signalBuffer)return{};let{spanIds:n,spanTypes:r,logIds:i,logTypes:a}=this._signalBuffer.collectWindow(e,t);return{"mxl.soft_navigation.span_ids":n,"mxl.soft_navigation.span_id_types":r,"mxl.soft_navigation.log_ids":i,"mxl.soft_navigation.log_id_types":a}}_processEntry(e){var t;if(!this._isEnabled||(t=this.limitManager)!=null&&t.limitSoftNavigationEntry())return;let n=this.perf.epochMillisFromOriginOffset(e.startTime),r=this.perf.epochMillisFromOriginOffset(e.startTime+e.duration);this.tracer.startSpan(Ef,{startTime:n,attributes:U({[tr]:e.name,[Df]:jf.performanceObserver,"mxl.soft_navigation.navigation_id":e.navigationId,[Of]:e.interactionId,[kf]:this.perf.millisFromZeroTime(e.startTime),[Af]:e.duration,"mxl.soft_navigation.paint_time":e.paintTime==null?void 0:this.perf.millisFromZeroTime(e.paintTime),"mxl.soft_navigation.presentation_time":e.presentationTime==null?void 0:this.perf.millisFromZeroTime(e.presentationTime)},this._correlationAttributes(n,r))}).end(r)}_processClickEntry(e){if(!this._isEnabled||e.name!==`click`)return;this._pendingNavigations=this._pendingNavigations.filter(({timestamp:t})=>e.startTime-t<6e4);let t=this._pendingNavigations.findIndex(({timestamp:t})=>Tm(t,e)!==null);if(t===-1)return;let[n]=this._pendingNavigations.splice(t,1);this._emitPolyfillSpan(e,n.timestamp,n.url)}_emitPolyfillSpan(e,t,n){var r;if(!this._isEnabled||(r=this.limitManager)!=null&&r.limitSoftNavigationEntry())return;let i=this.perf.epochMillisFromOriginOffset(e.startTime),a=this.perf.epochMillisFromOriginOffset(t);this.tracer.startSpan(Ef,{startTime:i,attributes:U({[tr]:n,[Df]:jf.polyfill,[kf]:this.perf.millisFromZeroTime(e.startTime),[Af]:t-e.startTime,[Of]:e.interactionId===0?void 0:e.interactionId},this._correlationAttributes(i,a))}).end(a)}};let Dm=`mxl.user_timing.start_time`,Om=`mxl.user_timing.duration`,km=`mxl.user_timing.entry_type`;H(),F(),W();var Am=class extends G{constructor({diag:e,perf:t,limitManager:n,allowedEntries:r}={}){super({config:{},diag:e,instrumentationName:`UserTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_markObserver`,null),P(this,`_measureObserver`,null),P(this,`_seenEntries`,new Set),P(this,`_allowedEntries`,void 0),this._allowedEntries=r,this._config.enabled&&this.enable()}onEnable(){this._seenEntries=new Set,this._markObserver&&this._markObserver.disconnect(),this._measureObserver&&this._measureObserver.disconnect(),this._markObserver=om(`mark`,this._processEntry.bind(this),{diag:this._diag}),this._markObserver||this._diag.error(`failed to enable mark observer`),this._measureObserver=om(`measure`,e=>this._processEntry(e),{diag:this._diag}),this._measureObserver||this._diag.error(`failed to enable measure observer`),!this._markObserver&&!this._measureObserver&&(this._isEnabled=!1)}onDisable(){this._markObserver&&(this._markObserver.disconnect(),this._markObserver=null),this._measureObserver&&(this._measureObserver.disconnect(),this._measureObserver=null),this._seenEntries=new Set}_processEntry(e){var t;if(!this._isEnabled||this._allowedEntries!==void 0&&!(Array.isArray(this._allowedEntries)?this._allowedEntries.includes(e.name):this._allowedEntries(e)))return;let n=`${location.href}::${e.name}`;if(this._seenEntries.has(n)||(this._seenEntries.add(n),(t=this.limitManager)!=null&&t.limitUserTimingEntry(e.entryType)))return;if(e.entryType===`measure`){let t=e.detail;this.tracer.startSpan(e.name,{attributes:U({[I]:`ux.user_timing`,[$n]:`user_timing`,[km]:e.entryType,[Dm]:this.perf.millisFromZeroTime(e.startTime),[Om]:e.duration},t!=null&&{"mxl.user_timing.detail":JSON.stringify(t)}),startTime:this.perf.epochMillisFromOriginOffset(e.startTime)}).end(this.perf.epochMillisFromOriginOffset(e.startTime+e.duration));return}let{detail:r}=e,i=r==null?void 0:JSON.stringify(r);this.logger.emit({attributes:{[I]:`ux.user_timing`,"mxl.user_timing.name":e.name,[Dm]:this.perf.millisFromZeroTime(e.startTime),[Om]:e.duration,[km]:e.entryType},body:i,eventName:`mxl-user-timing`,severityNumber:V.INFO,timestamp:this.perf.epochMillisFromOriginOffset(e.startTime)})}};let jm=`mxl.web_vital.attribution.`;F(),W();var Mm=class{constructor(){P(this,`t`,void 0),P(this,`o`,0),P(this,`i`,[])}l(e){var t;if(e.hadRecentInput)return;let n=this.i[0],r=this.i.at(-1);this.o&&n&&r&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),(t=this.t)==null||t.call(this,e)}};let Nm=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Pm=e=>{if(document.readyState===`loading`)return`loading`;let t=Nm();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`},Fm=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},Im=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){var n;let r=e,i=r.id?`#`+r.id:[Fm(r),...Array.from((n=r.classList)==null?[]:n).sort()].join(`.`);if(t.length+i.length>99)return t||i;if(t=t?i+`>`+t:i,r.id)break;e=r.parentNode}}catch(e){}return t},Lm=new WeakMap;function Rm(e,t){let n=Lm.get(t);return n||(n=new WeakMap,Lm.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}let zm=-1,Bm=()=>zm,Vm=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(zm=t.timeStamp,e(t))},!0)},Q=(e,t,n,r)=>{let i,a;return o=>{var s;t.value>=0&&(o||r)&&(a=t.value-((s=i)==null?0:s),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},Hm=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Um=()=>{var e,t;return(e=(t=Nm())==null?void 0:t.activationStart)==null?0:e},Wm=-1,Gm=new Set,Km=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,qm=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of Gm)e();isFinite(Wm)||(Wm=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,qm,!0))}},Jm=(e=!1)=>{if(e&&(Wm=1/0),Wm<0){var t;let e=Um(),n=document.prerendering||(t=globalThis.performance.getEntriesByType(`visibility-state`).find(t=>t.name===`hidden`&&t.startTime>=e))==null?void 0:t.startTime;Wm=n==null?Km():n,addEventListener(`visibilitychange`,qm,!0),addEventListener(`prerenderingchange`,qm,!0),Vm(()=>{setTimeout(()=>{Wm=Km()})})}return{get firstHiddenTime(){return Wm},onHidden(e){Gm.add(e)}}},$=(e,t=-1,n,r=0,i,a,o)=>{let s=Nm(),c=(s==null?void 0:s.navigationId)||0,l=`navigate`;return n?l=n:Bm()>=0?l=`back-forward-cache`:s&&(document.prerendering||Um()>0?l=`prerender`:document.wasDiscarded?l=`restore`:s.type&&(l=s.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:l,navigationId:r||c,navigationInteractionId:i,navigationURL:a||(s==null?void 0:s.name),navigationStartTime:o||0}},Ym=(e,t,n={})=>{try{let r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){let e=new PerformanceObserver(e=>{queueMicrotask(()=>{let n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(let t of r)e.observe(U({type:t,buffered:!0},n));return e}}catch(e){}},Xm=e=>{var t,n;return((t=globalThis.PerformanceObserver)==null||(t=t.supportedEntryTypes)==null?void 0:t.includes(`soft-navigation`))&&typeof((n=globalThis.PerformanceSoftNavigation)==null||(n=n.prototype)==null?void 0:n.getLargestInteractionContentfulPaint)==`function`&&e&&e.reportSoftNavs},Zm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let t=e.keys().next().value;t!==void 0&&e.delete(t)}},Qm=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var $m=class{constructor(){P(this,`u`,void 0)}};let eh=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},th=[1800,3e3],nh=(e,t={})=>{let n=Xm(t);eh(()=>{let r=Rm(t,$m),i=Jm(),a,o=$(`FCP`),s=Ym([`paint`],e=>{for(let t of e)t.name===`first-contentful-paint`&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(o.value=Math.max(t.startTime-Um(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,a(!0)))});s&&(a=Q(e,o,th,t.reportAllChanges),Vm(n=>{o=$(`FCP`,-1,`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,Bm()),a=Q(e,o,th,t.reportAllChanges),Hm(()=>{o.value=performance.now()-n.timeStamp,a(!0)})})),n&&Ym([`soft-navigation`],n=>{n.forEach(n=>{r.u&&n.navigationId&&Zm(r.u,n),o=$(`FCP`,Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0),`soft-navigation`,n.navigationId,n.interactionId,n.name,n.startTime),a=Q(e,o,th,t.reportAllChanges),a(!0)})},t)})},rh=[.1,.25],ih=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],ah=(e,t={})=>{let n=Rm(t=Object.assign({},t),Mm),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=ih(e.sources),o=n==null?void 0:n.node;if(o){var i,a;let e=(i=(a=t.generateTarget)==null?void 0:a.call(t,o))==null?Im(o):i;r.set(n,e)}}},((e,t={})=>{let n=Jm();nh(Qm(()=>{let r,i=$(`CLS`,0),a=Rm(t,Mm),o=(n,o,s,c,l)=>{i=$(`CLS`,0,n,o,s,c,l),a.o=0,r=Q(e,i,rh,t.reportAllChanges)},s=(e=!1)=>{a.o>i.value&&(i.value=a.o,i.entries=a.i),r(e)},c=e=>{s(!0),o(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime)},l=e=>{for(let t of e)t.entryType===`soft-navigation`?c(t):a.l(t);s()},u=[`layout-shift`];Xm(t)&&u.push(`soft-navigation`);let d=Ym(u,l);d&&(r=Q(e,i,rh,t.reportAllChanges),n.onHidden(()=>{l(d.takeRecords()),r(!0)}),Vm(()=>{o(`back-forward-cache`,i.navigationId,i.navigationInteractionId,i.navigationURL,Bm()),Hm(r)}),setTimeout(r))}))})(t=>{e((e=>{let t={};if(e.entries.length){var n;let i=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(!(i==null||(n=i.sources)==null)&&n.length){let e=ih(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:Pm(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},oh=(e,t={})=>{let n=Rm(t=Object.assign({},t),$m);Xm(t)&&(n.u=new Map),nh(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Pm(Bm())};if(e.navigationType!==`soft-navigation`){if(e.entries.length){let n=Nm(),r=e.entries.at(-1);if(n){let i=n.responseStart,a=n.activationStart||0,o=Math.max(0,i-a);t={timeToFirstByte:o,firstByteToFCP:e.value-o,loadState:Pm(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}}else{var r;let i=(r=n.u)==null?void 0:r.get(e.navigationId);i&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:`complete`,navigationEntry:i})}return Object.assign(e,{attribution:t})})(t))},t)},sh=0,ch=1/0,lh=0,uh=e=>{for(let t of e)t.interactionId&&(ch=Math.min(ch,t.interactionId),lh=Math.max(lh,t.interactionId),sh=lh?(lh-ch)/7+1:0)},dh,fh=()=>{var e;return dh?sh:(e=performance.interactionCount)==null?0:e},ph=()=>{`interactionCount`in performance||dh||(dh=Ym([`event`],uh,{durationThreshold:0}))};var mh=class{constructor(){P(this,`h`,0),P(this,`v`,[]),P(this,`p`,new Map),P(this,`m`,void 0),P(this,`M`,void 0)}T(){return fh()-this.h}D(){this.h=fh(),this.v.length=0,this.p.clear()}S(e){let t=this.T(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||n!==-1||e!==`soft-navigation`&&e!==`back-forward-cache`?this.v[n]:{k:8,id:-1,entries:[]}}l(e){var t;if((t=this.m)==null||t.call(this,e),!e.interactionId)return;let n=this.v.at(-1),r=this.p.get(e.interactionId);if(r||this.v.length<10||e.duration>n.k){var i;if(r?e.duration>r.k?(r.entries=[e],r.k=e.duration):e.duration===r.k&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],k:e.duration},this.p.set(r.id,r),this.v.push(r)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10){let e=this.v.splice(10);for(let t of e)this.p.delete(t.id)}(i=this.M)==null||i.call(this,r)}}};let hh=e=>{let t=`requestIdleCallback`in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let i=Qm(e),a=-1,o=()=>{r(a),i()};addEventListener(`visibilitychange`,o,{once:!0,capture:!0}),a=n(()=>{removeEventListener(`visibilitychange`,o,{capture:!0}),i()},{timeout:t})}},gh=[200,500],_h=(e,t={})=>{let n=Rm(t=Object.assign({},t),mh),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(hh(u),c=!0)},u=()=>{let e=new Set(n.v.map(e=>o.get(e.entries[0]))),t=i.length-10;i=i.filter((n,r)=>r>=t||e.has(n));let s=new Set;for(let e of i){let t=d(e.startTime,e.processingEnd);for(let e of t)s.add(e)}let l=r.length-10;r=r.filter((e,t)=>s.has(e)||t>=l&&e.startTime>a),c=!1};n.m=e=>{let n=e.startTime+e.duration,r;a=Math.max(a,e.processingEnd);for(let a=i.length-1;a>=0;a--){let o=i[a];if(Math.abs(n-o.renderTime)<=8){r=o,r.startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),t.includeProcessedEventEntries&&r.entries.push(e);break}}r||(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:t.includeProcessedEventEntries?[e]:[]},i.push(r)),e.interactionId&&o.set(e,r),l()},n.M=e=>{if(!s.get(e)){var n;let o=(n=e.entries.find(e=>e.target))==null?void 0:n.target;if(o){var r,i;let n=(r=(i=t.generateTarget)==null?void 0:i.call(t,o))==null?Im(o):r;s.set(e,n)}else{var a;let t=(a=e.entries.find(e=>e.targetSelector))==null?void 0:a.targetSelector;t&&s.set(e,t)}}};let d=(e,t)=>{let n=[];for(let i of r)if(!(i.startTime+i.duration<e)){if(i.startTime>t)break;n.push(i)}return n},f=e=>{if(e.entries.length===0){let t=e.navigationStartTime||0,n={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:Pm(t)};return Object.assign(e,{attribution:n})}let t=e.entries[0],r=o.get(t),i=Math.max(r.processingStart,t.startTime),a=Math.max(t.startTime+t.duration,i),c=Math.min(r.processingEnd,a),l=r.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,c),f=n.p.get(t.interactionId),p={interactionTarget:s.get(f),interactionType:t.name.startsWith(`key`)?`keyboard`:`pointer`,interactionTime:t.startTime,nextPaintTime:a,processedEventEntries:l,longAnimationFrameEntries:u,inputDelay:i-t.startTime,processingDuration:c-i,presentationDelay:a-c,loadState:Pm(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;let n=e.interactionTime,r=e.nextPaintTime;if(!((t=e.longAnimationFrameEntries)!=null&&t.length)||!n||!r)return;let i=e.inputDelay,a=e.processingDuration,o,s,c=0,l=0,u=0,d=0;for(let t of e.longAnimationFrameEntries){l=l+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let r=t-Math.max(n,e.startTime),u=e.duration?r/e.duration*e.forcedStyleAndLayoutDuration:0;c+=r-u,l+=u,r>d&&(s=e.startTime<n+i?`input-delay`:e.startTime>=n+i+a?`presentation-delay`:`processing-duration`,o=e,d=r)}}let f=e.longAnimationFrameEntries.at(-1),p=f?f.startTime+f.duration:0;p>=n+i+a&&(u=r-p),o&&s&&(e.longestScript={entry:o,subpart:s,intersectingDuration:d}),e.totalScriptDuration=c,e.totalStyleAndLayoutDuration=l,e.totalPaintDuration=u,e.totalUnattributedDuration=r-n-c-l-u})(p),Object.assign(e,{attribution:p})};Ym([`long-animation-frame`],e=>{r=r.concat(e),l()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=Jm();eh(()=>{var r;ph();let i,a=$(`INP`),o=Rm(t,mh),s=(n,r,s,c,l)=>{o.D(),a=$(`INP`,-1,n,r,s,c,l),i=Q(e,a,gh,t.reportAllChanges)},c=()=>{let e=o.S(a.navigationType);e&&e.k!==a.value&&(a.value=e.k,a.entries=e.entries,i())},l=e=>{c(),i(!0),s(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{hh(()=>{for(let t of e)t.entryType===`soft-navigation`?l(t):o.l(t);c(),t&&i(!0)})},d=[`event`,`first-input`];Xm(t)&&d.push(`soft-navigation`);let f=Ym(d,u,U(U({},t),{},{durationThreshold:(r=t.durationThreshold)==null?40:r}));i=Q(e,a,gh,t.reportAllChanges),f&&(n.onHidden(()=>{u(f.takeRecords(),!0)}),Vm(()=>{s(`back-forward-cache`,a.navigationId,a.navigationInteractionId,a.navigationURL,Bm())}))})})(t=>{e(f(t))},t)};var vh=class{constructor(){P(this,`m`,void 0),P(this,`u`,void 0)}l(e){var t;(t=this.m)==null||t.call(this,e)}};let yh=[2500,4e3],bh=50,xh=[];Ym([`resource`],e=>{for(let t of e)xh.push(t),xh.length>bh&&xh.shift()});let Sh=(e,t={})=>{(t=Object.assign({},t)).resourceBufferSize!=null&&(bh=t.resourceBufferSize);let n=Rm(t,vh),r=new WeakMap;Xm(t)&&(n.u=new Map),n.m=e=>{let n=e.element;if(n){var i,a;let o=(i=(a=t.generateTarget)==null?void 0:a.call(t,n))==null?Im(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{let n=!1,r=Xm(t);eh(()=>{let i,a=Jm(),o=$(`LCP`),s=Rm(t,vh),c=(r,s,c,l,u)=>{o=$(`LCP`,-1,r,s,c,l,u),i=Q(e,o,yh,t.reportAllChanges),n=!1,r===`soft-navigation`&&(a=Jm(!0))},l=e=>{var t;s.u&&e.navigationId&&Zm(s.u,e),n||i(!0),c(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime);let r=(t=e.getLargestInteractionContentfulPaint)==null?void 0:t.call(e);r&&u([r])},u=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(let t of e){if(!t)continue;if(t.entryType===`soft-navigation`){l(t);continue}let e=0,r=[],c=t.startTime;if(t.entryType===`largest-contentful-paint`)e=Math.max(t.startTime-Um(),0),s.l(t),r=[t];else if(t.entryType===`interaction-contentful-paint`){var n;let i=t;if(!o.navigationId||`interactionId`in i&&i.interactionId!=o.navigationInteractionId)continue;c=((n=i.largestContentfulPaint)==null?void 0:n.renderTime)||0,e=Math.max(c-t.startTime,0),i.largestContentfulPaint&&(s.l(i.largestContentfulPaint),r=[i.largestContentfulPaint])}c<a.firstHiddenTime&&(o.value=e,o.entries=r,i())}},d=[`largest-contentful-paint`];r&&d.push(`interaction-contentful-paint`,`soft-navigation`);let f=Ym(d,u);if(f){i=Q(e,o,yh,t.reportAllChanges);let a=[`keydown`,`click`,`visibilitychange`],s=e=>{if(e.isTrusted&&!n){let e=o.id;hh(()=>{if(!n){if(!r){f.disconnect();for(let e of a)removeEventListener(e,s,{capture:!0})}e===o.id&&(n=!0,i(!0))}})}};for(let e of a)addEventListener(e,s,{capture:!0});Vm(r=>{c(`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,Bm()),i=Q(e,o,yh,t.reportAllChanges),Hm(()=>{o.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var i,a,o;let s=e.entries.at(-1),c=s.url&&(xh.findLast(e=>e.name===s.url)||performance.getEntriesByType(`resource`).findLast(e=>e.name===s.url)),l;t.target=r.get(s),t.lcpEntry=s,s.url&&(t.url=s.url),c&&(t.lcpResourceEntry=c);let u=0,d=0;if(e.navigationType===`soft-navigation`?(u=e.navigationStartTime||0,l=(o=n.u)==null?void 0:o.get(e.navigationId)):(l=Nm(),u=(i=l==null?void 0:l.activationStart)==null?0:i,d=(a=l==null?void 0:l.responseStart)==null?0:a),l){let n=Math.max(0,d-u),r=Math.max(n,c?(c.requestStart||c.startTime)-u:0),i=Math.min(e.value,Math.max(r,c?c.responseEnd-u:0));t=U(U({},t),{},{timeToFirstByte:n,resourceLoadDelay:r-n,resourceLoadDuration:i-r,elementRenderDelay:e.value-i,navigationEntry:l})}}return Object.assign(e,{attribution:t})})(t))},t)},Ch=[800,1800],wh=e=>{document.prerendering?eh(()=>wh(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>wh(e),!0)},Th=(e,t={})=>{((e,t={})=>{let n=Xm(t),r=$(`TTFB`),i=Q(e,r,Ch,t.reportAllChanges);wh(()=>{let a=Nm();if(a){let o=a.responseStart;r.value=Math.max(o-Um(),0),r.entries=[a],i(!0),Vm(()=>{r=$(`TTFB`,0,`back-forward-cache`,r.navigationId,r.navigationInteractionId,r.navigationURL,Bm()),i=Q(e,r,Ch,t.reportAllChanges),i(!0)}),n&&Ym([`soft-navigation`],n=>{n.forEach(n=>{n.navigationId&&(r=$(`TTFB`,0,`soft-navigation`,n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Q(e,r,Ch,t.reportAllChanges),i(!0))})},t)}})})(t=>{e((e=>{let t=e.entries[0],n={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0,navigationEntry:t};if(e.entries.length&&t instanceof PerformanceNavigationTiming){let r=t.activationStart||0,i=Math.max((t.workerStart||t.fetchStart||0)-r,0),a=Math.max(t.domainLookupStart-r,0),o=Math.max(t.connectStart-r,0),s=Math.max(t.connectEnd-r,0);n={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:t}}return Object.assign(e,{attribution:n})})(t))},t)},Eh=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],Dh={CLS:ah,FCP:oh,LCP:Sh,INP:_h,TTFB:Th,FID:void 0};H(),B(),_s(),F(),W();let Oh=[`diag`,`perf`,`listeners`,`urlDocument`,`urlAttribution`,`includeRawAttribution`,`reportSoftNavs`,`pageManager`,`applyCustomLogRecordData`],kh=e=>Math.round(Math.max(0,e)),Ah=e=>{var t,n,r,i;return{x:Math.round((t=e==null?void 0:e.x)==null?0:t),y:Math.round((n=e==null?void 0:e.y)==null?0:n),width:Math.round((r=e==null?void 0:e.width)==null?0:r),height:Math.round((i=e==null?void 0:e.height)==null?0:i)}},jh=e=>{let t=typeof e;return t===`number`||t===`string`||t===`boolean`},Mh=(e,t)=>{let n={},r=e.attribution;try{if(r.longAnimationFrameEntries.length>0){let e=new Map;for(let t of r.longAnimationFrameEntries)for(let n of t.scripts){let t=n.sourceURL||`(inline)`;t.length>2048&&(t=`${t.substring(0,2048)}...`);let r=e.get(t);r?(r.totalDuration+=n.duration,r.styleAndLayoutDuration+=n.forcedStyleAndLayoutDuration,r.count++):e.set(t,{count:1,styleAndLayoutDuration:n.forcedStyleAndLayoutDuration,totalDuration:n.duration})}e.size>0&&(n[`${jm}loaf_scripts`]=JSON.stringify(Object.fromEntries([...e].sort((e,t)=>t[1].totalDuration-e[1].totalDuration).slice(0,250).map(([e,t])=>[e,{count:t.count,style_and_layout_duration:Math.round(t.styleAndLayoutDuration),total_duration:Math.round(t.totalDuration)}]))))}}catch(e){t.error(`error building loaf scripts for INP`,e)}return n},Nh=(e,t)=>{let n={};try{let t=e.entries;if(t.length>0){let e=t.slice(0,50).map(e=>{var t;let n=e.sources[0];return{selector:_m((t=n==null?void 0:n.node)==null?null:t),startRect:Ah(n==null?void 0:n.previousRect),endRect:Ah(n==null?void 0:n.currentRect)}}),r=jm;n[`${r}clsLayoutShifts`]=JSON.stringify(e),t.length>50&&(n[`${r}clsLayoutShiftsDroppedCount`]=t.length-50)}}catch(e){t.error(`error building CLS layout shifts`,e)}return n},Ph=(e,t)=>{let n={};try{var r,i;let t=(r=e.entries.find(e=>e.target))==null?void 0:r.target,a=t==null||(i=t.tagName)==null?void 0:i.toLowerCase();a&&(n[`${jm}element_type`]=a)}catch(e){t.error(`error building INP element type attribution`,e)}return n},Fh=(e,t)=>{let n={},r=e.attribution.navigationEntry;if(r)try{var i;let e=kh(r.redirectEnd-r.redirectStart),t=kh(r.domainLookupEnd-r.domainLookupStart),a=kh(r.secureConnectionStart>0?r.secureConnectionStart-r.connectStart:r.connectEnd-r.connectStart),o=kh(r.secureConnectionStart>0?r.connectEnd-r.secureConnectionStart:0),s=kh(Math.max((i=r.finalResponseHeadersStart)==null?0:i,r.responseStart)-r.requestStart),c=kh(Math.round(r.responseEnd-r.startTime)-e-t-a-o-s),l=jm;n[`${l}redirect`]=e,n[`${l}domainLookup`]=t,n[`${l}tcpConnection`]=a,n[`${l}tlsNegotiation`]=o,n[`${l}serverResponse`]=s,n[`${l}unattributed`]=c}catch(e){t.error(`error computing TTFB timing breakdown`,e)}else t.debug(`TTFB navigationEntry unavailable, skipping timing breakdown`);return n},Ih=(e,t)=>{let n={};try{var r;let t=(r=e.attribution.lcpEntry)==null?void 0:r.element;if(t){let e=t.tagName.toLowerCase(),r=JSON.stringify(Ah(t.getBoundingClientRect())),i=jm;n[`${i}elementType`]=e,n[`${i}elementBoundingRect`]=r}}catch(e){t.error(`error building LCP element attribution`,e)}return n};var Lh=class extends G{constructor(e={}){let{diag:t,perf:n,listeners:r=Dh,urlDocument:i,urlAttribution:a=!0,includeRawAttribution:o=!0,reportSoftNavs:s=!0,pageManager:c,applyCustomLogRecordData:l}=e,u=Uo(e,Oh);super({config:u,diag:t,instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,perf:n}),P(this,`_listeners`,void 0),P(this,`_urlDocument`,void 0),P(this,`_urlAttribution`,void 0),P(this,`_includeRawAttribution`,void 0),P(this,`_softNavsActive`,void 0),P(this,`_pageManager`,void 0),P(this,`_attributedPage`,{CLS:void 0,FCP:void 0,INP:void 0,LCP:void 0,TTFB:void 0}),P(this,`_largestShiftTargetForCLS`,null),P(this,`_clsMetricId`,void 0),P(this,`_applyCustomLogRecordData`,void 0),P(this,`_listenersRegistered`,!1),this._listeners=r,this._urlDocument=i==null?window.document:i,this._urlAttribution=a,this._includeRawAttribution=o,this._softNavsActive=s&&am(`soft-navigation`),this._pageManager=c==null?On.getPageManager():c,this._applyCustomLogRecordData=l,this._config.enabled!==!1&&this.enable()}enable(){typeof PerformanceObserver<`u`?super.enable():this._diag.debug(`PerformanceObserver not supported, web vitals will not be collected`)}onDisable(){this._diag.debug(`WebVitalsInstrumentation disabled, pausing emission`)}onEnable(){if(this._listenersRegistered){this._diag.debug(`WebVitalsInstrumentation listeners already registered, resuming emission`);return}this._listenersRegistered=!0,Eh.forEach(e=>{var t,n;let r=e!==`TTFB`&&this._softNavsActive;if(this._urlAttribution){var i,a;(i=(a=this._listeners)[e])==null||i.call(a,e=>{if(this._isEnabled)if(e.name===`CLS`){let t=e,n=t.attribution.largestShiftTarget;this._clsMetricId===t.id?this._largestShiftTargetForCLS!==n&&(this._largestShiftTargetForCLS=n,this._attributedPage.CLS=this._currentAttributedPage()):(this._clsMetricId=t.id,this._largestShiftTargetForCLS=n,this._attributedPage.CLS=this._currentAttributedPage())}else this._attributedPage[e.name]=this._currentAttributedPage()},{reportAllChanges:!0,reportSoftNavs:r})}(t=(n=this._listeners)[e])==null||t.call(n,e=>{this._isEnabled&&this._emitWebVital(e)},{reportSoftNavs:r})})}_currentAttributedPage(){var e,t,n;return{fullURL:this._urlDocument.URL,label:(e=this._pageManager.getPageLabel())==null?void 0:e,pageID:(t=this._pageManager.getCurrentPageId())==null?void 0:t,path:(n=this._pageManager.getCurrentRoute())==null?void 0:n.path}}_getTimeForMetric(e){var t;if(e.name===`INP`&&e.attribution.interactionTime!==void 0)return this.perf.epochMillisFromOriginOffset(e.attribution.interactionTime);if(e.name===`CLS`){let t=e.entries.length>0?Math.min(...e.entries.map(e=>e.startTime)):e.attribution.largestShiftTime;if(t!==void 0)return this.perf.epochMillisFromOriginOffset(t)}if(e.name===`TTFB`)return this.perf.getZeroTime();let n=(t=e.entries[e.entries.length-1])==null?void 0:t.startTime;return n===void 0?this.perf.getNowMillis():this.perf.epochMillisFromOriginOffset(n)}_emitWebVital(e){let t=this._attributedPage[e.name],n=this._getTimeForMetric(e),r=this.userSessionManager.getSessionPartIdAt(n),i=cm(),a={attributes:U(U(U(U(U(U(U(U(U(U({[I]:`ux.web_vital`,"browser.web_vital.name":e.name.toLowerCase(),"browser.web_vital.value":e.value,"browser.web_vital.delta":e.delta,"browser.web_vital.rating":e.rating,"browser.web_vital.id":e.id,"browser.web_vital.navigation_type":e.navigationType},e.navigationId===void 0?{}:{"browser.web_vital.navigation_id":e.navigationId}),e.navigationInteractionId===void 0?{}:{"browser.web_vital.interaction_id":e.navigationInteractionId}),r===null?{}:{[or]:r}),i!=null&&i.length?{[nr]:i}:{}),t?{[tr]:e.navigationURL!=null&&(e.navigationType===`soft-navigation`||this._softNavsActive)?e.navigationURL:t.fullURL,[rr]:t.path,[ir]:t.pageID,[ar]:t.label}:{}),e.name===`INP`?Mh(e,this._diag):{}),e.name===`INP`?Ph(e,this._diag):{}),e.name===`TTFB`?Fh(e,this._diag):{}),e.name===`CLS`?Nh(e,this._diag):{}),e.name===`LCP`?Ih(e,this._diag):{}),body:this._includeRawAttribution&&e.attribution!=null?JSON.stringify(Object.fromEntries(Object.entries(e.attribution).filter(([,e])=>jh(e)))):void 0,eventName:`browser.web_vital`,severityNumber:V.INFO,timestamp:yi(n)};this._applyCustomLogRecordData&&hs(()=>{var e;return(e=this._applyCustomLogRecordData)==null?void 0:e.call(this,a)},e=>{e&&this._diag.error(`applyCustomLogRecordData hook failed`,e)},!0),this.logger.emit(a)}};W();let Rh=(e={},{logManager:t,userSessionManager:n,pageManager:r,limitManager:i,includeReplay:a=!1,autoStart:o=!0,replayOptions:s,replayContext:c,sessionStorage:l,signalBuffer:u})=>{var d,f,p,m,h,g,_,v,ee,y,b,te,ne;let x=[];if((d=e.omit)!=null&&d.has(`exception`)||x.push(new hm(e.exception)),(f=e.omit)!=null&&f.has(`click`)||x.push(new rm(e.click)),(p=e.omit)!=null&&p.has(`rage-click`)||x.push(new Cm(e[`rage-click`])),(m=e.omit)!=null&&m.has(`first-interaction`)||x.push(new vm(e[`first-interaction`])),(h=e.omit)!=null&&h.has(`max-scroll-depth`)||x.push(new Sm(e[`max-scroll-depth`])),(g=e.omit)!=null&&g.has(`web-vital`)||x.push(new Lh(U(U({},e[`web-vital`]),{},{pageManager:r}))),(_=e.omit)!=null&&_.has(`loaf`)||x.push(new bm(U({},e.loaf))),(v=e.omit)!=null&&v.has(`user-timing`)||x.push(new Am(e[`user-timing`])),(ee=e.omit)!=null&&ee.has(`element-timing`)||x.push(new pm(U(U({},e[`element-timing`]),{},{limitManager:i}))),(y=e.omit)!=null&&y.has(`soft-navigation-performance`)||x.push(new Em(U({limitManager:i,signalBuffer:u},e[`soft-navigation-performance`]))),(b=e.omit)!=null&&b.has(`document-load`)||x.push(new fm(e[`document-load`])),(te=e.omit)!=null&&te.has(`server-timing`)||x.push(new wm(U(U({},e[`server-timing`]),{},{limitManager:i}))),e[`empty-root`]&&x.push(new mm(U({},e[`empty-root`]))),a&&!((ne=e.omit)!=null&&ne.has(`replay`))){if(!c)throw Error(`replayContext is required when includeReplay is true`);if(!l)throw Error(`sessionStorage is required when includeReplay is true`);x.push(new Zo({autoStart:o,replayContext:c,rrwebOptions:s,sessionStorage:l}))}for(let e of x)e instanceof G&&(n&&e.setUserSessionManager(n),t&&e.setLogManager(t),i&&e.setLimitManager(i));return x};N(),H(),_s(),js(),wl(),W(),q();let zh=(e={})=>{let{resource:t=ws(),spanExporters:n=[],logExporters:r=[],spanProcessors:i=[],propagator:a=null,defaultInstrumentationConfig:o,instrumentations:s=[],contextManager:c=null,logProcessors:l=[],logLevel:u=y.ERROR,diagLogger:d=j.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:f,dynamicSDKConfig:p,registerGlobally:m=!0,blockNetworkSpanForwarding:h=!1,restrictedProtocols:g=new Set([`file:`]),useDocumentTitleAsPageLabel:_=!0,serviceName:v,exception:ee}=e;try{var b,te,ne,x;if(m){let e=Jp.registered();if(e!==null)return d.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}if(j.setLogger(new ue,{logLevel:u}),typeof window>`u`)return d.warn(`browser not detected, skipping initialization`),!1;let y=new ga,S=y.getNowMillis();window.addEventListener(`pageshow`,e=>ha(y.epochMillisFromOriginOffset(e.timeStamp)));let C=tm(e),{appId:w,appVersion:re,collectorUrl:ie,configUrl:ae}=C,oe=w!==void 0;if(!oe&&!r.length&&!n.length)throw Error(`when appId is omitted, at least one logExporter or spanExporter must be set`);if(g.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(oe&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let se=m?void 0:w,T=new Kf({diag:d,namespace:se,storage:window.localStorage}),ce=new Kf({diag:d,namespace:se,storage:window.sessionStorage}),le=Bh({registerGlobally:m,sdkLocalStorage:T}),E=le.getMXLUserId();if(oe&&!E)throw Error(`userID is required when using MXL exporter`);let de=U({},p),D=f==null?new Sd({appId:w,appVersion:re,configUrl:ae,defaultConfig:de,deviceId:E,storage:T}):f;D.refreshRemoteConfig();let fe=(b=(te=D.resolveApplicationServiceName)==null?void 0:te.call(D,v))==null?(()=>{var e;return(v==null?void 0:v.trim())||((e=D.getConfig().serviceName)==null?void 0:e.trim())||cd})():b,pe=ld({serviceName:fe}).merge(t).merge(ud({appId:w,appVersion:re,diagLogger:d,enduserPseudoId:E,pageSessionStorage:ce})),me=new Ld({blockNetworkSpanForwarding:h,deviceId:E,dynamicConfigManager:D});if(!me.isSDKEnabled())return d.debug(`SDK is disabled, skipping initialization.`),!1;let he=qf({defaultInstrumentationConfig:o,diag:d,featureManager:me,propagator:a,registerGlobally:m}),ge=new Ed(wd),O=Vh({dynamicConfigManager:D,limitManager:ge,perf:y,registerGlobally:m,sdkLocalStorage:T,sdkSessionStorage:ce,userSessionConfig:C.session}),_e,ve;w!==void 0&&(_e=new Ff({emptySessionAvoidanceEnabled:me.isEmptySessionAvoidanceEnabled(),exporter:new Au({appId:w,collectorUrl:ie,userID:E}),limitManager:ge,userSessionManager:O}),ve=new tc({exporter:new Ou({appId:w,collectorUrl:ie,userID:E})}));let ye=Wh({registerGlobally:m,useDocumentTitleAsPageLabel:_,userSessionManager:O,perf:y}),be=!(o==null||(ne=o.omit)==null)&&ne.has(`soft-navigation-performance`)?void 0:new Wf,{tracerProvider:xe,mxlTraceManager:Se}=Hh({attributeScrubbers:C.attributeScrubbers,contextManager:c,mxlSpanProcessor:_e,pageManager:ye,propagator:he?new Gf:a,registerGlobally:m,resource:pe,signalBuffer:be,spanExporters:n,spanProcessors:i,userManager:le});O.setTracerProvider(xe);let{loggerProvider:Ce,mxlLogManager:we}=Uh({attributeScrubbers:C.attributeScrubbers,exception:ee,limitManager:ge,logExporters:r,logProcessors:l,mxlLogProcessor:ve,pageManager:ye,perf:y,registerGlobally:m,resource:pe,sdkLocalStorage:T,signalBuffer:be,userManager:le,userSessionManager:O,visibilityDoc:window.document}),Te=new Qu({appId:w==null?``:w,loggerProvider:Ce,pageManager:ye,storage:T,userManager:le,userSessionManager:O});O.setAnalyticsManager(Te),m&&xn.setGlobalAnalyticsManager(Te),O.startSessionPartInternal({reason:`init`});let Ee=typeof window<`u`&&window.__MXL_DISABLE_SESSION_RECORDER===!0,{autoStart:De,replay:Oe}=Cd({autoStart:C.replay.enabled,dynamicConfig:D.getConfig(),isSessionReplayEnabled:me.isSessionReplayEnabled(),replay:C.replay.options}),ke=!!(oe&&E&&!Ee&&me.isSessionReplayEnabled()),Ae=ke&&De&&Oe!=null&&Oe.omitRedundantInstrumentations?[`click`,`exception`,`@opentelemetry/instrumentation-fetch`,`@opentelemetry/instrumentation-xml-http-request`]:void 0,je=Ae===void 0?o:U(U({},o),{},{omit:new Set([...(x=o==null?void 0:o.omit)==null?[]:x,...Ae])}),Me=ke&&w!==void 0&&E?{appId:w,appVersion:re,redactUrl:Vo(C.attributeScrubbers),serviceName:fe,transport:Fu({apiKey:C.replay.apiKey,appId:w,collectorUrl:ie,configUrl:ae}),userID:E}:void 0,Ne=()=>Rh(je,{includeReplay:ke,limitManager:ge,logManager:we,pageManager:ye,autoStart:De,replayContext:Me,replayOptions:Oe,sessionStorage:ce,signalBuffer:be,userSessionManager:O}),Pe,Fe,Ie;if(m){let e=Rh(je,{includeReplay:ke,limitManager:ge,pageManager:ye,autoStart:De,replayContext:Me,replayOptions:Oe,sessionStorage:ce,signalBuffer:be,userSessionManager:O});Pe=e.find(e=>e instanceof Zo),Fe=ts({instrumentations:[...e,...s]})}else{let e=Ne();Pe=e.find(e=>e instanceof Zo),Fe=ts({instrumentations:[...e,...s],loggerProvider:Ce,tracerProvider:xe})}let Le=!1,Re=!1;Kp(je,Yf({collectorUrl:ie,configUrl:ae})).then(e=>{Re||e.length===0||(Ie=ts(m?{instrumentations:e}:{instrumentations:e,loggerProvider:Ce,tracerProvider:xe}))}).catch(e=>{d.warn(`failed to load network instrumentations: ${e instanceof Error?e.message:String(e)}`)});let k=()=>{Re||(Re=!0,Pe==null||Pe.disable(),Fe==null||Fe(),Ie==null||Ie(),O._shutdown())},ze=Pe?ju(Pe):qp;d.info(`successfully initialized the SDK`);let Be={analytics:Te,flush:function(){var e=K(function*(){yield xe.forceFlush(),yield Ce.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:we,page:ye,session:O,sessionRecording:ze,setDynamicConfig:e=>{D.setConfig(e)},shutdown:function(){var e=K(function*(){Le||(Le=!0,k(),yield xe.shutdown(),yield Ce.shutdown())});return function(){return e.apply(this,arguments)}}(),stop:k,trace:Se,user:le};return m&&Jp.register(Be),O.recordSDKStartupDuration(y.getNowMillis()-S),Te.screenView(),Be}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return d.error(`failed to initialize the SDK: ${t}`),!1}},Bh=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new Hd({storage:t});return e&&Xn.setGlobalUserManager(n),n},Vh=({dynamicConfigManager:e,limitManager:t,perf:n,registerGlobally:r,sdkLocalStorage:i,sdkSessionStorage:a,userSessionConfig:o})=>{let s=new yf({config:o,dynamicConfigManager:e,limitManager:t,perf:n,storage:i,tabStorage:a,visibilityDoc:window.document});return r&&Fn.setGlobalUserSessionManager(s),s},Hh=({resource:e,userManager:t,spanExporters:n,spanProcessors:r=[],propagator:i=null,contextManager:a=null,attributeScrubbers:o,registerGlobally:s,mxlSpanProcessor:c,pageManager:l,signalBuffer:u})=>{let d=[...r,new xf,new Tf,new Uf({userManager:t}),new Lf({pageManager:l}),new Bf({attributeScrubbers:o}),...u?[new zf({buffer:u})]:[]];n==null||n.forEach(e=>{d.push(new Wc({exporter:e}))}),c&&d.push(c);let f=new rl({resource:e,spanLimits:{attributeCountLimit:wd.maxAllowed.session_property*2,eventCountLimit:wd.maxAllowed.breadcrumb*2},spanProcessors:d}),p=new zd({tracerProvider:s?void 0:f});if(s){Un.setGlobalTraceManager(p),M.setGlobalTracerProvider(f),i&&qt.setGlobalPropagator(i);let e=a||new ol;e.enable(),A.setGlobalContextManager(e)}return{mxlTraceManager:p,tracerProvider:f}},Uh=({resource:e,userManager:t,logExporters:n,logProcessors:r,userSessionManager:i,limitManager:a,attributeScrubbers:o,registerGlobally:s,mxlLogProcessor:c,sdkLocalStorage:l,pageManager:u,perf:d,visibilityDoc:f,signalBuffer:p,exception:m})=>{let h=[...r,new Hf({userSessionManager:i}),new bf,new Cf,new Vf({userManager:t}),new Sf({attributeScrubbers:o}),new If({pageManager:u}),...p?[new Rf({buffer:p})]:[]];n==null||n.forEach(e=>{h.push(new tc({exporter:e}))}),c&&h.push(c);let g=new Js({processors:h,resource:e}),_=new Nd({exception:m,limitManager:a,loggerProvider:s?void 0:g,perf:d,storage:l,userSessionManager:i,visibilityDoc:f});return s&&(Fa.setGlobalLoggerProvider(g),pn.setGlobalLogManager(_)),{loggerProvider:g,mxlLogManager:_}},Wh=({useDocumentTitleAsPageLabel:e,registerGlobally:t,userSessionManager:n,perf:r})=>{let i=new Pd({useDocumentTitleAsPageLabel:e,userSessionManager:n,perf:r});return t&&On.setGlobalPageManager(i),i};return N(),Object.defineProperty(e,`DiagLogLevel`,{enumerable:!0,get:function(){return y}}),e.ReplayInstrumentation=Zo,e.analytics=xn,e.attributes=dr,e.getNavigationInstrumentation=Va,e.initSDK=zh,e.loadRrwebModule=Eo,e.log=pn,e.page=On,e.resetRrwebModuleCacheForTests=Do,e.session=Fn,e.setRrwebModuleLoaderForTests=Oo,e.setRrwebScriptUrl=So,e.trace=Un,e.user=Xn,e})({});
1
+ "use strict";window.MXLWebSdk=window.MXLWebSdk||(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i,a=n((()=>{i=`1.9.1`}));function o(e){let t=new Set([e]),n=new Set,r=e.match(s);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(s);if(!r)return a(e);let c={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return c.prerelease!=null||i.major!==c.major?a(e):i.major===0?i.minor===c.minor&&i.patch<=c.patch?o(e):a(e):i.minor<=c.minor?o(e):a(e)}}var s,c,l=n((()=>{a(),s=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,c=o(i)}));function u(e,t,n,r=!1){var a;let o=h[m]=(a=h[m])==null?{version:i}:a;if(!r&&o[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(o.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${i}`);return n.error(t.stack||t.message),!1}return o[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${i}.`),!0}function d(e){var t,n;let r=(t=h[m])==null?void 0:t.version;if(!(!r||!c(r)))return(n=h[m])==null?void 0:n[e]}function f(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${i}.`);let n=h[m];n&&delete n[e]}var p,m,h,g=n((()=>{a(),l(),p=i.split(`.`)[0],m=Symbol.for(`opentelemetry.js.api.${p}`),h=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function _(e,t,n){let r=d(`diag`);if(r)return r[e](t,...n)}var v,ee=n((()=>{g(),v=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return _(`debug`,this._namespace,e)}error(...e){return _(`error`,this._namespace,e)}info(...e){return _(`info`,this._namespace,e)}warn(...e){return _(`warn`,this._namespace,e)}verbose(...e){return _(`verbose`,this._namespace,e)}}})),y,b=n((()=>{(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`})(y||(y={}))}));function te(e,t){e<y.NONE?e=y.NONE:e>y.ALL&&(e=y.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,y.ERROR),warn:n(`warn`,y.WARN),info:n(`info`,y.INFO),debug:n(`debug`,y.DEBUG),verbose:n(`verbose`,y.VERBOSE)}}var ne=n((()=>{b()})),x,S,C=n((()=>{ee(),ne(),b(),g(),x=`diag`,S=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=d(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:y.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=d(`diag`),s=te((i=n.logLevel)==null?y.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return u(`diag`,s,t,!0)},t.disable=()=>{f(x,t)},t.createComponentLogger=e=>new v(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),w,re=n((()=>{w=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}}));function ie(e={}){return new w(new Map(Object.entries(e)))}var ae=n((()=>{C(),re(),S.instance()}));function oe(e){return Symbol.for(e)}var se,T,ce=n((()=>{se=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},T=new se})),le,E,ue,de=n((()=>{if(le=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],E={},typeof console<`u`)for(let e of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[e]==`function`&&(E[e]=console[e]);ue=class{constructor(){function e(e){return function(...t){let n=E[e];if(typeof n!=`function`&&(n=E.log),typeof n!=`function`&&console&&(n=console[e],typeof n!=`function`&&(n=console.log)),typeof n==`function`)return n.apply(console,t)}}for(let t=0;t<le.length;t++)this[le[t].n]=e(le[t].c)}}}));function D(){return xe}var fe,pe,me,he,ge,O,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke=n((()=>{fe=class{constructor(){}createGauge(e,t){return Ce}createHistogram(e,t){return we}createCounter(e,t){return Se}createUpDownCounter(e,t){return Te}createObservableGauge(e,t){return De}createObservableCounter(e,t){return Ee}createObservableUpDownCounter(e,t){return Oe}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},pe=class{},me=class extends pe{add(e,t){}},he=class extends pe{add(e,t){}},ge=class extends pe{record(e,t){}},O=class extends pe{record(e,t){}},_e=class{addCallback(e){}removeCallback(e){}},ve=class extends _e{},ye=class extends _e{},be=class extends _e{},xe=new fe,Se=new me,Ce=new ge,we=new O,Te=new he,Ee=new ve,De=new ye,Oe=new be})),Ae,je,Me=n((()=>{Ae={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},je={set(e,t,n){e!=null&&(e[t]=n)}}})),Ne,Pe=n((()=>{ce(),Ne=class{active(){return T}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Fe,Ie,Le,Re=n((()=>{Pe(),g(),C(),Fe=`context`,Ie=new Ne,Le=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return u(Fe,e,S.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return d(Fe)||Ie}disable(){this._getContextManager().disable(),f(Fe,S.instance())}}})),k,ze=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(k||(k={}))})),Be,Ve,He,Ue=n((()=>{ze(),Be=`0000000000000000`,Ve=`00000000000000000000000000000000`,He={traceId:Ve,spanId:Be,traceFlags:k.NONE}})),We,Ge=n((()=>{Ue(),We=class{constructor(e=He){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Ke(e){return e.getValue(Qe)||void 0}function qe(){return Ke(Le.getInstance().active())}function Je(e,t){return e.setValue(Qe,t)}function Ye(e){return e.deleteValue(Qe)}function Xe(e,t){return Je(e,new We(t))}function Ze(e){var t;return(t=Ke(e))==null?void 0:t.spanContext()}var Qe,$e=n((()=>{ce(),Ge(),Re(),Qe=oe(`OpenTelemetry Context Key SPAN`)}));function et(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(at[e.charCodeAt(t)]|0)+(at[e.charCodeAt(t+1)]|0)+(at[e.charCodeAt(t+2)]|0)+(at[e.charCodeAt(t+3)]|0);return n===t}function tt(e){return et(e,32)&&e!==`00000000000000000000000000000000`}function nt(e){return et(e,16)&&e!==`0000000000000000`}function rt(e){return tt(e.traceId)&&nt(e.spanId)}function it(e){return new We(e)}var at,ot=n((()=>{Ue(),Ge(),at=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 st(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var ct,lt,ut=n((()=>{Re(),$e(),Ge(),ot(),ct=Le.getInstance(),lt=class{startSpan(e,t,n=ct.active()){if(t!=null&&t.root)return new We;let r=n&&Ze(n);return st(r)&&rt(r)?new We(r):new We}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a==null?ct.active():a,c=this.startSpan(e,i,s),l=Je(s,c);return ct.with(l,o,void 0,c)}}})),dt,ft,pt=n((()=>{ut(),dt=new lt,ft=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):dt}}})),mt,ht=n((()=>{ut(),mt=class{getTracer(e,t,n){return new lt}}})),gt,_t,vt=n((()=>{pt(),ht(),gt=new mt,_t=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new ft(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?gt:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),yt,bt=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(yt||(yt={}))})),xt,St=n((()=>{(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`})(xt||(xt={}))})),Ct,wt=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Ct||(Ct={}))})),A,Tt=n((()=>{Re(),A=Le.getInstance()})),j,Et=n((()=>{C(),j=S.instance()})),Dt,Ot,kt=n((()=>{ke(),Dt=class{getMeter(e,t,n){return xe}},Ot=new Dt})),At,jt,Mt=n((()=>{kt(),g(),C(),At=`metrics`,jt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return u(At,e,S.instance())}getMeterProvider(){return d(At)||Ot}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){f(At,S.instance())}}})),Nt,Pt=n((()=>{Mt(),Nt=jt.getInstance()})),Ft,It=n((()=>{Ft=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function Lt(e){return e.getValue(Vt)||void 0}function Rt(){return Lt(Le.getInstance().active())}function zt(e,t){return e.setValue(Vt,t)}function Bt(e){return e.deleteValue(Vt)}var Vt,Ht=n((()=>{Re(),ce(),Vt=oe(`OpenTelemetry Baggage Key`)})),Ut,Wt,Gt,Kt=n((()=>{g(),It(),Me(),Ht(),ae(),C(),Ut=`propagation`,Wt=new Ft,Gt=class e{constructor(){this.createBaggage=ie,this.getBaggage=Lt,this.getActiveBaggage=Rt,this.setBaggage=zt,this.deleteBaggage=Bt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return u(Ut,e,S.instance())}inject(e,t,n=je){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Ae){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){f(Ut,S.instance())}_getGlobalPropagator(){return d(Ut)||Wt}}})),qt,Jt=n((()=>{Kt(),qt=Gt.getInstance()})),Yt,Xt,Zt=n((()=>{g(),vt(),ot(),$e(),C(),Yt=`trace`,Xt=class e{constructor(){this._proxyTracerProvider=new _t,this.wrapSpanContext=it,this.isSpanContextValid=rt,this.deleteSpan=Ye,this.getSpan=Ke,this.getActiveSpan=qe,this.getSpanContext=Ze,this.setSpan=Je,this.setSpanContext=Xe}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=u(Yt,this._proxyTracerProvider,S.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return d(Yt)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){f(Yt,S.instance()),this._proxyTracerProvider=new _t}}})),M,Qt=n((()=>{Zt(),M=Xt.getInstance()})),N=n((()=>{ae(),ce(),de(),b(),ke(),Me(),pt(),vt(),bt(),St(),wt(),ze(),ot(),Ue(),Tt(),Et(),Pt(),Jt(),Qt()}));N();function $t(e,t,n,r=new Set){return new Proxy(e,{get(e,i,a){let o=Reflect.get(e,i,a);return typeof o!=`function`||r.has(i)?o:(...r)=>{try{return o.apply(e,r)}catch(e){let a=e instanceof Error?e.message:`Unknown error`;n.error(`${String(i)}: ${a}`);let o=t[i];return typeof o==`function`?o.apply(t,r):void 0}}}})}var en=class{logException(e,t){}captureException(e,t){}addExceptionFilter(e){}message(e,t,n){}};function tn(e){"@babel/helpers - typeof";return tn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},tn(e)}var nn=n((()=>{}));function rn(e,t){if(tn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(tn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var an=n((()=>{nn()}));function on(e){var t=rn(e,`string`);return tn(t)==`symbol`?t:t+``}var sn=n((()=>{nn(),an()}));function P(e,t,n){return(t=on(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=n((()=>{sn()}));F();let cn=new en;var ln=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?cn:e}setDelegate(e){this._delegate=e}logException(e,t){this.getDelegate().logException(e,t)}captureException(e,t){this.logException(e,t)}addExceptionFilter(e){this.getDelegate().addExceptionFilter(e)}message(e,t,n){this.getDelegate().message(e,t,n)}};F();let un=new en,dn=new Set([`setDelegate`,`getDelegate`]);var fn=class e{static getInstance(){if(!e._instance){let t=new ln,n=$t(t,un,j.createComponentLogger({namespace:`LogAPI`}),dn);e._instance=Object.assign(n,{getLogManager(){return t},setGlobalLogManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(fn,`_instance`,void 0);let pn=fn.getInstance();var mn=class{track(){}identify(){}increment(){}decrement(){}clear(){}screenView(){}};let hn=(e,t,n,r=100)=>{e.length>=r&&(e.shift(),n()),e.push(t)};N(),F();let gn=new mn;var _n=class{constructor(e){P(this,`_delegate`,void 0),P(this,`_queue`,[]),P(this,`_diag`,void 0),this._diag=e==null?j.createComponentLogger({namespace:`ProxyAnalyticsManager`}):e}getDelegate(){var e;return(e=this._delegate)==null?gn:e}setDelegate(e){this._delegate=e;let t=this._queue;if(this._queue=null,t)for(let n of t)n.op===`track`?e.track(n.name,n.options):e.identify(n.options)}track(e,t){if(this._queue){this._enqueue({op:`track`,name:e,options:t});return}this.getDelegate().track(e,t)}identify(e){if(this._queue){this._enqueue({op:`identify`,options:e});return}this.getDelegate().identify(e)}increment(e){this.getDelegate().increment(e)}decrement(e){this.getDelegate().decrement(e)}clear(){this.getDelegate().clear()}screenView(){this.getDelegate().screenView()}_enqueue(e){let t=this._queue;t&&hn(t,e,()=>{this._diag.warn(`dropping oldest queued analytics call; pre-init queue is full`)})}};N(),F();let vn=new mn,yn=new Set([`setDelegate`,`getDelegate`]);var bn=class e{static getInstance(){if(!e._instance){let t=new _n,n=$t(t,vn,j.createComponentLogger({namespace:`AnalyticsAPI`}),yn);e._instance=Object.assign(n,{getAnalyticsManager(){return t},setGlobalAnalyticsManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(bn,`_instance`,void 0);let xn=bn.getInstance();var Sn=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}addRouteChangedListener(e){return()=>{}}};F();let Cn=new Sn;var wn=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Cn:e}setDelegate(e){this._delegate=e}setCurrentRoute(e){this.getDelegate().setCurrentRoute(e)}getCurrentRoute(){return this.getDelegate().getCurrentRoute()}getCurrentPageId(){return this.getDelegate().getCurrentPageId()}setPageLabel(e){this.getDelegate().setPageLabel(e)}getPageLabel(){return this.getDelegate().getPageLabel()}clearCurrentRoute(){this.getDelegate().clearCurrentRoute()}addRouteChangedListener(e){return this.getDelegate().addRouteChangedListener(e)}};N(),F();let Tn=new Sn,En=new Set([`setDelegate`,`getDelegate`]);var Dn=class e{static getInstance(){if(!e._instance){let t=new wn,n=$t(t,Tn,j.createComponentLogger({namespace:`PageAPI`}),En);e._instance=Object.assign(n,{getPageManager(){return t},setGlobalPageManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Dn,`_instance`,void 0);let On=Dn.getInstance();var kn=class{addBreadcrumb(e){}addProperty(e,t,n){}removeProperty(e){}getUserSessionId(){return null}getPreviousUserSessionId(){return null}getUserSessionStartTime(){return null}endUserSession(){}getUserSessionAttributes(){return null}getSessionPartProperties(){return{}}getSessionPartId(){return null}getSessionPartIdAt(e){return null}getSessionPartSpan(){return null}startSessionPartInternal(e){}endSessionPartInternal(e){}rolloverSessionPartInternal(e){}incrSessionPartCountForKey(e){}incrNextSessionPartCountForKey(e){}addSessionPartStartedListener(e){return()=>{}}addSessionPartEndedListener(e){return()=>{}}setTracerProvider(){}setAnalyticsManager(e){}recordSDKStartupDuration(e){}claimReplaySample(e){return!1}nextReplayMetaVersion(){return 0}_clearMaxDurationTimer(){}_shutdown(){}};F();let An=new kn;var jn=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?An:e}setDelegate(e){let t=this._delegate;t&&t!==e&&t._shutdown(),this._delegate=e}addBreadcrumb(e){this.getDelegate().addBreadcrumb(e)}addProperty(e,t,n){this.getDelegate().addProperty(e,t,n)}removeProperty(e){this.getDelegate().removeProperty(e)}getUserSessionId(){return this.getDelegate().getUserSessionId()}getPreviousUserSessionId(){return this.getDelegate().getPreviousUserSessionId()}getUserSessionStartTime(){return this.getDelegate().getUserSessionStartTime()}endUserSession(){this.getDelegate().endUserSession()}getUserSessionAttributes(){return this.getDelegate().getUserSessionAttributes()}getSessionPartProperties(){return this.getDelegate().getSessionPartProperties()}getSessionPartId(){return this.getDelegate().getSessionPartId()}getSessionPartIdAt(e){return this.getDelegate().getSessionPartIdAt(e)}getSessionPartSpan(){return this.getDelegate().getSessionPartSpan()}startSessionPartInternal(e){this.getDelegate().startSessionPartInternal(e)}endSessionPartInternal(e){this.getDelegate().endSessionPartInternal(e)}rolloverSessionPartInternal(e){this.getDelegate().rolloverSessionPartInternal(e)}incrSessionPartCountForKey(e){this.getDelegate().incrSessionPartCountForKey(e)}incrNextSessionPartCountForKey(e){this.getDelegate().incrNextSessionPartCountForKey(e)}addSessionPartStartedListener(e){return this.getDelegate().addSessionPartStartedListener(e)}addSessionPartEndedListener(e){return this.getDelegate().addSessionPartEndedListener(e)}setTracerProvider(e){this.getDelegate().setTracerProvider(e)}setAnalyticsManager(e){this.getDelegate().setAnalyticsManager(e)}recordSDKStartupDuration(e){this.getDelegate().recordSDKStartupDuration(e)}claimReplaySample(e){return this.getDelegate().claimReplaySample(e)}nextReplayMetaVersion(){return this.getDelegate().nextReplayMetaVersion()}_clearMaxDurationTimer(){this.getDelegate()._clearMaxDurationTimer()}_shutdown(){this.getDelegate()._shutdown()}};N(),F();let Mn=new kn,Nn=new Set([`setDelegate`,`getDelegate`]);var Pn=class e{static getInstance(){if(!e._instance){let t=new jn,n=$t(t,Mn,j.createComponentLogger({namespace:`SessionAPI`}),Nn);e._instance=Object.assign(n,{getUserSessionManager(){return t},setGlobalUserSessionManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Pn,`_instance`,void 0);let Fn=Pn.getInstance();N(),F();var In=class{constructor(e=He){P(this,`_spanContext`,void 0),P(this,`attributes`,{}),this._spanContext=e}fail(e){}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}removeAttribute(e){return this}addEvent(e,t,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}};N();var Ln=class{startSpan(e,t){return new In}setSpan(e,t){return T}getSpan(e){}};F();let Rn=new Ln;var zn=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Rn:e}setDelegate(e){this._delegate=e}startSpan(e,t,n){return this.getDelegate().startSpan(e,t,n)}setSpan(e,t){return this.getDelegate().setSpan(e,t)}getSpan(e){return this.getDelegate().getSpan(e)}};N(),F();let Bn=new Ln,Vn=new Set([`setDelegate`,`getDelegate`]);var Hn=class e{static getInstance(){if(!e._instance){let t=new zn,n=$t(t,Bn,j.createComponentLogger({namespace:`TraceAPI`}),Vn);e._instance=Object.assign(n,{getTraceManager(){return t},setGlobalTraceManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Hn,`_instance`,void 0);let Un=Hn.getInstance();var Wn=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};N(),F();let Gn=new Wn;var Kn=class{constructor(e){P(this,`_delegate`,void 0),P(this,`_queue`,[]),P(this,`_diag`,void 0),this._diag=e==null?j.createComponentLogger({namespace:`ProxyUserManager`}):e}getDelegate(){var e;return(e=this._delegate)==null?Gn:e}setDelegate(e){this._delegate=e;let t=this._queue;if(this._queue=null,t)for(let n of t)e.setUserId(n.userId)}getMXLUserId(){return this.getDelegate().getMXLUserId()}getUserId(){return this.getDelegate().getUserId()}setUserId(e){if(this._queue){hn(this._queue,{op:`setUserId`,userId:e},()=>{this._diag.warn(`dropping oldest queued setUserId; pre-init queue is full`)});return}this.getDelegate().setUserId(e)}clearUserId(){this.getDelegate().clearUserId()}};N(),F();let qn=new Wn,Jn=new Set([`setDelegate`,`getDelegate`]);var Yn=class e{static getInstance(){if(!e._instance){let t=new Kn,n=$t(t,qn,j.createComponentLogger({namespace:`UserAPI`}),Jn);e._instance=Object.assign(n,{getUserManager(){return t},setGlobalUserManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Yn,`_instance`,void 0);let Xn=Yn.getInstance(),I=`mxl.type`,Zn=`mxl.state`,Qn=`react.component_stack`,$n=`mxl.instrumentation`,er=`mxl.js_file_bundle_ids`,tr=`browser.url.full`,nr=`browser.navigation_timing.not_restored_reasons`,rr=`app.surface.name`,ir=`app.surface.id`,ar=`app.surface.label`,or=`mxl.session_part_id`,sr=`mxl.user_session_id`,cr=`mxl.user_session_previous_id`,lr=`mxl.user_session_number`,ur=`mxl.application.id`,L=`mxl.session_prev.`,dr={pageLabel:ar};function fr(e){return e.setValue(mr,!0)}function pr(e){return e.getValue(mr)===!0}var mr,hr=n((()=>{N(),mr=oe(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function gr(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!_r(n)){j.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!vr(r)){j.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function _r(e){return typeof e==`string`&&e!==``}function vr(e){return e==null?!0:Array.isArray(e)?yr(e):br(typeof e)}function yr(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(br(e)){t=e;continue}return!1}return!1}}return!0}function br(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var xr=n((()=>{N()}));function Sr(){return e=>{j.error(Cr(e))}}function Cr(e){return typeof e==`string`?e:JSON.stringify(wr(e))}function wr(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Tr=n((()=>{N()}));function Er(e){try{Dr(e)}catch(e){}}var Dr,Or=n((()=>{Tr(),Dr=Sr()})),kr=n((()=>{})),Ar,jr=n((()=>{Ar=`2.12.0`})),Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr=n((()=>{Mr=`http.method`,Nr=`http.url`,Pr=`http.status_code`,Fr=`http.request_content_length`,Ir=`http.response_content_length`,Lr=Mr,Rr=Nr,zr=Pr,Br=Fr,Vr=Ir})),Ur=n((()=>{Hr()})),Wr=n((()=>{})),Gr=n((()=>{Wr()})),Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui=n((()=>{Kr=`error.type`,qr=`exception.message`,Jr=`exception.stacktrace`,Yr=`exception.type`,Xr=`http.request.method`,Zr=`http.request.method_original`,Qr=`http.response.status_code`,$r=`server.address`,ei=`server.port`,ti=`service.name`,ni=`telemetry.sdk.language`,ri=`webjs`,ii=`telemetry.sdk.name`,ai=`telemetry.sdk.version`,oi=`url.full`,si=`url.path`,ci=`url.query`,li=`user_agent.original`})),di=n((()=>{})),fi=n((()=>{})),R=n((()=>{Ur(),Gr(),ui(),di(),fi()})),pi,mi=n((()=>{pi=`process.runtime.name`})),hi,gi=n((()=>{jr(),R(),mi(),hi={[ii]:`opentelemetry`,[pi]:`browser`,[ni]:ri,[ai]:Ar}})),_i,vi=n((()=>{kr(),gi(),_i=performance}));function yi(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*ki)]}function bi(e){return Di(yi(_i.timeOrigin),yi(typeof e==`number`?e:_i.now()))}function xi(e){if(Ti(e))return e;if(typeof e==`number`)return e<_i.timeOrigin/2?bi(e):yi(e);if(e instanceof Date)return yi(e.getTime());throw TypeError(`Invalid input type`)}function Si(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Ai),[n,r]}function Ci(e){return e[0]*Ai+e[1]}function wi(e){return e[0]*1e3+e[1]/1e6}function Ti(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Ei(e){return Ti(e)||typeof e==`number`||e instanceof Date}function Di(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Ai&&(n[1]-=Ai,n[0]+=1),n}var Oi,ki,Ai,ji=n((()=>{vi(),Oi=9,ki=Math.pow(10,6),Ai=Math.pow(10,Oi)})),z,Mi=n((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(z||(z={}))}));function Ni(e){return Ri.test(e)}function Pi(e){return zi.test(e)&&!Bi.test(e)}var Fi,Ii,Li,Ri,zi,Bi,Vi=n((()=>{Fi=`[_0-9a-z-*/]`,Ii=`[a-z]${Fi}{0,255}`,Li=`[a-z0-9]${Fi}{0,240}@[a-z]${Fi}{0,13}`,Ri=RegExp(`^(?:${Ii}|${Li})$`),zi=/^[ -~]{0,255}[!-~]$/,Bi=/,|=/})),Hi,Ui,Wi,Gi,Ki,qi=n((()=>{Vi(),F(),Hi=32,Ui=512,Wi=`,`,Gi=`=`,Ki=class e{constructor(e){P(this,`_length`,void 0),P(this,`_rawTraceState`,void 0),P(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Ni(e)||!Pi(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>Ui)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=Wi+e),e=`${n[0]}${Gi}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Wi),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Gi);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Ni(a)||!Pi(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Ui)&&(t.set(a,o),n=s,t.size>=Hi))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}}}));function Ji(e){let t=Qi.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Yi,Xi,Zi,Qi,$i,ea=n((()=>{N(),hr(),qi(),Yi=`traceparent`,Xi=`tracestate`,Zi=`00`,Qi=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),$i=class{inject(e,t,n){let r=M.getSpanContext(e);if(!r||pr(e)||!rt(r))return;let i=`${Zi}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||k.NONE).toString(16)}`;n.set(t,Yi,i),r.traceState&&n.set(t,Xi,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Yi);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Ji(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Xi);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Ki(typeof e==`string`?e:void 0)}return M.setSpanContext(e,a)}fields(){return[Yi,Xi]}}}));function ta(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new na(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var na,ra=n((()=>{na=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}));function ia(e,t){return typeof t==`string`?e===t:!!e.match(t)}function aa(e,t){if(!t)return!1;for(let n of t)if(ia(e,n))return!0;return!1}var oa=n((()=>{})),sa,ca=n((()=>{F(),sa=class{constructor(){P(this,`_promise`,void 0),P(this,`_resolve`,void 0),P(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),la,ua=n((()=>{ca(),F(),la=class{constructor(e,t){P(this,`_isCalled`,!1),P(this,`_deferred`,new sa),P(this,`_callback`,void 0),P(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function da(e,t){return new Promise(n=>{A.with(fr(A.active()),()=>{e.export(t,n)})})}var fa=n((()=>{N(),hr()})),pa,B=n((()=>{N(),hr(),F(),xr(),Or(),Tr(),ji(),Mi(),vi(),ea(),qi(),ra(),oa(),ua(),fa(),pa={_export:da}}));B(),F();let ma;function ha(e){ma=e}var ga=class{constructor(e=window.performance){P(this,`_clock`,void 0),P(this,`navigationEntry`,null),P(this,`epochMillisFromOriginOffset`,e=>this._clock.timeOrigin+e),P(this,`getNowHRTime`,()=>yi(this.getNowMillis())),P(this,`getNowMillis`,()=>this.epochMillisFromOriginOffset(this._clock.now())),P(this,`millisSinceHRTime`,e=>this.getNowMillis()-wi(e)),P(this,`getZeroTime`,()=>{var e;return Math.max(this._clock.timeOrigin+this._getNavigationActivationStart(),(e=ma)==null?0:e)}),P(this,`getNavigationEntry`,()=>{var e,t,n;if(this.navigationEntry)return this.navigationEntry;let[r]=(e=(t=(n=this._clock).getEntriesByType)==null?void 0:t.call(n,`navigation`))==null?[]:e;return r?(this.navigationEntry=r,this.navigationEntry):null}),P(this,`millisFromZeroTime`,e=>Math.max(0,e-(this.getZeroTime()-this._clock.timeOrigin))),P(this,`millisFromZeroTimeEpoch`,e=>Math.max(0,e-this.getZeroTime())),this._clock=e}_getNavigationActivationStart(){var e;let t=this.getNavigationEntry();return(e=t==null?void 0:t.activationStart)==null?0:e}},V,_a=n((()=>{(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`})(V||(V={}))}));function va(){return ba}var ya,ba,xa=n((()=>{ya=class{emit(e){}enabled(){return!1}},ba=new ya}));function Sa(e,t,n){return r=>r===e?t:n}var Ca,wa,Ta=n((()=>{Ca=Symbol.for(`io.opentelemetry.js.api.logs`),wa=globalThis})),Ea,Da,Oa=n((()=>{xa(),Ea=class{getLogger(e,t,n){return new ya}},Da=new Ea})),ka,Aa=n((()=>{xa(),ka=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ba}}})),ja,Ma=n((()=>{Oa(),Aa(),ja=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new ka(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?Da:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),Na,Pa=n((()=>{Ta(),Oa(),Ma(),Na=class e{constructor(){this._proxyLoggerProvider=new ja}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return wa[Ca]?this.getLoggerProvider():(wa[Ca]=Sa(1,e,Da),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=wa[Ca])==null?void 0:e.call(wa,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete wa[Ca],this._proxyLoggerProvider=new ja}}})),Fa,H=n((()=>{_a(),xa(),Pa(),Fa=Na.getInstance()}));function Ia(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ia(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ia(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var W=n((()=>{F()}));N(),H(),F(),W();var La=class{constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,P(this,`_config`,{}),P(this,`_diag`,void 0),P(this,`_tracer`,void 0),P(this,`_meter`,void 0),P(this,`_logger`,void 0),this.setConfig(n),this._diag=j.createComponentLogger({namespace:e}),this._tracer=M.getTracer(e,t),this._meter=Nt.getMeter(e,t),this._logger=Fa.getLogger(e,t),this._updateMetricInstruments()}get tracer(){return this._tracer}get meter(){return this._meter}get logger(){return this._logger}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}getConfig(){return this._config}setConfig(e){this._config=U({enabled:!0},e)}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}_updateMetricInstruments(){}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}};F();var G=class extends La{constructor({instrumentationName:e,instrumentationVersion:t,config:n,diag:r,perf:i,limitManager:a}){super(e,t,n),P(this,`_userSessionManager`,void 0),P(this,`_logManager`,void 0),P(this,`_limitManager`,void 0),P(this,`_perf`,void 0),P(this,`_isEnabled`,!1),P(this,`_removeSessionPartListeners`,{}),P(this,`_sessionPartListeners`,{}),r&&(this._diag=r),this._perf=i==null?new ga:i,this._userSessionManager=Fn.getUserSessionManager(),this._logManager=pn.getLogManager(),this._limitManager=a}get limitManager(){return this._limitManager}get userSessionManager(){return this._userSessionManager}get logManager(){return this._logManager}get perf(){return this._perf}init(){}setLimitManager(e){this._limitManager=e}setLogManager(e){this._logManager=e}setUserSessionManager(e){this._userSessionManager=e,this._registerSessionPartListeners()}setSessionPartListeners(e){this._sessionPartListeners=e,this._registerSessionPartListeners()}unregisterSessionPartListeners(){var e,t,n,r;(e=(t=this._removeSessionPartListeners).start)==null||e.call(t),(n=(r=this._removeSessionPartListeners).end)==null||n.call(r),this._removeSessionPartListeners={}}_registerSessionPartListeners(){this._isEnabled&&(this.unregisterSessionPartListeners(),this._sessionPartListeners.start&&(this._removeSessionPartListeners.start=this.userSessionManager.addSessionPartStartedListener(()=>{var e,t;return(e=(t=this._sessionPartListeners).start)==null?void 0:e.call(t)})),this._sessionPartListeners.end&&(this._removeSessionPartListeners.end=this.userSessionManager.addSessionPartEndedListener(()=>{var e,t;return(e=(t=this._sessionPartListeners).end)==null?void 0:e.call(t)})))}disable(){this._isEnabled&&(this._isEnabled=!1,this.onDisable(),this.unregisterSessionPartListeners())}enable(){this._isEnabled||(this._isEnabled=!0,this.onEnable())}};F();let Ra=/\([^()]+\)/g;var za=class extends G{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0}){super({config:{},diag:e,instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`}),P(this,`_shouldCleanupPathOptionsFromRouteName`,!0),P(this,`_currentRouteSpan`,null),P(this,`_instrumentationType`,`manual`),P(this,`_removeSessionStartedFn`,null),P(this,`_removeSessionEndedFn`,null),P(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),P(this,`setCurrentRoute`,e=>{if(!this._config.enabled)return;let t=On.getCurrentRoute(),n=e.url!==(t==null?void 0:t.url);if(On.setCurrentRoute(e),n){this._endRouteSpan(t),this._startRouteSpan(e),xn.screenView();return}if(!this._currentRouteSpan){this._startRouteSpan(e);return}(t==null?void 0:t.path)!==e.path&&(this._endRouteSpan(t),this._startRouteSpan(e))}),P(this,`_setupSessionListeners`,()=>{this._removeSessionStartedFn||(this._removeSessionStartedFn=this.userSessionManager.addSessionPartStartedListener(({reason:e})=>{if(e===`web_soft_navigation`)return;let t=On.getCurrentRoute();t&&!this._currentRouteSpan&&(this._diag.debug(`Session started, starting route span.`),this._startRouteSpan(t))})),this._removeSessionEndedFn||(this._removeSessionEndedFn=this.userSessionManager.addSessionPartEndedListener(()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan(On.getCurrentRoute()))}))}),P(this,`_cleanUpSessionListeners`,()=>{this._removeSessionStartedFn&&(this._removeSessionStartedFn(),this._removeSessionStartedFn=null),this._removeSessionEndedFn&&(this._removeSessionEndedFn(),this._removeSessionEndedFn=null)}),P(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`),this._setupSessionListeners();let t=this._shouldCleanupPathOptionsFromRouteName?e.path.replace(Ra,``):e.path;return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[I]:`ux.surface`,[rr]:t,[ir]:On.getCurrentPageId()||void 0}}),this._currentRouteSpan.setAttribute($n,this._instrumentationType),this._currentRouteSpan}),P(this,`_endRouteSpan`,e=>{this._currentRouteSpan&&(e&&this._diag.debug(`Ending route span for url: ${e.url}`),this._currentRouteSpan.end(),this._currentRouteSpan=null)}),this._shouldCleanupPathOptionsFromRouteName=t,this._config.enabled&&this.enable()}onEnable(){this.setConfig({enabled:!0}),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}onDisable(){this._cleanUpSessionListeners(),this.setConfig({enabled:!1}),this._diag.debug(`NavigationInstrumentation disabled, stopped listening for navigation events.`)}};let Ba,Va=(e={})=>(Ba||(Ba=new za(e)),Ba);function Ha(e){let t=(e,t=2)=>String(e).padStart(t,`0`);return`${e.getUTCFullYear()}-${t(e.getUTCMonth()+1)}-${t(e.getUTCDate())} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}.${t(e.getUTCMilliseconds(),3)}`}function Ua(e){let t=/edg/i.test(e)?`Edge`:/opr|opera/i.test(e)?`Opera`:/chrome|crios/i.test(e)?`Chrome`:/firefox|fxios/i.test(e)?`Firefox`:/safari/i.test(e)?`Safari`:`Unknown`,n=/windows/i.test(e)?`Windows`:/mac os|macintosh/i.test(e)?`macOS`:/android/i.test(e)?`Android`:/iphone|ipad|ios/i.test(e)?`iOS`:/linux/i.test(e)?`Linux`:`Unknown`;return{browserName:t,deviceType:/mobile|iphone|android.*mobile/i.test(e)?`mobile`:/ipad|tablet/i.test(e)?`tablet`:`desktop`,osName:n}}function Wa(e,t){if(e<=0)return()=>void 0;let n,r=setInterval(()=>{if(typeof requestIdleCallback!=`function`){t();return}n===void 0&&(n=requestIdleCallback(()=>{n=void 0,t()},{timeout:2e3}))},e);return()=>{clearInterval(r),n!==void 0&&typeof cancelIdleCallback==`function`&&cancelIdleCallback(n),n=void 0}}function Ga(e){try{return JSON.stringify(e).length}catch(e){return 64}}function Ka(e,t){try{e(t)}catch(e){}}let qa=[`log`,`info`,`warn`,`error`,`debug`],Ja=2e3;function Ya(e){let t={};for(let n of qa){let r=console[n];t[n]=r,console[n]=(...t)=>{Ka(e,{level:n,message:Xa(t),type:`console`}),r.apply(console,t)}}return()=>{for(let e of qa){let n=t[e];n&&(console[e]=n)}}}function Xa(e){let t=e.map(e=>{if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch(t){return String(e)}}).join(` `);return t.length>Ja?`${t.slice(0,Ja)}…`:t}N();function Za(){var e;let t=(e=M.getActiveSpan())==null?void 0:e.spanContext().traceId;return t&&t!==`00000000000000000000000000000000`?t:void 0}let Qa=4e3;function $a(e){let t=t=>{var n,r;Ka(e,{errorStack:eo((n=t.error)==null?void 0:n.stack),level:`error`,message:t.message||String((r=t.error)==null?`Error`:r),traceId:Za(),type:`error`})},n=t=>{var n;let r=t.reason,i=typeof r==`string`?r:(n=r==null?void 0:r.message)==null?`Unhandled promise rejection`:n;Ka(e,{errorStack:eo(typeof r==`object`?r==null?void 0:r.stack:void 0),level:`error`,message:i,traceId:Za(),type:`error`})};return window.addEventListener(`error`,t),window.addEventListener(`unhandledrejection`,n),()=>{window.removeEventListener(`error`,t),window.removeEventListener(`unhandledrejection`,n)}}function eo(e){if(e)return e.length>Qa?`${e.slice(0,Qa)}…`:e}function to(e,t){let n=n=>{let r=n.target;r instanceof Element&&Ka(e,{targetSelector:no(r),targetText:t?void 0:ro(r),type:`click`})},r=t=>{let n=t.target;n instanceof Element&&Ka(e,{targetSelector:no(n),type:`input`})};return document.addEventListener(`click`,n,!0),document.addEventListener(`input`,r,!0),()=>{document.removeEventListener(`click`,n,!0),document.removeEventListener(`input`,r,!0)}}function no(e){return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:``}${typeof e.className==`string`&&e.className.trim()?`.${e.className.trim().split(/\s+/)[0]}`:``}`}function ro(e){var t;let n=((t=e.textContent)==null?``:t).trim().replace(/\s+/g,` `);if(n)return n.length>120?`${n.slice(0,120)}…`:n}function io(e){let t=``,n=()=>{let n=location.href;n!==t&&(t=n,Ka(e,{type:`navigation`,url:n}))};n();let r=history.pushState,i=history.replaceState;return history.pushState=function(...e){let t=r.apply(this,e);return n(),t},history.replaceState=function(...e){let t=i.apply(this,e);return n(),t},window.addEventListener(`popstate`,n),window.addEventListener(`hashchange`,n),()=>{history.pushState=r,history.replaceState=i,window.removeEventListener(`popstate`,n),window.removeEventListener(`hashchange`,n)}}function ao(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function K(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){ao(a,r,i,o,s,`next`,e)}function s(e){ao(a,r,i,o,s,`throw`,e)}o(void 0)})}}var q=n((()=>{}));q(),W();function oo(e,t){let n=typeof window<`u`?window.fetch.bind(window):void 0;n&&(window.fetch=function(){var e=K(function*(e,t){let i=so(e),a=co(e,t),o=Za(),s=performance.now();try{let c=yield n(e,t);return r(i,a,c.status,s,o),c}catch(e){throw r(i,a,0,s,o,String(e)),e}});return function(t,n){return e.apply(this,arguments)}}());let r=(n,r,i,a,o,s)=>{t(n)||Ka(e,U({net:{durationMs:Math.round(performance.now()-a),method:r,status:i,url:n},traceId:o,type:`network`},s?{attrs:{error:s}}:{}))},i=typeof window<`u`?window.XMLHttpRequest:void 0,a=i==null?void 0:i.prototype.open,o=i==null?void 0:i.prototype.send;return i&&a&&o&&(i.prototype.open=function(e,t,...n){return this.__mxlMethod=String(e).toUpperCase(),this.__mxlUrl=typeof t==`string`?t:t.href,a.apply(this,[e,t,...n])},i.prototype.send=function(...e){let t=this,n=performance.now(),i=Za();return this.addEventListener(`loadend`,()=>{var e,a;r((e=t.__mxlUrl)==null?``:e,(a=t.__mxlMethod)==null?`GET`:a,this.status,n,i)}),o.apply(this,e)}),()=>{n&&(window.fetch=n),i&&a&&(i.prototype.open=a),i&&o&&(i.prototype.send=o)}}function so(e){return typeof e==`string`?e:e instanceof URL?e.href:e.url}function co(e,t){var n;let r=(n=t==null?void 0:t.method)==null?typeof e==`object`&&`method`in e?e.method:void 0:n;return(r==null?`GET`:r).toUpperCase()}q();function lo({config:e,sessionId:t,transport:n,onActivity:r,flushIntervalMs:i=5e3,flushBytes:a=65536}){let o=[],s=0,c=0,l=!1,u=e=>{l||(o.push({ev:e,seq:c++}),s+=Ga(e),s>=a&&d())},d=function(){var i=K(function*(i=!1){if(o.length===0||l)return;r==null||r();let a=o;o=[],s=0;let c=a.map(({ev:n,seq:r})=>uo(t,n,r,e.redactUrl));yield n.postSessionEvents(c,i)});return function(){return i.apply(this,arguments)}}(),f=[io(u),to(u,e.maskAllText),Ya(u),oo(u,e=>n.shouldIgnoreUrl(e)),$a(u)],p=Wa(i,()=>{d()});return{flush:d,pause:()=>{l=!0},resume:()=>{l=!1},stop:()=>{p();for(let e of f)e()}}}function uo(e,t,n,r){var i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,ee,y;let b=(i=t.net)==null?void 0:i.url,te=(a=t.url)==null?typeof location<`u`?location.href:``:a;return{attributes:(o=t.attrs)==null?{}:o,error_stack:(s=t.errorStack)==null?``:s,level:(c=t.level)==null?``:c,message:(l=t.message)==null?``:l,net_duration_ms:(u=(d=t.net)==null?void 0:d.durationMs)==null?0:u,net_method:(f=(p=t.net)==null?void 0:p.method)==null?``:f,net_status:(m=(h=t.net)==null?void 0:h.status)==null?0:m,net_url:b?r(b):``,seq:n,session_id:e,target_selector:(g=t.targetSelector)==null?``:g,target_text:(_=t.targetText)==null?``:_,timestamp:Ha(new Date((v=t.timestamp)==null?Date.now():v)),trace_id:(ee=(y=t.traceId)==null?Za():y)==null?``:ee,type:t.type,url:te?r(te):``}}q();function fo(e){return po.apply(this,arguments)}function po(){return po=K(function*(e){let t=new CompressionStream(`gzip`),n=t.writable.getWriter(),r=n.write(e).then(()=>n.close()),[i]=yield Promise.all([new Response(t.readable).arrayBuffer(),r]),a=new Uint8Array(i);if(a.length<18||a[0]!==31||a[1]!==139||a[2]!==8)throw Error(`gzip produced ${a.length} bytes, not a complete gzip stream`);return a}),po.apply(this,arguments)}q(),W();let mo=4*1024*1024,ho=0;function go(e,t){let n=Date.now();n-ho<3e4||(ho=n,console.warn(`[mxl] session replay ${e}`,...t?[t]:[]))}function _o({config:e,sessionId:t,transport:n,chunkSeqStore:r,rrwebModule:i,onActivity:a,flushIntervalMs:o=5e3,flushBytes:s=102400}){let c=[],l=0,u=!1,d=0,f=0,p=!1,m=!1,h=0,g=!1,_=Promise.resolve(),v=()=>{c=[],l=0,u=!1,d=0,f=0},ee=()=>void 0,y=function(){var e=K(function*(e,r,i){let a;try{a=yield fo(new TextEncoder().encode(e))}catch(e){go(`chunk compression failed (dropping chunk)`,e);return}(yield n.postSessionBlob(r,a,i))===`exhausted`&&!m&&(m=!0,go(`replay ${t} reached its maximum recorded size; recording stopped for this session`),ee())});return function(t,n,r){return e.apply(this,arguments)}}(),b=(e=!1)=>{if(m||c.length===0)return _;a==null||a();let n=`[${c.join(`,`)}]`,i={chunkSeq:r.nextChunkSeq(t),durationMs:Math.max(0,f-d),eventCount:c.length,isCheckpoint:u,sessionId:t};v();let o=_.then(()=>y(n,i,e));return _=o.catch(()=>void 0),o},{record:te}=i,ne=te(U(U({checkoutEveryNms:3e5,emit:(t,n)=>{var r,i;if(g||m)return;let a=t;a.type===4&&typeof((r=a.data)==null?void 0:r.href)==`string`&&(a.data.href=e.redactUrl(a.data.href));let o=n===!0||a.type===2;if(a.type===3&&((i=a.data)==null?void 0:i.source)===2&&a.data.type===2&&h++,p&&!o)return;let _;try{_=JSON.stringify(a)}catch(e){return}if(l+_.length>mo){go(`buffer exceeded ${mo} bytes (dropping ${l+_.length} bytes until the next full snapshot)`),v(),p=!0;return}p=!1,o&&(u=!0),c.length===0&&(d=a.timestamp),f=a.timestamp,c.push(_),l+=_.length,l>=s&&b()},maskAllInputs:e.maskAllInputs},e.maskAllText?{maskTextSelector:`*`}:{}),e.rrwebOptions)),x=Wa(o,()=>{b()}),S=!1;return ee=()=>{S||(S=!0,x(),v(),ne==null||ne())},{flush:b,getClickCount:()=>h,pause:()=>{g=!0},resume:()=>{g=!1},stop:ee}}q();let vo=`https://unpkg.com/rrweb@2.0.0-alpha.20/dist/rrweb.umd.cjs`,yo,bo,xo=vo;function So(e){xo=e,yo=void 0}function Co(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.async=!0,r.onload=()=>t(),r.onerror=n,document.head.appendChild(r)})}function wo(){return To.apply(this,arguments)}function To(){return To=K(function*(){if(typeof window>`u`)throw Error(`no browser`);if(window.rrweb)return window.rrweb;if(yield Co(xo),!window.rrweb)throw Error(`no rrweb`);return window.rrweb}),To.apply(this,arguments)}function Eo(){return bo?bo():(yo===void 0&&(yo=wo()),yo)}function Do(){yo=void 0,bo=void 0,xo=vo}function Oo(e){bo=e,yo=void 0}let ko=new Set;function Ao(e){!e||e===`00000000000000000000000000000000`||ko.add(e)}function jo(){return Array.from(ko)}function Mo(){ko.clear()}let No=`__MXL_REPLAY_SESSION__`;function Po(e){globalThis[No]={recordTraceId:Ao,sessionId:e}}function Fo(){delete globalThis[No]}function Io(e){let t=e=>`replay.chunkSeq.${e}`;return{nextChunkSeq(n){let r=e.getItem(t(n)),i=r===null?0:Number.parseInt(r,10),a=Number.isFinite(i)?i:0;return e.setItem(t(n),String(a+1)),a}}}R();let Lo=/\/\/(.+):(.+)@(.+)\//,Ro=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],zo=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(Lo,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},Bo=e=>{let t=[...Ro,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:oi,scrub:e=>zo({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:Rr,scrub:e=>zo({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:si,scrub:e=>zo({queryParamRegex:n,scrubPath:!0,scrubQuery:!1,value:e})},{key:ci,scrub:e=>zo({queryParamRegex:n,scrubPath:!1,scrubQuery:!0,value:e})}]},Vo=e=>{let t=e.filter(({key:e})=>e===oi);return e=>t.reduce((e,{scrub:t})=>t(e),e)};function Ho(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Uo(e,t){if(e==null)return{};var n,r,i=Ho(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let Wo=[`debug`,`sampleRate`,`maskAllInputs`,`maskAllText`,`flushIntervalMs`,`omitRedundantInstrumentations`];function Go(e,t){var n;let r=t==null?{}:t,{debug:i=!1,sampleRate:a,maskAllInputs:o=!0,maskAllText:s=!0,flushIntervalMs:c=5e3,omitRedundantInstrumentations:l}=r,u=Uo(r,Wo);return{appId:e.appId,appVersion:e.appVersion,debug:i,environment:void 0,flushIntervalMs:c,maskAllInputs:o,maskAllText:s,redactUrl:(n=e.redactUrl)==null?Vo(Bo()):n,replaySampleRate:a==null?1:a,rrwebOptions:u,serviceName:e.serviceName,userID:e.userID}}W();function Ko(e){var t;let n=(t=e.visibilityDoc)==null?document:t,r=!1,i=setInterval(()=>{n.visibilityState===`visible`&&e.transport.postSessionMeta(qo(e.config,e.sessionId,e.startedAt,e.nextMetaVersion(),`active`,null))},6e4),a=()=>{var t;r||(r=!0,clearInterval(i),e.recorder.flush(!0),e.events.flush(!0),e.transport.postSessionMeta(qo(e.config,e.sessionId,e.startedAt,e.nextMetaVersion(),`ended`,e.recorder.getClickCount()),!0),e.recorder.stop(),e.events.stop(),Mo(),(t=e.onFinalize)==null||t.call(e))},o=()=>{n.visibilityState===`hidden`&&a()};return n.addEventListener(`visibilitychange`,o),window.addEventListener(`pagehide`,a),()=>{clearInterval(i),n.removeEventListener(`visibilitychange`,o),window.removeEventListener(`pagehide`,a)}}function qo(e,t,n,r,i,a){var o;let s=Ua(navigator.userAgent),c=new Date,l={browser_name:s.browserName,device_type:s.deviceType,os_name:s.osName,resource_attributes:U(U({},e.environment?{"deployment.environment":e.environment,"deployment.environment.name":e.environment}:{}),e.appVersion?{"deployment.commit_sha":e.appVersion}:{}),service_name:(o=e.serviceName)==null?``:o,session_id:t,start_time:Ha(n),status:i,url_initial:e.redactUrl(window.location.href),user_agent:navigator.userAgent,user_id:Yo(),version:r};return i===`ended`&&(l.click_count=a==null?0:a,l.duration_ms=Math.max(0,c.getTime()-n.getTime()),l.end_time=Ha(c),l.trace_ids=jo()),l}function Jo(e){let t=e.getUserSessionStartTime();return new Date(t==null?Date.now():t)}function Yo(){var e;return(e=Xn.getUserId())==null?``:e}F(),q();var Xo=class{constructor({context:e,userSessionManager:t,sessionStorage:n,rrwebOptions:r,autoStart:i=!0,diag:a,visibilityDoc:o}){P(this,`_context`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_chunkSeqStore`,void 0),P(this,`_config`,void 0),P(this,`_diag`,void 0),P(this,`_autoStart`,void 0),P(this,`_visibilityDoc`,void 0),P(this,`_active`,void 0),P(this,`_paused`,!1),P(this,`_enableRequested`,!1),P(this,`_startInProgress`,!1),P(this,`_stopInProgress`,!1),P(this,`_removeSessionStartedListener`,void 0),P(this,`_removeResumeListener`,void 0),this._context=e,this._userSessionManager=t,this._visibilityDoc=o,this._chunkSeqStore=Io(n),this._autoStart=i,this._config=Go(e,r),this._diag=a==null?{debug:()=>void 0,error:()=>void 0,info:()=>void 0,verbose:()=>void 0,warn:()=>void 0}:a}isRecording(){return!!this._active&&!this._paused}enable(e){if(!this._autoStart&&!(e!=null&&e.force)){this._diag.debug(`replay.enabled is false, waiting for manual enable`);return}this._enableRequested=!0,this._paused=!1,this._tryStart()}pause(){this._active&&(this._enableRequested=!1,this._paused=!0,this._active.recorder.pause(),this._active.events.pause())}resume(){if(!this._active){this.enable();return}let e=this._paused;this._enableRequested=!0,this._paused=!1,this._active.recorder.resume(),this._active.events.resume(),e&&this._active.rrwebModule.record.takeFullSnapshot()}stop(){var e=this;return K(function*(){var t,n;if(e._enableRequested=!1,e._paused=!1,(t=e._removeSessionStartedListener)==null||t.call(e),e._removeSessionStartedListener=void 0,(n=e._removeResumeListener)==null||n.call(e),e._removeResumeListener=void 0,!e._active){Fo(),Mo();return}if(e._stopInProgress)return;e._stopInProgress=!0;let r=e._active;e._active=void 0;try{var i;(i=r.removeSessionEndListener)==null||i.call(r),r.removeLifecycle(),yield r.recorder.flush(!0),yield r.events.flush(!0),r.recorder.stop(),r.events.stop()}finally{Fo(),Mo(),e._stopInProgress=!1}})()}_tryStart(){var e=this;return K(function*(){if(!e._enableRequested||e._active||e._startInProgress||e._stopInProgress)return;if(typeof window>`u`){e._diag.warn(`session replay cannot run in non-browser environments`);return}let t=e._userSessionManager.getUserSessionId();if(t===null){e._removeSessionStartedListener||(e._removeSessionStartedListener=e._userSessionManager.addSessionPartStartedListener(()=>{var t;(t=e._removeSessionStartedListener)==null||t.call(e),e._removeSessionStartedListener=void 0,e._tryStart()}));return}if(!e._userSessionManager.claimReplaySample(e._config.replaySampleRate)){e._diag.debug(`session replay skipped by sample rate`);return}e._startInProgress=!0;try{let n=yield Eo();if(!e._enableRequested||e._active)return;Po(t),Mo();let r=Jo(e._userSessionManager),i=()=>{},a=_o({chunkSeqStore:e._chunkSeqStore,config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,rrwebModule:n,sessionId:t,transport:e._context.transport}),o=lo({config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,sessionId:t,transport:e._context.transport}),s=()=>e._userSessionManager.nextReplayMetaVersion();e._context.transport.postReplay(),e._context.transport.postSessionMeta(qo(e._config,t,r,s(),`active`,null)),e._active={events:o,recorder:a,removeLifecycle:globalThis.__MXL_TEST_SKIP_REPLAY_LIFECYCLE__===!0?()=>void 0:Ko({config:e._config,events:o,nextMetaVersion:s,onFinalize:()=>{var t,n,r;(t=e._active)==null||t.removeLifecycle(),(n=e._active)==null||(r=n.removeSessionEndListener)==null||r.call(n),e._active=void 0,Fo(),Mo(),e._resumeWhenVisible()},recorder:a,sessionId:t,startedAt:r,transport:e._context.transport,visibilityDoc:e._visibilityDoc}),removeSessionEndListener:e._userSessionManager.addSessionPartEndedListener(()=>{a.flush(!0),o.flush(!0)}),rrwebModule:n},e._diag.debug(`session recording started`)}catch(t){e._diag.error(`failed to start session recording`,t)}finally{e._startInProgress=!1}})()}_resumeWhenVisible(){var e;if(this._removeResumeListener)return;let t=(e=this._visibilityDoc)==null?document:e,n=()=>{var e;t.visibilityState===`visible`&&((e=this._removeResumeListener)==null||e.call(this),this._removeResumeListener=void 0,this._tryStart())};t.addEventListener(`visibilitychange`,n),this._removeResumeListener=()=>{t.removeEventListener(`visibilitychange`,n)}}};F(),q();var Zo=class extends G{constructor(e={}){super({config:{},diag:e.diag,instrumentationName:`ReplayInstrumentation`,instrumentationVersion:`2.0.0`,perf:e.perf}),P(this,`_args`,void 0),P(this,`_sessionRecording`,void 0),P(this,`_wasPaused`,!1),P(this,`_stopPromise`,void 0),this._args=e,(!e.replayContext||!e.sessionStorage)&&this._diag.warn(`replayContext and sessionStorage are required for session recording`),this._config.enabled||this._diag.debug(`disabled, not starting`)}setUserSessionManager(e){super.setUserSessionManager(e),this._ensureSessionRecording(),this._config.enabled&&this._args.autoStart!==!1&&this._args.replayContext&&this._args.sessionStorage&&this.enable()}_ensureSessionRecording(){if(this._sessionRecording)return this._sessionRecording;let{replayContext:e,sessionStorage:t,autoStart:n,rrwebOptions:r,visibilityDoc:i}=this._args;if(!(!e||!t))return this._sessionRecording=new Xo({context:e,diag:this._diag,autoStart:n,rrwebOptions:r,sessionStorage:t,userSessionManager:this.userSessionManager,visibilityDoc:i}),this._sessionRecording}isRecording(){var e,t;return(e=(t=this._sessionRecording)==null?void 0:t.isRecording())==null?!1:e}enable(e){this._isEnabled=!0,this._startRecording(e)}onEnable(){this._startRecording()}_startRecording(e){this._wasPaused=!1,this._afterPendingStop(()=>{var t;(t=this._ensureSessionRecording())==null||t.enable(e)})}pause(){var e;this._wasPaused=!0,(e=this._sessionRecording)==null||e.pause()}resume(){if(!this._wasPaused){this.enable({force:!0});return}this._afterPendingStop(()=>{var e;(e=this._sessionRecording)==null||e.resume(),this._wasPaused=!1})}_afterPendingStop(e){if(this._stopPromise){this._stopPromise.then(e);return}e()}onDisable(){let e=this._sessionRecording;e&&(this._stopPromise=e.stop().finally(()=>{this._sessionRecording===e&&(this._sessionRecording=void 0),this._stopPromise=void 0}))}waitForDisable(){var e=this;return K(function*(){yield e._stopPromise})()}};function Qo(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function $o(e){e.forEach(e=>e.disable())}var es=n((()=>{}));function ts(e){var t,n;let r=e.tracerProvider||M.getTracerProvider(),i=e.meterProvider||Nt.getMeterProvider(),a=e.loggerProvider||Fa.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return Qo(o,r,i,a),()=>{$o(o)}}var ns=n((()=>{N(),H(),es()}));function rs(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function is(e){e&&e.logger&&(typeof e.logger==`function`?J=e.logger:J(`new logger isn't a function, not replacing`))}var J,as,os,ss,cs,ls=n((()=>{J=console.error.bind(console),as=(e,t,n)=>{if(!e||!e[t]){J(`no original function `+String(t)+` to wrap`);return}if(!n){J(`no wrapper function`),J(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){J(`original object and wrapper must be functions`);return}let i=n(r,t);return rs(i,`__original`,r),rs(i,`__unwrap`,()=>{e[t]===i&&rs(e,t,r)}),rs(i,`__wrapped`,!0),rs(e,t,i),i},os=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{J(`must provide one or more modules to patch`),J(Error().stack);return}if(!(t&&Array.isArray(t))){J(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{as(e,t,n)})})},ss=(e,t)=>{if(!e||!e[t]){J(`no function to unwrap.`),J(Error().stack);return}let n=e[t];if(!n.__unwrap)J(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},cs=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{J(`must provide one or more modules to patch`),J(Error().stack);return}if(!(t&&Array.isArray(t))){J(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{ss(e,t)})})},is.wrap=as,is.massWrap=os,is.unwrap=ss,is.massUnwrap=cs})),us,ds=n((()=>{N(),H(),ls(),F(),W(),us=class{constructor(e,t,n){P(this,`_config`,{}),P(this,`_tracer`,void 0),P(this,`_meter`,void 0),P(this,`_logger`,void 0),P(this,`_diag`,void 0),P(this,`instrumentationName`,void 0),P(this,`instrumentationVersion`,void 0),P(this,`_wrap`,as),P(this,`_unwrap`,ss),P(this,`_massWrap`,os),P(this,`_massUnwrap`,cs),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=j.createComponentLogger({namespace:e}),this._tracer=M.getTracer(e,t),this._meter=Nt.getMeter(e,t),this._logger=Fa.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=U({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}}})),fs,ps=n((()=>{ds(),fs=class extends us{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}}})),ms=n((()=>{ps(),N()}));function hs(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}var gs=n((()=>{})),_s=n((()=>{ns(),ms(),F(),gs()}));let vs;function ys(){if(vs===void 0)try{let e=globalThis.process.argv0;vs=e?`unknown_service:${e}`:`unknown_service`}catch(e){vs=`unknown_service`}return vs}let bs=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;N(),B(),R(),F(),q();var xs=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Ts(t),r._asyncAttributesPending=t.filter(([e,t])=>bs(t)).length>0,r}constructor(e,t){var n;P(this,`_rawAttributes`,void 0),P(this,`_asyncAttributesPending`,!1),P(this,`_schemaUrl`,void 0),P(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(bs(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Ts(this._rawAttributes),this._schemaUrl=Es(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return K(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,bs(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&j.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(bs(n)){j.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Ds(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Ss(e,t){return xs.FromAttributeList(Object.entries(e),t)}function Cs(){return Ss({})}function ws(){return Ss({[ti]:ys(),[ni]:hi[ni],[ii]:hi[ii],[ai]:hi[ai]})}function Ts(e){return e.map(([e,t])=>bs(t)?[e,t.catch(t=>{j.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Es(e){if(typeof e==`string`||e===void 0)return e;j.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Ds(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;j.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}N();function Os(e){return ks(e,new WeakSet)}function ks(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(!ks(n,t))return!1;return!0}let n=e;if(n.constructor!==Object&&n.constructor!==void 0)return!1;for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&!ks(n[e],t))return!1;return!0}return!1}var Y;(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`})(Y||(Y={}));function As(e,t,n,r,i){if(r.length===0)return j.warn(`Invalid attribute key: ${r}`),Y.DROP_INVALID;if(!Os(i))return j.warn(`Invalid attribute value set for key: ${r}`),Y.DROP_INVALID;let a=!Object.prototype.hasOwnProperty.call(e,r);return a&&n>=t.attributeCountLimit?Y.DROP_LIMIT_REACHED:(e[r]=js(i,t.attributeValueLengthLimit),a?Y.ADD_NEW:Y.ADD_OVERWRITE_EXISTING)}function js(e,t){if(t<=0)return j.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(e=>js(e,t));if(typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=js(i,t);return n}return e}function Ms(e,t){if(t==null)return{};let n={},r=0,i=0;for(let[a,o]of Object.entries(t)){let t=As(n,e,r,a,o);t===Y.ADD_NEW?r+=1:(t===Y.DROP_INVALID||t===Y.DROP_LIMIT_REACHED)&&(i+=1)}return{attributes:r>0?n:void 0,droppedAttributesCount:i}}N(),B(),R(),F();var Ns=class{get hrTime(){return this._hrTime}set hrTime(e){this._isLogRecordReadonly()||(this._hrTime=e)}get hrTimeObserved(){return this._hrTimeObserved}set hrTimeObserved(e){this._isLogRecordReadonly()||(this._hrTimeObserved=e)}get spanContext(){return this._spanContext}set spanContext(e){this._isLogRecordReadonly()||(this._spanContext=e)}set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`attributes`,{}),P(this,`_hrTime`,void 0),P(this,`_hrTimeObserved`,void 0),P(this,`_spanContext`,void 0),P(this,`_severityText`,void 0),P(this,`_severityNumber`,void 0),P(this,`_body`,void 0),P(this,`_eventName`,void 0),P(this,`_attributesCount`,0),P(this,`_droppedAttributesCount`,0),P(this,`_isReadonly`,!1),P(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this._hrTime=xi(r==null?f:r),this._hrTimeObserved=xi(i==null?f:i),d){let e=M.getSpanContext(d);e&&rt(e)&&(this._spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;let n=As(this.attributes,this._logRecordLimits,this._attributesCount,e,t);return n===Y.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&j.warn(`Dropping extra attributes.`)):n===Y.ADD_NEW&&this._attributesCount++,this}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(qr,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Yr,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Yr,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(qr,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Jr,n.stack),t=!0)}t||j.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&j.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};H(),N(),F(),W();var Ps=class{constructor(e,t){P(this,`_instrumentationScope`,void 0),P(this,`_sharedState`,void 0),P(this,`_loggerConfig`,void 0),this._instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let t=e.context||A.active();if(!this.enabled(e))return;let n=new Ns(this._sharedState,this._instrumentationScope,U({context:t},e));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,t),n._makeReadonly()}enabled(e){if(this._sharedState.hasShutdown)return!1;let t=this._loggerConfig;if(t.disabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==V.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||A.active();if(t.traceBased){let e=M.getSpanContext(r);if(e&&rt(e)&&(e.traceFlags&k.SAMPLED)!==k.SAMPLED)return!1}let i={context:r,instrumentationScope:this._instrumentationScope,severityNumber:e==null?void 0:e.severityNumber,eventName:e==null?void 0:e.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},Fs=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};B(),F(),q();var Is=class{constructor(e){P(this,`processors`,void 0),this.processors=e}forceFlush(e){var t=this;return K(function*(){var n;let r=(n=e==null?void 0:e.timeoutMillis)==null?3e4:n;yield Promise.all(t.processors.map(e=>ta(e.forceFlush(),r)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return K(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))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(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,Ls(t)])]}function Rs(e){var t;return JSON.stringify([e.name,e.version||``,e.schemaUrl||``,Ls(e.attributes),(t=e.droppedAttributesCount)==null?0:t])}let zs=`error.type`;F();var Bs=class{constructor(e){P(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(`otel.sdk.log.created`,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}};N(),H(),W(),F();let Vs={disabled:!1,minimumSeverity:V.UNSPECIFIED,traceBased:!1},Hs=()=>U({},Vs);var Us=class{constructor(e,t,n,r,i){P(this,`loggers`,new Map),P(this,`activeProcessor`,void 0),P(this,`registeredLogRecordProcessors`,[]),P(this,`resource`,void 0),P(this,`logRecordLimits`,void 0),P(this,`processors`,void 0),P(this,`loggerMetrics`,void 0),P(this,`hasShutdown`,!1),P(this,`_loggerConfigurator`,void 0),P(this,`_loggerConfigs`,new Map),this.resource=e,this.logRecordLimits=t,this.processors=n,n.length>0?(this.registeredLogRecordProcessors=n,this.activeProcessor=new Is(this.registeredLogRecordProcessors)):this.activeProcessor=new Fs,this._loggerConfigurator=r==null?Hs:r;let a=i?i.getMeter(`@opentelemetry/sdk-logs`,`0.223.0`):D();this.loggerMetrics=new Bs(a)}getLoggerConfig(e){let t=Rs(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};N(),H(),B(),F(),W();var Ws=class{constructor(e={}){var t,n,r,i,a,o,s;P(this,`_shutdownOnce`,void 0),P(this,`_sharedState`,void 0);let c={resource:(t=e.resource)==null?ws():t,logRecordLimits:{attributeCountLimit:(n=(r=e.logRecordLimits)==null?void 0:r.attributeCountLimit)==null?128:n,attributeValueLengthLimit:(i=(a=e.logRecordLimits)==null?void 0:a.attributeValueLengthLimit)==null?1/0:i},loggerConfigurator:(o=e.loggerConfigurator)==null?Hs:o,processors:(s=e.processors)==null?[]:s,meterProvider:e.meterProvider};this._sharedState=new Us(c.resource,c.logRecordLimits,c.processors,c.loggerConfigurator,c.meterProvider),this._shutdownOnce=new la(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return j.warn(`A shutdown LoggerProvider cannot provide a Logger`),va();e||j.warn(`Logger requested without instrumentation scope name.`);let r=U({name:e||`unknown`,version:t,schemaUrl:n==null?void 0:n.schemaUrl},Ms(this._sharedState.logRecordLimits,n==null?void 0:n.attributes)),i=Rs(r);return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Ps(r,this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(e){return this._shutdownOnce.isCalled?(j.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush(e)}shutdown(){return this._shutdownOnce.isCalled?(j.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.hasShutdown=!0,this._sharedState.activeProcessor.shutdown()}};F(),W();let Gs=new Map;var Ks=class{constructor(e,t,n){var r;P(this,`processedLogs`,void 0),P(this,`queueSize`,void 0),P(this,`queueSizeCallback`,void 0),P(this,`standardAttrs`,void 0),P(this,`droppedAttrs`,void 0);let i=(r=Gs.get(e))==null?0:r;if(Gs.set(e,i+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${i}`},this.droppedAttrs=U(U({},this.standardAttrs),{},{[zs]:`queue_full`}),this.processedLogs=t.createCounter(`otel.sdk.processor.log.processed`,{unit:`{log_record}`,description:`The number of log records for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(`otel.sdk.processor.log.queue.capacity`,{unit:`{log_record}`,description:`The maximum number of log records the queue of a given instance of an SDK log processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(`otel.sdk.processor.log.queue.size`,{unit:`{log_record}`,description:`The number of log records in the queue of a given instance of an SDK log processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropLogs(e){this.processedLogs.add(e,this.droppedAttrs)}finishLogs(e,t){if(!t){this.processedLogs.add(e,this.standardAttrs);return}let n=U(U({},this.standardAttrs),{},{[zs]:t.name});this.processedLogs.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};N(),B(),q(),F();function qs(e){return Js.apply(this,arguments)}function Js(){return Js=K(function*(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&(yield Promise.all(t))}),Js.apply(this,arguments)}var Ys=class{constructor(e,t,n,r){P(this,`_exportCompleted`,void 0),P(this,`_exportScheduledPromise`,void 0),P(this,`_metrics`,void 0),P(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n),this._metrics=r}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(e,t,n){var r=this;return K(function*(){try{yield qs(t),yield A.with(fr(A.active()),K(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){Er(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return K(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{if(r._metrics.finishLogs(t.length,e.error),clearTimeout(o),e.code===z.SUCCESS)i();else{var n;a((n=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):n)}}),r._exportScheduledResolve()})})()}},Xs=class{constructor(e){var t,n,r,i;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_metrics`,void 0),P(this,`_currentExport`,null),P(this,`_finishedLogRecords`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_flushing`,!1),this._exporter=e.exporter,this._maxExportBatchSize=(t=e.maxExportBatchSize)==null?512:t,this._maxQueueSize=(n=e.maxQueueSize)==null?2048:n,this._scheduledDelayMillis=(r=e.scheduledDelayMillis)==null?1e3:r,this._exportTimeoutMillis=(i=e.exportTimeoutMillis)==null?3e4:i,this._shutdownOnce=new la(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(j.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let a=e!=null&&e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-logs`):D();this._metrics=new Ks(`batching_log_processor`,a,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedLogRecords.length})}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){if(this._finishedLogRecords.length>=this._maxQueueSize){this._metrics.dropLogs(1);return}this._finishedLogRecords.push(e),this._maybeStartTimer()}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return K(function*(){e.onShutdown(),yield e._flushAll(),e._metrics.shutdown(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return K(function*(){if(e._flushing)return;e._flushing=!0;let t=e._finishedLogRecords;e._finishedLogRecords=[],e._clearTimer();let n=e._currentExport;for(n!==null&&(yield e._exporter.forceFlush(),yield n.exportCompleted,e._currentExport=null);t.length>0;){let n;t.length<=e._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,e._maxExportBatchSize);let r=new Ys(e._exporter,n,e._exportTimeoutMillis,e._metrics);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){Er(e)}finally{e._currentExport=null}}e._flushing=!1,e._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new Ys(this._exporter,e,this._exportTimeoutMillis,this._metrics);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,Er(e),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)}};F();var Zs=class extends Xs{constructor(e){super(e),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this._onInit(e)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){e.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))}};N(),F();var Qs=class{constructor(){P(this,`_enabled`,!1),P(this,`_currentContext`,T)}_bindFunction(e=T,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=T,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=T,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||T;try{return t.call(n,...r)}finally{this._currentContext=i}}};W();let $s=Symbol.for(`nodejs.util.inspect.custom`);function ec(e){let t={};for(let[n,r]of e.getRawAttributes())typeof(r==null?void 0:r.then)!=`function`&&r!=null&&(t[n]!=null||(t[n]=r));return t}function tc(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r!=null&&r.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,U(U({},r),{},{depth:r.depth==null?r.depth:r.depth-1}))}`}N(),B(),R(),F();var nc=class{constructor(e){var t,n;P(this,`_spanContext`,void 0),P(this,`kind`,void 0),P(this,`parentSpanContext`,void 0),P(this,`attributes`,{}),P(this,`links`,[]),P(this,`events`,[]),P(this,`startTime`,void 0),P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_droppedAttributesCount`,0),P(this,`_droppedEventsCount`,0),P(this,`_droppedLinksCount`,0),P(this,`_attributesCount`,0),P(this,`name`,void 0),P(this,`status`,{code:Ct.UNSET}),P(this,`endTime`,[0,0]),P(this,`_ended`,!1),P(this,`_duration`,[-1,-1]),P(this,`_spanProcessor`,void 0),P(this,`_spanLimits`,void 0),P(this,`_attributeValueLengthLimit`,void 0),P(this,`_recordEndMetrics`,void 0),P(this,`_performanceStartTime`,void 0),P(this,`_performanceOffset`,void 0),P(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=_i.now(),this._performanceOffset=r-(this._performanceStartTime+_i.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return j.warn(`Invalid attribute key: ${e}`),this;if(!vr(t))return j.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return j.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&j.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Ei(t)&&(Ei(n)||(n=t),t=void 0);let i=gr(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&j.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=gr(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Ct.UNSET||this.status.code===Ct.OK)return this;let t={code:e.code};return e.code===Ct.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&j.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){j.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=Si(this.startTime,this.endTime),this._duration[0]<0&&(j.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&&j.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&j.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=_i.now())return bi(e+this._performanceOffset);if(typeof e==`number`)return yi(e);if(e instanceof Date)return yi(e.getTime());if(Ti(e))return e;if(this._startTimeProvided)return yi(Date.now());let t=_i.now()-this._performanceStartTime;return Di(this.startTime,yi(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[qr]=e:e&&(e.code?n[Yr]=e.code.toString():e.name&&(n[Yr]=e.name),e.message&&(n[qr]=e.message),e.stack&&(n[Jr]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(`exception`,n,t):j.warn(`Failed to record an exception ${e}`)}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 e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);j.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(j.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[$s](e,t,n){return tc(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:ec(this.resource)}},e,t,n)}},rc;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(rc||(rc={}));let ic=`otel.span.sampling_result`;F();var ac=class{constructor(e){P(this,`startedSpans`,void 0),P(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(`otel.sdk.span.started`,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(`otel.sdk.span.live`,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=sc(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":oc(e),[ic]:n}),t===rc.NOT_RECORD)return()=>{};let r={[ic]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function oc(e){return e?e.isRemote?`remote`:`local`:`none`}function sc(e){switch(e){case rc.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case rc.RECORD:return`RECORD_ONLY`;case rc.NOT_RECORD:return`DROP`}}N(),B(),F();var cc=class{constructor(e,t){P(this,`_sampler`,void 0),P(this,`_spanLimits`,void 0),P(this,`_idGenerator`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_resource`,void 0),P(this,`_spanProcessor`,void 0),P(this,`_tracerMetrics`,void 0),this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,`2.12.0`);this._tracerMetrics=new ac(n)}startSpan(e,t={},n=A.active()){var r,i,a;t.root&&(n=M.deleteSpan(n));let o=M.getSpan(n);if(pr(n))return j.debug(`Instrumentation suppressed, returning Noop Span`),M.wrapSpanContext(He);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!M.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?xt.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:gr(e.attributes)})),m=gr(t.attributes),h=this._sampler.shouldSample(n,u,e,f,m,p),g=this._tracerMetrics.startSpan(s,h.decision);d=(a=h.traceState)==null?d:a;let _=h.decision===yt.RECORD_AND_SAMPLED?k.SAMPLED:k.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===yt.NOT_RECORD)return j.debug(`Recording is off, propagating context in a non-recording span`),M.wrapSpanContext(v);let ee=gr(Object.assign(m,h.attributes));return new nc({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:v,name:e,kind:f,links:p,parentSpanContext:l,attributes:ee,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}startActiveSpan(e,t,n,r){var i;let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=r);let c=(i=o)==null?A.active():i,l=this.startSpan(e,a,c),u=M.setSpan(c,l);return A.with(u,s,void 0,l)}[$s](e,t,n){return tc(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:ec(this._resource)},spanLimits:this._spanLimits},e,t,n)}};B(),F();var lc=class{constructor(e){P(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Er(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},uc=class{shouldSample(){return{decision:rc.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},dc=class{shouldSample(){return{decision:rc.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};N(),B(),F();var fc=class{constructor(e){var t,n,r,i;P(this,`_root`,void 0),P(this,`_remoteParentSampled`,void 0),P(this,`_remoteParentNotSampled`,void 0),P(this,`_localParentSampled`,void 0),P(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Er(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new dc),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new dc:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new uc:n,this._localParentSampled=(r=e.localParentSampled)==null?new dc:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new uc:i}shouldSample(e,t,n,r,i,a){let o=M.getSpanContext(e);return!o||!rt(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&k.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&k.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};R(),F(),W();let pc=new Map;var mc=class{constructor(e,t,n){var r;P(this,`processedSpans`,void 0),P(this,`queueSize`,void 0),P(this,`queueSizeCallback`,void 0),P(this,`standardAttrs`,void 0),P(this,`droppedAttrs`,void 0);let i=(r=pc.get(e))==null?0:r;if(pc.set(e,i+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${i}`},this.droppedAttrs=U(U({},this.standardAttrs),{},{[Kr]:`queue_full`}),this.processedSpans=t.createCounter(`otel.sdk.processor.span.processed`,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(`otel.sdk.processor.span.queue.capacity`,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(`otel.sdk.processor.span.queue.size`,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n=U(U({},this.standardAttrs),{},{[Kr]:t.name});this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};N(),B(),F();var hc=class{constructor(e){var t,n,r,i;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_metrics`,void 0),P(this,`_isExporting`,!1),P(this,`_finishedSpans`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_droppedSpansCount`,0),this._exporter=e.exporter,this._maxExportBatchSize=(t=e.maxExportBatchSize)==null?512:t,this._maxQueueSize=(n=e.maxQueueSize)==null?2048:n,this._scheduledDelayMillis=(r=e.scheduledDelayMillis)==null?5e3:r,this._exportTimeoutMillis=(i=e.exportTimeoutMillis)==null?3e4:i,this._shutdownOnce=new la(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(j.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let a=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):D();this._metrics=new mc(`batching_span_processor`,a,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&k.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&j.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(j.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);A.with(fr(A.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{if(clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===z.SUCCESS)e();else{var a;t((a=i.error)==null?Error(`BatchSpanProcessor: span export failed`):a)}}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a!=null||(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{Er(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Er(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};B(),F();var gc=class extends hc{constructor(e){super(e),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{Er(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Er(e)})},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))}};let _c=new Uint8Array(16),vc=new Uint8Array(8),yc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function bc(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 xc(e){let t=``;for(let n=0;n<e.length;n++)t+=yc[e[n]];return t}var Sc=class{generateTraceId(){return bc(_c),xc(_c)}generateSpanId(){return bc(vc),xc(vc)}};N(),F();var Cc;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Cc||(Cc={}));var wc=class{constructor(e={}){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;P(this,`_resource`,void 0),P(this,`_activeSpanProcessor`,void 0),P(this,`_forceFlushTimeoutMillis`,void 0),P(this,`_tracerOptions`,void 0),P(this,`_tracers`,new Map),this._forceFlushTimeoutMillis=(t=e.forceFlushTimeoutMillis)==null?3e4:t,this._resource=(n=e.resource)==null?ws():n;let v=(r=e.spanProcessors)==null?[]:r;this._activeSpanProcessor=new lc(v),this._tracerOptions={resource:this._resource,sampler:(i=e.sampler)==null?new fc({root:new dc}):i,spanLimits:{attributeCountLimit:(a=(o=e.spanLimits)==null?void 0:o.attributeCountLimit)==null?128:a,attributeValueLengthLimit:(s=(c=e.spanLimits)==null?void 0:c.attributeValueLengthLimit)==null?1/0:s,eventCountLimit:(l=(u=e.spanLimits)==null?void 0:u.eventCountLimit)==null?128:l,linkCountLimit:(d=(f=e.spanLimits)==null?void 0:f.linkCountLimit)==null?128:d,attributePerEventCountLimit:(p=(m=e.spanLimits)==null?void 0:m.attributePerEventCountLimit)==null?128:p,attributePerLinkCountLimit:(h=(g=e.spanLimits)==null?void 0:g.attributePerLinkCountLimit)==null?128:h},idGenerator:e.idGenerator||new Sc,spanProcessor:this._activeSpanProcessor,meterProvider:(_=e.meterProvider)==null?{getMeter(){return D()}}:_}}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new cc({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(e){var t;let n=(t=e==null?void 0:e.timeoutMillis)==null?this._forceFlushTimeoutMillis:t,r=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(t=>{let r,i=setTimeout(()=>{t(Error(`Span processor did not completed within timeout period of ${n} ms`)),r=Cc.timeout},n);e.forceFlush().then(()=>{clearTimeout(i),r!==Cc.timeout&&(r=Cc.resolved,t(r))}).catch(e=>{clearTimeout(i),r=Cc.error,t(e)})}));return new Promise((e,t)=>{Promise.all(r).then(n=>{let r=n.filter(e=>e!==Cc.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[$s](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return tc(`TracerProvider`,{resource:{attributes:ec(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>{var t,n;return(t=(n=e.constructor)==null?void 0:n.name)==null?`SpanProcessor`:t})},e,t,n)}};_s();let Tc={compression:`gzip`,concurrencyLimit:5,keepalive:!0,timeoutMillis:30*1e3},Ec=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t}),Dc={name:`span`,countItems:e=>e.length},Oc={name:`log`,countItems:e=>e.length};function kc(e,t){let n={attributes:jc(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Ac(e,t){let n={name:e.name,version:e.version};if(e.attributes&&Object.keys(e.attributes).length>0){var r;n.attributes=jc(e.attributes,t),n.droppedAttributesCount=(r=e.droppedAttributesCount)==null?0:r}return n}function jc(e,t){return Object.keys(e).map(n=>Mc(n,e[n],t))}function Mc(e,t,n){return{key:e,value:Nc(t,n)}}function Nc(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=Nc(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:Nc(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function Pc(e,t){return{resourceLogs:Ic(e,t)}}function Fc(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:r}=n,i=t.get(e);i||(i=new Map,t.set(e,i));let a=i.get(r);a||(a=[],i.set(r,a)),a.push(n)}return t}function Ic(e,t){let n=Fc(e);return Array.from(n,([e,n])=>{let r=kc(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:Ac(e[0].instrumentationScope,t),logRecords:e.map(e=>Lc(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Lc(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Rc(e.severityNumber),severityText:e.severityText,body:Nc(e.body,t),eventName:e.eventName,attributes:jc(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:(n=e.spanContext)==null?void 0:n.traceFlags,traceId:t.encodeOptionalSpanContext((r=e.spanContext)==null?void 0:r.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)==null?void 0:i.spanId)}}function Rc(e){return e}B();function zc(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Bc(e){return zc(e).toString()}let Vc=typeof BigInt<`u`?Bc:Ci;function Hc(e){return e}let Uc={encodeHrTime:Vc,encodeSpanContext:Hc,encodeOptionalSpanContext:Hc,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};N();let Wc={serializeRequest:e=>{let t=Pc(e,Uc);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(e){return j.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};function Gc(e,t){let n=e&255|256;return t&&(n|=512),n}function Kc(e,t){var n,r,i,a;let o=e.spanContext(),s=e.status,c=(n=e.parentSpanContext)!=null&&n.spanId?t.encodeSpanContext((r=e.parentSpanContext)==null?void 0:r.spanId):void 0;return{traceId:t.encodeSpanContext(o.traceId),spanId:t.encodeSpanContext(o.spanId),parentSpanId:c,traceState:(i=o.traceState)==null?void 0:i.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:jc(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Jc(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>qc(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Gc(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function qc(e,t){var n;return{attributes:e.attributes?jc(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(n=e.context.traceState)==null?void 0:n.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Gc(e.context.traceFlags,e.context.isRemote)}}function Jc(e,t){return{attributes:e.attributes?jc(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Yc(e,t){return{resourceSpans:Zc(e,t)}}function Xc(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Zc(e,t){let n=Xc(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Kc(e,t));o.push({scope:Ac(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=kc(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}N();let Qc={serializeRequest:e=>{let t=Yc(e,Uc);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(e){return j.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};var $c=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};F();var el=class extends Error{constructor(e,t,n){super(e),P(this,`code`,void 0),P(this,`name`,`OTLPExporterError`),P(this,`data`,void 0),this.data=n,this.code=t}};F(),q();var tl=class{constructor(e){P(this,`_concurrencyLimit`,void 0),P(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var e=this;return K(function*(){yield Promise.all(e._sendingPromises)})()}};function nl(e){return new tl(e.concurrencyLimit)}N();function rl(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function il(){return{handleResponse(e){e==null||!rl(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||j.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}B(),N(),F(),q();var al=class{constructor(e,t,n,r,i,a){P(this,`_metrics`,void 0),P(this,`_diagLogger`,void 0),P(this,`_transport`,void 0),P(this,`_serializer`,void 0),P(this,`_responseHandler`,void 0),P(this,`_promiseQueue`,void 0),P(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=a,this._diagLogger=j.createComponentLogger({namespace:`OTLPExportDelegate`}),this._metrics=i}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:z.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:z.FAILED,error:Error(`Nothing to send`)});return}let r=this._metrics.startExport(e);this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(r(void 0),e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:z.SUCCESS});return}else if(e.status===`failure`&&e.error){r(e.error),t({code:z.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;r(`export_max_retries`),t({code:z.FAILED,error:(n=e.error)==null?new el(`Export failed with retryable status`):n})}else r(`export_failed`),t({code:z.FAILED,error:new el(`Export failed with unknown error`)})},e=>{r(e),t({code:z.FAILED,error:e})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(e){this._metrics=e}shutdown(){var e=this;return K(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function ol(e,t){return new al(e.transport,e.serializer,il(),e.promiseHandler,e.metrics,t.timeout)}function sl(e,t,n,r){return ol({transport:r,serializer:t,promiseHandler:nl(e),metrics:n},{timeout:e.timeoutMillis})}N(),B(),F(),W();let cl=new Map;var ll=class{constructor(e){var t;P(this,`inflight`,void 0),P(this,`exported`,void 0),P(this,`duration`,void 0),P(this,`standardAttrs`,void 0),P(this,`responseAttributesFromError`,void 0),P(this,`helper`,void 0);let{componentType:n,metricsHelper:r,meterProvider:i,url:a,responseAttributesFromError:o}=e;this.responseAttributesFromError=o;let s=i?i.getMeter(`@opentelemetry/otlp-exporter`,`0.223.0`):D(),c=(t=cl.get(n))==null?0:t;if(cl.set(n,c+1),this.standardAttrs={"otel.component.type":n,"otel.component.name":`${n}/${c}`},a){let e=a;a.includes(`://`)||(e=`http://${a}`);try{let t=new URL(e);this.standardAttrs[`server.address`]=t.hostname;let n;t.port?n=Number(t.port):t.protocol===`http:`?n=80:t.protocol===`https:`&&(n=443),typeof n==`number`&&(this.standardAttrs[`server.port`]=n)}catch(e){}}this.helper=r,this.inflight=s.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`}),this.exported=s.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s for which the export has finished, either successful or failed.`}),this.duration=s.createHistogram(`otel.sdk.exporter.operation.duration`,{unit:`s`,description:`The duration of exporting a batch of telemetry records.`,advice:{explicitBucketBoundaries:[]}})}startExport(e){let t=this.helper.countItems(e),n=bi();return this.inflight.add(t,this.standardAttrs),e=>{let r=bi();this.inflight.add(-t,this.standardAttrs);let i=e?U(U({},this.standardAttrs),{},{"error.type":e instanceof Error?e.name:`export_failed`}):this.standardAttrs;this.exported.add(t,i);let a=U(U({},i),this.responseAttributesFromError(e)),o=wi(Si(n,r))/1e3;this.duration.record(o,a)}}};N(),q();let ul=49152,dl=0,fl=0,pl=e=>typeof e==`string`?new TextEncoder().encode(e).byteLength:e.byteLength;function ml(e){return hl.apply(this,arguments)}function hl(){return hl=K(function*(e){try{let{body:t}=e;if(!t)return;let n=t.getReader();try{let e=yield n.read();for(;!e.done;)e=yield n.read()}finally{n.releaseLock()}}catch(e){let t=e instanceof Error?e:Error(String(e));j.debug(`Fetch transport failed to drain response body: ${t.message}`)}}),hl.apply(this,arguments)}function gl(e,t){return _l.apply(this,arguments)}function _l(){return _l=K(function*(e,t){let n,r;if(`timeout`in AbortSignal)n=AbortSignal.timeout(t.timeoutMillis);else{let e=new AbortController;({signal:n}=e),r=setTimeout(()=>{e.abort(new DOMException(`TimeoutError`,`TimeoutError`))},t.timeoutMillis)}let i=pl(t.body),a=!1;if(t.keepalive){let e=dl+i>ul;if(a=!e&&!(fl>=9),a)dl+=i,fl++;else{let t=e?`inflight bytes (${dl} + ${i}) would exceed ${ul}B budget`:`concurrent count (${fl}) at limit of 9`;j.debug(`Sending without keepalive: ${t}`)}}let o=()=>{r!==void 0&&clearTimeout(r)},s=a?()=>{o(),dl-=i,fl--}:o,c;try{c=yield fetch(e,{body:t.body,headers:t.headers,keepalive:a,method:`POST`,signal:n})}catch(e){throw s(),e}return ml(c).finally(s),{keepalive:a,response:c}}),_l.apply(this,arguments)}N(),q(),W();var vl=class e{constructor(e){this._config=e}static _compressRequest(e){return K(function*(){let t=new CompressionStream(`gzip`),n=t.writable.getWriter();n.write(e),n.close();let r=[],i=t.readable.getReader(),a=!1;for(;!a;){let e=yield i.read();e.value&&r.push(e.value),{done:a}=e}let o=new Uint8Array(r.reduce((e,t)=>e+t.length,0)),s=0;for(let e of r)o.set(e,s),s+=e.length;return o})()}send(e,t){return this._asyncSend(e,t)}shutdown(){}_asyncSend(t,n){var r=this;return K(function*(){let i=t,a=U({"Content-Type":`application/json`},r._config.headers),o=!1;try{if(r._config.compression===`gzip`){try{i=yield e._compressRequest(t)}catch(e){let t=e instanceof Error?e:Error(String(e));return j.warn(`Fetch transport gzip compression failed: ${t.message}`),{error:t,status:`failure`}}a[`Content-Encoding`]=`gzip`,a[`Content-Length`]=i.length.toString()}let s=yield gl(r._config.url,{body:i,headers:a,keepalive:!0,timeoutMillis:n});({keepalive:o}=s);let{response:c}=s;if(c.ok)return{status:`success`};let l=Error(`${c.status} Fetch request failed`),u=`Fetch transport received HTTP ${c.status} (keepalive=${o})`;return c.status>=500?(j.debug(u),{error:l,status:`retryable`}):(j.warn(u),{error:l,status:`failure`})}catch(e){let t=e instanceof Error?e:Error(String(e)),n=t instanceof TypeError||t instanceof DOMException&&t.name===`TimeoutError`,r=`Fetch transport failed (keepalive=${o}): ${t.message}`;return n?j.debug(r):j.warn(r),{error:t,status:n?`retryable`:`failure`}}})()}};let yl=e=>new vl(e);q();let bl=()=>Math.random()*40-20;var xl=class{constructor(e,t=new ga){this._transport=e,this._perf=t}send(e,t){var n=this;return K(function*(){let r=n._perf.getNowMillis()+t,i=yield n._transport.send(e,t),a=5,o=1e3;for(;i.status===`retryable`&&a>0;){var s;a--;let t=Math.max(Math.min(o,5e3)+bl(),0);o*=1.5;let c=(s=i.retryInMillis)==null?t:s,l=r-n._perf.getNowMillis();if(c>l)return i;i=yield n._retry(e,l,c)}return i})()}shutdown(){this._transport.shutdown()}_retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}};let Sl=e=>{var t;return new xl(e.transport,(t=e.perf)==null?new ga:t)},Cl=`http.response.status_code`;function wl(e){if(!e)return{[Cl]:200};if(!(e instanceof Error))return{};if(e.message.startsWith(`Fetch request failed with non-retryable status `)){let t=e.message.substring(47);return{[Cl]:Number(t)}}return{}}function Tl(e,t,n){return new ll({componentType:e,metricsHelper:t,url:n,meterProvider:void 0,responseAttributesFromError:wl})}let El=(e,t,n,r)=>sl(e,t,Tl(n,r,e.url),Sl({transport:yl(e)}));var Dl=class extends $c{constructor(e){super(El(e,Wc,`otlp_http_log_exporter`,Oc))}};W();var Ol=class extends Dl{constructor({appId:e,userID:t,collectorUrl:n}){super(U(U({},Tc),{},{headers:Ec(e,t),url:`${n}/v1/logs`}))}};W();var kl=class extends $c{constructor(e){super(El(U(U({},e),{},{compression:`gzip`}),Qc,`otlp_http_span_exporter`,Dc))}};W();var Al=class extends kl{constructor({appId:e,userID:t,collectorUrl:n}){super(U(U({},Tc),{},{headers:Ec(e,t),url:`${n}/v1/traces`}))}};function jl(e){return{isRecording:()=>e.isRecording(),setEnabled:t=>{if(t){e.resume();return}e.pause()}}}W(),q();let Ml=e=>({"mxl-client-id":e}),Nl=0;function Pl(e,t){let n=Date.now();n-Nl<3e4||(Nl=n,console.warn(`[mxl] session replay ${e} failed (dropping; will retry on next chunk):`,t))}function Fl(e){let t=Ml(e.appId),n=e.configUrl,{collectorUrl:r}=e,i=[`${n}/sessionReplays/`,`${n}/sessionEvents`,`${n}/replay`,`${r}/v1/logs`,`${r}/v1/traces`],a=e=>i.some(t=>e.startsWith(t)),o=function(){var e=K(function*(e,r,i,a,o){try{let{response:s}=yield gl(`${n}${r}`,{body:i,headers:U(U({},t),a),keepalive:o,timeoutMillis:1e4});return s.ok?`accepted`:(Pl(e,Error(`HTTP ${s.status}`)),s.status===413?`exhausted`:`rejected`)}catch(t){return Pl(e,t),`failed`}});return function(t,n,r,i,a){return e.apply(this,arguments)}}(),s=function(){var t=K(function*(t=!1){e.apiKey&&(yield o(`replay POST`,`/replay`,`null`,{"content-type":`application/json`,"mxl-api-key":e.apiKey},t))});return function(){return t.apply(this,arguments)}}(),c=function(){var e=K(function*(e,t=!1){yield o(`metadata POST`,`/sessionReplays/meta`,`${JSON.stringify(e)}\n`,{"content-type":`application/x-ndjson`},t)});return function(t){return e.apply(this,arguments)}}();return{postReplay:s,postSessionBlob:(e,t,n=!1)=>o(`blob POST`,`/sessionReplays/blob`,t,{"content-type":`application/octet-stream`,"x-mxl-chunk-seq":String(e.chunkSeq),"x-mxl-duration-ms":String(e.durationMs),"x-mxl-event-count":String(e.eventCount),"x-mxl-is-checkpoint":e.isCheckpoint?`1`:`0`,"x-mxl-session-id":e.sessionId},n),postSessionEvents:function(){var e=K(function*(e,t=!1){e.length!==0&&(yield o(`events POST`,`/sessionEvents`,`${e.map(e=>JSON.stringify(e)).join(`
2
+ `)}\n`,{"content-type":`application/x-ndjson`},t))});return function(t){return e.apply(this,arguments)}}(),postSessionMeta:c,shouldIgnoreUrl:a}}let Il=`mxl_user`,Ll=`mxl_user_id`,Rl=`mxl_external_user_id`,zl=`mxl_profile_snapshot`,Bl=`mxl_session_analytics_prev`;W();let Vl=()=>({avatar:``,email:``,firstName:``,lastName:``,profileId:``,properties:{}});function Hl(e){try{let t=e.getItem(zl);if(!t)return null;let n=JSON.parse(t);if(typeof n==`object`&&n&&typeof n.profileId==`string`)return n}catch(e){}return null}function Ul(e,t){try{return e.setItem(zl,JSON.stringify(t)),!0}catch(e){return!1}}function Wl(e){try{e.removeItem(zl)}catch(e){}}function Gl(e,t){let n=e==null?Vl():e,r=U(U({},n.properties),t.properties);return{avatar:t.avatar===void 0?n.avatar:t.avatar,email:t.email===void 0?n.email:t.email,firstName:t.firstName===void 0?n.firstName:t.firstName,lastName:t.lastName===void 0?n.lastName:t.lastName,profileId:t.profileId,properties:r}}function Kl(e){let t=U({},e.properties);return e.firstName&&(t.first_name=e.firstName),e.lastName&&(t.last_name=e.lastName),e.email&&(t.email=e.email),e.avatar&&(t.avatar=e.avatar),t}F(),W();var ql=class{constructor(){P(this,`_screenViewCount`,0),P(this,`_eventCount`,0),P(this,`_entry`,null),P(this,`_exit`,null),P(this,`_referrer`,``),P(this,`_utm`,{utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``})}recordScreenView(e){this._screenViewCount+=1,this._eventCount+=1,this._entry||(this._entry=U({},e),this._referrer=e.referrer,this._utm={utmCampaign:e.utmCampaign,utmContent:e.utmContent,utmMedium:e.utmMedium,utmSource:e.utmSource,utmTerm:e.utmTerm}),this._exit=U({},e)}recordTrackEvent(){this._eventCount+=1}buildSpanAttributes(e,t){var n,r,i,a,o,s,c,l;let u={"mxl.session.screen_view_count":this._screenViewCount,"mxl.session.event_count":this._eventCount,"mxl.session.profile_id":e,"mxl.session.entry_origin":(n=(r=this._entry)==null?void 0:r.origin)==null?``:n,"mxl.session.entry_path":(i=(a=this._entry)==null?void 0:a.path)==null?``:i,"mxl.session.exit_origin":(o=(s=this._exit)==null?void 0:s.origin)==null?``:o,"mxl.session.exit_path":(c=(l=this._exit)==null?void 0:l.path)==null?``:c,"mxl.session.referrer":this._referrer,"mxl.session.utm_medium":this._utm.utmMedium,"mxl.session.utm_source":this._utm.utmSource,"mxl.session.utm_campaign":this._utm.utmCampaign,"mxl.session.utm_content":this._utm.utmContent,"mxl.session.utm_term":this._utm.utmTerm};return t&&(u[`${L}profile_id`]=t.profileId,u[`${L}screen_view_count`]=t.screenViewCount,u[`${L}event_count`]=t.eventCount,u[`${L}entry_origin`]=t.entryOrigin,u[`${L}entry_path`]=t.entryPath,u[`${L}exit_origin`]=t.exitOrigin,u[`${L}exit_path`]=t.exitPath,u[`${L}referrer`]=t.referrer,u[`${L}utm_medium`]=t.utmMedium,u[`${L}utm_source`]=t.utmSource,u[`${L}utm_campaign`]=t.utmCampaign,u[`${L}utm_content`]=t.utmContent,u[`${L}utm_term`]=t.utmTerm),u}toRowSnapshot(e,t,n){var r,i,a,o,s,c,l,u;return{appId:e,deviceId:n,entryOrigin:(r=(i=this._entry)==null?void 0:i.origin)==null?``:r,entryPath:(a=(o=this._entry)==null?void 0:o.path)==null?``:a,eventCount:this._eventCount,exitOrigin:(s=(c=this._exit)==null?void 0:c.origin)==null?``:s,exitPath:(l=(u=this._exit)==null?void 0:u.path)==null?``:l,profileId:t,referrer:this._referrer,screenViewCount:this._screenViewCount,utmCampaign:this._utm.utmCampaign,utmContent:this._utm.utmContent,utmMedium:this._utm.utmMedium,utmSource:this._utm.utmSource,utmTerm:this._utm.utmTerm}}reset(){this._screenViewCount=0,this._eventCount=0,this._entry=null,this._exit=null,this._referrer=``,this._utm={utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``}}};function Jl(e){try{let t=e.getItem(Bl);return t?JSON.parse(t):null}catch(e){return null}}function Yl(e,t){try{e.setItem(Bl,JSON.stringify(t))}catch(e){}}function Xl(e){try{e.removeItem(Bl)}catch(e){}}function Zl(e,t=document.referrer){let n=``,r=e,i=``,a=``,o=``,s=``,c=``;try{var l,u,d,f,p;let t=new URL(e,window.location.origin);n=t.origin,r=`${t.pathname}${t.search}${t.hash}`,i=(l=t.searchParams.get(`utm_medium`))==null?``:l,a=(u=t.searchParams.get(`utm_source`))==null?``:u,o=(d=t.searchParams.get(`utm_campaign`))==null?``:d,s=(f=t.searchParams.get(`utm_content`))==null?``:f,c=(p=t.searchParams.get(`utm_term`))==null?``:p}catch(e){}return{origin:n,path:r,referrer:t,utmCampaign:o,utmContent:s,utmMedium:i,utmSource:a,utmTerm:c}}N(),H(),F(),W();var Ql=class{constructor({appId:e,diag:t,loggerProvider:n,pageManager:r,storage:i=window.localStorage,userManager:a,userSessionManager:o}){P(this,`_diag`,void 0),P(this,`_logger`,void 0),P(this,`_appId`,void 0),P(this,`_userManager`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_pageManager`,void 0),P(this,`_storage`,void 0),P(this,`_sessionAnalytics`,new ql),P(this,`_lastScreenViewPath`,null),P(this,`_screenViewTimer`,null);let s=n==null?Fa:n;this._diag=t==null?j.createComponentLogger({namespace:`MXLAnalyticsManager`}):t,this._appId=e,this._userManager=a,this._userSessionManager=o,this._pageManager=r,this._storage=i,this._logger=s.getLogger(`mxl-web-sdk-analytics`)}getSessionAnalyticsState(){return this._sessionAnalytics}track(e,t={}){if(typeof e!=`string`||!e.trim()){this._diag.warn(`track name must be a non-empty string`);return}this._sessionAnalytics.recordTrackEvent(),this._emitAnalyticsLog(`track`,e.trim(),t.properties)}identify(e){var t,n,r,i,a,o;if(!((t=e.profileId)!=null&&t.trim())){this._diag.warn(`identify requires profileId`);return}let s=Gl(Hl(this._storage),{avatar:(n=e.avatar)==null?``:n,email:(r=e.email)==null?``:r,firstName:(i=e.firstName)==null?``:i,lastName:(a=e.lastName)==null?``:a,profileId:e.profileId.trim(),properties:(o=e.properties)==null?{}:o});Ul(this._storage,s)||this._diag.warn(`Failed to persist profile snapshot`),this._userManager.setUserId(s.profileId);let c=Kl(s);this._emitAnalyticsLog(`identify`,`identify`,c,s.profileId)}increment({property:e,value:t=1}){var n;let r=this._resolveProfileId();if(!r){this._diag.warn(`increment requires an identified profile`);return}let i=Hl(this._storage),a=Number.parseFloat((n=i==null?void 0:i.properties[e])==null?`0`:n),o=Number.isFinite(a)?a+t:t,s=Gl(i,{profileId:r,properties:U(U({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});Ul(this._storage,s),this._emitAnalyticsLog(`increment`,e,{counter_name:e,counter_value:String(o)},r)}decrement({property:e,value:t=1}){var n;let r=this._resolveProfileId();if(!r){this._diag.warn(`decrement requires an identified profile`);return}let i=Hl(this._storage),a=Number.parseFloat((n=i==null?void 0:i.properties[e])==null?`0`:n),o=Number.isFinite(a)?a-Math.abs(t):-Math.abs(t),s=Gl(i,{profileId:r,properties:U(U({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});Ul(this._storage,s),this._emitAnalyticsLog(`decrement`,e,{counter_name:e,counter_value:String(o)},r)}clear(){Wl(this._storage),this._userManager.clearUserId()}screenView(){this._screenViewTimer&&clearTimeout(this._screenViewTimer),this._screenViewTimer=setTimeout(()=>{this._screenViewTimer=null,this._emitScreenView()},50)}buildSessionPartAnalyticsAttributes(){var e,t;let n=Jl(this._storage),r=this._userManager.getMXLUserId(),i=(e=this._resolveProfileId())==null?r:e,a=this._sessionAnalytics.buildSpanAttributes(i,n);return a[`mxl.visitor.is_new`]=((t=this._userSessionManager.getUserSessionAttributes())==null?void 0:t[lr])===1,a[`browser.language`]=navigator.language||``,a}finalizeSessionPartAnalytics(){var e;let t=this._userManager.getMXLUserId(),n=(e=this._resolveProfileId())==null?t:e,r=this._sessionAnalytics.toRowSnapshot(this._appId,n,t);Yl(this._storage,r)}resetSessionAnalyticsForNewUserSession(){this._sessionAnalytics.reset(),Xl(this._storage),this._lastScreenViewPath=null}_emitScreenView(){var e,t;let n=this._pageManager.getCurrentRoute(),r=(e=n==null?void 0:n.url)==null?window.location.href:e,i=(t=n==null?void 0:n.path)==null?window.location.pathname:t;if(this._lastScreenViewPath===i)return;this._lastScreenViewPath=i;let a=Zl(r);this._sessionAnalytics.recordScreenView(a),this._emitAnalyticsLog(`screen_view`,`screen_view`)}_emitAnalyticsLog(e,t,n={},r){var i,a,o,s,c,l;let u=this._pageManager.getCurrentRoute(),d=(i=u==null?void 0:u.url)==null?window.location.href:i,f=(a=u==null?void 0:u.path)==null?window.location.pathname:a,p=(o=(s=this._pageManager.getPageLabel())==null?document.title:s)==null?``:o,m=``;try{m=new URL(d,window.location.origin).origin}catch(e){m=window.location.origin}let h=this._userManager.getMXLUserId(),g=(c=r==null?this._resolveProfileId():r)==null?h:c,_=(l=this._userSessionManager.getUserSessionId())==null?``:l,v={"mxl.analytics.kind":e,"mxl.analytics.name":t,[ur]:this._appId,"mxl.device.id":h,"mxl.profile.id":g,"mxl.session.id":_,[rr]:f,"mxl.page.url":d,"mxl.page.origin":m,"mxl.page.title":p,"mxl.page.referrer":document.referrer};for(let[e,t]of Object.entries(n))t!=null&&(v[`mxl.event.property.${e}`]=String(t));this._logger.emit({attributes:v,body:t,severityNumber:V.INFO,severityText:`INFO`})}_resolveProfileId(){let e=this._userManager.getUserId();if(e)return e;let t=Hl(this._storage);return(t==null?void 0:t.profileId)||null}};let $l=`http.response.body.size`,eu=`log.record.uid`,tu=`user.id`,nu=new Uint8Array(16),ru=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),iu=()=>{crypto.getRandomValues(nu);let e=``;for(let t=0;t<16;t++)e+=ru[nu[t]];return e},au=`0.1.2`,ou=`mxl_app_instance_id`,su=(e,t)=>{let n=null;try{n=e.getItem(ou)}catch(e){t.warn(`Failed to retrieve app instance ID from session storage`,e)}if(!n){t.debug(`No existing app instance ID found in session storage, creating a new one`),n=iu();try{e.setItem(ou,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n};R(),W();let cu=`unknown_service`,lu=({serviceName:e})=>Ss({[ti]:e}),uu=({diagLogger:e,appVersion:t,pageSessionStorage:n,appId:r,enduserPseudoId:i})=>{var a;let o=window.navigator;return Ss(U(U({[ii]:`mxl-web-sdk`,app_version:t,app_framework:1,sdk_version:au,[ai]:au,sdk_simple_version:1,sdk_platform:`web`,[ni]:`webjs`,"mxl.app_instance_id":su(n,e),[li]:o.userAgent,screen_resolution:`${window.screen.width}x${window.screen.height}`,viewport_resolution:`${window.innerWidth}x${window.innerHeight}`,network_effective_type:(a=o.connection)==null?void 0:a.effectiveType,device_memory:o.deviceMemory,webdriver:o.webdriver},i?{"enduser.pseudo.id":i}:{}),r?{[ur]:r}:{}))},du={networkSpansForwardingThreshold:0,samplingPct:100},fu=`mxl_remote_config`,pu=(e,t,{osVersion:n,appVersion:r,deviceId:i})=>`${e}/config?${new URLSearchParams({appId:t,osVersion:n,appVersion:r,deviceId:i}).toString()}`,mu=e=>typeof e==`object`&&!!e&&!Array.isArray(e),hu=(e,t,n)=>{let r=e[t];if(typeof r==`number`)return r;let i=e[n];if(typeof i==`number`)return i},gu=(e,t,n)=>{let r=e[t];if(typeof r==`boolean`)return r;let i=e[n];if(typeof i==`boolean`)return i},_u=(e,t,n)=>{let r=e[t];if(typeof r==`string`)return r;let i=e[n];if(typeof i==`string`)return i},vu=e=>{if(!mu(e))return;let t={},n=hu(e,`maxDurationSeconds`,`max_duration_seconds`);n!==void 0&&(t.maxDurationSeconds=n);let r=hu(e,`inactivityTimeoutSeconds`,`inactivity_timeout_seconds`);r!==void 0&&(t.inactivityTimeoutSeconds=r);let i=hu(e,`foregroundInactivityTimeoutSeconds`,`foreground_inactivity_timeout_seconds`);return i!==void 0&&(t.foregroundInactivityTimeoutSeconds=i),t},yu=e=>{if(!mu(e))return;let t={},n=hu(e,`pctEnabled`,`pct_enabled`);n!==void 0&&(t.pctEnabled=n);let r=hu(e,`sampleRate`,`sample_rate`);r!==void 0&&(t.sampleRate=r);let i=gu(e,`maskAllInputs`,`mask_all_inputs`);i!==void 0&&(t.maskAllInputs=i);let a=gu(e,`maskAllText`,`mask_all_text`);a!==void 0&&(t.maskAllText=a);let o=hu(e,`flushIntervalMs`,`flush_interval_ms`);o!==void 0&&(t.flushIntervalMs=o);let s=gu(e,`omitRedundantInstrumentations`,`omit_redundant_instrumentations`);s!==void 0&&(t.omitRedundantInstrumentations=s);let c=gu(e,`debug`,`debug`);return c!==void 0&&(t.debug=c),Object.keys(t).length>0?t:void 0},bu=e=>{var t,n,r;if(!mu(e))throw TypeError(`Remote config must be an object`);let i=e.threshold;if(typeof i!=`number`)throw TypeError(`Remote config threshold must be a number`);let a={threshold:i},o=(t=e.networkSpanForwarding)==null?e.network_span_forwarding:t;if(mu(o)){let e=hu(o,`pctEnabled`,`pct_enabled`);e!==void 0&&(a.networkSpanForwarding={pctEnabled:e})}let s=hu(e,`emptySessionAvoidanceEnabledPct`,`empty_session_avoidance_enabled_pct`);s!==void 0&&(a.emptySessionAvoidanceEnabledPct=s);let c=_u(e,`serviceName`,`service_name`);c!==void 0&&(a.serviceName=c);let l=yu((n=e.sessionReplay)==null?e.session_replay:n);l!==void 0&&(a.sessionReplay=l);let u=vu((r=e.userSession)==null?e.user_session:r);return u!==void 0&&(a.userSession=u),a};N(),W(),F(),q();let xu=e=>{var t,n,r;let i={samplingPct:e.threshold};return e.networkSpanForwarding!==void 0&&(i.networkSpansForwardingThreshold=e.networkSpanForwarding.pctEnabled),e.serviceName!==void 0&&e.serviceName!==``&&(i.serviceName=e.serviceName),e.emptySessionAvoidanceEnabledPct!==void 0&&(i.emptySessionAvoidanceEnabledPct=e.emptySessionAvoidanceEnabledPct),e.sessionReplay!==void 0&&(i.replay=U({},e.sessionReplay)),((t=e.userSession)==null?void 0:t.maxDurationSeconds)!==void 0&&(i.userSessionMaxDurationSeconds=e.userSession.maxDurationSeconds),((n=e.userSession)==null?void 0:n.inactivityTimeoutSeconds)!==void 0&&(i.userSessionInactivityTimeoutSeconds=e.userSession.inactivityTimeoutSeconds),((r=e.userSession)==null?void 0:r.foregroundInactivityTimeoutSeconds)!==void 0&&(i.userSessionForegroundInactivityTimeoutSeconds=e.userSession.foregroundInactivityTimeoutSeconds),i};var Su=class{constructor({appId:e,appVersion:t,deviceId:n,diag:r=j.createComponentLogger({namespace:`mxl-config-manager`}),storage:i,defaultConfig:a={},configUrl:o}){P(this,`_remoteConfigURL`,null),P(this,`_diag`,void 0),P(this,`_storage`,void 0),P(this,`_baseConfig`,void 0),P(this,`_sdkConfig`,void 0),P(this,`_etag`,null),P(this,`_remoteSourceServiceName`,void 0),e&&t&&n&&o&&(this._remoteConfigURL=pu(o,e,{appVersion:t,deviceId:n,osVersion:`1`})),this._diag=r,this._storage=i;let s=this._getRemoteConfigFromStorage();s&&(this._etag=s.etag,this._captureRemoteServiceName(s.config)),this._baseConfig=U(U({},du),a),this._sdkConfig=U(U({},this._baseConfig),s?xu(s.config):{})}setConfig(e){this._sdkConfig=U(U({},this._sdkConfig),e)}getConfig(){return this._sdkConfig}resolveApplicationServiceName(e){var t,n;return((t=this._remoteSourceServiceName)==null?void 0:t.trim())||(e==null?void 0:e.trim())||((n=this._baseConfig.serviceName)==null?void 0:n.trim())||cu}_captureRemoteServiceName(e){if(e.serviceName===void 0)return;let t=e.serviceName.trim();this._remoteSourceServiceName=t.length>0?t:void 0}refreshRemoteConfig(){var e=this;return K(function*(){if(e._remoteConfigURL)try{let t=yield e._fetchRemoteConfig(e._remoteConfigURL);if(!t){e._diag.debug(`No changes in remote config, skipping update`);return}let[n,r]=t;e._captureRemoteServiceName(n),e._storage.setItem(fu,JSON.stringify({config:n,etag:r})),e._sdkConfig=U(U({},e._baseConfig),xu(n)),e._etag=r}catch(t){e._diag.warn(`Failed to refresh remote config: ${t instanceof Error?t.message:String(t)}`)}})()}_getRemoteConfigFromStorage(){try{let e=this._storage.getItem(fu);if(e){let t=JSON.parse(e);return{config:bu(t.config),etag:t.etag}}return null}catch(e){return this._diag.warn(`Failed to parse remote config from storage: ${e instanceof Error?e.message:String(e)}`),null}}_fetchRemoteConfig(e){var t=this;return K(function*(){let n=yield fetch(e,{headers:t._etag?{"If-None-Match":t._etag}:{}}),r=n.headers.get(`etag`);return n.status===304?null:n.ok?[bu(yield n.json()),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};W();function Cu({autoStart:e,replay:t,dynamicConfig:n,isSessionReplayEnabled:r}){if(!r)return{autoStart:!1,replay:t};let i=n.replay;if(!i)return{autoStart:e,replay:t};let a=U({},t);return i.sampleRate!==void 0&&(a.sampleRate=i.sampleRate),i.maskAllInputs!==void 0&&(a.maskAllInputs=i.maskAllInputs),i.maskAllText!==void 0&&(a.maskAllText=i.maskAllText),i.flushIntervalMs!==void 0&&(a.flushIntervalMs=i.flushIntervalMs),i.omitRedundantInstrumentations!==void 0&&(a.omitRedundantInstrumentations=i.omitRedundantInstrumentations),i.debug!==void 0&&(a.debug=i.debug),{autoStart:e,replay:a}}let wu={maxAllowed:{breadcrumb:100,element_timing:500,error_log:500,exception:500,info_log:100,network_request:1e4,server_timing:500,session_property:100,span:1e3,user_timing_mark:500,user_timing_measure:500,soft_navigation:100,warning_log:200},maxAttributes:{error_log:50,exception:50,info_log:50,warning_log:50},maxLength:{breadcrumb:256,error_log:4e3,exception:1024,exception_attribute_key:128,exception_attribute_value:256,info_log:4e3,log_attribute_key:128,log_attribute_value:256,session_property_key:128,session_property_value:256,warning_log:4e3}};N(),F();let Tu={error:`error_log`,info:`info_log`,warning:`warning_log`};var Eu=class{constructor({diag:e,maxAllowed:t,maxLength:n,maxAttributes:r}){P(this,`_diag`,void 0),P(this,`_diagnosticCounts`,{}),P(this,`_currentCount`,{breadcrumb:0,element_timing:0,error_log:0,exception:0,info_log:0,network_request:0,server_timing:0,session_property:0,span:0,user_timing_mark:0,user_timing_measure:0,soft_navigation:0,warning_log:0}),P(this,`_maxAllowed`,void 0),P(this,`_maxLength`,void 0),P(this,`_maxAttributes`,void 0),this._diag=e==null?j.createComponentLogger({namespace:`MXLLimitManager`}):e,this._maxAllowed=t,this._maxLength=n,this._maxAttributes=r}_dropIfMaxReached(e){return this._currentCount[e]>=this._maxAllowed[e]?(this._diag.warn(`disallowing ${e} because the maximum number of ${this._maxAllowed[e].toString()} has already been reached for this session`),this._incrDiagnosticCount(e,`drop`),!0):(this._currentCount[e]=(this._currentCount[e]||0)+1,!1)}truncateString(e,t){return t.length>this._maxLength[e]?(this._diag.warn(`truncating ${e} because it is longer than ${this._maxLength[e].toString()} characters: "${t}"`),this._incrDiagnosticCount(e,`truncate_string`),t.substring(0,this._maxLength[e])):t}_truncateAttributes(e,t,n,r){let i=Object.keys(t);i.length>this._maxAttributes[e]&&(this._diag.warn(`truncating ${e} attributes because there are more than ${this._maxAttributes[e].toString()} set`),this._incrDiagnosticCount(e,`truncate_attributes`));let a={};for(let s=0;s<Math.min(i.length,this._maxAttributes[e]);s++){var o;let e=this.truncateString(n,i[s]);a[e]=this.truncateString(r,((o=t[i[s]])==null?void 0:o.toString())||``)}return a}limitBreadcrumb(e){return this._dropIfMaxReached(`breadcrumb`)?`dropped`:{name:this.truncateString(`breadcrumb`,e)}}limitException(e,t){return this._dropIfMaxReached(`exception`)?`dropped`:{attributes:this._truncateAttributes(`exception`,t,`exception_attribute_key`,`exception_attribute_value`),message:this.truncateString(`exception`,e)}}limitLog(e,t,n){let r=Tu[t];return this._dropIfMaxReached(r)?`dropped`:{attributes:this._truncateAttributes(r,n,`log_attribute_key`,`log_attribute_value`),message:this.truncateString(r,e)}}limitSessionProperty(e,t){return this._dropIfMaxReached(`session_property`)?`dropped`:{key:this.truncateString(`session_property_key`,e),value:this.truncateString(`session_property_value`,t)}}limitElementTimingEntry(){return this._dropIfMaxReached(`element_timing`)}limitServerTimingEntry(){return this._dropIfMaxReached(`server_timing`)}limitUserTimingEntry(e){return this._dropIfMaxReached(e===`mark`?`user_timing_mark`:`user_timing_measure`)}limitSoftNavigationEntry(){return this._dropIfMaxReached(`soft_navigation`)}dropReadableSpan(e){let t=e.attributes[`mxl.type`]===`perf.network_request`?`network_request`:`span`;return this._dropIfMaxReached(t)}reset(){this._diagnosticCounts={},this._currentCount={breadcrumb:0,element_timing:0,error_log:0,exception:0,info_log:0,network_request:0,server_timing:0,session_property:0,span:0,user_timing_mark:0,user_timing_measure:0,soft_navigation:0,warning_log:0}}_incrDiagnosticCount(e,t){let n=`mxl.app.applied_limit.${e}.${t}.count`;this._diagnosticCounts[n]=(this._diagnosticCounts[n]||0)+1}getDiagnosticCounts(){return this._diagnosticCounts}};let Du=(e,t,n)=>{try{let r=e.getItem(t),i=r?parseInt(r,10):0;return Number.isNaN(i)&&(n.warn(`Non-numeric value stored at ${t} (${String(r)}); resetting counter.`),i=0),i++,e.setItem(t,i.toString()),i}catch(e){return n.warn(`Failed to retrieve ${t} from storage: `,e),1}},Ou=e=>e.visibilityState===`hidden`?`background`:`foreground`,ku=globalThis;N(),H(),R(),F(),sn(),W();let Au=()=>JSON.stringify(ku._MXLFileBundleIDs||{}),ju=(e,t,n)=>`${e}\n${t}\n${n}`,Mu=e=>{if(!(e instanceof Error)||e.cause==null)return``;let t=[],n=new Set,r=e.cause,i=0;for(;r!=null&&i<5&&!n.has(r);){if(n.add(r),r instanceof Error)t.push(`${r.name}: ${r.message}`),r=r.cause;else{t.push(String(r));break}i+=1}return t.join(`, `)};var Nu=class e{constructor({diag:e,perf:t,userSessionManager:n,limitManager:r,loggerProvider:i,visibilityDoc:a,storage:o,exception:s}){var c,l;P(this,`_diag`,void 0),P(this,`_perf`,void 0),P(this,`_logger`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_limitManager`,void 0),P(this,`_visibilityDoc`,void 0),P(this,`_storage`,void 0),P(this,`_filters`,void 0),P(this,`_dedupWindowMs`,void 0),P(this,`_dedupLastSeen`,new Map);let u=i==null?Fa:i;this._diag=e==null?j.createComponentLogger({namespace:`MXLLogManager`}):e,this._perf=t,this._logger=u.getLogger(`mxl-web-sdk-logs`),this._userSessionManager=n,this._limitManager=r,this._visibilityDoc=a,this._storage=o,this._filters=[...(c=s==null?void 0:s.filters)==null?[]:c],this._dedupWindowMs=(l=s==null?void 0:s.dedupWindowMs)==null?1e3:l}addExceptionFilter(e){this._filters.push(e)}captureException(e,t){this.logException(e,t)}_validateAttributes(e){return Object.prototype.toString.call(e)===`[object Object]`?e:(this._diag.warn(`attributes must be a plain object`,e),{})}static _logSeverityToSeverityNumber(e){switch(e){case`info`:return V.INFO;case`warning`:return V.WARN;default:return V.ERROR}}logException(t,{handled:n=!0,attributes:r={},timestamp:i=this._perf.getNowMillis(),handler:a=`manual`}={}){var o;if(!this._passesFilters(t))return;let s=this._validateAttributes(r),c=(t==null||(o=t.constructor)==null?void 0:o.name)||typeof t,l=``,u=c,d=``;if(t instanceof Error)l=String(t.message||``).trim(),u=t.name||``,d=t.stack||``;else if(t&&typeof t==`object`)try{l=JSON.stringify(t)}catch(e){l=String(t).trim()}else l=String(t).trim();if(this._isDuplicate(u,l,d,i))return;n||this._userSessionManager.incrSessionPartCountForKey(`mxl.unhandled_exceptions_count`);let{[Qn]:f}=s,p=Uo(s,[Qn].map(on)),m=this._limitManager.limitException(l,p);m!==`dropped`&&this._logger.emit({attributes:U(U(U({},m.attributes),f===void 0?{}:{[Qn]:String(f)}),{},{[I]:`sys.exception`,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":Mu(t),[Yr]:c,"exception.name":u,[qr]:m.message,[Jr]:d,[er]:Au(),[Zn]:Ou(this._visibilityDoc),"mxl.exception_number":Du(this._storage,`mxl_exception_number`,this._diag)}),body:m.message,eventName:`mxl-exception`,severityNumber:V.ERROR,severityText:`ERROR`,timestamp:i})}message(e,t,{attributes:n={},includeStacktrace:r=!0,stacktrace:i}={}){if(typeof e!=`string`||!e.trim()){this._diag.warn(`Message must be a non-empty string`);return}if(![`info`,`warning`,`error`].includes(t)){this._diag.warn(`Severity must be info, warning, or error`);return}let a=this._validateAttributes(n);t===`error`&&this._userSessionManager.incrSessionPartCountForKey(`mxl.error_log_count`);let o=``;t!==`info`&&(typeof i==`string`?o=i:r&&(o=Error().stack||``)),this._logMessage({attributes:a,message:e.trim(),severity:t,stack:o,timestamp:this._perf.getNowMillis()})}_logMessage({message:t,severity:n,timestamp:r,attributes:i={},stack:a}){let o=this._limitManager.limitLog(t,n,i);o!==`dropped`&&this._logger.emit({attributes:U(U(U({},o.attributes),{},{[I]:`sys.log`},a?{"mxl.stacktrace.js":a,[er]:Au()}:{}),{},{[Zn]:Ou(this._visibilityDoc)}),body:o.message,eventName:`mxl-log`,severityNumber:e._logSeverityToSeverityNumber(n),severityText:n.toUpperCase(),timestamp:r})}_passesFilters(e){for(let t of this._filters)try{if(!t(e))return!1}catch(e){this._diag.warn(`exception filter threw`,e instanceof Error?e.message:e)}return!0}_isDuplicate(e,t,n,r){if(this._dedupWindowMs<=0)return!1;let i=ju(e,t,n),a=this._dedupLastSeen.get(i);return a!==void 0&&r-a<this._dedupWindowMs?!0:(this._dedupLastSeen.set(i,r),!1)}static _exceptionHandlingType(e,t){return e?`handled`:t===`global_exception`?`unhandled_error`:t===`promise_rejection`?`unhandled_rejection`:`unhandled`}};N(),F();var Pu=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document,diag:n,navigationHost:r=window,userSessionManager:i,perf:a=new ga}={}){var o;P(this,`_currentRoute`,null),P(this,`_currentPageId`,null),P(this,`_pageLabel`,null),P(this,`_titleDocument`,void 0),P(this,`_useDocumentTitleAsPageLabel`,void 0),P(this,`_routeChangedListeners`,[]),P(this,`_diag`,void 0),P(this,`_navigationHost`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_perf`,void 0),P(this,`getCurrentPageId`,()=>this._currentPageId),P(this,`getCurrentRoute`,()=>this._currentRoute),P(this,`setPageLabel`,e=>{this._pageLabel=e}),P(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),P(this,`setCurrentRoute`,e=>{(!this._currentRoute||this._currentRoute.url!==e.url)&&(this._currentPageId=iu()),this._currentRoute=e,e.label?this._pageLabel=e.label:this._pageLabel=null;for(let t of this._routeChangedListeners)try{t(e)}catch(e){this._diag.warn(`Error while executing route changed listener`,e)}}),P(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),P(this,`addRouteChangedListener`,e=>(this._routeChangedListeners.push(e),()=>{let t=this._routeChangedListeners.indexOf(e);t!==-1&&this._routeChangedListeners.splice(t,1)})),P(this,`_onSoftNavigation`,e=>{var t;e.from.url!==this._navigationHost.location.href&&(ha(this._perf.epochMillisFromOriginOffset(e.timeStamp)),(t=this._userSessionManager)==null||t.rolloverSessionPartInternal({endReason:`web_soft_navigation`,startReason:`web_soft_navigation`}),this._setRouteFromCurrentLocation(),xn.screenView())}),P(this,`_setRouteFromCurrentLocation`,()=>{let e=this._navigationHost.location.pathname;this.setCurrentRoute({path:e,url:e})}),this._useDocumentTitleAsPageLabel=e,this._titleDocument=t,this._diag=n==null?j.createComponentLogger({namespace:`MXLPageManager`}):n,this._navigationHost=r,this._userSessionManager=i,this._perf=a,(o=this._navigationHost.navigation)==null||o.addEventListener(`currententrychange`,this._onSoftNavigation),this._setRouteFromCurrentLocation()}};let Fu=(e,t)=>!t||t<=0||t>100?!1:t>=Iu(e),Iu=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100};F();var Lu=class{constructor({dynamicConfigManager:e,deviceId:t,blockNetworkSpanForwarding:n}){P(this,`_dynamicConfigManager`,void 0),P(this,`_deviceId`,void 0),P(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=e,this._deviceId=t,this._blockNetworkSpanForwarding=n}isSDKEnabled(){let e=this._dynamicConfigManager.getConfig();return Fu(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return Fu(this._deviceId,e.networkSpansForwardingThreshold)}isSessionReplayEnabled(){var e,t;let n=(e=(t=this._dynamicConfigManager.getConfig().replay)==null?void 0:t.pctEnabled)==null?100:e;return Fu(this._deviceId,n)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return Fu(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};F(),sn();var Ru=class{constructor(e){P(this,`_span`,void 0),this._span=e}get attributes(){return this._span.attributes}addEvent(e,t,n){return this._span.addEvent(e,t,n),this}addLink(e){return this._span.addLink(e),this}addLinks(e){return this._span.addLinks(e),this}end(e){this._span.end(e)}isRecording(){return this._span.isRecording()}recordException(e,t){this._span.recordException(e,t)}setAttribute(e,t){return this._span.setAttribute(e,t),this}setAttributes(e){return this._span.setAttributes(e),this}removeAttribute(e){let t=this._span.attributes,{[e]:n}=t,r=Uo(t,[e].map(on));return this._span.attributes=r,this}setStatus(e){return this._span.setStatus(e),this}spanContext(){return this._span.spanContext()}updateName(e){return this._span.updateName(e),this}fail(e={code:`failure`}){e.code&&this._span.setAttribute(`mxl.error_code`,e.code.toUpperCase()),this._span.end(e.endTime)}};N(),F();var zu=class{constructor({tracerProvider:e}={}){P(this,`_tracer`,void 0),P(this,`setSpan`,M.setSpan);let t=e==null?M:e;this._tracer=t.getTracer(`mxl-web-sdk-traces`)}startSpan(e,t={},n){t.attributes=t.attributes?t.attributes:{},t.attributes[I]=`perf`;let r=t.parentSpan?M.setSpan(A.active(),t.parentSpan):n;return new Ru(this._tracer.startSpan(e,t,r))}getSpan(e){let t=M.getSpan(e);if(t)return new Ru(t)}};let Bu=e=>typeof e[`enduser.pseudo.id`]==`string`&&e[`enduser.pseudo.id`].length===32,Vu=e=>typeof e==`string`&&e.length===32;N(),F();var Hu=class{constructor({diag:e,storage:t}){P(this,`_diag`,void 0),P(this,`_storage`,void 0),P(this,`_mxlUserId`,null),this._diag=e==null?j.createComponentLogger({namespace:`MXLUserManager`}):e,this._storage=t,this._migrateOldLocalStorageKey(),this._initialSetup()}getMXLUserId(){return this._mxlUserId||this._generateNewMXLUserId()}setMXLUserId(e){this._mxlUserId=e;try{this._storage.setItem(Ll,e)}catch(e){this._diag.warn(`Failed to persist user object for storage, keeping it in-memory only`,e)}}clearMXLUserId(){this._mxlUserId=null;try{this._storage.removeItem(Ll)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(Il);if(e){let t=JSON.parse(e);Bu(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(Ll,t[`enduser.pseudo.id`]),this._storage.removeItem(Il)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(Il))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(Ll);e?Vu(e)?this._mxlUserId=e:(this._diag.warn(`Invalid mxl user id, generating a new one`),this.clearMXLUserId()):this._diag.debug(`No existing user found in storage, creating a new one`)}catch(e){this._diag.warn(`Failed to get mxl user id from storage, defaulting to a new one`,e)}this._mxlUserId||(this._mxlUserId=this._generateNewMXLUserId())}_generateNewMXLUserId(){let e=iu();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(Rl)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(Rl,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(Rl)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let Uu=({diag:e,value:t,defaultValue:n,min:r,max:i})=>t===void 0?n:Number.isFinite(t)?t<r||t>i?(e==null||e.warn(`value (${t.toString()}) is outside the allowed range [${r.toString()}, ${i.toString()}]; falling back to default (${n.toString()}).`),n):t:(e==null||e.warn(`value is not a finite number; falling back to default (${n.toString()}).`),n),Wu=e=>e.visibilityState===`visible`&&e.hasFocus(),Gu=(e,t=1e3)=>{let n=!1,r=null,i=((...i)=>{n||(e(...i),n=!0,r=setTimeout(()=>{n=!1,r=null},t))});return i.cancel=()=>{r!==null&&(clearTimeout(r),r=null),n=!1},i},Ku=`mxl_user_session_state`,qu=`mxl_permanent_properties`,Ju=`mxl_last_end_user_session_ts`,Yu=`mxl_tab`,Xu=`mxl_tab_activity`,Zu=1800,Qu=new Set([`user_session_ended`,`web_foreground_inactivity`]),$u=[`keydown`,`mousedown`,`mousemove`,`scroll`],ed=({target:e,visibilityDoc:t,activityEvents:n,onActivity:r,onVisibilityChange:i,onFocus:a,onBlur:o,onPageShow:s,onPageHide:c})=>{var l;for(let t of n)e.addEventListener(t,r);(l=t.addEventListener)==null||l.call(t,`visibilitychange`,i),e.addEventListener(`focus`,a),e.addEventListener(`blur`,o),e.addEventListener(`pageshow`,s),e.addEventListener(`pagehide`,c)},td=({target:e,visibilityDoc:t,activityEvents:n,onActivity:r,onVisibilityChange:i,onFocus:a,onBlur:o,onPageShow:s,onPageHide:c})=>{var l;for(let t of n)e.removeEventListener(t,r);(l=t.removeEventListener)==null||l.call(t,`visibilitychange`,i),e.removeEventListener(`focus`,a),e.removeEventListener(`blur`,o),e.removeEventListener(`pageshow`,s),e.removeEventListener(`pagehide`,c)};W();let nd=(e,t)=>t<e.userSessionStartTs||t>=e.userSessionMaxEndTs||e.inactivityDeadlineTs!==null&&t>=e.inactivityDeadlineTs,rd=({now:e,previousUserSessionId:t,maxUserSessionDurationSeconds:n,inactivityTimeoutSeconds:r,foregroundInactivityTimeoutSeconds:i,userSessionNumber:a})=>({foregroundInactivityTimeoutSeconds:i,inactivityDeadlineTs:null,inactivityTimeoutSeconds:r,maxUserSessionDurationSeconds:n,previousUserSessionId:t,replayMetaVersion:0,replaySampled:null,schemaVersion:3,userSessionId:iu(),userSessionMaxEndTs:e+n*1e3,userSessionNumber:a,userSessionPartIndex:0,userSessionProperties:{},userSessionStartTs:e}),id=e=>typeof e==`object`&&e?e.schemaVersion:void 0,ad=e=>U(U({},e),{},{foregroundInactivityTimeoutSeconds:e.inactivityTimeoutSeconds,schemaVersion:3}),od=e=>ad(U(U({},e),{},{replayMetaVersion:2,replaySampled:null})),sd=e=>{switch(id(e)){case 3:return e;case 2:return ad(e);case 1:return od(e);default:return null}},cd=(e,t)=>{let n=e.getItem(Ku);if(!n)return null;try{let e=sd(JSON.parse(n));if(!e)throw Error(`stored user session state failed structural validation`);return e}catch(n){return t.error(`User session state in storage is corrupt; discarding it`,n),e.removeItem(Ku),null}},ld=(e,t)=>{let n=e.getItem(qu);if(!n)return{};try{let e=JSON.parse(n);if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`permanent properties blob is not a plain object`);let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}catch(n){return t.error(`Permanent properties in storage are corrupt; discarding`,n),e.removeItem(qu),{}}},ud=(e,t)=>Object.keys(t).length===0?e.removeItem(qu):e.setItem(qu,JSON.stringify(t)),dd=e=>{if(!e)return{isSameOrigin:!1,isValid:!1};try{let t=new URL(e),n=window.location.origin;return{isSameOrigin:t.origin===n,isValid:!0,scrubbedUrl:t.origin+t.pathname}}catch(e){return{isSameOrigin:!1,isValid:!1}}},fd=(e,t,n)=>{try{let e=t.getEntriesByType(`navigation`);if(e.length>0&&e[0]){let t=e[0];if(t.type===`reload`)return`reload`;if(t.type===`back_forward`)return`back_forward`}}catch(e){n.warn(`Failed to get navigation type`,e)}return e.isValid?e.isSameOrigin?`same_origin`:`external`:`direct`},pd=(e,t)=>{try{let t=e.getItem(Xu);return t?JSON.parse(t):null}catch(e){return t.warn(`Failed to retrieve tab activity`,e),null}},md=(e,t,n,r)=>{let i=su(t,r),a,o;if(e===`same_origin`){let e=pd(n,r);e&&Date.now()-e.lastActivityMs<=1e4&&(a=e.tabId,{experienceId:o}=e)}return o===void 0&&(o=iu()),{navigationSource:e,tab:{experienceId:o,sourceTabId:a,tabId:i}}},hd=({sessionStorage:e,localStorage:t,referrer:n,navigationPerformance:r,diag:i})=>{let a=dd(n),o=fd(a,r,i);try{let t=e.getItem(Yu);if(t)return{navigationSource:o,referrerScrubbedUrl:a.isValid&&a.scrubbedUrl?a.scrubbedUrl:void 0,tab:JSON.parse(t)}}catch(e){i.warn(`Failed to retrieve tab data`,e)}let s=md(o,e,t,i);try{e.setItem(Yu,JSON.stringify(s.tab))}catch(e){i.warn(`Failed to store tab data`,e)}return{navigationSource:s.navigationSource,referrerScrubbedUrl:a.isValid&&a.scrubbedUrl?a.scrubbedUrl:void 0,tab:s.tab}},gd=(e,t,n)=>{let r={experienceId:t.experienceId,lastActivityMs:Date.now(),tabId:t.tabId};try{e.setItem(Xu,JSON.stringify(r))}catch(e){n.warn(`Failed to save tab activity`,e)}},_d=(e,t,n)=>{let r=r=>{var i;if(r.button===1||r.ctrlKey||r.metaKey||r.shiftKey){gd(t,e,n);return}(i=r.target)!=null&&i.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&gd(t,e,n)},i={capture:!0,passive:!0};document.addEventListener(`auxclick`,r,i),document.addEventListener(`click`,r,i)};N(),F(),W();var vd=class e{static shutdownAllTestInstances(){for(let t of e._testInstances)t._shutdown();e._testInstances.clear()}constructor({config:t={},dynamicConfigManager:n,diag:r,perf:i,visibilityDoc:a,storage:o,limitManager:s,target:c=window,activityThrottleMs:l=3e4,activityEvents:u=$u,tabStorage:d,referrer:f=typeof document<`u`?document.referrer:``,navigationPerformance:p=typeof window<`u`?window.performance:{getEntriesByType:()=>[]}}){P(this,`_state`,null),P(this,`_previousUserSessionId`,null),P(this,`_config`,void 0),P(this,`_dynamicConfigManager`,void 0),P(this,`_maxDurationTimeout`,null),P(this,`_isShutdown`,!1),P(this,`_permanentProperties`,{}),P(this,`_hasStoredState`,!1),P(this,`_activeSessionPartId`,null),P(this,`_sessionPartHistory`,[]),P(this,`_currentSessionPartNumber`,null),P(this,`_sessionPartSpan`,null),P(this,`_activeSessionPartCounts`,null),P(this,`_coldStart`,!0),P(this,`_nextSessionPartCounts`,{}),P(this,`_sdkStartupDuration`,0),P(this,`_sessionPartStartedListeners`,[]),P(this,`_sessionPartEndedListeners`,[]),P(this,`_tracer`,void 0),P(this,`_diag`,void 0),P(this,`_perf`,void 0),P(this,`_storage`,void 0),P(this,`_visibilityDoc`,void 0),P(this,`_limitManager`,void 0),P(this,`_target`,void 0),P(this,`_activityEvents`,void 0),P(this,`_onActivityThrottled`,void 0),P(this,`_sessionPartInactivityTimer`,null),P(this,`_tab`,void 0),P(this,`_navigationSource`,void 0),P(this,`_referrerScrubbedUrl`,void 0),P(this,`_analyticsManager`,null),P(this,`_onActivity`,()=>{try{if(!Wu(this._visibilityDoc))return;if(this._activeSessionPartId===null){this.startSessionPartInternal({reason:`web_activity`});return}this._startSessionPartInactivityTimer()}catch(e){this._diag.warn(`Error handling activity event`,e)}}),P(this,`_onVisibilityChange`,()=>{this._handleEngagementTransition(`visibilitychange`)}),P(this,`_onFocus`,()=>{this._handleEngagementTransition(`focus`)}),P(this,`_onBlur`,()=>{this._handleEngagementTransition(`blur`)}),P(this,`_onPageShow`,e=>{this._handleEngagementTransition(e.persisted?`pageshow-bfcache`:`pageshow-initial`)}),P(this,`_onPageHide`,e=>{try{if(this._activeSessionPartId===null)return;let t=e.persisted?`web_background`:`web_hard_navigation`;this._diag.debug(`page hiding (persisted=${e.persisted}); ending current part as ${t}`),this.endSessionPartInternal({reason:t})}catch(t){this._diag.error(`Error ending session part on pagehide (persisted=${e.persisted})`,t)}}),P(this,`_onSessionPartInactivity`,()=>{this._sessionPartInactivityTimer=null;try{if(this._activeSessionPartId===null)return;this._diag.debug(`inactivity timer fired; ending current part and user session`),this.endSessionPartInternal({reason:`web_foreground_inactivity`,userSessionEndReason:`inactivity`})}catch(e){this._diag.warn(`Error handling inactivity timer`,e)}}),this._diag=r==null?j.createComponentLogger({namespace:`MXLUserSessionManager`}):r,this._perf=i,this._visibilityDoc=a,this._storage=o,this._limitManager=s,this._permanentProperties=ld(this._storage,this._diag),this._tracer=M.getTracer(`mxl-web-sdk-session-parts`),this._target=c,this._activityEvents=u,this._onActivityThrottled=Gu(this._onActivity,l),this._config=t,this._dynamicConfigManager=n;let m=hd({diag:this._diag,localStorage:o,navigationPerformance:p,referrer:f,sessionStorage:d});this._tab=m.tab,this._navigationSource=m.navigationSource,this._referrerScrubbedUrl=m.referrerScrubbedUrl,_d(this._tab,o,this._diag),e._testInstances.add(this)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-session-parts`),ed({activityEvents:this._activityEvents,onActivity:this._onActivityThrottled,onBlur:this._onBlur,onFocus:this._onFocus,onPageHide:this._onPageHide,onPageShow:this._onPageShow,onVisibilityChange:this._onVisibilityChange,target:this._target,visibilityDoc:this._visibilityDoc});let{state:t,created:n}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());this._state=t,n&&this._storeState()}recordSDKStartupDuration(e){this._sdkStartupDuration=Math.max(1,Math.ceil(e))}claimReplaySample(e){let{state:t}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());if(t.replaySampled!==null)return this._state=t,t.replaySampled;let n=Math.random()<e;return this._state=U(U({},t),{},{replaySampled:n}),this._storeState(),n}nextReplayMetaVersion(){let{state:e}=this._loadOrCreateUserSessionState(this._perf.getNowMillis()),t=e.replayMetaVersion+1;return this._state=U(U({},e),{},{replayMetaVersion:t}),this._storeState(),t}setAnalyticsManager(e){this._analyticsManager=e}getUserSessionId(){var e,t;return(e=(t=this._state)==null?void 0:t.userSessionId)==null?null:e}getPreviousUserSessionId(){var e,t;return(e=(t=this._state)==null?void 0:t.previousUserSessionId)==null?this._previousUserSessionId:e}getUserSessionStartTime(){var e,t;return(e=(t=this._state)==null?void 0:t.userSessionStartTs)==null?null:e}getUserSessionAttributes(){var e,t;if(!this._state)return null;let n=(e=this.getPreviousUserSessionId())==null?``:e;return{[sr]:this._state.userSessionId,[cr]:n,[lr]:this._state.userSessionNumber,"mxl.user_session_part_index":this._state.userSessionPartIndex,"mxl.session_part_number":(t=this._currentSessionPartNumber)==null?0:t,"mxl.user_session_start_ts":this._state.userSessionStartTs,"mxl.user_session_max_duration_seconds":this._state.maxUserSessionDurationSeconds,"mxl.user_session_inactivity_timeout_seconds":this._state.inactivityTimeoutSeconds,"mxl.user_session_foreground_inactivity_timeout_seconds":this._state.foregroundInactivityTimeoutSeconds}}endUserSession(){if(!this._state){this._diag.debug(`Trying to end user session, but there is no active session. This is a no-op.`);return}let e=this._perf.getNowMillis(),t=this._storage.getItem(Ju),n=t===null?NaN:Number(t);if(Number.isFinite(n)&&e-n<5e3){this._diag.warn(`endUserSession called within cooldown period, ignoring.`);return}this._rolloverUserSession(`manual`),this._storage.setItem(Ju,String(e))}getSessionPartId(){return this._activeSessionPartId}getSessionPartIdAt(e){for(let t=this._sessionPartHistory.length-1;t>=0;t--)if(this._sessionPartHistory[t].startTimeEpochMillis<=e)return this._sessionPartHistory[t].id;return this._sessionPartHistory.length>0?this._sessionPartHistory[0].id:this.getSessionPartId()}getSessionPartSpan(){return this._sessionPartSpan}startSessionPartInternal({reason:e,timestamp:t}){if(this._sessionPartSpan){this._diag.warn(`startSessionPartInternal called while a part is active (reason: ${e}); ignoring`);return}if(Ou(this._visibilityDoc)===`background`||!this._visibilityDoc.hasFocus()){this._diag.debug(`skipping session part start (reason: ${e}) because the tab is not engaged`);return}let n=iu(),r=this._nextSessionPartCounts;this._beginUserSessionForPartStart();let i=U(U({},this.getUserSessionAttributes()),{},{[I]:`ux.session_part`,[Zn]:`foreground`,[or]:n,"mxl.session_part_start_reason":e,"mxl.cold_start":this._coldStart,"mxl.experience_id":this._tab.experienceId,"mxl.tab_id":this._tab.tabId,"mxl.navigation_source":this._navigationSource},r);this._referrerScrubbedUrl&&(i[`mxl.referrer_url`]=this._referrerScrubbedUrl),this._tab.sourceTabId&&(i[`mxl.source_tab_id`]=this._tab.sourceTabId),this._activeSessionPartId=n;let a;try{a=new Ru(this._tracer.startSpan(`mxl-session-part`,{attributes:i,startTime:t}))}catch(e){this._activeSessionPartId=null,this._diag.error(`Error starting session part span`,e);return}this._activeSessionPartCounts={},this._nextSessionPartCounts={},this._sessionPartSpan=a,this._sessionPartHistory.push({id:n,startTimeEpochMillis:t==null?this._perf.getNowMillis():t}),this._startSessionPartInactivityTimer(),this._fireListeners(this._sessionPartStartedListeners,`started`,{reason:e})}endSessionPartInternal({reason:e,userSessionEndReason:t,timestamp:n}){if(!this._sessionPartSpan){this._diag.debug(`trying to end a session part, but there is no session part in progress. This is a no-op.`);return}this._clearSessionPartInactivityTimer();let r=Qu.has(e),i=this._perf.getNowMillis(),a=n==null?i:n,o=this._sessionPartSpan;try{let n=U(U(U({"mxl.session_part_end_reason":e},this._activeSessionPartCounts),this._limitManager.getDiagnosticCounts()),{},{"mxl.sdk_startup_duration":this._sdkStartupDuration});this._coldStart&&(n[`mxl.page_load`]=this._visibilityDoc.readyState===`complete`),r&&(n[`mxl.is_final_session_part`]=1,t&&(n[`mxl.user_session_termination_reason`]=t)),this._analyticsManager&&(Object.assign(n,this._analyticsManager.buildSessionPartAnalyticsAttributes()),this._analyticsManager.finalizeSessionPartAnalytics());let i={};for(let[e,t]of Object.entries(this.getSessionPartProperties()))i[`mxl.properties.`+e]=t;try{o.setAttributes(U(U({},i),n))}catch(e){this._diag.warn(`Error setting end attributes on session part span; ending span without them`,e)}}finally{this._fireListeners(this._sessionPartEndedListeners,`ended`);try{o.end(a)}catch(e){this._diag.warn(`Error ending session part span`,e)}this._sessionPartSpan=null,this._coldStart=!1,this._activeSessionPartId=null,this._activeSessionPartCounts=null,this._currentSessionPartNumber=null,this._limitManager.reset()}if(r){var s,c;this._previousUserSessionId=(s=(c=this._state)==null?void 0:c.userSessionId)==null?null:s,this._state=null,this._storage.removeItem(Ku),this._clearMaxDurationTimer(),this._sessionPartHistory=[]}else this._continueUserSessionAfterPartEnd(i)}rolloverSessionPartInternal({endReason:e,startReason:t,timestamp:n}){if(!this._sessionPartSpan)return;let r=n==null?this._perf.getNowMillis():n;this.endSessionPartInternal({reason:e,timestamp:r}),this.startSessionPartInternal({reason:t,timestamp:r})}addBreadcrumb(e){if(!this._sessionPartSpan){this._diag.debug(`trying to add breadcrumb, but there is no session part in progress. This is a no-op.`);return}let t=this._limitManager.limitBreadcrumb(e);t!==`dropped`&&this._sessionPartSpan.addEvent(`mxl-breadcrumb`,{message:t.name},this._perf.getNowMillis())}addProperty(e,t,n){let r=this._limitManager.limitSessionProperty(e,t);if(r===`dropped`)return;let i=r.key,a=r.value;if((n==null?void 0:n.lifespan)===`permanent`){let e=U(U({},this._permanentProperties),{},{[i]:a});if(!ud(this._storage,e)){this._diag.warn(`Storage unavailable; rejecting permanent property write.`);return}this._permanentProperties=e,this._removeFromUserSessionProperties(i);return}let{state:o}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());this._state=U(U({},o),{},{userSessionProperties:U(U({},o.userSessionProperties),{},{[i]:a})}),this._storeState()||(this._state=o,this._diag.warn(`Storage unavailable; rejecting user-session property write.`))}removeProperty(e){let t=this._limitManager.truncateString(`session_property_key`,e);this._removeFromPermanentProperties(t),this._removeFromUserSessionProperties(t)}getSessionPartProperties(){var e;return U(U({},this._permanentProperties),(e=this._state)==null?void 0:e.userSessionProperties)}incrSessionPartCountForKey(e){if(!this._sessionPartSpan||!this._activeSessionPartCounts){this._diag.debug(`trying to increment a count for the active session part, but there is no session part in progress. This is a no-op.`);return}this._activeSessionPartCounts[e]=(this._activeSessionPartCounts[e]||0)+1}incrNextSessionPartCountForKey(e){this._nextSessionPartCounts[e]=(this._nextSessionPartCounts[e]||0)+1}addSessionPartStartedListener(e){return this._addListener(this._sessionPartStartedListeners,e)}addSessionPartEndedListener(e){return this._addListener(this._sessionPartEndedListeners,e)}_loadOrCreateUserSessionState(e){let t=cd(this._storage,this._diag);!t&&!this._hasStoredState&&this._state&&(t=this._state);let n=!1;if(!t||nd(t,e)){var r;t&&(this._previousUserSessionId=t.userSessionId);let i=Du(this._storage,`mxl_user_session_number`,this._diag);t=rd(U(U({},this._resolveUserSessionDurations()),{},{now:e,previousUserSessionId:this._previousUserSessionId,userSessionNumber:i})),n=!0,(r=this._analyticsManager)==null||r.resetSessionAnalyticsForNewUserSession()}return(n||this._maxDurationTimeout===null)&&this._setupMaxDurationTimer(t,e),{created:n,state:t}}_beginUserSessionForPartStart(){let e=this._perf.getNowMillis(),{state:t}=this._loadOrCreateUserSessionState(e);this._currentSessionPartNumber=Du(this._storage,`mxl_session_part_number`,this._diag),this._state=U(U({},t),{},{userSessionPartIndex:t.userSessionPartIndex+1,inactivityDeadlineTs:null}),this._storeState()}_continueUserSessionAfterPartEnd(e){if(!this._state){this._clearMaxDurationTimer();return}if(this._hasStoredState&&this._storage.getItem(`mxl_user_session_state`)===null){this._previousUserSessionId=this._state.userSessionId,this._state=null,this._clearMaxDurationTimer();return}this._state=U(U({},this._state),{},{inactivityDeadlineTs:e+this._state.inactivityTimeoutSeconds*1e3}),this._storeState()}_rolloverUserSession(e){var t,n;if(this._sessionPartSpan){let t=this._perf.getNowMillis();this.endSessionPartInternal({reason:`user_session_ended`,userSessionEndReason:e,timestamp:t}),this.startSessionPartInternal({reason:`user_session_rollover`,timestamp:t});return}this._previousUserSessionId=(t=(n=this._state)==null?void 0:n.userSessionId)==null?null:t,this._state=null,this._storage.removeItem(Ku),this._clearMaxDurationTimer()}_setupMaxDurationTimer(e,t){this._clearMaxDurationTimer();let n=e.userSessionMaxEndTs-t;n<=0||(this._maxDurationTimeout=setTimeout(()=>{this._maxDurationTimeout=null,this._rolloverUserSession(`max_duration_reached`)},n))}_clearMaxDurationTimer(){this._maxDurationTimeout!==null&&(clearTimeout(this._maxDurationTimeout),this._maxDurationTimeout=null)}_shutdown(){this._isShutdown||(this._isShutdown=!0,e._testInstances.delete(this),this._onActivityThrottled.cancel(),td({activityEvents:this._activityEvents,onActivity:this._onActivityThrottled,onBlur:this._onBlur,onFocus:this._onFocus,onPageHide:this._onPageHide,onPageShow:this._onPageShow,onVisibilityChange:this._onVisibilityChange,target:this._target,visibilityDoc:this._visibilityDoc}),this._clearSessionPartInactivityTimer(),this._clearMaxDurationTimer())}_handleEngagementTransition(e){try{let t=Wu(this._visibilityDoc),n=this._activeSessionPartId!==null;if(!t&&n){this._diag.debug(`tab disengaged via ${e}; ending current part`),this.endSessionPartInternal({reason:`web_background`});return}if(t&&!n){this._diag.debug(`tab engaged via ${e}; starting new part`),this.startSessionPartInternal({reason:`web_foreground`});return}t&&n&&this._startSessionPartInactivityTimer()}catch(e){this._diag.warn(`Error handling engagement change`,e)}}_resolveUserSessionDurations(){var e,t,n,r;let i=(e=this._dynamicConfigManager)==null?void 0:e.getConfig(),a=Uu({defaultValue:43200,diag:this._diag,max:86400,min:3600,value:(t=this._config.maxDurationSeconds)==null?i==null?void 0:i.userSessionMaxDurationSeconds:t}),o=this._withinMaxDuration(`session.inactivityTimeoutSeconds`,Uu({defaultValue:Zu,diag:this._diag,max:86400,min:30,value:(n=this._config.inactivityTimeoutSeconds)==null?i==null?void 0:i.userSessionInactivityTimeoutSeconds:n}),a,Zu);return{foregroundInactivityTimeoutSeconds:this._withinMaxDuration(`session.foregroundInactivityTimeoutSeconds`,Uu({defaultValue:o,diag:this._diag,max:86400,min:30,value:(r=this._config.foregroundInactivityTimeoutSeconds)==null?i==null?void 0:i.userSessionForegroundInactivityTimeoutSeconds:r}),a,o),inactivityTimeoutSeconds:o,maxUserSessionDurationSeconds:a}}_withinMaxDuration(e,t,n,r){return t<=n?t:(this._diag.warn(`${e} (${t.toString()}s) exceeds session.maxDurationSeconds (${n.toString()}s); falling back to ${r.toString()}s.`),r)}_startSessionPartInactivityTimer(){this._clearSessionPartInactivityTimer(),this._state&&(this._sessionPartInactivityTimer=setTimeout(this._onSessionPartInactivity,this._state.foregroundInactivityTimeoutSeconds*1e3))}_clearSessionPartInactivityTimer(){this._sessionPartInactivityTimer!==null&&(clearTimeout(this._sessionPartInactivityTimer),this._sessionPartInactivityTimer=null)}_addListener(e,t){return e.push(t),()=>{let n=e.indexOf(t);n!==-1&&e.splice(n,1)}}_fireListeners(e,t,n){for(let r of e)try{r(n)}catch(e){this._diag.warn(`Error while executing session part ${t} listener`,e)}}_storeState(){if(!this._state)return!1;let e=this._storage.setItem(Ku,JSON.stringify(this._state));return e&&(this._hasStoredState=!0),e}_removeFromPermanentProperties(e){if(!(e in this._permanentProperties))return;let t=U({},this._permanentProperties);delete t[e],this._permanentProperties=t,ud(this._storage,t)}_removeFromUserSessionProperties(e){if(!this._state||!(e in this._state.userSessionProperties))return;let t=U({},this._state.userSessionProperties);delete t[e],this._state=U(U({},this._state),{},{userSessionProperties:t}),this._storeState()}};P(vd,`_testInstances`,new Set),F();var yd=class{constructor({urlDocument:e=window.document}={}){P(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`browser.url.full`]||e.setAttribute(tr,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};F();var bd=class{constructor({urlDocument:e=window.document}={}){P(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){e.attributes[`browser.url.full`]||(e.attributes[tr]=this._urlDocument.URL)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var xd=class{constructor({attributeScrubbers:e}){P(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&e.setAttribute(t.key,t.scrub(n))})}shutdown(){return Promise.resolve(void 0)}};R(),F();var Sd=class{constructor({urlDocument:e=window.document,visibilityDocument:t=window.document}={}){P(this,`_urlDocument`,void 0),P(this,`_visibilityDocument`,void 0),this._urlDocument=e,this._visibilityDocument=t}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`mxl.type`]||e.setAttribute(I,`sys.log`),e.setAttribute(oi,this._urlDocument.URL),e.attributes[`mxl.is_tab_engaged`]===void 0&&e.setAttribute(`mxl.is_tab_engaged`,Wu(this._visibilityDocument))}shutdown(){return Promise.resolve(void 0)}};R();let Cd=e=>{if((e.attributes[`http.request.method`]||e.attributes[`http.method`])&&(typeof e.attributes[`http.response.status_code`]==`number`||typeof e.attributes[`http.status_code`]==`number`)){var t;let n=(t=e.attributes[`url.full`])==null?e.attributes[Rr]:t;return typeof n==`string`&&n.includes(`://`)}return!1};R();var wd=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){Ao(e.spanContext().traceId)}onEnding(e){Cd(e)&&(e.attributes[I]=`perf.network_request`,e.attributes[`url.full`]===void 0&&(e.attributes[oi]=e.attributes[Rr]),e.attributes[`http.response.status_code`]===void 0&&(e.attributes[Qr]=e.attributes[zr]),e.attributes[`http.request.method`]===void 0&&(e.attributes[Xr]=e.attributes[Lr]),e.attributes[`http.response.body.size`]===void 0&&(e.attributes[$l]=e.attributes[Vr]),e.attributes[`http.request.body.size`]===void 0&&(e.attributes[`http.request.body.size`]=e.attributes[Br]))}onStart(){}shutdown(){return Promise.resolve(void 0)}};let Td=`Soft Navigation`,Ed=`mxl.soft_navigation.source`,Dd=`mxl.soft_navigation.interaction_id`,Od=`mxl.soft_navigation.start_time`,kd=`mxl.soft_navigation.duration`,Ad={performanceObserver:`performance_observer`,polyfill:`polyfill`},jd=e=>e.attributes[I]===`ux.session_part`,Md=e=>e.attributes[Ed]!==void 0;N(),B(),F();let Nd=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var Pd=class{constructor({exporter:e,limitManager:t,userSessionManager:n,emptySessionAvoidanceEnabled:r=!1,diag:i=j.createComponentLogger({namespace:`MXLSessionPartBatchedSpanProcessor`})}){P(this,`_shutdownOnce`,void 0),P(this,`_pendingSpans`,[]),P(this,`_exporter`,void 0),P(this,`_limitManager`,void 0),P(this,`_userSessionManager`,void 0),P(this,`_emptySessionAvoidanceEnabled`,void 0),P(this,`_diag`,void 0),P(this,`_shutdown`,()=>this._exporter.shutdown()),this._diag=i,this._exporter=e,this._shutdownOnce=new la(this._shutdown,this),this._limitManager=t,this._userSessionManager=n,this._emptySessionAvoidanceEnabled=r}forceFlush(){return this._diag.debug(`forceFlush called for MXLSessionPartBatchedSpanProcessor. This is a no op`),Promise.resolve(void 0)}onEnd(e){if(this._shutdownOnce.isCalled){this._diag.debug(`span ended after processor shutdown. Ignoring span.`);return}if(jd(e))this._diag.debug(`session part span ended. Exporting all pending spans.`),this._exportSpans([e,...this._pendingSpans]),this._pendingSpans=[];else{if(this._diag.debug(`non-session-part span ended. Adding to pending spans queue.`),this._limitManager.dropReadableSpan(e))return;this._pendingSpans.push(e)}}_isEmptySessionExport(e){return e.length===1&&jd(e[0])}_exportSpans(e){if(this._emptySessionAvoidanceEnabled&&this._isEmptySessionExport(e)){this._diag.debug(`Skipping export of empty session part`);return}pa._export(this._exporter,e).then(e=>{if(e.code===z.FAILED){var t;let n=((t=e.error)==null?void 0:t.message)||`unknown error`,r=`unknown`;n===`Concurrent export limit reached`?r=`concurrent_limit`:n===`Fetch request errored`&&(r=`fetch_error`),this._userSessionManager.incrSessionPartCountForKey(Nd(r,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(Nd(r,`previous`)),this._diag.error(`spans failed to export: ${n}`)}}).catch(e=>{let t=`unknown error`;e&&e instanceof Error?t=e.message:typeof e==`string`&&(t=e),this._userSessionManager.incrSessionPartCountForKey(Nd(`unknown`,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(Nd(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}shutdown(){return this._shutdownOnce.call()}};F();var Fd=class{constructor({pageManager:e}){P(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){if(!e.attributes[`app.surface.name`]||!e.attributes[`app.surface.id`]){let t=this._pageManager.getCurrentRoute();t&&(e.setAttribute(rr,t.path),e.setAttribute(ir,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&e.setAttribute(ar,t)}shutdown(){return Promise.resolve(void 0)}};F();var Id=class{constructor({pageManager:e}){P(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){if(!e.attributes[`app.surface.name`]||!e.attributes[`app.surface.id`]){let t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.attributes[rr]=t.path,e.attributes[ir]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&(e.attributes[ar]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};N(),B(),F();var Ld=class{constructor({buffer:e}){P(this,`_buffer`,void 0),this._buffer=e}onEmit(e){try{let t=e.attributes[eu];typeof t==`string`&&t.length>0&&this._buffer.record({kind:`log`,id:t,startTime:wi(e.hrTime),type:e.attributes[I]})}catch(e){j.error(`failed to record log for signal correlation`,e)}}forceFlush(){return Promise.resolve(void 0)}shutdown(){return Promise.resolve(void 0)}};N(),B(),F();var Rd=class{constructor({buffer:e}){P(this,`_buffer`,void 0),this._buffer=e}forceFlush(){return Promise.resolve(void 0)}onStart(e){try{if(Md(e)||jd(e))return;this._buffer.record({kind:`span`,id:e.spanContext().spanId,startTime:wi(e.startTime),type:e.attributes[I]})}catch(e){j.error(`failed to record span for correlation`,e)}}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var zd=class{constructor({attributeScrubbers:e}){P(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&(e.attributes[t.key]=t.scrub(n))})}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var Bd=class{constructor({userManager:e}){P(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._userManager.getUserId()&&e.setAttributes({[tu]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}};F();var Vd=class{constructor({userSessionManager:e}){P(this,`_userSessionManager`,void 0),this._userSessionManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){var t,n,r,i,a,o;let s=(t=(n=e.attributes[`mxl.user_session_id`])==null?this._userSessionManager.getUserSessionId():n)==null?``:t,c=(r=(i=e.attributes[`mxl.user_session_previous_id`])==null?this._userSessionManager.getPreviousUserSessionId():i)==null?``:r,l=(a=(o=e.attributes[`mxl.session_part_id`])==null?this._userSessionManager.getSessionPartId():o)==null?``:a;e.setAttributes({[eu]:iu(),[sr]:s,[cr]:c,[or]:l})}shutdown(){return Promise.resolve(void 0)}};F();var Hd=class{constructor({userManager:e}){P(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){let t=this._userManager.getUserId();t&&(e.attributes[tu]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var Ud=class{constructor({maxAgeMillis:e=6e4,maxEntries:t=4096}={}){P(this,`_maxAgeMillis`,void 0),P(this,`_maxEntries`,void 0),P(this,`_entries`,[]),P(this,`_latestStartTime`,0),this._maxAgeMillis=e,this._maxEntries=t}record(e){this._entries.push(e),e.startTime>this._latestStartTime&&(this._latestStartTime=e.startTime),this._evict()}collectWindow(e,t){let n=this._entries.filter(n=>n.startTime>=e&&n.startTime<=t),r=n.filter(e=>e.kind===`span`),i=n.filter(e=>e.kind===`log`);return{spanIds:r.map(e=>e.id),spanTypes:r.map(e=>{var t;return(t=e.type)==null?``:t}),logIds:i.map(e=>e.id),logTypes:i.map(e=>{var t;return(t=e.type)==null?``:t})}}_evict(){let e=this._latestStartTime-this._maxAgeMillis;for(;this._entries.length>0&&this._entries[0].startTime<e;)this._entries.shift();for(;this._entries.length>this._maxEntries;)this._entries.shift()}};N(),B();var Wd=class extends $i{inject(e,t,n){super.inject(e,t,n);let r=M.getSpan(e);if(r){let e=t instanceof Headers?t.get(`traceparent`):Ae.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};N(),F();var Gd=class{constructor({namespace:e,storage:t,diag:n}){P(this,`_diag`,void 0),P(this,`_keyPrefix`,void 0),P(this,`_storage`,void 0),P(this,`_writeDisabled`,!1),this._diag=n==null?j.createComponentLogger({namespace:`NamespacedStorage`}):n,this._keyPrefix=e?`${e}__`:``,this._storage=t}keys(){let e;try{({length:e}=this._storage)}catch(e){return this._diag.warn(`failed to read storage length`,String(e)),[]}let t=[];for(let n=0;n<e;n++)try{let e=this._storage.key(n);if(e===null)continue;this._keyPrefix?e.startsWith(this._keyPrefix)&&t.push(e.substring(this._keyPrefix.length)):t.push(e)}catch(e){this._diag.warn(`failed to read storage key at index ${n.toString()}`,String(e))}return t}get length(){return this.keys().length}clear(){let e=!0;for(let t of this.keys())this._safeRemove(this._keyName(t))||(e=!1);return e}getItem(e){try{return this._storage.getItem(this._keyName(e))}catch(t){return this._diag.warn(`failed to read ${e}`,String(t)),null}}key(e){var t;return(t=this.keys()[e])==null?null:t}removeItem(e){return this._safeRemove(this._keyName(e))}setItem(e,t){if(this._writeDisabled)return!1;try{return this._storage.setItem(this._keyName(e),t),!0}catch(e){return this._disableWrites(e),!1}}getStorageEventKey(e){return this._keyName(e)}_keyName(e){return`${this._keyPrefix}${e}`}_safeRemove(e){try{return this._storage.removeItem(e),!0}catch(t){return this._diag.warn(`failed to remove ${e}`,String(t)),!1}}_disableWrites(e){if(this._writeDisabled)return;this._writeDisabled=!0;let t=e instanceof Error?e.name:`UnknownError`;this._diag.error(`writes disabled after failure; continuing in-memory only`,t)}};let Kd=({diag:e,featureManager:t,registerGlobally:n,propagator:r,defaultInstrumentationConfig:i})=>{var a;if(!t.isNetworkSpanForwardingEnabled())return!1;let o=[];return n||o.push("Network span forwarding cannot be used when `registerGlobally` is set to false. Turning off network span forwarding."),r&&o.push("Network span forwarding cannot be used alongside a custom `propagator`. Turning off network span forwarding."),!(i==null||(a=i.omit)==null)&&a.has(`@opentelemetry/instrumentation-xml-http-request`)&&i.omit.has(`@opentelemetry/instrumentation-fetch`)&&o.push(`Network span forwarding cannot be used when both '@opentelemetry/instrumentation-xml-http-request' and '@opentelemetry/instrumentation-fetch' are omitted. Turning off network span forwarding.`),o.forEach(t=>{e.warn(t)}),o.length===0},qd=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Jd=({collectorUrl:e,configUrl:t})=>[RegExp(`^${qd(e)}/v1/(traces|logs)(\\?|$)`),RegExp(`^${qd(t)}/((config|replay)(\\?|$)|sessionReplays/)`)];var X,Yd=n((()=>{(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`})(X||(X={}))}));function Xd(){return cf||(cf=document.createElement(`a`)),cf}function Zd(e,t){return t in e}function Qd(e,t,n,r=!0){if(Zd(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function $d(e,t,n=!1,r){r===void 0&&(r=t[X.START_TIME]!==0),n||(Qd(e,X.FETCH_START,t,r),Qd(e,X.DOMAIN_LOOKUP_START,t,r),Qd(e,X.DOMAIN_LOOKUP_END,t,r),Qd(e,X.CONNECT_START,t,r),Qd(e,X.SECURE_CONNECTION_START,t,r),Qd(e,X.CONNECT_END,t,r),Qd(e,X.REQUEST_START,t,r),Qd(e,X.RESPONSE_START,t,r),Qd(e,X.RESPONSE_END,t,r))}function ef(e){return e.slice().sort((e,t)=>{let n=e[X.FETCH_START],r=t[X.FETCH_START];return n>r?1:n<r?-1:0})}function tf(){return typeof location<`u`?location.origin:void 0}function nf(e,t,n,r,i=new WeakSet,a){let o=of(e);e=o.toString();let s=af(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=ef(s);if(o.origin!==tf()&&c.length>1){let e=c[0],t=rf(c,e[X.RESPONSE_END],n),r=e[X.RESPONSE_END];return t[X.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function rf(e,t,n){let r=Ci(n),i=Ci(xi(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=Ci(xi(n[X.FETCH_START])),c=r-Ci(xi(n[X.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function af(e,t,n,r,i,a){let o=Ci(t),s=Ci(n),c=r.filter(t=>{let n=Ci(xi(t[X.FETCH_START])),r=Ci(xi(t[X.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function of(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=Xd();return t.href=e,t}function sf(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),of(e).origin===tf()?!0:n.some(t=>ia(e,t))}var cf,lf=n((()=>{B(),Yd()})),uf=n((()=>{F(),q(),Yd(),lf()})),df,ff=n((()=>{df=`http.request.body.size`}));function pf(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=mf(t.body);return t.body=e,n}else return Promise.resolve(gf(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>_f(e)):Promise.resolve()}}function mf(e){if(!e.pipeThrough)return Sf.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},transform(e,n){return K(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function hf(e){return typeof Document<`u`&&e instanceof Document}function gf(e){if(hf(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return _f(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return vf(e);if(e instanceof URLSearchParams)return _f(e.toString());if(e.byteLength!==void 0)return e.byteLength;Sf.warn(`unknown body type`)}function _f(e){return Cf.encode(e).byteLength}function vf(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function yf(e){let t=bf(),n=e.toUpperCase();return n in t?n:`_OTHER`}function bf(){return Tf===void 0&&(Tf=wf),Tf}function xf(e){let t=Number(e.port||Ef[e.protocol]);if(t&&!isNaN(t))return t}var Sf,Cf,wf,Tf,Ef,Df=n((()=>{N(),B(),q(),Sf=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),Cf=new TextEncoder,wf={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Ef={"https:":`443`,"http:":`80`}})),Of,kf=n((()=>{Of=`0.223.0`})),Af,jf,Mf,Nf=n((()=>{N(),B(),uf(),ff(),R(),Df(),kf(),F(),Af=300,jf=typeof PerformanceObserver<`u`,Mf=class extends fs{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,Of,e),P(this,`component`,`fetch`),P(this,`version`,Of),P(this,`moduleName`,this.component),P(this,`_usedResources`,new WeakSet),P(this,`_tasksCount`,0)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[X.FETCH_START]},M.setSpan(A.active(),e));$d(n,t,this.getConfig().ignoreNetworkEvents,void 0),n.end(t[X.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=of(t.url);e.setAttribute(Qr,t.status),e.setAttribute($r,n.hostname);let r=xf(n);r&&e.setAttribute(ei,r)}_addHeaders(e,t){if(!sf(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};qt.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)qt.inject(A.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);qt.inject(A.active(),t,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))}),e.headers=t}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(aa(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n={},r=t.method,i=yf(t.method||`GET`),a=i;return n[Xr]=i,i!==r&&(n[Zr]=r),n[oi]=e,this.tracer.startSpan(a,{kind:xt.CLIENT,attributes:n})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=nf(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n)),$d(e,t,this.getConfig().ignoreNetworkEvents,void 0)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=yi(Date.now()),i=bi();this._addFinalSpanAttributes(e,n),n.status>=400&&(e.setStatus({code:Ct.ERROR}),e.setAttribute(Kr,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},Af)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=this,i=of(n[0]instanceof Request?n[0].url:String(n[0])).href,a;a=n[0]instanceof Request?n[1]==null?n[0]:new Request(n[0],n[1]):n[1]||{};let o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&pf(...n).then(e=>{e&&o.setAttribute(df,e)}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}catch(n){t._diag.error(`Failed to read fetch response body`,n),t._endSpan(e,s,{status:0,url:i})}return n}function d(e,n){try{c(e,n)}catch(r){t._diag.error(`Failed to end span on fetch error`,r),t._endSpan(e,s,{status:n.status||0,url:i})}throw n}return A.with(M.setSpan(A.active(),o),()=>(t._callRequestHook(o,a),t._addHeaders(a,i),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o),d.bind(r,o))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&hs(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&hs(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=bi(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(!jf){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(e){this._diag.warn(`Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.`,e)}}}disable(){jf&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}})),Pf=n((()=>{Nf()})),Ff,If=n((()=>{Ff=`http.request.body.size`})),Lf,Rf=n((()=>{(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`})(Lf||(Lf={}))}));function zf(e){return typeof Document<`u`&&e instanceof Document}function Bf(e){if(zf(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Vf(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Hf(e);if(e instanceof URLSearchParams)return Vf(e.toString());if(e.byteLength!==void 0)return e.byteLength;Kf.warn(`unknown body type`)}function Vf(e){return qf.encode(e).byteLength}function Hf(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Uf(e){let t=Wf(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Wf(){return Yf===void 0&&(Yf=Jf),Yf}function Gf(e){let t=Number(e.port||Xf[e.protocol]);if(t&&!isNaN(t))return t}var Kf,qf,Jf,Yf,Xf,Zf=n((()=>{N(),B(),Kf=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),qf=new TextEncoder,Jf={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Xf={"https:":`443`,"http:":`80`}})),Qf,$f=n((()=>{Qf=`0.223.0`})),ep,tp,np=n((()=>{N(),_s(),B(),uf(),R(),If(),Rf(),Zf(),$f(),F(),ep=300,tp=class extends fs{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,Qf,e),P(this,`component`,`xml-http-request`),P(this,`version`,Qf),P(this,`moduleName`,this.component),P(this,`_tasksCount`,0),P(this,`_xhrMem`,new WeakMap),P(this,`_usedResources`,new WeakSet)}init(){}_addHeaders(e,t){let n=of(t).href;if(!sf(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};qt.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};qt.inject(A.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){A.with(M.setSpan(A.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[X.FETCH_START]});$d(e,t,this.getConfig().ignoreNetworkEvents,void 0),e.end(t[X.RESPONSE_END])})}_addFinalSpanAttributes(e,t){t.status&&e.setAttribute(Qr,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&hs(()=>n(e,t),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_addResourceObserver(e,t){let n=this._xhrMem.get(e);!n||typeof PerformanceObserver!=`function`||typeof PerformanceResourceTiming!=`function`||(n.createdResources={observer:new PerformanceObserver(e=>{let r=e.getEntries(),i=of(t);r.forEach(e=>{e.initiatorType===`xmlhttprequest`&&e.name===i.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:[`resource`]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(_i.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,i){if(!n||!r||!i||!e.createdResources)return;let a=e.createdResources.entries;(!a||!a.length)&&(a=_i.getEntriesByType(`resource`));let o=nf(of(n).href,r,i,a,this._usedResources);if(o.mainRequest){let e=o.mainRequest;this._markResourceAsUsed(e);let n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n)),$d(t,e,this.getConfig().ignoreNetworkEvents,void 0)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){let r=of(t);if(aa(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i={},a=n,o=Uf(n),s=o;i[Xr]=o,o!==a&&(i[Zr]=a),i[oi]=r.toString(),i[$r]=r.hostname;let c=Gf(r);c&&(i[ei]=c);let l=this.tracer.startSpan(s,{kind:xt.CLIENT,attributes:i});return l.addEvent(Lf.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:l,spanUrl:t}),l}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=n[0],i=n[1];return t._createSpan(this,i,r),e.apply(this,n)}}}_patchSend(){let e=this;function t(t,n,r,i){let a=n.callbackToRemoveEvents;typeof a==`function`&&a();let{span:o,spanUrl:s,sendStartTime:c}=n;o&&(e._findResourceAndAddNetworkEvents(n,o,s,c,r),o.addEvent(t,i),e._addFinalSpanAttributes(o,n),o.end(i),e._tasksCount--),e._clearResources()}function n(n,r,i,a){let o=e._xhrMem.get(r);if(!o)return;if(o.status=r.status,o.statusText=r.statusText,e._xhrMem.delete(r),o.span){let t=o.span;e._applyAttributesAfterXHR(t,r),i?a&&(t.setStatus({code:Ct.ERROR,message:a}),t.setAttribute(Kr,a)):o.status&&o.status>=400&&(t.setStatus({code:Ct.ERROR}),t.setAttribute(Kr,String(o.status)))}let s=bi(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},ep)}function r(){n(Lf.EVENT_ERROR,this,!0,`error`)}function i(){n(Lf.EVENT_ABORT,this,!1)}function a(){n(Lf.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(Lf.EVENT_LOAD,this,!1):n(Lf.EVENT_ERROR,this,!1)}function s(t){t.removeEventListener(`abort`,i),t.removeEventListener(`error`,r),t.removeEventListener(`load`,o),t.removeEventListener(`timeout`,a);let n=e._xhrMem.get(t);n&&(n.callbackToRemoveEvents=void 0)}return t=>function(...n){if(!e._isEnabled)return t.apply(this,n);let c=e._xhrMem.get(this);if(!c)return t.apply(this,n);let l=c.span,u=c.spanUrl;if(l&&u){if(e.getConfig().measureRequestSize&&n!=null&&n[0]){let e=n[0],t=Bf(e);t!==void 0&&l.setAttribute(Ff,t)}A.with(M.setSpan(A.active(),l),()=>{e._tasksCount++,c.sendStartTime=bi(),l.addEvent(Lf.METHOD_SEND),this.addEventListener(`abort`,i),this.addEventListener(`error`,r),this.addEventListener(`load`,o),this.addEventListener(`timeout`,a),c.callbackToRemoveEvents=()=>{s(this),c.createdResources&&c.createdResources.observer.disconnect()},e._addHeaders(this,u),e._addResourceObserver(this,u)})}return t.apply(this,n)}}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(e){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.`,e)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),rp=n((()=>{np()})),ip=r({FetchInstrumentation:()=>Mf,XMLHttpRequestInstrumentation:()=>tp}),ap=n((()=>{Pf(),rp()}));W(),q();let op=function(){var e=K(function*(e,t){var n,r;let i=[],a=!((n=e.omit)!=null&&n.has(`@opentelemetry/instrumentation-fetch`)),o=!((r=e.omit)!=null&&r.has(`@opentelemetry/instrumentation-xml-http-request`));if(!a&&!o)return i;let{FetchInstrumentation:s,XMLHttpRequestInstrumentation:c}=yield Promise.resolve().then(()=>(ap(),ip));if(a){var l,u,d,f;i.push(new s(U(U({},e[`@opentelemetry/instrumentation-fetch`]),{},{ignoreUrls:[...(l=(u=e.network)==null?void 0:u.ignoreUrls)==null?[]:l,...(d=(f=e[`@opentelemetry/instrumentation-fetch`])==null?void 0:f.ignoreUrls)==null?[]:d,...t],enabled:!1})))}if(o){var p,m,h,g;i.push(new c(U(U({},e[`@opentelemetry/instrumentation-xml-http-request`]),{},{ignoreUrls:[...(p=(m=e.network)==null?void 0:m.ignoreUrls)==null?[]:p,...(h=(g=e[`@opentelemetry/instrumentation-xml-http-request`])==null?void 0:g.ignoreUrls)==null?[]:h,...t],enabled:!1})))}return i});return function(t,n){return e.apply(this,arguments)}}();Promise.resolve();let sp=(e={},t=[])=>op(e,t),cp={isRecording:()=>!1,setEnabled:()=>{}};N(),F();let lp=new class{constructor({diagLogger:e=j.createComponentLogger({namespace:`mxl-registry`})}={}){P(this,`_sdk`,null),P(this,`_diag`,void 0),P(this,`register`,e=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=e}),P(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),P(this,`registered`,()=>this._sdk),this._diag=e}};W();let up=[`enabled`,`apiKey`],dp={additionalQueryParamsToScrub:`scrubbing.queryParams`,apiKey:`replay.apiKey`,apiURL:`configUrl`,appID:`appId`,applicationId:`appId`,attributeScrubbers:`scrubbing.scrubbers`,enableDefaultAttributeScrubbing:`scrubbing.defaults`,inactivityTimeoutSeconds:`session.inactivityTimeoutSeconds`,maxUserSessionDurationSeconds:`session.maxDurationSeconds`,otelCollectorURL:`collectorUrl`,recordUserSessions:`replay.enabled`},fp=e=>{let t=Object.keys(dp).filter(t=>t in e),n=e.defaultInstrumentationConfig,r=t.map(e=>`'${e}' was removed, use '${dp[e]}' instead`);if(n&&`replay`in n&&r.push(`'defaultInstrumentationConfig.replay' was removed, use 'replay' instead`),r.length>0)throw Error(`${r.join(`; `)}. See UPGRADING.md.`)},pp=e=>{if(e===void 0)return;if(typeof e!=`string`)throw Error(`appId must be a string, or omitted if not using MXL. Received ${String(e)}`);let t=e.trim();if(t===``)throw Error(`appId cannot be an empty string, omit it if not using MXL.`);return t},mp=e=>{if(e===void 0){let e=`MXLAppVersionX.X.X`;return e===``?`unspecified`:e}if(typeof e!=`string`)throw Error(`if appVersion is specified, it must be a string. Received ${String(e)}`);let t=e.trim();if(t===``)throw Error(`if appVersion is specified, it cannot be an empty string.`);return t},hp=(e,t,n)=>{if(t===void 0)return n;let r=typeof t==`string`?t.trim():``,i;try{i=new URL(r).protocol}catch(e){i=void 0}if(i!==`http:`&&i!==`https:`)throw Error(`${e} must be an absolute http(s) URL, or omitted to use the default. Received ${JSON.stringify(t)}`);return r.replace(/\/+$/,``)},gp=e=>{var t,n;fp(e);let r=(t=e.replay)==null?{}:t,{enabled:i=!0,apiKey:a}=r,o=Uo(r,up),{defaults:s=!0,queryParams:c=[],scrubbers:l=[]}=(n=e.scrubbing)==null?{}:n;return{appId:pp(e.appId),appVersion:mp(e.appVersion),attributeScrubbers:[...s?Bo(c):[],...l],collectorUrl:hp(`collectorUrl`,e.collectorUrl,`http://mxl-otelcol.apps.ocpthikadev01.safaricom.net`),configUrl:hp(`configUrl`,e.configUrl,`http://mxl-basket.apps.ocpthikadev01.safaricom.net`),replay:{apiKey:a,enabled:i,options:o},session:U({},e.session)}},_p=(e,t)=>{let n=e.nodeName.toLowerCase(),r=t.substring(0,30),i=t.length>30?`...`:``;return`<${n}${e.className?` class="${e.className}"`:``}>${r}${i}</${n}>`};F();var vp=class extends G{constructor({diag:e,perf:t,shouldTrack:n,innerTextForElement:r}={}){super({config:{},diag:e,instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onClickHandler`,void 0),this._onClickHandler=e=>{let t=e.target;if(t instanceof HTMLElement&&!t.hasAttribute(`disabled`)&&!(n&&!n(t)))try{let n=this.userSessionManager.getSessionPartSpan();n&&n.addEvent(`click`,{"mxl.type":`ux.tap`,"tap.coords":`${e.x.toString()},${e.y.toString()}`,"view.name":_p(t,r?r(t):t.textContent)},this.perf.epochMillisFromOriginOffset(e.timeStamp))}catch(e){this._diag.error(`failed to create new user interaction span event`,e)}},this._config.enabled&&this.enable()}onDisable(){document.removeEventListener(`click`,this._onClickHandler)}onEnable(){document.addEventListener(`click`,this._onClickHandler)}};W();let yp=[`diag`];function bp(e){var t,n;return typeof PerformanceObserver<`u`&&((t=(n=PerformanceObserver.supportedEntryTypes)==null?void 0:n.includes(e))==null?!1:t)}function xp(e,t,n){let r=n==null?{}:n,{diag:i}=r,a=Uo(r,yp);if(!bp(e))return i==null||i.debug(`${e} not supported, skipping observer`),null;try{let n=new PerformanceObserver(n=>{for(let r of n.getEntries())try{t(r)}catch(t){i==null||i.error(`error processing ${e} entry`,t)}});return n.observe(U({buffered:!0,type:e},a)),n}catch(e){return null}}let Sp=function(e){return 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`,e}({});function Cp(e,t){return t in e}function Z(e,t,n,r=!0){if(Cp(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function wp(e,t,n=!1,r=t.startTime!==0){n||(Z(e,`fetchStart`,t,r),Z(e,`domainLookupStart`,t,r),Z(e,`domainLookupEnd`,t,r),Z(e,`connectStart`,t,r),Z(e,`secureConnectionStart`,t,r),Z(e,`connectEnd`,t,r),Z(e,`requestStart`,t,r),Z(e,`responseStart`,t,r),Z(e,`responseEnd`,t,r));let i=t.encodedBodySize;i!==void 0&&e.setAttribute(`http.response_content_length`,i);let a=t.decodedBodySize;a!==void 0&&i!==a&&e.setAttribute(`http.response_content_length_uncompressed`,a)}let Tp=()=>window.performance.getEntriesByType(`navigation`)[0],Ep=(e=Tp())=>{var t;let n=e==null?void 0:e.notRestoredReasons;return n==null||(t=n.reasons)==null?void 0:t.map(e=>e.reason)},Dp=()=>{let e={},t=Tp();return t?(Object.values(Sp).forEach(n=>{if(Cp(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}}),e.transferSize=t.transferSize,e.initiatorType=t.initiatorType,e.responseStatus=t.responseStatus,e.deliveryType=t.deliveryType,e.renderBlockingStatus=t.renderBlockingStatus,e.type=t.type,e.notRestoredReasons=Ep(t),e):e},Op={"first-contentful-paint":`firstContentfulPaint`,"first-paint":`firstPaint`},kp=(e,t)=>{window.performance.getEntriesByType(`paint`).forEach(({name:n,startTime:r})=>{Cp(Op,n)&&e.addEvent(Op[n],t.epochMillisFromOriginOffset(r))})};N(),B(),_s(),R(),F();var Ap=class extends G{constructor({diag:e,perf:t,enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i=!1,ignoreNetworkEvents:a=!1}={}){super({config:{applyCustomAttributesOnSpan:r,enabled:n,ignoreNetworkEvents:a,ignorePerformancePaintEvents:i},diag:e,instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_navigationObserver`,null),P(this,`_performanceCollected`,!1),this._config.enabled&&this.enable()}_addResourcesSpans(e){performance.getEntriesByType(`resource`).forEach(t=>{this._initResourceSpan(t,e)})}_collectIfLoadEventFinished(){if(!(this._performanceCollected||!this._isLoadEventFinished())){this._performanceCollected=!0;try{this._collectPerformance()}catch(e){this._diag.error(`failed to collect the document load`,e)}finally{this._disconnectObserver()}}}_isLoadEventFinished(){var e;let[t]=performance.getEntriesByType(`navigation`);return((e=t==null?void 0:t.loadEventEnd)==null?0:e)>0}_disconnectObserver(){var e;(e=this._navigationObserver)==null||e.disconnect(),this._navigationObserver=null}_collectPerformance(){let e=[...document.getElementsByTagName(`meta`)].find(e=>e.getAttribute(`name`)===Yi),t=Dp(),n=(e==null?void 0:e.content)||``;A.with(qt.extract(T,{traceparent:n}),()=>{var e;let n=this._startSpan(`documentLoad`,`fetchStart`,t);if(!n){this._diag.warn(`navigation entry has no fetchStart, document load will not be collected`);return}A.with(M.setSpan(A.active(),n),()=>{let e=this._startSpan(`documentFetch`,`fetchStart`,t);e&&(e.setAttribute(oi,location.href),A.with(M.setSpan(A.active(),e),()=>{var n;wp(e,t,this.getConfig().ignoreNetworkEvents),this._addResourceAttributesToSpan(e,t),this._addNavigationTimingAttributesToSpan(e,t),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,`responseEnd`,t)}))}),n.setAttribute(I,`ux.document_load`),n.setAttribute(oi,location.href),n.setAttribute(li,navigator.userAgent),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(Z(n,`fetchStart`,t),Z(n,`unloadEventStart`,t),Z(n,`unloadEventEnd`,t),Z(n,`domInteractive`,t),Z(n,`domContentLoadedEventStart`,t),Z(n,`domContentLoadedEventEnd`,t),Z(n,`domComplete`,t),Z(n,`loadEventStart`,t),Z(n,`loadEventEnd`,t)),this.getConfig().ignorePerformancePaintEvents||kp(n,this.perf),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,`loadEventEnd`,t)})}_endSpan(e,t,n){e&&(Cp(n,t)&&typeof n[t]==`number`?e.end(this.perf.epochMillisFromOriginOffset(n[t])):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(`resourceFetch`,`fetchStart`,e,t);r&&(r.setAttribute(oi,e.name),wp(r,e,this.getConfig().ignoreNetworkEvents),this._addResourceAttributesToSpan(r,e),this._addResourceDiagnosticAttributes(r,e),this._addCustomAttributesOnResourceSpan(r,e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.resourceFetch),this._endSpan(r,`responseEnd`,e))}_startSpan(e,t,n,r){if(Cp(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:this.perf.epochMillisFromOriginOffset(n[t])},r?M.setSpan(A.active(),r):void 0)}_addCustomAttributesOnSpan(e,t){t&&hs(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addResourceAttributesToSpan(e,t){e.setAttribute(I,`ux.resource_fetch`),t.deliveryType&&e.setAttribute(`http.response.delivery_type`,t.deliveryType),t.initiatorType&&e.setAttribute(`http.request.initiator_type`,t.initiatorType),t.renderBlockingStatus&&e.setAttribute(`http.request.render_blocking_status`,t.renderBlockingStatus),t.responseStatus&&e.setAttribute(Qr,t.responseStatus),t.encodedBodySize!==void 0&&e.setAttribute($l,t.encodedBodySize),t.transferSize!==void 0&&e.setAttribute(`http.response.size`,t.transferSize),t.decodedBodySize!==void 0&&e.setAttribute(`http.response.decoded_body_size`,t.decodedBodySize)}_addNavigationTimingAttributesToSpan(e,t){var n;t.type&&e.setAttribute(`browser.navigation_timing.type`,t.type),(n=t.notRestoredReasons)!=null&&n.length&&e.setAttribute(nr,t.notRestoredReasons)}_addCustomAttributesOnResourceSpan(e,t,n){n&&hs(()=>{n(e,t)},e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}_hasNoSizeData(e){return e.transferSize===0&&e.decodedBodySize===0&&e.encodedBodySize===0}_hasTimingData(e){return e.fetchStart>0&&e.responseEnd>0}_isCorsRestricted(e){return this._hasNoSizeData(e)&&this._hasTimingData(e)}_isFetchIncomplete(e){return this._hasNoSizeData(e)&&e.fetchStart>0&&e.responseEnd===0}_isFetchPrevented(e){return this._hasNoSizeData(e)&&e.fetchStart===0}_isCacheValidated(e){return e.transferSize===300&&e.deliveryType!==`cache`}_addResourceDiagnosticAttributes(e,t){this._isCorsRestricted(t)?e.setAttribute(`http.response.cors_opaque`,!0):this._isFetchIncomplete(t)?e.setAttribute(`http.request.incomplete`,!0):this._isFetchPrevented(t)&&e.setAttribute(`http.request.prevented`,!0),this._isCacheValidated(t)&&e.setAttribute(`http.response.cache_revalidated`,!0)}onEnable(){if(this._isLoadEventFinished()){queueMicrotask(()=>{this._isEnabled&&this._collectIfLoadEventFinished()});return}this._navigationObserver=xp(`navigation`,()=>{this._collectIfLoadEventFinished()},{buffered:!1,diag:this._diag}),this._navigationObserver||this._diag.warn(`navigation entries are not observable, document load will not be collected`)}onDisable(){this._disconnectObserver()}};F();var jp=class extends G{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ElementTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_observer`,null),this._config.enabled&&this.enable()}onEnable(){if(!bp(`element`)){this._isEnabled=!1,this._diag.debug(`element not supported, skipping`);return}if(this._observer&&this._observer.disconnect(),this._observer=xp(`element`,e=>this._processEntry(e),{diag:this._diag}),!this._observer){this._isEnabled=!1,this._diag.error(`failed to enable`);return}}onDisable(){this._observer&&(this._observer.disconnect(),this._observer=null)}_processEntry(e){var t,n;if(!this._isEnabled||(t=this.limitManager)!=null&&t.limitElementTimingEntry())return;let r=this.tracer.startSpan(e.identifier,{attributes:{[I]:`ux.element_timing`,"mxl.element_timing.identifier":e.identifier,"mxl.element_timing.element":(n=e.element)==null||(n=n.tagName)==null?void 0:n.toLowerCase(),"mxl.element_timing.render_time":e.renderTime,"mxl.element_timing.load_time":e.loadTime,"mxl.element_timing.start_time":e.startTime,"mxl.element_timing.url":e.url,"mxl.element_timing.natural_width":e.naturalWidth,"mxl.element_timing.natural_height":e.naturalHeight},startTime:this.perf.epochMillisFromOriginOffset(0)});e.loadTime>0&&r.addEvent(`load`,this.perf.epochMillisFromOriginOffset(e.loadTime)),r.end(this.perf.epochMillisFromOriginOffset(e.startTime))}};F();var Mp=class extends G{constructor({diag:e,perf:t,rootNode:n,emptyCheckDelayMs:r=500}){super({config:{},diag:e,instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_observer`,void 0),P(this,`_emptyCheckDelayMs`,void 0),P(this,`_rootNode`,void 0),this._rootNode=n,this._emptyCheckDelayMs=r,this._observer=new MutationObserver((e,t)=>{this._observerCallback(e)}),this._config.enabled&&this._rootNode?this.enable():this._rootNode||this._diag.warn(`supplied root node was null, this instrumentation won't be enabled`)}onDisable(){this._observer.disconnect()}onEnable(){this._rootNode&&this._observer.observe(this._rootNode,{childList:!0})}_observerCallback(e){let t=!1,n=!1;for(let r of e)r.target===this._rootNode&&(r.removedNodes.length>0&&(t=!0),r.addedNodes.length>0&&(n=!0));t&&!n&&(this._diag.debug(`root node had child nodes removed without new ones being added, checking if it's empty in ${this._emptyCheckDelayMs}ms`),window.setTimeout(()=>{this._checkForEmptyRootNode()},this._emptyCheckDelayMs))}_checkForEmptyRootNode(){var e;if(((e=this._rootNode)==null?void 0:e.childNodes.length)===0){this._diag.debug(`root node was found to be empty`);let e=this.userSessionManager.getSessionPartSpan();e?e.addEvent(`empty-root-node`,{"mxl.type":`ux.empty_root_node`}):this._diag.debug(`no active session found to emit event on`)}}};F();var Np=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onErrorHandler`,void 0),P(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=e=>{this.logManager.logException(e.error||e.message,{handled:!1,handler:`global_exception`,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp)})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,handler:`promise_rejection`,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp)})},this._config.enabled&&this.enable()}onDisable(){window.removeEventListener(`error`,this._onErrorHandler),window.removeEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}onEnable(){window.addEventListener(`error`,this._onErrorHandler),window.addEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}};let Pp=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},Fp=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#${n.id}`:[Pp(n),...Array.from(n.classList).sort()].join(`.`);if(t.length+r.length>99)return t||r;if(t=t?`${r}>${t}`:r,n.id)break;e=n.parentNode}}catch(e){}return t};H(),F();var Ip=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`FirstInteractionInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onClick`,void 0),P(this,`_onKeyDown`,void 0),P(this,`_onScroll`,void 0),P(this,`_listenersAttached`,!1),this._onClick=e=>{this._handle({interactionType:e.pointerType===`touch`?`tap`:`click`,target:e.target instanceof Element?e.target:null,timestamp:e.timeStamp,x:e.clientX,y:e.clientY})},this._onKeyDown=e=>{this._handle({interactionType:`keypress`,target:e.target instanceof Element?e.target:null,timestamp:e.timeStamp})},this._onScroll=e=>{this._handle({interactionType:`scroll`,target:null,timestamp:e.timeStamp})},this._config.enabled&&this.enable()}onEnable(){this._attachListeners(),this.setSessionPartListeners({start:()=>{this._attachListeners()}})}onDisable(){this._detachListeners()}_handle(e){if(this._listenersAttached){this._detachListeners();try{this._emit(e)}catch(e){this._diag.error(`failed to process first-interaction candidate`,e)}}}_attachListeners(){if(this._listenersAttached)return;let e={capture:!0,passive:!0};document.addEventListener(`click`,this._onClick,e),document.addEventListener(`keydown`,this._onKeyDown,e),document.addEventListener(`scroll`,this._onScroll,e),this._listenersAttached=!0}_detachListeners(){if(!this._listenersAttached)return;let e={capture:!0};document.removeEventListener(`click`,this._onClick,e),document.removeEventListener(`keydown`,this._onKeyDown,e),document.removeEventListener(`scroll`,this._onScroll,e),this._listenersAttached=!1}_emit(e){let t=`document`,n=``;e.interactionType!==`scroll`&&e.target&&(t=e.target.tagName.toLowerCase(),n=Fp(e.target));let r={[I]:`mxl.otel_log`,"first_interaction.interaction_type":e.interactionType,"first_interaction.element_type":t,"first_interaction.element_selector":n,"first_interaction.time":this.perf.millisFromZeroTime(e.timestamp)};e.x!==void 0&&e.y!==void 0&&(r[`first_interaction.x`]=e.x,r[`first_interaction.y`]=e.y),this.logger.emit({timestamp:this.perf.epochMillisFromOriginOffset(e.timestamp),eventName:`first-interaction`,severityNumber:V.INFO,attributes:r})}};let Lp=()=>`mxlv2-${Date.now()}-${Math.floor(Math.random()*8999999999999)+0xe8d4a51000}`;H(),F();var Rp=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`LoafInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_observer`,null),P(this,`_isFirstEntry`,!0),P(this,`_totalDuration`,0),P(this,`_workDuration`,0),P(this,`_styleLayoutDuration`,0),P(this,`_count`,0),P(this,`_longestDuration`,0),P(this,`_longestDurationExcludingFirst`,0),P(this,`_totalBlockingDuration`,0),P(this,`_scriptSummaries`,new Map),this._config.enabled&&this.enable()}onEnable(){if(!bp(`long-animation-frame`)){this._isEnabled=!1,this._diag.debug(`long-animation-frame not supported, skipping`);return}if(this._observer&&this._observer.disconnect(),this._observer=xp(`long-animation-frame`,e=>this._processEntry(e),{diag:this._diag}),!this._observer){this._isEnabled=!1,this._diag.error(`failed to enable`);return}this.setSessionPartListeners({end:()=>{try{this._flushReport()}catch(e){this._diag.error(`error flushing report`,e)}}})}onDisable(){this._resetAccumulators(),this._observer&&(this._observer.disconnect(),this._observer=null)}_processEntry(e){if(this._isEnabled){this._count++,this._totalDuration+=e.duration,this._workDuration+=e.renderStart?e.renderStart-e.startTime:e.duration,e.styleAndLayoutStart&&(this._styleLayoutDuration+=Math.max(0,e.startTime+e.duration-e.styleAndLayoutStart)),this._longestDuration=Math.max(this._longestDuration,e.duration),this._isFirstEntry&&this._count===1?this._isFirstEntry=!1:(this._longestDurationExcludingFirst=Math.max(this._longestDurationExcludingFirst,e.duration),e.firstUIEventTimestamp===0&&(this._totalBlockingDuration+=e.blockingDuration));try{for(let t of e.scripts){let e=t.sourceURL||`(inline)`;e.length>2048&&(e=`${e.substring(0,2048)}...`);let n=this._scriptSummaries.get(e);n?(n.totalDuration+=t.duration,n.styleAndLayoutDuration+=t.forcedStyleAndLayoutDuration,n.count++):this._scriptSummaries.set(e,{count:1,styleAndLayoutDuration:t.forcedStyleAndLayoutDuration,totalDuration:t.duration})}}catch(e){this._diag.error(`error processing scripts for entry`,e)}}}_flushReport(){if(this._count===0)return;let e;e=this._totalBlockingDuration<=200?`good`:this._totalBlockingDuration<=600?`needs-improvement`:`poor`;let t={[I]:`ux.web_vital`,"mxl.web_vital.id":Lp(),"mxl.web_vital.name":`TBD`,"mxl.web_vital.value":Math.round(this._totalBlockingDuration),"mxl.web_vital.rating":e,"mxl.tbd.loaf_total_duration":Math.round(this._totalDuration),"mxl.tbd.loaf_work_duration":Math.round(this._workDuration),"mxl.tbd.loaf_style_and_layout_duration":Math.round(this._styleLayoutDuration),"mxl.tbd.loaf_count":this._count,"mxl.tbd.loaf_longest_duration":Math.round(this._longestDuration),"mxl.tbd.loaf_longest_duration_excluding_first":Math.round(this._longestDurationExcludingFirst)};try{this.logger.emit({attributes:t,eventName:`mxl-loaf-report`,severityNumber:V.INFO})}catch(e){this._diag.error(`error emitting loaf report`,e)}try{if(this._scriptSummaries.size>0){let e=[...this._scriptSummaries].sort((e,t)=>t[1].totalDuration-e[1].totalDuration).slice(0,250).map(([e,t])=>[e,{count:t.count,style_and_layout_duration:Math.round(t.styleAndLayoutDuration),total_duration:Math.round(t.totalDuration)}]);this.logger.emit({attributes:{[I]:`ux.loaf_scripts`},body:JSON.stringify(Object.fromEntries(e)),eventName:`mxl-loaf-scripts`,severityNumber:V.INFO})}}catch(e){this._diag.error(`error emitting loaf script summary`,e)}this._resetAccumulators()}_resetAccumulators(){this._totalDuration=0,this._workDuration=0,this._styleLayoutDuration=0,this._count=0,this._longestDuration=0,this._longestDurationExcludingFirst=0,this._totalBlockingDuration=0,this._scriptSummaries=new Map}};let zp=(e=document)=>{var t,n;let r=e.defaultView;if(!r)return null;let i=e.scrollingElement,a=i==null?e.documentElement:i;if(!a)return null;let o=a.scrollHeight,s=a.scrollWidth,c=(t=i==null?void 0:i.clientHeight)==null?r.innerHeight:t,l=(n=i==null?void 0:i.clientWidth)==null?r.innerWidth:n;return!o||!s||!c||!l?null:{documentHeight:o,documentWidth:s,scrollableHeight:Math.max(0,o-c),viewportHeight:c,viewportWidth:l}};H(),F(),W();var Bp=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`MaxScrollDepthInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onScrollHandler`,void 0),P(this,`_hasScrolled`,!1),P(this,`_maxScrollY`,0),this._onScrollHandler=()=>{try{let e=window.scrollY;e>this._maxScrollY&&(this._maxScrollY=e),this._hasScrolled=!0}catch(e){this._diag.error(`failed to process scroll`,e)}},this._config.enabled&&this.enable()}onEnable(){this._resetTracking(null),window.addEventListener(`scroll`,this._onScrollHandler,{passive:!0}),this.setSessionPartListeners({end:()=>{try{this._emit()}catch(e){this._diag.error(`failed to emit max-scroll-depth log`,e)}}})}onDisable(){window.removeEventListener(`scroll`,this._onScrollHandler)}_emit(){let e=null;try{this._maxScrollY=Math.max(this._maxScrollY,window.scrollY),e=zp();let t=e?this._scrollPercent(e):void 0;e&&t!==void 0&&(this._maxScrollY=Math.min(this._maxScrollY,e.scrollableHeight)),this.logger.emit({eventName:`max-scroll-depth`,severityNumber:V.INFO,attributes:U({[I]:`mxl.otel_log`,"max_scroll_depth.pixels":this._maxScrollY,"max_scroll_depth.did_scroll":this._hasScrolled},e?U(U({},t===void 0?{}:{"max_scroll_depth.percent":t}),{},{"max_scroll_depth.document_height":e.documentHeight}):{})})}finally{this._resetTracking(e)}}_resetTracking(e){let t=window.scrollY;this._maxScrollY=e?Math.max(0,Math.min(t,e.scrollableHeight)):Math.max(0,t),this._hasScrolled=!1}_scrollPercent({documentHeight:e,scrollableHeight:t}){let n=t===0?0:e;if(this._maxScrollY>n){this._diag.debug(`omitting max-scroll-depth percent, range is stale: reached ${String(this._maxScrollY)} past a bound of ${String(n)}`);return}return t===0?0:Math.min(100,Math.round(this._maxScrollY/t*100))}};H(),F();var Vp=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`RageClickInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onClickHandler`,void 0),P(this,`_eventWindow`,null),this._onClickHandler=e=>{try{this._handleClick(e)}catch(e){this._diag.error(`failed to process rage-click candidate`,e)}},this._config.enabled&&this.enable()}onDisable(){document.removeEventListener(`click`,this._onClickHandler),this._flush()}onEnable(){document.addEventListener(`click`,this._onClickHandler)}_handleClick(e){if(!(e.target instanceof Element))return;let t=e.target,n=e instanceof PointerEvent&&e.pointerType===`touch`?`tap`:`click`;if(this._eventWindow===null){this._eventWindow={target:t,x:e.clientX,y:e.clientY,count:1,interactionType:n,timestamp:e.timeStamp,timeoutId:window.setTimeout(()=>{try{this._flush()}catch(e){this._diag.error(`failed to emit rage-click log`,e)}},500)};return}let r=t===this._eventWindow.target,i=Math.abs(e.clientX-this._eventWindow.x),a=Math.abs(e.clientY-this._eventWindow.y);(r||i<=50&&a<=50)&&(this._eventWindow.count+=1)}_flush(){if(this._eventWindow===null)return;let e=this._eventWindow;window.clearTimeout(e.timeoutId),this._eventWindow=null,!(e.count<3)&&this.logger.emit({timestamp:this.perf.epochMillisFromOriginOffset(e.timestamp),eventName:`rage-click`,severityNumber:V.INFO,attributes:{[I]:`mxl.otel_log`,"rage_click.element_type":e.target.tagName.toLowerCase(),"rage_click.element_selector":Fp(e.target),"rage_click.x":e.x,"rage_click.y":e.y,"rage_click.count":e.count,"rage_click.interaction_type":e.interactionType}})}};H(),F();var Hp=class extends G{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ServerTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_navigationObserver`,null),P(this,`_performanceCollected`,!1),this._config.enabled&&this.enable()}_disconnectObserver(){var e;(e=this._navigationObserver)==null||e.disconnect(),this._navigationObserver=null}onEnable(){this._performanceCollected||(this._navigationObserver=xp(`navigation`,()=>{this._disconnectObserver(),this._readServerTiming()},{diag:this._diag}),this._navigationObserver||this._diag.warn(`navigation entries are not observable, server timings will not be collected`))}onDisable(){this._disconnectObserver()}_readServerTiming(){var e,t;if(this._performanceCollected)return;this._performanceCollected=!0;let n=(e=(t=performance.getEntriesByType(`navigation`)[0])==null?void 0:t.serverTiming)==null?[]:e;for(let e of n){var r;if((r=this.limitManager)!=null&&r.limitServerTimingEntry())return;this.logger.emit({attributes:{[I]:`ux.server_timing`,"mxl.server_timing.name":e.name,"mxl.server_timing.duration":e.duration,"mxl.server_timing.description":e.description},eventName:`mxl-server-timing`,severityNumber:V.INFO})}}};F(),W();function Up(e,t){return t.startTime<=e&&e<=t.startTime+t.duration?t:null}var Wp=class extends G{constructor({diag:e,perf:t,limitManager:n,navigationHost:r=window,signalBuffer:i}={}){super({config:{},diag:e,instrumentationName:`SoftNavigationPerformanceInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_observer`,null),P(this,`_eventObserver`,null),P(this,`_pendingNavigations`,[]),P(this,`_usePolyfill`,!1),P(this,`_navigationHost`,void 0),P(this,`_signalBuffer`,void 0),P(this,`_handleCurrentEntryChange`,e=>{var t;let n=(t=this._navigationHost.navigation)==null||(t=t.currentEntry)==null?void 0:t.url;if(!n){this._diag.debug(`currententrychange fired with no URL, skipping`);return}this._pendingNavigations.push({timestamp:e.timeStamp,url:n})}),this._navigationHost=r,this._signalBuffer=i,this._config.enabled&&this.enable()}enable(){bp(`soft-navigation`)?(this._usePolyfill=!1,super.enable()):this._navigationHost.navigation&&bp(`event`)?(this._usePolyfill=!0,super.enable()):this._diag.debug(`soft-navigation and navigation API not supported, skipping`)}onEnable(){this._usePolyfill?this._enablePolyfill():this._enableNative()}_enableNative(){this._observer&&this._observer.disconnect(),this._observer=xp(`soft-navigation`,e=>this._processEntry(e),{diag:this._diag}),this._observer||(this._isEnabled=!1,this._diag.error(`failed to enable`))}_enablePolyfill(){this._eventObserver&&this._eventObserver.disconnect();let e=this._navigationHost.navigation;if(!e){this._isEnabled=!1,this._diag.error(`failed to enable polyfill`);return}if(e.addEventListener(`currententrychange`,this._handleCurrentEntryChange),this._eventObserver=xp(`event`,e=>this._processClickEntry(e),{diag:this._diag,durationThreshold:16}),!this._eventObserver){var t;(t=e.removeEventListener)==null||t.call(e,`currententrychange`,this._handleCurrentEntryChange),this._isEnabled=!1,this._diag.error(`failed to enable polyfill`)}}onDisable(){var e,t;this._observer&&(this._observer.disconnect(),this._observer=null),this._eventObserver&&(this._eventObserver.disconnect(),this._eventObserver=null),(e=this._navigationHost.navigation)==null||(t=e.removeEventListener)==null||t.call(e,`currententrychange`,this._handleCurrentEntryChange),this._pendingNavigations.length=0}_correlationAttributes(e,t){if(!this._signalBuffer)return{};let{spanIds:n,spanTypes:r,logIds:i,logTypes:a}=this._signalBuffer.collectWindow(e,t);return{"mxl.soft_navigation.span_ids":n,"mxl.soft_navigation.span_id_types":r,"mxl.soft_navigation.log_ids":i,"mxl.soft_navigation.log_id_types":a}}_processEntry(e){var t;if(!this._isEnabled||(t=this.limitManager)!=null&&t.limitSoftNavigationEntry())return;let n=this.perf.epochMillisFromOriginOffset(e.startTime),r=this.perf.epochMillisFromOriginOffset(e.startTime+e.duration);this.tracer.startSpan(Td,{startTime:n,attributes:U({[tr]:e.name,[Ed]:Ad.performanceObserver,"mxl.soft_navigation.navigation_id":e.navigationId,[Dd]:e.interactionId,[Od]:this.perf.millisFromZeroTime(e.startTime),[kd]:e.duration,"mxl.soft_navigation.paint_time":e.paintTime==null?void 0:this.perf.millisFromZeroTime(e.paintTime),"mxl.soft_navigation.presentation_time":e.presentationTime==null?void 0:this.perf.millisFromZeroTime(e.presentationTime)},this._correlationAttributes(n,r))}).end(r)}_processClickEntry(e){if(!this._isEnabled||e.name!==`click`)return;this._pendingNavigations=this._pendingNavigations.filter(({timestamp:t})=>e.startTime-t<6e4);let t=this._pendingNavigations.findIndex(({timestamp:t})=>Up(t,e)!==null);if(t===-1)return;let[n]=this._pendingNavigations.splice(t,1);this._emitPolyfillSpan(e,n.timestamp,n.url)}_emitPolyfillSpan(e,t,n){var r;if(!this._isEnabled||(r=this.limitManager)!=null&&r.limitSoftNavigationEntry())return;let i=this.perf.epochMillisFromOriginOffset(e.startTime),a=this.perf.epochMillisFromOriginOffset(t);this.tracer.startSpan(Td,{startTime:i,attributes:U({[tr]:n,[Ed]:Ad.polyfill,[Od]:this.perf.millisFromZeroTime(e.startTime),[kd]:t-e.startTime,[Dd]:e.interactionId===0?void 0:e.interactionId},this._correlationAttributes(i,a))}).end(a)}};let Gp=`mxl.user_timing.start_time`,Kp=`mxl.user_timing.duration`,qp=`mxl.user_timing.entry_type`;H(),F(),W();var Jp=class extends G{constructor({diag:e,perf:t,limitManager:n,allowedEntries:r}={}){super({config:{},diag:e,instrumentationName:`UserTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_markObserver`,null),P(this,`_measureObserver`,null),P(this,`_seenEntries`,new Set),P(this,`_allowedEntries`,void 0),this._allowedEntries=r,this._config.enabled&&this.enable()}onEnable(){this._seenEntries=new Set,this._markObserver&&this._markObserver.disconnect(),this._measureObserver&&this._measureObserver.disconnect(),this._markObserver=xp(`mark`,this._processEntry.bind(this),{diag:this._diag}),this._markObserver||this._diag.error(`failed to enable mark observer`),this._measureObserver=xp(`measure`,e=>this._processEntry(e),{diag:this._diag}),this._measureObserver||this._diag.error(`failed to enable measure observer`),!this._markObserver&&!this._measureObserver&&(this._isEnabled=!1)}onDisable(){this._markObserver&&(this._markObserver.disconnect(),this._markObserver=null),this._measureObserver&&(this._measureObserver.disconnect(),this._measureObserver=null),this._seenEntries=new Set}_processEntry(e){var t;if(!this._isEnabled||this._allowedEntries!==void 0&&!(Array.isArray(this._allowedEntries)?this._allowedEntries.includes(e.name):this._allowedEntries(e)))return;let n=`${location.href}::${e.name}`;if(this._seenEntries.has(n)||(this._seenEntries.add(n),(t=this.limitManager)!=null&&t.limitUserTimingEntry(e.entryType)))return;if(e.entryType===`measure`){let t=e.detail;this.tracer.startSpan(e.name,{attributes:U({[I]:`ux.user_timing`,[$n]:`user_timing`,[qp]:e.entryType,[Gp]:this.perf.millisFromZeroTime(e.startTime),[Kp]:e.duration},t!=null&&{"mxl.user_timing.detail":JSON.stringify(t)}),startTime:this.perf.epochMillisFromOriginOffset(e.startTime)}).end(this.perf.epochMillisFromOriginOffset(e.startTime+e.duration));return}let{detail:r}=e,i=r==null?void 0:JSON.stringify(r);this.logger.emit({attributes:{[I]:`ux.user_timing`,"mxl.user_timing.name":e.name,[Gp]:this.perf.millisFromZeroTime(e.startTime),[Kp]:e.duration,[qp]:e.entryType},body:i,eventName:`mxl-user-timing`,severityNumber:V.INFO,timestamp:this.perf.epochMillisFromOriginOffset(e.startTime)})}};let Yp=`mxl.web_vital.attribution.`;F(),W();var Xp=class{constructor(){P(this,`t`,void 0),P(this,`o`,0),P(this,`i`,[])}l(e){var t;if(e.hadRecentInput)return;let n=this.i[0],r=this.i.at(-1);this.o&&n&&r&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),(t=this.t)==null||t.call(this,e)}};let Zp=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Qp=e=>{if(document.readyState===`loading`)return`loading`;let t=Zp();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`},$p=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},em=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){var n;let r=e,i=r.id?`#`+r.id:[$p(r),...Array.from((n=r.classList)==null?[]:n).sort()].join(`.`);if(t.length+i.length>99)return t||i;if(t=t?i+`>`+t:i,r.id)break;e=r.parentNode}}catch(e){}return t},tm=new WeakMap;function nm(e,t){let n=tm.get(t);return n||(n=new WeakMap,tm.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}let rm=-1,im=()=>rm,am=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(rm=t.timeStamp,e(t))},!0)},Q=(e,t,n,r)=>{let i,a;return o=>{var s;t.value>=0&&(o||r)&&(a=t.value-((s=i)==null?0:s),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},om=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},sm=()=>{var e,t;return(e=(t=Zp())==null?void 0:t.activationStart)==null?0:e},cm=-1,lm=new Set,um=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,dm=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of lm)e();isFinite(cm)||(cm=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,dm,!0))}},fm=(e=!1)=>{if(e&&(cm=1/0),cm<0){var t;let e=sm(),n=document.prerendering||(t=globalThis.performance.getEntriesByType(`visibility-state`).find(t=>t.name===`hidden`&&t.startTime>=e))==null?void 0:t.startTime;cm=n==null?um():n,addEventListener(`visibilitychange`,dm,!0),addEventListener(`prerenderingchange`,dm,!0),am(()=>{setTimeout(()=>{cm=um()})})}return{get firstHiddenTime(){return cm},onHidden(e){lm.add(e)}}},$=(e,t=-1,n,r=0,i,a,o)=>{let s=Zp(),c=(s==null?void 0:s.navigationId)||0,l=`navigate`;return n?l=n:im()>=0?l=`back-forward-cache`:s&&(document.prerendering||sm()>0?l=`prerender`:document.wasDiscarded?l=`restore`:s.type&&(l=s.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:l,navigationId:r||c,navigationInteractionId:i,navigationURL:a||(s==null?void 0:s.name),navigationStartTime:o||0}},pm=(e,t,n={})=>{try{let r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){let e=new PerformanceObserver(e=>{queueMicrotask(()=>{let n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(let t of r)e.observe(U({type:t,buffered:!0},n));return e}}catch(e){}},mm=e=>{var t,n;return((t=globalThis.PerformanceObserver)==null||(t=t.supportedEntryTypes)==null?void 0:t.includes(`soft-navigation`))&&typeof((n=globalThis.PerformanceSoftNavigation)==null||(n=n.prototype)==null?void 0:n.getLargestInteractionContentfulPaint)==`function`&&e&&e.reportSoftNavs},hm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let t=e.keys().next().value;t!==void 0&&e.delete(t)}},gm=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var _m=class{constructor(){P(this,`u`,void 0)}};let vm=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},ym=[1800,3e3],bm=(e,t={})=>{let n=mm(t);vm(()=>{let r=nm(t,_m),i=fm(),a,o=$(`FCP`),s=pm([`paint`],e=>{for(let t of e)t.name===`first-contentful-paint`&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(o.value=Math.max(t.startTime-sm(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,a(!0)))});s&&(a=Q(e,o,ym,t.reportAllChanges),am(n=>{o=$(`FCP`,-1,`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,im()),a=Q(e,o,ym,t.reportAllChanges),om(()=>{o.value=performance.now()-n.timeStamp,a(!0)})})),n&&pm([`soft-navigation`],n=>{n.forEach(n=>{r.u&&n.navigationId&&hm(r.u,n),o=$(`FCP`,Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0),`soft-navigation`,n.navigationId,n.interactionId,n.name,n.startTime),a=Q(e,o,ym,t.reportAllChanges),a(!0)})},t)})},xm=[.1,.25],Sm=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],Cm=(e,t={})=>{let n=nm(t=Object.assign({},t),Xp),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=Sm(e.sources),o=n==null?void 0:n.node;if(o){var i,a;let e=(i=(a=t.generateTarget)==null?void 0:a.call(t,o))==null?em(o):i;r.set(n,e)}}},((e,t={})=>{let n=fm();bm(gm(()=>{let r,i=$(`CLS`,0),a=nm(t,Xp),o=(n,o,s,c,l)=>{i=$(`CLS`,0,n,o,s,c,l),a.o=0,r=Q(e,i,xm,t.reportAllChanges)},s=(e=!1)=>{a.o>i.value&&(i.value=a.o,i.entries=a.i),r(e)},c=e=>{s(!0),o(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime)},l=e=>{for(let t of e)t.entryType===`soft-navigation`?c(t):a.l(t);s()},u=[`layout-shift`];mm(t)&&u.push(`soft-navigation`);let d=pm(u,l);d&&(r=Q(e,i,xm,t.reportAllChanges),n.onHidden(()=>{l(d.takeRecords()),r(!0)}),am(()=>{o(`back-forward-cache`,i.navigationId,i.navigationInteractionId,i.navigationURL,im()),om(r)}),setTimeout(r))}))})(t=>{e((e=>{let t={};if(e.entries.length){var n;let i=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(!(i==null||(n=i.sources)==null)&&n.length){let e=Sm(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:Qp(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},wm=(e,t={})=>{let n=nm(t=Object.assign({},t),_m);mm(t)&&(n.u=new Map),bm(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Qp(im())};if(e.navigationType!==`soft-navigation`){if(e.entries.length){let n=Zp(),r=e.entries.at(-1);if(n){let i=n.responseStart,a=n.activationStart||0,o=Math.max(0,i-a);t={timeToFirstByte:o,firstByteToFCP:e.value-o,loadState:Qp(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}}else{var r;let i=(r=n.u)==null?void 0:r.get(e.navigationId);i&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:`complete`,navigationEntry:i})}return Object.assign(e,{attribution:t})})(t))},t)},Tm=0,Em=1/0,Dm=0,Om=e=>{for(let t of e)t.interactionId&&(Em=Math.min(Em,t.interactionId),Dm=Math.max(Dm,t.interactionId),Tm=Dm?(Dm-Em)/7+1:0)},km,Am=()=>{var e;return km?Tm:(e=performance.interactionCount)==null?0:e},jm=()=>{`interactionCount`in performance||km||(km=pm([`event`],Om,{durationThreshold:0}))};var Mm=class{constructor(){P(this,`h`,0),P(this,`v`,[]),P(this,`p`,new Map),P(this,`m`,void 0),P(this,`M`,void 0)}T(){return Am()-this.h}D(){this.h=Am(),this.v.length=0,this.p.clear()}S(e){let t=this.T(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||n!==-1||e!==`soft-navigation`&&e!==`back-forward-cache`?this.v[n]:{k:8,id:-1,entries:[]}}l(e){var t;if((t=this.m)==null||t.call(this,e),!e.interactionId)return;let n=this.v.at(-1),r=this.p.get(e.interactionId);if(r||this.v.length<10||e.duration>n.k){var i;if(r?e.duration>r.k?(r.entries=[e],r.k=e.duration):e.duration===r.k&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],k:e.duration},this.p.set(r.id,r),this.v.push(r)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10){let e=this.v.splice(10);for(let t of e)this.p.delete(t.id)}(i=this.M)==null||i.call(this,r)}}};let Nm=e=>{let t=`requestIdleCallback`in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let i=gm(e),a=-1,o=()=>{r(a),i()};addEventListener(`visibilitychange`,o,{once:!0,capture:!0}),a=n(()=>{removeEventListener(`visibilitychange`,o,{capture:!0}),i()},{timeout:t})}},Pm=[200,500],Fm=(e,t={})=>{let n=nm(t=Object.assign({},t),Mm),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(c=!0,Nm(u))},u=()=>{let e=new Set(n.v.map(e=>o.get(e.entries[0]))),t=i.length-10;i=i.filter((n,r)=>r>=t||e.has(n));let s=new Set;for(let e of i){let t=d(e.startTime,e.processingEnd);for(let e of t)s.add(e)}let l=r.length-10;r=r.filter((e,t)=>s.has(e)||t>=l&&e.startTime>a),c=!1};n.m=e=>{let n=e.startTime+e.duration,r;a=Math.max(a,e.processingEnd);for(let a=i.length-1;a>=0;a--){let o=i[a];if(Math.abs(n-o.renderTime)<=8){r=o,r.startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),t.includeProcessedEventEntries&&r.entries.push(e);break}}r||(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:t.includeProcessedEventEntries?[e]:[]},i.push(r)),e.interactionId&&o.set(e,r),l()},n.M=e=>{if(!s.get(e)){var n;let o=(n=e.entries.find(e=>e.target))==null?void 0:n.target;if(o){var r,i;let n=(r=(i=t.generateTarget)==null?void 0:i.call(t,o))==null?em(o):r;s.set(e,n)}else{var a;let t=(a=e.entries.find(e=>e.targetSelector))==null?void 0:a.targetSelector;t&&s.set(e,t)}}};let d=(e,t)=>{let n=[];for(let i of r)if(!(i.startTime+i.duration<e)){if(i.startTime>t)break;n.push(i)}return n},f=e=>{if(e.entries.length===0){let t=e.navigationStartTime||0,n={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:Qp(t)};return Object.assign(e,{attribution:n})}let t=e.entries[0],r=o.get(t),i=Math.max(r.processingStart,t.startTime),a=Math.max(t.startTime+t.duration,i),c=Math.min(r.processingEnd,a),l=r.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,c),f=n.p.get(t.interactionId),p={interactionTarget:s.get(f),interactionType:t.name.startsWith(`key`)?`keyboard`:`pointer`,interactionTime:t.startTime,nextPaintTime:a,processedEventEntries:l,longAnimationFrameEntries:u,inputDelay:i-t.startTime,processingDuration:c-i,presentationDelay:a-c,loadState:Qp(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;let n=e.interactionTime,r=e.nextPaintTime;if(!((t=e.longAnimationFrameEntries)!=null&&t.length)||!n||!r)return;let i=e.inputDelay,a=e.processingDuration,o,s,c=0,l=0,u=0,d=0;for(let t of e.longAnimationFrameEntries){l=l+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let r=t-Math.max(n,e.startTime),u=e.duration?r/e.duration*e.forcedStyleAndLayoutDuration:0;c+=r-u,l+=u,r>d&&(s=e.startTime<n+i?`input-delay`:e.startTime>=n+i+a?`presentation-delay`:`processing-duration`,o=e,d=r)}}let f=e.longAnimationFrameEntries.at(-1),p=f?f.startTime+f.duration:0;p>=n+i+a&&(u=r-p),o&&s&&(e.longestScript={entry:o,subpart:s,intersectingDuration:d}),e.totalScriptDuration=c,e.totalStyleAndLayoutDuration=l,e.totalPaintDuration=u,e.totalUnattributedDuration=r-n-c-l-u})(p),Object.assign(e,{attribution:p})};pm([`long-animation-frame`],e=>{r=r.concat(e),l()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=fm();vm(()=>{var r;jm();let i,a=$(`INP`),o=nm(t,Mm),s=(n,r,s,c,l)=>{o.D(),a=$(`INP`,-1,n,r,s,c,l),i=Q(e,a,Pm,t.reportAllChanges)},c=()=>{let e=o.S(a.navigationType);e&&e.k!==a.value&&(a.value=e.k,a.entries=e.entries,i())},l=e=>{c(),i(!0),s(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Nm(()=>{for(let t of e)t.entryType===`soft-navigation`?l(t):o.l(t);c(),t&&i(!0)})},d=[`event`,`first-input`];mm(t)&&d.push(`soft-navigation`);let f=pm(d,u,U(U({},t),{},{durationThreshold:(r=t.durationThreshold)==null?40:r}));i=Q(e,a,Pm,t.reportAllChanges),f&&(n.onHidden(()=>{u(f.takeRecords(),!0)}),am(()=>{s(`back-forward-cache`,a.navigationId,a.navigationInteractionId,a.navigationURL,im())}))})})(t=>{e(f(t))},t)};var Im=class{constructor(){P(this,`m`,void 0),P(this,`u`,void 0)}l(e){var t;(t=this.m)==null||t.call(this,e)}};let Lm=[2500,4e3],Rm=50,zm=[];pm([`resource`],e=>{for(let t of e)zm.push(t),zm.length>Rm&&zm.shift()});let Bm=(e,t={})=>{(t=Object.assign({},t)).resourceBufferSize!=null&&(Rm=t.resourceBufferSize);let n=nm(t,Im),r=new WeakMap;mm(t)&&(n.u=new Map),n.m=e=>{let n=e.element;if(n){var i,a;let o=(i=(a=t.generateTarget)==null?void 0:a.call(t,n))==null?em(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{let n=!1,r=mm(t);vm(()=>{let i,a=fm(),o=$(`LCP`),s=nm(t,Im),c=(r,s,c,l,u)=>{o=$(`LCP`,-1,r,s,c,l,u),i=Q(e,o,Lm,t.reportAllChanges),n=!1,r===`soft-navigation`&&(a=fm(!0))},l=e=>{var t;s.u&&e.navigationId&&hm(s.u,e),n||i(!0),c(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime);let r=(t=e.getLargestInteractionContentfulPaint)==null?void 0:t.call(e);r&&u([r])},u=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(let t of e){if(!t)continue;if(t.entryType===`soft-navigation`){l(t);continue}let e=0,r=[],c=t.startTime;if(t.entryType===`largest-contentful-paint`)e=Math.max(t.startTime-sm(),0),s.l(t),r=[t];else if(t.entryType===`interaction-contentful-paint`){var n;let i=t;if(!o.navigationId||`interactionId`in i&&i.interactionId!=o.navigationInteractionId)continue;c=((n=i.largestContentfulPaint)==null?void 0:n.renderTime)||0,e=Math.max(c-t.startTime,0),i.largestContentfulPaint&&(s.l(i.largestContentfulPaint),r=[i.largestContentfulPaint])}c<a.firstHiddenTime&&(o.value=e,o.entries=r,i())}},d=[`largest-contentful-paint`];r&&d.push(`interaction-contentful-paint`,`soft-navigation`);let f=pm(d,u);if(f){i=Q(e,o,Lm,t.reportAllChanges);let a=[`keydown`,`click`,`visibilitychange`],s=e=>{if(e.isTrusted&&!n){let e=o.id;Nm(()=>{if(!n){if(!r){f.disconnect();for(let e of a)removeEventListener(e,s,{capture:!0})}e===o.id&&(n=!0,i(!0))}})}};for(let e of a)addEventListener(e,s,{capture:!0});am(r=>{c(`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,im()),i=Q(e,o,Lm,t.reportAllChanges),om(()=>{o.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var i,a,o;let s=e.entries.at(-1),c=e=>e.name===s.url&&(e.requestStart||e.startTime)<=s.startTime,l=s.url&&(zm.findLast(c)||performance.getEntriesByType(`resource`).findLast(c)),u;t.target=r.get(s),t.lcpEntry=s,s.url&&(t.url=s.url),l&&(t.lcpResourceEntry=l);let d=0,f=0;if(e.navigationType===`soft-navigation`?(d=e.navigationStartTime||0,u=(o=n.u)==null?void 0:o.get(e.navigationId)):(u=Zp(),d=(i=u==null?void 0:u.activationStart)==null?0:i,f=(a=u==null?void 0:u.responseStart)==null?0:a),u){let n=Math.max(0,f-d),r=Math.max(n,l?(l.requestStart||l.startTime)-d:0),i=Math.min(e.value,Math.max(r,l?l.responseEnd-d:0));t=U(U({},t),{},{timeToFirstByte:n,resourceLoadDelay:r-n,resourceLoadDuration:i-r,elementRenderDelay:e.value-i,navigationEntry:u})}}return Object.assign(e,{attribution:t})})(t))},t)},Vm=[800,1800],Hm=e=>{document.prerendering?vm(()=>Hm(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>Hm(e),!0)},Um=(e,t={})=>{((e,t={})=>{let n=mm(t),r=$(`TTFB`),i=Q(e,r,Vm,t.reportAllChanges);Hm(()=>{let a=Zp();if(a){let o=a.responseStart;r.value=Math.max(o-sm(),0),r.entries=[a],i(!0),am(()=>{r=$(`TTFB`,0,`back-forward-cache`,r.navigationId,r.navigationInteractionId,r.navigationURL,im()),i=Q(e,r,Vm,t.reportAllChanges),i(!0)}),n&&pm([`soft-navigation`],n=>{n.forEach(n=>{n.navigationId&&(r=$(`TTFB`,0,`soft-navigation`,n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Q(e,r,Vm,t.reportAllChanges),i(!0))})},t)}})})(t=>{e((e=>{let t=e.entries[0],n={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0,navigationEntry:t};if(e.entries.length&&t instanceof PerformanceNavigationTiming){let r=t.activationStart||0,i=Math.max((t.workerStart||t.fetchStart||0)-r,0),a=Math.max(t.domainLookupStart-r,0),o=Math.max(t.connectStart-r,0),s=Math.max(t.connectEnd-r,0);n={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:t}}return Object.assign(e,{attribution:n})})(t))},t)},Wm=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],Gm={CLS:Cm,FCP:wm,LCP:Bm,INP:Fm,TTFB:Um,FID:void 0};H(),B(),_s(),F(),W();let Km=[`diag`,`perf`,`listeners`,`urlDocument`,`urlAttribution`,`includeRawAttribution`,`reportSoftNavs`,`pageManager`,`applyCustomLogRecordData`],qm=e=>Math.round(Math.max(0,e)),Jm=e=>{var t,n,r,i;return{x:Math.round((t=e==null?void 0:e.x)==null?0:t),y:Math.round((n=e==null?void 0:e.y)==null?0:n),width:Math.round((r=e==null?void 0:e.width)==null?0:r),height:Math.round((i=e==null?void 0:e.height)==null?0:i)}},Ym=e=>{let t=typeof e;return t===`number`||t===`string`||t===`boolean`},Xm=(e,t)=>{let n={},r=e.attribution;try{if(r.longAnimationFrameEntries.length>0){let e=new Map;for(let t of r.longAnimationFrameEntries)for(let n of t.scripts){let t=n.sourceURL||`(inline)`;t.length>2048&&(t=`${t.substring(0,2048)}...`);let r=e.get(t);r?(r.totalDuration+=n.duration,r.styleAndLayoutDuration+=n.forcedStyleAndLayoutDuration,r.count++):e.set(t,{count:1,styleAndLayoutDuration:n.forcedStyleAndLayoutDuration,totalDuration:n.duration})}e.size>0&&(n[`${Yp}loaf_scripts`]=JSON.stringify(Object.fromEntries([...e].sort((e,t)=>t[1].totalDuration-e[1].totalDuration).slice(0,250).map(([e,t])=>[e,{count:t.count,style_and_layout_duration:Math.round(t.styleAndLayoutDuration),total_duration:Math.round(t.totalDuration)}]))))}}catch(e){t.error(`error building loaf scripts for INP`,e)}return n},Zm=(e,t)=>{let n={};try{let t=e.entries;if(t.length>0){let e=t.slice(0,50).map(e=>{var t;let n=e.sources[0];return{selector:Fp((t=n==null?void 0:n.node)==null?null:t),startRect:Jm(n==null?void 0:n.previousRect),endRect:Jm(n==null?void 0:n.currentRect)}}),r=Yp;n[`${r}clsLayoutShifts`]=JSON.stringify(e),t.length>50&&(n[`${r}clsLayoutShiftsDroppedCount`]=t.length-50)}}catch(e){t.error(`error building CLS layout shifts`,e)}return n},Qm=(e,t)=>{let n={};try{var r,i;let t=(r=e.entries.find(e=>e.target))==null?void 0:r.target,a=t==null||(i=t.tagName)==null?void 0:i.toLowerCase();a&&(n[`${Yp}element_type`]=a)}catch(e){t.error(`error building INP element type attribution`,e)}return n},$m=(e,t)=>{let n={},r=e.attribution.navigationEntry;if(r)try{var i;let e=qm(r.redirectEnd-r.redirectStart),t=qm(r.domainLookupEnd-r.domainLookupStart),a=qm(r.secureConnectionStart>0?r.secureConnectionStart-r.connectStart:r.connectEnd-r.connectStart),o=qm(r.secureConnectionStart>0?r.connectEnd-r.secureConnectionStart:0),s=qm(Math.max((i=r.finalResponseHeadersStart)==null?0:i,r.responseStart)-r.requestStart),c=qm(Math.round(r.responseEnd-r.startTime)-e-t-a-o-s),l=Yp;n[`${l}redirect`]=e,n[`${l}domainLookup`]=t,n[`${l}tcpConnection`]=a,n[`${l}tlsNegotiation`]=o,n[`${l}serverResponse`]=s,n[`${l}unattributed`]=c}catch(e){t.error(`error computing TTFB timing breakdown`,e)}else t.debug(`TTFB navigationEntry unavailable, skipping timing breakdown`);return n},eh=(e,t)=>{let n={};try{var r;let t=(r=e.attribution.lcpEntry)==null?void 0:r.element;if(t){let e=t.tagName.toLowerCase(),r=JSON.stringify(Jm(t.getBoundingClientRect())),i=Yp;n[`${i}elementType`]=e,n[`${i}elementBoundingRect`]=r}}catch(e){t.error(`error building LCP element attribution`,e)}return n};var th=class extends G{constructor(e={}){let{diag:t,perf:n,listeners:r=Gm,urlDocument:i,urlAttribution:a=!0,includeRawAttribution:o=!0,reportSoftNavs:s=!0,pageManager:c,applyCustomLogRecordData:l}=e,u=Uo(e,Km);super({config:u,diag:t,instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,perf:n}),P(this,`_listeners`,void 0),P(this,`_urlDocument`,void 0),P(this,`_urlAttribution`,void 0),P(this,`_includeRawAttribution`,void 0),P(this,`_softNavsActive`,void 0),P(this,`_pageManager`,void 0),P(this,`_attributedPage`,{CLS:void 0,FCP:void 0,INP:void 0,LCP:void 0,TTFB:void 0}),P(this,`_largestShiftTargetForCLS`,null),P(this,`_clsMetricId`,void 0),P(this,`_applyCustomLogRecordData`,void 0),P(this,`_listenersRegistered`,!1),this._listeners=r,this._urlDocument=i==null?window.document:i,this._urlAttribution=a,this._includeRawAttribution=o,this._softNavsActive=s&&bp(`soft-navigation`),this._pageManager=c==null?On.getPageManager():c,this._applyCustomLogRecordData=l,this._config.enabled!==!1&&this.enable()}enable(){typeof PerformanceObserver<`u`?super.enable():this._diag.debug(`PerformanceObserver not supported, web vitals will not be collected`)}onDisable(){this._diag.debug(`WebVitalsInstrumentation disabled, pausing emission`)}onEnable(){if(this._listenersRegistered){this._diag.debug(`WebVitalsInstrumentation listeners already registered, resuming emission`);return}this._listenersRegistered=!0,Wm.forEach(e=>{var t,n;let r=e!==`TTFB`&&this._softNavsActive;if(this._urlAttribution){var i,a;(i=(a=this._listeners)[e])==null||i.call(a,e=>{if(this._isEnabled)if(e.name===`CLS`){let t=e,n=t.attribution.largestShiftTarget;this._clsMetricId===t.id?this._largestShiftTargetForCLS!==n&&(this._largestShiftTargetForCLS=n,this._attributedPage.CLS=this._currentAttributedPage()):(this._clsMetricId=t.id,this._largestShiftTargetForCLS=n,this._attributedPage.CLS=this._currentAttributedPage())}else this._attributedPage[e.name]=this._currentAttributedPage()},{reportAllChanges:!0,reportSoftNavs:r})}(t=(n=this._listeners)[e])==null||t.call(n,e=>{this._isEnabled&&this._emitWebVital(e)},{reportSoftNavs:r})})}_currentAttributedPage(){var e,t,n;return{fullURL:this._urlDocument.URL,label:(e=this._pageManager.getPageLabel())==null?void 0:e,pageID:(t=this._pageManager.getCurrentPageId())==null?void 0:t,path:(n=this._pageManager.getCurrentRoute())==null?void 0:n.path}}_getTimeForMetric(e){var t;if(e.name===`INP`&&e.attribution.interactionTime!==void 0)return this.perf.epochMillisFromOriginOffset(e.attribution.interactionTime);if(e.name===`CLS`){let t=e.entries.length>0?Math.min(...e.entries.map(e=>e.startTime)):e.attribution.largestShiftTime;if(t!==void 0)return this.perf.epochMillisFromOriginOffset(t)}if(e.name===`TTFB`)return this.perf.getZeroTime();let n=(t=e.entries[e.entries.length-1])==null?void 0:t.startTime;return n===void 0?this.perf.getNowMillis():this.perf.epochMillisFromOriginOffset(n)}_emitWebVital(e){let t=this._attributedPage[e.name],n=this._getTimeForMetric(e),r=this.userSessionManager.getSessionPartIdAt(n),i=Ep(),a={attributes:U(U(U(U(U(U(U(U(U(U({[I]:`ux.web_vital`,"browser.web_vital.name":e.name.toLowerCase(),"browser.web_vital.value":e.value,"browser.web_vital.delta":e.delta,"browser.web_vital.rating":e.rating,"browser.web_vital.id":e.id,"browser.web_vital.navigation_type":e.navigationType},e.navigationId===void 0?{}:{"browser.web_vital.navigation_id":e.navigationId}),e.navigationInteractionId===void 0?{}:{"browser.web_vital.interaction_id":e.navigationInteractionId}),r===null?{}:{[or]:r}),i!=null&&i.length?{[nr]:i}:{}),t?{[tr]:e.navigationURL!=null&&(e.navigationType===`soft-navigation`||this._softNavsActive)?e.navigationURL:t.fullURL,[rr]:t.path,[ir]:t.pageID,[ar]:t.label}:{}),e.name===`INP`?Xm(e,this._diag):{}),e.name===`INP`?Qm(e,this._diag):{}),e.name===`TTFB`?$m(e,this._diag):{}),e.name===`CLS`?Zm(e,this._diag):{}),e.name===`LCP`?eh(e,this._diag):{}),body:this._includeRawAttribution&&e.attribution!=null?JSON.stringify(Object.fromEntries(Object.entries(e.attribution).filter(([,e])=>Ym(e)))):void 0,eventName:`browser.web_vital`,severityNumber:V.INFO,timestamp:yi(n)};this._applyCustomLogRecordData&&hs(()=>{var e;return(e=this._applyCustomLogRecordData)==null?void 0:e.call(this,a)},e=>{e&&this._diag.error(`applyCustomLogRecordData hook failed`,e)},!0),this.logger.emit(a)}};W();let nh=(e={},{logManager:t,userSessionManager:n,pageManager:r,limitManager:i,includeReplay:a=!1,autoStart:o=!0,replayOptions:s,replayContext:c,sessionStorage:l,signalBuffer:u})=>{var d,f,p,m,h,g,_,v,ee,y,b,te,ne;let x=[];if((d=e.omit)!=null&&d.has(`exception`)||x.push(new Np(e.exception)),(f=e.omit)!=null&&f.has(`click`)||x.push(new vp(e.click)),(p=e.omit)!=null&&p.has(`rage-click`)||x.push(new Vp(e[`rage-click`])),(m=e.omit)!=null&&m.has(`first-interaction`)||x.push(new Ip(e[`first-interaction`])),(h=e.omit)!=null&&h.has(`max-scroll-depth`)||x.push(new Bp(e[`max-scroll-depth`])),(g=e.omit)!=null&&g.has(`web-vital`)||x.push(new th(U(U({},e[`web-vital`]),{},{pageManager:r}))),(_=e.omit)!=null&&_.has(`loaf`)||x.push(new Rp(U({},e.loaf))),(v=e.omit)!=null&&v.has(`user-timing`)||x.push(new Jp(e[`user-timing`])),(ee=e.omit)!=null&&ee.has(`element-timing`)||x.push(new jp(U(U({},e[`element-timing`]),{},{limitManager:i}))),(y=e.omit)!=null&&y.has(`soft-navigation-performance`)||x.push(new Wp(U({limitManager:i,signalBuffer:u},e[`soft-navigation-performance`]))),(b=e.omit)!=null&&b.has(`document-load`)||x.push(new Ap(e[`document-load`])),(te=e.omit)!=null&&te.has(`server-timing`)||x.push(new Hp(U(U({},e[`server-timing`]),{},{limitManager:i}))),e[`empty-root`]&&x.push(new Mp(U({},e[`empty-root`]))),a&&!((ne=e.omit)!=null&&ne.has(`replay`))){if(!c)throw Error(`replayContext is required when includeReplay is true`);if(!l)throw Error(`sessionStorage is required when includeReplay is true`);x.push(new Zo({autoStart:o,replayContext:c,rrwebOptions:s,sessionStorage:l}))}for(let e of x)e instanceof G&&(n&&e.setUserSessionManager(n),t&&e.setLogManager(t),i&&e.setLimitManager(i));return x};N(),H(),_s(),W(),q();let rh=(e={})=>{let{resource:t=Cs(),spanExporters:n=[],logExporters:r=[],spanProcessors:i=[],propagator:a=null,defaultInstrumentationConfig:o,instrumentations:s=[],contextManager:c=null,logProcessors:l=[],logLevel:u=y.ERROR,diagLogger:d=j.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:f,dynamicSDKConfig:p,registerGlobally:m=!0,blockNetworkSpanForwarding:h=!1,restrictedProtocols:g=new Set([`file:`]),useDocumentTitleAsPageLabel:_=!0,serviceName:v,exception:ee}=e;try{var b,te,ne,x;if(m){let e=lp.registered();if(e!==null)return d.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}if(j.setLogger(new ue,{logLevel:u}),typeof window>`u`)return d.warn(`browser not detected, skipping initialization`),!1;let y=new ga,S=y.getNowMillis();window.addEventListener(`pageshow`,e=>ha(y.epochMillisFromOriginOffset(e.timeStamp)));let C=gp(e),{appId:w,appVersion:re,collectorUrl:ie,configUrl:ae}=C,oe=w!==void 0;if(!oe&&!r.length&&!n.length)throw Error(`when appId is omitted, at least one logExporter or spanExporter must be set`);if(g.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(oe&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let se=m?void 0:w,T=new Gd({diag:d,namespace:se,storage:window.localStorage}),ce=new Gd({diag:d,namespace:se,storage:window.sessionStorage}),le=ih({registerGlobally:m,sdkLocalStorage:T}),E=le.getMXLUserId();if(oe&&!E)throw Error(`userID is required when using MXL exporter`);let de=U({},p),D=f==null?new Su({appId:w,appVersion:re,configUrl:ae,defaultConfig:de,deviceId:E,storage:T}):f;D.refreshRemoteConfig();let fe=(b=(te=D.resolveApplicationServiceName)==null?void 0:te.call(D,v))==null?(()=>{var e;return(v==null?void 0:v.trim())||((e=D.getConfig().serviceName)==null?void 0:e.trim())||cu})():b,pe=lu({serviceName:fe}).merge(t).merge(uu({appId:w,appVersion:re,diagLogger:d,enduserPseudoId:E,pageSessionStorage:ce})),me=new Lu({blockNetworkSpanForwarding:h,deviceId:E,dynamicConfigManager:D});if(!me.isSDKEnabled())return d.debug(`SDK is disabled, skipping initialization.`),!1;let he=Kd({defaultInstrumentationConfig:o,diag:d,featureManager:me,propagator:a,registerGlobally:m}),ge=new Eu(wu),O=ah({dynamicConfigManager:D,limitManager:ge,perf:y,registerGlobally:m,sdkLocalStorage:T,sdkSessionStorage:ce,userSessionConfig:C.session}),_e,ve;w!==void 0&&(_e=new Pd({emptySessionAvoidanceEnabled:me.isEmptySessionAvoidanceEnabled(),exporter:new Al({appId:w,collectorUrl:ie,userID:E}),limitManager:ge,userSessionManager:O}),ve=new Zs({exporter:new Ol({appId:w,collectorUrl:ie,userID:E})}));let ye=ch({registerGlobally:m,useDocumentTitleAsPageLabel:_,userSessionManager:O,perf:y}),be=!(o==null||(ne=o.omit)==null)&&ne.has(`soft-navigation-performance`)?void 0:new Ud,{tracerProvider:xe,mxlTraceManager:Se}=oh({attributeScrubbers:C.attributeScrubbers,contextManager:c,mxlSpanProcessor:_e,pageManager:ye,propagator:he?new Wd:a,registerGlobally:m,resource:pe,signalBuffer:be,spanExporters:n,spanProcessors:i,userManager:le});O.setTracerProvider(xe);let{loggerProvider:Ce,mxlLogManager:we}=sh({attributeScrubbers:C.attributeScrubbers,exception:ee,limitManager:ge,logExporters:r,logProcessors:l,mxlLogProcessor:ve,pageManager:ye,perf:y,registerGlobally:m,resource:pe,sdkLocalStorage:T,signalBuffer:be,userManager:le,userSessionManager:O,visibilityDoc:window.document}),Te=new Ql({appId:w==null?``:w,loggerProvider:Ce,pageManager:ye,storage:T,userManager:le,userSessionManager:O});O.setAnalyticsManager(Te),m&&xn.setGlobalAnalyticsManager(Te),O.startSessionPartInternal({reason:`init`});let Ee=typeof window<`u`&&window.__MXL_DISABLE_SESSION_RECORDER===!0,{autoStart:De,replay:Oe}=Cu({autoStart:C.replay.enabled,dynamicConfig:D.getConfig(),isSessionReplayEnabled:me.isSessionReplayEnabled(),replay:C.replay.options}),ke=!!(oe&&E&&!Ee&&me.isSessionReplayEnabled()),Ae=ke&&De&&Oe!=null&&Oe.omitRedundantInstrumentations?[`click`,`exception`,`@opentelemetry/instrumentation-fetch`,`@opentelemetry/instrumentation-xml-http-request`]:void 0,je=Ae===void 0?o:U(U({},o),{},{omit:new Set([...(x=o==null?void 0:o.omit)==null?[]:x,...Ae])}),Me=ke&&w!==void 0&&E?{appId:w,appVersion:re,redactUrl:Vo(C.attributeScrubbers),serviceName:fe,transport:Fl({apiKey:C.replay.apiKey,appId:w,collectorUrl:ie,configUrl:ae}),userID:E}:void 0,Ne=()=>nh(je,{includeReplay:ke,limitManager:ge,logManager:we,pageManager:ye,autoStart:De,replayContext:Me,replayOptions:Oe,sessionStorage:ce,signalBuffer:be,userSessionManager:O}),Pe,Fe,Ie;if(m){let e=nh(je,{includeReplay:ke,limitManager:ge,pageManager:ye,autoStart:De,replayContext:Me,replayOptions:Oe,sessionStorage:ce,signalBuffer:be,userSessionManager:O});Pe=e.find(e=>e instanceof Zo),Fe=ts({instrumentations:[...e,...s]})}else{let e=Ne();Pe=e.find(e=>e instanceof Zo),Fe=ts({instrumentations:[...e,...s],loggerProvider:Ce,tracerProvider:xe})}let Le=!1,Re=!1;sp(je,Jd({collectorUrl:ie,configUrl:ae})).then(e=>{Re||e.length===0||(Ie=ts(m?{instrumentations:e}:{instrumentations:e,loggerProvider:Ce,tracerProvider:xe}))}).catch(e=>{d.warn(`failed to load network instrumentations: ${e instanceof Error?e.message:String(e)}`)});let k=()=>{Re||(Re=!0,Pe==null||Pe.disable(),Fe==null||Fe(),Ie==null||Ie(),O._shutdown())},ze=Pe?jl(Pe):cp;d.info(`successfully initialized the SDK`);let Be={analytics:Te,flush:function(){var e=K(function*(){yield xe.forceFlush(),yield Ce.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:we,page:ye,session:O,sessionRecording:ze,setDynamicConfig:e=>{D.setConfig(e)},shutdown:function(){var e=K(function*(){Le||(Le=!0,k(),yield xe.shutdown(),yield Ce.shutdown())});return function(){return e.apply(this,arguments)}}(),stop:k,trace:Se,user:le};return m&&lp.register(Be),O.recordSDKStartupDuration(y.getNowMillis()-S),Te.screenView(),Be}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return d.error(`failed to initialize the SDK: ${t}`),!1}},ih=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new Hu({storage:t});return e&&Xn.setGlobalUserManager(n),n},ah=({dynamicConfigManager:e,limitManager:t,perf:n,registerGlobally:r,sdkLocalStorage:i,sdkSessionStorage:a,userSessionConfig:o})=>{let s=new vd({config:o,dynamicConfigManager:e,limitManager:t,perf:n,storage:i,tabStorage:a,visibilityDoc:window.document});return r&&Fn.setGlobalUserSessionManager(s),s},oh=({resource:e,userManager:t,spanExporters:n,spanProcessors:r=[],propagator:i=null,contextManager:a=null,attributeScrubbers:o,registerGlobally:s,mxlSpanProcessor:c,pageManager:l,signalBuffer:u})=>{let d=[...r,new bd,new wd,new Hd({userManager:t}),new Id({pageManager:l}),new zd({attributeScrubbers:o}),...u?[new Rd({buffer:u})]:[]];n==null||n.forEach(e=>{d.push(new gc({exporter:e}))}),c&&d.push(c);let f=new wc({resource:e,spanLimits:{attributeCountLimit:wu.maxAllowed.session_property*2,eventCountLimit:wu.maxAllowed.breadcrumb*2},spanProcessors:d}),p=new zu({tracerProvider:s?void 0:f});if(s){Un.setGlobalTraceManager(p),M.setGlobalTracerProvider(f),i&&qt.setGlobalPropagator(i);let e=a||new Qs;e.enable(),A.setGlobalContextManager(e)}return{mxlTraceManager:p,tracerProvider:f}},sh=({resource:e,userManager:t,logExporters:n,logProcessors:r,userSessionManager:i,limitManager:a,attributeScrubbers:o,registerGlobally:s,mxlLogProcessor:c,sdkLocalStorage:l,pageManager:u,perf:d,visibilityDoc:f,signalBuffer:p,exception:m})=>{let h=[...r,new Vd({userSessionManager:i}),new yd,new Sd,new Bd({userManager:t}),new xd({attributeScrubbers:o}),new Fd({pageManager:u}),...p?[new Ld({buffer:p})]:[]];n==null||n.forEach(e=>{h.push(new Zs({exporter:e}))}),c&&h.push(c);let g=new Ws({processors:h,resource:e}),_=new Nu({exception:m,limitManager:a,loggerProvider:s?void 0:g,perf:d,storage:l,userSessionManager:i,visibilityDoc:f});return s&&(Fa.setGlobalLoggerProvider(g),pn.setGlobalLogManager(_)),{loggerProvider:g,mxlLogManager:_}},ch=({useDocumentTitleAsPageLabel:e,registerGlobally:t,userSessionManager:n,perf:r})=>{let i=new Pu({useDocumentTitleAsPageLabel:e,userSessionManager:n,perf:r});return t&&On.setGlobalPageManager(i),i};return N(),Object.defineProperty(e,`DiagLogLevel`,{enumerable:!0,get:function(){return y}}),e.ReplayInstrumentation=Zo,e.analytics=xn,e.attributes=dr,e.getNavigationInstrumentation=Va,e.initSDK=rh,e.loadRrwebModule=Eo,e.log=pn,e.page=On,e.resetRrwebModuleCacheForTests=Do,e.session=Fn,e.setRrwebModuleLoaderForTests=Oo,e.setRrwebScriptUrl=So,e.trace=Un,e.user=Xn,e})({});
3
3
  //# sourceMappingURL=mxl-web-sdk.js.map