Socket
Socket
Sign inDemoInstall

@datadog/browser-logs

Package Overview
Dependencies
1
Maintainers
1
Versions
247
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.34.1 to 4.34.2

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)};function n(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=console.debug.bind(console),t.log=console.log.bind(console),t.info=console.info.bind(console),t.warn=console.warn.bind(console),t.error=console.error.bind(console);var r,o=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))},i=!1;function s(e){i=e}function a(e,t,n){var o=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=r?u(o):o;return n.apply(this,e)}}function u(e){return function(){return c(e,this,arguments)}}function c(t,n,o){try{return t.apply(n,o)}catch(t){if(f(e.error,t),r)try{r(t)}catch(t){f(e.error,t)}}}function f(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];i&&t.apply(void 0,o([e,"[MONITOR]"],n,!1))}var l=1e3,d=6e4;function v(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,s=!n||void 0===n.trailing||n.trailing,a=!1;return{throttled:function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];a?r=n:(i?e.apply(void 0,n):r=n,a=!0,o=setTimeout((function(){s&&r&&e.apply(void 0,r),a=!1,r=void 0}),t))},cancel:function(){clearTimeout(o),a=!1,r=void 0}}}function p(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 h(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,h)}function g(e){return 0!==e&&100*Math.random()<=e}function y(){}function m(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)),s=b(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),s()}}function b(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):y}function w(e,t){return-1!==e.indexOf(t)}function C(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 x(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100}function k(e){return Object.keys(e).map((function(t){return e[t]}))}function S(e){return 0===Object.keys(e).length}function E(e,t){return e.slice(0,t.length)===t}function _(){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}function R(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)}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 s="object"===T(e)?e:{};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=L(s[a],t[a],n));return s}}function O(e){return L(void 0,e)}function B(){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}var P=/[^\u0000-\u007F]/;function M(e){return P.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}function q(e){void 0===e&&(e=M);var t,n={};return{getBytesCount:function(){return void 0===t&&(t=e(m(n))),t},get:function(){return n},add:function(e,r){n[e]=r,t=void 0},remove:function(e){delete n[e],t=void 0},set:function(e){n=e,t=void 0},getContext:function(){return O(n)},setContext:function(e){n=O(e),t=void 0},setContextProperty:function(e,r){n[e]=O(r),t=void 0},removeContextProperty:function(e){delete n[e],t=void 0},clearContext:function(){n={},t=void 0}}}var A,I=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}();function j(){return(new Date).getTime()}function D(){return j()}function U(){return performance.now()}function N(){return{relative:U(),timeStamp:D()}}function F(){return void 0===A&&(A=performance.timing.navigationStart),A}function H(){var e=_().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function G(e){var t;void 0===e&&(e=null===(t=_().location)||void 0===t?void 0:t.hostname);var n=H();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}function z(e){var t=p({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t}var V,$,J;function W(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires=".concat(o.toUTCString()),s=r&&r.crossSite?"none":"strict",a=r&&r.domain?";domain=".concat(r.domain):"",u=r&&r.secure?";secure":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(s).concat(a).concat(u)}function X(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 Z(e,t){W(e,"",0,t)}function Y(){return $||new Set}function K(e){return Q(e,function(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}(window.location)).href}function Q(e,t){if(function(){if(void 0!==J)return J;try{var e=new URL("http://test/path");return J="http://test/path"===e.href}catch(e){J=!1}return J}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}var ee="datadoghq.com",te="ap1.datadoghq.com",ne={logs:"logs",rum:"rum",sessionReplay:"session-replay"},re={logs:"logs",rum:"rum",sessionReplay:"replay"};function oe(e,t,n){var r=function(e,t){var n="/api/v2/".concat(re[t]),r=e.proxy,o=e.proxyUrl;if(r){var i=K(r);return function(e){return"".concat(i,"?ddforward=").concat(encodeURIComponent("".concat(n,"?").concat(e)))}}var s=function(e,t){var n=e.site,r=void 0===n?ee:n,o=e.internalAnalyticsSubdomain;if(o&&r===ee)return"".concat(o,".").concat(ee);var i=r.split("."),s=i.pop(),a=r!==te?"".concat(ne[t],"."):"";return"".concat(a,"browser-intake-").concat(i.join("-"),".").concat(s)}(e,t);if(void 0===r&&o){var a=K(o);return function(e){return"".concat(a,"?ddforward=").concat(encodeURIComponent("https://".concat(s).concat(n,"?").concat(e)))}}return function(e){return"https://".concat(s).concat(n,"?").concat(e)}}(e,t);return{build:function(o,i){var s=function(e,t,n,r,o){var i=e.clientToken,s=e.internalAnalyticsSubdomain,a=["sdk_version:".concat("4.34.1"),"api:".concat(r)].concat(n);o&&a.push("retry_count:".concat(o.count),"retry_after:".concat(o.lastFailureStatus));var u=["ddsource=browser","ddtags=".concat(encodeURIComponent(a.join(","))),"dd-api-key=".concat(i),"dd-evp-origin-version=".concat(encodeURIComponent("4.34.1")),"dd-evp-origin=browser","dd-request-id=".concat(h())];"rum"===t&&u.push("batch_time=".concat(D()));s&&u.reverse();return u.join("&")}(e,t,n,o,i);return r(s)},urlPrefix:r(""),endpointType:t}}var ie=/[^a-z0-9_:./-]/;function se(e,n){var r=200-e.length-1;(n.length>r||ie.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 ae(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(se("env",t)),n&&i.push(se("service",n)),r&&i.push(se("version",r)),o&&i.push(se("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:oe(e,"logs",t),rumEndpointBuilder:oe(e,"rum",t),sessionReplayEndpointBuilder:oe(e,"sessionReplay",t)}}(e,t),r=k(n).map((function(e){return e.urlPrefix})),o=function(e,t,n){if(!e.replica)return;var r=p({},e,{site:ee,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:oe(r,"logs",n),rumEndpointBuilder:oe(r,"rum",n)};return t.push.apply(t,k(o).map((function(e){return e.urlPrefix}))),p({applicationId:e.replica.applicationId},o)}(e,r,t);return p({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||ee},n)}function ue(e){var r,o,i;if(e&&e.clientToken){var s=null!==(r=e.sessionSampleRate)&&void 0!==r?r:e.sampleRate;if(void 0===s||x(s))if(void 0===e.telemetrySampleRate||x(e.telemetrySampleRate)){var a;if(void 0===e.telemetryConfigurationSampleRate||x(e.telemetryConfigurationSampleRate))return a=e.enableExperimentalFeatures,Array.isArray(a)&&($||($=new Set(a)),a.filter((function(e){return"string"==typeof e})).forEach((function(e){w(e,"-")&&t.warn("please use snake case for '".concat(e,"'")),$.add(e)}))),p({beforeSend:e.beforeSend&&n(e.beforeSend,"beforeSend threw an error:"),cookieOptions:ce(e),sessionSampleRate:null!=s?s: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:16384,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:3e4,batchMessagesLimit:50,messageBytesLimit:262144},ae(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.")}function ce(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===V){for(var e="dd_site_test_".concat(h()),t=window.location.hostname.split("."),n=t.pop();t.length&&!X(e);)n="".concat(t.pop(),".").concat(n),W(e,"test",l,{domain:n});Z(e,{domain:n}),V=n}return V}()),t}var fe="?";function le(e){var t=[],n=we(e,"stack"),r=String(e);return n&&E(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=pe.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=he.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]||fe,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=ge.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:fe,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=ye.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||fe,line:+t[3],url:t[2]}}(e)||function(e){var t=me.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=be.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]||fe,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=fe),t.push(n))})),{message:we(e,"message"),name:we(e,"name"),stack:t}}var de="((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\\w+\\.|\\/).*?)",ve="(?::(\\d+))",pe=new RegExp("^\\s*at (.*?) ?\\(".concat(de).concat(ve,"?").concat(ve,"?\\)?\\s*$"),"i"),he=new RegExp("\\((\\S*)".concat(ve).concat(ve,"\\)"));var ge=new RegExp("^\\s*at ?".concat(de).concat(ve,"?").concat(ve,"??\\s*$"),"i");var ye=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var me=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,be=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function we(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}var Ce="agent",xe="console",ke="logger",Se="network",Ee="source",_e="report";function Re(e){var t=Te(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 Te(e){return"".concat(e.name||"Error",": ").concat(e.message)}function Le(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return c((function(){var n=le(t);n.stack=n.stack.slice(2),e=Re(n)})),e}function Oe(e,t){for(var n=e,r=[];(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=le(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&Re(o)}),n=n.cause}return r.length?r:void 0}var Be=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 Pe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Be((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}function Me(e,t){var n,r=window;return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function qe(e,t,n,r){return Ae(e,[t],n,r)}function Ae(e,t,n,r){var o=void 0===r?{}:r,i=o.once,s=o.capture,a=o.passive,c=u(i?function(e){d(),n(e)}:n),f=a?{capture:s,passive:a}:s,l=Me(e,"addEventListener");function d(){var n=Me(e,"removeEventListener");t.forEach((function(t){return n.call(e,t,c,f)}))}return t.forEach((function(t){return l.call(e,t,c,f)})),{stop:d}}var Ie={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function je(e){var t,n=[];w(e,Ie.cspViolation)&&n.push(t=new Be((function(){var e=u((function(e){t.notify(function(e){var t=Ie.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:Ie.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:De(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(R(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))}));return qe(document,"securitypolicyviolation",e).stop})));var r=e.filter((function(e){return e!==Ie.cspViolation}));return r.length&&n.push(function(e){var t=new Be((function(){if(window.ReportingObserver){var n=u((function(e){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:De(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)),Pe.apply(void 0,n)}function De(e,t,n,r,o){return n&&Re({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})}function Ue(e,n,r){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return w(n,e)}))?"all"===e?n:(o=e,i=new Set,o.forEach((function(e){return i.add(e)})),C(i)):void t.error("".concat(r,' should be "all" or an array with allowed values "').concat(n.join('", "'),'"'));var o,i}var Ne=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},Fe={debug:"debug",error:"error",info:"info",warn:"warn"},He="console",Ge="http",ze=Object.keys(Fe),Ve=function(){function e(e,t,n,r,o){void 0===n&&(n=Ge),void 0===r&&(r=Fe.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=q(),this.contextManager.set(p({},o,t?{logger:{name:t}}:void 0))}return e.prototype.log=function(e,t,n){void 0===n&&(n=Fe.info),this.handleLogStrategy({message:e,context:O(t),status:n},this)},e.prototype.debug=function(e,t){this.log(e,t,Fe.debug)},e.prototype.info=function(e,t){this.log(e,t,Fe.info)},e.prototype.warn=function(e,t){this.log(e,t,Fe.warn)},e.prototype.error=function(e,t){var n={error:{origin:ke}};this.log(e,B(n,t),Fe.error)},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},Ne([a],e.prototype,"log",null),e}();function $e(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var Je={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",FROZEN:"page_frozen"};function We(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||X("datadog-synthetics-injects-rum"))}function Xe(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||X("datadog-synthetics-result-id");return"string"==typeof e?e:void 0}var Ze,Ye="log",Ke="configuration",Qe=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","http://localhost","<anonymous>"],et=["ddog-gov.com"],tt={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function nt(e,t){var n,o=new Be;return tt.telemetryEnabled=!w(et,t.site)&&g(t.telemetrySampleRate),tt.telemetryConfigurationEnabled=tt.telemetryEnabled&&g(t.telemetryConfigurationSampleRate),Ze=function(t){if(tt.telemetryEnabled){var r=function(e,t){return B({type:"telemetry",date:D(),service:e,version:"4.34.1",source:"browser",_dd:{format_version:2},telemetry:t,experimental_features:C(Y())},void 0!==n?n():{})}(e,t);o.notify(r),$e("telemetry",r)}},r=rt,p(tt,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:o,enabled:tt.telemetryEnabled}}function rt(e){ot(p({type:Ye,status:"error"},function(e){if(e instanceof Error){var t=le(e);return{error:{kind:t.name,stack:Re(it(t))},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught ".concat(m(e))}}(e)))}function ot(e){Ze&&tt.sentEventCount<tt.maxEventsPerPage&&(tt.sentEventCount+=1,Ze(e))}function it(e){return e.stack=e.stack.filter((function(e){return!e.url||Qe.some((function(t){return E(e.url,t)}))})),e}var st=function(){function e(e,t,n,r,o,i){var s=this;this.request=e,this.batchMessagesLimit=t,this.batchBytesLimit=n,this.messageBytesLimit=r,this.flushTimeout=o,this.pageExitObservable=i,this.flushObservable=new Be,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,i.subscribe((function(){return s.flush(s.request.sendOnExit)})),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(e){if(void 0===e&&(e=this.request.send),0!==this.bufferMessagesCount){var t=this.pushOnlyBuffer.concat(k(this.upsertBuffer)),n=this.bufferBytesCount;this.flushObservable.notify({bufferBytesCount:this.bufferBytesCount,bufferMessagesCount:this.bufferMessagesCount}),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,e({data:t.join("\n"),bytesCount:n})}},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.willReachedBytesLimitWith(i)&&this.flush(),this.push(o,i,n),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=m(e);return{processedMessage:t,messageBytesCount:M(t)}},e.prototype.push=function(e,t,n){this.bufferMessagesCount>0&&(this.bufferBytesCount+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesCount+=t,this.bufferMessagesCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=M(t);this.bufferBytesCount-=n,this.bufferMessagesCount-=1,this.bufferMessagesCount>0&&(this.bufferBytesCount-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesCount+e+1>=this.batchBytesLimit},e.prototype.isFull=function(){return this.bufferMessagesCount===this.batchMessagesLimit||this.bufferBytesCount>=this.batchBytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout(u((function(){e.flush(),e.flushPeriodically()})),this.flushTimeout)},e}(),at=3145728;function ut(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?ft(e,t,n,{onSuccess:function(){return lt(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),ct(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function ct(e,t,n,r){2===e.transportStatus&&setTimeout(u((function(){ft(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=1e3,lt(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(6e4,2*e.currentBackoffTime),ct(e,t,n,r)}})})),e.currentBackoffTime)}function ft(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||e.status>=500)}(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 lt(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(3,"MiB"),source:Ce,startClocks:N()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=dt();i.size()>0;)ut(i.dequeue(),t,n,r,o)}function dt(){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>=at}}}function vt(e,t,n){var r={transportStatus:0,currentBackoffTime:1e3,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=81920&&this.ongoingRequestCount<32},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:dt(),queueFullReported:!1},o=function(n,r){return function(e,t,n,r){var o=n.data,i=n.bytesCount,s=n.retry;if(function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&i<t){var a=e.build("fetch",s);fetch(a,{method:"POST",body:o,keepalive:!0,mode:"cors"}).then(u((function(e){return null==r?void 0:r({status:e.status,type:e.type})})),u((function(){ht(e.build("xhr",s),o,r)})))}else{ht(e.build("xhr",s),o,r)}}(e,t,n,r)};return{send:function(t){ut(t,r,o,e.endpointType,n)},sendOnExit:function(n){!function(e,t,n){var r=n.data,o=n.bytesCount;if(navigator.sendBeacon&&o<t)try{var i=e.build("beacon");if(navigator.sendBeacon(i,r))return}catch(e){!function(e){pt||(pt=!0,rt(e))}(e)}ht(e.build("xhr"),r)}(e,t,n)}}}var pt=!1;function ht(e,t,n){var r=new XMLHttpRequest,o=u((function(){r.removeEventListener("loadend",o),null==n||n({status:r.status})}));r.open("POST",e,!0),r.addEventListener("loadend",o),r.send(t)}function gt(e,t,n,r,o){var i,s=a(t);function a(t){return new st(vt(t,e.batchBytesLimit,n),e.batchMessagesLimit,e.batchBytesLimit,e.messageBytesLimit,e.flushTimeout,r)}return o&&(i=a(o)),{add:function(e,t){void 0===t&&(t=!0),s.add(e),i&&t&&i.add(e)}}}var yt=1/0,mt=function(){function e(e){var t=this;this.expireDelay=e,this.entries=[],this.clearOldContextsInterval=setInterval((function(){return t.clearOldContexts()}),6e4)}return e.prototype.add=function(e,t){var n=this,r={context:e,startTime:t,endTime:yt,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.entries.unshift(r),r},e.prototype.find=function(e){void 0===e&&(e=yt);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.context;break}}},e.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===yt&&t.close(e)},e.prototype.findAll=function(e){return void 0===e&&(e=yt),this.entries.filter((function(t){return t.startTime<=e&&e<=t.endTime})).map((function(e){return e.context}))},e.prototype.reset=function(){this.entries=[]},e.prototype.stop=function(){clearInterval(this.clearOldContextsInterval)},e.prototype.clearOldContexts=function(){for(var e=U()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}();var bt,wt=144e5,Ct=9e5,xt=/^([a-z]+)=([a-z0-9-]+)$/,kt="&",St="_dd_s",Et=[];function _t(e,t){var n;if(void 0===t&&(t=0),bt||(bt=e),e===bt)if(t>=100)Lt();else{var r,o=Pt();if(Rt()){if(o.lock)return void Tt(e,t);if(r=h(),o.lock=r,Bt(o,e.options),(o=Pt()).lock!==r)return void Tt(e,t)}var i=e.process(o);if(Rt()&&(o=Pt()).lock!==r)Tt(e,t);else{if(i&&Ot(i,e.options),Rt()&&(!i||!Mt(i))){if((o=Pt()).lock!==r)return void Tt(e,t);delete o.lock,Bt(o,e.options),i=o}null===(n=e.after)||void 0===n||n.call(e,i||o),Lt()}}else Et.push(e)}function Rt(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)}function Tt(e,t){setTimeout(u((function(){_t(e,t+1)})),10)}function Lt(){bt=void 0;var e=Et.shift();e&&_t(e)}function Ot(e,t){Mt(e)?function(e){W(St,"",0,e)}(t):(e.expire=String(j()+Ct),Bt(e,t))}function Bt(e,t){W(St,function(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(kt);var t}(e),Ct,t)}function Pt(){var e=X(St),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(kt)||xt.test(e))}(e)&&e.split(kt).forEach((function(e){var n=xt.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}function Mt(e){return S(e)}function qt(e,t,n){var r=new Be,o=new Be,i=setInterval(u((function(){_t({options:e,process:function(e){return f(e)?void 0:{}},after:a})})),1e3),s=function(){var e=Pt();if(f(e))return e;return{}}();function a(e){return f(e)||(e={}),c()&&(!function(e){return s.id!==e.id||s[t]!==e[t]}(e)?s=e:(s={},o.notify())),e}function c(){return void 0!==s[t]}function f(e){return(void 0===e.created||j()-Number(e.created)<wt)&&(void 0===e.expire||j()<Number(e.expire))}return{expandOrRenewSession:v(u((function(){var o;_t({options:e,process:function(e){var r=a(e);return o=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;e[t]=o,i&&!e.id&&(e.id=h(),e.created=String(j()));return i}(r),r},after:function(e){o&&!c()&&function(e){s=e,r.notify()}(e),s=e}})})),1e3).throttled,expandSession:function(){_t({options:e,process:function(e){return c()?a(e):void 0}})},getSession:function(){return s},renewObservable:r,expireObservable:o,stop:function(){clearInterval(i)}}}var At=[];function It(e,t,n){!function(e){var t=X(St),n=X("_dd"),r=X("_dd_r"),o=X("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),Ot(i,e)}}(e);var r=qt(e,t,n);At.push((function(){return r.stop()}));var o,i=new mt(144e5);function s(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return At.push((function(){return i.stop()})),r.renewObservable.subscribe((function(){i.add(s(),U())})),r.expireObservable.subscribe((function(){i.closeActive(U())})),r.expandOrRenewSession(),i.add(s(),[0,F()][0]),o=Ae(window,["click","touchstart","keydown","scroll"],(function(){return r.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,At.push(o),function(e){var t=u((function(){"visible"===document.visibilityState&&e()})),n=qe(document,"visibilitychange",t).stop;At.push(n);var r=setInterval(t,6e4);At.push((function(){clearInterval(r)}))}((function(){return r.expandSession()})),{findActiveSession:function(e){return i.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable}}var jt;function Dt(e){var t=It(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:Ut(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}}}function Ut(e){return g(e.sessionSampleRate)?"1":"0"}var Nt=((jt={})[Fe.debug]=0,jt[Fe.info]=1,jt[Fe.warn]=2,jt[Fe.error]=3,jt);function Ft(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return Nt[e]>=Nt[n.getLevel()]&&w(o,t)}function Ht(e,t,n,r,o,i){var s=ze.concat(["custom"]),a={};s.forEach((function(e){var n,r,o,s,u;a[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,s=0,u=!1,{isLimitReached:function(){if(0===s&&setTimeout((function(){s=0}),d),(s+=1)<=r||u)return u=!1,!1;if(s===r+1){u=!0;try{o({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:Ce,startClocks:N()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(i){var s,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,h=i.logger,g=void 0===h?o:h,y=f.date-F(),m=e.findTrackedSession(y);if(m){var b=p||r(),w=B({service:t.service,session_id:m.id,usr:S(b.user)?void 0:b.user,view:b.view},b.context,zt(y),f,g.getContext(),d);!Ft(f.status,Ge,g)||!1===(null===(s=t.beforeSend)||void 0===s?void 0:s.call(t,w))||(null===(u=w.error)||void 0===u?void 0:u.origin)!==Ce&&(null!==(c=a[w.status])&&void 0!==c?c:a.custom).isLimitReached()||n.notify(1,w)}}))}var Gt=!1;function zt(t){var n,r=window;if(We()){var o=i(r.DD_RUM_SYNTHETICS);return o||Gt||(Gt=!0,function(t,n){f(e.debug,t,n),ot(p({type:Ye,message:t,status:"debug"},n))}("Logs sent before RUM is injected by the synthetics worker",{testId:(n=window._DATADOG_SYNTHETICS_PUBLIC_ID||X("datadog-synthetics-public-id"),"string"==typeof n?n:void 0),resultId:Xe()})),o}return i(r.DD_RUM);function i(e){if(e&&e.getInternalContext)return e.getInternalContext(t)}}var Vt,$t={};function Jt(e){var t=e.map((function(e){return $t[e]||($t[e]=function(e){var t=new Be((function(){var n=console[e];return console[e]=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(console,r);var i=Le();c((function(){t.notify(Wt(r,e,i))}))},function(){console[e]=n}}));return t}(e)),$t[e]}));return Pe.apply(void 0,t)}function Wt(t,n,r){var o,i=t.map((function(e){return function(e){if("string"==typeof e)return e;if(e instanceof Error)return Te(le(e));return m(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?Re(le(s)):void 0,i="console error: ".concat(i)}return{api:n,message:i,stack:o,handlingStack:r}}var Xt,Zt=((Vt={})[e.log]=Fe.info,Vt[e.debug]=Fe.debug,Vt[e.info]=Fe.info,Vt[e.warn]=Fe.warn,Vt[e.error]=Fe.error,Vt);var Yt,Kt=((Xt={})[Ie.cspViolation]=Fe.error,Xt[Ie.intervention]=Fe.error,Xt[Ie.deprecation]=Fe.warn,Xt);function Qt(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 en(e,t,n){var r=n.before,o=n.after;return Qt(e,t,(function(e){return function(){var t,n=arguments;return r&&c(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&c(o,this,n),t}}))}var tn,nn=new WeakMap;function rn(){var e;return Yt||(e=new Be((function(){var t=en(XMLHttpRequest.prototype,"open",{before:on}).stop,n=en(XMLHttpRequest.prototype,"send",{before:function(){sn.call(this,e)}}).stop,r=en(XMLHttpRequest.prototype,"abort",{before:an}).stop;return function(){t(),n(),r()}})),Yt=e),Yt}function on(e,t){nn.set(this,{state:"open",method:e,url:K(String(t))})}function sn(e){var t=this,n=nn.get(this);if(n){var r=n;r.state="start",r.startTime=U(),r.startClocks=N(),r.isAborted=!1,r.xhr=this;var o=!1,i=en(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&s()}}).stop,s=u((function(){if(t.removeEventListener("loadend",s),i(),!o){o=!0;var a,u=n;u.state="complete",u.duration=(a=r.startClocks.timeStamp,D()-a),u.status=t.status,e.notify(p({},u))}}));this.addEventListener("loadend",s),e.notify(r)}}function an(){var e=nn.get(this);e&&(e.isAborted=!0)}function un(){var e;return tn||(e=new Be((function(){if(window.fetch)return Qt(window,"fetch",(function(t){return function(n,r){var o,i=c(cn,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),c(fn,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),tn=e),tn}function cn(e,t,n){var r=n&&n.method||"object"==typeof t&&t.method||"GET",o=K("object"==typeof t&&t.url||t),i={state:"start",init:n,input:t,method:r,startClocks:N(),url:o};return e.notify(i),i}function fn(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(u(r),u(r))}function ln(e,t){if(!e.forwardErrorsToLogs)return{stop:y};var n=rn().subscribe((function(e){"complete"===e.state&&o("xhr",e)})),r=un().subscribe((function(e){"resolve"===e.state&&o("fetch",e)}));function o(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(vn(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:Se,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:Fe.error,origin:Se}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(dn(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 s(){var e,s;if(r.cancel().catch(y),n.collectStreamBody){var a;if(1===o.length)a=o[0];else{a=new Uint8Array(i);var u=0;o.forEach((function(e){a.set(e,u),u+=e.length}))}e=a.slice(0,n.bytesLimit),s=a.length>n.bytesLimit}t(void 0,e,s)}!function e(){r.read().then(u((function(t){t.done?s():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?s():e())})),u((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(u((function(e){return n(dn(e,t))})),u((function(e){return n("Unable to retrieve response: ".concat(e))}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(dn(Re(le(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function dn(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function vn(e){return"xhr"===e?"XHR":"Fetch"}var pn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function hn(e){var t=function(e){return en(window,"onerror",{before:function(t,n,r,o,i){var s;if(i)s=le(i),e(s,i);else{var a,u={url:n,column:o,line:r},c=t;if("[object String]"==={}.toString.call(t)){var f=pn.exec(c);f&&(a=f[1],c=f[2])}e(s={name:a,message:"string"==typeof c?c:void 0,stack:[u]},t)}}})}(e).stop,n=function(e){return en(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=le(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}function gn(e){return hn((function(t,n){e.notify(function(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,s=e.source,a=e.handling;return t&&(void 0!==t.message||n instanceof Error)?{startClocks:o,source:s,handling:a,originalError:n,message:t.message||"Empty message",stack:Re(t),handlingStack:r,type:t.name,causes:Oe(n,s)}:{startClocks:o,source:s,handling:a,originalError:n,message:"".concat(i," ").concat(m(n)),stack:"No stack, consider using an instance of Error",handlingStack:r,type:t&&t.name}}({stackTrace:t,originalError:n,startClocks:N(),nonErrorPrefix:"Uncaught",source:Ee,handling:"unhandled"}))}))}var yn=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 mn,bn,wn,Cn,xn=function(n){var r,o,i=!1,a=q(),c=q(),f={},l=function(){},d=new I,v=function(e,t,n,r){void 0===n&&(n=O(y())),void 0===r&&(r=D()),d.add((function(){return v(e,t,n,r)}))},h=function(){},g=new Ve((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.apply(void 0,e)}));function y(){return{view:{referrer:document.referrer,url:window.location.href},context:a.getContext(),user:c.getContext()}}return r={logger:g,init:u((function(r){var o;if(h=function(){return O(r)},G()&&(r=function(e){return p({},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=ue(t),r=Ue(t.forwardConsoleLogs,k(e),"Forward Console Logs"),o=Ue(t.forwardReports,k(Ie),"Forward Reports");if(n&&r&&o)return t.forwardErrorsToLogs&&!w(r,e.error)&&r.push(e.error),p({forwardErrorsToLogs:!1!==t.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:32768},n)}(r);s&&(o=n(r,s,y,g),v=o.handleLog,l=o.getInternalContext,d.drain(),i=!0)}})),getLoggerGlobalContext:u(a.get),getGlobalContext:u(a.getContext),setLoggerGlobalContext:u(a.set),setGlobalContext:u(a.setContext),addLoggerGlobalContext:u(a.add),setGlobalContextProperty:u(a.setContextProperty),removeLoggerGlobalContext:u(a.remove),removeGlobalContextProperty:u(a.removeContextProperty),clearGlobalContext:u(a.clearContext),createLogger:u((function(e,t){return void 0===t&&(t={}),f[e]=new Ve((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.apply(void 0,e)}),e,t.handler,t.level,t.context),f[e]})),getLogger:u((function(e){return f[e]})),getInitConfiguration:u((function(){return h()})),getInternalContext:u((function(e){return l(e)})),setUser:u((function(e){(function(e){var n="object"===T(e);return n||t.error("Unsupported user:",e),n})(e)&&c.setContext(z(e))})),getUser:u(c.getContext),setUserProperty:u((function(e,t){var n,r=z((n={},n[e]=t,n))[e];c.setContextProperty(e,r)})),removeUserProperty:u(c.removeContextProperty),clearUser:u(c.clearContext)},o=p({version:"4.34.1",onReady:function(e){e()}},r),Object.defineProperty(o,"_setDebug",{get:function(){return s},enumerable:!1}),o}((function(n,r,o,i){var s=new yn;s.subscribe(1,(function(e){return $e("logs",e)}));var a,u=function(e){return s.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:Ce},origin:Ce,status:Fe.error}})},c=a=new Be((function(){var e=Ae(window,["visibilitychange","freeze"],(function(e){"visibilitychange"===e.type&&"hidden"===document.visibilityState?a.notify({reason:Je.HIDDEN}):"freeze"===e.type&&a.notify({reason:Je.FROZEN})}),{capture:!0}).stop,t=qe(window,"beforeunload",(function(){a.notify({reason:Je.UNLOADING})})).stop;return function(){e(),t()}})),f=function(e,t,n){var r,o=nt("browser-logs-sdk",e);if(G()){var i=H();o.observable.subscribe((function(e){return i.send("internal_telemetry",e)}))}else{var s=gt(e,e.rumEndpointBuilder,t,n,null===(r=e.replica)||void 0===r?void 0:r.rumEndpointBuilder);o.observable.subscribe((function(t){return s.add(t,function(e){return"datad0g.com"===e.site}(e))}))}return o}(r,u,c);f.setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=zt())||void 0===e?void 0:e.application_id},session:{id:null===(t=g.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=zt())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=zt())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),ln(r,s),function(e,t){if(!e.forwardErrorsToLogs)return{stop:y};var n=new Be,r=gn(n).stop,o=n.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:Ee,stack:e.stack},origin:Ee,status:Fe.error}})}))}(r,s),function(t,n){var r=Jt(t.forwardConsoleLogs).subscribe((function(t){n.notify(0,{rawLogsEvent:{date:D(),message:t.message,origin:xe,error:t.api===e.error?{origin:xe,stack:t.stack}:void 0,status:Zt[t.api]}})}))}(r,s),function(e,t){var n=je(e.forwardReports).subscribe((function(e){var n,r=e.message,o=Kt[e.type];o===Fe.error?n={kind:e.subtype,origin:_e,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:D(),message:r,origin:_e,error:n,status:o}})}))}(r,s);var l,v=function(e){return{handleLog:function(n,r,o,i){var s=n.context;Ft(n.status,He,r)&&t(n.status,n.message,B(r.getContext(),s)),e.notify(0,{rawLogsEvent:{date:i||D(),message:n.message,status:n.status,origin:ke},messageContext:s,savedCommonContext:o,logger:r})}}}(s).handleLog,g=!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var n="dd_cookie_test_".concat(h()),r="test";W(n,r,d,e);var o=X(n)===r;return Z(n,e),o}catch(e){return t.error(e),!1}}(r.cookieOptions)||G()||We()?function(e){var t="1"===Ut(e)?{}:void 0;return{findTrackedSession:function(){return t}}}(r):Dt(r);return Ht(g,r,s,o,i,u),G()?function(e){var t=H();e.subscribe(1,(function(e){t.send("log",e)}))}(s):function(e,t,n,r){var o,i=gt(e,e.logsEndpointBuilder,n,r,null===(o=e.replica)||void 0===o?void 0:o.logsEndpointBuilder);t.subscribe(1,(function(e){i.add(e)}))}(r,s,u,c),function(e){tt.telemetryConfigurationEnabled&&ot({type:Ke,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}}(e);return p({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(n)),{handleLog:v,getInternalContext:(l=g,{get:function(e){var t=l.findTrackedSession(e);if(t)return{session_id:t.id}}}).get}}));mn=_(),wn=xn,Cn=mn[bn="DD_LOGS"],mn[bn]=wn,Cn&&Cn.q&&Cn.q.forEach((function(e){return n(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)};function n(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=console.debug.bind(console),t.log=console.log.bind(console),t.info=console.info.bind(console),t.warn=console.warn.bind(console),t.error=console.error.bind(console);var r,o=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))},i=!1;function s(e){i=e}function a(e,t,n){var o=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=r?u(o):o;return n.apply(this,e)}}function u(e){return function(){return c(e,this,arguments)}}function c(t,n,o){try{return t.apply(n,o)}catch(t){if(f(e.error,t),r)try{r(t)}catch(t){f(e.error,t)}}}function f(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];i&&t.apply(void 0,o([e,"[MONITOR]"],n,!1))}var l=1e3,d=6e4;function v(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,s=!n||void 0===n.trailing||n.trailing,a=!1;return{throttled:function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];a?r=n:(i?e.apply(void 0,n):r=n,a=!0,o=setTimeout((function(){s&&r&&e.apply(void 0,r),a=!1,r=void 0}),t))},cancel:function(){clearTimeout(o),a=!1,r=void 0}}}function p(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 h(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,h)}function g(e){return 0!==e&&100*Math.random()<=e}function y(){}function m(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)),s=b(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),s()}}function b(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):y}function w(e,t){return-1!==e.indexOf(t)}function C(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 x(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100}function k(e){return Object.keys(e).map((function(t){return e[t]}))}function S(e){return 0===Object.keys(e).length}function E(e,t){return e.slice(0,t.length)===t}function _(){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}function R(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)}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 s="object"===T(e)?e:{};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=L(s[a],t[a],n));return s}}function O(e){return L(void 0,e)}function B(){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}var P=/[^\u0000-\u007F]/;function M(e){return P.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}function A(e){void 0===e&&(e=M);var t,n={};return{getBytesCount:function(){return void 0===t&&(t=e(m(n))),t},get:function(){return n},add:function(e,r){n[e]=r,t=void 0},remove:function(e){delete n[e],t=void 0},set:function(e){n=e,t=void 0},getContext:function(){return O(n)},setContext:function(e){n=O(e),t=void 0},setContextProperty:function(e,r){n[e]=O(r),t=void 0},removeContextProperty:function(e){delete n[e],t=void 0},clearContext:function(){n={},t=void 0}}}var I,q=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}();function j(){return(new Date).getTime()}function D(){return j()}function U(){return performance.now()}function N(){return{relative:U(),timeStamp:D()}}function F(){return void 0===I&&(I=performance.timing.navigationStart),I}function H(){var e=_().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function G(e){var t;void 0===e&&(e=null===(t=_().location)||void 0===t?void 0:t.hostname);var n=H();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}function z(e){var t=p({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t}var V,$,J;function W(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires=".concat(o.toUTCString()),s=r&&r.crossSite?"none":"strict",a=r&&r.domain?";domain=".concat(r.domain):"",u=r&&r.secure?";secure":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(s).concat(a).concat(u)}function X(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 Z(e,t){W(e,"",0,t)}function Y(e){return!!$&&$.has(e)}function K(){return $||new Set}function Q(e){return ee(e,function(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}(window.location)).href}function ee(e,t){if(function(){if(void 0!==J)return J;try{var e=new URL("http://test/path");return J="http://test/path"===e.href}catch(e){J=!1}return J}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}var te="datadoghq.com",ne="ap1.datadoghq.com",re={logs:"logs",rum:"rum",sessionReplay:"session-replay"},oe={logs:"logs",rum:"rum",sessionReplay:"replay"};function ie(e,t,n){var r=function(e,t){var n="/api/v2/".concat(oe[t]),r=e.proxy,o=e.proxyUrl;if(r){var i=Q(r);return function(e){return"".concat(i,"?ddforward=").concat(encodeURIComponent("".concat(n,"?").concat(e)))}}var s=function(e,t){var n=e.site,r=void 0===n?te:n,o=e.internalAnalyticsSubdomain;if(o&&r===te)return"".concat(o,".").concat(te);var i=r.split("."),s=i.pop(),a=r!==ne?"".concat(re[t],"."):"";return"".concat(a,"browser-intake-").concat(i.join("-"),".").concat(s)}(e,t);if(void 0===r&&o){var a=Q(o);return function(e){return"".concat(a,"?ddforward=").concat(encodeURIComponent("https://".concat(s).concat(n,"?").concat(e)))}}return function(e){return"https://".concat(s).concat(n,"?").concat(e)}}(e,t);return{build:function(o,i,s){var a=function(e,t,n,r,o,i){var s=e.clientToken,a=e.internalAnalyticsSubdomain,u=["sdk_version:".concat("4.34.2"),"api:".concat(r)].concat(n);o&&Y("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(s),"dd-evp-origin-version=".concat(encodeURIComponent("4.34.2")),"dd-evp-origin=browser","dd-request-id=".concat(h())];"rum"===t&&c.push("batch_time=".concat(D()));a&&c.reverse();return c.join("&")}(e,t,n,o,i,s);return r(a)},urlPrefix:r(""),endpointType:t}}var se=/[^a-z0-9_:./-]/;function ae(e,n){var r=200-e.length-1;(n.length>r||se.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 ue(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(ae("env",t)),n&&i.push(ae("service",n)),r&&i.push(ae("version",r)),o&&i.push(ae("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:ie(e,"logs",t),rumEndpointBuilder:ie(e,"rum",t),sessionReplayEndpointBuilder:ie(e,"sessionReplay",t)}}(e,t),r=k(n).map((function(e){return e.urlPrefix})),o=function(e,t,n){if(!e.replica)return;var r=p({},e,{site:te,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:ie(r,"logs",n),rumEndpointBuilder:ie(r,"rum",n)};return t.push.apply(t,k(o).map((function(e){return e.urlPrefix}))),p({applicationId:e.replica.applicationId},o)}(e,r,t);return p({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||te},n)}function ce(e){var r,o,i;if(e&&e.clientToken){var s=null!==(r=e.sessionSampleRate)&&void 0!==r?r:e.sampleRate;if(void 0===s||x(s))if(void 0===e.telemetrySampleRate||x(e.telemetrySampleRate)){var a;if(void 0===e.telemetryConfigurationSampleRate||x(e.telemetryConfigurationSampleRate))return a=e.enableExperimentalFeatures,Array.isArray(a)&&($||($=new Set(a)),a.filter((function(e){return"string"==typeof e})).forEach((function(e){w(e,"-")&&t.warn("please use snake case for '".concat(e,"'")),$.add(e)}))),p({beforeSend:e.beforeSend&&n(e.beforeSend,"beforeSend threw an error:"),cookieOptions:fe(e),sessionSampleRate:null!=s?s: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:16384,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:3e4,batchMessagesLimit:50,messageBytesLimit:262144},ue(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.")}function fe(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===V){for(var e="dd_site_test_".concat(h()),t=window.location.hostname.split("."),n=t.pop();t.length&&!X(e);)n="".concat(t.pop(),".").concat(n),W(e,"test",l,{domain:n});Z(e,{domain:n}),V=n}return V}()),t}var le="?";function de(e){var t=[],n=Ce(e,"stack"),r=String(e);return n&&E(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=he.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=ge.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]||le,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=ye.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:le,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=me.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||le,line:+t[3],url:t[2]}}(e)||function(e){var t=be.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=we.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]||le,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=le),t.push(n))})),{message:Ce(e,"message"),name:Ce(e,"name"),stack:t}}var ve="((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\\w+\\.|\\/).*?)",pe="(?::(\\d+))",he=new RegExp("^\\s*at (.*?) ?\\(".concat(ve).concat(pe,"?").concat(pe,"?\\)?\\s*$"),"i"),ge=new RegExp("\\((\\S*)".concat(pe).concat(pe,"\\)"));var ye=new RegExp("^\\s*at ?".concat(ve).concat(pe,"?").concat(pe,"??\\s*$"),"i");var me=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var be=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,we=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Ce(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}var xe="agent",ke="console",Se="logger",Ee="network",_e="source",Re="report";function Te(e){var t=Le(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 Le(e){return"".concat(e.name||"Error",": ").concat(e.message)}function Oe(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return c((function(){var n=de(t);n.stack=n.stack.slice(2),e=Te(n)})),e}function Be(e,t){for(var n=e,r=[];(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=de(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&Te(o)}),n=n.cause}return r.length?r:void 0}var Pe=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 Me(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Pe((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}function Ae(e,t){var n,r=window;return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function Ie(e,t,n,r){return qe(e,[t],n,r)}function qe(e,t,n,r){var o=void 0===r?{}:r,i=o.once,s=o.capture,a=o.passive,c=u(i?function(e){d(),n(e)}:n),f=a?{capture:s,passive:a}:s,l=Ae(e,"addEventListener");function d(){var n=Ae(e,"removeEventListener");t.forEach((function(t){return n.call(e,t,c,f)}))}return t.forEach((function(t){return l.call(e,t,c,f)})),{stop:d}}var je={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function De(e){var t,n=[];w(e,je.cspViolation)&&n.push(t=new Pe((function(){var e=u((function(e){t.notify(function(e){var t=je.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:je.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:Ue(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(R(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))}));return Ie(document,"securitypolicyviolation",e).stop})));var r=e.filter((function(e){return e!==je.cspViolation}));return r.length&&n.push(function(e){var t=new Pe((function(){if(window.ReportingObserver){var n=u((function(e){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:Ue(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)),Me.apply(void 0,n)}function Ue(e,t,n,r,o){return n&&Te({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})}function Ne(e,n,r){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return w(n,e)}))?"all"===e?n:(o=e,i=new Set,o.forEach((function(e){return i.add(e)})),C(i)):void t.error("".concat(r,' should be "all" or an array with allowed values "').concat(n.join('", "'),'"'));var o,i}var Fe=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},He={debug:"debug",error:"error",info:"info",warn:"warn"},Ge="console",ze="http",Ve=Object.keys(He),$e=function(){function e(e,t,n,r,o){void 0===n&&(n=ze),void 0===r&&(r=He.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=A(),this.contextManager.set(p({},o,t?{logger:{name:t}}:void 0))}return e.prototype.log=function(e,t,n){void 0===n&&(n=He.info),this.handleLogStrategy({message:e,context:O(t),status:n},this)},e.prototype.debug=function(e,t){this.log(e,t,He.debug)},e.prototype.info=function(e,t){this.log(e,t,He.info)},e.prototype.warn=function(e,t){this.log(e,t,He.warn)},e.prototype.error=function(e,t){var n={error:{origin:Se}};this.log(e,B(n,t),He.error)},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},Fe([a],e.prototype,"log",null),e}();function Je(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var We={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function Xe(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||X("datadog-synthetics-injects-rum"))}function Ze(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||X("datadog-synthetics-result-id");return"string"==typeof e?e:void 0}var Ye,Ke="log",Qe="configuration",et=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","http://localhost","<anonymous>"],tt=["ddog-gov.com"],nt={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function rt(e,t){var n,o=new Pe;return nt.telemetryEnabled=!w(tt,t.site)&&g(t.telemetrySampleRate),nt.telemetryConfigurationEnabled=nt.telemetryEnabled&&g(t.telemetryConfigurationSampleRate),Ye=function(t){if(nt.telemetryEnabled){var r=function(e,t){return B({type:"telemetry",date:D(),service:e,version:"4.34.2",source:"browser",_dd:{format_version:2},telemetry:t,experimental_features:C(K())},void 0!==n?n():{})}(e,t);o.notify(r),Je("telemetry",r)}},r=ot,p(nt,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:o,enabled:nt.telemetryEnabled}}function ot(e){it(p({type:Ke,status:"error"},function(e){if(e instanceof Error){var t=de(e);return{error:{kind:t.name,stack:Te(st(t))},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught ".concat(m(e))}}(e)))}function it(e){Ye&&nt.sentEventCount<nt.maxEventsPerPage&&(nt.sentEventCount+=1,Ye(e))}function st(e){return e.stack=e.stack.filter((function(e){return!e.url||et.some((function(t){return E(e.url,t)}))})),e}var at=function(){function e(e,t,n,r,o,i){var s=this;this.request=e,this.batchMessagesLimit=t,this.batchBytesLimit=n,this.messageBytesLimit=r,this.flushTimeout=o,this.pageExitObservable=i,this.flushObservable=new Pe,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,i.subscribe((function(e){return s.flush(e.reason,s.request.sendOnExit)})),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(e,t){if(void 0===t&&(t=this.request.send),0!==this.bufferMessagesCount){var n=this.pushOnlyBuffer.concat(k(this.upsertBuffer)),r=this.bufferBytesCount;this.flushObservable.notify({bufferBytesCount:this.bufferBytesCount,bufferMessagesCount:this.bufferMessagesCount}),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,t({data:n.join("\n"),bytesCount:r,flushReason:e})}},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.willReachedBytesLimitWith(i)&&this.flush("batch_bytes_limit"),this.push(o,i,n),this.isFull()&&this.flush("batch_bytes_limit"))},e.prototype.process=function(e){var t=m(e);return{processedMessage:t,messageBytesCount:M(t)}},e.prototype.push=function(e,t,n){this.bufferMessagesCount>0&&(this.bufferBytesCount+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesCount+=t,this.bufferMessagesCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=M(t);this.bufferBytesCount-=n,this.bufferMessagesCount-=1,this.bufferMessagesCount>0&&(this.bufferBytesCount-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesCount+e+1>=this.batchBytesLimit},e.prototype.isFull=function(){return this.bufferMessagesCount===this.batchMessagesLimit||this.bufferBytesCount>=this.batchBytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout(u((function(){e.flush("batch_duration_limit"),e.flushPeriodically()})),this.flushTimeout)},e}(),ut=3145728;function ct(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?lt(e,t,n,{onSuccess:function(){return dt(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),ft(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function ft(e,t,n,r){2===e.transportStatus&&setTimeout(u((function(){lt(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=1e3,dt(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(6e4,2*e.currentBackoffTime),ft(e,t,n,r)}})})),e.currentBackoffTime)}function lt(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||e.status>=500)}(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 dt(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(3,"MiB"),source:xe,startClocks:N()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=vt();i.size()>0;)ct(i.dequeue(),t,n,r,o)}function vt(){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>=ut}}}function pt(e,t,n){var r={transportStatus:0,currentBackoffTime:1e3,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=81920&&this.ongoingRequestCount<32},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:vt(),queueFullReported:!1},o=function(n,r){return function(e,t,n,r){var o=n.data,i=n.bytesCount,s=n.flushReason,a=n.retry;if(function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&i<t){var c=e.build("fetch",s,a);fetch(c,{method:"POST",body:o,keepalive:!0,mode:"cors"}).then(u((function(e){return null==r?void 0:r({status:e.status,type:e.type})})),u((function(){gt(e.build("xhr",s,a),o,r)})))}else{gt(e.build("xhr",s,a),o,r)}}(e,t,n,r)};return{send:function(t){ct(t,r,o,e.endpointType,n)},sendOnExit:function(n){!function(e,t,n){var r=n.data,o=n.bytesCount,i=n.flushReason;if(navigator.sendBeacon&&o<t)try{var s=e.build("beacon",i);if(navigator.sendBeacon(s,r))return}catch(e){!function(e){ht||(ht=!0,ot(e))}(e)}gt(e.build("xhr",i),r)}(e,t,n)}}}var ht=!1;function gt(e,t,n){var r=new XMLHttpRequest,o=u((function(){r.removeEventListener("loadend",o),null==n||n({status:r.status})}));r.open("POST",e,!0),r.addEventListener("loadend",o),r.send(t)}function yt(e,t,n,r,o){var i,s=a(t);function a(t){return new at(pt(t,e.batchBytesLimit,n),e.batchMessagesLimit,e.batchBytesLimit,e.messageBytesLimit,e.flushTimeout,r)}return o&&(i=a(o)),{add:function(e,t){void 0===t&&(t=!0),s.add(e),i&&t&&i.add(e)}}}var mt=1/0,bt=function(){function e(e){var t=this;this.expireDelay=e,this.entries=[],this.clearOldContextsInterval=setInterval((function(){return t.clearOldContexts()}),6e4)}return e.prototype.add=function(e,t){var n=this,r={context:e,startTime:t,endTime:mt,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.entries.unshift(r),r},e.prototype.find=function(e){void 0===e&&(e=mt);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.context;break}}},e.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===mt&&t.close(e)},e.prototype.findAll=function(e){return void 0===e&&(e=mt),this.entries.filter((function(t){return t.startTime<=e&&e<=t.endTime})).map((function(e){return e.context}))},e.prototype.reset=function(){this.entries=[]},e.prototype.stop=function(){clearInterval(this.clearOldContextsInterval)},e.prototype.clearOldContexts=function(){for(var e=U()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}();var wt,Ct=144e5,xt=9e5,kt=/^([a-z]+)=([a-z0-9-]+)$/,St="&",Et="_dd_s",_t=[];function Rt(e,t){var n;if(void 0===t&&(t=0),wt||(wt=e),e===wt)if(t>=100)Ot();else{var r,o=Mt();if(Tt()){if(o.lock)return void Lt(e,t);if(r=h(),o.lock=r,Pt(o,e.options),(o=Mt()).lock!==r)return void Lt(e,t)}var i=e.process(o);if(Tt()&&(o=Mt()).lock!==r)Lt(e,t);else{if(i&&Bt(i,e.options),Tt()&&(!i||!At(i))){if((o=Mt()).lock!==r)return void Lt(e,t);delete o.lock,Pt(o,e.options),i=o}null===(n=e.after)||void 0===n||n.call(e,i||o),Ot()}}else _t.push(e)}function Tt(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)}function Lt(e,t){setTimeout(u((function(){Rt(e,t+1)})),10)}function Ot(){wt=void 0;var e=_t.shift();e&&Rt(e)}function Bt(e,t){At(e)?function(e){W(Et,"",0,e)}(t):(e.expire=String(j()+xt),Pt(e,t))}function Pt(e,t){W(Et,function(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(St);var t}(e),xt,t)}function Mt(){var e=X(Et),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(St)||kt.test(e))}(e)&&e.split(St).forEach((function(e){var n=kt.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}function At(e){return S(e)}function It(e,t,n){var r=new Pe,o=new Pe,i=setInterval(u((function(){Rt({options:e,process:function(e){return f(e)?void 0:{}},after:a})})),1e3),s=function(){var e=Mt();if(f(e))return e;return{}}();function a(e){return f(e)||(e={}),c()&&(!function(e){return s.id!==e.id||s[t]!==e[t]}(e)?s=e:(s={},o.notify())),e}function c(){return void 0!==s[t]}function f(e){return(void 0===e.created||j()-Number(e.created)<Ct)&&(void 0===e.expire||j()<Number(e.expire))}return{expandOrRenewSession:v(u((function(){var o;Rt({options:e,process:function(e){var r=a(e);return o=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;e[t]=o,i&&!e.id&&(e.id=h(),e.created=String(j()));return i}(r),r},after:function(e){o&&!c()&&function(e){s=e,r.notify()}(e),s=e}})})),1e3).throttled,expandSession:function(){Rt({options:e,process:function(e){return c()?a(e):void 0}})},getSession:function(){return s},renewObservable:r,expireObservable:o,stop:function(){clearInterval(i)}}}var qt=[];function jt(e,t,n){!function(e){var t=X(Et),n=X("_dd"),r=X("_dd_r"),o=X("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),Bt(i,e)}}(e);var r=It(e,t,n);qt.push((function(){return r.stop()}));var o,i=new bt(144e5);function s(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return qt.push((function(){return i.stop()})),r.renewObservable.subscribe((function(){i.add(s(),U())})),r.expireObservable.subscribe((function(){i.closeActive(U())})),r.expandOrRenewSession(),i.add(s(),[0,F()][0]),o=qe(window,["click","touchstart","keydown","scroll"],(function(){return r.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,qt.push(o),function(e){var t=u((function(){"visible"===document.visibilityState&&e()})),n=Ie(document,"visibilitychange",t).stop;qt.push(n);var r=setInterval(t,6e4);qt.push((function(){clearInterval(r)}))}((function(){return r.expandSession()})),{findActiveSession:function(e){return i.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable}}var Dt;function Ut(e){var t=jt(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:Nt(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}}}function Nt(e){return g(e.sessionSampleRate)?"1":"0"}var Ft=((Dt={})[He.debug]=0,Dt[He.info]=1,Dt[He.warn]=2,Dt[He.error]=3,Dt);function Ht(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return Ft[e]>=Ft[n.getLevel()]&&w(o,t)}function Gt(e,t,n,r,o,i){var s=Ve.concat(["custom"]),a={};s.forEach((function(e){var n,r,o,s,u;a[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,s=0,u=!1,{isLimitReached:function(){if(0===s&&setTimeout((function(){s=0}),d),(s+=1)<=r||u)return u=!1,!1;if(s===r+1){u=!0;try{o({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:xe,startClocks:N()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(i){var s,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,h=i.logger,g=void 0===h?o:h,y=f.date-F(),m=e.findTrackedSession(y);if(m){var b=p||r(),w=B({service:t.service,session_id:m.id,usr:S(b.user)?void 0:b.user,view:b.view},b.context,Vt(y),f,g.getContext(),d);!Ht(f.status,ze,g)||!1===(null===(s=t.beforeSend)||void 0===s?void 0:s.call(t,w))||(null===(u=w.error)||void 0===u?void 0:u.origin)!==xe&&(null!==(c=a[w.status])&&void 0!==c?c:a.custom).isLimitReached()||n.notify(1,w)}}))}var zt=!1;function Vt(t){var n,r=window;if(Xe()){var o=i(r.DD_RUM_SYNTHETICS);return o||zt||(zt=!0,function(t,n){f(e.debug,t,n),it(p({type:Ke,message:t,status:"debug"},n))}("Logs sent before RUM is injected by the synthetics worker",{testId:(n=window._DATADOG_SYNTHETICS_PUBLIC_ID||X("datadog-synthetics-public-id"),"string"==typeof n?n:void 0),resultId:Ze()})),o}return i(r.DD_RUM);function i(e){if(e&&e.getInternalContext)return e.getInternalContext(t)}}var $t,Jt={};function Wt(e){var t=e.map((function(e){return Jt[e]||(Jt[e]=function(e){var t=new Pe((function(){var n=console[e];return console[e]=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(console,r);var i=Oe();c((function(){t.notify(Xt(r,e,i))}))},function(){console[e]=n}}));return t}(e)),Jt[e]}));return Me.apply(void 0,t)}function Xt(t,n,r){var o,i=t.map((function(e){return function(e){if("string"==typeof e)return e;if(e instanceof Error)return Le(de(e));return m(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?Te(de(s)):void 0,i="console error: ".concat(i)}return{api:n,message:i,stack:o,handlingStack:r}}var Zt,Yt=(($t={})[e.log]=He.info,$t[e.debug]=He.debug,$t[e.info]=He.info,$t[e.warn]=He.warn,$t[e.error]=He.error,$t);var Kt,Qt=((Zt={})[je.cspViolation]=He.error,Zt[je.intervention]=He.error,Zt[je.deprecation]=He.warn,Zt);function en(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 tn(e,t,n){var r=n.before,o=n.after;return en(e,t,(function(e){return function(){var t,n=arguments;return r&&c(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&c(o,this,n),t}}))}var nn,rn=new WeakMap;function on(){var e;return Kt||(e=new Pe((function(){var t=tn(XMLHttpRequest.prototype,"open",{before:sn}).stop,n=tn(XMLHttpRequest.prototype,"send",{before:function(){an.call(this,e)}}).stop,r=tn(XMLHttpRequest.prototype,"abort",{before:un}).stop;return function(){t(),n(),r()}})),Kt=e),Kt}function sn(e,t){rn.set(this,{state:"open",method:e,url:Q(String(t))})}function an(e){var t=this,n=rn.get(this);if(n){var r=n;r.state="start",r.startTime=U(),r.startClocks=N(),r.isAborted=!1,r.xhr=this;var o=!1,i=tn(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&s()}}).stop,s=u((function(){if(t.removeEventListener("loadend",s),i(),!o){o=!0;var a,u=n;u.state="complete",u.duration=(a=r.startClocks.timeStamp,D()-a),u.status=t.status,e.notify(p({},u))}}));this.addEventListener("loadend",s),e.notify(r)}}function un(){var e=rn.get(this);e&&(e.isAborted=!0)}function cn(){var e;return nn||(e=new Pe((function(){if(window.fetch)return en(window,"fetch",(function(t){return function(n,r){var o,i=c(fn,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),c(ln,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),nn=e),nn}function fn(e,t,n){var r=n&&n.method||"object"==typeof t&&t.method||"GET",o=Q("object"==typeof t&&t.url||t),i={state:"start",init:n,input:t,method:r,startClocks:N(),url:o};return e.notify(i),i}function ln(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(u(r),u(r))}function dn(e,t){if(!e.forwardErrorsToLogs)return{stop:y};var n=on().subscribe((function(e){"complete"===e.state&&o("xhr",e)})),r=cn().subscribe((function(e){"resolve"===e.state&&o("fetch",e)}));function o(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(pn(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:Ee,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:He.error,origin:Ee}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(vn(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 s(){var e,s;if(r.cancel().catch(y),n.collectStreamBody){var a;if(1===o.length)a=o[0];else{a=new Uint8Array(i);var u=0;o.forEach((function(e){a.set(e,u),u+=e.length}))}e=a.slice(0,n.bytesLimit),s=a.length>n.bytesLimit}t(void 0,e,s)}!function e(){r.read().then(u((function(t){t.done?s():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?s():e())})),u((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(u((function(e){return n(vn(e,t))})),u((function(e){return n("Unable to retrieve response: ".concat(e))}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(vn(Te(de(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function vn(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function pn(e){return"xhr"===e?"XHR":"Fetch"}var hn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function gn(e){var t=function(e){return tn(window,"onerror",{before:function(t,n,r,o,i){var s;if(i)s=de(i),e(s,i);else{var a,u={url:n,column:o,line:r},c=t;if("[object String]"==={}.toString.call(t)){var f=hn.exec(c);f&&(a=f[1],c=f[2])}e(s={name:a,message:"string"==typeof c?c:void 0,stack:[u]},t)}}})}(e).stop,n=function(e){return tn(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=de(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}function yn(e){return gn((function(t,n){e.notify(function(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,s=e.source,a=e.handling;return t&&(void 0!==t.message||n instanceof Error)?{startClocks:o,source:s,handling:a,originalError:n,message:t.message||"Empty message",stack:Te(t),handlingStack:r,type:t.name,causes:Be(n,s)}:{startClocks:o,source:s,handling:a,originalError:n,message:"".concat(i," ").concat(m(n)),stack:"No stack, consider using an instance of Error",handlingStack:r,type:t&&t.name}}({stackTrace:t,originalError:n,startClocks:N(),nonErrorPrefix:"Uncaught",source:_e,handling:"unhandled"}))}))}var mn=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 bn,wn,Cn,xn,kn=function(n){var r,o,i=!1,a=A(),c=A(),f={},l=function(){},d=new q,v=function(e,t,n,r){void 0===n&&(n=O(y())),void 0===r&&(r=D()),d.add((function(){return v(e,t,n,r)}))},h=function(){},g=new $e((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.apply(void 0,e)}));function y(){return{view:{referrer:document.referrer,url:window.location.href},context:a.getContext(),user:c.getContext()}}return r={logger:g,init:u((function(r){var o;if(h=function(){return O(r)},G()&&(r=function(e){return p({},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=ce(t),r=Ne(t.forwardConsoleLogs,k(e),"Forward Console Logs"),o=Ne(t.forwardReports,k(je),"Forward Reports");if(n&&r&&o)return t.forwardErrorsToLogs&&!w(r,e.error)&&r.push(e.error),p({forwardErrorsToLogs:!1!==t.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:32768},n)}(r);s&&(o=n(r,s,y,g),v=o.handleLog,l=o.getInternalContext,d.drain(),i=!0)}})),getLoggerGlobalContext:u(a.get),getGlobalContext:u(a.getContext),setLoggerGlobalContext:u(a.set),setGlobalContext:u(a.setContext),addLoggerGlobalContext:u(a.add),setGlobalContextProperty:u(a.setContextProperty),removeLoggerGlobalContext:u(a.remove),removeGlobalContextProperty:u(a.removeContextProperty),clearGlobalContext:u(a.clearContext),createLogger:u((function(e,t){return void 0===t&&(t={}),f[e]=new $e((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.apply(void 0,e)}),e,t.handler,t.level,t.context),f[e]})),getLogger:u((function(e){return f[e]})),getInitConfiguration:u((function(){return h()})),getInternalContext:u((function(e){return l(e)})),setUser:u((function(e){(function(e){var n="object"===T(e);return n||t.error("Unsupported user:",e),n})(e)&&c.setContext(z(e))})),getUser:u(c.getContext),setUserProperty:u((function(e,t){var n,r=z((n={},n[e]=t,n))[e];c.setContextProperty(e,r)})),removeUserProperty:u(c.removeContextProperty),clearUser:u(c.clearContext)},o=p({version:"4.34.2",onReady:function(e){e()}},r),Object.defineProperty(o,"_setDebug",{get:function(){return s},enumerable:!1}),o}((function(n,r,o,i){var s=new mn;s.subscribe(1,(function(e){return Je("logs",e)}));var a,u=function(e){return s.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:xe},origin:xe,status:He.error}})},c=a=new Pe((function(){var e=Y("pagehide"),t=qe(window,["visibilitychange","freeze","pagehide"],(function(t){"pagehide"===t.type&&e?a.notify({reason:We.PAGEHIDE}):"visibilitychange"===t.type&&"hidden"===document.visibilityState?a.notify({reason:We.HIDDEN}):"freeze"===t.type&&a.notify({reason:We.FROZEN})}),{capture:!0}).stop,n=y;return e||(n=Ie(window,"beforeunload",(function(){a.notify({reason:We.UNLOADING})})).stop),function(){t(),n()}})),f=function(e,t,n){var r,o=rt("browser-logs-sdk",e);if(G()){var i=H();o.observable.subscribe((function(e){return i.send("internal_telemetry",e)}))}else{var s=yt(e,e.rumEndpointBuilder,t,n,null===(r=e.replica)||void 0===r?void 0:r.rumEndpointBuilder);o.observable.subscribe((function(t){return s.add(t,function(e){return"datad0g.com"===e.site}(e))}))}return o}(r,u,c);f.setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=Vt())||void 0===e?void 0:e.application_id},session:{id:null===(t=g.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=Vt())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=Vt())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),dn(r,s),function(e,t){if(!e.forwardErrorsToLogs)return{stop:y};var n=new Pe,r=yn(n).stop,o=n.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:_e,stack:e.stack},origin:_e,status:He.error}})}))}(r,s),function(t,n){var r=Wt(t.forwardConsoleLogs).subscribe((function(t){n.notify(0,{rawLogsEvent:{date:D(),message:t.message,origin:ke,error:t.api===e.error?{origin:ke,stack:t.stack}:void 0,status:Yt[t.api]}})}))}(r,s),function(e,t){var n=De(e.forwardReports).subscribe((function(e){var n,r=e.message,o=Qt[e.type];o===He.error?n={kind:e.subtype,origin:Re,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:D(),message:r,origin:Re,error:n,status:o}})}))}(r,s);var l,v=function(e){return{handleLog:function(n,r,o,i){var s=n.context;Ht(n.status,Ge,r)&&t(n.status,n.message,B(r.getContext(),s)),e.notify(0,{rawLogsEvent:{date:i||D(),message:n.message,status:n.status,origin:Se},messageContext:s,savedCommonContext:o,logger:r})}}}(s).handleLog,g=!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var n="dd_cookie_test_".concat(h()),r="test";W(n,r,d,e);var o=X(n)===r;return Z(n,e),o}catch(e){return t.error(e),!1}}(r.cookieOptions)||G()||Xe()?function(e){var t="1"===Nt(e)?{}:void 0;return{findTrackedSession:function(){return t}}}(r):Ut(r);return Gt(g,r,s,o,i,u),G()?function(e){var t=H();e.subscribe(1,(function(e){t.send("log",e)}))}(s):function(e,t,n,r){var o,i=yt(e,e.logsEndpointBuilder,n,r,null===(o=e.replica)||void 0===o?void 0:o.logsEndpointBuilder);t.subscribe(1,(function(e){i.add(e)}))}(r,s,u,c),function(e){nt.telemetryConfigurationEnabled&&it({type:Qe,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}}(e);return p({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(n)),{handleLog:v,getInternalContext:(l=g,{get:function(e){var t=l.findTrackedSession(e);if(t)return{session_id:t.id}}}).get}}));bn=_(),Cn=kn,xn=bn[wn="DD_LOGS"],bn[wn]=Cn,xn&&xn.q&&xn.q.forEach((function(e){return n(e,"onReady callback threw an error:")()}))}();
{
"name": "@datadog/browser-logs",
"version": "4.34.1",
"version": "4.34.2",
"license": "Apache-2.0",

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

"dependencies": {
"@datadog/browser-core": "4.34.1"
"@datadog/browser-core": "4.34.2"
},
"peerDependencies": {
"@datadog/browser-rum": "4.34.1"
"@datadog/browser-rum": "4.34.2"
},

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

},
"gitHead": "963c6de2a0ecd461f6926a873bf905e3185808e2"
"gitHead": "2b8ddef938217fceb252f520693a2c48c5b4db8e"
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc