@safaricom-mxl/web-sdk 0.1.4 → 0.1.5

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 (37) hide show
  1. package/dist/instrumentations/replay/events/capture/network.cjs +31 -22
  2. package/dist/instrumentations/replay/events/capture/network.cjs.map +1 -1
  3. package/dist/instrumentations/replay/events/capture/network.js +31 -22
  4. package/dist/instrumentations/replay/events/capture/network.js.map +1 -1
  5. package/dist/mxl-web-sdk.js +7 -7
  6. package/dist/mxl-web-sdk.js.map +1 -1
  7. package/dist/processors/UserSessionSpanProcessor/UserSessionSpanProcessor.cjs +30 -0
  8. package/dist/processors/UserSessionSpanProcessor/UserSessionSpanProcessor.cjs.map +1 -0
  9. package/dist/processors/UserSessionSpanProcessor/UserSessionSpanProcessor.d.cts +22 -0
  10. package/dist/processors/UserSessionSpanProcessor/UserSessionSpanProcessor.d.cts.map +1 -0
  11. package/dist/processors/UserSessionSpanProcessor/UserSessionSpanProcessor.d.ts +22 -0
  12. package/dist/processors/UserSessionSpanProcessor/UserSessionSpanProcessor.d.ts.map +1 -0
  13. package/dist/processors/UserSessionSpanProcessor/UserSessionSpanProcessor.js +29 -0
  14. package/dist/processors/UserSessionSpanProcessor/UserSessionSpanProcessor.js.map +1 -0
  15. package/dist/processors/UserSessionSpanProcessor/types.cjs +0 -0
  16. package/dist/processors/UserSessionSpanProcessor/types.d.cts +9 -0
  17. package/dist/processors/UserSessionSpanProcessor/types.d.cts.map +1 -0
  18. package/dist/processors/UserSessionSpanProcessor/types.d.ts +9 -0
  19. package/dist/processors/UserSessionSpanProcessor/types.d.ts.map +1 -0
  20. package/dist/processors/UserSessionSpanProcessor/types.js +0 -0
  21. package/dist/resources/sdkConstants.cjs +1 -1
  22. package/dist/resources/sdkConstants.cjs.map +1 -1
  23. package/dist/resources/sdkConstants.d.cts +1 -1
  24. package/dist/resources/sdkConstants.d.ts +1 -1
  25. package/dist/resources/sdkConstants.js +1 -1
  26. package/dist/resources/sdkConstants.js.map +1 -1
  27. package/dist/sdk/initSDK.cjs +5 -2
  28. package/dist/sdk/initSDK.cjs.map +1 -1
  29. package/dist/sdk/initSDK.d.cts.map +1 -1
  30. package/dist/sdk/initSDK.d.ts.map +1 -1
  31. package/dist/sdk/initSDK.js +5 -2
  32. package/dist/sdk/initSDK.js.map +1 -1
  33. package/dist/sdk/types.d.cts +1 -0
  34. package/dist/sdk/types.d.cts.map +1 -1
  35. package/dist/sdk/types.d.ts +1 -0
  36. package/dist/sdk/types.d.ts.map +1 -1
  37. package/package.json +1 -1
@@ -1,13 +1,13 @@
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=function(e){return 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`,e}({})})),o,s=n((()=>{o=`1.10.0`}));function c(e){let t=new Set([e]),n=new Set,r=e.match(l);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(l);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var l,u,d=n((()=>{s(),l=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,u=c(o)}));function f(){return Object.defineProperty({},`version`,{value:o,enumerable:!0,writable:!1,configurable:!1})}function p(e,t,n,r=!1){var i;let a=v[_]=(i=v[_])==null?f():i;if(!r&&a[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(a.version!==`1.10.0`){let t=Error(`@opentelemetry/api: Registration of version v${a.version} for ${e} does not match previously registered API v${o}`);return n.error(t.stack||t.message),!1}return a[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${o}.`),!0}function m(e){let t=v[_];if(t!=null){if(t!==y){if(!t.version||!u(t.version))return;y=t}return t[e]}}function h(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${o}.`);let n=v[_];n&&delete n[e]}var g,_,v,y,b=n((()=>{s(),d(),g=o.split(`.`)[0],_=Symbol.for(`opentelemetry.js.api.${g}`),v=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function x(e,t,n){let r=m(`diag`);if(r)return r[e](t,...n)}var S,ee=n((()=>{b(),S=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return x(`debug`,this._namespace,e)}error(...e){return x(`error`,this._namespace,e)}info(...e){return x(`info`,this._namespace,e)}warn(...e){return x(`warn`,this._namespace,e)}verbose(...e){return x(`verbose`,this._namespace,e)}}}));function te(e,t){e<0?e=0:e>9999&&(e=9999),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,30),warn:n(`warn`,50),info:n(`info`,60),debug:n(`debug`,70),verbose:n(`verbose`,80)}}var ne=n((()=>{})),re,C,w=n((()=>{b(),ee(),ne(),re=`diag`,C=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=m(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:60})=>{var r;if(e===t){var i;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((i=e.stack)==null?e.message:i),!1}typeof n==`number`&&(n={logLevel:n});let a=m(`diag`),o=te((r=n.logLevel)==null?60:r,e);if(a&&!n.suppressOverrideMessage){var s;let e=(s=Error().stack)==null?`<failed to generate stacktrace>`:s;a.warn(`Current logger will be overwritten from ${e}`),o.warn(`Current logger will overwrite one already registered from ${e}`)}return p(`diag`,o,t,!0)},t.disable=()=>{h(re,t)},t.createComponentLogger=e=>new S(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),ie,ae=n((()=>{ie=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 oe(e={}){return new ie(new Map(Object.entries(e)))}var se=n((()=>{w(),ae(),C.instance()}));function ce(e){return Symbol.for(e)}var T,le=n((()=>{T=new 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}}}})),ue,E,de,fe=n((()=>{if(ue=[{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]);de=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<ue.length;t++)this[ue[t].n]=e(ue[t].c)}}}));function D(){return Se}var pe,me,he,ge,_e,O,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae=n((()=>{pe=class{constructor(){}createGauge(e,t){return we}createHistogram(e,t){return Te}createCounter(e,t){return Ce}createUpDownCounter(e,t){return Ee}createObservableGauge(e,t){return Oe}createObservableCounter(e,t){return De}createObservableUpDownCounter(e,t){return ke}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},me=class{},he=class extends me{add(e,t){}},ge=class extends me{add(e,t){}},_e=class extends me{record(e,t){}},O=class extends me{record(e,t){}},ve=class{addCallback(e){}removeCallback(e){}},ye=class extends ve{},be=class extends ve{},xe=class extends ve{},Se=new pe,Ce=new he,we=new _e,Te=new O,Ee=new ge,De=new ye,Oe=new be,ke=new xe})),je,Me=n((()=>{je=function(e){return e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`,e}({})}));function Ne(){return Fe}var Pe,Fe,Ie=n((()=>{Pe=class{emit(e){}enabled(){return!1}},Fe=new Pe})),k,Le=n((()=>{k=function(e){return 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`,e}({})})),Re,ze,Be=n((()=>{Re={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},ze={set(e,t,n){e!=null&&(e[t]=n)}}})),Ve,He=n((()=>{Ve=function(e){return e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`,e}({})})),Ue,We,Ge,Ke=n((()=>{Ue=`0000000000000000`,We=`00000000000000000000000000000000`,Ge={traceId:We,spanId:Ue,traceFlags:0}})),qe,Je=n((()=>{Ke(),qe=class{constructor(e=Ge){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 Ye(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(et[e.charCodeAt(t)]|0)+(et[e.charCodeAt(t+1)]|0)+(et[e.charCodeAt(t+2)]|0)+(et[e.charCodeAt(t+3)]|0);return n===t}function Xe(e){return Ye(e,32)&&e!==`00000000000000000000000000000000`}function Ze(e){return Ye(e,16)&&e!==`0000000000000000`}function Qe(e){return Xe(e.traceId)&&Ze(e.spanId)}function $e(e){return new qe(e)}var et,tt=n((()=>{Je(),et=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])})),nt,rt=n((()=>{le(),nt=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}attach(e){return{dispose(){}}}}})),it,at,ot,st,ct=n((()=>{b(),w(),rt(),it=`context`,at=new nt,ot=Object.freeze({dispose:()=>{}}),st=class e{constructor(){this._attachUnsupportedWarned=!1}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return p(it,e,C.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)}attach(e){let t=this._getContextManager();return t.attach?t.attach(e):(this._attachUnsupportedWarned||(this._attachUnsupportedWarned=!0,C.instance().warn(`The current ContextManager does not implement attach(). The context will not be attached. Use a ContextManager that supports attach() (e.g. AsyncLocalStorageContextManager) or use with()/bind() instead.`)),ot)}_getContextManager(){return m(it)||at}disable(){this._getContextManager().disable(),h(it,C.instance())}}}));function lt(e){return e.getValue(ht)||void 0}function ut(){return lt(st.getInstance().active())}function dt(e,t){return e.setValue(ht,t)}function ft(e){return e.deleteValue(ht)}function pt(e,t){return dt(e,new qe(t))}function mt(e){var t;return(t=lt(e))==null?void 0:t.spanContext()}var ht,gt=n((()=>{le(),ct(),Je(),ht=ce(`OpenTelemetry Context Key SPAN`)}));function _t(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 vt,yt,bt=n((()=>{ct(),Je(),gt(),tt(),vt=st.getInstance(),yt=class{startSpan(e,t,n=vt.active()){if(t!=null&&t.root)return new qe;let r=n&&mt(n);return _t(r)&&Qe(r)?new qe(r):new qe}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?vt.active():i,l=this.startSpan(e,a,c),u=dt(c,l);return vt.with(u,s,void 0,l)}}})),xt,St,Ct=n((()=>{bt(),xt=new yt,St=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):xt}}})),wt,Tt=n((()=>{wt=function(e){return 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`,e}({})})),Et,Dt=n((()=>{Et=function(e){return e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`,e}({})})),Ot,kt=n((()=>{bt(),Ot=class{getTracer(e,t,n){return new yt}}})),At,jt,Mt=n((()=>{Ct(),kt(),At=new Ot,jt=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new St(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?At:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),Nt,Pt=n((()=>{Nt=function(e){return e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`,e}({})})),A,Ft=n((()=>{ct(),A=st.getInstance()})),j,It=n((()=>{w(),j=C.instance()})),Lt,Rt,zt=n((()=>{Ie(),Lt=class{getLogger(e,t,n){return new Pe}},Rt=new Lt})),Bt,Vt=n((()=>{Ie(),Bt=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):Fe}}})),Ht,Ut=n((()=>{zt(),Vt(),Ht=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new Bt(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?Rt:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),Wt,Gt,Kt=n((()=>{b(),w(),Ut(),Wt=`logs`,Gt=class e{constructor(){this._proxyLoggerProvider=new Ht}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){let t=p(Wt,e,C.instance());return t&&this._proxyLoggerProvider._setDelegate(e),t}getLoggerProvider(){return m(Wt)||this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){h(Wt,C.instance()),this._proxyLoggerProvider=new Ht}}})),qt,Jt=n((()=>{Kt(),qt=Gt.getInstance()})),Yt,Xt,Zt=n((()=>{Ae(),Yt=class{getMeter(e,t,n){return Se}},Xt=new Yt})),Qt,$t,en=n((()=>{b(),w(),Zt(),Qt=`metrics`,$t=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return p(Qt,e,C.instance())}getMeterProvider(){return m(Qt)||Xt}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){h(Qt,C.instance())}}})),tn,nn=n((()=>{en(),tn=$t.getInstance()})),rn,an=n((()=>{rn=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function on(e){return e.getValue(un)||void 0}function sn(){return on(st.getInstance().active())}function cn(e,t){return e.setValue(un,t)}function ln(e){return e.deleteValue(un)}var un,dn=n((()=>{le(),ct(),un=ce(`OpenTelemetry Baggage Key`)})),fn,pn,mn,hn=n((()=>{b(),w(),se(),Be(),an(),dn(),fn=`propagation`,pn=new rn,mn=class e{constructor(){this.createBaggage=oe,this.getBaggage=on,this.getActiveBaggage=sn,this.setBaggage=cn,this.deleteBaggage=ln}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return p(fn,e,C.instance())}inject(e,t,n=ze){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Re){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){h(fn,C.instance())}_getGlobalPropagator(){return m(fn)||pn}}})),gn,_n=n((()=>{hn(),gn=mn.getInstance()})),vn,yn,bn=n((()=>{b(),w(),gt(),tt(),Mt(),vn=`trace`,yn=class e{constructor(){this._proxyTracerProvider=new jt,this.wrapSpanContext=$e,this.isSpanContextValid=Qe,this.deleteSpan=ft,this.getSpan=lt,this.getActiveSpan=ut,this.getSpanContext=mt,this.setSpan=dt,this.setSpanContext=pt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=p(vn,this._proxyTracerProvider,C.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return m(vn)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){h(vn,C.instance()),this._proxyTracerProvider=new jt}}})),M,xn=n((()=>{bn(),M=yn.getInstance()})),N=n((()=>{a(),le(),fe(),Ae(),Me(),Ie(),Le(),Be(),He(),Ke(),tt(),Tt(),Dt(),Pt(),Ft(),It(),Jt(),nn(),_n(),xn()}));N();function Sn(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 Cn=class{logException(e,t){}captureException(e,t){}addExceptionFilter(e){}message(e,t,n){}};function wn(e){"@babel/helpers - typeof";return wn=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},wn(e)}var Tn=n((()=>{}));function En(e,t){if(wn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(wn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Dn=n((()=>{Tn()}));function On(e){var t=En(e,`string`);return wn(t)==`symbol`?t:t+``}var kn=n((()=>{Tn(),Dn()}));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((()=>{kn()}));F();let An=new Cn;var jn=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?An: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 Mn=new Cn,Nn=new Set([`setDelegate`,`getDelegate`]);var Pn=class e{static getInstance(){if(!e._instance){let t=new jn,n=Sn(t,Mn,j.createComponentLogger({namespace:`LogAPI`}),Nn);e._instance=Object.assign(n,{getLogManager(){return t},setGlobalLogManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Pn,`_instance`,void 0);let Fn=Pn.getInstance();var In=class{track(){}identify(){}increment(){}decrement(){}clear(){}screenView(){}};let Ln=(e,t,n,r=100)=>{e.length>=r&&(e.shift(),n()),e.push(t)};N(),F();let Rn=new In;var zn=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?Rn: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&&Ln(t,e,()=>{this._diag.warn(`dropping oldest queued analytics call; pre-init queue is full`)})}};N(),F();let Bn=new In,Vn=new Set([`setDelegate`,`getDelegate`]);var Hn=class e{static getInstance(){if(!e._instance){let t=new zn,n=Sn(t,Bn,j.createComponentLogger({namespace:`AnalyticsAPI`}),Vn);e._instance=Object.assign(n,{getAnalyticsManager(){return t},setGlobalAnalyticsManager(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{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}addRouteChangedListener(e){return()=>{}}};F();let Gn=new Wn;var Kn=class{constructor(){P(this,`_delegate`,void 0),P(this,`_routeChangedListeners`,[]),P(this,`_removeDelegateListener`,null)}getDelegate(){var e;return(e=this._delegate)==null?Gn:e}setDelegate(e){var t;(t=this._removeDelegateListener)==null||t.call(this),this._removeDelegateListener=null,this._delegate=e,this._removeDelegateListener=e.addRouteChangedListener(e=>{for(let t of this._routeChangedListeners)t(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._routeChangedListeners.push(e),()=>{let t=this._routeChangedListeners.indexOf(e);t!==-1&&this._routeChangedListeners.splice(t,1)}}};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=Sn(t,qn,j.createComponentLogger({namespace:`PageAPI`}),Jn);e._instance=Object.assign(n,{getPageManager(){return t},setGlobalPageManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Yn,`_instance`,void 0);let Xn=Yn.getInstance(),Zn=new Uint8Array(16),Qn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),$n=()=>{crypto.getRandomValues(Zn);let e=``;for(let t=0;t<16;t++)e+=Qn[Zn[t]];return e},er=`mxl_user_session_state`,tr=`mxl_permanent_properties`,nr=`mxl_last_end_user_session_ts`,rr=`mxl_tab`,ir=`mxl_tab_activity`,ar=1800,or=new Set([`user_session_ended`,`web_foreground_inactivity`]),sr=[`keydown`,`mousedown`,`mousemove`,`scroll`];function cr(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 I(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?cr(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var L=n((()=>{F()}));L();let lr={clicks:0,errors:0,pageViews:0},ur=(e,t)=>t<e.userSessionStartTs||t>=e.userSessionMaxEndTs||e.inactivityDeadlineTs!==null&&t>=e.inactivityDeadlineTs,dr=({now:e,previousUserSessionId:t,maxUserSessionDurationSeconds:n,inactivityTimeoutSeconds:r,foregroundInactivityTimeoutSeconds:i,userSessionNumber:a})=>({foregroundInactivityTimeoutSeconds:i,inactivityDeadlineTs:null,inactivityTimeoutSeconds:r,maxUserSessionDurationSeconds:n,previousUserSessionId:t,replayCounts:lr,replayMetaVersion:0,replaySampled:null,schemaVersion:4,userSessionId:$n(),userSessionMaxEndTs:e+n*1e3,userSessionNumber:a,userSessionPartIndex:0,userSessionProperties:{},userSessionStartTs:e}),fr=e=>typeof e==`object`&&e?e.schemaVersion:void 0,pr=e=>I(I({},e),{},{replayCounts:lr,schemaVersion:4}),mr=e=>pr(I(I({},e),{},{foregroundInactivityTimeoutSeconds:e.inactivityTimeoutSeconds})),hr=e=>mr(I(I({},e),{},{replayMetaVersion:2,replaySampled:null})),gr=e=>{switch(fr(e)){case 4:return e;case 3:return pr(e);case 2:return mr(e);case 1:return hr(e);default:return null}},_r=(e,t)=>{let n=e.getItem(er);if(!n)return null;try{let e=gr(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(er),null}},vr=(e,t)=>{let n=e.getItem(tr);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(tr),{}}},yr=(e,t)=>Object.keys(t).length===0?e.removeItem(tr):e.setItem(tr,JSON.stringify(t));var br=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){}recordSDKStartupTimings(){}claimReplaySample(e){return!1}nextReplayMetaVersion(){return 0}incrReplayCount(e){}getReplayCounts(){return lr}_clearMaxDurationTimer(){}_shutdown(){}};F();let xr=new br;var Sr=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?xr: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)}recordSDKStartupTimings(e){this.getDelegate().recordSDKStartupTimings(e)}claimReplaySample(e){return this.getDelegate().claimReplaySample(e)}nextReplayMetaVersion(){return this.getDelegate().nextReplayMetaVersion()}incrReplayCount(e){this.getDelegate().incrReplayCount(e)}getReplayCounts(){return this.getDelegate().getReplayCounts()}_clearMaxDurationTimer(){this.getDelegate()._clearMaxDurationTimer()}_shutdown(){this.getDelegate()._shutdown()}};N(),F();let Cr=new br,wr=new Set([`setDelegate`,`getDelegate`]);var Tr=class e{static getInstance(){if(!e._instance){let t=new Sr,n=Sn(t,Cr,j.createComponentLogger({namespace:`SessionAPI`}),wr);e._instance=Object.assign(n,{getUserSessionManager(){return t},setGlobalUserSessionManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Tr,`_instance`,void 0);let Er=Tr.getInstance();N(),F();var Dr=class{constructor(e=Ge){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 Or=class{startSpan(e,t){return new Dr}setSpan(e,t){return T}getSpan(e){}};F();let kr=new Or;var Ar=class{constructor(){P(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?kr: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 jr=new Or,Mr=new Set([`setDelegate`,`getDelegate`]);var Nr=class e{static getInstance(){if(!e._instance){let t=new Ar,n=Sn(t,jr,j.createComponentLogger({namespace:`TraceAPI`}),Mr);e._instance=Object.assign(n,{getTraceManager(){return t},setGlobalTraceManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Nr,`_instance`,void 0);let Pr=Nr.getInstance();var Fr=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};N(),F();let Ir=new Fr;var Lr=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?Ir: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){Ln(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 Rr=new Fr,zr=new Set([`setDelegate`,`getDelegate`]);var Br=class e{static getInstance(){if(!e._instance){let t=new Lr,n=Sn(t,Rr,j.createComponentLogger({namespace:`UserAPI`}),zr);e._instance=Object.assign(n,{getUserManager(){return t},setGlobalUserManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};P(Br,`_instance`,void 0);let Vr=Br.getInstance(),R=`mxl.type`,Hr=`mxl.state`,Ur=`react.component_stack`,Wr=`mxl.instrumentation`,Gr=`mxl.js_file_bundle_ids`,Kr=`mxl.perf_clock_lag_ms`,qr=`browser.url.full`,Jr=`browser.navigation_timing.not_restored_reasons`,Yr=`app.surface.name`,Xr=`app.surface.id`,Zr=`app.surface.label`,Qr=`mxl.session_part_id`,$r=`mxl.user_session_id`,ei=`mxl.user_session_previous_id`,ti=`mxl.user_session_number`,ni=`mxl.application.id`,ri=`mxl.profile.id`,z=`mxl.session_prev.`,ii={pageLabel:Zr};F();let ai=new WeakMap,oi=e=>{let t=ai.get(e);return t||(t={lastCheckedNow:e.now(),segments:[{from:0,origin:e.timeOrigin}]},ai.set(e,t)),t};var si=class{constructor(e=window.performance,t=()=>Date.now()){P(this,`_clock`,void 0),P(this,`_wallNow`,void 0),P(this,`_sharedClockState`,void 0),P(this,`navigationEntry`,null),P(this,`checkDrift`,()=>{let e=this._clock.now(),t=this._wallNow(),{segments:n}=this._sharedClockState,r=n[n.length-1];Math.abs(r.origin+e-t)>1e3&&(n.push({from:this._sharedClockState.lastCheckedNow,origin:t-e}),n.length>100&&n.splice(1,1)),this._sharedClockState.lastCheckedNow=e}),P(this,`offsetToAbsoluteTime`,(e,t=e)=>(this.checkDrift(),this._originAt(t)+e)),P(this,`getNow`,()=>{this.checkDrift();let{segments:e}=this._sharedClockState;return e[e.length-1].origin+this._clock.now()}),P(this,`getClockLag`,(e=this._sharedClockState.segments[0].origin)=>Math.round(this._wallNow()-(e+this._clock.now()))),P(this,`setZeroTimeOffset`,e=>{this._sharedClockState.zeroTimeOffset=e}),P(this,`getZeroTime`,e=>{let t=this._getZeroTimeOffset();return this.offsetToAbsoluteTime(t,e==null?t: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,`getOffsetFromOrigin`,()=>this._clock.now()),P(this,`getOffsetFromZeroTime`,(e=this._clock.now())=>Math.max(0,e-this._getZeroTimeOffset())),this._clock=e,this._wallNow=t,this._sharedClockState=oi(e)}_originAt(e){let{origin:t}=this._sharedClockState.segments[0];for(let n of this._sharedClockState.segments){if(n.from>=e)break;t=n.origin}return t}_getZeroTimeOffset(){var e;return Math.max(this._getNavigationActivationStart(),(e=this._sharedClockState.zeroTimeOffset)==null?0:e)}_getNavigationActivationStart(){var e;let t=this.getNavigationEntry();return(e=t==null?void 0:t.activationStart)==null?0:e}};N(),F(),L();var ci=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=tn.getMeter(e,t),this._logger=qt.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=I({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 B=class extends ci{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,`_removeSessionPartListeners`,{}),P(this,`_sessionPartListeners`,{}),r&&(this._diag=r),this._perf=i==null?new si:i,this._userSessionManager=Er.getUserSessionManager(),this._logManager=Fn.getLogManager(),this._limitManager=a}get _isEnabled(){return this._config.enabled===!0}set _isEnabled(e){this._config.enabled=e}setConfig(e){let t=this._isEnabled;super.setConfig(e),this._isEnabled=t}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(e=>{var t,n;return(t=(n=this._sessionPartListeners).start)==null?void 0:t.call(n,e)})),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 li=/\([^()]+\)/g;var ui=class extends B{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0,pageManager:n}){super({config:{},diag:e,instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`}),P(this,`_shouldCleanupPathOptionsFromRouteName`,!0),P(this,`_pageManager`,void 0),P(this,`_currentRouteSpan`,null),P(this,`_currentRouteSpanUrl`,null),P(this,`_currentRouteSpanPath`,void 0),P(this,`_instrumentationType`,`manual`),P(this,`_removeRouteChangedListener`,null),P(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),P(this,`setCurrentRoute`,e=>{this._pageManager.setCurrentRoute(e)}),P(this,`_onRouteChanged`,e=>{if(!this._isEnabled)return;if(this._currentRouteSpan&&this._currentRouteSpanUrl===e.url){e.path&&this._currentRouteSpanPath!==e.path&&this._renameCurrentRouteSpan(e);return}let t=this._currentRouteSpanUrl;this._endRouteSpan(),this._startRouteSpan(e),t!==null&&t!==e.url&&Un.screenView()}),P(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`);let t=this._resolveRouteName(e);return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[R]:`ux.surface`,[Yr]:e.path?t:void 0,[Xr]:this._pageManager.getCurrentPageId()||void 0}}),this._currentRouteSpanUrl=e.url,this._currentRouteSpanPath=e.path,this._currentRouteSpan.setAttribute(Wr,this._instrumentationType),this._currentRouteSpan}),P(this,`_endRouteSpan`,()=>{if(this._currentRouteSpan){var e;this._diag.debug(`Ending route span for url: ${(e=this._currentRouteSpanUrl)==null?`unknown`:e}`),this._currentRouteSpan.end(),this._currentRouteSpan=null,this._currentRouteSpanUrl=null,this._currentRouteSpanPath=void 0}}),P(this,`_renameCurrentRouteSpan`,e=>{var t,n;let r=this._resolveRouteName(e);this._diag.debug(`Resolved route span path to: ${r}`),(t=this._currentRouteSpan)==null||t.updateName(r),(n=this._currentRouteSpan)==null||n.setAttribute(`app.surface.name`,r),this._currentRouteSpanPath=e.path}),P(this,`_resolveRouteName`,e=>{var t;let n=(t=e.path)==null?e.url:t;return this._shouldCleanupPathOptionsFromRouteName?n.replace(li,``):n}),P(this,`_onSessionPartEnded`,()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan())}),P(this,`_onSessionPartStarted`,({reason:e})=>{if(e===`web_soft_navigation`)return;let t=this._pageManager.getCurrentRoute();t&&this._onRouteChanged(t)}),this._shouldCleanupPathOptionsFromRouteName=t,this._pageManager=n==null?Xn.getPageManager():n}onEnable(){this._removeRouteChangedListener=this._pageManager.addRouteChangedListener(this._onRouteChanged),this.setSessionPartListeners({end:this._onSessionPartEnded,start:this._onSessionPartStarted});let e=this._pageManager.getCurrentRoute();e&&this._onRouteChanged(e),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}onDisable(){var e;(e=this._removeRouteChangedListener)==null||e.call(this),this._removeRouteChangedListener=null,this._endRouteSpan(),this._diag.debug(`NavigationInstrumentation disabled, stopped listening for navigation events.`)}};let di,fi=(e={})=>(di||(di=new ui(e)),di);function pi(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 mi(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 hi(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 gi(e){try{return JSON.stringify(e).length}catch(e){return 64}}function _i(e,t){try{e(t)}catch(e){}}let vi=[`log`,`info`,`warn`,`error`,`debug`],yi=2e3;function bi(e){let t={};for(let n of vi){let r=console[n];t[n]=r,console[n]=(...t)=>{_i(e,{level:n,message:xi(t),type:`console`}),r.apply(console,t)}}return()=>{for(let e of vi){let n=t[e];n&&(console[e]=n)}}}function xi(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>yi?`${t.slice(0,yi)}…`:t}N();function Si(){var e;let t=(e=M.getActiveSpan())==null?void 0:e.spanContext().traceId;return t&&t!==`00000000000000000000000000000000`?t:void 0}let Ci=4e3;function wi(e){let t=t=>{var n,r;_i(e,{errorStack:Ti((n=t.error)==null?void 0:n.stack),level:`error`,message:t.message||String((r=t.error)==null?`Error`:r),traceId:Si(),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;_i(e,{errorStack:Ti(typeof r==`object`?r==null?void 0:r.stack:void 0),level:`error`,message:i,traceId:Si(),type:`error`})};return window.addEventListener(`error`,t),window.addEventListener(`unhandledrejection`,n),()=>{window.removeEventListener(`error`,t),window.removeEventListener(`unhandledrejection`,n)}}function Ti(e){if(e)return e.length>Ci?`${e.slice(0,Ci)}…`:e}function Ei(e,t){let n=n=>{let r=n.target;r instanceof Element&&_i(e,{targetSelector:Di(r),targetText:t?void 0:Oi(r),type:`click`})},r=t=>{let n=t.target;n instanceof Element&&_i(e,{targetSelector:Di(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 Di(e){return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:``}${typeof e.className==`string`&&e.className.trim()?`.${e.className.trim().split(/\s+/)[0]}`:``}`}function Oi(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 ki(e){let t=``,n=()=>{let n=location.href;n!==t&&(t=n,_i(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 Ai(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 V(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Ai(a,r,i,o,s,`next`,e)}function s(e){Ai(a,r,i,o,s,`throw`,e)}o(void 0)})}}var H=n((()=>{}));H(),L();function ji(e,t){let n=typeof window<`u`?window.fetch.bind(window):void 0;n&&(window.fetch=function(){var e=V(function*(e,t){let i=Mi(e),a=Ni(e,t),o=Si(),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)||_i(e,I({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=Si();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 Mi(e){return typeof e==`string`?e:e instanceof URL?e.href:e.url}function Ni(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()}H();function Pi({config:e,sessionId:t,transport:n,onActivity:r,onPageView:i,flushIntervalMs:a=5e3,flushBytes:o=65536}){let s=[],c=0,l=0,u=!1,d=e=>{e.type===`navigation`&&e.url&&(i==null||i(e.url)),!u&&(s.push({ev:e,seq:l++}),c+=gi(e),c>=o&&f())},f=function(){var i=V(function*(i=!1){if(s.length===0||u)return;r==null||r();let a=s;s=[],c=0;let o=a.map(({ev:n,seq:r})=>Fi(t,n,r,e.redactUrl));yield n.postSessionEvents(o,i)});return function(){return i.apply(this,arguments)}}(),p=[ki(d),Ei(d,e.maskAllText),bi(d),ji(d,e=>n.shouldIgnoreUrl(e)),wi(d)],m=hi(a,()=>{f()});return{flush:f,pause:()=>{u=!0},resume:()=>{u=!1},stop:()=>{m();for(let e of p)e()}}}function Fi(e,t,n,r){var i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;let x=(i=t.net)==null?void 0:i.url,S=(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:x?r(x):``,seq:n,session_id:e,target_selector:(g=t.targetSelector)==null?``:g,target_text:(_=t.targetText)==null?``:_,timestamp:pi(new Date((v=t.timestamp)==null?Date.now():v)),trace_id:(y=(b=t.traceId)==null?Si():b)==null?``:y,type:t.type,url:S?r(S):``}}H();function Ii(e){return Li.apply(this,arguments)}function Li(){return Li=V(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}),Li.apply(this,arguments)}H(),L();let Ri=4*1024*1024,zi=0;function Bi(e,t){let n=Date.now();n-zi<3e4||(zi=n,console.warn(`[mxl] session replay ${e}`,...t?[t]:[]))}function Vi({config:e,sessionId:t,transport:n,chunkSeqStore:r,rrwebModule:i,onActivity:a,onClick:o,flushIntervalMs:s=5e3,flushBytes:c=102400}){let l=[],u=0,d=!1,f=0,p=0,m=!1,h=!1,g=!1,_=Promise.resolve(),v=()=>{l=[],u=0,d=!1,f=0,p=0},y=()=>void 0,b=function(){var e=V(function*(e,r,i){let a;try{a=yield Ii(new TextEncoder().encode(e))}catch(e){Bi(`chunk compression failed (dropping chunk)`,e);return}(yield n.postSessionBlob(r,a,i))===`exhausted`&&!h&&(h=!0,Bi(`replay ${t} reached its maximum recorded size; recording stopped for this session`),y())});return function(t,n,r){return e.apply(this,arguments)}}(),x=(e=!1)=>{if(h||l.length===0)return _;a==null||a();let n=`[${l.join(`,`)}]`,i={chunkSeq:r.nextChunkSeq(t),durationMs:Math.max(0,p-f),eventCount:l.length,isCheckpoint:d,sessionId:t};v();let o=_.then(()=>b(n,i,e));return _=o.catch(()=>void 0),o},{record:S}=i,ee=S(I(I({checkoutEveryNms:3e5,emit:(t,n)=>{var r,i;if(g||h)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 s=n===!0||a.type===2;if(a.type===3&&((i=a.data)==null?void 0:i.source)===2&&a.data.type===2&&(o==null||o()),m&&!s)return;let _;try{_=JSON.stringify(a)}catch(e){return}if(u+_.length>Ri){Bi(`buffer exceeded ${Ri} bytes (dropping ${u+_.length} bytes until the next full snapshot)`),v(),m=!0;return}m=!1,s&&(d=!0),l.length===0&&(f=a.timestamp),p=a.timestamp,l.push(_),u+=_.length,u>=c&&x()},maskAllInputs:e.maskAllInputs},e.maskAllText?{maskTextSelector:`*`}:{}),e.rrwebOptions)),te=hi(s,()=>{x()}),ne=!1;return y=()=>{ne||(ne=!0,te(),v(),ee==null||ee())},{flush:x,pause:()=>{g=!0},resume:()=>{g=!1},stop:y}}H();let Hi=`https://unpkg.com/rrweb@2.2.2/dist/rrweb.umd.cjs`,Ui,Wi,Gi=Hi;function Ki(e){Gi=e,Ui=void 0}function qi(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 Ji(){return Yi.apply(this,arguments)}function Yi(){return Yi=V(function*(){if(typeof window>`u`)throw Error(`no browser`);if(window.rrweb)return window.rrweb;if(yield qi(Gi),!window.rrweb)throw Error(`no rrweb`);return window.rrweb}),Yi.apply(this,arguments)}function Xi(){return Wi?Wi():(Ui===void 0&&(Ui=Ji()),Ui)}function Zi(){Ui=void 0,Wi=void 0,Gi=Hi}function Qi(e){Wi=e,Ui=void 0}let $i=new Set;function ea(e){!e||e===`00000000000000000000000000000000`||$i.add(e)}function ta(){return Array.from($i)}function na(){$i.clear()}let ra=`__MXL_REPLAY_SESSION__`;function ia(e){globalThis[ra]={recordTraceId:ea,sessionId:e}}function aa(){delete globalThis[ra]}function oa(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}}}var sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a=n((()=>{sa=`http.method`,ca=`http.url`,la=`http.status_code`,ua=`http.request_content_length`,da=`http.response_content_length`,fa=sa,pa=ca,ma=la,ha=ua,ga=da})),va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La=n((()=>{va=`error.type`,ya=`exception.message`,ba=`exception.stacktrace`,xa=`exception.type`,Sa=`http.request.method`,Ca=`http.request.method_original`,wa=`http.response.status_code`,Ta=`server.address`,Ea=`server.port`,Da=`service.name`,Oa=`service.version`,ka=`telemetry.sdk.language`,Aa=`webjs`,ja=`telemetry.sdk.name`,Ma=`telemetry.sdk.version`,Na=`url.full`,Pa=`url.path`,Fa=`url.query`,Ia=`user_agent.original`})),U=n((()=>{_a(),La()}));U();let Ra=/\/\/(.+):(.+)@(.+)\//,za=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],Ba=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(Ra,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},Va=e=>{let t=[...za,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:Na,scrub:e=>Ba({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:pa,scrub:e=>Ba({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:Pa,scrub:e=>Ba({queryParamRegex:n,scrubPath:!0,scrubQuery:!1,value:e})},{key:Fa,scrub:e=>Ba({queryParamRegex:n,scrubPath:!1,scrubQuery:!0,value:e})}]},Ha=e=>{let t=e.filter(({key:e})=>e===Na);return e=>t.reduce((e,{scrub:t})=>t(e),e)};function Ua(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 Wa(e,t){if(e==null)return{};var n,r,i=Ua(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 Ga=[`debug`,`sampleRate`,`maskAllInputs`,`maskAllText`,`flushIntervalMs`,`omitRedundantInstrumentations`];function Ka(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=Wa(r,Ga);return{appId:e.appId,appVersion:e.appVersion,debug:i,environment:void 0,flushIntervalMs:c,maskAllInputs:o,maskAllText:s,redactUrl:(n=e.redactUrl)==null?Ha(Va()):n,replaySampleRate:a==null?1:a,rrwebOptions:u,serviceName:e.serviceName,userID:e.userID}}L();function qa(e){var t;let n=(t=e.visibilityDoc)==null?document:t,r=!1,i=setInterval(()=>{n.visibilityState===`visible`&&e.transport.postSessionMeta(Ja(e.config,e.sessionId,e.startedAt,e.nextMetaVersion(),`active`,e.replayCounts()))},6e4),a=()=>{var t;r||(r=!0,clearInterval(i),e.recorder.flush(!0),e.events.flush(!0),e.transport.postSessionMeta(Ja(e.config,e.sessionId,e.startedAt,e.nextMetaVersion(),`ended`,e.replayCounts()),!0),e.recorder.stop(),e.events.stop(),na(),(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 Ja(e,t,n,r,i,a){var o;let s=mi(navigator.userAgent),c=new Date,l={browser_name:s.browserName,click_count:a.clicks,device_type:s.deviceType,error_count:a.errors,os_name:s.osName,page_views:a.pageViews,resource_attributes:I(I({},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:pi(n),status:i,url_initial:e.redactUrl(window.location.href),user_agent:navigator.userAgent,user_id:Xa(),version:r};return i===`ended`&&(l.duration_ms=Math.max(0,c.getTime()-n.getTime()),l.end_time=pi(c),l.trace_ids=ta()),l}function Ya(e){let t=e.getUserSessionStartTime();return new Date(t==null?Date.now():t)}function Xa(){var e;return(e=Vr.getUserId())==null?``:e}F(),H();var Za=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),P(this,`_lastPageView`,void 0),this._context=e,this._userSessionManager=t,this._visibilityDoc=o,this._chunkSeqStore=oa(n),this._autoStart=i,this._config=Ka(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 V(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){aa(),na();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{aa(),na(),e._stopInProgress=!1}})()}_tryStart(){var e=this;return V(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 Xi();if(!e._enableRequested||e._active)return;ia(t),na();let r=Ya(e._userSessionManager),i=()=>{},a=Vi({chunkSeqStore:e._chunkSeqStore,config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,onClick:()=>{e._userSessionManager.incrReplayCount(`clicks`)},rrwebModule:n,sessionId:t,transport:e._context.transport}),o=Pi({config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,onPageView:n=>{let r=e._lastPageView;(r==null?void 0:r.sessionId)===t&&r.url===n||(e._lastPageView={sessionId:t,url:n},e._userSessionManager.incrReplayCount(`pageViews`))},sessionId:t,transport:e._context.transport}),s=()=>e._userSessionManager.nextReplayMetaVersion();e._context.transport.postReplay(),e._context.transport.postSessionMeta(Ja(e._config,t,r,s(),`active`,e._userSessionManager.getReplayCounts())),e._active={events:o,recorder:a,removeLifecycle:globalThis.__MXL_TEST_SKIP_REPLAY_LIFECYCLE__===!0?()=>void 0:qa({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,aa(),na(),e._resumeWhenVisible()},recorder:a,replayCounts:()=>e._userSessionManager.getReplayCounts(),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(),H();var Qa=class extends B{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`)}setUserSessionManager(e){super.setUserSessionManager(e),this._ensureSessionRecording()}_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 Za({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 V(function*(){yield e._stopPromise})()}};function $a(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 eo(e){e.forEach(e=>e.disable())}var to=n((()=>{}));function no(e){var t,n;let r=e.tracerProvider||M.getTracerProvider(),i=e.meterProvider||tn.getMeterProvider(),a=e.loggerProvider||qt.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return $a(o,r,i,a),()=>{eo(o)}}var ro=n((()=>{to(),N()}));function io(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 ao=n((()=>{}));function oo(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 so(e){e&&e.logger&&(typeof e.logger==`function`?W=e.logger:W(`new logger isn't a function, not replacing`))}var W,co,lo,uo,fo,po=n((()=>{W=console.error.bind(console),co=(e,t,n)=>{if(!e||!e[t]){W(`no original function `+String(t)+` to wrap`);return}if(!n){W(`no wrapper function`),W(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){W(`original object and wrapper must be functions`);return}let i=n(r,t);return oo(i,`__original`,r),oo(i,`__unwrap`,()=>{e[t]===i&&oo(e,t,r)}),oo(i,`__wrapped`,!0),oo(e,t,i),i},lo=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{W(`must provide one or more modules to patch`),W(Error().stack);return}if(!(t&&Array.isArray(t))){W(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{co(e,t,n)})})},uo=(e,t)=>{if(!e||!e[t]){W(`no function to unwrap.`),W(Error().stack);return}let n=e[t];if(!n.__unwrap)W(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},fo=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{W(`must provide one or more modules to patch`),W(Error().stack);return}if(!(t&&Array.isArray(t))){W(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{uo(e,t)})})},so.wrap=co,so.massWrap=lo,so.unwrap=uo,so.massUnwrap=fo})),mo,ho=n((()=>{po(),N(),F(),L(),mo=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`,co),P(this,`_unwrap`,uo),P(this,`_massWrap`,lo),P(this,`_massUnwrap`,fo),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=j.createComponentLogger({namespace:e}),this._tracer=M.getTracer(e,t),this._meter=tn.getMeter(e,t),this._logger=qt.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=I({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)}}}})),go,_o=n((()=>{ho(),F(),go=class extends mo{constructor(e,t,n){super(e,t,n),P(this,`_enabled`,!1),this._config.enabled&&this.enable()}isEnabled(){return this._enabled}}})),vo=n((()=>{_o()})),yo=n((()=>{ro(),ao(),vo()})),bo,xo=n((()=>{bo=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function So(e){return e.setValue(wo,!0)}function Co(e){return e.getValue(wo)===!0}var wo,To=n((()=>{N(),wo=ce(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function Eo(e){return Do(e,jo)}function Do(e,t){if(e.value===void 0)return 0;if(e.key.length===0)return j.warn(`Invalid attribute key: ${e.key}`),1;let n=!Object.hasOwn(e.attributes,e.key);if(n&&e.currentAttributesCount>=e.limits.attributeCountLimit)return 2;if(!t(e.value))return j.warn(`Invalid attribute value set for key: ${e.key}`),1;let r=e.limits.attributeValueLengthLimit;return r<=0&&(j.warn(`Invalid attributeValueLengthLimit: must be positive, got ${r} (ignoring)`),r=1/0),e.attributes[e.key]=Po(e.value,r),n?3:4}function Oo(e,t){return Ao(e,t,jo)}function ko(e,t){return Ao(e,t,Fo)}function Ao(e,t,n){if(typeof e!=`object`||!e)return{};let r={},i=0,a=t.attributeValueLengthLimit;a<=0&&(j.warn(`Invalid attributeValueLengthLimit: must be positive, got ${a} (ignoring)`),a=1/0);let o=0;for(let[s,c]of Object.entries(e))if(c!==void 0){if(o>=t.attributeCountLimit){i++;continue}if(s.length===0){j.warn(`Invalid attribute key: ${s}`),i++;continue}if(!n(c)){j.warn(`Invalid attribute value set for key: ${s}`),i++;continue}r[s]=Po(c,a),o++}return{attributes:r,droppedAttributesCount:i}}function jo(e){return Mo(e,new WeakSet)}function Mo(e,t){switch(typeof e){case`undefined`:case`bigint`:case`symbol`:case`function`:return!1;case`string`:case`number`:case`boolean`:return!0;case`object`:break;default:return!1}if(e===null||e instanceof Uint8Array)return!0;if(t.has(e))return!1;t.add(e);let n=No(e,t);return t.delete(e),n}function No(e,t){if(Array.isArray(e)){for(let n of e)if(n!==void 0&&!Mo(n,t))return!1;return!0}let n=e;if(n.constructor!==Object&&n.constructor!==void 0)return!1;for(let e of Object.keys(n)){let r=n[e];if(r!==void 0&&!Mo(r,t))return!1}return!0}function Po(e,t){switch(typeof e){case`number`:case`boolean`:case`undefined`:case`bigint`:case`symbol`:case`function`:return e;case`string`:return e.length<=t?e:e.substring(0,t);case`object`:break;default:return e}if(e===null)return e;if(e instanceof Uint8Array)return e.length<=t?e:e.slice(0,t);if(Array.isArray(e))return e.map(e=>Po(e,t));let n={},r=e;for(let e of Object.keys(r))r[e]!==void 0&&(n[e]=Po(r[e],t));return n}function Fo(e){return Array.isArray(e)?Io(e):Lo(typeof e)}function Io(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Lo(e)){t=e;continue}return!1}return!1}}return!0}function Lo(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var Ro,zo=n((()=>{N(),Ro=function(e){return e[e.DROP_UNDEFINED=0]=`DROP_UNDEFINED`,e[e.DROP_INVALID=1]=`DROP_INVALID`,e[e.DROP_LIMIT_REACHED=2]=`DROP_LIMIT_REACHED`,e[e.ADD_NEW=3]=`ADD_NEW`,e[e.ADD_OVERWRITE_EXISTING=4]=`ADD_OVERWRITE_EXISTING`,e}({})}));function Bo(){return e=>{j.error(Vo(e))}}function Vo(e){return typeof e==`string`?e:JSON.stringify(Ho(e))}function Ho(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 Uo=n((()=>{N()}));function G(e){try{Wo(e)}catch(e){}}var Wo,Go=n((()=>{Uo(),Wo=Bo()}));function K(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*rs)]}function Ko(e){return ts(K(performance.timeOrigin),K(typeof e==`number`?e:performance.now()))}function qo(e){if($o(e))return e;if(typeof e==`number`)return e<performance.timeOrigin/2?Ko(e):K(e);if(e instanceof Date)return K(e.getTime());throw TypeError(`Invalid input type`)}function Jo(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=is),[n,r]}function Yo(e){return e[0]*is+e[1]}function Xo(e){return e[0]*1e6+e[1]/1e3}function Zo(e){return e[0]*1e3+e[1]/1e6}function Qo(e){return e[0]+e[1]/is}function $o(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function es(e){return $o(e)||typeof e==`number`||e instanceof Date}function ts(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=is&&(n[1]-=is,n[0]+=1),n}var ns,rs,is,as=n((()=>{ns=9,rs=Math.pow(10,6),is=Math.pow(10,ns)})),q,os=n((()=>{q=function(e){return e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`,e}({})}));function ss(e){return us.test(e)}function cs(e){return ds.test(e)&&!fs.test(e)}var ls,us,ds,fs,ps=n((()=>{ls=`[_0-9a-z-*/]`,us=RegExp(`^(?:${`[a-z]${ls}{0,255}`}|${`[a-z0-9]${ls}{0,240}@[a-z]${ls}{0,13}`})$`),ds=/^[ -~]{0,255}[!-~]$/,fs=/,|=/})),ms,hs,gs,_s,vs,ys=n((()=>{ps(),F(),ms=32,hs=512,gs=`,`,_s=`=`,vs=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(!ss(e)||!cs(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`)i+=t.length-r.length;else{if(n.size>=ms)return this;i+=e.length+t.length+(n.size>0?2:1)}if(i>hs)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=gs+e),e=`${n[0]}${_s}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(gs),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(_s);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!ss(a)||!cs(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>hs)&&(t.set(a,o),n=s,t.size>=ms))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 bs(e){let t=ws.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var xs,Ss,Cs,ws,Ts,Es=n((()=>{To(),ys(),N(),xs=`traceparent`,Ss=`tracestate`,Cs=`00`,ws=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),Ts=class{inject(e,t,n){let r=M.getSpanContext(e);if(!r||Co(e)||!Qe(r))return;let i=`${Cs}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||Ve.NONE).toString(16)}`;n.set(t,xs,i),r.traceState&&n.set(t,Ss,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,xs);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=bs(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Ss);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new vs(typeof e==`string`?e:void 0)}return M.setSpanContext(e,a)}fields(){return[xs,Ss]}}}));function Ds(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Os(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Os,ks=n((()=>{Os=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}));function As(e,t){return typeof t==`string`?e===t:!!e.match(t)}function js(e,t){if(!t)return!1;for(let n of t)if(As(e,n))return!0;return!1}var Ms=n((()=>{})),Ns,Ps=n((()=>{F(),Ns=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)}}})),Fs,Is=n((()=>{Ps(),F(),Fs=class{constructor(e,t){P(this,`_isCalled`,!1),P(this,`_deferred`,new Ns),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 Ls(e,t){return new Promise(n=>{A.with(So(A.active()),()=>{e.export(t,n)})})}var Rs=n((()=>{To(),N()})),zs=n((()=>{})),Bs,Vs=n((()=>{Bs=`3.1.1`})),Hs,Us=n((()=>{Hs=`process.runtime.name`})),Ws,Gs=n((()=>{Vs(),Us(),U(),Ws={[ja]:`opentelemetry`,[Hs]:`browser`,[ka]:Aa,[Ma]:Bs}})),Ks=n((()=>{zs(),Gs()})),qs,J=n((()=>{To(),zo(),Go(),as(),os(),Es(),ks(),Ms(),Is(),Rs(),Ks(),qs={_export:Ls}}));function Js(){return`unknown_service`}var Ys=n((()=>{})),Xs=n((()=>{Ys()}));function Zs(e,t){return rc.FromAttributeList(Object.entries(e),t)}function Qs(){return Zs({})}function $s(){return Zs({[Da]:Js(),[ka]:Ws[ka],[ja]:Ws[ja],[Ma]:Ws[Ma]})}function ec(e){return e.map(([e,t])=>bo(t)?[e,t.then(e=>e,t=>{j.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function tc(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 nc(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 rc,ic=n((()=>{xo(),N(),J(),U(),Xs(),F(),H(),rc=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=ec(t),r._asyncAttributesPending=t.filter(([e,t])=>bo(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])=>(bo(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ec(this._rawAttributes),this._schemaUrl=tc(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return V(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,bo(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(bo(n)){j.debug(`Unsettled resource attribute ${t} skipped`);continue}Object.hasOwn(e,t)||(t.length===0?j.warn(`dropping invalid resource attribute key: <empty string>`):Fo(n)?e[t]=n:j.warn(`dropping invalid resource attribute value for key "${t}"`))}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=nc(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),ac=n((()=>{ic()}));N(),J(),U(),F();var oc=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=qo(r==null?f:r),this._hrTimeObserved=qo(i==null?f:i),d){let e=M.getSpanContext(d);e&&Qe(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=Eo({key:e,value:t,attributes:this.attributes,limits:this._logRecordLimits,currentAttributesCount:this._attributesCount});return n===Ro.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&j.warn(`Dropping extra attributes.`)):n===Ro.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(ya,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(xa,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(xa,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(ya,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ba,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}};N(),F(),L();var sc=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 oc(this._sharedState,this._instrumentationScope,I({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.enabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==k.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&&Qe(e)&&(e.traceFlags&Ve.SAMPLED)!==Ve.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}};function cc(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(cc)]:[`map`,Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,cc(t)])]}function lc(e){var t,n;return JSON.stringify([e.name,e.version||``,e.schemaUrl||``,cc((t=e.attributes)==null?{}:t),(n=e.droppedAttributesCount)==null?0:n])}var uc=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};J(),F(),H();var dc=class{constructor(e){P(this,`processors`,void 0),this.processors=e}forceFlush(e){var t=this;return V(function*(){var n;let r=(n=e==null?void 0:e.timeoutMillis)==null?3e4:n;yield Promise.all(t.processors.map(e=>Ds(e.forceFlush(),r)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return V(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}};let fc=`error.type`;F();var pc=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(),L(),F();let mc={enabled:!0,minimumSeverity:k.UNSPECIFIED,traceBased:!1},hc=()=>I({},mc);var gc=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 dc(this.registeredLogRecordProcessors)):this.activeProcessor=new uc,this._loggerConfigurator=r==null?hc:r;let a=i?i.getMeter(`@opentelemetry/sdk-logs`,`3.1.1`):D();this.loggerMetrics=new pc(a)}getLoggerConfig(e){let t=lc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};N(),ac(),J(),F(),L();var _c=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?$s():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?hc:o,processors:(s=e.processors)==null?[]:s,meterProvider:e.meterProvider};this._sharedState=new gc(c.resource,c.logRecordLimits,c.processors,c.loggerConfigurator,c.meterProvider),this._shutdownOnce=new Fs(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return j.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ne();e||j.warn(`Logger requested without instrumentation scope name.`);let r=I({name:e||`unknown`,version:t,schemaUrl:n==null?void 0:n.schemaUrl},ko(n==null?void 0:n.attributes,this._sharedState.logRecordLimits)),i=lc(r);return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new sc(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(),L();let vc=new Map;var yc=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=vc.get(e))==null?0:r;if(vc.set(e,i+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${i}`},this.droppedAttrs=I(I({},this.standardAttrs),{},{[fc]:`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=I(I({},this.standardAttrs),{},{[fc]:t.name});this.processedLogs.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};N(),J(),H(),F();function bc(e){return xc.apply(this,arguments)}function xc(){return xc=V(function*(e){let t=null;for(let n=0,r=e.length;n<r;n++){let r=e[n].resource;r.asyncAttributesPending&&r.waitForAsyncAttributes&&(t!=null||(t=new Set),t.add(r))}t!==null&&(yield Promise.all(Array.from(t,e=>{var t;return(t=e.waitForAsyncAttributes)==null?void 0:t.call(e)})))}),xc.apply(this,arguments)}var Sc=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 V(function*(){try{yield bc(t),yield A.with(So(A.active()),V(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){G(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return V(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{var n;r._metrics.finishLogs(t.length,e.error),clearTimeout(o),e.code===q.SUCCESS?i():a((n=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):n)}),r._exportScheduledResolve()})})()}},Cc=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 Fs(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 yc(`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 V(function*(){e.onShutdown(),yield e._flushAll(),e._metrics.shutdown(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return V(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 Sc(e._exporter,n,e._exportTimeoutMillis,e._metrics);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){G(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 Sc(this._exporter,e,this._exportTimeoutMillis,this._metrics);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,G(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),wc(this._timer))}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};function wc(e){var t;let n=e;typeof n!=`number`&&((t=n.unref)==null||t.call(n))}J(),F();var Tc=class extends Cc{constructor(e){super(e),P(this,`_visibilityChangeListener`,void 0),this._onInit(e)}onShutdown(){typeof document>`u`||this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener)}_onInit(e){e.disableAutoFlushOnDocumentHide===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{G(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener))}};N(),F();var Ec=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}}},Dc=class{shouldSample(){return{decision:0}}toString(){return`AlwaysOffSampler`}},Oc=class{shouldSample(){return{decision:2}}toString(){return`AlwaysOnSampler`}};N(),J(),F();var kc=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||(G(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Oc),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Oc:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new Dc:n,this._localParentSampled=(r=e.localParentSampled)==null?new Oc:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new Dc:i}shouldSample(e,t,n,r,i,a){let o=M.getSpanContext(e);return!o||!Qe(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&Ve.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&Ve.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()}}`}};L();let Ac=Symbol.for(`nodejs.util.inspect.custom`);function jc(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 Mc(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,I(I({},r),{},{depth:r.depth==null?r.depth:r.depth-1}))}`}N(),J(),U(),F(),L();var Nc=class{constructor(e){var t,n,r;P(this,`_spanContext`,void 0),P(this,`kind`,void 0),P(this,`parentSpanContext`,void 0),P(this,`attributes`,void 0),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:Et.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,`_recordEndMetrics`,void 0),P(this,`_performanceStartTime`,void 0),P(this,`_performanceOffset`,void 0),P(this,`_startTimeProvided`,void 0);let i=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=performance.now(),this._performanceOffset=i-(this._performanceStartTime+performance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,this.startTime=this._getTime((t=e.startTime)==null?i:t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.links){let{linkCountLimit:t}=this._spanLimits;e.links.length>t?(this.links=e.links.slice(e.links.length-t,e.links.length),this._droppedLinksCount=e.links.length-t):(this.links=e.links,this._droppedLinksCount=0)}this.attributes=(n=e.attributes)==null?{}:n,this._attributesCount=Object.keys(this.attributes).length,this._droppedAttributesCount=(r=e.droppedAttributesCount)==null?0:r,this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(this._isSpanEnded())return this;let n=Eo({key:e,value:t,attributes:this.attributes,limits:this._spanLimits,currentAttributesCount:this._attributesCount});return n===Ro.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&j.warn(`Dropping extra attributes.`)):n===Ro.ADD_NEW&&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;return r===0?(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++),es(t)&&(es(n)||(n=t),t=void 0),this.events.push(I({name:e,time:this._getTime(n)},ko(t,{attributeCountLimit:this._spanLimits.attributePerEventCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit}))),this)}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;return t===0?(this._droppedLinksCount++,this):(t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&j.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++),this.links.push(I({context:e.context},Oo(e.attributes,{attributeCountLimit:this._spanLimits.attributePerLinkCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit}))),this)}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Et.UNSET||this.status.code===Et.OK)return this;let t={code:e.code};return e.code===Et.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=Jo(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<=performance.now())return Ko(e+this._performanceOffset);if(typeof e==`number`)return K(e);if(e instanceof Date)return K(e.getTime());if($o(e))return e;if(this._startTimeProvided)return K(Date.now());let t=performance.now()-this._performanceStartTime;return ts(this.startTime,K(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[ya]=e:e&&(e.code?n[xa]=e.code.toString():e.name&&(n[xa]=e.name),e.message&&(n[ya]=e.message),e.stack&&(n[ba]=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}[Ac](e,t,n){return Mc(`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:jc(this.resource)}},e,t,n)}};let Pc=`otel.span.sampling_result`;F();var Fc=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=Lc(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":Ic(e),[Pc]:n}),t===0)return()=>{};let r={[Pc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Ic(e){return e?e.isRemote?`remote`:`local`:`none`}function Lc(e){switch(e){case 2:return`RECORD_AND_SAMPLE`;case 1:return`RECORD_ONLY`;case 0:return`DROP`}}N(),J(),F(),L();let Rc={attributeCountLimit:1/0,attributeValueLengthLimit:1/0};var zc=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`,`3.1.1`);this._tracerMetrics=new Fc(n)}startSpan(e,t={},n=A.active()){var r,i,a,o,s,c;t.root&&(n=M.deleteSpan(n));let l=M.getSpan(n);if(Co(n))return j.debug(`Instrumentation suppressed, returning Noop Span`),M.wrapSpanContext(Ge);let u=l==null?void 0:l.spanContext(),d=this._idGenerator.generateSpanId(),f,p,m;!u||!M.isSpanContextValid(u)?p=this._idGenerator.generateTraceId():(p=u.traceId,m=u.traceState,f=u);let h=(r=t.kind)==null?wt.INTERNAL:r,g=((i=t.links)==null?[]:i).map(e=>I({context:e.context},Oo(e.attributes,{attributeCountLimit:this._spanLimits.attributePerLinkCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit}))),_=Oo(t.attributes,Rc),v=(a=_.attributes)==null?{}:a,y=this._sampler.shouldSample(n,p,e,h,v,g),b=this._tracerMetrics.startSpan(u,y.decision);m=(o=y.traceState)==null?m:o;let x=y.decision===Nt.RECORD_AND_SAMPLED?Ve.SAMPLED:Ve.NONE,S={traceId:p,spanId:d,traceFlags:x,traceState:m};if(y.decision===Nt.NOT_RECORD)return j.debug(`Recording is off, propagating context in a non-recording span`),M.wrapSpanContext(S);let ee=Oo(Object.assign(v,y.attributes),this._spanLimits);return new Nc({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:S,name:e,kind:h,links:g,parentSpanContext:f,attributes:ee.attributes,droppedAttributesCount:((s=_.droppedAttributesCount)==null?0:s)+((c=ee.droppedAttributesCount)==null?0:c),startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:b})}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)}[Ac](e,t,n){return Mc(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:jc(this._resource)},spanLimits:this._spanLimits},e,t,n)}};J(),F();var Bc=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=>{G(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)})}};U(),F(),L();let Vc=new Map;var Hc=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=Vc.get(e))==null?0:r;if(Vc.set(e,i+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${i}`},this.droppedAttrs=I(I({},this.standardAttrs),{},{[va]:`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=I(I({},this.standardAttrs),{},{[va]:t.name});this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};N(),J(),F();var Uc=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 Fs(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 Hc(`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&Ve.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(So(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=>{var a;clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===q.SUCCESS?e():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].resource;t.asyncAttributesPending&&t.waitForAsyncAttributes&&(a!=null||(a=new Set),a.add(t))}a===null?i():Promise.all(Array.from(a,e=>{var t;return(t=e.waitForAsyncAttributes)==null?void 0:t.call(e)})).then(i,e=>{G(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,G(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),Wc(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};function Wc(e){var t;let n=e;typeof n!=`number`&&((t=n.unref)==null||t.call(n))}J(),F();var Gc=class extends Uc{constructor(e){super(e),P(this,`_visibilityChangeListener`,void 0),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{G(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener))}onShutdown(){typeof document<`u`&&this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener)}};let Kc=new Uint8Array(16),qc=new Uint8Array(8),Jc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Yc(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+=Jc[e[n]];return t}var Zc=class{generateTraceId(){return Yc(Kc),Xc(Kc)}generateSpanId(){return Yc(qc),Xc(qc)}};N(),ac(),F();var Qc=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,`_tracerOptions`,void 0),P(this,`_tracers`,new Map),this._resource=(t=e.resource)==null?$s():t;let _=(n=e.spanProcessors)==null?[]:n;this._activeSpanProcessor=new Bc(_),this._tracerOptions={resource:this._resource,sampler:(r=e.sampler)==null?new kc({root:new Oc}):r,spanLimits:{attributeCountLimit:(i=(a=e.spanLimits)==null?void 0:a.attributeCountLimit)==null?128:i,attributeValueLengthLimit:(o=(s=e.spanLimits)==null?void 0:s.attributeValueLengthLimit)==null?1/0:o,eventCountLimit:(c=(l=e.spanLimits)==null?void 0:l.eventCountLimit)==null?128:c,linkCountLimit:(u=(d=e.spanLimits)==null?void 0:d.linkCountLimit)==null?128:u,attributePerEventCountLimit:(f=(p=e.spanLimits)==null?void 0:p.attributePerEventCountLimit)==null?128:f,attributePerLinkCountLimit:(m=(h=e.spanLimits)==null?void 0:h.attributePerLinkCountLimit)==null?128:m},idGenerator:e.idGenerator||new Zc,spanProcessor:this._activeSpanProcessor,meterProvider:(g=e.meterProvider)==null?{getMeter(){return D()}}:g}}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new zc({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?3e4: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=1},n);e.forceFlush().then(()=>{clearTimeout(i),r!==1&&(r=0,t(r))}).catch(e=>{clearTimeout(i),r=2,t(e)})}));return new Promise((e,t)=>{Promise.all(r).then(n=>{let r=n.filter(e=>e!==0);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Ac](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Mc(`TracerProvider`,{resource:{attributes:jc(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)}};yo();let $c={compression:`gzip`,concurrencyLimit:5,keepalive:!0,timeoutMillis:30*1e3},el=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t});var tl,nl=n((()=>{tl={name:`metric_data_point`,countItems:e=>{let t=0;for(let n of e.scopeMetrics)for(let e of n.metrics)t+=e.dataPoints.length;return t}}})),rl,il=n((()=>{rl={name:`span`,countItems:e=>e.length}})),al,ol=n((()=>{al={name:`log`,countItems:e=>e.length}}));function sl(e){let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}var cl=n((()=>{})),ll=n((()=>{cl()})),ul,dl=n((()=>{ul=function(e){return e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e}({})})),Y,fl,pl=n((()=>{Y=function(e){return e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`,e}({}),fl=function(e){return e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`,e}({})}));function ml(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function hl(e){var t,n;return`${e.name}:${(t=e.version)==null?``:t}:${(n=e.schemaUrl)==null?``:n}`}function gl(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new bl(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function _l(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function vl(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function yl(e,t){return e.toLowerCase()===t.toLowerCase()}var bl,xl=n((()=>{bl=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),Sl,Cl=n((()=>{F(),Sl=class{constructor(){P(this,`kind`,0)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}}));function wl(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var Tl,El,Dl=n((()=>{xl(),F(),Tl=class{constructor(e,t,n=!0,r=wl(t)){P(this,`startTime`,void 0),P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),P(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=vl(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},El=class{constructor(e,t){P(this,`kind`,3),P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new Tl(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new Tl(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new Tl(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:0,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===`GAUGE`||e.type===`UP_DOWN_COUNTER`||e.type===`OBSERVABLE_GAUGE`||e.type===`OBSERVABLE_UP_DOWN_COUNTER`;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}}})),Ol,kl,Al=n((()=>{F(),Ol=class e{constructor(e=new kl,t=0,n=0,r=0){P(this,`backing`,void 0),P(this,`indexBase`,void 0),P(this,`indexStart`,void 0),P(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},kl=class e{constructor(e=[0]){P(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}}));function jl(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*Math.pow(2,t)}function Ml(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var Nl=n((()=>{})),Pl,Fl=n((()=>{Pl=class extends Error{}}));function Il(e){return Gl.setFloat64(0,e),{hi:Gl.getUint32(0),lo:Gl.getUint32(4)}}function Ll(e){let{hi:t}=Il(e);return((t&zl)>>20)-Vl}function Rl(e){let{hi:t,lo:n}=Il(e);return(t&Bl)===0&&n===0}var zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl=n((()=>{zl=2146435072,Bl=1048575,Vl=1023,Hl=-1022,Ul=Vl,Wl=Math.pow(2,-1022),Gl=new DataView(new ArrayBuffer(8))})),ql,Jl=n((()=>{Kl(),Nl(),Fl(),F(),ql=class{constructor(e){P(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<Wl?this._minNormalLowerBoundaryIndex():Ll(e)+(Rl(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new Pl(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new Pl(`overflow: ${e} is > maximum lower boundary: ${n}`);return jl(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Hl>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return Ul>>this._shift}}})),Yl,Xl=n((()=>{Kl(),Nl(),Fl(),F(),Yl=class{constructor(e){P(this,`_scale`,void 0),P(this,`_scaleFactor`,void 0),P(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=jl(Math.LOG2E,e),this._inverseFactor=jl(Math.LN2,-e)}mapToIndex(e){if(e<=Wl)return this._minNormalLowerBoundaryIndex()-1;if(Rl(e))return(Ll(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new Pl(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return Wl;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new Pl(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Hl<<this._scale}_maxNormalLowerBoundaryIndex(){return(Ul+1<<this._scale)-1}}}));function Zl(e){if(e>$l||e<Ql)throw new Pl(`expected scale >= ${Ql} && <= ${$l}, got: ${e}`);return eu[e+10]}var Ql,$l,eu,tu=n((()=>{Fl(),Jl(),Xl(),Ql=-10,$l=20,eu=Array.from({length:31},(e,t)=>t>10?new Yl(t-10):new ql(t-10))})),nu,ru,iu,au,ou,su,cu=n((()=>{Al(),Nl(),tu(),N(),F(),nu=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){P(this,`low`,void 0),P(this,`high`,void 0),this.low=e,this.high=t}},ru=20,iu=160,au=2,ou=class e{constructor(e,t=iu,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new Ol,l=new Ol,u=Zl(ru)){P(this,`startTime`,void 0),P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),P(this,`_sum`,void 0),P(this,`_count`,void 0),P(this,`_zeroCount`,void 0),P(this,`_min`,void 0),P(this,`_max`,void 0),P(this,`_positive`,void 0),P(this,`_negative`,void 0),P(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<au&&(j.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
2
- changing to the minimum size of: ${au}`),this._maxSize=au)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(Number.isFinite(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=Ml(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=Zl(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=nu.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=nu.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new nu(0,-1);let r=t-n;return new nu(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},su=class{constructor(e,t){P(this,`kind`,4),P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new ou(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:1,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===`GAUGE`||e.type===`UP_DOWN_COUNTER`||e.type===`OBSERVABLE_GAUGE`||e.type===`OBSERVABLE_UP_DOWN_COUNTER`;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}}})),lu,uu,du=n((()=>{J(),F(),lu=class{constructor(e,t=0,n=[0,0]){P(this,`startTime`,void 0),P(this,`_current`,void 0),P(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=K(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},uu=class{constructor(){P(this,`kind`,2)}createAccumulation(e){return new lu(e)}merge(e,t){let n=Xo(t.sampleTime)>=Xo(e.sampleTime)?t:e;return new lu(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=Xo(t.sampleTime)>=Xo(e.sampleTime)?t:e;return new lu(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:2,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}}})),fu,pu,mu=n((()=>{F(),fu=class{constructor(e,t,n=0,r=!1){P(this,`startTime`,void 0),P(this,`monotonic`,void 0),P(this,`_current`,void 0),P(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},pu=class{constructor(e){P(this,`kind`,1),P(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new fu(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new fu(t.startTime,this.monotonic,r,t.reset):new fu(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new fu(t.startTime,this.monotonic,r,!0):new fu(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:3,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}}})),hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju=n((()=>{Cl(),Dl(),cu(),du(),mu(),N(),F(),yu=(hu=class e{createAggregator(t){return e.DEFAULT_INSTANCE}},P(hu,`DEFAULT_INSTANCE`,new Sl),hu),bu=(gu=class e{createAggregator(t){switch(t.type){case`COUNTER`:case`OBSERVABLE_COUNTER`:case`HISTOGRAM`:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}},P(gu,`MONOTONIC_INSTANCE`,new pu(!0)),P(gu,`NON_MONOTONIC_INSTANCE`,new pu(!1)),gu),xu=(_u=class e{createAggregator(t){return e.DEFAULT_INSTANCE}},P(_u,`DEFAULT_INSTANCE`,new uu),_u),Su=(vu=class e{createAggregator(t){return e.DEFAULT_INSTANCE}},P(vu,`DEFAULT_INSTANCE`,new El([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0)),vu),Cu=class{constructor(e,t=!0){if(P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new El(this._boundaries,this._recordMinMax)}},wu=class{constructor(e=160,t=!0){P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new su(this._maxSize,this._recordMinMax)}},Tu=class{_resolve(e){switch(e.type){case`COUNTER`:case`UP_DOWN_COUNTER`:case`OBSERVABLE_COUNTER`:case`OBSERVABLE_UP_DOWN_COUNTER`:return Du;case`GAUGE`:case`OBSERVABLE_GAUGE`:return Ou;case`HISTOGRAM`:return e.advice.explicitBucketBoundaries?new Cu(e.advice.explicitBucketBoundaries):ku}return j.warn(`Unable to recognize instrument type: ${e.type}`),Eu}createAggregator(e){return this._resolve(e).createAggregator(e)}},Eu=new yu,Du=new bu,Ou=new xu,ku=new Su,new wu,Au=new Tu}));function Mu(e){switch(e.type){case 0:return Au;case 1:return Eu;case 2:return Du;case 3:return Ou;case 5:{var t,n;let r=e;return new wu((t=r.options)==null?void 0:t.maxSize,(n=r.options)==null?void 0:n.recordMinMax)}case 4:{var r,i;let t=e;return t.options==null?ku:new Cu((r=t.options)==null?void 0:r.boundaries,(i=t.options)==null?void 0:i.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Nu,Pu=n((()=>{ju(),Nu=function(e){return e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`,e}({})})),Fu,Iu,Lu=n((()=>{Fu=e=>({type:0}),Iu=e=>1})),Ru,zu,Bu,Vu,Hu,Uu=n((()=>{Ru=`otel.component.name`,zu=`otel.component.type`,Bu=`periodic_metric_reader`,Vu=`otel.sdk.metric_reader.collection.duration`,Hu=`error.type`})),Wu,Gu,Ku=n((()=>{Uu(),F(),L(),Wu=new Map,Gu=class{constructor(e,t){var n;P(this,`collectionDuration`,void 0),P(this,`standardAttrs`,void 0);let r=(n=Wu.get(e))==null?0:n;Wu.set(e,r+1),this.standardAttrs={[zu]:e,[Ru]:`${e}/${r}`},this.collectionDuration=t.createHistogram(Vu,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?I(I({},this.standardAttrs),{},{[Hu]:t}):this.standardAttrs;this.collectionDuration.record(e,n)}}})),qu,Ju=n((()=>{qu=`3.1.1`})),Yu,Xu=n((()=>{xl(),Lu(),Ku(),Ju(),N(),J(),F(),H(),Yu=class{constructor(e){var t,n,r,i;P(this,`_shutdown`,!1),P(this,`_metricProducers`,void 0),P(this,`_sdkMetricProducer`,void 0),P(this,`_selfObsMetrics`,void 0),P(this,`_aggregationTemporalitySelector`,void 0),P(this,`_aggregationSelector`,void 0),P(this,`_cardinalitySelector`,void 0),P(this,`_otelComponentType`,void 0),this._aggregationSelector=(t=e==null?void 0:e.aggregationSelector)==null?Fu:t,this._aggregationTemporalitySelector=(n=e==null?void 0:e.aggregationTemporalitySelector)==null?Iu:n,this._metricProducers=(r=e==null?void 0:e.metricProducers)==null?[]:r,this._cardinalitySelector=e==null?void 0:e.cardinalitySelector,this._otelComponentType=(i=e==null?void 0:e.otelComponentType)==null?this.constructor.name:i,this._selfObsMetrics=new Gu(this._otelComponentType,D())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,qu);this._selfObsMetrics=new Gu(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}collect(e){var t=this;return V(function*(){var n;if(t._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(t._shutdown)throw Error(`MetricReader is shutdown`);let r=Ko(),[i,...a]=yield Promise.all([t._sdkMetricProducer.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}),...t._metricProducers.map(t=>t.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}))]),o=Ko(),s=i.errors.concat(a.flatMap(e=>e.errors)),c=Qo(Jo(r,o));return t._selfObsMetrics.recordCollection(c,s.length>0?(n=s[0].name)==null?`collect_error`:n:void 0),{resourceMetrics:{resource:i.resourceMetrics.resource,scopeMetrics:i.resourceMetrics.scopeMetrics.concat(a.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:s}})()}shutdown(e){var t=this;return V(function*(){if(t._shutdown){j.error(`Cannot call shutdown twice.`);return}(e==null?void 0:e.timeoutMillis)==null?yield t.onShutdown():yield gl(t.onShutdown(),e.timeoutMillis),t._shutdown=!0})()}forceFlush(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if((e==null?void 0:e.timeoutMillis)==null){yield t.onForceFlush();return}yield gl(t.onForceFlush(),e.timeoutMillis)})()}}}));function Zu(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d=I(I({},o),{},{dataPoints:s.slice(c,c+u)});e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}var Qu=n((()=>{L()}));function $u(e){var t;let n=e;typeof n!=`number`&&((t=n.unref)==null||t.call(n))}var ed,td=n((()=>{xl(),Uu(),Xu(),Qu(),N(),J(),F(),L(),H(),ed=class extends Yu{constructor(e){var t,n;let{exporter:r,exportIntervalMillis:i=6e4,metricProducers:a,cardinalityLimits:o,maxExportBatchSize:s}=e,{exportTimeoutMillis:c=3e4}=e;if(super({aggregationSelector:(t=r.selectAggregation)==null?void 0:t.bind(r),aggregationTemporalitySelector:(n=r.selectAggregationTemporality)==null?void 0:n.bind(r),otelComponentType:Bu,metricProducers:a,cardinalitySelector:e=>{let t=I({default:2e3},o);switch(e){case`COUNTER`:var n;return(n=t.counter)==null?t.default:n;case`GAUGE`:var r;return(r=t.gauge)==null?t.default:r;case`HISTOGRAM`:var i;return(i=t.histogram)==null?t.default:i;case`OBSERVABLE_COUNTER`:var a;return(a=t.observableCounter)==null?t.default:a;case`OBSERVABLE_UP_DOWN_COUNTER`:var s;return(s=t.observableUpDownCounter)==null?t.default:s;case`OBSERVABLE_GAUGE`:var c;return(c=t.observableGauge)==null?t.default:c;case`UP_DOWN_COUNTER`:var l;return(l=t.upDownCounter)==null?t.default:l;default:return t.default}}}),P(this,`_interval`,void 0),P(this,`_exporter`,void 0),P(this,`_exportInterval`,void 0),P(this,`_exportTimeout`,void 0),P(this,`_maxExportBatchSize`,void 0),P(this,`_ongoingExportPromise`,null),i<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(c<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(s!==void 0&&(!Number.isInteger(s)||s<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(i<c){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);j.info(`Timeout of ${c} exceeds the interval of ${i}. Clamping timeout to interval duration.`),c=i}this._exportInterval=i,this._exportTimeout=c,this._exporter=r,this._maxExportBatchSize=s}_runOnce(){var e=this;return V(function*(){try{yield e._doRun()}catch(e){G(e)}})()}_doRun(){var e=this;return V(function*(){if(e._ongoingExportPromise){j.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}e._ongoingExportPromise=function(){var t=V(function*(){let{resourceMetrics:t,errors:n}=yield e.collect({timeoutMillis:e._exportTimeout});if(n.length>0&&j.error(`PeriodicExportingMetricReader: metrics collection errors`,...n),t.resource.asyncAttributesPending)try{var r,i;yield(r=(i=t.resource).waitForAsyncAttributes)==null?void 0:r.call(i)}catch(e){j.debug(`Error while resolving async portion of resource: `,e),G(e)}if(t.scopeMetrics.length===0)return;let a=e._maxExportBatchSize?Zu(t,e._maxExportBatchSize):[t],o=null;for(let t of a)try{let n=yield gl(qs._export(e._exporter,t),e._exportTimeout);n.code!==q.SUCCESS&&(o=Error(`PeriodicExportingMetricReader: metrics export failed (error ${n.error})`))}catch(t){if(t instanceof bl){j.error(`PeriodicExportingMetricReader: metrics export timed out after ${e._exportTimeout}ms`);break}else j.error(`PeriodicExportingMetricReader: metrics export threw error`,t),o=t instanceof Error?t:Error(String(t))}if(o)throw o});return function(){return t.apply(this,arguments)}}()();try{yield e._ongoingExportPromise}finally{e._ongoingExportPromise=null}})()}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),$u(this._interval)}onForceFlush(){var e=this;return V(function*(){yield e._awaitOngoingExport(),e._ongoingExportPromise?yield e._awaitOngoingExport():yield e._runOnce(),yield e._exporter.forceFlush()})()}_awaitOngoingExport(){var e=this;return V(function*(){if(e._ongoingExportPromise){j.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{yield e._ongoingExportPromise}catch(e){}}})()}onShutdown(){var e=this;return V(function*(){e._interval&&clearInterval(e._interval),yield e.onForceFlush(),yield e._exporter.shutdown()})()}}}));function nd(){return od}function rd(e){return new ad(e)}var id,ad,od,sd=n((()=>{F(),id=class{process(e,t){return e}},ad=class{constructor(e){P(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}},od=new id})),cd,ld=n((()=>{F(),cd=class{constructor(){P(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}}}));function ud(e,t,n){var r,i,a,o;return pd(e)||j.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:(r=n==null?void 0:n.description)==null?``:r,unit:(i=n==null?void 0:n.unit)==null?``:i,valueType:(a=n==null?void 0:n.valueType)==null?je.DOUBLE:a,advice:(o=n==null?void 0:n.advice)==null?{}:o}}function dd(e,t){var n,r;return{name:(n=e.name)==null?t.name:n,description:(r=e.description)==null?t.description:r,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function fd(e,t){return yl(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}function pd(e){return md.test(e)}var md,hd=n((()=>{xl(),N(),md=/^[a-z][a-z0-9_.\-/]{0,254}$/i}));function gd(e){return e instanceof Sd}var _d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed=n((()=>{N(),F(),_d=class{constructor(e,t){P(this,`_writableMetricStorage`,void 0),P(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){j.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===je.INT&&!Number.isInteger(e)&&(j.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},vd=class extends _d{add(e,t,n){this._record(e,t,n)}},yd=class extends _d{add(e,t,n){if(e<0){j.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},bd=class extends _d{record(e,t,n){this._record(e,t,n)}},xd=class extends _d{record(e,t,n){if(e<0){j.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},Sd=class{constructor(e,t,n){P(this,`_metricStorages`,void 0),P(this,`_descriptor`,void 0),P(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},Cd=class extends Sd{},wd=class extends Sd{},Td=class extends Sd{}})),Dd,Od=n((()=>{hd(),Ed(),F(),Dd=class{constructor(e){P(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=ud(e,`GAUGE`,t);return new bd(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=ud(e,`HISTOGRAM`,t);return new xd(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=ud(e,`COUNTER`,t);return new yd(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=ud(e,`UP_DOWN_COUNTER`,t);return new vd(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=ud(e,`OBSERVABLE_GAUGE`,t);return new wd(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=ud(e,`OBSERVABLE_COUNTER`,t);return new Cd(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=ud(e,`OBSERVABLE_UP_DOWN_COUNTER`,t);return new Td(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}}})),kd,Ad=n((()=>{hd(),F(),kd=class{constructor(e){P(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=ud(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}})),jd,Md,Nd=n((()=>{xl(),F(),jd=class{constructor(e){P(this,`_valueMap`,new Map),P(this,`_keyMap`,new Map),P(this,`_hash`,void 0),this._hash=e}get(e,t){return t!=null||(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n!=null||(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t!=null||(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},Md=class extends jd{constructor(){super(ml)}}})),Pd,Fd=n((()=>{xl(),Nd(),J(),F(),Pd=class{constructor(e,t){P(this,`_activeCollectionStorage`,new Md),P(this,`_cumulativeMemoStorage`,new Md),P(this,`_cardinalityLimit`,void 0),P(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),P(this,`_overflowHashCode`,void 0),P(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t==null?2e3:t)-1,this._overflowHashCode=ml(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let a=K(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){var i;(i=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(a)))==null||i.record(e);return}r=this._aggregator.createAccumulation(a),this._activeCollectionStorage.set(t,r)}r==null||r.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o==null||o.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new Md,e}}}));function Id(e){return Array.from(e.entries())}var Ld,Rd=n((()=>{Nd(),F(),Ld=class e{constructor(e,t){P(this,`_aggregator`,void 0),P(this,`_unreportedAccumulations`,new Map),P(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===1?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=Id(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new Md,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){var r;for(let[i,a]of e.keys())(r=t.get(i,a))==null||r.setStartTime(n);return t}}})),zd,Bd=n((()=>{Ad(),Nd(),Fd(),Rd(),F(),zd=class extends kd{constructor(e,t,n,r,i){super(e),P(this,`_aggregationCardinalityLimit`,void 0),P(this,`_deltaMetricStorage`,void 0),P(this,`_temporalMetricStorage`,void 0),P(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Pd(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ld(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new Md;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}}));function Vd(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Hd(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Ud(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Wd(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Gd(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
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=function(e){return 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`,e}({})})),o,s=n((()=>{o=`1.10.0`}));function c(e){let t=new Set([e]),n=new Set,r=e.match(l);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(l);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var l,u,d=n((()=>{s(),l=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,u=c(o)}));function f(){return Object.defineProperty({},`version`,{value:o,enumerable:!0,writable:!1,configurable:!1})}function p(e,t,n,r=!1){var i;let a=v[_]=(i=v[_])==null?f():i;if(!r&&a[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(a.version!==`1.10.0`){let t=Error(`@opentelemetry/api: Registration of version v${a.version} for ${e} does not match previously registered API v${o}`);return n.error(t.stack||t.message),!1}return a[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${o}.`),!0}function m(e){let t=v[_];if(t!=null){if(t!==y){if(!t.version||!u(t.version))return;y=t}return t[e]}}function h(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${o}.`);let n=v[_];n&&delete n[e]}var g,_,v,y,b=n((()=>{s(),d(),g=o.split(`.`)[0],_=Symbol.for(`opentelemetry.js.api.${g}`),v=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function x(e,t,n){let r=m(`diag`);if(r)return r[e](t,...n)}var S,ee=n((()=>{b(),S=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return x(`debug`,this._namespace,e)}error(...e){return x(`error`,this._namespace,e)}info(...e){return x(`info`,this._namespace,e)}warn(...e){return x(`warn`,this._namespace,e)}verbose(...e){return x(`verbose`,this._namespace,e)}}}));function te(e,t){e<0?e=0:e>9999&&(e=9999),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,30),warn:n(`warn`,50),info:n(`info`,60),debug:n(`debug`,70),verbose:n(`verbose`,80)}}var ne=n((()=>{})),re,C,w=n((()=>{b(),ee(),ne(),re=`diag`,C=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=m(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:60})=>{var r;if(e===t){var i;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((i=e.stack)==null?e.message:i),!1}typeof n==`number`&&(n={logLevel:n});let a=m(`diag`),o=te((r=n.logLevel)==null?60:r,e);if(a&&!n.suppressOverrideMessage){var s;let e=(s=Error().stack)==null?`<failed to generate stacktrace>`:s;a.warn(`Current logger will be overwritten from ${e}`),o.warn(`Current logger will overwrite one already registered from ${e}`)}return p(`diag`,o,t,!0)},t.disable=()=>{h(re,t)},t.createComponentLogger=e=>new S(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),ie,ae=n((()=>{ie=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 oe(e={}){return new ie(new Map(Object.entries(e)))}var se=n((()=>{w(),ae(),C.instance()}));function ce(e){return Symbol.for(e)}var T,le=n((()=>{T=new 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}}}})),ue,E,de,fe=n((()=>{if(ue=[{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]);de=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<ue.length;t++)this[ue[t].n]=e(ue[t].c)}}}));function D(){return Se}var pe,me,he,ge,_e,O,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae=n((()=>{pe=class{constructor(){}createGauge(e,t){return we}createHistogram(e,t){return Te}createCounter(e,t){return Ce}createUpDownCounter(e,t){return Ee}createObservableGauge(e,t){return Oe}createObservableCounter(e,t){return De}createObservableUpDownCounter(e,t){return ke}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},me=class{},he=class extends me{add(e,t){}},ge=class extends me{add(e,t){}},_e=class extends me{record(e,t){}},O=class extends me{record(e,t){}},ve=class{addCallback(e){}removeCallback(e){}},ye=class extends ve{},be=class extends ve{},xe=class extends ve{},Se=new pe,Ce=new he,we=new _e,Te=new O,Ee=new ge,De=new ye,Oe=new be,ke=new xe})),je,Me=n((()=>{je=function(e){return e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`,e}({})}));function Ne(){return Fe}var Pe,Fe,Ie=n((()=>{Pe=class{emit(e){}enabled(){return!1}},Fe=new Pe})),k,Le=n((()=>{k=function(e){return 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`,e}({})})),Re,ze,Be=n((()=>{Re={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},ze={set(e,t,n){e!=null&&(e[t]=n)}}})),A,Ve=n((()=>{A=function(e){return e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`,e}({})})),He,Ue,We,Ge=n((()=>{He=`0000000000000000`,Ue=`00000000000000000000000000000000`,We={traceId:Ue,spanId:He,traceFlags:0}})),Ke,qe=n((()=>{Ge(),Ke=class{constructor(e=We){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 Je(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=($e[e.charCodeAt(t)]|0)+($e[e.charCodeAt(t+1)]|0)+($e[e.charCodeAt(t+2)]|0)+($e[e.charCodeAt(t+3)]|0);return n===t}function Ye(e){return Je(e,32)&&e!==`00000000000000000000000000000000`}function Xe(e){return Je(e,16)&&e!==`0000000000000000`}function Ze(e){return Ye(e.traceId)&&Xe(e.spanId)}function Qe(e){return new Ke(e)}var $e,et=n((()=>{qe(),$e=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])})),tt,nt=n((()=>{le(),tt=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}attach(e){return{dispose(){}}}}})),rt,it,at,ot,st=n((()=>{b(),w(),nt(),rt=`context`,it=new tt,at=Object.freeze({dispose:()=>{}}),ot=class e{constructor(){this._attachUnsupportedWarned=!1}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return p(rt,e,C.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)}attach(e){let t=this._getContextManager();return t.attach?t.attach(e):(this._attachUnsupportedWarned||(this._attachUnsupportedWarned=!0,C.instance().warn(`The current ContextManager does not implement attach(). The context will not be attached. Use a ContextManager that supports attach() (e.g. AsyncLocalStorageContextManager) or use with()/bind() instead.`)),at)}_getContextManager(){return m(rt)||it}disable(){this._getContextManager().disable(),h(rt,C.instance())}}}));function ct(e){return e.getValue(mt)||void 0}function lt(){return ct(ot.getInstance().active())}function ut(e,t){return e.setValue(mt,t)}function dt(e){return e.deleteValue(mt)}function ft(e,t){return ut(e,new Ke(t))}function pt(e){var t;return(t=ct(e))==null?void 0:t.spanContext()}var mt,ht=n((()=>{le(),st(),qe(),mt=ce(`OpenTelemetry Context Key SPAN`)}));function gt(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 _t,vt,yt=n((()=>{st(),qe(),ht(),et(),_t=ot.getInstance(),vt=class{startSpan(e,t,n=_t.active()){if(t!=null&&t.root)return new Ke;let r=n&&pt(n);return gt(r)&&Ze(r)?new Ke(r):new Ke}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?_t.active():i,l=this.startSpan(e,a,c),u=ut(c,l);return _t.with(u,s,void 0,l)}}})),bt,xt,St=n((()=>{yt(),bt=new vt,xt=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):bt}}})),Ct,wt=n((()=>{Ct=function(e){return 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`,e}({})})),Tt,Et=n((()=>{Tt=function(e){return e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`,e}({})})),Dt,Ot=n((()=>{yt(),Dt=class{getTracer(e,t,n){return new vt}}})),kt,At,jt=n((()=>{St(),Ot(),kt=new Dt,At=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new xt(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?kt:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),Mt,Nt=n((()=>{Mt=function(e){return e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`,e}({})})),j,Pt=n((()=>{st(),j=ot.getInstance()})),M,Ft=n((()=>{w(),M=C.instance()})),It,Lt,Rt=n((()=>{Ie(),It=class{getLogger(e,t,n){return new Pe}},Lt=new It})),zt,Bt=n((()=>{Ie(),zt=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):Fe}}})),Vt,Ht=n((()=>{Rt(),Bt(),Vt=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new zt(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?Lt:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),Ut,Wt,Gt=n((()=>{b(),w(),Ht(),Ut=`logs`,Wt=class e{constructor(){this._proxyLoggerProvider=new Vt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){let t=p(Ut,e,C.instance());return t&&this._proxyLoggerProvider._setDelegate(e),t}getLoggerProvider(){return m(Ut)||this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){h(Ut,C.instance()),this._proxyLoggerProvider=new Vt}}})),Kt,qt=n((()=>{Gt(),Kt=Wt.getInstance()})),Jt,Yt,Xt=n((()=>{Ae(),Jt=class{getMeter(e,t,n){return Se}},Yt=new Jt})),Zt,Qt,$t=n((()=>{b(),w(),Xt(),Zt=`metrics`,Qt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return p(Zt,e,C.instance())}getMeterProvider(){return m(Zt)||Yt}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){h(Zt,C.instance())}}})),en,tn=n((()=>{$t(),en=Qt.getInstance()})),nn,rn=n((()=>{nn=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function an(e){return e.getValue(ln)||void 0}function on(){return an(ot.getInstance().active())}function sn(e,t){return e.setValue(ln,t)}function cn(e){return e.deleteValue(ln)}var ln,un=n((()=>{le(),st(),ln=ce(`OpenTelemetry Baggage Key`)})),dn,fn,pn,mn=n((()=>{b(),w(),se(),Be(),rn(),un(),dn=`propagation`,fn=new nn,pn=class e{constructor(){this.createBaggage=oe,this.getBaggage=an,this.getActiveBaggage=on,this.setBaggage=sn,this.deleteBaggage=cn}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return p(dn,e,C.instance())}inject(e,t,n=ze){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Re){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){h(dn,C.instance())}_getGlobalPropagator(){return m(dn)||fn}}})),hn,gn=n((()=>{mn(),hn=pn.getInstance()})),_n,vn,yn=n((()=>{b(),w(),ht(),et(),jt(),_n=`trace`,vn=class e{constructor(){this._proxyTracerProvider=new At,this.wrapSpanContext=Qe,this.isSpanContextValid=Ze,this.deleteSpan=dt,this.getSpan=ct,this.getActiveSpan=lt,this.getSpanContext=pt,this.setSpan=ut,this.setSpanContext=ft}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=p(_n,this._proxyTracerProvider,C.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return m(_n)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){h(_n,C.instance()),this._proxyTracerProvider=new At}}})),N,bn=n((()=>{yn(),N=vn.getInstance()})),P=n((()=>{a(),le(),fe(),Ae(),Me(),Ie(),Le(),Be(),Ve(),Ge(),et(),wt(),Et(),Nt(),Pt(),Ft(),qt(),tn(),gn(),bn()}));P();function xn(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 Sn=class{logException(e,t){}captureException(e,t){}addExceptionFilter(e){}message(e,t,n){}};function Cn(e){"@babel/helpers - typeof";return Cn=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},Cn(e)}var wn=n((()=>{}));function Tn(e,t){if(Cn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Cn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var En=n((()=>{wn()}));function Dn(e){var t=Tn(e,`string`);return Cn(t)==`symbol`?t:t+``}var On=n((()=>{wn(),En()}));function F(e,t,n){return(t=Dn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I=n((()=>{On()}));I();let kn=new Sn;var An=class{constructor(){F(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?kn: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)}};I();let jn=new Sn,Mn=new Set([`setDelegate`,`getDelegate`]);var Nn=class e{static getInstance(){if(!e._instance){let t=new An,n=xn(t,jn,M.createComponentLogger({namespace:`LogAPI`}),Mn);e._instance=Object.assign(n,{getLogManager(){return t},setGlobalLogManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};F(Nn,`_instance`,void 0);let Pn=Nn.getInstance();var Fn=class{track(){}identify(){}increment(){}decrement(){}clear(){}screenView(){}};let In=(e,t,n,r=100)=>{e.length>=r&&(e.shift(),n()),e.push(t)};P(),I();let Ln=new Fn;var Rn=class{constructor(e){F(this,`_delegate`,void 0),F(this,`_queue`,[]),F(this,`_diag`,void 0),this._diag=e==null?M.createComponentLogger({namespace:`ProxyAnalyticsManager`}):e}getDelegate(){var e;return(e=this._delegate)==null?Ln: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&&In(t,e,()=>{this._diag.warn(`dropping oldest queued analytics call; pre-init queue is full`)})}};P(),I();let zn=new Fn,Bn=new Set([`setDelegate`,`getDelegate`]);var Vn=class e{static getInstance(){if(!e._instance){let t=new Rn,n=xn(t,zn,M.createComponentLogger({namespace:`AnalyticsAPI`}),Bn);e._instance=Object.assign(n,{getAnalyticsManager(){return t},setGlobalAnalyticsManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};F(Vn,`_instance`,void 0);let Hn=Vn.getInstance();var Un=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}addRouteChangedListener(e){return()=>{}}};I();let Wn=new Un;var Gn=class{constructor(){F(this,`_delegate`,void 0),F(this,`_routeChangedListeners`,[]),F(this,`_removeDelegateListener`,null)}getDelegate(){var e;return(e=this._delegate)==null?Wn:e}setDelegate(e){var t;(t=this._removeDelegateListener)==null||t.call(this),this._removeDelegateListener=null,this._delegate=e,this._removeDelegateListener=e.addRouteChangedListener(e=>{for(let t of this._routeChangedListeners)t(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._routeChangedListeners.push(e),()=>{let t=this._routeChangedListeners.indexOf(e);t!==-1&&this._routeChangedListeners.splice(t,1)}}};P(),I();let Kn=new Un,qn=new Set([`setDelegate`,`getDelegate`]);var Jn=class e{static getInstance(){if(!e._instance){let t=new Gn,n=xn(t,Kn,M.createComponentLogger({namespace:`PageAPI`}),qn);e._instance=Object.assign(n,{getPageManager(){return t},setGlobalPageManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};F(Jn,`_instance`,void 0);let Yn=Jn.getInstance(),Xn=new Uint8Array(16),Zn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),Qn=()=>{crypto.getRandomValues(Xn);let e=``;for(let t=0;t<16;t++)e+=Zn[Xn[t]];return e},$n=`mxl_user_session_state`,er=`mxl_permanent_properties`,tr=`mxl_last_end_user_session_ts`,nr=`mxl_tab`,rr=`mxl_tab_activity`,ir=1800,ar=new Set([`user_session_ended`,`web_foreground_inactivity`]),or=[`keydown`,`mousedown`,`mousemove`,`scroll`];function sr(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 L(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?sr(Object(n),!0).forEach(function(t){F(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var R=n((()=>{I()}));R();let cr={clicks:0,errors:0,pageViews:0},lr=(e,t)=>t<e.userSessionStartTs||t>=e.userSessionMaxEndTs||e.inactivityDeadlineTs!==null&&t>=e.inactivityDeadlineTs,ur=({now:e,previousUserSessionId:t,maxUserSessionDurationSeconds:n,inactivityTimeoutSeconds:r,foregroundInactivityTimeoutSeconds:i,userSessionNumber:a})=>({foregroundInactivityTimeoutSeconds:i,inactivityDeadlineTs:null,inactivityTimeoutSeconds:r,maxUserSessionDurationSeconds:n,previousUserSessionId:t,replayCounts:cr,replayMetaVersion:0,replaySampled:null,schemaVersion:4,userSessionId:Qn(),userSessionMaxEndTs:e+n*1e3,userSessionNumber:a,userSessionPartIndex:0,userSessionProperties:{},userSessionStartTs:e}),dr=e=>typeof e==`object`&&e?e.schemaVersion:void 0,fr=e=>L(L({},e),{},{replayCounts:cr,schemaVersion:4}),pr=e=>fr(L(L({},e),{},{foregroundInactivityTimeoutSeconds:e.inactivityTimeoutSeconds})),mr=e=>pr(L(L({},e),{},{replayMetaVersion:2,replaySampled:null})),hr=e=>{switch(dr(e)){case 4:return e;case 3:return fr(e);case 2:return pr(e);case 1:return mr(e);default:return null}},gr=(e,t)=>{let n=e.getItem($n);if(!n)return null;try{let e=hr(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($n),null}},_r=(e,t)=>{let n=e.getItem(er);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(er),{}}},vr=(e,t)=>Object.keys(t).length===0?e.removeItem(er):e.setItem(er,JSON.stringify(t));var yr=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){}recordSDKStartupTimings(){}claimReplaySample(e){return!1}nextReplayMetaVersion(){return 0}incrReplayCount(e){}getReplayCounts(){return cr}_clearMaxDurationTimer(){}_shutdown(){}};I();let br=new yr;var xr=class{constructor(){F(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?br: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)}recordSDKStartupTimings(e){this.getDelegate().recordSDKStartupTimings(e)}claimReplaySample(e){return this.getDelegate().claimReplaySample(e)}nextReplayMetaVersion(){return this.getDelegate().nextReplayMetaVersion()}incrReplayCount(e){this.getDelegate().incrReplayCount(e)}getReplayCounts(){return this.getDelegate().getReplayCounts()}_clearMaxDurationTimer(){this.getDelegate()._clearMaxDurationTimer()}_shutdown(){this.getDelegate()._shutdown()}};P(),I();let Sr=new yr,Cr=new Set([`setDelegate`,`getDelegate`]);var wr=class e{static getInstance(){if(!e._instance){let t=new xr,n=xn(t,Sr,M.createComponentLogger({namespace:`SessionAPI`}),Cr);e._instance=Object.assign(n,{getUserSessionManager(){return t},setGlobalUserSessionManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};F(wr,`_instance`,void 0);let Tr=wr.getInstance();P(),I();var Er=class{constructor(e=We){F(this,`_spanContext`,void 0),F(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){}};P();var Dr=class{startSpan(e,t){return new Er}setSpan(e,t){return T}getSpan(e){}};I();let Or=new Dr;var kr=class{constructor(){F(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Or: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)}};P(),I();let Ar=new Dr,jr=new Set([`setDelegate`,`getDelegate`]);var Mr=class e{static getInstance(){if(!e._instance){let t=new kr,n=xn(t,Ar,M.createComponentLogger({namespace:`TraceAPI`}),jr);e._instance=Object.assign(n,{getTraceManager(){return t},setGlobalTraceManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};F(Mr,`_instance`,void 0);let Nr=Mr.getInstance();var Pr=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};P(),I();let Fr=new Pr;var Ir=class{constructor(e){F(this,`_delegate`,void 0),F(this,`_queue`,[]),F(this,`_diag`,void 0),this._diag=e==null?M.createComponentLogger({namespace:`ProxyUserManager`}):e}getDelegate(){var e;return(e=this._delegate)==null?Fr: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){In(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()}};P(),I();let Lr=new Pr,Rr=new Set([`setDelegate`,`getDelegate`]);var zr=class e{static getInstance(){if(!e._instance){let t=new Ir,n=xn(t,Lr,M.createComponentLogger({namespace:`UserAPI`}),Rr);e._instance=Object.assign(n,{getUserManager(){return t},setGlobalUserManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};F(zr,`_instance`,void 0);let Br=zr.getInstance(),z=`mxl.type`,Vr=`mxl.state`,Hr=`react.component_stack`,Ur=`mxl.instrumentation`,Wr=`mxl.js_file_bundle_ids`,Gr=`mxl.perf_clock_lag_ms`,Kr=`browser.url.full`,qr=`browser.navigation_timing.not_restored_reasons`,Jr=`app.surface.name`,Yr=`app.surface.id`,Xr=`app.surface.label`,Zr=`mxl.session_part_id`,Qr=`mxl.user_session_id`,$r=`mxl.user_session_previous_id`,ei=`mxl.user_session_number`,ti=`mxl.application.id`,ni=`mxl.profile.id`,B=`mxl.session_prev.`,ri={pageLabel:Xr};I();let ii=new WeakMap,ai=e=>{let t=ii.get(e);return t||(t={lastCheckedNow:e.now(),segments:[{from:0,origin:e.timeOrigin}]},ii.set(e,t)),t};var oi=class{constructor(e=window.performance,t=()=>Date.now()){F(this,`_clock`,void 0),F(this,`_wallNow`,void 0),F(this,`_sharedClockState`,void 0),F(this,`navigationEntry`,null),F(this,`checkDrift`,()=>{let e=this._clock.now(),t=this._wallNow(),{segments:n}=this._sharedClockState,r=n[n.length-1];Math.abs(r.origin+e-t)>1e3&&(n.push({from:this._sharedClockState.lastCheckedNow,origin:t-e}),n.length>100&&n.splice(1,1)),this._sharedClockState.lastCheckedNow=e}),F(this,`offsetToAbsoluteTime`,(e,t=e)=>(this.checkDrift(),this._originAt(t)+e)),F(this,`getNow`,()=>{this.checkDrift();let{segments:e}=this._sharedClockState;return e[e.length-1].origin+this._clock.now()}),F(this,`getClockLag`,(e=this._sharedClockState.segments[0].origin)=>Math.round(this._wallNow()-(e+this._clock.now()))),F(this,`setZeroTimeOffset`,e=>{this._sharedClockState.zeroTimeOffset=e}),F(this,`getZeroTime`,e=>{let t=this._getZeroTimeOffset();return this.offsetToAbsoluteTime(t,e==null?t:e)}),F(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}),F(this,`getOffsetFromOrigin`,()=>this._clock.now()),F(this,`getOffsetFromZeroTime`,(e=this._clock.now())=>Math.max(0,e-this._getZeroTimeOffset())),this._clock=e,this._wallNow=t,this._sharedClockState=ai(e)}_originAt(e){let{origin:t}=this._sharedClockState.segments[0];for(let n of this._sharedClockState.segments){if(n.from>=e)break;t=n.origin}return t}_getZeroTimeOffset(){var e;return Math.max(this._getNavigationActivationStart(),(e=this._sharedClockState.zeroTimeOffset)==null?0:e)}_getNavigationActivationStart(){var e;let t=this.getNavigationEntry();return(e=t==null?void 0:t.activationStart)==null?0:e}};P(),I(),R();var si=class{constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,F(this,`_config`,{}),F(this,`_diag`,void 0),F(this,`_tracer`,void 0),F(this,`_meter`,void 0),F(this,`_logger`,void 0),this.setConfig(n),this._diag=M.createComponentLogger({namespace:e}),this._tracer=N.getTracer(e,t),this._meter=en.getMeter(e,t),this._logger=Kt.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=L({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)}}};I();var V=class extends si{constructor({instrumentationName:e,instrumentationVersion:t,config:n,diag:r,perf:i,limitManager:a}){super(e,t,n),F(this,`_userSessionManager`,void 0),F(this,`_logManager`,void 0),F(this,`_limitManager`,void 0),F(this,`_perf`,void 0),F(this,`_removeSessionPartListeners`,{}),F(this,`_sessionPartListeners`,{}),r&&(this._diag=r),this._perf=i==null?new oi:i,this._userSessionManager=Tr.getUserSessionManager(),this._logManager=Pn.getLogManager(),this._limitManager=a}get _isEnabled(){return this._config.enabled===!0}set _isEnabled(e){this._config.enabled=e}setConfig(e){let t=this._isEnabled;super.setConfig(e),this._isEnabled=t}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(e=>{var t,n;return(t=(n=this._sessionPartListeners).start)==null?void 0:t.call(n,e)})),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())}};I();let ci=/\([^()]+\)/g;var li=class extends V{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0,pageManager:n}){super({config:{},diag:e,instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`}),F(this,`_shouldCleanupPathOptionsFromRouteName`,!0),F(this,`_pageManager`,void 0),F(this,`_currentRouteSpan`,null),F(this,`_currentRouteSpanUrl`,null),F(this,`_currentRouteSpanPath`,void 0),F(this,`_instrumentationType`,`manual`),F(this,`_removeRouteChangedListener`,null),F(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),F(this,`setCurrentRoute`,e=>{this._pageManager.setCurrentRoute(e)}),F(this,`_onRouteChanged`,e=>{if(!this._isEnabled)return;if(this._currentRouteSpan&&this._currentRouteSpanUrl===e.url){e.path&&this._currentRouteSpanPath!==e.path&&this._renameCurrentRouteSpan(e);return}let t=this._currentRouteSpanUrl;this._endRouteSpan(),this._startRouteSpan(e),t!==null&&t!==e.url&&Hn.screenView()}),F(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`);let t=this._resolveRouteName(e);return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[z]:`ux.surface`,[Jr]:e.path?t:void 0,[Yr]:this._pageManager.getCurrentPageId()||void 0}}),this._currentRouteSpanUrl=e.url,this._currentRouteSpanPath=e.path,this._currentRouteSpan.setAttribute(Ur,this._instrumentationType),this._currentRouteSpan}),F(this,`_endRouteSpan`,()=>{if(this._currentRouteSpan){var e;this._diag.debug(`Ending route span for url: ${(e=this._currentRouteSpanUrl)==null?`unknown`:e}`),this._currentRouteSpan.end(),this._currentRouteSpan=null,this._currentRouteSpanUrl=null,this._currentRouteSpanPath=void 0}}),F(this,`_renameCurrentRouteSpan`,e=>{var t,n;let r=this._resolveRouteName(e);this._diag.debug(`Resolved route span path to: ${r}`),(t=this._currentRouteSpan)==null||t.updateName(r),(n=this._currentRouteSpan)==null||n.setAttribute(`app.surface.name`,r),this._currentRouteSpanPath=e.path}),F(this,`_resolveRouteName`,e=>{var t;let n=(t=e.path)==null?e.url:t;return this._shouldCleanupPathOptionsFromRouteName?n.replace(ci,``):n}),F(this,`_onSessionPartEnded`,()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan())}),F(this,`_onSessionPartStarted`,({reason:e})=>{if(e===`web_soft_navigation`)return;let t=this._pageManager.getCurrentRoute();t&&this._onRouteChanged(t)}),this._shouldCleanupPathOptionsFromRouteName=t,this._pageManager=n==null?Yn.getPageManager():n}onEnable(){this._removeRouteChangedListener=this._pageManager.addRouteChangedListener(this._onRouteChanged),this.setSessionPartListeners({end:this._onSessionPartEnded,start:this._onSessionPartStarted});let e=this._pageManager.getCurrentRoute();e&&this._onRouteChanged(e),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}onDisable(){var e;(e=this._removeRouteChangedListener)==null||e.call(this),this._removeRouteChangedListener=null,this._endRouteSpan(),this._diag.debug(`NavigationInstrumentation disabled, stopped listening for navigation events.`)}};let ui,di=(e={})=>(ui||(ui=new li(e)),ui);function fi(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 pi(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 mi(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 hi(e){try{return JSON.stringify(e).length}catch(e){return 64}}function gi(e,t){try{e(t)}catch(e){}}let _i=[`log`,`info`,`warn`,`error`,`debug`],vi=2e3;function yi(e){let t={};for(let n of _i){let r=console[n];t[n]=r,console[n]=(...t)=>{gi(e,{level:n,message:bi(t),type:`console`}),r.apply(console,t)}}return()=>{for(let e of _i){let n=t[e];n&&(console[e]=n)}}}function bi(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>vi?`${t.slice(0,vi)}…`:t}P();function xi(){var e;let t=(e=N.getActiveSpan())==null?void 0:e.spanContext().traceId;return t&&t!==`00000000000000000000000000000000`?t:void 0}let Si=4e3;function Ci(e){let t=t=>{var n,r;gi(e,{errorStack:wi((n=t.error)==null?void 0:n.stack),level:`error`,message:t.message||String((r=t.error)==null?`Error`:r),traceId:xi(),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;gi(e,{errorStack:wi(typeof r==`object`?r==null?void 0:r.stack:void 0),level:`error`,message:i,traceId:xi(),type:`error`})};return window.addEventListener(`error`,t),window.addEventListener(`unhandledrejection`,n),()=>{window.removeEventListener(`error`,t),window.removeEventListener(`unhandledrejection`,n)}}function wi(e){if(e)return e.length>Si?`${e.slice(0,Si)}…`:e}function Ti(e,t){let n=n=>{let r=n.target;r instanceof Element&&gi(e,{targetSelector:Ei(r),targetText:t?void 0:Di(r),type:`click`})},r=t=>{let n=t.target;n instanceof Element&&gi(e,{targetSelector:Ei(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 Ei(e){return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:``}${typeof e.className==`string`&&e.className.trim()?`.${e.className.trim().split(/\s+/)[0]}`:``}`}function Di(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 Oi(e){let t=``,n=()=>{let n=location.href;n!==t&&(t=n,gi(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 ki(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 H(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){ki(a,r,i,o,s,`next`,e)}function s(e){ki(a,r,i,o,s,`throw`,e)}o(void 0)})}}var U=n((()=>{}));U(),R();function Ai(e,t){let n=!0,r=typeof window<`u`?window.fetch.bind(window):void 0,i=r?function(){var e=H(function*(e,t){if(!n)return r(e,t);let i=ji(e),o=Mi(e,t),s=xi(),c=performance.now();try{let n=yield r(e,t);return a(i,o,n.status,c,s),n}catch(e){throw a(i,o,0,c,s,String(e)),e}});return function(t,n){return e.apply(this,arguments)}}():void 0;i&&(window.fetch=i);let a=(n,r,i,a,o,s)=>{t(n)||gi(e,L({net:{durationMs:Math.round(performance.now()-a),method:r,status:i,url:n},traceId:o,type:`network`},s?{attrs:{error:s}}:{}))},o=typeof window<`u`?window.XMLHttpRequest:void 0,s=o==null?void 0:o.prototype.open,c=o==null?void 0:o.prototype.send,l=o&&s?function(e,t,...r){return n&&(this.__mxlMethod=String(e).toUpperCase(),this.__mxlUrl=typeof t==`string`?t:t.href),s.apply(this,[e,t,...r])}:void 0,u=o&&c?function(...e){if(!n)return c.apply(this,e);let t=this,r=performance.now(),i=xi();return this.addEventListener(`loadend`,()=>{var e,n;a((e=t.__mxlUrl)==null?``:e,(n=t.__mxlMethod)==null?`GET`:n,this.status,r,i)}),c.apply(this,e)}:void 0;return o&&l&&u&&(o.prototype.open=l,o.prototype.send=u),()=>{n=!1,i&&window.fetch===i&&(window.fetch=r),o&&s&&l&&o.prototype.open===l&&(o.prototype.open=s),o&&c&&u&&o.prototype.send===u&&(o.prototype.send=c)}}function ji(e){return typeof e==`string`?e:e instanceof URL?e.href:e.url}function Mi(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()}U();function Ni({config:e,sessionId:t,transport:n,onActivity:r,onPageView:i,flushIntervalMs:a=5e3,flushBytes:o=65536}){let s=[],c=0,l=0,u=!1,d=e=>{e.type===`navigation`&&e.url&&(i==null||i(e.url)),!u&&(s.push({ev:e,seq:l++}),c+=hi(e),c>=o&&f())},f=function(){var i=H(function*(i=!1){if(s.length===0||u)return;r==null||r();let a=s;s=[],c=0;let o=a.map(({ev:n,seq:r})=>Pi(t,n,r,e.redactUrl));yield n.postSessionEvents(o,i)});return function(){return i.apply(this,arguments)}}(),p=[Oi(d),Ti(d,e.maskAllText),yi(d),Ai(d,e=>n.shouldIgnoreUrl(e)),Ci(d)],m=mi(a,()=>{f()});return{flush:f,pause:()=>{u=!0},resume:()=>{u=!1},stop:()=>{m();for(let e of p)e()}}}function Pi(e,t,n,r){var i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;let x=(i=t.net)==null?void 0:i.url,S=(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:x?r(x):``,seq:n,session_id:e,target_selector:(g=t.targetSelector)==null?``:g,target_text:(_=t.targetText)==null?``:_,timestamp:fi(new Date((v=t.timestamp)==null?Date.now():v)),trace_id:(y=(b=t.traceId)==null?xi():b)==null?``:y,type:t.type,url:S?r(S):``}}U();function Fi(e){return Ii.apply(this,arguments)}function Ii(){return Ii=H(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}),Ii.apply(this,arguments)}U(),R();let Li=4*1024*1024,Ri=0;function zi(e,t){let n=Date.now();n-Ri<3e4||(Ri=n,console.warn(`[mxl] session replay ${e}`,...t?[t]:[]))}function Bi({config:e,sessionId:t,transport:n,chunkSeqStore:r,rrwebModule:i,onActivity:a,onClick:o,flushIntervalMs:s=5e3,flushBytes:c=102400}){let l=[],u=0,d=!1,f=0,p=0,m=!1,h=!1,g=!1,_=Promise.resolve(),v=()=>{l=[],u=0,d=!1,f=0,p=0},y=()=>void 0,b=function(){var e=H(function*(e,r,i){let a;try{a=yield Fi(new TextEncoder().encode(e))}catch(e){zi(`chunk compression failed (dropping chunk)`,e);return}(yield n.postSessionBlob(r,a,i))===`exhausted`&&!h&&(h=!0,zi(`replay ${t} reached its maximum recorded size; recording stopped for this session`),y())});return function(t,n,r){return e.apply(this,arguments)}}(),x=(e=!1)=>{if(h||l.length===0)return _;a==null||a();let n=`[${l.join(`,`)}]`,i={chunkSeq:r.nextChunkSeq(t),durationMs:Math.max(0,p-f),eventCount:l.length,isCheckpoint:d,sessionId:t};v();let o=_.then(()=>b(n,i,e));return _=o.catch(()=>void 0),o},{record:S}=i,ee=S(L(L({checkoutEveryNms:3e5,emit:(t,n)=>{var r,i;if(g||h)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 s=n===!0||a.type===2;if(a.type===3&&((i=a.data)==null?void 0:i.source)===2&&a.data.type===2&&(o==null||o()),m&&!s)return;let _;try{_=JSON.stringify(a)}catch(e){return}if(u+_.length>Li){zi(`buffer exceeded ${Li} bytes (dropping ${u+_.length} bytes until the next full snapshot)`),v(),m=!0;return}m=!1,s&&(d=!0),l.length===0&&(f=a.timestamp),p=a.timestamp,l.push(_),u+=_.length,u>=c&&x()},maskAllInputs:e.maskAllInputs},e.maskAllText?{maskTextSelector:`*`}:{}),e.rrwebOptions)),te=mi(s,()=>{x()}),ne=!1;return y=()=>{ne||(ne=!0,te(),v(),ee==null||ee())},{flush:x,pause:()=>{g=!0},resume:()=>{g=!1},stop:y}}U();let Vi=`https://unpkg.com/rrweb@2.2.2/dist/rrweb.umd.cjs`,Hi,Ui,Wi=Vi;function Gi(e){Wi=e,Hi=void 0}function Ki(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 qi(){return Ji.apply(this,arguments)}function Ji(){return Ji=H(function*(){if(typeof window>`u`)throw Error(`no browser`);if(window.rrweb)return window.rrweb;if(yield Ki(Wi),!window.rrweb)throw Error(`no rrweb`);return window.rrweb}),Ji.apply(this,arguments)}function Yi(){return Ui?Ui():(Hi===void 0&&(Hi=qi()),Hi)}function Xi(){Hi=void 0,Ui=void 0,Wi=Vi}function Zi(e){Ui=e,Hi=void 0}let Qi=new Set;function $i(e){!e||e===`00000000000000000000000000000000`||Qi.add(e)}function ea(){return Array.from(Qi)}function ta(){Qi.clear()}let na=`__MXL_REPLAY_SESSION__`;function ra(e){globalThis[na]={recordTraceId:$i,sessionId:e}}function ia(){delete globalThis[na]}function aa(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}}}var oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga=n((()=>{oa=`http.method`,sa=`http.url`,ca=`http.status_code`,la=`http.request_content_length`,ua=`http.response_content_length`,da=oa,fa=sa,pa=ca,ma=la,ha=ua})),_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia=n((()=>{_a=`error.type`,va=`exception.message`,ya=`exception.stacktrace`,ba=`exception.type`,xa=`http.request.method`,Sa=`http.request.method_original`,Ca=`http.response.status_code`,wa=`server.address`,Ta=`server.port`,Ea=`service.name`,Da=`service.version`,Oa=`telemetry.sdk.language`,ka=`webjs`,Aa=`telemetry.sdk.name`,ja=`telemetry.sdk.version`,Ma=`url.full`,Na=`url.path`,Pa=`url.query`,Fa=`user_agent.original`})),W=n((()=>{ga(),Ia()}));W();let La=/\/\/(.+):(.+)@(.+)\//,Ra=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],za=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(La,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},Ba=e=>{let t=[...Ra,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:Ma,scrub:e=>za({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:fa,scrub:e=>za({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:Na,scrub:e=>za({queryParamRegex:n,scrubPath:!0,scrubQuery:!1,value:e})},{key:Pa,scrub:e=>za({queryParamRegex:n,scrubPath:!1,scrubQuery:!0,value:e})}]},Va=e=>{let t=e.filter(({key:e})=>e===Ma);return e=>t.reduce((e,{scrub:t})=>t(e),e)};function Ha(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 Ua(e,t){if(e==null)return{};var n,r,i=Ha(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 Wa=[`debug`,`sampleRate`,`maskAllInputs`,`maskAllText`,`flushIntervalMs`,`omitRedundantInstrumentations`];function Ga(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=Ua(r,Wa);return{appId:e.appId,appVersion:e.appVersion,debug:i,environment:void 0,flushIntervalMs:c,maskAllInputs:o,maskAllText:s,redactUrl:(n=e.redactUrl)==null?Va(Ba()):n,replaySampleRate:a==null?1:a,rrwebOptions:u,serviceName:e.serviceName,userID:e.userID}}R();function Ka(e){var t;let n=(t=e.visibilityDoc)==null?document:t,r=!1,i=setInterval(()=>{n.visibilityState===`visible`&&e.transport.postSessionMeta(qa(e.config,e.sessionId,e.startedAt,e.nextMetaVersion(),`active`,e.replayCounts()))},6e4),a=()=>{var t;r||(r=!0,clearInterval(i),e.recorder.flush(!0),e.events.flush(!0),e.transport.postSessionMeta(qa(e.config,e.sessionId,e.startedAt,e.nextMetaVersion(),`ended`,e.replayCounts()),!0),e.recorder.stop(),e.events.stop(),ta(),(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 qa(e,t,n,r,i,a){var o;let s=pi(navigator.userAgent),c=new Date,l={browser_name:s.browserName,click_count:a.clicks,device_type:s.deviceType,error_count:a.errors,os_name:s.osName,page_views:a.pageViews,resource_attributes:L(L({},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:fi(n),status:i,url_initial:e.redactUrl(window.location.href),user_agent:navigator.userAgent,user_id:Ya(),version:r};return i===`ended`&&(l.duration_ms=Math.max(0,c.getTime()-n.getTime()),l.end_time=fi(c),l.trace_ids=ea()),l}function Ja(e){let t=e.getUserSessionStartTime();return new Date(t==null?Date.now():t)}function Ya(){var e;return(e=Br.getUserId())==null?``:e}I(),U();var Xa=class{constructor({context:e,userSessionManager:t,sessionStorage:n,rrwebOptions:r,autoStart:i=!0,diag:a,visibilityDoc:o}){F(this,`_context`,void 0),F(this,`_userSessionManager`,void 0),F(this,`_chunkSeqStore`,void 0),F(this,`_config`,void 0),F(this,`_diag`,void 0),F(this,`_autoStart`,void 0),F(this,`_visibilityDoc`,void 0),F(this,`_active`,void 0),F(this,`_paused`,!1),F(this,`_enableRequested`,!1),F(this,`_startInProgress`,!1),F(this,`_stopInProgress`,!1),F(this,`_removeSessionStartedListener`,void 0),F(this,`_removeResumeListener`,void 0),F(this,`_lastPageView`,void 0),this._context=e,this._userSessionManager=t,this._visibilityDoc=o,this._chunkSeqStore=aa(n),this._autoStart=i,this._config=Ga(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 H(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){ia(),ta();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{ia(),ta(),e._stopInProgress=!1}})()}_tryStart(){var e=this;return H(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 Yi();if(!e._enableRequested||e._active)return;ra(t),ta();let r=Ja(e._userSessionManager),i=()=>{},a=Bi({chunkSeqStore:e._chunkSeqStore,config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,onClick:()=>{e._userSessionManager.incrReplayCount(`clicks`)},rrwebModule:n,sessionId:t,transport:e._context.transport}),o=Ni({config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,onPageView:n=>{let r=e._lastPageView;(r==null?void 0:r.sessionId)===t&&r.url===n||(e._lastPageView={sessionId:t,url:n},e._userSessionManager.incrReplayCount(`pageViews`))},sessionId:t,transport:e._context.transport}),s=()=>e._userSessionManager.nextReplayMetaVersion();e._context.transport.postReplay(),e._context.transport.postSessionMeta(qa(e._config,t,r,s(),`active`,e._userSessionManager.getReplayCounts())),e._active={events:o,recorder:a,removeLifecycle:globalThis.__MXL_TEST_SKIP_REPLAY_LIFECYCLE__===!0?()=>void 0:Ka({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,ia(),ta(),e._resumeWhenVisible()},recorder:a,replayCounts:()=>e._userSessionManager.getReplayCounts(),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)}}};I(),U();var Za=class extends V{constructor(e={}){super({config:{},diag:e.diag,instrumentationName:`ReplayInstrumentation`,instrumentationVersion:`2.0.0`,perf:e.perf}),F(this,`_args`,void 0),F(this,`_sessionRecording`,void 0),F(this,`_wasPaused`,!1),F(this,`_stopPromise`,void 0),this._args=e,(!e.replayContext||!e.sessionStorage)&&this._diag.warn(`replayContext and sessionStorage are required for session recording`)}setUserSessionManager(e){super.setUserSessionManager(e),this._ensureSessionRecording()}_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 Xa({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 H(function*(){yield e._stopPromise})()}};function Qa(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 $a(e){e.forEach(e=>e.disable())}var eo=n((()=>{}));function to(e){var t,n;let r=e.tracerProvider||N.getTracerProvider(),i=e.meterProvider||en.getMeterProvider(),a=e.loggerProvider||Kt.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return Qa(o,r,i,a),()=>{$a(o)}}var no=n((()=>{eo(),P()}));function ro(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 io=n((()=>{}));function ao(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 oo(e){e&&e.logger&&(typeof e.logger==`function`?G=e.logger:G(`new logger isn't a function, not replacing`))}var G,so,co,lo,uo,fo=n((()=>{G=console.error.bind(console),so=(e,t,n)=>{if(!e||!e[t]){G(`no original function `+String(t)+` to wrap`);return}if(!n){G(`no wrapper function`),G(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){G(`original object and wrapper must be functions`);return}let i=n(r,t);return ao(i,`__original`,r),ao(i,`__unwrap`,()=>{e[t]===i&&ao(e,t,r)}),ao(i,`__wrapped`,!0),ao(e,t,i),i},co=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{G(`must provide one or more modules to patch`),G(Error().stack);return}if(!(t&&Array.isArray(t))){G(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{so(e,t,n)})})},lo=(e,t)=>{if(!e||!e[t]){G(`no function to unwrap.`),G(Error().stack);return}let n=e[t];if(!n.__unwrap)G(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},uo=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{G(`must provide one or more modules to patch`),G(Error().stack);return}if(!(t&&Array.isArray(t))){G(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{lo(e,t)})})},oo.wrap=so,oo.massWrap=co,oo.unwrap=lo,oo.massUnwrap=uo})),po,mo=n((()=>{fo(),P(),I(),R(),po=class{constructor(e,t,n){F(this,`_config`,{}),F(this,`_tracer`,void 0),F(this,`_meter`,void 0),F(this,`_logger`,void 0),F(this,`_diag`,void 0),F(this,`instrumentationName`,void 0),F(this,`instrumentationVersion`,void 0),F(this,`_wrap`,so),F(this,`_unwrap`,lo),F(this,`_massWrap`,co),F(this,`_massUnwrap`,uo),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=M.createComponentLogger({namespace:e}),this._tracer=N.getTracer(e,t),this._meter=en.getMeter(e,t),this._logger=Kt.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=L({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)}}}})),ho,go=n((()=>{mo(),I(),ho=class extends po{constructor(e,t,n){super(e,t,n),F(this,`_enabled`,!1),this._config.enabled&&this.enable()}isEnabled(){return this._enabled}}})),_o=n((()=>{go()})),vo=n((()=>{no(),io(),_o()})),yo,bo=n((()=>{yo=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function xo(e){return e.setValue(Co,!0)}function So(e){return e.getValue(Co)===!0}var Co,wo=n((()=>{P(),Co=ce(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function To(e){return Eo(e,Ao)}function Eo(e,t){if(e.value===void 0)return 0;if(e.key.length===0)return M.warn(`Invalid attribute key: ${e.key}`),1;let n=!Object.hasOwn(e.attributes,e.key);if(n&&e.currentAttributesCount>=e.limits.attributeCountLimit)return 2;if(!t(e.value))return M.warn(`Invalid attribute value set for key: ${e.key}`),1;let r=e.limits.attributeValueLengthLimit;return r<=0&&(M.warn(`Invalid attributeValueLengthLimit: must be positive, got ${r} (ignoring)`),r=1/0),e.attributes[e.key]=No(e.value,r),n?3:4}function Do(e,t){return ko(e,t,Ao)}function Oo(e,t){return ko(e,t,Po)}function ko(e,t,n){if(typeof e!=`object`||!e)return{};let r={},i=0,a=t.attributeValueLengthLimit;a<=0&&(M.warn(`Invalid attributeValueLengthLimit: must be positive, got ${a} (ignoring)`),a=1/0);let o=0;for(let[s,c]of Object.entries(e))if(c!==void 0){if(o>=t.attributeCountLimit){i++;continue}if(s.length===0){M.warn(`Invalid attribute key: ${s}`),i++;continue}if(!n(c)){M.warn(`Invalid attribute value set for key: ${s}`),i++;continue}r[s]=No(c,a),o++}return{attributes:r,droppedAttributesCount:i}}function Ao(e){return jo(e,new WeakSet)}function jo(e,t){switch(typeof e){case`undefined`:case`bigint`:case`symbol`:case`function`:return!1;case`string`:case`number`:case`boolean`:return!0;case`object`:break;default:return!1}if(e===null||e instanceof Uint8Array)return!0;if(t.has(e))return!1;t.add(e);let n=Mo(e,t);return t.delete(e),n}function Mo(e,t){if(Array.isArray(e)){for(let n of e)if(n!==void 0&&!jo(n,t))return!1;return!0}let n=e;if(n.constructor!==Object&&n.constructor!==void 0)return!1;for(let e of Object.keys(n)){let r=n[e];if(r!==void 0&&!jo(r,t))return!1}return!0}function No(e,t){switch(typeof e){case`number`:case`boolean`:case`undefined`:case`bigint`:case`symbol`:case`function`:return e;case`string`:return e.length<=t?e:e.substring(0,t);case`object`:break;default:return e}if(e===null)return e;if(e instanceof Uint8Array)return e.length<=t?e:e.slice(0,t);if(Array.isArray(e))return e.map(e=>No(e,t));let n={},r=e;for(let e of Object.keys(r))r[e]!==void 0&&(n[e]=No(r[e],t));return n}function Po(e){return Array.isArray(e)?Fo(e):Io(typeof e)}function Fo(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Io(e)){t=e;continue}return!1}return!1}}return!0}function Io(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var Lo,Ro=n((()=>{P(),Lo=function(e){return e[e.DROP_UNDEFINED=0]=`DROP_UNDEFINED`,e[e.DROP_INVALID=1]=`DROP_INVALID`,e[e.DROP_LIMIT_REACHED=2]=`DROP_LIMIT_REACHED`,e[e.ADD_NEW=3]=`ADD_NEW`,e[e.ADD_OVERWRITE_EXISTING=4]=`ADD_OVERWRITE_EXISTING`,e}({})}));function zo(){return e=>{M.error(Bo(e))}}function Bo(e){return typeof e==`string`?e:JSON.stringify(Vo(e))}function Vo(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 Ho=n((()=>{P()}));function Uo(e){try{Wo(e)}catch(e){}}var Wo,Go=n((()=>{Ho(),Wo=zo()}));function K(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*rs)]}function Ko(e){return ts(K(performance.timeOrigin),K(typeof e==`number`?e:performance.now()))}function qo(e){if($o(e))return e;if(typeof e==`number`)return e<performance.timeOrigin/2?Ko(e):K(e);if(e instanceof Date)return K(e.getTime());throw TypeError(`Invalid input type`)}function Jo(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=is),[n,r]}function Yo(e){return e[0]*is+e[1]}function Xo(e){return e[0]*1e6+e[1]/1e3}function Zo(e){return e[0]*1e3+e[1]/1e6}function Qo(e){return e[0]+e[1]/is}function $o(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function es(e){return $o(e)||typeof e==`number`||e instanceof Date}function ts(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=is&&(n[1]-=is,n[0]+=1),n}var ns,rs,is,as=n((()=>{ns=9,rs=Math.pow(10,6),is=Math.pow(10,ns)})),q,os=n((()=>{q=function(e){return e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`,e}({})}));function ss(e){return us.test(e)}function cs(e){return ds.test(e)&&!fs.test(e)}var ls,us,ds,fs,ps=n((()=>{ls=`[_0-9a-z-*/]`,us=RegExp(`^(?:${`[a-z]${ls}{0,255}`}|${`[a-z0-9]${ls}{0,240}@[a-z]${ls}{0,13}`})$`),ds=/^[ -~]{0,255}[!-~]$/,fs=/,|=/})),ms,hs,gs,_s,vs,ys=n((()=>{ps(),I(),ms=32,hs=512,gs=`,`,_s=`=`,vs=class e{constructor(e){F(this,`_length`,void 0),F(this,`_rawTraceState`,void 0),F(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!ss(e)||!cs(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`)i+=t.length-r.length;else{if(n.size>=ms)return this;i+=e.length+t.length+(n.size>0?2:1)}if(i>hs)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=gs+e),e=`${n[0]}${_s}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(gs),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(_s);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!ss(a)||!cs(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>hs)&&(t.set(a,o),n=s,t.size>=ms))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 bs(e){let t=ws.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var xs,Ss,Cs,ws,Ts,Es=n((()=>{wo(),ys(),P(),xs=`traceparent`,Ss=`tracestate`,Cs=`00`,ws=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),Ts=class{inject(e,t,n){let r=N.getSpanContext(e);if(!r||So(e)||!Ze(r))return;let i=`${Cs}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||A.NONE).toString(16)}`;n.set(t,xs,i),r.traceState&&n.set(t,Ss,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,xs);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=bs(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Ss);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new vs(typeof e==`string`?e:void 0)}return N.setSpanContext(e,a)}fields(){return[xs,Ss]}}}));function Ds(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Os(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Os,ks=n((()=>{Os=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}));function As(e,t){return typeof t==`string`?e===t:!!e.match(t)}function js(e,t){if(!t)return!1;for(let n of t)if(As(e,n))return!0;return!1}var Ms=n((()=>{})),Ns,Ps=n((()=>{I(),Ns=class{constructor(){F(this,`_promise`,void 0),F(this,`_resolve`,void 0),F(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)}}})),Fs,Is=n((()=>{Ps(),I(),Fs=class{constructor(e,t){F(this,`_isCalled`,!1),F(this,`_deferred`,new Ns),F(this,`_callback`,void 0),F(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 Ls(e,t){return new Promise(n=>{j.with(xo(j.active()),()=>{e.export(t,n)})})}var Rs=n((()=>{wo(),P()})),zs=n((()=>{})),Bs,Vs=n((()=>{Bs=`3.1.1`})),Hs,Us=n((()=>{Hs=`process.runtime.name`})),Ws,Gs=n((()=>{Vs(),Us(),W(),Ws={[Aa]:`opentelemetry`,[Hs]:`browser`,[Oa]:ka,[ja]:Bs}})),Ks=n((()=>{zs(),Gs()})),qs,J=n((()=>{wo(),Ro(),Go(),as(),os(),Es(),ks(),Ms(),Is(),Rs(),Ks(),qs={_export:Ls}}));function Js(){return`unknown_service`}var Ys=n((()=>{})),Xs=n((()=>{Ys()}));function Zs(e,t){return rc.FromAttributeList(Object.entries(e),t)}function Qs(){return Zs({})}function $s(){return Zs({[Ea]:Js(),[Oa]:Ws[Oa],[Aa]:Ws[Aa],[ja]:Ws[ja]})}function ec(e){return e.map(([e,t])=>yo(t)?[e,t.then(e=>e,t=>{M.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function tc(e){if(typeof e==`string`||e===void 0)return e;M.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function nc(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;M.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var rc,ic=n((()=>{bo(),P(),J(),W(),Xs(),I(),U(),rc=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=ec(t),r._asyncAttributesPending=t.filter(([e,t])=>yo(t)).length>0,r}constructor(e,t){var n;F(this,`_rawAttributes`,void 0),F(this,`_asyncAttributesPending`,!1),F(this,`_schemaUrl`,void 0),F(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(yo(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ec(this._rawAttributes),this._schemaUrl=tc(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return H(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,yo(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&M.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(yo(n)){M.debug(`Unsettled resource attribute ${t} skipped`);continue}Object.hasOwn(e,t)||(t.length===0?M.warn(`dropping invalid resource attribute key: <empty string>`):Po(n)?e[t]=n:M.warn(`dropping invalid resource attribute value for key "${t}"`))}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=nc(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),ac=n((()=>{ic()}));P(),J(),W(),I();var oc=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){F(this,`resource`,void 0),F(this,`instrumentationScope`,void 0),F(this,`attributes`,{}),F(this,`_hrTime`,void 0),F(this,`_hrTimeObserved`,void 0),F(this,`_spanContext`,void 0),F(this,`_severityText`,void 0),F(this,`_severityNumber`,void 0),F(this,`_body`,void 0),F(this,`_eventName`,void 0),F(this,`_attributesCount`,0),F(this,`_droppedAttributesCount`,0),F(this,`_isReadonly`,!1),F(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=qo(r==null?f:r),this._hrTimeObserved=qo(i==null?f:i),d){let e=N.getSpanContext(d);e&&Ze(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=To({key:e,value:t,attributes:this.attributes,limits:this._logRecordLimits,currentAttributesCount:this._attributesCount});return n===Lo.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&M.warn(`Dropping extra attributes.`)):n===Lo.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(va,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ba,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ba,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(va,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ya,n.stack),t=!0)}t||M.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&M.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};P(),I(),R();var sc=class{constructor(e,t){F(this,`_instrumentationScope`,void 0),F(this,`_sharedState`,void 0),F(this,`_loggerConfig`,void 0),this._instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let t=e.context||j.active();if(!this.enabled(e))return;let n=new oc(this._sharedState,this._instrumentationScope,L({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.enabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==k.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||j.active();if(t.traceBased){let e=N.getSpanContext(r);if(e&&Ze(e)&&(e.traceFlags&A.SAMPLED)!==A.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}};function cc(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(cc)]:[`map`,Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,cc(t)])]}function lc(e){var t,n;return JSON.stringify([e.name,e.version||``,e.schemaUrl||``,cc((t=e.attributes)==null?{}:t),(n=e.droppedAttributesCount)==null?0:n])}var uc=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};J(),I(),U();var dc=class{constructor(e){F(this,`processors`,void 0),this.processors=e}forceFlush(e){var t=this;return H(function*(){var n;let r=(n=e==null?void 0:e.timeoutMillis)==null?3e4:n;yield Promise.all(t.processors.map(e=>Ds(e.forceFlush(),r)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return H(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}};let fc=`error.type`;I();var pc=class{constructor(e){F(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)}};P(),R(),I();let mc={enabled:!0,minimumSeverity:k.UNSPECIFIED,traceBased:!1},hc=()=>L({},mc);var gc=class{constructor(e,t,n,r,i){F(this,`loggers`,new Map),F(this,`activeProcessor`,void 0),F(this,`registeredLogRecordProcessors`,[]),F(this,`resource`,void 0),F(this,`logRecordLimits`,void 0),F(this,`processors`,void 0),F(this,`loggerMetrics`,void 0),F(this,`hasShutdown`,!1),F(this,`_loggerConfigurator`,void 0),F(this,`_loggerConfigs`,new Map),this.resource=e,this.logRecordLimits=t,this.processors=n,n.length>0?(this.registeredLogRecordProcessors=n,this.activeProcessor=new dc(this.registeredLogRecordProcessors)):this.activeProcessor=new uc,this._loggerConfigurator=r==null?hc:r;let a=i?i.getMeter(`@opentelemetry/sdk-logs`,`3.1.1`):D();this.loggerMetrics=new pc(a)}getLoggerConfig(e){let t=lc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};P(),ac(),J(),I(),R();var _c=class{constructor(e={}){var t,n,r,i,a,o,s;F(this,`_shutdownOnce`,void 0),F(this,`_sharedState`,void 0);let c={resource:(t=e.resource)==null?$s():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?hc:o,processors:(s=e.processors)==null?[]:s,meterProvider:e.meterProvider};this._sharedState=new gc(c.resource,c.logRecordLimits,c.processors,c.loggerConfigurator,c.meterProvider),this._shutdownOnce=new Fs(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return M.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ne();e||M.warn(`Logger requested without instrumentation scope name.`);let r=L({name:e||`unknown`,version:t,schemaUrl:n==null?void 0:n.schemaUrl},Oo(n==null?void 0:n.attributes,this._sharedState.logRecordLimits)),i=lc(r);return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new sc(r,this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(e){return this._shutdownOnce.isCalled?(M.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush(e)}shutdown(){return this._shutdownOnce.isCalled?(M.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()}};I(),R();let vc=new Map;var yc=class{constructor(e,t,n){var r;F(this,`processedLogs`,void 0),F(this,`queueSize`,void 0),F(this,`queueSizeCallback`,void 0),F(this,`standardAttrs`,void 0),F(this,`droppedAttrs`,void 0);let i=(r=vc.get(e))==null?0:r;if(vc.set(e,i+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${i}`},this.droppedAttrs=L(L({},this.standardAttrs),{},{[fc]:`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=L(L({},this.standardAttrs),{},{[fc]:t.name});this.processedLogs.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};P(),J(),U(),I();function bc(e){return xc.apply(this,arguments)}function xc(){return xc=H(function*(e){let t=null;for(let n=0,r=e.length;n<r;n++){let r=e[n].resource;r.asyncAttributesPending&&r.waitForAsyncAttributes&&(t!=null||(t=new Set),t.add(r))}t!==null&&(yield Promise.all(Array.from(t,e=>{var t;return(t=e.waitForAsyncAttributes)==null?void 0:t.call(e)})))}),xc.apply(this,arguments)}var Sc=class{constructor(e,t,n,r){F(this,`_exportCompleted`,void 0),F(this,`_exportScheduledPromise`,void 0),F(this,`_metrics`,void 0),F(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 H(function*(){try{yield bc(t),yield j.with(xo(j.active()),H(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){Uo(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return H(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{var n;r._metrics.finishLogs(t.length,e.error),clearTimeout(o),e.code===q.SUCCESS?i():a((n=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):n)}),r._exportScheduledResolve()})})()}},Cc=class{constructor(e){var t,n,r,i;F(this,`_maxExportBatchSize`,void 0),F(this,`_maxQueueSize`,void 0),F(this,`_scheduledDelayMillis`,void 0),F(this,`_exportTimeoutMillis`,void 0),F(this,`_exporter`,void 0),F(this,`_metrics`,void 0),F(this,`_currentExport`,null),F(this,`_finishedLogRecords`,[]),F(this,`_timer`,void 0),F(this,`_shutdownOnce`,void 0),F(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 Fs(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(M.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 yc(`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 H(function*(){e.onShutdown(),yield e._flushAll(),e._metrics.shutdown(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return H(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 Sc(e._exporter,n,e._exportTimeoutMillis,e._metrics);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){Uo(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 Sc(this._exporter,e,this._exportTimeoutMillis,this._metrics);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,Uo(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),wc(this._timer))}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};function wc(e){var t;let n=e;typeof n!=`number`&&((t=n.unref)==null||t.call(n))}J(),I();var Tc=class extends Cc{constructor(e){super(e),F(this,`_visibilityChangeListener`,void 0),this._onInit(e)}onShutdown(){typeof document>`u`||this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener)}_onInit(e){e.disableAutoFlushOnDocumentHide===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{Uo(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener))}};P(),I();var Ec=class{constructor(){F(this,`_enabled`,!1),F(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}}},Dc=class{shouldSample(){return{decision:0}}toString(){return`AlwaysOffSampler`}},Oc=class{shouldSample(){return{decision:2}}toString(){return`AlwaysOnSampler`}};P(),J(),I();var kc=class{constructor(e){var t,n,r,i;F(this,`_root`,void 0),F(this,`_remoteParentSampled`,void 0),F(this,`_remoteParentNotSampled`,void 0),F(this,`_localParentSampled`,void 0),F(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Uo(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Oc),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Oc:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new Dc:n,this._localParentSampled=(r=e.localParentSampled)==null?new Oc:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new Dc:i}shouldSample(e,t,n,r,i,a){let o=N.getSpanContext(e);return!o||!Ze(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&A.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&A.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();let Ac=Symbol.for(`nodejs.util.inspect.custom`);function jc(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 Mc(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,L(L({},r),{},{depth:r.depth==null?r.depth:r.depth-1}))}`}P(),J(),W(),I(),R();var Nc=class{constructor(e){var t,n,r;F(this,`_spanContext`,void 0),F(this,`kind`,void 0),F(this,`parentSpanContext`,void 0),F(this,`attributes`,void 0),F(this,`links`,[]),F(this,`events`,[]),F(this,`startTime`,void 0),F(this,`resource`,void 0),F(this,`instrumentationScope`,void 0),F(this,`_droppedAttributesCount`,0),F(this,`_droppedEventsCount`,0),F(this,`_droppedLinksCount`,0),F(this,`_attributesCount`,0),F(this,`name`,void 0),F(this,`status`,{code:Tt.UNSET}),F(this,`endTime`,[0,0]),F(this,`_ended`,!1),F(this,`_duration`,[-1,-1]),F(this,`_spanProcessor`,void 0),F(this,`_spanLimits`,void 0),F(this,`_recordEndMetrics`,void 0),F(this,`_performanceStartTime`,void 0),F(this,`_performanceOffset`,void 0),F(this,`_startTimeProvided`,void 0);let i=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=performance.now(),this._performanceOffset=i-(this._performanceStartTime+performance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,this.startTime=this._getTime((t=e.startTime)==null?i:t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.links){let{linkCountLimit:t}=this._spanLimits;e.links.length>t?(this.links=e.links.slice(e.links.length-t,e.links.length),this._droppedLinksCount=e.links.length-t):(this.links=e.links,this._droppedLinksCount=0)}this.attributes=(n=e.attributes)==null?{}:n,this._attributesCount=Object.keys(this.attributes).length,this._droppedAttributesCount=(r=e.droppedAttributesCount)==null?0:r,this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(this._isSpanEnded())return this;let n=To({key:e,value:t,attributes:this.attributes,limits:this._spanLimits,currentAttributesCount:this._attributesCount});return n===Lo.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&M.warn(`Dropping extra attributes.`)):n===Lo.ADD_NEW&&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;return r===0?(M.warn(`No events allowed.`),this._droppedEventsCount++,this):(r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&M.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),es(t)&&(es(n)||(n=t),t=void 0),this.events.push(L({name:e,time:this._getTime(n)},Oo(t,{attributeCountLimit:this._spanLimits.attributePerEventCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit}))),this)}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;return t===0?(this._droppedLinksCount++,this):(t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&M.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++),this.links.push(L({context:e.context},Do(e.attributes,{attributeCountLimit:this._spanLimits.attributePerLinkCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit}))),this)}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Tt.UNSET||this.status.code===Tt.OK)return this;let t={code:e.code};return e.code===Tt.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&M.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()){M.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=Jo(this.startTime,this.endTime),this._duration[0]<0&&(M.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&&M.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&M.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<=performance.now())return Ko(e+this._performanceOffset);if(typeof e==`number`)return K(e);if(e instanceof Date)return K(e.getTime());if($o(e))return e;if(this._startTimeProvided)return K(Date.now());let t=performance.now()-this._performanceStartTime;return ts(this.startTime,K(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[va]=e:e&&(e.code?n[ba]=e.code.toString():e.name&&(n[ba]=e.name),e.message&&(n[va]=e.message),e.stack&&(n[ya]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(`exception`,n,t):M.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}}`);M.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}[Ac](e,t,n){return Mc(`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:jc(this.resource)}},e,t,n)}};let Pc=`otel.span.sampling_result`;I();var Fc=class{constructor(e){F(this,`startedSpans`,void 0),F(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=Lc(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":Ic(e),[Pc]:n}),t===0)return()=>{};let r={[Pc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Ic(e){return e?e.isRemote?`remote`:`local`:`none`}function Lc(e){switch(e){case 2:return`RECORD_AND_SAMPLE`;case 1:return`RECORD_ONLY`;case 0:return`DROP`}}P(),J(),I(),R();let Rc={attributeCountLimit:1/0,attributeValueLengthLimit:1/0};var zc=class{constructor(e,t){F(this,`_sampler`,void 0),F(this,`_spanLimits`,void 0),F(this,`_idGenerator`,void 0),F(this,`instrumentationScope`,void 0),F(this,`_resource`,void 0),F(this,`_spanProcessor`,void 0),F(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`,`3.1.1`);this._tracerMetrics=new Fc(n)}startSpan(e,t={},n=j.active()){var r,i,a,o,s,c;t.root&&(n=N.deleteSpan(n));let l=N.getSpan(n);if(So(n))return M.debug(`Instrumentation suppressed, returning Noop Span`),N.wrapSpanContext(We);let u=l==null?void 0:l.spanContext(),d=this._idGenerator.generateSpanId(),f,p,m;!u||!N.isSpanContextValid(u)?p=this._idGenerator.generateTraceId():(p=u.traceId,m=u.traceState,f=u);let h=(r=t.kind)==null?Ct.INTERNAL:r,g=((i=t.links)==null?[]:i).map(e=>L({context:e.context},Do(e.attributes,{attributeCountLimit:this._spanLimits.attributePerLinkCountLimit,attributeValueLengthLimit:this._spanLimits.attributeValueLengthLimit}))),_=Do(t.attributes,Rc),v=(a=_.attributes)==null?{}:a,y=this._sampler.shouldSample(n,p,e,h,v,g),b=this._tracerMetrics.startSpan(u,y.decision);m=(o=y.traceState)==null?m:o;let x=y.decision===Mt.RECORD_AND_SAMPLED?A.SAMPLED:A.NONE,S={traceId:p,spanId:d,traceFlags:x,traceState:m};if(y.decision===Mt.NOT_RECORD)return M.debug(`Recording is off, propagating context in a non-recording span`),N.wrapSpanContext(S);let ee=Do(Object.assign(v,y.attributes),this._spanLimits);return new Nc({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:S,name:e,kind:h,links:g,parentSpanContext:f,attributes:ee.attributes,droppedAttributesCount:((s=_.droppedAttributesCount)==null?0:s)+((c=ee.droppedAttributesCount)==null?0:c),startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:b})}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?j.active():i,l=this.startSpan(e,a,c),u=N.setSpan(c,l);return j.with(u,s,void 0,l)}[Ac](e,t,n){return Mc(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:jc(this._resource)},spanLimits:this._spanLimits},e,t,n)}};J(),I();var Bc=class{constructor(e){F(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=>{Uo(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)})}};W(),I(),R();let Vc=new Map;var Hc=class{constructor(e,t,n){var r;F(this,`processedSpans`,void 0),F(this,`queueSize`,void 0),F(this,`queueSizeCallback`,void 0),F(this,`standardAttrs`,void 0),F(this,`droppedAttrs`,void 0);let i=(r=Vc.get(e))==null?0:r;if(Vc.set(e,i+1),this.standardAttrs={"otel.component.type":e,"otel.component.name":`${e}/${i}`},this.droppedAttrs=L(L({},this.standardAttrs),{},{[_a]:`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=L(L({},this.standardAttrs),{},{[_a]:t.name});this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};P(),J(),I();var Uc=class{constructor(e){var t,n,r,i;F(this,`_maxExportBatchSize`,void 0),F(this,`_maxQueueSize`,void 0),F(this,`_scheduledDelayMillis`,void 0),F(this,`_exportTimeoutMillis`,void 0),F(this,`_exporter`,void 0),F(this,`_metrics`,void 0),F(this,`_isExporting`,!1),F(this,`_finishedSpans`,[]),F(this,`_timer`,void 0),F(this,`_shutdownOnce`,void 0),F(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 Fs(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(M.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 Hc(`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&A.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&&M.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(M.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);j.with(xo(j.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=>{var a;clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===q.SUCCESS?e():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].resource;t.asyncAttributesPending&&t.waitForAsyncAttributes&&(a!=null||(a=new Set),a.add(t))}a===null?i():Promise.all(Array.from(a,e=>{var t;return(t=e.waitForAsyncAttributes)==null?void 0:t.call(e)})).then(i,e=>{Uo(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,Uo(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),Wc(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};function Wc(e){var t;let n=e;typeof n!=`number`&&((t=n.unref)==null||t.call(n))}J(),I();var Gc=class extends Uc{constructor(e){super(e),F(this,`_visibilityChangeListener`,void 0),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{Uo(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener))}onShutdown(){typeof document<`u`&&this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener)}};let Kc=new Uint8Array(16),qc=new Uint8Array(8),Jc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Yc(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+=Jc[e[n]];return t}var Zc=class{generateTraceId(){return Yc(Kc),Xc(Kc)}generateSpanId(){return Yc(qc),Xc(qc)}};P(),ac(),I();var Qc=class{constructor(e={}){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;F(this,`_resource`,void 0),F(this,`_activeSpanProcessor`,void 0),F(this,`_tracerOptions`,void 0),F(this,`_tracers`,new Map),this._resource=(t=e.resource)==null?$s():t;let _=(n=e.spanProcessors)==null?[]:n;this._activeSpanProcessor=new Bc(_),this._tracerOptions={resource:this._resource,sampler:(r=e.sampler)==null?new kc({root:new Oc}):r,spanLimits:{attributeCountLimit:(i=(a=e.spanLimits)==null?void 0:a.attributeCountLimit)==null?128:i,attributeValueLengthLimit:(o=(s=e.spanLimits)==null?void 0:s.attributeValueLengthLimit)==null?1/0:o,eventCountLimit:(c=(l=e.spanLimits)==null?void 0:l.eventCountLimit)==null?128:c,linkCountLimit:(u=(d=e.spanLimits)==null?void 0:d.linkCountLimit)==null?128:u,attributePerEventCountLimit:(f=(p=e.spanLimits)==null?void 0:p.attributePerEventCountLimit)==null?128:f,attributePerLinkCountLimit:(m=(h=e.spanLimits)==null?void 0:h.attributePerLinkCountLimit)==null?128:m},idGenerator:e.idGenerator||new Zc,spanProcessor:this._activeSpanProcessor,meterProvider:(g=e.meterProvider)==null?{getMeter(){return D()}}:g}}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new zc({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?3e4: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=1},n);e.forceFlush().then(()=>{clearTimeout(i),r!==1&&(r=0,t(r))}).catch(e=>{clearTimeout(i),r=2,t(e)})}));return new Promise((e,t)=>{Promise.all(r).then(n=>{let r=n.filter(e=>e!==0);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Ac](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Mc(`TracerProvider`,{resource:{attributes:jc(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)}};vo();let $c={compression:`gzip`,concurrencyLimit:5,keepalive:!0,timeoutMillis:30*1e3},el=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t});var tl,nl=n((()=>{tl={name:`metric_data_point`,countItems:e=>{let t=0;for(let n of e.scopeMetrics)for(let e of n.metrics)t+=e.dataPoints.length;return t}}})),rl,il=n((()=>{rl={name:`span`,countItems:e=>e.length}})),al,ol=n((()=>{al={name:`log`,countItems:e=>e.length}}));function sl(e){let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}var cl=n((()=>{})),ll=n((()=>{cl()})),ul,dl=n((()=>{ul=function(e){return e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e}({})})),Y,fl,pl=n((()=>{Y=function(e){return e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`,e}({}),fl=function(e){return e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`,e}({})}));function ml(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function hl(e){var t,n;return`${e.name}:${(t=e.version)==null?``:t}:${(n=e.schemaUrl)==null?``:n}`}function gl(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new bl(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function _l(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function vl(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function yl(e,t){return e.toLowerCase()===t.toLowerCase()}var bl,xl=n((()=>{bl=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),Sl,Cl=n((()=>{I(),Sl=class{constructor(){F(this,`kind`,0)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}}));function wl(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var Tl,El,Dl=n((()=>{xl(),I(),Tl=class{constructor(e,t,n=!0,r=wl(t)){F(this,`startTime`,void 0),F(this,`_boundaries`,void 0),F(this,`_recordMinMax`,void 0),F(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=vl(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},El=class{constructor(e,t){F(this,`kind`,3),F(this,`_boundaries`,void 0),F(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new Tl(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new Tl(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new Tl(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:0,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===`GAUGE`||e.type===`UP_DOWN_COUNTER`||e.type===`OBSERVABLE_GAUGE`||e.type===`OBSERVABLE_UP_DOWN_COUNTER`;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}}})),Ol,kl,Al=n((()=>{I(),Ol=class e{constructor(e=new kl,t=0,n=0,r=0){F(this,`backing`,void 0),F(this,`indexBase`,void 0),F(this,`indexStart`,void 0),F(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},kl=class e{constructor(e=[0]){F(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}}));function jl(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*Math.pow(2,t)}function Ml(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var Nl=n((()=>{})),Pl,Fl=n((()=>{Pl=class extends Error{}}));function Il(e){return Gl.setFloat64(0,e),{hi:Gl.getUint32(0),lo:Gl.getUint32(4)}}function Ll(e){let{hi:t}=Il(e);return((t&zl)>>20)-Vl}function Rl(e){let{hi:t,lo:n}=Il(e);return(t&Bl)===0&&n===0}var zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl=n((()=>{zl=2146435072,Bl=1048575,Vl=1023,Hl=-1022,Ul=Vl,Wl=Math.pow(2,-1022),Gl=new DataView(new ArrayBuffer(8))})),ql,Jl=n((()=>{Kl(),Nl(),Fl(),I(),ql=class{constructor(e){F(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<Wl?this._minNormalLowerBoundaryIndex():Ll(e)+(Rl(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new Pl(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new Pl(`overflow: ${e} is > maximum lower boundary: ${n}`);return jl(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Hl>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return Ul>>this._shift}}})),Yl,Xl=n((()=>{Kl(),Nl(),Fl(),I(),Yl=class{constructor(e){F(this,`_scale`,void 0),F(this,`_scaleFactor`,void 0),F(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=jl(Math.LOG2E,e),this._inverseFactor=jl(Math.LN2,-e)}mapToIndex(e){if(e<=Wl)return this._minNormalLowerBoundaryIndex()-1;if(Rl(e))return(Ll(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new Pl(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return Wl;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new Pl(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Hl<<this._scale}_maxNormalLowerBoundaryIndex(){return(Ul+1<<this._scale)-1}}}));function Zl(e){if(e>$l||e<Ql)throw new Pl(`expected scale >= ${Ql} && <= ${$l}, got: ${e}`);return eu[e+10]}var Ql,$l,eu,tu=n((()=>{Fl(),Jl(),Xl(),Ql=-10,$l=20,eu=Array.from({length:31},(e,t)=>t>10?new Yl(t-10):new ql(t-10))})),nu,ru,iu,au,ou,su,cu=n((()=>{Al(),Nl(),tu(),P(),I(),nu=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){F(this,`low`,void 0),F(this,`high`,void 0),this.low=e,this.high=t}},ru=20,iu=160,au=2,ou=class e{constructor(e,t=iu,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new Ol,l=new Ol,u=Zl(ru)){F(this,`startTime`,void 0),F(this,`_maxSize`,void 0),F(this,`_recordMinMax`,void 0),F(this,`_sum`,void 0),F(this,`_count`,void 0),F(this,`_zeroCount`,void 0),F(this,`_min`,void 0),F(this,`_max`,void 0),F(this,`_positive`,void 0),F(this,`_negative`,void 0),F(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<au&&(M.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
2
+ changing to the minimum size of: ${au}`),this._maxSize=au)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(Number.isFinite(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=Ml(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=Zl(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=nu.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=nu.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new nu(0,-1);let r=t-n;return new nu(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},su=class{constructor(e,t){F(this,`kind`,4),F(this,`_maxSize`,void 0),F(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new ou(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:1,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===`GAUGE`||e.type===`UP_DOWN_COUNTER`||e.type===`OBSERVABLE_GAUGE`||e.type===`OBSERVABLE_UP_DOWN_COUNTER`;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}}})),lu,uu,du=n((()=>{J(),I(),lu=class{constructor(e,t=0,n=[0,0]){F(this,`startTime`,void 0),F(this,`_current`,void 0),F(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=K(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},uu=class{constructor(){F(this,`kind`,2)}createAccumulation(e){return new lu(e)}merge(e,t){let n=Xo(t.sampleTime)>=Xo(e.sampleTime)?t:e;return new lu(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=Xo(t.sampleTime)>=Xo(e.sampleTime)?t:e;return new lu(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:2,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}}})),fu,pu,mu=n((()=>{I(),fu=class{constructor(e,t,n=0,r=!1){F(this,`startTime`,void 0),F(this,`monotonic`,void 0),F(this,`_current`,void 0),F(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},pu=class{constructor(e){F(this,`kind`,1),F(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new fu(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new fu(t.startTime,this.monotonic,r,t.reset):new fu(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new fu(t.startTime,this.monotonic,r,!0):new fu(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:3,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}}})),hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju=n((()=>{Cl(),Dl(),cu(),du(),mu(),P(),I(),yu=(hu=class e{createAggregator(t){return e.DEFAULT_INSTANCE}},F(hu,`DEFAULT_INSTANCE`,new Sl),hu),bu=(gu=class e{createAggregator(t){switch(t.type){case`COUNTER`:case`OBSERVABLE_COUNTER`:case`HISTOGRAM`:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}},F(gu,`MONOTONIC_INSTANCE`,new pu(!0)),F(gu,`NON_MONOTONIC_INSTANCE`,new pu(!1)),gu),xu=(_u=class e{createAggregator(t){return e.DEFAULT_INSTANCE}},F(_u,`DEFAULT_INSTANCE`,new uu),_u),Su=(vu=class e{createAggregator(t){return e.DEFAULT_INSTANCE}},F(vu,`DEFAULT_INSTANCE`,new El([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0)),vu),Cu=class{constructor(e,t=!0){if(F(this,`_boundaries`,void 0),F(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new El(this._boundaries,this._recordMinMax)}},wu=class{constructor(e=160,t=!0){F(this,`_maxSize`,void 0),F(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new su(this._maxSize,this._recordMinMax)}},Tu=class{_resolve(e){switch(e.type){case`COUNTER`:case`UP_DOWN_COUNTER`:case`OBSERVABLE_COUNTER`:case`OBSERVABLE_UP_DOWN_COUNTER`:return Du;case`GAUGE`:case`OBSERVABLE_GAUGE`:return Ou;case`HISTOGRAM`:return e.advice.explicitBucketBoundaries?new Cu(e.advice.explicitBucketBoundaries):ku}return M.warn(`Unable to recognize instrument type: ${e.type}`),Eu}createAggregator(e){return this._resolve(e).createAggregator(e)}},Eu=new yu,Du=new bu,Ou=new xu,ku=new Su,new wu,Au=new Tu}));function Mu(e){switch(e.type){case 0:return Au;case 1:return Eu;case 2:return Du;case 3:return Ou;case 5:{var t,n;let r=e;return new wu((t=r.options)==null?void 0:t.maxSize,(n=r.options)==null?void 0:n.recordMinMax)}case 4:{var r,i;let t=e;return t.options==null?ku:new Cu((r=t.options)==null?void 0:r.boundaries,(i=t.options)==null?void 0:i.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Nu,Pu=n((()=>{ju(),Nu=function(e){return e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`,e}({})})),Fu,Iu,Lu=n((()=>{Fu=e=>({type:0}),Iu=e=>1})),Ru,zu,Bu,Vu,Hu,Uu=n((()=>{Ru=`otel.component.name`,zu=`otel.component.type`,Bu=`periodic_metric_reader`,Vu=`otel.sdk.metric_reader.collection.duration`,Hu=`error.type`})),Wu,Gu,Ku=n((()=>{Uu(),I(),R(),Wu=new Map,Gu=class{constructor(e,t){var n;F(this,`collectionDuration`,void 0),F(this,`standardAttrs`,void 0);let r=(n=Wu.get(e))==null?0:n;Wu.set(e,r+1),this.standardAttrs={[zu]:e,[Ru]:`${e}/${r}`},this.collectionDuration=t.createHistogram(Vu,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?L(L({},this.standardAttrs),{},{[Hu]:t}):this.standardAttrs;this.collectionDuration.record(e,n)}}})),qu,Ju=n((()=>{qu=`3.1.1`})),Yu,Xu=n((()=>{xl(),Lu(),Ku(),Ju(),P(),J(),I(),U(),Yu=class{constructor(e){var t,n,r,i;F(this,`_shutdown`,!1),F(this,`_metricProducers`,void 0),F(this,`_sdkMetricProducer`,void 0),F(this,`_selfObsMetrics`,void 0),F(this,`_aggregationTemporalitySelector`,void 0),F(this,`_aggregationSelector`,void 0),F(this,`_cardinalitySelector`,void 0),F(this,`_otelComponentType`,void 0),this._aggregationSelector=(t=e==null?void 0:e.aggregationSelector)==null?Fu:t,this._aggregationTemporalitySelector=(n=e==null?void 0:e.aggregationTemporalitySelector)==null?Iu:n,this._metricProducers=(r=e==null?void 0:e.metricProducers)==null?[]:r,this._cardinalitySelector=e==null?void 0:e.cardinalitySelector,this._otelComponentType=(i=e==null?void 0:e.otelComponentType)==null?this.constructor.name:i,this._selfObsMetrics=new Gu(this._otelComponentType,D())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,qu);this._selfObsMetrics=new Gu(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}collect(e){var t=this;return H(function*(){var n;if(t._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(t._shutdown)throw Error(`MetricReader is shutdown`);let r=Ko(),[i,...a]=yield Promise.all([t._sdkMetricProducer.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}),...t._metricProducers.map(t=>t.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}))]),o=Ko(),s=i.errors.concat(a.flatMap(e=>e.errors)),c=Qo(Jo(r,o));return t._selfObsMetrics.recordCollection(c,s.length>0?(n=s[0].name)==null?`collect_error`:n:void 0),{resourceMetrics:{resource:i.resourceMetrics.resource,scopeMetrics:i.resourceMetrics.scopeMetrics.concat(a.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:s}})()}shutdown(e){var t=this;return H(function*(){if(t._shutdown){M.error(`Cannot call shutdown twice.`);return}(e==null?void 0:e.timeoutMillis)==null?yield t.onShutdown():yield gl(t.onShutdown(),e.timeoutMillis),t._shutdown=!0})()}forceFlush(e){var t=this;return H(function*(){if(t._shutdown){M.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if((e==null?void 0:e.timeoutMillis)==null){yield t.onForceFlush();return}yield gl(t.onForceFlush(),e.timeoutMillis)})()}}}));function Zu(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d=L(L({},o),{},{dataPoints:s.slice(c,c+u)});e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}var Qu=n((()=>{R()}));function $u(e){var t;let n=e;typeof n!=`number`&&((t=n.unref)==null||t.call(n))}var ed,td=n((()=>{xl(),Uu(),Xu(),Qu(),P(),J(),I(),R(),U(),ed=class extends Yu{constructor(e){var t,n;let{exporter:r,exportIntervalMillis:i=6e4,metricProducers:a,cardinalityLimits:o,maxExportBatchSize:s}=e,{exportTimeoutMillis:c=3e4}=e;if(super({aggregationSelector:(t=r.selectAggregation)==null?void 0:t.bind(r),aggregationTemporalitySelector:(n=r.selectAggregationTemporality)==null?void 0:n.bind(r),otelComponentType:Bu,metricProducers:a,cardinalitySelector:e=>{let t=L({default:2e3},o);switch(e){case`COUNTER`:var n;return(n=t.counter)==null?t.default:n;case`GAUGE`:var r;return(r=t.gauge)==null?t.default:r;case`HISTOGRAM`:var i;return(i=t.histogram)==null?t.default:i;case`OBSERVABLE_COUNTER`:var a;return(a=t.observableCounter)==null?t.default:a;case`OBSERVABLE_UP_DOWN_COUNTER`:var s;return(s=t.observableUpDownCounter)==null?t.default:s;case`OBSERVABLE_GAUGE`:var c;return(c=t.observableGauge)==null?t.default:c;case`UP_DOWN_COUNTER`:var l;return(l=t.upDownCounter)==null?t.default:l;default:return t.default}}}),F(this,`_interval`,void 0),F(this,`_exporter`,void 0),F(this,`_exportInterval`,void 0),F(this,`_exportTimeout`,void 0),F(this,`_maxExportBatchSize`,void 0),F(this,`_ongoingExportPromise`,null),i<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(c<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(s!==void 0&&(!Number.isInteger(s)||s<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(i<c){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);M.info(`Timeout of ${c} exceeds the interval of ${i}. Clamping timeout to interval duration.`),c=i}this._exportInterval=i,this._exportTimeout=c,this._exporter=r,this._maxExportBatchSize=s}_runOnce(){var e=this;return H(function*(){try{yield e._doRun()}catch(e){Uo(e)}})()}_doRun(){var e=this;return H(function*(){if(e._ongoingExportPromise){M.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}e._ongoingExportPromise=function(){var t=H(function*(){let{resourceMetrics:t,errors:n}=yield e.collect({timeoutMillis:e._exportTimeout});if(n.length>0&&M.error(`PeriodicExportingMetricReader: metrics collection errors`,...n),t.resource.asyncAttributesPending)try{var r,i;yield(r=(i=t.resource).waitForAsyncAttributes)==null?void 0:r.call(i)}catch(e){M.debug(`Error while resolving async portion of resource: `,e),Uo(e)}if(t.scopeMetrics.length===0)return;let a=e._maxExportBatchSize?Zu(t,e._maxExportBatchSize):[t],o=null;for(let t of a)try{let n=yield gl(qs._export(e._exporter,t),e._exportTimeout);n.code!==q.SUCCESS&&(o=Error(`PeriodicExportingMetricReader: metrics export failed (error ${n.error})`))}catch(t){if(t instanceof bl){M.error(`PeriodicExportingMetricReader: metrics export timed out after ${e._exportTimeout}ms`);break}else M.error(`PeriodicExportingMetricReader: metrics export threw error`,t),o=t instanceof Error?t:Error(String(t))}if(o)throw o});return function(){return t.apply(this,arguments)}}()();try{yield e._ongoingExportPromise}finally{e._ongoingExportPromise=null}})()}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),$u(this._interval)}onForceFlush(){var e=this;return H(function*(){yield e._awaitOngoingExport(),e._ongoingExportPromise?yield e._awaitOngoingExport():yield e._runOnce(),yield e._exporter.forceFlush()})()}_awaitOngoingExport(){var e=this;return H(function*(){if(e._ongoingExportPromise){M.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{yield e._ongoingExportPromise}catch(e){}}})()}onShutdown(){var e=this;return H(function*(){e._interval&&clearInterval(e._interval),yield e.onForceFlush(),yield e._exporter.shutdown()})()}}}));function nd(){return od}function rd(e){return new ad(e)}var id,ad,od,sd=n((()=>{I(),id=class{process(e,t){return e}},ad=class{constructor(e){F(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}},od=new id})),cd,ld=n((()=>{I(),cd=class{constructor(){F(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}}}));function ud(e,t,n){var r,i,a,o;return pd(e)||M.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:(r=n==null?void 0:n.description)==null?``:r,unit:(i=n==null?void 0:n.unit)==null?``:i,valueType:(a=n==null?void 0:n.valueType)==null?je.DOUBLE:a,advice:(o=n==null?void 0:n.advice)==null?{}:o}}function dd(e,t){var n,r;return{name:(n=e.name)==null?t.name:n,description:(r=e.description)==null?t.description:r,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function fd(e,t){return yl(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}function pd(e){return md.test(e)}var md,hd=n((()=>{xl(),P(),md=/^[a-z][a-z0-9_.\-/]{0,254}$/i}));function gd(e){return e instanceof Sd}var _d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed=n((()=>{P(),I(),_d=class{constructor(e,t){F(this,`_writableMetricStorage`,void 0),F(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){M.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===je.INT&&!Number.isInteger(e)&&(M.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},vd=class extends _d{add(e,t,n){this._record(e,t,n)}},yd=class extends _d{add(e,t,n){if(e<0){M.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},bd=class extends _d{record(e,t,n){this._record(e,t,n)}},xd=class extends _d{record(e,t,n){if(e<0){M.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},Sd=class{constructor(e,t,n){F(this,`_metricStorages`,void 0),F(this,`_descriptor`,void 0),F(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},Cd=class extends Sd{},wd=class extends Sd{},Td=class extends Sd{}})),Dd,Od=n((()=>{hd(),Ed(),I(),Dd=class{constructor(e){F(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=ud(e,`GAUGE`,t);return new bd(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=ud(e,`HISTOGRAM`,t);return new xd(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=ud(e,`COUNTER`,t);return new yd(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=ud(e,`UP_DOWN_COUNTER`,t);return new vd(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=ud(e,`OBSERVABLE_GAUGE`,t);return new wd(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=ud(e,`OBSERVABLE_COUNTER`,t);return new Cd(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=ud(e,`OBSERVABLE_UP_DOWN_COUNTER`,t);return new Td(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}}})),kd,Ad=n((()=>{hd(),I(),kd=class{constructor(e){F(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=ud(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}})),jd,Md,Nd=n((()=>{xl(),I(),jd=class{constructor(e){F(this,`_valueMap`,new Map),F(this,`_keyMap`,new Map),F(this,`_hash`,void 0),this._hash=e}get(e,t){return t!=null||(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n!=null||(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t!=null||(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},Md=class extends jd{constructor(){super(ml)}}})),Pd,Fd=n((()=>{xl(),Nd(),J(),I(),Pd=class{constructor(e,t){F(this,`_activeCollectionStorage`,new Md),F(this,`_cumulativeMemoStorage`,new Md),F(this,`_cardinalityLimit`,void 0),F(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),F(this,`_overflowHashCode`,void 0),F(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t==null?2e3:t)-1,this._overflowHashCode=ml(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let a=K(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){var i;(i=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(a)))==null||i.record(e);return}r=this._aggregator.createAccumulation(a),this._activeCollectionStorage.set(t,r)}r==null||r.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o==null||o.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new Md,e}}}));function Id(e){return Array.from(e.entries())}var Ld,Rd=n((()=>{Nd(),I(),Ld=class e{constructor(e,t){F(this,`_aggregator`,void 0),F(this,`_unreportedAccumulations`,new Map),F(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===1?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=Id(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new Md,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){var r;for(let[i,a]of e.keys())(r=t.get(i,a))==null||r.setStartTime(n);return t}}})),zd,Bd=n((()=>{Ad(),Nd(),Fd(),Rd(),I(),zd=class extends kd{constructor(e,t,n,r,i){super(e),F(this,`_aggregationCardinalityLimit`,void 0),F(this,`_deltaMetricStorage`,void 0),F(this,`_temporalMetricStorage`,void 0),F(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Pd(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ld(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new Md;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}}));function Vd(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Hd(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Ud(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Wd(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Gd(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
3
3
  \t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
4
- \t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function Kd(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Gd(e,t):Wd(e,t):Ud(e,t):Hd(e,t)}var qd=n((()=>{})),Jd,Yd=n((()=>{hd(),qd(),N(),F(),Jd=class e{constructor(){P(this,`_sharedRegistry`,new Map),P(this,`_perCollectorRegistry`,new Map)}static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n==null&&(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();fd(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),j.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
4
+ \t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function Kd(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Gd(e,t):Wd(e,t):Ud(e,t):Hd(e,t)}var qd=n((()=>{})),Jd,Yd=n((()=>{hd(),qd(),P(),I(),Jd=class e{constructor(){F(this,`_sharedRegistry`,new Map),F(this,`_perCollectorRegistry`,new Map)}static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n==null&&(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();fd(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),M.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
5
5
  `,`Details:
6
6
  `,Vd(t,e),`The longer description will be used.
7
- To resolve the conflict:`,Kd(t,e))),n=r):j.warn(`A view or instrument with the name `,e.name,` has already been registered and is incompatible with another registered view.
7
+ To resolve the conflict:`,Kd(t,e))),n=r):M.warn(`A view or instrument with the name `,e.name,` has already been registered and is incompatible with another registered view.
8
8
  `,`Details:
9
9
  `,Vd(t,e),`To resolve the conflict:
10
- `,Kd(t,e))}return n}}})),Xd,Zd=n((()=>{N(),F(),Xd=class{constructor(e){P(this,`_backingStorages`,void 0),P(this,`hasAttributeProcessor`,void 0),this._backingStorages=e,this.hasAttributeProcessor=e.some(e=>e.hasAttributeProcessor)}record(e,t,n,r){this.hasAttributeProcessor&&n===void 0&&(n=A.active());let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}}})),Qd,$d,ef=n((()=>{Ed(),Nd(),N(),F(),Qd=class{constructor(e,t){P(this,`_buffer`,new Md),P(this,`_instrumentName`,void 0),P(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){j.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===je.INT&&!Number.isInteger(e)&&(j.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},$d=class{constructor(){P(this,`_buffer`,new Map)}observe(e,t,n={}){if(!gd(e))return;let r=this._buffer.get(e);if(r==null&&(r=new Md,this._buffer.set(e,r)),typeof t!=`number`){j.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===je.INT&&!Number.isInteger(t)&&(j.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}}})),tf,nf=n((()=>{xl(),Ed(),ef(),N(),F(),H(),tf=class{constructor(){P(this,`_callbacks`,[]),P(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(gd));if(n.size===0){j.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(gd)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}observe(e,t){var n=this;return V(function*(){let r=n._observeCallbacks(e,t),i=n._observeBatchCallbacks(e,t);return(yield Promise.allSettled([...r,...i])).filter(e=>e.status===`rejected`).map(e=>e.reason)})()}_observeCallbacks(e,t){return this._callbacks.map(function(){var n=V(function*({callback:n,instrument:r}){let i=new Qd(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=gl(a,t)),yield a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})});return function(e){return n.apply(this,arguments)}}())}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(function(){var n=V(function*({callback:n,instruments:r}){let i=new $d,a=Promise.resolve(n(i));t!=null&&(a=gl(a,t)),yield a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})});return function(e){return n.apply(this,arguments)}}())}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&_l(n.instruments,t))}}})),rf,af=n((()=>{Ad(),Fd(),Rd(),N(),F(),rf=class extends kd{constructor(e,t,n,r,i){super(e),P(this,`_aggregationCardinalityLimit`,void 0),P(this,`_deltaMetricStorage`,void 0),P(this,`_temporalMetricStorage`,void 0),P(this,`_attributesProcessor`,void 0),P(this,`hasAttributeProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Pd(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ld(t,r),this._attributesProcessor=n,this.hasAttributeProcessor=n!==void 0}record(e,t,n,r){this._attributesProcessor!==void 0&&(t=this._attributesProcessor.process(t,n==null?A.active():n)),this._deltaMetricStorage.record(e,t,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}})),of,sf=n((()=>{hd(),Od(),Bd(),Yd(),Zd(),nf(),af(),F(),H(),of=class{constructor(e,t){P(this,`metricStorageRegistry`,new Jd),P(this,`observableRegistry`,new tf),P(this,`meter`,void 0),P(this,`_meterProviderSharedState`,void 0),P(this,`_instrumentationScope`,void 0),this.meter=new Dd(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,rf);return t.length===1?t[0]:new Xd(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,zd)}collect(e,t,n){var r=this;return V(function*(){let i=yield r.observableRegistry.observe(t,n==null?void 0:n.timeoutMillis),a=r.metricStorageRegistry.getStorages(e);if(a.length===0)return null;let o=[];return a.forEach(n=>{let r=n.collect(e,t);r!=null&&o.push(r)}),o.length===0?{errors:i}:{scopeMetrics:{scope:r._instrumentationScope,metrics:o},errors:i}})()}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=dd(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,void 0,[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}}})),cf,lf=n((()=>{xl(),Pu(),ld(),sf(),F(),cf=class{constructor(e){P(this,`viewRegistry`,new cd),P(this,`metricCollectors`,[]),P(this,`meterSharedStates`,new Map),P(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=hl(e),n=this.meterSharedStates.get(t);return n==null&&(n=new of(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Mu(n.selectAggregation(e))]);return t}}})),uf,df=n((()=>{J(),F(),H(),uf=class{constructor(e,t){P(this,`_sharedState`,void 0),P(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}collect(e){var t=this;return V(function*(){let n=K(Date.now()),r=[],i=[],a=Array.from(t._sharedState.meterSharedStates.values()).map(function(){var a=V(function*(a){let o=yield a.collect(t,n,e);(o==null?void 0:o.scopeMetrics)!=null&&r.push(o.scopeMetrics),(o==null?void 0:o.errors)!=null&&i.push(...o.errors)});return function(e){return a.apply(this,arguments)}}());return yield Promise.all(a),{resourceMetrics:{resource:t._sharedState.resource,scopeMetrics:r},errors:i}})()}forceFlush(e){var t=this;return V(function*(){yield t._metricReader.forceFlush(e)})()}shutdown(e){var t=this;return V(function*(){yield t._metricReader.shutdown(e)})()}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){var t,n,r;return(t=(n=(r=this._metricReader).selectCardinalityLimit)==null?void 0:n.call(r,e))==null?2e3:t}}})),ff,pf,mf,hf=n((()=>{F(),ff=/[\^$\\.+?()[\]{}|]/g,pf=class e{constructor(t){P(this,`_matchAll`,void 0),P(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(ff,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},mf=class{constructor(e){P(this,`_matchAll`,void 0),P(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}}})),gf,_f=n((()=>{hf(),F(),gf=class{constructor(e){var t;P(this,`_nameFilter`,void 0),P(this,`_type`,void 0),P(this,`_unitFilter`,void 0),this._nameFilter=new pf((t=e==null?void 0:e.name)==null?`*`:t),this._type=e==null?void 0:e.type,this._unitFilter=new mf(e==null?void 0:e.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}})),vf,yf=n((()=>{hf(),F(),vf=class{constructor(e){P(this,`_nameFilter`,void 0),P(this,`_versionFilter`,void 0),P(this,`_schemaUrlFilter`,void 0),this._nameFilter=new mf(e==null?void 0:e.name),this._versionFilter=new mf(e==null?void 0:e.version),this._schemaUrlFilter=new mf(e==null?void 0:e.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}}));function bf(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function xf(e){if(bf(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&((e==null?void 0:e.instrumentName)==null||pf.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var Sf,Cf=n((()=>{Pu(),hf(),sd(),_f(),yf(),F(),Sf=class{constructor(e){var t;P(this,`name`,void 0),P(this,`description`,void 0),P(this,`aggregation`,void 0),P(this,`attributesProcessor`,void 0),P(this,`instrumentSelector`,void 0),P(this,`meterSelector`,void 0),P(this,`aggregationCardinalityLimit`,void 0),xf(e),e.attributesProcessors==null?this.attributesProcessor=nd():this.attributesProcessor=rd(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Mu((t=e.aggregation)==null?{type:0}:t),this.instrumentSelector=new gf({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new vf({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}}})),wf,Tf=n((()=>{Xu(),lf(),df(),Cf(),N(),ac(),F(),H(),wf=class{constructor(e){var t;if(P(this,`_sharedState`,void 0),P(this,`_shutdown`,!1),this._sharedState=new cf((t=e==null?void 0:e.resource)==null?$s():t),(e==null?void 0:e.views)!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new Sf(t));if((e==null?void 0:e.readers)!=null&&e.readers.length>0)for(let t of e.readers){let n=new uf(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof Yu&&t._setSelfObsMeterProvider(this)}}getMeter(e,t=``,n={}){return this._shutdown?(j.warn(`A shutdown MeterProvider cannot provide a Meter`),D()):((typeof e!=`string`||e.length===0)&&(j.warn(`Invalid MeterProvider instrumentation scope name, using empty string`),e=``),this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter)}shutdown(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`shutdown may only be called once per MeterProvider`);return}t._shutdown=!0,yield Promise.all(t._sharedState.metricCollectors.map(t=>t.shutdown(e)))})()}forceFlush(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}yield Promise.all(t._sharedState.metricCollectors.map(t=>t.forceFlush(e)))})()}}})),Ef=n((()=>{dl(),pl(),Pu(),td(),Tf()}));function Df(e,t){let n={attributes:kf(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Of(e,t){let n={name:e.name,version:e.version};if(e.attributes&&Object.keys(e.attributes).length>0){var r;n.attributes=kf(e.attributes,t),n.droppedAttributesCount=(r=e.droppedAttributesCount)==null?0:r}return n}function kf(e,t){return Object.keys(e).map(n=>Af(n,e[n],t))}function Af(e,t,n){return{key:e,value:jf(t,n)}}function jf(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]=jf(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:jf(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var Mf=n((()=>{}));function Nf(e,t){return{resourceLogs:Ff(e,t)}}function Pf(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 Ff(e,t){let n=Pf(e);return Array.from(n,([e,n])=>{let r=Df(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:Of(e[0].instrumentationScope,t),logRecords:e.map(e=>If(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function If(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Lf(e.severityNumber),severityText:e.severityText,body:jf(e.body,t),eventName:e.eventName,attributes:kf(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 Lf(e){return e}var Rf=n((()=>{Mf()}));function zf(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Bf(e){return zf(e).toString()}function Vf(e){return e}var Hf,Uf,Wf=n((()=>{ll(),J(),Hf=typeof BigInt<`u`?Bf:Yo,Uf={encodeHrTime:Hf,encodeSpanContext:Vf,encodeOptionalSpanContext:Vf,encodeUint8Array:sl}})),Gf,Kf=n((()=>{Rf(),Wf(),N(),Gf={serializeRequest:e=>{let t=Nf(e,Uf);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 qf(e,t){let n=Df(e.resource,t);return{resource:n,schemaUrl:n.schemaUrl,scopeMetrics:Jf(e.scopeMetrics,t)}}function Jf(e,t){return Array.from(e.map(e=>({scope:Of(e.scope,t),metrics:e.metrics.map(e=>Yf(e,t)),schemaUrl:e.scope.schemaUrl})))}function Yf(e,t){let n={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},r=ep(e.aggregationTemporality);switch(e.dataPointType){case fl.SUM:n.sum={aggregationTemporality:r,isMonotonic:e.isMonotonic,dataPoints:Zf(e,t)};break;case fl.GAUGE:n.gauge={dataPoints:Zf(e,t)};break;case fl.HISTOGRAM:n.histogram={aggregationTemporality:r,dataPoints:Qf(e,t)};break;case fl.EXPONENTIAL_HISTOGRAM:n.exponentialHistogram={aggregationTemporality:r,dataPoints:$f(e,t)}}return n}function Xf(e,t,n){let r={attributes:kf(e.attributes,n),startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)};switch(t){case je.INT:r.asInt=e.value;break;case je.DOUBLE:r.asDouble=e.value}return r}function Zf(e,t){return e.dataPoints.map(n=>Xf(n,e.descriptor.valueType,t))}function Qf(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:kf(e.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function $f(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:kf(e.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function ep(e){switch(e){case ul.DELTA:return 1;case ul.CUMULATIVE:return 2}}function tp(e,t){return{resourceMetrics:e.map(e=>qf(e,t))}}var np=n((()=>{Mf(),N(),Ef()})),rp,ip=n((()=>{Wf(),np(),N(),rp={serializeRequest:e=>{let t=tp([e],Uf);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 metrics export response: ${e.message}. Returning empty response`),{}}}}}));function ap(e,t){let n=e&255|fp;return t&&(n|=pp),n}function op(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:kf(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>cp(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>sp(e,t)),droppedLinksCount:e.droppedLinksCount,flags:ap(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function sp(e,t){var n;return{attributes:e.attributes?kf(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:ap(e.context.traceFlags,e.context.isRemote)}}function cp(e,t){return{attributes:e.attributes?kf(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function lp(e,t){return{resourceSpans:dp(e,t)}}function up(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 dp(e,t){let n=up(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=>op(e,t));o.push({scope:Of(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Df(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var fp,pp,mp=n((()=>{Mf(),fp=256,pp=512})),hp,gp=n((()=>{Wf(),mp(),N(),hp={serializeRequest:e=>{let t=lp(e,Uf);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`),{}}}}})),_p=n((()=>{nl(),il(),ol(),Kf(),ip(),gp()}));_p();var vp=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},yp,bp=n((()=>{F(),yp=class{constructor(e){P(this,`_delegate`,void 0),this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}setMetrics(e){this._delegate.setMetrics(e)}}})),xp,Sp=n((()=>{F(),xp=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}}}));function Cp(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function wp(e){if(e!=null)return V(function*(){return e})}function Tp(e,t,n){var r,i,a,o,s,c;return{timeoutMillis:Cp((r=(i=e.timeoutMillis)==null?t.timeoutMillis:i)==null?n.timeoutMillis:r),concurrencyLimit:(a=(o=e.concurrencyLimit)==null?t.concurrencyLimit:o)==null?n.concurrencyLimit:a,compression:(s=(c=e.compression)==null?t.compression:c)==null?n.compression:s}}function Ep(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Dp=n((()=>{H()}));function Op(e){return new kp(e.concurrencyLimit)}var kp,Ap=n((()=>{F(),H(),kp=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 V(function*(){yield Promise.all(e._sendingPromises)})()}}}));function jp(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Mp(){return{handleResponse(e){e==null||!jp(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||j.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Np=n((()=>{N()}));function Pp(e,t){return new Fp(e.transport,e.serializer,Mp(),e.promiseHandler,e.metrics,t.timeout)}var Fp,Ip=n((()=>{Sp(),Np(),J(),N(),F(),H(),Fp=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:q.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:q.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:q.SUCCESS});return}else if(e.status===`failure`&&e.error){r(e.error),t({code:q.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;r(`export_max_retries`),t({code:q.FAILED,error:(n=e.error)==null?new xp(`Export failed with retryable status`):n})}else r(`export_failed`),t({code:q.FAILED,error:new xp(`Export failed with unknown error`)})},e=>{r(e),t({code:q.FAILED,error:e})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(e){this._metrics=e}shutdown(){var e=this;return V(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}}}));function Lp(e,t,n,r){return Pp({transport:r,serializer:t,promiseHandler:Op(e),metrics:n},{timeout:e.timeoutMillis})}var Rp=n((()=>{Ap(),Ip()})),zp,Bp,Vp,Hp,Up,Wp,Gp=n((()=>{zp=`http.response.status_code`,Bp=`otel.component.name`,Vp=`otel.component.type`,Hp=`server.address`,Up=`server.port`,Wp=`error.type`})),Kp,qp=n((()=>{Kp=`0.301.2`})),Jp,Yp,Xp=n((()=>{Gp(),qp(),J(),N(),F(),L(),Jp=new Map,Yp=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`,Kp):D(),c=(t=Jp.get(n))==null?0:t;if(Jp.set(n,c+1),this.standardAttrs={[Vp]:n,[Bp]:`${n}/${c}`},a){let e=a;a.includes(`://`)||(e=`http://${a}`);try{let t=new URL(e);this.standardAttrs[Hp]=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[Up]=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=Ko();return this.inflight.add(t,this.standardAttrs),e=>{let r=Ko();this.inflight.add(-t,this.standardAttrs);let i=e?I(I({},this.standardAttrs),{},{[Wp]:e instanceof Error?e.name:`export_failed`}):this.standardAttrs;this.exported.add(t,i);let a=I(I({},i),this.responseAttributesFromError(e)),o=Zo(Jo(n,r))/1e3;this.duration.record(o,a)}}}})),Zp=n((()=>{bp(),Rp(),Xp()}));Zp(),N(),H();let Qp=49152,$p=0,em=0,tm=e=>typeof e==`string`?new TextEncoder().encode(e).byteLength:e.byteLength;function nm(e){return rm.apply(this,arguments)}function rm(){return rm=V(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}`)}}),rm.apply(this,arguments)}function im(e,t){return am.apply(this,arguments)}function am(){return am=V(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=tm(t.body),a=!1;if(t.keepalive){let e=$p+i>Qp;if(a=!e&&!(em>=9),a)$p+=i,em++;else{let t=e?`inflight bytes (${$p} + ${i}) would exceed ${Qp}B budget`:`concurrent count (${em}) at limit of 9`;j.debug(`Sending without keepalive: ${t}`)}}let o=()=>{r!==void 0&&clearTimeout(r)},s=a?()=>{o(),$p-=i,em--}: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 nm(c).finally(s),{keepalive:a,response:c}}),am.apply(this,arguments)}N(),H(),L();var om=class e{constructor(e){this._config=e}static _compressRequest(e){return V(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 V(function*(){let i=t,a=I({"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 im(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 sm=e=>new om(e);H();let cm=()=>Math.random()*40-20;var lm=class{constructor(e,t=new si){this._transport=e,this._perf=t}send(e,t){var n=this;return V(function*(){let r=n._perf.getNow()+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)+cm(),0);o*=1.5;let c=(s=i.retryInMillis)==null?t:s,l=r-n._perf.getNow();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 um=e=>{var t;return new lm(e.transport,(t=e.perf)==null?new si:t)},dm=`http.response.status_code`;function fm(e){if(!e)return{[dm]:200};if(!(e instanceof Error))return{};if(e.message.startsWith(`Fetch request failed with non-retryable status `)){let t=e.message.substring(47);return{[dm]:Number(t)}}return{}}function pm(e,t,n){return new Yp({componentType:e,metricsHelper:t,url:n,meterProvider:void 0,responseAttributesFromError:fm})}Zp();let mm=(e,t,n,r)=>Lp(e,t,pm(n,r,e.url),um({transport:sm(e)}));var hm=class extends vp{constructor(e){super(mm(e,Gf,`otlp_http_log_exporter`,al))}};L();var gm=class extends hm{constructor({appId:e,userID:t,collectorUrl:n}){super(I(I({},$c),{},{headers:el(e,t),url:`${n}/v1/logs`}))}};_p(),L();var _m=class extends vp{constructor(e){super(mm(I(I({},e),{},{compression:`gzip`}),hp,`otlp_http_span_exporter`,rl))}};L();var vm=class extends _m{constructor({appId:e,userID:t,collectorUrl:n}){super(I(I({},$c),{},{headers:el(e,t),url:`${n}/v1/traces`}))}};function ym(e){return{isRecording:()=>e.isRecording(),setEnabled:t=>{if(t){e.resume();return}e.pause()}}}L(),H();let bm=e=>({"mxl-client-id":e}),xm=0;function Sm(e,t){let n=Date.now();n-xm<3e4||(xm=n,console.warn(`[mxl] session replay ${e} failed (dropping; will retry on next chunk):`,t))}function Cm(e){let t=bm(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=V(function*(e,r,i,a,o){try{let{response:s}=yield im(`${n}${r}`,{body:i,headers:I(I({},t),a),keepalive:o,timeoutMillis:1e4});return s.ok?`accepted`:(Sm(e,Error(`HTTP ${s.status}`)),s.status===413?`exhausted`:`rejected`)}catch(t){return Sm(e,t),`failed`}});return function(t,n,r,i,a){return e.apply(this,arguments)}}(),s=function(){var t=V(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=V(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=V(function*(e,t=!1){e.length!==0&&(yield o(`events POST`,`/sessionEvents`,`${e.map(e=>JSON.stringify(e)).join(`
11
- `)}\n`,{"content-type":`application/x-ndjson`},t))});return function(t){return e.apply(this,arguments)}}(),postSessionMeta:c,shouldIgnoreUrl:a}}F();var wm=class{constructor(){P(this,`_items`,new Map)}get length(){return this._items.size}clear(){this._items.clear()}getItem(e){var t;return(t=this._items.get(e))==null?null:t}key(e){var t;return(t=Array.from(this._items.keys())[e])==null?null:t}removeItem(e){this._items.delete(e)}setItem(e,t){this._items.set(e,t)}};let Tm=(e,t)=>{let n=`${e} is null`;try{let t=window[e];if(t)return t}catch(e){n=e}return t.warn(`${e} is not accessible; keeping its data in memory for this page`,String(n)),new wm},Em=`mxl_user`,Dm=`mxl_user_id`,Om=`mxl_external_user_id`,km=`mxl_profile_snapshot`,Am=`mxl_session_analytics_prev`;L();let jm=()=>({avatar:``,email:``,firstName:``,lastName:``,profileId:``,properties:{}});function Mm(e){try{let t=e.getItem(km);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 Nm(e,t){try{return e.setItem(km,JSON.stringify(t)),!0}catch(e){return!1}}function Pm(e){try{e.removeItem(km)}catch(e){}}function Fm(e,t){let n=e==null?jm():e,r=I(I({},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 Im(e){let t=I({},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(),L();var Lm=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=I({},e),this._referrer=e.referrer,this._utm={utmCampaign:e.utmCampaign,utmContent:e.utmContent,utmMedium:e.utmMedium,utmSource:e.utmSource,utmTerm:e.utmTerm}),this._exit=I({},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[`${z}profile_id`]=t.profileId,u[`${z}screen_view_count`]=t.screenViewCount,u[`${z}event_count`]=t.eventCount,u[`${z}entry_origin`]=t.entryOrigin,u[`${z}entry_path`]=t.entryPath,u[`${z}exit_origin`]=t.exitOrigin,u[`${z}exit_path`]=t.exitPath,u[`${z}referrer`]=t.referrer,u[`${z}utm_medium`]=t.utmMedium,u[`${z}utm_source`]=t.utmSource,u[`${z}utm_campaign`]=t.utmCampaign,u[`${z}utm_content`]=t.utmContent,u[`${z}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 Rm(e){try{let t=e.getItem(Am);return t?JSON.parse(t):null}catch(e){return null}}function zm(e,t){try{e.setItem(Am,JSON.stringify(t))}catch(e){}}function Bm(e){try{e.removeItem(Am)}catch(e){}}function Vm(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(),F(),L();var Hm=class{constructor({appId:e,diag:t,loggerProvider:n,pageManager:r,storage:i,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 Lm),P(this,`_lastScreenViewPath`,null),P(this,`_screenViewTimer`,null);let s=n==null?qt: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==null?Tm(`localStorage`,this._diag):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=Fm(Mm(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});Nm(this._storage,s)||this._diag.warn(`Failed to persist profile snapshot`),this._userManager.setUserId(s.profileId);let c=Im(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=Mm(this._storage),a=Number.parseFloat((n=i==null?void 0:i.properties[e])==null?`0`:n),o=Number.isFinite(a)?a+t:t,s=Fm(i,{profileId:r,properties:I(I({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});Nm(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=Mm(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=Fm(i,{profileId:r,properties:I(I({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});Nm(this._storage,s),this._emitAnalyticsLog(`decrement`,e,{counter_name:e,counter_value:String(o)},r)}clear(){Pm(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=Rm(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[ti])===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);zm(this._storage,r)}resetSessionAnalyticsForNewUserSession(){this._sessionAnalytics.reset(),Bm(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=Vm(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,[ni]:this._appId,"mxl.device.id":h,[ri]:g,"mxl.session.id":_,[Yr]: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:k.INFO,severityText:`INFO`})}_resolveProfileId(){let e=this._userManager.getUserId();if(e)return e;let t=Mm(this._storage);return(t==null?void 0:t.profileId)||null}};let Um=`http.response.body.size`,Wm=`log.record.uid`,Gm=`user.id`,Km=`0.1.4`,qm=`mxl_app_instance_id`,Jm=(e,t)=>{let n=null;try{n=e.getItem(qm)}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=$n();try{e.setItem(qm,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n};ac(),U(),L();let Ym=`unknown_service`,Xm=({serviceName:e})=>Zs({[Da]:e}),Zm=({diagLogger:e,appVersion:t,pageSessionStorage:n,appId:r,enduserPseudoId:i})=>{var a;let o=window.navigator;return Zs(I(I({[ja]:`mxl-web-sdk`,app_version:t,app_framework:1,sdk_version:Km,[Ma]:Km,sdk_simple_version:1,sdk_platform:`web`,[ka]:`webjs`,"mxl.app_instance_id":Jm(n,e),[Ia]: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?{[ni]:r}:{}))},Qm={networkSpansForwardingThreshold:0,samplingPct:100},$m=`mxl_remote_config`,eh=(e,t,{osVersion:n,appVersion:r,deviceId:i})=>`${e}/config?${new URLSearchParams({appId:t,osVersion:n,appVersion:r,deviceId:i}).toString()}`,th=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=(e,t,n)=>{let r=e[t];if(typeof r==`number`)return r;let i=e[n];if(typeof i==`number`)return i},nh=(e,t,n)=>{let r=e[t];if(typeof r==`boolean`)return r;let i=e[n];if(typeof i==`boolean`)return i},rh=(e,t,n)=>{let r=e[t];if(typeof r==`string`)return r;let i=e[n];if(typeof i==`string`)return i},ih=e=>{if(!th(e))return;let t={},n=X(e,`maxDurationSeconds`,`max_duration_seconds`);n!==void 0&&(t.maxDurationSeconds=n);let r=X(e,`inactivityTimeoutSeconds`,`inactivity_timeout_seconds`);r!==void 0&&(t.inactivityTimeoutSeconds=r);let i=X(e,`foregroundInactivityTimeoutSeconds`,`foreground_inactivity_timeout_seconds`);return i!==void 0&&(t.foregroundInactivityTimeoutSeconds=i),t},ah=e=>{if(!th(e))return;let t={},n=X(e,`pctEnabled`,`pct_enabled`);n!==void 0&&(t.pctEnabled=n);let r=X(e,`sampleRate`,`sample_rate`);r!==void 0&&(t.sampleRate=r);let i=nh(e,`maskAllInputs`,`mask_all_inputs`);i!==void 0&&(t.maskAllInputs=i);let a=nh(e,`maskAllText`,`mask_all_text`);a!==void 0&&(t.maskAllText=a);let o=X(e,`flushIntervalMs`,`flush_interval_ms`);o!==void 0&&(t.flushIntervalMs=o);let s=nh(e,`omitRedundantInstrumentations`,`omit_redundant_instrumentations`);s!==void 0&&(t.omitRedundantInstrumentations=s);let c=nh(e,`debug`,`debug`);return c!==void 0&&(t.debug=c),Object.keys(t).length>0?t:void 0},oh=e=>{if(!th(e))return;let t={},n=nh(e,`enabled`,`enabled`);n!==void 0&&(t.enabled=n);let r=X(e,`pctEnabled`,`pct_enabled`);r!==void 0&&(t.pctEnabled=r);let i=X(e,`intervalMs`,`interval_ms`);return i!==void 0&&(t.intervalMs=i),Object.keys(t).length>0?t:void 0},sh=e=>{if(!th(e))return;let t={},n=nh(e,`enabled`,`enabled`);n!==void 0&&(t.enabled=n);let r=X(e,`pctEnabled`,`pct_enabled`);r!==void 0&&(t.pctEnabled=r);let i=X(e,`sampleIntervalMs`,`sample_interval_ms`);i!==void 0&&(t.sampleIntervalMs=i);let a=X(e,`maxBufferSize`,`max_buffer_size`);a!==void 0&&(t.maxBufferSize=a);let o=X(e,`windowMs`,`window_ms`);return o!==void 0&&(t.windowMs=o),Object.keys(t).length>0?t:void 0},ch=e=>{if(!th(e))return;let t={},n=oh(e.memory);n!==void 0&&(t.memory=n);let r=sh(e.profiling);return r!==void 0&&(t.profiling=r),Object.keys(t).length>0?t:void 0},lh=e=>{var t,n,r;if(!th(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(th(o)){let e=X(o,`pctEnabled`,`pct_enabled`);e!==void 0&&(a.networkSpanForwarding={pctEnabled:e})}let s=X(e,`emptySessionAvoidanceEnabledPct`,`empty_session_avoidance_enabled_pct`);s!==void 0&&(a.emptySessionAvoidanceEnabledPct=s);let c=rh(e,`serviceName`,`service_name`);c!==void 0&&(a.serviceName=c);let l=ah((n=e.sessionReplay)==null?e.session_replay:n);l!==void 0&&(a.sessionReplay=l);let u=ih((r=e.userSession)==null?e.user_session:r);u!==void 0&&(a.userSession=u);let d=ch(e.performance);return d!==void 0&&(a.performance=d),a};N(),L(),F(),H();let uh=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=I({},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),e.performance!==void 0&&(i.performance=I({},e.performance)),i};var dh=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),P(this,`_configChangeListeners`,new Set),e&&t&&n&&o&&(this._remoteConfigURL=eh(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=I(I({},Qm),a),this._sdkConfig=I(I({},this._baseConfig),s?uh(s.config):{})}setConfig(e){this._sdkConfig=I(I({},this._sdkConfig),e),this._notifyConfigChange()}getConfig(){return this._sdkConfig}onConfigChange(e){return this._configChangeListeners.add(e),()=>{this._configChangeListeners.delete(e)}}_notifyConfigChange(){let e=this._sdkConfig;for(let t of this._configChangeListeners)t(e)}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())||Ym}_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 V(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($m,JSON.stringify({config:n,etag:r})),e._sdkConfig=I(I({},e._baseConfig),uh(n)),e._etag=r,e._notifyConfigChange()}catch(t){e._diag.warn(`Failed to refresh remote config: ${t instanceof Error?t.message:String(t)}`)}})()}_getRemoteConfigFromStorage(){try{let e=this._storage.getItem($m);if(e){let t=JSON.parse(e);return{config:lh(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 V(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?[lh(yield n.json()),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};L();function fh({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=I({},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 ph={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 mh={error:`error_log`,info:`info_log`,warning:`warning_log`};var hh=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=mh[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}};F(),L();let gh=[`perf`];var _h=class extends _c{constructor(e){let{perf:t}=e,n=Wa(e,gh);super(n),P(this,`_perf`,void 0),this._perf=t}getLogger(e,t,n){return new vh(super.getLogger(e,t,n),this._perf)}},vh=class{constructor(e,t){P(this,`_logger`,void 0),P(this,`_perf`,void 0),this._logger=e,this._perf=t}emit(e){this._logger.emit(I(I({},e),{},{timestamp:this._toAbsoluteTime(e.timestamp)}))}enabled(e){return this._logger.enabled(e)}_toAbsoluteTime(e){return e===void 0?this._perf.getNow():typeof e==`number`&&e<performance.timeOrigin/2?this._perf.offsetToAbsoluteTime(e):e}};let yh=(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}},bh=e=>e.visibilityState===`hidden`?`background`:`foreground`,xh=globalThis;N(),U(),F(),kn(),L();let Sh=()=>JSON.stringify(xh._MXLFileBundleIDs||{}),Ch=(e,t,n)=>`${e}\n${t}\n${n}`,wh=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 Th=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?qt: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 k.INFO;case`warning`:return k.WARN;default:return k.ERROR}}logException(t,{handled:n=!0,attributes:r={},timestamp:i=this._perf.getNow(),handler:a=`manual`,spanContext:o}={}){var s;if(!this._passesFilters(t))return;let c=this._validateAttributes(r),l=(t==null||(s=t.constructor)==null?void 0:s.name)||typeof t,u=``,d=l,f=``;if(t instanceof Error)u=String(t.message||``).trim(),d=t.name||``,f=t.stack||``;else if(t&&typeof t==`object`)try{u=JSON.stringify(t)}catch(e){u=String(t).trim()}else u=String(t).trim();if(this._isDuplicate(d,u,f,i))return;n||this._userSessionManager.incrSessionPartCountForKey(`mxl.unhandled_exceptions_count`);let{[Ur]:p}=c,m=Wa(c,[Ur].map(On)),h=this._limitManager.limitException(u,m);h!==`dropped`&&(this._userSessionManager.incrReplayCount(`errors`),this._logger.emit(I(I({attributes:I(I(I({},h.attributes),p===void 0?{}:{[Ur]:String(p)}),{},{[R]:`sys.exception`,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":wh(t),[xa]:l,"exception.name":d,[ya]:h.message,[ba]:f,[Gr]:Sh(),[Hr]:bh(this._visibilityDoc),"mxl.exception_number":yh(this._storage,`mxl_exception_number`,this._diag)}),body:h.message},o?{context:M.setSpanContext(A.active(),o)}:{}),{},{eventName:`mxl-exception`,severityNumber:k.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.getNow()})}_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:I(I(I({},o.attributes),{},{[R]:`sys.log`},a?{"mxl.stacktrace.js":a,[Gr]:Sh()}:{}),{},{[Hr]:bh(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=Ch(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 Eh=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document,diag:n,navigationHost:r=window,userSessionManager:i,perf:a=new si}={}){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=$n()),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&&(this._perf.setZeroTimeOffset(e.timeStamp),(t=this._userSessionManager)==null||t.rolloverSessionPartInternal({endReason:`web_soft_navigation`,startReason:`web_soft_navigation`}),this._setRouteFromCurrentLocation(),Un.screenView())}),P(this,`_setRouteFromCurrentLocation`,()=>{var e;let t=this._navigationHost.location.pathname;if(((e=this._currentRoute)==null?void 0:e.url)===t&&this._currentRoute.path){this.setCurrentRoute(this._currentRoute);return}this.setCurrentRoute({url:t})}),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 Dh=(e,t)=>!t||t<=0||t>100?!1:t>=Oh(e),Oh=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 kh=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 Dh(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return Dh(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 Dh(this._deviceId,n)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return Dh(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};J(),F(),L(),kn();let Ah=(e,t,n)=>{if(typeof n!=`number`||n>e.getOffsetFromOrigin())return n;let r=t+n,i=e.offsetToAbsoluteTime(n);return Math.abs(i-r)>1e3?i:r};var jh=class e{constructor(e,t,n){P(this,`_span`,void 0),P(this,`_perf`,void 0),P(this,`_wallOrigin`,void 0),this._span=e,this._perf=t,this._wallOrigin=n}static start(t,n,r,i={},a){var o;let s=Date.now()-n.getOffsetFromOrigin();return new e(t.startSpan(r,I(I({},i),{},{startTime:(o=Ah(n,s,i.startTime))==null?Date.now():o}),a),n,s)}static from(t){return t instanceof e?t:new e(t)}get attributes(){return this._span.attributes}addEvent(e,t,n){return this._span.addEvent(e,es(t)?this._toSpanTime(t):t,this._toSpanTime(n)),this}addLink(e){return this._span.addLink(e),this}addLinks(e){return this._span.addLinks(e),this}end(e){this._end(e)}isRecording(){return this._span.isRecording()}recordException(e,t){this._span.recordException(e,this._toSpanTime(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=Wa(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._end(e.endTime)}_end(e){this._perf&&this._wallOrigin!==void 0&&this.isRecording()&&(this._span.attributes[`mxl.perf_clock_lag_delta_ms`]=this._perf.getClockLag(this._wallOrigin)),this._span.end(this._toSpanTime(e))}_toSpanTime(e){return!this._perf||this._wallOrigin===void 0?e:Ah(this._perf,this._wallOrigin,e)}};N(),F();var Mh=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[R]=`perf`;let r=t.parentSpan?M.setSpan(A.active(),t.parentSpan):n;return jh.from(this._tracer.startSpan(e,t,r))}getSpan(e){let t=M.getSpan(e);if(t)return jh.from(t)}};N(),F();let Nh=[`perf`];var Ph=class extends Qc{constructor(e){let{perf:t}=e,n=Wa(e,Nh);super(n),P(this,`_perf`,void 0),this._perf=t}getTracer(e,t,n){return new Fh(super.getTracer(e,t,n),this._perf)}},Fh=class{constructor(e,t){P(this,`_tracer`,void 0),P(this,`_perf`,void 0),this._tracer=e,this._perf=t}startSpan(e,t={},n){return jh.start(this._tracer,this._perf,e,t,n)}startActiveSpan(e,...t){let n=t[t.length-1],r=t.length>1?t[0]:{},i=t.length>2?t[1]:A.active(),a=this.startSpan(e,r,i);return A.with(M.setSpan(i,a),()=>n(a))}};let Ih=e=>typeof e[`enduser.pseudo.id`]==`string`&&e[`enduser.pseudo.id`].length===32,Lh=e=>typeof e==`string`&&e.length===32;N(),F();var Rh=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(Dm,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(Dm)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(Em);if(e){let t=JSON.parse(e);Ih(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(Dm,t[`enduser.pseudo.id`]),this._storage.removeItem(Em)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(Em))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(Dm);e?Lh(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=$n();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(Om)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(Om,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(Om)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let zh=({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),Bh=e=>e.visibilityState===`visible`&&e.hasFocus(),Vh=(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},Hh=({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)},Uh=({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)},Wh=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}}},Gh=(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`},Kh=(e,t)=>{try{let t=e.getItem(ir);return t?JSON.parse(t):null}catch(e){return t.warn(`Failed to retrieve tab activity`,e),null}},qh=(e,t,n,r)=>{let i=Jm(t,r),a,o;if(e===`same_origin`){let e=Kh(n,r);e&&Date.now()-e.lastActivityMs<=1e4&&(a=e.tabId,{experienceId:o}=e)}return o===void 0&&(o=$n()),{navigationSource:e,tab:{experienceId:o,sourceTabId:a,tabId:i}}},Jh=({sessionStorage:e,localStorage:t,referrer:n,navigationPerformance:r,diag:i})=>{let a=Wh(n),o=Gh(a,r,i);try{let t=e.getItem(rr);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=qh(o,e,t,i);try{e.setItem(rr,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}},Yh=(e,t,n)=>{let r={experienceId:t.experienceId,lastActivityMs:Date.now(),tabId:t.tabId};try{e.setItem(ir,JSON.stringify(r))}catch(e){n.warn(`Failed to save tab activity`,e)}},Xh=(e,t,n)=>{let r=r=>{var i;if(r.button===1||r.ctrlKey||r.metaKey||r.shiftKey){Yh(t,e,n);return}(i=r.target)!=null&&i.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&Yh(t,e,n)},i={capture:!0,passive:!0};document.addEventListener(`auxclick`,r,i),document.addEventListener(`click`,r,i)};N(),F(),L();var Zh=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=sr,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,`_sdkStartupTimings`,null),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(!Bh(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=vr(this._storage,this._diag),this._tracer=M.getTracer(`mxl-web-sdk-session-parts`),this._target=c,this._activityEvents=u,this._onActivityThrottled=Vh(this._onActivity,l),this._config=t,this._dynamicConfigManager=n;let m=Jh({diag:this._diag,localStorage:o,navigationPerformance:p,referrer:f,sessionStorage:d});this._tab=m.tab,this._navigationSource=m.navigationSource,this._referrerScrubbedUrl=m.referrerScrubbedUrl,Xh(this._tab,o,this._diag),e._testInstances.add(this)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-session-parts`),Hh({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.getNow());this._state=t,n&&this._storeState()}recordSDKStartupTimings(e){this._sdkStartupTimings=I(I({},e),{},{initDuration:Math.max(1,Math.ceil(e.initDuration))})}claimReplaySample(e){let{state:t}=this._loadOrCreateUserSessionState(this._perf.getNow());if(t.replaySampled!==null)return this._state=t,t.replaySampled;let n=Math.random()<e;return this._state=I(I({},t),{},{replaySampled:n}),this._storeState(),n}nextReplayMetaVersion(){let{state:e}=this._loadOrCreateUserSessionState(this._perf.getNow()),t=e.replayMetaVersion+1;return this._state=I(I({},e),{},{replayMetaVersion:t}),this._storeState(),t}incrReplayCount(e){let{state:t}=this._loadOrCreateUserSessionState(this._perf.getNow());this._state=I(I({},t),{},{replayCounts:I(I({},t.replayCounts),{},{[e]:t.replayCounts[e]+1})}),this._storeState()}getReplayCounts(){return this._loadOrCreateUserSessionState(this._perf.getNow()).state.replayCounts}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{[$r]:this._state.userSessionId,[ei]:n,[ti]: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.getNow(),t=this._storage.getItem(nr),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(nr,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(bh(this._visibilityDoc)===`background`||!this._visibilityDoc.hasFocus()){this._diag.debug(`skipping session part start (reason: ${e}) because the tab is not engaged`);return}let n=$n(),r=this._nextSessionPartCounts;this._beginUserSessionForPartStart();let i=I(I({},this.getUserSessionAttributes()),{},{[R]:`ux.session_part`,[Hr]:`foreground`,[Qr]: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=jh.from(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.getNow():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=or.has(e),i=this._perf.getNow(),a=n==null?i:n,o=this._sessionPartSpan;try{let n=I(I({"mxl.session_part_end_reason":e},this._activeSessionPartCounts),this._limitManager.getDiagnosticCounts());this._coldStart&&(n[`mxl.page_load`]=this._visibilityDoc.readyState===`complete`,this._sdkStartupTimings&&(n[`mxl.sdk_startup_duration`]=this._sdkStartupTimings.initDuration,n[`mxl.sdk_load_origin_offset`]=this._sdkStartupTimings.loadOriginOffset,n[`mxl.sdk_init_origin_offset`]=this._sdkStartupTimings.initOriginOffset)),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(I(I({},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(er),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.getNow():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.getNow())}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=I(I({},this._permanentProperties),{},{[i]:a});if(!yr(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.getNow());this._state=I(I({},o),{},{userSessionProperties:I(I({},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 I(I({},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=_r(this._storage,this._diag);!t&&!this._hasStoredState&&this._state&&(t=this._state);let n=!1;if(!t||ur(t,e)){var r;t&&(this._previousUserSessionId=t.userSessionId);let i=yh(this._storage,`mxl_user_session_number`,this._diag);t=dr(I(I({},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.getNow(),{state:t}=this._loadOrCreateUserSessionState(e);this._setupMaxDurationTimer(t,e),this._currentSessionPartNumber=yh(this._storage,`mxl_session_part_number`,this._diag),this._state=I(I({},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=I(I({},this._state),{},{inactivityDeadlineTs:e+this._state.inactivityTimeoutSeconds*1e3}),this._storeState()}_rolloverUserSession(e){var t,n;if(this._sessionPartSpan){let t=this._perf.getNow();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(er),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(),Uh({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=Bh(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=zh({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`,zh({defaultValue:ar,diag:this._diag,max:86400,min:30,value:(n=this._config.inactivityTimeoutSeconds)==null?i==null?void 0:i.userSessionInactivityTimeoutSeconds:n}),a,ar);return{foregroundInactivityTimeoutSeconds:this._withinMaxDuration(`session.foregroundInactivityTimeoutSeconds`,zh({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(er,JSON.stringify(this._state));return e&&(this._hasStoredState=!0),e}_removeFromPermanentProperties(e){if(!(e in this._permanentProperties))return;let t=I({},this._permanentProperties);delete t[e],this._permanentProperties=t,yr(this._storage,t)}_removeFromUserSessionProperties(e){if(!this._state||!(e in this._state.userSessionProperties))return;let t=I({},this._state.userSessionProperties);delete t[e],this._state=I(I({},this._state),{},{userSessionProperties:t}),this._storeState()}};P(Zh,`_testInstances`,new Set),F();var Qh=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(qr,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};F();var $h=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[qr]=this._urlDocument.URL)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var eg=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)}};U(),F();var tg=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(R,`sys.log`),e.setAttribute(Na,this._urlDocument.URL),e.attributes[`mxl.is_tab_engaged`]===void 0&&e.setAttribute(`mxl.is_tab_engaged`,Bh(this._visibilityDocument))}shutdown(){return Promise.resolve(void 0)}};U();let ng=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[pa]:t;return typeof n==`string`&&n.includes(`://`)}return!1};U();var rg=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){ea(e.spanContext().traceId)}onEnding(e){ng(e)&&(e.attributes[R]=`perf.network_request`,e.attributes[`url.full`]===void 0&&(e.attributes[Na]=e.attributes[pa]),e.attributes[`http.response.status_code`]===void 0&&(e.attributes[wa]=e.attributes[ma]),e.attributes[`http.request.method`]===void 0&&(e.attributes[Sa]=e.attributes[fa]),e.attributes[`http.response.body.size`]===void 0&&(e.attributes[Um]=e.attributes[ga]),e.attributes[`http.request.body.size`]===void 0&&(e.attributes[`http.request.body.size`]=e.attributes[ha]))}onStart(){}shutdown(){return Promise.resolve(void 0)}};let ig=`Soft Navigation`,ag=`mxl.soft_navigation.source`,og=`mxl.soft_navigation.interaction_id`,sg=`mxl.soft_navigation.start_time`,cg=`mxl.soft_navigation.duration`,lg={performanceObserver:`performance_observer`,polyfill:`polyfill`},ug=e=>e.attributes[R]===`ux.session_part`,dg=e=>e.attributes[ag]!==void 0;N(),J(),F();let fg=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var pg=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 Fs(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(ug(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&&ug(e[0])}_exportSpans(e){if(this._emptySessionAvoidanceEnabled&&this._isEmptySessionExport(e)){this._diag.debug(`Skipping export of empty session part`);return}qs._export(this._exporter,e).then(e=>{if(e.code===q.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(fg(r,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(fg(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(fg(`unknown`,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(fg(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}shutdown(){return this._shutdownOnce.call()}};F();var mg=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&&(t.path&&e.setAttribute(Yr,t.path),e.setAttribute(Xr,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&e.setAttribute(Zr,t)}shutdown(){return Promise.resolve(void 0)}};F();var hg=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&&(t.path&&(e.attributes[Yr]=t.path),e.attributes[Xr]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&(e.attributes[Zr]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var gg=class{constructor({perf:e}){P(this,`_perf`,void 0),this._perf=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.setAttribute(Kr,this._perf.getClockLag())}shutdown(){return Promise.resolve(void 0)}};F();var _g=class{constructor({perf:e}){P(this,`_perf`,void 0),this._perf=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){e.attributes[Kr]=this._perf.getClockLag()}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};N(),J(),F();var vg=class{constructor({buffer:e}){P(this,`_buffer`,void 0),this._buffer=e}onEmit(e){try{let t=e.attributes[Wm];typeof t==`string`&&t.length>0&&this._buffer.record({kind:`log`,id:t,startTime:Zo(e.hrTime),type:e.attributes[R]})}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(),J(),F();var yg=class{constructor({buffer:e}){P(this,`_buffer`,void 0),this._buffer=e}forceFlush(){return Promise.resolve(void 0)}onStart(e){try{if(dg(e)||ug(e))return;this._buffer.record({kind:`span`,id:e.spanContext().spanId,startTime:Zo(e.startTime),type:e.attributes[R]})}catch(e){j.error(`failed to record span for correlation`,e)}}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var bg=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 xg=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({[Gm]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}};F();var Sg=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({[Wm]:$n(),[$r]:s,[ei]:c,[Qr]:l})}shutdown(){return Promise.resolve(void 0)}};F();var Cg=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[Gm]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};F();var wg=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(),J();var Tg=class extends Ts{inject(e,t,n){super.inject(e,t,n);let r=M.getSpan(e);if(r){let e=t instanceof Headers?t.get(`traceparent`):Re.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};N(),F();var Eg=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 Dg=({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},Og=performance.now(),kg=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Ag=({collectorUrl:e,configUrl:t})=>[RegExp(`^${kg(e)}/v1/(traces|logs|metrics)(\\?|$)`),RegExp(`^${kg(t)}/((config|replay)(\\?|$)|sessionReplays/)`)];var jg,Mg=n((()=>{jg=`http.request.body.size`}));function Ng(...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}=Pg(t.body);return t.body=e,n}else return Promise.resolve(Ig(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>Lg(e)):Promise.resolve()}}function Pg(e){if(!e.pipeThrough)return Wg.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 V(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Fg(e){return typeof Document<`u`&&e instanceof Document}function Ig(e){if(Fg(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Lg(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Rg(e);if(e instanceof URLSearchParams)return Lg(e.toString());if(e.byteLength!==void 0)return e.byteLength;Wg.warn(`unknown body type`)}function Lg(e){return Gg.encode(e).byteLength}function Rg(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 zg(e){let t=Bg(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Bg(){return qg===void 0&&(qg=Kg),qg}function Vg(e){let t=Number(e.port||Jg[e.protocol]);if(t&&!isNaN(t))return t}function Hg(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch(t){return e}}function Ug(e){let t;try{t=new URL(e)}catch(t){return e}let n=!1;if((t.username||t.password)&&(t.username=Yg,t.password=Yg,n=!0),t.search.length>1){let e=!1,r=t.search.slice(1).split(`&`).map(t=>{let n=t.indexOf(`=`),r=n===-1?t:t.slice(0,n);return Xg.includes(Hg(r))?(e=!0,`${r}=${Yg}`):t});e&&(t.search=`?${r.join(`&`)}`,n=!0)}return n?t.href:e}var Wg,Gg,Kg,qg,Jg,Yg,Xg,Zg=n((()=>{N(),J(),H(),Wg=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),Gg=new TextEncoder,Kg={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Jg={"https:":`443`,"http:":`80`},Yg=`REDACTED`,Xg=[`sig`,`Signature`,`AWSAccessKeyId`,`X-Goog-Signature`,`X-Amz-Signature`,`X-Amz-Credential`,`X-Amz-Security-Token`]})),Qg,$g=n((()=>{Qg=`0.301.2`})),e_,t_=n((()=>{e_=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 n_(){return p_||(p_=document.createElement(`a`)),p_}function r_(e,t){return t in e}function i_(e,t,n,r=!0){if(r_(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function a_(e,t,n=!1,r){r===void 0&&(r=t.startTime!==0),n||(i_(e,`fetchStart`,t,r),i_(e,`domainLookupStart`,t,r),i_(e,`domainLookupEnd`,t,r),i_(e,`connectStart`,t,r),i_(e,`secureConnectionStart`,t,r),i_(e,`connectEnd`,t,r),i_(e,`requestStart`,t,r),i_(e,`responseStart`,t,r),i_(e,`responseEnd`,t,r))}function o_(e){return e.slice().sort((e,t)=>{let n=e.fetchStart,r=t.fetchStart;return n>r?1:n<r?-1:0})}function s_(){return typeof location<`u`?location.origin:void 0}function c_(e,t,n,r,i=new WeakSet,a){let o=d_(e);e=o.toString();let s=u_(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=o_(s);if(o.origin!==s_()&&c.length>1){let e=c[0],t=l_(c,e.responseEnd,n),r=e.responseEnd;return t.fetchStart<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function l_(e,t,n){let r=Yo(n),i=Yo(qo(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=Yo(qo(n.fetchStart)),c=r-Yo(qo(n.responseEnd));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function u_(e,t,n,r,i,a){let o=Yo(t),s=Yo(n),c=r.filter(t=>{let n=Yo(qo(t.fetchStart)),r=Yo(qo(t.responseEnd));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 d_(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=n_();return t.href=e,t}function f_(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),d_(e).origin===s_()?!0:n.some(t=>As(e,t))}var p_,m_=n((()=>{J()})),h_=n((()=>{t_(),m_()})),g_,__,v_,y_=n((()=>{Mg(),Zg(),$g(),N(),J(),h_(),U(),F(),g_=300,__=typeof PerformanceObserver<`u`,v_=class extends go{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,Qg,e),P(this,`component`,`fetch`),P(this,`version`,Qg),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[e_.FETCH_START]},M.setSpan(A.active(),e));a_(n,t,this.getConfig().ignoreNetworkEvents,void 0),n.end(t[e_.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=d_(t.url);e.setAttribute(wa,t.status),e.setAttribute(Ta,n.hostname);let r=Vg(n);r&&e.setAttribute(Ea,r)}_addHeaders(e,t){if(!f_(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};gn.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)gn.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);gn.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(js(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n={},r=t.method,i=zg(t.method||`GET`),a=i;return n[Sa]=i,i!==r&&(n[Ca]=r),n[Na]=Ug(e),this.tracer.startSpan(a,{kind:wt.CLIENT,attributes:n})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=c_(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)),a_(e,t,this.getConfig().ignoreNetworkEvents,void 0)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=K(Date.now()),i=Ko();this._addFinalSpanAttributes(e,n),n.status>=400&&(e.setStatus({code:Et.ERROR}),e.setAttribute(va,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},g_)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._enabled)return e.apply(this,n);let r=this,i=d_(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&&Ng(...n).then(e=>{e&&o.setAttribute(jg,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&&io(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&io(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=Ko(),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(!__){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}if(!this._enabled){if(this._isFetchPatched){this._diag.debug(`fetch constructor already patched`),this._enabled=!0;return}if(typeof globalThis.fetch!=`function`){this._diag.warn(`globalThis.fetch is missing or not a function; instrumentation will not be enabled. Register the instrumentation after any fetch polyfill, or call enable() once fetch is available.`);return}try{this._wrap(globalThis,`fetch`,this._patchConstructor()),this._isFetchPatched=!0,this._enabled=!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(){__&&this._enabled&&(this._enabled=!1,this._usedResources=new WeakSet)}}})),b_=n((()=>{y_()})),x_,S_=n((()=>{x_=`http.request.body.size`}));function C_(e){return typeof Document<`u`&&e instanceof Document}function w_(e){if(C_(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return T_(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return E_(e);if(e instanceof URLSearchParams)return T_(e.toString());if(e.byteLength!==void 0)return e.byteLength;M_.warn(`unknown body type`)}function T_(e){return N_.encode(e).byteLength}function E_(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 D_(e){let t=O_(),n=e.toUpperCase();return n in t?n:`_OTHER`}function O_(){return F_===void 0&&(F_=P_),F_}function k_(e){let t=Number(e.port||I_[e.protocol]);if(t&&!isNaN(t))return t}function A_(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch(t){return e}}function j_(e){let t;try{t=new URL(e)}catch(t){return e}let n=!1;if((t.username||t.password)&&(t.username=L_,t.password=L_,n=!0),t.search.length>1){let e=!1,r=t.search.slice(1).split(`&`).map(t=>{let n=t.indexOf(`=`),r=n===-1?t:t.slice(0,n);return R_.includes(A_(r))?(e=!0,`${r}=${L_}`):t});e&&(t.search=`?${r.join(`&`)}`,n=!0)}return n?t.href:e}var M_,N_,P_,F_,I_,L_,R_,z_=n((()=>{N(),J(),M_=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),N_=new TextEncoder,P_={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},I_={"https:":`443`,"http:":`80`},L_=`REDACTED`,R_=[`sig`,`Signature`,`AWSAccessKeyId`,`X-Goog-Signature`,`X-Amz-Signature`,`X-Amz-Credential`,`X-Amz-Security-Token`]})),B_,V_=n((()=>{B_=`0.301.2`})),H_,U_,W_=n((()=>{S_(),z_(),V_(),N(),yo(),J(),h_(),U(),F(),H_=300,U_=class extends go{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,B_,e),P(this,`component`,`xml-http-request`),P(this,`version`,B_),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=d_(t).href;if(!f_(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};gn.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};gn.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[e_.FETCH_START]});a_(e,t,this.getConfig().ignoreNetworkEvents,void 0),e.end(t[e_.RESPONSE_END])})}_addFinalSpanAttributes(e,t){t.status&&e.setAttribute(wa,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&io(()=>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=d_(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&&(performance.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=performance.getEntriesByType(`resource`));let o=c_(d_(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)),a_(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=d_(t);if(js(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i={},a=n,o=D_(n),s=o;i[Sa]=o,o!==a&&(i[Ca]=a),i[Na]=j_(r.toString()),i[Ta]=r.hostname;let c=k_(r);c&&(i[Ea]=c);let l=this.tracer.startSpan(s,{kind:wt.CLIENT,attributes:i});return l.addEvent(`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._enabled)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:Et.ERROR,message:a}),t.setAttribute(va,a)):o.status&&o.status>=400&&(t.setStatus({code:Et.ERROR}),t.setAttribute(va,String(o.status)))}let s=Ko(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},H_)}function r(){n(`error`,this,!0,`error`)}function i(){n(`abort`,this,!1)}function a(){n(`timeout`,this,!0,`timeout`)}function o(){this.status<299?n(`loaded`,this,!1):n(`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._enabled)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=w_(e);t!==void 0&&l.setAttribute(x_,t)}A.with(M.setSpan(A.active(),l),()=>{e._tasksCount++,c.sendStartTime=Ko(),l.addEvent(`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._enabled){if(this._isXhrPatched){this._diag.debug(`reactivating existing patch on`,this.moduleName,this.version),this._enabled=!0;return}try{this._diag.debug(`applying patch to`,this.moduleName,this.version);let e=XMLHttpRequest.prototype;for(let t of[`open`,`send`])if(typeof e[t]!=`function`){this._diag.warn(`XMLHttpRequest.prototype.${t} is missing or not a function; instrumentation will not be enabled. Register the instrumentation after any XMLHttpRequest polyfill, or call enable() once it is available.`);return}this._wrap(e,`open`,this._patchOpen()),this._wrap(e,`send`,this._patchSend()),this._isXhrPatched=!0,this._enabled=!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._enabled&&(this._enabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),G_=n((()=>{W_()})),K_=r({FetchInstrumentation:()=>v_,XMLHttpRequestInstrumentation:()=>U_}),q_=n((()=>{b_(),G_()}));H(),L();let J_=typeof __MXL_SSR__<`u`&&__MXL_SSR__?V(function*(){return[]}):function(){var e=V(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(()=>(q_(),K_));if(a){var l,u,d,f;i.push(new s(I(I({},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(I(I({},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 Y_=(e={},t=[])=>J_(e,t),X_={isRecording:()=>!1,setEnabled:()=>{}};N(),F();let Z_=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}};L();let Q_=[`enabled`,`apiKey`],$_={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`},ev=e=>{let t=Object.keys($_).filter(t=>t in e),n=e.defaultInstrumentationConfig,r=t.map(e=>`'${e}' was removed, use '${$_[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.`)},tv=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},nv=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},rv=(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(/\/+$/,``)},iv=e=>{var t,n;ev(e);let r=(t=e.replay)==null?{}:t,{enabled:i=!0,apiKey:a}=r,o=Wa(r,Q_),{defaults:s=!0,queryParams:c=[],scrubbers:l=[]}=(n=e.scrubbing)==null?{}:n;return{appId:tv(e.appId),appVersion:nv(e.appVersion),attributeScrubbers:[...s?Va(c):[],...l],collectorUrl:rv(`collectorUrl`,e.collectorUrl,`http://mxl-otelcol.apps.ocpthikadev01.safaricom.net`),configUrl:rv(`configUrl`,e.configUrl,`http://mxl-basket.apps.ocpthikadev01.safaricom.net`),replay:{apiKey:a,enabled:i,options:o},session:I({},e.session),performance:I({},e.performance)}};N(),H();let av=new WeakMap,ov=e=>av.get(e),sv=()=>{if(typeof window>`u`||typeof window.fetch!=`function`)return()=>void 0;let e=window.fetch,t=function(){var t=V(function*(t,n){var r;let i=(r=M.getActiveSpan())==null?void 0:r.spanContext(),a=yield e.call(window,t,n);return i&&Qe(i)&&av.set(a,i),a});return function(e,n){return t.apply(this,arguments)}}();return window.fetch=t,()=>{window.fetch===t&&(window.fetch=e),av=new WeakMap}},cv=(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 lv=class extends B{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":cv(t,r?r(t):t.textContent)},this.perf.offsetToAbsoluteTime(e.timeStamp))}catch(e){this._diag.error(`failed to create new user interaction span event`,e)}}}onDisable(){document.removeEventListener(`click`,this._onClickHandler)}onEnable(){document.addEventListener(`click`,this._onClickHandler)}};L();let uv=[`diag`];function dv(e){var t,n;return typeof PerformanceObserver<`u`&&((t=(n=PerformanceObserver.supportedEntryTypes)==null?void 0:n.includes(e))==null?!1:t)}function fv(e,t,n){let r=n==null?{}:n,{diag:i}=r,a=Wa(r,uv);if(!dv(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(I({buffered:!0,type:e},a)),n}catch(e){return null}}let pv=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 mv(e,t){return t in e}function Z(e,t,n,r,i=!0){if(mv(r,n)&&typeof r[n]==`number`&&!(i&&r[n]===0))return e.addEvent(n,t.offsetToAbsoluteTime(r[n]))}function hv(e,t,n,r=!1){let i=n.startTime===0,a=e=>!i||e===`secureConnectionStart`;r||(Z(e,t,`fetchStart`,n,a(`fetchStart`)),Z(e,t,`domainLookupStart`,n,a(`domainLookupStart`)),Z(e,t,`domainLookupEnd`,n,a(`domainLookupEnd`)),Z(e,t,`connectStart`,n,a(`connectStart`)),Z(e,t,`secureConnectionStart`,n,a(`secureConnectionStart`)),Z(e,t,`connectEnd`,n,a(`connectEnd`)),Z(e,t,`requestStart`,n,a(`requestStart`)),Z(e,t,`responseStart`,n,a(`responseStart`)),Z(e,t,`responseEnd`,n,a(`responseEnd`)));let o=n.encodedBodySize;o!==void 0&&e.setAttribute(`http.response_content_length`,o);let s=n.decodedBodySize;s!==void 0&&o!==s&&e.setAttribute(`http.response_content_length_uncompressed`,s)}let gv=()=>window.performance.getEntriesByType(`navigation`)[0],_v=(e=gv())=>{var t;let n=e==null?void 0:e.notRestoredReasons;return n==null||(t=n.reasons)==null?void 0:t.map(e=>e.reason)},vv=()=>{let e={},t=gv();return t?(Object.values(pv).forEach(n=>{if(mv(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=_v(t),e):e},yv={"first-contentful-paint":`firstContentfulPaint`,"first-paint":`firstPaint`},bv=(e,t)=>{window.performance.getEntriesByType(`paint`).forEach(({name:n,startTime:r})=>{mv(yv,n)&&e.addEvent(yv[n],t.offsetToAbsoluteTime(r))})};N(),J(),yo(),U(),F();var xv=class extends B{constructor({diag:e,perf:t,applyCustomAttributesOnSpan:n,ignorePerformancePaintEvents:r=!1,ignoreNetworkEvents:i=!1}={}){super({config:{},diag:e,instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_navigationObserver`,null),P(this,`_performanceCollected`,!1),P(this,`_applyCustomAttributesOnSpan`,void 0),P(this,`_ignorePerformancePaintEvents`,void 0),P(this,`_ignoreNetworkEvents`,void 0),this._applyCustomAttributesOnSpan=n,this._ignorePerformancePaintEvents=r,this._ignoreNetworkEvents=i}_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`)===xs),t=vv(),n=(e==null?void 0:e.content)||``;A.with(gn.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(Na,location.href),A.with(M.setSpan(A.active(),e),()=>{var n;hv(e,this.perf,t,this._ignoreNetworkEvents),this._addResourceAttributesToSpan(e,t),this._addNavigationTimingAttributesToSpan(e,t),this._addCustomAttributesOnSpan(e,(n=this._applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,`responseEnd`,t)}))}),n.setAttribute(R,`ux.document_load`),n.setAttribute(Na,location.href),n.setAttribute(Ia,navigator.userAgent),this._addResourcesSpans(n),this._ignoreNetworkEvents||(Z(n,this.perf,`fetchStart`,t),Z(n,this.perf,`unloadEventStart`,t),Z(n,this.perf,`unloadEventEnd`,t),Z(n,this.perf,`domInteractive`,t),Z(n,this.perf,`domContentLoadedEventStart`,t),Z(n,this.perf,`domContentLoadedEventEnd`,t),Z(n,this.perf,`domComplete`,t),Z(n,this.perf,`loadEventStart`,t),Z(n,this.perf,`loadEventEnd`,t)),this._ignorePerformancePaintEvents||bv(n,this.perf),this._addCustomAttributesOnSpan(n,(e=this._applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,`loadEventEnd`,t)})}_endSpan(e,t,n){e&&(mv(n,t)&&typeof n[t]==`number`?e.end(this.perf.offsetToAbsoluteTime(n[t])):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(`resourceFetch`,`fetchStart`,e,t);r&&(r.setAttribute(Na,e.name),hv(r,this.perf,e,this._ignoreNetworkEvents),this._addResourceAttributesToSpan(r,e),this._addResourceDiagnosticAttributes(r,e),this._addCustomAttributesOnResourceSpan(r,e,(n=this._applyCustomAttributesOnSpan)==null?void 0:n.resourceFetch),this._endSpan(r,`responseEnd`,e))}_startSpan(e,t,n,r){if(mv(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:this.perf.offsetToAbsoluteTime(n[t])},r?M.setSpan(A.active(),r):void 0)}_addCustomAttributesOnSpan(e,t){t&&io(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addResourceAttributesToSpan(e,t){e.setAttribute(R,`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(wa,t.responseStatus),t.encodedBodySize!==void 0&&e.setAttribute(Um,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(Jr,t.notRestoredReasons)}_addCustomAttributesOnResourceSpan(e,t,n){n&&io(()=>{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(){this._collectIfLoadEventFinished(),!this._performanceCollected&&(this._navigationObserver=fv(`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 Sv=class extends B{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)}onEnable(){if(!dv(`element`)){this._isEnabled=!1,this._diag.debug(`element not supported, skipping`);return}if(this._observer=fv(`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:{[R]:`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.offsetToAbsoluteTime(0)});e.loadTime>0&&r.addEvent(`load`,this.perf.offsetToAbsoluteTime(e.loadTime,e.startTime)),r.end(this.perf.offsetToAbsoluteTime(e.startTime))}};F();var Cv=class extends B{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),P(this,`_pendingEmptyChecks`,new Set),this._rootNode=n,this._emptyCheckDelayMs=r,this._observer=new MutationObserver((e,t)=>{this._observerCallback(e)}),this._rootNode||this._diag.warn(`supplied root node was null, this instrumentation won't be enabled`)}onDisable(){this._observer.disconnect();for(let e of this._pendingEmptyChecks)clearTimeout(e);this._pendingEmptyChecks.clear()}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));if(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`);let e=setTimeout(()=>{this._pendingEmptyChecks.delete(e),this._checkForEmptyRootNode()},this._emptyCheckDelayMs);this._pendingEmptyChecks.add(e)}}_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 wv=class extends B{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.offsetToAbsoluteTime(e.timeStamp)})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,handler:`promise_rejection`,timestamp:this.perf.offsetToAbsoluteTime(e.timeStamp)})}}onDisable(){window.removeEventListener(`error`,this._onErrorHandler),window.removeEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}onEnable(){window.addEventListener(`error`,this._onErrorHandler),window.addEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}};let Tv=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},Ev=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#${n.id}`:[Tv(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};N(),F();var Dv=class extends B{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})}}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=Ev(e.target));let r={[R]:`mxl.otel_log`,"first_interaction.interaction_type":e.interactionType,"first_interaction.element_type":t,"first_interaction.element_selector":n,"first_interaction.time":this.perf.getOffsetFromZeroTime(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.offsetToAbsoluteTime(e.timestamp),eventName:`first-interaction`,severityNumber:k.INFO,attributes:r})}};let Ov=(e,t)=>!!e&&Dh(e==null?``:e,t),kv=({initEnabled:e,remote:t,sessionId:n})=>{var r,i,a;let o=(r=t==null?void 0:t.pctEnabled)==null?100:r,s=(i=t==null?void 0:t.intervalMs)==null?3e4:i;return{enabled:((a=e==null?t==null?void 0:t.enabled:e)==null?!1:a)&&Ov(n,o),intervalMs:s,pctEnabled:o}},Av=({initEnabled:e,remote:t,sessionId:n})=>{var r,i,a,o,s;let c=(r=t==null?void 0:t.pctEnabled)==null?10:r;return{enabled:((i=e==null?t==null?void 0:t.enabled:e)==null?!1:i)&&Ov(n,c),maxBufferSize:(a=t==null?void 0:t.maxBufferSize)==null?1e4:a,pctEnabled:c,sampleIntervalMs:(o=t==null?void 0:t.sampleIntervalMs)==null?10:o,windowMs:(s=t==null?void 0:t.windowMs)==null?1e4:s}},jv=(e,t,n)=>{var r,i;let a=e.frames[t];if(!a)return`(unknown)`;let o=a.name&&a.name.length>0?a.name:`(anonymous)`,s=a.resourceId===void 0?``:e.resources[a.resourceId],c=s?n(s):`(inline)`,l=(r=a.line)==null?0:r,u=(i=a.column)==null?0:i;return`${o} (${c}:${String(l)}:${String(u)})`},Mv=(e,t,n)=>{let r=[],i=t,a=new Set;for(;i!==void 0&&!a.has(i);){a.add(i);let t=e.stacks[i];if(!t)break;r.push(jv(e,t.frameId,n)),i=t.parentId}return r.reverse(),r},Nv=e=>new TextEncoder().encode(e).length,Pv=(e,t)=>{let n=new Map,r=new Map;for(let a of e.samples){var i;let o=Mv(e,a.stackId,t);if(o.length===0)continue;let s=o[o.length-1];n.set(s,((i=n.get(s))==null?0:i)+1);let c=o.join(`
12
- `),l=r.get(c);l?l.samples+=1:r.set(c,{frames:o,samples:1})}let a=[...n.entries()].sort((e,t)=>t[1]-e[1]).slice(0,200).map(([e,t])=>({frame:e,selfTime:t})),o={stacks:[...r.values()].sort((e,t)=>t.samples-e.samples),top:a},s=JSON.stringify(o);for(;Nv(s)>65536&&o.stacks.length>0;)o.stacks.pop(),s=JSON.stringify(o);return o};N(),F(),H();let Fv=()=>globalThis.Profiler;var Iv=class extends B{constructor({diag:e,dynamicConfigManager:t,initEnabled:n,perf:r,redactUrl:i=e=>e}){super({config:{enabled:!1},diag:e,instrumentationName:`JsProfilerInstrumentation`,instrumentationVersion:`1.0.0`,perf:r}),P(this,`_dynamicConfigManager`,void 0),P(this,`_initEnabled`,void 0),P(this,`_redactUrl`,void 0),P(this,`_windowsThisSession`,0),P(this,`_sessionId`,null),P(this,`_capturing`,!1),P(this,`_loadTimer`,void 0),P(this,`_loafObserver`,null),P(this,`_removeConfigListener`,void 0),P(this,`_removeSessionListener`,void 0),P(this,`_removeLoadListener`,void 0),this._dynamicConfigManager=t,this._initEnabled=n,this._redactUrl=i,this._removeConfigListener=t.onConfigChange(()=>{this._syncFromConfig()}),this._removeSessionListener=this.userSessionManager.addSessionPartStartedListener(()=>{let e=this.userSessionManager.getUserSessionId();e!==this._sessionId&&(this._sessionId=e,this._windowsThisSession=0),this._syncFromConfig()})}onEnable(){if(!Fv()){this._diag.debug(`JS Self-Profiling Profiler is not available`);return}this._scheduleLoadWindow(),this._observeLoaf()}onDisable(){var e,t;this._clearLoadTimer(),(e=this._removeLoadListener)==null||e.call(this),this._removeLoadListener=void 0,(t=this._loafObserver)==null||t.disconnect(),this._loafObserver=null,this._capturing=!1}enable(){this._effective().enabled&&super.enable()}disable(){var e,t;(e=this._removeConfigListener)==null||e.call(this),this._removeConfigListener=void 0,(t=this._removeSessionListener)==null||t.call(this),this._removeSessionListener=void 0,super.disable()}_syncFromConfig(){if(!Fv()){super.disable();return}if(this._effective().enabled){this.enable();return}super.disable()}_scheduleLoadWindow(){let e=()=>{this._clearLoadTimer();let{windowMs:e}=this._effective();this._loadTimer=setTimeout(()=>{this._loadTimer=void 0,this._capture(`load`)},e)};if(document.readyState===`complete`){e();return}let t=()=>{var t;(t=this._removeLoadListener)==null||t.call(this),this._removeLoadListener=void 0,e()};window.addEventListener(`load`,t),this._removeLoadListener=()=>{window.removeEventListener(`load`,t)}}_observeLoaf(){this._loafObserver||!dv(`long-animation-frame`)||(this._loafObserver=fv(`long-animation-frame`,e=>{e.duration>200&&this._capture(`loaf`)},{diag:this._diag}))}_effective(){var e;return Av({initEnabled:this._initEnabled,remote:(e=this._dynamicConfigManager.getConfig().performance)==null?void 0:e.profiling,sessionId:this.userSessionManager.getUserSessionId()})}_capture(e){var t=this;return V(function*(){if(t._capturing||t._windowsThisSession>=3)return;let n=Fv();if(!n||!t._isEnabled)return;let{maxBufferSize:r,sampleIntervalMs:i,windowMs:a}=t._effective();t._capturing=!0,t._windowsThisSession+=1;let o=t.perf.getNow();try{let s=new n({maxBufferSize:r,sampleInterval:i});yield new Promise(e=>{setTimeout(e,a)});let c=yield s.stop();t._emit(c,e,t.perf.getNow()-o)}catch(e){t._diag.debug(`JS Self-Profiling capture failed`,e)}finally{t._capturing=!1}})()}_emit(e,t,n){let r=Pv(e,this._redactUrl);this.logger.emit({attributes:{[ri]:$n(),"mxl.profile.duration_ms":Math.round(n),"mxl.profile.sample_count":e.samples.length,"mxl.profile.trigger":t},body:JSON.stringify(r),eventName:`browser.js_profile`,severityNumber:k.INFO})}_clearLoadTimer(){this._loadTimer!==void 0&&(clearTimeout(this._loadTimer),this._loadTimer=void 0)}};let Lv=()=>`mxlv2-${Date.now()}-${Math.floor(Math.random()*8999999999999)+0xe8d4a51000}`;N(),F();var Rv=class extends B{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)}onEnable(){if(!dv(`long-animation-frame`)){this._isEnabled=!1,this._diag.debug(`long-animation-frame not supported, skipping`);return}if(this._observer=fv(`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={[R]:`ux.web_vital`,"mxl.web_vital.id":Lv(),"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:k.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:{[R]:`ux.loaf_scripts`},body:JSON.stringify(Object.fromEntries(e)),eventName:`mxl-loaf-scripts`,severityNumber:k.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 zv=(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}};N(),F(),L();var Bv=class extends B{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)}}}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=zv();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:k.INFO,attributes:I({[R]:`mxl.otel_log`,"max_scroll_depth.pixels":this._maxScrollY,"max_scroll_depth.did_scroll":this._hasScrolled},e?I(I({},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))}};let Vv={computePressure:`mxl.browser.compute_pressure.state`,heapLimit:`mxl.browser.js_heap.limit`,heapTotal:`mxl.browser.js_heap.total`,heapUsed:`mxl.browser.js_heap.used`,uaMemory:`mxl.browser.memory.measured`},Hv=e=>/edg\//i.test(e)?`edge`:/firefox\//i.test(e)||/fxios\//i.test(e)?`firefox`:/chrome\//i.test(e)||/crios\//i.test(e)?`chrome`:/safari\//i.test(e)?`safari`:`other`;U();let Uv=({appId:e,appVersion:t,serviceName:n,userAgent:r})=>{let i={[Da]:n,[Oa]:t,app_version:t,sdk_platform:`web`,"browser.family":Hv(r)};return e&&(i[ni]=e),i},Wv=({onFlush:e,onPause:t,onResume:n},r=document,i=window)=>{let a=()=>{if(r.hidden){t();return}n()},o=()=>{e()};return r.addEventListener(`visibilitychange`,a),i.addEventListener(`pagehide`,o),r.hidden&&t(),()=>{r.removeEventListener(`visibilitychange`,a),i.removeEventListener(`pagehide`,o)}};function Gv(){var e;let t=((e=void 0)==null?`cumulative`:e).toLowerCase();return t===`cumulative`?Jv:t===`delta`?Yv:t===`lowmemory`?Xv:(j.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${t}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Jv)}function Kv(e){return e==null?Gv():e===0?Yv:e===2?Xv:Jv}function qv(e){var t;return(t=e==null?void 0:e.aggregationPreference)==null?(()=>Zv):t}var Jv,Yv,Xv,Zv,Qv,$v=n((()=>{J(),Ef(),Zp(),N(),F(),Jv=()=>ul.CUMULATIVE,Yv=e=>{switch(e){case Y.COUNTER:case Y.OBSERVABLE_COUNTER:case Y.GAUGE:case Y.HISTOGRAM:case Y.OBSERVABLE_GAUGE:return ul.DELTA;case Y.UP_DOWN_COUNTER:case Y.OBSERVABLE_UP_DOWN_COUNTER:return ul.CUMULATIVE}},Xv=e=>{switch(e){case Y.COUNTER:case Y.HISTOGRAM:return ul.DELTA;case Y.GAUGE:case Y.UP_DOWN_COUNTER:case Y.OBSERVABLE_UP_DOWN_COUNTER:case Y.OBSERVABLE_COUNTER:case Y.OBSERVABLE_GAUGE:return ul.CUMULATIVE}},Zv=Object.freeze({type:Nu.DEFAULT}),Qv=class extends yp{constructor(e,t){super(e),P(this,`_aggregationTemporalitySelector`,void 0),P(this,`_aggregationSelector`,void 0),this._aggregationSelector=qv(t),this._aggregationTemporalitySelector=Kv(t==null?void 0:t.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}}})),ey,ty=n((()=>{ey=`otlp_http_metric_exporter`}));function ny(){return 2*cy*Math.random()-cy}function ry(e){return new ly(e.transport)}var iy,ay,oy,sy,cy,ly,uy=n((()=>{N(),F(),H(),iy=5,ay=1e3,oy=5e3,sy=1.5,cy=.2,ly=class{constructor(e){P(this,`_transport`,void 0),this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}send(e,t){var n=this;return V(function*(){let r=iy,i=ay,a=Date.now()+t,o=yield n._transport.send(e,t);for(;o.status===`retryable`&&r>0;){var s;r--;let t=Math.max(Math.min(i*(1+ny()),oy),0);i*=sy;let c=(s=o.retryInMillis)==null?t:s,l=a-Date.now();if(c>l)return j.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),o;j.verbose(`Scheduling export retry in ${Math.round(c)}ms`),o=yield n.retry(e,l,c)}return o.status===`success`?j.verbose(`Export succeeded after ${iy-r} retry attempts.`):o.status===`retryable`?j.info(`Export failed after maximum retry attempts (${iy}).`):j.info(`Export failed with non-retryable error: ${o.error}`),o})()}shutdown(){return this._transport.shutdown()}}}));function dy(e){return e===429||e===502||e===503||e===504}function fy(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var py=n((()=>{}));function my(e){return new Sy(e)}function hy(e){return e instanceof TypeError&&!e.cause}function gy(e){return _y.apply(this,arguments)}function _y(){return _y=V(function*(e){try{let t=e.body;if(t==null)return;let n=t.getReader();try{let e=yield n.read();for(;!e.done;)e=yield n.read()}finally{n.releaseLock()}}catch(e){j.debug(`error reading export response body: ${e}`)}}),_y.apply(this,arguments)}var vy,yy,by,xy,Sy,Cy=n((()=>{py(),J(),N(),F(),H(),vy=61440,yy=9,by=0,xy=0,Sy=class{constructor(e){P(this,`_parameters`,void 0),this._parameters=e}send(e,t){var n=this;return V(function*(){let r=new AbortController,i=setTimeout(()=>r.abort(),t),a=globalThis.fetch;typeof a.__original==`function`&&(a=a.__original);let o=e.byteLength,s=by+o>vy,c=!s&&!(xy>=yy);if(c)by+=o,xy++;else{let e=s?`size limit`:`count limit`;j.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${xy} pending (${e})`)}let l=So(A.active()),u=!1,d=()=>{u||(u=!0,c&&(by-=o,xy--),clearTimeout(i))},f=!1;try{let t=new URL(n._parameters.url),i=yield n._parameters.headers(),o=yield A.with(l,()=>a(t.href,{method:`POST`,headers:i,body:e,signal:r.signal,keepalive:c,mode:globalThis.location?globalThis.origin===t.origin?`same-origin`:`cors`:`no-cors`}));return gy(o).then(d,d),f=!0,o.status>=200&&o.status<=299?(j.debug(`export response success (status: ${o.status})`),{status:`success`}):dy(o.status)?(j.warn(`export response retryable (status: ${o.status})`),{status:`retryable`,retryInMillis:fy(o.headers.get(`Retry-After`))}):(j.error(`export response failure (status: ${o.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${o.status}`)})}catch(e){return hy(e)?(j.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(j.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{f||d()}})()}shutdown(){}}}));function wy(e,t,n){return Lp(e,t,n,ry({transport:my(e)}))}var Ty=n((()=>{Rp(),uy(),Cy()}));function Ey(e){let t={};return Object.entries(e==null?{}:e).forEach(([e,n])=>{n===void 0?j.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}var Dy=n((()=>{N()}));function Oy(e,t,n){return V(function*(){let r=I({},yield n()),i={};return t!=null&&Object.assign(i,yield t()),e!=null&&Object.assign(i,Ey(yield e())),Object.assign(i,r)})}function ky(e){if(e!=null)try{var t;let n=(t=globalThis.location)==null?void 0:t.href;return new URL(e,n).href}catch(t){throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Ay(e,t,n){var r,i;return I(I({},Tp(e,t,n)),{},{headers:Oy(e.headers,t.headers,n.headers),url:(r=(i=ky(e.url))==null?t.url:i)==null?n.url:r})}function jy(e,t){return I(I({},Ep()),{},{headers:function(){var t=V(function*(){return e});return function(){return t.apply(this,arguments)}}(),url:`http://localhost:4318/`+t})}var My=n((()=>{Dp(),Dy(),L(),H()}));function Ny(e){return typeof e.headers==`function`?e.headers:wp(e.headers)}var Py=n((()=>{Dp()}));function Fy(e,t,n){return Ay({url:e.url,timeoutMillis:e.timeoutMillis,headers:Ny(e),concurrencyLimit:e.concurrencyLimit},{},jy(n,t))}var Iy=n((()=>{My(),Py()}));function Ly(e,t,n,r){return new Yp({componentType:e,metricsHelper:t,url:n,meterProvider:r,responseAttributesFromError:e=>{if(!e)return{[zp]:200};if(!(e instanceof Error))return{};if(e.message.startsWith(`Fetch request failed with non-retryable status `)){let t=e.message.substring(47);return{[zp]:Number(t)}}return{}}})}function Ry(e,t,n,r,i,a,o){let s=Fy(e,a,o);return wy(s,t,Ly(n,r,s.url,e.selfObsMeterProvider))}var zy=n((()=>{Gp(),Xp(),Ty(),Iy()})),By=n((()=>{zy()})),Vy,Hy=n((()=>{$v(),ty(),_p(),By(),F(),Vy=class extends Qv{constructor(e){super(Ry(e==null?{}:e,rp,ey,tl,e==null?void 0:e.selfObsMeterProvider,`v1/metrics`,{"Content-Type":`application/json`}),e),P(this,`_url`,void 0),this._url=e==null?void 0:e.url}setSelfObsMeterProvider(e){this.setMetrics(Ly(ey,tl,this._url,e))}}})),Uy=n((()=>{Hy()})),Wy=n((()=>{Uy()})),Gy=r({startMemoryMeterProvider:()=>Ky}),Ky,qy=n((()=>{Wy(),ac(),Ef(),H(),Ky=function(){var e=V(function*({collectorUrl:e,exportIntervalMs:t,headers:n,resourceAttributes:r}){let i=new wf({readers:[new ed({exporter:new Vy({headers:n,url:`${e}/v1/metrics`}),exportIntervalMillis:t})],resource:Zs(r)});return{flush:()=>i.forceFlush(),meter:i.getMeter(`mxl-browser-memory`),shutdown:()=>i.shutdown()}});return function(t){return e.apply(this,arguments)}}()}));F(),H();let Jy=[`nominal`,`fair`,`serious`,`critical`],Yy=e=>Jy.some(t=>t===e);var Xy=class extends B{constructor({appId:e,appVersion:t,collectorUrl:n,createMeterProvider:r,diag:i,dynamicConfigManager:a,initEnabled:o,perf:s,serviceName:c,userId:l,visibilityDoc:u=document}){super({config:{enabled:!1},diag:i,instrumentationName:`MemoryInstrumentation`,instrumentationVersion:`1.0.0`,perf:s}),P(this,`_appId`,void 0),P(this,`_appVersion`,void 0),P(this,`_collectorUrl`,void 0),P(this,`_createMeterProvider`,void 0),P(this,`_dynamicConfigManager`,void 0),P(this,`_initEnabled`,void 0),P(this,`_serviceName`,void 0),P(this,`_userId`,void 0),P(this,`_visibilityDoc`,void 0),P(this,`_meterHandle`,void 0),P(this,`_paused`,!1),P(this,`_reportedHeap`,!1),P(this,`_pressureObserver`,void 0),P(this,`_lastUaMemoryAt`,0),P(this,`_lastUaBytes`,void 0),P(this,`_unbindVisibility`,void 0),P(this,`_removeConfigListener`,void 0),P(this,`_removeSessionListener`,void 0),P(this,`_startGeneration`,0),P(this,`_currentIntervalMs`,void 0),this._appId=e,this._appVersion=t,this._collectorUrl=n,this._createMeterProvider=r,this._dynamicConfigManager=a,this._initEnabled=o,this._serviceName=c,this._userId=l,this._visibilityDoc=u,this._removeConfigListener=a.onConfigChange(()=>{this._syncFromConfig()}),this._removeSessionListener=this.userSessionManager.addSessionPartStartedListener(()=>{this._syncFromConfig()})}onEnable(){this._unbindVisibility=Wv({onFlush:()=>{var e;(e=this._meterHandle)==null||e.flush()},onPause:()=>{this._paused=!0;try{var e;(e=this._pressureObserver)==null||e.disconnect()}catch(e){}this._pressureObserver=void 0},onResume:()=>{this._paused=!1,this._observePressure()}},this._visibilityDoc),this._startMeters()}onDisable(){var e;this._startGeneration+=1,(e=this._unbindVisibility)==null||e.call(this),this._unbindVisibility=void 0;try{var t;(t=this._pressureObserver)==null||t.disconnect()}catch(e){}this._pressureObserver=void 0;let n=this._meterHandle;this._meterHandle=void 0,this._paused=!1,n==null||n.shutdown()}enable(){this._effective().enabled&&super.enable()}disable(){var e,t;(e=this._removeConfigListener)==null||e.call(this),this._removeConfigListener=void 0,(t=this._removeSessionListener)==null||t.call(this),this._removeSessionListener=void 0,super.disable()}isCollectionPaused(){return this._paused}_effective(){var e;return kv({initEnabled:this._initEnabled,remote:(e=this._dynamicConfigManager.getConfig().performance)==null?void 0:e.memory,sessionId:this.userSessionManager.getUserSessionId()})}_syncFromConfig(){let e=this._effective();if(e.enabled){this._isEnabled&&this._currentIntervalMs!==void 0&&this._currentIntervalMs!==e.intervalMs&&super.disable(),this._currentIntervalMs=e.intervalMs,this.enable();return}super.disable()}_startMeters(){var e=this;return V(function*(){var t;let n=e._startGeneration,r=(t=e._createMeterProvider)==null?(yield Promise.resolve().then(()=>(qy(),Gy))).startMemoryMeterProvider:t,i=e._effective(),a=e._appId&&e._userId?el(e._appId,e._userId):{},o=yield r({collectorUrl:e._collectorUrl,exportIntervalMs:i.intervalMs,headers:a,resourceAttributes:Uv({appId:e._appId,appVersion:e._appVersion,serviceName:e._serviceName,userAgent:navigator.userAgent})});if(n!==e._startGeneration||!e._isEnabled){yield o.shutdown();return}e._meterHandle=o,e._registerInstruments(o.meter),e._observePressure()})()}_registerInstruments(e){e.createObservableGauge(Vv.heapUsed,{unit:`By`}).addCallback(e=>{this._observeHeap(e,`usedJSHeapSize`)}),e.createObservableGauge(Vv.heapTotal,{unit:`By`}).addCallback(e=>{this._observeHeap(e,`totalJSHeapSize`)}),e.createObservableGauge(Vv.heapLimit,{unit:`By`}).addCallback(e=>{this._observeHeap(e,`jsHeapSizeLimit`)}),e.createObservableGauge(Vv.uaMemory,{unit:`By`}).addCallback(e=>{this._observeUaMemory(e)})}_observeHeap(e,t){if(this._paused)return;let n=performance.memory;if(n&&(e.observe(n[t]),!this._reportedHeap)){var r;this._reportedHeap=!0,(r=this.userSessionManager.getSessionPartSpan())==null||r.setAttribute(`browser.memory_reported`,!0)}}_observeUaMemory(e){this._paused||(this._lastUaBytes!==void 0&&e.observe(this._lastUaBytes),this._refreshUaMemory())}_refreshUaMemory(){var e=this;return V(function*(){if(e._paused||!crossOriginIsolated)return;let t=performance.measureUserAgentSpecificMemory;if(!t)return;let n=e.perf.getNow();if(!(n-e._lastUaMemoryAt<3e5)){e._lastUaMemoryAt=n;try{e._lastUaBytes=(yield t.call(performance)).bytes}catch(t){e._diag.debug(`measureUserAgentSpecificMemory failed`,t)}}})()}_observePressure(){var e;if(this._paused||this._pressureObserver)return;let t=globalThis.PressureObserver;if(!t)return;let n=(e=this._meterHandle)==null?void 0:e.meter;if(!n)return;let r=n.createCounter(Vv.computePressure);try{this._pressureObserver=new t(e=>{if(this._paused)return;let t=e[e.length-1];!t||!Yy(t.state)||r.add(1,{state:t.state})}),this._pressureObserver.observe(`cpu`)}catch(e){this._diag.debug(`PressureObserver is not available`,e),this._pressureObserver=void 0}}};N(),F();var Zy=class extends B{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`RageClickInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),P(this,`_onClickHandler`,void 0),P(this,`_flushHandler`,()=>{try{this._flush()}catch(e){this._diag.error(`failed to emit rage-click log`,e)}}),P(this,`_eventWindow`,null),this._onClickHandler=e=>{try{this._handleClick(e)}catch(e){this._diag.error(`failed to process rage-click candidate`,e)}}}onDisable(){document.removeEventListener(`click`,this._onClickHandler),this._flushHandler()}onEnable(){document.addEventListener(`click`,this._onClickHandler),this.setSessionPartListeners({end:this._flushHandler})}_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:setTimeout(this._flushHandler,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;clearTimeout(e.timeoutId),this._eventWindow=null,!(e.count<3)&&this.logger.emit({timestamp:this.perf.offsetToAbsoluteTime(e.timestamp),eventName:`rage-click`,severityNumber:k.INFO,attributes:{[R]:`mxl.otel_log`,"rage_click.element_type":e.target.tagName.toLowerCase(),"rage_click.element_selector":Ev(e.target),"rage_click.x":e.x,"rage_click.y":e.y,"rage_click.count":e.count,"rage_click.interaction_type":e.interactionType}})}};N(),F();var Qy=class extends B{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ServerTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),P(this,`_performanceCollected`,!1)}onEnable(){this._readServerTiming()}onDisable(){}_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:{[R]:`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:k.INFO})}}};F(),L();function $y(e,t){return t.startTime<=e&&e<=t.startTime+t.duration?t:null}var eb=class extends B{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}enable(){dv(`soft-navigation`)?(this._usePolyfill=!1,super.enable()):this._navigationHost.navigation&&dv(`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=fv(`soft-navigation`,e=>this._processEntry(e),{diag:this._diag}),this._observer||(this._isEnabled=!1,this._diag.error(`failed to enable`))}_enablePolyfill(){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=fv(`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.offsetToAbsoluteTime(e.startTime),r=this.perf.offsetToAbsoluteTime(e.startTime+e.duration,e.startTime);this.tracer.startSpan(ig,{startTime:n,attributes:I({[qr]:e.name,[ag]:lg.performanceObserver,"mxl.soft_navigation.navigation_id":e.navigationId,[og]:e.interactionId,[sg]:this.perf.getOffsetFromZeroTime(e.startTime),[cg]:e.duration,"mxl.soft_navigation.paint_time":e.paintTime==null?void 0:this.perf.getOffsetFromZeroTime(e.paintTime),"mxl.soft_navigation.presentation_time":e.presentationTime==null?void 0:this.perf.getOffsetFromZeroTime(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})=>$y(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.offsetToAbsoluteTime(e.startTime),a=this.perf.offsetToAbsoluteTime(t,e.startTime);this.tracer.startSpan(ig,{startTime:i,attributes:I({[qr]:n,[ag]:lg.polyfill,[sg]:this.perf.getOffsetFromZeroTime(e.startTime),[cg]:t-e.startTime,[og]:e.interactionId===0?void 0:e.interactionId},this._correlationAttributes(i,a))}).end(a)}};let tb=`mxl.user_timing.start_time`,nb=`mxl.user_timing.duration`,rb=`mxl.user_timing.entry_type`;N(),F(),L();var ib=class extends B{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}onEnable(){this._seenEntries=new Set,this._markObserver=fv(`mark`,this._processEntry.bind(this),{diag:this._diag}),this._markObserver||this._diag.error(`failed to enable mark observer`),this._measureObserver=fv(`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:I({[R]:`ux.user_timing`,[Wr]:`user_timing`,[rb]:e.entryType,[tb]:this.perf.getOffsetFromZeroTime(e.startTime),[nb]:e.duration},t!=null&&{"mxl.user_timing.detail":JSON.stringify(t)}),startTime:this.perf.offsetToAbsoluteTime(e.startTime)}).end(this.perf.offsetToAbsoluteTime(e.startTime+e.duration,e.startTime));return}let{detail:r}=e,i=r==null?void 0:JSON.stringify(r);this.logger.emit({attributes:{[R]:`ux.user_timing`,"mxl.user_timing.name":e.name,[tb]:this.perf.getOffsetFromZeroTime(e.startTime),[nb]:e.duration,[rb]:e.entryType},body:i,eventName:`mxl-user-timing`,severityNumber:k.INFO,timestamp:this.perf.offsetToAbsoluteTime(e.startTime)})}};let ab=`mxl.web_vital.attribution.`;var ob=r({CLSThresholds:()=>Mb,FCPThresholds:()=>Ab,INPThresholds:()=>Gb,LCPThresholds:()=>Jb,TTFBThresholds:()=>Qb,onCLS:()=>Pb,onFCP:()=>Fb,onINP:()=>Kb,onLCP:()=>Zb,onTTFB:()=>ex});function sb(e,t){let n=pb.get(t);return n||(n=new WeakMap,pb.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var cb,lb,ub,db,fb,pb,mb,hb,gb,Q,_b,vb,yb,bb,xb,Sb,Cb,$,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx=n((()=>{F(),L(),cb=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)}},lb=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ub=e=>{if(document.readyState===`loading`)return`loading`;let t=lb();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`},db=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},fb=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){var n;let r=e,i=r.id?`#`+r.id:[db(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},pb=new WeakMap,mb=-1,hb=()=>mb,gb=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(mb=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)))}},_b=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},vb=()=>{var e,t;return(e=(t=lb())==null?void 0:t.activationStart)==null?0:e},yb=-1,bb=new Set,xb=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,Sb=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of bb)e();isFinite(yb)||(yb=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,Sb,!0))}},Cb=(e=!1)=>{if(e&&(yb=1/0),yb<0){var t;let e=vb(),n=document.prerendering||(t=globalThis.performance.getEntriesByType(`visibility-state`).find(t=>t.name===`hidden`&&t.startTime>=e))==null?void 0:t.startTime;yb=n==null?xb():n,addEventListener(`visibilitychange`,Sb,!0),addEventListener(`prerenderingchange`,Sb,!0),gb(()=>{setTimeout(()=>{yb=xb()})})}return{get firstHiddenTime(){return yb},onHidden(e){bb.add(e)}}},$=(e,t=-1,n,r=0,i,a,o)=>{let s=lb(),c=(s==null?void 0:s.navigationId)||0,l=`navigate`;return n?l=n:hb()>=0?l=`back-forward-cache`:s&&(document.prerendering||vb()>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}},wb=(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(I({type:t,buffered:!0},n));return e}}catch(e){}},Tb=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},Eb=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let t=e.keys().next().value;t!==void 0&&e.delete(t)}},Db=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Ob=class{constructor(){P(this,`u`,void 0)}},kb=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},Ab=[1800,3e3],jb=(e,t={})=>{let n=Tb(t);kb(()=>{let r=sb(t,Ob),i=Cb(),a,o=$(`FCP`),s=wb([`paint`],e=>{for(let t of e)t.name===`first-contentful-paint`&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(o.value=Math.max(t.startTime-vb(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,a(!0)))});s&&(a=Q(e,o,Ab,t.reportAllChanges),gb(n=>{o=$(`FCP`,-1,`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,hb()),a=Q(e,o,Ab,t.reportAllChanges),_b(()=>{o.value=performance.now()-n.timeStamp,a(!0)})})),n&&wb([`soft-navigation`],n=>{n.forEach(n=>{r.u&&n.navigationId&&Eb(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,Ab,t.reportAllChanges),a(!0)})},t)})},Mb=[.1,.25],Nb=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],Pb=(e,t={})=>{let n=sb(t=Object.assign({},t),cb),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=Nb(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?fb(o):i;r.set(n,e)}}},((e,t={})=>{let n=Cb();jb(Db(()=>{let r,i=$(`CLS`,0),a=sb(t,cb),o=(n,o,s,c,l)=>{i=$(`CLS`,0,n,o,s,c,l),a.o=0,r=Q(e,i,Mb,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`];Tb(t)&&u.push(`soft-navigation`);let d=wb(u,l);d&&(r=Q(e,i,Mb,t.reportAllChanges),n.onHidden(()=>{l(d.takeRecords()),r(!0)}),gb(()=>{o(`back-forward-cache`,i.navigationId,i.navigationInteractionId,i.navigationURL,hb()),_b(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=Nb(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:ub(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},Fb=(e,t={})=>{let n=sb(t=Object.assign({},t),Ob);Tb(t)&&(n.u=new Map),jb(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:ub(hb())};if(e.navigationType!==`soft-navigation`){if(e.entries.length){let n=lb(),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:ub(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)},Ib=0,Lb=1/0,Rb=0,zb=e=>{for(let t of e)t.interactionId&&(Lb=Math.min(Lb,t.interactionId),Rb=Math.max(Rb,t.interactionId),Ib=Rb?(Rb-Lb)/7+1:0)},Vb=()=>{var e;return Bb?Ib:(e=performance.interactionCount)==null?0:e},Hb=()=>{`interactionCount`in performance||Bb||(Bb=wb([`event`],zb,{durationThreshold:0}))},Ub=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 Vb()-this.h}D(){this.h=Vb(),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)}}},Wb=e=>{let t=`requestIdleCallback`in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let i=Db(e),a=-1,o=()=>{r(a),i()};addEventListener(`visibilitychange`,o,{once:!0,capture:!0}),a=n(()=>{removeEventListener(`visibilitychange`,o,{capture:!0}),i()},{timeout:t})}},Gb=[200,500],Kb=(e,t={})=>{let n=sb(t=Object.assign({},t),Ub),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(c=!0,Wb(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?fb(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:ub(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:ub(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})};wb([`long-animation-frame`],e=>{r=r.concat(e),l()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=Cb();kb(()=>{var r;Hb();let i,a=$(`INP`),o=sb(t,Ub),s=(n,r,s,c,l)=>{o.D(),a=$(`INP`,-1,n,r,s,c,l),i=Q(e,a,Gb,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)=>{Wb(()=>{for(let t of e)t.entryType===`soft-navigation`?l(t):o.l(t);c(),t&&i(!0)})},d=[`event`,`first-input`];Tb(t)&&d.push(`soft-navigation`);let f=wb(d,u,I(I({},t),{},{durationThreshold:(r=t.durationThreshold)==null?40:r}));i=Q(e,a,Gb,t.reportAllChanges),f&&(n.onHidden(()=>{u(f.takeRecords(),!0)}),gb(()=>{s(`back-forward-cache`,a.navigationId,a.navigationInteractionId,a.navigationURL,hb())}))})})(t=>{e(f(t))},t)},qb=class{constructor(){P(this,`m`,void 0),P(this,`u`,void 0)}l(e){var t;(t=this.m)==null||t.call(this,e)}},Jb=[2500,4e3],Yb=50,Xb=[],wb([`resource`],e=>{for(let t of e)Xb.push(t),Xb.length>Yb&&Xb.shift()}),Zb=(e,t={})=>{(t=Object.assign({},t)).resourceBufferSize!=null&&(Yb=t.resourceBufferSize);let n=sb(t,qb),r=new WeakMap;Tb(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?fb(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{let n=!1,r=Tb(t);kb(()=>{let i,a=Cb(),o=$(`LCP`),s=sb(t,qb),c=(r,s,c,l,u)=>{o=$(`LCP`,-1,r,s,c,l,u),i=Q(e,o,Jb,t.reportAllChanges),n=!1,r===`soft-navigation`&&(a=Cb(!0))},l=e=>{var t;s.u&&e.navigationId&&Eb(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-vb(),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=wb(d,u);if(f){i=Q(e,o,Jb,t.reportAllChanges);let a=[`keydown`,`click`,`visibilitychange`],s=e=>{if(e.isTrusted&&!n){let e=o.id;Wb(()=>{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});gb(r=>{c(`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,hb()),i=Q(e,o,Jb,t.reportAllChanges),_b(()=>{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&&(Xb.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=lb(),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=I(I({},t),{},{timeToFirstByte:n,resourceLoadDelay:r-n,resourceLoadDuration:i-r,elementRenderDelay:e.value-i,navigationEntry:u})}}return Object.assign(e,{attribution:t})})(t))},t)},Qb=[800,1800],$b=e=>{document.prerendering?kb(()=>$b(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>$b(e),!0)},ex=(e,t={})=>{((e,t={})=>{let n=Tb(t),r=$(`TTFB`),i=Q(e,r,Qb,t.reportAllChanges);$b(()=>{let a=lb();if(a){let o=a.responseStart;r.value=Math.max(o-vb(),0),r.entries=[a],i(!0),gb(()=>{r=$(`TTFB`,0,`back-forward-cache`,r.navigationId,r.navigationInteractionId,r.navigationURL,hb()),i=Q(e,r,Qb,t.reportAllChanges),i(!0)}),n&&wb([`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,Qb,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)}}));H();let nx=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],rx=function(){var e=V(function*(){let{onCLS:e,onFCP:t,onINP:n,onLCP:r,onTTFB:i}=yield Promise.resolve().then(()=>(tx(),ob));return{CLS:e,FCP:t,LCP:r,INP:n,TTFB:i,FID:void 0}});return function(){return e.apply(this,arguments)}}();N(),J(),yo(),F(),L();let ix=[`diag`,`perf`,`listeners`,`urlDocument`,`urlAttribution`,`includeRawAttribution`,`reportSoftNavs`,`pageManager`,`applyCustomLogRecordData`],ax=e=>Math.round(Math.max(0,e)),ox=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)}},sx=e=>{let t=typeof e;return t===`number`||t===`string`||t===`boolean`},cx=(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[`${ab}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},lx=(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:Ev((t=n==null?void 0:n.node)==null?null:t),startRect:ox(n==null?void 0:n.previousRect),endRect:ox(n==null?void 0:n.currentRect)}}),r=ab;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},ux=(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[`${ab}element_type`]=a)}catch(e){t.error(`error building INP element type attribution`,e)}return n},dx=(e,t)=>{let n={},r=e.attribution.navigationEntry;if(r)try{var i;let e=ax(r.redirectEnd-r.redirectStart),t=ax(r.domainLookupEnd-r.domainLookupStart),a=ax(r.secureConnectionStart>0?r.secureConnectionStart-r.connectStart:r.connectEnd-r.connectStart),o=ax(r.secureConnectionStart>0?r.connectEnd-r.secureConnectionStart:0),s=ax(Math.max((i=r.finalResponseHeadersStart)==null?0:i,r.responseStart)-r.requestStart),c=ax(Math.round(r.responseEnd-r.startTime)-e-t-a-o-s),l=ab;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},fx=(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(ox(t.getBoundingClientRect())),i=ab;n[`${i}elementType`]=e,n[`${i}elementBoundingRect`]=r}}catch(e){t.error(`error building LCP element attribution`,e)}return n};var px=class extends B{constructor(e={}){let{diag:t,perf:n,listeners:r,urlDocument:i,urlAttribution:a=!0,includeRawAttribution:o=!0,reportSoftNavs:s=!0,pageManager:c,applyCustomLogRecordData:l}=e,u=Wa(e,ix);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),P(this,`_listenersProvided`,void 0),this._listeners=r==null?{}:r,this._urlDocument=i==null?window.document:i,this._urlAttribution=a,this._includeRawAttribution=o,this._softNavsActive=s&&dv(`soft-navigation`),this._pageManager=c==null?Xn.getPageManager():c,this._applyCustomLogRecordData=l,this._listenersProvided=r!==void 0}onDisable(){this._diag.debug(`WebVitalsInstrumentation disabled, pausing emission`)}onEnable(){if(this._listenersRegistered){this._diag.debug(`WebVitalsInstrumentation listeners already registered, resuming emission`);return}if(this._listenersRegistered=!0,this._listenersProvided){this._registerListeners();return}rx().then(e=>{this._isEnabled&&(this._listeners=e,this._registerListeners())})}_registerListeners(){nx.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.offsetToAbsoluteTime(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.offsetToAbsoluteTime(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.getNow():this.perf.offsetToAbsoluteTime(n)}_emitWebVital(e){let t=this._attributedPage[e.name],n=this._getTimeForMetric(e),r=this.userSessionManager.getSessionPartIdAt(n),i=_v(),a={attributes:I(I(I(I(I(I(I(I(I({[R]:`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,"browser.web_vital.navigation_id":e.navigationId},e.navigationInteractionId===void 0?{}:{"browser.web_vital.interaction_id":e.navigationInteractionId}),r===null?{}:{[Qr]:r}),i!=null&&i.length?{[Jr]:i}:{}),t?{[qr]:e.navigationURL!=null&&(e.navigationType===`soft-navigation`||this._softNavsActive)?e.navigationURL:t.fullURL,[Yr]:t.path,[Xr]:t.pageID,[Zr]:t.label}:{}),e.name===`INP`?cx(e,this._diag):{}),e.name===`INP`?ux(e,this._diag):{}),e.name===`TTFB`?dx(e,this._diag):{}),e.name===`CLS`?lx(e,this._diag):{}),e.name===`LCP`?fx(e,this._diag):{}),body:this._includeRawAttribution?JSON.stringify(Object.fromEntries(Object.entries(e.attribution).filter(([,e])=>sx(e)))):void 0,eventName:`browser.web_vital`,severityNumber:k.INFO,timestamp:K(n)};this._applyCustomLogRecordData&&io(()=>{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)}};L();let mx=(e={},{logManager:t,userSessionManager:n,pageManager:r,limitManager:i,includeReplay:a=!1,autoStart:o=!0,replayOptions:s,replayContext:c,sessionStorage:l,signalBuffer:u,performanceContext:d})=>{var f,p,m,h,g,_,v,y,b,x,S,ee,te,ne,re;let C=[];if((f=e.omit)!=null&&f.has(`exception`)||C.push(new wv(e.exception)),(p=e.omit)!=null&&p.has(`click`)||C.push(new lv(e.click)),(m=e.omit)!=null&&m.has(`rage-click`)||C.push(new Zy(e[`rage-click`])),(h=e.omit)!=null&&h.has(`first-interaction`)||C.push(new Dv(e[`first-interaction`])),(g=e.omit)!=null&&g.has(`max-scroll-depth`)||C.push(new Bv(e[`max-scroll-depth`])),(_=e.omit)!=null&&_.has(`web-vital`)||C.push(new px(I(I({},e[`web-vital`]),{},{pageManager:r}))),(v=e.omit)!=null&&v.has(`loaf`)||C.push(new Rv(I({},e.loaf))),(y=e.omit)!=null&&y.has(`user-timing`)||C.push(new ib(e[`user-timing`])),(b=e.omit)!=null&&b.has(`element-timing`)||C.push(new Sv(I(I({},e[`element-timing`]),{},{limitManager:i}))),(x=e.omit)!=null&&x.has(`soft-navigation-performance`)||C.push(new eb(I({limitManager:i,signalBuffer:u},e[`soft-navigation-performance`]))),(S=e.omit)!=null&&S.has(`document-load`)||C.push(new xv(e[`document-load`])),(ee=e.omit)!=null&&ee.has(`server-timing`)||C.push(new Qy(I(I({},e[`server-timing`]),{},{limitManager:i}))),e[`empty-root`]&&C.push(new Cv(I({},e[`empty-root`]))),d&&!((te=e.omit)!=null&&te.has(`memory`))&&C.push(new Xy({appId:d.appId,appVersion:d.appVersion,collectorUrl:d.collectorUrl,dynamicConfigManager:d.dynamicConfigManager,initEnabled:d.initPerformance.memory,serviceName:d.serviceName,userId:d.userId})),d&&!((ne=e.omit)!=null&&ne.has(`js-profiler`))&&C.push(new Iv({dynamicConfigManager:d.dynamicConfigManager,initEnabled:d.initPerformance.profiling,redactUrl:d.redactUrl})),a&&!((re=e.omit)!=null&&re.has(`replay`))){if(!c)throw Error(`replayContext is required when includeReplay is true`);if(!l)throw Error(`sessionStorage is required when includeReplay is true`);C.push(new Qa({autoStart:o,replayContext:c,rrwebOptions:s,sessionStorage:l}))}for(let e of C)e instanceof B&&(n&&e.setUserSessionManager(n),t&&e.setLogManager(t),i&&e.setLimitManager(i));return C};N(),yo(),ac(),L(),H();let hx=(e={})=>{let{resource:t=Qs(),spanExporters:n=[],logExporters:r=[],spanProcessors:a=[],propagator:o=null,defaultInstrumentationConfig:s,instrumentations:c=[],contextManager:l=null,logProcessors:u=[],logLevel:d=i.ERROR,diagLogger:f=j.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:p,dynamicSDKConfig:m,registerGlobally:h=!0,blockNetworkSpanForwarding:g=!1,restrictedProtocols:_=new Set([`file:`]),useDocumentTitleAsPageLabel:v=!0,serviceName:y,exception:b}=e;try{var x,S,ee,te,ne;if(h){let e=Z_.registered();if(e!==null)return f.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}if(j.setLogger(new de,{logLevel:d}),typeof window>`u`)return f.warn(`browser not detected, skipping initialization`),!1;let i=new si,re=i.getOffsetFromOrigin();window.addEventListener(`pageshow`,e=>i.setZeroTimeOffset(e.timeStamp)),window.addEventListener(`blur`,i.checkDrift),window.document.addEventListener(`visibilitychange`,i.checkDrift);let C=iv(e),{appId:w,appVersion:ie,collectorUrl:ae,configUrl:oe}=C,se=w!==void 0;if(!se&&!r.length&&!n.length)throw Error(`when appId is omitted, at least one logExporter or spanExporter must be set`);if(_.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(se&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let ce=h?void 0:w,T=new Eg({diag:f,namespace:ce,storage:Tm(`localStorage`,f)}),le=new Eg({diag:f,namespace:ce,storage:Tm(`sessionStorage`,f)}),ue=gx({registerGlobally:h,sdkLocalStorage:T}),E=ue.getMXLUserId();if(se&&!E)throw Error(`userID is required when using MXL exporter`);let fe=I({},m),D=p==null?new dh({appId:w,appVersion:ie,configUrl:oe,defaultConfig:fe,deviceId:E,storage:T}):p;D.refreshRemoteConfig();let pe=(x=(S=D.resolveApplicationServiceName)==null?void 0:S.call(D,y))==null?(()=>{var e;return(y==null?void 0:y.trim())||((e=D.getConfig().serviceName)==null?void 0:e.trim())||Ym})():x,me=Xm({serviceName:pe}).merge(t).merge(Zm({appId:w,appVersion:ie,diagLogger:f,enduserPseudoId:E,pageSessionStorage:le})),he=new kh({blockNetworkSpanForwarding:g,deviceId:E,dynamicConfigManager:D});if(!he.isSDKEnabled())return f.debug(`SDK is disabled, skipping initialization.`),!1;let ge=Dg({defaultInstrumentationConfig:s,diag:f,featureManager:he,propagator:o,registerGlobally:h}),_e=new hh(ph),O=_x({dynamicConfigManager:D,limitManager:_e,perf:i,registerGlobally:h,sdkLocalStorage:T,sdkSessionStorage:le,userSessionConfig:C.session}),ve,ye;w!==void 0&&(ve=new pg({emptySessionAvoidanceEnabled:he.isEmptySessionAvoidanceEnabled(),exporter:new vm({appId:w,collectorUrl:ae,userID:E}),limitManager:_e,userSessionManager:O}),ye=new Tc({exporter:new gm({appId:w,collectorUrl:ae,userID:E})}));let be=bx({registerGlobally:h,useDocumentTitleAsPageLabel:v,userSessionManager:O,perf:i}),xe=!(s==null||(ee=s.omit)==null)&&ee.has(`soft-navigation-performance`)?void 0:new wg,{tracerProvider:Se,mxlTraceManager:Ce}=vx({attributeScrubbers:C.attributeScrubbers,contextManager:l,mxlSpanProcessor:ve,pageManager:be,perf:i,propagator:ge?new Tg:o,registerGlobally:h,resource:me,signalBuffer:xe,spanExporters:n,spanProcessors:a,userManager:ue});O.setTracerProvider(Se);let{loggerProvider:we,mxlLogManager:Te}=yx({attributeScrubbers:C.attributeScrubbers,exception:b,limitManager:_e,logExporters:r,logProcessors:u,mxlLogProcessor:ye,pageManager:be,perf:i,registerGlobally:h,resource:me,sdkLocalStorage:T,signalBuffer:xe,userManager:ue,userSessionManager:O,visibilityDoc:window.document}),Ee=new Hm({appId:w==null?``:w,loggerProvider:we,pageManager:be,storage:T,userManager:ue,userSessionManager:O});O.setAnalyticsManager(Ee),h&&Un.setGlobalAnalyticsManager(Ee),O.startSessionPartInternal({reason:`init`});let De=typeof window<`u`&&window.__MXL_DISABLE_SESSION_RECORDER===!0,{autoStart:Oe,replay:ke}=fh({autoStart:C.replay.enabled,dynamicConfig:D.getConfig(),isSessionReplayEnabled:he.isSessionReplayEnabled(),replay:C.replay.options}),Ae=!!(se&&E&&!De&&he.isSessionReplayEnabled()),je=Ae&&Oe&&ke!=null&&ke.omitRedundantInstrumentations?[`click`,`exception`,`@opentelemetry/instrumentation-fetch`,`@opentelemetry/instrumentation-xml-http-request`]:void 0,Me=je===void 0?s:I(I({},s),{},{omit:new Set([...(te=s==null?void 0:s.omit)==null?[]:te,...je])}),Ne=Ae&&w!==void 0&&E?{appId:w,appVersion:ie,redactUrl:Ha(C.attributeScrubbers),serviceName:pe,transport:Cm({apiKey:C.replay.apiKey,appId:w,collectorUrl:ae,configUrl:oe}),userID:E}:void 0,Pe={appId:w,appVersion:ie,collectorUrl:ae,dynamicConfigManager:D,initPerformance:C.performance,redactUrl:Ha(C.attributeScrubbers),serviceName:pe,userId:E==null?void 0:E},Fe=()=>mx(Me,{includeReplay:Ae,limitManager:_e,logManager:Te,pageManager:be,autoStart:Oe,performanceContext:Pe,replayContext:Ne,replayOptions:ke,sessionStorage:le,signalBuffer:xe,userSessionManager:O}),Ie,k,Le;if(h){let e=mx(Me,{includeReplay:Ae,limitManager:_e,pageManager:be,autoStart:Oe,performanceContext:Pe,replayContext:Ne,replayOptions:ke,sessionStorage:le,signalBuffer:xe,userSessionManager:O});Ie=e.find(e=>e instanceof Qa),k=no({instrumentations:[...e,...c]})}else{let e=Fe();Ie=e.find(e=>e instanceof Qa),k=no({instrumentations:[...e,...c],loggerProvider:we,tracerProvider:Se})}let Re=!1,ze=!1,Be=!(Me==null||(ne=Me.omit)==null)&&ne.has(`@opentelemetry/instrumentation-fetch`)?()=>void 0:sv();Y_(Me,Ag({collectorUrl:ae,configUrl:oe})).then(e=>{ze||e.length===0||(Le=no(h?{instrumentations:e}:{instrumentations:e,loggerProvider:we,tracerProvider:Se}))}).catch(e=>{f.warn(`failed to load network instrumentations: ${e instanceof Error?e.message:String(e)}`)});let Ve=()=>{ze||(ze=!0,Ie==null||Ie.disable(),k==null||k(),Le==null||Le(),Be(),O._shutdown())},He=Ie?ym(Ie):X_;f.info(`successfully initialized the SDK`);let Ue={analytics:Ee,flush:function(){var e=V(function*(){yield Se.forceFlush(),yield we.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:Te,page:be,session:O,sessionRecording:He,setDynamicConfig:e=>{D.setConfig(e)},shutdown:function(){var e=V(function*(){Re||(Re=!0,Ve(),yield Se.shutdown(),yield we.shutdown())});return function(){return e.apply(this,arguments)}}(),stop:Ve,trace:Ce,user:ue};return h&&Z_.register(Ue),O.recordSDKStartupTimings({initDuration:i.getOffsetFromOrigin()-re,initOriginOffset:re,loadOriginOffset:Og}),Ee.screenView(),Ue}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return f.error(`failed to initialize the SDK: ${t}`),!1}},gx=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new Rh({storage:t});return e&&Vr.setGlobalUserManager(n),n},_x=({dynamicConfigManager:e,limitManager:t,perf:n,registerGlobally:r,sdkLocalStorage:i,sdkSessionStorage:a,userSessionConfig:o})=>{let s=new Zh({config:o,dynamicConfigManager:e,limitManager:t,perf:n,storage:i,tabStorage:a,visibilityDoc:window.document});return r&&Er.setGlobalUserSessionManager(s),s},vx=({resource:e,userManager:t,spanExporters:n,spanProcessors:r=[],propagator:i=null,contextManager:a=null,attributeScrubbers:o,registerGlobally:s,mxlSpanProcessor:c,pageManager:l,perf:u,signalBuffer:d})=>{let f=[...r,new $h,new rg,new Cg({userManager:t}),new hg({pageManager:l}),new _g({perf:u}),new bg({attributeScrubbers:o}),...d?[new yg({buffer:d})]:[]];n==null||n.forEach(e=>{f.push(new Gc({exporter:e}))}),c&&f.push(c);let p=new Ph({perf:u,resource:e,spanLimits:{attributeCountLimit:ph.maxAllowed.session_property*2,eventCountLimit:ph.maxAllowed.breadcrumb*2},spanProcessors:f}),m=new Mh({tracerProvider:s?void 0:p});if(s){Pr.setGlobalTraceManager(m),M.setGlobalTracerProvider(p),i&&gn.setGlobalPropagator(i);let e=a||new Ec;e.enable(),A.setGlobalContextManager(e)}return{mxlTraceManager:m,tracerProvider:p}},yx=({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 Sg({userSessionManager:i}),new Qh,new tg,new xg({userManager:t}),new eg({attributeScrubbers:o}),new mg({pageManager:u}),new gg({perf:d}),...p?[new vg({buffer:p})]:[]];n==null||n.forEach(e=>{h.push(new Tc({exporter:e}))}),c&&h.push(c);let g=new _h({processors:h,resource:e,perf:d}),_=new Th({exception:m,limitManager:a,loggerProvider:s?void 0:g,perf:d,storage:l,userSessionManager:i,visibilityDoc:f});return s&&(qt.setGlobalLoggerProvider(g),Fn.setGlobalLogManager(_)),{loggerProvider:g,mxlLogManager:_}},bx=({useDocumentTitleAsPageLabel:e,registerGlobally:t,userSessionManager:n,perf:r})=>{let i=new Eh({useDocumentTitleAsPageLabel:e,userSessionManager:n,perf:r});return t&&Xn.setGlobalPageManager(i),i};return N(),e.DiagLogLevel=i,e.ReplayInstrumentation=Qa,e.analytics=Un,e.attributes=ii,e.getNavigationInstrumentation=fi,e.getResponseSpanContext=ov,e.initSDK=hx,e.loadRrwebModule=Xi,e.log=Fn,e.page=Xn,e.resetRrwebModuleCacheForTests=Zi,e.session=Er,e.setRrwebModuleLoaderForTests=Qi,e.setRrwebScriptUrl=Ki,e.trace=Pr,e.user=Vr,e})({});
10
+ `,Kd(t,e))}return n}}})),Xd,Zd=n((()=>{P(),I(),Xd=class{constructor(e){F(this,`_backingStorages`,void 0),F(this,`hasAttributeProcessor`,void 0),this._backingStorages=e,this.hasAttributeProcessor=e.some(e=>e.hasAttributeProcessor)}record(e,t,n,r){this.hasAttributeProcessor&&n===void 0&&(n=j.active());let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}}})),Qd,$d,ef=n((()=>{Ed(),Nd(),P(),I(),Qd=class{constructor(e,t){F(this,`_buffer`,new Md),F(this,`_instrumentName`,void 0),F(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){M.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===je.INT&&!Number.isInteger(e)&&(M.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},$d=class{constructor(){F(this,`_buffer`,new Map)}observe(e,t,n={}){if(!gd(e))return;let r=this._buffer.get(e);if(r==null&&(r=new Md,this._buffer.set(e,r)),typeof t!=`number`){M.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===je.INT&&!Number.isInteger(t)&&(M.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}}})),tf,nf=n((()=>{xl(),Ed(),ef(),P(),I(),U(),tf=class{constructor(){F(this,`_callbacks`,[]),F(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(gd));if(n.size===0){M.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(gd)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}observe(e,t){var n=this;return H(function*(){let r=n._observeCallbacks(e,t),i=n._observeBatchCallbacks(e,t);return(yield Promise.allSettled([...r,...i])).filter(e=>e.status===`rejected`).map(e=>e.reason)})()}_observeCallbacks(e,t){return this._callbacks.map(function(){var n=H(function*({callback:n,instrument:r}){let i=new Qd(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=gl(a,t)),yield a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})});return function(e){return n.apply(this,arguments)}}())}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(function(){var n=H(function*({callback:n,instruments:r}){let i=new $d,a=Promise.resolve(n(i));t!=null&&(a=gl(a,t)),yield a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})});return function(e){return n.apply(this,arguments)}}())}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&_l(n.instruments,t))}}})),rf,af=n((()=>{Ad(),Fd(),Rd(),P(),I(),rf=class extends kd{constructor(e,t,n,r,i){super(e),F(this,`_aggregationCardinalityLimit`,void 0),F(this,`_deltaMetricStorage`,void 0),F(this,`_temporalMetricStorage`,void 0),F(this,`_attributesProcessor`,void 0),F(this,`hasAttributeProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Pd(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ld(t,r),this._attributesProcessor=n,this.hasAttributeProcessor=n!==void 0}record(e,t,n,r){this._attributesProcessor!==void 0&&(t=this._attributesProcessor.process(t,n==null?j.active():n)),this._deltaMetricStorage.record(e,t,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}})),of,sf=n((()=>{hd(),Od(),Bd(),Yd(),Zd(),nf(),af(),I(),U(),of=class{constructor(e,t){F(this,`metricStorageRegistry`,new Jd),F(this,`observableRegistry`,new tf),F(this,`meter`,void 0),F(this,`_meterProviderSharedState`,void 0),F(this,`_instrumentationScope`,void 0),this.meter=new Dd(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,rf);return t.length===1?t[0]:new Xd(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,zd)}collect(e,t,n){var r=this;return H(function*(){let i=yield r.observableRegistry.observe(t,n==null?void 0:n.timeoutMillis),a=r.metricStorageRegistry.getStorages(e);if(a.length===0)return null;let o=[];return a.forEach(n=>{let r=n.collect(e,t);r!=null&&o.push(r)}),o.length===0?{errors:i}:{scopeMetrics:{scope:r._instrumentationScope,metrics:o},errors:i}})()}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=dd(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,void 0,[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}}})),cf,lf=n((()=>{xl(),Pu(),ld(),sf(),I(),cf=class{constructor(e){F(this,`viewRegistry`,new cd),F(this,`metricCollectors`,[]),F(this,`meterSharedStates`,new Map),F(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=hl(e),n=this.meterSharedStates.get(t);return n==null&&(n=new of(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Mu(n.selectAggregation(e))]);return t}}})),uf,df=n((()=>{J(),I(),U(),uf=class{constructor(e,t){F(this,`_sharedState`,void 0),F(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}collect(e){var t=this;return H(function*(){let n=K(Date.now()),r=[],i=[],a=Array.from(t._sharedState.meterSharedStates.values()).map(function(){var a=H(function*(a){let o=yield a.collect(t,n,e);(o==null?void 0:o.scopeMetrics)!=null&&r.push(o.scopeMetrics),(o==null?void 0:o.errors)!=null&&i.push(...o.errors)});return function(e){return a.apply(this,arguments)}}());return yield Promise.all(a),{resourceMetrics:{resource:t._sharedState.resource,scopeMetrics:r},errors:i}})()}forceFlush(e){var t=this;return H(function*(){yield t._metricReader.forceFlush(e)})()}shutdown(e){var t=this;return H(function*(){yield t._metricReader.shutdown(e)})()}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){var t,n,r;return(t=(n=(r=this._metricReader).selectCardinalityLimit)==null?void 0:n.call(r,e))==null?2e3:t}}})),ff,pf,mf,hf=n((()=>{I(),ff=/[\^$\\.+?()[\]{}|]/g,pf=class e{constructor(t){F(this,`_matchAll`,void 0),F(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(ff,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},mf=class{constructor(e){F(this,`_matchAll`,void 0),F(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}}})),gf,_f=n((()=>{hf(),I(),gf=class{constructor(e){var t;F(this,`_nameFilter`,void 0),F(this,`_type`,void 0),F(this,`_unitFilter`,void 0),this._nameFilter=new pf((t=e==null?void 0:e.name)==null?`*`:t),this._type=e==null?void 0:e.type,this._unitFilter=new mf(e==null?void 0:e.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}})),vf,yf=n((()=>{hf(),I(),vf=class{constructor(e){F(this,`_nameFilter`,void 0),F(this,`_versionFilter`,void 0),F(this,`_schemaUrlFilter`,void 0),this._nameFilter=new mf(e==null?void 0:e.name),this._versionFilter=new mf(e==null?void 0:e.version),this._schemaUrlFilter=new mf(e==null?void 0:e.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}}));function bf(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function xf(e){if(bf(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&((e==null?void 0:e.instrumentName)==null||pf.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var Sf,Cf=n((()=>{Pu(),hf(),sd(),_f(),yf(),I(),Sf=class{constructor(e){var t;F(this,`name`,void 0),F(this,`description`,void 0),F(this,`aggregation`,void 0),F(this,`attributesProcessor`,void 0),F(this,`instrumentSelector`,void 0),F(this,`meterSelector`,void 0),F(this,`aggregationCardinalityLimit`,void 0),xf(e),e.attributesProcessors==null?this.attributesProcessor=nd():this.attributesProcessor=rd(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Mu((t=e.aggregation)==null?{type:0}:t),this.instrumentSelector=new gf({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new vf({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}}})),wf,Tf=n((()=>{Xu(),lf(),df(),Cf(),P(),ac(),I(),U(),wf=class{constructor(e){var t;if(F(this,`_sharedState`,void 0),F(this,`_shutdown`,!1),this._sharedState=new cf((t=e==null?void 0:e.resource)==null?$s():t),(e==null?void 0:e.views)!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new Sf(t));if((e==null?void 0:e.readers)!=null&&e.readers.length>0)for(let t of e.readers){let n=new uf(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof Yu&&t._setSelfObsMeterProvider(this)}}getMeter(e,t=``,n={}){return this._shutdown?(M.warn(`A shutdown MeterProvider cannot provide a Meter`),D()):((typeof e!=`string`||e.length===0)&&(M.warn(`Invalid MeterProvider instrumentation scope name, using empty string`),e=``),this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter)}shutdown(e){var t=this;return H(function*(){if(t._shutdown){M.warn(`shutdown may only be called once per MeterProvider`);return}t._shutdown=!0,yield Promise.all(t._sharedState.metricCollectors.map(t=>t.shutdown(e)))})()}forceFlush(e){var t=this;return H(function*(){if(t._shutdown){M.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}yield Promise.all(t._sharedState.metricCollectors.map(t=>t.forceFlush(e)))})()}}})),Ef=n((()=>{dl(),pl(),Pu(),td(),Tf()}));function Df(e,t){let n={attributes:kf(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Of(e,t){let n={name:e.name,version:e.version};if(e.attributes&&Object.keys(e.attributes).length>0){var r;n.attributes=kf(e.attributes,t),n.droppedAttributesCount=(r=e.droppedAttributesCount)==null?0:r}return n}function kf(e,t){return Object.keys(e).map(n=>Af(n,e[n],t))}function Af(e,t,n){return{key:e,value:jf(t,n)}}function jf(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]=jf(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:jf(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var Mf=n((()=>{}));function Nf(e,t){return{resourceLogs:Ff(e,t)}}function Pf(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 Ff(e,t){let n=Pf(e);return Array.from(n,([e,n])=>{let r=Df(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:Of(e[0].instrumentationScope,t),logRecords:e.map(e=>If(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function If(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Lf(e.severityNumber),severityText:e.severityText,body:jf(e.body,t),eventName:e.eventName,attributes:kf(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 Lf(e){return e}var Rf=n((()=>{Mf()}));function zf(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Bf(e){return zf(e).toString()}function Vf(e){return e}var Hf,Uf,Wf=n((()=>{ll(),J(),Hf=typeof BigInt<`u`?Bf:Yo,Uf={encodeHrTime:Hf,encodeSpanContext:Vf,encodeOptionalSpanContext:Vf,encodeUint8Array:sl}})),Gf,Kf=n((()=>{Rf(),Wf(),P(),Gf={serializeRequest:e=>{let t=Nf(e,Uf);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 M.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}}}));function qf(e,t){let n=Df(e.resource,t);return{resource:n,schemaUrl:n.schemaUrl,scopeMetrics:Jf(e.scopeMetrics,t)}}function Jf(e,t){return Array.from(e.map(e=>({scope:Of(e.scope,t),metrics:e.metrics.map(e=>Yf(e,t)),schemaUrl:e.scope.schemaUrl})))}function Yf(e,t){let n={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},r=ep(e.aggregationTemporality);switch(e.dataPointType){case fl.SUM:n.sum={aggregationTemporality:r,isMonotonic:e.isMonotonic,dataPoints:Zf(e,t)};break;case fl.GAUGE:n.gauge={dataPoints:Zf(e,t)};break;case fl.HISTOGRAM:n.histogram={aggregationTemporality:r,dataPoints:Qf(e,t)};break;case fl.EXPONENTIAL_HISTOGRAM:n.exponentialHistogram={aggregationTemporality:r,dataPoints:$f(e,t)}}return n}function Xf(e,t,n){let r={attributes:kf(e.attributes,n),startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)};switch(t){case je.INT:r.asInt=e.value;break;case je.DOUBLE:r.asDouble=e.value}return r}function Zf(e,t){return e.dataPoints.map(n=>Xf(n,e.descriptor.valueType,t))}function Qf(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:kf(e.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function $f(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:kf(e.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function ep(e){switch(e){case ul.DELTA:return 1;case ul.CUMULATIVE:return 2}}function tp(e,t){return{resourceMetrics:e.map(e=>qf(e,t))}}var np=n((()=>{Mf(),P(),Ef()})),rp,ip=n((()=>{Wf(),np(),P(),rp={serializeRequest:e=>{let t=tp([e],Uf);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 M.warn(`Failed to parse metrics export response: ${e.message}. Returning empty response`),{}}}}}));function ap(e,t){let n=e&255|fp;return t&&(n|=pp),n}function op(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:kf(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>cp(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>sp(e,t)),droppedLinksCount:e.droppedLinksCount,flags:ap(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function sp(e,t){var n;return{attributes:e.attributes?kf(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:ap(e.context.traceFlags,e.context.isRemote)}}function cp(e,t){return{attributes:e.attributes?kf(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function lp(e,t){return{resourceSpans:dp(e,t)}}function up(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 dp(e,t){let n=up(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=>op(e,t));o.push({scope:Of(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Df(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var fp,pp,mp=n((()=>{Mf(),fp=256,pp=512})),hp,gp=n((()=>{Wf(),mp(),P(),hp={serializeRequest:e=>{let t=lp(e,Uf);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 M.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}}})),_p=n((()=>{nl(),il(),ol(),Kf(),ip(),gp()}));_p();var vp=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},yp,bp=n((()=>{I(),yp=class{constructor(e){F(this,`_delegate`,void 0),this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}setMetrics(e){this._delegate.setMetrics(e)}}})),xp,Sp=n((()=>{I(),xp=class extends Error{constructor(e,t,n){super(e),F(this,`code`,void 0),F(this,`name`,`OTLPExporterError`),F(this,`data`,void 0),this.data=n,this.code=t}}}));function Cp(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function wp(e){if(e!=null)return H(function*(){return e})}function Tp(e,t,n){var r,i,a,o,s,c;return{timeoutMillis:Cp((r=(i=e.timeoutMillis)==null?t.timeoutMillis:i)==null?n.timeoutMillis:r),concurrencyLimit:(a=(o=e.concurrencyLimit)==null?t.concurrencyLimit:o)==null?n.concurrencyLimit:a,compression:(s=(c=e.compression)==null?t.compression:c)==null?n.compression:s}}function Ep(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Dp=n((()=>{U()}));function Op(e){return new kp(e.concurrencyLimit)}var kp,Ap=n((()=>{I(),U(),kp=class{constructor(e){F(this,`_concurrencyLimit`,void 0),F(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 H(function*(){yield Promise.all(e._sendingPromises)})()}}}));function jp(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Mp(){return{handleResponse(e){e==null||!jp(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||M.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Np=n((()=>{P()}));function Pp(e,t){return new Fp(e.transport,e.serializer,Mp(),e.promiseHandler,e.metrics,t.timeout)}var Fp,Ip=n((()=>{Sp(),Np(),J(),P(),I(),U(),Fp=class{constructor(e,t,n,r,i,a){F(this,`_metrics`,void 0),F(this,`_diagLogger`,void 0),F(this,`_transport`,void 0),F(this,`_serializer`,void 0),F(this,`_responseHandler`,void 0),F(this,`_promiseQueue`,void 0),F(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=a,this._diagLogger=M.createComponentLogger({namespace:`OTLPExportDelegate`}),this._metrics=i}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:q.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:q.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:q.SUCCESS});return}else if(e.status===`failure`&&e.error){r(e.error),t({code:q.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;r(`export_max_retries`),t({code:q.FAILED,error:(n=e.error)==null?new xp(`Export failed with retryable status`):n})}else r(`export_failed`),t({code:q.FAILED,error:new xp(`Export failed with unknown error`)})},e=>{r(e),t({code:q.FAILED,error:e})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(e){this._metrics=e}shutdown(){var e=this;return H(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}}}));function Lp(e,t,n,r){return Pp({transport:r,serializer:t,promiseHandler:Op(e),metrics:n},{timeout:e.timeoutMillis})}var Rp=n((()=>{Ap(),Ip()})),zp,Bp,Vp,Hp,Up,Wp,Gp=n((()=>{zp=`http.response.status_code`,Bp=`otel.component.name`,Vp=`otel.component.type`,Hp=`server.address`,Up=`server.port`,Wp=`error.type`})),Kp,qp=n((()=>{Kp=`0.301.2`})),Jp,Yp,Xp=n((()=>{Gp(),qp(),J(),P(),I(),R(),Jp=new Map,Yp=class{constructor(e){var t;F(this,`inflight`,void 0),F(this,`exported`,void 0),F(this,`duration`,void 0),F(this,`standardAttrs`,void 0),F(this,`responseAttributesFromError`,void 0),F(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`,Kp):D(),c=(t=Jp.get(n))==null?0:t;if(Jp.set(n,c+1),this.standardAttrs={[Vp]:n,[Bp]:`${n}/${c}`},a){let e=a;a.includes(`://`)||(e=`http://${a}`);try{let t=new URL(e);this.standardAttrs[Hp]=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[Up]=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=Ko();return this.inflight.add(t,this.standardAttrs),e=>{let r=Ko();this.inflight.add(-t,this.standardAttrs);let i=e?L(L({},this.standardAttrs),{},{[Wp]:e instanceof Error?e.name:`export_failed`}):this.standardAttrs;this.exported.add(t,i);let a=L(L({},i),this.responseAttributesFromError(e)),o=Zo(Jo(n,r))/1e3;this.duration.record(o,a)}}}})),Zp=n((()=>{bp(),Rp(),Xp()}));Zp(),P(),U();let Qp=49152,$p=0,em=0,tm=e=>typeof e==`string`?new TextEncoder().encode(e).byteLength:e.byteLength;function nm(e){return rm.apply(this,arguments)}function rm(){return rm=H(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));M.debug(`Fetch transport failed to drain response body: ${t.message}`)}}),rm.apply(this,arguments)}function im(e,t){return am.apply(this,arguments)}function am(){return am=H(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=tm(t.body),a=!1;if(t.keepalive){let e=$p+i>Qp;if(a=!e&&!(em>=9),a)$p+=i,em++;else{let t=e?`inflight bytes (${$p} + ${i}) would exceed ${Qp}B budget`:`concurrent count (${em}) at limit of 9`;M.debug(`Sending without keepalive: ${t}`)}}let o=()=>{r!==void 0&&clearTimeout(r)},s=a?()=>{o(),$p-=i,em--}: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 nm(c).finally(s),{keepalive:a,response:c}}),am.apply(this,arguments)}P(),U(),R();var om=class e{constructor(e){this._config=e}static _compressRequest(e){return H(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 H(function*(){let i=t,a=L({"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 M.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 im(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?(M.debug(u),{error:l,status:`retryable`}):(M.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?M.debug(r):M.warn(r),{error:t,status:n?`retryable`:`failure`}}})()}};let sm=e=>new om(e);U();let cm=()=>Math.random()*40-20;var lm=class{constructor(e,t=new oi){this._transport=e,this._perf=t}send(e,t){var n=this;return H(function*(){let r=n._perf.getNow()+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)+cm(),0);o*=1.5;let c=(s=i.retryInMillis)==null?t:s,l=r-n._perf.getNow();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 um=e=>{var t;return new lm(e.transport,(t=e.perf)==null?new oi:t)},dm=`http.response.status_code`;function fm(e){if(!e)return{[dm]:200};if(!(e instanceof Error))return{};if(e.message.startsWith(`Fetch request failed with non-retryable status `)){let t=e.message.substring(47);return{[dm]:Number(t)}}return{}}function pm(e,t,n){return new Yp({componentType:e,metricsHelper:t,url:n,meterProvider:void 0,responseAttributesFromError:fm})}Zp();let mm=(e,t,n,r)=>Lp(e,t,pm(n,r,e.url),um({transport:sm(e)}));var hm=class extends vp{constructor(e){super(mm(e,Gf,`otlp_http_log_exporter`,al))}};R();var gm=class extends hm{constructor({appId:e,userID:t,collectorUrl:n}){super(L(L({},$c),{},{headers:el(e,t),url:`${n}/v1/logs`}))}};_p(),R();var _m=class extends vp{constructor(e){super(mm(L(L({},e),{},{compression:`gzip`}),hp,`otlp_http_span_exporter`,rl))}};R();var vm=class extends _m{constructor({appId:e,userID:t,collectorUrl:n}){super(L(L({},$c),{},{headers:el(e,t),url:`${n}/v1/traces`}))}};function ym(e){return{isRecording:()=>e.isRecording(),setEnabled:t=>{if(t){e.resume();return}e.pause()}}}R(),U();let bm=e=>({"mxl-client-id":e}),xm=0;function Sm(e,t){let n=Date.now();n-xm<3e4||(xm=n,console.warn(`[mxl] session replay ${e} failed (dropping; will retry on next chunk):`,t))}function Cm(e){let t=bm(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=H(function*(e,r,i,a,o){try{let{response:s}=yield im(`${n}${r}`,{body:i,headers:L(L({},t),a),keepalive:o,timeoutMillis:1e4});return s.ok?`accepted`:(Sm(e,Error(`HTTP ${s.status}`)),s.status===413?`exhausted`:`rejected`)}catch(t){return Sm(e,t),`failed`}});return function(t,n,r,i,a){return e.apply(this,arguments)}}(),s=function(){var t=H(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=H(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=H(function*(e,t=!1){e.length!==0&&(yield o(`events POST`,`/sessionEvents`,`${e.map(e=>JSON.stringify(e)).join(`
11
+ `)}\n`,{"content-type":`application/x-ndjson`},t))});return function(t){return e.apply(this,arguments)}}(),postSessionMeta:c,shouldIgnoreUrl:a}}I();var wm=class{constructor(){F(this,`_items`,new Map)}get length(){return this._items.size}clear(){this._items.clear()}getItem(e){var t;return(t=this._items.get(e))==null?null:t}key(e){var t;return(t=Array.from(this._items.keys())[e])==null?null:t}removeItem(e){this._items.delete(e)}setItem(e,t){this._items.set(e,t)}};let Tm=(e,t)=>{let n=`${e} is null`;try{let t=window[e];if(t)return t}catch(e){n=e}return t.warn(`${e} is not accessible; keeping its data in memory for this page`,String(n)),new wm},Em=`mxl_user`,Dm=`mxl_user_id`,Om=`mxl_external_user_id`,km=`mxl_profile_snapshot`,Am=`mxl_session_analytics_prev`;R();let jm=()=>({avatar:``,email:``,firstName:``,lastName:``,profileId:``,properties:{}});function Mm(e){try{let t=e.getItem(km);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 Nm(e,t){try{return e.setItem(km,JSON.stringify(t)),!0}catch(e){return!1}}function Pm(e){try{e.removeItem(km)}catch(e){}}function Fm(e,t){let n=e==null?jm():e,r=L(L({},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 Im(e){let t=L({},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}I(),R();var Lm=class{constructor(){F(this,`_screenViewCount`,0),F(this,`_eventCount`,0),F(this,`_entry`,null),F(this,`_exit`,null),F(this,`_referrer`,``),F(this,`_utm`,{utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``})}recordScreenView(e){this._screenViewCount+=1,this._eventCount+=1,this._entry||(this._entry=L({},e),this._referrer=e.referrer,this._utm={utmCampaign:e.utmCampaign,utmContent:e.utmContent,utmMedium:e.utmMedium,utmSource:e.utmSource,utmTerm:e.utmTerm}),this._exit=L({},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[`${B}profile_id`]=t.profileId,u[`${B}screen_view_count`]=t.screenViewCount,u[`${B}event_count`]=t.eventCount,u[`${B}entry_origin`]=t.entryOrigin,u[`${B}entry_path`]=t.entryPath,u[`${B}exit_origin`]=t.exitOrigin,u[`${B}exit_path`]=t.exitPath,u[`${B}referrer`]=t.referrer,u[`${B}utm_medium`]=t.utmMedium,u[`${B}utm_source`]=t.utmSource,u[`${B}utm_campaign`]=t.utmCampaign,u[`${B}utm_content`]=t.utmContent,u[`${B}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 Rm(e){try{let t=e.getItem(Am);return t?JSON.parse(t):null}catch(e){return null}}function zm(e,t){try{e.setItem(Am,JSON.stringify(t))}catch(e){}}function Bm(e){try{e.removeItem(Am)}catch(e){}}function Vm(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}}P(),I(),R();var Hm=class{constructor({appId:e,diag:t,loggerProvider:n,pageManager:r,storage:i,userManager:a,userSessionManager:o}){F(this,`_diag`,void 0),F(this,`_logger`,void 0),F(this,`_appId`,void 0),F(this,`_userManager`,void 0),F(this,`_userSessionManager`,void 0),F(this,`_pageManager`,void 0),F(this,`_storage`,void 0),F(this,`_sessionAnalytics`,new Lm),F(this,`_lastScreenViewPath`,null),F(this,`_screenViewTimer`,null);let s=n==null?Kt:n;this._diag=t==null?M.createComponentLogger({namespace:`MXLAnalyticsManager`}):t,this._appId=e,this._userManager=a,this._userSessionManager=o,this._pageManager=r,this._storage=i==null?Tm(`localStorage`,this._diag):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=Fm(Mm(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});Nm(this._storage,s)||this._diag.warn(`Failed to persist profile snapshot`),this._userManager.setUserId(s.profileId);let c=Im(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=Mm(this._storage),a=Number.parseFloat((n=i==null?void 0:i.properties[e])==null?`0`:n),o=Number.isFinite(a)?a+t:t,s=Fm(i,{profileId:r,properties:L(L({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});Nm(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=Mm(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=Fm(i,{profileId:r,properties:L(L({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});Nm(this._storage,s),this._emitAnalyticsLog(`decrement`,e,{counter_name:e,counter_value:String(o)},r)}clear(){Pm(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=Rm(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[ei])===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);zm(this._storage,r)}resetSessionAnalyticsForNewUserSession(){this._sessionAnalytics.reset(),Bm(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=Vm(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,[ti]:this._appId,"mxl.device.id":h,[ni]:g,"mxl.session.id":_,[Jr]: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:k.INFO,severityText:`INFO`})}_resolveProfileId(){let e=this._userManager.getUserId();if(e)return e;let t=Mm(this._storage);return(t==null?void 0:t.profileId)||null}};let Um=`http.response.body.size`,Wm=`log.record.uid`,Gm=`user.id`,Km=`0.1.5`,qm=`mxl_app_instance_id`,Jm=(e,t)=>{let n=null;try{n=e.getItem(qm)}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=Qn();try{e.setItem(qm,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n};ac(),W(),R();let Ym=`unknown_service`,Xm=({serviceName:e})=>Zs({[Ea]:e}),Zm=({diagLogger:e,appVersion:t,pageSessionStorage:n,appId:r,enduserPseudoId:i})=>{var a;let o=window.navigator;return Zs(L(L({[Aa]:`mxl-web-sdk`,app_version:t,app_framework:1,sdk_version:Km,[ja]:Km,sdk_simple_version:1,sdk_platform:`web`,[Oa]:`webjs`,"mxl.app_instance_id":Jm(n,e),[Fa]: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?{[ti]:r}:{}))},Qm={networkSpansForwardingThreshold:0,samplingPct:100},$m=`mxl_remote_config`,eh=(e,t,{osVersion:n,appVersion:r,deviceId:i})=>`${e}/config?${new URLSearchParams({appId:t,osVersion:n,appVersion:r,deviceId:i}).toString()}`,th=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=(e,t,n)=>{let r=e[t];if(typeof r==`number`)return r;let i=e[n];if(typeof i==`number`)return i},nh=(e,t,n)=>{let r=e[t];if(typeof r==`boolean`)return r;let i=e[n];if(typeof i==`boolean`)return i},rh=(e,t,n)=>{let r=e[t];if(typeof r==`string`)return r;let i=e[n];if(typeof i==`string`)return i},ih=e=>{if(!th(e))return;let t={},n=X(e,`maxDurationSeconds`,`max_duration_seconds`);n!==void 0&&(t.maxDurationSeconds=n);let r=X(e,`inactivityTimeoutSeconds`,`inactivity_timeout_seconds`);r!==void 0&&(t.inactivityTimeoutSeconds=r);let i=X(e,`foregroundInactivityTimeoutSeconds`,`foreground_inactivity_timeout_seconds`);return i!==void 0&&(t.foregroundInactivityTimeoutSeconds=i),t},ah=e=>{if(!th(e))return;let t={},n=X(e,`pctEnabled`,`pct_enabled`);n!==void 0&&(t.pctEnabled=n);let r=X(e,`sampleRate`,`sample_rate`);r!==void 0&&(t.sampleRate=r);let i=nh(e,`maskAllInputs`,`mask_all_inputs`);i!==void 0&&(t.maskAllInputs=i);let a=nh(e,`maskAllText`,`mask_all_text`);a!==void 0&&(t.maskAllText=a);let o=X(e,`flushIntervalMs`,`flush_interval_ms`);o!==void 0&&(t.flushIntervalMs=o);let s=nh(e,`omitRedundantInstrumentations`,`omit_redundant_instrumentations`);s!==void 0&&(t.omitRedundantInstrumentations=s);let c=nh(e,`debug`,`debug`);return c!==void 0&&(t.debug=c),Object.keys(t).length>0?t:void 0},oh=e=>{if(!th(e))return;let t={},n=nh(e,`enabled`,`enabled`);n!==void 0&&(t.enabled=n);let r=X(e,`pctEnabled`,`pct_enabled`);r!==void 0&&(t.pctEnabled=r);let i=X(e,`intervalMs`,`interval_ms`);return i!==void 0&&(t.intervalMs=i),Object.keys(t).length>0?t:void 0},sh=e=>{if(!th(e))return;let t={},n=nh(e,`enabled`,`enabled`);n!==void 0&&(t.enabled=n);let r=X(e,`pctEnabled`,`pct_enabled`);r!==void 0&&(t.pctEnabled=r);let i=X(e,`sampleIntervalMs`,`sample_interval_ms`);i!==void 0&&(t.sampleIntervalMs=i);let a=X(e,`maxBufferSize`,`max_buffer_size`);a!==void 0&&(t.maxBufferSize=a);let o=X(e,`windowMs`,`window_ms`);return o!==void 0&&(t.windowMs=o),Object.keys(t).length>0?t:void 0},ch=e=>{if(!th(e))return;let t={},n=oh(e.memory);n!==void 0&&(t.memory=n);let r=sh(e.profiling);return r!==void 0&&(t.profiling=r),Object.keys(t).length>0?t:void 0},lh=e=>{var t,n,r;if(!th(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(th(o)){let e=X(o,`pctEnabled`,`pct_enabled`);e!==void 0&&(a.networkSpanForwarding={pctEnabled:e})}let s=X(e,`emptySessionAvoidanceEnabledPct`,`empty_session_avoidance_enabled_pct`);s!==void 0&&(a.emptySessionAvoidanceEnabledPct=s);let c=rh(e,`serviceName`,`service_name`);c!==void 0&&(a.serviceName=c);let l=ah((n=e.sessionReplay)==null?e.session_replay:n);l!==void 0&&(a.sessionReplay=l);let u=ih((r=e.userSession)==null?e.user_session:r);u!==void 0&&(a.userSession=u);let d=ch(e.performance);return d!==void 0&&(a.performance=d),a};P(),R(),I(),U();let uh=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=L({},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),e.performance!==void 0&&(i.performance=L({},e.performance)),i};var dh=class{constructor({appId:e,appVersion:t,deviceId:n,diag:r=M.createComponentLogger({namespace:`mxl-config-manager`}),storage:i,defaultConfig:a={},configUrl:o}){F(this,`_remoteConfigURL`,null),F(this,`_diag`,void 0),F(this,`_storage`,void 0),F(this,`_baseConfig`,void 0),F(this,`_sdkConfig`,void 0),F(this,`_etag`,null),F(this,`_remoteSourceServiceName`,void 0),F(this,`_configChangeListeners`,new Set),e&&t&&n&&o&&(this._remoteConfigURL=eh(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=L(L({},Qm),a),this._sdkConfig=L(L({},this._baseConfig),s?uh(s.config):{})}setConfig(e){this._sdkConfig=L(L({},this._sdkConfig),e),this._notifyConfigChange()}getConfig(){return this._sdkConfig}onConfigChange(e){return this._configChangeListeners.add(e),()=>{this._configChangeListeners.delete(e)}}_notifyConfigChange(){let e=this._sdkConfig;for(let t of this._configChangeListeners)t(e)}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())||Ym}_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 H(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($m,JSON.stringify({config:n,etag:r})),e._sdkConfig=L(L({},e._baseConfig),uh(n)),e._etag=r,e._notifyConfigChange()}catch(t){e._diag.warn(`Failed to refresh remote config: ${t instanceof Error?t.message:String(t)}`)}})()}_getRemoteConfigFromStorage(){try{let e=this._storage.getItem($m);if(e){let t=JSON.parse(e);return{config:lh(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 H(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?[lh(yield n.json()),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};R();function fh({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=L({},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 ph={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}};P(),I();let mh={error:`error_log`,info:`info_log`,warning:`warning_log`};var hh=class{constructor({diag:e,maxAllowed:t,maxLength:n,maxAttributes:r}){F(this,`_diag`,void 0),F(this,`_diagnosticCounts`,{}),F(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}),F(this,`_maxAllowed`,void 0),F(this,`_maxLength`,void 0),F(this,`_maxAttributes`,void 0),this._diag=e==null?M.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=mh[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}};I(),R();let gh=[`perf`];var _h=class extends _c{constructor(e){let{perf:t}=e,n=Ua(e,gh);super(n),F(this,`_perf`,void 0),this._perf=t}getLogger(e,t,n){return new vh(super.getLogger(e,t,n),this._perf)}},vh=class{constructor(e,t){F(this,`_logger`,void 0),F(this,`_perf`,void 0),this._logger=e,this._perf=t}emit(e){this._logger.emit(L(L({},e),{},{timestamp:this._toAbsoluteTime(e.timestamp)}))}enabled(e){return this._logger.enabled(e)}_toAbsoluteTime(e){return e===void 0?this._perf.getNow():typeof e==`number`&&e<performance.timeOrigin/2?this._perf.offsetToAbsoluteTime(e):e}};let yh=(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}},bh=e=>e.visibilityState===`hidden`?`background`:`foreground`,xh=globalThis;P(),W(),I(),On(),R();let Sh=()=>JSON.stringify(xh._MXLFileBundleIDs||{}),Ch=(e,t,n)=>`${e}\n${t}\n${n}`,wh=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 Th=class e{constructor({diag:e,perf:t,userSessionManager:n,limitManager:r,loggerProvider:i,visibilityDoc:a,storage:o,exception:s}){var c,l;F(this,`_diag`,void 0),F(this,`_perf`,void 0),F(this,`_logger`,void 0),F(this,`_userSessionManager`,void 0),F(this,`_limitManager`,void 0),F(this,`_visibilityDoc`,void 0),F(this,`_storage`,void 0),F(this,`_filters`,void 0),F(this,`_dedupWindowMs`,void 0),F(this,`_dedupLastSeen`,new Map);let u=i==null?Kt:i;this._diag=e==null?M.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 k.INFO;case`warning`:return k.WARN;default:return k.ERROR}}logException(t,{handled:n=!0,attributes:r={},timestamp:i=this._perf.getNow(),handler:a=`manual`,spanContext:o}={}){var s;if(!this._passesFilters(t))return;let c=this._validateAttributes(r),l=(t==null||(s=t.constructor)==null?void 0:s.name)||typeof t,u=``,d=l,f=``;if(t instanceof Error)u=String(t.message||``).trim(),d=t.name||``,f=t.stack||``;else if(t&&typeof t==`object`)try{u=JSON.stringify(t)}catch(e){u=String(t).trim()}else u=String(t).trim();if(this._isDuplicate(d,u,f,i))return;n||this._userSessionManager.incrSessionPartCountForKey(`mxl.unhandled_exceptions_count`);let{[Hr]:p}=c,m=Ua(c,[Hr].map(Dn)),h=this._limitManager.limitException(u,m);h!==`dropped`&&(this._userSessionManager.incrReplayCount(`errors`),this._logger.emit(L(L({attributes:L(L(L({},h.attributes),p===void 0?{}:{[Hr]:String(p)}),{},{[z]:`sys.exception`,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":wh(t),[ba]:l,"exception.name":d,[va]:h.message,[ya]:f,[Wr]:Sh(),[Vr]:bh(this._visibilityDoc),"mxl.exception_number":yh(this._storage,`mxl_exception_number`,this._diag)}),body:h.message},o?{context:N.setSpanContext(j.active(),o)}:{}),{},{eventName:`mxl-exception`,severityNumber:k.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.getNow()})}_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:L(L(L({},o.attributes),{},{[z]:`sys.log`},a?{"mxl.stacktrace.js":a,[Wr]:Sh()}:{}),{},{[Vr]:bh(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=Ch(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`}};P(),I();var Eh=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document,diag:n,navigationHost:r=window,userSessionManager:i,perf:a=new oi}={}){var o;F(this,`_currentRoute`,null),F(this,`_currentPageId`,null),F(this,`_pageLabel`,null),F(this,`_titleDocument`,void 0),F(this,`_useDocumentTitleAsPageLabel`,void 0),F(this,`_routeChangedListeners`,[]),F(this,`_diag`,void 0),F(this,`_navigationHost`,void 0),F(this,`_userSessionManager`,void 0),F(this,`_perf`,void 0),F(this,`getCurrentPageId`,()=>this._currentPageId),F(this,`getCurrentRoute`,()=>this._currentRoute),F(this,`setPageLabel`,e=>{this._pageLabel=e}),F(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),F(this,`setCurrentRoute`,e=>{(!this._currentRoute||this._currentRoute.url!==e.url)&&(this._currentPageId=Qn()),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)}}),F(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),F(this,`addRouteChangedListener`,e=>(this._routeChangedListeners.push(e),()=>{let t=this._routeChangedListeners.indexOf(e);t!==-1&&this._routeChangedListeners.splice(t,1)})),F(this,`_onSoftNavigation`,e=>{var t;e.from.url!==this._navigationHost.location.href&&(this._perf.setZeroTimeOffset(e.timeStamp),(t=this._userSessionManager)==null||t.rolloverSessionPartInternal({endReason:`web_soft_navigation`,startReason:`web_soft_navigation`}),this._setRouteFromCurrentLocation(),Hn.screenView())}),F(this,`_setRouteFromCurrentLocation`,()=>{var e;let t=this._navigationHost.location.pathname;if(((e=this._currentRoute)==null?void 0:e.url)===t&&this._currentRoute.path){this.setCurrentRoute(this._currentRoute);return}this.setCurrentRoute({url:t})}),this._useDocumentTitleAsPageLabel=e,this._titleDocument=t,this._diag=n==null?M.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 Dh=(e,t)=>!t||t<=0||t>100?!1:t>=Oh(e),Oh=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100};I();var kh=class{constructor({dynamicConfigManager:e,deviceId:t,blockNetworkSpanForwarding:n}){F(this,`_dynamicConfigManager`,void 0),F(this,`_deviceId`,void 0),F(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=e,this._deviceId=t,this._blockNetworkSpanForwarding=n}isSDKEnabled(){let e=this._dynamicConfigManager.getConfig();return Dh(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return Dh(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 Dh(this._deviceId,n)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return Dh(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};J(),I(),R(),On();let Ah=(e,t,n)=>{if(typeof n!=`number`||n>e.getOffsetFromOrigin())return n;let r=t+n,i=e.offsetToAbsoluteTime(n);return Math.abs(i-r)>1e3?i:r};var jh=class e{constructor(e,t,n){F(this,`_span`,void 0),F(this,`_perf`,void 0),F(this,`_wallOrigin`,void 0),this._span=e,this._perf=t,this._wallOrigin=n}static start(t,n,r,i={},a){var o;let s=Date.now()-n.getOffsetFromOrigin();return new e(t.startSpan(r,L(L({},i),{},{startTime:(o=Ah(n,s,i.startTime))==null?Date.now():o}),a),n,s)}static from(t){return t instanceof e?t:new e(t)}get attributes(){return this._span.attributes}addEvent(e,t,n){return this._span.addEvent(e,es(t)?this._toSpanTime(t):t,this._toSpanTime(n)),this}addLink(e){return this._span.addLink(e),this}addLinks(e){return this._span.addLinks(e),this}end(e){this._end(e)}isRecording(){return this._span.isRecording()}recordException(e,t){this._span.recordException(e,this._toSpanTime(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=Ua(t,[e].map(Dn));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._end(e.endTime)}_end(e){this._perf&&this._wallOrigin!==void 0&&this.isRecording()&&(this._span.attributes[`mxl.perf_clock_lag_delta_ms`]=this._perf.getClockLag(this._wallOrigin)),this._span.end(this._toSpanTime(e))}_toSpanTime(e){return!this._perf||this._wallOrigin===void 0?e:Ah(this._perf,this._wallOrigin,e)}};P(),I();var Mh=class{constructor({tracerProvider:e}={}){F(this,`_tracer`,void 0),F(this,`setSpan`,N.setSpan);let t=e==null?N:e;this._tracer=t.getTracer(`mxl-web-sdk-traces`)}startSpan(e,t={},n){t.attributes=t.attributes?t.attributes:{},t.attributes[z]=`perf`;let r=t.parentSpan?N.setSpan(j.active(),t.parentSpan):n;return jh.from(this._tracer.startSpan(e,t,r))}getSpan(e){let t=N.getSpan(e);if(t)return jh.from(t)}};P(),I();let Nh=[`perf`];var Ph=class extends Qc{constructor(e){let{perf:t}=e,n=Ua(e,Nh);super(n),F(this,`_perf`,void 0),this._perf=t}getTracer(e,t,n){return new Fh(super.getTracer(e,t,n),this._perf)}},Fh=class{constructor(e,t){F(this,`_tracer`,void 0),F(this,`_perf`,void 0),this._tracer=e,this._perf=t}startSpan(e,t={},n){return jh.start(this._tracer,this._perf,e,t,n)}startActiveSpan(e,...t){let n=t[t.length-1],r=t.length>1?t[0]:{},i=t.length>2?t[1]:j.active(),a=this.startSpan(e,r,i);return j.with(N.setSpan(i,a),()=>n(a))}};let Ih=e=>typeof e[`enduser.pseudo.id`]==`string`&&e[`enduser.pseudo.id`].length===32,Lh=e=>typeof e==`string`&&e.length===32;P(),I();var Rh=class{constructor({diag:e,storage:t}){F(this,`_diag`,void 0),F(this,`_storage`,void 0),F(this,`_mxlUserId`,null),this._diag=e==null?M.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(Dm,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(Dm)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(Em);if(e){let t=JSON.parse(e);Ih(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(Dm,t[`enduser.pseudo.id`]),this._storage.removeItem(Em)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(Em))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(Dm);e?Lh(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=Qn();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(Om)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(Om,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(Om)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let zh=({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),Bh=e=>e.visibilityState===`visible`&&e.hasFocus(),Vh=(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},Hh=({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)},Uh=({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)},Wh=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}}},Gh=(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`},Kh=(e,t)=>{try{let t=e.getItem(rr);return t?JSON.parse(t):null}catch(e){return t.warn(`Failed to retrieve tab activity`,e),null}},qh=(e,t,n,r)=>{let i=Jm(t,r),a,o;if(e===`same_origin`){let e=Kh(n,r);e&&Date.now()-e.lastActivityMs<=1e4&&(a=e.tabId,{experienceId:o}=e)}return o===void 0&&(o=Qn()),{navigationSource:e,tab:{experienceId:o,sourceTabId:a,tabId:i}}},Jh=({sessionStorage:e,localStorage:t,referrer:n,navigationPerformance:r,diag:i})=>{let a=Wh(n),o=Gh(a,r,i);try{let t=e.getItem(nr);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=qh(o,e,t,i);try{e.setItem(nr,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}},Yh=(e,t,n)=>{let r={experienceId:t.experienceId,lastActivityMs:Date.now(),tabId:t.tabId};try{e.setItem(rr,JSON.stringify(r))}catch(e){n.warn(`Failed to save tab activity`,e)}},Xh=(e,t,n)=>{let r=r=>{var i;if(r.button===1||r.ctrlKey||r.metaKey||r.shiftKey){Yh(t,e,n);return}(i=r.target)!=null&&i.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&Yh(t,e,n)},i={capture:!0,passive:!0};document.addEventListener(`auxclick`,r,i),document.addEventListener(`click`,r,i)};P(),I(),R();var Zh=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=or,tabStorage:d,referrer:f=typeof document<`u`?document.referrer:``,navigationPerformance:p=typeof window<`u`?window.performance:{getEntriesByType:()=>[]}}){F(this,`_state`,null),F(this,`_previousUserSessionId`,null),F(this,`_config`,void 0),F(this,`_dynamicConfigManager`,void 0),F(this,`_maxDurationTimeout`,null),F(this,`_isShutdown`,!1),F(this,`_permanentProperties`,{}),F(this,`_hasStoredState`,!1),F(this,`_activeSessionPartId`,null),F(this,`_sessionPartHistory`,[]),F(this,`_currentSessionPartNumber`,null),F(this,`_sessionPartSpan`,null),F(this,`_activeSessionPartCounts`,null),F(this,`_coldStart`,!0),F(this,`_nextSessionPartCounts`,{}),F(this,`_sdkStartupTimings`,null),F(this,`_sessionPartStartedListeners`,[]),F(this,`_sessionPartEndedListeners`,[]),F(this,`_tracer`,void 0),F(this,`_diag`,void 0),F(this,`_perf`,void 0),F(this,`_storage`,void 0),F(this,`_visibilityDoc`,void 0),F(this,`_limitManager`,void 0),F(this,`_target`,void 0),F(this,`_activityEvents`,void 0),F(this,`_onActivityThrottled`,void 0),F(this,`_sessionPartInactivityTimer`,null),F(this,`_tab`,void 0),F(this,`_navigationSource`,void 0),F(this,`_referrerScrubbedUrl`,void 0),F(this,`_analyticsManager`,null),F(this,`_onActivity`,()=>{try{if(!Bh(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)}}),F(this,`_onVisibilityChange`,()=>{this._handleEngagementTransition(`visibilitychange`)}),F(this,`_onFocus`,()=>{this._handleEngagementTransition(`focus`)}),F(this,`_onBlur`,()=>{this._handleEngagementTransition(`blur`)}),F(this,`_onPageShow`,e=>{this._handleEngagementTransition(e.persisted?`pageshow-bfcache`:`pageshow-initial`)}),F(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)}}),F(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?M.createComponentLogger({namespace:`MXLUserSessionManager`}):r,this._perf=i,this._visibilityDoc=a,this._storage=o,this._limitManager=s,this._permanentProperties=_r(this._storage,this._diag),this._tracer=N.getTracer(`mxl-web-sdk-session-parts`),this._target=c,this._activityEvents=u,this._onActivityThrottled=Vh(this._onActivity,l),this._config=t,this._dynamicConfigManager=n;let m=Jh({diag:this._diag,localStorage:o,navigationPerformance:p,referrer:f,sessionStorage:d});this._tab=m.tab,this._navigationSource=m.navigationSource,this._referrerScrubbedUrl=m.referrerScrubbedUrl,Xh(this._tab,o,this._diag),e._testInstances.add(this)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-session-parts`),Hh({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.getNow());this._state=t,n&&this._storeState()}recordSDKStartupTimings(e){this._sdkStartupTimings=L(L({},e),{},{initDuration:Math.max(1,Math.ceil(e.initDuration))})}claimReplaySample(e){let{state:t}=this._loadOrCreateUserSessionState(this._perf.getNow());if(t.replaySampled!==null)return this._state=t,t.replaySampled;let n=Math.random()<e;return this._state=L(L({},t),{},{replaySampled:n}),this._storeState(),n}nextReplayMetaVersion(){let{state:e}=this._loadOrCreateUserSessionState(this._perf.getNow()),t=e.replayMetaVersion+1;return this._state=L(L({},e),{},{replayMetaVersion:t}),this._storeState(),t}incrReplayCount(e){let{state:t}=this._loadOrCreateUserSessionState(this._perf.getNow());this._state=L(L({},t),{},{replayCounts:L(L({},t.replayCounts),{},{[e]:t.replayCounts[e]+1})}),this._storeState()}getReplayCounts(){return this._loadOrCreateUserSessionState(this._perf.getNow()).state.replayCounts}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{[Qr]:this._state.userSessionId,[$r]:n,[ei]: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.getNow(),t=this._storage.getItem(tr),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(tr,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(bh(this._visibilityDoc)===`background`||!this._visibilityDoc.hasFocus()){this._diag.debug(`skipping session part start (reason: ${e}) because the tab is not engaged`);return}let n=Qn(),r=this._nextSessionPartCounts;this._beginUserSessionForPartStart();let i=L(L({},this.getUserSessionAttributes()),{},{[z]:`ux.session_part`,[Vr]:`foreground`,[Zr]: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=jh.from(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.getNow():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=ar.has(e),i=this._perf.getNow(),a=n==null?i:n,o=this._sessionPartSpan;try{let n=L(L({"mxl.session_part_end_reason":e},this._activeSessionPartCounts),this._limitManager.getDiagnosticCounts());this._coldStart&&(n[`mxl.page_load`]=this._visibilityDoc.readyState===`complete`,this._sdkStartupTimings&&(n[`mxl.sdk_startup_duration`]=this._sdkStartupTimings.initDuration,n[`mxl.sdk_load_origin_offset`]=this._sdkStartupTimings.loadOriginOffset,n[`mxl.sdk_init_origin_offset`]=this._sdkStartupTimings.initOriginOffset)),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(L(L({},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($n),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.getNow():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.getNow())}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=L(L({},this._permanentProperties),{},{[i]:a});if(!vr(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.getNow());this._state=L(L({},o),{},{userSessionProperties:L(L({},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 L(L({},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=gr(this._storage,this._diag);!t&&!this._hasStoredState&&this._state&&(t=this._state);let n=!1;if(!t||lr(t,e)){var r;t&&(this._previousUserSessionId=t.userSessionId);let i=yh(this._storage,`mxl_user_session_number`,this._diag);t=ur(L(L({},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.getNow(),{state:t}=this._loadOrCreateUserSessionState(e);this._setupMaxDurationTimer(t,e),this._currentSessionPartNumber=yh(this._storage,`mxl_session_part_number`,this._diag),this._state=L(L({},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=L(L({},this._state),{},{inactivityDeadlineTs:e+this._state.inactivityTimeoutSeconds*1e3}),this._storeState()}_rolloverUserSession(e){var t,n;if(this._sessionPartSpan){let t=this._perf.getNow();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($n),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(),Uh({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=Bh(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=zh({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`,zh({defaultValue:ir,diag:this._diag,max:86400,min:30,value:(n=this._config.inactivityTimeoutSeconds)==null?i==null?void 0:i.userSessionInactivityTimeoutSeconds:n}),a,ir);return{foregroundInactivityTimeoutSeconds:this._withinMaxDuration(`session.foregroundInactivityTimeoutSeconds`,zh({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($n,JSON.stringify(this._state));return e&&(this._hasStoredState=!0),e}_removeFromPermanentProperties(e){if(!(e in this._permanentProperties))return;let t=L({},this._permanentProperties);delete t[e],this._permanentProperties=t,vr(this._storage,t)}_removeFromUserSessionProperties(e){if(!this._state||!(e in this._state.userSessionProperties))return;let t=L({},this._state.userSessionProperties);delete t[e],this._state=L(L({},this._state),{},{userSessionProperties:t}),this._storeState()}};F(Zh,`_testInstances`,new Set),I();var Qh=class{constructor({urlDocument:e=window.document}={}){F(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`browser.url.full`]||e.setAttribute(Kr,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};I();var $h=class{constructor({urlDocument:e=window.document}={}){F(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){e.attributes[`browser.url.full`]||(e.attributes[Kr]=this._urlDocument.URL)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};I();var eg=class{constructor({attributeScrubbers:e}){F(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)}};W(),I();var tg=class{constructor({urlDocument:e=window.document,visibilityDocument:t=window.document}={}){F(this,`_urlDocument`,void 0),F(this,`_visibilityDocument`,void 0),this._urlDocument=e,this._visibilityDocument=t}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`mxl.type`]||e.setAttribute(z,`sys.log`),e.setAttribute(Ma,this._urlDocument.URL),e.attributes[`mxl.is_tab_engaged`]===void 0&&e.setAttribute(`mxl.is_tab_engaged`,Bh(this._visibilityDocument))}shutdown(){return Promise.resolve(void 0)}};W();let ng=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[fa]:t;return typeof n==`string`&&n.includes(`://`)}return!1};W();var rg=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){$i(e.spanContext().traceId)}onEnding(e){ng(e)&&(e.attributes[z]=`perf.network_request`,e.attributes[`url.full`]===void 0&&(e.attributes[Ma]=e.attributes[fa]),e.attributes[`http.response.status_code`]===void 0&&(e.attributes[Ca]=e.attributes[pa]),e.attributes[`http.request.method`]===void 0&&(e.attributes[xa]=e.attributes[da]),e.attributes[`http.response.body.size`]===void 0&&(e.attributes[Um]=e.attributes[ha]),e.attributes[`http.request.body.size`]===void 0&&(e.attributes[`http.request.body.size`]=e.attributes[ma]))}onStart(){}shutdown(){return Promise.resolve(void 0)}};let ig=`Soft Navigation`,ag=`mxl.soft_navigation.source`,og=`mxl.soft_navigation.interaction_id`,sg=`mxl.soft_navigation.start_time`,cg=`mxl.soft_navigation.duration`,lg={performanceObserver:`performance_observer`,polyfill:`polyfill`},ug=e=>e.attributes[z]===`ux.session_part`,dg=e=>e.attributes[ag]!==void 0;P(),J(),I();let fg=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var pg=class{constructor({exporter:e,limitManager:t,userSessionManager:n,emptySessionAvoidanceEnabled:r=!1,diag:i=M.createComponentLogger({namespace:`MXLSessionPartBatchedSpanProcessor`})}){F(this,`_shutdownOnce`,void 0),F(this,`_pendingSpans`,[]),F(this,`_exporter`,void 0),F(this,`_limitManager`,void 0),F(this,`_userSessionManager`,void 0),F(this,`_emptySessionAvoidanceEnabled`,void 0),F(this,`_diag`,void 0),F(this,`_shutdown`,()=>this._exporter.shutdown()),this._diag=i,this._exporter=e,this._shutdownOnce=new Fs(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(ug(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&&ug(e[0])}_exportSpans(e){if(this._emptySessionAvoidanceEnabled&&this._isEmptySessionExport(e)){this._diag.debug(`Skipping export of empty session part`);return}qs._export(this._exporter,e).then(e=>{if(e.code===q.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(fg(r,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(fg(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(fg(`unknown`,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(fg(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}shutdown(){return this._shutdownOnce.call()}};I();var mg=class{constructor({pageManager:e}){F(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&&(t.path&&e.setAttribute(Jr,t.path),e.setAttribute(Yr,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&e.setAttribute(Xr,t)}shutdown(){return Promise.resolve(void 0)}};I();var hg=class{constructor({pageManager:e}){F(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&&(t.path&&(e.attributes[Jr]=t.path),e.attributes[Yr]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&(e.attributes[Xr]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};I();var gg=class{constructor({perf:e}){F(this,`_perf`,void 0),this._perf=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.setAttribute(Gr,this._perf.getClockLag())}shutdown(){return Promise.resolve(void 0)}};I();var _g=class{constructor({perf:e}){F(this,`_perf`,void 0),this._perf=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){e.attributes[Gr]=this._perf.getClockLag()}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};P(),J(),I();var vg=class{constructor({buffer:e}){F(this,`_buffer`,void 0),this._buffer=e}onEmit(e){try{let t=e.attributes[Wm];typeof t==`string`&&t.length>0&&this._buffer.record({kind:`log`,id:t,startTime:Zo(e.hrTime),type:e.attributes[z]})}catch(e){M.error(`failed to record log for signal correlation`,e)}}forceFlush(){return Promise.resolve(void 0)}shutdown(){return Promise.resolve(void 0)}};P(),J(),I();var yg=class{constructor({buffer:e}){F(this,`_buffer`,void 0),this._buffer=e}forceFlush(){return Promise.resolve(void 0)}onStart(e){try{if(dg(e)||ug(e))return;this._buffer.record({kind:`span`,id:e.spanContext().spanId,startTime:Zo(e.startTime),type:e.attributes[z]})}catch(e){M.error(`failed to record span for correlation`,e)}}onEnd(){}shutdown(){return Promise.resolve(void 0)}};I();var bg=class{constructor({attributeScrubbers:e}){F(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)}};I();var xg=class{constructor({userManager:e}){F(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._userManager.getUserId()&&e.setAttributes({[Gm]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}};I();var Sg=class{constructor({userSessionManager:e}){F(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({[Wm]:Qn(),[Qr]:s,[$r]:c,[Zr]:l})}shutdown(){return Promise.resolve(void 0)}};I();let Cg=`session.id`;var wg=class{constructor({userSessionManager:e}){F(this,`_userSessionManager`,void 0),this._userSessionManager=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){if(e.attributes[Cg]!==void 0)return;let t=this._userSessionManager.getUserSessionId();t&&(e.attributes[Cg]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};I();var Tg=class{constructor({userManager:e}){F(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEnding(e){let t=this._userManager.getUserId();t&&(e.attributes[Gm]=t)}onStart(){}onEnd(){}shutdown(){return Promise.resolve(void 0)}};I();var Eg=class{constructor({maxAgeMillis:e=6e4,maxEntries:t=4096}={}){F(this,`_maxAgeMillis`,void 0),F(this,`_maxEntries`,void 0),F(this,`_entries`,[]),F(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()}};P(),J();var Dg=class extends Ts{inject(e,t,n){super.inject(e,t,n);let r=N.getSpan(e);if(r){let e=t instanceof Headers?t.get(`traceparent`):Re.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};P(),I();var Og=class{constructor({namespace:e,storage:t,diag:n}){F(this,`_diag`,void 0),F(this,`_keyPrefix`,void 0),F(this,`_storage`,void 0),F(this,`_writeDisabled`,!1),this._diag=n==null?M.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 kg=({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},Ag=performance.now(),jg=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Mg=({collectorUrl:e,configUrl:t})=>[RegExp(`^${jg(e)}/v1/(traces|logs|metrics)(\\?|$)`),RegExp(`^${jg(t)}/((config|replay)(\\?|$)|sessionReplays/)`)];var Ng,Pg=n((()=>{Ng=`http.request.body.size`}));function Fg(...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}=Ig(t.body);return t.body=e,n}else return Promise.resolve(Rg(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>zg(e)):Promise.resolve()}}function Ig(e){if(!e.pipeThrough)return Kg.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 H(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Lg(e){return typeof Document<`u`&&e instanceof Document}function Rg(e){if(Lg(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return zg(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Bg(e);if(e instanceof URLSearchParams)return zg(e.toString());if(e.byteLength!==void 0)return e.byteLength;Kg.warn(`unknown body type`)}function zg(e){return qg.encode(e).byteLength}function Bg(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 Vg(e){let t=Hg(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Hg(){return Yg===void 0&&(Yg=Jg),Yg}function Ug(e){let t=Number(e.port||Xg[e.protocol]);if(t&&!isNaN(t))return t}function Wg(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch(t){return e}}function Gg(e){let t;try{t=new URL(e)}catch(t){return e}let n=!1;if((t.username||t.password)&&(t.username=Zg,t.password=Zg,n=!0),t.search.length>1){let e=!1,r=t.search.slice(1).split(`&`).map(t=>{let n=t.indexOf(`=`),r=n===-1?t:t.slice(0,n);return Qg.includes(Wg(r))?(e=!0,`${r}=${Zg}`):t});e&&(t.search=`?${r.join(`&`)}`,n=!0)}return n?t.href:e}var Kg,qg,Jg,Yg,Xg,Zg,Qg,$g=n((()=>{P(),J(),U(),Kg=M.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),qg=new TextEncoder,Jg={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Xg={"https:":`443`,"http:":`80`},Zg=`REDACTED`,Qg=[`sig`,`Signature`,`AWSAccessKeyId`,`X-Goog-Signature`,`X-Amz-Signature`,`X-Amz-Credential`,`X-Amz-Security-Token`]})),e_,t_=n((()=>{e_=`0.301.2`})),n_,r_=n((()=>{n_=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 i_(){return h_||(h_=document.createElement(`a`)),h_}function a_(e,t){return t in e}function o_(e,t,n,r=!0){if(a_(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function s_(e,t,n=!1,r){r===void 0&&(r=t.startTime!==0),n||(o_(e,`fetchStart`,t,r),o_(e,`domainLookupStart`,t,r),o_(e,`domainLookupEnd`,t,r),o_(e,`connectStart`,t,r),o_(e,`secureConnectionStart`,t,r),o_(e,`connectEnd`,t,r),o_(e,`requestStart`,t,r),o_(e,`responseStart`,t,r),o_(e,`responseEnd`,t,r))}function c_(e){return e.slice().sort((e,t)=>{let n=e.fetchStart,r=t.fetchStart;return n>r?1:n<r?-1:0})}function l_(){return typeof location<`u`?location.origin:void 0}function u_(e,t,n,r,i=new WeakSet,a){let o=p_(e);e=o.toString();let s=f_(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=c_(s);if(o.origin!==l_()&&c.length>1){let e=c[0],t=d_(c,e.responseEnd,n),r=e.responseEnd;return t.fetchStart<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function d_(e,t,n){let r=Yo(n),i=Yo(qo(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=Yo(qo(n.fetchStart)),c=r-Yo(qo(n.responseEnd));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function f_(e,t,n,r,i,a){let o=Yo(t),s=Yo(n),c=r.filter(t=>{let n=Yo(qo(t.fetchStart)),r=Yo(qo(t.responseEnd));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 p_(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=i_();return t.href=e,t}function m_(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),p_(e).origin===l_()?!0:n.some(t=>As(e,t))}var h_,g_=n((()=>{J()})),__=n((()=>{r_(),g_()})),v_,y_,b_,x_=n((()=>{Pg(),$g(),t_(),P(),J(),__(),W(),I(),v_=300,y_=typeof PerformanceObserver<`u`,b_=class extends ho{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,e_,e),F(this,`component`,`fetch`),F(this,`version`,e_),F(this,`moduleName`,this.component),F(this,`_usedResources`,new WeakSet),F(this,`_tasksCount`,0)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[n_.FETCH_START]},N.setSpan(j.active(),e));s_(n,t,this.getConfig().ignoreNetworkEvents,void 0),n.end(t[n_.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=p_(t.url);e.setAttribute(Ca,t.status),e.setAttribute(wa,n.hostname);let r=Ug(n);r&&e.setAttribute(Ta,r)}_addHeaders(e,t){if(!m_(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};hn.inject(j.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)hn.inject(j.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);hn.inject(j.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(js(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n={},r=t.method,i=Vg(t.method||`GET`),a=i;return n[xa]=i,i!==r&&(n[Sa]=r),n[Ma]=Gg(e),this.tracer.startSpan(a,{kind:Ct.CLIENT,attributes:n})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=u_(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)),s_(e,t,this.getConfig().ignoreNetworkEvents,void 0)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=K(Date.now()),i=Ko();this._addFinalSpanAttributes(e,n),n.status>=400&&(e.setStatus({code:Tt.ERROR}),e.setAttribute(_a,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},v_)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._enabled)return e.apply(this,n);let r=this,i=p_(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&&Fg(...n).then(e=>{e&&o.setAttribute(Ng,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 j.with(N.setSpan(j.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&&ro(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&ro(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=Ko(),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(!y_){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}if(!this._enabled){if(this._isFetchPatched){this._diag.debug(`fetch constructor already patched`),this._enabled=!0;return}if(typeof globalThis.fetch!=`function`){this._diag.warn(`globalThis.fetch is missing or not a function; instrumentation will not be enabled. Register the instrumentation after any fetch polyfill, or call enable() once fetch is available.`);return}try{this._wrap(globalThis,`fetch`,this._patchConstructor()),this._isFetchPatched=!0,this._enabled=!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(){y_&&this._enabled&&(this._enabled=!1,this._usedResources=new WeakSet)}}})),S_=n((()=>{x_()})),C_,w_=n((()=>{C_=`http.request.body.size`}));function T_(e){return typeof Document<`u`&&e instanceof Document}function E_(e){if(T_(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return D_(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return O_(e);if(e instanceof URLSearchParams)return D_(e.toString());if(e.byteLength!==void 0)return e.byteLength;P_.warn(`unknown body type`)}function D_(e){return F_.encode(e).byteLength}function O_(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 k_(e){let t=A_(),n=e.toUpperCase();return n in t?n:`_OTHER`}function A_(){return L_===void 0&&(L_=I_),L_}function j_(e){let t=Number(e.port||R_[e.protocol]);if(t&&!isNaN(t))return t}function M_(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch(t){return e}}function N_(e){let t;try{t=new URL(e)}catch(t){return e}let n=!1;if((t.username||t.password)&&(t.username=z_,t.password=z_,n=!0),t.search.length>1){let e=!1,r=t.search.slice(1).split(`&`).map(t=>{let n=t.indexOf(`=`),r=n===-1?t:t.slice(0,n);return B_.includes(M_(r))?(e=!0,`${r}=${z_}`):t});e&&(t.search=`?${r.join(`&`)}`,n=!0)}return n?t.href:e}var P_,F_,I_,L_,R_,z_,B_,V_=n((()=>{P(),J(),P_=M.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),F_=new TextEncoder,I_={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},R_={"https:":`443`,"http:":`80`},z_=`REDACTED`,B_=[`sig`,`Signature`,`AWSAccessKeyId`,`X-Goog-Signature`,`X-Amz-Signature`,`X-Amz-Credential`,`X-Amz-Security-Token`]})),H_,U_=n((()=>{H_=`0.301.2`})),W_,G_,K_=n((()=>{w_(),V_(),U_(),P(),vo(),J(),__(),W(),I(),W_=300,G_=class extends ho{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,H_,e),F(this,`component`,`xml-http-request`),F(this,`version`,H_),F(this,`moduleName`,this.component),F(this,`_tasksCount`,0),F(this,`_xhrMem`,new WeakMap),F(this,`_usedResources`,new WeakSet)}init(){}_addHeaders(e,t){let n=p_(t).href;if(!m_(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};hn.inject(j.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};hn.inject(j.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){j.with(N.setSpan(j.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[n_.FETCH_START]});s_(e,t,this.getConfig().ignoreNetworkEvents,void 0),e.end(t[n_.RESPONSE_END])})}_addFinalSpanAttributes(e,t){t.status&&e.setAttribute(Ca,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&ro(()=>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=p_(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&&(performance.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=performance.getEntriesByType(`resource`));let o=u_(p_(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)),s_(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=p_(t);if(js(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i={},a=n,o=k_(n),s=o;i[xa]=o,o!==a&&(i[Sa]=a),i[Ma]=N_(r.toString()),i[wa]=r.hostname;let c=j_(r);c&&(i[Ta]=c);let l=this.tracer.startSpan(s,{kind:Ct.CLIENT,attributes:i});return l.addEvent(`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._enabled)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:Tt.ERROR,message:a}),t.setAttribute(_a,a)):o.status&&o.status>=400&&(t.setStatus({code:Tt.ERROR}),t.setAttribute(_a,String(o.status)))}let s=Ko(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},W_)}function r(){n(`error`,this,!0,`error`)}function i(){n(`abort`,this,!1)}function a(){n(`timeout`,this,!0,`timeout`)}function o(){this.status<299?n(`loaded`,this,!1):n(`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._enabled)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=E_(e);t!==void 0&&l.setAttribute(C_,t)}j.with(N.setSpan(j.active(),l),()=>{e._tasksCount++,c.sendStartTime=Ko(),l.addEvent(`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._enabled){if(this._isXhrPatched){this._diag.debug(`reactivating existing patch on`,this.moduleName,this.version),this._enabled=!0;return}try{this._diag.debug(`applying patch to`,this.moduleName,this.version);let e=XMLHttpRequest.prototype;for(let t of[`open`,`send`])if(typeof e[t]!=`function`){this._diag.warn(`XMLHttpRequest.prototype.${t} is missing or not a function; instrumentation will not be enabled. Register the instrumentation after any XMLHttpRequest polyfill, or call enable() once it is available.`);return}this._wrap(e,`open`,this._patchOpen()),this._wrap(e,`send`,this._patchSend()),this._isXhrPatched=!0,this._enabled=!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._enabled&&(this._enabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),q_=n((()=>{K_()})),J_=r({FetchInstrumentation:()=>b_,XMLHttpRequestInstrumentation:()=>G_}),Y_=n((()=>{S_(),q_()}));U(),R();let X_=typeof __MXL_SSR__<`u`&&__MXL_SSR__?H(function*(){return[]}):function(){var e=H(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(()=>(Y_(),J_));if(a){var l,u,d,f;i.push(new s(L(L({},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(L(L({},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 Z_=(e={},t=[])=>X_(e,t),Q_={isRecording:()=>!1,setEnabled:()=>{}};P(),I();let $_=new class{constructor({diagLogger:e=M.createComponentLogger({namespace:`mxl-registry`})}={}){F(this,`_sdk`,null),F(this,`_diag`,void 0),F(this,`register`,e=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=e}),F(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),F(this,`registered`,()=>this._sdk),this._diag=e}};R();let ev=[`enabled`,`apiKey`],tv={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`},nv=e=>{let t=Object.keys(tv).filter(t=>t in e),n=e.defaultInstrumentationConfig,r=t.map(e=>`'${e}' was removed, use '${tv[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.`)},rv=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},iv=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},av=(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(/\/+$/,``)},ov=e=>{var t,n;nv(e);let r=(t=e.replay)==null?{}:t,{enabled:i=!0,apiKey:a}=r,o=Ua(r,ev),{defaults:s=!0,queryParams:c=[],scrubbers:l=[]}=(n=e.scrubbing)==null?{}:n;return{appId:rv(e.appId),appVersion:iv(e.appVersion),attributeScrubbers:[...s?Ba(c):[],...l],collectorUrl:av(`collectorUrl`,e.collectorUrl,`http://mxl-otelcol.apps.ocpthikadev01.safaricom.net`),configUrl:av(`configUrl`,e.configUrl,`http://mxl-basket.apps.ocpthikadev01.safaricom.net`),replay:{apiKey:a,enabled:i,options:o},session:L({},e.session),performance:L({},e.performance)}};P(),U();let sv=new WeakMap,cv=e=>sv.get(e),lv=()=>{if(typeof window>`u`||typeof window.fetch!=`function`)return()=>void 0;let e=window.fetch,t=function(){var t=H(function*(t,n){var r;let i=(r=N.getActiveSpan())==null?void 0:r.spanContext(),a=yield e.call(window,t,n);return i&&Ze(i)&&sv.set(a,i),a});return function(e,n){return t.apply(this,arguments)}}();return window.fetch=t,()=>{window.fetch===t&&(window.fetch=e),sv=new WeakMap}},uv=(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}>`};I();var dv=class extends V{constructor({diag:e,perf:t,shouldTrack:n,innerTextForElement:r}={}){super({config:{},diag:e,instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),F(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":uv(t,r?r(t):t.textContent)},this.perf.offsetToAbsoluteTime(e.timeStamp))}catch(e){this._diag.error(`failed to create new user interaction span event`,e)}}}onDisable(){document.removeEventListener(`click`,this._onClickHandler)}onEnable(){document.addEventListener(`click`,this._onClickHandler)}};R();let fv=[`diag`];function pv(e){var t,n;return typeof PerformanceObserver<`u`&&((t=(n=PerformanceObserver.supportedEntryTypes)==null?void 0:n.includes(e))==null?!1:t)}function mv(e,t,n){let r=n==null?{}:n,{diag:i}=r,a=Ua(r,fv);if(!pv(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(L({buffered:!0,type:e},a)),n}catch(e){return null}}let hv=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 gv(e,t){return t in e}function Z(e,t,n,r,i=!0){if(gv(r,n)&&typeof r[n]==`number`&&!(i&&r[n]===0))return e.addEvent(n,t.offsetToAbsoluteTime(r[n]))}function _v(e,t,n,r=!1){let i=n.startTime===0,a=e=>!i||e===`secureConnectionStart`;r||(Z(e,t,`fetchStart`,n,a(`fetchStart`)),Z(e,t,`domainLookupStart`,n,a(`domainLookupStart`)),Z(e,t,`domainLookupEnd`,n,a(`domainLookupEnd`)),Z(e,t,`connectStart`,n,a(`connectStart`)),Z(e,t,`secureConnectionStart`,n,a(`secureConnectionStart`)),Z(e,t,`connectEnd`,n,a(`connectEnd`)),Z(e,t,`requestStart`,n,a(`requestStart`)),Z(e,t,`responseStart`,n,a(`responseStart`)),Z(e,t,`responseEnd`,n,a(`responseEnd`)));let o=n.encodedBodySize;o!==void 0&&e.setAttribute(`http.response_content_length`,o);let s=n.decodedBodySize;s!==void 0&&o!==s&&e.setAttribute(`http.response_content_length_uncompressed`,s)}let vv=()=>window.performance.getEntriesByType(`navigation`)[0],yv=(e=vv())=>{var t;let n=e==null?void 0:e.notRestoredReasons;return n==null||(t=n.reasons)==null?void 0:t.map(e=>e.reason)},bv=()=>{let e={},t=vv();return t?(Object.values(hv).forEach(n=>{if(gv(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=yv(t),e):e},xv={"first-contentful-paint":`firstContentfulPaint`,"first-paint":`firstPaint`},Sv=(e,t)=>{window.performance.getEntriesByType(`paint`).forEach(({name:n,startTime:r})=>{gv(xv,n)&&e.addEvent(xv[n],t.offsetToAbsoluteTime(r))})};P(),J(),vo(),W(),I();var Cv=class extends V{constructor({diag:e,perf:t,applyCustomAttributesOnSpan:n,ignorePerformancePaintEvents:r=!1,ignoreNetworkEvents:i=!1}={}){super({config:{},diag:e,instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),F(this,`_navigationObserver`,null),F(this,`_performanceCollected`,!1),F(this,`_applyCustomAttributesOnSpan`,void 0),F(this,`_ignorePerformancePaintEvents`,void 0),F(this,`_ignoreNetworkEvents`,void 0),this._applyCustomAttributesOnSpan=n,this._ignorePerformancePaintEvents=r,this._ignoreNetworkEvents=i}_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`)===xs),t=bv(),n=(e==null?void 0:e.content)||``;j.with(hn.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}j.with(N.setSpan(j.active(),n),()=>{let e=this._startSpan(`documentFetch`,`fetchStart`,t);e&&(e.setAttribute(Ma,location.href),j.with(N.setSpan(j.active(),e),()=>{var n;_v(e,this.perf,t,this._ignoreNetworkEvents),this._addResourceAttributesToSpan(e,t),this._addNavigationTimingAttributesToSpan(e,t),this._addCustomAttributesOnSpan(e,(n=this._applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,`responseEnd`,t)}))}),n.setAttribute(z,`ux.document_load`),n.setAttribute(Ma,location.href),n.setAttribute(Fa,navigator.userAgent),this._addResourcesSpans(n),this._ignoreNetworkEvents||(Z(n,this.perf,`fetchStart`,t),Z(n,this.perf,`unloadEventStart`,t),Z(n,this.perf,`unloadEventEnd`,t),Z(n,this.perf,`domInteractive`,t),Z(n,this.perf,`domContentLoadedEventStart`,t),Z(n,this.perf,`domContentLoadedEventEnd`,t),Z(n,this.perf,`domComplete`,t),Z(n,this.perf,`loadEventStart`,t),Z(n,this.perf,`loadEventEnd`,t)),this._ignorePerformancePaintEvents||Sv(n,this.perf),this._addCustomAttributesOnSpan(n,(e=this._applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,`loadEventEnd`,t)})}_endSpan(e,t,n){e&&(gv(n,t)&&typeof n[t]==`number`?e.end(this.perf.offsetToAbsoluteTime(n[t])):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(`resourceFetch`,`fetchStart`,e,t);r&&(r.setAttribute(Ma,e.name),_v(r,this.perf,e,this._ignoreNetworkEvents),this._addResourceAttributesToSpan(r,e),this._addResourceDiagnosticAttributes(r,e),this._addCustomAttributesOnResourceSpan(r,e,(n=this._applyCustomAttributesOnSpan)==null?void 0:n.resourceFetch),this._endSpan(r,`responseEnd`,e))}_startSpan(e,t,n,r){if(gv(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:this.perf.offsetToAbsoluteTime(n[t])},r?N.setSpan(j.active(),r):void 0)}_addCustomAttributesOnSpan(e,t){t&&ro(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addResourceAttributesToSpan(e,t){e.setAttribute(z,`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(Ca,t.responseStatus),t.encodedBodySize!==void 0&&e.setAttribute(Um,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(qr,t.notRestoredReasons)}_addCustomAttributesOnResourceSpan(e,t,n){n&&ro(()=>{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(){this._collectIfLoadEventFinished(),!this._performanceCollected&&(this._navigationObserver=mv(`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()}};I();var wv=class extends V{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ElementTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),F(this,`_observer`,null)}onEnable(){if(!pv(`element`)){this._isEnabled=!1,this._diag.debug(`element not supported, skipping`);return}if(this._observer=mv(`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:{[z]:`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.offsetToAbsoluteTime(0)});e.loadTime>0&&r.addEvent(`load`,this.perf.offsetToAbsoluteTime(e.loadTime,e.startTime)),r.end(this.perf.offsetToAbsoluteTime(e.startTime))}};I();var Tv=class extends V{constructor({diag:e,perf:t,rootNode:n,emptyCheckDelayMs:r=500}){super({config:{},diag:e,instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),F(this,`_observer`,void 0),F(this,`_emptyCheckDelayMs`,void 0),F(this,`_rootNode`,void 0),F(this,`_pendingEmptyChecks`,new Set),this._rootNode=n,this._emptyCheckDelayMs=r,this._observer=new MutationObserver((e,t)=>{this._observerCallback(e)}),this._rootNode||this._diag.warn(`supplied root node was null, this instrumentation won't be enabled`)}onDisable(){this._observer.disconnect();for(let e of this._pendingEmptyChecks)clearTimeout(e);this._pendingEmptyChecks.clear()}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));if(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`);let e=setTimeout(()=>{this._pendingEmptyChecks.delete(e),this._checkForEmptyRootNode()},this._emptyCheckDelayMs);this._pendingEmptyChecks.add(e)}}_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`)}}};I();var Ev=class extends V{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),F(this,`_onErrorHandler`,void 0),F(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=e=>{this.logManager.logException(e.error||e.message,{handled:!1,handler:`global_exception`,timestamp:this.perf.offsetToAbsoluteTime(e.timeStamp)})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,handler:`promise_rejection`,timestamp:this.perf.offsetToAbsoluteTime(e.timeStamp)})}}onDisable(){window.removeEventListener(`error`,this._onErrorHandler),window.removeEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}onEnable(){window.addEventListener(`error`,this._onErrorHandler),window.addEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}};let Dv=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},Ov=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#${n.id}`:[Dv(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};P(),I();var kv=class extends V{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`FirstInteractionInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),F(this,`_onClick`,void 0),F(this,`_onKeyDown`,void 0),F(this,`_onScroll`,void 0),F(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})}}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=Ov(e.target));let r={[z]:`mxl.otel_log`,"first_interaction.interaction_type":e.interactionType,"first_interaction.element_type":t,"first_interaction.element_selector":n,"first_interaction.time":this.perf.getOffsetFromZeroTime(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.offsetToAbsoluteTime(e.timestamp),eventName:`first-interaction`,severityNumber:k.INFO,attributes:r})}};let Av=(e,t)=>!!e&&Dh(e==null?``:e,t),jv=({initEnabled:e,remote:t,sessionId:n})=>{var r,i,a;let o=(r=t==null?void 0:t.pctEnabled)==null?100:r,s=(i=t==null?void 0:t.intervalMs)==null?3e4:i;return{enabled:((a=e==null?t==null?void 0:t.enabled:e)==null?!1:a)&&Av(n,o),intervalMs:s,pctEnabled:o}},Mv=({initEnabled:e,remote:t,sessionId:n})=>{var r,i,a,o,s;let c=(r=t==null?void 0:t.pctEnabled)==null?10:r;return{enabled:((i=e==null?t==null?void 0:t.enabled:e)==null?!1:i)&&Av(n,c),maxBufferSize:(a=t==null?void 0:t.maxBufferSize)==null?1e4:a,pctEnabled:c,sampleIntervalMs:(o=t==null?void 0:t.sampleIntervalMs)==null?10:o,windowMs:(s=t==null?void 0:t.windowMs)==null?1e4:s}},Nv=(e,t,n)=>{var r,i;let a=e.frames[t];if(!a)return`(unknown)`;let o=a.name&&a.name.length>0?a.name:`(anonymous)`,s=a.resourceId===void 0?``:e.resources[a.resourceId],c=s?n(s):`(inline)`,l=(r=a.line)==null?0:r,u=(i=a.column)==null?0:i;return`${o} (${c}:${String(l)}:${String(u)})`},Pv=(e,t,n)=>{let r=[],i=t,a=new Set;for(;i!==void 0&&!a.has(i);){a.add(i);let t=e.stacks[i];if(!t)break;r.push(Nv(e,t.frameId,n)),i=t.parentId}return r.reverse(),r},Fv=e=>new TextEncoder().encode(e).length,Iv=(e,t)=>{let n=new Map,r=new Map;for(let a of e.samples){var i;let o=Pv(e,a.stackId,t);if(o.length===0)continue;let s=o[o.length-1];n.set(s,((i=n.get(s))==null?0:i)+1);let c=o.join(`
12
+ `),l=r.get(c);l?l.samples+=1:r.set(c,{frames:o,samples:1})}let a=[...n.entries()].sort((e,t)=>t[1]-e[1]).slice(0,200).map(([e,t])=>({frame:e,selfTime:t})),o={stacks:[...r.values()].sort((e,t)=>t.samples-e.samples),top:a},s=JSON.stringify(o);for(;Fv(s)>65536&&o.stacks.length>0;)o.stacks.pop(),s=JSON.stringify(o);return o};P(),I(),U();let Lv=()=>globalThis.Profiler;var Rv=class extends V{constructor({diag:e,dynamicConfigManager:t,initEnabled:n,perf:r,redactUrl:i=e=>e}){super({config:{enabled:!1},diag:e,instrumentationName:`JsProfilerInstrumentation`,instrumentationVersion:`1.0.0`,perf:r}),F(this,`_dynamicConfigManager`,void 0),F(this,`_initEnabled`,void 0),F(this,`_redactUrl`,void 0),F(this,`_windowsThisSession`,0),F(this,`_sessionId`,null),F(this,`_capturing`,!1),F(this,`_loadTimer`,void 0),F(this,`_loafObserver`,null),F(this,`_removeConfigListener`,void 0),F(this,`_removeSessionListener`,void 0),F(this,`_removeLoadListener`,void 0),this._dynamicConfigManager=t,this._initEnabled=n,this._redactUrl=i,this._removeConfigListener=t.onConfigChange(()=>{this._syncFromConfig()}),this._removeSessionListener=this.userSessionManager.addSessionPartStartedListener(()=>{let e=this.userSessionManager.getUserSessionId();e!==this._sessionId&&(this._sessionId=e,this._windowsThisSession=0),this._syncFromConfig()})}onEnable(){if(!Lv()){this._diag.debug(`JS Self-Profiling Profiler is not available`);return}this._scheduleLoadWindow(),this._observeLoaf()}onDisable(){var e,t;this._clearLoadTimer(),(e=this._removeLoadListener)==null||e.call(this),this._removeLoadListener=void 0,(t=this._loafObserver)==null||t.disconnect(),this._loafObserver=null,this._capturing=!1}enable(){this._effective().enabled&&super.enable()}disable(){var e,t;(e=this._removeConfigListener)==null||e.call(this),this._removeConfigListener=void 0,(t=this._removeSessionListener)==null||t.call(this),this._removeSessionListener=void 0,super.disable()}_syncFromConfig(){if(!Lv()){super.disable();return}if(this._effective().enabled){this.enable();return}super.disable()}_scheduleLoadWindow(){let e=()=>{this._clearLoadTimer();let{windowMs:e}=this._effective();this._loadTimer=setTimeout(()=>{this._loadTimer=void 0,this._capture(`load`)},e)};if(document.readyState===`complete`){e();return}let t=()=>{var t;(t=this._removeLoadListener)==null||t.call(this),this._removeLoadListener=void 0,e()};window.addEventListener(`load`,t),this._removeLoadListener=()=>{window.removeEventListener(`load`,t)}}_observeLoaf(){this._loafObserver||!pv(`long-animation-frame`)||(this._loafObserver=mv(`long-animation-frame`,e=>{e.duration>200&&this._capture(`loaf`)},{diag:this._diag}))}_effective(){var e;return Mv({initEnabled:this._initEnabled,remote:(e=this._dynamicConfigManager.getConfig().performance)==null?void 0:e.profiling,sessionId:this.userSessionManager.getUserSessionId()})}_capture(e){var t=this;return H(function*(){if(t._capturing||t._windowsThisSession>=3)return;let n=Lv();if(!n||!t._isEnabled)return;let{maxBufferSize:r,sampleIntervalMs:i,windowMs:a}=t._effective();t._capturing=!0,t._windowsThisSession+=1;let o=t.perf.getNow();try{let s=new n({maxBufferSize:r,sampleInterval:i});yield new Promise(e=>{setTimeout(e,a)});let c=yield s.stop();t._emit(c,e,t.perf.getNow()-o)}catch(e){t._diag.debug(`JS Self-Profiling capture failed`,e)}finally{t._capturing=!1}})()}_emit(e,t,n){let r=Iv(e,this._redactUrl);this.logger.emit({attributes:{[ni]:Qn(),"mxl.profile.duration_ms":Math.round(n),"mxl.profile.sample_count":e.samples.length,"mxl.profile.trigger":t},body:JSON.stringify(r),eventName:`browser.js_profile`,severityNumber:k.INFO})}_clearLoadTimer(){this._loadTimer!==void 0&&(clearTimeout(this._loadTimer),this._loadTimer=void 0)}};let zv=()=>`mxlv2-${Date.now()}-${Math.floor(Math.random()*8999999999999)+0xe8d4a51000}`;P(),I();var Bv=class extends V{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`LoafInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),F(this,`_observer`,null),F(this,`_isFirstEntry`,!0),F(this,`_totalDuration`,0),F(this,`_workDuration`,0),F(this,`_styleLayoutDuration`,0),F(this,`_count`,0),F(this,`_longestDuration`,0),F(this,`_longestDurationExcludingFirst`,0),F(this,`_totalBlockingDuration`,0),F(this,`_scriptSummaries`,new Map)}onEnable(){if(!pv(`long-animation-frame`)){this._isEnabled=!1,this._diag.debug(`long-animation-frame not supported, skipping`);return}if(this._observer=mv(`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={[z]:`ux.web_vital`,"mxl.web_vital.id":zv(),"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:k.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:{[z]:`ux.loaf_scripts`},body:JSON.stringify(Object.fromEntries(e)),eventName:`mxl-loaf-scripts`,severityNumber:k.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 Vv=(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}};P(),I(),R();var Hv=class extends V{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`MaxScrollDepthInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),F(this,`_onScrollHandler`,void 0),F(this,`_hasScrolled`,!1),F(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)}}}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=Vv();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:k.INFO,attributes:L({[z]:`mxl.otel_log`,"max_scroll_depth.pixels":this._maxScrollY,"max_scroll_depth.did_scroll":this._hasScrolled},e?L(L({},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))}};let Uv={computePressure:`mxl.browser.compute_pressure.state`,heapLimit:`mxl.browser.js_heap.limit`,heapTotal:`mxl.browser.js_heap.total`,heapUsed:`mxl.browser.js_heap.used`,uaMemory:`mxl.browser.memory.measured`},Wv=e=>/edg\//i.test(e)?`edge`:/firefox\//i.test(e)||/fxios\//i.test(e)?`firefox`:/chrome\//i.test(e)||/crios\//i.test(e)?`chrome`:/safari\//i.test(e)?`safari`:`other`;W();let Gv=({appId:e,appVersion:t,serviceName:n,userAgent:r})=>{let i={[Ea]:n,[Da]:t,app_version:t,sdk_platform:`web`,"browser.family":Wv(r)};return e&&(i[ti]=e),i},Kv=({onFlush:e,onPause:t,onResume:n},r=document,i=window)=>{let a=()=>{if(r.hidden){t();return}n()},o=()=>{e()};return r.addEventListener(`visibilitychange`,a),i.addEventListener(`pagehide`,o),r.hidden&&t(),()=>{r.removeEventListener(`visibilitychange`,a),i.removeEventListener(`pagehide`,o)}};function qv(){var e;let t=((e=void 0)==null?`cumulative`:e).toLowerCase();return t===`cumulative`?Xv:t===`delta`?Zv:t===`lowmemory`?Qv:(M.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${t}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Xv)}function Jv(e){return e==null?qv():e===0?Zv:e===2?Qv:Xv}function Yv(e){var t;return(t=e==null?void 0:e.aggregationPreference)==null?(()=>$v):t}var Xv,Zv,Qv,$v,ey,ty=n((()=>{J(),Ef(),Zp(),P(),I(),Xv=()=>ul.CUMULATIVE,Zv=e=>{switch(e){case Y.COUNTER:case Y.OBSERVABLE_COUNTER:case Y.GAUGE:case Y.HISTOGRAM:case Y.OBSERVABLE_GAUGE:return ul.DELTA;case Y.UP_DOWN_COUNTER:case Y.OBSERVABLE_UP_DOWN_COUNTER:return ul.CUMULATIVE}},Qv=e=>{switch(e){case Y.COUNTER:case Y.HISTOGRAM:return ul.DELTA;case Y.GAUGE:case Y.UP_DOWN_COUNTER:case Y.OBSERVABLE_UP_DOWN_COUNTER:case Y.OBSERVABLE_COUNTER:case Y.OBSERVABLE_GAUGE:return ul.CUMULATIVE}},$v=Object.freeze({type:Nu.DEFAULT}),ey=class extends yp{constructor(e,t){super(e),F(this,`_aggregationTemporalitySelector`,void 0),F(this,`_aggregationSelector`,void 0),this._aggregationSelector=Yv(t),this._aggregationTemporalitySelector=Jv(t==null?void 0:t.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}}})),ny,ry=n((()=>{ny=`otlp_http_metric_exporter`}));function iy(){return 2*uy*Math.random()-uy}function ay(e){return new dy(e.transport)}var oy,sy,cy,ly,uy,dy,fy=n((()=>{P(),I(),U(),oy=5,sy=1e3,cy=5e3,ly=1.5,uy=.2,dy=class{constructor(e){F(this,`_transport`,void 0),this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}send(e,t){var n=this;return H(function*(){let r=oy,i=sy,a=Date.now()+t,o=yield n._transport.send(e,t);for(;o.status===`retryable`&&r>0;){var s;r--;let t=Math.max(Math.min(i*(1+iy()),cy),0);i*=ly;let c=(s=o.retryInMillis)==null?t:s,l=a-Date.now();if(c>l)return M.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),o;M.verbose(`Scheduling export retry in ${Math.round(c)}ms`),o=yield n.retry(e,l,c)}return o.status===`success`?M.verbose(`Export succeeded after ${oy-r} retry attempts.`):o.status===`retryable`?M.info(`Export failed after maximum retry attempts (${oy}).`):M.info(`Export failed with non-retryable error: ${o.error}`),o})()}shutdown(){return this._transport.shutdown()}}}));function py(e){return e===429||e===502||e===503||e===504}function my(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var hy=n((()=>{}));function gy(e){return new wy(e)}function _y(e){return e instanceof TypeError&&!e.cause}function vy(e){return yy.apply(this,arguments)}function yy(){return yy=H(function*(e){try{let t=e.body;if(t==null)return;let n=t.getReader();try{let e=yield n.read();for(;!e.done;)e=yield n.read()}finally{n.releaseLock()}}catch(e){M.debug(`error reading export response body: ${e}`)}}),yy.apply(this,arguments)}var by,xy,Sy,Cy,wy,Ty=n((()=>{hy(),J(),P(),I(),U(),by=61440,xy=9,Sy=0,Cy=0,wy=class{constructor(e){F(this,`_parameters`,void 0),this._parameters=e}send(e,t){var n=this;return H(function*(){let r=new AbortController,i=setTimeout(()=>r.abort(),t),a=globalThis.fetch;typeof a.__original==`function`&&(a=a.__original);let o=e.byteLength,s=Sy+o>by,c=!s&&!(Cy>=xy);if(c)Sy+=o,Cy++;else{let e=s?`size limit`:`count limit`;M.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${Cy} pending (${e})`)}let l=xo(j.active()),u=!1,d=()=>{u||(u=!0,c&&(Sy-=o,Cy--),clearTimeout(i))},f=!1;try{let t=new URL(n._parameters.url),i=yield n._parameters.headers(),o=yield j.with(l,()=>a(t.href,{method:`POST`,headers:i,body:e,signal:r.signal,keepalive:c,mode:globalThis.location?globalThis.origin===t.origin?`same-origin`:`cors`:`no-cors`}));return vy(o).then(d,d),f=!0,o.status>=200&&o.status<=299?(M.debug(`export response success (status: ${o.status})`),{status:`success`}):py(o.status)?(M.warn(`export response retryable (status: ${o.status})`),{status:`retryable`,retryInMillis:my(o.headers.get(`Retry-After`))}):(M.error(`export response failure (status: ${o.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${o.status}`)})}catch(e){return _y(e)?(M.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(M.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{f||d()}})()}shutdown(){}}}));function Ey(e,t,n){return Lp(e,t,n,ay({transport:gy(e)}))}var Dy=n((()=>{Rp(),fy(),Ty()}));function Oy(e){let t={};return Object.entries(e==null?{}:e).forEach(([e,n])=>{n===void 0?M.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}var ky=n((()=>{P()}));function Ay(e,t,n){return H(function*(){let r=L({},yield n()),i={};return t!=null&&Object.assign(i,yield t()),e!=null&&Object.assign(i,Oy(yield e())),Object.assign(i,r)})}function jy(e){if(e!=null)try{var t;let n=(t=globalThis.location)==null?void 0:t.href;return new URL(e,n).href}catch(t){throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function My(e,t,n){var r,i;return L(L({},Tp(e,t,n)),{},{headers:Ay(e.headers,t.headers,n.headers),url:(r=(i=jy(e.url))==null?t.url:i)==null?n.url:r})}function Ny(e,t){return L(L({},Ep()),{},{headers:function(){var t=H(function*(){return e});return function(){return t.apply(this,arguments)}}(),url:`http://localhost:4318/`+t})}var Py=n((()=>{Dp(),ky(),R(),U()}));function Fy(e){return typeof e.headers==`function`?e.headers:wp(e.headers)}var Iy=n((()=>{Dp()}));function Ly(e,t,n){return My({url:e.url,timeoutMillis:e.timeoutMillis,headers:Fy(e),concurrencyLimit:e.concurrencyLimit},{},Ny(n,t))}var Ry=n((()=>{Py(),Iy()}));function zy(e,t,n,r){return new Yp({componentType:e,metricsHelper:t,url:n,meterProvider:r,responseAttributesFromError:e=>{if(!e)return{[zp]:200};if(!(e instanceof Error))return{};if(e.message.startsWith(`Fetch request failed with non-retryable status `)){let t=e.message.substring(47);return{[zp]:Number(t)}}return{}}})}function By(e,t,n,r,i,a,o){let s=Ly(e,a,o);return Ey(s,t,zy(n,r,s.url,e.selfObsMeterProvider))}var Vy=n((()=>{Gp(),Xp(),Dy(),Ry()})),Hy=n((()=>{Vy()})),Uy,Wy=n((()=>{ty(),ry(),_p(),Hy(),I(),Uy=class extends ey{constructor(e){super(By(e==null?{}:e,rp,ny,tl,e==null?void 0:e.selfObsMeterProvider,`v1/metrics`,{"Content-Type":`application/json`}),e),F(this,`_url`,void 0),this._url=e==null?void 0:e.url}setSelfObsMeterProvider(e){this.setMetrics(zy(ny,tl,this._url,e))}}})),Gy=n((()=>{Wy()})),Ky=n((()=>{Gy()})),qy=r({startMemoryMeterProvider:()=>Jy}),Jy,Yy=n((()=>{Ky(),ac(),Ef(),U(),Jy=function(){var e=H(function*({collectorUrl:e,exportIntervalMs:t,headers:n,resourceAttributes:r}){let i=new wf({readers:[new ed({exporter:new Uy({headers:n,url:`${e}/v1/metrics`}),exportIntervalMillis:t})],resource:Zs(r)});return{flush:()=>i.forceFlush(),meter:i.getMeter(`mxl-browser-memory`),shutdown:()=>i.shutdown()}});return function(t){return e.apply(this,arguments)}}()}));I(),U();let Xy=[`nominal`,`fair`,`serious`,`critical`],Zy=e=>Xy.some(t=>t===e);var Qy=class extends V{constructor({appId:e,appVersion:t,collectorUrl:n,createMeterProvider:r,diag:i,dynamicConfigManager:a,initEnabled:o,perf:s,serviceName:c,userId:l,visibilityDoc:u=document}){super({config:{enabled:!1},diag:i,instrumentationName:`MemoryInstrumentation`,instrumentationVersion:`1.0.0`,perf:s}),F(this,`_appId`,void 0),F(this,`_appVersion`,void 0),F(this,`_collectorUrl`,void 0),F(this,`_createMeterProvider`,void 0),F(this,`_dynamicConfigManager`,void 0),F(this,`_initEnabled`,void 0),F(this,`_serviceName`,void 0),F(this,`_userId`,void 0),F(this,`_visibilityDoc`,void 0),F(this,`_meterHandle`,void 0),F(this,`_paused`,!1),F(this,`_reportedHeap`,!1),F(this,`_pressureObserver`,void 0),F(this,`_lastUaMemoryAt`,0),F(this,`_lastUaBytes`,void 0),F(this,`_unbindVisibility`,void 0),F(this,`_removeConfigListener`,void 0),F(this,`_removeSessionListener`,void 0),F(this,`_startGeneration`,0),F(this,`_currentIntervalMs`,void 0),this._appId=e,this._appVersion=t,this._collectorUrl=n,this._createMeterProvider=r,this._dynamicConfigManager=a,this._initEnabled=o,this._serviceName=c,this._userId=l,this._visibilityDoc=u,this._removeConfigListener=a.onConfigChange(()=>{this._syncFromConfig()}),this._removeSessionListener=this.userSessionManager.addSessionPartStartedListener(()=>{this._syncFromConfig()})}onEnable(){this._unbindVisibility=Kv({onFlush:()=>{var e;(e=this._meterHandle)==null||e.flush()},onPause:()=>{this._paused=!0;try{var e;(e=this._pressureObserver)==null||e.disconnect()}catch(e){}this._pressureObserver=void 0},onResume:()=>{this._paused=!1,this._observePressure()}},this._visibilityDoc),this._startMeters()}onDisable(){var e;this._startGeneration+=1,(e=this._unbindVisibility)==null||e.call(this),this._unbindVisibility=void 0;try{var t;(t=this._pressureObserver)==null||t.disconnect()}catch(e){}this._pressureObserver=void 0;let n=this._meterHandle;this._meterHandle=void 0,this._paused=!1,n==null||n.shutdown()}enable(){this._effective().enabled&&super.enable()}disable(){var e,t;(e=this._removeConfigListener)==null||e.call(this),this._removeConfigListener=void 0,(t=this._removeSessionListener)==null||t.call(this),this._removeSessionListener=void 0,super.disable()}isCollectionPaused(){return this._paused}_effective(){var e;return jv({initEnabled:this._initEnabled,remote:(e=this._dynamicConfigManager.getConfig().performance)==null?void 0:e.memory,sessionId:this.userSessionManager.getUserSessionId()})}_syncFromConfig(){let e=this._effective();if(e.enabled){this._isEnabled&&this._currentIntervalMs!==void 0&&this._currentIntervalMs!==e.intervalMs&&super.disable(),this._currentIntervalMs=e.intervalMs,this.enable();return}super.disable()}_startMeters(){var e=this;return H(function*(){var t;let n=e._startGeneration,r=(t=e._createMeterProvider)==null?(yield Promise.resolve().then(()=>(Yy(),qy))).startMemoryMeterProvider:t,i=e._effective(),a=e._appId&&e._userId?el(e._appId,e._userId):{},o=yield r({collectorUrl:e._collectorUrl,exportIntervalMs:i.intervalMs,headers:a,resourceAttributes:Gv({appId:e._appId,appVersion:e._appVersion,serviceName:e._serviceName,userAgent:navigator.userAgent})});if(n!==e._startGeneration||!e._isEnabled){yield o.shutdown();return}e._meterHandle=o,e._registerInstruments(o.meter),e._observePressure()})()}_registerInstruments(e){e.createObservableGauge(Uv.heapUsed,{unit:`By`}).addCallback(e=>{this._observeHeap(e,`usedJSHeapSize`)}),e.createObservableGauge(Uv.heapTotal,{unit:`By`}).addCallback(e=>{this._observeHeap(e,`totalJSHeapSize`)}),e.createObservableGauge(Uv.heapLimit,{unit:`By`}).addCallback(e=>{this._observeHeap(e,`jsHeapSizeLimit`)}),e.createObservableGauge(Uv.uaMemory,{unit:`By`}).addCallback(e=>{this._observeUaMemory(e)})}_observeHeap(e,t){if(this._paused)return;let n=performance.memory;if(n&&(e.observe(n[t]),!this._reportedHeap)){var r;this._reportedHeap=!0,(r=this.userSessionManager.getSessionPartSpan())==null||r.setAttribute(`browser.memory_reported`,!0)}}_observeUaMemory(e){this._paused||(this._lastUaBytes!==void 0&&e.observe(this._lastUaBytes),this._refreshUaMemory())}_refreshUaMemory(){var e=this;return H(function*(){if(e._paused||!crossOriginIsolated)return;let t=performance.measureUserAgentSpecificMemory;if(!t)return;let n=e.perf.getNow();if(!(n-e._lastUaMemoryAt<3e5)){e._lastUaMemoryAt=n;try{e._lastUaBytes=(yield t.call(performance)).bytes}catch(t){e._diag.debug(`measureUserAgentSpecificMemory failed`,t)}}})()}_observePressure(){var e;if(this._paused||this._pressureObserver)return;let t=globalThis.PressureObserver;if(!t)return;let n=(e=this._meterHandle)==null?void 0:e.meter;if(!n)return;let r=n.createCounter(Uv.computePressure);try{this._pressureObserver=new t(e=>{if(this._paused)return;let t=e[e.length-1];!t||!Zy(t.state)||r.add(1,{state:t.state})}),this._pressureObserver.observe(`cpu`)}catch(e){this._diag.debug(`PressureObserver is not available`,e),this._pressureObserver=void 0}}};P(),I();var $y=class extends V{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`RageClickInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),F(this,`_onClickHandler`,void 0),F(this,`_flushHandler`,()=>{try{this._flush()}catch(e){this._diag.error(`failed to emit rage-click log`,e)}}),F(this,`_eventWindow`,null),this._onClickHandler=e=>{try{this._handleClick(e)}catch(e){this._diag.error(`failed to process rage-click candidate`,e)}}}onDisable(){document.removeEventListener(`click`,this._onClickHandler),this._flushHandler()}onEnable(){document.addEventListener(`click`,this._onClickHandler),this.setSessionPartListeners({end:this._flushHandler})}_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:setTimeout(this._flushHandler,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;clearTimeout(e.timeoutId),this._eventWindow=null,!(e.count<3)&&this.logger.emit({timestamp:this.perf.offsetToAbsoluteTime(e.timestamp),eventName:`rage-click`,severityNumber:k.INFO,attributes:{[z]:`mxl.otel_log`,"rage_click.element_type":e.target.tagName.toLowerCase(),"rage_click.element_selector":Ov(e.target),"rage_click.x":e.x,"rage_click.y":e.y,"rage_click.count":e.count,"rage_click.interaction_type":e.interactionType}})}};P(),I();var eb=class extends V{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ServerTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),F(this,`_performanceCollected`,!1)}onEnable(){this._readServerTiming()}onDisable(){}_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:{[z]:`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:k.INFO})}}};I(),R();function tb(e,t){return t.startTime<=e&&e<=t.startTime+t.duration?t:null}var nb=class extends V{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}),F(this,`_observer`,null),F(this,`_eventObserver`,null),F(this,`_pendingNavigations`,[]),F(this,`_usePolyfill`,!1),F(this,`_navigationHost`,void 0),F(this,`_signalBuffer`,void 0),F(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}enable(){pv(`soft-navigation`)?(this._usePolyfill=!1,super.enable()):this._navigationHost.navigation&&pv(`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=mv(`soft-navigation`,e=>this._processEntry(e),{diag:this._diag}),this._observer||(this._isEnabled=!1,this._diag.error(`failed to enable`))}_enablePolyfill(){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=mv(`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.offsetToAbsoluteTime(e.startTime),r=this.perf.offsetToAbsoluteTime(e.startTime+e.duration,e.startTime);this.tracer.startSpan(ig,{startTime:n,attributes:L({[Kr]:e.name,[ag]:lg.performanceObserver,"mxl.soft_navigation.navigation_id":e.navigationId,[og]:e.interactionId,[sg]:this.perf.getOffsetFromZeroTime(e.startTime),[cg]:e.duration,"mxl.soft_navigation.paint_time":e.paintTime==null?void 0:this.perf.getOffsetFromZeroTime(e.paintTime),"mxl.soft_navigation.presentation_time":e.presentationTime==null?void 0:this.perf.getOffsetFromZeroTime(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})=>tb(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.offsetToAbsoluteTime(e.startTime),a=this.perf.offsetToAbsoluteTime(t,e.startTime);this.tracer.startSpan(ig,{startTime:i,attributes:L({[Kr]:n,[ag]:lg.polyfill,[sg]:this.perf.getOffsetFromZeroTime(e.startTime),[cg]:t-e.startTime,[og]:e.interactionId===0?void 0:e.interactionId},this._correlationAttributes(i,a))}).end(a)}};let rb=`mxl.user_timing.start_time`,ib=`mxl.user_timing.duration`,ab=`mxl.user_timing.entry_type`;P(),I(),R();var ob=class extends V{constructor({diag:e,perf:t,limitManager:n,allowedEntries:r}={}){super({config:{},diag:e,instrumentationName:`UserTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),F(this,`_markObserver`,null),F(this,`_measureObserver`,null),F(this,`_seenEntries`,new Set),F(this,`_allowedEntries`,void 0),this._allowedEntries=r}onEnable(){this._seenEntries=new Set,this._markObserver=mv(`mark`,this._processEntry.bind(this),{diag:this._diag}),this._markObserver||this._diag.error(`failed to enable mark observer`),this._measureObserver=mv(`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:L({[z]:`ux.user_timing`,[Ur]:`user_timing`,[ab]:e.entryType,[rb]:this.perf.getOffsetFromZeroTime(e.startTime),[ib]:e.duration},t!=null&&{"mxl.user_timing.detail":JSON.stringify(t)}),startTime:this.perf.offsetToAbsoluteTime(e.startTime)}).end(this.perf.offsetToAbsoluteTime(e.startTime+e.duration,e.startTime));return}let{detail:r}=e,i=r==null?void 0:JSON.stringify(r);this.logger.emit({attributes:{[z]:`ux.user_timing`,"mxl.user_timing.name":e.name,[rb]:this.perf.getOffsetFromZeroTime(e.startTime),[ib]:e.duration,[ab]:e.entryType},body:i,eventName:`mxl-user-timing`,severityNumber:k.INFO,timestamp:this.perf.offsetToAbsoluteTime(e.startTime)})}};let sb=`mxl.web_vital.attribution.`;var cb=r({CLSThresholds:()=>Pb,FCPThresholds:()=>Mb,INPThresholds:()=>qb,LCPThresholds:()=>Xb,TTFBThresholds:()=>ex,onCLS:()=>Ib,onFCP:()=>Lb,onINP:()=>Jb,onLCP:()=>$b,onTTFB:()=>nx});function lb(e,t){let n=hb.get(t);return n||(n=new WeakMap,hb.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var ub,db,fb,pb,mb,hb,gb,_b,vb,Q,yb,bb,xb,Sb,Cb,wb,Tb,$,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx=n((()=>{I(),R(),ub=class{constructor(){F(this,`t`,void 0),F(this,`o`,0),F(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)}},db=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},fb=e=>{if(document.readyState===`loading`)return`loading`;let t=db();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`},pb=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},mb=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){var n;let r=e,i=r.id?`#`+r.id:[pb(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},hb=new WeakMap,gb=-1,_b=()=>gb,vb=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(gb=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)))}},yb=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},bb=()=>{var e,t;return(e=(t=db())==null?void 0:t.activationStart)==null?0:e},xb=-1,Sb=new Set,Cb=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,wb=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of Sb)e();isFinite(xb)||(xb=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,wb,!0))}},Tb=(e=!1)=>{if(e&&(xb=1/0),xb<0){var t;let e=bb(),n=document.prerendering||(t=globalThis.performance.getEntriesByType(`visibility-state`).find(t=>t.name===`hidden`&&t.startTime>=e))==null?void 0:t.startTime;xb=n==null?Cb():n,addEventListener(`visibilitychange`,wb,!0),addEventListener(`prerenderingchange`,wb,!0),vb(()=>{setTimeout(()=>{xb=Cb()})})}return{get firstHiddenTime(){return xb},onHidden(e){Sb.add(e)}}},$=(e,t=-1,n,r=0,i,a,o)=>{let s=db(),c=(s==null?void 0:s.navigationId)||0,l=`navigate`;return n?l=n:_b()>=0?l=`back-forward-cache`:s&&(document.prerendering||bb()>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}},Eb=(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(L({type:t,buffered:!0},n));return e}}catch(e){}},Db=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},Ob=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let t=e.keys().next().value;t!==void 0&&e.delete(t)}},kb=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Ab=class{constructor(){F(this,`u`,void 0)}},jb=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},Mb=[1800,3e3],Nb=(e,t={})=>{let n=Db(t);jb(()=>{let r=lb(t,Ab),i=Tb(),a,o=$(`FCP`),s=Eb([`paint`],e=>{for(let t of e)t.name===`first-contentful-paint`&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(o.value=Math.max(t.startTime-bb(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,a(!0)))});s&&(a=Q(e,o,Mb,t.reportAllChanges),vb(n=>{o=$(`FCP`,-1,`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,_b()),a=Q(e,o,Mb,t.reportAllChanges),yb(()=>{o.value=performance.now()-n.timeStamp,a(!0)})})),n&&Eb([`soft-navigation`],n=>{n.forEach(n=>{r.u&&n.navigationId&&Ob(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,Mb,t.reportAllChanges),a(!0)})},t)})},Pb=[.1,.25],Fb=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],Ib=(e,t={})=>{let n=lb(t=Object.assign({},t),ub),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=Fb(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?mb(o):i;r.set(n,e)}}},((e,t={})=>{let n=Tb();Nb(kb(()=>{let r,i=$(`CLS`,0),a=lb(t,ub),o=(n,o,s,c,l)=>{i=$(`CLS`,0,n,o,s,c,l),a.o=0,r=Q(e,i,Pb,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`];Db(t)&&u.push(`soft-navigation`);let d=Eb(u,l);d&&(r=Q(e,i,Pb,t.reportAllChanges),n.onHidden(()=>{l(d.takeRecords()),r(!0)}),vb(()=>{o(`back-forward-cache`,i.navigationId,i.navigationInteractionId,i.navigationURL,_b()),yb(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=Fb(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:fb(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},Lb=(e,t={})=>{let n=lb(t=Object.assign({},t),Ab);Db(t)&&(n.u=new Map),Nb(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:fb(_b())};if(e.navigationType!==`soft-navigation`){if(e.entries.length){let n=db(),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:fb(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)},Rb=0,zb=1/0,Bb=0,Vb=e=>{for(let t of e)t.interactionId&&(zb=Math.min(zb,t.interactionId),Bb=Math.max(Bb,t.interactionId),Rb=Bb?(Bb-zb)/7+1:0)},Ub=()=>{var e;return Hb?Rb:(e=performance.interactionCount)==null?0:e},Wb=()=>{`interactionCount`in performance||Hb||(Hb=Eb([`event`],Vb,{durationThreshold:0}))},Gb=class{constructor(){F(this,`h`,0),F(this,`v`,[]),F(this,`p`,new Map),F(this,`m`,void 0),F(this,`M`,void 0)}T(){return Ub()-this.h}D(){this.h=Ub(),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)}}},Kb=e=>{let t=`requestIdleCallback`in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let i=kb(e),a=-1,o=()=>{r(a),i()};addEventListener(`visibilitychange`,o,{once:!0,capture:!0}),a=n(()=>{removeEventListener(`visibilitychange`,o,{capture:!0}),i()},{timeout:t})}},qb=[200,500],Jb=(e,t={})=>{let n=lb(t=Object.assign({},t),Gb),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(c=!0,Kb(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?mb(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:fb(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:fb(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})};Eb([`long-animation-frame`],e=>{r=r.concat(e),l()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=Tb();jb(()=>{var r;Wb();let i,a=$(`INP`),o=lb(t,Gb),s=(n,r,s,c,l)=>{o.D(),a=$(`INP`,-1,n,r,s,c,l),i=Q(e,a,qb,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)=>{Kb(()=>{for(let t of e)t.entryType===`soft-navigation`?l(t):o.l(t);c(),t&&i(!0)})},d=[`event`,`first-input`];Db(t)&&d.push(`soft-navigation`);let f=Eb(d,u,L(L({},t),{},{durationThreshold:(r=t.durationThreshold)==null?40:r}));i=Q(e,a,qb,t.reportAllChanges),f&&(n.onHidden(()=>{u(f.takeRecords(),!0)}),vb(()=>{s(`back-forward-cache`,a.navigationId,a.navigationInteractionId,a.navigationURL,_b())}))})})(t=>{e(f(t))},t)},Yb=class{constructor(){F(this,`m`,void 0),F(this,`u`,void 0)}l(e){var t;(t=this.m)==null||t.call(this,e)}},Xb=[2500,4e3],Zb=50,Qb=[],Eb([`resource`],e=>{for(let t of e)Qb.push(t),Qb.length>Zb&&Qb.shift()}),$b=(e,t={})=>{(t=Object.assign({},t)).resourceBufferSize!=null&&(Zb=t.resourceBufferSize);let n=lb(t,Yb),r=new WeakMap;Db(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?mb(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{let n=!1,r=Db(t);jb(()=>{let i,a=Tb(),o=$(`LCP`),s=lb(t,Yb),c=(r,s,c,l,u)=>{o=$(`LCP`,-1,r,s,c,l,u),i=Q(e,o,Xb,t.reportAllChanges),n=!1,r===`soft-navigation`&&(a=Tb(!0))},l=e=>{var t;s.u&&e.navigationId&&Ob(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-bb(),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=Eb(d,u);if(f){i=Q(e,o,Xb,t.reportAllChanges);let a=[`keydown`,`click`,`visibilitychange`],s=e=>{if(e.isTrusted&&!n){let e=o.id;Kb(()=>{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});vb(r=>{c(`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,_b()),i=Q(e,o,Xb,t.reportAllChanges),yb(()=>{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&&(Qb.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=db(),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=L(L({},t),{},{timeToFirstByte:n,resourceLoadDelay:r-n,resourceLoadDuration:i-r,elementRenderDelay:e.value-i,navigationEntry:u})}}return Object.assign(e,{attribution:t})})(t))},t)},ex=[800,1800],tx=e=>{document.prerendering?jb(()=>tx(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>tx(e),!0)},nx=(e,t={})=>{((e,t={})=>{let n=Db(t),r=$(`TTFB`),i=Q(e,r,ex,t.reportAllChanges);tx(()=>{let a=db();if(a){let o=a.responseStart;r.value=Math.max(o-bb(),0),r.entries=[a],i(!0),vb(()=>{r=$(`TTFB`,0,`back-forward-cache`,r.navigationId,r.navigationInteractionId,r.navigationURL,_b()),i=Q(e,r,ex,t.reportAllChanges),i(!0)}),n&&Eb([`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,ex,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)}}));U();let ix=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],ax=function(){var e=H(function*(){let{onCLS:e,onFCP:t,onINP:n,onLCP:r,onTTFB:i}=yield Promise.resolve().then(()=>(rx(),cb));return{CLS:e,FCP:t,LCP:r,INP:n,TTFB:i,FID:void 0}});return function(){return e.apply(this,arguments)}}();P(),J(),vo(),I(),R();let ox=[`diag`,`perf`,`listeners`,`urlDocument`,`urlAttribution`,`includeRawAttribution`,`reportSoftNavs`,`pageManager`,`applyCustomLogRecordData`],sx=e=>Math.round(Math.max(0,e)),cx=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)}},lx=e=>{let t=typeof e;return t===`number`||t===`string`||t===`boolean`},ux=(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[`${sb}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},dx=(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:Ov((t=n==null?void 0:n.node)==null?null:t),startRect:cx(n==null?void 0:n.previousRect),endRect:cx(n==null?void 0:n.currentRect)}}),r=sb;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},fx=(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[`${sb}element_type`]=a)}catch(e){t.error(`error building INP element type attribution`,e)}return n},px=(e,t)=>{let n={},r=e.attribution.navigationEntry;if(r)try{var i;let e=sx(r.redirectEnd-r.redirectStart),t=sx(r.domainLookupEnd-r.domainLookupStart),a=sx(r.secureConnectionStart>0?r.secureConnectionStart-r.connectStart:r.connectEnd-r.connectStart),o=sx(r.secureConnectionStart>0?r.connectEnd-r.secureConnectionStart:0),s=sx(Math.max((i=r.finalResponseHeadersStart)==null?0:i,r.responseStart)-r.requestStart),c=sx(Math.round(r.responseEnd-r.startTime)-e-t-a-o-s),l=sb;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},mx=(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(cx(t.getBoundingClientRect())),i=sb;n[`${i}elementType`]=e,n[`${i}elementBoundingRect`]=r}}catch(e){t.error(`error building LCP element attribution`,e)}return n};var hx=class extends V{constructor(e={}){let{diag:t,perf:n,listeners:r,urlDocument:i,urlAttribution:a=!0,includeRawAttribution:o=!0,reportSoftNavs:s=!0,pageManager:c,applyCustomLogRecordData:l}=e,u=Ua(e,ox);super({config:u,diag:t,instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,perf:n}),F(this,`_listeners`,void 0),F(this,`_urlDocument`,void 0),F(this,`_urlAttribution`,void 0),F(this,`_includeRawAttribution`,void 0),F(this,`_softNavsActive`,void 0),F(this,`_pageManager`,void 0),F(this,`_attributedPage`,{CLS:void 0,FCP:void 0,INP:void 0,LCP:void 0,TTFB:void 0}),F(this,`_largestShiftTargetForCLS`,null),F(this,`_clsMetricId`,void 0),F(this,`_applyCustomLogRecordData`,void 0),F(this,`_listenersRegistered`,!1),F(this,`_listenersProvided`,void 0),this._listeners=r==null?{}:r,this._urlDocument=i==null?window.document:i,this._urlAttribution=a,this._includeRawAttribution=o,this._softNavsActive=s&&pv(`soft-navigation`),this._pageManager=c==null?Yn.getPageManager():c,this._applyCustomLogRecordData=l,this._listenersProvided=r!==void 0}onDisable(){this._diag.debug(`WebVitalsInstrumentation disabled, pausing emission`)}onEnable(){if(this._listenersRegistered){this._diag.debug(`WebVitalsInstrumentation listeners already registered, resuming emission`);return}if(this._listenersRegistered=!0,this._listenersProvided){this._registerListeners();return}ax().then(e=>{this._isEnabled&&(this._listeners=e,this._registerListeners())})}_registerListeners(){ix.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.offsetToAbsoluteTime(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.offsetToAbsoluteTime(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.getNow():this.perf.offsetToAbsoluteTime(n)}_emitWebVital(e){let t=this._attributedPage[e.name],n=this._getTimeForMetric(e),r=this.userSessionManager.getSessionPartIdAt(n),i=yv(),a={attributes:L(L(L(L(L(L(L(L(L({[z]:`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,"browser.web_vital.navigation_id":e.navigationId},e.navigationInteractionId===void 0?{}:{"browser.web_vital.interaction_id":e.navigationInteractionId}),r===null?{}:{[Zr]:r}),i!=null&&i.length?{[qr]:i}:{}),t?{[Kr]:e.navigationURL!=null&&(e.navigationType===`soft-navigation`||this._softNavsActive)?e.navigationURL:t.fullURL,[Jr]:t.path,[Yr]:t.pageID,[Xr]:t.label}:{}),e.name===`INP`?ux(e,this._diag):{}),e.name===`INP`?fx(e,this._diag):{}),e.name===`TTFB`?px(e,this._diag):{}),e.name===`CLS`?dx(e,this._diag):{}),e.name===`LCP`?mx(e,this._diag):{}),body:this._includeRawAttribution?JSON.stringify(Object.fromEntries(Object.entries(e.attribution).filter(([,e])=>lx(e)))):void 0,eventName:`browser.web_vital`,severityNumber:k.INFO,timestamp:K(n)};this._applyCustomLogRecordData&&ro(()=>{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)}};R();let gx=(e={},{logManager:t,userSessionManager:n,pageManager:r,limitManager:i,includeReplay:a=!1,autoStart:o=!0,replayOptions:s,replayContext:c,sessionStorage:l,signalBuffer:u,performanceContext:d})=>{var f,p,m,h,g,_,v,y,b,x,S,ee,te,ne,re;let C=[];if((f=e.omit)!=null&&f.has(`exception`)||C.push(new Ev(e.exception)),(p=e.omit)!=null&&p.has(`click`)||C.push(new dv(e.click)),(m=e.omit)!=null&&m.has(`rage-click`)||C.push(new $y(e[`rage-click`])),(h=e.omit)!=null&&h.has(`first-interaction`)||C.push(new kv(e[`first-interaction`])),(g=e.omit)!=null&&g.has(`max-scroll-depth`)||C.push(new Hv(e[`max-scroll-depth`])),(_=e.omit)!=null&&_.has(`web-vital`)||C.push(new hx(L(L({},e[`web-vital`]),{},{pageManager:r}))),(v=e.omit)!=null&&v.has(`loaf`)||C.push(new Bv(L({},e.loaf))),(y=e.omit)!=null&&y.has(`user-timing`)||C.push(new ob(e[`user-timing`])),(b=e.omit)!=null&&b.has(`element-timing`)||C.push(new wv(L(L({},e[`element-timing`]),{},{limitManager:i}))),(x=e.omit)!=null&&x.has(`soft-navigation-performance`)||C.push(new nb(L({limitManager:i,signalBuffer:u},e[`soft-navigation-performance`]))),(S=e.omit)!=null&&S.has(`document-load`)||C.push(new Cv(e[`document-load`])),(ee=e.omit)!=null&&ee.has(`server-timing`)||C.push(new eb(L(L({},e[`server-timing`]),{},{limitManager:i}))),e[`empty-root`]&&C.push(new Tv(L({},e[`empty-root`]))),d&&!((te=e.omit)!=null&&te.has(`memory`))&&C.push(new Qy({appId:d.appId,appVersion:d.appVersion,collectorUrl:d.collectorUrl,dynamicConfigManager:d.dynamicConfigManager,initEnabled:d.initPerformance.memory,serviceName:d.serviceName,userId:d.userId})),d&&!((ne=e.omit)!=null&&ne.has(`js-profiler`))&&C.push(new Rv({dynamicConfigManager:d.dynamicConfigManager,initEnabled:d.initPerformance.profiling,redactUrl:d.redactUrl})),a&&!((re=e.omit)!=null&&re.has(`replay`))){if(!c)throw Error(`replayContext is required when includeReplay is true`);if(!l)throw Error(`sessionStorage is required when includeReplay is true`);C.push(new Za({autoStart:o,replayContext:c,rrwebOptions:s,sessionStorage:l}))}for(let e of C)e instanceof V&&(n&&e.setUserSessionManager(n),t&&e.setLogManager(t),i&&e.setLimitManager(i));return C};P(),vo(),ac(),R(),U();let _x=(e={})=>{let{resource:t=Qs(),spanExporters:n=[],logExporters:r=[],spanProcessors:a=[],propagator:o=null,defaultInstrumentationConfig:s,instrumentations:c=[],contextManager:l=null,logProcessors:u=[],logLevel:d=i.ERROR,diagLogger:f=M.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:p,dynamicSDKConfig:m,registerGlobally:h=!0,blockNetworkSpanForwarding:g=!1,restrictedProtocols:_=new Set([`file:`]),useDocumentTitleAsPageLabel:v=!0,serviceName:y,exception:b}=e;try{var x,S,ee,te,ne;if(h){let e=$_.registered();if(e!==null)return f.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}if(M.setLogger(new de,{logLevel:d}),typeof window>`u`)return f.warn(`browser not detected, skipping initialization`),!1;let i=new oi,re=i.getOffsetFromOrigin();window.addEventListener(`pageshow`,e=>i.setZeroTimeOffset(e.timeStamp)),window.addEventListener(`blur`,i.checkDrift),window.document.addEventListener(`visibilitychange`,i.checkDrift);let C=ov(e),{appId:w,appVersion:ie,collectorUrl:ae,configUrl:oe}=C,se=w!==void 0;if(!se&&!r.length&&!n.length)throw Error(`when appId is omitted, at least one logExporter or spanExporter must be set`);if(_.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(se&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let ce=h?void 0:w,T=new Og({diag:f,namespace:ce,storage:Tm(`localStorage`,f)}),le=new Og({diag:f,namespace:ce,storage:Tm(`sessionStorage`,f)}),ue=vx({registerGlobally:h,sdkLocalStorage:T}),E=ue.getMXLUserId();if(se&&!E)throw Error(`userID is required when using MXL exporter`);let fe=L({},m),D=p==null?new dh({appId:w,appVersion:ie,configUrl:oe,defaultConfig:fe,deviceId:E,storage:T}):p;D.refreshRemoteConfig();let pe=(x=(S=D.resolveApplicationServiceName)==null?void 0:S.call(D,y))==null?(()=>{var e;return(y==null?void 0:y.trim())||((e=D.getConfig().serviceName)==null?void 0:e.trim())||Ym})():x,me=Xm({serviceName:pe}).merge(t).merge(Zm({appId:w,appVersion:ie,diagLogger:f,enduserPseudoId:E,pageSessionStorage:le})),he=new kh({blockNetworkSpanForwarding:g,deviceId:E,dynamicConfigManager:D});if(!he.isSDKEnabled())return f.debug(`SDK is disabled, skipping initialization.`),!1;let ge=kg({defaultInstrumentationConfig:s,diag:f,featureManager:he,propagator:o,registerGlobally:h}),_e=new hh(ph),O=yx({dynamicConfigManager:D,limitManager:_e,perf:i,registerGlobally:h,sdkLocalStorage:T,sdkSessionStorage:le,userSessionConfig:C.session}),ve,ye;w!==void 0&&(ve=new pg({emptySessionAvoidanceEnabled:he.isEmptySessionAvoidanceEnabled(),exporter:new vm({appId:w,collectorUrl:ae,userID:E}),limitManager:_e,userSessionManager:O}),ye=new Tc({exporter:new gm({appId:w,collectorUrl:ae,userID:E})}));let be=Sx({registerGlobally:h,useDocumentTitleAsPageLabel:v,userSessionManager:O,perf:i}),xe=!(s==null||(ee=s.omit)==null)&&ee.has(`soft-navigation-performance`)?void 0:new Eg,{tracerProvider:Se,mxlTraceManager:Ce}=bx({attributeScrubbers:C.attributeScrubbers,contextManager:l,mxlSpanProcessor:ve,pageManager:be,perf:i,propagator:ge?new Dg:o,registerGlobally:h,resource:me,signalBuffer:xe,spanExporters:n,spanProcessors:a,userManager:ue,userSessionManager:O});O.setTracerProvider(Se);let{loggerProvider:we,mxlLogManager:Te}=xx({attributeScrubbers:C.attributeScrubbers,exception:b,limitManager:_e,logExporters:r,logProcessors:u,mxlLogProcessor:ye,pageManager:be,perf:i,registerGlobally:h,resource:me,sdkLocalStorage:T,signalBuffer:xe,userManager:ue,userSessionManager:O,visibilityDoc:window.document}),Ee=new Hm({appId:w==null?``:w,loggerProvider:we,pageManager:be,storage:T,userManager:ue,userSessionManager:O});O.setAnalyticsManager(Ee),h&&Hn.setGlobalAnalyticsManager(Ee),O.startSessionPartInternal({reason:`init`});let De=typeof window<`u`&&window.__MXL_DISABLE_SESSION_RECORDER===!0,{autoStart:Oe,replay:ke}=fh({autoStart:C.replay.enabled,dynamicConfig:D.getConfig(),isSessionReplayEnabled:he.isSessionReplayEnabled(),replay:C.replay.options}),Ae=!!(se&&E&&!De&&he.isSessionReplayEnabled()),je=Ae&&Oe&&ke!=null&&ke.omitRedundantInstrumentations?[`click`,`exception`,`@opentelemetry/instrumentation-fetch`,`@opentelemetry/instrumentation-xml-http-request`]:void 0,Me=je===void 0?s:L(L({},s),{},{omit:new Set([...(te=s==null?void 0:s.omit)==null?[]:te,...je])}),Ne=Ae&&w!==void 0&&E?{appId:w,appVersion:ie,redactUrl:Va(C.attributeScrubbers),serviceName:pe,transport:Cm({apiKey:C.replay.apiKey,appId:w,collectorUrl:ae,configUrl:oe}),userID:E}:void 0,Pe={appId:w,appVersion:ie,collectorUrl:ae,dynamicConfigManager:D,initPerformance:C.performance,redactUrl:Va(C.attributeScrubbers),serviceName:pe,userId:E==null?void 0:E},Fe=()=>gx(Me,{includeReplay:Ae,limitManager:_e,logManager:Te,pageManager:be,autoStart:Oe,performanceContext:Pe,replayContext:Ne,replayOptions:ke,sessionStorage:le,signalBuffer:xe,userSessionManager:O}),Ie,k,Le;if(h){let e=gx(Me,{includeReplay:Ae,limitManager:_e,pageManager:be,autoStart:Oe,performanceContext:Pe,replayContext:Ne,replayOptions:ke,sessionStorage:le,signalBuffer:xe,userSessionManager:O});Ie=e.find(e=>e instanceof Za),k=to({instrumentations:[...e,...c]})}else{let e=Fe();Ie=e.find(e=>e instanceof Za),k=to({instrumentations:[...e,...c],loggerProvider:we,tracerProvider:Se})}let Re=!1,ze=!1,Be=!(Me==null||(ne=Me.omit)==null)&&ne.has(`@opentelemetry/instrumentation-fetch`)?()=>void 0:lv();Z_(Me,Mg({collectorUrl:ae,configUrl:oe})).then(e=>{ze||e.length===0||(Le=to(h?{instrumentations:e}:{instrumentations:e,loggerProvider:we,tracerProvider:Se}))}).catch(e=>{f.warn(`failed to load network instrumentations: ${e instanceof Error?e.message:String(e)}`)});let A=()=>{ze||(ze=!0,Ie==null||Ie.disable(),k==null||k(),Le==null||Le(),Be(),O._shutdown())},Ve=Ie?ym(Ie):Q_;f.info(`successfully initialized the SDK`);let He={analytics:Ee,flush:function(){var e=H(function*(){yield Se.forceFlush(),yield we.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:Te,page:be,session:O,sessionRecording:Ve,setDynamicConfig:e=>{D.setConfig(e)},shutdown:function(){var e=H(function*(){Re||(Re=!0,A(),yield Se.shutdown(),yield we.shutdown())});return function(){return e.apply(this,arguments)}}(),stop:A,trace:Ce,user:ue};return h&&$_.register(He),O.recordSDKStartupTimings({initDuration:i.getOffsetFromOrigin()-re,initOriginOffset:re,loadOriginOffset:Ag}),Ee.screenView(),He}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return f.error(`failed to initialize the SDK: ${t}`),!1}},vx=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new Rh({storage:t});return e&&Br.setGlobalUserManager(n),n},yx=({dynamicConfigManager:e,limitManager:t,perf:n,registerGlobally:r,sdkLocalStorage:i,sdkSessionStorage:a,userSessionConfig:o})=>{let s=new Zh({config:o,dynamicConfigManager:e,limitManager:t,perf:n,storage:i,tabStorage:a,visibilityDoc:window.document});return r&&Tr.setGlobalUserSessionManager(s),s},bx=({resource:e,userManager:t,userSessionManager:n,spanExporters:r,spanProcessors:i=[],propagator:a=null,contextManager:o=null,attributeScrubbers:s,registerGlobally:c,mxlSpanProcessor:l,pageManager:u,perf:d,signalBuffer:f})=>{let p=[...i,new $h,new rg,new Tg({userManager:t}),new wg({userSessionManager:n}),new hg({pageManager:u}),new _g({perf:d}),new bg({attributeScrubbers:s}),...f?[new yg({buffer:f})]:[]];r==null||r.forEach(e=>{p.push(new Gc({exporter:e}))}),l&&p.push(l);let m=new Ph({perf:d,resource:e,spanLimits:{attributeCountLimit:ph.maxAllowed.session_property*2,eventCountLimit:ph.maxAllowed.breadcrumb*2},spanProcessors:p}),h=new Mh({tracerProvider:c?void 0:m});if(c){Nr.setGlobalTraceManager(h),N.setGlobalTracerProvider(m),a&&hn.setGlobalPropagator(a);let e=o||new Ec;e.enable(),j.setGlobalContextManager(e)}return{mxlTraceManager:h,tracerProvider:m}},xx=({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 Sg({userSessionManager:i}),new Qh,new tg,new xg({userManager:t}),new eg({attributeScrubbers:o}),new mg({pageManager:u}),new gg({perf:d}),...p?[new vg({buffer:p})]:[]];n==null||n.forEach(e=>{h.push(new Tc({exporter:e}))}),c&&h.push(c);let g=new _h({processors:h,resource:e,perf:d}),_=new Th({exception:m,limitManager:a,loggerProvider:s?void 0:g,perf:d,storage:l,userSessionManager:i,visibilityDoc:f});return s&&(Kt.setGlobalLoggerProvider(g),Pn.setGlobalLogManager(_)),{loggerProvider:g,mxlLogManager:_}},Sx=({useDocumentTitleAsPageLabel:e,registerGlobally:t,userSessionManager:n,perf:r})=>{let i=new Eh({useDocumentTitleAsPageLabel:e,userSessionManager:n,perf:r});return t&&Yn.setGlobalPageManager(i),i};return P(),e.DiagLogLevel=i,e.ReplayInstrumentation=Za,e.analytics=Hn,e.attributes=ri,e.getNavigationInstrumentation=di,e.getResponseSpanContext=cv,e.initSDK=_x,e.loadRrwebModule=Yi,e.log=Pn,e.page=Yn,e.resetRrwebModuleCacheForTests=Xi,e.session=Tr,e.setRrwebModuleLoaderForTests=Zi,e.setRrwebScriptUrl=Gi,e.trace=Nr,e.user=Br,e})({});
13
13
  //# sourceMappingURL=mxl-web-sdk.js.map