@launchdarkly/browser-telemetry 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -466,6 +466,79 @@ interface StackOptions {
466
466
  maxLineLength?: number;
467
467
  };
468
468
  }
469
+ interface BreadcrumbsOptions {
470
+ /**
471
+ * Set the maximum number of breadcrumbs. Defaults to 50.
472
+ */
473
+ maxBreadcrumbs?: number;
474
+ /**
475
+ * True to enable automatic evaluation breadcrumbs. Defaults to true.
476
+ */
477
+ evaluations?: boolean;
478
+ /**
479
+ * True to enable flag change breadcrumbs. Defaults to true.
480
+ */
481
+ flagChange?: boolean;
482
+ /**
483
+ * True to enable click breadcrumbs. Defaults to true.
484
+ */
485
+ click?: boolean;
486
+ /**
487
+ * True to enable input breadcrumbs for keypresses. Defaults to true.
488
+ *
489
+ * Input breadcrumbs do not include entered text, just that text was entered.
490
+ */
491
+ keyboardInput?: boolean;
492
+ /**
493
+ * Controls instrumentation and breadcrumbs for HTTP requests.
494
+ * The default is to instrument XMLHttpRequests and fetch requests.
495
+ *
496
+ * `false` to disable all HTTP breadcrumbs and instrumentation.
497
+ *
498
+ * Example:
499
+ * ```
500
+ * // This would instrument only XmlHttpRequests
501
+ * http: {
502
+ * instrumentFetch: false
503
+ * instrumentXhr: true
504
+ * }
505
+ *
506
+ * // Disable all HTTP instrumentation:
507
+ * http: false
508
+ * ```
509
+ */
510
+ http?: HttpBreadcrumbOptions | false;
511
+ /**
512
+ * Custom breadcrumb filters.
513
+ *
514
+ * Can be used to redact or modify breadcrumbs.
515
+ *
516
+ * Example:
517
+ * ```
518
+ * // We want to redact any click events that include the message 'sneaky-button'
519
+ * filters: [
520
+ * (breadcrumb) => {
521
+ * if(
522
+ * breadcrumb.class === 'ui' &&
523
+ * breadcrumb.type === 'click' &&
524
+ * breadcrumb.message?.includes('sneaky-button')
525
+ * ) {
526
+ * return;
527
+ * }
528
+ * return breadcrumb;
529
+ * }
530
+ * ]
531
+ * ```
532
+ *
533
+ * If you want to redact or modify URLs in breadcrumbs, then a urlFilter should be used.
534
+ *
535
+ * If any breadcrumb filters throw an exception while processing a breadcrumb, then that breadcrumb will be excluded.
536
+ *
537
+ * If any breadcrumbFilter cannot be executed, for example because it is not a function, then all breadcrumbs will
538
+ * be excluded.
539
+ */
540
+ filters?: BreadcrumbFilter[];
541
+ }
469
542
  /**
470
543
  * Options for configuring browser telemetry.
471
544
  */
