@safaricom-mxl/web-sdk 0.0.10 → 0.0.12

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 (47) hide show
  1. package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.cjs +4 -0
  2. package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.cjs.map +1 -1
  3. package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.d.cts +4 -0
  4. package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.d.cts.map +1 -1
  5. package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.d.ts +4 -0
  6. package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.d.ts.map +1 -1
  7. package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.js +4 -0
  8. package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.js.map +1 -1
  9. package/dist/index.d.cts +2 -2
  10. package/dist/index.d.ts +2 -2
  11. package/dist/mxl-web-sdk.js +38 -1
  12. package/dist/mxl-web-sdk.js.map +1 -1
  13. package/dist/packages/otlp-transformer/dist/index.cjs +215 -81
  14. package/dist/packages/otlp-transformer/dist/index.cjs.map +1 -1
  15. package/dist/packages/otlp-transformer/dist/index.d.cts.map +1 -1
  16. package/dist/packages/otlp-transformer/dist/index.d.ts.map +1 -1
  17. package/dist/packages/otlp-transformer/dist/index.js +215 -81
  18. package/dist/packages/otlp-transformer/dist/index.js.map +1 -1
  19. package/dist/resources/constants/index.cjs +1 -1
  20. package/dist/resources/constants/index.cjs.map +1 -1
  21. package/dist/resources/constants/index.d.cts +1 -1
  22. package/dist/resources/constants/index.d.ts +1 -1
  23. package/dist/resources/constants/index.js +1 -1
  24. package/dist/resources/constants/index.js.map +1 -1
  25. package/dist/sdk/index.d.cts +2 -2
  26. package/dist/sdk/index.d.ts +2 -2
  27. package/dist/sdk/initSDK.cjs +15 -2
  28. package/dist/sdk/initSDK.cjs.map +1 -1
  29. package/dist/sdk/initSDK.d.cts +3 -1
  30. package/dist/sdk/initSDK.d.cts.map +1 -1
  31. package/dist/sdk/initSDK.d.ts +3 -1
  32. package/dist/sdk/initSDK.d.ts.map +1 -1
  33. package/dist/sdk/initSDK.js +15 -2
  34. package/dist/sdk/initSDK.js.map +1 -1
  35. package/dist/sdk/setupSessionRecorder.cjs +46 -0
  36. package/dist/sdk/setupSessionRecorder.cjs.map +1 -0
  37. package/dist/sdk/setupSessionRecorder.d.cts +21 -0
  38. package/dist/sdk/setupSessionRecorder.d.cts.map +1 -0
  39. package/dist/sdk/setupSessionRecorder.d.ts +21 -0
  40. package/dist/sdk/setupSessionRecorder.d.ts.map +1 -0
  41. package/dist/sdk/setupSessionRecorder.js +43 -0
  42. package/dist/sdk/setupSessionRecorder.js.map +1 -0
  43. package/dist/sdk/types.d.cts +22 -1
  44. package/dist/sdk/types.d.cts.map +1 -1
  45. package/dist/sdk/types.d.ts +22 -1
  46. package/dist/sdk/types.d.ts.map +1 -1
  47. package/package.json +14 -13
@@ -1,2 +1,39 @@
1
- "use strict";window.MXLWebSdk=window.MXLWebSdk||(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},n=`1.9.0`,r=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function i(e){var t=new Set([e]),n=new Set,i=e.match(r);if(!i)return function(){return!1};var a={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};if(a.prerelease!=null)return function(t){return t===e};function o(e){return n.add(e),!1}function s(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;var i=e.match(r);if(!i)return o(e);var c={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};return c.prerelease!=null||a.major!==c.major?o(e):a.major===0?a.minor===c.minor&&a.patch<=c.patch?s(e):o(e):a.minor<=c.minor?s(e):o(e)}}var a=i(n),o=n.split(`.`)[0],s=Symbol.for(`opentelemetry.js.api.`+o),c=t;function l(e,t,r,i){var a;i===void 0&&(i=!1);var o=c[s]=(a=c[s])==null?{version:n}:a;if(!i&&o[e]){var l=Error(`@opentelemetry/api: Attempted duplicate registration of API: `+e);return r.error(l.stack||l.message),!1}if(o.version!==n){var l=Error(`@opentelemetry/api: Registration of version v`+o.version+` for `+e+` does not match previously registered API v`+n);return r.error(l.stack||l.message),!1}return o[e]=t,r.debug(`@opentelemetry/api: Registered a global for `+e+` v`+n+`.`),!0}function u(e){var t,n,r=(t=c[s])==null?void 0:t.version;if(!(!r||!a(r)))return(n=c[s])==null?void 0:n[e]}function d(e,t){t.debug(`@opentelemetry/api: Unregistering a global for `+e+` v`+n+`.`);var r=c[s];r&&delete r[e]}var f=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},p=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},ee=function(){function e(e){this._namespace=e.namespace||`DiagComponentLogger`}return e.prototype.debug=function(){var e=[...arguments];return m(`debug`,this._namespace,e)},e.prototype.error=function(){var e=[...arguments];return m(`error`,this._namespace,e)},e.prototype.info=function(){var e=[...arguments];return m(`info`,this._namespace,e)},e.prototype.warn=function(){var e=[...arguments];return m(`warn`,this._namespace,e)},e.prototype.verbose=function(){var e=[...arguments];return m(`verbose`,this._namespace,e)},e}();function m(e,t,n){var r=u(`diag`);if(r)return n.unshift(t),r[e].apply(r,p([],f(n),!1))}var h;(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(h||(h={}));function te(e,t){e<h.NONE?e=h.NONE:e>h.ALL&&(e=h.ALL),t=t||{};function n(n,r){var i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,h.ERROR),warn:n(`warn`,h.WARN),info:n(`info`,h.INFO),debug:n(`debug`,h.DEBUG),verbose:n(`verbose`,h.VERBOSE)}}var g=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},ne=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},re=`diag`,_=function(){function e(){function e(e){return function(){var t=[...arguments],n=u(`diag`);if(n)return n[e].apply(n,ne([],g(t),!1))}}var t=this;t.setLogger=function(e,n){var r,i,a;if(n===void 0&&(n={logLevel:h.INFO}),e===t){var o=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=o.stack)==null?o.message:r),!1}typeof n==`number`&&(n={logLevel:n});var s=u(`diag`),c=te((i=n.logLevel)==null?h.INFO:i,e);if(s&&!n.suppressOverrideMessage){var d=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;s.warn(`Current logger will be overwritten from `+d),c.warn(`Current logger will overwrite one already registered from `+d)}return l(`diag`,c,t,!0)},t.disable=function(){d(re,t)},t.createComponentLogger=function(e){return new ee(e)},t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}(),ie=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},ae=function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)},oe=function(){function e(e){this._entries=e?new Map(e):new Map}return e.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var t=ie(e,2);return[t[0],t[1]]})},e.prototype.setEntry=function(t,n){var r=new e(this._entries);return r._entries.set(t,n),r},e.prototype.removeEntry=function(t){var n=new e(this._entries);return n._entries.delete(t),n},e.prototype.removeEntries=function(){for(var t,n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=new e(this._entries);try{for(var o=ae(r),s=o.next();!s.done;s=o.next()){var c=s.value;a._entries.delete(c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return a},e.prototype.clear=function(){return new e},e}(),se=Symbol(`BaggageEntryMetadata`),ce=_.instance();function le(e){return e===void 0&&(e={}),new oe(new Map(Object.entries(e)))}function ue(e){return typeof e!=`string`&&(ce.error(`Cannot create baggage metadata from unknown type: `+typeof e),e=``),{__TYPE__:se,toString:function(){return e}}}function v(e){return Symbol.for(e)}var y=new(function(){function e(t){var n=this;n._currentContext=t?new Map(t):new Map,n.getValue=function(e){return n._currentContext.get(e)},n.setValue=function(t,r){var i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=function(t){var r=new e(n._currentContext);return r._currentContext.delete(t),r}}return e}()),de=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],fe=function(){function e(){function e(e){return function(){var t=[...arguments];if(console){var n=console[e];if(typeof n!=`function`&&(n=console.log),typeof n==`function`)return n.apply(console,t)}}}for(var t=0;t<de.length;t++)this[de[t].n]=e(de[t].c)}return e}(),b=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),pe=function(){function e(){}return e.prototype.createGauge=function(e,t){return Ce},e.prototype.createHistogram=function(e,t){return we},e.prototype.createCounter=function(e,t){return Se},e.prototype.createUpDownCounter=function(e,t){return Te},e.prototype.createObservableGauge=function(e,t){return De},e.prototype.createObservableCounter=function(e,t){return Ee},e.prototype.createObservableUpDownCounter=function(e,t){return Oe},e.prototype.addBatchObservableCallback=function(e,t){},e.prototype.removeBatchObservableCallback=function(e){},e}(),x=function(){function e(){}return e}(),me=function(e){b(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(e,t){},t}(x),he=function(e){b(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(e,t){},t}(x),ge=function(e){b(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(e,t){},t}(x),_e=function(e){b(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(e,t){},t}(x),ve=function(){function e(){}return e.prototype.addCallback=function(e){},e.prototype.removeCallback=function(e){},e}(),ye=function(e){b(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(ve),S=function(e){b(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(ve),be=function(e){b(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(ve),xe=new pe,Se=new me,Ce=new ge,we=new _e,Te=new he,Ee=new ye,De=new S,Oe=new be;function ke(){return xe}var Ae={get:function(e,t){if(e!=null)return e[t]},keys:function(e){return e==null?[]:Object.keys(e)}},je={set:function(e,t,n){e!=null&&(e[t]=n)}},Me=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Ne=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Pe=function(){function e(){}return e.prototype.active=function(){return y},e.prototype.with=function(e,t,n){var r=[...arguments].slice(3);return t.call.apply(t,Ne([n],Me(r),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}(),Fe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Ie=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Le=`context`,Re=new Pe,ze=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return l(Le,e,_.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,n){for(var r,i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return(r=this._getContextManager()).with.apply(r,Ie([e,t,n],Fe(i),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return u(Le)||Re},e.prototype.disable=function(){this._getContextManager().disable(),d(Le,_.instance())},e}(),C;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(C||(C={}));var Be=`0000000000000000`,Ve=`00000000000000000000000000000000`,He={traceId:Ve,spanId:Be,traceFlags:C.NONE},Ue=function(){function e(e){e===void 0&&(e=He),this._spanContext=e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e}(),We=v(`OpenTelemetry Context Key SPAN`);function Ge(e){return e.getValue(We)||void 0}function Ke(){return Ge(ze.getInstance().active())}function qe(e,t){return e.setValue(We,t)}function Je(e){return e.deleteValue(We)}function Ye(e,t){return qe(e,new Ue(t))}function Xe(e){var t;return(t=Ge(e))==null?void 0:t.spanContext()}var Ze=/^([0-9a-f]{32})$/i,Qe=/^[0-9a-f]{16}$/i;function $e(e){return Ze.test(e)&&e!==Ve}function et(e){return Qe.test(e)&&e!==Be}function tt(e){return $e(e.traceId)&&et(e.spanId)}function nt(e){return new Ue(e)}var rt=ze.getInstance(),it=function(){function e(){}return e.prototype.startSpan=function(e,t,n){if(n===void 0&&(n=rt.active()),t!=null&&t.root)return new Ue;var r=n&&Xe(n);return at(r)&&tt(r)?new Ue(r):new Ue},e.prototype.startActiveSpan=function(e,t,n,r){var i,a,o;if(!(arguments.length<2)){arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);var s=a==null?rt.active():a,c=this.startSpan(e,i,s),l=qe(s,c);return rt.with(l,o,void 0,c)}},e}();function at(e){return typeof e==`object`&&typeof e.spanId==`string`&&typeof e.traceId==`string`&&typeof e.traceFlags==`number`}var ot=new it,st=function(){function e(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}return e.prototype.startSpan=function(e,t,n){return this._getTracer().startSpan(e,t,n)},e.prototype.startActiveSpan=function(e,t,n,r){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ot},e}(),ct=new(function(){function e(){}return e.prototype.getTracer=function(e,t,n){return new it},e}()),lt=function(){function e(){}return e.prototype.getTracer=function(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new st(this,e,t,n):r},e.prototype.getDelegate=function(){var e;return(e=this._delegate)==null?ct:e},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)},e}(),ut;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(ut||(ut={}));var dt;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(dt||(dt={}));var ft;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(ft||(ft={}));var w=ze.getInstance(),T=_.instance(),pt=new(function(){function e(){}return e.prototype.getMeter=function(e,t,n){return xe},e}()),mt=`metrics`,ht=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(e){return l(mt,e,_.instance())},e.prototype.getMeterProvider=function(){return u(mt)||pt},e.prototype.getMeter=function(e,t,n){return this.getMeterProvider().getMeter(e,t,n)},e.prototype.disable=function(){d(mt,_.instance())},e}().getInstance(),gt=function(){function e(){}return e.prototype.inject=function(e,t){},e.prototype.extract=function(e,t){return e},e.prototype.fields=function(){return[]},e}(),_t=v(`OpenTelemetry Baggage Key`);function vt(e){return e.getValue(_t)||void 0}function yt(){return vt(ze.getInstance().active())}function bt(e,t){return e.setValue(_t,t)}function xt(e){return e.deleteValue(_t)}var St=`propagation`,Ct=new gt,E=function(){function e(){this.createBaggage=le,this.getBaggage=vt,this.getActiveBaggage=yt,this.setBaggage=bt,this.deleteBaggage=xt}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(e){return l(St,e,_.instance())},e.prototype.inject=function(e,t,n){return n===void 0&&(n=je),this._getGlobalPropagator().inject(e,t,n)},e.prototype.extract=function(e,t,n){return n===void 0&&(n=Ae),this._getGlobalPropagator().extract(e,t,n)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){d(St,_.instance())},e.prototype._getGlobalPropagator=function(){return u(St)||Ct},e}().getInstance(),wt=`trace`,D=function(){function e(){this._proxyTracerProvider=new lt,this.wrapSpanContext=nt,this.isSpanContextValid=tt,this.deleteSpan=Je,this.getSpan=Ge,this.getActiveSpan=Ke,this.getSpanContext=Xe,this.setSpan=qe,this.setSpanContext=Ye}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=l(wt,this._proxyTracerProvider,_.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return u(wt)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){d(wt,_.instance()),this._proxyTracerProvider=new lt},e}().getInstance();let Tt=({target:e,events:t,callback:n})=>{t.forEach(t=>{e.addEventListener(t,n)})},Et=({target:e,events:t,callback:n})=>{t.forEach(t=>{e.removeEventListener(t,n)})};function Dt(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}}}})}let Ot=new Uint8Array(16),kt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),At=()=>{crypto.getRandomValues(Ot);let e=``;for(let t=0;t<16;t++)e+=kt[Ot[t]];return e},jt=(e,t,n)=>{try{let n=e.getItem(t),r=n?parseInt(n,10):0;return r++,e.setItem(t,r.toString()),r}catch(e){return n.warn(`Failed to retrieve ${t} from storage: `,e),1}},O=`mxl.type`,Mt=`mxl.state`,Nt=`mxl.properties.`,Pt=`mxl.js_file_bundle_ids`,Ft=`browser.url.full`,It=`app.surface.name`,Lt=`app.surface.id`,Rt=`app.surface.label`,k=function(e){return e.Session=`ux.session`,e.Network=`perf.network_request`,e.Perf=`perf`,e.SystemLog=`sys.log`,e.SystemException=`sys.exception`,e.WebVital=`ux.web_vital`,e.ResourceFetch=`ux.resource_fetch`,e.DocumentLoad=`ux.document_load`,e.Surface=`ux.surface`,e}({}),zt=function(e){return e.Foreground=`foreground`,e.Background=`background`,e}({}),Bt=function(e){return e.DeclarativeLegacy=`react_router_declarative_legacy`,e.Declarative=`react_router_declarative`,e.Data=`react_router_data`,e.Manual=`manual`,e}({}),Vt=e=>e.visibilityState===`hidden`?zt.Background:zt.Foreground,Ht=globalThis,Ut=(e,t)=>!t||t<=0||t>100?!1:t>=Wt(e),Wt=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100},Gt=v(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Kt(e){return e.setValue(Gt,!0)}function qt(e){return e.getValue(Gt)===!0}function Jt(e){"@babel/helpers - typeof";return Jt=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},Jt(e)}function Yt(e,t){if(Jt(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Jt(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Xt(e){var t=Yt(e,`string`);return Jt(t)==`symbol`?t:t+``}function A(e,t,n){return(t=Xt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Zt=`http.method`,Qt=`http.url`,$t=`http.status_code`,en=`error.type`,j=`exception.message`,tn=`exception.stacktrace`,M=`exception.type`,nn=`http.request.method`,rn=`http.request.method_original`,an=`http.response.status_code`,on=`server.address`,sn=`server.port`,cn=`service.name`,ln=`telemetry.sdk.language`,un=`webjs`,dn=`telemetry.sdk.name`,fn=`telemetry.sdk.version`,N=`url.full`,pn=`user_agent.original`,mn=Math.pow(10,6);function hn(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*mn)]}function gn(e){return e[0]*1e3+e[1]/1e6}var _n;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(_n||(_n={}));let vn=`[_0-9a-z-*/]`,yn=`[a-z]${vn}{0,255}`,bn=`[a-z0-9]${vn}{0,240}@[a-z]${vn}{0,13}`,xn=RegExp(`^(?:${yn}|${bn})$`),Sn=/^[ -~]{0,255}[!-~]$/,Cn=/,|=/;function wn(e){return xn.test(e)}function Tn(e){return Sn.test(e)&&!Cn.test(e)}var En=class e{constructor(e){A(this,`_internalState`,new Map),e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+`=`+this.get(t)),e),[]).join(`,`)}_parse(e){e.length>512||(this._internalState=e.split(`,`).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(`=`);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);wn(i)&&Tn(a)&&e.set(i,a)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};let Dn=`traceparent`,On=`tracestate`,kn=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function An(e){let t=kn.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var jn=class{inject(e,t,n){let r=D.getSpanContext(e);if(!r||qt(e)||!tt(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||C.NONE).toString(16)}`;n.set(t,Dn,i),r.traceState&&n.set(t,On,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Dn);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=An(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,On);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new En(typeof e==`string`?e:void 0)}return D.setSpanContext(e,a)}fields(){return[Dn,On]}},Mn=class{constructor(){A(this,`_promise`,void 0),A(this,`_resolve`,void 0),A(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)}},Nn=class{constructor(e,t){A(this,`_isCalled`,!1),A(this,`_deferred`,new Mn),A(this,`_callback`,void 0),A(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 Pn(e,t){return new Promise(n=>{w.with(Kt(w.active()),()=>{e.export(t,n)})})}let Fn={_export:Pn},In=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;function Ln(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 P(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Ln(a,r,i,o,s,`next`,e)}function s(e){Ln(a,r,i,o,s,`throw`,e)}o(void 0)})}}var Rn=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Vn(t),r._asyncAttributesPending=t.filter(([e,t])=>In(t)).length>0,r}constructor(e,t){var n;A(this,`_rawAttributes`,void 0),A(this,`_asyncAttributesPending`,!1),A(this,`_schemaUrl`,void 0),A(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(In(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Vn(this._rawAttributes),this._schemaUrl=Hn(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,In(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&T.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(In(n)){T.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Un(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function zn(e,t){return Rn.FromAttributeList(Object.entries(e),t)}function Bn(){return zn({})}function Vn(e){return e.map(([e,t])=>In(t)?[e,t.catch(t=>{T.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Hn(e){if(typeof e==`string`||e===void 0)return e;T.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Un(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;T.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}let Wn=v(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Gn(e){return e.setValue(Wn,!0)}function Kn(e){return e.getValue(Wn)===!0}let qn=`baggage`;function Jn(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Yn(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Xn(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch(e){return}let c;return t!==-1&&t<e.length-1&&(c=ue(e.substring(t+1))),{key:o,value:s,metadata:c}}var Zn=class{inject(e,t,n){let r=E.getBaggage(e);if(!r||Kn(e))return;let i=Jn(Yn(r).filter(e=>e.length<=4096).slice(0,180));i.length>0&&n.set(t,qn,i)}extract(e,t,n){let r=n.get(t,qn),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=Xn(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:E.setBaggage(e,E.createBaggage(a))}fields(){return[qn]}};function Qn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!$n(n)){T.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!er(r)){T.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function $n(e){return typeof e==`string`&&e!==``}function er(e){return e==null?!0:Array.isArray(e)?tr(e):nr(typeof e)}function tr(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(nr(e)){t=e;continue}return!1}return!1}}return!0}function nr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function rr(){return e=>{T.error(ir(e))}}function ir(e){return typeof e==`string`?e:JSON.stringify(ar(e))}function ar(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}let or=rr();function sr(e){try{or(e)}catch(e){}}let cr={[dn]:`opentelemetry`,"process.runtime.name":`browser`,[ln]:un,[fn]:`2.6.0`},lr=performance,ur=Math.pow(10,6),dr=Math.pow(10,9);function F(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*ur)]}function fr(e){return _r(F(lr.timeOrigin),F(typeof e==`number`?e:lr.now()))}function pr(e){if(hr(e))return e;if(typeof e==`number`)return e<lr.timeOrigin?fr(e):F(e);if(e instanceof Date)return F(e.getTime());throw TypeError(`Invalid input type`)}function mr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=dr),[n,r]}function I(e){return e[0]*dr+e[1]}function hr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function gr(e){return hr(e)||typeof e==`number`||e instanceof Date}function _r(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=dr&&(n[1]-=dr,n[0]+=1),n}var vr;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(vr||(vr={}));var yr=class{constructor(e={}){var t;A(this,`_propagators`,void 0),A(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t,this._fields=Array.from(new Set(this._propagators.map(e=>typeof e.fields==`function`?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){T.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){T.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}};let br=`[_0-9a-z-*/]`,xr=`[a-z]${br}{0,255}`,Sr=`[a-z0-9]${br}{0,240}@[a-z]${br}{0,13}`,Cr=RegExp(`^(?:${xr}|${Sr})$`),wr=/^[ -~]{0,255}[!-~]$/,Tr=/,|=/;function Er(e){return Cr.test(e)}function Dr(e){return wr.test(e)&&!Tr.test(e)}var Or=class e{constructor(e){A(this,`_internalState`,new Map),e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+`=`+this.get(t)),e),[]).join(`,`)}_parse(e){e.length>512||(this._internalState=e.split(`,`).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(`=`);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Er(i)&&Dr(a)&&e.set(i,a)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};let kr=`traceparent`,Ar=`tracestate`,jr=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function Mr(e){let t=jr.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Nr=class{inject(e,t,n){let r=D.getSpanContext(e);if(!r||Kn(e)||!tt(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||C.NONE).toString(16)}`;n.set(t,kr,i),r.traceState&&n.set(t,Ar,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,kr);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Mr(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Ar);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Or(typeof e==`string`?e:void 0)}return D.setSpanContext(e,a)}fields(){return[kr,Ar]}};let Pr=Function.prototype.toString,Fr=Pr.call(Object),Ir=Object.getPrototypeOf,Lr=Object.prototype,Rr=Lr.hasOwnProperty,zr=Symbol?Symbol.toStringTag:void 0,Br=Lr.toString;function Vr(e){if(!Hr(e)||Ur(e)!==`[object Object]`)return!1;let t=Ir(e);if(t===null)return!0;let n=Rr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Pr.call(n)===Fr}function Hr(e){return typeof e==`object`&&!!e}function Ur(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:zr&&zr in Object(e)?Wr(e):Gr(e)}function Wr(e){let t=Rr.call(e,zr),n=e[zr],r=!1;try{e[zr]=void 0,r=!0}catch(e){}let i=Br.call(e);return r&&(t?e[zr]=n:delete e[zr]),i}function Gr(e){return Br.call(e)}function Kr(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Jr(t,e.shift(),0,n);return t}function qr(e){return Xr(e)?e.slice():e}function Jr(e,t,n=0,r){let i;if(!(n>20)){if(n++,$r(e)||$r(t)||Zr(t))i=qr(t);else if(Xr(e)){if(i=e.slice(),Xr(t))for(let e=0,n=t.length;e<n;e++)i.push(qr(t[e]));else if(Qr(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];i[r]=qr(t[r])}}}else if(Qr(e))if(Qr(t)){if(!ei(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o],c=t[s];if($r(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Yr(e,s,r)||Yr(t,s,r))delete i[s];else{if(Qr(a)&&Qr(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Jr(i[s],c,n,r)}}}}else i=t;return i}}function Yr(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function Xr(e){return Array.isArray(e)}function Zr(e){return typeof e==`function`}function Qr(e){return!$r(e)&&!Xr(e)&&!Zr(e)&&typeof e==`object`}function $r(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function ei(e,t){return!(!Vr(e)||!Vr(t))}function ti(e,t){return typeof t==`string`?e===t:!!e.match(t)}var ni=class{constructor(){A(this,`_promise`,void 0),A(this,`_resolve`,void 0),A(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)}},ri=class{constructor(e,t){A(this,`_isCalled`,!1),A(this,`_deferred`,new ni),A(this,`_callback`,void 0),A(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}};let ii;function ai(){if(ii===void 0)try{let e=globalThis.process.argv0;ii=e?`unknown_service:${e}`:`unknown_service`}catch(e){ii=`unknown_service`}return ii}let oi=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;var si=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=ui(t),r._asyncAttributesPending=t.filter(([e,t])=>oi(t)).length>0,r}constructor(e,t){var n;A(this,`_rawAttributes`,void 0),A(this,`_asyncAttributesPending`,!1),A(this,`_schemaUrl`,void 0),A(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(oi(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ui(this._rawAttributes),this._schemaUrl=di(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,oi(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&T.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(oi(n)){T.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=fi(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function ci(e,t){return si.FromAttributeList(Object.entries(e),t)}function li(){return ci({[cn]:ai(),[ln]:cr[ln],[dn]:cr[dn],[fn]:cr[fn]})}function ui(e){return e.map(([e,t])=>oi(t)?[e,t.catch(t=>{T.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function di(e){if(typeof e==`string`||e===void 0)return e;T.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function fi(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;T.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function pi(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?pi(Object(n),!0).forEach(function(t){A(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var mi=class{constructor(e){var t;A(this,`_spanContext`,void 0),A(this,`kind`,void 0),A(this,`parentSpanContext`,void 0),A(this,`attributes`,{}),A(this,`links`,[]),A(this,`events`,[]),A(this,`startTime`,void 0),A(this,`resource`,void 0),A(this,`instrumentationScope`,void 0),A(this,`_droppedAttributesCount`,0),A(this,`_droppedEventsCount`,0),A(this,`_droppedLinksCount`,0),A(this,`_attributesCount`,0),A(this,`name`,void 0),A(this,`status`,{code:ft.UNSET}),A(this,`endTime`,[0,0]),A(this,`_ended`,!1),A(this,`_duration`,[-1,-1]),A(this,`_spanProcessor`,void 0),A(this,`_spanLimits`,void 0),A(this,`_attributeValueLengthLimit`,void 0),A(this,`_recordEndMetrics`,void 0),A(this,`_performanceStartTime`,void 0),A(this,`_performanceOffset`,void 0),A(this,`_startTimeProvided`,void 0);let n=Date.now();this._spanContext=e.spanContext,this._performanceStartTime=lr.now(),this._performanceOffset=n-(this._performanceStartTime+lr.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,this.links=e.links||[],this.startTime=this._getTime((t=e.startTime)==null?n:t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return T.warn(`Invalid attribute key: ${e}`),this;if(!er(t))return T.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return T.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&T.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),gr(t)&&(gr(n)||(n=t),t=void 0);let i=Qn(t);return this.events.push({name:e,attributes:i,time:this._getTime(n),droppedAttributesCount:0}),this}addLink(e){return this.links.push(e),this}addLinks(e){return this.links.push(...e),this}setStatus(e){return this._isSpanEnded()?this:(this.status=L({},e),this.status.message!=null&&typeof e.message!=`string`&&(T.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`),delete this.status.message),this)}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){T.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=mr(this.startTime,this.endTime),this._duration[0]<0&&(T.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&&T.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit 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<=lr.now())return fr(e+this._performanceOffset);if(typeof e==`number`)return F(e);if(e instanceof Date)return F(e.getTime());if(hr(e))return e;if(this._startTimeProvided)return F(Date.now());let t=lr.now()-this._performanceStartTime;return _r(this.startTime,F(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[j]=e:e&&(e.code?n[M]=e.code.toString():e.name&&(n[M]=e.name),e.message&&(n[j]=e.message),e.stack&&(n[tn]=e.stack)),n[M]||n[j]?this.addEvent(`exception`,n,t):T.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}}`);T.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(T.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}},R;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(R||(R={}));var hi=class{shouldSample(){return{decision:R.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},gi=class{shouldSample(){return{decision:R.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},_i=class{constructor(e){var t,n,r,i;A(this,`_root`,void 0),A(this,`_remoteParentSampled`,void 0),A(this,`_remoteParentNotSampled`,void 0),A(this,`_localParentSampled`,void 0),A(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(sr(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new gi),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new gi:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new hi:n,this._localParentSampled=(r=e.localParentSampled)==null?new gi:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new hi:i}shouldSample(e,t,n,r,i,a){let o=D.getSpanContext(e);return!o||!tt(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&C.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&C.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()}}`}},vi=class{constructor(e=0){A(this,`_ratio`,void 0),A(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:$e(t)&&this._accumulate(t)<this._upperBound?R.RECORD_AND_SAMPLED:R.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<e.length/8;n++){let r=n*8,i=parseInt(e.slice(r,r+8),16);t=(t^i)>>>0}return t}},z;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(z||(z={}));function yi(){var e,t,n,r,i,a,o,s;return{sampler:bi(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(e=void 0)==null?1/0:e,attributeCountLimit:(t=void 0)==null?128:t},spanLimits:{attributeValueLengthLimit:(n=void 0)==null?1/0:n,attributeCountLimit:(r=void 0)==null?128:r,linkCountLimit:(i=void 0)==null?128:i,eventCountLimit:(a=void 0)==null?128:a,attributePerEventCountLimit:(o=void 0)==null?128:o,attributePerLinkCountLimit:(s=void 0)==null?128:s}}}function bi(){var e;let t=(e=void 0)==null?z.ParentBasedAlwaysOn:e;switch(t){case z.AlwaysOn:return new gi;case z.AlwaysOff:return new hi;case z.ParentBasedAlwaysOn:return new _i({root:new gi});case z.ParentBasedAlwaysOff:return new _i({root:new hi});case z.TraceIdRatio:return new vi(xi());case z.ParentBasedTraceIdRatio:return new _i({root:new vi(xi())});default:return T.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${z.ParentBasedAlwaysOn}".`),new _i({root:new gi})}}function xi(){return T.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1}function Si(e){let t={sampler:bi()},n=yi(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function Ci(e){var t,n,r,i,a,o,s,c,l,u,d,f;let p=Object.assign({},e.spanLimits);return p.attributeCountLimit=(t=(n=(r=(i=(a=e.spanLimits)==null?void 0:a.attributeCountLimit)==null?(o=e.generalLimits)==null?void 0:o.attributeCountLimit:i)==null?void 0:r)==null?void 0:n)==null?128:t,p.attributeValueLengthLimit=(s=(c=(l=(u=(d=e.spanLimits)==null?void 0:d.attributeValueLengthLimit)==null?(f=e.generalLimits)==null?void 0:f.attributeValueLengthLimit:u)==null?void 0:l)==null?void 0:c)==null?1/0:s,Object.assign({},e,{spanLimits:p})}var wi=class{constructor(e,t){var n,r,i,a;A(this,`_maxExportBatchSize`,void 0),A(this,`_maxQueueSize`,void 0),A(this,`_scheduledDelayMillis`,void 0),A(this,`_exportTimeoutMillis`,void 0),A(this,`_exporter`,void 0),A(this,`_isExporting`,!1),A(this,`_finishedSpans`,[]),A(this,`_timer`,void 0),A(this,`_shutdownOnce`,void 0),A(this,`_droppedSpansCount`,0),this._exporter=e,this._maxExportBatchSize=typeof(t==null?void 0:t.maxExportBatchSize)==`number`?t.maxExportBatchSize:(n=void 0)==null?512:n,this._maxQueueSize=typeof(t==null?void 0:t.maxQueueSize)==`number`?t.maxQueueSize:(r=void 0)==null?2048:r,this._scheduledDelayMillis=typeof(t==null?void 0:t.scheduledDelayMillis)==`number`?t.scheduledDelayMillis:(i=void 0)==null?5e3:i,this._exportTimeoutMillis=typeof(t==null?void 0:t.exportTimeoutMillis)==`number`?t.exportTimeoutMillis:(a=void 0)==null?3e4:a,this._shutdownOnce=new ri(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(T.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&C.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&T.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(T.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);w.with(Gn(w.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,r=>{if(clearTimeout(n),r.code===vr.SUCCESS)e();else{var i;t((i=r.error)==null?Error(`BatchSpanProcessor: span export failed`):i)}}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a!=null||(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{sr(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,sr(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},Ti=class extends wi{constructor(e,t){super(e,t),A(this,`_visibilityChangeListener`,void 0),A(this,`_pageHideListener`,void 0),this.onInit(t)}onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{sr(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{sr(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}};let Ei=new Uint8Array(16),Di=new Uint8Array(8),Oi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ki(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 Ai(e){let t=``;for(let n=0;n<e.length;n++)t+=Oi[e[n]];return t}var ji=class{generateTraceId(){return ki(Ei),Ai(Ei)}generateSpanId(){return ki(Di),Ai(Di)}};let Mi=`otel.span.sampling_result`;var Ni=class{constructor(e){A(this,`startedSpans`,void 0),A(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=Fi(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":Pi(e),[Mi]:n}),t===R.NOT_RECORD)return()=>{};let r={[Mi]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Pi(e){return e?e.isRemote?`remote`:`local`:`none`}function Fi(e){switch(e){case R.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case R.RECORD:return`RECORD_ONLY`;case R.NOT_RECORD:return`DROP`}}var Ii=class{constructor(e,t,n,r){A(this,`_sampler`,void 0),A(this,`_generalLimits`,void 0),A(this,`_spanLimits`,void 0),A(this,`_idGenerator`,void 0),A(this,`instrumentationScope`,void 0),A(this,`_resource`,void 0),A(this,`_spanProcessor`,void 0),A(this,`_tracerMetrics`,void 0);let i=Si(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new ji,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e,this._tracerMetrics=new Ni(i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,`2.6.0`):ke())}startSpan(e,t={},n=w.active()){var r,i,a;t.root&&(n=D.deleteSpan(n));let o=D.getSpan(n);if(Kn(n))return T.debug(`Instrumentation suppressed, returning Noop Span`),D.wrapSpanContext(He);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!D.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?dt.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:Qn(e.attributes)})),ee=Qn(t.attributes),m=this._sampler.shouldSample(n,u,e,f,ee,p),h=this._tracerMetrics.startSpan(s,m.decision);d=(a=m.traceState)==null?d:a;let te=m.decision===ut.RECORD_AND_SAMPLED?C.SAMPLED:C.NONE,g={traceId:u,spanId:c,traceFlags:te,traceState:d};if(m.decision===ut.NOT_RECORD)return T.debug(`Recording is off, propagating context in a non-recording span`),D.wrapSpanContext(g);let ne=Qn(Object.assign(ee,m.attributes));return new mi({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:g,name:e,kind:f,links:p,parentSpanContext:l,attributes:ne,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}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?w.active():i,l=this.startSpan(e,a,c),u=D.setSpan(c,l);return w.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}},Li=class{constructor(e){A(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=>{sr(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)})}},Ri;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Ri||(Ri={}));var zi=class{constructor(e={}){var t,n;A(this,`_config`,void 0),A(this,`_tracers`,new Map),A(this,`_resource`,void 0),A(this,`_activeSpanProcessor`,void 0);let r=Kr({},yi(),Ci(e));this._resource=(t=r.resource)==null?li():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new Li(i)}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new Ii({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Ri.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Ri.timeout&&(r=Ri.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Ri.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Ri.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}},Bi=class{constructor(){A(this,`_enabled`,!1),A(this,`_currentContext`,y)}_bindFunction(e=y,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=y,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=y,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||y;try{return t.call(n,...r)}finally{this._currentContext=i}}};function Vi(e){if(e!==null){if(e===void 0){let e=new Bi;e.enable(),w.setGlobalContextManager(e);return}e.enable(),w.setGlobalContextManager(e)}}function Hi(e){if(e!==null){if(e===void 0){E.setGlobalPropagator(new yr({propagators:[new Nr,new Zn]}));return}E.setGlobalPropagator(e)}}var Ui=class extends zi{constructor(e={}){super(e)}register(e={}){D.setGlobalTracerProvider(this),Hi(e.propagator),Vi(e.contextManager)}},B;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(B||(B={}));let Wi;function Gi(){return Wi||(Wi=document.createElement(`a`)),Wi}function Ki(e,t){return t in e}function V(e,t,n,r=!0){if(Ki(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function qi(e,t,n=!1,r,i){if(r===void 0&&(r=t[B.START_TIME]!==0),n||(V(e,B.FETCH_START,t,r),V(e,B.DOMAIN_LOOKUP_START,t,r),V(e,B.DOMAIN_LOOKUP_END,t,r),V(e,B.CONNECT_START,t,r),V(e,B.SECURE_CONNECTION_START,t,r),V(e,B.CONNECT_END,t,r),V(e,B.REQUEST_START,t,r),V(e,B.RESPONSE_START,t,r),V(e,B.RESPONSE_END,t,r)),!i){let n=t[B.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(`http.response_content_length`,n);let r=t[B.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(`http.response_content_length_uncompressed`,r)}}function Ji(e){return e.slice().sort((e,t)=>{let n=e[B.FETCH_START],r=t[B.FETCH_START];return n>r?1:n<r?-1:0})}function Yi(){return typeof location<`u`?location.origin:void 0}function Xi(e,t,n,r,i=new WeakSet,a){let o=H(e);e=o.toString();let s=Qi(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=Ji(s);if(o.origin!==Yi()&&c.length>1){let e=c[0],t=Zi(c,e[B.RESPONSE_END],n),r=e[B.RESPONSE_END];return t[B.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function Zi(e,t,n){let r=I(n),i=I(pr(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=I(pr(n[B.FETCH_START])),c=r-I(pr(n[B.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function Qi(e,t,n,r,i,a){let o=I(t),s=I(n),c=r.filter(t=>{let n=I(pr(t[B.FETCH_START])),r=I(pr(t[B.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function H(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=Gi();return t.href=e,t}function $i(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),H(e).origin===Yi()?!0:n.some(t=>ti(e,t))}let ea=`mxl_pending_`;var ta=class{constructor({resource:e=Bn(),storage:t=window.localStorage,diag:n=T.createComponentLogger({namespace:`MXLSpanStorage`}),storedSpansExpireTimeoutMS:r=3600*1e3,onExpiredSpansExport:i,spanSessionManager:a}){A(this,`_noExportTracer`,void 0),A(this,`_storage`,void 0),A(this,`_diag`,void 0),A(this,`_onExpiredSpansExport`,void 0),A(this,`_storedSpansExpireTimeoutMS`,void 0),A(this,`_spanSessionManager`,void 0),A(this,`_checkExpiredSpansInterval`,void 0),this._noExportTracer=new zi({resource:e}).getTracer(`mxl-web-sdk-sessions`),this._storage=t,this._diag=n,this._storedSpansExpireTimeoutMS=r,this._onExpiredSpansExport=i,this._spanSessionManager=a,this.startExpiredSpansCheck()}storePendingSpans(e,t,n){try{if(this.clearStoredSpans(e),this._getPendingSpansKeys().length>=10){this._spanSessionManager.incrSessionCountForKey(`mxl.max_pending_spans_reached`),this._diag.warn(`Not storing pending spans as the max number of items was reached`);return}let r=`${ea}${e}_${Date.now()}`;this._storage.setItem(r,JSON.stringify([t,...n],(e,t)=>e.startsWith(`_`)?void 0:t)),this._diag.debug(`Stored pending span: ${r}`)}catch(e){this._diag.error(`Failed to store spans to storage:`,e)}}clearStoredSpans(e){try{let t=`${ea}${e}_`;this._getPendingSpansKeys().forEach(e=>{e.startsWith(t)&&this._storage.removeItem(e)})}catch(e){this._diag.error(`Failed to clear stored spans from storage:`,e)}}startExpiredSpansCheck(){this._checkExpiredSpansInterval=setInterval(()=>{this.checkAndExportExpiredSpans()},300*1e3)}stopExpiredSpansCheck(){this._checkExpiredSpansInterval&&(clearInterval(this._checkExpiredSpansInterval),this._checkExpiredSpansInterval=void 0)}checkAndExportExpiredSpans(){try{let e=this._getPendingSpansKeys();if(e.length===0)return;let t=Date.now();e.forEach(e=>{let n=e.split(`_`),r=parseInt(n[n.length-1],10);if(Number.isNaN(r)&&(this._diag.error(`Found invalid timestamp in stored span:`,r),this._storage.removeItem(e)),t-r<=this._storedSpansExpireTimeoutMS)return;let i=this._storage.getItem(e);if(i){try{let e=[];for(let t of JSON.parse(i)){let n=this._noExportTracer.startSpan(t.name,{kind:t.kind,attributes:t.attributes,links:t.links,startTime:t.startTime});n.setStatus(t.status),n.end(t.endTime),e.push(n)}this._onExpiredSpansExport&&e.length>0&&this._onExpiredSpansExport(e)}catch(e){this._diag.error(`Failed to process expired spans:`,e)}this._storage.removeItem(e)}})}catch(e){this._diag.error(`Failed to check and export expired spans:`,e)}}_getPendingSpansKeys(){let e=[];for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);n!=null&&n.startsWith(ea)&&e.push(n)}return e}destroy(){this.stopExpiredSpansCheck()}},na=class{constructor(e,t){A(this,`_keyPrefix`,void 0),A(this,`_storage`,void 0),this._keyPrefix=`${e}_`,this._storage=t}getNamespacedKeys(){let e=[];for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);n!=null&&n.startsWith(this._keyPrefix)&&e.push(n.substring(this._keyPrefix.length))}return e}get length(){return this.getNamespacedKeys().length}clear(){this.getNamespacedKeys().forEach(e=>{this._storage.removeItem(`${this._keyPrefix}${e}`)})}getItem(e){return this._storage.getItem(`${this._keyPrefix}${e}`)}key(e){return this.getNamespacedKeys()[e]||null}removeItem(e){this._storage.removeItem(`${this._keyPrefix}${e}`)}setItem(e,t){this._storage.setItem(`${this._keyPrefix}${e}`,t)}};let ra=({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};var ia=class{constructor(e=window.performance){A(this,`_clock`,void 0),A(this,`epochMillisFromOriginOffset`,e=>this._clock.timeOrigin+e),A(this,`getNowHRTime`,()=>hn(this.getNowMillis())),A(this,`getNowMillis`,()=>this.epochMillisFromOriginOffset(this._clock.now())),A(this,`millisSinceHRTime`,e=>this.getNowMillis()-gn(e)),this._clock=e}};let aa=(e,t=1e3)=>{let n=!1;return(...r)=>{n||(e(...r),setTimeout(()=>{n=!1},t),n=!0)}};var oa=class{logException(e,t){}message(e,t,n){}};let sa=new oa;var ca=class{constructor(){A(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?sa:e}setDelegate(e){this._delegate=e}logException(e,t){this.getDelegate().logException(e,t)}message(e,t,n){this.getDelegate().message(e,t,n)}};let la=new oa,ua=new Set([`setDelegate`,`getDelegate`]);var da=class e{static getInstance(){if(!e._instance){let t=new ca,n=Dt(t,la,T.createComponentLogger({namespace:`LogAPI`}),ua);e._instance=Object.assign(n,{setGlobalLogManager(e){t.setDelegate(e)},getLogManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};A(da,`_instance`,void 0);let fa=da.getInstance();var pa=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}};let ma=new pa;var ha=class{constructor(){A(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?ma:e}setDelegate(e){this._delegate=e}setCurrentRoute(e){this.getDelegate().setCurrentRoute(e)}getCurrentRoute(){return this.getDelegate().getCurrentRoute()}getCurrentPageId(){return this.getDelegate().getCurrentPageId()}setPageLabel(e){this.getDelegate().setPageLabel(e)}getPageLabel(){return this.getDelegate().getPageLabel()}clearCurrentRoute(){this.getDelegate().clearCurrentRoute()}};let ga=new pa,_a=new Set([`setDelegate`,`getDelegate`]);var va=class e{static getInstance(){if(!e._instance){let t=new ha,n=Dt(t,ga,T.createComponentLogger({namespace:`PageAPI`}),_a);e._instance=Object.assign(n,{setGlobalPageManager(e){t.setDelegate(e)},getPageManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};A(va,`_instance`,void 0);let U=va.getInstance();var ya=class{constructor(){A(this,`getSessionId`,()=>null),A(this,`getPreviousSessionId`,()=>null)}addBreadcrumb(e){}addProperty(e,t,n){}removeProperty(e){}endSessionSpan(){}endSessionSpanInternal(e){}currentSessionAsReadableSpan(e){return null}getSessionSpan(){return null}getSessionStartTime(){return null}startSessionSpan(){}addSessionStartedListener(e){return()=>{}}addSessionEndedListener(e){return()=>{}}};let ba=new ya;var xa=class{constructor(){A(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?ba:e}setDelegate(e){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)}endSessionSpan(){this.getDelegate().endSessionSpan()}endSessionSpanInternal(e){this.getDelegate().endSessionSpanInternal(e)}currentSessionAsReadableSpan(e){return this.getDelegate().currentSessionAsReadableSpan(e)}getSessionId(){return this.getDelegate().getSessionId()}getPreviousSessionId(){return this.getDelegate().getPreviousSessionId()}getSessionSpan(){return this.getDelegate().getSessionSpan()}getSessionStartTime(){return this.getDelegate().getSessionStartTime()}startSessionSpan(e){this.getDelegate().startSessionSpan(e)}addSessionStartedListener(e){return this.getDelegate().addSessionStartedListener(e)}addSessionEndedListener(e){return this.getDelegate().addSessionEndedListener(e)}};let Sa=new ya,Ca=new Set([`setDelegate`,`getDelegate`]);var wa=class e{static getInstance(){if(!e._instance){let t=new xa,n=Dt(t,Sa,T.createComponentLogger({namespace:`SessionAPI`}),Ca);e._instance=Object.assign(n,{setGlobalSessionManager(e){t.setDelegate(e)},getSpanSessionManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};A(wa,`_instance`,void 0);let Ta=wa.getInstance();var Ea=class{constructor(e=He){A(this,`_spanContext`,void 0),A(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){}},Da=class{startSpan(e,t){return new Ea}setSpan(e,t){return y}getSpan(e){}};let Oa=new Da;var ka=class{constructor(){A(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Oa: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)}};let Aa=new Da,ja=new Set([`setDelegate`,`getDelegate`]);var Ma=class e{static getInstance(){if(!e._instance){let t=new ka,n=Dt(t,Aa,T.createComponentLogger({namespace:`TraceAPI`}),ja);e._instance=Object.assign(n,{setGlobalTraceManager(e){t.setDelegate(e)},getTraceManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};A(Ma,`_instance`,void 0);let Na=Ma.getInstance(),Pa=`enduser.pseudo.id`;var Fa=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};let Ia=new Fa;var La=class{constructor(){A(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Ia:e}setDelegate(e){this._delegate=e}getMXLUserId(){return this.getDelegate().getMXLUserId()}getUserId(){return this.getDelegate().getUserId()}setUserId(e){this.getDelegate().setUserId(e)}clearUserId(){this.getDelegate().clearUserId()}};let Ra=new Fa,za=new Set([`setDelegate`,`getDelegate`]);var Ba=class e{static getInstance(){if(!e._instance){let t=new La,n=Dt(t,Ra,T.createComponentLogger({namespace:`UserAPI`}),za);e._instance=Object.assign(n,{setGlobalUserManager(e){t.setDelegate(e)},getUserManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};A(Ba,`_instance`,void 0);let Va=Ba.getInstance();var W;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(W||(W={}));var Ha=class{emit(e){}};let Ua=new Ha,Wa=Symbol.for(`io.opentelemetry.js.api.logs`),Ga=globalThis;function Ka(e,t,n){return r=>r===e?t:n}let qa=new class{getLogger(e,t,n){return new Ha}};var Ja=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(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):Ua}},Ya=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new Ja(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?qa:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}};let Xa=class e{constructor(){this._proxyLoggerProvider=new Ya}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return Ga[Wa]?this.getLoggerProvider():(Ga[Wa]=Ka(1,e,qa),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=Ga[Wa])==null?void 0:e.call(Ga,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Ga[Wa],this._proxyLoggerProvider=new Ya}}.getInstance();function Za(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 Qa(e){e.forEach(e=>e.disable())}function $a(e){var t,n;let r=e.tracerProvider||D.getTracerProvider(),i=e.meterProvider||ht.getMeterProvider(),a=e.loggerProvider||Xa.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return Za(o,r,i,a),()=>{Qa(o)}}function eo(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function to(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}let no=`http.request.body.size`,ro=`http.response.body.size`,io=`session.id`,ao=`user.id`;var oo=class{constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,A(this,`_config`,{}),A(this,`_diag`,void 0),A(this,`_tracer`,void 0),A(this,`_meter`,void 0),A(this,`_logger`,void 0),this.setConfig(n),this._diag=T.createComponentLogger({namespace:e}),this._tracer=D.getTracer(e,t),this._meter=ht.getMeter(e,t),this._logger=Xa.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)}}},G=class extends oo{constructor({instrumentationName:e,instrumentationVersion:t,config:n,diag:r,perf:i}){super(e,t,n),A(this,`_sessionManager`,void 0),A(this,`_logManager`,void 0),A(this,`_perf`,void 0),r&&(this._diag=r),this._perf=i==null?new ia:i,this._sessionManager=Ta.getSpanSessionManager(),this._logManager=fa.getLogManager()}get sessionManager(){return this._sessionManager}get logManager(){return this._logManager}get perf(){return this._perf}init(){}setLogManager(e){this._logManager=e}setSessionManager(e){this._sessionManager=e}};let so=function(e){return e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`,e}({}),co=function(e){return e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`,e}({}),lo=()=>{let e={},t=window.performance.getEntriesByType(`navigation`)[0];return Object.values(B).forEach(n=>{if(Ki(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}}),e},uo={"first-paint":co.FIRST_PAINT,"first-contentful-paint":co.FIRST_CONTENTFUL_PAINT},fo=e=>{window.performance.getEntriesByType(`paint`).forEach(({name:t,startTime:n})=>{Ki(uo,t)&&e.addEvent(uo[t],n)})};var po=class extends G{constructor({diag:e,perf:t,enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i=!1,ignoreNetworkEvents:a=!1}={}){super({instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i,ignoreNetworkEvents:a}}),A(this,`_onDocumentLoaded`,void 0),A(this,`_performanceCollected`,!1),this._onDocumentLoaded=()=>{window.setTimeout(()=>{this._collectPerformance()},0)},this._config.enabled&&this.enable()}init(){this._diag.debug(`Initializing document load instrumentation`)}_addResourcesSpans(e){performance.getEntriesByType(`resource`).forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){if(this._performanceCollected)return;this._performanceCollected=!0;let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===Dn),t=lo(),n=(e==null?void 0:e.content)||``;w.with(E.extract(y,{traceparent:n}),()=>{var e;let n=this._startSpan(so.DOCUMENT_LOAD,B.FETCH_START,t);n&&(w.with(D.setSpan(w.active(),n),()=>{let e=this._startSpan(so.DOCUMENT_FETCH,B.FETCH_START,t);e&&(e.setAttribute(N,location.href),w.with(D.setSpan(w.active(),e),()=>{var n;qi(e,t,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,B.RESPONSE_END,t)}))}),n.setAttribute(O,k.DocumentLoad),n.setAttribute(N,location.href),n.setAttribute(pn,navigator.userAgent),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(V(n,B.FETCH_START,t),V(n,B.UNLOAD_EVENT_START,t),V(n,B.UNLOAD_EVENT_END,t),V(n,B.DOM_INTERACTIVE,t),V(n,B.DOM_CONTENT_LOADED_EVENT_START,t),V(n,B.DOM_CONTENT_LOADED_EVENT_END,t),V(n,B.DOM_COMPLETE,t),V(n,B.LOAD_EVENT_START,t),V(n,B.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||fo(n),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,B.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Ki(n,t)&&typeof n[t]==`number`?e.end(n[t]):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(so.RESOURCE_FETCH,B.FETCH_START,e,t);r&&(r.setAttribute(O,k.ResourceFetch),r.setAttribute(N,e.name),qi(r,e,this.getConfig().ignoreNetworkEvents),e.deliveryType&&r.setAttribute(`http.response.delivery_type`,e.deliveryType),e.initiatorType&&r.setAttribute(`http.request.initiator_type`,e.initiatorType),e.renderBlockingStatus&&r.setAttribute(`http.request.render_blocking_status`,e.renderBlockingStatus),e.responseStatus&&r.setAttribute(an,e.responseStatus),typeof e.encodedBodySize==`number`&&e.encodedBodySize>=0&&r.setAttribute(ro,e.encodedBodySize),typeof e.transferSize==`number`&&e.transferSize>=0&&r.setAttribute(`http.response.size`,e.transferSize),typeof e.decodedBodySize==`number`&&e.decodedBodySize>=0&&r.setAttribute(`http.response.decoded_body_size`,e.decodedBodySize),this._addResourceDiagnosticAttributes(r,e),this._addCustomAttributesOnResourceSpan(r,e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.resourceFetch),this._endSpan(r,B.RESPONSE_END,e))}_startSpan(e,t,n,r){if(Ki(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?D.setSpan(w.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():window.addEventListener(`load`,this._onDocumentLoaded)}_addCustomAttributesOnSpan(e,t){t&&eo(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&eo(()=>{n(e,t)},e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}_hasNoSizeData(e){let t=typeof e.transferSize==`number`?e.transferSize:0,n=typeof e.decodedBodySize==`number`?e.decodedBodySize:0,r=typeof e.encodedBodySize==`number`?e.encodedBodySize:0;return t===0&&n===0&&r===0}_hasTimingData(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0,n=typeof e.responseEnd==`number`?e.responseEnd:0;return t>0&&n>0}_isCorsRestricted(e){return this._hasNoSizeData(e)&&this._hasTimingData(e)}_isFetchIncomplete(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0,n=typeof e.responseEnd==`number`?e.responseEnd:0;return this._hasNoSizeData(e)&&t>0&&n===0}_isFetchPrevented(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0;return this._hasNoSizeData(e)&&t===0}_isCacheValidated(e){let t=typeof e.transferSize==`number`?e.transferSize:0,n=typeof e.deliveryType==`string`?e.deliveryType:``;return t===300&&n!==`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)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}},mo=class extends G{constructor({diag:e,perf:t,rootNode:n,emptyCheckDelayMs:r=500}){super({instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),A(this,`_observer`,void 0),A(this,`_emptyCheckDelayMs`,void 0),A(this,`_rootNode`,void 0),this._rootNode=n,this._emptyCheckDelayMs=r,this._observer=new MutationObserver((e,t)=>{this._observerCallback(e)}),this._config.enabled&&this._rootNode?this.enable():this._rootNode||this._diag.warn(`supplied root node was null, this instrumentation won't be enabled`)}disable(){this._observer.disconnect()}enable(){this._rootNode&&this._observer.observe(this._rootNode,{childList:!0})}_observerCallback(e){let t=!1,n=!1;for(let r of e)r.target===this._rootNode&&(r.removedNodes.length>0&&(t=!0),r.addedNodes.length>0&&(n=!0));t&&!n&&(this._diag.debug(`root node had child nodes removed without new ones being added, checking if it's empty in ${this._emptyCheckDelayMs}ms`),window.setTimeout(()=>{this._checkForEmptyRootNode()},this._emptyCheckDelayMs))}_checkForEmptyRootNode(){var e;if(((e=this._rootNode)==null?void 0:e.childNodes.length)===0){this._diag.debug(`root node was found to be empty`);let e=this.sessionManager.getSessionSpan();e?e.addEvent(`empty-root-node`,{"mxl.type":`ux.empty_root_node`}):this._diag.debug(`no active session found to emit event on`)}}};let ho=(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}>`};var go=class extends G{constructor({diag:e,perf:t,shouldTrack:n,innerTextForElement:r}={}){super({instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),A(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.sessionManager.getSessionSpan();n&&n.addEvent(`click`,{"mxl.type":`ux.tap`,"view.name":ho(t,r?r(t):t.innerText),"tap.coords":`${e.x.toString()},${e.y.toString()}`},this.perf.epochMillisFromOriginOffset(e.timeStamp))}catch(e){this._diag.error(`failed to create new user interaction span event`,e)}},this._config.enabled&&this.enable()}disable(){document.removeEventListener(`click`,this._onClickHandler)}enable(){document.addEventListener(`click`,this._onClickHandler)}},_o=class extends G{constructor({diag:e,perf:t}={}){super({instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),A(this,`_onErrorHandler`,void 0),A(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=e=>{this.logManager.logException(e.error||e.message,{handled:!1,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp),handler:`global_exception`})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp),handler:`promise_rejection`})},this._config.enabled&&this.enable()}disable(){window.removeEventListener(`error`,this._onErrorHandler),window.removeEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}enable(){window.addEventListener(`error`,this._onErrorHandler),window.addEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}};let K=console.error.bind(console);function vo(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})}let yo=(e,t,n)=>{if(!e||!e[t]){K(`no original function `+String(t)+` to wrap`);return}if(!n){K(`no wrapper function`),K(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){K(`original object and wrapper must be functions`);return}let i=n(r,t);return vo(i,`__original`,r),vo(i,`__unwrap`,()=>{e[t]===i&&vo(e,t,r)}),vo(i,`__wrapped`,!0),vo(e,t,i),i},bo=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{yo(e,t,n)})})},xo=(e,t)=>{if(!e||!e[t]){K(`no function to unwrap.`),K(Error().stack);return}let n=e[t];if(!n.__unwrap)K(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},So=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{xo(e,t)})})};function Co(e){e&&e.logger&&(typeof e.logger==`function`?K=e.logger:K(`new logger isn't a function, not replacing`))}Co.wrap=yo,Co.massWrap=bo,Co.unwrap=xo,Co.massUnwrap=So;var wo=class{constructor(e,t,n){A(this,`_config`,{}),A(this,`_tracer`,void 0),A(this,`_meter`,void 0),A(this,`_logger`,void 0),A(this,`_diag`,void 0),A(this,`instrumentationName`,void 0),A(this,`instrumentationVersion`,void 0),A(this,`_wrap`,yo),A(this,`_unwrap`,xo),A(this,`_massWrap`,bo),A(this,`_massUnwrap`,So),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=T.createComponentLogger({namespace:e}),this._tracer=D.getTracer(e,t),this._meter=ht.getMeter(e,t),this._logger=Xa.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)}}},To=class extends wo{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function Eo(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function Do(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var q;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(q||(q={}));function Oo(e,t){let n=q.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=q.DUPLICATE;break}else t.toLowerCase()===e&&(n=q.STABLE);return n}let ko=performance,Ao=Math.pow(10,6),jo=Math.pow(10,9);function Mo(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Ao)]}function No(e){return Po(Mo(ko.timeOrigin),Mo(typeof e==`number`?e:ko.now()))}function Po(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=jo&&(n[1]-=jo,n[0]+=1),n}function Fo(e,t){return typeof t==`string`?e===t:!!e.match(t)}function Io(e,t){if(!t)return!1;for(let n of t)if(Fo(e,n))return!0;return!1}var Lo;(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(Lo||(Lo={}));let Ro=T.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`});function zo(...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}=Bo(t.body);return t.body=e,n}else return Promise.resolve(Ho(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>Wo(e)):Promise.resolve()}}function Bo(e){if(!e.pipeThrough)return Ro.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 P(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Vo(e){return typeof Document<`u`&&e instanceof Document}function Ho(e){if(Vo(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Wo(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Go(e);if(e instanceof URLSearchParams)return Wo(e.toString());if(e.byteLength!==void 0)return e.byteLength;Ro.warn(`unknown body type`)}let Uo=new TextEncoder;function Wo(e){return Uo.encode(e).byteLength}function Go(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 Ko(e){let t=Yo(),n=e.toUpperCase();return n in t?n:`_OTHER`}let qo={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Jo;function Yo(){return Jo===void 0&&(Jo=qo),Jo}let Xo={"https:":`443`,"http:":`80`};function Zo(e){let t=Number(e.port||Xo[e.protocol]);if(t&&!isNaN(t))return t}let Qo=`0.213.0`,$o=typeof PerformanceObserver<`u`;var es=class extends To{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,Qo,e),A(this,`component`,`fetch`),A(this,`version`,Qo),A(this,`moduleName`,this.component),A(this,`_usedResources`,new WeakSet),A(this,`_tasksCount`,0),A(this,`_semconvStability`,void 0),this._semconvStability=Oo(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[B.FETCH_START]},D.setSpan(w.active(),e)),r=!(this._semconvStability&q.OLD);qi(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[B.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=H(t.url);if(this._semconvStability&q.OLD&&(e.setAttribute(`http.status_code`,t.status),t.statusText!=null&&e.setAttribute(Lo.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(`http.host`,n.host),e.setAttribute(`http.scheme`,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(`http.user_agent`,navigator.userAgent)),this._semconvStability&q.STABLE){e.setAttribute(an,t.status),e.setAttribute(on,n.hostname);let r=Zo(n);r&&e.setAttribute(sn,r)}}_addHeaders(e,t){if(!$i(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};E.inject(w.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)E.inject(w.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);E.inject(w.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(Io(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&q.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[Lo.COMPONENT]=this.moduleName,r[`http.method`]=i,r[`http.url`]=e}if(this._semconvStability&q.STABLE){let i=t.method,a=Ko(t.method||`GET`);n||(n=a),r[nn]=a,a!==i&&(r[rn]=i),r[N]=e}return this.tracer.startSpan(n,{kind:dt.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=Xi(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));let r=!(this._semconvStability&q.OLD);qi(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=Mo(Date.now()),i=No();this._addFinalSpanAttributes(e,n),this._semconvStability&q.STABLE&&n.status>=400&&(e.setStatus({code:ft.ERROR}),e.setAttribute(en,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},300)}_patchConstructor(){return e=>{let t=this,n=new Set([`url`,`type`,`redirected`]);function r(e,t){return new Proxy(e,{get(e,i,a){if(typeof i==`string`&&n.has(i))return Reflect.get(t,i);if(i===`clone`)return function(){return r(e.clone(),t)};let o=Reflect.get(e,i,e);return typeof o==`function`?o.bind(e):o}})}return function(...n){let i=this,a=H(n[0]instanceof Request?n[0].url:String(n[0])).href,o=n[0]instanceof Request?n[0]:n[1]||{},s=t._createSpan(a,o);if(!s)return e.apply(this,n);let c=t._prepareSpanData(a);t.getConfig().measureRequestSize&&zo(...n).then(e=>{e&&(t._semconvStability&q.OLD&&s.setAttribute(`http.request_content_length_uncompressed`,e),t._semconvStability&q.STABLE&&s.setAttribute(`http.request.body.size`,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function l(e,n){t._applyAttributesAfterFetch(e,o,n),t._endSpan(e,c,{status:n.status||0,statusText:n.message,url:a})}function u(e,n){t._applyAttributesAfterFetch(e,o,n),n.status>=200&&n.status<400?t._endSpan(e,c,n):t._endSpan(e,c,{status:n.status,statusText:n.statusText,url:a})}function d(e,t){if(!e)return null;let n=e.getReader();return new ReadableStream({pull(e){return P(function*(){try{let{value:t,done:r}=yield n.read();r?(n.releaseLock(),e.close()):e.enqueue(t)}catch(t){e.error(t),n.cancel(t).catch(e=>{});try{n.releaseLock()}catch(e){}}})()},cancel(e){return t.cancel(e).catch(e=>{}),n.cancel(e)}})}function f(e,t,n){let i=null;try{let t=n.clone().body;if(t){let a=t.getReader(),o=n.status===204||n.status===205||n.status===304?null:d(n.body,a);i=r(new Response(o,{status:n.status,statusText:n.statusText,headers:n.headers}),n);let s=()=>{a.read().then(({done:t})=>{t?u(e,n):s()},t=>{l(e,t)})};s()}else u(e,n)}finally{var a;t((a=i)==null?n:a)}}function p(e,t,n){try{l(e,n)}finally{t(n)}}return new Promise((n,r)=>w.with(D.setSpan(w.active(),s),()=>(t._callRequestHook(s,o),t._addHeaders(o,a),t._tasksCount++,e.apply(i,o instanceof Request?[o]:[a,o]).then(f.bind(i,s,n),p.bind(i,s,r)))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&Eo(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&Eo(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=No(),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(!$o){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}Do(fetch)&&(this._unwrap(globalThis,`fetch`),this._diag.debug(`removing previous patch for constructor`)),this._wrap(globalThis,`fetch`,this._patchConstructor())}disable(){$o&&(this._unwrap(globalThis,`fetch`),this._usedResources=new WeakSet)}};function ts(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 ns(e,t){if(e==null)return{};var n,r,i=ts(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 rs=[`omitIfAlreadyPatched`];var is=class extends es{constructor(e={}){let{omitIfAlreadyPatched:t}=e,n=ns(e,rs);super(L(L({},n),{},{enabled:!1})),A(this,`_omitIfAlreadyPatched`,void 0),this._omitIfAlreadyPatched=t,n.enabled&&this.enable()}enable(){if(this._omitIfAlreadyPatched&&to(fetch)){this._diag.debug("fetch is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation");return}super.enable()}};let as=/\([^()]+\)/g;var os=class extends G{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0}){super({instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),A(this,`_shouldCleanupPathOptionsFromRouteName`,!0),A(this,`_currentRouteSpan`,null),A(this,`_instrumentationType`,Bt.Manual),A(this,`_removeSessionStartedFn`,null),A(this,`_removeSessionEndedFn`,null),A(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),A(this,`setCurrentRoute`,e=>{if(!this._config.enabled)return;let t=U.getCurrentRoute();e.url!==(t==null?void 0:t.url)&&(U.setCurrentRoute(e),this._endRouteSpan(t),this._startRouteSpan(e))}),A(this,`_setupSessionListeners`,()=>{this._removeSessionStartedFn||(this._removeSessionStartedFn=this.sessionManager.addSessionStartedListener(()=>{let e=U.getCurrentRoute();e&&!this._currentRouteSpan&&(this._diag.debug(`Session started, starting route span.`),this._startRouteSpan(e))})),this._removeSessionEndedFn||(this._removeSessionEndedFn=this.sessionManager.addSessionEndedListener(()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan(U.getCurrentRoute()))}))}),A(this,`_cleanUpSessionListeners`,()=>{this._removeSessionStartedFn&&(this._removeSessionStartedFn(),this._removeSessionStartedFn=null),this._removeSessionEndedFn&&(this._removeSessionEndedFn(),this._removeSessionEndedFn=null)}),A(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`),this._setupSessionListeners();let t=this._shouldCleanupPathOptionsFromRouteName?e.path.replace(as,``):e.path;return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[O]:k.Surface,[It]:t,[Lt]:U.getCurrentPageId()||void 0}}),this._currentRouteSpan.setAttribute(`mxl.instrumentation`,this._instrumentationType),this._currentRouteSpan}),A(this,`_endRouteSpan`,e=>{this._currentRouteSpan&&(e&&this._diag.debug(`Ending route span for url: ${e.url}`),this._currentRouteSpan.end(),this._currentRouteSpan=null)}),A(this,`enable`,()=>{this.setConfig({enabled:!0}),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}),A(this,`disable`,()=>{this._cleanUpSessionListeners(),this.setConfig({enabled:!1}),this._diag.debug(`NavigationInstrumentation disabled, stopped listening for navigation events.`)}),this._shouldCleanupPathOptionsFromRouteName=t,this._config.enabled&&this.enable()}};let ss,cs=(e={})=>(ss||(ss=new os(e)),ss),ls={samplingPct:100,networkSpansForwardingThreshold:0},us=`mxl_remote_config`,ds=(e,{osVersion:t,appVersion:n,deviceId:r},i)=>`${i||`https://mxl-basket.apps.ocpthikadev01.safaricom.net`}/config?appId=${e}&osVersion=${t}&appVersion=${n}&deviceId=${r}`,fs=e=>{let t={samplingPct:e.threshold};return e.network_span_forwarding!==void 0&&(t.networkSpansForwardingThreshold=e.network_span_forwarding.pct_enabled),e.empty_session_avoidance_enabled_pct!==void 0&&(t.emptySessionAvoidanceEnabledPct=e.empty_session_avoidance_enabled_pct),t};var ps=class{constructor({appID:e,appVersion:t,deviceId:n,diag:r=T.createComponentLogger({namespace:`mxl-config-manager`}),storage:i=window.localStorage,defaultConfig:a={},mxlConfigURL:o}={}){A(this,`_remoteConfigURL`,null),A(this,`_diag`,void 0),A(this,`_storage`,void 0),A(this,`_sdkConfig`,void 0),A(this,`_etag`,null),e&&t&&n&&(this._remoteConfigURL=ds(e,{appVersion:t,deviceId:n,osVersion:`1`},o)),this._diag=r,this._storage=i;let s=this._getRemoteConfigFromStorage();s&&(this._etag=s.etag),this._sdkConfig=L(L(L({},ls),a),s?fs(s.config):{})}setConfig(e){this._sdkConfig=L(L({},this._sdkConfig),e)}getConfig(){return this._sdkConfig}refreshRemoteConfig(){var e=this;return P(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._storage.setItem(us,JSON.stringify({config:n,etag:r})),e._sdkConfig=fs(n),e._etag=r}catch(t){e._diag.warn(`Failed to refresh remote config: ${t instanceof Error?t.message:String(t)}`)}})()}_getRemoteConfigFromStorage(){try{let e=this._storage.getItem(us);return e?JSON.parse(e):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 P(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?[yield n.json(),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};let ms={maxAllowed:{error_log:500,warning_log:200,info_log:100,exception:500,breadcrumb:100,session_property:100,span:1e3,network_request:1e4},maxLength:{error_log:128,warning_log:128,info_log:128,exception:1024,breadcrumb:256,session_property_key:128,session_property_value:256,log_attribute_key:128,log_attribute_value:256,exception_attribute_key:128,exception_attribute_value:256},maxAttributes:{error_log:50,warning_log:50,info_log:50,exception:50}},hs={info:`info_log`,warning:`warning_log`,error:`error_log`};var gs=class{constructor({diag:e,maxAllowed:t,maxLength:n,maxAttributes:r}){A(this,`_diag`,void 0),A(this,`_diagnosticCounts`,{}),A(this,`_currentCount`,{exception:0,error_log:0,warning_log:0,info_log:0,breadcrumb:0,session_property:0,span:0,network_request:0}),A(this,`_maxAllowed`,void 0),A(this,`_maxLength`,void 0),A(this,`_maxAttributes`,void 0),this._diag=e==null?T.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`:{message:this.truncateString(`exception`,e),attributes:this._truncateAttributes(`exception`,t,`exception_attribute_key`,`exception_attribute_value`)}}limitLog(e,t,n){let r=hs[t];return this._dropIfMaxReached(r)?`dropped`:{message:this.truncateString(r,e),attributes:this._truncateAttributes(r,n,`log_attribute_key`,`log_attribute_value`)}}limitSessionProperty(e,t){return this._dropIfMaxReached(`session_property`)?`dropped`:{key:this.truncateString(`session_property_key`,e),value:this.truncateString(`session_property_value`,t)}}dropReadableSpan(e){let t=e.attributes[O]===k.Network?`network_request`:`span`;return this._dropIfMaxReached(t)}reset(){this._diagnosticCounts={},this._currentCount={exception:0,error_log:0,warning_log:0,info_log:0,breadcrumb:0,session_property:0,span:0,network_request:0}}_incrDiagnosticCount(e,t){let n=`mxl.app.applied_limit.${e}.${t}.count`;this._diagnosticCounts[n]=(this._diagnosticCounts[n]||0)+1}getDiagnosticCounts(){return this._diagnosticCounts}};let _s=()=>JSON.stringify(Ht._MXLFileBundleIDs||{});var vs=class e{constructor({diag:e,perf:t,spanSessionManager:n,limitManager:r,loggerProvider:i,visibilityDoc:a=window.document,storage:o=window.localStorage}){A(this,`_diag`,void 0),A(this,`_perf`,void 0),A(this,`_logger`,void 0),A(this,`_spanSessionManager`,void 0),A(this,`_limitManager`,void 0),A(this,`_visibilityDoc`,void 0),A(this,`_storage`,void 0);let s=i==null?Xa:i;this._diag=e==null?T.createComponentLogger({namespace:`MXLLogManager`}):e,this._perf=t==null?new ia:t,this._logger=s.getLogger(`mxl-web-sdk-logs`),this._spanSessionManager=n,this._limitManager=r,this._visibilityDoc=a,this._storage=o}_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 W.INFO;case`warning`:return W.WARN;default:return W.ERROR}}logException(t,{handled:n=!0,attributes:r={},timestamp:i=this._perf.getNowMillis(),handler:a=`manual`}={}){var o;let s=this._validateAttributes(r);n||this._spanSessionManager.incrSessionCountForKey(`mxl.unhandled_exceptions_count`);let c=(t==null||(o=t.constructor)==null?void 0:o.name)||typeof t,l=``,u=c,d=``,f=``;if(t instanceof Error)l=String(t.message||``).trim(),u=t.name||``,d=t.stack||``,f=t.cause?`present`:``;else if(t&&typeof t==`object`)try{l=JSON.stringify(t)}catch(e){l=String(t).trim()}else l=String(t).trim();let p=this._limitManager.limitException(l,s);p!==`dropped`&&this._logger.emit({timestamp:i,severityNumber:W.ERROR,severityText:`ERROR`,body:p.message,attributes:L(L({},p.attributes),{},{[O]:k.SystemException,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":f,[M]:c,"exception.name":u,[j]:p.message,[tn]:d,[Pt]:_s(),[Mt]:Vt(this._visibilityDoc),"mxl.exception_number":jt(this._storage,`mxl_exception_number`,this._diag)})})}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._spanSessionManager.incrSessionCountForKey(`mxl.error_log_count`);let o=``;t!==`info`&&(typeof i==`string`?o=i:r&&(o=Error().stack||``)),this._logMessage({message:e.trim(),severity:t,timestamp:this._perf.getNowMillis(),attributes:a,stack:o})}_logMessage({message:t,severity:n,timestamp:r,attributes:i={},stack:a}){let o=this._limitManager.limitLog(t,n,i);o!==`dropped`&&this._logger.emit({timestamp:r,severityNumber:e._logSeverityToSeverityNumber(n),severityText:n.toUpperCase(),body:o.message,attributes:L(L(L({},o.attributes),{},{[O]:k.SystemLog},a?{"mxl.stacktrace.js":a,[Pt]:_s()}:{}),{},{[Mt]:Vt(this._visibilityDoc)})})}static _exceptionHandlingType(e,t){return e?`handled`:t===`global_exception`?`unhandled_error`:t===`promise_rejection`?`unhandled_rejection`:`unhandled`}},ys=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document}={}){A(this,`_currentRoute`,null),A(this,`_currentPageId`,null),A(this,`_pageLabel`,null),A(this,`_titleDocument`,void 0),A(this,`_useDocumentTitleAsPageLabel`,void 0),A(this,`getCurrentPageId`,()=>this._currentPageId),A(this,`getCurrentRoute`,()=>this._currentRoute),A(this,`setPageLabel`,e=>{this._pageLabel=e}),A(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),A(this,`setCurrentRoute`,e=>{(!this._currentRoute||this._currentRoute.url!==e.url)&&(this._currentPageId=At()),this._currentRoute=e,e.label?this._pageLabel=e.label:this._pageLabel=null}),A(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),this._useDocumentTitleAsPageLabel=e,this._titleDocument=t}},bs=class{constructor({dynamicConfigManager:e,deviceId:t,blockNetworkSpanForwarding:n}){A(this,`_dynamicConfigManager`,void 0),A(this,`_deviceId`,void 0),A(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=e,this._deviceId=t,this._blockNetworkSpanForwarding=n}isSDKEnabled(){let e=this._dynamicConfigManager.getConfig();return Ut(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return Ut(this._deviceId,e.networkSpansForwardingThreshold)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return Ut(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};let xs=`0.0.10`,Ss=`mxl-web-sdk`,Cs=`mxl_app_instance_id`,ws=(e,t)=>{let n=null;try{n=e.getItem(Cs)}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=At();try{e.setItem(Cs,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n},Ts=({diagLogger:e,appVersion:t,pageSessionStorage:n})=>zn({[cn]:Ss,[dn]:Ss,app_version:t,app_framework:1,sdk_version:xs,[fn]:xs,sdk_simple_version:1,sdk_platform:`web`,[ln]:`webjs`,"mxl.app_instance_id":ws(n,e),[pn]:window.navigator.userAgent,screen_resolution:`${window.screen.width}x${window.screen.height}`});var Es=class{constructor(e){A(this,`_span`,void 0),this._span=e}get attributes(){return this._span.attributes}addEvent(e,t,n){return this._span.addEvent(e,t,n),this}addLink(e){return this._span.addLink(e),this}addLinks(e){return this._span.addLinks(e),this}end(e){this._span.end(e)}isRecording(){return this._span.isRecording()}recordException(e,t){this._span.recordException(e,t)}setAttribute(e,t){return this._span.setAttribute(e,t),this}setAttributes(e){return this._span.setAttributes(e),this}removeAttribute(e){let t=this._span.attributes,{[e]:n}=t,r=ns(t,[e].map(Xt));return this._span.attributes=r,this}setStatus(e){return this._span.setStatus(e),this}spanContext(){return this._span.spanContext()}updateName(e){return this._span.updateName(e),this}fail(e={code:`failure`}){e.code&&this._span.setAttribute(`mxl.error_code`,e.code.toUpperCase()),this._span.end(e.endTime)}};let Ds=`mxl_tab`,Os=`mxl_tab_activity`;var ks=class{constructor({diag:e,perf:t,visibilityDoc:n=window.document,storage:r=window.localStorage,sessionStorage:i=window.sessionStorage,limitManager:a,referrer:o=document.referrer}){A(this,`_previousSessionId`,null),A(this,`_activeSessionId`,null),A(this,`_activeSessionStartTime`,null),A(this,`_sessionSpan`,null),A(this,`_activeSessionCounts`,null),A(this,`_nextSessionCounts`,{}),A(this,`_coldStart`,!0),A(this,`_sdkStartupDuration`,0),A(this,`_sessionStartedListeners`,[]),A(this,`_sessionEndedListeners`,[]),A(this,`_tab`,void 0),A(this,`_navigationSource`,void 0),A(this,`_referrerInfo`,void 0),A(this,`_tracer`,void 0),A(this,`_noExportTracer`,void 0),A(this,`_diag`,void 0),A(this,`_perf`,void 0),A(this,`_visibilityDoc`,void 0),A(this,`_storage`,void 0),A(this,`_sessionStorage`,void 0),A(this,`_limitManager`,void 0),A(this,`_referrer`,void 0),this._diag=e==null?T.createComponentLogger({namespace:`MXLSpanSessionManager`}):e,this._perf=t==null?new ia:t,this._visibilityDoc=n,this._storage=r,this._sessionStorage=i,this._limitManager=a,this._referrer=o,this._tracer=D.getTracer(`mxl-web-sdk-sessions`),this._noExportTracer=new zi().getTracer(`mxl-web-sdk-sessions`),this._referrerInfo=this._processReferrer();let s=this._initTab();this._tab=s.tab,this._navigationSource=s.navigationSource,this._setupNewTabClickListeners()}_getPermanentAttributes(){let e=new Map;try{for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);if(n!=null&&n.startsWith(Nt)){let t=this._storage.getItem(n);t&&e.set(n,t)}}}catch(e){this._diag.warn(`Error loading permanent session properties`,e)}return Object.fromEntries(e.entries())}addBreadcrumb(e){if(!this._sessionSpan){this._diag.debug(`trying to add breadcrumb to a session, but there is no session in progress. This is a no-op.`);return}let t=this._limitManager.limitBreadcrumb(e);t!==`dropped`&&this._sessionSpan.addEvent(`mxl-breadcrumb`,{message:t.name},this._perf.getNowMillis())}addProperty(e,t,n){if(!this._sessionSpan){this._diag.debug(`trying to add properties to a session, but there is no session in progress. This is a no-op.`);return}let r=this._limitManager.limitSessionProperty(e,t);if(r===`dropped`)return;let i=Nt+r.key;if(this._sessionSpan.setAttribute(i,r.value),(n==null?void 0:n.lifespan)===`permanent`)try{this._storage.setItem(i,t)}catch(e){this._diag.warn(`Failed to set permanent session property`,e)}}removeProperty(e){if(!this._sessionSpan){this._diag.debug(`trying to remove a session property, but there is no session in progress. This is a no-op.`);return}let t=Nt+this._limitManager.truncateString(`session_property_key`,e);this._sessionSpan.removeAttribute(t);try{this._storage.getItem(t)&&this._storage.removeItem(t)}catch(e){this._diag.warn(`Error removing permanent session property`,e)}}endSessionSpan(){this.endSessionSpanInternal(`manual`)}endSessionSpanInternal(e){if(!this._sessionSpan){this._diag.debug(`trying to end a session, but there is no session in progress. This is a no-op.`);return}for(let e of this._sessionEndedListeners)try{e()}catch(e){this._diag.warn(`Error while executing session ended listener`,e)}this._sessionSpan.setAttributes(this._endSessionSpanAttributes(e)),this._sessionSpan.end(),this._sessionSpan=null,this._activeSessionStartTime=null,this._previousSessionId=this._activeSessionId,this._activeSessionId=null,this._activeSessionCounts=null,this._limitManager.reset()}_endSessionSpanAttributes(e){return L(L(L(L({},this._getPermanentAttributes()),{},{"mxl.session_end_type":e},this._activeSessionCounts),this._limitManager.getDiagnosticCounts()),{},{"mxl.sdk_startup_duration":this._sdkStartupDuration})}currentSessionAsReadableSpan(e){if(!this._sessionSpan||!this._activeSessionStartTime)return this._diag.debug(`trying to end a session, but there is no session in progress. This is a no-op.`),null;let t=this._noExportTracer.startSpan(`mxl-session`,{startTime:this._activeSessionStartTime,attributes:L(L(L({},this._sessionSpan.attributes),this._endSessionSpanAttributes(e)),{},{"mxl.from_storage":!0})});return t.end(),t}getSessionId(){return this._activeSessionId}getPreviousSessionId(){return this._previousSessionId}getSessionSpan(){return this._sessionSpan}getSessionStartTime(){return this._activeSessionStartTime}startSessionSpan(e){this._sessionSpan&&this.endSessionSpanInternal(`manual`),this._activeSessionId=At(),this._activeSessionStartTime=this._perf.getNowHRTime(),this._activeSessionCounts={};let t=this._nextSessionCounts;this._nextSessionCounts={};let n=L(L({},this._getPermanentAttributes()),{},{[O]:k.Session,[Mt]:Vt(this._visibilityDoc),[io]:this._activeSessionId,"mxl.cold_start":this._coldStart,"mxl.session_number":jt(this._storage,`mxl_session_number`,this._diag),"mxl.experience_id":this._tab.experienceId,"mxl.tab_id":this._tab.tabId,"mxl.navigation_source":this._navigationSource},t);this._referrerInfo.isValid&&this._referrerInfo.scrubbedUrl&&(n[`mxl.referrer_url`]=this._referrerInfo.scrubbedUrl),this._tab.sourceTabId&&(n[`mxl.source_tab_id`]=this._tab.sourceTabId),e!=null&&e.reason&&(n[`mxl.session_start_type`]=e.reason),this._sessionSpan=new Es(this._tracer.startSpan(`mxl-session`,{attributes:n})),this._coldStart=!1;for(let e of this._sessionStartedListeners)try{e()}catch(e){this._diag.warn(`Error while executing session started listener`,e)}}incrSessionCountForKey(e){if(!this._sessionSpan||!this._activeSessionCounts){this._diag.debug(`trying to increment a count for the active session, but there is no session in progress. This is a no-op.`);return}this._activeSessionCounts[e]=(this._activeSessionCounts[e]||0)+1}incrNextSessionCountForKey(e){this._nextSessionCounts[e]=(this._nextSessionCounts[e]||0)+1}addSessionStartedListener(e){let t=this._sessionStartedListeners.push(e);return()=>{this._sessionStartedListeners.splice(t-1,1)}}addSessionEndedListener(e){let t=this._sessionEndedListeners.push(e);return()=>{this._sessionEndedListeners.splice(t-1,1)}}recordSDKStartupDuration(e){this._sdkStartupDuration=Math.ceil(e)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-sessions`)}_determineNavigationSource(){try{let e=window.performance.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){this._diag.warn(`Failed to get navigation type`,e)}return this._referrerInfo.isValid?this._referrerInfo.isSameOrigin?`same_origin`:`external`:`direct`}_processReferrer(){if(!this._referrer)return{isValid:!1,isSameOrigin:!1};try{let e=new URL(this._referrer),t=window.location.origin;return{isValid:!0,isSameOrigin:e.origin===t,scrubbedUrl:e.origin+e.pathname}}catch(e){return{isValid:!1,isSameOrigin:!1}}}_getTabContext(e){let t=ws(this._sessionStorage,this._diag),n,r;if(e===`same_origin`){let e=this._getTabActivity();e&&Date.now()-e.lastActivityMs<=1e4&&(n=e.tabId,r=e.experienceId)}return r!=null||(r=At()),{sourceTabId:n,experienceId:r,tabId:t}}_initTab(){let e=this._determineNavigationSource();try{let t=this._sessionStorage.getItem(Ds);if(t)return{tab:JSON.parse(t),navigationSource:e}}catch(e){this._diag.warn(`Failed to retrieve tab data`,e)}let t=this._getTabContext(e),n={experienceId:t.experienceId,sourceTabId:t.sourceTabId,tabId:t.tabId};try{this._sessionStorage.setItem(Ds,JSON.stringify(n))}catch(e){this._diag.warn(`Failed to store tab data`,e)}return{tab:n,navigationSource:e}}_getTabActivity(){try{let e=this._storage.getItem(Os);return e?JSON.parse(e):null}catch(e){return this._diag.warn(`Failed to retrieve tab activity`,e),null}}_storeTabActivity(e){try{this._storage.setItem(Os,JSON.stringify(e))}catch(e){this._diag.warn(`Failed to save tab activity`,e)}}_storeCurrentTabAsSource(){let e={tabId:this._tab.tabId,experienceId:this._tab.experienceId,lastActivityMs:Date.now()};this._storeTabActivity(e)}_setupNewTabClickListeners(){let e=e=>{var t;if(e.button===1||e.ctrlKey||e.metaKey||e.shiftKey){this._storeCurrentTabAsSource();return}(t=e.target)!=null&&t.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&this._storeCurrentTabAsSource()},t={capture:!0,passive:!0};document.addEventListener(`auxclick`,e,t),document.addEventListener(`click`,e,t)}},As=class{constructor({tracerProvider:e}={}){A(this,`_tracer`,void 0),A(this,`setSpan`,D.setSpan),this._tracer=(e==null?D:e).getTracer(`mxl-web-sdk-traces`)}startSpan(e,t={},n){t.attributes=t.attributes?t.attributes:{},t.attributes[O]=k.Perf;let r=t.parentSpan?D.setSpan(w.active(),t.parentSpan):n;return new Es(this._tracer.startSpan(e,t,r))}getSpan(e){let t=D.getSpan(e);if(t)return new Es(t)}};let js=`mxl_user`,Ms=`mxl_user_id`,Ns=`mxl_external_user_id`,Ps=e=>typeof e[Pa]==`string`&&e[Pa].length===32,Fs=e=>typeof e==`string`&&e.length===32;var Is=class{constructor({diag:e,storage:t=window.localStorage}={}){A(this,`_diag`,void 0),A(this,`_storage`,void 0),A(this,`_mxlUserId`,null),this._diag=e==null?T.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(Ms,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(Ms)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(js);if(e){let t=JSON.parse(e);Ps(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(Ms,t[Pa]),this._storage.removeItem(js)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(js))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(Ms);e?Fs(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=At();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(Ns)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(Ns,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(Ns)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let Ls=[`keydown`,`mousedown`,`mousemove`,`scroll`];var Rs=class extends G{constructor({diag:e}={}){super({instrumentationName:`SpanSessionBrowserActivityInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),A(this,`_onActivityThrottled`,void 0),A(this,`_activityTimeout`,void 0),A(this,`disable`,()=>{Et({target:window,events:Ls,callback:this._onActivityThrottled}),this._activityTimeout&&clearTimeout(this._activityTimeout),this._activityTimeout=null}),A(this,`enable`,()=>{Tt({target:window,events:Ls,callback:this._onActivityThrottled})}),A(this,`_onInactivity`,()=>{this._diag.debug(`Inactivity detected`),this._activityTimeout&&clearTimeout(this._activityTimeout),this._activityTimeout=null,this.sessionManager.endSessionSpanInternal(`inactivity`)}),A(this,`_onActivity`,()=>{this._diag.debug(`Activity detected`),this._activityTimeout&&clearTimeout(this._activityTimeout),this.sessionManager.getSessionId()||this.sessionManager.startSessionSpan({reason:`activity`}),this._activityTimeout=setTimeout(this._onInactivity,18e5)}),this._activityTimeout=null,this._onActivityThrottled=aa(this._onActivity,3e4),this._config.enabled&&this.enable()}},zs=class extends G{constructor({diag:e}={}){super({instrumentationName:`SpanSessionOnLoadInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),this._config.enabled&&this.enable()}disable(){this.sessionManager.endSessionSpanInternal(`unknown`)}enable(){this.sessionManager.startSessionSpan({reason:`init`})}};let Bs=14400*1e3;var Vs=class extends G{constructor({diag:e,perf:t}={}){super({instrumentationName:`SpanSessionTimeoutInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),A(this,`_sessionTimeout`,void 0),A(this,`disable`,()=>{this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=null}),A(this,`enable`,()=>{this._checkTimeout()}),A(this,`_onTimeout`,()=>{this._diag.debug(`Timeout detected`),this._sessionTimeout&&clearTimeout(this._sessionTimeout),this.sessionManager.endSessionSpanInternal(`timer`),this.sessionManager.startSessionSpan({reason:`timer`}),this._sessionTimeout=setTimeout(this._checkTimeout,Bs)}),A(this,`_checkTimeout`,()=>{let e=this.sessionManager.getSessionStartTime();if(e){let t=Bs-this.perf.millisSinceHRTime(e);if(t<=0){this._onTimeout();return}this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=setTimeout(this._checkTimeout,t);return}this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=setTimeout(this._checkTimeout,Bs)}),this._sessionTimeout=null,this._config.enabled&&this.enable()}};let Hs=[`mousedown`];var Us=class extends G{constructor({diag:e,perf:t,visibilityWaitTimeMs:n=0,limitedSessionMaxDurationMs:r=5e3,backgroundSessions:i=!1,maxPendingSpanCount:a=5,visibilityDoc:o=window.document}={},s,c){super({instrumentationName:`SpanSessionVisibilityInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),A(this,`_currentVisibilityState`,void 0),A(this,`_checkVisibilityTimeout`,void 0),A(this,`_interactionSinceLastVisibilityChange`,void 0),A(this,`_avoidEndingLimitedSessions`,void 0),A(this,`_mxlSpanProcessor`,void 0),A(this,`_checkVisibilityChange`,void 0),A(this,`_onVisibilityChange`,void 0),A(this,`_onInteractionThrottled`,void 0),this._currentVisibilityState=o.visibilityState,this._checkVisibilityTimeout=null,this._interactionSinceLastVisibilityChange=!1,this._avoidEndingLimitedSessions=r>0&&s.isEmptySessionAvoidanceEnabled(),this._mxlSpanProcessor=c,this._checkVisibilityChange=()=>{if(n<=0){this._currentVisibilityState=o.visibilityState,this._onVisibilityChange();return}if(this._checkVisibilityTimeout&&clearTimeout(this._checkVisibilityTimeout),o.visibilityState===`visible`&&this._currentVisibilityState!==o.visibilityState){this._currentVisibilityState=o.visibilityState,this._onVisibilityChange();return}this._diag.debug(`Visibility changed to ${o.visibilityState}. Will wait ${(n/1e3).toString()}s, and check if visibility changed`),this._checkVisibilityTimeout=setTimeout(()=>{this._currentVisibilityState===o.visibilityState?this._diag.debug(`Visibility was not changed after timeout happened: ${o.visibilityState}`):(this._currentVisibilityState=o.visibilityState,this._onVisibilityChange())},n)},this._onVisibilityChange=()=>{this._diag.debug(`Visibility change detected: ${o.visibilityState}`);let e=this.sessionManager.getSessionStartTime();if(this._avoidEndingLimitedSessions&&e!==null&&this.perf.millisSinceHRTime(e)<r&&!this._interactionSinceLastVisibilityChange&&this._mxlSpanProcessor&&this._mxlSpanProcessor.getPendingSpansCount()<a){this._diag.debug(`Not ending the session since it is considered limited`),this.sessionManager.addBreadcrumb(`Tab visibility changed to ${o.visibilityState}`);let e=this.sessionManager.getSessionId();if(e){let t=this.sessionManager.currentSessionAsReadableSpan(`state_changed`);t&&this._mxlSpanProcessor.storePendingSpans(e,t)}}else{let e=this.sessionManager.getSessionId();this._mxlSpanProcessor&&e&&this._mxlSpanProcessor.clearStoredSpans(e),this.sessionManager.endSessionSpanInternal(`state_changed`),o.visibilityState===`hidden`&&i?(this._diag.debug("Starting a session since document visibility switched to hidden and `backgroundSessions` is enabled"),this.sessionManager.startSessionSpan({reason:`hidden`})):o.visibilityState===`visible`&&(this._diag.debug(`Starting a session since document visibility switched to visible`),this.sessionManager.startSessionSpan({reason:`visible`}))}this._interactionSinceLastVisibilityChange=!1},this._onInteractionThrottled=aa(()=>{this._interactionSinceLastVisibilityChange=!0},1e3),this._config.enabled&&this.enable()}disable(){window.removeEventListener(`visibilitychange`,this._checkVisibilityChange),this._avoidEndingLimitedSessions&&Et({target:window,events:Hs,callback:this._onInteractionThrottled})}enable(){window.addEventListener(`visibilitychange`,this._checkVisibilityChange),this._avoidEndingLimitedSessions&&Tt({target:window,events:Hs,callback:this._onInteractionThrottled})}},Ws=class{constructor(){A(this,`t`,void 0),A(this,`o`,0),A(this,`i`,[])}u(e){var t;if(e.hadRecentInput)return;let n=this.i[0],r=this.i.at(-1);this.o&&n&&r&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),(t=this.t)==null||t.call(this,e)}};let Gs=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Ks=e=>{if(document.readyState===`loading`)return`loading`;{let t=Gs();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`},qs=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},Js=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#`+n.id:[qs(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},Ys=new WeakMap;function Xs(e,t){return Ys.get(e)||Ys.set(e,new t),Ys.get(e)}let Zs=-1,Qs=()=>Zs,$s=e=>{addEventListener(`pageshow`,(t=>{t.persisted&&(Zs=t.timeStamp,e(t))}),!0)},J=(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)))}},ec=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},tc=()=>{var e;let t=Gs();return(e=t==null?void 0:t.activationStart)==null?0:e},Y=(e,t=-1)=>{let n=Gs(),r=`navigate`;return Qs()>=0?r=`back-forward-cache`:n&&(document.prerendering||tc()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},nc=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return r.observe(L({type:e,buffered:!0},n)),r}}catch(e){}},rc=e=>{let t=!1;return()=>{t||(e(),t=!0)}},ic=-1,ac=new Set,oc=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,sc=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of ac)e();isFinite(ic)||(ic=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,sc,!0))}},cc=()=>{if(ic<0){var e;let t=tc(),n=document.prerendering||(e=globalThis.performance.getEntriesByType(`visibility-state`).filter((e=>e.name===`hidden`&&e.startTime>t))[0])==null?void 0:e.startTime;ic=n==null?oc():n,addEventListener(`visibilitychange`,sc,!0),addEventListener(`prerenderingchange`,sc,!0),$s((()=>{setTimeout((()=>{ic=oc()}))}))}return{get firstHiddenTime(){return ic},onHidden(e){ac.add(e)}}},lc=e=>{document.prerendering?addEventListener(`prerenderingchange`,(()=>e()),!0):e()},uc=[1800,3e3],dc=(e,t={})=>{lc((()=>{let n=cc(),r,i=Y(`FCP`),a=nc(`paint`,(e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-tc(),0),i.entries.push(t),r(!0)))}));a&&(r=J(e,i,uc,t.reportAllChanges),$s((n=>{i=Y(`FCP`),r=J(e,i,uc,t.reportAllChanges),ec((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},fc=[.1,.25],pc=e=>e.find((e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1}))||e[0],mc=(e,t={})=>{let n=Xs(t=Object.assign({},t),Ws),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=pc(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?Js(o):i;r.set(n,e)}}},((e,t={})=>{let n=cc();dc(rc((()=>{let r,i=Y(`CLS`,0),a=Xs(t,Ws),o=e=>{for(let t of e)a.u(t);a.o>i.value&&(i.value=a.o,i.entries=a.i,r())},s=nc(`layout-shift`,o);s&&(r=J(e,i,fc,t.reportAllChanges),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),$s((()=>{a.o=0,i=Y(`CLS`,0),r=J(e,i,fc,t.reportAllChanges),ec((()=>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=pc(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:Ks(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},hc=(e,t={})=>{dc((t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Ks(Qs())};if(e.entries.length){let n=Gs(),r=e.entries.at(-1);if(n){let i=n.activationStart||0,a=Math.max(0,n.responseStart-i);t={timeToFirstByte:a,firstByteToFCP:e.value-a,loadState:Ks(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})})(t))}),t)},gc=0,_c=1/0,vc=0,yc=e=>{for(let t of e)t.interactionId&&(_c=Math.min(_c,t.interactionId),vc=Math.max(vc,t.interactionId),gc=vc?(vc-_c)/7+1:0)},bc,xc=()=>{var e;return bc?gc:(e=performance.interactionCount)==null?0:e},Sc=()=>{`interactionCount`in performance||bc||(bc=nc(`event`,yc,{type:`event`,buffered:!0,durationThreshold:0}))},Cc=0;var wc=class{constructor(){A(this,`l`,[]),A(this,`h`,new Map),A(this,`m`,void 0),A(this,`p`,void 0)}v(){Cc=xc(),this.l.length=0,this.h.clear()}M(){let e=Math.min(this.l.length-1,Math.floor((xc()-Cc)/50));return this.l[e]}u(e){var t;if((t=this.m)==null||t.call(this,e),!e.interactionId&&e.entryType!==`first-input`)return;let n=this.l.at(-1),r=this.h.get(e.interactionId);if(r||this.l.length<10||e.duration>n.T){var i;if(r?e.duration>r.T?(r.entries=[e],r.T=e.duration):e.duration===r.T&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],T:e.duration},this.h.set(r.id,r),this.l.push(r)),this.l.sort(((e,t)=>t.T-e.T)),this.l.length>10){let e=this.l.splice(10);for(let t of e)this.h.delete(t.id)}(i=this.p)==null||i.call(this,r)}}};let Tc=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState===`hidden`?e():(e=rc(e),addEventListener(`visibilitychange`,e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener(`visibilitychange`,e,{capture:!0})})))},Ec=[200,500],Dc=(e,t={})=>{let n=Xs(t=Object.assign({},t),wc),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(Tc(u),c=!0)},u=()=>{let e=n.l.map((e=>o.get(e.entries[0]))),t=i.length-50;i=i.filter(((n,r)=>r>=t||e.includes(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-1-50;r=r.filter(((e,t)=>e.startTime>a&&t>l||s.has(e))),c=!1};n.m=e=>{let t=e.startTime+e.duration,n;a=Math.max(a,e.processingEnd);for(let r=i.length-1;r>=0;r--){let a=i[r];if(Math.abs(t-a.renderTime)<=8){n=a,n.startTime=Math.min(e.startTime,n.startTime),n.processingStart=Math.min(e.processingStart,n.processingStart),n.processingEnd=Math.max(e.processingEnd,n.processingEnd),n.entries.push(e);break}}n||(n={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:t,entries:[e]},i.push(n)),(e.interactionId||e.entryType===`first-input`)&&o.set(e,n),l()},n.p=e=>{if(!s.get(e)){let i=e.entries[0].target;if(i){var n,r;let a=(n=(r=t.generateTarget)==null?void 0:r.call(t,i))==null?Js(i):n;s.set(e,a)}}};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=>{let t=e.entries[0],r=o.get(t),i=t.processingStart,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.h.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:Ks(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;if(!((t=e.longAnimationFrameEntries)!=null&&t.length))return;let n=e.interactionTime,r=e.inputDelay,i=e.processingDuration,a,o,s=0,c=0,l=0,u=0;for(let t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let l=t-Math.max(n,e.startTime),d=e.duration?l/e.duration*e.forcedStyleAndLayoutDuration:0;s+=l-d,c+=d,l>u&&(o=e.startTime<n+r?`input-delay`:e.startTime>=n+r+i?`presentation-delay`:`processing-duration`,a=e,u=l)}}let d=e.longAnimationFrameEntries.at(-1),f=d?d.startTime+d.duration:0;f>=n+r+i&&(l=e.nextPaintTime-f),a&&o&&(e.longestScript={entry:a,subpart:o,intersectingDuration:u}),e.totalScriptDuration=s,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=l,e.totalUnattributedDuration=e.nextPaintTime-n-s-c-l})(p),Object.assign(e,{attribution:p})};nc(`long-animation-frame`,(e=>{r=r.concat(e),l()})),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=cc();lc((()=>{var r;Sc();let i,a=Y(`INP`),o=Xs(t,wc),s=e=>{Tc((()=>{for(let t of e)o.u(t);let t=o.M();t&&t.T!==a.value&&(a.value=t.T,a.entries=t.entries,i())}))},c=nc(`event`,s,{durationThreshold:(r=t.durationThreshold)==null?40:r});i=J(e,a,Ec,t.reportAllChanges),c&&(c.observe({type:`first-input`,buffered:!0}),n.onHidden((()=>{s(c.takeRecords()),i(!0)})),$s((()=>{o.v(),a=Y(`INP`),i=J(e,a,Ec,t.reportAllChanges)})))}))})((t=>{e(f(t))}),t)};var Oc=class{constructor(){A(this,`m`,void 0)}u(e){var t;(t=this.m)==null||t.call(this,e)}};let kc=[2500,4e3],Ac=(e,t={})=>{let n=Xs(t=Object.assign({},t),Oc),r=new WeakMap;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?Js(n):i;r.set(e,o)}},((e,t={})=>{lc((()=>{let n=cc(),r,i=Y(`LCP`),a=Xs(t,Oc),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(let t of e)a.u(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-tc(),0),i.entries=[t],r())},s=nc(`largest-contentful-paint`,o);if(s){r=J(e,i,kc,t.reportAllChanges);let n=rc((()=>{o(s.takeRecords()),s.disconnect(),r(!0)})),a=e=>{e.isTrusted&&(Tc(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});$s((n=>{i=Y(`LCP`),r=J(e,i,kc,t.reportAllChanges),ec((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){let n=Gs();if(n){let i=n.activationStart||0,a=e.entries.at(-1),o=a.url&&performance.getEntriesByType(`resource`).filter((e=>e.name===a.url))[0],s=Math.max(0,n.responseStart-i),c=Math.max(s,o?(o.requestStart||o.startTime)-i:0),l=Math.min(e.value,Math.max(c,o?o.responseEnd-i:0));t={target:r.get(a),timeToFirstByte:s,resourceLoadDelay:c-s,resourceLoadDuration:l-c,elementRenderDelay:e.value-l,navigationEntry:n,lcpEntry:a},a.url&&(t.url=a.url),o&&(t.lcpResourceEntry=o)}}return Object.assign(e,{attribution:t})})(t))}),t)},jc=[800,1800],Mc=e=>{document.prerendering?lc((()=>Mc(e))):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,(()=>Mc(e)),!0)},Nc=(e,t={})=>{((e,t={})=>{let n=Y(`TTFB`),r=J(e,n,jc,t.reportAllChanges);Mc((()=>{let i=Gs();i&&(n.value=Math.max(i.responseStart-tc(),0),n.entries=[i],r(!0),$s((()=>{n=Y(`TTFB`,0),r=J(e,n,jc,t.reportAllChanges),r(!0)})))}))})((t=>{e((e=>{let t={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(e.entries.length){let n=e.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),a=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),s=Math.max(n.connectEnd-r,0);t={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:n}}return Object.assign(e,{attribution:t})})(t))}),t)},Pc=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],Fc={CLS:mc,FCP:hc,LCP:Ac,INP:Dc,TTFB:Nc,FID:void 0},Ic=(e,t)=>{let n={},r=[];if(e===`CLS`){let e=t.attribution;r.push({key:`largestShiftTarget`,value:e.largestShiftTarget},{key:`largestShiftValue`,value:e.largestShiftValue})}else if(e===`INP`){let e=t.attribution;r.push({key:`interactionTarget`,value:e.interactionTarget},{key:`interactionType`,value:e.interactionType},{key:`nextPaintTime`,value:e.nextPaintTime},{key:`inputDelay`,value:e.inputDelay},{key:`processingDuration`,value:e.processingDuration},{key:`presentationDelay`,value:e.presentationDelay},{key:`totalScriptDuration`,value:e.totalScriptDuration},{key:`totalStyleAndLayoutDuration`,value:e.totalStyleAndLayoutDuration},{key:`totalPaintDuration`,value:e.totalPaintDuration},{key:`totalUnattributedDuration`,value:e.totalUnattributedDuration},{key:`loadState`,value:e.loadState})}else if(e===`LCP`){let e=t.attribution;r.push({key:`target`,value:e.target},{key:`url`,value:e.url},{key:`timeToFirstByte`,value:e.timeToFirstByte},{key:`resourceLoadDelay`,value:e.resourceLoadDelay},{key:`resourceLoadDuration`,value:e.resourceLoadDuration},{key:`elementRenderDelay`,value:e.elementRenderDelay})}return r.forEach(e=>{e.value!==void 0&&(n[`mxl.web_vital.attribution.${e.key}`]=e.value)}),n};var Lc=class extends G{constructor({diag:e,perf:t,listeners:n=Fc,urlDocument:r=window.document,urlAttribution:i=!0,pageManager:a}={}){super({instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),A(this,`_listeners`,void 0),A(this,`_urlDocument`,void 0),A(this,`_urlAttribution`,void 0),A(this,`_pageManager`,void 0),A(this,`_attributedPage`,{INP:void 0,LCP:void 0,CLS:void 0,FCP:void 0,TTFB:void 0}),A(this,`_largestShiftTargetForCLS`,void 0),A(this,`_listenersRegistered`,!1),A(this,`_isEnabled`,!1),this._listeners=n,this._urlDocument=r,this._urlAttribution=i,this._pageManager=a==null?U.getPageManager():a,this._config.enabled&&this.enable()}disable(){this._isEnabled=!1,this._diag.debug(`WebVitalsInstrumentation disabled, pausing emission`)}enable(){if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug(`WebVitalsInstrumentation listeners already registered, resuming emission`);return}if(this._listenersRegistered=!0,Pc.forEach(e=>{var t,n;(t=(n=this._listeners)[e])==null||t.call(n,t=>{if(!this._isEnabled)return;let n=this.sessionManager.getSessionSpan();if(!n)return;let r=this._getTimeForMetric(t),i=this._getAttributedPageForMetric(t),a=L({[O]:k.WebVital,[N]:i.fullURL,[Ft]:i.fullURL,"mxl.web_vital.navigation_type":t.navigationType,"mxl.web_vital.name":t.name,"mxl.web_vital.rating":t.rating,"mxl.web_vital.id":t.id,"mxl.web_vital.delta":t.delta,"mxl.web_vital.value":t.value},Ic(e,t));i.path&&i.pageID&&(a[It]=i.path,a[Lt]=i.pageID),i.label&&(a[Rt]=i.label),n.addEvent(`mxl-web-vitals-report-${e}`,a,r)})}),this._urlAttribution){var e,t,n,r,i,a,o,s,c,l;(e=(t=this._listeners).TTFB)==null||e.call(t,()=>{this._attributedPage.TTFB=this._currentAttributedPage()},{reportAllChanges:!0}),(n=(r=this._listeners).FCP)==null||n.call(r,()=>{this._attributedPage.FCP=this._currentAttributedPage()},{reportAllChanges:!0}),(i=(a=this._listeners).INP)==null||i.call(a,()=>{this._attributedPage.INP=this._currentAttributedPage()},{reportAllChanges:!0}),(o=(s=this._listeners).LCP)==null||o.call(s,()=>{this._attributedPage.LCP=this._currentAttributedPage()},{reportAllChanges:!0}),(c=(l=this._listeners).CLS)==null||c.call(l,e=>{let t=e;this._largestShiftTargetForCLS!==t.attribution.largestShiftTarget&&(this._largestShiftTargetForCLS=t.attribution.largestShiftTarget,this._attributedPage.CLS=this._currentAttributedPage())},{reportAllChanges:!0})}}_getTimeForMetric(e){return e.name===`CLS`&&e.attribution.largestShiftTime?this.perf.epochMillisFromOriginOffset(e.attribution.largestShiftTime):e.name===`INP`&&e.attribution.interactionTime?this.perf.epochMillisFromOriginOffset(e.attribution.interactionTime):this.perf.getNowMillis()}_currentAttributedPage(){let e={fullURL:this._urlDocument.URL},t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.path=t.path,e.pageID=n);let r=this._pageManager.getPageLabel();return r&&(e.label=r),e}_getAttributedPageForMetric(e){return e.name===`FCP`&&this._attributedPage.FCP?this._attributedPage.FCP:e.name===`TTFB`&&this._attributedPage.TTFB?this._attributedPage.TTFB:e.name===`INP`&&this._attributedPage.INP?this._attributedPage.INP:e.name===`LCP`&&this._attributedPage.LCP?this._attributedPage.LCP:e.name===`CLS`&&this._attributedPage.CLS&&e.attribution.largestShiftTarget===this._largestShiftTargetForCLS?this._attributedPage.CLS:this._currentAttributedPage()}};let X=console.error.bind(console);function Rc(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})}let zc=(e,t,n)=>{if(!e||!e[t]){X(`no original function `+String(t)+` to wrap`);return}if(!n){X(`no wrapper function`),X(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){X(`original object and wrapper must be functions`);return}let i=n(r,t);return Rc(i,`__original`,r),Rc(i,`__unwrap`,()=>{e[t]===i&&Rc(e,t,r)}),Rc(i,`__wrapped`,!0),Rc(e,t,i),i},Bc=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{X(`must provide one or more modules to patch`),X(Error().stack);return}if(!(t&&Array.isArray(t))){X(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{zc(e,t,n)})})},Vc=(e,t)=>{if(!e||!e[t]){X(`no function to unwrap.`),X(Error().stack);return}let n=e[t];if(!n.__unwrap)X(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Hc=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{X(`must provide one or more modules to patch`),X(Error().stack);return}if(!(t&&Array.isArray(t))){X(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Vc(e,t)})})};function Uc(e){e&&e.logger&&(typeof e.logger==`function`?X=e.logger:X(`new logger isn't a function, not replacing`))}Uc.wrap=zc,Uc.massWrap=Bc,Uc.unwrap=Vc,Uc.massUnwrap=Hc;var Wc=class{constructor(e,t,n){A(this,`_config`,{}),A(this,`_tracer`,void 0),A(this,`_meter`,void 0),A(this,`_logger`,void 0),A(this,`_diag`,void 0),A(this,`instrumentationName`,void 0),A(this,`instrumentationVersion`,void 0),A(this,`_wrap`,zc),A(this,`_unwrap`,Vc),A(this,`_massWrap`,Bc),A(this,`_massUnwrap`,Hc),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=T.createComponentLogger({namespace:e}),this._tracer=D.getTracer(e,t),this._meter=ht.getMeter(e,t),this._logger=Xa.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)}}},Gc=class extends Wc{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function Kc(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function qc(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var Z;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(Z||(Z={}));function Jc(e,t){let n=Z.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=Z.DUPLICATE;break}else t.toLowerCase()===e&&(n=Z.STABLE);return n}let Yc=performance,Xc=Math.pow(10,6),Zc=Math.pow(10,9);function Qc(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Xc)]}function $c(e){return el(Qc(Yc.timeOrigin),Qc(typeof e==`number`?e:Yc.now()))}function el(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Zc&&(n[1]-=Zc,n[0]+=1),n}function tl(e,t){return typeof t==`string`?e===t:!!e.match(t)}function nl(e,t){if(!t)return!1;for(let n of t)if(tl(e,n))return!0;return!1}var Q;(function(e){e.METHOD_OPEN=`open`,e.METHOD_SEND=`send`,e.EVENT_ABORT=`abort`,e.EVENT_ERROR=`error`,e.EVENT_LOAD=`loaded`,e.EVENT_TIMEOUT=`timeout`})(Q||(Q={}));let rl=T.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`});function il(e){return typeof Document<`u`&&e instanceof Document}function al(e){if(il(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return sl(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return cl(e);if(e instanceof URLSearchParams)return sl(e.toString());if(e.byteLength!==void 0)return e.byteLength;rl.warn(`unknown body type`)}let ol=new TextEncoder;function sl(e){return ol.encode(e).byteLength}function cl(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 ll(e){let t=fl(),n=e.toUpperCase();return n in t?n:`_OTHER`}let ul={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},dl;function fl(){return dl===void 0&&(dl=ul),dl}let pl={"https:":`443`,"http:":`80`};function ml(e){let t=Number(e.port||pl[e.protocol]);if(t&&!isNaN(t))return t}let hl=`0.213.0`;var gl;(function(e){e.HTTP_STATUS_TEXT=`http.status_text`})(gl||(gl={}));var _l=class extends Gc{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,hl,e),A(this,`component`,`xml-http-request`),A(this,`version`,hl),A(this,`moduleName`,this.component),A(this,`_tasksCount`,0),A(this,`_xhrMem`,new WeakMap),A(this,`_usedResources`,new WeakSet),A(this,`_semconvStability`,void 0),this._semconvStability=Jc(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addHeaders(e,t){let n=H(t).href;if(!$i(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};E.inject(w.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};E.inject(w.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){w.with(D.setSpan(w.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[B.FETCH_START]}),n=!(this._semconvStability&Z.OLD);qi(e,t,this.getConfig().ignoreNetworkEvents,void 0,n),e.end(t[B.RESPONSE_END])})}_addFinalSpanAttributes(e,t,n){if(this._semconvStability&Z.OLD){if(t.status!==void 0&&e.setAttribute(`http.status_code`,t.status),t.statusText!==void 0&&e.setAttribute(gl.HTTP_STATUS_TEXT,t.statusText),typeof n==`string`){let t=H(n);e.setAttribute(`http.host`,t.host),e.setAttribute(`http.scheme`,t.protocol.replace(`:`,``))}e.setAttribute(`http.user_agent`,navigator.userAgent)}this._semconvStability&Z.STABLE&&t.status&&e.setAttribute(an,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&Kc(()=>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=H(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&&(Yc.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=Yc.getEntriesByType(`resource`));let o=Xi(H(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));let r=!(this._semconvStability&Z.OLD);qi(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){if(nl(t,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let r=``,i=H(t),a={};if(this._semconvStability&Z.OLD&&(r=n.toUpperCase(),a[`http.method`]=n,a[`http.url`]=i.toString()),this._semconvStability&Z.STABLE){let e=n,t=ll(n);r||(r=t),a[nn]=t,t!==e&&(a[rn]=e),a[N]=i.toString(),a[on]=i.hostname;let o=ml(i);o&&(a[sn]=o)}let o=this.tracer.startSpan(r,{kind:dt.CLIENT,attributes:a});return o.addEvent(Q.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:o,spanUrl:t}),o}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...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,s),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),e._semconvStability&Z.STABLE&&(i?a&&(t.setStatus({code:ft.ERROR,message:a}),t.setAttribute(en,a)):o.status&&o.status>=400&&(t.setStatus({code:ft.ERROR}),t.setAttribute(en,String(o.status))))}let s=$c(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},300)}function r(){n(Q.EVENT_ERROR,this,!0,`error`)}function i(){n(Q.EVENT_ABORT,this,!1)}function a(){n(Q.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(Q.EVENT_LOAD,this,!1):n(Q.EVENT_ERROR,this,!1)}function s(t){t.removeEventListener(`abort`,i),t.removeEventListener(`error`,r),t.removeEventListener(`load`,o),t.removeEventListener(`timeout`,a);let n=e._xhrMem.get(t);n&&(n.callbackToRemoveEvents=void 0)}return t=>function(...n){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 t=n[0],r=al(t);r!==void 0&&(e._semconvStability&Z.OLD&&l.setAttribute(`http.request_content_length_uncompressed`,r),e._semconvStability&Z.STABLE&&l.setAttribute(`http.request.body.size`,r))}w.with(D.setSpan(w.active(),l),()=>{e._tasksCount++,c.sendStartTime=$c(),l.addEvent(Q.METHOD_SEND),this.addEventListener(`abort`,i),this.addEventListener(`error`,r),this.addEventListener(`load`,o),this.addEventListener(`timeout`,a),c.callbackToRemoveEvents=()=>{s(this),c.createdResources&&c.createdResources.observer.disconnect()},e._addHeaders(this,u),e._addResourceObserver(this,u)})}return t.apply(this,n)}}enable(){this._diag.debug(`applying patch to`,this.moduleName,this.version),qc(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,`open`),this._diag.debug(`removing previous patch from method open`)),qc(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.debug(`removing previous patch from method send`)),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend())}disable(){this._diag.debug(`removing patch from`,this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}};let vl=[`omitIfAlreadyPatched`];var yl=class extends _l{constructor(e={}){let{omitIfAlreadyPatched:t}=e,n=ns(e,vl);super(L(L({},n),{},{enabled:!1})),A(this,`_omitIfAlreadyPatched`,void 0),this._omitIfAlreadyPatched=t,n.enabled&&this.enable()}enable(){if(this._omitIfAlreadyPatched&&(to(XMLHttpRequest.prototype.open)||to(XMLHttpRequest.prototype.send))){this._diag.debug("XMLHttpRequest is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation");return}super.enable()}};let bl=v(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function xl(e){return e.setValue(bl,!0)}function Sl(){return e=>{T.error(Cl(e))}}function Cl(e){return typeof e==`string`?e:JSON.stringify(wl(e))}function wl(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}let Tl=Sl();function El(e){try{Tl(e)}catch(e){}}let Dl={[dn]:`opentelemetry`,"process.runtime.name":`browser`,[ln]:un,[fn]:`2.6.0`},Ol=performance,kl=Math.pow(10,6),Al=Math.pow(10,9);function jl(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*kl)]}function Ml(e){return Fl(jl(Ol.timeOrigin),jl(typeof e==`number`?e:Ol.now()))}function Nl(e){if(Pl(e))return e;if(typeof e==`number`)return e<Ol.timeOrigin?Ml(e):jl(e);if(e instanceof Date)return jl(e.getTime());throw TypeError(`Invalid input type`)}function Pl(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Fl(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Al&&(n[1]-=Al,n[0]+=1),n}var Il;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(Il||(Il={}));var Ll=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Rl(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Ll(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var zl=class{constructor(){A(this,`_promise`,void 0),A(this,`_resolve`,void 0),A(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)}},Bl=class{constructor(e,t){A(this,`_isCalled`,!1),A(this,`_deferred`,new zl),A(this,`_callback`,void 0),A(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 Vl(e,t){return new Promise(n=>{w.with(xl(w.active()),()=>{e.export(t,n)})})}let Hl={_export:Vl},Ul;function Wl(){if(Ul===void 0)try{let e=globalThis.process.argv0;Ul=e?`unknown_service:${e}`:`unknown_service`}catch(e){Ul=`unknown_service`}return Ul}let Gl=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;var Kl=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Yl(t),r._asyncAttributesPending=t.filter(([e,t])=>Gl(t)).length>0,r}constructor(e,t){var n;A(this,`_rawAttributes`,void 0),A(this,`_asyncAttributesPending`,!1),A(this,`_schemaUrl`,void 0),A(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Gl(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Yl(this._rawAttributes),this._schemaUrl=Xl(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Gl(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&T.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Gl(n)){T.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Zl(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function ql(e,t){return Kl.FromAttributeList(Object.entries(e),t)}function Jl(){return ql({[cn]:Wl(),[ln]:Dl[ln],[dn]:Dl[dn],[fn]:Dl[fn]})}function Yl(e){return e.map(([e,t])=>Gl(t)?[e,t.catch(t=>{T.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Xl(e){if(typeof e==`string`||e===void 0)return e;T.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Zl(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;T.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Ql(e){return $l(e,new WeakSet)}function $l(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>$l(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>$l(e,t))}return!1}var eu=class{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.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,t,n){A(this,`hrTime`,void 0),A(this,`hrTimeObserved`,void 0),A(this,`spanContext`,void 0),A(this,`resource`,void 0),A(this,`instrumentationScope`,void 0),A(this,`attributes`,{}),A(this,`_severityText`,void 0),A(this,`_severityNumber`,void 0),A(this,`_body`,void 0),A(this,`_eventName`,void 0),A(this,`totalAttributesCount`,0),A(this,`_isReadonly`,!1),A(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=Nl(r==null?f:r),this.hrTimeObserved=Nl(i==null?f:i),d){let e=D.getSpanContext(d);e&&tt(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){return this._isLogRecordReadonly()?this:e.length===0?(T.warn(`Invalid attribute key: ${e}`),this):Ql(t)?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&T.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),this)):(T.warn(`Invalid attribute value set for key: ${e}`),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}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return T.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,j)||this.setAttribute(j,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,M)||this.setAttribute(M,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,M)||this.setAttribute(M,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,j)||this.setAttribute(j,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,tn)||this.setAttribute(tn,n.stack),t=!0)}t||T.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&T.warn(`Can not execute the operation on emitted log record`),this._isReadonly}},tu=class{constructor(e,t){A(this,`instrumentationScope`,void 0),A(this,`_sharedState`,void 0),A(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){var t;let n=this._loggerConfig,r=e.context||w.active(),i=(t=e.severityNumber)==null?W.UNSPECIFIED:t;if(i!==W.UNSPECIFIED&&i<n.minimumSeverity)return;if(n.traceBased){let e=D.getSpanContext(r);if(e&&tt(e)&&(e.traceFlags&C.SAMPLED)!==C.SAMPLED)return}let a=new eu(this._sharedState,this.instrumentationScope,L({context:r},e));this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}},nu=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}},ru=class{constructor(e,t){A(this,`processors`,void 0),A(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return P(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>Rl(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return P(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}};function iu(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}let au={disabled:!1,minimumSeverity:W.UNSPECIFIED,traceBased:!1},ou=()=>L({},au);var su=class{constructor(e,t,n,r,i){A(this,`loggers`,new Map),A(this,`activeProcessor`,void 0),A(this,`registeredLogRecordProcessors`,[]),A(this,`resource`,void 0),A(this,`forceFlushTimeoutMillis`,void 0),A(this,`logRecordLimits`,void 0),A(this,`processors`,void 0),A(this,`_loggerConfigurator`,void 0),A(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new ru(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new nu,this._loggerConfigurator=i==null?ou:i}getLoggerConfig(e){let t=iu(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}},cu=class{constructor(e={}){var t,n,r,i,a,o,s,c;A(this,`_shutdownOnce`,void 0),A(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?Jl():t,forceFlushTimeoutMillis:(n=e.forceFlushTimeoutMillis)==null?3e4:n,logRecordLimits:{attributeCountLimit:(r=(i=e.logRecordLimits)==null?void 0:i.attributeCountLimit)==null?128:r,attributeValueLengthLimit:(a=(o=e.logRecordLimits)==null?void 0:o.attributeValueLengthLimit)==null?1/0:a},loggerConfigurator:(s=e.loggerConfigurator)==null?ou:s,processors:(c=e.processors)==null?[]:c};this._sharedState=new su(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator),this._shutdownOnce=new Bl(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return T.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ua;e||T.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new tu({name:r,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(T.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(T.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},lu=class{constructor(e,t){var n,r,i,a;A(this,`_maxExportBatchSize`,void 0),A(this,`_maxQueueSize`,void 0),A(this,`_scheduledDelayMillis`,void 0),A(this,`_exportTimeoutMillis`,void 0),A(this,`_exporter`,void 0),A(this,`_isExporting`,!1),A(this,`_finishedLogRecords`,[]),A(this,`_timer`,void 0),A(this,`_shutdownOnce`,void 0),this._exporter=e,this._maxExportBatchSize=(n=t==null?void 0:t.maxExportBatchSize)==null?512:n,this._maxQueueSize=(r=t==null?void 0:t.maxQueueSize)==null?2048:r,this._scheduledDelayMillis=(i=t==null?void 0:t.scheduledDelayMillis)==null?5e3:i,this._exportTimeoutMillis=(a=t==null?void 0:t.exportTimeoutMillis)==null?3e4:a,this._shutdownOnce=new Bl(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(T.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return P(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<r;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():Rl(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis)}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,El(e)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let t=()=>Hl._export(this._exporter,e).then(e=>{if(e.code!==Il.SUCCESS){var t;El((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed (status ${e})`):t)}}).catch(El),n=[];for(let t=0;t<e.length;t++){let r=e[t].resource;r.asyncAttributesPending&&typeof r.waitForAsyncAttributes==`function`&&n.push(r.waitForAsyncAttributes())}return n.length===0?t():Promise.all(n).then(t,El)}},uu=class extends lu{constructor(e,t){super(e,t),A(this,`_visibilityChangeListener`,void 0),A(this,`_pageHideListener`,void 0),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}},du=class{constructor(e){A(this,`_sessionIdProvider`,void 0),this._sessionIdProvider=e}forceFlush(){return P(function*(){})()}onStart(e,t){var n;let r=(n=this._sessionIdProvider)==null?void 0:n.getSessionId();r&&e.setAttribute(`session.id`,r)}onEnd(e){}shutdown(){return P(function*(){})()}};function fu(e){return new du(e)}let pu={compression:`gzip`,keepalive:!0,concurrencyLimit:5,timeoutMillis:30*1e3},mu=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t}),hu=(e,t)=>t||`http://mxl-otelcol.service-availability.apps.ocpthikadev01.safaricom.net`;function gu(e,t){let n={attributes:vu(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function _u(e){return{name:e.name,version:e.version}}function vu(e,t){return Object.keys(e).map(n=>yu(n,e[n],t))}function yu(e,t,n){return{key:e,value:bu(t,n)}}function bu(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]=bu(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:bu(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function xu(e,t){return{resourceLogs:Cu(e,t)}}function Su(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function Cu(e,t){let n=Su(e);return Array.from(n,([e,n])=>{let r=gu(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:_u(e[0].instrumentationScope),logRecords:e.map(e=>wu(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function wu(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Tu(e.severityNumber),severityText:e.severityText,body:bu(e.body,t),eventName:e.eventName,attributes:Eu(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 Tu(e){return e}function Eu(e,t){return Object.keys(e).map(n=>yu(n,e[n],t))}let Du=Math.pow(10,9);function Ou(e){return e[0]*Du+e[1]}function ku(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Au(e){return ku(e).toString()}let ju=typeof BigInt<`u`?Au:Ou;function Mu(e){return e}let Nu={encodeHrTime:ju,encodeSpanContext:Mu,encodeOptionalSpanContext:Mu,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};function Pu(e,t){let n=e&255|256;return t&&(n|=512),n}function Fu(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:vu(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Lu(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Iu(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Pu(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Iu(e,t){var n;return{attributes:e.attributes?vu(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:Pu(e.context.traceFlags,e.context.isRemote)}}function Lu(e,t){return{attributes:e.attributes?vu(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ru(e,t){return{resourceSpans:Bu(e,t)}}function zu(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 Bu(e,t){let n=zu(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=>Fu(e,t));o.push({scope:_u(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=gu(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}let Vu={serializeRequest:e=>{let t=xu(e,Nu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}},Hu={serializeRequest:e=>{let t=Ru(e,Nu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var Uu=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},Wu=class extends Error{constructor(e,t,n){super(e),A(this,`code`,void 0),A(this,`name`,`OTLPExporterError`),A(this,`data`,void 0),this.data=n,this.code=t}},Gu=class{constructor(e){A(this,`_concurrencyLimit`,void 0),A(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 P(function*(){yield Promise.all(e._sendingPromises)})()}};function Ku(e){return new Gu(e.concurrencyLimit)}var $;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})($||($={}));function qu(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Ju(){return{handleResponse(e){e==null||!qu(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||T.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Yu=class{constructor(e,t,n,r,i){A(this,`_diagLogger`,void 0),A(this,`_transport`,void 0),A(this,`_serializer`,void 0),A(this,`_responseHandler`,void 0),A(this,`_promiseQueue`,void 0),A(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=T.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:$.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:$.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(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:$.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:$.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:$.FAILED,error:(n=e.error)==null?new Wu(`Export failed with retryable status`):n})}else t({code:$.FAILED,error:new Wu(`Export failed with unknown error`)})},e=>t({code:$.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return P(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function Xu(e,t){return new Yu(e.transport,e.serializer,Ju(),e.promiseHandler,t.timeout)}function Zu(e,t,n){return Xu({transport:n,serializer:t,promiseHandler:Ku(e)},{timeout:e.timeoutMillis})}let Qu=49152,$u=0,ed=0;var td=class e{constructor(e){this._config=e}static _compressRequest(e){return P(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),a=e.done}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 P(function*(){let i=t,a=L({"Content-Type":`application/json`},r._config.headers),o,s;if(`timeout`in AbortSignal)o=AbortSignal.timeout(n);else{let e=new AbortController;o=e.signal,s=setTimeout(()=>{e.abort(new DOMException(`TimeoutError`,`TimeoutError`))},n)}let c=!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 T.warn(`Fetch transport gzip compression failed: ${t.message}`),{status:`failure`,error:t}}a[`Content-Encoding`]=`gzip`,a[`Content-Length`]=i.length.toString()}let n=$u+i.byteLength>Qu;if(c=!n&&!(ed>=9),c)$u+=i.byteLength,ed++;else{let e=n?`inflight bytes (${$u} + ${i.byteLength}) would exceed ${Qu}B budget`:`concurrent count (${ed}) at limit of 9`;T.debug(`Sending without keepalive: ${e}`)}let s=yield fetch(r._config.url,{method:`POST`,keepalive:c,headers:a,body:i,signal:o});if(s.ok)return{status:`success`};let l=Error(`${s.status} Fetch request failed`),u=`Fetch transport received HTTP ${s.status} (keepalive=${c})`;return s.status>=500?(T.debug(u),{status:`retryable`,error:l}):(T.warn(u),{status:`failure`,error:l})}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=${c}): ${t.message}`;return n?T.debug(r):T.warn(r),{status:n?`retryable`:`failure`,error:t}}finally{s!==void 0&&clearTimeout(s),c&&($u-=i.byteLength,ed--)}})()}};let nd=e=>new td(e),rd=()=>Math.random()*40-20;var id=class{constructor(e,t=new ia){this._transport=e,this._perf=t}send(e,t){var n=this;return P(function*(){let r=n._perf.getNowMillis()+t,i=yield n._transport.send(e,t),a=5,o=1e3;for(;i.status===`retryable`&&a>0;){var s;a--;let t=Math.max(Math.min(o,5e3)+rd(),0);o*=1.5;let c=(s=i.retryInMillis)==null?t:s,l=r-n._perf.getNowMillis();if(c>l)return i;i=yield n._retry(e,l,c)}return i})()}shutdown(){this._transport.shutdown()}_retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}};let ad=e=>{var t;return new id(e.transport,(t=e.perf)==null?new ia:t)},od=(e,t)=>Zu(e,t,ad({transport:nd(e)}));var sd=class extends Uu{constructor(e){super(od(e,Vu))}};let cd=(e,t)=>`${hu(e,t)}/v1/logs`;var ld=class extends sd{constructor({appID:e,userID:t,mxlDataURL:n}){super(L(L({},pu),{},{headers:mu(e,t),url:cd(e,n)}))}},ud=class extends Uu{constructor(e){super(od(L(L({},e),{},{compression:`gzip`}),Hu))}};let dd=(e,t)=>`${hu(e,t)}/v1/traces`;var fd=class extends ud{constructor({appID:e,userID:t,mxlDataURL:n}){super(L(L({},pu),{},{headers:mu(e,t),url:dd(e,n)}))}},pd=class{constructor({urlDocument:e=window.document}={}){A(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.setAttribute(Ft,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}},md=class{constructor({urlDocument:e=window.document}={}){A(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){e.attributes[Ft]=this._urlDocument.URL}onStart(){}shutdown(){return Promise.resolve(void 0)}},hd=class{constructor({spanSessionManager:e}){A(this,`_spanSessionManager`,void 0),this._spanSessionManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.setAttributes({"log.record.uid":At(),[io]:this._spanSessionManager.getSessionId(),"session.previous_id":this._spanSessionManager.getPreviousSessionId()})}shutdown(){return Promise.resolve(void 0)}},gd=class{constructor({attributeScrubbers:e}){A(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)}},_d=class{constructor({urlDocument:e=window.document}={}){A(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[O]||e.setAttribute(O,k.SystemLog),e.setAttribute(N,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};let vd=e=>{if((e.attributes[nn]||e.attributes[Zt])&&(typeof e.attributes[an]==`number`||typeof e.attributes[$t]==`number`)){var t;let n=(t=e.attributes[N])==null?e.attributes[Qt]:t;return typeof n==`string`&&n.includes(`://`)}return!1};var yd=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){if(vd(e)){var t,n,r,i,a;e.attributes[O]=k.Network,(t=e.attributes)[N]!=null||(t[N]=e.attributes[Qt]),(n=e.attributes)[an]!=null||(n[an]=e.attributes[$t]),(r=e.attributes)[nn]!=null||(r[nn]=e.attributes[Zt]),(i=e.attributes)[ro]!=null||(i[ro]=e.attributes[`http.response_content_length`]),(a=e.attributes)[no]!=null||(a[no]=e.attributes[`http.request_content_length`])}}onStart(){}shutdown(){return Promise.resolve(void 0)}};let bd=e=>e.attributes[O]===k.Session,xd=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var Sd=class{constructor({resource:e,exporter:t,limitManager:n,spanSessionManager:r,storage:i=window.localStorage,storedSpansExpireTimeoutMS:a,diag:o=T.createComponentLogger({namespace:`MXLSessionBatchedSpanProcessor`})}){A(this,`_shutdownOnce`,void 0),A(this,`_pendingSpans`,[]),A(this,`_exporter`,void 0),A(this,`_limitManager`,void 0),A(this,`_spanStorage`,void 0),A(this,`_spanSessionManager`,void 0),A(this,`_diag`,void 0),A(this,`_shutdown`,()=>(this._spanStorage.destroy(),this._exporter.shutdown())),this._diag=o,this._exporter=t,this._shutdownOnce=new Nn(this._shutdown,this),this._limitManager=n,this._spanSessionManager=r,this._spanStorage=new ta({resource:e,storage:i,diag:o,onExpiredSpansExport:e=>{this._exportSpans(e)},storedSpansExpireTimeoutMS:a,spanSessionManager:r})}forceFlush(){return this._diag.debug(`forceFlush called for MXLSessionBatchedSpanProcessor. 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(bd(e))this._diag.debug(`session span ended. Exporting all pending spans.`),this._exportSpans([e,...this._pendingSpans]),this._pendingSpans=[];else{if(this._diag.debug(`non-session span ended. Adding to pending spans queue.`),this._limitManager.dropReadableSpan(e))return;this._pendingSpans.push(e)}}_exportSpans(e){Fn._export(this._exporter,e).then(e=>{if(e.code===_n.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._spanSessionManager.incrSessionCountForKey(xd(r,`current`)),this._spanSessionManager.incrNextSessionCountForKey(xd(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._spanSessionManager.incrSessionCountForKey(xd(`unknown`,`current`)),this._spanSessionManager.incrNextSessionCountForKey(xd(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}storePendingSpans(e,t){this._spanStorage.storePendingSpans(e,t,this._pendingSpans)}clearStoredSpans(e){this._spanStorage.clearStoredSpans(e)}shutdown(){return this._shutdownOnce.call()}},Cd=class{constructor({pageManager:e}){A(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){if(!e.attributes[It]||!e.attributes[Lt]){let t=this._pageManager.getCurrentRoute();t&&(e.setAttribute(It,t.path),e.setAttribute(Lt,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[Rt]&&e.setAttribute(Rt,t)}shutdown(){return Promise.resolve(void 0)}},wd=class{constructor({pageManager:e}){A(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){if(!e.attributes[It]||!e.attributes[Lt]){let t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.attributes[It]=t.path,e.attributes[Lt]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[Rt]&&(e.attributes[Rt]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}},Td=class{constructor({attributeScrubbers:e}){A(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&(e.attributes[t.key]=t.scrub(n))})}onStart(){}shutdown(){return Promise.resolve(void 0)}},Ed=class{constructor({userManager:e}){A(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._userManager.getUserId()&&e.setAttributes({[ao]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}},Dd=class{constructor({userManager:e}){A(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){let t=this._userManager.getUserId();t&&(e.attributes[ao]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}},Od=class extends jn{inject(e,t,n){super.inject(e,t,n);let r=D.getSpan(e);if(r){let e=t instanceof Headers?t.get(`traceparent`):Ae.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};let kd=/\/\/(.+):(.+)@(.+)\//,Ad=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],jd=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(kd,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},Md=e=>{let t=[...Ad,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:N,scrub:e=>jd({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!0})},{key:Qt,scrub:e=>jd({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!0})},{key:`url.path`,scrub:e=>jd({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!1})},{key:`url.query`,scrub:e=>jd({value:e,queryParamRegex:n,scrubPath:!1,scrubQuery:!0})}]},Nd=new class{constructor({diagLogger:e=T.createComponentLogger({namespace:`mxl-registry`})}={}){A(this,`_sdk`,null),A(this,`_diag`,void 0),A(this,`register`,e=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=e}),A(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),A(this,`registered`,()=>this._sdk),this._diag=e}},Pd=(e={},{featureManager:t,logManager:n,spanSessionManager:r,mxlSpanProcessor:i,pageManager:a})=>{var o,s,c,l,u,d;let f=[new zs(e[`session-on-load`]),new Us(e[`session-visibility`],t,i),new Rs(e[`session-activity`]),new Vs(e[`session-timeout`])];(o=e.omit)!=null&&o.has(`exception`)||f.push(new _o(e.exception)),(s=e.omit)!=null&&s.has(`click`)||f.push(new go(e.click)),(c=e.omit)!=null&&c.has(`web-vital`)||f.push(new Lc(L(L({},e[`web-vital`]),{},{pageManager:a}))),(l=e.omit)!=null&&l.has(`document-load`)||f.push(new po(e[`document-load`])),(u=e.omit)!=null&&u.has(`@opentelemetry/instrumentation-fetch`)||f.push(new is(L(L({},e.network),e[`@opentelemetry/instrumentation-fetch`]))),(d=e.omit)!=null&&d.has(`@opentelemetry/instrumentation-xml-http-request`)||f.push(new yl(L(L({},e.network),e[`@opentelemetry/instrumentation-xml-http-request`]))),e[`empty-root`]&&f.push(new mo(L({},e[`empty-root`])));for(let e of f)e instanceof G&&(r&&e.setSessionManager(r),n&&e.setLogManager(n));return f},Fd=e=>{if(e!==void 0){if(typeof e!=`string`)throw Error(`appID must be a string, or omitted if not using MXL. Received ${String(e)}`);return e}},Id=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},Ld=({appID:e,appVersion:t,resource:n=Bn(),spanExporters:r=[],logExporters:i=[],spanProcessors:a=[],propagator:o=null,defaultInstrumentationConfig:s,instrumentations:c=[],contextManager:l=null,logProcessors:u=[],attributeScrubbers:d=[],enableDefaultAttributeScrubbing:f=!0,additionalQueryParamsToScrub:p=[],logLevel:ee=h.ERROR,mxlDataURL:m,mxlConfigURL:te,diagLogger:g=T.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:ne,dynamicSDKConfig:re,registerGlobally:_=!0,blockNetworkSpanForwarding:ie=!1,restrictedProtocols:ae=new Set([`file:`]),useDocumentTitleAsPageLabel:oe=!0}={})=>{try{if(_){let e=Nd.registered();if(e!==null)return g.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}if(T.setLogger(new fe,{logLevel:ee}),typeof window>`u`)return g.warn(`browser not detected, skipping initialization`),!1;let h=new ia,ce=h.getNowMillis(),le=Fd(e),ue=Id(t),v=le!==void 0;if(!v&&!i.length&&!r.length)throw Error(`when appID is omitted, at least one logExporter or spanExporter must be set`);if(ae.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(v&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let y=!_&&e,de=y?new na(e,window.localStorage):window.localStorage,b=y?new na(e,window.sessionStorage):window.sessionStorage,pe=n.merge(Ts({diagLogger:g,appVersion:ue,pageSessionStorage:b})),x=Rd({registerGlobally:_,sdkLocalStorage:de}),me=x.getMXLUserId();if(v&&!me)throw Error(`userID is required when using MXL exporter`);let he=ne==null?new ps({appID:le,appVersion:ue,mxlConfigURL:te,defaultConfig:re,deviceId:me,storage:de}):ne;he.refreshRemoteConfig();let ge=new bs({dynamicConfigManager:he,deviceId:me,blockNetworkSpanForwarding:ie});if(!ge.isSDKEnabled())return g.debug(`SDK is disabled, skipping initialization.`),!1;let _e=ra({featureManager:ge,diag:g,registerGlobally:_,defaultInstrumentationConfig:s,propagator:o}),ve=new gs(ms),ye=[...f?Md(p):[],...d],S=zd({limitManager:ve,registerGlobally:_,sdkLocalStorage:de,sdkSessionStorage:b}),be,xe;if(v){var se;be=new Sd({resource:pe,exporter:new fd({appID:le,mxlDataURL:m,userID:me}),limitManager:ve,storedSpansExpireTimeoutMS:s==null||(se=s[`session-visibility`])==null?void 0:se.storedSpansExpireTimeoutMS,storage:de,spanSessionManager:S}),xe=new uu(new ld({appID:le,mxlDataURL:m,userID:me}))}let Se=Hd({useDocumentTitleAsPageLabel:oe,registerGlobally:_}),{tracerProvider:Ce,mxlTraceManager:we}=Bd({resource:pe,spanSessionManager:S,userManager:x,spanExporters:r,spanProcessors:a,propagator:_e?new Od:o,contextManager:l,attributeScrubbers:ye,registerGlobally:_,mxlSpanProcessor:be,pageManager:Se});S.setTracerProvider(Ce);let{loggerProvider:Te,mxlLogManager:Ee}=Vd({resource:pe,userManager:x,logExporters:i,logProcessors:u,spanSessionManager:S,limitManager:ve,attributeScrubbers:ye,registerGlobally:_,mxlLogProcessor:xe,sdkLocalStorage:de,pageManager:Se});$a(_?{instrumentations:[Pd(s,{featureManager:ge,mxlSpanProcessor:be,pageManager:Se}),...c]}:{tracerProvider:Ce,loggerProvider:Te,instrumentations:[Pd(s,{featureManager:ge,logManager:Ee,spanSessionManager:S,mxlSpanProcessor:be,pageManager:Se}),...c]}),g.info(`successfully initialized the SDK`);let De={setDynamicConfig:e=>{he.setConfig(e)},flush:function(){var e=P(function*(){yield Ce.forceFlush(),yield Te.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:Ee,trace:we,session:S,user:x,page:Se};return _&&Nd.register(De),S.recordSDKStartupDuration(h.getNowMillis()-ce),De}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return g.error(`failed to initialize the SDK: ${t}`),!1}},Rd=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new Is({storage:t});return e&&Va.setGlobalUserManager(n),n},zd=({limitManager:e,registerGlobally:t,sdkLocalStorage:n,sdkSessionStorage:r})=>{let i=new ks({limitManager:e,storage:n,sessionStorage:r});return t&&Ta.setGlobalSessionManager(i),i},Bd=({resource:e,spanSessionManager:t,userManager:n,spanExporters:r,spanProcessors:i=[],propagator:a=null,contextManager:o=null,attributeScrubbers:s,registerGlobally:c,mxlSpanProcessor:l,pageManager:u})=>{let d=[...i,fu(t),new md,new yd,new Dd({userManager:n}),new wd({pageManager:u}),new Td({attributeScrubbers:s})];r==null||r.forEach(e=>{d.push(new Ti(e))}),l&&d.push(l);let f=new Ui({resource:e,spanProcessors:d,spanLimits:{attributeCountLimit:ms.maxAllowed.session_property*2,attributePerEventCountLimit:20,eventCountLimit:ms.maxAllowed.breadcrumb*2,attributeValueLengthLimit:1024}}),p=new As({tracerProvider:c?void 0:f});return c&&(Na.setGlobalTraceManager(p),f.register({contextManager:o||new Bi,propagator:a})),{tracerProvider:f,mxlTraceManager:p}},Vd=({resource:e,userManager:t,logExporters:n,logProcessors:r,spanSessionManager:i,limitManager:a,attributeScrubbers:o,registerGlobally:s,mxlLogProcessor:c,sdkLocalStorage:l,pageManager:u})=>{let d=[...r,new hd({spanSessionManager:i}),new pd,new _d,new Ed({userManager:t}),new gd({attributeScrubbers:o}),new Cd({pageManager:u})];n==null||n.forEach(e=>{d.push(new uu(e))}),c&&d.push(c);let f=new cu({resource:e,processors:d}),p=new vs({spanSessionManager:i,limitManager:a,loggerProvider:s?void 0:f,storage:l});return s&&(Xa.setGlobalLoggerProvider(f),fa.setGlobalLogManager(p)),{loggerProvider:f,mxlLogManager:p}},Hd=({useDocumentTitleAsPageLabel:e,registerGlobally:t})=>{let n=new ys({useDocumentTitleAsPageLabel:e});return t&&U.setGlobalPageManager(n),n};return Object.defineProperty(e,`DiagLogLevel`,{enumerable:!0,get:function(){return h}}),e.getNavigationInstrumentation=cs,e.initSDK=Ld,e.log=fa,e.page=U,e.session=Ta,e.trace=Na,e.user=Va,e})({});
1
+ "use strict";window.MXLWebSdk=window.MXLWebSdk||(function(exports){Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJSMin=(z,G)=>()=>(G||z((G={exports:{}}).exports,G),G.exports),__copyProps=(z,G,K,J)=>{if(G&&typeof G==`object`||typeof G==`function`)for(var Y=__getOwnPropNames(G),X=0,Z=Y.length,Q;X<Z;X++)Q=Y[X],!__hasOwnProp.call(z,Q)&&Q!==K&&__defProp(z,Q,{get:(z=>G[z]).bind(null,Q),enumerable:!(J=__getOwnPropDesc(G,Q))||J.enumerable});return z},__toESM=(z,G,K)=>(K=z==null?{}:__create(__getProtoOf(z)),__copyProps(G||!z||!z.__esModule?__defProp(K,`default`,{value:z,enumerable:!0}):K,z));const VERSION$10=`1.9.1`,re$1=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function _makeCompatibilityCheck$1(z){let G=new Set([z]),K=new Set,J=z.match(re$1);if(!J)return()=>!1;let Y={major:+J[1],minor:+J[2],patch:+J[3],prerelease:J[4]};if(Y.prerelease!=null)return function(G){return G===z};function X(z){return K.add(z),!1}function Z(z){return G.add(z),!0}return function(z){if(G.has(z))return!0;if(K.has(z))return!1;let J=z.match(re$1);if(!J)return X(z);let Q={major:+J[1],minor:+J[2],patch:+J[3],prerelease:J[4]};return Q.prerelease!=null||Y.major!==Q.major?X(z):Y.major===0?Y.minor===Q.minor&&Y.patch<=Q.patch?Z(z):X(z):Y.minor<=Q.minor?Z(z):X(z)}}const isCompatible$1=_makeCompatibilityCheck$1(VERSION$10),major$1=VERSION$10.split(`.`)[0],GLOBAL_OPENTELEMETRY_API_KEY$1=Symbol.for(`opentelemetry.js.api.${major$1}`),_global$2=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function registerGlobal$1(z,G,K,J=!1){var Y;let X=_global$2[GLOBAL_OPENTELEMETRY_API_KEY$1]=(Y=_global$2[GLOBAL_OPENTELEMETRY_API_KEY$1])==null?{version:VERSION$10}:Y;if(!J&&X[z]){let G=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${z}`);return K.error(G.stack||G.message),!1}if(X.version!==VERSION$10){let G=Error(`@opentelemetry/api: Registration of version v${X.version} for ${z} does not match previously registered API v${VERSION$10}`);return K.error(G.stack||G.message),!1}return X[z]=G,K.debug(`@opentelemetry/api: Registered a global for ${z} v${VERSION$10}.`),!0}function getGlobal$1(z){var G,K;let J=(G=_global$2[GLOBAL_OPENTELEMETRY_API_KEY$1])==null?void 0:G.version;if(!(!J||!isCompatible$1(J)))return(K=_global$2[GLOBAL_OPENTELEMETRY_API_KEY$1])==null?void 0:K[z]}function unregisterGlobal$1(z,G){G.debug(`@opentelemetry/api: Unregistering a global for ${z} v${VERSION$10}.`);let K=_global$2[GLOBAL_OPENTELEMETRY_API_KEY$1];K&&delete K[z]}var DiagComponentLogger$1=class{constructor(z){this._namespace=z.namespace||`DiagComponentLogger`}debug(...z){return logProxy$1(`debug`,this._namespace,z)}error(...z){return logProxy$1(`error`,this._namespace,z)}info(...z){return logProxy$1(`info`,this._namespace,z)}warn(...z){return logProxy$1(`warn`,this._namespace,z)}verbose(...z){return logProxy$1(`verbose`,this._namespace,z)}};function logProxy$1(z,G,K){let J=getGlobal$1(`diag`);if(J)return J[z](G,...K)}var DiagLogLevel;(function(z){z[z.NONE=0]=`NONE`,z[z.ERROR=30]=`ERROR`,z[z.WARN=50]=`WARN`,z[z.INFO=60]=`INFO`,z[z.DEBUG=70]=`DEBUG`,z[z.VERBOSE=80]=`VERBOSE`,z[z.ALL=9999]=`ALL`})(DiagLogLevel||(DiagLogLevel={}));function createLogLevelDiagLogger$1(z,G){z<DiagLogLevel.NONE?z=DiagLogLevel.NONE:z>DiagLogLevel.ALL&&(z=DiagLogLevel.ALL),G=G||{};function K(K,J){let Y=G[K];return typeof Y==`function`&&z>=J?Y.bind(G):function(){}}return{error:K(`error`,DiagLogLevel.ERROR),warn:K(`warn`,DiagLogLevel.WARN),info:K(`info`,DiagLogLevel.INFO),debug:K(`debug`,DiagLogLevel.DEBUG),verbose:K(`verbose`,DiagLogLevel.VERBOSE)}}const API_NAME$4=`diag`;var DiagAPI=class z{static instance(){return this._instance||(this._instance=new z),this._instance}constructor(){function z(z){return function(...G){let K=getGlobal$1(`diag`);if(K)return K[z](...G)}}let G=this;G.setLogger=(z,K={logLevel:DiagLogLevel.INFO})=>{var J,Y,X;if(z===G){let z=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return G.error((J=z.stack)==null?z.message:J),!1}typeof K==`number`&&(K={logLevel:K});let Z=getGlobal$1(`diag`),Q=createLogLevelDiagLogger$1((Y=K.logLevel)==null?DiagLogLevel.INFO:Y,z);if(Z&&!K.suppressOverrideMessage){let z=(X=Error().stack)==null?`<failed to generate stacktrace>`:X;Z.warn(`Current logger will be overwritten from ${z}`),Q.warn(`Current logger will overwrite one already registered from ${z}`)}return registerGlobal$1(`diag`,Q,G,!0)},G.disable=()=>{unregisterGlobal$1(API_NAME$4,G)},G.createComponentLogger=z=>new DiagComponentLogger$1(z),G.verbose=z(`verbose`),G.debug=z(`debug`),G.info=z(`info`),G.warn=z(`warn`),G.error=z(`error`)}},BaggageImpl=class z{constructor(z){this._entries=z?new Map(z):new Map}getEntry(z){let G=this._entries.get(z);if(G)return Object.assign({},G)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(G,K){let J=new z(this._entries);return J._entries.set(G,K),J}removeEntry(G){let K=new z(this._entries);return K._entries.delete(G),K}removeEntries(...G){let K=new z(this._entries);for(let z of G)K._entries.delete(z);return K}clear(){return new z}};const baggageEntryMetadataSymbol=Symbol(`BaggageEntryMetadata`),diag$2=DiagAPI.instance();function createBaggage(z={}){return new BaggageImpl(new Map(Object.entries(z)))}function baggageEntryMetadataFromString(z){return typeof z!=`string`&&(diag$2.error(`Cannot create baggage metadata from unknown type: ${typeof z}`),z=``),{__TYPE__:baggageEntryMetadataSymbol,toString(){return z}}}function createContextKey(z){return Symbol.for(z)}var BaseContext=class z{constructor(G){let K=this;K._currentContext=G?new Map(G):new Map,K.getValue=z=>K._currentContext.get(z),K.setValue=(G,J)=>{let Y=new z(K._currentContext);return Y._currentContext.set(G,J),Y},K.deleteValue=G=>{let J=new z(K._currentContext);return J._currentContext.delete(G),J}}};const ROOT_CONTEXT=new BaseContext,consoleMap=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],_originalConsoleMethods={};if(typeof console<`u`)for(let z of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[z]==`function`&&(_originalConsoleMethods[z]=console[z]);var DiagConsoleLogger=class{constructor(){function z(z){return function(...G){let K=_originalConsoleMethods[z];if(typeof K!=`function`&&(K=_originalConsoleMethods.log),typeof K!=`function`&&console&&(K=console[z],typeof K!=`function`&&(K=console.log)),typeof K==`function`)return K.apply(console,G)}}for(let G=0;G<consoleMap.length;G++)this[consoleMap[G].n]=z(consoleMap[G].c)}},NoopMeter=class{constructor(){}createGauge(z,G){return NOOP_GAUGE_METRIC}createHistogram(z,G){return NOOP_HISTOGRAM_METRIC}createCounter(z,G){return NOOP_COUNTER_METRIC}createUpDownCounter(z,G){return NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(z,G){return NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(z,G){return NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(z,G){return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(z,G){}removeBatchObservableCallback(z){}},NoopMetric=class{},NoopCounterMetric=class extends NoopMetric{add(z,G){}},NoopUpDownCounterMetric=class extends NoopMetric{add(z,G){}},NoopGaugeMetric=class extends NoopMetric{record(z,G){}},NoopHistogramMetric=class extends NoopMetric{record(z,G){}},NoopObservableMetric=class{addCallback(z){}removeCallback(z){}},NoopObservableCounterMetric=class extends NoopObservableMetric{},NoopObservableGaugeMetric=class extends NoopObservableMetric{},NoopObservableUpDownCounterMetric=class extends NoopObservableMetric{};const NOOP_METER=new NoopMeter,NOOP_COUNTER_METRIC=new NoopCounterMetric,NOOP_GAUGE_METRIC=new NoopGaugeMetric,NOOP_HISTOGRAM_METRIC=new NoopHistogramMetric,NOOP_UP_DOWN_COUNTER_METRIC=new NoopUpDownCounterMetric,NOOP_OBSERVABLE_COUNTER_METRIC=new NoopObservableCounterMetric,NOOP_OBSERVABLE_GAUGE_METRIC=new NoopObservableGaugeMetric,NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new NoopObservableUpDownCounterMetric;function createNoopMeter(){return NOOP_METER}const defaultTextMapGetter={get(z,G){if(z!=null)return z[G]},keys(z){return z==null?[]:Object.keys(z)}},defaultTextMapSetter={set(z,G,K){z!=null&&(z[G]=K)}};var NoopContextManager=class{active(){return ROOT_CONTEXT}with(z,G,K,...J){return G.call(K,...J)}bind(z,G){return G}enable(){return this}disable(){return this}};const API_NAME$3=`context`,NOOP_CONTEXT_MANAGER=new NoopContextManager;var ContextAPI=class z{constructor(){}static getInstance(){return this._instance||(this._instance=new z),this._instance}setGlobalContextManager(z){return registerGlobal$1(API_NAME$3,z,DiagAPI.instance())}active(){return this._getContextManager().active()}with(z,G,K,...J){return this._getContextManager().with(z,G,K,...J)}bind(z,G){return this._getContextManager().bind(z,G)}_getContextManager(){return getGlobal$1(API_NAME$3)||NOOP_CONTEXT_MANAGER}disable(){this._getContextManager().disable(),unregisterGlobal$1(API_NAME$3,DiagAPI.instance())}},TraceFlags;(function(z){z[z.NONE=0]=`NONE`,z[z.SAMPLED=1]=`SAMPLED`})(TraceFlags||(TraceFlags={}));const INVALID_SPANID=`0000000000000000`,INVALID_TRACEID=`00000000000000000000000000000000`,INVALID_SPAN_CONTEXT={traceId:INVALID_TRACEID,spanId:INVALID_SPANID,traceFlags:TraceFlags.NONE};var NonRecordingSpan=class{constructor(z=INVALID_SPAN_CONTEXT){this._spanContext=z}spanContext(){return this._spanContext}setAttribute(z,G){return this}setAttributes(z){return this}addEvent(z,G){return this}addLink(z){return this}addLinks(z){return this}setStatus(z){return this}updateName(z){return this}end(z){}isRecording(){return!1}recordException(z,G){}};const SPAN_KEY=createContextKey(`OpenTelemetry Context Key SPAN`);function getSpan(z){return z.getValue(SPAN_KEY)||void 0}function getActiveSpan(){return getSpan(ContextAPI.getInstance().active())}function setSpan(z,G){return z.setValue(SPAN_KEY,G)}function deleteSpan(z){return z.deleteValue(SPAN_KEY)}function setSpanContext(z,G){return setSpan(z,new NonRecordingSpan(G))}function getSpanContext(z){var G;return(G=getSpan(z))==null?void 0:G.spanContext()}const isHex=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function isValidHex(z,G){if(typeof z!=`string`||z.length!==G)return!1;let K=0;for(let G=0;G<z.length;G+=4)K+=(isHex[z.charCodeAt(G)]|0)+(isHex[z.charCodeAt(G+1)]|0)+(isHex[z.charCodeAt(G+2)]|0)+(isHex[z.charCodeAt(G+3)]|0);return K===G}function isValidTraceId(z){return isValidHex(z,32)&&z!==INVALID_TRACEID}function isValidSpanId(z){return isValidHex(z,16)&&z!==INVALID_SPANID}function isSpanContextValid(z){return isValidTraceId(z.traceId)&&isValidSpanId(z.spanId)}function wrapSpanContext(z){return new NonRecordingSpan(z)}const contextApi=ContextAPI.getInstance();var NoopTracer=class{startSpan(z,G,K=contextApi.active()){if(G!=null&&G.root)return new NonRecordingSpan;let J=K&&getSpanContext(K);return isSpanContext(J)&&isSpanContextValid(J)?new NonRecordingSpan(J):new NonRecordingSpan}startActiveSpan(z,G,K,J){let Y,X,Z;if(arguments.length<2)return;arguments.length===2?Z=G:arguments.length===3?(Y=G,Z=K):(Y=G,X=K,Z=J);let Q=X==null?contextApi.active():X,ee=this.startSpan(z,Y,Q),te=setSpan(Q,ee);return contextApi.with(te,Z,void 0,ee)}};function isSpanContext(z){return typeof z==`object`&&!!z&&`spanId`in z&&typeof z.spanId==`string`&&`traceId`in z&&typeof z.traceId==`string`&&`traceFlags`in z&&typeof z.traceFlags==`number`}const NOOP_TRACER=new NoopTracer;var ProxyTracer=class{constructor(z,G,K,J){this._provider=z,this.name=G,this.version=K,this.options=J}startSpan(z,G,K){return this._getTracer().startSpan(z,G,K)}startActiveSpan(z,G,K,J){let Y=this._getTracer();return Reflect.apply(Y.startActiveSpan,Y,arguments)}_getTracer(){if(this._delegate)return this._delegate;let z=this._provider.getDelegateTracer(this.name,this.version,this.options);return z?(this._delegate=z,this._delegate):NOOP_TRACER}},NoopTracerProvider=class{getTracer(z,G,K){return new NoopTracer}};const NOOP_TRACER_PROVIDER=new NoopTracerProvider;var ProxyTracerProvider=class{getTracer(z,G,K){var J;return(J=this.getDelegateTracer(z,G,K))==null?new ProxyTracer(this,z,G,K):J}getDelegate(){var z;return(z=this._delegate)==null?NOOP_TRACER_PROVIDER:z}setDelegate(z){this._delegate=z}getDelegateTracer(z,G,K){var J;return(J=this._delegate)==null?void 0:J.getTracer(z,G,K)}},SamplingDecision$1;(function(z){z[z.NOT_RECORD=0]=`NOT_RECORD`,z[z.RECORD=1]=`RECORD`,z[z.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(SamplingDecision$1||(SamplingDecision$1={}));var SpanKind;(function(z){z[z.INTERNAL=0]=`INTERNAL`,z[z.SERVER=1]=`SERVER`,z[z.CLIENT=2]=`CLIENT`,z[z.PRODUCER=3]=`PRODUCER`,z[z.CONSUMER=4]=`CONSUMER`})(SpanKind||(SpanKind={}));var SpanStatusCode;(function(z){z[z.UNSET=0]=`UNSET`,z[z.OK=1]=`OK`,z[z.ERROR=2]=`ERROR`})(SpanStatusCode||(SpanStatusCode={}));const context=ContextAPI.getInstance(),diag$1=DiagAPI.instance();var NoopMeterProvider=class{getMeter(z,G,K){return NOOP_METER}};const NOOP_METER_PROVIDER=new NoopMeterProvider,API_NAME$2=`metrics`;var MetricsAPI=class z{constructor(){}static getInstance(){return this._instance||(this._instance=new z),this._instance}setGlobalMeterProvider(z){return registerGlobal$1(API_NAME$2,z,DiagAPI.instance())}getMeterProvider(){return getGlobal$1(API_NAME$2)||NOOP_METER_PROVIDER}getMeter(z,G,K){return this.getMeterProvider().getMeter(z,G,K)}disable(){unregisterGlobal$1(API_NAME$2,DiagAPI.instance())}};const metrics=MetricsAPI.getInstance();var NoopTextMapPropagator=class{inject(z,G){}extract(z,G){return z}fields(){return[]}};const BAGGAGE_KEY=createContextKey(`OpenTelemetry Baggage Key`);function getBaggage(z){return z.getValue(BAGGAGE_KEY)||void 0}function getActiveBaggage(){return getBaggage(ContextAPI.getInstance().active())}function setBaggage(z,G){return z.setValue(BAGGAGE_KEY,G)}function deleteBaggage(z){return z.deleteValue(BAGGAGE_KEY)}const API_NAME$1=`propagation`,NOOP_TEXT_MAP_PROPAGATOR=new NoopTextMapPropagator;var PropagationAPI=class z{constructor(){this.createBaggage=createBaggage,this.getBaggage=getBaggage,this.getActiveBaggage=getActiveBaggage,this.setBaggage=setBaggage,this.deleteBaggage=deleteBaggage}static getInstance(){return this._instance||(this._instance=new z),this._instance}setGlobalPropagator(z){return registerGlobal$1(API_NAME$1,z,DiagAPI.instance())}inject(z,G,K=defaultTextMapSetter){return this._getGlobalPropagator().inject(z,G,K)}extract(z,G,K=defaultTextMapGetter){return this._getGlobalPropagator().extract(z,G,K)}fields(){return this._getGlobalPropagator().fields()}disable(){unregisterGlobal$1(API_NAME$1,DiagAPI.instance())}_getGlobalPropagator(){return getGlobal$1(API_NAME$1)||NOOP_TEXT_MAP_PROPAGATOR}};const propagation=PropagationAPI.getInstance(),API_NAME=`trace`;var TraceAPI$1=class z{constructor(){this._proxyTracerProvider=new ProxyTracerProvider,this.wrapSpanContext=wrapSpanContext,this.isSpanContextValid=isSpanContextValid,this.deleteSpan=deleteSpan,this.getSpan=getSpan,this.getActiveSpan=getActiveSpan,this.getSpanContext=getSpanContext,this.setSpan=setSpan,this.setSpanContext=setSpanContext}static getInstance(){return this._instance||(this._instance=new z),this._instance}setGlobalTracerProvider(z){let G=registerGlobal$1(API_NAME,this._proxyTracerProvider,DiagAPI.instance());return G&&this._proxyTracerProvider.setDelegate(z),G}getTracerProvider(){return getGlobal$1(API_NAME)||this._proxyTracerProvider}getTracer(z,G){return this.getTracerProvider().getTracer(z,G)}disable(){unregisterGlobal$1(API_NAME,DiagAPI.instance()),this._proxyTracerProvider=new ProxyTracerProvider}};const trace$1=TraceAPI$1.getInstance(),bulkAddEventListener=({target:z,events:G,callback:K})=>{G.forEach(G=>{z.addEventListener(G,K)})},bulkRemoveEventListener=({target:z,events:G,callback:K})=>{G.forEach(G=>{z.removeEventListener(G,K)})};function createSafeProxy(z,G,K,J=new Set){return new Proxy(z,{get(z,Y,X){let Z=Reflect.get(z,Y,X);return typeof Z!=`function`||J.has(Y)?Z:(...J)=>{try{return Z.apply(z,J)}catch(z){let X=z instanceof Error?z.message:`Unknown error`;K.error(`${String(Y)}: ${X}`);let Z=G[Y];return typeof Z==`function`?Z.apply(G,J):void 0}}}})}const UUID_BYTES=16,BUFFER=new Uint8Array(UUID_BYTES),HEX$1=Array.from({length:256},(z,G)=>G.toString(16).padStart(2,`0`).toUpperCase()),generateUUID=()=>{crypto.getRandomValues(BUFFER);let z=``;for(let G=0;G<UUID_BYTES;G++)z+=HEX$1[BUFFER[G]];return z},getIncrementedCount=(z,G,K)=>{try{let K=z.getItem(G),J=K?parseInt(K,10):0;return J++,z.setItem(G,J.toString()),J}catch(z){return K.warn(`Failed to retrieve ${G} from storage: `,z),1}},KEY_MXL_TYPE=`mxl.type`,KEY_MXL_STATE=`mxl.state`,KEY_MXL_COLD_START=`mxl.cold_start`,KEY_MXL_SESSION_NUMBER=`mxl.session_number`,KEY_MXL_EXCEPTION_NUMBER=`mxl.exception_number`,KEY_MXL_SDK_STARTUP_DURATION=`mxl.sdk_startup_duration`,KEY_PREFIX_MXL_PROPERTIES=`mxl.properties.`,KEY_MXL_SESSION_REASON_ENDED=`mxl.session_end_type`,KEY_MXL_SESSION_REASON_STARTED=`mxl.session_start_type`,KEY_MXL_JS_EXCEPTION_STACKTRACE=`mxl.stacktrace.js`,KEY_MXL_EXCEPTION_HANDLING=`mxl.exception_handling`,KEY_MXL_EXCEPTION_CAUSE=`mxl.exception_cause`,KEY_MXL_ERROR_CODE=`mxl.error_code`,KEY_MXL_APP_INSTANCE_ID=`mxl.app_instance_id`,KEY_MXL_TAB_ID=`mxl.tab_id`,KEY_MXL_SOURCE_TAB_ID=`mxl.source_tab_id`,KEY_MXL_EXPERIENCE_ID=`mxl.experience_id`,KEY_MXL_ERROR_LOG_COUNT=`mxl.error_log_count`,KEY_MXL_INSTRUMENTATION=`mxl.instrumentation`,KEY_MXL_UNHANDLED_EXCEPTIONS_COUNT=`mxl.unhandled_exceptions_count`,KEY_MXL_FROM_STORAGE=`mxl.from_storage`,KEY_MXL_JS_FILE_BUNDLE_IDS=`mxl.js_file_bundle_ids`,KEY_MXL_W3C_TRACEPARENT=`mxl.w3c_traceparent`,KEY_MXL_NAVIGATION_SOURCE=`mxl.navigation_source`,KEY_MXL_REFERRER_URL=`mxl.referrer_url`,KEY_BROWSER_URL_FULL=`browser.url.full`,KEY_MXL_MAX_PENDING_SPANS_REACHED=`mxl.max_pending_spans_reached`,KEY_MXL_PAGE_PATH=`app.surface.name`,KEY_MXL_PAGE_ID=`app.surface.id`,KEY_APP_SURFACE_LABEL=`app.surface.label`;let MXL_TYPES=function(z){return z.Session=`ux.session`,z.Network=`perf.network_request`,z.Perf=`perf`,z.SystemLog=`sys.log`,z.SystemException=`sys.exception`,z.WebVital=`ux.web_vital`,z.ResourceFetch=`ux.resource_fetch`,z.DocumentLoad=`ux.document_load`,z.Surface=`ux.surface`,z}({}),MXL_STATES=function(z){return z.Foreground=`foreground`,z.Background=`background`,z}({}),MXL_NAVIGATION_INSTRUMENTATIONS=function(z){return z.DeclarativeLegacy=`react_router_declarative_legacy`,z.Declarative=`react_router_declarative`,z.Data=`react_router_data`,z.Manual=`manual`,z}({});const getVisibilityState=z=>z.visibilityState===`hidden`?MXL_STATES.Background:MXL_STATES.Foreground,GLOBAL_CONFIG=globalThis,DIGITS=6,isDeviceIdEnabled=(z,G)=>!G||G<=0||G>100?!1:G>=getNormalizedDeviceId(z),getNormalizedDeviceId=z=>{if(z.length<DIGITS)return 0;let G=z.slice(-DIGITS),K=16,J=Math.pow(16,DIGITS)-1;return parseInt(G,16)/J*100},SUPPRESS_TRACING_KEY$3=createContextKey(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function suppressTracing$3(z){return z.setValue(SUPPRESS_TRACING_KEY$3,!0)}function isTracingSuppressed$1(z){return z.getValue(SUPPRESS_TRACING_KEY$3)===!0}function _typeof(z){"@babel/helpers - typeof";return _typeof=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(z){return typeof z}:function(z){return z&&typeof Symbol==`function`&&z.constructor===Symbol&&z!==Symbol.prototype?`symbol`:typeof z},_typeof(z)}function toPrimitive(z,G){if(_typeof(z)!=`object`||!z)return z;var K=z[Symbol.toPrimitive];if(K!==void 0){var J=K.call(z,G||`default`);if(_typeof(J)!=`object`)return J;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(G===`string`?String:Number)(z)}function toPropertyKey(z){var G=toPrimitive(z,`string`);return _typeof(G)==`symbol`?G:G+``}function _defineProperty(z,G,K){return(G=toPropertyKey(G))in z?Object.defineProperty(z,G,{value:K,enumerable:!0,configurable:!0,writable:!0}):z[G]=K,z}const TMP_HTTP_METHOD=`http.method`,TMP_HTTP_URL=`http.url`,TMP_HTTP_STATUS_CODE=`http.status_code`,TMP_HTTP_REQUEST_CONTENT_LENGTH=`http.request_content_length`,TMP_HTTP_RESPONSE_CONTENT_LENGTH=`http.response_content_length`,SEMATTRS_HTTP_METHOD=TMP_HTTP_METHOD,SEMATTRS_HTTP_URL=TMP_HTTP_URL,SEMATTRS_HTTP_STATUS_CODE=TMP_HTTP_STATUS_CODE,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH=TMP_HTTP_REQUEST_CONTENT_LENGTH,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH=TMP_HTTP_RESPONSE_CONTENT_LENGTH,ATTR_ERROR_TYPE=`error.type`,ATTR_EXCEPTION_MESSAGE=`exception.message`,ATTR_EXCEPTION_STACKTRACE=`exception.stacktrace`,ATTR_EXCEPTION_TYPE=`exception.type`,ATTR_HTTP_REQUEST_METHOD=`http.request.method`,ATTR_HTTP_REQUEST_METHOD_ORIGINAL=`http.request.method_original`,ATTR_HTTP_RESPONSE_STATUS_CODE=`http.response.status_code`,ATTR_SERVER_ADDRESS=`server.address`,ATTR_SERVER_PORT=`server.port`,ATTR_SERVICE_NAME=`service.name`,ATTR_TELEMETRY_SDK_LANGUAGE=`telemetry.sdk.language`,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS=`webjs`,ATTR_TELEMETRY_SDK_NAME=`telemetry.sdk.name`,ATTR_TELEMETRY_SDK_VERSION=`telemetry.sdk.version`,ATTR_URL_FULL=`url.full`,ATTR_URL_PATH=`url.path`,ATTR_URL_QUERY=`url.query`,ATTR_USER_AGENT_ORIGINAL=`user_agent.original`,NANOSECOND_DIGITS$4=9,MILLISECONDS_TO_NANOSECONDS$4=Math.pow(10,6),SECOND_TO_NANOSECONDS$5=Math.pow(10,NANOSECOND_DIGITS$4);function millisToHrTime$4(z){let G=z/1e3;return[Math.trunc(G),Math.round(z%1e3*MILLISECONDS_TO_NANOSECONDS$4)]}function hrTimeToMilliseconds(z){return z[0]*1e3+z[1]/1e6}var ExportResultCode$3;(function(z){z[z.SUCCESS=0]=`SUCCESS`,z[z.FAILED=1]=`FAILED`})(ExportResultCode$3||(ExportResultCode$3={}));const VALID_KEY_CHAR_RANGE$1=`[_0-9a-z-*/]`,VALID_KEY$1=`[a-z]${VALID_KEY_CHAR_RANGE$1}{0,255}`,VALID_VENDOR_KEY$1=`[a-z0-9]${VALID_KEY_CHAR_RANGE$1}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE$1}{0,13}`,VALID_KEY_REGEX$1=RegExp(`^(?:${VALID_KEY$1}|${VALID_VENDOR_KEY$1})$`),VALID_VALUE_BASE_REGEX$1=/^[ -~]{0,255}[!-~]$/,INVALID_VALUE_COMMA_EQUAL_REGEX$1=/,|=/;function validateKey$1(z){return VALID_KEY_REGEX$1.test(z)}function validateValue$1(z){return VALID_VALUE_BASE_REGEX$1.test(z)&&!INVALID_VALUE_COMMA_EQUAL_REGEX$1.test(z)}const MAX_TRACE_STATE_ITEMS$1=32,MAX_TRACE_STATE_LEN$1=512,LIST_MEMBERS_SEPARATOR$1=`,`,LIST_MEMBER_KEY_VALUE_SPLITTER$1=`=`;var TraceState$1=class z{constructor(z){_defineProperty(this,`_internalState`,new Map),z&&this._parse(z)}set(z,G){let K=this._clone();return K._internalState.has(z)&&K._internalState.delete(z),K._internalState.set(z,G),K}unset(z){let G=this._clone();return G._internalState.delete(z),G}get(z){return this._internalState.get(z)}serialize(){return this._keys().reduce((z,G)=>(z.push(G+LIST_MEMBER_KEY_VALUE_SPLITTER$1+this.get(G)),z),[]).join(LIST_MEMBERS_SEPARATOR$1)}_parse(z){z.length>MAX_TRACE_STATE_LEN$1||(this._internalState=z.split(LIST_MEMBERS_SEPARATOR$1).reverse().reduce((z,G)=>{let K=G.trim(),J=K.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER$1);if(J!==-1){let Y=K.slice(0,J),X=K.slice(J+1,G.length);validateKey$1(Y)&&validateValue$1(X)&&z.set(Y,X)}return z},new Map),this._internalState.size>MAX_TRACE_STATE_ITEMS$1&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,MAX_TRACE_STATE_ITEMS$1))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let G=new z;return G._internalState=new Map(this._internalState),G}};const TRACE_PARENT_HEADER$1=`traceparent`,TRACE_STATE_HEADER$1=`tracestate`,VERSION$9=`00`,TRACE_PARENT_REGEX$1=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function parseTraceParent$1(z){let G=TRACE_PARENT_REGEX$1.exec(z);return!G||G[1]===`00`&&G[5]?null:{traceId:G[2],spanId:G[3],traceFlags:parseInt(G[4],16)}}var W3CTraceContextPropagator$1=class{inject(z,G,K){let J=trace$1.getSpanContext(z);if(!J||isTracingSuppressed$1(z)||!isSpanContextValid(J))return;let Y=`${VERSION$9}-${J.traceId}-${J.spanId}-0${Number(J.traceFlags||TraceFlags.NONE).toString(16)}`;K.set(G,TRACE_PARENT_HEADER$1,Y),J.traceState&&K.set(G,TRACE_STATE_HEADER$1,J.traceState.serialize())}extract(z,G,K){let J=K.get(G,TRACE_PARENT_HEADER$1);if(!J)return z;let Y=Array.isArray(J)?J[0]:J;if(typeof Y!=`string`)return z;let X=parseTraceParent$1(Y);if(!X)return z;X.isRemote=!0;let Z=K.get(G,TRACE_STATE_HEADER$1);if(Z){let z=Array.isArray(Z)?Z.join(`,`):Z;X.traceState=new TraceState$1(typeof z==`string`?z:void 0)}return trace$1.setSpanContext(z,X)}fields(){return[TRACE_PARENT_HEADER$1,TRACE_STATE_HEADER$1]}},Deferred$2=class{constructor(){_defineProperty(this,`_promise`,void 0),_defineProperty(this,`_resolve`,void 0),_defineProperty(this,`_reject`,void 0),this._promise=new Promise((z,G)=>{this._resolve=z,this._reject=G})}get promise(){return this._promise}resolve(z){this._resolve(z)}reject(z){this._reject(z)}},BindOnceFuture$2=class{constructor(z,G){_defineProperty(this,`_isCalled`,!1),_defineProperty(this,`_deferred`,new Deferred$2),_defineProperty(this,`_callback`,void 0),_defineProperty(this,`_that`,void 0),this._callback=z,this._that=G}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...z){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...z)).then(z=>this._deferred.resolve(z),z=>this._deferred.reject(z))}catch(z){this._deferred.reject(z)}}return this._deferred.promise}};function _export(z,G){return new Promise(K=>{context.with(suppressTracing$3(context.active()),()=>{z.export(G,K)})})}const internal={_export},isPromiseLike$2=z=>typeof z==`object`&&!!z&&typeof z.then==`function`;function asyncGeneratorStep(z,G,K,J,Y,X,Z){try{var Q=z[X](Z),ee=Q.value}catch(z){K(z);return}Q.done?G(ee):Promise.resolve(ee).then(J,Y)}function _asyncToGenerator(z){return function(){var G=this,K=arguments;return new Promise(function(J,Y){var X=z.apply(G,K);function Z(z){asyncGeneratorStep(X,J,Y,Z,Q,`next`,z)}function Q(z){asyncGeneratorStep(X,J,Y,Z,Q,`throw`,z)}Z(void 0)})}}var ResourceImpl$2=class z{static FromAttributeList(G,K){let J=new z({},K);return J._rawAttributes=guardedRawAttributes$2(G),J._asyncAttributesPending=G.filter(([z,G])=>isPromiseLike$2(G)).length>0,J}constructor(z,G){var K;_defineProperty(this,`_rawAttributes`,void 0),_defineProperty(this,`_asyncAttributesPending`,!1),_defineProperty(this,`_schemaUrl`,void 0),_defineProperty(this,`_memoizedAttributes`,void 0);let J=(K=z.attributes)==null?{}:K;this._rawAttributes=Object.entries(J).map(([z,G])=>(isPromiseLike$2(G)&&(this._asyncAttributesPending=!0),[z,G])),this._rawAttributes=guardedRawAttributes$2(this._rawAttributes),this._schemaUrl=validateSchemaUrl$2(G==null?void 0:G.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var z=this;return _asyncToGenerator(function*(){if(z.asyncAttributesPending){for(let G=0;G<z._rawAttributes.length;G++){let[K,J]=z._rawAttributes[G];z._rawAttributes[G]=[K,isPromiseLike$2(J)?yield J:J]}z._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&diag$1.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let z={};for(let[K,J]of this._rawAttributes){if(isPromiseLike$2(J)){diag$1.debug(`Unsettled resource attribute ${K} skipped`);continue}if(J!=null){var G;z[K]!=null||(z[K]=J)}}return this._asyncAttributesPending||(this._memoizedAttributes=z),z}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(G){if(G==null)return this;let K=mergeSchemaUrl$2(this,G),J=K?{schemaUrl:K}:void 0;return z.FromAttributeList([...G.getRawAttributes(),...this.getRawAttributes()],J)}};function resourceFromAttributes$2(z,G){return ResourceImpl$2.FromAttributeList(Object.entries(z),G)}function emptyResource(){return resourceFromAttributes$2({})}function guardedRawAttributes$2(z){return z.map(([z,G])=>isPromiseLike$2(G)?[z,G.catch(G=>{diag$1.debug(`promise rejection for resource attribute: %s - %s`,z,G)})]:[z,G])}function validateSchemaUrl$2(z){if(typeof z==`string`||z===void 0)return z;diag$1.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,z)}function mergeSchemaUrl$2(z,G){let K=z==null?void 0:z.schemaUrl,J=G==null?void 0:G.schemaUrl,Y=K===void 0||K===``,X=J===void 0||J===``;if(Y)return J;if(X||K===J)return K;diag$1.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,K,J)}const SUPPRESS_TRACING_KEY$2=createContextKey(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function suppressTracing$2(z){return z.setValue(SUPPRESS_TRACING_KEY$2,!0)}function isTracingSuppressed(z){return z.getValue(SUPPRESS_TRACING_KEY$2)===!0}const BAGGAGE_KEY_PAIR_SEPARATOR=`=`,BAGGAGE_PROPERTIES_SEPARATOR=`;`,BAGGAGE_ITEMS_SEPARATOR=`,`,BAGGAGE_HEADER=`baggage`,BAGGAGE_MAX_NAME_VALUE_PAIRS=180,BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,BAGGAGE_MAX_TOTAL_LENGTH=8192;function serializeKeyPairs(z){return z.reduce((z,G)=>{let K=`${z}${z===``?``:BAGGAGE_ITEMS_SEPARATOR}${G}`;return K.length>BAGGAGE_MAX_TOTAL_LENGTH?z:K},``)}function getKeyPairs(z){return z.getAllEntries().map(([z,G])=>{let K=`${encodeURIComponent(z)}=${encodeURIComponent(G.value)}`;return G.metadata!==void 0&&(K+=BAGGAGE_PROPERTIES_SEPARATOR+G.metadata.toString()),K})}function parsePairKeyValue(z){if(!z)return;let G=z.indexOf(BAGGAGE_PROPERTIES_SEPARATOR),K=G===-1?z:z.substring(0,G),J=K.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);if(J<=0)return;let Y=K.substring(0,J).trim(),X=K.substring(J+1).trim();if(!Y||!X)return;let Z,Q;try{Z=decodeURIComponent(Y),Q=decodeURIComponent(X)}catch(z){return}let ee;return G!==-1&&G<z.length-1&&(ee=baggageEntryMetadataFromString(z.substring(G+1))),{key:Z,value:Q,metadata:ee}}var W3CBaggagePropagator=class{inject(z,G,K){let J=propagation.getBaggage(z);if(!J||isTracingSuppressed(z))return;let Y=serializeKeyPairs(getKeyPairs(J).filter(z=>z.length<=BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,BAGGAGE_MAX_NAME_VALUE_PAIRS));Y.length>0&&K.set(G,BAGGAGE_HEADER,Y)}extract(z,G,K){let J=K.get(G,BAGGAGE_HEADER),Y=Array.isArray(J)?J.join(BAGGAGE_ITEMS_SEPARATOR):J;if(!Y)return z;let X={};return Y.length===0||(Y.split(BAGGAGE_ITEMS_SEPARATOR).forEach(z=>{let G=parsePairKeyValue(z);if(G){let z={value:G.value};G.metadata&&(z.metadata=G.metadata),X[G.key]=z}}),Object.entries(X).length===0)?z:propagation.setBaggage(z,propagation.createBaggage(X))}fields(){return[BAGGAGE_HEADER]}};function sanitizeAttributes(z){let G={};if(typeof z!=`object`||!z)return G;for(let K in z){if(!Object.prototype.hasOwnProperty.call(z,K))continue;if(!isAttributeKey(K)){diag$1.warn(`Invalid attribute key: ${K}`);continue}let J=z[K];if(!isAttributeValue(J)){diag$1.warn(`Invalid attribute value set for key: ${K}`);continue}Array.isArray(J)?G[K]=J.slice():G[K]=J}return G}function isAttributeKey(z){return typeof z==`string`&&z!==``}function isAttributeValue(z){return z==null?!0:Array.isArray(z)?isHomogeneousAttributeValueArray(z):isValidPrimitiveAttributeValueType(typeof z)}function isHomogeneousAttributeValueArray(z){let G;for(let K of z){if(K==null)continue;let z=typeof K;if(z!==G){if(!G){if(isValidPrimitiveAttributeValueType(z)){G=z;continue}return!1}return!1}}return!0}function isValidPrimitiveAttributeValueType(z){switch(z){case`number`:case`boolean`:case`string`:return!0}return!1}function loggingErrorHandler$1(){return z=>{diag$1.error(stringifyException$1(z))}}function stringifyException$1(z){return typeof z==`string`?z:JSON.stringify(flattenException$1(z))}function flattenException$1(z){let G={},K=z;for(;K!==null;)Object.getOwnPropertyNames(K).forEach(z=>{if(G[z])return;let J=K[z];J&&(G[z]=String(J))}),K=Object.getPrototypeOf(K);return G}let delegateHandler$1=loggingErrorHandler$1();function globalErrorHandler$1(z){try{delegateHandler$1(z)}catch(z){}}function getStringFromEnv(z){}function getNumberFromEnv(z){}const VERSION$8=`2.7.0`,ATTR_PROCESS_RUNTIME_NAME$1=`process.runtime.name`,SDK_INFO$1={[ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[ATTR_PROCESS_RUNTIME_NAME$1]:`browser`,[ATTR_TELEMETRY_SDK_LANGUAGE]:TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS,[ATTR_TELEMETRY_SDK_VERSION]:VERSION$8},otperformance$3=performance,NANOSECOND_DIGITS$3=9,MILLISECONDS_TO_NANOSECONDS$3=Math.pow(10,6),SECOND_TO_NANOSECONDS$4=Math.pow(10,NANOSECOND_DIGITS$3);function millisToHrTime$3(z){let G=z/1e3;return[Math.trunc(G),Math.round(z%1e3*MILLISECONDS_TO_NANOSECONDS$3)]}function hrTime$3(z){return addHrTimes$3(millisToHrTime$3(otperformance$3.timeOrigin),millisToHrTime$3(typeof z==`number`?z:otperformance$3.now()))}function timeInputToHrTime$1(z){if(isTimeInputHrTime$1(z))return z;if(typeof z==`number`)return z<otperformance$3.timeOrigin?hrTime$3(z):millisToHrTime$3(z);if(z instanceof Date)return millisToHrTime$3(z.getTime());throw TypeError(`Invalid input type`)}function hrTimeDuration(z,G){let K=G[0]-z[0],J=G[1]-z[1];return J<0&&(--K,J+=SECOND_TO_NANOSECONDS$4),[K,J]}function hrTimeToNanoseconds$1(z){return z[0]*SECOND_TO_NANOSECONDS$4+z[1]}function isTimeInputHrTime$1(z){return Array.isArray(z)&&z.length===2&&typeof z[0]==`number`&&typeof z[1]==`number`}function isTimeInput(z){return isTimeInputHrTime$1(z)||typeof z==`number`||z instanceof Date}function addHrTimes$3(z,G){let K=[z[0]+G[0],z[1]+G[1]];return K[1]>=SECOND_TO_NANOSECONDS$4&&(K[1]-=SECOND_TO_NANOSECONDS$4,K[0]+=1),K}var ExportResultCode$2;(function(z){z[z.SUCCESS=0]=`SUCCESS`,z[z.FAILED=1]=`FAILED`})(ExportResultCode$2||(ExportResultCode$2={}));var CompositePropagator=class{constructor(z={}){var G;_defineProperty(this,`_propagators`,void 0),_defineProperty(this,`_fields`,void 0),this._propagators=(G=z.propagators)==null?[]:G,this._fields=Array.from(new Set(this._propagators.map(z=>typeof z.fields==`function`?z.fields():[]).reduce((z,G)=>z.concat(G),[])))}inject(z,G,K){for(let J of this._propagators)try{J.inject(z,G,K)}catch(z){diag$1.warn(`Failed to inject with ${J.constructor.name}. Err: ${z.message}`)}}extract(z,G,K){return this._propagators.reduce((z,J)=>{try{return J.extract(z,G,K)}catch(z){diag$1.warn(`Failed to extract with ${J.constructor.name}. Err: ${z.message}`)}return z},z)}fields(){return this._fields.slice()}};const VALID_KEY_CHAR_RANGE=`[_0-9a-z-*/]`,VALID_KEY=`[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`,VALID_VENDOR_KEY=`[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`,VALID_KEY_REGEX=RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`),VALID_VALUE_BASE_REGEX=/^[ -~]{0,255}[!-~]$/,INVALID_VALUE_COMMA_EQUAL_REGEX=/,|=/;function validateKey(z){return VALID_KEY_REGEX.test(z)}function validateValue(z){return VALID_VALUE_BASE_REGEX.test(z)&&!INVALID_VALUE_COMMA_EQUAL_REGEX.test(z)}const MAX_TRACE_STATE_ITEMS=32,MAX_TRACE_STATE_LEN=512,LIST_MEMBERS_SEPARATOR=`,`,LIST_MEMBER_KEY_VALUE_SPLITTER=`=`;var TraceState=class z{constructor(z){_defineProperty(this,`_internalState`,new Map),z&&this._parse(z)}set(z,G){let K=this._clone();return K._internalState.has(z)&&K._internalState.delete(z),K._internalState.set(z,G),K}unset(z){let G=this._clone();return G._internalState.delete(z),G}get(z){return this._internalState.get(z)}serialize(){return this._keys().reduce((z,G)=>(z.push(G+LIST_MEMBER_KEY_VALUE_SPLITTER+this.get(G)),z),[]).join(LIST_MEMBERS_SEPARATOR)}_parse(z){z.length>MAX_TRACE_STATE_LEN||(this._internalState=z.split(LIST_MEMBERS_SEPARATOR).reverse().reduce((z,G)=>{let K=G.trim(),J=K.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);if(J!==-1){let Y=K.slice(0,J),X=K.slice(J+1,G.length);validateKey(Y)&&validateValue(X)&&z.set(Y,X)}return z},new Map),this._internalState.size>MAX_TRACE_STATE_ITEMS&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,MAX_TRACE_STATE_ITEMS))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let G=new z;return G._internalState=new Map(this._internalState),G}};const TRACE_PARENT_HEADER=`traceparent`,TRACE_STATE_HEADER=`tracestate`,VERSION$7=`00`,TRACE_PARENT_REGEX=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function parseTraceParent(z){let G=TRACE_PARENT_REGEX.exec(z);return!G||G[1]===`00`&&G[5]?null:{traceId:G[2],spanId:G[3],traceFlags:parseInt(G[4],16)}}var W3CTraceContextPropagator=class{inject(z,G,K){let J=trace$1.getSpanContext(z);if(!J||isTracingSuppressed(z)||!isSpanContextValid(J))return;let Y=`${VERSION$7}-${J.traceId}-${J.spanId}-0${Number(J.traceFlags||TraceFlags.NONE).toString(16)}`;K.set(G,TRACE_PARENT_HEADER,Y),J.traceState&&K.set(G,TRACE_STATE_HEADER,J.traceState.serialize())}extract(z,G,K){let J=K.get(G,TRACE_PARENT_HEADER);if(!J)return z;let Y=Array.isArray(J)?J[0]:J;if(typeof Y!=`string`)return z;let X=parseTraceParent(Y);if(!X)return z;X.isRemote=!0;let Z=K.get(G,TRACE_STATE_HEADER);if(Z){let z=Array.isArray(Z)?Z.join(`,`):Z;X.traceState=new TraceState(typeof z==`string`?z:void 0)}return trace$1.setSpanContext(z,X)}fields(){return[TRACE_PARENT_HEADER,TRACE_STATE_HEADER]}};const objectTag=`[object Object]`,nullTag=`[object Null]`,undefinedTag=`[object Undefined]`,funcToString=Function.prototype.toString,objectCtorString=funcToString.call(Object),getPrototypeOf=Object.getPrototypeOf,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,symToStringTag=Symbol?Symbol.toStringTag:void 0,nativeObjectToString=objectProto.toString;function isPlainObject(z){if(!isObjectLike(z)||baseGetTag(z)!==objectTag)return!1;let G=getPrototypeOf(z);if(G===null)return!0;let K=hasOwnProperty.call(G,`constructor`)&&G.constructor;return typeof K==`function`&&K instanceof K&&funcToString.call(K)===objectCtorString}function isObjectLike(z){return typeof z==`object`&&!!z}function baseGetTag(z){return z==null?z===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(z)?getRawTag(z):objectToString(z)}function getRawTag(z){let G=hasOwnProperty.call(z,symToStringTag),K=z[symToStringTag],J=!1;try{z[symToStringTag]=void 0,J=!0}catch(z){}let Y=nativeObjectToString.call(z);return J&&(G?z[symToStringTag]=K:delete z[symToStringTag]),Y}function objectToString(z){return nativeObjectToString.call(z)}const MAX_LEVEL=20;function merge(...z){let G=z.shift(),K=new WeakMap;for(;z.length>0;)G=mergeTwoObjects(G,z.shift(),0,K);return G}function takeValue(z){return isArray$1(z)?z.slice():z}function mergeTwoObjects(z,G,K=0,J){let Y;if(!(K>MAX_LEVEL)){if(K++,isPrimitive(z)||isPrimitive(G)||isFunction(G))Y=takeValue(G);else if(isArray$1(z)){if(Y=z.slice(),isArray$1(G))for(let z=0,K=G.length;z<K;z++)Y.push(takeValue(G[z]));else if(isObject$1(G)){let z=Object.keys(G);for(let K=0,J=z.length;K<J;K++){let J=z[K];J===`__proto__`||J===`constructor`||J===`prototype`||(Y[J]=takeValue(G[J]))}}}else if(isObject$1(z))if(isObject$1(G)){if(!shouldMerge(z,G))return G;Y=Object.assign({},z);let X=Object.keys(G);for(let Z=0,Q=X.length;Z<Q;Z++){let Q=X[Z];if(Q===`__proto__`||Q===`constructor`||Q===`prototype`)continue;let ee=G[Q];if(isPrimitive(ee))ee===void 0?delete Y[Q]:Y[Q]=ee;else{let X=Y[Q],Z=ee;if(wasObjectReferenced(z,Q,J)||wasObjectReferenced(G,Q,J))delete Y[Q];else{if(isObject$1(X)&&isObject$1(Z)){let K=J.get(X)||[],Y=J.get(Z)||[];K.push({obj:z,key:Q}),Y.push({obj:G,key:Q}),J.set(X,K),J.set(Z,Y)}Y[Q]=mergeTwoObjects(Y[Q],ee,K,J)}}}}else Y=G;return Y}}function wasObjectReferenced(z,G,K){let J=K.get(z[G])||[];for(let K=0,Y=J.length;K<Y;K++){let Y=J[K];if(Y.key===G&&Y.obj===z)return!0}return!1}function isArray$1(z){return Array.isArray(z)}function isFunction(z){return typeof z==`function`}function isObject$1(z){return!isPrimitive(z)&&!isArray$1(z)&&!isFunction(z)&&typeof z==`object`}function isPrimitive(z){return typeof z==`string`||typeof z==`number`||typeof z==`boolean`||z===void 0||z instanceof Date||z instanceof RegExp||z===null}function shouldMerge(z,G){return!(!isPlainObject(z)||!isPlainObject(G))}function urlMatches$2(z,G){return typeof G==`string`?z===G:!!z.match(G)}var Deferred$1=class{constructor(){_defineProperty(this,`_promise`,void 0),_defineProperty(this,`_resolve`,void 0),_defineProperty(this,`_reject`,void 0),this._promise=new Promise((z,G)=>{this._resolve=z,this._reject=G})}get promise(){return this._promise}resolve(z){this._resolve(z)}reject(z){this._reject(z)}},BindOnceFuture$1=class{constructor(z,G){_defineProperty(this,`_isCalled`,!1),_defineProperty(this,`_deferred`,new Deferred$1),_defineProperty(this,`_callback`,void 0),_defineProperty(this,`_that`,void 0),this._callback=z,this._that=G}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...z){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...z)).then(z=>this._deferred.resolve(z),z=>this._deferred.reject(z))}catch(z){this._deferred.reject(z)}}return this._deferred.promise}};let serviceName$1;function defaultServiceName$1(){if(serviceName$1===void 0)try{let z=globalThis.process.argv0;serviceName$1=z?`unknown_service:${z}`:`unknown_service`}catch(z){serviceName$1=`unknown_service`}return serviceName$1}const isPromiseLike$1=z=>typeof z==`object`&&!!z&&typeof z.then==`function`;var ResourceImpl$1=class z{static FromAttributeList(G,K){let J=new z({},K);return J._rawAttributes=guardedRawAttributes$1(G),J._asyncAttributesPending=G.filter(([z,G])=>isPromiseLike$1(G)).length>0,J}constructor(z,G){var K;_defineProperty(this,`_rawAttributes`,void 0),_defineProperty(this,`_asyncAttributesPending`,!1),_defineProperty(this,`_schemaUrl`,void 0),_defineProperty(this,`_memoizedAttributes`,void 0);let J=(K=z.attributes)==null?{}:K;this._rawAttributes=Object.entries(J).map(([z,G])=>(isPromiseLike$1(G)&&(this._asyncAttributesPending=!0),[z,G])),this._rawAttributes=guardedRawAttributes$1(this._rawAttributes),this._schemaUrl=validateSchemaUrl$1(G==null?void 0:G.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var z=this;return _asyncToGenerator(function*(){if(z.asyncAttributesPending){for(let G=0;G<z._rawAttributes.length;G++){let[K,J]=z._rawAttributes[G];z._rawAttributes[G]=[K,isPromiseLike$1(J)?yield J:J]}z._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&diag$1.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let z={};for(let[K,J]of this._rawAttributes){if(isPromiseLike$1(J)){diag$1.debug(`Unsettled resource attribute ${K} skipped`);continue}if(J!=null){var G;z[K]!=null||(z[K]=J)}}return this._asyncAttributesPending||(this._memoizedAttributes=z),z}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(G){if(G==null)return this;let K=mergeSchemaUrl$1(this,G),J=K?{schemaUrl:K}:void 0;return z.FromAttributeList([...G.getRawAttributes(),...this.getRawAttributes()],J)}};function resourceFromAttributes$1(z,G){return ResourceImpl$1.FromAttributeList(Object.entries(z),G)}function defaultResource$1(){return resourceFromAttributes$1({[ATTR_SERVICE_NAME]:defaultServiceName$1(),[ATTR_TELEMETRY_SDK_LANGUAGE]:SDK_INFO$1[ATTR_TELEMETRY_SDK_LANGUAGE],[ATTR_TELEMETRY_SDK_NAME]:SDK_INFO$1[ATTR_TELEMETRY_SDK_NAME],[ATTR_TELEMETRY_SDK_VERSION]:SDK_INFO$1[ATTR_TELEMETRY_SDK_VERSION]})}function guardedRawAttributes$1(z){return z.map(([z,G])=>isPromiseLike$1(G)?[z,G.catch(G=>{diag$1.debug(`promise rejection for resource attribute: %s - %s`,z,G)})]:[z,G])}function validateSchemaUrl$1(z){if(typeof z==`string`||z===void 0)return z;diag$1.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,z)}function mergeSchemaUrl$1(z,G){let K=z==null?void 0:z.schemaUrl,J=G==null?void 0:G.schemaUrl,Y=K===void 0||K===``,X=J===void 0||J===``;if(Y)return J;if(X||K===J)return K;diag$1.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,K,J)}const ExceptionEventName=`exception`;var SpanImpl=class{constructor(z){var G,K;_defineProperty(this,`_spanContext`,void 0),_defineProperty(this,`kind`,void 0),_defineProperty(this,`parentSpanContext`,void 0),_defineProperty(this,`attributes`,{}),_defineProperty(this,`links`,[]),_defineProperty(this,`events`,[]),_defineProperty(this,`startTime`,void 0),_defineProperty(this,`resource`,void 0),_defineProperty(this,`instrumentationScope`,void 0),_defineProperty(this,`_droppedAttributesCount`,0),_defineProperty(this,`_droppedEventsCount`,0),_defineProperty(this,`_droppedLinksCount`,0),_defineProperty(this,`_attributesCount`,0),_defineProperty(this,`name`,void 0),_defineProperty(this,`status`,{code:SpanStatusCode.UNSET}),_defineProperty(this,`endTime`,[0,0]),_defineProperty(this,`_ended`,!1),_defineProperty(this,`_duration`,[-1,-1]),_defineProperty(this,`_spanProcessor`,void 0),_defineProperty(this,`_spanLimits`,void 0),_defineProperty(this,`_attributeValueLengthLimit`,void 0),_defineProperty(this,`_recordEndMetrics`,void 0),_defineProperty(this,`_performanceStartTime`,void 0),_defineProperty(this,`_performanceOffset`,void 0),_defineProperty(this,`_startTimeProvided`,void 0);let J=Date.now();if(this._spanContext=z.spanContext,this._performanceStartTime=otperformance$3.now(),this._performanceOffset=J-(this._performanceStartTime+otperformance$3.timeOrigin),this._startTimeProvided=z.startTime!=null,this._spanLimits=z.spanLimits,this._attributeValueLengthLimit=(G=this._spanLimits.attributeValueLengthLimit)==null?0:G,this._spanProcessor=z.spanProcessor,this.name=z.name,this.parentSpanContext=z.parentSpanContext,this.kind=z.kind,z.links)for(let G of z.links)this.addLink(G);this.startTime=this._getTime((K=z.startTime)==null?J:K),this.resource=z.resource,this.instrumentationScope=z.scope,this._recordEndMetrics=z.recordEndMetrics,z.attributes!=null&&this.setAttributes(z.attributes),this._spanProcessor.onStart(this,z.context)}spanContext(){return this._spanContext}setAttribute(z,G){if(G==null||this._isSpanEnded())return this;if(z.length===0)return diag$1.warn(`Invalid attribute key: ${z}`),this;if(!isAttributeValue(G))return diag$1.warn(`Invalid attribute value set for key: ${z}`),this;let{attributeCountLimit:K}=this._spanLimits,J=!Object.prototype.hasOwnProperty.call(this.attributes,z);return K!==void 0&&this._attributesCount>=K&&J?(this._droppedAttributesCount++,this):(this.attributes[z]=this._truncateToSize(G),J&&this._attributesCount++,this)}setAttributes(z){for(let G in z)Object.prototype.hasOwnProperty.call(z,G)&&this.setAttribute(G,z[G]);return this}addEvent(z,G,K){if(this._isSpanEnded())return this;let{eventCountLimit:J}=this._spanLimits;if(J===0)return diag$1.warn(`No events allowed.`),this._droppedEventsCount++,this;J!==void 0&&this.events.length>=J&&(this._droppedEventsCount===0&&diag$1.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),isTimeInput(G)&&(isTimeInput(K)||(K=G),G=void 0);let Y=sanitizeAttributes(G),{attributePerEventCountLimit:X}=this._spanLimits,Z={},Q=0,ee=0;for(let z in Y){if(!Object.prototype.hasOwnProperty.call(Y,z))continue;let G=Y[z];if(X!==void 0&&ee>=X){Q++;continue}Z[z]=this._truncateToSize(G),ee++}return this.events.push({name:z,attributes:Z,time:this._getTime(K),droppedAttributesCount:Q}),this}addLink(z){if(this._isSpanEnded())return this;let{linkCountLimit:G}=this._spanLimits;if(G===0)return this._droppedLinksCount++,this;G!==void 0&&this.links.length>=G&&(this._droppedLinksCount===0&&diag$1.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:K}=this._spanLimits,J=sanitizeAttributes(z.attributes),Y={},X=0,Z=0;for(let z in J){if(!Object.prototype.hasOwnProperty.call(J,z))continue;let G=J[z];if(K!==void 0&&Z>=K){X++;continue}Y[z]=this._truncateToSize(G),Z++}let Q={context:z.context};return Z>0&&(Q.attributes=Y),X>0&&(Q.droppedAttributesCount=X),this.links.push(Q),this}addLinks(z){for(let G of z)this.addLink(G);return this}setStatus(z){if(this._isSpanEnded()||z.code===SpanStatusCode.UNSET||this.status.code===SpanStatusCode.OK)return this;let G={code:z.code};return z.code===SpanStatusCode.ERROR&&(typeof z.message==`string`?G.message=z.message:z.message!=null&&diag$1.warn(`Dropping invalid status.message of type '${typeof z.message}', expected 'string'`)),this.status=G,this}updateName(z){return this._isSpanEnded()||(this.name=z),this}end(z){var G;if(this._isSpanEnded()){diag$1.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(z),this._duration=hrTimeDuration(this.startTime,this.endTime),this._duration[0]<0&&(diag$1.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&&diag$1.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&diag$1.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(G=this._recordEndMetrics)==null||G.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(z){if(typeof z==`number`&&z<=otperformance$3.now())return hrTime$3(z+this._performanceOffset);if(typeof z==`number`)return millisToHrTime$3(z);if(z instanceof Date)return millisToHrTime$3(z.getTime());if(isTimeInputHrTime$1(z))return z;if(this._startTimeProvided)return millisToHrTime$3(Date.now());let G=otperformance$3.now()-this._performanceStartTime;return addHrTimes$3(this.startTime,millisToHrTime$3(G))}isRecording(){return this._ended===!1}recordException(z,G){let K={};typeof z==`string`?K[ATTR_EXCEPTION_MESSAGE]=z:z&&(z.code?K[ATTR_EXCEPTION_TYPE]=z.code.toString():z.name&&(K[ATTR_EXCEPTION_TYPE]=z.name),z.message&&(K[ATTR_EXCEPTION_MESSAGE]=z.message),z.stack&&(K[ATTR_EXCEPTION_STACKTRACE]=z.stack)),K[ATTR_EXCEPTION_TYPE]||K[ATTR_EXCEPTION_MESSAGE]?this.addEvent(ExceptionEventName,K,G):diag$1.warn(`Failed to record an exception ${z}`)}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 z=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);diag$1.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,z)}return this._ended}_truncateToLimitUtil(z,G){return z.length<=G?z:z.substring(0,G)}_truncateToSize(z){let G=this._attributeValueLengthLimit;return G<=0?(diag$1.warn(`Attribute value limit must be positive, got ${G}`),z):typeof z==`string`?this._truncateToLimitUtil(z,G):Array.isArray(z)?z.map(z=>typeof z==`string`?this._truncateToLimitUtil(z,G):z):z}},SamplingDecision;(function(z){z[z.NOT_RECORD=0]=`NOT_RECORD`,z[z.RECORD=1]=`RECORD`,z[z.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(SamplingDecision||(SamplingDecision={}));var AlwaysOffSampler=class{shouldSample(){return{decision:SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},AlwaysOnSampler=class{shouldSample(){return{decision:SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},ParentBasedSampler=class{constructor(z){var G,K,J,Y;_defineProperty(this,`_root`,void 0),_defineProperty(this,`_remoteParentSampled`,void 0),_defineProperty(this,`_remoteParentNotSampled`,void 0),_defineProperty(this,`_localParentSampled`,void 0),_defineProperty(this,`_localParentNotSampled`,void 0),this._root=z.root,this._root||(globalErrorHandler$1(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new AlwaysOnSampler),this._remoteParentSampled=(G=z.remoteParentSampled)==null?new AlwaysOnSampler:G,this._remoteParentNotSampled=(K=z.remoteParentNotSampled)==null?new AlwaysOffSampler:K,this._localParentSampled=(J=z.localParentSampled)==null?new AlwaysOnSampler:J,this._localParentNotSampled=(Y=z.localParentNotSampled)==null?new AlwaysOffSampler:Y}shouldSample(z,G,K,J,Y,X){let Z=trace$1.getSpanContext(z);return!Z||!isSpanContextValid(Z)?this._root.shouldSample(z,G,K,J,Y,X):Z.isRemote?Z.traceFlags&TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(z,G,K,J,Y,X):this._remoteParentNotSampled.shouldSample(z,G,K,J,Y,X):Z.traceFlags&TraceFlags.SAMPLED?this._localParentSampled.shouldSample(z,G,K,J,Y,X):this._localParentNotSampled.shouldSample(z,G,K,J,Y,X)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},TraceIdRatioBasedSampler=class{constructor(z=0){_defineProperty(this,`_ratio`,void 0),_defineProperty(this,`_upperBound`,void 0),this._ratio=this._normalize(z),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(z,G){return{decision:isValidTraceId(G)&&this._accumulate(G)<this._upperBound?SamplingDecision.RECORD_AND_SAMPLED:SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(z){return typeof z!=`number`||isNaN(z)?0:z>=1?1:z<=0?0:z}_accumulate(z){let G=0;for(let K=0;K<z.length/8;K++){let J=K*8,Y=parseInt(z.slice(J,J+8),16);G=(G^Y)>>>0}return G}},TracesSamplerValues;(function(z){z.AlwaysOff=`always_off`,z.AlwaysOn=`always_on`,z.ParentBasedAlwaysOff=`parentbased_always_off`,z.ParentBasedAlwaysOn=`parentbased_always_on`,z.ParentBasedTraceIdRatio=`parentbased_traceidratio`,z.TraceIdRatio=`traceidratio`})(TracesSamplerValues||(TracesSamplerValues={}));const DEFAULT_RATIO=1;function loadDefaultConfig(){var z,G,K,J,Y,X,Z,Q;return{sampler:buildSamplerFromEnv(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(z=void 0)==null?1/0:z,attributeCountLimit:(G=void 0)==null?128:G},spanLimits:{attributeValueLengthLimit:(K=void 0)==null?1/0:K,attributeCountLimit:(J=void 0)==null?128:J,linkCountLimit:(Y=void 0)==null?128:Y,eventCountLimit:(X=void 0)==null?128:X,attributePerEventCountLimit:(Z=void 0)==null?128:Z,attributePerLinkCountLimit:(Q=void 0)==null?128:Q}}}function buildSamplerFromEnv(){var z;let G=(z=void 0)==null?TracesSamplerValues.ParentBasedAlwaysOn:z;switch(G){case TracesSamplerValues.AlwaysOn:return new AlwaysOnSampler;case TracesSamplerValues.AlwaysOff:return new AlwaysOffSampler;case TracesSamplerValues.ParentBasedAlwaysOn:return new ParentBasedSampler({root:new AlwaysOnSampler});case TracesSamplerValues.ParentBasedAlwaysOff:return new ParentBasedSampler({root:new AlwaysOffSampler});case TracesSamplerValues.TraceIdRatio:return new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv());case TracesSamplerValues.ParentBasedTraceIdRatio:return new ParentBasedSampler({root:new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv())});default:return diag$1.error(`OTEL_TRACES_SAMPLER value "${G}" invalid, defaulting to "${TracesSamplerValues.ParentBasedAlwaysOn}".`),new ParentBasedSampler({root:new AlwaysOnSampler})}}function getSamplerProbabilityFromEnv(){let z;return diag$1.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${DEFAULT_RATIO}.`),DEFAULT_RATIO}const DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function mergeConfig(z){let G={sampler:buildSamplerFromEnv()},K=loadDefaultConfig(),J=Object.assign({},K,G,z);return J.generalLimits=Object.assign({},K.generalLimits,z.generalLimits||{}),J.spanLimits=Object.assign({},K.spanLimits,z.spanLimits||{}),J}function reconfigureLimits(z){var G,K,J,Y,X,Z,Q,ee,te,ne,ie,ae;let oe=Object.assign({},z.spanLimits);return oe.attributeCountLimit=(G=(K=(J=(Y=(X=z.spanLimits)==null?void 0:X.attributeCountLimit)==null?(Z=z.generalLimits)==null?void 0:Z.attributeCountLimit:Y)==null?void 0:J)==null?void 0:K)==null?DEFAULT_ATTRIBUTE_COUNT_LIMIT:G,oe.attributeValueLengthLimit=(Q=(ee=(te=(ne=(ie=z.spanLimits)==null?void 0:ie.attributeValueLengthLimit)==null?(ae=z.generalLimits)==null?void 0:ae.attributeValueLengthLimit:ne)==null?void 0:te)==null?void 0:ee)==null?DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT:Q,Object.assign({},z,{spanLimits:oe})}var BatchSpanProcessorBase=class{constructor(z,G){var K,J,Y,X;_defineProperty(this,`_maxExportBatchSize`,void 0),_defineProperty(this,`_maxQueueSize`,void 0),_defineProperty(this,`_scheduledDelayMillis`,void 0),_defineProperty(this,`_exportTimeoutMillis`,void 0),_defineProperty(this,`_exporter`,void 0),_defineProperty(this,`_isExporting`,!1),_defineProperty(this,`_finishedSpans`,[]),_defineProperty(this,`_timer`,void 0),_defineProperty(this,`_shutdownOnce`,void 0),_defineProperty(this,`_droppedSpansCount`,0),this._exporter=z,this._maxExportBatchSize=typeof(G==null?void 0:G.maxExportBatchSize)==`number`?G.maxExportBatchSize:(K=void 0)==null?512:K,this._maxQueueSize=typeof(G==null?void 0:G.maxQueueSize)==`number`?G.maxQueueSize:(J=void 0)==null?2048:J,this._scheduledDelayMillis=typeof(G==null?void 0:G.scheduledDelayMillis)==`number`?G.scheduledDelayMillis:(Y=void 0)==null?5e3:Y,this._exportTimeoutMillis=typeof(G==null?void 0:G.exportTimeoutMillis)==`number`?G.exportTimeoutMillis:(X=void 0)==null?3e4:X,this._shutdownOnce=new BindOnceFuture$1(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(diag$1.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(z,G){}onEnd(z){this._shutdownOnce.isCalled||(z.spanContext().traceFlags&TraceFlags.SAMPLED)!==0&&this._addToBuffer(z)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(z){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&diag$1.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(diag$1.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(z),this._maybeStartTimer()}_flushAll(){return new Promise((z,G)=>{let K=[],J=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let z=0,G=J;z<G;z++)K.push(this._flushOneBatch());Promise.all(K).then(()=>{z()}).catch(G)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((z,G)=>{let K=setTimeout(()=>{G(Error(`Timeout`))},this._exportTimeoutMillis);context.with(suppressTracing$2(context.active()),()=>{let J;this._finishedSpans.length<=this._maxExportBatchSize?(J=this._finishedSpans,this._finishedSpans=[]):J=this._finishedSpans.splice(0,this._maxExportBatchSize);let Y=()=>this._exporter.export(J,J=>{if(clearTimeout(K),J.code===ExportResultCode$2.SUCCESS)z();else{var Y;G((Y=J.error)==null?Error(`BatchSpanProcessor: span export failed`):Y)}}),X=null;for(let z=0,G=J.length;z<G;z++){let G=J[z];if(G.resource.asyncAttributesPending&&G.resource.waitForAsyncAttributes){var Z;X!=null||(X=[]),X.push(G.resource.waitForAsyncAttributes())}}X===null?Y():Promise.all(X).then(Y,z=>{globalErrorHandler$1(z),G(z)})})})}_maybeStartTimer(){if(this._isExporting)return;let z=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(z=>{this._isExporting=!1,globalErrorHandler$1(z)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return z();this._timer===void 0&&(this._timer=setTimeout(()=>z(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},BatchSpanProcessor=class extends BatchSpanProcessorBase{constructor(z,G){super(z,G),_defineProperty(this,`_visibilityChangeListener`,void 0),_defineProperty(this,`_pageHideListener`,void 0),this.onInit(G)}onInit(z){(z==null?void 0:z.disableAutoFlushOnDocumentHide)!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(z=>{globalErrorHandler$1(z)})},this._pageHideListener=()=>{this.forceFlush().catch(z=>{globalErrorHandler$1(z)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}};const TRACE_ID_BYTES=16,SPAN_ID_BYTES=8,TRACE_BUFFER=new Uint8Array(TRACE_ID_BYTES),SPAN_BUFFER=new Uint8Array(SPAN_ID_BYTES),HEX=Array.from({length:256},(z,G)=>G.toString(16).padStart(2,`0`));function randomFill(z){for(let G=0;G<z.length;G++)z[G]=Math.random()*256>>>0;for(let G=0;G<z.length;G++)if(z[G]>0)return;z[z.length-1]=1}function toHex(z){let G=``;for(let K=0;K<z.length;K++)G+=HEX[z[K]];return G}var RandomIdGenerator=class{generateTraceId(){return randomFill(TRACE_BUFFER),toHex(TRACE_BUFFER)}generateSpanId(){return randomFill(SPAN_BUFFER),toHex(SPAN_BUFFER)}};const ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`;var TracerMetrics=class{constructor(z){_defineProperty(this,`startedSpans`,void 0),_defineProperty(this,`liveSpans`,void 0),this.startedSpans=z.createCounter(METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=z.createUpDownCounter(METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(z,G){let K=samplingDecisionToString(G);if(this.startedSpans.add(1,{[ATTR_OTEL_SPAN_PARENT_ORIGIN]:parentOrigin(z),[ATTR_OTEL_SPAN_SAMPLING_RESULT]:K}),G===SamplingDecision.NOT_RECORD)return()=>{};let J={[ATTR_OTEL_SPAN_SAMPLING_RESULT]:K};return this.liveSpans.add(1,J),()=>{this.liveSpans.add(-1,J)}}};function parentOrigin(z){return z?z.isRemote?`remote`:`local`:`none`}function samplingDecisionToString(z){switch(z){case SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case SamplingDecision.RECORD:return`RECORD_ONLY`;case SamplingDecision.NOT_RECORD:return`DROP`}}const VERSION$6=`2.7.0`;var Tracer=class{constructor(z,G,K,J){_defineProperty(this,`_sampler`,void 0),_defineProperty(this,`_generalLimits`,void 0),_defineProperty(this,`_spanLimits`,void 0),_defineProperty(this,`_idGenerator`,void 0),_defineProperty(this,`instrumentationScope`,void 0),_defineProperty(this,`_resource`,void 0),_defineProperty(this,`_spanProcessor`,void 0),_defineProperty(this,`_tracerMetrics`,void 0);let Y=mergeConfig(G);this._sampler=Y.sampler,this._generalLimits=Y.generalLimits,this._spanLimits=Y.spanLimits,this._idGenerator=G.idGenerator||new RandomIdGenerator,this._resource=K,this._spanProcessor=J,this.instrumentationScope=z,this._tracerMetrics=new TracerMetrics(Y.meterProvider?Y.meterProvider.getMeter(`@opentelemetry/sdk-trace`,VERSION$6):createNoopMeter())}startSpan(z,G={},K=context.active()){var J,Y,X;G.root&&(K=trace$1.deleteSpan(K));let Z=trace$1.getSpan(K);if(isTracingSuppressed(K))return diag$1.debug(`Instrumentation suppressed, returning Noop Span`),trace$1.wrapSpanContext(INVALID_SPAN_CONTEXT);let Q=Z==null?void 0:Z.spanContext(),ee=this._idGenerator.generateSpanId(),te,ne,ie;!Q||!trace$1.isSpanContextValid(Q)?ne=this._idGenerator.generateTraceId():(ne=Q.traceId,ie=Q.traceState,te=Q);let ae=(J=G.kind)==null?SpanKind.INTERNAL:J,oe=((Y=G.links)==null?[]:Y).map(z=>({context:z.context,attributes:sanitizeAttributes(z.attributes)})),se=sanitizeAttributes(G.attributes),ce=this._sampler.shouldSample(K,ne,z,ae,se,oe),le=this._tracerMetrics.startSpan(Q,ce.decision);ie=(X=ce.traceState)==null?ie:X;let ue=ce.decision===SamplingDecision$1.RECORD_AND_SAMPLED?TraceFlags.SAMPLED:TraceFlags.NONE,de={traceId:ne,spanId:ee,traceFlags:ue,traceState:ie};if(ce.decision===SamplingDecision$1.NOT_RECORD)return diag$1.debug(`Recording is off, propagating context in a non-recording span`),trace$1.wrapSpanContext(de);let fe=sanitizeAttributes(Object.assign(se,ce.attributes));return new SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:K,spanContext:de,name:z,kind:ae,links:oe,parentSpanContext:te,attributes:fe,startTime:G.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:le})}startActiveSpan(z,G,K,J){var Y;let X,Z,Q;if(arguments.length<2)return;arguments.length===2?Q=G:arguments.length===3?(X=G,Q=K):(X=G,Z=K,Q=J);let ee=(Y=Z)==null?context.active():Y,te=this.startSpan(z,X,ee),ne=trace$1.setSpan(ee,te);return context.with(ne,Q,void 0,te)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}},MultiSpanProcessor=class{constructor(z){_defineProperty(this,`_spanProcessors`,void 0),this._spanProcessors=z}forceFlush(){let z=[];for(let G of this._spanProcessors)z.push(G.forceFlush());return new Promise(G=>{Promise.all(z).then(()=>{G()}).catch(z=>{globalErrorHandler$1(z||Error(`MultiSpanProcessor: forceFlush failed`)),G()})})}onStart(z,G){for(let K of this._spanProcessors)K.onStart(z,G)}onEnding(z){for(let G of this._spanProcessors)G.onEnding&&G.onEnding(z)}onEnd(z){for(let G of this._spanProcessors)G.onEnd(z)}shutdown(){let z=[];for(let G of this._spanProcessors)z.push(G.shutdown());return new Promise((G,K)=>{Promise.all(z).then(()=>{G()},K)})}},ForceFlushState;(function(z){z[z.resolved=0]=`resolved`,z[z.timeout=1]=`timeout`,z[z.error=2]=`error`,z[z.unresolved=3]=`unresolved`})(ForceFlushState||(ForceFlushState={}));var BasicTracerProvider=class{constructor(z={}){var G,K;_defineProperty(this,`_config`,void 0),_defineProperty(this,`_tracers`,new Map),_defineProperty(this,`_resource`,void 0),_defineProperty(this,`_activeSpanProcessor`,void 0);let J=merge({},loadDefaultConfig(),reconfigureLimits(z));this._resource=(G=J.resource)==null?defaultResource$1():G,this._config=Object.assign({},J,{resource:this._resource});let Y=[];(K=z.spanProcessors)!=null&&K.length&&Y.push(...z.spanProcessors),this._activeSpanProcessor=new MultiSpanProcessor(Y)}getTracer(z,G,K){let J=`${z}@${G||``}:${(K==null?void 0:K.schemaUrl)||``}`;return this._tracers.has(J)||this._tracers.set(J,new Tracer({name:z,version:G,schemaUrl:K==null?void 0:K.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(J)}forceFlush(){let z=this._config.forceFlushTimeoutMillis,G=this._activeSpanProcessor._spanProcessors.map(G=>new Promise(K=>{let J,Y=setTimeout(()=>{K(Error(`Span processor did not completed within timeout period of ${z} ms`)),J=ForceFlushState.timeout},z);G.forceFlush().then(()=>{clearTimeout(Y),J!==ForceFlushState.timeout&&(J=ForceFlushState.resolved,K(J))}).catch(z=>{clearTimeout(Y),J=ForceFlushState.error,K(z)})}));return new Promise((z,K)=>{Promise.all(G).then(G=>{let J=G.filter(z=>z!==ForceFlushState.resolved);J.length>0?K(J):z()}).catch(z=>K([z]))})}shutdown(){return this._activeSpanProcessor.shutdown()}},StackContextManager=class{constructor(){_defineProperty(this,`_enabled`,!1),_defineProperty(this,`_currentContext`,ROOT_CONTEXT)}_bindFunction(z=ROOT_CONTEXT,G){let K=this,J=function(...J){return K.with(z,()=>G.apply(this,J))};return Object.defineProperty(J,`length`,{enumerable:!1,configurable:!0,writable:!1,value:G.length}),J}active(){return this._currentContext}bind(z,G){return z===void 0&&(z=this.active()),typeof G==`function`?this._bindFunction(z,G):G}disable(){return this._currentContext=ROOT_CONTEXT,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=ROOT_CONTEXT,this)}with(z,G,K,...J){let Y=this._currentContext;this._currentContext=z||ROOT_CONTEXT;try{return G.call(K,...J)}finally{this._currentContext=Y}}};function setupContextManager(z){if(z!==null){if(z===void 0){let z=new StackContextManager;z.enable(),context.setGlobalContextManager(z);return}z.enable(),context.setGlobalContextManager(z)}}function setupPropagator(z){if(z!==null){if(z===void 0){propagation.setGlobalPropagator(new CompositePropagator({propagators:[new W3CTraceContextPropagator,new W3CBaggagePropagator]}));return}propagation.setGlobalPropagator(z)}}var WebTracerProvider=class extends BasicTracerProvider{constructor(z={}){super(z)}register(z={}){trace$1.setGlobalTracerProvider(this),setupPropagator(z.propagator),setupContextManager(z.contextManager)}},PerformanceTimingNames;(function(z){z.CONNECT_END=`connectEnd`,z.CONNECT_START=`connectStart`,z.DECODED_BODY_SIZE=`decodedBodySize`,z.DOM_COMPLETE=`domComplete`,z.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,z.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,z.DOM_INTERACTIVE=`domInteractive`,z.DOMAIN_LOOKUP_END=`domainLookupEnd`,z.DOMAIN_LOOKUP_START=`domainLookupStart`,z.ENCODED_BODY_SIZE=`encodedBodySize`,z.FETCH_START=`fetchStart`,z.LOAD_EVENT_END=`loadEventEnd`,z.LOAD_EVENT_START=`loadEventStart`,z.NAVIGATION_START=`navigationStart`,z.REDIRECT_END=`redirectEnd`,z.REDIRECT_START=`redirectStart`,z.REQUEST_START=`requestStart`,z.RESPONSE_END=`responseEnd`,z.RESPONSE_START=`responseStart`,z.SECURE_CONNECTION_START=`secureConnectionStart`,z.START_TIME=`startTime`,z.UNLOAD_EVENT_END=`unloadEventEnd`,z.UNLOAD_EVENT_START=`unloadEventStart`})(PerformanceTimingNames||(PerformanceTimingNames={}));const ATTR_HTTP_RESPONSE_CONTENT_LENGTH=`http.response_content_length`,ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=`http.response_content_length_uncompressed`;let urlNormalizingAnchor;function getUrlNormalizingAnchor(){return urlNormalizingAnchor||(urlNormalizingAnchor=document.createElement(`a`)),urlNormalizingAnchor}function hasKey(z,G){return G in z}function addSpanNetworkEvent(z,G,K,J=!0){if(hasKey(K,G)&&typeof K[G]==`number`&&!(J&&K[G]===0))return z.addEvent(G,K[G])}function addSpanNetworkEvents(z,G,K=!1,J,Y){if(J===void 0&&(J=G[PerformanceTimingNames.START_TIME]!==0),K||(addSpanNetworkEvent(z,PerformanceTimingNames.FETCH_START,G,J),addSpanNetworkEvent(z,PerformanceTimingNames.DOMAIN_LOOKUP_START,G,J),addSpanNetworkEvent(z,PerformanceTimingNames.DOMAIN_LOOKUP_END,G,J),addSpanNetworkEvent(z,PerformanceTimingNames.CONNECT_START,G,J),addSpanNetworkEvent(z,PerformanceTimingNames.SECURE_CONNECTION_START,G,J),addSpanNetworkEvent(z,PerformanceTimingNames.CONNECT_END,G,J),addSpanNetworkEvent(z,PerformanceTimingNames.REQUEST_START,G,J),addSpanNetworkEvent(z,PerformanceTimingNames.RESPONSE_START,G,J),addSpanNetworkEvent(z,PerformanceTimingNames.RESPONSE_END,G,J)),!Y){let K=G[PerformanceTimingNames.ENCODED_BODY_SIZE];K!==void 0&&z.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH,K);let J=G[PerformanceTimingNames.DECODED_BODY_SIZE];J!==void 0&&K!==J&&z.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,J)}}function sortResources(z){return z.slice().sort((z,G)=>{let K=z[PerformanceTimingNames.FETCH_START],J=G[PerformanceTimingNames.FETCH_START];return K>J?1:K<J?-1:0})}function getOrigin(){return typeof location<`u`?location.origin:void 0}function getResource(z,G,K,J,Y=new WeakSet,X){let Z=parseUrl(z);z=Z.toString();let Q=filterResourcesForSpan(z,G,K,J,Y,X);if(Q.length===0)return{mainRequest:void 0};if(Q.length===1)return{mainRequest:Q[0]};let ee=sortResources(Q);if(Z.origin!==getOrigin()&&ee.length>1){let z=ee[0],G=findMainRequest(ee,z[PerformanceTimingNames.RESPONSE_END],K),J=z[PerformanceTimingNames.RESPONSE_END];return G[PerformanceTimingNames.FETCH_START]<J&&(G=z,z=void 0),{corsPreFlightRequest:z,mainRequest:G}}else return{mainRequest:Q[0]}}function findMainRequest(z,G,K){let J=hrTimeToNanoseconds$1(K),Y=hrTimeToNanoseconds$1(timeInputToHrTime$1(G)),X=z[1],Z,Q=z.length;for(let G=1;G<Q;G++){let K=z[G],Q=hrTimeToNanoseconds$1(timeInputToHrTime$1(K[PerformanceTimingNames.FETCH_START])),ee=J-hrTimeToNanoseconds$1(timeInputToHrTime$1(K[PerformanceTimingNames.RESPONSE_END]));Q>=Y&&(!Z||ee<Z)&&(Z=ee,X=K)}return X}function filterResourcesForSpan(z,G,K,J,Y,X){let Z=hrTimeToNanoseconds$1(G),Q=hrTimeToNanoseconds$1(K),ee=J.filter(G=>{let K=hrTimeToNanoseconds$1(timeInputToHrTime$1(G[PerformanceTimingNames.FETCH_START])),J=hrTimeToNanoseconds$1(timeInputToHrTime$1(G[PerformanceTimingNames.RESPONSE_END]));return G.initiatorType.toLowerCase()===(X||`xmlhttprequest`)&&G.name===z&&K>=Z&&J<=Q});return ee.length>0&&(ee=ee.filter(z=>!Y.has(z))),ee}function parseUrl(z){if(typeof URL==`function`)return new URL(z,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let G=getUrlNormalizingAnchor();return G.href=z,G}function shouldPropagateTraceHeaders(z,G){let K=G||[];return(typeof K==`string`||K instanceof RegExp)&&(K=[K]),parseUrl(z).origin===getOrigin()?!0:K.some(G=>urlMatches$2(z,G))}const PENDING_SPANS_STORAGE_KEY_PREFIX=`mxl_pending_`,MAX_PENDING_SPANS_ITEMS=10;var MXLSpanStorage=class{constructor({resource:z=emptyResource(),storage:G=window.localStorage,diag:K=diag$1.createComponentLogger({namespace:`MXLSpanStorage`}),storedSpansExpireTimeoutMS:J=3600*1e3,onExpiredSpansExport:Y,spanSessionManager:X}){_defineProperty(this,`_noExportTracer`,void 0),_defineProperty(this,`_storage`,void 0),_defineProperty(this,`_diag`,void 0),_defineProperty(this,`_onExpiredSpansExport`,void 0),_defineProperty(this,`_storedSpansExpireTimeoutMS`,void 0),_defineProperty(this,`_spanSessionManager`,void 0),_defineProperty(this,`_checkExpiredSpansInterval`,void 0),this._noExportTracer=new BasicTracerProvider({resource:z}).getTracer(`mxl-web-sdk-sessions`),this._storage=G,this._diag=K,this._storedSpansExpireTimeoutMS=J,this._onExpiredSpansExport=Y,this._spanSessionManager=X,this.startExpiredSpansCheck()}storePendingSpans(z,G,K){try{if(this.clearStoredSpans(z),this._getPendingSpansKeys().length>=MAX_PENDING_SPANS_ITEMS){this._spanSessionManager.incrSessionCountForKey(KEY_MXL_MAX_PENDING_SPANS_REACHED),this._diag.warn(`Not storing pending spans as the max number of items was reached`);return}let J=`${PENDING_SPANS_STORAGE_KEY_PREFIX}${z}_${Date.now()}`;this._storage.setItem(J,JSON.stringify([G,...K],(z,G)=>z.startsWith(`_`)?void 0:G)),this._diag.debug(`Stored pending span: ${J}`)}catch(z){this._diag.error(`Failed to store spans to storage:`,z)}}clearStoredSpans(z){try{let G=`${PENDING_SPANS_STORAGE_KEY_PREFIX}${z}_`;this._getPendingSpansKeys().forEach(z=>{z.startsWith(G)&&this._storage.removeItem(z)})}catch(z){this._diag.error(`Failed to clear stored spans from storage:`,z)}}startExpiredSpansCheck(){this._checkExpiredSpansInterval=setInterval(()=>{this.checkAndExportExpiredSpans()},300*1e3)}stopExpiredSpansCheck(){this._checkExpiredSpansInterval&&(clearInterval(this._checkExpiredSpansInterval),this._checkExpiredSpansInterval=void 0)}checkAndExportExpiredSpans(){try{let z=this._getPendingSpansKeys();if(z.length===0)return;let G=Date.now();z.forEach(z=>{let K=z.split(`_`),J=parseInt(K[K.length-1],10);if(Number.isNaN(J)&&(this._diag.error(`Found invalid timestamp in stored span:`,J),this._storage.removeItem(z)),G-J<=this._storedSpansExpireTimeoutMS)return;let Y=this._storage.getItem(z);if(Y){try{let z=[];for(let G of JSON.parse(Y)){let K=this._noExportTracer.startSpan(G.name,{kind:G.kind,attributes:G.attributes,links:G.links,startTime:G.startTime});K.setStatus(G.status),K.end(G.endTime),z.push(K)}this._onExpiredSpansExport&&z.length>0&&this._onExpiredSpansExport(z)}catch(z){this._diag.error(`Failed to process expired spans:`,z)}this._storage.removeItem(z)}})}catch(z){this._diag.error(`Failed to check and export expired spans:`,z)}}_getPendingSpansKeys(){let z=[];for(let G=0;G<this._storage.length;G++){let K=this._storage.key(G);K!=null&&K.startsWith(PENDING_SPANS_STORAGE_KEY_PREFIX)&&z.push(K)}return z}destroy(){this.stopExpiredSpansCheck()}},NamespacedStorage=class{constructor(z,G){_defineProperty(this,`_keyPrefix`,void 0),_defineProperty(this,`_storage`,void 0),this._keyPrefix=`${z}_`,this._storage=G}getNamespacedKeys(){let z=[];for(let G=0;G<this._storage.length;G++){let K=this._storage.key(G);K!=null&&K.startsWith(this._keyPrefix)&&z.push(K.substring(this._keyPrefix.length))}return z}get length(){return this.getNamespacedKeys().length}clear(){this.getNamespacedKeys().forEach(z=>{this._storage.removeItem(`${this._keyPrefix}${z}`)})}getItem(z){return this._storage.getItem(`${this._keyPrefix}${z}`)}key(z){return this.getNamespacedKeys()[z]||null}removeItem(z){this._storage.removeItem(`${this._keyPrefix}${z}`)}setItem(z,G){this._storage.setItem(`${this._keyPrefix}${z}`,G)}};const nsfConfigValidation=({diag:z,featureManager:G,registerGlobally:K,propagator:J,defaultInstrumentationConfig:Y})=>{var X;if(!G.isNetworkSpanForwardingEnabled())return!1;let Z=[];return K||Z.push("Network span forwarding cannot be used when `registerGlobally` is set to false. Turning off network span forwarding."),J&&Z.push("Network span forwarding cannot be used alongside a custom `propagator`. Turning off network span forwarding."),!(Y==null||(X=Y.omit)==null)&&X.has(`@opentelemetry/instrumentation-xml-http-request`)&&Y.omit.has(`@opentelemetry/instrumentation-fetch`)&&Z.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.`),Z.forEach(G=>{z.warn(G)}),Z.length===0};var OTelPerformanceManager=class{constructor(z=window.performance){_defineProperty(this,`_clock`,void 0),_defineProperty(this,`epochMillisFromOriginOffset`,z=>this._clock.timeOrigin+z),_defineProperty(this,`getNowHRTime`,()=>millisToHrTime$4(this.getNowMillis())),_defineProperty(this,`getNowMillis`,()=>this.epochMillisFromOriginOffset(this._clock.now())),_defineProperty(this,`millisSinceHRTime`,z=>this.getNowMillis()-hrTimeToMilliseconds(z)),this._clock=z}};const throttle$1=(z,G=1e3)=>{let K=!1;return(...J)=>{K||(z(...J),setTimeout(()=>{K=!1},G),K=!0)}};var NoOpLogManager=class{logException(z,G){}message(z,G,K){}};const NOOP_LOG_MANAGER$1=new NoOpLogManager;var ProxyLogManager=class{constructor(){_defineProperty(this,`_delegate`,void 0)}getDelegate(){var z;return(z=this._delegate)==null?NOOP_LOG_MANAGER$1:z}setDelegate(z){this._delegate=z}logException(z,G){this.getDelegate().logException(z,G)}message(z,G,K){this.getDelegate().message(z,G,K)}};const NOOP_LOG_MANAGER=new NoOpLogManager,INTERNAL_METHODS$4=new Set([`setDelegate`,`getDelegate`]);var LogAPI=class z{static getInstance(){if(!z._instance){let G=new ProxyLogManager,K=createSafeProxy(G,NOOP_LOG_MANAGER,diag$1.createComponentLogger({namespace:`LogAPI`}),INTERNAL_METHODS$4);z._instance=Object.assign(K,{setGlobalLogManager(z){G.setDelegate(z)},getLogManager(){return G}})}return z._instance}static resetInstance(){z._instance=void 0}};_defineProperty(LogAPI,`_instance`,void 0);const log=LogAPI.getInstance();var NoOpPageManager=class{setCurrentRoute(z){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(z){}getPageLabel(){return null}clearCurrentRoute(){}};const NOOP_PAGE_MANAGER$1=new NoOpPageManager;var ProxyPageManager=class{constructor(){_defineProperty(this,`_delegate`,void 0)}getDelegate(){var z;return(z=this._delegate)==null?NOOP_PAGE_MANAGER$1:z}setDelegate(z){this._delegate=z}setCurrentRoute(z){this.getDelegate().setCurrentRoute(z)}getCurrentRoute(){return this.getDelegate().getCurrentRoute()}getCurrentPageId(){return this.getDelegate().getCurrentPageId()}setPageLabel(z){this.getDelegate().setPageLabel(z)}getPageLabel(){return this.getDelegate().getPageLabel()}clearCurrentRoute(){this.getDelegate().clearCurrentRoute()}};const NOOP_PAGE_MANAGER=new NoOpPageManager,INTERNAL_METHODS$3=new Set([`setDelegate`,`getDelegate`]);var PageAPI=class z{static getInstance(){if(!z._instance){let G=new ProxyPageManager,K=createSafeProxy(G,NOOP_PAGE_MANAGER,diag$1.createComponentLogger({namespace:`PageAPI`}),INTERNAL_METHODS$3);z._instance=Object.assign(K,{setGlobalPageManager(z){G.setDelegate(z)},getPageManager(){return G}})}return z._instance}static resetInstance(){z._instance=void 0}};_defineProperty(PageAPI,`_instance`,void 0);const page=PageAPI.getInstance();var NoOpSpanSessionManager=class{constructor(){_defineProperty(this,`getSessionId`,()=>null),_defineProperty(this,`getPreviousSessionId`,()=>null)}addBreadcrumb(z){}addProperty(z,G,K){}removeProperty(z){}endSessionSpan(){}endSessionSpanInternal(z){}currentSessionAsReadableSpan(z){return null}getSessionSpan(){return null}getSessionStartTime(){return null}startSessionSpan(){}addSessionStartedListener(z){return()=>{}}addSessionEndedListener(z){return()=>{}}};const NOOP_SPAN_SESSION_MANAGER$1=new NoOpSpanSessionManager;var ProxySpanSessionManager=class{constructor(){_defineProperty(this,`_delegate`,void 0)}getDelegate(){var z;return(z=this._delegate)==null?NOOP_SPAN_SESSION_MANAGER$1:z}setDelegate(z){this._delegate=z}addBreadcrumb(z){this.getDelegate().addBreadcrumb(z)}addProperty(z,G,K){this.getDelegate().addProperty(z,G,K)}removeProperty(z){this.getDelegate().removeProperty(z)}endSessionSpan(){this.getDelegate().endSessionSpan()}endSessionSpanInternal(z){this.getDelegate().endSessionSpanInternal(z)}currentSessionAsReadableSpan(z){return this.getDelegate().currentSessionAsReadableSpan(z)}getSessionId(){return this.getDelegate().getSessionId()}getPreviousSessionId(){return this.getDelegate().getPreviousSessionId()}getSessionSpan(){return this.getDelegate().getSessionSpan()}getSessionStartTime(){return this.getDelegate().getSessionStartTime()}startSessionSpan(z){this.getDelegate().startSessionSpan(z)}addSessionStartedListener(z){return this.getDelegate().addSessionStartedListener(z)}addSessionEndedListener(z){return this.getDelegate().addSessionEndedListener(z)}};const NOOP_SPAN_SESSION_MANAGER=new NoOpSpanSessionManager,INTERNAL_METHODS$2=new Set([`setDelegate`,`getDelegate`]);var SessionAPI=class z{static getInstance(){if(!z._instance){let G=new ProxySpanSessionManager,K=createSafeProxy(G,NOOP_SPAN_SESSION_MANAGER,diag$1.createComponentLogger({namespace:`SessionAPI`}),INTERNAL_METHODS$2);z._instance=Object.assign(K,{setGlobalSessionManager(z){G.setDelegate(z)},getSpanSessionManager(){return G}})}return z._instance}static resetInstance(){z._instance=void 0}};_defineProperty(SessionAPI,`_instance`,void 0);const session=SessionAPI.getInstance();var NonRecordingExtendedSpan=class{constructor(z=INVALID_SPAN_CONTEXT){_defineProperty(this,`_spanContext`,void 0),_defineProperty(this,`attributes`,{}),this._spanContext=z}fail(z){}spanContext(){return this._spanContext}setAttribute(z,G){return this}setAttributes(z){return this}removeAttribute(z){return this}addEvent(z,G,K){return this}addLink(z){return this}addLinks(z){return this}setStatus(z){return this}updateName(z){return this}end(z){}isRecording(){return!1}recordException(z,G){}},NoOpTraceManager=class{startSpan(z,G){return new NonRecordingExtendedSpan}setSpan(z,G){return ROOT_CONTEXT}getSpan(z){}};const NOOP_TRACE_MANAGER$1=new NoOpTraceManager;var ProxyTraceManager=class{constructor(){_defineProperty(this,`_delegate`,void 0)}getDelegate(){var z;return(z=this._delegate)==null?NOOP_TRACE_MANAGER$1:z}setDelegate(z){this._delegate=z}startSpan(z,G,K){return this.getDelegate().startSpan(z,G,K)}setSpan(z,G){return this.getDelegate().setSpan(z,G)}getSpan(z){return this.getDelegate().getSpan(z)}};const NOOP_TRACE_MANAGER=new NoOpTraceManager,INTERNAL_METHODS$1=new Set([`setDelegate`,`getDelegate`]);var TraceAPI=class z{static getInstance(){if(!z._instance){let G=new ProxyTraceManager,K=createSafeProxy(G,NOOP_TRACE_MANAGER,diag$1.createComponentLogger({namespace:`TraceAPI`}),INTERNAL_METHODS$1);z._instance=Object.assign(K,{setGlobalTraceManager(z){G.setDelegate(z)},getTraceManager(){return G}})}return z._instance}static resetInstance(){z._instance=void 0}};_defineProperty(TraceAPI,`_instance`,void 0);const trace=TraceAPI.getInstance(),KEY_ENDUSER_PSEUDO_ID=`enduser.pseudo.id`;var NoOpUserManager=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};const NOOP_USER_MANAGER$1=new NoOpUserManager;var ProxyUserManager=class{constructor(){_defineProperty(this,`_delegate`,void 0)}getDelegate(){var z;return(z=this._delegate)==null?NOOP_USER_MANAGER$1:z}setDelegate(z){this._delegate=z}getMXLUserId(){return this.getDelegate().getMXLUserId()}getUserId(){return this.getDelegate().getUserId()}setUserId(z){this.getDelegate().setUserId(z)}clearUserId(){this.getDelegate().clearUserId()}};const NOOP_USER_MANAGER=new NoOpUserManager,INTERNAL_METHODS=new Set([`setDelegate`,`getDelegate`]);var UserAPI=class z{static getInstance(){if(!z._instance){let G=new ProxyUserManager,K=createSafeProxy(G,NOOP_USER_MANAGER,diag$1.createComponentLogger({namespace:`UserAPI`}),INTERNAL_METHODS);z._instance=Object.assign(K,{setGlobalUserManager(z){G.setDelegate(z)},getUserManager(){return G}})}return z._instance}static resetInstance(){z._instance=void 0}};_defineProperty(UserAPI,`_instance`,void 0);const user=UserAPI.getInstance();var SeverityNumber$1;(function(z){z[z.UNSPECIFIED=0]=`UNSPECIFIED`,z[z.TRACE=1]=`TRACE`,z[z.TRACE2=2]=`TRACE2`,z[z.TRACE3=3]=`TRACE3`,z[z.TRACE4=4]=`TRACE4`,z[z.DEBUG=5]=`DEBUG`,z[z.DEBUG2=6]=`DEBUG2`,z[z.DEBUG3=7]=`DEBUG3`,z[z.DEBUG4=8]=`DEBUG4`,z[z.INFO=9]=`INFO`,z[z.INFO2=10]=`INFO2`,z[z.INFO3=11]=`INFO3`,z[z.INFO4=12]=`INFO4`,z[z.WARN=13]=`WARN`,z[z.WARN2=14]=`WARN2`,z[z.WARN3=15]=`WARN3`,z[z.WARN4=16]=`WARN4`,z[z.ERROR=17]=`ERROR`,z[z.ERROR2=18]=`ERROR2`,z[z.ERROR3=19]=`ERROR3`,z[z.ERROR4=20]=`ERROR4`,z[z.FATAL=21]=`FATAL`,z[z.FATAL2=22]=`FATAL2`,z[z.FATAL3=23]=`FATAL3`,z[z.FATAL4=24]=`FATAL4`})(SeverityNumber$1||(SeverityNumber$1={}));var NoopLogger=class{emit(z){}enabled(){return!1}};const NOOP_LOGGER=new NoopLogger,GLOBAL_LOGS_API_KEY=Symbol.for(`io.opentelemetry.js.api.logs`),_global$1=globalThis;function makeGetter(z,G,K){return J=>J===z?G:K}const API_BACKWARDS_COMPATIBILITY_VERSION=1;var NoopLoggerProvider=class{getLogger(z,G,K){return new NoopLogger}};const NOOP_LOGGER_PROVIDER=new NoopLoggerProvider;var ProxyLogger=class{constructor(z,G,K,J){this._provider=z,this.name=G,this.version=K,this.options=J}emit(z){this._getLogger().emit(z)}enabled(z){return this._getLogger().enabled(z)}_getLogger(){if(this._delegate)return this._delegate;let z=this._provider._getDelegateLogger(this.name,this.version,this.options);return z?(this._delegate=z,this._delegate):NOOP_LOGGER}},ProxyLoggerProvider=class{getLogger(z,G,K){var J;return(J=this._getDelegateLogger(z,G,K))==null?new ProxyLogger(this,z,G,K):J}_getDelegate(){var z;return(z=this._delegate)==null?NOOP_LOGGER_PROVIDER:z}_setDelegate(z){this._delegate=z}_getDelegateLogger(z,G,K){var J;return(J=this._delegate)==null?void 0:J.getLogger(z,G,K)}},LogsAPI=class z{constructor(){this._proxyLoggerProvider=new ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new z),this._instance}setGlobalLoggerProvider(z){return _global$1[GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(_global$1[GLOBAL_LOGS_API_KEY]=makeGetter(API_BACKWARDS_COMPATIBILITY_VERSION,z,NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(z),z)}getLoggerProvider(){var z,G;return(G=(z=_global$1[GLOBAL_LOGS_API_KEY])==null?void 0:z.call(_global$1,API_BACKWARDS_COMPATIBILITY_VERSION))==null?this._proxyLoggerProvider:G}getLogger(z,G,K){return this.getLoggerProvider().getLogger(z,G,K)}disable(){delete _global$1[GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new ProxyLoggerProvider}};const logs=LogsAPI.getInstance();function enableInstrumentations(z,G,K,J){for(let Y=0,X=z.length;Y<X;Y++){let X=z[Y];G&&X.setTracerProvider(G),K&&X.setMeterProvider(K),J&&X.setLoggerProvider&&X.setLoggerProvider(J),X.getConfig().enabled||X.enable()}}function disableInstrumentations(z){z.forEach(z=>z.disable())}function registerInstrumentations(z){var G,K;let J=z.tracerProvider||trace$1.getTracerProvider(),Y=z.meterProvider||metrics.getMeterProvider(),X=z.loggerProvider||logs.getLoggerProvider(),Z=(G=(K=z.instrumentations)==null?void 0:K.flat())==null?[]:G;return enableInstrumentations(Z,J,Y,X),()=>{disableInstrumentations(Z)}}function ownKeys(z,G){var K=Object.keys(z);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(z);G&&(J=J.filter(function(G){return Object.getOwnPropertyDescriptor(z,G).enumerable})),K.push.apply(K,J)}return K}function _objectSpread2(z){for(var G=1;G<arguments.length;G++){var K=arguments[G]==null?{}:arguments[G];G%2?ownKeys(Object(K),!0).forEach(function(G){_defineProperty(z,G,K[G])}):Object.getOwnPropertyDescriptors?Object.defineProperties(z,Object.getOwnPropertyDescriptors(K)):ownKeys(Object(K)).forEach(function(G){Object.defineProperty(z,G,Object.getOwnPropertyDescriptor(K,G))})}return z}function safeExecuteInTheMiddle$2(z,G,K){let J,Y;try{Y=z()}catch(z){J=z}finally{if(G(J,Y),J&&!K)throw J;return Y}}function isWrapped$1(z){return typeof z==`function`&&typeof z.__original==`function`&&typeof z.__unwrap==`function`&&z.__wrapped===!0}const ATTR_HTTP_REQUEST_BODY_SIZE$2=`http.request.body.size`,ATTR_HTTP_RESPONSE_BODY_SIZE=`http.response.body.size`,ATTR_HTTP_RESPONSE_SIZE=`http.response.size`,ATTR_LOG_RECORD_UID=`log.record.uid`,ATTR_SESSION_ID$1=`session.id`,ATTR_SESSION_PREVIOUS_ID=`session.previous_id`,ATTR_USER_ID=`user.id`;var InstrumentationAbstract$2=class{constructor(z,G,K){this.instrumentationName=z,this.instrumentationVersion=G,_defineProperty(this,`_config`,{}),_defineProperty(this,`_diag`,void 0),_defineProperty(this,`_tracer`,void 0),_defineProperty(this,`_meter`,void 0),_defineProperty(this,`_logger`,void 0),this.setConfig(K),this._diag=diag$1.createComponentLogger({namespace:z}),this._tracer=trace$1.getTracer(z,G),this._meter=metrics.getMeter(z,G),this._logger=logs.getLogger(z,G),this._updateMetricInstruments()}get tracer(){return this._tracer}get meter(){return this._meter}get logger(){return this._logger}getModuleDefinitions(){var z;let G=(z=this.init())==null?[]:z;return Array.isArray(G)?G:[G]}getConfig(){return this._config}setConfig(z){this._config=_objectSpread2({enabled:!0},z)}setLoggerProvider(z){this._logger=z.getLogger(this.instrumentationName,this.instrumentationVersion)}setMeterProvider(z){this._meter=z.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}setTracerProvider(z){this._tracer=z.getTracer(this.instrumentationName,this.instrumentationVersion)}_updateMetricInstruments(){}_runSpanCustomizationHook(z,G,K,J){if(z)try{z(K,J)}catch(z){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:G},z)}}},MXLInstrumentationBase=class extends InstrumentationAbstract$2{constructor({instrumentationName:z,instrumentationVersion:G,config:K,diag:J,perf:Y}){super(z,G,K),_defineProperty(this,`_sessionManager`,void 0),_defineProperty(this,`_logManager`,void 0),_defineProperty(this,`_perf`,void 0),J&&(this._diag=J),this._perf=Y==null?new OTelPerformanceManager:Y,this._sessionManager=session.getSpanSessionManager(),this._logManager=log.getLogManager()}get sessionManager(){return this._sessionManager}get logManager(){return this._logManager}get perf(){return this._perf}init(){}setLogManager(z){this._logManager=z}setSessionManager(z){this._sessionManager=z}};let AttributeNames$2=function(z){return z.DOCUMENT_LOAD=`documentLoad`,z.DOCUMENT_FETCH=`documentFetch`,z.RESOURCE_FETCH=`resourceFetch`,z}({}),EventNames$1=function(z){return z.FIRST_PAINT=`firstPaint`,z.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`,z}({});const getPerformanceNavigationEntries=()=>{let z={},G=window.performance.getEntriesByType(`navigation`)[0];return Object.values(PerformanceTimingNames).forEach(K=>{if(hasKey(G,K)){let J=G[K];typeof J==`number`&&(z[K]=J)}}),z},performancePaintNames={"first-paint":EventNames$1.FIRST_PAINT,"first-contentful-paint":EventNames$1.FIRST_CONTENTFUL_PAINT},addSpanPerformancePaintEvents=z=>{window.performance.getEntriesByType(`paint`).forEach(({name:G,startTime:K})=>{hasKey(performancePaintNames,G)&&z.addEvent(performancePaintNames[G],K)})},ATTR_HTTP_RESPONSE_DELIVERY_TYPE=`http.response.delivery_type`,ATTR_HTTP_RESPONSE_DECODED_BODY_SIZE=`http.response.decoded_body_size`,ATTR_HTTP_REQUEST_INITIATOR_TYPE=`http.request.initiator_type`,ATTR_HTTP_REQUEST_RENDER_BLOCKING_STATUS=`http.request.render_blocking_status`,ATTR_HTTP_RESPONSE_CORS_OPAQUE=`http.response.cors_opaque`,ATTR_HTTP_RESPONSE_CACHE_REVALIDATED=`http.response.cache_revalidated`,ATTR_HTTP_REQUEST_INCOMPLETE=`http.request.incomplete`,ATTR_HTTP_REQUEST_PREVENTED=`http.request.prevented`;var DocumentLoadInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z,perf:G,enabled:K,applyCustomAttributesOnSpan:J,ignorePerformancePaintEvents:Y=!1,ignoreNetworkEvents:X=!1}={}){super({instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,perf:G,config:{enabled:K,applyCustomAttributesOnSpan:J,ignorePerformancePaintEvents:Y,ignoreNetworkEvents:X}}),_defineProperty(this,`_onDocumentLoaded`,void 0),_defineProperty(this,`_performanceCollected`,!1),this._onDocumentLoaded=()=>{window.setTimeout(()=>{this._collectPerformance()},0)},this._config.enabled&&this.enable()}init(){this._diag.debug(`Initializing document load instrumentation`)}_addResourcesSpans(z){performance.getEntriesByType(`resource`).forEach(G=>{this._initResourceSpan(G,z)})}_collectPerformance(){if(this._performanceCollected)return;this._performanceCollected=!0;let z=Array.from(document.getElementsByTagName(`meta`)).find(z=>z.getAttribute(`name`)===TRACE_PARENT_HEADER$1),G=getPerformanceNavigationEntries(),K=(z==null?void 0:z.content)||``;context.with(propagation.extract(ROOT_CONTEXT,{traceparent:K}),()=>{var z;let K=this._startSpan(AttributeNames$2.DOCUMENT_LOAD,PerformanceTimingNames.FETCH_START,G);K&&(context.with(trace$1.setSpan(context.active(),K),()=>{let z=this._startSpan(AttributeNames$2.DOCUMENT_FETCH,PerformanceTimingNames.FETCH_START,G);z&&(z.setAttribute(ATTR_URL_FULL,location.href),context.with(trace$1.setSpan(context.active(),z),()=>{var K;addSpanNetworkEvents(z,G,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(z,(K=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:K.documentFetch),this._endSpan(z,PerformanceTimingNames.RESPONSE_END,G)}))}),K.setAttribute(KEY_MXL_TYPE,MXL_TYPES.DocumentLoad),K.setAttribute(ATTR_URL_FULL,location.href),K.setAttribute(ATTR_USER_AGENT_ORIGINAL,navigator.userAgent),this._addResourcesSpans(K),this.getConfig().ignoreNetworkEvents||(addSpanNetworkEvent(K,PerformanceTimingNames.FETCH_START,G),addSpanNetworkEvent(K,PerformanceTimingNames.UNLOAD_EVENT_START,G),addSpanNetworkEvent(K,PerformanceTimingNames.UNLOAD_EVENT_END,G),addSpanNetworkEvent(K,PerformanceTimingNames.DOM_INTERACTIVE,G),addSpanNetworkEvent(K,PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START,G),addSpanNetworkEvent(K,PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END,G),addSpanNetworkEvent(K,PerformanceTimingNames.DOM_COMPLETE,G),addSpanNetworkEvent(K,PerformanceTimingNames.LOAD_EVENT_START,G),addSpanNetworkEvent(K,PerformanceTimingNames.LOAD_EVENT_END,G)),this.getConfig().ignorePerformancePaintEvents||addSpanPerformancePaintEvents(K),this._addCustomAttributesOnSpan(K,(z=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:z.documentLoad),this._endSpan(K,PerformanceTimingNames.LOAD_EVENT_END,G))})}_endSpan(z,G,K){z&&(hasKey(K,G)&&typeof K[G]==`number`?z.end(K[G]):z.end())}_initResourceSpan(z,G){var K;let J=this._startSpan(AttributeNames$2.RESOURCE_FETCH,PerformanceTimingNames.FETCH_START,z,G);J&&(J.setAttribute(KEY_MXL_TYPE,MXL_TYPES.ResourceFetch),J.setAttribute(ATTR_URL_FULL,z.name),addSpanNetworkEvents(J,z,this.getConfig().ignoreNetworkEvents),z.deliveryType&&J.setAttribute(ATTR_HTTP_RESPONSE_DELIVERY_TYPE,z.deliveryType),z.initiatorType&&J.setAttribute(ATTR_HTTP_REQUEST_INITIATOR_TYPE,z.initiatorType),z.renderBlockingStatus&&J.setAttribute(ATTR_HTTP_REQUEST_RENDER_BLOCKING_STATUS,z.renderBlockingStatus),z.responseStatus&&J.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE,z.responseStatus),typeof z.encodedBodySize==`number`&&z.encodedBodySize>=0&&J.setAttribute(ATTR_HTTP_RESPONSE_BODY_SIZE,z.encodedBodySize),typeof z.transferSize==`number`&&z.transferSize>=0&&J.setAttribute(ATTR_HTTP_RESPONSE_SIZE,z.transferSize),typeof z.decodedBodySize==`number`&&z.decodedBodySize>=0&&J.setAttribute(ATTR_HTTP_RESPONSE_DECODED_BODY_SIZE,z.decodedBodySize),this._addResourceDiagnosticAttributes(J,z),this._addCustomAttributesOnResourceSpan(J,z,(K=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:K.resourceFetch),this._endSpan(J,PerformanceTimingNames.RESPONSE_END,z))}_startSpan(z,G,K,J){if(hasKey(K,G)&&typeof K[G]==`number`)return this.tracer.startSpan(z,{startTime:K[G]},J?trace$1.setSpan(context.active(),J):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():window.addEventListener(`load`,this._onDocumentLoaded)}_addCustomAttributesOnSpan(z,G){G&&safeExecuteInTheMiddle$2(()=>{G(z)},z=>{z&&this._diag.error(`addCustomAttributesOnSpan`,z)},!0)}_addCustomAttributesOnResourceSpan(z,G,K){K&&safeExecuteInTheMiddle$2(()=>{K(z,G)},z=>{z&&this._diag.error(`addCustomAttributesOnResourceSpan`,z)},!0)}_hasNoSizeData(z){let G=typeof z.transferSize==`number`?z.transferSize:0,K=typeof z.decodedBodySize==`number`?z.decodedBodySize:0,J=typeof z.encodedBodySize==`number`?z.encodedBodySize:0;return G===0&&K===0&&J===0}_hasTimingData(z){let G=typeof z.fetchStart==`number`?z.fetchStart:0,K=typeof z.responseEnd==`number`?z.responseEnd:0;return G>0&&K>0}_isCorsRestricted(z){return this._hasNoSizeData(z)&&this._hasTimingData(z)}_isFetchIncomplete(z){let G=typeof z.fetchStart==`number`?z.fetchStart:0,K=typeof z.responseEnd==`number`?z.responseEnd:0;return this._hasNoSizeData(z)&&G>0&&K===0}_isFetchPrevented(z){let G=typeof z.fetchStart==`number`?z.fetchStart:0;return this._hasNoSizeData(z)&&G===0}_isCacheValidated(z){let G=typeof z.transferSize==`number`?z.transferSize:0,K=typeof z.deliveryType==`string`?z.deliveryType:``;return G===300&&K!==`cache`}_addResourceDiagnosticAttributes(z,G){this._isCorsRestricted(G)?z.setAttribute(ATTR_HTTP_RESPONSE_CORS_OPAQUE,!0):this._isFetchIncomplete(G)?z.setAttribute(ATTR_HTTP_REQUEST_INCOMPLETE,!0):this._isFetchPrevented(G)&&z.setAttribute(ATTR_HTTP_REQUEST_PREVENTED,!0),this._isCacheValidated(G)&&z.setAttribute(ATTR_HTTP_RESPONSE_CACHE_REVALIDATED,!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}},EmptyRootInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z,perf:G,rootNode:K,emptyCheckDelayMs:J=500}){super({instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,perf:G,config:{}}),_defineProperty(this,`_observer`,void 0),_defineProperty(this,`_emptyCheckDelayMs`,void 0),_defineProperty(this,`_rootNode`,void 0),this._rootNode=K,this._emptyCheckDelayMs=J,this._observer=new MutationObserver((z,G)=>{this._observerCallback(z)}),this._config.enabled&&this._rootNode?this.enable():this._rootNode||this._diag.warn(`supplied root node was null, this instrumentation won't be enabled`)}disable(){this._observer.disconnect()}enable(){this._rootNode&&this._observer.observe(this._rootNode,{childList:!0})}_observerCallback(z){let G=!1,K=!1;for(let J of z)J.target===this._rootNode&&(J.removedNodes.length>0&&(G=!0),J.addedNodes.length>0&&(K=!0));G&&!K&&(this._diag.debug(`root node had child nodes removed without new ones being added, checking if it's empty in ${this._emptyCheckDelayMs}ms`),window.setTimeout(()=>{this._checkForEmptyRootNode()},this._emptyCheckDelayMs))}_checkForEmptyRootNode(){var z;if(((z=this._rootNode)==null?void 0:z.childNodes.length)===0){this._diag.debug(`root node was found to be empty`);let z=this.sessionManager.getSessionSpan();z?z.addEvent(`empty-root-node`,{"mxl.type":`ux.empty_root_node`}):this._diag.debug(`no active session found to emit event on`)}}};const MAX_INNER_TEXT=30,getHTMLElementFriendlyName=(z,G)=>{let K=z.nodeName.toLowerCase(),J=G.substring(0,MAX_INNER_TEXT),Y=G.length>MAX_INNER_TEXT?`...`:``;return`<${K}${z.className?` class="${z.className}"`:``}>${J}${Y}</${K}>`};var ClicksInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z,perf:G,shouldTrack:K,innerTextForElement:J}={}){super({instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,perf:G,config:{}}),_defineProperty(this,`_onClickHandler`,void 0),this._onClickHandler=z=>{let G=z.target;if(G instanceof HTMLElement&&!G.hasAttribute(`disabled`)&&!(K&&!K(G)))try{let K=this.sessionManager.getSessionSpan();K&&K.addEvent(`click`,{"mxl.type":`ux.tap`,"view.name":getHTMLElementFriendlyName(G,J?J(G):G.innerText),"tap.coords":`${z.x.toString()},${z.y.toString()}`},this.perf.epochMillisFromOriginOffset(z.timeStamp))}catch(z){this._diag.error(`failed to create new user interaction span event`,z)}},this._config.enabled&&this.enable()}disable(){document.removeEventListener(`click`,this._onClickHandler)}enable(){document.addEventListener(`click`,this._onClickHandler)}},GlobalExceptionInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z,perf:G}={}){super({instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,perf:G,config:{}}),_defineProperty(this,`_onErrorHandler`,void 0),_defineProperty(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=z=>{this.logManager.logException(z.error||z.message,{handled:!1,timestamp:this.perf.epochMillisFromOriginOffset(z.timeStamp),handler:`global_exception`})},this._onUnhandledRejectionHandler=z=>{this.logManager.logException(z.reason,{handled:!1,timestamp:this.perf.epochMillisFromOriginOffset(z.timeStamp),handler:`promise_rejection`})},this._config.enabled&&this.enable()}disable(){window.removeEventListener(`error`,this._onErrorHandler),window.removeEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}enable(){window.addEventListener(`error`,this._onErrorHandler),window.addEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}};let logger$1=console.error.bind(console);function defineProperty$1(z,G,K){let J=!!z[G]&&Object.prototype.propertyIsEnumerable.call(z,G);Object.defineProperty(z,G,{configurable:!0,enumerable:J,writable:!0,value:K})}const wrap$1=(z,G,K)=>{if(!z||!z[G]){logger$1(`no original function `+String(G)+` to wrap`);return}if(!K){logger$1(`no wrapper function`),logger$1(Error().stack);return}let J=z[G];if(typeof J!=`function`||typeof K!=`function`){logger$1(`original object and wrapper must be functions`);return}let Y=K(J,G);return defineProperty$1(Y,`__original`,J),defineProperty$1(Y,`__unwrap`,()=>{z[G]===Y&&defineProperty$1(z,G,J)}),defineProperty$1(Y,`__wrapped`,!0),defineProperty$1(z,G,Y),Y},massWrap$1=(z,G,K)=>{if(z)Array.isArray(z)||(z=[z]);else{logger$1(`must provide one or more modules to patch`),logger$1(Error().stack);return}if(!(G&&Array.isArray(G))){logger$1(`must provide one or more functions to wrap on modules`);return}z.forEach(z=>{G.forEach(G=>{wrap$1(z,G,K)})})},unwrap$1=(z,G)=>{if(!z||!z[G]){logger$1(`no function to unwrap.`),logger$1(Error().stack);return}let K=z[G];if(!K.__unwrap)logger$1(`no original to unwrap to -- has `+String(G)+` already been unwrapped?`);else{K.__unwrap();return}},massUnwrap$1=(z,G)=>{if(z)Array.isArray(z)||(z=[z]);else{logger$1(`must provide one or more modules to patch`),logger$1(Error().stack);return}if(!(G&&Array.isArray(G))){logger$1(`must provide one or more functions to unwrap on modules`);return}z.forEach(z=>{G.forEach(G=>{unwrap$1(z,G)})})};function shimmer$1(z){z&&z.logger&&(typeof z.logger==`function`?logger$1=z.logger:logger$1(`new logger isn't a function, not replacing`))}shimmer$1.wrap=wrap$1,shimmer$1.massWrap=massWrap$1,shimmer$1.unwrap=unwrap$1,shimmer$1.massUnwrap=massUnwrap$1;var InstrumentationAbstract$1=class{constructor(z,G,K){_defineProperty(this,`_config`,{}),_defineProperty(this,`_tracer`,void 0),_defineProperty(this,`_meter`,void 0),_defineProperty(this,`_logger`,void 0),_defineProperty(this,`_diag`,void 0),_defineProperty(this,`instrumentationName`,void 0),_defineProperty(this,`instrumentationVersion`,void 0),_defineProperty(this,`_wrap`,wrap$1),_defineProperty(this,`_unwrap`,unwrap$1),_defineProperty(this,`_massWrap`,massWrap$1),_defineProperty(this,`_massUnwrap`,massUnwrap$1),this.instrumentationName=z,this.instrumentationVersion=G,this.setConfig(K),this._diag=diag$1.createComponentLogger({namespace:z}),this._tracer=trace$1.getTracer(z,G),this._meter=metrics.getMeter(z,G),this._logger=logs.getLogger(z,G),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(z){this._meter=z.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(z){this._logger=z.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var z;let G=(z=this.init())==null?[]:z;return Array.isArray(G)?G:[G]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(z){this._config=_objectSpread2({enabled:!0},z)}setTracerProvider(z){this._tracer=z.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(z,G,K,J){if(z)try{z(K,J)}catch(z){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:G},z)}}},InstrumentationBase$1=class extends InstrumentationAbstract$1{constructor(z,G,K){super(z,G,K),this._config.enabled&&this.enable()}};function safeExecuteInTheMiddle$1(z,G,K){let J,Y;try{Y=z()}catch(z){J=z}finally{if(G(J,Y),J&&!K)throw J;return Y}}var SemconvStability$1;(function(z){z[z.STABLE=1]=`STABLE`,z[z.OLD=2]=`OLD`,z[z.DUPLICATE=3]=`DUPLICATE`})(SemconvStability$1||(SemconvStability$1={}));function semconvStabilityFromStr$1(z,G){let K=SemconvStability$1.OLD,J=G==null?void 0:G.split(`,`).map(z=>z.trim()).filter(z=>z!==``);for(let G of J==null?[]:J)if(G.toLowerCase()===z+`/dup`){K=SemconvStability$1.DUPLICATE;break}else G.toLowerCase()===z&&(K=SemconvStability$1.STABLE);return K}function getStringListFromEnv$1(z){}const otperformance$2=performance,NANOSECOND_DIGITS$2=9,MILLISECONDS_TO_NANOSECONDS$2=Math.pow(10,6),SECOND_TO_NANOSECONDS$3=Math.pow(10,NANOSECOND_DIGITS$2);function millisToHrTime$2(z){let G=z/1e3;return[Math.trunc(G),Math.round(z%1e3*MILLISECONDS_TO_NANOSECONDS$2)]}function hrTime$2(z){return addHrTimes$2(millisToHrTime$2(otperformance$2.timeOrigin),millisToHrTime$2(typeof z==`number`?z:otperformance$2.now()))}function addHrTimes$2(z,G){let K=[z[0]+G[0],z[1]+G[1]];return K[1]>=SECOND_TO_NANOSECONDS$3&&(K[1]-=SECOND_TO_NANOSECONDS$3,K[0]+=1),K}function urlMatches$1(z,G){return typeof G==`string`?z===G:!!z.match(G)}function isUrlIgnored$1(z,G){if(!G)return!1;for(let K of G)if(urlMatches$1(z,K))return!0;return!1}var AttributeNames$1;(function(z){z.COMPONENT=`component`,z.HTTP_STATUS_TEXT=`http.status_text`})(AttributeNames$1||(AttributeNames$1={}));const ATTR_HTTP_HOST$1=`http.host`,ATTR_HTTP_METHOD$1=`http.method`,ATTR_HTTP_REQUEST_BODY_SIZE$1=`http.request.body.size`,ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED$1=`http.request_content_length_uncompressed`,ATTR_HTTP_SCHEME$1=`http.scheme`,ATTR_HTTP_STATUS_CODE$1=`http.status_code`,ATTR_HTTP_URL$1=`http.url`,ATTR_HTTP_USER_AGENT$1=`http.user_agent`,DIAG_LOGGER$1=diag$1.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`});function getFetchBodyLength(...z){if(z[0]instanceof URL||typeof z[0]==`string`){let G=z[1];if(!(G!=null&&G.body))return Promise.resolve();if(G.body instanceof ReadableStream){let{body:z,length:K}=_getBodyNonDestructively(G.body);return G.body=z,K}else return Promise.resolve(getXHRBodyLength$1(G.body))}else{let G=z[0];return G!=null&&G.body?G.clone().text().then(z=>getByteLength$1(z)):Promise.resolve()}}function _getBodyNonDestructively(z){if(!z.pipeThrough)return DIAG_LOGGER$1.warn(`Platform has ReadableStream but not pipeThrough!`),{body:z,length:Promise.resolve(void 0)};let G=0,K,J=new Promise(z=>{K=z}),Y=new TransformStream({start(){},transform(z,K){return _asyncToGenerator(function*(){let J=yield z;G+=J.byteLength,K.enqueue(z)})()},flush(){K(G)}});return{body:z.pipeThrough(Y),length:J}}function isDocument$1(z){return typeof Document<`u`&&z instanceof Document}function getXHRBodyLength$1(z){if(isDocument$1(z))return new XMLSerializer().serializeToString(document).length;if(typeof z==`string`)return getByteLength$1(z);if(z instanceof Blob)return z.size;if(z instanceof FormData)return getFormDataSize$1(z);if(z instanceof URLSearchParams)return getByteLength$1(z.toString());if(z.byteLength!==void 0)return z.byteLength;DIAG_LOGGER$1.warn(`unknown body type`)}const TEXT_ENCODER$1=new TextEncoder;function getByteLength$1(z){return TEXT_ENCODER$1.encode(z).byteLength}function getFormDataSize$1(z){let G=0;for(let[K,J]of z.entries())G+=K.length,J instanceof Blob?G+=J.size:G+=J.length;return G}function normalizeHttpRequestMethod$1(z){let G=getKnownMethods$1(),K=z.toUpperCase();return K in G?K:`_OTHER`}const DEFAULT_KNOWN_METHODS$1={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let knownMethods$1;function getKnownMethods$1(){if(knownMethods$1===void 0){let z;knownMethods$1=DEFAULT_KNOWN_METHODS$1}return knownMethods$1}const HTTP_PORT_FROM_PROTOCOL$1={"https:":`443`,"http:":`80`};function serverPortFromUrl$1(z){let G=Number(z.port||HTTP_PORT_FROM_PROTOCOL$1[z.protocol]);if(G&&!isNaN(G))return G}const VERSION$5=`0.215.0`,OBSERVER_WAIT_TIME_MS$1=300,hasBrowserPerformanceAPI=typeof PerformanceObserver<`u`;var FetchInstrumentation=class extends InstrumentationBase$1{constructor(z={}){super(`@opentelemetry/instrumentation-fetch`,VERSION$5,z),_defineProperty(this,`component`,`fetch`),_defineProperty(this,`version`,VERSION$5),_defineProperty(this,`moduleName`,this.component),_defineProperty(this,`_usedResources`,new WeakSet),_defineProperty(this,`_tasksCount`,0),_defineProperty(this,`_semconvStability`,void 0),this._semconvStability=semconvStabilityFromStr$1(`http`,z==null?void 0:z.semconvStabilityOptIn)}init(){}_addChildSpan(z,G){let K=this.tracer.startSpan(`CORS Preflight`,{startTime:G[PerformanceTimingNames.FETCH_START]},trace$1.setSpan(context.active(),z)),J=!(this._semconvStability&SemconvStability$1.OLD);addSpanNetworkEvents(K,G,this.getConfig().ignoreNetworkEvents,void 0,J),K.end(G[PerformanceTimingNames.RESPONSE_END])}_addFinalSpanAttributes(z,G){let K=parseUrl(G.url);if(this._semconvStability&SemconvStability$1.OLD&&(z.setAttribute(ATTR_HTTP_STATUS_CODE$1,G.status),G.statusText!=null&&z.setAttribute(AttributeNames$1.HTTP_STATUS_TEXT,G.statusText),z.setAttribute(ATTR_HTTP_HOST$1,K.host),z.setAttribute(ATTR_HTTP_SCHEME$1,K.protocol.replace(`:`,``)),typeof navigator<`u`&&z.setAttribute(ATTR_HTTP_USER_AGENT$1,navigator.userAgent)),this._semconvStability&SemconvStability$1.STABLE){z.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE,G.status),z.setAttribute(ATTR_SERVER_ADDRESS,K.hostname);let J=serverPortFromUrl$1(K);J&&z.setAttribute(ATTR_SERVER_PORT,J)}}_addHeaders(z,G){if(!shouldPropagateTraceHeaders(G,this.getConfig().propagateTraceHeaderCorsUrls)){let z={};propagation.inject(context.active(),z),Object.keys(z).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(z instanceof Request)propagation.inject(context.active(),z.headers,{set:(z,G,K)=>z.set(G,typeof K==`string`?K:String(K))});else{let G=new Headers(z.headers);propagation.inject(context.active(),G,{set:(z,G,K)=>z.set(G,typeof K==`string`?K:String(K))}),z.headers=G}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(z,G={}){if(isUrlIgnored$1(z,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let K=``,J={};if(this._semconvStability&SemconvStability$1.OLD){let Y=(G.method||`GET`).toUpperCase();K=`HTTP ${Y}`,J[AttributeNames$1.COMPONENT]=this.moduleName,J[ATTR_HTTP_METHOD$1]=Y,J[ATTR_HTTP_URL$1]=z}if(this._semconvStability&SemconvStability$1.STABLE){let Y=G.method,X=normalizeHttpRequestMethod$1(G.method||`GET`);K||(K=X),J[ATTR_HTTP_REQUEST_METHOD]=X,X!==Y&&(J[ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=Y),J[ATTR_URL_FULL]=z}return this.tracer.startSpan(K,{kind:SpanKind.CLIENT,attributes:J})}_findResourceAndAddNetworkEvents(z,G,K){let J=G.entries;if(!J.length){if(!performance.getEntriesByType)return;J=performance.getEntriesByType(`resource`)}let Y=getResource(G.spanUrl,G.startTime,K,J,this._usedResources,`fetch`);if(Y.mainRequest){let G=Y.mainRequest;this._markResourceAsUsed(G);let K=Y.corsPreFlightRequest;K&&(this._addChildSpan(z,K),this._markResourceAsUsed(K));let J=!(this._semconvStability&SemconvStability$1.OLD);addSpanNetworkEvents(z,G,this.getConfig().ignoreNetworkEvents,void 0,J)}}_markResourceAsUsed(z){this._usedResources.add(z)}_endSpan(z,G,K){let J=millisToHrTime$2(Date.now()),Y=hrTime$2();this._addFinalSpanAttributes(z,K),this._semconvStability&SemconvStability$1.STABLE&&K.status>=400&&(z.setStatus({code:SpanStatusCode.ERROR}),z.setAttribute(ATTR_ERROR_TYPE,String(K.status))),setTimeout(()=>{var K;(K=G.observer)==null||K.disconnect(),this._findResourceAndAddNetworkEvents(z,G,Y),this._tasksCount--,this._clearResources(),z.end(J)},OBSERVER_WAIT_TIME_MS$1)}_patchConstructor(){return z=>{let G=this;return function(...K){if(!G._isEnabled)return z.apply(this,K);let J=this,Y=parseUrl(K[0]instanceof Request?K[0].url:String(K[0])).href,X;X=K[0]instanceof Request?K[1]==null?K[0]:new Request(K[0],K[1]):K[1]||{};let Z=G._createSpan(Y,X);if(!Z)return z.apply(this,K);let Q=G._prepareSpanData(Y);G.getConfig().measureRequestSize&&getFetchBodyLength(...K).then(z=>{z&&(G._semconvStability&SemconvStability$1.OLD&&Z.setAttribute(ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED$1,z),G._semconvStability&SemconvStability$1.STABLE&&Z.setAttribute(ATTR_HTTP_REQUEST_BODY_SIZE$1,z))}).catch(z=>{G._diag.warn(`getFetchBodyLength`,z)});function ee(z,K){G._applyAttributesAfterFetch(z,X,K),G._endSpan(z,Q,{status:K.status||0,statusText:K.message,url:Y})}function te(z,K){G._applyAttributesAfterFetch(z,X,K),K.status>=200&&K.status<400?G._endSpan(z,Q,K):G._endSpan(z,Q,{status:K.status,statusText:K.statusText,url:Y})}function ne(z,K){try{let G=K.clone().body;if(G){let J=G.getReader(),Y=()=>{J.read().then(({done:G})=>{G?te(z,K):Y()},G=>{ee(z,G)})};Y()}else te(z,K)}catch(K){G._diag.error(`Failed to read fetch response body`,K),G._endSpan(z,Q,{status:0,url:Y})}return K}function ie(z,K){try{ee(z,K)}catch(J){G._diag.error(`Failed to end span on fetch error`,J),G._endSpan(z,Q,{status:K.status||0,url:Y})}throw K}return context.with(trace$1.setSpan(context.active(),Z),()=>(G._callRequestHook(Z,X),G._addHeaders(X,Y),G._tasksCount++,z.apply(J,X instanceof Request?[X]:[Y,X]).then(ne.bind(J,Z),ie.bind(J,Z))))}}}_applyAttributesAfterFetch(z,G,K){let J=this.getConfig().applyCustomAttributesOnSpan;J&&safeExecuteInTheMiddle$1(()=>J(z,G,K),z=>{z&&this._diag.error(`applyCustomAttributesOnSpan`,z)},!0)}_callRequestHook(z,G){let K=this.getConfig().requestHook;K&&safeExecuteInTheMiddle$1(()=>K(z,G),z=>{z&&this._diag.error(`requestHook`,z)},!0)}_prepareSpanData(z){let G=hrTime$2(),K=[];if(typeof PerformanceObserver!=`function`)return{entries:K,startTime:G,spanUrl:z};let J=new PerformanceObserver(G=>{G.getEntries().forEach(G=>{G.initiatorType===`fetch`&&G.name===z&&K.push(G)})});return J.observe({entryTypes:[`resource`]}),{entries:K,observer:J,startTime:G,spanUrl:z}}enable(){if(!hasBrowserPerformanceAPI){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}if(!this._isEnabled){if(this._isEnabled=!0,this._isFetchPatched){this._diag.debug(`fetch constructor already patched`);return}this._isFetchPatched=!0,this._wrap(globalThis,`fetch`,this._patchConstructor())}}disable(){hasBrowserPerformanceAPI&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}};function _objectWithoutPropertiesLoose(z,G){if(z==null)return{};var K={};for(var J in z)if({}.hasOwnProperty.call(z,J)){if(G.includes(J))continue;K[J]=z[J]}return K}function _objectWithoutProperties(z,G){if(z==null)return{};var K,J,Y=_objectWithoutPropertiesLoose(z,G);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(z);for(J=0;J<X.length;J++)K=X[J],G.includes(K)||{}.propertyIsEnumerable.call(z,K)&&(Y[K]=z[K])}return Y}const _excluded$2=[`omitIfAlreadyPatched`];var MXLFetchInstrumentation=class extends FetchInstrumentation{constructor(z={}){let{omitIfAlreadyPatched:G}=z,K=_objectWithoutProperties(z,_excluded$2);super(_objectSpread2(_objectSpread2({},K),{},{enabled:!1})),_defineProperty(this,`_omitIfAlreadyPatched`,void 0),this._omitIfAlreadyPatched=G,K.enabled&&this.enable()}enable(){if(this._omitIfAlreadyPatched&&isWrapped$1(fetch)){this._diag.debug("fetch is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation");return}super.enable()}};const PATH_OPTIONS_RE=/\([^()]+\)/g;var NavigationInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z,shouldCleanupPathOptionsFromRouteName:G=!0}){super({instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,config:{}}),_defineProperty(this,`_shouldCleanupPathOptionsFromRouteName`,!0),_defineProperty(this,`_currentRouteSpan`,null),_defineProperty(this,`_instrumentationType`,MXL_NAVIGATION_INSTRUMENTATIONS.Manual),_defineProperty(this,`_removeSessionStartedFn`,null),_defineProperty(this,`_removeSessionEndedFn`,null),_defineProperty(this,`setInstrumentationType`,z=>{this._instrumentationType=z}),_defineProperty(this,`setCurrentRoute`,z=>{if(!this._config.enabled)return;let G=page.getCurrentRoute();z.url!==(G==null?void 0:G.url)&&(page.setCurrentRoute(z),this._endRouteSpan(G),this._startRouteSpan(z))}),_defineProperty(this,`_setupSessionListeners`,()=>{this._removeSessionStartedFn||(this._removeSessionStartedFn=this.sessionManager.addSessionStartedListener(()=>{let z=page.getCurrentRoute();z&&!this._currentRouteSpan&&(this._diag.debug(`Session started, starting route span.`),this._startRouteSpan(z))})),this._removeSessionEndedFn||(this._removeSessionEndedFn=this.sessionManager.addSessionEndedListener(()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan(page.getCurrentRoute()))}))}),_defineProperty(this,`_cleanUpSessionListeners`,()=>{this._removeSessionStartedFn&&(this._removeSessionStartedFn(),this._removeSessionStartedFn=null),this._removeSessionEndedFn&&(this._removeSessionEndedFn(),this._removeSessionEndedFn=null)}),_defineProperty(this,`_startRouteSpan`,z=>{this._diag.debug(`Starting route span for url: ${z.url}`),this._setupSessionListeners();let G=this._shouldCleanupPathOptionsFromRouteName?z.path.replace(PATH_OPTIONS_RE,``):z.path;return this._currentRouteSpan=this.tracer.startSpan(G,{attributes:{[KEY_MXL_TYPE]:MXL_TYPES.Surface,[KEY_MXL_PAGE_PATH]:G,[KEY_MXL_PAGE_ID]:page.getCurrentPageId()||void 0}}),this._currentRouteSpan.setAttribute(KEY_MXL_INSTRUMENTATION,this._instrumentationType),this._currentRouteSpan}),_defineProperty(this,`_endRouteSpan`,z=>{this._currentRouteSpan&&(z&&this._diag.debug(`Ending route span for url: ${z.url}`),this._currentRouteSpan.end(),this._currentRouteSpan=null)}),_defineProperty(this,`enable`,()=>{this.setConfig({enabled:!0}),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}),_defineProperty(this,`disable`,()=>{this._cleanUpSessionListeners(),this.setConfig({enabled:!1}),this._diag.debug(`NavigationInstrumentation disabled, stopped listening for navigation events.`)}),this._shouldCleanupPathOptionsFromRouteName=G,this._config.enabled&&this.enable()}};let navigationInstrumentation;const getNavigationInstrumentation=(z={})=>(navigationInstrumentation||(navigationInstrumentation=new NavigationInstrumentation(z)),navigationInstrumentation),DEFAULT_CONFIG={samplingPct:100,networkSpansForwardingThreshold:0},LOCAL_STORAGE_REMOTE_CONFIG_KEY=`mxl_remote_config`,getConfigURL=(z,{osVersion:G,appVersion:K,deviceId:J},Y)=>`${Y||`https://mxl-basket.apps.ocpthikadev01.safaricom.net`}/config?appId=${z}&osVersion=${G}&appVersion=${K}&deviceId=${J}`,parseRemoteConfig=z=>{let G={samplingPct:z.threshold};return z.network_span_forwarding!==void 0&&(G.networkSpansForwardingThreshold=z.network_span_forwarding.pct_enabled),z.empty_session_avoidance_enabled_pct!==void 0&&(G.emptySessionAvoidanceEnabledPct=z.empty_session_avoidance_enabled_pct),G};var MXLDynamicConfigManager=class{constructor({appID:z,appVersion:G,deviceId:K,diag:J=diag$1.createComponentLogger({namespace:`mxl-config-manager`}),storage:Y=window.localStorage,defaultConfig:X={},mxlConfigURL:Z}={}){_defineProperty(this,`_remoteConfigURL`,null),_defineProperty(this,`_diag`,void 0),_defineProperty(this,`_storage`,void 0),_defineProperty(this,`_sdkConfig`,void 0),_defineProperty(this,`_etag`,null),z&&G&&K&&(this._remoteConfigURL=getConfigURL(z,{appVersion:G,deviceId:K,osVersion:`1`},Z)),this._diag=J,this._storage=Y;let Q=this._getRemoteConfigFromStorage();Q&&(this._etag=Q.etag),this._sdkConfig=_objectSpread2(_objectSpread2(_objectSpread2({},DEFAULT_CONFIG),X),Q?parseRemoteConfig(Q.config):{})}setConfig(z){this._sdkConfig=_objectSpread2(_objectSpread2({},this._sdkConfig),z)}getConfig(){return this._sdkConfig}refreshRemoteConfig(){var z=this;return _asyncToGenerator(function*(){if(z._remoteConfigURL)try{let G=yield z._fetchRemoteConfig(z._remoteConfigURL);if(!G){z._diag.debug(`No changes in remote config, skipping update`);return}let[K,J]=G;z._storage.setItem(LOCAL_STORAGE_REMOTE_CONFIG_KEY,JSON.stringify({config:K,etag:J})),z._sdkConfig=parseRemoteConfig(K),z._etag=J}catch(G){z._diag.warn(`Failed to refresh remote config: ${G instanceof Error?G.message:String(G)}`)}})()}_getRemoteConfigFromStorage(){try{let z=this._storage.getItem(LOCAL_STORAGE_REMOTE_CONFIG_KEY);return z?JSON.parse(z):null}catch(z){return this._diag.warn(`Failed to parse remote config from storage: ${z instanceof Error?z.message:String(z)}`),null}}_fetchRemoteConfig(z){var G=this;return _asyncToGenerator(function*(){let K=yield fetch(z,{headers:G._etag?{"If-None-Match":G._etag}:{}}),J=K.headers.get(`etag`);return K.status===304?null:K.ok?[yield K.json(),J]:(G._diag.warn(`Failed to fetch remote config from ${z}: ${K.statusText}`),null)})()}};const DEFAULT_MAX_LOG_ATTRIBUTES=50,DEFAULT_LIMITS={maxAllowed:{error_log:500,warning_log:200,info_log:100,exception:500,breadcrumb:100,session_property:100,span:1e3,network_request:1e4},maxLength:{error_log:128,warning_log:128,info_log:128,exception:1024,breadcrumb:256,session_property_key:128,session_property_value:256,log_attribute_key:128,log_attribute_value:256,exception_attribute_key:128,exception_attribute_value:256},maxAttributes:{error_log:DEFAULT_MAX_LOG_ATTRIBUTES,warning_log:DEFAULT_MAX_LOG_ATTRIBUTES,info_log:DEFAULT_MAX_LOG_ATTRIBUTES,exception:DEFAULT_MAX_LOG_ATTRIBUTES}},LogSeverityToLimitType={info:`info_log`,warning:`warning_log`,error:`error_log`};var MXLLimitManager=class{constructor({diag:z,maxAllowed:G,maxLength:K,maxAttributes:J}){_defineProperty(this,`_diag`,void 0),_defineProperty(this,`_diagnosticCounts`,{}),_defineProperty(this,`_currentCount`,{exception:0,error_log:0,warning_log:0,info_log:0,breadcrumb:0,session_property:0,span:0,network_request:0}),_defineProperty(this,`_maxAllowed`,void 0),_defineProperty(this,`_maxLength`,void 0),_defineProperty(this,`_maxAttributes`,void 0),this._diag=z==null?diag$1.createComponentLogger({namespace:`MXLLimitManager`}):z,this._maxAllowed=G,this._maxLength=K,this._maxAttributes=J}_dropIfMaxReached(z){return this._currentCount[z]>=this._maxAllowed[z]?(this._diag.warn(`disallowing ${z} because the maximum number of ${this._maxAllowed[z].toString()} has already been reached for this session`),this._incrDiagnosticCount(z,`drop`),!0):(this._currentCount[z]=(this._currentCount[z]||0)+1,!1)}truncateString(z,G){return G.length>this._maxLength[z]?(this._diag.warn(`truncating ${z} because it is longer than ${this._maxLength[z].toString()} characters: "${G}"`),this._incrDiagnosticCount(z,`truncate_string`),G.substring(0,this._maxLength[z])):G}_truncateAttributes(z,G,K,J){let Y=Object.keys(G);Y.length>this._maxAttributes[z]&&(this._diag.warn(`truncating ${z} attributes because there are more than ${this._maxAttributes[z].toString()} set`),this._incrDiagnosticCount(z,`truncate_attributes`));let X={};for(let Q=0;Q<Math.min(Y.length,this._maxAttributes[z]);Q++){var Z;let z=this.truncateString(K,Y[Q]);X[z]=this.truncateString(J,((Z=G[Y[Q]])==null?void 0:Z.toString())||``)}return X}limitBreadcrumb(z){return this._dropIfMaxReached(`breadcrumb`)?`dropped`:{name:this.truncateString(`breadcrumb`,z)}}limitException(z,G){return this._dropIfMaxReached(`exception`)?`dropped`:{message:this.truncateString(`exception`,z),attributes:this._truncateAttributes(`exception`,G,`exception_attribute_key`,`exception_attribute_value`)}}limitLog(z,G,K){let J=LogSeverityToLimitType[G];return this._dropIfMaxReached(J)?`dropped`:{message:this.truncateString(J,z),attributes:this._truncateAttributes(J,K,`log_attribute_key`,`log_attribute_value`)}}limitSessionProperty(z,G){return this._dropIfMaxReached(`session_property`)?`dropped`:{key:this.truncateString(`session_property_key`,z),value:this.truncateString(`session_property_value`,G)}}dropReadableSpan(z){let G=z.attributes[KEY_MXL_TYPE]===MXL_TYPES.Network?`network_request`:`span`;return this._dropIfMaxReached(G)}reset(){this._diagnosticCounts={},this._currentCount={exception:0,error_log:0,warning_log:0,info_log:0,breadcrumb:0,session_property:0,span:0,network_request:0}}_incrDiagnosticCount(z,G){let K=`mxl.app.applied_limit.${z}.${G}.count`;this._diagnosticCounts[K]=(this._diagnosticCounts[K]||0)+1}getDiagnosticCounts(){return this._diagnosticCounts}};const MXL_EXCEPTION_NUMBER_STORAGE_KEY=`mxl_exception_number`,getJSFileBundleIDs=()=>JSON.stringify(GLOBAL_CONFIG._MXLFileBundleIDs||{});var MXLLogManager=class z{constructor({diag:z,perf:G,spanSessionManager:K,limitManager:J,loggerProvider:Y,visibilityDoc:X=window.document,storage:Z=window.localStorage}){_defineProperty(this,`_diag`,void 0),_defineProperty(this,`_perf`,void 0),_defineProperty(this,`_logger`,void 0),_defineProperty(this,`_spanSessionManager`,void 0),_defineProperty(this,`_limitManager`,void 0),_defineProperty(this,`_visibilityDoc`,void 0),_defineProperty(this,`_storage`,void 0);let Q=Y==null?logs:Y;this._diag=z==null?diag$1.createComponentLogger({namespace:`MXLLogManager`}):z,this._perf=G==null?new OTelPerformanceManager:G,this._logger=Q.getLogger(`mxl-web-sdk-logs`),this._spanSessionManager=K,this._limitManager=J,this._visibilityDoc=X,this._storage=Z}_validateAttributes(z){return Object.prototype.toString.call(z)===`[object Object]`?z:(this._diag.warn(`attributes must be a plain object`,z),{})}static _logSeverityToSeverityNumber(z){switch(z){case`info`:return SeverityNumber$1.INFO;case`warning`:return SeverityNumber$1.WARN;default:return SeverityNumber$1.ERROR}}logException(G,{handled:K=!0,attributes:J={},timestamp:Y=this._perf.getNowMillis(),handler:X=`manual`}={}){var Z;let Q=this._validateAttributes(J);K||this._spanSessionManager.incrSessionCountForKey(KEY_MXL_UNHANDLED_EXCEPTIONS_COUNT);let ee=(G==null||(Z=G.constructor)==null?void 0:Z.name)||typeof G,te=``,ne=ee,ie=``,ae=``;if(G instanceof Error)te=String(G.message||``).trim(),ne=G.name||``,ie=G.stack||``,ae=G.cause?`present`:``;else if(G&&typeof G==`object`)try{te=JSON.stringify(G)}catch(z){te=String(G).trim()}else te=String(G).trim();let oe=this._limitManager.limitException(te,Q);oe!==`dropped`&&this._logger.emit({timestamp:Y,severityNumber:SeverityNumber$1.ERROR,severityText:`ERROR`,body:oe.message,attributes:_objectSpread2(_objectSpread2({},oe.attributes),{},{[KEY_MXL_TYPE]:MXL_TYPES.SystemException,[KEY_MXL_EXCEPTION_HANDLING]:z._exceptionHandlingType(K,X),[KEY_MXL_EXCEPTION_CAUSE]:ae,[ATTR_EXCEPTION_TYPE]:ee,"exception.name":ne,[ATTR_EXCEPTION_MESSAGE]:oe.message,[ATTR_EXCEPTION_STACKTRACE]:ie,[KEY_MXL_JS_FILE_BUNDLE_IDS]:getJSFileBundleIDs(),[KEY_MXL_STATE]:getVisibilityState(this._visibilityDoc),[KEY_MXL_EXCEPTION_NUMBER]:getIncrementedCount(this._storage,MXL_EXCEPTION_NUMBER_STORAGE_KEY,this._diag)})})}message(z,G,{attributes:K={},includeStacktrace:J=!0,stacktrace:Y}={}){if(typeof z!=`string`||!z.trim()){this._diag.warn(`Message must be a non-empty string`);return}if(![`info`,`warning`,`error`].includes(G)){this._diag.warn(`Severity must be info, warning, or error`);return}let X=this._validateAttributes(K);G===`error`&&this._spanSessionManager.incrSessionCountForKey(KEY_MXL_ERROR_LOG_COUNT);let Z=``;G!==`info`&&(typeof Y==`string`?Z=Y:J&&(Z=Error().stack||``)),this._logMessage({message:z.trim(),severity:G,timestamp:this._perf.getNowMillis(),attributes:X,stack:Z})}_logMessage({message:G,severity:K,timestamp:J,attributes:Y={},stack:X}){let Z=this._limitManager.limitLog(G,K,Y);Z!==`dropped`&&this._logger.emit({timestamp:J,severityNumber:z._logSeverityToSeverityNumber(K),severityText:K.toUpperCase(),body:Z.message,attributes:_objectSpread2(_objectSpread2(_objectSpread2({},Z.attributes),{},{[KEY_MXL_TYPE]:MXL_TYPES.SystemLog},X?{[KEY_MXL_JS_EXCEPTION_STACKTRACE]:X,[KEY_MXL_JS_FILE_BUNDLE_IDS]:getJSFileBundleIDs()}:{}),{},{[KEY_MXL_STATE]:getVisibilityState(this._visibilityDoc)})})}static _exceptionHandlingType(z,G){return z?`handled`:G===`global_exception`?`unhandled_error`:G===`promise_rejection`?`unhandled_rejection`:`unhandled`}},MXLPageManager=class{constructor({useDocumentTitleAsPageLabel:z=!0,titleDocument:G=window.document}={}){_defineProperty(this,`_currentRoute`,null),_defineProperty(this,`_currentPageId`,null),_defineProperty(this,`_pageLabel`,null),_defineProperty(this,`_titleDocument`,void 0),_defineProperty(this,`_useDocumentTitleAsPageLabel`,void 0),_defineProperty(this,`getCurrentPageId`,()=>this._currentPageId),_defineProperty(this,`getCurrentRoute`,()=>this._currentRoute),_defineProperty(this,`setPageLabel`,z=>{this._pageLabel=z}),_defineProperty(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),_defineProperty(this,`setCurrentRoute`,z=>{(!this._currentRoute||this._currentRoute.url!==z.url)&&(this._currentPageId=generateUUID()),this._currentRoute=z,z.label?this._pageLabel=z.label:this._pageLabel=null}),_defineProperty(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),this._useDocumentTitleAsPageLabel=z,this._titleDocument=G}},MXLSDKFeaturesManager=class{constructor({dynamicConfigManager:z,deviceId:G,blockNetworkSpanForwarding:K}){_defineProperty(this,`_dynamicConfigManager`,void 0),_defineProperty(this,`_deviceId`,void 0),_defineProperty(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=z,this._deviceId=G,this._blockNetworkSpanForwarding=K}isSDKEnabled(){let z=this._dynamicConfigManager.getConfig();return isDeviceIdEnabled(this._deviceId,z.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let z=this._dynamicConfigManager.getConfig();return isDeviceIdEnabled(this._deviceId,z.networkSpansForwardingThreshold)}isEmptySessionAvoidanceEnabled(){let z=this._dynamicConfigManager.getConfig();return isDeviceIdEnabled(this._deviceId,z.emptySessionAvoidanceEnabledPct)}};const TEMPLATE_APP_VERSION=`MXLAppVersionX.X.X`,SDK_VERSION=`0.0.12`,MXL_SERVICE_NAME=`mxl-web-sdk`,NATIVE_FRAMEWORK=1,MXL_APP_INSTANCE_ID_STORAGE_KEY=`mxl_app_instance_id`,getAppInstanceId=(z,G)=>{let K=null;try{K=z.getItem(MXL_APP_INSTANCE_ID_STORAGE_KEY)}catch(z){G.warn(`Failed to retrieve app instance ID from session storage`,z)}if(!K){G.debug(`No existing app instance ID found in session storage, creating a new one`),K=generateUUID();try{z.setItem(MXL_APP_INSTANCE_ID_STORAGE_KEY,K)}catch(z){G.warn(`Failed to persist app instance ID to session storage`,z)}}return K},getWebSDKResource=({diagLogger:z,appVersion:G,pageSessionStorage:K})=>resourceFromAttributes$2({[ATTR_SERVICE_NAME]:MXL_SERVICE_NAME,[ATTR_TELEMETRY_SDK_NAME]:MXL_SERVICE_NAME,app_version:G,app_framework:NATIVE_FRAMEWORK,sdk_version:SDK_VERSION,[ATTR_TELEMETRY_SDK_VERSION]:SDK_VERSION,sdk_simple_version:1,sdk_platform:`web`,[ATTR_TELEMETRY_SDK_LANGUAGE]:`webjs`,[KEY_MXL_APP_INSTANCE_ID]:getAppInstanceId(K,z),[ATTR_USER_AGENT_ORIGINAL]:window.navigator.userAgent,screen_resolution:`${window.screen.width}x${window.screen.height}`});var MXLExtendedSpan=class{constructor(z){_defineProperty(this,`_span`,void 0),this._span=z}get attributes(){return this._span.attributes}addEvent(z,G,K){return this._span.addEvent(z,G,K),this}addLink(z){return this._span.addLink(z),this}addLinks(z){return this._span.addLinks(z),this}end(z){this._span.end(z)}isRecording(){return this._span.isRecording()}recordException(z,G){this._span.recordException(z,G)}setAttribute(z,G){return this._span.setAttribute(z,G),this}setAttributes(z){return this._span.setAttributes(z),this}removeAttribute(z){let G=this._span.attributes,{[z]:K}=G,J=_objectWithoutProperties(G,[z].map(toPropertyKey));return this._span.attributes=J,this}setStatus(z){return this._span.setStatus(z),this}spanContext(){return this._span.spanContext()}updateName(z){return this._span.updateName(z),this}fail(z={code:`failure`}){z.code&&this._span.setAttribute(KEY_MXL_ERROR_CODE,z.code.toUpperCase()),this._span.end(z.endTime)}};const MXL_SESSION_NUMBER_STORAGE_KEY=`mxl_session_number`,MXL_TAB_STORAGE_KEY=`mxl_tab`,MXL_TAB_ACTIVITY_STORAGE_KEY=`mxl_tab_activity`;var MXLSpanSessionManager=class{constructor({diag:z,perf:G,visibilityDoc:K=window.document,storage:J=window.localStorage,sessionStorage:Y=window.sessionStorage,limitManager:X,referrer:Z=document.referrer}){_defineProperty(this,`_previousSessionId`,null),_defineProperty(this,`_activeSessionId`,null),_defineProperty(this,`_activeSessionStartTime`,null),_defineProperty(this,`_sessionSpan`,null),_defineProperty(this,`_activeSessionCounts`,null),_defineProperty(this,`_nextSessionCounts`,{}),_defineProperty(this,`_coldStart`,!0),_defineProperty(this,`_sdkStartupDuration`,0),_defineProperty(this,`_sessionStartedListeners`,[]),_defineProperty(this,`_sessionEndedListeners`,[]),_defineProperty(this,`_tab`,void 0),_defineProperty(this,`_navigationSource`,void 0),_defineProperty(this,`_referrerInfo`,void 0),_defineProperty(this,`_tracer`,void 0),_defineProperty(this,`_noExportTracer`,void 0),_defineProperty(this,`_diag`,void 0),_defineProperty(this,`_perf`,void 0),_defineProperty(this,`_visibilityDoc`,void 0),_defineProperty(this,`_storage`,void 0),_defineProperty(this,`_sessionStorage`,void 0),_defineProperty(this,`_limitManager`,void 0),_defineProperty(this,`_referrer`,void 0),this._diag=z==null?diag$1.createComponentLogger({namespace:`MXLSpanSessionManager`}):z,this._perf=G==null?new OTelPerformanceManager:G,this._visibilityDoc=K,this._storage=J,this._sessionStorage=Y,this._limitManager=X,this._referrer=Z,this._tracer=trace$1.getTracer(`mxl-web-sdk-sessions`),this._noExportTracer=new BasicTracerProvider().getTracer(`mxl-web-sdk-sessions`),this._referrerInfo=this._processReferrer();let Q=this._initTab();this._tab=Q.tab,this._navigationSource=Q.navigationSource,this._setupNewTabClickListeners()}_getPermanentAttributes(){let z=new Map;try{for(let G=0;G<this._storage.length;G++){let K=this._storage.key(G);if(K!=null&&K.startsWith(KEY_PREFIX_MXL_PROPERTIES)){let G=this._storage.getItem(K);G&&z.set(K,G)}}}catch(z){this._diag.warn(`Error loading permanent session properties`,z)}return Object.fromEntries(z.entries())}addBreadcrumb(z){if(!this._sessionSpan){this._diag.debug(`trying to add breadcrumb to a session, but there is no session in progress. This is a no-op.`);return}let G=this._limitManager.limitBreadcrumb(z);G!==`dropped`&&this._sessionSpan.addEvent(`mxl-breadcrumb`,{message:G.name},this._perf.getNowMillis())}addProperty(z,G,K){if(!this._sessionSpan){this._diag.debug(`trying to add properties to a session, but there is no session in progress. This is a no-op.`);return}let J=this._limitManager.limitSessionProperty(z,G);if(J===`dropped`)return;let Y=KEY_PREFIX_MXL_PROPERTIES+J.key;if(this._sessionSpan.setAttribute(Y,J.value),(K==null?void 0:K.lifespan)===`permanent`)try{this._storage.setItem(Y,G)}catch(z){this._diag.warn(`Failed to set permanent session property`,z)}}removeProperty(z){if(!this._sessionSpan){this._diag.debug(`trying to remove a session property, but there is no session in progress. This is a no-op.`);return}let G=KEY_PREFIX_MXL_PROPERTIES+this._limitManager.truncateString(`session_property_key`,z);this._sessionSpan.removeAttribute(G);try{this._storage.getItem(G)&&this._storage.removeItem(G)}catch(z){this._diag.warn(`Error removing permanent session property`,z)}}endSessionSpan(){this.endSessionSpanInternal(`manual`)}endSessionSpanInternal(z){if(!this._sessionSpan){this._diag.debug(`trying to end a session, but there is no session in progress. This is a no-op.`);return}for(let z of this._sessionEndedListeners)try{z()}catch(z){this._diag.warn(`Error while executing session ended listener`,z)}this._sessionSpan.setAttributes(this._endSessionSpanAttributes(z)),this._sessionSpan.end(),this._sessionSpan=null,this._activeSessionStartTime=null,this._previousSessionId=this._activeSessionId,this._activeSessionId=null,this._activeSessionCounts=null,this._limitManager.reset()}_endSessionSpanAttributes(z){return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},this._getPermanentAttributes()),{},{[KEY_MXL_SESSION_REASON_ENDED]:z},this._activeSessionCounts),this._limitManager.getDiagnosticCounts()),{},{[KEY_MXL_SDK_STARTUP_DURATION]:this._sdkStartupDuration})}currentSessionAsReadableSpan(z){if(!this._sessionSpan||!this._activeSessionStartTime)return this._diag.debug(`trying to end a session, but there is no session in progress. This is a no-op.`),null;let G=this._noExportTracer.startSpan(`mxl-session`,{startTime:this._activeSessionStartTime,attributes:_objectSpread2(_objectSpread2(_objectSpread2({},this._sessionSpan.attributes),this._endSessionSpanAttributes(z)),{},{[KEY_MXL_FROM_STORAGE]:!0})});return G.end(),G}getSessionId(){return this._activeSessionId}getPreviousSessionId(){return this._previousSessionId}getSessionSpan(){return this._sessionSpan}getSessionStartTime(){return this._activeSessionStartTime}startSessionSpan(z){this._sessionSpan&&this.endSessionSpanInternal(`manual`),this._activeSessionId=generateUUID(),this._activeSessionStartTime=this._perf.getNowHRTime(),this._activeSessionCounts={};let G=this._nextSessionCounts;this._nextSessionCounts={};let K=_objectSpread2(_objectSpread2({},this._getPermanentAttributes()),{},{[KEY_MXL_TYPE]:MXL_TYPES.Session,[KEY_MXL_STATE]:getVisibilityState(this._visibilityDoc),[ATTR_SESSION_ID$1]:this._activeSessionId,[KEY_MXL_COLD_START]:this._coldStart,[KEY_MXL_SESSION_NUMBER]:getIncrementedCount(this._storage,MXL_SESSION_NUMBER_STORAGE_KEY,this._diag),[KEY_MXL_EXPERIENCE_ID]:this._tab.experienceId,[KEY_MXL_TAB_ID]:this._tab.tabId,[KEY_MXL_NAVIGATION_SOURCE]:this._navigationSource},G);this._referrerInfo.isValid&&this._referrerInfo.scrubbedUrl&&(K[KEY_MXL_REFERRER_URL]=this._referrerInfo.scrubbedUrl),this._tab.sourceTabId&&(K[KEY_MXL_SOURCE_TAB_ID]=this._tab.sourceTabId),z!=null&&z.reason&&(K[KEY_MXL_SESSION_REASON_STARTED]=z.reason),this._sessionSpan=new MXLExtendedSpan(this._tracer.startSpan(`mxl-session`,{attributes:K})),this._coldStart=!1;for(let z of this._sessionStartedListeners)try{z()}catch(z){this._diag.warn(`Error while executing session started listener`,z)}}incrSessionCountForKey(z){if(!this._sessionSpan||!this._activeSessionCounts){this._diag.debug(`trying to increment a count for the active session, but there is no session in progress. This is a no-op.`);return}this._activeSessionCounts[z]=(this._activeSessionCounts[z]||0)+1}incrNextSessionCountForKey(z){this._nextSessionCounts[z]=(this._nextSessionCounts[z]||0)+1}addSessionStartedListener(z){let G=this._sessionStartedListeners.push(z);return()=>{this._sessionStartedListeners.splice(G-1,1)}}addSessionEndedListener(z){let G=this._sessionEndedListeners.push(z);return()=>{this._sessionEndedListeners.splice(G-1,1)}}recordSDKStartupDuration(z){this._sdkStartupDuration=Math.ceil(z)}setTracerProvider(z){this._tracer=z.getTracer(`mxl-web-sdk-sessions`)}_determineNavigationSource(){try{let z=window.performance.getEntriesByType(`navigation`);if(z.length>0&&z[0]){let G=z[0];if(G.type===`reload`)return`reload`;if(G.type===`back_forward`)return`back_forward`}}catch(z){this._diag.warn(`Failed to get navigation type`,z)}return this._referrerInfo.isValid?this._referrerInfo.isSameOrigin?`same_origin`:`external`:`direct`}_processReferrer(){if(!this._referrer)return{isValid:!1,isSameOrigin:!1};try{let z=new URL(this._referrer),G=window.location.origin;return{isValid:!0,isSameOrigin:z.origin===G,scrubbedUrl:z.origin+z.pathname}}catch(z){return{isValid:!1,isSameOrigin:!1}}}_getTabContext(z){var G;let K=getAppInstanceId(this._sessionStorage,this._diag),J,Y;if(z===`same_origin`){let z=this._getTabActivity();z&&Date.now()-z.lastActivityMs<=1e4&&(J=z.tabId,Y=z.experienceId)}return Y!=null||(Y=generateUUID()),{sourceTabId:J,experienceId:Y,tabId:K}}_initTab(){let z=this._determineNavigationSource();try{let G=this._sessionStorage.getItem(MXL_TAB_STORAGE_KEY);if(G)return{tab:JSON.parse(G),navigationSource:z}}catch(z){this._diag.warn(`Failed to retrieve tab data`,z)}let G=this._getTabContext(z),K={experienceId:G.experienceId,sourceTabId:G.sourceTabId,tabId:G.tabId};try{this._sessionStorage.setItem(MXL_TAB_STORAGE_KEY,JSON.stringify(K))}catch(z){this._diag.warn(`Failed to store tab data`,z)}return{tab:K,navigationSource:z}}_getTabActivity(){try{let z=this._storage.getItem(MXL_TAB_ACTIVITY_STORAGE_KEY);return z?JSON.parse(z):null}catch(z){return this._diag.warn(`Failed to retrieve tab activity`,z),null}}_storeTabActivity(z){try{this._storage.setItem(MXL_TAB_ACTIVITY_STORAGE_KEY,JSON.stringify(z))}catch(z){this._diag.warn(`Failed to save tab activity`,z)}}_storeCurrentTabAsSource(){let z={tabId:this._tab.tabId,experienceId:this._tab.experienceId,lastActivityMs:Date.now()};this._storeTabActivity(z)}_setupNewTabClickListeners(){let z=z=>{var G;if(z.button===1||z.ctrlKey||z.metaKey||z.shiftKey){this._storeCurrentTabAsSource();return}(G=z.target)!=null&&G.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&this._storeCurrentTabAsSource()},G={capture:!0,passive:!0};document.addEventListener(`auxclick`,z,G),document.addEventListener(`click`,z,G)}},MXLTraceManager=class{constructor({tracerProvider:z}={}){_defineProperty(this,`_tracer`,void 0),_defineProperty(this,`setSpan`,trace$1.setSpan),this._tracer=(z==null?trace$1:z).getTracer(`mxl-web-sdk-traces`)}startSpan(z,G={},K){G.attributes=G.attributes?G.attributes:{},G.attributes[KEY_MXL_TYPE]=MXL_TYPES.Perf;let J=G.parentSpan?trace$1.setSpan(context.active(),G.parentSpan):K;return new MXLExtendedSpan(this._tracer.startSpan(z,G,J))}getSpan(z){let G=trace$1.getSpan(z);if(G)return new MXLExtendedSpan(G)}};const MXL_USER_STORAGE_KEY_DEPRECATED=`mxl_user`,MXL_USER_ID_STORAGE_KEY=`mxl_user_id`,MXL_EXTERNAL_USER_ID_KEY=`mxl_external_user_id`,isUser=z=>typeof z[KEY_ENDUSER_PSEUDO_ID]==`string`&&z[KEY_ENDUSER_PSEUDO_ID].length===32,isUserId=z=>typeof z==`string`&&z.length===32;var MXLUserManager=class{constructor({diag:z,storage:G=window.localStorage}={}){_defineProperty(this,`_diag`,void 0),_defineProperty(this,`_storage`,void 0),_defineProperty(this,`_mxlUserId`,null),this._diag=z==null?diag$1.createComponentLogger({namespace:`MXLUserManager`}):z,this._storage=G,this._migrateOldLocalStorageKey(),this._initialSetup()}getMXLUserId(){return this._mxlUserId||this._generateNewMXLUserId()}setMXLUserId(z){this._mxlUserId=z;try{this._storage.setItem(MXL_USER_ID_STORAGE_KEY,z)}catch(z){this._diag.warn(`Failed to persist user object for storage, keeping it in-memory only`,z)}}clearMXLUserId(){this._mxlUserId=null;try{this._storage.removeItem(MXL_USER_ID_STORAGE_KEY)}catch(z){this._diag.warn(`Failed to remove mxl user in storage`,z)}}_migrateOldLocalStorageKey(){try{let z=this._storage.getItem(MXL_USER_STORAGE_KEY_DEPRECATED);if(z){let G=JSON.parse(z);isUser(G)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(MXL_USER_ID_STORAGE_KEY,G[KEY_ENDUSER_PSEUDO_ID]),this._storage.removeItem(MXL_USER_STORAGE_KEY_DEPRECATED)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(MXL_USER_STORAGE_KEY_DEPRECATED))}}catch(z){this._diag.warn(`Failed to get old user data from storage`,z)}}_initialSetup(){try{let z=this._storage.getItem(MXL_USER_ID_STORAGE_KEY);z?isUserId(z)?this._mxlUserId=z:(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(z){this._diag.warn(`Failed to get mxl user id from storage, defaulting to a new one`,z)}this._mxlUserId||(this._mxlUserId=this._generateNewMXLUserId())}_generateNewMXLUserId(){let z=generateUUID();return this.setMXLUserId(z),z}getUserId(){try{return this._storage.getItem(MXL_EXTERNAL_USER_ID_KEY)}catch(z){return this._diag.warn(`Failed to retrieve user id from storage`,z),null}}setUserId(z){try{this._storage.setItem(MXL_EXTERNAL_USER_ID_KEY,z)}catch(z){this._diag.warn(`Failed to store user id`,z)}}clearUserId(){try{this._storage.removeItem(MXL_EXTERNAL_USER_ID_KEY)}catch(z){this._diag.warn(`Failed to clear user id`,z)}}};const TIMEOUT_TIME$1=1800*1e3,EVENT_THROTTLING_TIME_WINDOW=30*1e3,WINDOW_USER_EVENTS=[`keydown`,`mousedown`,`mousemove`,`scroll`];var SpanSessionBrowserActivityInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z}={}){super({instrumentationName:`SpanSessionBrowserActivityInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,config:{}}),_defineProperty(this,`_onActivityThrottled`,void 0),_defineProperty(this,`_activityTimeout`,void 0),_defineProperty(this,`disable`,()=>{bulkRemoveEventListener({target:window,events:WINDOW_USER_EVENTS,callback:this._onActivityThrottled}),this._activityTimeout&&clearTimeout(this._activityTimeout),this._activityTimeout=null}),_defineProperty(this,`enable`,()=>{bulkAddEventListener({target:window,events:WINDOW_USER_EVENTS,callback:this._onActivityThrottled})}),_defineProperty(this,`_onInactivity`,()=>{this._diag.debug(`Inactivity detected`),this._activityTimeout&&clearTimeout(this._activityTimeout),this._activityTimeout=null,this.sessionManager.endSessionSpanInternal(`inactivity`)}),_defineProperty(this,`_onActivity`,()=>{this._diag.debug(`Activity detected`),this._activityTimeout&&clearTimeout(this._activityTimeout),this.sessionManager.getSessionId()||this.sessionManager.startSessionSpan({reason:`activity`}),this._activityTimeout=setTimeout(this._onInactivity,TIMEOUT_TIME$1)}),this._activityTimeout=null,this._onActivityThrottled=throttle$1(this._onActivity,EVENT_THROTTLING_TIME_WINDOW),this._config.enabled&&this.enable()}},SpanSessionOnLoadInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z}={}){super({instrumentationName:`SpanSessionOnLoadInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,config:{}}),this._config.enabled&&this.enable()}disable(){this.sessionManager.endSessionSpanInternal(`unknown`)}enable(){this.sessionManager.startSessionSpan({reason:`init`})}};const TIMEOUT_TIME=14400*1e3;var SpanSessionTimeoutInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z,perf:G}={}){super({instrumentationName:`SpanSessionTimeoutInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,perf:G,config:{}}),_defineProperty(this,`_sessionTimeout`,void 0),_defineProperty(this,`disable`,()=>{this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=null}),_defineProperty(this,`enable`,()=>{this._checkTimeout()}),_defineProperty(this,`_onTimeout`,()=>{this._diag.debug(`Timeout detected`),this._sessionTimeout&&clearTimeout(this._sessionTimeout),this.sessionManager.endSessionSpanInternal(`timer`),this.sessionManager.startSessionSpan({reason:`timer`}),this._sessionTimeout=setTimeout(this._checkTimeout,TIMEOUT_TIME)}),_defineProperty(this,`_checkTimeout`,()=>{let z=this.sessionManager.getSessionStartTime();if(z){let G=TIMEOUT_TIME-this.perf.millisSinceHRTime(z);if(G<=0){this._onTimeout();return}this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=setTimeout(this._checkTimeout,G);return}this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=setTimeout(this._checkTimeout,TIMEOUT_TIME)}),this._sessionTimeout=null,this._config.enabled&&this.enable()}};const SESSION_INTERACTION_EVENTS=[`mousedown`];var SpanSessionVisibilityInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z,perf:G,visibilityWaitTimeMs:K=0,limitedSessionMaxDurationMs:J=5e3,backgroundSessions:Y=!1,maxPendingSpanCount:X=5,visibilityDoc:Z=window.document}={},Q,ee){super({instrumentationName:`SpanSessionVisibilityInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,perf:G,config:{}}),_defineProperty(this,`_currentVisibilityState`,void 0),_defineProperty(this,`_checkVisibilityTimeout`,void 0),_defineProperty(this,`_interactionSinceLastVisibilityChange`,void 0),_defineProperty(this,`_avoidEndingLimitedSessions`,void 0),_defineProperty(this,`_mxlSpanProcessor`,void 0),_defineProperty(this,`_checkVisibilityChange`,void 0),_defineProperty(this,`_onVisibilityChange`,void 0),_defineProperty(this,`_onInteractionThrottled`,void 0),this._currentVisibilityState=Z.visibilityState,this._checkVisibilityTimeout=null,this._interactionSinceLastVisibilityChange=!1,this._avoidEndingLimitedSessions=J>0&&Q.isEmptySessionAvoidanceEnabled(),this._mxlSpanProcessor=ee,this._checkVisibilityChange=()=>{if(K<=0){this._currentVisibilityState=Z.visibilityState,this._onVisibilityChange();return}if(this._checkVisibilityTimeout&&clearTimeout(this._checkVisibilityTimeout),Z.visibilityState===`visible`&&this._currentVisibilityState!==Z.visibilityState){this._currentVisibilityState=Z.visibilityState,this._onVisibilityChange();return}this._diag.debug(`Visibility changed to ${Z.visibilityState}. Will wait ${(K/1e3).toString()}s, and check if visibility changed`),this._checkVisibilityTimeout=setTimeout(()=>{this._currentVisibilityState===Z.visibilityState?this._diag.debug(`Visibility was not changed after timeout happened: ${Z.visibilityState}`):(this._currentVisibilityState=Z.visibilityState,this._onVisibilityChange())},K)},this._onVisibilityChange=()=>{this._diag.debug(`Visibility change detected: ${Z.visibilityState}`);let z=this.sessionManager.getSessionStartTime();if(this._avoidEndingLimitedSessions&&z!==null&&this.perf.millisSinceHRTime(z)<J&&!this._interactionSinceLastVisibilityChange&&this._mxlSpanProcessor&&this._mxlSpanProcessor.getPendingSpansCount()<X){this._diag.debug(`Not ending the session since it is considered limited`),this.sessionManager.addBreadcrumb(`Tab visibility changed to ${Z.visibilityState}`);let z=this.sessionManager.getSessionId();if(z){let G=this.sessionManager.currentSessionAsReadableSpan(`state_changed`);G&&this._mxlSpanProcessor.storePendingSpans(z,G)}}else{let z=this.sessionManager.getSessionId();this._mxlSpanProcessor&&z&&this._mxlSpanProcessor.clearStoredSpans(z),this.sessionManager.endSessionSpanInternal(`state_changed`),Z.visibilityState===`hidden`&&Y?(this._diag.debug("Starting a session since document visibility switched to hidden and `backgroundSessions` is enabled"),this.sessionManager.startSessionSpan({reason:`hidden`})):Z.visibilityState===`visible`&&(this._diag.debug(`Starting a session since document visibility switched to visible`),this.sessionManager.startSessionSpan({reason:`visible`}))}this._interactionSinceLastVisibilityChange=!1},this._onInteractionThrottled=throttle$1(()=>{this._interactionSinceLastVisibilityChange=!0},1e3),this._config.enabled&&this.enable()}disable(){window.removeEventListener(`visibilitychange`,this._checkVisibilityChange),this._avoidEndingLimitedSessions&&bulkRemoveEventListener({target:window,events:SESSION_INTERACTION_EVENTS,callback:this._onInteractionThrottled})}enable(){window.addEventListener(`visibilitychange`,this._checkVisibilityChange),this._avoidEndingLimitedSessions&&bulkAddEventListener({target:window,events:SESSION_INTERACTION_EVENTS,callback:this._onInteractionThrottled})}},t=class{constructor(){_defineProperty(this,`t`,void 0),_defineProperty(this,`o`,0),_defineProperty(this,`i`,[])}u(z){var G;if(z.hadRecentInput)return;let K=this.i[0],J=this.i.at(-1);this.o&&K&&J&&z.startTime-J.startTime<1e3&&z.startTime-K.startTime<5e3?(this.o+=z.value,this.i.push(z)):(this.o=z.value,this.i=[z]),(G=this.t)==null||G.call(this,z)}};const e=()=>{let z=performance.getEntriesByType(`navigation`)[0];if(z&&z.responseStart>0&&z.responseStart<performance.now())return z},n=z=>{if(document.readyState===`loading`)return`loading`;let G=e();if(G){if(z<G.domInteractive)return`loading`;if(G.domContentLoadedEventStart===0||z<G.domContentLoadedEventStart)return`dom-interactive`;if(G.domComplete===0||z<G.domComplete)return`dom-content-loaded`}return`complete`},o=z=>{let G=z.nodeName;return z.nodeType===1?G.toLowerCase():G.toUpperCase().replace(/^#/,``)},i$2=z=>{let G=``;try{for(;(z==null?void 0:z.nodeType)!==9;){let K=z,J=K.id?`#`+K.id:[o(K),...Array.from(K.classList).sort()].join(`.`);if(G.length+J.length>99)return G||J;if(G=G?J+`>`+G:J,K.id)break;z=K.parentNode}}catch(z){}return G},r=new WeakMap;function s(z,G){return r.get(z)||r.set(z,new G),r.get(z)}let a=-1;const c=()=>a,u=z=>{addEventListener(`pageshow`,G=>{G.persisted&&(a=G.timeStamp,z(G))},!0)},f=(z,G,K,J)=>{let Y,X;return Z=>{var Q;G.value>=0&&(Z||J)&&(X=G.value-((Q=Y)==null?0:Q),(X||Y===void 0)&&(Y=G.value,G.delta=X,G.rating=((z,G)=>z>G[1]?`poor`:z>G[0]?`needs-improvement`:`good`)(G.value,K),z(G)))}},d=z=>{requestAnimationFrame(()=>requestAnimationFrame(z))},l=()=>{var z,G;return(z=(G=e())==null?void 0:G.activationStart)==null?0:z},h=(z,G=-1)=>{let K=e(),J=`navigate`;return c()>=0?J=`back-forward-cache`:K&&(document.prerendering||l()>0?J=`prerender`:document.wasDiscarded?J=`restore`:K.type&&(J=K.type.replace(/_/g,`-`))),{name:z,value:G,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:J}},m=(z,G,K={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(z)){let J=new PerformanceObserver(z=>{queueMicrotask(()=>{G(z.getEntries())})});return J.observe(_objectSpread2({type:z,buffered:!0},K)),J}}catch(z){}},g=z=>{let G=!1;return()=>{G||(z(),G=!0)}};let p=-1;const y=new Set,v=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,b=z=>{if(document.visibilityState===`hidden`){if(z.type===`visibilitychange`)for(let z of y)z();isFinite(p)||(p=z.type===`visibilitychange`?z.timeStamp:0,removeEventListener(`prerenderingchange`,b,!0))}},M=()=>{if(p<0){var z;let G=l(),K=document.prerendering||(z=globalThis.performance.getEntriesByType(`visibility-state`).find(z=>z.name===`hidden`&&z.startTime>=G))==null?void 0:z.startTime;p=K==null?v():K,addEventListener(`visibilitychange`,b,!0),addEventListener(`prerenderingchange`,b,!0),u(()=>{setTimeout(()=>{p=v()})})}return{get firstHiddenTime(){return p},onHidden(z){y.add(z)}}},T=z=>{document.prerendering?addEventListener(`prerenderingchange`,z,!0):z()},E=[1800,3e3],D=(z,G={})=>{T(()=>{let K=M(),J,Y=h(`FCP`),X=m(`paint`,z=>{for(let G of z)G.name===`first-contentful-paint`&&(X.disconnect(),G.startTime<K.firstHiddenTime&&(Y.value=Math.max(G.startTime-l(),0),Y.entries.push(G),J(!0)))});X&&(J=f(z,Y,E,G.reportAllChanges),u(K=>{Y=h(`FCP`),J=f(z,Y,E,G.reportAllChanges),d(()=>{Y.value=performance.now()-K.timeStamp,J(!0)})}))})},L=[.1,.25],S=z=>z.find(z=>{var G;return((G=z.node)==null?void 0:G.nodeType)===1})||z[0],P=(z,G={})=>{let K=s(G=Object.assign({},G),t),J=new WeakMap;K.t=z=>{var K;if(!(z==null||(K=z.sources)==null)&&K.length){let K=S(z.sources),Z=K==null?void 0:K.node;if(Z){var Y,X;let z=(Y=(X=G.generateTarget)==null?void 0:X.call(G,Z))==null?i$2(Z):Y;J.set(K,z)}}},((z,G={})=>{let K=M();D(g(()=>{let J,Y=h(`CLS`,0),X=s(G,t),Z=z=>{for(let G of z)X.u(G);X.o>Y.value&&(Y.value=X.o,Y.entries=X.i,J())},Q=m(`layout-shift`,Z);Q&&(J=f(z,Y,L,G.reportAllChanges),K.onHidden(()=>{Z(Q.takeRecords()),J(!0)}),u(()=>{X.o=0,Y=h(`CLS`,0),J=f(z,Y,L,G.reportAllChanges),d(J)}),setTimeout(J))}))})(G=>{z((z=>{let G={};if(z.entries.length){var K;let Y=z.entries.reduce((z,G)=>z.value>G.value?z:G);if(!(Y==null||(K=Y.sources)==null)&&K.length){let z=S(Y.sources);z&&(G={largestShiftTarget:J.get(z),largestShiftTime:Y.startTime,largestShiftValue:Y.value,largestShiftSource:z,largestShiftEntry:Y,loadState:n(Y.startTime)})}}return Object.assign(z,{attribution:G})})(G))},G)},w=(z,G={})=>{D(G=>{z((z=>{let G={timeToFirstByte:0,firstByteToFCP:z.value,loadState:n(c())};if(z.entries.length){let K=e(),J=z.entries.at(-1);if(K){let Y=K.activationStart||0,X=Math.max(0,K.responseStart-Y);G={timeToFirstByte:X,firstByteToFCP:z.value-X,loadState:n(z.entries[0].startTime),navigationEntry:K,fcpEntry:J}}}return Object.assign(z,{attribution:G})})(G))},G)};let _=0,k=1/0,F=0;const B=z=>{for(let G of z)G.interactionId&&(k=Math.min(k,G.interactionId),F=Math.max(F,G.interactionId),_=F?(F-k)/7+1:0)};let C;const O=()=>{var z;return C?_:(z=performance.interactionCount)==null?0:z},j=()=>{`interactionCount`in performance||C||(C=m(`event`,B,{durationThreshold:0}))};let I=0;var A=class{constructor(){_defineProperty(this,`l`,[]),_defineProperty(this,`h`,new Map),_defineProperty(this,`m`,void 0),_defineProperty(this,`p`,void 0)}v(){I=O(),this.l.length=0,this.h.clear()}M(){let z=Math.min(this.l.length-1,Math.floor((O()-I)/50));return this.l[z]}u(z){var G;if((G=this.m)==null||G.call(this,z),!z.interactionId&&z.entryType!==`first-input`)return;let K=this.l.at(-1),J=this.h.get(z.interactionId);if(J||this.l.length<10||z.duration>K.T){var Y;if(J?z.duration>J.T?(J.entries=[z],J.T=z.duration):z.duration===J.T&&z.startTime===J.entries[0].startTime&&J.entries.push(z):(J={id:z.interactionId,entries:[z],T:z.duration},this.h.set(J.id,J),this.l.push(J)),this.l.sort((z,G)=>G.T-z.T),this.l.length>10){let z=this.l.splice(10);for(let G of z)this.h.delete(G.id)}(Y=this.p)==null||Y.call(this,J)}}};const q=z=>{let G=globalThis.requestIdleCallback||setTimeout,K=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)z();else{let J=g(z),Y=-1,X=()=>{K(Y),J()};addEventListener(`visibilitychange`,X,{once:!0,capture:!0}),Y=G(()=>{removeEventListener(`visibilitychange`,X,{capture:!0}),J()})}},W=[200,500],x$1=(z,G={})=>{let K=s(G=Object.assign({},G),A),J=[],Y=[],X=0,Z=new WeakMap,Q=new WeakMap,ee=!1,te=()=>{ee||(q(ne),ee=!0)},ne=()=>{let z=new Set(K.l.map(z=>Z.get(z.entries[0]))),G=Y.length-10;Y=Y.filter((K,J)=>J>=G||z.has(K));let Q=new Set;for(let z of Y){let G=ie(z.startTime,z.processingEnd);for(let z of G)Q.add(z)}J=J.filter(z=>z.startTime>X||Q.has(z)),ee=!1};K.m=z=>{let K=z.startTime+z.duration,J;X=Math.max(X,z.processingEnd);for(let X=Y.length-1;X>=0;X--){let Z=Y[X];if(Math.abs(K-Z.renderTime)<=8){J=Z,J.startTime=Math.min(z.startTime,J.startTime),J.processingStart=Math.min(z.processingStart,J.processingStart),J.processingEnd=Math.max(z.processingEnd,J.processingEnd),!1!==G.includeProcessedEventEntries&&J.entries.push(z);break}}J||(J={startTime:z.startTime,processingStart:z.processingStart,processingEnd:z.processingEnd,renderTime:K,entries:!1===G.includeProcessedEventEntries?[]:[z]},Y.push(J)),(z.interactionId||z.entryType===`first-input`)&&Z.set(z,J),te()},K.p=z=>{if(!Q.get(z)){let Y=z.entries[0].target;if(Y){var K,J;let X=(K=(J=G.generateTarget)==null?void 0:J.call(G,Y))==null?i$2(Y):K;Q.set(z,X)}}};let ie=(z,G)=>{let K=[];for(let Y of J)if(!(Y.startTime+Y.duration<z)){if(Y.startTime>G)break;K.push(Y)}return K},ae=z=>{let G=z.entries[0],J=Z.get(G),Y=G.processingStart,X=Math.max(G.startTime+G.duration,Y),ee=Math.min(J.processingEnd,X),te=J.entries.sort((z,G)=>z.processingStart-G.processingStart),ne=ie(G.startTime,ee),ae=K.h.get(G.interactionId),oe={interactionTarget:Q.get(ae),interactionType:G.name.startsWith(`key`)?`keyboard`:`pointer`,interactionTime:G.startTime,nextPaintTime:X,processedEventEntries:te,longAnimationFrameEntries:ne,inputDelay:Y-G.startTime,processingDuration:ee-Y,presentationDelay:X-ee,loadState:n(G.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(z=>{var G;if(!((G=z.longAnimationFrameEntries)!=null&&G.length))return;let K=z.interactionTime,J=z.inputDelay,Y=z.processingDuration,X,Z,Q=0,ee=0,te=0,ne=0;for(let G of z.longAnimationFrameEntries){ee=ee+G.startTime+G.duration-G.styleAndLayoutStart;for(let z of G.scripts){let G=z.startTime+z.duration;if(G<K)continue;let te=G-Math.max(K,z.startTime),ie=z.duration?te/z.duration*z.forcedStyleAndLayoutDuration:0;Q+=te-ie,ee+=ie,te>ne&&(Z=z.startTime<K+J?`input-delay`:z.startTime>=K+J+Y?`presentation-delay`:`processing-duration`,X=z,ne=te)}}let ie=z.longAnimationFrameEntries.at(-1),ae=ie?ie.startTime+ie.duration:0;ae>=K+J+Y&&(te=z.nextPaintTime-ae),X&&Z&&(z.longestScript={entry:X,subpart:Z,intersectingDuration:ne}),z.totalScriptDuration=Q,z.totalStyleAndLayoutDuration=ee,z.totalPaintDuration=te,z.totalUnattributedDuration=z.nextPaintTime-K-Q-ee-te})(oe),Object.assign(z,{attribution:oe})};m(`long-animation-frame`,z=>{J=J.concat(z),te()}),((z,G={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let K=M();T(()=>{var J;j();let Y,X=h(`INP`),Z=s(G,A),Q=z=>{q(()=>{for(let G of z)Z.u(G);let G=Z.M();G&&G.T!==X.value&&(X.value=G.T,X.entries=G.entries,Y())})},ee=m(`event`,Q,{durationThreshold:(J=G.durationThreshold)==null?40:J});Y=f(z,X,W,G.reportAllChanges),ee&&(ee.observe({type:`first-input`,buffered:!0}),K.onHidden(()=>{Q(ee.takeRecords()),Y(!0)}),u(()=>{Z.v(),X=h(`INP`),Y=f(z,X,W,G.reportAllChanges)}))})})(G=>{z(ae(G))},G)};var N=class{constructor(){_defineProperty(this,`m`,void 0)}u(z){var G;(G=this.m)==null||G.call(this,z)}};const $=[2500,4e3],H=(z,G={})=>{let K=s(G=Object.assign({},G),N),J=new WeakMap;K.m=z=>{let K=z.element;if(K){var Y,X;let Z=(Y=(X=G.generateTarget)==null?void 0:X.call(G,K))==null?i$2(K):Y;J.set(z,Z)}else z.id&&J.set(z,`#${z.id}`)},((z,G={})=>{T(()=>{let K=M(),J,Y=h(`LCP`),X=s(G,N),Z=z=>{G.reportAllChanges||(z=z.slice(-1));for(let G of z)X.u(G),G.startTime<K.firstHiddenTime&&(Y.value=Math.max(G.startTime-l(),0),Y.entries=[G],J())},Q=m(`largest-contentful-paint`,Z);if(Q){J=f(z,Y,$,G.reportAllChanges);let K=g(()=>{Z(Q.takeRecords()),Q.disconnect(),J(!0)}),X=z=>{z.isTrusted&&(q(K),removeEventListener(z.type,X,{capture:!0}))};for(let z of[`keydown`,`click`,`visibilitychange`])addEventListener(z,X,{capture:!0});u(K=>{Y=h(`LCP`),J=f(z,Y,$,G.reportAllChanges),d(()=>{Y.value=performance.now()-K.timeStamp,J(!0)})})}})})(G=>{z((z=>{let G={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:z.value};if(z.entries.length){let K=z.entries.at(-1),Y=K.url&&performance.getEntriesByType(`resource`).find(z=>z.name===K.url);G.target=J.get(K),G.lcpEntry=K,K.url&&(G.url=K.url),Y&&(G.lcpResourceEntry=Y);let X=e();if(X){let K=X.activationStart||0,J=Math.max(0,X.responseStart-K),Z=Math.max(J,Y?(Y.requestStart||Y.startTime)-K:0),Q=Math.min(z.value,Math.max(Z,Y?Y.responseEnd-K:0));G=_objectSpread2(_objectSpread2({},G),{},{timeToFirstByte:J,resourceLoadDelay:Z-J,resourceLoadDuration:Q-Z,elementRenderDelay:z.value-Q,navigationEntry:X})}}return Object.assign(z,{attribution:G})})(G))},G)},R=[800,1800],U=z=>{document.prerendering?T(()=>U(z)):document.readyState===`complete`?setTimeout(z):addEventListener(`load`,()=>U(z),!0)},V=(z,G={})=>{((z,G={})=>{let K=h(`TTFB`),J=f(z,K,R,G.reportAllChanges);U(()=>{let Y=e();Y&&(K.value=Math.max(Y.responseStart-l(),0),K.entries=[Y],J(!0),u(()=>{K=h(`TTFB`,0),J=f(z,K,R,G.reportAllChanges),J(!0)}))})})(G=>{z((z=>{let G={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(z.entries.length){let K=z.entries[0],J=K.activationStart||0,Y=Math.max((K.workerStart||K.fetchStart)-J,0),X=Math.max(K.domainLookupStart-J,0),Z=Math.max(K.connectStart-J,0),Q=Math.max(K.connectEnd-J,0);G={waitingDuration:Y,cacheDuration:X-Y,dnsDuration:Z-X,connectionDuration:Q-Z,requestDuration:z.value-Q,navigationEntry:K}}return Object.assign(z,{attribution:G})})(G))},G)},MXL_WEB_VITALS_PREFIX=`mxl-web-vitals`,ALL_WEB_VITALS=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],WEB_VITALS_ID_TO_LISTENER={CLS:P,FCP:w,LCP:H,INP:x$1,TTFB:V,FID:void 0},webVitalAttributionToReport=(z,G)=>{let K={},J=[];if(z===`CLS`){let z=G.attribution;J.push({key:`largestShiftTarget`,value:z.largestShiftTarget},{key:`largestShiftValue`,value:z.largestShiftValue})}else if(z===`INP`){let z=G.attribution;J.push({key:`interactionTarget`,value:z.interactionTarget},{key:`interactionType`,value:z.interactionType},{key:`nextPaintTime`,value:z.nextPaintTime},{key:`inputDelay`,value:z.inputDelay},{key:`processingDuration`,value:z.processingDuration},{key:`presentationDelay`,value:z.presentationDelay},{key:`totalScriptDuration`,value:z.totalScriptDuration},{key:`totalStyleAndLayoutDuration`,value:z.totalStyleAndLayoutDuration},{key:`totalPaintDuration`,value:z.totalPaintDuration},{key:`totalUnattributedDuration`,value:z.totalUnattributedDuration},{key:`loadState`,value:z.loadState})}else if(z===`LCP`){let z=G.attribution;J.push({key:`target`,value:z.target},{key:`url`,value:z.url},{key:`timeToFirstByte`,value:z.timeToFirstByte},{key:`resourceLoadDelay`,value:z.resourceLoadDelay},{key:`resourceLoadDuration`,value:z.resourceLoadDuration},{key:`elementRenderDelay`,value:z.elementRenderDelay})}return J.forEach(z=>{z.value!==void 0&&(K[`mxl.web_vital.attribution.${z.key}`]=z.value)}),K};var WebVitalsInstrumentation=class extends MXLInstrumentationBase{constructor({diag:z,perf:G,listeners:K=WEB_VITALS_ID_TO_LISTENER,urlDocument:J=window.document,urlAttribution:Y=!0,pageManager:X}={}){super({instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,diag:z,perf:G,config:{}}),_defineProperty(this,`_listeners`,void 0),_defineProperty(this,`_urlDocument`,void 0),_defineProperty(this,`_urlAttribution`,void 0),_defineProperty(this,`_pageManager`,void 0),_defineProperty(this,`_attributedPage`,{INP:void 0,LCP:void 0,CLS:void 0,FCP:void 0,TTFB:void 0}),_defineProperty(this,`_largestShiftTargetForCLS`,void 0),_defineProperty(this,`_listenersRegistered`,!1),_defineProperty(this,`_isEnabled`,!1),this._listeners=K,this._urlDocument=J,this._urlAttribution=Y,this._pageManager=X==null?page.getPageManager():X,this._config.enabled&&this.enable()}disable(){this._isEnabled=!1,this._diag.debug(`WebVitalsInstrumentation disabled, pausing emission`)}enable(){if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug(`WebVitalsInstrumentation listeners already registered, resuming emission`);return}if(this._listenersRegistered=!0,ALL_WEB_VITALS.forEach(z=>{var G,K;(G=(K=this._listeners)[z])==null||G.call(K,G=>{if(!this._isEnabled)return;let K=this.sessionManager.getSessionSpan();if(!K)return;let J=this._getTimeForMetric(G),Y=this._getAttributedPageForMetric(G),X=_objectSpread2({[KEY_MXL_TYPE]:MXL_TYPES.WebVital,[ATTR_URL_FULL]:Y.fullURL,[KEY_BROWSER_URL_FULL]:Y.fullURL,"mxl.web_vital.navigation_type":G.navigationType,"mxl.web_vital.name":G.name,"mxl.web_vital.rating":G.rating,"mxl.web_vital.id":G.id,"mxl.web_vital.delta":G.delta,"mxl.web_vital.value":G.value},webVitalAttributionToReport(z,G));Y.path&&Y.pageID&&(X[KEY_MXL_PAGE_PATH]=Y.path,X[KEY_MXL_PAGE_ID]=Y.pageID),Y.label&&(X[KEY_APP_SURFACE_LABEL]=Y.label),K.addEvent(`${MXL_WEB_VITALS_PREFIX}-report-${z}`,X,J)})}),this._urlAttribution){var z,G,K,J,Y,X,Z,Q,ee,te;(z=(G=this._listeners).TTFB)==null||z.call(G,()=>{this._attributedPage.TTFB=this._currentAttributedPage()},{reportAllChanges:!0}),(K=(J=this._listeners).FCP)==null||K.call(J,()=>{this._attributedPage.FCP=this._currentAttributedPage()},{reportAllChanges:!0}),(Y=(X=this._listeners).INP)==null||Y.call(X,()=>{this._attributedPage.INP=this._currentAttributedPage()},{reportAllChanges:!0}),(Z=(Q=this._listeners).LCP)==null||Z.call(Q,()=>{this._attributedPage.LCP=this._currentAttributedPage()},{reportAllChanges:!0}),(ee=(te=this._listeners).CLS)==null||ee.call(te,z=>{let G=z;this._largestShiftTargetForCLS!==G.attribution.largestShiftTarget&&(this._largestShiftTargetForCLS=G.attribution.largestShiftTarget,this._attributedPage.CLS=this._currentAttributedPage())},{reportAllChanges:!0})}}_getTimeForMetric(z){return z.name===`CLS`&&z.attribution.largestShiftTime?this.perf.epochMillisFromOriginOffset(z.attribution.largestShiftTime):z.name===`INP`&&z.attribution.interactionTime?this.perf.epochMillisFromOriginOffset(z.attribution.interactionTime):this.perf.getNowMillis()}_currentAttributedPage(){let z={fullURL:this._urlDocument.URL},G=this._pageManager.getCurrentRoute(),K=this._pageManager.getCurrentPageId();G&&K&&(z.path=G.path,z.pageID=K);let J=this._pageManager.getPageLabel();return J&&(z.label=J),z}_getAttributedPageForMetric(z){return z.name===`FCP`&&this._attributedPage.FCP?this._attributedPage.FCP:z.name===`TTFB`&&this._attributedPage.TTFB?this._attributedPage.TTFB:z.name===`INP`&&this._attributedPage.INP?this._attributedPage.INP:z.name===`LCP`&&this._attributedPage.LCP?this._attributedPage.LCP:z.name===`CLS`&&this._attributedPage.CLS&&z.attribution.largestShiftTarget===this._largestShiftTargetForCLS?this._attributedPage.CLS:this._currentAttributedPage()}};let logger=console.error.bind(console);function defineProperty(z,G,K){let J=!!z[G]&&Object.prototype.propertyIsEnumerable.call(z,G);Object.defineProperty(z,G,{configurable:!0,enumerable:J,writable:!0,value:K})}const wrap=(z,G,K)=>{if(!z||!z[G]){logger(`no original function `+String(G)+` to wrap`);return}if(!K){logger(`no wrapper function`),logger(Error().stack);return}let J=z[G];if(typeof J!=`function`||typeof K!=`function`){logger(`original object and wrapper must be functions`);return}let Y=K(J,G);return defineProperty(Y,`__original`,J),defineProperty(Y,`__unwrap`,()=>{z[G]===Y&&defineProperty(z,G,J)}),defineProperty(Y,`__wrapped`,!0),defineProperty(z,G,Y),Y},massWrap=(z,G,K)=>{if(z)Array.isArray(z)||(z=[z]);else{logger(`must provide one or more modules to patch`),logger(Error().stack);return}if(!(G&&Array.isArray(G))){logger(`must provide one or more functions to wrap on modules`);return}z.forEach(z=>{G.forEach(G=>{wrap(z,G,K)})})},unwrap=(z,G)=>{if(!z||!z[G]){logger(`no function to unwrap.`),logger(Error().stack);return}let K=z[G];if(!K.__unwrap)logger(`no original to unwrap to -- has `+String(G)+` already been unwrapped?`);else{K.__unwrap();return}},massUnwrap=(z,G)=>{if(z)Array.isArray(z)||(z=[z]);else{logger(`must provide one or more modules to patch`),logger(Error().stack);return}if(!(G&&Array.isArray(G))){logger(`must provide one or more functions to unwrap on modules`);return}z.forEach(z=>{G.forEach(G=>{unwrap(z,G)})})};function shimmer(z){z&&z.logger&&(typeof z.logger==`function`?logger=z.logger:logger(`new logger isn't a function, not replacing`))}shimmer.wrap=wrap,shimmer.massWrap=massWrap,shimmer.unwrap=unwrap,shimmer.massUnwrap=massUnwrap;var InstrumentationAbstract=class{constructor(z,G,K){_defineProperty(this,`_config`,{}),_defineProperty(this,`_tracer`,void 0),_defineProperty(this,`_meter`,void 0),_defineProperty(this,`_logger`,void 0),_defineProperty(this,`_diag`,void 0),_defineProperty(this,`instrumentationName`,void 0),_defineProperty(this,`instrumentationVersion`,void 0),_defineProperty(this,`_wrap`,wrap),_defineProperty(this,`_unwrap`,unwrap),_defineProperty(this,`_massWrap`,massWrap),_defineProperty(this,`_massUnwrap`,massUnwrap),this.instrumentationName=z,this.instrumentationVersion=G,this.setConfig(K),this._diag=diag$1.createComponentLogger({namespace:z}),this._tracer=trace$1.getTracer(z,G),this._meter=metrics.getMeter(z,G),this._logger=logs.getLogger(z,G),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(z){this._meter=z.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(z){this._logger=z.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var z;let G=(z=this.init())==null?[]:z;return Array.isArray(G)?G:[G]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(z){this._config=_objectSpread2({enabled:!0},z)}setTracerProvider(z){this._tracer=z.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(z,G,K,J){if(z)try{z(K,J)}catch(z){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:G},z)}}},InstrumentationBase=class extends InstrumentationAbstract{constructor(z,G,K){super(z,G,K),this._config.enabled&&this.enable()}};function safeExecuteInTheMiddle(z,G,K){let J,Y;try{Y=z()}catch(z){J=z}finally{if(G(J,Y),J&&!K)throw J;return Y}}function isWrapped(z){return typeof z==`function`&&typeof z.__original==`function`&&typeof z.__unwrap==`function`&&z.__wrapped===!0}var SemconvStability;(function(z){z[z.STABLE=1]=`STABLE`,z[z.OLD=2]=`OLD`,z[z.DUPLICATE=3]=`DUPLICATE`})(SemconvStability||(SemconvStability={}));function semconvStabilityFromStr(z,G){let K=SemconvStability.OLD,J=G==null?void 0:G.split(`,`).map(z=>z.trim()).filter(z=>z!==``);for(let G of J==null?[]:J)if(G.toLowerCase()===z+`/dup`){K=SemconvStability.DUPLICATE;break}else G.toLowerCase()===z&&(K=SemconvStability.STABLE);return K}function getStringListFromEnv(z){}const otperformance$1=performance,NANOSECOND_DIGITS$1=9,MILLISECONDS_TO_NANOSECONDS$1=Math.pow(10,6),SECOND_TO_NANOSECONDS$2=Math.pow(10,NANOSECOND_DIGITS$1);function millisToHrTime$1(z){let G=z/1e3;return[Math.trunc(G),Math.round(z%1e3*MILLISECONDS_TO_NANOSECONDS$1)]}function hrTime$1(z){return addHrTimes$1(millisToHrTime$1(otperformance$1.timeOrigin),millisToHrTime$1(typeof z==`number`?z:otperformance$1.now()))}function addHrTimes$1(z,G){let K=[z[0]+G[0],z[1]+G[1]];return K[1]>=SECOND_TO_NANOSECONDS$2&&(K[1]-=SECOND_TO_NANOSECONDS$2,K[0]+=1),K}function urlMatches(z,G){return typeof G==`string`?z===G:!!z.match(G)}function isUrlIgnored(z,G){if(!G)return!1;for(let K of G)if(urlMatches(z,K))return!0;return!1}const ATTR_HTTP_HOST=`http.host`,ATTR_HTTP_METHOD=`http.method`,ATTR_HTTP_REQUEST_BODY_SIZE=`http.request.body.size`,ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=`http.request_content_length_uncompressed`,ATTR_HTTP_SCHEME=`http.scheme`,ATTR_HTTP_STATUS_CODE=`http.status_code`,ATTR_HTTP_URL=`http.url`,ATTR_HTTP_USER_AGENT=`http.user_agent`;var EventNames;(function(z){z.METHOD_OPEN=`open`,z.METHOD_SEND=`send`,z.EVENT_ABORT=`abort`,z.EVENT_ERROR=`error`,z.EVENT_LOAD=`loaded`,z.EVENT_TIMEOUT=`timeout`})(EventNames||(EventNames={}));const DIAG_LOGGER=diag$1.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`});function isDocument(z){return typeof Document<`u`&&z instanceof Document}function getXHRBodyLength(z){if(isDocument(z))return new XMLSerializer().serializeToString(document).length;if(typeof z==`string`)return getByteLength(z);if(z instanceof Blob)return z.size;if(z instanceof FormData)return getFormDataSize(z);if(z instanceof URLSearchParams)return getByteLength(z.toString());if(z.byteLength!==void 0)return z.byteLength;DIAG_LOGGER.warn(`unknown body type`)}const TEXT_ENCODER=new TextEncoder;function getByteLength(z){return TEXT_ENCODER.encode(z).byteLength}function getFormDataSize(z){let G=0;for(let[K,J]of z.entries())G+=K.length,J instanceof Blob?G+=J.size:G+=J.length;return G}function normalizeHttpRequestMethod(z){let G=getKnownMethods(),K=z.toUpperCase();return K in G?K:`_OTHER`}const DEFAULT_KNOWN_METHODS={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let knownMethods;function getKnownMethods(){if(knownMethods===void 0){let z;knownMethods=DEFAULT_KNOWN_METHODS}return knownMethods}const HTTP_PORT_FROM_PROTOCOL={"https:":`443`,"http:":`80`};function serverPortFromUrl(z){let G=Number(z.port||HTTP_PORT_FROM_PROTOCOL[z.protocol]);if(G&&!isNaN(G))return G}const VERSION$4=`0.215.0`;var AttributeNames;(function(z){z.HTTP_STATUS_TEXT=`http.status_text`})(AttributeNames||(AttributeNames={}));const OBSERVER_WAIT_TIME_MS=300;var XMLHttpRequestInstrumentation=class extends InstrumentationBase{constructor(z={}){super(`@opentelemetry/instrumentation-xml-http-request`,VERSION$4,z),_defineProperty(this,`component`,`xml-http-request`),_defineProperty(this,`version`,VERSION$4),_defineProperty(this,`moduleName`,this.component),_defineProperty(this,`_tasksCount`,0),_defineProperty(this,`_xhrMem`,new WeakMap),_defineProperty(this,`_usedResources`,new WeakSet),_defineProperty(this,`_semconvStability`,void 0),this._semconvStability=semconvStabilityFromStr(`http`,z==null?void 0:z.semconvStabilityOptIn)}init(){}_addHeaders(z,G){let K=parseUrl(G).href;if(!shouldPropagateTraceHeaders(K,this.getConfig().propagateTraceHeaderCorsUrls)){let z={};propagation.inject(context.active(),z),Object.keys(z).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let J={};propagation.inject(context.active(),J),Object.keys(J).forEach(G=>{z.setRequestHeader(G,String(J[G]))})}_addChildSpan(z,G){context.with(trace$1.setSpan(context.active(),z),()=>{let z=this.tracer.startSpan(`CORS Preflight`,{startTime:G[PerformanceTimingNames.FETCH_START]}),K=!(this._semconvStability&SemconvStability.OLD);addSpanNetworkEvents(z,G,this.getConfig().ignoreNetworkEvents,void 0,K),z.end(G[PerformanceTimingNames.RESPONSE_END])})}_addFinalSpanAttributes(z,G,K){if(this._semconvStability&SemconvStability.OLD){if(G.status!==void 0&&z.setAttribute(ATTR_HTTP_STATUS_CODE,G.status),G.statusText!==void 0&&z.setAttribute(AttributeNames.HTTP_STATUS_TEXT,G.statusText),typeof K==`string`){let G=parseUrl(K);z.setAttribute(ATTR_HTTP_HOST,G.host),z.setAttribute(ATTR_HTTP_SCHEME,G.protocol.replace(`:`,``))}z.setAttribute(ATTR_HTTP_USER_AGENT,navigator.userAgent)}this._semconvStability&SemconvStability.STABLE&&G.status&&z.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE,G.status)}_applyAttributesAfterXHR(z,G){let K=this.getConfig().applyCustomAttributesOnSpan;typeof K==`function`&&safeExecuteInTheMiddle(()=>K(z,G),z=>{z&&this._diag.error(`applyCustomAttributesOnSpan`,z)},!0)}_addResourceObserver(z,G){let K=this._xhrMem.get(z);!K||typeof PerformanceObserver!=`function`||typeof PerformanceResourceTiming!=`function`||(K.createdResources={observer:new PerformanceObserver(z=>{let J=z.getEntries(),Y=parseUrl(G);J.forEach(z=>{z.initiatorType===`xmlhttprequest`&&z.name===Y.href&&K.createdResources&&K.createdResources.entries.push(z)})}),entries:[]},K.createdResources.observer.observe({entryTypes:[`resource`]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(otperformance$1.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(z,G,K,J,Y){if(!K||!J||!Y||!z.createdResources)return;let X=z.createdResources.entries;(!X||!X.length)&&(X=otperformance$1.getEntriesByType(`resource`));let Z=getResource(parseUrl(K).href,J,Y,X,this._usedResources);if(Z.mainRequest){let z=Z.mainRequest;this._markResourceAsUsed(z);let K=Z.corsPreFlightRequest;K&&(this._addChildSpan(G,K),this._markResourceAsUsed(K));let J=!(this._semconvStability&SemconvStability.OLD);addSpanNetworkEvents(G,z,this.getConfig().ignoreNetworkEvents,void 0,J)}}_cleanPreviousSpanInformation(z){let G=this._xhrMem.get(z);if(G){let K=G.callbackToRemoveEvents;K&&K(),this._xhrMem.delete(z)}}_createSpan(z,G,K){if(isUrlIgnored(G,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let J=``,Y=parseUrl(G),X={};if(this._semconvStability&SemconvStability.OLD&&(J=K.toUpperCase(),X[ATTR_HTTP_METHOD]=K,X[ATTR_HTTP_URL]=Y.toString()),this._semconvStability&SemconvStability.STABLE){let z=K,G=normalizeHttpRequestMethod(K);J||(J=G),X[ATTR_HTTP_REQUEST_METHOD]=G,G!==z&&(X[ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=z),X[ATTR_URL_FULL]=Y.toString(),X[ATTR_SERVER_ADDRESS]=Y.hostname;let Z=serverPortFromUrl(Y);Z&&(X[ATTR_SERVER_PORT]=Z)}let Z=this.tracer.startSpan(J,{kind:SpanKind.CLIENT,attributes:X});return Z.addEvent(EventNames.METHOD_OPEN),this._cleanPreviousSpanInformation(z),this._xhrMem.set(z,{span:Z,spanUrl:G}),Z}_markResourceAsUsed(z){this._usedResources.add(z)}_patchOpen(){return z=>{let G=this;return function(...K){let J=K[0],Y=K[1];return G._createSpan(this,Y,J),z.apply(this,K)}}}_patchSend(){let z=this;function G(G,K,J,Y){let X=K.callbackToRemoveEvents;typeof X==`function`&&X();let{span:Z,spanUrl:Q,sendStartTime:ee}=K;Z&&(z._findResourceAndAddNetworkEvents(K,Z,Q,ee,J),Z.addEvent(G,Y),z._addFinalSpanAttributes(Z,K,Q),Z.end(Y),z._tasksCount--),z._clearResources()}function K(K,J,Y,X){let Z=z._xhrMem.get(J);if(!Z)return;if(Z.status=J.status,Z.statusText=J.statusText,z._xhrMem.delete(J),Z.span){let G=Z.span;z._applyAttributesAfterXHR(G,J),z._semconvStability&SemconvStability.STABLE&&(Y?X&&(G.setStatus({code:SpanStatusCode.ERROR,message:X}),G.setAttribute(ATTR_ERROR_TYPE,X)):Z.status&&Z.status>=400&&(G.setStatus({code:SpanStatusCode.ERROR}),G.setAttribute(ATTR_ERROR_TYPE,String(Z.status))))}let Q=hrTime$1(),ee=Date.now();setTimeout(()=>{G(K,Z,Q,ee)},OBSERVER_WAIT_TIME_MS)}function J(){K(EventNames.EVENT_ERROR,this,!0,`error`)}function Y(){K(EventNames.EVENT_ABORT,this,!1)}function X(){K(EventNames.EVENT_TIMEOUT,this,!0,`timeout`)}function Z(){this.status<299?K(EventNames.EVENT_LOAD,this,!1):K(EventNames.EVENT_ERROR,this,!1)}function Q(G){G.removeEventListener(`abort`,Y),G.removeEventListener(`error`,J),G.removeEventListener(`load`,Z),G.removeEventListener(`timeout`,X);let K=z._xhrMem.get(G);K&&(K.callbackToRemoveEvents=void 0)}return G=>function(...K){let ee=z._xhrMem.get(this);if(!ee)return G.apply(this,K);let te=ee.span,ne=ee.spanUrl;if(te&&ne){if(z.getConfig().measureRequestSize&&K!=null&&K[0]){let G=K[0],J=getXHRBodyLength(G);J!==void 0&&(z._semconvStability&SemconvStability.OLD&&te.setAttribute(ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED,J),z._semconvStability&SemconvStability.STABLE&&te.setAttribute(ATTR_HTTP_REQUEST_BODY_SIZE,J))}context.with(trace$1.setSpan(context.active(),te),()=>{z._tasksCount++,ee.sendStartTime=hrTime$1(),te.addEvent(EventNames.METHOD_SEND),this.addEventListener(`abort`,Y),this.addEventListener(`error`,J),this.addEventListener(`load`,Z),this.addEventListener(`timeout`,X),ee.callbackToRemoveEvents=()=>{Q(this),ee.createdResources&&ee.createdResources.observer.disconnect()},z._addHeaders(this,ne),z._addResourceObserver(this,ne)})}return G.apply(this,K)}}enable(){this._diag.debug(`applying patch to`,this.moduleName,this.version),isWrapped(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,`open`),this._diag.debug(`removing previous patch from method open`)),isWrapped(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.debug(`removing previous patch from method send`)),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend())}disable(){this._diag.debug(`removing patch from`,this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}};const _excluded$1=[`omitIfAlreadyPatched`];var MXLXHRInstrumentation=class extends XMLHttpRequestInstrumentation{constructor(z={}){let{omitIfAlreadyPatched:G}=z,K=_objectWithoutProperties(z,_excluded$1);super(_objectSpread2(_objectSpread2({},K),{},{enabled:!1})),_defineProperty(this,`_omitIfAlreadyPatched`,void 0),this._omitIfAlreadyPatched=G,K.enabled&&this.enable()}enable(){if(this._omitIfAlreadyPatched&&(isWrapped$1(XMLHttpRequest.prototype.open)||isWrapped$1(XMLHttpRequest.prototype.send))){this._diag.debug("XMLHttpRequest is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation");return}super.enable()}};const SUPPRESS_TRACING_KEY$1=createContextKey(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function suppressTracing$1(z){return z.setValue(SUPPRESS_TRACING_KEY$1,!0)}function loggingErrorHandler(){return z=>{diag$1.error(stringifyException(z))}}function stringifyException(z){return typeof z==`string`?z:JSON.stringify(flattenException(z))}function flattenException(z){let G={},K=z;for(;K!==null;)Object.getOwnPropertyNames(K).forEach(z=>{if(G[z])return;let J=K[z];J&&(G[z]=String(J))}),K=Object.getPrototypeOf(K);return G}let delegateHandler=loggingErrorHandler();function globalErrorHandler(z){try{delegateHandler(z)}catch(z){}}const VERSION$3=`2.7.0`,ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,SDK_INFO={[ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[ATTR_PROCESS_RUNTIME_NAME]:`browser`,[ATTR_TELEMETRY_SDK_LANGUAGE]:TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS,[ATTR_TELEMETRY_SDK_VERSION]:VERSION$3},otperformance=performance,NANOSECOND_DIGITS=9,MILLISECONDS_TO_NANOSECONDS=Math.pow(10,6),SECOND_TO_NANOSECONDS$1=Math.pow(10,NANOSECOND_DIGITS);function millisToHrTime(z){let G=z/1e3;return[Math.trunc(G),Math.round(z%1e3*MILLISECONDS_TO_NANOSECONDS)]}function hrTime(z){return addHrTimes(millisToHrTime(otperformance.timeOrigin),millisToHrTime(typeof z==`number`?z:otperformance.now()))}function timeInputToHrTime(z){if(isTimeInputHrTime(z))return z;if(typeof z==`number`)return z<otperformance.timeOrigin?hrTime(z):millisToHrTime(z);if(z instanceof Date)return millisToHrTime(z.getTime());throw TypeError(`Invalid input type`)}function isTimeInputHrTime(z){return Array.isArray(z)&&z.length===2&&typeof z[0]==`number`&&typeof z[1]==`number`}function addHrTimes(z,G){let K=[z[0]+G[0],z[1]+G[1]];return K[1]>=SECOND_TO_NANOSECONDS$1&&(K[1]-=SECOND_TO_NANOSECONDS$1,K[0]+=1),K}var ExportResultCode$1;(function(z){z[z.SUCCESS=0]=`SUCCESS`,z[z.FAILED=1]=`FAILED`})(ExportResultCode$1||(ExportResultCode$1={}));var TimeoutError=class z extends Error{constructor(G){super(G),Object.setPrototypeOf(this,z.prototype)}};function callWithTimeout(z,G){let K,J=new Promise(function(z,J){K=setTimeout(function(){J(new TimeoutError(`Operation timed out.`))},G)});return Promise.race([z,J]).then(z=>(clearTimeout(K),z),z=>{throw clearTimeout(K),z})}var Deferred=class{constructor(){_defineProperty(this,`_promise`,void 0),_defineProperty(this,`_resolve`,void 0),_defineProperty(this,`_reject`,void 0),this._promise=new Promise((z,G)=>{this._resolve=z,this._reject=G})}get promise(){return this._promise}resolve(z){this._resolve(z)}reject(z){this._reject(z)}},BindOnceFuture=class{constructor(z,G){_defineProperty(this,`_isCalled`,!1),_defineProperty(this,`_deferred`,new Deferred),_defineProperty(this,`_callback`,void 0),_defineProperty(this,`_that`,void 0),this._callback=z,this._that=G}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...z){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...z)).then(z=>this._deferred.resolve(z),z=>this._deferred.reject(z))}catch(z){this._deferred.reject(z)}}return this._deferred.promise}};let serviceName;function defaultServiceName(){if(serviceName===void 0)try{let z=globalThis.process.argv0;serviceName=z?`unknown_service:${z}`:`unknown_service`}catch(z){serviceName=`unknown_service`}return serviceName}const isPromiseLike=z=>typeof z==`object`&&!!z&&typeof z.then==`function`;var ResourceImpl=class z{static FromAttributeList(G,K){let J=new z({},K);return J._rawAttributes=guardedRawAttributes(G),J._asyncAttributesPending=G.filter(([z,G])=>isPromiseLike(G)).length>0,J}constructor(z,G){var K;_defineProperty(this,`_rawAttributes`,void 0),_defineProperty(this,`_asyncAttributesPending`,!1),_defineProperty(this,`_schemaUrl`,void 0),_defineProperty(this,`_memoizedAttributes`,void 0);let J=(K=z.attributes)==null?{}:K;this._rawAttributes=Object.entries(J).map(([z,G])=>(isPromiseLike(G)&&(this._asyncAttributesPending=!0),[z,G])),this._rawAttributes=guardedRawAttributes(this._rawAttributes),this._schemaUrl=validateSchemaUrl(G==null?void 0:G.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var z=this;return _asyncToGenerator(function*(){if(z.asyncAttributesPending){for(let G=0;G<z._rawAttributes.length;G++){let[K,J]=z._rawAttributes[G];z._rawAttributes[G]=[K,isPromiseLike(J)?yield J:J]}z._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&diag$1.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let z={};for(let[K,J]of this._rawAttributes){if(isPromiseLike(J)){diag$1.debug(`Unsettled resource attribute ${K} skipped`);continue}if(J!=null){var G;z[K]!=null||(z[K]=J)}}return this._asyncAttributesPending||(this._memoizedAttributes=z),z}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(G){if(G==null)return this;let K=mergeSchemaUrl(this,G),J=K?{schemaUrl:K}:void 0;return z.FromAttributeList([...G.getRawAttributes(),...this.getRawAttributes()],J)}};function resourceFromAttributes(z,G){return ResourceImpl.FromAttributeList(Object.entries(z),G)}function defaultResource(){return resourceFromAttributes({[ATTR_SERVICE_NAME]:defaultServiceName(),[ATTR_TELEMETRY_SDK_LANGUAGE]:SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE],[ATTR_TELEMETRY_SDK_NAME]:SDK_INFO[ATTR_TELEMETRY_SDK_NAME],[ATTR_TELEMETRY_SDK_VERSION]:SDK_INFO[ATTR_TELEMETRY_SDK_VERSION]})}function guardedRawAttributes(z){return z.map(([z,G])=>isPromiseLike(G)?[z,G.catch(G=>{diag$1.debug(`promise rejection for resource attribute: %s - %s`,z,G)})]:[z,G])}function validateSchemaUrl(z){if(typeof z==`string`||z===void 0)return z;diag$1.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,z)}function mergeSchemaUrl(z,G){let K=z==null?void 0:z.schemaUrl,J=G==null?void 0:G.schemaUrl,Y=K===void 0||K===``,X=J===void 0||J===``;if(Y)return J;if(X||K===J)return K;diag$1.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,K,J)}function isLogAttributeValue(z){return isLogAttributeValueInternal(z,new WeakSet)}function isLogAttributeValueInternal(z,G){if(z==null||typeof z==`string`||typeof z==`number`||typeof z==`boolean`||z instanceof Uint8Array)return!0;if(typeof z==`object`){if(G.has(z))return!1;if(G.add(z),Array.isArray(z))return z.every(z=>isLogAttributeValueInternal(z,G));let K=z;return K.constructor!==Object&&K.constructor!==void 0?!1:Object.values(K).every(z=>isLogAttributeValueInternal(z,G))}return!1}var LogRecordImpl=class{set severityText(z){this._isLogRecordReadonly()||(this._severityText=z)}get severityText(){return this._severityText}set severityNumber(z){this._isLogRecordReadonly()||(this._severityNumber=z)}get severityNumber(){return this._severityNumber}set body(z){this._isLogRecordReadonly()||(this._body=z)}get body(){return this._body}get eventName(){return this._eventName}set eventName(z){this._isLogRecordReadonly()||(this._eventName=z)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(z,G,K){_defineProperty(this,`hrTime`,void 0),_defineProperty(this,`hrTimeObserved`,void 0),_defineProperty(this,`spanContext`,void 0),_defineProperty(this,`resource`,void 0),_defineProperty(this,`instrumentationScope`,void 0),_defineProperty(this,`attributes`,{}),_defineProperty(this,`_severityText`,void 0),_defineProperty(this,`_severityNumber`,void 0),_defineProperty(this,`_body`,void 0),_defineProperty(this,`_eventName`,void 0),_defineProperty(this,`_attributesCount`,0),_defineProperty(this,`_droppedAttributesCount`,0),_defineProperty(this,`_isReadonly`,!1),_defineProperty(this,`_logRecordLimits`,void 0);let{timestamp:J,observedTimestamp:Y,eventName:X,severityNumber:Z,severityText:Q,body:ee,attributes:te={},exception:ne,context:ie}=K,ae=Date.now();if(this.hrTime=timeInputToHrTime(J==null?ae:J),this.hrTimeObserved=timeInputToHrTime(Y==null?ae:Y),ie){let z=trace$1.getSpanContext(ie);z&&isSpanContextValid(z)&&(this.spanContext=z)}this.severityNumber=Z,this.severityText=Q,this.body=ee,this.resource=z.resource,this.instrumentationScope=G,this._logRecordLimits=z.logRecordLimits,this._eventName=X,this.setAttributes(te),ne!=null&&this._setException(ne)}setAttribute(z,G){if(this._isLogRecordReadonly())return this;if(z.length===0)return diag$1.warn(`Invalid attribute key: ${z}`),this;if(!isLogAttributeValue(G))return diag$1.warn(`Invalid attribute value set for key: ${z}`),this;let K=!Object.prototype.hasOwnProperty.call(this.attributes,z);return K&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&diag$1.warn(`Dropping extra attributes.`),this):(this.attributes[z]=this._truncateToSize(G),K&&this._attributesCount++,this)}setAttributes(z){for(let[G,K]of Object.entries(z))this.setAttribute(G,K);return this}setBody(z){return this.body=z,this}setEventName(z){return this.eventName=z,this}setSeverityNumber(z){return this.severityNumber=z,this}setSeverityText(z){return this.severityText=z,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(z){let G=this._logRecordLimits.attributeValueLengthLimit;if(G<=0)return diag$1.warn(`Attribute value limit must be positive, got ${G}`),z;if(z==null)return z;if(typeof z==`string`)return this._truncateToLimitUtil(z,G);if(z instanceof Uint8Array)return z;if(Array.isArray(z))return z.map(z=>this._truncateToSize(z));if(typeof z==`object`){let G={};for(let[K,J]of Object.entries(z))G[K]=this._truncateToSize(J);return G}return z}_setException(z){let G=!1;if(typeof z==`string`||typeof z==`number`)Object.hasOwn(this.attributes,ATTR_EXCEPTION_MESSAGE)||this.setAttribute(ATTR_EXCEPTION_MESSAGE,String(z)),G=!0;else if(z&&typeof z==`object`){let K=z;K.code?(Object.hasOwn(this.attributes,ATTR_EXCEPTION_TYPE)||this.setAttribute(ATTR_EXCEPTION_TYPE,K.code.toString()),G=!0):K.name&&(Object.hasOwn(this.attributes,ATTR_EXCEPTION_TYPE)||this.setAttribute(ATTR_EXCEPTION_TYPE,K.name),G=!0),K.message&&(Object.hasOwn(this.attributes,ATTR_EXCEPTION_MESSAGE)||this.setAttribute(ATTR_EXCEPTION_MESSAGE,K.message),G=!0),K.stack&&(Object.hasOwn(this.attributes,ATTR_EXCEPTION_STACKTRACE)||this.setAttribute(ATTR_EXCEPTION_STACKTRACE,K.stack),G=!0)}G||diag$1.warn(`Failed to record an exception ${z}`)}_truncateToLimitUtil(z,G){return z.length<=G?z:z.substring(0,G)}_isLogRecordReadonly(){return this._isReadonly&&diag$1.warn(`Can not execute the operation on emitted log record`),this._isReadonly}},Logger=class{constructor(z,G){_defineProperty(this,`instrumentationScope`,void 0),_defineProperty(this,`_sharedState`,void 0),_defineProperty(this,`_loggerConfig`,void 0),this.instrumentationScope=z,this._sharedState=G,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(z){var G;let K=this._loggerConfig,J=z.context||context.active(),Y=(G=z.severityNumber)==null?SeverityNumber$1.UNSPECIFIED:G;if(Y!==SeverityNumber$1.UNSPECIFIED&&Y<K.minimumSeverity)return;if(K.traceBased){let z=trace$1.getSpanContext(J);if(z&&isSpanContextValid(z)&&(z.traceFlags&TraceFlags.SAMPLED)!==TraceFlags.SAMPLED)return}let X=new LogRecordImpl(this._sharedState,this.instrumentationScope,_objectSpread2({context:J},z));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(X,J),X._makeReadonly()}enabled(z){let G=this._loggerConfig;if(G.disabled)return!1;let K=z==null?void 0:z.severityNumber;if(typeof K==`number`&&K!==SeverityNumber$1.UNSPECIFIED&&K<G.minimumSeverity)return!1;let J=(z==null?void 0:z.context)||context.active();if(G.traceBased){let z=trace$1.getSpanContext(J);if(z&&isSpanContextValid(z)&&(z.traceFlags&TraceFlags.SAMPLED)!==TraceFlags.SAMPLED)return!1}let Y={context:J,instrumentationScope:this.instrumentationScope,severityNumber:z==null?void 0:z.severityNumber,eventName:z==null?void 0:z.eventName};for(let z of this._sharedState.processors)if(!z.enabled||z.enabled(Y))return!0;return!1}},NoopLogRecordProcessor=class{forceFlush(){return Promise.resolve()}onEmit(z,G){}shutdown(){return Promise.resolve()}enabled(z){return!1}},MultiLogRecordProcessor=class{constructor(z,G){_defineProperty(this,`processors`,void 0),_defineProperty(this,`forceFlushTimeoutMillis`,void 0),this.processors=z,this.forceFlushTimeoutMillis=G}forceFlush(){var z=this;return _asyncToGenerator(function*(){let G=z.forceFlushTimeoutMillis;yield Promise.all(z.processors.map(z=>callWithTimeout(z.forceFlush(),G)))})()}onEmit(z,G){this.processors.forEach(K=>K.onEmit(z,G))}shutdown(){var z=this;return _asyncToGenerator(function*(){yield Promise.all(z.processors.map(z=>z.shutdown()))})()}enabled(z){for(let G of this.processors)if(!G.enabled||G.enabled(z))return!0;return!1}};function getInstrumentationScopeKey(z){return`${z.name}@${z.version||``}:${z.schemaUrl||``}`}const METRIC_OTEL_SDK_LOG_CREATED=`otel.sdk.log.created`;var LoggerMetrics=class{constructor(z){_defineProperty(this,`createdLogs`,void 0),this.createdLogs=z.createCounter(METRIC_OTEL_SDK_LOG_CREATED,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}};const VERSION$2=`0.215.0`,DEFAULT_LOGGER_CONFIG={disabled:!1,minimumSeverity:SeverityNumber$1.UNSPECIFIED,traceBased:!1},DEFAULT_LOGGER_CONFIGURATOR=()=>_objectSpread2({},DEFAULT_LOGGER_CONFIG);var LoggerProviderSharedState=class{constructor(z,G,K,J,Y,X){_defineProperty(this,`loggers`,new Map),_defineProperty(this,`activeProcessor`,void 0),_defineProperty(this,`registeredLogRecordProcessors`,[]),_defineProperty(this,`resource`,void 0),_defineProperty(this,`forceFlushTimeoutMillis`,void 0),_defineProperty(this,`logRecordLimits`,void 0),_defineProperty(this,`processors`,void 0),_defineProperty(this,`loggerMetrics`,void 0),_defineProperty(this,`_loggerConfigurator`,void 0),_defineProperty(this,`_loggerConfigs`,new Map),this.resource=z,this.forceFlushTimeoutMillis=G,this.logRecordLimits=K,this.processors=J,J.length>0?(this.registeredLogRecordProcessors=J,this.activeProcessor=new MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new NoopLogRecordProcessor,this._loggerConfigurator=Y==null?DEFAULT_LOGGER_CONFIGURATOR:Y,this.loggerMetrics=new LoggerMetrics(X?X.getMeter(`@opentelemetry/sdk-logs`,VERSION$2):createNoopMeter())}getLoggerConfig(z){let G=getInstrumentationScopeKey(z),K=this._loggerConfigs.get(G);return K||(K=this._loggerConfigurator(z),this._loggerConfigs.set(G,K),K)}};const DEFAULT_LOGGER_NAME=`unknown`;var LoggerProvider=class{constructor(z={}){var G,K,J,Y,X,Z,Q,ee;_defineProperty(this,`_shutdownOnce`,void 0),_defineProperty(this,`_sharedState`,void 0);let te={resource:(G=z.resource)==null?defaultResource():G,forceFlushTimeoutMillis:(K=z.forceFlushTimeoutMillis)==null?3e4:K,logRecordLimits:{attributeCountLimit:(J=(Y=z.logRecordLimits)==null?void 0:Y.attributeCountLimit)==null?128:J,attributeValueLengthLimit:(X=(Z=z.logRecordLimits)==null?void 0:Z.attributeValueLengthLimit)==null?1/0:X},loggerConfigurator:(Q=z.loggerConfigurator)==null?DEFAULT_LOGGER_CONFIGURATOR:Q,processors:(ee=z.processors)==null?[]:ee,meterProvider:z.meterProvider};this._sharedState=new LoggerProviderSharedState(te.resource,te.forceFlushTimeoutMillis,te.logRecordLimits,te.processors,te.loggerConfigurator,te.meterProvider),this._shutdownOnce=new BindOnceFuture(this._shutdown,this)}getLogger(z,G,K){if(this._shutdownOnce.isCalled)return diag$1.warn(`A shutdown LoggerProvider cannot provide a Logger`),NOOP_LOGGER;z||diag$1.warn(`Logger requested without instrumentation scope name.`);let J=z||DEFAULT_LOGGER_NAME,Y=`${J}@${G||``}:${(K==null?void 0:K.schemaUrl)||``}`;return this._sharedState.loggers.has(Y)||this._sharedState.loggers.set(Y,new Logger({name:J,version:G,schemaUrl:K==null?void 0:K.schemaUrl},this._sharedState)),this._sharedState.loggers.get(Y)}forceFlush(){return this._shutdownOnce.isCalled?(diag$1.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(diag$1.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};function waitForResources(z){return _waitForResources.apply(this,arguments)}function _waitForResources(){return _waitForResources=_asyncToGenerator(function*(z){let G=[];for(let K=0,J=z.length;K<J;K++){let J=z[K];J.resource.asyncAttributesPending&&J.resource.waitForAsyncAttributes&&G.push(J.resource.waitForAsyncAttributes())}G!=null&&G.length>0&&(yield Promise.all(G))}),_waitForResources.apply(this,arguments)}var ExportOperation=class{constructor(z,G,K){_defineProperty(this,`_exportCompleted`,void 0),_defineProperty(this,`_exportScheduledPromise`,void 0),_defineProperty(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(z=>{this._exportScheduledResolve=z}),this._exportCompleted=this._executeExport(z,G,K)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(z,G,K){var J=this;return _asyncToGenerator(function*(){try{yield waitForResources(G),yield context.with(suppressTracing$1(context.active()),_asyncToGenerator(function*(){return J._exportWithTimeout(z,G,K)}))}catch(z){globalErrorHandler(z),J._exportScheduledResolve()}})()}_exportWithTimeout(z,G,K){var J=this;return _asyncToGenerator(function*(){return new Promise((Y,X)=>{let Z=setTimeout(()=>{X(Error(`Timeout`))},K);z.export(G,z=>{if(clearTimeout(Z),z.code===ExportResultCode$1.SUCCESS)Y();else{var G;X((G=z.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):G)}}),J._exportScheduledResolve()})})()}},BatchLogRecordProcessorBase=class{constructor(z,G){var K,J,Y,X;_defineProperty(this,`_maxExportBatchSize`,void 0),_defineProperty(this,`_maxQueueSize`,void 0),_defineProperty(this,`_scheduledDelayMillis`,void 0),_defineProperty(this,`_exportTimeoutMillis`,void 0),_defineProperty(this,`_exporter`,void 0),_defineProperty(this,`_currentExport`,null),_defineProperty(this,`_finishedLogRecords`,[]),_defineProperty(this,`_timer`,void 0),_defineProperty(this,`_shutdownOnce`,void 0),_defineProperty(this,`_flushing`,!1),this._exporter=z,this._maxExportBatchSize=(K=G==null?void 0:G.maxExportBatchSize)==null?512:K,this._maxQueueSize=(J=G==null?void 0:G.maxQueueSize)==null?2048:J,this._scheduledDelayMillis=(Y=G==null?void 0:G.scheduledDelayMillis)==null?5e3:Y,this._exportTimeoutMillis=(X=G==null?void 0:G.exportTimeoutMillis)==null?3e4:X,this._shutdownOnce=new BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(diag$1.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(z){this._shutdownOnce.isCalled||this._addToBuffer(z)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(z){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(z),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}_shutdown(){var z=this;return _asyncToGenerator(function*(){z.onShutdown(),yield z._flushAll(),yield z._exporter.shutdown()})()}_flushAll(){var z=this;return _asyncToGenerator(function*(){if(z._flushing)return;z._flushing=!0;let G=z._finishedLogRecords;for(z._finishedLogRecords=[],z._clearTimer(),z._currentExport!==null&&(yield z._exporter.forceFlush(),yield z._currentExport.exportCompleted,z._currentExport=null);G.length>0;){let K;G.length<=z._maxExportBatchSize?(K=G,G=[]):K=G.splice(0,z._maxExportBatchSize);let J=new ExportOperation(z._exporter,K,z._exportTimeoutMillis);z._currentExport=J;try{yield J.exportScheduled,yield z._exporter.forceFlush(),yield J.exportCompleted}catch(z){globalErrorHandler(z)}finally{z._currentExport=null}}z._flushing=!1,z._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let z=this._finishedLogRecords;return this._finishedLogRecords=[],z}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let z=this._extractBatch();if(z===null)return;let G=new ExportOperation(this._exporter,z,this._exportTimeoutMillis);this._currentExport=G,G.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(z=>{this._currentExport=null,globalErrorHandler(z),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},BatchLogRecordProcessor=class extends BatchLogRecordProcessorBase{constructor(z,G){super(z,G),_defineProperty(this,`_visibilityChangeListener`,void 0),_defineProperty(this,`_pageHideListener`,void 0),this._onInit(G)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(z){(z==null?void 0:z.disableAutoFlushOnDocumentHide)===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}};const ATTR_SESSION_ID=`session.id`;var SessionSpanProcessor=class{constructor(z){_defineProperty(this,`_sessionIdProvider`,void 0),this._sessionIdProvider=z}forceFlush(){return _asyncToGenerator(function*(){})()}onStart(z,G){var K;let J=(K=this._sessionIdProvider)==null?void 0:K.getSessionId();J&&z.setAttribute(ATTR_SESSION_ID,J)}onEnd(z){}shutdown(){return _asyncToGenerator(function*(){})()}};function createSessionSpanProcessor(z){return new SessionSpanProcessor(z)}const DEFAULT_CONCURRENCY=5,DEFAULT_MXL_EXPORTER_CONFIG={compression:`gzip`,keepalive:!0,concurrencyLimit:DEFAULT_CONCURRENCY,timeoutMillis:30*1e3},getMXLHeaders=(z,G)=>({"X-MXL-AID":z,"X-MXL-DID":G}),getDataURL=(z,G)=>G||`http://mxl-otelcol.service-availability.apps.ocpthikadev01.safaricom.net`,VERSION$1=`1.9.1`,re=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function _makeCompatibilityCheck(z){let G=new Set([z]),K=new Set,J=z.match(re);if(!J)return()=>!1;let Y={major:+J[1],minor:+J[2],patch:+J[3],prerelease:J[4]};if(Y.prerelease!=null)return function(G){return G===z};function X(z){return K.add(z),!1}function Z(z){return G.add(z),!0}return function(z){if(G.has(z))return!0;if(K.has(z))return!1;let J=z.match(re);if(!J)return X(z);let Q={major:+J[1],minor:+J[2],patch:+J[3],prerelease:J[4]};return Q.prerelease!=null||Y.major!==Q.major?X(z):Y.major===0?Y.minor===Q.minor&&Y.patch<=Q.patch?Z(z):X(z):Y.minor<=Q.minor?Z(z):X(z)}}const isCompatible=_makeCompatibilityCheck(VERSION$1),major=VERSION$1.split(`.`)[0],GLOBAL_OPENTELEMETRY_API_KEY=Symbol.for(`opentelemetry.js.api.${major}`),_global=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function registerGlobal(z,G,K,J=!1){var Y;let X=_global[GLOBAL_OPENTELEMETRY_API_KEY]=(Y=_global[GLOBAL_OPENTELEMETRY_API_KEY])==null?{version:VERSION$1}:Y;if(!J&&X[z]){let G=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${z}`);return K.error(G.stack||G.message),!1}if(X.version!==VERSION$1){let G=Error(`@opentelemetry/api: Registration of version v${X.version} for ${z} does not match previously registered API v${VERSION$1}`);return K.error(G.stack||G.message),!1}return X[z]=G,K.debug(`@opentelemetry/api: Registered a global for ${z} v${VERSION$1}.`),!0}function getGlobal(z){var G,K;let J=(G=_global[GLOBAL_OPENTELEMETRY_API_KEY])==null?void 0:G.version;if(!(!J||!isCompatible(J)))return(K=_global[GLOBAL_OPENTELEMETRY_API_KEY])==null?void 0:K[z]}function unregisterGlobal(z,G){G.debug(`@opentelemetry/api: Unregistering a global for ${z} v${VERSION$1}.`);let K=_global[GLOBAL_OPENTELEMETRY_API_KEY];K&&delete K[z]}var DiagComponentLogger=class{constructor(z){this._namespace=z.namespace||`DiagComponentLogger`}debug(...z){return logProxy(`debug`,this._namespace,z)}error(...z){return logProxy(`error`,this._namespace,z)}info(...z){return logProxy(`info`,this._namespace,z)}warn(...z){return logProxy(`warn`,this._namespace,z)}verbose(...z){return logProxy(`verbose`,this._namespace,z)}};function logProxy(z,G,K){let J=getGlobal(`diag`);if(J)return J[z](G,...K)}var DiagLogLevel$1;(function(z){z[z.NONE=0]=`NONE`,z[z.ERROR=30]=`ERROR`,z[z.WARN=50]=`WARN`,z[z.INFO=60]=`INFO`,z[z.DEBUG=70]=`DEBUG`,z[z.VERBOSE=80]=`VERBOSE`,z[z.ALL=9999]=`ALL`})(DiagLogLevel$1||(DiagLogLevel$1={}));function createLogLevelDiagLogger(z,G){z<DiagLogLevel$1.NONE?z=DiagLogLevel$1.NONE:z>DiagLogLevel$1.ALL&&(z=DiagLogLevel$1.ALL),G||(G={});function K(K,J){let Y=G[K];return typeof Y==`function`&&z>=J?Y.bind(G):function(){}}return{error:K(`error`,DiagLogLevel$1.ERROR),warn:K(`warn`,DiagLogLevel$1.WARN),info:K(`info`,DiagLogLevel$1.INFO),debug:K(`debug`,DiagLogLevel$1.DEBUG),verbose:K(`verbose`,DiagLogLevel$1.VERBOSE)}}const diag=class z{static instance(){return this._instance||(this._instance=new z),this._instance}constructor(){function z(z){return function(...G){let K=getGlobal(`diag`);if(K)return K[z](...G)}}let G=this;G.setLogger=(z,K={logLevel:DiagLogLevel$1.INFO})=>{var J;if(z===G){var Y;let z=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return G.error((Y=z.stack)==null?z.message:Y),!1}typeof K==`number`&&(K={logLevel:K});let X=getGlobal(`diag`),Z=createLogLevelDiagLogger((J=K.logLevel)==null?DiagLogLevel$1.INFO:J,z);if(X&&!K.suppressOverrideMessage){var Q;let z=(Q=Error().stack)==null?`<failed to generate stacktrace>`:Q;X.warn(`Current logger will be overwritten from ${z}`),Z.warn(`Current logger will overwrite one already registered from ${z}`)}return registerGlobal(`diag`,Z,G,!0)},G.disable=()=>{unregisterGlobal(`diag`,G)},G.createComponentLogger=z=>new DiagComponentLogger(z),G.verbose=z(`verbose`),G.debug=z(`debug`),G.info=z(`info`),G.warn=z(`warn`),G.error=z(`error`)}}.instance();function createResource(z,G){let K={attributes:toAttributes(z.attributes,G),droppedAttributesCount:0},J=z.schemaUrl;return J&&J!==``&&(K.schemaUrl=J),K}function createInstrumentationScope(z){return{name:z.name,version:z.version}}function toAttributes(z,G){return Object.keys(z).map(K=>toKeyValue(K,z[K],G))}function toKeyValue(z,G,K){return{key:z,value:toAnyValue(G,K)}}function toAnyValue(z,G){let K=typeof z;if(K===`string`)return{stringValue:z};if(K===`number`)return Number.isInteger(z)?{intValue:z}:{doubleValue:z};if(K===`boolean`)return{boolValue:z};if(z instanceof Uint8Array)return{bytesValue:G.encodeUint8Array(z)};if(Array.isArray(z)){let K=Array(z.length);for(let J=0;J<z.length;J++)K[J]=toAnyValue(z[J],G);return{arrayValue:{values:K}}}if(K===`object`&&z!=null){let K=Object.keys(z),J=Array(K.length);for(let Y=0;Y<K.length;Y++)J[Y]={key:K[Y],value:toAnyValue(z[K[Y]],G)};return{kvlistValue:{values:J}}}return{}}const SECOND_TO_NANOSECONDS=Math.pow(10,9);function hrTimeToNanoseconds(z){return z[0]*SECOND_TO_NANOSECONDS+z[1]}function hrTimeToNanos(z){let G=BigInt(1e9);return BigInt(Math.trunc(z[0]))*G+BigInt(Math.trunc(z[1]))}function encodeAsString(z){return hrTimeToNanos(z).toString()}const encodeTimestamp=typeof BigInt<`u`?encodeAsString:hrTimeToNanoseconds;function identity(z){return z}const JSON_ENCODER={encodeHrTime:encodeTimestamp,encodeSpanContext:identity,encodeOptionalSpanContext:identity,encodeUint8Array:z=>{if(typeof Buffer<`u`)return Buffer.from(z).toString(`base64`);let G=Array(z.length);for(let K=0;K<z.length;K++)G[K]=String.fromCharCode(z[K]);return btoa(G.join(``))}};function buildSpanFlagsFrom(z,G){let K=z&255|256;return G&&(K|=512),K}function sdkSpanToOtlpSpan(z,G){var K,J,Y,X;let Z=z.spanContext(),Q=z.status,ee=(K=z.parentSpanContext)!=null&&K.spanId?G.encodeSpanContext((J=z.parentSpanContext)==null?void 0:J.spanId):void 0;return{traceId:G.encodeSpanContext(Z.traceId),spanId:G.encodeSpanContext(Z.spanId),parentSpanId:ee,traceState:(Y=Z.traceState)==null?void 0:Y.serialize(),name:z.name,kind:z.kind==null?0:z.kind+1,startTimeUnixNano:G.encodeHrTime(z.startTime),endTimeUnixNano:G.encodeHrTime(z.endTime),attributes:toAttributes(z.attributes,G),droppedAttributesCount:z.droppedAttributesCount,events:z.events.map(z=>toOtlpSpanEvent(z,G)),droppedEventsCount:z.droppedEventsCount,status:{code:Q.code,message:Q.message},links:z.links.map(z=>toOtlpLink(z,G)),droppedLinksCount:z.droppedLinksCount,flags:buildSpanFlagsFrom(Z.traceFlags,(X=z.parentSpanContext)==null?void 0:X.isRemote)}}function toOtlpLink(z,G){var K;return{attributes:z.attributes?toAttributes(z.attributes,G):[],spanId:G.encodeSpanContext(z.context.spanId),traceId:G.encodeSpanContext(z.context.traceId),traceState:(K=z.context.traceState)==null?void 0:K.serialize(),droppedAttributesCount:z.droppedAttributesCount||0,flags:buildSpanFlagsFrom(z.context.traceFlags,z.context.isRemote)}}function toOtlpSpanEvent(z,G){return{attributes:z.attributes?toAttributes(z.attributes,G):[],name:z.name,timeUnixNano:G.encodeHrTime(z.time),droppedAttributesCount:z.droppedAttributesCount||0}}function createExportTraceServiceRequest(z,G){return{resourceSpans:spanRecordsToResourceSpans(z,G)}}function createResourceMap$1(z){let G=new Map;for(let K of z){let z=G.get(K.resource);z||(z=new Map,G.set(K.resource,z));let J=`${K.instrumentationScope.name}@${K.instrumentationScope.version||``}:${K.instrumentationScope.schemaUrl||``}`,Y=z.get(J);Y||(Y=[],z.set(J,Y)),Y.push(K)}return G}function spanRecordsToResourceSpans(z,G){let K=createResourceMap$1(z),J=[],Y=K.entries(),X=Y.next();for(;!X.done;){let[z,K]=X.value,Z=[],Q=K.values(),ee=Q.next();for(;!ee.done;){let z=ee.value;if(z.length>0){let K=z.map(z=>sdkSpanToOtlpSpan(z,G));Z.push({scope:createInstrumentationScope(z[0].instrumentationScope),spans:K,schemaUrl:z[0].instrumentationScope.schemaUrl})}ee=Q.next()}let te=createResource(z,G),ne={resource:te,scopeSpans:Z,schemaUrl:te.schemaUrl};J.push(ne),X=Y.next()}return J}function createExportLogsServiceRequest(z,G){return{resourceLogs:logRecordsToResourceLogs(z,G)}}function createResourceMap(z){let G=new Map;for(let K of z){let{resource:z,instrumentationScope:{name:J,version:Y=``,schemaUrl:X=``}}=K,Z=G.get(z);Z||(Z=new Map,G.set(z,Z));let Q=`${J}@${Y}:${X}`,ee=Z.get(Q);ee||(ee=[],Z.set(Q,ee)),ee.push(K)}return G}function logRecordsToResourceLogs(z,G){let K=createResourceMap(z);return Array.from(K,([z,K])=>{let J=createResource(z,G);return{resource:J,scopeLogs:Array.from(K,([,z])=>({scope:createInstrumentationScope(z[0].instrumentationScope),logRecords:z.map(z=>toLogRecord(z,G)),schemaUrl:z[0].instrumentationScope.schemaUrl})),schemaUrl:J.schemaUrl}})}function toLogRecord(z,G){var K,J,Y;return{timeUnixNano:G.encodeHrTime(z.hrTime),observedTimeUnixNano:G.encodeHrTime(z.hrTimeObserved),severityNumber:toSeverityNumber(z.severityNumber),severityText:z.severityText,body:toAnyValue(z.body,G),eventName:z.eventName,attributes:toLogAttributes(z.attributes,G),droppedAttributesCount:z.droppedAttributesCount,flags:(K=z.spanContext)==null?void 0:K.traceFlags,traceId:G.encodeOptionalSpanContext((J=z.spanContext)==null?void 0:J.traceId),spanId:G.encodeOptionalSpanContext((Y=z.spanContext)==null?void 0:Y.spanId)}}function toSeverityNumber(z){return z}function toLogAttributes(z,G){return Object.keys(z).map(K=>toKeyValue(K,z[K],G))}const JsonLogsSerializer={serializeRequest:z=>{let G=createExportLogsServiceRequest(z,JSON_ENCODER);return new TextEncoder().encode(JSON.stringify(G))},deserializeResponse:z=>{if(z.length===0)return{};let G=new TextDecoder;try{return JSON.parse(G.decode(z))}catch(z){return diag.warn(`Failed to parse logs export response: ${z.message}. Returning empty response`),{}}}},JsonTraceSerializer={serializeRequest:z=>{let G=createExportTraceServiceRequest(z,JSON_ENCODER);return new TextEncoder().encode(JSON.stringify(G))},deserializeResponse:z=>{if(z.length===0)return{};let G=new TextDecoder;try{return JSON.parse(G.decode(z))}catch(z){return diag.warn(`Failed to parse trace export response: ${z.message}. Returning empty response`),{}}}};var BaseFetchExporter=class{constructor(z){this._delegate=z}export(z,G){this._delegate.export(z,G)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},OTLPExporterError=class extends Error{constructor(z,G,K){super(z),_defineProperty(this,`code`,void 0),_defineProperty(this,`name`,`OTLPExporterError`),_defineProperty(this,`data`,void 0),this.data=K,this.code=G}},BoundedQueueExportPromiseHandler=class{constructor(z){_defineProperty(this,`_concurrencyLimit`,void 0),_defineProperty(this,`_sendingPromises`,[]),this._concurrencyLimit=z}pushPromise(z){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(z);let G=()=>{let G=this._sendingPromises.indexOf(z);this._sendingPromises.splice(G,1)};z.then(G,G)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var z=this;return _asyncToGenerator(function*(){yield Promise.all(z._sendingPromises)})()}};function createBoundedQueueExportPromiseHandler(z){return new BoundedQueueExportPromiseHandler(z.concurrencyLimit)}var ExportResultCode;(function(z){z[z.SUCCESS=0]=`SUCCESS`,z[z.FAILED=1]=`FAILED`})(ExportResultCode||(ExportResultCode={}));function isPartialSuccessResponse(z){return Object.prototype.hasOwnProperty.call(z,`partialSuccess`)}function createLoggingPartialSuccessResponseHandler(){return{handleResponse(z){z==null||!isPartialSuccessResponse(z)||z.partialSuccess==null||Object.keys(z.partialSuccess).length===0||diag$1.warn(`Received Partial Success response:`,JSON.stringify(z.partialSuccess))}}}var OTLPExportDelegate=class{constructor(z,G,K,J,Y){_defineProperty(this,`_diagLogger`,void 0),_defineProperty(this,`_transport`,void 0),_defineProperty(this,`_serializer`,void 0),_defineProperty(this,`_responseHandler`,void 0),_defineProperty(this,`_promiseQueue`,void 0),_defineProperty(this,`_timeout`,void 0),this._transport=z,this._serializer=G,this._responseHandler=K,this._promiseQueue=J,this._timeout=Y,this._diagLogger=diag$1.createComponentLogger({namespace:`OTLPExportDelegate`})}export(z,G){if(this._diagLogger.debug(`items to be sent`,z),this._promiseQueue.hasReachedLimit()){G({code:ExportResultCode.FAILED,error:Error(`Concurrent export limit reached`)});return}let K=this._serializer.serializeRequest(z);if(K==null){G({code:ExportResultCode.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(K,this._timeout).then(z=>{if(z.status===`success`){if(z.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(z.data))}catch(G){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,G,z.data)}G({code:ExportResultCode.SUCCESS});return}else if(z.status===`failure`&&z.error){G({code:ExportResultCode.FAILED,error:z.error});return}else if(z.status===`retryable`){var K;G({code:ExportResultCode.FAILED,error:(K=z.error)==null?new OTLPExporterError(`Export failed with retryable status`):K})}else G({code:ExportResultCode.FAILED,error:new OTLPExporterError(`Export failed with unknown error`)})},z=>G({code:ExportResultCode.FAILED,error:z})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var z=this;return _asyncToGenerator(function*(){z._diagLogger.debug(`shutdown started`),yield z.forceFlush(),z._transport.shutdown()})()}};function createOtlpExportDelegate(z,G){return new OTLPExportDelegate(z.transport,z.serializer,createLoggingPartialSuccessResponseHandler(),z.promiseHandler,G.timeout)}function createOtlpNetworkExportDelegate(z,G,K){return createOtlpExportDelegate({transport:K,serializer:G,promiseHandler:createBoundedQueueExportPromiseHandler(z)},{timeout:z.timeoutMillis})}const KEEPALIVE_BYTE_BUDGET=49152,MAX_KEEPALIVE_REQUESTS=9;let inflightKeepaliveBytes=0,inflightKeepaliveCount=0;var FetchTransport=class z{constructor(z){this._config=z}static _compressRequest(z){return _asyncToGenerator(function*(){let G=new CompressionStream(`gzip`),K=G.writable.getWriter();K.write(z),K.close();let J=[],Y=G.readable.getReader(),X=!1;for(;!X;){let z=yield Y.read();z.value&&J.push(z.value),X=z.done}let Z=new Uint8Array(J.reduce((z,G)=>z+G.length,0)),Q=0;for(let z of J)Z.set(z,Q),Q+=z.length;return Z})()}send(z,G){return this._asyncSend(z,G)}shutdown(){}_asyncSend(G,K){var J=this;return _asyncToGenerator(function*(){let Y=G,X=_objectSpread2({"Content-Type":`application/json`},J._config.headers),Z,Q;if(`timeout`in AbortSignal)Z=AbortSignal.timeout(K);else{let z=new AbortController;Z=z.signal,Q=setTimeout(()=>{z.abort(new DOMException(`TimeoutError`,`TimeoutError`))},K)}let ee=!1;try{if(J._config.compression===`gzip`){try{Y=yield z._compressRequest(G)}catch(z){let G=z instanceof Error?z:Error(String(z));return diag$1.warn(`Fetch transport gzip compression failed: ${G.message}`),{status:`failure`,error:G}}X[`Content-Encoding`]=`gzip`,X[`Content-Length`]=Y.length.toString()}let K=inflightKeepaliveBytes+Y.byteLength>KEEPALIVE_BYTE_BUDGET;if(ee=!K&&!(inflightKeepaliveCount>=MAX_KEEPALIVE_REQUESTS),ee)inflightKeepaliveBytes+=Y.byteLength,inflightKeepaliveCount++;else{let z=K?`inflight bytes (${inflightKeepaliveBytes} + ${Y.byteLength}) would exceed ${KEEPALIVE_BYTE_BUDGET}B budget`:`concurrent count (${inflightKeepaliveCount}) at limit of ${MAX_KEEPALIVE_REQUESTS}`;diag$1.debug(`Sending without keepalive: ${z}`)}let Q=yield fetch(J._config.url,{method:`POST`,keepalive:ee,headers:X,body:Y,signal:Z});if(Q.ok)return{status:`success`};let te=Error(`${Q.status} Fetch request failed`),ne=`Fetch transport received HTTP ${Q.status} (keepalive=${ee})`;return Q.status>=500?(diag$1.debug(ne),{status:`retryable`,error:te}):(diag$1.warn(ne),{status:`failure`,error:te})}catch(z){let G=z instanceof Error?z:Error(String(z)),K=G instanceof TypeError||G instanceof DOMException&&G.name===`TimeoutError`,J=`Fetch transport failed (keepalive=${ee}): ${G.message}`;return K?diag$1.debug(J):diag$1.warn(J),{status:K?`retryable`:`failure`,error:G}}finally{Q!==void 0&&clearTimeout(Q),ee&&(inflightKeepaliveBytes-=Y.byteLength,inflightKeepaliveCount--)}})()}};const createFetchTransport=z=>new FetchTransport(z),MAX_ATTEMPTS=5,INITIAL_BACKOFF=1e3,MAX_BACKOFF=5e3,BACKOFF_MULTIPLIER=1.5,JITTER=20,getJitter=()=>2*JITTER*Math.random()-JITTER;var RetryingTransport=class{constructor(z,G=new OTelPerformanceManager){this._transport=z,this._perf=G}send(z,G){var K=this;return _asyncToGenerator(function*(){let J=K._perf.getNowMillis()+G,Y=yield K._transport.send(z,G),X=MAX_ATTEMPTS,Z=INITIAL_BACKOFF;for(;Y.status===`retryable`&&X>0;){var Q;X--;let G=Math.max(Math.min(Z,MAX_BACKOFF)+getJitter(),0);Z*=BACKOFF_MULTIPLIER;let ee=(Q=Y.retryInMillis)==null?G:Q,te=J-K._perf.getNowMillis();if(ee>te)return Y;Y=yield K._retry(z,te,ee)}return Y})()}shutdown(){this._transport.shutdown()}_retry(z,G,K){return new Promise((J,Y)=>{setTimeout(()=>{this._transport.send(z,G).then(J,Y)},K)})}};const createRetryingTransport=z=>{var G;return new RetryingTransport(z.transport,(G=z.perf)==null?new OTelPerformanceManager:G)},createOtlpBrowserFetchExportDelegate=(z,G)=>createOtlpNetworkExportDelegate(z,G,createRetryingTransport({transport:createFetchTransport(z)}));var OTLPFetchLogExporter=class extends BaseFetchExporter{constructor(z){super(createOtlpBrowserFetchExportDelegate(z,JsonLogsSerializer))}};const getLogEndpoint=(z,G)=>`${getDataURL(z,G)}/v1/logs`;var MXLLogExporter=class extends OTLPFetchLogExporter{constructor({appID:z,userID:G,mxlDataURL:K}){super(_objectSpread2(_objectSpread2({},DEFAULT_MXL_EXPORTER_CONFIG),{},{headers:getMXLHeaders(z,G),url:getLogEndpoint(z,K)}))}},OTLPFetchTraceExporter=class extends BaseFetchExporter{constructor(z){super(createOtlpBrowserFetchExportDelegate(_objectSpread2(_objectSpread2({},z),{},{compression:`gzip`}),JsonTraceSerializer))}};const getTraceEndpoint=(z,G)=>`${getDataURL(z,G)}/v1/traces`;var MXLTraceExporter=class extends OTLPFetchTraceExporter{constructor({appID:z,userID:G,mxlDataURL:K}){super(_objectSpread2(_objectSpread2({},DEFAULT_MXL_EXPORTER_CONFIG),{},{headers:getMXLHeaders(z,G),url:getTraceEndpoint(z,K)}))}},BrowserLogRecordProcessor=class{constructor({urlDocument:z=window.document}={}){_defineProperty(this,`_urlDocument`,void 0),this._urlDocument=z}forceFlush(){return Promise.resolve(void 0)}onEmit(z){z.setAttribute(KEY_BROWSER_URL_FULL,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}},BrowserSpanProcessor=class{constructor({urlDocument:z=window.document}={}){_defineProperty(this,`_urlDocument`,void 0),this._urlDocument=z}forceFlush(){return Promise.resolve(void 0)}onEnd(z){z.attributes[KEY_BROWSER_URL_FULL]=this._urlDocument.URL}onStart(){}shutdown(){return Promise.resolve(void 0)}},IdentifiableSessionLogRecordProcessor=class{constructor({spanSessionManager:z}){_defineProperty(this,`_spanSessionManager`,void 0),this._spanSessionManager=z}forceFlush(){return Promise.resolve(void 0)}onEmit(z){z.setAttributes({[ATTR_LOG_RECORD_UID]:generateUUID(),[ATTR_SESSION_ID$1]:this._spanSessionManager.getSessionId(),[ATTR_SESSION_PREVIOUS_ID]:this._spanSessionManager.getPreviousSessionId()})}shutdown(){return Promise.resolve(void 0)}},LogRecordScrubProcessor=class{constructor({attributeScrubbers:z}){_defineProperty(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=z}forceFlush(){return Promise.resolve(void 0)}onEmit(z){this._attributeScrubbers.forEach(G=>{let K=z.attributes[G.key];K&&typeof K==`string`&&z.setAttribute(G.key,G.scrub(K))})}shutdown(){return Promise.resolve(void 0)}},MXLLogRecordProcessor=class{constructor({urlDocument:z=window.document}={}){_defineProperty(this,`_urlDocument`,void 0),this._urlDocument=z}forceFlush(){return Promise.resolve(void 0)}onEmit(z){z.attributes[KEY_MXL_TYPE]||z.setAttribute(KEY_MXL_TYPE,MXL_TYPES.SystemLog),z.setAttribute(ATTR_URL_FULL,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};const isNetworkSpan=z=>{if((z.attributes[ATTR_HTTP_REQUEST_METHOD]||z.attributes[SEMATTRS_HTTP_METHOD])&&(typeof z.attributes[ATTR_HTTP_RESPONSE_STATUS_CODE]==`number`||typeof z.attributes[SEMATTRS_HTTP_STATUS_CODE]==`number`)){var G;let K=(G=z.attributes[ATTR_URL_FULL])==null?z.attributes[SEMATTRS_HTTP_URL]:G;return typeof K==`string`&&K.includes(`://`)}return!1};var MXLNetworkSpanProcessor=class{forceFlush(){return Promise.resolve(void 0)}onEnd(z){if(isNetworkSpan(z)){var G,K,J,Y,X,Z,Q,ee,te,ne;z.attributes[KEY_MXL_TYPE]=MXL_TYPES.Network,(G=z.attributes)[ATTR_URL_FULL]!=null||(G[ATTR_URL_FULL]=z.attributes[SEMATTRS_HTTP_URL]),(J=z.attributes)[ATTR_HTTP_RESPONSE_STATUS_CODE]!=null||(J[ATTR_HTTP_RESPONSE_STATUS_CODE]=z.attributes[SEMATTRS_HTTP_STATUS_CODE]),(X=z.attributes)[ATTR_HTTP_REQUEST_METHOD]!=null||(X[ATTR_HTTP_REQUEST_METHOD]=z.attributes[SEMATTRS_HTTP_METHOD]),(Q=z.attributes)[ATTR_HTTP_RESPONSE_BODY_SIZE]!=null||(Q[ATTR_HTTP_RESPONSE_BODY_SIZE]=z.attributes[SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH]),(te=z.attributes)[ATTR_HTTP_REQUEST_BODY_SIZE$2]!=null||(te[ATTR_HTTP_REQUEST_BODY_SIZE$2]=z.attributes[SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH])}}onStart(){}shutdown(){return Promise.resolve(void 0)}};const isSessionSpan=z=>z.attributes[KEY_MXL_TYPE]===MXL_TYPES.Session,exportFailureAttributeKey=(z,G)=>`mxl.${G===`current`?`export_failed`:`previous_export_failed`}.${z}`;var MXLSessionBatchedSpanProcessor=class{constructor({resource:z,exporter:G,limitManager:K,spanSessionManager:J,storage:Y=window.localStorage,storedSpansExpireTimeoutMS:X,diag:Z=diag$1.createComponentLogger({namespace:`MXLSessionBatchedSpanProcessor`})}){_defineProperty(this,`_shutdownOnce`,void 0),_defineProperty(this,`_pendingSpans`,[]),_defineProperty(this,`_exporter`,void 0),_defineProperty(this,`_limitManager`,void 0),_defineProperty(this,`_spanStorage`,void 0),_defineProperty(this,`_spanSessionManager`,void 0),_defineProperty(this,`_diag`,void 0),_defineProperty(this,`_shutdown`,()=>(this._spanStorage.destroy(),this._exporter.shutdown())),this._diag=Z,this._exporter=G,this._shutdownOnce=new BindOnceFuture$2(this._shutdown,this),this._limitManager=K,this._spanSessionManager=J,this._spanStorage=new MXLSpanStorage({resource:z,storage:Y,diag:Z,onExpiredSpansExport:z=>{this._exportSpans(z)},storedSpansExpireTimeoutMS:X,spanSessionManager:J})}forceFlush(){return this._diag.debug(`forceFlush called for MXLSessionBatchedSpanProcessor. This is a no op`),Promise.resolve(void 0)}onEnd(z){if(this._shutdownOnce.isCalled){this._diag.debug(`span ended after processor shutdown. Ignoring span.`);return}if(isSessionSpan(z))this._diag.debug(`session span ended. Exporting all pending spans.`),this._exportSpans([z,...this._pendingSpans]),this._pendingSpans=[];else{if(this._diag.debug(`non-session span ended. Adding to pending spans queue.`),this._limitManager.dropReadableSpan(z))return;this._pendingSpans.push(z)}}_exportSpans(z){internal._export(this._exporter,z).then(z=>{if(z.code===ExportResultCode$3.FAILED){var G;let K=((G=z.error)==null?void 0:G.message)||`unknown error`,J=`unknown`;K===`Concurrent export limit reached`?J=`concurrent_limit`:K===`Fetch request errored`&&(J=`fetch_error`),this._spanSessionManager.incrSessionCountForKey(exportFailureAttributeKey(J,`current`)),this._spanSessionManager.incrNextSessionCountForKey(exportFailureAttributeKey(J,`previous`)),this._diag.error(`spans failed to export: ${K}`)}}).catch(z=>{let G=`unknown error`;z&&z instanceof Error?G=z.message:typeof z==`string`&&(G=z),this._spanSessionManager.incrSessionCountForKey(exportFailureAttributeKey(`unknown`,`current`)),this._spanSessionManager.incrNextSessionCountForKey(exportFailureAttributeKey(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${G}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}storePendingSpans(z,G){this._spanStorage.storePendingSpans(z,G,this._pendingSpans)}clearStoredSpans(z){this._spanStorage.clearStoredSpans(z)}shutdown(){return this._shutdownOnce.call()}},PageLogRecordProcessor=class{constructor({pageManager:z}){_defineProperty(this,`_pageManager`,void 0),this._pageManager=z}forceFlush(){return Promise.resolve(void 0)}onEmit(z){if(!z.attributes[KEY_MXL_PAGE_PATH]||!z.attributes[KEY_MXL_PAGE_ID]){let G=this._pageManager.getCurrentRoute();G&&(z.setAttribute(KEY_MXL_PAGE_PATH,G.path),z.setAttribute(KEY_MXL_PAGE_ID,this._pageManager.getCurrentPageId()))}let G=this._pageManager.getPageLabel();G&&!z.attributes[KEY_APP_SURFACE_LABEL]&&z.setAttribute(KEY_APP_SURFACE_LABEL,G)}shutdown(){return Promise.resolve(void 0)}},PageSpanProcessor=class{constructor({pageManager:z}){_defineProperty(this,`_pageManager`,void 0),this._pageManager=z}forceFlush(){return Promise.resolve(void 0)}onEnd(z){if(!z.attributes[KEY_MXL_PAGE_PATH]||!z.attributes[KEY_MXL_PAGE_ID]){let G=this._pageManager.getCurrentRoute(),K=this._pageManager.getCurrentPageId();G&&K&&(z.attributes[KEY_MXL_PAGE_PATH]=G.path,z.attributes[KEY_MXL_PAGE_ID]=K)}let G=this._pageManager.getPageLabel();G&&!z.attributes[KEY_APP_SURFACE_LABEL]&&(z.attributes[KEY_APP_SURFACE_LABEL]=G)}onStart(){}shutdown(){return Promise.resolve(void 0)}},SpanScrubProcessor=class{constructor({attributeScrubbers:z}){_defineProperty(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=z}forceFlush(){return Promise.resolve(void 0)}onEnd(z){this._attributeScrubbers.forEach(G=>{let K=z.attributes[G.key];K&&typeof K==`string`&&(z.attributes[G.key]=G.scrub(K))})}onStart(){}shutdown(){return Promise.resolve(void 0)}},UserLogRecordProcessor=class{constructor({userManager:z}){_defineProperty(this,`_userManager`,void 0),this._userManager=z}forceFlush(){return Promise.resolve(void 0)}onEmit(z){this._userManager.getUserId()&&z.setAttributes({[ATTR_USER_ID]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}},UserSpanProcessor=class{constructor({userManager:z}){_defineProperty(this,`_userManager`,void 0),this._userManager=z}forceFlush(){return Promise.resolve(void 0)}onEnd(z){let G=this._userManager.getUserId();G&&(z.attributes[ATTR_USER_ID]=G)}onStart(){}shutdown(){return Promise.resolve(void 0)}},MXLW3CTraceContextPropagator=class extends W3CTraceContextPropagator$1{inject(z,G,K){super.inject(z,G,K);let J=trace$1.getSpan(z);if(J){let z=G instanceof Headers?G.get(`traceparent`):defaultTextMapGetter.get(G,`traceparent`);z&&J.setAttribute(KEY_MXL_W3C_TRACEPARENT,z)}}};const HOST_CREDENTIALS_REGEX=/\/\/(.+):(.+)@(.+)\//,DEFAULT_SENSITIVE_TOKENS=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],scrubURL=({value:z,queryParamRegex:G,scrubPath:K,scrubQuery:J})=>{let Y=z;return K&&(Y=Y.replace(HOST_CREDENTIALS_REGEX,`//REDACTED:REDACTED@$3/`)),J&&(Y=Y.replaceAll(G,`$1$2=REDACTED`)),Y},getDefaultAttributeScrubbers=z=>{let G=[...DEFAULT_SENSITIVE_TOKENS,...z||[]],K=RegExp(`(^|&|\\?)(${G.join(`|`)})=[^&]+`,`g`);return[{key:ATTR_URL_FULL,scrub:z=>scrubURL({value:z,queryParamRegex:K,scrubPath:!0,scrubQuery:!0})},{key:SEMATTRS_HTTP_URL,scrub:z=>scrubURL({value:z,queryParamRegex:K,scrubPath:!0,scrubQuery:!0})},{key:ATTR_URL_PATH,scrub:z=>scrubURL({value:z,queryParamRegex:K,scrubPath:!0,scrubQuery:!1})},{key:ATTR_URL_QUERY,scrub:z=>scrubURL({value:z,queryParamRegex:K,scrubPath:!1,scrubQuery:!0})}]};var Registry=class{constructor({diagLogger:z=diag$1.createComponentLogger({namespace:`mxl-registry`})}={}){_defineProperty(this,`_sdk`,null),_defineProperty(this,`_diag`,void 0),_defineProperty(this,`register`,z=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=z}),_defineProperty(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),_defineProperty(this,`registered`,()=>this._sdk),this._diag=z}};const registry=new Registry,setupDefaultInstrumentations=(z={},{featureManager:G,logManager:K,spanSessionManager:J,mxlSpanProcessor:Y,pageManager:X})=>{var Z,Q,ee,te,ne,ie;let ae=[new SpanSessionOnLoadInstrumentation(z[`session-on-load`]),new SpanSessionVisibilityInstrumentation(z[`session-visibility`],G,Y),new SpanSessionBrowserActivityInstrumentation(z[`session-activity`]),new SpanSessionTimeoutInstrumentation(z[`session-timeout`])];(Z=z.omit)!=null&&Z.has(`exception`)||ae.push(new GlobalExceptionInstrumentation(z.exception)),(Q=z.omit)!=null&&Q.has(`click`)||ae.push(new ClicksInstrumentation(z.click)),(ee=z.omit)!=null&&ee.has(`web-vital`)||ae.push(new WebVitalsInstrumentation(_objectSpread2(_objectSpread2({},z[`web-vital`]),{},{pageManager:X}))),(te=z.omit)!=null&&te.has(`document-load`)||ae.push(new DocumentLoadInstrumentation(z[`document-load`])),(ne=z.omit)!=null&&ne.has(`@opentelemetry/instrumentation-fetch`)||ae.push(new MXLFetchInstrumentation(_objectSpread2(_objectSpread2({},z.network),z[`@opentelemetry/instrumentation-fetch`]))),(ie=z.omit)!=null&&ie.has(`@opentelemetry/instrumentation-xml-http-request`)||ae.push(new MXLXHRInstrumentation(_objectSpread2(_objectSpread2({},z.network),z[`@opentelemetry/instrumentation-xml-http-request`]))),z[`empty-root`]&&ae.push(new EmptyRootInstrumentation(_objectSpread2({},z[`empty-root`])));for(let z of ae)z instanceof MXLInstrumentationBase&&(J&&z.setSessionManager(J),K&&z.setLogManager(K));return ae};
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */
16
+ var __assign=function(){return __assign=Object.assign||function(z){for(var G,K=1,J=arguments.length;K<J;K++)for(var Y in G=arguments[K],G)Object.prototype.hasOwnProperty.call(G,Y)&&(z[Y]=G[Y]);return z},__assign.apply(this,arguments)};function __rest(z,G){var K={};for(var J in z)Object.prototype.hasOwnProperty.call(z,J)&&G.indexOf(J)<0&&(K[J]=z[J]);if(z!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var Y=0,J=Object.getOwnPropertySymbols(z);Y<J.length;Y++)G.indexOf(J[Y])<0&&Object.prototype.propertyIsEnumerable.call(z,J[Y])&&(K[J[Y]]=z[J[Y]]);return K}function __values(z){var G=typeof Symbol==`function`&&Symbol.iterator,K=G&&z[G],J=0;if(K)return K.call(z);if(z&&typeof z.length==`number`)return{next:function(){return z&&J>=z.length&&(z=void 0),{value:z&&z[J++],done:!z}}};throw TypeError(G?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function __read(z,G){var K=typeof Symbol==`function`&&z[Symbol.iterator];if(!K)return z;var J=K.call(z),Y,X=[],Z;try{for(;(G===void 0||G-- >0)&&!(Y=J.next()).done;)X.push(Y.value)}catch(z){Z={error:z}}finally{try{Y&&!Y.done&&(K=J.return)&&K.call(J)}finally{if(Z)throw Z.error}}return X}function __spreadArray(z,G,K){if(K||arguments.length===2)for(var J=0,Y=G.length,X;J<Y;J++)(X||!(J in G))&&(X||(X=Array.prototype.slice.call(G,0,J)),X[J]=G[J]);return z.concat(X||Array.prototype.slice.call(G))}var NodeType;(function(z){z[z.Document=0]=`Document`,z[z.DocumentType=1]=`DocumentType`,z[z.Element=2]=`Element`,z[z.Text=3]=`Text`,z[z.CDATA=4]=`CDATA`,z[z.Comment=5]=`Comment`})(NodeType||(NodeType={}));function isElement(z){return z.nodeType===z.ELEMENT_NODE}function isShadowRoot(z){var G,K=(G=z)==null?void 0:G.host;return!!(K&&K.shadowRoot&&K.shadowRoot===z)}function maskInputValue(z){var G=z.maskInputOptions,K=z.tagName,J=z.type,Y=z.value,X=z.maskInputFn,Z=Y||``;return(G[K.toLowerCase()]||G[J])&&(Z=X?X(Z):`*`.repeat(Z.length)),Z}var ORIGINAL_ATTRIBUTE_NAME=`__rrweb_original__`;function is2DCanvasBlank(z){var G=z.getContext(`2d`);if(!G)return!0;for(var K=50,J=0;J<z.width;J+=K)for(var Y=0;Y<z.height;Y+=K){var X=G.getImageData,Z=ORIGINAL_ATTRIBUTE_NAME in X?X[ORIGINAL_ATTRIBUTE_NAME]:X;if(new Uint32Array(Z.call(G,J,Y,Math.min(K,z.width-J),Math.min(K,z.height-Y)).data.buffer).some(function(z){return z!==0}))return!1}return!0}var _id=1,tagNameRegex=RegExp(`[^a-z0-9-_:]`),IGNORED_NODE=-2;function genId(){return _id++}function getValidTagName(z){if(z instanceof HTMLFormElement)return`form`;var G=z.tagName.toLowerCase().trim();return tagNameRegex.test(G)?`div`:G}function getCssRulesString(z){try{var G=z.rules||z.cssRules;return G?Array.from(G).map(getCssRuleString).join(``):null}catch(z){return null}}function getCssRuleString(z){var G=z.cssText;if(isCSSImportRule(z))try{G=getCssRulesString(z.styleSheet)||G}catch(z){}return G}function isCSSImportRule(z){return`styleSheet`in z}function stringifyStyleSheet(z){return z.cssRules?Array.from(z.cssRules).map(function(z){return z.cssText||``}).join(``):``}function extractOrigin(z){var G=``;return G=z.indexOf(`//`)>-1?z.split(`/`).slice(0,3).join(`/`):z.split(`/`)[0],G=G.split(`?`)[0],G}var canvasService,canvasCtx,URL_IN_CSS_REF=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,DATA_URI=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(z,G){return(z||``).replace(URL_IN_CSS_REF,function(z,K,J,Y,X,Z){var Q=J||X||Z,ee=K||Y||``;if(!Q)return z;if(!RELATIVE_PATH.test(Q)||DATA_URI.test(Q))return`url(`+ee+Q+ee+`)`;if(Q[0]===`/`)return`url(`+ee+(extractOrigin(G)+Q)+ee+`)`;var te=G.split(`/`),ne=Q.split(`/`);te.pop();for(var ie=0,ae=ne;ie<ae.length;ie++){var oe=ae[ie];oe!==`.`&&(oe===`..`?te.pop():te.push(oe))}return`url(`+ee+te.join(`/`)+ee+`)`})}var SRCSET_NOT_SPACES=/^[^ \t\n\r\u000c]+/,SRCSET_COMMAS_OR_SPACES=/^[, \t\n\r\u000c]+/;function getAbsoluteSrcsetString(z,G){if(G.trim()===``)return G;var K=0;function J(z){var J,Y=z.exec(G.substring(K));return Y?(J=Y[0],K+=J.length,J):``}for(var Y=[];J(SRCSET_COMMAS_OR_SPACES),!(K>=G.length);){var X=J(SRCSET_NOT_SPACES);if(X.slice(-1)===`,`)X=absoluteToDoc(z,X.substring(0,X.length-1)),Y.push(X);else{var Z=``;X=absoluteToDoc(z,X);for(var Q=!1;;){var ee=G.charAt(K);if(ee===``){Y.push((X+Z).trim());break}else if(Q)ee===`)`&&(Q=!1);else if(ee===`,`){K+=1,Y.push((X+Z).trim());break}else ee===`(`&&(Q=!0);Z+=ee,K+=1}}}return Y.join(`, `)}function absoluteToDoc(z,G){if(!G||G.trim()===``)return G;var K=z.createElement(`a`);return K.href=G,K.href}function isSVGElement(z){return!!(z.tagName===`svg`||z.ownerSVGElement)}function getHref(){var z=document.createElement(`a`);return z.href=``,z.href}function transformAttribute(z,G,K,J){return K===`src`||K===`href`&&J||K===`xlink:href`&&J&&J[0]!==`#`||K===`background`&&J&&(G===`table`||G===`td`||G===`th`)?absoluteToDoc(z,J):K===`srcset`&&J?getAbsoluteSrcsetString(z,J):K===`style`&&J?absoluteToStylesheet(J,getHref()):G===`object`&&K===`data`&&J?absoluteToDoc(z,J):J}function _isBlockedElement(z,G,K){if(typeof G==`string`){if(z.classList.contains(G))return!0}else for(var J=0;J<z.classList.length;J++){var Y=z.classList[J];if(G.test(Y))return!0}return K?z.matches(K):!1}function needMaskingText(z,G,K){if(!z)return!1;if(z.nodeType===z.ELEMENT_NODE){if(typeof G==`string`){if(z.classList.contains(G))return!0}else for(var J=0;J<z.classList.length;J++){var Y=z.classList[J];if(G.test(Y))return!0}return K&&z.matches(K)?!0:needMaskingText(z.parentNode,G,K)}return z.nodeType,z.TEXT_NODE,needMaskingText(z.parentNode,G,K)}function onceIframeLoaded(z,G,K){var J=z.contentWindow;if(J){var Y=!1,X;try{X=J.document.readyState}catch(z){return}if(X!==`complete`){var Z=setTimeout(function(){Y||(G(),Y=!0)},K);z.addEventListener(`load`,function(){clearTimeout(Z),Y=!0,G()});return}var Q=`about:blank`;if(J.location.href!==Q||z.src===Q||z.src===``){setTimeout(G,0);return}z.addEventListener(`load`,G)}}function serializeNode(z,G){var K,J=G.doc,Y=G.blockClass,X=G.blockSelector,Z=G.maskTextClass,Q=G.maskTextSelector,ee=G.inlineStylesheet,te=G.maskInputOptions,ne=te===void 0?{}:te,ie=G.maskTextFn,ae=G.maskInputFn,oe=G.dataURLOptions,se=oe===void 0?{}:oe,ce=G.inlineImages,le=G.recordCanvas,ue=G.keepIframeSrcFn,de;if(J.__sn){var fe=J.__sn.id;de=fe===1?void 0:fe}switch(z.nodeType){case z.DOCUMENT_NODE:return z.compatMode===`CSS1Compat`?{type:NodeType.Document,childNodes:[],rootId:de}:{type:NodeType.Document,childNodes:[],compatMode:z.compatMode,rootId:de};case z.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:z.name,publicId:z.publicId,systemId:z.systemId,rootId:de};case z.ELEMENT_NODE:for(var pe=_isBlockedElement(z,Y,X),me=getValidTagName(z),he={},ge=0,_e=Array.from(z.attributes);ge<_e.length;ge++){var ve=_e[ge],ye=ve.name,be=ve.value;he[ye]=transformAttribute(J,me,ye,be)}if(me===`link`&&ee){var xe=Array.from(J.styleSheets).find(function(G){return G.href===z.href}),Se=null;xe&&(Se=getCssRulesString(xe)),Se&&(delete he.rel,delete he.href,he._cssText=absoluteToStylesheet(Se,xe.href))}if(me===`style`&&z.sheet&&!(z.innerText||z.textContent||``).trim().length){var Se=getCssRulesString(z.sheet);Se&&(he._cssText=absoluteToStylesheet(Se,getHref()))}if(me===`input`||me===`textarea`||me===`select`){var be=z.value;he.type!==`radio`&&he.type!==`checkbox`&&he.type!==`submit`&&he.type!==`button`&&be?he.value=maskInputValue({type:he.type,tagName:me,value:be,maskInputOptions:ne,maskInputFn:ae}):z.checked&&(he.checked=z.checked)}if(me===`option`&&(z.selected&&!ne.select?he.selected=!0:delete he.selected),me===`canvas`&&le){if(z.__context===`2d`)is2DCanvasBlank(z)||(he.rr_dataURL=z.toDataURL(se.type,se.quality));else if(!(`__context`in z)){var Ce=z.toDataURL(se.type,se.quality),we=document.createElement(`canvas`);we.width=z.width,we.height=z.height,Ce!==we.toDataURL(se.type,se.quality)&&(he.rr_dataURL=Ce)}}if(me===`img`&&ce){canvasService||(canvasService=J.createElement(`canvas`),canvasCtx=canvasService.getContext(`2d`));var Te=z,Ee=Te.crossOrigin;Te.crossOrigin=`anonymous`;var De=function(){try{canvasService.width=Te.naturalWidth,canvasService.height=Te.naturalHeight,canvasCtx.drawImage(Te,0,0),he.rr_dataURL=canvasService.toDataURL(se.type,se.quality)}catch(z){console.warn(`Cannot inline img src=`+Te.currentSrc+`! Error: `+z)}Ee?he.crossOrigin=Ee:delete he.crossOrigin};Te.complete&&Te.naturalWidth!==0?De():Te.onload=De}if((me===`audio`||me===`video`)&&(he.rr_mediaState=z.paused?`paused`:`played`,he.rr_mediaCurrentTime=z.currentTime),z.scrollLeft&&(he.rr_scrollLeft=z.scrollLeft),z.scrollTop&&(he.rr_scrollTop=z.scrollTop),pe){var Oe=z.getBoundingClientRect(),ke=Oe.width,Ae=Oe.height;he={class:he.class,rr_width:ke+`px`,rr_height:Ae+`px`}}return me===`iframe`&&!ue(he.src)&&(z.contentDocument||(he.rr_src=he.src),delete he.src),{type:NodeType.Element,tagName:me,attributes:he,childNodes:[],isSVG:isSVGElement(z)||void 0,needBlock:pe,rootId:de};case z.TEXT_NODE:var je=z.parentNode&&z.parentNode.tagName,Me=z.textContent,Ne=je===`STYLE`?!0:void 0,Pe=je===`SCRIPT`?!0:void 0;if(Ne&&Me){try{z.nextSibling||z.previousSibling||(K=z.parentNode.sheet)!=null&&K.cssRules&&(Me=stringifyStyleSheet(z.parentNode.sheet))}catch(G){console.warn(`Cannot get CSS styles from text's parentNode. Error: `+G,z)}Me=absoluteToStylesheet(Me,getHref())}return Pe&&(Me=`SCRIPT_PLACEHOLDER`),!Ne&&!Pe&&needMaskingText(z,Z,Q)&&Me&&(Me=ie?ie(Me):Me.replace(/[\S]/g,`*`)),{type:NodeType.Text,textContent:Me||``,isStyle:Ne,rootId:de};case z.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:``,rootId:de};case z.COMMENT_NODE:return{type:NodeType.Comment,textContent:z.textContent||``,rootId:de};default:return!1}}function lowerIfExists(z){return z===void 0?``:z.toLowerCase()}function slimDOMExcluded(z,G){return!!(G.comment&&z.type===NodeType.Comment||z.type===NodeType.Element&&(G.script&&(z.tagName===`script`||z.tagName===`link`&&z.attributes.rel===`preload`&&z.attributes.as===`script`||z.tagName===`link`&&z.attributes.rel===`prefetch`&&typeof z.attributes.href==`string`&&z.attributes.href.endsWith(`.js`))||G.headFavicon&&(z.tagName===`link`&&z.attributes.rel===`shortcut icon`||z.tagName===`meta`&&(lowerIfExists(z.attributes.name).match(/^msapplication-tile(image|color)$/)||lowerIfExists(z.attributes.name)===`application-name`||lowerIfExists(z.attributes.rel)===`icon`||lowerIfExists(z.attributes.rel)===`apple-touch-icon`||lowerIfExists(z.attributes.rel)===`shortcut icon`))||z.tagName===`meta`&&(G.headMetaDescKeywords&&lowerIfExists(z.attributes.name).match(/^description|keywords$/)||G.headMetaSocial&&(lowerIfExists(z.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(z.attributes.name).match(/^(og|twitter):/)||lowerIfExists(z.attributes.name)===`pinterest`)||G.headMetaRobots&&(lowerIfExists(z.attributes.name)===`robots`||lowerIfExists(z.attributes.name)===`googlebot`||lowerIfExists(z.attributes.name)===`bingbot`)||G.headMetaHttpEquiv&&z.attributes[`http-equiv`]!==void 0||G.headMetaAuthorship&&(lowerIfExists(z.attributes.name)===`author`||lowerIfExists(z.attributes.name)===`generator`||lowerIfExists(z.attributes.name)===`framework`||lowerIfExists(z.attributes.name)===`publisher`||lowerIfExists(z.attributes.name)===`progid`||lowerIfExists(z.attributes.property).match(/^article:/)||lowerIfExists(z.attributes.property).match(/^product:/))||G.headMetaVerification&&(lowerIfExists(z.attributes.name)===`google-site-verification`||lowerIfExists(z.attributes.name)===`yandex-verification`||lowerIfExists(z.attributes.name)===`csrf-token`||lowerIfExists(z.attributes.name)===`p:domain_verify`||lowerIfExists(z.attributes.name)===`verify-v1`||lowerIfExists(z.attributes.name)===`verification`||lowerIfExists(z.attributes.name)===`shopify-checkout-api-token`))))}function serializeNodeWithId(z,G){var K=G.doc,J=G.map,Y=G.blockClass,X=G.blockSelector,Z=G.maskTextClass,Q=G.maskTextSelector,ee=G.skipChild,te=ee===void 0?!1:ee,ne=G.inlineStylesheet,ie=ne===void 0?!0:ne,ae=G.maskInputOptions,oe=ae===void 0?{}:ae,se=G.maskTextFn,ce=G.maskInputFn,le=G.slimDOMOptions,ue=G.dataURLOptions,de=ue===void 0?{}:ue,fe=G.inlineImages,pe=fe===void 0?!1:fe,me=G.recordCanvas,he=me===void 0?!1:me,ge=G.onSerialize,_e=G.onIframeLoad,ve=G.iframeLoadTimeout,ye=ve===void 0?5e3:ve,be=G.keepIframeSrcFn,xe=be===void 0?function(){return!1}:be,Se=G.preserveWhiteSpace,Ce=Se===void 0?!0:Se,we=serializeNode(z,{doc:K,blockClass:Y,blockSelector:X,maskTextClass:Z,maskTextSelector:Q,inlineStylesheet:ie,maskInputOptions:oe,maskTextFn:se,maskInputFn:ce,dataURLOptions:de,inlineImages:pe,recordCanvas:he,keepIframeSrcFn:xe});if(!we)return console.warn(z,`not serialized`),null;var Te=`__sn`in z?z.__sn.id:slimDOMExcluded(we,le)||!Ce&&we.type===NodeType.Text&&!we.isStyle&&!we.textContent.replace(/^\s+|\s+$/gm,``).length?IGNORED_NODE:genId(),Ee=Object.assign(we,{id:Te});if(z.__sn=Ee,Te===IGNORED_NODE)return null;J[Te]=z,ge&&ge(z);var De=!te;if(Ee.type===NodeType.Element&&(De=De&&!Ee.needBlock,delete Ee.needBlock,z.shadowRoot&&(Ee.isShadowHost=!0)),(Ee.type===NodeType.Document||Ee.type===NodeType.Element)&&De){le.headWhitespace&&we.type===NodeType.Element&&we.tagName===`head`&&(Ce=!1);for(var Oe={doc:K,map:J,blockClass:Y,blockSelector:X,maskTextClass:Z,maskTextSelector:Q,skipChild:te,inlineStylesheet:ie,maskInputOptions:oe,maskTextFn:se,maskInputFn:ce,slimDOMOptions:le,dataURLOptions:de,inlineImages:pe,recordCanvas:he,preserveWhiteSpace:Ce,onSerialize:ge,onIframeLoad:_e,iframeLoadTimeout:ye,keepIframeSrcFn:xe},ke=0,Ae=Array.from(z.childNodes);ke<Ae.length;ke++){var je=Ae[ke],Me=serializeNodeWithId(je,Oe);Me&&Ee.childNodes.push(Me)}if(isElement(z)&&z.shadowRoot)for(var Ne=0,Pe=Array.from(z.shadowRoot.childNodes);Ne<Pe.length;Ne++){var je=Pe[Ne],Me=serializeNodeWithId(je,Oe);Me&&(Me.isShadow=!0,Ee.childNodes.push(Me))}}return z.parentNode&&isShadowRoot(z.parentNode)&&(Ee.isShadow=!0),Ee.type===NodeType.Element&&Ee.tagName===`iframe`&&onceIframeLoaded(z,function(){var G=z.contentDocument;if(G&&_e){var K=serializeNodeWithId(G,{doc:G,map:J,blockClass:Y,blockSelector:X,maskTextClass:Z,maskTextSelector:Q,skipChild:!1,inlineStylesheet:ie,maskInputOptions:oe,maskTextFn:se,maskInputFn:ce,slimDOMOptions:le,dataURLOptions:de,inlineImages:pe,recordCanvas:he,preserveWhiteSpace:Ce,onSerialize:ge,onIframeLoad:_e,iframeLoadTimeout:ye,keepIframeSrcFn:xe});K&&_e(z,K)}},ye),Ee}function snapshot(z,G){var K=G||{},J=K.blockClass,Y=J===void 0?`rr-block`:J,X=K.blockSelector,Z=X===void 0?null:X,Q=K.maskTextClass,ee=Q===void 0?`rr-mask`:Q,te=K.maskTextSelector,ne=te===void 0?null:te,ie=K.inlineStylesheet,ae=ie===void 0?!0:ie,oe=K.inlineImages,se=oe===void 0?!1:oe,ce=K.recordCanvas,le=ce===void 0?!1:ce,ue=K.maskAllInputs,de=ue===void 0?!1:ue,fe=K.maskTextFn,pe=K.maskInputFn,me=K.slimDOM,he=me===void 0?!1:me,ge=K.dataURLOptions,_e=K.preserveWhiteSpace,ve=K.onSerialize,ye=K.onIframeLoad,be=K.iframeLoadTimeout,xe=K.keepIframeSrcFn,Se=xe===void 0?function(){return!1}:xe,Ce={};return[serializeNodeWithId(z,{doc:z,map:Ce,blockClass:Y,blockSelector:Z,maskTextClass:ee,maskTextSelector:ne,skipChild:!1,inlineStylesheet:ae,maskInputOptions:de===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:de===!1?{password:!0}:de,maskTextFn:fe,maskInputFn:pe,slimDOMOptions:he===!0||he===`all`?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:he===`all`,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:he===!1?{}:he,dataURLOptions:ge,inlineImages:se,recordCanvas:le,preserveWhiteSpace:_e,onSerialize:ve,onIframeLoad:ye,iframeLoadTimeout:be,keepIframeSrcFn:Se}),Ce]}var HOVER_SELECTOR=/([^\\]):hover/,HOVER_SELECTOR_GLOBAL=new RegExp(HOVER_SELECTOR.source,`g`),EventType;(function(z){z[z.DomContentLoaded=0]=`DomContentLoaded`,z[z.Load=1]=`Load`,z[z.FullSnapshot=2]=`FullSnapshot`,z[z.IncrementalSnapshot=3]=`IncrementalSnapshot`,z[z.Meta=4]=`Meta`,z[z.Custom=5]=`Custom`,z[z.Plugin=6]=`Plugin`})(EventType||(EventType={}));var IncrementalSource;(function(z){z[z.Mutation=0]=`Mutation`,z[z.MouseMove=1]=`MouseMove`,z[z.MouseInteraction=2]=`MouseInteraction`,z[z.Scroll=3]=`Scroll`,z[z.ViewportResize=4]=`ViewportResize`,z[z.Input=5]=`Input`,z[z.TouchMove=6]=`TouchMove`,z[z.MediaInteraction=7]=`MediaInteraction`,z[z.StyleSheetRule=8]=`StyleSheetRule`,z[z.CanvasMutation=9]=`CanvasMutation`,z[z.Font=10]=`Font`,z[z.Log=11]=`Log`,z[z.Drag=12]=`Drag`,z[z.StyleDeclaration=13]=`StyleDeclaration`})(IncrementalSource||(IncrementalSource={}));var MouseInteractions;(function(z){z[z.MouseUp=0]=`MouseUp`,z[z.MouseDown=1]=`MouseDown`,z[z.Click=2]=`Click`,z[z.ContextMenu=3]=`ContextMenu`,z[z.DblClick=4]=`DblClick`,z[z.Focus=5]=`Focus`,z[z.Blur=6]=`Blur`,z[z.TouchStart=7]=`TouchStart`,z[z.TouchMove_Departed=8]=`TouchMove_Departed`,z[z.TouchEnd=9]=`TouchEnd`,z[z.TouchCancel=10]=`TouchCancel`})(MouseInteractions||(MouseInteractions={}));var CanvasContext;(function(z){z[z[`2D`]=0]=`2D`,z[z.WebGL=1]=`WebGL`,z[z.WebGL2=2]=`WebGL2`})(CanvasContext||(CanvasContext={}));var MediaInteractions;(function(z){z[z.Play=0]=`Play`,z[z.Pause=1]=`Pause`,z[z.Seeked=2]=`Seeked`,z[z.VolumeChange=3]=`VolumeChange`})(MediaInteractions||(MediaInteractions={}));var ReplayerEvents;(function(z){z.Start=`start`,z.Pause=`pause`,z.Resume=`resume`,z.Resize=`resize`,z.Finish=`finish`,z.FullsnapshotRebuilded=`fullsnapshot-rebuilded`,z.LoadStylesheetStart=`load-stylesheet-start`,z.LoadStylesheetEnd=`load-stylesheet-end`,z.SkipStart=`skip-start`,z.SkipEnd=`skip-end`,z.MouseInteraction=`mouse-interaction`,z.EventCast=`event-cast`,z.CustomEvent=`custom-event`,z.Flush=`flush`,z.StateChange=`state-change`,z.PlayBack=`play-back`})(ReplayerEvents||(ReplayerEvents={}));function on(z,G,K){K===void 0&&(K=document);var J={capture:!0,passive:!0};return K.addEventListener(z,G,J),function(){return K.removeEventListener(z,G,J)}}function createMirror(){return{map:{},getId:function(z){return!z||!z.__sn?-1:z.__sn.id},getNode:function(z){return this.map[z]||null},removeNodeFromMap:function(z){var G=this,K=z.__sn&&z.__sn.id;delete this.map[K],z.childNodes&&z.childNodes.forEach(function(z){return G.removeNodeFromMap(z)})},has:function(z){return this.map.hasOwnProperty(z)},reset:function(){this.map={}}}}var DEPARTED_MIRROR_ACCESS_WARNING=`Please stop import mirror directly. Instead of that,\r
17
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
18
+ or you can use record.mirror to access the mirror instance during recording.`,_mirror={map:{},getId:function(){return console.error(DEPARTED_MIRROR_ACCESS_WARNING),-1},getNode:function(){return console.error(DEPARTED_MIRROR_ACCESS_WARNING),null},removeNodeFromMap:function(){console.error(DEPARTED_MIRROR_ACCESS_WARNING)},has:function(){return console.error(DEPARTED_MIRROR_ACCESS_WARNING),!1},reset:function(){console.error(DEPARTED_MIRROR_ACCESS_WARNING)}};typeof window<`u`&&window.Proxy&&window.Reflect&&(_mirror=new Proxy(_mirror,{get:function(z,G,K){return G===`map`&&console.error(DEPARTED_MIRROR_ACCESS_WARNING),Reflect.get(z,G,K)}}));function throttle(z,G,K){K===void 0&&(K={});var J=null,Y=0;return function(X){var Z=Date.now();!Y&&K.leading===!1&&(Y=Z);var Q=G-(Z-Y),ee=this,te=arguments;Q<=0||Q>G?(J&&(clearTimeout(J),J=null),Y=Z,z.apply(ee,te)):!J&&K.trailing!==!1&&(J=setTimeout(function(){Y=K.leading===!1?0:Date.now(),J=null,z.apply(ee,te)},Q))}}function hookSetter(z,G,K,J,Y){Y===void 0&&(Y=window);var X=Y.Object.getOwnPropertyDescriptor(z,G);return Y.Object.defineProperty(z,G,J?K:{set:function(z){var G=this;setTimeout(function(){K.set.call(G,z)},0),X&&X.set&&X.set.call(this,z)}}),function(){return hookSetter(z,G,X||{},!0)}}function patch(z,G,K){try{if(!(G in z))return function(){};var J=z[G],Y=K(J);return typeof Y==`function`&&(Y.prototype=Y.prototype||{},Object.defineProperties(Y,{__rrweb_original__:{enumerable:!1,value:J}})),z[G]=Y,function(){z[G]=J}}catch(z){return function(){}}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function isBlocked(z,G){if(!z)return!1;if(z.nodeType===z.ELEMENT_NODE){var K=!1;if(typeof G==`string`){if(z.closest!==void 0)return z.closest(`.`+G)!==null;K=z.classList.contains(G)}else z.classList.forEach(function(z){G.test(z)&&(K=!0)});return K||isBlocked(z.parentNode,G)}return z.nodeType,z.TEXT_NODE,isBlocked(z.parentNode,G)}function isIgnored(z){return`__sn`in z?z.__sn.id===IGNORED_NODE:!1}function isAncestorRemoved(z,G){if(isShadowRoot(z))return!1;var K=G.getId(z);return G.has(K)?z.parentNode&&z.parentNode.nodeType===z.DOCUMENT_NODE?!1:z.parentNode?isAncestorRemoved(z.parentNode,G):!0:!0}function isTouchEvent(z){return!!z.changedTouches}function polyfill(z){z===void 0&&(z=window),`NodeList`in z&&!z.NodeList.prototype.forEach&&(z.NodeList.prototype.forEach=Array.prototype.forEach),`DOMTokenList`in z&&!z.DOMTokenList.prototype.forEach&&(z.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(z){if(!(0 in arguments))throw TypeError(`1 argument is required`);do if(this===z)return!0;while(z=z&&z.parentNode);return!1})}var TreeIndex=function(){function z(){this.reset()}return z.prototype.add=function(z){var G=this.indexes.get(z.parentId),K={id:z.node.id,mutation:z,children:[],texts:[],attributes:[]};G?(K.parent=G,G.children[K.id]=K):this.tree[K.id]=K,this.indexes.set(K.id,K)},z.prototype.remove=function(z,G){var K=this,J=this.indexes.get(z.parentId),Y=this.indexes.get(z.id),X=function(z){K.removeIdSet.add(z);var J=G.getNode(z);J==null||J.childNodes.forEach(function(z){`__sn`in z&&X(z.__sn.id)})},Z=function(G){K.removeIdSet.add(G.id),Object.values(G.children).forEach(function(z){return Z(z)});var J=K.indexes.get(G.id);if(J){var Y=J.parent;Y&&(delete J.parent,delete Y.children[J.id],K.indexes.delete(z.id))}};Y?J?(delete Y.parent,delete J.children[Y.id],this.indexes.delete(z.id),Z(Y)):(delete this.tree[Y.id],this.indexes.delete(Y.id),Z(Y)):(this.removeNodeMutations.push(z),X(z.id))},z.prototype.text=function(z){var G=this.indexes.get(z.id);G?G.texts.push(z):this.textMutations.push(z)},z.prototype.attribute=function(z){var G=this.indexes.get(z.id);G?G.attributes.push(z):this.attributeMutations.push(z)},z.prototype.scroll=function(z){this.scrollMap.set(z.id,z)},z.prototype.input=function(z){this.inputMap.set(z.id,z)},z.prototype.flush=function(){var z,G,K,J,Y=this,X=this,Z=X.tree,Q=X.removeNodeMutations,ee=X.textMutations,te=X.attributeMutations,ne={source:IncrementalSource.Mutation,removes:Q,texts:ee,attributes:te,adds:[]},ie=function(z,G){G&&Y.removeIdSet.add(z.id),ne.texts=ne.texts.concat(G?[]:z.texts).filter(function(z){return!Y.removeIdSet.has(z.id)}),ne.attributes=ne.attributes.concat(G?[]:z.attributes).filter(function(z){return!Y.removeIdSet.has(z.id)}),!Y.removeIdSet.has(z.id)&&!Y.removeIdSet.has(z.mutation.parentId)&&!G?(ne.adds.push(z.mutation),z.children&&Object.values(z.children).forEach(function(z){return ie(z,!1)})):Object.values(z.children).forEach(function(z){return ie(z,!0)})};Object.values(Z).forEach(function(z){return ie(z,!1)});try{for(var ae=__values(this.scrollMap.keys()),oe=ae.next();!oe.done;oe=ae.next()){var se=oe.value;this.removeIdSet.has(se)&&this.scrollMap.delete(se)}}catch(G){z={error:G}}finally{try{oe&&!oe.done&&(G=ae.return)&&G.call(ae)}finally{if(z)throw z.error}}try{for(var ce=__values(this.inputMap.keys()),le=ce.next();!le.done;le=ce.next()){var se=le.value;this.removeIdSet.has(se)&&this.inputMap.delete(se)}}catch(z){K={error:z}}finally{try{le&&!le.done&&(J=ce.return)&&J.call(ce)}finally{if(K)throw K.error}}var ue=new Map(this.scrollMap),de=new Map(this.inputMap);return this.reset(),{mutationData:ne,scrollMap:ue,inputMap:de}},z.prototype.reset=function(){this.tree=[],this.indexes=new Map,this.removeNodeMutations=[],this.textMutations=[],this.attributeMutations=[],this.removeIdSet=new Set,this.scrollMap=new Map,this.inputMap=new Map},z.prototype.idRemoved=function(z){return this.removeIdSet.has(z)},z}();function isIframeINode(z){return`__sn`in z?z.__sn.type===NodeType.Element&&z.__sn.tagName===`iframe`:!1}function hasShadowRoot(z){return!!(z!=null&&z.shadowRoot)}function isNodeInLinkedList(z){return`__ln`in z}var DoubleLinkedList=function(){function z(){this.length=0,this.head=null}return z.prototype.get=function(z){if(z>=this.length)throw Error(`Position outside of list range`);for(var G=this.head,K=0;K<z;K++)G=(G==null?void 0:G.next)||null;return G},z.prototype.addNode=function(z){var G={value:z,previous:null,next:null};if(z.__ln=G,z.previousSibling&&isNodeInLinkedList(z.previousSibling)){var K=z.previousSibling.__ln.next;G.next=K,G.previous=z.previousSibling.__ln,z.previousSibling.__ln.next=G,K&&(K.previous=G)}else if(z.nextSibling&&isNodeInLinkedList(z.nextSibling)&&z.nextSibling.__ln.previous){var K=z.nextSibling.__ln.previous;G.previous=K,G.next=z.nextSibling.__ln,z.nextSibling.__ln.previous=G,K&&(K.next=G)}else this.head&&(this.head.previous=G),G.next=this.head,this.head=G;this.length++},z.prototype.removeNode=function(z){var G=z.__ln;this.head&&(G.previous?(G.previous.next=G.next,G.next&&(G.next.previous=G.previous)):(this.head=G.next,this.head&&(this.head.previous=null)),z.__ln&&delete z.__ln,this.length--)},z}(),moveKey=function(z,G){return`${z}@${G}`};function isINode(z){return`__sn`in z}var MutationBuffer=function(){function z(){var z=this;this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=function(G){G.forEach(z.processMutation),z.emit()},this.emit=function(){var G,K,J,Y;if(!(z.frozen||z.locked)){for(var X=[],Z=new DoubleLinkedList,Q=function(G){for(var K=G,J=IGNORED_NODE;J===IGNORED_NODE;)K=K&&K.nextSibling,J=K&&z.mirror.getId(K);return J},ee=function(G){for(var K,J,Y,ee,te,ne=G.getRootNode?(K=G.getRootNode())==null?void 0:K.host:null,ie=ne;(Y=(J=ie==null?void 0:ie.getRootNode)==null?void 0:J.call(ie))!=null&&Y.host;)ie=((te=(ee=ie==null?void 0:ie.getRootNode)==null?void 0:ee.call(ie))==null?void 0:te.host)||null;var ae=!z.doc.contains(G)&&(ie===null||!z.doc.contains(ie));if(!(!G.parentNode||ae)){var oe=isShadowRoot(G.parentNode)?z.mirror.getId(ne):z.mirror.getId(G.parentNode),se=Q(G);if(oe===-1||se===-1)return Z.addNode(G);var ce=serializeNodeWithId(G,{doc:z.doc,map:z.mirror.map,blockClass:z.blockClass,blockSelector:z.blockSelector,maskTextClass:z.maskTextClass,maskTextSelector:z.maskTextSelector,skipChild:!0,inlineStylesheet:z.inlineStylesheet,maskInputOptions:z.maskInputOptions,maskTextFn:z.maskTextFn,maskInputFn:z.maskInputFn,slimDOMOptions:z.slimDOMOptions,recordCanvas:z.recordCanvas,inlineImages:z.inlineImages,onSerialize:function(K){isIframeINode(K)&&z.iframeManager.addIframe(K),hasShadowRoot(G)&&z.shadowDomManager.addShadowRoot(G.shadowRoot,document)},onIframeLoad:function(G,K){z.iframeManager.attachIframe(G,K),z.shadowDomManager.observeAttachShadow(G)}});ce&&X.push({parentId:oe,nextId:se,node:ce})}};z.mapRemoves.length;)z.mirror.removeNodeFromMap(z.mapRemoves.shift());try{for(var te=__values(z.movedSet),ne=te.next();!ne.done;ne=te.next()){var ie=ne.value;isParentRemoved(z.removes,ie,z.mirror)&&!z.movedSet.has(ie.parentNode)||ee(ie)}}catch(z){G={error:z}}finally{try{ne&&!ne.done&&(K=te.return)&&K.call(te)}finally{if(G)throw G.error}}try{for(var ae=__values(z.addedSet),oe=ae.next();!oe.done;oe=ae.next()){var ie=oe.value;!isAncestorInSet(z.droppedSet,ie)&&!isParentRemoved(z.removes,ie,z.mirror)||isAncestorInSet(z.movedSet,ie)?ee(ie):z.droppedSet.add(ie)}}catch(z){J={error:z}}finally{try{oe&&!oe.done&&(Y=ae.return)&&Y.call(ae)}finally{if(J)throw J.error}}for(var se=null;Z.length;){var ce=null;if(se){var le=z.mirror.getId(se.value.parentNode),ue=Q(se.value);le!==-1&&ue!==-1&&(ce=se)}if(!ce)for(var de=Z.length-1;de>=0;de--){var fe=Z.get(de);if(fe){var le=z.mirror.getId(fe.value.parentNode),ue=Q(fe.value);if(le!==-1&&ue!==-1){ce=fe;break}}}if(!ce){for(;Z.head;)Z.removeNode(Z.head.value);break}se=ce.previous,Z.removeNode(ce.value),ee(ce.value)}var pe={texts:z.texts.map(function(G){return{id:z.mirror.getId(G.node),value:G.value}}).filter(function(G){return z.mirror.has(G.id)}),attributes:z.attributes.map(function(G){return{id:z.mirror.getId(G.node),attributes:G.attributes}}).filter(function(G){return z.mirror.has(G.id)}),removes:z.removes,adds:X};!pe.texts.length&&!pe.attributes.length&&!pe.removes.length&&!pe.adds.length||(z.texts=[],z.attributes=[],z.removes=[],z.addedSet=new Set,z.movedSet=new Set,z.droppedSet=new Set,z.movedMap={},z.mutationCb(pe))}},this.processMutation=function(G){var K,J,Y,X;if(!isIgnored(G.target))switch(G.type){case`characterData`:var Z=G.target.textContent;!isBlocked(G.target,z.blockClass)&&Z!==G.oldValue&&z.texts.push({value:needMaskingText(G.target,z.maskTextClass,z.maskTextSelector)&&Z?z.maskTextFn?z.maskTextFn(Z):Z.replace(/[\S]/g,`*`):Z,node:G.target});break;case`attributes`:var Q=G.target,Z=G.target.getAttribute(G.attributeName);if(G.attributeName===`value`&&(Z=maskInputValue({maskInputOptions:z.maskInputOptions,tagName:G.target.tagName,type:G.target.getAttribute(`type`),value:Z,maskInputFn:z.maskInputFn})),isBlocked(G.target,z.blockClass)||Z===G.oldValue)return;var ee=z.attributes.find(function(z){return z.node===G.target});if(ee||(ee={node:G.target,attributes:{}},z.attributes.push(ee)),G.attributeName===`style`){var te=z.doc.createElement(`span`);G.oldValue&&te.setAttribute(`style`,G.oldValue),(ee.attributes.style===void 0||ee.attributes.style===null)&&(ee.attributes.style={});var ne=ee.attributes.style;try{for(var ie=__values(Array.from(Q.style)),ae=ie.next();!ae.done;ae=ie.next()){var oe=ae.value,se=Q.style.getPropertyValue(oe),ce=Q.style.getPropertyPriority(oe);(se!==te.style.getPropertyValue(oe)||ce!==te.style.getPropertyPriority(oe))&&(ce===``?ne[oe]=se:ne[oe]=[se,ce])}}catch(z){K={error:z}}finally{try{ae&&!ae.done&&(J=ie.return)&&J.call(ie)}finally{if(K)throw K.error}}try{for(var le=__values(Array.from(te.style)),ue=le.next();!ue.done;ue=le.next()){var oe=ue.value;Q.style.getPropertyValue(oe)===``&&(ne[oe]=!1)}}catch(z){Y={error:z}}finally{try{ue&&!ue.done&&(X=le.return)&&X.call(le)}finally{if(Y)throw Y.error}}}else ee.attributes[G.attributeName]=transformAttribute(z.doc,G.target.tagName,G.attributeName,Z);break;case`childList`:G.addedNodes.forEach(function(K){return z.genAdds(K,G.target)}),G.removedNodes.forEach(function(K){var J=z.mirror.getId(K),Y=isShadowRoot(G.target)?z.mirror.getId(G.target.host):z.mirror.getId(G.target);isBlocked(G.target,z.blockClass)||isIgnored(K)||(z.addedSet.has(K)?(deepDelete(z.addedSet,K),z.droppedSet.add(K)):z.addedSet.has(G.target)&&J===-1||isAncestorRemoved(G.target,z.mirror)||(z.movedSet.has(K)&&z.movedMap[moveKey(J,Y)]?deepDelete(z.movedSet,K):z.removes.push({parentId:Y,id:J,isShadow:isShadowRoot(G.target)?!0:void 0})),z.mapRemoves.push(K))});break}},this.genAdds=function(G,K){if(!(K&&isBlocked(K,z.blockClass))){if(isINode(G)){if(isIgnored(G))return;z.movedSet.add(G);var J=null;K&&isINode(K)&&(J=K.__sn.id),J&&(z.movedMap[moveKey(G.__sn.id,J)]=!0)}else z.addedSet.add(G),z.droppedSet.delete(G);isBlocked(G,z.blockClass)||G.childNodes.forEach(function(G){return z.genAdds(G)})}}}return z.prototype.init=function(z){var G=this;[`mutationCb`,`blockClass`,`blockSelector`,`maskTextClass`,`maskTextSelector`,`inlineStylesheet`,`maskInputOptions`,`maskTextFn`,`maskInputFn`,`recordCanvas`,`inlineImages`,`slimDOMOptions`,`doc`,`mirror`,`iframeManager`,`shadowDomManager`,`canvasManager`].forEach(function(K){G[K]=z[K]})},z.prototype.freeze=function(){this.frozen=!0,this.canvasManager.freeze()},z.prototype.unfreeze=function(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()},z.prototype.isFrozen=function(){return this.frozen},z.prototype.lock=function(){this.locked=!0,this.canvasManager.lock()},z.prototype.unlock=function(){this.locked=!1,this.canvasManager.unlock(),this.emit()},z.prototype.reset=function(){this.shadowDomManager.reset(),this.canvasManager.reset()},z}();function deepDelete(z,G){z.delete(G),G.childNodes.forEach(function(G){return deepDelete(z,G)})}function isParentRemoved(z,G,K){var J=G.parentNode;if(!J)return!1;var Y=K.getId(J);return z.some(function(z){return z.id===Y})?!0:isParentRemoved(z,J,K)}function isAncestorInSet(z,G){var K=G.parentNode;return K?z.has(K)?!0:isAncestorInSet(z,K):!1}var mutationBuffers=[],isCSSGroupingRuleSupported=typeof CSSGroupingRule<`u`,isCSSMediaRuleSupported=typeof CSSMediaRule<`u`,isCSSSupportsRuleSupported=typeof CSSSupportsRule<`u`,isCSSConditionRuleSupported=typeof CSSConditionRule<`u`;function getEventTarget(z){try{if(`composedPath`in z){var G=z.composedPath();if(G.length)return G[0]}else if(`path`in z&&z.path.length)return z.path[0];return z.target}catch(G){return z.target}}function initMutationObserver(z,G){var K,J,Y=new MutationBuffer;mutationBuffers.push(Y),Y.init(z);var X=window.MutationObserver||window.__rrMutationObserver,Z=(J=(K=window==null?void 0:window.Zone)==null?void 0:K.__symbol__)==null?void 0:J.call(K,`MutationObserver`);Z&&window[Z]&&(X=window[Z]);var Q=new X(Y.processMutations.bind(Y));return Q.observe(G,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),Q}function initMoveObserver(z){var G=z.mousemoveCb,K=z.sampling,J=z.doc,Y=z.mirror;if(K.mousemove===!1)return function(){};var X=typeof K.mousemove==`number`?K.mousemove:50,Z=typeof K.mousemoveCallback==`number`?K.mousemoveCallback:500,Q=[],ee,te=throttle(function(z){var K=Date.now()-ee;G(Q.map(function(z){return z.timeOffset-=K,z}),z),Q=[],ee=null},Z),ne=throttle(function(z){var G=getEventTarget(z),K=isTouchEvent(z)?z.changedTouches[0]:z,J=K.clientX,X=K.clientY;ee||(ee=Date.now()),Q.push({x:J,y:X,id:Y.getId(G),timeOffset:Date.now()-ee}),te(typeof DragEvent<`u`&&z instanceof DragEvent?IncrementalSource.Drag:z instanceof MouseEvent?IncrementalSource.MouseMove:IncrementalSource.TouchMove)},X,{trailing:!1}),ie=[on(`mousemove`,ne,J),on(`touchmove`,ne,J),on(`drag`,ne,J)];return function(){ie.forEach(function(z){return z()})}}function initMouseInteractionObserver(z){var G=z.mouseInteractionCb,K=z.doc,J=z.mirror,Y=z.blockClass,X=z.sampling;if(X.mouseInteraction===!1)return function(){};var Z=X.mouseInteraction===!0||X.mouseInteraction===void 0?{}:X.mouseInteraction,Q=[],ee=function(z){return function(K){var X=getEventTarget(K);if(!isBlocked(X,Y)){var Z=isTouchEvent(K)?K.changedTouches[0]:K;if(Z){var Q=J.getId(X),ee=Z.clientX,te=Z.clientY;G({type:MouseInteractions[z],id:Q,x:ee,y:te})}}}};return Object.keys(MouseInteractions).filter(function(z){return Number.isNaN(Number(z))&&!z.endsWith(`_Departed`)&&Z[z]!==!1}).forEach(function(z){var G=z.toLowerCase(),J=ee(z);Q.push(on(G,J,K))}),function(){Q.forEach(function(z){return z()})}}function initScrollObserver(z){var G=z.scrollCb,K=z.doc,J=z.mirror,Y=z.blockClass,X=z.sampling;return on(`scroll`,throttle(function(z){var X=getEventTarget(z);if(!(!X||isBlocked(X,Y))){var Z=J.getId(X);if(X===K){var Q=K.scrollingElement||K.documentElement;G({id:Z,x:Q.scrollLeft,y:Q.scrollTop})}else G({id:Z,x:X.scrollLeft,y:X.scrollTop})}},X.scroll||100),K)}function initViewportResizeObserver(z){var G=z.viewportResizeCb,K=-1,J=-1;return on(`resize`,throttle(function(){var z=getWindowHeight(),Y=getWindowWidth();(K!==z||J!==Y)&&(G({width:Number(Y),height:Number(z)}),K=z,J=Y)},200),window)}function wrapEventWithUserTriggeredFlag(z,G){var K=__assign({},z);return G||delete K.userTriggered,K}var INPUT_TAGS=[`INPUT`,`TEXTAREA`,`SELECT`],lastInputValueMap=new WeakMap;function initInputObserver(z){var G=z.inputCb,K=z.doc,J=z.mirror,Y=z.blockClass,X=z.ignoreClass,Z=z.maskInputOptions,Q=z.maskInputFn,ee=z.sampling,te=z.userTriggeredOnInput;function ne(z){var G=getEventTarget(z),J=z.isTrusted;if(G&&G.tagName===`OPTION`&&(G=G.parentElement),!(!G||!G.tagName||INPUT_TAGS.indexOf(G.tagName)<0||isBlocked(G,Y))){var ee=G.type;if(!G.classList.contains(X)){var ne=G.value,ae=!1;ee===`radio`||ee===`checkbox`?ae=G.checked:(Z[G.tagName.toLowerCase()]||Z[ee])&&(ne=maskInputValue({maskInputOptions:Z,tagName:G.tagName,type:ee,value:ne,maskInputFn:Q})),ie(G,wrapEventWithUserTriggeredFlag({text:ne,isChecked:ae,userTriggered:J},te));var oe=G.name;ee===`radio`&&oe&&ae&&K.querySelectorAll(`input[type="radio"][name="${oe}"]`).forEach(function(z){z!==G&&ie(z,wrapEventWithUserTriggeredFlag({text:z.value,isChecked:!ae,userTriggered:!1},te))})}}}function ie(z,K){var Y=lastInputValueMap.get(z);if(!Y||Y.text!==K.text||Y.isChecked!==K.isChecked){lastInputValueMap.set(z,K);var X=J.getId(z);G(__assign(__assign({},K),{id:X}))}}var ae=(ee.input===`last`?[`change`]:[`input`,`change`]).map(function(z){return on(z,ne,K)}),oe=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`),se=[[HTMLInputElement.prototype,`value`],[HTMLInputElement.prototype,`checked`],[HTMLSelectElement.prototype,`value`],[HTMLTextAreaElement.prototype,`value`],[HTMLSelectElement.prototype,`selectedIndex`],[HTMLOptionElement.prototype,`selected`]];return oe&&oe.set&&ae.push.apply(ae,__spreadArray([],__read(se.map(function(z){return hookSetter(z[0],z[1],{set:function(){ne({target:this})}})})),!1)),function(){ae.forEach(function(z){return z()})}}function getNestedCSSRulePositions(z){var G=[];function K(z,G){if(isCSSGroupingRuleSupported&&z.parentRule instanceof CSSGroupingRule||isCSSMediaRuleSupported&&z.parentRule instanceof CSSMediaRule||isCSSSupportsRuleSupported&&z.parentRule instanceof CSSSupportsRule||isCSSConditionRuleSupported&&z.parentRule instanceof CSSConditionRule){var K=Array.from(z.parentRule.cssRules),J=K.indexOf(z);G.unshift(J)}else{var K=Array.from(z.parentStyleSheet.cssRules),J=K.indexOf(z);G.unshift(J)}return G}return K(z,G)}function initStyleSheetObserver(z,G){var K=z.styleSheetRuleCb,J=z.mirror,Y=G.win,X=Y.CSSStyleSheet.prototype.insertRule;Y.CSSStyleSheet.prototype.insertRule=function(z,G){var Y=J.getId(this.ownerNode);return Y!==-1&&K({id:Y,adds:[{rule:z,index:G}]}),X.apply(this,arguments)};var Z=Y.CSSStyleSheet.prototype.deleteRule;Y.CSSStyleSheet.prototype.deleteRule=function(z){var G=J.getId(this.ownerNode);return G!==-1&&K({id:G,removes:[{index:z}]}),Z.apply(this,arguments)};var Q={};isCSSGroupingRuleSupported?Q.CSSGroupingRule=Y.CSSGroupingRule:(isCSSMediaRuleSupported&&(Q.CSSMediaRule=Y.CSSMediaRule),isCSSConditionRuleSupported&&(Q.CSSConditionRule=Y.CSSConditionRule),isCSSSupportsRuleSupported&&(Q.CSSSupportsRule=Y.CSSSupportsRule));var ee={};return Object.entries(Q).forEach(function(z){var G=__read(z,2),Y=G[0],X=G[1];ee[Y]={insertRule:X.prototype.insertRule,deleteRule:X.prototype.deleteRule},X.prototype.insertRule=function(z,G){var X=J.getId(this.parentStyleSheet.ownerNode);return X!==-1&&K({id:X,adds:[{rule:z,index:__spreadArray(__spreadArray([],__read(getNestedCSSRulePositions(this)),!1),[G||0],!1)}]}),ee[Y].insertRule.apply(this,arguments)},X.prototype.deleteRule=function(z){var G=J.getId(this.parentStyleSheet.ownerNode);return G!==-1&&K({id:G,removes:[{index:__spreadArray(__spreadArray([],__read(getNestedCSSRulePositions(this)),!1),[z],!1)}]}),ee[Y].deleteRule.apply(this,arguments)}}),function(){Y.CSSStyleSheet.prototype.insertRule=X,Y.CSSStyleSheet.prototype.deleteRule=Z,Object.entries(Q).forEach(function(z){var G=__read(z,2),K=G[0],J=G[1];J.prototype.insertRule=ee[K].insertRule,J.prototype.deleteRule=ee[K].deleteRule})}}function initStyleDeclarationObserver(z,G){var K=z.styleDeclarationCb,J=z.mirror,Y=G.win,X=Y.CSSStyleDeclaration.prototype.setProperty;Y.CSSStyleDeclaration.prototype.setProperty=function(z,G,Y){var Z,Q,ee=J.getId((Q=(Z=this.parentRule)==null?void 0:Z.parentStyleSheet)==null?void 0:Q.ownerNode);return ee!==-1&&K({id:ee,set:{property:z,value:G,priority:Y},index:getNestedCSSRulePositions(this.parentRule)}),X.apply(this,arguments)};var Z=Y.CSSStyleDeclaration.prototype.removeProperty;return Y.CSSStyleDeclaration.prototype.removeProperty=function(z){var G,Y,X=J.getId((Y=(G=this.parentRule)==null?void 0:G.parentStyleSheet)==null?void 0:Y.ownerNode);return X!==-1&&K({id:X,remove:{property:z},index:getNestedCSSRulePositions(this.parentRule)}),Z.apply(this,arguments)},function(){Y.CSSStyleDeclaration.prototype.setProperty=X,Y.CSSStyleDeclaration.prototype.removeProperty=Z}}function initMediaInteractionObserver(z){var G=z.mediaInteractionCb,K=z.blockClass,J=z.mirror,Y=z.sampling,X=function(z){return throttle(function(Y){var X=getEventTarget(Y);if(!(!X||isBlocked(X,K))){var Z=X,Q=Z.currentTime,ee=Z.volume,te=Z.muted;G({type:z,id:J.getId(X),currentTime:Q,volume:ee,muted:te})}},Y.media||500)},Z=[on(`play`,X(0)),on(`pause`,X(1)),on(`seeked`,X(2)),on(`volumechange`,X(3))];return function(){Z.forEach(function(z){return z()})}}function initFontObserver(z){var G=z.fontCb,K=z.doc,J=K.defaultView;if(!J)return function(){};var Y=[],X=new WeakMap,Z=J.FontFace;J.FontFace=function(z,G,K){var J=new Z(z,G,K);return X.set(J,{family:z,buffer:typeof G!=`string`,descriptors:K,fontSource:typeof G==`string`?G:JSON.stringify(Array.from(new Uint8Array(G)))}),J};var Q=patch(K.fonts,`add`,function(z){return function(K){return setTimeout(function(){var z=X.get(K);z&&(G(z),X.delete(K))},0),z.apply(this,[K])}});return Y.push(function(){J.FontFace=Z}),Y.push(Q),function(){Y.forEach(function(z){return z()})}}function mergeHooks(z,G){var K=z.mutationCb,J=z.mousemoveCb,Y=z.mouseInteractionCb,X=z.scrollCb,Z=z.viewportResizeCb,Q=z.inputCb,ee=z.mediaInteractionCb,te=z.styleSheetRuleCb,ne=z.styleDeclarationCb,ie=z.canvasMutationCb,ae=z.fontCb;z.mutationCb=function(){var z=[...arguments];G.mutation&&G.mutation.apply(G,__spreadArray([],__read(z),!1)),K.apply(void 0,__spreadArray([],__read(z),!1))},z.mousemoveCb=function(){var z=[...arguments];G.mousemove&&G.mousemove.apply(G,__spreadArray([],__read(z),!1)),J.apply(void 0,__spreadArray([],__read(z),!1))},z.mouseInteractionCb=function(){var z=[...arguments];G.mouseInteraction&&G.mouseInteraction.apply(G,__spreadArray([],__read(z),!1)),Y.apply(void 0,__spreadArray([],__read(z),!1))},z.scrollCb=function(){var z=[...arguments];G.scroll&&G.scroll.apply(G,__spreadArray([],__read(z),!1)),X.apply(void 0,__spreadArray([],__read(z),!1))},z.viewportResizeCb=function(){var z=[...arguments];G.viewportResize&&G.viewportResize.apply(G,__spreadArray([],__read(z),!1)),Z.apply(void 0,__spreadArray([],__read(z),!1))},z.inputCb=function(){var z=[...arguments];G.input&&G.input.apply(G,__spreadArray([],__read(z),!1)),Q.apply(void 0,__spreadArray([],__read(z),!1))},z.mediaInteractionCb=function(){var z=[...arguments];G.mediaInteaction&&G.mediaInteaction.apply(G,__spreadArray([],__read(z),!1)),ee.apply(void 0,__spreadArray([],__read(z),!1))},z.styleSheetRuleCb=function(){var z=[...arguments];G.styleSheetRule&&G.styleSheetRule.apply(G,__spreadArray([],__read(z),!1)),te.apply(void 0,__spreadArray([],__read(z),!1))},z.styleDeclarationCb=function(){var z=[...arguments];G.styleDeclaration&&G.styleDeclaration.apply(G,__spreadArray([],__read(z),!1)),ne.apply(void 0,__spreadArray([],__read(z),!1))},z.canvasMutationCb=function(){var z=[...arguments];G.canvasMutation&&G.canvasMutation.apply(G,__spreadArray([],__read(z),!1)),ie.apply(void 0,__spreadArray([],__read(z),!1))},z.fontCb=function(){var z=[...arguments];G.font&&G.font.apply(G,__spreadArray([],__read(z),!1)),ae.apply(void 0,__spreadArray([],__read(z),!1))}}function initObservers(z,G){var K,J;G===void 0&&(G={});var Y=z.doc.defaultView;if(!Y)return function(){};mergeHooks(z,G);var X=initMutationObserver(z,z.doc),Z=initMoveObserver(z),Q=initMouseInteractionObserver(z),ee=initScrollObserver(z),te=initViewportResizeObserver(z),ne=initInputObserver(z),ie=initMediaInteractionObserver(z),ae=initStyleSheetObserver(z,{win:Y}),oe=initStyleDeclarationObserver(z,{win:Y}),se=z.collectFonts?initFontObserver(z):function(){},ce=[];try{for(var le=__values(z.plugins),ue=le.next();!ue.done;ue=le.next()){var de=ue.value;ce.push(de.observer(de.callback,Y,de.options))}}catch(z){K={error:z}}finally{try{ue&&!ue.done&&(J=le.return)&&J.call(le)}finally{if(K)throw K.error}}return function(){mutationBuffers.forEach(function(z){return z.reset()}),X.disconnect(),Z(),Q(),ee(),te(),ne(),ie(),ae(),oe(),se(),ce.forEach(function(z){return z()})}}var IframeManager=function(){function z(z){this.iframes=new WeakMap,this.mutationCb=z.mutationCb}return z.prototype.addIframe=function(z){this.iframes.set(z,!0)},z.prototype.addLoadListener=function(z){this.loadListener=z},z.prototype.attachIframe=function(z,G){var K;this.mutationCb({adds:[{parentId:z.__sn.id,nextId:null,node:G}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(K=this.loadListener)==null||K.call(this,z)},z}(),ShadowDomManager=function(){function z(z){this.restorePatches=[],this.mutationCb=z.mutationCb,this.scrollCb=z.scrollCb,this.bypassOptions=z.bypassOptions,this.mirror=z.mirror;var G=this;this.restorePatches.push(patch(HTMLElement.prototype,`attachShadow`,function(z){return function(){var K=z.apply(this,arguments);return this.shadowRoot&&G.addShadowRoot(this.shadowRoot,this.ownerDocument),K}}))}return z.prototype.addShadowRoot=function(z,G){initMutationObserver(__assign(__assign({},this.bypassOptions),{doc:G,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),z),initScrollObserver(__assign(__assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:z,mirror:this.mirror}))},z.prototype.observeAttachShadow=function(z){if(z.contentWindow){var G=this;this.restorePatches.push(patch(z.contentWindow.HTMLElement.prototype,`attachShadow`,function(K){return function(){var J=K.apply(this,arguments);return this.shadowRoot&&G.addShadowRoot(this.shadowRoot,z.contentDocument),J}}))}},z.prototype.reset=function(){this.restorePatches.forEach(function(z){return z()})},z}();function initCanvas2DMutationObserver(z,G,K,J){var Y,X,Z=[],Q=Object.getOwnPropertyNames(G.CanvasRenderingContext2D.prototype),ee=function(J){try{if(typeof G.CanvasRenderingContext2D.prototype[J]!=`function`)return`continue`;var Y=patch(G.CanvasRenderingContext2D.prototype,J,function(G){return function(){for(var Y=this,X=[],Z=0;Z<arguments.length;Z++)X[Z]=arguments[Z];return isBlocked(this.canvas,K)||setTimeout(function(){var G=__spreadArray([],__read(X),!1);if(J===`drawImage`&&G[0]&&G[0]instanceof HTMLCanvasElement){var K=G[0],Z=K.getContext(`2d`),Q=Z==null?void 0:Z.getImageData(0,0,K.width,K.height),ee=Q==null?void 0:Q.data;G[0]=JSON.stringify(ee)}z(Y.canvas,{type:CanvasContext[`2D`],property:J,args:G})},0),G.apply(this,X)}});Z.push(Y)}catch(K){var X=hookSetter(G.CanvasRenderingContext2D.prototype,J,{set:function(G){z(this.canvas,{type:CanvasContext[`2D`],property:J,args:[G],setter:!0})}});Z.push(X)}};try{for(var te=__values(Q),ne=te.next();!ne.done;ne=te.next()){var ie=ne.value;ee(ie)}}catch(z){Y={error:z}}finally{try{ne&&!ne.done&&(X=te.return)&&X.call(te)}finally{if(Y)throw Y.error}}return function(){Z.forEach(function(z){return z()})}}function initCanvasContextObserver(z,G){var K=[];try{var J=patch(z.HTMLCanvasElement.prototype,`getContext`,function(z){return function(K){var J=[...arguments].slice(1);return isBlocked(this,G)||`__context`in this||(this.__context=K),z.apply(this,__spreadArray([K],__read(J),!1))}});K.push(J)}catch(z){console.error(`failed to patch HTMLCanvasElement.prototype.getContext`)}return function(){K.forEach(function(z){return z()})}}for(var chars=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,lookup=typeof Uint8Array>`u`?[]:new Uint8Array(256),i$1=0;i$1<chars.length;i$1++)lookup[chars.charCodeAt(i$1)]=i$1;var encode=function(z){var G=new Uint8Array(z),K,J=G.length,Y=``;for(K=0;K<J;K+=3)Y+=chars[G[K]>>2],Y+=chars[(G[K]&3)<<4|G[K+1]>>4],Y+=chars[(G[K+1]&15)<<2|G[K+2]>>6],Y+=chars[G[K+2]&63];return J%3==2?Y=Y.substring(0,Y.length-1)+`=`:J%3==1&&(Y=Y.substring(0,Y.length-2)+`==`),Y},webGLVarMap=new Map;function variableListFor(z,G){var K=webGLVarMap.get(z);return K||(K=new Map,webGLVarMap.set(z,K)),K.has(G)||K.set(G,[]),K.get(G)}var saveWebGLVar=function(z,G,K){if(!(!z||!(isInstanceOfWebGLObject(z,G)||typeof z==`object`))){var J=z.constructor.name,Y=variableListFor(K,J),X=Y.indexOf(z);return X===-1&&(X=Y.length,Y.push(z)),X}};function serializeArg(z,G,K){return z instanceof Array?z.map(function(z){return serializeArg(z,G,K)}):z===null?z:z instanceof Float32Array||z instanceof Float64Array||z instanceof Int32Array||z instanceof Uint32Array||z instanceof Uint8Array||z instanceof Uint16Array||z instanceof Int16Array||z instanceof Int8Array||z instanceof Uint8ClampedArray?{rr_type:z.constructor.name,args:[Object.values(z)]}:z instanceof ArrayBuffer?{rr_type:z.constructor.name,base64:encode(z)}:z instanceof DataView?{rr_type:z.constructor.name,args:[serializeArg(z.buffer,G,K),z.byteOffset,z.byteLength]}:z instanceof HTMLImageElement?{rr_type:z.constructor.name,src:z.src}:z instanceof ImageData?{rr_type:z.constructor.name,args:[serializeArg(z.data,G,K),z.width,z.height]}:isInstanceOfWebGLObject(z,G)||typeof z==`object`?{rr_type:z.constructor.name,index:saveWebGLVar(z,G,K)}:z}var serializeArgs=function(z,G,K){return __spreadArray([],__read(z),!1).map(function(z){return serializeArg(z,G,K)})},isInstanceOfWebGLObject=function(z,G){return!![`WebGLActiveInfo`,`WebGLBuffer`,`WebGLFramebuffer`,`WebGLProgram`,`WebGLRenderbuffer`,`WebGLShader`,`WebGLShaderPrecisionFormat`,`WebGLTexture`,`WebGLUniformLocation`,`WebGLVertexArrayObject`,`WebGLVertexArrayObjectOES`].filter(function(z){return typeof G[z]==`function`}).find(function(K){return z instanceof G[K]})};function patchGLPrototype(z,G,K,J,Y,X){var Z,Q,ee=[],te=Object.getOwnPropertyNames(z),ne=function(Z){try{if(typeof z[Z]!=`function`)return`continue`;var Q=patch(z,Z,function(Q){return function(){var ee=[...arguments],te=Q.apply(this,ee);if(saveWebGLVar(te,X,z),!isBlocked(this.canvas,J)){Y.getId(this.canvas);var ne={type:G,property:Z,args:serializeArgs(__spreadArray([],__read(ee),!1),X,z)};K(this.canvas,ne)}return te}});ee.push(Q)}catch(J){var te=hookSetter(z,Z,{set:function(z){K(this.canvas,{type:G,property:Z,args:[z],setter:!0})}});ee.push(te)}};try{for(var ie=__values(te),ae=ie.next();!ae.done;ae=ie.next()){var oe=ae.value;ne(oe)}}catch(z){Z={error:z}}finally{try{ae&&!ae.done&&(Q=ie.return)&&Q.call(ie)}finally{if(Z)throw Z.error}}return ee}function initCanvasWebGLMutationObserver(z,G,K,J){var Y=[];return Y.push.apply(Y,__spreadArray([],__read(patchGLPrototype(G.WebGLRenderingContext.prototype,CanvasContext.WebGL,z,K,J,G)),!1)),G.WebGL2RenderingContext!==void 0&&Y.push.apply(Y,__spreadArray([],__read(patchGLPrototype(G.WebGL2RenderingContext.prototype,CanvasContext.WebGL2,z,K,J,G)),!1)),function(){Y.forEach(function(z){return z()})}}var CanvasManager=function(){function z(z){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=function(z,G){(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(z)||this.pendingCanvasMutations.set(z,[]),this.pendingCanvasMutations.get(z).push(G)},this.mutationCb=z.mutationCb,this.mirror=z.mirror,z.recordCanvas===!0&&this.initCanvasMutationObserver(z.win,z.blockClass)}return z.prototype.reset=function(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()},z.prototype.freeze=function(){this.frozen=!0},z.prototype.unfreeze=function(){this.frozen=!1},z.prototype.lock=function(){this.locked=!0},z.prototype.unlock=function(){this.locked=!1},z.prototype.initCanvasMutationObserver=function(z,G){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var K=initCanvasContextObserver(z,G),J=initCanvas2DMutationObserver(this.processMutation.bind(this),z,G,this.mirror),Y=initCanvasWebGLMutationObserver(this.processMutation.bind(this),z,G,this.mirror);this.resetObservers=function(){K(),J(),Y()}},z.prototype.startPendingCanvasMutationFlusher=function(){var z=this;requestAnimationFrame(function(){return z.flushPendingCanvasMutations()})},z.prototype.startRAFTimestamping=function(){var z=this,G=function(K){z.rafStamps.latestId=K,requestAnimationFrame(G)};requestAnimationFrame(G)},z.prototype.flushPendingCanvasMutations=function(){var z=this;this.pendingCanvasMutations.forEach(function(G,K){var J=z.mirror.getId(K);z.flushPendingCanvasMutationFor(K,J)}),requestAnimationFrame(function(){return z.flushPendingCanvasMutations()})},z.prototype.flushPendingCanvasMutationFor=function(z,G){if(!(this.frozen||this.locked)){var K=this.pendingCanvasMutations.get(z);if(!(!K||G===-1)){var J=K.map(function(z){return z.type,__rest(z,[`type`])}),Y=K[0].type;this.mutationCb({id:G,type:Y,commands:J}),this.pendingCanvasMutations.delete(z)}}},z}();function wrapEvent(z){return __assign(__assign({},z),{timestamp:Date.now()})}var wrappedEmit,takeFullSnapshot,mirror=createMirror();function record(z){z===void 0&&(z={});var G=z.emit,K=z.checkoutEveryNms,J=z.checkoutEveryNth,Y=z.blockClass,X=Y===void 0?`rr-block`:Y,Z=z.blockSelector,Q=Z===void 0?null:Z,ee=z.ignoreClass,te=ee===void 0?`rr-ignore`:ee,ne=z.maskTextClass,ie=ne===void 0?`rr-mask`:ne,ae=z.maskTextSelector,oe=ae===void 0?null:ae,se=z.inlineStylesheet,ce=se===void 0?!0:se,le=z.maskAllInputs,ue=z.maskInputOptions,de=z.slimDOMOptions,fe=z.maskInputFn,pe=z.maskTextFn,me=z.hooks,he=z.packFn,ge=z.sampling,_e=ge===void 0?{}:ge,ve=z.mousemoveWait,ye=z.recordCanvas,be=ye===void 0?!1:ye,xe=z.userTriggeredOnInput,Se=xe===void 0?!1:xe,Ce=z.collectFonts,we=Ce===void 0?!1:Ce,Te=z.inlineImages,Ee=Te===void 0?!1:Te,De=z.plugins,Oe=z.keepIframeSrcFn,ke=Oe===void 0?function(){return!1}:Oe;if(!G)throw Error(`emit function is required`);ve!==void 0&&_e.mousemove===void 0&&(_e.mousemove=ve);var Ae=le===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:ue===void 0?{password:!0}:ue,je=de===!0||de===`all`?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:de===`all`,headMetaDescKeywords:de===`all`}:de||{};polyfill();var Me,Ne=0,Pe=function(z){var G,K;try{for(var J=__values(De||[]),Y=J.next();!Y.done;Y=J.next()){var X=Y.value;X.eventProcessor&&(z=X.eventProcessor(z))}}catch(z){G={error:z}}finally{try{Y&&!Y.done&&(K=J.return)&&K.call(J)}finally{if(G)throw G.error}}return he&&(z=he(z)),z};wrappedEmit=function(z,Y){var X;if((X=mutationBuffers[0])!=null&&X.isFrozen()&&z.type!==EventType.FullSnapshot&&!(z.type===EventType.IncrementalSnapshot&&z.data.source===IncrementalSource.Mutation)&&mutationBuffers.forEach(function(z){return z.unfreeze()}),G(Pe(z),Y),z.type===EventType.FullSnapshot)Me=z,Ne=0;else if(z.type===EventType.IncrementalSnapshot){if(z.data.source===IncrementalSource.Mutation&&z.data.isAttachIframe)return;Ne++;var Z=J&&Ne>=J,Q=K&&z.timestamp-Me.timestamp>K;(Z||Q)&&takeFullSnapshot(!0)}};var Fe=function(z){wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Mutation},z)}))},Ie=function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Scroll},z)}))},Le=function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.CanvasMutation},z)}))},Re=new IframeManager({mutationCb:Fe}),ze=new CanvasManager({recordCanvas:be,mutationCb:Le,win:window,blockClass:X,mirror}),Be=new ShadowDomManager({mutationCb:Fe,scrollCb:Ie,bypassOptions:{blockClass:X,blockSelector:Q,maskTextClass:ie,maskTextSelector:oe,inlineStylesheet:ce,maskInputOptions:Ae,maskTextFn:pe,maskInputFn:fe,recordCanvas:be,inlineImages:Ee,sampling:_e,slimDOMOptions:je,iframeManager:Re,canvasManager:ze},mirror});takeFullSnapshot=function(z){var G,K,J,Y;z===void 0&&(z=!1),wrappedEmit(wrapEvent({type:EventType.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),z),mutationBuffers.forEach(function(z){return z.lock()});var Z=__read(snapshot(document,{blockClass:X,blockSelector:Q,maskTextClass:ie,maskTextSelector:oe,inlineStylesheet:ce,maskAllInputs:Ae,maskTextFn:pe,slimDOM:je,recordCanvas:be,inlineImages:Ee,onSerialize:function(z){isIframeINode(z)&&Re.addIframe(z),hasShadowRoot(z)&&Be.addShadowRoot(z.shadowRoot,document)},onIframeLoad:function(z,G){Re.attachIframe(z,G),Be.observeAttachShadow(z)},keepIframeSrcFn:ke}),2),ee=Z[0],te=Z[1];if(!ee)return console.warn(`Failed to snapshot the document`);mirror.map=te,wrappedEmit(wrapEvent({type:EventType.FullSnapshot,data:{node:ee,initialOffset:{left:window.pageXOffset===void 0?(document==null?void 0:document.documentElement.scrollLeft)||((K=(G=document==null?void 0:document.body)==null?void 0:G.parentElement)==null?void 0:K.scrollLeft)||(document==null?void 0:document.body.scrollLeft)||0:window.pageXOffset,top:window.pageYOffset===void 0?(document==null?void 0:document.documentElement.scrollTop)||((Y=(J=document==null?void 0:document.body)==null?void 0:J.parentElement)==null?void 0:Y.scrollTop)||(document==null?void 0:document.body.scrollTop)||0:window.pageYOffset}}})),mutationBuffers.forEach(function(z){return z.unlock()})};try{var Ve=[];Ve.push(on(`DOMContentLoaded`,function(){wrappedEmit(wrapEvent({type:EventType.DomContentLoaded,data:{}}))}));var He=function(z){var G;return initObservers({mutationCb:Fe,mousemoveCb:function(z,G){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:{source:G,positions:z}}))},mouseInteractionCb:function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.MouseInteraction},z)}))},scrollCb:Ie,viewportResizeCb:function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.ViewportResize},z)}))},inputCb:function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Input},z)}))},mediaInteractionCb:function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.MediaInteraction},z)}))},styleSheetRuleCb:function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.StyleSheetRule},z)}))},styleDeclarationCb:function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.StyleDeclaration},z)}))},canvasMutationCb:Le,fontCb:function(z){return wrappedEmit(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Font},z)}))},blockClass:X,ignoreClass:te,maskTextClass:ie,maskTextSelector:oe,maskInputOptions:Ae,inlineStylesheet:ce,sampling:_e,recordCanvas:be,inlineImages:Ee,userTriggeredOnInput:Se,collectFonts:we,doc:z,maskInputFn:fe,maskTextFn:pe,blockSelector:Q,slimDOMOptions:je,mirror,iframeManager:Re,shadowDomManager:Be,canvasManager:ze,plugins:((G=De==null?void 0:De.filter(function(z){return z.observer}))==null?void 0:G.map(function(z){return{observer:z.observer,options:z.options,callback:function(G){return wrappedEmit(wrapEvent({type:EventType.Plugin,data:{plugin:z.name,payload:G}}))}}}))||[]},me)};Re.addLoadListener(function(z){Ve.push(He(z.contentDocument))});var Ue=function(){takeFullSnapshot(),Ve.push(He(document))};return document.readyState===`interactive`||document.readyState===`complete`?Ue():Ve.push(on(`load`,function(){wrappedEmit(wrapEvent({type:EventType.Load,data:{}})),Ue()},window)),function(){Ve.forEach(function(z){return z()})}}catch(z){console.warn(z)}}record.addCustomEvent=function(z,G){if(!wrappedEmit)throw Error(`please add custom event after start recording`);wrappedEmit(wrapEvent({type:EventType.Custom,data:{tag:z,payload:G}}))},record.freezePage=function(){mutationBuffers.forEach(function(z){return z.freeze()})},record.takeFullSnapshot=function(z){if(!takeFullSnapshot)throw Error(`please take full snapshot after start recording`);takeFullSnapshot(z)},record.mirror=mirror;const SUPPRESS_TRACING_KEY=createContextKey(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function suppressTracing(z){return z.setValue(SUPPRESS_TRACING_KEY,!0)}var u8=Uint8Array,u16=Uint16Array,u32=Uint32Array,fleb=new u8([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fdeb=new u8([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(z,G){for(var K=new u16(31),J=0;J<31;++J)K[J]=G+=1<<z[J-1];for(var Y=new u32(K[30]),J=1;J<30;++J)for(var X=K[J];X<K[J+1];++X)Y[X]=X-K[J]<<5|J;return[K,Y]},_a=freb(fleb,2),fl=_a[0],revfl=_a[1];fl[28]=258,revfl[258]=28;for(var _b=freb(fdeb,0),fd=_b[0],revfd=_b[1],rev=new u16(32768),i=0;i<32768;++i){var x=(i&43690)>>>1|(i&21845)<<1;x=(x&52428)>>>2|(x&13107)<<2,x=(x&61680)>>>4|(x&3855)<<4,rev[i]=((x&65280)>>>8|(x&255)<<8)>>>1}for(var hMap=(function(z,G,K){for(var J=z.length,Y=0,X=new u16(G);Y<J;++Y)z[Y]&&++X[z[Y]-1];var Z=new u16(G);for(Y=0;Y<G;++Y)Z[Y]=Z[Y-1]+X[Y-1]<<1;var Q;if(K){Q=new u16(1<<G);var ee=15-G;for(Y=0;Y<J;++Y)if(z[Y])for(var te=Y<<4|z[Y],ne=G-z[Y],ie=Z[z[Y]-1]++<<ne,ae=ie|(1<<ne)-1;ie<=ae;++ie)Q[rev[ie]>>>ee]=te}else for(Q=new u16(J),Y=0;Y<J;++Y)z[Y]&&(Q[Y]=rev[Z[z[Y]-1]++]>>>15-z[Y]);return Q}),flt=new u8(288),i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;for(var fdt=new u8(32),i=0;i<32;++i)fdt[i]=5;var flm=hMap(flt,9,0),flrm=hMap(flt,9,1),fdm=hMap(fdt,5,0),fdrm=hMap(fdt,5,1),shft=function(z){return(z+7)/8|0},slc=function(z,G,K){(G==null||G<0)&&(G=0),(K==null||K>z.length)&&(K=z.length);var J=new(z.BYTES_PER_ELEMENT==2?u16:z.BYTES_PER_ELEMENT==4?u32:u8)(K-G);return J.set(z.subarray(G,K)),J},wbits=function(z,G,K){K<<=G&7;var J=G/8|0;z[J]|=K,z[J+1]|=K>>>8},wbits16=function(z,G,K){K<<=G&7;var J=G/8|0;z[J]|=K,z[J+1]|=K>>>8,z[J+2]|=K>>>16},hTree=function(z,G){for(var K=[],J=0;J<z.length;++J)z[J]&&K.push({s:J,f:z[J]});var Y=K.length,X=K.slice();if(!Y)return[et,0];if(Y==1){var Z=new u8(K[0].s+1);return Z[K[0].s]=1,[Z,1]}K.sort(function(z,G){return z.f-G.f}),K.push({s:-1,f:25001});var Q=K[0],ee=K[1],te=0,ne=1,ie=2;for(K[0]={s:-1,f:Q.f+ee.f,l:Q,r:ee};ne!=Y-1;)Q=K[K[te].f<K[ie].f?te++:ie++],ee=K[te!=ne&&K[te].f<K[ie].f?te++:ie++],K[ne++]={s:-1,f:Q.f+ee.f,l:Q,r:ee};for(var ae=X[0].s,J=1;J<Y;++J)X[J].s>ae&&(ae=X[J].s);var oe=new u16(ae+1),se=ln(K[ne-1],oe,0);if(se>G){var J=0,ce=0,le=se-G,ue=1<<le;for(X.sort(function(z,G){return oe[G.s]-oe[z.s]||z.f-G.f});J<Y;++J){var de=X[J].s;if(oe[de]>G)ce+=ue-(1<<se-oe[de]),oe[de]=G;else break}for(ce>>>=le;ce>0;){var fe=X[J].s;oe[fe]<G?ce-=1<<G-oe[fe]++-1:++J}for(;J>=0&&ce;--J){var pe=X[J].s;oe[pe]==G&&(--oe[pe],++ce)}se=G}return[new u8(oe),se]},ln=function(z,G,K){return z.s==-1?Math.max(ln(z.l,G,K+1),ln(z.r,G,K+1)):G[z.s]=K},lc=function(z){for(var G=z.length;G&&!z[--G];);for(var K=new u16(++G),J=0,Y=z[0],X=1,Z=function(z){K[J++]=z},Q=1;Q<=G;++Q)if(z[Q]==Y&&Q!=G)++X;else{if(!Y&&X>2){for(;X>138;X-=138)Z(32754);X>2&&(Z(X>10?X-11<<5|28690:X-3<<5|12305),X=0)}else if(X>3){for(Z(Y),--X;X>6;X-=6)Z(8304);X>2&&(Z(X-3<<5|8208),X=0)}for(;X--;)Z(Y);X=1,Y=z[Q]}return[K.subarray(0,J),G]},clen=function(z,G){for(var K=0,J=0;J<G.length;++J)K+=z[J]*G[J];return K},wfblk=function(z,G,K){var J=K.length,Y=shft(G+2);z[Y]=J&255,z[Y+1]=J>>>8,z[Y+2]=z[Y]^255,z[Y+3]=z[Y+1]^255;for(var X=0;X<J;++X)z[Y+X+4]=K[X];return(Y+4+J)*8},wblk=function(z,G,K,J,Y,X,Z,Q,ee,te,ne){wbits(G,ne++,K),++Y[256];for(var ie=hTree(Y,15),ae=ie[0],oe=ie[1],se=hTree(X,15),ce=se[0],le=se[1],ue=lc(ae),de=ue[0],fe=ue[1],pe=lc(ce),me=pe[0],he=pe[1],ge=new u16(19),_e=0;_e<de.length;++_e)ge[de[_e]&31]++;for(var _e=0;_e<me.length;++_e)ge[me[_e]&31]++;for(var ve=hTree(ge,7),ye=ve[0],be=ve[1],xe=19;xe>4&&!ye[clim[xe-1]];--xe);var Se=te+5<<3,Ce=clen(Y,flt)+clen(X,fdt)+Z,we=clen(Y,ae)+clen(X,ce)+Z+14+3*xe+clen(ge,ye)+(2*ge[16]+3*ge[17]+7*ge[18]);if(Se<=Ce&&Se<=we)return wfblk(G,ne,z.subarray(ee,ee+te));var Te,Ee,De,Oe;if(wbits(G,ne,1+(we<Ce)),ne+=2,we<Ce){Te=hMap(ae,oe,0),Ee=ae,De=hMap(ce,le,0),Oe=ce;var ke=hMap(ye,be,0);wbits(G,ne,fe-257),wbits(G,ne+5,he-1),wbits(G,ne+10,xe-4),ne+=14;for(var _e=0;_e<xe;++_e)wbits(G,ne+3*_e,ye[clim[_e]]);ne+=3*xe;for(var Ae=[de,me],je=0;je<2;++je)for(var Me=Ae[je],_e=0;_e<Me.length;++_e){var Ne=Me[_e]&31;wbits(G,ne,ke[Ne]),ne+=ye[Ne],Ne>15&&(wbits(G,ne,Me[_e]>>>5&127),ne+=Me[_e]>>>12)}}else Te=flm,Ee=flt,De=fdm,Oe=fdt;for(var _e=0;_e<Q;++_e)if(J[_e]>255){var Ne=J[_e]>>>18&31;wbits16(G,ne,Te[Ne+257]),ne+=Ee[Ne+257],Ne>7&&(wbits(G,ne,J[_e]>>>23&31),ne+=fleb[Ne]);var Pe=J[_e]&31;wbits16(G,ne,De[Pe]),ne+=Oe[Pe],Pe>3&&(wbits16(G,ne,J[_e]>>>5&8191),ne+=fdeb[Pe])}else wbits16(G,ne,Te[J[_e]]),ne+=Ee[J[_e]];return wbits16(G,ne,Te[256]),ne+Ee[256]},deo=new u32([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),et=new u8(0),dflt=function(z,G,K,J,Y,X){var Z=z.length,Q=new u8(J+Z+5*(1+Math.ceil(Z/7e3))+Y),ee=Q.subarray(J,Q.length-Y),te=0;if(!G||Z<8)for(var ne=0;ne<=Z;ne+=65535){var ie=ne+65535;ie>=Z&&(ee[te>>3]=X),te=wfblk(ee,te+1,z.subarray(ne,ie))}else{for(var ae=deo[G-1],oe=ae>>>13,se=ae&8191,ce=(1<<K)-1,le=new u16(32768),ue=new u16(ce+1),de=Math.ceil(K/3),fe=2*de,pe=function(G){return(z[G]^z[G+1]<<de^z[G+2]<<fe)&ce},me=new u32(25e3),he=new u16(288),ge=new u16(32),_e=0,ve=0,ne=0,ye=0,be=0,xe=0;ne<Z;++ne){var Se=pe(ne),Ce=ne&32767,we=ue[Se];if(le[Ce]=we,ue[Se]=Ce,be<=ne){var Te=Z-ne;if((_e>7e3||ye>24576)&&Te>423){te=wblk(z,ee,0,me,he,ge,ve,ye,xe,ne-xe,te),ye=_e=ve=0,xe=ne;for(var Ee=0;Ee<286;++Ee)he[Ee]=0;for(var Ee=0;Ee<30;++Ee)ge[Ee]=0}var De=2,Oe=0,ke=se,Ae=Ce-we&32767;if(Te>2&&Se==pe(ne-Ae))for(var je=Math.min(oe,Te)-1,Me=Math.min(32767,ne),Ne=Math.min(258,Te);Ae<=Me&&--ke&&Ce!=we;){if(z[ne+De]==z[ne+De-Ae]){for(var Pe=0;Pe<Ne&&z[ne+Pe]==z[ne+Pe-Ae];++Pe);if(Pe>De){if(De=Pe,Oe=Ae,Pe>je)break;for(var Fe=Math.min(Ae,Pe-2),Ie=0,Ee=0;Ee<Fe;++Ee){var Le=ne-Ae+Ee+32768&32767,Re=Le-le[Le]+32768&32767;Re>Ie&&(Ie=Re,we=Le)}}}Ce=we,we=le[Ce],Ae+=Ce-we+32768&32767}if(Oe){me[ye++]=268435456|revfl[De]<<18|revfd[Oe];var ze=revfl[De]&31,Be=revfd[Oe]&31;ve+=fleb[ze]+fdeb[Be],++he[257+ze],++ge[Be],be=ne+De,++_e}else me[ye++]=z[ne],++he[z[ne]]}}te=wblk(z,ee,X,me,he,ge,ve,ye,xe,ne-xe,te),!X&&te&7&&(te=wfblk(ee,te+1,et))}return slc(Q,0,J+shft(te)+Y)},crct=(function(){for(var z=new Int32Array(256),G=0;G<256;++G){for(var K=G,J=9;--J;)K=(K&1&&-306674912)^K>>>1;z[G]=K}return z})(),crc=function(){var z=-1;return{p:function(G){for(var K=z,J=0;J<G.length;++J)K=crct[K&255^G[J]]^K>>>8;z=K},d:function(){return~z}}},dopt=function(z,G,K,J,Y){return dflt(z,G.level==null?6:G.level,G.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(z.length)))*1.5):12+G.mem,K,J,!Y)},wbytes=function(z,G,K){for(;K;++G)z[G]=K,K>>>=8},gzh=function(z,G){var K=G.filename;if(z[0]=31,z[1]=139,z[2]=8,z[8]=G.level<2?4:G.level==9?2:0,z[9]=3,G.mtime!=0&&wbytes(z,4,Math.floor(new Date(G.mtime||Date.now())/1e3)),K){z[3]=8;for(var J=0;J<=K.length;++J)z[J+10]=K.charCodeAt(J)}},gzhl=function(z){return 10+(z.filename&&z.filename.length+1||0)};function gzipSync(z,G){G||(G={});var K=crc(),J=z.length;K.p(z);var Y=dopt(z,G,gzhl(G),8),X=Y.length;return gzh(Y,G),wbytes(Y,X-8,K.d()),wbytes(Y,X-4,J),Y}var td=typeof TextDecoder<`u`&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0})}catch(z){}
19
+ /**
20
+ * @license
21
+ * Copyright 2009 The Closure Library Authors
22
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
23
+ *
24
+ * Licensed under the Apache License, Version 2.0 (the "License");
25
+ * you may not use this file except in compliance with the License.
26
+ * You may obtain a copy of the License at
27
+ *
28
+ * http://www.apache.org/licenses/LICENSE-2.0
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software
31
+ * distributed under the License is distributed on an "AS IS" BASIS,
32
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33
+ * See the License for the specific language governing permissions and
34
+ * limitations under the License.
35
+ *
36
+ * SPDX-License-Identifier: Apache-2.0
37
+ */
38
+ var wasm=null;try{wasm=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(z){}function Long(z,G,K){this.low=z|0,this.high=G|0,this.unsigned=!!K}Long.prototype.__isLong__,Object.defineProperty(Long.prototype,`__isLong__`,{value:!0});function isLong(z){return(z&&z.__isLong__)===!0}function ctz32(z){var G=Math.clz32(z&-z);return z?31-G:G}Long.isLong=isLong;var INT_CACHE={},UINT_CACHE={};function fromInt(z,G){var K,J,Y;return G?(z>>>=0,(Y=0<=z&&z<256)&&(J=UINT_CACHE[z],J)?J:(K=fromBits(z,0,!0),Y&&(UINT_CACHE[z]=K),K)):(z|=0,(Y=-128<=z&&z<128)&&(J=INT_CACHE[z],J)?J:(K=fromBits(z,z<0?-1:0,!1),Y&&(INT_CACHE[z]=K),K))}Long.fromInt=fromInt;function fromNumber(z,G){if(isNaN(z))return G?UZERO:ZERO;if(G){if(z<0)return UZERO;if(z>=TWO_PWR_64_DBL)return MAX_UNSIGNED_VALUE}else{if(z<=-TWO_PWR_63_DBL)return MIN_VALUE;if(z+1>=TWO_PWR_63_DBL)return MAX_VALUE}return z<0?fromNumber(-z,G).neg():fromBits(z%TWO_PWR_32_DBL|0,z/TWO_PWR_32_DBL|0,G)}Long.fromNumber=fromNumber;function fromBits(z,G,K){return new Long(z,G,K)}Long.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(z,G,K){if(z.length===0)throw Error(`empty string`);if(typeof G==`number`?(K=G,G=!1):G=!!G,z===`NaN`||z===`Infinity`||z===`+Infinity`||z===`-Infinity`)return G?UZERO:ZERO;if(K=K||10,K<2||36<K)throw RangeError(`radix`);var J;if((J=z.indexOf(`-`))>0)throw Error(`interior hyphen`);if(J===0)return fromString(z.substring(1),G,K).neg();for(var Y=fromNumber(pow_dbl(K,8)),X=ZERO,Z=0;Z<z.length;Z+=8){var Q=Math.min(8,z.length-Z),ee=parseInt(z.substring(Z,Z+Q),K);if(Q<8){var te=fromNumber(pow_dbl(K,Q));X=X.mul(te).add(fromNumber(ee))}else X=X.mul(Y),X=X.add(fromNumber(ee))}return X.unsigned=G,X}Long.fromString=fromString;function fromValue(z,G){return typeof z==`number`?fromNumber(z,G):typeof z==`string`?fromString(z,G):fromBits(z.low,z.high,typeof G==`boolean`?G:z.unsigned)}Long.fromValue=fromValue;var TWO_PWR_16_DBL=65536,TWO_PWR_24_DBL=1<<24,TWO_PWR_32_DBL=TWO_PWR_16_DBL*TWO_PWR_16_DBL,TWO_PWR_64_DBL=TWO_PWR_32_DBL*TWO_PWR_32_DBL,TWO_PWR_63_DBL=TWO_PWR_64_DBL/2,TWO_PWR_24=fromInt(TWO_PWR_24_DBL),ZERO=fromInt(0);Long.ZERO=ZERO;var UZERO=fromInt(0,!0);Long.UZERO=UZERO;var ONE=fromInt(1);Long.ONE=ONE;var UONE=fromInt(1,!0);Long.UONE=UONE;var NEG_ONE=fromInt(-1);Long.NEG_ONE=NEG_ONE;var MAX_VALUE=fromBits(-1,2147483647,!1);Long.MAX_VALUE=MAX_VALUE;var MAX_UNSIGNED_VALUE=fromBits(-1,-1,!0);Long.MAX_UNSIGNED_VALUE=MAX_UNSIGNED_VALUE;var MIN_VALUE=fromBits(0,-2147483648,!1);Long.MIN_VALUE=MIN_VALUE;var LongPrototype=Long.prototype;LongPrototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},LongPrototype.toNumber=function(){return this.unsigned?(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0):this.high*TWO_PWR_32_DBL+(this.low>>>0)},LongPrototype.toString=function(z){if(z=z||10,z<2||36<z)throw RangeError(`radix`);if(this.isZero())return`0`;if(this.isNegative())if(this.eq(MIN_VALUE)){var G=fromNumber(z),K=this.div(G),J=K.mul(G).sub(this);return K.toString(z)+J.toInt().toString(z)}else return`-`+this.neg().toString(z);for(var Y=fromNumber(pow_dbl(z,6),this.unsigned),X=this,Z=``;;){var Q=X.div(Y),ee=(X.sub(Q.mul(Y)).toInt()>>>0).toString(z);if(X=Q,X.isZero())return ee+Z;for(;ee.length<6;)ee=`0`+ee;Z=``+ee+Z}},LongPrototype.getHighBits=function(){return this.high},LongPrototype.getHighBitsUnsigned=function(){return this.high>>>0},LongPrototype.getLowBits=function(){return this.low},LongPrototype.getLowBitsUnsigned=function(){return this.low>>>0},LongPrototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();for(var z=this.high==0?this.low:this.high,G=31;G>0&&!(z&1<<G);G--);return this.high==0?G+1:G+33},LongPrototype.isSafeInteger=function(){var z=this.high>>21;return z?this.unsigned?!1:z===-1&&!(this.low===0&&this.high===-2097152):!0},LongPrototype.isZero=function(){return this.high===0&&this.low===0},LongPrototype.eqz=LongPrototype.isZero,LongPrototype.isNegative=function(){return!this.unsigned&&this.high<0},LongPrototype.isPositive=function(){return this.unsigned||this.high>=0},LongPrototype.isOdd=function(){return(this.low&1)==1},LongPrototype.isEven=function(){return(this.low&1)==0},LongPrototype.equals=function(z){return isLong(z)||(z=fromValue(z)),this.unsigned!==z.unsigned&&this.high>>>31==1&&z.high>>>31==1?!1:this.high===z.high&&this.low===z.low},LongPrototype.eq=LongPrototype.equals,LongPrototype.notEquals=function(z){return!this.eq(z)},LongPrototype.neq=LongPrototype.notEquals,LongPrototype.ne=LongPrototype.notEquals,LongPrototype.lessThan=function(z){return this.comp(z)<0},LongPrototype.lt=LongPrototype.lessThan,LongPrototype.lessThanOrEqual=function(z){return this.comp(z)<=0},LongPrototype.lte=LongPrototype.lessThanOrEqual,LongPrototype.le=LongPrototype.lessThanOrEqual,LongPrototype.greaterThan=function(z){return this.comp(z)>0},LongPrototype.gt=LongPrototype.greaterThan,LongPrototype.greaterThanOrEqual=function(z){return this.comp(z)>=0},LongPrototype.gte=LongPrototype.greaterThanOrEqual,LongPrototype.ge=LongPrototype.greaterThanOrEqual,LongPrototype.compare=function(z){if(isLong(z)||(z=fromValue(z)),this.eq(z))return 0;var G=this.isNegative(),K=z.isNegative();return G&&!K?-1:!G&&K?1:this.unsigned?z.high>>>0>this.high>>>0||z.high===this.high&&z.low>>>0>this.low>>>0?-1:1:this.sub(z).isNegative()?-1:1},LongPrototype.comp=LongPrototype.compare,LongPrototype.negate=function(){return!this.unsigned&&this.eq(MIN_VALUE)?MIN_VALUE:this.not().add(ONE)},LongPrototype.neg=LongPrototype.negate,LongPrototype.add=function(z){isLong(z)||(z=fromValue(z));var G=this.high>>>16,K=this.high&65535,J=this.low>>>16,Y=this.low&65535,X=z.high>>>16,Z=z.high&65535,Q=z.low>>>16,ee=z.low&65535,te=0,ne=0,ie=0,ae=0;return ae+=Y+ee,ie+=ae>>>16,ae&=65535,ie+=J+Q,ne+=ie>>>16,ie&=65535,ne+=K+Z,te+=ne>>>16,ne&=65535,te+=G+X,te&=65535,fromBits(ie<<16|ae,te<<16|ne,this.unsigned)},LongPrototype.subtract=function(z){return isLong(z)||(z=fromValue(z)),this.add(z.neg())},LongPrototype.sub=LongPrototype.subtract,LongPrototype.multiply=function(z){if(this.isZero())return this;if(isLong(z)||(z=fromValue(z)),wasm)return fromBits(wasm.mul(this.low,this.high,z.low,z.high),wasm.get_high(),this.unsigned);if(z.isZero())return this.unsigned?UZERO:ZERO;if(this.eq(MIN_VALUE))return z.isOdd()?MIN_VALUE:ZERO;if(z.eq(MIN_VALUE))return this.isOdd()?MIN_VALUE:ZERO;if(this.isNegative())return z.isNegative()?this.neg().mul(z.neg()):this.neg().mul(z).neg();if(z.isNegative())return this.mul(z.neg()).neg();if(this.lt(TWO_PWR_24)&&z.lt(TWO_PWR_24))return fromNumber(this.toNumber()*z.toNumber(),this.unsigned);var G=this.high>>>16,K=this.high&65535,J=this.low>>>16,Y=this.low&65535,X=z.high>>>16,Z=z.high&65535,Q=z.low>>>16,ee=z.low&65535,te=0,ne=0,ie=0,ae=0;return ae+=Y*ee,ie+=ae>>>16,ae&=65535,ie+=J*ee,ne+=ie>>>16,ie&=65535,ie+=Y*Q,ne+=ie>>>16,ie&=65535,ne+=K*ee,te+=ne>>>16,ne&=65535,ne+=J*Q,te+=ne>>>16,ne&=65535,ne+=Y*Z,te+=ne>>>16,ne&=65535,te+=G*ee+K*Q+J*Z+Y*X,te&=65535,fromBits(ie<<16|ae,te<<16|ne,this.unsigned)},LongPrototype.mul=LongPrototype.multiply,LongPrototype.divide=function(z){if(isLong(z)||(z=fromValue(z)),z.isZero())throw Error(`division by zero`);if(wasm)return!this.unsigned&&this.high===-2147483648&&z.low===-1&&z.high===-1?this:fromBits((this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,z.low,z.high),wasm.get_high(),this.unsigned);if(this.isZero())return this.unsigned?UZERO:ZERO;var G,K,J;if(this.unsigned){if(z.unsigned||(z=z.toUnsigned()),z.gt(this))return UZERO;if(z.gt(this.shru(1)))return UONE;J=UZERO}else{if(this.eq(MIN_VALUE))return z.eq(ONE)||z.eq(NEG_ONE)?MIN_VALUE:z.eq(MIN_VALUE)?ONE:(G=this.shr(1).div(z).shl(1),G.eq(ZERO)?z.isNegative()?ONE:NEG_ONE:(K=this.sub(z.mul(G)),J=G.add(K.div(z)),J));if(z.eq(MIN_VALUE))return this.unsigned?UZERO:ZERO;if(this.isNegative())return z.isNegative()?this.neg().div(z.neg()):this.neg().div(z).neg();if(z.isNegative())return this.div(z.neg()).neg();J=ZERO}for(K=this;K.gte(z);){G=Math.max(1,Math.floor(K.toNumber()/z.toNumber()));for(var Y=Math.ceil(Math.log(G)/Math.LN2),X=Y<=48?1:pow_dbl(2,Y-48),Z=fromNumber(G),Q=Z.mul(z);Q.isNegative()||Q.gt(K);)G-=X,Z=fromNumber(G,this.unsigned),Q=Z.mul(z);Z.isZero()&&(Z=ONE),J=J.add(Z),K=K.sub(Q)}return J},LongPrototype.div=LongPrototype.divide,LongPrototype.modulo=function(z){return isLong(z)||(z=fromValue(z)),wasm?fromBits((this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,z.low,z.high),wasm.get_high(),this.unsigned):this.sub(this.div(z).mul(z))},LongPrototype.mod=LongPrototype.modulo,LongPrototype.rem=LongPrototype.modulo,LongPrototype.not=function(){return fromBits(~this.low,~this.high,this.unsigned)},LongPrototype.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},LongPrototype.clz=LongPrototype.countLeadingZeros,LongPrototype.countTrailingZeros=function(){return this.low?ctz32(this.low):ctz32(this.high)+32},LongPrototype.ctz=LongPrototype.countTrailingZeros,LongPrototype.and=function(z){return isLong(z)||(z=fromValue(z)),fromBits(this.low&z.low,this.high&z.high,this.unsigned)},LongPrototype.or=function(z){return isLong(z)||(z=fromValue(z)),fromBits(this.low|z.low,this.high|z.high,this.unsigned)},LongPrototype.xor=function(z){return isLong(z)||(z=fromValue(z)),fromBits(this.low^z.low,this.high^z.high,this.unsigned)},LongPrototype.shiftLeft=function(z){return isLong(z)&&(z=z.toInt()),(z&=63)==0?this:z<32?fromBits(this.low<<z,this.high<<z|this.low>>>32-z,this.unsigned):fromBits(0,this.low<<z-32,this.unsigned)},LongPrototype.shl=LongPrototype.shiftLeft,LongPrototype.shiftRight=function(z){return isLong(z)&&(z=z.toInt()),(z&=63)==0?this:z<32?fromBits(this.low>>>z|this.high<<32-z,this.high>>z,this.unsigned):fromBits(this.high>>z-32,this.high>=0?0:-1,this.unsigned)},LongPrototype.shr=LongPrototype.shiftRight,LongPrototype.shiftRightUnsigned=function(z){return isLong(z)&&(z=z.toInt()),(z&=63)==0?this:z<32?fromBits(this.low>>>z|this.high<<32-z,this.high>>>z,this.unsigned):fromBits(z===32?this.high:this.high>>>z-32,0,this.unsigned)},LongPrototype.shru=LongPrototype.shiftRightUnsigned,LongPrototype.shr_u=LongPrototype.shiftRightUnsigned,LongPrototype.rotateLeft=function(z){var G;return isLong(z)&&(z=z.toInt()),(z&=63)==0?this:z===32?fromBits(this.high,this.low,this.unsigned):z<32?(G=32-z,fromBits(this.low<<z|this.high>>>G,this.high<<z|this.low>>>G,this.unsigned)):(z-=32,G=32-z,fromBits(this.high<<z|this.low>>>G,this.low<<z|this.high>>>G,this.unsigned))},LongPrototype.rotl=LongPrototype.rotateLeft,LongPrototype.rotateRight=function(z){var G;return isLong(z)&&(z=z.toInt()),(z&=63)==0?this:z===32?fromBits(this.high,this.low,this.unsigned):z<32?(G=32-z,fromBits(this.high<<G|this.low>>>z,this.low<<G|this.high>>>z,this.unsigned)):(z-=32,G=32-z,fromBits(this.low<<G|this.high>>>z,this.high<<G|this.low>>>z,this.unsigned))},LongPrototype.rotr=LongPrototype.rotateRight,LongPrototype.toSigned=function(){return this.unsigned?fromBits(this.low,this.high,!1):this},LongPrototype.toUnsigned=function(){return this.unsigned?this:fromBits(this.low,this.high,!0)},LongPrototype.toBytes=function(z){return z?this.toBytesLE():this.toBytesBE()},LongPrototype.toBytesLE=function(){var z=this.high,G=this.low;return[G&255,G>>>8&255,G>>>16&255,G>>>24,z&255,z>>>8&255,z>>>16&255,z>>>24]},LongPrototype.toBytesBE=function(){var z=this.high,G=this.low;return[z>>>24,z>>>16&255,z>>>8&255,z&255,G>>>24,G>>>16&255,G>>>8&255,G&255]},Long.fromBytes=function(z,G,K){return K?Long.fromBytesLE(z,G):Long.fromBytesBE(z,G)},Long.fromBytesLE=function(z,G){return new Long(z[0]|z[1]<<8|z[2]<<16|z[3]<<24,z[4]|z[5]<<8|z[6]<<16|z[7]<<24,G)},Long.fromBytesBE=function(z,G){return new Long(z[4]<<24|z[5]<<16|z[6]<<8|z[7],z[0]<<24|z[1]<<16|z[2]<<8|z[3],G)},typeof BigInt==`function`&&(Long.fromBigInt=function(z,G){return fromBits(Number(BigInt.asIntN(32,z)),Number(BigInt.asIntN(32,z>>BigInt(32))),G)},Long.fromValue=function(z,G){return typeof z==`bigint`?Long.fromBigInt(z,G):fromValue(z,G)},LongPrototype.toBigInt=function(){var z=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|z});var require_aspromise=__commonJSMin(((z,G)=>{G.exports=K;function K(z,G){for(var K=Array(arguments.length-1),J=0,Y=2,X=!0;Y<arguments.length;)K[J++]=arguments[Y++];return new Promise(function(Y,Z){K[J]=function(z){if(X)if(X=!1,z)Z(z);else{for(var G=Array(arguments.length-1),K=0;K<G.length;)G[K++]=arguments[K];Y.apply(null,G)}};try{z.apply(G||null,K)}catch(z){X&&(X=!1,Z(z))}})}})),require_base64=__commonJSMin((z=>{var G=z;G.length=function(z){var G=z.length;if(!G)return 0;for(var K=0;--G%4>1&&z.charAt(G)===`=`;)++K;return Math.ceil(z.length*3)/4-K};for(var K=Array(64),J=Array(123),Y=0;Y<64;)J[K[Y]=Y<26?Y+65:Y<52?Y+71:Y<62?Y-4:Y-59|43]=Y++;G.encode=function(z,G,J){for(var Y=null,X=[],Z=0,Q=0,ee;G<J;){var te=z[G++];switch(Q){case 0:X[Z++]=K[te>>2],ee=(te&3)<<4,Q=1;break;case 1:X[Z++]=K[ee|te>>4],ee=(te&15)<<2,Q=2;break;case 2:X[Z++]=K[ee|te>>6],X[Z++]=K[te&63],Q=0;break}Z>8191&&((Y||(Y=[])).push(String.fromCharCode.apply(String,X)),Z=0)}return Q&&(X[Z++]=K[ee],X[Z++]=61,Q===1&&(X[Z++]=61)),Y?(Z&&Y.push(String.fromCharCode.apply(String,X.slice(0,Z))),Y.join(``)):String.fromCharCode.apply(String,X.slice(0,Z))};var X=`invalid encoding`;G.decode=function(z,G,K){for(var Y=K,Z=0,Q,ee=0;ee<z.length;){var te=z.charCodeAt(ee++);if(te===61&&Z>1)break;if((te=J[te])===void 0)throw Error(X);switch(Z){case 0:Q=te,Z=1;break;case 1:G[K++]=Q<<2|(te&48)>>4,Q=te,Z=2;break;case 2:G[K++]=(Q&15)<<4|(te&60)>>2,Q=te,Z=3;break;case 3:G[K++]=(Q&3)<<6|te,Z=0;break}}if(Z===1)throw Error(X);return K-Y},G.test=function(z){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(z)}})),require_eventemitter=__commonJSMin(((z,G)=>{G.exports=K;function K(){this._listeners={}}K.prototype.on=function(z,G,K){return(this._listeners[z]||(this._listeners[z]=[])).push({fn:G,ctx:K||this}),this},K.prototype.off=function(z,G){if(z===void 0)this._listeners={};else if(G===void 0)this._listeners[z]=[];else for(var K=this._listeners[z],J=0;J<K.length;)K[J].fn===G?K.splice(J,1):++J;return this},K.prototype.emit=function(z){var G=this._listeners[z];if(G){for(var K=[],J=1;J<arguments.length;)K.push(arguments[J++]);for(J=0;J<G.length;)G[J].fn.apply(G[J++].ctx,K)}return this}})),require_float=__commonJSMin(((z,G)=>{G.exports=K(K);function K(z){return typeof Float32Array<`u`?(function(){var G=new Float32Array([-0]),K=new Uint8Array(G.buffer),J=K[3]===128;function Y(z,J,Y){G[0]=z,J[Y]=K[0],J[Y+1]=K[1],J[Y+2]=K[2],J[Y+3]=K[3]}function X(z,J,Y){G[0]=z,J[Y]=K[3],J[Y+1]=K[2],J[Y+2]=K[1],J[Y+3]=K[0]}z.writeFloatLE=J?Y:X,z.writeFloatBE=J?X:Y;function Z(z,J){return K[0]=z[J],K[1]=z[J+1],K[2]=z[J+2],K[3]=z[J+3],G[0]}function Q(z,J){return K[3]=z[J],K[2]=z[J+1],K[1]=z[J+2],K[0]=z[J+3],G[0]}z.readFloatLE=J?Z:Q,z.readFloatBE=J?Q:Z})():(function(){function G(z,G,K,J){var Y=G<0?1:0;if(Y&&(G=-G),G===0)z(1/G>0?0:2147483648,K,J);else if(isNaN(G))z(2143289344,K,J);else if(G>34028234663852886e22)z((Y<<31|2139095040)>>>0,K,J);else if(G<11754943508222875e-54)z((Y<<31|Math.round(G/1401298464324817e-60))>>>0,K,J);else{var X=Math.floor(Math.log(G)/Math.LN2),Z=Math.round(G*Math.pow(2,-X)*8388608)&8388607;z((Y<<31|X+127<<23|Z)>>>0,K,J)}}z.writeFloatLE=G.bind(null,J),z.writeFloatBE=G.bind(null,Y);function K(z,G,K){var J=z(G,K),Y=(J>>31)*2+1,X=J>>>23&255,Z=J&8388607;return X===255?Z?NaN:Y*(1/0):X===0?Y*1401298464324817e-60*Z:Y*Math.pow(2,X-150)*(Z+8388608)}z.readFloatLE=K.bind(null,X),z.readFloatBE=K.bind(null,Z)})(),typeof Float64Array<`u`?(function(){var G=new Float64Array([-0]),K=new Uint8Array(G.buffer),J=K[7]===128;function Y(z,J,Y){G[0]=z,J[Y]=K[0],J[Y+1]=K[1],J[Y+2]=K[2],J[Y+3]=K[3],J[Y+4]=K[4],J[Y+5]=K[5],J[Y+6]=K[6],J[Y+7]=K[7]}function X(z,J,Y){G[0]=z,J[Y]=K[7],J[Y+1]=K[6],J[Y+2]=K[5],J[Y+3]=K[4],J[Y+4]=K[3],J[Y+5]=K[2],J[Y+6]=K[1],J[Y+7]=K[0]}z.writeDoubleLE=J?Y:X,z.writeDoubleBE=J?X:Y;function Z(z,J){return K[0]=z[J],K[1]=z[J+1],K[2]=z[J+2],K[3]=z[J+3],K[4]=z[J+4],K[5]=z[J+5],K[6]=z[J+6],K[7]=z[J+7],G[0]}function Q(z,J){return K[7]=z[J],K[6]=z[J+1],K[5]=z[J+2],K[4]=z[J+3],K[3]=z[J+4],K[2]=z[J+5],K[1]=z[J+6],K[0]=z[J+7],G[0]}z.readDoubleLE=J?Z:Q,z.readDoubleBE=J?Q:Z})():(function(){function G(z,G,K,J,Y,X){var Z=J<0?1:0;if(Z&&(J=-J),J===0)z(0,Y,X+G),z(1/J>0?0:2147483648,Y,X+K);else if(isNaN(J))z(0,Y,X+G),z(2146959360,Y,X+K);else if(J>17976931348623157e292)z(0,Y,X+G),z((Z<<31|2146435072)>>>0,Y,X+K);else{var Q;if(J<22250738585072014e-324)Q=J/5e-324,z(Q>>>0,Y,X+G),z((Z<<31|Q/4294967296)>>>0,Y,X+K);else{var ee=Math.floor(Math.log(J)/Math.LN2);ee===1024&&(ee=1023),Q=J*Math.pow(2,-ee),z(Q*4503599627370496>>>0,Y,X+G),z((Z<<31|ee+1023<<20|Q*1048576&1048575)>>>0,Y,X+K)}}}z.writeDoubleLE=G.bind(null,J,0,4),z.writeDoubleBE=G.bind(null,Y,4,0);function K(z,G,K,J,Y){var X=z(J,Y+G),Z=z(J,Y+K),Q=(Z>>31)*2+1,ee=Z>>>20&2047,te=4294967296*(Z&1048575)+X;return ee===2047?te?NaN:Q*(1/0):ee===0?Q*5e-324*te:Q*Math.pow(2,ee-1075)*(te+4503599627370496)}z.readDoubleLE=K.bind(null,X,0,4),z.readDoubleBE=K.bind(null,Z,4,0)})(),z}function J(z,G,K){G[K]=z&255,G[K+1]=z>>>8&255,G[K+2]=z>>>16&255,G[K+3]=z>>>24}function Y(z,G,K){G[K]=z>>>24,G[K+1]=z>>>16&255,G[K+2]=z>>>8&255,G[K+3]=z&255}function X(z,G){return(z[G]|z[G+1]<<8|z[G+2]<<16|z[G+3]<<24)>>>0}function Z(z,G){return(z[G]<<24|z[G+1]<<16|z[G+2]<<8|z[G+3])>>>0}})),require_inquire=__commonJSMin(((exports,module)=>{module.exports=inquire;function inquire(moduleName){try{var mod=eval(`quire`.replace(/^/,`re`))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(z){}return null}})),require_utf8=__commonJSMin((z=>{var G=z;G.length=function(z){for(var G=0,K=0,J=0;J<z.length;++J)K=z.charCodeAt(J),K<128?G+=1:K<2048?G+=2:(K&64512)==55296&&(z.charCodeAt(J+1)&64512)==56320?(++J,G+=4):G+=3;return G},G.read=function(z,G,K){if(K-G<1)return``;for(var J=null,Y=[],X=0,Z;G<K;)Z=z[G++],Z<128?Y[X++]=Z:Z>191&&Z<224?Y[X++]=(Z&31)<<6|z[G++]&63:Z>239&&Z<365?(Z=((Z&7)<<18|(z[G++]&63)<<12|(z[G++]&63)<<6|z[G++]&63)-65536,Y[X++]=55296+(Z>>10),Y[X++]=56320+(Z&1023)):Y[X++]=(Z&15)<<12|(z[G++]&63)<<6|z[G++]&63,X>8191&&((J||(J=[])).push(String.fromCharCode.apply(String,Y)),X=0);return J?(X&&J.push(String.fromCharCode.apply(String,Y.slice(0,X))),J.join(``)):String.fromCharCode.apply(String,Y.slice(0,X))},G.write=function(z,G,K){for(var J=K,Y,X,Z=0;Z<z.length;++Z)Y=z.charCodeAt(Z),Y<128?G[K++]=Y:Y<2048?(G[K++]=Y>>6|192,G[K++]=Y&63|128):(Y&64512)==55296&&((X=z.charCodeAt(Z+1))&64512)==56320?(Y=65536+((Y&1023)<<10)+(X&1023),++Z,G[K++]=Y>>18|240,G[K++]=Y>>12&63|128,G[K++]=Y>>6&63|128,G[K++]=Y&63|128):(G[K++]=Y>>12|224,G[K++]=Y>>6&63|128,G[K++]=Y&63|128);return K-J}})),require_pool=__commonJSMin(((z,G)=>{G.exports=K;function K(z,G,K){var J=K||8192,Y=J>>>1,X=null,Z=J;return function(K){if(K<1||K>Y)return z(K);Z+K>J&&(X=z(J),Z=0);var Q=G.call(X,Z,Z+=K);return Z&7&&(Z=(Z|7)+1),Q}}})),require_longbits=__commonJSMin(((z,G)=>{G.exports=J;var K=require_minimal$1();function J(z,G){this.lo=z>>>0,this.hi=G>>>0}var Y=J.zero=new J(0,0);Y.toNumber=function(){return 0},Y.zzEncode=Y.zzDecode=function(){return this},Y.length=function(){return 1};var X=J.zeroHash=`\0\0\0\0\0\0\0\0`;J.fromNumber=function(z){if(z===0)return Y;var G=z<0;G&&(z=-z);var K=z>>>0,X=(z-K)/4294967296>>>0;return G&&(X=~X>>>0,K=~K>>>0,++K>4294967295&&(K=0,++X>4294967295&&(X=0))),new J(K,X)},J.from=function(z){if(typeof z==`number`)return J.fromNumber(z);if(K.isString(z))if(K.Long)z=K.Long.fromString(z);else return J.fromNumber(parseInt(z,10));return z.low||z.high?new J(z.low>>>0,z.high>>>0):Y},J.prototype.toNumber=function(z){if(!z&&this.hi>>>31){var G=~this.lo+1>>>0,K=~this.hi>>>0;return G||(K=K+1>>>0),-(G+K*4294967296)}return this.lo+this.hi*4294967296},J.prototype.toLong=function(z){return K.Long?new K.Long(this.lo|0,this.hi|0,!!z):{low:this.lo|0,high:this.hi|0,unsigned:!!z}};var Z=String.prototype.charCodeAt;J.fromHash=function(z){return z===X?Y:new J((Z.call(z,0)|Z.call(z,1)<<8|Z.call(z,2)<<16|Z.call(z,3)<<24)>>>0,(Z.call(z,4)|Z.call(z,5)<<8|Z.call(z,6)<<16|Z.call(z,7)<<24)>>>0)},J.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},J.prototype.zzEncode=function(){var z=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^z)>>>0,this.lo=(this.lo<<1^z)>>>0,this},J.prototype.zzDecode=function(){var z=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^z)>>>0,this.hi=(this.hi>>>1^z)>>>0,this},J.prototype.length=function(){var z=this.lo,G=(this.lo>>>28|this.hi<<4)>>>0,K=this.hi>>>24;return K===0?G===0?z<16384?z<128?1:2:z<2097152?3:4:G<16384?G<128?5:6:G<2097152?7:8:K<128?9:10}})),require_minimal$1=__commonJSMin((z=>{var G=z;G.asPromise=require_aspromise(),G.base64=require_base64(),G.EventEmitter=require_eventemitter(),G.float=require_float(),G.inquire=require_inquire(),G.utf8=require_utf8(),G.pool=require_pool(),G.LongBits=require_longbits(),G.isNode=!!(typeof global<`u`&&global&&global.process&&global.process.versions&&global.process.versions.node),G.global=G.isNode&&global||typeof window<`u`&&window||typeof self<`u`&&self||z,G.emptyArray=Object.freeze?Object.freeze([]):[],G.emptyObject=Object.freeze?Object.freeze({}):{},G.isInteger=Number.isInteger||function(z){return typeof z==`number`&&isFinite(z)&&Math.floor(z)===z},G.isString=function(z){return typeof z==`string`||z instanceof String},G.isObject=function(z){return z&&typeof z==`object`},G.isset=G.isSet=function(z,G){var K=z[G];return K!=null&&z.hasOwnProperty(G)?typeof K!=`object`||(Array.isArray(K)?K.length:Object.keys(K).length)>0:!1},G.Buffer=(function(){try{var z=G.inquire(`buffer`).Buffer;return z.prototype.utf8Write?z:null}catch(z){return null}})(),G._Buffer_from=null,G._Buffer_allocUnsafe=null,G.newBuffer=function(z){return typeof z==`number`?G.Buffer?G._Buffer_allocUnsafe(z):new G.Array(z):G.Buffer?G._Buffer_from(z):typeof Uint8Array>`u`?z:new Uint8Array(z)},G.Array=typeof Uint8Array<`u`?Uint8Array:Array,G.Long=G.global.dcodeIO&&G.global.dcodeIO.Long||G.global.Long||G.inquire(`long`),G.key2Re=/^true|false|0|1$/,G.key32Re=/^-?(?:0|[1-9][0-9]*)$/,G.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,G.longToHash=function(z){return z?G.LongBits.from(z).toHash():G.LongBits.zeroHash},G.longFromHash=function(z,K){var J=G.LongBits.fromHash(z);return G.Long?G.Long.fromBits(J.lo,J.hi,K):J.toNumber(!!K)};function K(z,G,K){for(var J=Object.keys(G),Y=0;Y<J.length;++Y)(z[J[Y]]===void 0||!K)&&(z[J[Y]]=G[J[Y]]);return z}G.merge=K,G.lcFirst=function(z){return z.charAt(0).toLowerCase()+z.substring(1)};function J(z){function G(z,J){if(!(this instanceof G))return new G(z,J);Object.defineProperty(this,`message`,{get:function(){return z}}),Error.captureStackTrace?Error.captureStackTrace(this,G):Object.defineProperty(this,`stack`,{value:Error().stack||``}),J&&K(this,J)}return G.prototype=Object.create(Error.prototype,{constructor:{value:G,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return z},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+`: `+this.message},writable:!0,enumerable:!1,configurable:!0}}),G}G.newError=J,G.ProtocolError=J(`ProtocolError`),G.oneOfGetter=function(z){for(var G={},K=0;K<z.length;++K)G[z[K]]=1;return function(){for(var z=Object.keys(this),K=z.length-1;K>-1;--K)if(G[z[K]]===1&&this[z[K]]!==void 0&&this[z[K]]!==null)return z[K]}},G.oneOfSetter=function(z){return function(G){for(var K=0;K<z.length;++K)z[K]!==G&&delete this[z[K]]}},G.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},G._configure=function(){var z=G.Buffer;if(!z){G._Buffer_from=G._Buffer_allocUnsafe=null;return}G._Buffer_from=z.from!==Uint8Array.from&&z.from||function(G,K){return new z(G,K)},G._Buffer_allocUnsafe=z.allocUnsafe||function(G){return new z(G)}}})),require_writer=__commonJSMin(((z,G)=>{G.exports=ne;var K=require_minimal$1(),J,Y=K.LongBits,X=K.base64,Z=K.utf8;function Q(z,G,K){this.fn=z,this.len=G,this.next=void 0,this.val=K}function ee(){}function te(z){this.head=z.head,this.tail=z.tail,this.len=z.len,this.next=z.states}function ne(){this.len=0,this.head=new Q(ee,0,0),this.tail=this.head,this.states=null}var ie=function(){return K.Buffer?function(){return(ne.create=function(){return new J})()}:function(){return new ne}};ne.create=ie(),ne.alloc=function(z){return new K.Array(z)},K.Array!==Array&&(ne.alloc=K.pool(ne.alloc,K.Array.prototype.subarray)),ne.prototype._push=function(z,G,K){return this.tail=this.tail.next=new Q(z,G,K),this.len+=G,this};function ae(z,G,K){G[K]=z&255}function oe(z,G,K){for(;z>127;)G[K++]=z&127|128,z>>>=7;G[K]=z}function se(z,G){this.len=z,this.next=void 0,this.val=G}se.prototype=Object.create(Q.prototype),se.prototype.fn=oe,ne.prototype.uint32=function(z){return this.len+=(this.tail=this.tail.next=new se((z>>>=0)<128?1:z<16384?2:z<2097152?3:z<268435456?4:5,z)).len,this},ne.prototype.int32=function(z){return z<0?this._push(ce,10,Y.fromNumber(z)):this.uint32(z)},ne.prototype.sint32=function(z){return this.uint32((z<<1^z>>31)>>>0)};function ce(z,G,K){for(;z.hi;)G[K++]=z.lo&127|128,z.lo=(z.lo>>>7|z.hi<<25)>>>0,z.hi>>>=7;for(;z.lo>127;)G[K++]=z.lo&127|128,z.lo>>>=7;G[K++]=z.lo}ne.prototype.uint64=function(z){var G=Y.from(z);return this._push(ce,G.length(),G)},ne.prototype.int64=ne.prototype.uint64,ne.prototype.sint64=function(z){var G=Y.from(z).zzEncode();return this._push(ce,G.length(),G)},ne.prototype.bool=function(z){return this._push(ae,1,z?1:0)};function le(z,G,K){G[K]=z&255,G[K+1]=z>>>8&255,G[K+2]=z>>>16&255,G[K+3]=z>>>24}ne.prototype.fixed32=function(z){return this._push(le,4,z>>>0)},ne.prototype.sfixed32=ne.prototype.fixed32,ne.prototype.fixed64=function(z){var G=Y.from(z);return this._push(le,4,G.lo)._push(le,4,G.hi)},ne.prototype.sfixed64=ne.prototype.fixed64,ne.prototype.float=function(z){return this._push(K.float.writeFloatLE,4,z)},ne.prototype.double=function(z){return this._push(K.float.writeDoubleLE,8,z)};var ue=K.Array.prototype.set?function(z,G,K){G.set(z,K)}:function(z,G,K){for(var J=0;J<z.length;++J)G[K+J]=z[J]};ne.prototype.bytes=function(z){var G=z.length>>>0;if(!G)return this._push(ae,1,0);if(K.isString(z)){var J=ne.alloc(G=X.length(z));X.decode(z,J,0),z=J}return this.uint32(G)._push(ue,G,z)},ne.prototype.string=function(z){var G=Z.length(z);return G?this.uint32(G)._push(Z.write,G,z):this._push(ae,1,0)},ne.prototype.fork=function(){return this.states=new te(this),this.head=this.tail=new Q(ee,0,0),this.len=0,this},ne.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Q(ee,0,0),this.len=0),this},ne.prototype.ldelim=function(){var z=this.head,G=this.tail,K=this.len;return this.reset().uint32(K),K&&(this.tail.next=z.next,this.tail=G,this.len+=K),this},ne.prototype.finish=function(){for(var z=this.head.next,G=this.constructor.alloc(this.len),K=0;z;)z.fn(z.val,G,K),K+=z.len,z=z.next;return G},ne._configure=function(z){J=z,ne.create=ie(),J._configure()}})),require_writer_buffer=__commonJSMin(((z,G)=>{G.exports=Y;var K=require_writer();(Y.prototype=Object.create(K.prototype)).constructor=Y;var J=require_minimal$1();function Y(){K.call(this)}Y._configure=function(){Y.alloc=J._Buffer_allocUnsafe,Y.writeBytesBuffer=J.Buffer&&J.Buffer.prototype instanceof Uint8Array&&J.Buffer.prototype.set.name===`set`?function(z,G,K){G.set(z,K)}:function(z,G,K){if(z.copy)z.copy(G,K,0,z.length);else for(var J=0;J<z.length;)G[K++]=z[J++]}},Y.prototype.bytes=function(z){J.isString(z)&&(z=J._Buffer_from(z,`base64`));var G=z.length>>>0;return this.uint32(G),G&&this._push(Y.writeBytesBuffer,G,z),this};function X(z,G,K){z.length<40?J.utf8.write(z,G,K):G.utf8Write?G.utf8Write(z,K):G.write(z,K)}Y.prototype.string=function(z){var G=J.Buffer.byteLength(z);return this.uint32(G),G&&this._push(X,G,z),this},Y._configure()})),require_reader=__commonJSMin(((z,G)=>{G.exports=Q;var K=require_minimal$1(),J,Y=K.LongBits,X=K.utf8;function Z(z,G){return RangeError(`index out of range: `+z.pos+` + `+(G||1)+` > `+z.len)}function Q(z){this.buf=z,this.pos=0,this.len=z.length}var ee=typeof Uint8Array<`u`?function(z){if(z instanceof Uint8Array||Array.isArray(z))return new Q(z);throw Error(`illegal buffer`)}:function(z){if(Array.isArray(z))return new Q(z);throw Error(`illegal buffer`)},te=function(){return K.Buffer?function(z){return(Q.create=function(z){return K.Buffer.isBuffer(z)?new J(z):ee(z)})(z)}:ee};Q.create=te(),Q.prototype._slice=K.Array.prototype.subarray||K.Array.prototype.slice,Q.prototype.uint32=(function(){var z=4294967295;return function(){if(z=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(z=(z|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(z=(z|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(z=(z|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(z=(z|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return z;if((this.pos+=5)>this.len)throw this.pos=this.len,Z(this,10);return z}})(),Q.prototype.int32=function(){return this.uint32()|0},Q.prototype.sint32=function(){var z=this.uint32();return z>>>1^-(z&1)|0};function ne(){var z=new Y(0,0),G=0;if(this.len-this.pos>4){for(;G<4;++G)if(z.lo=(z.lo|(this.buf[this.pos]&127)<<G*7)>>>0,this.buf[this.pos++]<128)return z;if(z.lo=(z.lo|(this.buf[this.pos]&127)<<28)>>>0,z.hi=(z.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return z;G=0}else{for(;G<3;++G){if(this.pos>=this.len)throw Z(this);if(z.lo=(z.lo|(this.buf[this.pos]&127)<<G*7)>>>0,this.buf[this.pos++]<128)return z}return z.lo=(z.lo|(this.buf[this.pos++]&127)<<G*7)>>>0,z}if(this.len-this.pos>4){for(;G<5;++G)if(z.hi=(z.hi|(this.buf[this.pos]&127)<<G*7+3)>>>0,this.buf[this.pos++]<128)return z}else for(;G<5;++G){if(this.pos>=this.len)throw Z(this);if(z.hi=(z.hi|(this.buf[this.pos]&127)<<G*7+3)>>>0,this.buf[this.pos++]<128)return z}throw Error(`invalid varint encoding`)}Q.prototype.bool=function(){return this.uint32()!==0};function ie(z,G){return(z[G-4]|z[G-3]<<8|z[G-2]<<16|z[G-1]<<24)>>>0}Q.prototype.fixed32=function(){if(this.pos+4>this.len)throw Z(this,4);return ie(this.buf,this.pos+=4)},Q.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Z(this,4);return ie(this.buf,this.pos+=4)|0};function ae(){if(this.pos+8>this.len)throw Z(this,8);return new Y(ie(this.buf,this.pos+=4),ie(this.buf,this.pos+=4))}Q.prototype.float=function(){if(this.pos+4>this.len)throw Z(this,4);var z=K.float.readFloatLE(this.buf,this.pos);return this.pos+=4,z},Q.prototype.double=function(){if(this.pos+8>this.len)throw Z(this,4);var z=K.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,z},Q.prototype.bytes=function(){var z=this.uint32(),G=this.pos,J=this.pos+z;if(J>this.len)throw Z(this,z);if(this.pos+=z,Array.isArray(this.buf))return this.buf.slice(G,J);if(G===J){var Y=K.Buffer;return Y?Y.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,G,J)},Q.prototype.string=function(){var z=this.bytes();return X.read(z,0,z.length)},Q.prototype.skip=function(z){if(typeof z==`number`){if(this.pos+z>this.len)throw Z(this,z);this.pos+=z}else do if(this.pos>=this.len)throw Z(this);while(this.buf[this.pos++]&128);return this},Q.prototype.skipType=function(z){switch(z){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(z=this.uint32()&7)!=4;)this.skipType(z);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type `+z+` at offset `+this.pos)}return this},Q._configure=function(z){J=z,Q.create=te(),J._configure();var G=K.Long?`toLong`:`toNumber`;K.merge(Q.prototype,{int64:function(){return ne.call(this)[G](!1)},uint64:function(){return ne.call(this)[G](!0)},sint64:function(){return ne.call(this).zzDecode()[G](!1)},fixed64:function(){return ae.call(this)[G](!0)},sfixed64:function(){return ae.call(this)[G](!1)}})}})),require_reader_buffer=__commonJSMin(((z,G)=>{G.exports=Y;var K=require_reader();(Y.prototype=Object.create(K.prototype)).constructor=Y;var J=require_minimal$1();function Y(z){K.call(this,z)}Y._configure=function(){J.Buffer&&(Y.prototype._slice=J.Buffer.prototype.slice)},Y.prototype.string=function(){var z=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+z,this.len)):this.buf.toString(`utf-8`,this.pos,this.pos=Math.min(this.pos+z,this.len))},Y._configure()})),require_service=__commonJSMin(((z,G)=>{G.exports=J;var K=require_minimal$1();(J.prototype=Object.create(K.EventEmitter.prototype)).constructor=J;function J(z,G,J){if(typeof z!=`function`)throw TypeError(`rpcImpl must be a function`);K.EventEmitter.call(this),this.rpcImpl=z,this.requestDelimited=!!G,this.responseDelimited=!!J}J.prototype.rpcCall=function z(G,J,Y,X,Z){if(!X)throw TypeError(`request must be specified`);var Q=this;if(!Z)return K.asPromise(z,Q,G,J,Y,X);if(!Q.rpcImpl){setTimeout(function(){Z(Error(`already ended`))},0);return}try{return Q.rpcImpl(G,J[Q.requestDelimited?`encodeDelimited`:`encode`](X).finish(),function(z,K){if(z)return Q.emit(`error`,z,G),Z(z);if(K===null){Q.end(!0);return}if(!(K instanceof Y))try{K=Y[Q.responseDelimited?`decodeDelimited`:`decode`](K)}catch(z){return Q.emit(`error`,z,G),Z(z)}return Q.emit(`data`,K,G),Z(null,K)})}catch(z){Q.emit(`error`,z,G),setTimeout(function(){Z(z)},0);return}},J.prototype.end=function(z){return this.rpcImpl&&(z||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit(`end`).off()),this}})),require_rpc=__commonJSMin((z=>{var G=z;G.Service=require_service()})),require_roots=__commonJSMin(((z,G)=>{G.exports={}})),require_index_minimal=__commonJSMin((z=>{var G=z;G.build=`minimal`,G.Writer=require_writer(),G.BufferWriter=require_writer_buffer(),G.Reader=require_reader(),G.BufferReader=require_reader_buffer(),G.util=require_minimal$1(),G.rpc=require_rpc(),G.roots=require_roots(),G.configure=K;function K(){G.util._configure(),G.Writer._configure(G.BufferWriter),G.Reader._configure(G.BufferReader)}K()})),require_minimal=__commonJSMin(((z,G)=>{G.exports=require_index_minimal()})),import_minimal=__toESM(require_minimal(),1);const _excluded=[`resource`,`getSessionId`,`tracer`,`url`,`debug`,`apiKey`,`headers`];var BatchLogProcessor=class{constructor(z,G){_defineProperty(this,`logs`,[]),_defineProperty(this,`scheduledDelayMillis`,void 0),_defineProperty(this,`timeout`,void 0),_defineProperty(this,`exporter`,void 0),_defineProperty(this,`lastBatchSent`,0),this.scheduledDelayMillis=(G==null?void 0:G.scheduledDelayMillis)||5e3,this.exporter=z,typeof window<`u`&&window.addEventListener(`unload`,()=>{this._flushAll()})}onLog(z){this.logs.push(z),this.timeout===void 0&&(this.timeout=setTimeout(()=>{this.timeout=void 0,this._flushAll()},this.scheduledDelayMillis))}_flushAll(){this.lastBatchSent=Date.now(),context.with(suppressTracing(context.active()),()=>{let z=this.logs.splice(0,this.logs.length);this.exporter.export(z)})}};function convert(z,G,K){return{body:z,timeUnixNano:G,attributes:K}}function createBaseAnyValue(){return{stringValue:void 0,boolValue:void 0,intValue:void 0,doubleValue:void 0,arrayValue:void 0,kvlistValue:void 0,bytesValue:void 0}}const AnyValue={encode(z,G=import_minimal.default.Writer.create()){return z.stringValue!==void 0&&G.uint32(10).string(z.stringValue),z.boolValue!==void 0&&G.uint32(16).bool(z.boolValue),z.intValue!==void 0&&G.uint32(24).int64(z.intValue),z.doubleValue!==void 0&&G.uint32(33).double(z.doubleValue),z.arrayValue!==void 0&&ArrayValue.encode(z.arrayValue,G.uint32(42).fork()).ldelim(),z.kvlistValue!==void 0&&KeyValueList.encode(z.kvlistValue,G.uint32(50).fork()).ldelim(),z.bytesValue!==void 0&&G.uint32(58).bytes(z.bytesValue),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseAnyValue();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.stringValue=K.string();continue;case 2:if(z!==16)break;Y.boolValue=K.bool();continue;case 3:if(z!==24)break;Y.intValue=longToNumber$1(K.int64());continue;case 4:if(z!==33)break;Y.doubleValue=K.double();continue;case 5:if(z!==42)break;Y.arrayValue=ArrayValue.decode(K,K.uint32());continue;case 6:if(z!==50)break;Y.kvlistValue=KeyValueList.decode(K,K.uint32());continue;case 7:if(z!==58)break;Y.bytesValue=K.bytes();continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{stringValue:isSet$2(z.stringValue)?globalThis.String(z.stringValue):void 0,boolValue:isSet$2(z.boolValue)?globalThis.Boolean(z.boolValue):void 0,intValue:isSet$2(z.intValue)?globalThis.Number(z.intValue):void 0,doubleValue:isSet$2(z.doubleValue)?globalThis.Number(z.doubleValue):void 0,arrayValue:isSet$2(z.arrayValue)?ArrayValue.fromJSON(z.arrayValue):void 0,kvlistValue:isSet$2(z.kvlistValue)?KeyValueList.fromJSON(z.kvlistValue):void 0,bytesValue:isSet$2(z.bytesValue)?bytesFromBase64$1(z.bytesValue):void 0}},toJSON(z){let G={};return z.stringValue!==void 0&&(G.stringValue=z.stringValue),z.boolValue!==void 0&&(G.boolValue=z.boolValue),z.intValue!==void 0&&(G.intValue=Math.round(z.intValue)),z.doubleValue!==void 0&&(G.doubleValue=z.doubleValue),z.arrayValue!==void 0&&(G.arrayValue=ArrayValue.toJSON(z.arrayValue)),z.kvlistValue!==void 0&&(G.kvlistValue=KeyValueList.toJSON(z.kvlistValue)),z.bytesValue!==void 0&&(G.bytesValue=base64FromBytes$1(z.bytesValue)),G},create(z){return AnyValue.fromPartial(z==null?{}:z)},fromPartial(z){var G,K,J,Y,X;let Z=createBaseAnyValue();return Z.stringValue=(G=z.stringValue)==null?void 0:G,Z.boolValue=(K=z.boolValue)==null?void 0:K,Z.intValue=(J=z.intValue)==null?void 0:J,Z.doubleValue=(Y=z.doubleValue)==null?void 0:Y,Z.arrayValue=z.arrayValue!==void 0&&z.arrayValue!==null?ArrayValue.fromPartial(z.arrayValue):void 0,Z.kvlistValue=z.kvlistValue!==void 0&&z.kvlistValue!==null?KeyValueList.fromPartial(z.kvlistValue):void 0,Z.bytesValue=(X=z.bytesValue)==null?void 0:X,Z}};function createBaseArrayValue(){return{values:[]}}const ArrayValue={encode(z,G=import_minimal.default.Writer.create()){if(z.values!==void 0&&z.values.length!==0)for(let K of z.values)AnyValue.encode(K,G.uint32(10).fork()).ldelim();return G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseArrayValue();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.values.push(AnyValue.decode(K,K.uint32()));continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{values:globalThis.Array.isArray(z==null?void 0:z.values)?z.values.map(z=>AnyValue.fromJSON(z)):[]}},toJSON(z){var G;let K={};return(G=z.values)!=null&&G.length&&(K.values=z.values.map(z=>AnyValue.toJSON(z))),K},create(z){return ArrayValue.fromPartial(z==null?{}:z)},fromPartial(z){var G;let K=createBaseArrayValue();return K.values=((G=z.values)==null?void 0:G.map(z=>AnyValue.fromPartial(z)))||[],K}};function createBaseKeyValueList(){return{values:[]}}const KeyValueList={encode(z,G=import_minimal.default.Writer.create()){if(z.values!==void 0&&z.values.length!==0)for(let K of z.values)KeyValue.encode(K,G.uint32(10).fork()).ldelim();return G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseKeyValueList();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.values.push(KeyValue.decode(K,K.uint32()));continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{values:globalThis.Array.isArray(z==null?void 0:z.values)?z.values.map(z=>KeyValue.fromJSON(z)):[]}},toJSON(z){var G;let K={};return(G=z.values)!=null&&G.length&&(K.values=z.values.map(z=>KeyValue.toJSON(z))),K},create(z){return KeyValueList.fromPartial(z==null?{}:z)},fromPartial(z){var G;let K=createBaseKeyValueList();return K.values=((G=z.values)==null?void 0:G.map(z=>KeyValue.fromPartial(z)))||[],K}};function createBaseKeyValue(){return{key:``,value:void 0}}const KeyValue={encode(z,G=import_minimal.default.Writer.create()){return z.key!==void 0&&z.key!==``&&G.uint32(10).string(z.key),z.value!==void 0&&AnyValue.encode(z.value,G.uint32(18).fork()).ldelim(),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseKeyValue();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.key=K.string();continue;case 2:if(z!==18)break;Y.value=AnyValue.decode(K,K.uint32());continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{key:isSet$2(z.key)?globalThis.String(z.key):``,value:isSet$2(z.value)?AnyValue.fromJSON(z.value):void 0}},toJSON(z){let G={};return z.key!==void 0&&z.key!==``&&(G.key=z.key),z.value!==void 0&&(G.value=AnyValue.toJSON(z.value)),G},create(z){return KeyValue.fromPartial(z==null?{}:z)},fromPartial(z){var G;let K=createBaseKeyValue();return K.key=(G=z.key)==null?``:G,K.value=z.value!==void 0&&z.value!==null?AnyValue.fromPartial(z.value):void 0,K}};function createBaseInstrumentationLibrary(){return{name:``,version:``}}const InstrumentationLibrary={encode(z,G=import_minimal.default.Writer.create()){return z.name!==void 0&&z.name!==``&&G.uint32(10).string(z.name),z.version!==void 0&&z.version!==``&&G.uint32(18).string(z.version),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseInstrumentationLibrary();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.name=K.string();continue;case 2:if(z!==18)break;Y.version=K.string();continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{name:isSet$2(z.name)?globalThis.String(z.name):``,version:isSet$2(z.version)?globalThis.String(z.version):``}},toJSON(z){let G={};return z.name!==void 0&&z.name!==``&&(G.name=z.name),z.version!==void 0&&z.version!==``&&(G.version=z.version),G},create(z){return InstrumentationLibrary.fromPartial(z==null?{}:z)},fromPartial(z){var G,K;let J=createBaseInstrumentationLibrary();return J.name=(G=z.name)==null?``:G,J.version=(K=z.version)==null?``:K,J}};function createBaseInstrumentationScope(){return{name:``,version:``}}const InstrumentationScope={encode(z,G=import_minimal.default.Writer.create()){return z.name!==void 0&&z.name!==``&&G.uint32(10).string(z.name),z.version!==void 0&&z.version!==``&&G.uint32(18).string(z.version),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseInstrumentationScope();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.name=K.string();continue;case 2:if(z!==18)break;Y.version=K.string();continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{name:isSet$2(z.name)?globalThis.String(z.name):``,version:isSet$2(z.version)?globalThis.String(z.version):``}},toJSON(z){let G={};return z.name!==void 0&&z.name!==``&&(G.name=z.name),z.version!==void 0&&z.version!==``&&(G.version=z.version),G},create(z){return InstrumentationScope.fromPartial(z==null?{}:z)},fromPartial(z){var G,K;let J=createBaseInstrumentationScope();return J.name=(G=z.name)==null?``:G,J.version=(K=z.version)==null?``:K,J}};function bytesFromBase64$1(z){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(z,`base64`));{let G=globalThis.atob(z),K=new Uint8Array(G.length);for(let z=0;z<G.length;++z)K[z]=G.charCodeAt(z);return K}}function base64FromBytes$1(z){if(globalThis.Buffer)return globalThis.Buffer.from(z).toString(`base64`);{let G=[];return z.forEach(z=>{G.push(globalThis.String.fromCharCode(z))}),globalThis.btoa(G.join(``))}}function longToNumber$1(z){if(z.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error(`Value is larger than Number.MAX_SAFE_INTEGER`);return z.toNumber()}import_minimal.default.util.Long!==Long&&(import_minimal.default.util.Long=Long,import_minimal.default.configure());function isSet$2(z){return z!=null}function createBaseResource(){return{attributes:[],droppedAttributesCount:0}}const Resource={encode(z,G=import_minimal.default.Writer.create()){if(z.attributes!==void 0&&z.attributes.length!==0)for(let K of z.attributes)KeyValue.encode(K,G.uint32(10).fork()).ldelim();return z.droppedAttributesCount!==void 0&&z.droppedAttributesCount!==0&&G.uint32(16).uint32(z.droppedAttributesCount),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseResource();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.attributes.push(KeyValue.decode(K,K.uint32()));continue;case 2:if(z!==16)break;Y.droppedAttributesCount=K.uint32();continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{attributes:globalThis.Array.isArray(z==null?void 0:z.attributes)?z.attributes.map(z=>KeyValue.fromJSON(z)):[],droppedAttributesCount:isSet$1(z.droppedAttributesCount)?globalThis.Number(z.droppedAttributesCount):0}},toJSON(z){var G;let K={};return(G=z.attributes)!=null&&G.length&&(K.attributes=z.attributes.map(z=>KeyValue.toJSON(z))),z.droppedAttributesCount!==void 0&&z.droppedAttributesCount!==0&&(K.droppedAttributesCount=Math.round(z.droppedAttributesCount)),K},create(z){return Resource.fromPartial(z==null?{}:z)},fromPartial(z){var G,K;let J=createBaseResource();return J.attributes=((G=z.attributes)==null?void 0:G.map(z=>KeyValue.fromPartial(z)))||[],J.droppedAttributesCount=(K=z.droppedAttributesCount)==null?0:K,J}};function isSet$1(z){return z!=null}let SeverityNumber=function(z){return z[z.SEVERITY_NUMBER_UNSPECIFIED=0]=`SEVERITY_NUMBER_UNSPECIFIED`,z[z.SEVERITY_NUMBER_TRACE=1]=`SEVERITY_NUMBER_TRACE`,z[z.SEVERITY_NUMBER_TRACE2=2]=`SEVERITY_NUMBER_TRACE2`,z[z.SEVERITY_NUMBER_TRACE3=3]=`SEVERITY_NUMBER_TRACE3`,z[z.SEVERITY_NUMBER_TRACE4=4]=`SEVERITY_NUMBER_TRACE4`,z[z.SEVERITY_NUMBER_DEBUG=5]=`SEVERITY_NUMBER_DEBUG`,z[z.SEVERITY_NUMBER_DEBUG2=6]=`SEVERITY_NUMBER_DEBUG2`,z[z.SEVERITY_NUMBER_DEBUG3=7]=`SEVERITY_NUMBER_DEBUG3`,z[z.SEVERITY_NUMBER_DEBUG4=8]=`SEVERITY_NUMBER_DEBUG4`,z[z.SEVERITY_NUMBER_INFO=9]=`SEVERITY_NUMBER_INFO`,z[z.SEVERITY_NUMBER_INFO2=10]=`SEVERITY_NUMBER_INFO2`,z[z.SEVERITY_NUMBER_INFO3=11]=`SEVERITY_NUMBER_INFO3`,z[z.SEVERITY_NUMBER_INFO4=12]=`SEVERITY_NUMBER_INFO4`,z[z.SEVERITY_NUMBER_WARN=13]=`SEVERITY_NUMBER_WARN`,z[z.SEVERITY_NUMBER_WARN2=14]=`SEVERITY_NUMBER_WARN2`,z[z.SEVERITY_NUMBER_WARN3=15]=`SEVERITY_NUMBER_WARN3`,z[z.SEVERITY_NUMBER_WARN4=16]=`SEVERITY_NUMBER_WARN4`,z[z.SEVERITY_NUMBER_ERROR=17]=`SEVERITY_NUMBER_ERROR`,z[z.SEVERITY_NUMBER_ERROR2=18]=`SEVERITY_NUMBER_ERROR2`,z[z.SEVERITY_NUMBER_ERROR3=19]=`SEVERITY_NUMBER_ERROR3`,z[z.SEVERITY_NUMBER_ERROR4=20]=`SEVERITY_NUMBER_ERROR4`,z[z.SEVERITY_NUMBER_FATAL=21]=`SEVERITY_NUMBER_FATAL`,z[z.SEVERITY_NUMBER_FATAL2=22]=`SEVERITY_NUMBER_FATAL2`,z[z.SEVERITY_NUMBER_FATAL3=23]=`SEVERITY_NUMBER_FATAL3`,z[z.SEVERITY_NUMBER_FATAL4=24]=`SEVERITY_NUMBER_FATAL4`,z[z.UNRECOGNIZED=-1]=`UNRECOGNIZED`,z}({});function severityNumberFromJSON(z){switch(z){case 0:case`SEVERITY_NUMBER_UNSPECIFIED`:return SeverityNumber.SEVERITY_NUMBER_UNSPECIFIED;case 1:case`SEVERITY_NUMBER_TRACE`:return SeverityNumber.SEVERITY_NUMBER_TRACE;case 2:case`SEVERITY_NUMBER_TRACE2`:return SeverityNumber.SEVERITY_NUMBER_TRACE2;case 3:case`SEVERITY_NUMBER_TRACE3`:return SeverityNumber.SEVERITY_NUMBER_TRACE3;case 4:case`SEVERITY_NUMBER_TRACE4`:return SeverityNumber.SEVERITY_NUMBER_TRACE4;case 5:case`SEVERITY_NUMBER_DEBUG`:return SeverityNumber.SEVERITY_NUMBER_DEBUG;case 6:case`SEVERITY_NUMBER_DEBUG2`:return SeverityNumber.SEVERITY_NUMBER_DEBUG2;case 7:case`SEVERITY_NUMBER_DEBUG3`:return SeverityNumber.SEVERITY_NUMBER_DEBUG3;case 8:case`SEVERITY_NUMBER_DEBUG4`:return SeverityNumber.SEVERITY_NUMBER_DEBUG4;case 9:case`SEVERITY_NUMBER_INFO`:return SeverityNumber.SEVERITY_NUMBER_INFO;case 10:case`SEVERITY_NUMBER_INFO2`:return SeverityNumber.SEVERITY_NUMBER_INFO2;case 11:case`SEVERITY_NUMBER_INFO3`:return SeverityNumber.SEVERITY_NUMBER_INFO3;case 12:case`SEVERITY_NUMBER_INFO4`:return SeverityNumber.SEVERITY_NUMBER_INFO4;case 13:case`SEVERITY_NUMBER_WARN`:return SeverityNumber.SEVERITY_NUMBER_WARN;case 14:case`SEVERITY_NUMBER_WARN2`:return SeverityNumber.SEVERITY_NUMBER_WARN2;case 15:case`SEVERITY_NUMBER_WARN3`:return SeverityNumber.SEVERITY_NUMBER_WARN3;case 16:case`SEVERITY_NUMBER_WARN4`:return SeverityNumber.SEVERITY_NUMBER_WARN4;case 17:case`SEVERITY_NUMBER_ERROR`:return SeverityNumber.SEVERITY_NUMBER_ERROR;case 18:case`SEVERITY_NUMBER_ERROR2`:return SeverityNumber.SEVERITY_NUMBER_ERROR2;case 19:case`SEVERITY_NUMBER_ERROR3`:return SeverityNumber.SEVERITY_NUMBER_ERROR3;case 20:case`SEVERITY_NUMBER_ERROR4`:return SeverityNumber.SEVERITY_NUMBER_ERROR4;case 21:case`SEVERITY_NUMBER_FATAL`:return SeverityNumber.SEVERITY_NUMBER_FATAL;case 22:case`SEVERITY_NUMBER_FATAL2`:return SeverityNumber.SEVERITY_NUMBER_FATAL2;case 23:case`SEVERITY_NUMBER_FATAL3`:return SeverityNumber.SEVERITY_NUMBER_FATAL3;case 24:case`SEVERITY_NUMBER_FATAL4`:return SeverityNumber.SEVERITY_NUMBER_FATAL4;default:return SeverityNumber.UNRECOGNIZED}}function severityNumberToJSON(z){switch(z){case SeverityNumber.SEVERITY_NUMBER_UNSPECIFIED:return`SEVERITY_NUMBER_UNSPECIFIED`;case SeverityNumber.SEVERITY_NUMBER_TRACE:return`SEVERITY_NUMBER_TRACE`;case SeverityNumber.SEVERITY_NUMBER_TRACE2:return`SEVERITY_NUMBER_TRACE2`;case SeverityNumber.SEVERITY_NUMBER_TRACE3:return`SEVERITY_NUMBER_TRACE3`;case SeverityNumber.SEVERITY_NUMBER_TRACE4:return`SEVERITY_NUMBER_TRACE4`;case SeverityNumber.SEVERITY_NUMBER_DEBUG:return`SEVERITY_NUMBER_DEBUG`;case SeverityNumber.SEVERITY_NUMBER_DEBUG2:return`SEVERITY_NUMBER_DEBUG2`;case SeverityNumber.SEVERITY_NUMBER_DEBUG3:return`SEVERITY_NUMBER_DEBUG3`;case SeverityNumber.SEVERITY_NUMBER_DEBUG4:return`SEVERITY_NUMBER_DEBUG4`;case SeverityNumber.SEVERITY_NUMBER_INFO:return`SEVERITY_NUMBER_INFO`;case SeverityNumber.SEVERITY_NUMBER_INFO2:return`SEVERITY_NUMBER_INFO2`;case SeverityNumber.SEVERITY_NUMBER_INFO3:return`SEVERITY_NUMBER_INFO3`;case SeverityNumber.SEVERITY_NUMBER_INFO4:return`SEVERITY_NUMBER_INFO4`;case SeverityNumber.SEVERITY_NUMBER_WARN:return`SEVERITY_NUMBER_WARN`;case SeverityNumber.SEVERITY_NUMBER_WARN2:return`SEVERITY_NUMBER_WARN2`;case SeverityNumber.SEVERITY_NUMBER_WARN3:return`SEVERITY_NUMBER_WARN3`;case SeverityNumber.SEVERITY_NUMBER_WARN4:return`SEVERITY_NUMBER_WARN4`;case SeverityNumber.SEVERITY_NUMBER_ERROR:return`SEVERITY_NUMBER_ERROR`;case SeverityNumber.SEVERITY_NUMBER_ERROR2:return`SEVERITY_NUMBER_ERROR2`;case SeverityNumber.SEVERITY_NUMBER_ERROR3:return`SEVERITY_NUMBER_ERROR3`;case SeverityNumber.SEVERITY_NUMBER_ERROR4:return`SEVERITY_NUMBER_ERROR4`;case SeverityNumber.SEVERITY_NUMBER_FATAL:return`SEVERITY_NUMBER_FATAL`;case SeverityNumber.SEVERITY_NUMBER_FATAL2:return`SEVERITY_NUMBER_FATAL2`;case SeverityNumber.SEVERITY_NUMBER_FATAL3:return`SEVERITY_NUMBER_FATAL3`;case SeverityNumber.SEVERITY_NUMBER_FATAL4:return`SEVERITY_NUMBER_FATAL4`;case SeverityNumber.UNRECOGNIZED:default:return`UNRECOGNIZED`}}function createBaseLogsData(){return{resourceLogs:[]}}const LogsData$1={encode(z,G=import_minimal.default.Writer.create()){if(z.resourceLogs!==void 0&&z.resourceLogs.length!==0)for(let K of z.resourceLogs)ResourceLogs.encode(K,G.uint32(10).fork()).ldelim();return G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseLogsData();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.resourceLogs.push(ResourceLogs.decode(K,K.uint32()));continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{resourceLogs:globalThis.Array.isArray(z==null?void 0:z.resourceLogs)?z.resourceLogs.map(z=>ResourceLogs.fromJSON(z)):[]}},toJSON(z){var G;let K={};return(G=z.resourceLogs)!=null&&G.length&&(K.resourceLogs=z.resourceLogs.map(z=>ResourceLogs.toJSON(z))),K},create(z){return LogsData$1.fromPartial(z==null?{}:z)},fromPartial(z){var G;let K=createBaseLogsData();return K.resourceLogs=((G=z.resourceLogs)==null?void 0:G.map(z=>ResourceLogs.fromPartial(z)))||[],K}};function createBaseResourceLogs(){return{resource:void 0,scopeLogs:[],instrumentationLibraryLogs:[],schemaUrl:``}}const ResourceLogs={encode(z,G=import_minimal.default.Writer.create()){if(z.resource!==void 0&&Resource.encode(z.resource,G.uint32(10).fork()).ldelim(),z.scopeLogs!==void 0&&z.scopeLogs.length!==0)for(let K of z.scopeLogs)ScopeLogs.encode(K,G.uint32(18).fork()).ldelim();if(z.instrumentationLibraryLogs!==void 0&&z.instrumentationLibraryLogs.length!==0)for(let K of z.instrumentationLibraryLogs)InstrumentationLibraryLogs.encode(K,G.uint32(8002).fork()).ldelim();return z.schemaUrl!==void 0&&z.schemaUrl!==``&&G.uint32(26).string(z.schemaUrl),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseResourceLogs();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.resource=Resource.decode(K,K.uint32());continue;case 2:if(z!==18)break;Y.scopeLogs.push(ScopeLogs.decode(K,K.uint32()));continue;case 1e3:if(z!==8002)break;Y.instrumentationLibraryLogs.push(InstrumentationLibraryLogs.decode(K,K.uint32()));continue;case 3:if(z!==26)break;Y.schemaUrl=K.string();continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{resource:isSet(z.resource)?Resource.fromJSON(z.resource):void 0,scopeLogs:globalThis.Array.isArray(z==null?void 0:z.scopeLogs)?z.scopeLogs.map(z=>ScopeLogs.fromJSON(z)):[],instrumentationLibraryLogs:globalThis.Array.isArray(z==null?void 0:z.instrumentationLibraryLogs)?z.instrumentationLibraryLogs.map(z=>InstrumentationLibraryLogs.fromJSON(z)):[],schemaUrl:isSet(z.schemaUrl)?globalThis.String(z.schemaUrl):``}},toJSON(z){var G,K;let J={};return z.resource!==void 0&&(J.resource=Resource.toJSON(z.resource)),(G=z.scopeLogs)!=null&&G.length&&(J.scopeLogs=z.scopeLogs.map(z=>ScopeLogs.toJSON(z))),(K=z.instrumentationLibraryLogs)!=null&&K.length&&(J.instrumentationLibraryLogs=z.instrumentationLibraryLogs.map(z=>InstrumentationLibraryLogs.toJSON(z))),z.schemaUrl!==void 0&&z.schemaUrl!==``&&(J.schemaUrl=z.schemaUrl),J},create(z){return ResourceLogs.fromPartial(z==null?{}:z)},fromPartial(z){var G,K,J;let Y=createBaseResourceLogs();return Y.resource=z.resource!==void 0&&z.resource!==null?Resource.fromPartial(z.resource):void 0,Y.scopeLogs=((G=z.scopeLogs)==null?void 0:G.map(z=>ScopeLogs.fromPartial(z)))||[],Y.instrumentationLibraryLogs=((K=z.instrumentationLibraryLogs)==null?void 0:K.map(z=>InstrumentationLibraryLogs.fromPartial(z)))||[],Y.schemaUrl=(J=z.schemaUrl)==null?``:J,Y}};function createBaseScopeLogs(){return{scope:void 0,logRecords:[],schemaUrl:``}}const ScopeLogs={encode(z,G=import_minimal.default.Writer.create()){if(z.scope!==void 0&&InstrumentationScope.encode(z.scope,G.uint32(10).fork()).ldelim(),z.logRecords!==void 0&&z.logRecords.length!==0)for(let K of z.logRecords)LogRecord.encode(K,G.uint32(18).fork()).ldelim();return z.schemaUrl!==void 0&&z.schemaUrl!==``&&G.uint32(26).string(z.schemaUrl),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseScopeLogs();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.scope=InstrumentationScope.decode(K,K.uint32());continue;case 2:if(z!==18)break;Y.logRecords.push(LogRecord.decode(K,K.uint32()));continue;case 3:if(z!==26)break;Y.schemaUrl=K.string();continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{scope:isSet(z.scope)?InstrumentationScope.fromJSON(z.scope):void 0,logRecords:globalThis.Array.isArray(z==null?void 0:z.logRecords)?z.logRecords.map(z=>LogRecord.fromJSON(z)):[],schemaUrl:isSet(z.schemaUrl)?globalThis.String(z.schemaUrl):``}},toJSON(z){var G;let K={};return z.scope!==void 0&&(K.scope=InstrumentationScope.toJSON(z.scope)),(G=z.logRecords)!=null&&G.length&&(K.logRecords=z.logRecords.map(z=>LogRecord.toJSON(z))),z.schemaUrl!==void 0&&z.schemaUrl!==``&&(K.schemaUrl=z.schemaUrl),K},create(z){return ScopeLogs.fromPartial(z==null?{}:z)},fromPartial(z){var G,K;let J=createBaseScopeLogs();return J.scope=z.scope!==void 0&&z.scope!==null?InstrumentationScope.fromPartial(z.scope):void 0,J.logRecords=((G=z.logRecords)==null?void 0:G.map(z=>LogRecord.fromPartial(z)))||[],J.schemaUrl=(K=z.schemaUrl)==null?``:K,J}};function createBaseInstrumentationLibraryLogs(){return{instrumentationLibrary:void 0,logRecords:[],schemaUrl:``}}const InstrumentationLibraryLogs={encode(z,G=import_minimal.default.Writer.create()){if(z.instrumentationLibrary!==void 0&&InstrumentationLibrary.encode(z.instrumentationLibrary,G.uint32(10).fork()).ldelim(),z.logRecords!==void 0&&z.logRecords.length!==0)for(let K of z.logRecords)LogRecord.encode(K,G.uint32(18).fork()).ldelim();return z.schemaUrl!==void 0&&z.schemaUrl!==``&&G.uint32(26).string(z.schemaUrl),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseInstrumentationLibraryLogs();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==10)break;Y.instrumentationLibrary=InstrumentationLibrary.decode(K,K.uint32());continue;case 2:if(z!==18)break;Y.logRecords.push(LogRecord.decode(K,K.uint32()));continue;case 3:if(z!==26)break;Y.schemaUrl=K.string();continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{instrumentationLibrary:isSet(z.instrumentationLibrary)?InstrumentationLibrary.fromJSON(z.instrumentationLibrary):void 0,logRecords:globalThis.Array.isArray(z==null?void 0:z.logRecords)?z.logRecords.map(z=>LogRecord.fromJSON(z)):[],schemaUrl:isSet(z.schemaUrl)?globalThis.String(z.schemaUrl):``}},toJSON(z){var G;let K={};return z.instrumentationLibrary!==void 0&&(K.instrumentationLibrary=InstrumentationLibrary.toJSON(z.instrumentationLibrary)),(G=z.logRecords)!=null&&G.length&&(K.logRecords=z.logRecords.map(z=>LogRecord.toJSON(z))),z.schemaUrl!==void 0&&z.schemaUrl!==``&&(K.schemaUrl=z.schemaUrl),K},create(z){return InstrumentationLibraryLogs.fromPartial(z==null?{}:z)},fromPartial(z){var G,K;let J=createBaseInstrumentationLibraryLogs();return J.instrumentationLibrary=z.instrumentationLibrary!==void 0&&z.instrumentationLibrary!==null?InstrumentationLibrary.fromPartial(z.instrumentationLibrary):void 0,J.logRecords=((G=z.logRecords)==null?void 0:G.map(z=>LogRecord.fromPartial(z)))||[],J.schemaUrl=(K=z.schemaUrl)==null?``:K,J}};function createBaseLogRecord(){return{timeUnixNano:0,observedTimeUnixNano:0,severityNumber:0,severityText:``,body:void 0,attributes:[],droppedAttributesCount:0,flags:0,traceId:new Uint8Array,spanId:new Uint8Array}}const LogRecord={encode(z,G=import_minimal.default.Writer.create()){if(z.timeUnixNano!==void 0&&z.timeUnixNano!==0&&G.uint32(9).fixed64(z.timeUnixNano),z.observedTimeUnixNano!==void 0&&z.observedTimeUnixNano!==0&&G.uint32(89).fixed64(z.observedTimeUnixNano),z.severityNumber!==void 0&&z.severityNumber!==0&&G.uint32(16).int32(z.severityNumber),z.severityText!==void 0&&z.severityText!==``&&G.uint32(26).string(z.severityText),z.body!==void 0&&AnyValue.encode(z.body,G.uint32(42).fork()).ldelim(),z.attributes!==void 0&&z.attributes.length!==0)for(let K of z.attributes)KeyValue.encode(K,G.uint32(50).fork()).ldelim();return z.droppedAttributesCount!==void 0&&z.droppedAttributesCount!==0&&G.uint32(56).uint32(z.droppedAttributesCount),z.flags!==void 0&&z.flags!==0&&G.uint32(69).fixed32(z.flags),z.traceId!==void 0&&z.traceId.length!==0&&G.uint32(74).bytes(z.traceId),z.spanId!==void 0&&z.spanId.length!==0&&G.uint32(82).bytes(z.spanId),G},decode(z,G){let K=z instanceof import_minimal.default.Reader?z:import_minimal.default.Reader.create(z),J=G===void 0?K.len:K.pos+G,Y=createBaseLogRecord();for(;K.pos<J;){let z=K.uint32();switch(z>>>3){case 1:if(z!==9)break;Y.timeUnixNano=longToNumber(K.fixed64());continue;case 11:if(z!==89)break;Y.observedTimeUnixNano=longToNumber(K.fixed64());continue;case 2:if(z!==16)break;Y.severityNumber=K.int32();continue;case 3:if(z!==26)break;Y.severityText=K.string();continue;case 5:if(z!==42)break;Y.body=AnyValue.decode(K,K.uint32());continue;case 6:if(z!==50)break;Y.attributes.push(KeyValue.decode(K,K.uint32()));continue;case 7:if(z!==56)break;Y.droppedAttributesCount=K.uint32();continue;case 8:if(z!==69)break;Y.flags=K.fixed32();continue;case 9:if(z!==74)break;Y.traceId=K.bytes();continue;case 10:if(z!==82)break;Y.spanId=K.bytes();continue}if((z&7)==4||z===0)break;K.skipType(z&7)}return Y},fromJSON(z){return{timeUnixNano:isSet(z.timeUnixNano)?globalThis.Number(z.timeUnixNano):0,observedTimeUnixNano:isSet(z.observedTimeUnixNano)?globalThis.Number(z.observedTimeUnixNano):0,severityNumber:isSet(z.severityNumber)?severityNumberFromJSON(z.severityNumber):0,severityText:isSet(z.severityText)?globalThis.String(z.severityText):``,body:isSet(z.body)?AnyValue.fromJSON(z.body):void 0,attributes:globalThis.Array.isArray(z==null?void 0:z.attributes)?z.attributes.map(z=>KeyValue.fromJSON(z)):[],droppedAttributesCount:isSet(z.droppedAttributesCount)?globalThis.Number(z.droppedAttributesCount):0,flags:isSet(z.flags)?globalThis.Number(z.flags):0,traceId:isSet(z.traceId)?bytesFromBase64(z.traceId):new Uint8Array,spanId:isSet(z.spanId)?bytesFromBase64(z.spanId):new Uint8Array}},toJSON(z){var G;let K={};return z.timeUnixNano!==void 0&&z.timeUnixNano!==0&&(K.timeUnixNano=Math.round(z.timeUnixNano)),z.observedTimeUnixNano!==void 0&&z.observedTimeUnixNano!==0&&(K.observedTimeUnixNano=Math.round(z.observedTimeUnixNano)),z.severityNumber!==void 0&&z.severityNumber!==0&&(K.severityNumber=severityNumberToJSON(z.severityNumber)),z.severityText!==void 0&&z.severityText!==``&&(K.severityText=z.severityText),z.body!==void 0&&(K.body=AnyValue.toJSON(z.body)),(G=z.attributes)!=null&&G.length&&(K.attributes=z.attributes.map(z=>KeyValue.toJSON(z))),z.droppedAttributesCount!==void 0&&z.droppedAttributesCount!==0&&(K.droppedAttributesCount=Math.round(z.droppedAttributesCount)),z.flags!==void 0&&z.flags!==0&&(K.flags=Math.round(z.flags)),z.traceId!==void 0&&z.traceId.length!==0&&(K.traceId=base64FromBytes(z.traceId)),z.spanId!==void 0&&z.spanId.length!==0&&(K.spanId=base64FromBytes(z.spanId)),K},create(z){return LogRecord.fromPartial(z==null?{}:z)},fromPartial(z){var G,K,J,Y,X,Z,Q,ee,te;let ne=createBaseLogRecord();return ne.timeUnixNano=(G=z.timeUnixNano)==null?0:G,ne.observedTimeUnixNano=(K=z.observedTimeUnixNano)==null?0:K,ne.severityNumber=(J=z.severityNumber)==null?0:J,ne.severityText=(Y=z.severityText)==null?``:Y,ne.body=z.body!==void 0&&z.body!==null?AnyValue.fromPartial(z.body):void 0,ne.attributes=((X=z.attributes)==null?void 0:X.map(z=>KeyValue.fromPartial(z)))||[],ne.droppedAttributesCount=(Z=z.droppedAttributesCount)==null?0:Z,ne.flags=(Q=z.flags)==null?0:Q,ne.traceId=(ee=z.traceId)==null?new Uint8Array:ee,ne.spanId=(te=z.spanId)==null?new Uint8Array:te,ne}};function bytesFromBase64(z){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(z,`base64`));{let G=globalThis.atob(z),K=new Uint8Array(G.length);for(let z=0;z<G.length;++z)K[z]=G.charCodeAt(z);return K}}function base64FromBytes(z){if(globalThis.Buffer)return globalThis.Buffer.from(z).toString(`base64`);{let G=[];return z.forEach(z=>{G.push(globalThis.String.fromCharCode(z))}),globalThis.btoa(G.join(``))}}function longToNumber(z){if(z.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error(`Value is larger than Number.MAX_SAFE_INTEGER`);return z.toNumber()}import_minimal.default.util.Long!==Long&&(import_minimal.default.util.Long=Long,import_minimal.default.configure());function isSet(z){return z!=null}const VERSION=`0.0.12`,defaultHeaders={"Content-Type":`application/x-protobuf`,"Content-Encoding":`gzip`},LogsData=LogsData$1;function isArray(z){return Array.isArray(z)}function isObject(z){return!!z&&typeof z==`object`&&!isArray(z)}function convertToAnyValue(z){return isObject(z)?{kvlistValue:{values:Object.entries(z).map(([z,G])=>({key:z,value:convertToAnyValue(G)}))}}:isArray(z)?{arrayValue:{values:z.map(z=>convertToAnyValue(z))}}:typeof z==`string`?{stringValue:z}:typeof z==`number`?{doubleValue:z}:typeof z==`boolean`?{boolValue:z}:{}}var OTLPLogExporter=class{constructor(z){_defineProperty(this,`config`,void 0),this.config=z}constructLogData(z){var G,K,J;return{resourceLogs:[{resource:{attributes:(G=convertToAnyValue(_objectSpread2({},Object.fromEntries(Object.entries((K=(J=this.config.resource)==null?void 0:J.attributes)==null?{}:K)))))==null||(G=G.kvlistValue)==null?void 0:G.values},scopeLogs:[{scope:{name:`rum.rr-web`,version:VERSION},logRecords:z.map(z=>{var G,K;return{body:convertToAnyValue((G=z.body)==null?null:G),timeUnixNano:z.timeUnixNano*1e6,attributes:(K=convertToAnyValue(z.attributes||{}).kvlistValue)==null?void 0:K.values}})}]}]}}export(z){if(z.length===0)return;let G=this.constructLogData(z);this.config.debug&&console.log(`otlp request`,G);let K=gzipSync(LogsData.encode(G).finish()),J=this.config.headers?Object.assign({},defaultHeaders,this.config.headers):defaultHeaders;fetch(this.config.beaconUrl,{method:`POST`,body:new Uint8Array(K),headers:J}).catch(()=>{})}};const replacementImageURI=`data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==`,INCREMENTAL_SNAPSHOT_EVENT_TYPE=3,MUTATION_SOURCE_TYPE=0,MAX_MESSAGE_SIZE=5e6;function ensureStringifiedMaxMessageSize(z){if(z.length>MAX_MESSAGE_SIZE){let G=z.matchAll(/data:([\w/\-.]+);(\w+),([^)"]*)/gim);for(let K of G)z=K[1].toLocaleLowerCase().slice(0,6)===`image/`?z.replace(K[0],replacementImageURI):z.replace(K[0],``)}return z}var MutationRateLimiter=class{constructor(z,G={}){var K,J;_defineProperty(this,`bucketSize`,100),_defineProperty(this,`refillRate`,10),_defineProperty(this,`mutationBuckets`,{}),_defineProperty(this,`loggedTracker`,{}),_defineProperty(this,`refillBuckets`,()=>{Object.keys(this.mutationBuckets).forEach(z=>{this.mutationBuckets[z]=this.mutationBuckets[z]+this.refillRate,this.mutationBuckets[z]>=this.bucketSize&&delete this.mutationBuckets[z]})}),_defineProperty(this,`getNodeOrRelevantParent`,z=>{let G=this.rrweb.mirror.getNode(z);if((G==null?void 0:G.nodeName)!==`svg`&&G instanceof Element){let z=G.closest(`svg`);if(z)return[this.rrweb.mirror.getId(z),z]}return[z,G]}),_defineProperty(this,`numberOfChanges`,z=>{var G,K,J,Y,X,Z,Q,ee;return((G=(K=z.removes)==null?void 0:K.length)==null?0:G)+((J=(Y=z.attributes)==null?void 0:Y.length)==null?0:J)+((X=(Z=z.texts)==null?void 0:Z.length)==null?0:X)+((Q=(ee=z.adds)==null?void 0:ee.length)==null?0:Q)}),_defineProperty(this,`throttleMutations`,z=>{if(z.type!==INCREMENTAL_SNAPSHOT_EVENT_TYPE||z.data.source!==MUTATION_SOURCE_TYPE)return z;let G=z.data,K=this.numberOfChanges(G);G.attributes&&(G.attributes=G.attributes.filter(z=>{var G;let[K,J]=this.getNodeOrRelevantParent(z.id);if(this.mutationBuckets[K]===0)return!1;if(this.mutationBuckets[K]=(G=this.mutationBuckets[K])==null?this.bucketSize:G,this.mutationBuckets[K]=Math.max(this.mutationBuckets[K]-1,0),this.mutationBuckets[K]===0&&!this.loggedTracker[K]){var Y,X;this.loggedTracker[K]=!0,(Y=(X=this.options).onBlockedNode)==null||Y.call(X,K,J)}return z}));let J=this.numberOfChanges(G);if(!(J===0&&K!==J))return z}),this.rrweb=z,this.options=G,this.refillRate=(K=this.options.refillRate)==null?this.refillRate:K,this.bucketSize=(J=this.options.bucketSize)==null?this.bucketSize:J,setInterval(()=>{this.refillBuckets()},1e3)}};const MAX_RECORDING_LENGTH=14460*1e3,MAX_CHUNK_SIZE=950*1024,encoder=new TextEncoder,decoder=new TextDecoder;let inited=!1,tracer,lastKnownSession,sessionStartTime=0,paused=!1,eventCounter=1,logCounter=1,mutationRateLimiter,getSessionIdImpl,queuedFullSnapshotTimeout;const SessionRecorder={get inited(){return!!inited},isRecording(){return!!inited&&!paused},setEnabled(z){z?SessionRecorder.resume():SessionRecorder.stop()},init(z){var G,K;if(inited)return;if(typeof window>`u`){console.error(`Session recorder can't be ran in non-browser environments`);return}let{resource:J,getSessionId:Y,tracer:X,url:Z,debug:Q,apiKey:ee,headers:te}=z,ne=_objectWithoutProperties(z,_excluded);getSessionIdImpl=Y,tracer=X;let ie=tracer.startSpan(`record init`);if(!ie.isRecording())return;ie.end();let ae=Z,oe=_objectSpread2({},te);ee&&(oe.authorization=ee);let se=new BatchLogProcessor(new OTLPLogExporter({beaconUrl:ae,debug:Q,headers:oe,resource:J}),{});lastKnownSession=(G=Y())==null?``:G,sessionStartTime=Date.now(),mutationRateLimiter=(K=mutationRateLimiter)==null?new MutationRateLimiter(record,{onBlockedNode:(z,G)=>{let K=`OpenTelemetry Session Recorder: Rate limiting recording mutations on node ${z}. This can be due to excessive animations.`,J=Date.now(),Y=tracer.startSpan(`console.warn`,{kind:SpanKind.INTERNAL,startTime:J});Y.setAttribute(`component`,`console`),Y.setAttribute(`level`,`warn`),Y.setAttribute(`message`,K),Y.end(J),Q&&console.warn(K,G),clearTimeout(queuedFullSnapshotTimeout),queuedFullSnapshotTimeout=setTimeout(()=>{record.takeFullSnapshot()},1e3)}}):K,inited=record(_objectSpread2(_objectSpread2({maskAllInputs:!0,maskTextSelector:`*`},ne),{},{emit(z){var G;if(paused)return;let K=(G=getSessionIdImpl==null?void 0:getSessionIdImpl())==null?``:G;if(K!==lastKnownSession){if(document.hidden)return;lastKnownSession=K,sessionStartTime=Date.now(),eventCounter=1,logCounter=1,record.takeFullSnapshot()}if(z.timestamp>sessionStartTime+MAX_RECORDING_LENGTH)return;let J=mutationRateLimiter?mutationRateLimiter.throttleMutations(z):z;if(!J)return;let Y=J.timestamp,X=eventCounter++,Z=encoder.encode(ensureStringifiedMaxMessageSize(JSON.stringify(J))),ee=Math.ceil(Z.byteLength/MAX_CHUNK_SIZE);for(let z=0;z<ee;z++){let G=z*MAX_CHUNK_SIZE,K=(z+1)*MAX_CHUNK_SIZE,J=convert(decoder.decode(Z.slice(G,K)),Y,{"rr-web.offset":logCounter++,"rr-web.event":X,"rr-web.chunk":z+1,"rr-web.total-chunks":ee});Q&&console.log(J),se.onLog(J)}}}))},resume(){if(!inited)return;let z=paused;paused=!1,z||(record.takeFullSnapshot(),tracer.startSpan(`record resume`).end())},stop(){inited&&(paused&&tracer.startSpan(`record stop`).end(),paused=!0)},deinit(){inited&&(inited(),inited=!1,getSessionIdImpl=void 0)}},noopSessionRecording={isRecording:()=>!1,setEnabled:()=>{}};function buildInitConfig({resource:z,spanSessionManager:G,tracerProvider:K,appID:J,userID:Y,mxlDataURL:X,sessionRecorder:Z}){return _objectSpread2({resource:z,getSessionId:()=>G.getSessionId(),tracer:K.getTracer(`mxl.session-recorder`,VERSION),url:getLogEndpoint(J,X),headers:getMXLHeaders(J,Y)},Z)}function createSessionRecordingControl(z){let G=()=>buildInitConfig(z);return z.recordUserSessions?(SessionRecorder.init(G()),{isRecording:()=>SessionRecorder.isRecording(),setEnabled:z=>{SessionRecorder.setEnabled(z)}}):{isRecording:()=>SessionRecorder.isRecording(),setEnabled:z=>{z?SessionRecorder.inited?SessionRecorder.resume():SessionRecorder.init(G()):SessionRecorder.inited&&SessionRecorder.stop()}}}const validateAppID=z=>{if(z!==void 0){if(typeof z!=`string`)throw Error(`appID must be a string, or omitted if not using MXL. Received ${String(z)}`);return z}},validateAppVersion=z=>{if(z===void 0){let z=TEMPLATE_APP_VERSION.trim();return z===``?`unspecified`:z}if(typeof z!=`string`)throw Error(`if appVersion is specified, it must be a string. Received ${String(z)}`);let G=z.trim();if(G===``)throw Error(`if appVersion is specified, it cannot be an empty string.`);return G},initSDK=({appID:z,appVersion:G,resource:K=emptyResource(),spanExporters:J=[],logExporters:Y=[],spanProcessors:X=[],propagator:Z=null,defaultInstrumentationConfig:Q,instrumentations:ee=[],contextManager:te=null,logProcessors:ne=[],attributeScrubbers:ie=[],enableDefaultAttributeScrubbing:ae=!0,additionalQueryParamsToScrub:oe=[],logLevel:se=DiagLogLevel.ERROR,mxlDataURL:ce,mxlConfigURL:le,diagLogger:ue=diag$1.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:de,dynamicSDKConfig:fe,registerGlobally:pe=!0,blockNetworkSpanForwarding:me=!1,restrictedProtocols:he=new Set([`file:`]),useDocumentTitleAsPageLabel:ge=!0,recordUserSessions:_e=!0,sessionRecorder:ve}={})=>{try{if(pe){let z=registry.registered();if(z!==null)return ue.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),z}if(diag$1.setLogger(new DiagConsoleLogger,{logLevel:se}),typeof window>`u`)return ue.warn(`browser not detected, skipping initialization`),!1;let be=new OTelPerformanceManager,xe=be.getNowMillis(),Se=validateAppID(z),Ce=validateAppVersion(G),we=Se!==void 0;if(!we&&!Y.length&&!J.length)throw Error(`when appID is omitted, at least one logExporter or spanExporter must be set`);if(he.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(we&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let Te=!pe&&z,Ee=Te?new NamespacedStorage(z,window.localStorage):window.localStorage,De=Te?new NamespacedStorage(z,window.sessionStorage):window.sessionStorage,Oe=K.merge(getWebSDKResource({diagLogger:ue,appVersion:Ce,pageSessionStorage:De})),ke=setupUser({registerGlobally:pe,sdkLocalStorage:Ee}),Ae=ke.getMXLUserId();if(we&&!Ae)throw Error(`userID is required when using MXL exporter`);let je=de==null?new MXLDynamicConfigManager({appID:Se,appVersion:Ce,mxlConfigURL:le,defaultConfig:fe,deviceId:Ae,storage:Ee}):de;je.refreshRemoteConfig();let Me=new MXLSDKFeaturesManager({dynamicConfigManager:je,deviceId:Ae,blockNetworkSpanForwarding:me});if(!Me.isSDKEnabled())return ue.debug(`SDK is disabled, skipping initialization.`),!1;let Ne=nsfConfigValidation({featureManager:Me,diag:ue,registerGlobally:pe,defaultInstrumentationConfig:Q,propagator:Z}),Pe=new MXLLimitManager(DEFAULT_LIMITS),Fe=[...ae?getDefaultAttributeScrubbers(oe):[],...ie],Ie=setupSession({limitManager:Pe,registerGlobally:pe,sdkLocalStorage:Ee,sdkSessionStorage:De}),Le,Re;if(we){var ye;Le=new MXLSessionBatchedSpanProcessor({resource:Oe,exporter:new MXLTraceExporter({appID:Se,mxlDataURL:ce,userID:Ae}),limitManager:Pe,storedSpansExpireTimeoutMS:Q==null||(ye=Q[`session-visibility`])==null?void 0:ye.storedSpansExpireTimeoutMS,storage:Ee,spanSessionManager:Ie}),Re=new BatchLogRecordProcessor(new MXLLogExporter({appID:Se,mxlDataURL:ce,userID:Ae}))}let ze=setupPage({useDocumentTitleAsPageLabel:ge,registerGlobally:pe}),{tracerProvider:Be,mxlTraceManager:Ve}=setupTraces({resource:Oe,spanSessionManager:Ie,userManager:ke,spanExporters:J,spanProcessors:X,propagator:Ne?new MXLW3CTraceContextPropagator:Z,contextManager:te,attributeScrubbers:Fe,registerGlobally:pe,mxlSpanProcessor:Le,pageManager:ze});Ie.setTracerProvider(Be);let{loggerProvider:He,mxlLogManager:Ue}=setupLogs({resource:Oe,userManager:ke,logExporters:Y,logProcessors:ne,spanSessionManager:Ie,limitManager:Pe,attributeScrubbers:Fe,registerGlobally:pe,mxlLogProcessor:Re,sdkLocalStorage:Ee,pageManager:ze});registerInstrumentations(pe?{instrumentations:[setupDefaultInstrumentations(Q,{featureManager:Me,mxlSpanProcessor:Le,pageManager:ze}),...ee]}:{tracerProvider:Be,loggerProvider:He,instrumentations:[setupDefaultInstrumentations(Q,{featureManager:Me,logManager:Ue,spanSessionManager:Ie,mxlSpanProcessor:Le,pageManager:ze}),...ee]});let We=typeof window<`u`&&window.__MXL_DISABLE_SESSION_RECORDER===!0,Ge=we&&Se&&Ae&&!We?createSessionRecordingControl({resource:Oe,spanSessionManager:Ie,tracerProvider:Be,appID:Se,userID:Ae,mxlDataURL:ce,recordUserSessions:_e,sessionRecorder:ve}):noopSessionRecording;ue.info(`successfully initialized the SDK`);let Ke={setDynamicConfig:z=>{je.setConfig(z)},flush:function(){var z=_asyncToGenerator(function*(){yield Be.forceFlush(),yield He.forceFlush()});return function(){return z.apply(this,arguments)}}(),log:Ue,trace:Ve,session:Ie,user:ke,page:ze,sessionRecording:Ge};return pe&&registry.register(Ke),Ie.recordSDKStartupDuration(be.getNowMillis()-xe),Ke}catch(z){let G=z instanceof Error?z.message:`Unknown error.`;return ue.error(`failed to initialize the SDK: ${G}`),!1}},setupUser=({registerGlobally:z,sdkLocalStorage:G})=>{let K=new MXLUserManager({storage:G});return z&&user.setGlobalUserManager(K),K},setupSession=({limitManager:z,registerGlobally:G,sdkLocalStorage:K,sdkSessionStorage:J})=>{let Y=new MXLSpanSessionManager({limitManager:z,storage:K,sessionStorage:J});return G&&session.setGlobalSessionManager(Y),Y},setupTraces=({resource:z,spanSessionManager:G,userManager:K,spanExporters:J,spanProcessors:Y=[],propagator:X=null,contextManager:Z=null,attributeScrubbers:Q,registerGlobally:ee,mxlSpanProcessor:te,pageManager:ne})=>{let ie=[...Y,createSessionSpanProcessor(G),new BrowserSpanProcessor,new MXLNetworkSpanProcessor,new UserSpanProcessor({userManager:K}),new PageSpanProcessor({pageManager:ne}),new SpanScrubProcessor({attributeScrubbers:Q})];J==null||J.forEach(z=>{ie.push(new BatchSpanProcessor(z))}),te&&ie.push(te);let ae=new WebTracerProvider({resource:z,spanProcessors:ie,spanLimits:{attributeCountLimit:DEFAULT_LIMITS.maxAllowed.session_property*2,attributePerEventCountLimit:20,eventCountLimit:DEFAULT_LIMITS.maxAllowed.breadcrumb*2,attributeValueLengthLimit:1024}}),oe=new MXLTraceManager({tracerProvider:ee?void 0:ae});return ee&&(trace.setGlobalTraceManager(oe),ae.register({contextManager:Z||new StackContextManager,propagator:X})),{tracerProvider:ae,mxlTraceManager:oe}},setupLogs=({resource:z,userManager:G,logExporters:K,logProcessors:J,spanSessionManager:Y,limitManager:X,attributeScrubbers:Z,registerGlobally:Q,mxlLogProcessor:ee,sdkLocalStorage:te,pageManager:ne})=>{let ie=[...J,new IdentifiableSessionLogRecordProcessor({spanSessionManager:Y}),new BrowserLogRecordProcessor,new MXLLogRecordProcessor,new UserLogRecordProcessor({userManager:G}),new LogRecordScrubProcessor({attributeScrubbers:Z}),new PageLogRecordProcessor({pageManager:ne})];K==null||K.forEach(z=>{ie.push(new BatchLogRecordProcessor(z))}),ee&&ie.push(ee);let ae=new LoggerProvider({resource:z,processors:ie}),oe=new MXLLogManager({spanSessionManager:Y,limitManager:X,loggerProvider:Q?void 0:ae,storage:te});return Q&&(logs.setGlobalLoggerProvider(ae),log.setGlobalLogManager(oe)),{loggerProvider:ae,mxlLogManager:oe}},setupPage=({useDocumentTitleAsPageLabel:z,registerGlobally:G})=>{let K=new MXLPageManager({useDocumentTitleAsPageLabel:z});return G&&page.setGlobalPageManager(K),K};return Object.defineProperty(exports,`DiagLogLevel`,{enumerable:!0,get:function(){return DiagLogLevel}}),exports.getNavigationInstrumentation=getNavigationInstrumentation,exports.initSDK=initSDK,exports.log=log,exports.page=page,exports.session=session,exports.trace=trace,exports.user=user,exports})({});
2
39
  //# sourceMappingURL=mxl-web-sdk.js.map