Socket
Socket
Sign inDemoInstall

@datadog/browser-logs

Package Overview
Dependencies
Maintainers
1
Versions
252
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 5.7.0 to 5.8.0

cjs/domain/contexts/commonContext.d.ts

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=console,n={};Object.keys(e).forEach((function(e){n[e]=t[e]}));var r="Datadog Browser SDK:",o={debug:n.debug.bind(t,r),log:n.log.bind(t,r),info:n.info.bind(t,r),warn:n.warn.bind(t,r),error:n.error.bind(t,r)};function i(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];try{return e.apply(void 0,n)}catch(e){o.error(t,e)}}}var a,s=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))},u=!1;function c(e){u=e}function f(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(a?l(r):r).apply(this,e)}}function l(e){return function(){return d(e,this,arguments)}}function d(e,t,n){try{return e.apply(t,n)}catch(e){if(p(e),a)try{a(e)}catch(e){p(e)}}}function p(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];u&&o.error.apply(o,s(["[MONITOR]"],e,!1))}function v(e,t){return-1!==e.indexOf(t)}function g(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 h(e){return Object.keys(e).map((function(t){return e[t]}))}function y(e,t){return e.slice(0,t.length)===t}function m(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 b(){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 E=1024,S=1024*E,C=/[^\u0000-\u007F]/;function w(e){return C.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}function _(e,t){var n,r=b();return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function x(e,t){return _(b(),"setTimeout")(l(e),t)}function k(e){_(b(),"clearTimeout")(e)}function O(e,t){return _(b(),"setInterval")(l(e),t)}function T(e){_(b(),"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=x((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){k(o),s=!1,r=void 0}}}function L(){}function A(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=I(Object.prototype),o=I(Array.prototype),i=I(Object.getPrototypeOf(e)),a=I(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}}function I(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):L}function P(e){return 0===Object.keys(e).length}var B=3*E,D=16*E,N=200;function U(e){void 0===e&&(e=2);var t=new Map,n=!1;function r(r){if(void 0===r&&(r=0),!n&&0!==e){var i=2===e?B:D,a=r;t.forEach((function(e){a+=e.getBytesCount()})),a>i&&(!function(e){o.warn("Customer data exceeds the recommended ".concat(e/E,"KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning"))}(i),n=!0)}}return{createDetachedTracker:function(){var e=M((function(){return r(e.getBytesCount())}));return e},getOrCreateTracker:function(e){return t.has(e)||t.set(e,M(r)),t.get(e)},setCompressionStatus:function(t){0===e&&(e=t,r())},getCompressionStatus:function(){return e},stop:function(){t.forEach((function(e){return e.stop()})),t.clear()}}}function M(e){var t=0,n=R((function(n){t=w(A(n)),e()}),N),r=n.throttled,o=n.cancel,i=function(){o(),t=0};return{updateCustomerData:function(e){P(e)?i():r(e)},resetCustomerData:i,getBytesCount:function(){return t},stop:function(){o()}}}function q(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function j(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]=j(o[i],t[i],n);return o}var a="object"===q(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=j(a[s],t[s],n));return a}}function H(e){return j(void 0,e)}function G(){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=j(e,i))}return e}var F=220*E,V="$",z=3;function Y(e,t){var n;void 0===t&&(t=F);var r=I(Object.prototype),o=I(Array.prototype),i=[],a=new WeakMap,s=W(e,V,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=W(c.source[l],c.path,l,i,a))?JSON.stringify(d).length:4,u+=f,f=1,u>t){J(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=W(c.source[l],c.path,l,i,a))&&(u+=JSON.stringify(d).length+f+l.length+z,f=1),u>t){J(t,"truncated",e);break}c.target[l]=d}}return r(),o(),s}J(t,"discarded",e)}function W(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 J(e,t,n){o.warn("The data provided has been ".concat(t," as it is over the limit of ").concat(e," characters:"),n)}var K=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(this)||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];return new K((function(t){var n=e.map((function(e){return e.subscribe((function(e){return t.notify(e)}))}));return function(){return n.forEach((function(e){return e.unsubscribe()}))}}))}function $(e){var t={},n=new K,r={getContext:function(){return H(t)},setContext:function(o){"object"===q(o)?(t=Y(o),e.updateCustomerData(t)):r.clearContext(),n.notify()},setContextProperty:function(r,o){t[r]=Y(o),e.updateCustomerData(t),n.notify()},removeContextProperty:function(r){delete t[r],e.updateCustomerData(t),n.notify()},clearContext:function(){t={},e.resetCustomerData(),n.notify()},changeObservable:n};return r}var X,Q,ee=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}(),te=1e3,ne=60*te,re=60*ne;function oe(){return(new Date).getTime()}function ie(){return oe()}function ae(){return performance.now()}function se(){return{relative:ae(),timeStamp:ie()}}function ue(e,t){return e+t}function ce(){return void 0===X&&(X=performance.timing.navigationStart),X}function fe(){var e=b().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function le(e){var t;void 0===e&&(e=null===(t=b().location)||void 0===t?void 0:t.hostname);var n=fe();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}function de(e,t,n,r,o){return pe(e,t,[n],r,o)}function pe(e,t,n,r,o){var i=void 0===o?{}:o,a=i.once,s=i.capture,u=i.passive,c=l((function(t){(t.isTrusted||t.__ddIsTrusted||e.allowUntrustedEvents)&&(a&&p(),r(t))})),f=u?{capture:s,passive:u}:s,d=_(t,"addEventListener");function p(){var e=_(t,"removeEventListener");n.forEach((function(n){return e.call(t,n,c,f)}))}return n.forEach((function(e){return d.call(t,e,c,f)})),{stop:p}}!function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.DBL_CLICK="dblclick",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.TOUCH_END="touchend",e.TOUCH_MOVE="touchmove",e.VISIBILITY_CHANGE="visibilitychange",e.PAGE_SHOW="pageshow",e.FREEZE="freeze",e.RESUME="resume",e.DOM_CONTENT_LOADED="DOMContentLoaded",e.POINTER_DOWN="pointerdown",e.POINTER_UP="pointerup",e.POINTER_CANCEL="pointercancel",e.HASH_CHANGE="hashchange",e.PAGE_HIDE="pagehide",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.MOUSE_MOVE="mousemove",e.FOCUS="focus",e.BLUR="blur",e.CONTEXT_MENU="contextmenu",e.RESIZE="resize",e.CHANGE="change",e.INPUT="input",e.PLAY="play",e.PAUSE="pause",e.SECURITY_POLICY_VIOLATION="securitypolicyviolation",e.SELECTION_CHANGE="selectionchange",e.STORAGE="storage"}(Q||(Q={}));var ve,ge="_dd_c",he=[];function ye(e,t,n,r){var o=function(e,t){return"".concat(ge,"_").concat(e,"_").concat(t)}(t,n),i=$(r);return a(),he.push(de(e,window,Q.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 me(e){var t=m({},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.COLLECT_FLUSH_REASON="collect_flush_reason",e.ZERO_LCP_TELEMETRY="zero_lcp_telemetry",e.DISABLE_REPLAY_INLINE_CSS="disable_replay_inline_css",e.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql"}(ve||(ve={}));var be=new Set;function Ee(e){return be.has(e)}function Se(){return be}function Ce(e){return 0!==e&&100*Math.random()<=e}function we(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100}function _e(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,_e)}var xe=/([\w-]+)\s*=\s*([^;]+)/g;function ke(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 Oe,Te,Re,Le=4*re,Ae=15*ne;function Ie(){return null!=Oe?Oe:Oe=function(e){var t;void 0===e&&(e=window);var n=e.navigator.userAgent;if(e.chrome||/HeadlessChrome/.test(n))return 1;if(0===(null===(t=e.navigator.vendor)||void 0===t?void 0:t.indexOf("Apple"))||/safari/i.test(n)&&!/chrome|android/i.test(n))return 2;if(e.document.documentMode)return 0;return 3}()}function Pe(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":"",c=r&&r.partitioned?";partitioned":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(s).concat(u).concat(c)}function Be(e){return function(e,t){for(xe.lastIndex=0;;){var n=xe.exec(e);if(!n)break;if(n[1]===t)return n[2]}}(document.cookie,e)}function De(e){return Te||(Te=function(e){var t=new Map;for(xe.lastIndex=0;;){var n=xe.exec(e);if(!n)break;t.set(n[1],n[2])}return t}(document.cookie)),Te.get(e)}function Ne(e,t){Pe(e,"",0,t)}var Ue="_dd_s",Me=/^([a-z]+)=([a-z0-9-]+)$/,qe="&";function je(e){return P(e)}function He(e){e.expire=String(oe()+Ae)}function Ge(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(qe);var t}function Fe(e){var t={};return function(e){return!!e&&(-1!==e.indexOf(qe)||Me.test(e))}(e)&&e.split(qe).forEach((function(e){var n=Me.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}var Ve="_dd",ze="_dd_r",Ye="_dd_l",We="rum",Je="logs";function Ke(e){var t=function(e){var t={};t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie||!!e.useCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie||!!e.useCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===Re){for(var e="dd_site_test_".concat(_e()),t=window.location.hostname.split("."),n=t.pop();t.length&&!Be(e);)n="".concat(t.pop(),".").concat(n),Pe(e,"test",te,{domain:n});Ne(e,{domain:n}),Re=n}return Re}());return t}(e);return function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_".concat(_e()),n="test";Pe(t,n,ne,e);var r=Be(t)===n;return Ne(t,e),r}catch(e){return o.error(e),!1}}(t)?{type:"Cookie",cookieOptions:t}:void 0}function Ze(e){var t,n={isLockEnabled:1===Ie(),persistSession:(t=e,function(e){Pe(Ue,Ge(e),Ae,t)}),retrieveSession:$e,clearSession:Xe(e)};return function(e){if(!De(Ue)){var t=De(Ve),n=De(ze),r=De(Ye),o={};t&&(o.id=t),r&&/^[01]$/.test(r)&&(o[Je]=r),n&&/^[012]$/.test(n)&&(o[We]=n),je(o)||(He(o),e.persistSession(o))}}(n),n}function $e(){return Fe(Be(Ue))}function Xe(e){return function(){Ne(Ue,e)}}var Qe="_dd_test_";function et(e){localStorage.setItem(Ue,Ge(e))}function tt(){return Fe(localStorage.getItem(Ue))}function nt(){localStorage.removeItem(Ue)}var rt,ot=10,it=100,at=[];function st(e,t,n){var r;void 0===n&&(n=0);var o=t.isLockEnabled,i=t.retrieveSession,a=t.persistSession,s=t.clearSession;if(rt||(rt=e),e===rt)if(o&&n>=it)ct(t);else{var u,c=i();if(o){if(c.lock)return void ut(e,t,n);if(u=_e(),c.lock=u,a(c),(c=i()).lock!==u)return void ut(e,t,n)}var f=e.process(c);if(o&&(c=i()).lock!==u)ut(e,t,n);else{if(f&&(je(f)?s():(He(f),a(f))),o&&(!f||!je(f))){if((c=i()).lock!==u)return void ut(e,t,n);delete c.lock,a(c),f=c}null===(r=e.after)||void 0===r||r.call(e,f||c),ct(t)}}else at.push(e)}function ut(e,t,n){x((function(){st(e,t,n+1)}),ot)}function ct(e){rt=void 0;var t=at.shift();t&&st(t,e)}var ft=te;function lt(e){var t=Ke(e);return!t&&e.allowFallbackToLocalStorage&&(t=function(){try{var e=_e(),t="".concat(Qe).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 dt(e,t,n){var r=new K,o=new K,i="Cookie"===e.type?Ze(e.cookieOptions):{isLockEnabled:!1,persistSession:et,retrieveSession:tt,clearSession:nt},a=i.clearSession,s=i.retrieveSession,u=O((function(){st({process:function(e){return d(e)?void 0:{}},after:f},i)}),ft),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||oe()-Number(e.created)<Le)&&(void 0===e.expire||oe()<Number(e.expire))}return{expandOrRenewSession:R((function(){var e;st({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=_e(),e.created=String(oe()));return i}(o),o},after:function(t){e&&!l()&&function(e){c=e,r.notify()}(t),c=t}},i)}),ft).throttled,expandSession:function(){st({process:function(e){return l()?f(e):void 0}},i)},getSession:function(){return c},renewObservable:r,expireObservable:o,expire:function(){a(),f({})},stop:function(){T(u)}}}function pt(e){return vt(e,yt(window.location)).href}function vt(e,t){var n=function(){if(void 0===gt)try{var e=new ht("http://test/path");gt="http://test/path"===e.href}catch(e){gt=!1}return gt?ht: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(A({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 gt,ht=URL;function yt(e){if(e.origin&&"null"!==e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}var mt="datad0g.com",bt="dd0g-gov.com",Et="datadoghq.com";function St(e,t,n){var r=function(e,t){var n="/api/v2/".concat(t),r=e.proxy;if("string"==typeof r){var o=pt(r);return function(e){return"".concat(o,"?ddforward=").concat(encodeURIComponent("".concat(n,"?").concat(e)))}}if("function"==typeof r)return function(e){return r({path:n,parameters:e})};var i=function(e){var t=e.site,n=void 0===t?Et:t,r=e.internalAnalyticsSubdomain;if(r&&n===Et)return"".concat(r,".").concat(Et);if(n===bt)return"http-intake.logs.".concat(n);var o=n.split("."),i=o.pop();return"browser-intake-".concat(o.join("-"),".").concat(i)}(e);return function(e){return"https://".concat(i).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("5.7.0"),"api:".concat(r)].concat(n);u&&Ee(ve.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("5.7.0")),"dd-evp-origin=browser","dd-request-id=".concat(_e())];c&&l.push("dd-evp-encoding=".concat(c));"rum"===t&&l.push("batch_time=".concat(ie()));a&&l.reverse();return l.join("&")}(e,t,n,o,i);return r(a)},urlPrefix:r(""),trackType:t}}var Ct=200;var wt=/[^a-z0-9_:./-]/;function _t(e,t){var n=Ct-e.length-1;(t.length>n||wt.test(t))&&o.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var r=t.replace(/,/g,"_");return"".concat(e,":").concat(r)}function xt(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(_t("env",t)),n&&i.push(_t("service",n)),r&&i.push(_t("version",r)),o&&i.push(_t("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:St(e,"logs",t),rumEndpointBuilder:St(e,"rum",t),sessionReplayEndpointBuilder:St(e,"replay",t)}}(e,t),r=h(n).map((function(e){return e.urlPrefix})),o=function(e,t,n){if(!e.replica)return;var r=m({},e,{site:Et,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:St(r,"logs",n),rumEndpointBuilder:St(r,"rum",n)};return t.push.apply(t,h(o).map((function(e){return e.urlPrefix}))),m({applicationId:e.replica.applicationId},o)}(e,r,t);return m({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||Et},n)}function kt(e){var t,n,r;if(e&&e.clientToken)if(void 0===e.sessionSampleRate||we(e.sessionSampleRate))if(void 0===e.telemetrySampleRate||we(e.telemetrySampleRate)){if(void 0===e.telemetryConfigurationSampleRate||we(e.telemetryConfigurationSampleRate))return Array.isArray(e.enableExperimentalFeatures)&&e.enableExperimentalFeatures.filter((function(e){return t=ve,n=e,Object.keys(t).some((function(e){return t[e]===n}));var t,n})).forEach((function(e){be.add(e)})),m({beforeSend:e.beforeSend&&i(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:lt(e),sessionSampleRate:null!==(t=e.sessionSampleRate)&&void 0!==t?t:100,telemetrySampleRate:null!==(n=e.telemetrySampleRate)&&void 0!==n?n:20,telemetryConfigurationSampleRate:null!==(r=e.telemetryConfigurationSampleRate)&&void 0!==r?r:5,service:e.service,silentMultipleInit:!!e.silentMultipleInit,allowUntrustedEvents:!!e.allowUntrustedEvents,batchBytesLimit:16*E,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*te,batchMessagesLimit:50,messageBytesLimit:256*E},xt(e));o.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else o.error("Telemetry Sample Rate should be a number between 0 and 100");else o.error("Session Sample Rate should be a number between 0 and 100");else o.error("Client Token is not configured, we will not send any data.")}var Ot="?";function Tt(e){var t=[],n=Ut(e,"stack"),r=String(e);return n&&y(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=At.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=It.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]||Ot,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Pt.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:Ot,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=Bt.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||Ot,line:+t[3],url:t[2]}}(e)||function(e){var t=Dt.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=Nt.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]||Ot,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=Ot),t.push(n))})),{message:Ut(e,"message"),name:Ut(e,"name"),stack:t}}var Rt="((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",Lt="(?::(\\d+))",At=new RegExp("^\\s*at (.*?) ?\\(".concat(Rt).concat(Lt,"?").concat(Lt,"?\\)?\\s*$"),"i"),It=new RegExp("\\((\\S*)".concat(Lt).concat(Lt,"\\)"));var Pt=new RegExp("^\\s*at ?".concat(Rt).concat(Lt,"?").concat(Lt,"??\\s*$"),"i");var Bt=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var Dt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Nt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Ut(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function Mt(e,t,n,r){var o=[{url:t,column:r,line:n}],i=function(e){var t,n,r;"[object String]"==={}.toString.call(e)&&(n=(t=qt.exec(e))[1],r=t[2]);return{name:n,message:r}}(e);return{name:i.name,message:i.message,stack:o}}var qt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;var jt="No stack, consider using an instance of Error";function Ht(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(A(Y(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)?Ft(t):jt,l=u?function(e,t){var n=e,r=[];for(;(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=Tt(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&Ft(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:Gt(n)}}function Gt(e){return e instanceof Error&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function Ft(e){var t=Vt(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 Vt(e){return"".concat(e.name||"Error",": ").concat(e.message)}var zt={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function Yt(e,t){var n=[];v(t,zt.cspViolation)&&n.push(function(e){return new K((function(t){return de(e,document,Q.SECURITY_POLICY_VIOLATION,(function(e){t.notify(function(e){var t=zt.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:zt.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:Wt(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(ke(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber),originalReport:e}}(e))})).stop}))}(e));var r=t.filter((function(e){return e!==zt.cspViolation}));return r.length&&n.push(function(e){return new K((function(t){if(window.ReportingObserver){var n=l((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),originalReport:e,stack:Wt(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()}}}))}(r)),Z.apply(void 0,n)}function Wt(e,t,n,r,o){return n?Ft({name:e,message:t,stack:[{func:"?",url:n,line:null!=r?r:void 0,column:null!=o?o:void 0}]}):void 0}var Jt=32*E;function Kt(e,t,n){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return v(t,e)}))?"all"===e?t:(r=e,i=new Set,r.forEach((function(e){return i.add(e)})),g(i)):void o.error("".concat(n,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'));var r,i}var Zt={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"},$t=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},Xt={debug:"debug",error:"error",info:"info",warn:"warn"},Qt={console:"console",http:"http",silent:"silent"},en=Object.keys(Xt),tn=function(){function e(e,t,n,r,o,i){void 0===r&&(r=Qt.http),void 0===o&&(o=Xt.debug),void 0===i&&(i={}),this.handleLogStrategy=e,this.handlerType=r,this.level=o,this.contextManager=$(t),this.contextManager.setContext(i),n&&this.contextManager.setContextProperty("logger",{name:n})}return e.prototype.log=function(e,t,n,r){var o;if(void 0===n&&(n=Xt.info),null!=r){var i=Ht({stackTrace:r instanceof Error?Tt(r):void 0,originalError:r,nonErrorPrefix:"Provided",source:Zt.LOGGER,handling:"handled",startClocks:se()});o={stack:i.stack,kind:i.type,message:i.message}}var a=Y(t),s=o?G({error:o},a):a;this.handleLogStrategy({message:Y(e),context:s,status:n},this)},e.prototype.debug=function(e,t,n){this.log(e,t,Xt.debug,n)},e.prototype.info=function(e,t,n){this.log(e,t,Xt.info,n)},e.prototype.warn=function(e,t,n){this.log(e,t,Xt.warn,n)},e.prototype.error=function(e,t,n){this.log(e,t,Xt.error,n)},e.prototype.setContext=function(e){this.contextManager.setContext(e)},e.prototype.getContext=function(){return this.contextManager.getContext()},e.prototype.setContextProperty=function(e,t){this.contextManager.setContextProperty(e,t)},e.prototype.removeContextProperty=function(e){this.contextManager.removeContextProperty(e)},e.prototype.clearContext=function(){this.contextManager.clearContext()},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},$t([f],e.prototype,"log",null),e}(),nn="logs";function rn(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var on={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};var an="datadog-synthetics-public-id",sn="datadog-synthetics-result-id",un="datadog-synthetics-injects-rum";function cn(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||De(un))}function fn(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||De(sn);return"string"==typeof e?e:void 0}var ln=1/0,dn=ne,pn=function(){function e(e,t){var n=this;this.expireDelay=e,this.maxEntries=t,this.entries=[],this.clearOldValuesInterval=O((function(){return n.clearOldValues()}),dn)}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=ue(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(){T(this.clearOldValuesInterval)},e.prototype.clearOldValues=function(){for(var e=ae()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}(),vn=ne,gn=Le,hn=[];function yn(e,t,n){var r=dt(e.sessionStoreStrategyType,t,n);hn.push((function(){return r.stop()}));var o=new pn(gn);function i(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return hn.push((function(){return o.stop()})),r.renewObservable.subscribe((function(){o.add(i(),ae())})),r.expireObservable.subscribe((function(){o.closeActive(ae())})),r.expandOrRenewSession(),o.add(i(),[0,ce()][0]),function(e,t){var n=pe(e,window,[Q.CLICK,Q.TOUCH_START,Q.KEY_DOWN,Q.SCROLL],t,{capture:!0,passive:!0}).stop;hn.push(n)}(e,(function(){return r.expandOrRenewSession()})),function(e,t){var n=function(){"visible"===document.visibilityState&&t()},r=de(e,document,Q.VISIBILITY_CHANGE,n).stop;hn.push(r);var o=O(n,vn);hn.push((function(){T(o)}))}(e,(function(){return r.expandSession()})),{findActiveSession:function(e){return o.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable,expire:r.expire}}var mn="logs";function bn(e){var t=yn(e,mn,(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:En(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 En(e){return Ce(e.sessionSampleRate)?"1":"0"}var Sn,Cn={log:"log",configuration:"configuration"},wn=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],_n=["ddog-gov.com"],xn={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function kn(e,t){var n,r=new K;xn.telemetryEnabled=!v(_n,t.site)&&Ce(t.telemetrySampleRate),xn.telemetryConfigurationEnabled=xn.telemetryEnabled&&Ce(t.telemetryConfigurationSampleRate);var o={is_local_file:"file:"===window.location.protocol,is_worker:"WorkerGlobalScope"in self};return Sn=function(t){if(xn.telemetryEnabled){var i=function(e,t,r){return G({type:"telemetry",date:ie(),service:e,version:"5.7.0",source:"browser",_dd:{format_version:2},telemetry:G(t,{runtime_env:r}),experimental_features:g(Se())},void 0!==n?n():{})}(e,t,o);r.notify(i),rn("telemetry",i)}},a=Tn,m(xn,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:r,enabled:xn.telemetryEnabled}}function On(t,n){p(e.debug,t,n),Rn(m({type:Cn.log,message:t,status:"debug"},n))}function Tn(e,t){Rn(m({type:Cn.log,status:"error"},function(e){if(e instanceof Error){var t=Tt(e);return{error:{kind:t.name,stack:Ft(Ln(t))},message:t.message}}return{error:{stack:jt},message:"".concat("Uncaught"," ").concat(A(e))}}(e),t))}function Rn(e){Sn&&xn.sentEventCount<xn.maxEventsPerPage&&(xn.sentEventCount+=1,Sn(e))}function Ln(e){return e.stack=e.stack.filter((function(e){return!e.url||wn.some((function(t){return y(e.url,t)}))})),e}var An=!1;function In(e){var t,n=window;if(cn()){var r=o(n.DD_RUM_SYNTHETICS);return r||An||(An=!0,On("Logs sent before RUM is injected by the synthetics worker",{testId:(t=window._DATADOG_SYNTHETICS_PUBLIC_ID||De(an),"string"==typeof t?t:void 0),resultId:fn()})),r}return o(n.DD_RUM);function o(t){if(t&&t.getInternalContext)return t.getInternalContext(e)}}function Pn(e,t,n,r,o){var i=en.concat(["custom"]),a={};i.forEach((function(e){var n,r,i,s,u;a[e]=(n=e,r=t.eventRateLimiterThreshold,i=o,s=0,u=!1,{isLimitReached:function(){if(0===s&&x((function(){s=0}),ne),(s+=1)<=r||u)return u=!1,!1;if(s===r+1){u=!0;try{i({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:Zt.AGENT,startClocks:se()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(o){var i,s,u=o.rawLogsEvent,c=o.messageContext,f=void 0===c?void 0:c,l=o.savedCommonContext,d=void 0===l?void 0:l,p=u.date-ce(),v=e.findTrackedSession(p);if(v){var g=d||r(),h=G({service:t.service,session_id:v.id,usr:P(g.user)?void 0:g.user,view:g.view},g.context,In(p),u,f);!1===(null===(i=t.beforeSend)||void 0===i?void 0:i.call(t,h))||h.origin!==Zt.AGENT&&(null!==(s=a[h.status])&&void 0!==s?s:a.custom).isLimitReached()||n.notify(1,h)}}))}var Bn,Dn={};function Nn(n){var r=n.map((function(n){return Dn[n]||(Dn[n]=function(n){return new K((function(r){var o=t[n];return t[n]=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];o.apply(console,t);var a=function(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return d((function(){var n=Tt(t);n.stack=n.stack.slice(2),e=Ft(n)})),e}();d((function(){r.notify(function(t,n,r){var o,i,a=t.map((function(e){return function(e){if("string"==typeof e)return Y(e);if(e instanceof Error)return Vt(Tt(e));return A(Y(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?Ft(Tt(s)):void 0,i=Gt(s)}return{api:n,message:a,stack:o,handlingStack:r,fingerprint:i}}(t,n,a))}))},function(){t[n]=o}}))}(n)),Dn[n]}));return Z.apply(void 0,r)}var Un,Mn=((Bn={})[e.log]=Xt.info,Bn[e.debug]=Xt.debug,Bn[e.info]=Xt.info,Bn[e.warn]=Xt.warn,Bn[e.error]=Xt.error,Bn);var qn,jn=((Un={})[zt.cspViolation]=Xt.error,Un[zt.intervention]=Xt.error,Un[zt.deprecation]=Xt.warn,Un);function Hn(e,t,n){var r=e[t],o=function(e,t){return function(){var n,r,o=arguments;return d(t,null,[{target:this,parameters:o,onPostCall:function(e){r=e}}]),"function"==typeof e&&(n=e.apply(this,o)),r&&d(r,null,[n]),n}}(r,n),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}}}var Gn,Fn=new WeakMap;function Vn(e){return qn||(qn=function(e){return new K((function(t){var n=Hn(XMLHttpRequest.prototype,"open",zn).stop,r=Hn(XMLHttpRequest.prototype,"send",(function(n){!function(e,t,n){var r=e.target,o=Fn.get(r);if(!o)return;var i=o;i.state="start",i.startClocks=se(),i.isAborted=!1,i.xhr=r;var a=!1,s=Hn(r,"onreadystatechange",(function(){r.readyState===XMLHttpRequest.DONE&&u()})).stop,u=function(){if(c(),s(),!a){a=!0;var e,t=o;t.state="complete",t.duration=(e=i.startClocks.timeStamp,ie()-e),t.status=r.status,n.notify(m({},t))}},c=de(t,r,"loadend",u).stop;n.notify(i)}(n,e,t)})).stop,o=Hn(XMLHttpRequest.prototype,"abort",Yn).stop;return function(){n(),r(),o()}}))}(e)),qn}function zn(e){var t=e.target,n=e.parameters,r=n[0],o=n[1];Fn.set(t,{state:"open",method:r.toUpperCase(),url:pt(String(o))})}function Yn(e){var t=e.target,n=Fn.get(t);n&&(n.isAborted=!0)}function Wn(){return Gn||(Gn=new K((function(e){if(window.fetch){var t=Hn(window,"fetch",(function(t){return function(e,t){var n=e.parameters,r=e.onPostCall,o=n[0],i=n[1],a=i&&i.method||o instanceof Request&&o.method,s=a?a.toUpperCase():"GET",u=o instanceof Request?o.url:pt(String(o)),c=se(),f={state:"start",init:i,input:o,method:s,startClocks:c,url:u};t.notify(f),n[0]=f.input,n[1]=f.init,r((function(e){return function(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(l(r),l(r))}(t,e,f)}))}(t,e)})).stop;return t}}))),Gn}function Jn(e){return e>=500}function Kn(e,t){if(!e.forwardErrorsToLogs)return{stop:L};var n=Vn(e).subscribe((function(e){"complete"===e.state&&o("xhr",e)})),r=Wn().subscribe((function(e){"resolve"===e.state&&o("fetch",e)}));function o(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat($n(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:Xt.error,origin:Zt.NETWORK}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!Jn(r.status)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(Zn(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(L),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(l((function(t){t.done?a():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?a():e())})),l((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(l((function(e){return n(Zn(e,t))})),l((function(e){return n("Unable to retrieve response: ".concat(e))}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(Zn(Ft(Tt(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function Zn(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function $n(e){return"xhr"===e?"XHR":"Fetch"}function Xn(e){var t,n=function(t,n){var r=Ht({stackTrace:t,originalError:n,startClocks:se(),nonErrorPrefix:"Uncaught",source:Zt.SOURCE,handling:"unhandled"});e.notify(r)},r=(t=n,Hn(window,"onerror",(function(e){var n,r=e.parameters,o=r[0],i=r[1],a=r[2],s=r[3],u=r[4];n=u instanceof Error?Tt(u):Mt(o,i,a,s),t(n,null!=u?u:o)}))).stop,o=function(e){return Hn(window,"onunhandledrejection",(function(t){var n=t.parameters[0].reason||"Empty reason",r=Tt(n);e(r,n)}))}(n).stop;return{stop:function(){r(),o()}}}var Qn,er=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}(),tr=((Qn={})[Xt.debug]=0,Qn[Xt.info]=1,Qn[Xt.warn]=2,Qn[Xt.error]=3,Qn);function nr(e){return{handleLog:function(r,o,i,a){var s=G(o.getContext(),r.context);rr(r.status,Qt.console,o)&&function(e,r){n[e.status].call(t,e.message,r)}(r,s),rr(r.status,Qt.http,o)&&e.notify(0,{rawLogsEvent:{date:a||ie(),message:r.message,status:r.status,origin:Zt.LOGGER},messageContext:s,savedCommonContext:i})}}}function rr(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return tr[e]>=tr[n.getLevel()]&&v(o,t)}var or=function(){function e(e,t,n,r){var o=this;this.encoder=e,this.request=t,this.flushController=n,this.messageBytesLimit=r,this.upsertBuffer={},this.flushSubscription=this.flushController.flushObservable.subscribe((function(e){return o.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=h(this.upsertBuffer).join("\n");this.upsertBuffer={};var n,r=(n=e.reason,v(h(on),n)),o=r?this.request.sendOnExit:this.request.send;if(r&&this.encoder.isAsync){var i=this.encoder.finishSync();i.outputBytesCount&&o(ir(i,e));var a=[i.pendingData,t].filter(Boolean).join("\n");a&&o({data:a,bytesCount:w(a),flushReason:e.reason})}else t&&this.encoder.write(this.encoder.isEmpty?t:"\n".concat(t)),this.encoder.finish((function(t){o(ir(t,e))}))},e.prototype.addOrUpdate=function(e,t){var n=A(e),r=this.encoder.estimateEncodedBytesCount(n);r>=this.messageBytesLimit?o.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB.")):(this.hasMessageFor(t)&&this.remove(t),this.push(n,r,t))},e.prototype.push=function(e,t,n){var r=this;this.flushController.notifyBeforeAddMessage(t),void 0!==n?(this.upsertBuffer[n]=e,this.flushController.notifyAfterAddMessage()):this.encoder.write(this.encoder.isEmpty?e:"\n".concat(e),(function(e){r.flushController.notifyAfterAddMessage(e-t)}))},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.encoder.estimateEncodedBytesCount(t);this.flushController.notifyAfterRemoveMessage(n)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e}();function ir(e,t){return{data:"string"==typeof e.output?e.output:new Blob([e.output],{type:"text/plain"}),bytesCount:e.outputBytesCount,encoding:e.encoding,flushReason:t.reason}}var ar=80*E,sr=32,ur=3*S,cr=ne,fr=te;function lr(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?pr(e,t,n,{onSuccess:function(){return vr(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),dr(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function dr(e,t,n,r){2===e.transportStatus&&x((function(){pr(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=fr,vr(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(cr,2*e.currentBackoffTime),dr(e,t,n,r)}})}),e.currentBackoffTime)}function pr(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||Jn(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 vr(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(ur/S,"MiB"),source:Zt.AGENT,startClocks:se()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=gr();i.size()>0;)lr(i.dequeue(),t,n,r,o)}function gr(){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>=ur}}}function hr(e,t,n,r){var o={transportStatus:0,currentBackoffTime:fr,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=ar&&this.ongoingRequestCount<sr},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:gr(),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(l((function(e){return null==o?void 0:o({status:e.status,type:e.type})})),l((function(){var n=t.build("xhr",r);mr(e,n,r.data,o)})))}else{var s=t.build("xhr",r);mr(e,s,r.data,o)}}(e,t,n,r,o)};return{send:function(e){lr(e,o,i,t.trackType,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){yr||(yr=!0,Tn(e))}(e)}var a=t.build("xhr",r);mr(e,a,r.data)}(e,t,n,r)}}}var yr=!1;function mr(e,t,n,r){var o=new XMLHttpRequest;o.open("POST",t,!0),n instanceof Blob&&o.setRequestHeader("Content-Type",n.type),de(e,o,"loadend",(function(){null==r||r({status:o.status})}),{once:!0}),o.send(n)}function br(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 K((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,p(),c.notify({reason:e,messagesCount:t,bytesCount:n})}}function p(){k(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(e){void 0===e&&(e=0),f+=e,l>=n?d("messages_limit"):f>=r&&d("bytes_limit")},notifyAfterRemoveMessage:function(e){f-=e,0===(l-=1)&&p()}}}function Er(e,t,n,r,o,i){var a=u(e,t),s=n&&u(e,n);function u(e,t){var n=t.endpoint,a=t.encoder;return new or(a,hr(e,n,e.batchBytesLimit,r),br({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()}}}function Sr(){var e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write:function(n,r){var o=w(n);t+=o,e+=n,r&&r(o)},finish:function(e){e(this.finishSync())},finishSync:function(){var n={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,n},estimateEncodedBytesCount:function(e){return e.length}}}function Cr(e,t,n,r,o){var i=kn("browser-logs-sdk",t);i.setContextProvider((function(){var e,t,n,r,i,a;return{application:{id:null===(e=In())||void 0===e?void 0:e.application_id},session:{id:null===(t=o.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=In())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(a=null===(i=In())||void 0===i?void 0:i.user_action)||void 0===a?void 0:a.id}}}));var a=[];if(le()){var s=fe(),u=i.observable.subscribe((function(e){return s.send("internal_telemetry",e)}));a.push((function(){return u.unsubscribe()}))}else{var c=Er(t,{endpoint:t.rumEndpointBuilder,encoder:Sr()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:Sr()},n,r,o.expireObservable);a.push((function(){return c.stop()}));var f=i.observable.subscribe((function(e){return c.add(e,function(e){return e.site===mt}(t))}));a.push((function(){return f.unsubscribe()}))}return function(e){xn.telemetryConfigurationEnabled&&Rn({type:Cn.configuration,configuration:e})}(function(e){var t,n={session_sample_rate:(t=e).sessionSampleRate,telemetry_sample_rate:t.telemetrySampleRate,telemetry_configuration_sample_rate:t.telemetryConfigurationSampleRate,use_before_send:!!t.beforeSend,use_cross_site_session_cookie:t.useCrossSiteSessionCookie,use_partitioned_cross_site_session_cookie:t.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:t.useSecureSessionCookie,use_proxy:!!t.proxy,silent_multiple_init:t.silentMultipleInit,track_session_across_subdomains:t.trackSessionAcrossSubdomains,allow_fallback_to_local_storage:!!t.allowFallbackToLocalStorage,store_contexts_across_pages:!!t.storeContextsAcrossPages,allow_untrusted_events:!!t.allowUntrustedEvents};return m({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},n)}(e)),{telemetry:i,stop:function(){a.forEach((function(e){return e()}))}}}var wr,_r,xr,kr,Or=function(t){var n,r,i=!1,a=U(),s=$(a.getOrCreateTracker(2)),u=$(a.getOrCreateTracker(1)),f={},d=function(){},p=new ee,g=function(e,t,n,r){void 0===n&&(n=H(E())),void 0===r&&(r=ie()),p.add((function(){return g(e,t,n,r)}))},y=function(){},b=new tn((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g.apply(void 0,e)}),a.createDetachedTracker());function E(){return{view:{referrer:document.referrer,url:window.location.href},context:s.getContext(),user:u.getContext()}}return n={logger:b,init:l((function(n){var r;if(n){if(y=function(){return H(n)},le()&&(n=function(e){return m({},e,{clientToken:"empty"})}(n)),function(e){return!i||(e.silentMultipleInit||o.error("DD_LOGS is already initialized."),!1)}(n)){var c=function(t){var n=kt(t),r=Kt(t.forwardConsoleLogs,h(e),"Forward Console Logs"),o=Kt(t.forwardReports,h(zt),"Forward Reports");if(n&&r&&o)return t.forwardErrorsToLogs&&!v(r,e.error)&&r.push(e.error),m({forwardErrorsToLogs:!1!==t.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:Jt},n)}(n);if(c){if(n.storeContextsAcrossPages){var f=s.getContext();(s=ye(c,nn,2,a.getOrCreateTracker(2))).setContext(G(s.getContext(),f));var l=u.getContext();(u=ye(c,nn,1,a.getOrCreateTracker(1))).setContext(G(u.getContext(),l))}r=t(n,c,E),g=r.handleLog,d=r.getInternalContext,p.drain(),i=!0}}}else o.error("Missing configuration")})),getGlobalContext:l((function(){return s.getContext()})),setGlobalContext:l((function(e){return s.setContext(e)})),setGlobalContextProperty:l((function(e,t){return s.setContextProperty(e,t)})),removeGlobalContextProperty:l((function(e){return s.removeContextProperty(e)})),clearGlobalContext:l((function(){return s.clearContext()})),createLogger:l((function(e,t){return void 0===t&&(t={}),f[e]=new tn((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g.apply(void 0,e)}),a.createDetachedTracker(),Y(e),t.handler,t.level,Y(t.context)),f[e]})),getLogger:l((function(e){return f[e]})),getInitConfiguration:l((function(){return y()})),getInternalContext:l((function(e){return d(e)})),setUser:l((function(e){(function(e){var t="object"===q(e);return t||o.error("Unsupported user:",e),t})(e)&&u.setContext(me(e))})),getUser:l((function(){return u.getContext()})),setUserProperty:l((function(e,t){var n,r=me((n={},n[e]=t,n))[e];u.setContextProperty(e,r)})),removeUserProperty:l((function(e){return u.removeContextProperty(e)})),clearUser:l((function(){return u.clearContext()}))},r=m({version:"5.7.0",onReady:function(e){e()}},n),Object.defineProperty(r,"_setDebug",{get:function(){return c},enumerable:!1}),r}((function(t,n,r){var o=new er,i=[];o.subscribe(1,(function(e){return rn("logs",e)}));var a=function(e){return function(t){e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:Zt.AGENT,status:Xt.error}}),On("Error reported to customer",{"error.message":t.message})}}(o),s=function(e){return new K((function(t){var n=Ee(ve.PAGEHIDE),r=pe(e,window,[Q.VISIBILITY_CHANGE,Q.FREEZE,Q.PAGE_HIDE],(function(e){e.type===Q.PAGE_HIDE&&n?t.notify({reason:on.PAGEHIDE}):e.type===Q.VISIBILITY_CHANGE&&"hidden"===document.visibilityState?t.notify({reason:on.HIDDEN}):e.type===Q.FREEZE&&t.notify({reason:on.FROZEN})}),{capture:!0}).stop,o=L;return n||(o=de(e,window,Q.BEFORE_UNLOAD,(function(){t.notify({reason:on.UNLOADING})})).stop),function(){r(),o()}}))}(n),u=!n.sessionStoreStrategyType||le()||cn()?function(e){var t="1"===En(e)?{}:void 0;return{findTrackedSession:function(){return t},expireObservable:new K}}(n):bn(n),c=Cr(t,n,a,s,u).stop;i.push((function(){return c()})),Kn(n,o),function(e,t){if(!e.forwardErrorsToLogs)return{stop:L};var n=new K,r=Xn(n).stop,o=n.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,stack:e.stack},origin:Zt.SOURCE,status:Xt.error}})}))}(n,o),function(t,n){var r=Nn(t.forwardConsoleLogs).subscribe((function(t){n.notify(0,{rawLogsEvent:{date:ie(),message:t.message,origin:Zt.CONSOLE,error:t.api===e.error?{stack:t.stack,fingerprint:t.fingerprint}:void 0,status:Mn[t.api]}})}))}(n,o),function(e,t){var n=Yt(e,e.forwardReports).subscribe((function(e){var n,r=e.message,o=jn[e.type];o===Xt.error?n={kind:e.subtype,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:ie(),message:r,origin:Zt.REPORT,error:n,status:o}})}))}(n,o);var f,l=nr(o).handleLog;if(Pn(u,n,o,r,a),le())!function(e){var t=fe();e.subscribe(1,(function(e){t.send("log",e)}))}(o);else{var d=function(e,t,n,r,o){var i=Er(e,{endpoint:e.logsEndpointBuilder,encoder:Sr()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:Sr()},n,r,o.expireObservable);return t.subscribe(1,(function(e){i.add(e)})),i}(n,o,a,s,u).stop;i.push((function(){return d()}))}return{handleLog:l,getInternalContext:(f=u,{get:function(e){var t=f.findTrackedSession(e);if(t)return{session_id:t.id}}}).get,stop:function(){i.forEach((function(e){return e()}))}}}));wr=b(),xr=Or,kr=wr[_r="DD_LOGS"],wr[_r]=xr,kr&&kr.q&&kr.q.forEach((function(e){return i(e,"onReady callback threw an error:")()}))}();
!function(){"use strict";var e={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},t=console,n={};Object.keys(e).forEach((function(e){n[e]=t[e]}));var r="Datadog Browser SDK:",o={debug:n.debug.bind(t,r),log:n.log.bind(t,r),info:n.info.bind(t,r),warn:n.warn.bind(t,r),error:n.error.bind(t,r)};function i(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];try{return e.apply(void 0,n)}catch(e){o.error(t,e)}}}var a,s=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))},u=!1;function c(e){u=e}function f(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(a?l(r):r).apply(this,e)}}function l(e){return function(){return d(e,this,arguments)}}function d(e,t,n){try{return e.apply(t,n)}catch(e){if(p(e),a)try{a(e)}catch(e){p(e)}}}function p(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];u&&o.error.apply(o,s(["[MONITOR]"],e,!1))}function v(e,t){return-1!==e.indexOf(t)}function g(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 h(e){return Object.keys(e).map((function(t){return e[t]}))}function y(e,t){return e.slice(0,t.length)===t}function m(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 b(){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 E=1024,S=1024*E,w=/[^\u0000-\u007F]/;function C(e){return w.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}function _(e,t){var n,r=b();return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function x(e,t){return _(b(),"setTimeout")(l(e),t)}function k(e){_(b(),"clearTimeout")(e)}function O(e,t){return _(b(),"setInterval")(l(e),t)}function T(e){_(b(),"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=x((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){k(o),s=!1,r=void 0}}}function L(){}function A(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=I(Object.prototype),o=I(Array.prototype),i=I(Object.getPrototypeOf(e)),a=I(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}}function I(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):L}function P(e){return 0===Object.keys(e).length}var B=3*E,D=16*E,N=200;function U(e){void 0===e&&(e=2);var t=new Map,n=!1;function r(r){if(void 0===r&&(r=0),!n&&0!==e){var i=2===e?B:D,a=r;t.forEach((function(e){a+=e.getBytesCount()})),a>i&&(!function(e){o.warn("Customer data exceeds the recommended ".concat(e/E,"KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning"))}(i),n=!0)}}return{createDetachedTracker:function(){var e=M((function(){return r(e.getBytesCount())}));return e},getOrCreateTracker:function(e){return t.has(e)||t.set(e,M(r)),t.get(e)},setCompressionStatus:function(t){0===e&&(e=t,r())},getCompressionStatus:function(){return e},stop:function(){t.forEach((function(e){return e.stop()})),t.clear()}}}function M(e){var t=0,n=R((function(n){t=C(A(n)),e()}),N),r=n.throttled,o=n.cancel,i=function(){o(),t=0};return{updateCustomerData:function(e){P(e)?i():r(e)},resetCustomerData:i,getBytesCount:function(){return t},stop:function(){o()}}}function q(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function j(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]=j(o[i],t[i],n);return o}var a="object"===q(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=j(a[s],t[s],n));return a}}function H(e){return j(void 0,e)}function G(){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=j(e,i))}return e}var F=220*E,V="$",z=3;function Y(e,t){var n;void 0===t&&(t=F);var r=I(Object.prototype),o=I(Array.prototype),i=[],a=new WeakMap,s=W(e,V,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=W(c.source[l],c.path,l,i,a))?JSON.stringify(d).length:4,u+=f,f=1,u>t){J(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=W(c.source[l],c.path,l,i,a))&&(u+=JSON.stringify(d).length+f+l.length+z,f=1),u>t){J(t,"truncated",e);break}c.target[l]=d}}return r(),o(),s}J(t,"discarded",e)}function W(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 J(e,t,n){o.warn("The data provided has been ".concat(t," as it is over the limit of ").concat(e," characters:"),n)}var K=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(this)||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];return new K((function(t){var n=e.map((function(e){return e.subscribe((function(e){return t.notify(e)}))}));return function(){return n.forEach((function(e){return e.unsubscribe()}))}}))}function $(e){var t={},n=new K,r={getContext:function(){return H(t)},setContext:function(o){"object"===q(o)?(t=Y(o),e.updateCustomerData(t)):r.clearContext(),n.notify()},setContextProperty:function(r,o){t[r]=Y(o),e.updateCustomerData(t),n.notify()},removeContextProperty:function(r){delete t[r],e.updateCustomerData(t),n.notify()},clearContext:function(){t={},e.resetCustomerData(),n.notify()},changeObservable:n};return r}var X,Q,ee=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}(),te=1e3,ne=60*te,re=60*ne;function oe(){return(new Date).getTime()}function ie(){return oe()}function ae(){return performance.now()}function se(){return{relative:ae(),timeStamp:ie()}}function ue(e,t){return e+t}function ce(){return void 0===X&&(X=performance.timing.navigationStart),X}function fe(){var e=b().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function le(e){var t;void 0===e&&(e=null===(t=b().location)||void 0===t?void 0:t.hostname);var n=fe();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}function de(e,t,n,r,o){return pe(e,t,[n],r,o)}function pe(e,t,n,r,o){var i=void 0===o?{}:o,a=i.once,s=i.capture,u=i.passive,c=l((function(t){(t.isTrusted||t.__ddIsTrusted||e.allowUntrustedEvents)&&(a&&p(),r(t))})),f=u?{capture:s,passive:u}:s,d=_(t,"addEventListener");function p(){var e=_(t,"removeEventListener");n.forEach((function(n){return e.call(t,n,c,f)}))}return n.forEach((function(e){return d.call(t,e,c,f)})),{stop:p}}!function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.DBL_CLICK="dblclick",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.TOUCH_END="touchend",e.TOUCH_MOVE="touchmove",e.VISIBILITY_CHANGE="visibilitychange",e.PAGE_SHOW="pageshow",e.FREEZE="freeze",e.RESUME="resume",e.DOM_CONTENT_LOADED="DOMContentLoaded",e.POINTER_DOWN="pointerdown",e.POINTER_UP="pointerup",e.POINTER_CANCEL="pointercancel",e.HASH_CHANGE="hashchange",e.PAGE_HIDE="pagehide",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.MOUSE_MOVE="mousemove",e.FOCUS="focus",e.BLUR="blur",e.CONTEXT_MENU="contextmenu",e.RESIZE="resize",e.CHANGE="change",e.INPUT="input",e.PLAY="play",e.PAUSE="pause",e.SECURITY_POLICY_VIOLATION="securitypolicyviolation",e.SELECTION_CHANGE="selectionchange",e.STORAGE="storage"}(Q||(Q={}));var ve,ge="_dd_c",he=[];function ye(e,t,n,r){var o=function(e,t){return"".concat(ge,"_").concat(e,"_").concat(t)}(n,r);function i(){var e=localStorage.getItem(o);return null!==e?JSON.parse(e):{}}he.push(de(e,window,Q.STORAGE,(function(e){var n=e.key;o===n&&t.setContext(i())}))),t.changeObservable.subscribe((function(){localStorage.setItem(o,JSON.stringify(t.getContext()))})),t.setContext(G(i(),t.getContext()))}function me(e){var t=m({},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.COLLECT_FLUSH_REASON="collect_flush_reason",e.ZERO_LCP_TELEMETRY="zero_lcp_telemetry",e.DISABLE_REPLAY_INLINE_CSS="disable_replay_inline_css",e.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql"}(ve||(ve={}));var be=new Set;function Ee(e){return be.has(e)}function Se(){return be}function we(e){return 0!==e&&100*Math.random()<=e}function Ce(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100}function _e(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,_e)}var xe=/([\w-]+)\s*=\s*([^;]+)/g;function ke(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 Oe,Te,Re,Le=4*re,Ae=15*ne;function Ie(){return null!=Oe?Oe:Oe=function(e){var t;void 0===e&&(e=window);var n=e.navigator.userAgent;if(e.chrome||/HeadlessChrome/.test(n))return 1;if(0===(null===(t=e.navigator.vendor)||void 0===t?void 0:t.indexOf("Apple"))||/safari/i.test(n)&&!/chrome|android/i.test(n))return 2;if(e.document.documentMode)return 0;return 3}()}function Pe(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":"",c=r&&r.partitioned?";partitioned":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(s).concat(u).concat(c)}function Be(e){return function(e,t){for(xe.lastIndex=0;;){var n=xe.exec(e);if(!n)break;if(n[1]===t)return n[2]}}(document.cookie,e)}function De(e){return Te||(Te=function(e){var t=new Map;for(xe.lastIndex=0;;){var n=xe.exec(e);if(!n)break;t.set(n[1],n[2])}return t}(document.cookie)),Te.get(e)}function Ne(e,t){Pe(e,"",0,t)}var Ue="_dd_s",Me=/^([a-z]+)=([a-z0-9-]+)$/,qe="&";function je(e){return P(e)}function He(e){e.expire=String(oe()+Ae)}function Ge(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(qe);var t}function Fe(e){var t={};return function(e){return!!e&&(-1!==e.indexOf(qe)||Me.test(e))}(e)&&e.split(qe).forEach((function(e){var n=Me.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}var Ve="_dd",ze="_dd_r",Ye="_dd_l",We="rum",Je="logs";function Ke(e){var t=function(e){var t={};t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie||!!e.useCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie||!!e.useCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===Re){for(var e="dd_site_test_".concat(_e()),t=window.location.hostname.split("."),n=t.pop();t.length&&!Be(e);)n="".concat(t.pop(),".").concat(n),Pe(e,"test",te,{domain:n});Ne(e,{domain:n}),Re=n}return Re}());return t}(e);return function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_".concat(_e()),n="test";Pe(t,n,ne,e);var r=Be(t)===n;return Ne(t,e),r}catch(e){return o.error(e),!1}}(t)?{type:"Cookie",cookieOptions:t}:void 0}function Ze(e){var t,n={isLockEnabled:1===Ie(),persistSession:(t=e,function(e){Pe(Ue,Ge(e),Ae,t)}),retrieveSession:$e,clearSession:Xe(e)};return function(e){if(!De(Ue)){var t=De(Ve),n=De(ze),r=De(Ye),o={};t&&(o.id=t),r&&/^[01]$/.test(r)&&(o[Je]=r),n&&/^[012]$/.test(n)&&(o[We]=n),je(o)||(He(o),e.persistSession(o))}}(n),n}function $e(){return Fe(Be(Ue))}function Xe(e){return function(){Ne(Ue,e)}}var Qe="_dd_test_";function et(e){localStorage.setItem(Ue,Ge(e))}function tt(){return Fe(localStorage.getItem(Ue))}function nt(){localStorage.removeItem(Ue)}var rt,ot=10,it=100,at=[];function st(e,t,n){var r;void 0===n&&(n=0);var o=t.isLockEnabled,i=t.retrieveSession,a=t.persistSession,s=t.clearSession;if(rt||(rt=e),e===rt)if(o&&n>=it)ct(t);else{var u,c=i();if(o){if(c.lock)return void ut(e,t,n);if(u=_e(),c.lock=u,a(c),(c=i()).lock!==u)return void ut(e,t,n)}var f=e.process(c);if(o&&(c=i()).lock!==u)ut(e,t,n);else{if(f&&(je(f)?s():(He(f),a(f))),o&&(!f||!je(f))){if((c=i()).lock!==u)return void ut(e,t,n);delete c.lock,a(c),f=c}null===(r=e.after)||void 0===r||r.call(e,f||c),ct(t)}}else at.push(e)}function ut(e,t,n){x((function(){st(e,t,n+1)}),ot)}function ct(e){rt=void 0;var t=at.shift();t&&st(t,e)}var ft=te;function lt(e){var t=Ke(e);return!t&&e.allowFallbackToLocalStorage&&(t=function(){try{var e=_e(),t="".concat(Qe).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 dt(e,t,n){var r=new K,o=new K,i="Cookie"===e.type?Ze(e.cookieOptions):{isLockEnabled:!1,persistSession:et,retrieveSession:tt,clearSession:nt},a=i.clearSession,s=i.retrieveSession,u=O((function(){st({process:function(e){return d(e)?void 0:{}},after:f},i)}),ft),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||oe()-Number(e.created)<Le)&&(void 0===e.expire||oe()<Number(e.expire))}return{expandOrRenewSession:R((function(){var e;st({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=_e(),e.created=String(oe()));return i}(o),o},after:function(t){e&&!l()&&function(e){c=e,r.notify()}(t),c=t}},i)}),ft).throttled,expandSession:function(){st({process:function(e){return l()?f(e):void 0}},i)},getSession:function(){return c},renewObservable:r,expireObservable:o,expire:function(){a(),f({})},stop:function(){T(u)}}}function pt(e){return vt(e,yt(window.location)).href}function vt(e,t){var n=function(){if(void 0===gt)try{var e=new ht("http://test/path");gt="http://test/path"===e.href}catch(e){gt=!1}return gt?ht: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(A({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 gt,ht=URL;function yt(e){if(e.origin&&"null"!==e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}var mt="datad0g.com",bt="dd0g-gov.com",Et="datadoghq.com";function St(e,t,n){var r=function(e,t){var n="/api/v2/".concat(t),r=e.proxy;if("string"==typeof r){var o=pt(r);return function(e){return"".concat(o,"?ddforward=").concat(encodeURIComponent("".concat(n,"?").concat(e)))}}if("function"==typeof r)return function(e){return r({path:n,parameters:e})};var i=function(e){var t=e.site,n=void 0===t?Et:t,r=e.internalAnalyticsSubdomain;if(r&&n===Et)return"".concat(r,".").concat(Et);if(n===bt)return"http-intake.logs.".concat(n);var o=n.split("."),i=o.pop();return"browser-intake-".concat(o.join("-"),".").concat(i)}(e);return function(e){return"https://".concat(i).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("5.8.0"),"api:".concat(r)].concat(n);u&&Ee(ve.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("5.8.0")),"dd-evp-origin=browser","dd-request-id=".concat(_e())];c&&l.push("dd-evp-encoding=".concat(c));"rum"===t&&l.push("batch_time=".concat(ie()));a&&l.reverse();return l.join("&")}(e,t,n,o,i);return r(a)},urlPrefix:r(""),trackType:t}}var wt=200;var Ct=/[^a-z0-9_:./-]/;function _t(e,t){var n=wt-e.length-1;(t.length>n||Ct.test(t))&&o.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var r=t.replace(/,/g,"_");return"".concat(e,":").concat(r)}function xt(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(_t("env",t)),n&&i.push(_t("service",n)),r&&i.push(_t("version",r)),o&&i.push(_t("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:St(e,"logs",t),rumEndpointBuilder:St(e,"rum",t),sessionReplayEndpointBuilder:St(e,"replay",t)}}(e,t),r=h(n).map((function(e){return e.urlPrefix})),o=function(e,t,n){if(!e.replica)return;var r=m({},e,{site:Et,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:St(r,"logs",n),rumEndpointBuilder:St(r,"rum",n)};return t.push.apply(t,h(o).map((function(e){return e.urlPrefix}))),m({applicationId:e.replica.applicationId},o)}(e,r,t);return m({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||Et},n)}function kt(e){var t,n,r;if(e&&e.clientToken)if(void 0===e.sessionSampleRate||Ce(e.sessionSampleRate))if(void 0===e.telemetrySampleRate||Ce(e.telemetrySampleRate)){if(void 0===e.telemetryConfigurationSampleRate||Ce(e.telemetryConfigurationSampleRate))return Array.isArray(e.enableExperimentalFeatures)&&e.enableExperimentalFeatures.filter((function(e){return t=ve,n=e,Object.keys(t).some((function(e){return t[e]===n}));var t,n})).forEach((function(e){be.add(e)})),m({beforeSend:e.beforeSend&&i(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:lt(e),sessionSampleRate:null!==(t=e.sessionSampleRate)&&void 0!==t?t:100,telemetrySampleRate:null!==(n=e.telemetrySampleRate)&&void 0!==n?n:20,telemetryConfigurationSampleRate:null!==(r=e.telemetryConfigurationSampleRate)&&void 0!==r?r:5,service:e.service,silentMultipleInit:!!e.silentMultipleInit,allowUntrustedEvents:!!e.allowUntrustedEvents,batchBytesLimit:16*E,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*te,batchMessagesLimit:50,messageBytesLimit:256*E},xt(e));o.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else o.error("Telemetry Sample Rate should be a number between 0 and 100");else o.error("Session Sample Rate should be a number between 0 and 100");else o.error("Client Token is not configured, we will not send any data.")}var Ot="?";function Tt(e){var t=[],n=Ut(e,"stack"),r=String(e);return n&&y(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=At.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=It.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]||Ot,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Pt.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:Ot,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=Bt.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||Ot,line:+t[3],url:t[2]}}(e)||function(e){var t=Dt.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=Nt.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]||Ot,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=Ot),t.push(n))})),{message:Ut(e,"message"),name:Ut(e,"name"),stack:t}}var Rt="((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",Lt="(?::(\\d+))",At=new RegExp("^\\s*at (.*?) ?\\(".concat(Rt).concat(Lt,"?").concat(Lt,"?\\)?\\s*$"),"i"),It=new RegExp("\\((\\S*)".concat(Lt).concat(Lt,"\\)"));var Pt=new RegExp("^\\s*at ?".concat(Rt).concat(Lt,"?").concat(Lt,"??\\s*$"),"i");var Bt=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var Dt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Nt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Ut(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function Mt(e,t,n,r){var o=[{url:t,column:r,line:n}],i=function(e){var t,n,r;"[object String]"==={}.toString.call(e)&&(n=(t=qt.exec(e))[1],r=t[2]);return{name:n,message:r}}(e);return{name:i.name,message:i.message,stack:o}}var qt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;var jt="No stack, consider using an instance of Error";function Ht(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(A(Y(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)?Ft(t):jt,l=u?function(e,t){var n=e,r=[];for(;(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=Tt(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&Ft(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:Gt(n)}}function Gt(e){return e instanceof Error&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function Ft(e){var t=Vt(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 Vt(e){return"".concat(e.name||"Error",": ").concat(e.message)}var zt={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function Yt(e,t){var n=[];v(t,zt.cspViolation)&&n.push(function(e){return new K((function(t){return de(e,document,Q.SECURITY_POLICY_VIOLATION,(function(e){t.notify(function(e){var t=zt.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:zt.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:Wt(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(ke(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber),originalReport:e}}(e))})).stop}))}(e));var r=t.filter((function(e){return e!==zt.cspViolation}));return r.length&&n.push(function(e){return new K((function(t){if(window.ReportingObserver){var n=l((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),originalReport:e,stack:Wt(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()}}}))}(r)),Z.apply(void 0,n)}function Wt(e,t,n,r,o){return n?Ft({name:e,message:t,stack:[{func:"?",url:n,line:null!=r?r:void 0,column:null!=o?o:void 0}]}):void 0}var Jt=32*E;function Kt(e,t,n){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return v(t,e)}))?"all"===e?t:(r=e,i=new Set,r.forEach((function(e){return i.add(e)})),g(i)):void o.error("".concat(n,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'));var r,i}var Zt={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"},$t=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},Xt={debug:"debug",error:"error",info:"info",warn:"warn"},Qt={console:"console",http:"http",silent:"silent"},en=Object.keys(Xt),tn=function(){function e(e,t,n,r,o,i){void 0===r&&(r=Qt.http),void 0===o&&(o=Xt.debug),void 0===i&&(i={}),this.handleLogStrategy=e,this.handlerType=r,this.level=o,this.contextManager=$(t),this.contextManager.setContext(i),n&&this.contextManager.setContextProperty("logger",{name:n})}return e.prototype.log=function(e,t,n,r){var o;if(void 0===n&&(n=Xt.info),null!=r){var i=Ht({stackTrace:r instanceof Error?Tt(r):void 0,originalError:r,nonErrorPrefix:"Provided",source:Zt.LOGGER,handling:"handled",startClocks:se()});o={stack:i.stack,kind:i.type,message:i.message}}var a=Y(t),s=o?G({error:o},a):a;this.handleLogStrategy({message:Y(e),context:s,status:n},this)},e.prototype.debug=function(e,t,n){this.log(e,t,Xt.debug,n)},e.prototype.info=function(e,t,n){this.log(e,t,Xt.info,n)},e.prototype.warn=function(e,t,n){this.log(e,t,Xt.warn,n)},e.prototype.error=function(e,t,n){this.log(e,t,Xt.error,n)},e.prototype.setContext=function(e){this.contextManager.setContext(e)},e.prototype.getContext=function(){return this.contextManager.getContext()},e.prototype.setContextProperty=function(e,t){this.contextManager.setContextProperty(e,t)},e.prototype.removeContextProperty=function(e){this.contextManager.removeContextProperty(e)},e.prototype.clearContext=function(){this.contextManager.clearContext()},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},$t([f],e.prototype,"log",null),e}();var nn="logs";function rn(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var on={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};var an="datadog-synthetics-public-id",sn="datadog-synthetics-result-id",un="datadog-synthetics-injects-rum";function cn(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||De(un))}function fn(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||De(sn);return"string"==typeof e?e:void 0}var ln=1/0,dn=ne,pn=function(){function e(e,t){var n=this;this.expireDelay=e,this.maxEntries=t,this.entries=[],this.clearOldValuesInterval=O((function(){return n.clearOldValues()}),dn)}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=ue(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(){T(this.clearOldValuesInterval)},e.prototype.clearOldValues=function(){for(var e=ae()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}(),vn=ne,gn=Le,hn=[];function yn(e,t,n){var r=dt(e.sessionStoreStrategyType,t,n);hn.push((function(){return r.stop()}));var o=new pn(gn);function i(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return hn.push((function(){return o.stop()})),r.renewObservable.subscribe((function(){o.add(i(),ae())})),r.expireObservable.subscribe((function(){o.closeActive(ae())})),r.expandOrRenewSession(),o.add(i(),[0,ce()][0]),function(e,t){var n=pe(e,window,[Q.CLICK,Q.TOUCH_START,Q.KEY_DOWN,Q.SCROLL],t,{capture:!0,passive:!0}).stop;hn.push(n)}(e,(function(){return r.expandOrRenewSession()})),function(e,t){var n=function(){"visible"===document.visibilityState&&t()},r=de(e,document,Q.VISIBILITY_CHANGE,n).stop;hn.push(r);var o=O(n,vn);hn.push((function(){T(o)}))}(e,(function(){return r.expandSession()})),{findActiveSession:function(e){return o.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable,expire:r.expire}}var mn="logs";function bn(e){var t=yn(e,mn,(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:En(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 En(e){return we(e.sessionSampleRate)?"1":"0"}function Sn(){var e,t=window.navigator;return{status:t.onLine?"connected":"not_connected",interfaces:t.connection&&t.connection.type?[t.connection.type]:void 0,effective_type:null===(e=t.connection)||void 0===e?void 0:e.effectiveType}}var wn,Cn={log:"log",configuration:"configuration"},_n=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],xn=["ddog-gov.com"],kn={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function On(e,t){var n,r=new K;kn.telemetryEnabled=!v(xn,t.site)&&we(t.telemetrySampleRate),kn.telemetryConfigurationEnabled=kn.telemetryEnabled&&we(t.telemetryConfigurationSampleRate);var o={is_local_file:"file:"===window.location.protocol,is_worker:"WorkerGlobalScope"in self};return wn=function(t){if(kn.telemetryEnabled){var i=function(e,t,r){return G({type:"telemetry",date:ie(),service:e,version:"5.8.0",source:"browser",_dd:{format_version:2},telemetry:G(t,{runtime_env:r,connectivity:Sn()}),experimental_features:g(Se())},void 0!==n?n():{})}(e,t,o);r.notify(i),rn("telemetry",i)}},a=Rn,m(kn,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:r,enabled:kn.telemetryEnabled}}function Tn(t,n){p(e.debug,t,n),Ln(m({type:Cn.log,message:t,status:"debug"},n))}function Rn(e,t){Ln(m({type:Cn.log,status:"error"},function(e){if(e instanceof Error){var t=Tt(e);return{error:{kind:t.name,stack:Ft(An(t))},message:t.message}}return{error:{stack:jt},message:"".concat("Uncaught"," ").concat(A(e))}}(e),t))}function Ln(e){wn&&kn.sentEventCount<kn.maxEventsPerPage&&(kn.sentEventCount+=1,wn(e))}function An(e){return e.stack=e.stack.filter((function(e){return!e.url||_n.some((function(t){return y(e.url,t)}))})),e}var In=!1;function Pn(e){var t,n=window;if(cn()){var r=o(n.DD_RUM_SYNTHETICS);return r||In||(In=!0,Tn("Logs sent before RUM is injected by the synthetics worker",{testId:(t=window._DATADOG_SYNTHETICS_PUBLIC_ID||De(an),"string"==typeof t?t:void 0),resultId:fn()})),r}return o(n.DD_RUM);function o(t){if(t&&t.getInternalContext)return t.getInternalContext(e)}}function Bn(e,t,n,r,o){var i=en.concat(["custom"]),a={};i.forEach((function(e){var n,r,i,s,u;a[e]=(n=e,r=t.eventRateLimiterThreshold,i=o,s=0,u=!1,{isLimitReached:function(){if(0===s&&x((function(){s=0}),ne),(s+=1)<=r||u)return u=!1,!1;if(s===r+1){u=!0;try{i({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:Zt.AGENT,startClocks:se()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(o){var i,s,u=o.rawLogsEvent,c=o.messageContext,f=void 0===c?void 0:c,l=o.savedCommonContext,d=void 0===l?void 0:l,p=u.date-ce(),v=e.findTrackedSession(p);if(v){var g=d||r(),h=G({service:t.service,session_id:v.id,usr:P(g.user)?void 0:g.user,view:g.view},g.context,Pn(p),u,f);!1===(null===(i=t.beforeSend)||void 0===i?void 0:i.call(t,h))||h.origin!==Zt.AGENT&&(null!==(s=a[h.status])&&void 0!==s?s:a.custom).isLimitReached()||n.notify(1,h)}}))}var Dn,Nn={};function Un(n){var r=n.map((function(n){return Nn[n]||(Nn[n]=function(n){return new K((function(r){var o=t[n];return t[n]=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];o.apply(console,t);var a=function(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return d((function(){var n=Tt(t);n.stack=n.stack.slice(2),e=Ft(n)})),e}();d((function(){r.notify(function(t,n,r){var o,i,a=t.map((function(e){return function(e){if("string"==typeof e)return Y(e);if(e instanceof Error)return Vt(Tt(e));return A(Y(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?Ft(Tt(s)):void 0,i=Gt(s)}return{api:n,message:a,stack:o,handlingStack:r,fingerprint:i}}(t,n,a))}))},function(){t[n]=o}}))}(n)),Nn[n]}));return Z.apply(void 0,r)}var Mn,qn=((Dn={})[e.log]=Xt.info,Dn[e.debug]=Xt.debug,Dn[e.info]=Xt.info,Dn[e.warn]=Xt.warn,Dn[e.error]=Xt.error,Dn);var jn,Hn=((Mn={})[zt.cspViolation]=Xt.error,Mn[zt.intervention]=Xt.error,Mn[zt.deprecation]=Xt.warn,Mn);function Gn(e,t,n){var r=e[t],o=function(e,t){return function(){var n,r,o=arguments;return d(t,null,[{target:this,parameters:o,onPostCall:function(e){r=e}}]),"function"==typeof e&&(n=e.apply(this,o)),r&&d(r,null,[n]),n}}(r,n),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}}}var Fn,Vn=new WeakMap;function zn(e){return jn||(jn=function(e){return new K((function(t){var n=Gn(XMLHttpRequest.prototype,"open",Yn).stop,r=Gn(XMLHttpRequest.prototype,"send",(function(n){!function(e,t,n){var r=e.target,o=Vn.get(r);if(!o)return;var i=o;i.state="start",i.startClocks=se(),i.isAborted=!1,i.xhr=r;var a=!1,s=Gn(r,"onreadystatechange",(function(){r.readyState===XMLHttpRequest.DONE&&u()})).stop,u=function(){if(c(),s(),!a){a=!0;var e,t=o;t.state="complete",t.duration=(e=i.startClocks.timeStamp,ie()-e),t.status=r.status,n.notify(m({},t))}},c=de(t,r,"loadend",u).stop;n.notify(i)}(n,e,t)})).stop,o=Gn(XMLHttpRequest.prototype,"abort",Wn).stop;return function(){n(),r(),o()}}))}(e)),jn}function Yn(e){var t=e.target,n=e.parameters,r=n[0],o=n[1];Vn.set(t,{state:"open",method:String(r).toUpperCase(),url:pt(String(o))})}function Wn(e){var t=e.target,n=Vn.get(t);n&&(n.isAborted=!0)}function Jn(){return Fn||(Fn=new K((function(e){if(window.fetch){var t=Gn(window,"fetch",(function(t){return function(e,t){var n=e.parameters,r=e.onPostCall,o=n[0],i=n[1],a=i&&i.method;void 0===a&&o instanceof Request&&(a=o.method);var s=void 0!==a?String(a).toUpperCase():"GET",u=o instanceof Request?o.url:pt(String(o)),c=se(),f={state:"start",init:i,input:o,method:s,startClocks:c,url:u};t.notify(f),n[0]=f.input,n[1]=f.init,r((function(e){return function(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(l(r),l(r))}(t,e,f)}))}(t,e)})).stop;return t}}))),Fn}function Kn(e){return e>=500}function Zn(e,t){if(!e.forwardErrorsToLogs)return{stop:L};var n=zn(e).subscribe((function(e){"complete"===e.state&&o("xhr",e)})),r=Jn().subscribe((function(e){"resolve"===e.state&&o("fetch",e)}));function o(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(Xn(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:Xt.error,origin:Zt.NETWORK}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!Kn(r.status)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n($n(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(L),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(l((function(t){t.done?a():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?a():e())})),l((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(l((function(e){return n($n(e,t))})),l((function(e){return n("Unable to retrieve response: ".concat(e))}))):n()}(r.response,e,o):r.error&&function(e,t,n){n($n(Ft(Tt(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function $n(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function Xn(e){return"xhr"===e?"XHR":"Fetch"}function Qn(e){var t,n=function(t,n){var r=Ht({stackTrace:t,originalError:n,startClocks:se(),nonErrorPrefix:"Uncaught",source:Zt.SOURCE,handling:"unhandled"});e.notify(r)},r=(t=n,Gn(window,"onerror",(function(e){var n,r=e.parameters,o=r[0],i=r[1],a=r[2],s=r[3],u=r[4];n=u instanceof Error?Tt(u):Mt(o,i,a,s),t(n,null!=u?u:o)}))).stop,o=function(e){return Gn(window,"onunhandledrejection",(function(t){var n=t.parameters[0].reason||"Empty reason",r=Tt(n);e(r,n)}))}(n).stop;return{stop:function(){r(),o()}}}var er,tr=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}(),nr=((er={})[Xt.debug]=0,er[Xt.info]=1,er[Xt.warn]=2,er[Xt.error]=3,er);function rr(e){return{handleLog:function(r,o,i,a){var s=G(o.getContext(),r.context);or(r.status,Qt.console,o)&&function(e,r){n[e.status].call(t,e.message,r)}(r,s),or(r.status,Qt.http,o)&&e.notify(0,{rawLogsEvent:{date:a||ie(),message:r.message,status:r.status,origin:Zt.LOGGER},messageContext:s,savedCommonContext:i})}}}function or(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return nr[e]>=nr[n.getLevel()]&&v(o,t)}var ir=function(){function e(e,t,n,r){var o=this;this.encoder=e,this.request=t,this.flushController=n,this.messageBytesLimit=r,this.upsertBuffer={},this.flushSubscription=this.flushController.flushObservable.subscribe((function(e){return o.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=h(this.upsertBuffer).join("\n");this.upsertBuffer={};var n,r=(n=e.reason,v(h(on),n)),o=r?this.request.sendOnExit:this.request.send;if(r&&this.encoder.isAsync){var i=this.encoder.finishSync();i.outputBytesCount&&o(ar(i,e));var a=[i.pendingData,t].filter(Boolean).join("\n");a&&o({data:a,bytesCount:C(a),flushReason:e.reason})}else t&&this.encoder.write(this.encoder.isEmpty?t:"\n".concat(t)),this.encoder.finish((function(t){o(ar(t,e))}))},e.prototype.addOrUpdate=function(e,t){var n=A(e),r=this.encoder.estimateEncodedBytesCount(n);r>=this.messageBytesLimit?o.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB.")):(this.hasMessageFor(t)&&this.remove(t),this.push(n,r,t))},e.prototype.push=function(e,t,n){var r=this;this.flushController.notifyBeforeAddMessage(t),void 0!==n?(this.upsertBuffer[n]=e,this.flushController.notifyAfterAddMessage()):this.encoder.write(this.encoder.isEmpty?e:"\n".concat(e),(function(e){r.flushController.notifyAfterAddMessage(e-t)}))},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.encoder.estimateEncodedBytesCount(t);this.flushController.notifyAfterRemoveMessage(n)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e}();function ar(e,t){return{data:"string"==typeof e.output?e.output:new Blob([e.output],{type:"text/plain"}),bytesCount:e.outputBytesCount,encoding:e.encoding,flushReason:t.reason}}var sr=80*E,ur=32,cr=3*S,fr=ne,lr=te;function dr(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?vr(e,t,n,{onSuccess:function(){return gr(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),pr(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function pr(e,t,n,r){2===e.transportStatus&&x((function(){vr(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=lr,gr(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(fr,2*e.currentBackoffTime),pr(e,t,n,r)}})}),e.currentBackoffTime)}function vr(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||Kn(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 gr(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(cr/S,"MiB"),source:Zt.AGENT,startClocks:se()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=hr();i.size()>0;)dr(i.dequeue(),t,n,r,o)}function hr(){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>=cr}}}function yr(e,t,n,r){var o={transportStatus:0,currentBackoffTime:lr,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=sr&&this.ongoingRequestCount<ur},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:hr(),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(l((function(e){return null==o?void 0:o({status:e.status,type:e.type})})),l((function(){var n=t.build("xhr",r);br(e,n,r.data,o)})))}else{var s=t.build("xhr",r);br(e,s,r.data,o)}}(e,t,n,r,o)};return{send:function(e){dr(e,o,i,t.trackType,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){mr||(mr=!0,Rn(e))}(e)}var a=t.build("xhr",r);br(e,a,r.data)}(e,t,n,r)}}}var mr=!1;function br(e,t,n,r){var o=new XMLHttpRequest;o.open("POST",t,!0),n instanceof Blob&&o.setRequestHeader("Content-Type",n.type),de(e,o,"loadend",(function(){null==r||r({status:o.status})}),{once:!0}),o.send(n)}function Er(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 K((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,p(),c.notify({reason:e,messagesCount:t,bytesCount:n})}}function p(){k(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(e){void 0===e&&(e=0),f+=e,l>=n?d("messages_limit"):f>=r&&d("bytes_limit")},notifyAfterRemoveMessage:function(e){f-=e,0===(l-=1)&&p()}}}function Sr(e,t,n,r,o,i){var a=u(e,t),s=n&&u(e,n);function u(e,t){var n=t.endpoint,a=t.encoder;return new ir(a,yr(e,n,e.batchBytesLimit,r),Er({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()}}}function wr(){var e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write:function(n,r){var o=C(n);t+=o,e+=n,r&&r(o)},finish:function(e){e(this.finishSync())},finishSync:function(){var n={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,n},estimateEncodedBytesCount:function(e){return e.length}}}function Cr(e,t,n,r,o){var i=On("browser-logs-sdk",t);i.setContextProvider((function(){var e,t,n,r,i,a;return{application:{id:null===(e=Pn())||void 0===e?void 0:e.application_id},session:{id:null===(t=o.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=Pn())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(a=null===(i=Pn())||void 0===i?void 0:i.user_action)||void 0===a?void 0:a.id}}}));var a=[];if(le()){var s=fe(),u=i.observable.subscribe((function(e){return s.send("internal_telemetry",e)}));a.push((function(){return u.unsubscribe()}))}else{var c=Sr(t,{endpoint:t.rumEndpointBuilder,encoder:wr()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:wr()},n,r,o.expireObservable);a.push((function(){return c.stop()}));var f=i.observable.subscribe((function(e){return c.add(e,function(e){return e.site===mt}(t))}));a.push((function(){return f.unsubscribe()}))}return function(e){kn.telemetryConfigurationEnabled&&Ln({type:Cn.configuration,configuration:e})}(function(e){var t,n={session_sample_rate:(t=e).sessionSampleRate,telemetry_sample_rate:t.telemetrySampleRate,telemetry_configuration_sample_rate:t.telemetryConfigurationSampleRate,use_before_send:!!t.beforeSend,use_cross_site_session_cookie:t.useCrossSiteSessionCookie,use_partitioned_cross_site_session_cookie:t.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:t.useSecureSessionCookie,use_proxy:!!t.proxy,silent_multiple_init:t.silentMultipleInit,track_session_across_subdomains:t.trackSessionAcrossSubdomains,allow_fallback_to_local_storage:!!t.allowFallbackToLocalStorage,store_contexts_across_pages:!!t.storeContextsAcrossPages,allow_untrusted_events:!!t.allowUntrustedEvents};return m({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},n)}(e)),{telemetry:i,stop:function(){a.forEach((function(e){return e()}))}}}var _r,xr,kr,Or,Tr=function(t){var n,r,i=!1,a=U(),s=$(a.getOrCreateTracker(2)),u=$(a.getOrCreateTracker(1)),f={},d=function(){},p=new ee,g=function(e,t,n,r){void 0===n&&(n=E()),void 0===r&&(r=ie()),p.add((function(){return g(e,t,n,r)}))},y=function(){},b=new tn((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g.apply(void 0,e)}),a.createDetachedTracker());function E(){return function(e,t){return{view:{referrer:document.referrer,url:window.location.href},context:e.getContext(),user:t.getContext()}}(s,u)}return n={logger:b,init:l((function(n){var r;if(n){if(y=function(){return H(n)},le()&&(n=function(e){return m({},e,{clientToken:"empty"})}(n)),function(e){return!i||(e.silentMultipleInit||o.error("DD_LOGS is already initialized."),!1)}(n)){var a=function(t){var n=kt(t),r=Kt(t.forwardConsoleLogs,h(e),"Forward Console Logs"),o=Kt(t.forwardReports,h(zt),"Forward Reports");if(n&&r&&o)return t.forwardErrorsToLogs&&!v(r,e.error)&&r.push(e.error),m({forwardErrorsToLogs:!1!==t.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:Jt},n)}(n);a&&(n.storeContextsAcrossPages&&(ye(a,s,nn,2),ye(a,u,nn,1)),r=t(n,a,E),g=r.handleLog,d=r.getInternalContext,p.drain(),i=!0)}}else o.error("Missing configuration")})),getGlobalContext:l((function(){return s.getContext()})),setGlobalContext:l((function(e){return s.setContext(e)})),setGlobalContextProperty:l((function(e,t){return s.setContextProperty(e,t)})),removeGlobalContextProperty:l((function(e){return s.removeContextProperty(e)})),clearGlobalContext:l((function(){return s.clearContext()})),createLogger:l((function(e,t){return void 0===t&&(t={}),f[e]=new tn((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g.apply(void 0,e)}),a.createDetachedTracker(),Y(e),t.handler,t.level,Y(t.context)),f[e]})),getLogger:l((function(e){return f[e]})),getInitConfiguration:l((function(){return y()})),getInternalContext:l((function(e){return d(e)})),setUser:l((function(e){(function(e){var t="object"===q(e);return t||o.error("Unsupported user:",e),t})(e)&&u.setContext(me(e))})),getUser:l((function(){return u.getContext()})),setUserProperty:l((function(e,t){var n,r=me((n={},n[e]=t,n))[e];u.setContextProperty(e,r)})),removeUserProperty:l((function(e){return u.removeContextProperty(e)})),clearUser:l((function(){return u.clearContext()}))},r=m({version:"5.8.0",onReady:function(e){e()}},n),Object.defineProperty(r,"_setDebug",{get:function(){return c},enumerable:!1}),r}((function(t,n,r){var o=new tr,i=[];o.subscribe(1,(function(e){return rn("logs",e)}));var a=function(e){return function(t){e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:Zt.AGENT,status:Xt.error}}),Tn("Error reported to customer",{"error.message":t.message})}}(o),s=function(e){return new K((function(t){var n=Ee(ve.PAGEHIDE),r=pe(e,window,[Q.VISIBILITY_CHANGE,Q.FREEZE,Q.PAGE_HIDE],(function(e){e.type===Q.PAGE_HIDE&&n?t.notify({reason:on.PAGEHIDE}):e.type===Q.VISIBILITY_CHANGE&&"hidden"===document.visibilityState?t.notify({reason:on.HIDDEN}):e.type===Q.FREEZE&&t.notify({reason:on.FROZEN})}),{capture:!0}).stop,o=L;return n||(o=de(e,window,Q.BEFORE_UNLOAD,(function(){t.notify({reason:on.UNLOADING})})).stop),function(){r(),o()}}))}(n),u=!n.sessionStoreStrategyType||le()||cn()?function(e){var t="1"===En(e)?{}:void 0;return{findTrackedSession:function(){return t},expireObservable:new K}}(n):bn(n),c=Cr(t,n,a,s,u).stop;i.push((function(){return c()})),Zn(n,o),function(e,t){if(!e.forwardErrorsToLogs)return{stop:L};var n=new K,r=Qn(n).stop,o=n.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,stack:e.stack},origin:Zt.SOURCE,status:Xt.error}})}))}(n,o),function(t,n){var r=Un(t.forwardConsoleLogs).subscribe((function(t){n.notify(0,{rawLogsEvent:{date:ie(),message:t.message,origin:Zt.CONSOLE,error:t.api===e.error?{stack:t.stack,fingerprint:t.fingerprint}:void 0,status:qn[t.api]}})}))}(n,o),function(e,t){var n=Yt(e,e.forwardReports).subscribe((function(e){var n,r=e.message,o=Hn[e.type];o===Xt.error?n={kind:e.subtype,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:ie(),message:r,origin:Zt.REPORT,error:n,status:o}})}))}(n,o);var f,l=rr(o).handleLog;if(Bn(u,n,o,r,a),le())!function(e){var t=fe();e.subscribe(1,(function(e){t.send("log",e)}))}(o);else{var d=function(e,t,n,r,o){var i=Sr(e,{endpoint:e.logsEndpointBuilder,encoder:wr()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:wr()},n,r,o.expireObservable);return t.subscribe(1,(function(e){i.add(e)})),i}(n,o,a,s,u).stop;i.push((function(){return d()}))}return{handleLog:l,getInternalContext:(f=u,{get:function(e){var t=f.findTrackedSession(e);if(t)return{session_id:t.id}}}).get,stop:function(){i.forEach((function(e){return e()}))}}}));_r=b(),kr=Tr,Or=_r[xr="DD_LOGS"],_r[xr]=kr,Or&&Or.q&&Or.q.forEach((function(e){return i(e,"onReady callback threw an error:")()}))}();

@@ -24,3 +24,3 @@ import type { Context, InitConfiguration, User } from '@datadog/browser-core';

getInitConfiguration: () => InitConfiguration | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
setUser: (newUser: User) => void;

@@ -27,0 +27,0 @@ getUser: () => Context;

@@ -7,2 +7,3 @@ "use strict";

var logger_1 = require("../domain/logger");
var commonContext_1 = require("../domain/contexts/commonContext");
var LOGS_STORAGE_KEY = 'logs';

@@ -18,3 +19,3 @@ function makeLogsPublicApi(startLogsImpl) {

var handleLogStrategy = function (logsMessage, logger, savedCommonContext, date) {
if (savedCommonContext === void 0) { savedCommonContext = (0, browser_core_1.deepClone)(buildCommonContext()); }
if (savedCommonContext === void 0) { savedCommonContext = getCommonContext(); }
if (date === void 0) { date = (0, browser_core_1.timeStampNow)(); }

@@ -31,11 +32,4 @@ beforeInitLoggerLog.add(function () { return handleLogStrategy(logsMessage, logger, savedCommonContext, date); });

}, customerDataTrackerManager.createDetachedTracker());
function buildCommonContext() {
return {
view: {
referrer: document.referrer,
url: window.location.href,
},
context: globalContextManager.getContext(),
user: userContextManager.getContext(),
};
function getCommonContext() {
return (0, commonContext_1.buildCommonContext)(globalContextManager, userContextManager);
}

@@ -63,11 +57,7 @@ return (0, browser_core_1.makePublicApi)({

if (initConfiguration.storeContextsAcrossPages) {
var beforeInitGlobalContext = globalContextManager.getContext();
globalContextManager = (0, browser_core_1.createStoredContextManager)(configuration, LOGS_STORAGE_KEY, 2 /* CustomerDataType.GlobalContext */, customerDataTrackerManager.getOrCreateTracker(2 /* CustomerDataType.GlobalContext */));
globalContextManager.setContext((0, browser_core_1.combine)(globalContextManager.getContext(), beforeInitGlobalContext));
var beforeInitUserContext = userContextManager.getContext();
userContextManager = (0, browser_core_1.createStoredContextManager)(configuration, LOGS_STORAGE_KEY, 1 /* CustomerDataType.User */, customerDataTrackerManager.getOrCreateTracker(1 /* CustomerDataType.User */));
userContextManager.setContext((0, browser_core_1.combine)(userContextManager.getContext(), beforeInitUserContext));
(0, browser_core_1.storeContextManager)(configuration, globalContextManager, LOGS_STORAGE_KEY, 2 /* CustomerDataType.GlobalContext */);
(0, browser_core_1.storeContextManager)(configuration, userContextManager, LOGS_STORAGE_KEY, 1 /* CustomerDataType.User */);
}
;
(_a = startLogsImpl(initConfiguration, configuration, buildCommonContext), handleLogStrategy = _a.handleLog, getInternalContextStrategy = _a.getInternalContext);
(_a = startLogsImpl(initConfiguration, configuration, getCommonContext), handleLogStrategy = _a.handleLog, getInternalContextStrategy = _a.getInternalContext);
beforeInitLoggerLog.drain();

@@ -74,0 +64,0 @@ isAlreadyInitialized = true;

import type { LogsConfiguration, LogsInitConfiguration } from '../domain/configuration';
import type { CommonContext } from '../rawLogsEvent.types';
export declare function startLogs(initConfiguration: LogsInitConfiguration, configuration: LogsConfiguration, buildCommonContext: () => CommonContext): {
export declare function startLogs(initConfiguration: LogsInitConfiguration, configuration: LogsConfiguration, getCommonContext: () => CommonContext): {
handleLog: (logsMessage: import("../domain/logger").LogsMessage, logger: import("../domain/logger").Logger, savedCommonContext?: CommonContext | undefined, savedDate?: import("@datadog/browser-core").TimeStamp | undefined) => void;
getInternalContext: (startTime?: number | undefined) => import("../domain/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
stop: () => void;
};

@@ -15,6 +15,6 @@ "use strict";

var startLogsBridge_1 = require("../transport/startLogsBridge");
var internalContext_1 = require("../domain/internalContext");
var internalContext_1 = require("../domain/contexts/internalContext");
var reportError_1 = require("../domain/reportError");
var logsTelemetry_1 = require("../domain/logsTelemetry");
function startLogs(initConfiguration, configuration, buildCommonContext) {
function startLogs(initConfiguration, configuration, getCommonContext) {
var lifeCycle = new lifeCycle_1.LifeCycle();

@@ -35,3 +35,3 @@ var cleanupTasks = [];

var handleLog = (0, loggerCollection_1.startLoggerCollection)(lifeCycle).handleLog;
(0, assembly_1.startLogsAssembly)(session, configuration, lifeCycle, buildCommonContext, reportError);
(0, assembly_1.startLogsAssembly)(session, configuration, lifeCycle, getCommonContext, reportError);
if (!(0, browser_core_1.canUseEventBridge)()) {

@@ -38,0 +38,0 @@ var stopLogsBatch_1 = (0, startLogsBatch_1.startLogsBatch)(configuration, lifeCycle, reportError, pageExitObservable, session).stop;

@@ -6,2 +6,2 @@ import type { RawError } from '@datadog/browser-core';

import type { LogsSessionManager } from './logsSessionManager';
export declare function startLogsAssembly(sessionManager: LogsSessionManager, configuration: LogsConfiguration, lifeCycle: LifeCycle, buildCommonContext: () => CommonContext, reportError: (error: RawError) => void): void;
export declare function startLogsAssembly(sessionManager: LogsSessionManager, configuration: LogsConfiguration, lifeCycle: LifeCycle, getCommonContext: () => CommonContext, reportError: (error: RawError) => void): void;

@@ -6,4 +6,4 @@ "use strict";

var logger_1 = require("./logger");
var rumInternalContext_1 = require("./rumInternalContext");
function startLogsAssembly(sessionManager, configuration, lifeCycle, buildCommonContext, reportError) {
var rumInternalContext_1 = require("./contexts/rumInternalContext");
function startLogsAssembly(sessionManager, configuration, lifeCycle, getCommonContext, reportError) {
var statusWithCustom = logger_1.STATUSES.concat(['custom']);

@@ -22,3 +22,3 @@ var logRateLimiters = {};

}
var commonContext = savedCommonContext || buildCommonContext();
var commonContext = savedCommonContext || getCommonContext();
var log = (0, browser_core_1.combine)({

@@ -25,0 +25,0 @@ service: configuration.service,

@@ -5,3 +5,3 @@ "use strict";

var browser_core_1 = require("@datadog/browser-core");
var rumInternalContext_1 = require("./rumInternalContext");
var rumInternalContext_1 = require("./contexts/rumInternalContext");
var configuration_1 = require("./configuration");

@@ -8,0 +8,0 @@ function startLogsTelemetry(initConfiguration, configuration, reportError, pageExitObservable, session) {

@@ -16,3 +16,3 @@ export { Logger, LogsMessage, StatusType, HandlerType } from '../domain/logger';

getInitConfiguration: () => import("@datadog/browser-core").InitConfiguration | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
setUser: (newUser: import("@datadog/browser-core").User) => void;

@@ -19,0 +19,0 @@ getUser: () => import("@datadog/browser-core").Context;

@@ -24,3 +24,3 @@ import type { Context, InitConfiguration, User } from '@datadog/browser-core';

getInitConfiguration: () => InitConfiguration | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
setUser: (newUser: User) => void;

@@ -27,0 +27,0 @@ getUser: () => Context;

@@ -1,4 +0,5 @@

import { assign, BoundedBuffer, createContextManager, makePublicApi, monitor, display, deepClone, canUseEventBridge, timeStampNow, checkUser, sanitizeUser, sanitize, createStoredContextManager, combine, createCustomerDataTrackerManager, } from '@datadog/browser-core';
import { assign, BoundedBuffer, createContextManager, makePublicApi, monitor, display, deepClone, canUseEventBridge, timeStampNow, checkUser, sanitizeUser, sanitize, createCustomerDataTrackerManager, storeContextManager, } from '@datadog/browser-core';
import { validateAndBuildLogsConfiguration } from '../domain/configuration';
import { Logger } from '../domain/logger';
import { buildCommonContext } from '../domain/contexts/commonContext';
var LOGS_STORAGE_KEY = 'logs';

@@ -14,3 +15,3 @@ export function makeLogsPublicApi(startLogsImpl) {

var handleLogStrategy = function (logsMessage, logger, savedCommonContext, date) {
if (savedCommonContext === void 0) { savedCommonContext = deepClone(buildCommonContext()); }
if (savedCommonContext === void 0) { savedCommonContext = getCommonContext(); }
if (date === void 0) { date = timeStampNow(); }

@@ -27,11 +28,4 @@ beforeInitLoggerLog.add(function () { return handleLogStrategy(logsMessage, logger, savedCommonContext, date); });

}, customerDataTrackerManager.createDetachedTracker());
function buildCommonContext() {
return {
view: {
referrer: document.referrer,
url: window.location.href,
},
context: globalContextManager.getContext(),
user: userContextManager.getContext(),
};
function getCommonContext() {
return buildCommonContext(globalContextManager, userContextManager);
}

@@ -59,11 +53,7 @@ return makePublicApi({

if (initConfiguration.storeContextsAcrossPages) {
var beforeInitGlobalContext = globalContextManager.getContext();
globalContextManager = createStoredContextManager(configuration, LOGS_STORAGE_KEY, 2 /* CustomerDataType.GlobalContext */, customerDataTrackerManager.getOrCreateTracker(2 /* CustomerDataType.GlobalContext */));
globalContextManager.setContext(combine(globalContextManager.getContext(), beforeInitGlobalContext));
var beforeInitUserContext = userContextManager.getContext();
userContextManager = createStoredContextManager(configuration, LOGS_STORAGE_KEY, 1 /* CustomerDataType.User */, customerDataTrackerManager.getOrCreateTracker(1 /* CustomerDataType.User */));
userContextManager.setContext(combine(userContextManager.getContext(), beforeInitUserContext));
storeContextManager(configuration, globalContextManager, LOGS_STORAGE_KEY, 2 /* CustomerDataType.GlobalContext */);
storeContextManager(configuration, userContextManager, LOGS_STORAGE_KEY, 1 /* CustomerDataType.User */);
}
;
(_a = startLogsImpl(initConfiguration, configuration, buildCommonContext), handleLogStrategy = _a.handleLog, getInternalContextStrategy = _a.getInternalContext);
(_a = startLogsImpl(initConfiguration, configuration, getCommonContext), handleLogStrategy = _a.handleLog, getInternalContextStrategy = _a.getInternalContext);
beforeInitLoggerLog.drain();

@@ -70,0 +60,0 @@ isAlreadyInitialized = true;

import type { LogsConfiguration, LogsInitConfiguration } from '../domain/configuration';
import type { CommonContext } from '../rawLogsEvent.types';
export declare function startLogs(initConfiguration: LogsInitConfiguration, configuration: LogsConfiguration, buildCommonContext: () => CommonContext): {
export declare function startLogs(initConfiguration: LogsInitConfiguration, configuration: LogsConfiguration, getCommonContext: () => CommonContext): {
handleLog: (logsMessage: import("../domain/logger").LogsMessage, logger: import("../domain/logger").Logger, savedCommonContext?: CommonContext | undefined, savedDate?: import("@datadog/browser-core").TimeStamp | undefined) => void;
getInternalContext: (startTime?: number | undefined) => import("../domain/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
stop: () => void;
};

@@ -12,6 +12,6 @@ import { sendToExtension, createPageExitObservable, willSyntheticsInjectRum, canUseEventBridge, } from '@datadog/browser-core';

import { startLogsBridge } from '../transport/startLogsBridge';
import { startInternalContext } from '../domain/internalContext';
import { startInternalContext } from '../domain/contexts/internalContext';
import { startReportError } from '../domain/reportError';
import { startLogsTelemetry } from '../domain/logsTelemetry';
export function startLogs(initConfiguration, configuration, buildCommonContext) {
export function startLogs(initConfiguration, configuration, getCommonContext) {
var lifeCycle = new LifeCycle();

@@ -32,3 +32,3 @@ var cleanupTasks = [];

var handleLog = startLoggerCollection(lifeCycle).handleLog;
startLogsAssembly(session, configuration, lifeCycle, buildCommonContext, reportError);
startLogsAssembly(session, configuration, lifeCycle, getCommonContext, reportError);
if (!canUseEventBridge()) {

@@ -35,0 +35,0 @@ var stopLogsBatch_1 = startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable, session).stop;

@@ -6,2 +6,2 @@ import type { RawError } from '@datadog/browser-core';

import type { LogsSessionManager } from './logsSessionManager';
export declare function startLogsAssembly(sessionManager: LogsSessionManager, configuration: LogsConfiguration, lifeCycle: LifeCycle, buildCommonContext: () => CommonContext, reportError: (error: RawError) => void): void;
export declare function startLogsAssembly(sessionManager: LogsSessionManager, configuration: LogsConfiguration, lifeCycle: LifeCycle, getCommonContext: () => CommonContext, reportError: (error: RawError) => void): void;
import { ErrorSource, combine, createEventRateLimiter, getRelativeTime, isEmptyObject } from '@datadog/browser-core';
import { STATUSES } from './logger';
import { getRUMInternalContext } from './rumInternalContext';
export function startLogsAssembly(sessionManager, configuration, lifeCycle, buildCommonContext, reportError) {
import { getRUMInternalContext } from './contexts/rumInternalContext';
export function startLogsAssembly(sessionManager, configuration, lifeCycle, getCommonContext, reportError) {
var statusWithCustom = STATUSES.concat(['custom']);

@@ -18,3 +18,3 @@ var logRateLimiters = {};

}
var commonContext = savedCommonContext || buildCommonContext();
var commonContext = savedCommonContext || getCommonContext();
var log = combine({

@@ -21,0 +21,0 @@ service: configuration.service,

import { startTelemetry, canUseEventBridge, getEventBridge, startBatchWithReplica, createIdentityEncoder, isTelemetryReplicationAllowed, addTelemetryConfiguration, } from '@datadog/browser-core';
import { getRUMInternalContext } from './rumInternalContext';
import { getRUMInternalContext } from './contexts/rumInternalContext';
import { serializeLogsConfiguration } from './configuration';

@@ -4,0 +4,0 @@ export function startLogsTelemetry(initConfiguration, configuration, reportError, pageExitObservable, session) {

@@ -16,3 +16,3 @@ export { Logger, LogsMessage, StatusType, HandlerType } from '../domain/logger';

getInitConfiguration: () => import("@datadog/browser-core").InitConfiguration | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
setUser: (newUser: import("@datadog/browser-core").User) => void;

@@ -19,0 +19,0 @@ getUser: () => import("@datadog/browser-core").Context;

{
"name": "@datadog/browser-logs",
"version": "5.7.0",
"version": "5.8.0",
"license": "Apache-2.0",

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

"dependencies": {
"@datadog/browser-core": "5.7.0"
"@datadog/browser-core": "5.8.0"
},
"peerDependencies": {
"@datadog/browser-rum": "5.7.0"
"@datadog/browser-rum": "5.8.0"
},

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

},
"gitHead": "c631b23ad26be38c64db98c134cb3c57fa5cf7f7"
"gitHead": "450e621c48d00e8f50c97d6cc12c4ae7a7989daf"
}

@@ -16,5 +16,4 @@ import type { Context, InitConfiguration, User } from '@datadog/browser-core'

sanitize,
createStoredContextManager,
combine,
createCustomerDataTrackerManager,
storeContextManager,
} from '@datadog/browser-core'

@@ -25,3 +24,3 @@ import type { LogsInitConfiguration } from '../domain/configuration'

import { Logger } from '../domain/logger'
import type { CommonContext } from '../rawLogsEvent.types'
import { buildCommonContext } from '../domain/contexts/commonContext'
import type { startLogs } from './startLogs'

@@ -47,6 +46,6 @@

const customerDataTrackerManager = createCustomerDataTrackerManager()
let globalContextManager = createContextManager(
const globalContextManager = createContextManager(
customerDataTrackerManager.getOrCreateTracker(CustomerDataType.GlobalContext)
)
let userContextManager = createContextManager(customerDataTrackerManager.getOrCreateTracker(CustomerDataType.User))
const userContextManager = createContextManager(customerDataTrackerManager.getOrCreateTracker(CustomerDataType.User))

@@ -61,3 +60,3 @@ const customLoggers: { [name: string]: Logger | undefined } = {}

logger: Logger,
savedCommonContext = deepClone(buildCommonContext()),
savedCommonContext = getCommonContext(),
date = timeStampNow()

@@ -74,11 +73,4 @@ ) => {

function buildCommonContext(): CommonContext {
return {
view: {
referrer: document.referrer,
url: window.location.href,
},
context: globalContextManager.getContext(),
user: userContextManager.getContext(),
}
function getCommonContext() {
return buildCommonContext(globalContextManager, userContextManager)
}

@@ -111,19 +103,4 @@

if (initConfiguration.storeContextsAcrossPages) {
const beforeInitGlobalContext = globalContextManager.getContext()
globalContextManager = createStoredContextManager(
configuration,
LOGS_STORAGE_KEY,
CustomerDataType.GlobalContext,
customerDataTrackerManager.getOrCreateTracker(CustomerDataType.GlobalContext)
)
globalContextManager.setContext(combine(globalContextManager.getContext(), beforeInitGlobalContext))
const beforeInitUserContext = userContextManager.getContext()
userContextManager = createStoredContextManager(
configuration,
LOGS_STORAGE_KEY,
CustomerDataType.User,
customerDataTrackerManager.getOrCreateTracker(CustomerDataType.User)
)
userContextManager.setContext(combine(userContextManager.getContext(), beforeInitUserContext))
storeContextManager(configuration, globalContextManager, LOGS_STORAGE_KEY, CustomerDataType.GlobalContext)
storeContextManager(configuration, userContextManager, LOGS_STORAGE_KEY, CustomerDataType.User)
}

@@ -134,3 +111,3 @@

configuration,
buildCommonContext
getCommonContext
))

@@ -137,0 +114,0 @@

@@ -16,8 +16,8 @@ import {

import { startLoggerCollection } from '../domain/logger/loggerCollection'
import type { CommonContext } from '../rawLogsEvent.types'
import { startLogsBatch } from '../transport/startLogsBatch'
import { startLogsBridge } from '../transport/startLogsBridge'
import { startInternalContext } from '../domain/internalContext'
import { startInternalContext } from '../domain/contexts/internalContext'
import { startReportError } from '../domain/reportError'
import { startLogsTelemetry } from '../domain/logsTelemetry'
import type { CommonContext } from '../rawLogsEvent.types'

@@ -27,3 +27,3 @@ export function startLogs(

configuration: LogsConfiguration,
buildCommonContext: () => CommonContext
getCommonContext: () => CommonContext
) {

@@ -58,3 +58,3 @@ const lifeCycle = new LifeCycle()

startLogsAssembly(session, configuration, lifeCycle, buildCommonContext, reportError)
startLogsAssembly(session, configuration, lifeCycle, getCommonContext, reportError)

@@ -61,0 +61,0 @@ if (!canUseEventBridge()) {

@@ -9,3 +9,3 @@ import type { EventRateLimiter, RawError } from '@datadog/browser-core'

import type { LogsSessionManager } from './logsSessionManager'
import { getRUMInternalContext } from './rumInternalContext'
import { getRUMInternalContext } from './contexts/rumInternalContext'

@@ -16,3 +16,3 @@ export function startLogsAssembly(

lifeCycle: LifeCycle,
buildCommonContext: () => CommonContext,
getCommonContext: () => CommonContext,
reportError: (error: RawError) => void

@@ -36,3 +36,3 @@ ) {

const commonContext = savedCommonContext || buildCommonContext()
const commonContext = savedCommonContext || getCommonContext()
const log = combine(

@@ -39,0 +39,0 @@ {

@@ -13,3 +13,3 @@ import type { RawError, Observable, PageExitEvent, TelemetryEvent, Context } from '@datadog/browser-core'

import type { LogsConfiguration, LogsInitConfiguration } from './configuration'
import { getRUMInternalContext } from './rumInternalContext'
import { getRUMInternalContext } from './contexts/rumInternalContext'
import type { LogsSessionManager } from './logsSessionManager'

@@ -16,0 +16,0 @@ import { serializeLogsConfiguration } from './configuration'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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