@blueking/open-telemetry 0.0.34 → 0.0.35-beta.1

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 (54) hide show
  1. package/README.md +67 -57
  2. package/dist/bk-rum.global.js +2 -2
  3. package/dist/bk-rum.global.js.map +1 -1
  4. package/dist/core/action-activity.d.ts +5 -1
  5. package/dist/core/action-target.d.ts +19 -0
  6. package/dist/core/config.d.ts +15 -5
  7. package/dist/core/event-time.d.ts +7 -0
  8. package/dist/core/performance-timing.d.ts +13 -0
  9. package/dist/core/plugin.d.ts +37 -2
  10. package/dist/core/processor.d.ts +24 -2
  11. package/dist/core/request-timing.d.ts +3 -2
  12. package/dist/core/runtime-context.d.ts +62 -2
  13. package/dist/core/sdk.d.ts +23 -1
  14. package/dist/core/session-transition.d.ts +19 -0
  15. package/dist/core/trace-context.d.ts +6 -7
  16. package/dist/core/view-location.d.ts +10 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +2933 -1505
  19. package/dist/index.js.map +1 -1
  20. package/dist/integrations/vue-router.d.ts +25 -0
  21. package/dist/plugins/action.d.ts +1 -1
  22. package/dist/plugins/blank-screen-detection.d.ts +11 -0
  23. package/dist/plugins/blank-screen.d.ts +10 -18
  24. package/dist/plugins/common.d.ts +4 -2
  25. package/dist/plugins/document-vitals.d.ts +25 -0
  26. package/dist/plugins/page-view.d.ts +1 -1
  27. package/dist/plugins/resource.d.ts +3 -1
  28. package/dist/plugins/session-state.d.ts +14 -2
  29. package/dist/plugins/session-store.d.ts +12 -0
  30. package/dist/plugins/session.d.ts +1 -0
  31. package/dist/plugins/web-vitals-metrics.d.ts +80 -0
  32. package/dist/plugins/web-vitals.d.ts +2 -59
  33. package/dist/schema/attributes.d.ts +45 -0
  34. package/dist/schema/span.d.ts +5 -2
  35. package/package.json +9 -4
  36. package/skills/bk-rum-otele/references/actions.md +54 -37
  37. package/skills/bk-rum-otele/references/api.md +72 -51
  38. package/skills/bk-rum-otele/references/architecture.md +16 -16
  39. package/skills/bk-rum-otele/references/blank-screen.md +72 -142
  40. package/skills/bk-rum-otele/references/capabilities.md +66 -60
  41. package/skills/bk-rum-otele/references/configuration.md +101 -98
  42. package/skills/bk-rum-otele/references/data-model.md +22 -17
  43. package/skills/bk-rum-otele/references/errors-security.md +13 -13
  44. package/skills/bk-rum-otele/references/extensions.md +5 -3
  45. package/skills/bk-rum-otele/references/framework-integration.md +7 -24
  46. package/skills/bk-rum-otele/references/network.md +62 -49
  47. package/skills/bk-rum-otele/references/performance.md +62 -30
  48. package/skills/bk-rum-otele/references/privacy.md +5 -5
  49. package/skills/bk-rum-otele/references/production.md +9 -13
  50. package/skills/bk-rum-otele/references/session-context.md +67 -38
  51. package/skills/bk-rum-otele/references/span-protocol.md +692 -421
  52. package/skills/bk-rum-otele/references/telemetry-reference.md +288 -213
  53. package/skills/bk-rum-otele/references/troubleshooting.md +2 -2
  54. package/skills/bk-rum-otele/references/views-routing.md +103 -27
@@ -1,2 +1,2 @@
1
- var BkOpenTelemetry=(function(){var e=Object.defineProperty,t=(e,t)=>()=>(e&&(t=e(e=0)),t),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},r=`1.9.1`,i=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function a(e){let t=new Set([e]),n=new Set,r=e.match(i);if(!r)return()=>!1;let a={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[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;let r=e.match(i);if(!r)return o(e);let c={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[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 o=a(r),s=r.split(`.`)[0],c=Symbol.for(`opentelemetry.js.api.${s}`),l=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function u(e,t,n,i=!1){var a;let o=l[c]=(a=l[c])==null?{version:r}:a;if(!i&&o[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(o.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${r}`);return n.error(t.stack||t.message),!1}return o[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${r}.`),!0}function d(e){var t,n;let r=(t=l[c])==null?void 0:t.version;if(!(!r||!o(r)))return(n=l[c])==null?void 0:n[e]}function f(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${r}.`);let n=l[c];n&&delete n[e]}var p=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return m(`debug`,this._namespace,e)}error(...e){return m(`error`,this._namespace,e)}info(...e){return m(`info`,this._namespace,e)}warn(...e){return m(`warn`,this._namespace,e)}verbose(...e){return m(`verbose`,this._namespace,e)}};function m(e,t,n){let r=d(`diag`);if(r)return r[e](t,...n)}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 g(e,t){e<h.NONE?e=h.NONE:e>h.ALL&&(e=h.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,h.ERROR),warn:n(`warn`,h.WARN),info:n(`info`,h.INFO),debug:n(`debug`,h.DEBUG),verbose:n(`verbose`,h.VERBOSE)}}var _=`diag`,v=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=d(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:h.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=d(`diag`),s=g((i=n.logLevel)==null?h.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return u(`diag`,s,t,!0)},t.disable=()=>{f(_,t)},t.createComponentLogger=e=>new p(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}},y=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}},b=Symbol(`BaggageEntryMetadata`),x=v.instance();function S(e={}){return new y(new Map(Object.entries(e)))}function C(e){return typeof e!=`string`&&(x.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:b,toString(){return e}}}function w(e){return Symbol.for(e)}var T=new class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},E=class{constructor(){}createGauge(e,t){return ae}createHistogram(e,t){return oe}createCounter(e,t){return ie}createUpDownCounter(e,t){return se}createObservableGauge(e,t){return le}createObservableCounter(e,t){return ce}createObservableUpDownCounter(e,t){return ue}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},D=class{},ee=class extends D{add(e,t){}},O=class extends D{add(e,t){}},k=class extends D{record(e,t){}},A=class extends D{record(e,t){}},te=class{addCallback(e){}removeCallback(e){}},j=class extends te{},ne=class extends te{},re=class extends te{},M=new E,ie=new ee,ae=new k,oe=new A,se=new O,ce=new j,le=new ne,ue=new re;function de(){return M}var fe={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},pe={set(e,t,n){e!=null&&(e[t]=n)}},me=class{active(){return T}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}},he=`context`,ge=new me,_e=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return u(he,e,v.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return d(he)||ge}disable(){this._getContextManager().disable(),f(he,v.instance())}},N;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(N||(N={}));var ve={traceId:`00000000000000000000000000000000`,spanId:`0000000000000000`,traceFlags:N.NONE},ye=class{constructor(e=ve){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}},be=w(`OpenTelemetry Context Key SPAN`);function xe(e){return e.getValue(be)||void 0}function Se(){return xe(_e.getInstance().active())}function Ce(e,t){return e.setValue(be,t)}function we(e){return e.deleteValue(be)}function Te(e,t){return Ce(e,new ye(t))}function Ee(e){var t;return(t=xe(e))==null?void 0:t.spanContext()}var De=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 Oe(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(De[e.charCodeAt(t)]|0)+(De[e.charCodeAt(t+1)]|0)+(De[e.charCodeAt(t+2)]|0)+(De[e.charCodeAt(t+3)]|0);return n===t}function ke(e){return Oe(e,32)&&e!==`00000000000000000000000000000000`}function Ae(e){return Oe(e,16)&&e!==`0000000000000000`}function je(e){return ke(e.traceId)&&Ae(e.spanId)}function Me(e){return new ye(e)}var Ne=_e.getInstance(),Pe=class{startSpan(e,t,n=Ne.active()){if(t!=null&&t.root)return new ye;let r=n&&Ee(n);return Fe(r)&&je(r)?new ye(r):new ye}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a==null?Ne.active():a,c=this.startSpan(e,i,s),l=Ce(s,c);return Ne.with(l,o,void 0,c)}};function Fe(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Ie=new Pe,Le=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ie}},Re=new class{getTracer(e,t,n){return new Pe}},ze=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new Le(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?Re:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}},Be;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Be||(Be={}));var Ve;(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`})(Ve||(Ve={}));var He;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(He||(He={}));var Ue=_e.getInstance(),P=v.instance(),We=class{inject(e,t){}extract(e,t){return e}fields(){return[]}},Ge=w(`OpenTelemetry Baggage Key`);function Ke(e){return e.getValue(Ge)||void 0}function qe(){return Ke(_e.getInstance().active())}function Je(e,t){return e.setValue(Ge,t)}function Ye(e){return e.deleteValue(Ge)}var Xe=`propagation`,Ze=new We,Qe=class e{constructor(){this.createBaggage=S,this.getBaggage=Ke,this.getActiveBaggage=qe,this.setBaggage=Je,this.deleteBaggage=Ye}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return u(Xe,e,v.instance())}inject(e,t,n=pe){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=fe){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){f(Xe,v.instance())}_getGlobalPropagator(){return d(Xe)||Ze}}.getInstance(),$e=`trace`,et=class e{constructor(){this._proxyTracerProvider=new ze,this.wrapSpanContext=Me,this.isSpanContextValid=je,this.deleteSpan=we,this.getSpan=xe,this.getActiveSpan=Se,this.getSpanContext=Ee,this.setSpan=Ce,this.setSpanContext=Te}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=u($e,this._proxyTracerProvider,v.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return d($e)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){f($e,v.instance()),this._proxyTracerProvider=new ze}}.getInstance();function tt(e){return typeof e==`object`&&!!e&&`addEventListener`in e&&typeof e.addEventListener==`function`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`}function nt(e){"@babel/helpers - typeof";return nt=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},nt(e)}var rt=t((()=>{}));function it(e,t){if(nt(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(nt(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var at=t((()=>{rt()}));function ot(e){var t=it(e,`string`);return nt(t)==`symbol`?t:t+``}var st=t((()=>{rt(),at()}));function F(e,t,n){return(t=ot(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I=t((()=>{st()}));I();var ct=`OT_ZONE_CONTEXT`,lt=class{constructor(){F(this,`_enabled`,!1)}_bindFunction(e,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}_bindListener(e,t){let n=t;return n.__ot_listeners===void 0?(n.__ot_listeners={},typeof n.addEventListener==`function`&&(n.addEventListener=this._patchAddEventListener(n,n.addEventListener,e)),typeof n.removeEventListener==`function`&&(n.removeEventListener=this._patchRemoveEventListener(n,n.removeEventListener)),t):t}_createZone(e,t){return Zone.current.fork({name:e,properties:{[ct]:t},onCancelTask(e,t,n,r){return r.state===`notScheduled`||r.state===`running`?r:e.cancelTask(n,r)}})}_patchAddEventListener(e,t,n){let r=this;return function(i,a,o){e.__ot_listeners===void 0&&(e.__ot_listeners={});let s=e.__ot_listeners[i];s===void 0&&(s=new WeakMap,e.__ot_listeners[i]=s);let c=r.bind(n,a);return s.set(a,c),t.call(this,i,c,o)}}_patchRemoveEventListener(e,t){return function(n,r){if(e.__ot_listeners===void 0||e.__ot_listeners[n]===void 0)return t.call(this,n,r);let i=e.__ot_listeners[n],a=i.get(r);return i.delete(r),t.call(this,n,a||r)}}active(){return!this._enabled||!Zone.current?T:Zone.current.get(ct)||T}bind(e,t){return typeof t==`function`?this._bindFunction(e,t):(tt(t)&&this._bindListener(e,t),t)}disable(){return this._enabled=!1,this}enable(){return this._enabled=!0,this}with(e,t,n,...r){let i=`otel:with`;return t.name&&(i+=`:${t.name}`),this._createZone(i,e).run(t,n,r)}},ut=Object.defineProperty,dt=Object.defineProperties,ft=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable,gt=(e,t,n)=>t in e?ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_t=(e,t)=>{for(var n in t||(t={}))mt.call(t,n)&&gt(e,n,t[n]);if(pt)for(var n of pt(t))ht.call(t,n)&&gt(e,n,t[n]);return e},vt=(e,t)=>dt(e,ft(t)),L=(e,t,n)=>(gt(e,typeof t==`symbol`?t:t+``,n),n),R=globalThis;function z(e){return(R.__Zone_symbol_prefix||`__zone_symbol__`)+e}function yt(){let e=R.performance;function t(t){e&&e.mark&&e.mark(t)}function n(t,n){e&&e.measure&&e.measure(t,n)}t(`Zone`);let r=class e{constructor(e,t){L(this,`_parent`),L(this,`_name`),L(this,`_properties`),L(this,`_zoneDelegate`),this._parent=e,this._name=t?t.name||`unnamed`:`<root>`,this._properties=t&&t.properties||{},this._zoneDelegate=new o(this,this._parent&&this._parent._zoneDelegate,t)}static assertZonePatched(){if(R.Promise!==ee.ZoneAwarePromise)throw Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let t=e.current;for(;t.parent;)t=t.parent;return t}static get current(){return k.zone}static get currentTask(){return A}static __load_patch(r,i,a=!1){if(ee.hasOwnProperty(r)){let e=R[z(`forceDuplicateZoneCheck`)]===!0;if(!a&&e)throw Error(`Already loaded patch: `+r)}else if(!R[`__Zone_disable_`+r]){let a=`Zone:`+r;t(a),ee[r]=i(R,e,O),n(a,a)}}get parent(){return this._parent}get name(){return this._name}get(e){let t=this.getZoneWith(e);if(t)return t._properties[e]}getZoneWith(e){let t=this;for(;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null}fork(e){if(!e)throw Error(`ZoneSpec required!`);return this._zoneDelegate.fork(this,e)}wrap(e,t){if(typeof e!=`function`)throw Error(`Expecting function got: `+e);let n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}}run(e,t,n,r){k={parent:k,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{k=k.parent}}runGuarded(e,t=null,n,r){k={parent:k,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{k=k.parent}}runTask(e,t,n){if(e.zone!=this)throw Error(`A task can only be run in the zone of creation! (Creation: `+(e.zone||v).name+`; Execution: `+this.name+`)`);let r=e,{type:i,data:{isPeriodic:a=!1,isRefreshable:o=!1}={}}=e;if(e.state===y&&(i===D||i===E))return;let s=e.state!=S;s&&r._transitionTo(S,x);let c=A;A=r,k={parent:k,zone:this};try{i==E&&e.data&&!a&&!o&&(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,r,t,n)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{let t=e.state;if(t!==y&&t!==w)if(i==D||a||o&&t===b)s&&r._transitionTo(x,S,b);else{let e=r._zoneDelegates;this._updateTaskCount(r,-1),s&&r._transitionTo(y,S,y),o&&(r._zoneDelegates=e)}k=k.parent,A=c}}scheduleTask(e){if(e.zone&&e.zone!==this){let t=this;for(;t;){if(t===e.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${e.zone.name}`);t=t.parent}}e._transitionTo(b,y);let t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(w,b,y),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==b&&e._transitionTo(x,b),e}scheduleMicroTask(e,t,n,r){return this.scheduleTask(new s(T,e,t,n,r,void 0))}scheduleMacroTask(e,t,n,r,i){return this.scheduleTask(new s(E,e,t,n,r,i))}scheduleEventTask(e,t,n,r,i){return this.scheduleTask(new s(D,e,t,n,r,i))}cancelTask(e){if(e.zone!=this)throw Error(`A task can only be cancelled in the zone of creation! (Creation: `+(e.zone||v).name+`; Execution: `+this.name+`)`);if(!(e.state!==x&&e.state!==S)){e._transitionTo(C,x,S);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(w,C),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,C),e.runCount=-1,e}}_updateTaskCount(e,t){let n=e._zoneDelegates;t==-1&&(e._zoneDelegates=null);for(let r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)}};L(r,`__symbol__`,z);let i=r,a={name:``,onHasTask:(e,t,n,r)=>e.hasTask(n,r),onScheduleTask:(e,t,n,r)=>e.scheduleTask(n,r),onInvokeTask:(e,t,n,r,i,a)=>e.invokeTask(n,r,i,a),onCancelTask:(e,t,n,r)=>e.cancelTask(n,r)};class o{constructor(e,t,n){L(this,`_zone`),L(this,`_taskCounts`,{microTask:0,macroTask:0,eventTask:0}),L(this,`_forkDlgt`),L(this,`_forkZS`),L(this,`_forkCurrZone`),L(this,`_interceptDlgt`),L(this,`_interceptZS`),L(this,`_interceptCurrZone`),L(this,`_invokeDlgt`),L(this,`_invokeZS`),L(this,`_invokeCurrZone`),L(this,`_handleErrorDlgt`),L(this,`_handleErrorZS`),L(this,`_handleErrorCurrZone`),L(this,`_scheduleTaskDlgt`),L(this,`_scheduleTaskZS`),L(this,`_scheduleTaskCurrZone`),L(this,`_invokeTaskDlgt`),L(this,`_invokeTaskZS`),L(this,`_invokeTaskCurrZone`),L(this,`_cancelTaskDlgt`),L(this,`_cancelTaskZS`),L(this,`_cancelTaskCurrZone`),L(this,`_hasTaskDlgt`),L(this,`_hasTaskDlgtOwner`),L(this,`_hasTaskZS`),L(this,`_hasTaskCurrZone`),this._zone=e,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this._zone:t._forkCurrZone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this._zone:t._interceptCurrZone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this._zone:t._invokeCurrZone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this._zone:t._handleErrorCurrZone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this._zone:t._scheduleTaskCurrZone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this._zone:t._invokeTaskCurrZone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this._zone:t._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;let r=n&&n.onHasTask,i=t&&t._hasTaskZS;(r||i)&&(this._hasTaskZS=r?n:a,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,n.onScheduleTask||(this._scheduleTaskZS=a,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this._zone),n.onInvokeTask||(this._invokeTaskZS=a,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this._zone),n.onCancelTask||(this._cancelTaskZS=a,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this._zone))}get zone(){return this._zone}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new i(e,t)}intercept(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t}invoke(e,t,n,r,i){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,i):t.apply(n,r)}handleError(e,t){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t):!0}scheduleTask(e,t){let n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t),n||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else if(t.type==T)g(t);else throw Error(`Task is missing scheduleFn.`);return n}invokeTask(e,t,n,r){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,r):t.callback.apply(n,r)}cancelTask(e,t){let n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error(`Task is not cancelable`);n=t.cancelFn(t)}return n}hasTask(e,t){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(t){this.handleError(e,t)}}_updateTaskCount(e,t){let n=this._taskCounts,r=n[e],i=n[e]=r+t;if(i<0)throw Error(`More tasks executed then were scheduled.`);if(r==0||i==0){let t={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this._zone,t)}}}class s{constructor(e,t,n,r,i,a){if(L(this,`type`),L(this,`source`),L(this,`invoke`),L(this,`callback`),L(this,`data`),L(this,`scheduleFn`),L(this,`cancelFn`),L(this,`_zone`,null),L(this,`runCount`,0),L(this,`_zoneDelegates`,null),L(this,`_state`,`notScheduled`),this.type=e,this.source=t,this.data=r,this.scheduleFn=i,this.cancelFn=a,!n)throw Error(`callback is not defined`);this.callback=n;let o=this;e===D&&r&&r.useG?this.invoke=s.invokeTask:this.invoke=function(){return s.invokeTask.call(R,o,this,arguments)}}static invokeTask(e,t,n){e||(e=this),te++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{te===1&&!R[d]&&_(),te--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(y,b)}_transitionTo(e,t,n){if(this._state===t||this._state===n)this._state=e,e==y&&(this._zoneDelegates=null);else throw Error(`${this.type} '${this.source}': can not transition to '${e}', expecting state '${t}'${n?` or '`+n+`'`:``}, was '${this._state}'.`)}toString(){return this.data&&this.data.handleId!==void 0?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}let c=z(`setTimeout`),l=z(`Promise`),u=z(`then`),d=z(`enable_native_microtask_draining`),f=[],p=!1,m;function h(e){var t;!m&&R[l]&&(m=R[l].resolve(0)),m?((t=m[u])==null?m.then:t).call(m,e):R[c](e,0)}function g(e){let t=R[d],n=t&&f.length===0&&!p,r=!t&&te===0&&f.length===0;(n||r)&&h(_),e&&f.push(e)}function _(){if(!p){for(p=!0;f.length;){let e=f;f=[];for(let t of e)try{t.zone.runTask(t,null,null)}catch(e){O.onUnhandledError(e)}}R[d]?(p=!1,O.microtaskDrainDone()):(O.microtaskDrainDone(),p=!1)}}let v={name:`NO ZONE`},y=`notScheduled`,b=`scheduling`,x=`scheduled`,S=`running`,C=`canceling`,w=`unknown`,T=`microTask`,E=`macroTask`,D=`eventTask`,ee={},O={symbol:z,currentZoneFrame:()=>k,onUnhandledError:j,microtaskDrainDone:j,scheduleMicroTask:g,showUncaughtError:()=>!i[z(`ignoreConsoleErrorUncaughtError`)],patchEventTarget:()=>[],patchOnProperties:j,patchMethod:()=>j,bindArguments:()=>[],patchThen:()=>j,patchMacroTask:()=>j,patchEventPrototype:()=>j,getGlobalObjects:()=>void 0,ObjectDefineProperty:()=>j,ObjectGetOwnPropertyDescriptor:()=>void 0,ObjectCreate:()=>void 0,ArraySlice:()=>[],patchClass:()=>j,wrapWithCurrentZone:()=>j,filterProperties:()=>[],attachOriginToPatched:()=>j,_redefineProperty:()=>j,patchCallbacks:()=>j,nativeScheduleMicroTask:h},k={parent:null,zone:new i(null,null)},A=null,te=0;function j(){}return n(`Zone`,`Zone`),i}function bt(){let e=globalThis,t=e[z(`forceDuplicateZoneCheck`)]===!0;if(e.Zone&&(t||typeof e.Zone.__symbol__!=`function`))throw Error(`Zone already loaded.`);return e.Zone!=null||(e.Zone=yt()),e.Zone}var xt=Object.getOwnPropertyDescriptor,St=Object.defineProperty,Ct=Object.getPrototypeOf,wt=Object.create,Tt=Array.prototype.slice,Et=`addEventListener`,Dt=`removeEventListener`,Ot=z(Et),kt=z(Dt),At=`true`,jt=`false`,Mt=z(``);function Nt(e,t){return Zone.current.wrap(e,t)}function Pt(e,t,n,r,i){return Zone.current.scheduleMacroTask(e,t,n,r,i)}var B=z,Ft=typeof window<`u`,It=Ft?window:void 0,V=Ft&&It||globalThis,Lt=`removeAttribute`;function Rt(e,t){for(let n=e.length-1;n>=0;n--)typeof e[n]==`function`&&(e[n]=Nt(e[n],t+`_`+n));return e}function zt(e,t){let n=e.constructor.name;for(let r=0;r<t.length;r++){let i=t[r],a=e[i];if(a){if(!Bt(xt(e,i)))continue;e[i]=(e=>{let t=function(){return e.apply(this,Rt(arguments,n+`.`+i))};return nn(t,e),t})(a)}}}function Bt(e){return e?e.writable===!1?!1:!(typeof e.get==`function`&&e.set===void 0):!0}var Vt=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,Ht=!(`nw`in V)&&V.process!==void 0&&V.process.toString()===`[object process]`,Ut=!Ht&&!Vt&&!!(Ft&&It.HTMLElement),Wt=V.process!==void 0&&V.process.toString()===`[object process]`&&!Vt&&!!(Ft&&It.HTMLElement),Gt={},Kt=B(`enable_beforeunload`),qt=function(e){if(e=e||V.event,!e)return;let t=Gt[e.type];t||(t=Gt[e.type]=B(`ON_PROPERTY`+e.type));let n=this||e.target||V,r=n[t],i;if(Ut&&n===It&&e.type===`error`){let t=e;i=r&&r.call(this,t.message,t.filename,t.lineno,t.colno,t.error),i===!0&&e.preventDefault()}else i=r&&r.apply(this,arguments),e.type===`beforeunload`&&V[Kt]&&typeof i==`string`?e.returnValue=i:i!=null&&!i&&e.preventDefault();return i};function Jt(e,t,n){let r=xt(e,t);if(!r&&n&&xt(n,t)&&(r={enumerable:!0,configurable:!0}),!r||!r.configurable)return;let i=B(`on`+t+`patched`);if(e.hasOwnProperty(i)&&e[i])return;delete r.writable,delete r.value;let a=r.get,o=r.set,s=t.slice(2),c=Gt[s];c||(c=Gt[s]=B(`ON_PROPERTY`+s)),r.set=function(t){let n=this;!n&&e===V&&(n=V),n&&(typeof n[c]==`function`&&n.removeEventListener(s,qt),o==null||o.call(n,null),n[c]=t,typeof t==`function`&&n.addEventListener(s,qt,!1))},r.get=function(){let n=this;if(!n&&e===V&&(n=V),!n)return null;let i=n[c];if(i)return i;if(a){let e=a.call(this);if(e)return r.set.call(this,e),typeof n[Lt]==`function`&&n.removeAttribute(t),e}return null},St(e,t,r),e[i]=!0}function Yt(e,t,n){if(t)for(let r=0;r<t.length;r++)Jt(e,`on`+t[r],n);else{let t=[];for(let n in e)n.slice(0,2)==`on`&&t.push(n);for(let r=0;r<t.length;r++)Jt(e,t[r],n)}}var Xt=B(`originalInstance`);function Zt(e){let t=V[e];if(!t)return;V[B(e)]=t,V[e]=function(){let n=Rt(arguments,e);switch(n.length){case 0:this[Xt]=new t;break;case 1:this[Xt]=new t(n[0]);break;case 2:this[Xt]=new t(n[0],n[1]);break;case 3:this[Xt]=new t(n[0],n[1],n[2]);break;case 4:this[Xt]=new t(n[0],n[1],n[2],n[3]);break;default:throw Error(`Arg list too long.`)}},nn(V[e],t);let n=new t(function(){}),r;for(r in n)e===`XMLHttpRequest`&&r===`responseBlob`||(function(t){typeof n[t]==`function`?V[e].prototype[t]=function(){return this[Xt][t].apply(this[Xt],arguments)}:St(V[e].prototype,t,{set:function(n){typeof n==`function`?(this[Xt][t]=Nt(n,e+`.`+t),nn(this[Xt][t],n)):this[Xt][t]=n},get:function(){return this[Xt][t]}})})(r);for(r in t)r!==`prototype`&&t.hasOwnProperty(r)&&(V[e][r]=t[r])}function Qt(e,t){typeof Object.getOwnPropertySymbols==`function`&&Object.getOwnPropertySymbols(e).forEach(n=>{let r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){r&&(!r.writable||typeof r.set!=`function`)||(e[n]=t)},enumerable:r?r.enumerable:!0,configurable:r?r.configurable:!0})})}var $t=!1;function en(e,t,n){let r=e;for(;r&&!r.hasOwnProperty(t);)r=Ct(r);!r&&e[t]&&(r=e);let i=B(t),a=null;if(r&&(!(a=r[i])||!r.hasOwnProperty(i))&&(a=r[i]=r[t],Bt(r&&xt(r,t)))){let e=n(a,i,t);r[t]=function(){return e(this,arguments)},nn(r[t],a),$t&&Qt(a,r[t])}return a}function tn(e,t,n){let r=null;function i(e){let t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},r.apply(t.target,t.args),e}r=en(e,t,e=>function(t,r){let a=n(t,r);return a.cbIdx>=0&&typeof r[a.cbIdx]==`function`?Pt(a.name,r[a.cbIdx],a,i):e.apply(t,r)})}function nn(e,t){e[B(`OriginalDelegate`)]=t}function rn(e){return typeof e==`function`}function an(e){return typeof e==`number`}var on={useG:!0},H={},sn={},cn=RegExp(`^`+Mt+`(\\w+)(true|false)$`),ln=B(`propagationStopped`);function un(e,t){let n=(t?t(e):e)+jt,r=(t?t(e):e)+At,i=Mt+n,a=Mt+r;H[e]={},H[e][jt]=i,H[e][At]=a}function dn(e,t,n,r){let i=r&&r.add||Et,a=r&&r.rm||Dt,o=r&&r.listeners||`eventListeners`,s=r&&r.rmAll||`removeAllListeners`,c=B(i),l=`.`+i+`:`,u=`prependListener`;``+u;let d=function(e,t,n){if(e.isRemoved)return;let r=e.callback;typeof r==`object`&&r.handleEvent&&(e.callback=e=>r.handleEvent(e),e.originalDelegate=r);let i;try{e.invoke(e,t,[n])}catch(e){i=e}let o=e.options;if(o&&typeof o==`object`&&o.once){let r=e.originalDelegate?e.originalDelegate:e.callback;t[a].call(t,n.type,r,o)}return i};function f(n,r,i){if(r=r||e.event,!r)return;let a=n||r.target||e,o=a[H[r.type][i?At:jt]];if(o){let e=[];if(o.length===1){let t=d(o[0],a,r);t&&e.push(t)}else{let t=o.slice();for(let n=0;n<t.length&&!(r&&r[ln]===!0);n++){let i=d(t[n],a,r);i&&e.push(i)}}if(e.length===1)throw e[0];for(let n=0;n<e.length;n++){let r=e[n];t.nativeScheduleMicroTask(()=>{throw r})}}}let p=function(e){return f(this,e,!1)},m=function(e){return f(this,e,!0)};function h(t,n){if(!t)return!1;let r=!0;n&&n.useG!==void 0&&(r=n.useG);let d=n&&n.vh,f=!0;n&&n.chkDup!==void 0&&(f=n.chkDup);let h=!1;n&&n.rt!==void 0&&(h=n.rt);let g=t;for(;g&&!g.hasOwnProperty(i);)g=Ct(g);if(!g&&t[i]&&(g=t),!g||g[c])return!1;let _=n&&n.eventNameToString,v={},y=g[c]=g[i],b=g[B(a)]=g[a],x=g[B(o)]=g[o],S=g[B(s)]=g[s],C;n&&n.prepend&&(C=g[B(n.prepend)]=g[n.prepend]);function w(e,t){return t?typeof e==`boolean`?{capture:e,passive:!0}:e?typeof e==`object`&&e.passive!==!1?vt(_t({},e),{passive:!0}):e:{passive:!0}:e}let T=function(e){if(!v.isExisting)return y.call(v.target,v.eventName,v.capture?m:p,v.options)},E=function(e){if(!e.isRemoved){let t=H[e.eventName],n;t&&(n=t[e.capture?At:jt]);let r=n&&e.target[n];if(r){for(let t=0;t<r.length;t++)if(r[t]===e){r.splice(t,1),e.isRemoved=!0,e.removeAbortListener&&(e.removeAbortListener(),e.removeAbortListener=null),r.length===0&&(e.allRemoved=!0,e.target[n]=null);break}}}if(e.allRemoved)return b.call(e.target,e.eventName,e.capture?m:p,e.options)},D=function(e){return y.call(v.target,v.eventName,e.invoke,v.options)},ee=function(e){return C.call(v.target,v.eventName,e.invoke,v.options)},O=function(e){return b.call(e.target,e.eventName,e.invoke,e.options)},k=r?T:D,A=r?E:O,te=(n==null?void 0:n.diff)||function(e,t){let n=typeof t;return n===`function`&&e.callback===t||n===`object`&&e.originalDelegate===t},j=Zone[B(`UNPATCHED_EVENTS`)],ne=e[B(`PASSIVE_EVENTS`)];function re(e){if(typeof e==`object`&&e){let t=_t({},e);return e.signal&&(t.signal=e.signal),t}return e}let M=function(t,i,a,o,s=!1,c=!1){return function(){let l=this||e,u=arguments[0];n&&n.transferEventName&&(u=n.transferEventName(u));let p=arguments[1];if(!p||Ht&&u===`uncaughtException`)return t.apply(this,arguments);let m=!1;if(typeof p!=`function`){if(!p.handleEvent)return t.apply(this,arguments);m=!0}if(d&&!d(t,p,l,arguments))return;let h=!!ne&&ne.indexOf(u)!==-1,g=re(w(arguments[2],h)),y=g==null?void 0:g.signal;if(y!=null&&y.aborted)return;if(j){for(let e=0;e<j.length;e++)if(u===j[e])return h?t.call(l,u,p,g):t.apply(this,arguments)}let b=g?typeof g==`boolean`?!0:g.capture:!1,x=g&&typeof g==`object`?g.once:!1,S=Zone.current,C=H[u];C||(un(u,_),C=H[u]);let T=C[b?At:jt],E=l[T],D=!1;if(E){if(D=!0,f){for(let e=0;e<E.length;e++)if(te(E[e],p))return}}else E=l[T]=[];let ee,O=l.constructor.name,k=sn[O];k&&(ee=k[u]),ee||(ee=O+i+(_?_(u):u)),v.options=g,x&&(v.options.once=!1),v.target=l,v.capture=b,v.eventName=u,v.isExisting=D;let A=r?on:void 0;A&&(A.taskData=v),y&&(v.options.signal=void 0);let M=S.scheduleEventTask(ee,p,A,a,o);if(y){v.options.signal=y;let e=()=>M.zone.cancelTask(M);t.call(y,`abort`,e,{once:!0}),M.removeAbortListener=()=>y.removeEventListener(`abort`,e)}if(v.target=null,A&&(A.taskData=null),x&&(v.options.once=!0),typeof M.options!=`boolean`&&(M.options=g),M.target=l,M.capture=b,M.eventName=u,m&&(M.originalDelegate=p),c?E.unshift(M):E.push(M),s)return l}};return g[i]=M(y,l,k,A,h),C&&(g[u]=M(C,`.prependListener:`,ee,A,h,!0)),g[a]=function(){let t=this||e,r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));let i=arguments[2],a=i?typeof i==`boolean`?!0:i.capture:!1,o=arguments[1];if(!o)return b.apply(this,arguments);if(d&&!d(b,o,t,arguments))return;let s=H[r],c;s&&(c=s[a?At:jt]);let l=c&&t[c];if(l)for(let e=0;e<l.length;e++){let n=l[e];if(te(n,o)){if(l.splice(e,1),n.isRemoved=!0,l.length===0&&(n.allRemoved=!0,t[c]=null,!a&&typeof r==`string`)){let e=Mt+`ON_PROPERTY`+r;t[e]=null}return n.zone.cancelTask(n),h?t:void 0}}return b.apply(this,arguments)},g[o]=function(){let t=this||e,r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));let i=[],a=fn(t,_?_(r):r);for(let e=0;e<a.length;e++){let t=a[e],n=t.originalDelegate?t.originalDelegate:t.callback;i.push(n)}return i},g[s]=function(){let t=this||e,r=arguments[0];if(r){n&&n.transferEventName&&(r=n.transferEventName(r));let e=H[r];if(e){let n=e[jt],i=e[At],o=t[n],s=t[i];if(o){let e=o.slice();for(let t=0;t<e.length;t++){let n=e[t],i=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,i,n.options)}}if(s){let e=s.slice();for(let t=0;t<e.length;t++){let n=e[t],i=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,i,n.options)}}}}else{let e=Object.keys(t);for(let t=0;t<e.length;t++){let n=e[t],r=cn.exec(n),i=r&&r[1];i&&i!==`removeListener`&&this[s].call(this,i)}this[s].call(this,`removeListener`)}if(h)return this},nn(g[i],y),nn(g[a],b),S&&nn(g[s],S),x&&nn(g[o],x),!0}let g=[];for(let e=0;e<n.length;e++)g[e]=h(n[e],r);return g}function fn(e,t){if(!t){let n=[];for(let r in e){let i=cn.exec(r),a=i&&i[1];if(a&&(!t||a===t)){let t=e[r];if(t)for(let e=0;e<t.length;e++)n.push(t[e])}}return n}let n=H[t];n||(un(t),n=H[t]);let r=e[n[jt]],i=e[n[At]];return r?i?r.concat(i):r.slice():i?i.slice():[]}function pn(e,t){let n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,`stopImmediatePropagation`,e=>function(t,n){t[ln]=!0,e&&e.apply(t,n)})}function mn(e,t){t.patchMethod(e,`queueMicrotask`,e=>function(e,t){Zone.current.scheduleMicroTask(`queueMicrotask`,t[0])})}var hn=B(`zoneTask`);function gn(e,t,n,r){let i=null,a=null;t+=r,n+=r;let o={};function s(t){let n=t.data;n.args[0]=function(){return t.invoke.apply(this,arguments)};let r=i.apply(e,n.args);return an(r)?n.handleId=r:(n.handle=r,n.isRefreshable=rn(r.refresh)),t}function c(t){let{handle:n,handleId:r}=t.data;return a.call(e,n==null?r:n)}i=en(e,t,n=>function(i,a){var l;if(rn(a[0])){let e={isRefreshable:!1,isPeriodic:r===`Interval`,delay:r===`Timeout`||r===`Interval`?a[1]||0:void 0,args:a},n=a[0];a[0]=function(){try{return n.apply(this,arguments)}finally{let{handle:t,handleId:n,isPeriodic:r,isRefreshable:i}=e;!r&&!i&&(n?delete o[n]:t&&(t[hn]=null))}};let i=Pt(t,a[0],e,s,c);if(!i)return i;let{handleId:u,handle:d,isRefreshable:f,isPeriodic:p}=i.data;if(u)o[u]=i;else if(d&&(d[hn]=i,f&&!p)){let e=d.refresh;d.refresh=function(){let{zone:t,state:n}=i;return n===`notScheduled`?(i._state=`scheduled`,t._updateTaskCount(i,1)):n===`running`&&(i._state=`scheduling`),e.call(this)}}return(l=d==null?u:d)==null?i:l}else return n.apply(e,a)}),a=en(e,n,t=>function(n,r){let i=r[0],a;an(i)?(a=o[i],delete o[i]):(a=i==null?void 0:i[hn],a?i[hn]=null:a=i),a!=null&&a.type?a.cancelFn&&a.zone.cancelTask(a):t.apply(e,r)})}function _n(e,t){let{isBrowser:n,isMix:r}=t.getGlobalObjects();!n&&!r||!e.customElements||!(`customElements`in e)||t.patchCallbacks(t,e.customElements,`customElements`,`define`,[`connectedCallback`,`disconnectedCallback`,`adoptedCallback`,`attributeChangedCallback`,`formAssociatedCallback`,`formDisabledCallback`,`formResetCallback`,`formStateRestoreCallback`])}function vn(e,t){if(Zone[t.symbol(`patchEventTarget`)])return;let{eventNames:n,zoneSymbolEventNames:r,TRUE_STR:i,FALSE_STR:a,ZONE_SYMBOL_PREFIX:o}=t.getGlobalObjects();for(let e=0;e<n.length;e++){let t=n[e],s=t+a,c=t+i,l=o+s,u=o+c;r[t]={},r[t][a]=l,r[t][i]=u}let s=e.EventTarget;if(!(!s||!s.prototype))return t.patchEventTarget(e,t,[s&&s.prototype]),!0}function yn(e,t){t.patchEventPrototype(e,t)}function bn(e,t,n){if(!n||n.length===0)return t;let r=n.filter(t=>t.target===e);if(r.length===0)return t;let i=r[0].ignoreProperties;return t.filter(e=>i.indexOf(e)===-1)}function xn(e,t,n,r){e&&Yt(e,bn(e,t,n),r)}function Sn(e){return Object.getOwnPropertyNames(e).filter(e=>e.startsWith(`on`)&&e.length>2).map(e=>e.substring(2))}function Cn(e,t){if(Ht&&!Wt||Zone[e.symbol(`patchEvents`)])return;let n=t.__Zone_ignore_on_properties,r=[];if(Ut){let e=window;r=r.concat([`Document`,`SVGElement`,`Element`,`HTMLElement`,`HTMLBodyElement`,`HTMLMediaElement`,`HTMLFrameSetElement`,`HTMLFrameElement`,`HTMLIFrameElement`,`HTMLMarqueeElement`,`Worker`]),xn(e,Sn(e),n,Ct(e))}r=r.concat([`XMLHttpRequest`,`XMLHttpRequestEventTarget`,`IDBIndex`,`IDBRequest`,`IDBOpenDBRequest`,`IDBDatabase`,`IDBTransaction`,`IDBCursor`,`WebSocket`]);for(let e=0;e<r.length;e++){let i=t[r[e]];i!=null&&i.prototype&&xn(i.prototype,Sn(i.prototype),n)}}function wn(e){e.__load_patch(`timers`,e=>{let t=`clear`;gn(e,`set`,t,`Timeout`),gn(e,`set`,t,`Interval`),gn(e,`set`,t,`Immediate`)}),e.__load_patch(`requestAnimationFrame`,e=>{gn(e,`request`,`cancel`,`AnimationFrame`),gn(e,`mozRequest`,`mozCancel`,`AnimationFrame`),gn(e,`webkitRequest`,`webkitCancel`,`AnimationFrame`)}),e.__load_patch(`blocking`,(e,t)=>{let n=[`alert`,`prompt`,`confirm`];for(let r=0;r<n.length;r++){let i=n[r];en(e,i,(n,r,i)=>function(r,a){return t.current.run(n,e,a,i)})}}),e.__load_patch(`EventTarget`,(e,t,n)=>{yn(e,n),vn(e,n);let r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,n,[r.prototype])}),e.__load_patch(`MutationObserver`,(e,t,n)=>{Zt(`MutationObserver`),Zt(`WebKitMutationObserver`)}),e.__load_patch(`IntersectionObserver`,(e,t,n)=>{Zt(`IntersectionObserver`)}),e.__load_patch(`FileReader`,(e,t,n)=>{Zt(`FileReader`)}),e.__load_patch(`on_property`,(e,t,n)=>{Cn(n,e)}),e.__load_patch(`customElements`,(e,t,n)=>{_n(e,n)}),e.__load_patch(`XHR`,(e,t)=>{c(e);let n=B(`xhrTask`),r=B(`xhrSync`),i=B(`xhrListener`),a=B(`xhrScheduled`),o=B(`xhrURL`),s=B(`xhrErrorBeforeScheduled`);function c(e){let c=e.XMLHttpRequest;if(!c)return;let l=c.prototype;function u(e){return e[n]}let d=l[Ot],f=l[kt];if(!d){let t=e.XMLHttpRequestEventTarget;if(t){let e=t.prototype;d=e[Ot],f=e[kt]}}let p=`readystatechange`,m=`scheduled`;function h(e){let r=e.data,o=r.target;o[a]=!1,o[s]=!1;let c=o[i];d||(d=o[Ot],f=o[kt]),c&&f.call(o,p,c);let l=o[i]=()=>{if(o.readyState===o.DONE)if(!r.aborted&&o[a]&&e.state===m){let n=o[t.__symbol__(`loadfalse`)];if(o.status!==0&&n&&n.length>0){let i=e.invoke;e.invoke=function(){let n=o[t.__symbol__(`loadfalse`)];for(let t=0;t<n.length;t++)n[t]===e&&n.splice(t,1);!r.aborted&&e.state===m&&i.call(e)},n.push(e)}else e.invoke()}else !r.aborted&&o[a]===!1&&(o[s]=!0)};return d.call(o,p,l),o[n]||(o[n]=e),x.apply(o,r.args),o[a]=!0,e}function g(){}function _(e){let t=e.data;return t.aborted=!0,S.apply(t.target,t.args)}let v=en(l,`open`,()=>function(e,t){return e[r]=t[2]==0,e[o]=t[1],v.apply(e,t)}),y=B(`fetchTaskAborting`),b=B(`fetchTaskScheduling`),x=en(l,`send`,()=>function(e,n){if(t.current[b]===!0||e[r])return x.apply(e,n);{let t={target:e,url:e[o],isPeriodic:!1,args:n,aborted:!1},r=Pt(`XMLHttpRequest.send`,g,t,h,_);e&&e[s]===!0&&!t.aborted&&r.state===m&&r.invoke()}}),S=en(l,`abort`,()=>function(e,n){let r=u(e);if(r&&typeof r.type==`string`){if(r.cancelFn==null||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}else if(t.current[y]===!0)return S.apply(e,n)})}}),e.__load_patch(`geolocation`,e=>{e.navigator&&e.navigator.geolocation&&zt(e.navigator.geolocation,[`getCurrentPosition`,`watchPosition`])}),e.__load_patch(`PromiseRejectionEvent`,(e,t)=>{function n(t){return function(n){fn(e,t).forEach(r=>{let i=e.PromiseRejectionEvent;if(i){let e=new i(t,{promise:n.promise,reason:n.rejection});r.invoke(e)}})}}e.PromiseRejectionEvent&&(t[B(`unhandledPromiseRejectionHandler`)]=n(`unhandledrejection`),t[B(`rejectionHandledHandler`)]=n(`rejectionhandled`))}),e.__load_patch(`queueMicrotask`,(e,t,n)=>{mn(e,n)})}function Tn(e){e.__load_patch(`ZoneAwarePromise`,(e,t,n)=>{let r=Object.getOwnPropertyDescriptor,i=Object.defineProperty;function a(e){return e&&e.toString===Object.prototype.toString?(e.constructor&&e.constructor.name||``)+`: `+JSON.stringify(e):e?e.toString():Object.prototype.toString.call(e)}let o=n.symbol,s=[],c=e[o(`DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION`)]!==!1,l=o(`Promise`),u=o(`then`);n.onUnhandledError=e=>{if(n.showUncaughtError()){let t=e&&e.rejection;t?console.error(`Unhandled Promise rejection:`,t instanceof Error?t.message:t,`; Zone:`,e.zone.name,`; Task:`,e.task&&e.task.source,`; Value:`,t,t instanceof Error?t.stack:void 0):console.error(e)}},n.microtaskDrainDone=()=>{for(;s.length;){let e=s.shift();try{e.zone.runGuarded(()=>{throw e.throwOriginal?e.rejection:e})}catch(e){f(e)}}};let d=o(`unhandledPromiseRejectionHandler`);function f(e){n.onUnhandledError(e);try{let n=t[d];typeof n==`function`&&n.call(this,e)}catch(e){}}function p(e){return e&&typeof e.then==`function`}function m(e){return e}function h(e){return k.reject(e)}let g=o(`state`),_=o(`value`),v=o(`finally`),y=o(`parentPromiseValue`),b=o(`parentPromiseState`);function x(e,t){return n=>{try{w(e,t,n)}catch(t){w(e,!1,t)}}}let S=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},C=o(`currentTaskTrace`);function w(e,r,o){let l=S();if(e===o)throw TypeError(`Promise resolved with itself`);if(e[g]===null){let u=null;try{(typeof o==`object`||typeof o==`function`)&&(u=o&&o.then)}catch(t){return l(()=>{w(e,!1,t)})(),e}if(r!==!1&&o instanceof k&&o.hasOwnProperty(g)&&o.hasOwnProperty(_)&&o[g]!==null)E(o),w(e,o[g],o[_]);else if(r!==!1&&typeof u==`function`)try{u.call(o,l(x(e,r)),l(x(e,!1)))}catch(t){l(()=>{w(e,!1,t)})()}else{e[g]=r;let l=e[_];if(e[_]=o,e[v]===v&&r===!0&&(e[g]=e[b],e[_]=e[y]),r===!1&&o instanceof Error){let e=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;e&&i(o,C,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t<l.length;)D(e,l[t++],l[t++],l[t++],l[t++]);if(l.length==0&&r==0){e[g]=0;let r=o;try{throw Error(`Uncaught (in promise): `+a(o)+(o&&o.stack?`
2
- `+o.stack:``))}catch(e){r=e}c&&(r.throwOriginal=!0),r.rejection=o,r.promise=e,r.zone=t.current,r.task=t.currentTask,s.push(r),n.scheduleMicroTask()}}}return e}let T=o(`rejectionHandledHandler`);function E(e){if(e[g]===0){try{let n=t[T];n&&typeof n==`function`&&n.call(this,{rejection:e[_],promise:e})}catch(e){}e[g]=!1;for(let t=0;t<s.length;t++)e===s[t].promise&&s.splice(t,1)}}function D(e,t,n,r,i){E(e);let a=e[g],o=a?typeof r==`function`?r:m:typeof i==`function`?i:h;t.scheduleMicroTask(`Promise.then`,()=>{try{let r=e[_],i=!!n&&v===n[v];i&&(n[y]=r,n[b]=a),w(n,!0,t.run(o,void 0,i&&o!==h&&o!==m?[]:[r]))}catch(e){w(n,!1,e)}},n)}let ee=function(){},O=e.AggregateError;class k{static toString(){return`function ZoneAwarePromise() { [native code] }`}static resolve(e){return e instanceof k?e:w(new this(null),!0,e)}static reject(e){return w(new this(null),!1,e)}static withResolvers(){let e={};return e.promise=new k((t,n)=>{e.resolve=t,e.reject=n}),e}static any(e){if(!e||typeof e[Symbol.iterator]!=`function`)return Promise.reject(new O([],`All promises were rejected`));let t=[],n=0;try{for(let r of e)n++,t.push(k.resolve(r))}catch(e){return Promise.reject(new O([],`All promises were rejected`))}if(n===0)return Promise.reject(new O([],`All promises were rejected`));let r=!1,i=[];return new k((e,a)=>{for(let o=0;o<t.length;o++)t[o].then(t=>{r||(r=!0,e(t))},e=>{i.push(e),n--,n===0&&(r=!0,a(new O(i,`All promises were rejected`)))})})}static race(e){let t,n,r=new this((e,r)=>{t=e,n=r});function i(e){t(e)}function a(e){n(e)}for(let t of e)p(t)||(t=this.resolve(t)),t.then(i,a);return r}static all(e){return k.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof k?this:k).allWithCallback(e,{thenCallback:e=>({status:`fulfilled`,value:e}),errorCallback:e=>({status:`rejected`,reason:e})})}static allWithCallback(e,t){let n,r,i=new this((e,t)=>{n=e,r=t}),a=2,o=0,s=[];for(let i of e){p(i)||(i=this.resolve(i));let e=o;try{i.then(r=>{s[e]=t?t.thenCallback(r):r,a--,a===0&&n(s)},i=>{t?(s[e]=t.errorCallback(i),a--,a===0&&n(s)):r(i)})}catch(e){r(e)}a++,o++}return a-=2,a===0&&n(s),i}constructor(e){let t=this;if(!(t instanceof k))throw Error(`Must be an instanceof Promise.`);t[g]=null,t[_]=[];try{let n=S();e&&e(n(x(t,!0)),n(x(t,!1)))}catch(e){w(t,!1,e)}}get[Symbol.toStringTag](){return`Promise`}get[Symbol.species](){return k}then(e,n){var r;let i=(r=this.constructor)==null?void 0:r[Symbol.species];(!i||typeof i!=`function`)&&(i=this.constructor||k);let a=new i(ee),o=t.current;return this[g]==null?this[_].push(o,a,e,n):D(this,o,a,e,n),a}catch(e){return this.then(null,e)}finally(e){var n;let r=(n=this.constructor)==null?void 0:n[Symbol.species];(!r||typeof r!=`function`)&&(r=k);let i=new r(ee);i[v]=v;let a=t.current;return this[g]==null?this[_].push(a,i,e,e):D(this,a,i,e,e),i}}k.resolve=k.resolve,k.reject=k.reject,k.race=k.race,k.all=k.all;let A=e[l]=e.Promise;e.Promise=k;let te=o(`thenPatched`);function j(e){let t=e.prototype,n=r(t,`then`);if(n&&(n.writable===!1||!n.configurable))return;let i=t.then;t[u]=i,e.prototype.then=function(e,t){return new k((e,t)=>{i.call(this,e,t)}).then(e,t)},e[te]=!0}n.patchThen=j;function ne(e){return function(t,n){let r=e.apply(t,n);if(r instanceof k)return r;let i=r.constructor;return i[te]||j(i),r}}if(A){j(A);let t=A.try;t&&typeof t==`function`&&(k.try=t),en(e,`fetch`,e=>ne(e))}return Promise[t.__symbol__(`uncaughtPromiseErrors`)]=s,k})}function En(e){e.__load_patch(`toString`,e=>{let t=Function.prototype.toString,n=B(`OriginalDelegate`),r=B(`Promise`),i=B(`Error`),a=function(){if(typeof this==`function`){let a=this[n];if(a)return typeof a==`function`?t.call(a):Object.prototype.toString.call(a);if(this===Promise){let n=e[r];if(n)return t.call(n)}if(this===Error){let n=e[i];if(n)return t.call(n)}}return t.call(this)};a[n]=t,Function.prototype.toString=a;let o=Object.prototype.toString;Object.prototype.toString=function(){return typeof Promise==`function`&&this instanceof Promise?`[object Promise]`:o.call(this)}})}function Dn(e,t,n,r,i){let a=Zone.__symbol__(r);if(t[a])return;let o=t[a]=t[r];t[r]=function(a,s,c){return s&&s.prototype&&i.forEach(function(t){let i=`${n}.${r}::`+t,a=s.prototype;try{if(a.hasOwnProperty(t)){let n=e.ObjectGetOwnPropertyDescriptor(a,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,i),e._redefineProperty(s.prototype,t,n)):a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],i))}else a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],i))}catch(e){}}),o.call(t,a,s,c)},e.attachOriginToPatched(t[r],o)}function On(e){e.__load_patch(`util`,(e,t,n)=>{let r=Sn(e);n.patchOnProperties=Yt,n.patchMethod=en,n.bindArguments=Rt,n.patchMacroTask=tn;let i=t.__symbol__(`BLACK_LISTED_EVENTS`),a=t.__symbol__(`UNPATCHED_EVENTS`);e[a]&&(e[i]=e[a]),e[i]&&(t[i]=t[a]=e[i]),n.patchEventPrototype=pn,n.patchEventTarget=dn,n.ObjectDefineProperty=St,n.ObjectGetOwnPropertyDescriptor=xt,n.ObjectCreate=wt,n.ArraySlice=Tt,n.patchClass=Zt,n.wrapWithCurrentZone=Nt,n.filterProperties=bn,n.attachOriginToPatched=nn,n._redefineProperty=Object.defineProperty,n.patchCallbacks=Dn,n.getGlobalObjects=()=>({globalSources:sn,zoneSymbolEventNames:H,eventNames:r,isBrowser:Ut,isMix:Wt,isNode:Ht,TRUE_STR:At,FALSE_STR:jt,ZONE_SYMBOL_PREFIX:Mt,ADD_EVENT_LISTENER_STR:Et,REMOVE_EVENT_LISTENER_STR:Dt})})}function kn(e){Tn(e),En(e),On(e)}var An=bt();kn(An),wn(An);var jn=w(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Mn(e){return e.setValue(jn,!0)}function Nn(e){return e.getValue(jn)===!0}var Pn=`baggage`,Fn=4096;function In(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Ln(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 Rn(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=C(e.substring(t+1))),{key:o,value:s,metadata:c}}var zn=class{inject(e,t,n){let r=Qe.getBaggage(e);if(!r||Nn(e))return;let i=In(Ln(r).filter(e=>e.length<=Fn).slice(0,180));i.length>0&&n.set(t,Pn,i)}extract(e,t,n){let r=n.get(t,Pn),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=Rn(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:Qe.setBaggage(e,Qe.createBaggage(a))}fields(){return[Pn]}};function Bn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Vn(n)){P.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Hn(r)){P.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Vn(e){return typeof e==`string`&&e!==``}function Hn(e){return e==null?!0:Array.isArray(e)?Un(e):Wn(typeof e)}function Un(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Wn(e)){t=e;continue}return!1}return!1}}return!0}function Wn(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function Gn(){return e=>{P.error(Kn(e))}}function Kn(e){return typeof e==`string`?e:JSON.stringify(qn(e))}function qn(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Jn=Gn();function Yn(e){try{Jn(e)}catch(e){}}var Xn=`2.7.1`,Zn=`exception.message`,Qn=`exception.stacktrace`,$n=`exception.type`,er=`service.name`,tr=`telemetry.sdk.language`,nr=`webjs`,rr=`telemetry.sdk.name`,ir=`telemetry.sdk.version`,ar=`process.runtime.name`,or={[rr]:`opentelemetry`,[ar]:`browser`,[tr]:nr,[ir]:Xn},sr=performance,cr=9,lr=Math.pow(10,6),ur=Math.pow(10,cr);function dr(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*lr)]}function fr(e){return _r(dr(sr.timeOrigin),dr(typeof e==`number`?e:sr.now()))}function pr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ur),[n,r]}function mr(e){return e[0]*ur+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]>=ur&&(n[1]-=ur,n[0]+=1),n}var vr;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(vr||(vr={})),I();var yr=class{constructor(e={}){var t;F(this,`_propagators`,void 0),F(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t;let n=new Set;for(let e of this._propagators){let t=typeof e.fields==`function`?e.fields():[];for(let e of t)n.add(e)}this._fields=Array.from(n)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){P.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){P.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},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)}I();var Or=32,kr=512,Ar=`,`,jr=`=`,Mr=class e{constructor(e){F(this,`_length`,void 0),F(this,`_rawTraceState`,void 0),F(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Er(e)||!Dr(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>kr)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=Ar+e),e=`${n[0]}${jr}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Ar),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(jr);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Er(a)||!Dr(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>kr)&&(t.set(a,o),n=s,t.size>=Or))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}},Nr=`traceparent`,Pr=`tracestate`,Fr=`00`,Ir=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function Lr(e){let t=Ir.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Rr=class{inject(e,t,n){let r=et.getSpanContext(e);if(!r||Nn(e)||!je(r))return;let i=`${Fr}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||N.NONE).toString(16)}`;n.set(t,Nr,i),r.traceState&&n.set(t,Pr,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Nr);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Lr(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Pr);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Mr(typeof e==`string`?e:void 0)}return et.setSpanContext(e,a)}fields(){return[Nr,Pr]}},zr=`[object Object]`,Br=`[object Null]`,Vr=`[object Undefined]`,Hr=Function.prototype.toString,Ur=Hr.call(Object),Wr=Object.getPrototypeOf,Gr=Object.prototype,Kr=Gr.hasOwnProperty,qr=Symbol?Symbol.toStringTag:void 0,Jr=Gr.toString;function Yr(e){if(!Xr(e)||Zr(e)!==zr)return!1;let t=Wr(e);if(t===null)return!0;let n=Kr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Hr.call(n)===Ur}function Xr(e){return typeof e==`object`&&!!e}function Zr(e){return e==null?e===void 0?Vr:Br:qr&&qr in Object(e)?Qr(e):$r(e)}function Qr(e){let t=Kr.call(e,qr),n=e[qr],r=!1;try{e[qr]=void 0,r=!0}catch(e){}let i=Jr.call(e);return r&&(t?e[qr]=n:delete e[qr]),i}function $r(e){return Jr.call(e)}var ei=20;function ti(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ri(t,e.shift(),0,n);return t}function ni(e){return ai(e)?e.slice():e}function ri(e,t,n=0,r){let i;if(!(n>ei)){if(n++,ci(e)||ci(t)||oi(t))i=ni(t);else if(ai(e)){if(i=e.slice(),ai(t))for(let e=0,n=t.length;e<n;e++)i.push(ni(t[e]));else if(si(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=ni(t[r]))}}}else if(si(e))if(si(t)){if(!li(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];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(ci(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(ii(e,s,r)||ii(t,s,r))delete i[s];else{if(si(a)&&si(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]=ri(i[s],c,n,r)}}}}else i=t;return i}}function ii(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 ai(e){return Array.isArray(e)}function oi(e){return typeof e==`function`}function si(e){return!ci(e)&&!ai(e)&&!oi(e)&&typeof e==`object`}function ci(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function li(e,t){return!(!Yr(e)||!Yr(t))}I();var ui=class{constructor(){F(this,`_promise`,void 0),F(this,`_resolve`,void 0),F(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};I();var di=class{constructor(e,t){F(this,`_isCalled`,!1),F(this,`_deferred`,new ui),F(this,`_callback`,void 0),F(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};function fi(e,t){return new Promise(n=>{Ue.with(Mn(Ue.active()),()=>{e.export(t,n)})})}var pi={_export:fi};I();var mi=class{constructor(e){F(this,`_delegate`,void 0),this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};I();var hi=class extends Error{constructor(e,t,n){super(e),F(this,`code`,void 0),F(this,`name`,`OTLPExporterError`),F(this,`data`,void 0),this.data=n,this.code=t}};function gi(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 U(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){gi(a,r,i,o,s,`next`,e)}function s(e){gi(a,r,i,o,s,`throw`,e)}o(void 0)})}}function _i(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function vi(e){if(e!=null)return U(function*(){return e})}function yi(e,t,n){var r,i,a,o,s,c;return{timeoutMillis:_i((r=(i=e.timeoutMillis)==null?t.timeoutMillis:i)==null?n.timeoutMillis:r),concurrencyLimit:(a=(o=e.concurrencyLimit)==null?t.concurrencyLimit:o)==null?n.concurrencyLimit:a,compression:(s=(c=e.compression)==null?t.compression:c)==null?n.compression:s}}function bi(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}I();var xi=class{constructor(e){F(this,`_concurrencyLimit`,void 0),F(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var e=this;return U(function*(){yield Promise.all(e._sendingPromises)})()}};function Si(e){return new xi(e.concurrencyLimit)}function Ci(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function wi(){return{handleResponse(e){e==null||!Ci(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||P.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}I();var Ti=class{constructor(e,t,n,r,i){F(this,`_diagLogger`,void 0),F(this,`_transport`,void 0),F(this,`_serializer`,void 0),F(this,`_responseHandler`,void 0),F(this,`_promiseQueue`,void 0),F(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=P.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:vr.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:vr.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:vr.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:vr.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:vr.FAILED,error:(n=e.error)==null?new hi(`Export failed with retryable status`):n})}else t({code:vr.FAILED,error:new hi(`Export failed with unknown error`)})},e=>t({code:vr.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return U(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function Ei(e,t){return new Ti(e.transport,e.serializer,wi(),e.promiseHandler,t.timeout)}function Di(e,t,n){return Ei({transport:n,serializer:t,promiseHandler:Si(e)},{timeout:e.timeoutMillis})}function Oi(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 W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Oi(Object(n),!0).forEach(function(t){F(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var G=t((()=>{I()})),ki;function Ai(){if(ki===void 0)try{let e=globalThis.process.argv0;ki=e?`unknown_service:${e}`:`unknown_service`}catch(e){ki=`unknown_service`}return ki}var ji=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;I();var Mi=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Fi(t),r._asyncAttributesPending=t.filter(([e,t])=>ji(t)).length>0,r}constructor(e,t){var n;F(this,`_rawAttributes`,void 0),F(this,`_asyncAttributesPending`,!1),F(this,`_schemaUrl`,void 0),F(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(ji(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Fi(this._rawAttributes),this._schemaUrl=Ii(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return U(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,ji(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&P.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(ji(n)){P.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=Li(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Ni(e,t){return Mi.FromAttributeList(Object.entries(e),t)}function Pi(){return Ni({[er]:Ai(),[tr]:or[tr],[rr]:or[rr],[ir]:or[ir]})}function Fi(e){return e.map(([e,t])=>ji(t)?[e,t.catch(t=>{P.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Ii(e){if(typeof e==`string`||e===void 0)return e;P.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Li(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;P.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Ri(e,t){let n={attributes:Bi(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function zi(e){return{name:e.name,version:e.version}}function Bi(e,t){return Object.keys(e).map(n=>Vi(n,e[n],t))}function Vi(e,t,n){return{key:e,value:Hi(t,n)}}function Hi(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]=Hi(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:Hi(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function Ui(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Wi(e){return Ui(e).toString()}var Gi=typeof BigInt<`u`?Wi:mr;function Ki(e){return e}var qi={encodeHrTime:Gi,encodeSpanContext:Ki,encodeOptionalSpanContext:Ki,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(``))}},Ji=256,Yi=512;function Xi(e,t){let n=e&255|Ji;return t&&(n|=Yi),n}function Zi(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:Bi(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>$i(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Qi(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Xi(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Qi(e,t){var n;return{attributes:e.attributes?Bi(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:Xi(e.context.traceFlags,e.context.isRemote)}}function $i(e,t){return{attributes:e.attributes?Bi(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function ea(e,t){return{resourceSpans:na(e,t)}}function ta(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 na(e,t){let n=ta(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=>Zi(e,t));o.push({scope:zi(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Ri(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var ra={serializeRequest:e=>{let t=ea(e,qi);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return P.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};I();var ia=5,aa=1e3,oa=5e3,sa=1.5,ca=.2;function la(){return 2*ca*Math.random()-ca}var ua=class{constructor(e){F(this,`_transport`,void 0),this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}send(e,t){var n=this;return U(function*(){let r=ia,i=aa,a=Date.now()+t,o=yield n._transport.send(e,t);for(;o.status===`retryable`&&r>0;){var s;r--;let t=Math.max(Math.min(i*(1+la()),oa),0);i*=sa;let c=(s=o.retryInMillis)==null?t:s,l=a-Date.now();if(c>l)return P.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),o;P.verbose(`Scheduling export retry in ${Math.round(c)}ms`),o=yield n.retry(e,l,c)}return o.status===`success`?P.verbose(`Export succeeded after ${ia-r} retry attempts.`):o.status===`retryable`?P.info(`Export failed after maximum retry attempts (${ia}).`):P.info(`Export failed with non-retryable error: ${o.error}`),o})()}shutdown(){return this._transport.shutdown()}};function da(e){return new ua(e.transport)}function fa(e){return e===429||e===502||e===503||e===504}function pa(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}I();var ma=60*1024,ha=9,ga=0,_a=0,va=class{constructor(e){F(this,`_parameters`,void 0),this._parameters=e}send(e,t){var n=this;return U(function*(){let r=new AbortController,i=setTimeout(()=>r.abort(),t),a=globalThis.fetch;typeof a.__original==`function`&&(a=a.__original);let o=e.byteLength,s=ga+o>ma,c=!s&&!(_a>=ha);if(c)ga+=o,_a++;else{let e=s?`size limit`:`count limit`;P.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${_a} pending (${e})`)}try{let t=new URL(n._parameters.url),i=yield a(t.href,{method:`POST`,headers:yield n._parameters.headers(),body:e,signal:r.signal,keepalive:c,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return i.status>=200&&i.status<=299?(P.debug(`export response success (status: ${i.status})`),{status:`success`}):fa(i.status)?(P.warn(`export response retryable (status: ${i.status})`),{status:`retryable`,retryInMillis:pa(i.headers.get(`Retry-After`))}):(P.error(`export response failure (status: ${i.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${i.status}`)})}catch(e){return ba(e)?(P.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(P.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(i),c&&(ga-=o,_a--)}})()}shutdown(){}};function ya(e){return new va(e)}function ba(e){return e instanceof TypeError&&!e.cause}function xa(e,t){return Di(e,t,da({transport:ya(e)}))}function Sa(e){let t={};return Object.entries(e==null?{}:e).forEach(([e,n])=>{n===void 0?P.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}G();function Ca(e,t,n){return U(function*(){let r=W({},yield n()),i={};return t!=null&&Object.assign(i,yield t()),e!=null&&Object.assign(i,Sa(yield e())),Object.assign(i,r)})}function wa(e){if(e!=null)try{var t;let n=(t=globalThis.location)==null?void 0:t.href;return new URL(e,n).href}catch(t){throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Ta(e,t,n){var r,i;return W(W({},yi(e,t,n)),{},{headers:Ca(e.headers,t.headers,n.headers),url:(r=(i=wa(e.url))==null?t.url:i)==null?n.url:r})}function Ea(e,t){return W(W({},bi()),{},{headers:function(){var t=U(function*(){return e});return function(){return t.apply(this,arguments)}}(),url:`http://localhost:4318/`+t})}function Da(e){return typeof e.headers==`function`?e.headers:vi(e.headers)}function Oa(e,t,n){return Ta({url:e.url,timeoutMillis:e.timeoutMillis,headers:Da(e),concurrencyLimit:e.concurrencyLimit},{},Ea(n,t))}function ka(e,t,n,r){return xa(Oa(e,n,r),t)}var Aa=class extends mi{constructor(e={}){super(ka(e,ra,`v1/traces`,{"Content-Type":`application/json`}))}},ja=`exception`;I();var Ma=class{constructor(e){var t,n;F(this,`_spanContext`,void 0),F(this,`kind`,void 0),F(this,`parentSpanContext`,void 0),F(this,`attributes`,{}),F(this,`links`,[]),F(this,`events`,[]),F(this,`startTime`,void 0),F(this,`resource`,void 0),F(this,`instrumentationScope`,void 0),F(this,`_droppedAttributesCount`,0),F(this,`_droppedEventsCount`,0),F(this,`_droppedLinksCount`,0),F(this,`_attributesCount`,0),F(this,`name`,void 0),F(this,`status`,{code:He.UNSET}),F(this,`endTime`,[0,0]),F(this,`_ended`,!1),F(this,`_duration`,[-1,-1]),F(this,`_spanProcessor`,void 0),F(this,`_spanLimits`,void 0),F(this,`_attributeValueLengthLimit`,void 0),F(this,`_recordEndMetrics`,void 0),F(this,`_performanceStartTime`,void 0),F(this,`_performanceOffset`,void 0),F(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=sr.now(),this._performanceOffset=r-(this._performanceStartTime+sr.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return P.warn(`Invalid attribute key: ${e}`),this;if(!Hn(t))return P.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return P.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&P.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),gr(t)&&(gr(n)||(n=t),t=void 0);let i=Bn(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&P.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=Bn(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===He.UNSET||this.status.code===He.OK)return this;let t={code:e.code};return e.code===He.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&P.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){P.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=pr(this.startTime,this.endTime),this._duration[0]<0&&(P.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&&P.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&P.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=sr.now())return fr(e+this._performanceOffset);if(typeof e==`number`)return dr(e);if(e instanceof Date)return dr(e.getTime());if(hr(e))return e;if(this._startTimeProvided)return dr(Date.now());let t=sr.now()-this._performanceStartTime;return _r(this.startTime,dr(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Zn]=e:e&&(e.code?n[$n]=e.code.toString():e.name&&(n[$n]=e.name),e.message&&(n[Zn]=e.message),e.stack&&(n[Qn]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(ja,n,t):P.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}}`);P.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?(P.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}},K;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(K||(K={}));var Na=class{shouldSample(){return{decision:K.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},Pa=class{shouldSample(){return{decision:K.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};I();var Fa=class{constructor(e){var t,n,r,i;F(this,`_root`,void 0),F(this,`_remoteParentSampled`,void 0),F(this,`_remoteParentNotSampled`,void 0),F(this,`_localParentSampled`,void 0),F(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Yn(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Pa),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Pa:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new Na:n,this._localParentSampled=(r=e.localParentSampled)==null?new Pa:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new Na:i}shouldSample(e,t,n,r,i,a){let o=et.getSpanContext(e);return!o||!je(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&N.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&N.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()}}`}};I();var Ia=class{constructor(e=0){F(this,`_ratio`,void 0),F(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:ke(t)&&this._accumulate(t)<this._upperBound?K.RECORD_AND_SAMPLED:K.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<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}},La;(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`})(La||(La={}));var Ra=1;function za(){var e,t,n,r,i,a,o,s;return{sampler:Ba(),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 Ba(){var e;let t=(e=void 0)==null?La.ParentBasedAlwaysOn:e;switch(t){case La.AlwaysOn:return new Pa;case La.AlwaysOff:return new Na;case La.ParentBasedAlwaysOn:return new Fa({root:new Pa});case La.ParentBasedAlwaysOff:return new Fa({root:new Na});case La.TraceIdRatio:return new Ia(Va());case La.ParentBasedTraceIdRatio:return new Fa({root:new Ia(Va())});default:return P.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${La.ParentBasedAlwaysOn}".`),new Fa({root:new Pa})}}function Va(){return P.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Ra}.`),Ra}var Ha=1/0;function Ua(e){let t={sampler:Ba()},n=za(),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 Wa(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?Ha:s,Object.assign({},e,{spanLimits:p})}I();var Ga=class{constructor(e,t){var n,r,i,a;F(this,`_maxExportBatchSize`,void 0),F(this,`_maxQueueSize`,void 0),F(this,`_scheduledDelayMillis`,void 0),F(this,`_exportTimeoutMillis`,void 0),F(this,`_exporter`,void 0),F(this,`_isExporting`,!1),F(this,`_finishedSpans`,[]),F(this,`_timer`,void 0),F(this,`_shutdownOnce`,void 0),F(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 di(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(P.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&N.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&&P.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(P.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);Ue.with(Mn(Ue.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=>{Yn(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,Yn(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)}};I();var Ka=class extends Ga{constructor(e,t){super(e,t),F(this,`_visibilityChangeListener`,void 0),F(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=>{Yn(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Yn(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))}},qa=16,Ja=8,Ya=new Uint8Array(qa),Xa=new Uint8Array(Ja),Za=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Qa(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 $a(e){let t=``;for(let n=0;n<e.length;n++)t+=Za[e[n]];return t}var eo=class{generateTraceId(){return Qa(Ya),$a(Ya)}generateSpanId(){return Qa(Xa),$a(Xa)}},to=`otel.span.parent.origin`,no=`otel.span.sampling_result`,ro=`otel.sdk.span.live`,io=`otel.sdk.span.started`;I();var ao=class{constructor(e){F(this,`startedSpans`,void 0),F(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(io,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ro,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=so(t);if(this.startedSpans.add(1,{[to]:oo(e),[no]:n}),t===K.NOT_RECORD)return()=>{};let r={[no]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function oo(e){return e?e.isRemote?`remote`:`local`:`none`}function so(e){switch(e){case K.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case K.RECORD:return`RECORD_ONLY`;case K.NOT_RECORD:return`DROP`}}var co=`2.7.1`;I();var lo=class{constructor(e,t,n,r){F(this,`_sampler`,void 0),F(this,`_generalLimits`,void 0),F(this,`_spanLimits`,void 0),F(this,`_idGenerator`,void 0),F(this,`instrumentationScope`,void 0),F(this,`_resource`,void 0),F(this,`_spanProcessor`,void 0),F(this,`_tracerMetrics`,void 0);let i=Ua(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new eo,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,co):de();this._tracerMetrics=new ao(a)}startSpan(e,t={},n=Ue.active()){var r,i,a;t.root&&(n=et.deleteSpan(n));let o=et.getSpan(n);if(Nn(n))return P.debug(`Instrumentation suppressed, returning Noop Span`),et.wrapSpanContext(ve);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!et.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?Ve.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:Bn(e.attributes)})),m=Bn(t.attributes),h=this._sampler.shouldSample(n,u,e,f,m,p),g=this._tracerMetrics.startSpan(s,h.decision);d=(a=h.traceState)==null?d:a;let _=h.decision===Be.RECORD_AND_SAMPLED?N.SAMPLED:N.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===Be.NOT_RECORD)return P.debug(`Recording is off, propagating context in a non-recording span`),et.wrapSpanContext(v);let y=Bn(Object.assign(m,h.attributes));return new Ma({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:v,name:e,kind:f,links:p,parentSpanContext:l,attributes:y,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}startActiveSpan(e,t,n,r){var i;let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=r);let c=(i=o)==null?Ue.active():i,l=this.startSpan(e,a,c),u=et.setSpan(c,l);return Ue.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};I();var uo=class{constructor(e){F(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Yn(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)})}};I();var fo;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(fo||(fo={}));var po=class{constructor(e={}){var t,n;F(this,`_config`,void 0),F(this,`_tracers`,new Map),F(this,`_resource`,void 0),F(this,`_activeSpanProcessor`,void 0);let r=ti({},za(),Wa(e));this._resource=(t=r.resource)==null?Pi():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new uo(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 lo({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=fo.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==fo.timeout&&(r=fo.resolved,n(r))}).catch(e=>{clearTimeout(i),r=fo.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==fo.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};I();var mo=class{constructor(e){F(this,`_exporter`,void 0),F(this,`_shutdownOnce`,void 0),F(this,`_pendingExports`,void 0),this._exporter=e,this._shutdownOnce=new di(this._shutdown,this),this._pendingExports=new Set}forceFlush(){var e=this;return U(function*(){yield Promise.all(Array.from(e._pendingExports)),e._exporter.forceFlush&&(yield e._exporter.forceFlush())})()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&N.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>Yn(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}_doExport(e){var t=this;return U(function*(){if(e.resource.asyncAttributesPending){var n,r;yield(n=(r=e.resource).waitForAsyncAttributes)==null?void 0:n.call(r)}let i=yield pi._export(t._exporter,[e]);if(i.code!==vr.SUCCESS){var a;throw(a=i.error)==null?Error(`SimpleSpanProcessor: span export failed (status ${i})`):a}})()}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};I();var ho=class{constructor(){F(this,`_enabled`,!1),F(this,`_currentContext`,T)}_bindFunction(e=T,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=T,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=T,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||T;try{return t.call(n,...r)}finally{this._currentContext=i}}};function go(e){if(e!==null){if(e===void 0){let e=new ho;e.enable(),Ue.setGlobalContextManager(e);return}e.enable(),Ue.setGlobalContextManager(e)}}function _o(e){if(e!==null){if(e===void 0){Qe.setGlobalPropagator(new yr({propagators:[new Rr,new zn]}));return}Qe.setGlobalPropagator(e)}}var vo=class extends po{constructor(e={}){super(e)}register(e={}){et.setGlobalTracerProvider(this),_o(e.propagator),go(e.contextManager)}},q=e=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`,yo=()=>typeof window>`u`?`http://localhost`:window.location.origin,bo=e=>{try{return new URL(e,yo()).href}catch(t){return e}},xo=/^(?:\d+|[0-9a-f]{8}-[0-9a-f-]{27,}|[0-9a-f]{16,})$/i,So=e=>e.split(/[?#]/,1)[0].split(`/`).map(e=>xo.test(e)?`:id`:e).join(`/`),Co=e=>e.length>1?e.replace(/\/+$/,``):e,wo=(e,t)=>{let n=e=>Co(e.replace(/[?#].*$/,``));return n(e)===n(t)},To=(e,t)=>wo(bo(t),bo(e.transport.endpoint)),Eo=(e,t)=>To(e,t),Do=(e,t)=>typeof e==`function`?e(t):typeof e==`string`?t.includes(e):(e.lastIndex=0,e.test(t)),Oo=(e,t)=>(Array.isArray(e)?e:e?[e]:[]).some(e=>Do(e,t)),ko=e=>typeof e.tracking.request==`object`?e.tracking.request:void 0,Ao=(e,t)=>{var n;return Eo(e,t)||Oo((n=ko(e))==null?void 0:n.excludedUrls,bo(t))},jo=(e,t)=>{var n;return Oo((n=ko(e))==null?void 0:n.allowedTracingUrls,bo(t))},J={actionFrustrationType:`action.frustration.type`,actionId:`action.id`,actionName:`action.name`,actionTargetName:`action.target.name`,actionTargetTag:`action.target.tag`,actionType:`action.type`,deploymentEnvironmentName:`deployment.environment.name`,cacheHit:`resource.cache.hit`,deviceType:`device.type`,longTaskBlockingDuration:`long_task.blocking_duration`,longTaskEntryType:`long_task.entry_type`,longTaskId:`long_task.id`,networkEffectiveType:`network.effective_type`,networkStatus:`network.status`,nextHopProtocol:`resource.protocol`,outcomeType:`outcome.type`,resourceTimingConnectEnd:`resource.timing.connect_end`,resourceTimingConnectStart:`resource.timing.connect_start`,resourceTimingDomainLookupEnd:`resource.timing.domain_lookup_end`,resourceTimingDomainLookupStart:`resource.timing.domain_lookup_start`,resourceTimingFetchStart:`resource.timing.fetch_start`,resourceTimingFinalResponseHeadersStart:`resource.timing.final_response_headers_start`,resourceTimingRedirectEnd:`resource.timing.redirect_end`,resourceTimingRedirectStart:`resource.timing.redirect_start`,resourceTimingRequestStart:`resource.timing.request_start`,resourceTimingResponseEnd:`resource.timing.response_end`,resourceTimingResponseStart:`resource.timing.response_start`,resourceTimingSecureConnectionStart:`resource.timing.secure_connection_start`,resourceTimingStartTime:`resource.timing.start_time`,resourceTimingWorkerCacheLookupStart:`resource.timing.worker_cache_lookup_start`,resourceTimingWorkerFinalRouterSource:`resource.timing.worker_final_router_source`,resourceTimingWorkerMatchedRouterSource:`resource.timing.worker_matched_router_source`,resourceTimingWorkerRouterEvaluationStart:`resource.timing.worker_router_evaluation_start`,resourceTimingWorkerStart:`resource.timing.worker_start`,serviceName:`service.name`,serviceVersion:`service.version`,sessionHasReplay:`session.has_replay`,sessionId:`session.id`,sessionSampleRate:`session.sample_rate`,sessionPhase:`session.phase`,sessionType:`session.type`,spanType:`span_type`,userId:`user.id`,userAgentName:`user_agent.name`,userAgentOsName:`user_agent.os.name`,userAgentVersion:`user_agent.version`,vitalMetric:`vital.metric`,vitalValue:`vital.value`,viewDomComplete:`view.dom_complete`,viewDomContentLoaded:`view.dom_content_loaded`,viewDomInteractive:`view.dom_interactive`,viewFirstByte:`view.first_byte`,viewId:`view.id`,viewLoadEvent:`view.load_event`,viewLoadingTime:`view.loading_time`,viewLoadingTimeSource:`view.loading_time_source`,viewLoadingType:`view.loading_type`,viewName:`view.name`,viewPhase:`view.phase`,viewPrevious:`view.previous`,viewPreviousUrlTemplate:`view.previous_url_template`,viewReferrer:`view.referrer`,viewStartedAt:`view.started_at`,viewUrl:`view.url`,viewUrlTemplate:`view.url_template`,viewVersion:`view.version`,websocketPhase:`websocket.phase`};G();var Y={abort:`abort`,error:`error`,success:`success`,timeout:`timeout`,warning:`warning`},X={action:`action`,custom:`custom`,error:`error`,longTask:`long_task`,resource:`resource`,session:`session`,vital:`vital`,view:`view`,websocket:`websocket`},Z=(e,t)=>{let n=e[t];return typeof n==`string`&&n.trim()?n.trim():void 0},Q=({attributes:e,nameHint:t,spanType:n})=>{if(n===X.session){let t=Z(e,J.sessionPhase);return t?`session.${t}`:`session`}if(n===X.view){var r,i;return(r=(i=Z(e,J.viewName))==null?Z(e,J.viewUrlTemplate):i)==null?`view`:r}if(n===X.resource){var a;let t=(a=Z(e,`http.request.method`))==null?void 0:a.toUpperCase(),n=Z(e,`url.template`);if(t&&n)return`${t} ${n}`;let r=Z(e,`resource.type`);return r?`resource.${r}`:`resource`}if(n===X.action){var o,s;return(o=(s=Z(e,J.actionName))==null?Z(e,J.actionType):s)==null?`action`:o}if(n===X.error){let n=Z(e,`blank_screen.reason`);if(n)return`blank_screen.${n}`;let r=Z(e,`csp.effective_directive`);return r?`csp.${r}`:(t==null?void 0:t.trim())||Z(e,`error.source`)||`error`}if(n===X.vital){var c,l;return(c=(l=Z(e,J.vitalMetric))==null?void 0:l.toUpperCase())==null?`vital`:c}if(n===X.longTask){var u;return(u=Z(e,J.longTaskEntryType))==null?`long-task`:u}if(n===X.websocket){let t=Z(e,J.websocketPhase);return t?`websocket.${t}`:`websocket`}return n===X.custom?t===void 0?`custom`:`custom.${t}`:n},Mo=e=>e===408||e===504?Y.timeout:typeof e==`number`&&e>=400?Y.error:Y.success,No=e=>e===`good`?Y.success:Y.warning,Po=e=>{if(!e)return{};try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);return{serverAddress:t.hostname,serverPort:t.port?Number(t.port):void 0}}catch(e){return{}}},$=({outcome:e=Y.success,spanType:t})=>({[J.spanType]:t,[J.outcomeType]:e}),Fo=({initiatorType:e=`other`,method:t,outcome:n,url:r})=>{let i=Po(r),a=(n==null?void 0:n.type)===`response`&&typeof n.statusCode==`number`&&n.statusCode>0?n.statusCode:void 0,o=(n==null?void 0:n.type)===`abort`?Y.abort:(n==null?void 0:n.type)===`timeout`?Y.timeout:(n==null?void 0:n.type)===`network_error`?Y.error:typeof a==`number`?Mo(a):Y.success,s=t==null?void 0:t.toUpperCase();return W(W(W(W(W({},$({outcome:o,spanType:X.resource})),i.serverAddress?{"server.address":i.serverAddress}:{}),i.serverPort===void 0?{}:{"server.port":i.serverPort}),{},{"resource.type":e},s?{"http.request.method":s}:{}),typeof a==`number`?{"http.response.status_code":a}:{})};G();var Io=100,Lo=100,Ro=1e3,zo=100,Bo=1e4,Vo=`data-bk-action-name`,Ho=100,Uo=10,Wo=e=>e.replace(/\s+/g,` `).trim().slice(0,Ho),Go=e=>{var t;if(e.parentElement)return e.parentElement;let n=(t=e.getRootNode)==null?void 0:t.call(e);return typeof ShadowRoot<`u`&&n instanceof ShadowRoot?n.host:null},Ko=(e,t)=>{let n=e;for(;n;){let e=n.getAttribute(t);if(e)return Wo(e);n=Go(n)}},qo=e=>{var t;return e.isContentEditable?``:Wo((t=e.textContent)==null?``:t)},Jo=e=>{var t,n;let r=e,i=(t=r.labels)==null?void 0:t[0];if(i){let e=qo(i);if(e)return e}let a=e.tagName.toLowerCase(),o=(n=e.getAttribute(`type`))==null?void 0:n.toLowerCase();if(a===`input`&&[`button`,`reset`,`submit`].includes(o==null?``:o)){var s;let e=Wo((s=r.value)==null?``:s);if(e)return e}if(a===`button`||a===`label`||e.getAttribute(`role`)===`button`){let t=qo(e);if(t)return t}for(let t of[`aria-label`,`alt`,`name`,`title`,`placeholder`]){var c;let n=Wo((c=e.getAttribute(t))==null?``:c);if(n)return n}},Yo=(e,t=Vo,n=!1)=>{let r=Ko(e,t);if(r)return r;if(!n)return e.tagName.toLowerCase();let i=e,a=0;for(;i&&a<=Uo;){let e=i.tagName.toLowerCase();if(e===`body`||e===`html`||e===`head`)break;let t=Jo(i);if(t)return t;if(e===`form`)break;i=Go(i),a+=1}for(i=e,a=0;i&&a<=Uo;){let e=i.tagName.toLowerCase();if(e===`body`||e===`html`||e===`head`)break;let t=qo(i);if(t)return t;if(e===`form`)break;i=Go(i),a+=1}return e.tagName.toLowerCase()},Xo=e=>{var t;let n=(t=e.composedPath)==null?void 0:t.call(e)[0];return n instanceof Element?n:e.target instanceof Element?e.target:void 0},Zo=e=>{let t=e.timeStamp;return!Number.isFinite(t)||t<=0?Date.now():t>0xe8d4a51000?t:typeof performance>`u`?Date.now():performance.timeOrigin+t},Qo=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,$o=e=>{let t=e;if(t.tagName.toLowerCase()===`label`&&t.hasAttribute(`for`)){var n;t=document.getElementById((n=t.getAttribute(`for`))==null?``:n)}for(;t;){let e=t.tagName.toLowerCase();if(t.hasAttribute(`contenteditable`)||e===`canvas`||e===`select`||e===`textarea`||e===`a`&&t.hasAttribute(`href`))return!0;if(e===`input`){var r,i;return![`button`,`checkbox`,`radio`,`range`,`reset`,`submit`].includes((r=(i=t.getAttribute(`type`))==null?void 0:i.toLowerCase())==null?`text`:r)}t=Go(t)}return!1},es=(e={})=>{let t=[],n=new Map,r=new Set,i=e.actionNameAttribute||Vo,a=Qo(e.maxDuration,Bo),o=[],s,c=()=>{s==null||s.setRuntimeAttributes({[J.actionId]:[...n.keys()].at(-1)})},l=e=>!e.hadActivity&&!e.userActivity.input&&!e.userActivity.scroll&&!e.userActivity.selection&&!$o(e.target),u=e=>{if(!r.delete(e)||!s||!e.completed)return;clearTimeout(e.reportTimer),e.hadError&&e.frustrations.add(`error_click`),l(e)&&e.frustrations.add(`dead_click`);let t=[`rage_click`,`dead_click`,`error_click`].filter(t=>e.frustrations.has(t)),{endTime:n,hasLoadingTime:i}=e.completed,a=e.hadError||t.length>0,o=`click ${e.targetName}`,c=W(W(W(W({},s.config.hooks.getPageAttributes()),$({outcome:a?Y.warning:Y.success,spanType:X.action})),e.runtimeAttributes),{},{[J.actionId]:e.id,[J.actionName]:o,[J.actionType]:`click`,[J.actionTargetName]:e.targetName,[J.actionTargetTag]:e.targetTag},t.length?{[J.actionFrustrationType]:t}:{});s.startSpan(Q({attributes:c,spanType:X.action}),c,{rumSpanType:X.action,startTime:e.startTime}).end(i?n:e.startTime)},d=(e,t,i)=>{if(!n.delete(e.id)||!s)return;clearTimeout(e.validationTimer),clearTimeout(e.quietTimer),clearTimeout(e.maxDurationTimer),c(),e.completed={endTime:t,hasLoadingTime:i},r.add(e);let a=Math.max(0,e.startTime+Ro-Date.now());e.reportTimer=setTimeout(()=>u(e),a)},f=()=>{[...r].forEach(u)},p=e=>{if(clearTimeout(e.quietTimer),!e.hadActivity||e.pendingRequests.size)return;let t=Math.max(0,e.lastActivityTime+Lo-Date.now());e.quietTimer=setTimeout(()=>d(e,e.lastActivityTime,!0),t)},m=(e,t)=>{e.hadActivity=!0,e.lastActivityTime=Math.max(e.lastActivityTime,t),p(e)},h=(e,t)=>t>=e.startTime&&t<=e.startTime+a,g=e=>{for(let i of n.values()){if(e.type===`request_start`){var t;if(e.url&&Oo(s==null||(t=s.config.view)==null?void 0:t.excludedActivityUrls,e.url)||!h(i,e.time))continue;i.pendingRequests.add(e.id),m(i,e.time);continue}if(e.type===`request_end`){if(!i.pendingRequests.delete(e.id))continue;m(i,e.time);continue}if(e.type===`long_task`||e.type===`resource`){var r;if(e.type===`resource`&&e.url&&Oo(s==null||(r=s.config.view)==null?void 0:r.excludedActivityUrls,e.url)||e.startTime>i.startTime+a||(e.type===`resource`?e.startTime<i.startTime:e.endTime<i.startTime))continue;m(i,e.endTime);continue}if(e.type===`dom_mutation`||e.type===`window_open`){h(i,e.time)&&m(i,e.time);continue}e.type===`error`&&h(i,e.time)&&(i.hadError=!0,m(i,e.time))}},_=(e=Date.now())=>{[...n.values()].forEach(t=>d(t,e,t.hadActivity))},v=(e,t)=>{let n=`clientX`in t&&typeof t.clientX==`number`?t.clientX:0,r=`clientY`in t&&typeof t.clientY==`number`?t.clientY:0;o=o.filter(t=>e.startTime-t.action.startTime<=Ro);let i=o.at(-1),a=o.some(e=>e.action.userActivity.scroll||e.action.userActivity.selection),s=(i==null?void 0:i.target)===e.target&&Math.hypot(i.x-n,i.y-r)<=zo;(a||i&&!s)&&(o=[]),o.push({action:e,target:e.target,x:n,y:r}),o.length>=3&&e.startTime-o[o.length-3].action.startTime<=Ro&&(o.slice(-3).map(e=>e.action).forEach(e=>e.frustrations.add(`rage_click`)),o=[])};return{name:`action`,init(l){if(typeof window>`u`||typeof document>`u`)return;s=l;let u={capture:!0,passive:!0},p=t=>{if(!l.isSampled()||`button`in t&&typeof t.button==`number`&&t.button!==0)return;let r=Xo(t);if(!r)return;let o=Zo(t),s=q(`action`),u={frustrations:new Set,hadActivity:!1,hadError:!1,id:s,lastActivityTime:o,maxDurationTimer:setTimeout(()=>d(u,o+a,!0),a),pendingRequests:new Set,runtimeAttributes:l.getRuntimeAttributes(),startTime:o,target:r,targetName:Yo(r,i,e.nameCollection===`text`),targetTag:r.tagName.toLowerCase(),userActivity:{input:!1,scroll:!1,selection:!1},validationTimer:setTimeout(()=>{u.hadActivity||d(u,u.startTime,!1)},Io)};n.set(s,u),v(u,t),c()};window.addEventListener(`click`,p,u),t.push(()=>window.removeEventListener(`click`,p,u));let m=l.onActivity(g),h=l.onSessionLifecycle(e=>{e.type===`expired`&&(_(e.expiredAt),f())});t.push(m,h);let y=()=>{document.visibilityState===`hidden`&&(_(),f())},b=()=>{_(),f()};window.addEventListener(`pagehide`,b),document.addEventListener(`visibilitychange`,y),t.push(()=>window.removeEventListener(`pagehide`,b),()=>document.removeEventListener(`visibilitychange`,y));let x=e=>{new Set([...n.values(),...r,...o.map(e=>e.action)]).forEach(t=>{t.userActivity[e]=!0,e!==`input`&&t.frustrations.delete(`rage_click`)})},S=()=>x(`input`),C=()=>x(`scroll`),w=()=>x(`selection`);window.addEventListener(`input`,S,u),window.addEventListener(`scroll`,C,u),document.addEventListener(`selectionchange`,w,u),t.push(()=>window.removeEventListener(`input`,S,u),()=>window.removeEventListener(`scroll`,C,u),()=>document.removeEventListener(`selectionchange`,w,u))},shutdown(){for(_(),f();t.length;){var e;(e=t.pop())==null||e()}o=[],s=void 0}}},ts=e=>{let t=e.type===`characterData`?e.target.parentElement:e.target;return t instanceof Element&&!!t.closest(`[data-bk-excluded-activity-mutations]`)},ns=()=>{let e,t=[];return{name:`activity`,init(n){if(typeof document<`u`&&typeof MutationObserver<`u`&&(e=new MutationObserver(e=>{e.length&&!e.every(ts)&&n.notifyActivity({time:Date.now(),type:`dom_mutation`})}),e.observe(document,{attributes:!0,characterData:!0,childList:!0,subtree:!0})),!(typeof window>`u`)&&typeof window.open==`function`){let e=window.open,r=((...t)=>(n.notifyActivity({time:Date.now(),type:`window_open`}),Reflect.apply(e,window,t)));window.open=r,t.push(()=>{window.open===r&&(window.open=e)})}},shutdown(){var n;for(e==null||e.disconnect(),e=void 0;t.length;)(n=t.pop())==null||n()}}},rs=(e,t)=>!!(t&&Oo(e.config.view.excludedActivityUrls,t)),is=(e,t,n)=>{let r=new Set,i=!1,a=!1,o=t,s,c=e=>{i||(i=!0,clearTimeout(f),clearTimeout(s),d(),n(e))},l=()=>{clearTimeout(s),!(!a||r.size)&&(s=setTimeout(()=>c({endTime:o,hadActivity:!0}),Math.max(0,o+100-Date.now())))},u=e=>{a=!0,o=Math.max(o,e),l()},d=e.onActivity(n=>{if(!(n.type===`error`||n.type===`long_task`)){if(n.type===`request_start`){if(n.time<t||rs(e,n.url))return;r.add(n.id),u(n.time);return}if(n.type===`request_end`){if(!r.delete(n.id))return;u(n.time);return}if(n.type===`resource`){if(n.endTime<t||rs(e,n.url))return;u(n.endTime);return}n.time>=t&&u(n.time)}}),f=setTimeout(()=>{a||c({hadActivity:!1})},100);return()=>{i||(i=!0,clearTimeout(f),clearTimeout(s),d())}};G();var as=1e3,os=200,ss=`body`,cs=.8,ls=[`[data-loading="true"]`,`[aria-busy="true"]`,`.loading`,`.is-loading`,`.spinner`,`.skeleton`,`.bk-loading`],us=[[.2,.2],[.5,.2],[.8,.2],[.2,.5],[.5,.5],[.8,.5],[.2,.8],[.5,.8],[.8,.8]],ds=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,fs=(e,t)=>typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):t,ps=(e,t)=>t.some(t=>{try{return e.matches(t)||!!e.closest(t)}catch(e){return!1}}),ms=e=>{if(typeof getComputedStyle!=`function`)return!0;let t=getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`&&Number(t.opacity||1)>0},hs=(e,t)=>{if(typeof document.elementsFromPoint==`function`)return document.elementsFromPoint(e,t);let n=document.elementFromPoint(e,t);return n?[n]:[]},gs=(e,t)=>{var n;let r=document.querySelector(e),i=(n=r==null?document.body:r)==null?document.documentElement:n,a=0,o=0;for(let[e,n]of us){let r=hs(window.innerWidth*e,window.innerHeight*n);if(r.some(e=>ps(e,t))){o+=1;continue}r.some(e=>e!==i&&e!==document.body&&e!==document.documentElement&&i.contains(e)&&ms(e))||(a+=1)}let s=us.length-o;return{emptyCount:a,ignoredCount:o,reason:r?`empty_viewport`:`missing_root`,score:s?a/s:0,validCount:s}},_s=(e={})=>{var t;let n=ds(e.checkDelay,as),r=ds(e.confirmationDelay,os),i=e.rootSelector||ss,a=fs(e.threshold,cs),o=[...ls,...(t=e.ignoreSelectors)==null?[]:t],s,c,l,u,d=()=>{},f;return{name:`blank-screen`,init(e){if(typeof window>`u`||typeof document>`u`)return;let t=()=>{clearTimeout(u),u=void 0},p=(t,n)=>{if(s!==t||c===t||!e.isSampled())return;c=t;let r=Date.now(),i=W(W({},$({outcome:Y.error,spanType:X.error})),{},{"blank_screen.empty_ratio":n.score,"blank_screen.empty_sample_count":n.emptyCount,"blank_screen.reason":n.reason});e.startSpan(Q({attributes:i,spanType:X.error}),i,{startTime:r}).end(r)},m=t=>{if(s!==t||c===t||document.visibilityState===`hidden`)return;let n;try{n=gs(i,o)}catch(t){var l;e.config.debug&&((l=globalThis.console)==null||l.warn(`[bk-ot][blank-screen] detection failed:`,t));return}!n.validCount||n.score<a||(u=setTimeout(()=>{if(s!==t||document.visibilityState===`hidden`)return;let n;try{n=gs(i,o)}catch(t){var r;e.config.debug&&((r=globalThis.console)==null||r.warn(`[bk-ot][blank-screen] confirmation failed:`,t));return}n.validCount&&n.score>=a&&p(t,n)},r))},h=r=>{t(),!(document.visibilityState===`hidden`||!e.isSampled())&&(u=setTimeout(()=>m(r),n))};d=e.onViewChange(n=>{if(n.id!==s&&(t(),l==null||l(),l=void 0,s=n.id,c=void 0,n.id)){let t=n.id;l=is(e,Date.now(),()=>{l=void 0,h(t)})}});let g=()=>{document.visibilityState===`hidden`?t():s&&c!==s&&h(s)};document.addEventListener(`visibilitychange`,g),f=()=>document.removeEventListener(`visibilitychange`,g)},shutdown(){clearTimeout(u),u=void 0,d(),l==null||l(),l=void 0,f==null||f(),f=void 0,s=void 0,c=void 0}}},vs=[`http.url`,`url.full`],ys=new WeakSet,bs=e=>{ys.add(e)},xs=e=>{for(let n of vs){var t;let r=(t=e.attributes)==null?void 0:t[n];if(typeof r==`string`)return r}},Ss=e=>{let t=e==null?void 0:e[J.sessionId];return typeof t==`string`&&t.length>0},Cs=e=>{let t=e==null?void 0:e[J.viewId];return typeof t==`string`&&t.length>0},ws=e=>Ss(e)&&Cs(e),Ts=e=>(e==null?void 0:e[J.spanType])===X.session,Es=class{constructor(e,t,n){this.inner=e,this.config=t,this.getRuntimeAttributes=n}forceFlush(){return this.inner.forceFlush()}onEnd(e){let t=xs(e);if(!(ys.delete(e)||t&&To(this.config,t)||!ws(e.attributes)&&!(Ts(e.attributes)&&Ss(e.attributes)))){try{var n,r;if(((n=this.config.hooks)==null||(r=n.beforeSend)==null?void 0:r.call(n,{attributes:e.attributes,name:e.name,signal:`span`}))===!1)return}catch(e){var i;this.config.debug&&((i=globalThis.console)==null||i.warn(`[bk-ot] tracking.beforeSend failed:`,e))}this.inner.onEnd(e)}}onStart(e,t){var n;let r=(n=e.attributes)==null?{}:n,i={};for(let[e,t]of Object.entries(this.getRuntimeAttributes()))r[e]===void 0&&t!==void 0&&(i[e]=t);e.setAttributes(i),this.inner.onStart(e,t)}shutdown(){return this.inner.shutdown()}},Ds=100,Os=200,ks=[],As=e=>e.replace(/#.*$/,``),js=e=>{let t=ks.indexOf(e);t>=0&&ks.splice(t,1),e.timer!==void 0&&clearTimeout(e.timer)},Ms=(e,t)=>{let n=e.callback;js(e),e.callback=void 0,n==null||n(t)},Ns=e=>{let t=performance.timeOrigin+e.startTime,n=ks.filter(n=>!n.entry&&As(n.url)===As(e.name)&&t>=n.startTime-50).sort((e,n)=>Math.abs(e.startTime-t)-Math.abs(n.startTime-t))[0];n&&(n.entry=e,n.callback&&Ms(n,e))},Ps=(e,t=Date.now())=>{let n={startTime:t,url:e};return ks.push(n),ks.length>Ds&&Ms(ks[0]),{cancel:()=>Ms(n),complete:e=>{if(n.callback=e,n.entry){Ms(n,n.entry);return}n.timer=setTimeout(()=>Ms(n),Os)}}};G();var Fs=`traceparent`,Is=32,Ls=16,Rs=`0123456789abcdef`,zs=/^[\da-f]+$/,Bs=/^0+$/,Vs=/^\d+$/,Hs=/^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})(?:-.*)?$/,Us=/^([\da-f]{32})-([\da-f]{16})(?:-([01]))?$/,Ws=/(?:^|,)_dd\.p\.tid=([\da-f]{16})(?:,|$)/,Gs=`0000000000000000`,Ks=(e,t)=>e.length===t&&zs.test(e)&&!Bs.test(e),qs=e=>{let t=e.toLowerCase();return Ks(t,Is)?t:Ks(t,Ls)?t.padStart(Is,`0`):void 0},Js=e=>{let t=e.toLowerCase();return Ks(t,Ls)?t:void 0},Ys=e=>{let t=new Uint8Array(e/2);if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`)crypto.getRandomValues(t);else for(let e=0;e<t.length;e+=1)t[e]=Math.floor(Math.random()*256);let n=``;for(let e of t)n+=Rs[e>>4]+Rs[e&15];return Bs.test(n)?`${n.slice(1)}1`:n},Xs=e=>{if(!Vs.test(e))return;let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n)-48;for(let e=0;e<t.length;e+=1){let n=t[e]*10+r;t[e]=n%16,r=(n-n%16)/16}for(;r>0;)t.push(r%16),r=(r-r%16)/16}if(t.length>Ls)return;let n=``;for(let e=t.length-1;e>=0;--e)n+=Rs[t[e]];return n.padStart(Ls,`0`)},Zs=(e,t)=>{let n={};for(let i of t){var r;let t=(r=e(i))==null?void 0:r.trim();t&&(n[i]=t)}return n},Qs=[e=>{var t;let n=(t=e(`traceparent`))==null?void 0:t.trim().toLowerCase();if(!n)return;let r=Hs.exec(n);if(!r||r[1]===`ff`)return;let[,,i,a,o]=r;if(!(!Ks(i,Is)||!Ks(a,Ls)))return{format:`traceparent`,headers:Zs(e,[Fs]),sampled:(Number.parseInt(o,16)&1)==1,spanId:a,traceId:i}},e=>{var t;let n=(t=e(`sentry-trace`))==null?void 0:t.trim().toLowerCase();if(!n)return;let r=Zs(e,[`sentry-trace`]),i=Us.exec(n);if(!i)return{format:`sentry-trace`,headers:r};let[,a,o,s]=i;return W(W({format:`sentry-trace`,headers:r},s===void 0?{}:{sampled:s===`1`}),Ks(a,Is)&&Ks(o,Ls)?{spanId:o,traceId:a}:{})},e=>{var t;let n=(t=e(`b3`))==null?void 0:t.trim().toLowerCase();if(!n)return;let[r,i,a]=n.split(`-`),o=r?qs(r):void 0,s=i?Js(i):void 0;return W(W({format:`b3`,headers:Zs(e,[`b3`])},o&&s?{spanId:s,traceId:o}:{}),a?{sampled:a===`1`||a===`d`}:{})},e=>{var t,n,r;let i=(t=e(`x-b3-traceid`))==null?void 0:t.trim().toLowerCase(),a=(n=e(`x-b3-spanid`))==null?void 0:n.trim().toLowerCase(),o=(r=e(`x-b3-sampled`))==null?void 0:r.trim().toLowerCase();if(!i&&!a&&!o)return;let s=i?qs(i):void 0,c=a?Js(a):void 0;return W(W({format:`b3-multi`,headers:Zs(e,[`x-b3-traceid`,`x-b3-spanid`,`x-b3-parentspanid`,`x-b3-sampled`,`x-b3-flags`])},s&&c?{spanId:c,traceId:s}:{}),o?{sampled:o===`1`||o===`d`}:{})},e=>{var t,n,r,i,a,o;let s=(t=e(`x-datadog-trace-id`))==null?void 0:t.trim(),c=(n=e(`x-datadog-parent-id`))==null?void 0:n.trim(),l=(r=e(`x-datadog-sampling-priority`))==null?void 0:r.trim();if(!s&&!c&&!l)return;let u=(i=e(`x-datadog-tags`))==null?void 0:i.trim().toLowerCase(),d=(a=u?(o=Ws.exec(u))==null?void 0:o[1]:void 0)==null?Gs:a,f=s?Xs(s):void 0,p=f?qs(`${d}${f}`):void 0,m=c?Xs(c):void 0,h=m?Js(m):void 0;return W(W({format:`datadog`,headers:Zs(e,[`x-datadog-trace-id`,`x-datadog-parent-id`,`x-datadog-sampling-priority`,`x-datadog-origin`,`x-datadog-tags`])},p&&h?{spanId:h,traceId:p}:{}),l?{sampled:Number(l)>0}:{})},e=>{var t;let n=(t=e(`sw8`))==null?void 0:t.trim();if(!n)return;let r=n.split(`-`)[0];return W({format:`sw8`,headers:Zs(e,[`sw8`])},r?{sampled:r===`1`}:{})}],$s=e=>{for(let t of Qs){let n=t(e);if(n)return n}},ec=(e,t,n,r)=>({attributes:n,context:{spanId:t,traceFlags:r===!1?N.NONE:N.SAMPLED,traceId:e}}),tc=e=>{var t,n;let r=$s(e);if(!r){let e=Ys(Is),t=Ys(Ls),n=`00-${e}-${t}-01`;return{links:[ec(e,t,{format:`traceparent`,injected:!0,[Fs]:n})],traceparent:n}}return{links:[ec((t=r.traceId)==null?Ys(Is):t,(n=r.spanId)==null?Ys(Ls):n,W({format:r.format,injected:!1},r.headers),r.sampled)]}};G();var nc=e=>e.deliveryType===`cache`||e.transferSize===0&&e.decodedBodySize>0?!0:void 0,rc=e=>e.transferSize===0&&e.encodedBodySize===0&&e.decodedBodySize===0&&e.requestStart===0&&e.responseStart===0&&!e.nextHopProtocol,ic=(...e)=>e.every((t,n)=>n===0||e[n-1]<=t),ac=(e,t,n,r,i)=>{ic(n,r,i)&&(e[`resource.${t}.start`]=r-n,e[`resource.${t}.duration`]=i-r)},oc=e=>{let t={},n=[e.startTime,e.fetchStart,e.domainLookupStart,e.domainLookupEnd,e.connectStart,e.connectEnd,e.requestStart,e.responseStart,e.responseEnd];return!n.every(Number.isFinite)||!ic(...n)?t:(ac(t,`first_byte`,e.startTime,e.requestStart,e.responseStart),ac(t,`download`,e.startTime,e.responseStart,e.responseEnd),e.workerStart>0&&e.workerStart<e.fetchStart&&ac(t,`worker`,e.startTime,e.workerStart,e.fetchStart),e.fetchStart<e.domainLookupEnd&&ac(t,`dns`,e.startTime,e.domainLookupStart,e.domainLookupEnd),e.fetchStart<e.connectEnd&&(ac(t,`connect`,e.startTime,e.connectStart,e.connectEnd),e.connectStart<=e.secureConnectionStart&&e.secureConnectionStart<=e.connectEnd&&ac(t,`ssl`,e.startTime,e.secureConnectionStart,e.connectEnd)),e.redirectEnd>e.startTime&&ic(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart)&&ac(t,`redirect`,e.startTime,e.redirectStart,e.redirectEnd),t)},sc=[[`startTime`,J.resourceTimingStartTime],[`redirectStart`,J.resourceTimingRedirectStart],[`redirectEnd`,J.resourceTimingRedirectEnd],[`fetchStart`,J.resourceTimingFetchStart],[`workerStart`,J.resourceTimingWorkerStart],[`workerRouterEvaluationStart`,J.resourceTimingWorkerRouterEvaluationStart],[`workerCacheLookupStart`,J.resourceTimingWorkerCacheLookupStart],[`domainLookupStart`,J.resourceTimingDomainLookupStart],[`domainLookupEnd`,J.resourceTimingDomainLookupEnd],[`connectStart`,J.resourceTimingConnectStart],[`secureConnectionStart`,J.resourceTimingSecureConnectionStart],[`connectEnd`,J.resourceTimingConnectEnd],[`requestStart`,J.resourceTimingRequestStart],[`responseStart`,J.resourceTimingResponseStart],[`finalResponseHeadersStart`,J.resourceTimingFinalResponseHeadersStart],[`responseEnd`,J.resourceTimingResponseEnd],[`workerMatchedRouterSource`,J.resourceTimingWorkerMatchedRouterSource],[`workerFinalRouterSource`,J.resourceTimingWorkerFinalRouterSource]],cc=e=>{let t={};for(let[n,r]of sc){let i=e[n];(typeof i==`number`&&Number.isFinite(i)||typeof i==`string`&&i!==``)&&(t[r]=i)}return t},lc=e=>e.duration===0&&e.responseEnd>e.startTime?e.responseEnd-e.startTime:e.duration,uc=e=>{let t=rc(e),n=typeof e.deliveryType==`string`&&e.deliveryType?e.deliveryType:void 0;return W(W(W(W(W(W({[J.cacheHit]:nc(e)},e.nextHopProtocol?{[J.nextHopProtocol]:e.nextHopProtocol}:{}),oc(e)),cc(e)),n?{"resource.delivery_type":n}:{}),e.renderBlockingStatus?{"resource.render_blocking_status":e.renderBlockingStatus}:{}),t?{}:{"resource.size":e.decodedBodySize,"resource.encoded_body_size":e.encodedBodySize,"resource.decoded_body_size":e.decodedBodySize,"resource.transfer_size":e.transferSize})},dc=(e=!0)=>{let t;return{name:`resource`,init(n){var r;if(typeof PerformanceObserver>`u`||!((r=PerformanceObserver.supportedEntryTypes)!=null&&r.includes(`resource`)))return;let i=t=>{if(!n.isSampled()||!t.name||Eo(n.config,t.name))return;if(t.initiatorType===`fetch`||t.initiatorType===`xmlhttprequest`){Ns(t);return}if(t.duration<0)return;let r=n.config.hooks.redactUrl(t.name),i=lc(t),a=performance.timeOrigin+t.startTime,o=a+i;if(e&&n.isSampled()){let e=W(W(W({},n.config.hooks.getPageAttributes()),Fo({initiatorType:t.initiatorType||`other`,method:`GET`,outcome:typeof t.responseStatus==`number`?{statusCode:t.responseStatus,type:`response`}:void 0,url:r})),{},{"url.full":r,"url.template":n.config.hooks.getRequestUrlTemplate(r)},uc(t));n.startSpan(Q({attributes:e,spanType:X.resource}),e,{kind:Ve.CLIENT,rumSpanType:X.resource,startTime:a}).end(o)}n.notifyActivity({endTime:o,startTime:a,type:`resource`,url:t.name})};try{t=new PerformanceObserver(e=>{for(let t of e.getEntries())i(t)}),t.observe({type:`resource`,buffered:!0})}catch(e){t=void 0}},shutdown(){t==null||t.disconnect(),t=void 0}}};G();var fc=e=>typeof e.config.tracking.request==`object`?e.config.tracking.request:void 0,pc=e=>{var t;let n=(t=fc(e))==null?void 0:t.allowedTracingUrls;return Array.isArray(n)?n.length>0:n!==void 0},mc=e=>typeof e==`object`&&e&&`name`in e&&typeof e.name==`string`?e.name:``,hc=(e,t)=>{let n=e.signal;return mc(n==null?void 0:n.reason)===`TimeoutError`||mc(t)===`TimeoutError`?{error:t,type:`timeout`}:n!=null&&n.aborted||mc(t)===`AbortError`?{type:`abort`}:{error:t,type:`network_error`}},gc=(e,t)=>e===`abort`?{type:`abort`}:e===`timeout`?{type:`timeout`}:e===`error`||t.status===0?{type:`network_error`}:{statusCode:t.status,type:`response`},_c=e=>e.type===`network_error`||e.type===`timeout`||e.type===`response`&&typeof e.statusCode==`number`&&e.statusCode>=400,vc=e=>typeof e==`string`||e instanceof URL?bo(String(e)):bo(e.url),yc=(e,t)=>{var n;return((n=t==null?void 0:t.method)==null?typeof Request<`u`&&e instanceof Request?e.method:`GET`:n).toUpperCase()},bc=(e,t)=>typeof Request<`u`&&e instanceof Request?e:t==null?{}:t,xc=(e,t)=>{var n;let r=typeof Request<`u`&&e instanceof Request?e.headers:void 0;return new Headers((n=t==null?void 0:t.headers)==null?r:n)},Sc=(e,t,n)=>n.traceparent?(t.set(Fs,n.traceparent),W(W({},e),{},{headers:t})):e,Cc=e=>t=>e==null?void 0:e[t.toLowerCase()],wc=(e,t)=>Eo(e.config,t)||Oo(e.config.view.excludedActivityUrls,t),Tc=(e,t)=>{if(wc(e,t))return()=>{};let n=q(`request`);e.notifyActivity({id:n,time:Date.now(),type:`request_start`,url:t});let r=!1;return()=>{r||(r=!0,e.notifyActivity({id:n,time:Date.now(),type:`request_end`}))}},Ec=(e,t)=>e.isSampled()?Ps(t):{cancel(){},complete(e){e()}},Dc=(e,t,n,r)=>{var i,a;let o=(i=n.startedAt)==null?Date.now():i,s=W(W(W({},e.config.hooks.getPageAttributes()),Fo({initiatorType:t,method:n.method,url:(a=n.url)==null?``:a})),n.url?{"url.full":e.config.hooks.redactUrl(n.url),"url.template":e.config.hooks.getRequestUrlTemplate(n.url)}:{});return e.startSpan(Q({attributes:s,spanType:X.resource}),s,W({kind:Ve.CLIENT,rumSpanType:X.resource,startTime:o},r?{links:r.links}:{}))},Oc=(e,t,n,r,i,a={})=>{let o=a.url,s=o?e.config.hooks.redactUrl(o):void 0,c=a.method,l={attributes:W(W(W(W({},e.config.hooks.getPageAttributes()),Fo({initiatorType:n,method:c,outcome:i,url:s==null?``:s})),s?{"url.full":s}:{}),o?{"url.template":e.config.hooks.getRequestUrlTemplate(o)}:{}),resource:{method:c,outcome:i,transport:n,url:s},type:`resource`},u=!0;try{var d,f;u=(d=fc(e))==null||(f=d.beforeSend)==null?void 0:f.call(d,l,r)}catch(t){var p;e.config.debug&&((p=globalThis.console)==null||p.warn(`[bk-ot] request.beforeSend failed:`,t))}let m=e.applyRedact(l.attributes);if(t.setAttributes(m),t.updateName(Q({attributes:m,spanType:X.resource})),u===!1){bs(t);return}_c(i)&&t.setStatus({code:He.ERROR})},kc=e=>{let t=[],n=new Set;return{name:`request`,enabled:e!==!1,init(e){if(!(typeof window>`u`)){if(typeof window.fetch==`function`){let r=window.fetch,i=function(){var t=U(function*(t,i){let a=vc(t);if(!e.isSampled()||Ao(e.config,a))return r.call(this,t,i);let o={method:yc(t,i),startedAt:Date.now(),url:a},s=jo(e.config,a)?xc(t,i):void 0,c=s?tc(e=>{var t;return(t=s.get(e))==null?void 0:t}):void 0,l=Dc(e,`fetch`,o,c),u=Ec(e,a),d=Tc(e,a),f=bc(t,i),p=s&&c?Sc(i,s,c):i,m=!1,h=(t,r=Date.now())=>{if(!m){if(m=!0,n.delete(g),t){l.setAttributes(e.applyRedact(uc(t))),l.end(performance.timeOrigin+t.startTime+lc(t));return}l.end(r)}},g=()=>{u.cancel(),h()};n.add(g);try{let n=yield r.call(this,t,p),i=W(W({},n.status>0?{statusCode:n.status}:{}),{},{type:`response`});Oc(e,l,`fetch`,{request:f,response:n,type:`fetch`},i,o);let a=Date.now();return u.complete(e=>h(e,a)),n}catch(t){let n=hc(f,t);Oc(e,l,`fetch`,{error:t,request:f,type:`fetch`},n,o),n.type!==`abort`&&t instanceof Error&&l.recordException(t);let r=Date.now();throw u.complete(e=>h(e,r)),t}finally{d()}});return function(e,n){return t.apply(this,arguments)}}();window.fetch=i,t.push(()=>{window.fetch===i&&(window.fetch=r)})}if(typeof XMLHttpRequest<`u`){let r=new WeakMap,i=new WeakMap,a=XMLHttpRequest.prototype.open,o=XMLHttpRequest.prototype.send,s=function(e,t,n=!0,o,s){return r.set(this,{method:e.toUpperCase(),url:bo(String(t))}),i.delete(this),a.call(this,e,String(t),n,o,s)},c=function(t){var a;let s=(a=r.get(this))==null?{}:a;if(!e.isSampled()||!s.url||Ao(e.config,s.url))return o.call(this,t);s.startedAt=Date.now();let c=jo(e.config,s.url)?tc(Cc(i.get(this))):void 0,l=Dc(e,`xhr`,s,c),u=Ec(e,s.url),d=Tc(e,s.url);c!=null&&c.traceparent&&this.setRequestHeader(Fs,c.traceparent);let f=!1,p=!1,m=()=>{},h=()=>{m(),u.cancel(),!p&&(p=!0,n.delete(h),d(),l.end())};n.add(h);let g=t=>{if(f||p)return;f=!0,m();let r=gc(t,this);Oc(e,l,`xhr`,{type:`xhr`,xhr:this},r,s),d();let i=Date.now();u.complete(t=>{if(!p){if(p=!0,n.delete(h),t){l.setAttributes(e.applyRedact(uc(t))),l.end(performance.timeOrigin+t.startTime+lc(t));return}l.end(i)}})},_=()=>g(`abort`),v=()=>g(`error`),y=()=>g(`load`),b=()=>g(`timeout`);m=()=>{this.removeEventListener(`abort`,_),this.removeEventListener(`error`,v),this.removeEventListener(`load`,y),this.removeEventListener(`timeout`,b)},this.addEventListener(`abort`,_,{once:!0}),this.addEventListener(`error`,v,{once:!0}),this.addEventListener(`load`,y,{once:!0}),this.addEventListener(`timeout`,b,{once:!0});try{return o.call(this,t)}catch(e){throw e instanceof Error&&l.recordException(e),g(`error`),e}};if(XMLHttpRequest.prototype.open=s,XMLHttpRequest.prototype.send=c,t.push(()=>{XMLHttpRequest.prototype.open===s&&(XMLHttpRequest.prototype.open=a),XMLHttpRequest.prototype.send===c&&(XMLHttpRequest.prototype.send=o)}),pc(e)&&typeof XMLHttpRequest.prototype.setRequestHeader==`function`){let e=XMLHttpRequest.prototype.setRequestHeader,n=function(t,n){var r;let a=t.toLowerCase(),o=(r=i.get(this))==null?{}:r;return o[a]=a in o?`${o[a]}, ${n}`:n,i.set(this,o),e.call(this,t,n)};XMLHttpRequest.prototype.setRequestHeader=n,t.push(()=>{XMLHttpRequest.prototype.setRequestHeader===n&&(XMLHttpRequest.prototype.setRequestHeader=e)})}}}},shutdown(){var e;for(let e of[...n])e();for(;t.length;)(e=t.pop())==null||e()}}};G();var Ac=/^https?:|^\/\//i,jc=(e,t)=>{if(t)return Ac.test(t)?e(t):t},Mc=()=>{let e;return{name:`csp-violation`,init(t){if(typeof window>`u`||typeof document>`u`)return;let n=e=>{if(!t.isSampled())return;let n=Date.now(),r=jc(t.config.hooks.redactUrl,e.blockedURI),i=e.sourceFile?t.config.hooks.redactUrl(e.sourceFile):void 0,a=W(W(W({},t.config.hooks.getPageAttributes()),$({outcome:Y.error,spanType:X.error})),{},{"csp.blocked_uri":r,"csp.violated_directive":e.violatedDirective,"csp.effective_directive":e.effectiveDirective,"csp.disposition":e.disposition,"csp.source_file":i,"csp.line_number":e.lineNumber,"csp.column_number":e.columnNumber,"csp.status_code":e.statusCode,"csp.original_policy":e.originalPolicy,"error.source":`csp`});t.startSpan(Q({attributes:a,spanType:X.error}),a,{startTime:n}).end(n)};document.addEventListener(`securitypolicyviolation`,n),e=()=>document.removeEventListener(`securitypolicyviolation`,n)},shutdown(){e==null||e(),e=void 0}}},Nc=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)};G();var Pc=`BK_RUM_DEVICE_ID`,Fc=250,Ic=()=>navigator.connection,Lc=()=>navigator.userAgentData,Rc=e=>{for(let[t,n]of[[`Edge`,/Edg\/([\d.]+)/],[`Chrome`,/Chrome\/([\d.]+)/],[`Firefox`,/Firefox\/([\d.]+)/],[`Safari`,/Version\/([\d.]+).*Safari/]]){let r=e.match(n);if(r!=null&&r[1])return{name:t,version:r[1].split(`.`)[0]}}return{name:`Other`,version:void 0}},zc=(e,t)=>{let n=`${t==null?``:t} ${e}`;return/iphone|ipad|ipod/i.test(n)?`iOS`:/android/i.test(n)?`Android`:/mac/i.test(n)?`macOS`:/win/i.test(n)?`Windows`:/linux/i.test(n)?`Linux`:`Other`},Bc=e=>{let t=null;try{t=window.localStorage.getItem(e)}catch(e){}if(t)return t;let n=q(`device`);try{window.localStorage.setItem(e,n)}catch(e){}return n},Vc=()=>{var e,t;return typeof window>`u`?{}:{"browser.viewport.width":window.innerWidth,"browser.viewport.height":window.innerHeight,"browser.screen.width":(e=window.screen)==null?void 0:e.width,"browser.screen.height":(t=window.screen)==null?void 0:t.height}},Hc=()=>{if(typeof navigator>`u`)return{};let e=Ic();return{[J.networkStatus]:navigator.onLine?`connected`:`not_connected`,"network.effective_type":e==null?void 0:e.effectiveType,"network.connection.type":e==null?void 0:e.type}},Uc=()=>{if(typeof navigator>`u`)return{};let e=Lc(),t=navigator.userAgent,n=Rc(t),r=zc(t,e==null?void 0:e.platform),i=e!=null&&e.mobile||/mobi|android|iphone|ipad|ipod/i.test(t)?`mobile`:`desktop`;return{[J.deviceType]:i,[J.userAgentName]:n.name,[J.userAgentVersion]:n.version,[J.userAgentOsName]:r}},Wc=(e,t)=>{let n;return()=>{n!==void 0&&window.clearTimeout(n),n=window.setTimeout(()=>{n=void 0,e()},t)}},Gc=(e={})=>{let t=[];return{name:`device`,init(n){var r;let i=(r=e.storageKey)==null?`${Pc}_${Nc(n.config.application.name)}`:r,a=typeof window>`u`||e.persistentId!==!0?q(`device`):Bc(i);if(n.setRuntimeAttributes(W(W(W({"device.id":a},n.config.tracking.device===!1?Uc():{}),Vc()),Hc())),typeof window>`u`)return;let o=Wc(()=>{n.setRuntimeAttributes(Vc())},Fc);window.addEventListener(`resize`,o),window.addEventListener(`orientationchange`,o),t.push(()=>window.removeEventListener(`resize`,o),()=>window.removeEventListener(`orientationchange`,o));let s=()=>{n.setRuntimeAttributes(Hc())};window.addEventListener(`online`,s),window.addEventListener(`offline`,s),t.push(()=>window.removeEventListener(`online`,s),()=>window.removeEventListener(`offline`,s));let c=Ic();c&&typeof c.addEventListener==`function`&&(c.addEventListener(`change`,s),t.push(()=>{var e;(e=c.removeEventListener)==null||e.call(c,`change`,s)}))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};G();var Kc=e=>{if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch(t){return String(e)}},qc=({context:e,error:t,exceptionType:n,extra:r={},source:i})=>{if(!e.isSampled())return;let a=Date.now(),o=Kc(t);e.notifyActivity({time:a,type:`error`});let s=n==null?t instanceof Error?t.name||`Error`:i:n,c=t instanceof Error?t:{message:o,name:s},l=W(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getErrorAttributes()),$({outcome:Y.error,spanType:X.error})),{},{"error.message":o,"error.handled":!1,"error.source":i},r),u=e.startSpan(Q({attributes:l,nameHint:s,spanType:X.error}),l,{startTime:a});u.recordException(c),u.setStatus({code:He.ERROR,message:o}),u.end()},Jc=()=>{let e=[];return{name:`error`,init(t){if(typeof window>`u`)return;let n=e=>{var n;qc({context:t,source:`window.error`,error:(n=e.error)==null?e.message:n,extra:{"code.filepath":e.filename,"code.lineno":e.lineno,"code.column":e.colno}})},r=e=>{qc({context:t,source:`unhandledrejection`,error:e.reason,exceptionType:e.reason instanceof Error?e.reason.name:`UnhandledRejection`})},i=e=>{if(e instanceof ErrorEvent)return;let n=e.target;if(!(n instanceof Element))return;let r=n,i=r.src||r.href||n.currentSrc||``;qc({context:t,source:`resource`,error:Error(`Resource load failed: ${n.tagName.toLowerCase()} ${i}`),exceptionType:`ResourceError`,extra:{"url.full":t.config.hooks.redactUrl(i)}})};window.addEventListener(`error`,n),window.addEventListener(`unhandledrejection`,r),window.addEventListener(`error`,i,!0),e.push(()=>window.removeEventListener(`error`,n),()=>window.removeEventListener(`unhandledrejection`,r),()=>window.removeEventListener(`error`,i,!0))},shutdown(){for(;e.length;){var t;(t=e.pop())==null||t()}}}};G();var Yc=50,Xc=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,Zc=e=>Number.isFinite(e)?e:void 0,Qc=(e,t)=>W(W(W(W(W({},e.containerId?{"long_task.attribution.container_id":e.containerId}:{}),e.containerName?{"long_task.attribution.container_name":e.containerName}:{}),e.containerSrc?{"long_task.attribution.container_src":t(e.containerSrc)}:{}),e.containerType?{"long_task.attribution.container_type":e.containerType}:{}),e.name?{"long_task.attribution.name":e.name}:{}),$c=(e,t)=>({"long_task.script.duration":e.duration,"long_task.script.execution_start":e.executionStart,"long_task.script.forced_style_and_layout_duration":e.forcedStyleAndLayoutDuration,"long_task.script.invoker":e.invoker,"long_task.script.invoker_type":e.invokerType,"long_task.script.pause_duration":e.pauseDuration,"long_task.script.source_char_position":e.sourceCharPosition,"long_task.script.source_function_name":e.sourceFunctionName,"long_task.script.source_url":e.sourceURL?t(e.sourceURL):``,"long_task.script.start_time":e.startTime,"long_task.script.window_attribution":e.windowAttribution}),el=(e={})=>{let t=Xc(e.threshold,Yc),n,r,i=[];return{name:`long-task`,init(e){var a;if(typeof PerformanceObserver>`u`||typeof performance>`u`)return;let o=(a=PerformanceObserver.supportedEntryTypes)==null?[]:a,s=o.includes(`long-animation-frame`)?`long-animation-frame`:o.includes(`longtask`)?`longtask`:void 0;if(!s)return;let c=n=>{var r,i;if(!e.isSampled()||!Number.isFinite(n.duration)||n.duration<t)return;let a=n.entryType===`long-animation-frame`,o=a?n:void 0,s=(r=o==null?void 0:o.scripts)==null?[]:r,c=q(`long-task`),l=performance.timeOrigin+n.startTime,u=l+n.duration,d=a?`long-animation-frame`:`long-task`,f=a||(i=n.attribution)==null?[]:i,p=W(W(W(W(W(W({},e.config.hooks.getPageAttributes()),$({spanType:X.longTask})),Zc(o==null?void 0:o.blockingDuration)===void 0?{}:{[J.longTaskBlockingDuration]:o.blockingDuration}),{},{[J.longTaskEntryType]:d,[J.longTaskId]:c,"long_task.name":n.name},Zc(o==null?void 0:o.firstUIEventTimestamp)===void 0?{}:{"long_task.first_ui_event_timestamp":o.firstUIEventTimestamp}),Zc(o==null?void 0:o.renderStart)===void 0?{}:{"long_task.render_start":o.renderStart}),Zc(o==null?void 0:o.styleAndLayoutStart)===void 0?{}:{"long_task.style_and_layout_start":o.styleAndLayoutStart}),m=e.startSpan(Q({attributes:p,spanType:X.longTask}),p,{startTime:l});s.forEach(t=>{m.addEvent(`long_task.script`,e.applyRedact($c(t,e.config.hooks.redactUrl)),performance.timeOrigin+t.startTime)}),f.forEach((t,n)=>{m.addEvent(`long_task.attribution`,e.applyRedact(W({"long_task.attribution.index":n},Qc(t,e.config.hooks.redactUrl))),l)}),m.end(u),e.notifyActivity({endTime:u,startTime:l,type:`long_task`})},l=e=>e.forEach(e=>c(e));try{let e=!0;n=new PerformanceObserver(t=>{let n=t.getEntries();e?(i.push(...n),r||(r=setTimeout(()=>{let e=i;i=[],r=void 0,l(e)}))):l(n)}),n.observe({type:s,buffered:!0}),e=!1}catch(e){n=void 0}},shutdown(){n==null||n.disconnect(),n=void 0,clearTimeout(r),r=void 0,i=[]}}},tl=new Set,nl=``,rl,il,al=!1,ol=()=>typeof location>`u`?``:location.href,sl=(e,t)=>{let n=ol();nl=n;let r={fromUrl:t,source:e,toUrl:n};for(let e of Array.from(tl))e(r)},cl=()=>{sl(`popstate`,nl||ol())},ll=()=>{sl(`hashchange`,nl||ol())},ul=()=>{al||typeof window>`u`||typeof history>`u`||(al=!0,nl=ol(),rl=history.pushState,il=history.replaceState,history.pushState=function(e,t,n){let r=nl||ol(),i=rl==null?void 0:rl.apply(this,[e,t,n]);return sl(`pushState`,r),i},history.replaceState=function(e,t,n){let r=nl||ol(),i=il==null?void 0:il.apply(this,[e,t,n]);return sl(`replaceState`,r),i},window.addEventListener(`popstate`,cl),window.addEventListener(`hashchange`,ll))},dl=()=>{!al||typeof window>`u`||typeof history>`u`||(rl&&(history.pushState=rl),il&&(history.replaceState=il),window.removeEventListener(`popstate`,cl),window.removeEventListener(`hashchange`,ll),rl=void 0,il=void 0,al=!1,nl=``)},fl=e=>typeof window>`u`||typeof history>`u`?()=>{}:(ul(),tl.add(e),()=>{tl.delete(e),tl.size===0&&dl()});function pl(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 ml(e,t){if(e==null)return{};var n,r,i=pl(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}G();var hl=[`stopLoadingTime`],gl=new Set(Object.values(J)),_l=()=>typeof location>`u`?``:location.href,vl=()=>{if(typeof performance>`u`)return{};let e=performance.getEntriesByType(`navigation`)[0];if(!e)return{};let t={},n=(e,n)=>{Number.isFinite(n)&&n>0&&(t[e]=n)};return n(J.viewFirstByte,e.responseStart),n(J.viewDomInteractive,e.domInteractive),n(J.viewDomContentLoaded,e.domContentLoadedEventEnd),n(J.viewDomComplete,e.domComplete),n(J.viewLoadEvent,e.loadEventEnd),t},yl=e=>{let t=e.indexOf(`?`);return t<0?e:e.slice(0,t)},bl=e=>{let t=e.slice(1);if(!t||typeof document>`u`||typeof document.getElementById!=`function`)return!1;try{return!!document.getElementById(decodeURIComponent(t))}catch(e){return!!document.getElementById(t)}},xl=(e,t)=>{try{let n=typeof location>`u`?`http://localhost`:location.href,r=new URL(e,n),i=new URL(t,n);return r.pathname!==i.pathname||!bl(i.hash)&&yl(r.hash)!==yl(i.hash)}catch(n){return e!==t}},Sl=()=>{let e=[];return{name:`page-view`,init(t){if(typeof window>`u`)return;let n,r,i,a=(e=Date.now())=>t.setView({},e),o=(e,n,r=Date.now(),i)=>{e.version+=1;let a=W(W(W(W(W({},t.config.hooks.getPageAttributes()),e.attributes),e.snapshotAttributes),{},{[J.viewPhase]:n,[J.viewStartedAt]:e.startedAt,[J.viewVersion]:e.version},i?{"view.end_reason":i}:{}),e.loadingTime===void 0?{}:{[J.viewLoadingTime]:e.loadingTime,[J.viewLoadingTimeSource]:e.loadingTimeSource});t.startSpan(Q({attributes:a,spanType:X.view}),a,{contextTime:r,rumSpanType:X.view,startTime:r}).end(r)},s=(e,t=!0,r=Date.now())=>{var i;if(!n){t&&a(r);return}let s=W({},n);(i=n.stopLoadingTime)==null||i.call(n),o(n,`end`,r,e),n=void 0,t&&a(r);let{stopLoadingTime:c}=s;return ml(s,hl)},c=(e,t,r)=>{if(n!==e||!Number.isFinite(t)||t<0)return;let i=W(W({},e.loadingType===`initial_load`?vl():{}),{},{[J.viewLoadingTime]:t,[J.viewLoadingTimeSource]:r});Object.assign(e.snapshotAttributes,i),e.loadingTime=t,e.loadingTimeSource=r,o(e,`update`)},l=e=>{if(!t.config.view.loadingTime||document.visibilityState===`hidden`)return;let r=!1,i,a=e.loadingType!==`initial_load`,o,s,l=!1,u,d=()=>{var t;if(l||!r||!a||n!==e)return;let s=[i,o].filter(e=>e!==void 0);s.length&&c(e,Math.max(...s),`auto`),(t=e.stopLoadingTime)==null||t.call(e),e.stopLoadingTime=void 0},f=()=>{var t,n;let r=(t=(n=performance).getEntriesByType)==null?void 0:t.call(n,`navigation`)[0];return r!=null&&r.loadEventEnd?(o=Math.max(0,performance.timeOrigin+r.loadEventEnd-e.startedAt),a=!0,!0):!1};if(!a&&!f()){let t=()=>{setTimeout(()=>{n===e&&(f(),a=!0,d())})};window.addEventListener(`load`,t,{once:!0}),s=()=>window.removeEventListener(`load`,t)}let p=is(t,e.startedAt,t=>{r=!0,t.hadActivity&&(i=Math.max(0,t.endTime-e.startedAt)),d()}),m=()=>{var t;document.visibilityState===`hidden`&&(l=!0,(t=e.stopLoadingTime)==null||t.call(e),e.stopLoadingTime=void 0)};document.addEventListener(`visibilitychange`,m),u=()=>document.removeEventListener(`visibilitychange`,m),e.stopLoadingTime=()=>{p(),s==null||s(),s=void 0,u==null||u(),u=void 0},d()},u=e=>{let n=t.applyRedact(e==null?{}:e);return Object.fromEntries(Object.entries(n).filter(([e,t])=>t!==void 0&&!gl.has(e)))},d=(e,r,i,a=(e=>(e=n==null?void 0:n.rawUrl)==null?``:e)())=>{var c,d;if(!t.isSessionActive())return;let f=(c=e.url)==null?_l():c,p=t.config.hooks.getViewUrlTemplate(f),m=a?t.config.hooks.getViewUrlTemplate(a):``,h=(d=e.name)==null?p:d,g=u(e.attributes);s(r,!1);let _=q(`view`),v=t.config.hooks.redactUrl(f),y=t.config.hooks.redactUrl(a),b=i===`initial_load`,x=b&&typeof performance<`u`?performance.timeOrigin:Date.now(),S=b?vl():{};t.setView({attributes:g,id:_,loadingType:i,name:h,startedAt:x,url:v,urlTemplate:p},x),n={attributes:g,version:0,id:_,loadingType:i,name:h,rawUrl:f,snapshotAttributes:W(W(W(W(W(W({},g),t.config.hooks.getPageAttributes()),S),$({spanType:X.view})),{},{[J.viewId]:_},h?{[J.viewName]:h}:{}),{},{[J.viewUrl]:v,[J.viewUrlTemplate]:p,[J.viewLoadingType]:i,[J.viewPrevious]:y,[J.viewPreviousUrlTemplate]:m},b&&document.referrer?{[J.viewReferrer]:t.config.hooks.redactUrl(document.referrer)}:{}),startedAt:x,url:v,urlTemplate:p},o(n,`start`,x),l(n)},f=t.onViewCommand(e=>{if(e.type===`start`){d(e.options,`manual`,n?`route_change`:`initial_load`);return}if(n){if(e.type===`set_loading_time`){var r;(r=n.stopLoadingTime)==null||r.call(n),n.stopLoadingTime=void 0,c(n,Math.max(0,e.time-n.startedAt),`manual`);return}n.name!==e.name&&(n.name=e.name,n.snapshotAttributes[J.viewName]=e.name,t.setView({attributes:n.attributes,id:n.id,loadingType:n.loadingType,name:n.name,startedAt:n.startedAt,url:n.url,urlTemplate:n.urlTemplate}),o(n,`update`))}}),p=()=>{};t.config.view.tracking===`auto`&&(n||d({},`load`,`initial_load`),p=fl(e=>{xl(e.fromUrl,e.toUrl)&&d({},e.source,`route_change`,e.fromUrl)}));let m=e=>{if(e.persisted){r=s(`bfcache`);return}r=void 0,s(`pagehide`)},h=e=>{if(e.persisted&&t.config.view.tracking===`auto`){let e=r;if(r=void 0,!t.isSessionActive()){i=e;return}d(e?{attributes:e.attributes,name:e.name,url:e.rawUrl}:{},`bfCache`,`bf_cache`,e==null?void 0:e.rawUrl)}},g=t.onSessionLifecycle(e=>{if(e.type===`expired`){var t;i=(t=s(`session_expired`,!0,e.expiredAt))==null?r:t,r=void 0;return}i&&(d({attributes:i.attributes,name:i.name,url:i.rawUrl},`sessionRenewal`,`session_renewal`,i.rawUrl),i=void 0)});window.addEventListener(`pagehide`,m),window.addEventListener(`pageshow`,h),e.push(p,g,f,()=>window.removeEventListener(`pagehide`,m),()=>window.removeEventListener(`pageshow`,h),()=>s(`shutdown`))},shutdown(){for(;e.length;){var t;(t=e.pop())==null||t()}}}};G();var Cl=5e3,wl=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,Tl=(e,t,n,r)=>({expiresAt:Math.min(t+n,t+r),id:e,startedAt:t,status:`active`}),El=(e,t,n)=>{if(t>=e.startedAt+n)return`maxLifetime`;if(t>=e.expiresAt)return`inactivity`},Dl=(e,t,n,r)=>W(W({},e),{},{expiresAt:Math.min(t+n,e.startedAt+r)}),Ol=(e,t,n)=>{if(!e)return null;try{let r=JSON.parse(e);if(r.status===`active`&&typeof r.id==`string`&&r.id.length>0&&wl(r.startedAt)&&r.startedAt<=t+Cl&&wl(r.expiresAt)&&r.expiresAt>=r.startedAt&&r.expiresAt<=r.startedAt+n||r.status===`expired`&&typeof r.previousId==`string`&&r.previousId.length>0&&(r.reason===`inactivity`||r.reason===`maxLifetime`)&&wl(r.expiredAt)&&r.expiredAt<=t+Cl)return r}catch(e){}return null};G();var kl=900*1e3,Al=14400*1e3,jl=1e3,Ml=6e4,Nl=[`click`,`keydown`,`scroll`,`touchstart`],Pl=new Map,Fl=e=>{let t=typeof window<`u`,n=()=>{var n;if(t)try{return window.localStorage.getItem(e)}catch(e){t=!1}return(n=Pl.get(e))==null?null:n};return n(),{isLocalStorage:()=>t,read:n,write:n=>{let r=JSON.stringify(n);if(Pl.set(e,r),t)try{window.localStorage.setItem(e,r)}catch(e){t=!1}}}},Il=(e,t)=>{let n=``;try{n=new URL(e).host}catch(t){n=e}return`bk_ot_session__${Nc(`${t}\0${n||`default`}`)}`},Ll=(e,t,n,r)=>{let i=W(W(W({},e.config.hooks.getPageAttributes()),$({spanType:X.session})),{},{[J.sessionPhase]:t,[J.sessionHasReplay]:!1,[J.sessionId]:n,[J.sessionType]:`user`});e.startSpan(Q({attributes:i,spanType:X.session}),i,{contextTime:r,startTime:r}).end(r)},Rl=(e={})=>{let t=[];return{name:`session`,init(n){var r;if(typeof window>`u`||typeof document>`u`){let e=Date.now(),t=q(`session`);n.setRuntimeAttributes({[J.sessionHasReplay]:!1,[J.sessionId]:t,[J.sessionType]:`user`},e);return}let i=(r=e.storageKey)==null?Il(n.config.transport.endpoint,n.config.application.name):r,a=Fl(i),o=typeof performance<`u`&&Number.isFinite(performance.timeOrigin)?performance.timeOrigin:Date.now(),s,c,l=(e=Date.now())=>Ol(a.read(),e,Al),u=()=>{c!==void 0&&(clearTimeout(c),c=void 0)},d=(e,t=Date.now())=>{let r=s;r&&(n.notifySessionLifecycle({expiredAt:t,id:r,reason:e,type:`expired`}),Ll(n,`end`,r,t),u(),s=void 0,n.setRuntimeAttributes({[J.sessionHasReplay]:void 0,[J.sessionId]:void 0,[J.sessionType]:void 0},t),n.flush())},f=()=>{let e=Date.now(),t=l(e);if(!t){d(`external`,e);return}if(t.status===`expired`){d(t.reason,t.expiredAt);return}if(t.id!==s){d(`external`,e);return}let n=El(t,e,Al);if(!n){p(t);return}let r={expiredAt:e,previousId:t.id,reason:n,status:`expired`};a.write(r),d(n,e)},p=e=>{u();let t=Math.min(e.expiresAt,e.startedAt+Al);c=setTimeout(f,Math.max(0,t-Date.now()))},m=(e,t)=>{let r=e.id!==s;s=e.id,n.setRuntimeAttributes({[J.sessionHasReplay]:!1,[J.sessionId]:e.id,[J.sessionType]:`user`},Math.min(e.startedAt,o)),p(e),r&&t&&n.notifySessionLifecycle({id:e.id,previousId:t.previousId,reason:t.reason,startedAt:e.startedAt,type:`renewed`})},h=(e=!1)=>{let t=Date.now(),r=l(t);if((r==null?void 0:r.status)===`active`&&!El(r,t,Al)){let e=Dl(r,t,kl,Al);a.write(e),m(e,s?void 0:{reason:`shared`});return}let i=(r==null?void 0:r.status)===`expired`?r.previousId:r==null?void 0:r.id,o=(r==null?void 0:r.status)===`expired`?r.reason:r?El(r,t,Al):e?`init`:void 0,c=Tl(q(`session`),t,kl,Al);a.write(c),m(c,{previousId:i,reason:o==null?`init`:o}),Ll(n,(o==null?`init`:o)===`init`?`start`:`rotate`,c.id,c.startedAt)},g=()=>{if(!s)return;let e=Date.now(),t=l(e);if((t==null?void 0:t.status)!==`active`||t.id!==s||El(t,e,Al)){f();return}let n=Dl(t,e,kl,Al);a.write(n),m(n)};h(!0);let _=0,v=()=>{let e=Date.now();e-_<jl||(_=e,h())},y={capture:!0,passive:!0};Nl.forEach(e=>window.addEventListener(e,v,y)),t.push(()=>{Nl.forEach(e=>window.removeEventListener(e,v,y))});let b=()=>{document.visibilityState===`visible`&&g()};document.addEventListener(`visibilitychange`,b);let x=window.setInterval(b,Ml);t.push(()=>{document.removeEventListener(`visibilitychange`,b),window.clearInterval(x)});let S=e=>{if(!a.isLocalStorage()||e.storageArea!==window.localStorage||e.key!==i)return;let t=Date.now(),n=Ol(e.newValue,t,Al);if((n==null?void 0:n.status)===`active`&&n.id===s&&!El(n,t,Al)){p(n);return}d((n==null?void 0:n.status)===`expired`?n.reason:`external`,(n==null?void 0:n.status)===`expired`?n.expiredAt:t)};window.addEventListener(`storage`,S),t.push(()=>window.removeEventListener(`storage`,S)),t.push(u)},shutdown(){for(var e;t.length;)(e=t.pop())==null||e()}}},zl=n({CLSThresholds:()=>uu,FCPThresholds:()=>cu,INPThresholds:()=>wu,LCPThresholds:()=>Du,TTFBThresholds:()=>ku,onCLS:()=>fu,onFCP:()=>pu,onINP:()=>Tu,onLCP:()=>Ou,onTTFB:()=>ju});function Bl(e,t){return Kl.get(e)||Kl.set(e,new t),Kl.get(e)}var Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu=t((()=>{I(),G(),Vl=class{constructor(){F(this,`t`,void 0),F(this,`o`,0),F(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)}},Hl=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Ul=e=>{if(document.readyState===`loading`)return`loading`;let t=Hl();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`},Wl=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},Gl=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#`+n.id:[Wl(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},Kl=new WeakMap,ql=-1,Jl=()=>ql,Yl=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(ql=t.timeStamp,e(t))},!0)},Xl=(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)))}},Zl=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Ql=()=>{var e,t;return(e=(t=Hl())==null?void 0:t.activationStart)==null?0:e},$l=(e,t=-1)=>{let n=Hl(),r=`navigate`;return Jl()>=0?r=`back-forward-cache`:n&&(document.prerendering||Ql()>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}},eu=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return r.observe(W({type:e,buffered:!0},n)),r}}catch(e){}},tu=e=>{let t=!1;return()=>{t||(e(),t=!0)}},nu=-1,ru=new Set,iu=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,au=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of ru)e();isFinite(nu)||(nu=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,au,!0))}},ou=()=>{if(nu<0){var e;let t=Ql(),n=document.prerendering||(e=globalThis.performance.getEntriesByType(`visibility-state`).find(e=>e.name===`hidden`&&e.startTime>=t))==null?void 0:e.startTime;nu=n==null?iu():n,addEventListener(`visibilitychange`,au,!0),addEventListener(`prerenderingchange`,au,!0),Yl(()=>{setTimeout(()=>{nu=iu()})})}return{get firstHiddenTime(){return nu},onHidden(e){ru.add(e)}}},su=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},cu=[1800,3e3],lu=(e,t={})=>{su(()=>{let n=ou(),r,i=$l(`FCP`),a=eu(`paint`,e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Ql(),0),i.entries.push(t),r(!0)))});a&&(r=Xl(e,i,cu,t.reportAllChanges),Yl(n=>{i=$l(`FCP`),r=Xl(e,i,cu,t.reportAllChanges),Zl(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},uu=[.1,.25],du=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],fu=(e,t={})=>{let n=Bl(t=Object.assign({},t),Vl),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=du(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?Gl(o):i;r.set(n,e)}}},((e,t={})=>{let n=ou();lu(tu(()=>{let r,i=$l(`CLS`,0),a=Bl(t,Vl),o=e=>{for(let t of e)a.u(t);a.o>i.value&&(i.value=a.o,i.entries=a.i,r())},s=eu(`layout-shift`,o);s&&(r=Xl(e,i,uu,t.reportAllChanges),n.onHidden(()=>{o(s.takeRecords()),r(!0)}),Yl(()=>{a.o=0,i=$l(`CLS`,0),r=Xl(e,i,uu,t.reportAllChanges),Zl(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=du(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:Ul(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},pu=(e,t={})=>{lu(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Ul(Jl())};if(e.entries.length){let n=Hl(),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:Ul(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})})(t))},t)},mu=0,hu=1/0,gu=0,_u=e=>{for(let t of e)t.interactionId&&(hu=Math.min(hu,t.interactionId),gu=Math.max(gu,t.interactionId),mu=gu?(gu-hu)/7+1:0)},yu=()=>{var e;return vu?mu:(e=performance.interactionCount)==null?0:e},bu=()=>{`interactionCount`in performance||vu||(vu=eu(`event`,_u,{durationThreshold:0}))},xu=0,Su=class{constructor(){F(this,`l`,[]),F(this,`h`,new Map),F(this,`m`,void 0),F(this,`p`,void 0)}v(){xu=yu(),this.l.length=0,this.h.clear()}M(){let e=Math.min(this.l.length-1,Math.floor((yu()-xu)/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)}}},Cu=e=>{let t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let r=tu(e),i=-1,a=()=>{n(i),r()};addEventListener(`visibilitychange`,a,{once:!0,capture:!0}),i=t(()=>{removeEventListener(`visibilitychange`,a,{capture:!0}),r()})}},wu=[200,500],Tu=(e,t={})=>{let n=Bl(t=Object.assign({},t),Su),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(Cu(u),c=!0)},u=()=>{let e=new Set(n.l.map(e=>o.get(e.entries[0]))),t=i.length-10;i=i.filter((n,r)=>r>=t||e.has(n));let s=new Set;for(let e of i){let t=d(e.startTime,e.processingEnd);for(let e of t)s.add(e)}r=r.filter(e=>e.startTime>a||s.has(e)),c=!1};n.m=e=>{let n=e.startTime+e.duration,r;a=Math.max(a,e.processingEnd);for(let a=i.length-1;a>=0;a--){let o=i[a];if(Math.abs(n-o.renderTime)<=8){r=o,r.startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),!1!==t.includeProcessedEventEntries&&r.entries.push(e);break}}r||(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:!1===t.includeProcessedEventEntries?[]:[e]},i.push(r)),(e.interactionId||e.entryType===`first-input`)&&o.set(e,r),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?Gl(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:Ul(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})};eu(`long-animation-frame`,e=>{r=r.concat(e),l()}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=ou();su(()=>{var r;bu();let i,a=$l(`INP`),o=Bl(t,Su),s=e=>{Cu(()=>{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=eu(`event`,s,{durationThreshold:(r=t.durationThreshold)==null?40:r});i=Xl(e,a,wu,t.reportAllChanges),c&&(c.observe({type:`first-input`,buffered:!0}),n.onHidden(()=>{s(c.takeRecords()),i(!0)}),Yl(()=>{o.v(),a=$l(`INP`),i=Xl(e,a,wu,t.reportAllChanges)}))})})(t=>{e(f(t))},t)},Eu=class{constructor(){F(this,`m`,void 0)}u(e){var t;(t=this.m)==null||t.call(this,e)}},Du=[2500,4e3],Ou=(e,t={})=>{let n=Bl(t=Object.assign({},t),Eu),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?Gl(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{su(()=>{let n=ou(),r,i=$l(`LCP`),a=Bl(t,Eu),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-Ql(),0),i.entries=[t],r())},s=eu(`largest-contentful-paint`,o);if(s){r=Xl(e,i,Du,t.reportAllChanges);let n=tu(()=>{o(s.takeRecords()),s.disconnect(),r(!0)}),a=e=>{e.isTrusted&&(Cu(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});Yl(n=>{i=$l(`LCP`),r=Xl(e,i,Du,t.reportAllChanges),Zl(()=>{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=e.entries.at(-1),i=n.url&&performance.getEntriesByType(`resource`).find(e=>e.name===n.url);t.target=r.get(n),t.lcpEntry=n,n.url&&(t.url=n.url),i&&(t.lcpResourceEntry=i);let a=Hl();if(a){let n=a.activationStart||0,r=Math.max(0,a.responseStart-n),o=Math.max(r,i?(i.requestStart||i.startTime)-n:0),s=Math.min(e.value,Math.max(o,i?i.responseEnd-n:0));t=W(W({},t),{},{timeToFirstByte:r,resourceLoadDelay:o-r,resourceLoadDuration:s-o,elementRenderDelay:e.value-s,navigationEntry:a})}}return Object.assign(e,{attribution:t})})(t))},t)},ku=[800,1800],Au=e=>{document.prerendering?su(()=>Au(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>Au(e),!0)},ju=(e,t={})=>{((e,t={})=>{let n=$l(`TTFB`),r=Xl(e,n,ku,t.reportAllChanges);Au(()=>{let i=Hl();i&&(n.value=Math.max(i.responseStart-Ql(),0),n.entries=[i],r(!0),Yl(()=>{n=$l(`TTFB`,0),r=Xl(e,n,ku,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)}}));G();var Nu=10,Pu=6e4,Fu=5e3,Iu=1e3,Lu=(e,t)=>!!t&&e===t,Ru=(e,t)=>{let[n,r]=e===`CLS`?[.1,.25]:[200,500];return t<=n?`good`:t<=r?`needs-improvement`:`poor`},zu=e=>{var t,n,r;if(!(typeof Element>`u`||!(e instanceof Element)))return(t=(n=(r=e.getAttribute(`data-bk-action-name`))==null?e.getAttribute(`aria-label`):r)==null?e.getAttribute(`name`):n)==null?e.tagName.toLowerCase():t},Bu=()=>{if(typeof performance>`u`)return;let e=performance.interactionCount;return typeof e==`number`&&Number.isFinite(e)?e:void 0},Vu=(e,t)=>{var n,r;let i=(n=t.value)==null?0:n;t.hadRecentInput||!Number.isFinite(i)||(e.clsWindowStart===void 0||t.startTime-((r=e.clsWindowEnd)==null?t.startTime:r)>=Iu||t.startTime-e.clsWindowStart>=Fu?(e.clsWindowStart=t.startTime,e.clsWindowValue=i):e.clsWindowValue+=i,e.clsWindowEnd=t.startTime,e.clsWindowValue>e.cls&&(e.cls=Math.round(e.clsWindowValue*1e4)/1e4))},Hu=(e,t)=>{var n,r;if(!t.interactionId||!Number.isFinite(t.duration))return;e.interactionIdMin=Math.min(e.interactionIdMin,t.interactionId),e.interactionIdMax=Math.max(e.interactionIdMax,t.interactionId);let i=(n=t.processingStart)==null?t.startTime:n,a=(r=t.processingEnd)==null?i:r,o={duration:Math.min(t.duration,Pu),inputDelay:Math.max(0,i-t.startTime),interactionId:t.interactionId,interactionTarget:zu(t.target),interactionType:t.name,presentationDelay:Math.max(0,t.startTime+t.duration-a),processingDuration:Math.max(0,a-i)},s=e.inpCandidates.findIndex(e=>e.interactionId===t.interactionId);s>=0?o.duration>e.inpCandidates[s].duration&&(e.inpCandidates[s]=o):e.inpCandidates.push(o),e.inpCandidates.sort((e,t)=>t.duration-e.duration).splice(Nu)},Uu=e=>{let t=Bu(),n=t!==void 0&&e.interactionCountAtStart!==void 0?Math.max(0,t-e.interactionCountAtStart):e.interactionIdMin===1/0?0:(e.interactionIdMax-e.interactionIdMin)/7+1;if(e.inpCandidates.length)return e.inpCandidates[Math.min(e.inpCandidates.length-1,Math.floor(n/50))]},Wu=(e,t)=>{var n;let r=(n=e.attribution)==null?{}:n,i={},a=e=>r[e],o=(e,t,n)=>{t!=null&&(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)&&(i[e]=typeof t==`string`&&n?n(t):t)};switch(e.name){case`LCP`:o(`vital.lcp.url`,a(`url`),t),o(`vital.lcp.target`,a(`target`)),o(`vital.lcp.element_render_delay`,a(`elementRenderDelay`)),o(`vital.lcp.resource_load_duration`,a(`resourceLoadDuration`));break;case`CLS`:o(`vital.cls.load_state`,a(`loadState`));break;case`INP`:o(`vital.inp.interaction_target`,a(`interactionTarget`)),o(`vital.inp.interaction_type`,a(`interactionType`)),o(`vital.inp.input_delay`,a(`inputDelay`)),o(`vital.inp.processing_duration`,a(`processingDuration`)),o(`vital.inp.presentation_delay`,a(`presentationDelay`));break;case`TTFB`:o(`vital.ttfb.waiting_duration`,a(`waitingDuration`)),o(`vital.ttfb.dns_duration`,a(`dnsDuration`)),o(`vital.ttfb.connection_duration`,a(`connectionDuration`)),o(`vital.ttfb.request_duration`,a(`requestDuration`));break;default:break}return i},Gu=()=>{let e,t=!1;return{name:`web-vitals`,init(n){return U(function*(){if(typeof window>`u`)return;let r;try{r=yield Promise.resolve().then(()=>(Mu(),zl))}catch(e){if(n.config.debug){var i;(i=globalThis.console)==null||i.warn(`[bk-ot] web-vitals load failed:`,e)}return}if(t)return;let{onFCP:a,onLCP:o,onTTFB:s}=r,c=(e,t,r,i=r==null?Date.now():r)=>{if(!n.isSampled())return;let a=e.name.toLowerCase(),o=W(W(W(W({},n.config.hooks.getPageAttributes()),t),$({outcome:No(e.rating),spanType:X.vital})),{},{[J.vitalMetric]:a,[J.vitalValue]:e.value,"vital.id":e.id},Wu(e,n.config.hooks.redactUrl));n.startSpan(Q({attributes:o,spanType:X.vital}),o,{contextTime:r,startTime:i}).end(i)},l=e=>{if(t||!Number.isFinite(e.value)||!n.isSampled())return;let r=e.entries[0],i=r&&typeof performance<`u`?performance.timeOrigin+r.startTime:void 0;c(e,i===void 0?n.getRuntimeAttributes():n.getRuntimeAttributesAt(i),i)},u,d,f,p=(e,t,n)=>{c(e,t,n,Date.now())},m=()=>{let e=u;if(!e||!n.isSampled())return;p({attribution:{},entries:[],id:q(`vital`),name:`CLS`,rating:Ru(`CLS`,e.cls),value:e.cls},e.runtimeAttributes,e.startedAt);let t=Uu(e);t&&p({attribution:{inputDelay:t.inputDelay,interactionTarget:t.interactionTarget,interactionType:t.interactionType,presentationDelay:t.presentationDelay,processingDuration:t.processingDuration},entries:[],id:q(`vital`),name:`INP`,rating:Ru(`INP`,t.duration),value:t.duration},e.runtimeAttributes,e.startedAt)},h=n.onViewChange(e=>{var t;let r=u;if(r&&Lu(r.id,e.id)){r.runtimeAttributes=W(W(W({},r.runtimeAttributes),{},{[J.viewId]:e.id},e.name?{[J.viewName]:e.name}:{}),{},{[J.viewUrl]:e.url,[J.viewUrlTemplate]:e.urlTemplate});return}m(),u=e.id?{cls:0,clsWindowValue:0,interactionCountAtStart:Bu(),interactionIdMax:0,interactionIdMin:1/0,inpCandidates:[],id:e.id,runtimeAttributes:n.getRuntimeAttributes(),startedAt:(t=e.startedAt)==null?Date.now():t}:void 0});if(typeof PerformanceObserver<`u`){var g,_;(g=PerformanceObserver.supportedEntryTypes)!=null&&g.includes(`layout-shift`)&&(f=new PerformanceObserver(e=>{if(u)for(let t of e.getEntries())performance.timeOrigin+t.startTime<u.startedAt||Vu(u,t)}),f.observe({buffered:!0,type:`layout-shift`})),(_=PerformanceObserver.supportedEntryTypes)!=null&&_.includes(`event`)&&(d=new PerformanceObserver(e=>{if(u)for(let t of e.getEntries())performance.timeOrigin+t.startTime<u.startedAt||!t.interactionId||!Number.isFinite(t.duration)||Hu(u,t)}),d.observe({buffered:!0,durationThreshold:40,type:`event`}))}a(l),o(l),s(l),e=()=>{m(),u=void 0,h(),f==null||f.disconnect(),d==null||d.disconnect()}})()},shutdown(){t=!0,e==null||e(),e=void 0}}};G();var Ku=(e,t)=>{let n={"network.protocol.name":`websocket`,"url.full":t(e)};try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);n[`server.address`]=t.hostname,t.port&&(n[`server.port`]=Number(t.port)),n[`url.scheme`]=t.protocol.replace(`:`,``)}catch(e){}return n},qu=(e,t,n,r)=>{let i=q(`websocket`),a=Ku(n,t.config.hooks.redactUrl),o=!1,s=(e,n,o={})=>{if(r()||!t.isSampled())return;let s=e===`error`,c=W(W(W({},a),$({outcome:s?Y.error:Y.success,spanType:X.websocket})),{},{[J.websocketPhase]:e,"websocket.connection.id":i},o);t.startSpan(Q({attributes:c,spanType:X.websocket}),c,{kind:Ve.CLIENT,startTime:n}).end(n)};s(`connect`,Date.now()),e.addEventListener(`open`,()=>{o=!0,s(`open`,Date.now())}),e.addEventListener(`error`,()=>{s(`error`,Date.now(),{"websocket.error.phase":o?`runtime`:`connect`})}),e.addEventListener(`close`,e=>{s(`close`,Date.now(),{"websocket.close.code":e.code,"websocket.close.reason":e.reason,"websocket.close.was_clean":e.wasClean})})},Ju=()=>{let e,t,n=!1;return{name:`websocket`,init(r){if(typeof window>`u`||window.WebSocket===void 0)return;let i=window.WebSocket;e=i,t=new Proxy(i,{construct(e,t,i){let a=Reflect.construct(e,t,i);if(n||!r.isSampled())return a;let o=t[0]==null?``:String(t[0]);return o&&!Eo(r.config,o)&&qu(a,r,o,()=>n),a}}),window.WebSocket=t},shutdown(){n=!0,typeof window<`u`&&e&&window.WebSocket===t&&(window.WebSocket=e),t=void 0,e=void 0}}};I();var Yu=class{constructor(){F(this,`listeners`,new Set),F(this,`notify`,e=>{this.listeners.forEach(t=>t(e))}),F(this,`subscribe`,e=>(this.listeners.add(e),()=>this.listeners.delete(e)))}},Xu=`0.0.34`;G();var Zu=e=>e.trim().replace(/\/+$/,``),Qu=e=>{var t;let n=e.token||e.headers?W(W({},e.token?{Authorization:`Bearer ${e.token}`}:{}),(t=e.headers)==null?{}:t):void 0;return{concurrencyLimit:e.concurrencyLimit,endpoint:`${Zu(e.endpoint)}/v1/rum`,headers:n,timeoutMillis:e.timeoutMillis}},$u=e=>typeof e!=`number`||!Number.isFinite(e)?1:Math.max(0,Math.min(1,e)),ed=e=>e,td=e=>{if(!e)return e;try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);return t.username=``,t.password=``,t.search=``,t.hash=``,t.href}catch(t){return e.replace(/[?#].*$/,``)}},nd=e=>{try{return new URL(e,typeof location>`u`?`http://localhost`:location.href).pathname||`/`}catch(t){return e||`/`}},rd=e=>So(nd(e)),id=(e,t)=>n=>{try{let e=t==null?void 0:t(n);if(e)return e}catch(t){var r;e.debug&&((r=globalThis.console)==null||r.warn(`[bk-ot] url template hook failed:`,t))}return rd(n)},ad=e=>{var t;return{environment:(t=e.environment)==null?`production`:t,name:e.name,version:e.version}},od=(e,t,n)=>W(W(W({[J.deploymentEnvironmentName]:e.environment},t===!1?{}:Uc()),{},{[J.serviceName]:e.name},e.version?{[J.serviceVersion]:e.version}:{}),{},{[J.sessionSampleRate]:n,"telemetry.sdk.language":`webjs`,"telemetry.sdk.name":`blueking`,"telemetry.sdk.version":Xu}),sd=e=>{var t;if(!e)throw Error(`[bk-ot] transport is required.`);if(!((t=e.endpoint)!=null&&t.trim()))throw Error(`[bk-ot] transport.endpoint is required.`)},cd=e=>{var t,n,r,i,a,o,s,c,l,u,d,f,p;return{beforeSend:(t=e.tracking)==null?void 0:t.beforeSend,getPageAttributes:(n=(r=e.context)==null||(r=r.attributes)==null?void 0:r.page)==null?(()=>({})):n,getErrorAttributes:(i=(a=e.context)==null||(a=a.attributes)==null?void 0:a.error)==null?(()=>({})):i,getCustomAttributes:(o=(s=e.context)==null||(s=s.attributes)==null?void 0:s.custom)==null?(()=>({})):o,getRequestUrlTemplate:id(e,typeof((c=e.tracking)==null?void 0:c.request)==`object`?e.tracking.request.getUrlTemplate:void 0),getViewUrlTemplate:id(e,typeof((l=e.tracking)==null?void 0:l.view)==`object`?e.tracking.view.getUrlTemplate:void 0),redactAttributes:(u=(d=e.privacy)==null?void 0:d.redactAttributes)==null?ed:u,redactUrl:(f=(p=e.privacy)==null?void 0:p.redactUrl)==null?td:f}},ld=e=>{var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;if(!(!((t=e.application)==null||(t=t.name)==null)&&t.trim()))throw Error(`[bk-ot] application.name is required.`);sd(e.transport);let _=ad(e.application),v=typeof((n=e.tracking)==null?void 0:n.view)==`object`?e.tracking.view:void 0,y=cd(e),b=$u((r=e.session)==null?void 0:r.sampleRate);return{application:_,autoStart:(i=e.autoStart)==null?!0:i,debug:(a=e.debug)==null?!1:a,enabled:(o=e.enabled)==null?!0:o,extensions:{instrumentations:[...(s=(c=e.extensions)==null?void 0:c.instrumentations)==null?[]:s],plugins:[...(l=(u=e.extensions)==null?void 0:u.plugins)==null?[]:l]},hooks:y,resourceAttributes:y.redactAttributes(od(_,(d=e.tracking)==null?void 0:d.device,b)),session:W(W({},e.session),{},{sampleRate:b}),spanBatch:e.transport.batch,spanProcessor:(f=e.transport.processor)==null?`batch`:f,tracking:(p=e.tracking)==null?{}:p,trackingConsent:(m=(h=e.privacy)==null?void 0:h.trackingConsent)==null?`granted`:m,transport:Qu(e.transport),user:(g=e.context)==null?void 0:g.user,view:{excludedActivityUrls:v==null?void 0:v.excludedActivityUrls,loadingTime:(v==null?void 0:v.loadingTime)!==!1,tracking:(v==null?void 0:v.tracking)===`manual`?`manual`:`auto`}}};I();var ud=(e,t)=>typeof e.enabled==`function`?e.enabled(t):e.enabled!==!1,dd=class{constructor(e){F(this,`plugins`,void 0),F(this,`startedPlugins`,[]),this.plugins=e}flush(){var e=this;return U(function*(){yield Promise.all(e.startedPlugins.map(e=>Promise.resolve().then(()=>{var t;return(t=e.flush)==null?void 0:t.call(e)})))})()}shutdown(){var e=this;return U(function*(){let t=[...e.startedPlugins].reverse();for(let e of t){var n;yield(n=e.shutdown)==null?void 0:n.call(e)}e.startedPlugins=[]})()}start(e){var t=this;return U(function*(){for(let r of t.plugins)if(ud(r,e.config))try{yield r.init(e),t.startedPlugins.push(r)}catch(t){if(e.config.debug){var n;(n=globalThis.console)==null||n.warn(`[bk-ot] plugin "${r.name}" init failed:`,t)}}})()}};I(),G();var fd=new Set(Object.values(J)),pd=e=>{if(typeof e==`string`&&e.length>0)return e;if(Array.isArray(e))for(let t=e.length-1;t>=0;--t){let n=e[t];if(typeof n==`string`&&n.length>0)return n}},md=class{constructor(e={},t){F(this,`actionHistory`,[]),F(this,`attributes`,{}),F(this,`queuedViewCommands`,[]),F(this,`recordAssociation`,(e,t,n,r)=>{let i=e.at(-1);if(i&&i.endedAt===void 0&&(i.endedAt=Math.max(i.startedAt,n)),r){let r={};for(let e of t){let t=this.attributes[e];t!==void 0&&(r[e]=t)}e.push({attributes:r,startedAt:n})}e.length>100&&e.splice(0,e.length-100)}),F(this,`sessionHistory`,[]),F(this,`sampled`,!1),F(this,`samplingHistory`,[]),F(this,`sessionLifecycleListeners`,new Set),F(this,`setOptionalAttribute`,(e,t)=>{if(t===void 0){delete this.attributes[e];return}this.attributes[e]=t}),F(this,`user`,{}),F(this,`view`,{}),F(this,`viewAttributeKeys`,new Set),F(this,`viewChangeListeners`,new Set),F(this,`viewCommandListeners`,new Set),F(this,`viewHistory`,[]),F(this,`viewScopedAttributeKeys`,new Set),F(this,`dispatchViewCommand`,e=>{if(this.viewCommandListeners.size===0){this.queuedViewCommands.push(e);return}this.viewCommandListeners.forEach(t=>t(e))}),F(this,`getAttributes`,()=>W({},this.attributes)),F(this,`getAttributesAt`,e=>{if(!Number.isFinite(e))return this.getAttributes();let t=this.getAttributes(),n=(n,r)=>{for(let e of r)delete t[e];let i=[...n].reverse().find(t=>t.startedAt<=e&&(t.endedAt===void 0||e<t.endedAt));i&&Object.assign(t,i.attributes)};return n(this.sessionHistory,[J.sessionId,J.sessionHasReplay]),n(this.viewHistory,this.viewScopedAttributeKeys),n(this.actionHistory,[J.actionId]),t}),F(this,`getUser`,()=>W({},this.user)),F(this,`getView`,()=>W({},this.view)),F(this,`isSessionActive`,()=>typeof this.attributes[J.sessionId]==`string`),F(this,`isSessionSampledAt`,e=>{var t,n;return Number.isFinite(e)?(t=(n=[...this.samplingHistory].reverse().find(t=>t.startedAt<=e&&(t.endedAt===void 0||e<t.endedAt)))==null?void 0:n.sampled)==null?!1:t:this.sampled}),F(this,`isViewActive`,()=>typeof this.attributes[J.viewId]==`string`),F(this,`notifySessionLifecycle`,e=>{this.sessionLifecycleListeners.forEach(t=>t(e))}),F(this,`onSessionLifecycle`,e=>(this.sessionLifecycleListeners.add(e),()=>this.sessionLifecycleListeners.delete(e))),F(this,`onViewChange`,e=>(this.viewChangeListeners.add(e),this.view.id&&e(this.getView()),()=>this.viewChangeListeners.delete(e))),F(this,`onViewCommand`,e=>{for(this.viewCommandListeners.add(e);this.queuedViewCommands.length;)e(this.queuedViewCommands.shift());return()=>this.viewCommandListeners.delete(e)}),F(this,`setAttributes`,(e,t=Date.now())=>{for(let[t,n]of Object.entries(e)){if(n===void 0){delete this.attributes[t];continue}this.attributes[t]=n}if(J.sessionId in e&&this.recordAssociation(this.sessionHistory,[J.sessionId,J.sessionHasReplay],t,typeof this.attributes[J.sessionId]==`string`),J.actionId in e){let e=pd(this.attributes[J.actionId]);e===void 0?delete this.attributes[J.actionId]:this.attributes[J.actionId]=e,this.recordAssociation(this.actionHistory,[J.actionId],t,typeof this.attributes[J.actionId]==`string`)}}),F(this,`setUser`,e=>{if(this.user=W(W({},this.user),e),`id`in e){if(e.id===void 0){delete this.attributes[J.userId];return}this.attributes[J.userId]=e.id}}),F(this,`setSessionSampled`,(e,t=Date.now())=>{if(e===this.sampled)return;let n=this.samplingHistory.at(-1);n&&n.endedAt===void 0&&(n.endedAt=Math.max(n.startedAt,t)),this.sampled=e,e&&this.samplingHistory.push({sampled:e,startedAt:t}),this.samplingHistory.length>100&&this.samplingHistory.splice(0,this.samplingHistory.length-100)}),F(this,`setView`,(e,t=(t=>(t=e.startedAt)==null?Date.now():t)())=>{var n;this.viewAttributeKeys.forEach(e=>delete this.attributes[e]),this.viewAttributeKeys.clear();let r={};for(let[t,i]of Object.entries((n=e.attributes)==null?{}:n))i===void 0||fd.has(t)||(r[t]=i,this.attributes[t]=i,this.viewAttributeKeys.add(t),this.viewScopedAttributeKeys.add(t));this.view=W(W({},e),{},{attributes:r}),this.setOptionalAttribute(J.viewId,e.id),this.setOptionalAttribute(J.viewUrl,e.url),this.setOptionalAttribute(J.viewUrlTemplate,e.urlTemplate),this.setOptionalAttribute(J.viewLoadingType,e.loadingType),this.setOptionalAttribute(J.viewName,e.name),[J.viewId,J.viewUrl,J.viewUrlTemplate,J.viewLoadingType,J.viewName].forEach(e=>this.viewScopedAttributeKeys.add(e)),this.recordAssociation(this.viewHistory,this.viewScopedAttributeKeys,t,typeof e.id==`string`&&e.id.length>0),this.viewChangeListeners.forEach(e=>e(this.getView()))}),this.setAttributes(e),t&&this.setUser(t)}},hd=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t=Math.imul(t^e.charCodeAt(n),16777619);return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,t+=t<<5,(t>>>0)/4294967296},gd=({application:e,session:t},n)=>t.sampleRate<=0?!1:t.sampleRate>=1?!0:hd(`${e.name}\0${n}`)<t.sampleRate;I(),G();var _d=e=>({url:e.endpoint,headers:e.headers,concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis}),vd=`bk-rum`,yd=class{constructor(e){this.isSampled=e}shouldSample(){return{decision:this.isSampled()?K.RECORD_AND_SAMPLED:K.NOT_RECORD}}toString(){return`RumSessionSampler`}},bd,xd=()=>{if(bd)bd.users+=1;else{let e=new lt().enable(),t=Ue.setGlobalContextManager(e);t||e.disable(),bd={contextManager:t?e:void 0,ownsContext:t,ownsPropagator:Qe.setGlobalPropagator(new Rr),users:1}}let e=!1;return()=>{e||!bd||(e=!0,--bd.users,!(bd.users>0)&&(bd.ownsContext&&Ue.disable(),bd.ownsPropagator&&Qe.disable(),bd=void 0))}},Sd=(e,t)=>t?new Proxy(e,{get(e,t,n){if(t===`export`)return(t,n)=>{var r;return(r=globalThis.console)==null||r.log(`[bk-ot][rum]`,t),e.export(t,n)};let r=Reflect.get(e,t,n);return typeof r==`function`?r.bind(e):r}}):e,Cd=e=>[kc(e.tracking.request)],wd=e=>[Rl(e.session),...Dd(e.tracking.device,!0,Gc),ns(),Sl(),dc(Td(e.tracking.resource,!0))],Td=(e,t)=>e===void 0?t:e!==!1,Ed=e=>typeof e==`object`&&e?e:void 0,Dd=(e,t,n)=>Td(e,t)?[n(Ed(e))]:[],Od=e=>[...Dd(e.error,!0,Jc),...Dd(e.webVitals,!0,Gu),...Dd(e.blankScreen,!0,_s),...Dd(e.action,!0,es),...Dd(e.websocket,!1,Ju),...Dd(e.longTask,!1,el),...Dd(e.cspViolation,!1,Mc)],kd=class{assertBeforeStart(e){if(this.phase!==`idle`)throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`)}createPluginContext(){return{applyRedact:this.applyRedact,config:this.config,flush:this.flush,getRuntimeAttributes:this.getRuntimeAttributes,getRuntimeAttributesAt:this.getRuntimeAttributesAt,isSampled:this.isSampled,isSessionActive:this.isSessionActive,isViewActive:this.isViewActive,notifySessionLifecycle:this.notifySessionLifecycle,notifyActivity:this.activityObserver.notify,onActivity:this.activityObserver.subscribe,onSessionLifecycle:this.onSessionLifecycle,onViewCommand:this.runtimeContext.onViewCommand,onViewChange:this.runtimeContext.onViewChange,registerInstrumentations:this.registerInstrumentations,setRuntimeAttributes:this.setRuntimeAttributes,setUser:this.setUser,setView:this.runtimeContext.setView,startSpan:this.startSpan,tracer:this.tracer}}createPluginManager(){var e;return new dd([...wd(this.config),...Cd(this.config),...Od(this.config.tracking),...(e=this.config.extensions.plugins)==null?[]:e])}constructor(e){var t=this;F(this,`activityObserver`,new Yu),F(this,`flushProviders`,U(function*(){yield t.tracerProvider.forceFlush()})),F(this,`phase`,`idle`),F(this,`pluginManager`,void 0),F(this,`registeredInstrumentations`,void 0),F(this,`releaseOtelGlobals`,void 0),F(this,`runtimeContext`,void 0),F(this,`sampled`,!1),F(this,`startCollection`,U(function*(){if(t.pluginManager||!t.config.enabled||t.config.trackingConsent!==`granted`)return;t.releaseOtelGlobals=xd();let e=t.createPluginManager();t.pluginManager=e;try{var n;yield e.start(t.createPluginContext()),t.registerInstrumentations((n=t.config.extensions.instrumentations)==null?[]:n)}catch(n){var r,i,a;for(yield e.shutdown(),t.pluginManager=void 0;t.registeredInstrumentations.length;)(r=t.registeredInstrumentations.pop())==null||(i=r.disable)==null||i.call(r);throw(a=t.releaseOtelGlobals)==null||a.call(t),t.releaseOtelGlobals=void 0,n}})),F(this,`stopCollection`,function(){var e=U(function*(e){var n,r,i;let a=t.pluginManager;if(a){for(yield a.shutdown(),t.pluginManager=void 0;t.registeredInstrumentations.length;)(n=t.registeredInstrumentations.pop())==null||(r=n.disable)==null||r.call(n);t.setRuntimeAttributes({[J.sessionHasReplay]:void 0,[J.sessionId]:void 0}),e&&(yield t.flushProviders()),(i=t.releaseOtelGlobals)==null||i.call(t),t.releaseOtelGlobals=void 0}});return function(t){return e.apply(this,arguments)}}()),F(this,`teardownCallbacks`,[]),F(this,`tracerProvider`,void 0),F(this,`applyRedact`,e=>this.config.hooks.redactAttributes(e)),F(this,`config`,void 0),F(this,`flush`,U(function*(){var e;yield(e=t.pluginManager)==null?void 0:e.flush(),yield t.flushProviders()})),F(this,`getRuntimeAttributes`,()=>this.runtimeContext.getAttributes()),F(this,`getRuntimeAttributesAt`,e=>this.runtimeContext.getAttributesAt(e)),F(this,`isSampled`,()=>this.sampled),F(this,`isSessionActive`,()=>this.runtimeContext.isSessionActive()),F(this,`isViewActive`,()=>this.runtimeContext.isViewActive()),F(this,`notifySessionLifecycle`,e=>{this.runtimeContext.notifySessionLifecycle(e)}),F(this,`onSessionLifecycle`,e=>this.runtimeContext.onSessionLifecycle(e)),F(this,`registerInstrumentations`,e=>{e.length&&(e.forEach(e=>{e.setTracerProvider(this.tracerProvider),e.getConfig().enabled||e.enable()}),this.registeredInstrumentations.push(...e))}),F(this,`reportAction`,({attributes:e={},name:t})=>{if(!this.isSampled())return;let n=q(`action`),r=Date.now(),i=W(W(W(W({},this.config.hooks.getPageAttributes()),e),$({spanType:X.action})),{},{[J.actionId]:n,[J.actionName]:t,[J.actionType]:`custom`});this.startSpan(Q({attributes:i,spanType:X.action}),i,{rumSpanType:X.action,startTime:r}).end(r)}),F(this,`reportCustomEvent`,({attributes:e={},error:t,name:n})=>{if(!this.isSampled()){if(this.config.debug){var r;(r=globalThis.console)==null||r.warn(`[bk-ot] custom event dropped (not sampled):`,n)}return}let i=Date.now(),a=W(W(W(W({},this.config.hooks.getPageAttributes()),this.config.hooks.getCustomAttributes()),e),$({outcome:t?Y.error:Y.success,spanType:X.custom})),o=this.startSpan(Q({attributes:a,nameHint:n,spanType:X.custom}),a,{startTime:i});t&&(o.recordException(t),o.setStatus({code:He.ERROR,message:t.message})),o.end(i)}),F(this,`setRuntimeAttributes`,(e,t)=>{let n=W({},e),r=t==null?Date.now():t;if(J.sessionId in e){let t=e[J.sessionId];this.sampled=this.config.enabled&&typeof t==`string`&&t.length>0?gd(this.config,t):!1,this.runtimeContext.setSessionSampled(this.sampled,r)}this.runtimeContext.setAttributes(n,r)}),F(this,`setTrackingConsent`,function(){var e=U(function*(e){t.config.trackingConsent!==e&&(t.config.trackingConsent=e,t.phase===`started`&&(e===`granted`?yield t.startCollection():yield t.stopCollection(!0)))});return function(t){return e.apply(this,arguments)}}()),F(this,`setUser`,e=>{this.runtimeContext.setUser(e)}),F(this,`setViewLoadingTime`,()=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({time:Date.now(),type:`set_loading_time`})}),F(this,`setViewName`,e=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({name:e,type:`set_name`})}),F(this,`shutdown`,U(function*(){if(t.phase!==`stopped`){for(yield t.stopCollection(!1),yield t.flushProviders();t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}yield t.tracerProvider.shutdown(),t.phase=`stopped`}})),F(this,`start`,U(function*(){if(!(t.phase===`started`||t.phase===`starting`)){if(t.phase===`stopped`)throw Error(`[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.`);if(!t.config.enabled){t.phase=`started`;return}t.phase=`starting`;try{if(yield t.startCollection(),typeof window<`u`&&typeof document<`u`){let e=()=>{t.flush()},n=()=>{document.visibilityState===`hidden`&&t.flush()};window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,n),t.teardownCallbacks.push(()=>window.removeEventListener(`pagehide`,e),()=>document.removeEventListener(`visibilitychange`,n))}}catch(n){for(;t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}throw yield t.stopCollection(!1),t.phase=`idle`,n}t.phase=`started`}})),F(this,`startSpan`,(e,t={},n)=>{var r,i;let a=(r=n==null?void 0:n.contextTime)==null?typeof(n==null?void 0:n.startTime)==`number`?n.startTime:void 0:r;if(!this.isSampled()||a!==void 0&&!this.runtimeContext.isSessionSampledAt(a))return this.tracer.startSpan(e);let o=a===void 0?this.getRuntimeAttributes():this.runtimeContext.getAttributesAt(a),s=this.applyRedact(W(W({},o),t)),c=n!=null&&n.rumSpanType?Q({attributes:s,spanType:n.rumSpanType}):e;return this.tracer.startSpan(c,{kind:(i=n==null?void 0:n.kind)==null?Ve.INTERNAL:i,links:n==null?void 0:n.links,startTime:n==null?void 0:n.startTime,attributes:s})}),F(this,`startView`,(e={})=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({options:e,type:`start`})}),F(this,`tracer`,void 0),F(this,`use`,e=>{var t;return this.assertBeforeStart(`use`),(t=this.config.extensions.plugins)==null||t.push(e),this}),F(this,`useInstrumentation`,e=>{var t;return this.assertBeforeStart(`useInstrumentation`),this.config.enabled&&((t=this.config.extensions.instrumentations)==null||t.push(e)),this}),this.config=ld(e),this.runtimeContext=new md({},this.config.user);let n=Ni(this.config.resourceAttributes),r=(()=>{let e=Sd(new Aa(_d(this.config.transport)),this.config.debug);return[new Es(this.config.spanProcessor===`simple`?new mo(e):new Ka(e,this.config.spanBatch),this.config,()=>this.applyRedact(W(W({},this.runtimeContext.getAttributes()),this.config.hooks.getPageAttributes())))]})();this.tracerProvider=new vo({resource:n,sampler:new yd(this.isSampled),spanProcessors:r}),this.tracer=this.tracerProvider.getTracer(vd),this.registeredInstrumentations=[],this.config.autoStart&&this.start().catch(e=>{var t;(t=globalThis.console)==null||t.warn(`[bk-ot] auto start failed:`,e)})}};return typeof window<`u`&&Object.assign(window,{BkOpenTelemetry:kd}),kd})();
1
+ var BkOpenTelemetry=(function(){var e=`1.9.1`,t=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function n(e){let n=new Set([e]),r=new Set,i=e.match(t);if(!i)return()=>!1;let 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 r.add(e),!1}function s(e){return n.add(e),!0}return function(e){if(n.has(e))return!0;if(r.has(e))return!1;let i=e.match(t);if(!i)return o(e);let 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 r=n(e),i=e.split(`.`)[0],a=Symbol.for(`opentelemetry.js.api.${i}`),o=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function s(t,n,r,i=!1){var s;let c=o[a]=(s=o[a])==null?{version:e}:s;if(!i&&c[t]){let e=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return r.error(e.stack||e.message),!1}if(c.version!==`1.9.1`){let n=Error(`@opentelemetry/api: Registration of version v${c.version} for ${t} does not match previously registered API v${e}`);return r.error(n.stack||n.message),!1}return c[t]=n,r.debug(`@opentelemetry/api: Registered a global for ${t} v${e}.`),!0}function c(e){var t,n;let i=(t=o[a])==null?void 0:t.version;if(!(!i||!r(i)))return(n=o[a])==null?void 0:n[e]}function l(t,n){n.debug(`@opentelemetry/api: Unregistering a global for ${t} v${e}.`);let r=o[a];r&&delete r[t]}var u=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return d(`debug`,this._namespace,e)}error(...e){return d(`error`,this._namespace,e)}info(...e){return d(`info`,this._namespace,e)}warn(...e){return d(`warn`,this._namespace,e)}verbose(...e){return d(`verbose`,this._namespace,e)}};function d(e,t,n){let r=c(`diag`);if(r)return r[e](t,...n)}var f;(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`})(f||(f={}));function p(e,t){e<f.NONE?e=f.NONE:e>f.ALL&&(e=f.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,f.ERROR),warn:n(`warn`,f.WARN),info:n(`info`,f.INFO),debug:n(`debug`,f.DEBUG),verbose:n(`verbose`,f.VERBOSE)}}var m=`diag`,h=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=c(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:f.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=c(`diag`),l=p((i=n.logLevel)==null?f.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),l.warn(`Current logger will overwrite one already registered from ${e}`)}return s(`diag`,l,t,!0)},t.disable=()=>{l(m,t)},t.createComponentLogger=e=>new u(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}},g=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}},_=Symbol(`BaggageEntryMetadata`),v=h.instance();function y(e={}){return new g(new Map(Object.entries(e)))}function b(e){return typeof e!=`string`&&(v.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:_,toString(){return e}}}function x(e){return Symbol.for(e)}var S=new class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},C=class{constructor(){}createGauge(e,t){return F}createHistogram(e,t){return I}createCounter(e,t){return P}createUpDownCounter(e,t){return ee}createObservableGauge(e,t){return ne}createObservableCounter(e,t){return te}createObservableUpDownCounter(e,t){return re}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},w=class{},T=class extends w{add(e,t){}},E=class extends w{add(e,t){}},D=class extends w{record(e,t){}},O=class extends w{record(e,t){}},k=class{addCallback(e){}removeCallback(e){}},A=class extends k{},j=class extends k{},M=class extends k{},N=new C,P=new T,F=new D,I=new O,ee=new E,te=new A,ne=new j,re=new M;function ie(){return N}var ae={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},oe={set(e,t,n){e!=null&&(e[t]=n)}},se=class{active(){return S}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}},ce=`context`,le=new se,ue=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return s(ce,e,h.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return c(ce)||le}disable(){this._getContextManager().disable(),l(ce,h.instance())}},L;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(L||(L={}));var de={traceId:`00000000000000000000000000000000`,spanId:`0000000000000000`,traceFlags:L.NONE},fe=class{constructor(e=de){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}},pe=x(`OpenTelemetry Context Key SPAN`);function me(e){return e.getValue(pe)||void 0}function he(){return me(ue.getInstance().active())}function ge(e,t){return e.setValue(pe,t)}function _e(e){return e.deleteValue(pe)}function ve(e,t){return ge(e,new fe(t))}function ye(e){var t;return(t=me(e))==null?void 0:t.spanContext()}var be=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 xe(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(be[e.charCodeAt(t)]|0)+(be[e.charCodeAt(t+1)]|0)+(be[e.charCodeAt(t+2)]|0)+(be[e.charCodeAt(t+3)]|0);return n===t}function Se(e){return xe(e,32)&&e!==`00000000000000000000000000000000`}function Ce(e){return xe(e,16)&&e!==`0000000000000000`}function we(e){return Se(e.traceId)&&Ce(e.spanId)}function Te(e){return new fe(e)}var Ee=ue.getInstance(),De=class{startSpan(e,t,n=Ee.active()){if(t!=null&&t.root)return new fe;let r=n&&ye(n);return Oe(r)&&we(r)?new fe(r):new fe}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a==null?Ee.active():a,c=this.startSpan(e,i,s),l=ge(s,c);return Ee.with(l,o,void 0,c)}};function Oe(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var ke=new De,Ae=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ke}},je=new class{getTracer(e,t,n){return new De}},Me=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new Ae(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?je:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}},Ne;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Ne||(Ne={}));var Pe;(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`})(Pe||(Pe={}));var Fe;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Fe||(Fe={}));var Ie=ue.getInstance(),R=h.instance(),Le=class{inject(e,t){}extract(e,t){return e}fields(){return[]}},Re=x(`OpenTelemetry Baggage Key`);function ze(e){return e.getValue(Re)||void 0}function Be(){return ze(ue.getInstance().active())}function Ve(e,t){return e.setValue(Re,t)}function He(e){return e.deleteValue(Re)}var Ue=`propagation`,We=new Le,Ge=class e{constructor(){this.createBaggage=y,this.getBaggage=ze,this.getActiveBaggage=Be,this.setBaggage=Ve,this.deleteBaggage=He}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return s(Ue,e,h.instance())}inject(e,t,n=oe){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=ae){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){l(Ue,h.instance())}_getGlobalPropagator(){return c(Ue)||We}}.getInstance(),Ke=`trace`,qe=class e{constructor(){this._proxyTracerProvider=new Me,this.wrapSpanContext=Te,this.isSpanContextValid=we,this.deleteSpan=_e,this.getSpan=me,this.getActiveSpan=he,this.getSpanContext=ye,this.setSpan=ge,this.setSpanContext=ve}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=s(Ke,this._proxyTracerProvider,h.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return c(Ke)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){l(Ke,h.instance()),this._proxyTracerProvider=new Me}}.getInstance();function Je(e){return typeof e==`object`&&!!e&&`addEventListener`in e&&typeof e.addEventListener==`function`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`}function Ye(e){"@babel/helpers - typeof";return Ye=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},Ye(e)}function Xe(e,t){if(Ye(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ye(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ze(e){var t=Xe(e,`string`);return Ye(t)==`symbol`?t:t+``}function z(e,t,n){return(t=Ze(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qe=`OT_ZONE_CONTEXT`,$e=class{constructor(){z(this,`_enabled`,!1)}_bindFunction(e,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}_bindListener(e,t){let n=t;return n.__ot_listeners===void 0?(n.__ot_listeners={},typeof n.addEventListener==`function`&&(n.addEventListener=this._patchAddEventListener(n,n.addEventListener,e)),typeof n.removeEventListener==`function`&&(n.removeEventListener=this._patchRemoveEventListener(n,n.removeEventListener)),t):t}_createZone(e,t){return Zone.current.fork({name:e,properties:{[Qe]:t},onCancelTask(e,t,n,r){return r.state===`notScheduled`||r.state===`running`?r:e.cancelTask(n,r)}})}_patchAddEventListener(e,t,n){let r=this;return function(i,a,o){e.__ot_listeners===void 0&&(e.__ot_listeners={});let s=e.__ot_listeners[i];s===void 0&&(s=new WeakMap,e.__ot_listeners[i]=s);let c=r.bind(n,a);return s.set(a,c),t.call(this,i,c,o)}}_patchRemoveEventListener(e,t){return function(n,r){if(e.__ot_listeners===void 0||e.__ot_listeners[n]===void 0)return t.call(this,n,r);let i=e.__ot_listeners[n],a=i.get(r);return i.delete(r),t.call(this,n,a||r)}}active(){return!this._enabled||!Zone.current?S:Zone.current.get(Qe)||S}bind(e,t){return typeof t==`function`?this._bindFunction(e,t):(Je(t)&&this._bindListener(e,t),t)}disable(){return this._enabled=!1,this}enable(){return this._enabled=!0,this}with(e,t,n,...r){let i=`otel:with`;return t.name&&(i+=`:${t.name}`),this._createZone(i,e).run(t,n,r)}},et=Object.defineProperty,tt=Object.defineProperties,nt=Object.getOwnPropertyDescriptors,rt=Object.getOwnPropertySymbols,it=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,ot=(e,t,n)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,st=(e,t)=>{for(var n in t||(t={}))it.call(t,n)&&ot(e,n,t[n]);if(rt)for(var n of rt(t))at.call(t,n)&&ot(e,n,t[n]);return e},ct=(e,t)=>tt(e,nt(t)),B=(e,t,n)=>(ot(e,typeof t==`symbol`?t:t+``,n),n),V=globalThis;function H(e){return(V.__Zone_symbol_prefix||`__zone_symbol__`)+e}function lt(){let e=V.performance;function t(t){e&&e.mark&&e.mark(t)}function n(t,n){e&&e.measure&&e.measure(t,n)}t(`Zone`);let r=class e{constructor(e,t){B(this,`_parent`),B(this,`_name`),B(this,`_properties`),B(this,`_zoneDelegate`),this._parent=e,this._name=t?t.name||`unnamed`:`<root>`,this._properties=t&&t.properties||{},this._zoneDelegate=new o(this,this._parent&&this._parent._zoneDelegate,t)}static assertZonePatched(){if(V.Promise!==O.ZoneAwarePromise)throw Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let t=e.current;for(;t.parent;)t=t.parent;return t}static get current(){return A.zone}static get currentTask(){return j}static __load_patch(r,i,a=!1){if(O.hasOwnProperty(r)){let e=V[H(`forceDuplicateZoneCheck`)]===!0;if(!a&&e)throw Error(`Already loaded patch: `+r)}else if(!V[`__Zone_disable_`+r]){let a=`Zone:`+r;t(a),O[r]=i(V,e,k),n(a,a)}}get parent(){return this._parent}get name(){return this._name}get(e){let t=this.getZoneWith(e);if(t)return t._properties[e]}getZoneWith(e){let t=this;for(;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null}fork(e){if(!e)throw Error(`ZoneSpec required!`);return this._zoneDelegate.fork(this,e)}wrap(e,t){if(typeof e!=`function`)throw Error(`Expecting function got: `+e);let n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}}run(e,t,n,r){A={parent:A,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{A=A.parent}}runGuarded(e,t=null,n,r){A={parent:A,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{A=A.parent}}runTask(e,t,n){if(e.zone!=this)throw Error(`A task can only be run in the zone of creation! (Creation: `+(e.zone||v).name+`; Execution: `+this.name+`)`);let r=e,{type:i,data:{isPeriodic:a=!1,isRefreshable:o=!1}={}}=e;if(e.state===y&&(i===D||i===E))return;let s=e.state!=S;s&&r._transitionTo(S,x);let c=j;j=r,A={parent:A,zone:this};try{i==E&&e.data&&!a&&!o&&(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,r,t,n)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{let t=e.state;if(t!==y&&t!==w)if(i==D||a||o&&t===b)s&&r._transitionTo(x,S,b);else{let e=r._zoneDelegates;this._updateTaskCount(r,-1),s&&r._transitionTo(y,S,y),o&&(r._zoneDelegates=e)}A=A.parent,j=c}}scheduleTask(e){if(e.zone&&e.zone!==this){let t=this;for(;t;){if(t===e.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${e.zone.name}`);t=t.parent}}e._transitionTo(b,y);let t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(w,b,y),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==b&&e._transitionTo(x,b),e}scheduleMicroTask(e,t,n,r){return this.scheduleTask(new s(T,e,t,n,r,void 0))}scheduleMacroTask(e,t,n,r,i){return this.scheduleTask(new s(E,e,t,n,r,i))}scheduleEventTask(e,t,n,r,i){return this.scheduleTask(new s(D,e,t,n,r,i))}cancelTask(e){if(e.zone!=this)throw Error(`A task can only be cancelled in the zone of creation! (Creation: `+(e.zone||v).name+`; Execution: `+this.name+`)`);if(!(e.state!==x&&e.state!==S)){e._transitionTo(C,x,S);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(w,C),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,C),e.runCount=-1,e}}_updateTaskCount(e,t){let n=e._zoneDelegates;t==-1&&(e._zoneDelegates=null);for(let r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)}};B(r,`__symbol__`,H);let i=r,a={name:``,onHasTask:(e,t,n,r)=>e.hasTask(n,r),onScheduleTask:(e,t,n,r)=>e.scheduleTask(n,r),onInvokeTask:(e,t,n,r,i,a)=>e.invokeTask(n,r,i,a),onCancelTask:(e,t,n,r)=>e.cancelTask(n,r)};class o{constructor(e,t,n){B(this,`_zone`),B(this,`_taskCounts`,{microTask:0,macroTask:0,eventTask:0}),B(this,`_forkDlgt`),B(this,`_forkZS`),B(this,`_forkCurrZone`),B(this,`_interceptDlgt`),B(this,`_interceptZS`),B(this,`_interceptCurrZone`),B(this,`_invokeDlgt`),B(this,`_invokeZS`),B(this,`_invokeCurrZone`),B(this,`_handleErrorDlgt`),B(this,`_handleErrorZS`),B(this,`_handleErrorCurrZone`),B(this,`_scheduleTaskDlgt`),B(this,`_scheduleTaskZS`),B(this,`_scheduleTaskCurrZone`),B(this,`_invokeTaskDlgt`),B(this,`_invokeTaskZS`),B(this,`_invokeTaskCurrZone`),B(this,`_cancelTaskDlgt`),B(this,`_cancelTaskZS`),B(this,`_cancelTaskCurrZone`),B(this,`_hasTaskDlgt`),B(this,`_hasTaskDlgtOwner`),B(this,`_hasTaskZS`),B(this,`_hasTaskCurrZone`),this._zone=e,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this._zone:t._forkCurrZone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this._zone:t._interceptCurrZone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this._zone:t._invokeCurrZone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this._zone:t._handleErrorCurrZone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this._zone:t._scheduleTaskCurrZone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this._zone:t._invokeTaskCurrZone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this._zone:t._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;let r=n&&n.onHasTask,i=t&&t._hasTaskZS;(r||i)&&(this._hasTaskZS=r?n:a,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,n.onScheduleTask||(this._scheduleTaskZS=a,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this._zone),n.onInvokeTask||(this._invokeTaskZS=a,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this._zone),n.onCancelTask||(this._cancelTaskZS=a,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this._zone))}get zone(){return this._zone}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new i(e,t)}intercept(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t}invoke(e,t,n,r,i){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,i):t.apply(n,r)}handleError(e,t){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t):!0}scheduleTask(e,t){let n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t),n||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else if(t.type==T)g(t);else throw Error(`Task is missing scheduleFn.`);return n}invokeTask(e,t,n,r){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,r):t.callback.apply(n,r)}cancelTask(e,t){let n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error(`Task is not cancelable`);n=t.cancelFn(t)}return n}hasTask(e,t){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(t){this.handleError(e,t)}}_updateTaskCount(e,t){let n=this._taskCounts,r=n[e],i=n[e]=r+t;if(i<0)throw Error(`More tasks executed then were scheduled.`);if(r==0||i==0){let t={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this._zone,t)}}}class s{constructor(e,t,n,r,i,a){if(B(this,`type`),B(this,`source`),B(this,`invoke`),B(this,`callback`),B(this,`data`),B(this,`scheduleFn`),B(this,`cancelFn`),B(this,`_zone`,null),B(this,`runCount`,0),B(this,`_zoneDelegates`,null),B(this,`_state`,`notScheduled`),this.type=e,this.source=t,this.data=r,this.scheduleFn=i,this.cancelFn=a,!n)throw Error(`callback is not defined`);this.callback=n;let o=this;e===D&&r&&r.useG?this.invoke=s.invokeTask:this.invoke=function(){return s.invokeTask.call(V,o,this,arguments)}}static invokeTask(e,t,n){e||(e=this),M++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{M===1&&!V[d]&&_(),M--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(y,b)}_transitionTo(e,t,n){if(this._state===t||this._state===n)this._state=e,e==y&&(this._zoneDelegates=null);else throw Error(`${this.type} '${this.source}': can not transition to '${e}', expecting state '${t}'${n?` or '`+n+`'`:``}, was '${this._state}'.`)}toString(){return this.data&&this.data.handleId!==void 0?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}let c=H(`setTimeout`),l=H(`Promise`),u=H(`then`),d=H(`enable_native_microtask_draining`),f=[],p=!1,m;function h(e){var t;!m&&V[l]&&(m=V[l].resolve(0)),m?((t=m[u])==null?m.then:t).call(m,e):V[c](e,0)}function g(e){let t=V[d],n=t&&f.length===0&&!p,r=!t&&M===0&&f.length===0;(n||r)&&h(_),e&&f.push(e)}function _(){if(!p){for(p=!0;f.length;){let e=f;f=[];for(let t of e)try{t.zone.runTask(t,null,null)}catch(e){k.onUnhandledError(e)}}V[d]?(p=!1,k.microtaskDrainDone()):(k.microtaskDrainDone(),p=!1)}}let v={name:`NO ZONE`},y=`notScheduled`,b=`scheduling`,x=`scheduled`,S=`running`,C=`canceling`,w=`unknown`,T=`microTask`,E=`macroTask`,D=`eventTask`,O={},k={symbol:H,currentZoneFrame:()=>A,onUnhandledError:N,microtaskDrainDone:N,scheduleMicroTask:g,showUncaughtError:()=>!i[H(`ignoreConsoleErrorUncaughtError`)],patchEventTarget:()=>[],patchOnProperties:N,patchMethod:()=>N,bindArguments:()=>[],patchThen:()=>N,patchMacroTask:()=>N,patchEventPrototype:()=>N,getGlobalObjects:()=>void 0,ObjectDefineProperty:()=>N,ObjectGetOwnPropertyDescriptor:()=>void 0,ObjectCreate:()=>void 0,ArraySlice:()=>[],patchClass:()=>N,wrapWithCurrentZone:()=>N,filterProperties:()=>[],attachOriginToPatched:()=>N,_redefineProperty:()=>N,patchCallbacks:()=>N,nativeScheduleMicroTask:h},A={parent:null,zone:new i(null,null)},j=null,M=0;function N(){}return n(`Zone`,`Zone`),i}function ut(){let e=globalThis,t=e[H(`forceDuplicateZoneCheck`)]===!0;if(e.Zone&&(t||typeof e.Zone.__symbol__!=`function`))throw Error(`Zone already loaded.`);return e.Zone!=null||(e.Zone=lt()),e.Zone}var dt=Object.getOwnPropertyDescriptor,ft=Object.defineProperty,pt=Object.getPrototypeOf,mt=Object.create,ht=Array.prototype.slice,gt=`addEventListener`,_t=`removeEventListener`,vt=H(gt),yt=H(_t),bt=`true`,xt=`false`,St=H(``);function Ct(e,t){return Zone.current.wrap(e,t)}function wt(e,t,n,r,i){return Zone.current.scheduleMacroTask(e,t,n,r,i)}var U=H,Tt=typeof window<`u`,Et=Tt?window:void 0,W=Tt&&Et||globalThis,Dt=`removeAttribute`;function Ot(e,t){for(let n=e.length-1;n>=0;n--)typeof e[n]==`function`&&(e[n]=Ct(e[n],t+`_`+n));return e}function kt(e,t){let n=e.constructor.name;for(let r=0;r<t.length;r++){let i=t[r],a=e[i];if(a){if(!At(dt(e,i)))continue;e[i]=(e=>{let t=function(){return e.apply(this,Ot(arguments,n+`.`+i))};return Kt(t,e),t})(a)}}}function At(e){return e?e.writable===!1?!1:!(typeof e.get==`function`&&e.set===void 0):!0}var jt=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,Mt=!(`nw`in W)&&W.process!==void 0&&W.process.toString()===`[object process]`,Nt=!Mt&&!jt&&!!(Tt&&Et.HTMLElement),Pt=W.process!==void 0&&W.process.toString()===`[object process]`&&!jt&&!!(Tt&&Et.HTMLElement),Ft={},It=U(`enable_beforeunload`),Lt=function(e){if(e=e||W.event,!e)return;let t=Ft[e.type];t||(t=Ft[e.type]=U(`ON_PROPERTY`+e.type));let n=this||e.target||W,r=n[t],i;if(Nt&&n===Et&&e.type===`error`){let t=e;i=r&&r.call(this,t.message,t.filename,t.lineno,t.colno,t.error),i===!0&&e.preventDefault()}else i=r&&r.apply(this,arguments),e.type===`beforeunload`&&W[It]&&typeof i==`string`?e.returnValue=i:i!=null&&!i&&e.preventDefault();return i};function Rt(e,t,n){let r=dt(e,t);if(!r&&n&&dt(n,t)&&(r={enumerable:!0,configurable:!0}),!r||!r.configurable)return;let i=U(`on`+t+`patched`);if(e.hasOwnProperty(i)&&e[i])return;delete r.writable,delete r.value;let a=r.get,o=r.set,s=t.slice(2),c=Ft[s];c||(c=Ft[s]=U(`ON_PROPERTY`+s)),r.set=function(t){let n=this;!n&&e===W&&(n=W),n&&(typeof n[c]==`function`&&n.removeEventListener(s,Lt),o==null||o.call(n,null),n[c]=t,typeof t==`function`&&n.addEventListener(s,Lt,!1))},r.get=function(){let n=this;if(!n&&e===W&&(n=W),!n)return null;let i=n[c];if(i)return i;if(a){let e=a.call(this);if(e)return r.set.call(this,e),typeof n[Dt]==`function`&&n.removeAttribute(t),e}return null},ft(e,t,r),e[i]=!0}function zt(e,t,n){if(t)for(let r=0;r<t.length;r++)Rt(e,`on`+t[r],n);else{let t=[];for(let n in e)n.slice(0,2)==`on`&&t.push(n);for(let r=0;r<t.length;r++)Rt(e,t[r],n)}}var Bt=U(`originalInstance`);function Vt(e){let t=W[e];if(!t)return;W[U(e)]=t,W[e]=function(){let n=Ot(arguments,e);switch(n.length){case 0:this[Bt]=new t;break;case 1:this[Bt]=new t(n[0]);break;case 2:this[Bt]=new t(n[0],n[1]);break;case 3:this[Bt]=new t(n[0],n[1],n[2]);break;case 4:this[Bt]=new t(n[0],n[1],n[2],n[3]);break;default:throw Error(`Arg list too long.`)}},Kt(W[e],t);let n=new t(function(){}),r;for(r in n)e===`XMLHttpRequest`&&r===`responseBlob`||(function(t){typeof n[t]==`function`?W[e].prototype[t]=function(){return this[Bt][t].apply(this[Bt],arguments)}:ft(W[e].prototype,t,{set:function(n){typeof n==`function`?(this[Bt][t]=Ct(n,e+`.`+t),Kt(this[Bt][t],n)):this[Bt][t]=n},get:function(){return this[Bt][t]}})})(r);for(r in t)r!==`prototype`&&t.hasOwnProperty(r)&&(W[e][r]=t[r])}function Ht(e,t){typeof Object.getOwnPropertySymbols==`function`&&Object.getOwnPropertySymbols(e).forEach(n=>{let r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){r&&(!r.writable||typeof r.set!=`function`)||(e[n]=t)},enumerable:r?r.enumerable:!0,configurable:r?r.configurable:!0})})}var Ut=!1;function Wt(e,t,n){let r=e;for(;r&&!r.hasOwnProperty(t);)r=pt(r);!r&&e[t]&&(r=e);let i=U(t),a=null;if(r&&(!(a=r[i])||!r.hasOwnProperty(i))&&(a=r[i]=r[t],At(r&&dt(r,t)))){let e=n(a,i,t);r[t]=function(){return e(this,arguments)},Kt(r[t],a),Ut&&Ht(a,r[t])}return a}function Gt(e,t,n){let r=null;function i(e){let t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},r.apply(t.target,t.args),e}r=Wt(e,t,e=>function(t,r){let a=n(t,r);return a.cbIdx>=0&&typeof r[a.cbIdx]==`function`?wt(a.name,r[a.cbIdx],a,i):e.apply(t,r)})}function Kt(e,t){e[U(`OriginalDelegate`)]=t}function qt(e){return typeof e==`function`}function Jt(e){return typeof e==`number`}var Yt={useG:!0},Xt={},Zt={},Qt=RegExp(`^`+St+`(\\w+)(true|false)$`),$t=U(`propagationStopped`);function en(e,t){let n=(t?t(e):e)+xt,r=(t?t(e):e)+bt,i=St+n,a=St+r;Xt[e]={},Xt[e][xt]=i,Xt[e][bt]=a}function tn(e,t,n,r){let i=r&&r.add||gt,a=r&&r.rm||_t,o=r&&r.listeners||`eventListeners`,s=r&&r.rmAll||`removeAllListeners`,c=U(i),l=`.`+i+`:`,u=`prependListener`;``+u;let d=function(e,t,n){if(e.isRemoved)return;let r=e.callback;typeof r==`object`&&r.handleEvent&&(e.callback=e=>r.handleEvent(e),e.originalDelegate=r);let i;try{e.invoke(e,t,[n])}catch(e){i=e}let o=e.options;if(o&&typeof o==`object`&&o.once){let r=e.originalDelegate?e.originalDelegate:e.callback;t[a].call(t,n.type,r,o)}return i};function f(n,r,i){if(r=r||e.event,!r)return;let a=n||r.target||e,o=a[Xt[r.type][i?bt:xt]];if(o){let e=[];if(o.length===1){let t=d(o[0],a,r);t&&e.push(t)}else{let t=o.slice();for(let n=0;n<t.length&&!(r&&r[$t]===!0);n++){let i=d(t[n],a,r);i&&e.push(i)}}if(e.length===1)throw e[0];for(let n=0;n<e.length;n++){let r=e[n];t.nativeScheduleMicroTask(()=>{throw r})}}}let p=function(e){return f(this,e,!1)},m=function(e){return f(this,e,!0)};function h(t,n){if(!t)return!1;let r=!0;n&&n.useG!==void 0&&(r=n.useG);let d=n&&n.vh,f=!0;n&&n.chkDup!==void 0&&(f=n.chkDup);let h=!1;n&&n.rt!==void 0&&(h=n.rt);let g=t;for(;g&&!g.hasOwnProperty(i);)g=pt(g);if(!g&&t[i]&&(g=t),!g||g[c])return!1;let _=n&&n.eventNameToString,v={},y=g[c]=g[i],b=g[U(a)]=g[a],x=g[U(o)]=g[o],S=g[U(s)]=g[s],C;n&&n.prepend&&(C=g[U(n.prepend)]=g[n.prepend]);function w(e,t){return t?typeof e==`boolean`?{capture:e,passive:!0}:e?typeof e==`object`&&e.passive!==!1?ct(st({},e),{passive:!0}):e:{passive:!0}:e}let T=function(e){if(!v.isExisting)return y.call(v.target,v.eventName,v.capture?m:p,v.options)},E=function(e){if(!e.isRemoved){let t=Xt[e.eventName],n;t&&(n=t[e.capture?bt:xt]);let r=n&&e.target[n];if(r){for(let t=0;t<r.length;t++)if(r[t]===e){r.splice(t,1),e.isRemoved=!0,e.removeAbortListener&&(e.removeAbortListener(),e.removeAbortListener=null),r.length===0&&(e.allRemoved=!0,e.target[n]=null);break}}}if(e.allRemoved)return b.call(e.target,e.eventName,e.capture?m:p,e.options)},D=function(e){return y.call(v.target,v.eventName,e.invoke,v.options)},O=function(e){return C.call(v.target,v.eventName,e.invoke,v.options)},k=function(e){return b.call(e.target,e.eventName,e.invoke,e.options)},A=r?T:D,j=r?E:k,M=(n==null?void 0:n.diff)||function(e,t){let n=typeof t;return n===`function`&&e.callback===t||n===`object`&&e.originalDelegate===t},N=Zone[U(`UNPATCHED_EVENTS`)],P=e[U(`PASSIVE_EVENTS`)];function F(e){if(typeof e==`object`&&e){let t=st({},e);return e.signal&&(t.signal=e.signal),t}return e}let I=function(t,i,a,o,s=!1,c=!1){return function(){let l=this||e,u=arguments[0];n&&n.transferEventName&&(u=n.transferEventName(u));let p=arguments[1];if(!p||Mt&&u===`uncaughtException`)return t.apply(this,arguments);let m=!1;if(typeof p!=`function`){if(!p.handleEvent)return t.apply(this,arguments);m=!0}if(d&&!d(t,p,l,arguments))return;let h=!!P&&P.indexOf(u)!==-1,g=F(w(arguments[2],h)),y=g==null?void 0:g.signal;if(y!=null&&y.aborted)return;if(N){for(let e=0;e<N.length;e++)if(u===N[e])return h?t.call(l,u,p,g):t.apply(this,arguments)}let b=g?typeof g==`boolean`?!0:g.capture:!1,x=g&&typeof g==`object`?g.once:!1,S=Zone.current,C=Xt[u];C||(en(u,_),C=Xt[u]);let T=C[b?bt:xt],E=l[T],D=!1;if(E){if(D=!0,f){for(let e=0;e<E.length;e++)if(M(E[e],p))return}}else E=l[T]=[];let O,k=l.constructor.name,A=Zt[k];A&&(O=A[u]),O||(O=k+i+(_?_(u):u)),v.options=g,x&&(v.options.once=!1),v.target=l,v.capture=b,v.eventName=u,v.isExisting=D;let j=r?Yt:void 0;j&&(j.taskData=v),y&&(v.options.signal=void 0);let I=S.scheduleEventTask(O,p,j,a,o);if(y){v.options.signal=y;let e=()=>I.zone.cancelTask(I);t.call(y,`abort`,e,{once:!0}),I.removeAbortListener=()=>y.removeEventListener(`abort`,e)}if(v.target=null,j&&(j.taskData=null),x&&(v.options.once=!0),typeof I.options!=`boolean`&&(I.options=g),I.target=l,I.capture=b,I.eventName=u,m&&(I.originalDelegate=p),c?E.unshift(I):E.push(I),s)return l}};return g[i]=I(y,l,A,j,h),C&&(g[u]=I(C,`.prependListener:`,O,j,h,!0)),g[a]=function(){let t=this||e,r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));let i=arguments[2],a=i?typeof i==`boolean`?!0:i.capture:!1,o=arguments[1];if(!o)return b.apply(this,arguments);if(d&&!d(b,o,t,arguments))return;let s=Xt[r],c;s&&(c=s[a?bt:xt]);let l=c&&t[c];if(l)for(let e=0;e<l.length;e++){let n=l[e];if(M(n,o)){if(l.splice(e,1),n.isRemoved=!0,l.length===0&&(n.allRemoved=!0,t[c]=null,!a&&typeof r==`string`)){let e=St+`ON_PROPERTY`+r;t[e]=null}return n.zone.cancelTask(n),h?t:void 0}}return b.apply(this,arguments)},g[o]=function(){let t=this||e,r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));let i=[],a=nn(t,_?_(r):r);for(let e=0;e<a.length;e++){let t=a[e],n=t.originalDelegate?t.originalDelegate:t.callback;i.push(n)}return i},g[s]=function(){let t=this||e,r=arguments[0];if(r){n&&n.transferEventName&&(r=n.transferEventName(r));let e=Xt[r];if(e){let n=e[xt],i=e[bt],o=t[n],s=t[i];if(o){let e=o.slice();for(let t=0;t<e.length;t++){let n=e[t],i=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,i,n.options)}}if(s){let e=s.slice();for(let t=0;t<e.length;t++){let n=e[t],i=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,i,n.options)}}}}else{let e=Object.keys(t);for(let t=0;t<e.length;t++){let n=e[t],r=Qt.exec(n),i=r&&r[1];i&&i!==`removeListener`&&this[s].call(this,i)}this[s].call(this,`removeListener`)}if(h)return this},Kt(g[i],y),Kt(g[a],b),S&&Kt(g[s],S),x&&Kt(g[o],x),!0}let g=[];for(let e=0;e<n.length;e++)g[e]=h(n[e],r);return g}function nn(e,t){if(!t){let n=[];for(let r in e){let i=Qt.exec(r),a=i&&i[1];if(a&&(!t||a===t)){let t=e[r];if(t)for(let e=0;e<t.length;e++)n.push(t[e])}}return n}let n=Xt[t];n||(en(t),n=Xt[t]);let r=e[n[xt]],i=e[n[bt]];return r?i?r.concat(i):r.slice():i?i.slice():[]}function rn(e,t){let n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,`stopImmediatePropagation`,e=>function(t,n){t[$t]=!0,e&&e.apply(t,n)})}function an(e,t){t.patchMethod(e,`queueMicrotask`,e=>function(e,t){Zone.current.scheduleMicroTask(`queueMicrotask`,t[0])})}var on=U(`zoneTask`);function sn(e,t,n,r){let i=null,a=null;t+=r,n+=r;let o={};function s(t){let n=t.data;n.args[0]=function(){return t.invoke.apply(this,arguments)};let r=i.apply(e,n.args);return Jt(r)?n.handleId=r:(n.handle=r,n.isRefreshable=qt(r.refresh)),t}function c(t){let{handle:n,handleId:r}=t.data;return a.call(e,n==null?r:n)}i=Wt(e,t,n=>function(i,a){var l;if(qt(a[0])){let e={isRefreshable:!1,isPeriodic:r===`Interval`,delay:r===`Timeout`||r===`Interval`?a[1]||0:void 0,args:a},n=a[0];a[0]=function(){try{return n.apply(this,arguments)}finally{let{handle:t,handleId:n,isPeriodic:r,isRefreshable:i}=e;!r&&!i&&(n?delete o[n]:t&&(t[on]=null))}};let i=wt(t,a[0],e,s,c);if(!i)return i;let{handleId:u,handle:d,isRefreshable:f,isPeriodic:p}=i.data;if(u)o[u]=i;else if(d&&(d[on]=i,f&&!p)){let e=d.refresh;d.refresh=function(){let{zone:t,state:n}=i;return n===`notScheduled`?(i._state=`scheduled`,t._updateTaskCount(i,1)):n===`running`&&(i._state=`scheduling`),e.call(this)}}return(l=d==null?u:d)==null?i:l}else return n.apply(e,a)}),a=Wt(e,n,t=>function(n,r){let i=r[0],a;Jt(i)?(a=o[i],delete o[i]):(a=i==null?void 0:i[on],a?i[on]=null:a=i),a!=null&&a.type?a.cancelFn&&a.zone.cancelTask(a):t.apply(e,r)})}function cn(e,t){let{isBrowser:n,isMix:r}=t.getGlobalObjects();!n&&!r||!e.customElements||!(`customElements`in e)||t.patchCallbacks(t,e.customElements,`customElements`,`define`,[`connectedCallback`,`disconnectedCallback`,`adoptedCallback`,`attributeChangedCallback`,`formAssociatedCallback`,`formDisabledCallback`,`formResetCallback`,`formStateRestoreCallback`])}function ln(e,t){if(Zone[t.symbol(`patchEventTarget`)])return;let{eventNames:n,zoneSymbolEventNames:r,TRUE_STR:i,FALSE_STR:a,ZONE_SYMBOL_PREFIX:o}=t.getGlobalObjects();for(let e=0;e<n.length;e++){let t=n[e],s=t+a,c=t+i,l=o+s,u=o+c;r[t]={},r[t][a]=l,r[t][i]=u}let s=e.EventTarget;if(!(!s||!s.prototype))return t.patchEventTarget(e,t,[s&&s.prototype]),!0}function un(e,t){t.patchEventPrototype(e,t)}function dn(e,t,n){if(!n||n.length===0)return t;let r=n.filter(t=>t.target===e);if(r.length===0)return t;let i=r[0].ignoreProperties;return t.filter(e=>i.indexOf(e)===-1)}function fn(e,t,n,r){e&&zt(e,dn(e,t,n),r)}function pn(e){return Object.getOwnPropertyNames(e).filter(e=>e.startsWith(`on`)&&e.length>2).map(e=>e.substring(2))}function mn(e,t){if(Mt&&!Pt||Zone[e.symbol(`patchEvents`)])return;let n=t.__Zone_ignore_on_properties,r=[];if(Nt){let e=window;r=r.concat([`Document`,`SVGElement`,`Element`,`HTMLElement`,`HTMLBodyElement`,`HTMLMediaElement`,`HTMLFrameSetElement`,`HTMLFrameElement`,`HTMLIFrameElement`,`HTMLMarqueeElement`,`Worker`]),fn(e,pn(e),n,pt(e))}r=r.concat([`XMLHttpRequest`,`XMLHttpRequestEventTarget`,`IDBIndex`,`IDBRequest`,`IDBOpenDBRequest`,`IDBDatabase`,`IDBTransaction`,`IDBCursor`,`WebSocket`]);for(let e=0;e<r.length;e++){let i=t[r[e]];i!=null&&i.prototype&&fn(i.prototype,pn(i.prototype),n)}}function hn(e){e.__load_patch(`timers`,e=>{let t=`clear`;sn(e,`set`,t,`Timeout`),sn(e,`set`,t,`Interval`),sn(e,`set`,t,`Immediate`)}),e.__load_patch(`requestAnimationFrame`,e=>{sn(e,`request`,`cancel`,`AnimationFrame`),sn(e,`mozRequest`,`mozCancel`,`AnimationFrame`),sn(e,`webkitRequest`,`webkitCancel`,`AnimationFrame`)}),e.__load_patch(`blocking`,(e,t)=>{let n=[`alert`,`prompt`,`confirm`];for(let r=0;r<n.length;r++){let i=n[r];Wt(e,i,(n,r,i)=>function(r,a){return t.current.run(n,e,a,i)})}}),e.__load_patch(`EventTarget`,(e,t,n)=>{un(e,n),ln(e,n);let r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,n,[r.prototype])}),e.__load_patch(`MutationObserver`,(e,t,n)=>{Vt(`MutationObserver`),Vt(`WebKitMutationObserver`)}),e.__load_patch(`IntersectionObserver`,(e,t,n)=>{Vt(`IntersectionObserver`)}),e.__load_patch(`FileReader`,(e,t,n)=>{Vt(`FileReader`)}),e.__load_patch(`on_property`,(e,t,n)=>{mn(n,e)}),e.__load_patch(`customElements`,(e,t,n)=>{cn(e,n)}),e.__load_patch(`XHR`,(e,t)=>{c(e);let n=U(`xhrTask`),r=U(`xhrSync`),i=U(`xhrListener`),a=U(`xhrScheduled`),o=U(`xhrURL`),s=U(`xhrErrorBeforeScheduled`);function c(e){let c=e.XMLHttpRequest;if(!c)return;let l=c.prototype;function u(e){return e[n]}let d=l[vt],f=l[yt];if(!d){let t=e.XMLHttpRequestEventTarget;if(t){let e=t.prototype;d=e[vt],f=e[yt]}}let p=`readystatechange`,m=`scheduled`;function h(e){let r=e.data,o=r.target;o[a]=!1,o[s]=!1;let c=o[i];d||(d=o[vt],f=o[yt]),c&&f.call(o,p,c);let l=o[i]=()=>{if(o.readyState===o.DONE)if(!r.aborted&&o[a]&&e.state===m){let n=o[t.__symbol__(`loadfalse`)];if(o.status!==0&&n&&n.length>0){let i=e.invoke;e.invoke=function(){let n=o[t.__symbol__(`loadfalse`)];for(let t=0;t<n.length;t++)n[t]===e&&n.splice(t,1);!r.aborted&&e.state===m&&i.call(e)},n.push(e)}else e.invoke()}else !r.aborted&&o[a]===!1&&(o[s]=!0)};return d.call(o,p,l),o[n]||(o[n]=e),x.apply(o,r.args),o[a]=!0,e}function g(){}function _(e){let t=e.data;return t.aborted=!0,S.apply(t.target,t.args)}let v=Wt(l,`open`,()=>function(e,t){return e[r]=t[2]==0,e[o]=t[1],v.apply(e,t)}),y=U(`fetchTaskAborting`),b=U(`fetchTaskScheduling`),x=Wt(l,`send`,()=>function(e,n){if(t.current[b]===!0||e[r])return x.apply(e,n);{let t={target:e,url:e[o],isPeriodic:!1,args:n,aborted:!1},r=wt(`XMLHttpRequest.send`,g,t,h,_);e&&e[s]===!0&&!t.aborted&&r.state===m&&r.invoke()}}),S=Wt(l,`abort`,()=>function(e,n){let r=u(e);if(r&&typeof r.type==`string`){if(r.cancelFn==null||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}else if(t.current[y]===!0)return S.apply(e,n)})}}),e.__load_patch(`geolocation`,e=>{e.navigator&&e.navigator.geolocation&&kt(e.navigator.geolocation,[`getCurrentPosition`,`watchPosition`])}),e.__load_patch(`PromiseRejectionEvent`,(e,t)=>{function n(t){return function(n){nn(e,t).forEach(r=>{let i=e.PromiseRejectionEvent;if(i){let e=new i(t,{promise:n.promise,reason:n.rejection});r.invoke(e)}})}}e.PromiseRejectionEvent&&(t[U(`unhandledPromiseRejectionHandler`)]=n(`unhandledrejection`),t[U(`rejectionHandledHandler`)]=n(`rejectionhandled`))}),e.__load_patch(`queueMicrotask`,(e,t,n)=>{an(e,n)})}function gn(e){e.__load_patch(`ZoneAwarePromise`,(e,t,n)=>{let r=Object.getOwnPropertyDescriptor,i=Object.defineProperty;function a(e){return e&&e.toString===Object.prototype.toString?(e.constructor&&e.constructor.name||``)+`: `+JSON.stringify(e):e?e.toString():Object.prototype.toString.call(e)}let o=n.symbol,s=[],c=e[o(`DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION`)]!==!1,l=o(`Promise`),u=o(`then`);n.onUnhandledError=e=>{if(n.showUncaughtError()){let t=e&&e.rejection;t?console.error(`Unhandled Promise rejection:`,t instanceof Error?t.message:t,`; Zone:`,e.zone.name,`; Task:`,e.task&&e.task.source,`; Value:`,t,t instanceof Error?t.stack:void 0):console.error(e)}},n.microtaskDrainDone=()=>{for(;s.length;){let e=s.shift();try{e.zone.runGuarded(()=>{throw e.throwOriginal?e.rejection:e})}catch(e){f(e)}}};let d=o(`unhandledPromiseRejectionHandler`);function f(e){n.onUnhandledError(e);try{let n=t[d];typeof n==`function`&&n.call(this,e)}catch(e){}}function p(e){return e&&typeof e.then==`function`}function m(e){return e}function h(e){return A.reject(e)}let g=o(`state`),_=o(`value`),v=o(`finally`),y=o(`parentPromiseValue`),b=o(`parentPromiseState`);function x(e,t){return n=>{try{w(e,t,n)}catch(t){w(e,!1,t)}}}let S=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},C=o(`currentTaskTrace`);function w(e,r,o){let l=S();if(e===o)throw TypeError(`Promise resolved with itself`);if(e[g]===null){let u=null;try{(typeof o==`object`||typeof o==`function`)&&(u=o&&o.then)}catch(t){return l(()=>{w(e,!1,t)})(),e}if(r!==!1&&o instanceof A&&o.hasOwnProperty(g)&&o.hasOwnProperty(_)&&o[g]!==null)E(o),w(e,o[g],o[_]);else if(r!==!1&&typeof u==`function`)try{u.call(o,l(x(e,r)),l(x(e,!1)))}catch(t){l(()=>{w(e,!1,t)})()}else{e[g]=r;let l=e[_];if(e[_]=o,e[v]===v&&r===!0&&(e[g]=e[b],e[_]=e[y]),r===!1&&o instanceof Error){let e=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;e&&i(o,C,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t<l.length;)D(e,l[t++],l[t++],l[t++],l[t++]);if(l.length==0&&r==0){e[g]=0;let r=o;try{throw Error(`Uncaught (in promise): `+a(o)+(o&&o.stack?`
2
+ `+o.stack:``))}catch(e){r=e}c&&(r.throwOriginal=!0),r.rejection=o,r.promise=e,r.zone=t.current,r.task=t.currentTask,s.push(r),n.scheduleMicroTask()}}}return e}let T=o(`rejectionHandledHandler`);function E(e){if(e[g]===0){try{let n=t[T];n&&typeof n==`function`&&n.call(this,{rejection:e[_],promise:e})}catch(e){}e[g]=!1;for(let t=0;t<s.length;t++)e===s[t].promise&&s.splice(t,1)}}function D(e,t,n,r,i){E(e);let a=e[g],o=a?typeof r==`function`?r:m:typeof i==`function`?i:h;t.scheduleMicroTask(`Promise.then`,()=>{try{let r=e[_],i=!!n&&v===n[v];i&&(n[y]=r,n[b]=a),w(n,!0,t.run(o,void 0,i&&o!==h&&o!==m?[]:[r]))}catch(e){w(n,!1,e)}},n)}let O=function(){},k=e.AggregateError;class A{static toString(){return`function ZoneAwarePromise() { [native code] }`}static resolve(e){return e instanceof A?e:w(new this(null),!0,e)}static reject(e){return w(new this(null),!1,e)}static withResolvers(){let e={};return e.promise=new A((t,n)=>{e.resolve=t,e.reject=n}),e}static any(e){if(!e||typeof e[Symbol.iterator]!=`function`)return Promise.reject(new k([],`All promises were rejected`));let t=[],n=0;try{for(let r of e)n++,t.push(A.resolve(r))}catch(e){return Promise.reject(new k([],`All promises were rejected`))}if(n===0)return Promise.reject(new k([],`All promises were rejected`));let r=!1,i=[];return new A((e,a)=>{for(let o=0;o<t.length;o++)t[o].then(t=>{r||(r=!0,e(t))},e=>{i.push(e),n--,n===0&&(r=!0,a(new k(i,`All promises were rejected`)))})})}static race(e){let t,n,r=new this((e,r)=>{t=e,n=r});function i(e){t(e)}function a(e){n(e)}for(let t of e)p(t)||(t=this.resolve(t)),t.then(i,a);return r}static all(e){return A.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof A?this:A).allWithCallback(e,{thenCallback:e=>({status:`fulfilled`,value:e}),errorCallback:e=>({status:`rejected`,reason:e})})}static allWithCallback(e,t){let n,r,i=new this((e,t)=>{n=e,r=t}),a=2,o=0,s=[];for(let i of e){p(i)||(i=this.resolve(i));let e=o;try{i.then(r=>{s[e]=t?t.thenCallback(r):r,a--,a===0&&n(s)},i=>{t?(s[e]=t.errorCallback(i),a--,a===0&&n(s)):r(i)})}catch(e){r(e)}a++,o++}return a-=2,a===0&&n(s),i}constructor(e){let t=this;if(!(t instanceof A))throw Error(`Must be an instanceof Promise.`);t[g]=null,t[_]=[];try{let n=S();e&&e(n(x(t,!0)),n(x(t,!1)))}catch(e){w(t,!1,e)}}get[Symbol.toStringTag](){return`Promise`}get[Symbol.species](){return A}then(e,n){var r;let i=(r=this.constructor)==null?void 0:r[Symbol.species];(!i||typeof i!=`function`)&&(i=this.constructor||A);let a=new i(O),o=t.current;return this[g]==null?this[_].push(o,a,e,n):D(this,o,a,e,n),a}catch(e){return this.then(null,e)}finally(e){var n;let r=(n=this.constructor)==null?void 0:n[Symbol.species];(!r||typeof r!=`function`)&&(r=A);let i=new r(O);i[v]=v;let a=t.current;return this[g]==null?this[_].push(a,i,e,e):D(this,a,i,e,e),i}}A.resolve=A.resolve,A.reject=A.reject,A.race=A.race,A.all=A.all;let j=e[l]=e.Promise;e.Promise=A;let M=o(`thenPatched`);function N(e){let t=e.prototype,n=r(t,`then`);if(n&&(n.writable===!1||!n.configurable))return;let i=t.then;t[u]=i,e.prototype.then=function(e,t){return new A((e,t)=>{i.call(this,e,t)}).then(e,t)},e[M]=!0}n.patchThen=N;function P(e){return function(t,n){let r=e.apply(t,n);if(r instanceof A)return r;let i=r.constructor;return i[M]||N(i),r}}if(j){N(j);let t=j.try;t&&typeof t==`function`&&(A.try=t),Wt(e,`fetch`,e=>P(e))}return Promise[t.__symbol__(`uncaughtPromiseErrors`)]=s,A})}function _n(e){e.__load_patch(`toString`,e=>{let t=Function.prototype.toString,n=U(`OriginalDelegate`),r=U(`Promise`),i=U(`Error`),a=function(){if(typeof this==`function`){let a=this[n];if(a)return typeof a==`function`?t.call(a):Object.prototype.toString.call(a);if(this===Promise){let n=e[r];if(n)return t.call(n)}if(this===Error){let n=e[i];if(n)return t.call(n)}}return t.call(this)};a[n]=t,Function.prototype.toString=a;let o=Object.prototype.toString;Object.prototype.toString=function(){return typeof Promise==`function`&&this instanceof Promise?`[object Promise]`:o.call(this)}})}function vn(e,t,n,r,i){let a=Zone.__symbol__(r);if(t[a])return;let o=t[a]=t[r];t[r]=function(a,s,c){return s&&s.prototype&&i.forEach(function(t){let i=`${n}.${r}::`+t,a=s.prototype;try{if(a.hasOwnProperty(t)){let n=e.ObjectGetOwnPropertyDescriptor(a,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,i),e._redefineProperty(s.prototype,t,n)):a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],i))}else a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],i))}catch(e){}}),o.call(t,a,s,c)},e.attachOriginToPatched(t[r],o)}function yn(e){e.__load_patch(`util`,(e,t,n)=>{let r=pn(e);n.patchOnProperties=zt,n.patchMethod=Wt,n.bindArguments=Ot,n.patchMacroTask=Gt;let i=t.__symbol__(`BLACK_LISTED_EVENTS`),a=t.__symbol__(`UNPATCHED_EVENTS`);e[a]&&(e[i]=e[a]),e[i]&&(t[i]=t[a]=e[i]),n.patchEventPrototype=rn,n.patchEventTarget=tn,n.ObjectDefineProperty=ft,n.ObjectGetOwnPropertyDescriptor=dt,n.ObjectCreate=mt,n.ArraySlice=ht,n.patchClass=Vt,n.wrapWithCurrentZone=Ct,n.filterProperties=dn,n.attachOriginToPatched=Kt,n._redefineProperty=Object.defineProperty,n.patchCallbacks=vn,n.getGlobalObjects=()=>({globalSources:Zt,zoneSymbolEventNames:Xt,eventNames:r,isBrowser:Nt,isMix:Pt,isNode:Mt,TRUE_STR:bt,FALSE_STR:xt,ZONE_SYMBOL_PREFIX:St,ADD_EVENT_LISTENER_STR:gt,REMOVE_EVENT_LISTENER_STR:_t})})}function bn(e){gn(e),_n(e),yn(e)}var xn=ut();bn(xn),hn(xn);var Sn=x(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Cn(e){return e.setValue(Sn,!0)}function wn(e){return e.getValue(Sn)===!0}var Tn=`baggage`,En=4096;function Dn(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function On(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 kn(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=b(e.substring(t+1))),{key:o,value:s,metadata:c}}var An=class{inject(e,t,n){let r=Ge.getBaggage(e);if(!r||wn(e))return;let i=Dn(On(r).filter(e=>e.length<=En).slice(0,180));i.length>0&&n.set(t,Tn,i)}extract(e,t,n){let r=n.get(t,Tn),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=kn(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:Ge.setBaggage(e,Ge.createBaggage(a))}fields(){return[Tn]}};function jn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Mn(n)){R.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Nn(r)){R.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Mn(e){return typeof e==`string`&&e!==``}function Nn(e){return e==null?!0:Array.isArray(e)?Pn(e):Fn(typeof e)}function Pn(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Fn(e)){t=e;continue}return!1}return!1}}return!0}function Fn(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function In(){return e=>{R.error(Ln(e))}}function Ln(e){return typeof e==`string`?e:JSON.stringify(Rn(e))}function Rn(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var zn=In();function Bn(e){try{zn(e)}catch(e){}}var Vn=`2.7.1`,Hn=`exception.message`,Un=`exception.stacktrace`,Wn=`exception.type`,Gn=`service.name`,Kn=`telemetry.sdk.language`,qn=`webjs`,Jn=`telemetry.sdk.name`,Yn=`telemetry.sdk.version`,Xn=`process.runtime.name`,Zn={[Jn]:`opentelemetry`,[Xn]:`browser`,[Kn]:qn,[Yn]:Vn},Qn=performance,$n=9,er=Math.pow(10,6),tr=Math.pow(10,$n);function nr(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*er)]}function rr(e){return cr(nr(Qn.timeOrigin),nr(typeof e==`number`?e:Qn.now()))}function ir(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=tr),[n,r]}function ar(e){return e[0]*tr+e[1]}function or(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function sr(e){return or(e)||typeof e==`number`||e instanceof Date}function cr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=tr&&(n[1]-=tr,n[0]+=1),n}var lr;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(lr||(lr={}));var ur=class{constructor(e={}){var t;z(this,`_propagators`,void 0),z(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t;let n=new Set;for(let e of this._propagators){let t=typeof e.fields==`function`?e.fields():[];for(let e of t)n.add(e)}this._fields=Array.from(n)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){R.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){R.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},dr=`[_0-9a-z-*/]`,fr=`[a-z]${dr}{0,255}`,pr=`[a-z0-9]${dr}{0,240}@[a-z]${dr}{0,13}`,mr=RegExp(`^(?:${fr}|${pr})$`),hr=/^[ -~]{0,255}[!-~]$/,gr=/,|=/;function _r(e){return mr.test(e)}function vr(e){return hr.test(e)&&!gr.test(e)}var yr=32,br=512,xr=`,`,Sr=`=`,Cr=class e{constructor(e){z(this,`_length`,void 0),z(this,`_rawTraceState`,void 0),z(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!_r(e)||!vr(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>br)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=xr+e),e=`${n[0]}${Sr}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(xr),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Sr);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!_r(a)||!vr(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>br)&&(t.set(a,o),n=s,t.size>=yr))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}},wr=`traceparent`,Tr=`tracestate`,Er=`00`,Dr=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function Or(e){let t=Dr.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var kr=class{inject(e,t,n){let r=qe.getSpanContext(e);if(!r||wn(e)||!we(r))return;let i=`${Er}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||L.NONE).toString(16)}`;n.set(t,wr,i),r.traceState&&n.set(t,Tr,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,wr);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Or(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Tr);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Cr(typeof e==`string`?e:void 0)}return qe.setSpanContext(e,a)}fields(){return[wr,Tr]}},Ar=`[object Object]`,jr=`[object Null]`,Mr=`[object Undefined]`,Nr=Function.prototype.toString,Pr=Nr.call(Object),Fr=Object.getPrototypeOf,Ir=Object.prototype,Lr=Ir.hasOwnProperty,Rr=Symbol?Symbol.toStringTag:void 0,zr=Ir.toString;function Br(e){if(!Vr(e)||Hr(e)!==Ar)return!1;let t=Fr(e);if(t===null)return!0;let n=Lr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Nr.call(n)===Pr}function Vr(e){return typeof e==`object`&&!!e}function Hr(e){return e==null?e===void 0?Mr:jr:Rr&&Rr in Object(e)?Ur(e):Wr(e)}function Ur(e){let t=Lr.call(e,Rr),n=e[Rr],r=!1;try{e[Rr]=void 0,r=!0}catch(e){}let i=zr.call(e);return r&&(t?e[Rr]=n:delete e[Rr]),i}function Wr(e){return zr.call(e)}var Gr=20;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>Gr)){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];r===`__proto__`||r===`constructor`||r===`prototype`||(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];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let 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!(!Br(e)||!Br(t))}var ti=class{constructor(){z(this,`_promise`,void 0),z(this,`_resolve`,void 0),z(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)}},ni=class{constructor(e,t){z(this,`_isCalled`,!1),z(this,`_deferred`,new ti),z(this,`_callback`,void 0),z(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 ri(e,t){return new Promise(n=>{Ie.with(Cn(Ie.active()),()=>{e.export(t,n)})})}var ii={_export:ri},ai=class{constructor(e){z(this,`_delegate`,void 0),this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},oi=class extends Error{constructor(e,t,n){super(e),z(this,`code`,void 0),z(this,`name`,`OTLPExporterError`),z(this,`data`,void 0),this.data=n,this.code=t}};function si(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 G(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){si(a,r,i,o,s,`next`,e)}function s(e){si(a,r,i,o,s,`throw`,e)}o(void 0)})}}function ci(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function li(e){if(e!=null)return G(function*(){return e})}function ui(e,t,n){var r,i,a,o,s,c;return{timeoutMillis:ci((r=(i=e.timeoutMillis)==null?t.timeoutMillis:i)==null?n.timeoutMillis:r),concurrencyLimit:(a=(o=e.concurrencyLimit)==null?t.concurrencyLimit:o)==null?n.concurrencyLimit:a,compression:(s=(c=e.compression)==null?t.compression:c)==null?n.compression:s}}function di(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var fi=class{constructor(e){z(this,`_concurrencyLimit`,void 0),z(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 G(function*(){yield Promise.all(e._sendingPromises)})()}};function pi(e){return new fi(e.concurrencyLimit)}function mi(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function hi(){return{handleResponse(e){e==null||!mi(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||R.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var gi=class{constructor(e,t,n,r,i){z(this,`_diagLogger`,void 0),z(this,`_transport`,void 0),z(this,`_serializer`,void 0),z(this,`_responseHandler`,void 0),z(this,`_promiseQueue`,void 0),z(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=R.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:lr.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:lr.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:lr.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:lr.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:lr.FAILED,error:(n=e.error)==null?new oi(`Export failed with retryable status`):n})}else t({code:lr.FAILED,error:new oi(`Export failed with unknown error`)})},e=>t({code:lr.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return G(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function _i(e,t){return new gi(e.transport,e.serializer,hi(),e.promiseHandler,t.timeout)}function vi(e,t,n){return _i({transport:n,serializer:t,promiseHandler:pi(e)},{timeout:e.timeoutMillis})}function yi(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 K(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yi(Object(n),!0).forEach(function(t){z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var bi;function xi(){if(bi===void 0)try{let e=globalThis.process.argv0;bi=e?`unknown_service:${e}`:`unknown_service`}catch(e){bi=`unknown_service`}return bi}var Si=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Ci=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Ei(t),r._asyncAttributesPending=t.filter(([e,t])=>Si(t)).length>0,r}constructor(e,t){var n;z(this,`_rawAttributes`,void 0),z(this,`_asyncAttributesPending`,!1),z(this,`_schemaUrl`,void 0),z(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Si(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Ei(this._rawAttributes),this._schemaUrl=Di(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return G(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Si(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&R.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Si(n)){R.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=Oi(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function wi(e,t){return Ci.FromAttributeList(Object.entries(e),t)}function Ti(){return wi({[Gn]:xi(),[Kn]:Zn[Kn],[Jn]:Zn[Jn],[Yn]:Zn[Yn]})}function Ei(e){return e.map(([e,t])=>Si(t)?[e,t.catch(t=>{R.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Di(e){if(typeof e==`string`||e===void 0)return e;R.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Oi(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;R.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function ki(e,t){let n={attributes:ji(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Ai(e){return{name:e.name,version:e.version}}function ji(e,t){return Object.keys(e).map(n=>Mi(n,e[n],t))}function Mi(e,t,n){return{key:e,value:Ni(t,n)}}function Ni(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]=Ni(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:Ni(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function Pi(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Fi(e){return Pi(e).toString()}var Ii=typeof BigInt<`u`?Fi:ar;function Li(e){return e}var Ri={encodeHrTime:Ii,encodeSpanContext:Li,encodeOptionalSpanContext:Li,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(``))}},zi=256,Bi=512;function Vi(e,t){let n=e&255|zi;return t&&(n|=Bi),n}function Hi(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:ji(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Wi(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Ui(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Vi(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Ui(e,t){var n;return{attributes:e.attributes?ji(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:Vi(e.context.traceFlags,e.context.isRemote)}}function Wi(e,t){return{attributes:e.attributes?ji(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Gi(e,t){return{resourceSpans:qi(e,t)}}function Ki(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 qi(e,t){let n=Ki(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=>Hi(e,t));o.push({scope:Ai(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=ki(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var Ji={serializeRequest:e=>{let t=Gi(e,Ri);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return R.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}},Yi=5,Xi=1e3,Zi=5e3,Qi=1.5,$i=.2;function ea(){return 2*$i*Math.random()-$i}var ta=class{constructor(e){z(this,`_transport`,void 0),this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}send(e,t){var n=this;return G(function*(){let r=Yi,i=Xi,a=Date.now()+t,o=yield n._transport.send(e,t);for(;o.status===`retryable`&&r>0;){var s;r--;let t=Math.max(Math.min(i*(1+ea()),Zi),0);i*=Qi;let c=(s=o.retryInMillis)==null?t:s,l=a-Date.now();if(c>l)return R.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),o;R.verbose(`Scheduling export retry in ${Math.round(c)}ms`),o=yield n.retry(e,l,c)}return o.status===`success`?R.verbose(`Export succeeded after ${Yi-r} retry attempts.`):o.status===`retryable`?R.info(`Export failed after maximum retry attempts (${Yi}).`):R.info(`Export failed with non-retryable error: ${o.error}`),o})()}shutdown(){return this._transport.shutdown()}};function na(e){return new ta(e.transport)}function ra(e){return e===429||e===502||e===503||e===504}function ia(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var aa=60*1024,oa=9,sa=0,ca=0,la=class{constructor(e){z(this,`_parameters`,void 0),this._parameters=e}send(e,t){var n=this;return G(function*(){let r=new AbortController,i=setTimeout(()=>r.abort(),t),a=globalThis.fetch;typeof a.__original==`function`&&(a=a.__original);let o=e.byteLength,s=sa+o>aa,c=!s&&!(ca>=oa);if(c)sa+=o,ca++;else{let e=s?`size limit`:`count limit`;R.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${ca} pending (${e})`)}try{let t=new URL(n._parameters.url),i=yield a(t.href,{method:`POST`,headers:yield n._parameters.headers(),body:e,signal:r.signal,keepalive:c,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return i.status>=200&&i.status<=299?(R.debug(`export response success (status: ${i.status})`),{status:`success`}):ra(i.status)?(R.warn(`export response retryable (status: ${i.status})`),{status:`retryable`,retryInMillis:ia(i.headers.get(`Retry-After`))}):(R.error(`export response failure (status: ${i.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${i.status}`)})}catch(e){return da(e)?(R.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(R.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(i),c&&(sa-=o,ca--)}})()}shutdown(){}};function ua(e){return new la(e)}function da(e){return e instanceof TypeError&&!e.cause}function fa(e,t){return vi(e,t,na({transport:ua(e)}))}function pa(e){let t={};return Object.entries(e==null?{}:e).forEach(([e,n])=>{n===void 0?R.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}function ma(e,t,n){return G(function*(){let r=K({},yield n()),i={};return t!=null&&Object.assign(i,yield t()),e!=null&&Object.assign(i,pa(yield e())),Object.assign(i,r)})}function ha(e){if(e!=null)try{var t;let n=(t=globalThis.location)==null?void 0:t.href;return new URL(e,n).href}catch(t){throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function ga(e,t,n){var r,i;return K(K({},ui(e,t,n)),{},{headers:ma(e.headers,t.headers,n.headers),url:(r=(i=ha(e.url))==null?t.url:i)==null?n.url:r})}function _a(e,t){return K(K({},di()),{},{headers:function(){var t=G(function*(){return e});return function(){return t.apply(this,arguments)}}(),url:`http://localhost:4318/`+t})}function va(e){return typeof e.headers==`function`?e.headers:li(e.headers)}function ya(e,t,n){return ga({url:e.url,timeoutMillis:e.timeoutMillis,headers:va(e),concurrencyLimit:e.concurrencyLimit},{},_a(n,t))}function ba(e,t,n,r){return fa(ya(e,n,r),t)}var xa=class extends ai{constructor(e={}){super(ba(e,Ji,`v1/traces`,{"Content-Type":`application/json`}))}},Sa=`exception`,Ca=class{constructor(e){var t,n;z(this,`_spanContext`,void 0),z(this,`kind`,void 0),z(this,`parentSpanContext`,void 0),z(this,`attributes`,{}),z(this,`links`,[]),z(this,`events`,[]),z(this,`startTime`,void 0),z(this,`resource`,void 0),z(this,`instrumentationScope`,void 0),z(this,`_droppedAttributesCount`,0),z(this,`_droppedEventsCount`,0),z(this,`_droppedLinksCount`,0),z(this,`_attributesCount`,0),z(this,`name`,void 0),z(this,`status`,{code:Fe.UNSET}),z(this,`endTime`,[0,0]),z(this,`_ended`,!1),z(this,`_duration`,[-1,-1]),z(this,`_spanProcessor`,void 0),z(this,`_spanLimits`,void 0),z(this,`_attributeValueLengthLimit`,void 0),z(this,`_recordEndMetrics`,void 0),z(this,`_performanceStartTime`,void 0),z(this,`_performanceOffset`,void 0),z(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Qn.now(),this._performanceOffset=r-(this._performanceStartTime+Qn.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return R.warn(`Invalid attribute key: ${e}`),this;if(!Nn(t))return R.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return R.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&R.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),sr(t)&&(sr(n)||(n=t),t=void 0);let i=jn(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&R.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=jn(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Fe.UNSET||this.status.code===Fe.OK)return this;let t={code:e.code};return e.code===Fe.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&R.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){R.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=ir(this.startTime,this.endTime),this._duration[0]<0&&(R.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&&R.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&R.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=Qn.now())return rr(e+this._performanceOffset);if(typeof e==`number`)return nr(e);if(e instanceof Date)return nr(e.getTime());if(or(e))return e;if(this._startTimeProvided)return nr(Date.now());let t=Qn.now()-this._performanceStartTime;return cr(this.startTime,nr(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Hn]=e:e&&(e.code?n[Wn]=e.code.toString():e.name&&(n[Wn]=e.name),e.message&&(n[Hn]=e.message),e.stack&&(n[Un]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Sa,n,t):R.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}}`);R.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?(R.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}},wa;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(wa||(wa={}));var Ta=class{shouldSample(){return{decision:wa.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},Ea=class{shouldSample(){return{decision:wa.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},Da=class{constructor(e){var t,n,r,i;z(this,`_root`,void 0),z(this,`_remoteParentSampled`,void 0),z(this,`_remoteParentNotSampled`,void 0),z(this,`_localParentSampled`,void 0),z(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Bn(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Ea),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Ea:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new Ta:n,this._localParentSampled=(r=e.localParentSampled)==null?new Ea:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new Ta:i}shouldSample(e,t,n,r,i,a){let o=qe.getSpanContext(e);return!o||!we(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&L.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&L.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()}}`}},Oa=class{constructor(e=0){z(this,`_ratio`,void 0),z(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:Se(t)&&this._accumulate(t)<this._upperBound?wa.RECORD_AND_SAMPLED:wa.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<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}},ka;(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`})(ka||(ka={}));var Aa=1;function ja(){var e,t,n,r,i,a,o,s;return{sampler:Ma(),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 Ma(){var e;let t=(e=void 0)==null?ka.ParentBasedAlwaysOn:e;switch(t){case ka.AlwaysOn:return new Ea;case ka.AlwaysOff:return new Ta;case ka.ParentBasedAlwaysOn:return new Da({root:new Ea});case ka.ParentBasedAlwaysOff:return new Da({root:new Ta});case ka.TraceIdRatio:return new Oa(Na());case ka.ParentBasedTraceIdRatio:return new Da({root:new Oa(Na())});default:return R.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${ka.ParentBasedAlwaysOn}".`),new Da({root:new Ea})}}function Na(){return R.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Aa}.`),Aa}var Pa=1/0;function Fa(e){let t={sampler:Ma()},n=ja(),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 Ia(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?Pa:s,Object.assign({},e,{spanLimits:p})}var La=class{constructor(e,t){var n,r,i,a;z(this,`_maxExportBatchSize`,void 0),z(this,`_maxQueueSize`,void 0),z(this,`_scheduledDelayMillis`,void 0),z(this,`_exportTimeoutMillis`,void 0),z(this,`_exporter`,void 0),z(this,`_isExporting`,!1),z(this,`_finishedSpans`,[]),z(this,`_timer`,void 0),z(this,`_shutdownOnce`,void 0),z(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 ni(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(R.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&L.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&&R.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(R.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);Ie.with(Cn(Ie.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===lr.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=>{Bn(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,Bn(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)}},Ra=class extends La{constructor(e,t){super(e,t),z(this,`_visibilityChangeListener`,void 0),z(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=>{Bn(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Bn(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))}},za=16,Ba=8,Va=new Uint8Array(za),Ha=new Uint8Array(Ba),Ua=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Wa(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 Ga(e){let t=``;for(let n=0;n<e.length;n++)t+=Ua[e[n]];return t}var Ka=class{generateTraceId(){return Wa(Va),Ga(Va)}generateSpanId(){return Wa(Ha),Ga(Ha)}},qa=`otel.span.parent.origin`,Ja=`otel.span.sampling_result`,Ya=`otel.sdk.span.live`,Xa=`otel.sdk.span.started`,Za=class{constructor(e){z(this,`startedSpans`,void 0),z(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(Xa,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(Ya,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=$a(t);if(this.startedSpans.add(1,{[qa]:Qa(e),[Ja]:n}),t===wa.NOT_RECORD)return()=>{};let r={[Ja]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Qa(e){return e?e.isRemote?`remote`:`local`:`none`}function $a(e){switch(e){case wa.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case wa.RECORD:return`RECORD_ONLY`;case wa.NOT_RECORD:return`DROP`}}var eo=`2.7.1`,to=class{constructor(e,t,n,r){z(this,`_sampler`,void 0),z(this,`_generalLimits`,void 0),z(this,`_spanLimits`,void 0),z(this,`_idGenerator`,void 0),z(this,`instrumentationScope`,void 0),z(this,`_resource`,void 0),z(this,`_spanProcessor`,void 0),z(this,`_tracerMetrics`,void 0);let i=Fa(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new Ka,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,eo):ie();this._tracerMetrics=new Za(a)}startSpan(e,t={},n=Ie.active()){var r,i,a;t.root&&(n=qe.deleteSpan(n));let o=qe.getSpan(n);if(wn(n))return R.debug(`Instrumentation suppressed, returning Noop Span`),qe.wrapSpanContext(de);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!qe.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?Pe.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:jn(e.attributes)})),m=jn(t.attributes),h=this._sampler.shouldSample(n,u,e,f,m,p),g=this._tracerMetrics.startSpan(s,h.decision);d=(a=h.traceState)==null?d:a;let _=h.decision===Ne.RECORD_AND_SAMPLED?L.SAMPLED:L.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===Ne.NOT_RECORD)return R.debug(`Recording is off, propagating context in a non-recording span`),qe.wrapSpanContext(v);let y=jn(Object.assign(m,h.attributes));return new Ca({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:v,name:e,kind:f,links:p,parentSpanContext:l,attributes:y,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}startActiveSpan(e,t,n,r){var i;let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=r);let c=(i=o)==null?Ie.active():i,l=this.startSpan(e,a,c),u=qe.setSpan(c,l);return Ie.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}},no=class{constructor(e){z(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=>{Bn(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)})}},ro;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(ro||(ro={}));var io=class{constructor(e={}){var t,n;z(this,`_config`,void 0),z(this,`_tracers`,new Map),z(this,`_resource`,void 0),z(this,`_activeSpanProcessor`,void 0);let r=Kr({},ja(),Ia(e));this._resource=(t=r.resource)==null?Ti():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new no(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 to({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=ro.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==ro.timeout&&(r=ro.resolved,n(r))}).catch(e=>{clearTimeout(i),r=ro.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==ro.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}},ao=class{constructor(e){z(this,`_exporter`,void 0),z(this,`_shutdownOnce`,void 0),z(this,`_pendingExports`,void 0),this._exporter=e,this._shutdownOnce=new ni(this._shutdown,this),this._pendingExports=new Set}forceFlush(){var e=this;return G(function*(){yield Promise.all(Array.from(e._pendingExports)),e._exporter.forceFlush&&(yield e._exporter.forceFlush())})()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>Bn(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}_doExport(e){var t=this;return G(function*(){if(e.resource.asyncAttributesPending){var n,r;yield(n=(r=e.resource).waitForAsyncAttributes)==null?void 0:n.call(r)}let i=yield ii._export(t._exporter,[e]);if(i.code!==lr.SUCCESS){var a;throw(a=i.error)==null?Error(`SimpleSpanProcessor: span export failed (status ${i})`):a}})()}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}},oo=class{constructor(){z(this,`_enabled`,!1),z(this,`_currentContext`,S)}_bindFunction(e=S,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=S,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=S,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||S;try{return t.call(n,...r)}finally{this._currentContext=i}}};function so(e){if(e!==null){if(e===void 0){let e=new oo;e.enable(),Ie.setGlobalContextManager(e);return}e.enable(),Ie.setGlobalContextManager(e)}}function co(e){if(e!==null){if(e===void 0){Ge.setGlobalPropagator(new ur({propagators:[new kr,new An]}));return}Ge.setGlobalPropagator(e)}}var lo=class extends io{constructor(e={}){super(e)}register(e={}){qe.setGlobalTracerProvider(this),co(e.propagator),so(e.contextManager)}},uo=`data-bk-action-name`,fo=100,po=20,mo=512,ho=2048,go=[`data-testid`,`data-test`,`data-qa`,`data-cy`,uo],_o=e=>e.replace(/\s+/g,` `).trim().slice(0,fo),vo=e=>{if(e.assignedSlot)return e.assignedSlot;if(e.parentElement)return e.parentElement;let t=e.getRootNode();return`host`in t?t.host:null},yo=e=>{var t;if(e.hasAttribute(`hidden`)||e.getAttribute(`data-bk-privacy`)===`hidden`)return!0;let n=(t=e.ownerDocument.defaultView)==null?void 0:t.getComputedStyle(e);return(n==null?void 0:n.display)===`none`||(n==null?void 0:n.visibility)===`hidden`||(n==null?void 0:n.visibility)===`collapse`},bo=e=>{for(let t=e;t;t=vo(t))if(yo(t))return!0;return!1},xo=e=>yo(e)||e.getAttribute(`aria-hidden`)===`true`||e.getAttribute(`data-bk-privacy`)===`mask`||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)||e.getAttribute(`contenteditable`)!==null&&e.getAttribute(`contenteditable`)!==`false`,So=e=>{for(let t=e;t;t=vo(t))if(xo(t))return!0;return!1},Co=e=>{if(So(e))return``;let t=[e],n=``,r=0;for(;t.length&&r++<200&&n.length<fo*4;){let e=t.pop();if(e.nodeType===3){var i,a;let t=(i=e.assignedSlot)==null?e.parentElement:i;t&&!So(t)&&(n+=(a=e.textContent)==null?``:a)}else if(e.nodeType===1&&!So(e))for(let n=e.childNodes.length-1;n>=0;--n)t.push(e.childNodes[n])}return _o(n)},wo=(e,t)=>{let n=t.actionNameAttribute?[t.actionNameAttribute,uo]:[uo],r=0;for(let t=e;t&&r++<po;t=vo(t))for(let e of n){var i;let n=_o((i=t.getAttribute(e))==null?``:i);if(n)return{name:n,nameSource:`explicit`}}if(t.nameCollection===`text`){let t=!1;for(let n=e;n;n=vo(n))(n.getAttribute(`data-bk-privacy`)===`mask`||n.getAttribute(`aria-hidden`)===`true`||n.getAttribute(`contenteditable`)!==null&&n.getAttribute(`contenteditable`)!==`false`)&&(t=!0);if(!t){r=0;for(let t=e;t&&r++<po;t=vo(t)){var a,o;if(/^(FORM|BODY|HTML|HEAD)$/.test(t.tagName))break;if(t.getAttribute(`aria-hidden`)===`true`)continue;let e=t.getRootNode(),n=((a=t.getAttribute(`aria-labelledby`))==null?``:a).split(/\s+/).filter(Boolean).slice(0,10).map(t=>{var n;return(n=e.getElementById)==null?void 0:n.call(e,t)}).filter(e=>!!e).map(Co).filter(Boolean).join(` `),r=`labels`in t?Array.from((o=t.labels)==null?[]:o).slice(0,10).map(Co).filter(Boolean).join(` `):``,i=_o(n||t.getAttribute(`aria-label`)||r||t.getAttribute(`alt`)||t.getAttribute(`title`)||``);if(i)return{name:i,nameSource:`accessible_name`}}let t=Co(e);if(t)return{name:t,nameSource:`text`}}}return{name:e.tagName.toLowerCase(),nameSource:`fallback`}},To=e=>Array.from(e,e=>`\\${e.codePointAt(0).toString(16)} `).join(``),Eo=(e,t)=>{var n,r;return(n=(r=e.ownerDocument.defaultView)==null||(r=r.CSS)==null?void 0:r.escape(t))==null?To(t):n},Do=(e,t)=>{let n=e.getAttribute(t);if(!(!n||n.length>128||/[\u0000-\u001f\u007f]/.test(n)))return`[${Eo(e,t)}="${n.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"]`},Oo=e=>!!e&&e.length<=128&&!/\d{3}|[a-f0-9]{8}|[:\s\u0000-\u001f\u007f]/i.test(e),ko=e=>{for(let t=e;t;t=vo(t))if(t.getAttribute(`data-bk-privacy`)===`mask`)return!0;return!1},Ao=(e,t,n)=>{let r=[uo,...n.actionNameAttribute?[n.actionNameAttribute]:[]],i=``,a=0;for(let n=e;n&&a++<po;n=n.parentElement){let a=Eo(n,n.tagName.toLowerCase()),o=1;for(let e=n.previousElementSibling;e;e=e.previousElementSibling)e.tagName===n.tagName&&(o+=1);let s=`${a}:nth-of-type(${o})`,c=ko(n),l=(c?r:[...go,...r]).map(e=>Do(n,e)).filter(e=>!!e);!c&&Oo(n.id)&&l.push(`#${Eo(n,n.id)}`),l.push(s);for(let n of l){let r=i?`${n} > ${i}`:n;if(r.length>mo)continue;let a=t.querySelectorAll(r);if(a.length===1&&a[0]===e)return r}if(i=i?`${s} > ${i}`:s,i.length>mo)return}},jo=(e,t)=>{if(!e.isConnected)return;let n=[],r=e;for(let e=0;e<po;e+=1){let e=r.getRootNode(),i=Ao(r,e,t);if(!i)return;n.unshift(i);let a=n.join(` ::shadow `);if(a.length>mo)return;if(!(`host`in e))return a;r=e.host}},Mo=(e,t,n={})=>{var r,i;if(bo(e))return;let a=K(K({},wo(e,n)),{},{tag:e.tagName.toLowerCase()}),o=jo(e,n);o&&(a.selector=o);let s=[],c=0;for(let a of(r=(i=t.composedPath)==null?void 0:i.call(t))==null?[e]:r){if(a.nodeType!==1||bo(a))continue;let t=a===e?o:jo(a,n);if(t){if(s.length===10||c+t.length>ho)break;s.push(t),c+=t.length}}s.length&&(a.path=s);let l=e.getBoundingClientRect();Number.isFinite(l.width)&&(a.width=l.width),Number.isFinite(l.height)&&(a.height=l.height);let u=t,d=u.detail===0&&u.clientX===0&&u.clientY===0;return!d&&Number.isFinite(u.clientX)&&Number.isFinite(l.left)&&(a.x=u.clientX-l.left),!d&&Number.isFinite(u.clientY)&&Number.isFinite(l.top)&&(a.y=u.clientY-l.top),a},No=new WeakMap,Po=e=>{let t=No.get(e);if(t!==void 0)return t;let n=Date.now(),r=e.timeStamp,i=n;if(Number.isFinite(r)&&r>0){if(r>0xe8d4a51000)i=Math.min(n,r);else if(typeof performance<`u`&&typeof performance.now==`function`){let e=performance.now()-r;Number.isFinite(e)&&e>=0&&(i=n-e)}}return i=Math.floor(i),No.set(e,i),i},Fo=e=>{let t=typeof performance<`u`&&typeof performance.now==`function`?performance.now():0,n=e.timeStamp;return Number.isFinite(n)&&n>=0&&n<0xe8d4a51000?Math.min(t,n):Math.max(0,t-(Date.now()-Po(e)))},q=e=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`,Io=()=>typeof document<`u`&&document.baseURI||typeof window<`u`&&(window.location.href||window.location.origin)||`http://localhost`,Lo=e=>{try{return new URL(e,Io()).href}catch(t){return e}},Ro=/^(?:\d+|[0-9a-f]{8}-[0-9a-f-]{27,}|[0-9a-f]{16,})$/i,zo=e=>e.split(/[?#]/,1)[0].split(`/`).map(e=>Ro.test(e)?`:id`:e).join(`/`),Bo=e=>e.length>1?e.replace(/\/+$/,``):e,Vo=(e,t)=>{let n=e=>Bo(e.replace(/[?#].*$/,``));return n(e)===n(t)},Ho=(e,t)=>Vo(Lo(t),Lo(e.transport.endpoint)),Uo=(e,t)=>Ho(e,t),Wo=(e,t)=>typeof e==`function`?e(t):typeof e==`string`?t.includes(e):(e.lastIndex=0,e.test(t)),Go=(e,t)=>(Array.isArray(e)?e:e?[e]:[]).some(e=>Wo(e,t)),Ko=e=>typeof e.tracking.request==`object`?e.tracking.request:void 0,qo=(e,t)=>{var n;return Uo(e,t)||Go((n=Ko(e))==null?void 0:n.excludedUrls,Lo(t))},Jo=(e,t)=>{if(typeof e!=`string`)return Wo(e,t);try{let n=new URL(e),r=new URL(t);if(![`http:`,`https:`].includes(n.protocol)||n.username||n.password||n.search||n.hash||n.origin!==r.origin)return!1;let i=Bo(n.pathname);return i===`/`||r.pathname===i||r.pathname.startsWith(`${i}/`)}catch(e){return!1}},Yo=(e,t)=>{var n;let r=(n=Ko(e))==null?void 0:n.allowedTracingUrls,i=Lo(t);return(Array.isArray(r)?r:r?[r]:[]).some(e=>Jo(e,i))},J={actionFrustrationType:`action.frustration.type`,actionId:`action.id`,actionIds:`action.ids`,actionEndReason:`action.end_reason`,actionLoadingTime:`action.loading_time`,actionName:`action.name`,actionNameSource:`action.name_source`,actionPositionX:`action.position.x`,actionPositionY:`action.position.y`,actionTargetHeight:`action.target.height`,actionTargetName:`action.target.name`,actionTargetPath:`action.target.path`,actionTargetSelector:`action.target.selector`,actionTargetTag:`action.target.tag`,actionTargetWidth:`action.target.width`,actionType:`action.type`,deploymentEnvironmentName:`deployment.environment.name`,cacheHit:`resource.cache.hit`,deviceType:`device.type`,longTaskBlockingDuration:`long_task.blocking_duration`,longTaskEntryType:`long_task.entry_type`,longTaskId:`long_task.id`,networkEffectiveType:`network.effective_type`,networkStatus:`network.status`,nextHopProtocol:`resource.protocol`,resourceInitiatorType:`resource.initiator_type`,outcomeType:`outcome.type`,resourceTimingConnectEnd:`resource.timing.connect_end`,resourceTimingConnectStart:`resource.timing.connect_start`,resourceTimingDomainLookupEnd:`resource.timing.domain_lookup_end`,resourceTimingDomainLookupStart:`resource.timing.domain_lookup_start`,resourceTimingFetchStart:`resource.timing.fetch_start`,resourceTimingFinalResponseHeadersStart:`resource.timing.final_response_headers_start`,resourceTimingRedirectEnd:`resource.timing.redirect_end`,resourceTimingRedirectStart:`resource.timing.redirect_start`,resourceTimingRequestStart:`resource.timing.request_start`,resourceTimingResponseEnd:`resource.timing.response_end`,resourceTimingResponseStart:`resource.timing.response_start`,resourceTimingSecureConnectionStart:`resource.timing.secure_connection_start`,resourceTimingStartTime:`resource.timing.start_time`,resourceTimingWorkerCacheLookupStart:`resource.timing.worker_cache_lookup_start`,resourceTimingWorkerFinalRouterSource:`resource.timing.worker_final_router_source`,resourceTimingWorkerMatchedRouterSource:`resource.timing.worker_matched_router_source`,resourceTimingWorkerRouterEvaluationStart:`resource.timing.worker_router_evaluation_start`,resourceTimingWorkerStart:`resource.timing.worker_start`,serviceName:`service.name`,serviceVersion:`service.version`,sessionHasReplay:`session.has_replay`,sessionId:`session.id`,sessionStartTime:`session.start_time`,sessionLastActivityTime:`session.last_activity_time`,sessionSampleRate:`session.sample_rate`,sessionPhase:`session.phase`,sessionType:`session.type`,spanType:`span_type`,tabId:`tab.id`,timingActivationStart:`timing.activation_start`,timingConnectEnd:`timing.connect_end`,timingConnectStart:`timing.connect_start`,timingDomContentLoadedEventEnd:`timing.dom_content_loaded_event_end`,timingDomContentLoadedEventStart:`timing.dom_content_loaded_event_start`,timingDomainLookupEnd:`timing.domain_lookup_end`,timingDomainLookupStart:`timing.domain_lookup_start`,timingFetchStart:`timing.fetch_start`,timingFinalResponseHeadersStart:`timing.final_response_headers_start`,timingLoadEventEnd:`timing.load_event_end`,timingLoadEventStart:`timing.load_event_start`,timingRedirectEnd:`timing.redirect_end`,timingRedirectStart:`timing.redirect_start`,timingRequestStart:`timing.request_start`,timingResponseEnd:`timing.response_end`,timingResponseStart:`timing.response_start`,timingSecureConnectionStart:`timing.secure_connection_start`,timingStartTime:`timing.start_time`,timingUnloadEventEnd:`timing.unload_event_end`,timingUnloadEventStart:`timing.unload_event_start`,timingWorkerCacheLookupStart:`timing.worker_cache_lookup_start`,timingWorkerRouterEvaluationStart:`timing.worker_router_evaluation_start`,timingWorkerStart:`timing.worker_start`,userId:`user.id`,userAgentName:`user_agent.name`,userAgentOsName:`user_agent.os.name`,userAgentVersion:`user_agent.version`,vitalMetric:`vital.metric`,vitalId:`vital.id`,vitalScope:`vital.scope`,vitalValue:`vital.value`,vitalVersion:`vital.version`,viewDomComplete:`view.dom_complete`,viewDomContentLoaded:`view.dom_content_loaded`,viewDomInteractive:`view.dom_interactive`,viewFirstByte:`view.first_byte`,viewEndReason:`view.end_reason`,viewForegroundTime:`view.foreground_time`,viewId:`view.id`,viewIsActive:`view.is_active`,viewLoadEvent:`view.load_event`,viewLoadingTime:`view.loading_time`,viewLoadingTimeSource:`view.loading_time_source`,viewLoadingType:`view.loading_type`,viewName:`view.name`,viewPhase:`view.phase`,viewPageStates:`view.page_states`,viewPrevious:`view.previous`,viewPreviousUrlTemplate:`view.previous_url_template`,viewReferrer:`view.referrer`,viewStartedAt:`view.started_at`,viewTimeSpent:`view.time_spent`,viewUrl:`view.url`,viewUrlTemplate:`view.url_template`,viewVersion:`view.version`,websocketPhase:`websocket.phase`},Y={abort:`abort`,error:`error`,success:`success`,timeout:`timeout`,unknown:`unknown`,warning:`warning`},X={action:`action`,custom:`custom`,error:`error`,longTask:`long_task`,resource:`resource`,session:`session`,vital:`vital`,view:`view`,websocket:`websocket`},Z=(e,t)=>{let n=e[t];return typeof n==`string`&&n.trim()?n.trim():void 0},Q=({attributes:e,nameHint:t,spanType:n})=>{if(n===X.session){let t=Z(e,J.sessionPhase);return t?`session.${t}`:`session`}if(n===X.view){var r,i;return(r=(i=Z(e,J.viewName))==null?Z(e,J.viewUrlTemplate):i)==null?`view`:r}if(n===X.resource){var a;let t=(a=Z(e,`http.request.method`))==null?void 0:a.toUpperCase(),n=Z(e,`url.template`);if(t&&n)return`${t} ${n}`;let r=Z(e,`resource.type`);return r?`resource.${r}`:`resource`}if(n===X.action){var o,s;return(o=(s=Z(e,J.actionName))==null?Z(e,J.actionType):s)==null?`action`:o}if(n===X.error){let n=Z(e,`blank_screen.reason`);if(n)return`blank_screen.${n}`;let r=Z(e,`csp.effective_directive`);return r?`csp.${r}`:(t==null?void 0:t.trim())||Z(e,`error.source`)||`error`}if(n===X.vital){var c,l;return(c=(l=Z(e,J.vitalMetric))==null?void 0:l.toUpperCase())==null?`vital`:c}if(n===X.longTask){var u;return(u=Z(e,J.longTaskEntryType))==null?`long-task`:u}if(n===X.websocket){let t=Z(e,J.websocketPhase);return t?`websocket.${t}`:`websocket`}return n===X.custom?t===void 0?`custom`:`custom.${t}`:n},Xo=e=>e===408||e===504?Y.timeout:typeof e==`number`&&e>=400?Y.error:Y.success,Zo=(e,t)=>{if(e===`xmlhttprequest`||e===`xhr`)return`xhr`;if(e===`fetch`||e===`beacon`)return e;if([`navigation`,`iframe`,`frame`].includes(e))return`document`;let n=``;try{n=new URL(t,`http://localhost`).pathname}catch(e){}return/\.css$/i.test(n)?`css`:/\.(?:m?js)$/i.test(n)||e===`script`?`js`:/\.(?:png|jpe?g|gif|svg|ico|webp|avif|bmp|tiff?)$/i.test(n)||[`image`,`img`,`icon`].includes(e)?`image`:/\.(?:woff2?|ttf|otf|eot)$/i.test(n)?`font`:/\.(?:mp[34]|webm|ogg|wav|aac|m4[av]|mov)$/i.test(n)||[`audio`,`video`].includes(e)?`media`:`other`},Qo=e=>e===`good`?Y.success:Y.warning,$o=e=>{if(!e)return{};try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);return{serverAddress:t.hostname,serverPort:t.port?Number(t.port):void 0}}catch(e){return{}}},es=({outcome:e=Y.success,spanType:t})=>({[J.spanType]:t,[J.outcomeType]:e}),ts=({initiatorType:e=`other`,method:t,outcome:n,url:r})=>{let i=$o(r),a=(n==null?void 0:n.type)===`response`&&typeof n.statusCode==`number`&&n.statusCode>0?n.statusCode:void 0,o=(n==null?void 0:n.type)===`abort`?Y.abort:(n==null?void 0:n.type)===`timeout`?Y.timeout:(n==null?void 0:n.type)===`network_error`?Y.error:typeof a==`number`?Xo(a):Y.unknown,s=t==null?void 0:t.toUpperCase();return K(K(K(K(K({},es({outcome:o,spanType:X.resource})),i.serverAddress?{"server.address":i.serverAddress}:{}),i.serverPort===void 0?{}:{"server.port":i.serverPort}),{},{"resource.type":Zo(e,r),[J.resourceInitiatorType]:e},s?{"http.request.method":s}:{}),typeof a==`number`?{"http.response.status_code":a}:{})},ns=100,rs=100,is=1e3,as=100,os=1e4,ss=`data-bk-action-name`,cs=e=>{var t;if(e.parentElement)return e.parentElement;let n=(t=e.getRootNode)==null?void 0:t.call(e);return typeof ShadowRoot<`u`&&n instanceof ShadowRoot?n.host:null},ls=e=>{var t;let n=(t=e.composedPath)==null?void 0:t.call(e)[0];return n instanceof Element?n:e.target instanceof Element?e.target:void 0},us=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,ds=e=>{let t=e;if(t.tagName.toLowerCase()===`label`&&t.hasAttribute(`for`)){var n;t=document.getElementById((n=t.getAttribute(`for`))==null?``:n)}for(;t;){let e=t.tagName.toLowerCase();if(t.hasAttribute(`contenteditable`)||e===`canvas`||e===`select`||e===`textarea`||e===`a`&&t.hasAttribute(`href`))return!0;if(e===`input`){var r,i;return![`button`,`checkbox`,`radio`,`range`,`reset`,`submit`].includes((r=(i=t.getAttribute(`type`))==null?void 0:i.toLowerCase())==null?`text`:r)}t=cs(t)}return!1},fs=(e={})=>{let t=[],n=new Map,r=new Set,i=e.actionNameAttribute||ss,a=us(e.maxDuration,os),o=[],s,c=e=>!e.hadActivity&&!e.userActivity.input&&!e.userActivity.scroll&&!e.userActivity.selection&&!ds(e.target),l=e=>{var t;if(!r.has(e)||!s||!e.completed)return;if((t=s.isSessionTransitionPending)!=null&&t.call(s)){e.waitingForAssociation||(e.waitingForAssociation=!0,s.afterSessionTransition(()=>{queueMicrotask(()=>{e.waitingForAssociation=!1,l(e)})},!0));return}r.delete(e),clearTimeout(e.reportTimer),e.hadError&&e.frustrations.add(`error_click`),c(e)&&e.frustrations.add(`dead_click`);let n=[`rage_click`,`dead_click`,`error_click`].filter(t=>e.frustrations.has(t)),{endTime:i,loadingTime:a,reason:o}=e.completed,u=e.targetSnapshot,d=e.hadError||n.length>0,f=`click ${u.name}`,p=K(K(K(K(K(K(K(K(K(K(K({},s.config.hooks.getPageAttributes()),es({outcome:d?Y.warning:Y.success,spanType:X.action})),e.runtimeAttributes),{},{[J.actionId]:e.id,[J.actionName]:f,[J.actionType]:`click`,[J.actionTargetName]:u.name,[J.actionTargetTag]:u.tag,[J.actionNameSource]:u.nameSource,[J.actionEndReason]:o},a===void 0?{}:{[J.actionLoadingTime]:a}),u.selector===void 0?{}:{[J.actionTargetSelector]:u.selector}),u.path===void 0?{}:{[J.actionTargetPath]:u.path}),u.width===void 0?{}:{[J.actionTargetWidth]:u.width}),u.height===void 0?{}:{[J.actionTargetHeight]:u.height}),u.x===void 0?{}:{[J.actionPositionX]:u.x}),u.y===void 0?{}:{[J.actionPositionY]:u.y}),n.length?{[J.actionFrustrationType]:n}:{});delete p[J.actionIds],s.startSpan(Q({attributes:p,spanType:X.action}),p,{rumSpanType:X.action,startTime:e.startTime}).end(i)},u=(e,t,i,a=Date.now(),o)=>{if(!n.delete(e.id)||!s)return;clearTimeout(e.validationTimer),clearTimeout(e.quietTimer),clearTimeout(e.maxDurationTimer),s.endActionContext(e.id,Math.max(e.startTime,a),o),e.completed=K(K({endTime:Math.max(e.startTime,a)},i===`activity_end`?{loadingTime:Math.max(0,t-e.startTime)}:{}),{},{reason:i}),r.add(e);let c=Math.max(0,e.startTime+is-Date.now());e.reportTimer=setTimeout(()=>l(e),c)},d=()=>{[...r].forEach(l)},f=e=>{if(clearTimeout(e.quietTimer),!e.hadActivity||e.pendingRequests.size)return;let t=Math.max(0,e.lastActivityTime+rs-Date.now());e.quietTimer=setTimeout(()=>u(e,e.lastActivityTime,`activity_end`),t)},p=(e,t)=>{e.hadActivity=!0,e.lastActivityTime=Math.max(e.lastActivityTime,t),f(e)},m=(e,t)=>t>=e.startTime&&t<=e.startTime+a,h=e=>{if(e.type===`error`){let t=new Set(e.actionIds);for(let e of[...n.values(),...r])t.has(e.id)&&(e.hadError=!0);return}if(e.type!==`long_task`)for(let r of n.values()){let n=r.startTime+a;if(Date.now()>=n){u(r,n,`timeout`,n);continue}if(e.type===`request_start`){var t;if(e.url&&Go(s==null||(t=s.config.view)==null?void 0:t.excludedActivityUrls,e.url)||!m(r,e.time))continue;r.pendingRequests.add(e.id),p(r,e.time);continue}if(e.type===`request_end`){if(!r.pendingRequests.delete(e.id))continue;p(r,e.time);continue}if(e.type===`resource`){var i;if(e.url&&Go(s==null||(i=s.config.view)==null?void 0:i.excludedActivityUrls,e.url)||!m(r,e.startTime))continue;p(r,Math.min(e.endTime,n));continue}m(r,e.time)&&p(r,e.time)}},g=(e,t=Date.now(),r)=>{[...n.values()].forEach(n=>{r&&n.runtimeAttributes[J.sessionId]!==r||u(n,t,e,t)})},_=(e,t)=>{let n=`clientX`in t&&typeof t.clientX==`number`?t.clientX:0,r=`clientY`in t&&typeof t.clientY==`number`?t.clientY:0;o=o.filter(t=>e.startTime-t.action.startTime<=is);let i=o.at(-1),a=o.some(e=>e.action.userActivity.scroll||e.action.userActivity.selection),s=(i==null?void 0:i.target)===e.target&&Math.hypot(i.x-n,i.y-r)<=as;(a||i&&!s)&&(o=[]),o.push({action:e,target:e.target,x:n,y:r}),o.length>=3&&e.startTime-o[o.length-3].action.startTime<=is&&(o.slice(-3).map(e=>e.action).forEach(e=>e.frustrations.add(`rage_click`)),o=[])};return{name:`action`,init(c){if(typeof window>`u`||typeof document>`u`)return;s=c;let f={capture:!0,passive:!0},p=t=>{var o;if(!t.isTrusted||document.visibilityState!==`visible`||!c.isSampled()||`button`in t&&typeof t.button==`number`&&t.button!==0)return;let s=ls(t);if(!s)return;let d=Mo(s,t,{actionNameAttribute:i,nameCollection:e.nameCollection});if(!d)return;let f=Po(t),p=q(`action`),m={frustrations:new Set,hadActivity:!1,hadError:!1,id:p,lastActivityTime:f,maxDurationTimer:setTimeout(()=>u(m,f+a,`timeout`,f+a),Math.max(0,f+a-Date.now())),pendingRequests:new Set,runtimeAttributes:c.getRuntimeAttributesAt(f),startTime:f,target:s,targetSnapshot:d,userActivity:{input:!1,scroll:!1,selection:!1},validationTimer:setTimeout(()=>{m.hadActivity||u(m,m.startTime,`no_activity`)},ns)};n.set(p,m),_(m,t),c.registerActionContext(p,f,m.runtimeAttributes),(o=c.isSessionTransitionPending)!=null&&o.call(c)&&c.afterSessionTransition(()=>{var e;if(!n.has(p)&&!r.has(m))return;let t=m.runtimeAttributes[J.viewId],i=typeof t==`string`?(e=m.pendingViews)==null?void 0:e.find(e=>e.time>=f&&e.id!==t):void 0;m.pendingViews=void 0,!(!i||m.completed&&m.completed.endTime<=i.time)&&(n.has(p)?u(m,i.time,`view_change`,i.time,i.relativeTime):(m.completed={endTime:i.time,reason:`view_change`},c.endActionContext(p,i.time,i.relativeTime)),queueMicrotask(()=>l(m)))},!0)};window.addEventListener(`click`,p,f),t.push(()=>window.removeEventListener(`click`,p,f));let m=c.onActivity(h),v=c.onSessionLifecycle(e=>{if(e.type===`expired`){if(e.endTimeKnown===!1)for(let t of n.values())t.runtimeAttributes[J.sessionId]===e.id&&(n.delete(t.id),c.endActionContext(t.id,t.startTime),clearTimeout(t.validationTimer),clearTimeout(t.quietTimer),clearTimeout(t.maxDurationTimer));else g(`session_expired`,e.expiredAt,e.id);o=o.filter(t=>t.action.runtimeAttributes[J.sessionId]!==e.id),d()}}),y=c.onViewChange(e=>{if(e.id){for(let a of[...n.values(),...r]){var t;let r=a.runtimeAttributes[J.viewId],o=(t=e.startedAt)==null?Date.now():t;if(typeof r!=`string`){var i;((i=a.pendingViews)==null?a.pendingViews=[]:i).push({id:e.id,time:o,relativeTime:e.relativeStartedAt});continue}r!==e.id&&n.has(a.id)&&u(a,o,`view_change`,o,e.relativeStartedAt)}for(let t of r){let n=t.runtimeAttributes[J.viewId];typeof n==`string`&&n!==e.id&&l(t)}o=o.filter(t=>!t.action.runtimeAttributes[J.viewId]||t.action.runtimeAttributes[J.viewId]===e.id)}});t.push(m,v,y);let b=()=>{document.visibilityState===`hidden`&&(o=[],g(`page_hidden`),d())},x=()=>{o=[],g(`page_exit`),d()};window.addEventListener(`pagehide`,x),document.addEventListener(`visibilitychange`,b),t.push(()=>window.removeEventListener(`pagehide`,x),()=>document.removeEventListener(`visibilitychange`,b));let S=e=>{new Set([...n.values(),...r,...o.map(e=>e.action)]).forEach(t=>{t.userActivity[e]=!0,e!==`input`&&t.frustrations.delete(`rage_click`)})},C=e=>{e.isTrusted&&S(`input`)},w=e=>{e.isTrusted&&S(`scroll`)},T=e=>{e.isTrusted&&S(`selection`)};window.addEventListener(`input`,C,f),window.addEventListener(`scroll`,w,f),document.addEventListener(`selectionchange`,T,f),t.push(()=>window.removeEventListener(`input`,C,f),()=>window.removeEventListener(`scroll`,w,f),()=>document.removeEventListener(`selectionchange`,T,f))},shutdown(){for(g(`shutdown`),d();t.length;){var e;(e=t.pop())==null||e()}o=[],s=void 0}}},ps=e=>{let t=e.type===`characterData`?e.target.parentElement:e.target;return t instanceof Element&&!!t.closest(`[data-bk-excluded-activity-mutations]`)},ms=()=>{let e,t=[];return{name:`activity`,init(n){if(typeof document<`u`&&typeof MutationObserver<`u`&&(e=new MutationObserver(e=>{e.length&&!e.every(ps)&&n.notifyActivity({time:Date.now(),type:`dom_mutation`})}),e.observe(document,{attributes:!0,characterData:!0,childList:!0,subtree:!0})),!(typeof window>`u`)&&typeof window.open==`function`){let e=window.open,r=((...t)=>(n.notifyActivity({time:Date.now(),type:`window_open`}),Reflect.apply(e,window,t)));window.open=r,t.push(()=>{window.open===r&&(window.open=e)})}},shutdown(){var n;for(e==null||e.disconnect(),e=void 0;t.length;)(n=t.pop())==null||n()}}},hs=[.2,.5,.8],gs=24,_s=32,vs=32,ys=32,bs=e=>{var t,n,r;return(t=(n=e.parentElement)==null?(r=e.getRootNode)==null||(r=r.call(e))==null?void 0:r.host:n)==null?null:t},xs=e=>typeof getComputedStyle==`function`?getComputedStyle(e):void 0,Ss=e=>{if(!e||e===`transparent`)return 0;let t=e.match(/\/\s*([\d.]+)(%)?\s*\)$/);if(t)return Number(t[1])/(t[2]?100:1);let n=e.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)$/);return n?Number(n[1]):1},Cs=e=>{let t=e;for(let e=0;t&&e<gs;e++,t=bs(t)){let n=xs(t);if(n&&(n.display===`none`||n.contentVisibility===`hidden`||e===0&&(n.visibility===`hidden`||n.visibility===`collapse`)||Number(n.opacity||1)===0))return`hidden`}return t?`unknown`:`visible`},ws=(e,t)=>t.some(t=>{try{return e.matches(t)||!!e.closest(t)}catch(e){return!1}}),Ts=(e,t,n)=>{let r=e.childNodes;if(!r)return!1;for(let e=0;e<Math.min(r.length,vs);e++){var i;let a=r[e];if(a.nodeType!==3||!((i=a.textContent)!=null&&i.trim()))continue;if(typeof document.createRange!=`function`)return!0;let o=document.createRange();o.selectNodeContents(a);let s=o.getClientRects();for(let e=0;e<Math.min(s.length,ys);e++){let r=s[e];if(t>=r.left&&t<=r.right&&n>=r.top&&n<=r.bottom)return!0}if(s.length>ys)return}return r.length>vs?void 0:!1},Es=(e,t,n,r)=>{let i=typeof document.elementsFromPoint==`function`?document.elementsFromPoint(n,r):[document.elementFromPoint(n,r)].filter(e=>!!e);for(let o of i.slice(0,_s)){let i=Cs(o);if(i===`hidden`)continue;if(i===`unknown`)return`unknown`;let s=o===e||e.contains(o);if(s&&ws(o,t))return`loading`;let c=xs(o),l=o.tagName.toLowerCase();if([`canvas`,`iframe`,`object`,`embed`,`video`,`svg`].includes(l)||o.shadowRoot)return`unknown`;if(typeof getComputedStyle==`function`)for(let e of[`::before`,`::after`]){let t=getComputedStyle(o,e);if(t.content&&![`none`,`normal`,`""`].includes(t.content))return`unknown`}if(c!=null&&c.backgroundImage&&c.backgroundImage!==`none`)return`unknown`;if(l===`img`){let e=o;return e.complete&&e.naturalWidth>0&&s?`content`:`unknown`}if(s&&[`input`,`textarea`,`select`].includes(l))return`content`;let u=Ts(o,n,r);if(u===void 0)return`unknown`;if(u&&(!(c!=null&&c.color)||Ss(c.color)>0))return s?`content`:`unknown`;if(Ss(c==null?void 0:c.backgroundColor)>=1){let e=1,t=o;for(let n=0;t&&n<gs;n++,t=bs(t)){var a;e*=Number(((a=xs(t))==null?void 0:a.opacity)||1)}if(e>=1)return`blank`}}return i.length>_s?`unknown`:`blank`},Ds=(e,t,n=.8)=>{var r,i;let a=document.querySelector(e),o=(r=a==null?document.body:a)==null?document.documentElement:r,s={blank:0,content:0,loading:0,unknown:0},c=o==null||(i=o.getBoundingClientRect)==null?void 0:i.call(o),l=c&&c.width>0?Math.max(0,c.left):0,u=c&&c.height>0?Math.max(0,c.top):0,d=c&&c.width>0?Math.min(window.innerWidth,c.right):window.innerWidth,f=c&&c.height>0?Math.min(window.innerHeight,c.bottom):window.innerHeight;for(let e of hs)for(let n of hs){let r=o&&d>l&&f>u?Es(o,t,l+(d-l)*n,u+(f-u)*e):`unknown`;s[r]++}let p=s.blank+s.content,m=p?s.blank/p:0,h=p>=5?m>=n?`blank`:`content`:s.loading>s.unknown?`loading`:`unknown`;return{contentCount:s.content,emptyCount:s.blank,ignoredCount:s.loading,unknownCount:s.unknown,reason:a?`empty_viewport`:`missing_root`,score:m,state:h,validCount:p}},Os=[`[data-loading="true"]`,`[aria-busy="true"]`,`.loading`,`.is-loading`,`.spinner`,`.skeleton`,`.bk-loading`],ks=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,As=(e={})=>{var t;let n=ks(e.checkDelay,1e3),r=ks(e.confirmationDelay,200),i=Math.max(100,ks(e.maxWait,1e4)),a=Math.min(1,ks(e.threshold,.8)),o=e.rootSelector||`body`,s=[...Os,...(t=e.ignoreSelectors)==null?[]:t],c;return{name:`blank-screen`,init(e){if(typeof window>`u`||typeof document>`u`)return;let t=!1,l=!1,u,d,f,p=Date.now(),m=p,h=`view`,g,_,v,y=new Set,b=()=>{clearTimeout(f),f=void 0},x=()=>!l&&document.visibilityState!==`hidden`,S=()=>document.readyState!==`loading`,C=(n,r,i=r.reason)=>{var a,o,s;let c=u;if(!c||t||!e.isSampled()||u!==c)return;let l=Date.now(),f=(a=(o=e.getRuntimeAttributesAt)==null?void 0:o.call(e,l))==null?e.getRuntimeAttributes():a;if(u!==c||f[`view.id`]!==c||typeof f[`session.id`]!=`string`||f[`session.id`]!==d)return;let p=n===`detected`,m=p?X.error:X.custom,g=K(K(K(K(K(K({},f),es({spanType:m,outcome:p?Y.error:n===`recovered`?Y.success:Y.unknown})),{},{"blank_screen.phase":n,"blank_screen.state":(s=r.state)==null?`unknown`:s,"blank_screen.strategy_version":2,"blank_screen.trigger":h},i?{"blank_screen.reason":i}:{}),r.score===void 0?{}:{"blank_screen.empty_ratio":r.score}),r.validCount===void 0?{}:{"blank_screen.empty_sample_count":r.emptyCount,"blank_screen.valid_sample_count":r.validCount,"blank_screen.ignored_sample_count":r.ignoredCount,"blank_screen.unknown_sample_count":r.unknownCount}),_?K({"blank_screen.id":_.id,"blank_screen.first_detected_at":_.firstDetectedAt,"blank_screen.detected_at":_.detectedAt},n===`recovered`?{"blank_screen.duration":Math.max(0,l-_.firstDetectedAt),"blank_screen.recovered_at":l}:{}):{}),v=n===`detected`?`blank_screen.${i}`:`blank_screen.${n}`;e.startSpan(v,g,{startTime:l}).end(l)},w=(e,t)=>{let n=`${e.state}:${t==null?e.reason:t}`;n!==v&&(C(`observation`,e,t),v=n)},T=()=>{if(b(),t||!u||!x())return;let e=Date.now(),r=Math.max(0,p+i-e),a=!S()||y.size?r:Math.min(r,Math.max(0,m+n-e));f=setTimeout(D,a)},E=()=>{b(),!t&&u&&x()&&(f=setTimeout(()=>{p=Date.now(),D()},i))},D=()=>{if(f=void 0,t||!u||!x())return;let c=Date.now();if(!S()||y.size||c-m<n){g=void 0,c-p>=i?(w({state:S()?`loading`:`unknown`},S()?`activity_timeout`:`document_not_ready`),E()):T();return}let l;try{l=Ds(o,s,a)}catch(t){var d;e.config.debug&&((d=globalThis.console)==null||d.warn(`[bk-ot][blank-screen] detection failed:`,t)),w({state:`unknown`},`detection_unavailable`),E();return}if(l.state===`blank`){if(!_&&g===void 0){g=c,f=setTimeout(D,r);return}_||(_={id:q(`blank`),firstDetectedAt:g,detectedAt:c,reason:l.reason},C(`detected`,l))}else g=void 0,l.state===`content`?(_&&C(`recovered`,l,_.reason),_=void 0,v=void 0):w(l,l.state===`loading`?`loading_visible`:`insufficient_evidence`);E()},O=e=>{g=void 0,h=e,m=Date.now(),(!f||m-p>=i)&&(p=m),T()},k=e.onActivity(n=>{var r;t||n.type===`long_task`||(n.type===`request_start`||n.type===`resource`)&&n.url&&Go((r=e.config.view)==null?void 0:r.excludedActivityUrls,n.url)||(n.type===`request_start`&&y.add(n.id),!(n.type===`request_end`&&!y.delete(n.id))&&u&&O(n.type))}),A=e.onViewChange(t=>{if(t.id===u)return;b(),u=t.id;let n=e.getRuntimeAttributes()[`session.id`];d=typeof n==`string`?n:void 0,g=void 0,_=void 0,v=void 0,p=m=Date.now(),h=`view`,T()}),j=()=>{b(),g=void 0,x()&&(p=Date.now(),O(`visible`))},M=()=>{p=Date.now(),O(`document_ready`)},N=()=>{l=!0,b(),g=void 0},P=()=>{l=!1,j()};document.addEventListener(`visibilitychange`,j),document.addEventListener(`DOMContentLoaded`,M),document.addEventListener(`freeze`,N),document.addEventListener(`resume`,P),c=()=>{t=!0,b(),k(),A(),y.clear(),document.removeEventListener(`visibilitychange`,j),document.removeEventListener(`DOMContentLoaded`,M),document.removeEventListener(`freeze`,N),document.removeEventListener(`resume`,P)}},shutdown(){c==null||c(),c=void 0}}},js=new Set(Object.values(J)),$=(e={})=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t.slice():t])),Ms=[J.sessionId,J.sessionHasReplay,J.sessionType,J.sessionStartTime,J.sessionLastActivityTime],Ns=e=>typeof performance<`u`?performance.now()-(Date.now()-e):void 0,Ps=class{constructor(e={},t){var n;z(this,`actionHistory`,new Map),z(this,`appendActionIds`,(e,t,n=!1)=>{let r=e[J.sessionId],i=e[J.viewId];if(typeof r!=`string`||typeof i!=`string`)return e;let a=[...this.actionHistory].filter(([,e])=>{var a;return(n?(a=e.relativeStartedAt)==null?1/0:a:e.startedAt)<=t&&((n?e.relativeEndedAt:e.endedAt)===void 0||t<(n?e.relativeEndedAt:e.endedAt))&&e.attributes[J.sessionId]===r&&e.attributes[J.viewId]===i}).map(([e])=>e);return a.length&&(e[J.actionIds]=a),e}),z(this,`attributes`,{}),z(this,`queuedViewCommands`,[]),z(this,`recordAssociation`,(e,t,n,r)=>{let i=e.at(-1);if(i&&i.endedAt===void 0&&(i.endedAt=Math.max(i.startedAt,n)),r){let r={};for(let e of t){let t=this.attributes[e];t!==void 0&&(r[e]=t)}e.push({attributes:r,startedAt:n})}e.length>100&&e.splice(0,e.length-100)}),z(this,`sampled`,!1),z(this,`samplingHistory`,[]),z(this,`sessionHistory`,[]),z(this,`sessionLifecycleListeners`,new Set),z(this,`setOptionalAttribute`,(e,t)=>{if(t===void 0){delete this.attributes[e];return}this.attributes[e]=t}),z(this,`user`,{}),z(this,`view`,{}),z(this,`viewAttributeKeys`,new Set),z(this,`viewChangeListeners`,new Set),z(this,`viewCommandListeners`,new Set),z(this,`viewHistory`,[]),z(this,`viewLifecycles`,new Map),z(this,`viewScopedAttributeKeys`,new Set),z(this,`dispatchViewCommand`,e=>{if(e.type===`start`?e=K(K({},e),{},{options:K(K({},e.options),{},{attributes:$(e.options.attributes)})}):e.type===`set_context`?e=K(K({},e),{},{attributes:$(e.attributes)}):e.type===`set_context_property`&&Array.isArray(e.value)&&(e=K(K({},e),{},{value:e.value.slice()})),this.viewCommandListeners.size===0){if(e.type===`start`){let e=this.queuedViewCommands.findIndex(e=>e.type===`start`);e>=0&&this.queuedViewCommands.splice(e,1)}this.queuedViewCommands.push(e);return}this.viewCommandListeners.forEach(t=>t(e))}),z(this,`endActionContext`,(e,t,n)=>{var r;let i=this.actionHistory.get(e);if(!i)return;i.endedAt=Math.min((r=i.endedAt)==null?1/0:r,Math.max(i.startedAt,t));let a=n==null?i.relativeStartedAt===void 0||typeof performance>`u`?void 0:Math.min(performance.now(),i.relativeStartedAt+t-i.startedAt):n;if(a!==void 0&&i.relativeStartedAt!==void 0){var o;i.relativeEndedAt=Math.min((o=i.relativeEndedAt)==null?1/0:o,Math.max(i.relativeStartedAt,a))}let s=[...this.actionHistory].filter(([,e])=>e.endedAt!==void 0).sort(([,e],[,t])=>e.endedAt-t.endedAt);for(let[e]of s.slice(0,Math.max(0,s.length-100)))this.actionHistory.delete(e)}),z(this,`getAttributes`,()=>this.appendActionIds($(this.attributes),Date.now())),z(this,`getAttributesAt`,e=>{var t;if(!Number.isFinite(e))return this.getAttributes();let n=K({},this.attributes),r=(t,r)=>{for(let e of r)delete n[e];let i=[...t].reverse().find(t=>t.startedAt<=e&&(t.endedAt===void 0||e<t.endedAt));return i&&Object.assign(n,i.attributes),i},i=r(this.sessionHistory,Ms);delete n[J.sessionLastActivityTime];let a=[...(t=i==null?void 0:i.activityTimes)==null?[]:t].reverse().find(t=>t<=e);return a!==void 0&&(n[J.sessionLastActivityTime]=a),r(this.viewHistory,this.viewScopedAttributeKeys),this.appendActionIds($(n),e)}),z(this,`getRuntimeContextAtRelativeTime`,e=>{var t;if(!Number.isFinite(e))return;let n=[...this.viewLifecycles.values()].reverse().find(({view:t})=>t.relativeStartedAt!==void 0&&t.relativeStartedAt<=e&&(t.relativeEndedAt===void 0||e<t.relativeEndedAt));if((n==null?void 0:n.view.startedAt)===void 0)return;let r=n.view.startedAt+e-n.view.relativeStartedAt,i=$(this.attributes);for(let e of[...Ms,...this.viewScopedAttributeKeys]){delete i[e];let t=n.runtimeAttributes[e];t!==void 0&&(i[e]=Array.isArray(t)?t.slice():t)}delete i[J.sessionLastActivityTime];let a=[...this.sessionHistory].reverse().find(e=>e.attributes[J.sessionId]===i[J.sessionId]),o=[...(t=a==null?void 0:a.activityTimes)==null?[]:t].reverse().find(e=>e<=r);return o!==void 0&&(i[J.sessionLastActivityTime]=o),delete i[J.actionIds],{attributes:this.appendActionIds(i,e,!0),time:r}}),z(this,`getUser`,()=>K({},this.user)),z(this,`getView`,()=>K(K({},this.view),{},{attributes:$(this.view.attributes)})),z(this,`getViewHistory`,()=>[...this.viewLifecycles.values()].map(({view:e,runtimeAttributes:t})=>({view:K(K({},e),{},{attributes:$(e.attributes)}),runtimeAttributes:$(t)}))),z(this,`isSessionActive`,()=>typeof this.attributes[J.sessionId]==`string`),z(this,`isSessionSampledAt`,e=>{var t,n;return Number.isFinite(e)?(t=(n=[...this.samplingHistory].reverse().find(t=>t.startedAt<=e&&(t.endedAt===void 0||e<t.endedAt)))==null?void 0:n.sampled)==null?!1:t:this.sampled}),z(this,`isViewActive`,()=>typeof this.attributes[J.viewId]==`string`),z(this,`notifySessionLifecycle`,e=>{this.sessionLifecycleListeners.forEach(t=>t(e))}),z(this,`onSessionLifecycle`,e=>(this.sessionLifecycleListeners.add(e),()=>this.sessionLifecycleListeners.delete(e))),z(this,`onViewChange`,e=>(this.viewChangeListeners.add(e),this.view.id&&e(this.getView()),()=>this.viewChangeListeners.delete(e))),z(this,`onViewCommand`,e=>{for(this.viewCommandListeners.add(e);this.queuedViewCommands.length;)e(this.queuedViewCommands.shift());return()=>this.viewCommandListeners.delete(e)}),z(this,`registerActionContext`,(e,t,n)=>{this.actionHistory.has(e)||this.actionHistory.set(e,{attributes:n,startedAt:t,relativeStartedAt:Ns(t)})}),z(this,`setAttributes`,(e,t=Date.now())=>{let n=this.attributes[J.sessionId];J.sessionId in e&&e[J.sessionId]!==n&&Ms.forEach(e=>delete this.attributes[e]);for(let[t,n]of Object.entries(e))if(!(t===J.actionId||t===J.actionIds)){if(n===void 0){delete this.attributes[t];continue}this.attributes[t]=Array.isArray(n)?n.slice():n}let r=this.attributes[J.sessionId];if(r!==n&&this.recordAssociation(this.sessionHistory,Ms,t,typeof r==`string`),typeof r==`string`){let e=this.sessionHistory.at(-1),t=this.attributes[J.sessionLastActivityTime];if(e&&typeof t==`number`&&Number.isFinite(t)){var i;let n=(i=e.activityTimes)==null?e.activityTimes=[]:i;n.at(-1)!==t&&(n.push(t),n.length>100&&n.splice(0,n.length-100))}}else Ms.forEach(e=>delete this.attributes[e])}),z(this,`setSessionSampled`,(e,t=Date.now())=>{if(e===this.sampled)return;let n=this.samplingHistory.at(-1);n&&n.endedAt===void 0&&(n.endedAt=Math.max(n.startedAt,t)),this.sampled=e,e&&this.samplingHistory.push({sampled:e,startedAt:t}),this.samplingHistory.length>100&&this.samplingHistory.splice(0,this.samplingHistory.length-100)}),z(this,`setUser`,e=>{if(this.user=K(K({},this.user),e),`id`in e){if(e.id===void 0){delete this.attributes[J.userId];return}this.attributes[J.userId]=e.id}}),z(this,`setView`,(e,t=e.id===this.view.id||(n=e.startedAt)==null?Date.now():n)=>{let r=this.view.id?this.viewLifecycles.get(this.view.id):void 0;if(r&&e.id!==this.view.id){var i,a,o;r.view.endedAt=(i=e.endedAt)==null?t:i,r.view.relativeEndedAt=(a=e.relativeEndedAt)==null?e.relativeStartedAt:a,r.view.interactionCountAtEnd=(o=e.interactionCountAtEnd)==null?e.interactionCountAtStart:o;let n=this.getAttributes();for(let e of Object.keys(n))(e.startsWith(`session.`)||e.startsWith(`view.`)||e===J.tabId)&&delete n[e];for(let[e,t]of Object.entries(r.runtimeAttributes))(e.startsWith(`session.`)||e.startsWith(`view.`)||e===J.tabId)&&(n[e]=t);r.runtimeAttributes=n}this.viewAttributeKeys.forEach(e=>delete this.attributes[e]),this.viewAttributeKeys.clear();let s={};for(let[t,n]of Object.entries($(e.attributes)))n===void 0||js.has(t)||t.startsWith(`view.custom_timings.`)||(s[t]=n,this.attributes[t]=n,this.viewAttributeKeys.add(t),this.viewScopedAttributeKeys.add(t));this.view=K(K({},e),{},{attributes:s}),this.setOptionalAttribute(J.viewId,e.id),this.setOptionalAttribute(J.viewUrl,e.url),this.setOptionalAttribute(J.viewUrlTemplate,e.urlTemplate),this.setOptionalAttribute(J.viewLoadingType,e.loadingType),this.setOptionalAttribute(J.viewName,e.name),[J.viewId,J.viewUrl,J.viewUrlTemplate,J.viewLoadingType,J.viewName].forEach(e=>this.viewScopedAttributeKeys.add(e)),this.recordAssociation(this.viewHistory,this.viewScopedAttributeKeys,t,typeof e.id==`string`&&e.id.length>0),e.id&&(this.viewLifecycles.set(e.id,{view:this.getView(),runtimeAttributes:this.getAttributes()}),this.viewLifecycles.size>100&&this.viewLifecycles.delete(this.viewLifecycles.keys().next().value)),this.viewChangeListeners.forEach(e=>e(this.getView()))}),this.setAttributes(e),t&&this.setUser(t)}},Fs=x(`bk-rum-context-time`),Is=x(`bk-rum-context-snapshot`),Ls=[`http.url`,`url.full`],Rs=new WeakSet,zs=new WeakMap,Bs=(e,t,n)=>{zs.set(e,{attributes:$(t),keys:new Set(n)})},Vs=e=>{Rs.add(e)},Hs=e=>{for(let n of Ls){var t;let r=(t=e.attributes)==null?void 0:t[n];if(typeof r==`string`)return r}},Us=e=>{let t=e==null?void 0:e[J.sessionId];return typeof t==`string`&&t.length>0},Ws=e=>{let t=e==null?void 0:e[J.viewId];return typeof t==`string`&&t.length>0},Gs=e=>Us(e)&&Ws(e),Ks=e=>(e==null?void 0:e[J.spanType])===X.session,qs=e=>[X.resource,X.error,X.longTask].some(t=>e[J.spanType]===t),Js=e=>((e[J.spanType]!==X.action||typeof e[J.actionId]!=`string`)&&delete e[J.actionId],qs(e)||delete e[J.actionIds],e),Ys=(e,t)=>K(K({},e),{},{attributes:t,duration:e.duration,ended:e.ended,droppedAttributesCount:e.droppedAttributesCount,droppedEventsCount:e.droppedEventsCount,droppedLinksCount:e.droppedLinksCount,spanContext:()=>e.spanContext()}),Xs=e=>e.startTime?e.startTime[0]*1e3+e.startTime[1]/1e6:Date.now(),Zs=class{redactEnvelope(e){var t,n;let r=e=>{var t,n,r;let i=$(e);return(t=(n=this.config.hooks)==null||(r=n.redactAttributes)==null?void 0:r.call(n,i))==null?i:t};return K(K({},e),{},{attributes:r(e.attributes),links:((t=e.links)==null?[]:t).map(e=>K(K({},e),{},{context:K({},e.context),attributes:r(e.attributes)})),events:((n=e.events)==null?[]:n).map(e=>K(K({},e),{},{time:[...e.time],attributes:r(e.attributes)})),spanContext:()=>e.spanContext()})}constructor(e,t,n,r,i){z(this,`actionContexts`,new WeakMap),z(this,`pending`,new WeakMap),this.inner=e,this.config=t,this.getRuntimeAttributes=n,this.association=r,this.onError=i}forceFlush(){return this.inner.forceFlush()}onEnd(e){let t=e,n=this.pending.get(e);if(n){if(!n.attributes){n.ended=e;return}this.pending.delete(e),e=Ys(e,K(K({},n.attributes),e.attributes))}let r=$(e.attributes),i=zs.get(t);if(zs.delete(t),i){for(let e of i.keys)delete r[e];Object.assign(r,i.attributes)}if(Js(r),Ks(r))for(let e of Object.keys(r))e.startsWith(`view.`)&&delete r[e];let a=this.actionContexts.get(t);this.actionContexts.delete(t),qs(r)&&a&&(delete r[J.actionIds],r[J.sessionId]===a[J.sessionId]&&r[J.viewId]===a[J.viewId]&&a[J.actionIds]!==void 0&&(r[J.actionIds]=a[J.actionIds])),e=Ys(e,r);let o=Hs(e);if(!(Rs.delete(t)||o&&Ho(this.config,o)||!Gs(e.attributes)&&!(Ks(e.attributes)&&Us(e.attributes))||this.association&&!this.association.isSampled(e.attributes))){try{var s,c,l,u;e=this.redactEnvelope(e);let t={attributes:e.attributes,events:e.events,links:e.links,name:e.name,signal:`span`};if(((s=this.config.hooks)==null||(c=s.beforeSend)==null?void 0:c.call(s,t))===!1)return;e=this.redactEnvelope(K(K({},e),{},{attributes:t.attributes,name:t.name,events:(l=t.events)==null?[]:l,links:(u=t.links)==null?[]:u}))}catch(e){var d;this.config.debug&&((d=globalThis.console)==null||d.warn(`[bk-ot] span filtering failed:`,e));return}if(Js(e.attributes),e.attributes[J.spanType]===X.error){var f;let t=e.attributes[J.actionIds];(f=this.onError)==null||f.call(this,{type:`error`,time:Xs(e),actionIds:Array.isArray(t)?t.filter(e=>typeof e==`string`):[]})}this.inner.onEnd(e)}}onStart(e,t){var n,r,i,a,o,s;(n=this.association)==null||n.checkSession();let c=(r=e.attributes)==null?{}:r;if(((i=t.getValue)==null?void 0:i.call(t,Is))===!0){this.actionContexts.set(e,K({},c)),this.inner.onStart(e,t);return}let l=(a=t.getValue)==null?void 0:a.call(t,Fs),u=typeof l==`number`?l:Xs(e);if(!Us(c)&&(o=this.association)!=null&&o.isPending(u)){let n=K({},this.getRuntimeAttributes());for(let e of Object.keys(n))(e.startsWith(`session.`)||e.startsWith(`view.`)||e===J.actionId||e===J.actionIds||e in c)&&delete n[e];e.setAttributes(n);let r={};this.pending.set(e,r),this.association.whenReady(()=>{r.attributes=this.association.getAttributesAt(u),this.actionContexts.set(e,r.attributes),r.ended&&this.onEnd(r.ended)}),this.inner.onStart(e,t);return}let d={},f=(s=this.association)==null?void 0:s.getAttributesAt(u),p=f?K(K({},this.getRuntimeAttributes()),f):this.getRuntimeAttributes();if(f)for(let e of Object.keys(p))(e.startsWith(`session.`)||e.startsWith(`view.`)||e===J.actionId||e===J.actionIds)&&!(e in f)&&delete p[e];this.actionContexts.set(e,p);for(let[e,t]of Object.entries(p))e===J.actionId||e===J.actionIds&&!qs(c)||Ks(c)&&e.startsWith(`view.`)||c[e]===void 0&&t!==void 0&&(d[e]=t);e.setAttributes(d),this.inner.onStart(e,t)}shutdown(){return this.inner.shutdown()}},Qs=1e3,$s=200,ec=6e4,tc=[],nc=e=>e.replace(/#.*$/,``),rc=e=>{e.finished=!0,e.timer!==void 0&&clearTimeout(e.timer);let t=e.callback;e.callback=void 0;try{t==null||t(e.entry)}catch(e){}},ic=e=>{var t;let n=tc.filter(t=>{var n;return nc(t.url)===nc(e.name)&&t.initiatorType===e.initiatorType&&e.startTime>=t.startTime&&e.startTime<=((n=t.callEnd)==null?performance.now():n)+.1}).sort((e,t)=>t.startTime-e.startTime),r=n[0];!r||r.finished||r.entry||((t=n[1])==null?void 0:t.startTime)!==r.startTime&&(r.entry=e,r.callback&&rc(r))},ac=(e,t=performance.now(),n=`fetch`)=>{let r={startTime:t,url:e,initiatorType:n,finished:!1};return tc.push(r),tc.length>Qs&&rc(tc.shift()),{sent:()=>{r.callEnd=performance.now()},cancel:()=>{rc(r)},complete:(e,t=!1)=>{if(r.callback=e,r.finished||r.entry){rc(r);return}r.timer=setTimeout(()=>rc(r),t?ec:$s)}}},oc=`traceparent`,sc=32,cc=16,lc=`0123456789abcdef`,uc=/^[\da-f]+$/,dc=/^0+$/,fc=/^\d+$/,pc=/^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})(?:-.*)?$/,mc=/^([\da-f]{32})-([\da-f]{16})(?:-([01]))?$/,hc=/(?:^|,)_dd\.p\.tid=([\da-f]{16})(?:,|$)/,gc=`0000000000000000`,_c=(e,t)=>e.length===t&&uc.test(e)&&!dc.test(e),vc=e=>{let t=e.toLowerCase();return _c(t,sc)?t:_c(t,cc)?t.padStart(sc,`0`):void 0},yc=e=>{let t=e.toLowerCase();return _c(t,cc)?t:void 0},bc=e=>{let t=new Uint8Array(e/2);if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`)crypto.getRandomValues(t);else for(let e=0;e<t.length;e+=1)t[e]=Math.floor(Math.random()*256);let n=``;for(let e of t)n+=lc[e>>4]+lc[e&15];return dc.test(n)?`${n.slice(1)}1`:n},xc=e=>{if(!fc.test(e))return;let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n)-48;for(let e=0;e<t.length;e+=1){let n=t[e]*10+r;t[e]=n%16,r=(n-n%16)/16}for(;r>0;)t.push(r%16),r=(r-r%16)/16}if(t.length>cc)return;let n=``;for(let e=t.length-1;e>=0;--e)n+=lc[t[e]];return n.padStart(cc,`0`)},Sc=[e=>{var t;let n=(t=e(`traceparent`))==null?void 0:t.trim();if(!n)return;let r=pc.exec(n);if(!r||r[1]===`ff`||r[1]===`00`&&n.length!==55)return;let[,,i,a,o]=r;if(!(!_c(i,sc)||!_c(a,cc)))return{format:`traceparent`,sampled:(Number.parseInt(o,16)&1)==1,spanId:a,traceId:i}},e=>{var t;let n=(t=e(`sentry-trace`))==null?void 0:t.trim().toLowerCase();if(!n)return;let r=mc.exec(n);if(!r)return{format:`sentry-trace`};let[,i,a,o]=r;return K(K({format:`sentry-trace`},o===void 0?{}:{sampled:o===`1`}),_c(i,sc)&&_c(a,cc)?{spanId:a,traceId:i}:{})},e=>{var t;let n=(t=e(`b3`))==null?void 0:t.trim().toLowerCase();if(!n)return;let[r,i,a]=n.split(`-`),o=r?vc(r):void 0,s=i?yc(i):void 0;return K(K({format:`b3`},o&&s?{spanId:s,traceId:o}:{}),a?{sampled:a===`1`||a===`d`}:{})},e=>{var t,n,r;let i=(t=e(`x-b3-traceid`))==null?void 0:t.trim().toLowerCase(),a=(n=e(`x-b3-spanid`))==null?void 0:n.trim().toLowerCase(),o=(r=e(`x-b3-sampled`))==null?void 0:r.trim().toLowerCase();if(!i&&!a&&!o)return;let s=i?vc(i):void 0,c=a?yc(a):void 0;return K(K({format:`b3-multi`},s&&c?{spanId:c,traceId:s}:{}),o?{sampled:o===`1`||o===`d`}:{})},e=>{var t,n,r,i,a,o;let s=(t=e(`x-datadog-trace-id`))==null?void 0:t.trim(),c=(n=e(`x-datadog-parent-id`))==null?void 0:n.trim(),l=(r=e(`x-datadog-sampling-priority`))==null?void 0:r.trim();if(!s&&!c&&!l)return;let u=(i=e(`x-datadog-tags`))==null?void 0:i.trim().toLowerCase(),d=(a=u?(o=hc.exec(u))==null?void 0:o[1]:void 0)==null?gc:a,f=s?xc(s):void 0,p=f?vc(`${d}${f}`):void 0,m=c?xc(c):void 0,h=m?yc(m):void 0;return K(K({format:`datadog`},p&&h?{spanId:h,traceId:p}:{}),l?{sampled:Number(l)>0}:{})},e=>{var t;let n=(t=e(`sw8`))==null?void 0:t.trim();if(!n)return;let r=n.split(`-`)[0];return K({format:`sw8`},r?{sampled:r===`1`}:{})}],Cc=e=>{for(let t of Sc){let n=t(e);if(n)return n}},wc=(e,t,n,r)=>({attributes:n,context:{spanId:t,traceFlags:r===!1?L.NONE:L.SAMPLED,traceId:e}}),Tc=e=>{let t=Cc(e);if(!t){let e=bc(sc),t=bc(cc),n=`00-${e}-${t}-01`;return{links:[wc(e,t,{format:`traceparent`,injected:!0})],traceparent:n}}return!t.traceId||!t.spanId?{links:[]}:{links:[wc(t.traceId,t.spanId,{format:t.format,injected:!1},t.sampled)]}},Ec=(e,t,n)=>{typeof n==`number`&&Number.isFinite(n)&&n>=0&&(e[t]=n)},Dc=e=>{let t={};if(!Number.isFinite(e.startTime)||e.startTime<0)return t;let n=(e,n)=>Ec(t,e,n);return n(J.timingStartTime,e.startTime),n(J.timingRedirectStart,e.redirectStart),n(J.timingRedirectEnd,e.redirectEnd),n(J.timingFetchStart,e.fetchStart),n(J.timingWorkerStart,e.workerStart),n(J.timingWorkerRouterEvaluationStart,e.workerRouterEvaluationStart),n(J.timingWorkerCacheLookupStart,e.workerCacheLookupStart),n(J.timingDomainLookupStart,e.domainLookupStart),n(J.timingDomainLookupEnd,e.domainLookupEnd),n(J.timingConnectStart,e.connectStart),n(J.timingSecureConnectionStart,e.secureConnectionStart),n(J.timingConnectEnd,e.connectEnd),n(J.timingRequestStart,e.requestStart),n(J.timingResponseStart,e.responseStart),n(J.timingFinalResponseHeadersStart,e.finalResponseHeadersStart),n(J.timingResponseEnd,e.responseEnd),t},Oc=e=>{let t={};if(!Number.isFinite(e.startTime)||e.startTime<0)return t;let n=(e,n)=>Ec(t,e,n);return n(J.timingUnloadEventStart,e.unloadEventStart),n(J.timingUnloadEventEnd,e.unloadEventEnd),n(J.timingDomContentLoadedEventStart,e.domContentLoadedEventStart),n(J.timingDomContentLoadedEventEnd,e.domContentLoadedEventEnd),n(J.timingLoadEventStart,e.loadEventStart),n(J.timingLoadEventEnd,e.loadEventEnd),n(J.timingActivationStart,e.activationStart),t},kc=e=>({matched:e.workerMatchedRouterSource||e.workerMatchedSourceType,final:e.workerFinalRouterSource||e.workerFinalSourceType}),Ac=e=>{var t,n;let r=kc(e);if(!(e.workerStart>0||((t=e.workerRouterEvaluationStart)==null?0:t)>0||((n=e.workerCacheLookupStart)==null?0:n)>0||r.matched||r.final)){if(e.deliveryType===`cache`)return!0;if(!e.deliveryType)return e.transferSize===0&&e.decodedBodySize>0&&e.requestStart>0&&e.responseStart>0?!0:void 0}},jc=e=>e.transferSize===0&&e.encodedBodySize===0&&e.decodedBodySize===0&&e.requestStart===0&&e.responseStart===0&&!e.nextHopProtocol,Mc=(...e)=>e.every((t,n)=>n===0||e[n-1]<=t),Nc=(e,t,n,r,i)=>{Mc(n,r,i)&&(e[`resource.${t}.start`]=r-n,e[`resource.${t}.duration`]=i-r)},Pc=e=>{let t={},n=[e.startTime,e.fetchStart,e.domainLookupStart,e.domainLookupEnd,e.connectStart,e.connectEnd,e.requestStart,e.responseStart,e.responseEnd];return!n.every(Number.isFinite)||!Mc(...n)?t:(Nc(t,`first_byte`,e.startTime,e.requestStart,e.responseStart),Nc(t,`download`,e.startTime,e.responseStart,e.responseEnd),e.workerStart>0&&e.workerStart<e.fetchStart&&Nc(t,`worker`,e.startTime,e.workerStart,e.fetchStart),e.fetchStart<e.domainLookupEnd&&Nc(t,`dns`,e.startTime,e.domainLookupStart,e.domainLookupEnd),e.fetchStart<e.connectEnd&&(Nc(t,`connect`,e.startTime,e.connectStart,e.connectEnd),e.connectStart<=e.secureConnectionStart&&e.secureConnectionStart<=e.connectEnd&&Nc(t,`ssl`,e.startTime,e.secureConnectionStart,e.connectEnd)),e.redirectEnd>e.startTime&&Mc(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart)&&Nc(t,`redirect`,e.startTime,e.redirectStart,e.redirectEnd),t)},Fc=[[`startTime`,J.resourceTimingStartTime],[`redirectStart`,J.resourceTimingRedirectStart],[`redirectEnd`,J.resourceTimingRedirectEnd],[`fetchStart`,J.resourceTimingFetchStart],[`workerStart`,J.resourceTimingWorkerStart],[`workerRouterEvaluationStart`,J.resourceTimingWorkerRouterEvaluationStart],[`workerCacheLookupStart`,J.resourceTimingWorkerCacheLookupStart],[`domainLookupStart`,J.resourceTimingDomainLookupStart],[`domainLookupEnd`,J.resourceTimingDomainLookupEnd],[`connectStart`,J.resourceTimingConnectStart],[`secureConnectionStart`,J.resourceTimingSecureConnectionStart],[`connectEnd`,J.resourceTimingConnectEnd],[`requestStart`,J.resourceTimingRequestStart],[`responseStart`,J.resourceTimingResponseStart],[`finalResponseHeadersStart`,J.resourceTimingFinalResponseHeadersStart],[`responseEnd`,J.resourceTimingResponseEnd]],Ic=e=>{let t={};for(let[n,r]of Fc){let i=e[n];(typeof i==`number`&&Number.isFinite(i)||typeof i==`string`&&i!==``)&&(t[r]=i)}let n=kc(e);return n.matched&&(t[J.resourceTimingWorkerMatchedRouterSource]=n.matched),n.final&&(t[J.resourceTimingWorkerFinalRouterSource]=n.final),t},Lc=e=>e.duration===0&&e.responseEnd>e.startTime?e.responseEnd-e.startTime:e.duration,Rc=e=>{let t=jc(e),n=e.deliveryType===``?`other`:e.deliveryType;return K(K(K(K(K(K(K({[J.cacheHit]:Ac(e)},e.nextHopProtocol?{[J.nextHopProtocol]:e.nextHopProtocol}:{}),Pc(e)),Ic(e)),Dc(e)),n?{"resource.delivery_type":n}:{}),e.renderBlockingStatus?{"resource.render_blocking_status":e.renderBlockingStatus}:{}),t?{}:{"resource.size":e.decodedBodySize,"resource.encoded_body_size":e.encodedBodySize,"resource.decoded_body_size":e.decodedBodySize,"resource.transfer_size":e.transferSize})},zc=new WeakMap,Bc=(e=!0)=>{let t,n=!1,r=()=>{};return{name:`resource`,drain:()=>r(),flush:()=>r(),init(i){var a,o,s,c,l,u,d;if(typeof PerformanceObserver>`u`||!((a=PerformanceObserver.supportedEntryTypes)!=null&&a.includes(`resource`)))return;let f=(o=i.getRuntimeAttributes)==null?i:o,p=(s=zc.get(f))==null?new WeakSet:s;zc.set(f,p);let m=new WeakSet,h=i.collectionStart,g=(c=(l=h==null?void 0:h.allowInitialResourceHistory)==null?h==null?void 0:h.isInitialDocument:l)==null?!0:c,_=g?0:(u=h==null?void 0:h.relativeStartedAt)==null?performance.now():u,v=typeof((d=i.config.tracking)==null?void 0:d.request)==`object`?i.config.tracking.request:void 0,y=t=>{var r,a,o,s,c;if(n||!t.name||Uo(i.config,t.name))return;let l=t.initiatorType===`fetch`||t.initiatorType===`xmlhttprequest`;if(l){var u;if(ic(t),!g||!h||t.startTime>=h.relativeStartedAt||((u=i.config.tracking)==null?void 0:u.request)===!1||qo(i.config,t.name)||v!=null&&v.beforeSend)return}if(!Number.isFinite(t.startTime)||t.startTime<_||p.has(t)||!Number.isFinite(t.duration)||t.duration<0)return;let d=(r=i.getRuntimeContextAtRelativeTime)==null?void 0:r.call(i,t.startTime);if((a=i.isSessionTransitionPending)!=null&&a.call(i)){m.has(t)||(m.add(t),i.afterSessionTransition(()=>{m.delete(t),b(t)},!0));return}let f=i.getRuntimeContextAtRelativeTime||(o=i.getViewHistory)==null?void 0:o.call(i),y=f==null?void 0:f.slice().reverse().find(({view:e})=>e.relativeStartedAt!==void 0&&e.relativeStartedAt<=t.startTime&&(e.relativeEndedAt===void 0||t.startTime<e.relativeEndedAt));if(i.getRuntimeContextAtRelativeTime?!d:f&&!y)return;p.add(t);let x=i.config.hooks.redactUrl(t.name),S=Lc(t),C=(s=d==null?void 0:d.time)==null?y?y.view.startedAt+(t.startTime-y.view.relativeStartedAt):performance.timeOrigin+t.startTime:s,w=(c=d==null?void 0:d.attributes)==null?y==null?void 0:y.runtimeAttributes:c,T=C+S;if(e||l){let e=K(K(K({},i.config.hooks.getPageAttributes()),ts({initiatorType:t.initiatorType||`other`,outcome:typeof t.responseStatus==`number`?{statusCode:t.responseStatus,type:`response`}:void 0,url:x})),{},{"url.full":x,"url.template":i.config.hooks.getRequestUrlTemplate(x)},Rc(t));i.startSpan(Q({attributes:e,spanType:X.resource}),e,K({kind:Pe.CLIENT,rumSpanType:X.resource,startTime:C},w?{contextTime:C,contextAttributes:w}:{})).end(T)}i.notifyActivity({endTime:T,startTime:C,type:`resource`,url:t.name})},b=e=>{try{y(e)}catch(e){}};r=()=>{var e,r;if(!n)for(let n of(e=t==null||(r=t.takeRecords)==null?void 0:r.call(t))==null?[]:e)b(n)};try{t=new PerformanceObserver(e=>{for(let t of e.getEntries())b(t)}),t.observe({type:`resource`,buffered:!0})}catch(e){t=void 0}},shutdown(){n||(r(),n=!0,t==null||t.disconnect(),t=void 0,r=()=>{})}}},Vc=e=>typeof e.config.tracking.request==`object`?e.config.tracking.request:void 0,Hc=e=>{var t;let n=(t=Vc(e))==null?void 0:t.allowedTracingUrls;return Array.isArray(n)?n.length>0:n!==void 0},Uc=e=>typeof e==`object`&&e&&`name`in e&&typeof e.name==`string`?e.name:``,Wc=(e,t)=>Uc(e==null?void 0:e.reason)===`TimeoutError`||Uc(t)===`TimeoutError`?{error:t,type:`timeout`}:e!=null&&e.aborted||Uc(t)===`AbortError`?{type:`abort`}:{error:t,type:`network_error`},Gc=(e,t)=>e===`abort`?{type:`abort`}:e===`timeout`?{type:`timeout`}:e===`error`||t.status===0?{type:`network_error`}:{statusCode:t.status,type:`response`},Kc=e=>e.type===`network_error`||e.type===`timeout`||e.type===`response`&&typeof e.statusCode==`number`&&e.statusCode>=400,qc=e=>typeof e==`string`||e instanceof URL?Lo(String(e)):Lo(e.url),Jc=(e,t)=>{var n;return((n=t==null?void 0:t.method)==null?typeof Request<`u`&&e instanceof Request?e.method:`GET`:n).toUpperCase()},Yc=(e,t)=>typeof Request<`u`&&e instanceof Request?e:t==null?{}:t,Xc=(e,t)=>(t==null?void 0:t.signal)===void 0?typeof Request<`u`&&e instanceof Request?e.signal:void 0:t.signal,Zc=()=>typeof performance<`u`?performance.now():Date.now(),Qc=(e,t,n=Zc())=>e.startedAt+Math.max(0,(t?t.startTime+Lc(t):n)-e.relativeStartedAt),$c=(e,t)=>{e&&Vs(e);try{t()}catch(e){}try{e==null||e.end()}catch(e){}},el=(e,t)=>{var n;let r=typeof Request<`u`&&e instanceof Request?e.headers:void 0;return new Headers((n=t==null?void 0:t.headers)==null?r:n)},tl=(e,t,n)=>n.traceparent?(t.set(oc,n.traceparent),K(K({},e),{},{headers:t})):e,nl=e=>t=>e==null?void 0:e[t.toLowerCase()],rl=(e,t)=>{var n;if(!((n=e.isSessionTransitionPending)!=null&&n.call(e)&&!Cc(t)))return Tc(t)},il=(e,t)=>Uo(e.config,t)||Go(e.config.view.excludedActivityUrls,t),al=(e,t)=>{if(il(e,t))return()=>{};let n=q(`request`);try{e.notifyActivity({id:n,time:Date.now(),type:`request_start`,url:t})}catch(e){}let r=!1;return()=>{if(!r){r=!0;try{e.notifyActivity({id:n,time:Date.now(),type:`request_end`})}catch(e){}}}},ol=(e,t)=>{var n;return typeof PerformanceObserver>`u`||!((n=PerformanceObserver.supportedEntryTypes)!=null&&n.includes(`resource`))?{sent(){},cancel(){},complete(e,t=!1){e()}}:ac(e,performance.now(),t)},sl=(e,t,n,r)=>{var i,a;let o=(i=n.startedAt)==null?Date.now():i,s=K(K(K({},e.config.hooks.getPageAttributes()),ts({initiatorType:t===`xhr`?`xmlhttprequest`:t,method:n.method,url:(a=n.url)==null?``:a})),n.url?{"url.full":e.config.hooks.redactUrl(n.url),"url.template":e.config.hooks.getRequestUrlTemplate(n.url)}:{});return n.ownedAttributeKeys=Object.keys(s),e.startSpan(Q({attributes:s,spanType:X.resource}),s,K({kind:Pe.CLIENT,rumSpanType:X.resource,startTime:o},r?{links:r.links}:{}))},cl=(e,t,n,r,i,a={},o={})=>{var s;let c=a.url,l=c?e.config.hooks.redactUrl(c):void 0,u=a.method,d=K(K(K(K(K({},e.config.hooks.getPageAttributes()),ts({initiatorType:n===`xhr`?`xmlhttprequest`:n,method:u,outcome:i,url:l==null?``:l})),l?{"url.full":l}:{}),c?{"url.template":e.config.hooks.getRequestUrlTemplate(c)}:{}),o),f=new Set([...(s=a.ownedAttributeKeys)==null?[]:s,...Object.keys(d)]),p={attributes:d,resource:{method:u,outcome:i,transport:n,url:l},type:`resource`},m=!0;try{var h,g;m=(h=Vc(e))==null||(g=h.beforeSend)==null?void 0:g.call(h,p,r)}catch(t){var _;e.config.debug&&((_=globalThis.console)==null||_.warn(`[bk-ot] request.beforeSend failed:`,t))}let v=e.applyRedact(p.attributes);if(t.setAttributes(v),Bs(t,v,f),t.updateName(Q({attributes:v,spanType:X.resource})),m===!1){Vs(t);return}Kc(i)&&t.setStatus({code:Fe.ERROR})},ll=e=>{let t=[],n=new Set;return{name:`request`,enabled:e!==!1,init(e){if(!(typeof window>`u`)){if(typeof window.fetch==`function`){let r=window.fetch,i=function(){var t=G(function*(t,i){let a=``,o={},s,c=()=>{},l={},u=i,d;try{if(a=qc(t),e.isSampled()&&!qo(e.config,a)){o={method:Jc(t,i),startedAt:Date.now(),relativeStartedAt:Zc(),url:a};let n=Yo(e.config,a)?el(t,i):void 0,r=n?rl(e,e=>{var t;return(t=n.get(e))==null?void 0:t}):void 0;s=sl(e,`fetch`,o,r),c=al(e,a),l=Yc(t,i),d=Xc(t,i),u=n&&r?tl(i,n,r):i}}catch(e){return $c(s,c),r.call(this,t,i)}if(!s)return r.call(this,t,i);let f=!1,p,m,h=Zc(),g=()=>{},_=(t,r=Zc())=>{if(!f){f=!0,n.delete(v),g();try{let n=t?Rc(t):{"resource.timing.incomplete":!0};p&&m?cl(e,s,`fetch`,p,m,o,n):s.setAttributes(e.applyRedact(n))}catch(e){Vs(s)}finally{c(),s.end(Qc(o,t,r))}}},v=()=>{h=Zc(),y.cancel(),_()},y=ol(a,`fetch`);n.add(v);try{let e;try{e=r.call(this,t,u)}finally{y.sent()}let n=yield e;if(f)return n;m=K(K({},n.status>0?{statusCode:n.status}:{}),{},{type:`response`}),p={request:l,response:n,type:`fetch`},h=Zc(),y.complete(e=>_(e,h),!0);let i=()=>{f||(h=Zc(),m=Wc(d,d==null?void 0:d.reason),y.cancel())};return!f&&d&&(d.addEventListener(`abort`,i,{once:!0}),g=()=>d==null?void 0:d.removeEventListener(`abort`,i),d.aborted&&i()),n}catch(e){throw f||(m=Wc(d,e),p={error:e,request:l,type:`fetch`},m.type!==`abort`&&e instanceof Error&&s.recordException(e),h=Zc(),y.complete(e=>_(e,h))),e}});return function(e,n){return t.apply(this,arguments)}}();window.fetch=i,t.push(()=>{window.fetch===i&&(window.fetch=r)})}if(typeof XMLHttpRequest<`u`){let r=new WeakMap,i=new WeakMap,a=new WeakMap,o=XMLHttpRequest.prototype.open,s=XMLHttpRequest.prototype.send,c=XMLHttpRequest.prototype.abort,l=function(e,t,n=!0,s,c){try{var l;(l=i.get(this))==null||l(),r.set(this,{method:e.toUpperCase(),url:Lo(String(t))})}catch(e){r.delete(this)}return a.delete(this),o.call(this,e,t,n,s,c)},u=function(){try{var e;(e=i.get(this))==null||e()}catch(e){}return c.call(this)},d=function(t){let o=K({},r.get(this)),c,l=()=>{};try{if(e.isSampled()&&o.url&&!qo(e.config,o.url)){o.startedAt=Date.now(),o.relativeStartedAt=Zc();let t=Yo(e.config,o.url)?rl(e,nl(a.get(this))):void 0;c=sl(e,`xhr`,o,t),l=al(e,o.url),t!=null&&t.traceparent&&this.setRequestHeader(oc,t.traceparent)}}catch(e){return $c(c,l),s.call(this,t)}if(!c||!o.url)return s.call(this,t);let u=!1,d=!1,f=()=>{},p,m,h=()=>{p||(m=Zc(),p={status:this.status,statusText:this.statusText,responseURL:this.responseURL,responseType:this.responseType})},g=()=>{f(),w.cancel(),!d&&(d=!0,n.delete(g),l(),c.setAttribute(`resource.timing.incomplete`,!0),c.end(Qc(o)))},_=t=>{if(u||d)return;u=!0,f(),h();let r=Gc(t,p);w.complete(t=>{if(!d){d=!0,n.delete(g);try{cl(e,c,`xhr`,{type:`xhr`,xhr:this,responseSnapshot:p},r,o,t?Rc(t):{"resource.timing.incomplete":!0})}catch(e){Vs(c)}finally{l(),c.end(Qc(o,t,m))}}})},v=()=>_(this.readyState===4?`load`:`abort`),y=()=>{this.readyState===4&&(h(),p.status>0&&_(`load`))},b=()=>_(`abort`),x=()=>_(`error`),S=()=>_(`load`),C=()=>_(`timeout`);f=()=>{i.get(this)===v&&i.delete(this),this.removeEventListener(`readystatechange`,y,!0),this.removeEventListener(`abort`,b,!0),this.removeEventListener(`error`,x,!0),this.removeEventListener(`load`,S,!0),this.removeEventListener(`timeout`,C,!0)},i.set(this,v),this.addEventListener(`readystatechange`,y,!0),this.addEventListener(`abort`,b,{capture:!0,once:!0}),this.addEventListener(`error`,x,{capture:!0,once:!0}),this.addEventListener(`load`,S,{capture:!0,once:!0}),this.addEventListener(`timeout`,C,{capture:!0,once:!0});let w=ol(o.url,`xmlhttprequest`);n.add(g);try{return s.call(this,t)}catch(e){throw e instanceof Error&&c.recordException(e),_(`error`),e}finally{w.sent()}};if(XMLHttpRequest.prototype.open=l,XMLHttpRequest.prototype.send=d,typeof c==`function`&&(XMLHttpRequest.prototype.abort=u),t.push(()=>{XMLHttpRequest.prototype.open===l&&(XMLHttpRequest.prototype.open=o),XMLHttpRequest.prototype.send===d&&(XMLHttpRequest.prototype.send=s),XMLHttpRequest.prototype.abort===u&&(XMLHttpRequest.prototype.abort=c)}),Hc(e)&&typeof XMLHttpRequest.prototype.setRequestHeader==`function`){let e=XMLHttpRequest.prototype.setRequestHeader,n=function(t,n){var r;let i=t.toLowerCase(),o=(r=a.get(this))==null?{}:r;return o[i]=i in o?`${o[i]}, ${n}`:n,a.set(this,o),e.call(this,t,n)};XMLHttpRequest.prototype.setRequestHeader=n,t.push(()=>{XMLHttpRequest.prototype.setRequestHeader===n&&(XMLHttpRequest.prototype.setRequestHeader=e)})}}}},shutdown(){var e;for(let e of[...n])e();for(;t.length;)(e=t.pop())==null||e()}}},ul=/^https?:|^\/\//i,dl=(e,t)=>{if(t)return ul.test(t)?e(t):t},fl=()=>{let e;return{name:`csp-violation`,init(t){if(typeof window>`u`||typeof document>`u`)return;let n=e=>{if(!t.isSampled())return;let n=Date.now(),r=dl(t.config.hooks.redactUrl,e.blockedURI),i=e.sourceFile?t.config.hooks.redactUrl(e.sourceFile):void 0,a=K(K(K({},t.config.hooks.getPageAttributes()),es({outcome:Y.error,spanType:X.error})),{},{"csp.blocked_uri":r,"csp.violated_directive":e.violatedDirective,"csp.effective_directive":e.effectiveDirective,"csp.disposition":e.disposition,"csp.source_file":i,"csp.line_number":e.lineNumber,"csp.column_number":e.columnNumber,"csp.status_code":e.statusCode,"csp.original_policy":e.originalPolicy,"error.source":`csp`});t.startSpan(Q({attributes:a,spanType:X.error}),a,{startTime:n}).end(n)};document.addEventListener(`securitypolicyviolation`,n),e=()=>document.removeEventListener(`securitypolicyviolation`,n)},shutdown(){e==null||e(),e=void 0}}},pl=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)},ml=`BK_RUM_DEVICE_ID`,hl=250,gl=()=>navigator.connection,_l=()=>navigator.userAgentData,vl=e=>{for(let[t,n]of[[`Edge`,/Edg\/([\d.]+)/],[`Chrome`,/Chrome\/([\d.]+)/],[`Firefox`,/Firefox\/([\d.]+)/],[`Safari`,/Version\/([\d.]+).*Safari/]]){let r=e.match(n);if(r!=null&&r[1])return{name:t,version:r[1].split(`.`)[0]}}return{name:`Other`,version:void 0}},yl=(e,t)=>{let n=`${t==null?``:t} ${e}`;return/iphone|ipad|ipod/i.test(n)?`iOS`:/android/i.test(n)?`Android`:/mac/i.test(n)?`macOS`:/win/i.test(n)?`Windows`:/linux/i.test(n)?`Linux`:`Other`},bl=e=>{let t=null;try{t=window.localStorage.getItem(e)}catch(e){}if(t)return t;let n=q(`device`);try{window.localStorage.setItem(e,n)}catch(e){}return n},xl=()=>{var e,t;return typeof window>`u`?{}:{"browser.viewport.width":window.innerWidth,"browser.viewport.height":window.innerHeight,"browser.screen.width":(e=window.screen)==null?void 0:e.width,"browser.screen.height":(t=window.screen)==null?void 0:t.height}},Sl=()=>{if(typeof navigator>`u`)return{};let e=gl();return{[J.networkStatus]:navigator.onLine?`connected`:`not_connected`,"network.effective_type":e==null?void 0:e.effectiveType,"network.connection.type":e==null?void 0:e.type}},Cl=()=>{if(typeof navigator>`u`)return{};let e=_l(),t=navigator.userAgent,n=vl(t),r=yl(t,e==null?void 0:e.platform),i=e!=null&&e.mobile||/mobi|android|iphone|ipad|ipod/i.test(t)?`mobile`:`desktop`;return{[J.deviceType]:i,[J.userAgentName]:n.name,[J.userAgentVersion]:n.version,[J.userAgentOsName]:r}},wl=(e,t)=>{let n;return()=>{n!==void 0&&window.clearTimeout(n),n=window.setTimeout(()=>{n=void 0,e()},t)}},Tl=(e={})=>{let t=[];return{name:`device`,init(n){var r;let i=(r=e.storageKey)==null?`${ml}_${pl(n.config.application.name)}`:r,a=typeof window>`u`||e.persistentId!==!0?q(`device`):bl(i);if(n.setRuntimeAttributes(K(K(K({"device.id":a},n.config.tracking.device===!1?Cl():{}),xl()),Sl())),typeof window>`u`)return;let o=wl(()=>{n.setRuntimeAttributes(xl())},hl);window.addEventListener(`resize`,o),window.addEventListener(`orientationchange`,o),t.push(()=>window.removeEventListener(`resize`,o),()=>window.removeEventListener(`orientationchange`,o));let s=()=>{n.setRuntimeAttributes(Sl())};window.addEventListener(`online`,s),window.addEventListener(`offline`,s),t.push(()=>window.removeEventListener(`online`,s),()=>window.removeEventListener(`offline`,s));let c=gl();c&&typeof c.addEventListener==`function`&&(c.addEventListener(`change`,s),t.push(()=>{var e;(e=c.removeEventListener)==null||e.call(c,`change`,s)}))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}},El=e=>{if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch(t){return String(e)}},Dl=({context:e,error:t,exceptionType:n,extra:r={},source:i})=>{if(!e.isSampled())return;let a=Date.now(),o=El(t),s=n==null?t instanceof Error?t.name||`Error`:i:n,c=t instanceof Error?t:{message:o,name:s},l=K(K(K(K({},e.config.hooks.getPageAttributes()),e.config.hooks.getErrorAttributes()),es({outcome:Y.error,spanType:X.error})),{},{"error.message":o,"error.handled":!1,"error.source":i},r),u=e.startSpan(Q({attributes:l,nameHint:s,spanType:X.error}),l,{startTime:a});u.recordException(c),u.setStatus({code:Fe.ERROR,message:o}),u.end()},Ol=()=>{let e=[];return{name:`error`,init(t){if(typeof window>`u`)return;let n=e=>{var n;Dl({context:t,source:`window.error`,error:(n=e.error)==null?e.message:n,extra:{"code.filepath":e.filename,"code.lineno":e.lineno,"code.column":e.colno}})},r=e=>{Dl({context:t,source:`unhandledrejection`,error:e.reason,exceptionType:e.reason instanceof Error?e.reason.name:`UnhandledRejection`})},i=e=>{if(e instanceof ErrorEvent)return;let n=e.target;if(!(n instanceof Element))return;let r=n,i=r.src||r.href||n.currentSrc||``;Dl({context:t,source:`resource`,error:Error(`Resource load failed: ${n.tagName.toLowerCase()} ${i}`),exceptionType:`ResourceError`,extra:{"url.full":t.config.hooks.redactUrl(i)}})};window.addEventListener(`error`,n),window.addEventListener(`unhandledrejection`,r),window.addEventListener(`error`,i,!0),e.push(()=>window.removeEventListener(`error`,n),()=>window.removeEventListener(`unhandledrejection`,r),()=>window.removeEventListener(`error`,i,!0))},shutdown(){for(;e.length;){var t;(t=e.pop())==null||t()}}}},kl=50,Al=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,jl=e=>Number.isFinite(e)?e:void 0,Ml=(e,t)=>K(K(K(K(K({},e.containerId?{"long_task.attribution.container_id":e.containerId}:{}),e.containerName?{"long_task.attribution.container_name":e.containerName}:{}),e.containerSrc?{"long_task.attribution.container_src":t(e.containerSrc)}:{}),e.containerType?{"long_task.attribution.container_type":e.containerType}:{}),e.name?{"long_task.attribution.name":e.name}:{}),Nl=(e,t)=>({"long_task.script.duration":e.duration,"long_task.script.execution_start":e.executionStart,"long_task.script.forced_style_and_layout_duration":e.forcedStyleAndLayoutDuration,"long_task.script.invoker":e.invoker,"long_task.script.invoker_type":e.invokerType,"long_task.script.pause_duration":e.pauseDuration,"long_task.script.source_char_position":e.sourceCharPosition,"long_task.script.source_function_name":e.sourceFunctionName,"long_task.script.source_url":e.sourceURL?t(e.sourceURL):``,"long_task.script.start_time":e.startTime,"long_task.script.window_attribution":e.windowAttribution}),Pl=(e={})=>{let t=Al(e.threshold,kl),n,r,i=[],a=!1;return{name:`long-task`,init(e){var o;if(typeof PerformanceObserver>`u`||typeof performance>`u`)return;let s=(o=PerformanceObserver.supportedEntryTypes)==null?[]:o,c=s.includes(`long-animation-frame`)?`long-animation-frame`:s.includes(`longtask`)?`longtask`:void 0;if(!c)return;let l=n=>{var r,i;if(a||!Number.isFinite(n.duration)||n.duration<t)return;let o=n.entryType===`long-animation-frame`,s=o?n:void 0,c=(r=s==null?void 0:s.scripts)==null?[]:r,l=q(`long-task`),u=performance.timeOrigin+n.startTime,d=u+n.duration,f=o?`long-animation-frame`:`long-task`,p=o||(i=n.attribution)==null?[]:i,m=K(K(K(K(K(K({},e.config.hooks.getPageAttributes()),es({spanType:X.longTask})),jl(s==null?void 0:s.blockingDuration)===void 0?{}:{[J.longTaskBlockingDuration]:s.blockingDuration}),{},{[J.longTaskEntryType]:f,[J.longTaskId]:l,"long_task.name":n.name},jl(s==null?void 0:s.firstUIEventTimestamp)===void 0?{}:{"long_task.first_ui_event_timestamp":s.firstUIEventTimestamp}),jl(s==null?void 0:s.renderStart)===void 0?{}:{"long_task.render_start":s.renderStart}),jl(s==null?void 0:s.styleAndLayoutStart)===void 0?{}:{"long_task.style_and_layout_start":s.styleAndLayoutStart}),h=e.startSpan(Q({attributes:m,spanType:X.longTask}),m,{startTime:u});c.forEach(t=>{h.addEvent(`long_task.script`,e.applyRedact(Nl(t,e.config.hooks.redactUrl)),performance.timeOrigin+t.startTime)}),p.forEach((t,n)=>{h.addEvent(`long_task.attribution`,e.applyRedact(K({"long_task.attribution.index":n},Ml(t,e.config.hooks.redactUrl))),u)}),h.end(d),e.notifyActivity({endTime:d,startTime:u,type:`long_task`})},u=e=>e.forEach(e=>l(e));try{let e=!0;n=new PerformanceObserver(t=>{if(a)return;let n=t.getEntries();e?(i.push(...n),r||(r=setTimeout(()=>{let e=i;i=[],r=void 0,u(e)}))):u(n)}),n.observe({type:c,buffered:!0}),e=!1}catch(e){n=void 0}},shutdown(){a=!0,n==null||n.disconnect(),n=void 0,clearTimeout(r),r=void 0,i=[]}}},Fl=(e,t)=>!!(t&&Go(e.config.view.excludedActivityUrls,t)),Il=(e,t,n)=>{let r=new Set,i=!1,a=!1,o=t,s,c=e=>{i||(i=!0,clearTimeout(f),clearTimeout(s),d(),n(e))},l=()=>{clearTimeout(s),!(!a||r.size)&&(s=setTimeout(()=>c({endTime:o,hadActivity:!0}),Math.max(0,o+100-Date.now())))},u=e=>{a=!0,o=Math.max(o,e),l()},d=e.onActivity(n=>{if(!(n.type===`error`||n.type===`long_task`)){if(n.type===`request_start`){if(n.time<t||Fl(e,n.url))return;r.add(n.id),u(n.time);return}if(n.type===`request_end`){if(!r.delete(n.id))return;u(n.time);return}if(n.type===`resource`){if(n.endTime<t||Fl(e,n.url))return;u(n.endTime);return}n.time>=t&&u(n.time)}}),f=setTimeout(()=>{a||c({hadActivity:!1})},100);return()=>{i||(i=!0,clearTimeout(f),clearTimeout(s),d())}},Ll=new Set,Rl=``,zl,Bl=()=>typeof location>`u`?``:location.href,Vl=(e,t)=>{let n=Bl();if(Rl=n,t===n)return;let r={fromUrl:t,source:e,toUrl:n};for(let e of Array.from(Ll))try{e(r)}catch(e){}},Hl=()=>{if(zl||typeof window>`u`||typeof history>`u`)return;let e=history,t=window,n=e.pushState,r=e.replaceState,i=!0;Rl=Bl();let a=e.pushState=function(e,t,r){let a=Rl||Bl(),o=n.apply(this,[e,t,r]);return i&&Vl(`pushState`,a),o},o=e.replaceState=function(e,t,n){let a=Rl||Bl(),o=r.apply(this,[e,t,n]);return i&&Vl(`replaceState`,a),o},s=()=>{i&&Vl(`popstate`,Rl||Bl())},c=()=>{i&&Vl(`hashchange`,Rl||Bl())};t.addEventListener(`popstate`,s),t.addEventListener(`hashchange`,c),zl=()=>{i=!1,e.pushState===a&&(e.pushState=n),e.replaceState===o&&(e.replaceState=r),t.removeEventListener(`popstate`,s),t.removeEventListener(`hashchange`,c),zl=void 0,Rl=``}},Ul=e=>typeof window>`u`||typeof history>`u`?()=>{}:(Hl(),Ll.add(e),()=>{Ll.delete(e),Ll.size===0&&(zl==null||zl())}),Wl=e=>{try{return new URL(e,typeof location>`u`?`http://localhost`:location.href)}catch(e){return}},Gl=e=>/^#!?\//.test(e),Kl=e=>{let t=e.replace(/^#!/,``).replace(/^#/,``).split(/[?#]/,1)[0];return t.startsWith(`/`)?t:`/${t}`},ql=(e,t=`auto`)=>{var n;let r=Wl(e),i=(r==null?void 0:r.pathname)||`/`,a=(n=r==null?void 0:r.hash)==null?``:n,o=t===`hash`||t===`auto`&&Gl(a)?`hash`:`history`;return{hash:a,kind:o,pathname:i,routePath:o===`hash`?Kl(a):i}},Jl=e=>{if(!e||typeof document>`u`||typeof document.getElementById!=`function`)return!1;try{return!!document.getElementById(decodeURIComponent(e.slice(1)))}catch(t){return!!document.getElementById(e.slice(1))}},Yl=(e,t,n=`auto`)=>{if(n===`document`)return!1;let r=ql(e,n),i=ql(t,n);return r.pathname===i.pathname?n===`history`?!1:n===`hash`||r.kind===`hash`||i.kind===`hash`?r.kind!==i.kind||r.routePath!==i.routePath:r.hash===i.hash||Jl(i.hash)||!i.hash&&Jl(r.hash)?!1:Kl(r.hash)!==Kl(i.hash):!0};function Xl(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 Zl(e,t){if(e==null)return{};var n,r,i=Xl(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}var Ql=[`stopLoadingTime`],$l=new Set(Object.values(J)),eu=()=>{let e=typeof performance>`u`?void 0:performance.interactionCount;return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0},tu=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():0,nu=()=>typeof location>`u`?``:location.href,ru=()=>{if(typeof performance>`u`)return{};let e=performance.getEntriesByType(`navigation`)[0];if(!e)return{};let t={},n=(e,n)=>{Number.isFinite(n)&&n>0&&(t[e]=n)};return n(J.viewFirstByte,e.responseStart),n(J.viewDomInteractive,e.domInteractive),n(J.viewDomContentLoaded,e.domContentLoadedEventEnd),n(J.viewDomComplete,e.domComplete),n(J.viewLoadEvent,e.loadEventEnd),K(K(K({},t),Dc(e)),Oc(e))},iu=()=>{var e,t;return document.visibilityState===`hidden`?`hidden`:((e=(t=document).hasFocus)==null?void 0:e.call(t))===!1?`passive`:`active`},au=e=>e===`active`||e===`passive`,ou=()=>{let e=[],t;return{name:`page-view`,flush(){t==null||t()},init(n){var r,i,a,o,s,c;if(typeof window>`u`)return;let l,u,d,f,p,m=new Set,h,g,_,v,y,b=!1,x=(e=Date.now(),t=tu(),r=eu())=>n.setView({endedAt:e,relativeEndedAt:t,interactionCountAtEnd:r},e),S=e=>{var t;let n=tu(),r=Date.now(),i=l?r-l.startedAt-(n-l.relativeStartedAt):0;return Math.max((t=l==null?void 0:l.relativeStartedAt)==null?0:t,Math.min(n,Math.abs(i)>2?n:n-(r-e)))},C=(e,t=Date.now())=>n.setView({attributes:e.attributes,id:e.id,interactionCountAtStart:e.interactionCountAtStart,loadingType:e.loadingType,name:e.name,startedAt:e.startedAt,relativeStartedAt:e.relativeStartedAt,url:e.url,urlTemplate:e.urlTemplate},t),w=e=>{var t;if(!l)return;let n=l.pageStates;if(((t=n.at(-1))==null?void 0:t.state)!==e&&(n.push({state:e,start:Math.max(0,Date.now()-l.startedAt)}),n.length>100)){let e=n.shift();au(e.state)&&(l.foregroundBase+=n[0].start-e.start)}},T=(e,t,r=Date.now(),i)=>{var a,o;e.loadingType===`initial_load`&&Object.assign(e.snapshotAttributes,ru()),e.version+=1;let s=Math.max(0,r-e.startedAt),c=e.pageStates.filter(e=>e.start<=s),l=e.foregroundBase+c.reduce((e,t,n)=>{var r,i;return e+(au(t.state)?Math.max(0,((r=(i=c[n+1])==null?void 0:i.start)==null?s:r)-t.start):0)},0),u=K(K(K(K(K(K({},n.config.hooks.getPageAttributes()),e.attributes),e.snapshotAttributes),{},{[J.viewPhase]:t,[J.viewStartedAt]:e.startedAt,[J.viewVersion]:e.version,[J.viewTimeSpent]:s,[J.viewForegroundTime]:Math.min(s,l),[J.viewIsActive]:t!==`end`,[J.viewPageStates]:JSON.stringify(c)},e.customTimings),i?{[J.viewEndReason]:i}:{}),e.loadingTime===void 0?{}:{[J.viewLoadingTime]:e.loadingTime,[J.viewLoadingTimeSource]:e.loadingTimeSource}),d=u[J.sessionId],f=t===`end`?Math.max(e.startedAt,r-.001):r;(a=n.getRuntimeAttributesAt)==null||a.call(n,f);let p=()=>{var e;let i=(e=n.getRuntimeAttributesAt)==null?void 0:e.call(n,f);if(!(t!==`end`&&i&&(!d||i[J.sessionId]!==d))){if(i&&i[J.sessionId]===d)for(let e of[J.sessionStartTime,J.sessionLastActivityTime])i[e]===void 0?delete u[e]:u[e]=i[e];n.startSpan(Q({attributes:u,spanType:X.view}),u,{contextTime:r,rumSpanType:X.view,startTime:r}).end(r)}};t!==`end`&&(o=n.isSessionTransitionPending)!=null&&o.call(n)?n.afterSessionTransition(p):p()},E=(e,t=!0,n=Date.now(),r=!0,i=S(n),a=eu())=>{var o;if(!l){t&&x(n,i,a);return}let s=K({},l);(o=l.stopLoadingTime)==null||o.call(l),r&&T(l,`end`,n,e),l=void 0,t&&x(n,i,a);let{stopLoadingTime:c}=s;return Zl(s,Ql)},D=(e,t,n)=>{if(l!==e||!Number.isFinite(t)||t<0)return;let r={[J.viewLoadingTime]:t,[J.viewLoadingTimeSource]:n};Object.assign(e.snapshotAttributes,r),e.loadingTime=t,e.loadingTimeSource=n,T(e,`update`)},O=e=>{if(!n.config.view.loadingTime||document.visibilityState===`hidden`)return;let t=!1,r,i=e.loadingType!==`initial_load`,a,o,s=!1,c,u=()=>{var n;if(s||!t||!i||!f||l!==e)return;let o=[r,a,p].filter(e=>e!==void 0);o.length&&D(e,Math.max(...o),`auto`),(n=e.stopLoadingTime)==null||n.call(e),e.stopLoadingTime=void 0},d=()=>{var t,n;let r=(t=(n=performance).getEntriesByType)==null?void 0:t.call(n,`navigation`)[0];return r!=null&&r.loadEventEnd?(a=Math.max(0,performance.timeOrigin+r.loadEventEnd-e.startedAt),i=!0,!0):!1},f=e.loadingType!==`bf_cache`,p,m;if(!f)if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>{m=void 0,p=Math.max(0,Date.now()-e.startedAt),f=!0,u()})});m=()=>cancelAnimationFrame(t)}else f=!0;if(!i&&!d()){let t=()=>{setTimeout(()=>{l===e&&(d(),i=!0,u())})};window.addEventListener(`load`,t,{once:!0}),o=()=>window.removeEventListener(`load`,t)}let h=Il(n,e.startedAt,n=>{t=!0,n.hadActivity&&(r=Math.max(0,n.endTime-e.startedAt)),u()}),g=()=>{var t;document.visibilityState===`hidden`&&(s=!0,(t=e.stopLoadingTime)==null||t.call(e),e.stopLoadingTime=void 0)};document.addEventListener(`visibilitychange`,g),c=()=>document.removeEventListener(`visibilitychange`,g),e.stopLoadingTime=()=>{h(),o==null||o(),o=void 0,m==null||m(),m=void 0,c==null||c(),c=void 0},u()},k=e=>{let t=$(n.applyRedact($(e)));return Object.fromEntries(Object.entries(t).filter(([e,t])=>t!==void 0&&!$l.has(e)&&!e.startsWith(`view.custom_timings.`)))},A=(e,t,r,i=(e=>{var t;return(e=(t=f)==null?l==null?void 0:l.rawUrl:t)==null?``:e})(),a,o,s,c)=>{var u,d,p,x,C,w,D,j,M,N,P,F,I;let ee=c==null?eu():c,te=(u=a)==null?Date.now():u,ne=(d=s)==null?a===void 0?tu():S(a):d,re=n.isSessionActive();if((p=n.isSessionTransitionPending)!=null&&p.call(n)&&!o){var ie;let a=K(K({},e),{},{url:(ie=e.url)==null?nu():ie}),o={startedAt:te,relativeStartedAt:ne,interactionCountAtStart:ee};m.add(o),n.afterSessionTransition(()=>{m.delete(o),A(a,t,r,i,te,void 0,ne,ee)});return}if(!re)return;a!==void 0&&h!==void 0&&a<h&&(a=h,s=g);let ae=(x=e.url)==null?nu():x,oe=e.urlTemplate||n.config.hooks.getViewUrlTemplate(ae),se=i?(C=l==null?void 0:l.urlTemplate)==null?n.config.hooks.getViewUrlTemplate(i):C:``,ce=(w=e.name)==null?oe:w,le=k(e.attributes),ue=q(`view`),L=n.config.hooks.redactUrl(ae),de=n.config.hooks.redactUrl(i),fe=typeof performance<`u`?performance.timeOrigin:Date.now(),pe=(D=n.getRuntimeAttributes)==null?void 0:D.call(n)[J.sessionId],me=(j=n.getRuntimeAttributesAt)==null||(j=j.call(n,fe))==null?void 0:j[J.sessionId];r===`initial_load`&&(b||((M=n.collectionStart)==null?void 0:M.isInitialDocument)===!1||me!==pe)&&(r=`route_change`);let he=r===`initial_load`,ge=(N=a)==null?he?fe:te:N,_e=(P=s)==null?he&&a===void 0?0:ne:P,ve=he?0:ee;E(t,!1,ge,!0,_e,ve),b=!0,f=void 0,_=void 0,v=void 0,y=void 0,n.setView({attributes:le,id:ue,interactionCountAtStart:ve,loadingType:r,name:ce,relativeStartedAt:_e,startedAt:ge,url:L,urlTemplate:oe},ge);let ye=K(K(K(K(K(K(K({},Object.fromEntries(Object.entries((F=(I=n.getRuntimeAttributes)==null?void 0:I.call(n))==null?{}:F).filter(([e])=>e.startsWith(`session.`)||e===J.tabId))),o?{[J.sessionId]:o}:{}),le),n.config.hooks.getPageAttributes()),es({spanType:X.view})),{},{[J.viewId]:ue},ce?{[J.viewName]:ce}:{}),{},{[J.viewUrl]:L,[J.viewUrlTemplate]:oe,[J.viewLoadingType]:r,[J.viewPrevious]:de,[J.viewPreviousUrlTemplate]:se},he&&document.referrer?{[J.viewReferrer]:n.config.hooks.redactUrl(document.referrer)}:{});l={attributes:le,customTimings:{},pageStates:[{state:iu(),start:Math.max(0,Date.now()-ge)}],foregroundBase:0,version:0,id:ue,interactionCountAtStart:ve,loadingType:r,name:ce,rawUrl:ae,snapshotAttributes:ye,relativeStartedAt:_e,startedAt:ge,url:L,urlTemplate:oe},T(l,`start`,ge),O(l)},j=n.onViewCommand(e=>{if(e.type===`start`){var t;p=K(K({},e.options),{},{url:(t=e.options.url)==null?nu():t});let n=_,r=v,i=y;_=void 0,v=void 0,y=void 0,n!==void 0&&(u=void 0),A(e.options,`manual`,n===void 0?l||e.startedAt!==void 0?`route_change`:`initial_load`:`bf_cache`,void 0,n==null?e.startedAt:n,void 0,r==null?e.relativeStartedAt:r,i);return}if(l){if(e.type===`set_loading_time`){var n;(n=l.stopLoadingTime)==null||n.call(l),l.stopLoadingTime=void 0,D(l,Math.max(0,e.time-l.startedAt),`manual`);return}if(e.type===`add_timing`){var r;let t=e.name.trim().replace(/[^a-zA-Z0-9_.-]/g,`_`).slice(0,100),n=(r=e.elapsed)==null?e.time-l.startedAt:r;if(!t||!Number.isFinite(n)||n<0||n>Math.max(0,e.time-l.startedAt))return;let i=`view.custom_timings.${t}`;if(!(i in l.customTimings)&&Object.keys(l.customTimings).length>=100)return;l.customTimings[i]=n}else if(e.type===`set_context`||e.type===`set_context_property`){let t=e.type===`set_context`?e.attributes:K(K({},l.attributes),{},{[e.key]:e.value});for(let e of Object.keys(l.attributes))delete l.snapshotAttributes[e];l.attributes=k(t),Object.assign(l.snapshotAttributes,l.attributes),C(l)}else{if(l.name===e.name)return;l.name=e.name,l.snapshotAttributes[J.viewName]=e.name,C(l)}T(l,`update`)}});if(n.config.view.tracking===`auto`&&!l){var M;let e=((M=n.collectionStart)==null?void 0:M.isInitialDocument)===!1?n.collectionStart:void 0;A({},`load`,`initial_load`,void 0,e==null?void 0:e.startedAt,void 0,e==null?void 0:e.relativeStartedAt)}let N=Ul(e=>{let t=Yl(e.fromUrl,e.toUrl,n.config.view.routeMode);if(n.config.view.tracking===`auto`&&t)A({},e.source,`route_change`,e.fromUrl);else if(l){n.config.view.tracking===`manual`&&t&&(f!=null||(f=e.fromUrl)),l.rawUrl=e.toUrl;let r=n.config.hooks.redactUrl(e.toUrl);if(r===l.url)return;l.url=r,l.snapshotAttributes[J.viewUrl]=r,C(l),T(l,`update`)}});t=()=>{l&&n.isSessionActive()&&T(l,`update`)};let P=()=>{w(iu()),t==null||t()},F=()=>w(iu()),I=()=>{w(`frozen`),t==null||t()},ee=setInterval(()=>t==null?void 0:t(),6e4);(r=(i=document).addEventListener)==null||r.call(i,`visibilitychange`,P),(a=(o=document).addEventListener)==null||a.call(o,`freeze`,I),(s=(c=document).addEventListener)==null||s.call(c,`resume`,P),window.addEventListener(`focus`,F),window.addEventListener(`blur`,F),e.push(()=>clearInterval(ee),()=>{var e,t;return(e=(t=document).removeEventListener)==null?void 0:e.call(t,`visibilitychange`,P)},()=>{var e,t;return(e=(t=document).removeEventListener)==null?void 0:e.call(t,`freeze`,I)},()=>{var e,t;return(e=(t=document).removeEventListener)==null?void 0:e.call(t,`resume`,P)},()=>window.removeEventListener(`focus`,F),()=>window.removeEventListener(`blur`,F));let te=e=>{if(e.persisted){u=E(`bfcache`,!0,Po(e),!0,Fo(e));return}u=void 0,E(`pagehide`,!0,Po(e),!0,Fo(e))},ne=e=>{if(e.persisted&&n.config.view.tracking===`manual`){_=l?void 0:Po(e),v=l?void 0:Fo(e),y=l?void 0:eu();return}if(e.persisted&&n.config.view.tracking===`auto`){let t=Po(e),r=u;if(u=void 0,!n.isSessionActive()){d=r;return}A(r?{attributes:r.attributes,name:r.name,url:r.rawUrl,urlTemplate:r.urlTemplate}:{},`bfCache`,`bf_cache`,r==null?void 0:r.rawUrl,t,void 0,Fo(e))}},re=n.onSessionLifecycle(e=>{var t,r,i;if(e.type===`expired`){var a;l&&f&&(l.rawUrl=f,l.url=n.config.hooks.redactUrl(f),l.snapshotAttributes[J.viewUrl]=l.url),f=void 0,d=(a=E(`session_expired`,!0,e.expiredAt,e.endTimeKnown))==null?u:a,u=void 0;return}h=(t=e.activatedAt)==null?e.startedAt:t,g=(r=(i=[...m].find(e=>e.startedAt===h))==null?void 0:i.relativeStartedAt)==null?S(h):r;let o=Math.min(...Array.from(m,e=>e.startedAt));if(m.size&&(!d||o<=h)){d=void 0;return}d?(A({attributes:d.attributes,name:d.name,url:d.rawUrl,urlTemplate:d.urlTemplate},`sessionRenewal`,`session_renewal`,d.rawUrl,e.activatedAt,e.id,g),d=void 0):!l&&p?A(p,`manual`,`initial_load`,``,e.activatedAt,e.id,g):!l&&n.config.view.tracking===`auto`&&A({},`load`,`initial_load`,``,e.activatedAt,e.id,g)});window.addEventListener(`pagehide`,te),window.addEventListener(`pageshow`,ne),e.push(N,re,j,()=>window.removeEventListener(`pagehide`,te),()=>window.removeEventListener(`pageshow`,ne),()=>E(`shutdown`))},shutdown(){for(t=void 0;e.length;){var n;(n=e.pop())==null||n()}}}},su=5e3,cu=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,lu=(e,t)=>{if(!e||typeof e!=`object`)return;let n=e;if(typeof n.previousId==`string`&&n.previousId.length>0&&(n.reason===`inactivity`||n.reason===`maxLifetime`)&&cu(n.expiredAt)&&n.expiredAt<=t+su)return{previousId:n.previousId,expiredAt:n.expiredAt,reason:n.reason}},uu=e=>{let t=new Map;for(let n of e)t.delete(n.previousId),t.set(n.previousId,n);return[...t.values()].slice(-100)},du=(e,t)=>{var n,r;return(e==null?void 0:e.status)===`expired`&&e.previousId===t?e:(e==null?void 0:e.status)===`active`&&((n=e.previous)==null?void 0:n.previousId)===t?e.previous:e==null||(r=e.endedSessions)==null?void 0:r.find(e=>e.previousId===t)},fu=(e,t)=>{var n;let r={previousId:e.id,expiredAt:e.expiresAt,reason:t},i=e.previous;return K(K({},r),{},{schemaVersion:2,status:`expired`,endedSessions:uu([...(n=e.endedSessions)==null?[]:n,...i?[{previousId:i.previousId,expiredAt:i.expiredAt,reason:i.reason}]:[],r])})},pu=(e,t,n,r)=>({schemaVersion:2,expiresAt:Math.min(t+n,t+r),id:e,lastActivityAt:t,startedAt:t,status:`active`}),mu=(e,t,n)=>{if(t>=e.expiresAt)return e.expiresAt>=e.startedAt+n?`maxLifetime`:`inactivity`},hu=(e,t,n,r)=>K(K({},e),{},{lastActivityAt:Math.max(e.lastActivityAt,t),expiresAt:Math.min(Math.max(e.lastActivityAt,t)+n,e.startedAt+r)}),gu=(e,t,n)=>{if(!e)return null;try{let r=JSON.parse(e);if(!r||typeof r!=`object`)return null;let i=Array.isArray(r.endedSessions)?uu(r.endedSessions.slice(-100).map(e=>lu(e,t)).filter(e=>!!e)):void 0;if(delete r.endedSessions,i!=null&&i.length&&(r.endedSessions=i),r.schemaVersion===2&&r.status===`active`&&typeof r.id==`string`&&r.id.length>0&&cu(r.startedAt)&&r.startedAt<=t+su&&cu(r.lastActivityAt)&&r.lastActivityAt>=r.startedAt&&r.lastActivityAt<=t+su&&cu(r.expiresAt)&&r.expiresAt>=r.lastActivityAt&&r.expiresAt===Math.min(r.lastActivityAt+900*1e3,r.startedAt+n)){let e=lu(r.previous,t);return delete r.previous,e&&(r.previous=K(K({},e),{},{schemaVersion:2,status:`expired`})),r}if(r.schemaVersion===2&&r.status===`expired`&&typeof r.previousId==`string`&&r.previousId.length>0&&(r.reason===`inactivity`||r.reason===`maxLifetime`)&&cu(r.expiredAt)&&r.expiredAt<=t+su)return r}catch(e){}return null},_u=(e,t,n)=>{let r=!1,i=null,a,o=!1,s=new Set;try{var c;a=e.localStorage,r=!!((c=e.navigator)!=null&&c.locks),r&&a.getItem(t)}catch(e){r=!1}let l=()=>{if(!r)return i?gu(JSON.stringify(i),Date.now(),n):null;try{return gu(a.getItem(t),Date.now(),n)}catch(e){return r=!1,i}};return{isShared:()=>r,matches:e=>r&&e.storageArea===a&&(e.key===t||e.key===null),read:l,transact(n){return G(function*(){if(o)return;let c=()=>{if(o)return;let e=l(),s=n(e);return r?s.record!==e&&(s.record?a.setItem(t,JSON.stringify(s.record)):a.removeItem(t)):i=s.record,s.result};if(!r)return c();let u=new AbortController;s.add(u);let d=setTimeout(()=>u.abort(),1e3);try{return yield e.navigator.locks.request(t,{signal:u.signal},()=>{if(clearTimeout(d),!(u.signal.aborted||o))return c()})}catch(e){return o?void 0:(r=!1,c())}finally{clearTimeout(d),s.delete(u)}})()},stop(){o=!0,s.forEach(e=>e.abort()),s.clear()}}},vu=900*1e3,yu=14400*1e3,bu=1e3,xu=[`click`,`pointerdown`,`keydown`,`wheel`,`touchstart`,`touchmove`],Su=(e,t)=>{let n=e;try{n=new URL(e).host}catch(e){}return`bk_ot_session__${pl(`${t}\0${n||`default`}`)}`},Cu=e=>({[J.sessionId]:e.id,[J.sessionType]:`user`,[J.sessionHasReplay]:!1,[J.sessionStartTime]:e.startedAt,[J.sessionLastActivityTime]:e.lastActivityAt}),wu=(e,t,n,r)=>{let i=K(K(K(K({},e.config.hooks.getPageAttributes()),es({spanType:X.session})),Cu(n)),{},{[J.sessionPhase]:t});e.startSpan(Q({attributes:i,spanType:X.session}),i,{contextTime:r,startTime:r}).end(r)},Tu=(e={})=>{let t=[];return{name:`session`,init(n){return G(function*(){var r;if(typeof window>`u`||typeof document>`u`){n.setRuntimeAttributes(Cu(pu(q(`session`),Date.now(),vu,yu)));return}let i=window,a=document,o=Date.now(),s=typeof performance<`u`?performance.timeOrigin:void 0,c=a.visibilityState===`visible`&&s!==void 0&&Number.isFinite(s)&&s<=o&&o-s<vu?s:void 0,l=_u(i,`${(r=e.storageKey)==null?Su(n.config.transport.endpoint,n.config.application.name):r}__v2`,yu),u,d=!1,f=!1,p=!1,m,h,g=-1/0,_,v,y=0,b=()=>{clearTimeout(m),m=void 0},x=(e,t,r,i=!0)=>{(u==null?void 0:u.id)===e&&(u=void 0,b(),n.notifySessionLifecycle({id:e,reason:t,expiredAt:r,endTimeKnown:i,type:`expired`}),n.setRuntimeAttributes({[J.sessionId]:void 0,[J.sessionType]:void 0,[J.sessionHasReplay]:void 0,[J.sessionStartTime]:void 0,[J.sessionLastActivityTime]:void 0},r),n.flush())},S=e=>{if((e==null?void 0:e.status)===`expired`)return e;let t=e==null?void 0:e.previous;if(!t)return;let n=gu(JSON.stringify(t),Date.now(),yu);return(n==null?void 0:n.status)===`expired`?n:void 0},C=e=>{b(),m=setTimeout(()=>{E()},Math.max(0,e.expiresAt-Date.now()))},w=(e,t,r)=>{let i=(u==null?void 0:u.id)!==e.id;if(u=e,i){var a,o,s;let i=(a=c)==null?t:a;c=void 0,n.setRuntimeAttributes(Cu(e),i),n.notifySessionLifecycle({id:e.id,previousId:(o=S(e))==null?void 0:o.previousId,reason:r.created?(s=r.reason)==null?`init`:s:`shared`,startedAt:e.startedAt,activatedAt:i,type:`renewed`})}else n.setRuntimeAttributes({[J.sessionLastActivityTime]:e.lastActivityAt},t);C(e)},T=(e,t)=>{if(f)return;let r=e.record;if(u&&((r==null?void 0:r.status)!==`active`||r.id!==u.id)){let e=du(r,u.id),n=e&&e.expiredAt>=u.startedAt;x(u.id,n?e.reason:`external`,n?e.expiredAt:Math.min(t,u.expiresAt),!!n)}e.ended&&wu(n,`end`,e.ended,e.ended.expiresAt),(r==null?void 0:r.status)===`active`&&(e.activate||(u==null?void 0:u.id)===r.id)&&(w(r,t,e),e.created&&wu(n,e.reason?`rotate`:`start`,r,r.startedAt))},E=function(){var e=G(function*(e,t){var r;if(f)return;let i=e==null?Date.now():e,a=n.beginSessionTransition(Math.min(i,(r=u==null?void 0:u.expiresAt)==null?i:r));y++;try{let r=yield l.transact(n=>{let r=n,i,a,o=Date.now();(r==null?void 0:r.status)===`active`&&(e!==void 0&&(!t||t===r.id)&&e>=r.startedAt&&e<r.expiresAt&&o<Math.min(e+vu,r.startedAt+yu)&&(r=hu(r,e,vu,yu)),a=mu(r,o,yu),a&&(i=r,r=fu(r,a)));let s=e!==void 0&&(!t||(r==null?void 0:r.status)===`active`&&r.id===t)&&!((r==null?void 0:r.status)===`expired`&&e<r.expiredAt)&&!((r==null?void 0:r.status)===`active`&&e<r.startedAt);if(s)if((r==null?void 0:r.status)===`active`)r=hu(r,e,vu,yu);else{let t=(r==null?void 0:r.status)===`expired`?r:void 0;return o-e>=vu?{record:r,result:{record:r,ended:i}}:(r=K(K({},pu(q(`session`),e,vu,yu)),{},{endedSessions:t==null?void 0:t.endedSessions,previous:t?{schemaVersion:2,status:`expired`,previousId:t.previousId,expiredAt:t.expiredAt,reason:t.reason}:void 0}),{record:r,result:{record:r,ended:i,activate:!0,created:!0,reason:t==null?void 0:t.reason}})}return{record:r,result:{record:r,ended:i,activate:s}}});if(r&&!f){if(n.config.debug){var o,s,c,d,p;(o=globalThis.console)==null||o.debug(`[bk-ot] session`,{trigger:e===void 0?`check`:t?`activity_flush`:`activity`,mode:l.isShared()?`shared`:`memory`,previousId:u==null?void 0:u.id,sessionId:((s=r.record)==null?void 0:s.status)===`active`?r.record.id:void 0,lastActivityAt:((c=r.record)==null?void 0:c.status)===`active`?r.record.lastActivityAt:void 0,deadline:((d=r.record)==null?void 0:d.status)===`active`?r.record.expiresAt:(p=r.record)==null?void 0:p.expiredAt,detectedAt:Date.now()})}T(r,i)}}finally{y--,a()}});return function(t,n){return e.apply(this,arguments)}}(),D=()=>{if(f||y||p||!u)return;let e=l.read();if((e==null?void 0:e.status)===`active`&&e.id===u.id&&!mu(e,Date.now(),yu)){e.lastActivityAt!==u.lastActivityAt&&w(e,Date.now(),{record:e});return}p=!0,E().finally(()=>{p=!1})};t.push(n.registerSessionCheck(D));let O=e=>{if(a.visibilityState!==`visible`||!e.isTrusted||f)return;let t=Po(e);d=!0;let n=l.read();!u||(n==null?void 0:n.status)!==`active`||n.id!==u.id||mu(n,Date.now(),yu)||t-g>=bu?(clearTimeout(h),h=void 0,_=void 0,g=t,E(t)):(_=t,v=u.id,h===void 0&&(h=setTimeout(()=>{h=void 0;let e=_;_=void 0,e!==void 0&&(g=e,E(e,v))},Math.max(0,g+bu-Date.now()))))},k=()=>{a.visibilityState===`visible`&&(d?D():(d=!0,E(Date.now())))},A=e=>{l.matches(e)&&D()},j={capture:!0,passive:!0};xu.forEach(e=>i.addEventListener(e,O,j)),a.addEventListener(`visibilitychange`,k),i.addEventListener(`pageshow`,k),i.addEventListener(`focus`,D),i.addEventListener(`resume`,D),i.addEventListener(`storage`,A),t.push(()=>{f=!0,l.stop(),b(),clearTimeout(h),xu.forEach(e=>i.removeEventListener(e,O,j)),a.removeEventListener(`visibilitychange`,k),i.removeEventListener(`pageshow`,k),i.removeEventListener(`focus`,D),i.removeEventListener(`resume`,D),i.removeEventListener(`storage`,A)}),a.visibilityState===`visible`&&(d=!0,yield E(Date.now()))})()},shutdown(){for(var e;t.length;)(e=t.pop())==null||e()}}},Eu={FCP:[1800,3e3],LCP:[2500,4e3],TTFB:[800,1800]},Du=({collectInitialDocument:e,getTarget:t,onChange:n,onMetric:r})=>{let i=!1,a=!1,o=!1,s=!1,c=!1,l=!1,u=1/0,d,f,p,m=[],h=new Set,g=[],_=()=>!!document.prerendering,v=e=>performance.getEntriesByType(e),y=()=>{let e=v(`navigation`)[0];return e&&Number.isFinite(e.responseStart)&&e.responseStart>0&&e.responseStart<performance.now()?e:void 0},b=e=>{var t;return typeof PerformanceObserver<`u`&&((t=PerformanceObserver.supportedEntryTypes)==null?void 0:t.includes(e))},x=!!b(`paint`),S=!!b(`largest-contentful-paint`),C=(e,t,n)=>{e.addEventListener(t,n,!0),m.push(()=>e.removeEventListener(t,n,!0))},w=(e,t,n=[],r={},i=0,a=`document`)=>{let[o,s]=Eu[e];return{name:e,value:t,rating:t<=o?`good`:t<=s?`needs-improvement`:`poor`,entries:n,attribution:r,activationStart:i,kind:a}},T=e=>{!i&&Number.isFinite(e.value)&&e.value>=0&&r(e)},E=()=>{d&&d!==f&&(f=d,T(d))},D=()=>{for(let{observer:e,process:t}of g)t(e.takeRecords())},O=(e,t)=>{let n;try{return n=new PerformanceObserver(e=>{i||t(e.getEntries())}),n.observe({type:e,buffered:!0}),g.push({observer:n,process:t,type:e}),n}catch(e){n==null||n.disconnect();return}},k=()=>{var e;if(i||o||!a||c||_()||document.readyState!==`complete`)return;let t=y();if(!t)return;c=!0;let n=(e=t.activationStart)==null?0:e,r=Math.max(0,t.responseStart-n),s=(e,t=0)=>Math.min(r,Math.max(t,e-n)),l=s(t.workerStart||t.fetchStart),u=s(t.domainLookupStart,l),d=s(t.connectStart,u),f=s(t.connectEnd,d);T(w(`TTFB`,r,[t],{waitingDuration:l,cacheDuration:u-l,dnsDuration:d-u,connectionDuration:f-d,requestDuration:r-f}))},A=()=>{p===void 0&&!c&&(p=setTimeout(()=>{p=void 0,k()},0))},j=()=>{var r,c,f,p;if(i||a||o||!e||_())return;a=!0;let m=(r=(c=v(`navigation`)[0])==null?void 0:c.activationStart)==null?0:r;if(u=(f=(p=v(`visibility-state`).find(e=>e.name===`hidden`&&e.startTime>=m))==null?void 0:p.startTime)==null?document.visibilityState===`hidden`?0:1/0:f,x){let e=O(`paint`,t=>{if(o||s)return;let n=t.find(e=>e.name===`first-contentful-paint`);n&&(s=!0,e==null||e.disconnect(),n.startTime<u&&T(w(`FCP`,Math.max(0,n.startTime-m),[n])))});x=!!e}S&&(S=!!O(`largest-contentful-paint`,e=>{if(!(o||l))for(let r of e){if(!Number.isFinite(r.startTime)||r.startTime>=u)continue;let e=Math.max(0,r.startTime-m),i={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e};r.element&&(i.target=t(r.element)),r.url&&(i.url=r.url);let a=y();if(a){let t=r.url?v(`resource`).filter(e=>e.name===r.url&&e.startTime<=r.startTime).sort((e,t)=>t.startTime-e.startTime)[0]:void 0,n=Math.min(e,Math.max(0,a.responseStart-m)),o=Math.min(e,Math.max(n,t?(t.requestStart||t.startTime)-m:0)),s=Math.min(e,Math.max(o,t?t.responseEnd-m:0));Object.assign(i,{timeToFirstByte:n,resourceLoadDelay:o-n,resourceLoadDuration:s-o,elementRenderDelay:e-s})}d=w(`LCP`,e,[r],i),n==null||n()}})),document.readyState===`complete`&&A()},M=()=>{i||(D(),k(),E())},N=()=>{if(!l){D(),E(),l=!0;for(let e of g)e.type===`largest-contentful-paint`&&e.observer.disconnect()}},P=()=>{for(let e of h)cancelAnimationFrame(e);h.clear()},F=e=>{let t=requestAnimationFrame(()=>{h.delete(t),i||e()});h.add(t)},I=()=>{M(),o=!0;for(let{observer:e}of g)e.disconnect();p!==void 0&&clearTimeout(p),p=void 0};C(document,`prerenderingchange`,j),C(window,`load`,A),C(document,`visibilitychange`,e=>{document.visibilityState!==`hidden`||_()||(u=Math.min(u,e.timeStamp),N())});for(let e of[`click`,`keydown`])C(window,e,e=>{e.isTrusted&&a&&N()});return C(window,`pagehide`,()=>{I(),P()}),C(window,`pageshow`,e=>{if(!e.persisted)return;I(),P();let t=e.timeStamp;!Number.isFinite(t)||t<0||(y()&&T(w(`TTFB`,0,[],{waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0},t,`activation`)),(x||S)&&typeof requestAnimationFrame==`function`&&F(()=>F(()=>{if(document.visibilityState===`hidden`)return;let e=Math.max(0,performance.now()-t);x&&T(w(`FCP`,e,[],{},t,`activation`)),S&&T(w(`LCP`,e,[],{timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e},t,`activation`))})))}),j(),{flush:M,stop(){i||(I(),i=!0,P(),m.forEach(e=>e()),g.length=m.length=0,d=f=void 0)}}},Ou=10,ku=6e4,Au=5e3,ju=1e3,Mu=(e,t)=>{let[n,r]=e===`CLS`?[.1,.25]:[200,500];return t<=n?`good`:t<=r?`needs-improvement`:`poor`},Nu=e=>{if(!(typeof Element>`u`||!(e instanceof Element)))try{return Mo(e,new Event(`vital`),{nameCollection:`explicit`})}catch(e){return}},Pu=(e,t)=>{!Number.isFinite(t.interactionId)||!t.interactionId||t.interactionId<0||(e.interactionIdMin=Math.min(e.interactionIdMin,t.interactionId),e.interactionIdMax=Math.max(e.interactionIdMax,t.interactionId))},Fu=()=>{if(typeof performance>`u`)return;let e=performance.interactionCount;return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0},Iu=e=>e&&[e.x,e.y,e.width,e.height].every(Number.isFinite)&&e.width>=0&&e.height>=0?e.width*e.height:0,Lu=e=>{let t=Iu(e.previousRect),n=Iu(e.currentRect);if(!t||!n)return t+n;let r=e.previousRect,i=e.currentRect,a=Math.max(0,Math.min(r.x+r.width,i.x+i.width)-Math.max(r.x,i.x)),o=Math.max(0,Math.min(r.y+r.height,i.y+i.height)-Math.max(r.y,i.y));return t+n-a*o},Ru=(e,t)=>{var n,r;let i=(n=t.sources)==null?void 0:n.reduce((e,t)=>Lu(t)>Lu(e)?t:e,t.sources[0]),a=(r=Nu(i==null?void 0:i.node))==null?void 0:r.selector,o=typeof window>`u`?void 0:window.devicePixelRatio,s=K(K({"vital.cls.time":Math.max(0,t.startTime-e.relativeStartedAt)},a?{"vital.cls.target_selector":a}:{}),typeof o==`number`&&Number.isFinite(o)&&o>0?{"vital.cls.device_pixel_ratio":o}:{});for(let[e,t]of[[`previous_rect`,i==null?void 0:i.previousRect],[`current_rect`,i==null?void 0:i.currentRect]])if(t)for(let n of[`x`,`y`,`width`,`height`])Number.isFinite(t[n])&&(s[`vital.cls.${e}.${n}`]=t[n]);return s},zu=(e,t)=>{var n,r,i;let a=(n=t.value)==null?0:n;t.hadRecentInput||!Number.isFinite(a)||a<0||!Number.isFinite(t.startTime)||t.startTime<0||(e.clsWindowStart===void 0||t.startTime-((r=e.clsWindowEnd)==null?t.startTime:r)>=ju||t.startTime-e.clsWindowStart>=Au?(e.clsWindowStart=t.startTime,e.clsWindowValue=a,e.clsWindowLargestShift=void 0):e.clsWindowValue+=a,e.clsWindowEnd=t.startTime,(!e.clsWindowLargestShift||a>e.clsWindowLargestShift.value)&&(e.clsWindowLargestShift={attribution:Ru(e,t),value:a}),e.clsWindowValue>((i=e.clsMaxWindowValue)==null?0:i)&&(e.clsMaxWindowValue=e.clsWindowValue,e.cls=Math.round(e.clsWindowValue*1e4)/1e4,e.clsAttribution=e.clsWindowLargestShift.attribution))},Bu=(e,t,n=Nu)=>{var r;let i=(r=e.inpGroups)==null?e.inpGroups=new Map:r,a=Array.isArray(t)?t:[t];for(let t of a){var o,s;let r=(o=t.processingStart)==null?t.startTime:o,a=(s=t.processingEnd)==null?r:s;if(!t.interactionId||t.interactionId<0||!Number.isFinite(t.interactionId)||![t.duration,t.startTime,r,a].every(Number.isFinite)||t.duration<0||t.startTime<0)continue;Pu(e,t);let c=t.startTime+t.duration,l=i.get(t.interactionId);l||(l=Array.from(i.values()).find(e=>Math.abs(c-e.referenceRenderTime)<=8)),l?(l.startTime=Math.min(l.startTime,t.startTime),l.processingStart=Math.min(l.processingStart,r),l.processingEnd=Math.max(l.processingEnd,a)):l={startTime:t.startTime,processingStart:r,processingEnd:a,referenceRenderTime:c},i.set(t.interactionId,l);let u=e.inpCandidates.findIndex(e=>e.interactionId===t.interactionId);if(u>=0&&t.duration<=e.inpCandidates[u].rawDuration)continue;let d;try{d=n(t.target,t)}catch(e){}let f={startTime:t.startTime,duration:Math.min(t.duration,ku),rawDuration:t.duration,inputDelay:0,interactionId:t.interactionId,interactionTarget:d==null?void 0:d.name,targetSelector:d==null?void 0:d.selector,interactionType:t.name,presentationDelay:0,processingDuration:0};u>=0?e.inpCandidates[u]=f:e.inpCandidates.push(f),e.inpCandidates.sort((e,t)=>t.rawDuration-e.rawDuration).splice(Ou)}for(let t of e.inpCandidates){let e=i.get(t.interactionId),n=e.startTime+t.duration,r=Math.max(e.startTime,Math.min(e.processingStart,n)),a=Math.max(r,Math.min(e.processingEnd,n));t.startTime=e.startTime,t.inputDelay=r-e.startTime,t.processingDuration=a-r,t.presentationDelay=n-a}let c=new Set(e.inpCandidates.map(e=>e.interactionId));for(let e of i.keys())c.has(e)||i.delete(e)},Vu=e=>{var t;let n=e.endedAt===void 0?Fu():e.interactionCountAtEnd,r=e.interactionIdMin===1/0?0:(e.interactionIdMax-e.interactionIdMin)/7+1;return n!==void 0&&e.interactionCountAtStart!==void 0?Math.max(r,n-e.interactionCountAtStart-((t=e.foreignInteractionCount)==null?0:t)):r},Hu=e=>{if(e.inpCandidates.length)return e.inpCandidates[Math.min(e.inpCandidates.length-1,Math.floor(Vu(e)/50))]},Uu=(e,t)=>!!t&&e===t,Wu=5*6e4,Gu=100,Ku=3e3,qu=(e,t)=>{var n;let r=(n=e.attribution)==null?{}:n,i={},a=e=>r[e],o=(e,t,n)=>{t==null||t===``||(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)&&(i[e]=typeof t==`string`&&n?n(t):t)};switch(e.name){case`LCP`:o(`vital.lcp.url`,a(`url`),t),o(`vital.lcp.target`,a(`target`)),o(`vital.lcp.element_render_delay`,a(`elementRenderDelay`)),o(`vital.lcp.resource_load_delay`,a(`resourceLoadDelay`)),o(`vital.lcp.time_to_first_byte`,a(`timeToFirstByte`)),o(`vital.lcp.resource_load_duration`,a(`resourceLoadDuration`));break;case`CLS`:o(`vital.cls.load_state`,a(`loadState`));break;case`INP`:o(`vital.inp.interaction_target`,a(`interactionTarget`)),o(`vital.inp.target_selector`,a(`targetSelector`)),o(`vital.inp.time`,a(`time`)),o(`vital.inp.interaction_type`,a(`interactionType`)),o(`vital.inp.input_delay`,a(`inputDelay`)),o(`vital.inp.processing_duration`,a(`processingDuration`)),o(`vital.inp.presentation_delay`,a(`presentationDelay`));break;case`TTFB`:o(`vital.ttfb.waiting_duration`,a(`waitingDuration`)),o(`vital.ttfb.cache_duration`,a(`cacheDuration`)),o(`vital.ttfb.dns_duration`,a(`dnsDuration`)),o(`vital.ttfb.connection_duration`,a(`connectionDuration`)),o(`vital.ttfb.request_duration`,a(`requestDuration`));break;default:break}return i},Ju=()=>{let e,t=()=>{},n=!1;return{name:`web-vitals`,flush:()=>t(),init(r){var i,a,o,s,c,l,u;if(n||typeof window>`u`)return;let d=((i=r.collectionStart)==null?void 0:i.isInitialDocument)!==!1,f=[],p=new Map,m=new Map,h,g,_,v,y=[],b=e=>{var t;return typeof PerformanceObserver<`u`&&((t=PerformanceObserver.supportedEntryTypes)==null?void 0:t.includes(e))},x=b(`layout-shift`),S=!1,C=()=>{if(!(!g||S)){S=!0;try{let e=r.getRuntimeAttributes();g&&e[J.viewId]===g.id&&e[J.sessionId]===g.runtimeAttributes[J.sessionId]&&(g.runtimeAttributes=e)}finally{S=!1}}},w=(e,t,i={})=>{var a,o,s,c;let l=(a=(o=t.view)==null?void 0:o.runtimeAttributes)==null?t.runtimeAttributes:a;if(n||!Number.isFinite(e.value)||e.value<0||!l[J.viewId])return;let u=K(K({},qu(e,r.config.hooks.redactUrl)),i),d=JSON.stringify([e.value,u,l]),f=t.metrics.get(e.name);if((f==null?void 0:f.signature)===d)return;let p={id:(s=f==null?void 0:f.id)==null?q(`vital`):s,version:((c=f==null?void 0:f.version)==null?0:c)+1,signature:d};t.metrics.set(e.name,p);let m=K(K(K(K({},r.config.hooks.getPageAttributes()),l),es({outcome:Qo(e.rating),spanType:X.vital})),{},{[J.vitalMetric]:e.name.toLowerCase(),[J.vitalValue]:e.value,[J.vitalId]:p.id,[J.vitalVersion]:p.version,[J.vitalScope]:t.kind},u),h=Date.now();r.startSpan(Q({attributes:m,spanType:X.vital}),m,{contextAttributes:l,contextTime:t.startedAt,startTime:h}).end(h)},T=e=>{let t=K(K({},e),{},{kind:`view`});x&&w({name:`CLS`,rating:Mu(`CLS`,e.cls),value:e.cls,attribution:{}},t,e.clsAttribution);let n=Hu(e);n?w({name:`INP`,rating:Mu(`INP`,n.duration),value:n.duration,attribution:{inputDelay:n.inputDelay,interactionTarget:n.interactionTarget,interactionType:n.interactionType,presentationDelay:n.presentationDelay,processingDuration:n.processingDuration,targetSelector:n.targetSelector,time:Math.max(0,n.startTime-e.relativeStartedAt)}},t):b(`event`)&&e.interactionIdMin!==1/0&&w({name:`INP`,rating:`good`,value:0,attribution:{}},t)},E=()=>{n||_!==void 0||(_=setTimeout(()=>{_=void 0,t()},Ku))},D=()=>{var e;let t=Date.now();for(let e=f.length-1;e>=0;e--)f[e].retainedUntil!==void 0&&f[e].retainedUntil<=t&&f.splice(e,1);f.length>Gu&&f.splice(0,f.length-Gu);for(let[n,r]of p)((e=r.view)==null?void 0:e.retainedUntil)!==void 0&&r.view.retainedUntil<=t&&p.delete(n);for(;p.size>Gu;)p.delete(p.keys().next().value)},O=e=>[...f].reverse().find(t=>t.relativeStartedAt<=e.startTime&&(t.relativeEndedAt===void 0||e.startTime<t.relativeEndedAt)),k=[],A=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`click`,`keydown`,`keyup`],j=e=>{var t,n;if(!e.isTrusted)return;let r=(t=(n=e.composedPath)==null?void 0:n.call(e)[0])==null?e.target:t;k.push({name:e.type,time:e.timeStamp,target:Nu(r)});let i=performance.now()-1e4;for(;k.length>100||k[0]&&k[0].time<i;)k.shift()};A.forEach(e=>window.addEventListener(e,j,!0));let M=(e,t)=>{let n=k.filter(e=>e.name===t.name&&Math.abs(e.time-t.startTime)<=8&&performance.now()-e.time<=1e4),r=n.filter(e=>e.time===t.startTime),i=r.length===1?r[0]:n.length===1?n[0]:void 0;return i?i.target:Nu(e)},N=[],P=(e,t)=>{if(n||e.length===0)return;C(),D();let r=new Map;for(let n of e){var i;let e=O(n);if(!e){d&&!h&&f.length===0&&(N.push({entry:n,type:t}),N.length>200&&N.shift());continue}let a=(i=r.get(e))==null?[]:i;a.push(n),r.set(e,a)}let a=new Set;for(let[e,n]of r){var o,s,c;if(t===`inp`)Bu(e,n,M);else for(let r of n)(t===`count`?Pu:zu)(e,r);if(e.endedAt===void 0){E();continue}if(a.add(e),e.interactionCountAtEnd===void 0||e.interactionCountAtStart===void 0||e.interactionIdMin===1/0)continue;let r=(e.interactionIdMax-e.interactionIdMin)/7+1,i=e.interactionCountAtEnd-e.interactionCountAtStart-((o=e.foreignInteractionCount)==null?0:o),u=Math.max(0,r-i),d=Math.max(0,u-((s=e.nativeLateCount)==null?0:s));if(e.nativeLateCount=Math.max((c=e.nativeLateCount)==null?0:c,u),d)for(let t of f){let r=n.map(e=>e.startTime+e.duration);if(t.relativeStartedAt>=e.relativeEndedAt&&t.relativeStartedAt<Math.min(...r)-4&&(t.relativeEndedAt===void 0||Math.max(...r)+4<t.relativeEndedAt)){var l;t.foreignInteractionCount=((l=t.foreignInteractionCount)==null?0:l)+d,t.endedAt!==void 0&&a.add(t)}}}for(let e of a)T(e)},F=(e,t,n)=>{if(!b(e))return;let r=e=>P(e,t),i=new PerformanceObserver(e=>r(e.getEntries()));y.push({observer:i,process:r}),i.observe(K({type:e,buffered:!0},n===void 0?{}:{durationThreshold:n}))},I=()=>y.forEach(({observer:e,process:t})=>{var n,r;return t((n=(r=e.takeRecords)==null?void 0:r.call(e))==null?[]:n)}),ee=e=>{if(n)return;C();let t=e.kind===`document`?h:p.get(e.activationStart);if(t)w(e,t);else for(m.set(`${e.kind}:${e.activationStart}:${e.name}`,K(K({},e),{},{entries:[]}));m.size>30;)m.delete(m.keys().next().value)},te=(e,t)=>{var n,r,i;return{id:e.id,startedAt:(n=e.startedAt)==null?Date.now():n,relativeStartedAt:(r=e.relativeStartedAt)==null?e.loadingType===`initial_load`?0:performance.now():r,endedAt:e.endedAt,relativeEndedAt:e.relativeEndedAt,retainedUntil:e.endedAt===void 0?void 0:Date.now()+Wu,runtimeAttributes:t,cls:0,clsWindowValue:0,inpCandidates:[],metrics:new Map,interactionCountAtStart:(i=e.interactionCountAtStart)==null?e.loadingType===`initial_load`?0:void 0:i,interactionCountAtEnd:e.interactionCountAtEnd,interactionIdMin:1/0,interactionIdMax:0}},ne=(e,t)=>{e.loadingType===`initial_load`&&!h&&d&&(h=K(K({},t),{},{metrics:new Map,kind:`document`,view:t})),e.loadingType===`bf_cache`&&p.set(t.relativeStartedAt,K(K({},t),{},{metrics:new Map,kind:`activation`,view:t}));for(let[e,t]of m){let n=t.kind===`document`?h:p.get(t.activationStart);n&&(m.delete(e),w(t,n))}};for(let e of(a=(o=r.getViewHistory)==null?void 0:o.call(r))==null?[]:a){var re;if(!e.view.id||!d&&((re=e.view.relativeStartedAt)==null?-1/0:re)<r.collectionStart.relativeStartedAt)continue;let t=te(e.view,e.runtimeAttributes);f.push(t),t.endedAt===void 0&&(g=t),ne(e.view,t)}let ie=r.onViewChange(e=>{if(!n){if(g&&Uu(g.id,e.id)){C();return}if(I(),g){var t,i,a,o,s,c,l,u;let n=g;n.endedAt=Math.max(n.startedAt,(t=(i=e.endedAt)==null?e.startedAt:i)==null?Date.now():t),n.relativeEndedAt=Math.max(n.relativeStartedAt,(a=(o=e.relativeEndedAt)==null?e.relativeStartedAt:o)==null?performance.now():a),n.retainedUntil=Date.now()+Wu;let d=(s=r.getViewHistory)==null?void 0:s.call(r).find(e=>e.view.id===n.id);n.interactionCountAtEnd=(c=(l=(u=d==null?void 0:d.view.interactionCountAtEnd)==null?e.interactionCountAtEnd:u)==null?e.interactionCountAtStart:l)==null?Fu():c,d&&(n.runtimeAttributes=d.runtimeAttributes),T(n)}if(g=e.id?te(e,r.getRuntimeAttributes()):void 0,g){var d;(d=g).interactionCountAtStart!=null||(d.interactionCountAtStart=Fu()),f.push(g),ne(e,g);let t=N.splice(0);for(let e of[`count`,`inp`,`cls`])P(t.filter(t=>t.type===e).map(e=>e.entry),e)}D()}});t=()=>{if(!n){_!==void 0&&clearTimeout(_),_=void 0,I(),_!==void 0&&clearTimeout(_),_=void 0,C(),v==null||v.flush(),_!==void 0&&clearTimeout(_),_=void 0,D();for(let e of f)T(e)}};let ae=()=>{document.visibilityState===`hidden`&&t()};(s=(c=document).addEventListener)==null||s.call(c,`visibilitychange`,ae),(l=(u=document).addEventListener)==null||l.call(u,`freeze`,t);let oe=t;e=()=>{var e,n,r,i;t(),v==null||v.stop(),ie(),y.forEach(({observer:e})=>e.disconnect()),(e=(n=document).removeEventListener)==null||e.call(n,`visibilitychange`,ae),(r=(i=document).removeEventListener)==null||r.call(i,`freeze`,oe),A.forEach(e=>window.removeEventListener(e,j,!0)),_!==void 0&&clearTimeout(_),f.length=k.length=N.length=0,p.clear(),m.clear(),g=void 0,h=void 0},F(`event`,`count`,0),F(`event`,`inp`,40),F(`first-input`,`inp`),F(`layout-shift`,`cls`),v=Du({collectInitialDocument:d,getTarget:e=>{var t;return(t=Nu(e))==null?void 0:t.selector},onMetric:ee,onChange:E})},shutdown(){n||(e==null||e(),n=!0,e=void 0,t=()=>{})}}},Yu=(e,t)=>{let n={"network.protocol.name":`websocket`,"url.full":t(e)};try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);n[`server.address`]=t.hostname,t.port&&(n[`server.port`]=Number(t.port)),n[`url.scheme`]=t.protocol.replace(`:`,``)}catch(e){}return n},Xu=(e,t,n,r)=>{let i=q(`websocket`),a=Yu(n,t.config.hooks.redactUrl),o=!1,s=(e,n,o={})=>{if(r()||!t.isSampled())return;let s=e===`error`,c=K(K(K({},a),es({outcome:s?Y.error:Y.success,spanType:X.websocket})),{},{[J.websocketPhase]:e,"websocket.connection.id":i},o);t.startSpan(Q({attributes:c,spanType:X.websocket}),c,{kind:Pe.CLIENT,startTime:n}).end(n)};s(`connect`,Date.now()),e.addEventListener(`open`,()=>{o=!0,s(`open`,Date.now())}),e.addEventListener(`error`,()=>{s(`error`,Date.now(),{"websocket.error.phase":o?`runtime`:`connect`})}),e.addEventListener(`close`,e=>{s(`close`,Date.now(),{"websocket.close.code":e.code,"websocket.close.reason":e.reason,"websocket.close.was_clean":e.wasClean})})},Zu=()=>{let e,t,n=!1;return{name:`websocket`,init(r){if(typeof window>`u`||window.WebSocket===void 0)return;let i=window.WebSocket;e=i,t=new Proxy(i,{construct(e,t,i){let a=Reflect.construct(e,t,i);if(n||!r.isSampled())return a;let o=t[0]==null?``:String(t[0]);return o&&!Uo(r.config,o)&&Xu(a,r,o,()=>n),a}}),window.WebSocket=t},shutdown(){n=!0,typeof window<`u`&&e&&window.WebSocket===t&&(window.WebSocket=e),t=void 0,e=void 0}}},Qu=class{constructor(){z(this,`listeners`,new Set),z(this,`notify`,e=>{this.listeners.forEach(t=>t(e))}),z(this,`subscribe`,e=>(this.listeners.add(e),()=>this.listeners.delete(e)))}},$u=`0.0.35-beta.1`,ed=e=>e.trim().replace(/\/+$/,``),td=e=>{var t;let n=e.token||e.headers?K(K({},e.token?{Authorization:`Bearer ${e.token}`}:{}),(t=e.headers)==null?{}:t):void 0;return{concurrencyLimit:e.concurrencyLimit,endpoint:`${ed(e.endpoint)}/v1/rum`,headers:n,timeoutMillis:e.timeoutMillis}},nd=e=>typeof e!=`number`||!Number.isFinite(e)?1:Math.max(0,Math.min(1,e)),rd=e=>e,id=e=>{if(!e)return e;try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);return t.username=``,t.password=``,t.search=``,t.hash=``,t.href}catch(t){return e.replace(/[?#].*$/,``)}},ad=e=>{try{return new URL(e,typeof location>`u`?`http://localhost`:location.href).pathname||`/`}catch(t){return e||`/`}},od=e=>zo(ad(e)),sd=(e,t,n=od)=>r=>{try{let e=t==null?void 0:t(r);if(e)return e}catch(t){var i;e.debug&&((i=globalThis.console)==null||i.warn(`[bk-ot] url template hook failed:`,t))}return n(r)},cd=e=>{var t;return{environment:(t=e.environment)==null?`production`:t,name:e.name,version:e.version}},ld=(e,t,n)=>K(K(K({[J.deploymentEnvironmentName]:e.environment},t===!1?{}:Cl()),{},{[J.serviceName]:e.name},e.version?{[J.serviceVersion]:e.version}:{}),{},{[J.sessionSampleRate]:n,"telemetry.sdk.language":`webjs`,"telemetry.sdk.name":`blueking`,"telemetry.sdk.version":$u}),ud=e=>{var t;if(!e)throw Error(`[bk-ot] transport is required.`);if(!((t=e.endpoint)!=null&&t.trim()))throw Error(`[bk-ot] transport.endpoint is required.`)},dd=e=>{var t,n,r,i,a,o,s,c,l,u,d,f,p;return{beforeSend:(t=e.tracking)==null?void 0:t.beforeSend,getPageAttributes:(n=(r=e.context)==null||(r=r.attributes)==null?void 0:r.page)==null?(()=>({})):n,getErrorAttributes:(i=(a=e.context)==null||(a=a.attributes)==null?void 0:a.error)==null?(()=>({})):i,getCustomAttributes:(o=(s=e.context)==null||(s=s.attributes)==null?void 0:s.custom)==null?(()=>({})):o,getRequestUrlTemplate:sd(e,typeof((c=e.tracking)==null?void 0:c.request)==`object`?e.tracking.request.getUrlTemplate:void 0),getViewUrlTemplate:sd(e,typeof((l=e.tracking)==null?void 0:l.view)==`object`?e.tracking.view.getUrlTemplate:void 0,t=>{var n,r;return zo(ql(t,(n=(r=e.tracking)==null||(r=r.view)==null?void 0:r.routeMode)==null?`auto`:n).routePath)}),redactAttributes:(u=(d=e.privacy)==null?void 0:d.redactAttributes)==null?rd:u,redactUrl:(f=(p=e.privacy)==null?void 0:p.redactUrl)==null?id:f}},fd=e=>{var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;if(!(!((t=e.application)==null||(t=t.name)==null)&&t.trim()))throw Error(`[bk-ot] application.name is required.`);ud(e.transport);let v=cd(e.application),y=typeof((n=e.tracking)==null?void 0:n.view)==`object`?e.tracking.view:void 0,b=dd(e),x=nd((r=e.session)==null?void 0:r.sampleRate);return{application:v,autoStart:(i=e.autoStart)==null?!0:i,debug:(a=e.debug)==null?!1:a,enabled:(o=e.enabled)==null?!0:o,extensions:{instrumentations:[...(s=(c=e.extensions)==null?void 0:c.instrumentations)==null?[]:s],plugins:[...(l=(u=e.extensions)==null?void 0:u.plugins)==null?[]:l]},hooks:b,resourceAttributes:b.redactAttributes(ld(v,(d=e.tracking)==null?void 0:d.device,x)),session:K(K({},e.session),{},{sampleRate:x}),spanBatch:e.transport.batch,spanProcessor:(f=e.transport.processor)==null?`batch`:f,tracking:(p=e.tracking)==null?{}:p,trackingConsent:(m=(h=e.privacy)==null?void 0:h.trackingConsent)==null?`granted`:m,transport:td(e.transport),user:(g=e.context)==null?void 0:g.user,view:{excludedActivityUrls:y==null?void 0:y.excludedActivityUrls,loadingTime:(y==null?void 0:y.loadingTime)!==!1,tracking:(y==null?void 0:y.tracking)===`manual`?`manual`:`auto`,routeMode:(_=y==null?void 0:y.routeMode)==null?`auto`:_}}},pd=(e,t)=>typeof e.enabled==`function`?e.enabled(t):e.enabled!==!1,md=class{drain(e){for(let n of e)try{var t;(t=n.drain)==null||t.call(n)}catch(e){this.warn(n,`drain`,e)}}invoke(e,t){var n=this;return G(function*(){try{var r;yield(r=e[t])==null?void 0:r.call(e)}catch(r){n.warn(e,t,r)}})()}warn(e,t,n){var r;this.debug&&((r=globalThis.console)==null||r.warn(`[bk-ot] plugin "${e.name}" ${t} failed:`,n))}constructor(e){z(this,`debug`,!1),z(this,`plugins`,void 0),z(this,`startedPlugins`,[]),z(this,`stopped`,!1),z(this,`stopping`,void 0),this.plugins=e}flush(){var e=this;return G(function*(){let t=[...e.startedPlugins];e.drain(t);for(let n of t)yield e.invoke(n,`flush`)})()}shutdown(){var e=this;return G(function*(){if(e.stopping)return e.stopping;e.stopped=!0;let t=e.startedPlugins.splice(0);return e.stopping=G(function*(){e.drain(t);for(let n of t)yield e.invoke(n,`flush`);for(let n of t.reverse())yield e.invoke(n,`shutdown`)})(),e.stopping})()}start(e){var t=this;return G(function*(){t.debug=e.config.debug;for(let a of t.plugins){if(t.stopped)return;if(pd(a,e.config)){t.startedPlugins.push(a);try{if(yield a.init(e),t.stopped){var n;yield(n=a.shutdown)==null?void 0:n.call(a);return}}catch(n){let o=t.startedPlugins.indexOf(a);if(o>=0){t.startedPlugins.splice(o,1);try{var r;yield(r=a.shutdown)==null?void 0:r.call(a)}catch(e){}}if(e.config.debug){var i;(i=globalThis.console)==null||i.warn(`[bk-ot] plugin "${a.name}" init failed:`,n)}}}}})()}},hd=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t=Math.imul(t^e.charCodeAt(n),16777619);return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,t+=t<<5,(t>>>0)/4294967296},gd=({application:e,session:t},n)=>t.sampleRate<=0?!1:t.sampleRate>=1?!0:hd(`${e.name}\0${n}`)<t.sampleRate,_d=class{constructor(e){z(this,`associations`,[]),z(this,`callbacks`,[]),z(this,`check`,void 0),z(this,`checking`,!1),z(this,`pending`,new Set),z(this,`begin`,e=>{let t={at:e};return this.pending.add(t),()=>{if(!(!this.pending.delete(t)||this.pending.size)){for(;!this.pending.size&&this.callbacks.length;)this.callbacks.shift()();for(;!this.pending.size&&this.associations.length;)this.associations.shift()()}}}),z(this,`checkSession`,()=>{if(!(this.checking||this.pending.size)){this.checking=!0;try{var e;(e=this.check)==null||e.call(this)}finally{this.checking=!1}}}),z(this,`isPending`,e=>[...this.pending].some(t=>e===void 0||e>=t.at)),z(this,`registerCheck`,e=>(this.check=e,()=>{this.check===e&&(this.check=void 0)})),z(this,`reset`,()=>{this.pending.clear(),this.callbacks.length=0,this.associations.length=0}),z(this,`whenReady`,(e,t=!1)=>{if(!this.pending.size){e();return}let n=t?this.associations:this.callbacks;n.length>=this.capacity&&n.shift(),n.push(e)}),this.capacity=e}},vd=e=>({url:e.endpoint,headers:e.headers,concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis}),yd=`bk-rum`,bd=class{constructor(e){this.isSampled=e}shouldSample(e,t,n,r,i){return{decision:this.isSampled(i)?wa.RECORD_AND_SAMPLED:wa.NOT_RECORD}}toString(){return`RumSessionSampler`}},xd,Sd=()=>{if(xd)xd.users+=1;else{let e=new $e().enable(),t=Ie.setGlobalContextManager(e);t||e.disable(),xd={contextManager:t?e:void 0,ownsContext:t,ownsPropagator:Ge.setGlobalPropagator(new kr),users:1}}let e=!1;return()=>{e||!xd||(e=!0,--xd.users,!(xd.users>0)&&(xd.ownsContext&&Ie.disable(),xd.ownsPropagator&&Ge.disable(),xd=void 0))}},Cd=(e,t)=>t?new Proxy(e,{get(e,t,n){if(t===`export`)return(t,n)=>{var r;return(r=globalThis.console)==null||r.log(`[bk-ot][rum]`,t),e.export(t,n)};let r=Reflect.get(e,t,n);return typeof r==`function`?r.bind(e):r}}):e,wd=e=>[ll(e.tracking.request)],Td=e=>[Tu(e.session),...Od(e.tracking.device,!0,Tl),ms(),ou(),Bc(Ed(e.tracking.resource,!0))],Ed=(e,t)=>e===void 0?t:e!==!1,Dd=e=>typeof e==`object`&&e?e:void 0,Od=(e,t,n)=>Ed(e,t)?[n(Dd(e))]:[],kd=e=>[...Od(e.error,!0,Ol),...Od(e.webVitals,!0,Ju),...Od(e.blankScreen,!0,As),...Od(e.action,!0,fs),...Od(e.websocket,!1,Zu),...Od(e.longTask,!1,Pl),...Od(e.cspViolation,!1,fl)],Ad=class{assertBeforeStart(e){if(this.phase!==`idle`)throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`)}createPluginContext(){return{applyRedact:this.applyRedact,beginSessionTransition:this.beginSessionTransition,registerSessionCheck:this.registerSessionCheck,isSessionTransitionPending:this.isSessionTransitionPending,afterSessionTransition:this.afterSessionTransition,config:this.config,registerActionContext:this.runtimeContext.registerActionContext,endActionContext:this.runtimeContext.endActionContext,flush:this.flush,getRuntimeAttributes:this.getRuntimeAttributes,getRuntimeAttributesAt:this.getRuntimeAttributesAt,getRuntimeContextAtRelativeTime:e=>(this.sessionTransition.checkSession(),this.runtimeContext.getRuntimeContextAtRelativeTime(e)),getViewHistory:this.runtimeContext.getViewHistory,isSampled:this.isSampled,isSessionActive:this.isSessionActive,isViewActive:this.isViewActive,notifySessionLifecycle:this.notifySessionLifecycle,notifyActivity:this.activityObserver.notify,onActivity:this.activityObserver.subscribe,onSessionLifecycle:this.onSessionLifecycle,onViewCommand:this.runtimeContext.onViewCommand,onViewChange:this.runtimeContext.onViewChange,registerInstrumentations:this.registerInstrumentations,setRuntimeAttributes:this.setRuntimeAttributes,setUser:this.setUser,setView:this.runtimeContext.setView,startSpan:this.startSpan,tracer:this.tracer}}createPluginManager(){var e;return new md([...Td(this.config),...wd(this.config),...kd(this.config.tracking),...(e=this.config.extensions.plugins)==null?[]:e])}constructor(e){var t=this,n,r;z(this,`activityObserver`,new Qu),z(this,`allowInitialResourceHistory`,void 0),z(this,`collectAttributesAt`,(e,t)=>{this.sessionTransition.checkSession();let n=t?this.runtimeContext.getAttributesAt(e):this.runtimeContext.getAttributes();if(!this.sessionTransition.isPending(e))return n;for(let e of Object.keys(n))(e.startsWith(`session.`)||e.startsWith(`view.`)||e===J.actionId||e===J.actionIds)&&delete n[e];return this.sessionTransition.whenReady(()=>{let t=this.runtimeContext.getAttributesAt(e);for(let[e,r]of Object.entries(t))(e.startsWith(`session.`)||e.startsWith(`view.`)||e===J.actionId||e===J.actionIds)&&(n[e]=r)},!0),n}),z(this,`collectionStopping`,void 0),z(this,`flushProviders`,G(function*(){yield t.tracerProvider.forceFlush()})),z(this,`hasStartedCollection`,!1),z(this,`isStopped`,()=>this.phase===`stopped`),z(this,`latestManualViewOptions`,void 0),z(this,`phase`,`idle`),z(this,`pluginManager`,void 0),z(this,`registeredInstrumentations`,void 0),z(this,`releaseOtelGlobals`,void 0),z(this,`runtimeContext`,void 0),z(this,`sampled`,!1),z(this,`sessionTransition`,void 0),z(this,`shutdownTask`,void 0),z(this,`startCollection`,G(function*(){if(yield t.collectionStopping,t.isStopped()||t.pluginManager||!t.config.enabled||t.config.trackingConsent!==`granted`)return;if(typeof window<`u`){if(!t.tabId){t.tabId=q(`tab`);try{let e=window.sessionStorage.getItem(`bk_ot_tab_id`);e?t.tabId=e:window.sessionStorage.setItem(`bk_ot_tab_id`,t.tabId)}catch(e){}}t.runtimeContext.setAttributes({[J.tabId]:t.tabId})}t.releaseOtelGlobals=Sd();let e=t.createPluginManager();t.pluginManager=e,t.config.view.tracking===`manual`&&t.latestManualViewOptions&&t.runtimeContext.dispatchViewCommand({type:`start`,options:t.latestManualViewOptions,startedAt:t.hasStartedCollection?Date.now():void 0,relativeStartedAt:t.hasStartedCollection&&typeof performance<`u`?performance.now():void 0});let n={allowInitialResourceHistory:t.allowInitialResourceHistory&&!t.hasStartedCollection,isInitialDocument:!t.hasStartedCollection,startedAt:Date.now(),relativeStartedAt:typeof performance<`u`?performance.now():0};t.hasStartedCollection=!0;try{var r;if(yield e.start(K(K({},t.createPluginContext()),{},{collectionStart:n})),t.isStopped()||t.pluginManager!==e||t.config.trackingConsent!==`granted`)return;t.registerInstrumentations((r=t.config.extensions.instrumentations)==null?[]:r)}catch(n){throw t.pluginManager===e?yield t.stopCollection(!1):yield e.shutdown(),n}})),z(this,`stopCollection`,function(){var e=G(function*(e){if(t.collectionStopping)return t.collectionStopping;let n=t.pluginManager;t.pluginManager=void 0,t.sessionTransition.reset();let r=t.registeredInstrumentations.splice(0),i=t.releaseOtelGlobals;t.releaseOtelGlobals=void 0,t.setRuntimeAttributes({[J.sessionHasReplay]:void 0,[J.sessionId]:void 0});let a=G(function*(){try{yield n==null?void 0:n.shutdown(),e&&(yield t.flushProviders())}finally{for(var a,o;r.length;)(a=r.pop())==null||(o=a.disable)==null||o.call(a);i==null||i()}})();t.collectionStopping=a;try{yield a}finally{t.collectionStopping===a&&(t.collectionStopping=void 0)}});return function(t){return e.apply(this,arguments)}}()),z(this,`tabId`,void 0),z(this,`teardownCallbacks`,[]),z(this,`tracerProvider`,void 0),z(this,`addTiming`,(e,t)=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({name:e,elapsed:t,time:Date.now(),type:`add_timing`})}),z(this,`afterSessionTransition`,(e,t=!1)=>this.sessionTransition.whenReady(e,t)),z(this,`applyRedact`,e=>this.config.hooks.redactAttributes(e)),z(this,`beginSessionTransition`,e=>this.sessionTransition.begin(e)),z(this,`config`,void 0),z(this,`flush`,G(function*(){var e;yield(e=t.pluginManager)==null?void 0:e.flush(),yield t.flushProviders()})),z(this,`getRuntimeAttributes`,()=>this.collectAttributesAt(Date.now(),!1)),z(this,`getRuntimeAttributesAt`,e=>this.collectAttributesAt(e,!0)),z(this,`getViewContext`,()=>K({},this.runtimeContext.getView().attributes)),z(this,`isSampled`,()=>(this.sessionTransition.checkSession(),this.config.trackingConsent===`granted`&&this.config.enabled&&(this.sampled||this.sessionTransition.isPending()))),z(this,`isSessionActive`,()=>(this.sessionTransition.checkSession(),this.runtimeContext.isSessionActive())),z(this,`isSessionTransitionPending`,()=>this.sessionTransition.isPending()),z(this,`isViewActive`,()=>this.runtimeContext.isViewActive()),z(this,`notifySessionLifecycle`,e=>{this.runtimeContext.notifySessionLifecycle(e)}),z(this,`onSessionLifecycle`,e=>this.runtimeContext.onSessionLifecycle(e)),z(this,`registerInstrumentations`,e=>{e.length&&(e.forEach(e=>{e.setTracerProvider(this.tracerProvider),e.getConfig().enabled||e.enable()}),this.registeredInstrumentations.push(...e))}),z(this,`registerSessionCheck`,e=>this.sessionTransition.registerCheck(e)),z(this,`reportAction`,({attributes:e={},name:t})=>{if(!this.isSampled())return;let n=q(`action`),r=Date.now(),i=K(K(K(K({},this.config.hooks.getPageAttributes()),e),es({spanType:X.action})),{},{[J.actionId]:n,[J.actionName]:t,[J.actionType]:`custom`});this.startSpan(Q({attributes:i,spanType:X.action}),i,{rumSpanType:X.action,startTime:r}).end(r)}),z(this,`reportCustomEvent`,({attributes:e={},error:t,name:n})=>{if(!this.isSampled()){if(this.config.debug){var r;(r=globalThis.console)==null||r.warn(`[bk-ot] custom event dropped (not sampled):`,n)}return}let i=Date.now(),a=K(K(K(K({},this.config.hooks.getPageAttributes()),this.config.hooks.getCustomAttributes()),e),es({outcome:t?Y.error:Y.success,spanType:X.custom})),o=this.startSpan(Q({attributes:a,nameHint:n,spanType:X.custom}),a,{startTime:i});t&&(o.recordException(t),o.setStatus({code:Fe.ERROR,message:t.message})),o.end(i)}),z(this,`setRuntimeAttributes`,(e,t)=>{let n=K({},e),r=t==null?Date.now():t;if(J.sessionId in e){let t=e[J.sessionId];this.sampled=this.config.enabled&&typeof t==`string`&&t.length>0?gd(this.config,t):!1,this.runtimeContext.setSessionSampled(this.sampled,r)}this.runtimeContext.setAttributes(n,r)}),z(this,`setTrackingConsent`,function(){var e=G(function*(e){e===`not-granted`&&(t.allowInitialResourceHistory=!1),t.config.trackingConsent!==e&&(t.config.trackingConsent=e,!(t.phase!==`started`&&t.phase!==`starting`)&&(e===`granted`?yield t.startCollection():yield t.stopCollection(!0)))});return function(t){return e.apply(this,arguments)}}()),z(this,`setUser`,e=>{this.runtimeContext.setUser(e)}),z(this,`setViewContext`,e=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({attributes:K({},e),type:`set_context`})}),z(this,`setViewContextProperty`,(e,t)=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({key:e,value:t,type:`set_context_property`})}),z(this,`setViewLoadingTime`,()=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({time:Date.now(),type:`set_loading_time`})}),z(this,`setViewName`,e=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({name:e,type:`set_name`})}),z(this,`shutdown`,G(function*(){return t.shutdownTask?t.shutdownTask:(t.phase=`stopped`,t.shutdownTask=G(function*(){var e;for(yield t.stopCollection(!1),yield t.flushProviders();t.teardownCallbacks.length;)(e=t.teardownCallbacks.pop())==null||e();yield t.tracerProvider.shutdown()})(),t.shutdownTask)})),z(this,`start`,G(function*(){if(!(t.phase===`started`||t.phase===`starting`)){if(t.phase===`stopped`)throw Error(`[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.`);if(!t.config.enabled){t.phase=`started`;return}t.phase=`starting`;try{if(yield t.startCollection(),t.phase!==`starting`)return;if(typeof window<`u`&&typeof document<`u`){let e=()=>{t.flush()},n=()=>{document.visibilityState===`hidden`&&t.flush()};window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,n),document.addEventListener(`freeze`,e),t.teardownCallbacks.push(()=>window.removeEventListener(`pagehide`,e),()=>document.removeEventListener(`visibilitychange`,n),()=>document.removeEventListener(`freeze`,e))}}catch(n){for(;t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}throw yield t.stopCollection(!1),t.phase===`starting`&&(t.phase=`idle`),n}t.phase===`starting`&&(t.phase=`started`)}})),z(this,`startSpan`,(e,t={},n)=>{var r,i,a,o;let s=(r=n==null?void 0:n.contextTime)==null?typeof(n==null?void 0:n.startTime)==`number`?n.startTime:void 0:r,c=(i=n==null?void 0:n.contextAttributes)==null?s===void 0?this.getRuntimeAttributes():this.getRuntimeAttributesAt(s):i,l=Js(this.applyRedact(K(K({},c),t)));if(l[J.spanType]===X.session)for(let e of Object.keys(l))(e.startsWith(`view.`)||e===J.actionId||e===J.actionIds)&&delete l[e];if(typeof l[J.sessionId]!=`string`&&!this.sessionTransition.isPending(s==null?Date.now():s))return qe.wrapSpanContext(de);let u=n!=null&&n.rumSpanType?Q({attributes:l,spanType:n.rumSpanType}):e,d=Ie.active();return(n==null?void 0:n.contextTime)!==void 0&&(d=d.setValue(Fs,n.contextTime)),(n==null?void 0:n.contextAttributes)!==void 0&&(d=d.setValue(Is,!0)),this.tracer.startSpan(u,{kind:(a=n==null?void 0:n.kind)==null?Pe.INTERNAL:a,links:n==null||(o=n.links)==null?void 0:o.map(e=>K(K({},e),{},{context:K({},e.context),attributes:this.applyRedact($(e.attributes))})),startTime:n==null?void 0:n.startTime,attributes:l},d)}),z(this,`startView`,(e={})=>{if(this.phase===`stopped`)return;let t=K(K({},e),{},{attributes:$(e.attributes)});this.config.view.tracking===`manual`&&(this.latestManualViewOptions=t),this.runtimeContext.dispatchViewCommand({options:t,type:`start`})}),z(this,`tracer`,void 0),z(this,`use`,e=>{var t;return this.assertBeforeStart(`use`),(t=this.config.extensions.plugins)==null||t.push(e),this}),z(this,`useInstrumentation`,e=>{var t;return this.assertBeforeStart(`useInstrumentation`),this.config.enabled&&((t=this.config.extensions.instrumentations)==null||t.push(e)),this}),this.config=fd(e),this.allowInitialResourceHistory=this.config.trackingConsent===`granted`,this.sessionTransition=new _d((n=(r=this.config.spanBatch)==null?void 0:r.maxQueueSize)==null?2048:n),this.runtimeContext=new Ps({},this.config.user);let i=wi(this.config.resourceAttributes),a=(()=>{let e=Cd(new xa(vd(this.config.transport)),this.config.debug);return[new Zs(this.config.spanProcessor===`simple`?new ao(e):new Ra(e,this.config.spanBatch),this.config,()=>this.applyRedact(K(K({},this.runtimeContext.getAttributes()),this.config.hooks.getPageAttributes())),{checkSession:this.sessionTransition.checkSession,isPending:this.sessionTransition.isPending,whenReady:e=>this.sessionTransition.whenReady(e,!0),getAttributesAt:e=>this.applyRedact(this.runtimeContext.getAttributesAt(e)),isSampled:e=>this.config.trackingConsent===`granted`&&this.config.enabled&&typeof e[J.sessionId]==`string`&&gd(this.config,e[J.sessionId])},this.activityObserver.notify)]})();this.tracerProvider=new lo({resource:i,sampler:new bd(e=>{if(this.sessionTransition.checkSession(),!this.config.enabled||this.config.trackingConsent!==`granted`)return!1;let t=e[J.sessionId];return typeof t==`string`?gd(this.config,t):this.isSampled()}),spanProcessors:a}),this.tracer=this.tracerProvider.getTracer(yd),this.registeredInstrumentations=[],this.config.autoStart&&this.start().catch(e=>{var t;(t=globalThis.console)==null||t.warn(`[bk-ot] auto start failed:`,e)})}};return typeof window<`u`&&Object.assign(window,{BkOpenTelemetry:Ad}),Ad})();