Socket
Socket
Sign inDemoInstall

@datadog/browser-logs

Package Overview
Dependencies
Maintainers
1
Versions
256
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 1.26.2 to 1.26.3

2

bundle/datadog-logs.js

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

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"datadogLogs",(function(){return ft})),n.d(t,"makeLogsGlobal",(function(){return lt}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function o(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function i(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}var a,s=function(e){return Array.isArray(e)},u=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function c(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];null!=i&&(e=l(e,i,f()))}return e}function f(){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}}}function l(e,t,n){if(void 0===t)return e;if(!u(t)&&!s(t))return t;if(!n.hasAlreadyBeenSeen(t)){if(u(t)&&(void 0===e||u(e))){var r=e||{};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=l(r[o],t[o],n));return r}if(s(t)&&(void 0===e||s(e))){(r=e||[]).length=Math.max(r.length,t.length);for(var i=0;i<t.length;i+=1)r[i]=l(r[i],t[i],n);return r}return t}}function d(e){var t=(e.name||"Error")+": "+e.message;return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",o=e.line?":"+e.line:"",i=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+o+i})),t}!function(e){e.AGENT="agent",e.CONSOLE="console",e.NETWORK="network",e.SOURCE="source",e.LOGGER="logger",e.CUSTOM="custom"}(a||(a={}));var p=/[^\u0000-\u007F]/,h=function(){function e(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return e.prototype.send=function(e,t){var n=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()}(this.endpointUrl):this.endpointUrl;if(navigator.sendBeacon&&t<this.bytesLimit&&navigator.sendBeacon(n,e))return;var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(e)},e}();var v=function(){function e(e,t,n,r,o,i){void 0===i&&(i=U),this.request=e,this.maxSize=t,this.bytesLimit=n,this.maxMessageSize=r,this.flushTimeout=o,this.beforeUnloadCallback=i,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0,this.flushOnVisibilityHidden(),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(){if(0!==this.bufferMessageCount){var e=i(this.pushOnlyBuffer,(t=this.upsertBuffer,n=[],Object.keys(t).forEach((function(e){n.push(t[e])})),n));this.request.send(e.join("\n"),this.bufferBytesSize),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var t,n},e.prototype.sizeInBytes=function(e){return p.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,o=n.messageBytesSize;o>=this.maxMessageSize?console.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(o)&&this.flush(),this.push(r,o,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=H(e);return{processedMessage:t,messageBytesSize:this.sizeInBytes(t)}},e.prototype.push=function(e,t,n){this.bufferMessageCount>0&&(this.bufferBytesSize+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesSize+=t,this.bufferMessageCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.sizeInBytes(t);this.bufferBytesSize-=n,this.bufferMessageCount-=1,this.bufferMessageCount>0&&(this.bufferBytesSize-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesSize+e+1>=this.bytesLimit},e.prototype.isFull=function(){return this.bufferMessageCount===this.maxSize||this.bufferBytesSize>=this.bytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout((function(){e.flush(),e.flushPeriodically()}),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(K(window,L.BEFORE_UNLOAD,this.beforeUnloadCallback),K(document,L.VISIBILITY_CHANGE,(function(){"hidden"===document.visibilityState&&e.flush()})),K(window,L.BEFORE_UNLOAD,(function(){return e.flush()})))},e}(),g="?",m=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var b,w=function(){var e,t,n,r,o,i,a=[];function s(e,t,n){var r;for(var o in a)if(y(a,o))try{a[o](e,t,n)}catch(e){r=e}if(r)throw r}function u(e,r,o,i,a){if(t)E.augmentStackTraceWithInitialElement(t,r,o,""+e),f();else if(a)s(E(a),!0,a);else{var u,c={url:r,column:i,line:o},l=e;if("[object String]"==={}.toString.call(e)){var d=l.match(m);d&&(u=d[1],l=d[2])}s({name:u,message:l,stack:[c]},!0)}return!!n&&n.apply(this,arguments)}function c(e){var t=e.reason||"Empty reason";s(E(t),!0,t)}function f(){var n=t,r=e;t=void 0,e=void 0,s(n,!1,r)}function l(n){if(t){if(e===n)return;f()}var r=E(n);throw t=r,e=n,setTimeout((function(){e===n&&f()}),r.incomplete?2e3:0),n}return l.subscribe=function(e){!function(){if(r)return;n=window.onerror,window.onerror=k(u),r=!0}(),function(){if(i)return;o=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=k(c),i=!0}(),a.push(e)},l.unsubscribe=function(e){for(var t=a.length-1;t>=0;t-=1)a[t]===e&&a.splice(t,1);0===a.length&&(r&&(window.onerror=n,r=!1),i&&(window.onunhandledrejection=o,i=!1))},l.traceKitWindowOnError=u,l}(),E=function(){var e=!1;function t(e){if(e.stack){for(var t,n,r,o,i=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,u=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=e.stack.split("\n"),l=[],d=0,p=f.length;d<p;d+=1){if(i.exec(f[d])){var h=(r=i.exec(f[d]))[2]&&0===r[2].indexOf("native");t=r[2]&&0===r[2].indexOf("eval"),n=c.exec(r[2]),t&&n&&(r[2]=n[1],r[3]=n[2],r[4]=n[3]),o={args:h?[r[2]]:[],column:r[4]?+r[4]:void 0,func:r[1]||g,line:r[3]?+r[3]:void 0,url:h?void 0:r[2]}}else if(s.exec(f[d]))o={args:[],column:(r=s.exec(f[d]))[4]?+r[4]:void 0,func:r[1]||g,line:+r[3],url:r[2]};else{if(!a.exec(f[d]))continue;t=(r=a.exec(f[d]))[3]&&r[3].indexOf(" > eval")>-1,n=u.exec(r[3]),t&&n?(r[3]=n[1],r[4]=n[2],r[5]=void 0):0!==d||r[5]||void 0===e.columnNumber||(l[0].column=e.columnNumber+1),o={args:r[2]?r[2].split(","):[],column:r[5]?+r[5]:void 0,func:r[1]||g,line:r[4]?+r[4]:void 0,url:r[3]}}!o.func&&o.line&&(o.func=g),l.push(o)}if(l.length)return{stack:l,message:e.message,name:e.name}}}function n(e,t,n,r){var o={url:t,line:n?+n:void 0};if(o.url&&o.line){e.incomplete=!1;var i=e.stack;if(i.length>0&&i[0].url===o.url){if(i[0].line===o.line)return!1;if(!i[0].line&&i[0].func===o.func)return i[0].line=o.line,i[0].context=o.context,!1}return i.unshift(o),e.partial=!0,!0}return e.incomplete=!0,!1}function r(e,t){for(var o,i,a=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,s=[],u={},c=!1,f=r.caller;f&&!c;f=f.caller)f!==E&&f!==w&&(i={args:[],column:void 0,func:g,line:void 0,url:void 0},o=a.exec(f.toString()),f.name?i.func=f.name:o&&(i.func=o[1]),void 0===i.func&&(i.func=o?o.input.substring(0,o.input.indexOf("{")):void 0),u[""+f]?c=!0:u[""+f]=!0,s.push(i));t&&s.splice(0,t);var l={stack:s,message:e.message,name:e.name};return n(l,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),l}function o(n,o){var i,a=void 0===o?0:+o;try{if(i=function(e){var t=e.stacktrace;if(t){for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,o=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,i=t.split("\n"),a=[],s=0;s<i.length;s+=2){var u=void 0;r.exec(i[s])?u={args:[],column:void 0,func:(n=r.exec(i[s]))[3],line:+n[1],url:n[2]}:o.exec(i[s])&&(u={args:(n=o.exec(i[s]))[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),u&&(!u.func&&u.line&&(u.func=g),u.context=[i[s+1]],a.push(u))}if(a.length)return{stack:a,message:e.message,name:e.name}}}(n))return i}catch(t){if(e)throw t}try{if(i=t(n))return i}catch(t){if(e)throw t}try{if(i=function(e){var t=e.message.split("\n");if(!(t.length<4)){var n,r=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of function script\s*$/i,a=[],s=window&&window.document&&window.document.getElementsByTagName("script"),u=[];for(var c in s)y(s,c)&&!s[c].src&&u.push(s[c]);for(var f=2;f<t.length;f+=2){var l=void 0;if(r.exec(t[f]))l={args:[],column:void 0,func:(n=r.exec(t[f]))[3],line:+n[1],url:n[2]};else if(o.exec(t[f]))l={args:[],column:void 0,func:(n=o.exec(t[f]))[4],line:+n[1],url:n[3]};else if(i.exec(t[f])){n=i.exec(t[f]),l={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+n[1]}}l&&(l.func||(l.func=g),l.context=[t[f+1]],a.push(l))}if(a.length)return{stack:a,message:t[0],name:e.name}}}(n))return i}catch(t){if(e)throw t}try{if(i=r(n,a+1))return i}catch(t){if(e)throw t}return{message:n.message,name:n.name,stack:[]}}return o.augmentStackTraceWithInitialElement=n,o.computeStackTraceFromStackProp=t,o.ofCaller=function(e){var t=1+(void 0===e?0:+e);try{throw new Error}catch(e){return E(e,t+1)}},o}();!function(e){e.info="info",e.error="error"}(b||(b={}));var T,x={maxMessagesPerPage:0,sentMessageCount:0};function O(e){if(e.internalMonitoringEndpoint){var t=function(e){var t,n=r(e.internalMonitoringEndpoint);void 0!==e.replica&&(t=r(e.replica.internalMonitoringEndpoint));function r(t){return new v(new h(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){var r=function(e){return c({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==T?T():{},e)}(e);n.add(r),t&&t.add(r)}}}(e);!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))}(x,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){T=e}}}function S(e,t,n){var r=n.value;n.value=function(){var e=x.batch?k(r):r;return e.apply(this,arguments)}}function k(e){return function(){try{return e.apply(this,arguments)}catch(e){C(e);try{_(e)}catch(e){C(e)}}}}function _(e){M(r(r({},function(e){if(e instanceof Error){var t=E(e);return{error:{kind:t.name,stack:d(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+H(e)}}(e)),{status:b.error}))}function M(e){x.batch&&x.sentMessageCount<x.maxMessagesPerPage&&(x.sentMessageCount+=1,x.batch.add(e))}function R(e){x.debugMode=e}function C(e){x.debugMode&&console.warn("[INTERNAL ERROR]",e)}var L,I,N,A,B=1e3,D=60*B,j=60*D;function P(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):(1e7+"-1000-4000-8000-100000000000").replace(/[018]/g,P)}function U(){}function H(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];z(e)&&(r=[!0,e.toJSON],delete e.toJSON);var o,i,a=[!1,void 0];"object"==typeof e&&z(o=Object.getPrototypeOf(e))&&(a=[!0,o.toJSON],delete o.toJSON);try{i=JSON.stringify(e,void 0,n)}catch(e){i="<error: unable to serialize object>"}finally{r[0]&&(e.toJSON=r[1]),a[0]&&(o.toJSON=a[1])}return i}function z(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function G(){return void 0===A&&(A=performance.timing.navigationStart),A}function F(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}function K(e,t,n,r){return q(e,[t],n,r)}function q(e,t,n,r){var o=void 0===r?{}:r,i=o.once,a=o.capture,s=o.passive,u=k(i?function(e){f(),n(e)}:n),c=s?{capture:a,passive:s}:a;t.forEach((function(t){return e.addEventListener(t,u,c)}));var f=function(){return t.forEach((function(t){return e.removeEventListener(t,u,c)}))};return{stop:f}}!function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.VISIBILITY_CHANGE="visibilitychange",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"}(L||(L={})),function(e){e.DOCUMENT="document",e.XHR="xhr",e.BEACON="beacon",e.FETCH="fetch",e.CSS="css",e.JS="js",e.IMAGE="image",e.FONT="font",e.MEDIA="media",e.OTHER="other"}(I||(I={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(N||(N={}));var $,W=B;function X(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires="+o.toUTCString(),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain="+r.domain:"",u=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+i+";path=/;samesite="+a+s+u}function J(e){return function(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}(document.cookie,e)}function V(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+P();return X(t,"test",B,e),"test"===J(t)}catch(e){return console.error(e),!1}}var Y,Z,Q={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*B,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384},ee={alternate:{logs:"logs",rum:"rum",trace:"trace"},classic:{logs:"browser",rum:"rum",trace:"public-trace"}};function te(e,t){var n={applicationId:e.applicationId,buildMode:t.buildMode,clientToken:e.clientToken,env:e.env,proxyHost:e.proxyHost,sdkVersion:t.sdkVersion,service:e.service,site:e.site||ae[e.datacenter||t.datacenter],version:e.version},o=Array.isArray(e.enableExperimentalFeatures)?e.enableExperimentalFeatures:[],i=e.useAlternateIntakeDomains?"alternate":"classic",a=function(e,t,n){if(t.proxyHost)return["https://"+t.proxyHost+"/v1/input/"];var r=[t.site];t.buildMode===ie.STAGING&&n&&r.push(ae[Z.US]);for(var o=[],i=Object.keys(ee[e]),a=0,s=r;a<s.length;a++)for(var u=s[a],c=0,f=i;c<f.length;c++){var l=f[c];o.push("https://"+oe(e,l,u)+"/v1/input/")}return o}(i,n,void 0!==e.replica),s=r({cookieOptions:ne(e),isEnabled:function(e){return t=e,-1!==o.indexOf(t);var t},logsEndpoint:re(i,"logs",n),proxyHost:e.proxyHost,rumEndpoint:re(i,"rum",n),service:e.service,traceEndpoint:re(i,"trace",n),isIntakeUrl:function(e){return a.some((function(t){return 0===e.indexOf(t)}))}},Q);if(e.internalMonitoringApiKey&&(s.internalMonitoringEndpoint=re(i,"logs",n,"browser-agent-internal-monitoring")),"allowedTracingOrigins"in e&&(s.allowedTracingOrigins=e.allowedTracingOrigins),"sampleRate"in e&&(s.sampleRate=e.sampleRate),"resourceSampleRate"in e&&(s.resourceSampleRate=e.resourceSampleRate),"trackInteractions"in e&&(s.trackInteractions=!!e.trackInteractions),n.buildMode===ie.E2E_TEST&&(s.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",s.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",s.rumEndpoint="<<< E2E RUM ENDPOINT >>>"),n.buildMode===ie.STAGING&&void 0!==e.replica){var u=r(r({},n),{applicationId:e.replica.applicationId,clientToken:e.replica.clientToken,site:ae[Z.US]});s.replica={applicationId:e.replica.applicationId,internalMonitoringEndpoint:re(i,"logs",u,"browser-agent-internal-monitoring"),logsEndpoint:re(i,"logs",u),rumEndpoint:re(i,"rum",u)}}return s}function ne(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===$){for(var e="dd_site_test_"+P(),t=window.location.hostname.split("."),n=t.pop();t.length&&!J(e);)n=t.pop()+"."+n,X(e,"test",B,{domain:n});$=n}return $}()),t}function re(e,t,n,r){var o="sdk_version:"+n.sdkVersion+(n.env?",env:"+n.env:"")+(n.service?",service:"+n.service:"")+(n.version?",version:"+n.version:""),i=oe(e,t,n.site),a=n.proxyHost?n.proxyHost:i,s=n.proxyHost?"ddhost="+i+"&":"",u=""+(n.applicationId?"_dd.application_id="+n.applicationId+"&":"")+s+"ddsource="+(r||"browser")+"&ddtags="+o;return"https://"+a+"/v1/input/"+n.clientToken+"?"+u}function oe(e,t,n){var r=ee[e][t];if("classic"===e)return r+"-http-intake.logs."+n;var o=n.split("."),i=o.pop();return r+".browser-intake-"+(o.join("-")+"."+i)}!function(e){e.US="us",e.EU="eu"}(Z||(Z={}));var ie,ae=((Y={})[Z.EU]="datadoghq.eu",Y[Z.US]="datadoghq.com",Y);function se(){return"file:"!==window.location.protocol||(console.error("Execution is not allowed in the current context."),!1)}function ue(){var e={};return{get:function(){return e},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},set:function(t){e=t}}}!function(e){e.RELEASE="release",e.STAGING="staging",e.E2E_TEST="e2e-test"}(ie||(ie={}));var ce,fe,le=1e4,de=function(){function e(e){void 0===e&&(e=le),this.limit=e,this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>this.limit&&this.buffer.splice(0,1)},e.prototype.drain=function(e){this.buffer.forEach((function(t){return e(t)})),this.buffer.length=0},e}();!function(e){e.debug="debug",e.info="info",e.warn="warn",e.error="error"}(fe||(fe={}));var pe,he=((ce={})[fe.debug]=0,ce[fe.info]=1,ce[fe.warn]=2,ce[fe.error]=3,ce);Object.keys(fe);!function(e){e.http="http",e.console="console",e.silent="silent"}(pe||(pe={}));var ve,ge,me,ye=function(){function e(e,t,n,r){void 0===t&&(t=pe.http),void 0===n&&(n=fe.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=ue(),this.contextManager.set(r)}return e.prototype.log=function(e,t,n){if(void 0===n&&(n=fe.info),he[n]>=he[this.level])switch(this.handlerType){case pe.http:this.sendLog(r({message:e,status:n},c(this.contextManager.get(),t)));break;case pe.console:console.log(n+": "+e,c(this.contextManager.get(),t));break;case pe.silent:}},e.prototype.debug=function(e,t){this.log(e,t,fe.debug)},e.prototype.info=function(e,t){this.log(e,t,fe.info)},e.prototype.warn=function(e,t){this.log(e,t,fe.warn)},e.prototype.error=function(e,t){var n={error:{origin:a.LOGGER}};this.log(e,c(n,t),fe.error)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.setLevel=function(e){this.level=e},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);i>3&&a&&Object.defineProperty(t,n,a)}([S],e.prototype,"log",null),e}();function be(e){return we(e,F(window.location)).href}function we(e,t){if(function(){if(void 0!==ve)return ve;try{var e=new URL("http://test/path");return ve="http://test/path"===e.href}catch(e){ve=!1}return ve}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '"+e+"'");var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}var Ee,Te=[],xe=[];function Oe(){return ge||(!function(){if(!window.fetch)return;me=window.fetch,window.fetch=k((function(e,t){var n=this,r=t&&t.method||"object"==typeof e&&e.method||"GET",i=be("object"==typeof e&&e.url||e),a={init:t,method:r,startTime:performance.now(),url:i},s=function(e){return t=n,r=void 0,s=function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return a.duration=performance.now()-a.startTime,"stack"in e||e instanceof Error?(a.status=0,a.response=d(E(e)),xe.forEach((function(e){return e(a)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];t=void 0,r.label=2;case 2:return r.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return t=r.sent(),[3,5];case 4:return n=r.sent(),t="Unable to retrieve response: "+n,[3,5];case 5:a.response=t,a.responseType=e.type,a.status=e.status,xe.forEach((function(e){return e(a)})),r.label=6;case 6:return[2]}}))},new((i=void 0)||(i=Promise))((function(e,n){function o(e){try{u(s.next(e))}catch(e){n(e)}}function a(e){try{u(s.throw(e))}catch(e){n(e)}}function u(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(o,a)}u((s=s.apply(t,r||[])).next())}));var t,r,i,s};Te.forEach((function(e){return e(a)}));var u=me.call(this,e,a.init);return u.then(k(s),k(s)),u}))}(),ge={beforeSend:function(e){Te.push(e)},onRequestComplete:function(e){xe.push(e)}}),ge}var Se,ke,_e=[],Me=[];function Re(){return Ee||(Se=XMLHttpRequest.prototype.open,ke=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=k((function(e,t){return this._datadog_xhr={method:e,startTime:-1,url:be(t)},Se.apply(this,arguments)})),XMLHttpRequest.prototype.send=k((function(e){var t=this;if(this._datadog_xhr){this._datadog_xhr.startTime=performance.now();var n=this.onreadystatechange;this.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&k(o)(),n&&n.apply(this,arguments)};var r=!1,o=function(){r||(r=!0,t._datadog_xhr.duration=performance.now()-t._datadog_xhr.startTime,t._datadog_xhr.response=t.response,t._datadog_xhr.status=t.status,Me.forEach((function(e){return e(t._datadog_xhr)})))};this.addEventListener("loadend",k(o)),_e.forEach((function(e){return e(t._datadog_xhr,t)}))}return ke.apply(this,arguments)})),Ee={beforeSend:function(e){_e.push(e)},onRequestComplete:function(e){Me.push(e)}}),Ee}var Ce,Le,Ie,Ne=function(){function e(){this.observers=[]}return e.prototype.subscribe=function(e){this.observers.push(e)},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function Ae(e){if(!Ce){var t=new Ne;!function(e,t){function n(n,r){e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({message:je(n)+" error "+r.method+" "+r.url,resource:{method:r.method,statusCode:r.status,url:r.url},source:a.NETWORK,stack:De(r.response,e)||"Failed to load",startTime:r.startTime})}Re().onRequestComplete((function(e){return n(N.XHR,e)})),Oe().onRequestComplete((function(e){return n(N.FETCH,e)}))}(e,t),function(e){Le=console.error,console.error=k((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Le.apply(console,i([t],n)),e.notify({message:i(["console error:",t],n).map(Be).join(" "),source:a.CONSOLE,startTime:performance.now()})}))}(t),function(e){Ie=function(t,n,r){var o=function(e,t,n){return e&&(void 0!==e.message||t instanceof Error)?{message:e.message||"Empty message",stack:d(e),type:e.name}:{message:n+" "+H(t),stack:"No stack, consider using an instance of Error",type:e&&e.name}}(t,r,"Uncaught"),i=o.stack,s=o.message,u=o.type;e.notify({message:s,stack:i,type:u,source:a.SOURCE,startTime:performance.now()})},w.subscribe(Ie)}(t),Ce=function(e,t){var n=0,r=new Ne;return t.subscribe((function(t){n<e.maxErrorsByMinute?(n+=1,r.notify(t)):n===e.maxErrorsByMinute&&(n+=1,r.notify({message:"Reached max number of errors by minute: "+e.maxErrorsByMinute,source:a.AGENT,startTime:performance.now()}))})),setInterval((function(){return n=0}),D),r}(e,t)}return Ce}function Be(e){return"string"==typeof e?e:e instanceof Error?d(E(e)):H(e,0,2)}function De(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function je(e){return N.XHR===e?"XHR":"Fetch"}var Pe="_dd",Ue="_dd_r",He="_dd_l",ze="rum",Ge="logs";var Fe="_dd_s",Ke=15*D,qe=4*j,$e=D;function We(e,t,n){var r=function(e,t){var n,r,o=!1,i=function(){o=!0,window.clearTimeout(n),n=window.setTimeout((function(){o=!1}),W)};return{get:function(){return o?r:(r=J(e),i(),r)},set:function(n,o){X(e,n,o,t),r=n,i()}}}(Fe,e);!function(e){var t=e.get(),n=J(Pe),r=J(Ue),o=J(He);if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i[Ge]=o),r&&/^[012]$/.test(r)&&(i[ze]=r),Ye(i,e)}}(r);var o=new Ne,i=Ve(r).id,a=function(e,t,n){var r,o=!n||void 0===n.leading||n.leading,i=!n||void 0===n.trailing||n.trailing,a=!1,s=!1;return{throttled:function(){var n=this;a?s=!0:(o?e.apply(this):s=!0,a=!0,r=window.setTimeout((function(){i&&s&&e.apply(n),a=!1,s=!1}),t))},cancel:function(){window.clearTimeout(r),a=!1,s=!1}}}((function(){var e=Ve(r),a=n(e[t]),s=a.trackingType,u=a.isTracked;e[t]=s,u&&!e.id&&(e.id=P(),e.created=String(Date.now())),Ye(e,r),u&&i!==e.id&&(i=e.id,o.notify())}),W).throttled;return a(),function(e){var t=q(window,[L.CLICK,L.TOUCH_START,L.KEY_DOWN,L.SCROLL],e,{capture:!0,passive:!0}).stop;Qe.push(t)}(a),function(e){var t=k((function(){"visible"===document.visibilityState&&e()})),n=K(document,L.VISIBILITY_CHANGE,t).stop;Qe.push(n);var r=window.setInterval(t,$e);Qe.push((function(){clearInterval(r)}))}((function(){Ye(Ve(r),r)})),{getId:function(){return Ve(r).id},getTrackingType:function(){return Ve(r)[t]},renewObservable:o}}var Xe=/^([a-z]+)=([a-z0-9-]+)$/,Je="&";function Ve(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf(Je)||Xe.test(e))})(t)&&t.split(Je).forEach((function(e){var t=Xe.exec(e);if(null!==t){var r=t[1],o=t[2];n[r]=o}}));return n}(e);return function(e){return(void 0===e.created||Date.now()-Number(e.created)<qe)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(Ze(e),{})}function Ye(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+Ke);var r=function(e){return Object.keys(e).map((function(t){return[t,e[t]]}))}(e).map((function(e){return e[0]+"="+e[1]})).join(Je);t.set(r,Ke)}else Ze(t)}function Ze(e){e.set("",0)}var Qe=[];var et,tt="logs";function nt(e,t){if(!t){var n=rt(e)===et.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=We(e.cookieOptions,tt,(function(t){return function(e,t){var n=function(e){return e===et.NOT_TRACKED||e===et.TRACKED}(t)?t:rt(e);return{trackingType:n,isTracked:n===et.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===et.TRACKED}}}function rt(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?et.TRACKED:et.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(et||(et={}));var ot={buildMode:"release",datacenter:"us",sdkVersion:"1.26.2"};function it(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var at,st,ut,ct,ft=lt((function(e,t,n){var r=function(e,t){var n=te(e,t);return{configuration:n,internalMonitoring:O(n)}}(e,ot),o=r.configuration,i=r.internalMonitoring;return function(e,t,n,r,o,i){n.setExternalContextProvider((function(){return c({session_id:r.getId()},i(),it())}));var a=function(e,t){var n,r=o(e.logsEndpoint);void 0!==e.replica&&(n=o(e.replica.logsEndpoint));function o(t){return new v(new h(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(o,i){var a=function(e,t,n,r){return c(e,t,n,r)}({service:e.service,session_id:t.getId()},i,it(),o);r.add(a),n&&n.add(a)}}}(e,r);return t.subscribe((function(e){var t;o.error(e.message,c({date:(t=e.startTime,Math.floor(G()+t)),error:{kind:e.type,origin:e.source,stack:e.stack}},e.resource?{http:{method:e.resource.method,status_code:e.resource.statusCode,url:e.resource.url}}:void 0,it(e.startTime)))})),function(e,t){r.isTracked()&&a.add(e,t)}}(o,!1!==e.forwardErrorsToLogs?Ae(o):new Ne,i,nt(o,V(o.cookieOptions)),t,n)}));function lt(e){var t=!1,n=ue(),o={},i=new de,a=function(e,t){i.add([e,t])},s=new ye(u);return function(e){var t=r(r({},e),{onReady:function(e){e()}});return Object.defineProperty(t,"_setDebug",{get:function(){return R},enumerable:!1}),t}({logger:s,init:k((function(r){se()&&function(e){if(t)return e.silentMultipleInit||console.error("DD_LOGS is already initialized."),!1;if(!e||!e.publicApiKey&&!e.clientToken)return console.error("Client Token is not configured, we will not send any data."),!1;if(void 0!==e.sampleRate&&(n=e.sampleRate,!(function(e){return"number"==typeof e}(n)&&n>=0&&n<=100)))return console.error("Sample Rate should be a number between 0 and 100"),!1;var n;return!0}(r)&&(r.publicApiKey&&(r.clientToken=r.publicApiKey,console.warn("Public API Key is deprecated. Please use Client Token instead.")),a=e(r,s,n.get),i.drain((function(e){var t=e[0],n=e[1];return a(t,n)})),t=!0)})),getLoggerGlobalContext:k(n.get),setLoggerGlobalContext:k(n.set),addLoggerGlobalContext:k(n.add),removeLoggerGlobalContext:k(n.remove),createLogger:k((function(e,t){return void 0===t&&(t={}),o[e]=new ye(u,t.handler,t.level,r(r({},t.context),{logger:{name:e}})),o[e]})),getLogger:k((function(e){return o[e]}))});function u(e){a(e,c({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},n.get()))}}at=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}(),ut=ft,ct=at[st="DD_LOGS"],at[st]=ut,ct&&ct.q&&ct.q.forEach((function(e){return e()}))}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"datadogLogs",(function(){return ft})),n.d(t,"makeLogsGlobal",(function(){return lt}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function o(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function i(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}var a,s=function(e){return Array.isArray(e)},u=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function c(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];null!=i&&(e=l(e,i,f()))}return e}function f(){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}}}function l(e,t,n){if(void 0===t)return e;if(!u(t)&&!s(t))return t;if(!n.hasAlreadyBeenSeen(t)){if(u(t)&&(void 0===e||u(e))){var r=e||{};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=l(r[o],t[o],n));return r}if(s(t)&&(void 0===e||s(e))){(r=e||[]).length=Math.max(r.length,t.length);for(var i=0;i<t.length;i+=1)r[i]=l(r[i],t[i],n);return r}return t}}function d(e){var t=(e.name||"Error")+": "+e.message;return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",o=e.line?":"+e.line:"",i=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+o+i})),t}!function(e){e.AGENT="agent",e.CONSOLE="console",e.NETWORK="network",e.SOURCE="source",e.LOGGER="logger",e.CUSTOM="custom"}(a||(a={}));var p=/[^\u0000-\u007F]/,h=function(){function e(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return e.prototype.send=function(e,t){var n=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()}(this.endpointUrl):this.endpointUrl;if(navigator.sendBeacon&&t<this.bytesLimit&&navigator.sendBeacon(n,e))return;var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(e)},e}();var v=function(){function e(e,t,n,r,o,i){void 0===i&&(i=U),this.request=e,this.maxSize=t,this.bytesLimit=n,this.maxMessageSize=r,this.flushTimeout=o,this.beforeUnloadCallback=i,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0,this.flushOnVisibilityHidden(),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(){if(0!==this.bufferMessageCount){var e=i(this.pushOnlyBuffer,(t=this.upsertBuffer,n=[],Object.keys(t).forEach((function(e){n.push(t[e])})),n));this.request.send(e.join("\n"),this.bufferBytesSize),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var t,n},e.prototype.sizeInBytes=function(e){return p.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,o=n.messageBytesSize;o>=this.maxMessageSize?console.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(o)&&this.flush(),this.push(r,o,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=H(e);return{processedMessage:t,messageBytesSize:this.sizeInBytes(t)}},e.prototype.push=function(e,t,n){this.bufferMessageCount>0&&(this.bufferBytesSize+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesSize+=t,this.bufferMessageCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.sizeInBytes(t);this.bufferBytesSize-=n,this.bufferMessageCount-=1,this.bufferMessageCount>0&&(this.bufferBytesSize-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesSize+e+1>=this.bytesLimit},e.prototype.isFull=function(){return this.bufferMessageCount===this.maxSize||this.bufferBytesSize>=this.bytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout((function(){e.flush(),e.flushPeriodically()}),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(K(window,L.BEFORE_UNLOAD,this.beforeUnloadCallback),K(document,L.VISIBILITY_CHANGE,(function(){"hidden"===document.visibilityState&&e.flush()})),K(window,L.BEFORE_UNLOAD,(function(){return e.flush()})))},e}(),g="?",m=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var b,w=function(){var e,t,n,r,o,i,a=[];function s(e,t,n){var r;for(var o in a)if(y(a,o))try{a[o](e,t,n)}catch(e){r=e}if(r)throw r}function u(e,r,o,i,a){if(t)E.augmentStackTraceWithInitialElement(t,r,o,""+e),f();else if(a)s(E(a),!0,a);else{var u,c={url:r,column:i,line:o},l=e;if("[object String]"==={}.toString.call(e)){var d=l.match(m);d&&(u=d[1],l=d[2])}s({name:u,message:l,stack:[c]},!0)}return!!n&&n.apply(this,arguments)}function c(e){var t=e.reason||"Empty reason";s(E(t),!0,t)}function f(){var n=t,r=e;t=void 0,e=void 0,s(n,!1,r)}function l(n){if(t){if(e===n)return;f()}var r=E(n);throw t=r,e=n,setTimeout((function(){e===n&&f()}),r.incomplete?2e3:0),n}return l.subscribe=function(e){!function(){if(r)return;n=window.onerror,window.onerror=k(u),r=!0}(),function(){if(i)return;o=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=k(c),i=!0}(),a.push(e)},l.unsubscribe=function(e){for(var t=a.length-1;t>=0;t-=1)a[t]===e&&a.splice(t,1);0===a.length&&(r&&(window.onerror=n,r=!1),i&&(window.onunhandledrejection=o,i=!1))},l.traceKitWindowOnError=u,l}(),E=function(){var e=!1;function t(e){if(e.stack){for(var t,n,r,o,i=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,u=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=e.stack.split("\n"),l=[],d=0,p=f.length;d<p;d+=1){if(i.exec(f[d])){var h=(r=i.exec(f[d]))[2]&&0===r[2].indexOf("native");t=r[2]&&0===r[2].indexOf("eval"),n=c.exec(r[2]),t&&n&&(r[2]=n[1],r[3]=n[2],r[4]=n[3]),o={args:h?[r[2]]:[],column:r[4]?+r[4]:void 0,func:r[1]||g,line:r[3]?+r[3]:void 0,url:h?void 0:r[2]}}else if(s.exec(f[d]))o={args:[],column:(r=s.exec(f[d]))[4]?+r[4]:void 0,func:r[1]||g,line:+r[3],url:r[2]};else{if(!a.exec(f[d]))continue;t=(r=a.exec(f[d]))[3]&&r[3].indexOf(" > eval")>-1,n=u.exec(r[3]),t&&n?(r[3]=n[1],r[4]=n[2],r[5]=void 0):0!==d||r[5]||void 0===e.columnNumber||(l[0].column=e.columnNumber+1),o={args:r[2]?r[2].split(","):[],column:r[5]?+r[5]:void 0,func:r[1]||g,line:r[4]?+r[4]:void 0,url:r[3]}}!o.func&&o.line&&(o.func=g),l.push(o)}if(l.length)return{stack:l,message:e.message,name:e.name}}}function n(e,t,n,r){var o={url:t,line:n?+n:void 0};if(o.url&&o.line){e.incomplete=!1;var i=e.stack;if(i.length>0&&i[0].url===o.url){if(i[0].line===o.line)return!1;if(!i[0].line&&i[0].func===o.func)return i[0].line=o.line,i[0].context=o.context,!1}return i.unshift(o),e.partial=!0,!0}return e.incomplete=!0,!1}function r(e,t){for(var o,i,a=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,s=[],u={},c=!1,f=r.caller;f&&!c;f=f.caller)f!==E&&f!==w&&(i={args:[],column:void 0,func:g,line:void 0,url:void 0},o=a.exec(f.toString()),f.name?i.func=f.name:o&&(i.func=o[1]),void 0===i.func&&(i.func=o?o.input.substring(0,o.input.indexOf("{")):void 0),u[""+f]?c=!0:u[""+f]=!0,s.push(i));t&&s.splice(0,t);var l={stack:s,message:e.message,name:e.name};return n(l,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),l}function o(n,o){var i,a=void 0===o?0:+o;try{if(i=function(e){var t=e.stacktrace;if(t){for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,o=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,i=t.split("\n"),a=[],s=0;s<i.length;s+=2){var u=void 0;r.exec(i[s])?u={args:[],column:void 0,func:(n=r.exec(i[s]))[3],line:+n[1],url:n[2]}:o.exec(i[s])&&(u={args:(n=o.exec(i[s]))[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),u&&(!u.func&&u.line&&(u.func=g),u.context=[i[s+1]],a.push(u))}if(a.length)return{stack:a,message:e.message,name:e.name}}}(n))return i}catch(t){if(e)throw t}try{if(i=t(n))return i}catch(t){if(e)throw t}try{if(i=function(e){var t=e.message.split("\n");if(!(t.length<4)){var n,r=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of function script\s*$/i,a=[],s=window&&window.document&&window.document.getElementsByTagName("script"),u=[];for(var c in s)y(s,c)&&!s[c].src&&u.push(s[c]);for(var f=2;f<t.length;f+=2){var l=void 0;if(r.exec(t[f]))l={args:[],column:void 0,func:(n=r.exec(t[f]))[3],line:+n[1],url:n[2]};else if(o.exec(t[f]))l={args:[],column:void 0,func:(n=o.exec(t[f]))[4],line:+n[1],url:n[3]};else if(i.exec(t[f])){n=i.exec(t[f]),l={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+n[1]}}l&&(l.func||(l.func=g),l.context=[t[f+1]],a.push(l))}if(a.length)return{stack:a,message:t[0],name:e.name}}}(n))return i}catch(t){if(e)throw t}try{if(i=r(n,a+1))return i}catch(t){if(e)throw t}return{message:n.message,name:n.name,stack:[]}}return o.augmentStackTraceWithInitialElement=n,o.computeStackTraceFromStackProp=t,o.ofCaller=function(e){var t=1+(void 0===e?0:+e);try{throw new Error}catch(e){return E(e,t+1)}},o}();!function(e){e.info="info",e.error="error"}(b||(b={}));var T,x={maxMessagesPerPage:0,sentMessageCount:0};function O(e){if(e.internalMonitoringEndpoint){var t=function(e){var t,n=r(e.internalMonitoringEndpoint);void 0!==e.replica&&(t=r(e.replica.internalMonitoringEndpoint));function r(t){return new v(new h(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){var r=function(e){return c({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==T?T():{},e)}(e);n.add(r),t&&t.add(r)}}}(e);!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))}(x,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){T=e}}}function S(e,t,n){var r=n.value;n.value=function(){var e=x.batch?k(r):r;return e.apply(this,arguments)}}function k(e){return function(){try{return e.apply(this,arguments)}catch(e){C(e);try{_(e)}catch(e){C(e)}}}}function _(e){M(r(r({},function(e){if(e instanceof Error){var t=E(e);return{error:{kind:t.name,stack:d(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+H(e)}}(e)),{status:b.error}))}function M(e){x.batch&&x.sentMessageCount<x.maxMessagesPerPage&&(x.sentMessageCount+=1,x.batch.add(e))}function R(e){x.debugMode=e}function C(e){x.debugMode&&console.warn("[INTERNAL ERROR]",e)}var L,I,N,A,B=1e3,D=60*B,j=60*D;function P(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):(1e7+"-1000-4000-8000-100000000000").replace(/[018]/g,P)}function U(){}function H(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];z(e)&&(r=[!0,e.toJSON],delete e.toJSON);var o,i,a=[!1,void 0];"object"==typeof e&&z(o=Object.getPrototypeOf(e))&&(a=[!0,o.toJSON],delete o.toJSON);try{i=JSON.stringify(e,void 0,n)}catch(e){i="<error: unable to serialize object>"}finally{r[0]&&(e.toJSON=r[1]),a[0]&&(o.toJSON=a[1])}return i}function z(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function G(){return void 0===A&&(A=performance.timing.navigationStart),A}function F(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}function K(e,t,n,r){return q(e,[t],n,r)}function q(e,t,n,r){var o=void 0===r?{}:r,i=o.once,a=o.capture,s=o.passive,u=k(i?function(e){f(),n(e)}:n),c=s?{capture:a,passive:s}:a;t.forEach((function(t){return e.addEventListener(t,u,c)}));var f=function(){return t.forEach((function(t){return e.removeEventListener(t,u,c)}))};return{stop:f}}!function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.VISIBILITY_CHANGE="visibilitychange",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"}(L||(L={})),function(e){e.DOCUMENT="document",e.XHR="xhr",e.BEACON="beacon",e.FETCH="fetch",e.CSS="css",e.JS="js",e.IMAGE="image",e.FONT="font",e.MEDIA="media",e.OTHER="other"}(I||(I={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(N||(N={}));var $,W=B;function X(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires="+o.toUTCString(),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain="+r.domain:"",u=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+i+";path=/;samesite="+a+s+u}function J(e){return function(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}(document.cookie,e)}function V(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+P();return X(t,"test",B,e),"test"===J(t)}catch(e){return console.error(e),!1}}var Y,Z,Q={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*B,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384},ee={alternate:{logs:"logs",rum:"rum",trace:"trace"},classic:{logs:"browser",rum:"rum",trace:"public-trace"}};function te(e,t){var n={applicationId:e.applicationId,buildMode:t.buildMode,clientToken:e.clientToken,env:e.env,proxyHost:e.proxyHost,sdkVersion:t.sdkVersion,service:e.service,site:e.site||ae[e.datacenter||t.datacenter],version:e.version},o=Array.isArray(e.enableExperimentalFeatures)?e.enableExperimentalFeatures:[],i=e.useAlternateIntakeDomains?"alternate":"classic",a=function(e,t,n){if(t.proxyHost)return["https://"+t.proxyHost+"/v1/input/"];var r=[t.site];t.buildMode===ie.STAGING&&n&&r.push(ae[Z.US]);for(var o=[],i=Object.keys(ee[e]),a=0,s=r;a<s.length;a++)for(var u=s[a],c=0,f=i;c<f.length;c++){var l=f[c];o.push("https://"+oe(e,l,u)+"/v1/input/")}return o}(i,n,void 0!==e.replica),s=r({cookieOptions:ne(e),isEnabled:function(e){return t=e,-1!==o.indexOf(t);var t},logsEndpoint:re(i,"logs",n),proxyHost:e.proxyHost,rumEndpoint:re(i,"rum",n),service:e.service,traceEndpoint:re(i,"trace",n),isIntakeUrl:function(e){return a.some((function(t){return 0===e.indexOf(t)}))}},Q);if(e.internalMonitoringApiKey&&(s.internalMonitoringEndpoint=re(i,"logs",n,"browser-agent-internal-monitoring")),"allowedTracingOrigins"in e&&(s.allowedTracingOrigins=e.allowedTracingOrigins),"sampleRate"in e&&(s.sampleRate=e.sampleRate),"resourceSampleRate"in e&&(s.resourceSampleRate=e.resourceSampleRate),"trackInteractions"in e&&(s.trackInteractions=!!e.trackInteractions),n.buildMode===ie.E2E_TEST&&(s.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",s.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",s.rumEndpoint="<<< E2E RUM ENDPOINT >>>"),n.buildMode===ie.STAGING&&void 0!==e.replica){var u=r(r({},n),{applicationId:e.replica.applicationId,clientToken:e.replica.clientToken,site:ae[Z.US]});s.replica={applicationId:e.replica.applicationId,internalMonitoringEndpoint:re(i,"logs",u,"browser-agent-internal-monitoring"),logsEndpoint:re(i,"logs",u),rumEndpoint:re(i,"rum",u)}}return s}function ne(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===$){for(var e="dd_site_test_"+P(),t=window.location.hostname.split("."),n=t.pop();t.length&&!J(e);)n=t.pop()+"."+n,X(e,"test",B,{domain:n});$=n}return $}()),t}function re(e,t,n,r){var o="sdk_version:"+n.sdkVersion+(n.env?",env:"+n.env:"")+(n.service?",service:"+n.service:"")+(n.version?",version:"+n.version:""),i=oe(e,t,n.site),a=n.proxyHost?n.proxyHost:i,s=n.proxyHost?"ddhost="+i+"&":"",u=""+(n.applicationId?"_dd.application_id="+n.applicationId+"&":"")+s+"ddsource="+(r||"browser")+"&ddtags="+o;return"https://"+a+"/v1/input/"+n.clientToken+"?"+u}function oe(e,t,n){var r=ee[e][t];if("classic"===e)return r+"-http-intake.logs."+n;var o=n.split("."),i=o.pop();return r+".browser-intake-"+(o.join("-")+"."+i)}!function(e){e.US="us",e.EU="eu"}(Z||(Z={}));var ie,ae=((Y={})[Z.EU]="datadoghq.eu",Y[Z.US]="datadoghq.com",Y);function se(){return"file:"!==window.location.protocol||(console.error("Execution is not allowed in the current context."),!1)}function ue(){var e={};return{get:function(){return e},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},set:function(t){e=t}}}!function(e){e.RELEASE="release",e.STAGING="staging",e.E2E_TEST="e2e-test"}(ie||(ie={}));var ce,fe,le=1e4,de=function(){function e(e){void 0===e&&(e=le),this.limit=e,this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>this.limit&&this.buffer.splice(0,1)},e.prototype.drain=function(e){this.buffer.forEach((function(t){return e(t)})),this.buffer.length=0},e}();!function(e){e.debug="debug",e.info="info",e.warn="warn",e.error="error"}(fe||(fe={}));var pe,he=((ce={})[fe.debug]=0,ce[fe.info]=1,ce[fe.warn]=2,ce[fe.error]=3,ce);Object.keys(fe);!function(e){e.http="http",e.console="console",e.silent="silent"}(pe||(pe={}));var ve,ge,me,ye=function(){function e(e,t,n,r){void 0===t&&(t=pe.http),void 0===n&&(n=fe.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=ue(),this.contextManager.set(r)}return e.prototype.log=function(e,t,n){if(void 0===n&&(n=fe.info),he[n]>=he[this.level])switch(this.handlerType){case pe.http:this.sendLog(r({message:e,status:n},c(this.contextManager.get(),t)));break;case pe.console:console.log(n+": "+e,c(this.contextManager.get(),t));break;case pe.silent:}},e.prototype.debug=function(e,t){this.log(e,t,fe.debug)},e.prototype.info=function(e,t){this.log(e,t,fe.info)},e.prototype.warn=function(e,t){this.log(e,t,fe.warn)},e.prototype.error=function(e,t){var n={error:{origin:a.LOGGER}};this.log(e,c(n,t),fe.error)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.setLevel=function(e){this.level=e},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);i>3&&a&&Object.defineProperty(t,n,a)}([S],e.prototype,"log",null),e}();function be(e){return we(e,F(window.location)).href}function we(e,t){if(function(){if(void 0!==ve)return ve;try{var e=new URL("http://test/path");return ve="http://test/path"===e.href}catch(e){ve=!1}return ve}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '"+e+"'");var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}var Ee,Te=[],xe=[];function Oe(){return ge||(!function(){if(!window.fetch)return;me=window.fetch,window.fetch=k((function(e,t){var n=this,r=t&&t.method||"object"==typeof e&&e.method||"GET",i=be("object"==typeof e&&e.url||e),a={init:t,method:r,startTime:performance.now(),url:i},s=function(e){return t=n,r=void 0,s=function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return a.duration=performance.now()-a.startTime,"stack"in e||e instanceof Error?(a.status=0,a.response=d(E(e)),xe.forEach((function(e){return e(a)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];t=void 0,r.label=2;case 2:return r.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return t=r.sent(),[3,5];case 4:return n=r.sent(),t="Unable to retrieve response: "+n,[3,5];case 5:a.response=t,a.responseType=e.type,a.status=e.status,xe.forEach((function(e){return e(a)})),r.label=6;case 6:return[2]}}))},new((i=void 0)||(i=Promise))((function(e,n){function o(e){try{u(s.next(e))}catch(e){n(e)}}function a(e){try{u(s.throw(e))}catch(e){n(e)}}function u(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(o,a)}u((s=s.apply(t,r||[])).next())}));var t,r,i,s};Te.forEach((function(e){return e(a)}));var u=me.call(this,e,a.init);return u.then(k(s),k(s)),u}))}(),ge={beforeSend:function(e){Te.push(e)},onRequestComplete:function(e){xe.push(e)}}),ge}var Se,ke,_e=[],Me=[];function Re(){return Ee||(Se=XMLHttpRequest.prototype.open,ke=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=k((function(e,t){return this._datadog_xhr={method:e,startTime:-1,url:be(t)},Se.apply(this,arguments)})),XMLHttpRequest.prototype.send=k((function(e){var t=this;if(this._datadog_xhr){this._datadog_xhr.startTime=performance.now();var n=this.onreadystatechange;this.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&k(o)(),n&&n.apply(this,arguments)};var r=!1,o=function(){r||(r=!0,t._datadog_xhr.duration=performance.now()-t._datadog_xhr.startTime,t._datadog_xhr.response=t.response,t._datadog_xhr.status=t.status,Me.forEach((function(e){return e(t._datadog_xhr)})))};this.addEventListener("loadend",k(o)),_e.forEach((function(e){return e(t._datadog_xhr,t)}))}return ke.apply(this,arguments)})),Ee={beforeSend:function(e){_e.push(e)},onRequestComplete:function(e){Me.push(e)}}),Ee}var Ce,Le,Ie,Ne=function(){function e(){this.observers=[]}return e.prototype.subscribe=function(e){this.observers.push(e)},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function Ae(e){if(!Ce){var t=new Ne;!function(e,t){function n(n,r){e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({message:je(n)+" error "+r.method+" "+r.url,resource:{method:r.method,statusCode:r.status,url:r.url},source:a.NETWORK,stack:De(r.response,e)||"Failed to load",startTime:r.startTime})}Re().onRequestComplete((function(e){return n(N.XHR,e)})),Oe().onRequestComplete((function(e){return n(N.FETCH,e)}))}(e,t),function(e){Le=console.error,console.error=k((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Le.apply(console,i([t],n)),e.notify({message:i(["console error:",t],n).map(Be).join(" "),source:a.CONSOLE,startTime:performance.now()})}))}(t),function(e){Ie=function(t,n,r){var o=function(e,t,n){return e&&(void 0!==e.message||t instanceof Error)?{message:e.message||"Empty message",stack:d(e),type:e.name}:{message:n+" "+H(t),stack:"No stack, consider using an instance of Error",type:e&&e.name}}(t,r,"Uncaught"),i=o.stack,s=o.message,u=o.type;e.notify({message:s,stack:i,type:u,source:a.SOURCE,startTime:performance.now()})},w.subscribe(Ie)}(t),Ce=function(e,t){var n=0,r=new Ne;return t.subscribe((function(t){n<e.maxErrorsByMinute?(n+=1,r.notify(t)):n===e.maxErrorsByMinute&&(n+=1,r.notify({message:"Reached max number of errors by minute: "+e.maxErrorsByMinute,source:a.AGENT,startTime:performance.now()}))})),setInterval((function(){return n=0}),D),r}(e,t)}return Ce}function Be(e){return"string"==typeof e?e:e instanceof Error?d(E(e)):H(e,0,2)}function De(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function je(e){return N.XHR===e?"XHR":"Fetch"}var Pe="_dd",Ue="_dd_r",He="_dd_l",ze="rum",Ge="logs";var Fe="_dd_s",Ke=15*D,qe=4*j,$e=D;function We(e,t,n){var r=function(e,t){var n,r,o=!1,i=function(){o=!0,window.clearTimeout(n),n=window.setTimeout((function(){o=!1}),W)};return{get:function(){return o?r:(r=J(e),i(),r)},set:function(n,o){X(e,n,o,t),r=n,i()}}}(Fe,e);!function(e){var t=e.get(),n=J(Pe),r=J(Ue),o=J(He);if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i[Ge]=o),r&&/^[012]$/.test(r)&&(i[ze]=r),Ye(i,e)}}(r);var o=new Ne,i=Ve(r).id,a=function(e,t,n){var r,o=!n||void 0===n.leading||n.leading,i=!n||void 0===n.trailing||n.trailing,a=!1,s=!1;return{throttled:function(){var n=this;a?s=!0:(o?e.apply(this):s=!0,a=!0,r=window.setTimeout((function(){i&&s&&e.apply(n),a=!1,s=!1}),t))},cancel:function(){window.clearTimeout(r),a=!1,s=!1}}}((function(){var e=Ve(r),a=n(e[t]),s=a.trackingType,u=a.isTracked;e[t]=s,u&&!e.id&&(e.id=P(),e.created=String(Date.now())),Ye(e,r),u&&i!==e.id&&(i=e.id,o.notify())}),W).throttled;return a(),function(e){var t=q(window,[L.CLICK,L.TOUCH_START,L.KEY_DOWN,L.SCROLL],e,{capture:!0,passive:!0}).stop;Qe.push(t)}(a),function(e){var t=k((function(){"visible"===document.visibilityState&&e()})),n=K(document,L.VISIBILITY_CHANGE,t).stop;Qe.push(n);var r=window.setInterval(t,$e);Qe.push((function(){clearInterval(r)}))}((function(){Ye(Ve(r),r)})),{getId:function(){return Ve(r).id},getTrackingType:function(){return Ve(r)[t]},renewObservable:o}}var Xe=/^([a-z]+)=([a-z0-9-]+)$/,Je="&";function Ve(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf(Je)||Xe.test(e))})(t)&&t.split(Je).forEach((function(e){var t=Xe.exec(e);if(null!==t){var r=t[1],o=t[2];n[r]=o}}));return n}(e);return function(e){return(void 0===e.created||Date.now()-Number(e.created)<qe)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(Ze(e),{})}function Ye(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+Ke);var r=function(e){return Object.keys(e).map((function(t){return[t,e[t]]}))}(e).map((function(e){return e[0]+"="+e[1]})).join(Je);t.set(r,Ke)}else Ze(t)}function Ze(e){e.set("",0)}var Qe=[];var et,tt="logs";function nt(e,t){if(!t){var n=rt(e)===et.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=We(e.cookieOptions,tt,(function(t){return function(e,t){var n=function(e){return e===et.NOT_TRACKED||e===et.TRACKED}(t)?t:rt(e);return{trackingType:n,isTracked:n===et.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===et.TRACKED}}}function rt(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?et.TRACKED:et.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(et||(et={}));var ot={buildMode:"release",datacenter:"us",sdkVersion:"1.26.3"};function it(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var at,st,ut,ct,ft=lt((function(e,t,n){var r=function(e,t){var n=te(e,t);return{configuration:n,internalMonitoring:O(n)}}(e,ot),o=r.configuration,i=r.internalMonitoring;return function(e,t,n,r,o,i){n.setExternalContextProvider((function(){return c({session_id:r.getId()},i(),it())}));var a=function(e,t){var n,r=o(e.logsEndpoint);void 0!==e.replica&&(n=o(e.replica.logsEndpoint));function o(t){return new v(new h(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(o,i){var a=function(e,t,n,r){return c(e,t,n,r)}({service:e.service,session_id:t.getId()},i,it(),o);r.add(a),n&&n.add(a)}}}(e,r);return t.subscribe((function(e){var t;o.error(e.message,c({date:(t=e.startTime,Math.floor(G()+t)),error:{kind:e.type,origin:e.source,stack:e.stack}},e.resource?{http:{method:e.resource.method,status_code:e.resource.statusCode,url:e.resource.url}}:void 0,it(e.startTime)))})),function(e,t){r.isTracked()&&a.add(e,t)}}(o,!1!==e.forwardErrorsToLogs?Ae(o):new Ne,i,nt(o,V(o.cookieOptions)),t,n)}));function lt(e){var t=!1,n=ue(),o={},i=new de,a=function(e,t){i.add([e,t])},s=new ye(u);return function(e){var t=r(r({},e),{onReady:function(e){e()}});return Object.defineProperty(t,"_setDebug",{get:function(){return R},enumerable:!1}),t}({logger:s,init:k((function(r){se()&&function(e){if(t)return e.silentMultipleInit||console.error("DD_LOGS is already initialized."),!1;if(!e||!e.publicApiKey&&!e.clientToken)return console.error("Client Token is not configured, we will not send any data."),!1;if(void 0!==e.sampleRate&&(n=e.sampleRate,!(function(e){return"number"==typeof e}(n)&&n>=0&&n<=100)))return console.error("Sample Rate should be a number between 0 and 100"),!1;var n;return!0}(r)&&(r.publicApiKey&&(r.clientToken=r.publicApiKey,console.warn("Public API Key is deprecated. Please use Client Token instead.")),a=e(r,s,n.get),i.drain((function(e){var t=e[0],n=e[1];return a(t,n)})),t=!0)})),getLoggerGlobalContext:k(n.get),setLoggerGlobalContext:k(n.set),addLoggerGlobalContext:k(n.add),removeLoggerGlobalContext:k(n.remove),createLogger:k((function(e,t){return void 0===t&&(t={}),o[e]=new ye(u,t.handler,t.level,r(r({},t.context),{logger:{name:e}})),o[e]})),getLogger:k((function(e){return o[e]}))});function u(e){a(e,c({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},n.get()))}}at=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}(),ut=ft,ct=at[st="DD_LOGS"],at[st]=ut,ct&&ct.q&&ct.q.forEach((function(e){return e()}))}]);

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

datacenter: 'us',
sdkVersion: '1.26.2',
sdkVersion: '1.26.3',
};
//# sourceMappingURL=buildEnv.js.map
export var buildEnv = {
buildMode: 'release',
datacenter: 'us',
sdkVersion: '1.26.2',
sdkVersion: '1.26.3',
};
//# sourceMappingURL=buildEnv.js.map
{
"name": "@datadog/browser-logs",
"version": "1.26.2",
"version": "1.26.3",
"license": "Apache-2.0",

@@ -16,3 +16,3 @@ "main": "cjs/index.js",

"dependencies": {
"@datadog/browser-core": "1.26.2",
"@datadog/browser-core": "1.26.3",
"tslib": "^1.10.0"

@@ -29,3 +29,3 @@ },

},
"gitHead": "973ea9cafa295be60787cdb4a02ee00425554fdd"
"gitHead": "a3ff0b6a2f9ff91c4800cb9c4ecaefb87b80e1af"
}
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