@launchdarkly/browser-telemetry 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.12](https://github.com/launchdarkly/js-core/compare/browser-telemetry-v1.0.11...browser-telemetry-v1.0.12) (2025-11-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* The following workspace dependencies were updated
|
|
9
|
+
* devDependencies
|
|
10
|
+
* @launchdarkly/js-client-sdk bumped from 0.8.1 to 0.9.0
|
|
11
|
+
|
|
3
12
|
## [1.0.11](https://github.com/launchdarkly/js-core/compare/browser-telemetry-v1.0.10...browser-telemetry-v1.0.11) (2025-07-23)
|
|
4
13
|
|
|
5
14
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ne=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Me=Object.prototype.hasOwnProperty;var Pe=(e,t)=>{for(var r in t)ne(e,r,{get:t[r],enumerable:!0})},Ne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ce(t))!Me.call(e,i)&&i!==r&&ne(e,i,{get:()=>t[i],enumerable:!(n=De(t,i))||n.enumerable});return e};var Ue=e=>Ne(ne({},"__esModule",{value:!0}),e);var Ct={};Pe(Ct,{addBreadcrumb:()=>Bt,captureError:()=>Ot,captureErrorEvent:()=>Ft,close:()=>Rt,getTelemetryInstance:()=>F,initTelemetry:()=>Tt,initTelemetryInstance:()=>Dt,inspectors:()=>wt,register:()=>It,resetTelemetryInstance:()=>St});module.exports=Ue(Ct);function H(e){try{return e.target}catch(t){return}}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 A(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(" > ")}var X=class{constructor(){window.addEventListener("click",t=>{var n;let r=H(t);if(r){let i={class:"ui",type:"click",level:"info",timestamp:Date.now(),message:A(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"],j=class{constructor(){window.addEventListener("keypress",t=>{var i;let r=H(t),n=r;if(r&&(je.includes(r.tagName)||n!=null&&n.isContentEditable)){let f={class:"ui",type:"input",level:"info",timestamp:Date.now(),message:A(r)};this._shouldDeduplicate(f)||((i=this._destination)==null||i.addBreadcrumb(f),this._lastEvent=f)}},!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 q=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 ie(e,t){return t?e.reduce((r,n)=>n(r),t):""}function K(e,t){var r;(r=e.data)!=null&&r.url&&(e.data.url=ie(t.urlFilters,e.data.url))}var qe="__LaunchDarkly_original_fetch",W=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 se(e){function t(...r){let n=Date.now();return W.apply(this,r).then(i=>{let f={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(f),i})}t.prototype=W==null?void 0:W.prototype;try{Object.defineProperty(t,qe,{value:W,writable:!0,configurable:!0})}catch(r){}window.fetch=t}var G=class{constructor(t){this._loggedIssue=!1;se(r=>{var i,f,x;let n=!1;try{K(r,t),n=!0}catch(k){this._loggedIssue||((f=(i=t.getLogger)==null?void 0:i.call(t))==null||f.warn("Error filtering http breadcrumb",k),this._loggedIssue=!0)}n&&((x=this._destination)==null||x.addBreadcrumb(r))})}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var ve="__LaunchDarkly_original_xhr",We=`${ve}_open`,Ge=`${ve}_send`,ee="__LaunchDarkly_data_xhr",ye=window.XMLHttpRequest.prototype.open,Le=window.XMLHttpRequest.prototype.send;function ae(e){function t(...n){this.addEventListener("error",function(i){let f=this[ee];f.error=!0}),this.addEventListener("loadend",function(i){let f=this[ee];f&&f.timestamp&&e({class:"http",timestamp:f.timestamp,level:f.error?"error":"info",type:"xhr",data:{url:f.url,method:f.method,statusCode:this.status,statusText:this.statusText}})},!0),ye.apply(this,n);try{let i={method:n==null?void 0:n[0],url:n==null?void 0:n[1]};Object.defineProperty(this,ee,{value:i,writable:!0,configurable:!0})}catch(i){}}function r(...n){Le.apply(this,n);let i=this[ee];i&&(i.timestamp=Date.now())}window.XMLHttpRequest.prototype.open=t,window.XMLHttpRequest.prototype.send=r;try{Object.defineProperties(window.XMLHttpRequest,{[We]:{value:ye,writable:!0,configurable:!0},[Ge]:{value:Le,writable:!0,configurable:!0}})}catch(n){}}var z=class{constructor(t){this._loggedIssue=!1;ae(r=>{var i,f,x;let n=!1;try{K(r,t),n=!0}catch(k){this._loggedIssue||((f=(i=t.getLogger)==null?void 0:i.call(t))==null||f.warn("Error filtering http breadcrumb",k),this._loggedIssue=!0)}n&&((x=this._destination)==null||x.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){try{if(e.includes("://")){let t=new URL(e),r=!1;if(t.username&&(t.username="redacted",r=!0),t.password&&(t.password="redacted",r=!0),r)return t.toString()}}catch(t){}return 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 oe(e){return Ze(Ye(e))}function ce(e,t,r){e.breadcrumbs.evaluations&&t.push({type:"flag-used",name:"launchdarkly-browser-telemetry-flag-used",synchronous:!0,method(n,i,f){r.handleFlagUsed(n,i,f)}}),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},Je="LaunchDarkly - Browser Telemetry:";function T(e){return`${Je} ${e}`}function P(e){return{warn:(...t)=>{if(!e){S.warn(...t);return}try{e.warn(...t)}catch(r){S.warn(...t),S.warn(T("The provided logger threw an exception, using fallback logger."))}}}}var Qe={start:0,end:3},et={start:4,end:5},ue={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 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 it(e){return e[le.start]=(e[le.start]|128)&191,e[ue.start]=e[ue.start]&15|64,`${N(e,Qe)}-${N(e,et)}-${N(e,ue)}-${N(e,le)}${N(e,tt)}-${N(e,rt)}`}function st(){let e=nt();return it(e)}function fe(){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 f(k,B){return Object.prototype.hasOwnProperty.call(k,B)}function x(k){return typeof k=="undefined"}y.wrap=function(B){function I(){try{return B.apply(this,arguments)}catch(Z){throw y.report(Z),Z}}return I},y.computeStackTrace=function(){let I={};function Z(a){if(!y.remoteFetching)return"";try{let u=function(){try{return new e.XMLHttpRequest}catch(p){return new e.ActiveXObject("Microsoft.XMLHTTP")}}();return u.open("GET",a,!1),u.send(""),u.responseText}catch(c){return""}}function D(a){if(typeof a!="string")return[];if(!f(I,a)){let c="",u="";try{u=e.document.domain}catch(o){}let p=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(a);p&&p[2]===u&&(c=Z(a)),I[a]=c?c.split(`
|
|
1
|
+
"use strict";var ne=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Me=Object.prototype.hasOwnProperty;var Pe=(e,t)=>{for(var r in t)ne(e,r,{get:t[r],enumerable:!0})},Ne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ce(t))!Me.call(e,i)&&i!==r&&ne(e,i,{get:()=>t[i],enumerable:!(n=De(t,i))||n.enumerable});return e};var Ue=e=>Ne(ne({},"__esModule",{value:!0}),e);var Ct={};Pe(Ct,{addBreadcrumb:()=>Bt,captureError:()=>Ot,captureErrorEvent:()=>Ft,close:()=>Rt,getTelemetryInstance:()=>F,initTelemetry:()=>Tt,initTelemetryInstance:()=>Dt,inspectors:()=>wt,register:()=>It,resetTelemetryInstance:()=>St});module.exports=Ue(Ct);function H(e){try{return e.target}catch(t){return}}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 A(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(" > ")}var X=class{constructor(){window.addEventListener("click",t=>{var n;let r=H(t);if(r){let i={class:"ui",type:"click",level:"info",timestamp:Date.now(),message:A(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"],j=class{constructor(){window.addEventListener("keypress",t=>{var i;let r=H(t),n=r;if(r&&(je.includes(r.tagName)||n!=null&&n.isContentEditable)){let f={class:"ui",type:"input",level:"info",timestamp:Date.now(),message:A(r)};this._shouldDeduplicate(f)||((i=this._destination)==null||i.addBreadcrumb(f),this._lastEvent=f)}},!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 q=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 ie(e,t){return t?e.reduce((r,n)=>n(r),t):""}function K(e,t){var r;(r=e.data)!=null&&r.url&&(e.data.url=ie(t.urlFilters,e.data.url))}var qe="__LaunchDarkly_original_fetch",W=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 se(e){function t(...r){let n=Date.now();return W.apply(this,r).then(i=>{let f={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(f),i})}t.prototype=W==null?void 0:W.prototype;try{Object.defineProperty(t,qe,{value:W,writable:!0,configurable:!0})}catch(r){}window.fetch=t}var G=class{constructor(t){this._loggedIssue=!1;se(r=>{var i,f,x;let n=!1;try{K(r,t),n=!0}catch(k){this._loggedIssue||((f=(i=t.getLogger)==null?void 0:i.call(t))==null||f.warn("Error filtering http breadcrumb",k),this._loggedIssue=!0)}n&&((x=this._destination)==null||x.addBreadcrumb(r))})}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var ve="__LaunchDarkly_original_xhr",We=`${ve}_open`,Ge=`${ve}_send`,ee="__LaunchDarkly_data_xhr",ye=window.XMLHttpRequest.prototype.open,Le=window.XMLHttpRequest.prototype.send;function ae(e){function t(...n){this.addEventListener("error",function(i){let f=this[ee];f.error=!0}),this.addEventListener("loadend",function(i){let f=this[ee];f&&f.timestamp&&e({class:"http",timestamp:f.timestamp,level:f.error?"error":"info",type:"xhr",data:{url:f.url,method:f.method,statusCode:this.status,statusText:this.statusText}})},!0),ye.apply(this,n);try{let i={method:n==null?void 0:n[0],url:n==null?void 0:n[1]};Object.defineProperty(this,ee,{value:i,writable:!0,configurable:!0})}catch(i){}}function r(...n){Le.apply(this,n);let i=this[ee];i&&(i.timestamp=Date.now())}window.XMLHttpRequest.prototype.open=t,window.XMLHttpRequest.prototype.send=r;try{Object.defineProperties(window.XMLHttpRequest,{[We]:{value:ye,writable:!0,configurable:!0},[Ge]:{value:Le,writable:!0,configurable:!0}})}catch(n){}}var z=class{constructor(t){this._loggedIssue=!1;ae(r=>{var i,f,x;let n=!1;try{K(r,t),n=!0}catch(k){this._loggedIssue||((f=(i=t.getLogger)==null?void 0:i.call(t))==null||f.warn("Error filtering http breadcrumb",k),this._loggedIssue=!0)}n&&((x=this._destination)==null||x.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){try{if(e.includes("://")){let t=new URL(e),r=!1;if(t.username&&(t.username="redacted",r=!0),t.password&&(t.password="redacted",r=!0),r)return t.toString()}}catch(t){}return 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 oe(e){return Ze(Ye(e))}function ce(e,t,r){e.breadcrumbs.evaluations&&t.push({type:"flag-used",name:"launchdarkly-browser-telemetry-flag-used",synchronous:!0,method(n,i,f){r.handleFlagUsed(n,i,f)}}),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},Je="LaunchDarkly - Browser Telemetry:";function T(e){return`${Je} ${e}`}function P(e){return{warn:(...t)=>{if(!e){S.warn(...t);return}try{e.warn(...t)}catch(r){S.warn(...t),S.warn(T("The provided logger threw an exception, using fallback logger."))}}}}var Qe={start:0,end:3},et={start:4,end:5},ue={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 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 it(e){return e[le.start]=(e[le.start]|128)&191,e[ue.start]=e[ue.start]&15|64,`${N(e,Qe)}-${N(e,et)}-${N(e,ue)}-${N(e,le)}${N(e,tt)}-${N(e,rt)}`}function st(){let e=nt();return it(e)}function fe(){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 f(k,B){return Object.prototype.hasOwnProperty.call(k,B)}function x(k){return typeof k=="undefined"}y.wrap=function(B){function I(){try{return B.apply(this,arguments)}catch(Z){throw y.report(Z),Z}}return I},y.computeStackTrace=(function(){let I={};function Z(a){if(!y.remoteFetching)return"";try{let u=function(){try{return new e.XMLHttpRequest}catch(p){return new e.ActiveXObject("Microsoft.XMLHTTP")}}();return u.open("GET",a,!1),u.send(""),u.responseText}catch(c){return""}}function D(a){if(typeof a!="string")return[];if(!f(I,a)){let c="",u="";try{u=e.document.domain}catch(o){}let p=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(a);p&&p[2]===u&&(c=Z(a)),I[a]=c?c.split(`
|
|
2
2
|
`):[]}return I[a]}function C(a,c){typeof c!="number"&&(c=Number(c));let u=/function ([^(]*)\(([^)]*)\)/,p=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,o="",b=10,g=D(a),d;if(!g.length)return n;for(let l=0;l<b;++l)if(o=g[c-l]+o,!x(o)&&((d=p.exec(o))||(d=u.exec(o))))return d[1];return n}function $(a,c){typeof c!="number"&&(c=Number(c));let u=D(a);if(!u.length)return null;let p=[],o=Math.floor(y.linesOfContext/2),b=o+y.linesOfContext%2,g=Math.max(0,c-o-1),d=Math.min(u.length,c+b-1);c-=1;for(let l=g;l<d;++l)x(u[l])||p.push(u[l]);return p.length>0?{contextLines:p,startFromSource:g+1}:null}function J(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function pe(a){return J(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function Q(a,c){let u,p;for(let o=0,b=c.length;o<b;++o)if((u=D(c[o])).length&&(u=u.join(`
|
|
3
3
|
`),p=a.exec(u)))return{url:c[o],line:u.substring(0,p.index).split(`
|
|
4
4
|
`).length,column:p.index-u.lastIndexOf(`
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`),b=[],g;for(let l=0;l<o.length;l+=2){let m=null;if((g=u.exec(o[l]))?m={url:g[2],line:+g[1],column:null,func:g[3],args:[]}:(g=p.exec(o[l]))&&(m={url:g[6],line:+g[1],column:+g[2],func:g[3]||g[4],args:g[5]?g[5].split(","):[]}),m){if(!m.func&&m.line&&(m.func=C(m.url,m.line)),m.line)try{let s=$(m.url,m.line);m.srcStart=s==null?void 0:s.startFromSource,m.context=m.line&&(d=s==null?void 0:s.contextLines)!=null?d:null}catch(s){}m.context||(m.context=[o[l+1]]),b.push(m)}}return b.length?{mode:"stacktrace",name:a.name,message:a.message,stack:b}:null}function Be(a){let c=a.message.split(`
|
|
8
8
|
`);if(c.length<4)return null;let u=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,p=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of function script\s*$/i,b=[],g=e&&e.document&&e.document.getElementsByTagName("script"),d=[],l;for(let m in g)f(g,m)&&!g[m].src&&d.push(g[m]);for(let m=2;m<c.length;m+=2){let s=null;if(l=u.exec(c[m]))s={url:l[2],func:l[3],args:[],line:+l[1],column:null};else if(l=p.exec(c[m])){s={url:l[3],func:l[4],args:[],line:+l[1],column:null};let h=+l[1],E=d[l[2]-1];if(E){let L=D(s.url);if(L){L=L.join(`
|
|
9
9
|
`);let O=L.indexOf(E.innerText);O>=0&&(s.line=h+L.substring(0,O).split(`
|
|
10
|
-
`).length)}}}else if(l=o.exec(c[m])){let h=e.location.href.replace(/#.*$/,""),E=new RegExp(pe(c[m+1])),L=Q(E,[h]);s={url:h,func:"",args:[],line:L?L.line:l[1],column:null}}if(s){s.func||(s.func=C(s.url,s.line));let h=$(s.url,s.line);s.srcStart=h==null?void 0:h.startFromSource;let E=h==null?void 0:h.contextLines,L=E?E[Math.floor(E.length/2)]:null;E&&L&&L.replace(/^\s*/,"")===c[m+1].replace(/^\s*/,"")?s.context=E:s.context=[c[m+1]],b.push(s)}}return b.length?{mode:"multiline",name:a.name,message:c[0],stack:b}:null}function he(a,c,u,p){var b;let o={url:c,line:u};if(o.url&&o.line){if(a.incomplete=!1,o.func||(o.func=C(o.url,o.line)),!o.context){let d=$(o.url,o.line);o.context=(b=d==null?void 0:d.contextLines)!=null?b:null,o.srcStart=d==null?void 0:d.startFromSource}let g=/ '([^']+)' /.exec(p);if(g&&(o.column=re(g[1],o.url,o.line)),a.stack.length>0&&a.stack[0].url===o.url){if(a.stack[0].line===o.line)return!1;if(!a.stack[0].line&&a.stack[0].func===o.func)return a.stack[0].line=o.line,a.stack[0].context=o.context,!1}return a.stack.unshift(o),a.partial=!0,!0}return a.incomplete=!0,!1}function be(a,c){let u=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,p=[],o={},b=!1,g,d,l;for(let s=be.caller;s&&!b;s=s.caller)if(!(s===w||s===y.report)){if(d={url:null,func:n,args:[],line:null,column:null},s.name?d.func=s.name:(g=u.exec(s.toString()))&&(d.func=g[1]),typeof d.func=="undefined")try{d.func=g.input.substring(0,g.input.indexOf("{"))}catch(h){}if(l=Oe(s)){d.url=l.url,d.line=l.line,d.func===n&&(d.func=C(d.url,d.line));let h=/ '([^']+)' /.exec(a.message||a.description);h&&(d.column=re(h[1],l.url,l.line))}o[`${s}`]?b=!0:o[`${s}`]=!0,p.push(d)}c&&p.splice(0,c);let m={mode:"callers",name:a.name,message:a.message,stack:p};return he(m,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description),m}function w(a,c){let u=null;c=c==null?0:+c;try{if(u=Fe(a),u)return u}catch(p){}try{if(u=ge(a),u)return u}catch(p){}try{if(u=Be(a),u)return u}catch(p){}try{if(u=be(a,c+1),u)return u}catch(p){}return{name:a.name,message:a.message,mode:"failed",stack:[]}}function Ie(a){a=(a==null?0:+a)+1;try{throw new Error}catch(c){return w(c,a+1)}}return w.augmentStackTraceWithInitialElement=he,w.computeStackTraceFromStackProp=ge,w.guessFunctionName=C,w.gatherContext=$,w.ofCaller=Ie,w.getSource=D,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 te(){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 ot(e,t,r){return Math.min(t,Math.max(e,r))}function _e(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 ke(e,t,r,n){let i=e<0?0:e,f=t>r.length?r.length:t;return i<f?r.slice(i,f).map(n):[]}function ct(e,t){var k,B;let{context:r}=e;if(!r)return{};let{maxLineLength:n}=t.source,i=Math.floor(n/2),f=I=>_e({maxLength:t.source.maxLineLength,beforeColumnCharacters:i},I,0),x=ot(0,r.length-1,((k=e==null?void 0:e.line)!=null?k:0)-((B=e.srcStart)!=null?B:0));return{srcBefore:ke(x-t.source.beforeLines,x,r,f),srcLine:_e({maxLength:n,beforeColumnCharacters:i},r[x],e.column||0),srcAfter:ke(x+1,x+1+t.source.afterLines,r,f)}}function me(e,t){return t.enabled?{frames:te().computeStackTrace(e).stack.reverse().map(i=>{var f,x;return{fileName:at(i.url,window.location.origin),function:i.func,line:(f=i.line)!=null?f:void 0,col:(x=i.column)!=null?x:void 0,...ct(i,t)}})}:{frames:[]}}var we="$ld:telemetry",ut=`${we}:error`,lt=`${we}:session:init`,Te="generic",ft="exception was null or undefined",mt="exception had no message",dt=5;function Se(e){switch(typeof e){case"string":case"boolean":case"number":return e;default:return}}function pt(e,t){return e===void 0?void 0:t(e)}function gt(e){if(!e.enabled)return;let t=te(),r=Math.max(e.source.afterLines,e.source.beforeLines),n=t;n.linesOfContext=r*2+1}function ht(e){return e.logger!==void 0}function bt(e){return e.waitForInitialization!==void 0}var R=class{constructor(t){this._options=t;this._pendingEvents=[];this._breadcrumbs=[];this._inspectorInstances=[];this._collectors=[];this._sessionId=fe();this._registrationComplete=!1;this._eventsDropped=!1;this._breadcrumbFilterError=!1;this._errorFilterError=!1;var f;gt(t.stack),this._collectors.push(new q),this._collectors.push(...t.collectors),this._maxPendingEvents=t.maxPendingEvents,this._maxBreadcrumbs=t.breadcrumbs.maxBreadcrumbs,this._logger=(f=this._options.logger)!=null?f:S;let r=[oe];t.breadcrumbs.http.customUrlFilter&&r.push(t.breadcrumbs.http.customUrlFilter),t.breadcrumbs.http.instrumentFetch&&this._collectors.push(new G({urlFilters:r,getLogger:()=>this._logger})),t.breadcrumbs.http.instrumentXhr&&this._collectors.push(new z({urlFilters:r,getLogger:()=>this._logger})),t.breadcrumbs.click&&this._collectors.push(new X),t.breadcrumbs.keyboardInput&&this._collectors.push(new j),this._collectors.forEach(x=>x.register(this,this._sessionId));let n=this,i=[];ce(t,i,n),this._inspectorInstances.push(...i)}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 f;(f=this._client)==null||f.track(i.type,i.data)}),this._pendingEvents=[],this._registrationComplete=!0};bt(t)?(async()=>{try{await t.waitForInitialization(dt)}catch(n){}r()})():r()}_setLogger(){this._options.logger?this._logger=this._options.logger:ht(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,f=>{this._errorFilterError||(this._errorFilterError=!0,this._logger.warn(T(`Error applying error filters: ${f}`)))});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(T("Maximum pending events reached. Old events will be dropped until the SDK client is registered."))),this._pendingEvents.shift())))}captureError(t){var i,f;let n=t!=null?{type:t.name||((i=t.constructor)==null?void 0:i.name)||Te,message:(f=t.message)!=null?f:mt,stack:me(t,this._options.stack),breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId}:{type:Te,message:ft,stack:{frames:[]},breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId};this._capture(ut,n)}captureErrorEvent(t){this.captureError(t.error)}_applyFilters(t,r,n){try{return r.reduce((i,f)=>pt(i,f),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(T(`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:Se(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:Se(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(n)}};var xt={maxBreadcrumbs:0,evaluations:!1,flagChange:!1,click:!1,keyboardInput:!1,http:{instrumentFetch:!1,instrumentXhr:!1,customUrlFilter:void 0},filters:[]},yt={enabled:!1,source:{beforeLines:0,afterLines:0,maxLineLength:0}};function Lt(){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 U(e,t,r){return T(`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(U(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(U("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(T(`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,_("boolean","breadcrumbs.http.instrumentFetch",r)),instrumentXhr:v(e==null?void 0:e.instrumentXhr,t.instrumentXhr,_("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 P(t);S.warn(U("logger","MinLogger or LDLogger",typeof t))}}function _t(e,t,r){var n,i,f;return e===!1?yt:{enabled:!0,source:{beforeLines:v((n=e==null?void 0:e.source)==null?void 0:n.beforeLines,t.source.beforeLines,_("number","stack.beforeLines",r)),afterLines:v((i=e==null?void 0:e.source)==null?void 0:i.afterLines,t.source.afterLines,_("number","stack.afterLines",r)),maxLineLength:v((f=e==null?void 0:e.source)==null?void 0:f.maxLineLength,t.source.maxLineLength,_("number","stack.maxLineLength",r))}}}function kt(e,t,r){return e===!1?xt:{maxBreadcrumbs:v(e==null?void 0:e.maxBreadcrumbs,t.maxBreadcrumbs,_("number","breadcrumbs.maxBreadcrumbs",r)),evaluations:v(e==null?void 0:e.evaluations,t.evaluations,_("boolean","breadcrumbs.evaluations",r)),flagChange:v(e==null?void 0:e.flagChange,t.flagChange,_("boolean","breadcrumbs.flagChange",r)),click:v(e==null?void 0:e.click,t.click,_("boolean","breadcrumbs.click",r)),keyboardInput:v(e==null?void 0:e.keyboardInput,t.keyboardInput,_("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(U("breadcrumbs.filters","BreadcrumbFilter[]",typeof n)),!1))}}function V(e,t){let r=Lt();return e.breadcrumbs&&_("object","breadcrumbs",t)(e.breadcrumbs),e.stack&&_("object","stack",t)(e.stack),{breadcrumbs:kt(e.breadcrumbs,r.breadcrumbs,t),stack:_t(e.stack,r.stack,t),maxPendingEvents:v(e.maxPendingEvents,r.maxPendingEvents,_("number","maxPendingEvents",t)),collectors:[...v(e.collectors,r.collectors,n=>Array.isArray(n)?!0:(t==null||t.warn(U("collectors","Collector[]",typeof n)),!1))],logger:Et(e),errorFilters:v(e.errorFilters,r.errorFilters,n=>Array.isArray(n)?!0:(t==null||t.warn(U("errorFilters","ErrorDataFilter[]",typeof n)),!1))}}var Y,de=!1;function Tt(e){let t=P(e==null?void 0:e.logger);if(Y){t.warn(T("Telemetry has already been initialized. Ignoring new options."));return}let r=V(e||{},t);Y=new R(r)}function F(){if(!Y){if(de)return;S.warn(T("Telemetry has not been initialized")),de=!0;return}return Y}function St(){Y=void 0,de=!1}function wt(){var e;return((e=F())==null?void 0:e.inspectors())||[]}function Ot(e){var t;(t=F())==null||t.captureError(e)}function Ft(e){var t;(t=F())==null||t.captureErrorEvent(e)}function Bt(e){var t;(t=F())==null||t.addBreadcrumb(e)}function It(e){var t;(t=F())==null||t.register(e)}function Rt(){var e;(e=F())==null||e.close()}function Dt(e){let t=V(e||{},P(e==null?void 0:e.logger));return new R(t)}0&&(module.exports={addBreadcrumb,captureError,captureErrorEvent,close,getTelemetryInstance,initTelemetry,initTelemetryInstance,inspectors,register,resetTelemetryInstance});
|
|
10
|
+
`).length)}}}else if(l=o.exec(c[m])){let h=e.location.href.replace(/#.*$/,""),E=new RegExp(pe(c[m+1])),L=Q(E,[h]);s={url:h,func:"",args:[],line:L?L.line:l[1],column:null}}if(s){s.func||(s.func=C(s.url,s.line));let h=$(s.url,s.line);s.srcStart=h==null?void 0:h.startFromSource;let E=h==null?void 0:h.contextLines,L=E?E[Math.floor(E.length/2)]:null;E&&L&&L.replace(/^\s*/,"")===c[m+1].replace(/^\s*/,"")?s.context=E:s.context=[c[m+1]],b.push(s)}}return b.length?{mode:"multiline",name:a.name,message:c[0],stack:b}:null}function he(a,c,u,p){var b;let o={url:c,line:u};if(o.url&&o.line){if(a.incomplete=!1,o.func||(o.func=C(o.url,o.line)),!o.context){let d=$(o.url,o.line);o.context=(b=d==null?void 0:d.contextLines)!=null?b:null,o.srcStart=d==null?void 0:d.startFromSource}let g=/ '([^']+)' /.exec(p);if(g&&(o.column=re(g[1],o.url,o.line)),a.stack.length>0&&a.stack[0].url===o.url){if(a.stack[0].line===o.line)return!1;if(!a.stack[0].line&&a.stack[0].func===o.func)return a.stack[0].line=o.line,a.stack[0].context=o.context,!1}return a.stack.unshift(o),a.partial=!0,!0}return a.incomplete=!0,!1}function be(a,c){let u=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,p=[],o={},b=!1,g,d,l;for(let s=be.caller;s&&!b;s=s.caller)if(!(s===w||s===y.report)){if(d={url:null,func:n,args:[],line:null,column:null},s.name?d.func=s.name:(g=u.exec(s.toString()))&&(d.func=g[1]),typeof d.func=="undefined")try{d.func=g.input.substring(0,g.input.indexOf("{"))}catch(h){}if(l=Oe(s)){d.url=l.url,d.line=l.line,d.func===n&&(d.func=C(d.url,d.line));let h=/ '([^']+)' /.exec(a.message||a.description);h&&(d.column=re(h[1],l.url,l.line))}o[`${s}`]?b=!0:o[`${s}`]=!0,p.push(d)}c&&p.splice(0,c);let m={mode:"callers",name:a.name,message:a.message,stack:p};return he(m,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description),m}function w(a,c){let u=null;c=c==null?0:+c;try{if(u=Fe(a),u)return u}catch(p){}try{if(u=ge(a),u)return u}catch(p){}try{if(u=Be(a),u)return u}catch(p){}try{if(u=be(a,c+1),u)return u}catch(p){}return{name:a.name,message:a.message,mode:"failed",stack:[]}}function Ie(a){a=(a==null?0:+a)+1;try{throw new Error}catch(c){return w(c,a+1)}}return w.augmentStackTraceWithInitialElement=he,w.computeStackTraceFromStackProp=ge,w.guessFunctionName=C,w.gatherContext=$,w.ofCaller=Ie,w.getSource=D,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 te(){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 ot(e,t,r){return Math.min(t,Math.max(e,r))}function _e(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 ke(e,t,r,n){let i=e<0?0:e,f=t>r.length?r.length:t;return i<f?r.slice(i,f).map(n):[]}function ct(e,t){var k,B;let{context:r}=e;if(!r)return{};let{maxLineLength:n}=t.source,i=Math.floor(n/2),f=I=>_e({maxLength:t.source.maxLineLength,beforeColumnCharacters:i},I,0),x=ot(0,r.length-1,((k=e==null?void 0:e.line)!=null?k:0)-((B=e.srcStart)!=null?B:0));return{srcBefore:ke(x-t.source.beforeLines,x,r,f),srcLine:_e({maxLength:n,beforeColumnCharacters:i},r[x],e.column||0),srcAfter:ke(x+1,x+1+t.source.afterLines,r,f)}}function me(e,t){return t.enabled?{frames:te().computeStackTrace(e).stack.reverse().map(i=>{var f,x;return{fileName:at(i.url,window.location.origin),function:i.func,line:(f=i.line)!=null?f:void 0,col:(x=i.column)!=null?x:void 0,...ct(i,t)}})}:{frames:[]}}var we="$ld:telemetry",ut=`${we}:error`,lt=`${we}:session:init`,Te="generic",ft="exception was null or undefined",mt="exception had no message",dt=5;function Se(e){switch(typeof e){case"string":case"boolean":case"number":return e;default:return}}function pt(e,t){return e===void 0?void 0:t(e)}function gt(e){if(!e.enabled)return;let t=te(),r=Math.max(e.source.afterLines,e.source.beforeLines),n=t;n.linesOfContext=r*2+1}function ht(e){return e.logger!==void 0}function bt(e){return e.waitForInitialization!==void 0}var R=class{constructor(t){this._options=t;this._pendingEvents=[];this._breadcrumbs=[];this._inspectorInstances=[];this._collectors=[];this._sessionId=fe();this._registrationComplete=!1;this._eventsDropped=!1;this._breadcrumbFilterError=!1;this._errorFilterError=!1;var f;gt(t.stack),this._collectors.push(new q),this._collectors.push(...t.collectors),this._maxPendingEvents=t.maxPendingEvents,this._maxBreadcrumbs=t.breadcrumbs.maxBreadcrumbs,this._logger=(f=this._options.logger)!=null?f:S;let r=[oe];t.breadcrumbs.http.customUrlFilter&&r.push(t.breadcrumbs.http.customUrlFilter),t.breadcrumbs.http.instrumentFetch&&this._collectors.push(new G({urlFilters:r,getLogger:()=>this._logger})),t.breadcrumbs.http.instrumentXhr&&this._collectors.push(new z({urlFilters:r,getLogger:()=>this._logger})),t.breadcrumbs.click&&this._collectors.push(new X),t.breadcrumbs.keyboardInput&&this._collectors.push(new j),this._collectors.forEach(x=>x.register(this,this._sessionId));let n=this,i=[];ce(t,i,n),this._inspectorInstances.push(...i)}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 f;(f=this._client)==null||f.track(i.type,i.data)}),this._pendingEvents=[],this._registrationComplete=!0};bt(t)?(async()=>{try{await t.waitForInitialization(dt)}catch(n){}r()})():r()}_setLogger(){this._options.logger?this._logger=this._options.logger:ht(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,f=>{this._errorFilterError||(this._errorFilterError=!0,this._logger.warn(T(`Error applying error filters: ${f}`)))});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(T("Maximum pending events reached. Old events will be dropped until the SDK client is registered."))),this._pendingEvents.shift())))}captureError(t){var i,f;let n=t!=null?{type:t.name||((i=t.constructor)==null?void 0:i.name)||Te,message:(f=t.message)!=null?f:mt,stack:me(t,this._options.stack),breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId}:{type:Te,message:ft,stack:{frames:[]},breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId};this._capture(ut,n)}captureErrorEvent(t){this.captureError(t.error)}_applyFilters(t,r,n){try{return r.reduce((i,f)=>pt(i,f),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(T(`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:Se(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:Se(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(n)}};var xt={maxBreadcrumbs:0,evaluations:!1,flagChange:!1,click:!1,keyboardInput:!1,http:{instrumentFetch:!1,instrumentXhr:!1,customUrlFilter:void 0},filters:[]},yt={enabled:!1,source:{beforeLines:0,afterLines:0,maxLineLength:0}};function Lt(){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 U(e,t,r){return T(`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(U(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(U("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(T(`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,_("boolean","breadcrumbs.http.instrumentFetch",r)),instrumentXhr:v(e==null?void 0:e.instrumentXhr,t.instrumentXhr,_("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 P(t);S.warn(U("logger","MinLogger or LDLogger",typeof t))}}function _t(e,t,r){var n,i,f;return e===!1?yt:{enabled:!0,source:{beforeLines:v((n=e==null?void 0:e.source)==null?void 0:n.beforeLines,t.source.beforeLines,_("number","stack.beforeLines",r)),afterLines:v((i=e==null?void 0:e.source)==null?void 0:i.afterLines,t.source.afterLines,_("number","stack.afterLines",r)),maxLineLength:v((f=e==null?void 0:e.source)==null?void 0:f.maxLineLength,t.source.maxLineLength,_("number","stack.maxLineLength",r))}}}function kt(e,t,r){return e===!1?xt:{maxBreadcrumbs:v(e==null?void 0:e.maxBreadcrumbs,t.maxBreadcrumbs,_("number","breadcrumbs.maxBreadcrumbs",r)),evaluations:v(e==null?void 0:e.evaluations,t.evaluations,_("boolean","breadcrumbs.evaluations",r)),flagChange:v(e==null?void 0:e.flagChange,t.flagChange,_("boolean","breadcrumbs.flagChange",r)),click:v(e==null?void 0:e.click,t.click,_("boolean","breadcrumbs.click",r)),keyboardInput:v(e==null?void 0:e.keyboardInput,t.keyboardInput,_("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(U("breadcrumbs.filters","BreadcrumbFilter[]",typeof n)),!1))}}function V(e,t){let r=Lt();return e.breadcrumbs&&_("object","breadcrumbs",t)(e.breadcrumbs),e.stack&&_("object","stack",t)(e.stack),{breadcrumbs:kt(e.breadcrumbs,r.breadcrumbs,t),stack:_t(e.stack,r.stack,t),maxPendingEvents:v(e.maxPendingEvents,r.maxPendingEvents,_("number","maxPendingEvents",t)),collectors:[...v(e.collectors,r.collectors,n=>Array.isArray(n)?!0:(t==null||t.warn(U("collectors","Collector[]",typeof n)),!1))],logger:Et(e),errorFilters:v(e.errorFilters,r.errorFilters,n=>Array.isArray(n)?!0:(t==null||t.warn(U("errorFilters","ErrorDataFilter[]",typeof n)),!1))}}var Y,de=!1;function Tt(e){let t=P(e==null?void 0:e.logger);if(Y){t.warn(T("Telemetry has already been initialized. Ignoring new options."));return}let r=V(e||{},t);Y=new R(r)}function F(){if(!Y){if(de)return;S.warn(T("Telemetry has not been initialized")),de=!0;return}return Y}function St(){Y=void 0,de=!1}function wt(){var e;return((e=F())==null?void 0:e.inspectors())||[]}function Ot(e){var t;(t=F())==null||t.captureError(e)}function Ft(e){var t;(t=F())==null||t.captureErrorEvent(e)}function Bt(e){var t;(t=F())==null||t.addBreadcrumb(e)}function It(e){var t;(t=F())==null||t.register(e)}function Rt(){var e;(e=F())==null||e.close()}function Dt(e){let t=V(e||{},P(e==null?void 0:e.logger));return new R(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
|