raygun4js
Version:
Raygun.io plugin for JavaScript
6 lines (5 loc) • 52.4 kB
JavaScript
/*! Raygun4js - v2.12.0 - 2018-08-28
* https://github.com/MindscapeHQ/raygun4js
* Copyright (c) 2018 MindscapeHQ; Licensed MIT */
!function(a,b){function c(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function d(a){return"undefined"==typeof a}var e,f={},g=a.TraceKit,h=[].slice,i="?";f.setRaygun=function(a){e||(e=a)},f.noConflict=function(){return a.TraceKit=g,f},f.wrap=function(a){function b(){try{return a.apply(this,arguments)}catch(b){throw f.report(b),b}}return b},f.report=function(){function b(a){j(),n.push(a)}function d(a){for(var b=n.length-1;b>=0;--b)n[b]===a&&n.splice(b,1)}function g(a,b){var d=null;if(!b||f.collectWindowErrors){for(var e in n)if(c(n,e))try{n[e].apply(null,[a].concat(h.call(arguments,2)))}catch(g){d=g}if(d)throw d}}function i(a,b,c,d,e){var h=null;if(e)h=f.computeStackTrace(e);else if(p)f.computeStackTrace.augmentStackTraceWithInitialElement(p,b,c,a),h=p,p=null,o=null;else{var i={url:b,line:c,column:d};i.func=f.computeStackTrace.guessFunctionName(i.url,i.line),i.context=f.computeStackTrace.gatherContext(i.url,i.line),h={mode:"onerror",message:a,url:document.location.href,stack:[i],useragent:navigator.userAgent}}return g(h,"from window.onerror"),!!l&&l.apply(this,arguments)}function j(){m!==!0&&(l=a.onerror,a.onerror=i,m=!0)}function k(b){var c;if("undefined"!=typeof document&&(c=h.call(arguments,1)),p){if(o===b)return;var d=p;p=null,o=null,g.apply(null,[d,null].concat(c))}var i=f.computeStackTrace(b);if(p=i,o=b,a.setTimeout(function(){o===b&&(p=null,o=null,g.apply(null,[i,null].concat(c)))},i.incomplete?2e3:0),!e.Utilities.isReactNative())throw b}var l,m,n=[],o=null,p=null;return k.subscribe=b,k.unsubscribe=d,k}(),f.computeStackTrace=function(){function b(a){return"string"!=typeof a?[]:""}function g(d){if(!c(x,d)){var e="";d=d||"";var f;f="undefined"!=typeof document?document.domain:a.location.hostname,d.indexOf&&d.indexOf(f)!==-1&&(e=b(d)),x[d]=e?e.split("\n"):[]}return x[d]}function h(a,b){var c,e=/function ([^(]*)\(([^)]*)\)/,f=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,h="",j=10,k=g(a);if(!k.length)return i;for(var l=0;l<j;++l)if(h=k[b-l]+h,!d(h)){if(c=f.exec(h))return c[1];if(c=e.exec(h))return c[1]}return i}function j(a,b){var c=g(a);if(!c.length)return null;var e=[],h=Math.floor(f.linesOfContext/2),i=h+f.linesOfContext%2,j=Math.max(0,b-h-1),k=Math.min(c.length,b+i-1);b-=1;for(var l=j;l<k;++l)d(c[l])||e.push(c[l]);return e.length>0?e:null}function k(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function l(a){return k(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function m(a,b){for(var c,d,e=0,f=b.length;e<f;++e)if((c=g(b[e])).length&&(c=c.join("\n"),d=a.exec(c)))return{url:b[e],line:c.substring(0,d.index).split("\n").length,column:d.index-c.lastIndexOf("\n",d.index)-1};return null}function n(a,b,c){var d,e=g(b),f=new RegExp("\\b"+k(a)+"\\b");return c-=1,e&&e.length>c&&(d=f.exec(e[c]))?d.index:null}function o(b){for(var c,d,e,f,g=[a.location.href],h=document.getElementsByTagName("script"),i=""+b,j=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,n=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,o=0;o<h.length;++o){var p=h[o];p.src&&g.push(p.src)}if(e=j.exec(i)){var q=e[1]?"\\s+"+e[1]:"",r=e[2].split(",").join("\\s*,\\s*");c=k(e[3]).replace(/;$/,";?"),d=new RegExp("function"+q+"\\s*\\(\\s*"+r+"\\s*\\)\\s*{\\s*"+c+"\\s*}")}else d=new RegExp(k(i).replace(/\s+/g,"\\s+"));if(f=m(d,g))return f;if(e=n.exec(i)){var s=e[1];if(c=l(e[2]),d=new RegExp("on"+s+"=[\\'\"]\\s*"+c+"\\s*[\\'\"]","i"),f=m(d,g[0]))return f;if(d=new RegExp(c),f=m(d,g))return f}return null}function p(a){if(!a.stack)return{tracekitResult:"nostack"};var b,c,d=/^\s*at (.*?) ?\(((?:file|https?|\s*|blob|chrome-extension|native|webpack|eval|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,f=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,g=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,k=a.stack.split("\n"),l=[],m=/^(.*) is undefined$/.exec(a.message);if(e.Utilities.isReactNative())for(var o=/^(.*@)?.*\/[^\.]+(\.app|CodePush)\/?(.*)/,p="file://reactnative.local/",q=0;q<k.length;q++)if(b=o.exec(k[q]),null!==b){var r=b[1]?b[1]:"anonymous@",s=b[3];k[q]=r+p+s}for(var q=0,t=k.length;q<t;++q){if(b=f.exec(k[q]))c={url:b[3],func:b[1]||i,args:b[2]?b[2].split(","):"",line:+b[4],column:b[5]?+b[5]:null};else if(b=d.exec(k[q]))c={url:b[2],func:b[1]||i,line:+b[3],column:b[4]?+b[4]:null};else{if(!(b=g.exec(k[q])))continue;c={url:b[2],func:b[1]||i,line:+b[3],column:b[4]?+b[4]:null}}!c.func&&c.line&&(c.func=h(c.url,c.line)),"undefined"!=typeof document&&c.line&&(c.context=j(c.url,c.line)),l.push(c)}if(l[0]&&l[0].line&&!l[0].column&&m?l[0].column=n(m[1],l[0].url,l[0].line):l[0].column||"undefined"==typeof a.columnNumber||(l[0].column=a.columnNumber+1),!l.length)return null;var u={mode:"stack",name:a?a.name:"",message:a?a.message:"",url:"undefined"!=typeof document?document.location.href:"",stack:l,useragent:navigator?navigator.userAgent:"",stackstring:a&&a.stack?a.stack.toString():""};return u}function q(a){for(var b,c=a.stacktrace,d=/ line (\d+), column (\d+) in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,e=c?c.split("\n"):[],f=[],g=0,i=e.length;g<i;g+=2)if(b=d.exec(e[g])){var k={line:+b[1],column:+b[2],func:b[3]||b[4],args:b[5]?b[5].split(","):[],url:b[6]};if(!k.func&&k.line&&(k.func=h(k.url,k.line)),k.line)try{k.context=j(k.url,k.line)}catch(l){}k.context||(k.context=[e[g+1]]),f.push(k)}return f.length?{mode:"stacktrace",name:a.name,message:a.message,url:document.location.href,stack:f,useragent:navigator.userAgent,stackstring:c}:null}function r(b){var d=b.message.split("\n");if(d.length<4)return null;var e,f,i,k,n=/^\s*Line (\d+) of linked script ((?:file|http|https)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|http|https)\S+)(?:: in function (\S+))?\s*$/i,p=/^\s*Line (\d+) of function script\s*$/i,q=[],r=document.getElementsByTagName("script"),s=[];for(f in r)c(r,f)&&!r[f].src&&s.push(r[f]);for(f=2,i=d.length;f<i;f+=2){var t=null;if(e=n.exec(d[f]))t={url:e[2],func:e[3],line:+e[1]};else if(e=o.exec(d[f])){t={url:e[3],func:e[4]};var u=+e[1],v=s[e[2]-1];if(v&&(k=g(t.url))){k=k.join("\n");var w=k.indexOf(v.innerText);w>=0&&(t.line=u+k.substring(0,w).split("\n").length)}}else if(e=p.exec(d[f])){var x=a.location.href.replace(/#.*$/,""),y=e[1],z=new RegExp(l(d[f+1]));k=m(z,[x]),t={url:x,line:k?k.line:y,func:""}}if(t){t.func||(t.func=h(t.url,t.line));var A=j(t.url,t.line),B=A?A[Math.floor(A.length/2)]:null;A&&B.replace(/^\s*/,"")===d[f+1].replace(/^\s*/,"")?t.context=A:t.context=[d[f+1]],q.push(t)}}return q.length?{mode:"multiline",name:b.name,message:d[0],url:document.location.href,stack:q,useragent:navigator.userAgent}:null}function s(a,b,c,d){var e={url:b,line:c};if(e.url&&e.line){a.incomplete=!1,e.func||(e.func=h(e.url,e.line)),e.context||(e.context=j(e.url,e.line));var f=/ '([^']+)' /.exec(d);if(f&&(e.column=n(f[1],e.url,e.line)),a.stack.length>0&&a.stack[0].url===e.url){if(a.stack[0].line===e.line)return!1;if(!a.stack[0].line&&a.stack[0].func===e.func)return a.stack[0].line=e.line,a.stack[0].context=e.context,!1}return a.stack.unshift(e),a.partial=!0,!0}return a.incomplete=!0,!1}function t(a,b){for(var c,d,e,g=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,j=[],k={},l=!1,m=t.caller;m&&!l;m=m.caller)if(m!==u&&m!==f.report){if(d={url:null,func:i,line:null,column:null},m.name?d.func=m.name:(c=g.exec(m.toString()))&&(d.func=c[1]),"undefined"==typeof d.func)try{d.func=c.input.substring(0,c.input.indexOf("{"))}catch(p){}if(e=o(m)){d.url=e.url,d.line=e.line,d.func===i&&(d.func=h(d.url,d.line));var q=/ '([^']+)' /.exec(a.message||a.description);q&&(d.column=n(q[1],e.url,e.line))}k[""+m]?l=!0:k[""+m]=!0,j.push(d)}b&&j.splice(0,b);var r={mode:"callers",name:a.name,message:a.message,url:document.location.href,stack:j,useragent:navigator.userAgent};return s(r,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description),r}function u(a,b){var c=null;b=null==b?0:+b;try{if(c=q(a))return c}catch(d){if(w)throw d}try{if(c=p(a))return c}catch(d){if(w)throw d}try{if(c=r(a))return c}catch(d){if(w)throw d}try{if(c=t(a,b+1))return c}catch(d){if(w)throw d}return{tracekitResult:"failedToComputeAnyStackTrace"}}function v(a){a=(null==a?0:+a)+1;try{throw new Error}catch(b){return u(b,a+1)}}var w=!1,x={};return u.augmentStackTraceWithInitialElement=s,u.guessFunctionName=h,u.gatherContext=j,u.ofCaller=v,u}(),f.extendToAsynchronousCallbacks=function(){var b=function(b){var c=a[b];a[b]=function(){var a=h.call(arguments),b=a[0];return"function"==typeof b&&(a[0]=f.wrap(b)),c.apply?c.apply(this,a):c(a[0],a[1])}};b("setTimeout"),b("setInterval")},f.remoteFetching||(f.remoteFetching=!0),f.collectWindowErrors||(f.collectWindowErrors=!0),(!f.linesOfContext||f.linesOfContext<1)&&(f.linesOfContext=11),a.TraceKit=f}(window),function(a,b){"use strict";if(a&&a.event&&a.event.add){var c=a.event.add;a.event.add=function(d,e,f,g,h){if("function"!=typeof f&&"function"!=typeof f.handler)return c.call(this,d,e,f,g,h);var i;return f.handler?(i=f.handler,f.handler=b.wrap(f.handler)):(i=f,f=b.wrap(f)),i.guid?f.guid=i.guid:f.guid=i.guid=a.guid++,c.call(this,d,e,f,g,h)};var d=a.fn.ready;a.fn.ready=function(a){return d.call(this,b.wrap(a))};var e=a.ajax;a.ajax=function(c,d){"object"==typeof c&&(d=c,c=void 0),d=d||{};for(var f,g=["complete","error","success"];f=g.pop();)a.isFunction(d[f])&&(d[f]=b.wrap(d[f]));try{return c?e.call(this,c,d):e.call(this,d)}catch(h){throw b.report(h),h}}}}(window.jQuery,window.TraceKit),Date.prototype.toISOString||!function(){function a(a){var b=String(a);return 1===b.length&&(b="0"+b),b}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}(),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;if(null==this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return-1;var f=0|b;if(f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);c<e;){if(c in d&&d[c]===a)return c;c++}return-1}),Array.prototype.map||(Array.prototype.map=function(a){var b,c,d;if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(b=arguments[1]),c=new Array(f),d=0;d<f;){var g,h;d in e&&(g=e[d],h=a.call(b,g,d,e),c[d]=h),d++}return c}),Array.prototype.forEach||(Array.prototype.forEach=function(a){var b,c;if(null==this)throw new TypeError("this is null or not defined");var d=Object(this),e=d.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(b=arguments[1]),c=0;c<e;){var f;c in d&&(f=d[c],a.call(b,f,c,d)),c++}}),Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),window.raygunUtilityFactory=function(a,b){var c,d={getUuid:function(){function a(a){var b=(Math.random().toString(16)+"000000000").substr(2,8);return a?"-"+b.substr(0,4)+"-"+b.substr(4,4):b}return a()+a(!0)+a(!0)+a()},createCookie:function(a,b,c,d){if(!this.isReactNative()){var e;if(c){var f=new Date;f.setTime(f.getTime()+60*c*60*1e3),e="; expires="+f.toGMTString()}else e="";var g=d?"; secure":"";document.cookie=a+"="+b+e+"; path=/"+g}},readCookie:function(a,b){if(this.isReactNative())return void b(null,"none");for(var c=a+"=",d=document.cookie.split(";"),e=0;e<d.length;e++){for(var f=d[e];" "===f.charAt(0);)f=f.substring(1,f.length);if(0===f.indexOf(c)){var g=f.substring(c.length,f.length);return void b(null,g)}}b(null,null)},clearCookie:function(a){this.isReactNative()||this.createCookie(a,"",-1)},log:function(c,d){a.console&&a.console.log&&b.Options._debugMode&&(a.console.log(c),d&&a.console.log(d))},isApiKeyConfigured:function(){return!(!b.Options._raygunApiKey||""===b.Options._raygunApiKey)||(b.Utilities.log("Raygun API key has not been configured, make sure you call Raygun.init(yourApiKey)"),!1)},isReactNative:function(){return"undefined"==typeof document&&"undefined"!=typeof __DEV__},defaultReactNativeGlobalHandler:function(a,b){"function"==typeof c&&c(a,b)},localStorageAvailable:function(){try{return"localStorage"in a&&null!==a.localStorage}catch(b){return!1}},truncateURL:function(a){var b=a,c=a.split("//")[1];if(c){var d=c.indexOf("?"),e=c.toString().substring(0,d),f=e.split("/").slice(0,4).join("/"),g=e.substring(0,48);b=f.length<g.length?f:g,b!==e&&(b+="..")}return b},merge:function(a,b){var c,d={};for(c in a)d[c]=a[c];for(c in b)d[c]=b[c];return d},mergeMutate:function(a,b){var c;for(c in b)a[c]=b[c];return a},mergeArray:function(a,b){return null!=b?a.concat(b):a.slice(0)},forEach:function(a,b){for(var c=0;c<a.length;c++)b.call(null,c,a[c])},isEmpty:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},contains:function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},getRandomInt:function(){return Math.floor(9007199254740992*Math.random())},getViewPort:function(){if(this.isReactNative())return{width:"Not available",height:"Not available"};var b=document.documentElement,c=document.getElementsByTagName("body")[0],d=a.innerWidth||b.clientWidth||c.clientWidth,e=a.innerHeight||b.clientHeight||c.clientHeight;return{width:d,height:e}},parseUrl:function(b,c){function d(a){return!isNaN(parseFloat(a))&&isFinite(a)}return function(b,c){if("undefined"==typeof document)return"";var e=c||a.location.toString();if(!b)return e;b=b.toString(),"//"===e.substring(0,2)?e="http:"+e:1===e.split("://").length&&(e="http://"+e),c=e.split("/");var f={auth:""},g=c[2].split("@");1===g.length?g=g[0].split(":"):(f.auth=g[0],g=g[1].split(":")),f.protocol=c[0],f.hostname=g[0],f.port=g[1]||("https"===f.protocol.split(":")[0].toLowerCase()?"443":"80"),f.pathname=(c.length>3?"/":"")+c.slice(3,c.length).join("/").split("?")[0].split("#")[0];var h=f.pathname;"/"===h.charAt(h.length-1)&&(h=h.substring(0,h.length-1));var i=f.hostname,j=i.split("."),k=h.split("/");if("hostname"===b)return i;if("domain"===b)return/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/.test(i)?i:j.slice(-2).join(".");if("sub"===b)return j.slice(0,j.length-2).join(".");if("port"===b)return f.port;if("protocol"===b)return f.protocol.split(":")[0];if("auth"===b)return f.auth;if("user"===b)return f.auth.split(":")[0];if("pass"===b)return f.auth.split(":")[1]||"";if("path"===b)return f.pathname;if("."===b.charAt(0)){if(b=b.substring(1),d(b))return b=parseInt(b,10),j[b<0?j.length+b:b-1]||""}else{if(d(b))return b=parseInt(b,10),k[b<0?k.length+b:b]||"";if("file"===b)return k.slice(-1)[0];if("filename"===b)return k.slice(-1)[0].split(".")[0];if("fileext"===b)return k.slice(-1)[0].split(".")[1]||"";if("?"===b.charAt(0)||"#"===b.charAt(0)){var l=e,m=null;if("?"===b.charAt(0)?l=(l.split("?")[1]||"").split("#")[0]:"#"===b.charAt(0)&&(l=l.split("#")[1]||""),!b.charAt(1))return l;b=b.substring(1),l=l.split("&");for(var n=0,o=l.length;n<o;n++)if(m=l[n].split("="),m[0]===b)return m[1]||"";return null}}return""}(b,c)},enhance:function(a,b,c){var d=a[b];return a[b]=function(){c.apply(this,arguments),"function"==typeof d&&d.apply(this,arguments)},function(){a[b]=d}},addEventHandler:function(a,b,c,d){var e=d||!1;return a.addEventListener?a.addEventListener(b,c,e):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c,function(){a.removeEventListener?a.removeEventListener(b,c,e):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=function(){}}},nodeText:function(a){var b=a.textContent||a.innerText||"";return["submit","button"].indexOf(a.type)!==-1&&(b=a.value||b),b=b.replace(/^\s+|\s+$/g,"")},nodeSelector:function(a){var b=[a.tagName];return a.id&&b.push("#"+a.id),a.className&&a.className.length&&b.push("."+a.className.split(" ").join(".")),b.join("")},truncate:function(a,b){var c="(...)";return a.length>b?a.slice(0,b-c.length)+c:a}};return d.isReactNative()&&__DEV__!==!0&&a.ErrorUtils&&a.ErrorUtils.getGlobalHandler&&(c=a.ErrorUtils.getGlobalHandler()),d},window.raygunBreadcrumbsFactory=function(a,b){function c(a,b){for(var c=0;c<b.length;c++){var d=b[c];if("string"==typeof d&&a&&a.indexOf(d)>-1)return!0;if("object"==typeof d&&d.exec(a))return!0}return!1}var d=function(){this.MAX_BREADCRUMBS=32,this.MAX_MESSAGE_SIZE=1024,this.BREADCRUMB_LEVELS=["debug","info","warning","error"],this.DEFAULT_BREADCRUMB_LEVEL="info",this.DEFAULT_XHR_IGNORED_HOSTS=["raygun"],this.breadcrumbLevel="info",this.logXhrContents=!1,this.xhrIgnoredHosts=[].concat(this.DEFAULT_XHR_IGNORED_HOSTS),this.breadcrumbs=[],this.wrapWithHandler=function(a){return function(){try{return a.apply(this,arguments)}catch(c){b.Utilities.log(c)}}},this.disableConsoleFunctions=[],this.disableNavigationFunctions=[],this.disableXHRLogging=function(){},this.disableClicksTracking=function(){},this.enableAutoBreadcrumbs(),this.wrapPrototypeWithHandlers()};return d.prototype.recordBreadcrumb=function(a,c){var d={level:this.DEFAULT_BREADCRUMB_LEVEL,timestamp:(new Date).getTime(),type:"manual"};switch(typeof a){case"object":d=b.Utilities.merge(d,a);break;case"string":d=b.Utilities.merge(b.Utilities.merge(d,{message:a,metadata:c}));break;default:return void b.Utilities.log("expected first argument to recordBreadcrumb to be a 'string' or 'object', got "+typeof a)}this.BREADCRUMB_LEVELS.indexOf(d.level)===-1&&(b.Utilities.log("unknown breadcrumb level "+d.level+" setting to default of '"+this.DEFAULT_BREADCRUMB_LEVEL+"'"),d.level=this.DEFAULT_BREADCRUMB_LEVEL),this.shouldRecord(d)&&(d.message=b.Utilities.truncate(d.message,this.MAX_MESSAGE_SIZE),this.breadcrumbs.push(d),this.breadcrumbs=this.breadcrumbs.slice(-this.MAX_BREADCRUMBS))},d.prototype.shouldRecord=function(a){var b=this.BREADCRUMB_LEVELS.indexOf(a.level),c=this.BREADCRUMB_LEVELS.indexOf(this.breadcrumbLevel);return b>=c},d.prototype.setBreadcrumbLevel=function(a){return this.BREADCRUMB_LEVELS.indexOf(a)===-1?void b.Utilities.log("Breadcrumb level of '"+a+"' is invalid, setting to default of '"+this.DEFAULT_BREADCRUMB_LEVEL+"'"):void(this.breadcrumbLevel=a)},d.prototype.setOption=function(a,b){if("breadcrumbsLevel"===a)this.setBreadcrumbLevel(b);else if("xhrIgnoredHosts"===a){this.xhrIgnoredHosts=b.concat(this.DEFAULT_XHR_IGNORED_HOSTS);var d=this;this.removeBreadcrumbsWithPredicate(function(a){return"request"===a.type&&c(a.metadata.requestURL||a.metadata.responseURL,d.xhrIgnoredHosts)})}else"logXhrContents"===a&&(this.logXhrContents=b)},d.prototype.any=function(){return this.breadcrumbs.length>0},d.prototype.all=function(){for(var a=[],b=0;b<this.breadcrumbs.length;b++){var c=this.breadcrumbs[b];c&&"request"===c.type&&!this.logXhrContents&&(c.metadata&&c.metadata.responseText&&(c.metadata.responseText="Disabled"),c.metadata&&c.metadata.requestText&&(c.metadata.requestText=void 0)),a.push(c)}return a},d.prototype.enableAutoBreadcrumbs=function(){this.enableAutoBreadcrumbsXHR(),this.enableAutoBreadcrumbsClicks(),this.enableAutoBreadcrumbsConsole(),this.enableAutoBreadcrumbsNavigation()},d.prototype.disableAutoBreadcrumbs=function(){this.disableAutoBreadcrumbsXHR(),this.disableAutoBreadcrumbsClicks(),this.disableAutoBreadcrumbsConsole(),this.disableAutoBreadcrumbsNavigation()},d.prototype.removeBreadcrumbsWithPredicate=function(a){for(var b=this.breadcrumbs,c=[],d=0;d<b.length;d++){var e=b[d];a(e)||c.push(e)}this.breadcrumbs=c},d.prototype.removeCrumbsOfType=function(a){this.removeBreadcrumbsWithPredicate(function(b){return b.type===a})},d.prototype.enableAutoBreadcrumbsConsole=function(){if("undefined"!=typeof a.console){var c=function(a,b){for(var c=[],d=0;d<b.length;d++){var e=b[d];null!==e&&void 0!==e&&c.push(e.toString())}this.recordBreadcrumb({type:"console",level:a,message:Array.prototype.slice.call(c).join(", ")})}.bind(this),d=["log","warn","error"],e=this;this.disableConsoleFunctions=d.map(function(a){return b.Utilities.enhance(console,a,e.wrapWithHandler(function(){var b="log"===a?"info":"warn"===a?"warning":"error";c(b,arguments)}))})}},d.prototype.disableAutoBreadcrumbsConsole=function(){this.disableConsoleFunctions.forEach(function(a){a()}),this.removeCrumbsOfType("console")},d.prototype.enableAutoBreadcrumbsNavigation=function(){if(a.addEventListener&&a.history&&a.history.pushState){var c=function(b,c,d,e){var f=location.pathname+location.search+location.hash,g=null;return a.history.state&&(g=history.state),{message:"History "+b,type:"navigation",level:"info",metadata:{from:f,to:e||f,prevState:JSON.stringify(g)||"unsupported",nextState:JSON.stringify(c)}}}.bind(this),d=function(a){return a.split("#")[1]||""},e=["pushState","replaceState"];this.disableNavigationFunctions=this.disableNavigationFunctions.concat(e.map(function(a){return b.Utilities.enhance(history,a,this.wrapWithHandler(function(b,d,e){this.recordBreadcrumb(c(a,b,d,e))}.bind(this)))}.bind(this)));var f=function(a){var b,c=a.oldURL,e=a.newURL;return b=c&&e?{from:d(c),to:d(e)}:{to:location.hash},{type:"navigation",message:"Hash change",metadata:b}},g=function(a){return this.wrapWithHandler(function(){this.recordBreadcrumb(a.apply(null,arguments))}.bind(this))}.bind(this),h=[{element:a,event:"hashchange",handler:f},{element:a,event:"load",handler:function(){return{type:"navigation",message:"Page loaded"}}},{element:a,event:"popstate",handler:function(){return{type:"navigation",message:"Navigated back"}}},{element:a,event:"pagehide",handler:function(){return{type:"navigation",message:"Page hidden"}}},{element:a,event:"pageshow",handler:function(){return{type:"navigation",message:"Page shown"}}},{element:document,event:"DOMContentLoaded",handler:function(){return{type:"navigation",message:"DOMContentLoaded"}}}];this.disableNavigationFunctions=this.disableNavigationFunctions.concat(h.map(function(a){return b.Utilities.addEventHandler(a.element,a.event,g(a.handler))}.bind(this)))}},d.prototype.disableAutoBreadcrumbsNavigation=function(){this.disableNavigationFunctions.forEach(function(a){a()}),this.disableNavigationFunctions=[],this.removeCrumbsOfType("navigation")},d.prototype.enableAutoBreadcrumbsClicks=function(){this.disableClicksTracking=b.Utilities.addEventHandler(a,"click",this.wrapWithHandler(function(a){var c,d;try{c=b.Utilities.truncate(b.Utilities.nodeText(a.target),150),d=b.Utilities.nodeSelector(a.target)}catch(e){c="[unknown]",d="[unknown]",b.Utilities.log("Error retrieving node text/selector. Most likely due to a cross domain error")}this.recordBreadcrumb({type:"click-event",message:"UI Click",level:"info",metadata:{text:c,selector:d}})}.bind(this),!0))},d.prototype.disableAutoBreadcrumbsClicks=function(){this.disableClicksTracking(),this.removeCrumbsOfType("click-event")},d.prototype.enableAutoBreadcrumbsXHR=function(){var d=this;return a.XMLHttpRequest.prototype.addEventListener?void(this.disableXHRLogging=b.Utilities.enhance(a.XMLHttpRequest.prototype,"open",d.wrapWithHandler(function(){var a=(new Date).getTime(),e=arguments[1]||"Unknown",f=arguments[0];c(e,d.xhrIgnoredHosts)||(b.Utilities.enhance(this,"send",d.wrapWithHandler(function(){var a={method:f,requestURL:e};arguments[0]&&"string"==typeof arguments[0]&&(a.requestText=b.Utilities.truncate(arguments[0],500)),d.recordBreadcrumb({type:"request",message:"Opening request to "+e,level:"info",metadata:a})})),this.addEventListener("load",d.wrapWithHandler(function(){var c="N/A for non text responses";""!==this.responseType&&"text"!==this.responseType||(c=b.Utilities.truncate(this.responseText,500)),d.recordBreadcrumb({type:"request",message:"Finished request to "+e,level:"info",metadata:{status:this.status,requestURL:e,responseURL:this.responseURL,responseText:c,duration:(new Date).getTime()-a+"ms"}})})),this.addEventListener("error",d.wrapWithHandler(function(){d.recordBreadcrumb({type:"request",message:"Failed request to "+e,level:"info",metadata:{status:this.status,requestURL:e,responseURL:this.responseURL,duration:(new Date).getTime()-a+"ms"}})})),this.addEventListener("abort",d.wrapWithHandler(function(){d.recordBreadcrumb({type:"request",message:"Request to "+e+"aborted",level:"info",metadata:{requestURL:e,duration:(new Date).getTime()-a+"ms"}})})))}))):void(this.disableXHRLogging=function(){})},d.prototype.disableAutoBreadcrumbsXHR=function(){this.disableXHRLogging(),this.removeCrumbsOfType("request")},d.prototype.wrapPrototypeWithHandlers=function(){var a,b;for(a in d.prototype)b=d.prototype[a],"function"==typeof b&&(d.prototype[a]=this.wrapWithHandler(b))},d};var raygunFactory=function(a,b,c){function d(a){"function"==typeof C&&C(a)}function e(){v||Q?j():u.Utilities.readCookie(H,f)}function f(a,b){var c;a&&(c="Unknown"),b?c=b:(c=u.Utilities.getUuid(),u.Utilities.createCookie(H,c,744,ia)),u.setUser(c,!0,null,null,null,c),j()}function g(a){var b=a.reason;!b&&a.detail&&a.detail.reason&&(b=a.detail.reason),b||(b=a),typeof b!==Error&&"string"==typeof b&&(b=new Error(b)),ka.send(b,c,["UnhandledPromiseRejection"])}function h(){F=u.Utilities.addEventHandler(a,"unhandledrejection",g)}function i(){F()}function j(){if(da!==G.READY){if(da=G.READY,u.RealUserMonitoring!==c&&!S){var b=function(){_=new u.RealUserMonitoring(u.Options._raygunApiKey,X,t,v,w,V,Y,Z,K,ba,ca,ga,z,ia),_.attach()};"onLoad"===D?b():a.addEventListener?a.addEventListener("load",b):a.attachEvent("onload",b)}k(),m()}}function k(){var a;for(a=0;a<ea.length;a++)q(ea[a].stackTrace,ea[a].options,ea[a].userTriggered,ea[a].error);for(ea=[],a=0;a<fa.length;a++)ka.trackEvent(fa[a].type,fa[a].options);fa=[]}function l(a,b){var c=(new Date).toJSON();try{var d="raygunjs+"+u.Options._raygunApiKey+"="+c+"="+u.Utilities.getRandomInt();"undefined"==typeof localStorage[d]&&(localStorage[d]=JSON.stringify({url:a,data:b}))}catch(e){u.Utilities.log("Raygun4JS: LocalStorage full, cannot save exception")}}function m(){if(u.Utilities.localStorageAvailable())for(var a in localStorage)if("raygunjs="===a.substring(0,9)||a.substring(0,33)==="raygunjs+"+u.Options._raygunApiKey){try{var b=JSON.parse(localStorage[a]);t(b.url,b.data)}catch(c){u.Utilities.log("Raygun4JS: Invalid JSON object in LocalStorage")}try{localStorage.removeItem(a)}catch(c){u.Utilities.log("Raygun4JS: Unable to remove error")}}}function n(a,b){if(x)for(var d=0;d<x.length;d++)if("object"==typeof x[d]&&"function"==typeof x[d].exec){var e=x[d].exec(a);if(null!==e&&e!==c)return"[removed by filter]"}else if(x[d]===a)return"[removed by filter]";return b}function o(a,b){if(null==a)return a;if("[object Object]"!==Object.prototype.toString.call(a))return a;var c={};for(var d in a){var e=a[d];"[object Object]"===Object.prototype.toString.call(e)?"Details"!==b||"Client"!==d?c[d]=o(n(d,e),d):c[d]=e:"[object Function]"!==Object.prototype.toString.call(e)&&("undefined"!=typeof b?c[d]=n(d,e):"OccurredOn"===d&&(c[d]=e))}return c}function p(a,b,d,e){var f="AJAX Error: "+(b.statusText||"unknown")+" "+(d.type||"unknown")+" "+(u.Utilities.truncateURL(d.url)||"unknown");(!M||0!==b.status&&b.getAllResponseHeaders())&&u.send(e||a.type,{status:b.status,statusText:b.statusText,type:d.type,url:d.url,ajaxErrorMessage:f,contentType:d.contentType,requestData:d.data&&d.data.slice?d.data.slice(0,10240):c,responseData:b.responseText&&b.responseText.slice?b.responseText.slice(0,10240):c,activeTarget:a.target&&a.target.activeElement&&a.target.activeElement.outerHTML&&a.target.activeElement.outerHTML.slice?a.target.activeElement.outerHTML.slice(0,10240):c})}function q(b,d,e,f){if(da!==G.READY)return void ea.push({stackTrace:b,options:d,userTriggered:e,error:f});var g="Script error",h=[],i={};if(P){if(!b.stack||!b.stack.length)return void u.Utilities.log("Raygun4JS: Cancelling send due to null stacktrace");var j=u.Utilities.parseUrl("domain"),k=g;if(b.message?k=b.message:d&&d.status&&(k=d.status),"undefined"==typeof k&&(k=g),!u.Utilities.isReactNative()&&"function"==typeof k.substring&&k.substring(0,g.length)===g&&null!==b.stack[0].url&&b.stack[0].url!==c&&b.stack[0].url.indexOf(j)===-1&&(0===b.stack[0].line||"?"===b.stack[0].func))return void u.Utilities.log("Raygun4JS: cancelling send due to third-party script error with no stacktrace and message");for(var l=!1,m=0;!l&&b.stack&&m<b.stack.length;m++)if(null!==b.stack[m]&&b.stack[m]!==c&&null!==b.stack[m].url&&b.stack[m].url!==c){for(var p in W)b.stack[m].url.indexOf(W[p])>-1&&(l=!0);b.stack[m].url.indexOf(j)>-1&&(l=!0)}if(!l)return void u.Utilities.log("Raygun4JS: cancelling send due to error on non-origin, non-whitelisted domain")}if(Y instanceof Array)for(var q in Y)if(Y.hasOwnProperty(q)&&a.location.hostname&&a.location.hostname.match(Y[q]))return void u.Utilities.log("Raygun4JS: cancelling send as error originates from an excluded hostname");if(Z instanceof Array&&!u.Utilities.isReactNative())for(var s in Z)if(Z.hasOwnProperty(s)&&navigator.userAgent.match(Z[s]))return void u.Utilities.log("Raygun4JS: cancelling send as error originates from an excluded user agent");if(u.Utilities.isReactNative()||!navigator.userAgent.match("RaygunPulseInsightsCrawler")){b.stack&&b.stack.length&&u.Utilities.forEach(b.stack,function(a,b){h.push({LineNumber:b.line,ColumnNumber:b.column,ClassName:"line "+b.line+", column "+b.column,FileName:b.url,MethodName:b.func||"[anonymous]"})});var t=u.Utilities.parseUrl("?");t.length>0&&u.Utilities.forEach(t.split("&"),function(a,b){var c=b.split("=");if(c&&2===c.length){var d=decodeURIComponent(c[0]),e=n(d,c[1]);i[d]=e}}),d===c&&(d={}),u.Utilities.isEmpty(d.customData)&&("function"==typeof U?d.customData=U():d.customData=U),u.Utilities.isEmpty(d.tags)&&("function"==typeof V?d.tags=V():"string"==typeof V?d.tags=[V]:d.tags=V),e||(d.tags||(d.tags=[]),u.Utilities.contains(d.tags,"UnhandledException")||d.tags.push("UnhandledException")),u.Utilities.isReactNative()&&!u.Utilities.contains(d.tags,"React Native")&&d.tags.push("React Native");var x,z=a.screen||{width:u.Utilities.getViewPort().width,height:u.Utilities.getViewPort().height,colorDepth:8},B=d.customData&&d.customData.ajaxErrorMessage;x="customData"===$?o(d.customData,"UserCustomData"):d.customData;try{JSON.stringify(x)}catch(C){var D="Cannot add custom data; may contain circular reference";x={error:D},u.Utilities.log("Raygun4JS: "+D)}var E=g;B?E=B:b.message?E=b.message:d&&d.status?E=d.status:"string"==typeof f&&(E=f),"undefined"==typeof E&&(E=g),E&&"string"==typeof E&&(E=E.substring(0,512));var F;F=u.Utilities.isReactNative()?"/":[location.protocol,"//",location.host,location.pathname,location.hash].join("");var H={OccurredOn:new Date,Details:{Error:{ClassName:b.name,Message:E,StackTrace:h,StackString:b.stackstring},Environment:{UtcOffset:(new Date).getTimezoneOffset()/-60,"User-Language":navigator.userLanguage,"Document-Mode":u.Utilities.isReactNative()?"Not available":document.documentMode,"Browser-Width":u.Utilities.getViewPort().width,"Browser-Height":u.Utilities.getViewPort().height,"Screen-Width":z.width,"Screen-Height":z.height,"Color-Depth":z.colorDepth,Browser:navigator.appCodeName,"Browser-Name":navigator.appName,"Browser-Version":navigator.appVersion,Platform:navigator.platform},Client:{Name:"raygun-js",Version:"2.12.0"},UserCustomData:x,Tags:d.tags,Request:{Url:F,QueryString:i,Headers:{"User-Agent":navigator.userAgent,Referer:u.Utilities.isReactNative()?"Not available":document.referrer,Host:u.Utilities.isReactNative()?"Not available":document.domain}},Version:w||"Not supplied"}};if(H.Details.User=v,aa.any()){H.Details.Breadcrumbs=[];var I=aa.all()||[];I.forEach(function(a){a.metadata&&(a.CustomData=a.metadata,
delete a.metadata),H.Details.Breadcrumbs.push(a)})}if("all"===$&&(H=o(H)),"function"==typeof A&&(u.Utilities.log("Raygun4JS: calling custom grouping key"),H.Details.GroupingKey=A(H,b,d)),"function"==typeof y){var J=y(H);J&&r(J)}else r(H)}}function r(a){if(u.Utilities.isApiKeyConfigured()){u.Utilities.log("Sending exception data to Raygun:",a);var b=X+"/entries?apikey="+encodeURIComponent(u.Options._raygunApiKey);t(b,JSON.stringify(a))}}function s(b,c){var d;return d=new a.XMLHttpRequest,"withCredentials"in d||u.Utilities.isReactNative()?d.open(b,c,!0):a.XDomainRequest&&(L&&(c=c.slice(6)),d=new a.XDomainRequest,d.open(b,c)),d.timeout=1e4,d}function t(b,c,e,f){var g=s("POST",b,c);return"function"==typeof B&&B(g),u.Utilities.log("Is offline enabled? "+O),"withCredentials"in g||u.Utilities.isReactNative()?(g.onreadystatechange=function(){4===g.readyState&&(202===g.status?m():O&&403!==g.status&&400!==g.status&&429!==g.status&&l(b,c))},g.onload=function(){u.Utilities.log("posted to Raygun"),d(this),e&&"function"==typeof e&&e(g,b,c)}):a.XDomainRequest&&(g.ontimeout=function(){O&&(u.Utilities.log("Raygun: saved locally"),l(b,c))},g.onload=function(){u.Utilities.log("posted to Raygun"),m(),d(this),e&&"function"==typeof e&&e(g,b,c)}),g.onerror=function(){u.Utilities.log("failed to post to Raygun"),d(this),f&&"function"==typeof f&&f(g,b,c)},g?(u.Utilities.isReactNative()&&g.setRequestHeader("Content-type","application/json;charset=UTF-8"),void g.send(c)):void u.Utilities.log("CORS not supported")}var u={};u.Utilities=raygunUtilityFactory(a,u),u.Breadcrumbs=raygunBreadcrumbsFactory(a,u);var v,w,x,y,z,A,B,C,D,E,F,G={LOADING:0,READY:1},H="raygun4js-userid",I=TraceKit,J=a.Raygun,K=!1,L=!1,M=!1,N=!1,O=!1,P=!1,Q=!1,R=!1,S=!0,T=!1,U={},V=[],W=[],X="https://api.raygun.io",Y=null,Z=null,$="customData",_=null,aa=new u.Breadcrumbs,ba=null,ca=!0,da=G.LOADING,ea=[],fa=[],ga=null,ha=!0,ia=!1,ja=Math.random(),ka={Rand:ja,Options:{},noConflict:function(){return J&&(a.Raygun=J),u},constructNewRaygun:function(){var b=raygunFactory(a,a.jQuery);return b},init:function(a,d,f){return I.remoteFetching=!1,this.Options._raygunApiKey=a,f&&(U=f),b&&(E=b(document)),d&&(L=d.allowInsecureSubmissions||!1,M=d.ignoreAjaxAbort||!1,N=d.ignoreAjaxError||!1,Q=d.disableAnonymousUserTracking||!1,R=d.disableErrorTracking||!1,S=d.disablePulse===c||d.disablePulse,Y=d.excludedHostnames||!1,Z=d.excludedUserAgents||!1,ba=d.pulseMaxVirtualPageDuration||null,ca=d.pulseIgnoreUrlCasing||!1,ga=d.pulseCustomLoadTimeEnabled||!1,ia=d.setCookieAsSecure||!1,d.apiUrl&&(X=d.apiUrl),"undefined"!=typeof d.wrapAsynchronousCallbacks&&(T=d.wrapAsynchronousCallbacks),"undefined"!=typeof d.captureUnhandledRejections&&(ha=d.captureUnhandledRejections),d.debugMode&&(K=d.debugMode),this.Options._debugMode=K,d.ignore3rdPartyErrors&&(P=!0),d.apiEndpoint&&(X=d.apiEndpoint),d.from&&(D=d.from)),e(),u},withCustomData:function(a){return U=a,u},withTags:function(a){return V=a,_!==c&&null!==_&&_.withTags(a),u},attach:function(){return!u.Utilities.isApiKeyConfigured()||R?u:(a.RaygunObject&&a[a.RaygunObject]&&a[a.RaygunObject].q&&(a.onerror=null),ha&&h(),u.Utilities.isReactNative()&&__DEV__!==!0&&a.ErrorUtils&&a.ErrorUtils.setGlobalHandler&&a.ErrorUtils.setGlobalHandler(function(a,b){var c=C;C=function(){"function"==typeof c&&c(),u.Utilities.defaultReactNativeGlobalHandler(a,b),C=c},TraceKit.report(a)}),I.report.subscribe(q),T&&I.extendToAsynchronousCallbacks(),E&&E.ajaxError&&!N&&E.ajaxError(p),u)},detach:function(){return I.report.unsubscribe(q),E&&E.unbind("ajaxError",p),ha&&i(),u},send:function(a,b,c){if(R)return u.Utilities.log("Error not sent due to disabled error tracking"),u;try{q(I.computeStackTrace(a),{customData:"function"==typeof U?u.Utilities.merge(U(),b):u.Utilities.merge(U,b),tags:"function"==typeof V?u.Utilities.mergeArray(V(),c):u.Utilities.mergeArray(V,c)},!0,a)}catch(d){if(a!==d)throw d}return u},setUser:function(a,b,d,e,f,g){return v={Identifier:a},"boolean"==typeof b&&(v.IsAnonymous=b),d&&(v.Email=d),e&&(v.FullName=e),f&&(v.FirstName=f),g&&(v.UUID=g),_!==c&&null!==_&&_.setUser(v),u},resetAnonymousUser:function(){u.Utilities.clearCookie("raygun4js-userid")},setVersion:function(a){return w=a,u},saveIfOffline:function(a){return"undefined"!=typeof a&&"boolean"==typeof a&&(O=a),u},filterSensitiveData:function(a){return x=a,u},setFilterScope:function(a){return"customData"!==a&&"all"!==a||($=a),u},whitelistCrossOriginDomains:function(a){return W=a,u},onBeforeSend:function(a){return y=a,u},onBeforeSendRum:function(a){return z=a,u},groupingKey:function(a){return A=a,u},onBeforeXHR:function(a){return B=a,u},onAfterSend:function(a){return C=a,u},endSession:function(){u.RealUserMonitoring!==c&&_&&_.endSession()},trackEvent:function(a,b){return da!==G.READY?void fa.push({type:a,options:b}):void(u.RealUserMonitoring!==c&&_&&("pageView"===a&&b.path?_.virtualPageLoaded(b.path):"customTimings"===a&&b.timings&&_.sendCustomTimings(b.timings)))},recordBreadcrumb:function(){aa.recordBreadcrumb.apply(aa,arguments)},enableAutoBreadcrumbs:function(a){a?aa["enableAutoBreadcrumbs"+a]():aa.enableAutoBreadcrumbs()},disableAutoBreadcrumbs:function(a){a?aa["disableAutoBreadcrumbs"+a]():aa.disableAutoBreadcrumbs()},setBreadcrumbOption:function(a,b){aa.setOption(a,b)},setBreadcrumbs:function(a){aa=a},getBreadcrumbs:function(){return aa.all()}};return u=u.Utilities.mergeMutate(u,ka),a.__raygunNoConflict||(a.Raygun=u),TraceKit.setRaygun(u),u};window.__instantiatedRaygun=raygunFactory(window,window.jQuery);var raygunRumFactory=function(a,b,c){c.RealUserMonitoring=function(b,c,d,e,f,g,h,i,j,k,l,m,n,o){function p(a){if(!V.pendingPayloadData||a){var b,c,d=[],e=[],f=!1,g=function(){e.push(r(d)),d=[],f=!1},h=function(){d.length>0&&g(),e.length>0&&(V.sendItemsImmediately(e),d=[],f=!1)};for(c=0;c<V.queuedPerformanceTimings.length;c++){b=V.queuedPerformanceTimings[c];var i=b.timing.t===X.Page||b.timing.t===X.VirtualPage;if(f&&i&&g(),d.length>0&&i&&g(),i&&t(),b.timing.t===X.VirtualPage&&b.timing.pending)return h(),void V.queuedPerformanceTimings.splice(0,c);d.push(b),f=f||b.timing.t===X.Page||b.timing.t===X.VirtualPage}h(),V.queuedPerformanceTimings=[]}}function q(a,b){V.queuedPerformanceTimings=V.queuedPerformanceTimings.concat(a),p(b)}function r(a){return{sessionId:V.sessionId,requestId:V.requestId,timestamp:(new Date).toISOString(),type:"web_request_timing",user:V.user,version:V.version||"Not supplied",device:navigator.userAgent,tags:V.tags,data:a}}function s(a){var b=w(V.cookieName),c=null===b,d="string"==typeof exisitingCookie&&b.length>0&&b.indexOf("timestamp")===-1,e=null;if(!c&&!d){var f=new Date(v(b,"timestamp")),g=new Date(new Date-18e5);e=f<g}if(c||d||e)V.sessionId=O(32),u(V.cookieName,V.sessionId,void 0,V.setCookieAsSecure),a(!0);else{var h=w(V.cookieName),i=v(h,"id");"undefined"===i||"null"===i?(V.sessionId=O(32),u(V.cookieName,V.sessionId,void 0,V.setCookieAsSecure),a(!0)):(V.sessionId=i,a(!1))}}function t(){V.requestId=O(16)}function u(a,b,c,d){var e,f;if(c){var g=new Date;g.setTime(g.getTime()+60*c*60*1e3),e="; expires="+g.toGMTString()}else e="";f=(new Date).toISOString();var h=d?"; secure":"";document.cookie=a+"=id|"+b+"×tamp|"+f+e+"; path=/"+h}function v(a,b){var c=a.split(/[|&]/);return"id"===b?c[1]:"timestamp"===b?c[3]:void 0}function w(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(b))return e.substring(b.length,e.length)}return null}function x(){var a,b=w(V.cookieName);if(b){var c=new Date(v(b,"timestamp")),d=new Date(new Date-18e5);a=c<d}else a=!0;a&&(V.sessionId=O(32)),u(V.cookieName,V.sessionId,void 0,V.setCookieAsSecure),a&&V.sendNewSessionStart()}function y(a){return{t:X.VirtualPage,startTime:a,staticLoad:V.initalStaticPageLoadTimestamp,pending:!0}}function z(){var a,b=0;for(b;b<V.queuedPerformanceTimings.length;b++)a=V.queuedPerformanceTimings[b],a.timing.t===X.VirtualPage&&a.timing.pending&&(a.timing=A(a.timing))}function A(a){var b=Q(0);return{t:a.t,du:Math.min(V.maxVirtualPageDuration,b-a.startTime),o:Math.min(V.maxVirtualPageDuration,b-a.staticLoad)}}function B(a,b){var c={du:a.duration,t:X.Page};return c.a=b+a.fetchStart,a.domainLookupStart&&a.domainLookupStart>0&&(c.b=b+a.domainLookupStart-c.a),a.domainLookupEnd&&a.domainLookupEnd>0&&(c.c=b+a.domainLookupEnd-c.a),a.connectStart&&a.connectStart>0&&(c.d=b+a.connectStart-c.a),a.connectEnd&&a.connectEnd>0&&(c.e=b+a.connectEnd-c.a),a.responseStart&&a.responseStart>0&&(c.f=b+a.responseStart-c.a),a.responseEnd&&a.responseEnd>0&&(c.g=b+a.responseEnd-c.a),a.domLoading&&a.domLoading>0&&(c.h=b+a.domLoading-c.a),a.domInteractive&&a.domInteractive>0&&(c.i=b+a.domInteractive-c.a),a.domContentLoadedEventEnd&&a.domContentLoadedEventEnd>0&&(c.j=b+a.domContentLoadedEventEnd-c.a),a.domComplete&&a.domComplete>0&&(c.k=R(b+a.domComplete-c.a)),a.loadEventStart&&a.loadEventStart>0&&(c.l=b+a.loadEventStart-c.a),a.loadEventEnd&&a.loadEventEnd>0&&(c.m=b+a.loadEventEnd-c.a),a.secureConnectionStart&&a.secureConnectionStart>0&&(c.n=b+(a.secureConnectionStart-a.connectStart)-c.a),c=N(c)}function C(a){return"xmlhttprequest"===a.initiatorType||"fetch"===a.initiatorType?X.XHR:E(a)?F(a):D(a)?X.XHR:F(a)}function D(a){return"string"==typeof a.initiatorType&&""===a.initiatorType}function E(a){switch(a.initiatorType){case"img":case"css":case"script":case"link":case"other":case"use":return!0}return!1}function F(a){return 0===a.duration?X.CachedChildAsset:X.ChildAsset}function G(a,b){var c={du:R(a.duration).toFixed(2),t:C(a),a:b+a.fetchStart};return a.domainLookupStart&&a.domainLookupStart>0&&(c.b=b+a.domainLookupStart-c.a),a.domainLookupEnd&&a.domainLookupEnd>0&&(c.c=b+a.domainLookupEnd-c.a),a.connectStart&&a.connectStart>0&&(c.d=b+a.connectStart-c.a),a.connectEnd&&a.connectEnd>0&&(c.e=b+a.connectEnd-c.a),a.responseStart&&a.responseStart>0&&(c.f=b+a.responseStart-c.a),a.responseEnd&&a.responseEnd>0&&(c.g=b+a.responseEnd-c.a),a.secureConnectionStart&&a.secureConnectionStart>0&&(c.n=b+(a.secureConnectionStart-a.connectStart)-c.a),c.a=c.a.toFixed(2),c=N(c)}function H(){var b=a.location.pathname;V.ignoreUrlCasing&&(b=b.toLowerCase());var c=a.location.protocol+"//"+a.location.host+b;return c.length>800&&(c=c.substring(0,800)),{url:c,userAgent:navigator.userAgent,timing:B(a.performance.timing,0),size:0}}function I(b,c){V.ignoreUrlCasing&&(b=b.toLowerCase()),b.indexOf("?")!==-1&&(b=b.split("?")[0]);var d=a.location.protocol+"//"+a.location.host+b;return d.length>800&&(d=d.substring(0,800)),{url:d,userAgent:navigator.userAgent,timing:y(c),size:0}}function J(b,c){var d=b.name.split("?")[0];return V.ignoreUrlCasing&&(d=d.toLowerCase()),d.length>800&&(d=d.substring(0,800)),{url:d,timing:G(b,c?0:a.performance.timing.navigationStart),size:b.decodedBodySize||0}}function K(a){return 0===a.indexOf(V.apiUrl)||(a.indexOf("favicon.ico")>0||(0===a.indexOf("about:blank")||("j"===a[0]&&1===a.indexOf("avascript:")||(0===a.indexOf("chrome-extension://")||(0===a.indexOf("res://")||0===a.indexOf("file://"))))))}function L(b,c){if(P("getEntries","function"))try{for(var d=a.performance.getEntries(),e=V.offset;e<d.length;e++){var f=d[e].name.split("?")[0];K(f)||b.push(J(d[e],c))}V.offset=d.length}catch(g){}}function M(b,c){if(!P("timing","object")||void 0===a.performance.timing.fetchStart||isNaN(a.performance.timing.fetchStart))return null;var d=[];return c&&d.push(H()),L(d),b&&(d.push(I(b,Q(0))),L(d,!0)),d}function N(a){for(var b in a)isNaN(a[b])&&"string"!=typeof a[b]&&(a[b]=0);return a}function O(a){return Math.round(Math.pow(36,a+1)-Math.random()*Math.pow(36,a)).toString(36).slice(1)}function P(b,c){return"object"==typeof a.performance&&(!b||b&&typeof a.performance[b]===c)}function Q(b){return P("now","function")?a.performance.now():b}function R(a){return Math.min(a,3e5)}function S(b,c){V.debugMode&&a.console&&a.console.log&&(a.console.log(b),c&&a.console.log(c))}function T(a){return function(b,c){if(!b.hasOwnProperty(a)||!c.hasOwnProperty(a))return S('Raygun4JS: Property "'+a+'" not found in items in this collection'),0;var d=b[a],e=c[a],f=0;return d>e?f=1:d<e&&(f=-1),f}}function U(a,b){return a.sort(T(b))}var V=this,W={};this.cookieName="raygun4js-sid",this.apiKey=b,this.apiUrl=c,this.debugMode=j,this.excludedHostNames=h,this.excludedUserAgents=i,this.maxVirtualPageDuration=k||18e5,this.ignoreUrlCasing=l,this.customTimingsEnabled=m,this.beforeSend=n||function(a){return a},this.pendingPayloadData=m||!1,this.queuedPerformanceTimings=[],this.pendingVirtualPage=null,this.sessionId=null,this.virtualPage=null,this.user=e,this.version=f,this.tags=g,this.heartBeatInterval=null,this.heartBeatIntervalTime=3e4,this.offset=0,this.queuedItems=[],this.maxQueueItemsSent=50,this.setCookieAsSecure=o;var X={Page:"p",VirtualPage:"v",XHR:"x",CachedChildAsset:"e",ChildAsset:"c"};this.attach=function(){s(function(a){V.pageLoaded(a)});var b=function(){this.updateCookieTimestamp()}.bind(W),c=function(){V.sendChildAssets(!0),V.sendQueuedItems()}.bind(W),d=function(){"visible"===document.visibilityState&&this.updateCookieTimestamp()}.bind(W);a.addEventListener?(a.addEventListener("click",b),document.addEventListener("visibilitychange",d),a.addEventListener("beforeunload",c)):a.attachEvent&&document.attachEvent("onclick",b)},this.pageLoaded=function(a){a&&this.sendNewSessionStart(),V.sendPerformance(!0),V.heartBeat(),V.initalStaticPageLoadTimestamp=Q(0)},this.virtualPageLoaded=function(a){"string"==typeof a&&(a.length>0&&"/"!==a[0]&&(a+="/"),a.length>800&&(a=a.substring(0,800)),this.virtualPage=a),z(),this.sendPerformance(!1)},this.heartBeat=function(){return null!==V.heartBeatInterval?void S("Raygun4JS: Heartbeat already exists. Skipping heartbeat creation."):void(V.heartBeatInterval=setInterval(function(){V.sendChildAssets(),V.sendQueuedItems()},V.heartBeatIntervalTime))},this.setUser=function(a){V.user=a},this.withTags=function(a){V.tags=a},this.endSession=function(){V.sendItemImmediately({sessionId:V.sessionId,requestId:V.requestId,timestamp:(new Date).toISOString(),type:"session_end"})},this.sendNewSessionStart=function(){V.sendItemImmediately({sessionId:V.sessionId,timestamp:(new Date).toISOString(),type:"session_start",user:V.user,version:V.version||"Not supplied",tags:V.tags,device:navigator.userAgent})},this.sendCustomTimings=function(a){"object"!=typeof a||"number"!=typeof a.custom1&&"number"!=typeof a.custom2&&"number"!=typeof a.custom3&&"number"!=typeof a.custom4&&"number"!=typeof a.custom5&&"number"!=typeof a.custom6&&"number"!=typeof a.custom7&&"number"!=typeof a.custom8&&"number"!=typeof a.custom9&&"number"!=typeof a.custom10||V.pendingPayloadData&&V.queuedPerformanceTimings.length>0&&(V.pendingPayloadData=!1,V.queuedPerformanceTimings[0].customTiming=a,p())},this.sendPerformance=function(a){var b=M(this.virtualPage,a);null===b||b.length<0||q(b,!1)},this.sendChildAssets=function(a){a&&z();var b=[];L(b),q(b,a)},this.sendQueuedItems=function(){if(V.queuedItems.length>0){V.queuedItems=U(V.queuedItems,"timestamp");var a=V.queuedItems.splice(0,V.maxQueueItemsSent);V.sendItemsImmediately(a)}},this.sendItemImmediately=function(a){var b=[a];V.sendItemsImmediately(b)},this.sendItemsImmediately=function(a){var b={eventData:a},c=function(){S("Raygun4JS: Items sent successfully. Queue length: "+V.queuedItems.length)},d=function(b){V.requeueItemsToFront(a),S("Raygun4JS: Items failed to send. Queue length: "+V.queuedItems.length+" Response status code: "+b.status)};this.postPayload(b,c,d)},this.requeueItemsToFront=function(a){V.queuedItems=a.concat(V.queuedItems)},this.postPayload=function(a,b,c){"function"!=typeof b&&(b=function(){}),"function"!=typeof c&&(c=function(){}),V.makePostCorsRequest(V.apiUrl+"/events?apikey="+encodeURIComponent(V.apiKey),a,b,c)},this.makePostCorsRequest=function(b,c,e,f){if(V.excludedUserAgents instanceof Array)for(var g in V.excludedUserAgents)if(V.excludedUserAgents.hasOwnProperty(g)&&navigator.userAgent.match(V.excludedUserAgents[g]))return void S("Raygun4JS: cancelling send as error originates from an excluded user agent");if(V.excludedHostNames instanceof Array)for(var h in V.excludedHostNames)if(V.excludedHostNames.hasOwnProperty(h)&&a.location.hostname&&a.location.hostname.match(V.excludedHostNames[h]))return void S("Raygun4JS: cancelling send as error originates from an excluded hostname");if(!navigator.userAgent.match("RaygunPulseInsightsCrawler")){var i=V.beforeSend(c);if(!i)return void S("Raygun4JS: cancelling send because onBeforeSendRUM returned falsy value");if(i.eventData)for(var j=0;j<i.eventData.length;j++)i.eventData[j].data&&"string"!=typeof i.eventData[j].data&&(i.eventData[j].data=JSON.stringify(i.eventData[j].data));d(b,JSON.stringify(i),e,f)}},W.updateCookieTimestamp=x}};raygunRumFactory(window,window.jQuery,window.__instantiatedRaygun),function(a,b){if(a.RaygunObject&&a[a.RaygunObject]){var c,d,e,f,g,h,i,j=a[a.RaygunObject].o,k=!1,l=!1,m=[],n=["function (b,c,d,f,g){","||(g=new Error(b)),a[e].q=a[e].q||[]"];c=a[a.RaygunObject].q;var o=b,p=["trackEvent","send","recordBreadcrumb"],q=function(){j=a[a.RaygunObject].o;for(var b in j){var c=j[b];c&&(p.indexOf(c[0])===-1?r(c):m.push(c))}},r=function(a){var b=a[0],c=a[1];if(b)switch(b){case"boot":t();break;case"noConflict":h=c;break;case"apiKey":d=c,k=!0;break;case"options":e=c;break;case"attach":case"enableCrashReporting":f=c,k=!0;break;case"enablePulse":g=c,k=!0;break;case"detach":o.detach();break;case"getRaygunInstance":return o;case"setUser":o.setUser(c.identifier,c.isAnonymous,c.email,c.fullName,c.firstName,c.uuid);break;case"onBeforeSend":o.onBeforeSend(c);break;case"onBeforeSendRUM":o.onBeforeSendRum(c);break;case"onBeforeXHR":o.onBeforeXHR(c);break;case"onAfterSend":o.onAfterSend(c);break;case"withCustomData":o.withCustomData(c);break;case"withTags":o.withTags(c);break;case"setVersion":o.setVersion(c);