PageSourceSearch

https://doubleagent.io/assets/@appsignal--javascript-072c6f77.js

js doubleagent.io collected 2026-10-06 15:14:01 UTC 11,421 bytes, 2 lines download raw bytes

1import{__awaiter as t,__generator as e,__extends as r,__assign as n,__values as i,__spreadArray as s,__read as o}from"tslib";import{getGlobalObject as a,isNodeEnv as u,urlEncode as c,isError as h,getStacktrace as p,toHashMapString as d,Serializable as l,compose as f,toHashMap as m}from"@appsignal/core";var v="1.4.1";var _=function(){function Environment(){}Environment.serialize=function(){return{transport:this.transport(),origin:this.origin()}};Environment.origin=function(){var t=a();return t.location?t.location.origin||"".concat(t.location.protocol,"//").concat(t.location.hostname):""};Environment.transport=function(){var t=a();return u()&&typeof jest==="undefined"?"NodeHTTP":t.XDomainRequest?"XDomainRequest":t.XMLHttpRequest&&!t.fetch?"XMLHttpRequest":"fetch"};Environment.supportsPromises=function(){var t=a();return"Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;new t.Promise((function(t){e=t}));return typeof e==="function"}()};return Environment}();var g=function(){function XDomainTransport(t){this.url=t}XDomainTransport.prototype.send=function(t){var e=this;return new Promise((function(r,n){var i;var s=new XDomainRequest;var o=new RegExp("^https?:");s.onload=function(){return r({})};s.open("POST",e.url.replace(o,(i=window===null||window===void 0?void 0:window.location)===null||i===void 0?void 0:i.protocol));setTimeout((function(){try{s.send(t)}catch(t){n(t)}}),0)}))};return XDomainTransport}();var y=function(){function XHRTransport(t){this.url=t}XHRTransport.prototype.send=function(t){var e=this;return new Promise((function(r,n){try{var i=new XMLHttpRequest;i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&r({})};i.open("POST",e.url);i.send(t)}catch(t){n(t)}}))};return XHRTransport}();var P=function(){function FetchTransport(t,e){this.url=t}FetchTransport.prototype.send=function(r){return t(this,void 0,void 0,(function(){var t,n,i;return e(this,(function(e){switch(e.label){case 0:return[4,fetch(this.url,{method:"POST",body:r})];case 1:t=e.sent();n=t.statusText,i=t.ok;return[2,i?Promise.resolve({}):Promise.reject({statusText:n})]}}))}))};return FetchTransport}();var A=function(){function NodeTransport(t){this.url=t;this.https=import("https")}NodeTransport.prototype.send=function(t){var e=this;var r={method:"POST",headers:{"Content-Type":"application/json","Content-Length":t.length}};return new Promise((function(n,i){e.https.then((function(s){var o=s.request(e.url,r,(function(){})).on("error",(function(t){return i(t)}));o.write(t);o.end();n({})})).catch((function(t){console.warn("NodeTransport is being used, but the HTTPS module could not be imported. No data will be sent to AppSignal.");i(t)}))}))};return NodeTransport}();var w=function(){function PushApi(t){this._uri=t.uri||"https://appsignal-endpoint.net/collect";this._apiKey=t.key;this._clientVersion=t.version;this._transport=this._createTransport(this._url())}PushApi.prototype.push=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this._transport.send(r.toJSON())];case 1:t.sent();return[2,r]}}))}))};PushApi.prototype._createTransport=function(t){switch(_.transport()){case"XDomainRequest":return new g(t);case"XMLHttpRequest":return new y(t);case"NodeHTTP":return new A(t);default:return new P(t)}};PushApi.prototype._url=function(){var t=this._authorization();return"".concat(this._uri,"?").concat(c(t))};PushApi.prototype._authorization=function(){return{api_key:this._apiKey,version:this._clientVersion}};return PushApi}();var b=function(t){r(Span,t);function Span(e){return t.call(this,n({timestamp:Math.round((new Date).getTime()/1e3),namespace:"frontend",error:{name:"NullError",message:"No error has been set",backtrace:[]}},e))||this}Span.prototype.setAction=function(t){if(!t||typeof t!=="string")return this;this._data.action=t;return this};Span.prototype.setNamespace=function(t){if(!t||typeof t!=="string")return this;this._data.namespace=t;return this};Span.prototype.setError=function(t){if(!t||!h(t))return this;this._data.error={name:t.name||"[unknown]",message:t.message,backtrace:p(t)};return this};Span.prototype.setTags=function(t){this._data.tags=n(n({},this._data.tags),d(t));return this};Span.prototype.setParams=function(t){this._data.params=n(n({},this._data.params),t);return this};Span.prototype.setBreadcrumbs=function(t){this._data.breadcrumbs=t;return this};Span.prototype.setEnvironment=function(t){this._data.environment=n(n({},this._data.environment),t);return this};Span.prototype.cleanBacktracePath=function(t){if(t.length===0)return this;if(!this._data.error||!this._data.error.backtrace)return this;var e=0;this._data.error.backtrace=this._data.error.backtrace.map((function(r){var n,s;var o=extractPath(r);if(!o)return r;try{for(var a=i(t),u=a.next();!u.done;u=a.next()){var c=u.value;var h=o.match(c);if(h&&!(h.length<2)){var p=h.slice(1).join("");if(p){e++;return r.replace(o,p)}}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return r}));e>0&&this.setEnvironment({backtrace_paths_matched:e.toString()});return this};return Span}(l);function extractPath(t){var e=/^\s*at\s/;var r=/at(?:\s.*)?\s\(?(.*):\d*:\d*\)?$/i;if(t.match(e)){var n=t.match(r);
1return n?n[1]:void 0}var i=/^.*@/;var s=/@\s?(.*):\d*:\d*$/i;if(t.match(i)){n=t.match(s);return n?n[1]:void 0}}var T=function(){function Queue(t){this._data=t||[]}Queue.prototype.clear=function(){this._data=[]};Queue.prototype.values=function(){return this._data};Queue.prototype.push=function(t){var e;return Array.isArray(t)?(e=this._data).push.apply(e,s([],o(t),false)):this._data.push(t)};Queue.prototype.drain=function(){return e(this,(function(t){switch(t.label){case 0:return this._data.length>0?[4,this._data.shift()]:[3,2];case 1:t.sent();return[3,0];case 2:return[2]}}))};return Queue}();var E=function(){function Dispatcher(t,e,r){this._retries=0;this._timerID=0;this._duration=0;this._api=e;this._queue=t;this.options=n({limit:5,initialDuration:1e3},r);this.reset()}Dispatcher.prototype.schedule=function(r){var n=this;r===void 0&&(r=this._duration);var s=a();var o=1.3;var cb=function(){return t(n,void 0,void 0,(function(){var t,n,s,a,u;var c,h;return e(this,(function(e){switch(e.label){case 0:e.trys.push([0,7,8,9]);t=i(this._queue.drain()),n=t.next();e.label=1;case 1:if(!!n.done)return[3,6];s=n.value;if(!s)return[2];e.label=2;case 2:e.trys.push([2,4,,5]);return[4,this._api.push(s)];case 3:e.sent();return[3,5];case 4:e.sent();a=Math.floor(Math.pow(r,o));this._retries=this._retries-1;if(this._retries===0)this.reset();else{this._queue.push(s);this._timerID=this.schedule(a)}return[2];case 5:n=t.next();return[3,1];case 6:return[3,9];case 7:u=e.sent();c={error:u};return[3,9];case 8:try{n&&!n.done&&(h=t.return)&&h.call(t)}finally{if(c)throw c.error}return[7];case 9:this.reset();return[2]}}))}))};return s.setTimeout(cb,r)};Dispatcher.prototype.reset=function(){var t=this.options,e=t.limit,r=t.initialDuration;this._retries=e;this._duration=r};return Dispatcher}();var S=function(){function Appsignal(t){this.VERSION=v;this.ignored=[];this.matchBacktracePaths=[];this._breadcrumbs=[];this._hooks={decorators:Array(),overrides:Array()};this._env=_.serialize();this._queue=new T([]);var e=t.key,r=e===void 0?"":e,n=t.uri,i=t.revision,s=t.ignoreErrors,o=t.matchBacktracePaths;i&&typeof i!=="string"&&(t.revision=String(i));r===""&&console.info("[APPSIGNAL]: No API key provided. Started in development mode. No data will be sent.");this._api=new w({key:r,uri:n,version:this.VERSION});s&&Array.isArray(s)&&(this.ignored=s.filter((function(t){return t instanceof RegExp})).map(unglobalize));if(o){Array.isArray(o)?this.matchBacktracePaths=o:this.matchBacktracePaths=[o];this.matchBacktracePaths=this.matchBacktracePaths.filter((function(t){return t instanceof RegExp})).map(unglobalize)}this._dispatcher=new E(this._queue,this._api);this._options=t}Appsignal.prototype.send=function(t,e,r){var n=this;if(t instanceof Error||t instanceof b||t&&t.error instanceof Error){var i;i="error"in t?t.error:t;if(this.ignored.length!==0){if(i&&"message"in i&&this.ignored.some((function(t){return t.test(i.message)}))){console.warn("[APPSIGNAL]: Ignored an error: ".concat(i.message));return}if(i instanceof b){var a=i.serialize().error;if(a.message&&this.ignored.some((function(t){return t.test(a.message)}))){console.warn("[APPSIGNAL]: Ignored a span: ".concat(a.message));return}}}var u=i instanceof b?i:this._createSpanFromError(i);this._hooks.decorators.length>0&&f.apply(void 0,s([],o(this._hooks.decorators),false))(u);if(e)if(typeof e==="function"){var c=e;c(u)}else{console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a tags object is deprecated. Use the callback argument instead.");var h=m(e)||{};u.setTags(h)}if(r){console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a namespace is deprecated. Use the callback argument instead.");u.setNamespace(r)}this._breadcrumbs.length>0&&u.setBreadcrumbs(this._breadcrumbs);this._hooks.overrides.length>0&&f.apply(void 0,s([],o(this._hooks.overrides),false))(u);u.cleanBacktracePath(this.matchBacktracePaths);if(_.supportsPromises()){this._breadcrumbs=[];if(this._options.key)return this._api.push(u).catch((function(){n._queue.push(u);setTimeout((function(){return n._dispatcher.schedule()}),0)}));console.warn("[APPSIGNAL]: Span not sent because we're in development mode:",u)}else console.error("[APPSIGNAL]: Error not sent. A Promise polyfill is required.")}else console.error("[APPSIGNAL]: Can't send error, given error is not a valid type")};Appsignal.prototype.sendError=function(t,e,r){return this.send(t,e,r)};Appsignal.prototype.use=function(t){t.call(this)};Appsignal.prototype.createSpan=function(t){var e=this._options,r=e.revision,n=r===void 0?"":r,i=e.namespace;var s=new b({environment:this._env,revision:n});i&&s.setNamespace(i);t&&typeof t==="function"&&t(s);return s};Appsignal.prototype.wrap=function(r,n,i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:e.trys.push([0,2,,5]);return[4,r()];case 1:return[2,e.sent()];case 2:t=e.sent();return t instanceof Error||t instanceof ErrorEvent?[4,this.sendError(t,n,i)]:[3,4];case 3:e.sent();e.label=4;case 4:return[2,Promise.reject(t)];case 5:return[2]}}
1))}))};Appsignal.prototype.addDecorator=function(t){this._hooks.decorators.push(t)};Appsignal.prototype.addOverride=function(t){this._hooks.overrides.push(t)};Appsignal.prototype.demo=function(){var t=this._createSpanFromError(new Error("Hello world! This is an error used for demonstration purposes."));t.setAction("TestAction").setParams({path:"/hello",method:"GET"}).setTags({demo_sample:"true"});this.send(t)};Appsignal.prototype.addBreadcrumb=function(t){var e=n(n({timestamp:Math.round((new Date).getTime()/1e3)},t),{metadata:m(t.metadata)});if(e.category)if(e.action){this._breadcrumbs.length===20&&this._breadcrumbs.pop();this._breadcrumbs.unshift(e)}else console.warn("[APPSIGNAL]: Breadcrumb not added. `action` is missing.");else console.warn("[APPSIGNAL]: Breadcrumb not added. `category` is missing.")};Appsignal.prototype._createSpanFromError=function(t){var e=this.createSpan();e.setError(t);return e};return Appsignal}();function unglobalize(t){return new RegExp(t.source,t.flags.replace("g",""))}export{S as default};
2

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.