Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
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 3.6.3 to 3.6.4

2

bundle/datadog-logs.js

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

!function(){"use strict";var e=function(){return(e=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 t(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=a.trys,(o=o.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 n(){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 r={log:console.log.bind(console),warn:console.warn.bind(console),error:console.error.bind(console)},o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function i(e){if(s){if(a===e)return;y()}var t=w(e);throw s=t,a=e,setTimeout(K((function(){a===e&&y()})),t.incomplete?2e3:0),e}var a,s,u,c,f,l,d=[];function p(e){!function(){if(c)return;u=window.onerror,window.onerror=K(g),c=!0}(),function(){if(l)return;f=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=K(m),l=!0}(),d.push(e)}function h(e){for(var t=d.length-1;t>=0;t-=1)d[t]===e&&d.splice(t,1);0===d.length&&(c&&(window.onerror=u,c=!1),l&&(window.onunhandledrejection=f,l=!1))}function v(e,t,n){var r;if(d.forEach((function(o){try{o(e,t,n)}catch(e){r=e}})),r)throw r}function g(e,t,n,r,i){if(s)E(s,t,n),y();else if(i)v(w(i),!0,i);else{var a,c={url:t,column:r,line:n},f=e;if("[object String]"==={}.toString.call(e)){var l=o.exec(f);l&&(a=l[1],f=l[2])}v({name:a,message:"string"==typeof f?f:void 0,stack:[c]},!0,e)}return!!u&&u.apply(this,arguments)}function m(e){var t=e.reason||"Empty reason";v(w(t),!0,t)}function y(){var e=s,t=a;s=void 0,a=void 0,v(e,!1,t)}var b="?";function w(e,t){var n,r=void 0===t?0:+t;try{if(n=function(e){var t=k(e,"stacktrace");if(!t)return;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=b),u.context=[i[s+1]],a.push(u))}if(!a.length)return;return{stack:a,message:k(e,"message"),name:k(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=function(e){var t=k(e,"stack");if(!t)return;for(var n,r,o,i,a=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,s=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,c=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,f=/\((\S*)(?::(\d+))(?::(\d+))\)/,l=t.split("\n"),d=[],p=0,h=l.length;p<h;p+=1){if(a.exec(l[p])){var v=(o=a.exec(l[p]))[2]&&0===o[2].indexOf("native");n=o[2]&&0===o[2].indexOf("eval"),r=f.exec(o[2]),n&&r&&(o[2]=r[1],o[3]=r[2],o[4]=r[3]),i={args:v?[o[2]]:[],column:o[4]?+o[4]:void 0,func:o[1]||b,line:o[3]?+o[3]:void 0,url:v?void 0:o[2]}}else if(u.exec(l[p]))i={args:[],column:(o=u.exec(l[p]))[4]?+o[4]:void 0,func:o[1]||b,line:+o[3],url:o[2]};else{if(!s.exec(l[p]))continue;n=(o=s.exec(l[p]))[3]&&o[3].indexOf(" > eval")>-1,r=c.exec(o[3]),n&&r?(o[3]=r[1],o[4]=r[2],o[5]=void 0):0!==p||o[5]||R(e.columnNumber)||(d[0].column=e.columnNumber+1),i={args:o[2]?o[2].split(","):[],column:o[5]?+o[5]:void 0,func:o[1]||b,line:o[4]?+o[4]:void 0,url:o[3]}}!i.func&&i.line&&(i.func=b),d.push(i)}if(!d.length)return;return{stack:d,message:k(e,"message"),name:k(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=function(e){var t=k(e,"message");if(!t)return;var n=t.split("\n");if(n.length<4)return;var r,o=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,a=/^\s*Line (\d+) of function script\s*$/i,s=[],u=window&&window.document&&window.document.getElementsByTagName("script"),c=[];for(var f in u)T(u,f)&&!u[f].src&&c.push(u[f]);for(var l=2;l<n.length;l+=2){var d=void 0;if(o.exec(n[l]))d={args:[],column:void 0,func:(r=o.exec(n[l]))[3],line:+r[1],url:r[2]};else if(i.exec(n[l]))d={args:[],column:void 0,func:(r=i.exec(n[l]))[4],line:+r[1],url:r[3]};else if(a.exec(n[l])){r=a.exec(n[l]),d={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+r[1]}}d&&(d.func||(d.func=b),d.context=[n[l+1]],s.push(d))}if(!s.length)return;return{stack:s,message:n[0],name:k(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=S(e,r+1))return n}catch(e){if(x)throw e}return{message:k(e,"message"),name:k(e,"name"),stack:[]}}var x=!1;function E(e,t,n){var r={url:t,line:n?+n:void 0};if(r.url&&r.line){e.incomplete=!1;var o=e.stack;if(o.length>0&&o[0].url===r.url){if(o[0].line===r.line)return!1;if(!o[0].line&&o[0].func===r.func)return o[0].line=r.line,o[0].context=r.context,!1}return o.unshift(r),e.partial=!0,!0}return e.incomplete=!0,!1}function S(e,t){for(var n,r,o=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,a=[],s={},u=!1,c=S.caller;c&&!u;c=c.caller)c!==w&&c!==i&&(r={args:[],column:void 0,func:b,line:void 0,url:void 0},n=o.exec(c.toString()),c.name?r.func=c.name:n&&(r.func=n[1]),void 0===r.func&&(r.func=n?n.input.substring(0,n.input.indexOf("{")):void 0),s[c.toString()]?u=!0:s[c.toString()]=!0,a.push(r));t&&a.splice(0,t);var f={stack:a,message:k(e,"message"),name:k(e,"name")};return E(f,k(e,"sourceURL")||k(e,"fileName"),k(e,"line")||k(e,"lineNumber")),f}function k(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function R(e){return void 0===e}var M,O="agent",_="console",L="logger",C="network",A="source";function I(e){var t=N(e);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 N(e){return(e.name||"Error")+": "+e.message}function B(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return J((function(){var n=w(t);n.stack=n.stack.slice(2),e=I(n)})),e}!function(e){e.HANDLED="handled",e.UNHANDLED="unhandled"}(M||(M={}));var D=/[^\u0000-\u007F]/,j=function(){function e(e,t,n,r,o,i){void 0===i&&(i=ie),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(e){if(0!==this.bufferMessageCount){var t=n(this.pushOnlyBuffer,(r=this.upsertBuffer,Object.keys(r).map((function(e){return r[e]}))));this.request.send(t.join("\n"),this.bufferBytesSize,e),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var r},e.prototype.sizeInBytes=function(e){return D.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),o=n.processedMessage,i=n.messageBytesSize;i>=this.maxMessageSize?r.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(i)&&this.flush("willReachedBytesLimitWith"),this.push(o,i,t),this.isFull()&&this.flush("isFull"))},e.prototype.process=function(e){var t=ae(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(K((function(){e.flush("flushPeriodically"),e.flushPeriodically()})),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(ce(window,"beforeunload",this.beforeUnloadCallback),ce(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&e.flush("visibilitychange")})),ce(window,"beforeunload",(function(){return e.flush("beforeunload")})))},e}(),P=!1,U=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,n){var r=z(this.endpointUrl,"dd-request-id",oe());this.withBatchTime&&(r=z(r,"batch_time",(new Date).getTime().toString()));var o=!!navigator.sendBeacon&&t<this.bytesLimit;if(o)try{if(navigator.sendBeacon(r,e))return}catch(e){!function(e){q||(q=!0,W(e))}(e)}var i=new XMLHttpRequest;i.addEventListener("loadend",K((function(e){return function(e){var i=null==e?void 0:e.currentTarget;i.status>=200&&i.status<300||P||(P=!0,V("XHR fallback failed",{on_line:navigator.onLine,size:t,url:r,try_beacon:o,flush_reason:n,event:{is_trusted:e.isTrusted,total:e.total,loaded:e.loaded},request:{status:i.status,ready_state:i.readyState,response_text:i.responseText.slice(0,512)}}))}(e)}))),i.open("POST",r,!0),i.send(e)},e}();function z(e,t,n){return e+(ue(e,"?")?"&":"?")+t+"="+n}var H,q=!1;!function(e){e.info="info",e.error="error"}(H||(H={}));var F,G={maxMessagesPerPage:0,sentMessageCount:0};function X(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 j(new U(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}function o(e){return de({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==F?F():{},e)}return{add:function(e){var r=o(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])}))}(G,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){F=e}}}function $(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=G.batch?K(r):r;return n.apply(this,e)}}function K(e){return function(){return J(e,this,arguments)}}function J(e,t,n){try{return e.apply(t,n)}catch(e){Q(e);try{W(e)}catch(e){Q(e)}}}function V(t,n){!function(e,t){G.debugMode&&r.log("[MONITORING MESSAGE]",e,t)}(t,n),Z(e(e({message:t},n),{status:H.info}))}function W(t){Z(e(e({},function(e){if(e instanceof Error){var t=w(e);return{error:{kind:t.name,stack:I(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+ae(e)}}(t)),{status:H.error}))}function Z(e){G.batch&&G.sentMessageCount<G.maxMessagesPerPage&&(G.sentMessageCount+=1,G.batch.add(e))}function Y(e){G.debugMode=e}function Q(e){G.debugMode&&r.error("[INTERNAL ERROR]",e)}var ee,te,ne=1e3,re=6e4;function oe(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,oe)}function ie(){}function ae(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];se(e)&&(r=[!0,e.toJSON],delete e.toJSON);var o,i,a=[!1,void 0];"object"==typeof e&&se(o=Object.getPrototypeOf(e))&&(a=[!0,o.toJSON],delete o.toJSON);try{i=JSON.stringify(e,t,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 se(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function ue(e,t){return-1!==e.indexOf(t)}function ce(e,t,n,r){return fe(e,[t],n,r)}function fe(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 le(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]=le(o[i],t[i],n);return o}var a,s="object"==(null===(a=e)?"null":Array.isArray(a)?"array":typeof a)?e:{};for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(s[u]=le(s[u],t[u],n));return s}}function de(){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=le(e,i))}return e}!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"}(ee||(ee={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(te||(te={}));var pe;function he(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 ve(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)").exec(e);return n?n[1]:void 0}(document.cookie,e)}function ge(e,t){he(e,"",0,t)}function me(e,t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];try{return e.apply(void 0,n)}catch(e){r.error(t,e)}}}var ye={alternate:{logs:"logs",rum:"rum",sessionReplay:"session-replay"},classic:{logs:"browser",rum:"rum",sessionReplay:void 0}},be={logs:"logs",rum:"rum",sessionReplay:"replay"},we=Object.keys(ye.alternate),xe="datadoghq.com",Ee="datadoghq.eu",Se=[xe,Ee],ke=[xe,"us3.datadoghq.com",Ee,"ddog-gov.com"];function Te(e,t){var n=t.sdkVersion,r=e.site,o=void 0===r?xe:r,i=e.clientToken,a=e.env,s=e.proxyHost,u=e.proxyUrl,c=e.service,f=e.version,l=e.intakeApiVersion,d=e.useAlternateIntakeDomains;function p(e,t){var r=function(e){if(function(e){return d||!ue(Se,o)||"sessionReplay"===e}(e)){var t=ye.alternate[e],n=o.split("."),r=n.pop();return t+".browser-intake-"+(n.join("-")+"."+r)}return ye.classic[e]+"-http-intake.logs."+o}(e),l=function(e){return h(e)?"/api/v2/"+be[e]:"/v1/input/"+i}(e),p=function(e,t){var r="ddsource="+(t||"browser")+"&ddtags="+encodeURIComponent("sdk_version:"+n+(a?",env:"+a:"")+(c?",service:"+c:"")+(f?",version:"+f:""));h(e)&&(r+="&dd-api-key="+i+"&dd-evp-origin-version="+encodeURIComponent(n)+"&dd-evp-origin=browser");return r}(e,t),v="https://"+r+l+"?"+p;return u?u+"?ddforward="+encodeURIComponent(v):s?"https://"+s+l+"?ddhost="+r+"&"+p:v}function h(e){return 2===l||!ue(ke,o)||"sessionReplay"===e}return{build:p,buildIntakeUrl:function(e){var t=p(e);return t.slice(0,t.indexOf("?"))}}}var Re,Me={ALLOW:"allow",MASK:"mask",MASK_USER_INPUT:"mask-user-input"},Oe={allowedTracingOrigins:[],maxErrorsPerMinute:3e3,maxActionsPerMinute:3e3,maxInternalMonitoringMessagesPerPage:15,sampleRate:100,replaySampleRate:100,silentMultipleInit:!1,trackInteractions:!1,trackViewsManually:!1,defaultPrivacyLevel:Me.MASK_USER_INPUT,requestErrorResponseLengthLimit:32768,flushTimeout:3e4,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function _e(t,n){var r,o,i=Array.isArray(t.enableExperimentalFeatures)?t.enableExperimentalFeatures:[],a=e(e({beforeSend:t.beforeSend&&me(t.beforeSend,"beforeSend threw an error:"),cookieOptions:Le(t),isEnabled:function(e){return ue(i,e)},service:t.service},function(t,n){var r=Te(t,n),o=we.map((function(e){return r.buildIntakeUrl(e)})),i={isIntakeUrl:function(e){return o.some((function(t){return 0===e.indexOf(t)}))},logsEndpoint:r.build("logs"),rumEndpoint:r.build("rum"),sessionReplayEndpoint:r.build("sessionReplay")};if(t.internalMonitoringApiKey&&(i.internalMonitoringEndpoint=r.build("logs","browser-agent-internal-monitoring")),n.buildMode===Re.E2E_TEST&&(i.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",i.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",i.rumEndpoint="<<< E2E RUM ENDPOINT >>>",i.sessionReplayEndpoint="<<< E2E SESSION REPLAY ENDPOINT >>>"),n.buildMode===Re.STAGING&&void 0!==t.replica){var a=Te(e(e({},t),{site:xe,applicationId:t.replica.applicationId,clientToken:t.replica.clientToken,useAlternateIntakeDomains:!0,intakeApiVersion:2}),n);i.replica={applicationId:t.replica.applicationId,internalMonitoringEndpoint:a.build("logs","browser-agent-internal-monitoring"),logsEndpoint:a.build("logs"),rumEndpoint:a.build("rum")};var s=we.map((function(e){return a.buildIntakeUrl(e)}));s.forEach((function(e){return o.push(e)})),o.push.apply(o,s)}return i}(t,n)),Oe);return"allowedTracingOrigins"in t&&(a.allowedTracingOrigins=t.allowedTracingOrigins),"sampleRate"in t&&(a.sampleRate=t.sampleRate),"replaySampleRate"in t&&(a.replaySampleRate=t.replaySampleRate),"trackInteractions"in t&&(a.trackInteractions=!!t.trackInteractions),"trackViewsManually"in t&&(a.trackViewsManually=!!t.trackViewsManually),"actionNameAttribute"in t&&(a.actionNameAttribute=t.actionNameAttribute),r=Me,o=t.defaultPrivacyLevel,Object.keys(r).some((function(e){return r[e]===o}))&&(a.defaultPrivacyLevel=t.defaultPrivacyLevel),a}function Le(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===pe){for(var e="dd_site_test_"+oe(),t=window.location.hostname.split("."),n=t.pop();t.length&&!ve(e);)n=t.pop()+"."+n,he(e,"test",ne,{domain:n});ge(e,{domain:n}),pe=n}return pe}()),t}function Ce(){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"}(Re||(Re={}));var Ae,Ie,Ne,Be,De,je,Pe=function(){function e(e){void 0===e&&(e=1e4),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(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},e}(),Ue={debug:"debug",error:"error",info:"info",warn:"warn"},ze=((Ae={})[Ue.debug]=0,Ae[Ue.info]=1,Ae[Ue.warn]=2,Ae[Ue.error]=3,Ae),He=(Object.keys(Ue),"console"),qe="http",Fe=function(){function t(e,t,n,r){void 0===t&&(t=qe),void 0===n&&(n=Ue.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=Ce(),this.contextManager.set(r)}return t.prototype.log=function(t,n,o){if(void 0===o&&(o=Ue.info),ze[o]>=ze[this.level]){var i=Array.isArray(this.handlerType)?this.handlerType:[this.handlerType];ue(i,qe)&&this.sendLog(e({message:t,status:o},de(this.contextManager.get(),n))),ue(i,He)&&r.log(o+": "+t,de(this.contextManager.get(),n))}},t.prototype.debug=function(e,t){this.log(e,t,Ue.debug)},t.prototype.info=function(e,t){this.log(e,t,Ue.info)},t.prototype.warn=function(e,t){this.log(e,t,Ue.warn)},t.prototype.error=function(e,t){var n={error:{origin:L}};this.log(e,de(n,t),Ue.error)},t.prototype.setContext=function(e){this.contextManager.set(e)},t.prototype.addContext=function(e,t){this.contextManager.add(e,t)},t.prototype.removeContext=function(e){this.contextManager.remove(e)},t.prototype.setHandler=function(e){this.handlerType=e},t.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)}([$],t.prototype,"log",null),t}(),Ge=function(){function e(e){this.onFirstSubscribe=e,this.observers=[]}return e.prototype.subscribe=function(e){var t=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e),{unsubscribe:function(){t.observers=t.observers.filter((function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function Xe(){return Date.now()}function $e(){return performance.now()}function Ke(){return{relative:$e(),timeStamp:Xe()}}function Je(e,t){return t-e}function Ve(t){(function(){Ne||(Ne=new Ge,Ie=console.error,console.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=B();J((function(){Ie.apply(console,t);var n=e(e({},We(t,r)),{source:_,startClocks:Ke(),handling:M.HANDLED});Ne.notify(n)}))});return Ne})().subscribe((function(e){return t.notify(e)}))}function We(e,t){var r=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n,e))return r}}(e,(function(e){return e instanceof Error}));return{message:n(["console error:"],e).map((function(e){return function(e){if("string"==typeof e)return e;if(e instanceof Error)return N(w(e));return ae(e,void 0,2)}(e)})).join(" "),stack:r?I(w(r)):void 0,handlingStack:t}}function Ze(e){return p(Be=function(t,n,r){var o=function(e,t,n,r){return e&&(void 0!==e.message||t instanceof Error)?{message:e.message||"Empty message",stack:I(e),handlingStack:r,type:e.name}:{message:n+" "+ae(t),stack:"No stack, consider using an instance of Error",handlingStack:r,type:e&&e.name}}(t,r,"Uncaught"),i=o.stack,a=o.message,s=o.type;e.notify({message:a,stack:i,type:s,source:A,startClocks:Ke(),originalError:r,handling:M.UNHANDLED})}),{stop:function(){h(Be)}}}function Ye(e){return Qe(e,function(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}(window.location)).href}function Qe(e,t){if(function(){if(void 0!==De)return De;try{var e=new URL("http://test/path");return De="http://test/path"===e.href}catch(e){De=!1}return De}())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 et,tt,nt,rt,ot,it=[],at=[];function st(e,t){var n=this;return J((function(){n._datadog_xhr={method:e,url:Ye(t)}})),et.apply(this,arguments)}function ut(){var e=this;return J((function(){if(e._datadog_xhr){e._datadog_xhr.startTime=$e(),e._datadog_xhr.startClocks=Ke(),e._datadog_xhr.isAborted=!1;var t=!1,n=e.onreadystatechange,r=function(){this.readyState===XMLHttpRequest.DONE&&o(),n&&n.apply(this,arguments)},o=K((function(){e.removeEventListener("loadend",o),e.onreadystatechange===r&&(e.onreadystatechange=n),t||(t=!0,ft(e))}));e.onreadystatechange=r,e.addEventListener("loadend",o),it.forEach((function(t){return t(e._datadog_xhr,e)}))}})),tt.apply(this,arguments)}function ct(){var e=this;return J((function(){e._datadog_xhr&&(e._datadog_xhr.isAborted=!0)})),nt.apply(this,arguments)}function ft(t){t._datadog_xhr.duration=Je(t._datadog_xhr.startClocks.timeStamp,Xe()),t._datadog_xhr.responseText=t.response,t._datadog_xhr.status=t.status,t._datadog_xhr.xhr=t,at.forEach((function(n){return n(e({},t._datadog_xhr))}))}var lt=[],dt=[];function pt(){return rt||(!function(){if(!window.fetch)return;ot=window.fetch,window.fetch=function(e,t){var n,r=J(ht,null,[e,t]);return r?J(vt,null,[n=ot.call(this,r.input,r.init),r]):n=ot.call(this,e,t),n}}(),rt={beforeSend:function(e){lt.push(e)},onRequestComplete:function(e){dt.push(e)}}),rt}function ht(e,t){var n=t&&t.method||"object"==typeof e&&e.method||"GET",r=Ye("object"==typeof e&&e.url||e),o={init:t,input:e,method:n,startClocks:Ke(),url:r};return lt.forEach((function(e){return e(o)})),o}function vt(e,n){var r=this,o=function(e){return o=r,i=void 0,s=function(){var r,o;return t(this,(function(t){switch(t.label){case 0:return n.duration=Je(n.startClocks.timeStamp,Xe()),"stack"in e||e instanceof Error?(n.status=0,n.responseText=I(w(e)),n.isAborted=e instanceof DOMException&&e.code===DOMException.ABORT_ERR,n.error=e,dt.forEach((function(e){return e(n)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];r=void 0,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return r=t.sent(),[3,5];case 4:return o=t.sent(),r="Unable to retrieve response: "+o,[3,5];case 5:n.response=e,n.responseText=r,n.responseType=e.type,n.status=e.status,n.isAborted=!1,dt.forEach((function(e){return e(n)})),t.label=6;case 6:return[2]}}))},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{u(s.next(e))}catch(e){t(e)}}function r(e){try{u(s.throw(e))}catch(e){t(e)}}function u(t){t.done?e(t.value):new a((function(e){e(t.value)})).then(n,r)}u((s=s.apply(o,i||[])).next())}));var o,i,a,s};e.then(K(o),K(o))}function gt(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:yt(n)+" error "+r.method+" "+r.url,resource:{method:r.method,statusCode:r.status,url:r.url},source:C,stack:mt(r.responseText,e)||"Failed to load",startClocks:r.startClocks})}return(je||(et=XMLHttpRequest.prototype.open,tt=XMLHttpRequest.prototype.send,nt=XMLHttpRequest.prototype.abort,XMLHttpRequest.prototype.open=st,XMLHttpRequest.prototype.send=ut,XMLHttpRequest.prototype.abort=ct,je={beforeSend:function(e){it.push(e)},onRequestComplete:function(e){at.push(e)}}),je).onRequestComplete((function(e){return n(te.XHR,e)})),pt().onRequestComplete((function(e){return n(te.FETCH,e)})),{stop:function(){je&&(je=void 0,it.length=0,at.length=0,XMLHttpRequest.prototype.open=et,XMLHttpRequest.prototype.send=tt,XMLHttpRequest.prototype.abort=nt),rt&&(rt=void 0,lt.splice(0,lt.length),dt.splice(0,dt.length),window.fetch=ot)}}}function mt(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function yt(e){return te.XHR===e?"XHR":"Fetch"}var bt="_dd_s",wt=9e5,xt=144e5;function Et(t,n,r){var o=function(e,t){var n,r,o=!1,i=function(){o=!0,clearTimeout(n),n=setTimeout((function(){o=!1}),1e3)};return{get:function(){return o||(r=ve(e),i()),r},set:function(n,o){he(e,n,o,t),r=n,i()}}}(bt,t);!function(e){var t=e.get(),n=ve("_dd"),r=ve("_dd_r"),o=ve("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),Rt(i,e)}}(o);var i=new Ge,a=Tt(o),s=function(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=setTimeout((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){clearTimeout(o),s=!1,r=void 0}}}(K((function(){var t=Tt(o),s=e({},t),u=r(t[n]),c=u.trackingType,f=u.isTracked;t[n]=c,f&&!t.id&&(t.id=oe(),t.created=String(Date.now())),Rt(t,o),f&&a.id!==t.id&&(a=e({},t),i.notify()),f&&void 0!==a[n]&&a[n]!==c&&(V("session type changed",{debug:{product:n,inMemorySession:a,retrievedSession:s,newTrackingType:c,_dd_s:ve(bt)}}),a=e({},t))})),1e3).throttled;return s(),function(e){var t=fe(window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0}).stop;Ot.push(t)}(s),function(e){var t=K((function(){"visible"===document.visibilityState&&e()})),n=ce(document,"visibilitychange",t).stop;Ot.push(n);var r=setInterval(t,6e4);Ot.push((function(){clearInterval(r)}))}((function(){Rt(Tt(o),o)})),{getId:function(){return Tt(o).id},getTrackingType:function(){return Tt(o)[n]},renewObservable:i}}var St=/^([a-z]+)=([a-z0-9-]+)$/,kt="&";function Tt(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf("&")||St.test(e))})(t)&&t.split(kt).forEach((function(e){var t=St.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)<xt)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(Mt(e),{})}function Rt(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+wt);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(kt);t.set(r,wt)}else Mt(t)}function Mt(e){e.set("",0)}var Ot=[];var _t;function Lt(e,t){if(!t){var n=Ct(e)===_t.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=Et(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return e===_t.NOT_TRACKED||e===_t.TRACKED}(t)?t:Ct(e);return{trackingType:n,isTracked:n===_t.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===_t.TRACKED}}}function Ct(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?_t.TRACKED:_t.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(_t||(_t={}));var At={buildMode:"release",sdkVersion:"3.6.3"};function It(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var Nt,Bt,Dt,jt,Pt=function(t){var n=!1,o=Ce(),i={},a=new Pe,s=function(e,t){a.add((function(){return s(e,t)}))},u=function(){},c=new Fe(d);return f={logger:c,init:K((function(e){(function(e){return n?(e.silentMultipleInit||r.error("DD_LOGS is already initialized."),!1):e&&e.clientToken?!!(void 0===e.sampleRate||(t=e.sampleRate,function(e){return"number"==typeof e}(t)&&t>=0&&t<=100))||(r.error("Sample Rate should be a number between 0 and 100"),!1):(r.error("Client Token is not configured, we will not send any data."),!1);var t})(e)&&(s=t(e,c,o.get),u=function(){return le(void 0,e)},a.drain(),n=!0)})),getLoggerGlobalContext:K(o.get),setLoggerGlobalContext:K(o.set),addLoggerGlobalContext:K(o.add),removeLoggerGlobalContext:K(o.remove),createLogger:K((function(t,n){return void 0===n&&(n={}),i[t]=new Fe(d,n.handler,n.level,e(e({},n.context),{logger:{name:t}})),i[t]})),getLogger:K((function(e){return i[e]})),getInitConfiguration:K((function(){return u()}))},l=e(e({},f),{onReady:function(e){e()}}),Object.defineProperty(l,"_setDebug",{get:function(){return Y},enumerable:!1}),l;var f,l;function d(e){s(e,de({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},o.get()))}}((function(e,t,n){var o=function(e,t){var n=_e(e,t);return{configuration:n,internalMonitoring:X(n)}}(e,At),i=o.configuration,a=o.internalMonitoring,s=new Ge;return!1!==e.forwardErrorsToLogs&&(Ve(s),Ze(s),gt(i,s)),function(e,t,n,r,o,i){n.setExternalContextProvider((function(){return de({session_id:r.getId()},i(),It())}));var a=function(e,t,n){var r=(o=Ue.error,i=t.maxErrorsPerMinute,a=n,s=0,u=!1,{isLimitReached:function(){if(0===s&&setTimeout((function(){s=0}),re),(s+=1)<=i||u)return u=!1,!1;if(s===i+1){u=!0;try{a({message:"Reached max number of "+o+"s by minute: "+i,source:O,startClocks:Ke()})}finally{u=!1}}return!0}});var o,i,a,s,u;return function(n,o){if(e.isTracked()){var i=de({service:t.service,session_id:e.getId()},o,It(),n);if(!(t.beforeSend&&!1===t.beforeSend(i)||i.status===Ue.error&&r.isLimitReached()))return i}}}(r,e,u),s=function(e){var t,n=r(e.logsEndpoint);void 0!==e.replica&&(t=r(e.replica.logsEndpoint));function r(t){return new j(new U(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){n.add(e),t&&t.add(e)}}}(e);function u(e){o.error(e.message,de({date:e.startClocks.timeStamp,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.startClocks.relative)))}return t.subscribe(u),function(e,t){var n=a(e,t);n&&s.add(n)}}(i,s,a,Lt(i,function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+oe(),n="test";he(t,n,ne,e);var o=ve(t)===n;return ge(t,e),o}catch(e){return r.error(e),!1}}(i.cookieOptions)),t,n)}));Nt=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}(),Dt=Pt,jt=Nt[Bt="DD_LOGS"],Nt[Bt]=Dt,jt&&jt.q&&jt.q.forEach((function(e){return me(e,"onReady callback threw an error:")()}))}();
!function(){"use strict";var e=function(){return(e=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 t(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=a.trys,(o=o.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 n(){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 r={log:console.log.bind(console),warn:console.warn.bind(console),error:console.error.bind(console)},o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function i(e){if(s){if(a===e)return;y()}var t=w(e);throw s=t,a=e,setTimeout(K((function(){a===e&&y()})),t.incomplete?2e3:0),e}var a,s,u,c,f,l,d=[];function p(e){!function(){if(c)return;u=window.onerror,window.onerror=K(g),c=!0}(),function(){if(l)return;f=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=K(m),l=!0}(),d.push(e)}function h(e){for(var t=d.length-1;t>=0;t-=1)d[t]===e&&d.splice(t,1);0===d.length&&(c&&(window.onerror=u,c=!1),l&&(window.onunhandledrejection=f,l=!1))}function v(e,t,n){var r;if(d.forEach((function(o){try{o(e,t,n)}catch(e){r=e}})),r)throw r}function g(e,t,n,r,i){if(s)E(s,t,n),y();else if(i)v(w(i),!0,i);else{var a,c={url:t,column:r,line:n},f=e;if("[object String]"==={}.toString.call(e)){var l=o.exec(f);l&&(a=l[1],f=l[2])}v({name:a,message:"string"==typeof f?f:void 0,stack:[c]},!0,e)}return!!u&&u.apply(this,arguments)}function m(e){var t=e.reason||"Empty reason";v(w(t),!0,t)}function y(){var e=s,t=a;s=void 0,a=void 0,v(e,!1,t)}var b="?";function w(e,t){var n,r=void 0===t?0:+t;try{if(n=function(e){var t=k(e,"stacktrace");if(!t)return;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=b),u.context=[i[s+1]],a.push(u))}if(!a.length)return;return{stack:a,message:k(e,"message"),name:k(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=function(e){var t=k(e,"stack");if(!t)return;for(var n,r,o,i,a=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,s=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,c=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,f=/\((\S*)(?::(\d+))(?::(\d+))\)/,l=t.split("\n"),d=[],p=0,h=l.length;p<h;p+=1){if(a.exec(l[p])){var v=(o=a.exec(l[p]))[2]&&0===o[2].indexOf("native");n=o[2]&&0===o[2].indexOf("eval"),r=f.exec(o[2]),n&&r&&(o[2]=r[1],o[3]=r[2],o[4]=r[3]),i={args:v?[o[2]]:[],column:o[4]?+o[4]:void 0,func:o[1]||b,line:o[3]?+o[3]:void 0,url:v?void 0:o[2]}}else if(u.exec(l[p]))i={args:[],column:(o=u.exec(l[p]))[4]?+o[4]:void 0,func:o[1]||b,line:+o[3],url:o[2]};else{if(!s.exec(l[p]))continue;n=(o=s.exec(l[p]))[3]&&o[3].indexOf(" > eval")>-1,r=c.exec(o[3]),n&&r?(o[3]=r[1],o[4]=r[2],o[5]=void 0):0!==p||o[5]||R(e.columnNumber)||(d[0].column=e.columnNumber+1),i={args:o[2]?o[2].split(","):[],column:o[5]?+o[5]:void 0,func:o[1]||b,line:o[4]?+o[4]:void 0,url:o[3]}}!i.func&&i.line&&(i.func=b),d.push(i)}if(!d.length)return;return{stack:d,message:k(e,"message"),name:k(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=function(e){var t=k(e,"message");if(!t)return;var n=t.split("\n");if(n.length<4)return;var r,o=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,a=/^\s*Line (\d+) of function script\s*$/i,s=[],u=window&&window.document&&window.document.getElementsByTagName("script"),c=[];for(var f in u)T(u,f)&&!u[f].src&&c.push(u[f]);for(var l=2;l<n.length;l+=2){var d=void 0;if(o.exec(n[l]))d={args:[],column:void 0,func:(r=o.exec(n[l]))[3],line:+r[1],url:r[2]};else if(i.exec(n[l]))d={args:[],column:void 0,func:(r=i.exec(n[l]))[4],line:+r[1],url:r[3]};else if(a.exec(n[l])){r=a.exec(n[l]),d={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+r[1]}}d&&(d.func||(d.func=b),d.context=[n[l+1]],s.push(d))}if(!s.length)return;return{stack:s,message:n[0],name:k(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=S(e,r+1))return n}catch(e){if(x)throw e}return{message:k(e,"message"),name:k(e,"name"),stack:[]}}var x=!1;function E(e,t,n){var r={url:t,line:n?+n:void 0};if(r.url&&r.line){e.incomplete=!1;var o=e.stack;if(o.length>0&&o[0].url===r.url){if(o[0].line===r.line)return!1;if(!o[0].line&&o[0].func===r.func)return o[0].line=r.line,o[0].context=r.context,!1}return o.unshift(r),e.partial=!0,!0}return e.incomplete=!0,!1}function S(e,t){for(var n,r,o=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,a=[],s={},u=!1,c=S.caller;c&&!u;c=c.caller)c!==w&&c!==i&&(r={args:[],column:void 0,func:b,line:void 0,url:void 0},n=o.exec(c.toString()),c.name?r.func=c.name:n&&(r.func=n[1]),void 0===r.func&&(r.func=n?n.input.substring(0,n.input.indexOf("{")):void 0),s[c.toString()]?u=!0:s[c.toString()]=!0,a.push(r));t&&a.splice(0,t);var f={stack:a,message:k(e,"message"),name:k(e,"name")};return E(f,k(e,"sourceURL")||k(e,"fileName"),k(e,"line")||k(e,"lineNumber")),f}function k(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function R(e){return void 0===e}var M,O="agent",_="console",L="logger",C="network",A="source";function I(e){var t=N(e);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 N(e){return(e.name||"Error")+": "+e.message}function B(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return J((function(){var n=w(t);n.stack=n.stack.slice(2),e=I(n)})),e}!function(e){e.HANDLED="handled",e.UNHANDLED="unhandled"}(M||(M={}));var D=/[^\u0000-\u007F]/,j=function(){function e(e,t,n,r,o,i){void 0===i&&(i=ie),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(e){if(0!==this.bufferMessageCount){var t=n(this.pushOnlyBuffer,(r=this.upsertBuffer,Object.keys(r).map((function(e){return r[e]}))));this.request.send(t.join("\n"),this.bufferBytesSize,e),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var r},e.prototype.sizeInBytes=function(e){return D.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),o=n.processedMessage,i=n.messageBytesSize;i>=this.maxMessageSize?r.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(i)&&this.flush("willReachedBytesLimitWith"),this.push(o,i,t),this.isFull()&&this.flush("isFull"))},e.prototype.process=function(e){var t=ae(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(K((function(){e.flush("flushPeriodically"),e.flushPeriodically()})),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(ce(window,"beforeunload",this.beforeUnloadCallback),ce(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&e.flush("visibilitychange")})),ce(window,"beforeunload",(function(){return e.flush("beforeunload")})))},e}(),P=!1,U=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,n){var r=z(this.endpointUrl,"dd-request-id",oe());this.withBatchTime&&(r=z(r,"batch_time",(new Date).getTime().toString()));var o=!!navigator.sendBeacon&&t<this.bytesLimit;if(o)try{if(navigator.sendBeacon(r,e))return}catch(e){!function(e){q||(q=!0,W(e))}(e)}var i=new XMLHttpRequest;i.addEventListener("loadend",K((function(e){return function(e){var i=null==e?void 0:e.currentTarget;i.status>=200&&i.status<300||P||(P=!0,V("XHR fallback failed",{on_line:navigator.onLine,size:t,url:r,try_beacon:o,flush_reason:n,event:{is_trusted:e.isTrusted,total:e.total,loaded:e.loaded},request:{status:i.status,ready_state:i.readyState,response_text:i.responseText.slice(0,512)}}))}(e)}))),i.open("POST",r,!0),i.send(e)},e}();function z(e,t,n){return e+(ue(e,"?")?"&":"?")+t+"="+n}var H,q=!1;!function(e){e.info="info",e.error="error"}(H||(H={}));var F,G={maxMessagesPerPage:0,sentMessageCount:0};function X(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 j(new U(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}function o(e){return de({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==F?F():{},e)}return{add:function(e){var r=o(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])}))}(G,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){F=e}}}function $(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=G.batch?K(r):r;return n.apply(this,e)}}function K(e){return function(){return J(e,this,arguments)}}function J(e,t,n){try{return e.apply(t,n)}catch(e){Q(e);try{W(e)}catch(e){Q(e)}}}function V(t,n){!function(e,t){G.debugMode&&r.log("[MONITORING MESSAGE]",e,t)}(t,n),Z(e(e({message:t},n),{status:H.info}))}function W(t){Z(e(e({},function(e){if(e instanceof Error){var t=w(e);return{error:{kind:t.name,stack:I(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+ae(e)}}(t)),{status:H.error}))}function Z(e){G.batch&&G.sentMessageCount<G.maxMessagesPerPage&&(G.sentMessageCount+=1,G.batch.add(e))}function Y(e){G.debugMode=e}function Q(e){G.debugMode&&r.error("[INTERNAL ERROR]",e)}var ee,te,ne=1e3,re=6e4;function oe(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,oe)}function ie(){}function ae(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];se(e)&&(r=[!0,e.toJSON],delete e.toJSON);var o,i,a=[!1,void 0];"object"==typeof e&&se(o=Object.getPrototypeOf(e))&&(a=[!0,o.toJSON],delete o.toJSON);try{i=JSON.stringify(e,t,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 se(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function ue(e,t){return-1!==e.indexOf(t)}function ce(e,t,n,r){return fe(e,[t],n,r)}function fe(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 le(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]=le(o[i],t[i],n);return o}var a,s="object"==(null===(a=e)?"null":Array.isArray(a)?"array":typeof a)?e:{};for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(s[u]=le(s[u],t[u],n));return s}}function de(){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=le(e,i))}return e}!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"}(ee||(ee={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(te||(te={}));var pe;function he(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 ve(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)").exec(e);return n?n[1]:void 0}(document.cookie,e)}function ge(e,t){he(e,"",0,t)}function me(e,t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];try{return e.apply(void 0,n)}catch(e){r.error(t,e)}}}var ye={alternate:{logs:"logs",rum:"rum",sessionReplay:"session-replay"},classic:{logs:"browser",rum:"rum",sessionReplay:void 0}},be={logs:"logs",rum:"rum",sessionReplay:"replay"},we=Object.keys(ye.alternate),xe="datadoghq.com",Ee="datadoghq.eu",Se=[xe,Ee],ke=[xe,"us3.datadoghq.com",Ee,"ddog-gov.com"];function Te(e,t){var n=t.sdkVersion,r=e.site,o=void 0===r?xe:r,i=e.clientToken,a=e.env,s=e.proxyHost,u=e.proxyUrl,c=e.service,f=e.version,l=e.intakeApiVersion,d=e.useAlternateIntakeDomains;function p(e,t){var r=function(e){if(function(e){return d||!ue(Se,o)||"sessionReplay"===e}(e)){var t=ye.alternate[e],n=o.split("."),r=n.pop();return t+".browser-intake-"+(n.join("-")+"."+r)}return ye.classic[e]+"-http-intake.logs."+o}(e),l=function(e){return h(e)?"/api/v2/"+be[e]:"/v1/input/"+i}(e),p=function(e,t){var r="ddsource="+(t||"browser")+"&ddtags="+encodeURIComponent("sdk_version:"+n+(a?",env:"+a:"")+(c?",service:"+c:"")+(f?",version:"+f:""));h(e)&&(r+="&dd-api-key="+i+"&dd-evp-origin-version="+encodeURIComponent(n)+"&dd-evp-origin=browser");return r}(e,t),v="https://"+r+l+"?"+p;return u?u+"?ddforward="+encodeURIComponent(v):s?"https://"+s+l+"?ddhost="+r+"&"+p:v}function h(e){return 2===l||!ue(ke,o)||"sessionReplay"===e}return{build:p,buildIntakeUrl:function(e){var t=p(e);return t.slice(0,t.indexOf("?"))}}}var Re,Me={ALLOW:"allow",MASK:"mask",MASK_USER_INPUT:"mask-user-input"},Oe={allowedTracingOrigins:[],maxErrorsPerMinute:3e3,maxActionsPerMinute:3e3,maxInternalMonitoringMessagesPerPage:15,sampleRate:100,replaySampleRate:100,silentMultipleInit:!1,trackInteractions:!1,trackViewsManually:!1,defaultPrivacyLevel:Me.MASK_USER_INPUT,requestErrorResponseLengthLimit:32768,flushTimeout:3e4,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function _e(t,n){var r,o,i=Array.isArray(t.enableExperimentalFeatures)?t.enableExperimentalFeatures:[],a=e(e({beforeSend:t.beforeSend&&me(t.beforeSend,"beforeSend threw an error:"),cookieOptions:Le(t),isEnabled:function(e){return ue(i,e)},service:t.service},function(t,n){var r=Te(t,n),o=we.map((function(e){return r.buildIntakeUrl(e)})),i={isIntakeUrl:function(e){return o.some((function(t){return 0===e.indexOf(t)}))},logsEndpoint:r.build("logs"),rumEndpoint:r.build("rum"),sessionReplayEndpoint:r.build("sessionReplay")};if(t.internalMonitoringApiKey&&(i.internalMonitoringEndpoint=r.build("logs","browser-agent-internal-monitoring")),n.buildMode===Re.E2E_TEST&&(i.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",i.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",i.rumEndpoint="<<< E2E RUM ENDPOINT >>>",i.sessionReplayEndpoint="<<< E2E SESSION REPLAY ENDPOINT >>>"),n.buildMode===Re.STAGING&&void 0!==t.replica){var a=Te(e(e({},t),{site:xe,applicationId:t.replica.applicationId,clientToken:t.replica.clientToken,useAlternateIntakeDomains:!0,intakeApiVersion:2}),n);i.replica={applicationId:t.replica.applicationId,internalMonitoringEndpoint:a.build("logs","browser-agent-internal-monitoring"),logsEndpoint:a.build("logs"),rumEndpoint:a.build("rum")};var s=we.map((function(e){return a.buildIntakeUrl(e)}));s.forEach((function(e){return o.push(e)})),o.push.apply(o,s)}return i}(t,n)),Oe);return"allowedTracingOrigins"in t&&(a.allowedTracingOrigins=t.allowedTracingOrigins),"sampleRate"in t&&(a.sampleRate=t.sampleRate),"replaySampleRate"in t&&(a.replaySampleRate=t.replaySampleRate),"trackInteractions"in t&&(a.trackInteractions=!!t.trackInteractions),"trackViewsManually"in t&&(a.trackViewsManually=!!t.trackViewsManually),"actionNameAttribute"in t&&(a.actionNameAttribute=t.actionNameAttribute),r=Me,o=t.defaultPrivacyLevel,Object.keys(r).some((function(e){return r[e]===o}))&&(a.defaultPrivacyLevel=t.defaultPrivacyLevel),a}function Le(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===pe){for(var e="dd_site_test_"+oe(),t=window.location.hostname.split("."),n=t.pop();t.length&&!ve(e);)n=t.pop()+"."+n,he(e,"test",ne,{domain:n});ge(e,{domain:n}),pe=n}return pe}()),t}function Ce(){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"}(Re||(Re={}));var Ae,Ie,Ne,Be,De,je,Pe=function(){function e(e){void 0===e&&(e=1e4),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(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},e}(),Ue={debug:"debug",error:"error",info:"info",warn:"warn"},ze=((Ae={})[Ue.debug]=0,Ae[Ue.info]=1,Ae[Ue.warn]=2,Ae[Ue.error]=3,Ae),He=(Object.keys(Ue),"console"),qe="http",Fe=function(){function t(e,t,n,r){void 0===t&&(t=qe),void 0===n&&(n=Ue.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=Ce(),this.contextManager.set(r)}return t.prototype.log=function(t,n,o){if(void 0===o&&(o=Ue.info),ze[o]>=ze[this.level]){var i=Array.isArray(this.handlerType)?this.handlerType:[this.handlerType];ue(i,qe)&&this.sendLog(e({message:t,status:o},de(this.contextManager.get(),n))),ue(i,He)&&r.log(o+": "+t,de(this.contextManager.get(),n))}},t.prototype.debug=function(e,t){this.log(e,t,Ue.debug)},t.prototype.info=function(e,t){this.log(e,t,Ue.info)},t.prototype.warn=function(e,t){this.log(e,t,Ue.warn)},t.prototype.error=function(e,t){var n={error:{origin:L}};this.log(e,de(n,t),Ue.error)},t.prototype.setContext=function(e){this.contextManager.set(e)},t.prototype.addContext=function(e,t){this.contextManager.add(e,t)},t.prototype.removeContext=function(e){this.contextManager.remove(e)},t.prototype.setHandler=function(e){this.handlerType=e},t.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)}([$],t.prototype,"log",null),t}(),Ge=function(){function e(e){this.onFirstSubscribe=e,this.observers=[]}return e.prototype.subscribe=function(e){var t=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e),{unsubscribe:function(){t.observers=t.observers.filter((function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function Xe(){return Date.now()}function $e(){return performance.now()}function Ke(){return{relative:$e(),timeStamp:Xe()}}function Je(e,t){return t-e}function Ve(t){(function(){Ne||(Ne=new Ge,Ie=console.error,console.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=B();J((function(){Ie.apply(console,t);var n=e(e({},We(t,r)),{source:_,startClocks:Ke(),handling:M.HANDLED});Ne.notify(n)}))});return Ne})().subscribe((function(e){return t.notify(e)}))}function We(e,t){var r=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n,e))return r}}(e,(function(e){return e instanceof Error}));return{message:n(["console error:"],e).map((function(e){return function(e){if("string"==typeof e)return e;if(e instanceof Error)return N(w(e));return ae(e,void 0,2)}(e)})).join(" "),stack:r?I(w(r)):void 0,handlingStack:t}}function Ze(e){return p(Be=function(t,n,r){var o=function(e,t,n,r){return e&&(void 0!==e.message||t instanceof Error)?{message:e.message||"Empty message",stack:I(e),handlingStack:r,type:e.name}:{message:n+" "+ae(t),stack:"No stack, consider using an instance of Error",handlingStack:r,type:e&&e.name}}(t,r,"Uncaught"),i=o.stack,a=o.message,s=o.type;e.notify({message:a,stack:i,type:s,source:A,startClocks:Ke(),originalError:r,handling:M.UNHANDLED})}),{stop:function(){h(Be)}}}function Ye(e){return Qe(e,function(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}(window.location)).href}function Qe(e,t){if(function(){if(void 0!==De)return De;try{var e=new URL("http://test/path");return De="http://test/path"===e.href}catch(e){De=!1}return De}())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 et,tt,nt,rt,ot,it=[],at=[];function st(e,t){var n=this;return J((function(){n._datadog_xhr={method:e,url:Ye(t)}})),et.apply(this,arguments)}function ut(){var e=this;return J((function(){if(e._datadog_xhr){e._datadog_xhr.startTime=$e(),e._datadog_xhr.startClocks=Ke(),e._datadog_xhr.isAborted=!1;var t=!1,n=e.onreadystatechange,r=function(){this.readyState===XMLHttpRequest.DONE&&o(),n&&n.apply(this,arguments)},o=K((function(){e.removeEventListener("loadend",o),e.onreadystatechange===r&&(e.onreadystatechange=n),t||(t=!0,ft(e))}));e.onreadystatechange=r,e.addEventListener("loadend",o),it.forEach((function(t){return t(e._datadog_xhr,e)}))}})),tt.apply(this,arguments)}function ct(){var e=this;return J((function(){e._datadog_xhr&&(e._datadog_xhr.isAborted=!0)})),nt.apply(this,arguments)}function ft(t){t._datadog_xhr.duration=Je(t._datadog_xhr.startClocks.timeStamp,Xe()),t._datadog_xhr.responseText=t.response,t._datadog_xhr.status=t.status,t._datadog_xhr.xhr=t,at.forEach((function(n){return n(e({},t._datadog_xhr))}))}var lt=[],dt=[];function pt(){return rt||(!function(){if(!window.fetch)return;ot=window.fetch,window.fetch=function(e,t){var n,r=J(ht,null,[e,t]);return r?J(vt,null,[n=ot.call(this,r.input,r.init),r]):n=ot.call(this,e,t),n}}(),rt={beforeSend:function(e){lt.push(e)},onRequestComplete:function(e){dt.push(e)}}),rt}function ht(e,t){var n=t&&t.method||"object"==typeof e&&e.method||"GET",r=Ye("object"==typeof e&&e.url||e),o={init:t,input:e,method:n,startClocks:Ke(),url:r};return lt.forEach((function(e){return e(o)})),o}function vt(e,n){var r=this,o=function(e){return o=r,i=void 0,s=function(){var r,o;return t(this,(function(t){switch(t.label){case 0:return n.duration=Je(n.startClocks.timeStamp,Xe()),"stack"in e||e instanceof Error?(n.status=0,n.responseText=I(w(e)),n.isAborted=e instanceof DOMException&&e.code===DOMException.ABORT_ERR,n.error=e,dt.forEach((function(e){return e(n)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];r=void 0,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return r=t.sent(),[3,5];case 4:return o=t.sent(),r="Unable to retrieve response: "+o,[3,5];case 5:n.response=e,n.responseText=r,n.responseType=e.type,n.status=e.status,n.isAborted=!1,dt.forEach((function(e){return e(n)})),t.label=6;case 6:return[2]}}))},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{u(s.next(e))}catch(e){t(e)}}function r(e){try{u(s.throw(e))}catch(e){t(e)}}function u(t){t.done?e(t.value):new a((function(e){e(t.value)})).then(n,r)}u((s=s.apply(o,i||[])).next())}));var o,i,a,s};e.then(K(o),K(o))}function gt(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:yt(n)+" error "+r.method+" "+r.url,resource:{method:r.method,statusCode:r.status,url:r.url},source:C,stack:mt(r.responseText,e)||"Failed to load",startClocks:r.startClocks})}return(je||(et=XMLHttpRequest.prototype.open,tt=XMLHttpRequest.prototype.send,nt=XMLHttpRequest.prototype.abort,XMLHttpRequest.prototype.open=st,XMLHttpRequest.prototype.send=ut,XMLHttpRequest.prototype.abort=ct,je={beforeSend:function(e){it.push(e)},onRequestComplete:function(e){at.push(e)}}),je).onRequestComplete((function(e){return n(te.XHR,e)})),pt().onRequestComplete((function(e){return n(te.FETCH,e)})),{stop:function(){je&&(je=void 0,it.length=0,at.length=0,XMLHttpRequest.prototype.open=et,XMLHttpRequest.prototype.send=tt,XMLHttpRequest.prototype.abort=nt),rt&&(rt=void 0,lt.splice(0,lt.length),dt.splice(0,dt.length),window.fetch=ot)}}}function mt(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function yt(e){return te.XHR===e?"XHR":"Fetch"}var bt="_dd_s",wt=9e5,xt=144e5;function Et(t,n,r){var o=function(e,t){var n,r,o=!1,i=function(){o=!0,clearTimeout(n),n=setTimeout((function(){o=!1}),1e3)};return{get:function(){return o||(r=ve(e),i()),r},set:function(n,o){he(e,n,o,t),r=n,i()},clearCache:function(){clearTimeout(n),o=!1}}}(bt,t);!function(e){var t=e.get(),n=ve("_dd"),r=ve("_dd_r"),o=ve("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),Rt(i,e)}}(o);var i=new Ge,a=Tt(o),s=function(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=setTimeout((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){clearTimeout(o),s=!1,r=void 0}}}(K((function(){o.clearCache();var t=Tt(o),s=e({},t),u=r(t[n]),c=u.trackingType,f=u.isTracked;t[n]=c,f&&!t.id&&(t.id=oe(),t.created=String(Date.now())),Rt(t,o),f&&a.id!==t.id&&(a=e({},t),i.notify()),f&&void 0!==a[n]&&a[n]!==c&&(V("session type changed",{debug:{product:n,inMemorySession:a,retrievedSession:s,newTrackingType:c,_dd_s:ve(bt)}}),a=e({},t))})),1e3).throttled;return s(),function(e){var t=fe(window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0}).stop;Ot.push(t)}(s),function(e){var t=K((function(){"visible"===document.visibilityState&&e()})),n=ce(document,"visibilitychange",t).stop;Ot.push(n);var r=setInterval(t,6e4);Ot.push((function(){clearInterval(r)}))}((function(){o.clearCache(),Rt(Tt(o),o)})),{getId:function(){return Tt(o).id},getTrackingType:function(){return Tt(o)[n]},renewObservable:i}}var St=/^([a-z]+)=([a-z0-9-]+)$/,kt="&";function Tt(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf("&")||St.test(e))})(t)&&t.split(kt).forEach((function(e){var t=St.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)<xt)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(Mt(e),{})}function Rt(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+wt);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(kt);t.set(r,wt)}else Mt(t)}function Mt(e){e.set("",0)}var Ot=[];var _t;function Lt(e,t){if(!t){var n=Ct(e)===_t.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=Et(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return e===_t.NOT_TRACKED||e===_t.TRACKED}(t)?t:Ct(e);return{trackingType:n,isTracked:n===_t.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===_t.TRACKED}}}function Ct(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?_t.TRACKED:_t.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(_t||(_t={}));var At={buildMode:"release",sdkVersion:"3.6.4"};function It(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var Nt,Bt,Dt,jt,Pt=function(t){var n=!1,o=Ce(),i={},a=new Pe,s=function(e,t){a.add((function(){return s(e,t)}))},u=function(){},c=new Fe(d);return f={logger:c,init:K((function(e){(function(e){return n?(e.silentMultipleInit||r.error("DD_LOGS is already initialized."),!1):e&&e.clientToken?!!(void 0===e.sampleRate||(t=e.sampleRate,function(e){return"number"==typeof e}(t)&&t>=0&&t<=100))||(r.error("Sample Rate should be a number between 0 and 100"),!1):(r.error("Client Token is not configured, we will not send any data."),!1);var t})(e)&&(s=t(e,c,o.get),u=function(){return le(void 0,e)},a.drain(),n=!0)})),getLoggerGlobalContext:K(o.get),setLoggerGlobalContext:K(o.set),addLoggerGlobalContext:K(o.add),removeLoggerGlobalContext:K(o.remove),createLogger:K((function(t,n){return void 0===n&&(n={}),i[t]=new Fe(d,n.handler,n.level,e(e({},n.context),{logger:{name:t}})),i[t]})),getLogger:K((function(e){return i[e]})),getInitConfiguration:K((function(){return u()}))},l=e(e({},f),{onReady:function(e){e()}}),Object.defineProperty(l,"_setDebug",{get:function(){return Y},enumerable:!1}),l;var f,l;function d(e){s(e,de({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},o.get()))}}((function(e,t,n){var o=function(e,t){var n=_e(e,t);return{configuration:n,internalMonitoring:X(n)}}(e,At),i=o.configuration,a=o.internalMonitoring,s=new Ge;return!1!==e.forwardErrorsToLogs&&(Ve(s),Ze(s),gt(i,s)),function(e,t,n,r,o,i){n.setExternalContextProvider((function(){return de({session_id:r.getId()},i(),It())}));var a=function(e,t,n){var r=(o=Ue.error,i=t.maxErrorsPerMinute,a=n,s=0,u=!1,{isLimitReached:function(){if(0===s&&setTimeout((function(){s=0}),re),(s+=1)<=i||u)return u=!1,!1;if(s===i+1){u=!0;try{a({message:"Reached max number of "+o+"s by minute: "+i,source:O,startClocks:Ke()})}finally{u=!1}}return!0}});var o,i,a,s,u;return function(n,o){if(e.isTracked()){var i=de({service:t.service,session_id:e.getId()},o,It(),n);if(!(t.beforeSend&&!1===t.beforeSend(i)||i.status===Ue.error&&r.isLimitReached()))return i}}}(r,e,u),s=function(e){var t,n=r(e.logsEndpoint);void 0!==e.replica&&(t=r(e.replica.logsEndpoint));function r(t){return new j(new U(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){n.add(e),t&&t.add(e)}}}(e);function u(e){o.error(e.message,de({date:e.startClocks.timeStamp,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.startClocks.relative)))}return t.subscribe(u),function(e,t){var n=a(e,t);n&&s.add(n)}}(i,s,a,Lt(i,function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+oe(),n="test";he(t,n,ne,e);var o=ve(t)===n;return ge(t,e),o}catch(e){return r.error(e),!1}}(i.cookieOptions)),t,n)}));Nt=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}(),Dt=Pt,jt=Nt[Bt="DD_LOGS"],Nt[Bt]=Dt,jt&&jt.q&&jt.q.forEach((function(e){return me(e,"onReady callback threw an error:")()}))}();

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

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

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

"dependencies": {
"@datadog/browser-core": "3.6.3",
"@datadog/browser-core": "3.6.4",
"tslib": "^1.10.0"

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

},
"gitHead": "b504d87abff702fb64506df02cc17540c1123e93"
"gitHead": "8d26165153c9e4e3bf9396ea96947697ff9c752e"
}
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