@@ -477,89 +550,17 @@ interface Options {
477
550
  */
478
551
  maxPendingEvents?: number;
479
552
  /**
480
- * Properties related to automatic breadcrumb collection.
553
+ * Properties related to automatic breadcrumb collection, or `false` to disable automatic breadcrumbs.
481
554
  */
482
- breadcrumbs?: {
483
- /**
484
- * Set the maximum number of breadcrumbs. Defaults to 50.
485
- */
486
- maxBreadcrumbs?: number;
487
- /**
488
- * True to enable automatic evaluation breadcrumbs. Defaults to true.
489
- */
490
- evaluations?: boolean;
491
- /**
492
- * True to enable flag change breadcrumbs. Defaults to true.
493
- */
494
- flagChange?: boolean;
495
- /**
496
- * True to enable click breadcrumbs. Defaults to true.
497
- */
498
- click?: boolean;
499
- /**
500
- * True to enable input breadcrumbs for keypresses. Defaults to true.
501
- *
502
- * Input breadcrumbs do not include entered text, just that text was entered.
503
- */
504
- keyboardInput?: boolean;
505
- /**
506
- * Controls instrumentation and breadcrumbs for HTTP requests.
507
- * The default is to instrument XMLHttpRequests and fetch requests.
508
- *
509
- * `false` to disable all HTTP breadcrumbs and instrumentation.
510
- *
511
- * Example:
512
- * ```
513
- * // This would instrument only XmlHttpRequests
514
- * http: {
515
- * instrumentFetch: false
516
- * instrumentXhr: true
517
- * }
518
- *
519
- * // Disable all HTTP instrumentation:
520
- * http: false
521
- * ```
522
- */
523
- http?: HttpBreadcrumbOptions | false;
524
- /**
525
- * Custom breadcrumb filters.
526
- *
527
- * Can be used to redact or modify breadcrumbs.
528
- *
529
- * Example:
530
- * ```
531
- * // We want to redact any click events that include the message 'sneaky-button'
532
- * filters: [
533
- * (breadcrumb) => {
534
- * if(
535
- * breadcrumb.class === 'ui' &&
536
- * breadcrumb.type === 'click' &&
537
- * breadcrumb.message?.includes('sneaky-button')
538
- * ) {
539
- * return;
540
- * }
541
- * return breadcrumb;
542
- * }
543
- * ]
544
- * ```
545
- *
546
- * If you want to redact or modify URLs in breadcrumbs, then a urlFilter should be used.
547
- *
548
- * If any breadcrumb filters throw an exception while processing a breadcrumb, then that breadcrumb will be excluded.
549
- *
550
- * If any breadcrumbFilter cannot be executed, for example because it is not a function, then all breadcrumbs will
551
- * be excluded.
552
- */
553
- filters?: BreadcrumbFilter[];
554
- };
555
+ breadcrumbs?: BreadcrumbsOptions | false;
555
556
  /**
556
557
  * Additional, or custom, collectors.
557
558
  */
558
559
  collectors?: Collector[];
559
560
  /**
560
- * Configuration that controls the capture of the stack trace.
561
+ * Configuration that controls the capture of the stack trace, or `false` to exclude stack frames from error events.
561
562
  */
562
- stack?: StackOptions;
563
+ stack?: StackOptions | false;
563
564
  /**
564
565
  * Logger to use for warnings.
565
566
  *
@@ -743,4 +744,4 @@ declare function close(): void;
743
744
  */
744
745
  declare function initTelemetryInstance(options?: Options): BrowserTelemetry;
745
746
 
746
- export { type Breadcrumb, type BreadcrumbClass, type BreadcrumbData, type BreadcrumbDataValue, type BreadcrumbFilter, type BreadcrumbLevel, type BrowserTelemetry, type BrowserTelemetryInspector, type Collector, type CustomBreadcrumb, type ErrorData, type ErrorDataFilter, type FeatureManagementBreadcrumb, type HttpBreadcrumb, type HttpBreadcrumbOptions, type ImplementsCrumb, type LDClientInitialization, type LDClientLogging, type LDClientTracking, type LogBreadcrumb, type MinLogger, type NavigationBreadcrumb, type Options, type Recorder, type StackFrame, type StackOptions, type StackTrace, type UiBreadcrumb, type UrlFilter, addBreadcrumb, captureError, captureErrorEvent, close, getTelemetryInstance, initTelemetry, initTelemetryInstance, inspectors, register };
747
+ export { type Breadcrumb, type BreadcrumbClass, type BreadcrumbData, type BreadcrumbDataValue, type BreadcrumbFilter, type BreadcrumbLevel, type BreadcrumbsOptions, type BrowserTelemetry, type BrowserTelemetryInspector, type Collector, type CustomBreadcrumb, type ErrorData, type ErrorDataFilter, type FeatureManagementBreadcrumb, type HttpBreadcrumb, type HttpBreadcrumbOptions, type ImplementsCrumb, type LDClientInitialization, type LDClientLogging, type LDClientTracking, type LogBreadcrumb, type MinLogger, type NavigationBreadcrumb, type Options, type Recorder, type StackFrame, type StackOptions, type StackTrace, type UiBreadcrumb, type UrlFilter, addBreadcrumb, captureError, captureErrorEvent, close, getTelemetryInstance, initTelemetry, initTelemetryInstance, inspectors, register };
package/dist/index.d.ts CHANGED
@@ -466,6 +466,79 @@ interface StackOptions {
466
466
  maxLineLength?: number;
467
467
  };
468
468
  }
469
+ interface BreadcrumbsOptions {
470
+ /**
471
+ * Set the maximum number of breadcrumbs. Defaults to 50.
472
+ */
473
+ maxBreadcrumbs?: number;
474
+ /**
475
+ * True to enable automatic evaluation breadcrumbs. Defaults to true.
476
+ */
477
+ evaluations?: boolean;
478
+ /**
479
+ * True to enable flag change breadcrumbs. Defaults to true.
480
+ */
481
+ flagChange?: boolean;
482
+ /**
483
+ * True to enable click breadcrumbs. Defaults to true.
484
+ */
485
+ click?: boolean;
486
+ /**
487
+ * True to enable input breadcrumbs for keypresses. Defaults to true.
488
+ *
489
+ * Input breadcrumbs do not include entered text, just that text was entered.
490
+ */
491
+ keyboardInput?: boolean;
492
+ /**
493
+ * Controls instrumentation and breadcrumbs for HTTP requests.
494
+ * The default is to instrument XMLHttpRequests and fetch requests.
495
+ *
496
+ * `false` to disable all HTTP breadcrumbs and instrumentation.
497
+ *
498
+ * Example:
499
+ * ```
500
+ * // This would instrument only XmlHttpRequests
501
+ * http: {
502
+ * instrumentFetch: false
503
+ * instrumentXhr: true
504
+ * }
505
+ *
506
+ * // Disable all HTTP instrumentation:
507
+ * http: false
508
+ * ```
509
+ */
510
+ http?: HttpBreadcrumbOptions | false;
511
+ /**
512
+ * Custom breadcrumb filters.
513
+ *
514
+ * Can be used to redact or modify breadcrumbs.
515
+ *
516
+ * Example:
517
+ * ```
518
+ * // We want to redact any click events that include the message 'sneaky-button'
519
+ * filters: [
520
+ * (breadcrumb) => {
521
+ * if(
522
+ * breadcrumb.class === 'ui' &&
523
+ * breadcrumb.type === 'click' &&
524
+ * breadcrumb.message?.includes('sneaky-button')
525
+ * ) {
526
+ * return;
527
+ * }
528
+ * return breadcrumb;
529
+ * }
530
+ * ]
531
+ * ```
532
+ *
533
+ * If you want to redact or modify URLs in breadcrumbs, then a urlFilter should be used.
534
+ *
535
+ * If any breadcrumb filters throw an exception while processing a breadcrumb, then that breadcrumb will be excluded.
536
+ *
537
+ * If any breadcrumbFilter cannot be executed, for example because it is not a function, then all breadcrumbs will
538
+ * be excluded.
539
+ */
540
+ filters?: BreadcrumbFilter[];
541
+ }
469
542
  /**
470
543
  * Options for configuring browser telemetry.
471
544
  */
