UNPKG

honeybadger

Version:

A JavaScript library for integrating apps with the Honeybadger Rails Error Notifier.

45 lines (44 loc) 20.4 kB
'use strict'; (function(){(function(){function h(p){var j,d,c,e="json"==p;if(e||"json-stringify"==p||"json-parse"==p){if("json-stringify"==p||e){if(j="function"==typeof i.stringify&&m){(c=function(){return 1}).toJSON=c;try{j="0"===i.stringify(0)&&"0"===i.stringify(new Number)&&'""'==i.stringify(new String)&&i.stringify(a)===f&&i.stringify(f)===f&&i.stringify()===f&&"1"===i.stringify(c)&&"[1]"==i.stringify([c])&&"[null]"==i.stringify([f])&&"null"==i.stringify(null)&&"[null,null,null]"==i.stringify([f,a,null])&&'{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'== i.stringify({A:[c,!0,!1,null,"\x00\b\n\f\r\t"]})&&"1"===i.stringify(null,c)&&"[\n 1,\n 2\n]"==i.stringify([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==i.stringify(new Date(-864E13))&&'"+275760-09-13T00:00:00.000Z"'==i.stringify(new Date(864E13))&&'"-000001-01-01T00:00:00.000Z"'==i.stringify(new Date(-621987552E5))&&'"1969-12-31T23:59:59.999Z"'==i.stringify(new Date(-1))}catch(b){j=!1}}if(!e)return j}if("json-parse"==p||e){if("function"==typeof i.parse)try{if(0===i.parse("0")&&!i.parse(!1)&&(c= i.parse('{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'),d=5==c.A.length&&1==c.A[0])){try{d=!i.parse('"\t"')}catch(l){}if(d)try{d=1!=i.parse("01")}catch(k){}}}catch(r){d=!1}if(!e)return d}return j&&d}}var a={}.toString,e,b,f,n="function"===typeof define&&define.amd,i=!n&&"object"==typeof exports&&exports;i||n?"object"==typeof JSON&&JSON?n?i=JSON:(i.stringify=JSON.stringify,i.parse=JSON.parse):n&&(i=this.JSON={}):i=this.JSON||(this.JSON={});var x,s,q,A,H,B,j,l,r,g,y,c,u,m=new Date(-0xc782b5b800cec), t,v,I;try{m=-109252==m.getUTCFullYear()&&0===m.getUTCMonth()&&1==m.getUTCDate()&&10==m.getUTCHours()&&37==m.getUTCMinutes()&&6==m.getUTCSeconds()&&708==m.getUTCMilliseconds()}catch(U){}if(!h("json")){m||(t=Math.floor,v=[0,31,59,90,120,151,181,212,243,273,304,334],I=function(p,a){return v[a]+365*(p-1970)+t((p-1969+(a=+(1<a)))/4)-t((p-1901+a)/100)+t((p-1601+a)/400)});if(!(e={}.hasOwnProperty))e=function(p){var j={},d;(j.__proto__=null,j.__proto__={toString:1},j).toString!=a?e=function(d){var a=this.__proto__, d=d in(this.__proto__=null,this);this.__proto__=a;return d}:(d=j.constructor,e=function(a){var j=(this.constructor||d).prototype;return a in this&&!(a in j&&this[a]===j[a])});j=null;return e.call(this,p)};b=function(j,c){var d=0,f,b,i;(f=function(){this.valueOf=0}).prototype.valueOf=0;b=new f;for(i in b)e.call(b,i)&&d++;f=b=null;d?d=2==d?function(d,j){var p={},c="[object Function]"==a.call(d),b;for(b in d)!(c&&"prototype"==b)&&(!e.call(p,b)&&(p[b]=1)&&e.call(d,b))&&j(b)}:function(d,j){var p="[object Function]"== a.call(d),c,b;for(c in d)!(p&&"prototype"==c)&&(e.call(d,c)&&!(b="constructor"===c))&&j(c);(b||e.call(d,c="constructor"))&&j(c)}:(b="valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor".split(" "),d=function(d,j){var c="[object Function]"==a.call(d),p;for(p in d)!(c&&"prototype"==p)&&e.call(d,p)&&j(p);for(c=b.length;p=b[--c];e.call(d,p)&&j(p));});return d(j,c)};h("json-stringify")||(x={"\\":"\\\\",'"':'\\"',"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"}, s=function(j,a){return("000000"+(a||0)).slice(-j)},q=function(j){for(var a='"',d=0,c;c=j.charAt(d);d++)a+=-1<'\\"\b\f\n\r\t'.indexOf(c)?x[c]:x[c]=" ">c?"\\u00"+s(2,c.charCodeAt(0).toString(16)):c;return a+'"'},A=function(j,c,d,i,l,r,h){var k=c[j],g,y,m,n,u,x,v,D,G;if("object"==typeof k&&k)if(g=a.call(k),"[object Date]"==g&&!e.call(k,"toJSON"))if(k>-1/0&&k<1/0){if(I){m=t(k/864E5);for(g=t(m/365.2425)+1970-1;I(g+1,0)<=m;g++);for(y=t((m-I(g,0))/30.42);I(g,y+1)<=m;y++);m=1+m-I(g,y);n=(k%864E5+864E5)%864E5; u=t(n/36E5)%24;x=t(n/6E4)%60;v=t(n/1E3)%60;n%=1E3}else g=k.getUTCFullYear(),y=k.getUTCMonth(),m=k.getUTCDate(),u=k.getUTCHours(),x=k.getUTCMinutes(),v=k.getUTCSeconds(),n=k.getUTCMilliseconds();k=(0>=g||1E4<=g?(0>g?"-":"+")+s(6,0>g?-g:g):s(4,g))+"-"+s(2,y+1)+"-"+s(2,m)+"T"+s(2,u)+":"+s(2,x)+":"+s(2,v)+"."+s(3,n)+"Z"}else k=null;else if("function"==typeof k.toJSON&&("[object Number]"!=g&&"[object String]"!=g&&"[object Array]"!=g||e.call(k,"toJSON")))k=k.toJSON(j);d&&(k=d.call(c,j,k));if(null===k)return"null"; g=a.call(k);if("[object Boolean]"==g)return""+k;if("[object Number]"==g)return k>-1/0&&k<1/0?""+k:"null";if("[object String]"==g)return q(k);if("object"==typeof k){for(j=h.length;j--;)if(h[j]===k)throw TypeError();h.push(k);D=[];c=r;r+=l;if("[object Array]"==g){y=0;for(j=k.length;y<j;G||(G=!0),y++)g=A(y,k,d,i,l,r,h),D.push(g===f?"null":g);j=G?l?"[\n"+r+D.join(",\n"+r)+"\n"+c+"]":"["+D.join(",")+"]":"[]"}else b(i||k,function(j){var c=A(j,k,d,i,l,r,h);c!==f&&D.push(q(j)+":"+(l?" ":"")+c);G||(G=!0)}), j=G?l?"{\n"+r+D.join(",\n"+r)+"\n"+c+"}":"{"+D.join(",")+"}":"{}";h.pop();return j}},i.stringify=function(j,c,d){var b,e,g,f,i,l;if("function"==typeof c||"object"==typeof c&&c)if("[object Function]"==a.call(c))e=c;else if("[object Array]"==a.call(c)){g={};f=0;for(i=c.length;f<i;l=c[f++],("[object String]"==a.call(l)||"[object Number]"==a.call(l))&&(g[l]=1));}if(d)if("[object Number]"==a.call(d)){if(0<(d-=d%1)){b="";for(10<d&&(d=10);b.length<d;b+=" ");}}else"[object String]"==a.call(d)&&(b=10>=d.length? d:d.slice(0,10));return A("",(l={},l[""]=j,l),e,g,b,"",[])});h("json-parse")||(H=String.fromCharCode,B={"\\":"\\",'"':'"',"/":"/",b:"\b",t:"\t",n:"\n",f:"\f",r:"\r"},j=function(){c=u=null;throw SyntaxError();},l=function(){for(var a=u,b=a.length,d,l,e,g,f;c<b;)if(d=a.charAt(c),-1<"\t\r\n ".indexOf(d))c++;else{if(-1<"{}[]:,".indexOf(d))return c++,d;if('"'==d){l="@";for(c++;c<b;)if(d=a.charAt(c)," ">d)j();else if("\\"==d)if(d=a.charAt(++c),-1<'\\"/btnfr'.indexOf(d))l+=B[d],c++;else if("u"==d){e=++c; for(g=c+4;c<g;c++)d=a.charAt(c),"0"<=d&&"9">=d||("a"<=d&&"f">=d||"A"<=d&&"F">=d)||j();l+=H("0x"+a.slice(e,c))}else j();else{if('"'==d)break;l+=d;c++}if('"'==a.charAt(c))return c++,l}else{e=c;"-"==d&&(f=!0,d=a.charAt(++c));if("0"<=d&&"9">=d){for("0"==d&&(d=a.charAt(c+1),"0"<=d&&"9">=d)&&j();c<b&&(d=a.charAt(c),"0"<=d&&"9">=d);c++);if("."==a.charAt(c)){for(g=++c;g<b&&(d=a.charAt(g),"0"<=d&&"9">=d);g++);g==c&&j();c=g}d=a.charAt(c);if("e"==d||"E"==d){d=a.charAt(++c);("+"==d||"-"==d)&&c++;for(g=c;g<b&& (d=a.charAt(g),"0"<=d&&"9">=d);g++);g==c&&j();c=g}return+a.slice(e,c)}f&&j();if("true"==a.slice(c,c+4))return c+=4,!0;if("false"==a.slice(c,c+5))return c+=5,!1;if("null"==a.slice(c,c+4))return c+=4,null}j()}return"$"},r=function(a){var c,d;"$"==a&&j();if("string"==typeof a){if("@"==a.charAt(0))return a.slice(1);if("["==a){for(c=[];;d||(d=!0)){a=l();if("]"==a)break;d&&(","==a?(a=l(),"]"==a&&j()):j());","==a&&j();c.push(r(a))}return c}if("{"==a){for(c={};;d||(d=!0)){a=l();if("}"==a)break;d&&(","==a? (a=l(),"}"==a&&j()):j());(","==a||"string"!=typeof a||"@"!=a.charAt(0)||":"!=l())&&j();c[a.slice(1)]=r(l())}return c}j()}return a},y=function(a,c,d){d=g(a,c,d);d===f?delete a[c]:a[c]=d},g=function(c,j,d){var g=c[j],l;if("object"==typeof g&&g)if("[object Array]"==a.call(g))for(l=g.length;l--;)y(g,l,d);else b(g,function(a){y(g,a,d)});return d.call(c,j,g)},i.parse=function(b,e){var d,f;c=0;u=b;d=r(l());"$"!=l()&&j();c=u=null;return e&&"[object Function]"==a.call(e)?g((f={},f[""]=d,f),"",e):d})}n&&define(function(){return i})}).call(this);var TraceKit={_has:function(h,a){return Object.prototype.hasOwnProperty.call(h,a)}}; TraceKit.report=function(){function h(a,b){var f=null;if(!b||TraceKit.collectWindowErrors){for(var h in e)if(TraceKit._has(e,h))try{e[h].apply(null,[a].concat(Array.prototype.slice.call(arguments,2)))}catch(n){f=n}if(f)throw f;}}function a(a){var e=Array.prototype.slice.call(arguments,1);if(f){if(b===a)return;var n=f;b=f=null;h.apply(null,[n,null].concat(e))}var q=TraceKit.computeStackTrace(a);f=q;b=a;window.setTimeout(function(){b===a&&(b=f=null,h.apply(null,[q,null].concat(e)))},q.incomplete?2E3: 0);throw a;}var e=[],b=null,f=null,n=window.onerror;window.onerror=function(a,e,s){var q=null;f?(TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(f,e,s,a),q=f,b=f=null):(q={url:e,line:s},q.func=TraceKit.computeStackTrace.guessFunctionName(q.url,q.line),q.context=TraceKit.computeStackTrace.gatherContext(q.url,q.line),q={mode:"onerror",message:a,url:document.location.href,stack:[q],useragent:navigator.userAgent});h(q,"from window.onerror");return n?n.apply(this,arguments):!1};a.subscribe= function(a){e.push(a)};a.unsubscribe=function(a){for(var b=e.length-1;0<=b;--b)e[b]===a&&e.splice(b,1)};return a}(); TraceKit.computeStackTrace=function(){function h(a){if(!TraceKit._has(B,a)){var b;if(-1!==a.indexOf(document.domain))if(TraceKit.remoteFetching)try{var e=new ("undefined"===typeof XMLHttpRequest?function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(j){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(b){}throw Error("No XHR.");}:XMLHttpRequest);e.open("GET",a, !1);e.send("");b=e.responseText}catch(g){b=""}else b="";else b=[];B[a]=b.length?b.split("\n"):[]}return B[a]}function a(a,b){var e=/function ([^(]*)\(([^)]*)\)/,g=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,f="",c=h(a),i;if(!c.length)return"?";for(var n=0;10>n;++n)if(f=c[b-n]+f,void 0!==f&&((i=g.exec(f))||(i=e.exec(f))))return i[1];return"?"}function e(a,b){var e=h(a);if(!e.length)return null;for(var g=[],f=Math.floor(TraceKit.linesOfContext/2),c=f+TraceKit.linesOfContext%2, f=Math.max(0,b-f-1),c=Math.min(e.length,b+c-1);f<c;++f)"undefined"!==typeof e[f]&&g.push(e[f]);return 0<g.length?g:null}function b(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function f(a){return b(a).replace("<","(?:<|&lt;)").replace(">","(?:>|&gt;)").replace("&","(?:&|&amp;)").replace('"','(?:"|&quot;)').replace(/\s+/g,"\\s+")}function n(a,b){for(var e,f,i=0,c=b.length;i<c;++i)if((e=h(b[i])).length)if(e=e.join("\n"),f=a.exec(e))return{url:b[i],line:e.substring(0,f.index).split("\n").length, column:f.index-e.lastIndexOf("\n",f.index)-1};return null}function i(a,e,f){var e=h(e),a=RegExp("\\b"+b(a)+"\\b"),g,f=f-1;return e&&e.length>f&&(g=a.exec(e[f]))?g.index:null}function x(a){var e=[window.location.href],i=document.getElementsByTagName("script"),a=""+a,g;for(g=0;g<i.length;++g){var h=i[g];h.src&&e.push(h.src)}(i=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(a))?(g=i[1]?"\\s+"+i[1]:"",h=i[2].split(",").join("\\s*,\\s*"),i=b(i[3]).replace(/;$/,";?"),g= RegExp("function"+g+"\\s*\\(\\s*"+h+"\\s*\\)\\s*{\\s*"+i+"\\s*}")):g=RegExp(b(a).replace(/\s+/g,"\\s+"));if(g=n(g,e))return g;if(i=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(a)){a=i[1];i=f(i[2]);g=RegExp("on"+a+"=[\\'\"]\\s*"+i+"\\s*[\\'\"]","i");if(g=n(g,e[0]))return g;g=RegExp(i);if(g=n(g,e))return g}return null}function s(b,f,h,g){f={url:f,line:h};if(f.url&&f.line){b.incomplete=!1;f.func||(f.func=a(f.url,f.line));f.context||(f.context=e(f.url,f.line));if(g=/ '([^']+)' /.exec(g))f.column= i(g[1],f.url,f.line);if(0<b.stack.length&&b.stack[0].url===f.url){if(b.stack[0].line===f.line)return!1;if(!b.stack[0].line&&b.stack[0].func===f.func)return b.stack[0].line=f.line,b.stack[0].context=f.context,!1}b.stack.unshift(f);return b.partial=!0}b.incomplete=!0;return!1}function q(b,f){for(var e=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,g=[],h={},c=!1,n,m,t=q.caller;t&&!c;t=t.caller)if(!(t===A||t===TraceKit.report)){m={url:null,func:"?",line:null,column:null};if(t.name)m.func= t.name;else if(n=e.exec(t.toString()))m.func=n[1];if(n=x(t)){m.url=n.url;m.line=n.line;"?"===m.func&&(m.func=a(m.url,m.line));var v=/ '([^']+)' /.exec(b.message||b.description);v&&(m.column=i(v[1],n.url,n.line))}h[""+t]?c=!0:h[""+t]=!0;g.push(m)}f&&g.splice(0,f);e={mode:"callers",name:b.name,message:b.message,url:document.location.href,stack:g,useragent:navigator.userAgent};s(e,b.sourceURL||b.fileName,b.line||b.lineNumber,b.message||b.description);return e}function A(b,l){var r=null,l=null==l?0:+l; try{for(var g=/ line (\d+), column (\d+) in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,s=b.stacktrace.split("\n"),c=[],u,m=0,t=s.length;m<t;m+=2)if(u=g.exec(s[m])){var v={line:+u[1],column:+u[2],func:u[3]||u[4],args:u[5]?u[5].split(","):[],url:u[6]};!v.func&&v.line&&(v.func=a(v.url,v.line));if(v.line)try{v.context=e(v.url,v.line)}catch(A){}v.context||(v.context=[s[m+1]]);c.push(v)}r=c.length?{mode:"stacktrace",name:b.name,message:b.message,url:document.location.href,stack:c, useragent:navigator.userAgent}:null;if(r)return r}catch(x){if(H)throw x;}try{if(b.stack){var g=/^\s*at ((?:\[object object\])?\S+) \(((?:file|http|https):.*?):(\d+)(?::(\d+))?\)\s*$/i,s=/^\s*(\S*)(?:\((.*?)\))?@((?:file|http|https).*?):(\d+)(?::(\d+))?\s*$/i,p=b.stack.split("\n"),c=[],w,d,B=/^(.*) is undefined$/.exec(b.message);u=0;for(var K=p.length;u<K;++u){if(w=s.exec(p[u]))d={url:w[3],func:w[1],args:w[2]?w[2].split(","):"",line:+w[4],column:w[5]?+w[5]:null};else if(w=g.exec(p[u]))d={url:w[2], func:w[1],line:+w[3],column:w[4]?+w[4]:null};else continue;!d.func&&d.line&&(d.func=a(d.url,d.line));d.line&&(d.context=e(d.url,d.line));c.push(d)}c[0]&&(c[0].line&&!c[0].column&&B)&&(c[0].column=i(B[1],c[0].url,c[0].line));r=c.length?{mode:"stack",name:b.name,message:b.message,url:document.location.href,stack:c,useragent:navigator.userAgent}:null}else r=null;if(r)return r}catch(O){if(H)throw O;}try{var E=b.message.split("\n");if(4>E.length)r=null;else{p=/^\s*Line (\d+) of linked script ((?:file|http|https)\S+)(?:: in function (\S+))?\s*$/i; w=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|http|https)\S+)(?:: in function (\S+))?\s*$/i;d=/^\s*Line (\d+) of function script\s*$/i;var B=[],k=document.getElementsByTagName("script"),K=[],C,z,L,F;for(z in k)TraceKit._has(k,z)&&!k[z].src&&K.push(k[z]);z=2;for(L=E.length;z<L;z+=2){k=null;if(C=p.exec(E[z]))k={url:C[2],func:C[3],line:+C[1]};else if(C=w.exec(E[z])){var k={url:C[3],func:C[4]},P=+C[1],M=K[C[2]-1];if(M&&(F=h(k.url))){F=F.join("\n");var N=F.indexOf(M.innerText);0<=N&&(k.line=P+F.substring(0, N).split("\n").length)}}else if(C=d.exec(E[z])){var D=window.location.href.replace(/#.*$/,""),G=C[1],Q=RegExp(f(E[z+1]));F=n(Q,[D]);k={url:D,line:F?F.line:G,func:""}}if(k){k.func||(k.func=a(k.url,k.line));var J=e(k.url,k.line),R=J?J[Math.floor(J.length/2)]:null;k.context=J&&R.replace(/^\s*/,"")===E[z+1].replace(/^\s*/,"")?J:[E[z+1]];B.push(k)}}r=B.length?{mode:"multiline",name:b.name,message:E[0],url:document.location.href,stack:B,useragent:navigator.userAgent}:null}if(r)return r}catch(S){if(H)throw S; }try{if(r=q(b,l+1))return r}catch(T){if(H)throw T;}return{mode:"failed"}}var H=!1,B={};A.augmentStackTraceWithInitialElement=s;A.guessFunctionName=a;A.gatherContext=e;A.ofCaller=function(a){try{throw Error();}catch(b){return A(b,(null==a?0:+a)+2)}};return A}(); (function(h){var a=function(a){var b=h[a];h[a]=function(){var a=Array.prototype.slice.call(arguments,0),e=a[0];"function"===typeof e&&(a[0]=function(){try{e.apply(this,arguments)}catch(a){throw TraceKit.report(a),a;}});return b.apply?b.apply(this,a):b(a[0],a[1])}};a("setTimeout");a("setInterval")})(window); (function(h){if(h){var a=h.event.add;h.event.add=function(b,e,i,x,s){var q;i.handler?(q=i.handler,i.handler=function(){try{return q.apply(this,arguments)}catch(a){throw TraceKit.report(a),a;}}):(q=i,i=function(){try{return q.apply(this,arguments)}catch(a){throw TraceKit.report(a),a;}});i.guid=q.guid?q.guid:q.guid=h.guid++;return a.call(this,b,e,i,x,s)};var e=h.fn.ready;h.fn.ready=function(a){return e.call(this,function(){try{return a.apply(this,arguments)}catch(b){throw TraceKit.report(b),b;}})}; var b=h.ajax;h.fn.ajax=function(a){if(h.isFunction(a.complete)){var e=a.complete;a.complete=function(){try{return e.apply(this,arguments)}catch(a){throw TraceKit.report(a),a;}}}if(h.isFunction(a.error)){var i=a.error;a.error=function(){try{return i.apply(this,arguments)}catch(a){throw TraceKit.report(a),a;}}}if(h.isFunction(a.success)){var x=a.success;a.success=function(){try{return x.apply(this,arguments)}catch(a){throw TraceKit.report(a),a;}}}try{return b.call(this,a)}catch(s){throw TraceKit.report(s), s;}}}})(window.jQuery);TraceKit.remoteFetching||(TraceKit.remoteFetching=!0);TraceKit.collectWindowErrors||(TraceKit.collectWindowErrors=!0);if(!TraceKit.linesOfContext||1>TraceKit.linesOfContext)TraceKit.linesOfContext=11;var Notice,notice={}; Notice=function(){function h(a){var e,b,f,h;this.options=null!=a?a:{};this.stackInfo=this.options.stackInfo||this.options.error&&TraceKit.computeStackTrace(this.options.error);this.trace=this._parseBacktrace(null!=(b=this.stackInfo)?b.stack:void 0);this["class"]=null!=(f=this.stackInfo)?f.name:void 0;this.message=null!=(h=this.stackInfo)?h.message:void 0;this.source=this.stackInfo&&this._extractSource(this.stackInfo.stack);this.url=document.URL;this.project_root=Honeybadger.configuration.project_root;this.environment= Honeybadger.configuration.environment;this.component=Honeybadger.configuration.component;this.action=Honeybadger.configuration.action;this.context={};b=Honeybadger.context;for(e in b)a=b[e],this.context[e]=a;if(this.options.context)for(e in b=this.options.context,b)a=b[e],this.context[e]=a}h.prototype.toJSON=function(){return JSON.stringify({notifier:{name:"honeybadger.js",url:"https://github.com/honeybadger-io/honeybadger-js",version:Honeybadger.version,language:"javascript"},error:{"class":this["class"], message:this.message,backtrace:this.trace,source:this.source},request:{url:this.url,component:this.component,action:this.action,context:this.context,cgi_data:this._cgiData()},server:{project_root:this.project_root,environment_name:this.environment}})};h.prototype._parseBacktrace=function(a){var e,b,f,h;null==a&&(a=[]);e=[];f=0;for(h=a.length;f<h;f++)b=a[f],b.url.match(/honeybadger(?:\.min)?\.js/)||e.push({file:b.url.replace(Honeybadger.configuration.project_root,"[PROJECT_ROOT]"),number:b.line,method:b.func}); return e};h.prototype._extractSource=function(a){var e,b,f,h,i;null==a&&(a=[]);f={};a=null!=(e=null!=(b=a[0])?b.context:void 0)?e:[];e=h=0;for(i=a.length;h<i;e=++h)b=a[e],f[e]=b;return f};h.prototype._cgiData=function(){var a,e,b;a={};for(e in navigator)b=navigator[e],"object"!==typeof b&&(a[e.split(/(?=[A-Z][a-z]*)/).join("_").toUpperCase()]=b);a.HTTP_USER_AGENT=a.USER_AGENT;delete a.USER_AGENT;document.referrer.match(/\S/)&&(a.HTTP_REFERER=document.referrer);return a};return h}();var Honeybadger,honeybadger={}; Honeybadger=function(){function h(){}h.version="0.0.1";h.default_configuration={api_key:null,host:"api.honeybadger.io",ssl:!0,project_root:window.location.protocol+"//"+window.location.host,environment:"production",component:null,action:null,disabled:!0,onerror:!1};h.configured=!1;h.configure=function(a){var e,b;null==a&&(a={});!1===this.configured&&("undefined"===typeof a.disabled&&(a.disabled=!1),this.configured=!0);for(e in a)b=a[e],this.configuration[e]=b;return this};h.configuration={reset:function(){var a, e,b,f;h.configured=!1;b=h.default_configuration;f=[];for(a in b)e=b[a],f.push(h.configuration[a]=e);return f}};h.configuration.reset();h.context={};h.resetContext=function(a){null==a&&(a={});this.context=a;return this};h.setContext=function(a){var e,b;null==a&&(a={});for(e in a)b=a[e],this.context[e]=b;return this};h.notify=function(a,e){var b;null==e&&(e={});if(!0===this.configuration.disabled)return!1;a&&(e.error=a);b=new Notice(e);return this._sendRequest(b.toJSON())};h._sendRequest=function(a){return this._crossDomainPost("http"+ (this.configuration.ssl&&"s"||"")+"://"+this.configuration.host+"/v1/notices.html",a)};h._crossDomainPost=function(a,e){var b,f;b=document.createElement("iframe");f="_hb_"+(new Date).getTime();document.body.appendChild(b);b.style.display="none";b.contentWindow.name=f;b=document.createElement("form");b.target=f;b.action=a;b.method="POST";f=document.createElement("input");f.type="hidden";f.name="payload";f.value=e;b.appendChild(f);f=document.createElement("input");f.type="hidden";f.name="api_key";f.value= this.configuration.api_key;b.appendChild(f);document.body.appendChild(b);return b.submit()};h._handleTraceKitSubscription=function(a){if(h.configuration.onerror)return h.notify(null,{stackInfo:a})};return h}.call(this);TraceKit.report.subscribe(Honeybadger._handleTraceKitSubscription);("undefined"!==typeof exports&&null!==exports?exports:this).Honeybadger=Honeybadger;}).call(this); //@ sourceMappingURL=honeybadger.min.js.map