UNPKG

31.6 kBJavaScriptView Raw
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 ct})),n.d(t,"makeLogsGlobal",(function(){return ft}));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,u,c,f=1e3,l=60*f,d=60*l;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 h(){}function v(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];g(e)&&(r=[!0,e.toJSON],delete e.toJSON);var o,i,a=[!1,void 0];"object"==typeof e&&g(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 g(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function m(){return void 0===c&&(c=performance.timing.navigationStart),c}function y(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}!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"}(a||(a={})),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"}(s||(s={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(u||(u={}));var b,w,E=f;function T(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 x(e){return function(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}(document.cookie,e)}function O(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+p();return T(t,"test",f,e),"test"===x(t)}catch(e){return console.error(e),!1}}function S(e){return _(e,y(window.location)).href}function k(e,t){return M(e)===M(t)}function M(e){return y(_(e))}function _(e,t){if(function(){if(void 0!==w)return w;try{var e=new URL("http://test/path");return w="http://test/path"===e.href}catch(e){w=!1}return w}())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 L={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*f,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function R(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===b){for(var e="dd_site_test_"+p(),t=window.location.hostname.split("."),n=t.pop();t.length&&!x(e);)n=t.pop()+"."+n,T(e,"test",f,{domain:n});b=n}return b}()),t}function C(e,t,n){var r="sdk_version:"+t.sdkVersion+(t.env?",env:"+t.env:"")+(t.service?",service:"+t.service:"")+(t.version?",version:"+t.version:""),o=e+"-http-intake.logs."+t.site,i=t.proxyHost?t.proxyHost:o,a=t.proxyHost?"ddhost="+o+"&":"",s=""+(t.applicationId?"_dd.application_id="+t.applicationId+"&":"")+a+"ddsource="+(n||"browser")+"&ddtags="+r;return"https://"+i+"/v1/input/"+t.clientToken+"?"+s}function I(e,t){return-1!==function(e){var t=_(e).pathname;return"/"===t[0]?t:"/"+t}(e).indexOf("/v1/input/")&&(k(e,t.logsEndpoint)||k(e,t.rumEndpoint)||k(e,t.traceEndpoint)||!!t.internalMonitoringEndpoint&&k(e,t.internalMonitoringEndpoint)||!!t.replica&&(k(e,t.replica.logsEndpoint)||k(e,t.replica.rumEndpoint)||k(e,t.replica.internalMonitoringEndpoint)))}var B,N=function(e){return Array.isArray(e)},A=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function D(){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=P(e,i,j()))}return e}function j(){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 P(e,t,n){if(void 0===t)return e;if(!A(t)&&!N(t))return t;if(!n.hasAlreadyBeenSeen(t)){if(A(t)&&(void 0===e||A(e))){var r=e||{};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=P(r[o],t[o],n));return r}if(N(t)&&(void 0===e||N(e))){(r=e||[]).length=Math.max(r.length,t.length);for(var i=0;i<t.length;i+=1)r[i]=P(r[i],t[i],n);return r}return t}}function U(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"}(B||(B={}));var z=/[^\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 G=function(){function e(e,t,n,r,o,i){void 0===i&&(i=h),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 z.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=v(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&&(window.addEventListener(a.BEFORE_UNLOAD,te(this.beforeUnloadCallback)),document.addEventListener(a.VISIBILITY_CHANGE,te((function(){"hidden"===document.visibilityState&&e.flush()}))),window.addEventListener(a.BEFORE_UNLOAD,te((function(){return e.flush()}))))},e}(),F="?",K=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function q(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var $,V=function(){var e,t,n,r,o,i,a=[];function s(e,t,n){var r;for(var o in a)if(q(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)W.augmentStackTraceWithInitialElement(t,r,o,""+e),f();else if(a)s(W(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(K);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(W(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=W(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=te(u),r=!0}(),function(){if(i)return;o=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=te(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}(),W=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]||F,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]||F,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]||F,line:r[4]?+r[4]:void 0,url:r[3]}}!o.func&&o.line&&(o.func=F),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!==W&&f!==V&&(i={args:[],column:void 0,func:F,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=F),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)q(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=F),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 W(e,t+1)}},o}();!function(e){e.info="info",e.error="error"}($||($={}));var X,J,Y,Z={maxMessagesPerPage:0,sentMessageCount:0};function Q(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 G(new H(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){var r=function(e){return D({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==X?X():{},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])}))}(Z,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){X=e}}}function ee(e,t,n){var r=n.value;n.value=function(){var e=Z.batch?te(r):r;return e.apply(this,arguments)}}function te(e){return function(){try{return e.apply(this,arguments)}catch(e){ie(e);try{ne(e)}catch(e){ie(e)}}}}function ne(e){re(r(r({},function(e){if(e instanceof Error){var t=W(e);return{error:{kind:t.name,stack:U(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+v(e)}}(e)),{status:$.error}))}function re(e){Z.batch&&Z.sentMessageCount<Z.maxMessagesPerPage&&(Z.sentMessageCount+=1,Z.batch.add(e))}function oe(e){Z.debugMode=e}function ie(e){Z.debugMode&&console.warn("[INTERNAL ERROR]",e)}!function(e){e.US="us",e.EU="eu"}(Y||(Y={}));var ae,se=((J={})[Y.EU]="datadoghq.eu",J[Y.US]="datadoghq.com",J);function ue(e,t){var n=function(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||se[e.datacenter||t.datacenter],version:e.version},o=Array.isArray(e.enableExperimentalFeatures)?e.enableExperimentalFeatures:[],i=r({cookieOptions:R(e),isEnabled:function(e){return t=e,-1!==o.indexOf(t);var t},logsEndpoint:C("browser",n),proxyHost:e.proxyHost,rumEndpoint:C("rum",n),service:e.service,traceEndpoint:C("public-trace",n)},L);if(e.internalMonitoringApiKey&&(i.internalMonitoringEndpoint=C("browser",n,"browser-agent-internal-monitoring")),"allowedTracingOrigins"in e&&(i.allowedTracingOrigins=e.allowedTracingOrigins),"sampleRate"in e&&(i.sampleRate=e.sampleRate),"resourceSampleRate"in e&&(i.resourceSampleRate=e.resourceSampleRate),"trackInteractions"in e&&(i.trackInteractions=!!e.trackInteractions),n.buildMode===ae.E2E_TEST&&(i.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",i.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",i.rumEndpoint="<<< E2E RUM ENDPOINT >>>"),n.buildMode===ae.STAGING&&void 0!==e.replica){var a=r(r({},n),{applicationId:e.replica.applicationId,clientToken:e.replica.clientToken,site:se[Y.US]});i.replica={applicationId:e.replica.applicationId,internalMonitoringEndpoint:C("browser",a,"browser-agent-internal-monitoring"),logsEndpoint:C("browser",a),rumEndpoint:C("rum",a)}}return i}(e,t);return{configuration:n,internalMonitoring:Q(n)}}function ce(){return"file:"!==window.location.protocol||(console.error("Execution is not allowed in the current context."),!1)}function fe(){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"}(ae||(ae={}));var le,de,pe=1e4,he=function(){function e(e){void 0===e&&(e=pe),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"}(de||(de={}));var ve,ge=((le={})[de.debug]=0,le[de.info]=1,le[de.warn]=2,le[de.error]=3,le);Object.keys(de);!function(e){e.http="http",e.console="console",e.silent="silent"}(ve||(ve={}));var me,ye,be,we=function(){function e(e,t,n,r){void 0===t&&(t=ve.http),void 0===n&&(n=de.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=fe(),this.contextManager.set(r)}return e.prototype.log=function(e,t,n){if(void 0===n&&(n=de.info),ge[n]>=ge[this.level])switch(this.handlerType){case ve.http:this.sendLog(r({message:e,status:n},D(this.contextManager.get(),t)));break;case ve.console:console.log(n+": "+e,D(this.contextManager.get(),t));break;case ve.silent:}},e.prototype.debug=function(e,t){this.log(e,t,de.debug)},e.prototype.info=function(e,t){this.log(e,t,de.info)},e.prototype.warn=function(e,t){this.log(e,t,de.warn)},e.prototype.error=function(e,t){var n={error:{origin:B.LOGGER}};this.log(e,D(n,t),de.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)}([ee],e.prototype,"log",null),e}(),Ee=[],Te=[];function xe(){return me||(!function(){if(!window.fetch)return;ye=window.fetch,window.fetch=te((function(e,t){var n=this,r=t&&t.method||"object"==typeof e&&e.method||"GET",i=S("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=U(W(e)),Te.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,Te.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};Ee.forEach((function(e){return e(a)}));var u=ye.call(this,e,a.init);return u.then(te(s),te(s)),u}))}(),me={beforeSend:function(e){Ee.push(e)},onRequestComplete:function(e){Te.push(e)}}),me}var Oe,Se,ke=[],Me=[];function _e(){return be||(Oe=XMLHttpRequest.prototype.open,Se=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=te((function(e,t){return this._datadog_xhr={method:e,startTime:-1,url:S(t)},Oe.apply(this,arguments)})),XMLHttpRequest.prototype.send=te((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&&te(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",te(o)),ke.forEach((function(e){return e(t._datadog_xhr,t)}))}return Se.apply(this,arguments)})),be={beforeSend:function(e){ke.push(e)},onRequestComplete:function(e){Me.push(e)}}),be}var Le,Re,Ce,Ie=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 Be(e){if(!Le){var t=new Ie;!function(e,t){function n(n,r){I(r.url,e)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({message:De(n)+" error "+r.method+" "+r.url,resource:{method:r.method,statusCode:r.status,url:r.url},source:B.NETWORK,stack:Ae(r.response,e)||"Failed to load",startTime:r.startTime})}_e().onRequestComplete((function(e){return n(u.XHR,e)})),xe().onRequestComplete((function(e){return n(u.FETCH,e)}))}(e,t),function(e){Re=console.error,console.error=te((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Re.apply(console,i([t],n)),e.notify({message:i(["console error:",t],n).map(Ne).join(" "),source:B.CONSOLE,startTime:performance.now()})}))}(t),function(e){Ce=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:U(e),type:e.name}:{message:n+" "+v(t),stack:"No stack, consider using an instance of Error",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:B.SOURCE,startTime:performance.now()})},V.subscribe(Ce)}(t),Le=function(e,t){var n=0,r=new Ie;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:B.AGENT,startTime:performance.now()}))})),setInterval((function(){return n=0}),l),r}(e,t)}return Le}function Ne(e){return"string"==typeof e?e:e instanceof Error?U(W(e)):v(e,0,2)}function Ae(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function De(e){return u.XHR===e?"XHR":"Fetch"}var je="_dd",Pe="_dd_r",Ue="_dd_l",ze="rum",He="logs";var Ge="_dd_s",Fe=15*l,Ke=4*d,qe=l;function $e(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}),E)};return{get:function(){return o?r:(r=x(e),i(),r)},set:function(n,o){T(e,n,o,t),r=n,i()}}}(Ge,e);!function(e){var t=e.get(),n=x(je),r=x(Pe),o=x(Ue);if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i[He]=o),r&&/^[012]$/.test(r)&&(i[ze]=r),Je(i,e)}}(r);var o=new Ie,i=Xe(r).id,s=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=Xe(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())),Je(e,r),u&&i!==e.id&&(i=e.id,o.notify())}),E).throttled;return s(),function(e){var t=te(e),n={capture:!0,passive:!0};[a.CLICK,a.TOUCH_START,a.KEY_DOWN,a.SCROLL].forEach((function(e){document.addEventListener(e,t,n),Ze.push((function(){return document.removeEventListener(e,t,n)}))}))}(s),function(e){var t=te((function(){"visible"===document.visibilityState&&e()})),n=window.setInterval(t,qe);document.addEventListener(a.VISIBILITY_CHANGE,t),Ze.push((function(){clearInterval(n),document.removeEventListener(a.VISIBILITY_CHANGE,t)}))}((function(){Je(Xe(r),r)})),{getId:function(){return Xe(r).id},getTrackingType:function(){return Xe(r)[t]},renewObservable:o}}var Ve=/^([a-z]+)=([a-z0-9-]+)$/,We="&";function Xe(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf(We)||Ve.test(e))})(t)&&t.split(We).forEach((function(e){var t=Ve.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)<Ke)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(Ye(e),{})}function Je(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+Fe);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(We);t.set(r,Fe)}else Ye(t)}function Ye(e){e.set("",0)}var Ze=[];var Qe,et="logs";function tt(e,t){if(!t){var n=nt(e)===Qe.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=$e(e.cookieOptions,et,(function(t){return function(e,t){var n=function(e){return e===Qe.NOT_TRACKED||e===Qe.TRACKED}(t)?t:nt(e);return{trackingType:n,isTracked:n===Qe.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===Qe.TRACKED}}}function nt(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?Qe.TRACKED:Qe.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(Qe||(Qe={}));var rt={buildMode:"release",datacenter:"us",sdkVersion:"1.25.4"};function ot(e){var t=window.DD_RUM,n=t&&t.getInternalContext?t.getInternalContext(e):void 0;if(!n||!n.session)return n;var r=n;return r.session_id=r.session.id,r.application_id=r.application.id,r.action&&(r.user_action={id:r.action.id}),r}var it,at,st,ut,ct=ft((function(e,t,n){var r=ue(e,rt),o=r.configuration,i=r.internalMonitoring;return function(e,t,n,r,o,i){n.setExternalContextProvider((function(){return D({session_id:r.getId()},i(),ot())}));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 G(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 D(e,t,n,r)}({service:e.service,session_id:t.getId()},i,ot(),o);r.add(a),n&&n.add(a)}}}(e,r);return t.subscribe((function(e){var t;o.error(e.message,D({date:(t=e.startTime,Math.floor(m()+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,ot(e.startTime)))})),function(e,t){r.isTracked()&&a.add(e,t)}}(o,!1!==e.forwardErrorsToLogs?Be(o):new Ie,i,tt(o,O(o.cookieOptions)),t,n)}));function ft(e){var t=!1,n=fe(),o={},i=new he,a=function(e,t){i.add([e,t])},s=new we(u);return function(e){var t=r(r({},e),{onReady:function(e){e()}});return Object.defineProperty(t,"_setDebug",{get:function(){return oe},enumerable:!1}),t}({logger:s,init:te((function(r){ce()&&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:te(n.get),setLoggerGlobalContext:te(n.set),addLoggerGlobalContext:te(n.add),removeLoggerGlobalContext:te(n.remove),createLogger:te((function(e,t){return void 0===t&&(t={}),o[e]=new we(u,t.handler,t.level,r(r({},t.context),{logger:{name:e}})),o[e]})),getLogger:te((function(e){return o[e]}))});function u(e){a(e,D({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},n.get()))}}it=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}(),st=ct,ut=it[at="DD_LOGS"],it[at]=st,ut&&ut.q&&ut.q.forEach((function(e){return e()}))}]);
\No newline at end of file