Socket
Socket
Sign inDemoInstall

@bugsnag/browser

Package Overview
Dependencies
7
Maintainers
9
Versions
123
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.0.0-alpha.2 to 8.0.0-alpha.3

2

dist/bugsnag.min.js

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

!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Bugsnag=e()}(function(){var r=["navigation","request","process","log","user","state","error","manual"],g=function(e,t,n){for(var r=n,o=0,a=e.length;o<a;o++)r=t(r,e[o],o,e);return r},h=function(e,o){return g(e,function(e,t,n,r){return o(t,n,r)?e.concat(t):e},[])},p=function(e,o){return g(e,function(e,t,n,r){return!0===e||t===o},!1)},i=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=!{toString:null}.propertyIsEnumerable("toString"),d=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(e){var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push(t);if(!s)return n;for(var r=0,o=d.length;r<o;r++)Object.prototype.hasOwnProperty.call(e,d[r])&&n.push(d[r]);return n},t=function(t,n){return void 0===t&&(t=1),void 0===n&&(n=Infinity),function(e){return"number"==typeof e&&parseInt(""+e,10)===e&&t<=e&&e<=n}},o=function(e){return"function"==typeof e||i(e)&&h(e,function(e){return"function"==typeof e}).length===e.length},f=function(e){return"string"==typeof e&&!!e.length},v={},y=function(){return{unhandledExceptions:!0,unhandledRejections:!0}},u=(v.schema={apiKey:{defaultValue:function(){return null},message:"is required",validate:f},appVersion:{defaultValue:function(){return undefined},message:"should be a string",validate:function(e){return e===undefined||f(e)}},appType:{defaultValue:function(){return undefined},message:"should be a string",validate:function(e){return e===undefined||f(e)}},autoDetectErrors:{defaultValue:function(){return!0},message:"should be true|false",validate:function(e){return!0===e||!1===e}},enabledErrorTypes:{defaultValue:y,message:"should be an object containing the flags { unhandledExceptions:true|false, unhandledRejections:true|false }",allowPartialObject:!0,validate:function(t){if("object"!=typeof t||!t)return!1;var e=a(t),n=a(y());return!(h(e,function(e){return p(n,e)}).length<e.length)&&!(0<h(a(t),function(e){return"boolean"!=typeof t[e]}).length)}},onError:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:o},onSession:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:o},onBreadcrumb:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:o},endpoints:{defaultValue:function(e){return void 0===e?{notify:"https://notify.bugsnag.com",sessions:"https://sessions.bugsnag.com"}:{notify:null,sessions:null}},message:"should be an object containing endpoint URLs { notify, sessions }",validate:function(e){return e&&"object"==typeof e&&f(e.notify)&&f(e.sessions)&&0===h(a(e),function(e){return!p(["notify","sessions"],e)}).length}},autoTrackSessions:{defaultValue:function(e){return!0},message:"should be true|false",validate:function(e){return!0===e||!1===e}},enabledReleaseStages:{defaultValue:function(){return null},message:"should be an array of strings",validate:function(e){return null===e||i(e)&&h(e,function(e){return"string"==typeof e}).length===e.length}},releaseStage:{defaultValue:function(){return"production"},message:"should be a string",validate:function(e){return"string"==typeof e&&e.length}},maxBreadcrumbs:{defaultValue:function(){return 25},message:"should be a number ≤100",validate:function(e){return t(0,100)(e)}},enabledBreadcrumbTypes:{defaultValue:function(){return r},message:"should be null or a list of available breadcrumb types ("+r.join(",")+")",validate:function(e){return null===e||i(e)&&g(e,function(e,t){return!1===e?e:p(r,t)},!0)}},context:{defaultValue:function(){return undefined},message:"should be a string",validate:function(e){return e===undefined||"string"==typeof e}},user:{defaultValue:function(){return{}},message:"should be an object with { id, email, name } properties",validate:function(e){return null===e||e&&g(a(e),function(e,t){return e&&p(["id","email","name"],t)},!0)}},metadata:{defaultValue:function(){return{}},message:"should be an object",validate:function(e){return"object"==typeof e&&null!==e}},logger:{defaultValue:function(){return undefined},message:"should be null or an object with methods { debug, info, warn, error }",validate:function(n){return!n||g(["debug","info","warn","error"],function(e,t){return e&&"function"==typeof n[t]},!0)}},redactedKeys:{defaultValue:function(){return["password"]},message:"should be an array of strings|regexes",validate:function(e){return i(e)&&e.length===h(e,function(e){return"string"==typeof e||e&&"function"==typeof e.test}).length}},plugins:{defaultValue:function(){return[]},message:"should be an array of plugin objects",validate:function(e){return i(e)&&e.length===h(e,function(e){return e&&"object"==typeof e&&"function"==typeof e.load}).length}},featureFlags:{defaultValue:function(){return[]},message:'should be an array of objects that have a "name" property',validate:function(e){return i(e)&&e.length===h(e,function(e){return e&&"object"==typeof e&&"string"==typeof e.name}).length}}},function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}),m=function(e,o){return g(e,function(e,t,n,r){return e.concat(o(t,n,r))},[])};function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var o=v.schema,o={releaseStage:u({},o.releaseStage,{defaultValue:function(){return/^localhost(:\d+)?$/.test(window.location.host)?"development":"production"}}),appType:b({},o.appType,{defaultValue:function(){return"browser"}}),logger:u({},o.logger,{defaultValue:function(){return"undefined"!=typeof console&&"function"==typeof console.debug?_():undefined}})},_=function(){var n={},r=console.log;return m(["debug","info","warn","error"],function(e){var t=console[e];n[e]=("function"==typeof t?t:r).bind(console,"[bugsnag]")}),n},S=function(){function e(e,t,n,r){void 0===r&&(r=new Date),this.type=n,this.message=e,this.metadata=t,this.timestamp=r}return e.prototype.toJSON=function(){return{type:this.type,name:this.message,timestamp:this.timestamp,metaData:this.metadata}},e}(),w={},E=(!function(e,t){"use strict";"object"==typeof w?w=t():e.StackFrame=t()}(this,function(){"use strict";function n(e){return!isNaN(parseFloat(e))&&isFinite(e)}function r(e){return e.charAt(0).toUpperCase()+e.substring(1)}function l(e){return function(){return this[e]}}var e=["isConstructor","isEval","isNative","isToplevel"],t=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=e.concat(t,o,["args"]);function i(e){if(e instanceof Object)for(var t=0;t<a.length;t++)e.hasOwnProperty(a[t])&&e[a[t]]!==undefined&&this["set"+r(a[t])](e[a[t]])}i.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof i)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new i(e)}},toString:function(){return(this.getFunctionName()||"{anonymous}")+("("+(this.getArgs()||[]).join(",")+")")+(this.getFileName()?"@"+this.getFileName():"")+(n(this.getLineNumber())?":"+this.getLineNumber():"")+(n(this.getColumnNumber())?":"+this.getColumnNumber():"")}};for(var s=0;s<e.length;s++)i.prototype["get"+r(e[s])]=l(e[s]),i.prototype["set"+r(e[s])]=function(t){return function(e){this[t]=Boolean(e)}}(e[s]);for(var u=0;u<t.length;u++)i.prototype["get"+r(t[u])]=l(t[u]),i.prototype["set"+r(t[u])]=function(t){return function(e){if(!n(e))throw new TypeError(t+" must be a Number");this[t]=Number(e)}}(t[u]);for(var c=0;c<o.length;c++)i.prototype["get"+r(o[c])]=l(o[c]),i.prototype["set"+r(o[c])]=function(t){return function(e){this[t]=String(e)}}(o[c]);return i}),{}),O=(!function(e,t){"use strict";"object"==typeof E?E=t(w):e.ErrorStackParser=t(e.StackFrame)}(this,function(s){"use strict";var t=/(^|@)\S+\:\d+/,n=/^\s*at .*(\S+\:\d+|\(native\))/m,r=/^(eval@)?(\[native code\])?$/;return{parse:function(e){if("undefined"!=typeof e.stacktrace||"undefined"!=typeof e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(n))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(e.replace(/[\(\)]/g,""));return[e[1],e[2]||undefined,e[3]||undefined]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(n)},this).map(function(e){var t=(e=-1<e.indexOf("(eval ")?e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""):e).replace(/^\s+/,"").replace(/\(eval code/g,"("),n=t.match(/ (\((.+):(\d+):(\d+)\)$)/),t=(t=n?t.replace(n[0],""):t).split(/\s+/).slice(1),n=this.extractLocation(n?n[1]:t.pop()),t=t.join(" ")||undefined,r=-1<["eval","<anonymous>"].indexOf(n[0])?undefined:n[0];return new s({functionName:t,fileName:r,lineNumber:n[1],columnNumber:n[2],source:e})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(r)},this).map(function(e){var t,n;return-1===(e=-1<e.indexOf(" > eval")?e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1"):e).indexOf("@")&&-1===e.indexOf(":")?new s({functionName:e}):(t=(t=e.match(n=/((.*".+"[^@]*)?[^@]*)(?:@)/))&&t[1]?t[1]:undefined,n=this.extractLocation(e.replace(n,"")),new s({functionName:t,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:e}))},this)},parseOpera:function(e){return!e.stacktrace||-1<e.message.indexOf("\n")&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[],o=2,a=n.length;o<a;o+=2){var i=t.exec(n[o]);i&&r.push(new s({fileName:i[2],lineNumber:i[1],source:n[o]}))}return r},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),r=[],o=0,a=n.length;o<a;o+=2){var i=t.exec(n[o]);i&&r.push(new s({functionName:i[3]||undefined,fileName:i[2],lineNumber:i[1],source:n[o]}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(e){var t,n=e.split("@"),r=this.extractLocation(n.pop()),n=n.shift()||"",o=n.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||undefined,n=(t=n.match(/\(([^\)]*)\)/)?n.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"):t)===undefined||"[arguments not available]"===t?undefined:t.split(",");return new s({functionName:o,args:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e})},this)}}}),E),j=function(e,t,n,r){var o=r&&r.redactedKeys?r.redactedKeys:[],r=r&&r.redactedPaths?r.redactedPaths:[];return JSON.stringify(B(e,o,r),t,n)},N=20,x=25e3,k=8,L="...";function R(e){return"[Throws: "+(e?e.message:"?")+"]"}function T(e,t){try{return e[t]}catch(n){return R(n)}}function B(e,d,f){var g=[],h=0;return function p(e,t){function n(){return t.length>k&&x<h}if(h++,t.length>N)return L;if(n())return L;if(null===e||"object"!=typeof e)return e;if(function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return 1}(g,e))return"[Circular]";if(g.push(e),"function"==typeof e.toJSON)try{h--;var r=p(e.toJSON(),t);return g.pop(),r}catch(u){return R(u)}if((r=e)instanceof Error||/^\[object (Error|(Dom)?Exception)\]$/.test(Object.prototype.toString.call(r)))return h--,r=p({name:e.name,message:e.message},t),g.pop(),r;if("[object Array]"===Object.prototype.toString.call(e)){for(var o=[],a=0,l=e.length;a<l;a++){if(n()){o.push(L);break}o.push(p(e[a],t.concat("[]")))}return g.pop(),o}var i={};try{for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(function(e,t){for(var n=0,r=e.length;n<r;n++)if(0===t.indexOf(e[n]))return 1}(f,t.join("."))&&function(e,t){for(var n=0,r=e.length;n<r;n++){if("string"==typeof e[n]&&e[n].toLowerCase()===t.toLowerCase())return 1;if(e[n]&&"function"==typeof e[n].test&&e[n].test(t))return 1}}(d,s))i[s]="[REDACTED]";else{if(n()){i[s]=L;break}i[s]=p(T(e,s),t.concat(s))}}catch(c){}return g.pop(),i}(e,[])}function M(e,t,n,r){var o;"string"==typeof n&&(r===undefined?r=null:null!==r&&"string"!=typeof r&&(r=j(r)),"number"!=typeof(o=t[n])?(e.push({name:n,variant:r}),t[n]=e.length-1):e[o]={name:n,variant:r})}var q={add:M,clear:function(e,t,n){var r=t[n];"number"==typeof r&&(e[r]=null,delete t[n])},merge:function(e,t,n){if(i(t)){for(var r=0;r<t.length;++r){var o=t[r];null!==o&&"object"==typeof o&&M(e,n,o.name,o.variant)}return e}},toEventApi:function(e){return m(h(e,Boolean),function(e){var t=e.name,e=e.variant,t={featureFlag:t};return"string"==typeof e&&(t.variant=e),t})}},I=function(e){return!(!e||!e.stack&&!e.stacktrace&&!e["opera#sourceloc"]||"string"!=typeof(e.stack||e.stacktrace||e["opera#sourceloc"])||e.stack===e.name+": "+e.message)};var D=function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}},A=function(e,t,n){"string"==typeof t&&(n?e[t]&&delete e[t][n]:delete e[t])},C=function(e,t,n,r){var o,a;if(t){if(null===n)return A(e,t);"object"==typeof n&&(a=n),"string"==typeof n&&((o={})[n]=r,a=o),a&&(e[t]||(e[t]={}),e[t]=u({},e[t],a))}},F=function(e,t,n){return"string"!=typeof t?undefined:n?e[t]?e[t][n]:undefined:e[t]},P=A,V={},l=(!function(e,t){"use strict";"object"==typeof V?V=t(w):e.StackGenerator=t(e.StackFrame)}(this,function(s){return{backtrace:function(e){for(var t=[],n=10,r=("object"==typeof e&&"number"==typeof e.maxStackSize&&(n=e.maxStackSize),arguments.callee);r&&t.length<n&&r.arguments;){for(var o=new Array(r.arguments.length),a=0;a<o.length;++a)o[a]=r.arguments[a];/function(?:\s+([\w$]+))+\s*\(/.test(r.toString())?t.push(new s({functionName:RegExp.$1||undefined,args:o})):t.push(new s({args:o}));try{r=r.caller}catch(i){break}}return t}}}),function(){function a(e,t,n,r,o){void 0===n&&(n=[]),void 0===r&&(r=$()),this.apiKey=undefined,this.context=undefined,this.groupingHash=undefined,this.originalError=o,this._handledState=r,this.severity=this._handledState.severity,this.unhandled=this._handledState.unhandled,this.app={},this.device={},this.request={},this.breadcrumbs=[],this.threads=[],this._metadata={},this._features=[],this._featuresIndex={},this._user={},this._session=undefined,this.errors=[X(e,t,a.__type,n)]}var e=a.prototype;return e.addMetadata=function(e,t,n){return C(this._metadata,e,t,n)},e.getMetadata=function(e,t){return F(this._metadata,e,t)},e.clearMetadata=function(e,t){return P(this._metadata,e,t)},e.addFeatureFlag=function(e,t){q.add(this._features,this._featuresIndex,e,t=void 0===t?null:t)},e.addFeatureFlags=function(e){q.merge(this._features,e,this._featuresIndex)},e.getFeatureFlags=function(){return q.toEventApi(this._features)},e.clearFeatureFlag=function(e){q.clear(this._features,this._featuresIndex,e)},e.clearFeatureFlags=function(){this._features=[],this._featuresIndex={}},e.getUser=function(){return this._user},e.setUser=function(e,t,n){this._user={id:e,email:t,name:n}},e.toJSON=function(){return{payloadVersion:"4",exceptions:m(this.errors,function(e){return u({},e,{message:e.errorMessage})}),severity:this.severity,unhandled:this._handledState.unhandled,severityReason:this._handledState.severityReason,app:this.app,device:this.device,request:this.request,breadcrumbs:this.breadcrumbs,context:this.context,groupingHash:this.groupingHash,metaData:this._metadata,user:this._user,session:this._session,featureFlags:this.getFeatureFlags()}},a}()),H=function(e){e={file:e.fileName,method:K(e.functionName),lineNumber:e.lineNumber,columnNumber:e.columnNumber,code:undefined,inProject:undefined};return-1<e.lineNumber&&!e.file&&!e.method&&(e.file="global code"),e},K=function(e){return/^global code$/i.test(e)?"global code":e},$=function(){return{unhandled:!1,severity:"warning",severityReason:{type:"handledException"}}},U=function(e){return"string"==typeof e?e:""};function X(e,t,n,r){return{errorClass:U(e),errorMessage:U(t),type:n,stacktrace:g(r,function(e,t){t=H(t);try{return"{}"===JSON.stringify(t)?e:e.concat(t)}catch(n){return e}},[])}}l.getStacktrace=function(e,t,n){if(I(e))return O.parse(e).slice(t);try{return h(V.backtrace(),function(e){return-1===(e.functionName||"").indexOf("StackGenerator$$")}).slice(1+n)}catch(r){return[]}},l.create=function(e,t,n,r,o,a){void 0===o&&(o=0);var t=z(e,t,r,a),a=t[0],t=t[1];try{var i=l.getStacktrace(a,0<t?1+t+o:0,1+o),s=new l(a.name,a.message,i,n,e)}catch(u){s=new l(a.name,a.message,[],n,e)}return"InvalidError"===a.name&&s.addMetadata(""+r,"non-error parameter",W(e)),a.cause&&(t=function c(e){return e.cause?[e].concat(c(e.cause)):[e]}(a).slice(1),o=m(t,function(e){var t=D(e)&&I(e)?O.parse(e):[],n=z(e,!0,"error cause")[0];return"InvalidError"===n.name&&s.addMetadata("error cause",W(e)),X(n.name,n.message,l.__type,t)}),(i=s.errors).push.apply(i,o)),s};var J,W=function(e){return null===e?"null":e===undefined?"undefined":e},z=function(e,t,n,r){var o,a=0,i=function(e){var t="error cause"===n?"was":"received",e=(r&&r.warn(n+" "+t+' a non-error: "'+e+'"'),new Error(n+" "+t+' a non-error. See "'+n+'" tab for more detail.'));return e.name="InvalidError",e};if(t)switch(typeof e){case"string":case"number":case"boolean":o=new Error(String(e)),a+=1;break;case"function":o=i("function"),a+=2;break;case"object":null!==e&&D(e)?o=e:null!==e&&G(e)?((o=new Error(e.message||e.errorMessage)).name=e.name||e.errorClass,a+=1):(o=i(null===e?"null":"unsupported object"),a+=2);break;default:o=i("nothing"),a+=2}else D(e)?o=e:(o=i(typeof e),a+=2);if(!I(o))try{throw o}catch(s){I(s)&&(o=s,a=1)}return[o,a]},G=(l.__type="browserjs",function(e){return!("string"!=typeof e.name&&"string"!=typeof e.errorClass||"string"!=typeof e.message&&"string"!=typeof e.errorMessage)}),Q=l,Y=function(e,t,n){var r=0,o=function(){if(r>=e.length)return n(null,!0);t(e[r],function(e,t){return e?n(e):!1===t?n(null,!1):(r++,void o())})};o()},Z=function(e,o,a,t){Y(e,function(e,n){if("function"!=typeof e)return n(null);try{var t;if(2!==e.length)return(t=e(o))&&"function"==typeof t.then?t.then(function(e){return setTimeout(function(){return n(null,e)})},function(e){setTimeout(function(){return a(e),n(null,!0)})}):n(null,t);e(o,function(e,t){if(e)return a(e),n(null);n(null,t)})}catch(r){a(r),n(null)}},t)},ee=function(e,t,n,r){for(var o=!1,a=e.slice();!o&&a.length;)try{o=!1===a.pop()(t)}catch(i){r.error("Error occurred in "+n+" callback, continuing anyway…"),r.error(i)}return o},te=function(e,t){e="000000000"+e;return e.substr(e.length-t)},ne="object"==typeof window?window:self,re=0;for(J in ne)Object.hasOwnProperty.call(ne,J)&&re++;var e=navigator.mimeTypes?navigator.mimeTypes.length:0,oe=te((e+navigator.userAgent.length).toString(36)+re.toString(36),4),ae=function(){return oe},ie=0,se=4,ue=36,ce=Math.pow(ue,se);function le(){return te((Math.random()*ce<<0).toString(ue),se)}function de(){return"c"+(new Date).getTime().toString(ue)+te((ie=ie<ce?ie:0,(++ie-1).toString(ue)),se)+ae()+(le()+le())}de.fingerprint=ae;var fe,ge,he=de,pe=function(){function e(){this.id=he(),this.startedAt=new Date,this._handled=0,this._unhandled=0,this._user={},this.app={},this.device={}}var t=e.prototype;return t.getUser=function(){return this._user},t.setUser=function(e,t,n){this._user={id:e,email:t,name:n}},t.toJSON=function(){return{id:this.id,startedAt:this.startedAt,events:{handled:this._handled,unhandled:this._unhandled}}},t._track=function(e){this[e._handledState.unhandled?"_unhandled":"_handled"]+=1},e}(),me=q.add,ve=q.clear,ye=q.merge,c=function(){},be=function(t,n){return new Error("Invalid configuration\n"+m(a(t),function(e){return" - "+e+" "+t[e]+", got "+_e(n[e])}).join("\n\n"))},_e=function(e){switch(typeof e){case"string":case"number":case"object":return JSON.stringify(e);default:return String(e)}},Se=function(){function s(e,t,n,r){var o=this,a=(void 0===t&&(t=v.schema),void 0===n&&(n=[]),this._notifier=r,this._config={},this._schema=t,this._delivery={sendSession:c,sendEvent:c},this._logger={debug:c,info:c,warn:c,error:c},this._plugins={},this._breadcrumbs=[],this._session=null,this._metadata={},this._featuresIndex={},this._features=[],this._context=undefined,this._user={},this._cbs={e:[],s:[],sp:[],b:[]},this.Client=s,this.Event=Q,this.Breadcrumb=S,this.Session=pe,this._config=this._configure(e,n),m(n.concat(this._config.plugins),function(e){e&&o._loadPlugin(e)}),this._depth=1,this),i=this.notify;this.notify=function(){return i.apply(a,arguments)}}var e=s.prototype;return e.addMetadata=function(e,t,n){return C(this._metadata,e,t,n)},e.getMetadata=function(e,t){return F(this._metadata,e,t)},e.clearMetadata=function(e,t){return P(this._metadata,e,t)},e.addFeatureFlag=function(e,t){me(this._features,this._featuresIndex,e,t=void 0===t?null:t)},e.addFeatureFlags=function(e){ye(this._features,e,this._featuresIndex)},e.clearFeatureFlag=function(e){ve(this._features,this._featuresIndex,e)},e.clearFeatureFlags=function(){this._features=[],this._featuresIndex={}},e.getContext=function(){return this._context},e.setContext=function(e){this._context=e},e._configure=function(r,e){var o=g(e,function(e,t){return t&&t.configSchema?u({},e,t.configSchema):e},this._schema),e=g(a(o),function(e,t){var n=o[t].defaultValue(r[t]);return r[t]!==undefined?o[t].validate(r[t])?o[t].allowPartialObject?e.config[t]=u(n,r[t]):e.config[t]=r[t]:(e.errors[t]=o[t].message,e.config[t]=n):e.config[t]=n,e},{errors:{},config:{}}),t=e.errors,e=e.config;if(o.apiKey){if(!e.apiKey)throw new Error("No Bugsnag API Key set");/^[0-9a-f]{32}$/i.test(e.apiKey)||(t.apiKey="should be a string of 32 hexadecimal characters")}return this._metadata=u({},e.metadata),ye(this._features,e.featureFlags,this._featuresIndex),this._user=u({},e.user),this._context=e.context,e.logger&&(this._logger=e.logger),e.onError&&(this._cbs.e=this._cbs.e.concat(e.onError)),e.onBreadcrumb&&(this._cbs.b=this._cbs.b.concat(e.onBreadcrumb)),e.onSession&&(this._cbs.s=this._cbs.s.concat(e.onSession)),a(t).length&&this._logger.warn(be(t,r)),e},e.getUser=function(){return this._user},e.setUser=function(e,t,n){this._user={id:e,email:t,name:n}},e._loadPlugin=function(e){var t=e.load(this);return e.name&&(this._plugins["~"+e.name+"~"]=t),this},e.getPlugin=function(e){return this._plugins["~"+e+"~"]},e._setDelivery=function(e){this._delivery=e(this)},e.startSession=function(){var e=new pe;return e.app.releaseStage=this._config.releaseStage,e.app.version=this._config.appVersion,e.app.type=this._config.appType,e._user=u({},this._user),ee(this._cbs.s,e,"onSession",this._logger)?(this._logger.debug("Session not started due to onSession callback"),this):this._sessionDelegate.startSession(this,e)},e.addOnError=function(e,t){this._cbs.e[(t=void 0===t?!1:t)?"unshift":"push"](e)},e.removeOnError=function(t){this._cbs.e=h(this._cbs.e,function(e){return e!==t})},e._addOnSessionPayload=function(e){this._cbs.sp.push(e)},e.addOnSession=function(e){this._cbs.s.push(e)},e.removeOnSession=function(t){this._cbs.s=h(this._cbs.s,function(e){return e!==t})},e.addOnBreadcrumb=function(e,t){this._cbs.b[(t=void 0===t?!1:t)?"unshift":"push"](e)},e.removeOnBreadcrumb=function(t){this._cbs.b=h(this._cbs.b,function(e){return e!==t})},e.pauseSession=function(){return this._sessionDelegate.pauseSession(this)},e.resumeSession=function(){return this._sessionDelegate.resumeSession(this)},e.leaveBreadcrumb=function(e,t,n){e="string"==typeof e?e:"",n="string"==typeof n&&p(r,n)?n:"manual",t="object"==typeof t&&null!==t?t:{},e&&(e=new S(e,t,n),ee(this._cbs.b,e,"onBreadcrumb",this._logger)?this._logger.debug("Breadcrumb not attached due to onBreadcrumb callback"):(this._breadcrumbs.push(e),this._breadcrumbs.length>this._config.maxBreadcrumbs&&(this._breadcrumbs=this._breadcrumbs.slice(this._breadcrumbs.length-this._config.maxBreadcrumbs))))},e._isBreadcrumbTypeEnabled=function(e){var t=this._config.enabledBreadcrumbTypes;return null===t||p(t,e)},e.notify=function(e,t,n){void 0===n&&(n=c);e=Q.create(e,!0,undefined,"notify()",this._depth+1,this._logger);this._notify(e,t,n)},e._notify=function(n,e,r){var o=this;if(void 0===r&&(r=c),n.app=u({},n.app,{releaseStage:this._config.releaseStage,version:this._config.appVersion,type:this._config.appType}),n.context=n.context||this._context,n._metadata=u({},n._metadata,this._metadata),n._user=u({},n._user,this._user),n.breadcrumbs=this._breadcrumbs.slice(),ye(n._features,this._features,n._featuresIndex),null!==this._config.enabledReleaseStages&&!p(this._config.enabledReleaseStages,this._config.releaseStage))return this._logger.warn("Event not sent due to releaseStage/enabledReleaseStages configuration"),r(null,n);var a=n.severity,i=function(e){o._logger.error("Error occurred in onError callback, continuing anyway…"),o._logger.error(e)},e=[].concat(this._cbs.e).concat(e);Z(e,n,i,function(e,t){if(e&&i(e),!t)return o._logger.debug("Event not sent due to onError callback"),r(null,n);o._isBreadcrumbTypeEnabled("error")&&s.prototype.leaveBreadcrumb.call(o,n.errors[0].errorClass,{errorClass:n.errors[0].errorClass,errorMessage:n.errors[0].errorMessage,severity:n.severity},"error"),a!==n.severity&&(n._handledState.severityReason={type:"userCallbackSetSeverity"}),n.unhandled!==n._handledState.unhandled&&(n._handledState.severityReason.unhandledOverridden=!0,n._handledState.unhandled=n.unhandled),o._session&&(o._session._track(n),n._session=o._session),o._delivery.sendEvent({apiKey:n.apiKey||o._config.apiKey,notifier:o._notifier,events:[n]},function(e){return r(e,n)})})},s}(),we={},Ee=["events.[].metaData","events.[].breadcrumbs.[].metaData","events.[].request"],Oe=(we.event=function(e,t){var n=j(e,null,null,{redactedPaths:Ee,redactedKeys:t});return 1e6<n.length&&(e.events[0]._metadata={notifier:"WARNING!\nSerialized payload was "+n.length/1e6+"MB (limit = 1MB)\nmetadata was removed"},n=j(e,null,null,{redactedPaths:Ee,redactedKeys:t})),n},we.session=function(e,t){return j(e,null,null)},function(e,t,n,r){var o=JSON.parse(JSON.stringify(new Date));return je(e.endpoints[t],r.location.protocol)+"?apiKey="+encodeURIComponent(e.apiKey)+"&payloadVersion="+n+"&sentAt="+encodeURIComponent(o)}),je=(fe=function(a,i){return void 0===i&&(i=window),{sendEvent:function(e,t){if(void 0===t&&(t=function(){}),null===a._config.endpoints.notify)return n=new Error("Event not sent due to incomplete endpoint configuration"),t(n);var n=Oe(a._config,"notify","4",i),r=we.event(e,a._config.redactedKeys),o=new i.XDomainRequest;o.onload=function(){t(null)},o.onerror=function(){var e=new Error("Event failed to send");a._logger.error("Event failed to send…",e),1e6<r.length&&a._logger.warn("Event oversized ("+(r.length/1e6).toFixed(2)+" MB)"),t(e)},o.open("POST",n),setTimeout(function(){try{o.send(r)}catch(e){a._logger.error(e),t(e)}},0)},sendSession:function(t,n){if(void 0===n&&(n=function(){}),null===a._config.endpoints.sessions)return e=new Error("Session not sent due to incomplete endpoint configuration"),n(e);var e=Oe(a._config,"sessions","1",i),r=new i.XDomainRequest;r.onload=function(){n(null)},r.open("POST",e),setTimeout(function(){try{r.send(we.session(t,a._config.redactedKeys))}catch(e){a._logger.error(e),n(e)}},0)}}})._matchPageProtocol=function(e,t){return"http:"===t?e.replace(/^https:/,"http:"):e},Ne=function(s,u){return void 0===u&&(u=window),{sendEvent:function(e,t){void 0===t&&(t=function(){});try{var n,r=s._config.endpoints.notify;if(null===r)return n=new Error("Event not sent due to incomplete endpoint configuration"),t(n);var o=new u.XMLHttpRequest,a=we.event(e,s._config.redactedKeys);o.onreadystatechange=function(){var e;o.readyState===u.XMLHttpRequest.DONE&&(0===(e=o.status)||400<=e?(e=new Error("Request failed with status "+e),s._logger.error("Event failed to send…",e),1e6<a.length&&s._logger.warn("Event oversized ("+(a.length/1e6).toFixed(2)+" MB)"),t(e)):t(null))},o.open("POST",r),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Bugsnag-Api-Key",e.apiKey||s._config.apiKey),o.setRequestHeader("Bugsnag-Payload-Version","4"),o.setRequestHeader("Bugsnag-Sent-At",(new Date).toISOString()),o.send(a)}catch(i){s._logger.error(i)}},sendSession:function(e,t){void 0===t&&(t=function(){});try{var n,r=s._config.endpoints.sessions;if(null===r)return n=new Error("Session not sent due to incomplete endpoint configuration"),t(n);var o=new u.XMLHttpRequest;o.onreadystatechange=function(){var e;o.readyState===u.XMLHttpRequest.DONE&&(0===(e=o.status)||400<=e?(e=new Error("Request failed with status "+e),s._logger.error("Session failed to send…",e),t(e)):t(null))},o.open("POST",r),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Bugsnag-Api-Key",s._config.apiKey),o.setRequestHeader("Bugsnag-Payload-Version","1"),o.setRequestHeader("Bugsnag-Sent-At",(new Date).toISOString()),o.send(we.session(e,s._config.redactedKeys))}catch(a){s._logger.error(a)}}}},xe=new Date,ke=function(){xe=new Date},Le={name:"appDuration",load:function(e){return e.addOnError(function(e){var t=new Date;e.app.duration=t-xe},!0),{reset:ke}}},Re=function(e,t){e="000000000"+e;return e.substr(e.length-t)},Te="object"==typeof window?window:self,Be=0;for(ge in Te)Object.hasOwnProperty.call(Te,ge)&&Be++;var e=navigator.mimeTypes?navigator.mimeTypes.length:0,Me=Re((e+navigator.userAgent.length).toString(36)+Be.toString(36),4),qe=function(){return Me},Ie=0,De=4,Ae=36,Ce=Math.pow(Ae,De);function Fe(){return Re((Math.random()*Ce<<0).toString(Ae),De)}function Pe(){return"c"+(new Date).getTime().toString(Ae)+Re((Ie=Ie<Ce?Ie:0,(++Ie-1).toString(Ae)),De)+qe()+(Fe()+Fe())}Pe.fingerprint=qe;var Ve=Pe,He="bugsnag-anonymous-id",Ke=function(e){try{var t=e.localStorage,n=t.getItem(He);return n&&/^c[a-z0-9]{20,32}$/.test(n)?n:(n=Ve(),t.setItem(He,n),n)}catch(r){}},$e=function(e){var t=e.getUser();t&&t.id||e.setUser(e.device.id)},Ue={load:function(e){e._sessionDelegate=Xe}},Xe={startSession:function(e,t){return e._session=t,(e._pausedSession=null)===e._config.enabledReleaseStages||p(e._config.enabledReleaseStages,e._config.releaseStage)?e._delivery.sendSession({notifier:e._notifier,device:t.device,app:t.app,sessions:[{id:t.id,startedAt:t.startedAt,user:t._user}]}):e._logger.warn("Session not sent due to releaseStage/enabledReleaseStages configuration"),e},resumeSession:function(e){return e._session?e:e._pausedSession?(e._session=e._pausedSession,e._pausedSession=null,e):e.startSession()},pauseSession:function(e){e._pausedSession=e._session,e._session=null}},Je={load:function(e){e._config.collectUserIp||e.addOnError(function(e){e._user&&"undefined"==typeof e._user.id&&delete e._user.id,e._user=u({id:"[REDACTED]"},e._user),e.request=u({clientIp:"[REDACTED]"},e.request)})},configSchema:{collectUserIp:{defaultValue:function(){return!0},message:"should be true|false",validate:function(e){return!0===e||!1===e}}}},We={load:function(a){!/^(local-)?dev(elopment)?$/.test(a._config.releaseStage)&&a._isBreadcrumbTypeEnabled("log")&&m(ze,function(r){var o=console[r];console[r]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];a.leaveBreadcrumb("Console output",g(t,function(e,t,n){var r="[Unknown value]";try{r=String(t)}catch(o){}if("[object Object]"===r)try{r=JSON.stringify(t)}catch(o){}return e["["+n+"]"]=r,e},{severity:0===r.indexOf("group")?"log":r}),"log"),o.apply(console,t)},console[r]._restore=function(){console[r]=o}})}},ze=h(["log","debug","info","warn","error"],function(e){return"undefined"!=typeof console&&"function"==typeof console[e]}),Ge=200,Qe=5e5,Ye=function(d,f){return void 0===d&&(d=document),void 0===f&&(f=window),{load:function(e){var o,a,i,s,t,n,u,c,l;function r(a,i,s){return void 0===s&&(s=!1),function(){var e=[].slice.call(arguments);try{var t,n=i(e),r=n.get();if(s&&a.apply(this,e),"function"!=typeof r)return a.apply(this,e);r.__trace__||(t=c(),r.__trace__=function(){u(t),l(function(){u(null)},0);var e=r.apply(this,arguments);return u(null),e},r.__trace__.__trace__=r.__trace__),n.replace(r.__trace__)}catch(o){}if(a.apply)return a.apply(this,e);switch(e.length){case 1:return a(e[0]);case 2:return a(e[0],e[1]);default:return a()}}}e._config.trackInlineScripts&&(o=f.location.href,s="",a=!!d.attachEvent?"complete"===d.readyState:"loading"!==d.readyState,s=(i=function(){return d.documentElement.outerHTML})(),t=d.onreadystatechange,d.onreadystatechange=function(){"interactive"===d.readyState&&(s=i(),a=!0);try{t.apply(this,arguments)}catch(e){}},n=null,u=function(e){n=e},c=function(){var e,t=d.currentScript||n;return t=t||a?t:(e=d.scripts||d.getElementsByTagName("script"))[e.length-1]},e.addOnError(function(e){e.errors[0].stacktrace=h(e.errors[0].stacktrace,function(e){return!/__trace__$/.test(e.method)});var r,t=e.errors[0].stacktrace[0],n=function(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"")};t&&t.file&&n(t.file)!==n(o)||(n=c())&&(n=n.innerHTML,e.addMetadata("script","content",n.length<=Qe?n:n.substr(0,Qe)),t&&t.lineNumber&&(t.code=(n=t.lineNumber,a&&s||(s=i()),e=["\x3c!-- DOC START --\x3e"].concat(s.split("\n")),n-=1,r=Math.max(n-3,0),n=Math.min(3+n,e.length),g(e.slice(r,n),function(e,t,n){return e[r+1+n]=t.length<=Ge?t:t.substr(0,Ge),e},{}))))},!0),l=m(["setTimeout","setInterval","setImmediate","requestAnimationFrame"],function(e){return Ze(f,e,function(e){return r(e,function(t){return{get:function(){return t[0]},replace:function(e){t[0]=e}}})})})[0],m(["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],function(e){f[e]&&f[e].prototype&&Object.prototype.hasOwnProperty.call(f[e].prototype,"addEventListener")&&(Ze(f[e].prototype,"addEventListener",function(e){return r(e,et)}),Ze(f[e].prototype,"removeEventListener",function(e){return r(e,et,!0)}))}))},configSchema:{trackInlineScripts:{validate:function(e){return!0===e||!1===e},defaultValue:function(){return!0},message:"should be true|false"}}}};function Ze(e,t,n){var r=e[t];if(!r)return r;n=n(r);return e[t]=n,r}function et(t){var n=!!t[1]&&"function"==typeof t[1].handleEvent;return{get:function(){return n?t[1].handleEvent:t[1]},replace:function(e){n?t[1].handleEvent=e:t[1]=e}}}var tt=function(i){return void 0===i&&(i=window),{load:function(o){"addEventListener"in i&&o._isBreadcrumbTypeEnabled("user")&&i.addEventListener("click",function(e){var t,n;try{t=function(e){var t=e.textContent||e.innerText||"";t||"submit"!==e.type&&"button"!==e.type||(t=e.value);if(140<(t=t.replace(nt,"").replace(rt,"$1")).length)return t.slice(0,135)+"(...)";return t}(e.target),n=function a(e,t){var n=[e.tagName];e.id&&n.push("#"+e.id);e.className&&e.className.length&&n.push("."+e.className.split(" ").join("."));if(!t.document.querySelectorAll||!Array.prototype.indexOf)return n.join("");try{if(1===t.document.querySelectorAll(n.join("")).length)return n.join("")}catch(o){return n.join("")}{var r;1<e.parentNode.childNodes.length&&(r=Array.prototype.indexOf.call(e.parentNode.childNodes,e)+1,n.push(":nth-child("+r+")"))}if(1===t.document.querySelectorAll(n.join("")).length)return n.join("");if(e.parentNode)return a(e.parentNode,t)+" > "+n.join("");return n.join("")}(e.target,i)}catch(r){n=t="[hidden]",o._logger.error("Cross domain error when tracking click event. See docs: https://tinyurl.com/yy3rn63z")}o.leaveBreadcrumb("UI click",{targetText:t,targetSelector:n},"user")},!0)}}},nt=/^\s+/,rt=/(^|[^\s])\s+$/;var ot=function(n){void 0===n&&(n=window);var e={load:function(t){var e;"addEventListener"in n&&t._isBreadcrumbTypeEnabled("navigation")&&(n.addEventListener("pagehide",(e=function(e){return function(){return t.leaveBreadcrumb(e,{},"navigation")}})("Page hidden"),!0),n.addEventListener("pageshow",e("Page shown"),!0),n.addEventListener("load",e("Page loaded"),!0),n.document.addEventListener("DOMContentLoaded",e("DOMContentLoaded"),!0),n.addEventListener("load",function(){return n.addEventListener("popstate",e("Navigated back"),!0)}),n.addEventListener("hashchange",function(e){e=e.oldURL?{from:at(e.oldURL,n),to:at(e.newURL,n),state:ut(n)}:{to:at(n.location.href,n)};t.leaveBreadcrumb("Hash changed",e,"navigation")},!0),n.history.pushState&&st(t,n.history,"pushState",n,!0),n.history.replaceState&&st(t,n.history,"replaceState",n))}};return e},at=function(e,t){t=t.document.createElement("A");return t.href=e,""+t.pathname+t.search+t.hash},it=function(e,t,n,r){var o=at(e.location.href,e);return{title:n,state:t,prevState:ut(e),to:r||o,from:o}},st=function(r,o,a,i,s){void 0===s&&(s=!1);var u=o[a];o[a]=function(e,t,n){r.leaveBreadcrumb("History "+a,it(i,e,t,n),"navigation"),s&&"function"==typeof r.resetEventCount&&r.resetEventCount(),u.apply(o,[e,t].concat(n!==undefined?n:[]))}},ut=function(e){try{return e.history.state}catch(t){}},ct="request",lt=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=window);var n={load:function(s){var u,r,c,n,l,i,d,f;s._isBreadcrumbTypeEnabled("request")&&(u=[s._config.endpoints.notify,s._config.endpoints.sessions].concat(e),"addEventListener"in t.XMLHttpRequest.prototype&&"WeakMap"in t&&(r=new WeakMap,c=new WeakMap,n=t.XMLHttpRequest.prototype.open,t.XMLHttpRequest.prototype.open=function(e,t){r.set(this,{method:e,url:t}),n.apply(this,arguments)},l=t.XMLHttpRequest.prototype.send,t.XMLHttpRequest.prototype.send=function(e){var o,t,n,a=this,i=r.get(this);i&&((t=c.get(this))&&(this.removeEventListener("load",t.load),this.removeEventListener("error",t.error)),o=new Date,t=function(){var e,t,n;e=i.method,t=i.url,n=dt(o),t!==undefined?"string"==typeof t&&p(u,t.replace(/\?.*$/,""))||s.leaveBreadcrumb("XMLHttpRequest error",{method:String(e),url:String(t),duration:n},ct):s._logger.warn("The request URL is no longer present on this XMLHttpRequest. A breadcrumb cannot be left for this request.")},this.addEventListener("load",n=function(){var e,t,n,r;e=i.method,t=i.url,n=a.status,r=dt(o),t!==undefined?"string"==typeof t&&p(u,t.replace(/\?.*$/,""))||(e={status:n,method:String(e),url:String(t),duration:r},400<=n?s.leaveBreadcrumb("XMLHttpRequest failed",e,ct):s.leaveBreadcrumb("XMLHttpRequest succeeded",e,ct)):s._logger.warn("The request URL is no longer present on this XMLHttpRequest. A breadcrumb cannot be left for this request.")}),this.addEventListener("error",t),c.set(this,{load:n,error:t})),l.apply(this,arguments)}),"fetch"in t&&!t.fetch.polyfill&&(i=t.fetch,t.fetch=function(){var o,e=arguments,t=arguments[0],n=arguments[1],a=null;return t&&"object"==typeof t?(a=t.url,n&&"method"in n?o=n.method:t&&"method"in t&&(o=t.method)):(a=t,n&&"method"in n&&(o=n.method)),o===undefined&&(o="GET"),new Promise(function(t,n){var r=new Date;i.apply(void 0,e).then(function(e){d(e,o,a,dt(r)),t(e)})["catch"](function(e){f(o,a,dt(r)),n(e)})})}),d=function(e,t,n,r){t={method:String(t),status:e.status,url:String(n),duration:r};400<=e.status?s.leaveBreadcrumb("fetch() failed",t,ct):s.leaveBreadcrumb("fetch() succeeded",t,ct)},f=function(e,t,n){s.leaveBreadcrumb("fetch() error",{method:String(e),url:String(t),duration:n},ct)})}};return n},dt=function(e){return e&&new Date-e},ft={load:function(t){var n=0;t.addOnError(function(e){if(n>=t._config.maxEvents)return t._logger.warn("Cancelling event send due to maxEvents per session limit of "+t._config.maxEvents+" being reached"),!1;n++}),t.resetEventCount=function(){n=0}},configSchema:{maxEvents:{defaultValue:function(){return 10},message:"should be a positive integer ≤100",validate:function(e){return t(1,100)(e)}}}},gt={},ht=(gt={load:function(e){e.addOnError(function(e){e=g(e.errors,function(e,t){return e.concat(t.stacktrace)},[]);m(e,function(e){e.file=ht(e.file)})})}})._strip=function(e){return"string"==typeof e?e.replace(/\?.*$/,"").replace(/#.*$/,""):e},pt=function(e,d){return void 0===e&&(e=window),void 0===d&&(d="window onerror"),{load:function(c){var l;c._config.autoDetectErrors&&c._config.enabledErrorTypes.unhandledExceptions&&(l=e.onerror,e.onerror=function(e,t,n,r,o){var a,i,s,u;0===n&&/Script error\.?/.test(e)?c._logger.warn("Ignoring cross-domain or eval script error. See docs: https://tinyurl.com/yy3rn63z"):(a={severity:"error",unhandled:!0,severityReason:{type:"unhandledException"}},o?(u=c.Event.create(o,!0,a,d,1),mt(u.errors[0].stacktrace,t,n,r)):"object"!=typeof e||null===e||t&&"string"==typeof t||n||r||o?(u=c.Event.create(e,!0,a,d,1),mt(u.errors[0].stacktrace,t,n,r)):(i=e.type?"Event: "+e.type:"Error",s=e.message||e.detail||"",(u=c.Event.create({name:i,message:s},!0,a,d,1)).originalError=e,u.addMetadata(d,{event:e,extraParameters:t})),c._notify(u)),"function"==typeof l&&l.apply(this,arguments)})}}},mt=function(e,t,n,r){e[0]||e.push({});e=e[0];e.file||"string"!=typeof t||(e.file=t),!e.lineNumber&&vt(n)&&(e.lineNumber=n),e.columnNumber||(vt(r)?e.columnNumber=r:window.event&&vt(window.event.errorCharacter)&&(e.columnNumber=window.event.errorCharacter))},vt=function(e){return"number"==typeof e&&"NaN"!==String.call(e)},yt=function(t){return function(e){e.file!==t.toString()&&e.method&&(e.method=e.method.replace(/^\s+/,""))}},e={},bt=u({},v.schema,o),n={_client:null,createClient:function(e){e=(e="string"==typeof e?{apiKey:e}:e)||{};var t,n,r,o,a,i=[Le,(void 0===o&&(o=navigator),void 0===a&&(a=window),{load:function(t){var n={locale:o.browserLanguage||o.systemLanguage||o.userLanguage||o.language,userAgent:o.userAgent};a&&a.screen&&a.screen.orientation&&a.screen.orientation.type?n.orientation=a.screen.orientation.type:a&&a.document&&(n.orientation=a.document.documentElement.clientWidth>a.document.documentElement.clientHeight?"landscape":"portrait"),t._config.generateAnonymousId&&(n.id=Ke(a)),t.addOnSession(function(e){e.device=u({},e.device,n),t._config.collectUserIp||$e(e)}),t.addOnError(function(e){e.device=u({},e.device,n,{time:new Date}),t._config.collectUserIp||$e(e)},!0)},configSchema:{generateAnonymousId:{validate:function(e){return!0===e||!1===e},defaultValue:function(){return!0},message:"should be true|false"}}}),(void 0===r&&(r=window),{load:function(e){e.addOnError(function(e){e.context===undefined&&(e.context=r.location.pathname)},!0)}}),(void 0===n&&(n=window),{load:function(e){e.addOnError(function(e){e.request&&e.request.url||(e.request=u({},e.request,{url:n.location.href}))},!0)}}),ft,Ue,Je,gt,pt(),(void 0===t&&(t=window),{load:function(o){var n;o._config.autoDetectErrors&&o._config.enabledErrorTypes.unhandledRejections&&(n=function(e){var t=e.reason,n=!1;try{e.detail&&e.detail.reason&&(t=e.detail.reason,n=!0)}catch(r){}e=o.Event.create(t,!1,{severity:"error",unhandled:!0,severityReason:{type:"unhandledPromiseRejection"}},"unhandledrejection handler",1,o._logger);n&&m(e.errors[0].stacktrace,yt(t)),o._notify(e,function(e){var t;D(e.originalError)&&!e.originalError.stack&&e.addMetadata("unhandledRejection handler",((t={})[Object.prototype.toString.call(e.originalError)]={name:e.originalError.name,message:e.originalError.message,code:e.originalError.code},t))})},"addEventListener"in t?t.addEventListener("unhandledrejection",n):t.onunhandledrejection=function(e,t){n({detail:{reason:e,promise:t}})},0)}}),ot(),tt(),lt(),We,Ye()],e=new Se(e,bt,i,{name:"Bugsnag JavaScript",version:"8.0.0-alpha.2",url:"https://github.com/bugsnag/bugsnag-js"});return e._setDelivery(window.XDomainRequest?fe:Ne),e._logger.debug("Loaded!"),e.leaveBreadcrumb("Bugsnag loaded",{},"state"),e._config.autoTrackSessions?e.startSession():e},start:function(e){return n._client?n._client._logger.warn("Bugsnag.start() was called more than once. Ignoring."):n._client=n.createClient(e),n._client},isStarted:function(){return null!=n._client}};return m(["resetEventCount"].concat(a(Se.prototype)),function(t){/^_/.test(t)||(n[t]=function(){if(!n._client)return console.log("Bugsnag."+t+"() was called before Bugsnag.start()");n._client._depth+=1;var e=n._client[t].apply(n._client,arguments);return--n._client._depth,e})}),(e=n).Client=Se,e.Event=Q,e.Session=pe,e.Breadcrumb=S,e["default"]=n,e});
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Bugsnag=e()}(function(){var r=["navigation","request","process","log","user","state","error","manual"],g=function(e,t,n){for(var r=n,o=0,a=e.length;o<a;o++)r=t(r,e[o],o,e);return r},h=function(e,o){return g(e,function(e,t,n,r){return o(t,n,r)?e.concat(t):e},[])},p=function(e,o){return g(e,function(e,t,n,r){return!0===e||t===o},!1)},i=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=!{toString:null}.propertyIsEnumerable("toString"),d=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(e){var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push(t);if(!s)return n;for(var r=0,o=d.length;r<o;r++)Object.prototype.hasOwnProperty.call(e,d[r])&&n.push(d[r]);return n},t=function(t,n){return void 0===t&&(t=1),void 0===n&&(n=Infinity),function(e){return"number"==typeof e&&parseInt(""+e,10)===e&&t<=e&&e<=n}},o=function(e){return"function"==typeof e||i(e)&&h(e,function(e){return"function"==typeof e}).length===e.length},f=function(e){return"string"==typeof e&&!!e.length},v={},y=function(){return{unhandledExceptions:!0,unhandledRejections:!0}},u=(v.schema={apiKey:{defaultValue:function(){return null},message:"is required",validate:f},appVersion:{defaultValue:function(){return undefined},message:"should be a string",validate:function(e){return e===undefined||f(e)}},appType:{defaultValue:function(){return undefined},message:"should be a string",validate:function(e){return e===undefined||f(e)}},autoDetectErrors:{defaultValue:function(){return!0},message:"should be true|false",validate:function(e){return!0===e||!1===e}},enabledErrorTypes:{defaultValue:y,message:"should be an object containing the flags { unhandledExceptions:true|false, unhandledRejections:true|false }",allowPartialObject:!0,validate:function(t){if("object"!=typeof t||!t)return!1;var e=a(t),n=a(y());return!(h(e,function(e){return p(n,e)}).length<e.length)&&!(0<h(a(t),function(e){return"boolean"!=typeof t[e]}).length)}},onError:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:o},onSession:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:o},onBreadcrumb:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:o},endpoints:{defaultValue:function(e){return void 0===e?{notify:"https://notify.bugsnag.com",sessions:"https://sessions.bugsnag.com"}:{notify:null,sessions:null}},message:"should be an object containing endpoint URLs { notify, sessions }",validate:function(e){return e&&"object"==typeof e&&f(e.notify)&&f(e.sessions)&&0===h(a(e),function(e){return!p(["notify","sessions"],e)}).length}},autoTrackSessions:{defaultValue:function(e){return!0},message:"should be true|false",validate:function(e){return!0===e||!1===e}},enabledReleaseStages:{defaultValue:function(){return null},message:"should be an array of strings",validate:function(e){return null===e||i(e)&&h(e,function(e){return"string"==typeof e}).length===e.length}},releaseStage:{defaultValue:function(){return"production"},message:"should be a string",validate:function(e){return"string"==typeof e&&e.length}},maxBreadcrumbs:{defaultValue:function(){return 25},message:"should be a number ≤100",validate:function(e){return t(0,100)(e)}},enabledBreadcrumbTypes:{defaultValue:function(){return r},message:"should be null or a list of available breadcrumb types ("+r.join(",")+")",validate:function(e){return null===e||i(e)&&g(e,function(e,t){return!1===e?e:p(r,t)},!0)}},context:{defaultValue:function(){return undefined},message:"should be a string",validate:function(e){return e===undefined||"string"==typeof e}},user:{defaultValue:function(){return{}},message:"should be an object with { id, email, name } properties",validate:function(e){return null===e||e&&g(a(e),function(e,t){return e&&p(["id","email","name"],t)},!0)}},metadata:{defaultValue:function(){return{}},message:"should be an object",validate:function(e){return"object"==typeof e&&null!==e}},logger:{defaultValue:function(){return undefined},message:"should be null or an object with methods { debug, info, warn, error }",validate:function(n){return!n||g(["debug","info","warn","error"],function(e,t){return e&&"function"==typeof n[t]},!0)}},redactedKeys:{defaultValue:function(){return["password"]},message:"should be an array of strings|regexes",validate:function(e){return i(e)&&e.length===h(e,function(e){return"string"==typeof e||e&&"function"==typeof e.test}).length}},plugins:{defaultValue:function(){return[]},message:"should be an array of plugin objects",validate:function(e){return i(e)&&e.length===h(e,function(e){return e&&"object"==typeof e&&"function"==typeof e.load}).length}},featureFlags:{defaultValue:function(){return[]},message:'should be an array of objects that have a "name" property',validate:function(e){return i(e)&&e.length===h(e,function(e){return e&&"object"==typeof e&&"string"==typeof e.name}).length}}},function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}),m=function(e,o){return g(e,function(e,t,n,r){return e.concat(o(t,n,r))},[])};function b(){return(b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var o=v.schema,o={releaseStage:u({},o.releaseStage,{defaultValue:function(){return/^localhost(:\d+)?$/.test(window.location.host)?"development":"production"}}),appType:b({},o.appType,{defaultValue:function(){return"browser"}}),logger:u({},o.logger,{defaultValue:function(){return"undefined"!=typeof console&&"function"==typeof console.debug?_():undefined}})},_=function(){var n={},r=console.log;return m(["debug","info","warn","error"],function(e){var t=console[e];n[e]=("function"==typeof t?t:r).bind(console,"[bugsnag]")}),n},S=function(){function e(e,t,n,r){void 0===r&&(r=new Date),this.type=n,this.message=e,this.metadata=t,this.timestamp=r}return e.prototype.toJSON=function(){return{type:this.type,name:this.message,timestamp:this.timestamp,metaData:this.metadata}},e}(),w={},E=(!function(e,t){"use strict";"object"==typeof w?w=t():e.StackFrame=t()}(this,function(){"use strict";function n(e){return!isNaN(parseFloat(e))&&isFinite(e)}function r(e){return e.charAt(0).toUpperCase()+e.substring(1)}function l(e){return function(){return this[e]}}var e=["isConstructor","isEval","isNative","isToplevel"],t=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=e.concat(t,o,["args"]);function i(e){if(e instanceof Object)for(var t=0;t<a.length;t++)e.hasOwnProperty(a[t])&&e[a[t]]!==undefined&&this["set"+r(a[t])](e[a[t]])}i.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof i)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new i(e)}},toString:function(){return(this.getFunctionName()||"{anonymous}")+("("+(this.getArgs()||[]).join(",")+")")+(this.getFileName()?"@"+this.getFileName():"")+(n(this.getLineNumber())?":"+this.getLineNumber():"")+(n(this.getColumnNumber())?":"+this.getColumnNumber():"")}};for(var s=0;s<e.length;s++)i.prototype["get"+r(e[s])]=l(e[s]),i.prototype["set"+r(e[s])]=function(t){return function(e){this[t]=Boolean(e)}}(e[s]);for(var u=0;u<t.length;u++)i.prototype["get"+r(t[u])]=l(t[u]),i.prototype["set"+r(t[u])]=function(t){return function(e){if(!n(e))throw new TypeError(t+" must be a Number");this[t]=Number(e)}}(t[u]);for(var c=0;c<o.length;c++)i.prototype["get"+r(o[c])]=l(o[c]),i.prototype["set"+r(o[c])]=function(t){return function(e){this[t]=String(e)}}(o[c]);return i}),{}),O=(!function(e,t){"use strict";"object"==typeof E?E=t(w):e.ErrorStackParser=t(e.StackFrame)}(this,function(s){"use strict";var t=/(^|@)\S+\:\d+/,n=/^\s*at .*(\S+\:\d+|\(native\))/m,r=/^(eval@)?(\[native code\])?$/;return{parse:function(e){if("undefined"!=typeof e.stacktrace||"undefined"!=typeof e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(n))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(e.replace(/[\(\)]/g,""));return[e[1],e[2]||undefined,e[3]||undefined]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(n)},this).map(function(e){var t=(e=-1<e.indexOf("(eval ")?e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""):e).replace(/^\s+/,"").replace(/\(eval code/g,"("),n=t.match(/ (\((.+):(\d+):(\d+)\)$)/),t=(t=n?t.replace(n[0],""):t).split(/\s+/).slice(1),n=this.extractLocation(n?n[1]:t.pop()),t=t.join(" ")||undefined,r=-1<["eval","<anonymous>"].indexOf(n[0])?undefined:n[0];return new s({functionName:t,fileName:r,lineNumber:n[1],columnNumber:n[2],source:e})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(r)},this).map(function(e){var t,n;return-1===(e=-1<e.indexOf(" > eval")?e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1"):e).indexOf("@")&&-1===e.indexOf(":")?new s({functionName:e}):(t=(t=e.match(n=/((.*".+"[^@]*)?[^@]*)(?:@)/))&&t[1]?t[1]:undefined,n=this.extractLocation(e.replace(n,"")),new s({functionName:t,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:e}))},this)},parseOpera:function(e){return!e.stacktrace||-1<e.message.indexOf("\n")&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[],o=2,a=n.length;o<a;o+=2){var i=t.exec(n[o]);i&&r.push(new s({fileName:i[2],lineNumber:i[1],source:n[o]}))}return r},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),r=[],o=0,a=n.length;o<a;o+=2){var i=t.exec(n[o]);i&&r.push(new s({functionName:i[3]||undefined,fileName:i[2],lineNumber:i[1],source:n[o]}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(e){var t,n=e.split("@"),r=this.extractLocation(n.pop()),n=n.shift()||"",o=n.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||undefined,n=(t=n.match(/\(([^\)]*)\)/)?n.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"):t)===undefined||"[arguments not available]"===t?undefined:t.split(",");return new s({functionName:o,args:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e})},this)}}}),E),j=function(e,t,n,r){var o=r&&r.redactedKeys?r.redactedKeys:[],r=r&&r.redactedPaths?r.redactedPaths:[];return JSON.stringify(B(e,o,r),t,n)},N=20,x=25e3,k=8,L="...";function R(e){return"[Throws: "+(e?e.message:"?")+"]"}function T(e,t){try{return e[t]}catch(n){return R(n)}}function B(e,d,f){var g=[],h=0;return function p(e,t){function n(){return t.length>k&&x<h}if(h++,t.length>N)return L;if(n())return L;if(null===e||"object"!=typeof e)return e;if(function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return 1}(g,e))return"[Circular]";if(g.push(e),"function"==typeof e.toJSON)try{h--;var r=p(e.toJSON(),t);return g.pop(),r}catch(u){return R(u)}if((r=e)instanceof Error||/^\[object (Error|(Dom)?Exception)\]$/.test(Object.prototype.toString.call(r)))return h--,r=p({name:e.name,message:e.message},t),g.pop(),r;if("[object Array]"===Object.prototype.toString.call(e)){for(var o=[],a=0,l=e.length;a<l;a++){if(n()){o.push(L);break}o.push(p(e[a],t.concat("[]")))}return g.pop(),o}var i={};try{for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(function(e,t){for(var n=0,r=e.length;n<r;n++)if(0===t.indexOf(e[n]))return 1}(f,t.join("."))&&function(e,t){for(var n=0,r=e.length;n<r;n++){if("string"==typeof e[n]&&e[n].toLowerCase()===t.toLowerCase())return 1;if(e[n]&&"function"==typeof e[n].test&&e[n].test(t))return 1}}(d,s))i[s]="[REDACTED]";else{if(n()){i[s]=L;break}i[s]=p(T(e,s),t.concat(s))}}catch(c){}return g.pop(),i}(e,[])}function M(e,t,n,r){var o;"string"==typeof n&&(r===undefined?r=null:null!==r&&"string"!=typeof r&&(r=j(r)),"number"!=typeof(o=t[n])?(e.push({name:n,variant:r}),t[n]=e.length-1):e[o]={name:n,variant:r})}var q={add:M,clear:function(e,t,n){var r=t[n];"number"==typeof r&&(e[r]=null,delete t[n])},merge:function(e,t,n){if(i(t)){for(var r=0;r<t.length;++r){var o=t[r];null!==o&&"object"==typeof o&&M(e,n,o.name,o.variant)}return e}},toEventApi:function(e){return m(h(e,Boolean),function(e){var t=e.name,e=e.variant,t={featureFlag:t};return"string"==typeof e&&(t.variant=e),t})}},I=function(e){return!(!e||!e.stack&&!e.stacktrace&&!e["opera#sourceloc"]||"string"!=typeof(e.stack||e.stacktrace||e["opera#sourceloc"])||e.stack===e.name+": "+e.message)};var D=function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}},A=function(e,t,n){"string"==typeof t&&(n?e[t]&&delete e[t][n]:delete e[t])},C=function(e,t,n,r){var o,a;if(t){if(null===n)return A(e,t);"object"==typeof n&&(a=n),"string"==typeof n&&((o={})[n]=r,a=o),a&&(e[t]||(e[t]={}),e[t]=u({},e[t],a))}},F=function(e,t,n){return"string"!=typeof t?undefined:n?e[t]?e[t][n]:undefined:e[t]},P=A,V={},l=(!function(e,t){"use strict";"object"==typeof V?V=t(w):e.StackGenerator=t(e.StackFrame)}(this,function(s){return{backtrace:function(e){for(var t=[],n=10,r=("object"==typeof e&&"number"==typeof e.maxStackSize&&(n=e.maxStackSize),arguments.callee);r&&t.length<n&&r.arguments;){for(var o=new Array(r.arguments.length),a=0;a<o.length;++a)o[a]=r.arguments[a];/function(?:\s+([\w$]+))+\s*\(/.test(r.toString())?t.push(new s({functionName:RegExp.$1||undefined,args:o})):t.push(new s({args:o}));try{r=r.caller}catch(i){break}}return t}}}),function(){function a(e,t,n,r,o){void 0===n&&(n=[]),void 0===r&&(r=$()),this.apiKey=undefined,this.context=undefined,this.groupingHash=undefined,this.originalError=o,this._handledState=r,this.severity=this._handledState.severity,this.unhandled=this._handledState.unhandled,this.app={},this.device={},this.request={},this.breadcrumbs=[],this.threads=[],this._metadata={},this._features=[],this._featuresIndex={},this._user={},this._session=undefined,this.errors=[X(e,t,a.__type,n)]}var e=a.prototype;return e.addMetadata=function(e,t,n){return C(this._metadata,e,t,n)},e.getMetadata=function(e,t){return F(this._metadata,e,t)},e.clearMetadata=function(e,t){return P(this._metadata,e,t)},e.addFeatureFlag=function(e,t){q.add(this._features,this._featuresIndex,e,t=void 0===t?null:t)},e.addFeatureFlags=function(e){q.merge(this._features,e,this._featuresIndex)},e.getFeatureFlags=function(){return q.toEventApi(this._features)},e.clearFeatureFlag=function(e){q.clear(this._features,this._featuresIndex,e)},e.clearFeatureFlags=function(){this._features=[],this._featuresIndex={}},e.getUser=function(){return this._user},e.setUser=function(e,t,n){this._user={id:e,email:t,name:n}},e.toJSON=function(){return{payloadVersion:"4",exceptions:m(this.errors,function(e){return u({},e,{message:e.errorMessage})}),severity:this.severity,unhandled:this._handledState.unhandled,severityReason:this._handledState.severityReason,app:this.app,device:this.device,request:this.request,breadcrumbs:this.breadcrumbs,context:this.context,groupingHash:this.groupingHash,metaData:this._metadata,user:this._user,session:this._session,featureFlags:this.getFeatureFlags()}},a}()),H=function(e){e={file:e.fileName,method:K(e.functionName),lineNumber:e.lineNumber,columnNumber:e.columnNumber,code:undefined,inProject:undefined};return-1<e.lineNumber&&!e.file&&!e.method&&(e.file="global code"),e},K=function(e){return/^global code$/i.test(e)?"global code":e},$=function(){return{unhandled:!1,severity:"warning",severityReason:{type:"handledException"}}},U=function(e){return"string"==typeof e?e:""};function X(e,t,n,r){return{errorClass:U(e),errorMessage:U(t),type:n,stacktrace:g(r,function(e,t){t=H(t);try{return"{}"===JSON.stringify(t)?e:e.concat(t)}catch(n){return e}},[])}}l.getStacktrace=function(e,t,n){if(I(e))return O.parse(e).slice(t);try{return h(V.backtrace(),function(e){return-1===(e.functionName||"").indexOf("StackGenerator$$")}).slice(1+n)}catch(r){return[]}},l.create=function(e,t,n,r,o,a){void 0===o&&(o=0);var t=z(e,t,r,a),a=t[0],t=t[1];try{var i=l.getStacktrace(a,0<t?1+t+o:0,1+o),s=new l(a.name,a.message,i,n,e)}catch(u){s=new l(a.name,a.message,[],n,e)}return"InvalidError"===a.name&&s.addMetadata(""+r,"non-error parameter",W(e)),a.cause&&(t=function c(e){return e.cause?[e].concat(c(e.cause)):[e]}(a).slice(1),o=m(t,function(e){var t=D(e)&&I(e)?O.parse(e):[],n=z(e,!0,"error cause")[0];return"InvalidError"===n.name&&s.addMetadata("error cause",W(e)),X(n.name,n.message,l.__type,t)}),(i=s.errors).push.apply(i,o)),s};var J,W=function(e){return null===e?"null":e===undefined?"undefined":e},z=function(e,t,n,r){var o,a=0,i=function(e){var t="error cause"===n?"was":"received",e=(r&&r.warn(n+" "+t+' a non-error: "'+e+'"'),new Error(n+" "+t+' a non-error. See "'+n+'" tab for more detail.'));return e.name="InvalidError",e};if(t)switch(typeof e){case"string":case"number":case"boolean":o=new Error(String(e)),a+=1;break;case"function":o=i("function"),a+=2;break;case"object":null!==e&&D(e)?o=e:null!==e&&G(e)?((o=new Error(e.message||e.errorMessage)).name=e.name||e.errorClass,a+=1):(o=i(null===e?"null":"unsupported object"),a+=2);break;default:o=i("nothing"),a+=2}else D(e)?o=e:(o=i(typeof e),a+=2);if(!I(o))try{throw o}catch(s){I(s)&&(o=s,a=1)}return[o,a]},G=(l.__type="browserjs",function(e){return!("string"!=typeof e.name&&"string"!=typeof e.errorClass||"string"!=typeof e.message&&"string"!=typeof e.errorMessage)}),Q=l,Y=function(e,t,n){var r=0,o=function(){if(r>=e.length)return n(null,!0);t(e[r],function(e,t){return e?n(e):!1===t?n(null,!1):(r++,void o())})};o()},Z=function(e,o,a,t){Y(e,function(e,n){if("function"!=typeof e)return n(null);try{var t;if(2!==e.length)return(t=e(o))&&"function"==typeof t.then?t.then(function(e){return setTimeout(function(){return n(null,e)})},function(e){setTimeout(function(){return a(e),n(null,!0)})}):n(null,t);e(o,function(e,t){if(e)return a(e),n(null);n(null,t)})}catch(r){a(r),n(null)}},t)},ee=function(e,t,n,r){for(var o=!1,a=e.slice();!o&&a.length;)try{o=!1===a.pop()(t)}catch(i){r.error("Error occurred in "+n+" callback, continuing anyway…"),r.error(i)}return o},te=function(e,t){e="000000000"+e;return e.substr(e.length-t)},ne="object"==typeof window?window:self,re=0;for(J in ne)Object.hasOwnProperty.call(ne,J)&&re++;var e=navigator.mimeTypes?navigator.mimeTypes.length:0,oe=te((e+navigator.userAgent.length).toString(36)+re.toString(36),4),ae=function(){return oe},ie=0,se=4,ue=36,ce=Math.pow(ue,se);function le(){return te((Math.random()*ce<<0).toString(ue),se)}function de(){return"c"+(new Date).getTime().toString(ue)+te((ie=ie<ce?ie:0,(++ie-1).toString(ue)),se)+ae()+(le()+le())}de.fingerprint=ae;var fe,ge,he=de,pe=function(){function e(){this.id=he(),this.startedAt=new Date,this._handled=0,this._unhandled=0,this._user={},this.app={},this.device={}}var t=e.prototype;return t.getUser=function(){return this._user},t.setUser=function(e,t,n){this._user={id:e,email:t,name:n}},t.toJSON=function(){return{id:this.id,startedAt:this.startedAt,events:{handled:this._handled,unhandled:this._unhandled}}},t._track=function(e){this[e._handledState.unhandled?"_unhandled":"_handled"]+=1},e}(),me=q.add,ve=q.clear,ye=q.merge,c=function(){},be=function(t,n){return new Error("Invalid configuration\n"+m(a(t),function(e){return" - "+e+" "+t[e]+", got "+_e(n[e])}).join("\n\n"))},_e=function(e){switch(typeof e){case"string":case"number":case"object":return JSON.stringify(e);default:return String(e)}},Se=function(){function s(e,t,n,r){var o=this,a=(void 0===t&&(t=v.schema),void 0===n&&(n=[]),this._notifier=r,this._config={},this._schema=t,this._delivery={sendSession:c,sendEvent:c},this._logger={debug:c,info:c,warn:c,error:c},this._plugins={},this._breadcrumbs=[],this._session=null,this._metadata={},this._featuresIndex={},this._features=[],this._context=undefined,this._user={},this._cbs={e:[],s:[],sp:[],b:[]},this.Client=s,this.Event=Q,this.Breadcrumb=S,this.Session=pe,this._config=this._configure(e,n),m(n.concat(this._config.plugins),function(e){e&&o._loadPlugin(e)}),this._depth=1,this),i=this.notify;this.notify=function(){return i.apply(a,arguments)}}var e=s.prototype;return e.addMetadata=function(e,t,n){return C(this._metadata,e,t,n)},e.getMetadata=function(e,t){return F(this._metadata,e,t)},e.clearMetadata=function(e,t){return P(this._metadata,e,t)},e.addFeatureFlag=function(e,t){me(this._features,this._featuresIndex,e,t=void 0===t?null:t)},e.addFeatureFlags=function(e){ye(this._features,e,this._featuresIndex)},e.clearFeatureFlag=function(e){ve(this._features,this._featuresIndex,e)},e.clearFeatureFlags=function(){this._features=[],this._featuresIndex={}},e.getContext=function(){return this._context},e.setContext=function(e){this._context=e},e._configure=function(r,e){var o=g(e,function(e,t){return t&&t.configSchema?u({},e,t.configSchema):e},this._schema),e=g(a(o),function(e,t){var n=o[t].defaultValue(r[t]);return r[t]!==undefined?o[t].validate(r[t])?o[t].allowPartialObject?e.config[t]=u(n,r[t]):e.config[t]=r[t]:(e.errors[t]=o[t].message,e.config[t]=n):e.config[t]=n,e},{errors:{},config:{}}),t=e.errors,e=e.config;if(o.apiKey){if(!e.apiKey)throw new Error("No Bugsnag API Key set");/^[0-9a-f]{32}$/i.test(e.apiKey)||(t.apiKey="should be a string of 32 hexadecimal characters")}return this._metadata=u({},e.metadata),ye(this._features,e.featureFlags,this._featuresIndex),this._user=u({},e.user),this._context=e.context,e.logger&&(this._logger=e.logger),e.onError&&(this._cbs.e=this._cbs.e.concat(e.onError)),e.onBreadcrumb&&(this._cbs.b=this._cbs.b.concat(e.onBreadcrumb)),e.onSession&&(this._cbs.s=this._cbs.s.concat(e.onSession)),a(t).length&&this._logger.warn(be(t,r)),e},e.getUser=function(){return this._user},e.setUser=function(e,t,n){this._user={id:e,email:t,name:n}},e._loadPlugin=function(e){var t=e.load(this);return e.name&&(this._plugins["~"+e.name+"~"]=t),this},e.getPlugin=function(e){return this._plugins["~"+e+"~"]},e._setDelivery=function(e){this._delivery=e(this)},e.startSession=function(){var e=new pe;return e.app.releaseStage=this._config.releaseStage,e.app.version=this._config.appVersion,e.app.type=this._config.appType,e._user=u({},this._user),ee(this._cbs.s,e,"onSession",this._logger)?(this._logger.debug("Session not started due to onSession callback"),this):this._sessionDelegate.startSession(this,e)},e.addOnError=function(e,t){this._cbs.e[(t=void 0===t?!1:t)?"unshift":"push"](e)},e.removeOnError=function(t){this._cbs.e=h(this._cbs.e,function(e){return e!==t})},e._addOnSessionPayload=function(e){this._cbs.sp.push(e)},e.addOnSession=function(e){this._cbs.s.push(e)},e.removeOnSession=function(t){this._cbs.s=h(this._cbs.s,function(e){return e!==t})},e.addOnBreadcrumb=function(e,t){this._cbs.b[(t=void 0===t?!1:t)?"unshift":"push"](e)},e.removeOnBreadcrumb=function(t){this._cbs.b=h(this._cbs.b,function(e){return e!==t})},e.pauseSession=function(){return this._sessionDelegate.pauseSession(this)},e.resumeSession=function(){return this._sessionDelegate.resumeSession(this)},e.leaveBreadcrumb=function(e,t,n){e="string"==typeof e?e:"",n="string"==typeof n&&p(r,n)?n:"manual",t="object"==typeof t&&null!==t?t:{},e&&(e=new S(e,t,n),ee(this._cbs.b,e,"onBreadcrumb",this._logger)?this._logger.debug("Breadcrumb not attached due to onBreadcrumb callback"):(this._breadcrumbs.push(e),this._breadcrumbs.length>this._config.maxBreadcrumbs&&(this._breadcrumbs=this._breadcrumbs.slice(this._breadcrumbs.length-this._config.maxBreadcrumbs))))},e._isBreadcrumbTypeEnabled=function(e){var t=this._config.enabledBreadcrumbTypes;return null===t||p(t,e)},e.notify=function(e,t,n){void 0===n&&(n=c);e=Q.create(e,!0,undefined,"notify()",this._depth+1,this._logger);this._notify(e,t,n)},e._notify=function(n,e,r){var o=this;if(void 0===r&&(r=c),n.app=u({},n.app,{releaseStage:this._config.releaseStage,version:this._config.appVersion,type:this._config.appType}),n.context=n.context||this._context,n._metadata=u({},n._metadata,this._metadata),n._user=u({},n._user,this._user),n.breadcrumbs=this._breadcrumbs.slice(),ye(n._features,this._features,n._featuresIndex),null!==this._config.enabledReleaseStages&&!p(this._config.enabledReleaseStages,this._config.releaseStage))return this._logger.warn("Event not sent due to releaseStage/enabledReleaseStages configuration"),r(null,n);var a=n.severity,i=function(e){o._logger.error("Error occurred in onError callback, continuing anyway…"),o._logger.error(e)},e=[].concat(this._cbs.e).concat(e);Z(e,n,i,function(e,t){if(e&&i(e),!t)return o._logger.debug("Event not sent due to onError callback"),r(null,n);o._isBreadcrumbTypeEnabled("error")&&s.prototype.leaveBreadcrumb.call(o,n.errors[0].errorClass,{errorClass:n.errors[0].errorClass,errorMessage:n.errors[0].errorMessage,severity:n.severity},"error"),a!==n.severity&&(n._handledState.severityReason={type:"userCallbackSetSeverity"}),n.unhandled!==n._handledState.unhandled&&(n._handledState.severityReason.unhandledOverridden=!0,n._handledState.unhandled=n.unhandled),o._session&&(o._session._track(n),n._session=o._session),o._delivery.sendEvent({apiKey:n.apiKey||o._config.apiKey,notifier:o._notifier,events:[n]},function(e){return r(e,n)})})},s}(),we={},Ee=["events.[].metaData","events.[].breadcrumbs.[].metaData","events.[].request"],Oe=(we.event=function(e,t){var n=j(e,null,null,{redactedPaths:Ee,redactedKeys:t});return 1e6<n.length&&(e.events[0]._metadata={notifier:"WARNING!\nSerialized payload was "+n.length/1e6+"MB (limit = 1MB)\nmetadata was removed"},n=j(e,null,null,{redactedPaths:Ee,redactedKeys:t})),n},we.session=function(e,t){return j(e,null,null)},function(e,t,n,r){var o=JSON.parse(JSON.stringify(new Date));return je(e.endpoints[t],r.location.protocol)+"?apiKey="+encodeURIComponent(e.apiKey)+"&payloadVersion="+n+"&sentAt="+encodeURIComponent(o)}),je=(fe=function(a,i){return void 0===i&&(i=window),{sendEvent:function(e,t){if(void 0===t&&(t=function(){}),null===a._config.endpoints.notify)return n=new Error("Event not sent due to incomplete endpoint configuration"),t(n);var n=Oe(a._config,"notify","4",i),r=we.event(e,a._config.redactedKeys),o=new i.XDomainRequest;o.onload=function(){t(null)},o.onerror=function(){var e=new Error("Event failed to send");a._logger.error("Event failed to send…",e),1e6<r.length&&a._logger.warn("Event oversized ("+(r.length/1e6).toFixed(2)+" MB)"),t(e)},o.open("POST",n),setTimeout(function(){try{o.send(r)}catch(e){a._logger.error(e),t(e)}},0)},sendSession:function(t,n){if(void 0===n&&(n=function(){}),null===a._config.endpoints.sessions)return e=new Error("Session not sent due to incomplete endpoint configuration"),n(e);var e=Oe(a._config,"sessions","1",i),r=new i.XDomainRequest;r.onload=function(){n(null)},r.open("POST",e),setTimeout(function(){try{r.send(we.session(t,a._config.redactedKeys))}catch(e){a._logger.error(e),n(e)}},0)}}})._matchPageProtocol=function(e,t){return"http:"===t?e.replace(/^https:/,"http:"):e},Ne=function(s,u){return void 0===u&&(u=window),{sendEvent:function(e,t){void 0===t&&(t=function(){});try{var n,r=s._config.endpoints.notify;if(null===r)return n=new Error("Event not sent due to incomplete endpoint configuration"),t(n);var o=new u.XMLHttpRequest,a=we.event(e,s._config.redactedKeys);o.onreadystatechange=function(){var e;o.readyState===u.XMLHttpRequest.DONE&&(0===(e=o.status)||400<=e?(e=new Error("Request failed with status "+e),s._logger.error("Event failed to send…",e),1e6<a.length&&s._logger.warn("Event oversized ("+(a.length/1e6).toFixed(2)+" MB)"),t(e)):t(null))},o.open("POST",r),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Bugsnag-Api-Key",e.apiKey||s._config.apiKey),o.setRequestHeader("Bugsnag-Payload-Version","4"),o.setRequestHeader("Bugsnag-Sent-At",(new Date).toISOString()),o.send(a)}catch(i){s._logger.error(i)}},sendSession:function(e,t){void 0===t&&(t=function(){});try{var n,r=s._config.endpoints.sessions;if(null===r)return n=new Error("Session not sent due to incomplete endpoint configuration"),t(n);var o=new u.XMLHttpRequest;o.onreadystatechange=function(){var e;o.readyState===u.XMLHttpRequest.DONE&&(0===(e=o.status)||400<=e?(e=new Error("Request failed with status "+e),s._logger.error("Session failed to send…",e),t(e)):t(null))},o.open("POST",r),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Bugsnag-Api-Key",s._config.apiKey),o.setRequestHeader("Bugsnag-Payload-Version","1"),o.setRequestHeader("Bugsnag-Sent-At",(new Date).toISOString()),o.send(we.session(e,s._config.redactedKeys))}catch(a){s._logger.error(a)}}}},xe=new Date,ke=function(){xe=new Date},Le={name:"appDuration",load:function(e){return e.addOnError(function(e){var t=new Date;e.app.duration=t-xe},!0),{reset:ke}}},Re=function(e,t){e="000000000"+e;return e.substr(e.length-t)},Te="object"==typeof window?window:self,Be=0;for(ge in Te)Object.hasOwnProperty.call(Te,ge)&&Be++;var e=navigator.mimeTypes?navigator.mimeTypes.length:0,Me=Re((e+navigator.userAgent.length).toString(36)+Be.toString(36),4),qe=function(){return Me},Ie=0,De=4,Ae=36,Ce=Math.pow(Ae,De);function Fe(){return Re((Math.random()*Ce<<0).toString(Ae),De)}function Pe(){return"c"+(new Date).getTime().toString(Ae)+Re((Ie=Ie<Ce?Ie:0,(++Ie-1).toString(Ae)),De)+qe()+(Fe()+Fe())}Pe.fingerprint=qe;var Ve=Pe,He="bugsnag-anonymous-id",Ke=function(e){try{var t=e.localStorage,n=t.getItem(He);return n&&/^c[a-z0-9]{20,32}$/.test(n)?n:(n=Ve(),t.setItem(He,n),n)}catch(r){}},$e=function(e){var t=e.getUser();t&&t.id||e.setUser(e.device.id)},Ue={load:function(e){e._sessionDelegate=Xe}},Xe={startSession:function(e,t){return e._session=t,(e._pausedSession=null)===e._config.enabledReleaseStages||p(e._config.enabledReleaseStages,e._config.releaseStage)?e._delivery.sendSession({notifier:e._notifier,device:t.device,app:t.app,sessions:[{id:t.id,startedAt:t.startedAt,user:t._user}]}):e._logger.warn("Session not sent due to releaseStage/enabledReleaseStages configuration"),e},resumeSession:function(e){return e._session?e:e._pausedSession?(e._session=e._pausedSession,e._pausedSession=null,e):e.startSession()},pauseSession:function(e){e._pausedSession=e._session,e._session=null}},Je={load:function(e){e._config.collectUserIp||e.addOnError(function(e){e._user&&"undefined"==typeof e._user.id&&delete e._user.id,e._user=u({id:"[REDACTED]"},e._user),e.request=u({clientIp:"[REDACTED]"},e.request)})},configSchema:{collectUserIp:{defaultValue:function(){return!0},message:"should be true|false",validate:function(e){return!0===e||!1===e}}}},We={load:function(a){!/^(local-)?dev(elopment)?$/.test(a._config.releaseStage)&&a._isBreadcrumbTypeEnabled("log")&&m(ze,function(r){var o=console[r];console[r]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];a.leaveBreadcrumb("Console output",g(t,function(e,t,n){var r="[Unknown value]";try{r=String(t)}catch(o){}if("[object Object]"===r)try{r=JSON.stringify(t)}catch(o){}return e["["+n+"]"]=r,e},{severity:0===r.indexOf("group")?"log":r}),"log"),o.apply(console,t)},console[r]._restore=function(){console[r]=o}})}},ze=h(["log","debug","info","warn","error"],function(e){return"undefined"!=typeof console&&"function"==typeof console[e]}),Ge=200,Qe=5e5,Ye=function(d,f){return void 0===d&&(d=document),void 0===f&&(f=window),{load:function(e){var o,a,i,s,t,n,u,c,l;function r(a,i,s){return void 0===s&&(s=!1),function(){var e=[].slice.call(arguments);try{var t,n=i(e),r=n.get();if(s&&a.apply(this,e),"function"!=typeof r)return a.apply(this,e);r.__trace__||(t=c(),r.__trace__=function(){u(t),l(function(){u(null)},0);var e=r.apply(this,arguments);return u(null),e},r.__trace__.__trace__=r.__trace__),n.replace(r.__trace__)}catch(o){}if(a.apply)return a.apply(this,e);switch(e.length){case 1:return a(e[0]);case 2:return a(e[0],e[1]);default:return a()}}}e._config.trackInlineScripts&&(o=f.location.href,s="",a=!!d.attachEvent?"complete"===d.readyState:"loading"!==d.readyState,s=(i=function(){return d.documentElement.outerHTML})(),t=d.onreadystatechange,d.onreadystatechange=function(){"interactive"===d.readyState&&(s=i(),a=!0);try{t.apply(this,arguments)}catch(e){}},n=null,u=function(e){n=e},c=function(){var e,t=d.currentScript||n;return t=t||a?t:(e=d.scripts||d.getElementsByTagName("script"))[e.length-1]},e.addOnError(function(e){e.errors[0].stacktrace=h(e.errors[0].stacktrace,function(e){return!/__trace__$/.test(e.method)});var r,t=e.errors[0].stacktrace[0],n=function(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"")};t&&t.file&&n(t.file)!==n(o)||(n=c())&&(n=n.innerHTML,e.addMetadata("script","content",n.length<=Qe?n:n.substr(0,Qe)),t&&t.lineNumber&&(t.code=(n=t.lineNumber,a&&s||(s=i()),e=["\x3c!-- DOC START --\x3e"].concat(s.split("\n")),n-=1,r=Math.max(n-3,0),n=Math.min(3+n,e.length),g(e.slice(r,n),function(e,t,n){return e[r+1+n]=t.length<=Ge?t:t.substr(0,Ge),e},{}))))},!0),l=m(["setTimeout","setInterval","setImmediate","requestAnimationFrame"],function(e){return Ze(f,e,function(e){return r(e,function(t){return{get:function(){return t[0]},replace:function(e){t[0]=e}}})})})[0],m(["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],function(e){f[e]&&f[e].prototype&&Object.prototype.hasOwnProperty.call(f[e].prototype,"addEventListener")&&(Ze(f[e].prototype,"addEventListener",function(e){return r(e,et)}),Ze(f[e].prototype,"removeEventListener",function(e){return r(e,et,!0)}))}))},configSchema:{trackInlineScripts:{validate:function(e){return!0===e||!1===e},defaultValue:function(){return!0},message:"should be true|false"}}}};function Ze(e,t,n){var r=e[t];if(!r)return r;n=n(r);return e[t]=n,r}function et(t){var n=!!t[1]&&"function"==typeof t[1].handleEvent;return{get:function(){return n?t[1].handleEvent:t[1]},replace:function(e){n?t[1].handleEvent=e:t[1]=e}}}var tt=function(i){return void 0===i&&(i=window),{load:function(o){"addEventListener"in i&&o._isBreadcrumbTypeEnabled("user")&&i.addEventListener("click",function(e){var t,n;try{t=function(e){var t=e.textContent||e.innerText||"";t||"submit"!==e.type&&"button"!==e.type||(t=e.value);if(140<(t=t.replace(nt,"").replace(rt,"$1")).length)return t.slice(0,135)+"(...)";return t}(e.target),n=function a(e,t){var n=[e.tagName];e.id&&n.push("#"+e.id);e.className&&e.className.length&&n.push("."+e.className.split(" ").join("."));if(!t.document.querySelectorAll||!Array.prototype.indexOf)return n.join("");try{if(1===t.document.querySelectorAll(n.join("")).length)return n.join("")}catch(o){return n.join("")}{var r;1<e.parentNode.childNodes.length&&(r=Array.prototype.indexOf.call(e.parentNode.childNodes,e)+1,n.push(":nth-child("+r+")"))}if(1===t.document.querySelectorAll(n.join("")).length)return n.join("");if(e.parentNode)return a(e.parentNode,t)+" > "+n.join("");return n.join("")}(e.target,i)}catch(r){n=t="[hidden]",o._logger.error("Cross domain error when tracking click event. See docs: https://tinyurl.com/yy3rn63z")}o.leaveBreadcrumb("UI click",{targetText:t,targetSelector:n},"user")},!0)}}},nt=/^\s+/,rt=/(^|[^\s])\s+$/;var ot=function(n){void 0===n&&(n=window);var e={load:function(t){var e;"addEventListener"in n&&t._isBreadcrumbTypeEnabled("navigation")&&(n.addEventListener("pagehide",(e=function(e){return function(){return t.leaveBreadcrumb(e,{},"navigation")}})("Page hidden"),!0),n.addEventListener("pageshow",e("Page shown"),!0),n.addEventListener("load",e("Page loaded"),!0),n.document.addEventListener("DOMContentLoaded",e("DOMContentLoaded"),!0),n.addEventListener("load",function(){return n.addEventListener("popstate",e("Navigated back"),!0)}),n.addEventListener("hashchange",function(e){e=e.oldURL?{from:at(e.oldURL,n),to:at(e.newURL,n),state:ut(n)}:{to:at(n.location.href,n)};t.leaveBreadcrumb("Hash changed",e,"navigation")},!0),n.history.pushState&&st(t,n.history,"pushState",n,!0),n.history.replaceState&&st(t,n.history,"replaceState",n))}};return e},at=function(e,t){t=t.document.createElement("A");return t.href=e,""+t.pathname+t.search+t.hash},it=function(e,t,n,r){var o=at(e.location.href,e);return{title:n,state:t,prevState:ut(e),to:r||o,from:o}},st=function(r,o,a,i,s){void 0===s&&(s=!1);var u=o[a];o[a]=function(e,t,n){r.leaveBreadcrumb("History "+a,it(i,e,t,n),"navigation"),s&&"function"==typeof r.resetEventCount&&r.resetEventCount(),u.apply(o,[e,t].concat(n!==undefined?n:[]))}},ut=function(e){try{return e.history.state}catch(t){}},ct="request",lt=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=window);var n={load:function(s){var u,r,c,n,l,i,d,f;s._isBreadcrumbTypeEnabled("request")&&(u=[s._config.endpoints.notify,s._config.endpoints.sessions].concat(e),"addEventListener"in t.XMLHttpRequest.prototype&&"WeakMap"in t&&(r=new WeakMap,c=new WeakMap,n=t.XMLHttpRequest.prototype.open,t.XMLHttpRequest.prototype.open=function(e,t){this&&r.set(this,{method:e,url:t}),n.apply(this,arguments)},l=t.XMLHttpRequest.prototype.send,t.XMLHttpRequest.prototype.send=function(e){var o,t,n,a=this,i=r.get(this);i&&((t=c.get(this))&&(this.removeEventListener("load",t.load),this.removeEventListener("error",t.error)),o=new Date,t=function(){var e,t,n;e=i.method,t=i.url,n=dt(o),t!==undefined?"string"==typeof t&&p(u,t.replace(/\?.*$/,""))||s.leaveBreadcrumb("XMLHttpRequest error",{method:String(e),url:String(t),duration:n},ct):s._logger.warn("The request URL is no longer present on this XMLHttpRequest. A breadcrumb cannot be left for this request.")},this.addEventListener("load",n=function(){var e,t,n,r;e=i.method,t=i.url,n=a.status,r=dt(o),t!==undefined?"string"==typeof t&&p(u,t.replace(/\?.*$/,""))||(e={status:n,method:String(e),url:String(t),duration:r},400<=n?s.leaveBreadcrumb("XMLHttpRequest failed",e,ct):s.leaveBreadcrumb("XMLHttpRequest succeeded",e,ct)):s._logger.warn("The request URL is no longer present on this XMLHttpRequest. A breadcrumb cannot be left for this request.")}),this.addEventListener("error",t),this&&c.set(this,{load:n,error:t})),l.apply(this,arguments)}),"fetch"in t&&!t.fetch.polyfill&&(i=t.fetch,t.fetch=function(){var o,e=arguments,t=arguments[0],n=arguments[1],a=null;return t&&"object"==typeof t?(a=t.url,n&&"method"in n?o=n.method:t&&"method"in t&&(o=t.method)):(a=t,n&&"method"in n&&(o=n.method)),o===undefined&&(o="GET"),new Promise(function(t,n){var r=new Date;i.apply(void 0,e).then(function(e){d(e,o,a,dt(r)),t(e)})["catch"](function(e){f(o,a,dt(r)),n(e)})})}),d=function(e,t,n,r){t={method:String(t),status:e.status,url:String(n),duration:r};400<=e.status?s.leaveBreadcrumb("fetch() failed",t,ct):s.leaveBreadcrumb("fetch() succeeded",t,ct)},f=function(e,t,n){s.leaveBreadcrumb("fetch() error",{method:String(e),url:String(t),duration:n},ct)})}};return n},dt=function(e){return e&&new Date-e},ft={load:function(t){var n=0;t.addOnError(function(e){if(n>=t._config.maxEvents)return t._logger.warn("Cancelling event send due to maxEvents per session limit of "+t._config.maxEvents+" being reached"),!1;n++}),t.resetEventCount=function(){n=0}},configSchema:{maxEvents:{defaultValue:function(){return 10},message:"should be a positive integer ≤100",validate:function(e){return t(1,100)(e)}}}},gt={},ht=(gt={load:function(e){e.addOnError(function(e){e=g(e.errors,function(e,t){return e.concat(t.stacktrace)},[]);m(e,function(e){e.file=ht(e.file)})})}})._strip=function(e){return"string"==typeof e?e.replace(/\?.*$/,"").replace(/#.*$/,""):e},pt=function(e,d){return void 0===e&&(e=window),void 0===d&&(d="window onerror"),{load:function(c){var l;c._config.autoDetectErrors&&c._config.enabledErrorTypes.unhandledExceptions&&(l=e.onerror,e.onerror=function(e,t,n,r,o){var a,i,s,u;0===n&&/Script error\.?/.test(e)?c._logger.warn("Ignoring cross-domain or eval script error. See docs: https://tinyurl.com/yy3rn63z"):(a={severity:"error",unhandled:!0,severityReason:{type:"unhandledException"}},o?(u=c.Event.create(o,!0,a,d,1),mt(u.errors[0].stacktrace,t,n,r)):"object"!=typeof e||null===e||t&&"string"==typeof t||n||r||o?(u=c.Event.create(e,!0,a,d,1),mt(u.errors[0].stacktrace,t,n,r)):(i=e.type?"Event: "+e.type:"Error",s=e.message||e.detail||"",(u=c.Event.create({name:i,message:s},!0,a,d,1)).originalError=e,u.addMetadata(d,{event:e,extraParameters:t})),c._notify(u)),"function"==typeof l&&l.apply(this,arguments)})}}},mt=function(e,t,n,r){e[0]||e.push({});e=e[0];e.file||"string"!=typeof t||(e.file=t),!e.lineNumber&&vt(n)&&(e.lineNumber=n),e.columnNumber||(vt(r)?e.columnNumber=r:window.event&&vt(window.event.errorCharacter)&&(e.columnNumber=window.event.errorCharacter))},vt=function(e){return"number"==typeof e&&"NaN"!==String.call(e)},yt=function(t){return function(e){e.file!==t.toString()&&e.method&&(e.method=e.method.replace(/^\s+/,""))}},e={},bt=u({},v.schema,o),n={_client:null,createClient:function(e){e=(e="string"==typeof e?{apiKey:e}:e)||{};var t,n,r,o,a,i=[Le,(void 0===o&&(o=navigator),void 0===a&&(a=window),{load:function(t){var n={locale:o.browserLanguage||o.systemLanguage||o.userLanguage||o.language,userAgent:o.userAgent};a&&a.screen&&a.screen.orientation&&a.screen.orientation.type?n.orientation=a.screen.orientation.type:a&&a.document&&(n.orientation=a.document.documentElement.clientWidth>a.document.documentElement.clientHeight?"landscape":"portrait"),t._config.generateAnonymousId&&(n.id=Ke(a)),t.addOnSession(function(e){e.device=u({},e.device,n),t._config.collectUserIp||$e(e)}),t.addOnError(function(e){e.device=u({},e.device,n,{time:new Date}),t._config.collectUserIp||$e(e)},!0)},configSchema:{generateAnonymousId:{validate:function(e){return!0===e||!1===e},defaultValue:function(){return!0},message:"should be true|false"}}}),(void 0===r&&(r=window),{load:function(e){e.addOnError(function(e){e.context===undefined&&(e.context=r.location.pathname)},!0)}}),(void 0===n&&(n=window),{load:function(e){e.addOnError(function(e){e.request&&e.request.url||(e.request=u({},e.request,{url:n.location.href}))},!0)}}),ft,Ue,Je,gt,pt(),(void 0===t&&(t=window),{load:function(o){var n;o._config.autoDetectErrors&&o._config.enabledErrorTypes.unhandledRejections&&(n=function(e){var t=e.reason,n=!1;try{e.detail&&e.detail.reason&&(t=e.detail.reason,n=!0)}catch(r){}e=o.Event.create(t,!1,{severity:"error",unhandled:!0,severityReason:{type:"unhandledPromiseRejection"}},"unhandledrejection handler",1,o._logger);n&&m(e.errors[0].stacktrace,yt(t)),o._notify(e,function(e){var t;D(e.originalError)&&!e.originalError.stack&&e.addMetadata("unhandledRejection handler",((t={})[Object.prototype.toString.call(e.originalError)]={name:e.originalError.name,message:e.originalError.message,code:e.originalError.code},t))})},"addEventListener"in t?t.addEventListener("unhandledrejection",n):t.onunhandledrejection=function(e,t){n({detail:{reason:e,promise:t}})},0)}}),ot(),tt(),lt(),We,Ye()],e=new Se(e,bt,i,{name:"Bugsnag JavaScript",version:"8.0.0-alpha.3",url:"https://github.com/bugsnag/bugsnag-js"});return e._setDelivery(window.XDomainRequest?fe:Ne),e._logger.debug("Loaded!"),e.leaveBreadcrumb("Bugsnag loaded",{},"state"),e._config.autoTrackSessions?e.startSession():e},start:function(e){return n._client?n._client._logger.warn("Bugsnag.start() was called more than once. Ignoring."):n._client=n.createClient(e),n._client},isStarted:function(){return null!=n._client}};return m(["resetEventCount"].concat(a(Se.prototype)),function(t){/^_/.test(t)||(n[t]=function(){if(!n._client)return console.log("Bugsnag."+t+"() was called before Bugsnag.start()");n._client._depth+=1;var e=n._client[t].apply(n._client,arguments);return--n._client._depth,e})}),(e=n).Client=Se,e.Event=Q,e.Session=pe,e.Breadcrumb=S,e["default"]=n,e});
//# sourceMappingURL=bugsnag.min.js.map
{
"name": "@bugsnag/browser",
"version": "8.0.0-alpha.2",
"version": "8.0.0-alpha.3",
"main": "dist/bugsnag.js",

@@ -33,24 +33,24 @@ "types": "types/bugsnag.d.ts",

"devDependencies": {
"@bugsnag/delivery-x-domain-request": "^8.0.0-alpha.1",
"@bugsnag/delivery-xml-http-request": "^8.0.0-alpha.1",
"@bugsnag/plugin-app-duration": "^8.0.0-alpha.1",
"@bugsnag/plugin-browser-context": "^8.0.0-alpha.1",
"@bugsnag/plugin-browser-device": "^8.0.0-alpha.1",
"@bugsnag/plugin-browser-request": "^8.0.0-alpha.1",
"@bugsnag/plugin-browser-session": "^8.0.0-alpha.1",
"@bugsnag/plugin-client-ip": "^8.0.0-alpha.1",
"@bugsnag/plugin-console-breadcrumbs": "^8.0.0-alpha.1",
"@bugsnag/plugin-inline-script-content": "^8.0.0-alpha.1",
"@bugsnag/plugin-interaction-breadcrumbs": "^8.0.0-alpha.1",
"@bugsnag/plugin-navigation-breadcrumbs": "^8.0.0-alpha.1",
"@bugsnag/plugin-network-breadcrumbs": "^8.0.0-alpha.2",
"@bugsnag/plugin-simple-throttle": "^8.0.0-alpha.2",
"@bugsnag/plugin-strip-query-string": "^8.0.0-alpha.1",
"@bugsnag/plugin-window-onerror": "^8.0.0-alpha.1",
"@bugsnag/plugin-window-unhandled-rejection": "^8.0.0-alpha.1"
"@bugsnag/delivery-x-domain-request": "^8.0.0-alpha.3",
"@bugsnag/delivery-xml-http-request": "^8.0.0-alpha.3",
"@bugsnag/plugin-app-duration": "^8.0.0-alpha.3",
"@bugsnag/plugin-browser-context": "^8.0.0-alpha.3",
"@bugsnag/plugin-browser-device": "^8.0.0-alpha.3",
"@bugsnag/plugin-browser-request": "^8.0.0-alpha.3",
"@bugsnag/plugin-browser-session": "^8.0.0-alpha.3",
"@bugsnag/plugin-client-ip": "^8.0.0-alpha.3",
"@bugsnag/plugin-console-breadcrumbs": "^8.0.0-alpha.3",
"@bugsnag/plugin-inline-script-content": "^8.0.0-alpha.3",
"@bugsnag/plugin-interaction-breadcrumbs": "^8.0.0-alpha.3",
"@bugsnag/plugin-navigation-breadcrumbs": "^8.0.0-alpha.3",
"@bugsnag/plugin-network-breadcrumbs": "^8.0.0-alpha.3",
"@bugsnag/plugin-simple-throttle": "^8.0.0-alpha.3",
"@bugsnag/plugin-strip-query-string": "^8.0.0-alpha.3",
"@bugsnag/plugin-window-onerror": "^8.0.0-alpha.3",
"@bugsnag/plugin-window-unhandled-rejection": "^8.0.0-alpha.3"
},
"dependencies": {
"@bugsnag/core": "^8.0.0-alpha.1"
"@bugsnag/core": "^8.0.0-alpha.3"
},
"gitHead": "159e236c690d3c604aeb8766c00ca084675071ad"
"gitHead": "a7216d4099791f3ba3dc79bb16f41e2140de0a47"
}

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 not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc