Socket
Socket
Sign inDemoInstall

@datadog/browser-logs

Package Overview
Dependencies
Maintainers
1
Versions
254
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-logs - npm Package Compare versions

Comparing version 4.49.0 to 4.50.0

2

bundle/datadog-logs.js

@@ -1,1 +0,1 @@

!function(){"use strict";var e={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},t=function(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];Object.prototype.hasOwnProperty.call(e,n)||(n=e.log),t[n].apply(t,r)},n=console;function r(e,n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];try{return e.apply(void 0,r)}catch(e){t.error(n,e)}}}t.debug=n.debug.bind(n),t.log=n.log.bind(n),t.info=n.info.bind(n),t.warn=n.warn.bind(n),t.error=n.error.bind(n);var o,i=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},a=!1;function s(e){a=e}function u(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(o?c(r):r).apply(this,e)}}function c(e){return function(){return f(e,this,arguments)}}function f(t,n,r){try{return t.apply(n,r)}catch(t){if(l(e.error,t),o)try{o(t)}catch(t){l(e.error,t)}}}function l(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];a&&t.apply(void 0,i([e,"[MONITOR]"],n,!1))}function d(e,t){return-1!==e.indexOf(t)}function v(e){if(Array.from)return Array.from(e);var t=[];if(e instanceof Set)e.forEach((function(e){return t.push(e)}));else for(var n=0;n<e.length;n++)t.push(e[n]);return t}function p(e){return Object.keys(e).map((function(t){return e[t]}))}function g(e,t){return e.slice(0,t.length)===t}function h(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}function y(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}var m=1024,b=1024*m,w=/[^\u0000-\u007F]/;function S(e){return w.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}function E(e,t){var n,r=y();return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function x(e,t){return E(y(),"setTimeout")(c(e),t)}function C(e){E(y(),"clearTimeout")(e)}function _(e,t){return E(y(),"setInterval")(c(e),t)}function k(e){E(y(),"clearInterval")(e)}function O(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,a=!n||void 0===n.trailing||n.trailing,s=!1;return{throttled:function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];s?r=n:(i?e.apply(void 0,n):r=n,s=!0,o=x((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){C(o),s=!1,r=void 0}}}function R(){}function T(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function L(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=L(o[i],t[i],n);return o}var a="object"===T(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=L(a[s],t[s],n));return a}}function A(e){return L(void 0,e)}function P(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];null!=i&&(e=L(e,i))}return e}function I(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=B(Object.prototype),o=B(Array.prototype),i=B(Object.getPrototypeOf(e)),a=B(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}}function B(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):R}var N=220*m,M="$",U=3;function q(e,t){var n;void 0===t&&(t=N);var r=B(Object.prototype),o=B(Array.prototype),i=[],a=new WeakMap,s=j(e,M,void 0,i,a),u=(null===(n=JSON.stringify(s))||void 0===n?void 0:n.length)||0;if(!(u>t)){for(;i.length>0&&u<t;){var c=i.shift(),f=0;if(Array.isArray(c.source))for(var l=0;l<c.source.length;l++){if(u+=void 0!==(d=j(c.source[l],c.path,l,i,a))?JSON.stringify(d).length:4,u+=f,f=1,u>t){D(t,"truncated",e);break}c.target[l]=d}else for(var l in c.source)if(Object.prototype.hasOwnProperty.call(c.source,l)){var d;if(void 0!==(d=j(c.source[l],c.path,l,i,a))&&(u+=JSON.stringify(d).length+f+l.length+U,f=1),u>t){D(t,"truncated",e);break}c.target[l]=d}}return r(),o(),s}D(t,"discarded",e)}function j(e,t,n,r,o){var i=function(e){var t=e;if(t&&"function"==typeof t.toJSON)try{return t.toJSON()}catch(e){}return e}(e);if(!i||"object"!=typeof i)return function(e){if("bigint"==typeof e)return"[BigInt] ".concat(e.toString());if("function"==typeof e)return"[Function] ".concat(e.name||"unknown");if("symbol"==typeof e)return"[Symbol] ".concat(e.description||e.toString());return e}(i);var a=function(e){try{if(e instanceof Event)return{isTrusted:e.isTrusted};var t=Object.prototype.toString.call(e).match(/\[object (.*)\]/);if(t&&t[1])return"[".concat(t[1],"]")}catch(e){}return"[Unserializable]"}(i);if("[Object]"!==a&&"[Array]"!==a&&"[Error]"!==a)return a;var s=e;if(o.has(s))return"[Reference seen at ".concat(o.get(s),"]");var u=void 0!==n?"".concat(t,".").concat(n):t,c=Array.isArray(i)?[]:{};return o.set(s,u),r.push({source:i,target:c,path:u}),c}function D(e,n,r){t.warn("The data provided has been ".concat(n," as it is over the limit of ").concat(e," characters:"),r)}var G,F=function(){function e(e){this.onFirstSubscribe=e,this.observers=[]}return e.prototype.subscribe=function(e){var t=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e),{unsubscribe:function(){t.observers=t.observers.filter((function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function H(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new F((function(){var t=e.map((function(e){return e.subscribe((function(e){return n.notify(e)}))}));return function(){return t.forEach((function(e){return e.unsubscribe()}))}}));return n}var z=3*m,J=((G={})[0]="feature flag evaluation",G[1]="user",G[2]="global context",G[3]="logger context",G);var V=200;function W(e,n){void 0===n&&(n=S);var r,o={},i=!1,a=new F,s=O((function(o){r=n(I(o)),i||(i=function(e,n){return e>z&&(t.warn("The ".concat(J[n]," data exceeds the recommended ").concat(z/m,"KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-3kib-warning")),!0)}(r,e))}),V).throttled,u={getBytesCount:function(){return r},get:function(){return o},add:function(e,t){o[e]=t,s(o),a.notify()},remove:function(e){delete o[e],s(o),a.notify()},set:function(e){s(o=e),a.notify()},getContext:function(){return A(o)},setContext:function(e){"object"===T(e)?(o=q(e),s(o)):u.clearContext(),a.notify()},setContextProperty:function(e,t){o[e]=q(t),s(o),a.notify()},removeContextProperty:function(e){delete o[e],s(o),a.notify()},clearContext:function(){o={},r=0,a.notify()},changeObservable:a};return u}var $,X=function(){function e(){this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},e.prototype.drain=function(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},e}(),Z=1e3,K=60*Z,Y=60*K;function Q(){return(new Date).getTime()}function ee(){return Q()}function te(){return performance.now()}function ne(){return{relative:te(),timeStamp:ee()}}function re(e,t){return e+t}function oe(){return void 0===$&&($=performance.timing.navigationStart),$}function ie(){var e=y().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function ae(e){var t;void 0===e&&(e=null===(t=y().location)||void 0===t?void 0:t.hostname);var n=ie();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}function se(e,t,n,r,o){return ue(e,t,[n],r,o)}function ue(e,t,n,r,o){var i=void 0===o?{}:o,a=i.once,s=i.capture,u=i.passive,f=c(a?function(e){v(),r(e)}:r),l=u?{capture:s,passive:u}:s,d=E(t,"addEventListener");function v(){var e=E(t,"removeEventListener");n.forEach((function(n){return e.call(t,n,f,l)}))}return n.forEach((function(e){return d.call(t,e,f,l)})),{stop:v}}var ce,fe="_dd_c",le=[];function de(e,t,n,r){void 0===r&&(r=S);var o=function(e,t){return"".concat(fe,"_").concat(e,"_").concat(t)}(t,n),i=W(n,r);return a(),le.push(se(e,window,"storage",(function(e){var t=e.key;o===t&&a()}))),i.changeObservable.subscribe((function(){localStorage.setItem(o,JSON.stringify(i.getContext()))})),i;function a(){var e=localStorage.getItem(o),t=null!==e?JSON.parse(e):{};i.setContext(t)}}function ve(e){var t=h({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t}!function(e){e.PAGEHIDE="pagehide",e.FEATURE_FLAGS="feature_flags",e.RESOURCE_PAGE_STATES="resource_page_states",e.PAGE_STATES="page_states",e.COLLECT_FLUSH_REASON="collect_flush_reason",e.NO_RESOURCE_DURATION_FROZEN_STATE="no_resource_duration_frozen_state",e.SCROLLMAP="scrollmap",e.INTERACTION_TO_NEXT_PAINT="interaction_to_next_paint",e.DISABLE_REPLAY_INLINE_CSS="disable_replay_inline_css"}(ce||(ce={}));var pe=new Set;function ge(e){return pe.has(e)}function he(){return pe}function ye(e){return 0!==e&&100*Math.random()<=e}function me(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100}function be(e){return 0===Object.keys(e).length}function we(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,we)}function Se(e,t,n){void 0===n&&(n="");var r=e.charCodeAt(t-1),o=r>=55296&&r<=56319?t+1:t;return e.length<=o?e:"".concat(e.slice(0,o)).concat(n)}var Ee,xe=4*Y,Ce=15*K;function _e(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires=".concat(o.toUTCString()),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain=".concat(r.domain):"",u=r&&r.secure?";secure":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(s).concat(u)}function ke(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*".concat(t,"\\s*=\\s*([^;]+)")).exec(e);return n?n[1]:void 0}(document.cookie,e)}function Oe(e,t){_e(e,"",0,t)}var Re="_dd_s",Te=/^([a-z]+)=([a-z0-9-]+)$/,Le="&";function Ae(e){return be(e)}function Pe(e){e.expire=String(Q()+Ce)}function Ie(e){return(t=e,Object.keys(t).map((function(e){return[e,t[e]]}))).map((function(e){var t=e[0],n=e[1];return"".concat(t,"=").concat(n)})).join(Le);var t}function Be(e){var t={};return function(e){return!!e&&(-1!==e.indexOf(Le)||Te.test(e))}(e)&&e.split(Le).forEach((function(e){var n=Te.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}var Ne="_dd",Me="_dd_r",Ue="_dd_l",qe="rum",je="logs";function De(e){var n=function(e){var t={};t.secure=!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie,t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===Ee){for(var e="dd_site_test_".concat(we()),t=window.location.hostname.split("."),n=t.pop();t.length&&!ke(e);)n="".concat(t.pop(),".").concat(n),_e(e,"test",Z,{domain:n});Oe(e,{domain:n}),Ee=n}return Ee}());return t}(e);return function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var n="dd_cookie_test_".concat(we()),r="test";_e(n,r,K,e);var o=ke(n)===r;return Oe(n,e),o}catch(e){return t.error(e),!1}}(n)?{type:"Cookie",cookieOptions:n}:void 0}function Ge(e){var t,n={persistSession:(t=e,function(e){_e(Re,Ie(e),Ce,t)}),retrieveSession:Fe,clearSession:He(e)};return function(e){if(!ke(Re)){var t=ke(Ne),n=ke(Me),r=ke(Ue),o={};t&&(o.id=t),r&&/^[01]$/.test(r)&&(o[je]=r),n&&/^[012]$/.test(n)&&(o[qe]=n),Ae(o)||(Pe(o),e.persistSession(o))}}(n),n}function Fe(){return Be(ke(Re))}function He(e){return function(){Oe(Re,e)}}var ze="_dd_test_";function Je(e){localStorage.setItem(Re,Ie(e))}function Ve(){return Be(localStorage.getItem(Re))}function We(){localStorage.removeItem(Re)}var $e,Xe=10,Ze=100,Ke=[];function Ye(e,t,n){var r;void 0===n&&(n=0);var o=t.retrieveSession,i=t.persistSession,a=t.clearSession,s=Qe();if($e||($e=e),e===$e)if(s&&n>=Ze)tt(t);else{var u,c=o();if(s){if(c.lock)return void et(e,t,n);if(u=we(),c.lock=u,i(c),(c=o()).lock!==u)return void et(e,t,n)}var f=e.process(c);if(s&&(c=o()).lock!==u)et(e,t,n);else{if(f&&(Ae(f)?a():(Pe(f),i(f))),s&&(!f||!Ae(f))){if((c=o()).lock!==u)return void et(e,t,n);delete c.lock,i(c),f=c}null===(r=e.after)||void 0===r||r.call(e,f||c),tt(t)}}else Ke.push(e)}var Qe=function(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)};function et(e,t,n){x((function(){Ye(e,t,n+1)}),Xe)}function tt(e){$e=void 0;var t=Ke.shift();t&&Ye(t,e)}var nt=Z;function rt(e){var t=De(e);return!t&&e.allowFallbackToLocalStorage&&(t=function(){try{var e=we(),t="".concat(ze).concat(e);localStorage.setItem(t,e);var n=localStorage.getItem(t);return localStorage.removeItem(t),e===n?{type:"LocalStorage"}:void 0}catch(e){return}}()),t}function ot(e,t,n){var r=new F,o=new F,i="Cookie"===e.type?Ge(e.cookieOptions):{persistSession:Je,retrieveSession:Ve,clearSession:We},a=i.clearSession,s=i.retrieveSession,u=_((function(){Ye({process:function(e){return d(e)?void 0:{}},after:f},i)}),nt),c=function(){var e=s();if(d(e))return e;return{}}();function f(e){return d(e)||(e={}),l()&&(!function(e){return c.id!==e.id||c[t]!==e[t]}(e)?c=e:(c={},o.notify())),e}function l(){return void 0!==c[t]}function d(e){return(void 0===e.created||Q()-Number(e.created)<xe)&&(void 0===e.expire||Q()<Number(e.expire))}return{expandOrRenewSession:O((function(){var e;Ye({process:function(r){var o=f(r);return e=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;e[t]=o,i&&!e.id&&(e.id=we(),e.created=String(Q()));return i}(o),o},after:function(t){e&&!l()&&function(e){c=e,r.notify()}(t),c=t}},i)}),nt).throttled,expandSession:function(){Ye({process:function(e){return l()?f(e):void 0}},i)},getSession:function(){return c},renewObservable:r,expireObservable:o,expire:function(){a(),f({})},stop:function(){k(u)}}}function it(e){return at(e,ct(window.location)).href}function at(e,t){var n=function(){if(void 0===st)try{var e=new ut("http://test/path");st="http://test/path"===e.href}catch(e){st=!1}return st?ut:void 0}();if(n)try{return void 0!==t?new n(e,t):new n(e)}catch(n){throw new Error("Failed to construct URL: ".concat(String(n)," ").concat(I({url:e,base:t})))}if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var r=document,o=r.createElement("a");if(void 0!==t){var i=(r=document.implementation.createHTMLDocument("")).createElement("base");i.href=t,r.head.appendChild(i),r.body.appendChild(o)}return o.href=e,o}var st,ut=URL;function ct(e){if(e.origin&&"null"!==e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}var ft="datad0g.com",lt="datadoghq.com",dt="ap1.datadoghq.com",vt={logs:"logs",rum:"rum",sessionReplay:"session-replay"},pt={logs:"logs",rum:"rum",sessionReplay:"replay"};function gt(e,t,n){var r=function(e,t){var n="/api/v2/".concat(pt[t]),r=e.proxy,o=e.proxyUrl;if(r){var i=it(r);return function(e){return"".concat(i,"?ddforward=").concat(encodeURIComponent("".concat(n,"?").concat(e)))}}var a=function(e,t){var n=e.site,r=void 0===n?lt:n,o=e.internalAnalyticsSubdomain;if(o&&r===lt)return"".concat(o,".").concat(lt);var i=r.split("."),a=i.pop(),s=r!==dt?"".concat(vt[t],"."):"";return"".concat(s,"browser-intake-").concat(i.join("-"),".").concat(a)}(e,t);if(void 0===r&&o){var s=it(o);return function(e){return"".concat(s,"?ddforward=").concat(encodeURIComponent("https://".concat(a).concat(n,"?").concat(e)))}}return function(e){return"https://".concat(a).concat(n,"?").concat(e)}}(e,t);return{build:function(o,i,a){var s=function(e,t,n,r,o,i){var a=e.clientToken,s=e.internalAnalyticsSubdomain,u=["sdk_version:".concat("4.49.0"),"api:".concat(r)].concat(n);o&&ge(ce.COLLECT_FLUSH_REASON)&&u.push("flush_reason:".concat(o));i&&u.push("retry_count:".concat(i.count),"retry_after:".concat(i.lastFailureStatus));var c=["ddsource=browser","ddtags=".concat(encodeURIComponent(u.join(","))),"dd-api-key=".concat(a),"dd-evp-origin-version=".concat(encodeURIComponent("4.49.0")),"dd-evp-origin=browser","dd-request-id=".concat(we())];"rum"===t&&c.push("batch_time=".concat(ee()));s&&c.reverse();return c.join("&")}(e,t,n,o,i,a);return r(s)},urlPrefix:r(""),endpointType:t}}var ht=200;var yt=/[^a-z0-9_:./-]/;function mt(e,n){var r=ht-e.length-1;(n.length>r||yt.test(n))&&t.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var o=n.replace(/,/g,"_");return"".concat(e,":").concat(o)}function bt(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(mt("env",t)),n&&i.push(mt("service",n)),r&&i.push(mt("version",r)),o&&i.push(mt("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:gt(e,"logs",t),rumEndpointBuilder:gt(e,"rum",t),sessionReplayEndpointBuilder:gt(e,"sessionReplay",t)}}(e,t),r=p(n).map((function(e){return e.urlPrefix})),o=function(e,t,n){if(!e.replica)return;var r=h({},e,{site:lt,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:gt(r,"logs",n),rumEndpointBuilder:gt(r,"rum",n)};return t.push.apply(t,p(o).map((function(e){return e.urlPrefix}))),h({applicationId:e.replica.applicationId},o)}(e,r,t);return h({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||lt},n)}function wt(e){var n,o,i;if(e&&e.clientToken){var a=null!==(n=e.sessionSampleRate)&&void 0!==n?n:e.sampleRate;if(void 0===a||me(a))if(void 0===e.telemetrySampleRate||me(e.telemetrySampleRate)){if(void 0===e.telemetryConfigurationSampleRate||me(e.telemetryConfigurationSampleRate))return Array.isArray(e.enableExperimentalFeatures)&&e.enableExperimentalFeatures.filter((function(e){return t=ce,n=e,Object.keys(t).some((function(e){return t[e]===n}));var t,n})).forEach((function(e){pe.add(e)})),h({beforeSend:e.beforeSend&&r(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:rt(e),sessionSampleRate:null!=a?a:100,telemetrySampleRate:null!==(o=e.telemetrySampleRate)&&void 0!==o?o:20,telemetryConfigurationSampleRate:null!==(i=e.telemetryConfigurationSampleRate)&&void 0!==i?i:5,service:e.service,silentMultipleInit:!!e.silentMultipleInit,batchBytesLimit:16*m,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*Z,batchMessagesLimit:50,messageBytesLimit:256*m},bt(e));t.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else t.error("Telemetry Sample Rate should be a number between 0 and 100");else t.error("Session Sample Rate should be a number between 0 and 100")}else t.error("Client Token is not configured, we will not send any data.")}var St="?";function Et(e){var t=[],n=At(e,"stack"),r=String(e);return n&&g(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=_t.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=kt.exec(t[2]);r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||St,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Ot.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:St,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=Rt.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||St,line:+t[3],url:t[2]}}(e)||function(e){var t=Tt.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=Lt.exec(t[3]);n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0);return{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||St,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=St),t.push(n))})),{message:At(e,"message"),name:At(e,"name"),stack:t}}var xt="((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",Ct="(?::(\\d+))",_t=new RegExp("^\\s*at (.*?) ?\\(".concat(xt).concat(Ct,"?").concat(Ct,"?\\)?\\s*$"),"i"),kt=new RegExp("\\((\\S*)".concat(Ct).concat(Ct,"\\)"));var Ot=new RegExp("^\\s*at ?".concat(xt).concat(Ct,"?").concat(Ct,"??\\s*$"),"i");var Rt=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var Tt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Lt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function At(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}var Pt="No stack, consider using an instance of Error";function It(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,a=e.source,s=e.handling,u=n instanceof Error,c=function(e,t,n,r){return(null==e?void 0:e.message)&&(null==e?void 0:e.name)?e.message:t?"Empty message":"".concat(n," ").concat(I(q(r)))}(t,u,i,n),f=function(e,t){if(void 0===t)return!1;if(e)return!0;return t.stack.length>0&&(t.stack.length>1||void 0!==t.stack[0].url)}(u,t)?Nt(t):Pt,l=u?function(e,t){var n=e,r=[];for(;(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=Et(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&Nt(o)}),n=n.cause}return r.length?r:void 0}(n,a):void 0;return{startClocks:o,source:a,handling:s,handlingStack:r,originalError:n,type:null==t?void 0:t.name,message:c,stack:f,causes:l,fingerprint:Bt(n)}}function Bt(e){return e instanceof Error&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function Nt(e){var t=Mt(e);return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"(".concat(e.args.join(", "),")"):"",o=e.line?":".concat(e.line):"",i=e.line&&e.column?":".concat(e.column):"";t+="\n at ".concat(n).concat(r," @ ").concat(e.url).concat(o).concat(i)})),t}function Mt(e){return"".concat(e.name||"Error",": ").concat(e.message)}var Ut={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function qt(e,t){var n=[];d(t,Ut.cspViolation)&&n.push(function(e){var t=new F((function(){return se(e,document,"securitypolicyviolation",(function(e){t.notify(function(e){var t=Ut.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:Ut.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:jt(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(Se(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))})).stop}));return t}(e));var r=t.filter((function(e){return e!==Ut.cspViolation}));return r.length&&n.push(function(e){var t=new F((function(){if(window.ReportingObserver){var n=c((function(e,n){return e.forEach((function(e){t.notify(function(e){var t=e.type,n=e.body;return{type:t,subtype:n.id,message:"".concat(t,": ").concat(n.message),stack:jt(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)}}(e))}))})),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),function(){r.disconnect()}}}));return t}(r)),H.apply(void 0,n)}function jt(e,t,n,r,o){return n?Nt({name:e,message:t,stack:[{func:"?",url:n,line:null!=r?r:void 0,column:null!=o?o:void 0}]}):void 0}var Dt=32*m;function Gt(e,n,r){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return d(n,e)}))?"all"===e?n:(o=e,i=new Set,o.forEach((function(e){return i.add(e)})),v(i)):void t.error("".concat(r,' should be "all" or an array with allowed values "').concat(n.join('", "'),'"'));var o,i}var Ft={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"},Ht=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},zt={debug:"debug",error:"error",info:"info",warn:"warn"},Jt={console:"console",http:"http",silent:"silent"},Vt=Object.keys(zt),Wt=function(){function e(e,t,n,r,o){void 0===n&&(n=Jt.http),void 0===r&&(r=zt.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=W(3),this.contextManager.set(h({},o,t?{logger:{name:t}}:void 0))}return e.prototype.log=function(e,t,n,r){var o;if(void 0===n&&(n=zt.info),n===zt.error&&(o={origin:Ft.LOGGER}),null!=r){var i=It({stackTrace:r instanceof Error?Et(r):void 0,originalError:r,nonErrorPrefix:"Provided",source:Ft.LOGGER,handling:"handled",startClocks:ne()});o={origin:Ft.LOGGER,stack:i.stack,kind:i.type,message:i.message}}var a=q(t),s=o?P({error:o},a):a;this.handleLogStrategy({message:q(e),context:s,status:n},this)},e.prototype.debug=function(e,t,n){this.log(e,t,zt.debug,n)},e.prototype.info=function(e,t,n){this.log(e,t,zt.info,n)},e.prototype.warn=function(e,t,n){this.log(e,t,zt.warn,n)},e.prototype.error=function(e,t,n){this.log(e,t,zt.error,n)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.getContext=function(){return this.contextManager.get()},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.getHandler=function(){return this.handlerType},e.prototype.setLevel=function(e){this.level=e},e.prototype.getLevel=function(){return this.level},Ht([u],e.prototype,"log",null),e}(),$t="logs";function Xt(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var Zt,Kt={log:"log",configuration:"configuration"},Yt=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],Qt=["ddog-gov.com"],en={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function tn(e,t){var n,r=new F;en.telemetryEnabled=!d(Qt,t.site)&&ye(t.telemetrySampleRate),en.telemetryConfigurationEnabled=en.telemetryEnabled&&ye(t.telemetryConfigurationSampleRate);var i={is_local_file:"file:"===window.location.protocol,is_worker:"WorkerGlobalScope"in self};return Zt=function(t){if(en.telemetryEnabled){var o=function(e,t,r){return P({type:"telemetry",date:ee(),service:e,version:"4.49.0",source:"browser",_dd:{format_version:2},telemetry:P(t,{runtime_env:r}),experimental_features:v(he())},void 0!==n?n():{})}(e,t,i);r.notify(o),Xt("telemetry",o)}},o=rn,h(en,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:r,enabled:en.telemetryEnabled}}function nn(t,n){l(e.debug,t,n),on(h({type:Kt.log,message:t,status:"debug"},n))}function rn(e,t){on(h({type:Kt.log,status:"error"},function(e){if(e instanceof Error){var t=Et(e);return{error:{kind:t.name,stack:Nt(an(t))},message:t.message}}return{error:{stack:Pt},message:"".concat("Uncaught"," ").concat(I(e))}}(e),t))}function on(e){Zt&&en.sentEventCount<en.maxEventsPerPage&&(en.sentEventCount+=1,Zt(e))}function an(e){return e.stack=e.stack.filter((function(e){return!e.url||Yt.some((function(t){return g(e.url,t)}))})),e}var sn={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};var un="datadog-synthetics-public-id",cn="datadog-synthetics-result-id",fn="datadog-synthetics-injects-rum";function ln(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||ke(fn))}function dn(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||ke(cn);return"string"==typeof e?e:void 0}var vn=function(){function e(e,t,n){var r=this;this.request=e,this.flushController=t,this.messageBytesLimit=n,this.pushOnlyBuffer=[],this.upsertBuffer={},this.flushSubscription=this.flushController.flushObservable.subscribe((function(e){return r.flush(e)}))}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.stop=function(){this.flushSubscription.unsubscribe()},e.prototype.flush=function(e){var t=this.pushOnlyBuffer.concat(p(this.upsertBuffer));this.pushOnlyBuffer=[],this.upsertBuffer={};var n,r={data:t.join("\n"),bytesCount:e.bytesCount,flushReason:e.reason};n=e.reason,d(p(sn),n)?this.request.sendOnExit(r):this.request.send(r)},e.prototype.addOrUpdate=function(e,n){var r=this.process(e),o=r.processedMessage,i=r.messageBytesCount;i>=this.messageBytesLimit?t.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB.")):(this.hasMessageFor(n)&&this.remove(n),this.push(o,i,n))},e.prototype.process=function(e){var t=I(e);return{processedMessage:t,messageBytesCount:S(t)}},e.prototype.push=function(e,t,n){var r=this.flushController.messagesCount>0?1:0;this.flushController.notifyBeforeAddMessage(t+r),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.flushController.notifyAfterAddMessage()},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=S(t),r=this.flushController.messagesCount>1?1:0;this.flushController.notifyAfterRemoveMessage(n+r)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e}();function pn(e){return e>=500}var gn=80*m,hn=32,yn=3*b,mn=K,bn=Z;function wn(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?En(e,t,n,{onSuccess:function(){return xn(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),Sn(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function Sn(e,t,n,r){2===e.transportStatus&&x((function(){En(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=bn,xn(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(mn,2*e.currentBackoffTime),Sn(e,t,n,r)}})}),e.currentBackoffTime)}function En(e,t,n,r){var o=r.onSuccess,i=r.onFailure;t.bandwidthMonitor.add(e),n(e,(function(n){t.bandwidthMonitor.remove(e),!function(e){return"opaque"!==e.type&&(0===e.status&&!navigator.onLine||408===e.status||429===e.status||pn(e.status))}(n)?(t.transportStatus=0,o()):(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:n.status},i())}))}function xn(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(yn/b,"MiB"),source:Ft.AGENT,startClocks:ne()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=Cn();i.size()>0;)wn(i.dequeue(),t,n,r,o)}function Cn(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=yn}}}function _n(e,t,n,r){var o={transportStatus:0,currentBackoffTime:bn,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=gn&&this.ongoingRequestCount<hn},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:Cn(),queueFullReported:!1},i=function(r,o){return function(e,t,n,r,o){var i=r.data,a=r.bytesCount,s=r.flushReason,u=r.retry,f=function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&a<n;if(f){var l=t.build("fetch",s,u);fetch(l,{method:"POST",body:i,keepalive:!0,mode:"cors"}).then(c((function(e){return null==o?void 0:o({status:e.status,type:e.type})})),c((function(){var n=t.build("xhr",s,u);On(e,n,i,o)})))}else{var d=t.build("xhr",s,u);On(e,d,i,o)}}(e,t,n,r,o)};return{send:function(e){wn(e,o,i,t.endpointType,r)},sendOnExit:function(r){!function(e,t,n,r){var o=r.data,i=r.bytesCount,a=r.flushReason,s=!!navigator.sendBeacon&&i<n;if(s)try{var u=t.build("beacon",a);if(navigator.sendBeacon(u,o))return}catch(e){!function(e){kn||(kn=!0,rn(e))}(e)}var c=t.build("xhr",a);On(e,c,o)}(e,t,n,r)}}}var kn=!1;function On(e,t,n,r){var o=new XMLHttpRequest;o.open("POST",t,!0),se(e,o,"loadend",(function(){null==r||r({status:o.status})}),{once:!0}),o.send(n)}function Rn(e){var t,n=e.messagesLimit,r=e.bytesLimit,o=e.durationLimit,i=e.pageExitObservable,a=e.sessionExpireObservable,s=i.subscribe((function(e){return d(e.reason)})),u=a.subscribe((function(){return d("session_expire")})),c=new F((function(){return function(){s.unsubscribe(),u.unsubscribe()}})),f=0,l=0;function d(e){if(0!==l){var t=l,n=f;l=0,f=0,v(),c.notify({reason:e,messagesCount:t,bytesCount:n})}}function v(){C(t),t=void 0}return{flushObservable:c,get messagesCount(){return l},notifyBeforeAddMessage:function(e){f+e>=r&&d("bytes_limit"),l+=1,f+=e,void 0===t&&(t=x((function(){d("duration_limit")}),o))},notifyAfterAddMessage:function(){l>=n?d("messages_limit"):f>=r&&d("bytes_limit")},notifyAfterRemoveMessage:function(e){f-=e,0===(l-=1)&&v()}}}function Tn(e,t,n,r,o,i){var a=u(e,t.endpoint),s=n&&u(e,n.endpoint);function u(e,t){return new vn(_n(e,t,e.batchBytesLimit,r),Rn({messagesLimit:e.batchMessagesLimit,bytesLimit:e.batchBytesLimit,durationLimit:e.flushTimeout,pageExitObservable:o,sessionExpireObservable:i}),e.messageBytesLimit)}return{flushObservable:a.flushController.flushObservable,add:function(e,t){void 0===t&&(t=!0),a.add(e),s&&t&&s.add(n.transformMessage?n.transformMessage(e):e)},upsert:function(e,t){a.upsert(e,t),s&&s.upsert(n.transformMessage?n.transformMessage(e):e,t)},stop:function(){a.stop(),null==s||s.stop()}}}var Ln=1/0,An=K,Pn=function(){function e(e,t){var n=this;this.expireDelay=e,this.maxEntries=t,this.entries=[],this.clearOldValuesInterval=_((function(){return n.clearOldValues()}),An)}return e.prototype.add=function(e,t){var n=this,r={value:e,startTime:t,endTime:Ln,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.maxEntries&&this.entries.length>=this.maxEntries&&this.entries.pop(),this.entries.unshift(r),r},e.prototype.find=function(e){void 0===e&&(e=Ln);for(var t=0,n=this.entries;t<n.length;t++){var r=n[t];if(r.startTime<=e){if(e<=r.endTime)return r.value;break}}},e.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===Ln&&t.close(e)},e.prototype.findAll=function(e,t){void 0===e&&(e=Ln),void 0===t&&(t=0);var n=re(e,t);return this.entries.filter((function(t){return t.startTime<=n&&e<=t.endTime})).map((function(e){return e.value}))},e.prototype.reset=function(){this.entries=[]},e.prototype.stop=function(){k(this.clearOldValuesInterval)},e.prototype.clearOldValues=function(){for(var e=te()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}(),In=K,Bn=xe,Nn=[];function Mn(e,t,n){var r=ot(e.sessionStoreStrategyType,t,n);Nn.push((function(){return r.stop()}));var o,i=new Pn(Bn);function a(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return Nn.push((function(){return i.stop()})),r.renewObservable.subscribe((function(){i.add(a(),te())})),r.expireObservable.subscribe((function(){i.closeActive(te())})),r.expandOrRenewSession(),i.add(a(),[0,oe()][0]),o=ue(0,window,["click","touchstart","keydown","scroll"],(function(){return r.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,Nn.push(o),function(e,t){var n=function(){"visible"===document.visibilityState&&t()},r=se(e,document,"visibilitychange",n).stop;Nn.push(r);var o=_(n,In);Nn.push((function(){k(o)}))}(e,(function(){return r.expandSession()})),{findActiveSession:function(e){return i.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable,expire:r.expire}}var Un,qn="logs";function jn(e){var t=Mn(e,qn,(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:Dn(e);return{trackingType:n,isTracked:"1"===n}}(e,t)}));return{findTrackedSession:function(e){var n=t.findActiveSession(e);return n&&"1"===n.trackingType?{id:n.id}:void 0},expireObservable:t.expireObservable}}function Dn(e){return ye(e.sessionSampleRate)?"1":"0"}var Gn=((Un={})[zt.debug]=0,Un[zt.info]=1,Un[zt.warn]=2,Un[zt.error]=3,Un);function Fn(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return Gn[e]>=Gn[n.getLevel()]&&d(o,t)}function Hn(e,t,n,r,o,i){var a=Vt.concat(["custom"]),s={};a.forEach((function(e){var n,r,o,a,u;s[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,a=0,u=!1,{isLimitReached:function(){if(0===a&&x((function(){a=0}),K),(a+=1)<=r||u)return u=!1,!1;if(a===r+1){u=!0;try{o({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:Ft.AGENT,startClocks:ne()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(i){var a,u,c,f=i.rawLogsEvent,l=i.messageContext,d=void 0===l?void 0:l,v=i.savedCommonContext,p=void 0===v?void 0:v,g=i.logger,h=void 0===g?o:g,y=f.date-oe(),m=e.findTrackedSession(y);if(m){var b=p||r(),w=P({service:t.service,session_id:m.id,usr:be(b.user)?void 0:b.user,view:b.view},b.context,Jn(y),f,h.getContext(),d);!Fn(f.status,Jt.http,h)||!1===(null===(a=t.beforeSend)||void 0===a?void 0:a.call(t,w))||(null===(u=w.error)||void 0===u?void 0:u.origin)!==Ft.AGENT&&(null!==(c=s[w.status])&&void 0!==c?c:s.custom).isLimitReached()||n.notify(1,w)}}))}var zn=!1;function Jn(e){var t,n=window;if(ln()){var r=o(n.DD_RUM_SYNTHETICS);return r||zn||(zn=!0,nn("Logs sent before RUM is injected by the synthetics worker",{testId:(t=window._DATADOG_SYNTHETICS_PUBLIC_ID||ke(un),"string"==typeof t?t:void 0),resultId:dn()})),r}return o(n.DD_RUM);function o(t){if(t&&t.getInternalContext)return t.getInternalContext(e)}}var Vn,Wn={};function $n(t){var r=t.map((function(t){return Wn[t]||(Wn[t]=function(t){var r=new F((function(){var o=n[t];return n[t]=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];o.apply(console,n);var a=function(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return f((function(){var n=Et(t);n.stack=n.stack.slice(2),e=Nt(n)})),e}();f((function(){r.notify(function(t,n,r){var o,i,a=t.map((function(e){return function(e){if("string"==typeof e)return q(e);if(e instanceof Error)return Mt(Et(e));return I(q(e),void 0,2)}(e)})).join(" ");if(n===e.error){var s=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}(t,(function(e){return e instanceof Error}));o=s?Nt(Et(s)):void 0,i=Bt(s),a="console error: ".concat(a)}return{api:n,message:a,stack:o,handlingStack:r,fingerprint:i}}(n,t,a))}))},function(){n[t]=o}}));return r}(t)),Wn[t]}));return H.apply(void 0,r)}var Xn,Zn=((Vn={})[e.log]=zt.info,Vn[e.debug]=zt.debug,Vn[e.info]=zt.info,Vn[e.warn]=zt.warn,Vn[e.error]=zt.error,Vn);var Kn,Yn=((Xn={})[Ut.cspViolation]=zt.error,Xn[Ut.intervention]=zt.error,Xn[Ut.deprecation]=zt.warn,Xn);function Qn(e,t,n){var r=e[t],o=n(r),i=function(){if("function"==typeof o)return o.apply(this,arguments)};return e[t]=i,{stop:function(){e[t]===i?e[t]=r:o=r}}}function er(e,t,n){var r=n.before,o=n.after;return Qn(e,t,(function(e){return function(){var t,n=arguments;return r&&f(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&f(o,this,n),t}}))}var tr,nr=new WeakMap;function rr(e){return Kn||(Kn=function(e){var t=new F((function(){var n=er(XMLHttpRequest.prototype,"open",{before:or}).stop,r=er(XMLHttpRequest.prototype,"send",{before:function(){ir.call(this,e,t)}}).stop,o=er(XMLHttpRequest.prototype,"abort",{before:ar}).stop;return function(){n(),r(),o()}}));return t}(e)),Kn}function or(e,t){nr.set(this,{state:"open",method:e,url:it(String(t))})}function ir(e,t){var n=this,r=nr.get(this);if(r){var o=r;o.state="start",o.startTime=te(),o.startClocks=ne(),o.isAborted=!1,o.xhr=this;var i=!1,a=er(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&s()}}).stop,s=function(){if(u(),a(),!i){i=!0;var e,s=r;s.state="complete",s.duration=(e=o.startClocks.timeStamp,ee()-e),s.status=n.status,t.notify(h({},s))}},u=se(e,this,"loadend",s).stop;t.notify(o)}}function ar(){var e=nr.get(this);e&&(e.isAborted=!0)}function sr(){var e;return tr||(e=new F((function(){if(window.fetch)return Qn(window,"fetch",(function(t){return function(n,r){var o,i=f(ur,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),f(cr,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),tr=e),tr}function ur(e,t,n){var r=n&&n.method||t instanceof Request&&t.method||"GET",o=t instanceof Request?t.url:it(String(t)),i={state:"start",init:n,input:t,method:r,startClocks:ne(),url:o};return e.notify(i),i}function cr(e,t,n){var r=function(t){var r=n;r.state="resolve","stack"in t||t instanceof Error?(r.status=0,r.isAborted=t instanceof DOMException&&t.code===DOMException.ABORT_ERR,r.error=t):"status"in t&&(r.response=t,r.responseType=t.type,r.status=t.status,r.isAborted=!1),e.notify(r)};t.then(c(r),c(r))}function fr(e,t){if(!e.forwardErrorsToLogs)return{stop:R};var n=rr(e).subscribe((function(e){"complete"===e.state&&o("xhr",e)})),r=sr().subscribe((function(e){"resolve"===e.state&&o("fetch",e)}));function o(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(dr(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:Ft.NETWORK,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:zt.error,origin:Ft.NETWORK}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!pn(r.status)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(lr(e.response,t)):n(e.response)}(r.xhr,e,o):r.response?function(e,t,n){var r=function(e){try{return e.clone()}catch(e){return}}(e);r&&r.body?window.TextDecoder?function(e,t,n){!function(e,t,n){var r=e.getReader(),o=[],i=0;function a(){var e,a;if(r.cancel().catch(R),n.collectStreamBody){var s;if(1===o.length)s=o[0];else{s=new Uint8Array(i);var u=0;o.forEach((function(e){s.set(e,u),u+=e.length}))}e=s.slice(0,n.bytesLimit),a=s.length>n.bytesLimit}t(void 0,e,a)}!function e(){r.read().then(c((function(t){t.done?a():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?a():e())})),c((function(e){return t(e)})))}()}(e,(function(e,t,r){if(e)n(e);else{var o=(new TextDecoder).decode(t);r&&(o+="..."),n(void 0,o)}}),{bytesLimit:t,collectStreamBody:!0})}(r.body,t.requestErrorResponseLengthLimit,(function(e,t){n(e?"Unable to retrieve response: ".concat(e):t)})):r.text().then(c((function(e){return n(lr(e,t))})),c((function(e){return n("Unable to retrieve response: ".concat(e))}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(lr(Nt(Et(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function lr(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function dr(e){return"xhr"===e?"XHR":"Fetch"}var vr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function pr(e){var t=function(e){return er(window,"onerror",{before:function(t,n,r,o,i){var a;if(i instanceof Error)a=Et(i);else{var s=[{url:n,column:o,line:r}],u=function(e){var t,n,r;"[object String]"==={}.toString.call(e)&&(n=(t=vr.exec(e))[1],r=t[2]);return{name:n,message:r}}(t);a={name:u.name,message:u.message,stack:s}}e(a,null!=i?i:t)}})}(e).stop,n=function(e){return er(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=Et(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}function gr(e,t){if(!e.forwardErrorsToLogs)return{stop:R};var n,r=new F,o=(n=r,pr((function(e,t){n.notify(It({stackTrace:e,originalError:t,startClocks:ne(),nonErrorPrefix:"Uncaught",source:Ft.SOURCE,handling:"unhandled"}))}))).stop,i=r.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:Ft.SOURCE,stack:e.stack},origin:Ft.SOURCE,status:zt.error}})}));return{stop:function(){o(),i.unsubscribe()}}}var hr=function(){function e(){this.callbacks={}}return e.prototype.notify=function(e,t){var n=this.callbacks[e];n&&n.forEach((function(e){return e(t)}))},e.prototype.subscribe=function(e,t){var n=this;return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),{unsubscribe:function(){n.callbacks[e]=n.callbacks[e].filter((function(e){return t!==e}))}}},e}();var yr,mr,br,wr,Sr=function(n){var r,o,i=!1,a=W(2),u=W(1),f={},l=function(){},v=new X,g=function(e,t,n,r){void 0===n&&(n=A(b())),void 0===r&&(r=ee()),v.add((function(){return g(e,t,n,r)}))},y=function(){},m=new Wt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g.apply(void 0,e)}));function b(){return{view:{referrer:document.referrer,url:window.location.href},context:a.getContext(),user:u.getContext()}}return r={logger:m,init:c((function(r){var o;if(r){if(y=function(){return A(r)},ae()&&(r=function(e){return h({},e,{clientToken:"empty"})}(r)),function(e){return!i||(e.silentMultipleInit||t.error("DD_LOGS is already initialized."),!1)}(r)){var s=function(t){var n=wt(t),r=Gt(t.forwardConsoleLogs,p(e),"Forward Console Logs"),o=Gt(t.forwardReports,p(Ut),"Forward Reports");if(n&&r&&o)return t.forwardErrorsToLogs&&!d(r,e.error)&&r.push(e.error),h({forwardErrorsToLogs:!1!==t.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:Dt},n)}(r);if(s){if(r.storeContextsAcrossPages){var c=a.getContext();(a=de(s,$t,2)).setContext(P(a.getContext(),c));var f=u.getContext();(u=de(s,$t,1)).setContext(P(u.getContext(),f))}o=n(r,s,b,m),g=o.handleLog,l=o.getInternalContext,v.drain(),i=!0}}}else t.error("Missing configuration")})),getLoggerGlobalContext:c((function(){return a.get()})),getGlobalContext:c((function(){return a.getContext()})),setLoggerGlobalContext:c((function(e){return a.set(e)})),setGlobalContext:c((function(e){return a.setContext(e)})),addLoggerGlobalContext:c((function(e,t){return a.add(e,t)})),setGlobalContextProperty:c((function(e,t){return a.setContextProperty(e,t)})),removeLoggerGlobalContext:c((function(e){return a.remove(e)})),removeGlobalContextProperty:c((function(e){return a.removeContextProperty(e)})),clearGlobalContext:c((function(){return a.clearContext()})),createLogger:c((function(e,t){return void 0===t&&(t={}),f[e]=new Wt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g.apply(void 0,e)}),q(e),t.handler,t.level,q(t.context)),f[e]})),getLogger:c((function(e){return f[e]})),getInitConfiguration:c((function(){return y()})),getInternalContext:c((function(e){return l(e)})),setUser:c((function(e){(function(e){var n="object"===T(e);return n||t.error("Unsupported user:",e),n})(e)&&u.setContext(ve(e))})),getUser:c((function(){return u.getContext()})),setUserProperty:c((function(e,t){var n,r=ve((n={},n[e]=t,n))[e];u.setContextProperty(e,r)})),removeUserProperty:c((function(e){return u.removeContextProperty(e)})),clearUser:c((function(){return u.clearContext()}))},o=h({version:"4.49.0",onReady:function(e){e()}},r),Object.defineProperty(o,"_setDebug",{get:function(){return s},enumerable:!1}),o}((function(n,r,o,i){var a=new hr,s=[];a.subscribe(1,(function(e){return Xt("logs",e)}));var u=function(e){a.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:Ft.AGENT},origin:Ft.AGENT,status:zt.error}}),nn("Error reported to customer",{"error.message":e.message})},c=function(e){var t=new F((function(){var n=ge(ce.PAGEHIDE),r=ue(0,window,["visibilitychange","freeze","pagehide"],(function(e){"pagehide"===e.type&&n?t.notify({reason:sn.PAGEHIDE}):"visibilitychange"===e.type&&"hidden"===document.visibilityState?t.notify({reason:sn.HIDDEN}):"freeze"===e.type&&t.notify({reason:sn.FROZEN})}),{capture:!0}).stop,o=R;return n||(o=se(e,window,"beforeunload",(function(){t.notify({reason:sn.UNLOADING})})).stop),function(){r(),o()}}));return t}(r),f=!r.sessionStoreStrategyType||ae()||ln()?function(e){var t="1"===Dn(e)?{}:void 0;return{findTrackedSession:function(){return t},expireObservable:new F}}(r):jn(r),l=function(e,t,n,r){var o=tn("browser-logs-sdk",e),i=[];if(ae()){var a=ie(),s=o.observable.subscribe((function(e){return a.send("internal_telemetry",e)}));i.push((function(){return s.unsubscribe()}))}else{var u=Tn(e,{endpoint:e.rumEndpointBuilder},e.replica&&{endpoint:e.replica.rumEndpointBuilder},t,n,r);i.push((function(){return u.stop()}));var c=o.observable.subscribe((function(t){return u.add(t,function(e){return e.site===ft}(e))}));i.push((function(){return c.unsubscribe()}))}return{telemetry:o,stop:function(){i.forEach((function(e){return e()}))}}}(r,u,c,f.expireObservable),d=l.telemetry,v=l.stop;s.push((function(){return v()})),d.setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=Jn())||void 0===e?void 0:e.application_id},session:{id:null===(t=f.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=Jn())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=Jn())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),fr(r,a),gr(r,a),function(t,n){var r=$n(t.forwardConsoleLogs).subscribe((function(t){n.notify(0,{rawLogsEvent:{date:ee(),message:t.message,origin:Ft.CONSOLE,error:t.api===e.error?{origin:Ft.CONSOLE,stack:t.stack,fingerprint:t.fingerprint}:void 0,status:Zn[t.api]}})}))}(r,a),function(e,t){var n=qt(e,e.forwardReports).subscribe((function(e){var n,r=e.message,o=Yn[e.type];o===zt.error?n={kind:e.subtype,origin:Ft.REPORT,stack:e.stack}:e.stack&&(r+=" Found in ".concat(function(e){var t;return null===(t=/@ (.+)/.exec(e))||void 0===t?void 0:t[1]}(e.stack))),t.notify(0,{rawLogsEvent:{date:ee(),message:r,origin:Ft.REPORT,error:n,status:o}})}))}(r,a);var p,g=function(e){return{handleLog:function(n,r,o,i){var a=n.context;Fn(n.status,Jt.console,r)&&t(n.status,n.message,P(r.getContext(),a)),e.notify(0,{rawLogsEvent:{date:i||ee(),message:n.message,status:n.status,origin:Ft.LOGGER},messageContext:a,savedCommonContext:o,logger:r})}}}(a).handleLog;if(Hn(f,r,a,o,i,u),ae())!function(e){var t=ie();e.subscribe(1,(function(e){t.send("log",e)}))}(a);else{var y=function(e,t,n,r,o){var i=Tn(e,{endpoint:e.logsEndpointBuilder},e.replica&&{endpoint:e.replica.logsEndpointBuilder},n,r,o);return t.subscribe(1,(function(e){i.add(e)})),i}(r,a,u,c,f.expireObservable).stop;s.push((function(){return y()}))}return function(e){en.telemetryConfigurationEnabled&&on({type:Kt.configuration,configuration:e})}(function(e){var t=function(e){var t,n,r=null!==(t=e.proxy)&&void 0!==t?t:e.proxyUrl;return{session_sample_rate:null!==(n=e.sessionSampleRate)&&void 0!==n?n:e.sampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,use_before_send:!!e.beforeSend,use_cross_site_session_cookie:e.useCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:void 0!==r?!!r:void 0,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_resources:e.trackResources,track_long_task:e.trackLongTasks,allow_fallback_to_local_storage:!!e.allowFallbackToLocalStorage,store_contexts_across_pages:!!e.storeContextsAcrossPages}}(e);return h({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(n)),{handleLog:g,getInternalContext:(p=f,{get:function(e){var t=p.findTrackedSession(e);if(t)return{session_id:t.id}}}).get,stop:function(){s.forEach((function(e){return e()}))}}}));yr=y(),br=Sr,wr=yr[mr="DD_LOGS"],yr[mr]=br,wr&&wr.q&&wr.q.forEach((function(e){return r(e,"onReady callback threw an error:")()}))}();
!function(){"use strict";var e={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},t=function(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];Object.prototype.hasOwnProperty.call(e,n)||(n=e.log),t[n].apply(t,r)},n=console,r="Datadog Browser SDK:";function o(e,n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];try{return e.apply(void 0,r)}catch(e){t.error(n,e)}}}t.debug=n.debug.bind(n,r),t.log=n.log.bind(n,r),t.info=n.info.bind(n,r),t.warn=n.warn.bind(n,r),t.error=n.error.bind(n,r);var i,a=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},s=!1;function u(e){s=e}function c(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(i?f(r):r).apply(this,e)}}function f(e){return function(){return l(e,this,arguments)}}function l(t,n,r){try{return t.apply(n,r)}catch(t){if(d(e.error,t),i)try{i(t)}catch(t){d(e.error,t)}}}function d(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];s&&t.apply(void 0,a([e,"[MONITOR]"],n,!1))}function v(e,t){return-1!==e.indexOf(t)}function p(e){if(Array.from)return Array.from(e);var t=[];if(e instanceof Set)e.forEach((function(e){return t.push(e)}));else for(var n=0;n<e.length;n++)t.push(e[n]);return t}function g(e){return Object.keys(e).map((function(t){return e[t]}))}function h(e,t){return e.slice(0,t.length)===t}function y(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}function m(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}var b=1024,w=1024*b,S=/[^\u0000-\u007F]/;function E(e){return S.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}function x(e,t){var n,r=m();return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function C(e,t){return x(m(),"setTimeout")(f(e),t)}function _(e){x(m(),"clearTimeout")(e)}function k(e,t){return x(m(),"setInterval")(f(e),t)}function O(e){x(m(),"clearInterval")(e)}function R(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,a=!n||void 0===n.trailing||n.trailing,s=!1;return{throttled:function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];s?r=n:(i?e.apply(void 0,n):r=n,s=!0,o=C((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){_(o),s=!1,r=void 0}}}function T(){}function L(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function A(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=A(o[i],t[i],n);return o}var a="object"===L(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=A(a[s],t[s],n));return a}}function I(e){return A(void 0,e)}function P(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];null!=i&&(e=A(e,i))}return e}function B(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=N(Object.prototype),o=N(Array.prototype),i=N(Object.getPrototypeOf(e)),a=N(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}}function N(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):T}var M=220*b,U="$",q=3;function j(e,t){var n;void 0===t&&(t=M);var r=N(Object.prototype),o=N(Array.prototype),i=[],a=new WeakMap,s=D(e,U,void 0,i,a),u=(null===(n=JSON.stringify(s))||void 0===n?void 0:n.length)||0;if(!(u>t)){for(;i.length>0&&u<t;){var c=i.shift(),f=0;if(Array.isArray(c.source))for(var l=0;l<c.source.length;l++){if(u+=void 0!==(d=D(c.source[l],c.path,l,i,a))?JSON.stringify(d).length:4,u+=f,f=1,u>t){G(t,"truncated",e);break}c.target[l]=d}else for(var l in c.source)if(Object.prototype.hasOwnProperty.call(c.source,l)){var d;if(void 0!==(d=D(c.source[l],c.path,l,i,a))&&(u+=JSON.stringify(d).length+f+l.length+q,f=1),u>t){G(t,"truncated",e);break}c.target[l]=d}}return r(),o(),s}G(t,"discarded",e)}function D(e,t,n,r,o){var i=function(e){var t=e;if(t&&"function"==typeof t.toJSON)try{return t.toJSON()}catch(e){}return e}(e);if(!i||"object"!=typeof i)return function(e){if("bigint"==typeof e)return"[BigInt] ".concat(e.toString());if("function"==typeof e)return"[Function] ".concat(e.name||"unknown");if("symbol"==typeof e)return"[Symbol] ".concat(e.description||e.toString());return e}(i);var a=function(e){try{if(e instanceof Event)return{isTrusted:e.isTrusted};var t=Object.prototype.toString.call(e).match(/\[object (.*)\]/);if(t&&t[1])return"[".concat(t[1],"]")}catch(e){}return"[Unserializable]"}(i);if("[Object]"!==a&&"[Array]"!==a&&"[Error]"!==a)return a;var s=e;if(o.has(s))return"[Reference seen at ".concat(o.get(s),"]");var u=void 0!==n?"".concat(t,".").concat(n):t,c=Array.isArray(i)?[]:{};return o.set(s,u),r.push({source:i,target:c,path:u}),c}function G(e,n,r){t.warn("The data provided has been ".concat(n," as it is over the limit of ").concat(e," characters:"),r)}var F,H=function(){function e(e){this.onFirstSubscribe=e,this.observers=[]}return e.prototype.subscribe=function(e){var t=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e),{unsubscribe:function(){t.observers=t.observers.filter((function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function z(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new H((function(){var t=e.map((function(e){return e.subscribe((function(e){return n.notify(e)}))}));return function(){return t.forEach((function(e){return e.unsubscribe()}))}}));return n}var J=3*b,V=((F={})[0]="feature flag evaluation",F[1]="user",F[2]="global context",F[3]="logger context",F);var W=200;function $(e,n){void 0===n&&(n=E);var r,o={},i=!1,a=new H,s=R((function(o){r=n(B(o)),i||(i=function(e,n){return e>J&&(t.warn("The ".concat(V[n]," data exceeds the recommended ").concat(J/b,"KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-3kib-warning")),!0)}(r,e))}),W).throttled,u={getBytesCount:function(){return r},get:function(){return o},add:function(e,t){o[e]=t,s(o),a.notify()},remove:function(e){delete o[e],s(o),a.notify()},set:function(e){s(o=e),a.notify()},getContext:function(){return I(o)},setContext:function(e){"object"===L(e)?(o=j(e),s(o)):u.clearContext(),a.notify()},setContextProperty:function(e,t){o[e]=j(t),s(o),a.notify()},removeContextProperty:function(e){delete o[e],s(o),a.notify()},clearContext:function(){o={},r=0,a.notify()},changeObservable:a};return u}var X,K=function(){function e(){this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},e.prototype.drain=function(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},e}(),Z=1e3,Y=60*Z,Q=60*Y;function ee(){return(new Date).getTime()}function te(){return ee()}function ne(){return performance.now()}function re(){return{relative:ne(),timeStamp:te()}}function oe(e,t){return e+t}function ie(){return void 0===X&&(X=performance.timing.navigationStart),X}function ae(){var e=m().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function se(e){var t;void 0===e&&(e=null===(t=m().location)||void 0===t?void 0:t.hostname);var n=ae();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}function ue(e,t,n,r,o){return ce(e,t,[n],r,o)}function ce(e,t,n,r,o){var i=void 0===o?{}:o,a=i.once,s=i.capture,u=i.passive,c=f(a?function(e){v(),r(e)}:r),l=u?{capture:s,passive:u}:s,d=x(t,"addEventListener");function v(){var e=x(t,"removeEventListener");n.forEach((function(n){return e.call(t,n,c,l)}))}return n.forEach((function(e){return d.call(t,e,c,l)})),{stop:v}}var fe,le="_dd_c",de=[];function ve(e,t,n,r){void 0===r&&(r=E);var o=function(e,t){return"".concat(le,"_").concat(e,"_").concat(t)}(t,n),i=$(n,r);return a(),de.push(ue(e,window,"storage",(function(e){var t=e.key;o===t&&a()}))),i.changeObservable.subscribe((function(){localStorage.setItem(o,JSON.stringify(i.getContext()))})),i;function a(){var e=localStorage.getItem(o),t=null!==e?JSON.parse(e):{};i.setContext(t)}}function pe(e){var t=y({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t}!function(e){e.PAGEHIDE="pagehide",e.FEATURE_FLAGS="feature_flags",e.RESOURCE_PAGE_STATES="resource_page_states",e.PAGE_STATES="page_states",e.COLLECT_FLUSH_REASON="collect_flush_reason",e.NO_RESOURCE_DURATION_FROZEN_STATE="no_resource_duration_frozen_state",e.SCROLLMAP="scrollmap",e.INTERACTION_TO_NEXT_PAINT="interaction_to_next_paint",e.WEB_VITALS_ATTRIBUTION="web_vitals_attribution",e.DISABLE_REPLAY_INLINE_CSS="disable_replay_inline_css"}(fe||(fe={}));var ge=new Set;function he(e){return ge.has(e)}function ye(){return ge}function me(e){return 0!==e&&100*Math.random()<=e}function be(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100}function we(e){return 0===Object.keys(e).length}function Se(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,Se)}function Ee(e,t,n){void 0===n&&(n="");var r=e.charCodeAt(t-1),o=r>=55296&&r<=56319?t+1:t;return e.length<=o?e:"".concat(e.slice(0,o)).concat(n)}var xe,Ce=4*Q,_e=15*Y;function ke(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires=".concat(o.toUTCString()),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain=".concat(r.domain):"",u=r&&r.secure?";secure":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(s).concat(u)}function Oe(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*".concat(t,"\\s*=\\s*([^;]+)")).exec(e);return n?n[1]:void 0}(document.cookie,e)}function Re(e,t){ke(e,"",0,t)}var Te="_dd_s",Le=/^([a-z]+)=([a-z0-9-]+)$/,Ae="&";function Ie(e){return we(e)}function Pe(e){e.expire=String(ee()+_e)}function Be(e){return(t=e,Object.keys(t).map((function(e){return[e,t[e]]}))).map((function(e){var t=e[0],n=e[1];return"".concat(t,"=").concat(n)})).join(Ae);var t}function Ne(e){var t={};return function(e){return!!e&&(-1!==e.indexOf(Ae)||Le.test(e))}(e)&&e.split(Ae).forEach((function(e){var n=Le.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}var Me="_dd",Ue="_dd_r",qe="_dd_l",je="rum",De="logs";function Ge(e){var n=function(e){var t={};t.secure=!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie,t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===xe){for(var e="dd_site_test_".concat(Se()),t=window.location.hostname.split("."),n=t.pop();t.length&&!Oe(e);)n="".concat(t.pop(),".").concat(n),ke(e,"test",Z,{domain:n});Re(e,{domain:n}),xe=n}return xe}());return t}(e);return function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var n="dd_cookie_test_".concat(Se()),r="test";ke(n,r,Y,e);var o=Oe(n)===r;return Re(n,e),o}catch(e){return t.error(e),!1}}(n)?{type:"Cookie",cookieOptions:n}:void 0}function Fe(e){var t,n={isLockEnabled:!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent),persistSession:(t=e,function(e){ke(Te,Be(e),_e,t)}),retrieveSession:He,clearSession:ze(e)};return function(e){if(!Oe(Te)){var t=Oe(Me),n=Oe(Ue),r=Oe(qe),o={};t&&(o.id=t),r&&/^[01]$/.test(r)&&(o[De]=r),n&&/^[012]$/.test(n)&&(o[je]=n),Ie(o)||(Pe(o),e.persistSession(o))}}(n),n}function He(){return Ne(Oe(Te))}function ze(e){return function(){Re(Te,e)}}var Je="_dd_test_";function Ve(e){localStorage.setItem(Te,Be(e))}function We(){return Ne(localStorage.getItem(Te))}function $e(){localStorage.removeItem(Te)}var Xe,Ke=10,Ze=100,Ye=[];function Qe(e,t,n){var r;void 0===n&&(n=0);var o=t.isLockEnabled,i=t.retrieveSession,a=t.persistSession,s=t.clearSession;if(Xe||(Xe=e),e===Xe)if(o&&n>=Ze)tt(t);else{var u,c=i();if(o){if(c.lock)return void et(e,t,n);if(u=Se(),c.lock=u,a(c),(c=i()).lock!==u)return void et(e,t,n)}var f=e.process(c);if(o&&(c=i()).lock!==u)et(e,t,n);else{if(f&&(Ie(f)?s():(Pe(f),a(f))),o&&(!f||!Ie(f))){if((c=i()).lock!==u)return void et(e,t,n);delete c.lock,a(c),f=c}null===(r=e.after)||void 0===r||r.call(e,f||c),tt(t)}}else Ye.push(e)}function et(e,t,n){C((function(){Qe(e,t,n+1)}),Ke)}function tt(e){Xe=void 0;var t=Ye.shift();t&&Qe(t,e)}var nt=Z;function rt(e){var t=Ge(e);return!t&&e.allowFallbackToLocalStorage&&(t=function(){try{var e=Se(),t="".concat(Je).concat(e);localStorage.setItem(t,e);var n=localStorage.getItem(t);return localStorage.removeItem(t),e===n?{type:"LocalStorage"}:void 0}catch(e){return}}()),t}function ot(e,t,n){var r=new H,o=new H,i="Cookie"===e.type?Fe(e.cookieOptions):{isLockEnabled:!1,persistSession:Ve,retrieveSession:We,clearSession:$e},a=i.clearSession,s=i.retrieveSession,u=k((function(){Qe({process:function(e){return d(e)?void 0:{}},after:f},i)}),nt),c=function(){var e=s();if(d(e))return e;return{}}();function f(e){return d(e)||(e={}),l()&&(!function(e){return c.id!==e.id||c[t]!==e[t]}(e)?c=e:(c={},o.notify())),e}function l(){return void 0!==c[t]}function d(e){return(void 0===e.created||ee()-Number(e.created)<Ce)&&(void 0===e.expire||ee()<Number(e.expire))}return{expandOrRenewSession:R((function(){var e;Qe({process:function(r){var o=f(r);return e=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;e[t]=o,i&&!e.id&&(e.id=Se(),e.created=String(ee()));return i}(o),o},after:function(t){e&&!l()&&function(e){c=e,r.notify()}(t),c=t}},i)}),nt).throttled,expandSession:function(){Qe({process:function(e){return l()?f(e):void 0}},i)},getSession:function(){return c},renewObservable:r,expireObservable:o,expire:function(){a(),f({})},stop:function(){O(u)}}}function it(e){return at(e,ct(window.location)).href}function at(e,t){var n=function(){if(void 0===st)try{var e=new ut("http://test/path");st="http://test/path"===e.href}catch(e){st=!1}return st?ut:void 0}();if(n)try{return void 0!==t?new n(e,t):new n(e)}catch(n){throw new Error("Failed to construct URL: ".concat(String(n)," ").concat(B({url:e,base:t})))}if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var r=document,o=r.createElement("a");if(void 0!==t){var i=(r=document.implementation.createHTMLDocument("")).createElement("base");i.href=t,r.head.appendChild(i),r.body.appendChild(o)}return o.href=e,o}var st,ut=URL;function ct(e){if(e.origin&&"null"!==e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}var ft="datad0g.com",lt="datadoghq.com",dt="ap1.datadoghq.com",vt={logs:"logs",rum:"rum",sessionReplay:"session-replay"},pt={logs:"logs",rum:"rum",sessionReplay:"replay"};function gt(e,t,n){var r=function(e,t){var n="/api/v2/".concat(pt[t]),r=e.proxy,o=e.proxyUrl;if(r){var i=it(r);return function(e){return"".concat(i,"?ddforward=").concat(encodeURIComponent("".concat(n,"?").concat(e)))}}var a=function(e,t){var n=e.site,r=void 0===n?lt:n,o=e.internalAnalyticsSubdomain;if(o&&r===lt)return"".concat(o,".").concat(lt);var i=r.split("."),a=i.pop(),s=r!==dt?"".concat(vt[t],"."):"";return"".concat(s,"browser-intake-").concat(i.join("-"),".").concat(a)}(e,t);if(void 0===r&&o){var s=it(o);return function(e){return"".concat(s,"?ddforward=").concat(encodeURIComponent("https://".concat(a).concat(n,"?").concat(e)))}}return function(e){return"https://".concat(a).concat(n,"?").concat(e)}}(e,t);return{build:function(o,i){var a=function(e,t,n,r,o){var i=e.clientToken,a=e.internalAnalyticsSubdomain,s=o.retry,u=o.flushReason,c=o.encoding,f=["sdk_version:".concat("4.50.0"),"api:".concat(r)].concat(n);u&&he(fe.COLLECT_FLUSH_REASON)&&f.push("flush_reason:".concat(u));s&&f.push("retry_count:".concat(s.count),"retry_after:".concat(s.lastFailureStatus));var l=["ddsource=browser","ddtags=".concat(encodeURIComponent(f.join(","))),"dd-api-key=".concat(i),"dd-evp-origin-version=".concat(encodeURIComponent("4.50.0")),"dd-evp-origin=browser","dd-request-id=".concat(Se())];c&&l.push("dd-evp-encoding=".concat(c));"rum"===t&&l.push("batch_time=".concat(te()));a&&l.reverse();return l.join("&")}(e,t,n,o,i);return r(a)},urlPrefix:r(""),endpointType:t}}var ht=200;var yt=/[^a-z0-9_:./-]/;function mt(e,n){var r=ht-e.length-1;(n.length>r||yt.test(n))&&t.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var o=n.replace(/,/g,"_");return"".concat(e,":").concat(o)}function bt(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(mt("env",t)),n&&i.push(mt("service",n)),r&&i.push(mt("version",r)),o&&i.push(mt("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:gt(e,"logs",t),rumEndpointBuilder:gt(e,"rum",t),sessionReplayEndpointBuilder:gt(e,"sessionReplay",t)}}(e,t),r=g(n).map((function(e){return e.urlPrefix})),o=function(e,t,n){if(!e.replica)return;var r=y({},e,{site:lt,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:gt(r,"logs",n),rumEndpointBuilder:gt(r,"rum",n)};return t.push.apply(t,g(o).map((function(e){return e.urlPrefix}))),y({applicationId:e.replica.applicationId},o)}(e,r,t);return y({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||lt},n)}function wt(e){var n,r,i;if(e&&e.clientToken){var a=null!==(n=e.sessionSampleRate)&&void 0!==n?n:e.sampleRate;if(void 0===a||be(a))if(void 0===e.telemetrySampleRate||be(e.telemetrySampleRate)){if(void 0===e.telemetryConfigurationSampleRate||be(e.telemetryConfigurationSampleRate))return Array.isArray(e.enableExperimentalFeatures)&&e.enableExperimentalFeatures.filter((function(e){return t=fe,n=e,Object.keys(t).some((function(e){return t[e]===n}));var t,n})).forEach((function(e){ge.add(e)})),y({beforeSend:e.beforeSend&&o(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:rt(e),sessionSampleRate:null!=a?a:100,telemetrySampleRate:null!==(r=e.telemetrySampleRate)&&void 0!==r?r:20,telemetryConfigurationSampleRate:null!==(i=e.telemetryConfigurationSampleRate)&&void 0!==i?i:5,service:e.service,silentMultipleInit:!!e.silentMultipleInit,batchBytesLimit:16*b,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*Z,batchMessagesLimit:50,messageBytesLimit:256*b},bt(e));t.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else t.error("Telemetry Sample Rate should be a number between 0 and 100");else t.error("Session Sample Rate should be a number between 0 and 100")}else t.error("Client Token is not configured, we will not send any data.")}var St="?";function Et(e){var t=[],n=At(e,"stack"),r=String(e);return n&&h(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=_t.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=kt.exec(t[2]);r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||St,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Ot.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:St,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=Rt.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||St,line:+t[3],url:t[2]}}(e)||function(e){var t=Tt.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=Lt.exec(t[3]);n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0);return{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||St,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=St),t.push(n))})),{message:At(e,"message"),name:At(e,"name"),stack:t}}var xt="((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",Ct="(?::(\\d+))",_t=new RegExp("^\\s*at (.*?) ?\\(".concat(xt).concat(Ct,"?").concat(Ct,"?\\)?\\s*$"),"i"),kt=new RegExp("\\((\\S*)".concat(Ct).concat(Ct,"\\)"));var Ot=new RegExp("^\\s*at ?".concat(xt).concat(Ct,"?").concat(Ct,"??\\s*$"),"i");var Rt=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var Tt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Lt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function At(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}var It="No stack, consider using an instance of Error";function Pt(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,a=e.source,s=e.handling,u=n instanceof Error,c=function(e,t,n,r){return(null==e?void 0:e.message)&&(null==e?void 0:e.name)?e.message:t?"Empty message":"".concat(n," ").concat(B(j(r)))}(t,u,i,n),f=function(e,t){if(void 0===t)return!1;if(e)return!0;return t.stack.length>0&&(t.stack.length>1||void 0!==t.stack[0].url)}(u,t)?Nt(t):It,l=u?function(e,t){var n=e,r=[];for(;(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=Et(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&Nt(o)}),n=n.cause}return r.length?r:void 0}(n,a):void 0;return{startClocks:o,source:a,handling:s,handlingStack:r,originalError:n,type:null==t?void 0:t.name,message:c,stack:f,causes:l,fingerprint:Bt(n)}}function Bt(e){return e instanceof Error&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function Nt(e){var t=Mt(e);return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"(".concat(e.args.join(", "),")"):"",o=e.line?":".concat(e.line):"",i=e.line&&e.column?":".concat(e.column):"";t+="\n at ".concat(n).concat(r," @ ").concat(e.url).concat(o).concat(i)})),t}function Mt(e){return"".concat(e.name||"Error",": ").concat(e.message)}var Ut={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function qt(e,t){var n=[];v(t,Ut.cspViolation)&&n.push(function(e){var t=new H((function(){return ue(e,document,"securitypolicyviolation",(function(e){t.notify(function(e){var t=Ut.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:Ut.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:jt(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(Ee(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))})).stop}));return t}(e));var r=t.filter((function(e){return e!==Ut.cspViolation}));return r.length&&n.push(function(e){var t=new H((function(){if(window.ReportingObserver){var n=f((function(e,n){return e.forEach((function(e){t.notify(function(e){var t=e.type,n=e.body;return{type:t,subtype:n.id,message:"".concat(t,": ").concat(n.message),stack:jt(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)}}(e))}))})),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),function(){r.disconnect()}}}));return t}(r)),z.apply(void 0,n)}function jt(e,t,n,r,o){return n?Nt({name:e,message:t,stack:[{func:"?",url:n,line:null!=r?r:void 0,column:null!=o?o:void 0}]}):void 0}var Dt=32*b;function Gt(e,n,r){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return v(n,e)}))?"all"===e?n:(o=e,i=new Set,o.forEach((function(e){return i.add(e)})),p(i)):void t.error("".concat(r,' should be "all" or an array with allowed values "').concat(n.join('", "'),'"'));var o,i}var Ft={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"},Ht=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},zt={debug:"debug",error:"error",info:"info",warn:"warn"},Jt={console:"console",http:"http",silent:"silent"},Vt=Object.keys(zt),Wt=function(){function e(e,t,n,r,o){void 0===n&&(n=Jt.http),void 0===r&&(r=zt.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=$(3),this.contextManager.set(y({},o,t?{logger:{name:t}}:void 0))}return e.prototype.log=function(e,t,n,r){var o;if(void 0===n&&(n=zt.info),n===zt.error&&(o={origin:Ft.LOGGER}),null!=r){var i=Pt({stackTrace:r instanceof Error?Et(r):void 0,originalError:r,nonErrorPrefix:"Provided",source:Ft.LOGGER,handling:"handled",startClocks:re()});o={origin:Ft.LOGGER,stack:i.stack,kind:i.type,message:i.message}}var a=j(t),s=o?P({error:o},a):a;this.handleLogStrategy({message:j(e),context:s,status:n},this)},e.prototype.debug=function(e,t,n){this.log(e,t,zt.debug,n)},e.prototype.info=function(e,t,n){this.log(e,t,zt.info,n)},e.prototype.warn=function(e,t,n){this.log(e,t,zt.warn,n)},e.prototype.error=function(e,t,n){this.log(e,t,zt.error,n)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.getContext=function(){return this.contextManager.get()},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.getHandler=function(){return this.handlerType},e.prototype.setLevel=function(e){this.level=e},e.prototype.getLevel=function(){return this.level},Ht([c],e.prototype,"log",null),e}(),$t="logs";function Xt(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var Kt,Zt={log:"log",configuration:"configuration"},Yt=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],Qt=["ddog-gov.com"],en={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function tn(e,t){var n,r=new H;en.telemetryEnabled=!v(Qt,t.site)&&me(t.telemetrySampleRate),en.telemetryConfigurationEnabled=en.telemetryEnabled&&me(t.telemetryConfigurationSampleRate);var o={is_local_file:"file:"===window.location.protocol,is_worker:"WorkerGlobalScope"in self};return Kt=function(t){if(en.telemetryEnabled){var i=function(e,t,r){return P({type:"telemetry",date:te(),service:e,version:"4.50.0",source:"browser",_dd:{format_version:2},telemetry:P(t,{runtime_env:r}),experimental_features:p(ye())},void 0!==n?n():{})}(e,t,o);r.notify(i),Xt("telemetry",i)}},i=rn,y(en,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:r,enabled:en.telemetryEnabled}}function nn(t,n){d(e.debug,t,n),on(y({type:Zt.log,message:t,status:"debug"},n))}function rn(e,t){on(y({type:Zt.log,status:"error"},function(e){if(e instanceof Error){var t=Et(e);return{error:{kind:t.name,stack:Nt(an(t))},message:t.message}}return{error:{stack:It},message:"".concat("Uncaught"," ").concat(B(e))}}(e),t))}function on(e){Kt&&en.sentEventCount<en.maxEventsPerPage&&(en.sentEventCount+=1,Kt(e))}function an(e){return e.stack=e.stack.filter((function(e){return!e.url||Yt.some((function(t){return h(e.url,t)}))})),e}var sn={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};var un="datadog-synthetics-public-id",cn="datadog-synthetics-result-id",fn="datadog-synthetics-injects-rum";function ln(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||Oe(fn))}function dn(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||Oe(cn);return"string"==typeof e?e:void 0}var vn=function(){function e(e,t,n){var r=this;this.request=e,this.flushController=t,this.messageBytesLimit=n,this.pushOnlyBuffer=[],this.upsertBuffer={},this.flushSubscription=this.flushController.flushObservable.subscribe((function(e){return r.flush(e)}))}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.stop=function(){this.flushSubscription.unsubscribe()},e.prototype.flush=function(e){var t=this.pushOnlyBuffer.concat(g(this.upsertBuffer));this.pushOnlyBuffer=[],this.upsertBuffer={};var n,r={data:t.join("\n"),bytesCount:e.bytesCount,flushReason:e.reason};n=e.reason,v(g(sn),n)?this.request.sendOnExit(r):this.request.send(r)},e.prototype.addOrUpdate=function(e,n){var r=this.process(e),o=r.processedMessage,i=r.messageBytesCount;i>=this.messageBytesLimit?t.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB.")):(this.hasMessageFor(n)&&this.remove(n),this.push(o,i,n))},e.prototype.process=function(e){var t=B(e);return{processedMessage:t,messageBytesCount:E(t)}},e.prototype.push=function(e,t,n){var r=this.flushController.messagesCount>0?1:0;this.flushController.notifyBeforeAddMessage(t+r),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.flushController.notifyAfterAddMessage()},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=E(t),r=this.flushController.messagesCount>1?1:0;this.flushController.notifyAfterRemoveMessage(n+r)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e}();function pn(e){return e>=500}var gn=80*b,hn=32,yn=3*w,mn=Y,bn=Z;function wn(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?En(e,t,n,{onSuccess:function(){return xn(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),Sn(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function Sn(e,t,n,r){2===e.transportStatus&&C((function(){En(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=bn,xn(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(mn,2*e.currentBackoffTime),Sn(e,t,n,r)}})}),e.currentBackoffTime)}function En(e,t,n,r){var o=r.onSuccess,i=r.onFailure;t.bandwidthMonitor.add(e),n(e,(function(n){t.bandwidthMonitor.remove(e),!function(e){return"opaque"!==e.type&&(0===e.status&&!navigator.onLine||408===e.status||429===e.status||pn(e.status))}(n)?(t.transportStatus=0,o()):(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:n.status},i())}))}function xn(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(yn/w,"MiB"),source:Ft.AGENT,startClocks:re()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=Cn();i.size()>0;)wn(i.dequeue(),t,n,r,o)}function Cn(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=yn}}}function _n(e,t,n,r){var o={transportStatus:0,currentBackoffTime:bn,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=gn&&this.ongoingRequestCount<hn},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:Cn(),queueFullReported:!1},i=function(r,o){return function(e,t,n,r,o){var i=function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&r.bytesCount<n;if(i){var a=t.build("fetch",r);fetch(a,{method:"POST",body:r.data,keepalive:!0,mode:"cors"}).then(f((function(e){return null==o?void 0:o({status:e.status,type:e.type})})),f((function(){var n=t.build("xhr",r);On(e,n,r.data,o)})))}else{var s=t.build("xhr",r);On(e,s,r.data,o)}}(e,t,n,r,o)};return{send:function(e){wn(e,o,i,t.endpointType,r)},sendOnExit:function(r){!function(e,t,n,r){var o=!!navigator.sendBeacon&&r.bytesCount<n;if(o)try{var i=t.build("beacon",r);if(navigator.sendBeacon(i,r.data))return}catch(e){!function(e){kn||(kn=!0,rn(e))}(e)}var a=t.build("xhr",r);On(e,a,r.data)}(e,t,n,r)}}}var kn=!1;function On(e,t,n,r){var o=new XMLHttpRequest;o.open("POST",t,!0),ue(e,o,"loadend",(function(){null==r||r({status:o.status})}),{once:!0}),o.send(n)}function Rn(e){var t,n=e.messagesLimit,r=e.bytesLimit,o=e.durationLimit,i=e.pageExitObservable,a=e.sessionExpireObservable,s=i.subscribe((function(e){return d(e.reason)})),u=a.subscribe((function(){return d("session_expire")})),c=new H((function(){return function(){s.unsubscribe(),u.unsubscribe()}})),f=0,l=0;function d(e){if(0!==l){var t=l,n=f;l=0,f=0,v(),c.notify({reason:e,messagesCount:t,bytesCount:n})}}function v(){_(t),t=void 0}return{flushObservable:c,get messagesCount(){return l},notifyBeforeAddMessage:function(e){f+e>=r&&d("bytes_limit"),l+=1,f+=e,void 0===t&&(t=C((function(){d("duration_limit")}),o))},notifyAfterAddMessage:function(){l>=n?d("messages_limit"):f>=r&&d("bytes_limit")},notifyAfterRemoveMessage:function(e){f-=e,0===(l-=1)&&v()}}}function Tn(e,t,n,r,o,i){var a=u(e,t.endpoint),s=n&&u(e,n.endpoint);function u(e,t){return new vn(_n(e,t,e.batchBytesLimit,r),Rn({messagesLimit:e.batchMessagesLimit,bytesLimit:e.batchBytesLimit,durationLimit:e.flushTimeout,pageExitObservable:o,sessionExpireObservable:i}),e.messageBytesLimit)}return{flushObservable:a.flushController.flushObservable,add:function(e,t){void 0===t&&(t=!0),a.add(e),s&&t&&s.add(n.transformMessage?n.transformMessage(e):e)},upsert:function(e,t){a.upsert(e,t),s&&s.upsert(n.transformMessage?n.transformMessage(e):e,t)},stop:function(){a.stop(),null==s||s.stop()}}}var Ln=1/0,An=Y,In=function(){function e(e,t){var n=this;this.expireDelay=e,this.maxEntries=t,this.entries=[],this.clearOldValuesInterval=k((function(){return n.clearOldValues()}),An)}return e.prototype.add=function(e,t){var n=this,r={value:e,startTime:t,endTime:Ln,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.maxEntries&&this.entries.length>=this.maxEntries&&this.entries.pop(),this.entries.unshift(r),r},e.prototype.find=function(e){void 0===e&&(e=Ln);for(var t=0,n=this.entries;t<n.length;t++){var r=n[t];if(r.startTime<=e){if(e<=r.endTime)return r.value;break}}},e.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===Ln&&t.close(e)},e.prototype.findAll=function(e,t){void 0===e&&(e=Ln),void 0===t&&(t=0);var n=oe(e,t);return this.entries.filter((function(t){return t.startTime<=n&&e<=t.endTime})).map((function(e){return e.value}))},e.prototype.reset=function(){this.entries=[]},e.prototype.stop=function(){O(this.clearOldValuesInterval)},e.prototype.clearOldValues=function(){for(var e=ne()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}(),Pn=Y,Bn=Ce,Nn=[];function Mn(e,t,n){var r=ot(e.sessionStoreStrategyType,t,n);Nn.push((function(){return r.stop()}));var o,i=new In(Bn);function a(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return Nn.push((function(){return i.stop()})),r.renewObservable.subscribe((function(){i.add(a(),ne())})),r.expireObservable.subscribe((function(){i.closeActive(ne())})),r.expandOrRenewSession(),i.add(a(),[0,ie()][0]),o=ce(0,window,["click","touchstart","keydown","scroll"],(function(){return r.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,Nn.push(o),function(e,t){var n=function(){"visible"===document.visibilityState&&t()},r=ue(e,document,"visibilitychange",n).stop;Nn.push(r);var o=k(n,Pn);Nn.push((function(){O(o)}))}(e,(function(){return r.expandSession()})),{findActiveSession:function(e){return i.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable,expire:r.expire}}var Un,qn="logs";function jn(e){var t=Mn(e,qn,(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:Dn(e);return{trackingType:n,isTracked:"1"===n}}(e,t)}));return{findTrackedSession:function(e){var n=t.findActiveSession(e);return n&&"1"===n.trackingType?{id:n.id}:void 0},expireObservable:t.expireObservable}}function Dn(e){return me(e.sessionSampleRate)?"1":"0"}var Gn=((Un={})[zt.debug]=0,Un[zt.info]=1,Un[zt.warn]=2,Un[zt.error]=3,Un);function Fn(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return Gn[e]>=Gn[n.getLevel()]&&v(o,t)}function Hn(e,t,n,r,o,i){var a=Vt.concat(["custom"]),s={};a.forEach((function(e){var n,r,o,a,u;s[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,a=0,u=!1,{isLimitReached:function(){if(0===a&&C((function(){a=0}),Y),(a+=1)<=r||u)return u=!1,!1;if(a===r+1){u=!0;try{o({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:Ft.AGENT,startClocks:re()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(i){var a,u,c,f=i.rawLogsEvent,l=i.messageContext,d=void 0===l?void 0:l,v=i.savedCommonContext,p=void 0===v?void 0:v,g=i.logger,h=void 0===g?o:g,y=f.date-ie(),m=e.findTrackedSession(y);if(m){var b=p||r(),w=P({service:t.service,session_id:m.id,usr:we(b.user)?void 0:b.user,view:b.view},b.context,Jn(y),f,h.getContext(),d);!Fn(f.status,Jt.http,h)||!1===(null===(a=t.beforeSend)||void 0===a?void 0:a.call(t,w))||(null===(u=w.error)||void 0===u?void 0:u.origin)!==Ft.AGENT&&(null!==(c=s[w.status])&&void 0!==c?c:s.custom).isLimitReached()||n.notify(1,w)}}))}var zn=!1;function Jn(e){var t,n=window;if(ln()){var r=o(n.DD_RUM_SYNTHETICS);return r||zn||(zn=!0,nn("Logs sent before RUM is injected by the synthetics worker",{testId:(t=window._DATADOG_SYNTHETICS_PUBLIC_ID||Oe(un),"string"==typeof t?t:void 0),resultId:dn()})),r}return o(n.DD_RUM);function o(t){if(t&&t.getInternalContext)return t.getInternalContext(e)}}var Vn,Wn={};function $n(t){var r=t.map((function(t){return Wn[t]||(Wn[t]=function(t){var r=new H((function(){var o=n[t];return n[t]=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];o.apply(console,n);var a=function(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return l((function(){var n=Et(t);n.stack=n.stack.slice(2),e=Nt(n)})),e}();l((function(){r.notify(function(t,n,r){var o,i,a=t.map((function(e){return function(e){if("string"==typeof e)return j(e);if(e instanceof Error)return Mt(Et(e));return B(j(e),void 0,2)}(e)})).join(" ");if(n===e.error){var s=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}(t,(function(e){return e instanceof Error}));o=s?Nt(Et(s)):void 0,i=Bt(s),a="console error: ".concat(a)}return{api:n,message:a,stack:o,handlingStack:r,fingerprint:i}}(n,t,a))}))},function(){n[t]=o}}));return r}(t)),Wn[t]}));return z.apply(void 0,r)}var Xn,Kn=((Vn={})[e.log]=zt.info,Vn[e.debug]=zt.debug,Vn[e.info]=zt.info,Vn[e.warn]=zt.warn,Vn[e.error]=zt.error,Vn);var Zn,Yn=((Xn={})[Ut.cspViolation]=zt.error,Xn[Ut.intervention]=zt.error,Xn[Ut.deprecation]=zt.warn,Xn);function Qn(e,t,n){var r=e[t],o=n(r),i=function(){if("function"==typeof o)return o.apply(this,arguments)};return e[t]=i,{stop:function(){e[t]===i?e[t]=r:o=r}}}function er(e,t,n){var r=n.before,o=n.after;return Qn(e,t,(function(e){return function(){var t,n=arguments;return r&&l(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&l(o,this,n),t}}))}var tr,nr=new WeakMap;function rr(e){return Zn||(Zn=function(e){var t=new H((function(){var n=er(XMLHttpRequest.prototype,"open",{before:or}).stop,r=er(XMLHttpRequest.prototype,"send",{before:function(){ir.call(this,e,t)}}).stop,o=er(XMLHttpRequest.prototype,"abort",{before:ar}).stop;return function(){n(),r(),o()}}));return t}(e)),Zn}function or(e,t){nr.set(this,{state:"open",method:e,url:it(String(t))})}function ir(e,t){var n=this,r=nr.get(this);if(r){var o=r;o.state="start",o.startTime=ne(),o.startClocks=re(),o.isAborted=!1,o.xhr=this;var i=!1,a=er(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&s()}}).stop,s=function(){if(u(),a(),!i){i=!0;var e,s=r;s.state="complete",s.duration=(e=o.startClocks.timeStamp,te()-e),s.status=n.status,t.notify(y({},s))}},u=ue(e,this,"loadend",s).stop;t.notify(o)}}function ar(){var e=nr.get(this);e&&(e.isAborted=!0)}function sr(){var e;return tr||(e=new H((function(){if(window.fetch)return Qn(window,"fetch",(function(t){return function(n,r){var o,i=l(ur,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),l(cr,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),tr=e),tr}function ur(e,t,n){var r=n&&n.method||t instanceof Request&&t.method||"GET",o=t instanceof Request?t.url:it(String(t)),i={state:"start",init:n,input:t,method:r,startClocks:re(),url:o};return e.notify(i),i}function cr(e,t,n){var r=function(t){var r=n;r.state="resolve","stack"in t||t instanceof Error?(r.status=0,r.isAborted=t instanceof DOMException&&t.code===DOMException.ABORT_ERR,r.error=t):"status"in t&&(r.response=t,r.responseType=t.type,r.status=t.status,r.isAborted=!1),e.notify(r)};t.then(f(r),f(r))}function fr(e,t){if(!e.forwardErrorsToLogs)return{stop:T};var n=rr(e).subscribe((function(e){"complete"===e.state&&o("xhr",e)})),r=sr().subscribe((function(e){"resolve"===e.state&&o("fetch",e)}));function o(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(dr(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:Ft.NETWORK,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:zt.error,origin:Ft.NETWORK}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!pn(r.status)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(lr(e.response,t)):n(e.response)}(r.xhr,e,o):r.response?function(e,t,n){var r=function(e){try{return e.clone()}catch(e){return}}(e);r&&r.body?window.TextDecoder?function(e,t,n){!function(e,t,n){var r=e.getReader(),o=[],i=0;function a(){var e,a;if(r.cancel().catch(T),n.collectStreamBody){var s;if(1===o.length)s=o[0];else{s=new Uint8Array(i);var u=0;o.forEach((function(e){s.set(e,u),u+=e.length}))}e=s.slice(0,n.bytesLimit),a=s.length>n.bytesLimit}t(void 0,e,a)}!function e(){r.read().then(f((function(t){t.done?a():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?a():e())})),f((function(e){return t(e)})))}()}(e,(function(e,t,r){if(e)n(e);else{var o=(new TextDecoder).decode(t);r&&(o+="..."),n(void 0,o)}}),{bytesLimit:t,collectStreamBody:!0})}(r.body,t.requestErrorResponseLengthLimit,(function(e,t){n(e?"Unable to retrieve response: ".concat(e):t)})):r.text().then(f((function(e){return n(lr(e,t))})),f((function(e){return n("Unable to retrieve response: ".concat(e))}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(lr(Nt(Et(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function lr(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function dr(e){return"xhr"===e?"XHR":"Fetch"}var vr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function pr(e){var t=function(e){return er(window,"onerror",{before:function(t,n,r,o,i){var a;if(i instanceof Error)a=Et(i);else{var s=[{url:n,column:o,line:r}],u=function(e){var t,n,r;"[object String]"==={}.toString.call(e)&&(n=(t=vr.exec(e))[1],r=t[2]);return{name:n,message:r}}(t);a={name:u.name,message:u.message,stack:s}}e(a,null!=i?i:t)}})}(e).stop,n=function(e){return er(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=Et(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}function gr(e,t){if(!e.forwardErrorsToLogs)return{stop:T};var n,r=new H,o=(n=r,pr((function(e,t){n.notify(Pt({stackTrace:e,originalError:t,startClocks:re(),nonErrorPrefix:"Uncaught",source:Ft.SOURCE,handling:"unhandled"}))}))).stop,i=r.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:Ft.SOURCE,stack:e.stack},origin:Ft.SOURCE,status:zt.error}})}));return{stop:function(){o(),i.unsubscribe()}}}var hr=function(){function e(){this.callbacks={}}return e.prototype.notify=function(e,t){var n=this.callbacks[e];n&&n.forEach((function(e){return e(t)}))},e.prototype.subscribe=function(e,t){var n=this;return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),{unsubscribe:function(){n.callbacks[e]=n.callbacks[e].filter((function(e){return t!==e}))}}},e}();var yr,mr,br,wr,Sr=function(n){var r,o,i=!1,a=$(2),s=$(1),c={},l=function(){},d=new K,p=function(e,t,n,r){void 0===n&&(n=I(b())),void 0===r&&(r=te()),d.add((function(){return p(e,t,n,r)}))},h=function(){},m=new Wt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p.apply(void 0,e)}));function b(){return{view:{referrer:document.referrer,url:window.location.href},context:a.getContext(),user:s.getContext()}}return r={logger:m,init:f((function(r){var o;if(r){if(h=function(){return I(r)},se()&&(r=function(e){return y({},e,{clientToken:"empty"})}(r)),function(e){return!i||(e.silentMultipleInit||t.error("DD_LOGS is already initialized."),!1)}(r)){var u=function(t){var n=wt(t),r=Gt(t.forwardConsoleLogs,g(e),"Forward Console Logs"),o=Gt(t.forwardReports,g(Ut),"Forward Reports");if(n&&r&&o)return t.forwardErrorsToLogs&&!v(r,e.error)&&r.push(e.error),y({forwardErrorsToLogs:!1!==t.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:Dt},n)}(r);if(u){if(r.storeContextsAcrossPages){var c=a.getContext();(a=ve(u,$t,2)).setContext(P(a.getContext(),c));var f=s.getContext();(s=ve(u,$t,1)).setContext(P(s.getContext(),f))}o=n(r,u,b,m),p=o.handleLog,l=o.getInternalContext,d.drain(),i=!0}}}else t.error("Missing configuration")})),getLoggerGlobalContext:f((function(){return a.get()})),getGlobalContext:f((function(){return a.getContext()})),setLoggerGlobalContext:f((function(e){return a.set(e)})),setGlobalContext:f((function(e){return a.setContext(e)})),addLoggerGlobalContext:f((function(e,t){return a.add(e,t)})),setGlobalContextProperty:f((function(e,t){return a.setContextProperty(e,t)})),removeLoggerGlobalContext:f((function(e){return a.remove(e)})),removeGlobalContextProperty:f((function(e){return a.removeContextProperty(e)})),clearGlobalContext:f((function(){return a.clearContext()})),createLogger:f((function(e,t){return void 0===t&&(t={}),c[e]=new Wt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p.apply(void 0,e)}),j(e),t.handler,t.level,j(t.context)),c[e]})),getLogger:f((function(e){return c[e]})),getInitConfiguration:f((function(){return h()})),getInternalContext:f((function(e){return l(e)})),setUser:f((function(e){(function(e){var n="object"===L(e);return n||t.error("Unsupported user:",e),n})(e)&&s.setContext(pe(e))})),getUser:f((function(){return s.getContext()})),setUserProperty:f((function(e,t){var n,r=pe((n={},n[e]=t,n))[e];s.setContextProperty(e,r)})),removeUserProperty:f((function(e){return s.removeContextProperty(e)})),clearUser:f((function(){return s.clearContext()}))},o=y({version:"4.50.0",onReady:function(e){e()}},r),Object.defineProperty(o,"_setDebug",{get:function(){return u},enumerable:!1}),o}((function(n,r,o,i){var a=new hr,s=[];a.subscribe(1,(function(e){return Xt("logs",e)}));var u=function(e){a.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:Ft.AGENT},origin:Ft.AGENT,status:zt.error}}),nn("Error reported to customer",{"error.message":e.message})},c=function(e){var t=new H((function(){var n=he(fe.PAGEHIDE),r=ce(0,window,["visibilitychange","freeze","pagehide"],(function(e){"pagehide"===e.type&&n?t.notify({reason:sn.PAGEHIDE}):"visibilitychange"===e.type&&"hidden"===document.visibilityState?t.notify({reason:sn.HIDDEN}):"freeze"===e.type&&t.notify({reason:sn.FROZEN})}),{capture:!0}).stop,o=T;return n||(o=ue(e,window,"beforeunload",(function(){t.notify({reason:sn.UNLOADING})})).stop),function(){r(),o()}}));return t}(r),f=!r.sessionStoreStrategyType||se()||ln()?function(e){var t="1"===Dn(e)?{}:void 0;return{findTrackedSession:function(){return t},expireObservable:new H}}(r):jn(r),l=function(e,t,n,r){var o=tn("browser-logs-sdk",e),i=[];if(se()){var a=ae(),s=o.observable.subscribe((function(e){return a.send("internal_telemetry",e)}));i.push((function(){return s.unsubscribe()}))}else{var u=Tn(e,{endpoint:e.rumEndpointBuilder},e.replica&&{endpoint:e.replica.rumEndpointBuilder},t,n,r);i.push((function(){return u.stop()}));var c=o.observable.subscribe((function(t){return u.add(t,function(e){return e.site===ft}(e))}));i.push((function(){return c.unsubscribe()}))}return{telemetry:o,stop:function(){i.forEach((function(e){return e()}))}}}(r,u,c,f.expireObservable),d=l.telemetry,v=l.stop;s.push((function(){return v()})),d.setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=Jn())||void 0===e?void 0:e.application_id},session:{id:null===(t=f.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=Jn())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=Jn())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),fr(r,a),gr(r,a),function(t,n){var r=$n(t.forwardConsoleLogs).subscribe((function(t){n.notify(0,{rawLogsEvent:{date:te(),message:t.message,origin:Ft.CONSOLE,error:t.api===e.error?{origin:Ft.CONSOLE,stack:t.stack,fingerprint:t.fingerprint}:void 0,status:Kn[t.api]}})}))}(r,a),function(e,t){var n=qt(e,e.forwardReports).subscribe((function(e){var n,r=e.message,o=Yn[e.type];o===zt.error?n={kind:e.subtype,origin:Ft.REPORT,stack:e.stack}:e.stack&&(r+=" Found in ".concat(function(e){var t;return null===(t=/@ (.+)/.exec(e))||void 0===t?void 0:t[1]}(e.stack))),t.notify(0,{rawLogsEvent:{date:te(),message:r,origin:Ft.REPORT,error:n,status:o}})}))}(r,a);var p,g=function(e){return{handleLog:function(n,r,o,i){var a=n.context;Fn(n.status,Jt.console,r)&&t(n.status,n.message,P(r.getContext(),a)),e.notify(0,{rawLogsEvent:{date:i||te(),message:n.message,status:n.status,origin:Ft.LOGGER},messageContext:a,savedCommonContext:o,logger:r})}}}(a).handleLog;if(Hn(f,r,a,o,i,u),se())!function(e){var t=ae();e.subscribe(1,(function(e){t.send("log",e)}))}(a);else{var h=function(e,t,n,r,o){var i=Tn(e,{endpoint:e.logsEndpointBuilder},e.replica&&{endpoint:e.replica.logsEndpointBuilder},n,r,o);return t.subscribe(1,(function(e){i.add(e)})),i}(r,a,u,c,f.expireObservable).stop;s.push((function(){return h()}))}return function(e){en.telemetryConfigurationEnabled&&on({type:Zt.configuration,configuration:e})}(function(e){var t=function(e){var t,n,r=null!==(t=e.proxy)&&void 0!==t?t:e.proxyUrl;return{session_sample_rate:null!==(n=e.sessionSampleRate)&&void 0!==n?n:e.sampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,use_before_send:!!e.beforeSend,use_cross_site_session_cookie:e.useCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:void 0!==r?!!r:void 0,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_resources:e.trackResources,track_long_task:e.trackLongTasks,allow_fallback_to_local_storage:!!e.allowFallbackToLocalStorage,store_contexts_across_pages:!!e.storeContextsAcrossPages}}(e);return y({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(n)),{handleLog:g,getInternalContext:(p=f,{get:function(e){var t=p.findTrackedSession(e);if(t)return{session_id:t.id}}}).get,stop:function(){s.forEach((function(e){return e()}))}}}));yr=m(),br=Sr,wr=yr[mr="DD_LOGS"],yr[mr]=br,wr&&wr.q&&wr.q.forEach((function(e){return o(e,"onReady callback threw an error:")()}))}();
{
"name": "@datadog/browser-logs",
"version": "4.49.0",
"version": "4.50.0",
"license": "Apache-2.0",

@@ -16,6 +16,6 @@ "main": "cjs/entries/main.js",

"dependencies": {
"@datadog/browser-core": "4.49.0"
"@datadog/browser-core": "4.50.0"
},
"peerDependencies": {
"@datadog/browser-rum": "4.49.0"
"@datadog/browser-rum": "4.50.0"
},

@@ -38,3 +38,3 @@ "peerDependenciesMeta": {

},
"gitHead": "4aa09a00c7457f4d4f302b15bc1c1bb645072016"
"gitHead": "6bb23089915b99c9dab8edbf0131b5edc09eb4b5"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc