@airbrake/browser
Advanced tools
Comparing version 1.0.0-beta.4 to 1.0.0-beta.5
@@ -608,3 +608,3 @@ 'use strict'; | ||
var _this = this; | ||
this.filters = []; | ||
this._filters = []; | ||
this._scope = new Scope(); | ||
@@ -619,5 +619,5 @@ this._onClose = []; | ||
this._opt.keysBlacklist = this._opt.keysBlacklist || [/password/, /secret/]; | ||
this.url = this._opt.host + "/api/v3/projects/" + this._opt.projectId + "/notices?key=" + this._opt.projectKey; | ||
this.processor = this._opt.processor || espProcessor; | ||
this.requester = makeRequester$1(this._opt); | ||
this._url = this._opt.host + "/api/v3/projects/" + this._opt.projectId + "/notices?key=" + this._opt.projectKey; | ||
this._processor = this._opt.processor || espProcessor; | ||
this._requester = makeRequester$1(this._opt); | ||
this.addFilter(ignoreNoiseFilter); | ||
@@ -647,3 +647,3 @@ this.addFilter(makeDebounceFilter()); | ||
BaseNotifier.prototype.addFilter = function (filter) { | ||
this.filters.push(filter); | ||
this._filters.push(filter); | ||
}; | ||
@@ -665,9 +665,5 @@ BaseNotifier.prototype.notify = function (err) { | ||
} | ||
if (this._opt.ignoreWindowError && err.context && err.context.windowError) { | ||
notice.error = new Error('airbrake: window error is ignored'); | ||
return Promise.resolve(notice); | ||
} | ||
var error = this.processor(err.error); | ||
var error = this._processor(err.error); | ||
notice.errors.push(error); | ||
for (var _i = 0, _a = this.filters; _i < _a.length; _i++) { | ||
for (var _i = 0, _a = this._filters; _i < _a.length; _i++) { | ||
var filter = _a[_i]; | ||
@@ -687,8 +683,8 @@ var r = filter(notice); | ||
name: 'airbrake-js', | ||
version: '1.0.0-beta.4', | ||
version: '1.0.0-beta.5', | ||
url: 'https://github.com/airbrake/airbrake-js', | ||
}; | ||
return this.sendNotice(notice); | ||
return this._sendNotice(notice); | ||
}; | ||
BaseNotifier.prototype.sendNotice = function (notice) { | ||
BaseNotifier.prototype._sendNotice = function (notice) { | ||
var body = jsonifyNotice(notice, { | ||
@@ -707,6 +703,6 @@ keysBlacklist: this._opt.keysBlacklist, | ||
method: 'POST', | ||
url: this.url, | ||
url: this._url, | ||
body: body, | ||
}; | ||
return this.requester(req) | ||
return this._requester(req) | ||
.then(function (resp) { | ||
@@ -721,3 +717,2 @@ notice.id = resp.json.id; | ||
}; | ||
// TODO: fix wrapping for multiple clients | ||
BaseNotifier.prototype.wrap = function (fn, props) { | ||
@@ -1055,2 +1050,6 @@ if (props === void 0) { props = []; } | ||
} | ||
//TODO: deprecated | ||
if (_this._opt.ignoreWindowError) { | ||
opt.instrumentation.onerror = false; | ||
} | ||
_this._instrument(opt.instrumentation); | ||
@@ -1057,0 +1056,0 @@ return _this; |
@@ -602,3 +602,3 @@ import ErrorStackParser from 'error-stack-parser'; | ||
var _this = this; | ||
this.filters = []; | ||
this._filters = []; | ||
this._scope = new Scope(); | ||
@@ -613,5 +613,5 @@ this._onClose = []; | ||
this._opt.keysBlacklist = this._opt.keysBlacklist || [/password/, /secret/]; | ||
this.url = this._opt.host + "/api/v3/projects/" + this._opt.projectId + "/notices?key=" + this._opt.projectKey; | ||
this.processor = this._opt.processor || espProcessor; | ||
this.requester = makeRequester$1(this._opt); | ||
this._url = this._opt.host + "/api/v3/projects/" + this._opt.projectId + "/notices?key=" + this._opt.projectKey; | ||
this._processor = this._opt.processor || espProcessor; | ||
this._requester = makeRequester$1(this._opt); | ||
this.addFilter(ignoreNoiseFilter); | ||
@@ -641,3 +641,3 @@ this.addFilter(makeDebounceFilter()); | ||
BaseNotifier.prototype.addFilter = function (filter) { | ||
this.filters.push(filter); | ||
this._filters.push(filter); | ||
}; | ||
@@ -659,9 +659,5 @@ BaseNotifier.prototype.notify = function (err) { | ||
} | ||
if (this._opt.ignoreWindowError && err.context && err.context.windowError) { | ||
notice.error = new Error('airbrake: window error is ignored'); | ||
return Promise.resolve(notice); | ||
} | ||
var error = this.processor(err.error); | ||
var error = this._processor(err.error); | ||
notice.errors.push(error); | ||
for (var _i = 0, _a = this.filters; _i < _a.length; _i++) { | ||
for (var _i = 0, _a = this._filters; _i < _a.length; _i++) { | ||
var filter = _a[_i]; | ||
@@ -681,8 +677,8 @@ var r = filter(notice); | ||
name: 'airbrake-js', | ||
version: '1.0.0-beta.4', | ||
version: '1.0.0-beta.5', | ||
url: 'https://github.com/airbrake/airbrake-js', | ||
}; | ||
return this.sendNotice(notice); | ||
return this._sendNotice(notice); | ||
}; | ||
BaseNotifier.prototype.sendNotice = function (notice) { | ||
BaseNotifier.prototype._sendNotice = function (notice) { | ||
var body = jsonifyNotice(notice, { | ||
@@ -701,6 +697,6 @@ keysBlacklist: this._opt.keysBlacklist, | ||
method: 'POST', | ||
url: this.url, | ||
url: this._url, | ||
body: body, | ||
}; | ||
return this.requester(req) | ||
return this._requester(req) | ||
.then(function (resp) { | ||
@@ -715,3 +711,2 @@ notice.id = resp.json.id; | ||
}; | ||
// TODO: fix wrapping for multiple clients | ||
BaseNotifier.prototype.wrap = function (fn, props) { | ||
@@ -1049,2 +1044,6 @@ if (props === void 0) { props = []; } | ||
} | ||
//TODO: deprecated | ||
if (_this._opt.ignoreWindowError) { | ||
opt.instrumentation.onerror = false; | ||
} | ||
_this._instrument(opt.instrumentation); | ||
@@ -1051,0 +1050,0 @@ return _this; |
@@ -1,2 +0,2 @@ | ||
var Airbrake=function(t){"use strict";function e(t){var e=this.constructor;return this.then(function(r){return e.resolve(t()).then(function(){return r})},function(r){return e.resolve(t()).then(function(){return e.reject(r)})})}var r=setTimeout;function n(t){return Boolean(t&&void 0!==t.length)}function o(){}function i(t){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function s(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,i._immediateFn(function(){var r=1===t._state?e.onFulfilled:e.onRejected;if(null!==r){var n;try{n=r(t._value)}catch(t){return void u(e.promise,t)}a(e.promise,n)}else(1===t._state?a:u)(e.promise,t._value)})):t._deferreds.push(e)}function a(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof i)return t._state=3,t._value=e,void c(t);if("function"==typeof r)return void h((n=r,o=e,function(){n.apply(o,arguments)}),t)}t._state=1,t._value=e,c(t)}catch(e){u(t,e)}var n,o}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&i._immediateFn(function(){t._handled||i._unhandledRejectionFn(t._value)});for(var e=0,r=t._deferreds.length;e<r;e++)s(t,t._deferreds[e]);t._deferreds=null}function f(t,e,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=r}function h(t,e){var r=!1;try{t(function(t){r||(r=!0,a(e,t))},function(t){r||(r=!0,u(e,t))})}catch(t){if(r)return;r=!0,u(e,t)}}i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var r=new this.constructor(o);return s(this,new f(t,e,r)),r},i.prototype.finally=e,i.all=function(t){return new i(function(e,r){if(!n(t))return r(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(t);if(0===o.length)return e([]);var i=o.length;function s(t,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var a=n.then;if("function"==typeof a)return void a.call(n,function(e){s(t,e)},r)}o[t]=n,0==--i&&e(o)}catch(t){r(t)}}for(var a=0;a<o.length;a++)s(a,o[a])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,r){r(t)})},i.race=function(t){return new i(function(e,r){if(!n(t))return r(new TypeError("Promise.race accepts an array"));for(var o=0,s=t.length;o<s;o++)i.resolve(t[o]).then(e,r)})},i._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){r(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype.finally||(l.Promise.prototype.finally=e):l.Promise=i;var p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var d=function(){return(d=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},y=128;function v(t,e){return t>>e||1}var m=function(){function t(t){this.maxStringLength=1024,this.maxObjectLength=y,this.maxArrayLength=y,this.maxDepth=8,this.keys=[],this.keysBlacklist=[],this.seen=[];var e=t.level||0;this.keysBlacklist=t.keysBlacklist||[],this.maxStringLength=v(this.maxStringLength,e),this.maxObjectLength=v(this.maxObjectLength,e),this.maxArrayLength=v(this.maxArrayLength,e),this.maxDepth=v(this.maxDepth,e)}return t.prototype.truncate=function(t,e,r){if(void 0===e&&(e=""),void 0===r&&(r=0),null==t)return t;switch(typeof t){case"boolean":case"number":case"function":return t;case"string":return this.truncateString(t);case"object":break;default:return this.truncateString(String(t))}if(t instanceof String)return this.truncateString(t.toString());if(t instanceof Boolean||t instanceof Number||t instanceof Date||t instanceof RegExp)return t;if(t instanceof Error)return this.truncateString(t.toString());if(this.seen.indexOf(t)>=0)return"[Circular "+this.getPath(t)+"]";var n=function(t){return Object.prototype.toString.apply(t).slice("[object ".length,-1)}(t);if(++r>this.maxDepth)return"[Truncated "+n+"]";switch(this.keys.push(e),this.seen.push(t),n){case"Array":return this.truncateArray(t,r);case"Object":return this.truncateObject(t,r);default:var o=this.maxDepth;this.maxDepth=0;var i=this.truncateObject(t,r);return i.__type=n,this.maxDepth=o,i}},t.prototype.getPath=function(t){for(var e=this.seen.indexOf(t),r=[this.keys[e]],n=e;n>=0;n--){var o=this.seen[n];o&&b(o,r[0])===t&&(t=o,r.unshift(this.keys[n]))}return"~"+r.join(".")},t.prototype.truncateString=function(t){return t.length>this.maxStringLength?t.slice(0,this.maxStringLength)+"...":t},t.prototype.truncateArray=function(t,e){void 0===e&&(e=0);for(var r=0,n=[],o=0;o<t.length;o++){var i=t[o];if(n.push(this.truncate(i,o.toString(),e)),++r>=this.maxArrayLength)break}return n},t.prototype.truncateObject=function(t,e){void 0===e&&(e=0);var r=0,n={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))if(w(o,this.keysBlacklist))n[o]="[Filtered]";else{var i=b(t,o);if(void 0!==i&&"function"!=typeof i&&(n[o]=this.truncate(i,o,e),++r>=this.maxObjectLength))break}return n},t}();function g(t,e){return void 0===e&&(e={}),new m(e).truncate(t)}function b(t,e){try{return t[e]}catch(t){return}}function w(t,e){for(var r=0,n=e;r<n.length;r++){var o=n[r];if(o===t)return!0;if(o instanceof RegExp&&t.match(o))return!0}return!1}var _=function(){function t(){this._context={},this._historyMaxLen=20,this._history=[]}return t.prototype.clone=function(){var e=new t;return e._context=d({},this._context),e._history=this._history.slice(),e},t.prototype.setContext=function(t){this._context=Object.assign(this._context,t)},t.prototype.context=function(){var t=d({},this._context);return this._history.length>0&&(t.history=this._history.slice()),t},t.prototype.pushHistory=function(t){this._isDupState(t)?this._lastRecord.num?this._lastRecord.num++:this._lastRecord.num=2:(t.date||(t.date=new Date),this._history.push(t),this._lastRecord=t,this._history.length>this._historyMaxLen&&(this._history=this._history.slice(-this._historyMaxLen)))},t.prototype._isDupState=function(t){if(!this._lastRecord)return!1;for(var e in t)if(t.hasOwnProperty(e)&&"date"!==e&&t[e]!==this._lastRecord[e])return!1;return!0},t}(),x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(t,e){return t(e={exports:{}},e.exports),e.exports}var O=E(function(t,e){t.exports=function(){function t(t){return t.charAt(0).toUpperCase()+t.substring(1)}function e(t){return function(){return this[t]}}var r=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],i=r.concat(n,o,["args"]);function s(e){if(e instanceof Object)for(var r=0;r<i.length;r++)e.hasOwnProperty(i[r])&&void 0!==e[i[r]]&&this["set"+t(i[r])](e[i[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(t){if(t instanceof s)this.evalOrigin=t;else{if(!(t instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(t)}},toString:function(){var t=this.getFileName()||"",e=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?t?"[eval] ("+t+":"+e+":"+r+")":"[eval]:"+e+":"+r:n?n+" ("+t+":"+e+":"+r+")":t+":"+e+":"+r}},s.fromString=function(t){var e=t.indexOf("("),r=t.lastIndexOf(")"),n=t.substring(0,e),o=t.substring(e+1,r).split(","),i=t.substring(r+1);if(0===i.indexOf("@"))var a=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),u=a[1],c=a[2],f=a[3];return new s({functionName:n,args:o||void 0,fileName:u,lineNumber:c||void 0,columnNumber:f||void 0})};for(var a=0;a<r.length;a++)s.prototype["get"+t(r[a])]=e(r[a]),s.prototype["set"+t(r[a])]=function(t){return function(e){this[t]=Boolean(e)}}(r[a]);for(var u=0;u<n.length;u++)s.prototype["get"+t(n[u])]=e(n[u]),s.prototype["set"+t(n[u])]=function(t){return function(e){if(r=e,isNaN(parseFloat(r))||!isFinite(r))throw new TypeError(t+" must be a Number");var r;this[t]=Number(e)}}(n[u]);for(var c=0;c<o.length;c++)s.prototype["get"+t(o[c])]=e(o[c]),s.prototype["set"+t(o[c])]=function(t){return function(e){this[t]=String(e)}}(o[c]);return s}()}),j=E(function(t,e){var r,n,o,i;t.exports=(r=O,n=/(^|@)\S+\:\d+/,o=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/,{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(o))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){var e=t.stack.split("\n").filter(function(t){return!!t.match(o)},this);return e.map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=e.match(/ (\((.+):(\d+):(\d+)\)$)/),o=(e=n?e.replace(n[0],""):e).split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:o.pop()),s=o.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new r({functionName:s,fileName:a,lineNumber:i[1],columnNumber:i[2],source:t})},this)},parseFFOrSafari:function(t){var e=t.stack.split("\n").filter(function(t){return!t.match(i)},this);return e.map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new r({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),o=n&&n[1]?n[1]:void 0,i=this.extractLocation(t.replace(e,""));return new r({functionName:o,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:t})},this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),o=[],i=2,s=n.length;i<s;i+=2){var a=e.exec(n[i]);a&&o.push(new r({fileName:a[2],lineNumber:a[1],source:n[i]}))}return o},parseOpera10:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),o=[],i=0,s=n.length;i<s;i+=2){var a=e.exec(n[i]);a&&o.push(new r({functionName:a[3]||void 0,fileName:a[2],lineNumber:a[1],source:n[i]}))}return o},parseOpera11:function(t){var e=t.stack.split("\n").filter(function(t){return!!t.match(n)&&!t.match(/^Error created at/)},this);return e.map(function(t){var e,n=t.split("@"),o=this.extractLocation(n.pop()),i=n.shift()||"",s=i.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(e=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===e||"[arguments not available]"===e?void 0:e.split(",");return new r({functionName:s,args:a,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})},this)}})}),k="object"==typeof console&&console.warn;function N(t){try{return j.parse(t)}catch(e){k&&t.stack&&console.warn("ErrorStackParser:",e.toString(),t.stack)}return t.fileName?[t]:[]}function S(t){var e=[];if(t.noStack)e.push({function:t.functionName||"",file:t.fileName||"",line:t.lineNumber||0,column:t.columnNumber||0});else{var r=N(t);if(0===r.length)try{throw new Error("fake")}catch(t){(r=N(t)).shift(),r.shift()}for(var n=0,o=r;n<o.length;n++){var i=o[n];e.push({function:i.functionName||"",file:i.fileName||"",line:i.lineNumber||0,column:i.columnNumber||0})}}return{type:t.name?t.name:"",message:t.message?String(t.message):String(t),backtrace:e}}var A=new RegExp(["^","\\[(\\$.+)\\]","\\s","([\\s\\S]+)","$"].join(""));function L(t){var e=t.errors[0];if(""!==e.type&&"Error"!==e.type)return t;var r=e.message.match(A);return null!==r&&(e.type=r[1],e.message=r[2]),t}var T=["Script error","Script error.","InvalidAccessError"];function R(t){var e=t.errors[0];if(""===e.type&&-1!==T.indexOf(e.message))return null;if(e.backtrace&&e.backtrace.length>0&&"<anonymous>"===e.backtrace[0].file)return null;return t}var P=new RegExp(["^","Uncaught\\s","(.+?)",":\\s","(.+)","$"].join(""));function D(t){var e=t.errors[0];if(""!==e.type&&"Error"!==e.type)return t;var r=e.message.match(P);return null!==r&&(e.type=r[1],e.message=r[2]),t}var B=E(function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:x);!function(t){!function(e){var r={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(r.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function s(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r.iterable&&(e[Symbol.iterator]=function(){return e}),e}function u(t){this.map={},t instanceof u?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function h(t){var e=new FileReader,r=f(e);return e.readAsArrayBuffer(t),r}function l(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function p(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r.arrayBuffer&&r.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=l(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(t))?this._bodyArrayBuffer=l(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=f(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(t,e){t=i(t),e=s(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},u.prototype.delete=function(t){delete this.map[i(t)]},u.prototype.get=function(t){return t=i(t),this.has(t)?this.map[t]:null},u.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},u.prototype.set=function(t,e){this.map[i(t)]=s(e)},u.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},u.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),a(t)},u.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),a(t)},u.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),a(t)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,e){var r,n,o=(e=e||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new u(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new u(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),d.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function v(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function m(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new u(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},p.call(y.prototype),p.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},m.error=function(){var t=new m(null,{status:0,statusText:""});return t.type="error",t};var g=[301,302,303,307,308];m.redirect=function(t,e){if(-1===g.indexOf(e))throw new RangeError("Invalid status code");return new m(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function b(t,n){return new Promise(function(o,i){var s=new y(t,n);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new u,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;o(new m(n,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r.blob&&(a.responseType="blob"),s.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)})}b.polyfill=!0,t.fetch||(t.fetch=b,t.Headers=u,t.Request=y,t.Response=m),e.Headers=u,e.Request=y,e.Response=m,e.fetch=b}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}),F=(B.fetch,B.Headers,B.Request,B.Response,{unauthorized:new Error("airbrake: unauthorized: project id or key are wrong"),ipRateLimited:new Error("airbrake: IP is rate limited")}),C=0;function U(t){if(Date.now()/1e3<C)return Promise.reject(F.ipRateLimited);var e={method:t.method,body:t.body};return B(t.url,e).then(function(t){if(401===t.status)throw F.unauthorized;if(429===t.status){var e=t.headers.get("X-RateLimit-Delay");if(!e)throw F.ipRateLimited;var r=parseInt(e,10);throw r>0&&(C=Date.now()/1e3+r),F.ipRateLimited}if(204===t.status)return{json:null};if(404===t.status)throw new Error("404 Not Found");return t.status>=200&&t.status<300?t.json().then(function(t){return{json:t}}):t.status>=400&&t.status<500?t.json().then(function(t){throw new Error(t.message)}):t.text().then(function(e){throw new Error("airbrake: fetch: unexpected response: code="+t.status+" body='"+e+"'")})})}function I(t){return function(e){return function(t,e){if(Date.now()/1e3<H)return Promise.reject(F.ipRateLimited);return new Promise(function(r,n){e({url:t.url,method:t.method,body:t.body,headers:{"content-type":"application/json"},timeout:t.timeout},function(t,e,o){if(t)n(t);else{if(!e.statusCode)return t=new Error("airbrake: request: response statusCode is "+e.statusCode),void n(t);if(401!==e.statusCode)if(429!==e.statusCode)if(204!==e.statusCode)if(e.statusCode>=200&&e.statusCode<300){var i=void 0;try{i=JSON.parse(o)}catch(t){return void n(t)}r(i)}else{if(e.statusCode>=400&&e.statusCode<500){var i=void 0;try{i=JSON.parse(o)}catch(t){return void n(t)}return t=new Error(i.message),void n(t)}o=o.trim(),t=new Error("airbrake: node: unexpected response: code="+e.statusCode+" body='"+o+"'"),n(t)}else r({json:null});else{n(F.ipRateLimited);var s=e.headers["x-ratelimit-delay"];if(!s)return;var a=void 0;if("string"==typeof s)a=s;else{if(!(s instanceof Array))return;a=s[0]}var u=parseInt(a,10);u>0&&(H=Date.now()/1e3+u)}else n(F.unauthorized)}})})}(e,t)}}var H=0;var q=function(){function t(t){var e,r,n,o=this;if(this.filters=[],this._scope=new _,this._onClose=[],!t.projectId||!t.projectKey)throw new Error("airbrake: projectId and projectKey are required");this._opt=t,this._opt.host=this._opt.host||"https://api.airbrake.io",this._opt.timeout=this._opt.timeout||1e4,this._opt.keysBlacklist=this._opt.keysBlacklist||[/password/,/secret/],this.url=this._opt.host+"/api/v3/projects/"+this._opt.projectId+"/notices?key="+this._opt.projectKey,this.processor=this._opt.processor||S,this.requester=(e=this._opt).request?I(e.request):U,this.addFilter(R),this.addFilter(function(t){var e=JSON.stringify(t.errors);return e===r?null:(n&&clearTimeout(n),r=e,n=setTimeout(function(){r=""},1e3),t)}),this.addFilter(D),this.addFilter(L),this._opt.environment&&this.addFilter(function(t){return t.context.environment=o._opt.environment,t}),this.addFilter(function(t){return t})}return t.prototype.close=function(){for(var t=0,e=this._onClose;t<e.length;t++){(0,e[t])()}},t.prototype.scope=function(){return this._scope},t.prototype.addFilter=function(t){this.filters.push(t)},t.prototype.notify=function(t){var e={errors:[],context:Object.assign({severity:"error"},this.scope().context(),t.context),params:t.params||{},environment:t.environment||{},session:t.session||{}};if("object"==typeof t&&void 0!==t.error||(t={error:t}),!t.error)return e.error=new Error("airbrake: got err="+JSON.stringify(t.error)+", wanted an Error"),Promise.resolve(e);if(this._opt.ignoreWindowError&&t.context&&t.context.windowError)return e.error=new Error("airbrake: window error is ignored"),Promise.resolve(e);var r=this.processor(t.error);e.errors.push(r);for(var n=0,o=this.filters;n<o.length;n++){var i=(0,o[n])(e);if(null===i)return e.error=new Error("airbrake: error is filtered"),Promise.resolve(e);e=i}return e.context||(e.context={}),e.context.language="JavaScript",e.context.notifier={name:"airbrake-js",version:"1.0.0-beta.4",url:"https://github.com/airbrake/airbrake-js"},this.sendNotice(e)},t.prototype.sendNotice=function(t){var e=function(t,e){var r=void 0===e?{}:e,n=r.maxLength,o=void 0===n?64e3:n,i=r.keysBlacklist,s=void 0===i?[]:i;if(t.errors)for(var a=0;a<t.errors.length;a++){var u=new m({keysBlacklist:s});t.errors[a]=u.truncate(t.errors[a])}for(var c="",f=["context","params","environment","session"],h=0;h<8;h++){for(var l={level:h,keysBlacklist:s},p=0,d=f;p<d.length;p++)(_=t[w=d[p]])&&(t[w]=g(_,l));if((c=JSON.stringify(t)).length<o)return c}var y={json:c.slice(0,Math.floor(o/2))+"..."};f.push("errors");for(var v=0,b=f;v<b.length;v++){var w,_;(_=t[w=b[v]])&&(c=JSON.stringify(_),y[w]=c.length)}var x=new Error("airbrake: notice exceeds max length and can't be truncated");throw x.params=y,x}(t,{keysBlacklist:this._opt.keysBlacklist});if(this._opt.reporter){if("function"==typeof this._opt.reporter)return this._opt.reporter(t);console.warn("airbrake: options.reporter must be a function")}var r={method:"POST",url:this.url,body:e};return this.requester(r).then(function(e){return t.id=e.json.id,t}).catch(function(e){return t.error=e,t})},t.prototype.wrap=function(t,e){if(void 0===e&&(e=[]),t._airbrake)return t;var r=this,n=function(){var e=Array.prototype.slice.call(arguments),n=r._wrapArguments(e);try{return t.apply(this,n)}catch(t){throw r.notify({error:t,params:{arguments:e}}),this._ignoreNextWindowError(),t}};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);for(var i=0,s=e;i<s.length;i++){o=s[i];t.hasOwnProperty(o)&&(n[o]=t[o])}return n._airbrake=!0,n.inner=t,n},t.prototype._wrapArguments=function(t){for(var e=0;e<t.length;e++){var r=t[e];"function"==typeof r&&(t[e]=this.wrap(r))}return t},t.prototype._ignoreNextWindowError=function(){},t.prototype.call=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this.wrap(t);return n.apply(this,Array.prototype.slice.call(arguments,1))},t}();function M(t){return window.navigator&&window.navigator.userAgent&&(t.context.userAgent=window.navigator.userAgent),window.location&&(t.context.url=String(window.location),t.context.rootDirectory=window.location.protocol+"//"+window.location.host),t}var $=["debug","log","info","warn","error"];var X=["type","name","src"];function W(t){var e=function(t){return function(e){var r;try{r=e.target}catch(t){return}if(r){var n={type:e.type};try{n.target=function(t){var e=[],r=t;for(;r;){var n=J(r);if(""!==n&&(e.push(n),e.length>10))break;r=r.parentNode}if(0===e.length)return String(t);return e.reverse().join(" > ")}(r)}catch(t){n.target="<"+String(t)+">"}t.scope().pushHistory(n)}}}(t);window.addEventListener&&(window.addEventListener("load",e),window.addEventListener("error",function(t){"error"in t||e(t)},!0)),"object"==typeof document&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",e),document.addEventListener("click",e),document.addEventListener("keypress",e))}function J(t){if(!t)return"";var e=[];if(t.tagName&&e.push(t.tagName.toLowerCase()),t.id&&(e.push("#"),e.push(t.id)),t.classList&&Array.from)e.push("."),e.push(Array.from(t.classList).join("."));else if(t.className){var r=function(t){if(t.split)return t.split(" ").join(".");if(t.baseVal&&t.baseVal.split)return t.baseVal.split(" ").join(".");return console.error("unsupported HTMLElement.className type",typeof t),""}(t.className);""!==r&&(e.push("."),e.push(r))}if(t.getAttribute)for(var n=0,o=X;n<o.length;n++){var i=o[n],s=t.getAttribute(i);s&&e.push("["+i+'="'+s+'"]')}return e.join("")}var V="";function z(t,e){var r=e.indexOf("://");r>=0?(r=(e=e.slice(r+3)).indexOf("/"),e=r>=0?e.slice(r):"/"):"/"!==e.charAt(0)&&(e="/"+e),t.scope().pushHistory({type:"location",from:V,to:e}),V=e}var G=function(t){function e(e){var r=t.call(this,e)||this;return r.offline=!1,r.todo=[],r._ignoreWindowError=0,r._ignoreNextXHR=0,r.addFilter(M),window.addEventListener&&(r.onOnline=r.onOnline.bind(r),window.addEventListener("online",r.onOnline),r.onOffline=r.onOffline.bind(r),window.addEventListener("offline",r.onOffline),r.onUnhandledrejection=r.onUnhandledrejection.bind(r),window.addEventListener("unhandledrejection",r.onUnhandledrejection),r._onClose.push(function(){window.removeEventListener("online",r.onOnline),window.removeEventListener("offline",r.onOffline),window.removeEventListener("unhandledrejection",r.onUnhandledrejection)})),r._instrument(e.instrumentation),r}return function(t,e){function r(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype._instrument=function(t){var e,r,n;if(void 0===t&&(t={}),t.console=!((e=this._opt.environment)&&e.startsWith&&e.startsWith("dev")),K(t.onerror)){var o=this,i=window.onerror;window.onerror=function(){i&&i.apply(this,arguments),o.onerror.apply(o,arguments)}}W(this),K(t.fetch)&&"function"==typeof fetch&&(r=this,n=window.fetch,window.fetch=function(t,e){var o={type:"xhr",date:new Date};return o.method=e&&e.method?e.method:"GET","string"==typeof t?o.url=t:(o.method=t.method,o.url=t.url),r._ignoreNextXHR++,setTimeout(function(){return r._ignoreNextXHR--}),n.apply(this,arguments).then(function(t){return o.statusCode=t.status,o.duration=(new Date).getTime()-o.date.getTime(),r.scope().pushHistory(o),t}).catch(function(t){throw o.error=t,o.duration=(new Date).getTime()-o.date.getTime(),r.scope().pushHistory(o),t})}),K(t.history)&&"object"==typeof history&&function(t){V=document.location.pathname;var e=window.onpopstate;window.onpopstate=function(r){if(z(t,document.location.pathname),e)return e.apply(this,arguments)};var r=history.pushState;history.pushState=function(e,n,o){o&&z(t,o.toString()),r.apply(this,arguments)}}(this),K(t.console)&&"object"==typeof console&&function(t){for(var e=function(e){if(!(e in console))return"continue";var r=console[e],n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];r.apply(console,n),t.scope().pushHistory({type:"log",severity:e,arguments:n})};n.inner=r,console[e]=n},r=0,n=$;r<n.length;r++)e(n[r])}(this),K(t.xhr)&&"undefined"!=typeof XMLHttpRequest&&function(t){function e(e){var r=e.__state;r.statusCode=e.status,r.duration=(new Date).getTime()-r.date.getTime(),t.scope().pushHistory(r)}var r=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(e,n,o,i,s){0===t._ignoreNextXHR&&(this.__state={type:"xhr",method:e,url:n}),r.apply(this,arguments)};var n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(t){var r=this.onreadystatechange;return this.onreadystatechange=function(t){if(4===this.readyState&&this.__state&&e(this),r)return r.apply(this,arguments)},this.__state&&(this.__state.date=new Date),n.apply(this,arguments)}}(this)},e.prototype.notify=function(e){var r=this;return this.offline?new Promise(function(t,n){for(r.todo.push({err:e,resolve:t,reject:n});r.todo.length>100;){var o=r.todo.shift();if(void 0===o)break;o.resolve({error:new Error("airbrake: offline queue is too large")})}}):t.prototype.notify.call(this,e)},e.prototype.onOnline=function(){this.offline=!1;for(var t=function(t){e.notify(t.err).then(function(e){t.resolve(e)})},e=this,r=0,n=this.todo;r<n.length;r++){t(n[r])}this.todo=[]},e.prototype.onOffline=function(){this.offline=!0},e.prototype.onUnhandledrejection=function(t){var e=t.reason||t.detail&&t.detail.reason;if(e){var r=e.message||String(e);r.indexOf&&0===r.indexOf("airbrake: ")||this.notify(e)}},e.prototype.onerror=function(t,e,r,n,o){this._ignoreWindowError>0||(o?this.notify({error:o,context:{windowError:!0}}):e&&r&&this.notify({error:{message:t,fileName:e,lineNumber:r,columnNumber:n,noStack:!0},context:{windowError:!0}}))},e.prototype._ignoreNextWindowError=function(){var t=this;this._ignoreWindowError++,setTimeout(function(){return t._ignoreWindowError--})},e}(q);function K(t){return void 0===t||!0===t}return t.Notifier=G,t}({}); | ||
var Airbrake=function(t){"use strict";function e(t){var e=this.constructor;return this.then(function(r){return e.resolve(t()).then(function(){return r})},function(r){return e.resolve(t()).then(function(){return e.reject(r)})})}var r=setTimeout;function n(t){return Boolean(t&&void 0!==t.length)}function o(){}function i(t){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function s(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,i._immediateFn(function(){var r=1===t._state?e.onFulfilled:e.onRejected;if(null!==r){var n;try{n=r(t._value)}catch(t){return void u(e.promise,t)}a(e.promise,n)}else(1===t._state?a:u)(e.promise,t._value)})):t._deferreds.push(e)}function a(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof i)return t._state=3,t._value=e,void c(t);if("function"==typeof r)return void h((n=r,o=e,function(){n.apply(o,arguments)}),t)}t._state=1,t._value=e,c(t)}catch(e){u(t,e)}var n,o}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&i._immediateFn(function(){t._handled||i._unhandledRejectionFn(t._value)});for(var e=0,r=t._deferreds.length;e<r;e++)s(t,t._deferreds[e]);t._deferreds=null}function f(t,e,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=r}function h(t,e){var r=!1;try{t(function(t){r||(r=!0,a(e,t))},function(t){r||(r=!0,u(e,t))})}catch(t){if(r)return;r=!0,u(e,t)}}i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var r=new this.constructor(o);return s(this,new f(t,e,r)),r},i.prototype.finally=e,i.all=function(t){return new i(function(e,r){if(!n(t))return r(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(t);if(0===o.length)return e([]);var i=o.length;function s(t,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var a=n.then;if("function"==typeof a)return void a.call(n,function(e){s(t,e)},r)}o[t]=n,0==--i&&e(o)}catch(t){r(t)}}for(var a=0;a<o.length;a++)s(a,o[a])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,r){r(t)})},i.race=function(t){return new i(function(e,r){if(!n(t))return r(new TypeError("Promise.race accepts an array"));for(var o=0,s=t.length;o<s;o++)i.resolve(t[o]).then(e,r)})},i._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){r(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var p=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();"Promise"in p?p.Promise.prototype.finally||(p.Promise.prototype.finally=e):p.Promise=i;var l=function(t,e){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var d=function(){return(d=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},y=128;function v(t,e){return t>>e||1}var m=function(){function t(t){this.maxStringLength=1024,this.maxObjectLength=y,this.maxArrayLength=y,this.maxDepth=8,this.keys=[],this.keysBlacklist=[],this.seen=[];var e=t.level||0;this.keysBlacklist=t.keysBlacklist||[],this.maxStringLength=v(this.maxStringLength,e),this.maxObjectLength=v(this.maxObjectLength,e),this.maxArrayLength=v(this.maxArrayLength,e),this.maxDepth=v(this.maxDepth,e)}return t.prototype.truncate=function(t,e,r){if(void 0===e&&(e=""),void 0===r&&(r=0),null==t)return t;switch(typeof t){case"boolean":case"number":case"function":return t;case"string":return this.truncateString(t);case"object":break;default:return this.truncateString(String(t))}if(t instanceof String)return this.truncateString(t.toString());if(t instanceof Boolean||t instanceof Number||t instanceof Date||t instanceof RegExp)return t;if(t instanceof Error)return this.truncateString(t.toString());if(this.seen.indexOf(t)>=0)return"[Circular "+this.getPath(t)+"]";var n=function(t){return Object.prototype.toString.apply(t).slice("[object ".length,-1)}(t);if(++r>this.maxDepth)return"[Truncated "+n+"]";switch(this.keys.push(e),this.seen.push(t),n){case"Array":return this.truncateArray(t,r);case"Object":return this.truncateObject(t,r);default:var o=this.maxDepth;this.maxDepth=0;var i=this.truncateObject(t,r);return i.__type=n,this.maxDepth=o,i}},t.prototype.getPath=function(t){for(var e=this.seen.indexOf(t),r=[this.keys[e]],n=e;n>=0;n--){var o=this.seen[n];o&&b(o,r[0])===t&&(t=o,r.unshift(this.keys[n]))}return"~"+r.join(".")},t.prototype.truncateString=function(t){return t.length>this.maxStringLength?t.slice(0,this.maxStringLength)+"...":t},t.prototype.truncateArray=function(t,e){void 0===e&&(e=0);for(var r=0,n=[],o=0;o<t.length;o++){var i=t[o];if(n.push(this.truncate(i,o.toString(),e)),++r>=this.maxArrayLength)break}return n},t.prototype.truncateObject=function(t,e){void 0===e&&(e=0);var r=0,n={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))if(w(o,this.keysBlacklist))n[o]="[Filtered]";else{var i=b(t,o);if(void 0!==i&&"function"!=typeof i&&(n[o]=this.truncate(i,o,e),++r>=this.maxObjectLength))break}return n},t}();function g(t,e){return void 0===e&&(e={}),new m(e).truncate(t)}function b(t,e){try{return t[e]}catch(t){return}}function w(t,e){for(var r=0,n=e;r<n.length;r++){var o=n[r];if(o===t)return!0;if(o instanceof RegExp&&t.match(o))return!0}return!1}var _=function(){function t(){this._context={},this._historyMaxLen=20,this._history=[]}return t.prototype.clone=function(){var e=new t;return e._context=d({},this._context),e._history=this._history.slice(),e},t.prototype.setContext=function(t){this._context=Object.assign(this._context,t)},t.prototype.context=function(){var t=d({},this._context);return this._history.length>0&&(t.history=this._history.slice()),t},t.prototype.pushHistory=function(t){this._isDupState(t)?this._lastRecord.num?this._lastRecord.num++:this._lastRecord.num=2:(t.date||(t.date=new Date),this._history.push(t),this._lastRecord=t,this._history.length>this._historyMaxLen&&(this._history=this._history.slice(-this._historyMaxLen)))},t.prototype._isDupState=function(t){if(!this._lastRecord)return!1;for(var e in t)if(t.hasOwnProperty(e)&&"date"!==e&&t[e]!==this._lastRecord[e])return!1;return!0},t}(),x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(t,e){return t(e={exports:{}},e.exports),e.exports}var O=E(function(t,e){t.exports=function(){function t(t){return t.charAt(0).toUpperCase()+t.substring(1)}function e(t){return function(){return this[t]}}var r=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],i=r.concat(n,o,["args"]);function s(e){if(e instanceof Object)for(var r=0;r<i.length;r++)e.hasOwnProperty(i[r])&&void 0!==e[i[r]]&&this["set"+t(i[r])](e[i[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(t){if(t instanceof s)this.evalOrigin=t;else{if(!(t instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(t)}},toString:function(){var t=this.getFileName()||"",e=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?t?"[eval] ("+t+":"+e+":"+r+")":"[eval]:"+e+":"+r:n?n+" ("+t+":"+e+":"+r+")":t+":"+e+":"+r}},s.fromString=function(t){var e=t.indexOf("("),r=t.lastIndexOf(")"),n=t.substring(0,e),o=t.substring(e+1,r).split(","),i=t.substring(r+1);if(0===i.indexOf("@"))var a=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),u=a[1],c=a[2],f=a[3];return new s({functionName:n,args:o||void 0,fileName:u,lineNumber:c||void 0,columnNumber:f||void 0})};for(var a=0;a<r.length;a++)s.prototype["get"+t(r[a])]=e(r[a]),s.prototype["set"+t(r[a])]=function(t){return function(e){this[t]=Boolean(e)}}(r[a]);for(var u=0;u<n.length;u++)s.prototype["get"+t(n[u])]=e(n[u]),s.prototype["set"+t(n[u])]=function(t){return function(e){if(r=e,isNaN(parseFloat(r))||!isFinite(r))throw new TypeError(t+" must be a Number");var r;this[t]=Number(e)}}(n[u]);for(var c=0;c<o.length;c++)s.prototype["get"+t(o[c])]=e(o[c]),s.prototype["set"+t(o[c])]=function(t){return function(e){this[t]=String(e)}}(o[c]);return s}()}),j=E(function(t,e){var r,n,o,i;t.exports=(r=O,n=/(^|@)\S+\:\d+/,o=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/,{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(o))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){var e=t.stack.split("\n").filter(function(t){return!!t.match(o)},this);return e.map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=e.match(/ (\((.+):(\d+):(\d+)\)$)/),o=(e=n?e.replace(n[0],""):e).split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:o.pop()),s=o.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new r({functionName:s,fileName:a,lineNumber:i[1],columnNumber:i[2],source:t})},this)},parseFFOrSafari:function(t){var e=t.stack.split("\n").filter(function(t){return!t.match(i)},this);return e.map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new r({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),o=n&&n[1]?n[1]:void 0,i=this.extractLocation(t.replace(e,""));return new r({functionName:o,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:t})},this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),o=[],i=2,s=n.length;i<s;i+=2){var a=e.exec(n[i]);a&&o.push(new r({fileName:a[2],lineNumber:a[1],source:n[i]}))}return o},parseOpera10:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),o=[],i=0,s=n.length;i<s;i+=2){var a=e.exec(n[i]);a&&o.push(new r({functionName:a[3]||void 0,fileName:a[2],lineNumber:a[1],source:n[i]}))}return o},parseOpera11:function(t){var e=t.stack.split("\n").filter(function(t){return!!t.match(n)&&!t.match(/^Error created at/)},this);return e.map(function(t){var e,n=t.split("@"),o=this.extractLocation(n.pop()),i=n.shift()||"",s=i.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(e=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===e||"[arguments not available]"===e?void 0:e.split(",");return new r({functionName:s,args:a,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})},this)}})}),k="object"==typeof console&&console.warn;function N(t){try{return j.parse(t)}catch(e){k&&t.stack&&console.warn("ErrorStackParser:",e.toString(),t.stack)}return t.fileName?[t]:[]}function S(t){var e=[];if(t.noStack)e.push({function:t.functionName||"",file:t.fileName||"",line:t.lineNumber||0,column:t.columnNumber||0});else{var r=N(t);if(0===r.length)try{throw new Error("fake")}catch(t){(r=N(t)).shift(),r.shift()}for(var n=0,o=r;n<o.length;n++){var i=o[n];e.push({function:i.functionName||"",file:i.fileName||"",line:i.lineNumber||0,column:i.columnNumber||0})}}return{type:t.name?t.name:"",message:t.message?String(t.message):String(t),backtrace:e}}var A=new RegExp(["^","\\[(\\$.+)\\]","\\s","([\\s\\S]+)","$"].join(""));function L(t){var e=t.errors[0];if(""!==e.type&&"Error"!==e.type)return t;var r=e.message.match(A);return null!==r&&(e.type=r[1],e.message=r[2]),t}var T=["Script error","Script error.","InvalidAccessError"];function R(t){var e=t.errors[0];if(""===e.type&&-1!==T.indexOf(e.message))return null;if(e.backtrace&&e.backtrace.length>0&&"<anonymous>"===e.backtrace[0].file)return null;return t}var P=new RegExp(["^","Uncaught\\s","(.+?)",":\\s","(.+)","$"].join(""));function D(t){var e=t.errors[0];if(""!==e.type&&"Error"!==e.type)return t;var r=e.message.match(P);return null!==r&&(e.type=r[1],e.message=r[2]),t}var B=E(function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:x);!function(t){!function(e){var r={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(r.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function s(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r.iterable&&(e[Symbol.iterator]=function(){return e}),e}function u(t){this.map={},t instanceof u?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function h(t){var e=new FileReader,r=f(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function l(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r.arrayBuffer&&r.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=f(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(t,e){t=i(t),e=s(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},u.prototype.delete=function(t){delete this.map[i(t)]},u.prototype.get=function(t){return t=i(t),this.has(t)?this.map[t]:null},u.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},u.prototype.set=function(t,e){this.map[i(t)]=s(e)},u.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},u.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),a(t)},u.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),a(t)},u.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),a(t)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,e){var r,n,o=(e=e||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new u(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new u(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),d.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function v(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function m(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new u(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},l.call(y.prototype),l.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},m.error=function(){var t=new m(null,{status:0,statusText:""});return t.type="error",t};var g=[301,302,303,307,308];m.redirect=function(t,e){if(-1===g.indexOf(e))throw new RangeError("Invalid status code");return new m(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function b(t,n){return new Promise(function(o,i){var s=new y(t,n);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new u,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;o(new m(n,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r.blob&&(a.responseType="blob"),s.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)})}b.polyfill=!0,t.fetch||(t.fetch=b,t.Headers=u,t.Request=y,t.Response=m),e.Headers=u,e.Request=y,e.Response=m,e.fetch=b}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}),F=(B.fetch,B.Headers,B.Request,B.Response,{unauthorized:new Error("airbrake: unauthorized: project id or key are wrong"),ipRateLimited:new Error("airbrake: IP is rate limited")}),C=0;function U(t){if(Date.now()/1e3<C)return Promise.reject(F.ipRateLimited);var e={method:t.method,body:t.body};return B(t.url,e).then(function(t){if(401===t.status)throw F.unauthorized;if(429===t.status){var e=t.headers.get("X-RateLimit-Delay");if(!e)throw F.ipRateLimited;var r=parseInt(e,10);throw r>0&&(C=Date.now()/1e3+r),F.ipRateLimited}if(204===t.status)return{json:null};if(404===t.status)throw new Error("404 Not Found");return t.status>=200&&t.status<300?t.json().then(function(t){return{json:t}}):t.status>=400&&t.status<500?t.json().then(function(t){throw new Error(t.message)}):t.text().then(function(e){throw new Error("airbrake: fetch: unexpected response: code="+t.status+" body='"+e+"'")})})}function I(t){return function(e){return function(t,e){if(Date.now()/1e3<H)return Promise.reject(F.ipRateLimited);return new Promise(function(r,n){e({url:t.url,method:t.method,body:t.body,headers:{"content-type":"application/json"},timeout:t.timeout},function(t,e,o){if(t)n(t);else{if(!e.statusCode)return t=new Error("airbrake: request: response statusCode is "+e.statusCode),void n(t);if(401!==e.statusCode)if(429!==e.statusCode)if(204!==e.statusCode)if(e.statusCode>=200&&e.statusCode<300){var i=void 0;try{i=JSON.parse(o)}catch(t){return void n(t)}r(i)}else{if(e.statusCode>=400&&e.statusCode<500){var i=void 0;try{i=JSON.parse(o)}catch(t){return void n(t)}return t=new Error(i.message),void n(t)}o=o.trim(),t=new Error("airbrake: node: unexpected response: code="+e.statusCode+" body='"+o+"'"),n(t)}else r({json:null});else{n(F.ipRateLimited);var s=e.headers["x-ratelimit-delay"];if(!s)return;var a=void 0;if("string"==typeof s)a=s;else{if(!(s instanceof Array))return;a=s[0]}var u=parseInt(a,10);u>0&&(H=Date.now()/1e3+u)}else n(F.unauthorized)}})})}(e,t)}}var H=0;var q=function(){function t(t){var e,r,n,o=this;if(this._filters=[],this._scope=new _,this._onClose=[],!t.projectId||!t.projectKey)throw new Error("airbrake: projectId and projectKey are required");this._opt=t,this._opt.host=this._opt.host||"https://api.airbrake.io",this._opt.timeout=this._opt.timeout||1e4,this._opt.keysBlacklist=this._opt.keysBlacklist||[/password/,/secret/],this._url=this._opt.host+"/api/v3/projects/"+this._opt.projectId+"/notices?key="+this._opt.projectKey,this._processor=this._opt.processor||S,this._requester=(e=this._opt).request?I(e.request):U,this.addFilter(R),this.addFilter(function(t){var e=JSON.stringify(t.errors);return e===r?null:(n&&clearTimeout(n),r=e,n=setTimeout(function(){r=""},1e3),t)}),this.addFilter(D),this.addFilter(L),this._opt.environment&&this.addFilter(function(t){return t.context.environment=o._opt.environment,t}),this.addFilter(function(t){return t})}return t.prototype.close=function(){for(var t=0,e=this._onClose;t<e.length;t++){(0,e[t])()}},t.prototype.scope=function(){return this._scope},t.prototype.addFilter=function(t){this._filters.push(t)},t.prototype.notify=function(t){var e={errors:[],context:Object.assign({severity:"error"},this.scope().context(),t.context),params:t.params||{},environment:t.environment||{},session:t.session||{}};if("object"==typeof t&&void 0!==t.error||(t={error:t}),!t.error)return e.error=new Error("airbrake: got err="+JSON.stringify(t.error)+", wanted an Error"),Promise.resolve(e);var r=this._processor(t.error);e.errors.push(r);for(var n=0,o=this._filters;n<o.length;n++){var i=(0,o[n])(e);if(null===i)return e.error=new Error("airbrake: error is filtered"),Promise.resolve(e);e=i}return e.context||(e.context={}),e.context.language="JavaScript",e.context.notifier={name:"airbrake-js",version:"1.0.0-beta.5",url:"https://github.com/airbrake/airbrake-js"},this._sendNotice(e)},t.prototype._sendNotice=function(t){var e=function(t,e){var r=void 0===e?{}:e,n=r.maxLength,o=void 0===n?64e3:n,i=r.keysBlacklist,s=void 0===i?[]:i;if(t.errors)for(var a=0;a<t.errors.length;a++){var u=new m({keysBlacklist:s});t.errors[a]=u.truncate(t.errors[a])}for(var c="",f=["context","params","environment","session"],h=0;h<8;h++){for(var p={level:h,keysBlacklist:s},l=0,d=f;l<d.length;l++)(_=t[w=d[l]])&&(t[w]=g(_,p));if((c=JSON.stringify(t)).length<o)return c}var y={json:c.slice(0,Math.floor(o/2))+"..."};f.push("errors");for(var v=0,b=f;v<b.length;v++){var w,_;(_=t[w=b[v]])&&(c=JSON.stringify(_),y[w]=c.length)}var x=new Error("airbrake: notice exceeds max length and can't be truncated");throw x.params=y,x}(t,{keysBlacklist:this._opt.keysBlacklist});if(this._opt.reporter){if("function"==typeof this._opt.reporter)return this._opt.reporter(t);console.warn("airbrake: options.reporter must be a function")}var r={method:"POST",url:this._url,body:e};return this._requester(r).then(function(e){return t.id=e.json.id,t}).catch(function(e){return t.error=e,t})},t.prototype.wrap=function(t,e){if(void 0===e&&(e=[]),t._airbrake)return t;var r=this,n=function(){var e=Array.prototype.slice.call(arguments),n=r._wrapArguments(e);try{return t.apply(this,n)}catch(t){throw r.notify({error:t,params:{arguments:e}}),this._ignoreNextWindowError(),t}};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);for(var i=0,s=e;i<s.length;i++){o=s[i];t.hasOwnProperty(o)&&(n[o]=t[o])}return n._airbrake=!0,n.inner=t,n},t.prototype._wrapArguments=function(t){for(var e=0;e<t.length;e++){var r=t[e];"function"==typeof r&&(t[e]=this.wrap(r))}return t},t.prototype._ignoreNextWindowError=function(){},t.prototype.call=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this.wrap(t);return n.apply(this,Array.prototype.slice.call(arguments,1))},t}();function M(t){return window.navigator&&window.navigator.userAgent&&(t.context.userAgent=window.navigator.userAgent),window.location&&(t.context.url=String(window.location),t.context.rootDirectory=window.location.protocol+"//"+window.location.host),t}var $=["debug","log","info","warn","error"];var X=["type","name","src"];function W(t){var e=function(t){return function(e){var r;try{r=e.target}catch(t){return}if(r){var n={type:e.type};try{n.target=function(t){var e=[],r=t;for(;r;){var n=J(r);if(""!==n&&(e.push(n),e.length>10))break;r=r.parentNode}if(0===e.length)return String(t);return e.reverse().join(" > ")}(r)}catch(t){n.target="<"+String(t)+">"}t.scope().pushHistory(n)}}}(t);window.addEventListener&&(window.addEventListener("load",e),window.addEventListener("error",function(t){"error"in t||e(t)},!0)),"object"==typeof document&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",e),document.addEventListener("click",e),document.addEventListener("keypress",e))}function J(t){if(!t)return"";var e=[];if(t.tagName&&e.push(t.tagName.toLowerCase()),t.id&&(e.push("#"),e.push(t.id)),t.classList&&Array.from)e.push("."),e.push(Array.from(t.classList).join("."));else if(t.className){var r=function(t){if(t.split)return t.split(" ").join(".");if(t.baseVal&&t.baseVal.split)return t.baseVal.split(" ").join(".");return console.error("unsupported HTMLElement.className type",typeof t),""}(t.className);""!==r&&(e.push("."),e.push(r))}if(t.getAttribute)for(var n=0,o=X;n<o.length;n++){var i=o[n],s=t.getAttribute(i);s&&e.push("["+i+'="'+s+'"]')}return e.join("")}var V="";function z(t,e){var r=e.indexOf("://");r>=0?(r=(e=e.slice(r+3)).indexOf("/"),e=r>=0?e.slice(r):"/"):"/"!==e.charAt(0)&&(e="/"+e),t.scope().pushHistory({type:"location",from:V,to:e}),V=e}var G=function(t){function e(e){var r=t.call(this,e)||this;return r.offline=!1,r.todo=[],r._ignoreWindowError=0,r._ignoreNextXHR=0,r.addFilter(M),window.addEventListener&&(r.onOnline=r.onOnline.bind(r),window.addEventListener("online",r.onOnline),r.onOffline=r.onOffline.bind(r),window.addEventListener("offline",r.onOffline),r.onUnhandledrejection=r.onUnhandledrejection.bind(r),window.addEventListener("unhandledrejection",r.onUnhandledrejection),r._onClose.push(function(){window.removeEventListener("online",r.onOnline),window.removeEventListener("offline",r.onOffline),window.removeEventListener("unhandledrejection",r.onUnhandledrejection)})),r._opt.ignoreWindowError&&(e.instrumentation.onerror=!1),r._instrument(e.instrumentation),r}return function(t,e){function r(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype._instrument=function(t){var e,r,n;if(void 0===t&&(t={}),t.console=!((e=this._opt.environment)&&e.startsWith&&e.startsWith("dev")),K(t.onerror)){var o=this,i=window.onerror;window.onerror=function(){i&&i.apply(this,arguments),o.onerror.apply(o,arguments)}}W(this),K(t.fetch)&&"function"==typeof fetch&&(r=this,n=window.fetch,window.fetch=function(t,e){var o={type:"xhr",date:new Date};return o.method=e&&e.method?e.method:"GET","string"==typeof t?o.url=t:(o.method=t.method,o.url=t.url),r._ignoreNextXHR++,setTimeout(function(){return r._ignoreNextXHR--}),n.apply(this,arguments).then(function(t){return o.statusCode=t.status,o.duration=(new Date).getTime()-o.date.getTime(),r.scope().pushHistory(o),t}).catch(function(t){throw o.error=t,o.duration=(new Date).getTime()-o.date.getTime(),r.scope().pushHistory(o),t})}),K(t.history)&&"object"==typeof history&&function(t){V=document.location.pathname;var e=window.onpopstate;window.onpopstate=function(r){if(z(t,document.location.pathname),e)return e.apply(this,arguments)};var r=history.pushState;history.pushState=function(e,n,o){o&&z(t,o.toString()),r.apply(this,arguments)}}(this),K(t.console)&&"object"==typeof console&&function(t){for(var e=function(e){if(!(e in console))return"continue";var r=console[e],n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];r.apply(console,n),t.scope().pushHistory({type:"log",severity:e,arguments:n})};n.inner=r,console[e]=n},r=0,n=$;r<n.length;r++)e(n[r])}(this),K(t.xhr)&&"undefined"!=typeof XMLHttpRequest&&function(t){function e(e){var r=e.__state;r.statusCode=e.status,r.duration=(new Date).getTime()-r.date.getTime(),t.scope().pushHistory(r)}var r=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(e,n,o,i,s){0===t._ignoreNextXHR&&(this.__state={type:"xhr",method:e,url:n}),r.apply(this,arguments)};var n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(t){var r=this.onreadystatechange;return this.onreadystatechange=function(t){if(4===this.readyState&&this.__state&&e(this),r)return r.apply(this,arguments)},this.__state&&(this.__state.date=new Date),n.apply(this,arguments)}}(this)},e.prototype.notify=function(e){var r=this;return this.offline?new Promise(function(t,n){for(r.todo.push({err:e,resolve:t,reject:n});r.todo.length>100;){var o=r.todo.shift();if(void 0===o)break;o.resolve({error:new Error("airbrake: offline queue is too large")})}}):t.prototype.notify.call(this,e)},e.prototype.onOnline=function(){this.offline=!1;for(var t=function(t){e.notify(t.err).then(function(e){t.resolve(e)})},e=this,r=0,n=this.todo;r<n.length;r++){t(n[r])}this.todo=[]},e.prototype.onOffline=function(){this.offline=!0},e.prototype.onUnhandledrejection=function(t){var e=t.reason||t.detail&&t.detail.reason;if(e){var r=e.message||String(e);r.indexOf&&0===r.indexOf("airbrake: ")||this.notify(e)}},e.prototype.onerror=function(t,e,r,n,o){this._ignoreWindowError>0||(o?this.notify({error:o,context:{windowError:!0}}):e&&r&&this.notify({error:{message:t,fileName:e,lineNumber:r,columnNumber:n,noStack:!0},context:{windowError:!0}}))},e.prototype._ignoreNextWindowError=function(){var t=this;this._ignoreWindowError++,setTimeout(function(){return t._ignoreWindowError--})},e}(q);function K(t){return void 0===t||!0===t}return t.Notifier=G,t}({}); | ||
//# sourceMappingURL=airbrake.iife.min.js.map |
{ | ||
"name": "@airbrake/browser", | ||
"version": "1.0.0-beta.4", | ||
"version": "1.0.0-beta.5", | ||
"description": "Notify Airbrake on JavaScript exceptions", | ||
@@ -28,3 +28,3 @@ "author": "Airbrake", | ||
"promise-polyfill": "^8.1.3", | ||
"rollup": "^1.22.0", | ||
"rollup": "^1.23.1", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
@@ -57,3 +57,4 @@ "rollup-plugin-node-resolve": "^5.2.0", | ||
"test": "jest" | ||
} | ||
}, | ||
"gitHead": "0a3f2d316ff617f58f59b3993ff36f1c42e3a67d" | ||
} |
@@ -60,3 +60,3 @@ # Airbrake for web browsers | ||
```js | ||
var airbrake = new Airbrake.Notifier({ | ||
const airbrake = new Airbrake.Notifier({ | ||
projectId: 1, | ||
@@ -71,4 +71,4 @@ projectKey: 'REPLACE_ME', | ||
```js | ||
var Airbrake = require('@airbrake/browser'); | ||
var airbrake = new Airbrake.Notifier({...}); | ||
const Airbrake = require('@airbrake/browser'); | ||
const airbrake = new Airbrake.Notifier({...}); | ||
``` | ||
@@ -79,3 +79,3 @@ | ||
```js | ||
var promise = airbrake.notify(`user id=${user_id} not found`); | ||
let promise = airbrake.notify(`user id=${user_id} not found`); | ||
promise.then(function(notice) { | ||
@@ -105,3 +105,3 @@ if (notice.id) { | ||
```js | ||
var startApp = function() { | ||
let startApp = function() { | ||
// This will throw if the document has no head tag. | ||
@@ -119,3 +119,3 @@ document.head.insertBefore(document.createElement('style')); | ||
```js | ||
var startApp = function() { | ||
let startApp = function() { | ||
// This will throw if the document has no head tag. | ||
@@ -122,0 +122,0 @@ document.head.insertBefore(document.createElement('style')); |
export declare class Notifier { | ||
constructor(opts?: any); | ||
constructor(opt: IOptions); | ||
public addFilter(filter: Filter): void; | ||
@@ -10,2 +10,28 @@ public notify(err: any): Promise<INotice>; | ||
interface IInstrumentationOptions { | ||
onerror?: boolean; | ||
fetch?: boolean; | ||
history?: boolean; | ||
console?: boolean; | ||
xhr?: boolean; | ||
} | ||
export interface IOptions { | ||
projectId: number; | ||
projectKey: string; | ||
environment?: string; | ||
host?: string; | ||
timeout?: number; | ||
keysBlacklist?: any[]; | ||
processor?: Processor; | ||
reporter?: Reporter; | ||
instrumentation?: IInstrumentationOptions; | ||
request?: request.RequestAPI< | ||
request.Request, | ||
request.CoreOptions, | ||
request.RequiredUriUrl | ||
>; | ||
} | ||
interface IFuncWrapper { | ||
@@ -12,0 +38,0 @@ (): any; |
@@ -21,7 +21,7 @@ import { IFuncWrapper } from './func_wrapper'; | ||
_opt: IOptions; | ||
protected url: string; | ||
_url: string; | ||
protected processor: Processor; | ||
protected requester: Requester; | ||
protected filters: Filter[] = []; | ||
_processor: Processor; | ||
_requester: Requester; | ||
_filters: Filter[] = []; | ||
_scope = new Scope(); | ||
@@ -40,6 +40,6 @@ | ||
this._opt.keysBlacklist = this._opt.keysBlacklist || [/password/, /secret/]; | ||
this.url = `${this._opt.host}/api/v3/projects/${this._opt.projectId}/notices?key=${this._opt.projectKey}`; | ||
this._url = `${this._opt.host}/api/v3/projects/${this._opt.projectId}/notices?key=${this._opt.projectKey}`; | ||
this.processor = this._opt.processor || espProcessor; | ||
this.requester = makeRequester(this._opt); | ||
this._processor = this._opt.processor || espProcessor; | ||
this._requester = makeRequester(this._opt); | ||
@@ -73,7 +73,7 @@ this.addFilter(ignoreNoiseFilter); | ||
public addFilter(filter: Filter): void { | ||
this.filters.push(filter); | ||
addFilter(filter: Filter): void { | ||
this._filters.push(filter); | ||
} | ||
public notify(err: any): Promise<INotice> { | ||
notify(err: any): Promise<INotice> { | ||
let notice: INotice = { | ||
@@ -102,11 +102,6 @@ errors: [], | ||
if (this._opt.ignoreWindowError && err.context && err.context.windowError) { | ||
notice.error = new Error('airbrake: window error is ignored'); | ||
return Promise.resolve(notice); | ||
} | ||
let error = this.processor(err.error); | ||
let error = this._processor(err.error); | ||
notice.errors.push(error); | ||
for (let filter of this.filters) { | ||
for (let filter of this._filters) { | ||
let r = filter(notice); | ||
@@ -129,6 +124,6 @@ if (r === null) { | ||
}; | ||
return this.sendNotice(notice); | ||
return this._sendNotice(notice); | ||
} | ||
protected sendNotice(notice: INotice): Promise<INotice> { | ||
_sendNotice(notice: INotice): Promise<INotice> { | ||
let body = jsonifyNotice(notice, { | ||
@@ -147,6 +142,6 @@ keysBlacklist: this._opt.keysBlacklist, | ||
method: 'POST', | ||
url: this.url, | ||
url: this._url, | ||
body, | ||
}; | ||
return this.requester(req) | ||
return this._requester(req) | ||
.then((resp) => { | ||
@@ -162,4 +157,3 @@ notice.id = resp.json.id; | ||
// TODO: fix wrapping for multiple clients | ||
public wrap(fn, props: string[] = []): IFuncWrapper { | ||
wrap(fn, props: string[] = []): IFuncWrapper { | ||
if (fn._airbrake) { | ||
@@ -212,3 +206,3 @@ return fn; | ||
public call(fn, ..._args: any[]): any { | ||
call(fn, ..._args: any[]): any { | ||
let wrapper = this.wrap(fn); | ||
@@ -215,0 +209,0 @@ return wrapper.apply(this, Array.prototype.slice.call(arguments, 1)); |
@@ -48,2 +48,7 @@ import { IOptions, IInstrumentationOptions } from './options'; | ||
//TODO: deprecated | ||
if (this._opt.ignoreWindowError) { | ||
opt.instrumentation.onerror = false; | ||
} | ||
this._instrument(opt.instrumentation); | ||
@@ -50,0 +55,0 @@ } |
@@ -23,3 +23,3 @@ import * as request from 'request'; | ||
keysBlacklist?: any[]; | ||
ignoreWindowError?: boolean; | ||
ignoreWindowError?: boolean; //TODO:deprecated | ||
processor?: Processor; | ||
@@ -26,0 +26,0 @@ reporter?: Reporter; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5914
647780