@@ -477,89 +550,17 @@ interface Options {
477
550
  */
478
551
  maxPendingEvents?: number;
479
552
  /**
480
- * Properties related to automatic breadcrumb collection.
553
+ * Properties related to automatic breadcrumb collection, or `false` to disable automatic breadcrumbs.
481
554
  */
482
- breadcrumbs?: {
483
- /**
484
- * Set the maximum number of breadcrumbs. Defaults to 50.
485
- */
486
- maxBreadcrumbs?: number;
487
- /**
488
- * True to enable automatic evaluation breadcrumbs. Defaults to true.
489
- */
490
- evaluations?: boolean;
491
- /**
492
- * True to enable flag change breadcrumbs. Defaults to true.
493
- */
494
- flagChange?: boolean;
495
- /**
496
- * True to enable click breadcrumbs. Defaults to true.
497
- */
498
- click?: boolean;
499
- /**
500
- * True to enable input breadcrumbs for keypresses. Defaults to true.
501
- *
502
- * Input breadcrumbs do not include entered text, just that text was entered.
503
- */
504
- keyboardInput?: boolean;
505
- /**
506
- * Controls instrumentation and breadcrumbs for HTTP requests.
507
- * The default is to instrument XMLHttpRequests and fetch requests.
508
- *
509
- * `false` to disable all HTTP breadcrumbs and instrumentation.
510
- *
511
- * Example:
512
- * ```
513
- * // This would instrument only XmlHttpRequests
514
- * http: {
515
- * instrumentFetch: false
516
- * instrumentXhr: true
517
- * }
518
- *
519
- * // Disable all HTTP instrumentation:
520
- * http: false
521
- * ```
522
- */
523
- http?: HttpBreadcrumbOptions | false;
524
- /**
525
- * Custom breadcrumb filters.
526
- *
527
- * Can be used to redact or modify breadcrumbs.
528
- *
529
- * Example:
530
- * ```
531
- * // We want to redact any click events that include the message 'sneaky-button'
532
- * filters: [
533
- * (breadcrumb) => {
534
- * if(
535
- * breadcrumb.class === 'ui' &&
536
- * breadcrumb.type === 'click' &&
537
- * breadcrumb.message?.includes('sneaky-button')
538
- * ) {
539
- * return;
540
- * }
541
- * return breadcrumb;
542
- * }
543
- * ]
544
- * ```
545
- *
546
- * If you want to redact or modify URLs in breadcrumbs, then a urlFilter should be used.
547
- *
548
- * If any breadcrumb filters throw an exception while processing a breadcrumb, then that breadcrumb will be excluded.
549
- *
550
- * If any breadcrumbFilter cannot be executed, for example because it is not a function, then all breadcrumbs will
551
- * be excluded.
552
- */
553
- filters?: BreadcrumbFilter[];
554
- };
555
+ breadcrumbs?: BreadcrumbsOptions | false;
555
556
  /**
556
557
  * Additional, or custom, collectors.
557
558
  */
558
559
  collectors?: Collector[];
559
560
  /**
560
- * Configuration that controls the capture of the stack trace.
561
+ * Configuration that controls the capture of the stack trace, or `false` to exclude stack frames from error events.
561
562
  */
562
- stack?: StackOptions;
563
+ stack?: StackOptions | false;
563
564
  /**
564
565
  * Logger to use for warnings.
565
566
  *
@@ -743,4 +744,4 @@ declare function close(): void;
743
744
  */
744
745
  declare function initTelemetryInstance(options?: Options): BrowserTelemetry;
745
746
 
746
- export { type Breadcrumb, type BreadcrumbClass, type BreadcrumbData, type BreadcrumbDataValue, type BreadcrumbFilter, type BreadcrumbLevel, type BrowserTelemetry, type BrowserTelemetryInspector, type Collector, type CustomBreadcrumb, type ErrorData, type ErrorDataFilter, type FeatureManagementBreadcrumb, type HttpBreadcrumb, type HttpBreadcrumbOptions, type ImplementsCrumb, type LDClientInitialization, type LDClientLogging, type LDClientTracking, type LogBreadcrumb, type MinLogger, type NavigationBreadcrumb, type Options, type Recorder, type StackFrame, type StackOptions, type StackTrace, type UiBreadcrumb, type UrlFilter, addBreadcrumb, captureError, captureErrorEvent, close, getTelemetryInstance, initTelemetry, initTelemetryInstance, inspectors, register };
747
+ export { type Breadcrumb, type BreadcrumbClass, type BreadcrumbData, type BreadcrumbDataValue, type BreadcrumbFilter, type BreadcrumbLevel, type BreadcrumbsOptions, type BrowserTelemetry, type BrowserTelemetryInspector, type Collector, type CustomBreadcrumb, type ErrorData, type ErrorDataFilter, type FeatureManagementBreadcrumb, type HttpBreadcrumb, type HttpBreadcrumbOptions, type ImplementsCrumb, type LDClientInitialization, type LDClientLogging, type LDClientTracking, type LogBreadcrumb, type MinLogger, type NavigationBreadcrumb, type Options, type Recorder, type StackFrame, type StackOptions, type StackTrace, type UiBreadcrumb, type UrlFilter, addBreadcrumb, captureError, captureErrorEvent, close, getTelemetryInstance, initTelemetry, initTelemetryInstance, inspectors, register };
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- function $(e){try{return e.target}catch(t){return}}var Oe=">",Ce=` ${Oe} `;function Be(e){let t=e;return typeof t=="object"&&t!=null&&t.parentNode}function De(e){if(typeof e.className!="string")return;let t=e.className;if(e.className.includes(" ")&&(t=e.className.replace(" ",".")),t!=="")return`.${t}`}function Ie(e){if(!e.tagName)return"";let t=[];t.push(e.tagName.toLowerCase()),e.id&&t.push(`#${e.id}`);let r=De(e);return r&&t.push(r),t.join("")}function H(e,t={maxDepth:10}){let r=[],n=e;for(;Be(n)&&n.parentNode&&r.length<t.maxDepth;){let i=Ie(n);if(i==="html")break;r.push(i),n=n.parentNode}return r.reverse().join(Ce)}var A=class{constructor(){window.addEventListener("click",t=>{var n;let r=$(t);if(r){let i={class:"ui",type:"click",level:"info",timestamp:Date.now(),message:H(r)};(n=this._destination)==null||n.addBreadcrumb(i)}},!0)}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var Me=1e3,Ne=["INPUT","TEXTAREA"],X=class{constructor(){window.addEventListener("keypress",t=>{var i;let r=$(t),n=r;if(r&&(Ne.includes(r.tagName)||n!=null&&n.isContentEditable)){let m={class:"ui",type:"input",level:"info",timestamp:Date.now(),message:H(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)<=Me&&this._lastEvent.message===t.message:!1}};var j=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 re(e,t){return t?e.reduce((r,n)=>n(r),t):""}function q(e,t){var r;(r=e.data)!=null&&r.url&&(e.data.url=re(t.urlFilters,e.data.url))}var Pe="__LaunchDarkly_original_fetch",K=window.fetch;function Ue(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 ne(e){function t(...r){let n=Date.now();return K.apply(this,r).then(i=>{let m={class:"http",timestamp:n,level:i.ok?"info":"error",type:"fetch",data:{...Ue(r[0],r[1]),statusCode:i.status,statusText:i.statusText}};return e(m),i})}t.prototype=K==null?void 0:K.prototype;try{Object.defineProperty(t,Pe,{value:K,writable:!0,configurable:!0})}catch(r){}window.fetch=t}var W=class{constructor(t){ne(r=>{var n;q(r,t),(n=this._destination)==null||n.addBreadcrumb(r)})}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var ye="__LaunchDarkly_original_xhr",$e=`${ye}_open`,He=`${ye}_send`,Q="__LaunchDarkly_data_xhr",be=window.XMLHttpRequest.prototype.open,xe=window.XMLHttpRequest.prototype.send;function ie(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),be.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){xe.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,{[$e]:{value:be,writable:!0,configurable:!0},[He]:{value:xe,writable:!0,configurable:!0}})}catch(n){}}var G=class{constructor(t){ie(r=>{var n;q(r,t),(n=this._destination)==null||n.addBreadcrumb(r)})}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var Ae=/sdk\/evalx\/[^/]+\/contexts\/(?<context>[^/?]*)\??.*?/,Xe=/\/eval\/[^/]+\/(?<context>[^/?]*)\??.*?/;function je(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 qe(e){var t,r;if(e.includes("/sdk/evalx")){let n=e.match(Ae),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(Xe),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 se(e){return qe(je(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 S={warn:console.warn},Ke="LaunchDarkly - Browser Telemetry:";function k(e){return`${Ke} ${e}`}function M(e){return{warn:(...t)=>{if(!e){S.warn(...t);return}try{e.warn(...t)}catch(r){S.warn(...t),S.warn(k("The provided logger threw an exception, using fallback logger."))}}}}var We={start:0,end:3},Ge={start:4,end:5},ae={start:6,end:7},ce={start:8,end:8},ze={start:9,end:9},Ve={start:10,end:15};function Ye(){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 N(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 Ze(e){return e[ce.start]=(e[ce.start]|128)&191,e[ae.start]=e[ae.start]&15|64,`${N(e,We)}-${N(e,Ge)}-${N(e,ae)}-${N(e,ce)}${N(e,ze)}-${N(e,Ve)}`}function Je(){let e=Ye();return Ze(e)}function ue(){return typeof crypto!==void 0&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Je()}var v={};(function(e,t){if(!e)return;let r=[].slice,n="?",i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function m(T,O){return Object.prototype.hasOwnProperty.call(T,O)}function x(T){return typeof T=="undefined"}v.wrap=function(O){function R(){try{return O.apply(this,arguments)}catch(L){throw v.report(L),L}}return R},v.computeStackTrace=function(){let R={};function L(o){if(!v.remoteFetching)return"";try{let l=function(){try{return new e.XMLHttpRequest}catch(d){return new e.ActiveXObject("Microsoft.XMLHTTP")}}();return l.open("GET",o,!1),l.send(""),l.responseText}catch(c){return""}}function D(o){if(typeof o!="string")return[];if(!m(R,o)){let c="",l="";try{l=e.document.domain}catch(u){}let d=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(o);d&&d[2]===l&&(c=L(o)),R[o]=c?c.split(`
2
- `):[]}return R[o]}function I(o,c){typeof c!="number"&&(c=Number(c));let l=/function ([^(]*)\(([^)]*)\)/,d=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,u="",b=10,g=D(o),f;if(!g.length)return n;for(let a=0;a<b;++a)if(u=g[c-a]+u,!x(u)&&((f=d.exec(u))||(f=l.exec(u))))return f[1];return n}function U(o,c){typeof c!="number"&&(c=Number(c));let l=D(o);if(!l.length)return null;let d=[],u=Math.floor(v.linesOfContext/2),b=u+v.linesOfContext%2,g=Math.max(0,c-u-1),f=Math.min(l.length,c+b-1);c-=1;for(let a=g;a<f;++a)x(l[a])||d.push(l[a]);return d.length>0?d:null}function Y(o){return o.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function fe(o){return Y(o).replace("<","(?:<|&lt;)").replace(">","(?:>|&gt;)").replace("&","(?:&|&amp;)").replace('"','(?:"|&quot;)').replace(/\s+/g,"\\s+")}function Z(o,c){let l,d;for(let u=0,b=c.length;u<b;++u)if((l=D(c[u])).length&&(l=l.join(`
3
- `),d=o.exec(l)))return{url:c[u],line:l.substring(0,d.index).split(`
4
- `).length,column:d.index-l.lastIndexOf(`
5
- `,d.index)-1};return null}function te(o,c,l){typeof l!="number"&&(l=Number(l));let d=D(c),u=new RegExp(`\\b${Y(o)}\\b`),b;return l-=1,d&&d.length>l&&(b=u.exec(d[l]))?b.index:null}function we(o){if(x(e&&e.document))return;let c=[e.location.href],l=e.document.getElementsByTagName("script"),d,u=`${o}`,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,a,h;for(let s=0;s<l.length;++s){let p=l[s];p.src&&c.push(p.src)}if(!(a=b.exec(u)))f=new RegExp(Y(u).replace(/\s+/g,"\\s+"));else{let s=a[1]?`\\s+${a[1]}`:"",p=a[2].split(",").join("\\s*,\\s*");d=Y(a[3]).replace(/;$/,";?"),f=new RegExp(`function${s}\\s*\\(\\s*${p}\\s*\\)\\s*{\\s*${d}\\s*}`)}if(h=Z(f,c))return h;if(a=g.exec(u)){let s=a[1];if(d=fe(a[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 de(o){if(!o.stack)return null;let c=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,l=/^\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,u,b=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,g=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=o.stack.split(`
6
- `),a=[],h,s,p,w=/^(.*) is undefined$/.exec(o.message);for(let y=0,J=f.length;y<J;++y){if(s=c.exec(f[y])){let he=s[2]&&s[2].indexOf("native")===0;u=s[2]&&s[2].indexOf("eval")===0,u&&(h=g.exec(s[2]))&&(s[2]=h[1],s[3]=h[2],s[4]=h[3]),p={url:he?null:s[2],func:s[1]||n,args:he?[s[2]]:[],line:s[3]?+s[3]:null,column:s[4]?+s[4]:null}}else if(s=d.exec(f[y]))p={url:s[2],func:s[1]||n,args:[],line:+s[3],column:s[4]?+s[4]:null};else if(s=l.exec(f[y]))u=s[3]&&s[3].indexOf(" > eval")>-1,u&&(h=b.exec(s[3]))?(s[3]=h[1],s[4]=h[2],s[5]=null):y===0&&!s[5]&&!x(o.columnNumber)&&(a[0].column=o.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=I(p.url,p.line)),p.context=p.line?U(p.url,p.line):null,a.push(p)}return a.length?(a[0]&&a[0].line&&!a[0].column&&w&&(a[0].column=te(w[1],a[0].url,a[0].line)),{mode:"stack",name:o.name,message:o.message,stack:a}):null}function Se(o){let{stacktrace:c}=o;if(!c)return null;let l=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,d=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,u=c.split(`
7
- `),b=[],g;for(let f=0;f<u.length;f+=2){let a=null;if((g=l.exec(u[f]))?a={url:g[2],line:+g[1],column:null,func:g[3],args:[]}:(g=d.exec(u[f]))&&(a={url:g[6],line:+g[1],column:+g[2],func:g[3]||g[4],args:g[5]?g[5].split(","):[]}),a){if(!a.func&&a.line&&(a.func=I(a.url,a.line)),a.line)try{a.context=U(a.url,a.line)}catch(h){}a.context||(a.context=[u[f+1]]),b.push(a)}}return b.length?{mode:"stacktrace",name:o.name,message:o.message,stack:b}:null}function Fe(o){let c=o.message.split(`
8
- `);if(c.length<4)return null;let l=/^\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,u=/^\s*Line (\d+) of function script\s*$/i,b=[],g=e&&e.document&&e.document.getElementsByTagName("script"),f=[],a;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(a=l.exec(c[h]))s={url:a[2],func:a[3],args:[],line:+a[1],column:null};else if(a=d.exec(c[h])){s={url:a[3],func:a[4],args:[],line:+a[1],column:null};let p=+a[1],w=f[a[2]-1];if(w){let y=D(s.url);if(y){y=y.join(`
9
- `);let J=y.indexOf(w.innerText);J>=0&&(s.line=p+y.substring(0,J).split(`
10
- `).length)}}}else if(a=u.exec(c[h])){let p=e.location.href.replace(/#.*$/,""),w=new RegExp(fe(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 pe(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 ge(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=ge.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=we(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 pe(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=Se(o),l)return l}catch(d){}try{if(l=de(o),l)return l}catch(d){}try{if(l=Fe(o),l)return l}catch(d){}try{if(l=ge(o,c+1),l)return l}catch(d){}return{name:o.name,message:o.message,mode:"failed",stack:[]}}function Re(o){o=(o==null?0:+o)+1;try{throw new Error}catch(c){return F(c,o+1)}}return F.augmentStackTraceWithInitialElement=pe,F.computeStackTraceFromStackProp=de,F.guessFunctionName=I,F.gatherContext=U,F.ofCaller=Re,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 ve="(index)";function Qe(e,t){let r=e;if(e.startsWith(t)){if(r=e.slice(t.length),r.startsWith("/")&&(r=r.slice(1)),r==="")return ve;r.endsWith("/")&&(r+=ve)}return r}function Ee(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 Le(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 et(e,t){let{context:r}=e;if(!r)return{};let{maxLineLength:n}=t.source,i=Math.floor(n/2),m=T=>Ee({maxLength:t.source.maxLineLength,beforeColumnCharacters:i},T,0),x=Math.floor(r.length/2);return{srcBefore:Le(x-t.source.beforeLines,x,r,m),srcLine:Ee({maxLength:n,beforeColumnCharacters:i},r[x],e.column||0),srcAfter:Le(x+1,x+1+t.source.afterLines,r,m)}}function le(e,t){return{frames:ee().computeStackTrace(e).stack.reverse().map(i=>({fileName:Qe(i.url,window.location.origin),function:i.func,line:i.line,col:i.column,...et(i,t)}))}}var Te="$ld:telemetry",tt=`${Te}:error`,rt=`${Te}:session:init`,_e="generic",nt="exception was null or undefined",it="exception had no message",st=5;function ke(e){switch(typeof e){case"string":case"boolean":case"number":return e;default:return}}function ot(e,t){return e===void 0?void 0:t(e)}function at(e){let t=ee(),r=Math.max(e.source.afterLines,e.source.beforeLines),n=t;n.linesOfContext=r*2+1}function ct(e){return e.logger!==void 0}function ut(e){return e.waitForInitialization!==void 0}var C=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;at(t.stack),this._collectors.push(new j),this._collectors.push(...t.collectors),this._maxPendingEvents=t.maxPendingEvents,this._maxBreadcrumbs=t.breadcrumbs.maxBreadcrumbs;let r=[se];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=[];oe(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(rt,{sessionId:this._sessionId}),this._pendingEvents.forEach(i=>{var m;(m=this._client)==null||m.track(i.type,i.data)}),this._pendingEvents=[],this._registrationComplete=!0};ut(t)?(async()=>{try{await t.waitForInitialization(st)}catch(n){}r()})():r()}_setLogger(){this._options.logger?this._logger=this._options.logger:ct(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)||_e,message:(m=t.message)!=null?m:it,stack:le(t,this._options.stack),breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId}:{type:_e,message:nt,stack:{frames:[]},breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId};this._capture(tt,n)}captureErrorEvent(t){this.captureError(t.error)}_applyFilters(t,r,n){try{return r.reduce((i,m)=>ot(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:ke(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:ke(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(n)}};function lt(){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 mt(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 ft(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 dt(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,O,R;let r=lt();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:mt((O=e.breadcrumbs)==null?void 0:O.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:dt(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:ft(e),errorFilters:E(e.errorFilters,r.errorFilters,L=>Array.isArray(L)?!0:(t==null||t.warn(P("errorFilters","ErrorDataFilter[]",typeof L)),!1))}}var V,me=!1;function yr(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 C(r)}function B(){if(!V){if(me)return;S.warn(k("Telemetry has not been initialized")),me=!0;return}return V}function vr(){V=void 0,me=!1}function _r(){var e;return((e=B())==null?void 0:e.inspectors())||[]}function kr(e){var t;(t=B())==null||t.captureError(e)}function Tr(e){var t;(t=B())==null||t.captureErrorEvent(e)}function wr(e){var t;(t=B())==null||t.addBreadcrumb(e)}function Sr(e){var t;(t=B())==null||t.register(e)}function Fr(){var e;(e=B())==null||e.close()}function Nr(e){let t=z(e||{},M(e==null?void 0:e.logger));return new C(t)}export{wr as addBreadcrumb,kr as captureError,Tr as captureErrorEvent,Fr as close,B as getTelemetryInstance,yr as initTelemetry,Nr as initTelemetryInstance,_r as inspectors,Sr as register,vr as resetTelemetryInstance};
1
+ function N(e){try{return e.target}catch(t){return}}var Be=">",Re=` ${Be} `;function Ce(e){let t=e;return typeof t=="object"&&t!=null&&t.parentNode}function Ie(e){if(typeof e.className!="string")return;let t=e.className;if(e.className.includes(" ")&&(t=e.className.replace(" ",".")),t!=="")return`.${t}`}function De(e){if(!e.tagName)return"";let t=[];t.push(e.tagName.toLowerCase()),e.id&&t.push(`#${e.id}`);let r=Ie(e);return r&&t.push(r),t.join("")}function U(e,t={maxDepth:10}){let r=[],n=e;for(;Ce(n)&&n.parentNode&&r.length<t.maxDepth;){let i=De(n);if(i==="html")break;r.push(i),n=n.parentNode}return r.reverse().join(Re)}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 Me=1e3,Pe=["INPUT","TEXTAREA"],H=class{constructor(){window.addEventListener("keypress",t=>{var i;let r=N(t),n=r;if(r&&(Pe.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)<=Me&&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 re(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=re(t.urlFilters,e.data.url))}var Ne="__LaunchDarkly_original_fetch",j=window.fetch;function Ue(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 ne(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:{...Ue(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,Ne,{value:j,writable:!0,configurable:!0})}catch(r){}window.fetch=t}var q=class{constructor(t){ne(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 ye="__LaunchDarkly_original_xhr",$e=`${ye}_open`,He=`${ye}_send`,Q="__LaunchDarkly_data_xhr",be=window.XMLHttpRequest.prototype.open,xe=window.XMLHttpRequest.prototype.send;function ie(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),be.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){xe.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,{[$e]:{value:be,writable:!0,configurable:!0},[He]:{value:xe,writable:!0,configurable:!0}})}catch(n){}}var K=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 Ae=/sdk\/evalx\/[^/]+\/contexts\/(?<context>[^/?]*)\??.*?/,Xe=/\/eval\/[^/]+\/(?<context>[^/?]*)\??.*?/;function je(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 qe(e){var t,r;if(e.includes("/sdk/evalx")){let n=e.match(Ae),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(Xe),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 se(e){return qe(je(e))}function ae(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},Ke="LaunchDarkly - Browser Telemetry:";function _(e){return`${Ke} ${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 We={start:0,end:3},Ge={start:4,end:5},oe={start:6,end:7},ce={start:8,end:8},ze={start:9,end:9},Ve={start:10,end:15};function Ye(){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 Ze(e){return e[ce.start]=(e[ce.start]|128)&191,e[oe.start]=e[oe.start]&15|64,`${I(e,We)}-${I(e,Ge)}-${I(e,oe)}-${I(e,ce)}${I(e,ze)}-${I(e,Ve)}`}function Je(){let e=Ye();return Ze(e)}function le(){return typeof crypto!==void 0&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Je()}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(S,z){return Object.prototype.hasOwnProperty.call(S,z)}function L(S){return typeof S=="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 me(a){return Y(a).replace("<","(?:<|&lt;)").replace(">","(?:>|&gt;)").replace("&","(?:&|&amp;)").replace('"','(?:"|&quot;)').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 we(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=me(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 de(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 he=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:he?null:s[2],func:s[1]||n,args:he?[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 Se(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 Oe(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(me(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 pe(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 ge(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=ge.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=we(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 pe(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=Se(a),u)return u}catch(d){}try{if(u=de(a),u)return u}catch(d){}try{if(u=Oe(a),u)return u}catch(d){}try{if(u=ge(a,c+1),u)return u}catch(d){}return{name:a.name,message:a.message,mode:"failed",stack:[]}}function Fe(a){a=(a==null?0:+a)+1;try{throw new Error}catch(c){return w(c,a+1)}}return w.augmentStackTraceWithInitialElement=pe,w.computeStackTraceFromStackProp=de,w.guessFunctionName=R,w.gatherContext=P,w.ofCaller=Fe,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 ve="(index)";function Qe(e,t){let r=e;if(e.startsWith(t)){if(r=e.slice(t.length),r.startsWith("/")&&(r=r.slice(1)),r==="")return ve;r.endsWith("/")&&(r+=ve)}return r}function Ee(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 Le(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 et(e,t){let{context:r}=e;if(!r)return{};let{maxLineLength:n}=t.source,i=Math.floor(n/2),m=S=>Ee({maxLength:t.source.maxLineLength,beforeColumnCharacters:i},S,0),L=Math.floor(r.length/2);return{srcBefore:Le(L-t.source.beforeLines,L,r,m),srcLine:Ee({maxLength:n,beforeColumnCharacters:i},r[L],e.column||0),srcAfter:Le(L+1,L+1+t.source.afterLines,r,m)}}function ue(e,t){return t.enabled?{frames:ee().computeStackTrace(e).stack.reverse().map(i=>({fileName:Qe(i.url,window.location.origin),function:i.func,line:i.line,col:i.column,...et(i,t)}))}:{frames:[]}}var Te="$ld:telemetry",tt=`${Te}:error`,rt=`${Te}:session:init`,_e="generic",nt="exception was null or undefined",it="exception had no message",st=5;function ke(e){switch(typeof e){case"string":case"boolean":case"number":return e;default:return}}function at(e,t){return e===void 0?void 0:t(e)}function ot(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 ct(e){return e.logger!==void 0}function lt(e){return e.waitForInitialization!==void 0}var O=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;ot(t.stack),this._collectors.push(new A),this._collectors.push(...t.collectors),this._maxPendingEvents=t.maxPendingEvents,this._maxBreadcrumbs=t.breadcrumbs.maxBreadcrumbs;let r=[se];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=[];ae(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(rt,{sessionId:this._sessionId}),this._pendingEvents.forEach(i=>{var m;(m=this._client)==null||m.track(i.type,i.data)}),this._pendingEvents=[],this._registrationComplete=!0};lt(t)?(async()=>{try{await t.waitForInitialization(st)}catch(n){}r()})():r()}_setLogger(){this._options.logger?this._logger=this._options.logger:ct(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)||_e,message:(m=t.message)!=null?m:it,stack:ue(t,this._options.stack),breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId}:{type:_e,message:nt,stack:{frames:[]},breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId};this._capture(tt,n)}captureErrorEvent(t){this.captureError(t.error)}_applyFilters(t,r,n){try{return r.reduce((i,m)=>at(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:ke(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:ke(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(n)}};var ut={maxBreadcrumbs:0,evaluations:!1,flagChange:!1,click:!1,keyboardInput:!1,http:{instrumentFetch:!1,instrumentXhr:!1,customUrlFilter:void 0},filters:[]},ft={enabled:!1,source:{beforeLines:0,afterLines:0,maxLineLength:0}};function mt(){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 dt(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 pt(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 gt(e,t,r){var n,i,m;return e===!1?ft:{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 ht(e,t,r){return e===!1?ut:{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:dt(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=mt();return e.breadcrumbs&&E("object","breadcrumbs",t)(e.breadcrumbs),e.stack&&E("object","stack",t)(e.stack),{breadcrumbs:ht(e.breadcrumbs,r.breadcrumbs,t),stack:gt(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:pt(e),errorFilters:v(e.errorFilters,r.errorFilters,n=>Array.isArray(n)?!0:(t==null||t.warn(D("errorFilters","ErrorDataFilter[]",typeof n)),!1))}}var G,fe=!1;function Lr(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 O(r)}function F(){if(!G){if(fe)return;T.warn(_("Telemetry has not been initialized")),fe=!0;return}return G}function _r(){G=void 0,fe=!1}function wr(){var e;return((e=F())==null?void 0:e.inspectors())||[]}function Sr(e){var t;(t=F())==null||t.captureError(e)}function Or(e){var t;(t=F())==null||t.captureErrorEvent(e)}function Fr(e){var t;(t=F())==null||t.addBreadcrumb(e)}function Br(e){var t;(t=F())==null||t.register(e)}function Rr(){var e;(e=F())==null||e.close()}function $r(e){let t=W(e||{},C(e==null?void 0:e.logger));return new O(t)}export{Fr as addBreadcrumb,Sr as captureError,Or as captureErrorEvent,Rr as close,F as getTelemetryInstance,Lr as initTelemetry,$r as initTelemetryInstance,wr as inspectors,Br as register,_r as resetTelemetryInstance};
11
11
  /**
12
12
  * https://github.com/csnover/TraceKit
13
13
  * @license MIT