mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 22:31:27 -05:00
3 lines
14 KiB
JavaScript
3 lines
14 KiB
JavaScript
|
/*! Raven.js 1.1.16 (2cf8531) | github.com/getsentry/raven-js */
|
||
|
!function(a,b){"use strict";function c(a,b){var c,d;b=b||{},a="raven"+a.substr(0,1).toUpperCase()+a.substr(1),document.createEvent?(c=document.createEvent("HTMLEvents"),c.initEvent(a,!0,!0)):(c=document.createEventObject(),c.eventType=a);for(d in b)j(b,d)&&(c[d]=b[d]);if(document.createEvent)document.dispatchEvent(c);else try{document.fireEvent("on"+c.eventType.toLowerCase(),c)}catch(e){}}function d(a){this.name="RavenConfigError",this.message=a}function e(a){var b=Q.exec(a),c={},e=7;try{for(;e--;)c[P[e]]=b[e]||""}catch(f){throw new d("Invalid DSN: "+a)}if(c.pass)throw new d("Do not specify your private key in the DSN!");return c}function f(a){return"undefined"==typeof a}function g(a){return"function"==typeof a}function h(a){return"string"==typeof a}function i(a){for(var b in a)return!1;return!0}function j(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function k(a,b){var c,d;if(f(a.length))for(c in a)j(a,c)&&b.call(null,c,a[c]);else if(d=a.length)for(c=0;d>c;c++)b.call(null,c,a[c])}function l(){J="?sentry_version=4&sentry_client=raven-js/"+O.VERSION+"&sentry_key="+H}function m(a,b){var d=[];a.stack&&a.stack.length&&k(a.stack,function(a,b){var c=n(b);c&&d.push(c)}),c("handle",{stackInfo:a,options:b}),p(a.name,a.message,a.url,a.lineno,d,b)}function n(a){if(a.url){var b,c={filename:a.url,lineno:a.line,colno:a.column,"function":a.func||"?"},d=o(a);if(d){var e=["pre_context","context_line","post_context"];for(b=3;b--;)c[e[b]]=d[b]}return c.in_app=!(!M.includePaths.test(c.filename)||/(Raven|TraceKit)\./.test(c["function"])||/raven\.(min\.)?js$/.test(c.filename)),c}}function o(a){if(a.context&&M.fetchContext){for(var b=a.context,c=~~(b.length/2),d=b.length,e=!1;d--;)if(b[d].length>300){e=!0;break}if(e){if(f(a.column))return;return[[],b[c].substr(a.column,50),[]]}return[b.slice(0,c),b[c],b.slice(c+1)]}}function p(a,b,c,d,e,f){var g,h;b+="",("Error"!==a||b)&&(M.ignoreErrors.test(b)||(e&&e.length?(c=e[0].filename||c,e.reverse(),g={frames:e}):c&&(g={frames:[{filename:c,lineno:d,in_app:!0}]}),b=r(b,100),M.ignoreUrls&&M.ignoreUrls.test(c)||(!M.whitelistUrls||M.whitelistUrls.test(c))&&(h=d?b+" at "+d:b,t(q({exception:{type:a,value:b},stacktrace:g,culprit:c,message:h},f)))))}function q(a,b){return b?(k(b,function(b,c){a[b]=c}),a):a}function r(a,b){return a.length<=b?a:a.substr(0,b)+"…"}function s(){var a={url:document.location.href,headers:{"User-Agent":navigator.userAgent}};return document.referrer&&(a.headers.Referer=document.referrer),a}function t(a){v()&&(a=q({project:I,logger:M.logger,site:M.site,platform:"javascript",request:s()},a),a.tags=q(M.tags,a.tags),a.extra=q(M.extra,a.extra),i(a.tags)&&delete a.tags,i(a.extra)&&delete a.extra,G&&(a.user=G),g(M.dataCallback)&&(a=M.dataCallback(a)),(!g(M.shouldSendCallback)||M.shouldSendCallback(a))&&(E=a.event_id||(a.event_id=x()),u(a)))}function u(a){var b=new Image,d=F+J+"&sentry_data="+encodeURIComponent(JSON.stringify(a));b.onload=function(){c("success",{data:a,src:d})},b.onerror=b.onabort=function(){c("failure",{data:a,src:d})},b.src=d}function v(){return L?F?!0:(y("error","Error: Raven has not been configured."),!1):!1}function w(a){for(var b,c=[],d=0,e=a.length;e>d;d++)b=a[d],h(b)?c.push(b.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):b&&b.source&&c.push(b.source);return new RegExp(c.join("|"),"i")}function x(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})}function y(b,c){a.console&&console[b]&&O.debug&&console[b](c)}function z(){var b=a.RavenConfig;b&&O.config(b.dsn,b.config).install()}var A={remoteFetching:!1,collectWindowErrors:!0,linesOfContext:7},B=[].slice,C="?";A.wrap=function(a){function b(){try{return a.apply(this,arguments)}catch(b){throw A.report(b),b}}return b},A.report=function(){function c(a){h(),o.push(a)}function d(a){for(var b=o.length-1;b>=0;--b)o[b]===a&&o.splice(b,1)}function e(){i(),o=[]}function f(a,b){var c=null;if(!b||A.collectWindowErrors){for(var d in o)if(j(o,d))try{o[d].apply(null,[a].concat(B.call(arguments,2)))}catch(e){c=e}if(c)throw c}}function g(a,b,c
|