Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
3 lines
34 KiB
Plaintext
3 lines
34 KiB
Plaintext
/*! @sentry/node-core 10.39.0 (ab54c5c) | https://github.com/getsentry/sentry-javascript */
|
|
import{Session as t}from"node:inspector";import{workerData as n,parentPort as e}from"node:worker_threads";import{posix as r,sep as o}from"node:path";import*as i from"node:http";import*as s from"node:https";import{Readable as c}from"node:stream";import{createGzip as u}from"node:zlib";import*as a from"node:net";import*as f from"node:tls";const h="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,p=globalThis,d="10.39.0";function l(){return m(p),p}function m(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||d,n[d]=n[d]||{}}function g(t,n,e=p){const r=e.__SENTRY__=e.__SENTRY__||{},o=r[d]=r[d]||{};return o[t]||(o[t]=n())}const y={};function b(t){if(!("console"in p))return t();const n=p.console,e={},r=Object.keys(y);r.forEach(t=>{const r=y[t];e[t]=n[t],n[t]=r});try{return t()}finally{r.forEach(t=>{n[t]=e[t]})}}function v(){return w().enabled}function _(t,...n){h&&v()&&b(()=>{p.console[t](`Sentry Logger [${t}]:`,...n)})}function w(){return h?g("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const S={enable:function(){w().enabled=!0},disable:function(){w().enabled=!1},isEnabled:v,log:function(...t){_("log",...t)},warn:function(...t){_("warn",...t)},error:function(...t){_("error",...t)}},$=/captureMessage|captureException/;function E(t){return t[t.length-1]||{}}const x="<anonymous>";const N=Object.prototype.toString;function C(t,n){return N.call(t)===`[object ${n}]`}function A(t){return C(t,"String")}function j(t){return C(t,"Object")}function k(t){return Boolean(t?.then&&"function"==typeof t.then)}function T(t,n){try{return t instanceof n}catch{return!1}}const I=p;function R(t,n){const e=t,r=[];if(!e?.tagName)return"";if(I.HTMLElement&&e instanceof HTMLElement&&e.dataset){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}r.push(e.tagName.toLowerCase());const o=n?.length?n.filter(t=>e.getAttribute(t)).map(t=>[t,e.getAttribute(t)]):null;if(o?.length)o.forEach(t=>{r.push(`[${t[0]}="${t[1]}"]`)});else{e.id&&r.push(`#${e.id}`);const t=e.className;if(t&&A(t)){const n=t.split(/\s+/);for(const t of n)r.push(`.${t}`)}}const i=["aria-label","type","name","title","alt"];for(const t of i){const n=e.getAttribute(t);n&&r.push(`[${t}="${n}"]`)}return r.join("")}function O(t){if(function(t){switch(N.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return T(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...D(t)};if(n=t,"undefined"!=typeof Event&&T(n,Event)){const n={type:t.type,target:P(t.target),currentTarget:P(t.currentTarget),...D(t)};return"undefined"!=typeof CustomEvent&&T(t,CustomEvent)&&(n.detail=t.detail),n}return t;var n}function P(t){try{return n=t,"undefined"!=typeof Element&&T(n,Element)?function(t,n={}){if(!t)return"<unknown>";try{let e=t;const r=5,o=[];let i=0,s=0;const c=" > ",u=c.length;let a;const f=Array.isArray(n)?n:n.keyAttrs,h=!Array.isArray(n)&&n.maxStringLength||80;for(;e&&i++<r&&(a=R(e,f),!("html"===a||i>1&&s+o.length*u+a.length>=h));)o.push(a),s+=a.length,e=e.parentNode;return o.reverse().join(c)}catch{return"<unknown>"}}(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}var n}function D(t){if("object"==typeof t&&null!==t){const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}return{}}let U,M;function L(t){if(void 0!==U)return U?U(t):t();const n=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),e=p;return n in e&&"function"==typeof e[n]?(U=e[n],U(t)):(U=null,t())}function B(){return L(()=>Math.random())}function W(){return L(()=>Date.now())}function z(t,n=0){return"string"!=typeof t||0===n||t.length<=n?t:`${t.slice(0,n)}...`}function F(t=function(){const t=p;return t.crypto||t.msCrypto}()){try{if(t?.randomUUID)return L(()=>t.randomUUID()).replace(/-/g,"")}catch{}return M||(M=[1e7]+1e3+4e3+8e3+1e11),M.replace(/[018]/g,t=>(t^(16*B()&15)>>t/4).toString(16))}function G(){return W()/1e3}let H;function J(){return(H??(H=function(){const{performance:t}=p;if(!t?.now||!t.timeOrigin)return G;const n=t.timeOrigin;return()=>(n+L(()=>t.now()))/1e3}()))()}function Y(t){const n=J(),e={sid:F(),init:!0,timestamp:n,started:n,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return{sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}(e)};return t&&V(e,t),e}function V(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),t.did||n.did||(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||J(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:F()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function K(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=K(r[t],n[t],e-1));return r}function Z(){return F()}function q(){return F().substring(16)}const Q="_sentrySpan";function X(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{h&&S.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,Q,n):delete t[Q]}function tt(t){return t[Q]}class nt{constructor(){this.t=!1,this.o=[],this.i=[],this.u=[],this.h=[],this.p={},this.l={},this.m={},this.v={},this._={},this.S={},this.N={traceId:Z(),sampleRand:B()}}clone(){const t=new nt;return t.u=[...this.u],t.l={...this.l},t.m={...this.m},t.v={...this.v},t._={...this._},this._.flags&&(t._.flags={values:[...this._.flags.values]}),t.p=this.p,t.C=this.C,t.A=this.A,t.j=this.j,t.k=this.k,t.i=[...this.i],t.h=[...this.h],t.S={...this.S},t.N={...this.N},t.T=this.T,t.I=this.I,t.R=this.R,X(t,tt(this)),t}setClient(t){this.T=t}setLastEventId(t){this.I=t}getClient(){return this.T}lastEventId(){return this.I}addScopeListener(t){this.o.push(t)}addEventProcessor(t){return this.i.push(t),this}setUser(t){return this.p=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.A&&V(this.A,{user:t}),this.O(),this}getUser(){return this.p}setConversationId(t){return this.R=t||void 0,this.O(),this}setTags(t){return this.l={...this.l,...t},this.O(),this}setTag(t,n){return this.setTags({[t]:n})}setAttributes(t){return this.m={...this.m,...t},this.O(),this}setAttribute(t,n){return this.setAttributes({[t]:n})}removeAttribute(t){return t in this.m&&(delete this.m[t],this.O()),this}setExtras(t){return this.v={...this.v,...t},this.O(),this}setExtra(t,n){return this.v={...this.v,[t]:n},this.O(),this}setFingerprint(t){return this.k=t,this.O(),this}setLevel(t){return this.C=t,this.O(),this}setTransactionName(t){return this.j=t,this.O(),this}setContext(t,n){return null===n?delete this._[t]:this._[t]=n,this.O(),this}setSession(t){return t?this.A=t:delete this.A,this.O(),this}getSession(){return this.A}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,e=n instanceof nt?n.getScopeData():j(n)?t:void 0,{tags:r,attributes:o,extra:i,user:s,contexts:c,level:u,fingerprint:a=[],propagationContext:f,conversationId:h}=e||{};return this.l={...this.l,...r},this.m={...this.m,...o},this.v={...this.v,...i},this._={...this._,...c},s&&Object.keys(s).length&&(this.p=s),u&&(this.C=u),a.length&&(this.k=a),f&&(this.N=f),h&&(this.R=h),this}clear(){return this.u=[],this.l={},this.m={},this.v={},this.p={},this._={},this.C=void 0,this.j=void 0,this.k=void 0,this.A=void 0,this.R=void 0,X(this,void 0),this.h=[],this.setPropagationContext({traceId:Z(),sampleRand:B()}),this.O(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:G(),...t,message:t.message?z(t.message,2048):t.message};return this.u.push(r),this.u.length>e&&(this.u=this.u.slice(-e),this.T?.recordDroppedEvent("buffer_overflow","log_item")),this.O(),this}getLastBreadcrumb(){return this.u[this.u.length-1]}clearBreadcrumbs(){return this.u=[],this.O(),this}addAttachment(t){return this.h.push(t),this}clearAttachments(){return this.h=[],this}getScopeData(){return{breadcrumbs:this.u,attachments:this.h,contexts:this._,tags:this.l,attributes:this.m,extra:this.v,user:this.p,level:this.C,fingerprint:this.k||[],eventProcessors:this.i,propagationContext:this.N,sdkProcessingMetadata:this.S,transactionName:this.j,span:tt(this),conversationId:this.R}}setSDKProcessingMetadata(t){return this.S=K(this.S,t,2),this}setPropagationContext(t){return this.N=t,this}getPropagationContext(){return this.N}captureException(t,n){const e=n?.event_id||F();if(!this.T)return h&&S.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.T.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e?.event_id||F();if(!this.T)return h&&S.warn("No client configured on scope - will not capture message!"),r;const o=e?.syntheticException??new Error(t);return this.T.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=t.event_id||n?.event_id||F();return this.T?(this.T.captureEvent(t,{...n,event_id:e},this),e):(h&&S.warn("No client configured on scope - will not capture event!"),e)}O(){this.t||(this.t=!0,this.o.forEach(t=>{t(this)}),this.t=!1)}}class et{constructor(t,n){let e,r;e=t||new nt,r=n||new nt,this.P=[{scope:e}],this.D=r}withScope(t){const n=this.U();let e;try{e=t(n)}catch(t){throw this.M(),t}return k(e)?e.then(t=>(this.M(),t),t=>{throw this.M(),t}):(this.M(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.D}getStackTop(){return this.P[this.P.length-1]}U(){const t=this.getScope().clone();return this.P.push({client:this.getClient(),scope:t}),t}M(){return!(this.P.length<=1)&&!!this.P.pop()}}function rt(){const t=m(l());return t.stack=t.stack||new et(g("defaultCurrentScope",()=>new nt),g("defaultIsolationScope",()=>new nt))}function ot(t){return rt().withScope(t)}function it(t,n){const e=rt();return e.withScope(()=>(e.getStackTop().scope=t,n(t)))}function st(t){return rt().withScope(()=>t(rt().getIsolationScope()))}function ct(t){const n=m(t);return n.acs?n.acs:{withIsolationScope:st,withScope:ot,withSetScope:it,withSetIsolationScope:(t,n)=>st(n),getCurrentScope:()=>rt().getScope(),getIsolationScope:()=>rt().getIsolationScope()}}function ut(){return ct(l()).getCurrentScope().getClient()}function at(t){if(t){if("object"==typeof t&&"deref"in t&&"function"==typeof t.deref)try{return t.deref()}catch{return}return t}}function ft(t){const n=t;return{scope:n._sentryScope,isolationScope:at(n._sentryIsolationScope)}}const ht=/^sentry-/;function pt(t){const n=function(t){if(!t||!A(t)&&!Array.isArray(t))return;if(Array.isArray(t))return t.reduce((t,n)=>{const e=dt(n);return Object.entries(e).forEach(([n,e])=>{t[n]=e}),t},{});return dt(t)}(t);if(!n)return;const e=Object.entries(n).reduce((t,[n,e])=>{if(n.match(ht)){t[n.slice(7)]=e}return t},{});return Object.keys(e).length>0?e:void 0}function dt(t){return t.split(",").map(t=>{const n=t.indexOf("=");if(-1===n)return[];return[t.slice(0,n),t.slice(n+1)].map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})}).reduce((t,[n,e])=>(n&&e&&(t[n]=e),t),{})}const lt=/^o(\d+)\./;function mt(t,n=!1){const{host:e,path:r,pass:o,port:i,projectId:s,protocol:c,publicKey:u}=t;return`${c}://${u}${n&&o?`:${o}`:""}@${e}${i?`:${i}`:""}/${r?`${r}/`:r}${s}`}function gt(t){const n=t.getOptions(),{host:e}=t.getDsn()||{};let r;return n.orgId?r=String(n.orgId):e&&(r=function(t){const n=t.match(lt);return n?.[1]}(e)),r}function yt(t){const{spanId:n,traceId:e,isRemote:r}=t.spanContext(),o=r?n:wt(t).parent_span_id,i=ft(t).scope;return{parent_span_id:o,span_id:r?i?.getPropagationContext().propagationSpanId||q():n,trace_id:e}}function bt(t){return t&&t.length>0?t.map(({context:{spanId:t,traceId:n,traceFlags:e,...r},attributes:o})=>({span_id:t,trace_id:n,sampled:1===e,attributes:o,...r})):void 0}function vt(t){return"number"==typeof t?_t(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?_t(t.getTime()):J()}function _t(t){return t>9999999999?t/1e3:t}function wt(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();const{spanId:n,traceId:e}=t.spanContext();if(function(t){const n=t;return!!(n.attributes&&n.startTime&&n.name&&n.endTime&&n.status)}(t)){const{attributes:r,startTime:o,name:i,endTime:s,status:c,links:u}=t;return{span_id:n,trace_id:e,data:r,description:i,parent_span_id:"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0,start_timestamp:vt(o),timestamp:vt(s)||void 0,status:St(c),op:r["sentry.op"],origin:r["sentry.origin"],links:bt(u)}}return{span_id:n,trace_id:e,start_timestamp:0,data:{}}}function St(t){if(t&&0!==t.code)return 1===t.code?"ok":t.message||"internal_error"}function $t(t){return t._sentryRootSpan||t}function Et(t){const n=ut();if(!n)return{};const e=$t(t),r=wt(e),o=r.data,i=e.spanContext().traceState,s=i?.get("sentry.sample_rate")??o["sentry.sample_rate"]??o["sentry.previous_trace_sample_rate"];function c(t){return"number"!=typeof s&&"string"!=typeof s||(t.sample_rate=`${s}`),t}const u=e._frozenDsc;if(u)return c(u);const a=i?.get("sentry.dsc"),f=a&&pt(a);if(f)return c(f);const h=function(t,n){const e=n.getOptions(),{publicKey:r}=n.getDsn()||{},o={environment:e.environment||"production",release:e.release,public_key:r,trace_id:t,org_id:gt(n)};return n.emit("createDsc",o),o}(t.spanContext().traceId,n),p=o["sentry.source"],d=r.description;return"url"!==p&&d&&(h.transaction=d),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=ut()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(h.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return 1===n}(e)),h.sample_rand=i?.get("sentry.sample_rand")??ft(e).scope?.getPropagationContext().sampleRand.toString()),c(h),n.emit("createDsc",h,e),h}function xt(t,n=100,e=1/0){try{return Nt("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function Nt(t,n,e=1/0,r=1/0,o=function(){const t=new WeakSet;function n(n){return!!t.has(n)||(t.add(n),!1)}function e(n){t.delete(n)}return[n,e]}()){const[i,s]=o;if(null==n||["boolean","string"].includes(typeof n)||"number"==typeof n&&Number.isFinite(n))return n;const c=function(t,n){try{if("domain"===t&&n&&"object"==typeof n&&n.L)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&n===global)return"[Global]";if("undefined"!=typeof window&&n===window)return"[Window]";if("undefined"!=typeof document&&n===document)return"[Document]";if("object"==typeof(e=n)&&null!==e&&(e.__isVue||e.B||e.__v_isVNode))return function(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}(n);if(function(t){return j(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(n))return"[SyntheticEvent]";if("number"==typeof n&&!Number.isFinite(n))return`[${n}]`;if("function"==typeof n)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||x}catch{return x}}(n)}]`;if("symbol"==typeof n)return`[${String(n)}]`;if("bigint"==typeof n)return`[BigInt: ${String(n)}]`;const r=function(t){const n=Object.getPrototypeOf(t);return n?.constructor?n.constructor.name:"null prototype"}(n);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var e}(t,n);if(!c.startsWith("[object "))return c;if(n.__sentry_skip_normalization__)return n;const u="number"==typeof n.__sentry_override_normalization_depth__?n.__sentry_override_normalization_depth__:e;if(0===u)return c.replace("object ","");if(i(n))return"[Circular ~]";const a=n;if(a&&"function"==typeof a.toJSON)try{return Nt("",a.toJSON(),u-1,r,o)}catch{}const f=Array.isArray(n)?[]:{};let h=0;const p=O(n);for(const t in p){if(!Object.prototype.hasOwnProperty.call(p,t))continue;if(h>=r){f[t]="[MaxProperties ~]";break}const n=p[t];f[t]=Nt(t,n,u-1,r,o),h++}return s(n),f}function Ct(t,n){const e=n.replace(/\\/g,"/").replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");let r=t;try{r=decodeURI(t)}catch{}return r.replace(/\\/g,"/").replace(/webpack:\/?/g,"").replace(new RegExp(`(file://)?/*${e}/*`,"ig"),"app:///")}function At(t,n=[]){return[t,n]}function jt(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function kt(t){const n=m(p);return n.encodePolyfill?n.encodePolyfill(t):(new TextEncoder).encode(t)}function Tt(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[kt(r),t]:r.push("string"==typeof t?kt(t):t)}for(const t of e){const[n,e]=t;if(o(`\n${JSON.stringify(n)}\n`),"string"==typeof e||e instanceof Uint8Array)o(e);else{let t;try{t=JSON.stringify(e)}catch{t=JSON.stringify(xt(e))}o(t)}}return"string"==typeof r?r:function(t){const n=t.reduce((t,n)=>t+n.length,0),e=new Uint8Array(n);let r=0;for(const n of t)e.set(n,r),r+=n.length;return e}(r)}const It={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function Rt(t){if(!t?.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}function Ot(t,n,e,r){const o=Rt(e),i=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,n){if(!n)return t;const e=t.sdk||{};t.sdk={...e,name:e.name||n.name,version:e.version||n.version,integrations:[...t.sdk?.integrations||[],...n.integrations||[]],packages:[...t.sdk?.packages||[],...n.packages||[]],settings:t.sdk?.settings||n.settings?{...t.sdk?.settings,...n.settings}:void 0}}(t,e?.sdk);const s=function(t,n,e,r){const o=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!e&&r&&{dsn:mt(r)},...o&&{trace:o}}}(t,o,r,n);delete t.sdkProcessingMetadata;return At(s,[[{type:i},t]])}const Pt="__SENTRY_SUPPRESS_TRACING__";function Dt(t){const n=ct(l());return n.suppressTracing?n.suppressTracing(t):function(...t){const n=ct(l());if(2===t.length){const[e,r]=t;return e?n.withSetScope(e,r):n.withScope(r)}return n.withScope(t[0])}(n=>{n.setSDKProcessingMetadata({[Pt]:!0});const e=t();return n.setSDKProcessingMetadata({[Pt]:void 0}),e})}class Ut{constructor(t){this.W=0,this.F=[],this.G(t)}then(t,n){return new Ut((e,r)=>{this.F.push([!1,n=>{if(t)try{e(t(n))}catch(t){r(t)}else e(n)},t=>{if(n)try{e(n(t))}catch(t){r(t)}else r(t)}]),this.H()})}catch(t){return this.then(t=>t,t)}finally(t){return new Ut((n,e)=>{let r,o;return this.then(n=>{o=!1,r=n,t&&t()},n=>{o=!0,r=n,t&&t()}).then(()=>{o?e(r):n(r)})})}H(){if(0===this.W)return;const t=this.F.slice();this.F=[],t.forEach(t=>{t[0]||(1===this.W&&t[1](this.J),2===this.W&&t[2](this.J),t[0]=!0)})}G(t){const n=(t,n)=>{0===this.W&&(k(n)?n.then(e,r):(this.W=t,this.J=n,this.H()))},e=t=>{n(1,t)},r=t=>{n(2,t)};try{t(e,r)}catch(t){r(t)}}}function Mt(t,n){const{fingerprint:e,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=n;!function(t,n){const{extra:e,tags:r,user:o,contexts:i,level:s,transactionName:c}=n;Object.keys(e).length&&(t.extra={...e,...t.extra});Object.keys(r).length&&(t.tags={...r,...t.tags});Object.keys(o).length&&(t.user={...o,...t.user});Object.keys(i).length&&(t.contexts={...i,...t.contexts});s&&(t.level=s);c&&"transaction"!==t.type&&(t.transaction=c)}(t,n),r&&function(t,n){t.contexts={trace:yt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Et(n),...t.sdkProcessingMetadata};const e=$t(n),r=wt(e).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,n){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],n&&(t.fingerprint=t.fingerprint.concat(n));t.fingerprint.length||delete t.fingerprint}(t,e),function(t,n){const e=[...t.breadcrumbs||[],...n];t.breadcrumbs=e.length?e:void 0}(t,o),function(t,n){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...n}}(t,i)}const Lt=Symbol.for("SentryBufferFullError");function Bt(t=100){const n=new Set;function e(t){n.delete(t)}return{get $(){return Array.from(n)},add:function(r){if(!(n.size<t))return o=Lt,new Ut((t,n)=>{n(o)});var o;const i=r();return n.add(i),i.then(()=>e(i),()=>e(i)),i},drain:function(t){if(!n.size)return e=!0,new Ut(t=>{t(e)});var e;const r=Promise.allSettled(Array.from(n)).then(()=>!0);if(!t)return r;const o=[r,new Promise(n=>{return"object"==typeof(e=setTimeout(()=>n(!1),t))&&"function"==typeof e.unref&&e.unref(),e;var e})];return Promise.race(o)}}}function Wt(t,{statusCode:n,headers:e},r=W()){const o={...t},i=e?.["x-sentry-rate-limits"],s=e?.["retry-after"];if(i)for(const t of i.trim().split(",")){const[n,e,,,i]=t.split(":",5),s=parseInt(n,10),c=1e3*(isNaN(s)?60:s);if(e)for(const t of e.split(";"))"metric_bucket"===t&&i&&!i.split(";").includes("custom")||(o[t]=r+c);else o.all=r+c}else s?o.all=r+function(t,n=W()){const e=parseInt(`${t}`,10);if(!isNaN(e))return 1e3*e;const r=Date.parse(`${t}`);return isNaN(r)?6e4:r-n}(s,r):429===n&&(o.all=r+6e4);return o}function zt(t,n,e=Bt(t.bufferSize||64)){let r={};return{send:function(t){const o=[];if(jt(t,(t,n)=>{const e=function(t){return It[t]}(n);(function(t,n,e=W()){return function(t,n){return t[n]||t.all||0}(t,n)>e})(r,e)||o.push(t)}),0===o.length)return Promise.resolve({});const i=At(t[0],o),s=t=>{!function(t,n){return jt(t,(t,e)=>n.includes(e))}(i,["client_report"])?jt(i,(t,n)=>{}):h&&S.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`)};return e.add(()=>n({body:Tt(i)}).then(t=>413===t.statusCode?(h&&S.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),s("send_error"),t):(h&&void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&S.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=Wt(r,t),t),t=>{throw s("network_error"),h&&S.error("Encountered error running transport request:",t),t})).then(t=>t,t=>{if(t===Lt)return h&&S.error("Skipped sending event because buffer is full."),s("queue_overflow"),Promise.resolve({});throw t})},flush:t=>e.drain(t)}}const Ft=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Gt(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=Ft.exec(n);return e?e.slice(1):[]}(t),e=n[0]||"";let r=n[1];return e||r?(r&&(r=r.slice(0,r.length-1)),e+r):"."}function Ht(t,n=!1){return!(n||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==t&&!t.includes("node_modules/")}const Jt=Symbol("AgentBaseInternalState");class Yt extends i.Agent{constructor(t){super(t),this[Jt]={}}isSecureEndpoint(t){if(t){if("boolean"==typeof t.secureEndpoint)return t.secureEndpoint;if("string"==typeof t.protocol)return"https:"===t.protocol}const{stack:n}=new Error;return"string"==typeof n&&n.split("\n").some(t=>-1!==t.indexOf("(https.js:")||-1!==t.indexOf("node:https:"))}createSocket(t,n,e){const r={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(t,r)).then(o=>{if(o instanceof i.Agent)return o.addRequest(t,r);this[Jt].currentSocket=o,super.createSocket(t,n,e)},e)}createConnection(){const t=this[Jt].currentSocket;if(this[Jt].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[Jt].defaultPort??("https:"===this.protocol?443:80)}set defaultPort(t){this[Jt]&&(this[Jt].defaultPort=t)}get protocol(){return this[Jt].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[Jt]&&(this[Jt].protocol=t)}}function Vt(...t){S.log("[https-proxy-agent:parse-proxy-response]",...t)}function Kt(t){return new Promise((n,e)=>{let r=0;const o=[];function i(){const c=t.read();c?function(c){o.push(c),r+=c.length;const u=Buffer.concat(o,r),a=u.indexOf("\r\n\r\n");if(-1===a)return Vt("have not received end of HTTP headers yet..."),void i();const f=u.subarray(0,a).toString("ascii").split("\r\n"),h=f.shift();if(!h)return t.destroy(),e(new Error("No header received from proxy CONNECT response"));const p=h.split(" "),d=+(p[1]||0),l=p.slice(2).join(" "),m={};for(const n of f){if(!n)continue;const r=n.indexOf(":");if(-1===r)return t.destroy(),e(new Error(`Invalid header from proxy CONNECT response: "${n}"`));const o=n.slice(0,r).toLowerCase(),i=n.slice(r+1).trimStart(),s=m[o];"string"==typeof s?m[o]=[s,i]:Array.isArray(s)?s.push(i):m[o]=i}Vt("got proxy server response: %o %o",h,m),s(),n({connect:{statusCode:d,statusText:l,headers:m},buffered:u})}(c):t.once("readable",i)}function s(){t.removeListener("end",c),t.removeListener("error",u),t.removeListener("readable",i)}function c(){s(),Vt("onend"),e(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){s(),Vt("onerror %o",t),e(t)}t.on("error",u),t.on("end",c),i()})}function Zt(...t){S.log("[https-proxy-agent]",...t)}class qt extends Yt{static __initStatic(){this.protocols=["http","https"]}constructor(t,n){super(n),this.options={},this.proxy="string"==typeof t?new URL(t):t,this.proxyHeaders=n?.headers??{},Zt("Creating new HttpsProxyAgent instance: %o",this.proxy.href);const e=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),r=this.proxy.port?parseInt(this.proxy.port,10):"https:"===this.proxy.protocol?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?Xt(n,"headers"):null,host:e,port:r}}async connect(t,n){const{proxy:e}=this;if(!n.host)throw new TypeError('No "host" provided');let r;if("https:"===e.protocol){Zt("Creating `tls.Socket`: %o",this.connectOpts);const t=this.connectOpts.servername||this.connectOpts.host;r=f.connect({...this.connectOpts,servername:t&&a.isIP(t)?void 0:t})}else Zt("Creating `net.Socket`: %o",this.connectOpts),r=a.connect(this.connectOpts);const o="function"==typeof this.proxyHeaders?this.proxyHeaders():{...this.proxyHeaders},i=a.isIPv6(n.host)?`[${n.host}]`:n.host;let s=`CONNECT ${i}:${n.port} HTTP/1.1\r\n`;if(e.username||e.password){const t=`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(t).toString("base64")}`}o.Host=`${i}:${n.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const t of Object.keys(o))s+=`${t}: ${o[t]}\r\n`;const c=Kt(r);r.write(`${s}\r\n`);const{connect:u,buffered:h}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),200===u.statusCode){if(t.once("socket",Qt),n.secureEndpoint){Zt("Upgrading socket connection to TLS");const t=n.servername||n.host;return f.connect({...Xt(n,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const p=new a.Socket({writable:!1});return p.readable=!0,t.once("socket",t=>{Zt("Replaying proxy buffer for failed request"),t.push(h),t.push(null)}),p}}function Qt(t){t.resume()}function Xt(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}qt.__initStatic();function tn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const nn=n;let en,rn=0,on={};function sn(t){nn.debug&&console.log(`[ANR Worker] ${t}`)}var cn,un,an;const fn=function(t){let n;try{n=new URL(t.url)}catch(n){return b(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),zt(t,()=>Promise.resolve({}))}const e="https:"===n.protocol,r=function(t,n){const{no_proxy:e}=process.env,r=e?.split(",").some(n=>t.host.endsWith(n)||t.hostname.endsWith(n));return r?void 0:n}(n,t.proxy||(e?process.env.https_proxy:void 0)||process.env.http_proxy),o=e?s:i,a=void 0!==t.keepAlive&&t.keepAlive,f=r?new qt(r):new o.Agent({keepAlive:a,maxSockets:30,timeout:2e3}),h=function(t,n,e){const{hostname:r,pathname:o,port:i,protocol:s,search:a}=new URL(t.url);return function(f){return new Promise((h,p)=>{Dt(()=>{let d=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const l={...t.headers};f.body.length>32768&&(l["content-encoding"]="gzip",d=d.pipe(u()));const m=r.startsWith("["),g=n.request({method:"POST",agent:e,headers:l,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:i,protocol:s,ca:t.caCerts},t=>{t.on("data",()=>{}),t.on("end",()=>{}),t.setEncoding("utf8");const n=t.headers["retry-after"]??null,e=t.headers["x-sentry-rate-limits"]??null;h({statusCode:t.statusCode,headers:{"retry-after":n,"x-sentry-rate-limits":Array.isArray(e)?e[0]||null:e}})});g.on("error",p),d.pipe(g)})})}}(t,t.httpModule??o,f);return zt(t,h)}({url:(cn=nn.dsn,un=nn.tunnel,an=nn.sdkMetadata.sdk,un||`${function(t){return`${function(t){const n=t.protocol?`${t.protocol}:`:"",e=t.port?`:${t.port}`:"";return`${n}//${t.host}${e}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(cn)}?${function(t,n){const e={sentry_version:"7"};return t.publicKey&&(e.sentry_key=t.publicKey),n&&(e.sentry_client=`${n.name}/${n.version}`),new URLSearchParams(e).toString()}(cn,an)}`)});async function hn(){if(en){sn("Sending abnormal session"),V(en,{status:"abnormal",abnormal_mechanism:"anr_foreground",release:nn.release,environment:nn.environment});const t=function(t,n,e,r){const o=Rt(e);return At({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:mt(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(en,nn.dsn,nn.sdkMetadata,nn.tunnel);sn(JSON.stringify(t)),await fn.send(t);try{e?.postMessage("session-ended")}catch{}}}function pn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(E(n).function||"")&&n.pop(),n.reverse(),$.test(E(n).function||"")&&(n.pop(),$.test(E(n).function||"")&&n.pop()),n.slice(0,50).map(t=>({...t,filename:t.filename||E(n).filename,function:t.function||"?"}))}(t);if(nn.appRootPath)for(const t of n)t.filename&&(t.filename=Ct(t.filename,nn.appRootPath));return n}async function dn(t,n){if(rn>=nn.maxAnrEvents)return;rn+=1,await hn(),sn("Sending event");const e={event_id:F(),contexts:nn.contexts,release:nn.release,environment:nn.environment,dist:nn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${nn.anrThreshold} ms`,stacktrace:{frames:pn(t)},mechanism:{type:"ANR"}}]},tags:nn.staticTags};n&&function(t,n){if(Mt(t,n),!t.contexts?.trace){const{traceId:e,parentSpanId:r,propagationSpanId:o}=n.propagationContext;t.contexts={trace:{trace_id:e,span_id:o||q(),parent_span_id:r},...t.contexts}}}(e,n),function(t){if(0===Object.keys(on).length)return;const n=nn.appRootPath?{}:on;if(nn.appRootPath)for(const[t,e]of Object.entries(on))n[Ct(t,nn.appRootPath)]=e;const e=new Map;for(const r of t.exception?.values||[])for(const t of r.stacktrace?.frames||[]){const r=t.abs_path||t.filename;r&&n[r]&&e.set(r,n[r])}if(e.size>0){const n=[];for(const[t,r]of e.entries())n.push({type:"sourcemap",code_file:t,debug_id:r});t.debug_meta={images:n}}}(e);const r=Ot(e,nn.dsn,nn.sdkMetadata,nn.tunnel);sn(JSON.stringify(r)),await fn.send(r),await fn.flush(2e3),rn>=nn.maxAnrEvents&&setTimeout(()=>{process.exit(0)},5e3)}let ln;if(sn("Started"),nn.captureStackTrace){sn("Connecting to debugger");const n=new t;n.connectToMainThread(),sn("Connected to debugger");const e=new Map;n.on("Debugger.scriptParsed",t=>{e.set(t.params.scriptId,t.params.url)}),n.on("Debugger.paused",t=>{if("other"===t.params.reason)try{sn("Debugger paused");const i=[...t.params.callFrames],s=nn.appRootPath?function(t=(process.argv[1]?Gt(process.argv[1]):process.cwd()),n="\\"===o){const e=n?tn(t):t;return t=>{if(!t)return;const o=n?tn(t):t;let{dir:i,base:s,ext:c}=r.parse(o);".js"!==c&&".mjs"!==c&&".cjs"!==c||(s=s.slice(0,-1*c.length));const u=decodeURIComponent(s);i||(i=".");const a=i.lastIndexOf("/node_modules");if(a>-1)return`${i.slice(a+14).replace(/\//g,".")}:${u}`;if(i.startsWith(e)){const t=i.slice(e.length+1).replace(/\//g,".");return t?`${t}:${u}`:u}return u}}(nn.appRootPath):()=>{},c=i.map(t=>function(t,n,e){const r=n?n.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,i=t.location.lineNumber?t.location.lineNumber+1:void 0;return{filename:r,module:e(r),function:t.functionName||"?",colno:o,lineno:i,in_app:r?Ht(r):void 0}}(t,e.get(t.location.scriptId),s)),u=setTimeout(()=>{dn(c).then(null,()=>{sn("Sending ANR event failed.")})},5e3);n.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},(t,e)=>{t&&sn(`Error executing script: '${t.message}'`),clearTimeout(u);const r=e?.result?e.result.value:void 0;n.post("Debugger.resume"),n.post("Debugger.disable"),dn(c,r).then(null,()=>{sn("Sending ANR event failed.")})})}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}}),ln=()=>{try{n.post("Debugger.enable",()=>{n.post("Debugger.pause")})}catch{}}}const{poll:mn}=function(t,n,e,r){const o=t();let i=!1,s=!0;return setInterval(()=>{const t=o.getTimeMs();!1===i&&t>n+e&&(i=!0,s&&r()),t<n+e&&(i=!1)},20),{poll:()=>{o.reset()},enabled:t=>{s=t}}}(function(){let t=process.hrtime();return{getTimeMs:()=>{const[n,e]=process.hrtime(t);return Math.floor(1e3*n+e/1e6)},reset:()=>{t=process.hrtime()}}},nn.pollInterval,nn.anrThreshold,function(){sn("Watchdog timeout"),ln?(sn("Pausing debugger to capture stack trace"),ln()):(sn("Capturing event without a stack trace"),dn().then(null,()=>{sn("Sending ANR event failed on watchdog timeout.")}))});e?.on("message",t=>{t.session&&(en=Y(t.session)),t.debugImages&&(on=t.debugImages),mn()});
|