@launchdarkly/browser-telemetry 0.2.0 → 0.3.0
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/CHANGELOG.md +7 -0
- package/README.md +52 -3
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -77
- package/dist/index.d.ts +78 -77
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.0](https://github.com/launchdarkly/js-core/compare/browser-telemetry-v0.2.0...browser-telemetry-v0.3.0) (2025-01-31)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Option to disable all breadcrumbs and stack. ([#770](https://github.com/launchdarkly/js-core/issues/770)) ([2c51838](https://github.com/launchdarkly/js-core/commit/2c51838f84a6c21ab38b12d960117d8ed801a114))
|
|
9
|
+
|
|
3
10
|
## [0.2.0](https://github.com/launchdarkly/js-core/compare/browser-telemetry-v0.1.1...browser-telemetry-v0.2.0) (2025-01-23)
|
|
4
11
|
|
|
5
12
|
|
package/README.md
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
> [!WARNING]
|
|
6
6
|
> This is an alpha version. The API is not stabilized and will introduce breaking changes.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
[![NPM][browser-telemetry-npm-badge]][browser-telemetry-npm-link]
|
|
9
|
+
[![Actions Status][browser-telemetry-ci-badge]][browser-telemetry-ci]
|
|
10
|
+
[![Documentation][browser-telemetry-ghp-badge]][browser-telemetry-ghp-link]
|
|
11
|
+
[![NPM][browser-telemetry-dm-badge]][browser-telemetry-npm-link]
|
|
12
|
+
[![NPM][browser-telemetry-dt-badge]][browser-telemetry-npm-link]
|
|
9
13
|
|
|
10
14
|
## LaunchDarkly overview
|
|
11
15
|
|
|
@@ -15,11 +19,47 @@ TODO Add badges
|
|
|
15
19
|
|
|
16
20
|
## Compatibility
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
This package is compatible with the `launchdarkly-js-client-sdk` version 3.4.0 and later.
|
|
19
23
|
|
|
20
24
|
## Setup
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
### For error metric collection only
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
import { initialize } from "launchdarkly-js-client-sdk";
|
|
30
|
+
import { initTelemetry, register } from "@launchdarkly/browser-telemetry";
|
|
31
|
+
|
|
32
|
+
// Initialize the telemetry as early as possible in your application.
|
|
33
|
+
// Errors will be missed if they occur before the telemetry is initialized.
|
|
34
|
+
// For metrics only, breadcrumbs and stack traces are not required.
|
|
35
|
+
initTelemetry({breadcrumbs: false, stack: false});
|
|
36
|
+
|
|
37
|
+
// Initialize the LaunchDarkly client.
|
|
38
|
+
const client = initialize('sdk-key', context);
|
|
39
|
+
|
|
40
|
+
// Register the client with the telemetry instance.
|
|
41
|
+
register(client);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### For error monitoring + metric collection
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
import { initialize } from "launchdarkly-js-client-sdk";
|
|
48
|
+
import { initTelemetry, register, inspectors } from "@launchdarkly/browser-telemetry";
|
|
49
|
+
|
|
50
|
+
// Initialize the telemetry as early as possible in your application.
|
|
51
|
+
// Errors will be missed if they occur before the telemetry is initialized.
|
|
52
|
+
initTelemetry();
|
|
53
|
+
|
|
54
|
+
// Initialize the LaunchDarkly client.
|
|
55
|
+
const client = initialize('sdk-key', context, {
|
|
56
|
+
// Inspectors allows the telemetry SDK to capture feature flag information.
|
|
57
|
+
inspectors: inspectors(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Register the client with the telemetry instance.
|
|
61
|
+
register(client);
|
|
62
|
+
```
|
|
23
63
|
|
|
24
64
|
## Contributing
|
|
25
65
|
|
|
@@ -39,3 +79,12 @@ We encourage pull requests and other contributions from the community. Check out
|
|
|
39
79
|
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides
|
|
40
80
|
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation
|
|
41
81
|
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates
|
|
82
|
+
|
|
83
|
+
[browser-telemetry-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/browser-telemetry.yml/badge.svg
|
|
84
|
+
[browser-telemetry-ci]: https://github.com/launchdarkly/js-core/actions/workflows/browser-telemetry.yml
|
|
85
|
+
[browser-telemetry-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/browser-telemetry.svg?style=flat-square
|
|
86
|
+
[browser-telemetry-npm-link]: https://www.npmjs.com/package/@launchdarkly/browser-telemetry
|
|
87
|
+
[browser-telemetry-ghp-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
|
|
88
|
+
[browser-telemetry-ghp-link]: https://launchdarkly.github.io/js-core/packages/telemetry/browser-telemetry/docs/
|
|
89
|
+
[browser-telemetry-dm-badge]: https://img.shields.io/npm/dm/@launchdarkly/browser-telemetry.svg?style=flat-square
|
|
90
|
+
[browser-telemetry-dt-badge]: https://img.shields.io/npm/dt/@launchdarkly/browser-telemetry.svg?style=flat-square
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";var re=Object.defineProperty;var
|
|
2
|
-
`):[]}return
|
|
3
|
-
`),d=
|
|
4
|
-
`).length,column:d.index-
|
|
5
|
-
`,d.index)-1};return null}function te(
|
|
6
|
-
`),
|
|
7
|
-
`),b=[],g;for(let f=0;f<
|
|
8
|
-
`);if(c.length<4)return null;let
|
|
9
|
-
`);let J=
|
|
10
|
-
`).length)}}}else if(a=u.exec(c[h])){let p=e.location.href.replace(/#.*$/,""),w=new RegExp(de(c[h+1])),y=Z(w,[p]);s={url:p,func:"",args:[],line:y?y.line:a[1],column:null}}if(s){s.func||(s.func=I(s.url,s.line));let p=U(s.url,s.line),w=p?p[Math.floor(p.length/2)]:null;p&&w&&w.replace(/^\s*/,"")===c[h+1].replace(/^\s*/,"")?s.context=p:s.context=[c[h+1]],b.push(s)}}return b.length?{mode:"multiline",name:o.name,message:c[0],stack:b}:null}function ge(o,c,l,d){let u={url:c,line:l};if(u.url&&u.line){o.incomplete=!1,u.func||(u.func=I(u.url,u.line)),u.context||(u.context=U(u.url,u.line));let b=/ '([^']+)' /.exec(d);if(b&&(u.column=te(b[1],u.url,u.line)),o.stack.length>0&&o.stack[0].url===u.url){if(o.stack[0].line===u.line)return!1;if(!o.stack[0].line&&o.stack[0].func===u.func)return o.stack[0].line=u.line,o.stack[0].context=u.context,!1}return o.stack.unshift(u),o.partial=!0,!0}return o.incomplete=!0,!1}function he(o,c){let l=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,d=[],u={},b=!1,g,f,a;for(let s=he.caller;s&&!b;s=s.caller)if(!(s===F||s===v.report)){if(f={url:null,func:n,args:[],line:null,column:null},s.name?f.func=s.name:(g=l.exec(s.toString()))&&(f.func=g[1]),typeof f.func=="undefined")try{f.func=g.input.substring(0,g.input.indexOf("{"))}catch(p){}if(a=Se(s)){f.url=a.url,f.line=a.line,f.func===n&&(f.func=I(f.url,f.line));let p=/ '([^']+)' /.exec(o.message||o.description);p&&(f.column=te(p[1],a.url,a.line))}u[`${s}`]?b=!0:u[`${s}`]=!0,d.push(f)}c&&d.splice(0,c);let h={mode:"callers",name:o.name,message:o.message,stack:d};return ge(h,o.sourceURL||o.fileName,o.line||o.lineNumber,o.message||o.description),h}function F(o,c){let l=null;c=c==null?0:+c;try{if(l=Fe(o),l)return l}catch(d){}try{if(l=pe(o),l)return l}catch(d){}try{if(l=Re(o),l)return l}catch(d){}try{if(l=he(o,c+1),l)return l}catch(d){}return{name:o.name,message:o.message,mode:"failed",stack:[]}}function Oe(o){o=(o==null?0:+o)+1;try{throw new Error}catch(c){return F(c,o+1)}}return F.augmentStackTraceWithInitialElement=ge,F.computeStackTraceFromStackProp=pe,F.guessFunctionName=I,F.gatherContext=U,F.ofCaller=Oe,F.getSource=D,F}(),v.remoteFetching||(v.remoteFetching=!0),v.collectWindowErrors||(v.collectWindowErrors=!0),(!v.linesOfContext||v.linesOfContext<1)&&(v.linesOfContext=11)})(typeof window!="undefined"?window:global);function ee(){return v}var Ee="(index)";function ot(e,t){let r=e;if(e.startsWith(t)){if(r=e.slice(t.length),r.startsWith("/")&&(r=r.slice(1)),r==="")return Ee;r.endsWith("/")&&(r+=Ee)}return r}function Le(e,t,r){if(t.length<=e.maxLength)return t;let n=Math.max(0,r-e.beforeColumnCharacters),i=Math.min(t.length,n+e.maxLength);return t.slice(n,i)}function _e(e,t,r,n){let i=e<0?0:e,m=t>r.length?r.length:t;return i<m?r.slice(i,m).map(n):[]}function at(e,t){let{context:r}=e;if(!r)return{};let{maxLineLength:n}=t.source,i=Math.floor(n/2),m=T=>Le({maxLength:t.source.maxLineLength,beforeColumnCharacters:i},T,0),x=Math.floor(r.length/2);return{srcBefore:_e(x-t.source.beforeLines,x,r,m),srcLine:Le({maxLength:n,beforeColumnCharacters:i},r[x],e.column||0),srcAfter:_e(x+1,x+1+t.source.afterLines,r,m)}}function me(e,t){return{frames:ee().computeStackTrace(e).stack.reverse().map(i=>({fileName:ot(i.url,window.location.origin),function:i.func,line:i.line,col:i.column,...at(i,t)}))}}var we="$ld:telemetry",ct=`${we}:error`,ut=`${we}:session:init`,ke="generic",lt="exception was null or undefined",mt="exception had no message",ft=5;function Te(e){switch(typeof e){case"string":case"boolean":case"number":return e;default:return}}function dt(e,t){return e===void 0?void 0:t(e)}function pt(e){let t=ee(),r=Math.max(e.source.afterLines,e.source.beforeLines),n=t;n.linesOfContext=r*2+1}function gt(e){return e.logger!==void 0}function ht(e){return e.waitForInitialization!==void 0}var B=class{constructor(t){this._options=t;this._pendingEvents=[];this._breadcrumbs=[];this._inspectorInstances=[];this._collectors=[];this._sessionId=le();this._registrationComplete=!1;this._clientRegistered=!1;this._eventsDropped=!1;this._breadcrumbFilterError=!1;this._errorFilterError=!1;var m;pt(t.stack),this._collectors.push(new j),this._collectors.push(...t.collectors),this._maxPendingEvents=t.maxPendingEvents,this._maxBreadcrumbs=t.breadcrumbs.maxBreadcrumbs;let r=[oe];t.breadcrumbs.http.customUrlFilter&&r.push(t.breadcrumbs.http.customUrlFilter),t.breadcrumbs.http.instrumentFetch&&this._collectors.push(new W({urlFilters:r})),t.breadcrumbs.http.instrumentXhr&&this._collectors.push(new G({urlFilters:r})),t.breadcrumbs.click&&this._collectors.push(new A),t.breadcrumbs.keyboardInput&&this._collectors.push(new X),this._collectors.forEach(x=>x.register(this,this._sessionId));let n=this,i=[];ae(t,i,n),this._inspectorInstances.push(...i),this._logger=(m=this._options.logger)!=null?m:S}register(t){if(this._client!==void 0)return;this._client=t,this._setLogger();let r=()=>{var n;(n=this._client)==null||n.track(ut,{sessionId:this._sessionId}),this._pendingEvents.forEach(i=>{var m;(m=this._client)==null||m.track(i.type,i.data)}),this._pendingEvents=[],this._registrationComplete=!0};ht(t)?(async()=>{try{await t.waitForInitialization(ft)}catch(n){}r()})():r()}_setLogger(){this._options.logger?this._logger=this._options.logger:gt(this._client)?this._logger=this._client.logger:this._logger=S}inspectors(){return this._inspectorInstances}_capture(t,r){var i;let n=this._applyFilters(r,this._options.errorFilters,m=>{this._errorFilterError||(this._errorFilterError=!0,this._logger.warn(k(`Error applying error filters: ${m}`)))});n!==void 0&&(this._registrationComplete?(i=this._client)==null||i.track(t,n):(this._pendingEvents.push({type:t,data:n}),this._pendingEvents.length>this._maxPendingEvents&&(this._eventsDropped||(this._eventsDropped=!0,this._logger.warn(k("Maximum pending events reached. Old events will be dropped until the SDK client is registered."))),this._pendingEvents.shift())))}captureError(t){var i,m;let n=t!=null?{type:t.name||((i=t.constructor)==null?void 0:i.name)||ke,message:(m=t.message)!=null?m:mt,stack:me(t,this._options.stack),breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId}:{type:ke,message:lt,stack:{frames:[]},breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId};this._capture(ct,n)}captureErrorEvent(t){this.captureError(t.error)}_applyFilters(t,r,n){try{return r.reduce((i,m)=>dt(i,m),t)}catch(i){n(i);return}}addBreadcrumb(t){let r=this._applyFilters(t,this._options.breadcrumbs.filters,n=>{this._breadcrumbFilterError||(this._breadcrumbFilterError=!0,this._logger.warn(k(`Error applying breadcrumb filters: ${n}`)))});r!==void 0&&(this._breadcrumbs.push(r),this._breadcrumbs.length>this._maxBreadcrumbs&&this._breadcrumbs.shift())}close(){this._collectors.forEach(t=>t.unregister())}handleFlagUsed(t,r,n){let i={type:"flag-evaluated",data:{key:t,value:Te(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(i)}handleFlagDetailChanged(t,r){let n={type:"flag-detail-changed",data:{key:t,value:Te(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(n)}};function bt(){return{breadcrumbs:{maxBreadcrumbs:50,evaluations:!0,flagChange:!0,click:!0,keyboardInput:!0,http:{instrumentFetch:!0,instrumentXhr:!0},filters:[]},stack:{source:{beforeLines:3,afterLines:3,maxLineLength:280}},maxPendingEvents:100,collectors:[],errorFilters:[]}}function P(e,t,r){return k(`Config option "${e}" should be of type ${t}, got ${r}, using default value`)}function _(e,t,r){return n=>{let i=typeof n;return i===e?!0:(r==null||r.warn(P(t,e,i)),!1)}}function E(e,t,r){return e!=null&&(!r||r(e))?e:t}function xt(e,t,r){if(e!==void 0&&e!==!1&&typeof e!="object")return r==null||r.warn(P("breadcrumbs.http","HttpBreadCrumbOptions | false",typeof e)),t;if(e===!1)return{instrumentFetch:!1,instrumentXhr:!1};e!=null&&e.customUrlFilter&&typeof e.customUrlFilter!="function"&&(r==null||r.warn(k(`The "breadcrumbs.http.customUrlFilter" must be a function. Received ${typeof e.customUrlFilter}`)));let n=e!=null&&e.customUrlFilter&&typeof(e==null?void 0:e.customUrlFilter)=="function"?e.customUrlFilter:void 0;return{instrumentFetch:E(e==null?void 0:e.instrumentFetch,t.instrumentFetch,_("boolean","breadcrumbs.http.instrumentFetch",r)),instrumentXhr:E(e==null?void 0:e.instrumentXhr,t.instrumentXhr,_("boolean","breadcrumbs.http.instrumentXhr",r)),customUrlFilter:n}}function yt(e){if(e.logger){let{logger:t}=e;if(typeof t=="object"&&t!==null&&"warn"in t)return M(t);S.warn(P("logger","MinLogger or LDLogger",typeof t))}}function vt(e,t,r){var n,i,m;return{source:{beforeLines:E((n=e==null?void 0:e.source)==null?void 0:n.beforeLines,t.source.beforeLines,_("number","stack.beforeLines",r)),afterLines:E((i=e==null?void 0:e.source)==null?void 0:i.afterLines,t.source.afterLines,_("number","stack.afterLines",r)),maxLineLength:E((m=e==null?void 0:e.source)==null?void 0:m.maxLineLength,t.source.maxLineLength,_("number","stack.maxLineLength",r))}}}function z(e,t){var n,i,m,x,T,C,R;let r=bt();return e.breadcrumbs&&_("object","breadcrumbs",t)(e.breadcrumbs),e.stack&&_("object","stack",t)(e.stack),{breadcrumbs:{maxBreadcrumbs:E((n=e.breadcrumbs)==null?void 0:n.maxBreadcrumbs,r.breadcrumbs.maxBreadcrumbs,_("number","breadcrumbs.maxBreadcrumbs",t)),evaluations:E((i=e.breadcrumbs)==null?void 0:i.evaluations,r.breadcrumbs.evaluations,_("boolean","breadcrumbs.evaluations",t)),flagChange:E((m=e.breadcrumbs)==null?void 0:m.flagChange,r.breadcrumbs.flagChange,_("boolean","breadcrumbs.flagChange",t)),click:E((x=e.breadcrumbs)==null?void 0:x.click,r.breadcrumbs.click,_("boolean","breadcrumbs.click",t)),keyboardInput:E((T=e.breadcrumbs)==null?void 0:T.keyboardInput,r.breadcrumbs.keyboardInput,_("boolean","breadcrumbs.keyboardInput",t)),http:xt((C=e.breadcrumbs)==null?void 0:C.http,r.breadcrumbs.http,t),filters:E((R=e.breadcrumbs)==null?void 0:R.filters,r.breadcrumbs.filters,L=>Array.isArray(L)?!0:(t==null||t.warn(P("breadcrumbs.filters","BreadcrumbFilter[]",typeof L)),!1))},stack:vt(e.stack,r.stack),maxPendingEvents:E(e.maxPendingEvents,r.maxPendingEvents,_("number","maxPendingEvents",t)),collectors:[...E(e.collectors,r.collectors,L=>Array.isArray(L)?!0:(t==null||t.warn(P("collectors","Collector[]",typeof L)),!1))],logger:yt(e),errorFilters:E(e.errorFilters,r.errorFilters,L=>Array.isArray(L)?!0:(t==null||t.warn(P("errorFilters","ErrorDataFilter[]",typeof L)),!1))}}var V,fe=!1;function Et(e){let t=M(e==null?void 0:e.logger);if(V){t.warn(k("Telemetry has already been initialized. Ignoring new options."));return}let r=z(e||{},t);V=new B(r)}function O(){if(!V){if(fe)return;S.warn(k("Telemetry has not been initialized")),fe=!0;return}return V}function Lt(){V=void 0,fe=!1}function _t(){var e;return((e=O())==null?void 0:e.inspectors())||[]}function kt(e){var t;(t=O())==null||t.captureError(e)}function Tt(e){var t;(t=O())==null||t.captureErrorEvent(e)}function wt(e){var t;(t=O())==null||t.addBreadcrumb(e)}function St(e){var t;(t=O())==null||t.register(e)}function Ft(){var e;(e=O())==null||e.close()}function Rt(e){let t=z(e||{},M(e==null?void 0:e.logger));return new B(t)}0&&(module.exports={addBreadcrumb,captureError,captureErrorEvent,close,getTelemetryInstance,initTelemetry,initTelemetryInstance,inspectors,register,resetTelemetryInstance});
|
|
1
|
+
"use strict";var re=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var De=(e,t)=>{for(var r in t)re(e,r,{get:t[r],enumerable:!0})},Me=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ce(t))!Ie.call(e,i)&&i!==r&&re(e,i,{get:()=>t[i],enumerable:!(n=Re(t,i))||n.enumerable});return e};var Pe=e=>Me(re({},"__esModule",{value:!0}),e);var It={};De(It,{addBreadcrumb:()=>Ft,captureError:()=>St,captureErrorEvent:()=>Ot,close:()=>Rt,getTelemetryInstance:()=>S,initTelemetry:()=>kt,initTelemetryInstance:()=>Ct,inspectors:()=>wt,register:()=>Bt,resetTelemetryInstance:()=>Tt});module.exports=Pe(It);function N(e){try{return e.target}catch(t){return}}var Ne=">",Ue=` ${Ne} `;function $e(e){let t=e;return typeof t=="object"&&t!=null&&t.parentNode}function He(e){if(typeof e.className!="string")return;let t=e.className;if(e.className.includes(" ")&&(t=e.className.replace(" ",".")),t!=="")return`.${t}`}function Ae(e){if(!e.tagName)return"";let t=[];t.push(e.tagName.toLowerCase()),e.id&&t.push(`#${e.id}`);let r=He(e);return r&&t.push(r),t.join("")}function U(e,t={maxDepth:10}){let r=[],n=e;for(;$e(n)&&n.parentNode&&r.length<t.maxDepth;){let i=Ae(n);if(i==="html")break;r.push(i),n=n.parentNode}return r.reverse().join(Ue)}var $=class{constructor(){window.addEventListener("click",t=>{var n;let r=N(t);if(r){let i={class:"ui",type:"click",level:"info",timestamp:Date.now(),message:U(r)};(n=this._destination)==null||n.addBreadcrumb(i)}},!0)}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var Xe=1e3,je=["INPUT","TEXTAREA"],H=class{constructor(){window.addEventListener("keypress",t=>{var i;let r=N(t),n=r;if(r&&(je.includes(r.tagName)||n!=null&&n.isContentEditable)){let m={class:"ui",type:"input",level:"info",timestamp:Date.now(),message:U(r)};this._shouldDeduplicate(m)||((i=this._destination)==null||i.addBreadcrumb(m),this._lastEvent=m)}},!0)}register(t,r){this._destination=t}unregister(){this._destination=void 0}_shouldDeduplicate(t){return this._lastEvent?Math.abs(t.timestamp-this._lastEvent.timestamp)<=Xe&&this._lastEvent.message===t.message:!1}};var A=class{constructor(){window.addEventListener("error",t=>{var r;(r=this._destination)==null||r.captureErrorEvent(t)},!0),window.addEventListener("unhandledrejection",t=>{var r;t.reason&&((r=this._destination)==null||r.captureError(t.reason))},!0)}register(t){this._destination=t}unregister(){this._destination=void 0}};function ne(e,t){return t?e.reduce((r,n)=>n(r),t):""}function X(e,t){var r;(r=e.data)!=null&&r.url&&(e.data.url=ne(t.urlFilters,e.data.url))}var qe="__LaunchDarkly_original_fetch",j=window.fetch;function Ke(e,t){var i;let r="",n="GET";return typeof e=="string"&&(r=e),typeof Request!="undefined"&&e instanceof Request&&(r=e.url,n=e.method),typeof URL!="undefined"&&e instanceof URL&&(r=e.toString()),t&&(n=(i=t.method)!=null?i:n),{url:r,method:n}}function ie(e){function t(...r){let n=Date.now();return j.apply(this,r).then(i=>{let m={class:"http",timestamp:n,level:i.ok?"info":"error",type:"fetch",data:{...Ke(r[0],r[1]),statusCode:i.status,statusText:i.statusText}};return e(m),i})}t.prototype=j==null?void 0:j.prototype;try{Object.defineProperty(t,qe,{value:j,writable:!0,configurable:!0})}catch(r){}window.fetch=t}var q=class{constructor(t){ie(r=>{var n;X(r,t),(n=this._destination)==null||n.addBreadcrumb(r)})}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var ve="__LaunchDarkly_original_xhr",We=`${ve}_open`,Ge=`${ve}_send`,Q="__LaunchDarkly_data_xhr",xe=window.XMLHttpRequest.prototype.open,ye=window.XMLHttpRequest.prototype.send;function se(e){function t(...n){this.addEventListener("error",function(i){let m=this[Q];m.error=!0}),this.addEventListener("loadend",function(i){let m=this[Q];m&&m.timestamp&&e({class:"http",timestamp:m.timestamp,level:m.error?"error":"info",type:"xhr",data:{url:m.url,method:m.method,statusCode:this.status,statusText:this.statusText}})},!0),xe.apply(this,n);try{let i={method:n==null?void 0:n[0],url:n==null?void 0:n[1]};Object.defineProperty(this,Q,{value:i,writable:!0,configurable:!0})}catch(i){}}function r(...n){ye.apply(this,n);let i=this[Q];i&&(i.timestamp=Date.now())}window.XMLHttpRequest.prototype.open=t,window.XMLHttpRequest.prototype.send=r;try{Object.defineProperties(window.XMLHttpRequest,{[We]:{value:xe,writable:!0,configurable:!0},[Ge]:{value:ye,writable:!0,configurable:!0}})}catch(n){}}var K=class{constructor(t){se(r=>{var n;X(r,t),(n=this._destination)==null||n.addBreadcrumb(r)})}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var ze=/sdk\/evalx\/[^/]+\/contexts\/(?<context>[^/?]*)\??.*?/,Ve=/\/eval\/[^/]+\/(?<context>[^/?]*)\??.*?/;function Ye(e){let t=new URL(e),r=!1;return t.username&&(t.username="redacted",r=!0),t.password&&(t.password="redacted",r=!0),r?t.toString():e}function Ze(e){var t,r;if(e.includes("/sdk/evalx")){let n=e.match(ze),i=(t=n==null?void 0:n.groups)==null?void 0:t.context;if(i)return e.replace(i,"*".repeat(i.length))}if(e.includes("/eval/")){let n=e.match(Ve),i=(r=n==null?void 0:n.groups)==null?void 0:r.context;if(i)return e.replace(i,"*".repeat(i.length))}return e}function ae(e){return Ze(Ye(e))}function oe(e,t,r){e.breadcrumbs.evaluations&&t.push({type:"flag-used",name:"launchdarkly-browser-telemetry-flag-used",synchronous:!0,method(n,i,m){r.handleFlagUsed(n,i,m)}}),e.breadcrumbs.flagChange&&t.push({type:"flag-detail-changed",name:"launchdarkly-browser-telemetry-flag-used",synchronous:!0,method(n,i){r.handleFlagDetailChanged(n,i)}})}var T={warn:console.warn},Je="LaunchDarkly - Browser Telemetry:";function _(e){return`${Je} ${e}`}function C(e){return{warn:(...t)=>{if(!e){T.warn(...t);return}try{e.warn(...t)}catch(r){T.warn(...t),T.warn(_("The provided logger threw an exception, using fallback logger."))}}}}var Qe={start:0,end:3},et={start:4,end:5},ce={start:6,end:7},le={start:8,end:8},tt={start:9,end:9},rt={start:10,end:15};function nt(){if(crypto&&crypto.getRandomValues){let t=new Uint8Array(16);return crypto.getRandomValues(t),[...t.values()]}let e=[];for(let t=0;t<16;t+=1)e.push(Math.floor(Math.random()*256));return e}function I(e,t){let r="";for(let n=t.start;n<=t.end;n+=1)r+=e[n].toString(16).padStart(2,"0");return r}function it(e){return e[le.start]=(e[le.start]|128)&191,e[ce.start]=e[ce.start]&15|64,`${I(e,Qe)}-${I(e,et)}-${I(e,ce)}-${I(e,le)}${I(e,tt)}-${I(e,rt)}`}function st(){let e=nt();return it(e)}function ue(){return typeof crypto!==void 0&&typeof crypto.randomUUID=="function"?crypto.randomUUID():st()}var y={};(function(e,t){if(!e)return;let r=[].slice,n="?",i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function m(O,z){return Object.prototype.hasOwnProperty.call(O,z)}function L(O){return typeof O=="undefined"}y.wrap=function(z){function M(){try{return z.apply(this,arguments)}catch(V){throw y.report(V),V}}return M},y.computeStackTrace=function(){let M={};function V(a){if(!y.remoteFetching)return"";try{let u=function(){try{return new e.XMLHttpRequest}catch(d){return new e.ActiveXObject("Microsoft.XMLHTTP")}}();return u.open("GET",a,!1),u.send(""),u.responseText}catch(c){return""}}function B(a){if(typeof a!="string")return[];if(!m(M,a)){let c="",u="";try{u=e.document.domain}catch(l){}let d=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(a);d&&d[2]===u&&(c=V(a)),M[a]=c?c.split(`
|
|
2
|
+
`):[]}return M[a]}function R(a,c){typeof c!="number"&&(c=Number(c));let u=/function ([^(]*)\(([^)]*)\)/,d=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,l="",b=10,g=B(a),f;if(!g.length)return n;for(let o=0;o<b;++o)if(l=g[c-o]+l,!L(l)&&((f=d.exec(l))||(f=u.exec(l))))return f[1];return n}function P(a,c){typeof c!="number"&&(c=Number(c));let u=B(a);if(!u.length)return null;let d=[],l=Math.floor(y.linesOfContext/2),b=l+y.linesOfContext%2,g=Math.max(0,c-l-1),f=Math.min(u.length,c+b-1);c-=1;for(let o=g;o<f;++o)L(u[o])||d.push(u[o]);return d.length>0?d:null}function Y(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function de(a){return Y(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function Z(a,c){let u,d;for(let l=0,b=c.length;l<b;++l)if((u=B(c[l])).length&&(u=u.join(`
|
|
3
|
+
`),d=a.exec(u)))return{url:c[l],line:u.substring(0,d.index).split(`
|
|
4
|
+
`).length,column:d.index-u.lastIndexOf(`
|
|
5
|
+
`,d.index)-1};return null}function te(a,c,u){typeof u!="number"&&(u=Number(u));let d=B(c),l=new RegExp(`\\b${Y(a)}\\b`),b;return u-=1,d&&d.length>u&&(b=l.exec(d[u]))?b.index:null}function Se(a){if(L(e&&e.document))return;let c=[e.location.href],u=e.document.getElementsByTagName("script"),d,l=`${a}`,b=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,g=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,f,o,h;for(let s=0;s<u.length;++s){let p=u[s];p.src&&c.push(p.src)}if(!(o=b.exec(l)))f=new RegExp(Y(l).replace(/\s+/g,"\\s+"));else{let s=o[1]?`\\s+${o[1]}`:"",p=o[2].split(",").join("\\s*,\\s*");d=Y(o[3]).replace(/;$/,";?"),f=new RegExp(`function${s}\\s*\\(\\s*${p}\\s*\\)\\s*{\\s*${d}\\s*}`)}if(h=Z(f,c))return h;if(o=g.exec(l)){let s=o[1];if(d=de(o[2]),f=new RegExp(`on${s}=[\\'"]\\s*${d}\\s*[\\'"]`,"i"),(h=Z(f,c[0]))||(f=new RegExp(d),h=Z(f,c)))return h}return null}function pe(a){if(!a.stack)return null;let c=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,u=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,d=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,l,b=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,g=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=a.stack.split(`
|
|
6
|
+
`),o=[],h,s,p,k=/^(.*) is undefined$/.exec(a.message);for(let x=0,J=f.length;x<J;++x){if(s=c.exec(f[x])){let be=s[2]&&s[2].indexOf("native")===0;l=s[2]&&s[2].indexOf("eval")===0,l&&(h=g.exec(s[2]))&&(s[2]=h[1],s[3]=h[2],s[4]=h[3]),p={url:be?null:s[2],func:s[1]||n,args:be?[s[2]]:[],line:s[3]?+s[3]:null,column:s[4]?+s[4]:null}}else if(s=d.exec(f[x]))p={url:s[2],func:s[1]||n,args:[],line:+s[3],column:s[4]?+s[4]:null};else if(s=u.exec(f[x]))l=s[3]&&s[3].indexOf(" > eval")>-1,l&&(h=b.exec(s[3]))?(s[3]=h[1],s[4]=h[2],s[5]=null):x===0&&!s[5]&&!L(a.columnNumber)&&(o[0].column=a.columnNumber+1),p={url:s[3],func:s[1]||n,args:s[2]?s[2].split(","):[],line:s[4]?+s[4]:null,column:s[5]?+s[5]:null};else continue;!p.func&&p.line&&(p.func=R(p.url,p.line)),p.context=p.line?P(p.url,p.line):null,o.push(p)}return o.length?(o[0]&&o[0].line&&!o[0].column&&k&&(o[0].column=te(k[1],o[0].url,o[0].line)),{mode:"stack",name:a.name,message:a.message,stack:o}):null}function Oe(a){let{stacktrace:c}=a;if(!c)return null;let u=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,d=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,l=c.split(`
|
|
7
|
+
`),b=[],g;for(let f=0;f<l.length;f+=2){let o=null;if((g=u.exec(l[f]))?o={url:g[2],line:+g[1],column:null,func:g[3],args:[]}:(g=d.exec(l[f]))&&(o={url:g[6],line:+g[1],column:+g[2],func:g[3]||g[4],args:g[5]?g[5].split(","):[]}),o){if(!o.func&&o.line&&(o.func=R(o.url,o.line)),o.line)try{o.context=P(o.url,o.line)}catch(h){}o.context||(o.context=[l[f+1]]),b.push(o)}}return b.length?{mode:"stacktrace",name:a.name,message:a.message,stack:b}:null}function Fe(a){let c=a.message.split(`
|
|
8
|
+
`);if(c.length<4)return null;let u=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,d=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,l=/^\s*Line (\d+) of function script\s*$/i,b=[],g=e&&e.document&&e.document.getElementsByTagName("script"),f=[],o;for(let h in g)m(g,h)&&!g[h].src&&f.push(g[h]);for(let h=2;h<c.length;h+=2){let s=null;if(o=u.exec(c[h]))s={url:o[2],func:o[3],args:[],line:+o[1],column:null};else if(o=d.exec(c[h])){s={url:o[3],func:o[4],args:[],line:+o[1],column:null};let p=+o[1],k=f[o[2]-1];if(k){let x=B(s.url);if(x){x=x.join(`
|
|
9
|
+
`);let J=x.indexOf(k.innerText);J>=0&&(s.line=p+x.substring(0,J).split(`
|
|
10
|
+
`).length)}}}else if(o=l.exec(c[h])){let p=e.location.href.replace(/#.*$/,""),k=new RegExp(de(c[h+1])),x=Z(k,[p]);s={url:p,func:"",args:[],line:x?x.line:o[1],column:null}}if(s){s.func||(s.func=R(s.url,s.line));let p=P(s.url,s.line),k=p?p[Math.floor(p.length/2)]:null;p&&k&&k.replace(/^\s*/,"")===c[h+1].replace(/^\s*/,"")?s.context=p:s.context=[c[h+1]],b.push(s)}}return b.length?{mode:"multiline",name:a.name,message:c[0],stack:b}:null}function ge(a,c,u,d){let l={url:c,line:u};if(l.url&&l.line){a.incomplete=!1,l.func||(l.func=R(l.url,l.line)),l.context||(l.context=P(l.url,l.line));let b=/ '([^']+)' /.exec(d);if(b&&(l.column=te(b[1],l.url,l.line)),a.stack.length>0&&a.stack[0].url===l.url){if(a.stack[0].line===l.line)return!1;if(!a.stack[0].line&&a.stack[0].func===l.func)return a.stack[0].line=l.line,a.stack[0].context=l.context,!1}return a.stack.unshift(l),a.partial=!0,!0}return a.incomplete=!0,!1}function he(a,c){let u=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,d=[],l={},b=!1,g,f,o;for(let s=he.caller;s&&!b;s=s.caller)if(!(s===w||s===y.report)){if(f={url:null,func:n,args:[],line:null,column:null},s.name?f.func=s.name:(g=u.exec(s.toString()))&&(f.func=g[1]),typeof f.func=="undefined")try{f.func=g.input.substring(0,g.input.indexOf("{"))}catch(p){}if(o=Se(s)){f.url=o.url,f.line=o.line,f.func===n&&(f.func=R(f.url,f.line));let p=/ '([^']+)' /.exec(a.message||a.description);p&&(f.column=te(p[1],o.url,o.line))}l[`${s}`]?b=!0:l[`${s}`]=!0,d.push(f)}c&&d.splice(0,c);let h={mode:"callers",name:a.name,message:a.message,stack:d};return ge(h,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description),h}function w(a,c){let u=null;c=c==null?0:+c;try{if(u=Oe(a),u)return u}catch(d){}try{if(u=pe(a),u)return u}catch(d){}try{if(u=Fe(a),u)return u}catch(d){}try{if(u=he(a,c+1),u)return u}catch(d){}return{name:a.name,message:a.message,mode:"failed",stack:[]}}function Be(a){a=(a==null?0:+a)+1;try{throw new Error}catch(c){return w(c,a+1)}}return w.augmentStackTraceWithInitialElement=ge,w.computeStackTraceFromStackProp=pe,w.guessFunctionName=R,w.gatherContext=P,w.ofCaller=Be,w.getSource=B,w}(),y.remoteFetching||(y.remoteFetching=!0),y.collectWindowErrors||(y.collectWindowErrors=!0),(!y.linesOfContext||y.linesOfContext<1)&&(y.linesOfContext=11)})(typeof window!="undefined"?window:global);function ee(){return y}var Ee="(index)";function at(e,t){let r=e;if(e.startsWith(t)){if(r=e.slice(t.length),r.startsWith("/")&&(r=r.slice(1)),r==="")return Ee;r.endsWith("/")&&(r+=Ee)}return r}function Le(e,t,r){if(t.length<=e.maxLength)return t;let n=Math.max(0,r-e.beforeColumnCharacters),i=Math.min(t.length,n+e.maxLength);return t.slice(n,i)}function _e(e,t,r,n){let i=e<0?0:e,m=t>r.length?r.length:t;return i<m?r.slice(i,m).map(n):[]}function ot(e,t){let{context:r}=e;if(!r)return{};let{maxLineLength:n}=t.source,i=Math.floor(n/2),m=O=>Le({maxLength:t.source.maxLineLength,beforeColumnCharacters:i},O,0),L=Math.floor(r.length/2);return{srcBefore:_e(L-t.source.beforeLines,L,r,m),srcLine:Le({maxLength:n,beforeColumnCharacters:i},r[L],e.column||0),srcAfter:_e(L+1,L+1+t.source.afterLines,r,m)}}function fe(e,t){return t.enabled?{frames:ee().computeStackTrace(e).stack.reverse().map(i=>({fileName:at(i.url,window.location.origin),function:i.func,line:i.line,col:i.column,...ot(i,t)}))}:{frames:[]}}var we="$ld:telemetry",ct=`${we}:error`,lt=`${we}:session:init`,ke="generic",ut="exception was null or undefined",ft="exception had no message",mt=5;function Te(e){switch(typeof e){case"string":case"boolean":case"number":return e;default:return}}function dt(e,t){return e===void 0?void 0:t(e)}function pt(e){if(!e.enabled)return;let t=ee(),r=Math.max(e.source.afterLines,e.source.beforeLines),n=t;n.linesOfContext=r*2+1}function gt(e){return e.logger!==void 0}function ht(e){return e.waitForInitialization!==void 0}var F=class{constructor(t){this._options=t;this._pendingEvents=[];this._breadcrumbs=[];this._inspectorInstances=[];this._collectors=[];this._sessionId=ue();this._registrationComplete=!1;this._clientRegistered=!1;this._eventsDropped=!1;this._breadcrumbFilterError=!1;this._errorFilterError=!1;var m;pt(t.stack),this._collectors.push(new A),this._collectors.push(...t.collectors),this._maxPendingEvents=t.maxPendingEvents,this._maxBreadcrumbs=t.breadcrumbs.maxBreadcrumbs;let r=[ae];t.breadcrumbs.http.customUrlFilter&&r.push(t.breadcrumbs.http.customUrlFilter),t.breadcrumbs.http.instrumentFetch&&this._collectors.push(new q({urlFilters:r})),t.breadcrumbs.http.instrumentXhr&&this._collectors.push(new K({urlFilters:r})),t.breadcrumbs.click&&this._collectors.push(new $),t.breadcrumbs.keyboardInput&&this._collectors.push(new H),this._collectors.forEach(L=>L.register(this,this._sessionId));let n=this,i=[];oe(t,i,n),this._inspectorInstances.push(...i),this._logger=(m=this._options.logger)!=null?m:T}register(t){if(this._client!==void 0)return;this._client=t,this._setLogger();let r=()=>{var n;(n=this._client)==null||n.track(lt,{sessionId:this._sessionId}),this._pendingEvents.forEach(i=>{var m;(m=this._client)==null||m.track(i.type,i.data)}),this._pendingEvents=[],this._registrationComplete=!0};ht(t)?(async()=>{try{await t.waitForInitialization(mt)}catch(n){}r()})():r()}_setLogger(){this._options.logger?this._logger=this._options.logger:gt(this._client)?this._logger=this._client.logger:this._logger=T}inspectors(){return this._inspectorInstances}_capture(t,r){var i;let n=this._applyFilters(r,this._options.errorFilters,m=>{this._errorFilterError||(this._errorFilterError=!0,this._logger.warn(_(`Error applying error filters: ${m}`)))});n!==void 0&&(this._registrationComplete?(i=this._client)==null||i.track(t,n):(this._pendingEvents.push({type:t,data:n}),this._pendingEvents.length>this._maxPendingEvents&&(this._eventsDropped||(this._eventsDropped=!0,this._logger.warn(_("Maximum pending events reached. Old events will be dropped until the SDK client is registered."))),this._pendingEvents.shift())))}captureError(t){var i,m;let n=t!=null?{type:t.name||((i=t.constructor)==null?void 0:i.name)||ke,message:(m=t.message)!=null?m:ft,stack:fe(t,this._options.stack),breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId}:{type:ke,message:ut,stack:{frames:[]},breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId};this._capture(ct,n)}captureErrorEvent(t){this.captureError(t.error)}_applyFilters(t,r,n){try{return r.reduce((i,m)=>dt(i,m),t)}catch(i){n(i);return}}addBreadcrumb(t){let r=this._applyFilters(t,this._options.breadcrumbs.filters,n=>{this._breadcrumbFilterError||(this._breadcrumbFilterError=!0,this._logger.warn(_(`Error applying breadcrumb filters: ${n}`)))});r!==void 0&&(this._breadcrumbs.push(r),this._breadcrumbs.length>this._maxBreadcrumbs&&this._breadcrumbs.shift())}close(){this._collectors.forEach(t=>t.unregister())}handleFlagUsed(t,r,n){let i={type:"flag-evaluated",data:{key:t,value:Te(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(i)}handleFlagDetailChanged(t,r){let n={type:"flag-detail-changed",data:{key:t,value:Te(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(n)}};var bt={maxBreadcrumbs:0,evaluations:!1,flagChange:!1,click:!1,keyboardInput:!1,http:{instrumentFetch:!1,instrumentXhr:!1,customUrlFilter:void 0},filters:[]},xt={enabled:!1,source:{beforeLines:0,afterLines:0,maxLineLength:0}};function yt(){return{breadcrumbs:{maxBreadcrumbs:50,evaluations:!0,flagChange:!0,click:!0,keyboardInput:!0,http:{instrumentFetch:!0,instrumentXhr:!0},filters:[]},stack:{enabled:!0,source:{beforeLines:3,afterLines:3,maxLineLength:280}},maxPendingEvents:100,collectors:[],errorFilters:[]}}function D(e,t,r){return _(`Config option "${e}" should be of type ${t}, got ${r}, using default value`)}function E(e,t,r){return n=>{let i=typeof n;return i===e?!0:(r==null||r.warn(D(t,e,i)),!1)}}function v(e,t,r){return e!=null&&(!r||r(e))?e:t}function vt(e,t,r){if(e!==void 0&&e!==!1&&typeof e!="object")return r==null||r.warn(D("breadcrumbs.http","HttpBreadCrumbOptions | false",typeof e)),t;if(e===!1)return{instrumentFetch:!1,instrumentXhr:!1};e!=null&&e.customUrlFilter&&typeof e.customUrlFilter!="function"&&(r==null||r.warn(_(`The "breadcrumbs.http.customUrlFilter" must be a function. Received ${typeof e.customUrlFilter}`)));let n=e!=null&&e.customUrlFilter&&typeof(e==null?void 0:e.customUrlFilter)=="function"?e.customUrlFilter:void 0;return{instrumentFetch:v(e==null?void 0:e.instrumentFetch,t.instrumentFetch,E("boolean","breadcrumbs.http.instrumentFetch",r)),instrumentXhr:v(e==null?void 0:e.instrumentXhr,t.instrumentXhr,E("boolean","breadcrumbs.http.instrumentXhr",r)),customUrlFilter:n}}function Et(e){if(e.logger){let{logger:t}=e;if(typeof t=="object"&&t!==null&&"warn"in t)return C(t);T.warn(D("logger","MinLogger or LDLogger",typeof t))}}function Lt(e,t,r){var n,i,m;return e===!1?xt:{enabled:!0,source:{beforeLines:v((n=e==null?void 0:e.source)==null?void 0:n.beforeLines,t.source.beforeLines,E("number","stack.beforeLines",r)),afterLines:v((i=e==null?void 0:e.source)==null?void 0:i.afterLines,t.source.afterLines,E("number","stack.afterLines",r)),maxLineLength:v((m=e==null?void 0:e.source)==null?void 0:m.maxLineLength,t.source.maxLineLength,E("number","stack.maxLineLength",r))}}}function _t(e,t,r){return e===!1?bt:{maxBreadcrumbs:v(e==null?void 0:e.maxBreadcrumbs,t.maxBreadcrumbs,E("number","breadcrumbs.maxBreadcrumbs",r)),evaluations:v(e==null?void 0:e.evaluations,t.evaluations,E("boolean","breadcrumbs.evaluations",r)),flagChange:v(e==null?void 0:e.flagChange,t.flagChange,E("boolean","breadcrumbs.flagChange",r)),click:v(e==null?void 0:e.click,t.click,E("boolean","breadcrumbs.click",r)),keyboardInput:v(e==null?void 0:e.keyboardInput,t.keyboardInput,E("boolean","breadcrumbs.keyboardInput",r)),http:vt(e==null?void 0:e.http,t.http,r),filters:v(e==null?void 0:e.filters,t.filters,n=>Array.isArray(n)?!0:(r==null||r.warn(D("breadcrumbs.filters","BreadcrumbFilter[]",typeof n)),!1))}}function W(e,t){let r=yt();return e.breadcrumbs&&E("object","breadcrumbs",t)(e.breadcrumbs),e.stack&&E("object","stack",t)(e.stack),{breadcrumbs:_t(e.breadcrumbs,r.breadcrumbs,t),stack:Lt(e.stack,r.stack,t),maxPendingEvents:v(e.maxPendingEvents,r.maxPendingEvents,E("number","maxPendingEvents",t)),collectors:[...v(e.collectors,r.collectors,n=>Array.isArray(n)?!0:(t==null||t.warn(D("collectors","Collector[]",typeof n)),!1))],logger:Et(e),errorFilters:v(e.errorFilters,r.errorFilters,n=>Array.isArray(n)?!0:(t==null||t.warn(D("errorFilters","ErrorDataFilter[]",typeof n)),!1))}}var G,me=!1;function kt(e){let t=C(e==null?void 0:e.logger);if(G){t.warn(_("Telemetry has already been initialized. Ignoring new options."));return}let r=W(e||{},t);G=new F(r)}function S(){if(!G){if(me)return;T.warn(_("Telemetry has not been initialized")),me=!0;return}return G}function Tt(){G=void 0,me=!1}function wt(){var e;return((e=S())==null?void 0:e.inspectors())||[]}function St(e){var t;(t=S())==null||t.captureError(e)}function Ot(e){var t;(t=S())==null||t.captureErrorEvent(e)}function Ft(e){var t;(t=S())==null||t.addBreadcrumb(e)}function Bt(e){var t;(t=S())==null||t.register(e)}function Rt(){var e;(e=S())==null||e.close()}function Ct(e){let t=W(e||{},C(e==null?void 0:e.logger));return new F(t)}0&&(module.exports={addBreadcrumb,captureError,captureErrorEvent,close,getTelemetryInstance,initTelemetry,initTelemetryInstance,inspectors,register,resetTelemetryInstance});
|
|
11
11
|
/**
|
|
12
12
|
* https://github.com/csnover/TraceKit
|
|
13
13
|
* @license MIT
|