@blueking/open-telemetry 0.0.14 → 0.0.15
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.
- package/README.md +170 -554
- package/dist/bk-rum.global.js +9 -9
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/core/action-activity.d.ts +28 -0
- package/dist/core/config.d.ts +113 -93
- package/dist/core/page-activity.d.ts +14 -0
- package/dist/core/plugin.d.ts +23 -6
- package/dist/core/processor.d.ts +25 -4
- package/dist/core/request-timing.d.ts +5 -0
- package/dist/core/runtime-context.d.ts +51 -3
- package/dist/core/sampling.d.ts +5 -1
- package/dist/core/sdk.d.ts +29 -10
- package/dist/core/url.d.ts +4 -1
- package/dist/index.d.ts +12 -14
- package/dist/index.js +2184 -1175
- package/dist/index.js.map +1 -1
- package/dist/plugins/action.d.ts +6 -2
- package/dist/plugins/activity.d.ts +6 -0
- package/dist/plugins/blank-screen.d.ts +17 -0
- package/dist/plugins/common.d.ts +11 -3
- package/dist/plugins/device.d.ts +2 -0
- package/dist/plugins/long-task.d.ts +3 -12
- package/dist/plugins/page-view.d.ts +1 -0
- package/dist/plugins/request-body.d.ts +14 -0
- package/dist/plugins/resource.d.ts +17 -1
- package/dist/plugins/session-state.d.ts +18 -0
- package/dist/plugins/session.d.ts +4 -4
- package/dist/plugins/web-vitals.d.ts +74 -0
- package/dist/schema/attributes.d.ts +31 -10
- package/dist/schema/span.d.ts +4 -12
- package/package.json +3 -7
- package/skills/bk-rum-otele/SKILL.md +34 -33
- package/skills/bk-rum-otele/evals/evals.json +1 -1
- package/skills/bk-rum-otele/references/api.md +45 -13
- package/skills/bk-rum-otele/references/concepts.md +38 -112
- package/skills/bk-rum-otele/references/configuration.md +135 -230
- package/skills/bk-rum-otele/references/custom-plugin.md +8 -5
- package/skills/bk-rum-otele/references/data-model.md +13 -8
- package/skills/bk-rum-otele/references/framework-integration.md +25 -17
- package/skills/bk-rum-otele/references/getting-started.md +27 -87
- package/skills/bk-rum-otele/references/plugins.md +165 -99
- package/skills/bk-rum-otele/references/privacy.md +42 -33
- package/skills/bk-rum-otele/references/telemetry-reference.md +73 -44
- package/skills/bk-rum-otele/references/troubleshooting.md +71 -37
- package/dist/plugins/http-body.d.ts +0 -3
- package/dist/plugins/route-timing.d.ts +0 -2
package/dist/bk-rum.global.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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,i=t((()=>{r=`1.9.1`}));function a(e){let t=new Set([e]),n=new Set,r=e.match(o);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function 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(o);if(!r)return a(e);let c={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return c.prerelease!=null||i.major!==c.major?a(e):i.major===0?i.minor===c.minor&&i.patch<=c.patch?s(e):a(e):i.minor<=c.minor?s(e):a(e)}}var o,s,c=t((()=>{i(),o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,s=a(r)}));function l(e,t,n,i=!1){var a;let o=m[p]=(a=m[p])==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 u(e){var t,n;let r=(t=m[p])==null?void 0:t.version;if(!(!r||!s(r)))return(n=m[p])==null?void 0:n[e]}function d(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${r}.`);let n=m[p];n&&delete n[e]}var f,p,m,h=t((()=>{i(),c(),f=r.split(`.`)[0],p=Symbol.for(`opentelemetry.js.api.${f}`),m=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function g(e,t,n){let r=u(`diag`);if(r)return r[e](t,...n)}var _,v=t((()=>{h(),_=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return g(`debug`,this._namespace,e)}error(...e){return g(`error`,this._namespace,e)}info(...e){return g(`info`,this._namespace,e)}warn(...e){return g(`warn`,this._namespace,e)}verbose(...e){return g(`verbose`,this._namespace,e)}}})),y,b=t((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(y||(y={}))}));function x(e,t){e<y.NONE?e=y.NONE:e>y.ALL&&(e=y.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,y.ERROR),warn:n(`warn`,y.WARN),info:n(`info`,y.INFO),debug:n(`debug`,y.DEBUG),verbose:n(`verbose`,y.VERBOSE)}}var S=t((()=>{b()})),ee,C,te=t((()=>{v(),S(),b(),h(),ee=`diag`,C=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=u(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:y.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=u(`diag`),s=x((i=n.logLevel)==null?y.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return l(`diag`,s,t,!0)},t.disable=()=>{d(ee,t)},t.createComponentLogger=e=>new _(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),w,ne=t((()=>{w=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}})),re,ie=t((()=>{re=Symbol(`BaggageEntryMetadata`)}));function T(e={}){return new w(new Map(Object.entries(e)))}function E(e){return typeof e!=`string`&&(ae.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:re,toString(){return e}}}var ae,D=t((()=>{te(),ne(),ie(),ae=C.instance()}));function oe(e){return Symbol.for(e)}var se,O,ce=t((()=>{se=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},O=new se}));function le(){return be}var ue,de,fe,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe=t((()=>{ue=class{constructor(){}createGauge(e,t){return Se}createHistogram(e,t){return Ce}createCounter(e,t){return xe}createUpDownCounter(e,t){return we}createObservableGauge(e,t){return Ee}createObservableCounter(e,t){return Te}createObservableUpDownCounter(e,t){return De}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},de=class{},fe=class extends de{add(e,t){}},pe=class extends de{add(e,t){}},me=class extends de{record(e,t){}},he=class extends de{record(e,t){}},ge=class{addCallback(e){}removeCallback(e){}},_e=class extends ge{},ve=class extends ge{},ye=class extends ge{},be=new ue,xe=new fe,Se=new me,Ce=new he,we=new pe,Te=new _e,Ee=new ve,De=new ye})),ke,Ae=t((()=>{(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(ke||(ke={}))})),je,Me,Ne=t((()=>{je={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},Me={set(e,t,n){e!=null&&(e[t]=n)}}})),Pe,Fe=t((()=>{ce(),Pe=class{active(){return O}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Ie,Le,Re,ze=t((()=>{Fe(),h(),te(),Ie=`context`,Le=new Pe,Re=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return l(Ie,e,C.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return u(Ie)||Le}disable(){this._getContextManager().disable(),d(Ie,C.instance())}}})),k,Be=t((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(k||(k={}))})),Ve,He,Ue,We=t((()=>{Be(),Ve=`0000000000000000`,He=`00000000000000000000000000000000`,Ue={traceId:He,spanId:Ve,traceFlags:k.NONE}})),Ge,Ke=t((()=>{We(),Ge=class{constructor(e=Ue){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function qe(e){return e.getValue($e)||void 0}function Je(){return qe(Re.getInstance().active())}function Ye(e,t){return e.setValue($e,t)}function Xe(e){return e.deleteValue($e)}function Ze(e,t){return Ye(e,new Ge(t))}function Qe(e){var t;return(t=qe(e))==null?void 0:t.spanContext()}var $e,et=t((()=>{ce(),Ke(),ze(),$e=oe(`OpenTelemetry Context Key SPAN`)}));function tt(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(ot[e.charCodeAt(t)]|0)+(ot[e.charCodeAt(t+1)]|0)+(ot[e.charCodeAt(t+2)]|0)+(ot[e.charCodeAt(t+3)]|0);return n===t}function nt(e){return tt(e,32)&&e!==`00000000000000000000000000000000`}function rt(e){return tt(e,16)&&e!==`0000000000000000`}function it(e){return nt(e.traceId)&&rt(e.spanId)}function at(e){return new Ge(e)}var ot,st=t((()=>{We(),Ke(),ot=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 ct(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 lt,ut,dt=t((()=>{ze(),et(),Ke(),st(),lt=Re.getInstance(),ut=class{startSpan(e,t,n=lt.active()){if(t!=null&&t.root)return new Ge;let r=n&&Qe(n);return ct(r)&&it(r)?new Ge(r):new Ge}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?lt.active():a,c=this.startSpan(e,i,s),l=Ye(s,c);return lt.with(l,o,void 0,c)}}})),ft,pt,mt=t((()=>{dt(),ft=new ut,pt=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):ft}}})),ht,gt=t((()=>{dt(),ht=class{getTracer(e,t,n){return new ut}}})),_t,vt,yt=t((()=>{mt(),gt(),_t=new ht,vt=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new pt(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?_t:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),bt,xt=t((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(bt||(bt={}))})),St,Ct=t((()=>{(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`})(St||(St={}))})),wt,Tt=t((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(wt||(wt={}))})),A,Et=t((()=>{ze(),A=Re.getInstance()})),j,Dt=t((()=>{te(),j=C.instance()})),Ot,kt,At=t((()=>{Oe(),Ot=class{getMeter(e,t,n){return be}},kt=new Ot})),jt,Mt,Nt=t((()=>{At(),h(),te(),jt=`metrics`,Mt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return l(jt,e,C.instance())}getMeterProvider(){return u(jt)||kt}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){d(jt,C.instance())}}})),Pt,Ft=t((()=>{Nt(),Pt=Mt.getInstance()})),It,Lt=t((()=>{It=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function Rt(e){return e.getValue(Ht)||void 0}function zt(){return Rt(Re.getInstance().active())}function Bt(e,t){return e.setValue(Ht,t)}function Vt(e){return e.deleteValue(Ht)}var Ht,Ut=t((()=>{ze(),ce(),Ht=oe(`OpenTelemetry Baggage Key`)})),Wt,Gt,Kt,qt=t((()=>{h(),Lt(),Ne(),Ut(),D(),te(),Wt=`propagation`,Gt=new It,Kt=class e{constructor(){this.createBaggage=T,this.getBaggage=Rt,this.getActiveBaggage=zt,this.setBaggage=Bt,this.deleteBaggage=Vt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return l(Wt,e,C.instance())}inject(e,t,n=Me){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=je){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){d(Wt,C.instance())}_getGlobalPropagator(){return u(Wt)||Gt}}})),Jt,Yt=t((()=>{qt(),Jt=Kt.getInstance()})),Xt,Zt,Qt=t((()=>{h(),yt(),st(),et(),te(),Xt=`trace`,Zt=class e{constructor(){this._proxyTracerProvider=new vt,this.wrapSpanContext=at,this.isSpanContextValid=it,this.deleteSpan=Xe,this.getSpan=qe,this.getActiveSpan=Je,this.getSpanContext=Qe,this.setSpan=Ye,this.setSpanContext=Ze}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=l(Xt,this._proxyTracerProvider,C.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return u(Xt)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){d(Xt,C.instance()),this._proxyTracerProvider=new vt}}})),M,$t=t((()=>{Qt(),M=Zt.getInstance()})),N=t((()=>{D(),ce(),b(),Oe(),Ae(),Ne(),mt(),yt(),xt(),Ct(),Tt(),Be(),st(),We(),Et(),Dt(),Ft(),Yt(),$t()})),en,tn=t((()=>{(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(en||(en={}))})),nn,rn,an=t((()=>{nn=class{emit(e){}enabled(){return!1}},rn=new nn}));function on(e,t,n){return r=>r===e?t:n}var sn,cn,ln=t((()=>{sn=Symbol.for(`io.opentelemetry.js.api.logs`),cn=globalThis})),un,dn,fn=t((()=>{an(),un=class{getLogger(e,t,n){return new nn}},dn=new un})),pn,mn=t((()=>{an(),pn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):rn}}})),hn,gn=t((()=>{fn(),mn(),hn=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new pn(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?dn:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),_n,vn=t((()=>{ln(),fn(),gn(),_n=class e{constructor(){this._proxyLoggerProvider=new hn}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return cn[sn]?this.getLoggerProvider():(cn[sn]=on(1,e,dn),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=cn[sn])==null?void 0:e.call(cn,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete cn[sn],this._proxyLoggerProvider=new hn}}})),yn,bn=t((()=>{tn(),an(),vn(),yn=_n.getInstance()}));function xn(e){return typeof e==`object`&&!!e&&`addEventListener`in e&&typeof e.addEventListener==`function`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`}function Sn(e){"@babel/helpers - typeof";return Sn=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},Sn(e)}var Cn=t((()=>{}));function wn(e,t){if(Sn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Sn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Tn=t((()=>{Cn()}));function En(e){var t=wn(e,`string`);return Sn(t)==`symbol`?t:t+``}var Dn=t((()=>{Cn(),Tn()}));function P(e,t,n){return(t=En(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=t((()=>{Dn()}));N(),F();var On=`OT_ZONE_CONTEXT`,kn=class{constructor(){P(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:{[On]: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?O:Zone.current.get(On)||O}bind(e,t){return typeof t==`function`?this._bindFunction(e,t):(xn(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)}};bn();var An=Object.defineProperty,jn=Object.defineProperties,Mn=Object.getOwnPropertyDescriptors,Nn=Object.getOwnPropertySymbols,Pn=Object.prototype.hasOwnProperty,Fn=Object.prototype.propertyIsEnumerable,In=(e,t,n)=>t in e?An(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ln=(e,t)=>{for(var n in t||(t={}))Pn.call(t,n)&&In(e,n,t[n]);if(Nn)for(var n of Nn(t))Fn.call(t,n)&&In(e,n,t[n]);return e},Rn=(e,t)=>jn(e,Mn(t)),I=(e,t,n)=>(In(e,typeof t==`symbol`?t:t+``,n),n),zn=globalThis;function Bn(e){return(zn.__Zone_symbol_prefix||`__zone_symbol__`)+e}function Vn(){let e=zn.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){I(this,`_parent`),I(this,`_name`),I(this,`_properties`),I(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(zn.Promise!==re.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 T.zone}static get currentTask(){return E}static __load_patch(r,i,a=!1){if(re.hasOwnProperty(r)){let e=zn[Bn(`forceDuplicateZoneCheck`)]===!0;if(!a&&e)throw Error(`Already loaded patch: `+r)}else if(!zn[`__Zone_disable_`+r]){let a=`Zone:`+r;t(a),re[r]=i(zn,e,ie),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){T={parent:T,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{T=T.parent}}runGuarded(e,t=null,n,r){T={parent:T,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{T=T.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===ne||i===w))return;let s=e.state!=S;s&&r._transitionTo(S,x);let c=E;E=r,T={parent:T,zone:this};try{i==w&&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!==C)if(i==ne||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)}T=T.parent,E=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(C,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(te,e,t,n,r,void 0))}scheduleMacroTask(e,t,n,r,i){return this.scheduleTask(new s(w,e,t,n,r,i))}scheduleEventTask(e,t,n,r,i){return this.scheduleTask(new s(ne,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(ee,x,S);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(C,ee),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,ee),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)}};I(r,`__symbol__`,Bn);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){I(this,`_zone`),I(this,`_taskCounts`,{microTask:0,macroTask:0,eventTask:0}),I(this,`_forkDlgt`),I(this,`_forkZS`),I(this,`_forkCurrZone`),I(this,`_interceptDlgt`),I(this,`_interceptZS`),I(this,`_interceptCurrZone`),I(this,`_invokeDlgt`),I(this,`_invokeZS`),I(this,`_invokeCurrZone`),I(this,`_handleErrorDlgt`),I(this,`_handleErrorZS`),I(this,`_handleErrorCurrZone`),I(this,`_scheduleTaskDlgt`),I(this,`_scheduleTaskZS`),I(this,`_scheduleTaskCurrZone`),I(this,`_invokeTaskDlgt`),I(this,`_invokeTaskZS`),I(this,`_invokeTaskCurrZone`),I(this,`_cancelTaskDlgt`),I(this,`_cancelTaskZS`),I(this,`_cancelTaskCurrZone`),I(this,`_hasTaskDlgt`),I(this,`_hasTaskDlgtOwner`),I(this,`_hasTaskZS`),I(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==te)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(I(this,`type`),I(this,`source`),I(this,`invoke`),I(this,`callback`),I(this,`data`),I(this,`scheduleFn`),I(this,`cancelFn`),I(this,`_zone`,null),I(this,`runCount`,0),I(this,`_zoneDelegates`,null),I(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===ne&&r&&r.useG?this.invoke=s.invokeTask:this.invoke=function(){return s.invokeTask.call(zn,o,this,arguments)}}static invokeTask(e,t,n){e||(e=this),ae++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{ae===1&&!zn[d]&&_(),ae--}}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=Bn(`setTimeout`),l=Bn(`Promise`),u=Bn(`then`),d=Bn(`enable_native_microtask_draining`),f=[],p=!1,m;function h(e){var t;!m&&zn[l]&&(m=zn[l].resolve(0)),m?((t=m[u])==null?m.then:t).call(m,e):zn[c](e,0)}function g(e){let t=zn[d],n=t&&f.length===0&&!p,r=!t&&ae===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){ie.onUnhandledError(e)}}zn[d]?(p=!1,ie.microtaskDrainDone()):(ie.microtaskDrainDone(),p=!1)}}let v={name:`NO ZONE`},y=`notScheduled`,b=`scheduling`,x=`scheduled`,S=`running`,ee=`canceling`,C=`unknown`,te=`microTask`,w=`macroTask`,ne=`eventTask`,re={},ie={symbol:Bn,currentZoneFrame:()=>T,onUnhandledError:D,microtaskDrainDone:D,scheduleMicroTask:g,showUncaughtError:()=>!i[Bn(`ignoreConsoleErrorUncaughtError`)],patchEventTarget:()=>[],patchOnProperties:D,patchMethod:()=>D,bindArguments:()=>[],patchThen:()=>D,patchMacroTask:()=>D,patchEventPrototype:()=>D,getGlobalObjects:()=>void 0,ObjectDefineProperty:()=>D,ObjectGetOwnPropertyDescriptor:()=>void 0,ObjectCreate:()=>void 0,ArraySlice:()=>[],patchClass:()=>D,wrapWithCurrentZone:()=>D,filterProperties:()=>[],attachOriginToPatched:()=>D,_redefineProperty:()=>D,patchCallbacks:()=>D,nativeScheduleMicroTask:h},T={parent:null,zone:new i(null,null)},E=null,ae=0;function D(){}return n(`Zone`,`Zone`),i}function Hn(){let e=globalThis,t=e[Bn(`forceDuplicateZoneCheck`)]===!0;if(e.Zone&&(t||typeof e.Zone.__symbol__!=`function`))throw Error(`Zone already loaded.`);return e.Zone!=null||(e.Zone=Vn()),e.Zone}var Un=Object.getOwnPropertyDescriptor,Wn=Object.defineProperty,Gn=Object.getPrototypeOf,Kn=Object.create,qn=Array.prototype.slice,Jn=`addEventListener`,Yn=`removeEventListener`,Xn=Bn(Jn),Zn=Bn(Yn),Qn=`true`,$n=`false`,er=Bn(``);function tr(e,t){return Zone.current.wrap(e,t)}function nr(e,t,n,r,i){return Zone.current.scheduleMacroTask(e,t,n,r,i)}var L=Bn,rr=typeof window<`u`,ir=rr?window:void 0,R=rr&&ir||globalThis,ar=`removeAttribute`;function or(e,t){for(let n=e.length-1;n>=0;n--)typeof e[n]==`function`&&(e[n]=tr(e[n],t+`_`+n));return e}function sr(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(!cr(Un(e,i)))continue;e[i]=(e=>{let t=function(){return e.apply(this,or(arguments,n+`.`+i))};return wr(t,e),t})(a)}}}function cr(e){return e?e.writable===!1?!1:!(typeof e.get==`function`&&e.set===void 0):!0}var lr=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,ur=!(`nw`in R)&&R.process!==void 0&&R.process.toString()===`[object process]`,dr=!ur&&!lr&&!!(rr&&ir.HTMLElement),fr=R.process!==void 0&&R.process.toString()===`[object process]`&&!lr&&!!(rr&&ir.HTMLElement),pr={},mr=L(`enable_beforeunload`),hr=function(e){if(e=e||R.event,!e)return;let t=pr[e.type];t||(t=pr[e.type]=L(`ON_PROPERTY`+e.type));let n=this||e.target||R,r=n[t],i;if(dr&&n===ir&&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`&&R[mr]&&typeof i==`string`?e.returnValue=i:i!=null&&!i&&e.preventDefault();return i};function gr(e,t,n){let r=Un(e,t);if(!r&&n&&Un(n,t)&&(r={enumerable:!0,configurable:!0}),!r||!r.configurable)return;let i=L(`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=pr[s];c||(c=pr[s]=L(`ON_PROPERTY`+s)),r.set=function(t){let n=this;!n&&e===R&&(n=R),n&&(typeof n[c]==`function`&&n.removeEventListener(s,hr),o==null||o.call(n,null),n[c]=t,typeof t==`function`&&n.addEventListener(s,hr,!1))},r.get=function(){let n=this;if(!n&&e===R&&(n=R),!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[ar]==`function`&&n.removeAttribute(t),e}return null},Wn(e,t,r),e[i]=!0}function _r(e,t,n){if(t)for(let r=0;r<t.length;r++)gr(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++)gr(e,t[r],n)}}var vr=L(`originalInstance`);function yr(e){let t=R[e];if(!t)return;R[L(e)]=t,R[e]=function(){let n=or(arguments,e);switch(n.length){case 0:this[vr]=new t;break;case 1:this[vr]=new t(n[0]);break;case 2:this[vr]=new t(n[0],n[1]);break;case 3:this[vr]=new t(n[0],n[1],n[2]);break;case 4:this[vr]=new t(n[0],n[1],n[2],n[3]);break;default:throw Error(`Arg list too long.`)}},wr(R[e],t);let n=new t(function(){}),r;for(r in n)e===`XMLHttpRequest`&&r===`responseBlob`||(function(t){typeof n[t]==`function`?R[e].prototype[t]=function(){return this[vr][t].apply(this[vr],arguments)}:Wn(R[e].prototype,t,{set:function(n){typeof n==`function`?(this[vr][t]=tr(n,e+`.`+t),wr(this[vr][t],n)):this[vr][t]=n},get:function(){return this[vr][t]}})})(r);for(r in t)r!==`prototype`&&t.hasOwnProperty(r)&&(R[e][r]=t[r])}function br(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 xr=!1;function Sr(e,t,n){let r=e;for(;r&&!r.hasOwnProperty(t);)r=Gn(r);!r&&e[t]&&(r=e);let i=L(t),a=null;if(r&&(!(a=r[i])||!r.hasOwnProperty(i))&&(a=r[i]=r[t],cr(r&&Un(r,t)))){let e=n(a,i,t);r[t]=function(){return e(this,arguments)},wr(r[t],a),xr&&br(a,r[t])}return a}function Cr(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=Sr(e,t,e=>function(t,r){let a=n(t,r);return a.cbIdx>=0&&typeof r[a.cbIdx]==`function`?nr(a.name,r[a.cbIdx],a,i):e.apply(t,r)})}function wr(e,t){e[L(`OriginalDelegate`)]=t}function Tr(e){return typeof e==`function`}function Er(e){return typeof e==`number`}var Dr={useG:!0},Or={},kr={},Ar=RegExp(`^`+er+`(\\w+)(true|false)$`),jr=L(`propagationStopped`);function Mr(e,t){let n=(t?t(e):e)+$n,r=(t?t(e):e)+Qn,i=er+n,a=er+r;Or[e]={},Or[e][$n]=i,Or[e][Qn]=a}function Nr(e,t,n,r){let i=r&&r.add||Jn,a=r&&r.rm||Yn,o=r&&r.listeners||`eventListeners`,s=r&&r.rmAll||`removeAllListeners`,c=L(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[Or[r.type][i?Qn:$n]];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[jr]===!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=Gn(g);if(!g&&t[i]&&(g=t),!g||g[c])return!1;let _=n&&n.eventNameToString,v={},y=g[c]=g[i],b=g[L(a)]=g[a],x=g[L(o)]=g[o],S=g[L(s)]=g[s],ee;n&&n.prepend&&(ee=g[L(n.prepend)]=g[n.prepend]);function C(e,t){return t?typeof e==`boolean`?{capture:e,passive:!0}:e?typeof e==`object`&&e.passive!==!1?Rn(Ln({},e),{passive:!0}):e:{passive:!0}:e}let te=function(e){if(!v.isExisting)return y.call(v.target,v.eventName,v.capture?m:p,v.options)},w=function(e){if(!e.isRemoved){let t=Or[e.eventName],n;t&&(n=t[e.capture?Qn:$n]);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)},ne=function(e){return y.call(v.target,v.eventName,e.invoke,v.options)},re=function(e){return ee.call(v.target,v.eventName,e.invoke,v.options)},ie=function(e){return b.call(e.target,e.eventName,e.invoke,e.options)},T=r?te:ne,E=r?w:ie,ae=(n==null?void 0:n.diff)||function(e,t){let n=typeof t;return n===`function`&&e.callback===t||n===`object`&&e.originalDelegate===t},D=Zone[L(`UNPATCHED_EVENTS`)],oe=e[L(`PASSIVE_EVENTS`)];function se(e){if(typeof e==`object`&&e){let t=Ln({},e);return e.signal&&(t.signal=e.signal),t}return e}let O=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||ur&&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=!!oe&&oe.indexOf(u)!==-1,g=se(C(arguments[2],h)),y=g==null?void 0:g.signal;if(y!=null&&y.aborted)return;if(D){for(let e=0;e<D.length;e++)if(u===D[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,ee=Or[u];ee||(Mr(u,_),ee=Or[u]);let te=ee[b?Qn:$n],w=l[te],ne=!1;if(w){if(ne=!0,f){for(let e=0;e<w.length;e++)if(ae(w[e],p))return}}else w=l[te]=[];let re,ie=l.constructor.name,T=kr[ie];T&&(re=T[u]),re||(re=ie+i+(_?_(u):u)),v.options=g,x&&(v.options.once=!1),v.target=l,v.capture=b,v.eventName=u,v.isExisting=ne;let E=r?Dr:void 0;E&&(E.taskData=v),y&&(v.options.signal=void 0);let O=S.scheduleEventTask(re,p,E,a,o);if(y){v.options.signal=y;let e=()=>O.zone.cancelTask(O);t.call(y,`abort`,e,{once:!0}),O.removeAbortListener=()=>y.removeEventListener(`abort`,e)}if(v.target=null,E&&(E.taskData=null),x&&(v.options.once=!0),typeof O.options!=`boolean`&&(O.options=g),O.target=l,O.capture=b,O.eventName=u,m&&(O.originalDelegate=p),c?w.unshift(O):w.push(O),s)return l}};return g[i]=O(y,l,T,E,h),ee&&(g[u]=O(ee,`.prependListener:`,re,E,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=Or[r],c;s&&(c=s[a?Qn:$n]);let l=c&&t[c];if(l)for(let e=0;e<l.length;e++){let n=l[e];if(ae(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=er+`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=Pr(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=Or[r];if(e){let n=e[$n],i=e[Qn],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=Ar.exec(n),i=r&&r[1];i&&i!==`removeListener`&&this[s].call(this,i)}this[s].call(this,`removeListener`)}if(h)return this},wr(g[i],y),wr(g[a],b),S&&wr(g[s],S),x&&wr(g[o],x),!0}let g=[];for(let e=0;e<n.length;e++)g[e]=h(n[e],r);return g}function Pr(e,t){if(!t){let n=[];for(let r in e){let i=Ar.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=Or[t];n||(Mr(t),n=Or[t]);let r=e[n[$n]],i=e[n[Qn]];return r?i?r.concat(i):r.slice():i?i.slice():[]}function Fr(e,t){let n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,`stopImmediatePropagation`,e=>function(t,n){t[jr]=!0,e&&e.apply(t,n)})}function Ir(e,t){t.patchMethod(e,`queueMicrotask`,e=>function(e,t){Zone.current.scheduleMicroTask(`queueMicrotask`,t[0])})}var Lr=L(`zoneTask`);function Rr(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 Er(r)?n.handleId=r:(n.handle=r,n.isRefreshable=Tr(r.refresh)),t}function c(t){let{handle:n,handleId:r}=t.data;return a.call(e,n==null?r:n)}i=Sr(e,t,n=>function(i,a){var l;if(Tr(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[Lr]=null))}};let i=nr(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[Lr]=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=Sr(e,n,t=>function(n,r){let i=r[0],a;Er(i)?(a=o[i],delete o[i]):(a=i==null?void 0:i[Lr],a?i[Lr]=null:a=i),a!=null&&a.type?a.cancelFn&&a.zone.cancelTask(a):t.apply(e,r)})}function zr(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 Br(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 Vr(e,t){t.patchEventPrototype(e,t)}function Hr(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 Ur(e,t,n,r){e&&_r(e,Hr(e,t,n),r)}function Wr(e){return Object.getOwnPropertyNames(e).filter(e=>e.startsWith(`on`)&&e.length>2).map(e=>e.substring(2))}function Gr(e,t){if(ur&&!fr||Zone[e.symbol(`patchEvents`)])return;let n=t.__Zone_ignore_on_properties,r=[];if(dr){let e=window;r=r.concat([`Document`,`SVGElement`,`Element`,`HTMLElement`,`HTMLBodyElement`,`HTMLMediaElement`,`HTMLFrameSetElement`,`HTMLFrameElement`,`HTMLIFrameElement`,`HTMLMarqueeElement`,`Worker`]),Ur(e,Wr(e),n,Gn(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&&Ur(i.prototype,Wr(i.prototype),n)}}function Kr(e){e.__load_patch(`timers`,e=>{let t=`clear`;Rr(e,`set`,t,`Timeout`),Rr(e,`set`,t,`Interval`),Rr(e,`set`,t,`Immediate`)}),e.__load_patch(`requestAnimationFrame`,e=>{Rr(e,`request`,`cancel`,`AnimationFrame`),Rr(e,`mozRequest`,`mozCancel`,`AnimationFrame`),Rr(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];Sr(e,i,(n,r,i)=>function(r,a){return t.current.run(n,e,a,i)})}}),e.__load_patch(`EventTarget`,(e,t,n)=>{Vr(e,n),Br(e,n);let r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,n,[r.prototype])}),e.__load_patch(`MutationObserver`,(e,t,n)=>{yr(`MutationObserver`),yr(`WebKitMutationObserver`)}),e.__load_patch(`IntersectionObserver`,(e,t,n)=>{yr(`IntersectionObserver`)}),e.__load_patch(`FileReader`,(e,t,n)=>{yr(`FileReader`)}),e.__load_patch(`on_property`,(e,t,n)=>{Gr(n,e)}),e.__load_patch(`customElements`,(e,t,n)=>{zr(e,n)}),e.__load_patch(`XHR`,(e,t)=>{c(e);let n=L(`xhrTask`),r=L(`xhrSync`),i=L(`xhrListener`),a=L(`xhrScheduled`),o=L(`xhrURL`),s=L(`xhrErrorBeforeScheduled`);function c(e){let c=e.XMLHttpRequest;if(!c)return;let l=c.prototype;function u(e){return e[n]}let d=l[Xn],f=l[Zn];if(!d){let t=e.XMLHttpRequestEventTarget;if(t){let e=t.prototype;d=e[Xn],f=e[Zn]}}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[Xn],f=o[Zn]),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=Sr(l,`open`,()=>function(e,t){return e[r]=t[2]==0,e[o]=t[1],v.apply(e,t)}),y=L(`fetchTaskAborting`),b=L(`fetchTaskScheduling`),x=Sr(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=nr(`XMLHttpRequest.send`,g,t,h,_);e&&e[s]===!0&&!t.aborted&&r.state===m&&r.invoke()}}),S=Sr(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&&sr(e.navigator.geolocation,[`getCurrentPosition`,`watchPosition`])}),e.__load_patch(`PromiseRejectionEvent`,(e,t)=>{function n(t){return function(n){Pr(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[L(`unhandledPromiseRejectionHandler`)]=n(`unhandledrejection`),t[L(`rejectionHandledHandler`)]=n(`rejectionhandled`))}),e.__load_patch(`queueMicrotask`,(e,t,n)=>{Ir(e,n)})}function qr(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 T.reject(e)}let g=o(`state`),_=o(`value`),v=o(`finally`),y=o(`parentPromiseValue`),b=o(`parentPromiseState`);function x(e,t){return n=>{try{C(e,t,n)}catch(t){C(e,!1,t)}}}let S=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},ee=o(`currentTaskTrace`);function C(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(()=>{C(e,!1,t)})(),e}if(r!==!1&&o instanceof T&&o.hasOwnProperty(g)&&o.hasOwnProperty(_)&&o[g]!==null)w(o),C(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(()=>{C(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,ee,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t<l.length;)ne(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 te=o(`rejectionHandledHandler`);function w(e){if(e[g]===0){try{let n=t[te];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 ne(e,t,n,r,i){w(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),C(n,!0,t.run(o,void 0,i&&o!==h&&o!==m?[]:[r]))}catch(e){C(n,!1,e)}},n)}let re=function(){},ie=e.AggregateError;class T{static toString(){return`function ZoneAwarePromise() { [native code] }`}static resolve(e){return e instanceof T?e:C(new this(null),!0,e)}static reject(e){return C(new this(null),!1,e)}static withResolvers(){let e={};return e.promise=new T((t,n)=>{e.resolve=t,e.reject=n}),e}static any(e){if(!e||typeof e[Symbol.iterator]!=`function`)return Promise.reject(new ie([],`All promises were rejected`));let t=[],n=0;try{for(let r of e)n++,t.push(T.resolve(r))}catch(e){return Promise.reject(new ie([],`All promises were rejected`))}if(n===0)return Promise.reject(new ie([],`All promises were rejected`));let r=!1,i=[];return new T((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 ie(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 T.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof T?this:T).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 T))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){C(t,!1,e)}}get[Symbol.toStringTag](){return`Promise`}get[Symbol.species](){return T}then(e,n){var r;let i=(r=this.constructor)==null?void 0:r[Symbol.species];(!i||typeof i!=`function`)&&(i=this.constructor||T);let a=new i(re),o=t.current;return this[g]==null?this[_].push(o,a,e,n):ne(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=T);let i=new r(re);i[v]=v;let a=t.current;return this[g]==null?this[_].push(a,i,e,e):ne(this,a,i,e,e),i}}T.resolve=T.resolve,T.reject=T.reject,T.race=T.race,T.all=T.all;let E=e[l]=e.Promise;e.Promise=T;let ae=o(`thenPatched`);function D(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 T((e,t)=>{i.call(this,e,t)}).then(e,t)},e[ae]=!0}n.patchThen=D;function oe(e){return function(t,n){let r=e.apply(t,n);if(r instanceof T)return r;let i=r.constructor;return i[ae]||D(i),r}}if(E){D(E);let t=E.try;t&&typeof t==`function`&&(T.try=t),Sr(e,`fetch`,e=>oe(e))}return Promise[t.__symbol__(`uncaughtPromiseErrors`)]=s,T})}function Jr(e){e.__load_patch(`toString`,e=>{let t=Function.prototype.toString,n=L(`OriginalDelegate`),r=L(`Promise`),i=L(`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 Yr(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 Xr(e){e.__load_patch(`util`,(e,t,n)=>{let r=Wr(e);n.patchOnProperties=_r,n.patchMethod=Sr,n.bindArguments=or,n.patchMacroTask=Cr;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=Fr,n.patchEventTarget=Nr,n.ObjectDefineProperty=Wn,n.ObjectGetOwnPropertyDescriptor=Un,n.ObjectCreate=Kn,n.ArraySlice=qn,n.patchClass=yr,n.wrapWithCurrentZone=tr,n.filterProperties=Hr,n.attachOriginToPatched=wr,n._redefineProperty=Object.defineProperty,n.patchCallbacks=Yr,n.getGlobalObjects=()=>({globalSources:kr,zoneSymbolEventNames:Or,eventNames:r,isBrowser:dr,isMix:fr,isNode:ur,TRUE_STR:Qn,FALSE_STR:$n,ZONE_SYMBOL_PREFIX:er,ADD_EVENT_LISTENER_STR:Jn,REMOVE_EVENT_LISTENER_STR:Yn})})}function Zr(e){qr(e),Jr(e),Xr(e)}var Qr=Hn();Zr(Qr),Kr(Qr);function $r(e){return e.setValue(ti,!0)}function ei(e){return e.getValue(ti)===!0}var ti,ni=t((()=>{N(),ti=oe(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)})),ri,ii,ai=t((()=>{ri=`baggage`,ii=4096}));function oi(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function si(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 ci(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=E(e.substring(t+1))),{key:o,value:s,metadata:c}}var li=t((()=>{N(),ai()})),ui,di=t((()=>{N(),ni(),ai(),li(),ui=class{inject(e,t,n){let r=Jt.getBaggage(e);if(!r||ei(e))return;let i=oi(si(r).filter(e=>e.length<=ii).slice(0,180));i.length>0&&n.set(t,ri,i)}extract(e,t,n){let r=n.get(t,ri),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=ci(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:Jt.setBaggage(e,Jt.createBaggage(a))}fields(){return[ri]}}}));function fi(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!pi(n)){j.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!mi(r)){j.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function pi(e){return typeof e==`string`&&e!==``}function mi(e){return e==null?!0:Array.isArray(e)?hi(e):gi(typeof e)}function hi(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(gi(e)){t=e;continue}return!1}return!1}}return!0}function gi(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var _i=t((()=>{N()}));function vi(){return e=>{j.error(yi(e))}}function yi(e){return typeof e==`string`?e:JSON.stringify(bi(e))}function bi(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 xi=t((()=>{N()}));function Si(e){try{Ci(e)}catch(e){}}var Ci,wi=t((()=>{xi(),Ci=vi()})),Ti=t((()=>{})),Ei,Di=t((()=>{Ei=`2.7.1`})),Oi=t((()=>{})),ki=t((()=>{Oi()})),Ai=t((()=>{})),ji=t((()=>{Ai()})),Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji=t((()=>{Mi=`error.type`,Ni=`exception.message`,Pi=`exception.stacktrace`,Fi=`exception.type`,Ii=`http.request.method`,Li=`http.request.method_original`,Ri=`http.response.status_code`,zi=`server.address`,Bi=`server.port`,Vi=`service.name`,Hi=`telemetry.sdk.language`,Ui=`webjs`,Wi=`telemetry.sdk.name`,Gi=`telemetry.sdk.version`,Ki=`url.full`,qi=`user_agent.original`})),Yi=t((()=>{})),Xi=t((()=>{})),Zi=t((()=>{ki(),ji(),Ji(),Yi(),Xi()})),Qi,$i=t((()=>{Qi=`process.runtime.name`})),ea,ta=t((()=>{Di(),Zi(),$i(),ea={[Wi]:`opentelemetry`,[Qi]:`browser`,[Hi]:Ui,[Gi]:Ei}})),z,na=t((()=>{Ti(),ta(),z=performance}));function ra(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*pa)]}function ia(e){return da(ra(z.timeOrigin),ra(typeof e==`number`?e:z.now()))}function aa(e){if(la(e))return e;if(typeof e==`number`)return e<z.timeOrigin?ia(e):ra(e);if(e instanceof Date)return ra(e.getTime());throw TypeError(`Invalid input type`)}function oa(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ma),[n,r]}function sa(e){return e[0]*ma+e[1]}function ca(e){return e[0]*1e6+e[1]/1e3}function la(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function ua(e){return la(e)||typeof e==`number`||e instanceof Date}function da(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=ma&&(n[1]-=ma,n[0]+=1),n}var fa,pa,ma,ha=t((()=>{na(),fa=9,pa=Math.pow(10,6),ma=Math.pow(10,fa)})),ga,_a=t((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(ga||(ga={}))})),va,ya=t((()=>{N(),F(),va=class{constructor(e={}){var t;P(this,`_propagators`,void 0),P(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){j.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){j.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}}));function ba(e){return Ta.test(e)}function xa(e){return Ea.test(e)&&!Da.test(e)}var Sa,Ca,wa,Ta,Ea,Da,Oa=t((()=>{Sa=`[_0-9a-z-*/]`,Ca=`[a-z]${Sa}{0,255}`,wa=`[a-z0-9]${Sa}{0,240}@[a-z]${Sa}{0,13}`,Ta=RegExp(`^(?:${Ca}|${wa})$`),Ea=/^[ -~]{0,255}[!-~]$/,Da=/,|=/})),ka,Aa,ja,Ma,Na,Pa=t((()=>{Oa(),F(),ka=32,Aa=512,ja=`,`,Ma=`=`,Na=class e{constructor(e){P(this,`_length`,void 0),P(this,`_rawTraceState`,void 0),P(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!ba(e)||!xa(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>Aa)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=ja+e),e=`${n[0]}${Ma}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(ja),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Ma);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!ba(a)||!xa(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Aa)&&(t.set(a,o),n=s,t.size>=ka))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}}}));function Fa(e){let t=za.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Ia,La,Ra,za,Ba,Va=t((()=>{N(),ni(),Pa(),Ia=`traceparent`,La=`tracestate`,Ra=`00`,za=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),Ba=class{inject(e,t,n){let r=M.getSpanContext(e);if(!r||ei(e)||!it(r))return;let i=`${Ra}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||k.NONE).toString(16)}`;n.set(t,Ia,i),r.traceState&&n.set(t,La,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Ia);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Fa(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,La);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Na(typeof e==`string`?e:void 0)}return M.setSpanContext(e,a)}fields(){return[Ia,La]}}}));function Ha(e){if(!Ua(e)||Wa(e)!==qa)return!1;let t=Qa(e);if(t===null)return!0;let n=eo.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Xa.call(n)===Za}function Ua(e){return typeof e==`object`&&!!e}function Wa(e){return e==null?e===void 0?Ya:Ja:to&&to in Object(e)?Ga(e):Ka(e)}function Ga(e){let t=eo.call(e,to),n=e[to],r=!1;try{e[to]=void 0,r=!0}catch(e){}let i=no.call(e);return r&&(t?e[to]=n:delete e[to]),i}function Ka(e){return no.call(e)}var qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro=t((()=>{qa=`[object Object]`,Ja=`[object Null]`,Ya=`[object Undefined]`,Xa=Function.prototype.toString,Za=Xa.call(Object),Qa=Object.getPrototypeOf,$a=Object.prototype,eo=$a.hasOwnProperty,to=Symbol?Symbol.toStringTag:void 0,no=$a.toString}));function io(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=oo(t,e.shift(),0,n);return t}function ao(e){return co(e)?e.slice():e}function oo(e,t,n=0,r){let i;if(!(n>mo)){if(n++,fo(e)||fo(t)||lo(t))i=ao(t);else if(co(e)){if(i=e.slice(),co(t))for(let e=0,n=t.length;e<n;e++)i.push(ao(t[e]));else if(uo(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]=ao(t[r]))}}}else if(uo(e))if(uo(t)){if(!po(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(fo(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(so(e,s,r)||so(t,s,r))delete i[s];else{if(uo(a)&&uo(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]=oo(i[s],c,n,r)}}}}else i=t;return i}}function so(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 co(e){return Array.isArray(e)}function lo(e){return typeof e==`function`}function uo(e){return!fo(e)&&!co(e)&&!lo(e)&&typeof e==`object`}function fo(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function po(e,t){return!(!Ha(e)||!Ha(t))}var mo,ho=t((()=>{ro(),mo=20}));function go(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new _o(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var _o,vo=t((()=>{_o=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}));function yo(e,t){return typeof t==`string`?e===t:!!e.match(t)}function bo(e,t){if(!t)return!1;for(let n of t)if(yo(e,n))return!0;return!1}var xo=t((()=>{})),So,Co=t((()=>{F(),So=class{constructor(){P(this,`_promise`,void 0),P(this,`_resolve`,void 0),P(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),wo,To=t((()=>{Co(),F(),wo=class{constructor(e,t){P(this,`_isCalled`,!1),P(this,`_deferred`,new So),P(this,`_callback`,void 0),P(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function Eo(e,t){return new Promise(n=>{A.with($r(A.active()),()=>{e.export(t,n)})})}var Do=t((()=>{N(),ni()})),Oo,B=t((()=>{di(),F(),_i(),wi(),xi(),ha(),_a(),li(),na(),ya(),Va(),N(),ni(),Pa(),ho(),vo(),xo(),To(),Do(),Oo={_export:Eo}}));F();var ko=class{constructor(e){P(this,`_delegate`,void 0),this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};F();var Ao=class extends Error{constructor(e,t,n){super(e),P(this,`code`,void 0),P(this,`name`,`OTLPExporterError`),P(this,`data`,void 0),this.data=n,this.code=t}};function jo(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function V(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){jo(a,r,i,o,s,`next`,e)}function s(e){jo(a,r,i,o,s,`throw`,e)}o(void 0)})}}var H=t((()=>{}));H();function Mo(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function No(e){if(e!=null)return V(function*(){return e})}function Po(e,t,n){var r,i,a,o,s,c;return{timeoutMillis:Mo((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 Fo(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}F(),H();var Io=class{constructor(e){P(this,`_concurrencyLimit`,void 0),P(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var e=this;return V(function*(){yield Promise.all(e._sendingPromises)})()}};function Lo(e){return new Io(e.concurrencyLimit)}N();function Ro(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function zo(){return{handleResponse(e){e==null||!Ro(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||j.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}B(),N(),F(),H();var Bo=class{constructor(e,t,n,r,i){P(this,`_diagLogger`,void 0),P(this,`_transport`,void 0),P(this,`_serializer`,void 0),P(this,`_responseHandler`,void 0),P(this,`_promiseQueue`,void 0),P(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=j.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:ga.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:ga.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:ga.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:ga.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:ga.FAILED,error:(n=e.error)==null?new Ao(`Export failed with retryable status`):n})}else t({code:ga.FAILED,error:new Ao(`Export failed with unknown error`)})},e=>t({code:ga.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return V(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function Vo(e,t){return new Bo(e.transport,e.serializer,zo(),e.promiseHandler,t.timeout)}function Ho(e,t,n){return Vo({transport:n,serializer:t,promiseHandler:Lo(e)},{timeout:e.timeoutMillis})}var Uo;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Uo||(Uo={}));var U;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(U||(U={}));var Wo;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Wo||(Wo={}));function Go(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Ko(e){var t,n;return`${e.name}:${(t=e.version)==null?``:t}:${(n=e.schemaUrl)==null?``:n}`}var qo=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Jo(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new qo(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Yo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xo(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Zo(e,t){return e.toLowerCase()===t.toLowerCase()}var Qo;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(Qo||(Qo={})),F();var $o=class{constructor(){P(this,`kind`,Qo.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};F();function es(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var ts=class{constructor(e,t,n=!0,r=es(t)){P(this,`startTime`,void 0),P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),P(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Xo(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},ns=class{constructor(e,t){P(this,`kind`,Qo.HISTOGRAM),P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new ts(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new ts(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new ts(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===U.GAUGE||e.type===U.UP_DOWN_COUNTER||e.type===U.OBSERVABLE_GAUGE||e.type===U.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};F();var rs=class e{constructor(e=new is,t=0,n=0,r=0){P(this,`backing`,void 0),P(this,`indexBase`,void 0),P(this,`indexStart`,void 0),P(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},is=class e{constructor(e=[0]){P(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},as=2146435072,os=1048575,ss=1023,cs=-ss+1,ls=ss,us=Math.pow(2,-1022);function ds(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&as)>>20)-ss}function fs(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&os)*Math.pow(2,32)+r}function ps(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*Math.pow(2,t)}function ms(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var hs=class extends Error{};F();var gs=class{constructor(e){P(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<us?this._minNormalLowerBoundaryIndex():ds(e)+this._rightShift(fs(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new hs(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new hs(`overflow: ${e} is > maximum lower boundary: ${n}`);return ps(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=cs>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return ls>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}};F();var _s=class{constructor(e){P(this,`_scale`,void 0),P(this,`_scaleFactor`,void 0),P(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=ps(Math.LOG2E,e),this._inverseFactor=ps(Math.LN2,-e)}mapToIndex(e){if(e<=us)return this._minNormalLowerBoundaryIndex()-1;if(fs(e)===0)return(ds(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new hs(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return us;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new hs(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return cs<<this._scale}_maxNormalLowerBoundaryIndex(){return(ls+1<<this._scale)-1}},vs=-10,ys=20,bs=Array.from({length:31},(e,t)=>t>10?new _s(t-10):new gs(t-10));function xs(e){if(e>ys||e<vs)throw new hs(`expected scale >= ${vs} && <= ${ys}, got: ${e}`);return bs[e+10]}N(),F();var Ss=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){P(this,`low`,void 0),P(this,`high`,void 0),this.low=e,this.high=t}},Cs=20,ws=160,Ts=2,Es=class e{constructor(e,t=ws,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new rs,l=new rs,u=xs(Cs)){P(this,`startTime`,void 0),P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),P(this,`_sum`,void 0),P(this,`_count`,void 0),P(this,`_zeroCount`,void 0),P(this,`_min`,void 0),P(this,`_max`,void 0),P(this,`_positive`,void 0),P(this,`_negative`,void 0),P(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<Ts&&(j.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
3
|
-
changing to the minimum size of: ${Ts}`),this._maxSize=Ts)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=ms(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=xs(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=Ss.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=Ss.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new Ss(0,-1);let r=t-n;return new Ss(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},Ds=class{constructor(e,t){P(this,`kind`,Qo.EXPONENTIAL_HISTOGRAM),P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new Es(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===U.GAUGE||e.type===U.UP_DOWN_COUNTER||e.type===U.OBSERVABLE_GAUGE||e.type===U.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}};B(),F();var Os=class{constructor(e,t=0,n=[0,0]){P(this,`startTime`,void 0),P(this,`_current`,void 0),P(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=ra(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},ks=class{constructor(){P(this,`kind`,Qo.LAST_VALUE)}createAccumulation(e){return new Os(e)}merge(e,t){let n=ca(t.sampleTime)>=ca(e.sampleTime)?t:e;return new Os(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=ca(t.sampleTime)>=ca(e.sampleTime)?t:e;return new Os(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}};F();var As=class{constructor(e,t,n=0,r=!1){P(this,`startTime`,void 0),P(this,`monotonic`,void 0),P(this,`_current`,void 0),P(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},js=class{constructor(e){P(this,`kind`,Qo.SUM),P(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new As(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new As(t.startTime,this.monotonic,r,t.reset):new As(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new As(t.startTime,this.monotonic,r,!0):new As(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};N(),F();var Ms=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Ms,`DEFAULT_INSTANCE`,new $o);var Ns=class e{createAggregator(t){switch(t.type){case U.COUNTER:case U.OBSERVABLE_COUNTER:case U.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};P(Ns,`MONOTONIC_INSTANCE`,new js(!0)),P(Ns,`NON_MONOTONIC_INSTANCE`,new js(!1));var Ps=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Ps,`DEFAULT_INSTANCE`,new ks);var Fs=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Fs,`DEFAULT_INSTANCE`,new ns([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var Is=class{constructor(e,t=!0){if(P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new ns(this._boundaries,this._recordMinMax)}},Ls=class{constructor(e=160,t=!0){P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new Ds(this._maxSize,this._recordMinMax)}},Rs=class{_resolve(e){switch(e.type){case U.COUNTER:case U.UP_DOWN_COUNTER:case U.OBSERVABLE_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:return Bs;case U.GAUGE:case U.OBSERVABLE_GAUGE:return Vs;case U.HISTOGRAM:return e.advice.explicitBucketBoundaries?new Is(e.advice.explicitBucketBoundaries):Hs}return j.warn(`Unable to recognize instrument type: ${e.type}`),zs}createAggregator(e){return this._resolve(e).createAggregator(e)}},zs=new Ms,Bs=new Ns,Vs=new Ps,Hs=new Fs;new Ls;var Us=new Rs,Ws;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(Ws||(Ws={}));function Gs(e){switch(e.type){case Ws.DEFAULT:return Us;case Ws.DROP:return zs;case Ws.SUM:return Bs;case Ws.LAST_VALUE:return Vs;case Ws.EXPONENTIAL_HISTOGRAM:{var t,n;let r=e;return new Ls((t=r.options)==null?void 0:t.maxSize,(n=r.options)==null?void 0:n.recordMinMax)}case Ws.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;if(t.options==null)return Hs;var r,i;return new Is((r=t.options)==null?void 0:r.boundaries,(i=t.options)==null?void 0:i.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Ks=e=>({type:Ws.DEFAULT}),qs=e=>Uo.CUMULATIVE;N(),F(),H();var Js=class{constructor(e){var t,n,r;P(this,`_shutdown`,!1),P(this,`_metricProducers`,void 0),P(this,`_sdkMetricProducer`,void 0),P(this,`_aggregationTemporalitySelector`,void 0),P(this,`_aggregationSelector`,void 0),P(this,`_cardinalitySelector`,void 0),this._aggregationSelector=(t=e==null?void 0:e.aggregationSelector)==null?Ks:t,this._aggregationTemporalitySelector=(n=e==null?void 0:e.aggregationTemporalitySelector)==null?qs:n,this._metricProducers=(r=e==null?void 0:e.metricProducers)==null?[]:r,this._cardinalitySelector=e==null?void 0:e.cardinalitySelector}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}collect(e){var t=this;return V(function*(){if(t._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(t._shutdown)throw Error(`MetricReader is shutdown`);let[n,...r]=yield Promise.all([t._sdkMetricProducer.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}),...t._metricProducers.map(t=>t.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}))]),i=n.errors.concat(r.flatMap(e=>e.errors));return{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:i}})()}shutdown(e){var t=this;return V(function*(){if(t._shutdown){j.error(`Cannot call shutdown twice.`);return}(e==null?void 0:e.timeoutMillis)==null?yield t.onShutdown():yield Jo(t.onShutdown(),e.timeoutMillis),t._shutdown=!0})()}forceFlush(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if((e==null?void 0:e.timeoutMillis)==null){yield t.onForceFlush();return}yield Jo(t.onForceFlush(),e.timeoutMillis)})()}};function Ys(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?Ys(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var G=t((()=>{F()}));N(),B(),F(),G(),H();var Xs=class extends Js{constructor(e){var t,n;let{exporter:r,exportIntervalMillis:i=6e4,metricProducers:a,cardinalityLimits:o}=e,{exportTimeoutMillis:s=3e4}=e;if(super({aggregationSelector:(t=r.selectAggregation)==null?void 0:t.bind(r),aggregationTemporalitySelector:(n=r.selectAggregationTemporality)==null?void 0:n.bind(r),metricProducers:a,cardinalitySelector:e=>{let t=W({default:2e3},o);switch(e){case U.COUNTER:var n;return(n=t.counter)==null?t.default:n;case U.GAUGE:var r;return(r=t.gauge)==null?t.default:r;case U.HISTOGRAM:var i;return(i=t.histogram)==null?t.default:i;case U.OBSERVABLE_COUNTER:var a;return(a=t.observableCounter)==null?t.default:a;case U.OBSERVABLE_UP_DOWN_COUNTER:var s;return(s=t.observableUpDownCounter)==null?t.default:s;case U.OBSERVABLE_GAUGE:var c;return(c=t.observableGauge)==null?t.default:c;case U.UP_DOWN_COUNTER:var l;return(l=t.upDownCounter)==null?t.default:l;default:return t.default}}}),P(this,`_interval`,void 0),P(this,`_exporter`,void 0),P(this,`_exportInterval`,void 0),P(this,`_exportTimeout`,void 0),i<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(s<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(i<s){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);j.info(`Timeout of ${s} exceeds the interval of ${i}. Clamping timeout to interval duration.`),s=i}this._exportInterval=i,this._exportTimeout=s,this._exporter=r}_runOnce(){var e=this;return V(function*(){try{yield Jo(e._doRun(),e._exportTimeout)}catch(t){if(t instanceof qo){j.error(`Export took longer than %s milliseconds and timed out.`,e._exportTimeout);return}Si(t)}})()}_doRun(){var e=this;return V(function*(){let{resourceMetrics:t,errors:n}=yield e.collect({timeoutMillis:e._exportTimeout});if(n.length>0&&j.error(`PeriodicExportingMetricReader: metrics collection errors`,...n),t.resource.asyncAttributesPending)try{var r,i;yield(r=(i=t.resource).waitForAsyncAttributes)==null?void 0:r.call(i)}catch(e){j.debug(`Error while resolving async portion of resource: `,e),Si(e)}if(t.scopeMetrics.length===0)return;let a=yield Oo._export(e._exporter,t);if(a.code!==ga.SUCCESS)throw Error(`PeriodicExportingMetricReader: metrics export failed (error ${a.error})`)})()}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}onForceFlush(){var e=this;return V(function*(){yield e._runOnce(),yield e._exporter.forceFlush()})()}onShutdown(){var e=this;return V(function*(){e._interval&&clearInterval(e._interval),yield e.onForceFlush(),yield e._exporter.shutdown()})()}};function Zs(){if(Qs===void 0)try{let e=globalThis.process.argv0;Qs=e?`unknown_service:${e}`:`unknown_service`}catch(e){Qs=`unknown_service`}return Qs}var Qs,$s=t((()=>{})),ec,tc=t((()=>{ec=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function nc(e,t){return sc.FromAttributeList(Object.entries(e),t)}function rc(){return nc({[Vi]:Zs(),[Hi]:ea[Hi],[Wi]:ea[Wi],[Gi]:ea[Gi]})}function ic(e){return e.map(([e,t])=>ec(t)?[e,t.catch(t=>{j.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ac(e){if(typeof e==`string`||e===void 0)return e;j.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function oc(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;j.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var sc,cc=t((()=>{N(),B(),Zi(),$s(),tc(),F(),H(),sc=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=ic(t),r._asyncAttributesPending=t.filter(([e,t])=>ec(t)).length>0,r}constructor(e,t){var n;P(this,`_rawAttributes`,void 0),P(this,`_asyncAttributesPending`,!1),P(this,`_schemaUrl`,void 0),P(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(ec(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ic(this._rawAttributes),this._schemaUrl=ac(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return V(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,ec(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&j.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(ec(n)){j.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=oc(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),lc=t((()=>{N(),cc(),Zi(),B(),F(),$s()}));F();var uc=class{constructor(){P(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};N();function dc(e,t,n){var r,i,a,o;return hc(e)||j.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:(r=n==null?void 0:n.description)==null?``:r,unit:(i=n==null?void 0:n.unit)==null?``:i,valueType:(a=n==null?void 0:n.valueType)==null?ke.DOUBLE:a,advice:(o=n==null?void 0:n.advice)==null?{}:o}}function fc(e,t){var n,r;return{name:(n=e.name)==null?t.name:n,description:(r=e.description)==null?t.description:r,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function pc(e,t){return Zo(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var mc=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function hc(e){return mc.test(e)}N(),B(),F();var gc=class{constructor(e,t){P(this,`_writableMetricStorage`,void 0),P(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n=A.active()){if(typeof e!=`number`){j.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===ke.INT&&!Number.isInteger(e)&&(j.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,ra(Date.now()))}},_c=class extends gc{add(e,t,n){this._record(e,t,n)}},vc=class extends gc{add(e,t,n){if(e<0){j.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},yc=class extends gc{record(e,t,n){this._record(e,t,n)}},bc=class extends gc{record(e,t,n){if(e<0){j.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},xc=class{constructor(e,t,n){P(this,`_metricStorages`,void 0),P(this,`_descriptor`,void 0),P(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},Sc=class extends xc{},Cc=class extends xc{},wc=class extends xc{};function Tc(e){return e instanceof xc}F();var Ec=class{constructor(e){P(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=dc(e,U.GAUGE,t);return new yc(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=dc(e,U.HISTOGRAM,t);return new bc(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=dc(e,U.COUNTER,t);return new vc(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=dc(e,U.UP_DOWN_COUNTER,t);return new _c(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=dc(e,U.OBSERVABLE_GAUGE,t);return new Cc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=dc(e,U.OBSERVABLE_COUNTER,t);return new Sc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=dc(e,U.OBSERVABLE_UP_DOWN_COUNTER,t);return new wc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};F();var Dc=class{constructor(e){P(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=dc(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};F();var Oc=class{constructor(e){P(this,`_valueMap`,new Map),P(this,`_keyMap`,new Map),P(this,`_hash`,void 0),this._hash=e}get(e,t){return t!=null||(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n!=null||(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t!=null||(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},kc=class extends Oc{constructor(){super(Go)}};F();var Ac=class{constructor(e,t){P(this,`_activeCollectionStorage`,new kc),P(this,`_cumulativeMemoStorage`,new kc),P(this,`_cardinalityLimit`,void 0),P(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),P(this,`_overflowHashCode`,void 0),P(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t==null?2e3:t)-1,this._overflowHashCode=Go(this._overflowAttributes)}record(e,t,n,r){let i=this._activeCollectionStorage.get(t);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){let t=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(r));t==null||t.record(e);return}i=this._aggregator.createAccumulation(r),this._activeCollectionStorage.set(t,i)}i==null||i.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o==null||o.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new kc,e}};F();var jc=class e{constructor(e,t){P(this,`_aggregator`,void 0),P(this,`_unreportedAccumulations`,new Map),P(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===Uo.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=Mc(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new kc,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys()){let e=t.get(r,i);e==null||e.setStartTime(n)}return t}};function Mc(e){return Array.from(e.entries())}F();var Nc=class extends Dc{constructor(e,t,n,r,i){super(e),P(this,`_aggregationCardinalityLimit`,void 0),P(this,`_deltaMetricStorage`,void 0),P(this,`_temporalMetricStorage`,void 0),P(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ac(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new jc(t,r),this._attributesProcessor=n}record(e,t){let n=new kc;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function Pc(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Fc(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Ic(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Lc(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Rc(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
|
|
1
|
+
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 oe}createHistogram(e,t){return se}createCounter(e,t){return ae}createUpDownCounter(e,t){return ce}createObservableGauge(e,t){return ue}createObservableCounter(e,t){return le}createObservableUpDownCounter(e,t){return de}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},D=class{},ee=class extends D{add(e,t){}},te=class extends D{add(e,t){}},O=class extends D{record(e,t){}},k=class extends D{record(e,t){}},ne=class{addCallback(e){}removeCallback(e){}},A=class extends ne{},re=class extends ne{},ie=class extends ne{},j=new E,ae=new ee,oe=new O,se=new k,ce=new te,le=new A,ue=new re,de=new ie;function fe(){return j}var pe;(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(pe||(pe={}));var me={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},he={set(e,t,n){e!=null&&(e[t]=n)}},ge=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}},_e=`context`,ve=new ge,ye=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return u(_e,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(_e)||ve}disable(){this._getContextManager().disable(),f(_e,v.instance())}},M;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(M||(M={}));var be={traceId:`00000000000000000000000000000000`,spanId:`0000000000000000`,traceFlags:M.NONE},xe=class{constructor(e=be){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){}},Se=w(`OpenTelemetry Context Key SPAN`);function Ce(e){return e.getValue(Se)||void 0}function we(){return Ce(ye.getInstance().active())}function Te(e,t){return e.setValue(Se,t)}function Ee(e){return e.deleteValue(Se)}function De(e,t){return Te(e,new xe(t))}function Oe(e){var t;return(t=Ce(e))==null?void 0:t.spanContext()}var ke=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 Ae(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(ke[e.charCodeAt(t)]|0)+(ke[e.charCodeAt(t+1)]|0)+(ke[e.charCodeAt(t+2)]|0)+(ke[e.charCodeAt(t+3)]|0);return n===t}function je(e){return Ae(e,32)&&e!==`00000000000000000000000000000000`}function Me(e){return Ae(e,16)&&e!==`0000000000000000`}function Ne(e){return je(e.traceId)&&Me(e.spanId)}function Pe(e){return new xe(e)}var Fe=ye.getInstance(),Ie=class{startSpan(e,t,n=Fe.active()){if(t!=null&&t.root)return new xe;let r=n&&Oe(n);return Le(r)&&Ne(r)?new xe(r):new xe}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?Fe.active():a,c=this.startSpan(e,i,s),l=Te(s,c);return Fe.with(l,o,void 0,c)}};function Le(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 Re=new Ie,ze=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):Re}},Be=new class{getTracer(e,t,n){return new Ie}},Ve=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new ze(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?Be:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}},He;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(He||(He={}));var Ue;(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`})(Ue||(Ue={}));var We;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(We||(We={}));var N=ye.getInstance(),P=v.instance(),Ge=new class{getMeter(e,t,n){return j}},Ke=`metrics`,qe=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return u(Ke,e,v.instance())}getMeterProvider(){return d(Ke)||Ge}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){f(Ke,v.instance())}}.getInstance(),Je=class{inject(e,t){}extract(e,t){return e}fields(){return[]}},Ye=w(`OpenTelemetry Baggage Key`);function Xe(e){return e.getValue(Ye)||void 0}function Ze(){return Xe(ye.getInstance().active())}function Qe(e,t){return e.setValue(Ye,t)}function $e(e){return e.deleteValue(Ye)}var et=`propagation`,tt=new Je,nt=class e{constructor(){this.createBaggage=S,this.getBaggage=Xe,this.getActiveBaggage=Ze,this.setBaggage=Qe,this.deleteBaggage=$e}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return u(et,e,v.instance())}inject(e,t,n=he){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=me){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){f(et,v.instance())}_getGlobalPropagator(){return d(et)||tt}}.getInstance(),rt=`trace`,F=class e{constructor(){this._proxyTracerProvider=new Ve,this.wrapSpanContext=Pe,this.isSpanContextValid=Ne,this.deleteSpan=Ee,this.getSpan=Ce,this.getActiveSpan=we,this.getSpanContext=Oe,this.setSpan=Te,this.setSpanContext=De}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=u(rt,this._proxyTracerProvider,v.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return d(rt)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){f(rt,v.instance()),this._proxyTracerProvider=new Ve}}.getInstance();function it(e){return typeof e==`object`&&!!e&&`addEventListener`in e&&typeof e.addEventListener==`function`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`}function at(e){"@babel/helpers - typeof";return at=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},at(e)}var ot=t((()=>{}));function st(e,t){if(at(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(at(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var ct=t((()=>{ot()}));function lt(e){var t=st(e,`string`);return at(t)==`symbol`?t:t+``}var ut=t((()=>{ot(),ct()}));function I(e,t,n){return(t=lt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var L=t((()=>{ut()}));L();var dt=`OT_ZONE_CONTEXT`,ft=class{constructor(){I(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:{[dt]: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(dt)||T}bind(e,t){return typeof t==`function`?this._bindFunction(e,t):(it(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)}},pt=Object.defineProperty,mt=Object.defineProperties,ht=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable,yt=(e,t,n)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bt=(e,t)=>{for(var n in t||(t={}))_t.call(t,n)&&yt(e,n,t[n]);if(gt)for(var n of gt(t))vt.call(t,n)&&yt(e,n,t[n]);return e},xt=(e,t)=>mt(e,ht(t)),R=(e,t,n)=>(yt(e,typeof t==`symbol`?t:t+``,n),n),z=globalThis;function B(e){return(z.__Zone_symbol_prefix||`__zone_symbol__`)+e}function St(){let e=z.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){R(this,`_parent`),R(this,`_name`),R(this,`_properties`),R(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(z.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 O.zone}static get currentTask(){return k}static __load_patch(r,i,a=!1){if(ee.hasOwnProperty(r)){let e=z[B(`forceDuplicateZoneCheck`)]===!0;if(!a&&e)throw Error(`Already loaded patch: `+r)}else if(!z[`__Zone_disable_`+r]){let a=`Zone:`+r;t(a),ee[r]=i(z,e,te),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){O={parent:O,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{O=O.parent}}runGuarded(e,t=null,n,r){O={parent:O,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{O=O.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=k;k=r,O={parent:O,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)}O=O.parent,k=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)}};R(r,`__symbol__`,B);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){R(this,`_zone`),R(this,`_taskCounts`,{microTask:0,macroTask:0,eventTask:0}),R(this,`_forkDlgt`),R(this,`_forkZS`),R(this,`_forkCurrZone`),R(this,`_interceptDlgt`),R(this,`_interceptZS`),R(this,`_interceptCurrZone`),R(this,`_invokeDlgt`),R(this,`_invokeZS`),R(this,`_invokeCurrZone`),R(this,`_handleErrorDlgt`),R(this,`_handleErrorZS`),R(this,`_handleErrorCurrZone`),R(this,`_scheduleTaskDlgt`),R(this,`_scheduleTaskZS`),R(this,`_scheduleTaskCurrZone`),R(this,`_invokeTaskDlgt`),R(this,`_invokeTaskZS`),R(this,`_invokeTaskCurrZone`),R(this,`_cancelTaskDlgt`),R(this,`_cancelTaskZS`),R(this,`_cancelTaskCurrZone`),R(this,`_hasTaskDlgt`),R(this,`_hasTaskDlgtOwner`),R(this,`_hasTaskZS`),R(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(R(this,`type`),R(this,`source`),R(this,`invoke`),R(this,`callback`),R(this,`data`),R(this,`scheduleFn`),R(this,`cancelFn`),R(this,`_zone`,null),R(this,`runCount`,0),R(this,`_zoneDelegates`,null),R(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(z,o,this,arguments)}}static invokeTask(e,t,n){e||(e=this),ne++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{ne===1&&!z[d]&&_(),ne--}}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=B(`setTimeout`),l=B(`Promise`),u=B(`then`),d=B(`enable_native_microtask_draining`),f=[],p=!1,m;function h(e){var t;!m&&z[l]&&(m=z[l].resolve(0)),m?((t=m[u])==null?m.then:t).call(m,e):z[c](e,0)}function g(e){let t=z[d],n=t&&f.length===0&&!p,r=!t&&ne===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){te.onUnhandledError(e)}}z[d]?(p=!1,te.microtaskDrainDone()):(te.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={},te={symbol:B,currentZoneFrame:()=>O,onUnhandledError:A,microtaskDrainDone:A,scheduleMicroTask:g,showUncaughtError:()=>!i[B(`ignoreConsoleErrorUncaughtError`)],patchEventTarget:()=>[],patchOnProperties:A,patchMethod:()=>A,bindArguments:()=>[],patchThen:()=>A,patchMacroTask:()=>A,patchEventPrototype:()=>A,getGlobalObjects:()=>void 0,ObjectDefineProperty:()=>A,ObjectGetOwnPropertyDescriptor:()=>void 0,ObjectCreate:()=>void 0,ArraySlice:()=>[],patchClass:()=>A,wrapWithCurrentZone:()=>A,filterProperties:()=>[],attachOriginToPatched:()=>A,_redefineProperty:()=>A,patchCallbacks:()=>A,nativeScheduleMicroTask:h},O={parent:null,zone:new i(null,null)},k=null,ne=0;function A(){}return n(`Zone`,`Zone`),i}function Ct(){let e=globalThis,t=e[B(`forceDuplicateZoneCheck`)]===!0;if(e.Zone&&(t||typeof e.Zone.__symbol__!=`function`))throw Error(`Zone already loaded.`);return e.Zone!=null||(e.Zone=St()),e.Zone}var wt=Object.getOwnPropertyDescriptor,Tt=Object.defineProperty,Et=Object.getPrototypeOf,Dt=Object.create,Ot=Array.prototype.slice,kt=`addEventListener`,At=`removeEventListener`,jt=B(kt),Mt=B(At),Nt=`true`,Pt=`false`,Ft=B(``);function It(e,t){return Zone.current.wrap(e,t)}function Lt(e,t,n,r,i){return Zone.current.scheduleMacroTask(e,t,n,r,i)}var V=B,Rt=typeof window<`u`,zt=Rt?window:void 0,H=Rt&&zt||globalThis,Bt=`removeAttribute`;function Vt(e,t){for(let n=e.length-1;n>=0;n--)typeof e[n]==`function`&&(e[n]=It(e[n],t+`_`+n));return e}function Ht(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(!Ut(wt(e,i)))continue;e[i]=(e=>{let t=function(){return e.apply(this,Vt(arguments,n+`.`+i))};return on(t,e),t})(a)}}}function Ut(e){return e?e.writable===!1?!1:!(typeof e.get==`function`&&e.set===void 0):!0}var Wt=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,Gt=!(`nw`in H)&&H.process!==void 0&&H.process.toString()===`[object process]`,Kt=!Gt&&!Wt&&!!(Rt&&zt.HTMLElement),qt=H.process!==void 0&&H.process.toString()===`[object process]`&&!Wt&&!!(Rt&&zt.HTMLElement),Jt={},Yt=V(`enable_beforeunload`),Xt=function(e){if(e=e||H.event,!e)return;let t=Jt[e.type];t||(t=Jt[e.type]=V(`ON_PROPERTY`+e.type));let n=this||e.target||H,r=n[t],i;if(Kt&&n===zt&&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`&&H[Yt]&&typeof i==`string`?e.returnValue=i:i!=null&&!i&&e.preventDefault();return i};function Zt(e,t,n){let r=wt(e,t);if(!r&&n&&wt(n,t)&&(r={enumerable:!0,configurable:!0}),!r||!r.configurable)return;let i=V(`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=Jt[s];c||(c=Jt[s]=V(`ON_PROPERTY`+s)),r.set=function(t){let n=this;!n&&e===H&&(n=H),n&&(typeof n[c]==`function`&&n.removeEventListener(s,Xt),o==null||o.call(n,null),n[c]=t,typeof t==`function`&&n.addEventListener(s,Xt,!1))},r.get=function(){let n=this;if(!n&&e===H&&(n=H),!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[Bt]==`function`&&n.removeAttribute(t),e}return null},Tt(e,t,r),e[i]=!0}function Qt(e,t,n){if(t)for(let r=0;r<t.length;r++)Zt(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++)Zt(e,t[r],n)}}var $t=V(`originalInstance`);function en(e){let t=H[e];if(!t)return;H[V(e)]=t,H[e]=function(){let n=Vt(arguments,e);switch(n.length){case 0:this[$t]=new t;break;case 1:this[$t]=new t(n[0]);break;case 2:this[$t]=new t(n[0],n[1]);break;case 3:this[$t]=new t(n[0],n[1],n[2]);break;case 4:this[$t]=new t(n[0],n[1],n[2],n[3]);break;default:throw Error(`Arg list too long.`)}},on(H[e],t);let n=new t(function(){}),r;for(r in n)e===`XMLHttpRequest`&&r===`responseBlob`||(function(t){typeof n[t]==`function`?H[e].prototype[t]=function(){return this[$t][t].apply(this[$t],arguments)}:Tt(H[e].prototype,t,{set:function(n){typeof n==`function`?(this[$t][t]=It(n,e+`.`+t),on(this[$t][t],n)):this[$t][t]=n},get:function(){return this[$t][t]}})})(r);for(r in t)r!==`prototype`&&t.hasOwnProperty(r)&&(H[e][r]=t[r])}function tn(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 nn=!1;function rn(e,t,n){let r=e;for(;r&&!r.hasOwnProperty(t);)r=Et(r);!r&&e[t]&&(r=e);let i=V(t),a=null;if(r&&(!(a=r[i])||!r.hasOwnProperty(i))&&(a=r[i]=r[t],Ut(r&&wt(r,t)))){let e=n(a,i,t);r[t]=function(){return e(this,arguments)},on(r[t],a),nn&&tn(a,r[t])}return a}function an(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=rn(e,t,e=>function(t,r){let a=n(t,r);return a.cbIdx>=0&&typeof r[a.cbIdx]==`function`?Lt(a.name,r[a.cbIdx],a,i):e.apply(t,r)})}function on(e,t){e[V(`OriginalDelegate`)]=t}function sn(e){return typeof e==`function`}function cn(e){return typeof e==`number`}var ln={useG:!0},un={},dn={},fn=RegExp(`^`+Ft+`(\\w+)(true|false)$`),pn=V(`propagationStopped`);function mn(e,t){let n=(t?t(e):e)+Pt,r=(t?t(e):e)+Nt,i=Ft+n,a=Ft+r;un[e]={},un[e][Pt]=i,un[e][Nt]=a}function hn(e,t,n,r){let i=r&&r.add||kt,a=r&&r.rm||At,o=r&&r.listeners||`eventListeners`,s=r&&r.rmAll||`removeAllListeners`,c=V(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[un[r.type][i?Nt:Pt]];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[pn]===!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=Et(g);if(!g&&t[i]&&(g=t),!g||g[c])return!1;let _=n&&n.eventNameToString,v={},y=g[c]=g[i],b=g[V(a)]=g[a],x=g[V(o)]=g[o],S=g[V(s)]=g[s],C;n&&n.prepend&&(C=g[V(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?xt(bt({},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=un[e.eventName],n;t&&(n=t[e.capture?Nt:Pt]);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)},te=function(e){return b.call(e.target,e.eventName,e.invoke,e.options)},O=r?T:D,k=r?E:te,ne=(n==null?void 0:n.diff)||function(e,t){let n=typeof t;return n===`function`&&e.callback===t||n===`object`&&e.originalDelegate===t},A=Zone[V(`UNPATCHED_EVENTS`)],re=e[V(`PASSIVE_EVENTS`)];function ie(e){if(typeof e==`object`&&e){let t=bt({},e);return e.signal&&(t.signal=e.signal),t}return e}let j=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||Gt&&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=!!re&&re.indexOf(u)!==-1,g=ie(w(arguments[2],h)),y=g==null?void 0:g.signal;if(y!=null&&y.aborted)return;if(A){for(let e=0;e<A.length;e++)if(u===A[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=un[u];C||(mn(u,_),C=un[u]);let T=C[b?Nt:Pt],E=l[T],D=!1;if(E){if(D=!0,f){for(let e=0;e<E.length;e++)if(ne(E[e],p))return}}else E=l[T]=[];let ee,te=l.constructor.name,O=dn[te];O&&(ee=O[u]),ee||(ee=te+i+(_?_(u):u)),v.options=g,x&&(v.options.once=!1),v.target=l,v.capture=b,v.eventName=u,v.isExisting=D;let k=r?ln:void 0;k&&(k.taskData=v),y&&(v.options.signal=void 0);let j=S.scheduleEventTask(ee,p,k,a,o);if(y){v.options.signal=y;let e=()=>j.zone.cancelTask(j);t.call(y,`abort`,e,{once:!0}),j.removeAbortListener=()=>y.removeEventListener(`abort`,e)}if(v.target=null,k&&(k.taskData=null),x&&(v.options.once=!0),typeof j.options!=`boolean`&&(j.options=g),j.target=l,j.capture=b,j.eventName=u,m&&(j.originalDelegate=p),c?E.unshift(j):E.push(j),s)return l}};return g[i]=j(y,l,O,k,h),C&&(g[u]=j(C,`.prependListener:`,ee,k,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=un[r],c;s&&(c=s[a?Nt:Pt]);let l=c&&t[c];if(l)for(let e=0;e<l.length;e++){let n=l[e];if(ne(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=Ft+`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=gn(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=un[r];if(e){let n=e[Pt],i=e[Nt],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=fn.exec(n),i=r&&r[1];i&&i!==`removeListener`&&this[s].call(this,i)}this[s].call(this,`removeListener`)}if(h)return this},on(g[i],y),on(g[a],b),S&&on(g[s],S),x&&on(g[o],x),!0}let g=[];for(let e=0;e<n.length;e++)g[e]=h(n[e],r);return g}function gn(e,t){if(!t){let n=[];for(let r in e){let i=fn.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=un[t];n||(mn(t),n=un[t]);let r=e[n[Pt]],i=e[n[Nt]];return r?i?r.concat(i):r.slice():i?i.slice():[]}function _n(e,t){let n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,`stopImmediatePropagation`,e=>function(t,n){t[pn]=!0,e&&e.apply(t,n)})}function vn(e,t){t.patchMethod(e,`queueMicrotask`,e=>function(e,t){Zone.current.scheduleMicroTask(`queueMicrotask`,t[0])})}var yn=V(`zoneTask`);function bn(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 cn(r)?n.handleId=r:(n.handle=r,n.isRefreshable=sn(r.refresh)),t}function c(t){let{handle:n,handleId:r}=t.data;return a.call(e,n==null?r:n)}i=rn(e,t,n=>function(i,a){var l;if(sn(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[yn]=null))}};let i=Lt(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[yn]=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=rn(e,n,t=>function(n,r){let i=r[0],a;cn(i)?(a=o[i],delete o[i]):(a=i==null?void 0:i[yn],a?i[yn]=null:a=i),a!=null&&a.type?a.cancelFn&&a.zone.cancelTask(a):t.apply(e,r)})}function xn(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 Sn(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 Cn(e,t){t.patchEventPrototype(e,t)}function wn(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 Tn(e,t,n,r){e&&Qt(e,wn(e,t,n),r)}function En(e){return Object.getOwnPropertyNames(e).filter(e=>e.startsWith(`on`)&&e.length>2).map(e=>e.substring(2))}function Dn(e,t){if(Gt&&!qt||Zone[e.symbol(`patchEvents`)])return;let n=t.__Zone_ignore_on_properties,r=[];if(Kt){let e=window;r=r.concat([`Document`,`SVGElement`,`Element`,`HTMLElement`,`HTMLBodyElement`,`HTMLMediaElement`,`HTMLFrameSetElement`,`HTMLFrameElement`,`HTMLIFrameElement`,`HTMLMarqueeElement`,`Worker`]),Tn(e,En(e),n,Et(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&&Tn(i.prototype,En(i.prototype),n)}}function On(e){e.__load_patch(`timers`,e=>{let t=`clear`;bn(e,`set`,t,`Timeout`),bn(e,`set`,t,`Interval`),bn(e,`set`,t,`Immediate`)}),e.__load_patch(`requestAnimationFrame`,e=>{bn(e,`request`,`cancel`,`AnimationFrame`),bn(e,`mozRequest`,`mozCancel`,`AnimationFrame`),bn(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];rn(e,i,(n,r,i)=>function(r,a){return t.current.run(n,e,a,i)})}}),e.__load_patch(`EventTarget`,(e,t,n)=>{Cn(e,n),Sn(e,n);let r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,n,[r.prototype])}),e.__load_patch(`MutationObserver`,(e,t,n)=>{en(`MutationObserver`),en(`WebKitMutationObserver`)}),e.__load_patch(`IntersectionObserver`,(e,t,n)=>{en(`IntersectionObserver`)}),e.__load_patch(`FileReader`,(e,t,n)=>{en(`FileReader`)}),e.__load_patch(`on_property`,(e,t,n)=>{Dn(n,e)}),e.__load_patch(`customElements`,(e,t,n)=>{xn(e,n)}),e.__load_patch(`XHR`,(e,t)=>{c(e);let n=V(`xhrTask`),r=V(`xhrSync`),i=V(`xhrListener`),a=V(`xhrScheduled`),o=V(`xhrURL`),s=V(`xhrErrorBeforeScheduled`);function c(e){let c=e.XMLHttpRequest;if(!c)return;let l=c.prototype;function u(e){return e[n]}let d=l[jt],f=l[Mt];if(!d){let t=e.XMLHttpRequestEventTarget;if(t){let e=t.prototype;d=e[jt],f=e[Mt]}}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[jt],f=o[Mt]),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=rn(l,`open`,()=>function(e,t){return e[r]=t[2]==0,e[o]=t[1],v.apply(e,t)}),y=V(`fetchTaskAborting`),b=V(`fetchTaskScheduling`),x=rn(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=Lt(`XMLHttpRequest.send`,g,t,h,_);e&&e[s]===!0&&!t.aborted&&r.state===m&&r.invoke()}}),S=rn(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&&Ht(e.navigator.geolocation,[`getCurrentPosition`,`watchPosition`])}),e.__load_patch(`PromiseRejectionEvent`,(e,t)=>{function n(t){return function(n){gn(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[V(`unhandledPromiseRejectionHandler`)]=n(`unhandledrejection`),t[V(`rejectionHandledHandler`)]=n(`rejectionhandled`))}),e.__load_patch(`queueMicrotask`,(e,t,n)=>{vn(e,n)})}function kn(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 O.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 O&&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(){},te=e.AggregateError;class O{static toString(){return`function ZoneAwarePromise() { [native code] }`}static resolve(e){return e instanceof O?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 O((t,n)=>{e.resolve=t,e.reject=n}),e}static any(e){if(!e||typeof e[Symbol.iterator]!=`function`)return Promise.reject(new te([],`All promises were rejected`));let t=[],n=0;try{for(let r of e)n++,t.push(O.resolve(r))}catch(e){return Promise.reject(new te([],`All promises were rejected`))}if(n===0)return Promise.reject(new te([],`All promises were rejected`));let r=!1,i=[];return new O((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 te(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 O.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof O?this:O).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 O))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 O}then(e,n){var r;let i=(r=this.constructor)==null?void 0:r[Symbol.species];(!i||typeof i!=`function`)&&(i=this.constructor||O);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=O);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}}O.resolve=O.resolve,O.reject=O.reject,O.race=O.race,O.all=O.all;let k=e[l]=e.Promise;e.Promise=O;let ne=o(`thenPatched`);function A(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 O((e,t)=>{i.call(this,e,t)}).then(e,t)},e[ne]=!0}n.patchThen=A;function re(e){return function(t,n){let r=e.apply(t,n);if(r instanceof O)return r;let i=r.constructor;return i[ne]||A(i),r}}if(k){A(k);let t=k.try;t&&typeof t==`function`&&(O.try=t),rn(e,`fetch`,e=>re(e))}return Promise[t.__symbol__(`uncaughtPromiseErrors`)]=s,O})}function An(e){e.__load_patch(`toString`,e=>{let t=Function.prototype.toString,n=V(`OriginalDelegate`),r=V(`Promise`),i=V(`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 jn(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 Mn(e){e.__load_patch(`util`,(e,t,n)=>{let r=En(e);n.patchOnProperties=Qt,n.patchMethod=rn,n.bindArguments=Vt,n.patchMacroTask=an;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=_n,n.patchEventTarget=hn,n.ObjectDefineProperty=Tt,n.ObjectGetOwnPropertyDescriptor=wt,n.ObjectCreate=Dt,n.ArraySlice=Ot,n.patchClass=en,n.wrapWithCurrentZone=It,n.filterProperties=wn,n.attachOriginToPatched=on,n._redefineProperty=Object.defineProperty,n.patchCallbacks=jn,n.getGlobalObjects=()=>({globalSources:dn,zoneSymbolEventNames:un,eventNames:r,isBrowser:Kt,isMix:qt,isNode:Gt,TRUE_STR:Nt,FALSE_STR:Pt,ZONE_SYMBOL_PREFIX:Ft,ADD_EVENT_LISTENER_STR:kt,REMOVE_EVENT_LISTENER_STR:At})})}function Nn(e){kn(e),An(e),Mn(e)}var Pn=Ct();Nn(Pn),On(Pn);var Fn=w(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function In(e){return e.setValue(Fn,!0)}function Ln(e){return e.getValue(Fn)===!0}var Rn=`baggage`,zn=4096;function Bn(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Vn(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 Hn(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 Un=class{inject(e,t,n){let r=nt.getBaggage(e);if(!r||Ln(e))return;let i=Bn(Vn(r).filter(e=>e.length<=zn).slice(0,180));i.length>0&&n.set(t,Rn,i)}extract(e,t,n){let r=n.get(t,Rn),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=Hn(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:nt.setBaggage(e,nt.createBaggage(a))}fields(){return[Rn]}};function Wn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Gn(n)){P.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Kn(r)){P.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Gn(e){return typeof e==`string`&&e!==``}function Kn(e){return e==null?!0:Array.isArray(e)?qn(e):Jn(typeof e)}function qn(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Jn(e)){t=e;continue}return!1}return!1}}return!0}function Jn(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function Yn(){return e=>{P.error(Xn(e))}}function Xn(e){return typeof e==`string`?e:JSON.stringify(Zn(e))}function Zn(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 Qn=Yn();function $n(e){try{Qn(e)}catch(e){}}var er=`2.7.1`,tr=`exception.message`,nr=`exception.stacktrace`,rr=`exception.type`,ir=`service.name`,ar=`telemetry.sdk.language`,or=`webjs`,sr=`telemetry.sdk.name`,cr=`telemetry.sdk.version`,lr=`process.runtime.name`,ur={[sr]:`opentelemetry`,[lr]:`browser`,[ar]:or,[cr]:er},dr=performance,fr=9,pr=Math.pow(10,6),mr=Math.pow(10,fr);function hr(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*pr)]}function gr(e){return wr(hr(dr.timeOrigin),hr(typeof e==`number`?e:dr.now()))}function _r(e){if(Sr(e))return e;if(typeof e==`number`)return e<dr.timeOrigin?gr(e):hr(e);if(e instanceof Date)return hr(e.getTime());throw TypeError(`Invalid input type`)}function vr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=mr),[n,r]}function yr(e){return e[0]*mr+e[1]}function br(e){return e[0]*1e3+e[1]/1e6}function xr(e){return e[0]*1e6+e[1]/1e3}function Sr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Cr(e){return Sr(e)||typeof e==`number`||e instanceof Date}function wr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=mr&&(n[1]-=mr,n[0]+=1),n}var U;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(U||(U={})),L();var Tr=class{constructor(e={}){var t;I(this,`_propagators`,void 0),I(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()}},Er=`[_0-9a-z-*/]`,Dr=`[a-z]${Er}{0,255}`,Or=`[a-z0-9]${Er}{0,240}@[a-z]${Er}{0,13}`,kr=RegExp(`^(?:${Dr}|${Or})$`),Ar=/^[ -~]{0,255}[!-~]$/,jr=/,|=/;function Mr(e){return kr.test(e)}function Nr(e){return Ar.test(e)&&!jr.test(e)}L();var Pr=32,Fr=512,Ir=`,`,Lr=`=`,Rr=class e{constructor(e){I(this,`_length`,void 0),I(this,`_rawTraceState`,void 0),I(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Mr(e)||!Nr(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>Fr)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=Ir+e),e=`${n[0]}${Lr}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Ir),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Lr);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Mr(a)||!Nr(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Fr)&&(t.set(a,o),n=s,t.size>=Pr))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}},zr=`traceparent`,Br=`tracestate`,Vr=`00`,Hr=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function Ur(e){let t=Hr.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Wr=class{inject(e,t,n){let r=F.getSpanContext(e);if(!r||Ln(e)||!Ne(r))return;let i=`${Vr}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||M.NONE).toString(16)}`;n.set(t,zr,i),r.traceState&&n.set(t,Br,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,zr);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Ur(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Br);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Rr(typeof e==`string`?e:void 0)}return F.setSpanContext(e,a)}fields(){return[zr,Br]}},Gr=`[object Object]`,Kr=`[object Null]`,qr=`[object Undefined]`,Jr=Function.prototype.toString,Yr=Jr.call(Object),Xr=Object.getPrototypeOf,Zr=Object.prototype,Qr=Zr.hasOwnProperty,$r=Symbol?Symbol.toStringTag:void 0,ei=Zr.toString;function ti(e){if(!ni(e)||ri(e)!==Gr)return!1;let t=Xr(e);if(t===null)return!0;let n=Qr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Jr.call(n)===Yr}function ni(e){return typeof e==`object`&&!!e}function ri(e){return e==null?e===void 0?qr:Kr:$r&&$r in Object(e)?ii(e):ai(e)}function ii(e){let t=Qr.call(e,$r),n=e[$r],r=!1;try{e[$r]=void 0,r=!0}catch(e){}let i=ei.call(e);return r&&(t?e[$r]=n:delete e[$r]),i}function ai(e){return ei.call(e)}var oi=20;function si(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=li(t,e.shift(),0,n);return t}function ci(e){return di(e)?e.slice():e}function li(e,t,n=0,r){let i;if(!(n>oi)){if(n++,mi(e)||mi(t)||fi(t))i=ci(t);else if(di(e)){if(i=e.slice(),di(t))for(let e=0,n=t.length;e<n;e++)i.push(ci(t[e]));else if(pi(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]=ci(t[r]))}}}else if(pi(e))if(pi(t)){if(!hi(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(mi(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(ui(e,s,r)||ui(t,s,r))delete i[s];else{if(pi(a)&&pi(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]=li(i[s],c,n,r)}}}}else i=t;return i}}function ui(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 di(e){return Array.isArray(e)}function fi(e){return typeof e==`function`}function pi(e){return!mi(e)&&!di(e)&&!fi(e)&&typeof e==`object`}function mi(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function hi(e,t){return!(!ti(e)||!ti(t))}var gi=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function _i(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new gi(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}L();var vi=class{constructor(){I(this,`_promise`,void 0),I(this,`_resolve`,void 0),I(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)}};L();var yi=class{constructor(e,t){I(this,`_isCalled`,!1),I(this,`_deferred`,new vi),I(this,`_callback`,void 0),I(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 bi(e,t){return new Promise(n=>{N.with(In(N.active()),()=>{e.export(t,n)})})}var xi={_export:bi};L();var Si=class{constructor(e){I(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()}};L();var Ci=class extends Error{constructor(e,t,n){super(e),I(this,`code`,void 0),I(this,`name`,`OTLPExporterError`),I(this,`data`,void 0),this.data=n,this.code=t}};function wi(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 W(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){wi(a,r,i,o,s,`next`,e)}function s(e){wi(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Ti(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Ei(e){if(e!=null)return W(function*(){return e})}function Di(e,t,n){var r,i,a,o,s,c;return{timeoutMillis:Ti((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 Oi(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}L();var ki=class{constructor(e){I(this,`_concurrencyLimit`,void 0),I(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 W(function*(){yield Promise.all(e._sendingPromises)})()}};function Ai(e){return new ki(e.concurrencyLimit)}function ji(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Mi(){return{handleResponse(e){e==null||!ji(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||P.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}L();var Ni=class{constructor(e,t,n,r,i){I(this,`_diagLogger`,void 0),I(this,`_transport`,void 0),I(this,`_serializer`,void 0),I(this,`_responseHandler`,void 0),I(this,`_promiseQueue`,void 0),I(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:U.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:U.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:U.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:U.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:U.FAILED,error:(n=e.error)==null?new Ci(`Export failed with retryable status`):n})}else t({code:U.FAILED,error:new Ci(`Export failed with unknown error`)})},e=>t({code:U.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return W(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function Pi(e,t){return new Ni(e.transport,e.serializer,Mi(),e.promiseHandler,t.timeout)}function Fi(e,t,n){return Pi({transport:n,serializer:t,promiseHandler:Ai(e)},{timeout:e.timeoutMillis})}var Ii;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(Ii||(Ii={}));var Li=class{emit(e){}enabled(){return!1}},Ri=new Li,zi=Symbol.for(`io.opentelemetry.js.api.logs`),Bi=globalThis;function Vi(e,t,n){return r=>r===e?t:n}var Hi=new class{getLogger(e,t,n){return new Li}},Ui=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ri}},Wi=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new Ui(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?Hi:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}},Gi=class e{constructor(){this._proxyLoggerProvider=new Wi}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return Bi[zi]?this.getLoggerProvider():(Bi[zi]=Vi(1,e,Hi),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=Bi[zi])==null?void 0:e.call(Bi,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Bi[zi],this._proxyLoggerProvider=new Wi}}.getInstance(),Ki;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Ki||(Ki={}));var G;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(G||(G={}));var qi;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(qi||(qi={}));function Ji(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Yi(e){var t,n;return`${e.name}:${(t=e.version)==null?``:t}:${(n=e.schemaUrl)==null?``:n}`}var Xi=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Zi(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Xi(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Qi(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function $i(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function ea(e,t){return e.toLowerCase()===t.toLowerCase()}var ta;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(ta||(ta={})),L();var na=class{constructor(){I(this,`kind`,ta.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};L();function ra(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var ia=class{constructor(e,t,n=!0,r=ra(t)){I(this,`startTime`,void 0),I(this,`_boundaries`,void 0),I(this,`_recordMinMax`,void 0),I(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=$i(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},aa=class{constructor(e,t){I(this,`kind`,ta.HISTOGRAM),I(this,`_boundaries`,void 0),I(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new ia(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new ia(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new ia(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:qi.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===G.GAUGE||e.type===G.UP_DOWN_COUNTER||e.type===G.OBSERVABLE_GAUGE||e.type===G.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};L();var oa=class e{constructor(e=new sa,t=0,n=0,r=0){I(this,`backing`,void 0),I(this,`indexBase`,void 0),I(this,`indexStart`,void 0),I(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},sa=class e{constructor(e=[0]){I(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},ca=2146435072,la=1048575,ua=1023,da=-ua+1,fa=ua,pa=Math.pow(2,-1022);function ma(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&ca)>>20)-ua}function ha(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&la)*Math.pow(2,32)+r}function ga(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*Math.pow(2,t)}function _a(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var va=class extends Error{};L();var ya=class{constructor(e){I(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<pa?this._minNormalLowerBoundaryIndex():ma(e)+this._rightShift(ha(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new va(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new va(`overflow: ${e} is > maximum lower boundary: ${n}`);return ga(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=da>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return fa>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}};L();var ba=class{constructor(e){I(this,`_scale`,void 0),I(this,`_scaleFactor`,void 0),I(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=ga(Math.LOG2E,e),this._inverseFactor=ga(Math.LN2,-e)}mapToIndex(e){if(e<=pa)return this._minNormalLowerBoundaryIndex()-1;if(ha(e)===0)return(ma(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new va(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return pa;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new va(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return da<<this._scale}_maxNormalLowerBoundaryIndex(){return(fa+1<<this._scale)-1}},xa=-10,Sa=20,Ca=Array.from({length:31},(e,t)=>t>10?new ba(t-10):new ya(t-10));function wa(e){if(e>Sa||e<xa)throw new va(`expected scale >= ${xa} && <= ${Sa}, got: ${e}`);return Ca[e+10]}L();var Ta=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){I(this,`low`,void 0),I(this,`high`,void 0),this.low=e,this.high=t}},Ea=20,Da=160,Oa=2,ka=class e{constructor(e,t=Da,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new oa,l=new oa,u=wa(Ea)){I(this,`startTime`,void 0),I(this,`_maxSize`,void 0),I(this,`_recordMinMax`,void 0),I(this,`_sum`,void 0),I(this,`_count`,void 0),I(this,`_zeroCount`,void 0),I(this,`_min`,void 0),I(this,`_max`,void 0),I(this,`_positive`,void 0),I(this,`_negative`,void 0),I(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<Oa&&(P.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
3
|
+
changing to the minimum size of: ${Oa}`),this._maxSize=Oa)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=_a(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=wa(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=Ta.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=Ta.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new Ta(0,-1);let r=t-n;return new Ta(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},Aa=class{constructor(e,t){I(this,`kind`,ta.EXPONENTIAL_HISTOGRAM),I(this,`_maxSize`,void 0),I(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new ka(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:qi.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===G.GAUGE||e.type===G.UP_DOWN_COUNTER||e.type===G.OBSERVABLE_GAUGE||e.type===G.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}};L();var ja=class{constructor(e,t=0,n=[0,0]){I(this,`startTime`,void 0),I(this,`_current`,void 0),I(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=hr(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Ma=class{constructor(){I(this,`kind`,ta.LAST_VALUE)}createAccumulation(e){return new ja(e)}merge(e,t){let n=xr(t.sampleTime)>=xr(e.sampleTime)?t:e;return new ja(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=xr(t.sampleTime)>=xr(e.sampleTime)?t:e;return new ja(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:qi.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}};L();var Na=class{constructor(e,t,n=0,r=!1){I(this,`startTime`,void 0),I(this,`monotonic`,void 0),I(this,`_current`,void 0),I(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Pa=class{constructor(e){I(this,`kind`,ta.SUM),I(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new Na(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new Na(t.startTime,this.monotonic,r,t.reset):new Na(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new Na(t.startTime,this.monotonic,r,!0):new Na(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:qi.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};L();var Fa=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};I(Fa,`DEFAULT_INSTANCE`,new na);var Ia=class e{createAggregator(t){switch(t.type){case G.COUNTER:case G.OBSERVABLE_COUNTER:case G.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};I(Ia,`MONOTONIC_INSTANCE`,new Pa(!0)),I(Ia,`NON_MONOTONIC_INSTANCE`,new Pa(!1));var La=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};I(La,`DEFAULT_INSTANCE`,new Ma);var Ra=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};I(Ra,`DEFAULT_INSTANCE`,new aa([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var za=class{constructor(e,t=!0){if(I(this,`_boundaries`,void 0),I(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new aa(this._boundaries,this._recordMinMax)}},Ba=class{constructor(e=160,t=!0){I(this,`_maxSize`,void 0),I(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new Aa(this._maxSize,this._recordMinMax)}},Va=class{_resolve(e){switch(e.type){case G.COUNTER:case G.UP_DOWN_COUNTER:case G.OBSERVABLE_COUNTER:case G.OBSERVABLE_UP_DOWN_COUNTER:return Ua;case G.GAUGE:case G.OBSERVABLE_GAUGE:return Wa;case G.HISTOGRAM:return e.advice.explicitBucketBoundaries?new za(e.advice.explicitBucketBoundaries):Ga}return P.warn(`Unable to recognize instrument type: ${e.type}`),Ha}createAggregator(e){return this._resolve(e).createAggregator(e)}},Ha=new Fa,Ua=new Ia,Wa=new La,Ga=new Ra;new Ba;var Ka=new Va,qa;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(qa||(qa={}));function Ja(e){switch(e.type){case qa.DEFAULT:return Ka;case qa.DROP:return Ha;case qa.SUM:return Ua;case qa.LAST_VALUE:return Wa;case qa.EXPONENTIAL_HISTOGRAM:{var t,n;let r=e;return new Ba((t=r.options)==null?void 0:t.maxSize,(n=r.options)==null?void 0:n.recordMinMax)}case qa.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;if(t.options==null)return Ga;var r,i;return new za((r=t.options)==null?void 0:r.boundaries,(i=t.options)==null?void 0:i.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Ya=e=>({type:qa.DEFAULT}),Xa=e=>Ki.CUMULATIVE;L();var Za=class{constructor(e){var t,n,r;I(this,`_shutdown`,!1),I(this,`_metricProducers`,void 0),I(this,`_sdkMetricProducer`,void 0),I(this,`_aggregationTemporalitySelector`,void 0),I(this,`_aggregationSelector`,void 0),I(this,`_cardinalitySelector`,void 0),this._aggregationSelector=(t=e==null?void 0:e.aggregationSelector)==null?Ya:t,this._aggregationTemporalitySelector=(n=e==null?void 0:e.aggregationTemporalitySelector)==null?Xa:n,this._metricProducers=(r=e==null?void 0:e.metricProducers)==null?[]:r,this._cardinalitySelector=e==null?void 0:e.cardinalitySelector}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}collect(e){var t=this;return W(function*(){if(t._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(t._shutdown)throw Error(`MetricReader is shutdown`);let[n,...r]=yield Promise.all([t._sdkMetricProducer.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}),...t._metricProducers.map(t=>t.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}))]),i=n.errors.concat(r.flatMap(e=>e.errors));return{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:i}})()}shutdown(e){var t=this;return W(function*(){if(t._shutdown){P.error(`Cannot call shutdown twice.`);return}(e==null?void 0:e.timeoutMillis)==null?yield t.onShutdown():yield Zi(t.onShutdown(),e.timeoutMillis),t._shutdown=!0})()}forceFlush(e){var t=this;return W(function*(){if(t._shutdown){P.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if((e==null?void 0:e.timeoutMillis)==null){yield t.onForceFlush();return}yield Zi(t.onForceFlush(),e.timeoutMillis)})()}};function Qa(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?Qa(Object(n),!0).forEach(function(t){I(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var q=t((()=>{L()}));L(),q();var $a=class extends Za{constructor(e){var t,n;let{exporter:r,exportIntervalMillis:i=6e4,metricProducers:a,cardinalityLimits:o}=e,{exportTimeoutMillis:s=3e4}=e;if(super({aggregationSelector:(t=r.selectAggregation)==null?void 0:t.bind(r),aggregationTemporalitySelector:(n=r.selectAggregationTemporality)==null?void 0:n.bind(r),metricProducers:a,cardinalitySelector:e=>{let t=K({default:2e3},o);switch(e){case G.COUNTER:var n;return(n=t.counter)==null?t.default:n;case G.GAUGE:var r;return(r=t.gauge)==null?t.default:r;case G.HISTOGRAM:var i;return(i=t.histogram)==null?t.default:i;case G.OBSERVABLE_COUNTER:var a;return(a=t.observableCounter)==null?t.default:a;case G.OBSERVABLE_UP_DOWN_COUNTER:var s;return(s=t.observableUpDownCounter)==null?t.default:s;case G.OBSERVABLE_GAUGE:var c;return(c=t.observableGauge)==null?t.default:c;case G.UP_DOWN_COUNTER:var l;return(l=t.upDownCounter)==null?t.default:l;default:return t.default}}}),I(this,`_interval`,void 0),I(this,`_exporter`,void 0),I(this,`_exportInterval`,void 0),I(this,`_exportTimeout`,void 0),i<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(s<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(i<s){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);P.info(`Timeout of ${s} exceeds the interval of ${i}. Clamping timeout to interval duration.`),s=i}this._exportInterval=i,this._exportTimeout=s,this._exporter=r}_runOnce(){var e=this;return W(function*(){try{yield Zi(e._doRun(),e._exportTimeout)}catch(t){if(t instanceof Xi){P.error(`Export took longer than %s milliseconds and timed out.`,e._exportTimeout);return}$n(t)}})()}_doRun(){var e=this;return W(function*(){let{resourceMetrics:t,errors:n}=yield e.collect({timeoutMillis:e._exportTimeout});if(n.length>0&&P.error(`PeriodicExportingMetricReader: metrics collection errors`,...n),t.resource.asyncAttributesPending)try{var r,i;yield(r=(i=t.resource).waitForAsyncAttributes)==null?void 0:r.call(i)}catch(e){P.debug(`Error while resolving async portion of resource: `,e),$n(e)}if(t.scopeMetrics.length===0)return;let a=yield xi._export(e._exporter,t);if(a.code!==U.SUCCESS)throw Error(`PeriodicExportingMetricReader: metrics export failed (error ${a.error})`)})()}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}onForceFlush(){var e=this;return W(function*(){yield e._runOnce(),yield e._exporter.forceFlush()})()}onShutdown(){var e=this;return W(function*(){e._interval&&clearInterval(e._interval),yield e.onForceFlush(),yield e._exporter.shutdown()})()}},eo;function to(){if(eo===void 0)try{let e=globalThis.process.argv0;eo=e?`unknown_service:${e}`:`unknown_service`}catch(e){eo=`unknown_service`}return eo}var no=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;L();var ro=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=oo(t),r._asyncAttributesPending=t.filter(([e,t])=>no(t)).length>0,r}constructor(e,t){var n;I(this,`_rawAttributes`,void 0),I(this,`_asyncAttributesPending`,!1),I(this,`_schemaUrl`,void 0),I(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(no(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=oo(this._rawAttributes),this._schemaUrl=so(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return W(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,no(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(no(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=co(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function io(e,t){return ro.FromAttributeList(Object.entries(e),t)}function ao(){return io({[ir]:to(),[ar]:ur[ar],[sr]:ur[sr],[cr]:ur[cr]})}function oo(e){return e.map(([e,t])=>no(t)?[e,t.catch(t=>{P.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function so(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 co(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)}L();var lo=class{constructor(){I(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};function uo(e,t,n){var r,i,a,o;return ho(e)||P.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:(r=n==null?void 0:n.description)==null?``:r,unit:(i=n==null?void 0:n.unit)==null?``:i,valueType:(a=n==null?void 0:n.valueType)==null?pe.DOUBLE:a,advice:(o=n==null?void 0:n.advice)==null?{}:o}}function fo(e,t){var n,r;return{name:(n=e.name)==null?t.name:n,description:(r=e.description)==null?t.description:r,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function po(e,t){return ea(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var mo=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function ho(e){return mo.test(e)}L();var go=class{constructor(e,t){I(this,`_writableMetricStorage`,void 0),I(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n=N.active()){if(typeof e!=`number`){P.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===pe.INT&&!Number.isInteger(e)&&(P.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,hr(Date.now()))}},_o=class extends go{add(e,t,n){this._record(e,t,n)}},vo=class extends go{add(e,t,n){if(e<0){P.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},yo=class extends go{record(e,t,n){this._record(e,t,n)}},bo=class extends go{record(e,t,n){if(e<0){P.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},xo=class{constructor(e,t,n){I(this,`_metricStorages`,void 0),I(this,`_descriptor`,void 0),I(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},So=class extends xo{},Co=class extends xo{},wo=class extends xo{};function To(e){return e instanceof xo}L();var Eo=class{constructor(e){I(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=uo(e,G.GAUGE,t);return new yo(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=uo(e,G.HISTOGRAM,t);return new bo(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=uo(e,G.COUNTER,t);return new vo(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=uo(e,G.UP_DOWN_COUNTER,t);return new _o(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=uo(e,G.OBSERVABLE_GAUGE,t);return new Co(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=uo(e,G.OBSERVABLE_COUNTER,t);return new So(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=uo(e,G.OBSERVABLE_UP_DOWN_COUNTER,t);return new wo(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};L();var Do=class{constructor(e){I(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=uo(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};L();var Oo=class{constructor(e){I(this,`_valueMap`,new Map),I(this,`_keyMap`,new Map),I(this,`_hash`,void 0),this._hash=e}get(e,t){return t!=null||(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n!=null||(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t!=null||(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},ko=class extends Oo{constructor(){super(Ji)}};L();var Ao=class{constructor(e,t){I(this,`_activeCollectionStorage`,new ko),I(this,`_cumulativeMemoStorage`,new ko),I(this,`_cardinalityLimit`,void 0),I(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),I(this,`_overflowHashCode`,void 0),I(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t==null?2e3:t)-1,this._overflowHashCode=Ji(this._overflowAttributes)}record(e,t,n,r){let i=this._activeCollectionStorage.get(t);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){let t=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(r));t==null||t.record(e);return}i=this._aggregator.createAccumulation(r),this._activeCollectionStorage.set(t,i)}i==null||i.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o==null||o.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new ko,e}};L();var jo=class e{constructor(e,t){I(this,`_aggregator`,void 0),I(this,`_unreportedAccumulations`,new Map),I(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===Ki.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=Mo(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new ko,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys()){let e=t.get(r,i);e==null||e.setStartTime(n)}return t}};function Mo(e){return Array.from(e.entries())}L();var No=class extends Do{constructor(e,t,n,r,i){super(e),I(this,`_aggregationCardinalityLimit`,void 0),I(this,`_deltaMetricStorage`,void 0),I(this,`_temporalMetricStorage`,void 0),I(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ao(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new jo(t,r),this._attributesProcessor=n}record(e,t){let n=new ko;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function Po(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Fo(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Io(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Lo(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Ro(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
|
|
4
4
|
\t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
|
|
5
|
-
\t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function
|
|
5
|
+
\t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function zo(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Ro(e,t):Lo(e,t):Io(e,t):Fo(e,t)}L();var Bo=class e{constructor(){I(this,`_sharedRegistry`,new Map),I(this,`_perCollectorRegistry`,new Map)}static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n==null&&(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();po(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),P.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
|
|
6
6
|
`,`Details:
|
|
7
|
-
`,
|
|
8
|
-
To resolve the conflict:`,
|
|
7
|
+
`,Po(t,e),`The longer description will be used.
|
|
8
|
+
To resolve the conflict:`,zo(t,e))),n=r):P.warn(`A view or instrument with the name `,e.name,` has already been registered and is incompatible with another registered view.
|
|
9
9
|
`,`Details:
|
|
10
|
-
`,
|
|
11
|
-
`,zc(t,e))}return n}};F();var Vc=class{constructor(e){P(this,`_backingStorages`,void 0),this._backingStorages=e}record(e,t,n,r){let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}};N(),F();var Hc=class{constructor(e,t){P(this,`_buffer`,new kc),P(this,`_instrumentName`,void 0),P(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){j.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===ke.INT&&!Number.isInteger(e)&&(j.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},Uc=class{constructor(){P(this,`_buffer`,new Map)}observe(e,t,n={}){if(!Tc(e))return;let r=this._buffer.get(e);if(r==null&&(r=new kc,this._buffer.set(e,r)),typeof t!=`number`){j.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===ke.INT&&!Number.isInteger(t)&&(j.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}};N(),F(),H();var Wc=class{constructor(){P(this,`_callbacks`,[]),P(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(Tc));if(n.size===0){j.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(Tc)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}observe(e,t){var n=this;return V(function*(){let r=n._observeCallbacks(e,t),i=n._observeBatchCallbacks(e,t);return(yield Promise.allSettled([...r,...i])).filter(e=>e.status===`rejected`).map(e=>e.reason)})()}_observeCallbacks(e,t){return this._callbacks.map(function(){var n=V(function*({callback:n,instrument:r}){let i=new Hc(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=Jo(a,t)),yield a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})});return function(e){return n.apply(this,arguments)}}())}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(function(){var n=V(function*({callback:n,instruments:r}){let i=new Uc,a=Promise.resolve(n(i));t!=null&&(a=Jo(a,t)),yield a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})});return function(e){return n.apply(this,arguments)}}())}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&Yo(n.instruments,t))}};F();var Gc=class extends Dc{constructor(e,t,n,r,i){super(e),P(this,`_aggregationCardinalityLimit`,void 0),P(this,`_deltaMetricStorage`,void 0),P(this,`_temporalMetricStorage`,void 0),P(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ac(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new jc(t,r),this._attributesProcessor=n}record(e,t,n,r){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};F();var Kc=class{process(e,t){return e}},qc=class{constructor(e){P(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}};function Jc(){return Xc}function Yc(e){return new qc(e)}var Xc=new Kc;F(),H();var Zc=class{constructor(e,t){P(this,`metricStorageRegistry`,new Bc),P(this,`observableRegistry`,new Wc),P(this,`meter`,void 0),P(this,`_meterProviderSharedState`,void 0),P(this,`_instrumentationScope`,void 0),this.meter=new Ec(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,Gc);return t.length===1?t[0]:new Vc(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,Nc)}collect(e,t,n){var r=this;return V(function*(){let i=yield r.observableRegistry.observe(t,n==null?void 0:n.timeoutMillis),a=r.metricStorageRegistry.getStorages(e);if(a.length===0)return null;let o=[];return a.forEach(n=>{let r=n.collect(e,t);r!=null&&o.push(r)}),o.length===0?{errors:i}:{scopeMetrics:{scope:r._instrumentationScope,metrics:o},errors:i}})()}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=fc(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,Jc(),[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}};F();var Qc=class{constructor(e){P(this,`viewRegistry`,new uc),P(this,`metricCollectors`,[]),P(this,`meterSharedStates`,new Map),P(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=Ko(e),n=this.meterSharedStates.get(t);return n==null&&(n=new Zc(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Gs(n.selectAggregation(e))]);return t}};B(),F(),H();var $c=class{constructor(e,t){P(this,`_sharedState`,void 0),P(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}collect(e){var t=this;return V(function*(){let n=ra(Date.now()),r=[],i=[],a=Array.from(t._sharedState.meterSharedStates.values()).map(function(){var a=V(function*(a){let o=yield a.collect(t,n,e);(o==null?void 0:o.scopeMetrics)!=null&&r.push(o.scopeMetrics),(o==null?void 0:o.errors)!=null&&i.push(...o.errors)});return function(e){return a.apply(this,arguments)}}());return yield Promise.all(a),{resourceMetrics:{resource:t._sharedState.resource,scopeMetrics:r},errors:i}})()}forceFlush(e){var t=this;return V(function*(){yield t._metricReader.forceFlush(e)})()}shutdown(e){var t=this;return V(function*(){yield t._metricReader.shutdown(e)})()}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){var t,n,r;return(t=(n=(r=this._metricReader).selectCardinalityLimit)==null?void 0:n.call(r,e))==null?2e3:t}};F();var el=/[\^$\\.+?()[\]{}|]/g,tl=class e{constructor(t){P(this,`_matchAll`,void 0),P(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(el,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},nl=class{constructor(e){P(this,`_matchAll`,void 0),P(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};F();var rl=class{constructor(e){var t;P(this,`_nameFilter`,void 0),P(this,`_type`,void 0),P(this,`_unitFilter`,void 0),this._nameFilter=new tl((t=e==null?void 0:e.name)==null?`*`:t),this._type=e==null?void 0:e.type,this._unitFilter=new nl(e==null?void 0:e.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};F();var il=class{constructor(e){P(this,`_nameFilter`,void 0),P(this,`_versionFilter`,void 0),P(this,`_schemaUrlFilter`,void 0),this._nameFilter=new nl(e==null?void 0:e.name),this._versionFilter=new nl(e==null?void 0:e.version),this._schemaUrlFilter=new nl(e==null?void 0:e.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};F();function al(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function ol(e){if(al(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&((e==null?void 0:e.instrumentName)==null||tl.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var sl=class{constructor(e){var t;P(this,`name`,void 0),P(this,`description`,void 0),P(this,`aggregation`,void 0),P(this,`attributesProcessor`,void 0),P(this,`instrumentSelector`,void 0),P(this,`meterSelector`,void 0),P(this,`aggregationCardinalityLimit`,void 0),ol(e),e.attributesProcessors==null?this.attributesProcessor=Jc():this.attributesProcessor=Yc(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Gs((t=e.aggregation)==null?{type:Ws.DEFAULT}:t),this.instrumentSelector=new rl({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new il({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};N(),lc(),F(),H();var cl=class{constructor(e){var t;if(P(this,`_sharedState`,void 0),P(this,`_shutdown`,!1),this._sharedState=new Qc((t=e==null?void 0:e.resource)==null?rc():t),(e==null?void 0:e.views)!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new sl(t));if((e==null?void 0:e.readers)!=null&&e.readers.length>0)for(let t of e.readers){let e=new $c(this._sharedState,t);t.setMetricProducer(e),this._sharedState.metricCollectors.push(e)}}getMeter(e,t=``,n={}){return this._shutdown?(j.warn(`A shutdown MeterProvider cannot provide a Meter`),le()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}shutdown(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`shutdown may only be called once per MeterProvider`);return}t._shutdown=!0,yield Promise.all(t._sharedState.metricCollectors.map(t=>t.shutdown(e)))})()}forceFlush(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}yield Promise.all(t._sharedState.metricCollectors.map(t=>t.forceFlush(e)))})()}},ll;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]=`AGGREGATION_TEMPORALITY_UNSPECIFIED`,e[e.AGGREGATION_TEMPORALITY_DELTA=1]=`AGGREGATION_TEMPORALITY_DELTA`,e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]=`AGGREGATION_TEMPORALITY_CUMULATIVE`})(ll||(ll={}));function ul(e,t){let n={attributes:fl(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function dl(e){return{name:e.name,version:e.version}}function fl(e,t){return Object.keys(e).map(n=>pl(n,e[n],t))}function pl(e,t,n){return{key:e,value:ml(t,n)}}function ml(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]=ml(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:ml(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}N();function hl(e,t){let n=ul(e.resource,t);return{resource:n,schemaUrl:n.schemaUrl,scopeMetrics:gl(e.scopeMetrics,t)}}function gl(e,t){return Array.from(e.map(e=>({scope:dl(e.scope),metrics:e.metrics.map(e=>_l(e,t)),schemaUrl:e.scope.schemaUrl})))}function _l(e,t){let n={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},r=Sl(e.aggregationTemporality);switch(e.dataPointType){case Wo.SUM:n.sum={aggregationTemporality:r,isMonotonic:e.isMonotonic,dataPoints:yl(e,t)};break;case Wo.GAUGE:n.gauge={dataPoints:yl(e,t)};break;case Wo.HISTOGRAM:n.histogram={aggregationTemporality:r,dataPoints:bl(e,t)};break;case Wo.EXPONENTIAL_HISTOGRAM:n.exponentialHistogram={aggregationTemporality:r,dataPoints:xl(e,t)};break}return n}function vl(e,t,n){let r={attributes:fl(e.attributes,n),startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)};switch(t){case ke.INT:r.asInt=e.value;break;case ke.DOUBLE:r.asDouble=e.value;break}return r}function yl(e,t){return e.dataPoints.map(n=>vl(n,e.descriptor.valueType,t))}function bl(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:fl(e.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function xl(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:fl(e.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function Sl(e){switch(e){case Uo.DELTA:return ll.AGGREGATION_TEMPORALITY_DELTA;case Uo.CUMULATIVE:return ll.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Cl(e,t){return{resourceMetrics:e.map(e=>hl(e,t))}}B();function wl(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Tl(e){return wl(e).toString()}var El=typeof BigInt<`u`?Tl:sa;function Dl(e){return e}var Ol={encodeHrTime:El,encodeSpanContext:Dl,encodeOptionalSpanContext:Dl,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};function kl(e,t){return{resourceLogs:jl(e,t)}}function Al(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function jl(e,t){let n=Al(e);return Array.from(n,([e,n])=>{let r=ul(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:dl(e[0].instrumentationScope),logRecords:e.map(e=>Ml(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Ml(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Nl(e.severityNumber),severityText:e.severityText,body:ml(e.body,t),eventName:e.eventName,attributes:Pl(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:(n=e.spanContext)==null?void 0:n.traceFlags,traceId:t.encodeOptionalSpanContext((r=e.spanContext)==null?void 0:r.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)==null?void 0:i.spanId)}}function Nl(e){return e}function Pl(e,t){return Object.keys(e).map(n=>pl(n,e[n],t))}N();var Fl={serializeRequest:e=>{let t=kl(e,Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return j.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};N();var Il={serializeRequest:e=>{let t=Cl([e],Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return j.warn(`Failed to parse metrics export response: ${e.message}. Returning empty response`),{}}}},Ll=256,Rl=512;function zl(e,t){let n=e&255|Ll;return t&&(n|=Rl),n}function Bl(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:fl(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Hl(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Vl(e,t)),droppedLinksCount:e.droppedLinksCount,flags:zl(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Vl(e,t){var n;return{attributes:e.attributes?fl(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:zl(e.context.traceFlags,e.context.isRemote)}}function Hl(e,t){return{attributes:e.attributes?fl(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ul(e,t){return{resourceSpans:Gl(e,t)}}function Wl(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 Gl(e,t){let n=Wl(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=>Bl(e,t));o.push({scope:dl(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=ul(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}N();var Kl={serializeRequest:e=>{let t=Ul(e,Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return j.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};N(),F(),H();var ql=5,Jl=1e3,Yl=5e3,Xl=1.5,Zl=.2;function Ql(){return 2*Zl*Math.random()-Zl}var $l=class{constructor(e){P(this,`_transport`,void 0),this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}send(e,t){var n=this;return V(function*(){let r=ql,i=Jl,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+Ql()),Yl),0);i*=Xl;let c=(s=o.retryInMillis)==null?t:s,l=a-Date.now();if(c>l)return j.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),o;j.verbose(`Scheduling export retry in ${Math.round(c)}ms`),o=yield n.retry(e,l,c)}return o.status===`success`?j.verbose(`Export succeeded after ${ql-r} retry attempts.`):o.status===`retryable`?j.info(`Export failed after maximum retry attempts (${ql}).`):j.info(`Export failed with non-retryable error: ${o.error}`),o})()}shutdown(){return this._transport.shutdown()}};function eu(e){return new $l(e.transport)}function tu(e){return e===429||e===502||e===503||e===504}function nu(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}N(),F(),H();var ru=60*1024,iu=9,au=0,ou=0,su=class{constructor(e){P(this,`_parameters`,void 0),this._parameters=e}send(e,t){var n=this;return V(function*(){let r=new AbortController,i=setTimeout(()=>r.abort(),t),a=globalThis.fetch;typeof a.__original==`function`&&(a=a.__original);let o=e.byteLength,s=au+o>ru,c=!s&&!(ou>=iu);if(c)au+=o,ou++;else{let e=s?`size limit`:`count limit`;j.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${ou} 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?(j.debug(`export response success (status: ${i.status})`),{status:`success`}):tu(i.status)?(j.warn(`export response retryable (status: ${i.status})`),{status:`retryable`,retryInMillis:nu(i.headers.get(`Retry-After`))}):(j.error(`export response failure (status: ${i.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${i.status}`)})}catch(e){return lu(e)?(j.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(j.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(i),c&&(au-=o,ou--)}})()}shutdown(){}};function cu(e){return new su(e)}function lu(e){return e instanceof TypeError&&!e.cause}function uu(e,t){return Ho(e,t,eu({transport:cu(e)}))}N();function du(e){let t={};return Object.entries(e==null?{}:e).forEach(([e,n])=>{n===void 0?j.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}G(),H();function fu(e,t,n){return V(function*(){let r=W({},yield n()),i={};return t!=null&&Object.assign(i,yield t()),e!=null&&Object.assign(i,du(yield e())),Object.assign(i,r)})}function pu(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 mu(e,t,n){var r,i;return W(W({},Po(e,t,n)),{},{headers:fu(e.headers,t.headers,n.headers),url:(r=(i=pu(e.url))==null?t.url:i)==null?n.url:r})}function hu(e,t){return W(W({},Fo()),{},{headers:function(){var t=V(function*(){return e});return function(){return t.apply(this,arguments)}}(),url:`http://localhost:4318/`+t})}function gu(e){return typeof e.headers==`function`?e.headers:No(e.headers)}function _u(e,t,n){return mu({url:e.url,timeoutMillis:e.timeoutMillis,headers:gu(e),concurrencyLimit:e.concurrencyLimit},{},hu(n,t))}function vu(e,t,n,r){return uu(_u(e,n,r),t)}var yu=class extends ko{constructor(e={}){super(vu(e,Fl,`v1/logs`,{"Content-Type":`application/json`}))}},bu;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e[e.LOWMEMORY=2]=`LOWMEMORY`})(bu||(bu={})),B(),N(),F();var xu=()=>Uo.CUMULATIVE,Su=e=>{switch(e){case U.COUNTER:case U.OBSERVABLE_COUNTER:case U.GAUGE:case U.HISTOGRAM:case U.OBSERVABLE_GAUGE:return Uo.DELTA;case U.UP_DOWN_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:return Uo.CUMULATIVE}},Cu=e=>{switch(e){case U.COUNTER:case U.HISTOGRAM:return Uo.DELTA;case U.GAUGE:case U.UP_DOWN_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:case U.OBSERVABLE_COUNTER:case U.OBSERVABLE_GAUGE:return Uo.CUMULATIVE}};function wu(){var e;let t=((e=void 0)==null?`cumulative`:e).toLowerCase();return t===`cumulative`?xu:t===`delta`?Su:t===`lowmemory`?Cu:(j.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${t}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),xu)}function Tu(e){return e==null?wu():e===bu.DELTA?Su:e===bu.LOWMEMORY?Cu:xu}var Eu=Object.freeze({type:Ws.DEFAULT});function Du(e){var t;return(t=e==null?void 0:e.aggregationPreference)==null?(()=>Eu):t}var Ou=class extends ko{constructor(e,t){super(e),P(this,`_aggregationTemporalitySelector`,void 0),P(this,`_aggregationSelector`,void 0),this._aggregationSelector=Du(t),this._aggregationTemporalitySelector=Tu(t==null?void 0:t.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}},ku=class extends Ou{constructor(e){super(vu(e==null?{}:e,Il,`v1/metrics`,{"Content-Type":`application/json`}),e)}},Au=class extends ko{constructor(e={}){super(vu(e,Kl,`v1/traces`,{"Content-Type":`application/json`}))}};function ju(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function Mu(e){e.forEach(e=>e.disable())}var Nu=t((()=>{}));function Pu(e){var t,n;let r=e.tracerProvider||M.getTracerProvider(),i=e.meterProvider||Pt.getMeterProvider(),a=e.loggerProvider||yn.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return ju(o,r,i,a),()=>{Mu(o)}}var Fu=t((()=>{N(),Nu()}));function Iu(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function Lu(e){e&&e.logger&&(typeof e.logger==`function`?K=e.logger:K(`new logger isn't a function, not replacing`))}var K,Ru,zu,Bu,Vu,Hu=t((()=>{K=console.error.bind(console),Ru=(e,t,n)=>{if(!e||!e[t]){K(`no original function `+String(t)+` to wrap`);return}if(!n){K(`no wrapper function`),K(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){K(`original object and wrapper must be functions`);return}let i=n(r,t);return Iu(i,`__original`,r),Iu(i,`__unwrap`,()=>{e[t]===i&&Iu(e,t,r)}),Iu(i,`__wrapped`,!0),Iu(e,t,i),i},zu=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Ru(e,t,n)})})},Bu=(e,t)=>{if(!e||!e[t]){K(`no function to unwrap.`),K(Error().stack);return}let n=e[t];if(!n.__unwrap)K(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Vu=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Bu(e,t)})})},Lu.wrap=Ru,Lu.massWrap=zu,Lu.unwrap=Bu,Lu.massUnwrap=Vu})),Uu,Wu=t((()=>{N(),bn(),Hu(),F(),G(),Uu=class{constructor(e,t,n){P(this,`_config`,{}),P(this,`_tracer`,void 0),P(this,`_meter`,void 0),P(this,`_logger`,void 0),P(this,`_diag`,void 0),P(this,`instrumentationName`,void 0),P(this,`instrumentationVersion`,void 0),P(this,`_wrap`,Ru),P(this,`_unwrap`,Bu),P(this,`_massWrap`,zu),P(this,`_massUnwrap`,Vu),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=j.createComponentLogger({namespace:e}),this._tracer=M.getTracer(e,t),this._meter=Pt.getMeter(e,t),this._logger=yn.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=W({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}}})),Gu,Ku=t((()=>{Wu(),Gu=class extends Uu{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}}})),qu=t((()=>{Ku(),N()}));function Ju(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}var Yu=t((()=>{}));function Xu(e,t){let n=q.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=q.DUPLICATE;break}else t.toLowerCase()===e&&(n=q.STABLE);return n}var q,Zu=t((()=>{(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(q||(q={}))})),Qu=t((()=>{Fu(),qu(),F(),Yu(),Zu()}));function $u(e){return ed(e,new WeakSet)}function ed(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>ed(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>ed(e,t))}return!1}N(),B(),Zi(),F();var td=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){P(this,`hrTime`,void 0),P(this,`hrTimeObserved`,void 0),P(this,`spanContext`,void 0),P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`attributes`,{}),P(this,`_severityText`,void 0),P(this,`_severityNumber`,void 0),P(this,`_body`,void 0),P(this,`_eventName`,void 0),P(this,`_attributesCount`,0),P(this,`_droppedAttributesCount`,0),P(this,`_isReadonly`,!1),P(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=aa(r==null?f:r),this.hrTimeObserved=aa(i==null?f:i),d){let e=M.getSpanContext(d);e&&it(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return j.warn(`Invalid attribute key: ${e}`),this;if(!$u(t))return j.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&j.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return j.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Ni,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Fi,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Fi,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Ni,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Pi,n.stack),t=!0)}t||j.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&j.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};bn(),N(),F(),G();var nd=class{constructor(e,t){P(this,`instrumentationScope`,void 0),P(this,`_sharedState`,void 0),P(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){var t;let n=this._loggerConfig,r=e.context||A.active(),i=(t=e.severityNumber)==null?en.UNSPECIFIED:t;if(i!==en.UNSPECIFIED&&i<n.minimumSeverity)return;if(n.traceBased){let e=M.getSpanContext(r);if(e&&it(e)&&(e.traceFlags&k.SAMPLED)!==k.SAMPLED)return}let a=new td(this._sharedState,this.instrumentationScope,W({context:r},e));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==en.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||A.active();if(t.traceBased){let e=M.getSpanContext(r);if(e&&it(e)&&(e.traceFlags&k.SAMPLED)!==k.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e==null?void 0:e.severityNumber,eventName:e==null?void 0:e.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},rd=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};B(),F(),H();var id=class{constructor(e,t){P(this,`processors`,void 0),P(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return V(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>go(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return V(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function ad(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var od=`otel.sdk.log.created`;F();var sd=class{constructor(e){P(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(od,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},cd=`0.217.0`;N(),bn(),G(),F();var ld={disabled:!1,minimumSeverity:en.UNSPECIFIED,traceBased:!1},ud=()=>W({},ld),dd=class{constructor(e,t,n,r,i,a){P(this,`loggers`,new Map),P(this,`activeProcessor`,void 0),P(this,`registeredLogRecordProcessors`,[]),P(this,`resource`,void 0),P(this,`forceFlushTimeoutMillis`,void 0),P(this,`logRecordLimits`,void 0),P(this,`processors`,void 0),P(this,`loggerMetrics`,void 0),P(this,`_loggerConfigurator`,void 0),P(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new id(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new rd,this._loggerConfigurator=i==null?ud:i;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,cd):le();this.loggerMetrics=new sd(o)}getLoggerConfig(e){let t=ad(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};N(),bn(),lc(),B(),F();var fd=class{constructor(e={}){var t,n,r,i,a,o,s,c;P(this,`_shutdownOnce`,void 0),P(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?rc():t,forceFlushTimeoutMillis:(n=e.forceFlushTimeoutMillis)==null?3e4:n,logRecordLimits:{attributeCountLimit:(r=(i=e.logRecordLimits)==null?void 0:i.attributeCountLimit)==null?128:r,attributeValueLengthLimit:(a=(o=e.logRecordLimits)==null?void 0:o.attributeValueLengthLimit)==null?1/0:a},loggerConfigurator:(s=e.loggerConfigurator)==null?ud:s,processors:(c=e.processors)==null?[]:c,meterProvider:e.meterProvider};this._sharedState=new dd(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator,l.meterProvider),this._shutdownOnce=new wo(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return j.warn(`A shutdown LoggerProvider cannot provide a Logger`),rn;e||j.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new nd({name:r,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(j.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(j.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};N(),B(),H(),F();function pd(e){return md.apply(this,arguments)}function md(){return md=V(function*(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&(yield Promise.all(t))}),md.apply(this,arguments)}var hd=class{constructor(e,t,n){P(this,`_exportCompleted`,void 0),P(this,`_exportScheduledPromise`,void 0),P(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(e,t,n){var r=this;return V(function*(){try{yield pd(t),yield A.with($r(A.active()),V(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){Si(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return V(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{if(clearTimeout(o),e.code===ga.SUCCESS)i();else{var t;a((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):t)}}),r._exportScheduledResolve()})})()}},gd=class{constructor(e,t){var n,r,i,a;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_currentExport`,null),P(this,`_finishedLogRecords`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=(n=t==null?void 0:t.maxExportBatchSize)==null?512:n,this._maxQueueSize=(r=t==null?void 0:t.maxQueueSize)==null?2048:r,this._scheduledDelayMillis=(i=t==null?void 0:t.scheduledDelayMillis)==null?5e3:i,this._exportTimeoutMillis=(a=t==null?void 0:t.exportTimeoutMillis)==null?3e4:a,this._shutdownOnce=new wo(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(j.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return V(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return V(function*(){if(e._flushing)return;e._flushing=!0;let t=e._finishedLogRecords;for(e._finishedLogRecords=[],e._clearTimer(),e._currentExport!==null&&(yield e._exporter.forceFlush(),yield e._currentExport.exportCompleted,e._currentExport=null);t.length>0;){let n;t.length<=e._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,e._maxExportBatchSize);let r=new hd(e._exporter,n,e._exportTimeoutMillis);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){Si(e)}finally{e._currentExport=null}}e._flushing=!1,e._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new hd(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,Si(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};F();var _d=class extends gd{constructor(e,t){super(e,t),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}},vd,yd=t((()=>{vd=`exception`})),bd,xd=t((()=>{N(),B(),Zi(),yd(),F(),bd=class{constructor(e){var t,n;P(this,`_spanContext`,void 0),P(this,`kind`,void 0),P(this,`parentSpanContext`,void 0),P(this,`attributes`,{}),P(this,`links`,[]),P(this,`events`,[]),P(this,`startTime`,void 0),P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_droppedAttributesCount`,0),P(this,`_droppedEventsCount`,0),P(this,`_droppedLinksCount`,0),P(this,`_attributesCount`,0),P(this,`name`,void 0),P(this,`status`,{code:wt.UNSET}),P(this,`endTime`,[0,0]),P(this,`_ended`,!1),P(this,`_duration`,[-1,-1]),P(this,`_spanProcessor`,void 0),P(this,`_spanLimits`,void 0),P(this,`_attributeValueLengthLimit`,void 0),P(this,`_recordEndMetrics`,void 0),P(this,`_performanceStartTime`,void 0),P(this,`_performanceOffset`,void 0),P(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=z.now(),this._performanceOffset=r-(this._performanceStartTime+z.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return j.warn(`Invalid attribute key: ${e}`),this;if(!mi(t))return j.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return j.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&j.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),ua(t)&&(ua(n)||(n=t),t=void 0);let i=fi(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&j.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=fi(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===wt.UNSET||this.status.code===wt.OK)return this;let t={code:e.code};return e.code===wt.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&j.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){j.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=oa(this.startTime,this.endTime),this._duration[0]<0&&(j.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&j.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&j.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=z.now())return ia(e+this._performanceOffset);if(typeof e==`number`)return ra(e);if(e instanceof Date)return ra(e.getTime());if(la(e))return e;if(this._startTimeProvided)return ra(Date.now());let t=z.now()-this._performanceStartTime;return da(this.startTime,ra(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Ni]=e:e&&(e.code?n[Fi]=e.code.toString():e.name&&(n[Fi]=e.name),e.message&&(n[Ni]=e.message),e.stack&&(n[Pi]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(vd,n,t):j.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);j.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(j.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}}})),Sd,Cd=t((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Sd||(Sd={}))})),wd,Td=t((()=>{Cd(),wd=class{shouldSample(){return{decision:Sd.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),Ed,Dd=t((()=>{Cd(),Ed=class{shouldSample(){return{decision:Sd.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),Od,kd=t((()=>{N(),B(),Td(),Dd(),F(),Od=class{constructor(e){var t,n,r,i;P(this,`_root`,void 0),P(this,`_remoteParentSampled`,void 0),P(this,`_remoteParentNotSampled`,void 0),P(this,`_localParentSampled`,void 0),P(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Si(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Ed),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Ed:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new wd:n,this._localParentSampled=(r=e.localParentSampled)==null?new Ed:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new wd:i}shouldSample(e,t,n,r,i,a){let o=M.getSpanContext(e);return!o||!it(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&k.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&k.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),Ad,jd=t((()=>{N(),Cd(),F(),Ad=class{constructor(e=0){P(this,`_ratio`,void 0),P(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:nt(t)&&this._accumulate(t)<this._upperBound?Sd.RECORD_AND_SAMPLED:Sd.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}}}));function Md(){var e,t,n,r,i,a,o,s;return{sampler:Nd(),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 Nd(){var e;let t=(e=void 0)==null?Fd.ParentBasedAlwaysOn:e;switch(t){case Fd.AlwaysOn:return new Ed;case Fd.AlwaysOff:return new wd;case Fd.ParentBasedAlwaysOn:return new Od({root:new Ed});case Fd.ParentBasedAlwaysOff:return new Od({root:new wd});case Fd.TraceIdRatio:return new Ad(Pd());case Fd.ParentBasedTraceIdRatio:return new Od({root:new Ad(Pd())});default:return j.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${Fd.ParentBasedAlwaysOn}".`),new Od({root:new Ed})}}function Pd(){return j.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Id}.`),Id}var Fd,Id,Ld=t((()=>{N(),B(),Td(),Dd(),kd(),jd(),(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`})(Fd||(Fd={})),Id=1}));function Rd(e){let t={sampler:Nd()},n=Md(),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 zd(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?Bd:s,Object.assign({},e,{spanLimits:p})}var Bd,Vd=t((()=>{Ld(),B(),Bd=1/0})),Hd,Ud=t((()=>{N(),B(),F(),Hd=class{constructor(e,t){var n,r,i,a;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_isExporting`,!1),P(this,`_finishedSpans`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(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 wo(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(j.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&k.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&j.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(j.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);A.with($r(A.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{if(clearTimeout(n),r.code===ga.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=>{Si(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,Si(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)}}})),Wd,Gd=t((()=>{Ud(),B(),F(),Wd=class extends Hd{constructor(e,t){super(e,t),P(this,`_visibilityChangeListener`,void 0),P(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=>{Si(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Si(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}}}));function Kd(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 qd(e){let t=``;for(let n=0;n<e.length;n++)t+=Qd[e[n]];return t}var Jd,Yd,Xd,Zd,Qd,$d,ef=t((()=>{Jd=16,Yd=8,Xd=new Uint8Array(Jd),Zd=new Uint8Array(Yd),Qd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),$d=class{generateTraceId(){return Kd(Xd),qd(Xd)}generateSpanId(){return Kd(Zd),qd(Zd)}}})),tf=t((()=>{Gd(),ef()})),nf,rf,af,of,sf=t((()=>{nf=`otel.span.parent.origin`,rf=`otel.span.sampling_result`,af=`otel.sdk.span.live`,of=`otel.sdk.span.started`}));function cf(e){return e?e.isRemote?`remote`:`local`:`none`}function lf(e){switch(e){case Sd.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Sd.RECORD:return`RECORD_ONLY`;case Sd.NOT_RECORD:return`DROP`}}var uf,df=t((()=>{Cd(),sf(),F(),uf=class{constructor(e){P(this,`startedSpans`,void 0),P(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(of,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(af,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=lf(t);if(this.startedSpans.add(1,{[nf]:cf(e),[rf]:n}),t===Sd.NOT_RECORD)return()=>{};let r={[rf]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}})),ff,pf=t((()=>{ff=`2.7.1`})),mf,hf=t((()=>{N(),B(),xd(),Vd(),tf(),df(),pf(),F(),mf=class{constructor(e,t,n,r){P(this,`_sampler`,void 0),P(this,`_generalLimits`,void 0),P(this,`_spanLimits`,void 0),P(this,`_idGenerator`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_resource`,void 0),P(this,`_spanProcessor`,void 0),P(this,`_tracerMetrics`,void 0);let i=Rd(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new $d,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,ff):le();this._tracerMetrics=new uf(a)}startSpan(e,t={},n=A.active()){var r,i,a;t.root&&(n=M.deleteSpan(n));let o=M.getSpan(n);if(ei(n))return j.debug(`Instrumentation suppressed, returning Noop Span`),M.wrapSpanContext(Ue);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!M.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?St.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:fi(e.attributes)})),m=fi(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===bt.RECORD_AND_SAMPLED?k.SAMPLED:k.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===bt.NOT_RECORD)return j.debug(`Recording is off, propagating context in a non-recording span`),M.wrapSpanContext(v);let y=fi(Object.assign(m,h.attributes));return new bd({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?A.active():i,l=this.startSpan(e,a,c),u=M.setSpan(c,l);return A.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),gf,_f=t((()=>{B(),F(),gf=class{constructor(e){P(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Si(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)})}}})),vf,yf,bf=t((()=>{B(),lc(),hf(),Ld(),_f(),Vd(),F(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(vf||(vf={})),yf=class{constructor(e={}){var t,n;P(this,`_config`,void 0),P(this,`_tracers`,new Map),P(this,`_resource`,void 0),P(this,`_activeSpanProcessor`,void 0);let r=io({},Md(),zd(e));this._resource=(t=r.resource)==null?rc():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new gf(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 mf({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=vf.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==vf.timeout&&(r=vf.resolved,n(r))}).catch(e=>{clearTimeout(i),r=vf.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==vf.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),xf,Sf=t((()=>{N(),B(),F(),H(),xf=class{constructor(e){P(this,`_exporter`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_pendingExports`,void 0),this._exporter=e,this._shutdownOnce=new wo(this._shutdown,this),this._pendingExports=new Set}forceFlush(){var e=this;return V(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&k.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>Si(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}_doExport(e){var t=this;return V(function*(){if(e.resource.asyncAttributesPending){var n,r;yield(n=(r=e.resource).waitForAsyncAttributes)==null?void 0:n.call(r)}let i=yield Oo._export(t._exporter,[e]);if(i.code!==ga.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()}}})),Cf=t((()=>{bf(),tf(),B(),F(),Sf(),Td(),Dd(),kd(),jd(),Cd()})),wf,Tf=t((()=>{N(),F(),wf=class{constructor(){P(this,`_enabled`,!1),P(this,`_currentContext`,O)}_bindFunction(e=O,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=O,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=O,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||O;try{return t.call(n,...r)}finally{this._currentContext=i}}}}));function Ef(e){if(e!==null){if(e===void 0){let e=new wf;e.enable(),A.setGlobalContextManager(e);return}e.enable(),A.setGlobalContextManager(e)}}function Df(e){if(e!==null){if(e===void 0){Jt.setGlobalPropagator(new va({propagators:[new Ba,new ui]}));return}Jt.setGlobalPropagator(e)}}var Of,kf=t((()=>{Cf(),Tf(),N(),B(),Of=class extends yf{constructor(e={}){super(e)}register(e={}){M.setGlobalTracerProvider(this),Df(e.propagator),Ef(e.contextManager)}}})),J,Af=t((()=>{(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(J||(J={}))})),jf,Mf,Nf=t((()=>{jf=`http.response_content_length`,Mf=`http.response_content_length_uncompressed`}));function Pf(){return qf||(qf=document.createElement(`a`)),qf}function Ff(e,t){return t in e}function Y(e,t,n,r=!0){if(Ff(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function If(e,t,n=!1,r,i){if(r===void 0&&(r=t[J.START_TIME]!==0),n||(Y(e,J.FETCH_START,t,r),Y(e,J.DOMAIN_LOOKUP_START,t,r),Y(e,J.DOMAIN_LOOKUP_END,t,r),Y(e,J.CONNECT_START,t,r),Y(e,J.SECURE_CONNECTION_START,t,r),Y(e,J.CONNECT_END,t,r),Y(e,J.REQUEST_START,t,r),Y(e,J.RESPONSE_START,t,r),Y(e,J.RESPONSE_END,t,r)),!i){let n=t[J.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(jf,n);let r=t[J.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(Mf,r)}}function Lf(e){return e.slice().sort((e,t)=>{let n=e[J.FETCH_START],r=t[J.FETCH_START];return n>r?1:n<r?-1:0})}function Rf(){return typeof location<`u`?location.origin:void 0}function zf(e,t,n,r,i=new WeakSet,a){let o=Hf(e);e=o.toString();let s=Vf(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=Lf(s);if(o.origin!==Rf()&&c.length>1){let e=c[0],t=Bf(c,e[J.RESPONSE_END],n),r=e[J.RESPONSE_END];return t[J.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function Bf(e,t,n){let r=sa(n),i=sa(aa(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=sa(aa(n[J.FETCH_START])),c=r-sa(aa(n[J.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function Vf(e,t,n,r,i,a){let o=sa(t),s=sa(n),c=r.filter(t=>{let n=sa(aa(t[J.FETCH_START])),r=sa(aa(t[J.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function Hf(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=Pf();return t.href=e,t}function Uf(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return`/`;let n=Gf(e,t);if(t&&n.indexOf(`@id`)>0)return n;let r=``;return e.parentNode&&(r+=Uf(e.parentNode,t)),r+=n,r}function Wf(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let n=Array.from(e.parentNode.childNodes);return n=n.filter(n=>{let r=n.localName;return t.indexOf(n.nodeType)>=0&&r===e.localName}),n.length>=1?n.indexOf(e)+1:0}function Gf(e,t){let n=e.nodeType,r=Wf(e),i=``;if(n===Node.ELEMENT_NODE){let n=e.getAttribute(`id`);if(t&&n)return`//*[@id="${n}"]`;i=e.localName}else if(n===Node.TEXT_NODE||n===Node.CDATA_SECTION_NODE)i=`text()`;else if(n===Node.COMMENT_NODE)i=`comment()`;else return``;return i&&r>1?`/${i}[${r}]`:`/${i}`}function Kf(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),Hf(e).origin===Rf()?!0:n.some(t=>yo(e,t))}var qf,Jf=t((()=>{Af(),B(),Nf()})),Yf=t((()=>{kf(),Tf(),Af(),Jf(),Cf()}));Qu(),Yf();var X={actionType:`action.type`,deploymentEnvironmentName:`deployment.environment.name`,browserName:`browser_name`,browserVersion:`browser_version`,cacheHit:`cache_hit`,deviceType:`device_type`,durationBucket:`duration_bucket`,errorType:`error_type`,eventLabel:`event_label`,exceptionFingerprint:`exception.fingerprint`,exceptionMessageShort:`exception.message_short`,exceptionStackTopFrame:`exception.stack_top_frame`,longtaskAttributionScript:`longtask.attribution_script`,longtaskBlockingDuration:`longtask.blocking_duration`,networkEffectiveType:`network.effective_type`,nextHopProtocol:`next_hop_protocol`,result:`result`,serviceName:`service.name`,serviceVersion:`service.version`,osName:`os_name`,sessionHasReplay:`session.has_replay`,sessionId:`session.id`,sessionStartTime:`session.start_time`,spanSubtype:`span_subtype`,spanType:`span_type`,statusClass:`status_class`,targetDomain:`target_domain`,targetLabel:`target_label`,targetPathTemplate:`target_path_template`,targetTag:`target.tag`,targetTextShort:`target.text_short`,targetValue:`target_value`,traceScene:`trace_scene`,transferSize:`transfer_size`,userId:`user.id`,vitalMetric:`vital.metric`,vitalRating:`vital.rating`,vitalValue:`vital.value`,viewId:`view.id`,viewLoadingType:`view.loading_type`,viewUrl:`view.url`,viewUrlPathGroup:`view.url_path_group`};G();var Z={abort:`abort`,error:`error`,success:`success`,timeout:`timeout`,warning:`warning`},Q={action:`action`,custom:`custom`,document:`document`,error:`error`,http:`http`,longtask:`longtask`,resource:`resource`,route:`route`,vital:`vital`},Xf=e=>e<100?`<100ms`:e<500?`100~500ms`:e<2e3?`500ms~2s`:`>2s`,Zf=e=>`${Math.trunc(e/100)}xx`,Qf=e=>e===408||e===504?Z.timeout:typeof e==`number`&&e>=400?Z.error:Z.success,$f=e=>e===408||e===504?`network_timeout`:typeof e!=`number`||e<400?`none`:e>=500?`http_5xx`:`http_4xx`,ep=e=>e===`good`?Z.success:Z.warning,tp=(e,t)=>{if(!e)return{};try{let n=new URL(e,typeof location>`u`?`http://localhost`:location.href),r=t==null?n.pathname:t;return{domain:n.host,label:`${n.host}${r}`,pathTemplate:r}}catch(n){return{label:e,pathTemplate:t==null?e:t}}},$=({duration:e,errorType:t=`none`,eventLabel:n,result:r=Z.success,spanSubtype:i,spanType:a,targetLabel:o,targetValue:s,traceScene:c})=>W(W(W(W(W({[X.spanType]:a,[X.spanSubtype]:i,[X.result]:r,[X.errorType]:t},e===void 0?{}:{[X.durationBucket]:Xf(e)}),n===void 0?{}:{[X.eventLabel]:n}),o===void 0?{}:{[X.targetLabel]:o}),s===void 0?{}:{[X.targetValue]:s}),c===void 0?{}:{[X.traceScene]:c}),np=({duration:e,method:t,statusCode:n,subtype:r,url:i,urlPathTemplate:a})=>{let o=tp(i,a);return W(W(W(W(W({},$({duration:e,errorType:$f(n),eventLabel:`API 调用`,result:Qf(n),spanSubtype:r,spanType:Q.http,targetLabel:o.label,targetValue:n})),t?{"http.request.method":t.toUpperCase()}:{}),o.domain?{[X.targetDomain]:o.domain}:{}),o.pathTemplate?{[X.targetPathTemplate]:o.pathTemplate}:{}),typeof n==`number`?{"http.response.status_code":n,[X.statusClass]:Zf(n)}:{})},rp=({duration:e,initiatorType:t=`other`,responseStatus:n,transferSize:r,url:i,urlPathTemplate:a})=>{var o;let s=tp(i,a),c=typeof n==`number`?Qf(n):Z.success;return W(W(W(W({},$({duration:e,errorType:typeof n==`number`?$f(n):`none`,eventLabel:`静态资源`,result:c,spanSubtype:t,spanType:Q.resource,targetLabel:(o=s.label)==null?i:o,targetValue:r})),s.domain?{[X.targetDomain]:s.domain}:{}),s.pathTemplate?{[X.targetPathTemplate]:s.pathTemplate}:{}),typeof n==`number`?{"http.response.status_code":n,[X.statusClass]:Zf(n)}:{})};G();var ip=[`click`,`submit`,`keydown`],ap=e=>e instanceof Element?e:void 0,op=e=>{var t;if(!e)return;let n=((t=e.textContent)==null?void 0:t.trim())||e.getAttribute(`aria-label`)||e.getAttribute(`title`)||``;return n?n.slice(0,32):void 0},sp=(e={})=>{var t;let n=[],r=(t=e.eventNames)==null?ip:t;return{name:`action`,init(e){if(typeof window>`u`)return;let t={capture:!0,passive:!0},i=t=>{var n;let r=ap(t.target),i=op(r),a=r==null?void 0:r.tagName.toLowerCase();e.startSpan(`action.${t.type}`,W(W(W(W({},e.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`用户操作`,spanSubtype:t.type,spanType:Q.action,targetLabel:(n=i==null?a:i)==null?t.type:n})),{},{[X.actionType]:t.type},i?{[X.targetTextShort]:i}:{}),a?{[X.targetTag]:a}:{})).end()};for(let e of r)window.addEventListener(e,i,t),n.push(()=>window.removeEventListener(e,i,t))},shutdown(){for(;n.length;){var e;(e=n.pop())==null||e()}}}};function cp(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 lp(e,t){if(e==null)return{};var n,r,i=cp(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}Dn(),G();var up=e=>typeof e==`string`&&e.length>0?e:void 0,dp=e=>{let t=up(e);return t?{[X.viewUrlPathGroup]:t}:{}},fp=e=>dp(e[X.viewUrlPathGroup]),pp=(e,t)=>{var n;let r=X.viewUrlPathGroup,{[r]:i}=e;return W(W({},lp(e,[r].map(En))),dp((n=up(i))==null?t:n))};G();var mp=`body`,hp=3e3,gp=.8,_p=[`[data-loading="true"]`,`[aria-busy="true"]`,`.loading`,`.is-loading`,`.spinner`,`.skeleton`,`.bk-loading`],vp=[[.5,.5],[.25,.25],[.75,.25],[.25,.75],[.75,.75]],yp=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,bp=(e,t)=>typeof e!=`number`||!Number.isFinite(e)?t:Math.max(0,Math.min(1,e)),xp=e=>{if(!e)return``;let t=e.tagName.toLowerCase();return e.id?`${t}#${e.id}`:t},Sp=(e,t)=>e?t.some(t=>{try{return e.matches(t)||!!e.closest(t)}catch(e){return!1}}):!1,Cp=e=>{if(typeof document>`u`)return()=>{};if(document.readyState===`complete`||document.readyState===`interactive`)return e(),()=>{};let t=()=>{document.removeEventListener(`DOMContentLoaded`,t),e()};return document.addEventListener(`DOMContentLoaded`,t),()=>document.removeEventListener(`DOMContentLoaded`,t)},wp=(e={})=>{var t,n;let r,i,a=!1,o={checkDelay:yp(e.checkDelay,hp),ignoreSelectors:(t=e.ignoreSelectors)==null?[]:t,rootSelector:(n=e.rootSelector)==null?mp:n,threshold:bp(e.threshold,gp)};return{name:`blank-screen`,init(e){if(typeof window>`u`||typeof document>`u`)return;let{checkDelay:t,rootSelector:n,threshold:s}=o,c=[..._p,...o.ignoreSelectors],l=e.meter.createCounter(`browser.blank_screen.count`,{description:`Number of suspected blank screen detections`}),u=()=>{try{var t,r;let i=document.querySelector(n),a=0,o=0;for(let[e,t]of vp){let n=document.elementFromPoint(window.innerWidth*e,window.innerHeight*t);if(Sp(n,c)){o+=1;continue}(n===i||n===document.body||n===document.documentElement)&&(a+=1)}let u=vp.length-o;if(u===0)return;let d=a/u,f=d>=s,p=xp(document.elementFromPoint(window.innerWidth/2,window.innerHeight/2)),m=W(W({},$({errorType:f?`blank_screen`:`none`,eventLabel:`白屏`,result:f?Z.error:Z.success,spanSubtype:`blank_screen`,spanType:Q.error,targetLabel:n,targetValue:d})),{},{"blank_screen.score":d,"blank_screen.threshold":s,"blank_screen.root":n,"blank_screen.detected":f,"blank_screen.sample_total":vp.length,"blank_screen.sample_valid":u,"blank_screen.sample_loading":o,"blank_screen.center_element":p,"blank_screen.dom_node_count":(t=(r=document.body)==null?void 0:r.getElementsByTagName(`*`).length)==null?0:t});f&&(l.add(1,e.applyRedact(W(W(W({},e.config.hooks.getMetricAttributes()),fp(e.getRuntimeAttributes())),{},{"blank_screen.root":n}))),e.startSpan(`browser.blank_screen`,m).end())}catch(t){if(e.config.debug){var i;(i=globalThis.console)==null||i.warn(`[bk-ot][blank-screen] detection failed:`,t)}}};i=Cp(()=>{a||(r=window.setTimeout(u,t))})},shutdown(){a=!0,i==null||i(),i=void 0,r!==void 0&&typeof window<`u`&&(window.clearTimeout(r),r=void 0)}}},Tp=()=>typeof window>`u`?`http://localhost`:window.location.origin,Ep=e=>{try{return new URL(e,Tp()).href}catch(t){return e}},Dp=e=>e.length>1?e.replace(/\/+$/,``):e,Op=(e,t)=>{let n=e=>Dp(e.replace(/[?#].*$/,``));return n(e)===n(t)},kp=e=>{try{return new URL(e,Tp()).origin===Tp()}catch(e){return!1}},Ap=(e,t)=>{let n=Ep(t);return[e.transport.traces.endpoint,e.transport.metrics.endpoint,e.transport.logs.endpoint].some(e=>Op(n,Ep(e)))},jp=(e,t)=>Ap(e,t),Mp=(e,t)=>e===`all`?!0:typeof e==`function`?e(t):(Array.isArray(e)?e:[e]).some(e=>typeof e==`string`?t.includes(e):e.test(t)),Np=(e,t)=>{if(kp(t))return!0;let n=e.instrumentations.propagateTraceHeaderUrls;return n?Mp(n,Ep(t)):!1},Pp,Fp=t((()=>{(function(e){e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`})(Pp||(Pp={}))})),Ip,Lp,Rp=t((()=>{Ip=`0.62.0`,Lp=`@opentelemetry/instrumentation-document-load`})),zp,Bp,Vp=t((()=>{zp=`http.url`,Bp=`http.user_agent`})),Hp,Up=t((()=>{(function(e){e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`})(Hp||(Hp={}))})),Wp,Gp,Kp,qp=t((()=>{B(),Up(),Wp=()=>{var e;let t={},n=(e=z.getEntriesByType)==null?void 0:e.call(z,`navigation`)[0];if(n)Object.values(J).forEach(e=>{if(Ff(n,e)){let r=n[e];typeof r==`number`&&(t[e]=r)}});else{let e=z.timing;e&&Object.values(J).forEach(n=>{if(Ff(e,n)){let r=e[n];typeof r==`number`&&(t[n]=r)}})}return t},Gp={"first-paint":Hp.FIRST_PAINT,"first-contentful-paint":Hp.FIRST_CONTENTFUL_PAINT},Kp=e=>{var t;let n=(t=z.getEntriesByType)==null?void 0:t.call(z,`paint`);n&&n.forEach(({name:t,startTime:n})=>{Ff(Gp,t)&&e.addEvent(Gp[t],n)})}})),Jp,Yp=t((()=>{N(),B(),Yf(),Zi(),Fp(),Rp(),Vp(),qp(),F(),Jp=class extends Gu{constructor(e={}){super(Lp,Ip,e),P(this,`component`,`document-load`),P(this,`version`,`1`),P(this,`moduleName`,this.component),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(e){var t;let n=(t=z.getEntriesByType)==null?void 0:t.call(z,`resource`);n&&n.forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===Ia),t=Wp(),n=e&&e.content||``;A.with(Jt.extract(O,{traceparent:n}),()=>{var e;let n=this._startSpan(Pp.DOCUMENT_LOAD,J.FETCH_START,t);n&&(A.with(M.setSpan(A.active(),n),()=>{let e=this._startSpan(Pp.DOCUMENT_FETCH,J.FETCH_START,t);e&&(this._semconvStability&q.OLD&&e.setAttribute(zp,location.href),this._semconvStability&q.STABLE&&e.setAttribute(Ki,location.href),A.with(M.setSpan(A.active(),e),()=>{var n;let r=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,r),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,J.RESPONSE_END,t)}))}),this._semconvStability&q.OLD&&(n.setAttribute(zp,location.href),n.setAttribute(Bp,navigator.userAgent)),this._semconvStability&q.STABLE&&(n.setAttribute(Ki,location.href),n.setAttribute(qi,navigator.userAgent)),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(Y(n,J.FETCH_START,t),Y(n,J.UNLOAD_EVENT_START,t),Y(n,J.UNLOAD_EVENT_END,t),Y(n,J.DOM_INTERACTIVE,t),Y(n,J.DOM_CONTENT_LOADED_EVENT_START,t),Y(n,J.DOM_CONTENT_LOADED_EVENT_END,t),Y(n,J.DOM_COMPLETE,t),Y(n,J.LOAD_EVENT_START,t),Y(n,J.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||Kp(n),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,J.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Ff(n,t)?e.end(n[t]):e.end())}_initResourceSpan(e,t){let n=this._startSpan(Pp.RESOURCE_FETCH,J.FETCH_START,e,t);if(n){var r;this._semconvStability&q.OLD&&n.setAttribute(zp,e.name),this._semconvStability&q.STABLE&&n.setAttribute(Ki,e.name);let t=!(this._semconvStability&q.OLD);If(n,e,this.getConfig().ignoreNetworkEvents,void 0,t),this._addCustomAttributesOnResourceSpan(n,e,(r=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:r.resourceFetch),this._endSpan(n,J.RESPONSE_END,e)}}_startSpan(e,t,n,r){if(Ff(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?M.setSpan(A.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener(`load`,this._onDocumentLoaded))}_addCustomAttributesOnSpan(e,t){t&&Ju(()=>t(e),e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}}})),Xp=n({AttributeNames:()=>Pp,DocumentLoadInstrumentation:()=>Jp}),Zp=t((()=>{Yp(),Fp()})),Qp,$p=t((()=>{(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(Qp||(Qp={}))})),em,tm,nm,rm,im,am,om,sm,cm=t((()=>{em=`http.host`,tm=`http.method`,nm=`http.request.body.size`,rm=`http.request_content_length_uncompressed`,im=`http.scheme`,am=`http.status_code`,om=`http.url`,sm=`http.user_agent`}));function lm(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=um(t.body);return t.body=e,n}else return Promise.resolve(fm(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>pm(e)):Promise.resolve()}}function um(e){if(!e.pipeThrough)return vm.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},transform(e,n){return V(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function dm(e){return typeof Document<`u`&&e instanceof Document}function fm(e){if(dm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return pm(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return mm(e);if(e instanceof URLSearchParams)return pm(e.toString());if(e.byteLength!==void 0)return e.byteLength;vm.warn(`unknown body type`)}function pm(e){return ym.encode(e).byteLength}function mm(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function hm(e){let t=gm(),n=e.toUpperCase();return n in t?n:`_OTHER`}function gm(){return xm===void 0&&(xm=bm),xm}function _m(e){let t=Number(e.port||Sm[e.protocol]);if(t&&!isNaN(t))return t}var vm,ym,bm,xm,Sm,Cm=t((()=>{N(),B(),H(),vm=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),ym=new TextEncoder,bm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Sm={"https:":`443`,"http:":`80`}})),wm,Tm=t((()=>{wm=`0.217.0`})),Em,Dm,Om,km=t((()=>{N(),Qu(),B(),Yf(),$p(),cm(),Zi(),Cm(),Tm(),F(),Em=300,Dm=typeof PerformanceObserver<`u`,Om=class extends Gu{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,wm,e),P(this,`component`,`fetch`),P(this,`version`,wm),P(this,`moduleName`,this.component),P(this,`_usedResources`,new WeakSet),P(this,`_tasksCount`,0),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[J.FETCH_START]},M.setSpan(A.active(),e)),r=!(this._semconvStability&q.OLD);If(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[J.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=Hf(t.url);if(this._semconvStability&q.OLD&&(e.setAttribute(am,t.status),t.statusText!=null&&e.setAttribute(Qp.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(em,n.host),e.setAttribute(im,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(sm,navigator.userAgent)),this._semconvStability&q.STABLE){e.setAttribute(Ri,t.status),e.setAttribute(zi,n.hostname);let r=_m(n);r&&e.setAttribute(Bi,r)}}_addHeaders(e,t){if(!Kf(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};Jt.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)Jt.inject(A.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);Jt.inject(A.active(),t,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))}),e.headers=t}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(bo(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&q.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[Qp.COMPONENT]=this.moduleName,r[tm]=i,r[om]=e}if(this._semconvStability&q.STABLE){let i=t.method,a=hm(t.method||`GET`);n||(n=a),r[Ii]=a,a!==i&&(r[Li]=i),r[Ki]=e}return this.tracer.startSpan(n,{kind:St.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=zf(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=ra(Date.now()),i=ia();this._addFinalSpanAttributes(e,n),this._semconvStability&q.STABLE&&n.status>=400&&(e.setStatus({code:wt.ERROR}),e.setAttribute(Mi,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},Em)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=this,i=Hf(n[0]instanceof Request?n[0].url:String(n[0])).href,a;a=n[0]instanceof Request?n[1]==null?n[0]:new Request(n[0],n[1]):n[1]||{};let o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&lm(...n).then(e=>{e&&(t._semconvStability&q.OLD&&o.setAttribute(rm,e),t._semconvStability&q.STABLE&&o.setAttribute(nm,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}catch(n){t._diag.error(`Failed to read fetch response body`,n),t._endSpan(e,s,{status:0,url:i})}return n}function d(e,n){try{c(e,n)}catch(r){t._diag.error(`Failed to end span on fetch error`,r),t._endSpan(e,s,{status:n.status||0,url:i})}throw n}return A.with(M.setSpan(A.active(),o),()=>(t._callRequestHook(o,a),t._addHeaders(a,i),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o),d.bind(r,o))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&Ju(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=ia(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(!Dm){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}if(!this._isEnabled){if(this._isFetchPatched){this._diag.debug(`fetch constructor already patched`),this._isEnabled=!0;return}try{this._wrap(globalThis,`fetch`,this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(e){this._diag.warn(`Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.`,e)}}}disable(){Dm&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}})),Am=n({FetchInstrumentation:()=>Om}),jm=t((()=>{km()})),Mm,Nm,Pm,Fm,Im,Lm,Rm,zm,Bm=t((()=>{Mm=`http.host`,Nm=`http.method`,Pm=`http.request.body.size`,Fm=`http.request_content_length_uncompressed`,Im=`http.scheme`,Lm=`http.status_code`,Rm=`http.url`,zm=`http.user_agent`})),Vm,Hm=t((()=>{(function(e){e.METHOD_OPEN=`open`,e.METHOD_SEND=`send`,e.EVENT_ABORT=`abort`,e.EVENT_ERROR=`error`,e.EVENT_LOAD=`loaded`,e.EVENT_TIMEOUT=`timeout`})(Vm||(Vm={}))}));function Um(e){return typeof Document<`u`&&e instanceof Document}function Wm(e){if(Um(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Gm(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Km(e);if(e instanceof URLSearchParams)return Gm(e.toString());if(e.byteLength!==void 0)return e.byteLength;Xm.warn(`unknown body type`)}function Gm(e){return Zm.encode(e).byteLength}function Km(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function qm(e){let t=Jm(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Jm(){return $m===void 0&&($m=Qm),$m}function Ym(e){let t=Number(e.port||eh[e.protocol]);if(t&&!isNaN(t))return t}var Xm,Zm,Qm,$m,eh,th=t((()=>{N(),B(),Xm=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),Zm=new TextEncoder,Qm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},eh={"https:":`443`,"http:":`80`}})),nh,rh=t((()=>{nh=`0.217.0`})),ih,ah=t((()=>{(function(e){e.HTTP_STATUS_TEXT=`http.status_text`})(ih||(ih={}))})),oh,sh,ch=t((()=>{N(),Qu(),B(),Yf(),Zi(),Bm(),Hm(),th(),rh(),ah(),F(),oh=300,sh=class extends Gu{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,nh,e),P(this,`component`,`xml-http-request`),P(this,`version`,nh),P(this,`moduleName`,this.component),P(this,`_tasksCount`,0),P(this,`_xhrMem`,new WeakMap),P(this,`_usedResources`,new WeakSet),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addHeaders(e,t){let n=Hf(t).href;if(!Kf(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};Jt.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};Jt.inject(A.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){A.with(M.setSpan(A.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[J.FETCH_START]}),n=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,n),e.end(t[J.RESPONSE_END])})}_addFinalSpanAttributes(e,t,n){if(this._semconvStability&q.OLD){if(t.status!==void 0&&e.setAttribute(Lm,t.status),t.statusText!==void 0&&e.setAttribute(ih.HTTP_STATUS_TEXT,t.statusText),typeof n==`string`){let t=Hf(n);e.setAttribute(Mm,t.host),e.setAttribute(Im,t.protocol.replace(`:`,``))}e.setAttribute(zm,navigator.userAgent)}this._semconvStability&q.STABLE&&t.status&&e.setAttribute(Ri,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_addResourceObserver(e,t){let n=this._xhrMem.get(e);!n||typeof PerformanceObserver!=`function`||typeof PerformanceResourceTiming!=`function`||(n.createdResources={observer:new PerformanceObserver(e=>{let r=e.getEntries(),i=Hf(t);r.forEach(e=>{e.initiatorType===`xmlhttprequest`&&e.name===i.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:[`resource`]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(z.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,i){if(!n||!r||!i||!e.createdResources)return;let a=e.createdResources.entries;(!a||!a.length)&&(a=z.getEntriesByType(`resource`));let o=zf(Hf(n).href,r,i,a,this._usedResources);if(o.mainRequest){let e=o.mainRequest;this._markResourceAsUsed(e);let n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&q.OLD);If(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){let r=Hf(t);if(bo(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i=``,a={};if(this._semconvStability&q.OLD&&(i=n.toUpperCase(),a[Nm]=n,a[Rm]=r.toString()),this._semconvStability&q.STABLE){let e=n,t=qm(n);i||(i=t),a[Ii]=t,t!==e&&(a[Li]=e),a[Ki]=r.toString(),a[zi]=r.hostname;let o=Ym(r);o&&(a[Bi]=o)}let o=this.tracer.startSpan(i,{kind:St.CLIENT,attributes:a});return o.addEvent(Vm.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:o,spanUrl:t}),o}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=n[0],i=n[1];return t._createSpan(this,i,r),e.apply(this,n)}}}_patchSend(){let e=this;function t(t,n,r,i){let a=n.callbackToRemoveEvents;typeof a==`function`&&a();let{span:o,spanUrl:s,sendStartTime:c}=n;o&&(e._findResourceAndAddNetworkEvents(n,o,s,c,r),o.addEvent(t,i),e._addFinalSpanAttributes(o,n,s),o.end(i),e._tasksCount--),e._clearResources()}function n(n,r,i,a){let o=e._xhrMem.get(r);if(!o)return;if(o.status=r.status,o.statusText=r.statusText,e._xhrMem.delete(r),o.span){let t=o.span;e._applyAttributesAfterXHR(t,r),e._semconvStability&q.STABLE&&(i?a&&(t.setStatus({code:wt.ERROR,message:a}),t.setAttribute(Mi,a)):o.status&&o.status>=400&&(t.setStatus({code:wt.ERROR}),t.setAttribute(Mi,String(o.status))))}let s=ia(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},oh)}function r(){n(Vm.EVENT_ERROR,this,!0,`error`)}function i(){n(Vm.EVENT_ABORT,this,!1)}function a(){n(Vm.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(Vm.EVENT_LOAD,this,!1):n(Vm.EVENT_ERROR,this,!1)}function s(t){t.removeEventListener(`abort`,i),t.removeEventListener(`error`,r),t.removeEventListener(`load`,o),t.removeEventListener(`timeout`,a);let n=e._xhrMem.get(t);n&&(n.callbackToRemoveEvents=void 0)}return t=>function(...n){if(!e._isEnabled)return t.apply(this,n);let c=e._xhrMem.get(this);if(!c)return t.apply(this,n);let l=c.span,u=c.spanUrl;if(l&&u){if(e.getConfig().measureRequestSize&&n!=null&&n[0]){let t=n[0],r=Wm(t);r!==void 0&&(e._semconvStability&q.OLD&&l.setAttribute(Fm,r),e._semconvStability&q.STABLE&&l.setAttribute(Pm,r))}A.with(M.setSpan(A.active(),l),()=>{e._tasksCount++,c.sendStartTime=ia(),l.addEvent(Vm.METHOD_SEND),this.addEventListener(`abort`,i),this.addEventListener(`error`,r),this.addEventListener(`load`,o),this.addEventListener(`timeout`,a),c.callbackToRemoveEvents=()=>{s(this),c.createdResources&&c.createdResources.observer.disconnect()},e._addHeaders(this,u),e._addResourceObserver(this,u)})}return t.apply(this,n)}}enable(){if(!this._isEnabled){if(this._isXhrPatched){this._diag.debug(`reactivating existing patch on`,this.moduleName,this.version),this._isEnabled=!0;return}try{this._diag.debug(`applying patch to`,this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(e){this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.warn(`Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.`,e)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),lh=n({XMLHttpRequestInstrumentation:()=>sh}),uh=t((()=>{ch()})),dh,fh=t((()=>{(function(e){e.EVENT_TYPE=`event_type`,e.TARGET_ELEMENT=`target_element`,e.TARGET_XPATH=`target_xpath`,e.HTTP_URL=`http.url`})(dh||(dh={}))})),ph,mh,hh=t((()=>{ph=`0.61.0`,mh=`@opentelemetry/instrumentation-user-interaction`}));function gh(){return!1}var _h,vh,yh,bh,xh=t((()=>{Qu(),N(),B(),Yf(),fh(),hh(),F(),_h=`OT_ZONE_CONTEXT`,vh=`Navigation:`,yh=[`click`],bh=class extends Gu{constructor(e={}){var t;super(mh,ph,e),P(this,`version`,ph),P(this,`moduleName`,`user-interaction`),P(this,`_spansData`,new WeakMap),P(this,`_wrappedListeners`,new WeakMap),P(this,`_eventsSpanMap`,new WeakMap),P(this,`_eventNames`,void 0),P(this,`_shouldPreventSpanCreation`,void 0),this._eventNames=new Set((t=e==null?void 0:e.eventNames)==null?yh:t),this._shouldPreventSpanCreation=typeof(e==null?void 0:e.shouldPreventSpanCreation)==`function`?e.shouldPreventSpanCreation:gh}init(){}_checkForTimeout(e,t){let n=this._spansData.get(t);n&&(e.source===`setTimeout`?n.hrTimeLastTimeout=ia():e.source!==`Promise.then`&&e.source!==`setTimeout`&&(n.hrTimeLastTimeout=void 0))}_allowEventName(e){return this._eventNames.has(e)}_createSpan(e,t,n){if(!this._isEnabled||!(e instanceof HTMLElement)||!e.getAttribute||e.hasAttribute(`disabled`)||!this._allowEventName(t))return;let r=Uf(e,!0);try{let i=this.tracer.startSpan(t,{attributes:{[dh.EVENT_TYPE]:t,[dh.TARGET_ELEMENT]:e.tagName,[dh.TARGET_XPATH]:r,[dh.HTTP_URL]:window.location.href}},n?M.setSpan(A.active(),n):void 0);return this._shouldPreventSpanCreation(t,e,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(e){this._diag.error(`failed to start create new user interaction span`,e)}}_decrementTask(e){let t=this._spansData.get(e);t&&(t.taskCount--,t.taskCount===0&&this._tryToEndSpan(e,t.hrTimeLastTimeout))}_getCurrentSpan(e){let t=e.get(_h);return t&&M.getSpan(t)}_incrementTask(e){let t=this._spansData.get(e);t&&t.taskCount++}addPatchedListener(e,t,n,r){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let a=i.get(t);return a||(a=new Map,i.set(t,a)),a.has(e)?!1:(a.set(e,r),!0)}removePatchedListener(e,t,n){let r=this._wrappedListeners.get(n);if(!r)return;let i=r.get(t);if(!i)return;let a=i.get(e);return a&&(i.delete(e),i.size===0&&(r.delete(t),r.size===0&&this._wrappedListeners.delete(n))),a}_invokeListener(e,t,n){return typeof e==`function`?e.apply(t,n):e.handleEvent(n[0])}_patchAddEventListener(){let e=this;return t=>function(n,r,i){if(!r)return t.call(this,n,r,i);let a=i&&typeof i==`object`&&i.once,o=function(...t){let i,o=t[0],s=o==null?void 0:o.target;o&&(i=e._eventsSpanMap.get(o)),a&&e.removePatchedListener(this,n,r);let c=e._createSpan(s,n,i);return c?(o&&e._eventsSpanMap.set(o,c),A.with(M.setSpan(A.active(),c),()=>{let n=e._invokeListener(r,this,t);return c.end(),n})):e._invokeListener(r,this,t)};if(e.addPatchedListener(this,n,r,o))return t.call(this,n,o,i)}}_patchRemoveEventListener(){let e=this;return t=>function(n,r,i){let a=e.removePatchedListener(this,n,r);return a?t.call(this,n,a,i):t.call(this,n,r,i)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._isEnabled&&(this._wrap(history,`replaceState`,this._patchHistoryMethod()),this._wrap(history,`pushState`,this._patchHistoryMethod()),this._wrap(history,`back`,this._patchHistoryMethod()),this._wrap(history,`forward`,this._patchHistoryMethod()),this._wrap(history,`go`,this._patchHistoryMethod()))}_patchHistoryMethod(){let e=this;return t=>function(...n){if(!e._isEnabled)return t.apply(this,n);let r=`${location.pathname}${location.hash}${location.search}`,i=t.apply(this,n),a=`${location.pathname}${location.hash}${location.search}`;return r!==a&&e._updateInteractionName(a),i}}_updateInteractionName(e){let t=M.getSpan(A.active());t&&typeof t.updateName==`function`&&t.updateName(`${vh} ${e}`)}_patchZoneCancelTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&e._decrementTask(i),t.call(this,n)}}_patchZoneScheduleTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&(e._incrementTask(i),e._checkForTimeout(n,i)),t.call(this,n)}}_patchZoneRunTask(){let e=this;return t=>function(n,r,i){let a=Array.isArray(i)&&i[0]instanceof Event?i[0]:void 0,o=a==null?void 0:a.target,s,c=this;if(o){if(s=e._createSpan(o,n.eventName),s)return e._incrementTask(s),c.run(()=>{try{return A.with(M.setSpan(A.active(),s),()=>{let e=Zone.current;return n._zone=e,t.call(e,n,r,i)})}finally{e._decrementTask(s)}})}else s=e._getCurrentSpan(c);try{return t.call(c,n,r,i)}finally{s&&e._shouldCountTask(n,c)&&e._decrementTask(s)}}}_shouldCountTask(e,t){if(e._zone&&(t=e._zone),!t||!e.data||e.data.isPeriodic)return!1;let n=this._getCurrentSpan(t);return!n||!this._spansData.get(n)?!1:e.type===`macroTask`||e.type===`microTask`}_tryToEndSpan(e,t){e&&this._spansData.get(e)&&(e.end(t),this._spansData.delete(e))}enable(){if(this._isEnabled||(this._isEnabled=!0,typeof this._zonePatched==`boolean`))return;let e=this._getZoneWithPrototype();this._diag.debug(`applying patch to`,this.moduleName,this.version,`zone:`,!!e),e?(this._zonePatched=!0,this._wrap(e.prototype,`runTask`,this._patchZoneRunTask()),this._wrap(e.prototype,`scheduleTask`,this._patchZoneScheduleTask()),this._wrap(e.prototype,`cancelTask`,this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(e=>{this._wrap(e,`addEventListener`,this._patchAddEventListener()),this._wrap(e,`removeEventListener`,this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){this._isEnabled&&(this._isEnabled=!1)}_getZoneWithPrototype(){return window.Zone}}})),Sh=n({AttributeNames:()=>dh,UserInteractionInstrumentation:()=>bh}),Ch=t((()=>{xh(),fh()}));Qu(),G(),H();var wh=[`http.url`,`url.full`],Th=[`http.status_code`,`http.response.status_code`],Eh=[`http.method`,`http.request.method`],Dh=e=>({test:e}),Oh=e=>typeof location>`u`?void 0:e.config.hooks.getViewPathGroup(location.href),kh=(e,t,n)=>{var r;t.setAttributes(e.applyRedact(W(W({},pp(e.getRuntimeAttributes(),Oh(e))),e.config.hooks.getPageAttributes())));let i;for(let n of wh){var a;let r=(a=t.attributes)==null?void 0:a[n];if(typeof r==`string`){let a=e.applyRedact({[n]:e.config.hooks.redactUrl(r)})[n];typeof a==`string`&&(i=a,t.setAttribute(n,a))}}let o=Th.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`number`),s=Eh.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`string`),c=(r=i)==null?wh.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`string`):r;t.setAttributes(e.applyRedact(np({method:s,statusCode:o,subtype:n,url:c,urlPathTemplate:c?e.config.hooks.getViewPathGroup(c):void 0})))},Ah=(e,t,n)=>{let r=Oh(e);t.setAttributes(e.applyRedact(W(W(W({},pp(e.getRuntimeAttributes(),r)),e.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`文档加载`,spanSubtype:n,spanType:Q.document,targetLabel:r,traceScene:`page_load`}))))},jh=(e,t,n)=>{let r=e.config.hooks.redactUrl(n.name);t.setAttributes(e.applyRedact(W(W(W(W({},pp(e.getRuntimeAttributes(),Oh(e))),e.config.hooks.getPageAttributes()),rp({duration:n.duration,initiatorType:n.initiatorType||`other`,responseStatus:n.responseStatus,transferSize:n.transferSize,url:r,urlPathTemplate:e.config.hooks.getViewPathGroup(n.name)})),{},{"url.full":r})))},Mh=(e={})=>{var t,n,r,i;let a=[],o={documentLoad:(t=e.documentLoad)==null?!0:t,fetch:(n=e.fetch)==null?!0:n,xhr:(r=e.xhr)==null?!0:r,userInteraction:(i=e.userInteraction)==null?!0:i};return{name:`official-instrumentations`,enabled:!!(o.documentLoad||o.fetch||o.xhr||o.userInteraction),init(e){return V(function*(){let t=[Dh(t=>jp(e.config,t))],n=[Dh(t=>Np(e.config,t))],[r,i,s,c]=yield Promise.all([o.documentLoad?Promise.resolve().then(()=>(Zp(),Xp)):Promise.resolve(null),o.fetch?Promise.resolve().then(()=>(jm(),Am)):Promise.resolve(null),o.xhr?Promise.resolve().then(()=>(uh(),lh)):Promise.resolve(null),o.userInteraction?Promise.resolve().then(()=>(Ch(),Sh)):Promise.resolve(null)]);if(r&&a.push(new r.DocumentLoadInstrumentation({semconvStabilityOptIn:`http`,applyCustomAttributesOnSpan:{documentLoad:t=>Ah(e,t,`navigate`),documentFetch:t=>Ah(e,t,`document_fetch`),resourceFetch:(t,n)=>jh(e,t,n)}})),i&&a.push(new i.FetchInstrumentation({applyCustomAttributesOnSpan:t=>kh(e,t,`fetch`),ignoreUrls:t,propagateTraceHeaderCorsUrls:n,semconvStabilityOptIn:`http`,ignoreNetworkEvents:!1})),s&&a.push(new s.XMLHttpRequestInstrumentation({applyCustomAttributesOnSpan:t=>kh(e,t,`xhr`),ignoreUrls:t,propagateTraceHeaderCorsUrls:n,semconvStabilityOptIn:`http`,ignoreNetworkEvents:!1})),c){let e=o.userInteraction!==null&&typeof o.userInteraction==`object`?{eventNames:o.userInteraction.eventNames}:void 0;a.push(new c.UserInteractionInstrumentation(e))}Pu({instrumentations:a})})()},shutdown(){for(;a.length;){var e,t;(e=a.pop())==null||(t=e.disable)==null||t.call(e)}}}},Nh=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)},Ph=(e,t)=>{let n=new Map,r=0,i=t=>{if(!(t-r<e)){r=t;for(let[r,i]of n)t-i.windowStart>e&&n.delete(r)}};return{allow(r){let a=Date.now();i(a);let o=n.get(r);return!o||a-o.windowStart>e?(n.set(r,{count:1,windowStart:a}),{allowed:!0,count:1}):(o.count+=1,{allowed:o.count<=t,count:o.count})}}};G();var Fh=6e4,Ih=5,Lh=/^https?:|^\/\//i,Rh=(e,t)=>{if(t)return Lh.test(t)?e(t):t},zh=()=>{let e;return{name:`csp-violation`,init(t){if(typeof window>`u`||typeof document>`u`)return;let n=Ph(Fh,Ih),r=e=>{let r=Nh(`${e.violatedDirective}|${e.blockedURI}|${e.sourceFile}|${e.lineNumber}`),i=n.allow(r);if(!i.allowed)return;let a=Rh(t.config.hooks.redactUrl,e.blockedURI),o=e.sourceFile?t.config.hooks.redactUrl(e.sourceFile):void 0,s=i.count===1;t.startSpan(`csp.violation`,W(W(W({},t.config.hooks.getPageAttributes()),$({errorType:`csp`,eventLabel:`CSP 错误`,result:Z.error,spanSubtype:`csp`,spanType:Q.error,targetLabel:a==null?e.effectiveDirective:a,targetValue:e.statusCode})),{},{"csp.blocked_uri":a,"csp.violated_directive":e.violatedDirective,"csp.effective_directive":e.effectiveDirective,"csp.disposition":e.disposition,"csp.source_file":o,"csp.line_number":e.lineNumber,"csp.column_number":e.columnNumber,"csp.status_code":e.statusCode,"csp.fingerprint":r,"csp.window_count":i.count,[X.exceptionFingerprint]:r,"error.source":`csp`},s?{"csp.original_policy":e.originalPolicy}:{})).end()};document.addEventListener(`securitypolicyviolation`,r),e=()=>document.removeEventListener(`securitypolicyviolation`,r)},shutdown(){e==null||e(),e=void 0}}},Bh=e=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`;G();var Vh=`BK_RUM_DEVICE_ID`,Hh=250,Uh=()=>navigator.connection,Wh=()=>navigator.userAgentData,Gh=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}},Kh=(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`},qh=e=>{let t=null;try{t=window.localStorage.getItem(e)}catch(e){}if(t)return t;let n=Bh(`device`);try{window.localStorage.setItem(e,n)}catch(e){}return n},Jh=()=>{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}},Yh=()=>{let e=Uh();return e?{"network.effective_type":e.effectiveType,"network.connection_type":e.type,"network.downlink":e.downlink,"network.rtt":e.rtt,"network.save_data":e.saveData}:{}},Xh=()=>{if(typeof navigator>`u`)return{};let e=Wh(),t=navigator.userAgent,n=Gh(t),r=Kh(t,e==null?void 0:e.platform),i=e!=null&&e.mobile||/mobi|android|iphone|ipad|ipod/i.test(t)?`mobile`:`desktop`;return{"device.memory":navigator.deviceMemory,"device.cpu_cores":navigator.hardwareConcurrency,"device.platform":e==null?void 0:e.platform,"device.mobile":e==null?void 0:e.mobile,[X.browserName]:n.name,[X.browserVersion]:n.version,[X.deviceType]:i,[X.osName]:r,"user_agent.name":n.name,"user_agent.version":n.version,"user_agent.os.name":r}},Zh=(e,t)=>{let n;return()=>{n!==void 0&&window.clearTimeout(n),n=window.setTimeout(()=>{n=void 0,e()},t)}},Qh=(e={})=>{var t;let n=[],r=(t=e.storageKey)==null?Vh:t;return{name:`device`,init(e){let t=typeof window>`u`?Bh(`device`):qh(r);if(e.setRuntimeAttributes(W(W(W({"device.id":t},Xh()),Jh()),Yh())),typeof window>`u`)return;let i=Zh(()=>{e.setRuntimeAttributes(Jh())},Hh);window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,i),n.push(()=>window.removeEventListener(`resize`,i),()=>window.removeEventListener(`orientationchange`,i));let a=Uh();if(a&&typeof a.addEventListener==`function`){let t=()=>{e.setRuntimeAttributes(Yh())};a.addEventListener(`change`,t),n.push(()=>{var e;(e=a.removeEventListener)==null||e.call(a,`change`,t)})}},shutdown(){for(;n.length;){var e;(e=n.pop())==null||e()}}}};N(),G();var $h=6e4,eg=5,tg=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,ng=e=>{if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch(t){return String(e)}},rg=e=>{var t;return e instanceof Error?(t=e.stack)==null?``:t:``},ig=e=>e.slice(0,80),ag=e=>{var t,n;return(t=(n=e.split(`
|
|
12
|
-
`).find(e=>e.trim().startsWith(`at `)))==null?void 0:n.trim())==null?``:t},og=e=>e===`unhandledrejection`?`promise`:e===`resource`?`resource_load`:`js`,sg=({context:e,error:t,exceptionType:n,extra:r={},source:i,spanName:a,throttle:o})=>{let s=ng(t),c=rg(t),l=Nh(`${i}|${s}|${c.slice(0,256)}`),u=o.allow(l);if(!u.allowed)return;let d=t instanceof Error?t:{message:s,name:n==null?i:n},f=W(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getErrorAttributes()),$({errorType:og(i),eventLabel:`错误`,result:Z.error,spanSubtype:og(i),spanType:Q.error,targetLabel:t instanceof Error?t.name:n==null?i:n})),{},{"exception.message":s,[X.exceptionMessageShort]:ig(s),"exception.stacktrace":c,[X.exceptionStackTopFrame]:ag(c),"exception.type":t instanceof Error?t.name:n==null?i:n,[X.exceptionFingerprint]:l,"error.handled":!1,"error.source":i,"error.window_count":u.count},r),p=e.startSpan(a,f);p.recordException(d),p.setStatus({code:wt.ERROR,message:s}),p.end()},cg=(e={})=>{let t=[],n=tg(e.windowMs,$h),r=tg(e.maxPerWindow,eg);return{name:`error`,init(e){if(typeof window>`u`)return;let i=Ph(n,r),a=t=>{var n;let r=!t.error&&!t.filename&&t.message===`Script error.`;sg({context:e,throttle:i,spanName:`browser.error`,source:`window.error`,error:(n=t.error)==null?t.message:n,extra:W({"code.filepath":t.filename,"code.lineno":t.lineno,"code.column":t.colno},r?{"error.cross_origin":!0}:{})})},o=t=>{sg({context:e,throttle:i,spanName:`browser.unhandledrejection`,source:`unhandledrejection`,error:t.reason,exceptionType:t.reason instanceof Error?t.reason.name:`UnhandledRejection`})},s=t=>{if(t instanceof ErrorEvent)return;let n=t.target;if(!(n instanceof Element))return;let r=n,a=r.src||r.href||n.currentSrc||``;sg({context:e,throttle:i,spanName:`browser.resource_error`,source:`resource`,error:Error(`Resource load failed: ${n.tagName.toLowerCase()} ${a}`),exceptionType:`ResourceError`,extra:{"url.full":e.config.hooks.redactUrl(a),"html.tag":n.tagName}})};window.addEventListener(`error`,a),window.addEventListener(`unhandledrejection`,o),window.addEventListener(`error`,s,!0),t.push(()=>window.removeEventListener(`error`,a),()=>window.removeEventListener(`unhandledrejection`,o),()=>window.removeEventListener(`error`,s,!0))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};bn(),H(),G();var lg=10*1024,ug=10,dg=e=>e.body,fg=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,pg=new WeakMap,mg=(e,t)=>e.length<=t?{body:e,truncated:!1}:{body:e.slice(0,t),truncated:!0},hg=(e,t)=>{if(!e)return;if(e instanceof Headers)return e.get(t)||void 0;let n=t.toLowerCase();if(Array.isArray(e)){var r;return(r=e.find(([e])=>e.toLowerCase()===n))==null?void 0:r[1]}let i=Object.keys(e).find(e=>e.toLowerCase()===n);return i?e[i]:void 0},gg=e=>{let t={};return e.forEach((e,n)=>{t[n]=e instanceof File?`[File name=${e.name} type=${e.type||`unknown`} size=${e.size}]`:e}),JSON.stringify(t)},_g=function(){var e=V(function*(e){return e==null?``:typeof e==`string`?e:e instanceof URLSearchParams?e.toString():e instanceof FormData?gg(e):e instanceof Blob?e.text():e instanceof ArrayBuffer||ArrayBuffer.isView(e)?new TextDecoder().decode(e):e instanceof Document?new XMLSerializer().serializeToString(e):String(e)});return function(t){return e.apply(this,arguments)}}(),vg=function(){var e=V(function*(e,t,n){let r=yield _g(e);if(r)return W(W({},mg(r,t)),{},{contentType:n})});return function(t,n,r){return e.apply(this,arguments)}}(),yg=function(){var e=V(function*(e,t,n){try{return yield vg(e,t,n)}catch(e){return}});return function(t,n,r){return e.apply(this,arguments)}}(),bg=e=>e instanceof Request?e.url:String(e),xg=(e,t)=>t!=null&&t.method?t.method:e instanceof Request?e.method:`GET`,Sg=(e,t,n)=>t!=null&&t.body?()=>yg(t.body,n,hg(t.headers,`content-type`)):(e instanceof Request,()=>Promise.resolve(void 0)),Cg=function(){var e=V(function*(e,t){try{let n=e.headers.get(`content-type`)||void 0,r=e.headers.get(`content-length`);if(r){let e=Number(r);if(Number.isFinite(e)&&e>t*ug)return{body:``,contentType:n,truncated:!0}}let i=e.clone();return yg(i.body?yield i.text():``,t,n)}catch(e){return}});return function(t,n){return e.apply(this,arguments)}}(),wg=(e,t)=>{if(e.responseType===``||e.responseType===`text`)return W(W({},mg(e.responseText||``,t)),{},{contentType:e.getResponseHeader(`content-type`)||void 0});if(e.responseType===`json`)return W(W({},mg(JSON.stringify(e.response),t)),{},{contentType:e.getResponseHeader(`content-type`)||void 0})},Tg=(e,t,n)=>{if(n)return e.redact(W(W({},t),{},{body:n.body,truncated:n.truncated}))},Eg=({config:e,context:t,duration:n,error:r,method:i,request:a,response:o,status:s,subtype:c,url:l})=>{let u=!!r||typeof s==`number`&&s>=400,d=i.toUpperCase(),f=u?Tg(e,{contentType:a==null?void 0:a.contentType,method:d,status:s,type:`request`,url:l},a):void 0,p=u?Tg(e,{contentType:o==null?void 0:o.contentType,method:d,status:s,type:`response`,url:l},o):void 0,m=W(W(W({},t.config.hooks.getPageAttributes()),np({duration:n,method:d,statusCode:s,subtype:c,url:t.config.hooks.redactUrl(l),urlPathTemplate:t.config.hooks.getViewPathGroup(l)})),{},{"http.duration":n,"http.request.method":d,"url.full":t.config.hooks.redactUrl(l)});if(typeof s==`number`&&(m[`http.response.status_code`]=s),f!=null&&(m[`http.request.body`]=f),p!=null&&(m[`http.response.body`]=p),u){var h,g;m[`http_body.request.truncated`]=(h=a==null?void 0:a.truncated)==null?!1:h,m[`http_body.response.truncated`]=(g=o==null?void 0:o.truncated)==null?!1:g}if(r instanceof Error){var _;m[`exception.message`]=r.message,m[`exception.type`]=r.name,m[`exception.stacktrace`]=(_=r.stack)==null?``:_}t.emitLog({severityNumber:u?en.ERROR:en.INFO,severityText:u?`ERROR`:`INFO`,body:u?`HTTP request completed with error`:`HTTP request completed`,attributes:m})},Dg=(e={})=>{var t;let n=[],r={maxBodySize:fg(e.maxBodySize,lg),redact:(t=e.redact)==null?dg:t};return{name:`http-body`,init(e){if(typeof window>`u`)return;let{maxBodySize:t}=r,i=window.fetch;if(typeof i==`function`){let a=function(){var n=V(function*(n,a){let o=bg(n);if(jp(e.config,o))return i(n,a);let s=xg(n,a),c=Sg(n,a,t),l=performance.now();try{let u=yield i(n,a),d=performance.now()-l,f=u.status>=400;return Eg({config:r,context:e,duration:d,method:s,request:f?yield c():void 0,response:f?yield Cg(u,t):void 0,status:u.status,subtype:`fetch`,url:o}),u}catch(t){let n=yield c();throw Eg({config:r,context:e,duration:performance.now()-l,error:t,method:s,request:n,subtype:`fetch`,url:o}),t}});return function(e,t){return n.apply(this,arguments)}}();window.fetch=a,n.push(()=>{window.fetch===a&&(window.fetch=i)})}let a=XMLHttpRequest.prototype.open,o=XMLHttpRequest.prototype.send,s=XMLHttpRequest.prototype.setRequestHeader,c=function(e,t,...n){var r;return pg.set(this,{method:e,startTime:performance.now(),url:String(t)}),a.call(this,e,t,(r=n[0])==null?!0:r,n[1],n[2])},l=function(e,t){let n=pg.get(this);if(n){var r;let i=e.toLowerCase(),a=(r=n.requestHeaders)==null?{}:r,o=a[i];a[i]=o?`${o}, ${t}`:t,n.requestHeaders=a}return s.call(this,e,t)},u=function(n){var i=this;let a=pg.get(this);if(a){var s;a.requestBody=n,a.requestContentType=(s=a.requestHeaders)==null?void 0:s[`content-type`]}return this.addEventListener(`abort`,()=>{let e=pg.get(this);e&&(e.aborted=!0)},{once:!0}),this.addEventListener(`error`,()=>{let e=pg.get(this);e&&(e.networkError=!0)},{once:!0}),this.addEventListener(`loadend`,()=>{V(function*(){let n=pg.get(i);if(!n||jp(e.config,n.url)||n.aborted)return;let a=n.networkError||i.status>=400,o=a?wg(i,t):void 0,s=a?yield yg(n.requestBody,t,n.requestContentType):void 0;Eg({config:r,context:e,duration:performance.now()-n.startTime,error:n.networkError?Error(`XHR network error`):void 0,method:n.method,request:s,response:o,status:i.status,subtype:`xhr`,url:n.url})})()},{once:!0}),o.call(this,n)};XMLHttpRequest.prototype.open=c,XMLHttpRequest.prototype.setRequestHeader=l,XMLHttpRequest.prototype.send=u,n.push(()=>{XMLHttpRequest.prototype.open===c&&(XMLHttpRequest.prototype.open=a),XMLHttpRequest.prototype.setRequestHeader===l&&(XMLHttpRequest.prototype.setRequestHeader=s),XMLHttpRequest.prototype.send===u&&(XMLHttpRequest.prototype.send=o)})},shutdown(){for(;n.length;){var e;(e=n.pop())==null||e()}}}};G();var Og=50,kg=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,Ag=(e={})=>{let t,n=kg(e.threshold,Og);return{name:`long-task`,init(e){var r;if(typeof PerformanceObserver>`u`||!((r=PerformanceObserver.supportedEntryTypes)!=null&&r.includes(`longtask`)))return;let i=e.meter.createCounter(`browser.long_task.count`,{description:`Number of long tasks observed (duration >= threshold)`}),a=e.meter.createHistogram(`browser.long_task.duration`,{unit:`ms`,description:`Duration of long tasks`});try{t=new PerformanceObserver(t=>{let r=e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),fp(e.getRuntimeAttributes())));for(let h of t.getEntries()){var o,s,c,l,u,d,f,p,m;if(h.duration<n)continue;let t=(o=h.attribution)==null?void 0:o[0],g=W(W({},r),{},{[X.longtaskAttributionScript]:(s=(c=t==null?void 0:t.containerSrc)==null?t==null?void 0:t.name:c)==null?`unknown`:s}),_=h.duration>100?Z.warning:Z.success;e.startSpan(`browser.long_task`,W(W(W({},r),$({duration:h.duration,errorType:_===Z.warning?`longtask_blocking`:`none`,eventLabel:`长任务`,result:_,spanSubtype:(l=t==null?void 0:t.name)==null?`unknown`:l,spanType:Q.longtask,targetLabel:(u=(d=(f=t==null?void 0:t.containerSrc)==null?t==null?void 0:t.containerName:f)==null?t==null?void 0:t.name:d)==null?`unknown`:u,targetValue:h.duration})),{},{[X.longtaskBlockingDuration]:h.duration,[X.longtaskAttributionScript]:(p=(m=t==null?void 0:t.containerSrc)==null?t==null?void 0:t.name:m)==null?`unknown`:p}),{startTime:performance.timeOrigin+h.startTime}).end(performance.timeOrigin+h.startTime+h.duration),i.add(1,g),a.record(h.duration,g)}}),t.observe({type:`longtask`,buffered:!0})}catch(e){t=void 0}},shutdown(){t==null||t.disconnect(),t=void 0}}},jg=new Set,Mg=``,Ng,Pg,Fg=!1,Ig=()=>typeof location>`u`?``:location.href,Lg=(e,t)=>{let n=Ig();Mg=n;let r={fromUrl:t,source:e,toUrl:n};for(let e of Array.from(jg))e(r)},Rg=()=>{Lg(`popstate`,Mg||Ig())},zg=()=>{Lg(`hashchange`,Mg||Ig())},Bg=()=>{Fg||typeof window>`u`||typeof history>`u`||(Fg=!0,Mg=Ig(),Ng=history.pushState,Pg=history.replaceState,history.pushState=function(e,t,n){let r=Mg||Ig(),i=Ng==null?void 0:Ng.apply(this,[e,t,n]);return Lg(`pushState`,r),i},history.replaceState=function(e,t,n){let r=Mg||Ig(),i=Pg==null?void 0:Pg.apply(this,[e,t,n]);return Lg(`replaceState`,r),i},window.addEventListener(`popstate`,Rg),window.addEventListener(`hashchange`,zg))},Vg=()=>{!Fg||typeof window>`u`||typeof history>`u`||(Ng&&(history.pushState=Ng),Pg&&(history.replaceState=Pg),window.removeEventListener(`popstate`,Rg),window.removeEventListener(`hashchange`,zg),Ng=void 0,Pg=void 0,Fg=!1,Mg=``)},Hg=e=>typeof window>`u`||typeof history>`u`?()=>{}:(Bg(),jg.add(e),()=>{jg.delete(e),jg.size===0&&Vg()});G();var Ug=()=>typeof location>`u`?``:location.href,Wg=()=>{let e=[];return{name:`page-view`,init(t){if(typeof window>`u`)return;let n=``,r,i=(e,i=n)=>{let a=Ug();if(a===n)return;r==null||r.setAttribute(`view.end_reason`,e),r==null||r.end(),n=a;let o=Bh(`view`),s=t.config.hooks.getViewPathGroup(a),c=e===`load`?`initial_load`:`route_change`,l=t.config.hooks.redactUrl(a),u=t.config.hooks.redactUrl(i);t.setView({id:o,loadingType:c,url:l,urlPathGroup:s});let d=e===`load`,f=W(W(W({},t.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:d?`文档加载`:`路由切换`,spanSubtype:d?`navigate`:e,spanType:d?Q.document:Q.route,targetLabel:s,traceScene:d?`page_load`:`route_change`})),{},{[X.viewId]:o,[X.viewUrl]:l,[X.viewUrlPathGroup]:s,[X.viewLoadingType]:c,"url.previous":u,"event.source":e},d?{"document.referrer":t.config.hooks.redactUrl(document.referrer||``)}:{});r=t.startSpan(`browser.view`,f),t.startSpan(`browser.page_view`,W({},f)).end()},a=Hg(e=>{i(e.source,e.fromUrl)});i(`load`);let o=()=>{r==null||r.setAttribute(`view.end_reason`,`shutdown`),r==null||r.end(),r=void 0};window.addEventListener(`pagehide`,o),e.push(a,()=>window.removeEventListener(`pagehide`,o),o)},shutdown(){for(;e.length;){var t;(t=e.pop())==null||t()}}}};G();var Gg=e=>e.transferSize===0&&e.decodedBodySize>0?!0:void 0,Kg=()=>{let e,t=new Set;return{name:`resource`,init(n){var r;if(typeof PerformanceObserver>`u`||!((r=PerformanceObserver.supportedEntryTypes)!=null&&r.includes(`resource`)))return;let i=e=>{if(!e.name||jp(n.config,e.name))return;let r=`${e.name}|${e.startTime}`;if(t.has(r))return;t.add(r);let i=n.config.hooks.redactUrl(e.name),a=e.duration;n.startSpan(`browser.resource`,W(W(W({},n.config.hooks.getPageAttributes()),rp({duration:a,initiatorType:e.initiatorType||`other`,responseStatus:e.responseStatus,transferSize:e.transferSize,url:i,urlPathTemplate:n.config.hooks.getViewPathGroup(e.name)})),{},{"url.full":i,[X.transferSize]:e.transferSize,[X.cacheHit]:Gg(e),[X.nextHopProtocol]:e.nextHopProtocol,initiator_type:e.initiatorType||`other`,"resource.encoded_body_size":e.encodedBodySize,"resource.decoded_body_size":e.decodedBodySize}),{startTime:performance.timeOrigin+e.startTime}).end(performance.timeOrigin+e.startTime+a)};try{e=new PerformanceObserver(e=>{for(let t of e.getEntries())i(t)}),e.observe({type:`resource`,buffered:!0})}catch(t){e=void 0}},shutdown(){e==null||e.disconnect(),e=void 0,t.clear()}}};G();var qg=()=>{let e=[],t=!1;return{name:`route-timing`,init(n){if(typeof window>`u`||typeof history>`u`)return;let r=n.meter.createHistogram(`browser.route_change.duration`,{unit:`ms`,description:`Estimated SPA route change duration (route start to next idle)`}),i=(e,i,a)=>{if(t)return;let o=performance.now(),s=performance.timeOrigin+o,c=()=>{if(t||typeof document<`u`&&document.visibilityState===`hidden`)return;let c=performance.now()-o,l=c>500?Z.warning:Z.success,u=n.applyRedact(W(W(W(W({},n.config.hooks.getPageAttributes()),n.config.hooks.getMetricAttributes()),fp(n.getRuntimeAttributes())),{},{"route.change.source":e}));r.record(c,u),n.startSpan(`browser.route_change`,W(W(W({},u),$({duration:c,errorType:l===Z.warning?`slow`:`none`,eventLabel:`路由切换`,result:l,spanSubtype:e,spanType:Q.route,targetLabel:n.config.hooks.getViewPathGroup(a),targetValue:c,traceScene:`route_change`})),{},{"url.full":n.config.hooks.redactUrl(a),"url.previous":n.config.hooks.redactUrl(i)}),{startTime:s}).end()};requestAnimationFrame(()=>requestAnimationFrame(()=>setTimeout(c,0)))},a=Hg(e=>{e.fromUrl!==e.toUrl&&i(e.source,e.fromUrl,e.toUrl)});e.push(a)},shutdown(){for(t=!0;e.length;){var n;(n=e.pop())==null||n()}}}};bn(),G();var Jg=1800*1e3,Yg=1440*60*1e3,Xg=6e4,Zg=5e3,Qg=[`click`,`keydown`,`scroll`,`mousemove`,`touchstart`],$g=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,e_=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0&&e<=t+Zg,t_=(e,t)=>{if(!e)return null;try{let n=JSON.parse(e);if(typeof(n==null?void 0:n.id)==`string`&&e_(n.ts,t)&&e_(n.startedAt,t))return n}catch(e){}return null},n_=(e,t)=>{if(typeof window>`u`)return null;let n=null;try{n=window.localStorage.getItem(e)}catch(e){}let r=t_(n,t);if(r)return r;try{n=window.sessionStorage.getItem(e)}catch(e){}return r=t_(n,t),r},r_=(e,t)=>{if(typeof window>`u`)return;let n=JSON.stringify(t);try{window.sessionStorage.setItem(e,n)}catch(e){}try{window.localStorage.setItem(e,n)}catch(e){}},i_=(e,t,n)=>{let r=Date.now(),i=n_(e,r);if(i){let a=r-i.ts>=t,o=r-i.startedAt>=n;if(!a&&!o){let t=W(W({},i),{},{ts:r});return r_(e,t),{id:t.id,rotated:!1}}let s=a?`inactivity`:`maxLifetime`,c={id:Bh(`session`),startedAt:r,ts:r};return r_(e,c),{id:c.id,prevId:i.id,reason:s,rotated:!0}}let a={id:Bh(`session`),startedAt:r,ts:r};return r_(e,a),{id:a.id,reason:`init`,rotated:!0}},a_=e=>{let t=``;try{t=new URL(e).host}catch(n){t=e}return`bk_ot_session__${Nh(t||`default`)}`},o_=(e,t)=>{if(!t.rotated||!t.reason)return;let n=Date.now();e.emitLog({severityNumber:en.INFO,severityText:`INFO`,body:t.reason===`init`?`session.start`:`session.rotate`,attributes:W(W({},e.config.hooks.getPageAttributes()),{},{[X.sessionHasReplay]:!1,[X.sessionId]:t.id,[X.sessionStartTime]:n,"session.rotate.reason":t.reason},t.prevId?{"session.previous_id":t.prevId}:{})})},s_=(e={})=>{let t=[],n=$g(e.inactivityMs,Jg),r=$g(e.maxLifetimeMs,Yg);return{name:`session`,init(i){var a;let o=(a=e.storageKey)==null?a_(i.config.transport.endpoint):a,s=``,c=()=>{if(typeof window>`u`){s||(s=Bh(`session`),i.setRuntimeAttributes({[X.sessionHasReplay]:!1,[X.sessionId]:s}));return}let e=i_(o,n,r);i.setRuntimeAttributes({[X.sessionHasReplay]:!1,[X.sessionId]:e.id}),e.id!==s&&(s=e.id,o_(i,e))};if(c(),typeof window>`u`||typeof document>`u`)return;let l=Date.now(),u=()=>{let e=Date.now();e-l<Xg||(l=e,c())},d={capture:!0,passive:!0};Qg.forEach(e=>{window.addEventListener(e,u,d)}),t.push(()=>{Qg.forEach(e=>{window.removeEventListener(e,u,d)})});let f=()=>{document.visibilityState===`visible`&&c()};document.addEventListener(`visibilitychange`,f),t.push(()=>document.removeEventListener(`visibilitychange`,f));let p=e=>{if(e.storageArea!==window.localStorage||e.key!==o||!e.newValue)return;let t=Date.now(),n=t_(e.newValue,t);if(!(!n||n.id===s)){s=n.id;try{window.sessionStorage.setItem(o,e.newValue)}catch(e){}i.setRuntimeAttributes({[X.sessionId]:n.id})}};window.addEventListener(`storage`,p),t.push(()=>window.removeEventListener(`storage`,p))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}},c_=n({CLSThresholds:()=>N_,FCPThresholds:()=>j_,INPThresholds:()=>q_,LCPThresholds:()=>X_,TTFBThresholds:()=>Q_,onCLS:()=>F_,onFCP:()=>I_,onINP:()=>J_,onLCP:()=>Z_,onTTFB:()=>ev});function l_(e,t){return h_.get(e)||h_.set(e,new t),h_.get(e)}var u_,d_,f_,p_,m_,h_,g_,__,v_,y_,b_,x_,S_,C_,w_,T_,E_,D_,O_,k_,A_,j_,M_,N_,P_,F_,I_,L_,R_,z_,B_,V_,H_,U_,W_,G_,K_,q_,J_,Y_,X_,Z_,Q_,$_,ev,tv=t((()=>{F(),G(),u_=class{constructor(){P(this,`t`,void 0),P(this,`o`,0),P(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)}},d_=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},f_=e=>{if(document.readyState===`loading`)return`loading`;let t=d_();if(t){if(e<t.domInteractive)return`loading`;if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return`dom-interactive`;if(t.domComplete===0||e<t.domComplete)return`dom-content-loaded`}return`complete`},p_=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},m_=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#`+n.id:[p_(n),...Array.from(n.classList).sort()].join(`.`);if(t.length+r.length>99)return t||r;if(t=t?r+`>`+t:r,n.id)break;e=n.parentNode}}catch(e){}return t},h_=new WeakMap,g_=-1,__=()=>g_,v_=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(g_=t.timeStamp,e(t))},!0)},y_=(e,t,n,r)=>{let i,a;return o=>{var s;t.value>=0&&(o||r)&&(a=t.value-((s=i)==null?0:s),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},b_=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},x_=()=>{var e,t;return(e=(t=d_())==null?void 0:t.activationStart)==null?0:e},S_=(e,t=-1)=>{let n=d_(),r=`navigate`;return __()>=0?r=`back-forward-cache`:n&&(document.prerendering||x_()>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}},C_=(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){}},w_=e=>{let t=!1;return()=>{t||(e(),t=!0)}},T_=-1,E_=new Set,D_=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,O_=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of E_)e();isFinite(T_)||(T_=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,O_,!0))}},k_=()=>{if(T_<0){var e;let t=x_(),n=document.prerendering||(e=globalThis.performance.getEntriesByType(`visibility-state`).find(e=>e.name===`hidden`&&e.startTime>=t))==null?void 0:e.startTime;T_=n==null?D_():n,addEventListener(`visibilitychange`,O_,!0),addEventListener(`prerenderingchange`,O_,!0),v_(()=>{setTimeout(()=>{T_=D_()})})}return{get firstHiddenTime(){return T_},onHidden(e){E_.add(e)}}},A_=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},j_=[1800,3e3],M_=(e,t={})=>{A_(()=>{let n=k_(),r,i=S_(`FCP`),a=C_(`paint`,e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-x_(),0),i.entries.push(t),r(!0)))});a&&(r=y_(e,i,j_,t.reportAllChanges),v_(n=>{i=S_(`FCP`),r=y_(e,i,j_,t.reportAllChanges),b_(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},N_=[.1,.25],P_=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],F_=(e,t={})=>{let n=l_(t=Object.assign({},t),u_),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=P_(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?m_(o):i;r.set(n,e)}}},((e,t={})=>{let n=k_();M_(w_(()=>{let r,i=S_(`CLS`,0),a=l_(t,u_),o=e=>{for(let t of e)a.u(t);a.o>i.value&&(i.value=a.o,i.entries=a.i,r())},s=C_(`layout-shift`,o);s&&(r=y_(e,i,N_,t.reportAllChanges),n.onHidden(()=>{o(s.takeRecords()),r(!0)}),v_(()=>{a.o=0,i=S_(`CLS`,0),r=y_(e,i,N_,t.reportAllChanges),b_(r)}),setTimeout(r))}))})(t=>{e((e=>{let t={};if(e.entries.length){var n;let i=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(!(i==null||(n=i.sources)==null)&&n.length){let e=P_(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:f_(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},I_=(e,t={})=>{M_(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:f_(__())};if(e.entries.length){let n=d_(),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:f_(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})})(t))},t)},L_=0,R_=1/0,z_=0,B_=e=>{for(let t of e)t.interactionId&&(R_=Math.min(R_,t.interactionId),z_=Math.max(z_,t.interactionId),L_=z_?(z_-R_)/7+1:0)},H_=()=>{var e;return V_?L_:(e=performance.interactionCount)==null?0:e},U_=()=>{`interactionCount`in performance||V_||(V_=C_(`event`,B_,{durationThreshold:0}))},W_=0,G_=class{constructor(){P(this,`l`,[]),P(this,`h`,new Map),P(this,`m`,void 0),P(this,`p`,void 0)}v(){W_=H_(),this.l.length=0,this.h.clear()}M(){let e=Math.min(this.l.length-1,Math.floor((H_()-W_)/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)}}},K_=e=>{let t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let r=w_(e),i=-1,a=()=>{n(i),r()};addEventListener(`visibilitychange`,a,{once:!0,capture:!0}),i=t(()=>{removeEventListener(`visibilitychange`,a,{capture:!0}),r()})}},q_=[200,500],J_=(e,t={})=>{let n=l_(t=Object.assign({},t),G_),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(K_(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?m_(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:f_(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})};C_(`long-animation-frame`,e=>{r=r.concat(e),l()}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=k_();A_(()=>{var r;U_();let i,a=S_(`INP`),o=l_(t,G_),s=e=>{K_(()=>{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=C_(`event`,s,{durationThreshold:(r=t.durationThreshold)==null?40:r});i=y_(e,a,q_,t.reportAllChanges),c&&(c.observe({type:`first-input`,buffered:!0}),n.onHidden(()=>{s(c.takeRecords()),i(!0)}),v_(()=>{o.v(),a=S_(`INP`),i=y_(e,a,q_,t.reportAllChanges)}))})})(t=>{e(f(t))},t)},Y_=class{constructor(){P(this,`m`,void 0)}u(e){var t;(t=this.m)==null||t.call(this,e)}},X_=[2500,4e3],Z_=(e,t={})=>{let n=l_(t=Object.assign({},t),Y_),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?m_(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{A_(()=>{let n=k_(),r,i=S_(`LCP`),a=l_(t,Y_),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-x_(),0),i.entries=[t],r())},s=C_(`largest-contentful-paint`,o);if(s){r=y_(e,i,X_,t.reportAllChanges);let n=w_(()=>{o(s.takeRecords()),s.disconnect(),r(!0)}),a=e=>{e.isTrusted&&(K_(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});v_(n=>{i=S_(`LCP`),r=y_(e,i,X_,t.reportAllChanges),b_(()=>{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=d_();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)},Q_=[800,1800],$_=e=>{document.prerendering?A_(()=>$_(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>$_(e),!0)},ev=(e,t={})=>{((e,t={})=>{let n=S_(`TTFB`),r=y_(e,n,Q_,t.reportAllChanges);$_(()=>{let i=d_();i&&(n.value=Math.max(i.responseStart-x_(),0),n.entries=[i],r(!0),v_(()=>{n=S_(`TTFB`,0),r=y_(e,n,Q_,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(),H();var nv=`unknown`,rv=e=>e?e.replace(/_/g,`-`):nv,iv=()=>{if(typeof performance>`u`)return nv;let e=performance.getEntriesByType(`navigation`)[0];return rv(e==null?void 0:e.type)},av=(e,t)=>{var n;return{"rum.navigation.type":(n=e.navigationType)==null?t:n,[X.vitalMetric]:e.name.toLowerCase(),[X.vitalRating]:e.rating}},ov=(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`)),o(`vital.lcp.time_to_first_byte`,a(`timeToFirstByte`));break;case`CLS`:o(`vital.cls.largest_shift_target`,a(`largestShiftTarget`)),o(`vital.cls.largest_shift_value`,a(`largestShiftValue`)),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`FCP`:o(`vital.fcp.time_to_first_byte`,a(`timeToFirstByte`)),o(`vital.fcp.load_state`,a(`loadState`));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},sv=()=>{let e=!1;return{name:`web-vitals`,init(t){return V(function*(){if(typeof window>`u`)return;let n;try{n=yield Promise.resolve().then(()=>(tv(),c_))}catch(e){if(t.config.debug){var r;(r=globalThis.console)==null||r.warn(`[bk-ot] web-vitals load failed:`,e)}return}if(e)return;let{onCLS:i,onFCP:a,onINP:o,onLCP:s,onTTFB:c}=n,l=iv(),u=t.meter.createHistogram(`browser.web_vital.cls`,{unit:`1`,description:`Cumulative Layout Shift`}),d=t.meter.createHistogram(`browser.web_vital.duration`,{unit:`ms`,description:`Web Vitals duration metrics, including FCP, INP, LCP and TTFB`}),f=e=>{let n=e.name.toLowerCase();t.startSpan(`browser.web_vital`,W(W(W(W(W({},t.config.hooks.getPageAttributes()),t.config.hooks.getMetricAttributes()),av(e,l)),$({duration:e.name===`CLS`?void 0:e.value,errorType:e.rating===`good`?`none`:`slow`,eventLabel:`Web 指标`,result:ep(e.rating),spanSubtype:n,spanType:Q.vital,targetLabel:n,targetValue:e.value})),{},{[X.vitalMetric]:n,[X.vitalValue]:e.value,[X.vitalRating]:e.rating,"vital.id":e.id},ov(e,t.config.hooks.redactUrl))).end()},p=n=>{e||!Number.isFinite(n.value)||(d.record(n.value,t.applyRedact(W(W(W(W({},t.config.hooks.getPageAttributes()),t.config.hooks.getMetricAttributes()),fp(t.getRuntimeAttributes())),av(n,l)))),f(n))};i(n=>{e||!Number.isFinite(n.value)||(u.record(n.value,t.applyRedact(W(W(W(W({},t.config.hooks.getPageAttributes()),t.config.hooks.getMetricAttributes()),fp(t.getRuntimeAttributes())),av(n,l)))),f(n))}),a(p),o(p),s(p),c(p)})()},shutdown(){e=!0}}};N(),bn(),G();var cv=64*1024,lv=6e4,uv=5,dv=e=>e==null?0:typeof e==`string`?e.length>cv||typeof TextEncoder>`u`?e.length:new TextEncoder().encode(e).byteLength:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:typeof Blob<`u`&&e instanceof Blob?e.size:0,fv=(e,t)=>{let n={"network.protocol.name":`websocket`,"url.full":t(e)},r={"network.protocol.name":`websocket`};try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);n[`server.address`]=t.host,n[`url.scheme`]=t.protocol.replace(`:`,``),r[`server.address`]=t.host,r[`url.scheme`]=n[`url.scheme`]}catch(e){}return{metricAttributes:r,spanAttributes:n}},pv=(e,t)=>{var n;let{bytesCounter:r,connectDurationHistogram:i,context:a,errorCounter:o,errorThrottle:s,isDisposed:c,messageCounter:l,url:u}=t,{metricAttributes:d,spanAttributes:f}=fv(u,a.config.hooks.redactUrl),p=a.applyRedact(W(W({},a.config.hooks.getMetricAttributes()),d)),m=(n=f[`server.address`])==null?f[`url.full`]:n,h=a.startSpan(`websocket.connect`,W(W(W({},f),$({errorType:`none`,eventLabel:`WebSocket`,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:m})),f[`server.address`]?{[X.targetDomain]:f[`server.address`]}:{})),g=performance.now(),_=!1,v=e=>{if(_)return;_=!0;let t=performance.now()-g;e===`error`&&h.setStatus({code:wt.ERROR,message:`websocket connect failed`}),h.setAttributes($({duration:t,errorType:e===`error`?`network`:`none`,eventLabel:`WebSocket`,result:e===`error`?Z.error:Z.success,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:m,targetValue:t})),h.end(),e===`opened`&&!c()&&i.record(t,p)};e.addEventListener(`open`,()=>{c()||v(`opened`)}),e.addEventListener(`message`,e=>{if(c())return;let t=W(W({},p),{},{"websocket.direction":`in`});l.add(1,t),r.add(dv(e.data),t)}),e.addEventListener(`error`,()=>{if(c())return;let e=_?`runtime`:`connect`;o.add(1,W(W({},p),{},{"websocket.error.phase":e})),v(`error`);let t=s.allow(`ws:error:${u}`);t.allowed&&a.emitLog({severityNumber:en.ERROR,severityText:`ERROR`,body:`websocket.error`,attributes:W(W(W({},f),$({errorType:`network`,eventLabel:`WebSocket 错误`,result:Z.error,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:m})),{},{"websocket.error.phase":e,"websocket.error.window_count":t.count})})}),e.addEventListener(`close`,e=>{c()||(_||v(`error`),a.emitLog({severityNumber:en.INFO,severityText:`INFO`,body:`websocket.close`,attributes:W(W(W({},f),$({errorType:e.wasClean?`none`:`network`,eventLabel:`WebSocket 关闭`,result:e.wasClean?Z.success:Z.warning,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:m,targetValue:e.code})),{},{"websocket.close.code":e.code,"websocket.close.reason":e.reason,"websocket.close.was_clean":e.wasClean})}))});let y=e.send.bind(e);e.send=e=>{if(!c()){let t=W(W({},p),{},{"websocket.direction":`out`});l.add(1,t),r.add(dv(e),t)}return y(e)}},mv=()=>{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;let a=r.meter.createCounter(`browser.websocket.message.count`,{description:`Total number of WebSocket messages observed`}),o=r.meter.createCounter(`browser.websocket.message.bytes`,{unit:`By`,description:`Total bytes transferred over WebSocket (best-effort)`}),s=r.meter.createCounter(`browser.websocket.error.count`,{description:`Total number of WebSocket error events`}),c=r.meter.createHistogram(`browser.websocket.connect.duration`,{unit:`ms`,description:`WebSocket connection establishment duration (only successful connects)`}),l=Ph(lv,uv),u=()=>n;t=new Proxy(i,{construct(e,t,i){let d=Reflect.construct(e,t,i);if(n)return d;let f=t[0]==null?``:String(t[0]);return!f||jp(r.config,f)||pv(d,{bytesCounter:o,connectDurationHistogram:c,context:r,errorCounter:s,errorThrottle:l,isDisposed:u,messageCounter:a,url:f}),d}}),window.WebSocket=t},shutdown(){n=!0,typeof window<`u`&&e&&window.WebSocket===t&&(window.WebSocket=e),t=void 0,e=void 0}}};G();var hv=`http://localhost:4318`,gv=60*1e3,_v=`unknown_service`,vv=e=>e.replace(/\/+$/,``),yv={traces:`rum`,metrics:`metrics`,logs:`logs`},bv=(e,t)=>`${vv(e||hv)}/v1/${yv[t]}`,xv=(e,t)=>{var n,r,i,a,o;let s=e==null||(n=e.signals)==null?void 0:n[t],c=(r=e==null||(i=e.signals)==null||(i=i.endpoints)==null?void 0:i[t])==null?s==null?void 0:s.endpoint:r,l=e!=null&&e.token||e!=null&&e.headers||s!=null&&s.headers?W(W(W({},e!=null&&e.token?{Authorization:`Bearer ${e.token}`}:{}),(a=e==null?void 0:e.headers)==null?{}:a),(o=s==null?void 0:s.headers)==null?{}:o):void 0;return{concurrencyLimit:s==null?void 0:s.concurrencyLimit,endpoint:c?vv(c):bv(e==null?void 0:e.endpoint,t),headers:l,timeoutMillis:s==null?void 0:s.timeoutMillis}},Sv=e=>typeof e!=`number`||!Number.isFinite(e)?1:Math.max(0,Math.min(1,e)),Cv=e=>e,wv=e=>e,Tv=e=>{try{return new URL(e,typeof location>`u`?`http://localhost`:location.href).pathname||`/`}catch(t){return e||`/`}},Ev=e=>{var t,n;return{environment:(t=e==null?void 0:e.environment)==null?`production`:t,name:(n=e==null?void 0:e.name)==null?_v:n,version:e==null?void 0:e.version}},Dv=e=>W(W({[X.deploymentEnvironmentName]:e.environment,"rum.provider":`blueking`,[X.serviceName]:e.name},e.version?{[X.serviceVersion]:e.version}:{}),{},{"telemetry.sdk.language":`webjs`}),Ov=e=>({endpoint:vv((e==null?void 0:e.endpoint)||hv),traces:xv(e,`traces`),metrics:xv(e,`metrics`),logs:xv(e,`logs`)}),kv=e=>({rate:Sv(e==null?void 0:e.rate)}),Av=e=>{var t,n,r,i,a,o,s,c,l,u,d,f;return{getPageAttributes:(t=(n=e.attributes)==null?void 0:n.page)==null?(()=>({"rum.page.host":typeof window>`u`?``:window.location.host,"rum.page.path":typeof window>`u`?``:window.location.pathname})):t,getMetricAttributes:(r=(i=e.attributes)==null?void 0:i.metric)==null?(()=>({})):r,getErrorAttributes:(a=(o=e.attributes)==null?void 0:o.error)==null?(()=>({})):a,getCustomAttributes:(s=(c=e.attributes)==null?void 0:c.custom)==null?(()=>({})):s,getViewPathGroup:t=>{var n,r,i;return(n=(r=e.route)==null||(i=r.getPathGroup)==null?void 0:i.call(r,t))==null?Tv(t):n},redactAttributes:(l=(u=e.privacy)==null?void 0:u.redactAttributes)==null?Cv:l,redactUrl:(d=(f=e.privacy)==null?void 0:f.redactUrl)==null?wv:d}},jv=e=>{var t,n,r,i,a,o;let s=Ev(e.app);return{app:s,autoStart:(t=e.autoStart)==null?!0:t,debug:(n=e.debug)==null?!1:n,enabled:(r=e.enabled)==null?!0:r,hooks:Av(e),instrumentations:(i=e.instrumentations)==null?{}:i,metricIntervalMillis:gv,plugins:(a=e.plugins)==null?{}:a,resourceAttributes:Dv(s),sampling:kv(e.sampling),spanBatch:e.spanBatch,spanProcessor:(o=e.spanProcessor)==null?`batch`:o,transport:Ov(e.transport),user:e.user}};F(),H();var Mv=(e,t)=>typeof e.enabled==`function`?e.enabled(t):e.enabled!==!1,Nv=class{constructor(e){P(this,`plugins`,void 0),P(this,`startedPlugins`,[]),this.plugins=e}flush(){var e=this;return V(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 V(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 V(function*(){for(let r of t.plugins)if(Mv(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)}}})()}},Pv=[`http.url`,`url.full`],Fv=e=>{for(let n of Pv){var t;let r=(t=e.attributes)==null?void 0:t[n];if(typeof r==`string`)return r}},Iv=class{constructor(e,t){this.inner=e,this.config=t}forceFlush(){return this.inner.forceFlush()}onEnd(e){let t=Fv(e);t&&Ap(this.config,t)||this.inner.onEnd(e)}onStart(e,t){this.inner.onStart(e,t)}shutdown(){return this.inner.shutdown()}};F(),G();var Lv=class{constructor(e={},t){P(this,`attributes`,{}),P(this,`setOptionalAttribute`,(e,t)=>{if(t===void 0){delete this.attributes[e];return}this.attributes[e]=t}),P(this,`user`,{}),P(this,`view`,{}),P(this,`getAttributes`,()=>W({},this.attributes)),P(this,`getUser`,()=>W({},this.user)),P(this,`getView`,()=>W({},this.view)),P(this,`setAttributes`,e=>{for(let[t,n]of Object.entries(e)){if(n===void 0){delete this.attributes[t];continue}this.attributes[t]=n}}),P(this,`setUser`,e=>{if(this.user=W(W({},this.user),e),`id`in e){if(e.id===void 0){delete this.attributes[X.userId];return}this.attributes[X.userId]=e.id}}),P(this,`setView`,e=>{this.view=W(W({},this.view),e),this.setOptionalAttribute(X.viewId,e.id),this.setOptionalAttribute(X.viewUrl,e.url),this.setOptionalAttribute(X.viewUrlPathGroup,e.urlPathGroup),this.setOptionalAttribute(X.viewLoadingType,e.loadingType)}),this.setAttributes(e),t&&this.setUser(t)}},Rv=`BK_RUM_SAMPLING`,zv=new Map,Bv=e=>zv.get(e),Vv=(e,t)=>(zv.set(e,t),t),Hv=({sampling:e})=>{if(e.rate<=0)return!1;if(e.rate>=1)return!0;try{let t=sessionStorage.getItem(Rv);if(t)return t===`1`;let n=Math.random()<e.rate;return sessionStorage.setItem(Rv,n?`1`:`0`),Vv(Rv,n),n}catch(t){let n=Bv(Rv);return typeof n==`boolean`?n:Vv(Rv,Math.random()<e.rate)}};N(),bn(),B(),Qu(),lc(),Cf(),Yf(),F(),G(),H();var Uv=e=>({url:e.endpoint,headers:e.headers,concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis}),Wv=`bk-rum`,Gv=(e,t,n)=>n?new Proxy(e,{get(e,n,r){if(n===`export`)return(n,r)=>{var i;return(i=globalThis.console)==null||i.log(`[bk-ot][${t}]`,n),e.export(n,r)};let i=Reflect.get(e,n,r);return typeof i==`function`?i.bind(e):i}}):e,Kv=e=>[Mh(e.instrumentations)],qv=(e,t)=>e===void 0?t:e!==!1,Jv=e=>typeof e==`object`&&e?e:void 0,Yv=(e,t,n)=>qv(e,t)?[n(Jv(e))]:[],Xv=e=>[...Yv(e.device,!0,Qh),...Yv(e.session,!0,s_),...Yv(e.pageView,!0,Wg),...Yv(e.httpBody,!1,Dg),...Yv(e.error,!0,cg),...Yv(e.webVitals,!0,sv),...Yv(e.resource,!0,Kg),...Yv(e.blankScreen,!0,wp),...Yv(e.action,!1,sp),...Yv(e.websocket,!1,mv),...Yv(e.longTask,!1,Ag),...Yv(e.cspViolation,!1,zh),...Yv(e.routeTiming,!1,qg)],Zv=class{assertBeforeStart(e){if(this.phase!==`idle`)throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`)}constructor(e){var t=this,n,r;P(this,`loggerProvider`,void 0),P(this,`meterProvider`,void 0),P(this,`phase`,`idle`),P(this,`pluginManager`,void 0),P(this,`plugins`,void 0),P(this,`registeredInstrumentations`,void 0),P(this,`runtimeContext`,void 0),P(this,`sampled`,void 0),P(this,`teardownCallbacks`,[]),P(this,`tracerProvider`,void 0),P(this,`applyRedact`,e=>this.config.hooks.redactAttributes(e)),P(this,`config`,void 0),P(this,`emitLog`,e=>{var t;let n=W(W({},e),{},{attributes:this.applyRedact(W(W({},this.getRuntimeAttributes()),(t=e.attributes)==null?{}:t))});this.logger.emit(n)}),P(this,`flush`,V(function*(){yield t.pluginManager.flush(),yield t.tracerProvider.forceFlush(),yield t.meterProvider.forceFlush(),yield t.loggerProvider.forceFlush()})),P(this,`getRuntimeAttributes`,()=>this.runtimeContext.getAttributes()),P(this,`logger`,void 0),P(this,`meter`,void 0),P(this,`reportAction`,({attributes:e={},targetTag:t,targetText:n,type:r})=>{var i;if(!this.sampled)return;let a=n==null?void 0:n.slice(0,32);this.startSpan(`action.${r}`,W(W(W(W(W({},this.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`用户操作`,spanSubtype:r,spanType:Q.action,targetLabel:(i=a==null?t:a)==null?r:i})),{},{[X.actionType]:r},a?{[X.targetTextShort]:a}:{}),t?{[X.targetTag]:t}:{}),e)).end()}),P(this,`reportCustomEvent`,({attributes:e={},error:t,name:n})=>{if(!this.sampled){if(this.config.debug){var r;(r=globalThis.console)==null||r.warn(`[bk-ot] custom event dropped (not sampled):`,n)}return}let i=this.startSpan(`custom.${n}`,W(W(W(W(W({},this.config.hooks.getPageAttributes()),this.config.hooks.getCustomAttributes()),$({errorType:t?`custom`:`none`,eventLabel:`自定义事件`,result:t?Z.error:Z.success,spanSubtype:n,spanType:Q.custom,targetLabel:n})),e),{},{"rum.custom.name":n}));t&&(i.recordException(t),i.setStatus({code:wt.ERROR,message:t.message})),i.end()}),P(this,`setRuntimeAttributes`,e=>{this.runtimeContext.setAttributes(e)}),P(this,`setUser`,e=>{this.runtimeContext.setUser(e)}),P(this,`setView`,e=>{this.runtimeContext.setView(e)}),P(this,`shutdown`,V(function*(){if(t.phase!==`stopped`){for(yield t.flush();t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}for(yield t.pluginManager.shutdown();t.registeredInstrumentations.length;){var n,r;(n=t.registeredInstrumentations.pop())==null||(r=n.disable)==null||r.call(n)}yield t.tracerProvider.shutdown(),yield t.meterProvider.shutdown(),yield t.loggerProvider.shutdown(),M.disable(),Pt.disable(),A.disable(),t.phase=`stopped`}})),P(this,`start`,V(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`,Jt.setGlobalPropagator(new Ba),t.tracerProvider.register({contextManager:new kn}),Pt.setGlobalMeterProvider(t.meterProvider),yn.setGlobalLoggerProvider(t.loggerProvider);try{if(t.registeredInstrumentations.length&&Pu({instrumentations:t.registeredInstrumentations,meterProvider:t.meterProvider,tracerProvider:t.tracerProvider}),yield t.pluginManager.start(t),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(r){for(;t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}yield t.pluginManager.shutdown();for(let e of t.registeredInstrumentations){var n;(n=e.disable)==null||n.call(e)}throw M.disable(),Pt.disable(),A.disable(),t.phase=`idle`,r}t.phase=`started`}})),P(this,`startSpan`,(e,t={},n)=>this.tracer.startSpan(e,{kind:St.INTERNAL,startTime:n==null?void 0:n.startTime,attributes:this.applyRedact(W(W({},this.getRuntimeAttributes()),t))})),P(this,`tracer`,void 0),P(this,`use`,e=>(this.assertBeforeStart(`use`),this.sampled&&this.plugins.push(e),this)),P(this,`useInstrumentation`,e=>(this.assertBeforeStart(`useInstrumentation`),this.config.enabled&&this.registeredInstrumentations.push(e),this)),this.config=jv(e),this.sampled=this.config.enabled&&Hv(this.config);let i=nc(this.config.resourceAttributes),a=Gv(new Au(Uv(this.config.transport.traces)),`traces`,this.config.debug),o=Gv(new ku(Uv(this.config.transport.metrics)),`metrics`,this.config.debug),s=Gv(new yu(Uv(this.config.transport.logs)),`logs`,this.config.debug),c=new Iv(this.config.spanProcessor===`simple`?new xf(a):new Wd(a,this.config.spanBatch),this.config),l=new Xs({exporter:o,exportIntervalMillis:this.config.metricIntervalMillis}),u=new _d(s);this.tracerProvider=new Of({resource:i,sampler:new Od({root:new Ad(+!!this.sampled)}),spanProcessors:[c]}),this.meterProvider=new cl({resource:i,readers:[l]}),this.loggerProvider=new fd({resource:i,processors:[u]}),this.tracer=this.tracerProvider.getTracer(Wv),this.meter=this.meterProvider.getMeter(Wv),this.logger=this.loggerProvider.getLogger(Wv),this.runtimeContext=new Lv({"rum.sampled":this.sampled},this.config.user),this.registeredInstrumentations=this.config.enabled?[...(n=this.config.instrumentations.custom)==null?[]:n]:[],this.plugins=[...this.config.enabled?Kv(this.config):[],...this.sampled?[...Xv(this.config.plugins),...(r=this.config.plugins.custom)==null?[]:r]:[]],this.pluginManager=new Nv(this.plugins),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:Zv}),Zv})();
|
|
10
|
+
`,Po(t,e),`To resolve the conflict:
|
|
11
|
+
`,zo(t,e))}return n}};L();var Vo=class{constructor(e){I(this,`_backingStorages`,void 0),this._backingStorages=e}record(e,t,n,r){let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}};L();var Ho=class{constructor(e,t){I(this,`_buffer`,new ko),I(this,`_instrumentName`,void 0),I(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){P.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===pe.INT&&!Number.isInteger(e)&&(P.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},Uo=class{constructor(){I(this,`_buffer`,new Map)}observe(e,t,n={}){if(!To(e))return;let r=this._buffer.get(e);if(r==null&&(r=new ko,this._buffer.set(e,r)),typeof t!=`number`){P.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===pe.INT&&!Number.isInteger(t)&&(P.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}};L();var Wo=class{constructor(){I(this,`_callbacks`,[]),I(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(To));if(n.size===0){P.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(To)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}observe(e,t){var n=this;return W(function*(){let r=n._observeCallbacks(e,t),i=n._observeBatchCallbacks(e,t);return(yield Promise.allSettled([...r,...i])).filter(e=>e.status===`rejected`).map(e=>e.reason)})()}_observeCallbacks(e,t){return this._callbacks.map(function(){var n=W(function*({callback:n,instrument:r}){let i=new Ho(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=Zi(a,t)),yield a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})});return function(e){return n.apply(this,arguments)}}())}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(function(){var n=W(function*({callback:n,instruments:r}){let i=new Uo,a=Promise.resolve(n(i));t!=null&&(a=Zi(a,t)),yield a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})});return function(e){return n.apply(this,arguments)}}())}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&Qi(n.instruments,t))}};L();var Go=class extends Do{constructor(e,t,n,r,i){super(e),I(this,`_aggregationCardinalityLimit`,void 0),I(this,`_deltaMetricStorage`,void 0),I(this,`_temporalMetricStorage`,void 0),I(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ao(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new jo(t,r),this._attributesProcessor=n}record(e,t,n,r){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};L();var Ko=class{process(e,t){return e}},qo=class{constructor(e){I(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}};function Jo(){return Xo}function Yo(e){return new qo(e)}var Xo=new Ko;L();var Zo=class{constructor(e,t){I(this,`metricStorageRegistry`,new Bo),I(this,`observableRegistry`,new Wo),I(this,`meter`,void 0),I(this,`_meterProviderSharedState`,void 0),I(this,`_instrumentationScope`,void 0),this.meter=new Eo(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,Go);return t.length===1?t[0]:new Vo(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,No)}collect(e,t,n){var r=this;return W(function*(){let i=yield r.observableRegistry.observe(t,n==null?void 0:n.timeoutMillis),a=r.metricStorageRegistry.getStorages(e);if(a.length===0)return null;let o=[];return a.forEach(n=>{let r=n.collect(e,t);r!=null&&o.push(r)}),o.length===0?{errors:i}:{scopeMetrics:{scope:r._instrumentationScope,metrics:o},errors:i}})()}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=fo(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,Jo(),[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}};L();var Qo=class{constructor(e){I(this,`viewRegistry`,new lo),I(this,`metricCollectors`,[]),I(this,`meterSharedStates`,new Map),I(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=Yi(e),n=this.meterSharedStates.get(t);return n==null&&(n=new Zo(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Ja(n.selectAggregation(e))]);return t}};L();var $o=class{constructor(e,t){I(this,`_sharedState`,void 0),I(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}collect(e){var t=this;return W(function*(){let n=hr(Date.now()),r=[],i=[],a=Array.from(t._sharedState.meterSharedStates.values()).map(function(){var a=W(function*(a){let o=yield a.collect(t,n,e);(o==null?void 0:o.scopeMetrics)!=null&&r.push(o.scopeMetrics),(o==null?void 0:o.errors)!=null&&i.push(...o.errors)});return function(e){return a.apply(this,arguments)}}());return yield Promise.all(a),{resourceMetrics:{resource:t._sharedState.resource,scopeMetrics:r},errors:i}})()}forceFlush(e){var t=this;return W(function*(){yield t._metricReader.forceFlush(e)})()}shutdown(e){var t=this;return W(function*(){yield t._metricReader.shutdown(e)})()}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){var t,n,r;return(t=(n=(r=this._metricReader).selectCardinalityLimit)==null?void 0:n.call(r,e))==null?2e3:t}};L();var es=/[\^$\\.+?()[\]{}|]/g,ts=class e{constructor(t){I(this,`_matchAll`,void 0),I(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(es,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},ns=class{constructor(e){I(this,`_matchAll`,void 0),I(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};L();var rs=class{constructor(e){var t;I(this,`_nameFilter`,void 0),I(this,`_type`,void 0),I(this,`_unitFilter`,void 0),this._nameFilter=new ts((t=e==null?void 0:e.name)==null?`*`:t),this._type=e==null?void 0:e.type,this._unitFilter=new ns(e==null?void 0:e.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};L();var is=class{constructor(e){I(this,`_nameFilter`,void 0),I(this,`_versionFilter`,void 0),I(this,`_schemaUrlFilter`,void 0),this._nameFilter=new ns(e==null?void 0:e.name),this._versionFilter=new ns(e==null?void 0:e.version),this._schemaUrlFilter=new ns(e==null?void 0:e.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};L();function as(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function os(e){if(as(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&((e==null?void 0:e.instrumentName)==null||ts.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var ss=class{constructor(e){var t;I(this,`name`,void 0),I(this,`description`,void 0),I(this,`aggregation`,void 0),I(this,`attributesProcessor`,void 0),I(this,`instrumentSelector`,void 0),I(this,`meterSelector`,void 0),I(this,`aggregationCardinalityLimit`,void 0),os(e),e.attributesProcessors==null?this.attributesProcessor=Jo():this.attributesProcessor=Yo(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Ja((t=e.aggregation)==null?{type:qa.DEFAULT}:t),this.instrumentSelector=new rs({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new is({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};L();var cs=class{constructor(e){var t;if(I(this,`_sharedState`,void 0),I(this,`_shutdown`,!1),this._sharedState=new Qo((t=e==null?void 0:e.resource)==null?ao():t),(e==null?void 0:e.views)!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new ss(t));if((e==null?void 0:e.readers)!=null&&e.readers.length>0)for(let t of e.readers){let e=new $o(this._sharedState,t);t.setMetricProducer(e),this._sharedState.metricCollectors.push(e)}}getMeter(e,t=``,n={}){return this._shutdown?(P.warn(`A shutdown MeterProvider cannot provide a Meter`),fe()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}shutdown(e){var t=this;return W(function*(){if(t._shutdown){P.warn(`shutdown may only be called once per MeterProvider`);return}t._shutdown=!0,yield Promise.all(t._sharedState.metricCollectors.map(t=>t.shutdown(e)))})()}forceFlush(e){var t=this;return W(function*(){if(t._shutdown){P.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}yield Promise.all(t._sharedState.metricCollectors.map(t=>t.forceFlush(e)))})()}},ls;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]=`AGGREGATION_TEMPORALITY_UNSPECIFIED`,e[e.AGGREGATION_TEMPORALITY_DELTA=1]=`AGGREGATION_TEMPORALITY_DELTA`,e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]=`AGGREGATION_TEMPORALITY_CUMULATIVE`})(ls||(ls={}));function us(e,t){let n={attributes:fs(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function ds(e){return{name:e.name,version:e.version}}function fs(e,t){return Object.keys(e).map(n=>ps(n,e[n],t))}function ps(e,t,n){return{key:e,value:ms(t,n)}}function ms(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]=ms(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:ms(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function hs(e,t){let n=us(e.resource,t);return{resource:n,schemaUrl:n.schemaUrl,scopeMetrics:gs(e.scopeMetrics,t)}}function gs(e,t){return Array.from(e.map(e=>({scope:ds(e.scope),metrics:e.metrics.map(e=>_s(e,t)),schemaUrl:e.scope.schemaUrl})))}function _s(e,t){let n={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},r=Ss(e.aggregationTemporality);switch(e.dataPointType){case qi.SUM:n.sum={aggregationTemporality:r,isMonotonic:e.isMonotonic,dataPoints:ys(e,t)};break;case qi.GAUGE:n.gauge={dataPoints:ys(e,t)};break;case qi.HISTOGRAM:n.histogram={aggregationTemporality:r,dataPoints:bs(e,t)};break;case qi.EXPONENTIAL_HISTOGRAM:n.exponentialHistogram={aggregationTemporality:r,dataPoints:xs(e,t)};break}return n}function vs(e,t,n){let r={attributes:fs(e.attributes,n),startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)};switch(t){case pe.INT:r.asInt=e.value;break;case pe.DOUBLE:r.asDouble=e.value;break}return r}function ys(e,t){return e.dataPoints.map(n=>vs(n,e.descriptor.valueType,t))}function bs(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:fs(e.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function xs(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:fs(e.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function Ss(e){switch(e){case Ki.DELTA:return ls.AGGREGATION_TEMPORALITY_DELTA;case Ki.CUMULATIVE:return ls.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Cs(e,t){return{resourceMetrics:e.map(e=>hs(e,t))}}function ws(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Ts(e){return ws(e).toString()}var Es=typeof BigInt<`u`?Ts:yr;function Ds(e){return e}var Os={encodeHrTime:Es,encodeSpanContext:Ds,encodeOptionalSpanContext:Ds,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};function ks(e,t){return{resourceLogs:js(e,t)}}function As(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function js(e,t){let n=As(e);return Array.from(n,([e,n])=>{let r=us(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:ds(e[0].instrumentationScope),logRecords:e.map(e=>Ms(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Ms(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Ns(e.severityNumber),severityText:e.severityText,body:ms(e.body,t),eventName:e.eventName,attributes:Ps(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:(n=e.spanContext)==null?void 0:n.traceFlags,traceId:t.encodeOptionalSpanContext((r=e.spanContext)==null?void 0:r.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)==null?void 0:i.spanId)}}function Ns(e){return e}function Ps(e,t){return Object.keys(e).map(n=>ps(n,e[n],t))}var Fs={serializeRequest:e=>{let t=ks(e,Os);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 logs export response: ${e.message}. Returning empty response`),{}}}},Is={serializeRequest:e=>{let t=Cs([e],Os);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 metrics export response: ${e.message}. Returning empty response`),{}}}},Ls=256,Rs=512;function zs(e,t){let n=e&255|Ls;return t&&(n|=Rs),n}function Bs(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:fs(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Hs(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Vs(e,t)),droppedLinksCount:e.droppedLinksCount,flags:zs(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Vs(e,t){var n;return{attributes:e.attributes?fs(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:zs(e.context.traceFlags,e.context.isRemote)}}function Hs(e,t){return{attributes:e.attributes?fs(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Us(e,t){return{resourceSpans:Gs(e,t)}}function Ws(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 Gs(e,t){let n=Ws(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=>Bs(e,t));o.push({scope:ds(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=us(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var Ks={serializeRequest:e=>{let t=Us(e,Os);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`),{}}}};L();var qs=5,Js=1e3,Ys=5e3,Xs=1.5,Zs=.2;function Qs(){return 2*Zs*Math.random()-Zs}var $s=class{constructor(e){I(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 W(function*(){let r=qs,i=Js,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+Qs()),Ys),0);i*=Xs;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 ${qs-r} retry attempts.`):o.status===`retryable`?P.info(`Export failed after maximum retry attempts (${qs}).`):P.info(`Export failed with non-retryable error: ${o.error}`),o})()}shutdown(){return this._transport.shutdown()}};function ec(e){return new $s(e.transport)}function tc(e){return e===429||e===502||e===503||e===504}function nc(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}L();var rc=60*1024,ic=9,ac=0,oc=0,sc=class{constructor(e){I(this,`_parameters`,void 0),this._parameters=e}send(e,t){var n=this;return W(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=ac+o>rc,c=!s&&!(oc>=ic);if(c)ac+=o,oc++;else{let e=s?`size limit`:`count limit`;P.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${oc} 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`}):tc(i.status)?(P.warn(`export response retryable (status: ${i.status})`),{status:`retryable`,retryInMillis:nc(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 lc(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&&(ac-=o,oc--)}})()}shutdown(){}};function cc(e){return new sc(e)}function lc(e){return e instanceof TypeError&&!e.cause}function uc(e,t){return Fi(e,t,ec({transport:cc(e)}))}function dc(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}q();function fc(e,t,n){return W(function*(){let r=K({},yield n()),i={};return t!=null&&Object.assign(i,yield t()),e!=null&&Object.assign(i,dc(yield e())),Object.assign(i,r)})}function pc(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 mc(e,t,n){var r,i;return K(K({},Di(e,t,n)),{},{headers:fc(e.headers,t.headers,n.headers),url:(r=(i=pc(e.url))==null?t.url:i)==null?n.url:r})}function hc(e,t){return K(K({},Oi()),{},{headers:function(){var t=W(function*(){return e});return function(){return t.apply(this,arguments)}}(),url:`http://localhost:4318/`+t})}function gc(e){return typeof e.headers==`function`?e.headers:Ei(e.headers)}function _c(e,t,n){return mc({url:e.url,timeoutMillis:e.timeoutMillis,headers:gc(e),concurrencyLimit:e.concurrencyLimit},{},hc(n,t))}function vc(e,t,n,r){return uc(_c(e,n,r),t)}var yc=class extends Si{constructor(e={}){super(vc(e,Fs,`v1/logs`,{"Content-Type":`application/json`}))}},bc;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e[e.LOWMEMORY=2]=`LOWMEMORY`})(bc||(bc={})),L();var xc=()=>Ki.CUMULATIVE,Sc=e=>{switch(e){case G.COUNTER:case G.OBSERVABLE_COUNTER:case G.GAUGE:case G.HISTOGRAM:case G.OBSERVABLE_GAUGE:return Ki.DELTA;case G.UP_DOWN_COUNTER:case G.OBSERVABLE_UP_DOWN_COUNTER:return Ki.CUMULATIVE}},Cc=e=>{switch(e){case G.COUNTER:case G.HISTOGRAM:return Ki.DELTA;case G.GAUGE:case G.UP_DOWN_COUNTER:case G.OBSERVABLE_UP_DOWN_COUNTER:case G.OBSERVABLE_COUNTER:case G.OBSERVABLE_GAUGE:return Ki.CUMULATIVE}};function wc(){var e;let t=((e=void 0)==null?`cumulative`:e).toLowerCase();return t===`cumulative`?xc:t===`delta`?Sc:t===`lowmemory`?Cc:(P.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${t}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),xc)}function Tc(e){return e==null?wc():e===bc.DELTA?Sc:e===bc.LOWMEMORY?Cc:xc}var Ec=Object.freeze({type:qa.DEFAULT});function Dc(e){var t;return(t=e==null?void 0:e.aggregationPreference)==null?(()=>Ec):t}var Oc=class extends Si{constructor(e,t){super(e),I(this,`_aggregationTemporalitySelector`,void 0),I(this,`_aggregationSelector`,void 0),this._aggregationSelector=Dc(t),this._aggregationTemporalitySelector=Tc(t==null?void 0:t.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}},kc=class extends Oc{constructor(e){super(vc(e==null?{}:e,Is,`v1/metrics`,{"Content-Type":`application/json`}),e)}},Ac=class extends Si{constructor(e={}){super(vc(e,Ks,`v1/traces`,{"Content-Type":`application/json`}))}};function jc(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function Mc(e){e.forEach(e=>e.disable())}function Nc(e){var t,n;let r=e.tracerProvider||F.getTracerProvider(),i=e.meterProvider||qe.getMeterProvider(),a=e.loggerProvider||Gi.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return jc(o,r,i,a),()=>{Mc(o)}}function Pc(e){return Fc(e,new WeakSet)}function Fc(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Fc(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Fc(e,t))}return!1}L();var Ic=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){I(this,`hrTime`,void 0),I(this,`hrTimeObserved`,void 0),I(this,`spanContext`,void 0),I(this,`resource`,void 0),I(this,`instrumentationScope`,void 0),I(this,`attributes`,{}),I(this,`_severityText`,void 0),I(this,`_severityNumber`,void 0),I(this,`_body`,void 0),I(this,`_eventName`,void 0),I(this,`_attributesCount`,0),I(this,`_droppedAttributesCount`,0),I(this,`_isReadonly`,!1),I(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=_r(r==null?f:r),this.hrTimeObserved=_r(i==null?f:i),d){let e=F.getSpanContext(d);e&&Ne(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return P.warn(`Invalid attribute key: ${e}`),this;if(!Pc(t))return P.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&P.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return P.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(tr,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(rr,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(rr,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(tr,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(nr,n.stack),t=!0)}t||P.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&P.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};L(),q();var Lc=class{constructor(e,t){I(this,`instrumentationScope`,void 0),I(this,`_sharedState`,void 0),I(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){var t;let n=this._loggerConfig,r=e.context||N.active(),i=(t=e.severityNumber)==null?Ii.UNSPECIFIED:t;if(i!==Ii.UNSPECIFIED&&i<n.minimumSeverity)return;if(n.traceBased){let e=F.getSpanContext(r);if(e&&Ne(e)&&(e.traceFlags&M.SAMPLED)!==M.SAMPLED)return}let a=new Ic(this._sharedState,this.instrumentationScope,K({context:r},e));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==Ii.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||N.active();if(t.traceBased){let e=F.getSpanContext(r);if(e&&Ne(e)&&(e.traceFlags&M.SAMPLED)!==M.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e==null?void 0:e.severityNumber,eventName:e==null?void 0:e.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},Rc=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};L();var zc=class{constructor(e,t){I(this,`processors`,void 0),I(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return W(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>_i(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return W(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function Bc(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Vc=`otel.sdk.log.created`;L();var Hc=class{constructor(e){I(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(Vc,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},Uc=`0.217.0`;q(),L();var Wc={disabled:!1,minimumSeverity:Ii.UNSPECIFIED,traceBased:!1},Gc=()=>K({},Wc),Kc=class{constructor(e,t,n,r,i,a){I(this,`loggers`,new Map),I(this,`activeProcessor`,void 0),I(this,`registeredLogRecordProcessors`,[]),I(this,`resource`,void 0),I(this,`forceFlushTimeoutMillis`,void 0),I(this,`logRecordLimits`,void 0),I(this,`processors`,void 0),I(this,`loggerMetrics`,void 0),I(this,`_loggerConfigurator`,void 0),I(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new zc(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Rc,this._loggerConfigurator=i==null?Gc:i;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,Uc):fe();this.loggerMetrics=new Hc(o)}getLoggerConfig(e){let t=Bc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};L();var qc=class{constructor(e={}){var t,n,r,i,a,o,s,c;I(this,`_shutdownOnce`,void 0),I(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?ao():t,forceFlushTimeoutMillis:(n=e.forceFlushTimeoutMillis)==null?3e4:n,logRecordLimits:{attributeCountLimit:(r=(i=e.logRecordLimits)==null?void 0:i.attributeCountLimit)==null?128:r,attributeValueLengthLimit:(a=(o=e.logRecordLimits)==null?void 0:o.attributeValueLengthLimit)==null?1/0:a},loggerConfigurator:(s=e.loggerConfigurator)==null?Gc:s,processors:(c=e.processors)==null?[]:c,meterProvider:e.meterProvider};this._sharedState=new Kc(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator,l.meterProvider),this._shutdownOnce=new yi(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return P.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ri;e||P.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Lc({name:r,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(P.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(P.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};L();function Jc(e){return Yc.apply(this,arguments)}function Yc(){return Yc=W(function*(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&(yield Promise.all(t))}),Yc.apply(this,arguments)}var Xc=class{constructor(e,t,n){I(this,`_exportCompleted`,void 0),I(this,`_exportScheduledPromise`,void 0),I(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(e,t,n){var r=this;return W(function*(){try{yield Jc(t),yield N.with(In(N.active()),W(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){$n(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return W(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{if(clearTimeout(o),e.code===U.SUCCESS)i();else{var t;a((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):t)}}),r._exportScheduledResolve()})})()}},Zc=class{constructor(e,t){var n,r,i,a;I(this,`_maxExportBatchSize`,void 0),I(this,`_maxQueueSize`,void 0),I(this,`_scheduledDelayMillis`,void 0),I(this,`_exportTimeoutMillis`,void 0),I(this,`_exporter`,void 0),I(this,`_currentExport`,null),I(this,`_finishedLogRecords`,[]),I(this,`_timer`,void 0),I(this,`_shutdownOnce`,void 0),I(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=(n=t==null?void 0:t.maxExportBatchSize)==null?512:n,this._maxQueueSize=(r=t==null?void 0:t.maxQueueSize)==null?2048:r,this._scheduledDelayMillis=(i=t==null?void 0:t.scheduledDelayMillis)==null?5e3:i,this._exportTimeoutMillis=(a=t==null?void 0:t.exportTimeoutMillis)==null?3e4:a,this._shutdownOnce=new yi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(P.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return W(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return W(function*(){if(e._flushing)return;e._flushing=!0;let t=e._finishedLogRecords;for(e._finishedLogRecords=[],e._clearTimer(),e._currentExport!==null&&(yield e._exporter.forceFlush(),yield e._currentExport.exportCompleted,e._currentExport=null);t.length>0;){let n;t.length<=e._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,e._maxExportBatchSize);let r=new Xc(e._exporter,n,e._exportTimeoutMillis);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){$n(e)}finally{e._currentExport=null}}e._flushing=!1,e._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new Xc(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,$n(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};L();var Qc=class extends Zc{constructor(e,t){super(e,t),I(this,`_visibilityChangeListener`,void 0),I(this,`_pageHideListener`,void 0),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}},$c=`exception`;L();var el=class{constructor(e){var t,n;I(this,`_spanContext`,void 0),I(this,`kind`,void 0),I(this,`parentSpanContext`,void 0),I(this,`attributes`,{}),I(this,`links`,[]),I(this,`events`,[]),I(this,`startTime`,void 0),I(this,`resource`,void 0),I(this,`instrumentationScope`,void 0),I(this,`_droppedAttributesCount`,0),I(this,`_droppedEventsCount`,0),I(this,`_droppedLinksCount`,0),I(this,`_attributesCount`,0),I(this,`name`,void 0),I(this,`status`,{code:We.UNSET}),I(this,`endTime`,[0,0]),I(this,`_ended`,!1),I(this,`_duration`,[-1,-1]),I(this,`_spanProcessor`,void 0),I(this,`_spanLimits`,void 0),I(this,`_attributeValueLengthLimit`,void 0),I(this,`_recordEndMetrics`,void 0),I(this,`_performanceStartTime`,void 0),I(this,`_performanceOffset`,void 0),I(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=dr.now(),this._performanceOffset=r-(this._performanceStartTime+dr.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(!Kn(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++),Cr(t)&&(Cr(n)||(n=t),t=void 0);let i=Wn(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=Wn(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===We.UNSET||this.status.code===We.OK)return this;let t={code:e.code};return e.code===We.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=vr(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<=dr.now())return gr(e+this._performanceOffset);if(typeof e==`number`)return hr(e);if(e instanceof Date)return hr(e.getTime());if(Sr(e))return e;if(this._startTimeProvided)return hr(Date.now());let t=dr.now()-this._performanceStartTime;return wr(this.startTime,hr(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[tr]=e:e&&(e.code?n[rr]=e.code.toString():e.name&&(n[rr]=e.name),e.message&&(n[tr]=e.message),e.stack&&(n[nr]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent($c,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}},J;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(J||(J={}));var tl=class{shouldSample(){return{decision:J.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},nl=class{shouldSample(){return{decision:J.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};L();var rl=class{constructor(e){var t,n,r,i;I(this,`_root`,void 0),I(this,`_remoteParentSampled`,void 0),I(this,`_remoteParentNotSampled`,void 0),I(this,`_localParentSampled`,void 0),I(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||($n(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new nl),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new nl:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new tl:n,this._localParentSampled=(r=e.localParentSampled)==null?new nl:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new tl:i}shouldSample(e,t,n,r,i,a){let o=F.getSpanContext(e);return!o||!Ne(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&M.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&M.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};L();var il=class{constructor(e=0){I(this,`_ratio`,void 0),I(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:je(t)&&this._accumulate(t)<this._upperBound?J.RECORD_AND_SAMPLED:J.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}},al;(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`})(al||(al={}));var ol=1;function sl(){var e,t,n,r,i,a,o,s;return{sampler:cl(),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 cl(){var e;let t=(e=void 0)==null?al.ParentBasedAlwaysOn:e;switch(t){case al.AlwaysOn:return new nl;case al.AlwaysOff:return new tl;case al.ParentBasedAlwaysOn:return new rl({root:new nl});case al.ParentBasedAlwaysOff:return new rl({root:new tl});case al.TraceIdRatio:return new il(ll());case al.ParentBasedTraceIdRatio:return new rl({root:new il(ll())});default:return P.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${al.ParentBasedAlwaysOn}".`),new rl({root:new nl})}}function ll(){return P.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${ol}.`),ol}var ul=1/0;function dl(e){let t={sampler:cl()},n=sl(),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 fl(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?ul:s,Object.assign({},e,{spanLimits:p})}L();var pl=class{constructor(e,t){var n,r,i,a;I(this,`_maxExportBatchSize`,void 0),I(this,`_maxQueueSize`,void 0),I(this,`_scheduledDelayMillis`,void 0),I(this,`_exportTimeoutMillis`,void 0),I(this,`_exporter`,void 0),I(this,`_isExporting`,!1),I(this,`_finishedSpans`,[]),I(this,`_timer`,void 0),I(this,`_shutdownOnce`,void 0),I(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 yi(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&M.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);N.with(In(N.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===U.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=>{$n(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,$n(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)}};L();var ml=class extends pl{constructor(e,t){super(e,t),I(this,`_visibilityChangeListener`,void 0),I(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=>{$n(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{$n(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))}},hl=16,gl=8,_l=new Uint8Array(hl),vl=new Uint8Array(gl),yl=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function bl(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 xl(e){let t=``;for(let n=0;n<e.length;n++)t+=yl[e[n]];return t}var Sl=class{generateTraceId(){return bl(_l),xl(_l)}generateSpanId(){return bl(vl),xl(vl)}},Cl=`otel.span.parent.origin`,wl=`otel.span.sampling_result`,Tl=`otel.sdk.span.live`,El=`otel.sdk.span.started`;L();var Dl=class{constructor(e){I(this,`startedSpans`,void 0),I(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(El,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(Tl,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=kl(t);if(this.startedSpans.add(1,{[Cl]:Ol(e),[wl]:n}),t===J.NOT_RECORD)return()=>{};let r={[wl]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Ol(e){return e?e.isRemote?`remote`:`local`:`none`}function kl(e){switch(e){case J.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case J.RECORD:return`RECORD_ONLY`;case J.NOT_RECORD:return`DROP`}}var Al=`2.7.1`;L();var jl=class{constructor(e,t,n,r){I(this,`_sampler`,void 0),I(this,`_generalLimits`,void 0),I(this,`_spanLimits`,void 0),I(this,`_idGenerator`,void 0),I(this,`instrumentationScope`,void 0),I(this,`_resource`,void 0),I(this,`_spanProcessor`,void 0),I(this,`_tracerMetrics`,void 0);let i=dl(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new Sl,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,Al):fe();this._tracerMetrics=new Dl(a)}startSpan(e,t={},n=N.active()){var r,i,a;t.root&&(n=F.deleteSpan(n));let o=F.getSpan(n);if(Ln(n))return P.debug(`Instrumentation suppressed, returning Noop Span`),F.wrapSpanContext(be);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!F.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?Ue.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:Wn(e.attributes)})),m=Wn(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===He.RECORD_AND_SAMPLED?M.SAMPLED:M.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===He.NOT_RECORD)return P.debug(`Recording is off, propagating context in a non-recording span`),F.wrapSpanContext(v);let y=Wn(Object.assign(m,h.attributes));return new el({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?N.active():i,l=this.startSpan(e,a,c),u=F.setSpan(c,l);return N.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};L();var Ml=class{constructor(e){I(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=>{$n(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)})}};L();var Nl;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Nl||(Nl={}));var Pl=class{constructor(e={}){var t,n;I(this,`_config`,void 0),I(this,`_tracers`,new Map),I(this,`_resource`,void 0),I(this,`_activeSpanProcessor`,void 0);let r=si({},sl(),fl(e));this._resource=(t=r.resource)==null?ao():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new Ml(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 jl({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=Nl.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Nl.timeout&&(r=Nl.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Nl.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Nl.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};L();var Fl=class{constructor(e){I(this,`_exporter`,void 0),I(this,`_shutdownOnce`,void 0),I(this,`_pendingExports`,void 0),this._exporter=e,this._shutdownOnce=new yi(this._shutdown,this),this._pendingExports=new Set}forceFlush(){var e=this;return W(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&M.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>$n(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}_doExport(e){var t=this;return W(function*(){if(e.resource.asyncAttributesPending){var n,r;yield(n=(r=e.resource).waitForAsyncAttributes)==null?void 0:n.call(r)}let i=yield xi._export(t._exporter,[e]);if(i.code!==U.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()}};L();var Il=class{constructor(){I(this,`_enabled`,!1),I(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 Ll(e){if(e!==null){if(e===void 0){let e=new Il;e.enable(),N.setGlobalContextManager(e);return}e.enable(),N.setGlobalContextManager(e)}}function Rl(e){if(e!==null){if(e===void 0){nt.setGlobalPropagator(new Tr({propagators:[new Wr,new Un]}));return}nt.setGlobalPropagator(e)}}var zl=class extends Pl{constructor(e={}){super(e)}register(e={}){F.setGlobalTracerProvider(this),Rl(e.propagator),Ll(e.contextManager)}},Bl=e=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`,Vl=()=>typeof window>`u`?`http://localhost`:window.location.origin,Hl=e=>{try{return new URL(e,Vl()).href}catch(t){return e}},Ul=e=>e.length>1?e.replace(/\/+$/,``):e,Wl=(e,t)=>{let n=e=>Ul(e.replace(/[?#].*$/,``));return n(e)===n(t)},Gl=(e,t)=>{let n=Hl(t);return[e.transport.traces,e.transport.metrics,e.transport.logs].filter(e=>e!==!1).some(e=>Wl(n,Hl(e.endpoint)))},Kl=(e,t)=>Gl(e,t),ql=(e,t)=>typeof e==`function`?e(t):typeof e==`string`?t.includes(e):(e.lastIndex=0,e.test(t)),Jl=(e,t)=>(Array.isArray(e)?e:e?[e]:[]).some(e=>ql(e,t)),Yl=e=>typeof e.tracking.request==`object`?e.tracking.request:void 0,Xl=(e,t)=>{var n;return Kl(e,t)||Jl((n=Yl(e))==null?void 0:n.excludedUrls,Hl(t))},Zl=(e,t)=>{var n;return e.transport.traces!==!1&&Jl((n=Yl(e))==null?void 0:n.allowedTracingUrls,Hl(t))},Y={actionErrorCount:`action.error.count`,actionFrustrationCount:`action.frustration.count`,actionFrustrationType:`action.frustration.type`,actionId:`action.id`,actionLoadingTime:`action.loading_time`,actionLongTaskCount:`action.long_task.count`,actionName:`action.name`,actionResourceCount:`action.resource.count`,actionTargetName:`action.target.name`,actionTargetTag:`action.target.tag`,actionType:`action.type`,deploymentEnvironmentName:`deployment.environment.name`,browserName:`browser.name`,browserVersion:`browser.version`,cacheHit:`resource.cache.hit`,deviceType:`device.type`,durationBucket:`duration_bucket`,errorType:`error_type`,eventLabel:`event_label`,exceptionFingerprint:`exception.fingerprint`,exceptionMessageShort:`exception.message_short`,exceptionStackTopFrame:`exception.stack_top_frame`,longTaskBlockingDuration:`long_task.blocking_duration`,longTaskCulprit:`long_task.culprit`,longTaskDuration:`long_task.duration`,longTaskEntryType:`long_task.entry_type`,longTaskId:`long_task.id`,longTaskIsFrozenFrame:`long_task.is_frozen_frame`,longTaskScriptCount:`long_task.script.count`,longTaskStartTime:`long_task.start_time`,networkEffectiveType:`network.effective_type`,nextHopProtocol:`resource.protocol`,result:`result`,serviceName:`service.name`,serviceVersion:`service.version`,osName:`os.name`,sessionHasReplay:`session.has_replay`,sessionId:`session.id`,sessionStartTime:`session.start_time`,spanSubtype:`span_subtype`,spanType:`span_type`,statusClass:`status_class`,targetDomain:`target_domain`,targetLabel:`target_label`,targetPathTemplate:`target_path_template`,targetValue:`target_value`,traceScene:`trace_scene`,transferSize:`transfer_size`,userId:`user.id`,vitalMetric:`vital.metric`,vitalRating:`vital.rating`,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`,viewLoadingType:`view.loading_type`,viewName:`view.name`,viewUrl:`view.url`,viewUrlPathGroup:`view.url_path_group`};q();var X={abort:`abort`,error:`error`,success:`success`,timeout:`timeout`,warning:`warning`},Z={action:`action`,custom:`custom`,document:`document`,error:`error`,longtask:`longtask`,resource:`resource`,route:`route`,vital:`vital`},Ql=e=>e<100?`<100ms`:e<500?`100~500ms`:e<2e3?`500ms~2s`:`>2s`,$l=e=>`${Math.trunc(e/100)}xx`,eu=e=>e===408||e===504?X.timeout:typeof e==`number`&&e>=400?X.error:X.success,tu=e=>e===408||e===504?`network_timeout`:typeof e!=`number`||e<400?`none`:e>=500?`http_5xx`:`http_4xx`,nu=e=>e===`good`?X.success:X.warning,ru=(e,t)=>{if(!e)return{};try{let n=new URL(e,typeof location>`u`?`http://localhost`:location.href),r=t==null?n.pathname:t;return{domain:n.host,label:`${n.host}${r}`,pathTemplate:r}}catch(n){return{label:e,pathTemplate:t==null?e:t}}},Q=({duration:e,errorType:t=`none`,eventLabel:n,result:r=X.success,spanSubtype:i,spanType:a,targetLabel:o,targetValue:s,traceScene:c})=>K(K(K(K(K({[Y.spanType]:a,[Y.spanSubtype]:i,[Y.result]:r,[Y.errorType]:t},e===void 0?{}:{[Y.durationBucket]:Ql(e)}),n===void 0?{}:{[Y.eventLabel]:n}),o===void 0?{}:{[Y.targetLabel]:o}),s===void 0?{}:{[Y.targetValue]:s}),c===void 0?{}:{[Y.traceScene]:c}),iu=({duration:e,initiatorType:t=`other`,method:n,networkError:r=!1,responseStatus:i,transferSize:a,url:o,urlPathTemplate:s})=>{var c;let l=ru(o,s),u=t===`fetch`||t===`xhr`,d=r?X.error:typeof i==`number`?eu(i):X.success,f=n==null?void 0:n.toUpperCase();return K(K(K(K(K(K(K({},Q({duration:e,errorType:r?`network`:typeof i==`number`?tu(i):`none`,eventLabel:u?`请求资源`:`静态资源`,result:d,spanSubtype:t,spanType:Z.resource,targetLabel:(c=l.label)==null?o:c,targetValue:u?i:a})),l.domain?{[Y.targetDomain]:l.domain}:{}),l.pathTemplate?{[Y.targetPathTemplate]:l.pathTemplate}:{}),{},{"resource.type":t,"resource.url":o},e===void 0?{}:{"resource.duration":e}),f?{"http.request.method":f,"resource.method":f}:{}),typeof a==`number`?{"resource.size":a}:{}),typeof i==`number`?K({"http.response.status_code":i,"resource.status_code":i},i>0?{[Y.statusClass]:$l(i)}:{}):{})};q();var au=100,ou=100,su=1e3,cu=100,lu=1e4,uu=`data-bk-action-name`,du=100,fu=10,pu=e=>e.replace(/\s+/g,` `).trim().slice(0,du),mu=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},hu=(e,t)=>{let n=e;for(;n;){let e=n.getAttribute(t);if(e)return pu(e);n=mu(n)}},gu=e=>{var t;return e.isContentEditable?``:pu((t=e.textContent)==null?``:t)},_u=e=>{var t,n;let r=e,i=(t=r.labels)==null?void 0:t[0];if(i){let e=gu(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=pu((s=r.value)==null?``:s);if(e)return e}if(a===`button`||a===`label`||e.getAttribute(`role`)===`button`){let t=gu(e);if(t)return t}for(let t of[`aria-label`,`alt`,`name`,`title`,`placeholder`]){var c;let n=pu((c=e.getAttribute(t))==null?``:c);if(n)return n}},vu=(e,t=uu,n=!1)=>{let r=hu(e,t);if(r)return r;if(!n)return e.tagName.toLowerCase();let i=e,a=0;for(;i&&a<=fu;){let e=i.tagName.toLowerCase();if(e===`body`||e===`html`||e===`head`)break;let t=_u(i);if(t)return t;if(e===`form`)break;i=mu(i),a+=1}for(i=e,a=0;i&&a<=fu;){let e=i.tagName.toLowerCase();if(e===`body`||e===`html`||e===`head`)break;let t=gu(i);if(t)return t;if(e===`form`)break;i=mu(i),a+=1}return e.tagName.toLowerCase()},yu=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},bu=e=>{let t=e.timeStamp;return!Number.isFinite(t)||t<=0?Date.now():t>0xe8d4a51000?t:typeof performance>`u`?Date.now():performance.timeOrigin+t},xu=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,Su=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=mu(t)}return!1},Cu=(e={})=>{let t=[],n=new Map,r=new Set,i=e.actionNameAttribute||uu,a=xu(e.maxDuration,lu),o=[],s,c=()=>{s==null||s.setRuntimeAttributes({[Y.actionId]:n.size?[...n.keys()]:void 0})},l=e=>!e.hadActivity&&!e.userActivity.input&&!e.userActivity.scroll&&!e.userActivity.selection&&!Su(e.target),u=e=>{var t;if(!r.delete(e)||!s||!e.completed||e.discardedByRage)return;clearTimeout(e.reportTimer),e.counts.error&&e.frustrations.add(`error_click`),((t=e.rageSources)==null?[e]:t).some(l)&&e.frustrations.add(`dead_click`);let n=[`rage_click`,`dead_click`,`error_click`].filter(t=>e.frustrations.has(t)),{endTime:i,hasLoadingTime:a}=e.completed,o=Math.max(0,i-e.startTime),c=e.counts.error>0||n.length>0,u=s.startSpan(`action.click`,K(K(K(K(K({},s.config.hooks.getPageAttributes()),Q({duration:a?o:void 0,errorType:e.counts.error?`js`:n.length?`frustration`:`none`,eventLabel:`用户操作`,result:c?X.warning:X.success,spanSubtype:`click`,spanType:Z.action,targetLabel:e.targetName,targetValue:a?o:void 0,traceScene:`user_action`})),e.runtimeAttributes),{},{[Y.actionId]:e.id,[Y.actionType]:`click`,[Y.actionName]:`Click on ${e.targetName}`,[Y.actionTargetName]:e.targetName,[Y.actionTargetTag]:e.targetTag,[Y.actionResourceCount]:e.counts.resource,[Y.actionErrorCount]:e.counts.error,[Y.actionLongTaskCount]:e.counts.longTask,[Y.actionFrustrationCount]:n.length},n.length?{[Y.actionFrustrationType]:n}:{}),a?{[Y.actionLoadingTime]:o}:{}),{startTime:e.startTime});u.setAttributes(K(K({},e.runtimeAttributes),{},{[Y.actionId]:e.id})),u.end(a?i: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+su-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+ou-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&&Jl(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;i.counts.resource+=1,m(i,e.time);continue}if(e.type===`long_task`||e.type===`resource`){var r;if(e.type===`resource`&&e.url&&Jl(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;i.counts[e.type===`long_task`?`longTask`:`resource`]+=1,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.counts.error+=1,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<=su);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)<=cu;if((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<=su){let t=o.slice(-3).map(e=>e.action);t.slice(0,-1).forEach(e=>{e.discardedByRage=!0}),e.frustrations.add(`rage_click`),e.rageSources=t,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(`button`in t&&typeof t.button==`number`&&t.button!==0)return;let r=yu(t);if(!r)return;let o=bu(t),s=Bl(`action`),u={counts:{error:0,longTask:0,resource:0},frustrations:new Set,hadActivity:!1,id:s,lastActivityTime:o,maxDurationTimer:setTimeout(()=>d(u,o+a,!0),a),pendingRequests:new Set,runtimeAttributes:l.getRuntimeAttributes(),startTime:o,target:r,targetName:vu(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)},au)};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=>{if(t.userActivity[e]=!0,e!==`input`&&t.frustrations.delete(`rage_click`)){var n;(n=t.rageSources)==null||n.slice(0,-1).forEach(e=>{e.discardedByRage=!1}),t.rageSources=void 0}})},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}}},wu=e=>{let t=e.type===`characterData`?e.target.parentElement:e.target;return t instanceof Element&&!!t.closest(`[data-bk-excluded-activity-mutations]`)},Tu=()=>{let e,t=[];return{name:`activity`,init(n){if(typeof document<`u`&&typeof MutationObserver<`u`&&(e=new MutationObserver(e=>{e.length&&!e.every(wu)&&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()}}},Eu=(e,t)=>!!(t&&Jl(e.config.view.excludedActivityUrls,t)),Du=(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||Eu(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||Eu(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())}},$=`bk.rum.sampled`,Ou=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},ku=({application:e,session:t},n)=>t.sampleRate<=0?!1:t.sampleRate>=1?!0:Ou(`${e.name}\0${n}`)<t.sampleRate;function Au(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 ju(e,t){if(e==null)return{};var n,r,i=Au(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}q();var Mu=e=>typeof e==`string`&&e.length>0?e:void 0,Nu=e=>{let t=Mu(e);return t?{[Y.viewUrlPathGroup]:t}:{}},Pu=e=>K(K({},Nu(e[Y.viewUrlPathGroup])),{},{[$]:e[$]===!0});q();var Fu=1e3,Iu=200,Lu=`body`,Ru=.8,zu=[`[data-loading="true"]`,`[aria-busy="true"]`,`.loading`,`.is-loading`,`.spinner`,`.skeleton`,`.bk-loading`],Bu=[[.2,.2],[.5,.2],[.8,.2],[.2,.5],[.5,.5],[.8,.5],[.2,.8],[.5,.8],[.8,.8]],Vu=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,Hu=(e,t)=>typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):t,Uu=e=>{if(!e)return``;let t=e.tagName.toLowerCase();return e.id?`${t}#${e.id}`:t},Wu=(e,t)=>t.some(t=>{try{return e.matches(t)||!!e.closest(t)}catch(e){return!1}}),Gu=e=>{if(typeof getComputedStyle!=`function`)return!0;let t=getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`&&Number(t.opacity||1)>0},Ku=(e,t)=>{if(typeof document.elementsFromPoint==`function`)return document.elementsFromPoint(e,t);let n=document.elementFromPoint(e,t);return n?[n]:[]},qu=(e,t)=>{let n=document.querySelector(e);if(!n)return{centerElement:Uu(Ku(window.innerWidth/2,window.innerHeight/2)[0]),emptyCount:Bu.length,ignoredCount:0,reason:`missing_root`,rootFound:!1,score:1,validCount:Bu.length};let r=0,i=0,a=``;for(let[e,o]of Bu){let s=Ku(window.innerWidth*e,window.innerHeight*o);if(e===.5&&o===.5&&(a=Uu(s[0])),s.some(e=>Wu(e,t))){i+=1;continue}s.some(e=>e!==n&&e!==document.body&&e!==document.documentElement&&n.contains(e)&&Gu(e))||(r+=1)}let o=Bu.length-i;return{centerElement:a,emptyCount:r,ignoredCount:i,reason:`empty_viewport`,rootFound:!0,score:o?r/o:0,validCount:o}},Ju=(e={})=>{var t;let n=Vu(e.checkDelay,Fu),r=Vu(e.confirmationDelay,Iu),i=e.rootSelector||Lu,a=Hu(e.threshold,Ru),o=[...zu,...(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=e.meter.createCounter(`browser.blank_screen.count`,{description:`Number of confirmed blank screens`}),p=()=>{clearTimeout(u),u=void 0},m=(n,r)=>{s!==n||c===n||(c=n,t.add(1,e.applyRedact(K(K(K({},e.config.hooks.getMetricAttributes()),Pu(e.getRuntimeAttributes())),{},{"blank_screen.reason":r.reason,"blank_screen.root_selector":i}))),e.startSpan(`browser.blank_screen`,K(K({},Q({errorType:`blank_screen`,eventLabel:`白屏`,result:X.error,spanSubtype:r.reason,spanType:Z.error,targetLabel:i,targetValue:r.score})),{},{"blank_screen.center_element":r.centerElement,"blank_screen.empty_ratio":r.score,"blank_screen.empty_sample_count":r.emptyCount,"blank_screen.ignored_sample_count":r.ignoredCount,"blank_screen.reason":r.reason,"blank_screen.root_found":r.rootFound,"blank_screen.root_selector":i,"blank_screen.sample_count":Bu.length,"blank_screen.valid_sample_count":r.validCount})).end())},h=t=>{if(s!==t||c===t||document.visibilityState===`hidden`)return;let n;try{n=qu(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=qu(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&&m(t,n)},r))},g=e=>{p(),document.visibilityState!==`hidden`&&(u=setTimeout(()=>h(e),n))};d=e.onViewChange(t=>{if(t.id!==s&&(p(),l==null||l(),l=void 0,s=t.id,c=void 0,t.id)){let n=t.id;l=Du(e,Date.now(),()=>{l=void 0,g(n)})}});let _=()=>{document.visibilityState===`hidden`?p():s&&c!==s&&g(s)};document.addEventListener(`visibilitychange`,_),f=()=>document.removeEventListener(`visibilitychange`,_)},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}}};q(),ut();var Yu=[`http.url`,`url.full`],Xu=`bk.rum.request.discard`,Zu=e=>{for(let n of Yu){var t;let r=(t=e.attributes)==null?void 0:t[n];if(typeof r==`string`)return r}},Qu=e=>{let t=e==null?void 0:e[Y.sessionId];return typeof t==`string`&&t.length>0},$u=e=>{let t=e==null?void 0:e[Y.viewId];return typeof t==`string`&&t.length>0},ed=e=>(e==null?void 0:e[`bk.rum.sampled`])===!0&&Qu(e)&&$u(e),td=class{constructor(e,t){this.inner=e,this.config=t}enabled(e){var t,n,r;return(t=(n=(r=this.inner).enabled)==null?void 0:n.call(r,e))==null?!0:t}forceFlush(){return this.inner.forceFlush()}onEmit(e,t){var n;let r=e.body===`session.start`||e.body===`session.rotate`;if(ed(e.attributes)||r&&((n=e.attributes)==null?void 0:n[`bk.rum.sampled`])===!0&&Qu(e.attributes)){delete e.attributes[$];try{var i,a,o,s,c;if(((i=this.config)==null||(o=(a=i.hooks).beforeSend)==null?void 0:o.call(a,{attributes:e.attributes,name:(s=e.eventName)==null?String((c=e.body)==null?``:c):s,signal:`log`}))===!1)return}catch(e){var l,u;(l=this.config)!=null&&l.debug&&((u=globalThis.console)==null||u.warn(`[bk-ot] tracking.beforeSend failed:`,e))}this.inner.onEmit(e,t)}}shutdown(){return this.inner.shutdown()}},nd=class{constructor(e,t,n){this.inner=e,this.config=t,this.getRuntimeAttributes=n}forceFlush(){return this.inner.forceFlush()}onEnd(e){let t=Zu(e);if(!(e.attributes[`bk.rum.request.discard`]===!0||t&&Gl(this.config,t)||!ed(e.attributes))){delete 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()}},rd=e=>K(K({},e),{},{dataPoints:e.dataPoints.filter(e=>e.attributes[$]===!0).map(e=>{let t=e.attributes,{[$]:n}=t,r=ju(t,[$].map(lt));return K(K({},e),{},{attributes:r})})}),id=class{constructor(e){this.inner=e}export(e,t){let n=K(K({},e),{},{scopeMetrics:e.scopeMetrics.map(e=>K(K({},e),{},{metrics:e.metrics.map(rd).filter(e=>e.dataPoints.length>0)})).filter(e=>e.metrics.length>0)});if(n.scopeMetrics.length===0){t({code:U.SUCCESS});return}this.inner.export(n,t)}forceFlush(){return this.inner.forceFlush()}selectAggregationTemporality(e){var t,n,r;return(t=(n=(r=this.inner).selectAggregationTemporality)==null?void 0:n.call(r,e))==null?Ki.CUMULATIVE:t}shutdown(){return this.inner.shutdown()}},ad=100,od=200,sd=[],cd=e=>e.replace(/#.*$/,``),ld=e=>{let t=sd.indexOf(e);t>=0&&sd.splice(t,1),e.timer!==void 0&&clearTimeout(e.timer)},ud=(e,t)=>{let n=e.callback;ld(e),e.callback=void 0,n==null||n(t)},dd=e=>{let t=performance.timeOrigin+e.startTime,n=sd.filter(n=>!n.entry&&cd(n.url)===cd(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&&ud(n,e))},fd=(e,t=Date.now())=>{let n={startTime:t,url:e};return sd.push(n),sd.length>ad&&ud(sd[0]),{cancel:()=>ud(n),complete:e=>{if(n.callback=e,n.entry){ud(n,n.entry);return}n.timer=setTimeout(()=>ud(n),od)}}};q();var pd=10*1024,md=[/^text\//i,/json/i,`application/x-www-form-urlencoded`,`application/graphql`],hd=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):pd,gd=(e,t,n)=>e?t.some(t=>typeof t==`string`?e.toLowerCase().includes(t.toLowerCase()):(t.lastIndex=0,t.test(e))):n,_d=e=>{try{var t;return e?(t=new Headers(e).get(`content-type`))==null?void 0:t:void 0}catch(e){return}},vd=function(){var e=W(function*(e,t){let n=e.getReader(),r=new TextDecoder,i=``;try{for(;i.length<=t;){let{done:e,value:t}=yield n.read();if(e){i+=r.decode();break}i+=r.decode(t,{stream:!0})}i.length>t&&(yield n.cancel().catch(()=>void 0))}finally{n.releaseLock()}return i});return function(t,n){return e.apply(this,arguments)}}(),yd=function(){var e=W(function*(e,t){if(typeof e==`string`)return e;if(typeof URLSearchParams<`u`&&e instanceof URLSearchParams)return e.toString();if(typeof Blob<`u`&&e instanceof Blob)return vd(e.stream(),t)});return function(t,n){return e.apply(this,arguments)}}(),bd=function(){var e=W(function*(e,t){if(typeof Request<`u`&&e instanceof Request){var n;let r=(n=e.headers.get(`content-type`))==null?void 0:n,i=e.clone();return{contentType:r,text:i.body?yield vd(i.body,t):``}}return{contentType:_d(e.headers),text:yield yd(e.body,t)}});return function(t,n){return e.apply(this,arguments)}}(),xd=e=>{if(typeof Request>`u`||!(e instanceof Request))return e;try{return e.clone()}catch(e){return}},Sd=function(){var e=W(function*(e,t){var n;if(!e)return{};let r=(n=e.headers.get(`content-type`))==null?void 0:n,i=e.clone();return{contentType:r,text:i.body?yield vd(i.body,t):``}});return function(t,n){return e.apply(this,arguments)}}(),Cd=e=>{var t;let n=(t=e.getResponseHeader(`content-type`))==null?void 0:t;return e.responseType===``||e.responseType===`text`?{contentType:n,text:e.responseText}:e.responseType===`json`?{contentType:n,text:JSON.stringify(e.response)}:{contentType:n}},wd=(e,t,n,r,i)=>{if(i===void 0)return;let a=hd(e.maxSize),o=i.length>a,s={body:i.slice(0,a*2),contentType:r,kind:n,method:t.resource.method,statusCode:t.resource.statusCode,truncated:o,type:t.resource.type,url:t.resource.url},c=e.redact(s);if(c!==void 0)return{body:c.slice(0,a),contentType:r,truncated:o||c.length>a}},Td=function(){var e=W(function*({bodyConfig:e,domainContext:t,event:n,fetchRequest:r,runtimeContext:i,span:a}){var o,s;let c=n.resource.statusCode,l=c===void 0||c===0||c>=400;if(((o=e.capture)==null?`errors`:o)===`errors`&&!l)return;let u=hd(e.maxSize)*2,d=(s=e.allowedContentTypes)==null?md:s,f={},p={};try{t.type===`fetch`?[f,p]=yield Promise.all([bd(r==null?t.request:r,u),Sd(t.response,u)]):(f={text:yield yd(t.requestBody,u)},p=Cd(t.xhr))}catch(e){return}let m,h;try{m=gd(f.contentType,d,!0)?wd(e,n,`request`,f.contentType,f.text):void 0,h=gd(p.contentType,d,!1)?wd(e,n,`response`,p.contentType,p.text):void 0}catch(e){return}if(!m&&!h)return;let g=a.spanContext();i.emitLog({attributes:K(K(K({},n.attributes),{},{"span.id":g.spanId,"trace.id":g.traceId},m?{"request.body":m.body,"request.body.content_type":m.contentType,"request.body.truncated":m.truncated}:{}),h?{"response.body":h.body,"response.body.content_type":h.contentType,"response.body.truncated":h.truncated}:{}),body:`browser.request.body`,context:F.setSpan(N.active(),a),eventName:`browser.request.body`,severityNumber:l?Ii.ERROR:Ii.INFO,severityText:l?`ERROR`:`INFO`})});return function(t){return e.apply(this,arguments)}}();q();var Ed=e=>e.deliveryType===`cache`||e.transferSize===0&&e.decodedBodySize>0?!0:void 0,Dd=(...e)=>e.every((t,n)=>n===0||e[n-1]<=t),Od=(e,t,n,r,i)=>{Dd(n,r,i)&&(e[`resource.${t}.start`]=r-n,e[`resource.${t}.duration`]=i-r)},kd=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)||!Dd(...n)?t:(Od(t,`first_byte`,e.startTime,e.requestStart,e.responseStart),Od(t,`download`,e.startTime,e.responseStart,e.responseEnd),e.workerStart>0&&e.workerStart<e.fetchStart&&Od(t,`worker`,e.startTime,e.workerStart,e.fetchStart),e.fetchStart<e.domainLookupEnd&&Od(t,`dns`,e.startTime,e.domainLookupStart,e.domainLookupEnd),e.fetchStart<e.connectEnd&&(Od(t,`connect`,e.startTime,e.connectStart,e.connectEnd),e.connectStart<=e.secureConnectionStart&&e.secureConnectionStart<=e.connectEnd&&Od(t,`ssl`,e.startTime,e.secureConnectionStart,e.connectEnd)),e.redirectEnd>e.startTime&&Dd(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart)&&Od(t,`redirect`,e.startTime,e.redirectStart,e.redirectEnd),t)},Ad=e=>e.duration===0&&e.responseEnd>e.startTime?e.responseEnd-e.startTime:e.duration,jd=e=>{let t=typeof e.deliveryType==`string`?e.deliveryType||`other`:void 0;return K(K(K(K({[Y.transferSize]:e.transferSize,[Y.cacheHit]:Ed(e),[Y.nextHopProtocol]:e.nextHopProtocol},kd(e)),t?{"resource.delivery_type":t}:{}),e.renderBlockingStatus?{"resource.render_blocking_status":e.renderBlockingStatus}:{}),{},{"resource.encoded_body_size":e.encodedBodySize,"resource.decoded_body_size":e.decodedBodySize})},Md=(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(!t.name||Kl(n.config,t.name))return;if(t.initiatorType===`fetch`||t.initiatorType===`xmlhttprequest`){dd(t);return}if(t.duration<0)return;let r=n.config.hooks.redactUrl(t.name),i=Ad(t),a=performance.timeOrigin+t.startTime,o=a+i;e&&n.startSpan(`browser.resource`,K(K(K({},n.config.hooks.getPageAttributes()),iu({duration:i,initiatorType:t.initiatorType||`other`,responseStatus:t.responseStatus,transferSize:t.transferSize,url:r,urlPathTemplate:n.config.hooks.getViewPathGroup(t.name)})),{},{"url.full":r,initiator_type:t.initiatorType||`other`},jd(t)),{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}}};q();var Nd=e=>typeof e.config.tracking.request==`object`?e.config.tracking.request:void 0,Pd=e=>{if(e.type===`xhr`)return e.xhr.status;if(e.response)return e.response.status;if(typeof e.error==`object`&&e.error&&`status`in e.error){let t=e.error.status;return typeof t==`number`?t:void 0}},Fd=e=>typeof e==`string`||e instanceof URL?Hl(String(e)):Hl(e.url),Id=(e,t)=>{var n;return((n=t==null?void 0:t.method)==null?typeof Request<`u`&&e instanceof Request?e.method:`GET`:n).toUpperCase()},Ld=(e,t)=>typeof Request<`u`&&e instanceof Request?e:t==null?{}:t,Rd=(e,t,n)=>{var r;let i=typeof Request<`u`&&e instanceof Request?e.headers:void 0,a=new Headers((r=t==null?void 0:t.headers)==null?i:r);return nt.inject(F.setSpan(N.active(),n),a,{set:(e,t,n)=>e.set(t,n)}),K(K({},t),{},{headers:a})},zd=(e,t)=>{let n={};nt.inject(F.setSpan(N.active(),t),n);for(let[t,r]of Object.entries(n))e.setRequestHeader(t,r)},Bd=(e,t)=>Kl(e.config,t)||Jl(e.config.view.excludedActivityUrls,t),Vd=(e,t)=>{if(Bd(e,t))return()=>{};let n=Bl(`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`}))}},Hd=(e,t)=>e.config.transport.traces===!1?{cancel(){},complete(e){e()}}:fd(t),Ud=(e,t,n)=>{var r;return e.startSpan(`browser.resource`,K(K(K({},e.config.hooks.getPageAttributes()),iu({initiatorType:t,method:n.method,url:(r=n.url)==null?``:r,urlPathTemplate:n.url?e.config.hooks.getViewPathGroup(n.url):void 0})),n.url?{"resource.url":e.config.hooks.redactUrl(n.url)}:{}),{kind:Ue.CLIENT})},Wd=(e,t,n,r,i={},a)=>{var o;let s=i.url,c=s?e.config.hooks.redactUrl(s):void 0,l=Pd(r),u=i.method,d={attributes:K(K(K({},e.config.hooks.getPageAttributes()),iu({initiatorType:n,method:u,networkError:r.type===`fetch`?!r.response:r.xhr.status===0,responseStatus:l,url:c==null?``:c,urlPathTemplate:s?e.config.hooks.getViewPathGroup(s):void 0})),c?{"resource.url":c,"url.full":c}:{}),resource:{method:u,statusCode:l,type:n,url:c},type:`resource`},f=!0;try{var p,m;f=(p=Nd(e))==null||(m=p.beforeSend)==null?void 0:m.call(p,d,r)}catch(t){var h;e.config.debug&&((h=globalThis.console)==null||h.warn(`[bk-ot] request.beforeSend failed:`,t))}if(t.setAttributes(e.applyRedact(d.attributes)),f===!1){t.setAttribute(Xu,!0);return}((l==null?0:l)>=400||l===0||r.type===`fetch`&&r.error)&&t.setStatus({code:We.ERROR});let g=e.config.transport.logs===!1||(o=Nd(e))==null?void 0:o.body;g&&Td({bodyConfig:g,domainContext:r,event:d,fetchRequest:a,runtimeContext:e,span:t})},Gd=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=W(function*(t,i){var a;let o=Fd(t);if(Xl(e.config,o))return r.call(this,t,i);let s={method:Id(t,i),url:o},c=Ud(e,`fetch`,s),l=Hd(e,o),u=Vd(e,o),d=Ld(t,i),f=e.config.transport.logs!==!1&&(a=Nd(e))!=null&&a.body?xd(d):void 0,p=Zl(e.config,o)?Rd(t,i,c):i,m=!1,h=t=>{m||(m=!0,n.delete(g),t&&c.setAttributes(e.applyRedact(jd(t))),c.end())},g=()=>{l.cancel(),h()};n.add(g);try{let n=yield r.call(this,t,p);return Wd(e,c,`fetch`,{request:d,response:n,type:`fetch`},s,f),l.complete(h),n}catch(t){throw Wd(e,c,`fetch`,{error:t,request:d,type:`fetch`},s,f),t instanceof Error&&c.recordException(t),l.complete(h),t}finally{u()}});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=XMLHttpRequest.prototype.open,a=XMLHttpRequest.prototype.send,o=function(e,t,n=!0,a,o){return r.set(this,{method:e.toUpperCase(),url:Hl(String(t))}),i.call(this,e,String(t),n,a,o)},s=function(t){var i;let o=(i=r.get(this))==null?{}:i;if(!o.url||Xl(e.config,o.url))return a.call(this,t);let s=Ud(e,`xhr`,o),c=Hd(e,o.url),l=Vd(e,o.url);Zl(e.config,o.url)&&zd(this,s);let u=!1,d=()=>{c.cancel(),!u&&(u=!0,n.delete(d),l(),s.end())};n.add(d);let f=()=>{u||(Wd(e,s,`xhr`,{requestBody:t,type:`xhr`,xhr:this},o),l(),c.complete(t=>{u||(u=!0,n.delete(d),t&&s.setAttributes(e.applyRedact(jd(t))),s.end())}))};this.addEventListener(`loadend`,f,{once:!0});try{return a.call(this,t)}catch(e){throw e instanceof Error&&s.recordException(e),f(),e}};XMLHttpRequest.prototype.open=o,XMLHttpRequest.prototype.send=s,t.push(()=>{XMLHttpRequest.prototype.open===o&&(XMLHttpRequest.prototype.open=i),XMLHttpRequest.prototype.send===s&&(XMLHttpRequest.prototype.send=a)})}}},shutdown(){var e;for(let e of[...n])e();for(;t.length;)(e=t.pop())==null||e()}}},Kd=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)},qd=(e,t)=>{let n=new Map,r=0,i=t=>{if(!(t-r<e)){r=t;for(let[r,i]of n)t-i.windowStart>e&&n.delete(r)}};return{allow(r){let a=Date.now();i(a);let o=n.get(r);return!o||a-o.windowStart>e?(n.set(r,{count:1,windowStart:a}),{allowed:!0,count:1}):(o.count+=1,{allowed:o.count<=t,count:o.count})}}};q();var Jd=6e4,Yd=5,Xd=/^https?:|^\/\//i,Zd=(e,t)=>{if(t)return Xd.test(t)?e(t):t},Qd=()=>{let e;return{name:`csp-violation`,init(t){if(typeof window>`u`||typeof document>`u`)return;let n=qd(Jd,Yd),r=e=>{let r=Kd(`${e.violatedDirective}|${e.blockedURI}|${e.sourceFile}|${e.lineNumber}`),i=n.allow(r);if(!i.allowed)return;let a=Zd(t.config.hooks.redactUrl,e.blockedURI),o=e.sourceFile?t.config.hooks.redactUrl(e.sourceFile):void 0,s=i.count===1;t.startSpan(`csp.violation`,K(K(K({},t.config.hooks.getPageAttributes()),Q({errorType:`csp`,eventLabel:`CSP 错误`,result:X.error,spanSubtype:`csp`,spanType:Z.error,targetLabel:a==null?e.effectiveDirective:a,targetValue:e.statusCode})),{},{"csp.blocked_uri":a,"csp.violated_directive":e.violatedDirective,"csp.effective_directive":e.effectiveDirective,"csp.disposition":e.disposition,"csp.source_file":o,"csp.line_number":e.lineNumber,"csp.column_number":e.columnNumber,"csp.status_code":e.statusCode,"csp.fingerprint":r,"csp.window_count":i.count,[Y.exceptionFingerprint]:r,"error.source":`csp`},s?{"csp.original_policy":e.originalPolicy}:{})).end()};document.addEventListener(`securitypolicyviolation`,r),e=()=>document.removeEventListener(`securitypolicyviolation`,r)},shutdown(){e==null||e(),e=void 0}}};q();var $d=`BK_RUM_DEVICE_ID`,ef=250,tf=()=>navigator.connection,nf=()=>navigator.userAgentData,rf=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}},af=(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`},of=e=>{let t=null;try{t=window.localStorage.getItem(e)}catch(e){}if(t)return t;let n=Bl(`device`);try{window.localStorage.setItem(e,n)}catch(e){}return n},sf=()=>{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}},cf=()=>{let e=tf();return e?{"network.effective_type":e.effectiveType,"network.connection_type":e.type,"network.downlink":e.downlink,"network.rtt":e.rtt,"network.save_data":e.saveData}:{}},lf=()=>{if(typeof navigator>`u`)return{};let e=nf(),t=navigator.userAgent,n=rf(t),r=af(t,e==null?void 0:e.platform),i=e!=null&&e.mobile||/mobi|android|iphone|ipad|ipod/i.test(t)?`mobile`:`desktop`;return{"device.memory":navigator.deviceMemory,"device.cpu_cores":navigator.hardwareConcurrency,"device.platform":e==null?void 0:e.platform,"device.mobile":e==null?void 0:e.mobile,[Y.browserName]:n.name,[Y.browserVersion]:n.version,[Y.deviceType]:i,[Y.osName]:r}},uf=(e,t)=>{let n;return()=>{n!==void 0&&window.clearTimeout(n),n=window.setTimeout(()=>{n=void 0,e()},t)}},df=(e={})=>{let t=[];return{name:`device`,init(n){var r;let i=(r=e.storageKey)==null?`${$d}_${Kd(n.config.application.name)}`:r,a=typeof window>`u`||e.persistentId!==!0?Bl(`device`):of(i);if(n.setRuntimeAttributes(K(K(K({"device.id":a},lf()),sf()),cf())),typeof window>`u`)return;let o=uf(()=>{n.setRuntimeAttributes(sf())},ef);window.addEventListener(`resize`,o),window.addEventListener(`orientationchange`,o),t.push(()=>window.removeEventListener(`resize`,o),()=>window.removeEventListener(`orientationchange`,o));let s=tf();if(s&&typeof s.addEventListener==`function`){let e=()=>{n.setRuntimeAttributes(cf())};s.addEventListener(`change`,e),t.push(()=>{var t;(t=s.removeEventListener)==null||t.call(s,`change`,e)})}},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};q();var ff=6e4,pf=5,mf=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,hf=e=>{if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch(t){return String(e)}},gf=e=>{var t;return e instanceof Error?(t=e.stack)==null?``:t:``},_f=e=>e.slice(0,80),vf=e=>{var t,n;return(t=(n=e.split(`
|
|
12
|
+
`).find(e=>e.trim().startsWith(`at `)))==null?void 0:n.trim())==null?``:t},yf=e=>e===`unhandledrejection`?`promise`:e===`resource`?`resource_load`:`js`,bf=({context:e,error:t,exceptionType:n,extra:r={},source:i,spanName:a,throttle:o})=>{let s=hf(t),c=gf(t),l=Kd(`${i}|${s}|${c.slice(0,256)}`),u=o.allow(l);if(!u.allowed)return;e.notifyActivity({time:Date.now(),type:`error`});let d=t instanceof Error?t:{message:s,name:n==null?i:n},f=K(K(K(K({},e.config.hooks.getPageAttributes()),e.config.hooks.getErrorAttributes()),Q({errorType:yf(i),eventLabel:`错误`,result:X.error,spanSubtype:yf(i),spanType:Z.error,targetLabel:t instanceof Error?t.name:n==null?i:n})),{},{"exception.message":s,[Y.exceptionMessageShort]:_f(s),"exception.stacktrace":c,[Y.exceptionStackTopFrame]:vf(c),"exception.type":t instanceof Error?t.name:n==null?i:n,[Y.exceptionFingerprint]:l,"error.handled":!1,"error.source":i,"error.window_count":u.count},r),p=e.startSpan(a,f);p.recordException(d),p.setStatus({code:We.ERROR,message:s}),p.end()},xf=(e={})=>{let t=[],n=mf(e.windowMs,ff),r=mf(e.maxPerWindow,pf);return{name:`error`,init(e){if(typeof window>`u`)return;let i=qd(n,r),a=t=>{var n;let r=!t.error&&!t.filename&&t.message===`Script error.`;bf({context:e,throttle:i,spanName:`browser.error`,source:`window.error`,error:(n=t.error)==null?t.message:n,extra:K({"code.filepath":t.filename,"code.lineno":t.lineno,"code.column":t.colno},r?{"error.cross_origin":!0}:{})})},o=t=>{bf({context:e,throttle:i,spanName:`browser.unhandledrejection`,source:`unhandledrejection`,error:t.reason,exceptionType:t.reason instanceof Error?t.reason.name:`UnhandledRejection`})},s=t=>{if(t instanceof ErrorEvent)return;let n=t.target;if(!(n instanceof Element))return;let r=n,a=r.src||r.href||n.currentSrc||``;bf({context:e,throttle:i,spanName:`browser.resource_error`,source:`resource`,error:Error(`Resource load failed: ${n.tagName.toLowerCase()} ${a}`),exceptionType:`ResourceError`,extra:{"url.full":e.config.hooks.redactUrl(a),"html.tag":n.tagName}})};window.addEventListener(`error`,a),window.addEventListener(`unhandledrejection`,o),window.addEventListener(`error`,s,!0),t.push(()=>window.removeEventListener(`error`,a),()=>window.removeEventListener(`unhandledrejection`,o),()=>window.removeEventListener(`error`,s,!0))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};q();var Sf=50,Cf=100,wf=700,Tf=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,Ef=e=>Number.isFinite(e)?e:void 0,Df=(e,t)=>{var n;let r=(n=e.attribution)==null?void 0:n[0];return r!=null&&r.containerSrc?t(r.containerSrc):(r==null?void 0:r.containerName)||(r==null?void 0:r.name)||e.name||`unknown`},Of=(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}),kf=(e={})=>{let t=Tf(e.threshold,Sf),n=Math.max(t,Tf(e.warningThreshold,Cf)),r,i,a=[];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=e.meter.createCounter(`browser.long_task.count`,{description:`Number of long tasks and long animation frames`}),u=e.meter.createHistogram(`browser.long_task.duration`,{description:`Duration of long tasks and long animation frames`,unit:`ms`}),d=e.meter.createHistogram(`browser.long_task.blocking_duration`,{description:`Blocking duration of long animation frames`,unit:`ms`}),f=r=>{var i,a,o;if(!Number.isFinite(r.duration)||r.duration<t)return;let s=r.entryType===`long-animation-frame`,c=s?r:void 0,f=(i=c==null?void 0:c.scripts)==null?[]:i,p=f.reduce((e,t)=>!e||t.duration>e.duration?t:e,void 0),m=Bl(`long-task`),h=performance.timeOrigin+r.startTime,g=h+r.duration,_=r.duration>=n?X.warning:X.success,v=s?`long-animation-frame`:`long-task`,y=p!=null&&p.sourceURL?e.config.hooks.redactUrl(p.sourceURL):void 0,b=s?void 0:Df(r,e.config.hooks.redactUrl),x=y||(p==null?void 0:p.sourceFunctionName)||b||`unknown`,S=e.startSpan(`browser.long_task`,K(K(K(K(K(K(K(K({},e.config.hooks.getPageAttributes()),Q({duration:r.duration,errorType:_===X.warning?`main_thread_blocked`:`none`,eventLabel:s?`长动画帧`:`长任务`,result:_,spanSubtype:v,spanType:Z.longtask,targetLabel:x,targetValue:(a=c==null?void 0:c.blockingDuration)==null?r.duration:a})),{},{[Y.longTaskBlockingDuration]:(o=c==null?void 0:c.blockingDuration)==null?r.duration:o,[Y.longTaskDuration]:r.duration,[Y.longTaskEntryType]:v,[Y.longTaskId]:m,[Y.longTaskIsFrozenFrame]:r.duration>=wf,[Y.longTaskScriptCount]:f.length},b?{[Y.longTaskCulprit]:b}:{}),p?{[Y.longTaskCulprit]:x,"long_task.culprit.duration":p.duration,"long_task.culprit.forced_style_and_layout_duration":p.forcedStyleAndLayoutDuration,"long_task.culprit.function_name":p.sourceFunctionName,"long_task.culprit.invoker_type":p.invokerType}:{}),Ef(c==null?void 0:c.firstUIEventTimestamp)===void 0?{}:{"long_task.first_ui_event_timestamp":c.firstUIEventTimestamp}),Ef(c==null?void 0:c.renderStart)===void 0?{}:{"long_task.render_start":c.renderStart}),Ef(c==null?void 0:c.styleAndLayoutStart)===void 0?{}:{"long_task.style_and_layout_start":c.styleAndLayoutStart}),c?{[Y.longTaskStartTime]:c.startTime}:{}),{startTime:h});f.forEach(t=>{S.addEvent(`long_task.script`,e.applyRedact(Of(t,e.config.hooks.redactUrl)),performance.timeOrigin+t.startTime)}),S.end(g),e.notifyActivity({endTime:g,startTime:h,type:`long_task`});let C=e.applyRedact(K(K(K({},e.config.hooks.getMetricAttributes()),Pu(e.getRuntimeAttributes())),{},{[Y.longTaskEntryType]:v}));l.add(1,C),u.record(r.duration,C),c&&d.record(c.blockingDuration,C)},p=e=>e.forEach(e=>f(e));try{let e=!0;r=new PerformanceObserver(t=>{let n=t.getEntries();e?(a.push(...n),i||(i=setTimeout(()=>{let e=a;a=[],i=void 0,p(e)}))):p(n)}),r.observe({type:c,buffered:!0}),e=!1}catch(e){r=void 0}},shutdown(){r==null||r.disconnect(),r=void 0,clearTimeout(i),i=void 0,a=[]}}},Af=new Set,jf=``,Mf,Nf,Pf=!1,Ff=()=>typeof location>`u`?``:location.href,If=(e,t)=>{let n=Ff();jf=n;let r={fromUrl:t,source:e,toUrl:n};for(let e of Array.from(Af))e(r)},Lf=()=>{If(`popstate`,jf||Ff())},Rf=()=>{If(`hashchange`,jf||Ff())},zf=()=>{Pf||typeof window>`u`||typeof history>`u`||(Pf=!0,jf=Ff(),Mf=history.pushState,Nf=history.replaceState,history.pushState=function(e,t,n){let r=jf||Ff(),i=Mf==null?void 0:Mf.apply(this,[e,t,n]);return If(`pushState`,r),i},history.replaceState=function(e,t,n){let r=jf||Ff(),i=Nf==null?void 0:Nf.apply(this,[e,t,n]);return If(`replaceState`,r),i},window.addEventListener(`popstate`,Lf),window.addEventListener(`hashchange`,Rf))},Bf=()=>{!Pf||typeof window>`u`||typeof history>`u`||(Mf&&(history.pushState=Mf),Nf&&(history.replaceState=Nf),window.removeEventListener(`popstate`,Lf),window.removeEventListener(`hashchange`,Rf),Mf=void 0,Nf=void 0,Pf=!1,jf=``)},Vf=e=>typeof window>`u`||typeof history>`u`?()=>{}:(zf(),Af.add(e),()=>{Af.delete(e),Af.size===0&&Bf()});q();var Hf=[`span`,`stopLoadingTime`],Uf=new Set([...Object.values(Y),$]),Wf=()=>typeof location>`u`?``:location.href,Gf=()=>{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(Y.viewFirstByte,e.responseStart),n(Y.viewDomInteractive,e.domInteractive),n(Y.viewDomContentLoaded,e.domContentLoadedEventEnd),n(Y.viewDomComplete,e.domComplete),n(Y.viewLoadEvent,e.loadEventEnd),t},Kf=e=>{let t=e.indexOf(`?`);return t<0?e:e.slice(0,t)},qf=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)}},Jf=(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||!qf(i.hash)&&Kf(r.hash)!==Kf(i.hash)}catch(n){return e!==t}},Yf=()=>{let e=[];return{name:`page-view`,init(t){if(typeof window>`u`)return;let n,r,i=t.config.view.loadingTime?t.meter.createHistogram(`browser.view.loading_time`,{description:`Time from view start until network and DOM activity become idle`,unit:`ms`}):void 0,a=(e=Date.now())=>t.setView({},e),o=(e,n,r=Date.now(),i)=>{e.documentVersion+=1,t.emitLog({attributes:K(K(K(K(K({},t.config.hooks.getPageAttributes()),e.attributes),e.snapshotAttributes),{},{"event.type":`view`,"view.document_version":e.documentVersion,"view.duration":Math.max(0,r-e.startedAt),"view.is_active":n!==`final`,"view.snapshot.type":n},i?{"view.end_reason":i}:{}),e.loadingTime===void 0?{}:{[Y.viewLoadingTime]:e.loadingTime,"view.loading_time.source":e.loadingTimeSource}),body:`browser.view`,eventName:`browser.view`,severityNumber:Ii.INFO,severityText:`INFO`,timestamp:r})},s=(e,r=!0,s=Date.now())=>{var c;if(!n){r&&a(s);return}let l=K({},n);(c=n.stopLoadingTime)==null||c.call(n),n.loadingTime!==void 0&&(i==null||i.record(n.loadingTime,t.applyRedact(K(K(K({},t.config.hooks.getMetricAttributes()),Pu(t.getRuntimeAttributes())),{},{"view.loading_type":n.loadingType})))),o(n,`final`,s,e),n.span.setAttribute(`view.end_reason`,e),n.span.end(s),n=void 0,r&&a(s);let{span:u,stopLoadingTime:d}=l;return ju(l,Hf)},c=(e,t,r)=>{if(n!==e||!Number.isFinite(t)||t<0)return;let i=K(K({},e.loadingType===`initial_load`?Gf():{}),{},{[Y.viewLoadingTime]:t,"view.loading_time.source":r});e.span.setAttributes(i),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=Du(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&&!Uf.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?Wf():c,p=t.config.hooks.getViewPathGroup(f),m=(d=e.name)==null?p:d,h=u(e.attributes);s(r,!1);let g=Bl(`view`),_=t.config.hooks.redactUrl(f),v=t.config.hooks.redactUrl(a),y=i===`initial_load`,b=y&&typeof performance<`u`?performance.timeOrigin:Date.now(),x=y?Gf():{};t.setView({attributes:h,id:g,loadingType:i,name:m,startedAt:b,url:_,urlPathGroup:p},b);let S=K(K(K(K(K({},h),t.config.hooks.getPageAttributes()),x),Q({errorType:`none`,eventLabel:y?`文档加载`:`路由切换`,spanSubtype:y?`navigate`:r,spanType:y?Z.document:Z.route,targetLabel:p,traceScene:y?`page_load`:`route_change`})),{},{[Y.viewId]:g,[Y.viewName]:m,[Y.viewUrl]:_,[Y.viewUrlPathGroup]:p,[Y.viewLoadingType]:i,"url.previous":v,"event.source":r},y?{"document.referrer":t.config.hooks.redactUrl(document.referrer||``)}:{});n={attributes:h,documentVersion:0,id:g,loadingType:i,name:m,rawUrl:f,snapshotAttributes:S,span:t.startSpan(`browser.view`,S,{startTime:b}),startedAt:b,url:_,urlPathGroup:p},o(n,`create`,b),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.span.setAttribute(Y.viewName,e.name),n.snapshotAttributes[Y.viewName]=e.name,t.setView({attributes:n.attributes,id:n.id,loadingType:n.loadingType,name:n.name,startedAt:n.startedAt,url:n.url,urlPathGroup:n.urlPathGroup}),o(n,`update`)}}),p=()=>{};t.config.view.tracking===`auto`&&(n||d({},`load`,`initial_load`),p=Vf(e=>{Jf(e.fromUrl,e.toUrl)&&d({},e.source,`route_change`,e.fromUrl)}));let m=e=>{e.persisted||s(`pagehide`)},h=e=>{e.persisted&&t.config.view.tracking===`auto`&&d({},`bfCache`,`bf_cache`,n==null?void 0:n.rawUrl)},g=t.onSessionLifecycle(e=>{if(e.type===`expired`){r=s(`session_expired`,!0,e.expiredAt);return}r&&(d({attributes:r.attributes,name:r.name,url:r.rawUrl},`sessionRenewal`,`session_renewal`,r.rawUrl),r=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()}}}};q();var Xf=5e3,Zf=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,Qf=(e,t,n,r)=>({expiresAt:Math.min(t+n,t+r),id:e,startedAt:t,status:`active`}),$f=(e,t,n)=>{if(t>=e.startedAt+n)return`maxLifetime`;if(t>=e.expiresAt)return`inactivity`},ep=(e,t,n,r)=>K(K({},e),{},{expiresAt:Math.min(t+n,e.startedAt+r)}),tp=(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&&Zf(r.startedAt)&&r.startedAt<=t+Xf&&Zf(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`)&&Zf(r.expiredAt)&&r.expiredAt<=t+Xf)return r}catch(e){}return null};q();var np=900*1e3,rp=14400*1e3,ip=1e3,ap=6e4,op=[`click`,`keydown`,`scroll`,`touchstart`],sp=new Map,cp=e=>{let t=typeof window<`u`,n=()=>{var n;if(t)try{return window.localStorage.getItem(e)}catch(e){t=!1}return(n=sp.get(e))==null?null:n};return n(),{isLocalStorage:()=>t,read:n,write:n=>{let r=JSON.stringify(n);if(sp.set(e,r),t)try{window.localStorage.setItem(e,r)}catch(e){t=!1}}}},lp=(e,t)=>{let n=``;try{n=new URL(e).host}catch(t){n=e}return`bk_ot_session__${Kd(`${t}\0${n||`default`}`)}`},up=(e,t)=>{t.reason&&e.emitLog({severityNumber:Ii.INFO,severityText:`INFO`,body:t.reason===`init`?`session.start`:`session.rotate`,attributes:K(K({},e.config.hooks.getPageAttributes()),{},{[Y.sessionHasReplay]:!1,[Y.sessionId]:t.record.id,[Y.sessionStartTime]:t.record.startedAt,"session.rotate.reason":t.reason},t.previousId?{"session.previous_id":t.previousId}:{})})},dp=(e={})=>{let t=[];return{name:`session`,init(n){var r;if(typeof window>`u`||typeof document>`u`){n.setRuntimeAttributes({[Y.sessionHasReplay]:!1,[Y.sessionId]:Bl(`session`)});return}let i=(r=e.storageKey)==null?lp(n.config.transport.endpoint,n.config.application.name):r,a=cp(i),o=typeof performance<`u`&&Number.isFinite(performance.timeOrigin)?performance.timeOrigin:Date.now(),s,c,l=(e=Date.now())=>tp(a.read(),e,rp),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`}),u(),s=void 0,n.setRuntimeAttributes({[Y.sessionHasReplay]:void 0,[Y.sessionId]: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=$f(t,e,rp);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+rp);c=setTimeout(f,Math.max(0,t-Date.now()))},m=(e,t)=>{let r=e.id!==s;s=e.id,n.setRuntimeAttributes({[Y.sessionHasReplay]:!1,[Y.sessionId]:e.id},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`&&!$f(r,t,rp)){let e=ep(r,t,np,rp);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?$f(r,t,rp):e?`init`:void 0,c=Qf(Bl(`session`),t,np,rp);a.write(c),m(c,{previousId:i,reason:o==null?`init`:o}),up(n,{previousId:i,reason:o==null?`init`:o,record:c})},g=()=>{if(!s)return;let e=Date.now(),t=l(e);if((t==null?void 0:t.status)!==`active`||t.id!==s||$f(t,e,rp)){f();return}let n=ep(t,e,np,rp);a.write(n),m(n)};h(!0);let _=0,v=()=>{let e=Date.now();e-_<ip||(_=e,h())},y={capture:!0,passive:!0};op.forEach(e=>window.addEventListener(e,v,y)),t.push(()=>{op.forEach(e=>window.removeEventListener(e,v,y))});let b=()=>{document.visibilityState===`visible`&&g()};document.addEventListener(`visibilitychange`,b);let x=window.setInterval(b,ap);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=tp(e.newValue,t,rp);if((n==null?void 0:n.status)===`active`&&n.id===s&&!$f(n,t,rp)){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()}}},fp=n({CLSThresholds:()=>Lp,FCPThresholds:()=>Fp,INPThresholds:()=>Zp,LCPThresholds:()=>em,TTFBThresholds:()=>nm,onCLS:()=>zp,onFCP:()=>Bp,onINP:()=>Qp,onLCP:()=>tm,onTTFB:()=>im});function pp(e,t){return yp.get(e)||yp.set(e,new t),yp.get(e)}var mp,hp,gp,_p,vp,yp,bp,xp,Sp,Cp,wp,Tp,Ep,Dp,Op,kp,Ap,jp,Mp,Np,Pp,Fp,Ip,Lp,Rp,zp,Bp,Vp,Hp,Up,Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp,$p,em,tm,nm,rm,im,am=t((()=>{L(),q(),mp=class{constructor(){I(this,`t`,void 0),I(this,`o`,0),I(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)}},hp=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},gp=e=>{if(document.readyState===`loading`)return`loading`;let t=hp();if(t){if(e<t.domInteractive)return`loading`;if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return`dom-interactive`;if(t.domComplete===0||e<t.domComplete)return`dom-content-loaded`}return`complete`},_p=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},vp=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#`+n.id:[_p(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},yp=new WeakMap,bp=-1,xp=()=>bp,Sp=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(bp=t.timeStamp,e(t))},!0)},Cp=(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)))}},wp=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Tp=()=>{var e,t;return(e=(t=hp())==null?void 0:t.activationStart)==null?0:e},Ep=(e,t=-1)=>{let n=hp(),r=`navigate`;return xp()>=0?r=`back-forward-cache`:n&&(document.prerendering||Tp()>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}},Dp=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return r.observe(K({type:e,buffered:!0},n)),r}}catch(e){}},Op=e=>{let t=!1;return()=>{t||(e(),t=!0)}},kp=-1,Ap=new Set,jp=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,Mp=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of Ap)e();isFinite(kp)||(kp=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,Mp,!0))}},Np=()=>{if(kp<0){var e;let t=Tp(),n=document.prerendering||(e=globalThis.performance.getEntriesByType(`visibility-state`).find(e=>e.name===`hidden`&&e.startTime>=t))==null?void 0:e.startTime;kp=n==null?jp():n,addEventListener(`visibilitychange`,Mp,!0),addEventListener(`prerenderingchange`,Mp,!0),Sp(()=>{setTimeout(()=>{kp=jp()})})}return{get firstHiddenTime(){return kp},onHidden(e){Ap.add(e)}}},Pp=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},Fp=[1800,3e3],Ip=(e,t={})=>{Pp(()=>{let n=Np(),r,i=Ep(`FCP`),a=Dp(`paint`,e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Tp(),0),i.entries.push(t),r(!0)))});a&&(r=Cp(e,i,Fp,t.reportAllChanges),Sp(n=>{i=Ep(`FCP`),r=Cp(e,i,Fp,t.reportAllChanges),wp(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},Lp=[.1,.25],Rp=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],zp=(e,t={})=>{let n=pp(t=Object.assign({},t),mp),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=Rp(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?vp(o):i;r.set(n,e)}}},((e,t={})=>{let n=Np();Ip(Op(()=>{let r,i=Ep(`CLS`,0),a=pp(t,mp),o=e=>{for(let t of e)a.u(t);a.o>i.value&&(i.value=a.o,i.entries=a.i,r())},s=Dp(`layout-shift`,o);s&&(r=Cp(e,i,Lp,t.reportAllChanges),n.onHidden(()=>{o(s.takeRecords()),r(!0)}),Sp(()=>{a.o=0,i=Ep(`CLS`,0),r=Cp(e,i,Lp,t.reportAllChanges),wp(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=Rp(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:gp(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},Bp=(e,t={})=>{Ip(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:gp(xp())};if(e.entries.length){let n=hp(),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:gp(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})})(t))},t)},Vp=0,Hp=1/0,Up=0,Wp=e=>{for(let t of e)t.interactionId&&(Hp=Math.min(Hp,t.interactionId),Up=Math.max(Up,t.interactionId),Vp=Up?(Up-Hp)/7+1:0)},Kp=()=>{var e;return Gp?Vp:(e=performance.interactionCount)==null?0:e},qp=()=>{`interactionCount`in performance||Gp||(Gp=Dp(`event`,Wp,{durationThreshold:0}))},Jp=0,Yp=class{constructor(){I(this,`l`,[]),I(this,`h`,new Map),I(this,`m`,void 0),I(this,`p`,void 0)}v(){Jp=Kp(),this.l.length=0,this.h.clear()}M(){let e=Math.min(this.l.length-1,Math.floor((Kp()-Jp)/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)}}},Xp=e=>{let t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let r=Op(e),i=-1,a=()=>{n(i),r()};addEventListener(`visibilitychange`,a,{once:!0,capture:!0}),i=t(()=>{removeEventListener(`visibilitychange`,a,{capture:!0}),r()})}},Zp=[200,500],Qp=(e,t={})=>{let n=pp(t=Object.assign({},t),Yp),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(Xp(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?vp(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:gp(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})};Dp(`long-animation-frame`,e=>{r=r.concat(e),l()}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=Np();Pp(()=>{var r;qp();let i,a=Ep(`INP`),o=pp(t,Yp),s=e=>{Xp(()=>{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=Dp(`event`,s,{durationThreshold:(r=t.durationThreshold)==null?40:r});i=Cp(e,a,Zp,t.reportAllChanges),c&&(c.observe({type:`first-input`,buffered:!0}),n.onHidden(()=>{s(c.takeRecords()),i(!0)}),Sp(()=>{o.v(),a=Ep(`INP`),i=Cp(e,a,Zp,t.reportAllChanges)}))})})(t=>{e(f(t))},t)},$p=class{constructor(){I(this,`m`,void 0)}u(e){var t;(t=this.m)==null||t.call(this,e)}},em=[2500,4e3],tm=(e,t={})=>{let n=pp(t=Object.assign({},t),$p),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?vp(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{Pp(()=>{let n=Np(),r,i=Ep(`LCP`),a=pp(t,$p),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-Tp(),0),i.entries=[t],r())},s=Dp(`largest-contentful-paint`,o);if(s){r=Cp(e,i,em,t.reportAllChanges);let n=Op(()=>{o(s.takeRecords()),s.disconnect(),r(!0)}),a=e=>{e.isTrusted&&(Xp(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});Sp(n=>{i=Ep(`LCP`),r=Cp(e,i,em,t.reportAllChanges),wp(()=>{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=hp();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=K(K({},t),{},{timeToFirstByte:r,resourceLoadDelay:o-r,resourceLoadDuration:s-o,elementRenderDelay:e.value-s,navigationEntry:a})}}return Object.assign(e,{attribution:t})})(t))},t)},nm=[800,1800],rm=e=>{document.prerendering?Pp(()=>rm(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>rm(e),!0)},im=(e,t={})=>{((e,t={})=>{let n=Ep(`TTFB`),r=Cp(e,n,nm,t.reportAllChanges);rm(()=>{let i=hp();i&&(n.value=Math.max(i.responseStart-Tp(),0),n.entries=[i],r(!0),Sp(()=>{n=Ep(`TTFB`,0),r=Cp(e,n,nm,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)}}));q();var om=`unknown`,sm=10,cm=6e4,lm=5e3,um=1e3,dm=e=>e?e.replace(/_/g,`-`):om,fm=()=>{if(typeof performance>`u`)return om;let e=performance.getEntriesByType(`navigation`)[0];return dm(e==null?void 0:e.type)},pm=(e,t)=>{let[n,r]=e===`CLS`?[.1,.25]:[200,500];return t<=n?`good`:t<=r?`needs-improvement`:`poor`},mm=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},hm=()=>{if(typeof performance>`u`)return;let e=performance.interactionCount;return typeof e==`number`&&Number.isFinite(e)?e:void 0},gm=(e,t)=>{var n,r;let i=(n=t.value)==null?0:n;if(!(t.hadRecentInput||!Number.isFinite(i))){if(e.clsWindowStart===void 0||t.startTime-((r=e.clsWindowEnd)==null?t.startTime:r)>=um||t.startTime-e.clsWindowStart>=lm){var a;e.clsWindowStart=t.startTime,e.clsWindowValue=i,e.clsWindowLargestShiftValue=i,e.clsWindowLargestShiftTarget=mm((a=t.sources)==null||(a=a[0])==null?void 0:a.node)}else if(e.clsWindowValue+=i,i>e.clsWindowLargestShiftValue){var o;e.clsWindowLargestShiftValue=i,e.clsWindowLargestShiftTarget=mm((o=t.sources)==null||(o=o[0])==null?void 0:o.node)}e.clsWindowEnd=t.startTime,e.clsWindowValue>e.cls&&(e.cls=Math.round(e.clsWindowValue*1e4)/1e4,e.largestShiftValue=e.clsWindowLargestShiftValue,e.largestShiftTarget=e.clsWindowLargestShiftTarget)}},_m=(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,cm),inputDelay:Math.max(0,i-t.startTime),interactionId:t.interactionId,interactionTarget:mm(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(sm)},vm=e=>{let t=hm(),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))]},ym=(e,t)=>{var n;return{"rum.navigation.type":(n=e.navigationType)==null?t:n,[Y.vitalMetric]:e.name.toLowerCase(),[Y.vitalRating]:e.rating}},bm=(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`)),o(`vital.lcp.time_to_first_byte`,a(`timeToFirstByte`));break;case`CLS`:o(`vital.cls.largest_shift_target`,a(`largestShiftTarget`)),o(`vital.cls.largest_shift_value`,a(`largestShiftValue`)),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`FCP`:o(`vital.fcp.time_to_first_byte`,a(`timeToFirstByte`)),o(`vital.fcp.load_state`,a(`loadState`));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},xm=()=>{let e,t=!1;return{name:`web-vitals`,init(n){return W(function*(){if(typeof window>`u`)return;let r;try{r=yield Promise.resolve().then(()=>(am(),fp))}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=fm(),l=n.meter.createHistogram(`browser.web_vital.cls`,{unit:`1`,description:`Cumulative Layout Shift`}),u=n.meter.createHistogram(`browser.web_vital.duration`,{unit:`ms`,description:`Web Vitals duration metrics, including FCP, INP, LCP and TTFB`}),d=(e,t,r)=>{let i=e.name.toLowerCase();n.startSpan(`browser.web_vital`,K(K(K(K(K({},n.config.hooks.getPageAttributes()),t),ym(e,c)),Q({duration:e.name===`CLS`?void 0:e.value,errorType:e.rating===`good`?`none`:`slow`,eventLabel:`Web 指标`,result:nu(e.rating),spanSubtype:i,spanType:Z.vital,targetLabel:i,targetValue:e.value})),{},{[Y.vitalMetric]:i,[Y.vitalValue]:e.value,[Y.vitalRating]:e.rating,"vital.id":e.id},bm(e,n.config.hooks.redactUrl)),r===void 0?void 0:{contextTime:r}).end()},f=e=>{if(t||!Number.isFinite(e.value))return;let r=e.entries[0],i=r&&typeof performance<`u`?performance.timeOrigin+r.startTime:void 0,a=i===void 0?n.getRuntimeAttributes():n.getRuntimeAttributesAt(i);u.record(e.value,n.applyRedact(K(K(K({},n.config.hooks.getMetricAttributes()),Pu(a)),ym(e,c)))),d(e,a,i)},p,m,h,g=(e,t,r)=>{let i=n.applyRedact(K(K(K({},n.config.hooks.getMetricAttributes()),Pu(t)),ym(e,c)));e.name===`CLS`?l.record(e.value,i):u.record(e.value,i),d(e,t,r)},_=()=>{let e=p;if(!e)return;g({attribution:{largestShiftTarget:e.largestShiftTarget,largestShiftValue:e.largestShiftValue},entries:[],id:Bl(`vital`),name:`CLS`,navigationType:c,rating:pm(`CLS`,e.cls),value:e.cls},e.runtimeAttributes,e.startedAt);let t=vm(e);t&&g({attribution:{inputDelay:t.inputDelay,interactionTarget:t.interactionTarget,interactionType:t.interactionType,presentationDelay:t.presentationDelay,processingDuration:t.processingDuration},entries:[],id:Bl(`vital`),name:`INP`,navigationType:c,rating:pm(`INP`,t.duration),value:t.duration},e.runtimeAttributes,e.startedAt)},v=n.onViewChange(e=>{var t;_(),p=e.id?{cls:0,clsWindowLargestShiftValue:0,clsWindowValue:0,interactionCountAtStart:hm(),interactionIdMax:0,interactionIdMin:1/0,inpCandidates:[],largestShiftValue:0,runtimeAttributes:n.getRuntimeAttributes(),startedAt:(t=e.startedAt)==null?Date.now():t}:void 0});if(typeof PerformanceObserver<`u`){var y,b;(y=PerformanceObserver.supportedEntryTypes)!=null&&y.includes(`layout-shift`)&&(h=new PerformanceObserver(e=>{if(p)for(let t of e.getEntries())performance.timeOrigin+t.startTime<p.startedAt||gm(p,t)}),h.observe({buffered:!0,type:`layout-shift`})),(b=PerformanceObserver.supportedEntryTypes)!=null&&b.includes(`event`)&&(m=new PerformanceObserver(e=>{if(p)for(let t of e.getEntries())performance.timeOrigin+t.startTime<p.startedAt||!t.interactionId||!Number.isFinite(t.duration)||_m(p,t)}),m.observe({buffered:!0,durationThreshold:40,type:`event`}))}a(f),o(f),s(f),e=()=>{_(),p=void 0,v(),h==null||h.disconnect(),m==null||m.disconnect()}})()},shutdown(){t=!0,e==null||e(),e=void 0}}};q();var Sm=64*1024,Cm=6e4,wm=5,Tm=e=>e==null?0:typeof e==`string`?e.length>Sm||typeof TextEncoder>`u`?e.length:new TextEncoder().encode(e).byteLength:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:typeof Blob<`u`&&e instanceof Blob?e.size:0,Em=(e,t)=>{let n={"network.protocol.name":`websocket`,"url.full":t(e)},r={"network.protocol.name":`websocket`};try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);n[`server.address`]=t.host,n[`url.scheme`]=t.protocol.replace(`:`,``),r[`server.address`]=t.host,r[`url.scheme`]=n[`url.scheme`]}catch(e){}return{metricAttributes:r,spanAttributes:n}},Dm=(e,t)=>{var n;let{bytesCounter:r,connectDurationHistogram:i,context:a,errorCounter:o,errorThrottle:s,isDisposed:c,messageCounter:l,url:u}=t,{metricAttributes:d,spanAttributes:f}=Em(u,a.config.hooks.redactUrl),p=a.applyRedact(K(K(K({},a.config.hooks.getMetricAttributes()),Pu(a.getRuntimeAttributes())),d)),m=(n=f[`server.address`])==null?f[`url.full`]:n,h=a.startSpan(`websocket.connect`,K(K(K({},f),Q({errorType:`none`,eventLabel:`WebSocket`,spanSubtype:`websocket`,spanType:Z.custom,targetLabel:m})),f[`server.address`]?{[Y.targetDomain]:f[`server.address`]}:{})),g=performance.now(),_=!1,v=e=>{if(_)return;_=!0;let t=performance.now()-g;e===`error`&&h.setStatus({code:We.ERROR,message:`websocket connect failed`}),h.setAttributes(Q({duration:t,errorType:e===`error`?`network`:`none`,eventLabel:`WebSocket`,result:e===`error`?X.error:X.success,spanSubtype:`websocket`,spanType:Z.custom,targetLabel:m,targetValue:t})),h.end(),e===`opened`&&!c()&&i.record(t,p)};e.addEventListener(`open`,()=>{c()||v(`opened`)}),e.addEventListener(`message`,e=>{if(c())return;let t=K(K({},p),{},{"websocket.direction":`in`});l.add(1,t),r.add(Tm(e.data),t)}),e.addEventListener(`error`,()=>{if(c())return;let e=_?`runtime`:`connect`;o.add(1,K(K({},p),{},{"websocket.error.phase":e})),v(`error`);let t=s.allow(`ws:error:${u}`);t.allowed&&a.emitLog({severityNumber:Ii.ERROR,severityText:`ERROR`,body:`websocket.error`,attributes:K(K(K({},f),Q({errorType:`network`,eventLabel:`WebSocket 错误`,result:X.error,spanSubtype:`websocket`,spanType:Z.custom,targetLabel:m})),{},{"websocket.error.phase":e,"websocket.error.window_count":t.count})})}),e.addEventListener(`close`,e=>{c()||(_||v(`error`),a.emitLog({severityNumber:Ii.INFO,severityText:`INFO`,body:`websocket.close`,attributes:K(K(K({},f),Q({errorType:e.wasClean?`none`:`network`,eventLabel:`WebSocket 关闭`,result:e.wasClean?X.success:X.warning,spanSubtype:`websocket`,spanType:Z.custom,targetLabel:m,targetValue:e.code})),{},{"websocket.close.code":e.code,"websocket.close.reason":e.reason,"websocket.close.was_clean":e.wasClean})}))});let y=e.send.bind(e);e.send=e=>{if(!c()){let t=K(K({},p),{},{"websocket.direction":`out`});l.add(1,t),r.add(Tm(e),t)}return y(e)}},Om=()=>{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;let a=r.meter.createCounter(`browser.websocket.message.count`,{description:`Total number of WebSocket messages observed`}),o=r.meter.createCounter(`browser.websocket.message.bytes`,{unit:`By`,description:`Total bytes transferred over WebSocket (best-effort)`}),s=r.meter.createCounter(`browser.websocket.error.count`,{description:`Total number of WebSocket error events`}),c=r.meter.createHistogram(`browser.websocket.connect.duration`,{unit:`ms`,description:`WebSocket connection establishment duration (only successful connects)`}),l=qd(Cm,wm),u=()=>n;t=new Proxy(i,{construct(e,t,i){let d=Reflect.construct(e,t,i);if(n)return d;let f=t[0]==null?``:String(t[0]);return!f||Kl(r.config,f)||Dm(d,{bytesCounter:o,connectDurationHistogram:c,context:r,errorCounter:s,errorThrottle:l,isDisposed:u,messageCounter:a,url:f}),d}}),window.WebSocket=t},shutdown(){n=!0,typeof window<`u`&&e&&window.WebSocket===t&&(window.WebSocket=e),t=void 0,e=void 0}}};L();var km=class{constructor(){I(this,`listeners`,new Set),I(this,`notify`,e=>{this.listeners.forEach(t=>t(e))}),I(this,`subscribe`,e=>(this.listeners.add(e),()=>this.listeners.delete(e)))}};q();var Am=60*1e3,jm=e=>e.trim().replace(/\/+$/,``),Mm={traces:`rum`,metrics:`metrics`,logs:`logs`},Nm=(e,t)=>`${jm(e==null?``:e)}/v1/${Mm[t]}`,Pm=(e,t)=>{var n,r,i;let a=(n=e.signals)==null?void 0:n[t];if(a===!1)return!1;let o=a==null?void 0:a.endpoint,s=e.token||e.headers||a!=null&&a.headers?K(K(K({},e.token?{Authorization:`Bearer ${e.token}`}:{}),(r=e.headers)==null?{}:r),(i=a==null?void 0:a.headers)==null?{}:i):void 0;return{concurrencyLimit:a==null?void 0:a.concurrencyLimit,endpoint:o?jm(o):Nm(e.endpoint,t),headers:s,timeoutMillis:a==null?void 0:a.timeoutMillis}},Fm=e=>typeof e!=`number`||!Number.isFinite(e)?1:Math.max(0,Math.min(1,e)),Im=e=>e,Lm=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(/[?#].*$/,``)}},Rm=e=>{try{return new URL(e,typeof location>`u`?`http://localhost`:location.href).pathname||`/`}catch(t){return e||`/`}},zm=e=>{var t;return{environment:(t=e.environment)==null?`production`:t,name:e.name,version:e.version}},Bm=e=>K(K({[Y.deploymentEnvironmentName]:e.environment,"rum.provider":`blueking`,"rum.schema.version":`1`,[Y.serviceName]:e.name},e.version?{[Y.serviceVersion]:e.version}:{}),{},{"telemetry.sdk.language":`webjs`,"telemetry.sdk.name":`@blueking/open-telemetry`}),Vm=e=>{var t,n;let r=Pm(e,`traces`),i=Pm(e,`metrics`),a=Pm(e,`logs`);return{endpoint:jm((t=e.endpoint)==null?``:t)||((n=[r,i,a].find(e=>e!==!1))==null?void 0:n.endpoint)||``,traces:r,metrics:i,logs:a}},Hm=e=>{if(!e)throw Error(`[bk-ot] transport is required.`);let t=[`traces`,`metrics`,`logs`].filter(t=>{var n;return((n=e.signals)==null?void 0:n[t])!==!1});if(!t.length)throw Error(`[bk-ot] at least one transport signal must be enabled.`);for(let i of t){var n,r;let t=(n=e.signals)==null?void 0:n[i],a=t?t.endpoint:void 0;if(!(a!=null&&a.trim())&&!((r=e.endpoint)!=null&&r.trim()))throw Error(`[bk-ot] transport.signals.${i}.endpoint or transport.endpoint is required.`)}},Um=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?(()=>({"rum.page.host":typeof window>`u`?``:window.location.host,"rum.page.path":typeof window>`u`?``:window.location.pathname})):n,getMetricAttributes:(i=(a=e.context)==null||(a=a.attributes)==null?void 0:a.metric)==null?(()=>({})):i,getErrorAttributes:(o=(s=e.context)==null||(s=s.attributes)==null?void 0:s.error)==null?(()=>({})):o,getCustomAttributes:(c=(l=e.context)==null||(l=l.attributes)==null?void 0:l.custom)==null?(()=>({})):c,getViewPathGroup:t=>{var n,r,i,a;return(n=typeof((r=e.tracking)==null?void 0:r.view)==`object`?(i=(a=e.tracking.view).getPathGroup)==null?void 0:i.call(a,t):void 0)==null?Rm(t):n},redactAttributes:(u=(d=e.privacy)==null?void 0:d.redactAttributes)==null?Im:u,redactUrl:(f=(p=e.privacy)==null?void 0:p.redactUrl)==null?Lm:f}},Wm=e=>{var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v;if(!(!((t=e.application)==null||(t=t.name)==null)&&t.trim()))throw Error(`[bk-ot] application.name is required.`);Hm(e.transport);let y=zm(e.application),b=typeof((n=e.tracking)==null?void 0:n.view)==`object`?e.tracking.view:void 0,x=(r=e.transport.signals)==null?void 0:r.traces,S=(i=e.transport.signals)==null?void 0:i.metrics;return{application:y,autoStart:(a=e.autoStart)==null?!0:a,debug:(o=e.debug)==null?!1:o,enabled:(s=e.enabled)==null?!0:s,extensions:{instrumentations:[...(c=(l=e.extensions)==null?void 0:l.instrumentations)==null?[]:c],plugins:[...(u=(d=e.extensions)==null?void 0:d.plugins)==null?[]:u]},hooks:Um(e),metricIntervalMillis:S?(f=S.intervalMillis)==null?Am:f:Am,resourceAttributes:Bm(y),session:K(K({},e.session),{},{sampleRate:Fm((p=e.session)==null?void 0:p.sampleRate)}),spanBatch:x?x.batch:void 0,spanProcessor:x?(m=x.processor)==null?`batch`:m:`batch`,tracking:(h=e.tracking)==null?{}:h,trackingConsent:(g=(_=e.privacy)==null?void 0:_.trackingConsent)==null?`granted`:g,transport:Vm(e.transport),user:(v=e.context)==null?void 0:v.user,view:{excludedActivityUrls:b==null?void 0:b.excludedActivityUrls,loadingTime:(b==null?void 0:b.loadingTime)!==!1,tracking:(b==null?void 0:b.tracking)===`manual`?`manual`:`auto`}}};L();var Gm=(e,t)=>typeof e.enabled==`function`?e.enabled(t):e.enabled!==!1,Km=class{constructor(e){I(this,`plugins`,void 0),I(this,`startedPlugins`,[]),this.plugins=e}flush(){var e=this;return W(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 W(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 W(function*(){for(let r of t.plugins)if(Gm(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)}}})()}};L(),q();var qm=new Set([...Object.values(Y),$]),Jm=class{constructor(e={},t){I(this,`actionHistory`,[]),I(this,`attributes`,{}),I(this,`queuedViewCommands`,[]),I(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)}),I(this,`sessionHistory`,[]),I(this,`sessionLifecycleListeners`,new Set),I(this,`setOptionalAttribute`,(e,t)=>{if(t===void 0){delete this.attributes[e];return}this.attributes[e]=t}),I(this,`user`,{}),I(this,`view`,{}),I(this,`viewAttributeKeys`,new Set),I(this,`viewChangeListeners`,new Set),I(this,`viewCommandListeners`,new Set),I(this,`viewHistory`,[]),I(this,`viewScopedAttributeKeys`,new Set),I(this,`dispatchViewCommand`,e=>{if(this.viewCommandListeners.size===0){this.queuedViewCommands.push(e);return}this.viewCommandListeners.forEach(t=>t(e))}),I(this,`getAttributes`,()=>K({},this.attributes)),I(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,[Y.sessionId,Y.sessionHasReplay,$]),n(this.viewHistory,this.viewScopedAttributeKeys),n(this.actionHistory,[Y.actionId]),t}),I(this,`getUser`,()=>K({},this.user)),I(this,`getView`,()=>K({},this.view)),I(this,`isSessionActive`,()=>typeof this.attributes[Y.sessionId]==`string`),I(this,`isViewActive`,()=>typeof this.attributes[Y.viewId]==`string`),I(this,`notifySessionLifecycle`,e=>{this.sessionLifecycleListeners.forEach(t=>t(e))}),I(this,`onSessionLifecycle`,e=>(this.sessionLifecycleListeners.add(e),()=>this.sessionLifecycleListeners.delete(e))),I(this,`onViewChange`,e=>(this.viewChangeListeners.add(e),this.view.id&&e(this.getView()),()=>this.viewChangeListeners.delete(e))),I(this,`onViewCommand`,e=>{for(this.viewCommandListeners.add(e);this.queuedViewCommands.length;)e(this.queuedViewCommands.shift());return()=>this.viewCommandListeners.delete(e)}),I(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(Y.sessionId in e&&this.recordAssociation(this.sessionHistory,[Y.sessionId,Y.sessionHasReplay,$],t,typeof this.attributes[Y.sessionId]==`string`),Y.actionId in e){let e=this.attributes[Y.actionId];this.recordAssociation(this.actionHistory,[Y.actionId],t,Array.isArray(e)?e.length>0:typeof e==`string`)}}),I(this,`setUser`,e=>{if(this.user=K(K({},this.user),e),`id`in e){if(e.id===void 0){delete this.attributes[Y.userId];return}this.attributes[Y.userId]=e.id}}),I(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||qm.has(t)||(r[t]=i,this.attributes[t]=i,this.viewAttributeKeys.add(t),this.viewScopedAttributeKeys.add(t));this.view=K(K({},e),{},{attributes:r}),this.setOptionalAttribute(Y.viewId,e.id),this.setOptionalAttribute(Y.viewUrl,e.url),this.setOptionalAttribute(Y.viewUrlPathGroup,e.urlPathGroup),this.setOptionalAttribute(Y.viewLoadingType,e.loadingType),this.setOptionalAttribute(Y.viewName,e.name),[Y.viewId,Y.viewUrl,Y.viewUrlPathGroup,Y.viewLoadingType,Y.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)}};L(),q();var Ym=e=>({url:e.endpoint,headers:e.headers,concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis}),Xm=`bk-rum`,Zm=class{constructor(e){this.isSampled=e}shouldSample(){return{decision:this.isSampled()?J.RECORD_AND_SAMPLED:J.NOT_RECORD}}toString(){return`RumSessionSampler`}},Qm,$m=()=>{if(Qm)Qm.users+=1;else{let e=new ft().enable(),t=N.setGlobalContextManager(e);t||e.disable(),Qm={contextManager:t?e:void 0,ownsContext:t,ownsPropagator:nt.setGlobalPropagator(new Wr),users:1}}let e=!1;return()=>{e||!Qm||(e=!0,--Qm.users,!(Qm.users>0)&&(Qm.ownsContext&&N.disable(),Qm.ownsPropagator&&nt.disable(),Qm=void 0))}},eh=(e,t,n)=>n?new Proxy(e,{get(e,n,r){if(n===`export`)return(n,r)=>{var i;return(i=globalThis.console)==null||i.log(`[bk-ot][${t}]`,n),e.export(n,r)};let i=Reflect.get(e,n,r);return typeof i==`function`?i.bind(e):i}}):e,th=e=>[Gd(e.tracking.request)],nh=e=>[dp(e.session),...ah(e.tracking.device,!0,df),Tu(),Yf(),Md(rh(e.tracking.resource,!0))],rh=(e,t)=>e===void 0?t:e!==!1,ih=e=>typeof e==`object`&&e?e:void 0,ah=(e,t,n)=>rh(e,t)?[n(ih(e))]:[],oh=e=>[...ah(e.error,!0,xf),...ah(e.webVitals,!0,xm),...ah(e.blankScreen,!0,Ju),...ah(e.action,!0,Cu),...ah(e.websocket,!1,Om),...ah(e.longTask,!1,kf),...ah(e.cspViolation,!1,Qd)],sh=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,emitLog:this.emitLog,flush:this.flush,getRuntimeAttributes:this.getRuntimeAttributes,getRuntimeAttributesAt:this.getRuntimeAttributesAt,isSampled:this.isSampled,isSessionActive:this.isSessionActive,isViewActive:this.isViewActive,logger:this.logger,meter:this.meter,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 Km([...nh(this.config),...th(this.config),...oh(this.config.tracking),...(e=this.config.extensions.plugins)==null?[]:e])}constructor(e){var t=this;I(this,`activityObserver`,new km),I(this,`flushProviders`,W(function*(){yield t.tracerProvider.forceFlush(),yield t.meterProvider.forceFlush(),yield t.loggerProvider.forceFlush()})),I(this,`loggerProvider`,void 0),I(this,`meterProvider`,void 0),I(this,`phase`,`idle`),I(this,`pluginManager`,void 0),I(this,`registeredInstrumentations`,void 0),I(this,`releaseOtelGlobals`,void 0),I(this,`runtimeContext`,void 0),I(this,`sampled`,!1),I(this,`startCollection`,W(function*(){if(t.pluginManager||!t.config.enabled||t.config.trackingConsent!==`granted`)return;t.config.transport.traces!==!1&&(t.releaseOtelGlobals=$m());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}})),I(this,`stopCollection`,function(){var e=W(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({[Y.sessionHasReplay]:void 0,[Y.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)}}()),I(this,`teardownCallbacks`,[]),I(this,`tracerProvider`,void 0),I(this,`applyRedact`,e=>this.config.hooks.redactAttributes(e)),I(this,`config`,void 0),I(this,`emitLog`,e=>{var t;let n=e.timestamp?br(_r(e.timestamp)):void 0,r=K(K({},e),{},{attributes:this.applyRedact(K(K({},n===void 0?this.getRuntimeAttributes():this.getRuntimeAttributesAt(n)),(t=e.attributes)==null?{}:t))});this.logger.emit(r)}),I(this,`flush`,W(function*(){var e;yield(e=t.pluginManager)==null?void 0:e.flush(),yield t.flushProviders()})),I(this,`getRuntimeAttributes`,()=>this.runtimeContext.getAttributes()),I(this,`getRuntimeAttributesAt`,e=>this.runtimeContext.getAttributesAt(e)),I(this,`isSampled`,()=>this.sampled),I(this,`isSessionActive`,()=>this.runtimeContext.isSessionActive()),I(this,`isViewActive`,()=>this.runtimeContext.isViewActive()),I(this,`logger`,void 0),I(this,`meter`,void 0),I(this,`notifySessionLifecycle`,e=>{this.runtimeContext.notifySessionLifecycle(e)}),I(this,`onSessionLifecycle`,e=>this.runtimeContext.onSessionLifecycle(e)),I(this,`registerInstrumentations`,e=>{e.length&&(Nc({instrumentations:e,meterProvider:this.meterProvider,tracerProvider:this.tracerProvider}),this.registeredInstrumentations.push(...e))}),I(this,`reportAction`,({attributes:e={},name:t})=>{if(!this.isSampled())return;let n=Bl(`action`);this.startSpan(`action.custom`,K(K(K(K({},this.config.hooks.getPageAttributes()),e),Q({errorType:`none`,eventLabel:`用户操作`,spanSubtype:`custom`,spanType:Z.action,targetLabel:t,traceScene:`user_action`})),{},{[Y.actionId]:n,[Y.actionName]:t,[Y.actionType]:`custom`})).end()}),I(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=this.startSpan(`custom.${n}`,K(K(K(K(K({},this.config.hooks.getPageAttributes()),this.config.hooks.getCustomAttributes()),Q({errorType:t?`custom`:`none`,eventLabel:`自定义事件`,result:t?X.error:X.success,spanSubtype:n,spanType:Z.custom,targetLabel:n})),e),{},{"rum.custom.name":n}));t&&(i.recordException(t),i.setStatus({code:We.ERROR,message:t.message})),i.end()}),I(this,`setRuntimeAttributes`,(e,t)=>{let n=K({},e);if(Y.sessionId in e){let t=e[Y.sessionId];this.sampled=this.config.enabled&&typeof t==`string`&&t.length>0?ku(this.config,t):!1,n[$]=this.sampled}this.runtimeContext.setAttributes(n,t)}),I(this,`setTrackingConsent`,function(){var e=W(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)}}()),I(this,`setUser`,e=>{this.runtimeContext.setUser(e)}),I(this,`setViewLoadingTime`,()=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({time:Date.now(),type:`set_loading_time`})}),I(this,`setViewName`,e=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({name:e,type:`set_name`})}),I(this,`shutdown`,W(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(),yield t.meterProvider.shutdown(),yield t.loggerProvider.shutdown(),t.phase=`stopped`}})),I(this,`start`,W(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`}})),I(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,o=a===void 0?this.getRuntimeAttributes():this.runtimeContext.getAttributesAt(a);return this.tracer.startSpan(e,{kind:(i=n==null?void 0:n.kind)==null?Ue.INTERNAL:i,startTime:n==null?void 0:n.startTime,attributes:this.applyRedact(K(K({},o),t))})}),I(this,`startView`,(e={})=>{this.isSampled()&&this.runtimeContext.dispatchViewCommand({options:e,type:`start`})}),I(this,`tracer`,void 0),I(this,`use`,e=>{var t;return this.assertBeforeStart(`use`),(t=this.config.extensions.plugins)==null||t.push(e),this}),I(this,`useInstrumentation`,e=>{var t;return this.assertBeforeStart(`useInstrumentation`),this.config.enabled&&((t=this.config.extensions.instrumentations)==null||t.push(e)),this}),this.config=Wm(e),this.runtimeContext=new Jm({[$]:!1},this.config.user);let n=io(this.config.resourceAttributes),r=(()=>{if(this.config.transport.traces===!1)return[];let e=eh(new Ac(Ym(this.config.transport.traces)),`traces`,this.config.debug);return[new nd(this.config.spanProcessor===`simple`?new Fl(e):new ml(e,this.config.spanBatch),this.config,()=>this.applyRedact(K(K({},this.runtimeContext.getAttributes()),this.config.hooks.getPageAttributes())))]})(),i=this.config.transport.metrics===!1?[]:[new $a({exporter:new id(eh(new kc(K(K({},Ym(this.config.transport.metrics)),{},{temporalityPreference:bc.DELTA})),`metrics`,this.config.debug)),exportIntervalMillis:this.config.metricIntervalMillis})],a=this.config.transport.logs===!1?[]:[new td(new Qc(eh(new yc(Ym(this.config.transport.logs)),`logs`,this.config.debug)),this.config)];this.tracerProvider=new zl({resource:n,sampler:new Zm(()=>this.config.transport.traces!==!1&&this.isSampled()),spanProcessors:r}),this.meterProvider=new cs({resource:n,readers:i}),this.loggerProvider=new qc({resource:n,processors:a}),this.tracer=this.tracerProvider.getTracer(Xm),this.meter=this.meterProvider.getMeter(Xm),this.logger=this.loggerProvider.getLogger(Xm),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:sh}),sh})();
|