Socket
Socket
Sign inDemoInstall

@elastic/apm-rum

Package Overview
Dependencies
Maintainers
62
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elastic/apm-rum - npm Package Compare versions

Comparing version 4.4.3 to 4.4.4

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [4.4.4](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum@4.4.3...@elastic/apm-rum@4.4.4) (2019-09-17)
**Note:** Version bump only for package @elastic/apm-rum
## [4.4.3](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum@4.4.2...@elastic/apm-rum@4.4.3) (2019-09-03)

@@ -8,0 +16,0 @@

2

dist/bundles/elastic-apm-opentracing.umd.min.js
/*! For license information please see elastic-apm-opentracing.umd.min.js.LICENSE */
!function(n){var r={};function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}i.m=n,i.c=r,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=11)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FORMAT_BINARY="binary",e.FORMAT_TEXT_MAP="text_map",e.FORMAT_HTTP_HEADERS="http_headers",e.REFERENCE_CHILD_OF="child_of",e.REFERENCE_FOLLOWS_FROM="follows_from"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),i=function(){function t(){}return t.prototype.context=function(){return this._context()},t.prototype.tracer=function(){return this._tracer()},t.prototype.setOperationName=function(t){return this._setOperationName(t),this},t.prototype.setBaggageItem=function(t,e){return this._setBaggageItem(t,e),this},t.prototype.getBaggageItem=function(t){return this._getBaggageItem(t)},t.prototype.setTag=function(t,e){return this._addTags(((n={})[t]=e,n)),this;var n},t.prototype.addTags=function(t){return this._addTags(t),this},t.prototype.log=function(t,e){return this._log(t,e),this},t.prototype.logEvent=function(t,e){return this._log({event:t,payload:e})},t.prototype.finish=function(t){this._finish(t)},t.prototype._context=function(){return r.spanContext},t.prototype._tracer=function(){return r.tracer},t.prototype._setOperationName=function(t){},t.prototype._setBaggageItem=function(t,e){},t.prototype._getBaggageItem=function(t){},t.prototype._addTags=function(t){},t.prototype._log=function(t,e){},t.prototype._finish=function(t){},t}();e.Span=i,e.default=i},function(t,e,n){t.exports=function(){"use strict";function c(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},r=0,e=void 0,i=void 0,s=function(t,e){p[r]=t,p[r+1]=e,2===(r+=2)&&(i?i(h):y())},t="undefined"!=typeof window?window:void 0,o=t||{},a=o.MutationObserver||o.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(h,1)}}var p=new Array(1e3);function h(){for(var t=0;t<r;t+=2){var e=p[t],n=p[t+1];e(n),p[t]=void 0,p[t+1]=void 0}r=0}var v,l,g,m,y=void 0;function _(t,e){var n=this,r=new this.constructor(b);void 0===r[w]&&M(r);var i=n._state;if(i){var o=arguments[i-1];s(function(){return R(i,r,o,n._result)})}else k(n,r,t,e);return r}function S(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(b);return O(e,t),e}y=u?function(){return process.nextTick(h)}:a?(l=0,g=new a(h),m=document.createTextNode(""),g.observe(m,{characterData:!0}),function(){m.data=l=++l%2}):f?((v=new MessageChannel).port1.onmessage=h,function(){return v.port2.postMessage(0)}):void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0===(e=t.runOnLoop||t.runOnContext)?d():function(){e(h)}}catch(t){return d()}}():d();var w=Math.random().toString(36).substring(2);function b(){}var T=void 0,E=1,x=2;function C(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}function L(t,e,n){var r,i,o,a;e.constructor===t.constructor&&n===_&&e.constructor.resolve===S?(o=t,(a=e)._state===E?N(o,a._result):a._state===x?A(o,a._result):k(a,void 0,function(t){return O(o,t)},function(t){return A(o,t)})):void 0===n?N(t,e):c(n)?(r=e,i=n,s(function(e){var n=!1,t=C(i,r,function(t){n||(n=!0,r!==t?O(e,t):N(e,t))},function(t){n||(n=!0,A(e,t))},e._label);!n&&t&&(n=!0,A(e,t))},t)):N(t,e)}function O(e,t){if(e===t)A(e,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=t),null===r||"object"!==i&&"function"!==i)N(e,t);else{var n=void 0;try{n=t.then}catch(t){return void A(e,t)}L(e,t,n)}var r,i}function I(t){t._onerror&&t._onerror(t._result),F(t)}function N(t,e){t._state===T&&(t._result=e,t._state=E,0!==t._subscribers.length&&s(F,t))}function A(t,e){t._state===T&&(t._state=x,t._result=e,s(I,t))}function k(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+E]=n,i[o+x]=r,0===o&&t._state&&s(F,t)}function F(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,i=void 0,o=t._result,a=0;a<e.length;a+=3)r=e[a],i=e[a+n],r?R(n,r,i,o):i(o);t._subscribers.length=0}}function R(t,e,n,r){var i=c(n),o=void 0,a=void 0,s=!0;if(i){try{o=n(r)}catch(t){s=!1,a=t}if(e===o)return void A(e,new TypeError("A promises callback cannot return that same promise."))}else o=r;e._state!==T||(i&&s?O(e,o):!1===s?A(e,a):t===E?N(e,o):t===x&&A(e,o))}var j=0;function M(t){t[w]=j++,t._state=void 0,t._result=void 0,t._subscribers=[]}var P=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(b),this.promise[w]||M(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?N(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&N(this.promise,this._result))):A(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===T&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===S){var i=void 0,o=void 0,a=!1;try{i=e.then}catch(t){a=!0,o=t}if(i===_&&e._state!==T)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===H){var s=new n(b);a?A(s,o):L(s,e,i),this._willSettleAt(s,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===T&&(this._remaining--,t===x?A(r,n):this._result[e]=n),0===this._remaining&&N(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;k(t,void 0,function(t){return n._settledAt(E,e,t)},function(t){return n._settledAt(x,e,t)})},t}(),H=function(){function e(t){this[w]=j++,this._result=this._state=void 0,this._subscribers=[],b!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){O(e,t)},function(t){A(e,t)})}catch(t){A(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var n=this.constructor;return c(e)?this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){throw t})}):this.then(e,e)},e}();return H.prototype.then=_,H.all=function(t){return new P(this,t).promise},H.race=function(i){var o=this;return n(i)?new o(function(t,e){for(var n=i.length,r=0;r<n;r++)o.resolve(i[r]).then(t,e)}):new o(function(t,e){return e(new TypeError("You must pass an array to race."))})},H.resolve=S,H.reject=function(t){var e=new this(b);return A(e,t),e},H._setScheduler=function(t){i=t},H._setAsap=function(t){s=t},H._asap=s,H.polyfill=function(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=H},H.Promise=H}()},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8),i=n(5),o=n(1),a=function(){function t(){}return t.prototype.startSpan=function(t,e){if(void 0===e&&(e={}),e.childOf){var n=r.childOf(e.childOf);e.references?e.references.push(n):e.references=[n],delete e.childOf}return this._startSpan(t,e)},t.prototype.inject=function(t,e,n){return t instanceof o.default&&(t=t.context()),this._inject(t,e,n)},t.prototype.extract=function(t,e){return this._extract(t,e)},t.prototype._startSpan=function(t,e){return i.span},t.prototype._inject=function(t,e,n){},t.prototype._extract=function(t,e){return i.spanContext},t}();e.Tracer=a,e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(10),o=n(4);e.tracer=null,e.spanContext=null,e.span=null,e.initialize=function(){e.tracer=new o.default,e.span=new r.default,e.spanContext=new i.default}},function(n,r,i){var o,a,s;!function(t,e){"use strict";a=[i(7)],void 0===(s="function"==typeof(o=function(s){var n=/(^|@)\S+\:\d+/,r=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/;function o(t,e,n){if("function"==typeof Array.prototype.map)return t.map(e,n);for(var r=new Array(t.length),i=0;i<t.length;i++)r[i]=e.call(n,t[i]);return r}function a(t,e,n){if("function"==typeof Array.prototype.filter)return t.filter(e,n);for(var r=[],i=0;i<t.length;i++)e.call(n,t[i])&&r.push(t[i]);return r}return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(r))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){var e=a(t.stack.split("\n"),function(t){return!!t.match(r)},this);return o(e,function(t){-1<t.indexOf("(eval ")&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(e.pop()),r=e.join(" ")||void 0,i=-1<function(t,e){{if("function"==typeof Array.prototype.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}}(["eval","<anonymous>"],n[0])?void 0:n[0];return new s(r,void 0,i,n[1],n[2],t)},this)},parseFFOrSafari:function(t){var e=a(t.stack.split("\n"),function(t){return!t.match(i)},this);return o(e,function(t){if(-1<t.indexOf(" > eval")&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new s(t);var e=t.split("@"),n=this.extractLocation(e.pop()),r=e.join("@")||void 0;return new s(r,void 0,n[0],n[1],n[2],t)},this)},parseOpera:function(t){return!t.stacktrace||-1<t.message.indexOf("\n")&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),r=[],i=2,o=n.length;i<o;i+=2){var a=e.exec(n[i]);a&&r.push(new s(void 0,void 0,a[2],a[1],void 0,n[i]))}return r},parseOpera10:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),r=[],i=0,o=n.length;i<o;i+=2){var a=e.exec(n[i]);a&&r.push(new s(a[3]||void 0,void 0,a[2],a[1],void 0,n[i]))}return r},parseOpera11:function(t){var e=a(t.stack.split("\n"),function(t){return!!t.match(n)&&!t.match(/^Error created at/)},this);return o(e,function(t){var e,n=t.split("@"),r=this.extractLocation(n.pop()),i=n.shift()||"",o=i.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(e=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===e||"[arguments not available]"===e?void 0:e.split(",");return new s(o,a,r[0],r[1],r[2],t)},this)}}})?o.apply(r,a):o)||(n.exports=s)}()},function(n,r,t){var i,o,a;!function(t,e){"use strict";o=[],void 0===(a="function"==typeof(i=function(){function e(t){return!isNaN(parseFloat(t))&&isFinite(t)}function t(t,e,n,r,i,o){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==n&&this.setFileName(n),void 0!==r&&this.setLineNumber(r),void 0!==i&&this.setColumnNumber(i),void 0!==o&&this.setSource(o)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){return(this.getFunctionName()||"{anonymous}")+"("+(this.getArgs()||[]).join(",")+")"+(this.getFileName()?"@"+this.getFileName():"")+(e(this.getLineNumber())?":"+this.getLineNumber():"")+(e(this.getColumnNumber())?":"+this.getColumnNumber():"")}},t})?i.apply(r,o):i)||(n.exports=a)}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=n(9),o=n(1);e.childOf=function(t){return t instanceof o.default&&(t=t.context()),new i.default(r.REFERENCE_CHILD_OF,t)},e.followsFrom=function(t){return t instanceof o.default&&(t=t.context()),new i.default(r.REFERENCE_FOLLOWS_FROM,t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=function(){function t(t,e){this._type=t,this._referencedContext=e instanceof r.default?e.context():e}return t.prototype.type=function(){return this._type},t.prototype.referencedContext=function(){return this._referencedContext},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){};e.SpanContext=r,e.default=r},function(t,e,n){"use strict";n.r(e);var r=n(3),o=n.n(r),i=[].slice;for(var a=[],s=0;s<256;++s)a[s]=(s+256).toString(16).substr(1);function c(t){if(t&&t.traceId&&t.id&&t.parentId){var e=t.sampled?"01":"00",n=t.sampled?t.id:t.parentId;return"00-"+t.traceId+"-"+n+"-"+e}}function h(e,t){var n=!1;return"string"==typeof t?n=e===t:Array.isArray(t)&&t.forEach(function(t){n||(n=h(e,t))}),n}function p(t){var e,n,r,i;return(e=o()(),r=n||0,[(i=a)[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")).substr(0,t)}function u(){return"undefined"!=typeof window&&"function"==typeof Array.prototype.forEach&&"function"==typeof JSON.stringify&&"function"==typeof Function.bind&&window.performance&&"function"==typeof window.performance.now&&"withCredentials"in new window.XMLHttpRequest}function f(t,e,n){if(n&&t){var r=E(t);return e&&(e=String(e)),n[r]=e,n}}var d=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function v(){return window.performance.timing.fetchStart}function l(){return{page:{referer:document.referrer,url:window.location.href}}}function g(t){return t&&t.split("?")[0]}function m(t){return null!==t&&"object"==typeof t}function y(t,e,n){for(var r=0,i=e.length;r<i;++r){var o=e[r];if(m(o)||"function"==typeof o)for(var a=Object.keys(o),s=0,c=a.length;s<c;s++){var u=a[s],f=o[u];n&&m(f)?(m(t[u])||(t[u]=Array.isArray(f)?[]:{}),y(t[u],[f],!1)):t[u]=f}}return t}function _(){if("undefined"!=typeof document){var t=document.currentScript;return t||function(){if("undefined"!=typeof document)for(var t=document.getElementsByTagName("script"),e=0,n=t.length;e<n;e++){var r=t[e];if(0<r.src.indexOf("elastic"))return r}}()}}function S(t){return y(t,i.call(arguments,1),!1)}function w(t){return y(t,i.call(arguments,1),!0)}function b(t){return void 0===t}function T(){}function E(t){return t.replace(/[.*"]/g,"_")}function x(){var n,r,i,t=(n=window.performance.timing,r=n.fetchStart,i={},d.forEach(function(t){var e=n[t];e&&r<=e&&(i[t]=e-r)}),i),e=function(){var t={},e=window.performance;if(e.getEntriesByType){var n=e.getEntriesByType("paint");if(0<n.length)for(var r=e.timing,i=r.fetchStart-r.navigationStart,o=0;o<n.length;o++){var a=n[o],s=0<=i?a.startTime-i:a.startTime;t[a.name]=s}}return t}(),o={timeToFirstByte:t.responseStart,domInteractive:t.domInteractive,domComplete:t.domComplete};return e["first-contentful-paint"]&&(o.firstContentfulPaint=e["first-contentful-paint"]),{navigationTiming:t,agent:o}}var C={fetchInProgress:!1};function L(t){return"__apm_symbol__"+t}function O(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,o,a,s,c=L(e);if(r&&!(i=r[c])){i=r[c]=r[e];var u=r&&Object.getOwnPropertyDescriptor(r,e);if(!(s=u)||!1!==s.writable&&("function"!=typeof s.get||void 0!==s.set)){var f=n(i,c,e);r[e]=function(){return f(this,arguments)},o=r[e],a=i,o[L("OriginalDelegate")]=a}}return i}var I=L("xhrIgnore"),N=L("xhrSync"),A=L("xhrURL"),k=L("xhrMethod"),F="schedule",R="invoke",j="clear",M="addEventListener",P="removeEventListener",H=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],D=3e5,q="page-load",B="Unknown",Q=60,z=1024,U="transaction:end",$="config:change",V="xmlhttprequest",X="fetch",Y="history",J=L("xhrTask"),W=L("xhrListener"),G=L("xhrScheduled");function Z(a){var t=XMLHttpRequest.prototype,s=t[M],c=t[P];if(!s){var e=window.XMLHttpRequestEventTarget;if(e){var n=e.prototype;s=n[M],c=n[P]}}var u="readystatechange";function f(t){t.state=R,t.ignore||a(R,t)}var r=O(t,"open",function(){return function(t,e){return t[k]=e[0],t[A]=e[1],t[N]=!1===e[2],r.apply(t,e)}}),d=O(t,"send",function(){return function(t,e){var n={source:V,state:"",type:"macroTask",ignore:t[I],data:{target:t,method:t[k],sync:t[N],url:t[A],args:e,aborted:!1}},r=function(t){XMLHttpRequest[G]=!1,t.state=F,t.ignore||a(F,t);var e=t.data,n=e.target,r=n[W];s||(s=n[M],c=n[P]),r&&c.call(n,u,r);var i=n[W]=function(){n.readyState===n.DONE&&!e.aborted&&XMLHttpRequest[G]&&t.state===F&&f(t)};s.call(n,u,i),n[J]||(n[J]=t);var o=d.apply(n,e.args);return XMLHttpRequest[G]=!0,o}(n);return t[N]&&f(n),r}}),i=O(t,"abort",function(){return function(t,e){var n,r=t[J];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;(n=r).state=j,a(j,n),n.data.aborted=!0}return i.apply(t,e)}})}var K=n(2);function tt(s){if(window.fetch&&window.Request){var c=window.fetch;window.fetch=function(t,e){var i,n,o=this,r=arguments;if("string"==typeof t)i=new Request(t,e),n=t;else{if(!t)return c.apply(o,r);n=(i=t).url}var a={source:X,state:"",type:"macroTask",data:{target:i,method:i.method,sync:!1,url:n,args:r,aborted:!1}};return new K.Promise(function(e,n){var t,r;C.fetchInProgress=!0,(t=a).state=F,s(F,t);try{r=c.apply(o,[i])}catch(t){return n(t),a.data.error=t,u(a),void(C.fetchInProgress=!1)}r.then(function(t){e(t),K.Promise.resolve().then(function(){a.data.response=t,u(a)})},function(t){n(t),K.Promise.resolve().then(function(){a.data.error=t,u(a)})}),C.fetchInProgress=!1})}}function u(t){t.state=R,s(R,t)}}var et=function(){function t(){this.observers={}}var e=t.prototype;return e.observe=function(e,n){var r=this;if("function"==typeof n)return this.observers[e]||(this.observers[e]=[]),this.observers[e].push(n),function(){var t=r.observers[e].indexOf(n);-1<t&&r.observers[e].splice(t,1)}},e.sendOnly=function(t,e){var n=this.observers[t];n&&n.forEach(function(t){try{t.apply(void 0,e)}catch(t){console.log(t,t.stack)}})},e.send=function(t,e){this.sendOnly(t+":before",e),this.sendOnly(t,e),this.sendOnly(t+":after",e)},t}(),nt=new et,rt=!1;function it(){return rt||(rt=!0,Z(function(t,e){nt.send(V,[t,e])}),tt(function(t,e){nt.send(X,[t,e])}),function(r){if(window.history){var i=history.pushState;"function"==typeof i&&(history.pushState=function(t,e,n){r(R,{source:Y,data:{state:t,title:e,url:n}}),i.apply(this,arguments)})}}(function(t,e){nt.send(Y,[t,e])})),nt}var ot=!1,at=!1;var st=n(6),ct=n.n(st);function ut(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=ct.a.parse(e)}catch(t){}return 0===o.length&&(o=[{fileName:n,lineNumber:r,columnNumber:i}]),o.map(function(t){return t.functionName&&(t.functionName=(e=t.functionName,e=1<(n=(e=(e=(e=1<(n=e.split("/")).length?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>")).split(".")).length?n[n.length-1]:n[0])),t;var e,n}).map(function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,o=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var a,s,c,u,f=(void 0===(a=e)&&(a=""),"<anonymous>"===a&&(a=""),a),d=(s=f,c=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),-1<s.indexOf(c)&&(s=s.replace(c+"/","")),s);return(u=f)&&0===window.location.href.indexOf(u)&&(d="(inline script)"),{abs_path:e,filename:d,function:o,lineno:n,colno:r}})}var ft={service:{name:[z,!0],version:!0,agent:{version:[z,!0]},environment:!0}},dt={"*":!0,headers:{"*":!0}},pt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:dt},response:dt},ht={name:[z,!0],type:[z,!0],id:[z,!0],trace_id:[z,!0],parent_id:[z,!0],transaction_id:[z,!0],subtype:!0,action:!0,context:pt},vt={name:!0,parent_id:!0,type:[z,!0],id:[z,!0],trace_id:[z,!0],span_count:{started:[z,!0]},context:pt},lt={id:[z,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:pt};function gt(t){return null==t||""===t||void 0===t}function mt(t,e,n){var r,i,o,a,s=(r=t[e],i=n[0],o=n[1],void 0===i&&(i=z),void 0===o&&(o=!1),void 0===a&&(a="N/A"),o&&gt(r)&&(r=a),"string"==typeof r?r.substring(0,i):r);gt(s)?delete t[e]:t[e]=s}function yt(r,i,o){void 0===r&&(r={}),void 0===o&&(o=i);for(var a=Object.keys(r),s=[],t=function(t){var e=a[t],n=!0===r[e]?s:r[e];Array.isArray(n)?"*"===e?Object.keys(o).forEach(function(t){return mt(o,t,n)}):mt(o,e,n):yt(n,i,o[e])},e=0;e<a.length;e++)t(e);return i}var _t=function(){function t(t,e,n){this._apmServer=t,this._configService=e,this._transactionService=n}var e=t.prototype;return e.createErrorDataModel=function(t){var e=ut(t),n=e.filter(function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}),r="(inline script)",i=n[n.length-1];i&&i.filename&&(r=i.filename);var o=t.message||t.error&&t.error.message,a=t.error?t.error.name:"";a||o&&-1<o.indexOf(":")&&(a=o.split(":")[0]);var s,c=this._configService.get("context");"object"==typeof t.error&&(s=this._getErrorProperties(t.error));var u=w({},l(),c,s),f={id:p(),culprit:r,exception:{message:o,stacktrace:n,type:a},context:u},d=this._transactionService.getCurrentTransaction();return d&&(f.trace_id=d.traceId,f.parent_id=d.id,f.transaction_id=d.id,f.transaction={type:d.type,sampled:d.sampled}),yt(lt,f)},e.logErrorEvent=function(t,e){if(void 0!==t){var n=this.createErrorDataModel(t);if(void 0!==n.exception.message)return e?this._apmServer.sendErrors([n]):this._apmServer.addError(n)}},e.registerGlobalEventListener=function(){var e=this;window.addEventListener("error",function(t){return e.logErrorEvent(t)})},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},e._getErrorProperties=function(n){var r={};return Object.keys(n).forEach(function(t){if("stack"!==t){var e=n[t];if(null!==e){switch(typeof e){case"function":return;case"object":if("function"!=typeof e.toISOString)return;e=e.toISOString()}r[t]=e}}}),r},t}(),St=function(r){r.registerServiceCreator("ErrorLogging",function(){var t=r.getService("ApmServer"),e=r.getService("ConfigService"),n=r.getService("TransactionService");return new _t(t,e,n)})},wt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],bt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Tt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,o=n.slashes,a=!r&&!o,s=this.getLocation(),c=wt.slice();i=i.replace("\\","/");for(var u=0;u<c.length;u++){var f=c[u],d=f[0],p=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var h=f[2];if(h){var v=i.lastIndexOf(d);e=Math.max(e,v),this[p]=i.slice(0,e),i=i.slice(e+h)}else this[p]=i.slice(e),i=i.slice(0,e)}}else this[p]=i;this[p]=this[p]||a&&f[3]&&s[p]||"",f[3]&&(this[p]=this[p].toLowerCase())}this.relative=a,this.protocol=r||s.protocol||"",this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null",this.href=this.toString()}var e=t.prototype;return e.toString=function(){var t=this.protocol;if(t+="//",this.auth){var e="[REDACTED]",n=this.auth.split(":");t+=(n[0]?e:"")+(n[1]?":"+e:"")+"@"}return t+=this.host,t+=this.path,t+=this.query,t+=this.hash},e.getLocation=function(){var t={};return"undefined"!=typeof window&&(t=window),t.location},e.extractProtocol=function(t){var e=bt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Et=function(){function t(t,e,n,r){this._apmServer=t,this._configService=e,this._logginService=n,this._transactionService=r}var e=t.prototype;return e.init=function(t){var n=this;void 0===t&&(t={}),this._configService.events.observe(U+":after",function(t){var e=n.createTransactionPayload(t);e&&n._apmServer.addTransaction(e)}),t[Y]&&nt.observe(Y,this.getHistorySub()),t[V]&&nt.observe(V,this.getXHRSub()),t[X]&&nt.observe(X,this.getFetchSub())},e.getHistorySub=function(){var n=this._transactionService;return function(t,e){e.source===Y&&t===R&&n.startTransaction(e.data.title,"route-change",{canReuse:!0})}},e.getXHRSub=function(){var n=this;return function(t,e){e.source!==V||C.fetchInProgress||n.processAPICalls(t,e)}},e.getFetchSub=function(){var n=this;return function(t,e){e.source===X&&n.processAPICalls(t,e)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===F&&e.data){var i=new Tt(e.data.url),o=e.data.method+" "+(i.relative?i.path:g(i.href)),a=r.startSpan(o,"external.http"),s=r.addTask();if(!a)return;var c=n.get("distributedTracing"),u=n.get("distributedTracingOrigins"),f=new Tt(window.location.href),d=h(i.origin,f.origin)||h(i.origin,u),p=e.data.target;c&&d&&p&&this.injectDtHeader(a,p),a.addContext({http:{method:e.data.method,url:i.href}}),a.sync=e.data.sync,e.data.span=a,e.id=s}t===R&&e.data&&e.data.span&&(void 0!==e.data.target.status?e.data.span.addContext({http:{status_code:e.data.target.status}}):e.data.response&&e.data.span.addContext({http:{status_code:e.data.response.status}}),e.data.span.end()),t===R&&e.id&&r.removeTask(e.id)},e.injectDtHeader=function(t,e){var n,r=this._configService,i=r.get("distributedTracingHeaderName"),o=r.get("distributedTracingHeaderValueCallback")(t),a=/^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/.test(n=o)&&"00000000000000000000000000000000"!==n.slice(3,35)&&"0000000000000000"!==n.slice(36,52);i&&o&&a&&("function"==typeof e.setRequestHeader?e.setRequestHeader(i,o):e.headers&&"function"==typeof e.headers.append?e.headers.append(i,o):e[i]=o)},e.extractDtHeader=function(t){var e=this._configService.get("distributedTracingHeaderName");if(t)return function(t){var e=/^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/.exec(t);if(e){var n="00"!==e[4];return{traceId:e[2],id:e[3],sampled:n}}}(t[e])},e.setTransactionContext=function(t){var e=this._configService.get("context");e&&t.addContext(e)},e.filterTransaction=function(t){var e=this._configService.get("transactionDurationThreshold"),n=t.duration();if(!n)return!1;if(e<n)return!1;if(0===t.spans.length)return!1;t.sampled||t.resetSpans();var r=this._configService.get("browserResponsivenessInterval");if(this._configService.get("checkBrowserResponsiveness")&&!t.isHardNavigation){var i=this._configService.get("browserResponsivenessBuffer");if(!this.checkBrowserResponsiveness(t,r,i))return!1}return!0},e.adjustTransactionTime=function(t){var e=t.spans,n=function(t){for(var e=t[0],n=1;n<t.length;n++){var r=t[n];e._start>r._start&&(e=r)}return e}(e);n&&n._start<t._start&&(t._start=n._start);var r=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n];-1===String(r.type).indexOf("external")&&(!e||e._end<r._end)&&(e=r)}return e}(e);r&&r._end>t._end&&(t._end=r._end);for(var i=t._end,o=0;o<e.length;o++){var a=e[o];a._end>i&&(a._end=i,a.type+=".truncated"),a._start>i&&(a._start=i)}},e.prepareTransaction=function(e){if(e.spans.sort(function(t,e){return t._start-e._start}),this._configService.get("groupSimilarSpans")){var t=this._configService.get("similarSpanThreshold");e.spans=this.groupSmallContinuouslySimilarSpans(e,t)}e.spans=e.spans.filter(function(t){return 0<t.duration()&&t._start>=e._start&&t._end<=e._end}),this.setTransactionContext(e)},e.createTransactionDataModel=function(n){var t=this._configService.get("context"),r=n._start,e=n.spans.map(function(t){var e={id:t.id,transaction_id:n.id,parent_id:t.parentId||n.id,trace_id:n.traceId,name:t.name,type:t.type,subType:t.subType,action:t.action,sync:t.sync,start:t._start-r,duration:t.duration(),context:t.context};return yt(ht,e)}),i=w({},t,n.context),o={id:n.id,trace_id:n.traceId,name:n.name,type:n.type,duration:n.duration(),spans:e,context:i,marks:n.marks,span_count:{started:e.length},sampled:n.sampled};return yt(vt,o)},e.createTransactionPayload=function(t){if(this.adjustTransactionTime(t),this.prepareTransaction(t),this.filterTransaction(t))return this.createTransactionDataModel(t)},e.convertTransactionsToServerModel=function(t){var e=this;return t.map(function(t){return e.createTransactionDataModel(t)})},e.groupSmallContinuouslySimilarSpans=function(o,a){var s=o.duration(),c=[],u=1;return o.spans.forEach(function(t,e){if(0===c.length)c.push(t);else{var n=c[c.length-1],r=n.type===t.type&&n.subType===t.subType&&n.action===t.action&&n.name===t.name&&t.duration()/s<a&&(t._start-n._end)/s<a,i=o.spans.length===e+1;r&&(u++,n._end=t._end),1<u&&(!r||i)&&(n.name=u+"x "+n.name,u=1),r||c.push(t)}}),c},e.checkBrowserResponsiveness=function(t,e,n){var r=t.browserResponsivenessCounter;if(void 0===e||void 0===r)return!0;var i=t.duration();return Math.floor(i/e)<=r+n},t}(),xt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=B),e||(e="custom"),this.options=n,this.name=t,this.type=e,this.id=this.options.id||p(16),this.traceId=this.options.traceId,this.sampled=this.options.sampled,this.timestamp=this.options.timestamp||Date.now(),this.ended=!1,this._start=window.performance.now(),this._end=void 0,this.onEnd=this.options.onEnd}var e=t.prototype;return e.ensureContext=function(){this.context||(this.context={})},e.addTags=function(t){console.warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(e){this.ensureContext();var n=this.context;n.tags||(n.tags={}),Object.keys(e).forEach(function(t){return f(t,e[t],n.tags)})},e.addContext=function(t){t&&(this.ensureContext(),w(this.context,t))},e.end=function(){this.ended||(this.ended=!0,this._end=window.performance.now(),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){if(b(this._end)||b(this._start))return null;var t=this._end-this._start;return parseFloat(t)},t}();var Ct=function(o){var t,e;function n(t,e,n){var r;if((r=o.call(this,t,e,n)||this).parentId=r.options.parentId,r.subType=void 0,r.action=void 0,-1!==r.type.indexOf(".")){var i=r.type.split(".",3);r.type=i[0],r.subType=i[1],r.action=i[2]}return r.sync=r.options.sync,r}return e=o,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e,n}(xt);var Lt=function(i){var t,e;function n(t,e,n){var r;return(r=i.call(this,t,e,n)||this).traceId=p(),r.marks=void 0,r.spans=[],r._activeSpans={},r.nextAutoTaskId=1,r._scheduledTasks=[],r.isHardNavigation=!1,r.sampled=Math.random()<=r.options.transactionSampleRate,r}e=i,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e;var r=n.prototype;return r.addMarks=function(t){this.marks=w(this.marks||{},t)},r.mark=function(t){var e=E(t),n=window.performance.now()-this._start,r={};r[e]=n,this.addMarks({custom:r})},r.canReuse=function(t){return void 0===t&&(t=5e3),!!this.options.canReuse&&!this.ended&&performance.now()-this._start<t},r.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=S(this.options,n))},r.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=S({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var o=new Ct(t,e,i);return this._activeSpans[o.id]=o}},r.isFinished=function(){return 0===this._scheduledTasks.length},r.detectFinish=function(){this.isFinished()&&this.end()},r.end=function(){if(!this.ended){for(var t in this.ended=!0,this._end=window.performance.now(),this._activeSpans){var e=this._activeSpans[t];e.type=e.type+".truncated",e.end()}var n=l();this.addContext(n),this.callOnEnd()}},r.addTask=function(t){if(void 0===t&&(t="task"+this.nextAutoTaskId++),-1==this._scheduledTasks.indexOf(t))return this._scheduledTasks.push(t),t},r.removeTask=function(t){var e=this._scheduledTasks.indexOf(t);-1<e&&this._scheduledTasks.splice(e,1),this.detectFinish()},r.resetSpans=function(){this.spans=[]},r._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id]},n}(xt),Ot=[["domainLookupStart","domainLookupEnd","Domain lookup"],["connectStart","connectEnd","Making a connection to the server"],["requestStart","responseEnd","Requesting and receiving the document"],["domLoading","domInteractive","Parsing the document, executing sync. scripts"],["domContentLoadedEventStart","domContentLoadedEventEnd",'Fire "DOMContentLoaded" event'],["loadEventStart","loadEventEnd",'Fire "load" event']];function It(t,e,n,r){return"number"==typeof t&&"number"==typeof e&&n<=t&&t<e&&e-n<=r&&e-t<D&&t-n<D&&e-n<D}function Nt(t){var e={transfer_size:t.transferSize,encoded_body_size:t.encodedBodySize,decoded_body_size:t.decodedBodySize},n=function(t){void 0===t&&(t=[]);for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.duration,a=r.description,s=i;a&&(s+=";desc="+a),o&&(s+=";dur="+o),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function At(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o="resource";n&&(o+="."+n);var a=g(e),s=new Ct(a,o);return s.addContext({http:{url:e,response:Nt(t)}}),s._start=r,s.end(),s._end=i,s}function kt(e){var t=window.performance;if(e.isHardNavigation&&t&&t.timing){var n=t.timing;if(e.marks&&e.marks.custom){var r=e.marks.custom;Object.keys(r).forEach(function(t){r[t]+=e._start})}e._start=0;var i=e._end;if(function(t,e,n){for(var r=[],i=0;i<Ot.length;i++){var o=t[Ot[i][0]],a=t[Ot[i][1]];if(It(o,a,e,n)){var s=new Ct(Ot[i][2],"hard-navigation.browser-timing");"requestStart"===Ot[i][0]&&(s.pageResponse=!0),s._start=o-e,s.ended=!0,s._end=a-e,r.push(s)}}return r}(n,n.fetchStart,i).forEach(function(t){t.traceId=e.traceId,t.sampled=e.sampled,t.pageResponse&&e.options.pageLoadSpanId&&(t.id=e.options.pageLoadSpanId),e.spans.push(t)}),"function"==typeof t.getEntriesByType){for(var o=t.getEntriesByType("resource"),a=[],s=0;s<e.spans;s++){var c=e.spans[s];"external"===c.type&&"http"===c.subType||a.push(c.name.split(" ")[1])}(function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.initiatorType,s=o.name,c=o.startTime,u=o.responseEnd;if("xmlhttprequest"!==a&&"fetch"!==a&&s)if(-1!==H.indexOf(a)){if(!It(c,u,0,n))continue;r.push(At(t[i]))}else{if(null!=a)continue;for(var f=!1,d=0;d<e.length;d++){var p=s.lastIndexOf(e[d]);if(-1<p&&p===s.length-e[d].length){f=!0;break}}!f&&It(c,u,0,n)&&r.push(At(t[i]))}}return r})(o,a,i).forEach(function(t){return e.spans.push(t)}),function(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=i.name,a=i.startTime,s=i.duration,c=a+s;if(!(s<=Q)&&It(a,c,0,e)){var u=new Ct(o,"app");u._start=a,u.end(),u._end=c,n.push(u)}}return n}(t.getEntriesByType("measure"),i).forEach(function(t){return e.spans.push(t)});var u=t.getEntriesByType("navigation");u&&0<u.length&&(u=u[0],e.addContext({response:Nt(u)}))}}}var Ft=function(){function t(t,e){this._config=e,this._logger=t,this.currentTransaction=void 0,this._alreadyCapturedPageLoad=!1}var e=t.prototype;return e.ensureCurrentTransaction=function(t){t||(t=this.createPerfOptions());var e=this.getCurrentTransaction();return e||(t.canReuse=!0,this.createTransaction(void 0,void 0,t))},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.setCurrentTransaction=function(t){this.currentTransaction=t},e.createTransaction=function(t,e,n){var r=new Lt(t,e,n);return this.setCurrentTransaction(r),n.checkBrowserResponsiveness&&this.startCounter(r),r},e.startCounter=function(t){t.browserResponsivenessCounter=0;var e=this._config.get("browserResponsivenessInterval");if(void 0!==e)var n=setInterval(function(){t.ended?window.clearInterval(n):t.browserResponsivenessCounter++},e)},e.capturePageLoadMetrics=function(t){if(this._config.get("capturePageLoad")&&!this._alreadyCapturedPageLoad&&t.isHardNavigation)return kt(t),t.addMarks(x()),self._alreadyCapturedPageLoad=!0},e.createPerfOptions=function(t){var e=this._config.config;return S({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,transactionSampleRate:e.transactionSampleRate,checkBrowserResponsiveness:e.checkBrowserResponsiveness},t)},e.startTransaction=function(t,e,n){var r=this,i=this.createPerfOptions(n),o=this.getCurrentTransaction();return o?o.canReuse()&&i.canReuse?o.redefine(t,void 0,i):(o.end(),o=this.createTransaction(t,e,i)):o=this.createTransaction(t,e,i),e===q&&(o.isHardNavigation=!0,i.pageLoadTraceId&&(o.traceId=i.pageLoadTraceId),i.pageLoadSampled&&(o.sampled=i.pageLoadSampled),o.name===B&&i.pageLoadTransactionName&&(o.name=i.pageLoadTransactionName)),this._config.events.send("transaction:start",[o]),o.onEnd=function(){return K.Promise.resolve().then(function(){if(!r.shouldIgnoreTransaction(o.name))if(o.type===q){var t=r._config.get("pageLoadTransactionName");o.name===B&&t&&(o.name=t),r.capturePageLoadMetrics(o)&&r.add(o)}else r.add(o)},function(t){0})},o},e.shouldIgnoreTransaction=function(t){var e=this._config.get("ignoreTransactions");if(e&&e.length)for(var n=0;n<e.length;n++){var r=e[n];if("function"==typeof r.test){if(r.test(t))return!0}else if(r===t)return!0}return!1},e.startSpan=function(t,e,n){var r=this.ensureCurrentTransaction();if(r)return r.startSpan(t,e,n)},e.add=function(t){this._config.events.send(U,[t])},e.addTask=function(t){var e=this.ensureCurrentTransaction();if(e){t=e.addTask(t);0}return t},e.removeTask=function(t){var e=this.getCurrentTransaction();e&&e.removeTask(t)},e.detectFinish=function(){var t=this.getCurrentTransaction();t&&t.detectFinish()},t}(),Rt=function(i){i.registerServiceCreator("TransactionService",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService");return new Ft(e,t)}),i.registerServiceCreator("PerformanceMonitoring",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService"),n=i.getService("ApmServer"),r=i.getService("TransactionService");return new Et(n,t,e,r)})},jt=function(){function t(t,e){e||(e={}),this.onFlush=t,this.items=[],this.queueLimit=e.queueLimit||-1,this.flushInterval=e.flushInterval||0,this.timeoutId=void 0}var e=t.prototype;return e._setTimer=function(){var t=this;this.timeoutId=setTimeout(function(){t.flush()},this.flushInterval)},e.flush=function(){this.onFlush(this.items),this._clear()},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.add=function(t){this.items.push(t),-1!==this.queueLimit&&this.items.length>=this.queueLimit?this.flush():void 0===this.timeoutId&&this._setTimer()},t}();var Mt=function(e,n,t){var r,i=t.context||this,o=t.limit,a=t.interval,s=t.countFn||function(){},c=0;return function(){var t="function"==typeof s&&s.apply(i,arguments);return"number"!=typeof t&&(t=1),c+=t,void 0===r&&(r=setTimeout(function(){r=void(c=0)},a)),o<c?"function"==typeof n?n.apply(i,arguments):void 0:e.apply(i,arguments)}},Pt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Ht=function(){function t(t,e){this._configService=t,this._loggingService=e,this.errorQueue=void 0,this.transactionQueue=void 0,this.throttleAddError=void 0,this.throttleAddTransaction=void 0,this.initialized=!1,this.ndjsonSpan={}}var e=t.prototype;return e.init=function(){this.initialized||(this.initialized=!0,this.initErrorQueue(),this.initTransactionQueue())},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"js-base",version:t.version},language:{name:"javascript"},environment:t.get("environment")}};return yt(ft,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,e,{"Content-Type":"application/x-ndjson"})},e._constructError=function(t){var e=t.url,n=t.status,r=(t.responseText,e+" HTTP status: "+n);return new Error(r)},e._makeHttpRequest=function(e,o,a,s){return new K.Promise(function(n,r){var i=new window.XMLHttpRequest;if(i[I]=!0,i.open(e,o,!0),i.timeout=1e4,s)for(var t in s)s.hasOwnProperty(t)&&i.setRequestHeader(t,s[t]);i.onreadystatechange=function(){if(4===i.readyState){var t=i.status,e=i.responseText;0===t||399<t&&t<600?r({url:o,status:t,responseText:e}):n(e)}},i.onerror=function(){var t=i.status,e=i.responseText;r({url:o,status:t,responseText:e})},i.send(a)})},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new jt(t,{queueLimit:e,flushInterval:n})},e.initErrorQueue=function(){var n=this;this.errorQueue&&this.errorQueue.flush(),this.errorQueue=this._createQueue(function(t){var e=n.sendErrors(t);e&&e.catch(function(t){n._loggingService.warn("Failed sending errors!",n._constructError(t))})});var t=this._configService.get("errorThrottleLimit"),e=this._configService.get("errorThrottleInterval");this.throttleAddError=Mt(this.errorQueue.add.bind(this.errorQueue),function(){return n._loggingService.warn("Dropped error due to throttling!")},{limit:t,interval:e})},e.initTransactionQueue=function(){var n=this;this.transactionQueue&&this.transactionQueue.flush(),this.transactionQueue=this._createQueue(function(t){var e=n.sendTransactions(t);e&&e.catch(function(t){n._loggingService.warn("Failed sending transactions!",n._constructError(t))})});var t=this._configService.get("transactionThrottleLimit"),e=this._configService.get("transactionThrottleInterval");this.throttleAddTransaction=Mt(this.transactionQueue.add.bind(this.transactionQueue),function(){return n._loggingService.warn("Dropped transaction due to throttling!")},{limit:t,interval:e})},e.addError=function(t){this.errorQueue||this.initErrorQueue(),this.throttleAddError(t)},e.addTransaction=function(t){this.transactionQueue||this.initTransactionQueue(),this.throttleAddTransaction(t)},e.ndjsonErrors=function(t){return t.map(function(t){return Pt.stringify({error:t})})},e.ndjsonTransactions=function(t){var n=this.ndjsonSpan;return t.map(function(t){var e="";return t.spans&&(e=t.spans.map(function(t){return n.span=t,Pt.stringify(n)}).join(""),delete t.spans),Pt.stringify({transaction:t})+e})},e._send=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e="transaction"),0!==t.length){var n={service:this.createMetaData().service,data:t},r=this._configService.applyFilters(n);if(r){var i,o=this._configService.getEndpointUrl();if("errors"===e)i=this.ndjsonErrors(r.data);else{if("transaction"!==e)return void 0;i=this.ndjsonTransactions(r.data)}i.unshift(Pt.stringify({metadata:{service:r.service}}));var a=i.join("");return this._postJson(o,a)}this._loggingService.warn("Dropped payload due to filtering!")}},e.sendTransactions=function(t){return this._send(t)},e.sendErrors=function(t){return this._send(t,"errors")},t}();var Dt=function(){function t(){this.config={},this.defaults={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",serverUrlPrefix:"/intake/v2/rum/events",active:!0,instrument:!0,disableInstrumentations:[],debug:!1,logLevel:"warn",browserResponsivenessInterval:500,browserResponsivenessBuffer:3,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,capturePageLoad:!0,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,sendPageLoadTransaction:!0,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderValueCallback:c,distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,context:{}},this.events=new et,this.filters=[],this.version=""}var e=t.prototype;return e.init=function(){var t=function(t){if(!t)return{};for(var e={},n=/^data-([\w-]+)$/,r=t.attributes,i=0;i<r.length;i++){var o=r[i];if(n.test(o.nodeName)){var a=o.nodeName.match(n)[1],s=a.split("-").map(function(t,e){return 0<e?t.charAt(0).toUpperCase()+t.substring(1):t}).join("");e[s]=o.value||o.nodeValue}}return e}(_());this.setConfig(t)},e.isActive=function(){return this.get("active")},e.setVersion=function(t){this.version=t},e.addFilter=function(t){if("function"!=typeof t)throw new Error("Argument to must be function");this.filters.push(t)},e.applyFilters=function(t){for(var e=0;e<this.filters.length;e++)if(!(t=this.filters[e](t)))return;return t},e.get=function(t){return t.split(".").reduce(function(t,e){return t&&t[e]},this.config)},e.getEndpointUrl=function(){return this.config.serverUrl+this.config.serverUrlPrefix},e.set=function(t,e){for(var n=t.split("."),r=n.length-1,i=this.config,o=0;o<r+1;o++){var a=n[o];if(a)if(o===r)i[a]=e;else{var s=i[a]||{};i[a]=s,i=s}}},e.setUserContext=function(t){void 0===t&&(t={});var e={},n=t,r=n.id,i=n.username,o=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof o&&(e.email=o),this.set("context.user",e)},e.setCustomContext=function(t){t&&"object"==typeof t&&this.set("context.custom",t)},e.addLabels=function(e){var n=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(e).forEach(function(t){return f(t,e[t],n.config.context.tags)})},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),this.config=w({},this.defaults,this.config,t),this.events.send($,[this.config])},e.validate=function(e){void 0===e&&(e={});var n=["serviceName","serverUrl"],r={missing:[],invalid:[]};return Object.keys(e).forEach(function(t){-1===n.indexOf(t)||e[t]||r.missing.push(t)}),e.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(e.serviceName)&&r.invalid.push({key:"serviceName",value:e.serviceName,allowed:"a-z, A-Z, 0-9, _, -, <space>"}),r},t}(),qt=function(){function t(t){t||(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"info",this.prefix=t.prefix||"",this.resetLogMethods()}var e=t.prototype;return e.shouldLog=function(t){return this.levels.indexOf(t)>=this.levels.indexOf(this.level)},e.setLevel=function(t){this.level=t,this.resetLogMethods()},e.resetLogMethods=function(){var o=this;this.levels.forEach(function(i){o[i]=o.shouldLog(i)?function(){var t,e=o.prefix;switch(i){case"trace":case"debug":t="info";break;default:t=i}var n=arguments;e&&("function"==typeof e&&(e=e(i)),n[0]=e+n[0]);if(console){var r=console[t]?console[t]:console.log;"function"==typeof r&&r.apply(console,n)}}:T})},t}(),Bt=function(){function t(){this._serviceCreators={},this._serviceInstances={},this.initialized=!1}var e=t.prototype;return e.registerCoreServices=function(){var t=this;this.registerServiceCreator("ConfigService",function(){return new Dt}),this.registerServiceCreator("LoggingService",function(){return new qt}),this.registerServiceCreator("ApmServer",function(){return new Ht(t.getService("ConfigService"),t.getService("LoggingService"))})},e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService("ConfigService");t.init();var e=this.getService("LoggingService");n(e,t),t.events.observe($,function(){n(e,t)}),this.getService("ApmServer").init()}function n(t,e){var n=e.get("debug"),r=e.get("logLevel");!0===n&&"trace"!==r?t.setLevel("debug"):t.setLevel(r)}},e.registerServiceCreator=function(t,e){this._serviceCreators[t]=e},e.registerServiceInstance=function(t,e){this._serviceInstances[t]=e},e.getService=function(t){if(!this._serviceInstances[t]){if("function"!=typeof this._serviceCreators[t])throw new Error("Can not get service, No creator for: "+t);this._serviceInstances[t]=this._serviceCreators[t](this)}return this._serviceInstances[t]},t}();var Qt,zt=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){if(this.isEnabled()&&!this._initialized){this._initialized=!0;var e=this.serviceFactory.getService("ConfigService");e.setVersion("4.4.3"),this.config(t);var n=this.serviceFactory.getService("LoggingService");if(!e.isActive())return n.info("RUM agent is inactive"),this;this.serviceFactory.init();var r=(i=e.get("instrument"),o=e.get("disableInstrumentations"),(a={})[V]=!1,a[X]=!1,a[Y]=!1,a[q]=!1,a.error=!1,s=a,i&&Object.keys(s).forEach(function(t){-1===o.indexOf(t)&&(s[t]=!0)}),s);if(this.serviceFactory.getService("PerformanceMonitoring").init(r),r.error)this.serviceFactory.getService("ErrorLogging").registerGlobalEventListener();r[q]&&e.get("sendPageLoadTransaction")&&this._sendPageLoadMetrics()}var i,o,a,s;return this},e._sendPageLoadMetrics=function(){var t=this.serviceFactory.getService("TransactionService").startTransaction(void 0,q,{canReuse:!0});t&&t.addTask(q);var e=function(){setTimeout(function(){t&&t.removeTask(q)})};"complete"===document.readyState?e():window.addEventListener("load",e)},e.isEnabled=function(){return!this._disable},e.observe=function(t,e){this.serviceFactory.getService("ConfigService").events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService("ConfigService"),n=e.validate(t),r=n.missing,o=n.invalid;if(0===r.length&&0===o.length)e.setConfig(t);else{var i=this.serviceFactory.getService("LoggingService"),a="RUM Agent isn't correctly configured: ";0<r.length&&(a+="Missing config - "+r.join(", "),0<o.length&&(a+=", ")),o.forEach(function(t,e){var n=t.key,r=t.value,i=t.allowed;a+=n+' "'+r+'" contains invalid characters! (allowed: '+i+")"+(e!==o.length-1?", ":"")}),i.error(a),e.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService("ConfigService").setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService("ConfigService").setCustomContext(t)},e.addTags=function(t){this.serviceFactory.getService("LoggingService").warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(t){this.serviceFactory.getService("ConfigService").addLabels(t)},e.setInitialPageLoadName=function(t){this.isEnabled()&&this.serviceFactory.getService("ConfigService").setConfig({pageLoadTransactionName:t})},e.startTransaction=function(t,e,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startTransaction(t,e,n)},e.startSpan=function(t,e){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e)},e.getCurrentTransaction=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").getCurrentTransaction()},e.getTransactionService=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService")},e.captureError=function(t){if(this.isEnabled())return this.serviceFactory.getService("ErrorLogging").logError(t)},e.addFilter=function(t){this.serviceFactory.getService("ConfigService").addFilter(t)},t}(),Ut=(ot||(ot=!0,u()?(it(),at=!0):"undefined"!=typeof window&&console.log("APM: Platform is not supported!")),at),$t=((Qt=new Bt).registerCoreServices(),St(Qt),Rt(Qt),Qt),Vt=new zt($t,!Ut);"undefined"!=typeof window&&(window.elasticApm=Vt);var Xt=Vt.init.bind(Vt),Yt=n(4),Jt=n(0),Wt=n(1);var Gt=function(r){var t,e;function n(t,e){var n;return(n=r.call(this)||this).__tracer=t,n.span=e,n.isTransaction=e instanceof Lt,n.spanContext={id:e.id,traceId:e.traceId,sampled:e.sampled},n}e=r,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e;var i=n.prototype;return i._context=function(){return this.spanContext},i._tracer=function(){return this.__tracer},i._setOperationName=function(t){this.span.name=t},i._addTags=function(t){var e=S({},t);if(e.type&&(this.span.type=e.type,delete e.type),this.isTransaction){var n=e["user.id"],r=e["user.username"],i=e["user.email"];(n||r||i)&&(this.span.addContext({user:{id:n,username:r,email:i}}),delete e["user.id"],delete e["user.username"],delete e["user.email"])}this.span.addLabels(e)},i._log=function(t,e){"error"===t.event&&(t["error.object"]?this.__tracer.errorLogging.logError(t["error.object"]):t.message&&this.__tracer.errorLogging.logError(t.message))},i._finish=function(t){this.span.end(),t&&(this.span._end=t-v())},n}(Wt.Span);var Zt=function(o){var t,e;function n(t,e,n,r){var i;return(i=o.call(this)||this).performanceMonitoring=t,i.transactionService=e,i.loggingService=n,i.errorLogging=r,i}e=o,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e;var r=n.prototype;return r._startSpan=function(t,e){var n,r={};if(e)if(r.timestamp=e.startTime,e.childOf)r.parentId=e.childOf.id;else if(e.references&&0<e.references.length){e.references.length;var i=function(t,e,n){if(null==t)throw new TypeError("array is null or not defined");var r=Object(t),i=r.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var o=0;o<i;){var a=r[o];if(e.call(n,a,o,r))return a;o++}}(e.references,function(t){return t.type()===Jt.REFERENCE_CHILD_OF});i&&(r.parentId=i.referencedContext().id)}if(!(n=this.transactionService.getCurrentTransaction()?this.transactionService.startSpan(t,void 0,r):this.transactionService.startTransaction(t,void 0,r)))return new Wt.Span;r.timestamp&&(n._start=r.timestamp-v());var o=new Gt(this,n);return e&&e.tags&&o.addTags(e.tags),o},r._inject=function(t,e,n){switch(e){case Jt.FORMAT_TEXT_MAP:case Jt.FORMAT_HTTP_HEADERS:this.performanceMonitoring.injectDtHeader(t,n);break;case Jt.FORMAT_BINARY:0}},r._extract=function(t,e){var n;switch(t){case Jt.FORMAT_TEXT_MAP:case Jt.FORMAT_HTTP_HEADERS:n=this.performanceMonitoring.extractDtHeader(e);break;case Jt.FORMAT_BINARY:0}return n||(n=null),n},n}(Yt.Tracer);function Kt(t){return e=t.serviceFactory,n=e.getService("PerformanceMonitoring"),r=e.getService("TransactionService"),i=e.getService("ErrorLogging"),o=e.getService("LoggingService"),new Zt(n,r,o,i);var e,n,r,i,o}n.d(e,"createTracer",function(){return Kt}),n.d(e,"init",function(){return Xt}),n.d(e,"apm",function(){return Vt}),n.d(e,"apmBase",function(){return Vt}),n.d(e,"ApmBase",function(){return zt}),"undefined"!=typeof window&&window.elasticApm&&(window.elasticApm.createTracer=Kt.bind(window.elasticApm,window.elasticApm));e.default=Kt}]);
!function(n){var r={};function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}i.m=n,i.c=r,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=11)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FORMAT_BINARY="binary",e.FORMAT_TEXT_MAP="text_map",e.FORMAT_HTTP_HEADERS="http_headers",e.REFERENCE_CHILD_OF="child_of",e.REFERENCE_FOLLOWS_FROM="follows_from"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),i=function(){function t(){}return t.prototype.context=function(){return this._context()},t.prototype.tracer=function(){return this._tracer()},t.prototype.setOperationName=function(t){return this._setOperationName(t),this},t.prototype.setBaggageItem=function(t,e){return this._setBaggageItem(t,e),this},t.prototype.getBaggageItem=function(t){return this._getBaggageItem(t)},t.prototype.setTag=function(t,e){return this._addTags(((n={})[t]=e,n)),this;var n},t.prototype.addTags=function(t){return this._addTags(t),this},t.prototype.log=function(t,e){return this._log(t,e),this},t.prototype.logEvent=function(t,e){return this._log({event:t,payload:e})},t.prototype.finish=function(t){this._finish(t)},t.prototype._context=function(){return r.spanContext},t.prototype._tracer=function(){return r.tracer},t.prototype._setOperationName=function(t){},t.prototype._setBaggageItem=function(t,e){},t.prototype._getBaggageItem=function(t){},t.prototype._addTags=function(t){},t.prototype._log=function(t,e){},t.prototype._finish=function(t){},t}();e.Span=i,e.default=i},function(t,e,n){t.exports=function(){"use strict";function c(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},r=0,e=void 0,i=void 0,s=function(t,e){p[r]=t,p[r+1]=e,2===(r+=2)&&(i?i(h):y())},t="undefined"!=typeof window?window:void 0,o=t||{},a=o.MutationObserver||o.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(h,1)}}var p=new Array(1e3);function h(){for(var t=0;t<r;t+=2){var e=p[t],n=p[t+1];e(n),p[t]=void 0,p[t+1]=void 0}r=0}var v,l,g,m,y=void 0;function _(t,e){var n=this,r=new this.constructor(b);void 0===r[w]&&M(r);var i=n._state;if(i){var o=arguments[i-1];s(function(){return R(i,r,o,n._result)})}else k(n,r,t,e);return r}function S(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(b);return O(e,t),e}y=u?function(){return process.nextTick(h)}:a?(l=0,g=new a(h),m=document.createTextNode(""),g.observe(m,{characterData:!0}),function(){m.data=l=++l%2}):f?((v=new MessageChannel).port1.onmessage=h,function(){return v.port2.postMessage(0)}):void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0===(e=t.runOnLoop||t.runOnContext)?d():function(){e(h)}}catch(t){return d()}}():d();var w=Math.random().toString(36).substring(2);function b(){}var T=void 0,E=1,x=2;function C(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}function L(t,e,n){var r,i,o,a;e.constructor===t.constructor&&n===_&&e.constructor.resolve===S?(o=t,(a=e)._state===E?N(o,a._result):a._state===x?A(o,a._result):k(a,void 0,function(t){return O(o,t)},function(t){return A(o,t)})):void 0===n?N(t,e):c(n)?(r=e,i=n,s(function(e){var n=!1,t=C(i,r,function(t){n||(n=!0,r!==t?O(e,t):N(e,t))},function(t){n||(n=!0,A(e,t))},e._label);!n&&t&&(n=!0,A(e,t))},t)):N(t,e)}function O(e,t){if(e===t)A(e,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=t),null===r||"object"!==i&&"function"!==i)N(e,t);else{var n=void 0;try{n=t.then}catch(t){return void A(e,t)}L(e,t,n)}var r,i}function I(t){t._onerror&&t._onerror(t._result),F(t)}function N(t,e){t._state===T&&(t._result=e,t._state=E,0!==t._subscribers.length&&s(F,t))}function A(t,e){t._state===T&&(t._state=x,t._result=e,s(I,t))}function k(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+E]=n,i[o+x]=r,0===o&&t._state&&s(F,t)}function F(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,i=void 0,o=t._result,a=0;a<e.length;a+=3)r=e[a],i=e[a+n],r?R(n,r,i,o):i(o);t._subscribers.length=0}}function R(t,e,n,r){var i=c(n),o=void 0,a=void 0,s=!0;if(i){try{o=n(r)}catch(t){s=!1,a=t}if(e===o)return void A(e,new TypeError("A promises callback cannot return that same promise."))}else o=r;e._state!==T||(i&&s?O(e,o):!1===s?A(e,a):t===E?N(e,o):t===x&&A(e,o))}var j=0;function M(t){t[w]=j++,t._state=void 0,t._result=void 0,t._subscribers=[]}var P=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(b),this.promise[w]||M(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?N(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&N(this.promise,this._result))):A(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===T&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===S){var i=void 0,o=void 0,a=!1;try{i=e.then}catch(t){a=!0,o=t}if(i===_&&e._state!==T)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===H){var s=new n(b);a?A(s,o):L(s,e,i),this._willSettleAt(s,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===T&&(this._remaining--,t===x?A(r,n):this._result[e]=n),0===this._remaining&&N(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;k(t,void 0,function(t){return n._settledAt(E,e,t)},function(t){return n._settledAt(x,e,t)})},t}(),H=function(){function e(t){this[w]=j++,this._result=this._state=void 0,this._subscribers=[],b!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){O(e,t)},function(t){A(e,t)})}catch(t){A(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var n=this.constructor;return c(e)?this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){throw t})}):this.then(e,e)},e}();return H.prototype.then=_,H.all=function(t){return new P(this,t).promise},H.race=function(i){var o=this;return n(i)?new o(function(t,e){for(var n=i.length,r=0;r<n;r++)o.resolve(i[r]).then(t,e)}):new o(function(t,e){return e(new TypeError("You must pass an array to race."))})},H.resolve=S,H.reject=function(t){var e=new this(b);return A(e,t),e},H._setScheduler=function(t){i=t},H._setAsap=function(t){s=t},H._asap=s,H.polyfill=function(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=H},H.Promise=H}()},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8),i=n(5),o=n(1),a=function(){function t(){}return t.prototype.startSpan=function(t,e){if(void 0===e&&(e={}),e.childOf){var n=r.childOf(e.childOf);e.references?e.references.push(n):e.references=[n],delete e.childOf}return this._startSpan(t,e)},t.prototype.inject=function(t,e,n){return t instanceof o.default&&(t=t.context()),this._inject(t,e,n)},t.prototype.extract=function(t,e){return this._extract(t,e)},t.prototype._startSpan=function(t,e){return i.span},t.prototype._inject=function(t,e,n){},t.prototype._extract=function(t,e){return i.spanContext},t}();e.Tracer=a,e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(10),o=n(4);e.tracer=null,e.spanContext=null,e.span=null,e.initialize=function(){e.tracer=new o.default,e.span=new r.default,e.spanContext=new i.default}},function(n,r,i){var o,a,s;!function(t,e){"use strict";a=[i(7)],void 0===(s="function"==typeof(o=function(s){var n=/(^|@)\S+\:\d+/,r=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/;function o(t,e,n){if("function"==typeof Array.prototype.map)return t.map(e,n);for(var r=new Array(t.length),i=0;i<t.length;i++)r[i]=e.call(n,t[i]);return r}function a(t,e,n){if("function"==typeof Array.prototype.filter)return t.filter(e,n);for(var r=[],i=0;i<t.length;i++)e.call(n,t[i])&&r.push(t[i]);return r}return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(r))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){var e=a(t.stack.split("\n"),function(t){return!!t.match(r)},this);return o(e,function(t){-1<t.indexOf("(eval ")&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(e.pop()),r=e.join(" ")||void 0,i=-1<function(t,e){{if("function"==typeof Array.prototype.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}}(["eval","<anonymous>"],n[0])?void 0:n[0];return new s(r,void 0,i,n[1],n[2],t)},this)},parseFFOrSafari:function(t){var e=a(t.stack.split("\n"),function(t){return!t.match(i)},this);return o(e,function(t){if(-1<t.indexOf(" > eval")&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new s(t);var e=t.split("@"),n=this.extractLocation(e.pop()),r=e.join("@")||void 0;return new s(r,void 0,n[0],n[1],n[2],t)},this)},parseOpera:function(t){return!t.stacktrace||-1<t.message.indexOf("\n")&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),r=[],i=2,o=n.length;i<o;i+=2){var a=e.exec(n[i]);a&&r.push(new s(void 0,void 0,a[2],a[1],void 0,n[i]))}return r},parseOpera10:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),r=[],i=0,o=n.length;i<o;i+=2){var a=e.exec(n[i]);a&&r.push(new s(a[3]||void 0,void 0,a[2],a[1],void 0,n[i]))}return r},parseOpera11:function(t){var e=a(t.stack.split("\n"),function(t){return!!t.match(n)&&!t.match(/^Error created at/)},this);return o(e,function(t){var e,n=t.split("@"),r=this.extractLocation(n.pop()),i=n.shift()||"",o=i.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(e=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===e||"[arguments not available]"===e?void 0:e.split(",");return new s(o,a,r[0],r[1],r[2],t)},this)}}})?o.apply(r,a):o)||(n.exports=s)}()},function(n,r,t){var i,o,a;!function(t,e){"use strict";o=[],void 0===(a="function"==typeof(i=function(){function e(t){return!isNaN(parseFloat(t))&&isFinite(t)}function t(t,e,n,r,i,o){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==n&&this.setFileName(n),void 0!==r&&this.setLineNumber(r),void 0!==i&&this.setColumnNumber(i),void 0!==o&&this.setSource(o)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){return(this.getFunctionName()||"{anonymous}")+"("+(this.getArgs()||[]).join(",")+")"+(this.getFileName()?"@"+this.getFileName():"")+(e(this.getLineNumber())?":"+this.getLineNumber():"")+(e(this.getColumnNumber())?":"+this.getColumnNumber():"")}},t})?i.apply(r,o):i)||(n.exports=a)}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=n(9),o=n(1);e.childOf=function(t){return t instanceof o.default&&(t=t.context()),new i.default(r.REFERENCE_CHILD_OF,t)},e.followsFrom=function(t){return t instanceof o.default&&(t=t.context()),new i.default(r.REFERENCE_FOLLOWS_FROM,t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=function(){function t(t,e){this._type=t,this._referencedContext=e instanceof r.default?e.context():e}return t.prototype.type=function(){return this._type},t.prototype.referencedContext=function(){return this._referencedContext},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){};e.SpanContext=r,e.default=r},function(t,e,n){"use strict";n.r(e);var r=n(3),o=n.n(r),i=[].slice;for(var a=[],s=0;s<256;++s)a[s]=(s+256).toString(16).substr(1);function c(t){if(t&&t.traceId&&t.id&&t.parentId){var e=t.sampled?"01":"00",n=t.sampled?t.id:t.parentId;return"00-"+t.traceId+"-"+n+"-"+e}}function h(e,t){var n=!1;return"string"==typeof t?n=e===t:Array.isArray(t)&&t.forEach(function(t){n||(n=h(e,t))}),n}function v(t){var e,n,r,i;return(e=o()(),r=n||0,[(i=a)[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")).substr(0,t)}function u(){return"undefined"!=typeof window&&"function"==typeof Array.prototype.forEach&&"function"==typeof JSON.stringify&&"function"==typeof Function.bind&&window.performance&&"function"==typeof window.performance.now&&"withCredentials"in new window.XMLHttpRequest}function f(t,e,n){if(n&&t){var r=E(t);return e&&(e=String(e)),n[r]=e,n}}var d=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function p(){return window.performance.timing.fetchStart}function l(){return{page:{referer:document.referrer,url:window.location.href}}}function g(t){return t&&t.split("?")[0]}function m(t){return null!==t&&"object"==typeof t}function y(t,e,n){for(var r=0,i=e.length;r<i;++r){var o=e[r];if(m(o)||"function"==typeof o)for(var a=Object.keys(o),s=0,c=a.length;s<c;s++){var u=a[s],f=o[u];n&&m(f)?(m(t[u])||(t[u]=Array.isArray(f)?[]:{}),y(t[u],[f],!1)):t[u]=f}}return t}function _(){if("undefined"!=typeof document){var t=document.currentScript;return t||function(){if("undefined"!=typeof document)for(var t=document.getElementsByTagName("script"),e=0,n=t.length;e<n;e++){var r=t[e];if(0<r.src.indexOf("elastic"))return r}}()}}function S(t){return y(t,i.call(arguments,1),!1)}function w(t){return y(t,i.call(arguments,1),!0)}function b(t){return void 0===t}function T(){}function E(t){return t.replace(/[.*"]/g,"_")}function x(){var n,r,i,t=(n=window.performance.timing,r=n.fetchStart,i={},d.forEach(function(t){var e=n[t];e&&r<=e&&(i[t]=e-r)}),i),e=function(){var t={},e=window.performance;if(e.getEntriesByType){var n=e.getEntriesByType("paint");if(0<n.length)for(var r=e.timing,i=r.fetchStart-r.navigationStart,o=0;o<n.length;o++){var a=n[o],s=0<=i?a.startTime-i:a.startTime;t[a.name]=s}}return t}(),o={timeToFirstByte:t.responseStart,domInteractive:t.domInteractive,domComplete:t.domComplete};return e["first-contentful-paint"]&&(o.firstContentfulPaint=e["first-contentful-paint"]),{navigationTiming:t,agent:o}}var C={fetchInProgress:!1};function L(t){return"__apm_symbol__"+t}function O(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,o,a,s,c=L(e);if(r&&!(i=r[c])){i=r[c]=r[e];var u=r&&Object.getOwnPropertyDescriptor(r,e);if(!(s=u)||!1!==s.writable&&("function"!=typeof s.get||void 0!==s.set)){var f=n(i,c,e);r[e]=function(){return f(this,arguments)},o=r[e],a=i,o[L("OriginalDelegate")]=a}}return i}var I=L("xhrIgnore"),N=L("xhrSync"),A=L("xhrURL"),k=L("xhrMethod"),F="schedule",R="invoke",j="clear",M="addEventListener",P="removeEventListener",H=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],D=3e5,q="page-load",B="Unknown",Q=60,z=1024,U="transaction:end",$="config:change",V="xmlhttprequest",X="fetch",Y="history",J=L("xhrTask"),W=L("xhrListener"),G=L("xhrScheduled");function Z(a){var t=XMLHttpRequest.prototype,s=t[M],c=t[P];if(!s){var e=window.XMLHttpRequestEventTarget;if(e){var n=e.prototype;s=n[M],c=n[P]}}var u="readystatechange";function f(t){t.state=R,t.ignore||a(R,t)}var r=O(t,"open",function(){return function(t,e){return t[k]=e[0],t[A]=e[1],t[N]=!1===e[2],r.apply(t,e)}}),d=O(t,"send",function(){return function(t,e){var n={source:V,state:"",type:"macroTask",ignore:t[I],data:{target:t,method:t[k],sync:t[N],url:t[A],args:e,aborted:!1}},r=function(t){XMLHttpRequest[G]=!1,t.state=F,t.ignore||a(F,t);var e=t.data,n=e.target,r=n[W];s||(s=n[M],c=n[P]),r&&c.call(n,u,r);var i=n[W]=function(){n.readyState===n.DONE&&!e.aborted&&XMLHttpRequest[G]&&t.state===F&&f(t)};s.call(n,u,i),n[J]||(n[J]=t);var o=d.apply(n,e.args);return XMLHttpRequest[G]=!0,o}(n);return t[N]&&f(n),r}}),i=O(t,"abort",function(){return function(t,e){var n,r=t[J];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;(n=r).state=j,a(j,n),n.data.aborted=!0}return i.apply(t,e)}})}var K=n(2);function tt(s){if(window.fetch&&window.Request){var c=window.fetch;window.fetch=function(t,e){var i,n,o=this,r=arguments;if("string"==typeof t)i=new Request(t,e),n=t;else{if(!t)return c.apply(o,r);n=(i=t).url}var a={source:X,state:"",type:"macroTask",data:{target:i,method:i.method,sync:!1,url:n,args:r,aborted:!1}};return new K.Promise(function(e,n){var t,r;C.fetchInProgress=!0,(t=a).state=F,s(F,t);try{r=c.apply(o,[i])}catch(t){return n(t),a.data.error=t,u(a),void(C.fetchInProgress=!1)}r.then(function(t){e(t),K.Promise.resolve().then(function(){a.data.response=t,u(a)})},function(t){n(t),K.Promise.resolve().then(function(){a.data.error=t,u(a)})}),C.fetchInProgress=!1})}}function u(t){t.state=R,s(R,t)}}var et=function(){function t(){this.observers={}}var e=t.prototype;return e.observe=function(e,n){var r=this;if("function"==typeof n)return this.observers[e]||(this.observers[e]=[]),this.observers[e].push(n),function(){var t=r.observers[e].indexOf(n);-1<t&&r.observers[e].splice(t,1)}},e.sendOnly=function(t,e){var n=this.observers[t];n&&n.forEach(function(t){try{t.apply(void 0,e)}catch(t){console.log(t,t.stack)}})},e.send=function(t,e){this.sendOnly(t+":before",e),this.sendOnly(t,e),this.sendOnly(t+":after",e)},t}(),nt=new et,rt=!1;function it(){return rt||(rt=!0,Z(function(t,e){nt.send(V,[t,e])}),tt(function(t,e){nt.send(X,[t,e])}),function(r){if(window.history){var i=history.pushState;"function"==typeof i&&(history.pushState=function(t,e,n){r(R,{source:Y,data:{state:t,title:e,url:n}}),i.apply(this,arguments)})}}(function(t,e){nt.send(Y,[t,e])})),nt}var ot=!1,at=!1;var st=n(6),ct=n.n(st);function ut(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=ct.a.parse(e)}catch(t){}return 0===o.length&&(o=[{fileName:n,lineNumber:r,columnNumber:i}]),o.map(function(t){return t.functionName&&(t.functionName=(e=t.functionName,e=1<(n=(e=(e=(e=1<(n=e.split("/")).length?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>")).split(".")).length?n[n.length-1]:n[0])),t;var e,n}).map(function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,o=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var a,s,c,u,f=(void 0===(a=e)&&(a=""),"<anonymous>"===a&&(a=""),a),d=(s=f,c=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),-1<s.indexOf(c)&&(s=s.replace(c+"/","")),s);return(u=f)&&0===window.location.href.indexOf(u)&&(d="(inline script)"),{abs_path:e,filename:d,function:o,lineno:n,colno:r}})}var ft={service:{name:[z,!0],version:!0,agent:{version:[z,!0]},environment:!0}},dt={"*":!0,headers:{"*":!0}},pt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:dt},response:dt},ht={name:[z,!0],type:[z,!0],id:[z,!0],trace_id:[z,!0],parent_id:[z,!0],transaction_id:[z,!0],subtype:!0,action:!0,context:pt},vt={name:!0,parent_id:!0,type:[z,!0],id:[z,!0],trace_id:[z,!0],span_count:{started:[z,!0]},context:pt},lt={id:[z,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:pt};function gt(t){return null==t||""===t||void 0===t}function mt(t,e,n){var r,i,o,a,s=(r=t[e],i=n[0],o=n[1],void 0===i&&(i=z),void 0===o&&(o=!1),void 0===a&&(a="N/A"),o&&gt(r)&&(r=a),"string"==typeof r?r.substring(0,i):r);gt(s)?delete t[e]:t[e]=s}function yt(r,i,o){void 0===r&&(r={}),void 0===o&&(o=i);for(var a=Object.keys(r),s=[],t=function(t){var e=a[t],n=!0===r[e]?s:r[e];Array.isArray(n)?"*"===e?Object.keys(o).forEach(function(t){return mt(o,t,n)}):mt(o,e,n):yt(n,i,o[e])},e=0;e<a.length;e++)t(e);return i}var _t=function(){function t(t,e,n){this._apmServer=t,this._configService=e,this._transactionService=n}var e=t.prototype;return e.createErrorDataModel=function(t){var e=ut(t),n=e.filter(function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}),r="(inline script)",i=n[n.length-1];i&&i.filename&&(r=i.filename);var o=t.message,a=t.error,s=o,c="",u={};a&&"object"==typeof a&&(s=s||a.message,c=a.name,u=this._getErrorProperties(a)),c||s&&-1<s.indexOf(":")&&(c=s.split(":")[0]);var f=this._configService.get("context"),d=w({},l(),f,u),p={id:v(),culprit:r,exception:{message:s,stacktrace:n,type:c},context:d},h=this._transactionService.getCurrentTransaction();return h&&(p.trace_id=h.traceId,p.parent_id=h.id,p.transaction_id=h.id,p.transaction={type:h.type,sampled:h.sampled}),yt(lt,p)},e.logErrorEvent=function(t,e){if(void 0!==t){var n=this.createErrorDataModel(t);if(void 0!==n.exception.message)return e?this._apmServer.sendErrors([n]):this._apmServer.addError(n)}},e.registerGlobalEventListener=function(){var e=this;window.addEventListener("error",function(t){return e.logErrorEvent(t)})},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},e._getErrorProperties=function(n){var r={};return Object.keys(n).forEach(function(t){if("stack"!==t){var e=n[t];if(null!==e){switch(typeof e){case"function":return;case"object":if("function"!=typeof e.toISOString)return;e=e.toISOString()}r[t]=e}}}),r},t}(),St=function(r){r.registerServiceCreator("ErrorLogging",function(){var t=r.getService("ApmServer"),e=r.getService("ConfigService"),n=r.getService("TransactionService");return new _t(t,e,n)})},wt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],bt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Tt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,o=n.slashes,a=!r&&!o,s=this.getLocation(),c=wt.slice();i=i.replace("\\","/");for(var u=0;u<c.length;u++){var f=c[u],d=f[0],p=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var h=f[2];if(h){var v=i.lastIndexOf(d);e=Math.max(e,v),this[p]=i.slice(0,e),i=i.slice(e+h)}else this[p]=i.slice(e),i=i.slice(0,e)}}else this[p]=i;this[p]=this[p]||a&&f[3]&&s[p]||"",f[3]&&(this[p]=this[p].toLowerCase())}this.relative=a,this.protocol=r||s.protocol||"",this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null",this.href=this.toString()}var e=t.prototype;return e.toString=function(){var t=this.protocol;if(t+="//",this.auth){var e="[REDACTED]",n=this.auth.split(":");t+=(n[0]?e:"")+(n[1]?":"+e:"")+"@"}return t+=this.host,t+=this.path,t+=this.query,t+=this.hash},e.getLocation=function(){var t={};return"undefined"!=typeof window&&(t=window),t.location},e.extractProtocol=function(t){var e=bt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Et=function(){function t(t,e,n,r){this._apmServer=t,this._configService=e,this._logginService=n,this._transactionService=r}var e=t.prototype;return e.init=function(t){var n=this;void 0===t&&(t={}),this._configService.events.observe(U+":after",function(t){var e=n.createTransactionPayload(t);e&&n._apmServer.addTransaction(e)}),t[Y]&&nt.observe(Y,this.getHistorySub()),t[V]&&nt.observe(V,this.getXHRSub()),t[X]&&nt.observe(X,this.getFetchSub())},e.getHistorySub=function(){var n=this._transactionService;return function(t,e){e.source===Y&&t===R&&n.startTransaction(e.data.title,"route-change",{canReuse:!0})}},e.getXHRSub=function(){var n=this;return function(t,e){e.source!==V||C.fetchInProgress||n.processAPICalls(t,e)}},e.getFetchSub=function(){var n=this;return function(t,e){e.source===X&&n.processAPICalls(t,e)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===F&&e.data){var i=new Tt(e.data.url),o=e.data.method+" "+(i.relative?i.path:g(i.href)),a=r.startSpan(o,"external.http"),s=r.addTask();if(!a)return;var c=n.get("distributedTracing"),u=n.get("distributedTracingOrigins"),f=new Tt(window.location.href),d=h(i.origin,f.origin)||h(i.origin,u),p=e.data.target;c&&d&&p&&this.injectDtHeader(a,p),a.addContext({http:{method:e.data.method,url:i.href}}),a.sync=e.data.sync,e.data.span=a,e.id=s}t===R&&e.data&&e.data.span&&(void 0!==e.data.target.status?e.data.span.addContext({http:{status_code:e.data.target.status}}):e.data.response&&e.data.span.addContext({http:{status_code:e.data.response.status}}),e.data.span.end()),t===R&&e.id&&r.removeTask(e.id)},e.injectDtHeader=function(t,e){var n,r=this._configService,i=r.get("distributedTracingHeaderName"),o=r.get("distributedTracingHeaderValueCallback")(t),a=/^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/.test(n=o)&&"00000000000000000000000000000000"!==n.slice(3,35)&&"0000000000000000"!==n.slice(36,52);i&&o&&a&&("function"==typeof e.setRequestHeader?e.setRequestHeader(i,o):e.headers&&"function"==typeof e.headers.append?e.headers.append(i,o):e[i]=o)},e.extractDtHeader=function(t){var e=this._configService.get("distributedTracingHeaderName");if(t)return function(t){var e=/^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/.exec(t);if(e){var n="00"!==e[4];return{traceId:e[2],id:e[3],sampled:n}}}(t[e])},e.setTransactionContext=function(t){var e=this._configService.get("context");e&&t.addContext(e)},e.filterTransaction=function(t){var e=this._configService.get("transactionDurationThreshold"),n=t.duration();if(!n)return!1;if(e<n)return!1;if(0===t.spans.length)return!1;t.sampled||t.resetSpans();var r=this._configService.get("browserResponsivenessInterval");if(this._configService.get("checkBrowserResponsiveness")&&!t.isHardNavigation){var i=this._configService.get("browserResponsivenessBuffer");if(!this.checkBrowserResponsiveness(t,r,i))return!1}return!0},e.adjustTransactionTime=function(t){var e=t.spans,n=function(t){for(var e=t[0],n=1;n<t.length;n++){var r=t[n];e._start>r._start&&(e=r)}return e}(e);n&&n._start<t._start&&(t._start=n._start);var r=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n];-1===String(r.type).indexOf("external")&&(!e||e._end<r._end)&&(e=r)}return e}(e);r&&r._end>t._end&&(t._end=r._end);for(var i=t._end,o=0;o<e.length;o++){var a=e[o];a._end>i&&(a._end=i,a.type+=".truncated"),a._start>i&&(a._start=i)}},e.prepareTransaction=function(e){if(e.spans.sort(function(t,e){return t._start-e._start}),this._configService.get("groupSimilarSpans")){var t=this._configService.get("similarSpanThreshold");e.spans=this.groupSmallContinuouslySimilarSpans(e,t)}e.spans=e.spans.filter(function(t){return 0<t.duration()&&t._start>=e._start&&t._end<=e._end}),this.setTransactionContext(e)},e.createTransactionDataModel=function(n){var t=this._configService.get("context"),r=n._start,e=n.spans.map(function(t){var e={id:t.id,transaction_id:n.id,parent_id:t.parentId||n.id,trace_id:n.traceId,name:t.name,type:t.type,subType:t.subType,action:t.action,sync:t.sync,start:t._start-r,duration:t.duration(),context:t.context};return yt(ht,e)}),i=w({},t,n.context),o={id:n.id,trace_id:n.traceId,name:n.name,type:n.type,duration:n.duration(),spans:e,context:i,marks:n.marks,span_count:{started:e.length},sampled:n.sampled};return yt(vt,o)},e.createTransactionPayload=function(t){if(this.adjustTransactionTime(t),this.prepareTransaction(t),this.filterTransaction(t))return this.createTransactionDataModel(t)},e.convertTransactionsToServerModel=function(t){var e=this;return t.map(function(t){return e.createTransactionDataModel(t)})},e.groupSmallContinuouslySimilarSpans=function(o,a){var s=o.duration(),c=[],u=1;return o.spans.forEach(function(t,e){if(0===c.length)c.push(t);else{var n=c[c.length-1],r=n.type===t.type&&n.subType===t.subType&&n.action===t.action&&n.name===t.name&&t.duration()/s<a&&(t._start-n._end)/s<a,i=o.spans.length===e+1;r&&(u++,n._end=t._end),1<u&&(!r||i)&&(n.name=u+"x "+n.name,u=1),r||c.push(t)}}),c},e.checkBrowserResponsiveness=function(t,e,n){var r=t.browserResponsivenessCounter;if(void 0===e||void 0===r)return!0;var i=t.duration();return Math.floor(i/e)<=r+n},t}(),xt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=B),e||(e="custom"),this.options=n,this.name=t,this.type=e,this.id=this.options.id||v(16),this.traceId=this.options.traceId,this.sampled=this.options.sampled,this.timestamp=this.options.timestamp||Date.now(),this.ended=!1,this._start=window.performance.now(),this._end=void 0,this.onEnd=this.options.onEnd}var e=t.prototype;return e.ensureContext=function(){this.context||(this.context={})},e.addTags=function(t){console.warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(e){this.ensureContext();var n=this.context;n.tags||(n.tags={}),Object.keys(e).forEach(function(t){return f(t,e[t],n.tags)})},e.addContext=function(t){t&&(this.ensureContext(),w(this.context,t))},e.end=function(){this.ended||(this.ended=!0,this._end=window.performance.now(),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){if(b(this._end)||b(this._start))return null;var t=this._end-this._start;return parseFloat(t)},t}();var Ct=function(o){var t,e;function n(t,e,n){var r;if((r=o.call(this,t,e,n)||this).parentId=r.options.parentId,r.subType=void 0,r.action=void 0,-1!==r.type.indexOf(".")){var i=r.type.split(".",3);r.type=i[0],r.subType=i[1],r.action=i[2]}return r.sync=r.options.sync,r}return e=o,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e,n}(xt);var Lt=function(i){var t,e;function n(t,e,n){var r;return(r=i.call(this,t,e,n)||this).traceId=v(),r.marks=void 0,r.spans=[],r._activeSpans={},r.nextAutoTaskId=1,r._scheduledTasks=[],r.isHardNavigation=!1,r.sampled=Math.random()<=r.options.transactionSampleRate,r}e=i,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e;var r=n.prototype;return r.addMarks=function(t){this.marks=w(this.marks||{},t)},r.mark=function(t){var e=E(t),n=window.performance.now()-this._start,r={};r[e]=n,this.addMarks({custom:r})},r.canReuse=function(t){return void 0===t&&(t=5e3),!!this.options.canReuse&&!this.ended&&performance.now()-this._start<t},r.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=S(this.options,n))},r.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=S({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var o=new Ct(t,e,i);return this._activeSpans[o.id]=o}},r.isFinished=function(){return 0===this._scheduledTasks.length},r.detectFinish=function(){this.isFinished()&&this.end()},r.end=function(){if(!this.ended){for(var t in this.ended=!0,this._end=window.performance.now(),this._activeSpans){var e=this._activeSpans[t];e.type=e.type+".truncated",e.end()}var n=l();this.addContext(n),this.callOnEnd()}},r.addTask=function(t){if(void 0===t&&(t="task"+this.nextAutoTaskId++),-1==this._scheduledTasks.indexOf(t))return this._scheduledTasks.push(t),t},r.removeTask=function(t){var e=this._scheduledTasks.indexOf(t);-1<e&&this._scheduledTasks.splice(e,1),this.detectFinish()},r.resetSpans=function(){this.spans=[]},r._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id]},n}(xt),Ot=[["domainLookupStart","domainLookupEnd","Domain lookup"],["connectStart","connectEnd","Making a connection to the server"],["requestStart","responseEnd","Requesting and receiving the document"],["domLoading","domInteractive","Parsing the document, executing sync. scripts"],["domContentLoadedEventStart","domContentLoadedEventEnd",'Fire "DOMContentLoaded" event'],["loadEventStart","loadEventEnd",'Fire "load" event']];function It(t,e,n,r){return"number"==typeof t&&"number"==typeof e&&n<=t&&t<e&&e-n<=r&&e-t<D&&t-n<D&&e-n<D}function Nt(t){var e={transfer_size:t.transferSize,encoded_body_size:t.encodedBodySize,decoded_body_size:t.decodedBodySize},n=function(t){void 0===t&&(t=[]);for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.duration,a=r.description,s=i;a&&(s+=";desc="+a),o&&(s+=";dur="+o),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function At(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o="resource";n&&(o+="."+n);var a=g(e),s=new Ct(a,o);return s.addContext({http:{url:e,response:Nt(t)}}),s._start=r,s.end(),s._end=i,s}function kt(e){var t=window.performance;if(e.isHardNavigation&&t&&t.timing){var n=t.timing;if(e.marks&&e.marks.custom){var r=e.marks.custom;Object.keys(r).forEach(function(t){r[t]+=e._start})}e._start=0;var i=e._end;if(function(t,e,n){for(var r=[],i=0;i<Ot.length;i++){var o=t[Ot[i][0]],a=t[Ot[i][1]];if(It(o,a,e,n)){var s=new Ct(Ot[i][2],"hard-navigation.browser-timing");"requestStart"===Ot[i][0]&&(s.pageResponse=!0),s._start=o-e,s.ended=!0,s._end=a-e,r.push(s)}}return r}(n,n.fetchStart,i).forEach(function(t){t.traceId=e.traceId,t.sampled=e.sampled,t.pageResponse&&e.options.pageLoadSpanId&&(t.id=e.options.pageLoadSpanId),e.spans.push(t)}),"function"==typeof t.getEntriesByType){for(var o=t.getEntriesByType("resource"),a=[],s=0;s<e.spans;s++){var c=e.spans[s];"external"===c.type&&"http"===c.subType||a.push(c.name.split(" ")[1])}(function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.initiatorType,s=o.name,c=o.startTime,u=o.responseEnd;if("xmlhttprequest"!==a&&"fetch"!==a&&s)if(-1!==H.indexOf(a)){if(!It(c,u,0,n))continue;r.push(At(t[i]))}else{if(null!=a)continue;for(var f=!1,d=0;d<e.length;d++){var p=s.lastIndexOf(e[d]);if(-1<p&&p===s.length-e[d].length){f=!0;break}}!f&&It(c,u,0,n)&&r.push(At(t[i]))}}return r})(o,a,i).forEach(function(t){return e.spans.push(t)}),function(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=i.name,a=i.startTime,s=i.duration,c=a+s;if(!(s<=Q)&&It(a,c,0,e)){var u=new Ct(o,"app");u._start=a,u.end(),u._end=c,n.push(u)}}return n}(t.getEntriesByType("measure"),i).forEach(function(t){return e.spans.push(t)});var u=t.getEntriesByType("navigation");u&&0<u.length&&(u=u[0],e.addContext({response:Nt(u)}))}}}var Ft=function(){function t(t,e){this._config=e,this._logger=t,this.currentTransaction=void 0,this._alreadyCapturedPageLoad=!1}var e=t.prototype;return e.ensureCurrentTransaction=function(t){t||(t=this.createPerfOptions());var e=this.getCurrentTransaction();return e||(t.canReuse=!0,this.createTransaction(void 0,void 0,t))},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.setCurrentTransaction=function(t){this.currentTransaction=t},e.createTransaction=function(t,e,n){var r=new Lt(t,e,n);return this.setCurrentTransaction(r),n.checkBrowserResponsiveness&&this.startCounter(r),r},e.startCounter=function(t){t.browserResponsivenessCounter=0;var e=this._config.get("browserResponsivenessInterval");if(void 0!==e)var n=setInterval(function(){t.ended?window.clearInterval(n):t.browserResponsivenessCounter++},e)},e.capturePageLoadMetrics=function(t){if(this._config.get("capturePageLoad")&&!this._alreadyCapturedPageLoad&&t.isHardNavigation)return kt(t),t.addMarks(x()),self._alreadyCapturedPageLoad=!0},e.createPerfOptions=function(t){var e=this._config.config;return S({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,transactionSampleRate:e.transactionSampleRate,checkBrowserResponsiveness:e.checkBrowserResponsiveness},t)},e.startTransaction=function(t,e,n){var r=this,i=this.createPerfOptions(n),o=this.getCurrentTransaction();return o?o.canReuse()&&i.canReuse?o.redefine(t,void 0,i):(o.end(),o=this.createTransaction(t,e,i)):o=this.createTransaction(t,e,i),e===q&&(o.isHardNavigation=!0,i.pageLoadTraceId&&(o.traceId=i.pageLoadTraceId),i.pageLoadSampled&&(o.sampled=i.pageLoadSampled),o.name===B&&i.pageLoadTransactionName&&(o.name=i.pageLoadTransactionName)),this._config.events.send("transaction:start",[o]),o.onEnd=function(){return K.Promise.resolve().then(function(){if(!r.shouldIgnoreTransaction(o.name))if(o.type===q){var t=r._config.get("pageLoadTransactionName");o.name===B&&t&&(o.name=t),r.capturePageLoadMetrics(o)&&r.add(o)}else r.add(o)},function(t){0})},o},e.shouldIgnoreTransaction=function(t){var e=this._config.get("ignoreTransactions");if(e&&e.length)for(var n=0;n<e.length;n++){var r=e[n];if("function"==typeof r.test){if(r.test(t))return!0}else if(r===t)return!0}return!1},e.startSpan=function(t,e,n){var r=this.ensureCurrentTransaction();if(r)return r.startSpan(t,e,n)},e.add=function(t){this._config.events.send(U,[t])},e.addTask=function(t){var e=this.ensureCurrentTransaction();if(e){t=e.addTask(t);0}return t},e.removeTask=function(t){var e=this.getCurrentTransaction();e&&e.removeTask(t)},e.detectFinish=function(){var t=this.getCurrentTransaction();t&&t.detectFinish()},t}(),Rt=function(i){i.registerServiceCreator("TransactionService",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService");return new Ft(e,t)}),i.registerServiceCreator("PerformanceMonitoring",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService"),n=i.getService("ApmServer"),r=i.getService("TransactionService");return new Et(n,t,e,r)})},jt=function(){function t(t,e){e||(e={}),this.onFlush=t,this.items=[],this.queueLimit=e.queueLimit||-1,this.flushInterval=e.flushInterval||0,this.timeoutId=void 0}var e=t.prototype;return e._setTimer=function(){var t=this;this.timeoutId=setTimeout(function(){t.flush()},this.flushInterval)},e.flush=function(){this.onFlush(this.items),this._clear()},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.add=function(t){this.items.push(t),-1!==this.queueLimit&&this.items.length>=this.queueLimit?this.flush():void 0===this.timeoutId&&this._setTimer()},t}();var Mt=function(e,n,t){var r,i=t.context||this,o=t.limit,a=t.interval,s=t.countFn||function(){},c=0;return function(){var t="function"==typeof s&&s.apply(i,arguments);return"number"!=typeof t&&(t=1),c+=t,void 0===r&&(r=setTimeout(function(){r=void(c=0)},a)),o<c?"function"==typeof n?n.apply(i,arguments):void 0:e.apply(i,arguments)}},Pt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Ht=function(){function t(t,e){this._configService=t,this._loggingService=e,this.errorQueue=void 0,this.transactionQueue=void 0,this.throttleAddError=void 0,this.throttleAddTransaction=void 0,this.initialized=!1,this.ndjsonSpan={}}var e=t.prototype;return e.init=function(){this.initialized||(this.initialized=!0,this.initErrorQueue(),this.initTransactionQueue())},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"js-base",version:t.version},language:{name:"javascript"},environment:t.get("environment")}};return yt(ft,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,e,{"Content-Type":"application/x-ndjson"})},e._constructError=function(t){var e=t.url,n=t.status,r=(t.responseText,e+" HTTP status: "+n);return new Error(r)},e._makeHttpRequest=function(e,o,a,s){return new K.Promise(function(n,r){var i=new window.XMLHttpRequest;if(i[I]=!0,i.open(e,o,!0),i.timeout=1e4,s)for(var t in s)s.hasOwnProperty(t)&&i.setRequestHeader(t,s[t]);i.onreadystatechange=function(){if(4===i.readyState){var t=i.status,e=i.responseText;0===t||399<t&&t<600?r({url:o,status:t,responseText:e}):n(e)}},i.onerror=function(){var t=i.status,e=i.responseText;r({url:o,status:t,responseText:e})},i.send(a)})},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new jt(t,{queueLimit:e,flushInterval:n})},e.initErrorQueue=function(){var n=this;this.errorQueue&&this.errorQueue.flush(),this.errorQueue=this._createQueue(function(t){var e=n.sendErrors(t);e&&e.catch(function(t){n._loggingService.warn("Failed sending errors!",n._constructError(t))})});var t=this._configService.get("errorThrottleLimit"),e=this._configService.get("errorThrottleInterval");this.throttleAddError=Mt(this.errorQueue.add.bind(this.errorQueue),function(){return n._loggingService.warn("Dropped error due to throttling!")},{limit:t,interval:e})},e.initTransactionQueue=function(){var n=this;this.transactionQueue&&this.transactionQueue.flush(),this.transactionQueue=this._createQueue(function(t){var e=n.sendTransactions(t);e&&e.catch(function(t){n._loggingService.warn("Failed sending transactions!",n._constructError(t))})});var t=this._configService.get("transactionThrottleLimit"),e=this._configService.get("transactionThrottleInterval");this.throttleAddTransaction=Mt(this.transactionQueue.add.bind(this.transactionQueue),function(){return n._loggingService.warn("Dropped transaction due to throttling!")},{limit:t,interval:e})},e.addError=function(t){this.errorQueue||this.initErrorQueue(),this.throttleAddError(t)},e.addTransaction=function(t){this.transactionQueue||this.initTransactionQueue(),this.throttleAddTransaction(t)},e.ndjsonErrors=function(t){return t.map(function(t){return Pt.stringify({error:t})})},e.ndjsonTransactions=function(t){var n=this.ndjsonSpan;return t.map(function(t){var e="";return t.spans&&(e=t.spans.map(function(t){return n.span=t,Pt.stringify(n)}).join(""),delete t.spans),Pt.stringify({transaction:t})+e})},e._send=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e="transaction"),0!==t.length){var n={service:this.createMetaData().service,data:t},r=this._configService.applyFilters(n);if(r){var i,o=this._configService.getEndpointUrl();if("errors"===e)i=this.ndjsonErrors(r.data);else{if("transaction"!==e)return void 0;i=this.ndjsonTransactions(r.data)}i.unshift(Pt.stringify({metadata:{service:r.service}}));var a=i.join("");return this._postJson(o,a)}this._loggingService.warn("Dropped payload due to filtering!")}},e.sendTransactions=function(t){return this._send(t)},e.sendErrors=function(t){return this._send(t,"errors")},t}();var Dt=function(){function t(){this.config={},this.defaults={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",serverUrlPrefix:"/intake/v2/rum/events",active:!0,instrument:!0,disableInstrumentations:[],debug:!1,logLevel:"warn",browserResponsivenessInterval:500,browserResponsivenessBuffer:3,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,capturePageLoad:!0,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,sendPageLoadTransaction:!0,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderValueCallback:c,distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,context:{}},this.events=new et,this.filters=[],this.version=""}var e=t.prototype;return e.init=function(){var t=function(t){if(!t)return{};for(var e={},n=/^data-([\w-]+)$/,r=t.attributes,i=0;i<r.length;i++){var o=r[i];if(n.test(o.nodeName)){var a=o.nodeName.match(n)[1],s=a.split("-").map(function(t,e){return 0<e?t.charAt(0).toUpperCase()+t.substring(1):t}).join("");e[s]=o.value||o.nodeValue}}return e}(_());this.setConfig(t)},e.isActive=function(){return this.get("active")},e.setVersion=function(t){this.version=t},e.addFilter=function(t){if("function"!=typeof t)throw new Error("Argument to must be function");this.filters.push(t)},e.applyFilters=function(t){for(var e=0;e<this.filters.length;e++)if(!(t=this.filters[e](t)))return;return t},e.get=function(t){return t.split(".").reduce(function(t,e){return t&&t[e]},this.config)},e.getEndpointUrl=function(){return this.config.serverUrl+this.config.serverUrlPrefix},e.set=function(t,e){for(var n=t.split("."),r=n.length-1,i=this.config,o=0;o<r+1;o++){var a=n[o];if(a)if(o===r)i[a]=e;else{var s=i[a]||{};i[a]=s,i=s}}},e.setUserContext=function(t){void 0===t&&(t={});var e={},n=t,r=n.id,i=n.username,o=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof o&&(e.email=o),this.set("context.user",e)},e.setCustomContext=function(t){t&&"object"==typeof t&&this.set("context.custom",t)},e.addLabels=function(e){var n=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(e).forEach(function(t){return f(t,e[t],n.config.context.tags)})},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),this.config=w({},this.defaults,this.config,t),this.events.send($,[this.config])},e.validate=function(e){void 0===e&&(e={});var n=["serviceName","serverUrl"],r={missing:[],invalid:[]};return Object.keys(e).forEach(function(t){-1===n.indexOf(t)||e[t]||r.missing.push(t)}),e.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(e.serviceName)&&r.invalid.push({key:"serviceName",value:e.serviceName,allowed:"a-z, A-Z, 0-9, _, -, <space>"}),r},t}(),qt=function(){function t(t){t||(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"info",this.prefix=t.prefix||"",this.resetLogMethods()}var e=t.prototype;return e.shouldLog=function(t){return this.levels.indexOf(t)>=this.levels.indexOf(this.level)},e.setLevel=function(t){this.level=t,this.resetLogMethods()},e.resetLogMethods=function(){var o=this;this.levels.forEach(function(i){o[i]=o.shouldLog(i)?function(){var t,e=o.prefix;switch(i){case"trace":case"debug":t="info";break;default:t=i}var n=arguments;e&&("function"==typeof e&&(e=e(i)),n[0]=e+n[0]);if(console){var r=console[t]?console[t]:console.log;"function"==typeof r&&r.apply(console,n)}}:T})},t}(),Bt=function(){function t(){this._serviceCreators={},this._serviceInstances={},this.initialized=!1}var e=t.prototype;return e.registerCoreServices=function(){var t=this;this.registerServiceCreator("ConfigService",function(){return new Dt}),this.registerServiceCreator("LoggingService",function(){return new qt}),this.registerServiceCreator("ApmServer",function(){return new Ht(t.getService("ConfigService"),t.getService("LoggingService"))})},e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService("ConfigService");t.init();var e=this.getService("LoggingService");n(e,t),t.events.observe($,function(){n(e,t)}),this.getService("ApmServer").init()}function n(t,e){var n=e.get("debug"),r=e.get("logLevel");!0===n&&"trace"!==r?t.setLevel("debug"):t.setLevel(r)}},e.registerServiceCreator=function(t,e){this._serviceCreators[t]=e},e.registerServiceInstance=function(t,e){this._serviceInstances[t]=e},e.getService=function(t){if(!this._serviceInstances[t]){if("function"!=typeof this._serviceCreators[t])throw new Error("Can not get service, No creator for: "+t);this._serviceInstances[t]=this._serviceCreators[t](this)}return this._serviceInstances[t]},t}();var Qt,zt=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){if(this.isEnabled()&&!this._initialized){this._initialized=!0;var e=this.serviceFactory.getService("ConfigService");e.setVersion("4.4.4"),this.config(t);var n=this.serviceFactory.getService("LoggingService");if(!e.isActive())return n.info("RUM agent is inactive"),this;this.serviceFactory.init();var r=(i=e.get("instrument"),o=e.get("disableInstrumentations"),(a={})[V]=!1,a[X]=!1,a[Y]=!1,a[q]=!1,a.error=!1,s=a,i&&Object.keys(s).forEach(function(t){-1===o.indexOf(t)&&(s[t]=!0)}),s);if(this.serviceFactory.getService("PerformanceMonitoring").init(r),r.error)this.serviceFactory.getService("ErrorLogging").registerGlobalEventListener();r[q]&&e.get("sendPageLoadTransaction")&&this._sendPageLoadMetrics()}var i,o,a,s;return this},e._sendPageLoadMetrics=function(){var t=this.serviceFactory.getService("TransactionService").startTransaction(void 0,q,{canReuse:!0});t&&t.addTask(q);var e=function(){setTimeout(function(){t&&t.removeTask(q)})};"complete"===document.readyState?e():window.addEventListener("load",e)},e.isEnabled=function(){return!this._disable},e.observe=function(t,e){this.serviceFactory.getService("ConfigService").events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService("ConfigService"),n=e.validate(t),r=n.missing,o=n.invalid;if(0===r.length&&0===o.length)e.setConfig(t);else{var i=this.serviceFactory.getService("LoggingService"),a="RUM Agent isn't correctly configured: ";0<r.length&&(a+="Missing config - "+r.join(", "),0<o.length&&(a+=", ")),o.forEach(function(t,e){var n=t.key,r=t.value,i=t.allowed;a+=n+' "'+r+'" contains invalid characters! (allowed: '+i+")"+(e!==o.length-1?", ":"")}),i.error(a),e.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService("ConfigService").setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService("ConfigService").setCustomContext(t)},e.addTags=function(t){this.serviceFactory.getService("LoggingService").warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(t){this.serviceFactory.getService("ConfigService").addLabels(t)},e.setInitialPageLoadName=function(t){this.isEnabled()&&this.serviceFactory.getService("ConfigService").setConfig({pageLoadTransactionName:t})},e.startTransaction=function(t,e,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startTransaction(t,e,n)},e.startSpan=function(t,e){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e)},e.getCurrentTransaction=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").getCurrentTransaction()},e.getTransactionService=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService")},e.captureError=function(t){if(this.isEnabled())return this.serviceFactory.getService("ErrorLogging").logError(t)},e.addFilter=function(t){this.serviceFactory.getService("ConfigService").addFilter(t)},t}(),Ut=(ot||(ot=!0,u()?(it(),at=!0):"undefined"!=typeof window&&console.log("APM: Platform is not supported!")),at),$t=((Qt=new Bt).registerCoreServices(),St(Qt),Rt(Qt),Qt),Vt=new zt($t,!Ut);"undefined"!=typeof window&&(window.elasticApm=Vt);var Xt=Vt.init.bind(Vt),Yt=n(4),Jt=n(0),Wt=n(1);var Gt=function(r){var t,e;function n(t,e){var n;return(n=r.call(this)||this).__tracer=t,n.span=e,n.isTransaction=e instanceof Lt,n.spanContext={id:e.id,traceId:e.traceId,sampled:e.sampled},n}e=r,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e;var i=n.prototype;return i._context=function(){return this.spanContext},i._tracer=function(){return this.__tracer},i._setOperationName=function(t){this.span.name=t},i._addTags=function(t){var e=S({},t);if(e.type&&(this.span.type=e.type,delete e.type),this.isTransaction){var n=e["user.id"],r=e["user.username"],i=e["user.email"];(n||r||i)&&(this.span.addContext({user:{id:n,username:r,email:i}}),delete e["user.id"],delete e["user.username"],delete e["user.email"])}this.span.addLabels(e)},i._log=function(t,e){"error"===t.event&&(t["error.object"]?this.__tracer.errorLogging.logError(t["error.object"]):t.message&&this.__tracer.errorLogging.logError(t.message))},i._finish=function(t){this.span.end(),t&&(this.span._end=t-p())},n}(Wt.Span);var Zt=function(o){var t,e;function n(t,e,n,r){var i;return(i=o.call(this)||this).performanceMonitoring=t,i.transactionService=e,i.loggingService=n,i.errorLogging=r,i}e=o,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e;var r=n.prototype;return r._startSpan=function(t,e){var n,r={};if(e)if(r.timestamp=e.startTime,e.childOf)r.parentId=e.childOf.id;else if(e.references&&0<e.references.length){e.references.length;var i=function(t,e,n){if(null==t)throw new TypeError("array is null or not defined");var r=Object(t),i=r.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var o=0;o<i;){var a=r[o];if(e.call(n,a,o,r))return a;o++}}(e.references,function(t){return t.type()===Jt.REFERENCE_CHILD_OF});i&&(r.parentId=i.referencedContext().id)}if(!(n=this.transactionService.getCurrentTransaction()?this.transactionService.startSpan(t,void 0,r):this.transactionService.startTransaction(t,void 0,r)))return new Wt.Span;r.timestamp&&(n._start=r.timestamp-p());var o=new Gt(this,n);return e&&e.tags&&o.addTags(e.tags),o},r._inject=function(t,e,n){switch(e){case Jt.FORMAT_TEXT_MAP:case Jt.FORMAT_HTTP_HEADERS:this.performanceMonitoring.injectDtHeader(t,n);break;case Jt.FORMAT_BINARY:0}},r._extract=function(t,e){var n;switch(t){case Jt.FORMAT_TEXT_MAP:case Jt.FORMAT_HTTP_HEADERS:n=this.performanceMonitoring.extractDtHeader(e);break;case Jt.FORMAT_BINARY:0}return n||(n=null),n},n}(Yt.Tracer);function Kt(t){return e=t.serviceFactory,n=e.getService("PerformanceMonitoring"),r=e.getService("TransactionService"),i=e.getService("ErrorLogging"),o=e.getService("LoggingService"),new Zt(n,r,o,i);var e,n,r,i,o}n.d(e,"createTracer",function(){return Kt}),n.d(e,"init",function(){return Xt}),n.d(e,"apm",function(){return Vt}),n.d(e,"apmBase",function(){return Vt}),n.d(e,"ApmBase",function(){return zt}),"undefined"!=typeof window&&window.elasticApm&&(window.elasticApm.createTracer=Kt.bind(window.elasticApm,window.elasticApm));e.default=Kt}]);
//# sourceMappingURL=elastic-apm-opentracing.umd.min.js.map
/*! For license information please see elastic-apm-rum.umd.min.js.LICENSE */
!function(n){var r={};function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}i.m=n,i.c=r,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=5)}([function(t,e,n){t.exports=function(){"use strict";function c(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},r=0,e=void 0,i=void 0,s=function(t,e){h[r]=t,h[r+1]=e,2===(r+=2)&&(i?i(v):y())},t="undefined"!=typeof window?window:void 0,o=t||{},a=o.MutationObserver||o.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<r;t+=2){var e=h[t],n=h[t+1];e(n),h[t]=void 0,h[t+1]=void 0}r=0}var l,p,g,m,y=void 0;function _(t,e){var n=this,r=new this.constructor(w);void 0===r[b]&&R(r);var i=n._state;if(i){var o=arguments[i-1];s(function(){return j(i,r,o,n._result)})}else A(n,r,t,e);return r}function S(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(w);return O(e,t),e}y=u?function(){return process.nextTick(v)}:a?(p=0,g=new a(v),m=document.createTextNode(""),g.observe(m,{characterData:!0}),function(){m.data=p=++p%2}):f?((l=new MessageChannel).port1.onmessage=v,function(){return l.port2.postMessage(0)}):void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0===(e=t.runOnLoop||t.runOnContext)?d():function(){e(v)}}catch(t){return d()}}():d();var b=Math.random().toString(36).substring(2);function w(){}var T=void 0,E=1,x=2;function L(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}function C(t,e,n){var r,i,o,a;e.constructor===t.constructor&&n===_&&e.constructor.resolve===S?(o=t,(a=e)._state===E?k(o,a._result):a._state===x?N(o,a._result):A(a,void 0,function(t){return O(o,t)},function(t){return N(o,t)})):void 0===n?k(t,e):c(n)?(r=e,i=n,s(function(e){var n=!1,t=L(i,r,function(t){n||(n=!0,r!==t?O(e,t):k(e,t))},function(t){n||(n=!0,N(e,t))},e._label);!n&&t&&(n=!0,N(e,t))},t)):k(t,e)}function O(e,t){if(e===t)N(e,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=t),null===r||"object"!==i&&"function"!==i)k(e,t);else{var n=void 0;try{n=t.then}catch(t){return void N(e,t)}C(e,t,n)}var r,i}function I(t){t._onerror&&t._onerror(t._result),F(t)}function k(t,e){t._state===T&&(t._result=e,t._state=E,0!==t._subscribers.length&&s(F,t))}function N(t,e){t._state===T&&(t._state=x,t._result=e,s(I,t))}function A(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+E]=n,i[o+x]=r,0===o&&t._state&&s(F,t)}function F(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,i=void 0,o=t._result,a=0;a<e.length;a+=3)r=e[a],i=e[a+n],r?j(n,r,i,o):i(o);t._subscribers.length=0}}function j(t,e,n,r){var i=c(n),o=void 0,a=void 0,s=!0;if(i){try{o=n(r)}catch(t){s=!1,a=t}if(e===o)return void N(e,new TypeError("A promises callback cannot return that same promise."))}else o=r;e._state!==T||(i&&s?O(e,o):!1===s?N(e,a):t===E?k(e,o):t===x&&N(e,o))}var P=0;function R(t){t[b]=P++,t._state=void 0,t._result=void 0,t._subscribers=[]}var M=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(w),this.promise[b]||R(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&k(this.promise,this._result))):N(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===T&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===S){var i=void 0,o=void 0,a=!1;try{i=e.then}catch(t){a=!0,o=t}if(i===_&&e._state!==T)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===q){var s=new n(w);a?N(s,o):C(s,e,i),this._willSettleAt(s,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===T&&(this._remaining--,t===x?N(r,n):this._result[e]=n),0===this._remaining&&k(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;A(t,void 0,function(t){return n._settledAt(E,e,t)},function(t){return n._settledAt(x,e,t)})},t}(),q=function(){function e(t){this[b]=P++,this._result=this._state=void 0,this._subscribers=[],w!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){O(e,t)},function(t){N(e,t)})}catch(t){N(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var n=this.constructor;return c(e)?this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){throw t})}):this.then(e,e)},e}();return q.prototype.then=_,q.all=function(t){return new M(this,t).promise},q.race=function(i){var o=this;return n(i)?new o(function(t,e){for(var n=i.length,r=0;r<n;r++)o.resolve(i[r]).then(t,e)}):new o(function(t,e){return e(new TypeError("You must pass an array to race."))})},q.resolve=S,q.reject=function(t){var e=new this(w);return N(e,t),e},q._setScheduler=function(t){i=t},q._setAsap=function(t){s=t},q._asap=s,q.polyfill=function(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=q},q.Promise=q}()},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(n,r,i){var o,a,s;!function(t,e){"use strict";a=[i(4)],void 0===(s="function"==typeof(o=function(s){var n=/(^|@)\S+\:\d+/,r=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/;function o(t,e,n){if("function"==typeof Array.prototype.map)return t.map(e,n);for(var r=new Array(t.length),i=0;i<t.length;i++)r[i]=e.call(n,t[i]);return r}function a(t,e,n){if("function"==typeof Array.prototype.filter)return t.filter(e,n);for(var r=[],i=0;i<t.length;i++)e.call(n,t[i])&&r.push(t[i]);return r}return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(r))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){var e=a(t.stack.split("\n"),function(t){return!!t.match(r)},this);return o(e,function(t){-1<t.indexOf("(eval ")&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(e.pop()),r=e.join(" ")||void 0,i=-1<function(t,e){{if("function"==typeof Array.prototype.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}}(["eval","<anonymous>"],n[0])?void 0:n[0];return new s(r,void 0,i,n[1],n[2],t)},this)},parseFFOrSafari:function(t){var e=a(t.stack.split("\n"),function(t){return!t.match(i)},this);return o(e,function(t){if(-1<t.indexOf(" > eval")&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new s(t);var e=t.split("@"),n=this.extractLocation(e.pop()),r=e.join("@")||void 0;return new s(r,void 0,n[0],n[1],n[2],t)},this)},parseOpera:function(t){return!t.stacktrace||-1<t.message.indexOf("\n")&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),r=[],i=2,o=n.length;i<o;i+=2){var a=e.exec(n[i]);a&&r.push(new s(void 0,void 0,a[2],a[1],void 0,n[i]))}return r},parseOpera10:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),r=[],i=0,o=n.length;i<o;i+=2){var a=e.exec(n[i]);a&&r.push(new s(a[3]||void 0,void 0,a[2],a[1],void 0,n[i]))}return r},parseOpera11:function(t){var e=a(t.stack.split("\n"),function(t){return!!t.match(n)&&!t.match(/^Error created at/)},this);return o(e,function(t){var e,n=t.split("@"),r=this.extractLocation(n.pop()),i=n.shift()||"",o=i.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(e=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===e||"[arguments not available]"===e?void 0:e.split(",");return new s(o,a,r[0],r[1],r[2],t)},this)}}})?o.apply(r,a):o)||(n.exports=s)}()},,function(n,r,t){var i,o,a;!function(t,e){"use strict";o=[],void 0===(a="function"==typeof(i=function(){function e(t){return!isNaN(parseFloat(t))&&isFinite(t)}function t(t,e,n,r,i,o){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==n&&this.setFileName(n),void 0!==r&&this.setLineNumber(r),void 0!==i&&this.setColumnNumber(i),void 0!==o&&this.setSource(o)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){return(this.getFunctionName()||"{anonymous}")+"("+(this.getArgs()||[]).join(",")+")"+(this.getFileName()?"@"+this.getFileName():"")+(e(this.getLineNumber())?":"+this.getLineNumber():"")+(e(this.getColumnNumber())?":"+this.getColumnNumber():"")}},t})?i.apply(r,o):i)||(n.exports=a)}()},function(t,e,n){"use strict";n.r(e);var r=n(1),o=n.n(r),i=[].slice;for(var a=[],s=0;s<256;++s)a[s]=(s+256).toString(16).substr(1);function c(t){if(t&&t.traceId&&t.id&&t.parentId){var e=t.sampled?"01":"00",n=t.sampled?t.id:t.parentId;return"00-"+t.traceId+"-"+n+"-"+e}}function v(e,t){var n=!1;return"string"==typeof t?n=e===t:Array.isArray(t)&&t.forEach(function(t){n||(n=v(e,t))}),n}function h(t){var e,n,r,i;return(e=o()(),r=n||0,[(i=a)[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")).substr(0,t)}function u(){return"undefined"!=typeof window&&"function"==typeof Array.prototype.forEach&&"function"==typeof JSON.stringify&&"function"==typeof Function.bind&&window.performance&&"function"==typeof window.performance.now&&"withCredentials"in new window.XMLHttpRequest}function f(t,e,n){if(n&&t){var r=T(t);return e&&(e=String(e)),n[r]=e,n}}var d=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function l(){return{page:{referer:document.referrer,url:window.location.href}}}function p(t){return t&&t.split("?")[0]}function g(t){return null!==t&&"object"==typeof t}function m(t,e,n){for(var r=0,i=e.length;r<i;++r){var o=e[r];if(g(o)||"function"==typeof o)for(var a=Object.keys(o),s=0,c=a.length;s<c;s++){var u=a[s],f=o[u];n&&g(f)?(g(t[u])||(t[u]=Array.isArray(f)?[]:{}),m(t[u],[f],!1)):t[u]=f}}return t}function y(){if("undefined"!=typeof document){var t=document.currentScript;return t||function(){if("undefined"!=typeof document)for(var t=document.getElementsByTagName("script"),e=0,n=t.length;e<n;e++){var r=t[e];if(0<r.src.indexOf("elastic"))return r}}()}}function _(t){return m(t,i.call(arguments,1),!1)}function S(t){return m(t,i.call(arguments,1),!0)}function b(t){return void 0===t}function w(){}function T(t){return t.replace(/[.*"]/g,"_")}function E(){var n,r,i,t=(n=window.performance.timing,r=n.fetchStart,i={},d.forEach(function(t){var e=n[t];e&&r<=e&&(i[t]=e-r)}),i),e=function(){var t={},e=window.performance;if(e.getEntriesByType){var n=e.getEntriesByType("paint");if(0<n.length)for(var r=e.timing,i=r.fetchStart-r.navigationStart,o=0;o<n.length;o++){var a=n[o],s=0<=i?a.startTime-i:a.startTime;t[a.name]=s}}return t}(),o={timeToFirstByte:t.responseStart,domInteractive:t.domInteractive,domComplete:t.domComplete};return e["first-contentful-paint"]&&(o.firstContentfulPaint=e["first-contentful-paint"]),{navigationTiming:t,agent:o}}var x={fetchInProgress:!1};function L(t){return"__apm_symbol__"+t}function C(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,o,a,s,c=L(e);if(r&&!(i=r[c])){i=r[c]=r[e];var u=r&&Object.getOwnPropertyDescriptor(r,e);if(!(s=u)||!1!==s.writable&&("function"!=typeof s.get||void 0!==s.set)){var f=n(i,c,e);r[e]=function(){return f(this,arguments)},o=r[e],a=i,o[L("OriginalDelegate")]=a}}return i}var O=L("xhrIgnore"),I=L("xhrSync"),k=L("xhrURL"),N=L("xhrMethod"),A="schedule",F="invoke",j="clear",P="addEventListener",R="removeEventListener",M=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],q=3e5,H="page-load",D="Unknown",Q=60,B=1024,U="transaction:end",z="config:change",$="xmlhttprequest",V="fetch",X="history",J=L("xhrTask"),Y=L("xhrListener"),G=L("xhrScheduled");function Z(a){var t=XMLHttpRequest.prototype,s=t[P],c=t[R];if(!s){var e=window.XMLHttpRequestEventTarget;if(e){var n=e.prototype;s=n[P],c=n[R]}}var u="readystatechange";function f(t){t.state=F,t.ignore||a(F,t)}var r=C(t,"open",function(){return function(t,e){return t[N]=e[0],t[k]=e[1],t[I]=!1===e[2],r.apply(t,e)}}),d=C(t,"send",function(){return function(t,e){var n={source:$,state:"",type:"macroTask",ignore:t[O],data:{target:t,method:t[N],sync:t[I],url:t[k],args:e,aborted:!1}},r=function(t){XMLHttpRequest[G]=!1,t.state=A,t.ignore||a(A,t);var e=t.data,n=e.target,r=n[Y];s||(s=n[P],c=n[R]),r&&c.call(n,u,r);var i=n[Y]=function(){n.readyState===n.DONE&&!e.aborted&&XMLHttpRequest[G]&&t.state===A&&f(t)};s.call(n,u,i),n[J]||(n[J]=t);var o=d.apply(n,e.args);return XMLHttpRequest[G]=!0,o}(n);return t[I]&&f(n),r}}),i=C(t,"abort",function(){return function(t,e){var n,r=t[J];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;(n=r).state=j,a(j,n),n.data.aborted=!0}return i.apply(t,e)}})}var K=n(0);function W(s){if(window.fetch&&window.Request){var c=window.fetch;window.fetch=function(t,e){var i,n,o=this,r=arguments;if("string"==typeof t)i=new Request(t,e),n=t;else{if(!t)return c.apply(o,r);n=(i=t).url}var a={source:V,state:"",type:"macroTask",data:{target:i,method:i.method,sync:!1,url:n,args:r,aborted:!1}};return new K.Promise(function(e,n){var t,r;x.fetchInProgress=!0,(t=a).state=A,s(A,t);try{r=c.apply(o,[i])}catch(t){return n(t),a.data.error=t,u(a),void(x.fetchInProgress=!1)}r.then(function(t){e(t),K.Promise.resolve().then(function(){a.data.response=t,u(a)})},function(t){n(t),K.Promise.resolve().then(function(){a.data.error=t,u(a)})}),x.fetchInProgress=!1})}}function u(t){t.state=F,s(F,t)}}var tt=function(){function t(){this.observers={}}var e=t.prototype;return e.observe=function(e,n){var r=this;if("function"==typeof n)return this.observers[e]||(this.observers[e]=[]),this.observers[e].push(n),function(){var t=r.observers[e].indexOf(n);-1<t&&r.observers[e].splice(t,1)}},e.sendOnly=function(t,e){var n=this.observers[t];n&&n.forEach(function(t){try{t.apply(void 0,e)}catch(t){console.log(t,t.stack)}})},e.send=function(t,e){this.sendOnly(t+":before",e),this.sendOnly(t,e),this.sendOnly(t+":after",e)},t}(),et=new tt,nt=!1;function rt(){return nt||(nt=!0,Z(function(t,e){et.send($,[t,e])}),W(function(t,e){et.send(V,[t,e])}),function(r){if(window.history){var i=history.pushState;"function"==typeof i&&(history.pushState=function(t,e,n){r(F,{source:X,data:{state:t,title:e,url:n}}),i.apply(this,arguments)})}}(function(t,e){et.send(X,[t,e])})),et}var it=!1,ot=!1;var at=n(2),st=n.n(at);function ct(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=st.a.parse(e)}catch(t){}return 0===o.length&&(o=[{fileName:n,lineNumber:r,columnNumber:i}]),o.map(function(t){return t.functionName&&(t.functionName=(e=t.functionName,e=1<(n=(e=(e=(e=1<(n=e.split("/")).length?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>")).split(".")).length?n[n.length-1]:n[0])),t;var e,n}).map(function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,o=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var a,s,c,u,f=(void 0===(a=e)&&(a=""),"<anonymous>"===a&&(a=""),a),d=(s=f,c=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),-1<s.indexOf(c)&&(s=s.replace(c+"/","")),s);return(u=f)&&0===window.location.href.indexOf(u)&&(d="(inline script)"),{abs_path:e,filename:d,function:o,lineno:n,colno:r}})}var ut={service:{name:[B,!0],version:!0,agent:{version:[B,!0]},environment:!0}},ft={"*":!0,headers:{"*":!0}},dt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:ft},response:ft},ht={name:[B,!0],type:[B,!0],id:[B,!0],trace_id:[B,!0],parent_id:[B,!0],transaction_id:[B,!0],subtype:!0,action:!0,context:dt},vt={name:!0,parent_id:!0,type:[B,!0],id:[B,!0],trace_id:[B,!0],span_count:{started:[B,!0]},context:dt},lt={id:[B,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:dt};function pt(t){return null==t||""===t||void 0===t}function gt(t,e,n){var r,i,o,a,s=(r=t[e],i=n[0],o=n[1],void 0===i&&(i=B),void 0===o&&(o=!1),void 0===a&&(a="N/A"),o&&pt(r)&&(r=a),"string"==typeof r?r.substring(0,i):r);pt(s)?delete t[e]:t[e]=s}function mt(r,i,o){void 0===r&&(r={}),void 0===o&&(o=i);for(var a=Object.keys(r),s=[],t=function(t){var e=a[t],n=!0===r[e]?s:r[e];Array.isArray(n)?"*"===e?Object.keys(o).forEach(function(t){return gt(o,t,n)}):gt(o,e,n):mt(n,i,o[e])},e=0;e<a.length;e++)t(e);return i}var yt=function(){function t(t,e,n){this._apmServer=t,this._configService=e,this._transactionService=n}var e=t.prototype;return e.createErrorDataModel=function(t){var e=ct(t),n=e.filter(function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}),r="(inline script)",i=n[n.length-1];i&&i.filename&&(r=i.filename);var o=t.message||t.error&&t.error.message,a=t.error?t.error.name:"";a||o&&-1<o.indexOf(":")&&(a=o.split(":")[0]);var s,c=this._configService.get("context");"object"==typeof t.error&&(s=this._getErrorProperties(t.error));var u=S({},l(),c,s),f={id:h(),culprit:r,exception:{message:o,stacktrace:n,type:a},context:u},d=this._transactionService.getCurrentTransaction();return d&&(f.trace_id=d.traceId,f.parent_id=d.id,f.transaction_id=d.id,f.transaction={type:d.type,sampled:d.sampled}),mt(lt,f)},e.logErrorEvent=function(t,e){if(void 0!==t){var n=this.createErrorDataModel(t);if(void 0!==n.exception.message)return e?this._apmServer.sendErrors([n]):this._apmServer.addError(n)}},e.registerGlobalEventListener=function(){var e=this;window.addEventListener("error",function(t){return e.logErrorEvent(t)})},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},e._getErrorProperties=function(n){var r={};return Object.keys(n).forEach(function(t){if("stack"!==t){var e=n[t];if(null!==e){switch(typeof e){case"function":return;case"object":if("function"!=typeof e.toISOString)return;e=e.toISOString()}r[t]=e}}}),r},t}(),_t=function(r){r.registerServiceCreator("ErrorLogging",function(){var t=r.getService("ApmServer"),e=r.getService("ConfigService"),n=r.getService("TransactionService");return new yt(t,e,n)})},St=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],bt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,wt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,o=n.slashes,a=!r&&!o,s=this.getLocation(),c=St.slice();i=i.replace("\\","/");for(var u=0;u<c.length;u++){var f=c[u],d=f[0],h=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var v=f[2];if(v){var l=i.lastIndexOf(d);e=Math.max(e,l),this[h]=i.slice(0,e),i=i.slice(e+v)}else this[h]=i.slice(e),i=i.slice(0,e)}}else this[h]=i;this[h]=this[h]||a&&f[3]&&s[h]||"",f[3]&&(this[h]=this[h].toLowerCase())}this.relative=a,this.protocol=r||s.protocol||"",this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null",this.href=this.toString()}var e=t.prototype;return e.toString=function(){var t=this.protocol;if(t+="//",this.auth){var e="[REDACTED]",n=this.auth.split(":");t+=(n[0]?e:"")+(n[1]?":"+e:"")+"@"}return t+=this.host,t+=this.path,t+=this.query,t+=this.hash},e.getLocation=function(){var t={};return"undefined"!=typeof window&&(t=window),t.location},e.extractProtocol=function(t){var e=bt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Tt=function(){function t(t,e,n,r){this._apmServer=t,this._configService=e,this._logginService=n,this._transactionService=r}var e=t.prototype;return e.init=function(t){var n=this;void 0===t&&(t={}),this._configService.events.observe(U+":after",function(t){var e=n.createTransactionPayload(t);e&&n._apmServer.addTransaction(e)}),t[X]&&et.observe(X,this.getHistorySub()),t[$]&&et.observe($,this.getXHRSub()),t[V]&&et.observe(V,this.getFetchSub())},e.getHistorySub=function(){var n=this._transactionService;return function(t,e){e.source===X&&t===F&&n.startTransaction(e.data.title,"route-change",{canReuse:!0})}},e.getXHRSub=function(){var n=this;return function(t,e){e.source!==$||x.fetchInProgress||n.processAPICalls(t,e)}},e.getFetchSub=function(){var n=this;return function(t,e){e.source===V&&n.processAPICalls(t,e)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===A&&e.data){var i=new wt(e.data.url),o=e.data.method+" "+(i.relative?i.path:p(i.href)),a=r.startSpan(o,"external.http"),s=r.addTask();if(!a)return;var c=n.get("distributedTracing"),u=n.get("distributedTracingOrigins"),f=new wt(window.location.href),d=v(i.origin,f.origin)||v(i.origin,u),h=e.data.target;c&&d&&h&&this.injectDtHeader(a,h),a.addContext({http:{method:e.data.method,url:i.href}}),a.sync=e.data.sync,e.data.span=a,e.id=s}t===F&&e.data&&e.data.span&&(void 0!==e.data.target.status?e.data.span.addContext({http:{status_code:e.data.target.status}}):e.data.response&&e.data.span.addContext({http:{status_code:e.data.response.status}}),e.data.span.end()),t===F&&e.id&&r.removeTask(e.id)},e.injectDtHeader=function(t,e){var n,r=this._configService,i=r.get("distributedTracingHeaderName"),o=r.get("distributedTracingHeaderValueCallback")(t),a=/^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/.test(n=o)&&"00000000000000000000000000000000"!==n.slice(3,35)&&"0000000000000000"!==n.slice(36,52);i&&o&&a&&("function"==typeof e.setRequestHeader?e.setRequestHeader(i,o):e.headers&&"function"==typeof e.headers.append?e.headers.append(i,o):e[i]=o)},e.extractDtHeader=function(t){var e=this._configService.get("distributedTracingHeaderName");if(t)return function(t){var e=/^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/.exec(t);if(e){var n="00"!==e[4];return{traceId:e[2],id:e[3],sampled:n}}}(t[e])},e.setTransactionContext=function(t){var e=this._configService.get("context");e&&t.addContext(e)},e.filterTransaction=function(t){var e=this._configService.get("transactionDurationThreshold"),n=t.duration();if(!n)return!1;if(e<n)return!1;if(0===t.spans.length)return!1;t.sampled||t.resetSpans();var r=this._configService.get("browserResponsivenessInterval");if(this._configService.get("checkBrowserResponsiveness")&&!t.isHardNavigation){var i=this._configService.get("browserResponsivenessBuffer");if(!this.checkBrowserResponsiveness(t,r,i))return!1}return!0},e.adjustTransactionTime=function(t){var e=t.spans,n=function(t){for(var e=t[0],n=1;n<t.length;n++){var r=t[n];e._start>r._start&&(e=r)}return e}(e);n&&n._start<t._start&&(t._start=n._start);var r=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n];-1===String(r.type).indexOf("external")&&(!e||e._end<r._end)&&(e=r)}return e}(e);r&&r._end>t._end&&(t._end=r._end);for(var i=t._end,o=0;o<e.length;o++){var a=e[o];a._end>i&&(a._end=i,a.type+=".truncated"),a._start>i&&(a._start=i)}},e.prepareTransaction=function(e){if(e.spans.sort(function(t,e){return t._start-e._start}),this._configService.get("groupSimilarSpans")){var t=this._configService.get("similarSpanThreshold");e.spans=this.groupSmallContinuouslySimilarSpans(e,t)}e.spans=e.spans.filter(function(t){return 0<t.duration()&&t._start>=e._start&&t._end<=e._end}),this.setTransactionContext(e)},e.createTransactionDataModel=function(n){var t=this._configService.get("context"),r=n._start,e=n.spans.map(function(t){var e={id:t.id,transaction_id:n.id,parent_id:t.parentId||n.id,trace_id:n.traceId,name:t.name,type:t.type,subType:t.subType,action:t.action,sync:t.sync,start:t._start-r,duration:t.duration(),context:t.context};return mt(ht,e)}),i=S({},t,n.context),o={id:n.id,trace_id:n.traceId,name:n.name,type:n.type,duration:n.duration(),spans:e,context:i,marks:n.marks,span_count:{started:e.length},sampled:n.sampled};return mt(vt,o)},e.createTransactionPayload=function(t){if(this.adjustTransactionTime(t),this.prepareTransaction(t),this.filterTransaction(t))return this.createTransactionDataModel(t)},e.convertTransactionsToServerModel=function(t){var e=this;return t.map(function(t){return e.createTransactionDataModel(t)})},e.groupSmallContinuouslySimilarSpans=function(o,a){var s=o.duration(),c=[],u=1;return o.spans.forEach(function(t,e){if(0===c.length)c.push(t);else{var n=c[c.length-1],r=n.type===t.type&&n.subType===t.subType&&n.action===t.action&&n.name===t.name&&t.duration()/s<a&&(t._start-n._end)/s<a,i=o.spans.length===e+1;r&&(u++,n._end=t._end),1<u&&(!r||i)&&(n.name=u+"x "+n.name,u=1),r||c.push(t)}}),c},e.checkBrowserResponsiveness=function(t,e,n){var r=t.browserResponsivenessCounter;if(void 0===e||void 0===r)return!0;var i=t.duration();return Math.floor(i/e)<=r+n},t}(),Et=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=D),e||(e="custom"),this.options=n,this.name=t,this.type=e,this.id=this.options.id||h(16),this.traceId=this.options.traceId,this.sampled=this.options.sampled,this.timestamp=this.options.timestamp||Date.now(),this.ended=!1,this._start=window.performance.now(),this._end=void 0,this.onEnd=this.options.onEnd}var e=t.prototype;return e.ensureContext=function(){this.context||(this.context={})},e.addTags=function(t){console.warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(e){this.ensureContext();var n=this.context;n.tags||(n.tags={}),Object.keys(e).forEach(function(t){return f(t,e[t],n.tags)})},e.addContext=function(t){t&&(this.ensureContext(),S(this.context,t))},e.end=function(){this.ended||(this.ended=!0,this._end=window.performance.now(),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){if(b(this._end)||b(this._start))return null;var t=this._end-this._start;return parseFloat(t)},t}();var xt=function(o){var t,e;function n(t,e,n){var r;if((r=o.call(this,t,e,n)||this).parentId=r.options.parentId,r.subType=void 0,r.action=void 0,-1!==r.type.indexOf(".")){var i=r.type.split(".",3);r.type=i[0],r.subType=i[1],r.action=i[2]}return r.sync=r.options.sync,r}return e=o,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e,n}(Et);var Lt=function(i){var t,e;function n(t,e,n){var r;return(r=i.call(this,t,e,n)||this).traceId=h(),r.marks=void 0,r.spans=[],r._activeSpans={},r.nextAutoTaskId=1,r._scheduledTasks=[],r.isHardNavigation=!1,r.sampled=Math.random()<=r.options.transactionSampleRate,r}e=i,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e;var r=n.prototype;return r.addMarks=function(t){this.marks=S(this.marks||{},t)},r.mark=function(t){var e=T(t),n=window.performance.now()-this._start,r={};r[e]=n,this.addMarks({custom:r})},r.canReuse=function(t){return void 0===t&&(t=5e3),!!this.options.canReuse&&!this.ended&&performance.now()-this._start<t},r.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=_(this.options,n))},r.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=_({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var o=new xt(t,e,i);return this._activeSpans[o.id]=o}},r.isFinished=function(){return 0===this._scheduledTasks.length},r.detectFinish=function(){this.isFinished()&&this.end()},r.end=function(){if(!this.ended){for(var t in this.ended=!0,this._end=window.performance.now(),this._activeSpans){var e=this._activeSpans[t];e.type=e.type+".truncated",e.end()}var n=l();this.addContext(n),this.callOnEnd()}},r.addTask=function(t){if(void 0===t&&(t="task"+this.nextAutoTaskId++),-1==this._scheduledTasks.indexOf(t))return this._scheduledTasks.push(t),t},r.removeTask=function(t){var e=this._scheduledTasks.indexOf(t);-1<e&&this._scheduledTasks.splice(e,1),this.detectFinish()},r.resetSpans=function(){this.spans=[]},r._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id]},n}(Et),Ct=[["domainLookupStart","domainLookupEnd","Domain lookup"],["connectStart","connectEnd","Making a connection to the server"],["requestStart","responseEnd","Requesting and receiving the document"],["domLoading","domInteractive","Parsing the document, executing sync. scripts"],["domContentLoadedEventStart","domContentLoadedEventEnd",'Fire "DOMContentLoaded" event'],["loadEventStart","loadEventEnd",'Fire "load" event']];function Ot(t,e,n,r){return"number"==typeof t&&"number"==typeof e&&n<=t&&t<e&&e-n<=r&&e-t<q&&t-n<q&&e-n<q}function It(t){var e={transfer_size:t.transferSize,encoded_body_size:t.encodedBodySize,decoded_body_size:t.decodedBodySize},n=function(t){void 0===t&&(t=[]);for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.duration,a=r.description,s=i;a&&(s+=";desc="+a),o&&(s+=";dur="+o),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function kt(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o="resource";n&&(o+="."+n);var a=p(e),s=new xt(a,o);return s.addContext({http:{url:e,response:It(t)}}),s._start=r,s.end(),s._end=i,s}function Nt(e){var t=window.performance;if(e.isHardNavigation&&t&&t.timing){var n=t.timing;if(e.marks&&e.marks.custom){var r=e.marks.custom;Object.keys(r).forEach(function(t){r[t]+=e._start})}e._start=0;var i=e._end;if(function(t,e,n){for(var r=[],i=0;i<Ct.length;i++){var o=t[Ct[i][0]],a=t[Ct[i][1]];if(Ot(o,a,e,n)){var s=new xt(Ct[i][2],"hard-navigation.browser-timing");"requestStart"===Ct[i][0]&&(s.pageResponse=!0),s._start=o-e,s.ended=!0,s._end=a-e,r.push(s)}}return r}(n,n.fetchStart,i).forEach(function(t){t.traceId=e.traceId,t.sampled=e.sampled,t.pageResponse&&e.options.pageLoadSpanId&&(t.id=e.options.pageLoadSpanId),e.spans.push(t)}),"function"==typeof t.getEntriesByType){for(var o=t.getEntriesByType("resource"),a=[],s=0;s<e.spans;s++){var c=e.spans[s];"external"===c.type&&"http"===c.subType||a.push(c.name.split(" ")[1])}(function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.initiatorType,s=o.name,c=o.startTime,u=o.responseEnd;if("xmlhttprequest"!==a&&"fetch"!==a&&s)if(-1!==M.indexOf(a)){if(!Ot(c,u,0,n))continue;r.push(kt(t[i]))}else{if(null!=a)continue;for(var f=!1,d=0;d<e.length;d++){var h=s.lastIndexOf(e[d]);if(-1<h&&h===s.length-e[d].length){f=!0;break}}!f&&Ot(c,u,0,n)&&r.push(kt(t[i]))}}return r})(o,a,i).forEach(function(t){return e.spans.push(t)}),function(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=i.name,a=i.startTime,s=i.duration,c=a+s;if(!(s<=Q)&&Ot(a,c,0,e)){var u=new xt(o,"app");u._start=a,u.end(),u._end=c,n.push(u)}}return n}(t.getEntriesByType("measure"),i).forEach(function(t){return e.spans.push(t)});var u=t.getEntriesByType("navigation");u&&0<u.length&&(u=u[0],e.addContext({response:It(u)}))}}}var At=function(){function t(t,e){this._config=e,this._logger=t,this.currentTransaction=void 0,this._alreadyCapturedPageLoad=!1}var e=t.prototype;return e.ensureCurrentTransaction=function(t){t||(t=this.createPerfOptions());var e=this.getCurrentTransaction();return e||(t.canReuse=!0,this.createTransaction(void 0,void 0,t))},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.setCurrentTransaction=function(t){this.currentTransaction=t},e.createTransaction=function(t,e,n){var r=new Lt(t,e,n);return this.setCurrentTransaction(r),n.checkBrowserResponsiveness&&this.startCounter(r),r},e.startCounter=function(t){t.browserResponsivenessCounter=0;var e=this._config.get("browserResponsivenessInterval");if(void 0!==e)var n=setInterval(function(){t.ended?window.clearInterval(n):t.browserResponsivenessCounter++},e)},e.capturePageLoadMetrics=function(t){if(this._config.get("capturePageLoad")&&!this._alreadyCapturedPageLoad&&t.isHardNavigation)return Nt(t),t.addMarks(E()),self._alreadyCapturedPageLoad=!0},e.createPerfOptions=function(t){var e=this._config.config;return _({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,transactionSampleRate:e.transactionSampleRate,checkBrowserResponsiveness:e.checkBrowserResponsiveness},t)},e.startTransaction=function(t,e,n){var r=this,i=this.createPerfOptions(n),o=this.getCurrentTransaction();return o?o.canReuse()&&i.canReuse?o.redefine(t,void 0,i):(o.end(),o=this.createTransaction(t,e,i)):o=this.createTransaction(t,e,i),e===H&&(o.isHardNavigation=!0,i.pageLoadTraceId&&(o.traceId=i.pageLoadTraceId),i.pageLoadSampled&&(o.sampled=i.pageLoadSampled),o.name===D&&i.pageLoadTransactionName&&(o.name=i.pageLoadTransactionName)),this._config.events.send("transaction:start",[o]),o.onEnd=function(){return K.Promise.resolve().then(function(){if(!r.shouldIgnoreTransaction(o.name))if(o.type===H){var t=r._config.get("pageLoadTransactionName");o.name===D&&t&&(o.name=t),r.capturePageLoadMetrics(o)&&r.add(o)}else r.add(o)},function(t){0})},o},e.shouldIgnoreTransaction=function(t){var e=this._config.get("ignoreTransactions");if(e&&e.length)for(var n=0;n<e.length;n++){var r=e[n];if("function"==typeof r.test){if(r.test(t))return!0}else if(r===t)return!0}return!1},e.startSpan=function(t,e,n){var r=this.ensureCurrentTransaction();if(r)return r.startSpan(t,e,n)},e.add=function(t){this._config.events.send(U,[t])},e.addTask=function(t){var e=this.ensureCurrentTransaction();if(e){t=e.addTask(t);0}return t},e.removeTask=function(t){var e=this.getCurrentTransaction();e&&e.removeTask(t)},e.detectFinish=function(){var t=this.getCurrentTransaction();t&&t.detectFinish()},t}(),Ft=function(i){i.registerServiceCreator("TransactionService",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService");return new At(e,t)}),i.registerServiceCreator("PerformanceMonitoring",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService"),n=i.getService("ApmServer"),r=i.getService("TransactionService");return new Tt(n,t,e,r)})},jt=function(){function t(t,e){e||(e={}),this.onFlush=t,this.items=[],this.queueLimit=e.queueLimit||-1,this.flushInterval=e.flushInterval||0,this.timeoutId=void 0}var e=t.prototype;return e._setTimer=function(){var t=this;this.timeoutId=setTimeout(function(){t.flush()},this.flushInterval)},e.flush=function(){this.onFlush(this.items),this._clear()},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.add=function(t){this.items.push(t),-1!==this.queueLimit&&this.items.length>=this.queueLimit?this.flush():void 0===this.timeoutId&&this._setTimer()},t}();var Pt=function(e,n,t){var r,i=t.context||this,o=t.limit,a=t.interval,s=t.countFn||function(){},c=0;return function(){var t="function"==typeof s&&s.apply(i,arguments);return"number"!=typeof t&&(t=1),c+=t,void 0===r&&(r=setTimeout(function(){r=void(c=0)},a)),o<c?"function"==typeof n?n.apply(i,arguments):void 0:e.apply(i,arguments)}},Rt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Mt=function(){function t(t,e){this._configService=t,this._loggingService=e,this.errorQueue=void 0,this.transactionQueue=void 0,this.throttleAddError=void 0,this.throttleAddTransaction=void 0,this.initialized=!1,this.ndjsonSpan={}}var e=t.prototype;return e.init=function(){this.initialized||(this.initialized=!0,this.initErrorQueue(),this.initTransactionQueue())},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"js-base",version:t.version},language:{name:"javascript"},environment:t.get("environment")}};return mt(ut,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,e,{"Content-Type":"application/x-ndjson"})},e._constructError=function(t){var e=t.url,n=t.status,r=(t.responseText,e+" HTTP status: "+n);return new Error(r)},e._makeHttpRequest=function(e,o,a,s){return new K.Promise(function(n,r){var i=new window.XMLHttpRequest;if(i[O]=!0,i.open(e,o,!0),i.timeout=1e4,s)for(var t in s)s.hasOwnProperty(t)&&i.setRequestHeader(t,s[t]);i.onreadystatechange=function(){if(4===i.readyState){var t=i.status,e=i.responseText;0===t||399<t&&t<600?r({url:o,status:t,responseText:e}):n(e)}},i.onerror=function(){var t=i.status,e=i.responseText;r({url:o,status:t,responseText:e})},i.send(a)})},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new jt(t,{queueLimit:e,flushInterval:n})},e.initErrorQueue=function(){var n=this;this.errorQueue&&this.errorQueue.flush(),this.errorQueue=this._createQueue(function(t){var e=n.sendErrors(t);e&&e.catch(function(t){n._loggingService.warn("Failed sending errors!",n._constructError(t))})});var t=this._configService.get("errorThrottleLimit"),e=this._configService.get("errorThrottleInterval");this.throttleAddError=Pt(this.errorQueue.add.bind(this.errorQueue),function(){return n._loggingService.warn("Dropped error due to throttling!")},{limit:t,interval:e})},e.initTransactionQueue=function(){var n=this;this.transactionQueue&&this.transactionQueue.flush(),this.transactionQueue=this._createQueue(function(t){var e=n.sendTransactions(t);e&&e.catch(function(t){n._loggingService.warn("Failed sending transactions!",n._constructError(t))})});var t=this._configService.get("transactionThrottleLimit"),e=this._configService.get("transactionThrottleInterval");this.throttleAddTransaction=Pt(this.transactionQueue.add.bind(this.transactionQueue),function(){return n._loggingService.warn("Dropped transaction due to throttling!")},{limit:t,interval:e})},e.addError=function(t){this.errorQueue||this.initErrorQueue(),this.throttleAddError(t)},e.addTransaction=function(t){this.transactionQueue||this.initTransactionQueue(),this.throttleAddTransaction(t)},e.ndjsonErrors=function(t){return t.map(function(t){return Rt.stringify({error:t})})},e.ndjsonTransactions=function(t){var n=this.ndjsonSpan;return t.map(function(t){var e="";return t.spans&&(e=t.spans.map(function(t){return n.span=t,Rt.stringify(n)}).join(""),delete t.spans),Rt.stringify({transaction:t})+e})},e._send=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e="transaction"),0!==t.length){var n={service:this.createMetaData().service,data:t},r=this._configService.applyFilters(n);if(r){var i,o=this._configService.getEndpointUrl();if("errors"===e)i=this.ndjsonErrors(r.data);else{if("transaction"!==e)return void 0;i=this.ndjsonTransactions(r.data)}i.unshift(Rt.stringify({metadata:{service:r.service}}));var a=i.join("");return this._postJson(o,a)}this._loggingService.warn("Dropped payload due to filtering!")}},e.sendTransactions=function(t){return this._send(t)},e.sendErrors=function(t){return this._send(t,"errors")},t}();var qt=function(){function t(){this.config={},this.defaults={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",serverUrlPrefix:"/intake/v2/rum/events",active:!0,instrument:!0,disableInstrumentations:[],debug:!1,logLevel:"warn",browserResponsivenessInterval:500,browserResponsivenessBuffer:3,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,capturePageLoad:!0,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,sendPageLoadTransaction:!0,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderValueCallback:c,distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,context:{}},this.events=new tt,this.filters=[],this.version=""}var e=t.prototype;return e.init=function(){var t=function(t){if(!t)return{};for(var e={},n=/^data-([\w-]+)$/,r=t.attributes,i=0;i<r.length;i++){var o=r[i];if(n.test(o.nodeName)){var a=o.nodeName.match(n)[1],s=a.split("-").map(function(t,e){return 0<e?t.charAt(0).toUpperCase()+t.substring(1):t}).join("");e[s]=o.value||o.nodeValue}}return e}(y());this.setConfig(t)},e.isActive=function(){return this.get("active")},e.setVersion=function(t){this.version=t},e.addFilter=function(t){if("function"!=typeof t)throw new Error("Argument to must be function");this.filters.push(t)},e.applyFilters=function(t){for(var e=0;e<this.filters.length;e++)if(!(t=this.filters[e](t)))return;return t},e.get=function(t){return t.split(".").reduce(function(t,e){return t&&t[e]},this.config)},e.getEndpointUrl=function(){return this.config.serverUrl+this.config.serverUrlPrefix},e.set=function(t,e){for(var n=t.split("."),r=n.length-1,i=this.config,o=0;o<r+1;o++){var a=n[o];if(a)if(o===r)i[a]=e;else{var s=i[a]||{};i[a]=s,i=s}}},e.setUserContext=function(t){void 0===t&&(t={});var e={},n=t,r=n.id,i=n.username,o=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof o&&(e.email=o),this.set("context.user",e)},e.setCustomContext=function(t){t&&"object"==typeof t&&this.set("context.custom",t)},e.addLabels=function(e){var n=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(e).forEach(function(t){return f(t,e[t],n.config.context.tags)})},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),this.config=S({},this.defaults,this.config,t),this.events.send(z,[this.config])},e.validate=function(e){void 0===e&&(e={});var n=["serviceName","serverUrl"],r={missing:[],invalid:[]};return Object.keys(e).forEach(function(t){-1===n.indexOf(t)||e[t]||r.missing.push(t)}),e.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(e.serviceName)&&r.invalid.push({key:"serviceName",value:e.serviceName,allowed:"a-z, A-Z, 0-9, _, -, <space>"}),r},t}(),Ht=function(){function t(t){t||(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"info",this.prefix=t.prefix||"",this.resetLogMethods()}var e=t.prototype;return e.shouldLog=function(t){return this.levels.indexOf(t)>=this.levels.indexOf(this.level)},e.setLevel=function(t){this.level=t,this.resetLogMethods()},e.resetLogMethods=function(){var o=this;this.levels.forEach(function(i){o[i]=o.shouldLog(i)?function(){var t,e=o.prefix;switch(i){case"trace":case"debug":t="info";break;default:t=i}var n=arguments;e&&("function"==typeof e&&(e=e(i)),n[0]=e+n[0]);if(console){var r=console[t]?console[t]:console.log;"function"==typeof r&&r.apply(console,n)}}:w})},t}(),Dt=function(){function t(){this._serviceCreators={},this._serviceInstances={},this.initialized=!1}var e=t.prototype;return e.registerCoreServices=function(){var t=this;this.registerServiceCreator("ConfigService",function(){return new qt}),this.registerServiceCreator("LoggingService",function(){return new Ht}),this.registerServiceCreator("ApmServer",function(){return new Mt(t.getService("ConfigService"),t.getService("LoggingService"))})},e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService("ConfigService");t.init();var e=this.getService("LoggingService");n(e,t),t.events.observe(z,function(){n(e,t)}),this.getService("ApmServer").init()}function n(t,e){var n=e.get("debug"),r=e.get("logLevel");!0===n&&"trace"!==r?t.setLevel("debug"):t.setLevel(r)}},e.registerServiceCreator=function(t,e){this._serviceCreators[t]=e},e.registerServiceInstance=function(t,e){this._serviceInstances[t]=e},e.getService=function(t){if(!this._serviceInstances[t]){if("function"!=typeof this._serviceCreators[t])throw new Error("Can not get service, No creator for: "+t);this._serviceInstances[t]=this._serviceCreators[t](this)}return this._serviceInstances[t]},t}();var Qt=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){if(this.isEnabled()&&!this._initialized){this._initialized=!0;var e=this.serviceFactory.getService("ConfigService");e.setVersion("4.4.3"),this.config(t);var n=this.serviceFactory.getService("LoggingService");if(!e.isActive())return n.info("RUM agent is inactive"),this;this.serviceFactory.init();var r=(i=e.get("instrument"),o=e.get("disableInstrumentations"),(a={})[$]=!1,a[V]=!1,a[X]=!1,a[H]=!1,a.error=!1,s=a,i&&Object.keys(s).forEach(function(t){-1===o.indexOf(t)&&(s[t]=!0)}),s);if(this.serviceFactory.getService("PerformanceMonitoring").init(r),r.error)this.serviceFactory.getService("ErrorLogging").registerGlobalEventListener();r[H]&&e.get("sendPageLoadTransaction")&&this._sendPageLoadMetrics()}var i,o,a,s;return this},e._sendPageLoadMetrics=function(){var t=this.serviceFactory.getService("TransactionService").startTransaction(void 0,H,{canReuse:!0});t&&t.addTask(H);var e=function(){setTimeout(function(){t&&t.removeTask(H)})};"complete"===document.readyState?e():window.addEventListener("load",e)},e.isEnabled=function(){return!this._disable},e.observe=function(t,e){this.serviceFactory.getService("ConfigService").events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService("ConfigService"),n=e.validate(t),r=n.missing,o=n.invalid;if(0===r.length&&0===o.length)e.setConfig(t);else{var i=this.serviceFactory.getService("LoggingService"),a="RUM Agent isn't correctly configured: ";0<r.length&&(a+="Missing config - "+r.join(", "),0<o.length&&(a+=", ")),o.forEach(function(t,e){var n=t.key,r=t.value,i=t.allowed;a+=n+' "'+r+'" contains invalid characters! (allowed: '+i+")"+(e!==o.length-1?", ":"")}),i.error(a),e.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService("ConfigService").setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService("ConfigService").setCustomContext(t)},e.addTags=function(t){this.serviceFactory.getService("LoggingService").warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(t){this.serviceFactory.getService("ConfigService").addLabels(t)},e.setInitialPageLoadName=function(t){this.isEnabled()&&this.serviceFactory.getService("ConfigService").setConfig({pageLoadTransactionName:t})},e.startTransaction=function(t,e,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startTransaction(t,e,n)},e.startSpan=function(t,e){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e)},e.getCurrentTransaction=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").getCurrentTransaction()},e.getTransactionService=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService")},e.captureError=function(t){if(this.isEnabled())return this.serviceFactory.getService("ErrorLogging").logError(t)},e.addFilter=function(t){this.serviceFactory.getService("ConfigService").addFilter(t)},t}();n.d(e,"init",function(){return Vt}),n.d(e,"apmBase",function(){return $t}),n.d(e,"apm",function(){return $t}),n.d(e,"ApmBase",function(){return Qt});var Bt,Ut=(it||(it=!0,u()?(rt(),ot=!0):"undefined"!=typeof window&&console.log("APM: Platform is not supported!")),ot),zt=((Bt=new Dt).registerCoreServices(),_t(Bt),Ft(Bt),Bt),$t=new Qt(zt,!Ut);"undefined"!=typeof window&&(window.elasticApm=$t);var Vt=$t.init.bind($t);e.default=Vt}]);
!function(n){var r={};function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}i.m=n,i.c=r,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=5)}([function(t,e,n){t.exports=function(){"use strict";function c(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},r=0,e=void 0,i=void 0,s=function(t,e){h[r]=t,h[r+1]=e,2===(r+=2)&&(i?i(v):y())},t="undefined"!=typeof window?window:void 0,o=t||{},a=o.MutationObserver||o.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<r;t+=2){var e=h[t],n=h[t+1];e(n),h[t]=void 0,h[t+1]=void 0}r=0}var l,p,g,m,y=void 0;function _(t,e){var n=this,r=new this.constructor(w);void 0===r[b]&&R(r);var i=n._state;if(i){var o=arguments[i-1];s(function(){return j(i,r,o,n._result)})}else A(n,r,t,e);return r}function S(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(w);return O(e,t),e}y=u?function(){return process.nextTick(v)}:a?(p=0,g=new a(v),m=document.createTextNode(""),g.observe(m,{characterData:!0}),function(){m.data=p=++p%2}):f?((l=new MessageChannel).port1.onmessage=v,function(){return l.port2.postMessage(0)}):void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0===(e=t.runOnLoop||t.runOnContext)?d():function(){e(v)}}catch(t){return d()}}():d();var b=Math.random().toString(36).substring(2);function w(){}var T=void 0,E=1,x=2;function L(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}function C(t,e,n){var r,i,o,a;e.constructor===t.constructor&&n===_&&e.constructor.resolve===S?(o=t,(a=e)._state===E?k(o,a._result):a._state===x?N(o,a._result):A(a,void 0,function(t){return O(o,t)},function(t){return N(o,t)})):void 0===n?k(t,e):c(n)?(r=e,i=n,s(function(e){var n=!1,t=L(i,r,function(t){n||(n=!0,r!==t?O(e,t):k(e,t))},function(t){n||(n=!0,N(e,t))},e._label);!n&&t&&(n=!0,N(e,t))},t)):k(t,e)}function O(e,t){if(e===t)N(e,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=t),null===r||"object"!==i&&"function"!==i)k(e,t);else{var n=void 0;try{n=t.then}catch(t){return void N(e,t)}C(e,t,n)}var r,i}function I(t){t._onerror&&t._onerror(t._result),F(t)}function k(t,e){t._state===T&&(t._result=e,t._state=E,0!==t._subscribers.length&&s(F,t))}function N(t,e){t._state===T&&(t._state=x,t._result=e,s(I,t))}function A(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+E]=n,i[o+x]=r,0===o&&t._state&&s(F,t)}function F(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,i=void 0,o=t._result,a=0;a<e.length;a+=3)r=e[a],i=e[a+n],r?j(n,r,i,o):i(o);t._subscribers.length=0}}function j(t,e,n,r){var i=c(n),o=void 0,a=void 0,s=!0;if(i){try{o=n(r)}catch(t){s=!1,a=t}if(e===o)return void N(e,new TypeError("A promises callback cannot return that same promise."))}else o=r;e._state!==T||(i&&s?O(e,o):!1===s?N(e,a):t===E?k(e,o):t===x&&N(e,o))}var P=0;function R(t){t[b]=P++,t._state=void 0,t._result=void 0,t._subscribers=[]}var M=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(w),this.promise[b]||R(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&k(this.promise,this._result))):N(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===T&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===S){var i=void 0,o=void 0,a=!1;try{i=e.then}catch(t){a=!0,o=t}if(i===_&&e._state!==T)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===q){var s=new n(w);a?N(s,o):C(s,e,i),this._willSettleAt(s,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===T&&(this._remaining--,t===x?N(r,n):this._result[e]=n),0===this._remaining&&k(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;A(t,void 0,function(t){return n._settledAt(E,e,t)},function(t){return n._settledAt(x,e,t)})},t}(),q=function(){function e(t){this[b]=P++,this._result=this._state=void 0,this._subscribers=[],w!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){O(e,t)},function(t){N(e,t)})}catch(t){N(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var n=this.constructor;return c(e)?this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){throw t})}):this.then(e,e)},e}();return q.prototype.then=_,q.all=function(t){return new M(this,t).promise},q.race=function(i){var o=this;return n(i)?new o(function(t,e){for(var n=i.length,r=0;r<n;r++)o.resolve(i[r]).then(t,e)}):new o(function(t,e){return e(new TypeError("You must pass an array to race."))})},q.resolve=S,q.reject=function(t){var e=new this(w);return N(e,t),e},q._setScheduler=function(t){i=t},q._setAsap=function(t){s=t},q._asap=s,q.polyfill=function(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=q},q.Promise=q}()},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(n,r,i){var o,a,s;!function(t,e){"use strict";a=[i(4)],void 0===(s="function"==typeof(o=function(s){var n=/(^|@)\S+\:\d+/,r=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/;function o(t,e,n){if("function"==typeof Array.prototype.map)return t.map(e,n);for(var r=new Array(t.length),i=0;i<t.length;i++)r[i]=e.call(n,t[i]);return r}function a(t,e,n){if("function"==typeof Array.prototype.filter)return t.filter(e,n);for(var r=[],i=0;i<t.length;i++)e.call(n,t[i])&&r.push(t[i]);return r}return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(r))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){var e=a(t.stack.split("\n"),function(t){return!!t.match(r)},this);return o(e,function(t){-1<t.indexOf("(eval ")&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(e.pop()),r=e.join(" ")||void 0,i=-1<function(t,e){{if("function"==typeof Array.prototype.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}}(["eval","<anonymous>"],n[0])?void 0:n[0];return new s(r,void 0,i,n[1],n[2],t)},this)},parseFFOrSafari:function(t){var e=a(t.stack.split("\n"),function(t){return!t.match(i)},this);return o(e,function(t){if(-1<t.indexOf(" > eval")&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new s(t);var e=t.split("@"),n=this.extractLocation(e.pop()),r=e.join("@")||void 0;return new s(r,void 0,n[0],n[1],n[2],t)},this)},parseOpera:function(t){return!t.stacktrace||-1<t.message.indexOf("\n")&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),r=[],i=2,o=n.length;i<o;i+=2){var a=e.exec(n[i]);a&&r.push(new s(void 0,void 0,a[2],a[1],void 0,n[i]))}return r},parseOpera10:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),r=[],i=0,o=n.length;i<o;i+=2){var a=e.exec(n[i]);a&&r.push(new s(a[3]||void 0,void 0,a[2],a[1],void 0,n[i]))}return r},parseOpera11:function(t){var e=a(t.stack.split("\n"),function(t){return!!t.match(n)&&!t.match(/^Error created at/)},this);return o(e,function(t){var e,n=t.split("@"),r=this.extractLocation(n.pop()),i=n.shift()||"",o=i.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(e=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===e||"[arguments not available]"===e?void 0:e.split(",");return new s(o,a,r[0],r[1],r[2],t)},this)}}})?o.apply(r,a):o)||(n.exports=s)}()},,function(n,r,t){var i,o,a;!function(t,e){"use strict";o=[],void 0===(a="function"==typeof(i=function(){function e(t){return!isNaN(parseFloat(t))&&isFinite(t)}function t(t,e,n,r,i,o){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==n&&this.setFileName(n),void 0!==r&&this.setLineNumber(r),void 0!==i&&this.setColumnNumber(i),void 0!==o&&this.setSource(o)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){return(this.getFunctionName()||"{anonymous}")+"("+(this.getArgs()||[]).join(",")+")"+(this.getFileName()?"@"+this.getFileName():"")+(e(this.getLineNumber())?":"+this.getLineNumber():"")+(e(this.getColumnNumber())?":"+this.getColumnNumber():"")}},t})?i.apply(r,o):i)||(n.exports=a)}()},function(t,e,n){"use strict";n.r(e);var r=n(1),o=n.n(r),i=[].slice;for(var a=[],s=0;s<256;++s)a[s]=(s+256).toString(16).substr(1);function c(t){if(t&&t.traceId&&t.id&&t.parentId){var e=t.sampled?"01":"00",n=t.sampled?t.id:t.parentId;return"00-"+t.traceId+"-"+n+"-"+e}}function v(e,t){var n=!1;return"string"==typeof t?n=e===t:Array.isArray(t)&&t.forEach(function(t){n||(n=v(e,t))}),n}function l(t){var e,n,r,i;return(e=o()(),r=n||0,[(i=a)[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")).substr(0,t)}function u(){return"undefined"!=typeof window&&"function"==typeof Array.prototype.forEach&&"function"==typeof JSON.stringify&&"function"==typeof Function.bind&&window.performance&&"function"==typeof window.performance.now&&"withCredentials"in new window.XMLHttpRequest}function f(t,e,n){if(n&&t){var r=T(t);return e&&(e=String(e)),n[r]=e,n}}var d=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function p(){return{page:{referer:document.referrer,url:window.location.href}}}function g(t){return t&&t.split("?")[0]}function h(t){return null!==t&&"object"==typeof t}function m(t,e,n){for(var r=0,i=e.length;r<i;++r){var o=e[r];if(h(o)||"function"==typeof o)for(var a=Object.keys(o),s=0,c=a.length;s<c;s++){var u=a[s],f=o[u];n&&h(f)?(h(t[u])||(t[u]=Array.isArray(f)?[]:{}),m(t[u],[f],!1)):t[u]=f}}return t}function y(){if("undefined"!=typeof document){var t=document.currentScript;return t||function(){if("undefined"!=typeof document)for(var t=document.getElementsByTagName("script"),e=0,n=t.length;e<n;e++){var r=t[e];if(0<r.src.indexOf("elastic"))return r}}()}}function _(t){return m(t,i.call(arguments,1),!1)}function S(t){return m(t,i.call(arguments,1),!0)}function b(t){return void 0===t}function w(){}function T(t){return t.replace(/[.*"]/g,"_")}function E(){var n,r,i,t=(n=window.performance.timing,r=n.fetchStart,i={},d.forEach(function(t){var e=n[t];e&&r<=e&&(i[t]=e-r)}),i),e=function(){var t={},e=window.performance;if(e.getEntriesByType){var n=e.getEntriesByType("paint");if(0<n.length)for(var r=e.timing,i=r.fetchStart-r.navigationStart,o=0;o<n.length;o++){var a=n[o],s=0<=i?a.startTime-i:a.startTime;t[a.name]=s}}return t}(),o={timeToFirstByte:t.responseStart,domInteractive:t.domInteractive,domComplete:t.domComplete};return e["first-contentful-paint"]&&(o.firstContentfulPaint=e["first-contentful-paint"]),{navigationTiming:t,agent:o}}var x={fetchInProgress:!1};function L(t){return"__apm_symbol__"+t}function C(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,o,a,s,c=L(e);if(r&&!(i=r[c])){i=r[c]=r[e];var u=r&&Object.getOwnPropertyDescriptor(r,e);if(!(s=u)||!1!==s.writable&&("function"!=typeof s.get||void 0!==s.set)){var f=n(i,c,e);r[e]=function(){return f(this,arguments)},o=r[e],a=i,o[L("OriginalDelegate")]=a}}return i}var O=L("xhrIgnore"),I=L("xhrSync"),k=L("xhrURL"),N=L("xhrMethod"),A="schedule",F="invoke",j="clear",P="addEventListener",R="removeEventListener",M=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],q=3e5,H="page-load",D="Unknown",Q=60,B=1024,U="transaction:end",z="config:change",$="xmlhttprequest",V="fetch",X="history",J=L("xhrTask"),Y=L("xhrListener"),G=L("xhrScheduled");function Z(a){var t=XMLHttpRequest.prototype,s=t[P],c=t[R];if(!s){var e=window.XMLHttpRequestEventTarget;if(e){var n=e.prototype;s=n[P],c=n[R]}}var u="readystatechange";function f(t){t.state=F,t.ignore||a(F,t)}var r=C(t,"open",function(){return function(t,e){return t[N]=e[0],t[k]=e[1],t[I]=!1===e[2],r.apply(t,e)}}),d=C(t,"send",function(){return function(t,e){var n={source:$,state:"",type:"macroTask",ignore:t[O],data:{target:t,method:t[N],sync:t[I],url:t[k],args:e,aborted:!1}},r=function(t){XMLHttpRequest[G]=!1,t.state=A,t.ignore||a(A,t);var e=t.data,n=e.target,r=n[Y];s||(s=n[P],c=n[R]),r&&c.call(n,u,r);var i=n[Y]=function(){n.readyState===n.DONE&&!e.aborted&&XMLHttpRequest[G]&&t.state===A&&f(t)};s.call(n,u,i),n[J]||(n[J]=t);var o=d.apply(n,e.args);return XMLHttpRequest[G]=!0,o}(n);return t[I]&&f(n),r}}),i=C(t,"abort",function(){return function(t,e){var n,r=t[J];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;(n=r).state=j,a(j,n),n.data.aborted=!0}return i.apply(t,e)}})}var K=n(0);function W(s){if(window.fetch&&window.Request){var c=window.fetch;window.fetch=function(t,e){var i,n,o=this,r=arguments;if("string"==typeof t)i=new Request(t,e),n=t;else{if(!t)return c.apply(o,r);n=(i=t).url}var a={source:V,state:"",type:"macroTask",data:{target:i,method:i.method,sync:!1,url:n,args:r,aborted:!1}};return new K.Promise(function(e,n){var t,r;x.fetchInProgress=!0,(t=a).state=A,s(A,t);try{r=c.apply(o,[i])}catch(t){return n(t),a.data.error=t,u(a),void(x.fetchInProgress=!1)}r.then(function(t){e(t),K.Promise.resolve().then(function(){a.data.response=t,u(a)})},function(t){n(t),K.Promise.resolve().then(function(){a.data.error=t,u(a)})}),x.fetchInProgress=!1})}}function u(t){t.state=F,s(F,t)}}var tt=function(){function t(){this.observers={}}var e=t.prototype;return e.observe=function(e,n){var r=this;if("function"==typeof n)return this.observers[e]||(this.observers[e]=[]),this.observers[e].push(n),function(){var t=r.observers[e].indexOf(n);-1<t&&r.observers[e].splice(t,1)}},e.sendOnly=function(t,e){var n=this.observers[t];n&&n.forEach(function(t){try{t.apply(void 0,e)}catch(t){console.log(t,t.stack)}})},e.send=function(t,e){this.sendOnly(t+":before",e),this.sendOnly(t,e),this.sendOnly(t+":after",e)},t}(),et=new tt,nt=!1;function rt(){return nt||(nt=!0,Z(function(t,e){et.send($,[t,e])}),W(function(t,e){et.send(V,[t,e])}),function(r){if(window.history){var i=history.pushState;"function"==typeof i&&(history.pushState=function(t,e,n){r(F,{source:X,data:{state:t,title:e,url:n}}),i.apply(this,arguments)})}}(function(t,e){et.send(X,[t,e])})),et}var it=!1,ot=!1;var at=n(2),st=n.n(at);function ct(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=st.a.parse(e)}catch(t){}return 0===o.length&&(o=[{fileName:n,lineNumber:r,columnNumber:i}]),o.map(function(t){return t.functionName&&(t.functionName=(e=t.functionName,e=1<(n=(e=(e=(e=1<(n=e.split("/")).length?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>")).split(".")).length?n[n.length-1]:n[0])),t;var e,n}).map(function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,o=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var a,s,c,u,f=(void 0===(a=e)&&(a=""),"<anonymous>"===a&&(a=""),a),d=(s=f,c=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),-1<s.indexOf(c)&&(s=s.replace(c+"/","")),s);return(u=f)&&0===window.location.href.indexOf(u)&&(d="(inline script)"),{abs_path:e,filename:d,function:o,lineno:n,colno:r}})}var ut={service:{name:[B,!0],version:!0,agent:{version:[B,!0]},environment:!0}},ft={"*":!0,headers:{"*":!0}},dt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:ft},response:ft},ht={name:[B,!0],type:[B,!0],id:[B,!0],trace_id:[B,!0],parent_id:[B,!0],transaction_id:[B,!0],subtype:!0,action:!0,context:dt},vt={name:!0,parent_id:!0,type:[B,!0],id:[B,!0],trace_id:[B,!0],span_count:{started:[B,!0]},context:dt},lt={id:[B,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:dt};function pt(t){return null==t||""===t||void 0===t}function gt(t,e,n){var r,i,o,a,s=(r=t[e],i=n[0],o=n[1],void 0===i&&(i=B),void 0===o&&(o=!1),void 0===a&&(a="N/A"),o&&pt(r)&&(r=a),"string"==typeof r?r.substring(0,i):r);pt(s)?delete t[e]:t[e]=s}function mt(r,i,o){void 0===r&&(r={}),void 0===o&&(o=i);for(var a=Object.keys(r),s=[],t=function(t){var e=a[t],n=!0===r[e]?s:r[e];Array.isArray(n)?"*"===e?Object.keys(o).forEach(function(t){return gt(o,t,n)}):gt(o,e,n):mt(n,i,o[e])},e=0;e<a.length;e++)t(e);return i}var yt=function(){function t(t,e,n){this._apmServer=t,this._configService=e,this._transactionService=n}var e=t.prototype;return e.createErrorDataModel=function(t){var e=ct(t),n=e.filter(function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}),r="(inline script)",i=n[n.length-1];i&&i.filename&&(r=i.filename);var o=t.message,a=t.error,s=o,c="",u={};a&&"object"==typeof a&&(s=s||a.message,c=a.name,u=this._getErrorProperties(a)),c||s&&-1<s.indexOf(":")&&(c=s.split(":")[0]);var f=this._configService.get("context"),d=S({},p(),f,u),h={id:l(),culprit:r,exception:{message:s,stacktrace:n,type:c},context:d},v=this._transactionService.getCurrentTransaction();return v&&(h.trace_id=v.traceId,h.parent_id=v.id,h.transaction_id=v.id,h.transaction={type:v.type,sampled:v.sampled}),mt(lt,h)},e.logErrorEvent=function(t,e){if(void 0!==t){var n=this.createErrorDataModel(t);if(void 0!==n.exception.message)return e?this._apmServer.sendErrors([n]):this._apmServer.addError(n)}},e.registerGlobalEventListener=function(){var e=this;window.addEventListener("error",function(t){return e.logErrorEvent(t)})},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},e._getErrorProperties=function(n){var r={};return Object.keys(n).forEach(function(t){if("stack"!==t){var e=n[t];if(null!==e){switch(typeof e){case"function":return;case"object":if("function"!=typeof e.toISOString)return;e=e.toISOString()}r[t]=e}}}),r},t}(),_t=function(r){r.registerServiceCreator("ErrorLogging",function(){var t=r.getService("ApmServer"),e=r.getService("ConfigService"),n=r.getService("TransactionService");return new yt(t,e,n)})},St=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],bt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,wt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,o=n.slashes,a=!r&&!o,s=this.getLocation(),c=St.slice();i=i.replace("\\","/");for(var u=0;u<c.length;u++){var f=c[u],d=f[0],h=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var v=f[2];if(v){var l=i.lastIndexOf(d);e=Math.max(e,l),this[h]=i.slice(0,e),i=i.slice(e+v)}else this[h]=i.slice(e),i=i.slice(0,e)}}else this[h]=i;this[h]=this[h]||a&&f[3]&&s[h]||"",f[3]&&(this[h]=this[h].toLowerCase())}this.relative=a,this.protocol=r||s.protocol||"",this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null",this.href=this.toString()}var e=t.prototype;return e.toString=function(){var t=this.protocol;if(t+="//",this.auth){var e="[REDACTED]",n=this.auth.split(":");t+=(n[0]?e:"")+(n[1]?":"+e:"")+"@"}return t+=this.host,t+=this.path,t+=this.query,t+=this.hash},e.getLocation=function(){var t={};return"undefined"!=typeof window&&(t=window),t.location},e.extractProtocol=function(t){var e=bt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Tt=function(){function t(t,e,n,r){this._apmServer=t,this._configService=e,this._logginService=n,this._transactionService=r}var e=t.prototype;return e.init=function(t){var n=this;void 0===t&&(t={}),this._configService.events.observe(U+":after",function(t){var e=n.createTransactionPayload(t);e&&n._apmServer.addTransaction(e)}),t[X]&&et.observe(X,this.getHistorySub()),t[$]&&et.observe($,this.getXHRSub()),t[V]&&et.observe(V,this.getFetchSub())},e.getHistorySub=function(){var n=this._transactionService;return function(t,e){e.source===X&&t===F&&n.startTransaction(e.data.title,"route-change",{canReuse:!0})}},e.getXHRSub=function(){var n=this;return function(t,e){e.source!==$||x.fetchInProgress||n.processAPICalls(t,e)}},e.getFetchSub=function(){var n=this;return function(t,e){e.source===V&&n.processAPICalls(t,e)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===A&&e.data){var i=new wt(e.data.url),o=e.data.method+" "+(i.relative?i.path:g(i.href)),a=r.startSpan(o,"external.http"),s=r.addTask();if(!a)return;var c=n.get("distributedTracing"),u=n.get("distributedTracingOrigins"),f=new wt(window.location.href),d=v(i.origin,f.origin)||v(i.origin,u),h=e.data.target;c&&d&&h&&this.injectDtHeader(a,h),a.addContext({http:{method:e.data.method,url:i.href}}),a.sync=e.data.sync,e.data.span=a,e.id=s}t===F&&e.data&&e.data.span&&(void 0!==e.data.target.status?e.data.span.addContext({http:{status_code:e.data.target.status}}):e.data.response&&e.data.span.addContext({http:{status_code:e.data.response.status}}),e.data.span.end()),t===F&&e.id&&r.removeTask(e.id)},e.injectDtHeader=function(t,e){var n,r=this._configService,i=r.get("distributedTracingHeaderName"),o=r.get("distributedTracingHeaderValueCallback")(t),a=/^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/.test(n=o)&&"00000000000000000000000000000000"!==n.slice(3,35)&&"0000000000000000"!==n.slice(36,52);i&&o&&a&&("function"==typeof e.setRequestHeader?e.setRequestHeader(i,o):e.headers&&"function"==typeof e.headers.append?e.headers.append(i,o):e[i]=o)},e.extractDtHeader=function(t){var e=this._configService.get("distributedTracingHeaderName");if(t)return function(t){var e=/^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/.exec(t);if(e){var n="00"!==e[4];return{traceId:e[2],id:e[3],sampled:n}}}(t[e])},e.setTransactionContext=function(t){var e=this._configService.get("context");e&&t.addContext(e)},e.filterTransaction=function(t){var e=this._configService.get("transactionDurationThreshold"),n=t.duration();if(!n)return!1;if(e<n)return!1;if(0===t.spans.length)return!1;t.sampled||t.resetSpans();var r=this._configService.get("browserResponsivenessInterval");if(this._configService.get("checkBrowserResponsiveness")&&!t.isHardNavigation){var i=this._configService.get("browserResponsivenessBuffer");if(!this.checkBrowserResponsiveness(t,r,i))return!1}return!0},e.adjustTransactionTime=function(t){var e=t.spans,n=function(t){for(var e=t[0],n=1;n<t.length;n++){var r=t[n];e._start>r._start&&(e=r)}return e}(e);n&&n._start<t._start&&(t._start=n._start);var r=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n];-1===String(r.type).indexOf("external")&&(!e||e._end<r._end)&&(e=r)}return e}(e);r&&r._end>t._end&&(t._end=r._end);for(var i=t._end,o=0;o<e.length;o++){var a=e[o];a._end>i&&(a._end=i,a.type+=".truncated"),a._start>i&&(a._start=i)}},e.prepareTransaction=function(e){if(e.spans.sort(function(t,e){return t._start-e._start}),this._configService.get("groupSimilarSpans")){var t=this._configService.get("similarSpanThreshold");e.spans=this.groupSmallContinuouslySimilarSpans(e,t)}e.spans=e.spans.filter(function(t){return 0<t.duration()&&t._start>=e._start&&t._end<=e._end}),this.setTransactionContext(e)},e.createTransactionDataModel=function(n){var t=this._configService.get("context"),r=n._start,e=n.spans.map(function(t){var e={id:t.id,transaction_id:n.id,parent_id:t.parentId||n.id,trace_id:n.traceId,name:t.name,type:t.type,subType:t.subType,action:t.action,sync:t.sync,start:t._start-r,duration:t.duration(),context:t.context};return mt(ht,e)}),i=S({},t,n.context),o={id:n.id,trace_id:n.traceId,name:n.name,type:n.type,duration:n.duration(),spans:e,context:i,marks:n.marks,span_count:{started:e.length},sampled:n.sampled};return mt(vt,o)},e.createTransactionPayload=function(t){if(this.adjustTransactionTime(t),this.prepareTransaction(t),this.filterTransaction(t))return this.createTransactionDataModel(t)},e.convertTransactionsToServerModel=function(t){var e=this;return t.map(function(t){return e.createTransactionDataModel(t)})},e.groupSmallContinuouslySimilarSpans=function(o,a){var s=o.duration(),c=[],u=1;return o.spans.forEach(function(t,e){if(0===c.length)c.push(t);else{var n=c[c.length-1],r=n.type===t.type&&n.subType===t.subType&&n.action===t.action&&n.name===t.name&&t.duration()/s<a&&(t._start-n._end)/s<a,i=o.spans.length===e+1;r&&(u++,n._end=t._end),1<u&&(!r||i)&&(n.name=u+"x "+n.name,u=1),r||c.push(t)}}),c},e.checkBrowserResponsiveness=function(t,e,n){var r=t.browserResponsivenessCounter;if(void 0===e||void 0===r)return!0;var i=t.duration();return Math.floor(i/e)<=r+n},t}(),Et=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=D),e||(e="custom"),this.options=n,this.name=t,this.type=e,this.id=this.options.id||l(16),this.traceId=this.options.traceId,this.sampled=this.options.sampled,this.timestamp=this.options.timestamp||Date.now(),this.ended=!1,this._start=window.performance.now(),this._end=void 0,this.onEnd=this.options.onEnd}var e=t.prototype;return e.ensureContext=function(){this.context||(this.context={})},e.addTags=function(t){console.warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(e){this.ensureContext();var n=this.context;n.tags||(n.tags={}),Object.keys(e).forEach(function(t){return f(t,e[t],n.tags)})},e.addContext=function(t){t&&(this.ensureContext(),S(this.context,t))},e.end=function(){this.ended||(this.ended=!0,this._end=window.performance.now(),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){if(b(this._end)||b(this._start))return null;var t=this._end-this._start;return parseFloat(t)},t}();var xt=function(o){var t,e;function n(t,e,n){var r;if((r=o.call(this,t,e,n)||this).parentId=r.options.parentId,r.subType=void 0,r.action=void 0,-1!==r.type.indexOf(".")){var i=r.type.split(".",3);r.type=i[0],r.subType=i[1],r.action=i[2]}return r.sync=r.options.sync,r}return e=o,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e,n}(Et);var Lt=function(i){var t,e;function n(t,e,n){var r;return(r=i.call(this,t,e,n)||this).traceId=l(),r.marks=void 0,r.spans=[],r._activeSpans={},r.nextAutoTaskId=1,r._scheduledTasks=[],r.isHardNavigation=!1,r.sampled=Math.random()<=r.options.transactionSampleRate,r}e=i,(t=n).prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e;var r=n.prototype;return r.addMarks=function(t){this.marks=S(this.marks||{},t)},r.mark=function(t){var e=T(t),n=window.performance.now()-this._start,r={};r[e]=n,this.addMarks({custom:r})},r.canReuse=function(t){return void 0===t&&(t=5e3),!!this.options.canReuse&&!this.ended&&performance.now()-this._start<t},r.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=_(this.options,n))},r.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=_({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var o=new xt(t,e,i);return this._activeSpans[o.id]=o}},r.isFinished=function(){return 0===this._scheduledTasks.length},r.detectFinish=function(){this.isFinished()&&this.end()},r.end=function(){if(!this.ended){for(var t in this.ended=!0,this._end=window.performance.now(),this._activeSpans){var e=this._activeSpans[t];e.type=e.type+".truncated",e.end()}var n=p();this.addContext(n),this.callOnEnd()}},r.addTask=function(t){if(void 0===t&&(t="task"+this.nextAutoTaskId++),-1==this._scheduledTasks.indexOf(t))return this._scheduledTasks.push(t),t},r.removeTask=function(t){var e=this._scheduledTasks.indexOf(t);-1<e&&this._scheduledTasks.splice(e,1),this.detectFinish()},r.resetSpans=function(){this.spans=[]},r._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id]},n}(Et),Ct=[["domainLookupStart","domainLookupEnd","Domain lookup"],["connectStart","connectEnd","Making a connection to the server"],["requestStart","responseEnd","Requesting and receiving the document"],["domLoading","domInteractive","Parsing the document, executing sync. scripts"],["domContentLoadedEventStart","domContentLoadedEventEnd",'Fire "DOMContentLoaded" event'],["loadEventStart","loadEventEnd",'Fire "load" event']];function Ot(t,e,n,r){return"number"==typeof t&&"number"==typeof e&&n<=t&&t<e&&e-n<=r&&e-t<q&&t-n<q&&e-n<q}function It(t){var e={transfer_size:t.transferSize,encoded_body_size:t.encodedBodySize,decoded_body_size:t.decodedBodySize},n=function(t){void 0===t&&(t=[]);for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.duration,a=r.description,s=i;a&&(s+=";desc="+a),o&&(s+=";dur="+o),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function kt(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o="resource";n&&(o+="."+n);var a=g(e),s=new xt(a,o);return s.addContext({http:{url:e,response:It(t)}}),s._start=r,s.end(),s._end=i,s}function Nt(e){var t=window.performance;if(e.isHardNavigation&&t&&t.timing){var n=t.timing;if(e.marks&&e.marks.custom){var r=e.marks.custom;Object.keys(r).forEach(function(t){r[t]+=e._start})}e._start=0;var i=e._end;if(function(t,e,n){for(var r=[],i=0;i<Ct.length;i++){var o=t[Ct[i][0]],a=t[Ct[i][1]];if(Ot(o,a,e,n)){var s=new xt(Ct[i][2],"hard-navigation.browser-timing");"requestStart"===Ct[i][0]&&(s.pageResponse=!0),s._start=o-e,s.ended=!0,s._end=a-e,r.push(s)}}return r}(n,n.fetchStart,i).forEach(function(t){t.traceId=e.traceId,t.sampled=e.sampled,t.pageResponse&&e.options.pageLoadSpanId&&(t.id=e.options.pageLoadSpanId),e.spans.push(t)}),"function"==typeof t.getEntriesByType){for(var o=t.getEntriesByType("resource"),a=[],s=0;s<e.spans;s++){var c=e.spans[s];"external"===c.type&&"http"===c.subType||a.push(c.name.split(" ")[1])}(function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.initiatorType,s=o.name,c=o.startTime,u=o.responseEnd;if("xmlhttprequest"!==a&&"fetch"!==a&&s)if(-1!==M.indexOf(a)){if(!Ot(c,u,0,n))continue;r.push(kt(t[i]))}else{if(null!=a)continue;for(var f=!1,d=0;d<e.length;d++){var h=s.lastIndexOf(e[d]);if(-1<h&&h===s.length-e[d].length){f=!0;break}}!f&&Ot(c,u,0,n)&&r.push(kt(t[i]))}}return r})(o,a,i).forEach(function(t){return e.spans.push(t)}),function(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=i.name,a=i.startTime,s=i.duration,c=a+s;if(!(s<=Q)&&Ot(a,c,0,e)){var u=new xt(o,"app");u._start=a,u.end(),u._end=c,n.push(u)}}return n}(t.getEntriesByType("measure"),i).forEach(function(t){return e.spans.push(t)});var u=t.getEntriesByType("navigation");u&&0<u.length&&(u=u[0],e.addContext({response:It(u)}))}}}var At=function(){function t(t,e){this._config=e,this._logger=t,this.currentTransaction=void 0,this._alreadyCapturedPageLoad=!1}var e=t.prototype;return e.ensureCurrentTransaction=function(t){t||(t=this.createPerfOptions());var e=this.getCurrentTransaction();return e||(t.canReuse=!0,this.createTransaction(void 0,void 0,t))},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.setCurrentTransaction=function(t){this.currentTransaction=t},e.createTransaction=function(t,e,n){var r=new Lt(t,e,n);return this.setCurrentTransaction(r),n.checkBrowserResponsiveness&&this.startCounter(r),r},e.startCounter=function(t){t.browserResponsivenessCounter=0;var e=this._config.get("browserResponsivenessInterval");if(void 0!==e)var n=setInterval(function(){t.ended?window.clearInterval(n):t.browserResponsivenessCounter++},e)},e.capturePageLoadMetrics=function(t){if(this._config.get("capturePageLoad")&&!this._alreadyCapturedPageLoad&&t.isHardNavigation)return Nt(t),t.addMarks(E()),self._alreadyCapturedPageLoad=!0},e.createPerfOptions=function(t){var e=this._config.config;return _({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,transactionSampleRate:e.transactionSampleRate,checkBrowserResponsiveness:e.checkBrowserResponsiveness},t)},e.startTransaction=function(t,e,n){var r=this,i=this.createPerfOptions(n),o=this.getCurrentTransaction();return o?o.canReuse()&&i.canReuse?o.redefine(t,void 0,i):(o.end(),o=this.createTransaction(t,e,i)):o=this.createTransaction(t,e,i),e===H&&(o.isHardNavigation=!0,i.pageLoadTraceId&&(o.traceId=i.pageLoadTraceId),i.pageLoadSampled&&(o.sampled=i.pageLoadSampled),o.name===D&&i.pageLoadTransactionName&&(o.name=i.pageLoadTransactionName)),this._config.events.send("transaction:start",[o]),o.onEnd=function(){return K.Promise.resolve().then(function(){if(!r.shouldIgnoreTransaction(o.name))if(o.type===H){var t=r._config.get("pageLoadTransactionName");o.name===D&&t&&(o.name=t),r.capturePageLoadMetrics(o)&&r.add(o)}else r.add(o)},function(t){0})},o},e.shouldIgnoreTransaction=function(t){var e=this._config.get("ignoreTransactions");if(e&&e.length)for(var n=0;n<e.length;n++){var r=e[n];if("function"==typeof r.test){if(r.test(t))return!0}else if(r===t)return!0}return!1},e.startSpan=function(t,e,n){var r=this.ensureCurrentTransaction();if(r)return r.startSpan(t,e,n)},e.add=function(t){this._config.events.send(U,[t])},e.addTask=function(t){var e=this.ensureCurrentTransaction();if(e){t=e.addTask(t);0}return t},e.removeTask=function(t){var e=this.getCurrentTransaction();e&&e.removeTask(t)},e.detectFinish=function(){var t=this.getCurrentTransaction();t&&t.detectFinish()},t}(),Ft=function(i){i.registerServiceCreator("TransactionService",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService");return new At(e,t)}),i.registerServiceCreator("PerformanceMonitoring",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService"),n=i.getService("ApmServer"),r=i.getService("TransactionService");return new Tt(n,t,e,r)})},jt=function(){function t(t,e){e||(e={}),this.onFlush=t,this.items=[],this.queueLimit=e.queueLimit||-1,this.flushInterval=e.flushInterval||0,this.timeoutId=void 0}var e=t.prototype;return e._setTimer=function(){var t=this;this.timeoutId=setTimeout(function(){t.flush()},this.flushInterval)},e.flush=function(){this.onFlush(this.items),this._clear()},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.add=function(t){this.items.push(t),-1!==this.queueLimit&&this.items.length>=this.queueLimit?this.flush():void 0===this.timeoutId&&this._setTimer()},t}();var Pt=function(e,n,t){var r,i=t.context||this,o=t.limit,a=t.interval,s=t.countFn||function(){},c=0;return function(){var t="function"==typeof s&&s.apply(i,arguments);return"number"!=typeof t&&(t=1),c+=t,void 0===r&&(r=setTimeout(function(){r=void(c=0)},a)),o<c?"function"==typeof n?n.apply(i,arguments):void 0:e.apply(i,arguments)}},Rt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Mt=function(){function t(t,e){this._configService=t,this._loggingService=e,this.errorQueue=void 0,this.transactionQueue=void 0,this.throttleAddError=void 0,this.throttleAddTransaction=void 0,this.initialized=!1,this.ndjsonSpan={}}var e=t.prototype;return e.init=function(){this.initialized||(this.initialized=!0,this.initErrorQueue(),this.initTransactionQueue())},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"js-base",version:t.version},language:{name:"javascript"},environment:t.get("environment")}};return mt(ut,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,e,{"Content-Type":"application/x-ndjson"})},e._constructError=function(t){var e=t.url,n=t.status,r=(t.responseText,e+" HTTP status: "+n);return new Error(r)},e._makeHttpRequest=function(e,o,a,s){return new K.Promise(function(n,r){var i=new window.XMLHttpRequest;if(i[O]=!0,i.open(e,o,!0),i.timeout=1e4,s)for(var t in s)s.hasOwnProperty(t)&&i.setRequestHeader(t,s[t]);i.onreadystatechange=function(){if(4===i.readyState){var t=i.status,e=i.responseText;0===t||399<t&&t<600?r({url:o,status:t,responseText:e}):n(e)}},i.onerror=function(){var t=i.status,e=i.responseText;r({url:o,status:t,responseText:e})},i.send(a)})},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new jt(t,{queueLimit:e,flushInterval:n})},e.initErrorQueue=function(){var n=this;this.errorQueue&&this.errorQueue.flush(),this.errorQueue=this._createQueue(function(t){var e=n.sendErrors(t);e&&e.catch(function(t){n._loggingService.warn("Failed sending errors!",n._constructError(t))})});var t=this._configService.get("errorThrottleLimit"),e=this._configService.get("errorThrottleInterval");this.throttleAddError=Pt(this.errorQueue.add.bind(this.errorQueue),function(){return n._loggingService.warn("Dropped error due to throttling!")},{limit:t,interval:e})},e.initTransactionQueue=function(){var n=this;this.transactionQueue&&this.transactionQueue.flush(),this.transactionQueue=this._createQueue(function(t){var e=n.sendTransactions(t);e&&e.catch(function(t){n._loggingService.warn("Failed sending transactions!",n._constructError(t))})});var t=this._configService.get("transactionThrottleLimit"),e=this._configService.get("transactionThrottleInterval");this.throttleAddTransaction=Pt(this.transactionQueue.add.bind(this.transactionQueue),function(){return n._loggingService.warn("Dropped transaction due to throttling!")},{limit:t,interval:e})},e.addError=function(t){this.errorQueue||this.initErrorQueue(),this.throttleAddError(t)},e.addTransaction=function(t){this.transactionQueue||this.initTransactionQueue(),this.throttleAddTransaction(t)},e.ndjsonErrors=function(t){return t.map(function(t){return Rt.stringify({error:t})})},e.ndjsonTransactions=function(t){var n=this.ndjsonSpan;return t.map(function(t){var e="";return t.spans&&(e=t.spans.map(function(t){return n.span=t,Rt.stringify(n)}).join(""),delete t.spans),Rt.stringify({transaction:t})+e})},e._send=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e="transaction"),0!==t.length){var n={service:this.createMetaData().service,data:t},r=this._configService.applyFilters(n);if(r){var i,o=this._configService.getEndpointUrl();if("errors"===e)i=this.ndjsonErrors(r.data);else{if("transaction"!==e)return void 0;i=this.ndjsonTransactions(r.data)}i.unshift(Rt.stringify({metadata:{service:r.service}}));var a=i.join("");return this._postJson(o,a)}this._loggingService.warn("Dropped payload due to filtering!")}},e.sendTransactions=function(t){return this._send(t)},e.sendErrors=function(t){return this._send(t,"errors")},t}();var qt=function(){function t(){this.config={},this.defaults={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",serverUrlPrefix:"/intake/v2/rum/events",active:!0,instrument:!0,disableInstrumentations:[],debug:!1,logLevel:"warn",browserResponsivenessInterval:500,browserResponsivenessBuffer:3,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,capturePageLoad:!0,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,sendPageLoadTransaction:!0,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderValueCallback:c,distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,context:{}},this.events=new tt,this.filters=[],this.version=""}var e=t.prototype;return e.init=function(){var t=function(t){if(!t)return{};for(var e={},n=/^data-([\w-]+)$/,r=t.attributes,i=0;i<r.length;i++){var o=r[i];if(n.test(o.nodeName)){var a=o.nodeName.match(n)[1],s=a.split("-").map(function(t,e){return 0<e?t.charAt(0).toUpperCase()+t.substring(1):t}).join("");e[s]=o.value||o.nodeValue}}return e}(y());this.setConfig(t)},e.isActive=function(){return this.get("active")},e.setVersion=function(t){this.version=t},e.addFilter=function(t){if("function"!=typeof t)throw new Error("Argument to must be function");this.filters.push(t)},e.applyFilters=function(t){for(var e=0;e<this.filters.length;e++)if(!(t=this.filters[e](t)))return;return t},e.get=function(t){return t.split(".").reduce(function(t,e){return t&&t[e]},this.config)},e.getEndpointUrl=function(){return this.config.serverUrl+this.config.serverUrlPrefix},e.set=function(t,e){for(var n=t.split("."),r=n.length-1,i=this.config,o=0;o<r+1;o++){var a=n[o];if(a)if(o===r)i[a]=e;else{var s=i[a]||{};i[a]=s,i=s}}},e.setUserContext=function(t){void 0===t&&(t={});var e={},n=t,r=n.id,i=n.username,o=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof o&&(e.email=o),this.set("context.user",e)},e.setCustomContext=function(t){t&&"object"==typeof t&&this.set("context.custom",t)},e.addLabels=function(e){var n=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(e).forEach(function(t){return f(t,e[t],n.config.context.tags)})},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),this.config=S({},this.defaults,this.config,t),this.events.send(z,[this.config])},e.validate=function(e){void 0===e&&(e={});var n=["serviceName","serverUrl"],r={missing:[],invalid:[]};return Object.keys(e).forEach(function(t){-1===n.indexOf(t)||e[t]||r.missing.push(t)}),e.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(e.serviceName)&&r.invalid.push({key:"serviceName",value:e.serviceName,allowed:"a-z, A-Z, 0-9, _, -, <space>"}),r},t}(),Ht=function(){function t(t){t||(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"info",this.prefix=t.prefix||"",this.resetLogMethods()}var e=t.prototype;return e.shouldLog=function(t){return this.levels.indexOf(t)>=this.levels.indexOf(this.level)},e.setLevel=function(t){this.level=t,this.resetLogMethods()},e.resetLogMethods=function(){var o=this;this.levels.forEach(function(i){o[i]=o.shouldLog(i)?function(){var t,e=o.prefix;switch(i){case"trace":case"debug":t="info";break;default:t=i}var n=arguments;e&&("function"==typeof e&&(e=e(i)),n[0]=e+n[0]);if(console){var r=console[t]?console[t]:console.log;"function"==typeof r&&r.apply(console,n)}}:w})},t}(),Dt=function(){function t(){this._serviceCreators={},this._serviceInstances={},this.initialized=!1}var e=t.prototype;return e.registerCoreServices=function(){var t=this;this.registerServiceCreator("ConfigService",function(){return new qt}),this.registerServiceCreator("LoggingService",function(){return new Ht}),this.registerServiceCreator("ApmServer",function(){return new Mt(t.getService("ConfigService"),t.getService("LoggingService"))})},e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService("ConfigService");t.init();var e=this.getService("LoggingService");n(e,t),t.events.observe(z,function(){n(e,t)}),this.getService("ApmServer").init()}function n(t,e){var n=e.get("debug"),r=e.get("logLevel");!0===n&&"trace"!==r?t.setLevel("debug"):t.setLevel(r)}},e.registerServiceCreator=function(t,e){this._serviceCreators[t]=e},e.registerServiceInstance=function(t,e){this._serviceInstances[t]=e},e.getService=function(t){if(!this._serviceInstances[t]){if("function"!=typeof this._serviceCreators[t])throw new Error("Can not get service, No creator for: "+t);this._serviceInstances[t]=this._serviceCreators[t](this)}return this._serviceInstances[t]},t}();var Qt=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){if(this.isEnabled()&&!this._initialized){this._initialized=!0;var e=this.serviceFactory.getService("ConfigService");e.setVersion("4.4.4"),this.config(t);var n=this.serviceFactory.getService("LoggingService");if(!e.isActive())return n.info("RUM agent is inactive"),this;this.serviceFactory.init();var r=(i=e.get("instrument"),o=e.get("disableInstrumentations"),(a={})[$]=!1,a[V]=!1,a[X]=!1,a[H]=!1,a.error=!1,s=a,i&&Object.keys(s).forEach(function(t){-1===o.indexOf(t)&&(s[t]=!0)}),s);if(this.serviceFactory.getService("PerformanceMonitoring").init(r),r.error)this.serviceFactory.getService("ErrorLogging").registerGlobalEventListener();r[H]&&e.get("sendPageLoadTransaction")&&this._sendPageLoadMetrics()}var i,o,a,s;return this},e._sendPageLoadMetrics=function(){var t=this.serviceFactory.getService("TransactionService").startTransaction(void 0,H,{canReuse:!0});t&&t.addTask(H);var e=function(){setTimeout(function(){t&&t.removeTask(H)})};"complete"===document.readyState?e():window.addEventListener("load",e)},e.isEnabled=function(){return!this._disable},e.observe=function(t,e){this.serviceFactory.getService("ConfigService").events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService("ConfigService"),n=e.validate(t),r=n.missing,o=n.invalid;if(0===r.length&&0===o.length)e.setConfig(t);else{var i=this.serviceFactory.getService("LoggingService"),a="RUM Agent isn't correctly configured: ";0<r.length&&(a+="Missing config - "+r.join(", "),0<o.length&&(a+=", ")),o.forEach(function(t,e){var n=t.key,r=t.value,i=t.allowed;a+=n+' "'+r+'" contains invalid characters! (allowed: '+i+")"+(e!==o.length-1?", ":"")}),i.error(a),e.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService("ConfigService").setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService("ConfigService").setCustomContext(t)},e.addTags=function(t){this.serviceFactory.getService("LoggingService").warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(t){this.serviceFactory.getService("ConfigService").addLabels(t)},e.setInitialPageLoadName=function(t){this.isEnabled()&&this.serviceFactory.getService("ConfigService").setConfig({pageLoadTransactionName:t})},e.startTransaction=function(t,e,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startTransaction(t,e,n)},e.startSpan=function(t,e){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e)},e.getCurrentTransaction=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").getCurrentTransaction()},e.getTransactionService=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService")},e.captureError=function(t){if(this.isEnabled())return this.serviceFactory.getService("ErrorLogging").logError(t)},e.addFilter=function(t){this.serviceFactory.getService("ConfigService").addFilter(t)},t}();n.d(e,"init",function(){return Vt}),n.d(e,"apmBase",function(){return $t}),n.d(e,"apm",function(){return $t}),n.d(e,"ApmBase",function(){return Qt});var Bt,Ut=(it||(it=!0,u()?(rt(),ot=!0):"undefined"!=typeof window&&console.log("APM: Platform is not supported!")),ot),zt=((Bt=new Dt).registerCoreServices(),_t(Bt),Ft(Bt),Bt),$t=new Qt(zt,!Ut);"undefined"!=typeof window&&(window.elasticApm=$t);var Vt=$t.init.bind($t);e.default=Vt}]);
//# sourceMappingURL=elastic-apm-rum.umd.min.js.map

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

const configService = this.serviceFactory.getService('ConfigService');
configService.setVersion('4.4.3');
configService.setVersion('4.4.4');
this.config(config);

@@ -22,0 +22,0 @@ const loggingService = this.serviceFactory.getService('LoggingService');

{
"name": "@elastic/apm-rum",
"version": "4.4.3",
"version": "4.4.4",
"description": "Elastic APM JavaScript agent",

@@ -44,3 +44,3 @@ "main": "dist/lib/index.js",

"dependencies": {
"@elastic/apm-rum-core": "^4.5.3"
"@elastic/apm-rum-core": "^4.5.4"
},

@@ -57,3 +57,3 @@ "bundlesize": [

],
"gitHead": "3808e4c5a34bcd3a6fb1a5b7a50d4bbdde39b385"
"gitHead": "cb3e0338a953daa5705d321de33c11f4a180e56e"
}

@@ -46,3 +46,3 @@ /**

*/
configService.setVersion('4.4.3')
configService.setVersion('4.4.4')
this.config(config)

@@ -49,0 +49,0 @@ /**

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc