Socket
Socket
Sign inDemoInstall

@elastic/apm-rum

Package Overview
Dependencies
Maintainers
61
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.6.0 to 4.7.0

src/index.d.ts

18

CHANGELOG.md

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

# [4.7.0](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum@4.6.0...@elastic/apm-rum@4.7.0) (2020-01-15)
### Bug Fixes
* **rum:** add constructor types for ApmBase class ([#562](https://github.com/elastic/apm-agent-rum-js/issues/562)) ([273f63f](https://github.com/elastic/apm-agent-rum-js/commit/273f63fe3763c5566c45ce02755279ccc7faabb3))
* **rum:** noop for API when agent is inactive ([#569](https://github.com/elastic/apm-agent-rum-js/issues/569)) ([77d4f6d](https://github.com/elastic/apm-agent-rum-js/commit/77d4f6da20bf113bf803652fd01c8d785eea3722))
### Features
* **rum:** add typescript typings ([#537](https://github.com/elastic/apm-agent-rum-js/issues/537)) ([dc4f391](https://github.com/elastic/apm-agent-rum-js/commit/dc4f391fe228a01b7b8e640a73127257a52d5d52))
* capture http-request transactions ([#517](https://github.com/elastic/apm-agent-rum-js/issues/517)) ([27ed994](https://github.com/elastic/apm-agent-rum-js/commit/27ed994ea9866e4493015eb3817ab12266f572a5))
# [4.6.0](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum@4.5.1...@elastic/apm-rum@4.6.0) (2019-11-19)

@@ -8,0 +26,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){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(w);void 0===r[b]&&M(r);var i=n._state;if(i){var o=arguments[i-1];s(function(){return F(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 L(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 b=Math.random().toString(36).substring(2);function w(){}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 O(t,e,n){var r,i,o,a;e.constructor===t.constructor&&n===_&&e.constructor.resolve===S?(o=t,(a=e)._state===E?I(o,a._result):a._state===x?N(o,a._result):A(a,void 0,function(t){return L(o,t)},function(t){return N(o,t)})):void 0===n?I(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?L(e,t):I(e,t))},function(t){n||(n=!0,N(e,t))},e._label);!n&&t&&(n=!0,N(e,t))},t)):I(t,e)}function L(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)I(e,t);else{var n=void 0;try{n=t.then}catch(t){return void N(e,t)}O(e,t,n)}var r,i}function k(t){t._onerror&&t._onerror(t._result),R(t)}function I(t,e){t._state===T&&(t._result=e,t._state=E,0!==t._subscribers.length&&s(R,t))}function N(t,e){t._state===T&&(t._state=x,t._result=e,s(k,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(R,t)}function R(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?F(n,r,i,o):i(o);t._subscribers.length=0}}function F(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?L(e,o):!1===s?N(e,a):t===E?I(e,o):t===x&&N(e,o))}var j=0;function M(t){t[b]=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(w),this.promise[b]||M(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?I(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&I(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===H){var s=new n(w);a?N(s,o):O(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&&I(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}(),H=function(){function e(t){this[b]=j++,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){L(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 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(w);return N(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,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){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(2),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(2),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(1),i=n(9),o=n(2);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(2),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),f=n(0),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 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 d(t,e,n){if(n&&t){var r=x(t);return e&&(e=String(e)),n[r]=e,n}}var p=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function v(){return window.performance.timing.fetchStart}function g(){return{page:{referer:document.referrer,url:window.location.href}}}function m(t){return t&&t.split("?")[0]}function y(t){return null!==t&&"object"==typeof t}function _(t,e,n){for(var r=0,i=e.length;r<i;++r){var o=e[r];if(y(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&&y(f)?(y(t[u])||(t[u]=Array.isArray(f)?[]:{}),_(t[u],[f],!1)):t[u]=f}}return t}function S(){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 b(t){return _(t,i.call(arguments,1),!1)}function w(t){return _(t,i.call(arguments,1),!0)}function T(t){return void 0===t}function E(){}function x(t){return t.replace(/[.*"]/g,"_")}function C(){var n,r,i,t=(n=window.performance.timing,r=n.fetchStart,i={},p.forEach(function(t){var e=n[t];e&&r<=e&&(i[t]=e-r)}),i),e=function(){var t={},e=window.performance;if("function"==typeof 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}}function O(){return window.performance.now()}function L(t){return"number"==typeof t&&0<=t?t:O()}function k(t,e){return T(e)||T(t)?null:parseFloat(e-t)}var I={fetchInProgress:!1};function N(t){return"__apm_symbol__"+t}function A(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=N(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[N("OriginalDelegate")]=a}}return i}var R=N("xhrIgnore"),F=N("xhrSync"),j=N("xhrURL"),M=N("xhrMethod"),P="schedule",H="invoke",q="clear",B="addEventListener",D="removeEventListener",Q=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],U=3e5,z="page-load",$="Unknown",V=60,X=1024,J="transaction:end",Y="config:change",W="xmlhttprequest",Z="fetch",G="history",K="elastic_apm_config",tt=N("xhrTask"),et=N("xhrListener"),nt=N("xhrScheduled");function rt(s){var t=XMLHttpRequest.prototype,c=t[B],u=t[D];if(!c){var e=window.XMLHttpRequestEventTarget;if(e){var n=e.prototype;c=n[B],u=n[D]}}var f="readystatechange";function d(t){t.state=H,t.ignore||s(H,t)}function i(n){XMLHttpRequest[nt]=!1,n.state=P,n.ignore||s(P,n);var r,i=n.data,o=i.target,t=o[et];c||(c=o[B],u=o[D]),t&&(u.call(o,f,t),u.call(o,"load",t));var e=o[et]=function(t){var e=t.type;r?r!=e&&setTimeout(function(){n.state!==H&&d(n)},0):o.readyState===o.DONE&&!i.aborted&&XMLHttpRequest[nt]&&n.state===P&&(r=e)};c.call(o,f,e),c.call(o,"load",e),o[tt]||(o[tt]=n);var a=p.apply(o,i.args);return XMLHttpRequest[nt]=!0,a}var r=A(t,"open",function(){return function(t,e){return t[M]=e[0],t[j]=e[1],t[F]=!1===e[2],r.apply(t,e)}}),p=A(t,"send",function(){return function(t,e){var n={source:W,state:"",type:"macroTask",ignore:t[R],data:{target:t,method:t[M],sync:t[F],url:t[j],args:e,aborted:!1}},r=i(n);return t[F]&&d(n),r}}),o=A(t,"abort",function(){return function(t,e){var n,r=t[tt];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;(n=r).state=q,s(q,n),n.data.aborted=!0}return o.apply(t,e)}})}function it(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:Z,state:"",type:"macroTask",data:{target:i,method:i.method,sync:!1,url:n,args:r,aborted:!1}};return new f.Promise(function(e,n){var t,r;I.fetchInProgress=!0,(t=a).state=P,s(P,t);try{r=c.apply(o,[i])}catch(t){return n(t),a.data.error=t,u(a),void(I.fetchInProgress=!1)}r.then(function(t){e(t),f.Promise.resolve().then(function(){a.data.response=t,u(a)})},function(t){n(t),f.Promise.resolve().then(function(){a.data.error=t,u(a)})}),I.fetchInProgress=!1})}}function u(t){t.state=H,s(H,t)}}var ot=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}(),at=new ot,st=!1;function ct(){return st||(st=!0,rt(function(t,e){at.send(W,[t,e])}),it(function(t,e){at.send(Z,[t,e])}),function(r){if(window.history){var i=history.pushState;"function"==typeof i&&(history.pushState=function(t,e,n){r(H,{source:G,data:{state:t,title:e,url:n}}),i.apply(this,arguments)})}}(function(t,e){at.send(G,[t,e])})),at}var ut=!1,ft=!1;var dt=n(6),pt=n.n(dt);function ht(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=pt.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 vt={service:{name:[X,!0],version:!0,agent:{version:[X,!0]},environment:!0}},lt={"*":!0,headers:{"*":!0}},gt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:lt},response:lt},mt={name:[X,!0],type:[X,!0],id:[X,!0],trace_id:[X,!0],parent_id:[X,!0],transaction_id:[X,!0],subtype:!0,action:!0,context:gt},yt={name:!0,parent_id:!0,type:[X,!0],id:[X,!0],trace_id:[X,!0],span_count:{started:[X,!0]},context:gt},_t={id:[X,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:gt};function St(t){return null==t||""===t||void 0===t}function bt(t,e,n){var r,i,o,a,s=(r=t[e],i=n[0],o=n[1],void 0===i&&(i=X),void 0===o&&(o=!1),void 0===a&&(a="N/A"),o&&St(r)&&(r=a),"string"==typeof r?r.substring(0,i):r);St(s)?delete t[e]:t[e]=s}function wt(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 bt(o,t,n)}):bt(o,e,n):wt(n,i,o[e])},e=0;e<a.length;e++)t(e);return i}var Tt=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=ht(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._transactionService.getCurrentTransaction(),d=f?f.context:{},p=this._configService.get("context"),h=w({},g(),d,p,u),v={id:l(),culprit:r,exception:{message:s,stacktrace:n,type:c},context:h};return f&&(v=b(v,{trace_id:f.traceId,parent_id:f.id,transaction_id:f.id,transaction:{type:f.type,sampled:f.sampled}})),wt(_t,v)},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.registerListeners=function(){var e=this;window.addEventListener("error",function(t){return e.logErrorEvent(t)}),window.addEventListener("unhandledrejection",function(t){return e.logPromiseEvent(t)})},e.logPromiseEvent=function(t){var e="Unhandled promise rejection: ",n=t.reason;null==n?this.logError(e+"<no reason specified>"):"string"==typeof n.message?this.logError({message:e+n.message,stack:n.stack?n.stack:null}):"object"!=typeof n&&this.logError(e+n)},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}(),Et=function(r){r.registerServiceCreator("ErrorLogging",function(){var t=r.getService("ApmServer"),e=r.getService("ConfigService"),n=r.getService("TransactionService");return new Tt(t,e,n)})},xt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],Ct=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Ot=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=xt.slice();i=i.replace("\\","/"),o||(c[2]=[NaN,"path"]);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,i="";this[p]=this[p]||a&&f[3]&&s[p]||"",f[3]&&(this[p]=this[p].toLowerCase())}a&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),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=Ct.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Lt=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(J+":after",function(t){var e=n.createTransactionPayload(t);e&&n._apmServer.addTransaction(e)}),t[G]&&at.observe(G,this.getHistorySub()),t[W]&&at.observe(W,this.getXHRSub()),t[Z]&&at.observe(Z,this.getFetchSub())},e.getHistorySub=function(){var n=this._transactionService;return function(t,e){e.source===G&&t===H&&n.startTransaction(e.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var n=this;return function(t,e){e.source!==W||I.fetchInProgress||n.processAPICalls(t,e)}},e.getFetchSub=function(){var n=this;return function(t,e){e.source===Z&&n.processAPICalls(t,e)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===P&&e.data){var i=new Ot(e.data.url),o=e.data.method+" "+(i.relative?i.path:m(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 Ot(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===H&&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===H&&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.options.checkBrowserResponsiveness){var i=this._configService.get("browserResponsivenessBuffer");if(!this.checkBrowserResponsiveness(t,r,i))return!1}return!0},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 wt(mt,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,breakdown:n.breakdownTimings,span_count:{started:e.length},sampled:n.sampled};return wt(yt,o)},e.createTransactionPayload=function(t){if(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}(),kt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=$),e||(e="custom"),this.name=t,this.type=e,this.options=n,this.id=n.id||l(16),this.traceId=n.traceId,this.sampled=n.sampled,this.timestamp=n.timestamp,this._start=L(n.startTime),this._end=void 0,this.ended=!1,this.onEnd=n.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 d(t,e[t],n.tags)})},e.addContext=function(t){t&&(this.ensureContext(),w(this.context,t))},e.end=function(t){this.ended||(this.ended=!0,this._end=L(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return k(this._start,this._end)},t}();var It=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}(kt),Nt=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function At(t){return{value:t}}function Rt(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,o=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":At(i),"span.self_time.sum.us":At(o)}}}var Ft=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.captureTimings=!1,r.breakdownTimings=[],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=x(t),n=O()-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&&O()-this._start<t},r.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=b(this.options,n))},r.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=b({},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 It(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(t){if(!this.ended){for(var e in this.ended=!0,this._end=L(t),this._activeSpans){var n=this._activeSpans[e];n.type=n.type+".truncated",n.end(t)}var r=g();this.addContext(r),this.callOnEnd()}},r.captureBreakdown=function(){this.breakdownTimings=function(t,e){void 0===e&&(e=window.performance.timing);var s=[],n=t.duration(),r=t.name,i=t.type,o=t.sampled,c={name:r,type:i};if(s.push({transaction:c,samples:{"transaction.duration.count":At(1),"transaction.duration.sum.us":At(n),"transaction.breakdown.count":At(o?1:0)}}),!o)return s;if(i===z&&e)for(var a=0;a<Nt.length;a++){var u=Nt[a],f=k(e[u[0]],e[u[1]]);0!==f&&null!=f&&s.push(Rt(c,{details:{type:u[2]},duration:f}))}else{var d=function(t){var e={},n=function(t){var e=t.spans,n=t._start,r=t._end;if(0===e.length)return t.duration();e.sort(function(t,e){return t._start-e._start});for(var i=e[0],o=i._end,a=i._start,s=o,c=a-n,u=1;u<e.length;u++)a=(i=e[u])._start,o=i._end,s<a?(c+=a-s,s=o):s<o&&(s=o);return s<r&&(c+=r-s),c}(t);e.app={count:1,duration:n};for(var r=t.spans,i=0;i<r.length;i++){var o=r[i],a=o.duration();if(0!==a&&null!=a){var s=o.type,c=o.subType,u=s;c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=a}}return e}(t);Object.keys(d).forEach(function(t){var e=t.split("."),n=e[0],r=e[1],i=d[t],o=i.duration,a=i.count;s.push(Rt(c,{details:{type:n,subtype:r},duration:o,count:a}))})}return s}(this)},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}(kt),jt=[["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 Mt(t,e,n,r,i){return void 0===i&&(i=0),"number"==typeof t&&"number"==typeof e&&i<=t&&t<e&&n<=t-i&&e-i<=r&&e-t<U&&t-i<U&&e-i<U}function Pt(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 Ht(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o="resource";n&&(o+="."+n);var a=m(e),s=new It(a,o);return s.addContext({http:{url:e,response:Pt(t)}}),s._start=r,s.end(),s._end=i,s}function qt(e){if(e.captureTimings){var t=window.performance,n=e._end;if(e.type===z){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=t.timing;(function(t,e,n,r){for(var i=[],o=0;o<jt.length;o++){var a=t[jt[o][0]],s=t[jt[o][1]];if(Mt(a,s,n,r,e)){var c=new It(jt[o][2],"hard-navigation.browser-timing");"requestStart"===jt[o][0]&&(c.pageResponse=!0),c._start=a-e,c.ended=!0,c._end=s-e,i.push(c)}}return i})(i,i.fetchStart,0,n).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)}),e.addMarks(C())}if("function"==typeof t.getEntriesByType){var o=e._start;if(function(t,e,n,r){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a.initiatorType,c=a.name,u=a.startTime,f=a.responseEnd;if("xmlhttprequest"!==s&&"fetch"!==s&&c)if(-1!==Q.indexOf(s)){if(!Mt(u,f,n,r))continue;i.push(Ht(t[o]))}else{if(null!=s)continue;for(var d=!1,p=0;p<e.length;p++){var h=c.lastIndexOf(e[p]);if(-1<h&&h===c.length-e[p].length){d=!0;break}}!d&&Mt(u,f,n,r)&&i.push(Ht(t[o]))}}return i}(t.getEntriesByType("resource"),function(t){for(var e=t.spans,n=[],r=0;r<e.length;r++){var i=e[r];"external"===i.type&&"http"===i.subType||n.push(i.name.split(" ")[1])}return n}(e),o,n).forEach(function(t){return e.spans.push(t)}),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.name,s=o.startTime,c=o.duration,u=s+c;if(!(c<=V)&&Mt(s,u,e,n)){var f=new It(a,"app");f._start=s,f.end(),f._end=u,r.push(f)}}return r}(t.getEntriesByType("measure"),o,n).forEach(function(t){return e.spans.push(t)}),e.type===z){var a=t.getEntriesByType("navigation");a&&0<a.length&&(a=a[0],e.addContext({response:Pt(a)}))}}}}var Bt=function(){function t(t,e){this._config=e,this._logger=t,this.currentTransaction=void 0}var e=t.prototype;return e.ensureCurrentTransaction=function(t){t||(t=this.createOptions());var e=this.getCurrentTransaction();return e||(t.canReuse=!0,t.managed=!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 Ft(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.createOptions=function(t){var e=this._config.config,n=b({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=b({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,checkBrowserResponsiveness:e.checkBrowserResponsiveness},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction();return r?r.canReuse()&&n.canReuse?r.redefine(t,void 0,n):(r.end(),r=this.createTransaction(t,e,n)):r=this.createTransaction(t,e,n),r.captureTimings=!0,e===z&&(r.options.checkBrowserResponsiveness=!1,n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),r.name===$&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),r},e.startTransaction=function(t,e,n){var r,i=this,o=this.createOptions(n);return(r=o.managed?this.startManagedTransaction(t,e,o):new Ft(t,e,o)).onEnd=function(){return i.handleTransactionEnd(r)},this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(r){var i=this;return f.Promise.resolve().then(function(){var t=r.name,e=r.type;if(!i.shouldIgnoreTransaction(t)){if(e===z){var n=i._config.get("pageLoadTransactionName");t===$&&n&&(r.name=n)}qt(r),i.adjustTransactionTime(r),i._config.get("breakdownMetrics")&&r.captureBreakdown(),i._config.events.send(J,[r])}},function(t){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.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.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)},t}(),Dt=function(i){i.registerServiceCreator("TransactionService",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService");return new Bt(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 Lt(n,t,e,r)})},Qt=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 Ut=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)}},zt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),$t=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}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 wt(vt,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,{payload:e,headers:{"Content-Type":"application/x-ndjson"}}).then(function(t){return t.responseText})},e._constructError=function(t){var e=t.url,n=t.status;t.responseText;if(void 0===n)return t;var r=e+" HTTP status: "+n;return new Error(r)},e._makeHttpRequest=function(e,o,t){var n=void 0===t?{timeout:1e4}:t,a=n.timeout,s=n.payload,c=n.headers;return new f.Promise(function(n,r){var i=new window.XMLHttpRequest;if(i[R]=!0,i.open(e,o,!0),i.timeout=a,c)for(var t in c)c.hasOwnProperty(t)&&i.setRequestHeader(t,c[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(i)}},i.onerror=function(){var t=i.status,e=i.responseText;r({url:o,status:t,responseText:e})},i.send(s)})},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new Qt(t,{queueLimit:e,flushInterval:n})},e.fetchConfig=function(t,e){var o=this,n=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return f.Promise.reject("serviceName is required for fetching central config.");n+="?service.name="+t,e&&(n+="&service.environment="+e);var a=this._configService.getLocalConfig();return a&&(n+="&ifnonematch="+a.etag),this._makeHttpRequest("GET",n,{timeout:5e3}).then(function(t){var e=t.status,n=t.responseText;if(304===e)return a;var r=JSON.parse(n),i=t.getResponseHeader("etag");return i&&(r.etag=i.replace(/["]/g,""),o._configService.setLocalConfig(r)),r}).catch(function(t){var e=o._constructError(t);return f.Promise.reject(e)})},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=Ut(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=Ut(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 zt.stringify({error:t})})},e.ndjsonMetricsets=function(t){return t.map(function(t){return zt.stringify({metricset:t})}).join("")},e.ndjsonTransactions=function(t){var r=this;return t.map(function(t){var e="";t.spans&&(e=t.spans.map(function(t){return zt.stringify({span:t})}).join(""),delete t.spans);var n="";return t.breakdown&&(n=r.ndjsonMetricsets(t.breakdown),delete t.breakdown),zt.stringify({transaction:t})+e+n})},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;if("errors"===e)i=this.ndjsonErrors(r.data);else{if("transaction"!==e)return void 0;i=this.ndjsonTransactions(r.data)}i.unshift(zt.stringify({metadata:{service:r.service}}));var o=i.join(""),a=this._configService.getEndpointUrl();return this._postJson(a,o)}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 Vt=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",breakdownMetrics:!1,browserResponsivenessInterval:500,browserResponsivenessBuffer:3,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderValueCallback:c,distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,context:{}},this.events=new ot,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}(S());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.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.config.context.user=b(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=b(this.config.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 d(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(Y,[this.config])},e.validate=function(e){void 0===e&&(e={});var n=["serviceName","serverUrl"],r={missing:[],invalid:[]};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>"});var t=e.transactionSampleRate;return void 0!==t&&("number"!=typeof t||isNaN(t)||t<0||1<t)&&r.invalid.push({key:"transactionSampleRate",value:t,allowed:"Number between 0 and 1"}),r},e.getLocalConfig=function(){var t=sessionStorage.getItem(K);if(t)return JSON.parse(t)},e.setLocalConfig=function(t){t&&sessionStorage.setItem(K,JSON.stringify(t))},t}(),Xt=function(){function t(t){void 0===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&&(n[0]=e+n[0]);if(console){var r=console[t]||console.log;"function"==typeof r&&r.apply(console,n)}}:E})},t}(),Jt=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 Vt}),this.registerServiceCreator("LoggingService",function(){return new Xt({prefix:"[Elastic APM] "})}),this.registerServiceCreator("ApmServer",function(){return new $t(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(Y,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 Yt,Wt=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){var e,n,r,i,o=this;if(this.isEnabled()&&!this._initialized){this._initialized=!0;var a=this.serviceFactory.getService("ConfigService");a.setVersion("4.6.0"),this.config(t);var s=this.serviceFactory.getService("LoggingService");if(a.isActive()){this.serviceFactory.init();var c=(e=a.get("instrument"),n=a.get("disableInstrumentations"),(r={})[W]=!1,r[Z]=!1,r[G]=!1,r[z]=!1,r.error=!1,i=r,e&&Object.keys(i).forEach(function(t){-1===n.indexOf(t)&&(i[t]=!0)}),i);if(this.serviceFactory.getService("PerformanceMonitoring").init(c),c.error)this.serviceFactory.getService("ErrorLogging").registerListeners();var u=function(){return c[z]&&o._sendPageLoadMetrics()};a.get("centralConfig")?this.fetchCentralConfig().then(u):u()}else s.info("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService("ApmServer"),c=this.serviceFactory.getService("LoggingService"),u=this.serviceFactory.getService("ConfigService");return t.fetchConfig(u.get("serviceName"),u.get("environment")).then(function(t){var e=t.transaction_sample_rate;if(e){var n={transactionSampleRate:e=Number(e)},r=u.validate(n).invalid;if(0===r.length)u.setConfig(n);else{var i=r[0],o=i.key,a=i.value,s=i.allowed;c.warn('invalid value "'+a+'" for '+o+". Allowed: "+s+".")}}return t}).catch(function(t){c.warn("failed fetching config:",t)})},e._sendPageLoadMetrics=function(){var t=this.serviceFactory.getService("TransactionService").startTransaction(void 0,z,{managed:!0,canReuse:!0});t&&t.addTask(z);var e=function(){setTimeout(function(){t&&t.removeTask(z)})};"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+=r.join(", ")+" is missing",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}(),Zt=(ut||(ut=!0,u()?(ct(),ft=!0):"undefined"!=typeof window&&console.log("[Elastic APM] platform is not supported!")),ft),Gt=((Yt=new Jt).registerCoreServices(),Et(Yt),Dt(Yt),Yt),Kt=new Wt(Gt,!Zt);"undefined"!=typeof window&&(window.elasticApm=Kt);var te=Kt.init.bind(Kt),ee=n(4),ne=n(1),re=n(2);var ie=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 Ft,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=b({},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}(re.Span);var oe=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={managed:!0};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()===ne.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 re.Span;r.timestamp&&(n._start=r.timestamp-v());var o=new ie(this,n);return e&&e.tags&&o.addTags(e.tags),o},r._inject=function(t,e,n){switch(e){case ne.FORMAT_TEXT_MAP:case ne.FORMAT_HTTP_HEADERS:this.performanceMonitoring.injectDtHeader(t,n);break;case ne.FORMAT_BINARY:0}},r._extract=function(t,e){var n;switch(t){case ne.FORMAT_TEXT_MAP:case ne.FORMAT_HTTP_HEADERS:n=this.performanceMonitoring.extractDtHeader(e);break;case ne.FORMAT_BINARY:0}return n||(n=null),n},n}(ee.Tracer);function ae(t){return e=t.serviceFactory,n=e.getService("PerformanceMonitoring"),r=e.getService("TransactionService"),i=e.getService("ErrorLogging"),o=e.getService("LoggingService"),new oe(n,r,o,i);var e,n,r,i,o}n.d(e,"createTracer",function(){return ae}),n.d(e,"init",function(){return te}),n.d(e,"apm",function(){return Kt}),n.d(e,"apmBase",function(){return Kt}),n.d(e,"ApmBase",function(){return Wt}),"undefined"!=typeof window&&window.elasticApm&&(window.elasticApm.createTracer=ae.bind(window.elasticApm,window.elasticApm));e.default=ae}]);
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e,n){var r;r=function(){"use strict";function t(t){return"function"==typeof t}var e=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,r=void 0,i=void 0,o=function(t,e){p[n]=t,p[n+1]=e,2===(n+=2)&&(i?i(h):y())},a="undefined"!=typeof window?window:void 0,s=a||{},c=s.MutationObserver||s.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<n;t+=2)(0,p[t])(p[t+1]),p[t]=void 0,p[t+1]=void 0;n=0}var l,v,g,m,y=void 0;function _(t,e){var n=this,r=new this.constructor(b);void 0===r[w]&&F(r);var i=n._state;if(i){var a=arguments[i-1];o((function(){return R(i,r,a,n._result)}))}else N(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}u?y=function(){return process.nextTick(h)}:c?(v=0,g=new c(h),m=document.createTextNode(""),g.observe(m,{characterData:!0}),y=function(){m.data=v=++v%2}):f?((l=new MessageChannel).port1.onmessage=h,y=function(){return l.port2.postMessage(0)}):y=void 0===a?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(h)}:d()}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(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===S?function(t,e){e._state===E?I(t,e._result):e._state===x?k(t,e._result):N(e,void 0,(function(e){return O(t,e)}),(function(e){return k(t,e)}))}(e,n):void 0===r?I(e,n):t(r)?function(t,e,n){o((function(t){var r=!1,i=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,(function(n){r||(r=!0,e!==n?O(t,n):I(t,n))}),(function(e){r||(r=!0,k(t,e))}),t._label);!r&&i&&(r=!0,k(t,i))}),t)}(e,n,r):I(e,n)}function O(t,e){if(t===e)k(t,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=e),null===r||"object"!==i&&"function"!==i)I(t,e);else{var n=void 0;try{n=e.then}catch(e){return void k(t,e)}C(t,e,n)}var r,i}function L(t){t._onerror&&t._onerror(t._result),A(t)}function I(t,e){t._state===T&&(t._result=e,t._state=E,0!==t._subscribers.length&&o(A,t))}function k(t,e){t._state===T&&(t._state=x,t._result=e,o(L,t))}function N(t,e,n,r){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+E]=n,i[a+x]=r,0===a&&t._state&&o(A,t)}function A(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(e,n,r,i){var o=t(r),a=void 0,s=void 0,c=!0;if(o){try{a=r(i)}catch(t){c=!1,s=t}if(n===a)return void k(n,new TypeError("A promises callback cannot return that same promise."))}else a=i;n._state!==T||(o&&c?O(n,a):!1===c?k(n,s):e===E?I(n,a):e===x&&k(n,a))}var j=0;function F(t){t[w]=j++,t._state=void 0,t._result=void 0,t._subscribers=[]}var M=function(){function t(t,n){this._instanceConstructor=t,this.promise=new t(b),this.promise[w]||F(this.promise),e(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?I(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&I(this.promise,this._result))):k(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(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===S){var i=void 0,o=void 0,a=!1;try{i=t.then}catch(t){a=!0,o=t}if(i===_&&t._state!==T)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===P){var s=new n(b);a?k(s,o):C(s,t,i),this._willSettleAt(s,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===T&&(this._remaining--,t===x?k(r,n):this._result[e]=n),0===this._remaining&&I(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;N(t,void 0,(function(t){return n._settledAt(E,e,t)}),(function(t){return n._settledAt(x,e,t)}))},t}(),P=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(t,e){try{e((function(e){O(t,e)}),(function(e){k(t,e)}))}catch(e){k(t,e)}}(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 t(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 P.prototype.then=_,P.all=function(t){return new M(this,t).promise},P.race=function(t){var n=this;return e(t)?new n((function(e,r){for(var i=t.length,o=0;o<i;o++)n.resolve(t[o]).then(e,r)})):new n((function(t,e){return e(new TypeError("You must pass an array to race."))}))},P.resolve=S,P.reject=function(t){var e=new this(b);return k(e,t),e},P._setScheduler=function(t){i=t},P._setAsap=function(t){o=t},P._asap=o,P.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=P},P.Promise=P,P},t.exports=r()},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){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(2),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(2),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(t,e,n){var r,i,o;!function(a,s){"use strict";i=[n(7)],void 0===(o="function"==typeof(r=function(t){var e=/(^|@)\S+\:\d+/,n=/^\s*at .*(\S+\:\d+|\(native\))/m,r=/^(eval@)?(\[native code\])?$/;function i(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 o(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(n))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(e){return i(o(e.stack.split("\n"),(function(t){return!!t.match(n)}),this),(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var n=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),r=this.extractLocation(n.pop()),i=n.join(" ")||void 0,o=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>"],r[0])>-1?void 0:r[0];return new t(i,void 0,o,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(o(e.stack.split("\n"),(function(t){return!t.match(r)}),this),(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t(e);var n=e.split("@"),r=this.extractLocation(n.pop()),i=n.join("@")||void 0;return new t(i,void 0,r[0],r[1],r[2],e)}),this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],o=2,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],o=0,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera11:function(n){return i(o(n.stack.split("\n"),(function(t){return!!t.match(e)&&!t.match(/^Error created at/)}),this),(function(e){var n,r=e.split("@"),i=this.extractLocation(r.pop()),o=r.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;o.match(/\(([^\)]*)\)/)&&(n=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(a,s,i[0],i[1],i[2],e)}),this)}}})?r.apply(e,i):r)||(t.exports=o)}()},function(t,e,n){var r,i,o;!function(n,a){"use strict";i=[],void 0===(o="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(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 e.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(e){if(!t(e))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(e)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(e){if(!t(e))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(e)},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():"")+(t(this.getLineNumber())?":"+this.getLineNumber():"")+(t(this.getColumnNumber())?":"+this.getColumnNumber():"")}},e})?r.apply(e,i):r)||(t.exports=o)}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(9),o=n(2);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(2),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),i=n.n(r),o=n(0),a=[].slice;for(var s=[],c=0;c<256;++c)s[c]=(c+256).toString(16).substr(1);function u(t,e){var n=!1;return"string"==typeof e?n=t===e:Array.isArray(e)&&e.forEach((function(e){n||(n=u(t,e))})),n}function f(t){var e,n,r,o;return(e=i()(),r=n||0,[(o=s)[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")).substr(0,t)}function d(){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 p(t,e,n){if(n&&t){var r=E(t);return e&&(e=String(e)),n[r]=e,n}}var h=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function l(){return window.performance.timing.fetchStart}function v(){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(r.src.indexOf("elastic")>0)return r}}()}}function S(t){return y(t,a.call(arguments,1),!1)}function w(t){return y(t,a.call(arguments,1),!0)}function b(t){return void 0===t}function T(){}function E(t){return t.replace(/[.*"]/g,"_")}function x(){var t=function(){var t=window.performance.timing,e=t.fetchStart,n={};return h.forEach((function(r){var i=t[r];i&&i>=e&&(n[r]=i-e)})),n}(),e=function(){var t={},e=window.performance;if("function"==typeof e.getEntriesByType){var n=e.getEntriesByType("paint");if(n.length>0)for(var r=e.timing,i=r.fetchStart-r.navigationStart,o=0;o<n.length;o++){var a=n[o],s=i>=0?a.startTime-i:a.startTime;t[a.name]=s}}return t}(),n={timeToFirstByte:t.responseStart,domInteractive:t.domInteractive,domComplete:t.domComplete};return e["first-contentful-paint"]&&(n.firstContentfulPaint=e["first-contentful-paint"]),{navigationTiming:t,agent:n}}function C(){return window.performance.now()}function O(t){return"number"==typeof t&&t>=0?t:C()}function L(t,e){return b(e)||b(t)?null:parseFloat(e-t)}function I(t){o.Promise.resolve().then(t)}var k={fetchInProgress:!1};function N(t){return"__apm_symbol__"+t}function A(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=N(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[N("OriginalDelegate")]=a}}return i}var R=N("xhrIgnore"),j=N("xhrSync"),F=N("xhrURL"),M=N("xhrMethod"),P="schedule",q="invoke",H="clear",D="addEventListener",B="removeEventListener",Q=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],z=3e5,U="page-load",$="custom",X="Unknown",V=[U,"route-change","http-request",$,"temporary"],J=60,Y="xmlhttprequest",W="fetch",Z="history",G="error",K=1024,tt=N("xhrTask"),et=N("xhrListener"),nt=N("xhrScheduled");function rt(t){var e=XMLHttpRequest.prototype,n=e[D],r=e[B];if(!n){var i=window.XMLHttpRequestEventTarget;if(i){var o=i.prototype;n=o[D],r=o[B]}}var a="readystatechange",s="load";function c(e){e.state=q,t(q,e)}function u(e){XMLHttpRequest[nt]=!1,e.state=P,t(P,e);var i=e.data,o=i.aborted,u=i.target;n||(n=u[D],r=u[B]);var f,d=u[et];d&&(r.call(u,a,d),r.call(u,s,d));var p=u[et]=function(t){var n=t.type;f?f!=n&&function(t){setTimeout(t,0)}((function(){e.state!==q&&c(e)})):u.readyState===u.DONE&&!o&&XMLHttpRequest[nt]&&e.state===P&&(f=n)};n.call(u,a,p),n.call(u,s,p),u[tt]||(u[tt]=e)}var f=A(e,"open",(function(){return function(t,e){return t[R]||(t[M]=e[0],t[F]=e[1],t[j]=!1===e[2]),f.apply(t,e)}})),d=A(e,"send",(function(){return function(t,e){if(t[R])return d.apply(t,e);var n={source:Y,state:"",type:"macroTask",data:{target:t,method:t[M],sync:t[j],url:t[F],aborted:!1}};u(n);var r=d.apply(t,e);return XMLHttpRequest[nt]=!0,t[j]&&c(n),r}})),p=A(e,"abort",(function(){return function(e,n){if(!e[R]){var r=e[tt];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;!function(e){e.state=H,t(H,e),e.data.aborted=!0}(r)}}return p.apply(e,n)}}))}var it=function(){function t(){this.observers={}}var e=t.prototype;return e.observe=function(t,e){var n=this;if("function"==typeof e)return this.observers[t]||(this.observers[t]=[]),this.observers[t].push(e),function(){var r=n.observers[t].indexOf(e);r>-1&&n.observers[t].splice(r,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}(),ot=new it,at=!1;function st(){return at||(at=!0,rt((function(t,e){ot.send(Y,[t,e])})),function(t){if(window.fetch&&window.Request){var e=window.fetch;window.fetch=function(t,i){var a,s,c=this,u=arguments;if("string"==typeof t)a=new Request(t,i),s=t;else{if(!t)return e.apply(c,u);s=(a=t).url}var f={source:W,state:"",type:"macroTask",data:{target:a,method:a.method,sync:!1,url:s,aborted:!1}};return new o.Promise((function(t,i){var o;k.fetchInProgress=!0,n(f);try{o=e.apply(c,[a])}catch(t){return i(t),f.data.error=t,r(f),void(k.fetchInProgress=!1)}o.then((function(e){t(e),I((function(){f.data.response=e,r(f)}))}),(function(t){i(t),I((function(){f.data.error=t,r(f)}))})),k.fetchInProgress=!1}))}}function n(e){e.state=P,t(P,e)}function r(e){e.state=q,t(q,e)}}((function(t,e){ot.send(W,[t,e])})),function(t){if(window.history){var e=history.pushState;"function"==typeof e&&(history.pushState=function(n,r,i){var o={source:Z,data:{state:n,title:r,url:i}};t(q,o),e.apply(this,arguments)})}}((function(t,e){ot.send(Z,[t,e])}))),ot}var ct=!1,ut=!1;var ft=n(6),dt=n.n(ft);function pt(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=dt.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,n=e.split("/"),e=(e=(e=n.length>1?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>"),e=(n=e.split(".")).length>1?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=function(t){return void 0===t&&(t=""),"<anonymous>"===t&&(t=""),t}(e),u=(a=c,s=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),a.indexOf(s)>-1&&(a=a.replace(s+"/","")),a);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u="(inline script)"),{abs_path:e,filename:u,function:o,lineno:n,colno:r}}))}var ht={service:{name:[K,!0],version:!0,agent:{version:[K,!0]},environment:!0}},lt={"*":!0,headers:{"*":!0}},vt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:lt},destination:{address:[K],service:{"*":[K,!0]}},response:lt},gt={name:[K,!0],type:[K,!0],id:[K,!0],trace_id:[K,!0],parent_id:[K,!0],transaction_id:[K,!0],subtype:!0,action:!0,context:vt},mt={name:!0,parent_id:!0,type:[K,!0],id:[K,!0],trace_id:[K,!0],span_count:{started:[K,!0]},context:vt},yt={id:[K,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:vt};function _t(t){return null==t||""===t||void 0===t}function St(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=K),void 0===n&&(n=!1),void 0===r&&(r="N/A"),n&&_t(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);_t(r)?delete t[e]:t[e]=r}function wt(t,e,n){void 0===t&&(t={}),void 0===n&&(n=e);for(var r=Object.keys(t),i=[],o=function(o){var a=r[o],s=!0===t[a]?i:t[a];Array.isArray(s)?"*"===a?Object.keys(n).forEach((function(t){return St(n,t,s)})):St(n,a,s):wt(s,e,n[a])},a=0;a<r.length;a++)o(a);return e}var bt=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=function(t){return t.filter((function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}))}(pt(t)),n="(inline script)",r=e[e.length-1];r&&r.filename&&(n=r.filename);var i=t.message,o=t.error,a=i,s="",c={};o&&"object"==typeof o&&(a=a||o.message,s=o.name,c=this._getErrorProperties(o)),s||a&&a.indexOf(":")>-1&&(s=a.split(":")[0]);var u=this._transactionService.getCurrentTransaction(),d=u?u.context:{},p=this._configService.get("context"),h=w({},v(),d,p,c),l={id:f(),culprit:n,exception:{message:a,stacktrace:e,type:s},context:h};return u&&(l=S(l,{trace_id:u.traceId,parent_id:u.id,transaction_id:u.id,transaction:{type:u.type,sampled:u.sampled}})),wt(yt,l)},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.registerListeners=function(){var t=this;window.addEventListener("error",(function(e){return t.logErrorEvent(e)})),window.addEventListener("unhandledrejection",(function(e){return t.logPromiseEvent(e)}))},e.logPromiseEvent=function(t){var e="Unhandled promise rejection: ",n=t.reason;null==n?this.logError(e+"<no reason specified>"):"string"==typeof n.message?this.logError({message:e+n.message,stack:n.stack?n.stack:null}):"object"!=typeof n&&this.logError(e+n)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},e._getErrorProperties=function(t){var e={};return Object.keys(t).forEach((function(n){if("stack"!==n){var r=t[n];if(null!==r){switch(typeof r){case"function":return;case"object":if("function"!=typeof r.toISOString)return;r=r.toISOString()}e[n]=r}}})),e},t}(),Tt={ErrorLogging:bt,registerServices:function(t){t.registerServiceCreator("ErrorLogging",(function(){var e=t.getService("ApmServer"),n=t.getService("ConfigService"),r=t.getService("TransactionService");return new bt(e,n,r)}))}};var Et=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],xt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Ct=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=Et.slice();i=i.replace("\\","/"),o||(c[2]=[NaN,"path"]);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 l=i.lastIndexOf(d);e=Math.max(e,l),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,i="";this[p]=this[p]||a&&f[3]&&s[p]||"",f[3]&&(this[p]=this[p].toLowerCase())}if(a&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),this.relative=a,this.protocol=r||s.protocol,this.hostname=this.host,this.port="",/:\d+$/.test(this.host)){var v=this.host.split(":"),g=v.pop(),m=v.join(":");!function(t,e){switch(e){case"http:":return"80"===t;case"https:":return"443"===t}return!0}(g,this.protocol)?this.port=g:this.host=m,this.hostname=m}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=this.auth.split(":");t+=(e[0]?"[REDACTED]":"")+(e[1]?":[REDACTED]":"")+"@"}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=xt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Ot=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 e=this;void 0===t&&(t={}),this._configService.events.observe("transaction:end:after",(function(t){var n=e.createTransactionPayload(t);n&&e._apmServer.addTransaction(n)})),t[Z]&&ot.observe(Z,this.getHistorySub()),t[Y]&&ot.observe(Y,this.getXHRSub()),t[W]&&ot.observe(W,this.getFetchSub())},e.getHistorySub=function(){var t=this._transactionService;return function(e,n){n.source===Z&&e===q&&t.startTransaction(n.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){n.source!==Y||k.fetchInProgress||t.processAPICalls(e,n)}},e.getFetchSub=function(){var t=this;return function(e,n){n.source===W&&t.processAPICalls(e,n)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===P&&e.data){var i=e.data,o=new Ct(i.url),a=i.method+" "+(o.relative?o.path:g(o.href));r.getCurrentTransaction()||r.startTransaction(a,"http-request",{managed:!0});var s=r.startSpan(a,"external.http"),c=r.addTask();if(!s)return;var f=n.get("distributedTracing"),d=n.get("distributedTracingOrigins"),p=new Ct(window.location.href),h=u(o.origin,p.origin)||u(o.origin,d),l=i.target;f&&h&&l&&this.injectDtHeader(s,l),s.sync=i.sync,i.span=s,e.id=c}else t===q&&(e.data&&e.data.span&&e.data.span.end(null,e.data),e.id&&r.removeTask(e.id))},e.injectDtHeader=function(t,e){var n,r=this._configService.get("distributedTracingHeaderName"),i=function(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}}(t),o=/^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/.test(n=i)&&"00000000000000000000000000000000"!==n.slice(3,35)&&"0000000000000000"!==n.slice(36,52);r&&i&&o&&("function"==typeof e.setRequestHeader?e.setRequestHeader(r,i):e.headers&&"function"==typeof e.headers.append?e.headers.append(r,i):e[r]=i)},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.filterTransaction=function(t){var e=this._configService.get("transactionDurationThreshold"),n=t.duration();if(!n)return!1;if(n>e)return!1;if((t.sampled||t.resetSpans(),t.options.checkBrowserResponsiveness)&&!this.checkBrowserResponsiveness(t,500,3))return!1;return!0},e.prepareTransaction=function(t){t.spans.sort((function(t,e){return t._start-e._start})),this._configService.get("groupSimilarSpans")&&(t.spans=this.groupSmallContinuouslySimilarSpans(t,.05)),t.spans=t.spans.filter((function(e){return e.duration()>0&&e._start>=t._start&&e._end<=t._end}))},e.createTransactionDataModel=function(t){var e=t._start,n=t.spans.map((function(n){var r={id:n.id,transaction_id:t.id,parent_id:n.parentId||t.id,trace_id:t.traceId,name:n.name,type:n.type,subType:n.subType,action:n.action,sync:n.sync,start:n._start-e,duration:n.duration(),context:n.context};return wt(gt,r)})),r={id:t.id,trace_id:t.traceId,name:t.name,type:t.type,duration:t.duration(),spans:n,context:t.context,marks:t.marks,breakdown:t.breakdownTimings,span_count:{started:n.length},sampled:t.sampled};return wt(mt,r)},e.createTransactionPayload=function(t){if(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(t,e){var n=t.duration(),r=[],i=1;return t.spans.forEach((function(o,a){if(0===r.length)r.push(o);else{var s=r[r.length-1],c=s.type===o.type&&s.subType===o.subType&&s.action===o.action&&s.name===o.name&&o.duration()/n<e&&(o._start-s._end)/n<e,u=t.spans.length===a+1;c&&(i++,s._end=o._end),i>1&&(!c||u)&&(s.name=i+"x "+s.name,i=1),c||r.push(o)}})),r},e.checkBrowserResponsiveness=function(t,e,n){var r=t.browserResponsivenessCounter,i=t.duration();return r+n>=Math.floor(i/e)},t}(),Lt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=X),e||(e=$),this.name=t,this.type=e,this.options=n,this.id=n.id||f(16),this.traceId=n.traceId,this.sampled=n.sampled,this.timestamp=n.timestamp,this._start=O(n.startTime),this._end=void 0,this.ended=!1,this.onEnd=n.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(t){this.ensureContext();var e=this.context;e.tags||(e.tags={}),Object.keys(t).forEach((function(n){return p(n,t[n],e.tags)}))},e.addContext=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];0!==e.length&&(this.ensureContext(),w.apply(void 0,[this.context].concat(e)))},e.end=function(t){this.ended||(this.ended=!0,this._end=O(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return L(this._start,this._end)},t}(),It=91,kt=93,Nt="external",At="resource";function Rt(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 jt(t,e){var n=t.port,r=t.protocol,i=t.hostname,o=t.host,a=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(n,r),s=i.charCodeAt(0)===It&&i.charCodeAt(i.length-1)===kt,c=i;return s&&(c=i.slice(1,-1)),{service:{name:r+"//"+o,resource:i+":"+a,type:e},address:c,port:Number(a)}}function Ft(t,e){if(e){var n;switch(t.type){case Nt:n=function(t){var e,n=t.url,r=t.method,i=t.target,o=t.response,a=new Ct(n),s=jt(a,Nt),c={http:{method:r,url:a.href},destination:s};return i&&void 0!==i.status?e=i.status:o&&(e=o.status),c.http.status_code=e,c}(e);break;case At:n=function(t){var e=t.entry,n=t.url,r=jt(new Ct(n),At);return{http:{url:n,response:Rt(e)},destination:r}}(e)}t.addContext(n)}}var Mt=function(t){var e,n;function r(e,n,r){var i;if((i=t.call(this,e,n,r)||this).parentId=i.options.parentId,i.subType=void 0,i.action=void 0,-1!==i.type.indexOf(".")){var o=i.type.split(".",3);i.type=o[0],i.subType=o[1],i.action=o[2]}return i.sync=i.options.sync,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r.prototype.end=function(e,n){t.prototype.end.call(this,e),Ft(this,n)},r}(Lt),Pt=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function qt(t){return{value:t}}function Ht(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,o=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":qt(i),"span.self_time.sum.us":qt(o)}}}var Dt=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=f(),i.marks=void 0,i.spans=[],i._activeSpans={},i.nextAutoTaskId=1,i._scheduledTasks=[],i.captureTimings=!1,i.breakdownTimings=[],i.sampled=Math.random()<=i.options.transactionSampleRate,i.browserResponsivenessCounter=0,i}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i.addMarks=function(t){this.marks=w(this.marks||{},t)},i.mark=function(t){var e=E(t),n=C()-this._start,r={};r[e]=n,this.addMarks({custom:r})},i.canReuse=function(t){return void 0===t&&(t=5e3),!!this.options.canReuse&&!this.ended&&C()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=S(this.options,n))},i.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 Mt(t,e,i);return this._activeSpans[o.id]=o,o}},i.isFinished=function(){return 0===this._scheduledTasks.length},i.detectFinish=function(){this.isFinished()&&this.end()},i.end=function(t){if(!this.ended){for(var e in this.ended=!0,this._end=O(t),this._activeSpans){var n=this._activeSpans[e];n.type=n.type+".truncated",n.end(t)}this.callOnEnd()}},i.captureBreakdown=function(){this.breakdownTimings=function(t,e){void 0===e&&(e=window.performance.timing);var n=[],r=t.duration(),i=t.name,o=t.type,a=t.sampled,s={name:i,type:o};if(n.push({transaction:s,samples:{"transaction.duration.count":qt(1),"transaction.duration.sum.us":qt(r),"transaction.breakdown.count":qt(a?1:0)}}),!a)return n;if(o===U&&e)for(var c=0;c<Pt.length;c++){var u=Pt[c],f=L(e[u[0]],e[u[1]]);0!==f&&null!=f&&n.push(Ht(s,{details:{type:u[2]},duration:f}))}else{var d=function(t){var e={},n=function(t){var e=t.spans,n=t._start,r=t._end;if(0===e.length)return t.duration();e.sort((function(t,e){return t._start-e._start}));for(var i=e[0],o=i._end,a=i._start,s=o,c=a-n,u=1;u<e.length;u++)a=(i=e[u])._start,o=i._end,a>s?(c+=a-s,s=o):o>s&&(s=o);return s<r&&(c+=r-s),c}(t);e.app={count:1,duration:n};for(var r=t.spans,i=0;i<r.length;i++){var o=r[i],a=o.duration();if(0!==a&&null!=a){var s=o.type,c=o.subType,u=s;c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=a}}return e}(t);Object.keys(d).forEach((function(t){var e=t.split("."),r=e[0],i=e[1],o=d[t],a=o.duration,c=o.count;n.push(Ht(s,{details:{type:r,subtype:i},duration:a,count:c}))}))}return n}(this)},i.addTask=function(t){if(void 0===t&&(t="task"+this.nextAutoTaskId++),-1==this._scheduledTasks.indexOf(t))return this._scheduledTasks.push(t),t},i.removeTask=function(t){var e=this._scheduledTasks.indexOf(t);e>-1&&this._scheduledTasks.splice(e,1),this.detectFinish()},i.resetSpans=function(){this.spans=[]},i._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id]},r}(Lt),Bt=[["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 Qt(t,e,n,r,i){return void 0===i&&(i=0),"number"==typeof t&&"number"==typeof e&&t>=i&&e>t&&t-i>=n&&e-i<=r&&e-t<z&&t-i<z&&e-i<z}function zt(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 Mt(a,o);return s._start=r,s.end(i,{url:e,entry:t}),s}function Ut(t){if(t.captureTimings){var e=window.performance,n=t._end;if(t.type===U){if(t.marks&&t.marks.custom){var r=t.marks.custom;Object.keys(r).forEach((function(e){r[e]+=t._start}))}t._start=0;var i=e.timing;(function(t,e,n,r){for(var i=[],o=0;o<Bt.length;o++){var a=t[Bt[o][0]],s=t[Bt[o][1]];if(Qt(a,s,n,r,e)){var c=new Mt(Bt[o][2],"hard-navigation.browser-timing");"requestStart"===Bt[o][0]&&(c.pageResponse=!0),c._start=a-e,c.end(s-e),i.push(c)}}return i})(i,i.fetchStart,0,n).forEach((function(e){e.traceId=t.traceId,e.sampled=t.sampled,e.pageResponse&&t.options.pageLoadSpanId&&(e.id=t.options.pageLoadSpanId),t.spans.push(e)})),t.addMarks(x())}if("function"==typeof e.getEntriesByType){var o=t._start;(function(t,e,n,r){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a.initiatorType,c=a.name,u=a.startTime,f=a.responseEnd;if("xmlhttprequest"!==s&&"fetch"!==s&&c)if(-1!==Q.indexOf(s)){if(!Qt(u,f,n,r))continue;i.push(zt(t[o]))}else{if(null!=s)continue;for(var d=!1,p=0;p<e.length;p++){var h=c.lastIndexOf(e[p]);if(h>-1&&h===c.length-e[p].length){d=!0;break}}!d&&Qt(u,f,n,r)&&i.push(zt(t[o]))}}return i})(e.getEntriesByType("resource"),function(t){for(var e=t.spans,n=[],r=0;r<e.length;r++){var i=e[r];"external"===i.type&&"http"===i.subType||n.push(i.name.split(" ")[1])}return n}(t),o,n).forEach((function(e){return t.spans.push(e)})),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.name,s=o.startTime,c=o.duration,u=s+c;if(!(c<=J)&&Qt(s,u,e,n)){var f=new Mt(a,"app");f._start=s,f.end(u),r.push(f)}}return r}(e.getEntriesByType("measure"),o,n).forEach((function(e){return t.spans.push(e)}))}}}var $t=function(){function t(t,e){this._config=e,this._logger=t,this.currentTransaction=void 0,this.respIntervalId=void 0}var e=t.prototype;return e.ensureCurrentTransaction=function(t,e,n){var r=this.getCurrentTransaction();return r||(r=new Dt(t,e,n),this.setCurrentTransaction(r),r)},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.setCurrentTransaction=function(t){this.currentTransaction=t},e.ensureRespInterval=function(t){var e=this,n=function(){clearInterval(e.respIntervalId),e.respIntervalId=void 0};t?void 0===this.respIntervalId&&(this.respIntervalId=setInterval((function(){var t=e.getCurrentTransaction();t?t.browserResponsivenessCounter++:n()}),500)):void 0!==this.respIntervalId&&n()},e.createOptions=function(t){var e=this._config.config,n=S({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=S({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,checkBrowserResponsiveness:e.checkBrowserResponsiveness},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction();if(r)if(r.canReuse()&&n.canReuse){var i;0;var o=V.indexOf(r.type),a=V.indexOf(e);-1!==o&&-1!==a&&a<o&&(i=e),r.redefine(t,i,n)}else r.end(),r=this.ensureCurrentTransaction(t,e,n);else r=this.ensureCurrentTransaction(t,e,n);return r.captureTimings=!0,r.type===U&&(r.options.checkBrowserResponsiveness=!1,n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),r.name===X&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),this.ensureRespInterval(r.options.checkBrowserResponsiveness),r},e.startTransaction=function(t,e,n){var r,i=this,o=this.createOptions(n);return(r=o.managed?this.startManagedTransaction(t,e,o):new Dt(t,e,o)).onEnd=function(){return i.handleTransactionEnd(r)},this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;return o.Promise.resolve().then((function(){var n=t.name,r=t.type;if(!e.shouldIgnoreTransaction(n)&&"temporary"!==r){if(r===U){var i=e._config.get("pageLoadTransactionName");n===X&&i&&(t.name=i)}Ut(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var o=e._config.get("context");!function(t,e){var n=v(),r={};if(t.type===U&&"function"==typeof performance.getEntriesByType){var i=performance.getEntriesByType("navigation");i&&i.length>0&&(r={response:Rt(i[0])})}t.addContext(n,r,e)}(t,o),e._config.events.send("transaction:end",[t])}}),(function(t){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.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(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0}));if(r)return r.startSpan(t,e,n)},e.addTask=function(t){var e=this.ensureCurrentTransaction(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0}));if(e){t=e.addTask(t);0}return t},e.removeTask=function(t){var e=this.getCurrentTransaction();e&&e.removeTask(t)},t}(),Xt={PerformanceMonitoring:Ot,registerServices:function(t){t.registerServiceCreator("TransactionService",(function(){var e=t.getService("ConfigService"),n=t.getService("LoggingService");return new $t(n,e)})),t.registerServiceCreator("PerformanceMonitoring",(function(){var e=t.getService("ConfigService"),n=t.getService("LoggingService"),r=t.getService("ApmServer"),i=t.getService("TransactionService");return new Ot(r,e,n,i)}))}},Vt=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 Jt=function(t,e,n){var r,i=n.context||this,o=n.limit,a=n.interval,s=n.countFn||function(){},c=0;return function(){var n="function"==typeof s&&s.apply(i,arguments);return"number"!=typeof n&&(n=1),c+=n,void 0===r&&(r=setTimeout((function(){c=0,r=void 0}),a)),c>o?"function"==typeof e?e.apply(i,arguments):void 0:t.apply(i,arguments)}},Yt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Wt=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}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 wt(ht,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,{payload:e,headers:{"Content-Type":"application/x-ndjson"}}).then((function(t){return t.responseText}))},e._constructError=function(t){var e=t.url,n=t.status;t.responseText;if(void 0===n)return t;var r=e+" HTTP status: "+n;return new Error(r)},e._makeHttpRequest=function(t,e,n){var r=void 0===n?{timeout:1e4}:n,i=r.timeout,a=r.payload,s=r.headers;return new o.Promise((function(n,r){var o=new window.XMLHttpRequest;if(o[R]=!0,o.open(t,e,!0),o.timeout=i,s)for(var c in s)s.hasOwnProperty(c)&&o.setRequestHeader(c,s[c]);o.onreadystatechange=function(){if(4===o.readyState){var t=o.status,i=o.responseText;0===t||t>399&&t<600?r({url:e,status:t,responseText:i}):n(o)}},o.onerror=function(){var t=o.status,n=o.responseText;r({url:e,status:t,responseText:n})},o.send(a)}))},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new Vt(t,{queueLimit:e,flushInterval:n})},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return o.Promise.reject("serviceName is required for fetching central config.");r+="?service.name="+t,e&&(r+="&service.environment="+e);var i=this._configService.getLocalConfig();return i&&(r+="&ifnonematch="+i.etag),this._makeHttpRequest("GET",r,{timeout:5e3}).then((function(t){var e=t.status,r=t.responseText;if(304===e)return i;var o=JSON.parse(r),a=t.getResponseHeader("etag");return a&&(o.etag=a.replace(/["]/g,""),n._configService.setLocalConfig(o)),o})).catch((function(t){var e=n._constructError(t);return o.Promise.reject(e)}))},e.initErrorQueue=function(){var t=this;this.errorQueue&&this.errorQueue.flush(),this.errorQueue=this._createQueue((function(e){var n=t.sendErrors(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending errors!",t._constructError(e))}))}));var e=this._configService.get("errorThrottleLimit"),n=this._configService.get("errorThrottleInterval");this.throttleAddError=Jt(this.errorQueue.add.bind(this.errorQueue),(function(){return t._loggingService.warn("Dropped error due to throttling!")}),{limit:e,interval:n})},e.initTransactionQueue=function(){var t=this;this.transactionQueue&&this.transactionQueue.flush(),this.transactionQueue=this._createQueue((function(e){var n=t.sendTransactions(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending transactions!",t._constructError(e))}))}));var e=this._configService.get("transactionThrottleLimit"),n=this._configService.get("transactionThrottleInterval");this.throttleAddTransaction=Jt(this.transactionQueue.add.bind(this.transactionQueue),(function(){return t._loggingService.warn("Dropped transaction due to throttling!")}),{limit:e,interval:n})},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 Yt.stringify({error:t})}))},e.ndjsonMetricsets=function(t){return t.map((function(t){return Yt.stringify({metricset:t})})).join("")},e.ndjsonTransactions=function(t){var e=this;return t.map((function(t){var n="";t.spans&&(n=t.spans.map((function(t){return Yt.stringify({span:t})})).join(""),delete t.spans);var r="";return t.breakdown&&(r=e.ndjsonMetricsets(t.breakdown),delete t.breakdown),Yt.stringify({transaction:t})+n+r}))},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;if("errors"===e)i=this.ndjsonErrors(r.data);else{if("transaction"!==e)return void 0;i=this.ndjsonTransactions(r.data)}i.unshift(Yt.stringify({metadata:{service:r.service}}));var o=i.join(""),a=this._configService.get("serverUrl")+"/intake/v2/rum/events";return this._postJson(a,o)}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 Zt=function(){function t(){this.config={},this.defaults={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",active:!0,instrument:!0,disableInstrumentations:[],debug:!1,logLevel:"warn",breakdownMetrics:!1,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,context:{}},this.events=new it,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].split("-").map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join("");e[a]=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.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.config.context.user=S(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=S(this.config.context.custom||{},t)},e.addLabels=function(t){var e=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(t).forEach((function(n){return p(n,t[n],e.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("config:change",[this.config])},e.validate=function(t){void 0===t&&(t={});var e=["serviceName","serverUrl"],n={missing:[],invalid:[]};Object.keys(t).forEach((function(r){-1===e.indexOf(r)||t[r]||n.missing.push(r)})),t.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(t.serviceName)&&n.invalid.push({key:"serviceName",value:t.serviceName,allowed:"a-z, A-Z, 0-9, _, -, <space>"});var r=t.transactionSampleRate;return void 0!==r&&("number"!=typeof r||isNaN(r)||r<0||r>1)&&n.invalid.push({key:"transactionSampleRate",value:r,allowed:"Number between 0 and 1"}),n},e.getLocalConfig=function(){var t=sessionStorage.getItem("elastic_apm_config");if(t)return JSON.parse(t)},e.setLocalConfig=function(t){t&&sessionStorage.setItem("elastic_apm_config",JSON.stringify(t))},t}(),Gt=function(){function t(t){void 0===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 t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var n,r=t.prefix;switch(e){case"trace":case"debug":n="info";break;default:n=e}var i=arguments;r&&(i[0]=r+i[0]);if(console){var o=console[n]||console.log;"function"==typeof o&&o.apply(console,i)}}:T}))},t}(),Kt=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 Zt})),this.registerServiceCreator("LoggingService",(function(){return new Gt({prefix:"[Elastic APM] "})})),this.registerServiceCreator("ApmServer",(function(){return new Wt(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("config:change",(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 te,ee=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){var e=this;if(this.isEnabled()&&!this._initialized){this._initialized=!0;var n=this.serviceFactory.getService("ConfigService");n.setVersion("4.7.0"),this.config(t);var r=this.serviceFactory.getService("LoggingService");if(n.isActive()){this.serviceFactory.init();var i=function(t,e){var n,r=((n={})[Y]=!1,n[W]=!1,n[Z]=!1,n[U]=!1,n[G]=!1,n);return t?(Object.keys(r).forEach((function(t){-1===e.indexOf(t)&&(r[t]=!0)})),r):r}(n.get("instrument"),n.get("disableInstrumentations"));if(this.serviceFactory.getService("PerformanceMonitoring").init(i),i[G])this.serviceFactory.getService("ErrorLogging").registerListeners();var o=function(){return i[U]&&e._sendPageLoadMetrics()};n.get("centralConfig")?this.fetchCentralConfig().then(o):o()}else this._disable=!0,r.info("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService("ApmServer"),e=this.serviceFactory.getService("LoggingService"),n=this.serviceFactory.getService("ConfigService");return t.fetchConfig(n.get("serviceName"),n.get("environment")).then((function(t){var r=t.transaction_sample_rate;if(r){var i={transactionSampleRate:r=Number(r)},o=n.validate(i).invalid;if(0===o.length)n.setConfig(i);else{var a=o[0],s=a.key,c=a.value,u=a.allowed;e.warn('invalid value "'+c+'" for '+s+". Allowed: "+u+".")}}return t})).catch((function(t){e.warn("failed fetching config:",t)}))},e._sendPageLoadMetrics=function(){var t=this.startTransaction(void 0,U,{managed:!0,canReuse:!0});t&&t.addTask(U);var e=function(){setTimeout((function(){t&&t.removeTask(U)}))};"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,i=n.invalid;if(0===r.length&&0===i.length)e.setConfig(t);else{var o=this.serviceFactory.getService("LoggingService"),a="RUM agent isn't correctly configured. ";r.length>0&&(a+=r.join(", ")+" is missing",i.length>0&&(a+=", ")),i.forEach((function(t,e){var n=t.key,r=t.value,o=t.allowed;a+=n+' "'+r+'" contains invalid characters! (allowed: '+o+")"+(e!==i.length-1?", ":"")})),o.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.captureError=function(t){if(this.isEnabled())return this.serviceFactory.getService("ErrorLogging").logError(t)},e.addFilter=function(t){this.serviceFactory.getService("ConfigService").addFilter(t)},t}(),ne=ct?ut:(ct=!0,d()?(st(),ut=!0):"undefined"!=typeof window&&console.log("[Elastic APM] platform is not supported!"),ut),re=((te=new Kt).registerCoreServices(),Tt.registerServices(te),Xt.registerServices(te),te),ie=new ee(re,!ne);"undefined"!=typeof window&&(window.elasticApm=ie);var oe=ie.init.bind(ie),ae=n(4),se=n(1),ce=n(2);var ue=function(t){var e,n;function r(e,n){var r;return(r=t.call(this)||this).__tracer=e,r.span=n,r.isTransaction=n instanceof Dt,r.spanContext={id:n.id,traceId:n.traceId,sampled:n.sampled},r}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.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-l())},r}(ce.Span);var fe=function(t){var e,n;function r(e,n,r,i){var o;return(o=t.call(this)||this).performanceMonitoring=e,o.transactionService=n,o.loggingService=r,o.errorLogging=i,o}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i._startSpan=function(t,e){var n,r={managed:!0};if(e)if(r.timestamp=e.startTime,e.childOf)r.parentId=e.childOf.id;else if(e.references&&e.references.length>0){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()===se.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 ce.Span;r.timestamp&&(n._start=r.timestamp-l());var o=new ue(this,n);return e&&e.tags&&o.addTags(e.tags),o},i._inject=function(t,e,n){switch(e){case se.FORMAT_TEXT_MAP:case se.FORMAT_HTTP_HEADERS:this.performanceMonitoring.injectDtHeader(t,n);break;case se.FORMAT_BINARY:0}},i._extract=function(t,e){var n;switch(t){case se.FORMAT_TEXT_MAP:case se.FORMAT_HTTP_HEADERS:n=this.performanceMonitoring.extractDtHeader(e);break;case se.FORMAT_BINARY:0}return n||(n=null),n},r}(ae.Tracer);function de(t){return function(t){var e=t.getService("PerformanceMonitoring"),n=t.getService("TransactionService"),r=t.getService("ErrorLogging"),i=t.getService("LoggingService");return new fe(e,n,i,r)}(t.serviceFactory)}n.d(e,"createTracer",(function(){return de})),n.d(e,"init",(function(){return oe})),n.d(e,"apm",(function(){return ie})),n.d(e,"apmBase",(function(){return ie})),n.d(e,"ApmBase",(function(){return ee})),"undefined"!=typeof window&&window.elasticApm&&(window.elasticApm.createTracer=de.bind(window.elasticApm,window.elasticApm));e.default=de}]);
//# 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){v[r]=t,v[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 v=new Array(1e3);function h(){for(var t=0;t<r;t+=2){var e=v[t],n=v[t+1];e(n),v[t]=void 0,v[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]&&M(r);var i=n._state;if(i){var o=arguments[i-1];s(function(){return F(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 k(e,t),e}y=u?function(){return process.nextTick(h)}:a?(p=0,g=new a(h),m=document.createTextNode(""),g.observe(m,{characterData:!0}),function(){m.data=p=++p%2}):f?((l=new MessageChannel).port1.onmessage=h,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(h)}}catch(t){return d()}}():d();var b=Math.random().toString(36).substring(2);function w(){}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?I(o,a._result):a._state===x?N(o,a._result):A(a,void 0,function(t){return k(o,t)},function(t){return N(o,t)})):void 0===n?I(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?k(e,t):I(e,t))},function(t){n||(n=!0,N(e,t))},e._label);!n&&t&&(n=!0,N(e,t))},t)):I(t,e)}function k(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)I(e,t);else{var n=void 0;try{n=t.then}catch(t){return void N(e,t)}L(e,t,n)}var r,i}function O(t){t._onerror&&t._onerror(t._result),j(t)}function I(t,e){t._state===T&&(t._result=e,t._state=E,0!==t._subscribers.length&&s(j,t))}function N(t,e){t._state===T&&(t._state=x,t._result=e,s(O,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(j,t)}function j(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?F(n,r,i,o):i(o);t._subscribers.length=0}}function F(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?k(e,o):!1===s?N(e,a):t===E?I(e,o):t===x&&N(e,o))}var R=0;function M(t){t[b]=R++,t._state=void 0,t._result=void 0,t._subscribers=[]}var P=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(w),this.promise[b]||M(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?I(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&I(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):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?N(r,n):this._result[e]=n),0===this._remaining&&I(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]=R++,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){k(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 P(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),f=n(0),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 d(t,e,n){if(n&&t){var r=E(t);return e&&(e=String(e)),n[r]=e,n}}var v=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function g(){return{page:{referer:document.referrer,url:window.location.href}}}function l(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 b(t){return y(t,i.call(arguments,1),!0)}function w(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={},v.forEach(function(t){var e=n[t];e&&r<=e&&(i[t]=e-r)}),i),e=function(){var t={},e=window.performance;if("function"==typeof 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}}function C(){return window.performance.now()}function L(t){return"number"==typeof t&&0<=t?t:C()}function k(t,e){return w(e)||w(t)?null:parseFloat(e-t)}var O={fetchInProgress:!1};function I(t){return"__apm_symbol__"+t}function N(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=I(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[I("OriginalDelegate")]=a}}return i}var A=I("xhrIgnore"),j=I("xhrSync"),F=I("xhrURL"),R=I("xhrMethod"),M="schedule",P="invoke",q="clear",H="addEventListener",B="removeEventListener",D=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],Q=3e5,U="page-load",z="Unknown",$=60,V=1024,X="transaction:end",J="config:change",Y="xmlhttprequest",Z="fetch",G="history",K="elastic_apm_config",W=I("xhrTask"),tt=I("xhrListener"),et=I("xhrScheduled");function nt(s){var t=XMLHttpRequest.prototype,c=t[H],u=t[B];if(!c){var e=window.XMLHttpRequestEventTarget;if(e){var n=e.prototype;c=n[H],u=n[B]}}var f="readystatechange";function d(t){t.state=P,t.ignore||s(P,t)}function i(n){XMLHttpRequest[et]=!1,n.state=M,n.ignore||s(M,n);var r,i=n.data,o=i.target,t=o[tt];c||(c=o[H],u=o[B]),t&&(u.call(o,f,t),u.call(o,"load",t));var e=o[tt]=function(t){var e=t.type;r?r!=e&&setTimeout(function(){n.state!==P&&d(n)},0):o.readyState===o.DONE&&!i.aborted&&XMLHttpRequest[et]&&n.state===M&&(r=e)};c.call(o,f,e),c.call(o,"load",e),o[W]||(o[W]=n);var a=v.apply(o,i.args);return XMLHttpRequest[et]=!0,a}var r=N(t,"open",function(){return function(t,e){return t[R]=e[0],t[F]=e[1],t[j]=!1===e[2],r.apply(t,e)}}),v=N(t,"send",function(){return function(t,e){var n={source:Y,state:"",type:"macroTask",ignore:t[A],data:{target:t,method:t[R],sync:t[j],url:t[F],args:e,aborted:!1}},r=i(n);return t[j]&&d(n),r}}),o=N(t,"abort",function(){return function(t,e){var n,r=t[W];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;(n=r).state=q,s(q,n),n.data.aborted=!0}return o.apply(t,e)}})}function rt(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:Z,state:"",type:"macroTask",data:{target:i,method:i.method,sync:!1,url:n,args:r,aborted:!1}};return new f.Promise(function(e,n){var t,r;O.fetchInProgress=!0,(t=a).state=M,s(M,t);try{r=c.apply(o,[i])}catch(t){return n(t),a.data.error=t,u(a),void(O.fetchInProgress=!1)}r.then(function(t){e(t),f.Promise.resolve().then(function(){a.data.response=t,u(a)})},function(t){n(t),f.Promise.resolve().then(function(){a.data.error=t,u(a)})}),O.fetchInProgress=!1})}}function u(t){t.state=P,s(P,t)}}var it=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}(),ot=new it,at=!1;function st(){return at||(at=!0,nt(function(t,e){ot.send(Y,[t,e])}),rt(function(t,e){ot.send(Z,[t,e])}),function(r){if(window.history){var i=history.pushState;"function"==typeof i&&(history.pushState=function(t,e,n){r(P,{source:G,data:{state:t,title:e,url:n}}),i.apply(this,arguments)})}}(function(t,e){ot.send(G,[t,e])})),ot}var ct=!1,ut=!1;var ft=n(2),dt=n.n(ft);function vt(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=dt.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 ht={service:{name:[V,!0],version:!0,agent:{version:[V,!0]},environment:!0}},lt={"*":!0,headers:{"*":!0}},pt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:lt},response:lt},gt={name:[V,!0],type:[V,!0],id:[V,!0],trace_id:[V,!0],parent_id:[V,!0],transaction_id:[V,!0],subtype:!0,action:!0,context:pt},mt={name:!0,parent_id:!0,type:[V,!0],id:[V,!0],trace_id:[V,!0],span_count:{started:[V,!0]},context:pt},yt={id:[V,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:pt};function _t(t){return null==t||""===t||void 0===t}function St(t,e,n){var r,i,o,a,s=(r=t[e],i=n[0],o=n[1],void 0===i&&(i=V),void 0===o&&(o=!1),void 0===a&&(a="N/A"),o&&_t(r)&&(r=a),"string"==typeof r?r.substring(0,i):r);_t(s)?delete t[e]:t[e]=s}function bt(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 St(o,t,n)}):St(o,e,n):bt(n,i,o[e])},e=0;e<a.length;e++)t(e);return i}var wt=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=vt(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._transactionService.getCurrentTransaction(),d=f?f.context:{},v=this._configService.get("context"),h=b({},g(),d,v,u),l={id:p(),culprit:r,exception:{message:s,stacktrace:n,type:c},context:h};return f&&(l=S(l,{trace_id:f.traceId,parent_id:f.id,transaction_id:f.id,transaction:{type:f.type,sampled:f.sampled}})),bt(yt,l)},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.registerListeners=function(){var e=this;window.addEventListener("error",function(t){return e.logErrorEvent(t)}),window.addEventListener("unhandledrejection",function(t){return e.logPromiseEvent(t)})},e.logPromiseEvent=function(t){var e="Unhandled promise rejection: ",n=t.reason;null==n?this.logError(e+"<no reason specified>"):"string"==typeof n.message?this.logError({message:e+n.message,stack:n.stack?n.stack:null}):"object"!=typeof n&&this.logError(e+n)},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}(),Tt=function(r){r.registerServiceCreator("ErrorLogging",function(){var t=r.getService("ApmServer"),e=r.getService("ConfigService"),n=r.getService("TransactionService");return new wt(t,e,n)})},Et=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],xt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Ct=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=Et.slice();i=i.replace("\\","/"),o||(c[2]=[NaN,"path"]);for(var u=0;u<c.length;u++){var f=c[u],d=f[0],v=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var h=f[2];if(h){var l=i.lastIndexOf(d);e=Math.max(e,l),this[v]=i.slice(0,e),i=i.slice(e+h)}else this[v]=i.slice(e),i=i.slice(0,e)}}else this[v]=i,i="";this[v]=this[v]||a&&f[3]&&s[v]||"",f[3]&&(this[v]=this[v].toLowerCase())}a&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),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=xt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Lt=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(X+":after",function(t){var e=n.createTransactionPayload(t);e&&n._apmServer.addTransaction(e)}),t[G]&&ot.observe(G,this.getHistorySub()),t[Y]&&ot.observe(Y,this.getXHRSub()),t[Z]&&ot.observe(Z,this.getFetchSub())},e.getHistorySub=function(){var n=this._transactionService;return function(t,e){e.source===G&&t===P&&n.startTransaction(e.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var n=this;return function(t,e){e.source!==Y||O.fetchInProgress||n.processAPICalls(t,e)}},e.getFetchSub=function(){var n=this;return function(t,e){e.source===Z&&n.processAPICalls(t,e)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===M&&e.data){var i=new Ct(e.data.url),o=e.data.method+" "+(i.relative?i.path:l(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 Ct(window.location.href),d=h(i.origin,f.origin)||h(i.origin,u),v=e.data.target;c&&d&&v&&this.injectDtHeader(a,v),a.addContext({http:{method:e.data.method,url:i.href}}),a.sync=e.data.sync,e.data.span=a,e.id=s}t===P&&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===P&&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.options.checkBrowserResponsiveness){var i=this._configService.get("browserResponsivenessBuffer");if(!this.checkBrowserResponsiveness(t,r,i))return!1}return!0},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 bt(gt,e)}),i=b({},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,breakdown:n.breakdownTimings,span_count:{started:e.length},sampled:n.sampled};return bt(mt,o)},e.createTransactionPayload=function(t){if(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}(),kt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=z),e||(e="custom"),this.name=t,this.type=e,this.options=n,this.id=n.id||p(16),this.traceId=n.traceId,this.sampled=n.sampled,this.timestamp=n.timestamp,this._start=L(n.startTime),this._end=void 0,this.ended=!1,this.onEnd=n.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 d(t,e[t],n.tags)})},e.addContext=function(t){t&&(this.ensureContext(),b(this.context,t))},e.end=function(t){this.ended||(this.ended=!0,this._end=L(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return k(this._start,this._end)},t}();var Ot=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}(kt),It=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function Nt(t){return{value:t}}function At(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,o=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":Nt(i),"span.self_time.sum.us":Nt(o)}}}var jt=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.captureTimings=!1,r.breakdownTimings=[],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=b(this.marks||{},t)},r.mark=function(t){var e=E(t),n=C()-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&&C()-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 Ot(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(t){if(!this.ended){for(var e in this.ended=!0,this._end=L(t),this._activeSpans){var n=this._activeSpans[e];n.type=n.type+".truncated",n.end(t)}var r=g();this.addContext(r),this.callOnEnd()}},r.captureBreakdown=function(){this.breakdownTimings=function(t,e){void 0===e&&(e=window.performance.timing);var s=[],n=t.duration(),r=t.name,i=t.type,o=t.sampled,c={name:r,type:i};if(s.push({transaction:c,samples:{"transaction.duration.count":Nt(1),"transaction.duration.sum.us":Nt(n),"transaction.breakdown.count":Nt(o?1:0)}}),!o)return s;if(i===U&&e)for(var a=0;a<It.length;a++){var u=It[a],f=k(e[u[0]],e[u[1]]);0!==f&&null!=f&&s.push(At(c,{details:{type:u[2]},duration:f}))}else{var d=function(t){var e={},n=function(t){var e=t.spans,n=t._start,r=t._end;if(0===e.length)return t.duration();e.sort(function(t,e){return t._start-e._start});for(var i=e[0],o=i._end,a=i._start,s=o,c=a-n,u=1;u<e.length;u++)a=(i=e[u])._start,o=i._end,s<a?(c+=a-s,s=o):s<o&&(s=o);return s<r&&(c+=r-s),c}(t);e.app={count:1,duration:n};for(var r=t.spans,i=0;i<r.length;i++){var o=r[i],a=o.duration();if(0!==a&&null!=a){var s=o.type,c=o.subType,u=s;c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=a}}return e}(t);Object.keys(d).forEach(function(t){var e=t.split("."),n=e[0],r=e[1],i=d[t],o=i.duration,a=i.count;s.push(At(c,{details:{type:n,subtype:r},duration:o,count:a}))})}return s}(this)},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}(kt),Ft=[["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 Rt(t,e,n,r,i){return void 0===i&&(i=0),"number"==typeof t&&"number"==typeof e&&i<=t&&t<e&&n<=t-i&&e-i<=r&&e-t<Q&&t-i<Q&&e-i<Q}function Mt(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 Pt(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o="resource";n&&(o+="."+n);var a=l(e),s=new Ot(a,o);return s.addContext({http:{url:e,response:Mt(t)}}),s._start=r,s.end(),s._end=i,s}function qt(e){if(e.captureTimings){var t=window.performance,n=e._end;if(e.type===U){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=t.timing;(function(t,e,n,r){for(var i=[],o=0;o<Ft.length;o++){var a=t[Ft[o][0]],s=t[Ft[o][1]];if(Rt(a,s,n,r,e)){var c=new Ot(Ft[o][2],"hard-navigation.browser-timing");"requestStart"===Ft[o][0]&&(c.pageResponse=!0),c._start=a-e,c.ended=!0,c._end=s-e,i.push(c)}}return i})(i,i.fetchStart,0,n).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)}),e.addMarks(x())}if("function"==typeof t.getEntriesByType){var o=e._start;if(function(t,e,n,r){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a.initiatorType,c=a.name,u=a.startTime,f=a.responseEnd;if("xmlhttprequest"!==s&&"fetch"!==s&&c)if(-1!==D.indexOf(s)){if(!Rt(u,f,n,r))continue;i.push(Pt(t[o]))}else{if(null!=s)continue;for(var d=!1,v=0;v<e.length;v++){var h=c.lastIndexOf(e[v]);if(-1<h&&h===c.length-e[v].length){d=!0;break}}!d&&Rt(u,f,n,r)&&i.push(Pt(t[o]))}}return i}(t.getEntriesByType("resource"),function(t){for(var e=t.spans,n=[],r=0;r<e.length;r++){var i=e[r];"external"===i.type&&"http"===i.subType||n.push(i.name.split(" ")[1])}return n}(e),o,n).forEach(function(t){return e.spans.push(t)}),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.name,s=o.startTime,c=o.duration,u=s+c;if(!(c<=$)&&Rt(s,u,e,n)){var f=new Ot(a,"app");f._start=s,f.end(),f._end=u,r.push(f)}}return r}(t.getEntriesByType("measure"),o,n).forEach(function(t){return e.spans.push(t)}),e.type===U){var a=t.getEntriesByType("navigation");a&&0<a.length&&(a=a[0],e.addContext({response:Mt(a)}))}}}}var Ht=function(){function t(t,e){this._config=e,this._logger=t,this.currentTransaction=void 0}var e=t.prototype;return e.ensureCurrentTransaction=function(t){t||(t=this.createOptions());var e=this.getCurrentTransaction();return e||(t.canReuse=!0,t.managed=!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 jt(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.createOptions=function(t){var e=this._config.config,n=S({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=S({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,checkBrowserResponsiveness:e.checkBrowserResponsiveness},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction();return r?r.canReuse()&&n.canReuse?r.redefine(t,void 0,n):(r.end(),r=this.createTransaction(t,e,n)):r=this.createTransaction(t,e,n),r.captureTimings=!0,e===U&&(r.options.checkBrowserResponsiveness=!1,n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),r.name===z&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),r},e.startTransaction=function(t,e,n){var r,i=this,o=this.createOptions(n);return(r=o.managed?this.startManagedTransaction(t,e,o):new jt(t,e,o)).onEnd=function(){return i.handleTransactionEnd(r)},this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(r){var i=this;return f.Promise.resolve().then(function(){var t=r.name,e=r.type;if(!i.shouldIgnoreTransaction(t)){if(e===U){var n=i._config.get("pageLoadTransactionName");t===z&&n&&(r.name=n)}qt(r),i.adjustTransactionTime(r),i._config.get("breakdownMetrics")&&r.captureBreakdown(),i._config.events.send(X,[r])}},function(t){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.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.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)},t}(),Bt=function(i){i.registerServiceCreator("TransactionService",function(){var t=i.getService("ConfigService"),e=i.getService("LoggingService");return new Ht(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 Lt(n,t,e,r)})},Dt=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 Qt=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)}},Ut=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),zt=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}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 bt(ht,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,{payload:e,headers:{"Content-Type":"application/x-ndjson"}}).then(function(t){return t.responseText})},e._constructError=function(t){var e=t.url,n=t.status;t.responseText;if(void 0===n)return t;var r=e+" HTTP status: "+n;return new Error(r)},e._makeHttpRequest=function(e,o,t){var n=void 0===t?{timeout:1e4}:t,a=n.timeout,s=n.payload,c=n.headers;return new f.Promise(function(n,r){var i=new window.XMLHttpRequest;if(i[A]=!0,i.open(e,o,!0),i.timeout=a,c)for(var t in c)c.hasOwnProperty(t)&&i.setRequestHeader(t,c[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(i)}},i.onerror=function(){var t=i.status,e=i.responseText;r({url:o,status:t,responseText:e})},i.send(s)})},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new Dt(t,{queueLimit:e,flushInterval:n})},e.fetchConfig=function(t,e){var o=this,n=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return f.Promise.reject("serviceName is required for fetching central config.");n+="?service.name="+t,e&&(n+="&service.environment="+e);var a=this._configService.getLocalConfig();return a&&(n+="&ifnonematch="+a.etag),this._makeHttpRequest("GET",n,{timeout:5e3}).then(function(t){var e=t.status,n=t.responseText;if(304===e)return a;var r=JSON.parse(n),i=t.getResponseHeader("etag");return i&&(r.etag=i.replace(/["]/g,""),o._configService.setLocalConfig(r)),r}).catch(function(t){var e=o._constructError(t);return f.Promise.reject(e)})},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=Qt(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=Qt(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 Ut.stringify({error:t})})},e.ndjsonMetricsets=function(t){return t.map(function(t){return Ut.stringify({metricset:t})}).join("")},e.ndjsonTransactions=function(t){var r=this;return t.map(function(t){var e="";t.spans&&(e=t.spans.map(function(t){return Ut.stringify({span:t})}).join(""),delete t.spans);var n="";return t.breakdown&&(n=r.ndjsonMetricsets(t.breakdown),delete t.breakdown),Ut.stringify({transaction:t})+e+n})},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;if("errors"===e)i=this.ndjsonErrors(r.data);else{if("transaction"!==e)return void 0;i=this.ndjsonTransactions(r.data)}i.unshift(Ut.stringify({metadata:{service:r.service}}));var o=i.join(""),a=this._configService.getEndpointUrl();return this._postJson(a,o)}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 $t=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",breakdownMetrics:!1,browserResponsivenessInterval:500,browserResponsivenessBuffer:3,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderValueCallback:c,distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,context:{}},this.events=new it,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.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.config.context.user=S(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=S(this.config.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 d(t,e[t],n.config.context.tags)})},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),this.config=b({},this.defaults,this.config,t),this.events.send(J,[this.config])},e.validate=function(e){void 0===e&&(e={});var n=["serviceName","serverUrl"],r={missing:[],invalid:[]};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>"});var t=e.transactionSampleRate;return void 0!==t&&("number"!=typeof t||isNaN(t)||t<0||1<t)&&r.invalid.push({key:"transactionSampleRate",value:t,allowed:"Number between 0 and 1"}),r},e.getLocalConfig=function(){var t=sessionStorage.getItem(K);if(t)return JSON.parse(t)},e.setLocalConfig=function(t){t&&sessionStorage.setItem(K,JSON.stringify(t))},t}(),Vt=function(){function t(t){void 0===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&&(n[0]=e+n[0]);if(console){var r=console[t]||console.log;"function"==typeof r&&r.apply(console,n)}}:T})},t}(),Xt=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 $t}),this.registerServiceCreator("LoggingService",function(){return new Vt({prefix:"[Elastic APM] "})}),this.registerServiceCreator("ApmServer",function(){return new zt(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(J,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 Jt=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){var e,n,r,i,o=this;if(this.isEnabled()&&!this._initialized){this._initialized=!0;var a=this.serviceFactory.getService("ConfigService");a.setVersion("4.6.0"),this.config(t);var s=this.serviceFactory.getService("LoggingService");if(a.isActive()){this.serviceFactory.init();var c=(e=a.get("instrument"),n=a.get("disableInstrumentations"),(r={})[Y]=!1,r[Z]=!1,r[G]=!1,r[U]=!1,r.error=!1,i=r,e&&Object.keys(i).forEach(function(t){-1===n.indexOf(t)&&(i[t]=!0)}),i);if(this.serviceFactory.getService("PerformanceMonitoring").init(c),c.error)this.serviceFactory.getService("ErrorLogging").registerListeners();var u=function(){return c[U]&&o._sendPageLoadMetrics()};a.get("centralConfig")?this.fetchCentralConfig().then(u):u()}else s.info("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService("ApmServer"),c=this.serviceFactory.getService("LoggingService"),u=this.serviceFactory.getService("ConfigService");return t.fetchConfig(u.get("serviceName"),u.get("environment")).then(function(t){var e=t.transaction_sample_rate;if(e){var n={transactionSampleRate:e=Number(e)},r=u.validate(n).invalid;if(0===r.length)u.setConfig(n);else{var i=r[0],o=i.key,a=i.value,s=i.allowed;c.warn('invalid value "'+a+'" for '+o+". Allowed: "+s+".")}}return t}).catch(function(t){c.warn("failed fetching config:",t)})},e._sendPageLoadMetrics=function(){var t=this.serviceFactory.getService("TransactionService").startTransaction(void 0,U,{managed:!0,canReuse:!0});t&&t.addTask(U);var e=function(){setTimeout(function(){t&&t.removeTask(U)})};"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+=r.join(", ")+" is missing",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 Wt}),n.d(e,"apmBase",function(){return Kt}),n.d(e,"apm",function(){return Kt}),n.d(e,"ApmBase",function(){return Jt});var Yt,Zt=(ct||(ct=!0,u()?(st(),ut=!0):"undefined"!=typeof window&&console.log("[Elastic APM] platform is not supported!")),ut),Gt=((Yt=new Xt).registerCoreServices(),Tt(Yt),Bt(Yt),Yt),Kt=new Jt(Gt,!Zt);"undefined"!=typeof window&&(window.elasticApm=Kt);var Wt=Kt.init.bind(Kt);e.default=Wt}]);
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e,n){var r;r=function(){"use strict";function t(t){return"function"==typeof t}var e=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,r=void 0,i=void 0,o=function(t,e){h[n]=t,h[n+1]=e,2===(n+=2)&&(i?i(v):y())},a="undefined"!=typeof window?window:void 0,s=a||{},c=s.MutationObserver||s.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<n;t+=2)(0,h[t])(h[t+1]),h[t]=void 0,h[t+1]=void 0;n=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 a=arguments[i-1];o((function(){return j(i,r,a,n._result)}))}else N(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 L(e,t),e}u?y=function(){return process.nextTick(v)}:c?(p=0,g=new c(v),m=document.createTextNode(""),g.observe(m,{characterData:!0}),y=function(){m.data=p=++p%2}):f?((l=new MessageChannel).port1.onmessage=v,y=function(){return l.port2.postMessage(0)}):y=void 0===a?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(v)}:d()}catch(t){return d()}}():d();var b=Math.random().toString(36).substring(2);function w(){}var T=void 0,E=1,C=2;function x(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===S?function(t,e){e._state===E?I(t,e._result):e._state===C?O(t,e._result):N(e,void 0,(function(e){return L(t,e)}),(function(e){return O(t,e)}))}(e,n):void 0===r?I(e,n):t(r)?function(t,e,n){o((function(t){var r=!1,i=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,(function(n){r||(r=!0,e!==n?L(t,n):I(t,n))}),(function(e){r||(r=!0,O(t,e))}),t._label);!r&&i&&(r=!0,O(t,i))}),t)}(e,n,r):I(e,n)}function L(t,e){if(t===e)O(t,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=e),null===r||"object"!==i&&"function"!==i)I(t,e);else{var n=void 0;try{n=e.then}catch(e){return void O(t,e)}x(t,e,n)}var r,i}function k(t){t._onerror&&t._onerror(t._result),A(t)}function I(t,e){t._state===T&&(t._result=e,t._state=E,0!==t._subscribers.length&&o(A,t))}function O(t,e){t._state===T&&(t._state=C,t._result=e,o(k,t))}function N(t,e,n,r){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+E]=n,i[a+C]=r,0===a&&t._state&&o(A,t)}function A(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(e,n,r,i){var o=t(r),a=void 0,s=void 0,c=!0;if(o){try{a=r(i)}catch(t){c=!1,s=t}if(n===a)return void O(n,new TypeError("A promises callback cannot return that same promise."))}else a=i;n._state!==T||(o&&c?L(n,a):!1===c?O(n,s):e===E?I(n,a):e===C&&O(n,a))}var F=0;function R(t){t[b]=F++,t._state=void 0,t._result=void 0,t._subscribers=[]}var M=function(){function t(t,n){this._instanceConstructor=t,this.promise=new t(w),this.promise[b]||R(this.promise),e(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?I(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&I(this.promise,this._result))):O(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(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===S){var i=void 0,o=void 0,a=!1;try{i=t.then}catch(t){a=!0,o=t}if(i===_&&t._state!==T)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===P){var s=new n(w);a?O(s,o):x(s,t,i),this._willSettleAt(s,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===T&&(this._remaining--,t===C?O(r,n):this._result[e]=n),0===this._remaining&&I(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;N(t,void 0,(function(t){return n._settledAt(E,e,t)}),(function(t){return n._settledAt(C,e,t)}))},t}(),P=function(){function e(t){this[b]=F++,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(t,e){try{e((function(e){L(t,e)}),(function(e){O(t,e)}))}catch(e){O(t,e)}}(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 t(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 P.prototype.then=_,P.all=function(t){return new M(this,t).promise},P.race=function(t){var n=this;return e(t)?new n((function(e,r){for(var i=t.length,o=0;o<i;o++)n.resolve(t[o]).then(e,r)})):new n((function(t,e){return e(new TypeError("You must pass an array to race."))}))},P.resolve=S,P.reject=function(t){var e=new this(w);return O(e,t),e},P._setScheduler=function(t){i=t},P._setAsap=function(t){o=t},P._asap=o,P.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=P},P.Promise=P,P},t.exports=r()},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){var r,i,o;!function(a,s){"use strict";i=[n(4)],void 0===(o="function"==typeof(r=function(t){var e=/(^|@)\S+\:\d+/,n=/^\s*at .*(\S+\:\d+|\(native\))/m,r=/^(eval@)?(\[native code\])?$/;function i(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 o(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(n))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(e){return i(o(e.stack.split("\n"),(function(t){return!!t.match(n)}),this),(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var n=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),r=this.extractLocation(n.pop()),i=n.join(" ")||void 0,o=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>"],r[0])>-1?void 0:r[0];return new t(i,void 0,o,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(o(e.stack.split("\n"),(function(t){return!t.match(r)}),this),(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t(e);var n=e.split("@"),r=this.extractLocation(n.pop()),i=n.join("@")||void 0;return new t(i,void 0,r[0],r[1],r[2],e)}),this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],o=2,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],o=0,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera11:function(n){return i(o(n.stack.split("\n"),(function(t){return!!t.match(e)&&!t.match(/^Error created at/)}),this),(function(e){var n,r=e.split("@"),i=this.extractLocation(r.pop()),o=r.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;o.match(/\(([^\)]*)\)/)&&(n=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(a,s,i[0],i[1],i[2],e)}),this)}}})?r.apply(e,i):r)||(t.exports=o)}()},,function(t,e,n){var r,i,o;!function(n,a){"use strict";i=[],void 0===(o="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(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 e.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(e){if(!t(e))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(e)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(e){if(!t(e))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(e)},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():"")+(t(this.getLineNumber())?":"+this.getLineNumber():"")+(t(this.getColumnNumber())?":"+this.getColumnNumber():"")}},e})?r.apply(e,i):r)||(t.exports=o)}()},function(t,e,n){"use strict";n.r(e);var r=n(1),i=n.n(r),o=n(0),a=[].slice;for(var s=[],c=0;c<256;++c)s[c]=(c+256).toString(16).substr(1);function u(t,e){var n=!1;return"string"==typeof e?n=t===e:Array.isArray(e)&&e.forEach((function(e){n||(n=u(t,e))})),n}function f(t){var e,n,r,o;return(e=i()(),r=n||0,[(o=s)[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")).substr(0,t)}function d(){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 h(t,e,n){if(n&&t){var r=T(t);return e&&(e=String(e)),n[r]=e,n}}var v=["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(r.src.indexOf("elastic")>0)return r}}()}}function _(t){return m(t,a.call(arguments,1),!1)}function S(t){return m(t,a.call(arguments,1),!0)}function b(t){return void 0===t}function w(){}function T(t){return t.replace(/[.*"]/g,"_")}function E(){var t=function(){var t=window.performance.timing,e=t.fetchStart,n={};return v.forEach((function(r){var i=t[r];i&&i>=e&&(n[r]=i-e)})),n}(),e=function(){var t={},e=window.performance;if("function"==typeof e.getEntriesByType){var n=e.getEntriesByType("paint");if(n.length>0)for(var r=e.timing,i=r.fetchStart-r.navigationStart,o=0;o<n.length;o++){var a=n[o],s=i>=0?a.startTime-i:a.startTime;t[a.name]=s}}return t}(),n={timeToFirstByte:t.responseStart,domInteractive:t.domInteractive,domComplete:t.domComplete};return e["first-contentful-paint"]&&(n.firstContentfulPaint=e["first-contentful-paint"]),{navigationTiming:t,agent:n}}function C(){return window.performance.now()}function x(t){return"number"==typeof t&&t>=0?t:C()}function L(t,e){return b(e)||b(t)?null:parseFloat(e-t)}function k(t){o.Promise.resolve().then(t)}var I={fetchInProgress:!1};function O(t){return"__apm_symbol__"+t}function N(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=O(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[O("OriginalDelegate")]=a}}return i}var A=O("xhrIgnore"),j=O("xhrSync"),F=O("xhrURL"),R=O("xhrMethod"),M="schedule",P="invoke",q="clear",D="addEventListener",H="removeEventListener",B=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],Q=3e5,z="page-load",U="custom",$="Unknown",V=[z,"route-change","http-request",U,"temporary"],X=60,J="xmlhttprequest",Y="fetch",Z="history",G="error",K=1024,W=O("xhrTask"),tt=O("xhrListener"),et=O("xhrScheduled");function nt(t){var e=XMLHttpRequest.prototype,n=e[D],r=e[H];if(!n){var i=window.XMLHttpRequestEventTarget;if(i){var o=i.prototype;n=o[D],r=o[H]}}var a="readystatechange",s="load";function c(e){e.state=P,t(P,e)}function u(e){XMLHttpRequest[et]=!1,e.state=M,t(M,e);var i=e.data,o=i.aborted,u=i.target;n||(n=u[D],r=u[H]);var f,d=u[tt];d&&(r.call(u,a,d),r.call(u,s,d));var h=u[tt]=function(t){var n=t.type;f?f!=n&&function(t){setTimeout(t,0)}((function(){e.state!==P&&c(e)})):u.readyState===u.DONE&&!o&&XMLHttpRequest[et]&&e.state===M&&(f=n)};n.call(u,a,h),n.call(u,s,h),u[W]||(u[W]=e)}var f=N(e,"open",(function(){return function(t,e){return t[A]||(t[R]=e[0],t[F]=e[1],t[j]=!1===e[2]),f.apply(t,e)}})),d=N(e,"send",(function(){return function(t,e){if(t[A])return d.apply(t,e);var n={source:J,state:"",type:"macroTask",data:{target:t,method:t[R],sync:t[j],url:t[F],aborted:!1}};u(n);var r=d.apply(t,e);return XMLHttpRequest[et]=!0,t[j]&&c(n),r}})),h=N(e,"abort",(function(){return function(e,n){if(!e[A]){var r=e[W];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;!function(e){e.state=q,t(q,e),e.data.aborted=!0}(r)}}return h.apply(e,n)}}))}var rt=function(){function t(){this.observers={}}var e=t.prototype;return e.observe=function(t,e){var n=this;if("function"==typeof e)return this.observers[t]||(this.observers[t]=[]),this.observers[t].push(e),function(){var r=n.observers[t].indexOf(e);r>-1&&n.observers[t].splice(r,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}(),it=new rt,ot=!1;function at(){return ot||(ot=!0,nt((function(t,e){it.send(J,[t,e])})),function(t){if(window.fetch&&window.Request){var e=window.fetch;window.fetch=function(t,i){var a,s,c=this,u=arguments;if("string"==typeof t)a=new Request(t,i),s=t;else{if(!t)return e.apply(c,u);s=(a=t).url}var f={source:Y,state:"",type:"macroTask",data:{target:a,method:a.method,sync:!1,url:s,aborted:!1}};return new o.Promise((function(t,i){var o;I.fetchInProgress=!0,n(f);try{o=e.apply(c,[a])}catch(t){return i(t),f.data.error=t,r(f),void(I.fetchInProgress=!1)}o.then((function(e){t(e),k((function(){f.data.response=e,r(f)}))}),(function(t){i(t),k((function(){f.data.error=t,r(f)}))})),I.fetchInProgress=!1}))}}function n(e){e.state=M,t(M,e)}function r(e){e.state=P,t(P,e)}}((function(t,e){it.send(Y,[t,e])})),function(t){if(window.history){var e=history.pushState;"function"==typeof e&&(history.pushState=function(n,r,i){var o={source:Z,data:{state:n,title:r,url:i}};t(P,o),e.apply(this,arguments)})}}((function(t,e){it.send(Z,[t,e])}))),it}var st=!1,ct=!1;var ut=n(2),ft=n.n(ut);function dt(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=ft.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,n=e.split("/"),e=(e=(e=n.length>1?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>"),e=(n=e.split(".")).length>1?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=function(t){return void 0===t&&(t=""),"<anonymous>"===t&&(t=""),t}(e),u=(a=c,s=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),a.indexOf(s)>-1&&(a=a.replace(s+"/","")),a);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u="(inline script)"),{abs_path:e,filename:u,function:o,lineno:n,colno:r}}))}var ht={service:{name:[K,!0],version:!0,agent:{version:[K,!0]},environment:!0}},vt={"*":!0,headers:{"*":!0}},lt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:vt},destination:{address:[K],service:{"*":[K,!0]}},response:vt},pt={name:[K,!0],type:[K,!0],id:[K,!0],trace_id:[K,!0],parent_id:[K,!0],transaction_id:[K,!0],subtype:!0,action:!0,context:lt},gt={name:!0,parent_id:!0,type:[K,!0],id:[K,!0],trace_id:[K,!0],span_count:{started:[K,!0]},context:lt},mt={id:[K,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:lt};function yt(t){return null==t||""===t||void 0===t}function _t(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=K),void 0===n&&(n=!1),void 0===r&&(r="N/A"),n&&yt(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);yt(r)?delete t[e]:t[e]=r}function St(t,e,n){void 0===t&&(t={}),void 0===n&&(n=e);for(var r=Object.keys(t),i=[],o=function(o){var a=r[o],s=!0===t[a]?i:t[a];Array.isArray(s)?"*"===a?Object.keys(n).forEach((function(t){return _t(n,t,s)})):_t(n,a,s):St(s,e,n[a])},a=0;a<r.length;a++)o(a);return e}var bt=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=function(t){return t.filter((function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}))}(dt(t)),n="(inline script)",r=e[e.length-1];r&&r.filename&&(n=r.filename);var i=t.message,o=t.error,a=i,s="",c={};o&&"object"==typeof o&&(a=a||o.message,s=o.name,c=this._getErrorProperties(o)),s||a&&a.indexOf(":")>-1&&(s=a.split(":")[0]);var u=this._transactionService.getCurrentTransaction(),d=u?u.context:{},h=this._configService.get("context"),v=S({},l(),d,h,c),p={id:f(),culprit:n,exception:{message:a,stacktrace:e,type:s},context:v};return u&&(p=_(p,{trace_id:u.traceId,parent_id:u.id,transaction_id:u.id,transaction:{type:u.type,sampled:u.sampled}})),St(mt,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.registerListeners=function(){var t=this;window.addEventListener("error",(function(e){return t.logErrorEvent(e)})),window.addEventListener("unhandledrejection",(function(e){return t.logPromiseEvent(e)}))},e.logPromiseEvent=function(t){var e="Unhandled promise rejection: ",n=t.reason;null==n?this.logError(e+"<no reason specified>"):"string"==typeof n.message?this.logError({message:e+n.message,stack:n.stack?n.stack:null}):"object"!=typeof n&&this.logError(e+n)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},e._getErrorProperties=function(t){var e={};return Object.keys(t).forEach((function(n){if("stack"!==n){var r=t[n];if(null!==r){switch(typeof r){case"function":return;case"object":if("function"!=typeof r.toISOString)return;r=r.toISOString()}e[n]=r}}})),e},t}(),wt={ErrorLogging:bt,registerServices:function(t){t.registerServiceCreator("ErrorLogging",(function(){var e=t.getService("ApmServer"),n=t.getService("ConfigService"),r=t.getService("TransactionService");return new bt(e,n,r)}))}};var Tt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],Et=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Ct=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=Tt.slice();i=i.replace("\\","/"),o||(c[2]=[NaN,"path"]);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,i="";this[h]=this[h]||a&&f[3]&&s[h]||"",f[3]&&(this[h]=this[h].toLowerCase())}if(a&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),this.relative=a,this.protocol=r||s.protocol,this.hostname=this.host,this.port="",/:\d+$/.test(this.host)){var p=this.host.split(":"),g=p.pop(),m=p.join(":");!function(t,e){switch(e){case"http:":return"80"===t;case"https:":return"443"===t}return!0}(g,this.protocol)?this.port=g:this.host=m,this.hostname=m}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=this.auth.split(":");t+=(e[0]?"[REDACTED]":"")+(e[1]?":[REDACTED]":"")+"@"}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=Et.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),xt=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 e=this;void 0===t&&(t={}),this._configService.events.observe("transaction:end:after",(function(t){var n=e.createTransactionPayload(t);n&&e._apmServer.addTransaction(n)})),t[Z]&&it.observe(Z,this.getHistorySub()),t[J]&&it.observe(J,this.getXHRSub()),t[Y]&&it.observe(Y,this.getFetchSub())},e.getHistorySub=function(){var t=this._transactionService;return function(e,n){n.source===Z&&e===P&&t.startTransaction(n.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){n.source!==J||I.fetchInProgress||t.processAPICalls(e,n)}},e.getFetchSub=function(){var t=this;return function(e,n){n.source===Y&&t.processAPICalls(e,n)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===M&&e.data){var i=e.data,o=new Ct(i.url),a=i.method+" "+(o.relative?o.path:p(o.href));r.getCurrentTransaction()||r.startTransaction(a,"http-request",{managed:!0});var s=r.startSpan(a,"external.http"),c=r.addTask();if(!s)return;var f=n.get("distributedTracing"),d=n.get("distributedTracingOrigins"),h=new Ct(window.location.href),v=u(o.origin,h.origin)||u(o.origin,d),l=i.target;f&&v&&l&&this.injectDtHeader(s,l),s.sync=i.sync,i.span=s,e.id=c}else t===P&&(e.data&&e.data.span&&e.data.span.end(null,e.data),e.id&&r.removeTask(e.id))},e.injectDtHeader=function(t,e){var n,r=this._configService.get("distributedTracingHeaderName"),i=function(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}}(t),o=/^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/.test(n=i)&&"00000000000000000000000000000000"!==n.slice(3,35)&&"0000000000000000"!==n.slice(36,52);r&&i&&o&&("function"==typeof e.setRequestHeader?e.setRequestHeader(r,i):e.headers&&"function"==typeof e.headers.append?e.headers.append(r,i):e[r]=i)},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.filterTransaction=function(t){var e=this._configService.get("transactionDurationThreshold"),n=t.duration();if(!n)return!1;if(n>e)return!1;if((t.sampled||t.resetSpans(),t.options.checkBrowserResponsiveness)&&!this.checkBrowserResponsiveness(t,500,3))return!1;return!0},e.prepareTransaction=function(t){t.spans.sort((function(t,e){return t._start-e._start})),this._configService.get("groupSimilarSpans")&&(t.spans=this.groupSmallContinuouslySimilarSpans(t,.05)),t.spans=t.spans.filter((function(e){return e.duration()>0&&e._start>=t._start&&e._end<=t._end}))},e.createTransactionDataModel=function(t){var e=t._start,n=t.spans.map((function(n){var r={id:n.id,transaction_id:t.id,parent_id:n.parentId||t.id,trace_id:t.traceId,name:n.name,type:n.type,subType:n.subType,action:n.action,sync:n.sync,start:n._start-e,duration:n.duration(),context:n.context};return St(pt,r)})),r={id:t.id,trace_id:t.traceId,name:t.name,type:t.type,duration:t.duration(),spans:n,context:t.context,marks:t.marks,breakdown:t.breakdownTimings,span_count:{started:n.length},sampled:t.sampled};return St(gt,r)},e.createTransactionPayload=function(t){if(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(t,e){var n=t.duration(),r=[],i=1;return t.spans.forEach((function(o,a){if(0===r.length)r.push(o);else{var s=r[r.length-1],c=s.type===o.type&&s.subType===o.subType&&s.action===o.action&&s.name===o.name&&o.duration()/n<e&&(o._start-s._end)/n<e,u=t.spans.length===a+1;c&&(i++,s._end=o._end),i>1&&(!c||u)&&(s.name=i+"x "+s.name,i=1),c||r.push(o)}})),r},e.checkBrowserResponsiveness=function(t,e,n){var r=t.browserResponsivenessCounter,i=t.duration();return r+n>=Math.floor(i/e)},t}(),Lt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=$),e||(e=U),this.name=t,this.type=e,this.options=n,this.id=n.id||f(16),this.traceId=n.traceId,this.sampled=n.sampled,this.timestamp=n.timestamp,this._start=x(n.startTime),this._end=void 0,this.ended=!1,this.onEnd=n.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(t){this.ensureContext();var e=this.context;e.tags||(e.tags={}),Object.keys(t).forEach((function(n){return h(n,t[n],e.tags)}))},e.addContext=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];0!==e.length&&(this.ensureContext(),S.apply(void 0,[this.context].concat(e)))},e.end=function(t){this.ended||(this.ended=!0,this._end=x(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return L(this._start,this._end)},t}(),kt=91,It=93,Ot="external",Nt="resource";function At(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 jt(t,e){var n=t.port,r=t.protocol,i=t.hostname,o=t.host,a=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(n,r),s=i.charCodeAt(0)===kt&&i.charCodeAt(i.length-1)===It,c=i;return s&&(c=i.slice(1,-1)),{service:{name:r+"//"+o,resource:i+":"+a,type:e},address:c,port:Number(a)}}function Ft(t,e){if(e){var n;switch(t.type){case Ot:n=function(t){var e,n=t.url,r=t.method,i=t.target,o=t.response,a=new Ct(n),s=jt(a,Ot),c={http:{method:r,url:a.href},destination:s};return i&&void 0!==i.status?e=i.status:o&&(e=o.status),c.http.status_code=e,c}(e);break;case Nt:n=function(t){var e=t.entry,n=t.url,r=jt(new Ct(n),Nt);return{http:{url:n,response:At(e)},destination:r}}(e)}t.addContext(n)}}var Rt=function(t){var e,n;function r(e,n,r){var i;if((i=t.call(this,e,n,r)||this).parentId=i.options.parentId,i.subType=void 0,i.action=void 0,-1!==i.type.indexOf(".")){var o=i.type.split(".",3);i.type=o[0],i.subType=o[1],i.action=o[2]}return i.sync=i.options.sync,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r.prototype.end=function(e,n){t.prototype.end.call(this,e),Ft(this,n)},r}(Lt),Mt=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function Pt(t){return{value:t}}function qt(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,o=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":Pt(i),"span.self_time.sum.us":Pt(o)}}}var Dt=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=f(),i.marks=void 0,i.spans=[],i._activeSpans={},i.nextAutoTaskId=1,i._scheduledTasks=[],i.captureTimings=!1,i.breakdownTimings=[],i.sampled=Math.random()<=i.options.transactionSampleRate,i.browserResponsivenessCounter=0,i}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i.addMarks=function(t){this.marks=S(this.marks||{},t)},i.mark=function(t){var e=T(t),n=C()-this._start,r={};r[e]=n,this.addMarks({custom:r})},i.canReuse=function(t){return void 0===t&&(t=5e3),!!this.options.canReuse&&!this.ended&&C()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=_(this.options,n))},i.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 Rt(t,e,i);return this._activeSpans[o.id]=o,o}},i.isFinished=function(){return 0===this._scheduledTasks.length},i.detectFinish=function(){this.isFinished()&&this.end()},i.end=function(t){if(!this.ended){for(var e in this.ended=!0,this._end=x(t),this._activeSpans){var n=this._activeSpans[e];n.type=n.type+".truncated",n.end(t)}this.callOnEnd()}},i.captureBreakdown=function(){this.breakdownTimings=function(t,e){void 0===e&&(e=window.performance.timing);var n=[],r=t.duration(),i=t.name,o=t.type,a=t.sampled,s={name:i,type:o};if(n.push({transaction:s,samples:{"transaction.duration.count":Pt(1),"transaction.duration.sum.us":Pt(r),"transaction.breakdown.count":Pt(a?1:0)}}),!a)return n;if(o===z&&e)for(var c=0;c<Mt.length;c++){var u=Mt[c],f=L(e[u[0]],e[u[1]]);0!==f&&null!=f&&n.push(qt(s,{details:{type:u[2]},duration:f}))}else{var d=function(t){var e={},n=function(t){var e=t.spans,n=t._start,r=t._end;if(0===e.length)return t.duration();e.sort((function(t,e){return t._start-e._start}));for(var i=e[0],o=i._end,a=i._start,s=o,c=a-n,u=1;u<e.length;u++)a=(i=e[u])._start,o=i._end,a>s?(c+=a-s,s=o):o>s&&(s=o);return s<r&&(c+=r-s),c}(t);e.app={count:1,duration:n};for(var r=t.spans,i=0;i<r.length;i++){var o=r[i],a=o.duration();if(0!==a&&null!=a){var s=o.type,c=o.subType,u=s;c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=a}}return e}(t);Object.keys(d).forEach((function(t){var e=t.split("."),r=e[0],i=e[1],o=d[t],a=o.duration,c=o.count;n.push(qt(s,{details:{type:r,subtype:i},duration:a,count:c}))}))}return n}(this)},i.addTask=function(t){if(void 0===t&&(t="task"+this.nextAutoTaskId++),-1==this._scheduledTasks.indexOf(t))return this._scheduledTasks.push(t),t},i.removeTask=function(t){var e=this._scheduledTasks.indexOf(t);e>-1&&this._scheduledTasks.splice(e,1),this.detectFinish()},i.resetSpans=function(){this.spans=[]},i._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id]},r}(Lt),Ht=[["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 Bt(t,e,n,r,i){return void 0===i&&(i=0),"number"==typeof t&&"number"==typeof e&&t>=i&&e>t&&t-i>=n&&e-i<=r&&e-t<Q&&t-i<Q&&e-i<Q}function Qt(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 Rt(a,o);return s._start=r,s.end(i,{url:e,entry:t}),s}function zt(t){if(t.captureTimings){var e=window.performance,n=t._end;if(t.type===z){if(t.marks&&t.marks.custom){var r=t.marks.custom;Object.keys(r).forEach((function(e){r[e]+=t._start}))}t._start=0;var i=e.timing;(function(t,e,n,r){for(var i=[],o=0;o<Ht.length;o++){var a=t[Ht[o][0]],s=t[Ht[o][1]];if(Bt(a,s,n,r,e)){var c=new Rt(Ht[o][2],"hard-navigation.browser-timing");"requestStart"===Ht[o][0]&&(c.pageResponse=!0),c._start=a-e,c.end(s-e),i.push(c)}}return i})(i,i.fetchStart,0,n).forEach((function(e){e.traceId=t.traceId,e.sampled=t.sampled,e.pageResponse&&t.options.pageLoadSpanId&&(e.id=t.options.pageLoadSpanId),t.spans.push(e)})),t.addMarks(E())}if("function"==typeof e.getEntriesByType){var o=t._start;(function(t,e,n,r){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a.initiatorType,c=a.name,u=a.startTime,f=a.responseEnd;if("xmlhttprequest"!==s&&"fetch"!==s&&c)if(-1!==B.indexOf(s)){if(!Bt(u,f,n,r))continue;i.push(Qt(t[o]))}else{if(null!=s)continue;for(var d=!1,h=0;h<e.length;h++){var v=c.lastIndexOf(e[h]);if(v>-1&&v===c.length-e[h].length){d=!0;break}}!d&&Bt(u,f,n,r)&&i.push(Qt(t[o]))}}return i})(e.getEntriesByType("resource"),function(t){for(var e=t.spans,n=[],r=0;r<e.length;r++){var i=e[r];"external"===i.type&&"http"===i.subType||n.push(i.name.split(" ")[1])}return n}(t),o,n).forEach((function(e){return t.spans.push(e)})),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.name,s=o.startTime,c=o.duration,u=s+c;if(!(c<=X)&&Bt(s,u,e,n)){var f=new Rt(a,"app");f._start=s,f.end(u),r.push(f)}}return r}(e.getEntriesByType("measure"),o,n).forEach((function(e){return t.spans.push(e)}))}}}var Ut=function(){function t(t,e){this._config=e,this._logger=t,this.currentTransaction=void 0,this.respIntervalId=void 0}var e=t.prototype;return e.ensureCurrentTransaction=function(t,e,n){var r=this.getCurrentTransaction();return r||(r=new Dt(t,e,n),this.setCurrentTransaction(r),r)},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.setCurrentTransaction=function(t){this.currentTransaction=t},e.ensureRespInterval=function(t){var e=this,n=function(){clearInterval(e.respIntervalId),e.respIntervalId=void 0};t?void 0===this.respIntervalId&&(this.respIntervalId=setInterval((function(){var t=e.getCurrentTransaction();t?t.browserResponsivenessCounter++:n()}),500)):void 0!==this.respIntervalId&&n()},e.createOptions=function(t){var e=this._config.config,n=_({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=_({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,checkBrowserResponsiveness:e.checkBrowserResponsiveness},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction();if(r)if(r.canReuse()&&n.canReuse){var i;0;var o=V.indexOf(r.type),a=V.indexOf(e);-1!==o&&-1!==a&&a<o&&(i=e),r.redefine(t,i,n)}else r.end(),r=this.ensureCurrentTransaction(t,e,n);else r=this.ensureCurrentTransaction(t,e,n);return r.captureTimings=!0,r.type===z&&(r.options.checkBrowserResponsiveness=!1,n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),r.name===$&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),this.ensureRespInterval(r.options.checkBrowserResponsiveness),r},e.startTransaction=function(t,e,n){var r,i=this,o=this.createOptions(n);return(r=o.managed?this.startManagedTransaction(t,e,o):new Dt(t,e,o)).onEnd=function(){return i.handleTransactionEnd(r)},this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;return o.Promise.resolve().then((function(){var n=t.name,r=t.type;if(!e.shouldIgnoreTransaction(n)&&"temporary"!==r){if(r===z){var i=e._config.get("pageLoadTransactionName");n===$&&i&&(t.name=i)}zt(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var o=e._config.get("context");!function(t,e){var n=l(),r={};if(t.type===z&&"function"==typeof performance.getEntriesByType){var i=performance.getEntriesByType("navigation");i&&i.length>0&&(r={response:At(i[0])})}t.addContext(n,r,e)}(t,o),e._config.events.send("transaction:end",[t])}}),(function(t){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.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(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0}));if(r)return r.startSpan(t,e,n)},e.addTask=function(t){var e=this.ensureCurrentTransaction(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0}));if(e){t=e.addTask(t);0}return t},e.removeTask=function(t){var e=this.getCurrentTransaction();e&&e.removeTask(t)},t}(),$t={PerformanceMonitoring:xt,registerServices:function(t){t.registerServiceCreator("TransactionService",(function(){var e=t.getService("ConfigService"),n=t.getService("LoggingService");return new Ut(n,e)})),t.registerServiceCreator("PerformanceMonitoring",(function(){var e=t.getService("ConfigService"),n=t.getService("LoggingService"),r=t.getService("ApmServer"),i=t.getService("TransactionService");return new xt(r,e,n,i)}))}},Vt=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 Xt=function(t,e,n){var r,i=n.context||this,o=n.limit,a=n.interval,s=n.countFn||function(){},c=0;return function(){var n="function"==typeof s&&s.apply(i,arguments);return"number"!=typeof n&&(n=1),c+=n,void 0===r&&(r=setTimeout((function(){c=0,r=void 0}),a)),c>o?"function"==typeof e?e.apply(i,arguments):void 0:t.apply(i,arguments)}},Jt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Yt=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}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 St(ht,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,{payload:e,headers:{"Content-Type":"application/x-ndjson"}}).then((function(t){return t.responseText}))},e._constructError=function(t){var e=t.url,n=t.status;t.responseText;if(void 0===n)return t;var r=e+" HTTP status: "+n;return new Error(r)},e._makeHttpRequest=function(t,e,n){var r=void 0===n?{timeout:1e4}:n,i=r.timeout,a=r.payload,s=r.headers;return new o.Promise((function(n,r){var o=new window.XMLHttpRequest;if(o[A]=!0,o.open(t,e,!0),o.timeout=i,s)for(var c in s)s.hasOwnProperty(c)&&o.setRequestHeader(c,s[c]);o.onreadystatechange=function(){if(4===o.readyState){var t=o.status,i=o.responseText;0===t||t>399&&t<600?r({url:e,status:t,responseText:i}):n(o)}},o.onerror=function(){var t=o.status,n=o.responseText;r({url:e,status:t,responseText:n})},o.send(a)}))},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new Vt(t,{queueLimit:e,flushInterval:n})},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return o.Promise.reject("serviceName is required for fetching central config.");r+="?service.name="+t,e&&(r+="&service.environment="+e);var i=this._configService.getLocalConfig();return i&&(r+="&ifnonematch="+i.etag),this._makeHttpRequest("GET",r,{timeout:5e3}).then((function(t){var e=t.status,r=t.responseText;if(304===e)return i;var o=JSON.parse(r),a=t.getResponseHeader("etag");return a&&(o.etag=a.replace(/["]/g,""),n._configService.setLocalConfig(o)),o})).catch((function(t){var e=n._constructError(t);return o.Promise.reject(e)}))},e.initErrorQueue=function(){var t=this;this.errorQueue&&this.errorQueue.flush(),this.errorQueue=this._createQueue((function(e){var n=t.sendErrors(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending errors!",t._constructError(e))}))}));var e=this._configService.get("errorThrottleLimit"),n=this._configService.get("errorThrottleInterval");this.throttleAddError=Xt(this.errorQueue.add.bind(this.errorQueue),(function(){return t._loggingService.warn("Dropped error due to throttling!")}),{limit:e,interval:n})},e.initTransactionQueue=function(){var t=this;this.transactionQueue&&this.transactionQueue.flush(),this.transactionQueue=this._createQueue((function(e){var n=t.sendTransactions(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending transactions!",t._constructError(e))}))}));var e=this._configService.get("transactionThrottleLimit"),n=this._configService.get("transactionThrottleInterval");this.throttleAddTransaction=Xt(this.transactionQueue.add.bind(this.transactionQueue),(function(){return t._loggingService.warn("Dropped transaction due to throttling!")}),{limit:e,interval:n})},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 Jt.stringify({error:t})}))},e.ndjsonMetricsets=function(t){return t.map((function(t){return Jt.stringify({metricset:t})})).join("")},e.ndjsonTransactions=function(t){var e=this;return t.map((function(t){var n="";t.spans&&(n=t.spans.map((function(t){return Jt.stringify({span:t})})).join(""),delete t.spans);var r="";return t.breakdown&&(r=e.ndjsonMetricsets(t.breakdown),delete t.breakdown),Jt.stringify({transaction:t})+n+r}))},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;if("errors"===e)i=this.ndjsonErrors(r.data);else{if("transaction"!==e)return void 0;i=this.ndjsonTransactions(r.data)}i.unshift(Jt.stringify({metadata:{service:r.service}}));var o=i.join(""),a=this._configService.get("serverUrl")+"/intake/v2/rum/events";return this._postJson(a,o)}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 Zt=function(){function t(){this.config={},this.defaults={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",active:!0,instrument:!0,disableInstrumentations:[],debug:!1,logLevel:"warn",breakdownMetrics:!1,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,context:{}},this.events=new rt,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].split("-").map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join("");e[a]=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.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.config.context.user=_(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=_(this.config.context.custom||{},t)},e.addLabels=function(t){var e=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(t).forEach((function(n){return h(n,t[n],e.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("config:change",[this.config])},e.validate=function(t){void 0===t&&(t={});var e=["serviceName","serverUrl"],n={missing:[],invalid:[]};Object.keys(t).forEach((function(r){-1===e.indexOf(r)||t[r]||n.missing.push(r)})),t.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(t.serviceName)&&n.invalid.push({key:"serviceName",value:t.serviceName,allowed:"a-z, A-Z, 0-9, _, -, <space>"});var r=t.transactionSampleRate;return void 0!==r&&("number"!=typeof r||isNaN(r)||r<0||r>1)&&n.invalid.push({key:"transactionSampleRate",value:r,allowed:"Number between 0 and 1"}),n},e.getLocalConfig=function(){var t=sessionStorage.getItem("elastic_apm_config");if(t)return JSON.parse(t)},e.setLocalConfig=function(t){t&&sessionStorage.setItem("elastic_apm_config",JSON.stringify(t))},t}(),Gt=function(){function t(t){void 0===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 t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var n,r=t.prefix;switch(e){case"trace":case"debug":n="info";break;default:n=e}var i=arguments;r&&(i[0]=r+i[0]);if(console){var o=console[n]||console.log;"function"==typeof o&&o.apply(console,i)}}:w}))},t}(),Kt=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 Zt})),this.registerServiceCreator("LoggingService",(function(){return new Gt({prefix:"[Elastic APM] "})})),this.registerServiceCreator("ApmServer",(function(){return new Yt(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("config:change",(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 Wt=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){var e=this;if(this.isEnabled()&&!this._initialized){this._initialized=!0;var n=this.serviceFactory.getService("ConfigService");n.setVersion("4.7.0"),this.config(t);var r=this.serviceFactory.getService("LoggingService");if(n.isActive()){this.serviceFactory.init();var i=function(t,e){var n,r=((n={})[J]=!1,n[Y]=!1,n[Z]=!1,n[z]=!1,n[G]=!1,n);return t?(Object.keys(r).forEach((function(t){-1===e.indexOf(t)&&(r[t]=!0)})),r):r}(n.get("instrument"),n.get("disableInstrumentations"));if(this.serviceFactory.getService("PerformanceMonitoring").init(i),i[G])this.serviceFactory.getService("ErrorLogging").registerListeners();var o=function(){return i[z]&&e._sendPageLoadMetrics()};n.get("centralConfig")?this.fetchCentralConfig().then(o):o()}else this._disable=!0,r.info("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService("ApmServer"),e=this.serviceFactory.getService("LoggingService"),n=this.serviceFactory.getService("ConfigService");return t.fetchConfig(n.get("serviceName"),n.get("environment")).then((function(t){var r=t.transaction_sample_rate;if(r){var i={transactionSampleRate:r=Number(r)},o=n.validate(i).invalid;if(0===o.length)n.setConfig(i);else{var a=o[0],s=a.key,c=a.value,u=a.allowed;e.warn('invalid value "'+c+'" for '+s+". Allowed: "+u+".")}}return t})).catch((function(t){e.warn("failed fetching config:",t)}))},e._sendPageLoadMetrics=function(){var t=this.startTransaction(void 0,z,{managed:!0,canReuse:!0});t&&t.addTask(z);var e=function(){setTimeout((function(){t&&t.removeTask(z)}))};"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,i=n.invalid;if(0===r.length&&0===i.length)e.setConfig(t);else{var o=this.serviceFactory.getService("LoggingService"),a="RUM agent isn't correctly configured. ";r.length>0&&(a+=r.join(", ")+" is missing",i.length>0&&(a+=", ")),i.forEach((function(t,e){var n=t.key,r=t.value,o=t.allowed;a+=n+' "'+r+'" contains invalid characters! (allowed: '+o+")"+(e!==i.length-1?", ":"")})),o.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.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 ie})),n.d(e,"apmBase",(function(){return re})),n.d(e,"apm",(function(){return re})),n.d(e,"ApmBase",(function(){return Wt}));var te,ee=st?ct:(st=!0,d()?(at(),ct=!0):"undefined"!=typeof window&&console.log("[Elastic APM] platform is not supported!"),ct),ne=((te=new Kt).registerCoreServices(),wt.registerServices(te),$t.registerServices(te),te),re=new Wt(ne,!ee);"undefined"!=typeof window&&(window.elasticApm=re);var ie=re.init.bind(re);e.default=ie}]);
//# sourceMappingURL=elastic-apm-rum.umd.min.js.map

@@ -18,3 +18,3 @@ import { getInstrumentationFlags, PAGE_LOAD, ERROR } from '@elastic/apm-rum-core';

var configService = this.serviceFactory.getService('ConfigService');
configService.setVersion('4.6.0');
configService.setVersion('4.7.0');
this.config(config);

@@ -44,2 +44,3 @@ var loggingService = this.serviceFactory.getService('LoggingService');

} else {
this._disable = true;
loggingService.info('RUM agent is inactive');

@@ -86,4 +87,3 @@ }

_proto._sendPageLoadMetrics = function _sendPageLoadMetrics() {
var transactionService = this.serviceFactory.getService('TransactionService');
var tr = transactionService.startTransaction(undefined, PAGE_LOAD, {
var tr = this.startTransaction(undefined, PAGE_LOAD, {
managed: true,

@@ -207,9 +207,2 @@ canReuse: true

_proto.getTransactionService = function getTransactionService() {
if (this.isEnabled()) {
var transactionService = this.serviceFactory.getService('TransactionService');
return transactionService;
}
};
_proto.captureError = function captureError(error) {

@@ -216,0 +209,0 @@ if (this.isEnabled()) {

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

var configService = this.serviceFactory.getService('ConfigService');
configService.setVersion('4.6.0');
configService.setVersion('4.7.0');
this.config(config);

@@ -49,2 +49,3 @@ var loggingService = this.serviceFactory.getService('LoggingService');

} else {
this._disable = true;
loggingService.info('RUM agent is inactive');

@@ -91,4 +92,3 @@ }

_proto._sendPageLoadMetrics = function _sendPageLoadMetrics() {
var transactionService = this.serviceFactory.getService('TransactionService');
var tr = transactionService.startTransaction(undefined, _apmRumCore.PAGE_LOAD, {
var tr = this.startTransaction(undefined, _apmRumCore.PAGE_LOAD, {
managed: true,

@@ -212,9 +212,2 @@ canReuse: true

_proto.getTransactionService = function getTransactionService() {
if (this.isEnabled()) {
var transactionService = this.serviceFactory.getService('TransactionService');
return transactionService;
}
};
_proto.captureError = function captureError(error) {

@@ -221,0 +214,0 @@ if (this.isEnabled()) {

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

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

"source": "src/index.js",
"types": "src/index.d.ts",
"repository": {

@@ -28,2 +29,3 @@ "type": "git",

"script": "node ../../dev-utils/run-script.js",
"test:types": "tsc --project test/types/tsconfig.json",
"test:node": "npm run script runNodeTests",

@@ -36,3 +38,3 @@ "test:bundle": "npm run script runBundleTests",

"test:sauce": "npm run script runSauceTests packages/rum true test:unit test:e2e:supported test:e2e:failsafe",
"test": "run-s build:e2e test:node test:bundle test:integration test:sauce",
"test": "run-s build:e2e test:types test:node test:bundle test:integration test:sauce",
"bench": "npm run build:umd && node test/benchmarks/run.js"

@@ -50,3 +52,3 @@ },

"dependencies": {
"@elastic/apm-rum-core": "^4.7.0"
"@elastic/apm-rum-core": "^4.8.0"
},

@@ -63,3 +65,3 @@ "bundlesize": [

],
"gitHead": "aa0625d1c4705028065cc2da451ee0f802040d92"
"gitHead": "08b142a7571d7d1c3beec2909bf6170dbb1eef4e"
}

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

*/
configService.setVersion('4.6.0')
configService.setVersion('4.7.0')
this.config(config)

@@ -83,2 +83,3 @@ const loggingService = this.serviceFactory.getService('LoggingService')

} else {
this._disable = true
loggingService.info('RUM agent is inactive')

@@ -128,6 +129,2 @@ }

_sendPageLoadMetrics() {
const transactionService = this.serviceFactory.getService(
'TransactionService'
)
/**

@@ -137,3 +134,3 @@ * Name of the transaction is set in transaction service to

*/
const tr = transactionService.startTransaction(undefined, PAGE_LOAD, {
const tr = this.startTransaction(undefined, PAGE_LOAD, {
managed: true,

@@ -270,11 +267,2 @@ canReuse: true

getTransactionService() {
if (this.isEnabled()) {
var transactionService = this.serviceFactory.getService(
'TransactionService'
)
return transactionService
}
}
captureError(error) {

@@ -281,0 +269,0 @@ if (this.isEnabled()) {

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