@aventurevc/mcp-server 0.8.7 → 0.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -118
- package/dist/chunks/ResourceImpl-Dm7ANMDE.js +1 -0
- package/dist/chunks/auth-DHJOzjfx.js +114 -0
- package/dist/chunks/esm-DJxYRwLA.js +222 -0
- package/dist/chunks/{index.node-Cae5ADms.js → index.node-BHu6TmNV.js} +1 -1
- package/dist/chunks/rolldown-runtime-tZXQYakl.js +1 -0
- package/dist/chunks/src-BqpNQELF.js +5 -0
- package/dist/chunks/text-field-DrqjhSVy.js +1 -0
- package/dist/chunks/{text-response-CLqndug9.js → text-response-o-moM-xZ.js} +1 -1
- package/dist/mcp-server/index.js +53 -53
- package/package.json +4 -4
- package/dist/chunks/auth-BkmEH7-r.js +0 -114
- package/dist/chunks/esm-D5poD1wu.js +0 -222
- package/dist/chunks/esm-VTPP_TTM.js +0 -1
- package/dist/chunks/src-UMZE8fVn.js +0 -5
- package/dist/chunks/text-field-CtBuc7ot.js +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import{i as e,r as t,t as n}from"./rolldown-runtime-tZXQYakl.js";import{D as r,G as i,I as a,J as o,L as s,N as c,Q as l,R as u,S as d,T as f,V as p,X as m,a as h,b as g,c as _,i as v,j as y,k as ee,l as te,q as ne,r as re,s as ie,t as ae,u as oe,v as b,w as se}from"./ResourceImpl-Dm7ANMDE.js";import{a as ce,c as le,d as ue,f as de,i as fe,l as pe,m as me,p as he,r as ge,t as _e,u as ve}from"./src-BqpNQELF.js";import*as ye from"node:module";import be from"node:module";import{EventEmitter as xe,errorMonitor as Se}from"node:events";import{execFile as Ce}from"node:child_process";import we,{join as Te,posix as Ee,sep as De}from"node:path";import Oe,{createReadStream as ke,readFile as Ae,readFileSync as je,readdir as Me}from"node:fs";import*as Ne from"node:util";import Pe,{format as Fe,promisify as Ie,types as Le}from"node:util";import{promisify as Re,types as ze}from"util";import*as Be from"fs";import{readFileSync as Ve}from"fs";import*as He from"path";import{normalize as x}from"path";import Ue,{fileURLToPath as We}from"node:url";import{AsyncLocalStorage as Ge}from"node:async_hooks";import*as S from"node:net";import*as C from"node:http";import{Readable as Ke}from"node:stream";import*as w from"node:diagnostics_channel";import{subscribe as qe,unsubscribe as T}from"node:diagnostics_channel";import*as Je from"node:tls";import{createGzip as E}from"node:zlib";import{MessageChannel as Ye,Worker as Xe,isMainThread as Ze,parentPort as Qe}from"node:worker_threads";import*as $e from"node:os";import et from"node:os";import{URL as tt}from"url";import nt from"node:tty";import*as rt from"module";import{isMainThread as it,threadId as at}from"worker_threads";import*as ot from"diagnostics_channel";import{createInterface as st}from"node:readline";import*as ct from"node:https";import{monitorEventLoopDelay as lt,performance as ut}from"perf_hooks";import{EventEmitter as dt}from"events";var ft=`baggage`,pt=4096;b();function mt(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function ht(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function gt(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;if(t!==-1&&t<e.length-1){let n=e.substring(t+1);c=m(n)}return{key:o,value:s,metadata:c}}function _t(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=gt(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}b();var vt=class{inject(e,t,n){let r=d.getBaggage(e);if(!r||he(e))return;let i=mt(ht(r).filter(e=>e.length<=pt).slice(0,180));i.length>0&&n.set(t,ft,i)}extract(e,t,n){let r=n.get(t,ft);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=_t(r[e],i,a,o);else[a]=_t(r,i,a,o);return a===0?e:d.setBaggage(e,d.createBaggage(i))}fields(){return[ft]}};b();function yt(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!bt(n)){f.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!xt(r)){f.warn(`Invalid attribute value set for key: ${n}`);continue}t[n]=Array.isArray(r)?r.slice():r}return t}function bt(e){return typeof e==`string`&&e!==``}function xt(e){return e==null?!0:Array.isArray(e)?St(e):Ct(typeof e)}function St(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Ct(e)){t=e;continue}return!1}return!1}}return!0}function Ct(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}b();var wt=o(`OpenTelemetry SDK Context Key RPC_METADATA`),Tt;(function(e){e.HTTP=`http`})(Tt||={});function Et(e,t){return e.setValue(wt,t)}var Dt=`[object Object]`,Ot=`[object Null]`,kt=`[object Undefined]`,At=Function.prototype.toString,jt=At.call(Object),Mt=Object.getPrototypeOf,Nt=Object.prototype,Pt=Nt.hasOwnProperty,Ft=Symbol?Symbol.toStringTag:void 0,It=Nt.toString;function Lt(e){if(!Rt(e)||zt(e)!==Dt)return!1;let t=Mt(e);if(t===null)return!0;let n=Pt.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&At.call(n)===jt}function Rt(e){return typeof e==`object`&&!!e}function zt(e){return e==null?e===void 0?kt:Ot:Ft&&Ft in Object(e)?Bt(e):Vt(e)}function Bt(e){let t=Pt.call(e,Ft),n=e[Ft],r=!1;try{e[Ft]=void 0,r=!0}catch{}let i=It.call(e);return r&&(t?e[Ft]=n:delete e[Ft]),i}function Vt(e){return It.call(e)}var Ht=20;function Ut(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Gt(t,e.shift(),0,n);return t}function Wt(e){return qt(e)?e.slice():e}function Gt(e,t,n=0,r){let i;if(!(n>Ht)){if(n++,Xt(e)||Xt(t)||Jt(t))i=Wt(t);else if(qt(e)){if(i=e.slice(),qt(t))for(let e=0,n=t.length;e<n;e++)i.push(Wt(t[e]));else if(Yt(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r!==`__proto__`&&r!==`constructor`&&r!==`prototype`&&(i[r]=Wt(t[r]))}}}else if(Yt(e)){if(Yt(t)){if(!Zt(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Xt(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Kt(e,s,r)||Kt(t,s,r))delete i[s];else{if(Yt(a)&&Yt(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Gt(i[s],c,n,r)}}}}else i=t}return i}}function Kt(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function qt(e){return Array.isArray(e)}function Jt(e){return typeof e==`function`}function Yt(e){return!Xt(e)&&!qt(e)&&!Jt(e)&&typeof e==`object`}function Xt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Zt(e,t){return!(!Lt(e)||!Lt(t))}var D=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,O=globalThis,k=`10.74.0`;function Qt(){return $t(O),O}function $t(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.74.0`,t[k]=t[`10.74.0`]||{}}function en(e,t,n=O){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[k]=r[`10.74.0`]||{};return i[e]||(i[e]=t())}var tn=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],nn=`Sentry Logger `,rn={};function an(e){if(!(`console`in O))return e();let t=O.console,n={},r=Object.keys(rn);r.forEach(e=>{let r=rn[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function on(){pn().enabled=!0}function sn(){pn().enabled=!1}function cn(){return pn().enabled}function ln(...e){fn(`log`,...e)}function un(...e){fn(`warn`,...e)}function dn(...e){fn(`error`,...e)}function fn(e,...t){D&&cn()&&an(()=>{O.console[e](`${nn}[${e}]:`,...t)})}function pn(){return D?en(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}var A={enable:on,disable:sn,isEnabled:cn,log:ln,warn:un,error:dn},mn=50,hn=/\(error: (.*)\)/,gn=/captureMessage|captureException/;function _n(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
|
|
2
|
+
`);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=hn.test(n)?n.replace(hn,`$1`):n;if(!o.includes(`Error: `)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=mn+r)break}}return yn(i.slice(r))}}function vn(e){return Array.isArray(e)?_n(...e):e}function yn(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(bn(t).function||``)&&t.pop(),t.reverse(),gn.test(bn(t).function||``)&&(t.pop(),gn.test(bn(t).function||``)&&t.pop()),t.slice(0,mn).map(e=>({...e,filename:e.filename||bn(t).filename,function:e.function||`?`}))}function bn(e){return e[e.length-1]||{}}var xn=`<anonymous>`;function Sn(e){try{return!e||typeof e!=`function`?xn:e.name||xn}catch{return xn}}function Cn(e){let t=e.exception;if(t){let e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}function wn(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var Tn={},En={};function Dn(e,t){return Tn[e]=Tn[e]||[],Tn[e].push(t),()=>{let n=Tn[e];if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}function On(e,t){if(!En[e]){En[e]=!0;try{t()}catch(t){D&&A.error(`Error while instrumenting ${e}`,t)}}}function kn(e,t){let n=e&&Tn[e];if(n)for(let r of n)try{r(t)}catch(t){D&&A.error(`Error while triggering instrumentation handler.
|
|
3
|
+
Type: ${e}
|
|
4
|
+
Name: ${Sn(r)}
|
|
5
|
+
Error:`,t)}}var An=Object.prototype.toString;function jn(e){switch(An.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Vn(e,Error)}}function Mn(e,t){return An.call(e)===`[object ${t}]`}function Nn(e){return Mn(e,`ErrorEvent`)}function Pn(e){return Mn(e,`String`)}function Fn(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function In(e){return e===null||Fn(e)||typeof e!=`object`&&typeof e!=`function`}function Ln(e){return Mn(e,`Object`)}function j(e){return typeof e==`object`&&!!e}function Rn(e){return typeof Event<`u`&&Vn(e,Event)}function zn(e){return Mn(e,`RegExp`)}function Bn(e){return!!(e?.then&&typeof e.then==`function`)}function Vn(e,t){try{return e instanceof t}catch{return!1}}function Hn(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Wn(i,r);try{e[t]=i}catch{D&&A.log(`Failed to replace method "${t}" in object`,e)}}function Un(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{D&&A.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Wn(e,t){try{e.prototype=t.prototype=t.prototype||{},Un(e,`__sentry_original__`,t)}catch{}}function Gn(e,t,n,r=!0){let i=e[t];if(typeof i!=`function`)throw Error(`Cannot wrap method: ${t} is not a function`);if(Kn(i))throw Error(`Attempting to wrap method ${t} multiple times`);Wn(n,i),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function Kn(e){return e.__sentry_original__}function qn(e){if(jn(e))return{message:e.message,name:e.name,stack:e.stack,...Jn(e)};if(Rn(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...Jn(e)}}return e}function Jn(e){return j(e)?Object.fromEntries(Object.entries(e)):{}}function Yn(e){let t=Object.keys(qn(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}var Xn;function Zn(e){if(Xn!==void 0)return Xn?Xn(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=O;return t in n&&typeof n[t]==`function`?(Xn=n[t],Xn(e)):(Xn=null,e())}function Qn(){return Zn(()=>Math.random())}function $n(){return Zn(()=>Date.now())}var er=Symbol.for(`sentry.skipNormalization`),tr=Symbol.for(`sentry.overrideNormalizationDepth`);function nr(e){Un(e,er,!0)}function rr(e,t){Un(e,tr,t)}function ir(e){return!!e[er]}function ar(e){let t=e[tr];return typeof t==`number`?t:void 0}function or(e,t=100,n=1/0){try{return cr(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function sr(e,t=3,n=102400){let r=or(e,t);return fr(r)>n?sr(e,t-1,n):r}function cr(e,t,n=1/0,r=1/0,i=pr()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=lr(e,t);if(!s.startsWith(`[object `))return s;if(ir(t))return t;let c=ar(t),l=c===void 0?n:c;if(l===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let u=t;if(u&&typeof u.toJSON==`function`)try{return cr(``,u.toJSON(),l-1,r,i)}catch{}let d=Array.isArray(t)?[]:{},f=0,p=qn(t);for(let e in p){if(!Object.prototype.hasOwnProperty.call(p,e))continue;if(f>=r){d[e]=`[MaxProperties ~]`;break}let t=p[e];d[e]=cr(e,t,l-1,r,i),f++}return o(t),d}function lr(e,t){try{return typeof global<`u`&&t===global?`[Global]`:typeof t==`number`&&!Number.isFinite(t)?`[${t}]`:typeof t==`function`?`[Function: ${Sn(t)}]`:typeof t==`symbol`?`[${String(t)}]`:typeof t==`bigint`?`[BigInt: ${String(t)}]`:`[object ${ur(t)}]`}catch(e){return`**non-serializable** (${e})`}}function ur(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function dr(e){return~-encodeURI(e).split(/%..|./).length}function fr(e){return dr(JSON.stringify(e))}function pr(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}function mr(e,t=`[unserializable]`){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return typeof t==`function`?t(e):t}}function hr(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function gr(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,r);return a>r-5&&(a=r),a===r&&(i=Math.max(a-140,0)),n=n.slice(i,a),i>0&&(n=`'{snip} ${n}`),a<r&&(n+=` {snip}`),n}function _r(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];In(r)?n.push(String(r)):r instanceof Error?n.push(r.message?`${r.name}: ${r.message}`:r.name):n.push(lr(void 0,r))}return n.join(t)}function vr(e,t,n=!1){return Pn(e)?zn(t)?t.test(e):Pn(t)?n?e===t:e.includes(t):typeof t==`function`&&t(e):!1}function yr(e,t=[],n=!1){for(let r of t)if(vr(e,r,n))return!0;return!1}function br(){let e=O;return e.crypto||e.msCrypto}var xr;function Sr(){return Qn()*16}function Cr(e=br()){try{if(e?.randomUUID)return Zn(()=>e.randomUUID()).replace(/-/g,``)}catch{}return xr||=`10000000100040008000100000000000`,xr.replace(/[018]/g,e=>(e^(Sr()&15)>>e/4).toString(16))}function wr(e){return e.exception?.values?.[0]}function Tr(e){let{message:t,event_id:n}=e;if(t)return t;let r=wr(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Er(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function Dr(e,t){let n=wr(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}var Or=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function kr(e){return parseInt(e||``,10)}function Ar(e){let t=e.match(Or)||[],n=kr(t[1]),r=kr(t[2]),i=kr(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:t[4]}}function jr(e){if(Mr(e))return!0;try{Un(e,`__sentry_captured__`,!0)}catch{}return!1}function Mr(e){try{return e.__sentry_captured__}catch{}}var Nr=1e3;function Pr(){return $n()/Nr}function Fr(){let{performance:e}=O;if(!e?.now||!e.timeOrigin)return Pr;let t=e.timeOrigin;return()=>(t+Zn(()=>e.now()))/Nr}var Ir;function Lr(){return(Ir??=Fr())()}function Rr(e){let t=Lr(),n={sid:Cr(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Vr(n)};return e&&zr(n,e),n}function zr(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Lr(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:Cr()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Br(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),zr(e,n)}function Vr(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Hr(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=Hr(r[e],t[e],n-1));return r}function Ur(){return Cr()}function Wr(){return Cr().substring(16)}function Gr(e){try{let t=O.WeakRef;if(typeof t==`function`)return new t(e)}catch{}return e}function Kr(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}var qr=`_sentrySpan`;function Jr(e,t){t?Un(e,qr,Gr(t)):delete e[qr]}function Yr(e){return Kr(e[qr])}var Xr=100,Zr=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ur(),sampleRand:Qn()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Jr(t,Yr(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&zr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof e?n.getScopeData():Ln(n)?t:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Jr(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ur(),sampleRand:Qn()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:Xr;if(n<=0)return this;let r={timestamp:Pr(),...e,message:e.message?hr(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Yr(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Hr(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||Cr();if(!this._client)return D&&A.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n?.event_id||Cr();if(!this._client)return D&&A.warn(`No client configured on scope - will not capture message!`),r;let i=n?.syntheticException??Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=e.event_id||t?.event_id||Cr();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(D&&A.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function Qr(){return en(`defaultCurrentScope`,()=>new Zr)}function $r(){return en(`defaultIsolationScope`,()=>new Zr)}var ei=e=>e instanceof Promise&&!e[ti],ti=Symbol(`chained PromiseLike`),ni=(e,t,n)=>{let r=e.then(e=>(t(e),e),e=>{throw n(e),e});return ei(r)&&ei(e)?r:ri(e,r)},ri=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let i=e[r];typeof i==`function`?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[ti]:!0}),t},ii=class{constructor(e,t){let n;n=e||new Zr;let r;r=t||new Zr,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return Bn(n)?ni(n,()=>this._popScope(),()=>this._popScope()):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function ai(){let e=$t(Qt());return e.stack=e.stack||new ii(Qr(),$r())}function oi(e){return ai().withScope(e)}function si(e,t){let n=ai();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function ci(e){return ai().withScope(()=>e(ai().getIsolationScope()))}function li(){return{withIsolationScope:ci,withScope:oi,withSetScope:si,withSetIsolationScope:(e,t)=>ci(t),getCurrentScope:()=>ai().getScope(),getIsolationScope:()=>ai().getIsolationScope()}}function ui(e){let t=$t(Qt());t.acs=e}function di(e){let t=$t(e);return t.acs?t.acs:li()}function fi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).includes(`value`)}function pi(e,t){let{value:n,unit:r}=fi(e)?e:{value:e,unit:void 0},i=_i(n),a=r&&typeof r==`string`?{unit:r}:{};if(i)return{...i,...a};if(!t||t===`skip-undefined`&&n===void 0)return;let o=``;try{o=JSON.stringify(n)??``}catch{}return{value:o,type:`string`,...a}}function mi(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let e=pi(i,t);e&&(n[r]=e)}return n}function hi(e){if(!e)return 0;let t=0;for(let[n,r]of Object.entries(e)){t+=n.length*2,t+=r.type.length*2,t+=(r.unit?.length??0)*2;let e=r.value;Array.isArray(e)?t+=gi(e[0])*e.length:In(e)?t+=gi(e):t+=100}return t}function gi(e){return typeof e==`string`?e.length*2:typeof e==`boolean`?4:typeof e==`number`?8:0}function _i(e){if(Array.isArray(e))return{value:e,type:`array`};let t=typeof e==`string`?`string`:typeof e==`boolean`?`boolean`:typeof e==`number`&&!Number.isNaN(e)?Number.isInteger(e)?`integer`:`double`:null;if(t)return{value:e,type:t}}function vi(){return!1}function M(){return di(Qt()).getCurrentScope()}function N(){return di(Qt()).getIsolationScope()}function yi(){return en(`globalScope`,()=>new Zr)}function bi(...e){let t=di(Qt());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function xi(...e){let t=di(Qt());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function P(){return M().getClient()}function Si(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Wr()};return n&&(i.parent_span_id=n),i}var Ci=`sentry.source`,wi=`sentry.sample_rate`,F=`sentry.op`,I=`sentry.origin`,Ti=`sentry.measurement_unit`,Ei=`sentry.measurement_value`,Di=`sentry.release`,Oi=`sentry.environment`,ki=`sentry.sdk.integrations`,Ai=`user.id`,ji=`user.email`,Mi=`user.ip_address`,Ni=`user.name`,Pi=`sentry.custom_span_name`,Fi=`sentry.profile_id`,Ii=`sentry.exclusive_time`,Li=`cache.hit`,Ri=`cache.key`,zi=`cache.item_size`,Bi=`http.request.method`,Vi=`gen_ai.conversation.id`;function Hi(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:`unauthenticated`};case 403:return{code:2,message:`permission_denied`};case 404:return{code:2,message:`not_found`};case 409:return{code:2,message:`already_exists`};case 413:return{code:2,message:`failed_precondition`};case 429:return{code:2,message:`resource_exhausted`};case 499:return{code:2,message:`cancelled`};default:return{code:2,message:`invalid_argument`}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:`unimplemented`};case 503:return{code:2,message:`unavailable`};case 504:return{code:2,message:`deadline_exceeded`};default:return{code:2,message:`internal_error`}}return{code:2,message:`internal_error`}}function Ui(e,t){e.setAttribute(`http.response.status_code`,t);let n=Hi(t);n.message!==`unknown_error`&&e.setStatus(n)}var Wi=`_sentryScope`,Gi=`_sentryIsolationScope`,Ki=Symbol.for(`sentry.otelSourceInference`),qi=Symbol.for(`sentry.otelSourceExplicitlySet`),Ji=Symbol.for(`sentry.tracerProviderSpan`);function Yi(e,t,n){e&&(Un(e,Gi,Gr(n)),Un(e,Wi,t))}function Xi(e){let t=e;return{scope:t[Wi],isolationScope:Kr(t[Gi])}}function Zi(e){Un(e,Ki,!0)}function Qi(e){return e[Ki]===!0}function $i(e){Un(e,qi,!0)}function ea(e){return e[qi]===!0}function ta(e){Un(e,Ji,!0)}function na(e){return e[Ji]===!0}var ra=`sentry-`;function ia(e){let t=oa(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.startsWith(`sentry-`)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function aa(e){if(e)return ca(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`${ra}${t}`]=n),e),{}))}function oa(e){if(e&&(Pn(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=sa(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):sa(e)}function sa(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}function ca(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((e,[t,n],r)=>{let i=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,a=r===0?i:`${e},${i}`;return a.length>8192?(D&&A.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}function la(e,t){if(!e)return t;let n=oa(e),r=oa(t);if(!r)return e;let i={},a=!1,o={},s={};for(let[e,t]of Object.entries(r))e.startsWith(`sentry-`)?(o[e]=t,a=!0):s[e]=t;if(n)for(let[e,t]of Object.entries(n))(!a||!e.startsWith(`sentry-`))&&(i[e]=t);a&&Object.assign(i,o);for(let[e,t]of Object.entries(s))i[e]??(i[e]=t);return ca(i)}var ua=/^o(\d+)\./,da=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function fa(e){return e===`http`||e===`https`}function pa(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function ma(e){let t=da.exec(e);if(!t){an(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,s=``]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return ha({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function ha(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function ga(e){if(!D)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>!e[t]&&(A.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?fa(r)?t&&isNaN(parseInt(t,10))?(A.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(A.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(A.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function _a(e){return e.match(ua)?.[1]}function va(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=_a(n)),r}function ya(e){let t=typeof e==`string`?ma(e):ha(e);if(t&&ga(t))return t}function ba(e){if(typeof e==`boolean`)return Number(e);let t=typeof e==`string`?parseFloat(e):e;if(!(typeof t!=`number`||isNaN(t)||t<0||t>1))return t}var xa=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Sa(e){if(!e)return;let t=e.match(xa);if(!t)return;let n;return t[3]===`1`?n=!0:t[3]===`0`&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Ca(e){return!!e.parentSpanId||!!e.dsc}function wa(e,t){let n=Sa(e),r=ia(t);if(!n?.traceId)return{traceId:Ur(),sampleRand:Qn()};let i=Da(n,r);r&&(r.sample_rand=i.toString());let{traceId:a,parentSpanId:o,parentSampled:s}=n;return{traceId:a,parentSpanId:o,sampled:s,dsc:r||{},sampleRand:i}}function Ta(e=Ur(),t=Wr(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function Ea(e=Ur(),t=Wr(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function Da(e,t){let n=ba(t?.sample_rand);if(n!==void 0)return n;let r=ba(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?Qn()*r:r+Qn()*(1-r):Qn()}function Oa(e,t){let n=va(e);return t&&n&&t!==n?(A.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):e.getOptions().strictTraceContinuation&&(t&&!n||!t&&n)?(A.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${n})`),!1):!0}var ka=!1;function Aa(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:a,status:o,origin:s,links:c}=L(e);return{parent_span_id:a,span_id:t,trace_id:n,data:r,op:i,status:o,origin:s,links:c}}function ja(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:L(e).parent_span_id,a=Xi(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Wr():t,trace_id:n}}function Ma(e){let{traceId:t,spanId:n}=e.spanContext();return Ta(t,n,Ua(e))}function Na(e){let{traceId:t,spanId:n}=e.spanContext();return Ea(t,n,Ua(e))}function Pa(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function Fa(e){if(e?.length)return e.map(({context:{spanId:e,traceId:t,traceFlags:n},attributes:r})=>({span_id:e,trace_id:t,sampled:n===1,attributes:r}))}function Ia(e){return typeof e==`number`?La(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?La(e.getTime()):Lr()}function La(e){return e>9999999999?e/1e3:e}function L(e){if(Ha(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Va(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:za(e),start_timestamp:Ia(i),timestamp:Ia(o)||void 0,status:Wa(s),op:r[F],origin:r[I],links:Pa(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Ra(e){if(Ha(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Va(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{name:a,span_id:t,trace_id:n,parent_span_id:za(e),start_timestamp:Ia(i),end_timestamp:Ia(o),is_segment:e===Qa(e),status:Ga(s),attributes:Ka(r,s),links:Fa(c)}}return{span_id:t,trace_id:n,start_timestamp:0,name:``,end_timestamp:0,status:`ok`,is_segment:e===Qa(e)}}function za(e){return`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0}function Ba(e){return{...e,attributes:mi(e.attributes),links:e.links?.map(e=>({...e,attributes:mi(e.attributes)}))}}function Va(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Ha(e){return typeof e.getSpanJSON==`function`}function Ua(e){let{traceFlags:t}=e.spanContext();return t===1}function Wa(e){if(e&&e.code!==0)return e.code===1?`ok`:e.message||`internal_error`}function Ga(e){return!e||e.code===1||e.code===0||e.message===`cancelled`?`ok`:`error`}function Ka(e,t){let n=Ga(t)===`error`?t?.message:void 0;return{...n&&{"sentry.status.message":n},...e}}var qa=`_sentryChildSpans`,Ja=`_sentryRootSpan`;function Ya(e,t){let n=e[Ja]||e;Un(t,Ja,n),Ua(e)&&(e.isRecording()||n.isRecording())&&(e[qa]?e[qa].add(t):Un(e,qa,new Set([t])))}function Xa(e){let t=new Set;function n(e){if(!t.has(e)&&Ua(e)){t.add(e);let r=e[qa]?Array.from(e[qa]):[];for(let e of r)n(e)}}return n(e),Array.from(t)}var Za=Qa;function Qa(e){return e[Ja]||e}function R(){let e=di(Qt());return e.getActiveSpan?e.getActiveSpan():Yr(M())}function $a(){ka||=(an(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}function eo(e,t){e.updateName(t),e.setAttributes({[Ci]:`custom`,[Pi]:t})}function to(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||P()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function no(e){A.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ro(e,t){if(!t?.length)return!1;for(let n of t){if(oo(n)){if(e.description&&vr(e.description,n))return D&&no(e),!0;continue}let t=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!t)continue;let r=!n.name||e.description&&vr(e.description,n.name),i=!n.op||e.op&&vr(e.op,n.op),a=!n.attributes||Object.entries(n.attributes).every(([t,n])=>io(e.attributes?.[t],n));if(r&&i&&a)return D&&no(e),!0}return!1}function io(e,t){return typeof e==`string`&&(typeof t==`string`||t instanceof RegExp)?vr(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function ao(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function oo(e){return typeof e==`string`||e instanceof RegExp}var so=Symbol.for(`sentry.nonRecordingSpan`),co=class{constructor(e={}){this._traceId=e.traceId||Ur(),this._spanId=e.spanId||Wr(),this.dropReason=e.dropReason,Un(this,so,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:0}}end(e){}setAttribute(e,t){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,t,n){return this}addLink(e){return this}addLinks(e){return this}recordException(e,t){}};function lo(e){return!!e&&e[so]===!0}var uo=`production`,fo=`_frozenDsc`;function po(e,t){Un(e,fo,t)}function mo(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||`production`,release:n.release,public_key:r,trace_id:e,org_id:va(t)};return t.emit(`createDsc`,i),i}function ho(e,t){let n=t.getPropagationContext();return n.dsc||mo(n.traceId,e)}function go(e){let t=P();if(!t)return{};let n=Za(e),r=L(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n[fo];if(c)return s(c);let l=lo(n),u=l&&n.dropReason===`ignored`;if(l&&(!to(t.getOptions())||u)){let e=Xi(n).scope;if(e){let n={...ho(t,e)};return u&&(n.sampled=`false`),s(n)}}let d=a?.get(`sentry.dsc`),f=d&&ia(d);if(f)return s(f);let p=mo(e.spanContext().traceId,t),m=i[`sentry.source`]??i[`sentry.segment.name.source`],h=r.description;return m!==`url`&&h&&(p.transaction=h),to()&&(p.sampled=String(Ua(n)),p.sample_rand=a?.get(`sentry.sample_rand`)??Xi(n).scope?.getPropagationContext().sampleRand.toString()),s(p),t.emit(`createDsc`,p,n),p}function _o(e){return aa(go(e))}function vo(e){return Un(e,`_streamed`,!0),e}function yo(e){return!!e&&typeof e==`function`&&`_streamed`in e&&!!e._streamed}function bo(e,t=[]){return[e,t]}function xo(e,t){let[n,r]=e;return[n,[...r,t]]}function So(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function Co(e,t){return So(e,(e,n)=>t.includes(n))}function wo(e){let t=$t(O);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function To(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[wo(r),e]:r.push(typeof e==`string`?wo(e):e)}for(let e of n){let[t,n]=e;if(i(`
|
|
6
|
+
${JSON.stringify(t)}
|
|
7
|
+
`),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(or(n))}i(e)}}return typeof r==`string`?r:Eo(r)}function Eo(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Do(e){return[{type:`span`},e]}function Oo(e){let t=typeof e.data==`string`?wo(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var ko={sessions:`session`,event:`error`,client_report:`internal`,user_report:`default`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,raw_security:`security`,log:`log_item`,trace_metric:`metric`};function Ao(e){return e in ko}function jo(e){return Ao(e)?ko[e]:e}function Mo(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function No(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date($n()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:pa(r)},...i&&{trace:i}}}function Po(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function Fo(e,t,n,r){let i=Mo(n);return bo({sent_at:new Date($n()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:pa(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Io(e,t,n,r){let i=Mo(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Po(e,n?.sdk);let o=No(e,i,r,t);return delete e.sdkProcessingMetadata,bo(o,[[{type:a},e]])}function Lo(e,t){function n(e){return!!e.trace_id&&!!e.public_key}let r=go(e[0]),i=t?.getDsn(),a=t?.getOptions().tunnel,o={sent_at:new Date($n()).toISOString(),...n(r)&&{trace:r},...!!a&&i&&{dsn:pa(i)}},{beforeSendSpan:s,ignoreSpans:c}=t?.getOptions()||{},l=c?.length?e.filter(e=>{let t=L(e);return!ro({description:t.description,op:t.op,attributes:t.data},c)}):e,u=e.length-l.length;u&&t?.recordDroppedEvent(`before_send`,`span`,u);let d=s?e=>{let t=L(e);return(yo(s)?t:s(t))||($a(),t)}:L,f=[];for(let e of l){let t=d(e);t&&f.push(Do(t))}return bo(o,f)}function Ro(e){if(!D)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`,parent_span_id:r}=L(e),{spanId:i}=e.spanContext(),a=Ua(e),o=Za(e),s=o===e,c=`[Tracing] Starting ${a?`sampled`:`unsampled`} ${s?`root `:``}span`,l=[`op: ${n}`,`name: ${t}`,`ID: ${i}`];if(r&&l.push(`parent ID: ${r}`),!s){let{op:e,description:t}=L(o);l.push(`root ID: ${o.spanContext().spanId}`),e&&l.push(`root op: ${e}`),t&&l.push(`root description: ${t}`)}A.log(`${c}
|
|
8
|
+
${l.join(`
|
|
9
|
+
`)}`)}function zo(e){if(!D)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`}=L(e),{spanId:r}=e.spanContext(),i=`[Tracing] Finishing "${n}" ${Za(e)===e?`root `:``}span "${t}" with ID ${r}`;A.log(i)}function Bo(e,t,n,r=R()){let i=r&&Za(r);i&&(D&&A.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[Ei]:t,[Ti]:n}))}function Vo(e){if(!e||e.length===0)return;let t={};return e.forEach(e=>{let n=e.attributes||{},r=n[Ti],i=n[Ei];typeof r==`string`&&typeof i==`number`&&(t[e.name]={value:i,unit:r})}),t}function Ho(e){$t(Qt()).segmentSpanCaptureStrategy=e}function Uo(){return $t(Qt()).segmentSpanCaptureStrategy}function Wo(e){return e.getOptions().traceLifecycle===`stream`}var Go=1e3,Ko=class{constructor(e={}){this._traceId=e.traceId||Ur(),this._spanId=e.spanId||Wr(),this._startTime=e.startTimestamp||Lr(),this._links=e.links,this._attributes={},this.setAttributes({[I]:`manual`,[F]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),`sampled`in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._frozen||(this._links?this._links.push(e):this._links=[e]),this}addLinks(e){return this._frozen||(this._links?this._links.push(...e):this._links=e),this}recordException(e,t){}spanContext(){let{_spanId:e,_traceId:t,_sampled:n}=this;return{spanId:e,traceId:t,traceFlags:+!!n}}setAttribute(e,t){return this._frozen?this:(t===void 0?delete this._attributes[e]:this._attributes[e]=t,e===`sentry.source`&&t!==void 0&&Qi(this)&&$i(this),this)}setAttributes(e){return Object.keys(e).forEach(t=>this.setAttribute(t,e[t])),this}updateStartTime(e){this._frozen||(this._startTime=Ia(e))}setStatus(e){return this._frozen||(this._status=e),this}updateName(e){return this._frozen?this:(this._name=e,Qi(this)||this.setAttribute(Ci,`custom`),this)}end(e){if(this._endTime){this._frozen=na(this);return}this._endTime=Ia(e),zo(this),this._onSpanEnded(),this._frozen=na(this)}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[F],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Wa(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[I],profile_id:this._attributes[Fi],exclusive_time:this._attributes[Ii],measurements:Vo(this._events),is_segment:this._isStandaloneSpan&&Za(this)===this||void 0,segment_id:this._isStandaloneSpan?Za(this).spanContext().spanId:void 0,links:Pa(this._links)}}getStreamedSpanJSON(){return{name:this._name??``,span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:this._endTime??this._startTime,is_segment:this._isStandaloneSpan||this===Za(this),status:Ga(this._status),attributes:Ka(this._attributes,this._status),links:Fa(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,t,n){if(this._frozen)return this;D&&A.log(`[Tracing] Adding an event to span:`,e);let r=qo(t)?t:n||Lr(),i=qo(t)?{}:t||{},a={name:e,time:Ia(r),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=P();e&&(e.emit(`spanEnd`,this),this._isStandaloneSpan||e.emit(`afterSpanEnd`,this));let t=Za(this),n=this._isStandaloneSpan||this===t;if(this._isStandaloneSpan){this._sampled?Xo(Lo([this],e)):(D&&A.log(`[Tracing] Discarding standalone span because its trace was not chosen to be sampled.`),e&&e.recordDroppedEvent(`sample_rate`,`span`));return}if(!n){let e=Uo();if(e){let n=Xi(this).scope||M();e.onChildSpanEnded(this,t,e=>this._convertSpanToTransaction(e),n)}return}if(e&&Wo(e)){e.emit(`afterSegmentSpanEnd`,this);return}let r=Xi(this).scope||M(),i=Uo();if(i)i.onSegmentSpanEnded(e=>this._convertSpanToTransaction(e),r);else{let e=this._convertSpanToTransaction();e&&r.captureEvent(e)}}_convertSpanToTransaction(e={}){if(!Jo(L(this)))return;this._name||=(D&&A.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),`<unlabeled transaction>`);let{scope:t,isolationScope:n}=Xi(this),r=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;e.onSpanCaptured?.(this);let i=[];for(let t of Xa(this)){if(t===this||Yo(t)||e.isSpanAlreadyCaptured?.(t))continue;let n=L(t);Jo(n)&&(e.onSpanCaptured?.(t),i.push(n))}let a=this._attributes[Ci];delete this._attributes[Pi];let o=!1;i.forEach(e=>{delete e.data[Pi],e.op?.startsWith(`gen_ai.`)&&(o=!0)});let s={contexts:{trace:Aa(this)},spans:i.length>Go?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,Go):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:go(this),hasGenAiSpans:o},request:r,...a&&{transaction_info:{source:a}}},c=Vo(this._events);return c&&Object.keys(c).length&&(D&&A.log(`[Measurements] Adding measurements to transaction event`,JSON.stringify(c,void 0,2)),s.measurements=c),s}};function qo(e){return e&&typeof e==`number`||e instanceof Date||Array.isArray(e)}function Jo(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function Yo(e){return e instanceof Ko&&e.isStandaloneSpan()}function Xo(e){let t=P();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent(`before_send`,`span`);return}t.sendEnvelope(e)}function Zo(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(e){throw t(e),n(),e}return Qo(i,t,n,r)}function Qo(e,t,n,r){return Bn(e)?ni(e,e=>{n(),r(e)},e=>{t(e),n()}):(n(),r(e),e)}function $o(e,t,n){if(!to(e))return[!1];let r,i;typeof e.tracesSampler==`function`?(i=e.tracesSampler({...t,inheritOrSampleWith:e=>typeof t.parentSampleRate==`number`?t.parentSampleRate:typeof t.parentSampled==`boolean`?Number(t.parentSampled):e}),r=!0):t.parentSampled===void 0?e.tracesSampleRate!==void 0&&(i=e.tracesSampleRate,r=!0):i=t.parentSampled;let a=ba(i);if(a===void 0)return D&&A.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!a)return D&&A.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler==`function`?`tracesSampler returned 0 or false`:`a negative sampling decision was inherited or tracesSampleRate is set to 0`}`),[!1,a,r];let o=n<a;return o||D&&A.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[o,a,r]}var es=`__SENTRY_SUPPRESS_TRACING__`;function z(e,t){let n=ds();if(n.startSpan)return n.startSpan(e,t);let r=us(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return bi(s,()=>hs(a)(()=>{let n=M(),o=ms(n,a),s=P(),c=e.onlyIfParent&&!o?cs(n,s):ls({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!_s(c)||!o)&&Jr(n,c),Zo(()=>t(c),()=>{let{status:e}=L(c);c.isRecording()&&(!e||e===`ok`)&&c.setStatus({code:2,message:`internal_error`})},()=>{c.end()})}))}function ts(e,t){let n=ds();if(n.startSpanManual)return n.startSpanManual(e,t);let r=us(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return bi(s,()=>hs(a)(()=>{let n=M(),o=ms(n,a),s=e.onlyIfParent&&!o?cs(n,P()):ls({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!_s(s)||!o)&&Jr(n,s),Zo(()=>t(s,()=>s.end()),()=>{let{status:e}=L(s);s.isRecording()&&(!e||e===`ok`)&&s.setStatus({code:2,message:`internal_error`})})}))}function B(e){let t=ds();return t.startInactiveSpan?t.startInactiveSpan(e):rs(e)}function ns(e){return rs(e)}function rs(e){let t=us(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?t=>bi(e.scope,t):r===void 0?e=>e():e=>V(r,e))(()=>{let i=M(),a=ms(i,r),o=P();return e.onlyIfParent&&!a?cs(i,o):ls({parentSpan:a,spanArguments:t,forceTransaction:n,scope:i})})}var is=(e,t)=>{let n=di(Qt());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=P(),o=ia(i);return a&&!Oa(a,o?.org_id)?ss(t):bi(e=>{let n=wa(r,i);return e.setPropagationContext(n),Jr(e,void 0),t()})};function V(e,t){let n=ds();return n.withActiveSpan?n.withActiveSpan(e,t):bi(n=>(Jr(n,e||void 0),t(n)))}function as(e){let t=ds();return t.suppressTracing?t.suppressTracing(e):bi(t=>{t.setSDKProcessingMetadata({[es]:!0});let n=e();return t.setSDKProcessingMetadata({[es]:void 0}),n})}function os(e=M()){let t=ds();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[es]===!0}function ss(e){let t=ds();return t.startNewTrace?t.startNewTrace(e):bi(t=>(t.setPropagationContext({traceId:Ur(),sampleRand:Qn()}),D&&A.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),V(null,e)))}function cs(e,t){t?.recordDroppedEvent(`no_parent_span`,`span`);let n=new co({traceId:e.getPropagationContext().traceId});return Yi(n,e,N()),n}function ls({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let i=N();if(!to()){let t=r.getPropagationContext(),a=new co({traceId:e?e.spanContext().traceId:t.traceId});return e&&!n&&Ya(e,a),Yi(a,r,i),a}let a=P();if(gs(a,t)){os(r)||a?.recordDroppedEvent(`ignored`,`span`);let t=new co({dropReason:`ignored`,traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&Ya(e,t),Yi(t,r,i),t}let o;if(e&&!n)o=ps(e,r,t,i),Ya(e,o);else if(e){let n=go(e),{traceId:a,spanId:s}=e.spanContext(),c=Ua(e);o=fs({traceId:a,parentSpanId:s,...t},r,i,c),po(o,n)}else{let{traceId:e,dsc:n,parentSpanId:a,sampled:s}=r.getPropagationContext();o=fs({traceId:e,parentSpanId:a,...t},r,i,s),n&&po(o,n)}return Ro(o),o}function us(e){let t={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let n={...t};return n.startTimestamp=Ia(e.startTime),delete n.startTime,n}return t}function ds(){return di(Qt())}function fs(e,t,n,r){let i=P(),a=i?.getOptions()||{},{name:o=``}=e,s={spanAttributes:{...e.attributes},spanName:o,parentSampled:r};i?.emit(`beforeSampling`,s,{decision:!1});let c=s.parentSampled??r,l=s.spanAttributes,u=t.getPropagationContext(),d=os(t),[f,p,m]=d?[!1]:$o(a,{name:o,parentSampled:c,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:ba(u.dsc?.sample_rate)},u.sampleRand),h=new Ko({...e,attributes:{[Ci]:`custom`,[wi]:p!==void 0&&m?p:void 0,...l},sampled:f});return!f&&i&&!d&&(D&&A.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),i.recordDroppedEvent(`sample_rate`,Wo(i)?`span`:`transaction`)),Yi(h,t,n),i&&i.emit(`spanStart`,h),h}function ps(e,t,n,r){let{spanId:i,traceId:a}=e.spanContext(),o=os(t),s=!o&&Ua(e),c=s?new Ko({...n,parentSpanId:i,traceId:a,sampled:s}):new co({traceId:a});Ya(e,c),Yi(c,t,r);let l=P();return l?(Wo(l)&&lo(c)&&(lo(e)&&e.dropReason?(c.dropReason=e.dropReason,l.recordDroppedEvent(e.dropReason,`span`)):o||(c.dropReason=`sample_rate`,l.recordDroppedEvent(`sample_rate`,`span`))),l.emit(`spanStart`,c),n.endTimestamp&&(l.emit(`spanEnd`,c),l.emit(`afterSpanEnd`,c)),c):c}function ms(e,t){if(t)return t;if(t===null)return;let n=Yr(e);if(!n)return;let r=P();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Za(n):n}function hs(e){return e===void 0?e=>e():t=>V(e,t)}function gs(e,t){let n=e?.getOptions().ignoreSpans;return!e||!Wo(e)||!n?.length?!1:ro({description:t.name||``,op:t.attributes?.[`sentry.op`]||t.op,attributes:t.attributes},n)}function _s(e){return lo(e)&&e.dropReason===`ignored`}function vs(e,t,n){let r,i,a,o=n?.maxWait?Math.max(n.maxWait,t):0,s=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=e(),r}function l(){i!==void 0&&clearTimeout(i),a!==void 0&&clearTimeout(a),i=a=void 0}function u(){return i!==void 0||a!==void 0?c():r}function d(){return i&&clearTimeout(i),i=s(c,t),o&&a===void 0&&(a=s(c,o)),r}return d.cancel=l,d.flush=u,d}var ys=new WeakSet,bs=e=>ys.has(e),xs=e=>{ys.add(e)},Ss=new WeakMap;function Cs(e){if(Uo()||Ho(ws),Ss.has(e))return;let t=new Set,n=vs(()=>{let e=[...t];t.clear();for(let t of e)t()},1,{maxWait:100});e.on(`flush`,()=>{n.flush()}),Ss.set(e,e=>{t.add(e),n()})}var ws={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&Ss.get(n);if(!r){let t=e();t&&n?.captureEvent(t);return}r(()=>{let t=e({isSpanAlreadyCaptured:bs,onSpanCaptured:xs});t&&n.captureEvent(t)})},onChildSpanEnded(e,t,n,r){if(ys.has(e)||!ys.has(t))return;let i=r.getClient(),a=i&&Ss.get(i),o=()=>{let e=n({isSpanAlreadyCaptured:bs,onSpanCaptured:xs});e?.contexts?.trace?.data&&(e.contexts.trace.data[`sentry.parent_span_already_sent`]=!0),e&&i?.captureEvent(e)};a?a(o):o()}},Ts=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`,`addEventListener`],Es=[`removeListener`,`off`,`removeEventListener`],Ds=Symbol(`SentryScopeBoundListeners`),Os;function ks(e){return Os!==void 0&&(e===Os||e.listener===Os)}function As(e,t=M()){let n=e;if(Ls(n))return e;Is(n);for(let e of Ts)typeof n[e]==`function`&&(n[e]=Ns(n,n[e],t));for(let e of Es)typeof n[e]==`function`&&(n[e]=Ps(n,n[e]));return typeof n.removeAllListeners==`function`&&(n.removeAllListeners=Fs(n,n.removeAllListeners)),e}function js(e,t){return function(...n){return bi(t,()=>e.apply(this,n))}}function Ms(e){return typeof e==`function`}function Ns(e,t,n){return function(...r){let i=r[0],a=r[1],o=r.slice(2);if(!Ms(a)||ks(a))return t.apply(this,r);let s=Ls(e)||Is(e),c=s.get(i);c||(c=new WeakMap,s.set(i,c));let l=c.get(a);l||(l=js(a,n),c.set(a,l));let u=Os;Os=l;try{return t.call(this,i,l,...o)}finally{Os=u}}}function Ps(e,t){return function(...n){let r=n[0],i=n[1],a=n.slice(2),o=Ms(i)?Ls(e)?.get(r)?.get(i):void 0;return o?t.call(this,r,o,...a):t.apply(this,n)}}function Fs(e,t){return function(...n){let r=Ls(e);if(r){if(n.length===0)Is(e);else{let e=n[0];r.delete(e)}}return t.apply(this,n)}}function Is(e){let t=new Map;return e[Ds]=t,t}function Ls(e){return e[Ds]}function Rs(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Hs(e,t),r&&Gs(e,r),Ks(e,n),Us(e,i),Ws(e,a)}function zs(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;Bs(e,`extra`,n),Bs(e,`tags`,r),Bs(e,`attributes`,i),Bs(e,`user`,a),Bs(e,`contexts`,o),e.sdkProcessingMetadata=Hr(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function Bs(e,t,n){e[t]=Hr(e[t],n,1)}function Vs(e,t){let n=yi().getScopeData();return e&&zs(n,e.getScopeData()),t&&zs(n,t.getScopeData()),n}function Hs(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function Us(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Ws(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Gs(e,t){e.contexts={trace:ja(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:go(t),...e.sdkProcessingMetadata};let n=L(Za(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Ks(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function qs(e){let t={},{response:n,profile:r,cloud_resource:i,culture:a,state:o}=e;if(n&&(n.status_code!=null&&(t[`http.response.status_code`]=n.status_code),n.body_size!=null&&(t[`http.response.body.size`]=n.body_size)),r&&(r.profile_id&&(t[`sentry.profile_id`]=r.profile_id),r.profiler_id&&(t[`sentry.profiler_id`]=r.profiler_id)),i)for(let[e,n]of Object.entries(i))n!=null&&(t[e]=n);a&&(a.locale&&(t[`culture.locale`]=a.locale),a.timezone&&(t[`culture.timezone`]=a.timezone)),o?.state&&typeof o.state.type==`string`&&(t[`state.type`]=o.state.type);let s=e.angular;if(s){let e=s.version;(typeof e==`string`||typeof e==`number`)&&(t[`angular.version`]=e)}let c=e.react;if(c){let e=c.version;(typeof e==`string`||typeof e==`number`)&&(t[`react.version`]=e)}return t}var Js=`aws.dynamodb.attribute_definitions`,Ys=`aws.dynamodb.consistent_read`,Xs=`aws.dynamodb.consumed_capacity`,Zs=`aws.dynamodb.count`,Qs=`aws.dynamodb.exclusive_start_table`,$s=`aws.dynamodb.global_secondary_indexes`,ec=`aws.dynamodb.global_secondary_index_updates`,tc=`aws.dynamodb.index_name`,nc=`aws.dynamodb.item_collection_metrics`,rc=`aws.dynamodb.limit`,ic=`aws.dynamodb.local_secondary_indexes`,ac=`aws.dynamodb.projection`,oc=`aws.dynamodb.provisioned_read_capacity`,sc=`aws.dynamodb.provisioned_write_capacity`,cc=`aws.dynamodb.scanned_count`,lc=`aws.dynamodb.scan_forward`,uc=`aws.dynamodb.segment`,dc=`aws.dynamodb.select`,fc=`aws.dynamodb.table_count`,pc=`aws.dynamodb.table_names`,mc=`aws.dynamodb.total_segments`,hc=`aws.kinesis.stream.name`,gc=`aws.request.extended_id`,_c=`aws.request.id`,vc=`aws.s3.bucket`,yc=`aws.secretsmanager.secret.arn`,bc=`aws.sns.topic.arn`,xc=`aws.step_functions.activity.arn`,Sc=`aws.step_functions.state_machine.arn`,Cc=`cache.key`,wc=`cloud.region`,Tc=`code.function.name`,Ec=`db.collection.name`,Dc=`db.name`,Oc=`db.namespace`,kc=`db.operation`,Ac=`db.operation.batch.size`,jc=`db.operation.name`,Mc=`db.query.text`,Nc=`db.statement`,Pc=`db.system`,Fc=`db.system.name`,Ic=`db.user`,Lc=`error.type`,Rc=`faas.execution`,zc=`faas.invoked_name`,Bc=`faas.invoked_provider`,Vc=`faas.invoked_region`,Hc=`faas.name`,Uc=`faas.trigger`,Wc=`gen_ai.embeddings.input`,Gc=`gen_ai.function_id`,Kc=`gen_ai.input.messages`,qc=`gen_ai.operation.name`,Jc=`gen_ai.output.messages`,Yc=`gen_ai.request.available_tools`,Xc=`gen_ai.request.max_tokens`,Zc=`gen_ai.request.model`,Qc=`gen_ai.request.stop_sequences`,$c=`gen_ai.request.temperature`,el=`gen_ai.request.top_p`,tl=`gen_ai.response.finish_reasons`,nl=`gen_ai.response.id`,rl=`gen_ai.response.model`,il=`gen_ai.response.streaming`,al=`gen_ai.system`,ol=`gen_ai.tool.input`,sl=`gen_ai.tool.name`,cl=`gen_ai.tool.output`,ll=`gen_ai.tool.type`,ul=`gen_ai.usage.input_tokens`,dl=`gen_ai.usage.output_tokens`,fl=`gen_ai.usage.total_tokens`,pl=`graphql.document`,ml=`graphql.operation.name`,hl=`graphql.operation.type`,gl=`http.client_ip`,_l=`http.flavor`,vl=`http.host`,yl=`http.method`,bl=`http.request.method`,xl=`http.response.status_code`,Sl=`http.route`,Cl=`http.scheme`,wl=`http.status_code`,Tl=`http.target`,El=`http.url`,Dl=`http.user_agent`,Ol=`koa.name`,kl=`koa.type`,Al=`messaging.batch.message_count`,jl=`messaging.destination`,Ml=`messaging.destination.name`,Nl=`messaging.message.id`,Pl=`messaging.operation.name`,Fl=`messaging.operation.type`,Il=`messaging.system`,Ll=`network.peer.address`,Rl=`network.peer.port`,zl=`network.protocol.name`,Bl=`network.protocol.version`,Vl=`net.host.ip`,Hl=`net.host.name`,Ul=`net.host.port`,Wl=`net.peer.ip`,Gl=`net.peer.name`,Kl=`net.peer.port`,ql=`net.transport`,Jl=`rpc.grpc.status_code`,Yl=`rpc.method`,Xl=`rpc.service`,Zl=`rpc.system`,Ql=`sentry.graphql.operation`,$l=`sentry.http.prefetch`,eu=`sentry.origin`,tu=`sentry.sdk.name`,nu=`sentry.sdk.version`,ru=`sentry.segment.id`,iu=`sentry.segment.name`,au=`sentry.trace_lifecycle`,ou=`server.address`,su=`server.port`,cu=`service.name`,lu=`service.version`,uu=`url.full`,du=`url.path`,fu=`url.query`,pu=`url.scheme`,mu=`user_agent.original`;function hu(e,t){let n=Ra(e),r=Qa(e),i=Ra(r),{isolationScope:a,scope:o}=Xi(e),s=Vs(a,o);yu(n,i,t,s);let c=e.kind;t.emit(`preprocessSpan`,n,{spanKind:c}),n.is_segment&&(gu(n,s),vu(n,t),t.emit(`processSegmentSpan`,n)),t.emit(`processSpan`,n);let{beforeSendSpan:l}=t.getOptions(),u=l&&yo(l)?bu(n,l):n,d=u.attributes?.[Ci];return n.is_segment&&d&&_u(u,{"sentry.segment.name.source":d}),{...Ba(u),_segmentSpan:r}}function gu(e,t){_u(e,qs(t.contexts))}function _u(e,t){let n=e.attributes??={};Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}function vu(e,t){let n=t.getIntegrationNames();n.length&&_u(e,{[ki]:n})}function yu(e,t,n,r){let i=n.getSdkMetadata(),{release:a,environment:o}=n.getOptions();_u(e,{[au]:`stream`,[iu]:t.name,[ru]:t.span_id,[tu]:i?.sdk?.name,[nu]:i?.sdk?.version,[Di]:a,[Oi]:o||`production`,[Ai]:r.user?.id,[ji]:r.user?.email,[Mi]:r.user?.ip_address,[Ni]:r.user?.username,...r.attributes})}function bu(e,t){return t(e)||($a(),e)}var xu=0,Su=1,Cu=2;function wu(e){return new Eu(t=>{t(e)})}function Tu(e){return new Eu((t,n)=>{n(e)})}var Eu=class e{constructor(e){this._state=xu,this._handlers=[],this._runExecutor(e)}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}_executeHandlers(){if(this._state===xu)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===Su&&e[1](this._value),this._state===Cu&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===xu){if(Bn(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(Su,e)},r=e=>{t(Cu,e)};try{e(n,r)}catch(e){r(e)}}};function Du(e,t,n,r=0){try{let i=Ou(t,n,e,r);return Bn(i)?i:wu(i)}catch(e){return Tu(e)}}function Ou(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return D&&a===null&&A.log(`Event processor "${i.id||`?`}" dropped event`),Bn(a)?a.then(e=>Ou(e,t,n,r+1)):Ou(a,t,n,r+1)}var ku,Au,ju,Mu;function Nu(e){let t=O._sentryDebugIds,n=O._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Mu&&r.length===Au&&i.length===ju)return Mu;Au=r.length,ju=i.length,Mu={},ku||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=ku?.[r];if(i&&Mu&&t)Mu[i[0]]=t,ku&&(ku[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&Mu&&ku){Mu[i]=t,ku[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Mu}function Pu(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||Cr(),timestamp:t.timestamp||Pr()},l=n.integrations||e.integrations.map(e=>e.name);Fu(c,e),Ru(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Iu(c,e.stackParser);let u=Bu(r,n.captureContext);n.mechanism&&Dr(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Vs(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Rs(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?wu(c):Du(m,c,n)).then(e=>(e&&Lu(e),typeof o==`number`&&o>0?zu(e,o,s):e))}function Fu(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||`production`,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=hr(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=hr(e.value,a)})}function Iu(e,t){let n=Nu(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Lu(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function Ru(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function zu(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:or(e.data,t,n)}}))},...e.user&&{user:or(e.user,t,n)},...e.contexts&&{contexts:or(e.contexts,t,n)},...e.extra&&{extra:or(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=or(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:or(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=or(e.contexts.flags,3,n)),r}function Bu(e,t){if(!t)return e;let n=e?e.clone():new Zr;return n.update(t),n}function Vu(e){if(e)return Hu(e)||Wu(e)?{captureContext:e}:e}function Hu(e){return e instanceof Zr||typeof e==`function`}var Uu=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Wu(e){return Object.keys(e).some(e=>Uu.includes(e))}function H(e,t){return M().captureException(e,Vu(t))}function Gu(e,t){let n=typeof t==`string`?t:void 0,r=typeof t==`string`?void 0:{captureContext:t};return M().captureMessage(e,n,r)}function Ku(e,t){return M().captureEvent(e,t)}function qu(e,t){N().setContext(e,t)}function Ju(e){N().setExtras(e)}function Yu(e,t){N().setExtra(e,t)}function Xu(e){N().setTags(e)}function Zu(e,t){N().setTag(e,t)}function Qu(e){N().setAttributes(e)}function $u(e,t){N().setAttribute(e,t)}function ed(e){N().setUser(e)}function td(e){N().setConversationId(e)}function nd(){return N().lastEventId()}async function rd(e){let t=P();return t?t.flush(e):(D&&A.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}async function id(e){let t=P();return t?t.close(e):(D&&A.warn(`Cannot flush events and disable SDK. No client defined.`),Promise.resolve(!1))}function ad(){return!!P()}function od(){let e=P();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function sd(e){N().addEventProcessor(e)}function cd(e){let t=N(),{user:n}=Vs(t,M()),{userAgent:r}=O.navigator||{},i=Rr({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&zr(a,{status:`exited`}),ld(),t.setSession(i),i}function ld(){let e=N(),t=M().getSession()||e.getSession();t&&Br(t),ud(),e.setSession()}function ud(){let e=N(),t=P(),n=e.getSession();n&&t&&t.captureSession(n)}function dd(e=!1){if(e){ld();return}ud()}function fd(e,t,n){function r(){let r=pd({monitorSlug:e,status:`in_progress`},n),i=Lr();function a(t){pd({monitorSlug:e,status:t,checkInId:r,duration:Lr()-i})}let o;try{o=t()}catch(e){throw a(`error`),e}return Bn(o)?o.then(e=>(a(`ok`),e),e=>{throw a(`error`),e}):(a(`ok`),o)}let i={...M().getPropagationContext()};return xi(()=>{if(n?.isolateTrace)return ss(r);let e=M();return Ca(e.getPropagationContext())||e.setPropagationContext(i),r()})}function pd(e,t){let n=M(),r=P();if(!r)D&&A.warn(`Cannot capture check-in. No client defined.`);else if(!r.captureCheckIn)D&&A.warn(`Cannot capture check-in. Client does not support sending check-ins.`);else return r.captureCheckIn(e,t,n);return Cr()}function md(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}function U(e,t=1){if(di(Qt()).getTracingChannelBinding?.()){e();return}t&&md(setTimeout(()=>{U(e,t-1)},1))}function hd(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function gd(e){return`${hd(e)}${e.projectId}/envelope/`}function _d(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function vd(e,t,n){return t||`${gd(e)}?${_d(e,n)}`}var yd=[];function bd(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function xd(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return bd(r)}function Sd(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&wd(e,t,n)}),n}function Cd(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function wd(e,t,n){if(n[t.name]){D&&A.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!yd.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),yd.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}[`processSpan`,`processSegmentSpan`].forEach(n=>{let r=t[n];typeof r==`function`&&e.on(n,n=>r.call(t,n,e))}),D&&A.log(`Integration installed: ${t.name}`)}function Td(e){let t=P();if(!t){D&&A.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}function W(e){return e}function Ed(e,t){let n={...e,...t};for(let r in t){let i=e[r],a=t[r];typeof i==`function`&&typeof a==`function`&&(n[r]=new Proxy(i,{apply:(e,t,n)=>(Reflect.apply(e,t,n),Reflect.apply(a,t,n))}))}return n}var Dd=`sentry.timestamp.sequence`,Od=0,kd;function Ad(e){let t=Math.floor(e*1e3);kd!==void 0&&t!==kd&&(Od=0);let n=Od;return Od++,kd=t,{key:Dd,value:{value:n,type:`integer`}}}function jd(e,t){return t?bi(t,()=>{let n=R(),r=n?ja(n):Si(t);return[n?go(n):ho(e,t),r]}):[void 0,void 0]}var Md={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function Nd(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function Pd(){return!Nd()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function Fd(){return typeof window<`u`&&(!Pd()||Id())}function Id(){return O.process?.type===`renderer`}function Ld(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...Fd()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Rd(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=pa(r)),bo(a,[Ld(e,i)])}var zd=100;function Bd(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function Vd(e,t){let n=Gd(),r=Wd(e);r===void 0?n.set(e,[t]):r.length>=zd?(Ud(e,r),n.set(e,[t])):n.set(e,[...r,t])}function Hd(e,t=M(),n=Vd){let r=t?.getClient()??P();if(!r){D&&A.warn(`No client available to capture log.`);return}let{release:i,environment:a,enableLogs:o=!0,beforeSendLog:s}=r.getOptions();if(!o){D&&A.warn(`logging option not enabled, log will not be captured.`);return}let[,c]=jd(r,t),l={...e.attributes},{user:{id:u,email:d,username:f},attributes:p={}}=Vs(N(),t);Bd(l,`user.id`,u,!1),Bd(l,`user.email`,d,!1),Bd(l,`user.name`,f,!1),Bd(l,`sentry.release`,i),Bd(l,`sentry.environment`,a);let{name:m,version:h}=r.getSdkMetadata()?.sdk??{};Bd(l,`sentry.sdk.name`,m),Bd(l,`sentry.sdk.version`,h);let g=r.getIntegrationByName(`Replay`),_=g?.getReplayId(!0);Bd(l,`sentry.replay_id`,_),_&&g?.getRecordingMode()===`buffer`&&Bd(l,`sentry._internal.replay_is_buffering`,!0);let v=e.message;if(Fn(v)){let{__sentry_template_string__:e,__sentry_template_values__:t=[]}=v;t?.length&&(l[`sentry.message.template`]=e),t.forEach((e,t)=>{l[`sentry.message.parameter.${t}`]=e})}Bd(l,`sentry.trace.parent_span_id`,Yr(t)?.spanContext().spanId);let y={...e,attributes:l};r.emit(`beforeCaptureLog`,y);let ee=s?an(()=>s(y)):y;if(!ee){r.recordDroppedEvent(`before_send`,`log_item`,1),D&&A.warn(`beforeSendLog returned null, log will not be captured.`);return}let{level:te,message:ne,attributes:re={},severityNumber:ie}=ee,ae=Lr(),oe=Ad(ae);n(r,{timestamp:ae,level:te,body:qd(String(ne)),trace_id:c?.trace_id,severity_number:ie??Md[te],attributes:Kd({...mi(p),...mi(re,!0),[oe.key]:oe.value})}),r.emit(`afterCaptureLog`,ee)}function Ud(e,t){let n=t??Wd(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Rd(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Gd().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Wd(e){return Gd().get(e)}function Gd(){return en(`clientToLogBufferMap`,()=>new WeakMap)}function Kd(e){let t={};for(let[n,r]of Object.entries(e)){let e=qd(n);t[e]=r.type===`string`?{...r,value:qd(r.value)}:r}return t}function qd(e){let t=Object(e),n=t.isWellFormed,r=t.toWellFormed;return typeof n==`function`&&typeof r==`function`?n.call(e)?e:r.call(e):e}function Jd(e,t){let n=t?`auto`:`never`;return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{version:2,...Fd()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Yd(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=pa(r)),bo(a,[Jd(e,i)])}var Xd=1e3;function Zd(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function Qd(e,t){let n=af(),r=rf(e);r===void 0?n.set(e,[t]):r.length>=Xd?(nf(e,r),n.set(e,[t])):n.set(e,[...r,t])}function $d(e,t,n){let{release:r,environment:i}=t.getOptions(),a={...e.attributes};Zd(a,`user.id`,n.id,!1),Zd(a,`user.email`,n.email,!1),Zd(a,`user.name`,n.username,!1),Zd(a,`sentry.release`,r),Zd(a,`sentry.environment`,i);let{name:o,version:s}=t.getSdkMetadata()?.sdk??{};Zd(a,`sentry.sdk.name`,o),Zd(a,`sentry.sdk.version`,s);let c=t.getIntegrationByName(`Replay`),l=c?.getReplayId(!0);return Zd(a,`sentry.replay_id`,l),l&&c?.getRecordingMode()===`buffer`&&Zd(a,`sentry._internal.replay_is_buffering`,!0),{...e,attributes:a}}function ef(e,t,n,r){let[,i]=jd(t,n),a=Yr(n),o=a?a.spanContext().traceId:i?.trace_id,s=a?a.spanContext().spanId:void 0,c=Lr(),l=Ad(c);return{timestamp:c,trace_id:o??``,span_id:s,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...mi(r),...mi(e.attributes,`skip-undefined`),[l.key]:l.value}}}function tf(e,t){let n=t?.scope??M(),r=t?.captureSerializedMetric??Qd,i=n?.getClient()??P();if(!i){D&&A.warn(`No client available to capture metric.`);return}let{_experiments:a,enableMetrics:o,beforeSendMetric:s}=i.getOptions();if(!(o??a?.enableMetrics??!0)){D&&A.warn(`metrics option not enabled, metric will not be captured.`);return}let{user:c,attributes:l}=Vs(N(),n),u=$d(e,i,c);i.emit(`processMetric`,u);let d=s||a?.beforeSendMetric,f=d?d(u):u;if(!f){D&&A.log("`beforeSendMetric` returned `null`, will not send metric.");return}let p=ef(f,i,n,l);D&&A.log(`[Metric]`,p),r(i,p),i.emit(`afterCaptureMetric`,f)}function nf(e,t){let n=t??rf(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Yd(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);af().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function rf(e){return af().get(e)}function af(){return en(`clientToMetricBufferMap`,()=>new WeakMap)}function of(e){return Ba({trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||``,start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status===`ok`||e.status===`cancelled`?`ok`:`error`,is_segment:!1,attributes:{...e.data},links:e.links})}function sf(e,t){if(e.type!==`transaction`||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||Wo(t))return;let n=[],r=[];for(let t of e.spans)t.op?.startsWith(`gen_ai.`)?n.push(of(t)):r.push(t);if(n.length===0)return;e.spans=r;let i=t.getDataCollectionOptions().userInfo?`auto`:`never`;return[{type:`span`,item_count:n.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...Fd()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var cf=Symbol.for(`SentryBufferFullError`);function lf(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Tu(cf);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return wu(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>md(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var uf=6e4;function df(e,t=$n()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?uf:r-t}function ff(e,t){return e[t]||e.all||0}function pf(e,t,n=$n()){return ff(e,t)>n}function mf(e,{statusCode:t,headers:n},r=$n()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+df(o,r):t===429&&(i.all=r+6e4);return i}function hf(e,t,n=lf(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(So(i,(t,n)=>{let i=jo(n);pf(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=bo(i[0],a),s=t=>{if(Co(o,[`client_report`])){D&&A.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}So(o,(n,r)=>{e.recordDroppedEvent(t,jo(r))})};return n.add(()=>t({body:To(o)}).then(e=>e.statusCode===413?(D&&A.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(D&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&A.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=mf(r,e),e),e=>{throw s(`network_error`),D&&A.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===cf)return D&&A.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function gf(e,t,n){let r=[{type:`client_report`},{timestamp:n||Pr(),discarded_events:e}];return bo(t?{dsn:t}:{},[r])}function _f(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function vf(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[Fi],exclusive_time:o?.[Ii],measurements:e.measurements,is_segment:!0}}function yf(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{"sentry.profile_id":e.profile_id},...e.exclusive_time&&{"sentry.exclusive_time":e.exclusive_time}}}},measurements:e.measurements}}var bf=`[Filtered]`,xf=[`forwarded`,`-ip`,`remote-`,`via`,`-user`],Sf=[`auth`,`token`,`secret`,`session`,`password`,`passwd`,`pwd`,`key`,`jwt`,`bearer`,`sso`,`saml`,`csrf`,`xsrf`,`credentials`,`sid`,`identity`,`set-cookie`,`cookie`],Cf=[`.sid`,`sessid`,`remember`,`oidc`,`pkce`,`nonce`,`__secure-`,`__host-`,`awsalb`,`awselb`,`akamai`,`__stripe`,`cognito`,`firebase`,`supabase`,`sb-`,`mfa`,`2fa`];function wf(e){return e===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[`incomingRequest`,`outgoingRequest`,`incomingResponse`,`outgoingResponse`],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:xf},httpHeaders:{request:{deny:xf},response:{deny:xf}},httpBodies:[],urlQueryParams:{deny:xf},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var Tf={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[`incomingRequest`,`outgoingRequest`,`incomingResponse`,`outgoingResponse`],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:5};function Ef(e){let t=e.dataCollection==null?wf(e.sendDefaultPii):Tf,n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:{request:n.httpHeaders?.request??t.httpHeaders.request,response:n.httpHeaders?.response??t.httpHeaders.response},httpBodies:n.httpBodies??t.httpBodies,urlQueryParams:n.urlQueryParams??n.queryParams??t.urlQueryParams,graphQL:{document:n.graphQL?.document??t.graphQL.document,variables:n.graphQL?.variables??t.graphQL.variables},genAI:{inputs:n.genAI?.inputs??t.genAI.inputs,outputs:n.genAI?.outputs??t.genAI.outputs},databaseQueryData:n.databaseQueryData??t.databaseQueryData,stackFrameVariables:n.stackFrameVariables??t.stackFrameVariables,frameContextLines:n.frameContextLines??t.frameContextLines}}var Df=`Not capturing exception because it's already been captured.`,Of=`Discarded session because of missing or non-string release`,kf=Symbol.for(`SentryInternalError`),Af=Symbol.for(`SentryDoNotSendEventError`),jf=5e3;function Mf(e){return{message:e,[kf]:!0}}function Nf(e){return{message:e,[Af]:!0}}function Pf(e){return j(e)&&kf in e}function Ff(e){return j(e)&&Af in e}function If(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{if(a+=r(t),a>=8e5)i(e);else if(!s){let t=e.getOptions()._flushInterval??jf;t>0&&(s=!0,o=md(setTimeout(()=>{i(e)},t)))}}),e.on(`flush`,()=>{i(e)})}var Lf=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=lf(e.transportOptions?.bufferSize??64),this._dataCollection=Ef(e),e.dsn?this._dsn=ya(e.dsn):D&&A.warn(`No DSN provided, client will not send events.`),this._dsn){let t=vd(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs??!0,this._options.enableLogs&&If(this,`afterCaptureLog`,`flushLogs`,Wf,Ud),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&If(this,`afterCaptureMetric`,`flushMetrics`,Uf,nf)}captureException(e,t,n){let r=Cr();if(jr(e))return D&&A.log(Df),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:Cr(),...n},a=Fn(e)?e:String(e),o=In(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=Cr();if(t?.originalException&&jr(t.originalException))return D&&A.log(Df),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Rf(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),zr(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(this.emit(`flush`),!t)return!0;let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){let t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),wd(this,e,this._integrations),t||Cd(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=sf(e,this),r=Io(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])r=xo(r,Oo(e));n&&(r=xo(r,n)),this.sendEnvelope(r).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=uo}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){D&&A.warn(Of);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){D&&A.warn(Of);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Fo(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;D&&A.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return D&&A.error(`Error while sending envelope:`,e),{}}return D&&A.error(`Transport disabled`),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Sd(this,e),Cd(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(zr(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=this.getIntegrationNames();return!t.integrations&&a.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Pu(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...Si(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ho(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=M(),r=N()){return D&&Vf(e)&&A.log(`Captured error event \`${_f(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{D&&(Ff(e)?A.log(e.message):Pf(e)?A.warn(e.message):A.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Hf(e),s=Vf(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:ba(a),u=Rf(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Nf("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:zf(Bf(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Nf(`${c} returned \`null\`, will not send event.`)}let d=n.getSession()||r.getSession();if(s&&d&&this._updateSessionFromEvent(d,i),s&&typeof l==`number`&&Qn()>l)throw this.recordDroppedEvent(`sample_rate`,`error`),Nf(`Discarding event because it's not included in the random sample (sampling rate = ${a})`);if(o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let f=i.transaction_info;return o&&f&&i.transaction!==e.transaction&&(i.transaction_info={...f,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw Ff(e)||Pf(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Mf(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
10
|
+
Reason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===cf&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){D&&A.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){D&&A.log(`No outcomes to send`);return}if(!this._dsn){D&&A.log(`No dsn provided, will not send outcomes`);return}D&&A.log(`Sending outcomes:`,e);let t=gf(e,this._options.tunnel&&pa(this._dsn));this.sendEnvelope(t)}};function Rf(e){return e===`replay_event`?`replay`:e||`error`}function zf(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Bn(e))return e.then(e=>{if(!Ln(e)&&e!==null)throw Mf(n);return e},e=>{throw Mf(`${t} rejected with ${e}`)});if(!Ln(e)&&e!==null)throw Mf(n);return e}function Bf(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:o}=t,s=!yo(t.beforeSendSpan)&&t.beforeSendSpan,c=n;if(Vf(c)&&i)return i(c,r);if(Hf(c)){if(s||o){let t=vf(c);if(o?.length&&ro({description:t.description,op:t.op,attributes:t.data},o))return null;if(s){let e=s(t);e?c=Hr(n,yf(e)):$a()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(o?.length&&ro({description:e.description,op:e.op,attributes:e.data},o)){ao(n,e);continue}if(s){let n=s(e);n?t.push(n):($a(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function Vf(e){return e.type===void 0}function Hf(e){return e.type===`transaction`}function Uf(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Gf(e.attributes)}function Wf(e){let t=0;return e.message&&(t+=e.message.length*2),t+Gf(e.attributes)}function Gf(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Kf(e[0]):In(e)?t+=Kf(e):t+=100}),t}function Kf(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function qf(e){M().setClient(e)}var Jf=new Set;function Yf(e){e.forEach(e=>{Jf.add(e),D&&A.log(`AI provider "${e}" wrapping will be skipped`)})}function Xf(e){return Jf.has(e)}function Zf(){Jf.clear(),D&&A.log(`Cleared AI provider skip registrations`)}function Qf(e,t){return t.some(t=>e.includes(t))}function $f(e,t,n){if(t===!1)return{};let r=n==null?Sf:[...Sf,...n],i={};if(t===!0){for(let t of Object.keys(e))i[t]=Qf(t.toLowerCase(),r)?bf:e[t];return i}if(`deny`in t){let n=t.deny.map(e=>e.toLowerCase());for(let t of Object.keys(e)){let a=t.toLowerCase();i[t]=Qf(a,r)||n.some(e=>a.includes(e))?bf:e[t]}return i}let a=t.allow.map(e=>e.toLowerCase());for(let t of Object.keys(e)){let n=t.toLowerCase();i[t]=Qf(n,r)?bf:a.some(e=>n.includes(e))?e[t]:bf}return i}function ep(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf(`=`,n);if(r===-1)break;let i=e.indexOf(`;`,n);if(i===-1)i=e.length;else if(i<r){n=e.lastIndexOf(`;`,r-1)+1;continue}let a=e.slice(n,r).trim();if(t[a]===void 0){let n=e.slice(r+1,i).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));try{t[a]=n.indexOf(`%`)===-1?n:decodeURIComponent(n)}catch{t[a]=n}}n=i+1}return t}var tp=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),np=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function rp(e,t){let n=String(e).toLowerCase();return tp.has(n)?!1:np.has(n)?!0:t?.strict?null:!!e}function ip(e,t,n,r,i){let a={sent_at:new Date($n()).toISOString()};return n?.sdk&&(a.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(a.dsn=pa(i)),t&&(a.trace=t),bo(a,[ap(e)])}function ap(e){return[{type:`check_in`},e]}var op=`thismessage:/`;function sp(e){return`isRelative`in e}function cp(e,t){let n=e.indexOf(`://`)<=0&&e.indexOf(`//`)!==0,r=t??(n?op:void 0);try{if(`canParse`in URL&&!URL.canParse(e,r))return;let t=new URL(e,r);return n?{isRelative:n,pathname:t.pathname,search:t.search,hash:t.hash}:t}catch{}}function lp(e){if(sp(e))return e.pathname;let t=new URL(e);return t.search=``,t.hash=``,[`80`,`443`].includes(t.port)&&(t.port=``),t.password&&=`%filtered%`,t.username&&=`%filtered%`,t.toString()}function up(e,t,n,r){return`${n?.method?.toUpperCase()??`GET`} ${r||(e?t===`client`?lp(e):e.pathname:`/`)}`}function dp(e,t,n,r,i){let a={[I]:n,[Ci]:`url`};return i&&(a[t===`server`?`http.route`:`url.template`]=i,a[Ci]=`route`),r?.method&&(a[Bi]=r.method.toUpperCase()),e&&(e.search&&(a[`url.query`]=e.search),e.hash&&(a[`url.fragment`]=e.hash),e.pathname&&(a[`url.path`]=e.pathname,e.pathname===`/`&&(a[Ci]=`route`)),sp(e)||(a[uu]=e.href,e.port&&(a[`url.port`]=e.port),e.protocol&&(a[`url.scheme`]=e.protocol),e.hostname&&(a[t===`server`?`server.address`:`url.domain`]=e.hostname))),[up(e,t,r,i),a]}function fp(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||``,r=t[8]||``;return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function pp(e){return e.split(/[?#]/,1)[0]}function mp(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function hp(e,t=!0){if(e.startsWith(`data:`)){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:`text/plain`,i=e.includes(`;base64,`),a=e.indexOf(`,`),o=``;if(t&&a!==-1){let t=e.slice(a+1);o=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?`,base64`:``}${o?`,${o}`:``}`}return e}function gp(e,...t){let n=new String(String.raw(e,...t));return n.__sentry_template_string__=e.join(`\0`).replace(/%/g,`%%`).replace(/\0/g,`%s`),n.__sentry_template_values__=t,n}var _p=gp;function vp(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:k})),i.version=k)}function yp(e={}){let t=e.client||P();if(!od()||!t)return{};let n=di(Qt());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||M(),i=e.span||R(),a=lo(i)&&!to(t.getOptions());if(!i&&vi())return{};let o=i&&!a?Ma(i):bp(r),s=aa(i?go(i):ho(t,r));if(!xa.test(o))return A.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let c={"sentry-trace":o,baggage:s};return e.propagateTraceparent&&(c.traceparent=i&&!a?Na(i):xp(r)),c}function bp(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ta(t,r,n)}function xp(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ea(t,r,n)}var Sp=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Cp(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return D&&!r&&A.log(Sp,e),r;let i=yr(e,t);return n?.set(e,i),D&&!i&&A.log(Sp,e),i}function wp(e){return Object.entries(e||yp()).map(([e,t])=>`<meta name="${e}" content="${t}"/>`).join(``)}function Tp(e){return Array.from(new Set(e))}var Ep=1048576;function Dp(e){return e===`small`?1e3:e===`medium`?1e4:Ep}function Op(e){let t={};try{e.forEach((e,n)=>{typeof e==`string`&&(t[n]=e)})}catch{}return t}function kp(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`?t[e]=n:typeof n==`number`&&(t[e]=String(n))})}catch{}return t}function Ap(e){let t=e.headers||{},n=(typeof t[`x-forwarded-host`]==`string`?t[`x-forwarded-host`]:void 0)||(typeof t.host==`string`?t.host:void 0),r=(typeof t[`x-forwarded-proto`]==`string`?t[`x-forwarded-proto`]:void 0)||e.protocol||(e.socket?.encrypted?`https`:`http`),i=e.url||``,a=jp({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Fp(i),headers:kp(t),cookies:s,data:o}}function jp({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Mp(e,t=!1,n=`request`){let r=typeof t==`boolean`?wf(t):t,i=n===`request`?r.httpHeaders.request:r.httpHeaders.response,a=r.cookies,o=`http.${n}.header.`,s={};try{let t={};for(let[n,r]of Object.entries(e)){if(r==null)continue;let e=n.toLowerCase();if(e===`cookie`||e===`set-cookie`){if(a===!1)continue;if(typeof r==`string`&&r!==``){let t=$f(Pp(r,e===`set-cookie`),a,Cf);for(let[n,r]of Object.entries(t))s[`${o}${Np(e)}.${Np(n)}`]=r}else s[`${o}${Np(e)}`]=bf}else{if(i===!1)continue;Array.isArray(r)?t[e]=r.map(e=>e==null?e:String(e)).join(`;`):typeof r==`string`&&(t[e]=r)}}if(i!==!1){let e=$f(t,i);for(let[t,n]of Object.entries(e))s[`${o}${Np(t)}`]=n}}catch{}return s}function Np(e){return e.replace(/-/g,`_`)}function Pp(e,t){let n=e.indexOf(`;`),r=t&&n!==-1?e.substring(0,n):e,i=t?[r]:r.split(`; `),a={};for(let e of i){let t=e.indexOf(`=`),n=(t===-1?e:e.substring(0,t)).toLowerCase();a[n]=t===-1?``:e.substring(t+1)}return a}function Fp(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}var G={INTERNAL:0,SERVER:1,CLIENT:2,PRODUCER:3,CONSUMER:4},Ip={[G.INTERNAL]:`INTERNAL`,[G.SERVER]:`SERVER`,[G.CLIENT]:`CLIENT`,[G.PRODUCER]:`PRODUCER`,[G.CONSUMER]:`CONSUMER`};function Lp(e){return Ip[e]}var Rp=100;function zp(e,t){let n=P(),r=N();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=Rp}=n.getOptions();if(a<=0)return;let o={timestamp:Pr(),...e},s=i?an(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}var Bp=`FunctionToString`,Vp=new WeakMap,Hp=W((()=>({name:Bp,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=Kn(this),r;try{Vp.has(P())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){Vp.set(e,!0)}}))),Up=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/Java exception was raised during method invocation$/,/Java object is gone$/],Wp=`EventFilters`,Gp=W((e={})=>{let t;return{name:Wp,setup(n){t=qp(e,n.getOptions())},processEvent(n,r,i){return t||=qp(e,i.getOptions()),Jp(n,t)?null:n}}}),Kp=W(((e={})=>({...Gp(e),name:`InboundFilters`})));function qp(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Up],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Jp(e,t){if(!e.type){if(Yp(e,t.ignoreErrors))return D&&A.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
11
|
+
Event: ${Tr(e)}`),!0;if(tm(e))return D&&A.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
12
|
+
Event: ${Tr(e)}`),!0;if(Zp(e,t.denyUrls))return D&&A.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
13
|
+
Event: ${Tr(e)}.
|
|
14
|
+
Url: ${em(e)}`),!0;if(!Qp(e,t.allowUrls))return D&&A.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
15
|
+
Event: ${Tr(e)}.
|
|
16
|
+
Url: ${em(e)}`),!0}else if(e.type===`transaction`&&Xp(e,t.ignoreTransactions))return D&&A.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
17
|
+
Event: ${Tr(e)}`),!0;return!1}function Yp(e,t){return t?.length?_f(e).some(e=>yr(e,t)):!1}function Xp(e,t){if(!t?.length)return!1;let n=e.transaction;return n?yr(n,t):!1}function Zp(e,t){if(!t?.length)return!1;let n=em(e);return n?yr(n,t):!1}function Qp(e,t){if(!t?.length)return!0;let n=em(e);return!n||yr(n,t)}function $p(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function em(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?$p(t):null}catch{return D&&A.error(`Cannot extract url for event ${Tr(e)}`),null}}function tm(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function nm(e,t,n,r,i,a){if(!i.exception?.values||!a||!jn(a.originalException))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=rm(e,t,r,a.originalException,n,i.exception.values,o,0))}function rm(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(jn(r[i])){am(o,s,r);let a=e(t,r[i]),l=c.length;om(a,i,l,s),c=rm(e,t,n,r[i],i,[a,...c],a,l)}return im(r)&&r.errors.forEach((a,l)=>{if(jn(a)){am(o,s,r);let u=e(t,a),d=c.length;om(u,`errors[${l}]`,d,s),c=rm(e,t,n,a,i,[u,...c],u,d)}}),c}function im(e){return Array.isArray(e.errors)}function am(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...im(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function om(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}function sm(e,t){return e(t.stack||``,1)}function cm(e){return jn(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function lm(e){return cm(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function um(e,t){let n={type:t.name||t.constructor.name,value:lm(t)},r=sm(e,t);return r.length&&(n.stacktrace={frames:r}),n}function dm(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(jn(n))return n}}function fm(e){if(`name`in e&&typeof e.name==`string`){let t=`'${e.name}' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message '${e.message}'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;let t=Yn(e);if(Nn(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=pm(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function pm(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function mm(e,t,n,r){if(jn(n))return[n,void 0];if(t.synthetic=!0,Ln(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:sr(n,t)},a=dm(n);if(a)return[a,i];let o=fm(n),s=r?.syntheticException||Error(o);return s.message=o,[s,i]}let i=r?.syntheticException||Error(n);return i.message=`${n}`,[i,void 0]}function hm(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=mm(e,i,n,r),s={exception:{values:[um(t,a)]}};return o&&(s.extra=o),Er(s,void 0,void 0),Dr(s,i),{...s,event_id:r?.event_id}}function gm(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=sm(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},Dr(a,{synthetic:!0}))}if(Fn(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return a.logentry={message:e,params:n},a}return a.message=t,a}var _m=`cause`,vm=5,ym=`LinkedErrors`,bm=W(((e={})=>{let t=e.limit||vm,n=e.key||_m;return{name:ym,preprocessEvent(e,r,i){nm(um,i.getOptions().stackParser,n,t,e,r)}}})),xm=[`X-Client-IP`,`X-Forwarded-For`,`Fly-Client-IP`,`CF-Connecting-IP`,`Fastly-Client-Ip`,`True-Client-Ip`,`X-Real-IP`,`X-Cluster-Client-IP`,`X-Forwarded`,`Forwarded-For`,`Forwarded`,`X-Vercel-Forwarded-For`];function Sm(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return xm.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Cm(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&wm(e))||null}function Cm(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function wm(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}var Tm=`RequestData`,Em=W(((e={})=>{function t(t){let n=t.getDataCollectionOptions(),r={...n,...e.include?.cookies===!0&&n.cookies===!1&&{cookies:!0},...e.include?.headers===!0&&n.httpHeaders.request===!1&&{httpHeaders:{...n.httpHeaders,request:!0}}};return{dataCollection:r,include:{cookies:r.cookies!==!1,data:!0,headers:r.httpHeaders.request!==!1,ip:r.userInfo,query_string:r.urlQueryParams!==!1,url:!0,...e.include}}}return{name:Tm,processEvent(e,n,r){let{sdkProcessingMetadata:i={}}=e,{normalizedRequest:a,ipAddress:o}=i,{include:s}=t(r);return a&&Dm(e,a,{ipAddress:o},s),e},processSegmentSpan(e,n){let{sdkProcessingMetadata:r={}}=N().getScopeData(),{normalizedRequest:i,ipAddress:a}=r;if(!i)return;let{include:o,dataCollection:s}=t(n);Om(e,i,a,o,s)}}}));function Dm(e,t,n,r){if(e.request={...e.request,...km(t,r)},r.ip){let r=t.headers&&Sm(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Om(e,t,n,r,i){let a=km(t,r),o={};if(a.url&&(o[uu]=a.url),a.method&&(o[`http.request.method`]=a.method),a.query_string&&(o[fu]=Am(a.query_string)),_u(e,o),a.cookies&&Object.keys(a.cookies).length>0&&_u(e,Mp({cookie:Object.entries(a.cookies).map(([e,t])=>`${e}=${t}`).join(`; `)},i,`request`)),a.headers&&_u(e,Mp(a.headers,i,`request`)),a.data!=null){let t=typeof a.data==`string`?a.data:JSON.stringify(a.data);t&&_u(e,{"http.request.body.data":t})}if(r.ip){let r=t.headers&&Sm(t.headers)||n||void 0;r&&_u(e,{[Mi]:r})}}function km(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let e=new Set(xm.map(e=>e.toLowerCase()));for(let t of Object.keys(r))e.has(t.toLowerCase())&&delete r[t]}return n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?ep(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Am(e){return typeof e==`string`?e||void 0:(Array.isArray(e)?e:Object.entries(e)).map(([e,t])=>`${e}=${t}`).join(`&`)||void 0}var jm=new Set([]);function Mm(e){let t=`console`,n=Dn(t,e);return On(t,Fm),n}function Nm(e){for(let t of e)jm.add(t);return()=>{for(let t of e)jm.delete(t)}}var Pm=new Set;function Fm(){`console`in O&&tn.forEach(function(e){!Pm.has(e)&&e in O.console&&(Pm.add(e),Hn(O.console,e,function(t){return rn[e]=t,function(...t){let n=t[0],r=rn[e],i=jm.size&&typeof n==`string`&&yr(n,jm);i||kn(`console`,{args:t,level:e}),(!i||D&&A.isEnabled())&&r?.apply(O.console,t)}}))})}function Im(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var Lm=`CaptureConsole`,Rm=W(((e={})=>{let t=e.levels||tn,n=e.handled??!0;return{name:Lm,setup(e){`console`in O&&Mm(({args:r,level:i})=>{P()===e&&t.includes(i)&&zm(r,i,n)})}}}));function zm(e,t,n){let r=Im(t),i=Error(),a={level:Im(t),extra:{arguments:e}};bi(o=>{if(o.addEventProcessor(e=>(e.logger=`console`,Dr(e,{handled:n,type:`auto.core.capture_console`}),e)),t===`assert`){if(!e[0]){let t=`Assertion failed: ${_r(e.slice(1),` `)||`console.assert`}`;o.setExtra(`arguments`,e.slice(1)),o.captureMessage(t,r,{captureContext:a,syntheticException:i})}return}let s=e.find(e=>e instanceof Error);if(s){H(s,a);return}let c=_r(e,` `);o.captureMessage(c,r,{captureContext:a,syntheticException:i})})}var Bm=`Dedupe`,Vm=W((()=>{let e;return{name:Bm,processEvent(t){if(t.type)return t;try{if(Hm(t,e))return D&&A.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}}));function Hm(e,t){return t?!!(Um(e,t)||Wm(e,t)):!1}function Um(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Km(e,t)||!Gm(e,t))}function Wm(e,t){let n=qm(t),r=qm(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Km(e,t)||!Gm(e,t))}function Gm(e,t){let n=Cn(e),r=Cn(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Km(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join(``)===r.join(``)}catch{return!1}}function qm(e){return e.exception?.values?.[0]}var Jm=`ExtraErrorData`,Ym=W(((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:Jm,processEvent(e,r,i){let{maxValueLength:a}=i.getOptions();return Xm(e,r,t,n,a)}}}));function Xm(e,t={},n,r,i){if(!t.originalException||!jn(t.originalException))return e;let a=t.originalException.name||t.originalException.constructor.name,o=Zm(t.originalException,r,i);if(o){let t={...e.contexts},r=or(o,n);return Ln(r)&&(nr(r),t[a]=r),{...e,contexts:t}}return e}function Zm(e,t,n){try{let r=[`name`,`message`,`stack`,`line`,`column`,`fileName`,`lineNumber`,`columnNumber`,`toJSON`],i={};for(let t of Object.keys(e)){if(r.indexOf(t)!==-1)continue;let a=e[t];i[t]=jn(a)||typeof a==`string`?n?hr(`${a}`,n):`${a}`:a}if(t&&e.cause!==void 0&&(i.cause=jn(e.cause)?{[e.cause.name||e.cause.constructor.name]:Zm(e.cause,!1,n)}:e.cause),typeof e.toJSON==`function`){let t=e.toJSON();for(let e of Object.keys(t)){let n=t[e];i[e]=jn(n)?n.toString():n}}return i}catch(e){D&&A.error(`Unable to extract extra data from the Error object:`,e)}return null}function Qm(e,t){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t];r===`.`?e.splice(t,1):r===`..`?(e.splice(t,1),n++):n&&(e.splice(t,1),n--)}if(t)for(;n--;)e.unshift(`..`);return e}var $m=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function eh(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=$m.exec(t);return n?n.slice(1):[]}function th(...e){let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:`/`;i&&(t=`${i}/${t}`,n=i.charAt(0)===`/`)}return t=Qm(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`}function nh(e){let t=0;for(;t<e.length&&e[t]===``;t++);let n=e.length-1;for(;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}function rh(e,t){e=th(e).slice(1),t=th(t).slice(1);let n=nh(e.split(`/`)),r=nh(t.split(`/`)),i=Math.min(n.length,r.length),a=i;for(let e=0;e<i;e++)if(n[e]!==r[e]){a=e;break}let o=[];for(let e=a;e<n.length;e++)o.push(`..`);return o=o.concat(r.slice(a)),o.join(`/`)}function ih(e){let t=eh(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}function ah(e,t){let n=eh(e)[2]||``;return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var oh=`RewriteFrames`,sh=W((e={})=>{let t=e.root,n=e.prefix||`app:///`,r=`window`in O&&!!O.window,i=e.iteratee||ch({isBrowser:r,root:t,prefix:n});function a(e){try{return{...e,exception:{...e.exception,values:e.exception.values.map(e=>({...e,...e.stacktrace&&{stacktrace:o(e.stacktrace)}}))}}}catch{return e}}function o(e){return{...e,frames:e?.frames?.map(e=>i(e))}}return{name:oh,processEvent(e){let t=e;return e.exception&&Array.isArray(e.exception.values)&&(t=a(t)),t}}});function ch({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;let i=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes(`\\`)&&!r.filename.includes(`/`),a=/^\//.test(r.filename);if(e){if(t){let e=r.filename;e.indexOf(t)===0&&(r.filename=e.replace(t,n))}}else if(i||a){let e=i?r.filename.replace(/^[a-zA-Z]:/,``).replace(/\\/g,`/`):r.filename;r.filename=`${n}${t?rh(t,e):ah(e)}`}return r}}var lh=[`reauthenticate`,`signInAnonymously`,`signInWithOAuth`,`signInWithIdToken`,`signInWithOtp`,`signInWithPassword`,`signInWithSSO`,`signOut`,`signUp`,`verifyOtp`],uh=[`createUser`,`deleteUser`,`listUsers`,`getUserById`,`updateUserById`,`inviteUserByEmail`],dh={eq:`eq`,neq:`neq`,gt:`gt`,gte:`gte`,lt:`lt`,lte:`lte`,like:`like`,"like(all)":`likeAllOf`,"like(any)":`likeAnyOf`,ilike:`ilike`,"ilike(all)":`ilikeAllOf`,"ilike(any)":`ilikeAnyOf`,is:`is`,in:`in`,cs:`contains`,cd:`containedBy`,sr:`rangeGt`,nxl:`rangeGte`,sl:`rangeLt`,nxr:`rangeLte`,adj:`rangeAdjacent`,ov:`overlaps`,fts:``,plfts:`plain`,phfts:`phrase`,wfts:`websearch`,not:`not`},fh=[`select`,`insert`,`upsert`,`update`,`delete`];function ph(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function mh(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function hh(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function gh(e,t){return hh(e,t)!==void 0}function _h(e,t){if(!e)return;if(typeof e.get==`function`)return e.get(t)??void 0;let n=e,r=t.toLowerCase(),i=Object.keys(n).find(e=>e.toLowerCase()===r);return i===void 0?void 0:n[i]}function vh(e,t={}){switch(e){case`GET`:return`select`;case`POST`:return _h(t,`Prefer`)?.includes(`resolution=`)?`upsert`:`insert`;case`PATCH`:return`update`;case`DELETE`:return`delete`;default:return`<unknown-op>`}}function yh(e,t){if(t===``||t===`*`)return`select(*)`;if(e===`select`)return`select(${t})`;if(e===`or`||e.endsWith(`.or`))return`${e}${t}`;let[n,...r]=t.split(`.`),i;return i=n?.startsWith(`fts`)?`textSearch`:n?.startsWith(`plfts`)?`textSearch[plain]`:n?.startsWith(`phfts`)?`textSearch[phrase]`:n?.startsWith(`wfts`)?`textSearch[websearch]`:n&&dh[n]||`filter`,`${i}(${e}, ${r.join(`.`)})`}function bh(e,t=!1){return new Proxy(e,{apply(n,r,i){return z({name:`auth ${t?`(admin) `:``}${e.name}`,attributes:{[I]:`auto.db.supabase`,[F]:`db`,"db.system":`postgresql`,"db.operation":`auth.${t?`admin.`:``}${e.name}`}},e=>Reflect.apply(n,r,i).then(t=>(j(t)&&`error`in t&&t.error?(e.setStatus({code:2}),H(t.error,{mechanism:{handled:!1,type:`auto.db.supabase.auth`}})):e.setStatus({code:1}),e.end(),t)).catch(t=>{throw e.setStatus({code:2}),e.end(),H(t,{mechanism:{handled:!1,type:`auto.db.supabase.auth`}}),t}).then(...i))}})}function xh(e){let t=e.auth;if(t&&!mh(e.auth)){for(let n of lh){let r=t[n];r&&typeof e.auth[n]==`function`&&(e.auth[n]=bh(r))}for(let n of uh){let r=t.admin[n];r&&typeof e.auth.admin[n]==`function`&&(e.auth.admin[n]=bh(r,!0))}ph(e.auth)}}function Sh(e,t){mh(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(e,n,r){let i=Reflect.apply(e,n,r),a=i.constructor;return wh(a,t),i}}),ph(e.prototype.from))}function Ch(e,t){mh(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(e,n,r){let i=fh,a=n,o=vh(a.method,a.headers);if(!i.includes(o)||!a?.url?.pathname||typeof a.url.pathname!=`string`)return Reflect.apply(e,n,r);let s=a.url.pathname.split(`/`),c=s.length>0?s[s.length-1]:``,l=[];for(let[e,t]of a.url.searchParams.entries())l.push(yh(e,t));let u=Object.create(null);if(Ln(a.body))for(let[e,t]of Object.entries(a.body))u[e]=t;let d=P(),f=t.sendOperationData??d?.getDataCollectionOptions().databaseQueryData===!0,p=hh(a.body,u),m=o===`select`?``:`${o}${gh(a.body,u)?`(...) `:``}`,h=f?l.join(` `):l.length>0?`[redacted]`:``,g=[m.trimEnd(),h].filter(Boolean).join(` `),_=g?`${g} from(${c})`:`from(${c})`,v={"db.table":c,"db.schema":a.schema,"db.url":a.url.origin,"db.sdk":_h(a.headers,`X-Client-Info`),"db.system":`postgresql`,"db.operation":o,[I]:`auto.db.supabase`,[F]:`db`};return l.length&&f&&(v[`db.query`]=l),p!==void 0&&f&&(v[`db.body`]=p),z({name:_,attributes:v},t=>Reflect.apply(e,n,[]).then(e=>{if(t&&(e&&typeof e==`object`&&`status`in e&&Ui(t,e.status||500),t.end()),e?.error){let t=Error(e.error.message);e.error.code&&(t.code=e.error.code),e.error.details&&(t.details=e.error.details);let n={};l.length&&f&&(n.query=l),p!==void 0&&f&&(n.body=p),H(t,e=>(e.addEventProcessor(e=>(Dr(e,{handled:!1,type:`auto.db.supabase.postgres`}),e)),e.setContext(`supabase`,n),e))}let n={type:`supabase`,category:`db.${o}`,message:_},r={};return l.length&&f&&(r.query=l),p!==void 0&&f&&(r.body=p),Object.keys(r).length&&(n.data=r),zp(n),e},e=>{throw t&&(Ui(t,500),t.end()),e}).then(...r))}}),ph(e.prototype.then))}function wh(e,t){for(let n of fh)mh(e.prototype[n])||(e.prototype[n]=new Proxy(e.prototype[n],{apply(e,r,i){let a=Reflect.apply(e,r,i),o=a.constructor;return D&&A.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),Ch(o,t),a}}),ph(e.prototype[n]))}var Th=(e,t={})=>{if(!e){D&&A.warn(`Supabase integration was not installed because no Supabase client was provided.`);return}Sh(e.constructor===Function?e:e.constructor,t),xh(e)},Eh=`Supabase`,Dh=((e,t)=>({setupOnce(){Th(e,t)},name:Eh})),Oh=W(e=>Dh(e.supabaseClient,{sendOperationData:e.sendOperationData})),kh=10,Ah=`ZodErrors`;function jh(e){return jn(e)&&e.name===`ZodError`&&Array.isArray(e.issues)}function Mh(e){return{...e,path:`path`in e&&Array.isArray(e.path)?e.path.join(`.`):void 0,keys:`keys`in e?JSON.stringify(e.keys):void 0,unionErrors:`unionErrors`in e?JSON.stringify(e.unionErrors):void 0}}function Nh(e){return e.map(e=>typeof e==`number`?`<array>`:e).join(`.`)}function Ph(e){let t=new Set;for(let n of e.issues){let e=Nh(n.path);e.length>0&&t.add(e)}let n=Array.from(t);if(n.length===0){let t=`variable`;if(e.issues.length>0){let n=e.issues[0];n!==void 0&&`expected`in n&&typeof n.expected==`string`&&(t=n.expected)}return`Failed to validate ${t}`}return`Failed to validate keys: ${hr(n.join(`, `),100)}`}function Fh(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!jh(r.originalException)||r.originalException.issues.length===0)return n;try{let i=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(Mh);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:`zod_issues.json`,data:JSON.stringify({issues:i})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:Ph(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":i.slice(0,e)}}}catch(e){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:`an exception was thrown while processing ZodError within applyZodErrorsToEvent()`,error:e instanceof Error?`${e.name}: ${e.message}
|
|
18
|
+
${e.stack}`:`unknown`}}}}}var Ih=W(((e={})=>{let t=e.limit??kh;return{name:Ah,processEvent(n,r){return Fh(t,e.saveZodIssuesAsAttachment,n,r)}}})),Lh=`Console`,Rh=W((e={})=>{let t=new Set(e.levels||tn);return{name:Lh,setup(n){let r=Mm(({args:e,level:r})=>{P()===n&&t.has(r)&&zh(r,e)});if(n.registerCleanup(r),e.filter){let t=Nm(e.filter);n.registerCleanup(t)}}}});function zh(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Im(e),message:Bh(t)};if(e===`assert`){if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Bh(e)}`:`Assertion failed`,n.data.arguments=e}else return}zp(n,{input:t,level:e})}function Bh(e){return`util`in O&&typeof O.util.format==`function`?O.util.format(...e):_r(e,` `)}var Vh=`flag.evaluation.`;function Hh(e){if(e.type)return e;let t=M().getScopeData().contexts.flags,n=t?t.values:[];return n.length?(e.contexts===void 0&&(e.contexts={}),e.contexts.flags={values:[...n]},e):e}function Uh(e,t,n=100){let r=M().getScopeData().contexts;r.flags||={values:[]};let i=r.flags.values;Wh(i,e,t,n)}function Wh(e,t,n,r){if(typeof n!=`boolean`)return;if(e.length>r){D&&A.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}let i=e.findIndex(e=>e.flag===t);i!==-1&&e.splice(i,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function Gh(e,t,n=10){if(typeof t!=`boolean`)return;let r=R();if(!r)return;let i=L(r).data;if(`${Vh}${e}`in i){r.setAttribute(`${Vh}${e}`,t);return}Object.keys(i).filter(e=>e.startsWith(Vh)).length<n&&r.setAttribute(`${Vh}${e}`,t)}var Kh=W(()=>({name:`FeatureFlags`,processEvent(e,t,n){return Hh(e)},addFeatureFlag(e,t){Uh(e,t),Gh(e,t)}})),qh=W(({growthbookClass:e})=>({name:`GrowthBook`,setupOnce(){let t=e.prototype;typeof t.isOn==`function`&&Hn(t,`isOn`,Jh),typeof t.getFeatureValue==`function`&&Hn(t,`getFeatureValue`,Jh)},processEvent(e,t,n){return Hh(e)}}));function Jh(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n==`string`&&typeof r==`boolean`&&(Uh(n,r),Gh(n,r)),r}}var Yh=`ConversationId`,Xh=W((()=>({name:Yh,setup(e){e.on(`spanStart`,e=>{let t=M().getScopeData(),n=N().getScopeData(),r=t.conversationId||n.conversationId;if(r){let{op:t,data:n,description:i}=L(e);if(!t?.startsWith(`gen_ai.`)&&!n[`ai.operationId`]&&!i?.startsWith(`ai.`))return;e.setAttribute(Vi,r)}})}})));function Zh(e){return!!e&&e._profiler!==void 0&&typeof e._profiler.start==`function`&&typeof e._profiler.stop==`function`}function Qh(){let e=P();if(!e){D&&A.warn(`No Sentry client available, profiling is not started`);return}let t=e.getIntegrationByName(`ProfilingIntegration`);if(!t){D&&A.warn(`ProfilingIntegration is not available`);return}if(!Zh(t)){D&&A.warn(`Profiler is not available on profiling integration.`);return}t._profiler.start()}function $h(){let e=P();if(!e){D&&A.warn(`No Sentry client available, profiling is not started`);return}let t=e.getIntegrationByName(`ProfilingIntegration`);if(!t){D&&A.warn(`ProfilingIntegration is not available`);return}if(!Zh(t)){D&&A.warn(`Profiler is not available on profiling integration.`);return}t._profiler.stop()}var eg={startProfiler:Qh,stopProfiler:$h};function tg(e,t={},n=M()){let{message:r,name:i,email:a,url:o,source:s,associatedEventId:c,tags:l}=e,u={contexts:{feedback:{contact_email:a,name:i,message:r,url:o,source:s,associated_event_id:c}},type:`feedback`,level:`info`,tags:l},d=n?.getClient()||P();return d&&d.emit(`beforeSendFeedback`,u,t),n.captureEvent(u,t)}function ng(e,t,n){return`util`in O&&typeof O.util.format==`function`?O.util.format(...e):rg(e,t,n)}function rg(e,t,n){return e.map(e=>In(e)?String(e):JSON.stringify(or(e,t,n))).join(` `)}function ig(e){return/%[sdifocO]/.test(e)}function ag(e,t){let n={};return n[`sentry.message.template`]=`${e} ${Array(t.length).fill(`{}`).join(` `)}`,t.forEach((e,t)=>{n[`sentry.message.parameter.${t}`]=e}),n}var og=`ConsoleLogs`,sg={[I]:`auto.log.console`},cg=W(((e={})=>{let t=e.levels||tn;return{name:og,setup(e){let{enableLogs:n,normalizeDepth:r=3,normalizeMaxBreadth:i=1e3}=e.getOptions();if(!n){D&&A.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let a=Mm(({args:n,level:a})=>{if(P()!==e||!t.includes(a))return;let o=n[0],s=n.slice(1);if(a===`assert`){o||Hd({level:`error`,message:s.length>0?`Assertion failed: ${ng(s,r,i)}`:`Assertion failed`,attributes:sg});return}let c=a===`log`,l={...sg};if(Ln(o)){Object.assign(l,or(o,r,i));let e=typeof n[1]==`string`?2:1;n.slice(e).forEach((e,t)=>{l[`sentry.message.parameter.${t}`]=or(e,r,i)})}else if(s.length>0&&typeof o==`string`&&!ig(o)){let e=ag(o,s);for(let[t,n]of Object.entries(e))l[t]=t.startsWith(`sentry.message.parameter.`)?or(n,r,i):n}Hd({level:c?`info`:a,message:ng(n,r,i),severityNumber:c?10:void 0,attributes:l})});e.registerCleanup(a)}}})),lg=t({count:()=>dg,distribution:()=>pg,gauge:()=>fg});function ug(e,t,n,r){tf({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function dg(e,t=1,n){ug(`counter`,e,t,n)}function fg(e,t,n){ug(`gauge`,e,t,n)}function pg(e,t,n){ug(`distribution`,e,t,n)}var mg=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function hg(e={}){let t=new Set(e.levels??mg),n=e.client;return{log(e){let{type:r,level:i,message:a,args:o,tag:s,date:c,...l}=e,u=n||P();if(!u)return;let d=vg(r,i);if(!t.has(d))return;let{normalizeDepth:f=3,normalizeMaxBreadth:p=1e3}=u.getOptions(),m={};for(let[e,t]of Object.entries(l))m[e]=or(t,f,p);m[`sentry.origin`]=`auto.log.consola`,s&&(m[`consola.tag`]=s),r&&(m[`consola.type`]=r),i!=null&&typeof i==`number`&&(m[`consola.level`]=i);let h=bg(yg(o,f,p),f,p);h?.attributes&&Object.assign(m,h.attributes),Hd({level:d,message:h?.message||a||o&&ng(o,f,p)||``,attributes:m})}}}var gg={silent:`trace`,fatal:`fatal`,error:`error`,warn:`warn`,log:`info`,info:`info`,success:`info`,fail:`error`,ready:`info`,start:`info`,box:`info`,debug:`debug`,trace:`trace`,verbose:`debug`,critical:`fatal`,notice:`info`},_g={0:`fatal`,1:`warn`,2:`info`,3:`info`,4:`debug`,5:`trace`};function vg(e,t){if(e===`verbose`)return`debug`;if(e===`silent`)return`trace`;if(e){let t=gg[e];if(t)return t}if(typeof t==`number`){let e=_g[t];if(e)return e}return`info`}function yg(e,t,n){if(!e?.length)return{message:``};let r=ng(e,t,n),i=e[0];if(Ln(i)){let t=typeof e[1]==`string`?2:1;return{message:r,attributes:i,messageParameters:e.slice(t)}}{let t=e.slice(1),n=t.length>0&&typeof i==`string`&&!ig(i);return{message:r,messageTemplate:n?i:void 0,messageParameters:n?t:void 0}}}function bg(e,t,n){let{message:r,attributes:i,messageTemplate:a,messageParameters:o}=e,s={};if(a&&o){let e=ag(a,o);for(let[r,i]of Object.entries(e))s[r]=r.startsWith(`sentry.message.parameter.`)?or(i,t,n):i}else o&&o.length>0&&o.forEach((e,r)=>{s[`sentry.message.parameter.${r}`]=or(e,t,n)});return{message:r,attributes:{...or(i,t,n),...s}}}var xg=`gen_ai.prompt`,Sg=`gen_ai.system`,Cg=`gen_ai.request.model`,wg=`gen_ai.request.stream`,Tg=`gen_ai.request.temperature`,Eg=`gen_ai.request.max_tokens`,Dg=`gen_ai.request.frequency_penalty`,Og=`gen_ai.request.presence_penalty`,kg=`gen_ai.request.top_p`,Ag=`gen_ai.request.top_k`,jg=`gen_ai.request.encoding_format`,Mg=`gen_ai.request.dimensions`,Ng=`gen_ai.response.finish_reasons`,Pg=`gen_ai.response.model`,Fg=`gen_ai.response.id`,Ig=`gen_ai.response.stop_reason`,Lg=`gen_ai.usage.input_tokens`,Rg=`gen_ai.usage.output_tokens`,zg=`gen_ai.usage.total_tokens`,Bg=`gen_ai.operation.name`,Vg=`sentry.sdk_meta.gen_ai.input.messages.original_length`,Hg=`gen_ai.input.messages`,Ug=`gen_ai.output.messages`,Wg=`gen_ai.system_instructions`,Gg=`gen_ai.response.text`,Kg=`gen_ai.request.available_tools`,qg=`gen_ai.response.streaming`,Jg=`gen_ai.response.tool_calls`,Yg=`gen_ai.agent.name`,Xg=`gen_ai.pipeline.name`,Zg=`gen_ai.conversation.id`,Qg=`gen_ai.usage.cache_creation_input_tokens`,$g=`gen_ai.usage.cache_read_input_tokens`,e_=`gen_ai.usage.input_tokens.cache_write`,t_=`gen_ai.usage.input_tokens.cached`,n_=`gen_ai.invoke_agent`,r_=`gen_ai.embeddings.input`,i_=`gen_ai.embeddings`,a_=`gen_ai.execute_tool`,o_=`gen_ai.tool.name`,s_=`gen_ai.tool.call.id`,c_=`gen_ai.tool.type`,l_=`gen_ai.tool.input`,u_=`gen_ai.tool.output`,d_=`gen_ai.tool.description`;function f_(e){return!e||typeof e!=`object`?!1:h_(e)||g_(e)||p_(e)||__(e)||v_(e)||y_(e)||b_(e)||x_(e)||S_(e)||C_(e)||w_(e)||T_(e)}function p_(e){return`image_url`in e?typeof e.image_url==`string`?e.image_url.startsWith(`data:`):m_(e):!1}function m_(e){return`image_url`in e&&!!e.image_url&&typeof e.image_url==`object`&&`url`in e.image_url&&typeof e.image_url.url==`string`&&e.image_url.url.startsWith(`data:`)}function h_(e){return`type`in e&&typeof e.type==`string`&&`source`in e&&f_(e.source)}function g_(e){return`inlineData`in e&&!!e.inlineData&&typeof e.inlineData==`object`&&`data`in e.inlineData&&typeof e.inlineData.data==`string`}function __(e){return`type`in e&&e.type===`input_audio`&&`input_audio`in e&&!!e.input_audio&&typeof e.input_audio==`object`&&`data`in e.input_audio&&typeof e.input_audio.data==`string`}function v_(e){return`type`in e&&e.type===`file`&&`file`in e&&!!e.file&&typeof e.file==`object`&&`file_data`in e.file&&typeof e.file.file_data==`string`}function y_(e){return`media_type`in e&&typeof e.media_type==`string`&&`data`in e}function b_(e){return`type`in e&&e.type===`file`&&`mediaType`in e&&typeof e.mediaType==`string`&&`data`in e&&typeof e.data==`string`&&!e.data.startsWith(`http://`)&&!e.data.startsWith(`https://`)}function x_(e){return`type`in e&&e.type===`image`&&`image`in e&&typeof e.image==`string`&&!e.image.startsWith(`http://`)&&!e.image.startsWith(`https://`)}function S_(e){return`type`in e&&(e.type===`blob`||e.type===`base64`)}function C_(e){return`b64_json`in e}function w_(e){return`type`in e&&`result`in e&&e.type===`image_generation`}function T_(e){return`uri`in e&&typeof e.uri==`string`&&e.uri.startsWith(`data:`)}var E_=`[Blob substitute]`,D_=[`image_url`,`data`,`content`,`b64_json`,`result`,`uri`,`image`];function O_(e){let t={...e};f_(t.source)&&(t.source=O_(t.source)),g_(e)&&(t.inlineData={...e.inlineData,data:E_}),m_(e)&&(t.image_url={...e.image_url,url:E_}),__(e)&&(t.input_audio={...e.input_audio,data:E_}),v_(e)&&(t.file={...e.file,file_data:E_});for(let e of D_)typeof t[e]==`string`&&(t[e]=E_);return t}var k_=2e4,A_=e=>new TextEncoder().encode(e).length,j_=e=>A_(JSON.stringify(e));function M_(e,t){if(A_(e)<=t)return e;let n=0,r=e.length,i=``;for(;n<=r;){let a=Math.floor((n+r)/2),o=e.slice(0,a);A_(o)<=t?(i=o,n=a+1):r=a-1}return i}function N_(e){return typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``}function P_(e,t){return typeof e==`string`?t:{...e,text:t}}function F_(e){return typeof e==`object`&&!!e&&`content`in e&&typeof e.content==`string`}function I_(e){return typeof e==`object`&&!!e&&`content`in e&&Array.isArray(e.content)}function L_(e){return typeof e==`object`&&!!e&&`parts`in e&&Array.isArray(e.parts)&&e.parts.length>0}function R_(e,t){let n=t-j_({...e,content:``});if(n<=0)return[];let r=M_(e.content,n);return[{...e,content:r}]}function z_(e){return`parts`in e&&Array.isArray(e.parts)?{key:`parts`,items:e.parts}:`content`in e&&Array.isArray(e.content)?{key:`content`,items:e.content}:{key:null,items:[]}}function B_(e,t){let{key:n,items:r}=z_(e);if(n===null||r.length===0)return[];let i=r.map(e=>P_(e,``)),a=t-j_({...e,[n]:i});if(a<=0)return[];let o=[];for(let e of r){let t=N_(e),n=A_(t);if(n<=a)o.push(e),a-=n;else if(o.length===0){let n=M_(t,a);n&&o.push(P_(e,n));break}else break}return o.length<=0?[]:[{...e,[n]:o}]}function V_(e,t){if(!e)return[];if(typeof e==`string`){let n=M_(e,t);return n?[n]:[]}return typeof e==`object`?F_(e)?R_(e,t):I_(e)||L_(e)?B_(e,t):[]:[]}function H_(e){return e.map(e=>{let t;return e&&typeof e==`object`&&(I_(e)?t={...e,content:H_(e.content)}:`content`in e&&f_(e.content)&&(t={...e,content:O_(e.content)}),L_(e)&&(t={...t??e,parts:H_(e.parts)}),f_(t)?t=O_(t):f_(e)&&(t=O_(e))),t??e})}function U_(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],i=H_([r]),a=i[0];return j_(a)<=n?i:V_(a,n)}function W_(e){return U_(e,k_)}function G_(e){return M_(e,k_)}function K_(e){let t=P()?.getDataCollectionOptions().genAI;return{...e,recordInputs:e?.recordInputs??t?.inputs??!1,recordOutputs:e?.recordOutputs??t?.outputs??!1}}function q_(e){if(e!==void 0)return e;let t=P();return!t||!Wo(t)&&t.getOptions().streamGenAiSpans===!1}function J_(e,t){return e?`${e}.${t}`:t}function Y_(e,t,n,r,i){if(t!==void 0&&e.setAttributes({[Lg]:t}),n!==void 0&&e.setAttributes({[Rg]:n}),t!==void 0||n!==void 0||r!==void 0||i!==void 0){let a=(t??0)+(n??0)+(r??0)+(i??0);e.setAttributes({[zg]:a})}}function X_(e,t,n){if(!e.isRecording())return;let r={[qg]:!0};t.responseId&&(r[Fg]=t.responseId),t.responseModel&&(r[Pg]=t.responseModel),t.promptTokens!==void 0&&(r[Lg]=t.promptTokens),t.completionTokens!==void 0&&(r[Rg]=t.completionTokens),t.totalTokens===void 0?(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[zg]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)):r[zg]=t.totalTokens,t.finishReasons.length&&(r[Ng]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[Gg]=t.responseTexts.join(``)),n&&t.toolCalls.length&&(r[Jg]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function Z_(e){if(typeof e==`string`)return G_(e);try{return JSON.stringify(Array.isArray(e)?W_(e):e)}catch{return`[unserializable]`}}function Q_(e){if(!Array.isArray(e))return{systemInstructions:void 0,filteredMessages:e};let t=e.findIndex(e=>e&&typeof e==`object`&&`role`in e&&e.role===`system`);if(t===-1)return{systemInstructions:void 0,filteredMessages:e};let n=e[t],r=typeof n.content==`string`?n.content:n.content===void 0?void 0:JSON.stringify(n.content);return r?{systemInstructions:JSON.stringify([{type:`text`,content:r}]),filteredMessages:[...e.slice(0,t),...e.slice(t+1)]}:{systemInstructions:void 0,filteredMessages:e}}async function $_(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r==`object`&&`data`in r?{...r,data:n}:n}function ev(e,t){return Bn(e)?new Proxy(e,{get(e,n){let r=n in Promise.prototype||n===Symbol.toStringTag?t:e,i=Reflect.get(r,n);return n===`withResponse`&&typeof i==`function`?function(){return $_(i.call(e),t)}:typeof i==`function`?i.bind(r):i}}):t}var tv=`WorkersAI`,nv=new Map,rv=new Map,iv=new Map([[`ai.generateText`,`invoke_agent`],[`ai.streamText`,`invoke_agent`],[`ai.generateObject`,`invoke_agent`],[`ai.streamObject`,`invoke_agent`],[`ai.generateText.doGenerate`,`generate_content`],[`ai.streamText.doStream`,`generate_content`],[`ai.generateObject.doGenerate`,`generate_content`],[`ai.streamObject.doStream`,`generate_content`],[`ai.embed.doEmbed`,`embeddings`],[`ai.embedMany.doEmbed`,`embeddings`],[`ai.rerank.doRerank`,`rerank`],[`ai.toolCall`,`execute_tool`]]),av=`operation.name`,ov=`ai.operationId`,sv=`ai.prompt`,cv=`ai.schema`,lv=`ai.response.object`,uv=`ai.values`,dv=`ai.response.text`,fv=`ai.response.toolCalls`,pv=`ai.response.finishReason`,mv=`ai.prompt.messages`,hv=`ai.prompt.tools`,gv=`ai.model.id`,_v=`ai.response.providerMetadata`,vv=`ai.usage.cachedInputTokens`,yv=`ai.telemetry.functionId`,bv=`ai.usage.completionTokens`,xv=`ai.usage.promptTokens`,Sv=`ai.usage.tokens`,Cv=`ai.toolCall.name`,wv=`ai.toolCall.id`,Tv=`ai.toolCall.args`,Ev=`ai.toolCall.result`;function Dv(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[Lg],i=e.data[Rg];if(typeof r==`number`||typeof i==`number`){let e=t.get(n)||{inputTokens:0,outputTokens:0};typeof r==`number`&&(e.inputTokens+=r),typeof i==`number`&&(e.outputTokens+=i),t.set(n,e)}}function Ov(e,t){let n=t.get(e.span_id);n&&e.data&&(n.inputTokens>0&&(e.data[Lg]=n.inputTokens),n.outputTokens>0&&(e.data[Rg]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(e.data[`gen_ai.usage.total_tokens`]=n.inputTokens+n.outputTokens))}function kv(e){let t=new Map;for(let n of e){let e=n.data[Kg];if(typeof e==`string`)try{let n=JSON.parse(e);for(let e of n)e.name&&e.description&&!t.has(e.name)&&t.set(e.name,e.description)}catch{}}return t}function Av(e,t){let n=kv(e);for(let r of e){if(r.op===`gen_ai.execute_tool`){let e=r.data[o_];if(typeof e==`string`){let t=n.get(e);t&&(r.data[d_]=t)}}r.op===`gen_ai.invoke_agent`&&Ov(r,t)}}function jv(e){return nv.get(e)}function Mv(e){nv.delete(e)}function Nv(e){let t=e.map(e=>{if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e});return JSON.stringify(t)}function Pv(e){return e.filter(e=>!!e&&typeof e==`object`&&`role`in e&&`content`in e)}function Fv(e){try{let t=JSON.parse(e);if(t&&typeof t==`object`){let{messages:e}=t,{prompt:n,system:r}=t,i=[];if(typeof r==`string`&&i.push({role:`system`,content:r}),typeof e==`string`)try{e=JSON.parse(e)}catch{}if(Array.isArray(e))return i.push(...Pv(e)),i;if(Array.isArray(n))return i.push(...Pv(n)),i;if(typeof n==`string`&&i.push({role:`user`,content:n}),i.length>0)return i}}catch{}return[]}function Iv(e,t,n){if(typeof t[`ai.prompt`]==`string`&&!t[`gen_ai.input.messages`]&&!t[`ai.prompt.messages`]){let r=t[sv],i=Fv(r);if(i.length){let{systemInstructions:t,filteredMessages:r}=Q_(i);t&&e.setAttribute(Wg,t);let a=Array.isArray(r)?r.length:0,o=n?Z_(r):mr(r);e.setAttributes({[sv]:o,[Hg]:o,[Vg]:a})}}else if(typeof t[`ai.prompt.messages`]==`string`){let r=t[mv];try{let t=JSON.parse(r);if(Array.isArray(t)){let{systemInstructions:i,filteredMessages:a}=Q_(t);i&&e.setAttribute(Wg,i);let o=Array.isArray(a)?a.length:0,s=!n&&a===t?r:n?Z_(a):mr(a);e.setAttributes({[mv]:s,[Hg]:s,[Vg]:o})}}catch{}}}function Lv(e){let{data:t,description:n}=L(e);if(!n)return;if(t[`ai.toolCall.name`]&&t[`ai.toolCall.id`]&&n===`ai.toolCall`){Gv(e,t);return}if(!t[`ai.operationId`]&&!n.startsWith(`ai.`))return;iv.get(n)===`generate_content`&&Yf([tv]);let r=P()?.getIntegrationByName(`VercelAI`);Kv(e,n,t,q_(r?.options?.enableTruncation))}function Rv(e){if(e.type===`transaction`&&e.spans){let t=new Map;for(let n of e.spans)Hv(n),Dv(n,t);Av(e.spans,t);let n=e.contexts?.trace;n?.op===`gen_ai.invoke_agent`&&Ov(n,t)}return e}function zv(e){if(typeof e!=`string`)return`stop`;switch(e){case`tool-calls`:return`tool_call`;case`stop`:case`length`:case`content_filter`:case`error`:return e;default:return e}}function Bv(e){let t=e[dv],n=e[fv],r=e[pv];if(t==null&&n==null)return;let i=[];if(typeof t==`string`&&t.length>0&&i.push({type:`text`,content:t}),n!=null)try{let t=typeof n==`string`?JSON.parse(n):n;if(Array.isArray(t)){for(let e of t){let t=e.input??e.args;i.push({type:`tool_call`,id:e.toolCallId,name:e.toolName,arguments:typeof t==`string`?t:JSON.stringify(t??{})})}delete e[fv]}}catch{}if(i.length>0){let t={role:`assistant`,parts:i,finish_reason:zv(r)};e[Ug]=JSON.stringify([t]),delete e[dv]}}function Vv(e){if(Wv(e,bv,Rg),Wv(e,xv,Lg),Wv(e,vv,t_),Wv(e,`ai.usage.inputTokens`,Lg),Wv(e,`ai.usage.outputTokens`,Rg),Wv(e,Sv,Lg),Wv(e,`ai.response.avgOutputTokensPerSecond`,`ai.response.avgCompletionTokensPerSecond`),!Object.keys(e).some(e=>e.startsWith(`ai.usage.inputTokenDetails.`))&&typeof e[`gen_ai.usage.input_tokens`]==`number`&&typeof e[`gen_ai.usage.input_tokens.cached`]==`number`&&(e[Lg]=e[Lg]+e[t_]),typeof e[`gen_ai.usage.input_tokens`]==`number`&&(e[zg]=(typeof e[`gen_ai.usage.output_tokens`]==`number`?e[Rg]:0)+e[Lg]),e[`ai.prompt.tools`]&&Array.isArray(e[`ai.prompt.tools`])&&(e[hv]=Nv(e[hv])),e[`operation.name`]){let t=e[`ai.operationId`]?e[ov]:e[av];e[Bg]=iv.get(t)??t,delete e[av]}if(Wv(e,mv,Hg),Bv(e),Wv(e,lv,`gen_ai.response.object`),Wv(e,hv,`gen_ai.request.available_tools`),Wv(e,Tv,l_),Wv(e,Ev,u_),Wv(e,cv,`gen_ai.request.schema`),Wv(e,gv,Cg),Array.isArray(e[`ai.values`])){let t=e[uv].map(e=>{try{return JSON.parse(e)}catch{return e}});e[r_]=t.length===1?t[0]:JSON.stringify(t)}Zv(e);for(let t of Object.keys(e))Array.isArray(e[t])&&(e[t]=JSON.stringify(e[t])),t.startsWith(`ai.`)&&Wv(e,t,`vercel.${t}`)}function Hv(e){let{data:t,origin:n}=e;n===`auto.vercelai.otel`&&(e.status&&e.status!==`ok`&&(e.status=`internal_error`),Vv(t))}function Uv(e){let t=e.attributes;if(t?.[`sentry.origin`]===`auto.vercelai.otel`){if(Vv(t),t[`sentry.op`]===`gen_ai.execute_tool`&&e.parent_span_id){let n=rv.get(e.parent_span_id);if(n){let e=t[o_];if(typeof e==`string`){let r=n.get(e);r&&(t[d_]=r)}}}rv.delete(e.span_id)}}function Wv(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function Gv(e,t){e.setAttribute(I,`auto.vercelai.otel`),e.setAttribute(F,`gen_ai.execute_tool`),e.setAttribute(Bg,`execute_tool`),Wv(t,Cv,o_),Wv(t,wv,s_);let n=t[s_];typeof n==`string`&&nv.set(n,e.spanContext()),t[`gen_ai.tool.type`]||e.setAttribute(c_,`function`);let r=t[o_];r&&e.updateName(`execute_tool ${r}`)}function Kv(e,t,n,r){e.setAttribute(I,`auto.vercelai.otel`);let i=t.replace(`ai.`,``);e.setAttribute(`ai.pipeline.name`,i),e.updateName(i);let a=n[yv];a&&typeof a==`string`&&e.setAttribute(`gen_ai.function_id`,a),Iv(e,n,r),n[`ai.model.id`]&&!n[`gen_ai.response.model`]&&e.setAttribute(Pg,n[gv]),e.setAttribute(`ai.streaming`,t.includes(`stream`));let o=iv.get(t);if(o?e.setAttribute(F,`gen_ai.${o}`):t.startsWith(`ai.stream`)&&e.setAttribute(F,`ai.run`),o===`invoke_agent`){a&&typeof a==`string`?e.updateName(`invoke_agent ${a}`):e.updateName(`invoke_agent`);return}let s=n[gv];s&&o&&e.updateName(`${o} ${s}`);let c=P();if(c&&Wo(c)&&n[`ai.prompt.tools`]&&Array.isArray(n[`ai.prompt.tools`])){let t=new Map;for(let e of n[hv])try{let n=typeof e==`string`?JSON.parse(e):e;n?.name&&n?.description&&t.set(n.name,n.description)}catch{}if(t.size>0){let n=L(e).parent_span_id;n&&rv.set(n,t)}}}var qv=new WeakSet;function Jv(e){qv.has(e)||(qv.add(e),e.on(`spanStart`,Lv),e.addEventProcessor(Object.assign(Rv,{id:`VercelAiEventProcessor`})),e.on(`processSpan`,e=>{Uv(e)}))}function Yv(e){let t={};if(!e||typeof e!=`object`)return t;let n=e,r=n.openai??n.azure;r&&(Qv(t,t_,r.cachedPromptTokens),Qv(t,`gen_ai.usage.output_tokens.reasoning`,r.reasoningTokens),Qv(t,`gen_ai.usage.output_tokens.prediction_accepted`,r.acceptedPredictionTokens),Qv(t,`gen_ai.usage.output_tokens.prediction_rejected`,r.rejectedPredictionTokens),Qv(t,Zg,r.responseId)),n.anthropic&&(Qv(t,t_,n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens),Qv(t,e_,n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens)),n.bedrock?.usage&&(Qv(t,t_,n.bedrock.usage.cacheReadInputTokens),Qv(t,e_,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(Qv(t,t_,n.deepseek.promptCacheHitTokens),Qv(t,`gen_ai.usage.input_tokens.cache_miss`,n.deepseek.promptCacheMissTokens));let i=(n.google??n.vertex)?.usageMetadata;return i&&typeof i.thoughtsTokenCount==`number`&&i.thoughtsTokenCount>0&&(t[Rg]=(i.candidatesTokenCount??0)+i.thoughtsTokenCount,Qv(t,zg,i.totalTokenCount),Qv(t,`gen_ai.usage.reasoning.output_tokens`,i.thoughtsTokenCount)),t}var Xv=new Set([Rg,zg,`gen_ai.usage.reasoning.output_tokens`]);function Zv(e){let t=e[_v];if(!t)return;let n=e[Bg]===`invoke_agent`;try{let r=Yv(JSON.parse(t));for(let[t,i]of Object.entries(r))t===`gen_ai.conversation.id`&&e[t]||n&&Xv.has(t)||(e[t]=i)}catch{}}function Qv(e,t,n){n!=null&&(e[t]=n)}var $v=`OpenAI`,ey={"responses.create":{operation:`chat`},"chat.completions.create":{operation:`chat`},"embeddings.create":{operation:`embeddings`},"conversations.create":{operation:`chat`}},ty=[`response.created`,`response.in_progress`,`response.failed`,`response.completed`,`response.incomplete`,`response.queued`,`response.output_text.delta`,`response.output_item.added`,`response.function_call_arguments.delta`,`response.function_call_arguments.done`,`response.output_item.done`];function ny(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&e.type.startsWith(`response.`)}function ry(e){return typeof e==`object`&&!!e&&`object`in e&&e.object===`chat.completion.chunk`}function iy(e,t,n){if(!t||typeof t!=`object`)return;let r=t,i={};if(typeof r.id==`string`&&(i[Fg]=r.id),typeof r.model==`string`&&(i[Pg]=r.model),r.object===`conversation`&&typeof r.id==`string`&&(i[Zg]=r.id),r.usage&&typeof r.usage==`object`){let e=r.usage,t=e.prompt_tokens??e.input_tokens;typeof t==`number`&&(i[Lg]=t);let n=e.completion_tokens??e.output_tokens;typeof n==`number`&&(i[Rg]=n),typeof e.total_tokens==`number`&&(i[zg]=e.total_tokens)}if(Array.isArray(r.choices)){let e=r.choices,t=e.map(e=>e.finish_reason).filter(e=>typeof e==`string`);if(t.length>0&&(i[Ng]=JSON.stringify(t)),n){let t=e.map(e=>e.message?.content||``);i[Gg]=JSON.stringify(t);let n=e.map(e=>e.message?.tool_calls).filter(e=>Array.isArray(e)&&e.length>0).flat();n.length>0&&(i[Jg]=JSON.stringify(n))}}if(typeof r.status==`string`&&(i[`gen_ai.response.finish_reasons`]||(i[Ng]=JSON.stringify([r.status]))),n&&(typeof r.output_text==`string`&&!i[`gen_ai.response.text`]&&(i[Gg]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!i[`gen_ai.response.tool_calls`])){let e=r.output.filter(e=>e?.type===`function_call`);e.length>0&&(i[Jg]=JSON.stringify(e))}e.setAttributes(i)}function ay(e){if(`conversation`in e&&typeof e.conversation==`string`)return e.conversation;if(`previous_response_id`in e&&typeof e.previous_response_id==`string`)return e.previous_response_id}function oy(e){let t={[Cg]:e.model??`unknown`};`temperature`in e&&(t[Tg]=e.temperature),`top_p`in e&&(t[kg]=e.top_p),`frequency_penalty`in e&&(t[Dg]=e.frequency_penalty),`presence_penalty`in e&&(t[Og]=e.presence_penalty),`stream`in e&&(t[wg]=e.stream),`encoding_format`in e&&(t[jg]=e.encoding_format),`dimensions`in e&&(t[Mg]=e.dimensions);let n=ay(e);return n&&(t[Zg]=n),t}function sy(e,t){for(let n of e){let e=n.index;if(e!==void 0&&n.function){if(!(e in t.chatCompletionToolCalls))t.chatCompletionToolCalls[e]={...n,function:{name:n.function.name,arguments:n.function.arguments||``}};else{let r=t.chatCompletionToolCalls[e];n.function.arguments&&r?.function&&(r.function.arguments+=n.function.arguments)}}}}function cy(e,t,n){t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,e.usage&&(t.promptTokens=e.usage.prompt_tokens,t.completionTokens=e.usage.completion_tokens,t.totalTokens=e.usage.total_tokens);for(let r of e.choices??[])n&&(r.delta?.content&&t.responseTexts.push(r.delta.content),r.delta?.tool_calls&&sy(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function ly(e,t,n,r){if(!(e&&typeof e==`object`)){t.eventTypes.push(`unknown:non-object`);return}if(e instanceof Error){r.setStatus({code:2,message:`internal_error`}),H(e,{mechanism:{handled:!1,type:`auto.ai.openai.stream-response`}});return}if(!(`type`in e))return;let i=e;if(!ty.includes(i.type)){t.eventTypes.push(i.type);return}if(n&&(i.type===`response.output_item.done`&&`item`in i&&t.responsesApiToolCalls.push(i.item),i.type===`response.output_text.delta`&&`delta`in i&&i.delta)){t.responseTexts.push(i.delta);return}if(`response`in i){let{response:e}=i;t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,e.usage&&(t.promptTokens=e.usage.input_tokens,t.completionTokens=e.usage.output_tokens,t.totalTokens=e.usage.total_tokens),e.status&&t.finishReasons.push(e.status),n&&e.output_text&&t.responseTexts.push(e.output_text)}}async function*uy(e,t,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:``,responseModel:``,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let i of e)ry(i)?cy(i,r,n):ny(i)&&ly(i,r,n,t),yield i}finally{let e=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];X_(t,{...r,toolCalls:e},n)}}function dy(e){let t=Array.isArray(e.tools)?e.tools:[],n=e.web_search_options&&typeof e.web_search_options==`object`?[{type:`web_search_options`,...e.web_search_options}]:[],r=[...t,...n];if(r.length!==0)try{return JSON.stringify(r)}catch(e){D&&A.error(`Failed to serialize OpenAI tools:`,e);return}}function fy(e,t){let n={[Sg]:`openai`,[Bg]:t,[I]:`auto.ai.openai`};if(e.length>0&&typeof e[0]==`object`&&e[0]!==null){let t=e[0],r=dy(t);r&&(n[Kg]=r),Object.assign(n,oy(t))}else n[Cg]=`unknown`;return n}function py(e,t,n,r){if(n===`embeddings`&&`input`in t){let n=t.input;if(n==null||typeof n==`string`&&n.length===0||Array.isArray(n)&&n.length===0)return;e.setAttribute(r_,typeof n==`string`?n:JSON.stringify(n));return}let i=`input`in t?t.input:`messages`in t?t.messages:void 0;if(!i||Array.isArray(i)&&i.length===0)return;let{systemInstructions:a,filteredMessages:o}=Q_(i);a&&e.setAttribute(Wg,a),e.setAttribute(Hg,r?Z_(o):mr(o)),Array.isArray(o)?e.setAttribute(Vg,o.length):e.setAttribute(Vg,1)}function my(e,t,n,r,i){return function(...t){let a=n.operation||`unknown`,o=fy(t,a),s=o[`gen_ai.request.model`]||`unknown`,c=t[0],l=c&&typeof c==`object`&&c.stream===!0,u={name:`${a} ${s}`,op:`gen_ai.${a}`,attributes:o};if(l){let n,o=ts(u,o=>(n=e.apply(r,t),i.recordInputs&&c&&py(o,c,a,q_(i.enableTruncation)),(async()=>{try{return uy(await n,o,i.recordOutputs??!1)}catch(e){throw o.setStatus({code:2,message:`internal_error`}),o.end(),e}})()));return ev(n,o)}let d,f=z(u,n=>(d=e.apply(r,t),i.recordInputs&&c&&py(n,c,a,q_(i.enableTruncation)),d.then(e=>(iy(n,e,i.recordOutputs),e))));return ev(d,f)}}function hy(e,t=``,n){return new Proxy(e,{get(e,r){let i=e[r],a=J_(t,String(r)),o=ey[a];return typeof i==`function`&&o?my(i,a,o,e,n):typeof i==`function`?i.bind(e):i&&typeof i==`object`?hy(i,a,n):i}})}function gy(e,t){return hy(e,``,K_(t))}var _y=`Anthropic_AI`,vy={"messages.create":{operation:`chat`},"messages.stream":{operation:`chat`,streaming:!0},"messages.countTokens":{operation:`chat`},"models.get":{operation:`models`},"completions.create":{operation:`chat`},"models.retrieve":{operation:`models`},"beta.messages.create":{operation:`chat`}};function yy(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:i}=Q_(t);r&&e.setAttributes({[Wg]:r});let a=Array.isArray(i)?i.length:1;e.setAttributes({[Hg]:n?Z_(i):mr(i),[Vg]:a})}var by={invalid_request_error:`invalid_argument`,authentication_error:`unauthenticated`,permission_error:`permission_denied`,not_found_error:`not_found`,request_too_large:`failed_precondition`,rate_limit_error:`resource_exhausted`,api_error:`internal_error`,overloaded_error:`unavailable`};function xy(e){return e&&by[e]||`internal_error`}function Sy(e,t){t.error&&(e.setStatus({code:2,message:xy(t.error.type)}),H(t.error,{mechanism:{handled:!1,type:`auto.ai.anthropic.anthropic_error`}}))}function Cy(e){let{system:t,messages:n,input:r}=e,i=typeof t==`string`?[{role:`system`,content:e.system}]:[],a=(Array.isArray(r)?r:r==null?void 0:[r])??(Array.isArray(n)?n:n==null?[]:[n]);return[...i,...a]}function wy(e,t){return`type`in e&&typeof e.type==`string`&&e.type===`error`&&(t.setStatus({code:2,message:xy(e.error?.type)}),!0)}function Ty(e,t){if(e.type===`message_delta`&&(e.usage&&typeof e.usage.output_tokens==`number`&&(t.completionTokens=e.usage.output_tokens),e.delta?.stop_reason&&t.finishReasons.push(e.delta.stop_reason)),e.message){let n=e.message;n.id&&(t.responseId=n.id),n.model&&(t.responseModel=n.model),n.usage&&(typeof n.usage.input_tokens==`number`&&(t.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens==`number`&&(t.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens==`number`&&(t.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function Ey(e,t){e.type===`content_block_start`&&typeof e.index==`number`&&e.content_block&&(e.content_block.type===`tool_use`||e.content_block.type===`server_tool_use`)&&(t.activeToolBlocks[e.index]={id:e.content_block.id,name:e.content_block.name,inputJsonParts:[]})}function Dy(e,t,n){if(e.type===`content_block_delta`&&e.delta){if(typeof e.index==`number`&&`partial_json`in e.delta&&typeof e.delta.partial_json==`string`){let n=t.activeToolBlocks[e.index];n&&n.inputJsonParts.push(e.delta.partial_json)}n&&typeof e.delta.text==`string`&&t.responseTexts.push(e.delta.text)}}function Oy(e,t){if(e.type!==`content_block_stop`||typeof e.index!=`number`)return;let n=t.activeToolBlocks[e.index];if(!n)return;let r=n.inputJsonParts.join(``),i;try{i=r?JSON.parse(r):{}}catch{i={__unparsed:r}}t.toolCalls.push({type:`tool_use`,id:n.id,name:n.name,input:i}),delete t.activeToolBlocks[e.index]}function ky(e,t,n,r){e&&typeof e==`object`&&(wy(e,r)||(Ty(e,t),Ey(e,t),Dy(e,t,n),Oy(e,t)))}async function*Ay(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:``,responseModel:``,promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let i of e)ky(i,r,n,t),yield i}finally{X_(t,r,n)}}function jy(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:``,responseModel:``,promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return e.on(`streamEvent`,e=>{ky(e,r,n,t)}),e.on(`message`,()=>{X_(t,r,n)}),e.on(`error`,e=>{H(e,{mechanism:{handled:!1,type:`auto.ai.anthropic.stream_error`}}),t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end())}),e}var My=!1,Ny=new WeakSet;function Py(e,t,n){let r={[Sg]:`anthropic`,[Bg]:n,[I]:`auto.ai.anthropic`};if(e.length>0&&typeof e[0]==`object`&&e[0]!==null){let t=e[0];t.tools&&Array.isArray(t.tools)&&(r[Kg]=JSON.stringify(t.tools)),r[Cg]=t.model??`unknown`,`temperature`in t&&(r[Tg]=t.temperature),`top_p`in t&&(r[kg]=t.top_p),`stream`in t&&(r[wg]=t.stream),`top_k`in t&&(r[Ag]=t.top_k),`frequency_penalty`in t&&(r[Dg]=t.frequency_penalty),`max_tokens`in t&&(r[Eg]=t.max_tokens)}else r[Cg]=t===`models.retrieve`||t===`models.get`?e[0]:`unknown`;return r}function Fy(e,t,n){yy(e,Cy(t),n),`prompt`in t&&e.setAttributes({[xg]:JSON.stringify(t.prompt)})}function Iy(e,t){if(`content`in t&&Array.isArray(t.content)){e.setAttributes({[Gg]:t.content.map(e=>e.text).filter(e=>!!e).join(``)});let n=[];for(let e of t.content)(e.type===`tool_use`||e.type===`server_tool_use`)&&n.push(e);n.length>0&&e.setAttributes({[Jg]:JSON.stringify(n)})}`completion`in t&&e.setAttributes({[Gg]:t.completion}),`input_tokens`in t&&e.setAttributes({[Gg]:JSON.stringify(t.input_tokens)})}function Ly(e,t){`id`in t&&`model`in t&&(e.setAttributes({[Fg]:t.id,[Pg]:t.model}),`usage`in t&&t.usage&&Y_(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function Ry(e,t,n){if(t&&typeof t==`object`){if(`type`in t&&t.type===`error`){Sy(e,t);return}n&&Iy(e,t),Ly(e,t)}}function zy(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end()),e}function By(e,t,n,r,i,a,o,s,c,l){let u={name:`${i} ${r[`gen_ai.request.model`]??`unknown`}`,op:`gen_ai.${i}`,attributes:r};if(c&&!l){let r,i=ts(u,i=>(r=e.apply(t,n),s.recordInputs&&o&&Fy(i,o,q_(s.enableTruncation)),(async()=>{try{return Ay(await r,i,s.recordOutputs??!1)}catch(e){return zy(e,i)}})()));return ev(r,i)}return ts(u,r=>{try{s.recordInputs&&o&&Fy(r,o,q_(s.enableTruncation)),My=!0;let i=e.apply(t,n);return My=!1,jy(i,r,s.recordOutputs??!1)}catch(e){return My=!1,zy(e,r)}})}function Vy(e,t,n,r,i){return new Proxy(e,{apply(e,a,o){let s=a===void 0?r:a,c=n.streaming===!0;if(!c&&My)return e.apply(s,o);let l=n.operation||`unknown`,u=Py(o,t,l),d=u[`gen_ai.request.model`]??`unknown`,f=typeof o[0]==`object`?o[0]:void 0,p=!!f?.stream;if(p||c)return By(e,s,o,u,l,t,f,i,p,c);let m,h=z({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},t=>(m=e.apply(s,o),i.recordInputs&&f&&Fy(t,f,q_(i.enableTruncation)),m.then(e=>(Ry(t,e,i.recordOutputs),e))));return ev(m,h)}})}function Hy(e,t){for(let n of Object.keys(vy)){let r=n.split(`.`),i=r.pop(),a=e;for(let e of r)a=a?.[e];if(!a||typeof a[i]!=`function`)continue;let o=a[i];if(Ny.has(o))continue;let s=Vy(o,n,vy[n],a,t);Ny.add(s),a[i]=s}return e}function Uy(e,t){return Hy(e,K_(t))}var Wy=`Google_GenAI`,Gy={"models.generateContent":{operation:`generate_content`},"models.generateContentStream":{operation:`generate_content`,streaming:!0},"models.embedContent":{operation:`embeddings`},"chats.create":{proxyResultPath:`chat`},"chat.sendMessage":{operation:`chat`},"chat.sendMessageStream":{operation:`chat`,streaming:!0}},Ky=`google_genai`;function qy(e,t){let n=e?.promptFeedback;if(n?.blockReason){let e=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:`internal_error`}),H(`Content blocked: ${e}`,{mechanism:{handled:!1,type:`auto.ai.google_genai`}}),!0}return!1}function Jy(e,t){typeof e.responseId==`string`&&(t.responseId=e.responseId),typeof e.modelVersion==`string`&&(t.responseModel=e.modelVersion);let n=e.usageMetadata;n&&(typeof n.promptTokenCount==`number`&&(t.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount==`number`&&(t.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount==`number`&&(t.totalTokens=n.totalTokenCount))}function Yy(e,t,n){Array.isArray(e.functionCalls)&&t.toolCalls.push(...e.functionCalls);for(let r of e.candidates??[]){r?.finishReason&&!t.finishReasons.includes(r.finishReason)&&t.finishReasons.push(r.finishReason);for(let e of r?.content?.parts??[])n&&e.text&&t.responseTexts.push(e.text),e.functionCall&&t.toolCalls.push({type:`function`,id:e.functionCall.id,name:e.functionCall.name,arguments:e.functionCall.args})}}function Xy(e,t,n,r){e&&!qy(e,r)&&(Jy(e,t),Yy(e,t,n))}async function*Zy(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let i of e)Xy(i,r,n,t),yield i}finally{X_(t,r,n)}}function Qy(e,t=`user`){return typeof e==`string`?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(e=>Qy(e,t)):typeof e!=`object`||!e?[]:`role`in e&&typeof e.role==`string`?[e]:`parts`in e?[{...e,role:t}]:[{role:t,content:e}]}function $y(e,t){if(`model`in e&&typeof e.model==`string`)return e.model;if(t&&typeof t==`object`){let e=t;if(`model`in e&&typeof e.model==`string`)return e.model;if(`modelVersion`in e&&typeof e.modelVersion==`string`)return e.modelVersion}return`unknown`}function eb(e){let t={};return`temperature`in e&&typeof e.temperature==`number`&&(t[Tg]=e.temperature),`topP`in e&&typeof e.topP==`number`&&(t[kg]=e.topP),`topK`in e&&typeof e.topK==`number`&&(t[Ag]=e.topK),`maxOutputTokens`in e&&typeof e.maxOutputTokens==`number`&&(t[Eg]=e.maxOutputTokens),`frequencyPenalty`in e&&typeof e.frequencyPenalty==`number`&&(t[Dg]=e.frequencyPenalty),`presencePenalty`in e&&typeof e.presencePenalty==`number`&&(t[Og]=e.presencePenalty),t}function tb(e,t,n){let r={[Sg]:Ky,[Bg]:e,[I]:`auto.ai.google_genai`};if(t){if(r[Cg]=$y(t,n),`config`in t&&typeof t.config==`object`&&t.config){let e=t.config;if(Object.assign(r,eb(e)),`tools`in e&&Array.isArray(e.tools)){let t=e.tools.flatMap(e=>e.functionDeclarations);r[Kg]=JSON.stringify(t)}}}else r[Cg]=$y({},n);return r}function nb(e,t,n,r){if(n===`embeddings`){let n=t.contents;n!=null&&e.setAttribute(r_,typeof n==`string`?n:JSON.stringify(n));return}let i=[];if(`config`in t&&t.config&&typeof t.config==`object`&&`systemInstruction`in t.config&&t.config.systemInstruction&&i.push(...Qy(t.config.systemInstruction,`system`)),`history`in t&&i.push(...Qy(t.history,`user`)),`contents`in t&&i.push(...Qy(t.contents,`user`)),`message`in t&&i.push(...Qy(t.message,`user`)),Array.isArray(i)&&i.length){let{systemInstructions:t,filteredMessages:n}=Q_(i);t&&e.setAttribute(Wg,t);let a=Array.isArray(n)?n.length:0;e.setAttributes({[Vg]:a,[Hg]:r?Z_(n):mr(n)})}}function rb(e,t,n){if(t&&typeof t==`object`){if(t.modelVersion&&e.setAttribute(Pg,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata==`object`){let n=t.usageMetadata;typeof n.promptTokenCount==`number`&&e.setAttributes({[Lg]:n.promptTokenCount}),typeof n.candidatesTokenCount==`number`&&e.setAttributes({[Rg]:n.candidatesTokenCount}),typeof n.totalTokenCount==`number`&&e.setAttributes({[zg]:n.totalTokenCount})}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let n=t.candidates.map(e=>e.content?.parts&&Array.isArray(e.content.parts)?e.content.parts.map(e=>typeof e.text==`string`?e.text:``).filter(e=>e.length>0).join(``):``).filter(e=>e.length>0);n.length>0&&e.setAttributes({[Gg]:n.join(``)})}if(n&&t.functionCalls){let n=t.functionCalls;Array.isArray(n)&&n.length>0&&e.setAttributes({[Jg]:JSON.stringify(n)})}}}function ib(e,t,n,r,i){let a=n.operation===`embeddings`;return new Proxy(e,{apply(e,t,o){let s=n.operation||`unknown`,c=o[0],l=tb(s,c,r),u=l[`gen_ai.request.model`]??`unknown`;return n.streaming?ts({name:`${s} ${u}`,op:`gen_ai.${s}`,attributes:l},async t=>{try{return i.recordInputs&&c&&nb(t,c,s,q_(i.enableTruncation)),Zy(await e.apply(r,o),t,!!i.recordOutputs)}catch(e){throw t.setStatus({code:2,message:`internal_error`}),t.end(),e}}):z({name:`${s} ${u}`,op:`gen_ai.${s}`,attributes:l},t=>(i.recordInputs&&c&&nb(t,c,s,q_(i.enableTruncation)),Zo(()=>e.apply(r,o),()=>{},()=>{},e=>{a||rb(t,e,i.recordOutputs)})))}})}function ab(e,t=``,n){return new Proxy(e,{get:(e,r,i)=>{let a=Reflect.get(e,r,i),o=J_(t,String(r)),s=Gy[o];if(typeof a==`function`&&s){let t=s.operation?ib(a,o,s,e,n):a.bind(e);return s.proxyResultPath?function(...e){let r=t(...e);return r&&typeof r==`object`?ab(r,s.proxyResultPath,n):r}:t}return typeof a==`function`?a.bind(e):a&&typeof a==`object`?ab(a,o,n):a}})}function ob(e,t){return ab(e,``,K_(t))}var sb=`LangChain`,cb=`auto.ai.langchain`,lb={human:`user`,ai:`assistant`,assistant:`assistant`,system:`system`,function:`function`,tool:`tool`},ub=(e,t,n)=>{n!=null&&(e[t]=n)},db=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function fb(e){if(Array.isArray(e))try{let t=e.map(e=>e&&typeof e==`object`&&f_(e)?O_(e):e);return JSON.stringify(t)}catch{return String(e)}return mr(e,String)}function pb(e){let t=e.toLowerCase();return lb[t]??t}function mb(e){return e.includes(`System`)?`system`:e.includes(`Human`)?`user`:e.includes(`AI`)||e.includes(`Assistant`)?`assistant`:e.includes(`Function`)?`function`:e.includes(`Tool`)?`tool`:`user`}function hb(e){if(e&&!Array.isArray(e))return e.invocation_params}function gb(e){return e.map(e=>{let t=e._getType;if(typeof t==`function`)return{role:pb(t.call(e)),content:fb(e.content)};if(e.lc===1&&e.kwargs){let t=e.id,n=Array.isArray(t)&&t.length>0?t[t.length-1]:``;return{role:pb(typeof n==`string`?mb(n):`user`),content:fb(e.kwargs?.content)}}if(e.type)return{role:pb(String(e.type).toLowerCase()),content:fb(e.content)};if(e.role)return{role:pb(String(e.role)),content:fb(e.content)};let n=e.constructor?.name;return n&&n!==`Object`?{role:pb(mb(n)),content:fb(e.content)}:{role:`user`,content:fb(e.content)}})}function _b(e,t,n){let r={},i=`kwargs`in e?e.kwargs:void 0;db(r,Tg,t?.temperature??n?.ls_temperature??i?.temperature),db(r,Eg,t?.max_tokens??n?.ls_max_tokens??i?.max_tokens),db(r,kg,t?.top_p??i?.top_p);let a=t?.frequency_penalty;db(r,Dg,a);let o=t?.presence_penalty;return db(r,Og,o),t&&`stream`in t&&ub(r,wg,!!t.stream),r}function vb(e,t,n,r,i){return{[Sg]:mr(e??`langchain`,String),[Bg]:`chat`,[Cg]:mr(t,String),[I]:cb,..._b(n,r,i)}}function yb(e,t,n,r,i,a){let o=a?.ls_provider,s=vb(o,i?.model??a?.ls_model_name??`unknown`,e,i,a);if(n&&Array.isArray(t)&&t.length>0){ub(s,Vg,t.length);let e=t.map(e=>({role:`user`,content:e}));ub(s,Hg,r?Z_(e):mr(e))}return s}function bb(e,t,n,r,i,a){let o=vb(a?.ls_provider??e.id?.[2],i?.model??a?.ls_model_name??`unknown`,e,i,a);if(n&&Array.isArray(t)&&t.length>0){let{systemInstructions:e,filteredMessages:n}=Q_(gb(t.flat()));e&&ub(o,Wg,e),ub(o,Vg,Array.isArray(n)?n.length:0),ub(o,Hg,r?Z_(n):mr(n))}return o}function xb(e,t){let n=[],r=e.flat();for(let e of r){let t=e.message?.tool_calls;if(Array.isArray(t)&&t.length>0)n.push(...t);else{let t=e.message?.content;if(Array.isArray(t))for(let e of t){let t=e;t.type===`tool_use`&&n.push(t)}}}n.length>0&&ub(t,Jg,mr(n,String))}function Sb(e,t){if(!e)return;let n=e.tokenUsage,r=e.usage;if(n)db(t,Lg,n.promptTokens),db(t,Rg,n.completionTokens),db(t,zg,n.totalTokens);else if(r){db(t,Lg,r.input_tokens),db(t,Rg,r.output_tokens);let e=Number(r.input_tokens),n=Number(r.output_tokens),i=(Number.isNaN(e)?0:e)+(Number.isNaN(n)?0:n);i>0&&db(t,zg,i),r.cache_creation_input_tokens!==void 0&&db(t,Qg,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&db(t,$g,r.cache_read_input_tokens)}}function Cb(e,t){if(!e)return;let n={};if(Array.isArray(e.generations)){let r=e.generations.flat().map(e=>e.generationInfo?.finish_reason?e.generationInfo.finish_reason:e.generation_info?.finish_reason?e.generation_info.finish_reason:null).filter(e=>typeof e==`string`);if(r.length>0&&ub(n,Ng,mr(r,String)),xb(e.generations,n),t){let t=e.generations.flat().map(e=>e.text??e.message?.content).filter(e=>typeof e==`string`);t.length>0&&ub(n,Gg,mr(t,String))}}Sb(e.llmOutput,n);let r=e.llmOutput,i=e.generations?.[0]?.[0]?.message,a=r?.model_name??r?.model??i?.response_metadata?.model_name;a&&ub(n,Pg,a);let o=r?.id??i?.id;o&&ub(n,Fg,o);let s=r?.stop_reason??i?.response_metadata?.finish_reason;return s&&ub(n,Ig,mr(s,String)),n}function wb(e){let t={},n=e?.lc_agent_name;return typeof n==`string`&&(t[Yg]=n),t}function Tb(e){let t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;let n=t.map(e=>{let t=e.function;return{type:`function`,name:e.name??t?.name??``,description:e.description??t?.description}});return JSON.stringify(n)}function Eb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.addHandler==`function`&&typeof t.copy==`function`}function Db(e){return typeof e==`object`&&e?.name===`SentryCallbackHandler`}function Ob(e){return e.some(Db)}function kb(e,t){if(!e)return[t];if(Eb(e)){if(Ob(e.handlers??[]))return e;let n=e.copy();return n.addHandler(t,!0),n}let n=Array.isArray(e)?e:[e];return Ob(n)?e:[...n,t]}function Ab(e={}){let{recordInputs:t,recordOutputs:n}=K_(e),r=q_(e.enableTruncation),i=new Map,a=e=>{let t=i.get(e);t?.isRecording()&&(t.end(),i.delete(e))},o={lc_serializable:!1,lc_namespace:[`langchain_core`,`callbacks`,`sentry`],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:[`langchain_core`,`callbacks`,`sentry`],lc_kwargs:{},name:`SentryCallbackHandler`,ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(e,n,a,o,s,c,l,u){let d=hb(c),f=yb(e,n,t,r,d,l),p=f[Cg],m=f[Bg];ts({name:`${m} ${p}`,op:`gen_ai.chat`,attributes:{...wb(l),...f,[F]:`gen_ai.chat`}},e=>(i.set(a,e),e))},handleChatModelStart(e,n,a,o,s,c,l,u){let d=hb(c),f=bb(e,n,t,r,d,l),p=Tb(s);p&&(f[Kg]=p);let m=f[Cg],h=f[Bg];ts({name:`${h} ${m}`,op:`gen_ai.chat`,attributes:{...wb(l),...f,[F]:`gen_ai.chat`}},e=>(i.set(a,e),e))},handleLLMEnd(e,t,r,o,s){let c=i.get(t);if(c?.isRecording()){let r=Cb(e,n);r&&c.setAttributes(r),a(t)}},handleLLMError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t))},handleChainStart(e,n,r,a,o,s,c,l){if(s?.__sentry_langgraph__)return;let u=l||e.name||`unknown_chain`,d={[I]:`auto.ai.langchain`,"langchain.chain.name":u};t&&(d[`langchain.chain.inputs`]=JSON.stringify(n)),ts({name:`chain ${u}`,op:`gen_ai.invoke_agent`,attributes:{...d,[F]:`gen_ai.invoke_agent`}},e=>(i.set(r,e),e))},handleChainEnd(e,t){let r=i.get(t);r?.isRecording()&&(n&&r.setAttributes({"langchain.chain.outputs":JSON.stringify(e)}),a(t))},handleChainError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t))},handleToolStart(e,n,r,a,o,s,c){if(s?.__sentry_langgraph__)return;let l=c||e.name||`unknown_tool`,u={...wb(s),[I]:cb,[Bg]:`execute_tool`,[o_]:l};t&&(u[l_]=n),ts({name:`execute_tool ${l}`,op:`gen_ai.execute_tool`,attributes:{...u,[F]:`gen_ai.execute_tool`}},e=>(i.set(r,e),e))},handleToolEnd(e,t){let r=i.get(t);if(r?.isRecording()){if(n){let t=e,n=t&&typeof t==`object`&&`content`in t?t.content:e;r.setAttributes({[u_]:typeof n==`string`?n:JSON.stringify(n)})}a(t)}},handleToolError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t))},copy(){return o},toJSON(){return{lc:1,type:`not_implemented`,id:o.lc_id}},toJSONNotImplemented(){return{lc:1,type:`not_implemented`,id:o.lc_id}}};return o}function jb(e){let t=e.constructor?.name??``;return t.includes(`OpenAI`)?`openai`:t.includes(`Google`)?`google_genai`:t.includes(`Mistral`)?`mistralai`:t.includes(`Vertex`)?`google_vertexai`:t.includes(`Bedrock`)?`aws_bedrock`:t.includes(`Ollama`)?`ollama`:t.includes(`Cloudflare`)?`cloudflare`:t.includes(`Cohere`)?`cohere`:`langchain`}function Mb(e){let t=e??{},n={[I]:cb,[F]:i_,[Bg]:`embeddings`,[Cg]:t.model??`unknown`};return n[Sg]=jb(t),`dimensions`in t&&(n[Mg]=t.dimensions),`encodingFormat`in t&&(n[jg]=t.encodingFormat),n}function Nb(e,t,n={}){let{recordInputs:r}=K_(n),i=Mb(e),a=i[`gen_ai.request.model`]||`unknown`;return r&&t!=null&&(i[r_]=typeof t==`string`?t:JSON.stringify(t)),{name:`embeddings ${a}`,op:i_,attributes:i}}function Pb(e,t={}){return new Proxy(e,{apply(e,n,r){return z(Nb(n,r[0],t),()=>Reflect.apply(e,n,r))}})}function Fb(e,t){let n=e;return typeof n.embedQuery==`function`&&(n.embedQuery=Pb(n.embedQuery,t)),typeof n.embedDocuments==`function`&&(n.embedDocuments=Pb(n.embedDocuments,t)),e}var Ib=`LangGraph`,Lb=`auto.ai.langgraph`;function Rb(e){let t=e[0];if(typeof t!=`object`||!t||!(`llm`in t)||!t.llm||typeof t.llm!=`object`)return null;let n=t.llm;return typeof n.modelName!=`string`&&typeof n.model!=`string`?null:n}function zb(e){let t=e[0];return typeof t==`object`&&t&&`name`in t&&typeof t.name==`string`?t.name:null}function Bb(e,t,n){let r=`__sentry_tool_wrapped__`;for(let i of e){if(!i||typeof i!=`object`)continue;let e=i,a=e.invoke;if(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,r))continue;let o=typeof e.name==`string`?e.name:`unknown_tool`,s=typeof e.description==`string`?e.description:void 0;e.invoke=new Proxy(a,{apply(e,r,i){let a={[I]:Lb,[F]:a_,[Bg]:`execute_tool`,[o_]:o,[c_]:`function`},c=i[1]?.metadata?.lc_agent_name??n;typeof c==`string`&&(a[Yg]=c),s&&(a[d_]=s);let l=i[0];if(typeof l==`object`&&l&&(`id`in l&&typeof l.id==`string`&&(a[s_]=l.id),t.recordInputs)){let e=`args`in l&&typeof l.args==`object`?l.args:l;try{a[l_]=JSON.stringify(e)}catch{}}return z({op:a_,name:`execute_tool ${o}`,attributes:a},async n=>{try{let a=await Reflect.apply(e,r,i);if(t.recordOutputs)try{let e=a,t=e&&typeof e==`object`&&`content`in e?e.content:a;n.setAttribute(u_,typeof t==`string`?t:JSON.stringify(t))}catch{}return a}catch(e){throw n.setStatus({code:2,message:`internal_error`}),e}})}}),Object.defineProperty(e,r,{value:!0,enumerable:!1})}return e}function Vb(e){if(!e||e.length===0)return null;let t=[];for(let n of e)if(n&&typeof n==`object`){let e=n.tool_calls;e&&Array.isArray(e)&&t.push(...e)}return t.length>0?t:null}function Hb(e){let t=e,n=0,r=0,i=0;if(t.usage_metadata&&typeof t.usage_metadata==`object`){let e=t.usage_metadata;return typeof e.input_tokens==`number`&&(n=e.input_tokens),typeof e.output_tokens==`number`&&(r=e.output_tokens),typeof e.total_tokens==`number`&&(i=e.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:i}}if(t.response_metadata&&typeof t.response_metadata==`object`){let e=t.response_metadata;if(e.tokenUsage&&typeof e.tokenUsage==`object`){let t=e.tokenUsage;typeof t.promptTokens==`number`&&(n=t.promptTokens),typeof t.completionTokens==`number`&&(r=t.completionTokens),typeof t.totalTokens==`number`&&(i=t.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:i}}function Ub(e,t){let n=t;if(n.response_metadata&&typeof n.response_metadata==`object`){let t=n.response_metadata;t.model_name&&typeof t.model_name==`string`&&e.setAttribute(Pg,t.model_name),t.finish_reason&&typeof t.finish_reason==`string`&&e.setAttribute(Ng,[t.finish_reason])}}function Wb(e){if(!e.builder?.nodes?.tools?.runnable?.tools)return null;let t=e.builder?.nodes?.tools?.runnable?.tools;return!t||!Array.isArray(t)||t.length===0?null:t.map(e=>({name:e.lc_kwargs?.name,description:e.lc_kwargs?.description,schema:e.lc_kwargs?.schema}))}function Gb(e,t,n){let r=n?.messages;if(!r||!Array.isArray(r))return;let i=t?.length??0,a=r.length>i?r.slice(i):[];if(a.length===0)return;let o=Vb(a);o&&e.setAttribute(Jg,JSON.stringify(o));let s=gb(a);e.setAttribute(Gg,JSON.stringify(s));let c=0,l=0,u=0;for(let t of a){let n=Hb(t);c+=n.inputTokens,l+=n.outputTokens,u+=n.totalTokens,Ub(e,t)}c>0&&e.setAttribute(Lg,c),l>0&&e.setAttribute(Rg,l),u>0&&e.setAttribute(zg,u)}var Kb=!1,qb=`__sentry_patched__`;function Jb(e){let t={[I]:Lb,[F]:`gen_ai.create_agent`,[Bg]:`create_agent`};return e&&(t[Yg]=e),{op:`gen_ai.create_agent`,name:e?`create_agent ${e}`:`create_agent`,attributes:t}}function Yb(e,t){if(Object.prototype.hasOwnProperty.call(e,qb))return e;let n=Ab(t),r=new Proxy(e,{apply(e,r,i){return Kb?Reflect.apply(e,r,i):z(Jb(),a=>{try{let o=Reflect.apply(e,r,i),s=i.length>0?i[0]:{};s?.name&&typeof s.name==`string`&&(a.setAttribute(Yg,s.name),a.updateName(`create_agent ${s.name}`));let c=o.invoke;return c&&typeof c==`function`&&(o.invoke=Xb(c.bind(o),o,s,t,void 0,n)),o}catch(e){throw a.setStatus({code:2,message:`internal_error`}),e}})}});return Object.defineProperty(r,qb,{value:!0,enumerable:!1}),r}function Xb(e,t,n,r,i,a){return new Proxy(e,{apply(e,o,s){let c=i?.modelName??i?.model;return z({op:`gen_ai.invoke_agent`,name:`invoke_agent`,attributes:{[I]:Lb,[F]:n_,[Bg]:`invoke_agent`}},async i=>{try{let l=n?.name;l&&typeof l==`string`&&(i.setAttribute(Xg,l),i.setAttribute(Yg,l),i.updateName(`invoke_agent ${l}`)),c&&i.setAttribute(Cg,c);let u=(s.length>1?s[1]:void 0)?.configurable?.thread_id;if(u&&typeof u==`string`&&i.setAttribute(Zg,u),a){let e=s[1]??{};s[1]=e,e.metadata={...e.metadata??{},__sentry_langgraph__:!0,...typeof l==`string`?{lc_agent_name:l}:{}},e.callbacks=kb(e.callbacks,a)}let d=Wb(t);d&&i.setAttribute(Kg,JSON.stringify(d));let f=r.recordInputs,p=r.recordOutputs,m=s.length>0?s[0]?.messages??[]:[];if(m&&f){let{systemInstructions:e,filteredMessages:t}=Q_(gb(m));e&&i.setAttribute(Wg,e);let n=q_(r.enableTruncation),a=Array.isArray(t)?t.length:0;i.setAttributes({[Hg]:n?Z_(t):mr(t),[Vg]:a})}let h=await Reflect.apply(e,o,s);return p&&Gb(i,m??null,h),h}catch(e){throw i.setStatus({code:2,message:`internal_error`}),e}})}})}function Zb(e,t){if(Object.prototype.hasOwnProperty.call(e,qb))return e;let n=K_(t),r=Ab(n),i=new Proxy(e,{apply(e,t,i){let a=Rb(i),o=zb(i),s=i[0];s&&Array.isArray(s.tools)&&s.tools.length>0&&Bb(s.tools,n,o??void 0),Kb=!0;let c;try{c=Reflect.apply(e,t,i)}finally{Kb=!1}let l=c.invoke;if(l&&typeof l==`function`){let e={};o&&(e.name=o),c.invoke=Xb(l.bind(c),c,e,n,a,r)}return c}});return Object.defineProperty(i,qb,{value:!0,enumerable:!1}),i}function Qb(e,t){return e.compile=Yb(e.compile,K_(t)),e}var $b=Qb;function ex(e,t,n){let r=n.getOptions(),i=n.getDsn(),a=r.tunnel,o=Mo(r._metadata),s={sent_at:new Date($n()).toISOString(),...tx(t)&&{trace:t},...o&&{sdk:o},...!!a&&i&&{dsn:pa(i)}},c=n.getDataCollectionOptions().userInfo?`auto`:`never`;return bo(s,[[{type:`span`,item_count:e.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...Fd()&&{ingest_settings:{infer_ip:c,infer_user_agent:c}},items:e}]])}function tx(e){return!!e.trace_id&&!!e.public_key}function nx(e){let t=156;if(t+=e.name.length*2,t+=hi(e.attributes),e.links&&e.links.length>0){let n=e.links[0]?.attributes,r=100+(n?hi(n):0);t+=r*e.links.length}return t}var rx=1e3,ix=5e6,ax=class{constructor(e,t){this._traceBuckets=new Map,this._client=e;let{maxSpanLimit:n,flushInterval:r,maxTraceWeightInBytes:i}=t??{};this._maxSpanLimit=n&&n>0&&n<=rx?n:rx,this._flushInterval=r&&r>0?r:5e3,this._maxTraceWeight=i&&i>0?i:ix,this._client.on(`flush`,()=>{this.drain()}),this._client.on(`close`,()=>{this._traceBuckets.forEach(e=>{clearTimeout(e.timeout)}),this._traceBuckets.clear()})}add(e){let t=e.trace_id,n=this._traceBuckets.get(t);n||(n={spans:new Set,size:0,timeout:md(setTimeout(()=>{this.flush(t)},this._flushInterval))},this._traceBuckets.set(t,n)),n.spans.add(e),n.size+=nx(e),(n.spans.size>=this._maxSpanLimit||n.size>=this._maxTraceWeight)&&this.flush(t)}drain(){this._traceBuckets.size&&(D&&A.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((e,t)=>{this.flush(t)}))}flush(e){let t=this._traceBuckets.get(e);if(!t)return;if(!t.spans.size){this._removeTrace(e);return}let n=Array.from(t.spans),r=n[0]?._segmentSpan;if(!r){D&&A.warn(`No segment span reference found on span JSON, cannot compute DSC`),this._removeTrace(e);return}let i=go(r),a=n.map(e=>{let{_segmentSpan:t,...n}=e;return n}),o=ex(a,i,this._client);D&&A.log(`Sending span envelope for trace ${e} with ${a.length} spans`),this._client.sendEnvelope(o).then(null,e=>{D&&A.error(`Error while sending streamed span envelope:`,e)}),this._removeTrace(e)}_removeTrace(e){let t=this._traceBuckets.get(e);t&&clearTimeout(t.timeout),this._traceBuckets.delete(e)}},ox=W(()=>({name:`SpanStreaming`,setup(e){let t=`SpanStreaming integration requires`,n=`Falling back to static trace lifecycle.`,r=e.getOptions();if(!Wo(e)){r.traceLifecycle=`static`,D&&A.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let i=r.beforeSendSpan;if(i&&!yo(i)){r.traceLifecycle=`static`,D&&A.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let a=new ax(e);e.on(`afterSpanEnd`,t=>{Ua(t)&&a.add(hu(t,e))})}}));function sx(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function cx(e,t,n){let r=e[t];if(typeof r==`function`){try{e[t]=n}catch{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=n}catch{Object.defineProperty(e,"default",{value:n,writable:!0,configurable:!0,enumerable:!0})}}}var lx=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let t=this._cache.get(e);if(t!==void 0)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){if(this._cache.size>=this._maxSize){let e=this._cache.keys().next().value;this._cache.delete(e)}this._cache.set(e,t)}remove(e){let t=this._cache.get(e);return t&&this._cache.delete(e),t}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(t=>e.push(t)),e}};function ux(e){let t=e._metadata?.sdk,n=t?.name&&t?.version?`${t?.name}/${t?.version}`:void 0;e.transportOptions={...e.transportOptions,headers:{...n&&{"user-agent":n},...e.transportOptions?.headers}}}var dx=class extends Lf{constructor(e){ux(e),e.traceLifecycle===`stream`&&!e.integrations.some(e=>e.name===`SpanStreaming`)&&e.integrations.push(ox()),super(e),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(e,t){let n=hm(this,this._options.stackParser,e,t);return n.level=`error`,wu(n)}eventFromMessage(e,t=`info`,n){return wu(gm(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return fx(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&fx(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:Cr();if(!this._isEnabled())return D&&A.warn(`SDK not enabled, will not capture check-in.`),r;let{release:i,environment:a,tunnel:o}=this.getOptions(),s={check_in_id:r,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};`duration`in e&&(s.duration=e.duration),t&&(s.monitor_config={schedule:t.schedule,checkin_margin:t.checkinMargin,max_runtime:t.maxRuntime,timezone:t.timezone,failure_issue_threshold:t.failureIssueThreshold,recovery_threshold:t.recoveryThreshold});let[c,l]=jd(this,n);l&&(s.contexts={trace:l});let u=ip(s,c,this.getSdkMetadata(),o,this.getDsn());return D&&A.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}registerCleanup(e){this._disposeCallbacks.push(e)}dispose(){D&&A.log(`Disposing client...`);for(let e of this._disposeCallbacks)try{e()}catch{}this._disposeCallbacks.length=0;for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=lf(64)}_prepareEvent(e,t,n,r){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,t,n,r)}_setUpMetricsProcessing(){this.on(`processMetric`,e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function fx(e){let t=N().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}var px={mechanism:{handled:!1,type:`auto.rpc.trpc.middleware`}};function mx(e){typeof e==`object`&&e&&`ok`in e&&!e.ok&&`error`in e&&H(e.error,px)}function hx(e={}){return async function(t){let{path:n,type:r,next:i,rawInput:a,getRawInput:o}=t,s=P(),c=s?.getOptions(),l=s?.getDataCollectionOptions(),u={procedure_path:n,procedure_type:r};if(rr(u,1+(c?.normalizeDepth??5)),(e.attachRpcInput===void 0?l?.httpBodies.includes(`incomingRequest`):e.attachRpcInput)&&(a!==void 0&&(u.input=or(a)),o!==void 0&&typeof o==`function`))try{u.input=or(await o())}catch{}return xi(t=>(t.setContext(`trpc`,u),ts({name:`trpc/${n}`,op:`rpc.server`,attributes:{[Ci]:`route`,[I]:`auto.rpc.trpc`},forceTransaction:!!e.forceTransaction},async e=>{try{let t=await i();return mx(t),e.end(),t}catch(t){throw H(t,px),e.end(),t}})))}}function gx(e,t,n){try{if(!P())return;let r=R();r?.isRecording()&&r.setStatus({code:2,message:`internal_error`}),H(e,{mechanism:{type:`auto.ai.mcp_server`,handled:!1,data:{error_type:t||`handler_execution`,...n}}})}catch{}}function _x(e,t){Hn(e,t,e=>function(n,...r){let i=r[r.length-1];if(typeof i!=`function`)return e.call(this,n,...r);let a=vx(i,t,n);return e.call(this,n,...r.slice(0,-1),a)})}function vx(e,t,n){return function(...r){try{return yx.call(this,e,t,n,r)}catch(t){return D&&A.warn(`MCP handler wrapping failed:`,t),e.apply(this,r)}}}function yx(e,t,n,r){try{let i=e.apply(this,r);return j(i)&&typeof i.then==`function`?Promise.resolve(i).catch(e=>{throw bx(e,t,n),e}):i}catch(e){throw bx(e,t,n),e}}function bx(e,t,n){try{let r={};t===`tool`||t===`registerTool`?(r.tool_name=n,e.name===`ProtocolValidationError`||e.message.includes(`validation`)||e.message.includes(`protocol`)?gx(e,`validation`,r):e.name===`ServerTimeoutError`||e.message.includes(`timed out`)||e.message.includes(`timeout`)?gx(e,`timeout`,r):gx(e,`tool_execution`,r)):t===`resource`||t===`registerResource`?(r.resource_uri=n,gx(e,`resource_execution`,r)):(t===`prompt`||t===`registerPrompt`)&&(r.prompt_name=n,gx(e,`prompt_execution`,r))}catch{}}function xx(e){typeof e.tool==`function`&&_x(e,`tool`),typeof e.registerTool==`function`&&_x(e,`registerTool`)}function Sx(e){typeof e.resource==`function`&&_x(e,`resource`),typeof e.registerResource==`function`&&_x(e,`registerResource`)}function Cx(e){typeof e.prompt==`function`&&_x(e,`prompt`),typeof e.registerPrompt==`function`&&_x(e,`registerPrompt`)}function wx(e){xx(e),Sx(e),Cx(e)}function Tx(e){let t=e,n=t._registeredTools;if(j(n))for(let[e,t]of Object.entries(n))typeof t.executor==`function`&&(t.executor=vx(t.executor,`registerTool`,e));let r=t._registeredResources;if(j(r))for(let[e,t]of Object.entries(r))typeof t.readCallback==`function`&&(t.readCallback=vx(t.readCallback,`registerResource`,e));let i=t._registeredResourceTemplates;if(j(i))for(let[e,t]of Object.entries(i))typeof t.readCallback==`function`&&(t.readCallback=vx(t.readCallback,`registerResource`,e));let a=t._registeredPrompts;if(j(a))for(let[e,t]of Object.entries(a))typeof t.handler==`function`&&(t.handler=vx(t.handler,`registerPrompt`,e))}var Ex=`mcp.method.name`,Dx=`mcp.transport`,Ox=`mcp.server.name`,kx=`mcp.server.title`,Ax=`mcp.server.version`,jx=`mcp.protocol.version`,Mx=`mcp.tool.name`,Nx=`mcp.resource.uri`,Px=`mcp.prompt.name`,Fx=`mcp.tool.result.is_error`,Ix=`mcp.tool.result.content_count`,Lx=`mcp.prompt.result.description`,Rx=`mcp.prompt.result.message_count`,zx=`mcp.request.argument`,Bx=`mcp.logging.level`,Vx=`mcp.logging.logger`,Hx=`mcp.logging.data_type`,Ux=`mcp.logging.message`,Wx=`network.transport`,Gx=`network.protocol.version`,Kx=`client.address`,qx=`client.port`,Jx=`mcp.server`,Yx=`mcp.notification.client_to_server`,Xx=`mcp.notification.server_to_client`,Zx=`auto.function.mcp_server`,Qx=`auto.mcp.notification`,$x=`route`;function eS(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`method`in e&&`id`in e}function tS(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`method`in e&&!(`id`in e)}function nS(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`id`in e&&(`result`in e||`error`in e)}function rS(e){return j(e)&&`connect`in e&&(`tool`in e&&`resource`in e&&`prompt`in e||`registerTool`in e&&`registerResource`in e&&`registerPrompt`in e)?!0:(D&&A.warn(`Did not patch MCP server. Interface is incompatible.`),!1)}function iS(e){return j(e)}function aS(e,t){let n={[Ix]:e.length};for(let[r,i]of e.entries()){if(!iS(i))continue;let a=e.length===1?`mcp.tool.result`:`mcp.tool.result.${r}`;if(typeof i.type==`string`&&(n[`${a}.content_type`]=i.type),t){let e=(e,t)=>{typeof t==`string`&&(n[`${a}.${e}`]=t)};e(`mime_type`,i.mimeType),e(`uri`,i.uri),e(`name`,i.name),typeof i.text==`string`&&(n[`${a}.content`]=i.text),typeof i.data==`string`&&(n[`${a}.data_size`]=i.data.length);let t=i.resource;iS(t)&&(e(`resource_uri`,t.uri),e(`resource_mime_type`,t.mimeType))}}return n}function oS(e,t){if(!iS(e))return{};let n=Array.isArray(e.content)?aS(e.content,t):{};return typeof e.isError==`boolean`&&(n[Fx]=e.isError),n}function sS(e,t){let n={};if(!iS(e))return n;if(t&&typeof e.description==`string`&&(n[Lx]=e.description),Array.isArray(e.messages)&&(n[Rx]=e.messages.length,t)){let t=e.messages;for(let[e,r]of t.entries()){if(!iS(r))continue;let i=t.length===1?`mcp.prompt.result`:`mcp.prompt.result.${e}`;if(((e,r)=>{if(typeof r==`string`){let a=t.length===1?`${i}.message_${e}`:`${i}.${e}`;n[a]=r}})(`role`,r.role),iS(r.content)){let e=r.content;if(typeof e.text==`string`){let r=t.length===1?`${i}.message_content`:`${i}.content`;n[r]=e.text}}}}return n}var cS=new Map,lS=new WeakMap;function uS(e){let t=e.sessionId;return t?cS.get(t):lS.get(e)}function dS(e,t){let n=e.sessionId;n?cS.set(n,t):lS.set(e,t)}function fS(e,t){dS(e,{...uS(e)||{},...t})}function pS(e){return uS(e)?.clientInfo}function mS(e){return uS(e)?.protocolVersion}function hS(e){return uS(e)}function gS(e){let t=e.sessionId;t&&cS.delete(t)}var _S=`io.modelcontextprotocol/protocolVersion`,vS=`io.modelcontextprotocol/clientInfo`,yS=`io.modelcontextprotocol/serverInfo`;function bS(e){let t={};return iS(e)&&(typeof e.name==`string`&&(t.name=e.name),typeof e.title==`string`&&(t.title=e.title),typeof e.version==`string`&&(t.version=e.version)),t}function xS(e){let t={};return iS(e.params)&&(typeof e.params.protocolVersion==`string`&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=bS(e.params.clientInfo))),t}function SS(e){let t={};if(iS(e.params)&&iS(e.params._meta)){let n=e.params._meta;typeof n[_S]==`string`&&(t.protocolVersion=n[_S]),n[vS]&&(t.clientInfo=bS(n[vS]))}return t}function CS(e){let t={};return iS(e)&&(typeof e.protocolVersion==`string`&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=bS(e.serverInfo))),t}function wS(e){let t={};return iS(e)&&iS(e._meta)&&e._meta[yS]&&(t.serverInfo=bS(e._meta[yS])),t}function TS(e){let t=pS(e),n={};return t?.name&&(n[`mcp.client.name`]=t.name),t?.title&&(n[`mcp.client.title`]=t.title),t?.version&&(n[`mcp.client.version`]=t.version),n}function ES(e){let t={};return e?.name&&(t[`mcp.client.name`]=e.name),e?.title&&(t[`mcp.client.title`]=e.title),e?.version&&(t[`mcp.client.version`]=e.version),t}function DS(e){let t=hS(e)?.serverInfo,n={};return t?.name&&(n[Ox]=t.name),t?.title&&(n[kx]=t.title),t?.version&&(n[Ax]=t.version),n}function OS(e){let t={};return e?.name&&(t[Ox]=e.name),e?.title&&(t[kx]=e.title),e?.version&&(t[Ax]=e.version),t}function kS(e){return{address:e?.requestInfo?.remoteAddress||e?.clientAddress||e?.request?.ip||e?.request?.connection?.remoteAddress,port:e?.requestInfo?.remotePort||e?.clientPort||e?.request?.connection?.remotePort}}function AS(e){if(!e?.constructor)return{mcpTransport:`unknown`,networkTransport:`unknown`};let t=typeof e.constructor?.name==`string`?e.constructor.name:`unknown`,n=`unknown`,r=t.toLowerCase();return r.includes(`stdio`)?n=`pipe`:(r.includes(`http`)||r.includes(`sse`))&&(n=`tcp`),{mcpTransport:t,networkTransport:n}}function jS(e,t){let n=e&&`sessionId`in e?e.sessionId:void 0,r=t?kS(t):{},{mcpTransport:i,networkTransport:a}=AS(e),o=TS(e),s=DS(e),c=mS(e);return{...n&&{"mcp.session.id":n},...r.address&&{"client.address":r.address},...r.port&&{"client.port":r.port},[Dx]:i,[Wx]:a,[Gx]:`2.0`,...c&&{"mcp.protocol.version":c},...o,...s}}var MS=new Map,NS=new WeakMap;function PS(e){let t=e.sessionId;if(t){let e=MS.get(t);return e||(e=new Map,MS.set(t,e)),e}let n=NS.get(e);return n||(n=new Map,NS.set(e,n)),n}function FS(e,t,n,r,i){PS(e).set(t,{span:n,method:r,capturePolicy:i,startTime:Date.now()})}function IS(e,t,n,r=!1){let i=PS(e),a=i.get(t);if(a){let{span:o,method:s}=a,c=s===`initialize`?CS(n):wS(n);(c.protocolVersion||c.serverInfo)&&fS(e,c);let l={...OS(c.serverInfo)};if(c.protocolVersion&&(l[jx]=c.protocolVersion),Object.keys(l).length>0&&o.setAttributes(l),r)o.setStatus({code:2,message:`internal_error`});else if(s===`tools/call`){let e=oS(n,a.capturePolicy.recordOutputs);o.setAttributes(e)}else if(s===`prompts/get`){let e=sS(n,a.capturePolicy.recordOutputs);o.setAttributes(e)}o.end(),i.delete(t)}}function LS(e){let t=e.sessionId;if(t){let e=MS.get(t);if(e){for(let[,t]of e)t.span.setStatus({code:2,message:`cancelled`}),t.span.end();MS.delete(t)}return}let n=NS.get(e);if(n){for(let[,e]of n)e.span.setStatus({code:2,message:`cancelled`}),e.span.end();n.clear()}}var RS={"tools/call":{targetField:`name`,targetAttribute:Mx,captureArguments:!0,argumentsField:`arguments`},"resources/read":{targetField:`uri`,targetAttribute:Nx,captureUri:!0},"resources/subscribe":{targetField:`uri`,targetAttribute:Nx},"resources/unsubscribe":{targetField:`uri`,targetAttribute:Nx},"prompts/get":{targetField:`name`,targetAttribute:Px,captureName:!0,captureArguments:!0,argumentsField:`arguments`}};function zS(e,t){let n=RS[e];if(!n)return{attributes:{}};let r=n.targetField&&typeof t?.[n.targetField]==`string`?t[n.targetField]:void 0;return{target:r,attributes:r&&n.targetAttribute?{[n.targetAttribute]:r}:{}}}function BS(e,t){let n={},r=RS[e];if(!r)return n;if(r.captureArguments&&r.argumentsField&&t?.[r.argumentsField]){let e=t[r.argumentsField];if(j(e))for(let[t,r]of Object.entries(e))n[`${zx}.${t.toLowerCase()}`]=JSON.stringify(r)}return r.captureUri&&t?.uri&&(n[`${zx}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${zx}.name`]=JSON.stringify(t.name)),n}function VS(e){return typeof e==`string`?e:JSON.stringify(e)}function HS(e,t,n){let r={};switch(e){case`notifications/cancelled`:t?.requestId&&(r[`mcp.cancelled.request_id`]=String(t.requestId)),t?.reason&&(r[`mcp.cancelled.reason`]=String(t.reason));break;case`notifications/message`:t?.level&&(r[Bx]=String(t.level)),t?.logger&&(r[Vx]=String(t.logger)),t?.data!==void 0&&(r[Hx]=typeof t.data,n&&(r[Ux]=VS(t.data)));break;case`notifications/progress`:t?.progressToken&&(r[`mcp.progress.token`]=String(t.progressToken)),typeof t?.progress==`number`&&(r[`mcp.progress.current`]=t.progress),typeof t?.total==`number`&&(r[`mcp.progress.total`]=t.total,typeof t?.progress==`number`&&(r[`mcp.progress.percentage`]=t.progress/t.total*100)),t?.message&&(r[`mcp.progress.message`]=String(t.message));break;case`notifications/resources/updated`:if(t?.uri){r[Nx]=String(t.uri);let e=cp(String(t.uri));e&&!sp(e)&&(r[`mcp.resource.protocol`]=e.protocol.replace(`:`,``))}break;case`notifications/initialized`:r[`mcp.lifecycle.phase`]=`initialization_complete`,r[`mcp.protocol.ready`]=1}return r}function US(e,t,n,r){if(e===`request`){let e=t,i=zS(e.method,n||{});return{...e.id!==void 0&&{"mcp.request.id":String(e.id)},...i.attributes,...r?BS(e.method,n||{}):{}}}return HS(t.method,n||{},r)}var WS=new Set([Kx,qx,Nx]);function GS(e){return WS.has(e)}function KS(e,t){return t?e:Object.entries(e).reduce((e,[t,n])=>(GS(t)||(e[t]=n),e),{})}function qS(e,t){return t?`${e} ${t}`:e}function JS(e){let t,n;switch(e){case`request`:t=Jx,n=Zx;break;case`notification-incoming`:t=Yx,n=Qx;break;case`notification-outgoing`:t=Xx,n=Qx}return{[F]:t,[I]:n,[Ci]:$x}}function YS(e){let{type:t,message:n,transport:r,extra:i,callback:a,options:o}=e,{method:s}=n,c=n.params,l;l=t===`request`?qS(s,zS(s,c||{}).target):s;let u=KS({...jS(r,i),[Ex]:s,...US(t,n,c,o?.recordInputs),...JS(t)},!!P()?.getDataCollectionOptions().userInfo);return z({name:l,forceTransaction:!0,attributes:u},a)}function XS(e,t,n,r,i){return YS({type:`notification-incoming`,message:e,transport:t,extra:n,callback:i,options:r})}function ZS(e,t,n,r){return YS({type:`notification-outgoing`,message:e,transport:t,options:n,callback:r})}function QS(e,t,n,r){let{method:i}=e,a=e.params;return{name:qS(i,zS(i,a||{}).target),op:Jx,forceTransaction:!0,attributes:KS({...jS(t,n),[Ex]:i,...US(`request`,e,a,r?.recordInputs),...JS(`request`)},!!P()?.getDataCollectionOptions().userInfo)}}function $S(e){if(e.recordInputs!==void 0&&e.recordOutputs!==void 0)return{recordInputs:e.recordInputs,recordOutputs:e.recordOutputs};let t=P()?.getDataCollectionOptions().genAI;return{recordInputs:e.recordInputs??t?.inputs??!1,recordOutputs:e.recordOutputs??t?.outputs??!1}}function eC(e,t){e.onmessage&&Hn(e,`onmessage`,n=>function(r,i){let a=eS(r)?r:void 0,o=tS(r)?r:void 0,s=a||o,c;if(s)try{c=a?.method===`initialize`?xS(a):SS(s),(c.protocolVersion||c.clientInfo)&&fS(e,c)}catch{}if(a){let r=$S(t);return xi(N().clone(),()=>{let t=B(QS(a,e,i,r));return a.method===`initialize`&&c&&t.setAttributes({...ES(c.clientInfo),...c.protocolVersion&&{"mcp.protocol.version":c.protocolVersion}}),FS(e,a.id,t,a.method,r),V(t,()=>n.call(this,a,i))})}return o?XS(o,e,i,$S(t),()=>n.call(this,o,i)):n.call(this,r,i)})}function tC(e,t){e.send&&Hn(e,`send`,n=>async function(...r){let[i]=r;return tS(i)?ZS(i,e,$S(t),()=>n.call(this,...r)):(nS(i)&&i.id!==null&&i.id!==void 0&&(i.error&&iC(i.error),IS(e,i.id,i.result,!!i.error)),n.call(this,...r))})}function nC(e){e.onclose&&Hn(e,`onclose`,t=>function(...n){return LS(e),gS(e),t.call(this,...n)})}function rC(e){e.onerror&&Hn(e,`onerror`,e=>function(t){return aC(t),e.call(this,t)})}function iC(e){try{if(j(e)&&`code`in e&&`message`in e){let t=e;if(t.code===-32603||t.code>=-32099&&t.code<=-32e3){let e=Error(t.message);e.name=`JsonRpcError_${t.code}`,gx(e,`protocol`)}}}catch{}}function aC(e){try{gx(e,`transport`)}catch{}}var oC=new WeakSet;function sC(e,t){if(oC.has(e)||!rS(e))return e;let n=e,r={...t};return Hn(n,`connect`,e=>async function(t,...n){let i=await e.call(this,t,...n);return eC(t,r),tC(t,r),nC(t),rC(t),i}),wx(n),Tx(n),oC.add(e),e}function cC(e,t=!1){return!(t||e&&!e.startsWith(`/`)&&!e.match(/^[A-Z]:/)&&!e.startsWith(`.`)&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes(`node_modules/`)}function lC(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let a=i.match(r);if(a)return{filename:`<data:${a[2]}>`,function:a[1]};let o=i.match(n);if(o){let t,n,r,i,a;if(o[1]){r=o[1];let e=r.lastIndexOf(`.`);if(r[e-1]===`.`&&e--,e>0){t=r.slice(0,e),n=r.slice(e+1);let i=t.indexOf(`.Module`);i>0&&(r=r.slice(i+1),t=t.slice(0,i))}i=void 0}n&&(i=t,a=n),n===`<anonymous>`&&(a=void 0,r=void 0),r===void 0&&(a||=`?`,r=i?`${i}.${a}`:a);let s=wn(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?fC(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:dC(o[3]),colno:dC(o[4]),in_app:cC(s||``,c)}}if(i.match(t))return{filename:i}}}function uC(e){return[90,lC(e)]}function dC(e){return parseInt(e||``,10)||void 0}function fC(e){try{return decodeURI(e)}catch{return}}var pC=new WeakMap,mC=(e,t)=>{let n=pC.get(e);n?n.push(t):pC.set(e,[t])},hC=e=>{let t=pC.get(e);return t||(t=[],pC.set(e,t)),t},gC=`express.name`,_C=`http.route`,vC=`express.type`,yC=`router`,bC=`middleware`,xC=`request_handler`,SC=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function CC(e){return e.includes(`:`)||e.includes(`*`)}var wC=(e,t,n)=>{if(t.name===`router`){let r=TC(``,t)||n||e||`/`;return{attributes:{[gC]:r,[vC]:yC},name:`router - ${r}`}}return t.name===`bound dispatch`||t.name===`handle`?{attributes:{[gC]:(e||n)??`request handler`,[vC]:xC},name:`request handler${t.path?` - ${e||n}`:``}`}:{attributes:{[gC]:t.name,[vC]:bC},name:`middleware - ${t.name}`}},TC=(e,t)=>{let n=Array.isArray(t.handle?.stack)?t.handle?.stack?.[0]:void 0;return n?.route?.path?`${e}${n.route.path}`:n&&Array.isArray(n?.handle?.stack)?TC(e,n):e},EC=(e,t,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(t))return!0;if(!Array.isArray(n?.ignoreLayers))return!1;try{return yr(e,n.ignoreLayers,!0)}catch{}return!1};function DC(e,t){let n=hC(e);if(n.length===0)return;if(n.every(e=>e===`/`))return e.originalUrl===`/`?`/`:void 0;if(t===`*`||t.includes(`/`)&&(t.includes(`,`)||t.includes(`\\`)||t.includes(`*`)||t.includes(`[`)))return t;let r=t.startsWith(`/`)?t:`/${t}`;return r.length>0&&(e.originalUrl===r||e.originalUrl.startsWith(r)||CC(r))?r:void 0}function OC(e){let t=hC(e),n=``;for(let e of t)e!==`/`&&e!==`/*`&&(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}var kC=e=>{let t=e[0];return Array.isArray(t)?t.map(e=>AC(e)||``).join(`,`):AC(t)},AC=e=>typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0,jC=e=>MC(e?.Router?.prototype),MC=e=>(typeof e==`object`||typeof e==`function`)&&!!e&&`route`in e&&typeof e.route==`function`,NC=e=>MC(e.Router)&&!jC(e);function PC(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function FC(e){return PC(e)>=500}function IC(e){if(!N()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let t=Ap(e);N().setSDKProcessingMetadata({normalizedRequest:t})}}function LC(e,t,n){if(!t?.handle)return;let r=t,i=r.handle;if(Kn(i)||i.length===4)return;function a(t,a,...o){let s=e();IC(t);let c=R();if(!c)return i.apply(this,[t,a,...o]);n&&mC(t,n);let l=hC(t),u=!!n,d=OC(t),f=DC(t,d);s.onRouteResolved?.(f);let p=wC(d,r,n),m=p.attributes[gC],h=p.attributes[vC],g=Object.assign(p.attributes,{[I]:`auto.http.express`,[F]:`${h}.express`});if(f&&(g[_C]=f),EC(p.attributes[`express.name`],h,s))return u&&l.pop(),i.apply(this,[t,a,...o]);let _=N();if(_!==$r()){if(h===`request_handler`){let e=t.method?t.method.toUpperCase():`GET`;_.setTransactionName(`${e} ${d}`)}}else D&&A.warn(`Isolation scope is still default isolation scope - skipping setting transactionName`);return ts({name:m,attributes:g},e=>{let n=!1;p.attributes[`express.type`]===`router`&&(e.end(),n=!0);let r=()=>{n||(n=!0,e.end())};for(let i=0;i<o.length;i++){let s=o[i];if(typeof s==`function`){o[i]=function(...i){let o=i[0],d=!!o&&o!==`route`&&o!==`router`;if(!n&&d){let[t,n]=SC(o);e.setStatus({code:2,message:n})}return n||(n=!0,a.removeListener(`finish`,r),e.end()),!(t.route&&d)&&u&&l.pop(),V(c,()=>s.apply(this,i))};break}}try{return i.apply(this,[t,a,...o])}catch(t){let[n,r]=SC(t);throw e.setStatus({code:2,message:r}),t}finally{n||a.once(`finish`,r)}})}for(let e in i)e in a||Object.defineProperty(a,e,{get(){return i[e]},set(t){i[e]=t}});Wn(a,i),Object.defineProperty(r,"handle",{enumerable:!0,configurable:!0,writable:!0,value:a})}function RC(e){return!!e&&typeof e==`object`&&`default`in e&&e.default||e}function zC(e){return!!e.express}var BC=!1;function VC(){BC||(BC=!0,D&&A.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function HC(e,t){let n,r;if(!t&&zC(e)){let{express:t,...i}=e;r=t,n=()=>i,VC()}else if(typeof t!=`function`)throw TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");else n=t,r=e;let i=RC(r),a=jC(i)?i.Router.prototype:NC(i)?i.Router:void 0;if(!a)throw TypeError(`no valid Express route function to instrument`);let o=a.route;try{Gn(a,`route`,function(...e){let t=o.apply(this,e),r=this.stack[this.stack.length-1];return LC(n,r,kC(e)),t})}catch(e){D&&A.error(`Failed to patch express route method:`,e)}let s=a.use;try{Gn(a,`use`,function(...e){let t=s.apply(this,e),r=this.stack[this.stack.length-1];return r&&LC(n,r,kC(e)),t})}catch(e){D&&A.error(`Failed to patch express use method:`,e)}let{application:c}=i,l=c.use;try{Gn(c,`use`,function(...e){let t=l.apply(this,e),r=jC(i)?this.router:this._router;if(r){let t=r.stack[r.stack.length-1];t&&LC(n,t,kC(e))}return t})}catch(e){D&&A.error(`Failed to patch express application.use method:`,e)}return i}function UC(){return P()?.getIntegrationByName(`Express`)?.getShouldHandleError?.()}function WC(e){return function(t,n,r,i){IC(n);let a=e?.shouldHandleError??UC()??FC;if(a===!1){i(t);return}a(t)&&(r.sentry=H(t,{mechanism:{type:`auto.middleware.express`,handled:!1}})),i(t)}}function GC(e,t){e.use(KC()),e.use(WC(t))}function KC(){return function(e,t,n){IC(e),n()}}var qC=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,JC=Symbol(`sentryPostgresConnectionContext`),YC=Symbol.for(`sentry.instrumented.postgresjs`),XC=Symbol.for(`sentry.query.from.instrumented.sql`);function ZC(e,t){return!e||typeof e!=`function`?(D&&A.warn(`instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance`),e):QC(e,{requireParentSpan:!0,...t})}function QC(e,t,n){if(e[YC])return e;let r=new Proxy(e,{apply(e,n,i){let a=Reflect.apply(e,n,i);return j(a)&&`handle`in a&&tw(a,r,t),a},get(e,n){let i=e[n];return typeof n!=`string`||typeof i!=`function`?i:n===`unsafe`||n===`file`?$C(i,e,r,t):n===`begin`||n===`reserve`?ew(i,e,r,t):i}});return n?r[JC]=n:lw(e,r),e[YC]=!0,r[YC]=!0,r}function $C(e,t,n,r){return function(...i){let a=Reflect.apply(e,t,i);return j(a)&&`handle`in a&&tw(a,n,r),a}}function ew(e,t,n,r){return function(...i){let a=n[JC];if(typeof i[i.length-1]!=`function`){let n=Reflect.apply(e,t,i);return n&&typeof n.then==`function`?n.then(e=>QC(e,r,a)):n}let o=i.length===1?i[0]:i[1],s=function(e){let t=QC(e,r,a);return o(t)},c=i.length===1?[s]:[i[0],s];return Reflect.apply(e,t,c)}}function tw(e,t,n){if(e.handle?.__sentryWrapped)return;e[XC]=!0;let r=e.handle,i=async function(...i){if(this.executed||!nw(n))return r.apply(this,i);let a=aw(rw(e.strings));return ts({name:a||`postgresjs.query`,op:`db`},e=>{e.setAttribute(I,`auto.db.postgresjs`),e.setAttributes({"db.system.name":`postgres`,"db.query.text":a});let o=t?t[JC]:void 0;if(ow(e,o),n.requestHook)try{n.requestHook(e,a,o)}catch(t){e.setAttribute(`sentry.hook.error`,`requestHook failed`),D&&A.error(`Error in requestHook for PostgresJs instrumentation:`,t)}let s=this;s.resolve=new Proxy(s.resolve,{apply:(t,n,r)=>{try{sw(e,a,r?.[0]?.command),e.end()}catch(e){D&&A.error(`Error ending span in resolve callback:`,e)}return Reflect.apply(t,n,r)}}),s.reject=new Proxy(s.reject,{apply:(t,n,r)=>{try{e.setStatus({code:2,message:r?.[0]?.message||`unknown_error`}),e.setAttribute(`db.response.status_code`,r?.[0]?.code||`unknown`),e.setAttribute(`error.type`,r?.[0]?.name||`unknown`),sw(e,a),e.end()}catch(e){D&&A.error(`Error ending span in reject callback:`,e)}return Reflect.apply(t,n,r)}});try{return r.apply(this,i)}catch(t){throw e.setStatus({code:2,message:t instanceof Error?t.message:`unknown_error`}),e.end(),t}})};i.__sentryWrapped=!0,e.handle=i}function nw(e){return R()!==void 0||!e.requireParentSpan}function rw(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((e,t,n)=>n===0?t:`${e}$${n}${t}`,``)}var iw;function aw(e){return e?(iw||=RegExp(`(?<!\\$)-?\\b\\d+\\b`,`g`),e.replace(/--.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``).replace(/;\s*$/,``).replace(/\s+/g,` `).trim().replace(/\bX'[0-9A-Fa-f]*'/gi,`?`).replace(/\bB'[01]*'/gi,`?`).replace(/'(?:[^']|'')*'/g,`?`).replace(/\b0x[0-9A-Fa-f]+/gi,`?`).replace(/\b(?:TRUE|FALSE)\b/gi,`?`).replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,`?`).replace(/-?\b\d+\.\d+\b/g,`?`).replace(/-?\.\d+\b/g,`?`).replace(iw,`?`).replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,`IN (?)`).replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,`IN ($?)`)):`Unknown SQL Query`}function ow(e,t){if(t&&(t.ATTR_DB_NAMESPACE&&e.setAttribute(`db.namespace`,t.ATTR_DB_NAMESPACE),t.ATTR_SERVER_ADDRESS&&e.setAttribute(`server.address`,t.ATTR_SERVER_ADDRESS),t.ATTR_SERVER_PORT!==void 0)){let n=parseInt(t.ATTR_SERVER_PORT,10);isNaN(n)||e.setAttribute(`server.port`,n)}}function sw(e,t,n){if(n){e.setAttribute(`db.operation.name`,n);return}let r=t?.match(qC);r?.[1]&&e.setAttribute(`db.operation.name`,r[1].toUpperCase())}function cw(e){let t=e.host?.[0]||`localhost`,n=e.port?.[0]||5432;return{ATTR_DB_NAMESPACE:typeof e.database==`string`&&e.database!==``?e.database:void 0,ATTR_SERVER_ADDRESS:t,ATTR_SERVER_PORT:String(n)}}function lw(e,t){let n=e;n.options&&typeof n.options==`object`&&(t[JC]=cw(n.options))}var uw=`http.client.request.created`,dw=`http.server.request.start`;function fw(e){let t=e.host||``,n=/^(.*):(\d+)$/.exec(t),r=n?n[1]:t,i=e.port??(n?Number(n[2]):void 0);return{method:e.method,port:i,protocol:e.protocol,host:e.host,hostname:r,path:e.path,headers:e.getHeaders()}}function pw(e){try{return String(mw(e))}catch{return``}}function mw(e){let t=e.protocol||`http:`,n=e.headers?.host&&String(e.headers?.host)||e.hostname||e.host||``,r=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(n)?``:`:${e.port}`,i=e.path?e.path:`/`,a=`${t}//${n}${r}`;return new URL(i.startsWith(`//`)?`${a}${i}`:i,a)}function hw(e){return String(pw(fw(e)))}function gw(e,t){let n=fp(hw(e)),r=t?.statusCode,i=sx(r);zp({category:`http`,data:{status_code:r,url:mp(n),"http.method":e.method||`GET`,...n.search?{"http.query":n.search}:{},...n.hash?{"http.fragment":n.hash}:{}},type:`http`,level:i},{event:`response`,request:e,response:t})}function _w(e){let t=hw(e),[n,r]=dp(cp(t),`client`,`auto.http.client`,e),i=e.getHeader(`user-agent`);return{name:n,attributes:{[F]:`http.client`,"otel.kind":`CLIENT`,"http.url":t,"http.method":e.method,"http.target":e.path||`/`,"net.peer.name":e.host,"http.host":e.getHeader(`host`),...i?{"user_agent.original":i}:{},...r},onlyIfParent:!0}}function vw(e,t){let{statusCode:n,statusMessage:r,httpVersion:i,socket:a}=e,o=i?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`;t.setAttributes({"http.response.status_code":n,"network.protocol.version":i,"http.flavor":i,"network.transport":o,"net.transport":o,"http.status_text":r?.toUpperCase(),"http.status_code":n,...bw(e),...yw(a)})}function yw(e){if(!e)return{};let{remoteAddress:t,remotePort:n}=e;return{"network.peer.address":t,"network.peer.port":n,"net.peer.ip":t,"net.peer.port":n}}function bw(e){let{headers:t}=e,n=t[`content-length`],r=n?parseInt(String(n),10):-1,i=t[`content-encoding`];return r>=0?i&&i!==`identity`?{"http.response_content_length":r}:{"http.response_content_length_uncompressed":r}:{}}function xw(e,t){let n=hw(e),{tracePropagationTargets:r,propagateTraceparent:i}=P()?.getOptions()??{};if(!Cp(n,r,t)||e.getHeader(`sentry-trace`))return;let a=yp({propagateTraceparent:i});if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(o)try{e.setHeader(`sentry-trace`,o),D&&A.log(`@sentry/instrumentation-http`,`Added sentry-trace header`)}catch(e){D&&A.error(`@sentry/instrumentation-http`,`Failed to set sentry-trace header:`,jn(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),D&&A.log(`@sentry/instrumentation-http`,`Added traceparent header`)}catch(e){D&&A.error(`@sentry/instrumentation-http`,`Failed to set traceparent header:`,jn(e)?e.message:`Unknown error`)}if(s){let t=la(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),D&&A.log(`@sentry/instrumentation-http`,`Added baggage header`)}catch(e){D&&A.error(`@sentry/instrumentation-http`,`Failed to set baggage header:`,jn(e)?e.message:`Unknown error`)}}}var Sw=e=>typeof e.__unwrap==`function`,Cw=`Double-wrapped http.client detected. Either disable spans in Sentry.httpIntegration, or disable the OpenTelemetry HTTP instrumentation. See: https://docs.sentry.io/platforms/javascript/guides/express/opentelemetry/custom-setup/#custom-http-instrumentation`,ww=!1,Tw=D?e=>{ww||(Sw(e.request)||Sw(e.get))&&(ww=!0,A.warn(Cw))}:()=>{};function Ew(e){let t=new lx(100),n=()=>P()?.getOptions(),r=r=>{if(M().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__===!0)return;let i=n(),{errorMonitor:a=`error`,spans:o=!i||to(i),propagateTrace:s=!1,breadcrumbs:c=!0,http:l,https:u,suppressOtelWarning:d=!1}=e,{request:f}=r;if(e.ignoreOutgoingRequests?.(hw(f),f))return;let p=!1;function m(e,t){p||(p=!0,gw(e,t))}function h(e){e.on(a,()=>m(e,void 0)),e.prependListener(`response`,t=>{e.listenerCount(`response`)<=1&&t.resume(),t.on(`end`,()=>m(e,t)),t.on(a,()=>m(e,t))})}if(!o){c&&h(f),s&&xw(f,t);return}d||(l&&Tw(l),u&&Tw(u));let g=B(_w(f));e.outgoingRequestHook?.(g,f),s&&(g.isRecording()?V(g,()=>{xw(f,t)}):xw(f,t));let _=!1;function v(e){_||(_=!0,g.setStatus(e),g.end())}let y=()=>v({code:0});f.on(`close`,y),f.on(a,e=>{D&&A.log(`@sentry/instrumentation-http`,`outgoingRequest on request error()`,e),c&&m(f,void 0),v({code:2})}),f.prependListener(`response`,t=>{f.removeListener(`close`,y),f.listenerCount(`response`)<=1&&t.resume(),vw(t,g),As(t),e.outgoingResponseHook?.(g,t);let n=!1;function r(r){if(!n){n=!0,r&&D&&A.log(`@sentry/instrumentation-http`,`outgoingRequest on response error()`,r),c&&m(f,t);let i=t.aborted&&!t.complete,a=r||typeof t.statusCode!=`number`||i?{code:2}:Hi(t.statusCode);e.applyCustomAttributesOnSpan?.(g,f,t),v(a)}}t.on(`end`,()=>r()),t.on(a,r)})};return{[uw]:r}}var Dw;function Ow(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!=`function`||(Dw=Ew({...t,http:e})[uw],Kn(n._storeHeader)))return;let r=n._storeHeader;Gn(n,`_storeHeader`,function(...e){try{Dw({request:this},uw)}catch{}return r.apply(this,e)})}function kw(e,t={}){return Ow(RC(e),t),e}var Aw=(e,t={})=>kw(e,t);function jw(e,t,n,r){let i=0,a=[];D&&A.log(r,`Patching request.on`);let o=new WeakMap,s=Dp(n);try{e.on=e.addListener=new Proxy(e.on,{apply:(e,t,n)=>{let[c,l,...u]=n;if(c===`data`){D&&A.log(r,`Handling request.on("data") with maximum body size of ${s}b`);let n=new Proxy(l,{apply:(e,t,n)=>{try{let e=n[0],t=Buffer.from(e);i<s?(a.push(t),i+=t.byteLength):D&&A.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{D&&A.error(r,`Encountered error while storing body chunk.`)}return Reflect.apply(e,t,n)}});return o.set(l,n),Reflect.apply(e,t,[c,n,...u])}return Reflect.apply(e,t,n)}}),e.off=e.removeListener=new Proxy(e.off,{apply:(e,t,n)=>{let[,r]=n,i=o.get(r);if(i){o.delete(r);let a=n.slice();return a[1]=i,Reflect.apply(e,t,a)}return Reflect.apply(e,t,n)}}),e.on(`end`,()=>{try{let e=Buffer.concat(a).toString(`utf-8`);if(e){let n=Buffer.byteLength(e,`utf-8`)>s?`${Buffer.from(e).subarray(0,s-3).toString(`utf-8`)}...`:e;t.setSDKProcessingMetadata({normalizedRequest:{data:n}})}}catch(e){D&&A.error(r,`Error building captured request body`,e)}})}catch(e){D&&A.error(r,`Error patching request to capture body`,e)}}var Mw=new WeakMap;function Nw(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:`ok`}}),n.once(`close`,()=>{let n=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&n){D&&A.log(`Recorded request session with status: ${n.status}`);let t=new Date($n());t.setSeconds(0,0);let i=t.toISOString(),a=Mw.get(e),o=a?.[i]||{exited:0,crashed:0,errored:0};if(o[{ok:`exited`,crashed:`crashed`,errored:`errored`}[n.status]]++,a)a[i]=o;else{D&&A.log(`Opened new request session aggregate.`);let t={[i]:o};Mw.set(e,t);let n=()=>{clearTimeout(s),a(),Mw.delete(e);let n=Object.entries(t).map(([e,t])=>({started:e,exited:t.exited,errored:t.errored,crashed:t.crashed}));e.sendSession({aggregates:n})},a=e.on(`flush`,()=>{D&&A.log(`Sending request session aggregate due to client flush`),n()}),s=setTimeout(()=>{D&&A.log(`Sending request session aggregate due to flushing schedule`),n()},r);md(s)}}})}var Pw=`Http.Server`,Fw=`Http.SentryServerSpans`,Iw=new WeakMap,Lw=Symbol.for(`sentry_http_server_instrumented`);function Rw(e){return!e[Lw]&&(e[Lw]=!0)}function zw(e,t){let n=t.emit;if(n===Iw.get(t))return;let r=new Proxy(n,{apply(t,n,r){let[i,...a]=r;if(i!==`request`)return t.apply(n,r);let o=P(),[s,c]=a;if(!o||!Rw(s))return t.apply(n,r);D&&A.log(Pw,`Handling incoming request`);let l=N().clone();l.setClient(o);let u=s.socket?.remoteAddress,d=s.url||`/`,f=Ap(s),{maxRequestBodySize:p=`medium`,ignoreRequestBody:m,sessions:h=!0,sessionFlushingDelayMS:g=6e4}=e;p!==`none`&&!m?.(d,s)&&jw(s,l,p,Pw),l.setSDKProcessingMetadata({normalizedRequest:f,ipAddress:u});let _=`${(s.method||`GET`).toUpperCase()} ${pp(d)}`;return l.setTransactionName(_),h&&Nw(o,{requestIsolationScope:l,response:c,sessionFlushingDelayMS:g??6e4}),xi(l,()=>{let i=f.headers?.[`sentry-trace`],a=f.headers?.baggage,o=Array.isArray(i)?i[0]:i;return is({sentryTrace:o,baggage:Array.isArray(a)?a[0]:a},()=>{let i=M().getPropagationContext();i.propagationSpanId=Wr(),o||(i.traceId=Ur(),i.sampleRand=Qn()),c.once(`close`,()=>{l.setContext(`response`,{status_code:c.statusCode})});let a=e.wrapServerEmitRequest,u=!1;return a?a(s,c,f,()=>{u=t.apply(n,r)}):u=t.apply(n,r),u})})}});Iw.set(t,r),t.emit=r}function Bw(e){let t=e.wrapServerEmitRequest,n=Vw(e),r={...e,wrapServerEmitRequest(r,i,a,o){let s=P()?.getOptions();e.spans??(s?to(s):!1)?n(r,i,a,o):t?t(r,i,a,o):o()}},i=e=>{let{server:t}=e;zw(r,t)};return{[dw]:i}}function Vw(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:i,errorMonitor:a=`error`,onSpanEnd:o}=e;return(e,s,c,l)=>{return typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__?l():t?t(e,s,c,u):u();function u(){let t=N().getClient();if(!t)return l();if(Hw(e,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return D&&A.log(Fw,`Skipping span creation for incoming request`,e.url),l();let u=c.url||e.url||`/`,d=cp(u),f=d?d.pathname:pp(u),p=(e.method||`GET`).toUpperCase(),m=`${p} ${f}`,h=e.headers,g=h[`user-agent`],_=h[`x-forwarded-for`],v=e.httpVersion,y=h.host,ee=y?.replace(/^(.*)(:[0-9]{1,5})/,`$1`)||`localhost`,te=u.startsWith(`https`)?`https`:`http`,{socket:ne}=e,{localAddress:re,localPort:ie,remoteAddress:ae,remotePort:oe}=ne??{};return ts({name:m,kind:G.SERVER,attributes:{[F]:`http.server`,[I]:`auto.http.server`,[Ci]:`url`,"http.route":f,"otel.kind":`SERVER`,"net.host.ip":re,"net.host.port":ie,"net.peer.ip":ae,"net.peer.port":oe,"sentry.http.prefetch":Ww(e)||void 0,[uu]:d&&!sp(d)?d.href:void 0,[du]:d?.pathname??f,[El]:u,"http.method":p,"http.target":d?`${d.pathname}${d.search}`:f,"http.host":y,"net.host.name":ee,"http.client_ip":typeof _==`string`?_.split(`,`)[0]:void 0,"http.user_agent":g,"http.scheme":te,"http.flavor":v,"net.transport":v?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,...Gw(e),...Mp(c.headers||{},t.getDataCollectionOptions())}},n=>{i?.(n,e,s);let r=!1;function c(i){r||(r=!0,n.setAttributes({"http.status_text":s.statusMessage?.toUpperCase(),"http.response.status_code":s.statusCode,"http.status_code":s.statusCode,...Mp(kp(s.headers),t?.getDataCollectionOptions()??!1,`response`)}),n.setStatus(i),o?.(n,e,s),n.end())}s.once(`close`,()=>{c(Hi(s.statusCode))}),s.once(a,()=>{let e=Hi(s.statusCode);c(e.code===2?e:{code:2})}),l()})}}}function Hw(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&Uw(r)||n?.(r,e))}function Uw(e){let t=pp(e);return!!(t.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||t.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function Ww(e){return e.headers[`next-router-prefetch`]===`1`}function Gw(e){let{headers:t}=e,n=t[`content-length`],r=n?parseInt(String(n),10):-1,i=t[`content-encoding`];return r>=0?i&&i!==`identity`?{"http.request_content_length":r}:{"http.request_content_length_uncompressed":r}:{}}var Kw=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;b();var qw=o(`sentry_http_server_instrumented`),Jw=`Http.Server`;function Yw(e,t){Un(e,`_startSpanCallback`,new WeakRef(t))}var Xw=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??`medium`,spans:!1,ignoreRequestBody:e.ignoreRequestBody,wrapServerEmitRequest(e,t,n,i){let a=P();if(!a||r.active().getValue(qw))return i();let o=d.extract(r.active(),n.headers).setValue(qw,!0);r.with(o,()=>{a.emit(`httpServerRequest`,e,t,n);let r=e._startSpanCallback?.deref();r?r(()=>(i(),!0)):i()})}};return{name:Jw,setupOnce(){let{[dw]:e}=Bw(t);qe(dw,e)},afterAllSetup(e){Kw&&e.getIntegrationByName(`Http`)&&A.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}});b();var Zw=`Http.ServerSpans`,Qw=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,i=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:a}=e,{requestHook:o,responseHook:s,applyCustomAttributesOnSpan:c}=e.instrumentation??{};return{name:Zw,setup(e){typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__||e.on(`httpServerRequest`,(i,l,u)=>{let d=i,f=l;Yw(d,i=>{if(tT(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return Kw&&A.log(Zw,`Skipping span creation for incoming request`,d.url),i();let l=u.url||d.url||`/`,p=cp(l),m=d.headers,h=m[`user-agent`],g=m[`x-forwarded-for`],_=d.httpVersion,v=m.host,y=v?.replace(/^(.*)(:[0-9]{1,5})/,`$1`)||`localhost`,ee=l.startsWith(`https`)?`https`:`http`,te=u.method||d.method?.toUpperCase()||`GET`,ne=p?p.pathname:pp(l),re=B({name:`${te} ${ne}`,kind:G.SERVER,attributes:{[F]:`http.server`,[I]:`auto.http.otel.http`,[$l]:$w(d)||void 0,[uu]:p&&!sp(p)?p.href:void 0,[du]:p?.pathname??ne,[El]:l,[yl]:u.method,[Tl]:p?`${p.pathname}${p.search}`:ne,[vl]:v,[Hl]:y,[gl]:typeof g==`string`?g.split(`,`)[0]:void 0,[Dl]:h,[Cl]:ee,[_l]:_,[ql]:_?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,...nT(d),...Mp(u.headers||{},e.getDataCollectionOptions())}});o?.(re,d),s?.(re,f),c?.(re,d,f),a?.(re,d,f);let ie={type:Tt.HTTP,span:re};return V(re,()=>r.with(Et(r.active(),ie),()=>{As(d),As(f);let e=!1;function t(t){if(e)return;e=!0;let n=aT(d,f,ie);re.setAttributes(n),re.setStatus(t),re.end();let r=n[`http.route`];r&&N().setTransactionName(`${d.method?.toUpperCase()||`GET`} ${r}`)}return f.on(`close`,()=>{t(Hi(f.statusCode))}),f.on(Se,()=>{let e=Hi(f.statusCode);t(e.code===2?e:{code:2})}),i()}))})})},processEvent(e){if(e.type===`transaction`){let t=e.contexts?.trace?.data?.[`http.response.status_code`];if(typeof t==`number`){if(oT(t,i))return Kw&&A.log(`Dropping transaction due to status code`,t),null;e.contexts={...e.contexts,response:{...e.contexts?.response,status_code:t}}}}return e},afterAllSetup(e){Kw&&(e.getIntegrationByName(`Http`)&&A.warn("It seems that you have manually added `httpServerSpansIntegration` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),e.getIntegrationByName(`Http.Server`)||A.error("It seems that you have manually added `httpServerSpansIntegration` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}});function $w(e){return e.headers[`next-router-prefetch`]===`1`}function eT(e){let t=pp(e);return!!(t.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||t.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function tT(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(os())return!0;let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&eT(r)||n?.(r,e))}function nT(e){let t=rT(e.headers);return t==null?{}:iT(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function rT(e){let t=e[`content-length`];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function iT(e){let t=e[`content-encoding`];return!!t&&t!==`identity`}function aT(e,t,n){let{socket:r}=e,{statusCode:i,statusMessage:a}=t,o={[xl]:i,[wl]:i,"http.status_text":a?.toUpperCase()};if(r){let{localAddress:e,localPort:t,remoteAddress:n,remotePort:i}=r;o[Vl]=e,o[Ul]=t,o[Wl]=n,o[Kl]=i}return o[wl]=i,o[`http.status_text`]=(a||``).toUpperCase(),n?.type===Tt.HTTP&&n.route!==void 0&&(o[Sl]=n.route),o}function oT(e,t){return t.some(t=>{if(typeof t==`number`)return t===e;let[n,r]=t;return e>=n&&e<=r})}var sT=class{emit(e){}enabled(){return!1}},cT=new sT,lT=Symbol.for(`io.opentelemetry.js.api.logs`),uT=globalThis;function dT(e,t,n){return r=>r===e?t:n}var fT=new class{getLogger(e,t,n){return new sT}},pT=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):cT}},mT=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new pT(this,e,t,n)}_getDelegate(){return this._delegate??fT}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},hT=class e{constructor(){this._proxyLoggerProvider=new mT}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return uT[lT]?this.getLoggerProvider():(uT[lT]=dT(1,e,fT),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return uT[lT]?.call(uT,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete uT[lT],this._proxyLoggerProvider=new mT}}.getInstance();function gT(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function _T(e){e.forEach(e=>e.disable())}b();function vT(e){let t=e.tracerProvider||g.getTracerProvider(),n=e.meterProvider||se.getMeterProvider(),r=e.loggerProvider||hT.getLoggerProvider(),i=e.instrumentations?.flat()??[];return gT(i,t,n,r),()=>{_T(i)}}b();var yT=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,bT=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,xT={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function ST(e,t,n){if(!CT(e))return f.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,`$1`);let r=AT(e);if(!r)return!1;let i=[],a=wT(r,t,i,n);return a&&!n?.includePrerelease?DT(r,i):a}function CT(e){return typeof e==`string`&&yT.test(e)}function wT(e,t,n,r){if(t.includes(`||`)){let i=t.trim().split(`||`);for(let t of i)if(TT(e,t,n,r))return!0;return!1}if(t.includes(` - `))t=iE(t,r);else if(t.includes(` `)){let i=t.trim().replace(/\s{2,}/g,` `).split(` `);for(let t of i)if(!TT(e,t,n,r))return!1;return!0}return TT(e,t,n,r)}function TT(e,t,n,r){if(t=OT(t,r),t.includes(` `))return wT(e,t,n,r);{let r=jT(t);return n.push(r),ET(e,r)}}function ET(e,t){if(t.invalid)return!1;if(!t.version||MT(t.version))return!0;let n=IT(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],i=t.prereleaseSegments||[];n=!r.length&&!i.length?0:!r.length&&i.length?1:r.length&&!i.length?-1:IT(r,i)}return xT[t.op]?.includes(n)}function DT(e,t){return!e.prerelease||t.some(t=>t.prerelease&&t.version===e.version)}function OT(e,t){return e=e.trim(),e=nE(e,t),e=tE(e),e=rE(e,t),e=e.trim(),e}function kT(e){return!e||e.toLowerCase()===`x`||e===`*`}function AT(e){let t=e.match(yT);if(!t){f.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,i=t.groups.build,a=n.split(`.`),o=r?.split(`.`);return{op:void 0,version:n,versionSegments:a,versionSegmentCount:a.length,prerelease:r,prereleaseSegments:o,prereleaseSegmentCount:o?o.length:0,build:i}}function jT(e){if(!e)return{};let t=e.match(bT);if(!t)return f.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,i=t.groups.prerelease,a=t.groups.build,o=r.split(`.`),s=i?.split(`.`);return n===`==`&&(n=`=`),{op:n||`=`,version:r,versionSegments:o,versionSegmentCount:o.length,prerelease:i,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:a}}function MT(e){return e===`*`||e===`x`||e===`X`}function NT(e){let t=parseInt(e,10);return isNaN(t)?e:t}function PT(e,t){if(typeof e==typeof t){if(typeof e==`number`||typeof e==`string`)return[e,t];throw Error(`Version segments can only be strings or numbers`)}return[String(e),String(t)]}function FT(e,t){if(MT(e)||MT(t))return 0;let[n,r]=PT(NT(e),NT(t));return n>r?1:n<r?-1:0}function IT(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=FT(e[n]||`0`,t[n]||`0`);if(r!==0)return r}return 0}var LT=`[a-zA-Z0-9-]`,RT=`0|[1-9]\\d*`,zT=`\\d*[a-zA-Z-]${LT}*`,BT=`((?:<|>)?=?)`,VT=`(?:${RT}|${zT})`,HT=`(?:-(${VT}(?:\\.${VT})*))`,UT=`${LT}+`,WT=`(?:\\+(${UT}(?:\\.${UT})*))`,GT=`${RT}|x|X|\\*`,KT=`[v=\\s]*(${GT})(?:\\.(${GT})(?:\\.(${GT})(?:${HT})?${WT}?)?)?`,qT=`^${BT}\\s*${KT}$`,JT=new RegExp(qT),YT=`^\\s*(${KT})\\s+-\\s+(${KT})\\s*\$`,XT=new RegExp(YT),ZT=`^(?:~>?)${KT}$`,QT=new RegExp(ZT),$T=`^(?:\\^)${KT}$`,eE=new RegExp($T);function tE(e){let t=QT;return e.replace(t,(e,t,n,r,i)=>{let a;return a=kT(t)?``:kT(n)?`>=${t}.0.0 <${+t+1}.0.0-0`:kT(r)?`>=${t}.${n}.0 <${t}.${+n+1}.0-0`:i?`>=${t}.${n}.${r}-${i} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${r} <${t}.${+n+1}.0-0`,a})}function nE(e,t){let n=eE,r=t?.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>{let o;return o=kT(t)?``:kT(n)?`>=${t}.0.0${r} <${+t+1}.0.0-0`:kT(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.0${r} <${+t+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i}-${a} <${+t+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i}${r} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i} <${+t+1}.0.0-0`,o})}function rE(e,t){let n=JT;return e.replace(n,(e,n,r,i,a,o)=>{let s=kT(r),c=s||kT(i),l=c||kT(a),u=l;return n===`=`&&u&&(n=``),o=t?.includePrerelease?`-0`:``,s?e=n===`>`||n===`<`?`<0.0.0-0`:`*`:n&&u?(c&&(i=0),a=0,n===`>`?(n=`>=`,c?(r=+r+1,i=0,a=0):(i=+i+1,a=0)):n===`<=`&&(n=`<`,c?r=+r+1:i=+i+1),n===`<`&&(o=`-0`),e=`${n+r}.${i}.${a}${o}`):c?e=`>=${r}.0.0${o} <${+r+1}.0.0-0`:l&&(e=`>=${r}.${i}.0${o} <${r}.${+i+1}.0-0`),e})}function iE(e,t){let n=XT;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>(n=kT(r)?``:kT(i)?`>=${r}.0.0${t?.includePrerelease?`-0`:``}`:kT(a)?`>=${r}.${i}.0${t?.includePrerelease?`-0`:``}`:o?`>=${n}`:`>=${n}${t?.includePrerelease?`-0`:``}`,c=kT(l)?``:kT(u)?`<${+l+1}.0.0-0`:kT(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t?.includePrerelease?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()))}var aE=console.error.bind(console);function oE(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}var sE=(e,t,n)=>{if(!e||!e[t]){aE(`no original function `+String(t)+` to wrap`);return}if(!n){aE(`no wrapper function`),aE(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){aE(`original object and wrapper must be functions`);return}let i=n(r,t);return oE(i,`__original`,r),oE(i,`__unwrap`,()=>{e[t]===i&&oE(e,t,r)}),oE(i,`__wrapped`,!0),oE(e,t,i),i},cE=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{aE(`must provide one or more modules to patch`),aE(Error().stack);return}if(!(t&&Array.isArray(t))){aE(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{sE(e,t,n)})})},lE=(e,t)=>{if(!e||!e[t]){aE(`no function to unwrap.`),aE(Error().stack);return}let n=e[t];if(!n.__unwrap)aE(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},uE=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{aE(`must provide one or more modules to patch`),aE(Error().stack);return}if(!(t&&Array.isArray(t))){aE(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{lE(e,t)})})};b();var dE=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=f.createComponentLogger({namespace:e}),this._tracer=g.getTracer(e,t),this._meter=se.getMeter(e,t),this._logger=hT.getLogger(e,t),this._updateMetricInstruments()}_wrap=sE;_unwrap=lE;_massWrap=cE;_massUnwrap=uE;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},fE=n(((t,n)=>{var r=e(`path`).sep;n.exports=function(e){var t=e.split(r),n=t.lastIndexOf(`node_modules`);if(n!==-1&&t[n+1]){for(var i=t[n+1][0]===`@`,a=i?t[n+1]+`/`+t[n+2]:t[n+1],o=i?3:2,s=``,c=n+o-1,l=0;l<=c;l++)s+=l===c?t[l]:t[l]+r;for(var u=``,d=t.length-1,f=n+o;f<=d;f++)u+=f===d?t[f]:t[f]+r;return{name:a,basedir:s,path:u}}}})),pE=n(((t,n)=>{var r=e(`path`),i=e(`module`),a=_e()(`require-in-the-middle`),o=fE();n.exports=d,n.exports.Hook=d;var s,c;if(i.isBuiltin)c=i.isBuiltin;else if(i.builtinModules)c=e=>e.startsWith(`node:`)?!0:(s===void 0&&(s=new Set(i.builtinModules)),s.has(e));else throw Error(`'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0`);var l=/([/\\]index)?(\.js)?$/,u=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol(`RitmExports`)}has(t,n){if(this._localCache.has(t))return!0;if(n)return!1;{let n=e.cache[t];return!!(n&&this._kRitmExports in n)}}get(t,n){let r=this._localCache.get(t);if(r!==void 0)return r;if(!n){let n=e.cache[t];return n&&n[this._kRitmExports]}}set(t,n,r){r?this._localCache.set(t,n):t in e.cache?e.cache[t][this._kRitmExports]=n:(a(`non-core module is unexpectedly not in require.cache: "%s"`,t),this._localCache.set(t,n))}};function d(t,n,s){if(!(this instanceof d))return new d(t,n,s);if(typeof t==`function`?(s=t,t=null,n=null):typeof n==`function`&&(s=n,n=null),typeof i._resolveFilename!=`function`){console.error(`Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!`,typeof i._resolveFilename),console.error(`Please report this error as an issue related to Node.js %s at https://github.com/nodejs/require-in-the-middle/issues`,process.version);return}this._cache=new u,this._unhooked=!1,this._origRequire=i.prototype.require;let l=this,p=new Set,m=n?n.internals===!0:!1,h=Array.isArray(t);a(`registering require hook`),this._require=i.prototype.require=function(e){return l._unhooked===!0?(a(`ignoring require call - module is soft-unhooked`),l._origRequire.apply(this,arguments)):g.call(this,arguments,!1)},typeof process.getBuiltinModule==`function`&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(e){return l._unhooked===!0?(a(`ignoring process.getBuiltinModule call - module is soft-unhooked`),l._origGetBuiltinModule.apply(this,arguments)):g.call(this,arguments,!0)});function g(n,u){let d=n[0],g=c(d),_;if(g){if(_=d,d.startsWith(`node:`)){let e=d.slice(5);c(e)&&(_=e)}}else if(u)return a(`call to process.getBuiltinModule with unknown built-in id`),l._origGetBuiltinModule.apply(this,n);else try{_=i._resolveFilename(d,this)}catch(e){return a(`Module._resolveFilename("%s") threw %j, calling original Module.require`,d,e.message),l._origRequire.apply(this,n)}let v,y;if(a(`processing %s module require('%s'): %s`,g===!0?`core`:`non-core`,d,_),l._cache.has(_,g)===!0)return a(`returning already patched cached module: %s`,_),l._cache.get(_,g);let ee=p.has(_);ee===!1&&p.add(_);let te=u?l._origGetBuiltinModule.apply(this,n):l._origRequire.apply(this,n);if(ee===!0)return a(`module is in the process of being patched already - ignoring: %s`,_),te;if(p.delete(_),g===!0){if(h===!0&&t.includes(_)===!1)return a(`ignoring core module not on whitelist: %s`,_),te;v=_}else if(h===!0&&t.includes(_)){let e=r.parse(_);v=e.name,y=e.dir}else{let n=o(_);if(n===void 0)return a(`could not parse filename: %s`,_),te;v=n.name,y=n.basedir;let i=f(n);a(`resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)`,v,d,i,y);let s=!1;if(h){if(!d.startsWith(`.`)&&t.includes(d)&&(v=d,s=!0),!t.includes(v)&&!t.includes(i))return te;t.includes(i)&&i!==v&&(v=i,s=!0)}if(!s){let t;try{t=e.resolve(v,{paths:[y]})}catch{return a(`could not resolve module: %s`,v),l._cache.set(_,te,g),te}if(t!==_){if(m===!0)v=v+r.sep+r.relative(y,_),a(`preparing to process require of internal file: %s`,v);else return a(`ignoring require of non-main module file: %s`,t),l._cache.set(_,te,g),te}}}l._cache.set(_,te,g),a(`calling require hook: %s`,v);let ne=s(te,v,y);return l._cache.set(_,ne,g),a(`returning module: %s`,v),ne}}d.prototype.unhook=function(){this._unhooked=!0,this._require===i.prototype.require?(i.prototype.require=this._origRequire,a(`require unhook successful`)):a(`require unhook unsuccessful`),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,a(`process.getBuiltinModule unhook successful`)):a(`process.getBuiltinModule unhook unsuccessful`))};function f(e){let t=r.sep===`/`?e.path:e.path.split(r.sep).join(`/`);return r.posix.join(e.name,t).replace(l,``)}})),mE=class{hooks=[];children=new Map},hE=class{_trie=new mE;_counter=0;insert(e){let t=this._trie;for(let n of e.moduleName.split(`/`)){let e=t.children.get(n);e||(e=new mE,t.children.set(n,e)),t=e}t.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:t,fullOnly:n}={}){let r=this._trie,i=[],a=!0;for(let t of e.split(`/`)){let e=r.children.get(t);if(!e){a=!1;break}n||i.push(...e.hooks),r=e}return n&&a&&i.push(...r.hooks),i.length===0?[]:i.length===1?[i[0].hook]:(t&&i.sort((e,t)=>e.insertedId-t.insertedId),i.map(({hook:e})=>e))}},gE=pE(),_E=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(e=>typeof global[e]==`function`),vE=class e{_moduleNameTrie=new hE;static _instance;constructor(){this._initialize()}_initialize(){new gE.Hook(null,{internals:!0},(e,t,n)=>{let r=yE(t),i=this._moduleNameTrie.search(r,{maintainInsertionOrder:!0,fullOnly:n===void 0});for(let{onRequire:r}of i)e=r(e,t,n);return e})}register(e,t){let n={moduleName:e,onRequire:t};return this._moduleNameTrie.insert(n),n}static getInstance(){return _E?new e:this._instance=this._instance??new e}};function yE(e){return He.sep===`/`?e:e.split(He.sep).join(`/`)}var bE=n((e=>{var t=[],n=new WeakMap,r=new Map,i=[];function a(e,t){return t===`module.exports`&&!Object.hasOwn(e,t)?e.default:e[t]}function o(e,t,r){return n.get(e).write(t,r)}function s(e,t,n){if(!(`value`in n))throw Error(`Getters/setters are not supported for exports property descriptors.`);return o(e,t,n.value)}var c={defineProperty:s,set:o};function l(e,a,o){let{namespace:s}=a;r.set(e,o),n.set(s,a);let l=new Proxy(s,c);t.forEach(t=>t(e,l,o)),i.push([e,l,o])}var u=[0,10,50],d=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:`Module`}});#e=Object.create(null);#t;#n;#r;constructor(e,t,n,r){if(this.#t=n,t!==void 0)for(let n=0;n<t.length;n++)this.#i(t[n],n,r?.[n]??e)}#i(e,t,n){let r;try{r=a(n,e),this.#t(t,r),this.namespace[e]=r}catch(e){if(!(e instanceof ReferenceError))throw e}r===void 0&&(this.#r??=[]).push(this.#a(e,t,n)),this.#e[e]=t}write(e,t){let n=this.#e[e];return n!==void 0&&(this.#t(n,t),this.#r!==void 0&&(this.#n??=Object.create(null),this.#n[e]=!0),this.namespace[e]=t),!0}#a(e,t,n){return()=>{if(this.#n?.[e]===!0)return!0;try{let r=a(n,e);return r!==void 0&&(this.#t(t,r),this.namespace[e]=r,!0)}catch(e){if(e instanceof ReferenceError)return!1;throw e}}}#o(){let e=this.#r;if(e===void 0)return;let t;for(let n of e)n()!==!0&&(t??=[]).push(n);this.#r=t}flush(){this.#r!==void 0&&queueMicrotask(()=>{this.#o(),this.#s(0)})}#s(e){if(this.#r===void 0)return;if(e>=u.length){this.#r=void 0;return}let t=setTimeout(()=>{this.#o(),this.#s(e+1)},u[e]);t&&typeof t.unref==`function`&&t.unref()}};e.register=l,e.ModuleBinder=d,e.importHooks=t,e.specifiers=r,e.toHook=i})),xE=n(((t,n)=>{var r=e(`path`),i=fE(),{fileURLToPath:a}=e(`url`),{MessageChannel:o}=e(`worker_threads`),{isBuiltin:s}=e(`module`);s||=()=>!0;var{importHooks:c,specifiers:l,toHook:u}=bE();function d(e,t){if(!(process.env.TURBOPACK??process.argv.includes(`--turbo`)))return!1;let n=e.slice(0,e.lastIndexOf(`-`));return t.endsWith(n)}function f(e){c.push(e),u.forEach(([t,n,r])=>e(t,n,r))}function p(e){let t=c.indexOf(e);t>-1&&c.splice(t,1)}function m(e,t,n,r){let i=e(t,n,r);i&&i!==t&&`default`in t&&(t.default=i)}var h;function g(){let{port1:e,port2:t}=new o,n=0,r;h=t=>{n++,e.postMessage(t)},e.on(`message`,()=>{n--,r&&n<=0&&r()}).unref();function i(){let e=setInterval(()=>{},1e3),t=new Promise(e=>{r=e}).then(()=>{clearInterval(e)});return n===0&&r(),t}let a=t;return{registerOptions:{data:{addHookMessagePort:a,include:[]},transferList:[a]},addHookMessagePort:a,waitForAllMessagesAcknowledged:i}}function _(e,t,n){if(!(this instanceof _))return new _(e,t,n);typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null);let o=t?t.internals===!0:!1;h&&Array.isArray(e)&&h(e),this._iitmHook=(t,c,u)=>{let f=t,p=f.startsWith(`node:`),h,g;if(p){let e=t.slice(5);s(e)&&(t=e)}else if(f.startsWith(`file://`)){let e=Error.stackTraceLimit;Error.stackTraceLimit=0;try{h=a(t),t=h}catch{}if(Error.stackTraceLimit=e,h){let e=i(h);e&&(t=e.name,g=e.basedir)}}if(e)for(let i of e)if(h&&i===h)m(n,c,h,void 0);else if(i===t){if(!g)m(n,c,t,g);else if(g.endsWith(l.get(f))||d(l.get(f),g))m(n,c,t,g);else if(o){let e=t+r.sep+r.relative(g,h);m(n,c,e,g)}}else i===u&&m(n,c,u,g);else m(n,c,t,g)},f(this._iitmHook)}_.prototype.unhook=function(){p(this._iitmHook)},n.exports=_,n.exports.Hook=_,n.exports.addHook=f,n.exports.removeHook=p,n.exports.createAddHookMessageChannel=g}));function SE(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function K(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var CE=xE();b();var q=class extends dE{_modules;_hooks=[];_requireInTheMiddleSingleton=vE.getInstance();_enabled=!1;constructor(e,t,n){super(e,t,n);let r=this.init();r&&!Array.isArray(r)&&(r=[r]),this._modules=r||[],this._config.enabled&&this.enable()}_wrap=(e,t,n)=>{if(K(e[t])&&this._unwrap(e,t),ze.isProxy(e)){let r=sE(Object.assign({},e),t,n);return Object.defineProperty(e,t,{value:r}),r}return sE(e,t,n)};_unwrap=(e,t)=>ze.isProxy(e)?Object.defineProperty(e,t,{value:e[t]}):lE(e,t);_massWrap=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{f.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){f.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._wrap(e,t,n)})})};_massUnwrap=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{f.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){f.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._unwrap(e,t)})})};_warnOnPreloadedModules(){let e=globalThis.require;e?.resolve&&e?.cache&&this._modules.forEach(t=>{let{name:n}=t;try{let t=e.resolve(n);e.cache[t]?.loaded&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let t=Ve(He.join(e,`package.json`),{encoding:`utf8`}),n=JSON.parse(t).version;return typeof n==`string`?n:void 0}catch{f.warn(`Failed extracting version`,e)}}_onRequire(e,t,n,r){if(!r)return typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for nodejs core module on require hook`,{module:e.name}),e.patch(t)):t;let i=this._extractPackageVersion(r);if(e.moduleVersion=i,e.name===n)return wE(e.supportedVersions,i,e.includePrerelease)&&typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for module on require hook`,{module:e.name,version:e.moduleVersion,baseDir:r}),e.patch(t,e.moduleVersion)):t;let a=e.files??[],o=He.normalize(n);return a.filter(t=>t.name===o&&wE(t.supportedVersions,i,e.includePrerelease)).reduce((t,n)=>(n.moduleExports=t,this._enabled?(this._diag.debug(`Applying instrumentation patch for nodejs module file on require hook`,{module:e.name,version:e.moduleVersion,fileName:n.name,baseDir:r}),n.patch(t,e.moduleVersion)):t),t)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch==`function`&&e.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module on instrumentation enabled`,{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module file on instrumentation enabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.patch(t.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let t=(t,n,r)=>{if(!r&&He.isAbsolute(n)){let e=He.parse(n);n=e.name,r=e.dir}return this._onRequire(e,t,n,r)},n=(t,n,r)=>this._onRequire(e,t,n,r),r=He.isAbsolute(e.name)?new gE.Hook([e.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(e.name,n);this._hooks.push(r);let i=new CE.Hook([e.name],{internals:!0},t);this._hooks.push(i)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch==`function`&&e.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module on instrumentation disabled`,{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module file on instrumentation disabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.unpatch(t.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};function wE(e,t,n){return t===void 0?e.includes(`*`):e.some(e=>ST(t,e,{includePrerelease:n}))}var J=class{files;name;supportedVersions;patch;unpatch;constructor(e,t,n,r,i){this.files=i||[],this.name=e,this.supportedVersions=t,this.patch=n,this.unpatch=r}},TE=Ar(process.versions.node),EE=TE.major,DE=TE.minor;b();var OE=TE.major===22&&TE.minor>=12||TE.major===23&&TE.minor>=2||TE.major>=24;function kE(e={}){let{outgoingRequestApplyCustomAttributes:t,...n}=e,i={propagateTrace:n.propagateTraceInOutgoingRequests??!0,applyCustomAttributesOnSpan:t,...n,spans:n.createSpansForOutgoingRequests!==!1&&(n.spans??!0),ignoreOutgoingRequests(e,t){return os()||!!n.ignoreOutgoingRequests?.(e,fw(t))},outgoingRequestHook(e,t){n.outgoingRequestHook?.(e,t);let i=t.once;t.once=new Proxy(i,{apply(t,n,i){let[a]=i;if(a!==`response`)return t.apply(n,i);let o=r.active(),s=g.setSpan(o,e);return r.with(s,()=>t.apply(n,i))}})},outgoingResponseHook(e,t){n.outgoingResponseHook?.(e,t)},errorMonitor:Se,http:C};OE?jE(i):ME(i)}var AE;function jE(e){let{[uw]:t}=Ew(e);AE&&T(uw,AE),qe(uw,t),AE=t}function ME(e){Aw(C,e)}var NE=`Http`;Object.assign(kE,{id:`${NE}.sentry`});var PE=W((e={})=>{let t=e.spans??!1,n=e.disableIncomingRequestSpans??!1,r=t&&!n,i={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},a={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes},o={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests,spans:t},s=Xw(i),c=Qw(a);return{name:NE,setup(e){r&&c.setup(e)},setupOnce(){s.setupOnce(),kE(o)},processEvent(e){return c.processEvent(e)}}}),FE=`sentry-trace`,IE=`baggage`,LE=`traceparent`;function RE(e,t,n){let r=KE(e.origin,e.path),{tracePropagationTargets:i,propagateTraceparent:a}=P()?.getOptions()||{};if(!Cp(r,i,t))return;let o=n&&_s(n)&&R()?void 0:n,s=o?V(o,()=>yp({propagateTraceparent:a})):yp({propagateTraceparent:a});if(!s)return;let{"sentry-trace":c,baggage:l,traceparent:u}=s,d=Array.isArray(e.headers)?zE(e.headers):BE(e.headers);if(HE(d,FE),HE(d,IE),a&&HE(d,LE),UE(d,FE)===-1){c&&d.push(FE,c),u&&UE(d,`traceparent`)===-1&&d.push(`traceparent`,u);let e=UE(d,IE);if(l&&e===-1)d.push(IE,l);else if(l){let t=d[e+1],n=la(t,l);n&&(d[e+1]=n)}}Array.isArray(e.headers)?e.headers.splice(0,e.headers.length,...d):e.headers=VE(d)}function zE(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];n%2==0?t.push(typeof r==`string`?r:String(r)):t.push(Array.isArray(r)?r.join(`, `):r??``)}return t}function BE(e){let t=e.split(`\r
|
|
19
|
+
`),n=[];for(let e of t)try{let t=e.indexOf(`:`);if(t===-1)continue;let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&n.push(r,i)}catch{A.warn(`Failed to convert string request header to array header: ${e}`)}return n}function VE(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];r&&i!=null&&t.push(`${r}: ${i}`)}return t.length?t.join(`\r
|
|
20
|
+
`).concat(`\r
|
|
21
|
+
`):``}function HE(e,t){let n=-1;for(let r=0;r<e.length;r+=2){if(e[r]!==t)continue;if(n===-1){n=r;continue}let i=e[n+1];if(t===IE&&i){let t=la(e[r+1],i);t&&(e[n+1]=t)}e.splice(r,2),r-=2}}function UE(e,t){return e.findIndex((e,n)=>n%2==0&&e===t)}function WE(e,t){let n=GE(e),r=t.statusCode,i=sx(r);zp({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function GE(e){try{let t=fp(KE(e.origin,e.path)),n={url:mp(t),"http.method":e.method||`GET`};return t.search&&(n[`http.query`]=t.search),t.hash&&(n[`http.fragment`]=t.hash),n}catch{return{}}}function KE(e,t=`/`){try{return new URL(t,e).toString()}catch{let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}}var qE=`http.request.method_original`,JE=[],YE=new WeakMap,XE=new WeakMap,ZE=new lx(100);function QE(e={}){JE.length||(eD(`undici:request:create`,t=>nD(e,t)),eD(`undici:client:sendHeaders`,t=>rD(e,t)),eD(`undici:request:headers`,t=>iD(e,t)),eD(`undici:request:trailers`,e=>aD(e)),eD(`undici:request:error`,e=>oD(e)))}function $E(e,t){try{return e()}catch(e){t(e);return}}function eD(e,t){let[n=0,r=0]=process.version.replace(`v`,``).split(`.`).map(e=>Number(e));n>18||n===18&&r>=19?JE.push(ot.subscribe?.(e,t)):JE.push(ot.channel(e).subscribe(t))}function tD(e){let t=new Map;if(Array.isArray(e.headers))for(let n=0;n<e.headers.length;n+=2){let r=e.headers[n],i=e.headers[n+1];typeof r==`string`&&i!==void 0&&t.set(r.toLowerCase(),i)}else if(typeof e.headers==`string`){let n=e.headers.split(`\r
|
|
22
|
+
`);for(let e of n){if(!e)continue;let n=e.indexOf(`:`);if(n===-1)continue;let r=e.substring(0,n).toLowerCase(),i=e.substring(n+1).trim(),a=t.get(r);a&&Array.isArray(a)?a.push(i):a?t.set(r,[a,i]):t.set(r,i)}}return t}function nD(e,{request:t}){let n=cD(t.origin,t.path),r=$E(()=>!!e.ignoreOutgoingRequests?.(n),e=>e&&Kw&&A.error(`caught ignoreOutgoingRequests error: `,e)),i=os()||!!r;if(XE.set(t,i),!e.spans){e.tracePropagation!==!1&&!i&&RE(t,ZE);return}if(t.method===`CONNECT`||r)return;let a;try{a=new tt(t.path,t.origin)}catch(e){Kw&&A.warn(`could not determine url.full:`,e);return}let o=a.protocol.replace(`:`,``),s=sD(t.method),c={[bl]:s,[qE]:t.method,[uu]:a.toString(),[du]:a.pathname,[fu]:a.search,[pu]:o,[I]:`auto.http.otel.node_fetch`};if(n.startsWith(`data:`)){let e=hp(n);c[`http.url`]=e,c[uu]=e,c[Pi]=`${t.method||`GET`} ${e}`}let l={https:`443`,http:`80`},u=a.hostname,d=a.port||l[o];c[ou]=u,d&&!isNaN(Number(d))&&(c[su]=Number(d));let f=tD(t).get(`user-agent`);f&&(c[mu]=Array.isArray(f)?f[f.length-1]:f);let p=P(),m=B({name:s===`_OTHER`?`HTTP`:s,kind:G.CLIENT,attributes:c,onlyIfParent:!p||!Wo(p)});$E(()=>e.requestHook?.(m,t),e=>e&&Kw&&A.error(`caught requestHook error: `,e)),RE(t,ZE,m),YE.set(t,m)}function rD(e,{request:t,socket:n}){let r=YE.get(t);if(!r)return;let{remoteAddress:i,remotePort:a}=n,o={[Ll]:i,[Rl]:a};if(e.headersToSpanAttributes?.requestHeaders){let n=new Set(e.headersToSpanAttributes.requestHeaders.map(e=>e.toLowerCase())),r=tD(t);for(let[e,t]of r.entries())if(n.has(e)){let n=Array.isArray(t)?t:[t];o[`http.request.header.${e}`]=n}}r.setAttributes(o)}function iD(e,{request:t,response:n}){e.breadcrumbs!==!1&&!XE.get(t)&&WE(t,n);let r=YE.get(t);if(!r)return;let i={[xl]:n.statusCode};if($E(()=>e.responseHook?.(r,{request:t,response:n}),e=>e&&Kw&&A.error(`caught responseHook error: `,e)),e.headersToSpanAttributes?.responseHeaders){let t=new Set;e.headersToSpanAttributes?.responseHeaders.forEach(e=>t.add(e.toLowerCase()));for(let e=0;e<n.headers.length;e+=2){let r=n.headers[e],a=n.headers[e+1];if(r===void 0||a===void 0)continue;let o=r.toString().toLowerCase(),s=a;if(t.has(o)){let e=`http.response.header.${o}`;Object.prototype.hasOwnProperty.call(i,e)?i[e].push(s.toString()):i[e]=[s.toString()]}}}r.setAttributes(i),n.statusCode>=400&&r.setStatus(Hi(n.statusCode))}function aD({request:e}){let t=YE.get(e);t&&(t.end(),YE.delete(e))}function oD({request:e,error:t}){let n=YE.get(e);n&&(n.setStatus({code:2,message:t.message}),n.end(),YE.delete(e))}function sD(e){return e.toUpperCase()in{CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0}?e.toUpperCase():`_OTHER`}function cD(e,t=`/`){let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}var lD=W(((e={})=>({name:`NodeFetch`,setupOnce(){QE(e)}}))),uD=`exception`,dD=Symbol.for(`nodejs.util.inspect.custom`);function fD(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function pD(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}b(),ie();var mD=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:ee.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=ue.now(),this._performanceOffset=t-(this._performanceStartTime+ue.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return f.warn(`Invalid attribute key: ${e}`),this;if(!xt(t))return f.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return f.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&f.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),le(t)&&(le(n)||(n=t),t=void 0);let i=yt(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&f.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=yt(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===ee.UNSET||this.status.code===ee.OK)return this;let t={code:e.code};return e.code===ee.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&f.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){f.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=ce(this.startTime,this.endTime),this._duration[0]<0&&(f.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&f.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&f.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=ue.now())return fe(e+this._performanceOffset);if(typeof e==`number`)return ve(e);if(e instanceof Date)return ve(e.getTime());if(pe(e))return e;if(this._startTimeProvided)return ve(Date.now());let t=ue.now()-this._performanceStartTime;return ge(this.startTime,ve(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[_]=e:e&&(e.code?n[oe]=e.code.toString():e.name&&(n[oe]=e.name),e.message&&(n[_]=e.message),e.stack&&(n[te]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(uD,n,t):f.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);f.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(f.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[dD](e,t,n){return pD(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:fD(this.resource)}},e,t,n)}},hD;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(hD||={});var gD=`otel.span.parent.origin`,_D=`otel.span.sampling_result`,vD=`otel.sdk.span.live`,yD=`otel.sdk.span.started`,bD=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(yD,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(vD,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=SD(t);if(this.startedSpans.add(1,{[gD]:xD(e),[_D]:n}),t===hD.NOT_RECORD)return()=>{};let r={[_D]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function xD(e){return e?e.isRemote?`remote`:`local`:`none`}function SD(e){switch(e){case hD.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case hD.RECORD:return`RECORD_ONLY`;case hD.NOT_RECORD:return`DROP`}}var CD=`2.11.0`;b();var wD=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,CD);this._tracerMetrics=new bD(n)}startSpan(e,t={},n=r.active()){t.root&&(n=g.deleteSpan(n));let i=g.getSpan(n);if(he(n))return f.debug(`Instrumentation suppressed, returning Noop Span`),g.wrapSpanContext(u);let a=i?.spanContext(),o=this._idGenerator.generateSpanId(),s,l,d;!a||!g.isSpanContextValid(a)?l=this._idGenerator.generateTraceId():(l=a.traceId,d=a.traceState,s=a);let m=t.kind??y.INTERNAL,h=(t.links??[]).map(e=>({context:e.context,attributes:yt(e.attributes)})),_=yt(t.attributes),v=this._sampler.shouldSample(n,l,e,m,_,h),ee=this._tracerMetrics.startSpan(a,v.decision);d=v.traceState??d;let te=v.decision===c.RECORD_AND_SAMPLED?p.SAMPLED:p.NONE,ne={traceId:l,spanId:o,traceFlags:te,traceState:d};if(v.decision===c.NOT_RECORD)return f.debug(`Recording is off, propagating context in a non-recording span`),g.wrapSpanContext(ne);let re=yt(Object.assign(_,v.attributes));return new mD({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:ne,name:e,kind:m,links:h,parentSpanContext:s,attributes:re,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:ee})}startActiveSpan(e,t,n,i){let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=i);let c=o??r.active(),l=this.startSpan(e,a,c),u=g.setSpan(c,l);return r.with(u,s,void 0,l)}[dD](e,t,n){return pD(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:fD(this._resource)},spanLimits:this._spanLimits},e,t,n)}},TD=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{de(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},ED=class{shouldSample(){return{decision:hD.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},DD=class{shouldSample(){return{decision:hD.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};b();var OD=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(de(Error(`ParentBasedSampler must have a root sampler configured`)),new DD),this._remoteParentSampled=e.remoteParentSampled??new DD,this._remoteParentNotSampled=e.remoteParentNotSampled??new ED,this._localParentSampled=e.localParentSampled??new DD,this._localParentNotSampled=e.localParentNotSampled??new ED}shouldSample(e,t,n,r,i,o){let s=g.getSpanContext(e);return!s||!a(s)?this._root.shouldSample(e,t,n,r,i,o):s.isRemote?s.traceFlags&p.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,o):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,o):s.traceFlags&p.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,o):this._localParentNotSampled.shouldSample(e,t,n,r,i,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},kD=8,AD=16,jD=class{generateTraceId=ND(AD);generateSpanId=ND(kD)},MD=Buffer.allocUnsafe(AD);function ND(e){return function(){for(let t=0;t<e/4;t++)MD.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(MD[t]>0);t++)t===e-1&&(MD[e-1]=1);return MD.toString(`hex`,0,e)}}b();var PD;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(PD||={});var FD=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??ae();let t=e.spanProcessors??[];this._activeSpanProcessor=new TD(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new OD({root:new DD}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new jD,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return i()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new wD({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(e){let t=e?.timeoutMillis??this._forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${t} ms`)),r=PD.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==PD.timeout&&(r=PD.resolved,n(r))}).catch(e=>{clearTimeout(i),r=PD.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==PD.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[dD](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return pD(`TracerProvider`,{resource:{attributes:fD(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};b();var ID=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:s(t)&&this._accumulate(t)<this._upperBound?hD.RECORD_AND_SAMPLED:hD.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};b();var LD;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(LD||={});var RD=1;function zD(){return{sampler:BD(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:v(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:v(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:v(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:v(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:v(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:v(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:v(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:v(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function BD(){let e=h(`OTEL_TRACES_SAMPLER`)??LD.ParentBasedAlwaysOn;switch(e){case LD.AlwaysOn:return new DD;case LD.AlwaysOff:return new ED;case LD.ParentBasedAlwaysOn:return new OD({root:new DD});case LD.ParentBasedAlwaysOff:return new OD({root:new ED});case LD.TraceIdRatio:return new ID(VD());case LD.ParentBasedTraceIdRatio:return new OD({root:new ID(VD())});default:return f.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${LD.ParentBasedAlwaysOn}".`),new OD({root:new DD})}}function VD(){let e=v(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(f.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${RD}.`),RD):e<0||e>1?(f.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${RD}.`),RD):e}function HD(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??v(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??v(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??v(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??v(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}var UD=class extends FD{constructor(e={}){let t=Ut({},zD(),HD(e));delete t.generalLimits,super(t)}};b();var WD=`sentry.parentIsRemote`,GD=`sentry.graphql.operation`;function KD(e){if(`parentSpanId`in e)return e.parentSpanId;if(`parentSpanContext`in e)return e.parentSpanContext?.spanId}function qD(e){return j(e.attributes)}function JD(e){return typeof e.kind==`number`}function YD(e){return!!e.status}function XD(e){return!!e.name}function ZD(e){if(!qD(e))return{};let t=e.attributes[`url.full`]||e.attributes[`http.url`],n={url:t,"http.method":e.attributes[`http.request.method`]||e.attributes[`http.method`]};!n[`http.method`]&&n.url&&(n[`http.method`]=`GET`);try{if(typeof t==`string`){let e=fp(t);n.url=mp(e),e.search&&(n[`http.query`]=e.search),e.hash&&(n[`http.fragment`]=e.hash)}}catch{}return n}function QD(e){return JD(e)?e.kind:y.INTERNAL}var $D=`sentry-trace`,eO=`baggage`,tO=`sentry.dsc`,nO=`sentry.sampled_not_recording`,rO=`sentry.url`,iO=`sentry.sample_rand`,aO=`sentry.sample_rate`,oO=`sentry.ignored`,sO=`sentry.segment_ignored`,cO=o(`sentry_scopes`),lO=o(`sentry_fork_isolation_scope`),uO=o(`sentry_fork_set_scope`),dO=o(`sentry_fork_set_isolation_scope`),fO=`_scopeContext`;function pO(e){return e.getValue(cO)}function mO(e,t){return e.setValue(cO,t)}function hO(e,t){Un(e,fO,Gr(t))}function gO(e){return Kr(e[fO])}function _O(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(nO)===`1`:!1;if(t===p.SAMPLED)return!0;if(r)return!1;let i=n?n.get(tO):void 0,a=i?ia(i):void 0;if(a?.sampled===`true`)return!0;if(a?.sampled===`false`)return!1}function vO(e,t){let n=e.spanContext(),r=Za(e),i=_O(n);if(i!==void 0)return i;if(_s(r))return!1;if(to(t?.getOptions())&&!n.isRemote&&Ha(r))return Ua(e)}function yO(e,t,n){let r=t[`http.request.method`]||t[`http.method`];if(r)return SO({attributes:t,name:e,kind:n},r);let i=t[`db.system.name`]||t[`db.system`],a=typeof t[`sentry.op`]==`string`&&t[`sentry.op`].startsWith(`cache.`);if(i&&!a)return xO({attributes:t,name:e});let o=t[`sentry.source`]===`custom`?`custom`:`route`;if(t[`rpc.service`])return{...TO(e,t,`route`),op:`rpc`};if(t[`messaging.system`])return{...TO(e,t,o),op:`message`};let s=t[Uc];return s?{...TO(e,t,o),op:s.toString()}:{op:void 0,description:e,source:`custom`}}function bO(e){let t,n;if(qD(e))t=e.attributes,n=XD(e)?e.name:`<unknown>`;else{let r=typeof e.spanContext==`function`?L(e):void 0;t=r?.data||{},n=XD(e)?e.name:r?.description||`<unknown>`}let r=QD(e);return yO(n,t,r)}function xO({attributes:e,name:t}){let n=e[Pi];if(typeof n==`string`)return{op:`db`,description:n,source:e[`sentry.source`]||`custom`};if(e[`sentry.source`]===`custom`)return{op:`db`,description:t,source:`custom`};let r=e[Nc];return{op:`db`,description:r?r.toString():t,source:`task`}}function SO({name:e,kind:t,attributes:n},r){let i=[`http`];switch(t){case y.CLIENT:i.push(`client`);break;case y.SERVER:i.push(`server`)}n[`sentry.http.prefetch`]&&i.push(`prefetch`);let{urlPath:a,url:o,query:s,fragment:c,hasRoute:l}=wO(n,t);if(!a)return{...TO(e,n),op:i.join(`.`)};let u=n[GD],d=`${r} ${a}`,f=u?`${d} (${CO(u)})`:d,p=l||a===`/`?`route`:`url`,m={};o&&(m.url=o),s&&(m[`http.query`]=s.slice(1)),c&&(m[`http.fragment`]=c.slice(1));let h=t===y.CLIENT||t===y.SERVER,g=!`${n[`sentry.origin`]||`manual`}`.startsWith(`auto`),_=n[Ci]===`custom`,v=n[Pi],{description:ee,source:te}=!_&&v==null&&(h||!g)?{description:f,source:p}:TO(e,n);return{op:i.join(`.`),description:ee,source:te,data:m}}function CO(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(`, `):`${t.slice(0,5).join(`, `)}, +${t.length-5}`}return`${e}`}function wO(e,t){let n=e[Tl],r=e[`http.url`]||e[`url.full`],i=e[Sl],a=typeof r==`string`?fp(r):void 0,o=a?mp(a):void 0,s=a?.search||void 0,c=a?.hash||void 0;return typeof i==`string`?{urlPath:i,url:o,query:s,fragment:c,hasRoute:!0}:t===y.SERVER&&typeof n==`string`?{urlPath:pp(n),url:o,query:s,fragment:c,hasRoute:!1}:a?{urlPath:o,url:o,query:s,fragment:c,hasRoute:!1}:typeof n==`string`?{urlPath:pp(n),url:o,query:s,fragment:c,hasRoute:!1}:{urlPath:void 0,url:o,query:s,fragment:c,hasRoute:!1}}function TO(e,t,n=`custom`){let r=t[`sentry.source`]||n,i=t[Pi];return i&&typeof i==`string`?{description:i,source:r}:{description:e,source:r}}function EO(e){e.on(`createDsc`,(t,n)=>{if(!n)return;let r=L(n),i=r.data[Ci],a=vO(n,e);if(a===!1)delete t.transaction;else if(r.description){let{description:e}=bO(n);i!==`url`&&e&&(t.transaction=e)}to()&&(t.sampled=a==null?void 0:String(a))})}function DO(){return g.getActiveSpan()}var OO=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,kO=class e{constructor(){this._internalState=new Map}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reverse().map(e=>`${e}=${this._internalState.get(e)}`).join(`,`)}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};function AO({dsc:e,sampled:t}){let n=e?aa(e):void 0,r=new kO,i=n?r.set(tO,n):r;return t===!1?i.set(nO,`1`):i}var jO=new Set;function MO(){return Array.from(jO)}function NO(e){jO.add(e)}var PO=class extends vt{constructor(){super(),NO(`SentryPropagator`),this._urlMatchesTargetsMap=new lx(100)}inject(e,t,n){if(he(e)){OO&&A.log(`[Tracing] Not injecting trace data for url because tracing is suppressed.`);return}let r=g.getSpan(e),i=r&&VO(r),{tracePropagationTargets:a,propagateTraceparent:o}=P()?.getOptions()||{};if(!Cp(i,a,this._urlMatchesTargetsMap)){OO&&A.log(`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`,i);return}let s=zO(t),c=BO(t),l=d.getBaggage(e)||d.createBaggage({}),{dynamicSamplingContext:u,traceId:f,spanId:p,sampled:m}=FO(e);if(s){let e=oa(s);e&&Object.entries(e).forEach(([e,t])=>{(c||!e.startsWith(`sentry-`))&&(l=l.setEntry(e,{value:t}))})}!c&&u&&(l=Object.entries(u).reduce((e,[t,n])=>n?e.setEntry(`${ra}${t}`,{value:n}):e,l)),!c&&f&&f!==`00000000000000000000000000000000`&&(n.set(t,$D,Ta(f,p,m)),o&&n.set(t,`traceparent`,Ea(f,p,m))),super.inject(d.setBaggage(e,l),t,n)}extract(e,t,n){let r=n.get(t,$D),i=n.get(t,eO);return RO(IO(e,{sentryTrace:r?Array.isArray(r)?r[0]:r:void 0,baggage:i}))}fields(){return[$D,eO,`traceparent`]}};function FO(e,t={}){let n=g.getSpan(e);if(n?.spanContext().isRemote){let e=n.spanContext();return{dynamicSamplingContext:go(n),traceId:e.traceId,spanId:void 0,sampled:_O(e)}}if(n){let e=n.spanContext();return{dynamicSamplingContext:go(n),traceId:e.traceId,spanId:e.spanId,sampled:vO(n,t.client)}}let r=t.scope||pO(e)?.scope||M(),i=t.client||P(),a=r.getPropagationContext();return{dynamicSamplingContext:i?ho(i,r):void 0,traceId:a.traceId,spanId:a.propagationSpanId,sampled:a.sampled}}function IO(e,{sentryTrace:t,baggage:n}){let{traceId:r,parentSpanId:i,sampled:a,dsc:o}=wa(t,n),s=P(),c=ia(n);if(!i||s&&!Oa(s,c?.org_id))return e;let l=HO({traceId:r,spanId:i,sampled:a,dsc:o});return g.setSpanContext(e,l)}function LO(e,t,n){let i=RO(IO(e,t));return r.with(i,n)}function RO(e){let t=pO(e);return mO(e,{scope:t?t.scope:M().clone(),isolationScope:t?t.isolationScope:N()})}function zO(e){try{let t=e[eO];return Array.isArray(t)?t.join(`,`):t}catch{return}}function BO(e){try{return e[$D]}catch{return}}function VO(e){let t=L(e).data,n=t[`http.url`]||t[`url.full`];if(typeof n==`string`)return n;let r=e.spanContext().traceState?.get(rO);if(r)return r}function HO({spanId:e,traceId:t,sampled:n,dsc:r}){let i=AO({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?p.SAMPLED:p.NONE,traceState:i}}function UO(e,t,n){let i=JO(),{name:a,parentSpan:o}=e;return rk(o)(()=>{let o=QO(e.scope,e.forceTransaction),s=e.onlyIfParent&&!g.getSpan(o),c=s?me(o):o;s&&P()?.recordDroppedEvent(`no_parent_span`,`span`);let l=YO(e);if(!to()){let e=he(c)?c:me(c);return r.with(e,()=>i.startActiveSpan(a,l,e,e=>(ZO(e),r.with(o,()=>Zo(()=>t(e),()=>{L(e).status===void 0&&e.setStatus({code:ee.ERROR})},n?()=>e.end():void 0)))))}return i.startActiveSpan(a,l,c,e=>(ZO(e),Zo(()=>t(e),()=>{L(e).status===void 0&&e.setStatus({code:ee.ERROR})},n?()=>e.end():void 0)))})}function WO(e,t){return UO(e,t,!0)}function GO(e,t){return UO(e,e=>t(e,()=>e.end()),!1)}function KO(e){let t=JO(),{name:n,parentSpan:r}=e;return rk(r)(()=>{let r=QO(e.scope,e.forceTransaction),i=e.onlyIfParent&&!g.getSpan(r),a=i?me(r):r;i&&P()?.recordDroppedEvent(`no_parent_span`,`span`);let o=YO(e);to()||(a=he(a)?a:me(a));let s=t.startSpan(n,o,a);return ZO(s),s})}function qO(e,t){let n=e?g.setSpan(r.active(),e):g.deleteSpan(r.active());return r.with(n,()=>t(M()))}function JO(){return P()?.tracer||g.getTracer(`@sentry/opentelemetry`,`10.74.0`)}function YO(e){let{startTime:t,attributes:n,kind:r,op:i,links:a}=e,o=typeof t==`number`?XO(t):t;return{attributes:i?{[F]:i,...n}:n,kind:r,links:a,startTime:o}}function XO(e){return e<9999999999?e*1e3:e}function ZO(e){let t=e.end.bind(e);e.end=e=>t(typeof e==`number`?XO(e):e)}function QO(e,t){let n=$O(e),r=g.getSpan(n);if(!r||!t)return n;let i=g.deleteSpan(n),{spanId:a,traceId:o}=r.spanContext(),s=_O(r.spanContext()),c=AO({dsc:go(Za(r)),sampled:s}),l={traceId:o,spanId:a,isRemote:!0,traceFlags:s?p.SAMPLED:p.NONE,traceState:c};return g.setSpanContext(i,l)}function $O(e){if(e){let t=gO(e);if(t)return t}return r.active()}function ek(e,t){return LO(r.active(),e,t)}function tk(e){let t=Ur(),n={traceId:t,spanId:Wr(),isRemote:!0,traceFlags:p.NONE},i=g.setSpanContext(r.active(),n);return r.with(i,()=>(M().setPropagationContext({traceId:t,sampleRand:Qn()}),e()))}function nk(e,t){let n=gO(t),r=n&&g.getSpan(n),i=r?ja(r):Si(t);return[r?go(r):ho(e,t),i]}function rk(e){return e===void 0?e=>e():t=>qO(e,t)}function ik(e){let t=me(r.active());return r.with(t,e)}function ak(e){let t=e?gO(e):r.active();return t?he(t):!1}function ok(e){e.on(`preprocessEvent`,e=>{let t=DO();return!t||e.type===`transaction`?void 0:(e.contexts={trace:ja(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:go(Za(t)),...e.sdkProcessingMetadata},e)})}function sk(e,t){let n=g.getSpan(e),r;if(n?.spanContext().traceState?.get(`sentry.ignored`)===`1`){let n=g.deleteSpan(e),i=g.getSpan(t);r=i?g.setSpan(n,i):n}else r=e;let i=pO(r),a=i?.scope||M(),o=i?.isolationScope||N(),s=r.getValue(lO)===!0,c=r.getValue(uO),l=r.getValue(dO),u=c||a.clone(),d={scope:u,isolationScope:l||(s?o.clone():o)},f=mO(r,d).deleteValue(lO).deleteValue(uO).deleteValue(dO);return hO(u,f),f}function ck(e){let t=new Map;for(let n of e)uk(t,n);return Array.from(t,function([e,t]){return t})}function lk(e){return e.attributes[WD]===!0?void 0:KD(e)}function uk(e,t){let n=t.spanContext().spanId,r=lk(t);if(!r){fk(e,{id:n,span:t,children:[]});return}let i=dk(e,r),a=fk(e,{id:n,span:t,parentNode:i,children:[]});i.children.push(a)}function dk(e,t){return e.get(t)||fk(e,{id:t,children:[]})}function fk(e,t){let n=e.get(t.id);return n?.span?n:n&&!n.span?(n.span=t.span,n.parentNode=t.parentNode,n):(e.set(t.id,t),t)}var pk={1:`cancelled`,2:`unknown_error`,3:`invalid_argument`,4:`deadline_exceeded`,5:`not_found`,6:`already_exists`,7:`permission_denied`,8:`resource_exhausted`,9:`failed_precondition`,10:`aborted`,11:`out_of_range`,12:`unimplemented`,13:`internal_error`,14:`unavailable`,15:`data_loss`,16:`unauthenticated`},mk=e=>Object.values(pk).includes(e);function hk(e){let t=qD(e)?e.attributes:{},n=YD(e)?e.status:void 0;if(n){if(n.code===ee.OK)return{code:1};if(n.code===ee.ERROR){if(n.message===void 0){let e=gk(t);if(e)return e}return n.message&&mk(n.message)?{code:2,message:n.message}:{code:2,message:`internal_error`}}}return gk(t)||(n?.code===ee.UNSET?{code:1}:{code:2,message:`unknown_error`})}function gk(e){let t=e[`http.response.status_code`]||e[`http.status_code`],n=e[Jl],r=typeof t==`number`?t:typeof t==`string`?parseInt(t):void 0;if(typeof r==`number`)return Hi(r);if(typeof n==`string`)return{code:2,message:pk[n]||`unknown_error`}}var _k=1e3,vk=300,yk=1e4,bk=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||vk,this._finishedSpanBuckets=Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor($n()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new lx(yk),this._debouncedFlush=vs(this.flush.bind(this),1,{maxWait:100})}export(e){let t=Math.floor($n()/1e3);if(this._lastCleanupTimestampInS!==t){let e=0;this._finishedSpanBuckets.forEach((n,r)=>{n&&n.timestampInS<=t-this._finishedSpanBucketSize&&(e+=n.spans.size,this._finishedSpanBuckets[r]=void 0)}),e>0&&OO&&A.log(`SpanExporter dropped ${e} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=t}let n=t%this._finishedSpanBucketSize,r=this._finishedSpanBuckets[n]||{timestampInS:t,spans:new Set};this._finishedSpanBuckets[n]=r,r.spans.add(e),this._spansToBucketEntry.set(e,r);let i=lk(e);(!i||this._sentSpans.get(i))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(e=>e?Array.from(e.spans):[]),t=this._maybeSend(e),n=t.size,r=e.length-n;OO&&A.log(`SpanExporter exported ${n} spans, ${r} spans are waiting for their parent spans to finish`);for(let e of t){this._sentSpans.set(e.spanContext().spanId,1);let t=this._spansToBucketEntry.get(e);t&&t.spans.delete(e)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let t=ck(e),n=new Set,r=this._getCompletedRootNodes(t);for(let e of r){let t=e.span;n.add(t);let r=Sk(t);if(e.parentNode&&this._sentSpans.get(e.parentNode.id)){let e=r.contexts?.trace?.data;e&&(e[`sentry.parent_span_already_sent`]=!0)}let i=r.spans||[],a=!1;for(let t of e.children)Ck(t,i,n)&&(a=!0);r.spans=i.length>_k?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,_k):i,a&&(r.sdkProcessingMetadata={...r.sdkProcessingMetadata,hasGenAiSpans:!0});let o=Vo(t.events);o&&(r.measurements=o),Ku(r)}return n}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||!!this._sentSpans.get(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(e=>this._nodeIsCompletedRootNodeOrHasSentParent(e))}};function xk(e){let t=e.attributes;return{origin:t[I],op:t[F],source:t[Ci]}}function Sk(e){let{op:t,description:n,data:r,origin:i=`manual`,source:a}=wk(e),o=Xi(e),s=e.attributes[wi],c={[Ci]:a,[wi]:s,[F]:t,[I]:i,...r,...Tk(e.attributes)},{links:l}=e,{traceId:u,spanId:d}=e.spanContext(),f={parent_span_id:KD(e),span_id:d,trace_id:u,data:c,origin:i,op:t,status:Wa(hk(e)),links:Pa(l)},p=c[xl],m=typeof p==`number`?{response:{status_code:p}}:void 0;return{contexts:{trace:f,otel:{resource:e.resource.attributes},...m},spans:[],start_timestamp:Ia(e.startTime),timestamp:Ia(e.endTime),transaction:n,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:o.scope,capturedSpanIsolationScope:o.isolationScope,sampleRate:s,dynamicSamplingContext:go(e)},...a&&{transaction_info:{source:a}}}}function Ck(e,t,n){let r=e.span;if(r&&n.add(r),!r){let r=!1;return e.children.forEach(e=>{Ck(e,t,n)&&(r=!0)}),r}let i=r.spanContext().spanId,a=r.spanContext().traceId,o=KD(r),{attributes:s,startTime:c,endTime:l,links:u}=r,{op:d,description:f,data:p,origin:m=`manual`}=wk(r),h={[I]:m,[F]:d,...Tk(s),...p},g=hk(r),_={span_id:i,trace_id:a,data:h,description:f,parent_span_id:o,start_timestamp:Ia(c),timestamp:Ia(l)||void 0,status:Wa(g),op:d,origin:m,measurements:Vo(r.events),links:Pa(u)};t.push(_);let v=!!d?.startsWith(`gen_ai.`);return e.children.forEach(e=>{Ck(e,t,n)&&(v=!0)}),v}function wk(e){let{op:t,source:n,origin:r}=xk(e),{op:i,description:a,source:o,data:s}=bO(e);return{op:t||i,description:a,source:n||o,origin:r,data:{...s,...Ek(e)}}}function Tk(e){let t={...e};return delete t[wi],delete t[WD],delete t[Pi],t}function Ek(e){let t=e.attributes,n={};e.kind!==y.INTERNAL&&(n[`otel.kind`]=y[e.kind]);let r=t[wl];r&&(n[xl]=r);let i=ZD(e);return i.url&&(n.url=i.url),i[`http.query`]&&(n[`http.query`]=i[`http.query`].slice(1)),i[`http.fragment`]&&(n[`http.fragment`]=i[`http.fragment`].slice(1)),n}function Dk(e,t){let n=e.attributes??{},r=t?.spanKind??G.INTERNAL,{op:i,description:a,source:o,data:s}=yO(e.name,n,r);e.name=a,_u(e,{[F]:i,[Ci]:o,[eu]:`manual`,...s}),r!==G.INTERNAL&&_u(e,{"otel.kind":Lp(r)})}var Ok=class{constructor(e){this._unsubscribePreprocessSpan=void 0,NO(`SentrySpanProcessor`),this._exporter=new bk(e),this._client=e?.client??P(),this._client&&Wo(this._client)&&(this._unsubscribePreprocessSpan=this._client.on(`preprocessSpan`,Dk))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(e,t){let n=g.getSpan(t),r=pO(t);n&&!n.spanContext().isRemote&&Ya(n,e),n?.spanContext().isRemote&&e.setAttribute(WD,!0),t===ne&&(r={scope:Qr(),isolationScope:$r()}),r&&Yi(e,r.scope,r.isolationScope),Ro(e),this._client?.emit(`spanStart`,e)}onEnd(e){zo(e),this._client?.emit(`spanEnd`,e),this._client&&Wo(this._client)?this._client.emit(`afterSpanEnd`,e):this._exporter.export(e)}},kk=class{constructor(e){this._client=e,this._isSpanStreaming=Wo(e),NO(`SentrySampler`)}shouldSample(e,t,n,r,i,a){let o=this._client.getOptions(),{ignoreSpans:s}=o,c=Nk(e),l=c?.spanContext();if(!to(o))return jk({decision:void 0,context:e,spanAttributes:i});let u=i[`http.method`]||i[`http.request.method`];if(r===y.CLIENT&&u&&(!c||l?.isRemote)&&!this._isSpanStreaming)return this._client.recordDroppedEvent(`no_parent_span`,`span`),jk({decision:void 0,context:e,spanAttributes:i});let d=c?Ak(c,t,n):void 0;if(c&&!l?.isRemote){if(this._isSpanStreaming){if(d&&s?.length){let{description:t,op:a}=yO(n,i,r);if(ro({description:t,op:i[`sentry.op`]??a,attributes:i},s))return this._client.recordDroppedEvent(`ignored`,`span`),jk({decision:hD.NOT_RECORD,context:e,spanAttributes:i,ignoredChildSpan:!0})}if(!d){let e=l?.traceState?.get(sO)===`1`;this._client.recordDroppedEvent(e?`ignored`:`sample_rate`,`span`)}}return jk({decision:d?hD.RECORD_AND_SAMPLED:hD.NOT_RECORD,context:e,spanAttributes:i})}let{description:f,data:p,op:m}=yO(n,i,r),h={...p,...i};if(m&&(h[F]=m),this._isSpanStreaming&&s?.length&&ro({description:f,op:h[`sentry.op`]??m,attributes:h},s))return this._client.recordDroppedEvent(`ignored`,`span`),jk({decision:hD.NOT_RECORD,context:e,spanAttributes:i,ignoredSegmentSpan:!0});let g={decision:!0};if(this._client.emit(`beforeSampling`,{spanAttributes:h,spanName:f,parentSampled:d,parentContext:l},g),!g.decision)return jk({decision:void 0,context:e,spanAttributes:i});let{isolationScope:_}=pO(e)??{},v=l?.traceState?l.traceState.get(tO):void 0,ee=v?ia(v):void 0,te=ba(ee?.sample_rand)??Qn(),[ne,re,ie]=$o(o,{name:f,attributes:h,normalizedRequest:_?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:ba(ee?.sample_rate)},te),ae=`${u}`.toUpperCase();return ae===`OPTIONS`||ae===`HEAD`?(OO&&A.log(`[Tracing] Not sampling span because HTTP method is '${ae}' for ${n}`),jk({decision:hD.NOT_RECORD,context:e,spanAttributes:i,sampleRand:te,downstreamTraceSampleRate:0})):(!ne&&d===void 0&&(OO&&A.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),this._client.recordDroppedEvent(`sample_rate`,this._isSpanStreaming?`span`:`transaction`)),{...jk({decision:ne?hD.RECORD_AND_SAMPLED:hD.NOT_RECORD,context:e,spanAttributes:i,sampleRand:te,downstreamTraceSampleRate:ie?re:void 0}),attributes:{[wi]:ie?re:void 0}})}toString(){return`SentrySampler`}};function Ak(e,t,n){let r=e.spanContext();if(a(r)&&r.traceId===t){if(r.isRemote){let t=_O(e.spanContext());return OO&&A.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${t}`),t}let t=_O(r);return OO&&A.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${t}`),t}}function jk({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:i,ignoredChildSpan:a,ignoredSegmentSpan:o}){let s=Mk(t,n);return i!==void 0&&(s=s.set(aO,`${i}`)),r!==void 0&&(s=s.set(iO,`${r}`)),a&&(s=s.set(oO,`1`)),o&&(s=s.set(sO,`1`)),e==null?{decision:hD.NOT_RECORD,traceState:s}:e===hD.NOT_RECORD?{decision:e,traceState:s.set(nO,`1`)}:{decision:e,traceState:s}}function Mk(e,t){let n=g.getSpan(e)?.spanContext()?.traceState||new kO,r=t[`http.url`]||t[`url.full`];return r&&typeof r==`string`&&(n=n.set(rO,r)),n}function Nk(e){let t=g.getSpan(e);return t&&a(t.spanContext())?t:void 0}function Pk(e,t={}){let n=L(e),r=n.data,i=e.kind??y.INTERNAL,a=Qi(e),o=r[Pi]!==void 0,s=a&&!o&&!ea(e),c=s&&r[`sentry.source`]===`custom`?{...r,[Ci]:void 0}:r,l=yO(n.description||`<unknown>`,c,i);if(i!==y.INTERNAL&&r[`otel.kind`]===void 0&&e.setAttribute(`otel.kind`,y[i]),l.op&&r[`sentry.op`]===void 0&&e.setAttribute(F,l.op),l.source!==void 0&&l.source!==`custom`&&(t.finalizeStatus||l.source!==`url`)&&(n.parent_span_id===void 0||i===y.SERVER)&&(r[`sentry.source`]===void 0||s)&&e.setAttribute(Ci,l.source),l.data&&Object.entries(l.data).forEach(([t,n])=>{n!==void 0&&r[t]===void 0&&e.setAttribute(t,n)}),t.finalizeStatus){Lk(e,r);let t=P();Ik(e,r,n.status,!!t&&Wo(t))}a&&l.description!==n.description&&(r[`sentry.source`]!==`custom`||s)&&e.updateName(l.description)}function Fk(e,t){Un(e,`kind`,t??y.INTERNAL)}function Ik(e,t,n,r){if(n===void 0){e.setStatus(gk(t)||{code:1});return}!r&&n!==`ok`&&!mk(n)&&e.setStatus({code:2,message:`internal_error`})}function Lk(e,t){let n=t[wl];t[`http.response.status_code`]===void 0&&n!==void 0&&(e.setAttribute(xl,n),t[xl]=n)}var Rk=class{startSpan(e,t={},n){let i=n||r.active(),a=t.root?void 0:g.getSpan(i);if(he(i))return this._createNonRecordingSpan(a);let o=this._startSentrySpan(e,t,a,n!==void 0);return ta(o),Fk(o,t.kind),t.attributes?.[`sentry.source`]===void 0&&Zi(o),Pk(o),o}startActiveSpan(e,t,n,i){let a=typeof t==`function`?{}:t,o=typeof n==`function`||n===void 0?r.active():n,s=typeof t==`function`?t:typeof n==`function`?n:i,c=this.startSpan(e,a,o),l=Xi(c).isolationScope,u=e=>l?e.setValue(dO,l):e;return _s(c)&&g.getSpan(o)?r.with(u(o),()=>s(c)):r.with(u(g.setSpan(o,c)),()=>(Jr(M(),c),s(c)))}_startSentrySpan(e,t,n,r){let i={name:e,attributes:t.attributes,links:t.links,startTime:t.startTime};return t.root?ss(()=>ns({...i,parentSpan:null})):n?.spanContext().isRemote?this._startRootSpanWithRemoteParent(i,n):n?ns({...i,parentSpan:n}):ss(()=>ns({...i,parentSpan:r?null:void 0}))}_startRootSpanWithRemoteParent(e,t){let{spanId:n,traceId:r,traceState:i}=t.spanContext(),a=go(t),o=typeof a.sample_rand==`string`?Number(a.sample_rand):void 0,s=!!i?.get(tO);return bi(i=>(i.setPropagationContext({traceId:r,parentSpanId:n,sampled:_O(t.spanContext()),dsc:s?a:void 0,sampleRand:typeof o==`number`&&!Number.isNaN(o)?o:Qn()}),Jr(i,void 0),ns({...e,parentSpan:null})))}_createNonRecordingSpan(e){let t=new co({traceId:e?.spanContext().traceId});return e&&Ya(e,t),Yi(t,M(),N()),t}},zk=class{constructor(e={}){this._tracers=new Map,this.resource=e.resource}getTracer(e,t,n){let r=JSON.stringify([e,t,n]),i=this._tracers.get(r);if(i)return i;let a=new Rk;return this._tracers.set(r,a),a}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},Bk=`telemetry.sdk.language`,Vk=`telemetry.sdk.name`,Hk=`telemetry.sdk.version`,Uk=`service.namespace`,Wk=class e{constructor(e){this._attributes=e}get attributes(){return this._attributes}merge(t){return t?new e({...this._attributes,...t.attributes}):this}getRawAttributes(){return Object.entries(this._attributes)}};function Gk(e){if(!e)return{};let t={};for(let n of e.split(`,`)){let e=n.indexOf(`=`);if(e===-1)continue;let r=n.substring(0,e).trim(),i=n.substring(e+1).trim();if(r)try{t[r]=decodeURIComponent(i)}catch{t[r]=i}}return t}function Kk(e){let t=typeof process<`u`?process.env:{},n=t.OTEL_SERVICE_NAME,r=Gk(t.OTEL_RESOURCE_ATTRIBUTES);return new Wk({[Uk]:`sentry`,[cu]:e,...r,...n?{[cu]:n}:{},[lu]:k,[Bk]:re[Bk],[Vk]:re[Vk],[Hk]:re[Hk]})}function qk({span:e,scope:t,client:n,propagateTraceparent:i}={}){let a=(t&&gO(t))??r.active();if(e){let{scope:t}=Xi(e);a=t&&gO(t)||g.setSpan(r.active(),e)}let{traceId:o,spanId:s,sampled:c,dynamicSamplingContext:l}=FO(a,{scope:t,client:n}),u={"sentry-trace":Ta(o,s,c),baggage:aa(l)};return i&&(u.traceparent=Ea(o,s,c)),u}function Jk(e){function t(){return pO(r.active())||{scope:Qr(),isolationScope:$r()}}function n(e){let t=r.active();return r.with(t,()=>e(s()))}function i(e,t){let n=gO(e)||r.active();return r.with(n.setValue(uO,e),()=>t(e))}function a(e){let t=r.active();return r.with(t.setValue(lO,!0),()=>{let t=s();return Ca(t.getPropagationContext())||t.setPropagationContext({traceId:Ur(),sampleRand:Qn()}),e(c())})}function o(e,t){let n=r.active();return r.with(n.setValue(dO,e),()=>t(c()))}function s(){return t().scope}function c(){return t().isolationScope}ui({withScope:n,withSetScope:i,withSetIsolationScope:o,withIsolationScope:a,getCurrentScope:s,getIsolationScope:c,startSpan:WO,startSpanManual:GO,startInactiveSpan:KO,getActiveSpan:DO,suppressTracing:ik,isTracingSuppressed:ak,getTraceData:qk,continueTrace:ek,startNewTrace:tk,withActiveSpan:qO,getTracingChannelBinding:e?.getTracingChannelBinding})}b();var Yk=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`],Xk=class{constructor(){this._kOtListeners=Symbol(`OtListeners`),this._wrapped=!1,NO(`SentryContextManager`),this._asyncLocalStorage=di(Qt()).getTracingChannelBinding?.()?.asyncLocalStorage??new Ge}active(){return this._asyncLocalStorage.getStore()??ne}with(e,t,n,...r){let i=sk(e,this.active()),a=n==null?t:t.bind(n);return this._asyncLocalStorage.run(i,a,...r)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}bind(e,t){return t instanceof xe?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:cO}}_bindFunction(e,t){let n=this.with.bind(this),r=function(...r){return n(e,()=>t.apply(this,r))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindEventEmitter(e,t){if(this._getPatchMap(t)!==void 0)return t;this._createPatchMap(t);for(let n of Yk)t[n]!==void 0&&(t[n]=this._patchAddListener(t,t[n],e));return typeof t.removeListener==`function`&&(t.removeListener=this._patchRemoveListener(t,t.removeListener)),typeof t.off==`function`&&(t.off=this._patchRemoveListener(t,t.off)),typeof t.removeAllListeners==`function`&&(t.removeAllListeners=this._patchRemoveAllListeners(t,t.removeAllListeners)),t}_patchRemoveListener(e,t){let n=this;return function(r,i){let a=n._getPatchMap(e)?.[r];if(a===void 0)return t.call(this,r,i);let o=a.get(i);return t.call(this,r,o||i)}}_patchRemoveAllListeners(e,t){let n=this;return function(r){let i=n._getPatchMap(e);return i!==void 0&&(arguments.length===0?n._createPatchMap(e):r!==void 0&&i[r]!==void 0&&delete i[r]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let r=this;return function(i,a){if(r._wrapped)return t.call(this,i,a);let o=r._getPatchMap(e);o===void 0&&(o=r._createPatchMap(e));let s=o[i];s===void 0&&(s=new WeakMap,o[i]=s);let c=r.bind(n,a);s.set(a,c),r._wrapped=!0;try{return t.call(this,i,c)}finally{r._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}};function Zk(e){Jk({getTracingChannelBinding:e?.skipOpenTelemetrySetup?$k():Qk()})}function Qk(){let e=new Ge;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:eA})}function $k(){return()=>{try{let e=r._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return e?{asyncLocalStorage:e,getStoreWithActiveSpan:eA}:void 0}catch{return}}}function eA(e){let t=r.active();return _s(e)&&Za(e)!==e||e.spanContext().traceState?.get(`sentry.ignored`)===`1`?t:g.setSpan(t,e)}var tA=Xk;b();function nA(){f.disable(),f.setLogger({error:A.error,warn:A.warn,info:A.log,debug:A.log,verbose:A.log},l.DEBUG)}var rA={};function Y(e,t,n){return n?aA(e,t,n):iA(e,t)}function iA(e,t){return Object.assign(n=>{let r=rA[e];if(r)return n&&r.setConfig(n),r;let i=t(n);return rA[e]=i,vT({instrumentations:[i]}),i},{id:e})}function aA(e,t,n){return Object.assign(r=>{let i=n(r),a=rA[e];if(a)return a.setConfig(i),a;let o=new t(i);return rA[e]=o,vT({instrumentations:[o]}),o},{id:e})}var oA=`ChildProcess`,sA=W((e={})=>({name:oA,setup(){w.channel(`child_process`).subscribe(t=>{j(t)&&`process`in t&&cA(t.process,e)}),w.channel(`worker_threads`).subscribe(t=>{j(t)&&`worker`in t&&lA(t.worker,e)})}}));function cA(e,t){let n=!1,r;e.on(`spawn`,()=>{if(e.spawnfile===`/usr/bin/sw_vers`){n=!0;return}r={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(r.spawnargs=e.spawnargs)}).on(`exit`,e=>{n||(n=!0,e!==null&&e!==0&&zp({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,zp({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function lA(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?zp({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):H(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}var uA=Ie(Ae),dA=Ie(Me),fA=`Context`,pA=W(((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?yA():void 0,r=t.device?bA(t.device):void 0,i=t.culture?vA():void 0,a=t.cloudResource?OA():void 0,o=t.os?_A():void 0,s={"process.runtime.engine.name":`v8`,"process.runtime.engine.version":process.versions.v8,...hA({app:n,device:r,culture:i,cloud_resource:a})};o&&o.then(e=>Object.assign(s,hA({os:e}))).catch(()=>{});let c=(async()=>{let e={};return o&&(e.os=await o),n&&(e.app=n),r&&(e.device=r),i&&(e.culture=i),a&&(e.cloud_resource=a),e})();async function l(e){let t=mA(await c);return e.contexts={...e.contexts,app:{...t.app,...e.contexts?.app},os:{...t.os,...e.contexts?.os},device:{...t.device,...e.contexts?.device},culture:{...t.culture,...e.contexts?.culture},cloud_resource:{...t.cloud_resource,...e.contexts?.cloud_resource}},e}return{name:fA,processEvent(e){return l(e)},processSegmentSpan(e){_u(e,s),_u(e,gA(n,r))}}}));function mA(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory==`function`){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=$e.freemem()),e}function hA(e){let t={},{app:n,device:r,os:i,culture:a,cloud_resource:o}=e;if(n&&n.app_start_time&&(t[`app.start_time`]=n.app_start_time),r&&(r.arch&&(t[`device.archs`]=[r.arch]),r.boot_time&&(t[`device.boot_time`]=r.boot_time),r.memory_size!=null&&(t[`device.memory_size`]=r.memory_size),r.processor_count!=null&&(t[`device.processor_count`]=r.processor_count),r.cpu_description&&(t[`device.cpu_description`]=r.cpu_description),r.processor_frequency!=null&&(t[`device.processor_frequency`]=r.processor_frequency)),i&&(i.name&&(t[`os.name`]=i.name),i.version&&(t[`os.version`]=i.version),i.kernel_version&&(t[`os.kernel_version`]=i.kernel_version),i.build&&(t[`os.build`]=i.build)),a&&(a.locale&&(t[`culture.locale`]=a.locale),a.timezone&&(t[`culture.timezone`]=a.timezone)),o)for(let[e,n]of Object.entries(o))n!=null&&(t[e]=n);return t}function gA(e,t){let n={};if(e&&(n[`app.memory`]=process.memoryUsage().rss,typeof process.availableMemory==`function`)){let e=process.availableMemory?.();e!=null&&(n[`app.free_memory`]=e)}return t?.free_memory!=null&&(n[`device.free_memory`]=$e.freemem()),n}async function _A(){let e=$e.platform();switch(e){case`darwin`:return TA();case`linux`:return DA();default:return{name:xA[e]||e,version:$e.release()}}}function vA(){try{if(typeof process.versions.icu!=`string`)return;let e=new Date(9e8);if(new Intl.DateTimeFormat(`es`,{month:`long`}).format(e)===`enero`){let e=Intl.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone}}}catch{}}function yA(){let e=process.memoryUsage().rss,t={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory==`function`){let e=process.availableMemory?.();e!=null&&(t.free_memory=e)}return t}function bA(e){let t={},n;try{n=$e.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=$e.arch(),(e===!0||e.memory)&&(t.memory_size=$e.totalmem(),t.free_memory=$e.freemem()),e===!0||e.cpu){let e=$e.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}var xA={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},SA=[{name:`fedora-release`,distros:[`Fedora`]},{name:`redhat-release`,distros:[`Red Hat Linux`,`Centos`]},{name:`redhat_version`,distros:[`Red Hat Linux`]},{name:`SuSE-release`,distros:[`SUSE Linux`]},{name:`lsb-release`,distros:[`Ubuntu Linux`,`Arch Linux`]},{name:`debian_version`,distros:[`Debian`]},{name:`debian_release`,distros:[`Debian`]},{name:`arch-release`,distros:[`Arch Linux`]},{name:`gentoo-release`,distros:[`Gentoo Linux`]},{name:`novell-release`,distros:[`SUSE Linux`]},{name:`alpine-release`,distros:[`Alpine Linux`]}],CA={alpine:e=>e,arch:e=>wA(/distrib_release=(.*)/,e),centos:e=>wA(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>wA(/release (..)/,e),mint:e=>wA(/distrib_release=(.*)/,e),red:e=>wA(/release ([^ ]+)/,e),suse:e=>wA(/VERSION = (.*)\n/,e),ubuntu:e=>wA(/distrib_release=(.*)/,e)};function wA(e,t){let n=e.exec(t);return n?n[1]:void 0}async function TA(){let e={kernel_version:$e.release(),name:`Mac OS X`,version:`10.${Number($e.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Ce(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=wA(/^ProductName:\s+(.*)$/m,t),e.version=wA(/^ProductVersion:\s+(.*)$/m,t),e.build=wA(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function EA(e){return e.split(` `)[0].toLowerCase()}async function DA(){let e={kernel_version:$e.release(),name:`Linux`};try{let t=await dA(`/etc`),n=SA.find(e=>t.includes(e.name));if(!n)return e;let r=(await uA(Te(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(EA(e))>=0)||i[0],e.version=CA[EA(e.name)]?.(r)}catch{}return e}function OA(){if(process.env.VERCEL)return{"cloud.provider":`vercel`,"cloud.region":process.env.VERCEL_REGION};if(process.env.AWS_REGION)return{"cloud.provider":`aws`,"cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV};if(process.env.GCP_PROJECT)return{"cloud.provider":`gcp`};if(process.env.ALIYUN_REGION_ID)return{"cloud.provider":`alibaba_cloud`,"cloud.region":process.env.ALIYUN_REGION_ID};if(process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME)return{"cloud.provider":`azure`,"cloud.region":process.env.REGION_NAME};if(process.env.IBM_CLOUD_REGION)return{"cloud.provider":`ibm_cloud`,"cloud.region":process.env.IBM_CLOUD_REGION};if(process.env.TENCENTCLOUD_REGION)return{"cloud.provider":`tencent_cloud`,"cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE};if(process.env.NETLIFY)return{"cloud.provider":`netlify`};if(process.env.FLY_REGION)return{"cloud.provider":`fly.io`,"cloud.region":process.env.FLY_REGION};if(process.env.DYNO)return{"cloud.provider":`heroku`}}var kA=new lx(10),AA=new lx(20),jA=7,MA=`ContextLines`;function NA(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function PA(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function FA(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function IA(e,t){let n=kA.get(e);if(n===void 0)return!1;for(let e=t[0];e<=t[1];e++)if(n[e]===void 0)return!1;return!0}function LA(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=GA(r,t),a=[];for(;;){if(n===e.length-1){a.push(i);break}let r=e[n+1];if(typeof r!=`number`)break;r<=i[1]?i[1]=r+t:(a.push(i),i=GA(r,t)),n++}return a}function RA(e,t,n){return new Promise((r,i)=>{let a=ke(e),o=st({input:a});function s(){a.destroy(),r()}let c=0,l=0,u=t[l];if(u===void 0){s();return}let d=u[0],f=u[1];function p(t){AA.set(e,1),Kw&&A.error(`Failed to read file: ${e}. Error: ${t}`),o.close(),o.removeAllListeners(),s()}a.on(`error`,p),o.on(`error`,p),o.on(`close`,s),o.on(`line`,e=>{if(c++,!(c<d)&&(n[c]=gr(e,0),c>=f)){if(l===t.length-1){o.close(),o.removeAllListeners();return}l++;let e=t[l];if(e===void 0){o.close(),o.removeAllListeners();return}d=e[0],f=e[1]}})})}async function zA(e,t){let n={};if(t>0&&e.exception?.values){for(let t of e.exception.values)if(t.stacktrace?.frames?.length)for(let e=t.stacktrace.frames.length-1;e>=0;e--){let r=t.stacktrace.frames[e],i=r?.filename;!r||typeof i!=`string`||typeof r.lineno!=`number`||PA(i)||FA(r)||(n[i]||(n[i]=[]),n[i].push(r.lineno))}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let e of r){if(AA.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=LA(r,t);if(a.every(t=>IA(e,t)))continue;let o=NA(kA,e,{});i.push(RA(e,a,o))}if(await Promise.all(i).catch(()=>{Kw&&A.log(`Failed to read one or more source files and resolve context lines`)}),t>0&&e.exception?.values)for(let n of e.exception.values)n.stacktrace?.frames&&n.stacktrace.frames.length>0&&BA(n.stacktrace.frames,t,kA);return e}function BA(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno==`number`){let e=n.get(r.filename);if(e===void 0)continue;HA(r.lineno,r,t,e)}}function VA(e){delete e.pre_context,delete e.context_line,delete e.post_context}function HA(e,t,n,r){if(t.lineno===void 0||r===void 0){Kw&&A.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=UA(e,n);i<e;i++){let e=r[i];if(e===void 0){VA(t),Kw&&A.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){VA(t),Kw&&A.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=WA(e,n);t.post_context=[];for(let n=e+1;n<=i;n++){let e=r[n];if(e===void 0)break;t.post_context.push(e)}}function UA(e,t){return Math.max(1,e-t)}function WA(e,t){return e+t}function GA(e,t){return[UA(e,t),WA(e,t)]}var KA=W(((e={})=>({name:MA,processEvent(t,n,r){return zA(t,e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??jA)}}))),qA;async function JA(){if(qA===void 0)try{qA=!!(await import(`node:inspector`)).url()}catch{qA=!1}return qA}function YA(e,t){return $f(e,t)}var XA=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function ZA(e,t,n){let r=0,i=5,a=0;return setInterval(()=>{a===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),a=i):(--a,a===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function QA(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function $A(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||QA(e)&&QA(t)}var ej=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc0LjAgKGNlNTAwOWEpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgY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R8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`;function tj(...e){A.log(`[LocalVariables]`,...e)}var nj=W(((e={})=>{function t(t,n,r){if(r===!1)return;let i=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<i.length;t++){let a=i.length-t-1,o=n[t],s=i[a];if(!s||!o)break;o.vars===void 0||s.in_app===!1&&e.includeOutOfAppFrames!==!0||!$A(s.function,o.function)||(s.vars=YA(o.vars,r))}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&`__SENTRY_ERROR_LOCAL_VARIABLES__`in n.originalException&&Array.isArray(n.originalException.__SENTRY_ERROR_LOCAL_VARIABLES__)){let r=P()?.getDataCollectionOptions().stackFrameVariables??!0;for(let i of e.exception?.values||[])t(i,n.originalException[XA],r);n.originalException[XA]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new Xe(new URL(`data:application/javascript;base64,${ej}`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{tj(`Worker error`,e)}),t.once(`exit`,e=>{tj(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await JA()){A.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:A.isEnabled()};r().then(()=>{try{i(n)}catch(e){A.error(`Failed to start worker`,e)}},e=>{A.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function rj(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function ij(e,t){if(t!==void 0)return rj(e(t,1))}function aj(e){let t=[],n=!1;function r(r){t=[],!n&&(n=!0,e(r))}t.push(r);function i(e){t.push(e)}function a(e){let n=t.pop()||r;try{n(e)}catch{r(e)}}return{add:i,next:a}}var oj=class e{constructor(e){this._session=e}static async create(t){if(t)return t;let n=await import(`node:inspector`);return new e(new n.Session)}configureAndConnect(e,t){this._session.connect(),this._session.on(`Debugger.paused`,t=>{e(t,()=>{this._session.post(`Debugger.resume`)})}),this._session.post(`Debugger.enable`),this._session.post(`Debugger.setPauseOnExceptions`,{state:t?`all`:`uncaught`})}setPauseOnExceptions(e){this._session.post(`Debugger.setPauseOnExceptions`,{state:e?`all`:`uncaught`})}getLocalVariables(e,t){this._getProperties(e,e=>{let{add:n,next:r}=aj(t);for(let t of e)if(t.value?.objectId&&t.value.className===`Array`){let e=t.value.objectId;n(n=>this._unrollArray(e,t.name,n,r))}else if(t.value?.objectId&&t.value.className===`Object`){let e=t.value.objectId;n(n=>this._unrollObject(e,t.name,n,r))}else t.value&&n(e=>this._unrollOther(t,e,r));r({})})}_getProperties(e,t){this._session.post(`Runtime.getProperties`,{objectId:e,ownProperties:!0},(e,n)=>{t(e?[]:n.result)})}_unrollArray(e,t,n,r){this._getProperties(e,e=>{n[t]=e.filter(e=>e.name!==`length`&&!isNaN(parseInt(e.name,10))).sort((e,t)=>parseInt(e.name,10)-parseInt(t.name,10)).map(e=>e.value?.value),r(n)})}_unrollObject(e,t,n,r){this._getProperties(e,e=>{n[t]=e.map(e=>[e.name,e.value?.value]).reduce((e,[t,n])=>(e[t]=n,e),{}),r(n)})}_unrollOther(e,t,n){e.value&&(`value`in e.value?e.value.value===void 0||e.value.value===null?t[e.name]=`<${e.value.value}>`:t[e.name]=e.value.value:`description`in e.value&&e.value.type!==`function`?t[e.name]=`<${e.value.description}>`:e.value.type===`undefined`&&(t[e.name]=`<undefined>`)),n(t)}},sj=`LocalVariables`,cj=W(((e={},t)=>{let n=new lx(20),r,i=!1;function a(t,r){let i=rj(t.stacktrace?.frames);if(i===void 0)return;let a=n.remove(i);if(a===void 0||r===!1)return;let o=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<o.length;t++){let n=o.length-t-1,i=a[t],s=o[n];if(!s||!i)break;i.vars===void 0||s.in_app===!1&&e.includeOutOfAppFrames!==!0||!$A(s.function,i.function)||(s.vars=YA(i.vars,r))}}function o(e){for(let t of e.exception?.values||[])a(t,P()?.getDataCollectionOptions().stackFrameVariables??!0);return e}let s;async function c(){let a=P()?.getOptions();if(a?.includeLocalVariables){if(EE<18){A.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await JA()){A.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await oj.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=ij(e,i.description);if(c==null){s();return}let{add:l,next:u}=aj(e=>{n.set(c,e),s()});for(let e=0;e<Math.min(a.length,5);e++){let{scopeChain:t,functionName:n,this:r}=a[e],i=t.find(e=>e.type===`local`),s=r.className===`global`||!r.className?n:`${r.className}.${n}`;if(i?.object.objectId===void 0)l(t=>{t[e]={function:s},u(t)});else{let t=i.object.objectId;l(n=>o.getLocalVariables(t,t=>{n[e]={function:s,vars:t},u(n)}))}}u([])},c=e.captureAllExceptions!==!1;o.configureAndConnect((e,t)=>s(a.stackParser,e,t),c),c&&(r=ZA(e.maxExceptionsPerSecond||50,()=>{A.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{A.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){A.log("The `LocalVariables` integration failed to start.",e)}}}return{name:sj,setupOnce(){s=c()},async processEvent(e){return await s,i?o(e):e},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}})),lj=(e={})=>TE.major<19?cj(e):nj(e),uj,dj=`Modules`;function fj(){return typeof __SENTRY_SERVER_MODULES__<`u`?__SENTRY_SERVER_MODULES__:O.__SENTRY_SERVER_MODULES__??{}}var pj=(()=>({name:dj,processEvent(e){return e.modules={...e.modules,...hj()},e},getModules:hj}));function mj(){return{...fj(),..._j()}}function hj(){return uj||=mj(),uj}function gj(){try{let e=Te(process.cwd(),`package.json`);return JSON.parse(je(e,`utf8`))}catch{return{}}}function _j(){let e=gj();return{...e.dependencies,...e.devDependencies}}var vj=2e3;function yj(e){an(()=>{console.error(e)});let t=P();if(t===void 0){Kw&&A.warn(`No NodeClient was defined, we are exiting the process now.`),global.process.exit(1);return}let n=t.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:vj;t.close(r).then(e=>{e||Kw&&A.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Kw&&A.error(e)})}var bj=`OnUncaughtException`,xj=W((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:bj,setup(e){it&&global.process.on(`uncaughtException`,Sj(e,t))}}});function Sj(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=yj;t.onFatalError?c=t.onFatalError:o.onFatalError&&(c=o.onFatalError);let l=global.process.listeners(`uncaughtException`).filter(e=>e.name!==`domainUncaughtExceptionClear`&&e._errorHandler!==!0).length===0,u=t.exitEvenIfOtherHandlersAreRegistered||l;n?u&&(i?(Kw&&A.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),yj(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,P()===e&&H(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}var Cj=`OnUnhandledRejection`,wj=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Tj=W(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...wj,...e.ignore??[]]};return{name:Cj,setup(e){global.process.on(`unhandledRejection`,kj(e,t))}}}));function Ej(e){if(!j(e))return{name:``,message:String(e??``)};let t=e;return{name:typeof t.name==`string`?t.name:``,message:typeof t.message==`string`?t.message:String(e)}}function Dj(e,t){let n=e.name===void 0||vr(t.name,e.name,!0),r=e.message===void 0||vr(t.message,e.message);return n&&r}function Oj(e,t){let n=Ej(t);return e.some(e=>Dj(e,n))}function kj(e,t){return function(n,r){if(P()!==e||Oj(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=j(n)?n._sentry_active_span:void 0;(a?e=>V(a,e):e=>e())(()=>{H(n,{originalException:n,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),Aj(n,t.mode)}}function Aj(e,t){let n=`This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:`;t===`warn`?an(()=>{console.warn(n),console.error(j(e)&&`stack`in e?e.stack:e)}):t===`strict`&&(an(()=>{console.warn(n)}),yj(e))}var jj=`ProcessSession`,Mj=W(()=>({name:jj,setupOnce(){cd(),process.on(`beforeExit`,()=>{N().getSession()?.status===`ok`&&ld()})}})),Nj=`Spotlight`,Pj=W(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:Nj,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&A.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}Fj(e,t)}}}));function Fj(e,t){let n=Ij(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){A.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=To(e);as(()=>{let e=C.request({method:`POST`,path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":`application/x-sentry-envelope`}},e=>{e.statusCode&&e.statusCode>=200&&e.statusCode<400&&(r=0),e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`)});e.on(`error`,()=>{r++,A.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Ij(e){try{return new URL(`${e}`)}catch{A.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var Lj=W((e={})=>({name:`Console`,setup(t){process.env.LAMBDA_TASK_ROOT&&On(`console`,Rj),Rh({...e,filter:[...e.filter||[],`[DEP0205] DeprecationWarning`]}).setup?.(t)}}));function Rj(){let e=O?.console;e&&tn.forEach(t=>{t in e&&zj(e,t)})}function zj(e,t){let n=e[t];rn[t]=n;let r=n,i,a=!1,o=function(...i){if(a){n.apply(e,i);return}a=!0;try{kn(`console`,{args:i,level:t}),r.apply(e,i)}finally{a=!1}};Wn(o,n);let s=n.bind(e);rn[t]=s;try{let n=o;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return n},set(e){e===o?(i!==void 0&&(r=i,i=void 0),n=o):e===s?(i=r,n=s):typeof e==`function`&&!e.__sentry_original__?(r=e,n=o):n=e}})}catch{Hn(e,t,function(e){return rn[t]=e,function(...e){kn(`console`,{args:e,level:t}),rn[t]?.apply(this,e)}})}}var Bj=`NodeSystemError`;function Vj(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`||typeof Ne.getSystemErrorMap!=`function`?!1:Ne.getSystemErrorMap().has(e.errno)}var Hj=W((e={})=>({name:Bj,processEvent:(t,n,r)=>{if(!Vj(n.originalException))return t;let i=n.originalException,a={...i};!r.getDataCollectionOptions().userInfo&&e.includePaths!==!0&&(delete a.path,delete a.dest),t.contexts={...t.contexts,node_system_error:a};for(let e of t.exception?.values||[])e.value&&(i.path&&e.value.includes(i.path)&&(e.value=e.value.replace(`'${i.path}'`,``).trim()),i.dest&&e.value.includes(i.dest)&&(e.value=e.value.replace(`'${i.dest}'`,``).trim()));return t}})),Uj,Wj=Symbol(`AgentBaseInternalState`),Gj=class extends (Uj=C.Agent,Uj){constructor(e){super(e),this[Wj]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==`boolean`)return e.secureEndpoint;if(typeof e.protocol==`string`)return e.protocol===`https:`}let{stack:t}=Error();return typeof t==`string`&&t.split(`
|
|
23
|
+
`).some(e=>e.indexOf(`(https.js:`)!==-1||e.indexOf(`node:https:`)!==-1)}createSocket(e,t,n){let r={...t,secureEndpoint:this.isSecureEndpoint(t)};Promise.resolve().then(()=>this.connect(e,r)).then(i=>{if(i instanceof C.Agent)return i.addRequest(e,r);this[Wj].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[Wj].currentSocket;if(this[Wj].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[Wj].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[Wj]&&(this[Wj].defaultPort=e)}get protocol(){return this[Wj].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[Wj]&&(this[Wj].protocol=e)}};function Kj(...e){A.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function qj(e){return new Promise((t,n)=>{let r=0,i=[];function a(){let t=e.read();t?l(t):e.once(`readable`,a)}function o(){e.removeListener(`end`,s),e.removeListener(`error`,c),e.removeListener(`readable`,a)}function s(){o(),Kj(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),Kj(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
|
|
24
|
+
\r
|
|
25
|
+
`);if(l===-1){Kj(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
|
|
26
|
+
`),d=u.shift();if(!d)return e.destroy(),n(Error(`No header received from proxy CONNECT response`));let f=d.split(` `),p=+(f[1]||0),m=f.slice(2).join(` `),h={};for(let t of u){if(!t)continue;let r=t.indexOf(`:`);if(r===-1)return e.destroy(),n(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,r).toLowerCase(),a=t.slice(r+1).trimStart(),o=h[i];typeof o==`string`?h[i]=[o,a]:Array.isArray(o)?o.push(a):h[i]=a}Kj(`got proxy server response: %o %o`,d,h),o(),t({connect:{statusCode:p,statusText:m,headers:h},buffered:c})}e.on(`error`,c),e.on(`end`,s),a()})}function Jj(...e){A.log(`[https-proxy-agent]`,...e)}var Yj=class extends Gj{constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},Jj(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?Zj(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;if(n.protocol===`https:`){Jj("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=Je.connect({...this.connectOpts,servername:e&&S.isIP(e)?void 0:e})}else Jj("Creating `net.Socket`: %o",this.connectOpts),r=S.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=S.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r
|
|
27
|
+
`;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r
|
|
28
|
+
`;let s=qj(r);r.write(`${o}\r
|
|
29
|
+
`);let{connect:c,buffered:l}=await s;if(e.emit(`proxyConnect`,c),this.emit(`proxyConnect`,c,e),c.statusCode===200){if(e.once(`socket`,Xj),t.secureEndpoint){Jj(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return Je.connect({...Zj(t,`host`,`path`,`port`),socket:r,servername:S.isIP(e)?void 0:e})}return r}r.destroy();let u=new S.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Jj(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Yj.protocols=[`http`,`https`];function Xj(e){e.resume()}function Zj(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var Qj=32768;function $j(e){return new Ke({read(){this.push(e),this.push(null)}})}function eM(e){let t;try{t=new URL(e.url)}catch{return an(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),hf(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=tM(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?ct:C,a=e.keepAlive!==void 0&&e.keepAlive,o=r?new Yj(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return hf(e,nM(e,e.httpModule??i,o))}function tM(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function nM(e,t,n){let{hostname:r,pathname:i,port:a,protocol:o,search:s}=new URL(e.url);return function(c){return new Promise((l,u)=>{as(()=>{let d=$j(c.body),f={...e.headers};c.body.length>Qj&&(f[`content-encoding`]=`gzip`,d=d.pipe(E()));let p=r.startsWith(`[`),m=t.request({method:`POST`,agent:n,headers:f,hostname:p?r.slice(1,-1):r,path:`${i}${s}`,port:a,protocol:o,ca:e.caCerts},e=>{e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`);let t=e.headers[`retry-after`]??null,n=e.headers[`x-sentry-rate-limits`]??null;l({statusCode:e.statusCode,headers:{"retry-after":t,"x-sentry-rate-limits":Array.isArray(n)?n[0]||null:n}})});m.on(`error`,u),d.pipe(m)})})}}function rM(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=rp(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?n??!0:t??n}function iM(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function aM(e=process.argv[1]?ih(process.argv[1]):process.cwd(),t=De===`\\`){let n=t?iM(e):e;return e=>{if(!e)return;let r=t?iM(e):e,{dir:i,base:a,ext:o}=Ee.parse(r);(o===`.js`||o===`.mjs`||o===`.cjs`)&&(a=a.slice(0,o.length*-1));let s=decodeURIComponent(a);i||=`.`;let c=i.lastIndexOf(`/node_modules`);if(c>-1)return`${i.slice(c+14).replace(/\//g,`.`)}:${s}`;if(i.startsWith(n)){let e=i.slice(n.length+1).replace(/\//g,`.`);return e?`${e}:${s}`:s}return s}}function oM(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(O.SENTRY_RELEASE?.id)return O.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||n||r||e}var sM=_n(uC(aM()));b();var cM=6e4,lM=class extends dx{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||$e.hostname(),n={...e,platform:`node`,runtime:e.runtime||{name:`node`,version:global.process.version},serverName:t};e.openTelemetryInstrumentations&&vT({instrumentations:e.openTelemetryInstrumentations}),vp(n,`node`),A.log(`Initializing Sentry: process: ${process.pid}, thread: ${it?`main`:`worker-${at}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Ud(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener)),Cs(this)}get tracer(){if(this._tracer)return this._tracer;let e=k,t=g.getTracer(`@sentry/node`,e);return this._tracer=t,t}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off(`beforeExit`,this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off(`beforeExit`,this._logOnExitFlushListener);let t=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),t}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{Kw&&A.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??cM).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}_setupIntegrations(){Zf(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?nk(this,e):[void 0,void 0]}},uM;function dM(){return EE>=21||EE===20&&DE>=6||EE===18&&DE>=19||(uM||(uM=!0,an(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})),!1)}function fM(){if(dM()&&!O._sentryEsmLoaderHookRegistered){O._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,CE.createAddHookMessageChannel)();rt.register(`import-in-the-middle/hook.mjs`,import.meta.url,{data:{addHookMessagePort:e,include:[]},transferList:[e]})}catch(e){A.warn(`Failed to register 'import-in-the-middle' hook`,e)}}}function pM(){return[Kp(),Hp(),bm(),Em(),Hj(),Xh(),Lj(),PE(),lD(),xj(),Tj(),KA(),lj(),pA(),sA(),Mj(),pj()]}function mM(e={}){return hM(e,pM)}function hM(e={},t){let n=_M(e,t);n.debug===!0&&(Kw?A.enable():an(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&fM(),Zk(n),M().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===`Spotlight`)&&n.integrations.push(Pj({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),vp(n,`node-core`);let r=new lM(n);return M().setClient(r),r.init(),A.log(`SDK initialized from ESM`),r.startClientReportTracking(),bM(),EO(r),ok(r),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function gM(){if(!Kw)return;let e=MO(),t=[`SentryContextManager`,`SentryPropagator`],n=e.includes(`SentryTracerProvider`);to()&&!n&&t.push(`SentrySpanProcessor`);for(let n of t)e.includes(n)||A.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);!n&&!e.includes(`SentrySampler`)&&A.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function _M(e,t){let n=vM(e.release),r=rM(e.spotlight),i=yM(e.tracesSampleRate),a={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??eM,stackParser:vn(e.stackParser||sM),release:n,tracesSampleRate:i,spotlight:r,debug:rp(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=xd({defaultIntegrations:e.defaultIntegrations??t(a),integrations:o});return{...a,integrations:s}}function vM(e){if(e!==void 0)return e;let t=oM();if(t!==void 0)return t}function yM(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let n=parseFloat(t);return isFinite(n)?n:void 0}function bM(){if(rp(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=wa(e,t);M().setPropagationContext(n)}}var xM=e=>({package:e,"javascript.is_cjs":!1});function SM(e,t){let n=P()?.getOptions();!n?.disableInstrumentationWarnings&&!(K(e)||typeof Kn(e)==`function`)&&od()&&to(n)&&(an(()=>{console.warn(`[Sentry] ${t} is not instrumented. Please make sure to initialize Sentry in a separate file that you \`--import\` when running node, see: https://docs.sentry.io/platforms/javascript/guides/${t}/install/esm/.`)}),yi().setContext(`missing_instrumentation`,xM(t)))}var{isPromise:CM}=Le,wM=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc0LjAgKGNlNTAwOWEpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyB0fWZyb20ibm9kZTppbnNwZWN0b3IiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIG4scGFyZW50UG9ydCBhcyBlfWZyb20ibm9kZTp3b3JrZXJfdGhyZWFkcyI7aW1wb3J0e3Bvc2l4IGFzIHIsc2VwIGFzIG99ZnJvbSJub2RlOnBhdGgiO2ltcG9ydCphcyBpIGZyb20ibm9kZTpodHRwIjtpbXBvcnQqYXMgcyBmcm9tIm5vZGU6aHR0cHMiO2ltcG9ydHtSZWFkYWJsZSBhcyBjfWZyb20ibm9kZTpzdHJlYW0iO2ltcG9ydHtjcmVhdGVHemlwIGFzIHV9ZnJvbSJub2RlOnpsaWIiO2ltcG9ydCphcyBhIGZyb20ibm9kZTpuZXQiO2ltcG9ydCphcyBmIGZyb20ibm9kZTp0bHMiO2NvbnN0IGg9InVuZGVmaW5lZCI9PXR5cGVvZiBfX1NFTlRSWV9ERUJVR19ffHxfX1NFTlRSWV9ERUJVR19fLHA9Z2xvYmFsVGhpcyxkPSIxMC43NC4wIjtmdW5jdGlvbiBsKCl7cmV0dXJuIGcoc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return O}function kM(){let e=Vs(N(),M());return e.attachments=[],e.eventProcessors=[],e}async function AM(e){let t={message:`ANR`},n={};for(let r of e.getEventProcessors()){if(t===null)break;t=await r(t,n)}return t?.contexts||{}}var jM=`Anr`,MM=W(((e={})=>{if(TE.major<16||TE.major===16&&TE.minor<17)throw Error(`ANR detection requires Node 16.17.0 or later`);let t,n,r=OM();return r.__SENTRY_GET_SCOPES__=kM,{name:jM,startWorker:()=>{t||n&&(t=NM(n,e))},stopWorker:()=>{t&&t.then(e=>{e(),t=void 0})},async setup(t){n=t,e.captureStackTrace&&await JA()&&(A.warn(`ANR captureStackTrace has been disabled because the debugger was already enabled`),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}));async function NM(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await AM(e);delete r.app?.app_memory,delete r.device?.free_memory;let i=e.getOptions(),a=e.getSdkMetadata()||{};a.sdk&&(a.sdk.integrations=i.integrations.map(e=>e.name));let o={debug:A.isEnabled(),dsn:n,tunnel:i.tunnel,environment:i.environment||`production`,release:i.release,dist:i.dist,sdkMetadata:a,appRootPath:t.appRootPath,pollInterval:t.pollInterval||TM,anrThreshold:t.anrThreshold||EM,captureStackTrace:!!t.captureStackTrace,maxAnrEvents:t.maxAnrEvents||1,staticTags:t.staticTags||{},contexts:r};if(o.captureStackTrace){let e=await import(`node:inspector`);e.url()||e.open(0)}let s=new Xe(new URL(`data:application/javascript;base64,${wM}`),{workerData:o,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{s.terminate()});let c=setInterval(()=>{try{let e=N().getSession(),t=e?{...e,toJSON:void 0}:void 0;s.postMessage({session:t,debugImages:Nu(i.stackParser)})}catch{}},o.pollInterval);return c.unref(),s.on(`message`,e=>{e===`session-ended`&&(DM(`ANR event sent from ANR worker. Clearing session in this thread.`),N().setSession(void 0))}),s.once(`error`,e=>{clearInterval(c),DM(`ANR worker error`,e)}),s.once(`exit`,e=>{clearInterval(c),DM(`ANR worker exit`,e)}),s.unref(),()=>{s.terminate(),clearInterval(c)}}function PM(e){let t=P()?.getIntegrationByName(jM);if(!t)return e();t.stopWorker();let n=e();return CM(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}function FM(e,...t){let[n,r,i,a]=t;if(Array.isArray(r)){let t={...i};t[`sentry.message.template`]=n,r.forEach((e,n)=>{t[`sentry.message.parameter.${n}`]=e}),Hd({level:e,message:Fe(n,...r),attributes:t},a?.scope)}else Hd({level:e,message:n,attributes:r},i?.scope??a?.scope)}var IM=t({debug:()=>RM,error:()=>VM,fatal:()=>HM,fmt:()=>_p,info:()=>zM,trace:()=>LM,warn:()=>BM});function LM(...e){FM(`trace`,...e)}function RM(...e){FM(`debug`,...e)}function zM(...e){FM(`info`,...e)}function BM(...e){FM(`warn`,...e)}function VM(...e){FM(`error`,...e)}function HM(...e){FM(`fatal`,...e)}var UM=`NodeRuntimeMetrics`,WM=3e4,GM=1e3,KM=10;function qM(e,t,n){return Number.isFinite(e)?e<GM?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${GM}ms. Using minimum of ${GM}ms.`),GM):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var JM=W((e={})=>{let t=qM(e.collectionIntervalMs??WM,UM,WM),n={cpuUtilization:!0,memHeapUsed:!0,memHeapTotal:!0,memRss:!0,eventLoopDelayP50:!0,eventLoopDelayP99:!0,eventLoopUtilization:!0,uptime:!0,cpuTime:!1,memExternal:!1,eventLoopDelayMin:!1,eventLoopDelayMax:!1,eventLoopDelayMean:!1,eventLoopDelayP90:!1,...e.collect},r=n.eventLoopDelayP99||n.eventLoopDelayMin||n.eventLoopDelayMax||n.eventLoopDelayMean||n.eventLoopDelayP50||n.eventLoopDelayP90,i=n.cpuUtilization||n.cpuTime,a,o,s,c=0,l,u=KM*1e6,d=e=>Math.max(0,(e-u)/1e9),f={attributes:{"sentry.origin":`auto.node.runtime_metrics`}},p={unit:`byte`,attributes:{"sentry.origin":`auto.node.runtime_metrics`}},m={unit:`second`,attributes:{"sentry.origin":`auto.node.runtime_metrics`}};function h(){let e=$n(),t=e-c;if(i&&o!==void 0){let e=process.cpuUsage(o);n.cpuTime&&(fg(`node.runtime.cpu.user`,e.user/1e6,m),fg(`node.runtime.cpu.system`,e.system/1e6,m)),n.cpuUtilization&&t>0&&fg(`node.runtime.cpu.utilization`,(e.user+e.system)/(t*1e3),f),o=process.cpuUsage()}if(n.memRss||n.memHeapUsed||n.memHeapTotal||n.memExternal){let e=process.memoryUsage();n.memRss&&fg(`node.runtime.mem.rss`,e.rss,p),n.memHeapUsed&&fg(`node.runtime.mem.heap_used`,e.heapUsed,p),n.memHeapTotal&&fg(`node.runtime.mem.heap_total`,e.heapTotal,p),n.memExternal&&(fg(`node.runtime.mem.external`,e.external,p),fg(`node.runtime.mem.array_buffers`,e.arrayBuffers,p))}if(r&&l&&(n.eventLoopDelayMin&&fg(`node.runtime.event_loop.delay.min`,d(l.min),m),n.eventLoopDelayMax&&fg(`node.runtime.event_loop.delay.max`,d(l.max),m),n.eventLoopDelayMean&&fg(`node.runtime.event_loop.delay.mean`,d(l.mean),m),n.eventLoopDelayP50&&fg(`node.runtime.event_loop.delay.p50`,d(l.percentile(50)),m),n.eventLoopDelayP90&&fg(`node.runtime.event_loop.delay.p90`,d(l.percentile(90)),m),n.eventLoopDelayP99&&fg(`node.runtime.event_loop.delay.p99`,d(l.percentile(99)),m),l.reset()),n.eventLoopUtilization&&s!==void 0){let e=ut.eventLoopUtilization();fg(`node.runtime.event_loop.utilization`,ut.eventLoopUtilization(e,s).utilization,f),s=e}n.uptime&&t>0&&dg(`node.runtime.process.uptime`,t/1e3,m),c=e}return{name:UM,setup(){if(r){l?.disable();try{l=lt({resolution:KM}),l.enable()}catch{l=void 0}}i&&(o=process.cpuUsage()),n.eventLoopUtilization&&(s=ut.eventLoopUtilization()),c=$n(),a&&clearInterval(a),a=md(setInterval(h,t))}}}),YM=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`],XM=Symbol.for(`level`),ZM=Symbol.for(`message`),QM=Symbol.for(`splat`);function $M(e,t){class n extends e{constructor(e){super(e),this._levels=new Set(t?.levels??YM)}log(e,n){try{if(setImmediate(()=>{this.emit(`logged`,e)}),!j(e))return;let n=e[XM],{level:r,message:i,timestamp:a,...o}=e;o[XM]=void 0,o[ZM]=void 0,o[QM]=void 0;let s=t?.customLevelMap?.[n],c=eN[n],l=s??c??`info`;this._levels.has(l)?FM(l,i,{...o,"sentry.origin":`auto.log.winston`}):!s&&!c&&Kw&&A.log(`Winston log level ${n} is not captured by Sentry. Please add ${n} to the "customLevelMap" option of the Sentry Winston transport.`)}catch{}n&&n()}}return n}var eN={silly:`trace`,debug:`debug`,verbose:`debug`,http:`debug`,info:`info`,notice:`info`,warn:`warn`,warning:`warn`,error:`error`,emerg:`fatal`,alert:`fatal`,crit:`fatal`},tN=Symbol(`sentry-track-pino-logger`);function nN(e,t,n){let r=Object.getOwnPropertySymbols(e),i=`Symbol(${t})`;for(let t of r)if(t.toString()===i){let r=e[t];return typeof r==`string`?r:n}return n}var rN={error:{levels:[],handled:!0},log:{levels:[`trace`,`debug`,`info`,`warn`,`error`,`fatal`]}};function iN(e){let{level:t,time:n,pid:r,hostname:i,...a}=e;return a}var aN=W((e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{...rN.error,...e.error},log:{...rN.log,...e.log}};function n(e){let n=e[tN];return n===`track`||n!==`ignore`&&t.autoInstrument}return{name:`Pino`,setup:e=>{let r=!!e.getOptions().enableLogs,i=w.tracingChannel(`pino_asJson`);function a(e,i,a){if(!n(e))return;let o=iN(a),[s,c,l]=i,u=e?.levels?.labels?.[l]||`info`,d=nN(e,`pino.messageKey`,`msg`),f=c||o?.[d]||``;if(r&&t.log.levels.includes(u)&&Hd({level:u,message:f,attributes:{...o,"sentry.origin":`auto.log.pino`,"pino.logger.level":l}}),t.error.levels.includes(u)){let n=nN(e,`pino.errorKey`,`err`),r={};for(let[e,t]of Object.entries(o))e!==n&&e!==d&&(r[e]=t);f&&(r[d]=f);let i={level:Im(u),contexts:{pino:r}};bi(e=>{e.addEventProcessor(e=>(e.logger=`pino`,Dr(e,{handled:t.error.handled,type:`auto.log.pino`}),e));let r=s[n];if(r){H(r,i);return}Gu(f,i)})}}i.end.subscribe(e=>{let{instance:t,arguments:n,result:r}=e;a(t,n,JSON.parse(r))})}}}),oN=Object.assign(aN,{trackLogger(e){j(e)&&`levels`in e&&(e[tN]=`track`)},untrackLogger(e){j(e)&&`levels`in e&&(e[tN]=`ignore`)}});function sN(e,t){e.setAttribute(I,t)}var cN=[[`january`,`1`],[`february`,`2`],[`march`,`3`],[`april`,`4`],[`may`,`5`],[`june`,`6`],[`july`,`7`],[`august`,`8`],[`september`,`9`],[`october`,`10`],[`november`,`11`],[`december`,`12`],[`jan`,`1`],[`feb`,`2`],[`mar`,`3`],[`apr`,`4`],[`may`,`5`],[`jun`,`6`],[`jul`,`7`],[`aug`,`8`],[`sep`,`9`],[`oct`,`10`],[`nov`,`11`],[`dec`,`12`],[`sunday`,`0`],[`monday`,`1`],[`tuesday`,`2`],[`wednesday`,`3`],[`thursday`,`4`],[`friday`,`5`],[`saturday`,`6`],[`sun`,`0`],[`mon`,`1`],[`tue`,`2`],[`wed`,`3`],[`thu`,`4`],[`fri`,`5`],[`sat`,`6`]];function lN(e){return cN.reduce((e,[t,n])=>e.replace(new RegExp(t,`gi`),n),e)}var uN=`Automatic instrumentation of CronJob only supports crontab string`;function dN(e,t){let n=!1;return new Proxy(e,{construct(e,r){let[i,a,o,s,c,...l]=r;if(typeof i!=`string`)throw Error(uN);if(n)throw Error(`A job named '${t}' has already been scheduled`);n=!0;let u=lN(i);async function d(e,n){return fd(t,async()=>{try{await a(e,n)}catch(e){throw H(e,{mechanism:{handled:!1,type:`auto.function.cron.instrumentCron`}}),e}},{schedule:{type:`crontab`,value:u},timezone:c||void 0})}return new e(i,d,o,s,c,...l)},get(e,r){return r===`from`?r=>{let{cronTime:i,onTick:a,timeZone:o}=r;if(typeof i!=`string`)throw Error(uN);if(n)throw Error(`A job named '${t}' has already been scheduled`);n=!0;let s=lN(i);return r.onTick=async(e,n)=>fd(t,async()=>{try{await a(e,n)}catch(e){throw H(e,{mechanism:{handled:!1,type:`auto.function.cron.instrumentCron`}}),e}},{schedule:{type:`crontab`,value:s},timezone:o||void 0}),e.from(r)}:e[r]}})}function fN(e,t={}){return new Proxy(e,{get(e,n){return n===`schedule`&&e.schedule?new Proxy(e.schedule,{apply(e,n,r){let[i,a,o]=r,s=o?.name,c=o?.timezone;if(!s)throw Error(`Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.`);return e.apply(n,[i,async(...e)=>fd(s,async()=>{try{return await a(...e)}catch(e){throw H(e,{mechanism:{handled:!1,type:`auto.function.node-cron.instrumentNodeCron`}}),e}},{schedule:{type:`crontab`,value:lN(i)},timezone:c,...t}),o])}}):e[n]}})}function pN(e){return new Proxy(e,{get(e,t){return t===`scheduleJob`?new Proxy(e.scheduleJob,{apply(e,t,n){let[r,i,a]=n;if(typeof r!=`string`||typeof i!=`string`||typeof a!=`function`)throw Error(`Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string`);let o=r,s=i;async function c(){return fd(o,async()=>{await a?.()},{schedule:{type:`crontab`,value:lN(s)}})}return e.apply(t,[o,s,c])}}):e[t]}})}var mN={instrumentCron:dN,instrumentNodeCron:fN,instrumentNodeSchedule:pN},hN=`Http`,gN=Object.assign(kE,{id:`${hN}.sentry`}),_N=W((e={})=>{let t=e.spans??!0,n=e.disableIncomingRequestSpans,r=t&&!n,i={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},a={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},o=Xw(i),s=Qw(a);return{name:hN,setup(e){let t=e.getOptions();r&&to(t)&&s.setup(e)},setupOnce(){o.setupOnce(),kE({breadcrumbs:e.breadcrumbs,spans:t,propagateTraceInOutgoingRequests:e.tracePropagation??!0,createSpansForOutgoingRequests:t,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(t,n)=>{let r=hw(n);if(r.startsWith(`data:`)){let e=hp(r);t.setAttribute(`http.url`,e),t.setAttribute(uu,e),t.updateName(`${n.method||`GET`} ${e}`)}e.instrumentation?.requestHook?.(t,n)},outgoingResponseHook:e.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:e.instrumentation?.applyCustomAttributesOnSpan})},processEvent(e){return s.processEvent(e)}}}),vN=W(((e={})=>({name:`NodeFetch`,setupOnce(){let t=P()?.getOptions();QE({...e,spans:yN(e,t)})}})));function yN(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&to(t))}var bN=`access.appendFile.chmod.chown.copyFile.cp.lchown.link.lstat.lutimes.mkdir.mkdtemp.open.opendir.readdir.readFile.readlink.realpath.rename.rm.rmdir.stat.symlink.truncate.unlink.utimes.writeFile`.split(`.`),xN=`access,appendFile,chmod,chown,copyFile,cp,exists,lchown,link,lstat,lutimes,mkdir,mkdtemp,open,opendir,readdir,readFile,readlink,realpath,realpath.native,rename,rm,rmdir,stat,symlink,truncate,unlink,utimes,writeFile`.split(`,`),SN=`accessSync,appendFileSync,chmodSync,chownSync,copyFileSync,cpSync,existsSync,lchownSync,linkSync,lstatSync,lutimesSync,mkdirSync,mkdtempSync,opendirSync,openSync,readdirSync,readFileSync,readlinkSync,realpathSync,realpathSync.native,renameSync,rmdirSync,rmSync,statSync,symlinkSync,truncateSync,unlinkSync,utimesSync,writeFileSync`.split(`,`);function CN(e){let t=e.split(`.`);if(t.length>1){if(t.length!==2)throw Error(`Invalid member function name ${e}`);return t}return[e]}function wN(e,t){if(!t)throw Error(JSON.stringify({member:t}));let[n,r]=CN(t);return r?{objectToPatch:e[n],functionNameToPatch:r}:{objectToPatch:e,functionNameToPatch:n}}var TN=`auto.file.fs`,EN=`file`,DN=[`rename`,`renameSync`],ON=[`copyFile`,`cp`,`copyFileSync`,`cpSync`],kN=[`link`,`linkSync`],AN=[`mkdtemp`,`mkdtempSync`],jN=[`symlink`,`symlinkSync`],MN=`access,appendFile,chmod,chown,exists,mkdir,lchown,lstat,lutimes,open,opendir,readdir,readFile,readlink,realpath,realpath.native,rm,rmdir,stat,truncate,unlink,utimes,writeFile,accessSync,appendFileSync,chmodSync,chownSync,existsSync,lchownSync,lstatSync,lutimesSync,opendirSync,mkdirSync,openSync,readdirSync,readFileSync,readlinkSync,realpathSync,realpathSync.native,rmdirSync,rmSync,statSync,truncateSync,unlinkSync,utimesSync,writeFileSync`.split(`,`);function NN(e,t,n){let r={[F]:EN,[I]:TN};return n.recordFilePaths&&(typeof t[0]==`string`&&MN.includes(e)?r.path_argument=t[0]:typeof t[0]==`string`&&typeof t[1]==`string`?jN.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):kN.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):ON.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):DN.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]==`string`&&AN.includes(e)&&(r.prefix_argument=t[0])),r}function PN(e,t){return Object.assign(e,t)}var FN=new WeakMap;function IN(e,t,n){let r=e[t];if(typeof r!=`function`)return;let i=FN.get(e);i||(i=new Set,FN.set(e,i)),!i.has(t)&&(i.add(t),e[t]=n(r))}function LN(e,t,n){return PN(function(...r){let i=NN(e,r,n);return z({name:`fs.${e}`,onlyIfParent:!0,attributes:i},e=>{try{return as(()=>t.apply(this,r))}catch(t){throw HN(e,t,n),t}})},t)}function RN(e,t,n){return PN(function(...r){let i=r.length-1,a=r[i];if(typeof a!=`function`)return t.apply(this,r);let o=NN(e,r,n),s=B({name:`fs.${e}`,onlyIfParent:!0,attributes:o}),c=R();r[i]=function(...e){let t=e[0];return t&&HN(s,t,n),s.end(),c?V(c,()=>a.apply(this,e)):a.apply(this,e)};try{return as(()=>t.apply(this,r))}catch(e){throw HN(s,e,n),s.end(),e}},t)}function zN(e,t){let n=`exists`,r=PN(function(...r){let i=r.length-1,a=r[i];if(typeof a!=`function`)return e.apply(this,r);let o=NN(n,r,t),s=B({name:`fs.${n}`,onlyIfParent:!0,attributes:o}),c=R();r[i]=function(...e){return s.end(),c?V(c,()=>a.apply(this,e)):a.apply(this,e)};try{return as(()=>e.apply(this,r))}catch(e){throw HN(s,e,t),s.end(),e}},e),i=function(e){return new Promise(t=>r(e,t))};return Object.defineProperty(i,"name",{value:n}),Object.defineProperty(r,Re.custom,{value:i}),r}function BN(e,t,n){return PN(async function(...r){let i=NN(e,r,n);return z({name:`fs.${e}`,onlyIfParent:!0,attributes:i},async e=>{try{return await as(()=>t.apply(this,r))}catch(t){throw HN(e,t,n),t}})},t)}function VN(e={}){for(let t of SN){let{objectToPatch:n,functionNameToPatch:r}=wN(Be,t);IN(n,r,n=>LN(t,n,e))}for(let t of xN){let{objectToPatch:n,functionNameToPatch:r}=wN(Be,t);t===`exists`?IN(n,r,t=>zN(t,e)):IN(n,r,n=>RN(t,n,e))}let t=Be.promises;for(let n of bN)IN(t,n,t=>BN(n,t,e))}function HN(e,t,n){e.setStatus({code:2,message:`internal_error`}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute(`fs_error`,t.message)}var UN=`FileSystem`,WN=W((e={})=>({name:UN,setupOnce(){VN(e)}})),GN=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;function KN(e){let t=R();if(!t)return;let n=Za(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(`http.route`,e)}var qN=`Express`,JN=[`>=4.0.0 <6`];function YN(e,t){GC(e,t),SM(e.use,`express`)}var XN=Y(qN,e=>new ZN(e)),ZN=class extends q{constructor(e={}){super(`sentry-express`,k,e)}init(){return new J(`express`,JN,e=>{try{HC(e,()=>({...this.getConfig(),onRouteResolved(e){e&&KN(e)}}))}catch(e){GN&&A.error(`Failed to patch express module:`,e)}return e},e=>e)}},QN=W((e=>({name:qN,setupOnce(){XN(e)},getShouldHandleError(){return e?.shouldHandleError}}))),$N=(e=>(e.FASTIFY_NAME=`fastify.name`,e.FASTIFY_TYPE=`fastify.type`,e.HOOK_NAME=`hook.name`,e.PLUGIN_NAME=`plugin.name`,e))($N||{}),eP=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`,e))(eP||{}),tP=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request handler`,e))(tP||{}),nP=Symbol(`opentelemetry.instrumentation.fastify.request_active_span`);b();function rP(e,t,n,r={}){let i=t.startSpan(n,{attributes:r}),a=e[nP]||[];return a.push(i),Object.defineProperty(e,nP,{enumerable:!1,configurable:!0,value:a}),i}function iP(e,t){let n=e[nP]||[];n.length&&(n.forEach(e=>{t&&(e.setStatus({code:ee.ERROR,message:t.message}),e.recordException(t)),e.end()}),delete e[nP])}function aP(e,t,n){let r,i;try{i=e(),oP(i)&&i.then(e=>t(void 0,e),e=>t(e))}catch(e){r=e}finally{if(!oP(i)&&(t(r,i),r))throw r;return i}}function oP(e){return typeof e==`object`&&e&&typeof Object.getOwnPropertyDescriptor(e,`then`)?.value==`function`||!1}b();var sP=`@sentry/instrumentation-fastify-v3`,cP=`anonymous`,lP=new Set([`onTimeout`,`onRequest`,`preParsing`,`preValidation`,`preSerialization`,`preHandler`,`onSend`,`onResponse`,`onError`]),uP=class extends q{constructor(e={}){super(sP,k,e)}init(){return[new J(`fastify`,[`>=3.0.0 <3.21.0`],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(t,n,r){if(!e.isEnabled())return r();e._wrap(n,`send`,e._patchSend());let i=t,a=i.routeOptions?i.routeOptions.url:t.routerPath;a&&KN(a);let o=t.method||`GET`;N().setTransactionName(`${o} ${a}`),r()}}_wrapHandler(e,t,n,i){let a=this;return this._diag.debug(`Patching fastify route.handler function`),function(...o){if(!a.isEnabled())return n.apply(this,o);let s=n.name||e||cP,c=`${tP.MIDDLEWARE} - ${s}`,l=o[1],u=rP(l,a.tracer,c,{[$N.FASTIFY_TYPE]:eP.MIDDLEWARE,[$N.PLUGIN_NAME]:e,[$N.HOOK_NAME]:t}),d=i&&o[o.length-1];return d&&(o[o.length-1]=function(...e){iP(l),d.apply(this,e)}),r.with(g.setSpan(r.active(),u),()=>aP(()=>n.apply(this,o),e=>{e instanceof Error&&(u.setStatus({code:ee.ERROR,message:e.message}),u.recordException(e)),i||iP(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug(`Patching fastify server.addHook function`),function(t){return function(...n){let r=n[0],i=n[1],a=this.pluginName;if(!lP.has(r))return t.apply(this,n);let o=typeof n[n.length-1]==`function`&&i.constructor.name!==`AsyncFunction`;return t.apply(this,[r,e._wrapHandler(a,r,i,o)])}}}_patchConstructor(e){let t=this;function n(...n){let r=e.fastify.apply(this,n);return r.addHook(`onRequest`,t._hookOnRequest()),r.addHook(`preHandler`,t._hookPreHandler()),dP(),t._wrap(r,`addHook`,t._wrapAddHook()),r}return e.errorCodes!==void 0&&(n.errorCodes=e.errorCodes),n.fastify=n,n.default=n,n}_patchSend(){let e=this;return this._diag.debug(`Patching fastify reply.send function`),function(t){return function(...n){let r=n[0];return e.isEnabled()?SE(()=>t.apply(this,n),e=>{!e&&r instanceof Error&&(e=r),iP(this,e)}):t.apply(this,n)}}}_hookPreHandler(){let e=this;return this._diag.debug(`Patching fastify preHandler function`),function(t,n,i){if(!e.isEnabled())return i();let a=t,o=a.routeOptions?.handler||a.context?.handler,s=o?.name.startsWith(`bound `)?o.name.substring(6):o?.name,c=`${tP.REQUEST_HANDLER} - ${s||this.pluginName||cP}`,l={[$N.PLUGIN_NAME]:this.pluginName,[$N.FASTIFY_TYPE]:eP.REQUEST_HANDLER,[Sl]:a.routeOptions?a.routeOptions.url:t.routerPath};s&&(l[$N.FASTIFY_NAME]=s);let u=rP(n,e.tracer,c,l);fP(u);let{requestHook:d}=e.getConfig();return d&&SE(()=>d(u,{request:t}),t=>{t&&e._diag.error(`request hook failed`,t)},!0),r.with(g.setSpan(r.active(),u),()=>{i()})}}};function dP(){let e=P();e&&e.on(`spanStart`,e=>{fP(e)})}function fP(e){let t=L(e).data,n=t[`fastify.type`];if(t[`sentry.op`]||!n)return;e.setAttributes({[I]:`auto.http.otel.fastify`,[F]:`${n}.fastify`});let r=t[`fastify.name`]||t[`plugin.name`]||t[`hook.name`];if(typeof r==`string`){let t=r.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``);e.updateName(t)}}var pP=`execute_tool`,mP=`invoke_agent`,hP=`graphql`,X=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,gP=()=>{};function Z(e,t,n){let r=_P(e,t,n),i=n?.beforeSpanEnd,a=n?.deferSpanEnd,o=e=>typeof n?.captureError==`function`?n.captureError(e):{mechanism:{type:`auto.diagnostic_channels.bind_span`,handled:!1}},s=(e,t)=>{n?.captureError&&H(t,o(t));let{message:r,attributes:i}=yP(t);e.setStatus({code:2,message:r}),e.setAttributes(i)},c=(e,t)=>{let n=!1;return r=>{n||(n=!0,r!==void 0&&s(e,r),vP(t,i))}},l={start:gP,asyncStart:gP,end(e){if(`error`in e||`result`in e){let t=e._sentrySpan;if(t&&a?.({span:t,data:e,end:c(t,e)}))return;vP(e,i)}},error(e){let t=e._sentrySpan;t&&s(t,e.error)},asyncEnd(e){let t=e._sentrySpan;t&&a?.({span:t,data:e,end:c(t,e)})||vP(e,i)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function _P(e,t,n){let r=di(Qt()).getTracingChannelBinding?.();if(!r)return X&&A.log(`[TracingChannel] Could not access async context binding.`),{channel:e,unbind:gP};let i=r.asyncLocalStorage;return e.start.bindStore(i,e=>{e._sentryCallerStore=i.getStore();let a=!n?.requiresParentSpan||R()?t(e):void 0;return a?(e._sentrySpan=a,r.getStoreWithActiveSpan(a)):e._sentryCallerStore}),e.asyncStart.bindStore(i,e=>e._sentryCallerStore),{channel:e,unbind:()=>{e.start.unbindStore(i),e.asyncStart.unbindStore(i)}}}function vP(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function yP(e){let t=j(e),n=t?`message`in e?e.message:void 0:e,r=n?String(n):void 0,i=t&&`name`in e?String(e.name):`unknown`;return{message:r,attributes:{[Lc]:i}}}var bP=`original-description`,xP=new Set([`Int`,`Float`,`String`,`BlockString`]);function SP(e,t,n){let r=Za(e);if(r===e)return;let i=L(r),a=n?`${t} ${n}`:t,o=i.data[Ql],s;s=Array.isArray(o)?[...o,a]:typeof o==`string`?[o,a]:a,r.setAttribute(Ql,s);let c=i.data[bP]??i.description;i.data[bP]||r.setAttribute(bP,c),r.updateName(`${c} (${CP(s)})`)}function CP(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(`, `):`${t.slice(0,5).join(`, `)}, +${t.length-5}`}return e}function wP(e,t,n){return e&&t?`${e} ${t}`:e||n}function TP(e){if(j(e)&&`errors`in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function EP(e){let t=e?.loc,n=t?.source?.body;if(typeof n==`string`&&t?.startToken)try{let e=[];for(let n=t.startToken;n;n=n.next)xP.has(n.kind)&&e.push({start:n.start,end:n.end,kind:n.kind});let r=n;for(let t=e.length-1;t>=0;t--){let{start:n,end:i,kind:a}=e[t],o=a===`String`||a===`BlockString`?`"*"`:`*`;r=r.slice(0,n)+o+r.slice(i)}return r}catch{return}}function DP(e){if(P()?.getDataCollectionOptions().graphQL.document===!0)return EP(e)}var OP=`graphql:parse`,kP=`graphql:validate`,AP=`graphql:execute`,jP=`graphql:subscribe`,MP=`graphql:resolve`,NP=`auto.graphql.diagnostic_channel`,PP=`graphql.parse`,FP=`graphql.validate`,IP=`graphql.execute`,LP=`graphql.subscribe`,RP=`graphql.resolve`,zP=`graphql.field.name`,BP=`graphql.field.path`,VP=`graphql.field.type`,HP=`graphql.parent.name`;function UP(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,i=t.useOperationNameForRootSpan!==!1;WP(e),GP(e),KP(e,AP,IP,i),KP(e,jP,LP,i),n||qP(e,r)}function WP(e){Z(e(OP),()=>B({name:PP,attributes:{[I]:NP,[F]:hP}}))}function GP(e){Z(e(kP),e=>B({name:FP,attributes:{[I]:NP,[F]:hP,[pl]:DP(e.document)}}),{beforeSpanEnd:(e,t)=>{Array.isArray(t.result)&&t.result.length>0&&e.setStatus({code:2,message:`invalid_argument`})}})}function KP(e,t,n,r){Z(e(t),e=>{let t=B({name:wP(e.operationType,e.operationName,n),attributes:{[I]:NP,[F]:hP,[hl]:e.operationType,[ml]:e.operationName||void 0,[pl]:DP(e.document)}});return r&&e.operationType&&SP(t,e.operationType,e.operationName),t},{beforeSpanEnd:(e,t)=>{TP(t.result)&&e.setStatus({code:2,message:`internal_error`})}})}function qP(e,t){Z(e(MP),e=>{if(!(t&&e.isDefaultResolver))return B({name:`${RP} ${e.fieldPath}`,attributes:{[I]:NP,[F]:hP,[zP]:e.fieldName,[BP]:e.fieldPath,[VP]:e.fieldType,[HP]:e.parentType}})})}var JP=W(((e={})=>({name:`Graphql`,setupOnce(){w.tracingChannel&&U(()=>{UP(w.tracingChannel,e)})}}))),YP=`mongoose:query`,XP=`mongoose:aggregate`,ZP=`mongoose:model:save`,QP=`mongoose:model:insertMany`,$P=`mongoose:model:bulkWrite`,eF=`mongoose:cursor:next`,tF=`auto.db.mongoose.diagnostic_channel`,nF=`mongodb`,rF=10,iF=!1;function aF(e){if(!iF){iF=!0;try{oF(e,YP),oF(e,XP),oF(e,ZP),oF(e,QP),oF(e,$P),oF(e,eF)}catch{X&&A.log(`Mongoose node:diagnostics_channel subscription failed.`)}}}function oF(e,t){Z(e(t),e=>{let t=e.collection,n=cF(e.args?.pipeline??e.args?.filter),r=sF(e);return B({name:t?`mongoose.${t}.${e.operation}`:`mongoose.${e.operation}`,attributes:{[I]:tF,[F]:`db`,[Fc]:nF,[jc]:e.operation,[Ec]:t??void 0,[Oc]:e.database??void 0,[Mc]:n??void 0,[Ac]:r??void 0,[ou]:e.serverAddress??void 0,[su]:e.serverPort??void 0}})})}function sF(e){let t=e.args,n=e.operation===`insertMany`?t?.docs:e.operation===`bulkWrite`?t?.ops:void 0;return Array.isArray(n)&&n.length>1?n.length:void 0}function cF(e){if(e!=null)try{let t=lF(e,0),n=JSON.stringify(t);return n==null||n===`{}`||n===`[]`?void 0:n}catch{return}}function lF(e,t){if(t>rF)return`?`;if(Array.isArray(e))return e.map(e=>lF(e,t+1));if(j(e)){let n={};for(let r of Object.keys(e))n[r]=lF(e[r],t+1);return n}return`?`}var uF=W((()=>({name:`Mongoose`,setupOnce(){w.tracingChannel&&U(()=>{aF(w.tracingChannel)})}}))),dF=`db.system`,fF=`db.name`,pF=`db.operation`,mF=`db.statement`,hF=`db.mongodb.collection`,gF=`db.connection_string`,_F=`net.peer.name`,vF=`net.peer.port`,yF=`mongodb`;function bF(e){return JSON.stringify(xF(e))}function xF(e){return Array.isArray(e)?e.map(e=>xF(e)):SF(e)?Object.entries(e).map(([e,t])=>[e,xF(t)]).reduce((e,t)=>(wF(t)&&(e[t[0]]=t[1]),e),{}):`?`}function SF(e){return j(e)&&!CF(e)}function CF(e){return typeof Buffer<`u`&&Buffer.isBuffer(e)}function wF(e){return Array.isArray(e)}function TF(e,t,n,r,i){let a,o;if(e){let t=typeof e.address==`string`?e.address.split(`:`):``;t.length===2&&(a=t[0],o=t[1])}let s;return s=n?.documents?.[0]?n.documents[0]:n?.cursors?n.cursors:n,EF(t.db,t.collection,a,o,s,r,i)}function EF(e,t,n,r,i,a,o){let s={[I]:o,[dF]:yF,[fF]:e,[hF]:t,[pF]:a,[gF]:`mongodb://${n}:${r}/${e}`};if(n&&r){s[_F]=n;let e=parseInt(r,10);isNaN(e)||(s[vF]=e)}if(i)try{s[mF]=bF(i)}catch{}return s}function DF(e){if(e.createIndexes!==void 0)return`createIndexes`;if(e.findandmodify!==void 0)return`findAndModify`;if(e.ismaster!==void 0)return`isMaster`;if(e.count!==void 0)return`count`;if(e.aggregate!==void 0)return`aggregate`}function OF(e,t,n,r,i){let a,o;if(t?.s&&(a=t.s.options?.host??t.s.host,o=(t.s.options?.port??t.s.port)?.toString(),a==null||o==null)){let e=t.description?.address;if(e){let t=e.split(`:`);a=t[0],o=t[1]}}let[s,c]=e.toString().split(`.`),l=n?.query??n?.q??n;return EF(s,c,a,o,l,r,i)}function kF(e){return B({name:`mongodb.${e[pF]||`command`}`,op:`db`,kind:G.CLIENT,attributes:e})}var AF=`mysql2:query`,jF=`mysql2:execute`,MF=`mysql2:connect`,NF=`mysql2:pool:connect`,PF=`auto.db.mysql2.diagnostic_channel`,FF=`mysql`,IF=/^\s*(\w+)/;function LF(e){RF(e,AF),RF(e,jF),zF(e,MF,`mysql2.connect`),zF(e,NF,`mysql2.pool.connect`)}function RF(e,t){Z(e(t),e=>{let t=e.query?aw(e.query):void 0,n=t?.match(IF)?.[1]?.toUpperCase();return B({name:t||`mysql2.query`,attributes:{[I]:PF,[F]:`db`,[Fc]:FF,[Mc]:t,[jc]:n,[Oc]:e.database||void 0,[ou]:e.serverAddress,[su]:e.serverPort}})},{requiresParentSpan:!0})}function zF(e,t,n){Z(e(t),e=>B({name:n,attributes:{[I]:PF,[F]:`db`,[Fc]:FF,[Oc]:e.database||void 0,[ou]:e.serverAddress,[su]:e.serverPort}}),{requiresParentSpan:!0})}var BF=W((()=>({name:`Mysql2`,setupOnce(){w.tracingChannel&&U(()=>{LF(w.tracingChannel)})}}))),VF=`7`,HF=`PRISMA_INSTRUMENTATION`,UF=`V${VF}_PRISMA_INSTRUMENTATION`,WF=globalThis;function GF(e){let t={helper:e};WF[UF]=t,WF[HF]=t}var KF=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES===`true`}catch{return!1}})(),qF=`00-10-10-00`,JF=`auto.db.otel.prisma`,YF=1e3,XF=new lx(YF),ZF=[];function QF(e,t){XF.set(e,t)}function $F(e,t){let n={...t,[I]:JF};return e===`prisma:engine:db_query`&&n[`db.system`]==null&&(n[Pc]=`prisma`),n}function eI(e,t){let n=t[`db.query.text`];return(e===`prisma:engine:db_query`||e===`prisma:client:db_query`)&&typeof n==`string`?n:e}function tI(){let e=!0;for(;e;){e=!1;for(let t=ZF.length-1;t>=0;t--){let n=ZF[t],r=XF.get(n.parent_span_id);if(!r)continue;let i=$F(n.name,n.attributes),a=B({name:eI(n.name,i),attributes:i,kind:n.kind===`client`?G.CLIENT:G.INTERNAL,startTime:n.start_time,parentSpan:r});QF(n.span_id,a),n.links&&a.addLinks(n.links.flatMap(e=>{let t=XF.get(e.span_id);return t?[{context:t.spanContext()}]:[]})),a.end(n.end_time),ZF.splice(t,1),e=!0}}}var nI=class{constructor({ignoreSpanTypes:e}){this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(e){let t=(e??R())?.spanContext();return t?`00-${t.traceId}-${t.spanId}-0${t.traceFlags}`:qF}dispatchEngineSpans(e){let t=new Map,n=e.filter(e=>e.parentId===null);for(let r of n)rI(r,e,t,this.ignoreSpanTypes)}createEngineSpan(e){ZF.push(...e.spans),tI();let t=ZF.length-YF;t>0&&(X&&A.log(`[Prisma] Dropping ${t} unresolved v5 engine span(s) whose parent was never registered.`),ZF.splice(0,t))}getActiveContext(){return R()}runInChildSpan(e,t){let n=typeof e==`string`?{name:e}:e;if(n.internal&&!KF)return t();let r=`prisma:client:${n.name}`;if(oI(r,this.ignoreSpanTypes))return t();let i=R(),a=$F(r,n.attributes),o={name:eI(r,a),attributes:a,kind:n.kind,links:n.links,startTime:n.startTime,parentSpan:i};if(n.active===!1){let e=B(o);return QF(e.spanContext().spanId,e),iI(e,()=>t(e,i))}return ts(o,e=>(QF(e.spanContext().spanId,e),iI(e,()=>t(e,i))))}};function rI(e,t,n,r){if(oI(e.name,r))return;let i=$F(e.name,e.attributes);ts({name:eI(e.name,i),attributes:i,kind:e.kind===`client`?G.CLIENT:G.INTERNAL,startTime:e.startTime},i=>{n.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(e=>{let t=n.get(e);return t?{context:{spanId:t,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=t.filter(t=>t.parentId===e.id);for(let e of a)rI(e,t,n,r);i.end(e.endTime)})}function iI(e,t){let n;try{n=t()}catch(t){throw e.end(),t}return aI(n)?n.then(t=>(e.end(),t),t=>{throw e.end(),t}):(e.end(),n)}function aI(e){return e!=null&&typeof e.then==`function`}function oI(e,t){return t.some(t=>typeof t==`string`?t===e:t.test(e))}var sI=`Prisma`;function cI(e){GF(new nI({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var lI=W((e=>({name:sI,setupOnce(){cI(e)}}))),uI=`node-redis:command`,dI=`node-redis:batch`,fI=`node-redis:connect`,pI=`ioredis:command`,mI=`ioredis:connect`,hI=`auto.db.redis.diagnostic_channel`,gI=`redis`;function _I(e,t){vI(e,uI,e=>e.args.slice(1),t),yI(e,dI,e=>e.batchMode===`PIPELINE`?`PIPELINE`:`MULTI`),bI(e,fI),vI(e,pI,e=>e.args,t),bI(e,mI)}function vI(e,t,n,r){Z(e(t),e=>{let t=n(e),r=t.length?`${e.command} ${t.join(` `)}`:e.command;return B({name:`redis-${e.command}`,attributes:{[I]:hI,[F]:`db.redis`,[Fc]:gI,[Mc]:r,...e.serverAddress==null?{}:{[ou]:e.serverAddress},...e.serverPort==null?{}:{[su]:e.serverPort}}})},{beforeSpanEnd(e,t){`error`in t||xI(r,e,t.command,n(t),t.result)}})}function yI(e,t,n){Z(e(t),e=>B({name:n(e),attributes:{[I]:hI,[F]:`db.redis`,[Fc]:gI,...Number(e.batchSize)>1?{[Ac]:e.batchSize}:{},...e.serverAddress==null?{}:{[ou]:e.serverAddress},...e.serverPort==null?{}:{[su]:e.serverPort}}}))}function bI(e,t){Z(e(t),e=>B({name:`redis-connect`,attributes:{[I]:hI,[F]:`db.redis.connect`,[Fc]:gI,...e.serverAddress==null?{}:{[ou]:e.serverAddress},...e.serverPort==null?{}:{[su]:e.serverPort}}}))}function xI(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}var SI=W(((e={})=>({name:`Redis`,setupOnce(){w.tracingChannel&&U(()=>{_I(w.tracingChannel,e.responseHook)})}}))),CI=[{regex:/^ECHO/i,args:0},{regex:/^(LPUSH|MSET|PFA|PUBLISH|RPUSH|SADD|SET|SPUBLISH|XADD|ZADD)/i,args:1},{regex:/^(HSET|HMSET|LSET|LINSERT)/i,args:2},{regex:/^(ACL|BIT|B[LRZ]|CLIENT|CLUSTER|CONFIG|COMMAND|DECR|DEL|EVAL|EX|FUNCTION|GEO|GET|HINCR|HMGET|HSCAN|INCR|L[TRLM]|MEMORY|P[EFISTU]|RPOP|S[CDIMORSU]|XACK|X[CDGILPRT]|Z[CDILMPRS])/i,args:-1}],wI=(e,t)=>{if(Array.isArray(t)&&t.length){let n=CI.find(({regex:t})=>t.test(e))?.args??0,r=n>=0?t.slice(0,n):t.slice();return t.length>r.length&&r.push(`[${t.length-n} other arguments]`),`${e} ${r.join(` `)}`}return e};function Q(e){return typeof e==`string`?e:void 0}function TI(e){return typeof e==`number`&&!isNaN(e)?e:void 0}function EI(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function DI(e){return j(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`}function OI(e,t,n){let r=e.getReader(),i={toolCalls:[]},a=``,o=!1,s=()=>{o||(o=!0,a&&(i.text=a),t(i))},c=e=>{o||(o=!0,n(e))};return new ReadableStream({async pull(e){try{let{done:t,value:n}=await r.read();if(t){s(),e.close();return}a+=kI(i,n)??``,e.enqueue(n)}catch(t){c(t),e.error(t)}},cancel(e){return s(),r.cancel(e)}})}function kI(e,t){if(!j(t))return;let{type:n,delta:r,textDelta:i,id:a,modelId:o,toolCallId:s,toolName:c,input:l,args:u,finishReason:d,usage:f,providerMetadata:p}=t;switch(n){case`text-delta`:{let e=r??i;return typeof e==`string`?e:void 0}case`tool-call`:e.toolCalls.push({toolCallId:s,toolName:c,input:l??u});return;case`response-metadata`:typeof a==`string`&&(e.responseId=a),typeof o==`string`&&(e.responseModel=o);return;case`finish`:e.finishReason=d,e.usage=f,p!==void 0&&(e.providerMetadata=p);return;default:return}}var AI=`ai:telemetry`,jI=`auto.vercelai.channel`,MI=`gen_ai.tool.call.id`,NI=`gen_ai.tool.description`,PI=`embeddings`,FI=`rerank`,II=`generate_content`,LI=`WorkersAI`,RI=`vercel.ai.operationId`,zI=`vercel.ai.model.provider`,BI=`vercel.ai.settings.maxRetries`,VI=new Map,HI=new Map,UI=new Map,WI=new Set([`generateText`,`streamText`,`generateObject`,`embed`,`embedMany`,`rerank`]);function GI(e){if(!WI.has(e.type))return;let t=Q(e.event.callId);t&&KI(t)}function KI(e){VI.delete(e),HI.delete(e),UI.delete(e)}function qI(e,t){if(WI.has(t))for(let t of Xv)delete e[t]}function JI(e,t){if(!e||!Array.isArray(t))return;let n=HI.get(e);for(let e of t)j(e)&&typeof e.name==`string`&&typeof e.description==`string`&&(n??=new Map,n.has(e.name)||n.set(e.name,e.description));n&&HI.set(e,n)}function YI(e,t,n){let r=e?HI.get(e)?.get(t):void 0;if(r)return r;if(Array.isArray(n)){let e=n.find(e=>j(e)&&e.name===t);return j(e)?Q(e.description):void 0}if(j(n)){let e=n[t];return j(e)?Q(e.description):void 0}}function XI(e,t={}){Z(e(AI),e=>tL(e,t),{beforeSpanEnd:(e,n)=>{oL(e,n,t),GI(n)},deferSpanEnd:({data:e,end:n})=>ZI(e,t,n)})}function ZI(e,t,n){if(e.type!==`languageModelCall`||!j(e.result))return!1;let r=e.result,i=r.stream;if(!DI(i))return!1;let a=Q(e.event.callId),{recordOutputs:o}=hL(e.event,t);return r.stream=OI(i,t=>{e.result={...r,...QI(t)},n(),$I(a,t,o)},e=>n(e)),!0}function QI(e){let t=[];e.text&&t.push({type:`text`,text:e.text});for(let n of e.toolCalls)t.push({type:`tool-call`,...n});return{content:t,...e.usage===void 0?{}:{usage:e.usage},...e.finishReason===void 0?{}:{finishReason:e.finishReason},...e.providerMetadata===void 0?{}:{providerMetadata:e.providerMetadata},...e.responseId||e.responseModel?{response:{...e.responseId?{id:e.responseId}:{},...e.responseModel?{modelId:e.responseModel}:{}}}:{}}}function $I(e,t,n){let r=e?UI.get(e):void 0;if(!r)return;let i=j(t.usage)?t.usage:void 0;if(i){let e=lL(i.inputTokens)??lL(i.promptTokens)??lL(i.tokens),t=lL(i.outputTokens)??lL(i.completionTokens);eL(r,ul,e),eL(r,dl,t),eL(r,fl,lL(i.totalTokens)??EI(e,t))}if(n){let e=uL(pL(t.text,t.toolCalls),cL({finishReason:t.finishReason}));e&&r.setAttribute(Jc,e)}}function eL(e,t,n){if(n===void 0)return;let r=L(e).data[t];e.setAttribute(t,(typeof r==`number`?r:0)+n)}function tL(e,t){let{type:n,event:r}=e;if(n===`step`||!r||typeof r!=`object`)return;let{recordInputs:i,enableTruncation:a}=hL(r,t),o=Q(r.provider),s=Q(r.modelId),c=Q(r.callId),l=TI(r.maxRetries);i&&JI(c,r.tools);let u={[I]:jI,...o?{[al]:o,[zI]:o}:{},...s?{[Zc]:s}:{},...l===void 0?{}:{[BI]:l}};switch(n){case`generateText`:case`streamText`:case`generateObject`:return rL(r,u,i,a,c,n===`streamText`);case`languageModelCall`:return Yf([LI]),iL(r,u,i,a,c,s);case`executeTool`:return aL(r,i);case`embed`:case`embedMany`:{let e=n===`embedMany`?r.values:r.value;return nL(PI,s,{...u,...i&&e!==void 0?{[Wc]:mr(e)}:{}})}case`rerank`:return nL(FI,s,u);default:return}}function nL(e,t,n){return B({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[qc]:e,...n}})}function rL(e,t,n,r,i,a){let o=Q(e.functionId),s=Q(e.operationId)??(a?`ai.streamText`:`ai.generateText`);i&&VI.set(i,{operationId:s,isStream:a});let c=nL(mP,o,{...t,[RI]:s,[il]:a,...o?{[Gc]:o}:{},...n?_L(e,r):{}});return a&&i&&UI.set(i,c),c}function iL(e,t,n,r,i,a){let o=i?VI.get(i):void 0,s=o?`${o.operationId}.${o.isStream?`doStream`:`doGenerate`}`:`ai.generateText.doGenerate`;return nL(II,a,{...t,[RI]:s,...n?_L(e,r):{},...n&&Array.isArray(e.tools)?{[Yc]:mr(e.tools)}:{}})}function aL(e,t){let n=j(e.toolCall)?e.toolCall:{},r=Q(n.toolName),i=Q(e.toolCallId)??Q(n.toolCallId),a=n.input??n.args,o=t&&r?YI(Q(e.callId),r,e.tools):void 0;return nL(pP,r,{[I]:jI,[ll]:`function`,...r?{[sl]:r}:{},...i?{[MI]:i}:{},...o?{[NI]:o}:{},...t&&a!==void 0?{[ol]:mr(a)}:{}})}function oL(e,t,n){let{type:r,result:i}=t;if(!j(i))return;let{recordOutputs:a}=hL(t.event,n);if(r===`executeTool`){a&&e.setAttribute(cl,mr(i.output??i));let n=j(i.output)?i.output:void 0;n?.type===`tool-error`&&mL(e,t,n.error);return}let o=j(i.usage)?i.usage:void 0;if(o){let t=lL(o.inputTokens)??lL(o.promptTokens)??lL(o.tokens),n=lL(o.outputTokens)??lL(o.completionTokens),r=lL(o.totalTokens)??EI(t,n);t!==void 0&&e.setAttribute(ul,t),n!==void 0&&e.setAttribute(dl,n),r!==void 0&&e.setAttribute(fl,r)}let s=cL(i);s&&r===`languageModelCall`&&e.setAttribute(tl,mr([s]));let c=j(i.response)?i.response:void 0,l=Q(c?.id)??Q(i.responseId);l&&e.setAttribute(nl,l);let u=Q(c?.modelId)??Q(t.event.modelId);u&&e.setAttribute(rl,u);let d=i.providerMetadata,f=Yv(d);if(`gen_ai.conversation.id`in f&&L(e).data[`gen_ai.conversation.id`]&&delete f[Vi],qI(f,r),e.setAttributes(f),a){let t=uL(r===`languageModelCall`&&Array.isArray(i.content)?fL(i.content):pL(i.text,i.toolCalls),s);t&&e.setAttribute(Jc,t)}}function sL(e){return e===`tool-calls`?`tool_call`:e??`stop`}function cL(e){let t=e.finishReason;return typeof t==`string`?t:j(t)?Q(t.unified):void 0}function lL(e){return TI(e)??(j(e)?TI(e.total):void 0)}function uL(e,t){if(e.length)return mr([{role:`assistant`,parts:e,finish_reason:sL(t)}])}function dL(e){let t=e.input??e.args;return{type:`tool_call`,id:Q(e.toolCallId),name:Q(e.toolName),arguments:typeof t==`string`?t:mr(t??{})}}function fL(e){let t=[];for(let n of e)j(n)&&(n.type===`text`&&typeof n.text==`string`?t.push({type:`text`,content:n.text}):n.type===`tool-call`&&t.push(dL(n)));return t}function pL(e,t){let n=[];if(typeof e==`string`&&e.length&&n.push({type:`text`,content:e}),Array.isArray(t))for(let e of t)j(e)&&n.push(dL(e));return n}function mL(e,t,n){e.setStatus({code:2,message:n instanceof Error?n.message:`tool_error`});let r=j(t.event.toolCall)?t.event.toolCall:{},i=Q(r.toolName),a=Q(t.event.toolCallId)??Q(r.toolCallId);bi(t=>{t.setContext(`trace`,ja(e)),i&&t.setTag(`vercel.ai.tool.name`,i),a&&t.setTag(`vercel.ai.tool.callId`,a),t.setLevel(`error`),H(n instanceof Error?n:Error(typeof n==`string`?n:`Tool execution failed`),{mechanism:{type:`auto.vercelai.channel`,handled:!1}})})}function hL(e,t){let n=P()?.getDataCollectionOptions().genAI;return{recordInputs:gL(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:gL(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:q_(t.enableTruncation)}}function gL(e,t,n){return typeof e==`boolean`?e:typeof t==`boolean`?t:n===!0}function _L(e,t){let n={},r=Q(e.instructions);r&&(n[Wg]=mr([{type:`text`,content:r}]));let i=e.messages??e.prompt;return i!==void 0&&(n[Kc]=t?Z_(i):mr(i),n[Vg]=Array.isArray(i)?i.length:1),n}var vL=W(((e={})=>({name:`VercelAI`,setupOnce(){w.tracingChannel&&U(()=>{XI(w.tracingChannel,e)})}}))),yL=`@sentry/instrumentation-fastify`,bL=`>=3.21.0 <6`,xL=`auto.http.otel.fastify`,SL=`hook.fastify`,CL=`request_handler.fastify`,wL=[`onRequest`,`preParsing`,`preValidation`,`preHandler`,`preSerialization`,`onSend`,`onResponse`,`onError`],TL=`hook.name`,EL=`fastify.type`,DL=`hook.callback.name`,OL=`fastify.root`,kL=`route-hook`,AL=`hook`,jL=`request-handler`,ML=`anonymous`,NL=Symbol(`sentry fastify request span`),PL=Symbol(`sentry fastify addHook original`),FL=Symbol(`sentry fastify setNotFoundHandler original`);function IL(e){return e.routeOptions?.url??e.routerPath}function LL(e){return e.routeOptions?.config??e.routeConfig}function RL(e){return j(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||`routerPath`in e)}function zL(e,t,n){e.decorate(PL,e.addHook),e.decorate(FL,e.setNotFoundHandler),e.decorateRequest(`opentelemetry`,function(){return{span:this[NL]}}),e.decorateRequest(NL,null),e.addHook(`onRoute`,VL),e.addHook(`onRequest`,WL),e.addHook(`onResponse`,GL),e.addHook=JL,e.setNotFoundHandler=YL,n()}var BL=zL;BL[Symbol.for(`skip-override`)]=!0,BL[Symbol.for(`fastify.display-name`)]=yL,BL[Symbol.for(`plugin-meta`)]={fastify:bL,name:yL};function VL(e){if(e.config?.otel!==!1){for(let t of wL){let n=e[t];typeof n==`function`?e[t]=ZL(n,t,HL(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(n=>ZL(n,t,HL(this.pluginName,t,n,e.url))))}e.onSend=UL(e.onSend,KL),e.onError=UL(e.onError,qL),e.handler=ZL(e.handler,`handler`,{[TL]:`${this.pluginName} - route-handler`,[EL]:jL,[Sl]:e.url,[DL]:e.handler.name.length>0?e.handler.name:ML})}}function HL(e,t,n,r){return{[TL]:`${e} - route -> ${t}`,[EL]:kL,[Sl]:r,[DL]:n.name?.length>0?n.name:ML}}function UL(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function WL(e,t,n){if(LL(e)?.otel===!1)return n();let r={[I]:xL,[OL]:yL,[bl]:e.method,[du]:e.url},i=IL(e);if(i!=null){r[Sl]=i;let e=R(),t=e&&Za(e);t&&L(t).data[`sentry.op`]===`http.server`&&t.setAttribute(Sl,i)}let a=B({name:`request`,op:CL,attributes:r});e[NL]=a,V(a,()=>{n()})}function GL(e,t,n){let r=e[NL];r!=null&&(r.setAttributes({[xl]:t.statusCode}),r.end()),e[NL]=null,n()}function KL(e,t,n,r){let i=e[NL];i!=null&&(t.statusCode>=500&&i.setStatus({code:2}),i.setAttributes({[xl]:t.statusCode}),i.end()),e[NL]=null,r(null,n)}function qL(e,t,n,r){e[NL]?.setStatus({code:2,message:n.message}),r()}function JL(e,t){let n=this[PL];return wL.includes(e)?n.call(this,e,ZL(t,e,{[TL]:`${this.pluginName} - ${e}`,[EL]:AL,[DL]:t.name?.length>0?t.name:ML})):n.call(this,e,t)}function YL(e,t){let n=this[FL];if(typeof e==`function`){n.call(this,ZL(e,`notFoundHandler`,{[TL]:`${this.pluginName} - not-found-handler`,[EL]:AL,[DL]:e.name?.length>0?e.name:ML}));return}if(e.preValidation!=null&&(e.preValidation=ZL(e.preValidation,`notFoundHandler - preValidation`,{[TL]:`${this.pluginName} - not-found-handler - preValidation`,[EL]:AL,[DL]:e.preValidation.name?.length>0?e.preValidation.name:ML})),e.preHandler!=null&&(e.preHandler=ZL(e.preHandler,`notFoundHandler - preHandler`,{[TL]:`${this.pluginName} - not-found-handler - preHandler`,[EL]:AL,[DL]:e.preHandler.name?.length>0?e.preHandler.name:ML})),t==null){n.call(this,e);return}n.call(this,e,ZL(t,`notFoundHandler`,{[TL]:`${this.pluginName} - not-found-handler`,[EL]:AL,[DL]:t.name?.length>0?t.name:ML}))}function XL(e){for(let t of e)if(RL(t))return t;return null}function ZL(e,t,n={}){return function(...r){let i=XL(r);if(i===null||LL(i)?.otel===!1)return e.call(this,...r);let a=i[NL]??void 0,o=e.name?.length>0?e.name:this.pluginName??ML,s=n[EL],c=s===AL?SL:s===jL?CL:void 0;return z({name:c?QL(n[TL]):`${t} - ${o}`,op:c,attributes:{...n,[I]:xL},parentSpan:a},()=>e.call(this,...r))}}function QL(e=``){return e.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``).replace(/^@sentry\/instrumentation-fastify -> /,``)}function $L(e){e.addHook(`onRequest`,async(e,t)=>{let n=IL(e),r=e.method||`GET`;N().setTransactionName(`${r} ${n}`)})}var eR=!1,tR=Object.assign(function(){eR||(eR=!0,w.subscribe(`fastify.initialization`,e=>{let t=e.fastify;t?.register(zL).after(e=>{e?X&&A.error(`Failed to setup Fastify instrumentation`,e):t&&$L(t)})}))},{id:`Fastify.v5`}),nR=`Fastify`;function rR(e,t,n){let r=n.statusCode;return r>=500||r<=299}function iR(){return P()?.getIntegrationByName(nR)}function aR(){w.subscribe(`tracing:fastify.request.handler:error`,e=>{let{error:t,request:n,reply:r}=e;oR.call(oR,t,n,r,`diagnostics-channel`)})}function oR(e,t,n,r){let i=iR()?.getShouldHandleError()||rR;if(r===`diagnostics-channel`&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r===`onError-hook`){X&&A.warn(`Fastify error handler was already registered via diagnostics channel.`,"You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}i(e,t,n)&&H(e,{mechanism:{handled:!1,type:`auto.function.fastify`}})}var sR=W((({shouldHandleError:e}={})=>{let t;return{name:nR,setupOnce(){t=e||rR,aR(),tR()},getShouldHandleError(){return t},setShouldHandleError(e){t=e}}})),cR=oR,lR=`db.mongodb.collection`,uR=`db.name`,dR=`db.user`,fR=`net.peer.name`,pR=`net.peer.port`,mR=`db.operation`,hR=`db.system`;function gR({collection:e,modelName:t,operation:n,origin:r,parentSpan:i}){let a={[lR]:e?.name,[uR]:e?.conn?.name,[dR]:e?.conn?.user,[fR]:e?.conn?.host,[pR]:e?.conn?.port,[mR]:n,[hR]:`mongoose`,[I]:r};return B({name:`mongoose.${t}.${n}`,op:`db`,kind:G.CLIENT,attributes:a,parentSpan:i})}var _R=`Fastify`,vR=Y(`${_R}.v3`,()=>new uP);function yR(){let e=P();if(e)return e.getIntegrationByName(_R)}var bR=(e=>Ed(sR(e),{setupOnce(){vR()}})),xR=W((e={})=>bR(e));function SR(e,t){t?.shouldHandleError&&yR()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(e,t,n){e.addHook(`onError`,async(e,t,n)=>{cR.call(cR,n,e,t,`onError-hook`)}),n()},{[Symbol.for(`skip-override`)]:!0,[Symbol.for(`fastify.display-name`)]:`sentry-fastify-error-handler`});e.register(n)}var CR=class{constructor(e,t,n,r){this.name=x(e),this.supportedVersions=t,this.patch=n,this.unpatch=r}},wR=(e=>(e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`,e))(wR||{}),TR=(e=>(e.SOF=`<SOF>`,e.EOF=`<EOF>`,e.BANG=`!`,e.DOLLAR=`$`,e.AMP=`&`,e.PAREN_L=`(`,e.PAREN_R=`)`,e.SPREAD=`...`,e.COLON=`:`,e.EQUALS=`=`,e.AT=`@`,e.BRACKET_L=`[`,e.BRACKET_R=`]`,e.BRACE_L=`{`,e.PIPE=`|`,e.BRACE_R=`}`,e.NAME=`Name`,e.INT=`Int`,e.FLOAT=`Float`,e.STRING=`String`,e.BLOCK_STRING=`BlockString`,e.COMMENT=`Comment`,e))(TR||{}),ER=(e=>(e.EXECUTE=`graphql.execute`,e.PARSE=`graphql.parse`,e.RESOLVE=`graphql.resolve`,e.VALIDATE=`graphql.validate`,e.SCHEMA_VALIDATE=`graphql.validateSchema`,e.SCHEMA_PARSE=`graphql.parseSchema`,e))(ER||{}),DR=(e=>(e.SOURCE=`graphql.source`,e.FIELD_NAME=`graphql.field.name`,e.FIELD_PATH=`graphql.field.path`,e.FIELD_TYPE=`graphql.field.type`,e.PARENT_NAME=`graphql.parent.name`,e.OPERATION_TYPE=`graphql.operation.type`,e.OPERATION_NAME=`graphql.operation.name`,e))(DR||{}),OR=Symbol.for(`opentelemetry.patched`),kR=Symbol.for(`opentelemetry.graphql_data`),AR=`Operation$operationName$not supported`,jR=Object.values(wR),MR=e=>typeof e?.then==`function`;function NR(e,t,n,r){if(P()?.getDataCollectionOptions().graphQL.document===!0){let i=qR(t,n,r);e.setAttribute(DR.SOURCE,i)}}function PR(e,t,n){let r=zR(e,n);return r?{field:r,spanAdded:!1}:(r={span:FR(e,t,n,BR(e,n))},RR(e,n,r),{field:r,spanAdded:!0})}function FR(e,t,n,r){let i={[DR.FIELD_NAME]:t.fieldName,[DR.FIELD_PATH]:n.join(`.`),[DR.FIELD_TYPE]:t.returnType.toString(),[DR.PARENT_NAME]:t.parentType.name},a=B({name:`${ER.RESOLVE} ${i[DR.FIELD_PATH]}`,attributes:i,parentSpan:r}),o=e[kR].source,s=t.fieldNodes.find(e=>e.kind===`Field`);return s&&NR(a,o.loc,s.loc?.start,s.loc?.end),a}function IR(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function LR(e,t){if(e&&Array.isArray(e.definitions))return t?e.definitions.filter(e=>jR.indexOf(e?.operation)!==-1).find(e=>t===e?.name?.value):e.definitions.find(e=>jR.indexOf(e?.operation)!==-1)}function RR(e,t,n){return e[kR].fields[t.join(`.`)]=n}function zR(e,t){return e[kR].fields[t.join(`.`)]}function BR(e,t){for(let n=t.length-1;n>0;n--){let r=zR(e,t.slice(0,n));if(r)return r.span}return VR(e)}function VR(e){return e[kR].span}function HR(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function UR(e){return GR(`
|
|
30
|
+
`,e)}function WR(e){return GR(` `,e)}function GR(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}var KR=[TR.FLOAT,TR.STRING,TR.INT,TR.BLOCK_STRING];function qR(e,t,n){let r=``;if(e?.startToken){let i=typeof t==`number`?t:e.start,a=typeof n==`number`?n:e.end,o=e.startToken.next,s=1;for(;o;){if(o.start<i){o=o.next,s=o?.line;continue}if(o.end>a){o=o.next,s=o?.line;continue}let e=o.value||o.kind,t=``;KR.indexOf(o.kind)>=0&&(e=`*`),o.kind===TR.STRING&&(e=`"${e}"`),o.kind===TR.EOF&&(e=``),o.line>s?(r+=UR(o.line-s),s=o.line,t=WR(o.column-1)):o.line===o.prev?.line&&(t=WR(o.start-(o.prev?.end||0))),r+=t+e,o&&=o.next}}return r}function JR(e,t){if(!e||e[OR])return;let n=e.getFields();e[OR]=!0,Object.keys(n).forEach(e=>{let r=n[e];if(r&&(r.resolve&&=ez(t,r.resolve),r.type)){let e=YR(r.type);for(let n of e)JR(n,t)}})}function YR(e){return`ofType`in e?YR(e.ofType):XR(e)?e.getTypes():ZR(e)?[e]:[]}function XR(e){return`getTypes`in e&&typeof e.getTypes==`function`}function ZR(e){return`getFields`in e&&typeof e.getFields==`function`}var QR=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},$R=(e,t)=>{t&&e.end()};function ez(e,t,n=!1){if(r[OR]||typeof t!=`function`)return t;function r(r,i,a,o){if(!t)return;if(e().ignoreTrivialResolveSpans&&n&&(j(r)||typeof r==`function`)&&typeof r[o.fieldName]!=`function`||!a[kR])return t.call(this,r,i,a,o);let{field:s,spanAdded:c}=PR(a,o,HR(o?.path)),l=s.span,u=c;return V(l,()=>{try{let e=t.call(this,r,i,a,o);return MR(e)?e.then(e=>($R(l,u),e),e=>{throw QR(l,e,u),e}):($R(l,u),e)}catch(e){throw QR(l,e,u),e}})}return r[OR]=!0,r}var tz=`@sentry/instrumentation-graphql`,nz=`auto.graphql.otel.graphql`,rz={ignoreResolveSpans:!1},iz=[`>=14.0.0 <17`],az=class extends q{constructor(e={}){super(tz,k,{...rz,...e})}setConfig(e={}){super.setConfig({...rz,...e})}init(){let e=new J(`graphql`,iz);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new CR(`graphql/execution/execute.js`,iz,e=>(K(e.execute)&&this._unwrap(e,`execute`),this._wrap(e,`execute`,this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,`execute`)})}_addPatchingParser(){return new CR(`graphql/language/parser.js`,iz,e=>(K(e.parse)&&this._unwrap(e,`parse`),this._wrap(e,`parse`,this._patchParse()),e),e=>{e&&this._unwrap(e,`parse`)})}_addPatchingValidate(){return new CR(`graphql/validation/validate.js`,iz,e=>(K(e.validate)&&this._unwrap(e,`validate`),this._wrap(e,`validate`,this._patchValidate()),e),e=>{e&&this._unwrap(e,`validate`)})}_patchExecute(e){let t=this;return function(n){return function(){let r;if(arguments.length>=2){let n=arguments;r=t._wrapExecuteArgs(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],e)}else{let n=arguments[0];r=t._wrapExecuteArgs(n.schema,n.document,n.rootValue,n.contextValue,n.variableValues,n.operationName,n.fieldResolver,n.typeResolver,e)}let i=LR(r.document,r.operationName),a=t._createExecuteSpan(i,r);return r.contextValue[kR]={source:r.document?r.document||r.document[kR]:void 0,span:a,fields:{}},V(a,()=>SE(()=>n.apply(this,[r]),(e,n)=>{t._handleExecutionResult(a,e,n)}))}}}_handleExecutionResult(e,t,n){if(n===void 0||t){IR(e,t);return}MR(n)?n.then(t=>{this._updateSpanFromResult(e,t),IR(e)},t=>{IR(e,t)}):(this._updateSpanFromResult(e,n),IR(e))}_updateSpanFromResult(e,t){if(t.errors?.length&&!L(e).status&&e.setStatus({code:2}),!this.getConfig().useOperationNameForRootSpan)return;let n=L(e).data,r=n[DR.OPERATION_TYPE],i=n[DR.OPERATION_NAME];if(!r)return;let a=Za(e),o=L(a).data[`sentry.graphql.operation`]||[],s=i?`${r} ${i}`:`${r}`;Array.isArray(o)?(o.push(s),a.setAttribute(GD,o)):typeof o==`string`?a.setAttribute(GD,[o,s]):a.setAttribute(GD,s),L(a).data[`original-description`]||a.setAttribute(`original-description`,L(a).description),a.updateName(`${L(a).data[`original-description`]} (${oz(o)})`)}_patchParse(){let e=this;return function(t){return function(n,r){return e._parse(this,t,n,r)}}}_patchValidate(){let e=this;return function(t){return function(n,r,i,a,o){return e._validate(this,t,n,r,i,o,a)}}}_parse(e,t,n,r){let i=B({name:ER.PARSE});return V(i,()=>SE(()=>t.call(e,n,r),(e,t)=>{t&&(LR(t)?t.loc&&NR(i,t.loc):i.updateName(ER.SCHEMA_PARSE)),IR(i,e)}))}_validate(e,t,n,r,i,a,o){let s=B({name:ER.VALIDATE});return V(s,()=>SE(()=>t.call(e,n,r,i,o,a),(e,t)=>{r.loc||s.updateName(ER.SCHEMA_VALIDATE),IR(s,e)}))}_createExecuteSpan(e,t){let n=B({name:ER.EXECUTE,attributes:{[I]:nz}});if(e){let{operation:t,name:r}=e;n.setAttribute(DR.OPERATION_TYPE,t);let i=r?.value;i?(n.setAttribute(DR.OPERATION_NAME,i),n.updateName(`${t} ${i}`)):n.updateName(t)}else{let e=` `;t.operationName&&(e=` "${t.operationName}" `),e=AR.replace(`$operationName$`,e),n.setAttribute(DR.OPERATION_NAME,e)}return t.document?.loc&&NR(n,t.document.loc),n}_wrapExecuteArgs(e,t,n,r,i,a,o,s,c){return r||={},r[kR]||this.getConfig().ignoreResolveSpans?{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:o,typeResolver:s}:(o=ez(()=>this.getConfig(),o??c,o==null),e&&(JR(e.getQueryType(),()=>this.getConfig()),JR(e.getMutationType(),()=>this.getConfig())),{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:o,typeResolver:s})}};function oz(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(`, `):`${t.slice(0,5).join(`, `)}, +${t.length-5}`}return`${e}`}var sz=`Graphql`,cz=Y(sz,az,e=>uz(e)),lz=W(((e={})=>Ed(JP(uz(e)),{name:sz,setupOnce(){cz(uz(e))}})));function uz(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var dz=`messaging.destination.partition.id`,fz=`messaging.kafka.message.key`,pz=`messaging.kafka.message.tombstone`,mz=`messaging.kafka.offset`,hz=`process`,gz=`receive`,_z=`send`,vz=`kafka`,yz=`_OTHER`;b();var bz=`auto.kafkajs.otel.producer`,xz=`auto.kafkajs.otel.consumer`;function Sz(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function Cz(e){let t=Sz(e,`sentry-trace`);if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=wa(t,Sz(e,`baggage`));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?p.SAMPLED:p.NONE}}]}function wz({topic:e,message:t,operationType:n,links:r,attributes:i}){let a=n===`receive`?`poll`:n;return B({name:`${a} ${e}`,kind:n===`receive`?G.CLIENT:G.CONSUMER,links:r,attributes:{...i,[Il]:vz,[Ml]:e,[Fl]:n,[Pl]:a,[fz]:t?.key?String(t.key):void 0,[pz]:t?.key&&t.value===null?!0:void 0,[mz]:t?.offset,...t?{[I]:xz}:{}}})}function Tz(e,t){let n=B({name:`send ${e}`,kind:G.PRODUCER,attributes:{[Il]:vz,[Ml]:e,[fz]:t.key?String(t.key):void 0,[pz]:t.key&&t.value===null?!0:void 0,[dz]:t.partition===void 0?void 0:String(t.partition),[Pl]:`send`,[Fl]:_z,[I]:bz}});t.headers=t.headers??{};let r=yp({span:n});return r[`sentry-trace`]&&(t.headers[`sentry-trace`]=r[`sentry-trace`]),r.baggage&&(t.headers.baggage=r.baggage),n}function Ez(e,t){return Promise.resolve(t).catch(t=>{let n,r=yz;throw typeof t==`string`||t===void 0?n=t:typeof t==`object`&&Object.prototype.hasOwnProperty.call(t,`message`)&&(n=t.message,r=t.constructor.name),e.forEach(e=>{e.setAttribute(Lc,r),e.setStatus({code:2,message:n})}),t}).finally(()=>{e.forEach(e=>e.end())})}var Dz=`@sentry/instrumentation-kafkajs`,Oz=class extends q{constructor(e={}){super(Dz,k,e)}init(){let e=e=>{K(e?.Kafka?.prototype.producer)&&this._unwrap(e.Kafka.prototype,`producer`),K(e?.Kafka?.prototype.consumer)&&this._unwrap(e.Kafka.prototype,`consumer`)};return new J(`kafkajs`,[`>=0.3.0 <3`],t=>(e(t),this._wrap(t?.Kafka?.prototype,`producer`,this._getProducerPatch()),this._wrap(t?.Kafka?.prototype,`consumer`,this._getConsumerPatch()),t),e)}_getConsumerPatch(){let e=this;return t=>function(...n){let r=t.apply(this,n);return K(r.run)&&e._unwrap(r,`run`),e._wrap(r,`run`,e._getConsumerRunPatch()),r}}_getProducerPatch(){let e=this;return t=>function(...n){let r=t.apply(this,n);return K(r.sendBatch)&&e._unwrap(r,`sendBatch`),e._wrap(r,`sendBatch`,e._getSendBatchPatch()),K(r.send)&&e._unwrap(r,`send`),e._wrap(r,`send`,e._getSendPatch()),K(r.transaction)&&e._unwrap(r,`transaction`),e._wrap(r,`transaction`,e._getProducerTransactionPatch()),r}}_getConsumerRunPatch(){let e=this;return t=>function(...n){let r=n[0];return r?.eachMessage&&(K(r.eachMessage)&&e._unwrap(r,`eachMessage`),e._wrap(r,`eachMessage`,e._getConsumerEachMessagePatch())),r?.eachBatch&&(K(r.eachBatch)&&e._unwrap(r,`eachBatch`),e._wrap(r,`eachBatch`,e._getConsumerEachBatchPatch())),t.call(this,r)}}_getConsumerEachMessagePatch(){return e=>function(...t){let n=t[0];return is({sentryTrace:Sz(n.message.headers,`sentry-trace`),baggage:Sz(n.message.headers,`baggage`)},()=>{let r=wz({topic:n.topic,message:n.message,operationType:hz,attributes:{[dz]:String(n.partition)}}),i=V(r,()=>e.apply(this,t));return Ez([r],i)})}}_getConsumerEachBatchPatch(){return e=>function(...t){let n=t[0],r=ss(()=>wz({topic:n.batch.topic,message:void 0,operationType:gz,attributes:{[Al]:n.batch.messages.length,[dz]:String(n.batch.partition)}}));return V(r,()=>{let i=[r];return n.batch.messages.forEach(e=>{i.push(wz({topic:n.batch.topic,message:e,operationType:hz,links:Cz(e.headers),attributes:{[dz]:String(n.batch.partition)}}))}),Ez(i,e.apply(this,t))})}}_getProducerTransactionPatch(){let e=this;return t=>function(...n){let r=B({name:`transaction`}),i=t.apply(this,n);return i.then(t=>{let n=t.send;t.send=function(...t){return V(r,()=>e._getSendPatch()(n).apply(this,t).catch(e=>{throw r.setStatus({code:2,message:e?.message}),e}))};let i=t.sendBatch;t.sendBatch=function(...t){return V(r,()=>e._getSendBatchPatch()(i).apply(this,t).catch(e=>{throw r.setStatus({code:2,message:e?.message}),e}))};let a=t.commit;t.commit=function(...e){let t=a.apply(this,e).then(()=>{r.setStatus({code:1})});return Ez([r],t)};let o=t.abort;t.abort=function(...e){let t=o.apply(this,e);return Ez([r],t)}}).catch(e=>{r.setStatus({code:2,message:e?.message}),r.end()}),i}}_getSendBatchPatch(){return e=>function(...t){let n=t[0].topicMessages||[],r=[];return n.forEach(e=>{e.messages.forEach(t=>{r.push(Tz(e.topic,t))})}),Ez(r,e.apply(this,t))}}_getSendPatch(){return e=>function(...t){let n=t[0];return Ez(n.messages.map(e=>Tz(n.topic,e)),e.apply(this,t))}}},kz=`Kafka`,Az=Y(kz,()=>new Oz),jz=W((()=>({name:kz,setupOnce(){Az()}}))),Mz=`@sentry/instrumentation-lru-memoizer`,Nz=class extends q{constructor(){super(Mz,k,{})}init(){return[new J(`lru-memoizer`,[`>=1.3 <4`],e=>Object.assign(function(...t){let n=e.apply(this,t);return function(...e){let t=e.pop(),r=M(),i=typeof t==`function`?function(...e){return bi(r,()=>t.apply(this,e))}:t;return n.apply(this,[...e,i])}},{sync:e.sync}),void 0)]}},Pz=`LruMemoizer`,Fz=Y(Pz,()=>new Nz),Iz=W((()=>({name:Pz,setupOnce(){Fz()}}))),Lz=`auto.db.otel.mongo`;function Rz(e,t,n,r){return TF(e,t,n,r,Lz)}function zz(e,t,n,r){return OF(e,t,n,r,Lz)}function Bz(e,t){let n=R(),r=!1;return function(...i){if(!r){r=!0;let t=i[0];e&&(t instanceof Error&&e.setStatus({code:2,message:t.message}),e.end())}return V(n??null,()=>t.apply(this,i))}}function Vz(){return!R()}function Hz(e){return t=>function(n,r,i,a,o){let s=typeof a==`function`?a:o;if(Vz()||typeof s!=`function`||typeof i!=`object`)return typeof a==`function`?t.call(this,n,r,i,a):t.call(this,n,r,i,a,o);let c=Bz(kF(zz(r,n,i[0],e)),s);return typeof a==`function`?t.call(this,n,r,i,c):t.call(this,n,r,i,a,c)}}function Uz(){return e=>function(t,n,r,i,a){let o=typeof i==`function`?i:a;if(Vz()||typeof o!=`function`||typeof r!=`object`)return typeof i==`function`?e.call(this,t,n,r,i):e.call(this,t,n,r,i,a);let s=Bz(kF(zz(n,t,r,DF(r))),o);return typeof i==`function`?e.call(this,t,n,r,s):e.call(this,t,n,r,i,s)}}function Wz(){return e=>function(t,n,r,i){let a=i,o=Object.keys(n)[0];if(typeof n!=`object`||n.ismaster||n.hello)return e.call(this,t,n,r,i);let s;Vz()||(s=kF(Rz(this,t,n,o)));let c=Bz(s,a);return e.call(this,t,n,r,c)}}function Gz(){return e=>function(...t){let[n,r]=t,i=Object.keys(r)[0],a=()=>void 0;if(typeof r!=`object`||r.ismaster||r.hello)return e.apply(this,t);let o;Vz()||(o=kF(Rz(this,n,r,i)));let s=Bz(o,a),c=e.apply(this,t);return c.then(e=>s(null,e),e=>s(e)),c}}function Kz(){return e=>function(t,n,r,i,a,o){let s=typeof a==`function`?a:o;if(Vz()||typeof s!=`function`||typeof r!=`object`)return typeof a==`function`?e.call(this,t,n,r,i,a):e.call(this,t,n,r,i,a,o);let c=Bz(kF(zz(n,t,r,`find`)),s);return typeof a==`function`?e.call(this,t,n,r,i,c):e.call(this,t,n,r,i,a,c)}}function qz(){return e=>function(t,n,r,i,a,o){let s=typeof a==`function`?a:o;if(Vz()||typeof s!=`function`)return typeof a==`function`?e.call(this,t,n,r,i,a):e.call(this,t,n,r,i,a,o);let c=Bz(kF(zz(n,t,r.cmd,`getMore`)),s);return typeof a==`function`?e.call(this,t,n,r,i,c):e.call(this,t,n,r,i,a,c)}}function Jz(){return e=>function(t){let n=R();return e.call(this,function(...e){return V(n??null,()=>t.apply(this,e))})}}var Yz=`@sentry/instrumentation-mongodb`,Xz=class extends q{constructor(e={}){super(Yz,k,e)}init(){let{v3PatchConnection:e,v3UnpatchConnection:t}=this._getV3ConnectionPatches(),{v4PatchConnectionCallback:n,v4PatchConnectionPromise:r,v4UnpatchConnection:i}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:a,v4UnpatchConnectionPool:o}=this._getV4ConnectionPoolPatches();return[new J(`mongodb`,[`>=3.3.0 <4`],void 0,void 0,[new CR(`mongodb/lib/core/wireprotocol/index.js`,[`>=3.3.0 <4`],e,t)]),new J(`mongodb`,[`>=4.0.0 <8`],void 0,void 0,[new CR(`mongodb/lib/cmap/connection.js`,[`>=4.0.0 <6.4`],n,i),new CR(`mongodb/lib/cmap/connection.js`,[`>=6.4.0 <8`],r,i),new CR(`mongodb/lib/cmap/connection_pool.js`,[`>=4.0.0 <6.4`],a,o)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>(K(e.insert)&&this._unwrap(e,`insert`),this._wrap(e,`insert`,Hz(`insert`)),K(e.remove)&&this._unwrap(e,`remove`),this._wrap(e,`remove`,Hz(`remove`)),K(e.update)&&this._unwrap(e,`update`),this._wrap(e,`update`,Hz(`update`)),K(e.command)&&this._unwrap(e,`command`),this._wrap(e,`command`,Uz()),K(e.query)&&this._unwrap(e,`query`),this._wrap(e,`query`,Kz()),K(e.getMore)&&this._unwrap(e,`getMore`),this._wrap(e,`getMore`,qz()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,`insert`),this._unwrap(e,`remove`),this._unwrap(e,`update`),this._unwrap(e,`command`),this._unwrap(e,`query`),this._unwrap(e,`getMore`))}}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let t=e.ConnectionPool.prototype;return K(t.checkOut)&&this._unwrap(t,`checkOut`),this._wrap(t,`checkOut`,Jz()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,`checkOut`)}}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>(K(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,Wz()),e),v4PatchConnectionPromise:e=>(K(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,Gz()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,`command`)}}}},Zz=`Mongo`,Qz=Y(Zz,()=>new Xz),$z=W((()=>({name:Zz,setupOnce(){Qz()}})));function eB(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
|
|
31
|
+
Mongoose Error Code: ${t.code}`:``}`})}function tB(e,t){return e instanceof Promise?e.catch(e=>{throw eB(t,e),e}).finally(()=>t.end()):(t.end(),e)}function nB(e,t,n,r,i){let a=0;return i.length===2?a=1:i.length===3&&(a=2),i[a]=(t,n)=>(t&&eB(r,t),r.end(),e(t,n)),t.apply(n,i)}var rB=`@sentry/instrumentation-mongoose`,iB=`auto.db.otel.mongoose`,aB=[`deleteOne`,`deleteMany`,`find`,`findOne`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`],oB=[`remove`,`count`,`findOneAndRemove`,...aB],sB=[`count`,`findOneAndRemove`,...aB],cB=[...aB];function lB(e){return e?e.startsWith(`6.`)||e.startsWith(`5.`)?oB:e.startsWith(`7.`)?sB:cB:aB}function uB(e){return e&&(e.startsWith(`5.`)||e.startsWith(`6.`))||!1}function dB(e){return!e||!e.startsWith(`8.`)?!1:parseInt(e.split(`.`)[1],10)>=21}var fB=Symbol(`stored-parent-span`),pB=Symbol(`already-instrumented`),mB=class extends q{constructor(e={}){super(rB,k,e)}init(){return new J(`mongoose`,[`>=5.9.7 <9.7.0`],this.patch.bind(this),this.unpatch.bind(this))}patch(e,t){let n=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e;return this._wrap(n.Model.prototype,`save`,this.patchOnModelMethods(`save`)),n.Model.prototype.$save=n.Model.prototype.save,uB(t)&&this._wrap(n.Model.prototype,`remove`,this.patchOnModelMethods(`remove`)),dB(t)&&(this._wrap(n.Model.prototype,`updateOne`,this._patchDocumentUpdateMethods(`updateOne`)),this._wrap(n.Model.prototype,`deleteOne`,this._patchDocumentUpdateMethods(`deleteOne`))),this._wrap(n.Query.prototype,`exec`,this.patchQueryExec()),this._wrap(n.Aggregate.prototype,`exec`,this.patchAggregateExec()),lB(t).forEach(e=>{this._wrap(n.Query.prototype,e,this.patchAndCaptureSpanContext(e))}),this._wrap(n.Model,`aggregate`,this.patchModelAggregate()),this._wrap(n.Model,`insertMany`,this.patchModelStatic(`insertMany`)),this._wrap(n.Model,`bulkWrite`,this.patchModelStatic(`bulkWrite`)),n}unpatch(e,t){let n=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e,r=lB(t);this._unwrap(n.Model.prototype,`save`),n.Model.prototype.$save=n.Model.prototype.save,uB(t)&&this._unwrap(n.Model.prototype,`remove`),dB(t)&&(this._unwrap(n.Model.prototype,`updateOne`),this._unwrap(n.Model.prototype,`deleteOne`)),this._unwrap(n.Query.prototype,`exec`),this._unwrap(n.Aggregate.prototype,`exec`),r.forEach(e=>{this._unwrap(n.Query.prototype,e)}),this._unwrap(n.Model,`aggregate`),this._unwrap(n.Model,`insertMany`),this._unwrap(n.Model,`bulkWrite`)}patchAggregateExec(){let e=this;return t=>function(n){let r=this[fB],i=gR({collection:this._model.collection,modelName:this._model?.modelName,operation:`aggregate`,origin:iB,parentSpan:r});return e._handleResponse(i,t,this,arguments,n)}}patchQueryExec(){let e=this;return t=>function(n){if(this[pB])return t.apply(this,arguments);let r=this[fB],i=gR({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:iB,parentSpan:r});return e._handleResponse(i,t,this,arguments,n)}}patchOnModelMethods(e){let t=this;return n=>function(r,i){let a=gR({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:e,origin:iB});return r instanceof Function&&(i=r),t._handleResponse(a,n,this,arguments,i)}}_patchDocumentUpdateMethods(e){let t=this;return n=>function(r,i,a){let o=a;typeof r==`function`?o=r:typeof i==`function`&&(o=i);let s=gR({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:e,origin:iB}),c=t._handleResponse(s,n,this,arguments,o);return c&&typeof c==`object`&&(c[pB]=!0),c}}patchModelStatic(e){let t=this;return n=>function(r,i,a){typeof i==`function`&&(a=i);let o=gR({collection:this.collection,modelName:this.modelName,operation:e,origin:iB});return t._handleResponse(o,n,this,arguments,a)}}patchModelAggregate(){return e=>function(){let t=R(),n=e.apply(this,arguments);return n&&(n[fB]=t),n}}patchAndCaptureSpanContext(e){return e=>function(){return this[fB]=R(),e.apply(this,arguments)}}_handleResponse(e,t,n,r,i){return V(e,()=>i instanceof Function?nB(i,t,n,e,r):tB(t.apply(n,r),e))}},hB=`Mongoose`,gB=Y(hB,()=>new mB),_B=W((()=>Ed(uF(),{name:hB,setupOnce(){gB()}}))),vB=`db.connection_string`,yB=`mysql`;function bB(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function xB(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}function SB(e){return typeof e==`string`?e:e.sql}function CB(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}var wB=`@sentry/instrumentation-mysql`,TB=`auto.db.otel.mysql`,EB=class extends q{constructor(e={}){super(wB,k,e)}init(){return[new J(`mysql`,[`>=2.0.0 <3`],e=>(K(e.createConnection)&&this._unwrap(e,`createConnection`),this._wrap(e,`createConnection`,this._patchCreateConnection()),K(e.createPool)&&this._unwrap(e,`createPool`),this._wrap(e,`createPool`,this._patchCreatePool()),K(e.createPoolCluster)&&this._unwrap(e,`createPoolCluster`),this._wrap(e,`createPoolCluster`,this._patchCreatePoolCluster()),e),e=>{e!==void 0&&(this._unwrap(e,`createConnection`),this._unwrap(e,`createPool`),this._unwrap(e,`createPoolCluster`))})]}_patchCreateConnection(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`query`,t._patchQuery(r)),r}}}_patchCreatePool(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`query`,t._patchQuery(r)),t._wrap(r,`getConnection`,t._patchGetConnection(r)),r}}}_patchCreatePoolCluster(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`getConnection`,t._patchGetConnection(r)),r}}}_patchGetConnection(e){return t=>{let n=this;return function(r,i,a){if(!n._enabled)return n._unwrap(e,`getConnection`),t.apply(e,arguments);if(arguments.length===1&&typeof r==`function`){let i=n._getConnectionCallbackPatchFn(r);return t.call(e,i)}if(arguments.length===2&&typeof i==`function`){let a=n._getConnectionCallbackPatchFn(i);return t.call(e,r,a)}if(arguments.length===3&&typeof a==`function`){let o=n._getConnectionCallbackPatchFn(a);return t.call(e,r,i,o)}return t.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let t=this,n=M();return function(r,i){i&&(K(i.query)||t._wrap(i,`query`,t._patchQuery(i))),typeof e==`function`&&bi(n,()=>e.call(this,r,i))}}_patchQuery(e){return t=>{let n=this;return function(r,i,a){if(!n._enabled)return n._unwrap(e,`query`),t.apply(e,arguments);let{host:o,port:s,database:c,user:l}=bB(e.config),u=parseInt(String(s),10),d={[I]:TB,[Pc]:yB,[vB]:xB(o,s,c),[Dc]:c,[Ic]:l,[Nc]:SB(r),[Gl]:o};isNaN(u)||(d[Kl]=u);let f=B({name:CB(r),kind:G.CLIENT,attributes:d}),p=Array.from(arguments).findIndex(e=>typeof e==`function`),m=M();if(p===-1){let n=V(f,()=>t.apply(e,arguments));return As(n,m),n.on(`error`,e=>{f.setStatus({code:2,message:e.message})}).on(`end`,()=>{f.end()})}return n._wrap(arguments,p,n._patchCallbackQuery(f,m)),V(f,()=>t.apply(e,arguments))}}}_patchCallbackQuery(e,t){return n=>function(r,i,a){return r&&e.setStatus({code:2,message:r.message}),e.end(),bi(t,()=>n(...arguments))}}},DB=`Mysql`,OB=Y(DB,()=>new EB({})),kB=W((()=>({name:DB,setupOnce(){OB()}}))),AB=`db.connection_string`,jB=`mysql`;function MB(e){let{host:t,port:n,database:r,user:i}=NB(e),a={[AB]:PB(t,n,r),[Dc]:r,[Ic]:i,[Gl]:t},o=parseInt(n,10);return isNaN(o)||(a[Kl]=o),a}function NB(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function PB(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}function FB(e,t,n){let[r,i]=typeof e==`string`?[e,n]:[e.sql,IB(e)?n||e.values:n];try{return t&&i?t(r,i):r}catch{return`Could not determine the query due to an error in formatting`}}function IB(e){return`values`in e}function LB(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}var RB=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function zB(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query==`function`&&typeof n?.execute==`function`?n:t}var BB=`@sentry/instrumentation-mysql2`,VB=`auto.db.otel.mysql2`,HB=[`>=1.4.2 <3.20.0`],UB=class extends q{constructor(e={}){super(BB,k,e)}init(){let e;function t(t){!e&&t.format&&(e=t.format)}let n=t=>{K(t.query)&&this._unwrap(t,`query`),this._wrap(t,`query`,this._patchQuery(e)),K(t.execute)&&this._unwrap(t,`execute`),this._wrap(t,`execute`,this._patchQuery(e))},r=e=>{this._unwrap(e,`query`),this._unwrap(e,`execute`)};return[new J(`mysql2`,HB,e=>(t(e),e),()=>{},[new CR(`mysql2/promise.js`,HB,e=>(t(e),e),()=>{}),new CR(`mysql2/lib/connection.js`,HB,e=>{let t=zB(e);return n(t),e},e=>{if(e===void 0)return;let t=zB(e);r(t)})])]}_patchQuery(e){let t=this;return n=>function(r,i,a){let o;Array.isArray(i)?o=i:arguments[2]&&(o=[i]);let s={...MB(this.config),[Pc]:jB,[Nc]:FB(r,e,o),[I]:VB},c=B({name:LB(r),kind:G.CLIENT,attributes:s}),l=RB(e=>{e&&c.setStatus({code:2,message:e.message}),c.end()});if(arguments.length===1){typeof r.onResult==`function`&&t._wrap(r,`onResult`,t._patchCallbackQuery(l));let e=n.apply(this,arguments);return e.once(`error`,e=>{l(e)}).once(`result`,()=>{l()}),e}return typeof arguments[1]==`function`?t._wrap(arguments,1,t._patchCallbackQuery(l)):typeof arguments[2]==`function`&&t._wrap(arguments,2,t._patchCallbackQuery(l)),n.apply(this,arguments)}}_patchCallbackQuery(e){return t=>function(...n){return e(n[0]),t(...n)}}},WB=`Mysql2`,GB=Y(WB,()=>new UB),KB=W((()=>Ed(BF(),{name:WB,setupOnce(){GB()}}))),qB,JB;function YB(e){qB=e}function XB(){return!!qB}function ZB(){if(qB)return JB??=qB()}var QB=[`get`,`set`,`setex`],$B=[`get`,`mget`],eV=[`set`,`setex`],tV=[`del`,`unlink`];function nV(e,t){return e.includes(t.toLowerCase())}function rV(e){if(nV($B,e))return`cache.get`;if(nV(eV,e))return`cache.put`;if(nV(tV,e))return`cache.remove`}function iV(e,t){return t.some(t=>e.startsWith(t))}function aV(e,t){try{if(t.length===0)return;let n=e=>typeof e==`string`||typeof e==`number`||Buffer.isBuffer(e)?[e.toString()]:Array.isArray(e)?cV(e.map(e=>n(e))):[`<unknown>`],r=t[0];return nV(QB,e)&&r!=null?n(r):cV(t.map(e=>n(e)))}catch{return}}function oV(e,t,n){if(!rV(e))return!1;for(let e of t)if(iV(e,n))return!0;return!1}function sV(e){let t=e=>{try{return Buffer.isBuffer(e)?e.byteLength:typeof e==`string`?e.length:typeof e==`number`?e.toString().length:e==null?0:JSON.stringify(e).length}catch{return}};return Array.isArray(e)?e.reduce((e,n)=>{let r=t(n);return typeof r==`number`?e===void 0?r:e+r:e},0):t(e)}function cV(e){let t=[],n=e=>{e.forEach(e=>{Array.isArray(e)?n(e):t.push(e)})};return n(e),t}var lV={};function uV(e){lV=e}var dV=(e,t,n,r)=>{let i=aV(t,n),a=rV(t);if(!i||!a||!lV.cachePrefixes||!oV(t,i,lV.cachePrefixes))return;let o=L(e).data,s=o[`net.peer.name`]??o[`server.address`],c=o[`net.peer.port`]??o[`server.port`];c&&s&&e.setAttributes({"network.peer.address":s,"network.peer.port":c});let l=nV(tV,t)?void 0:sV(r);l&&e.setAttribute(zi,l),nV($B,t)&&l!==void 0&&e.setAttribute(Li,l>0),e.setAttributes({[F]:a,[Ri]:i});let u=i.join(`, `);e.updateName(lV.maxCacheKeyLength?hr(u,lV.maxCacheKeyLength):u)},fV=`db.connection_string`,pV=`redis`,mV=`@sentry/instrumentation-ioredis`,hV=`auto.db.otel.redis`,gV=[`>=2.0.0 <5.11.0`];function _V(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var vV=class extends q{constructor(e={}){super(mV,k,e)}init(){return[new J(`ioredis`,gV,e=>{let t=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e;return K(t.prototype.sendCommand)&&this._unwrap(t.prototype,`sendCommand`),this._wrap(t.prototype,`sendCommand`,this._patchSendCommand()),K(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`connect`,this._patchConnection()),e},e=>{if(e===void 0)return;let t=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e;this._unwrap(t.prototype,`sendCommand`),this._unwrap(t.prototype,`connect`)})]}_patchSendCommand(){let e=this;return t=>function(...n){let r=n[0];if(n.length<1||typeof r!=`object`||!R())return t.apply(this,n);let{host:i,port:a}=this.options,o={[Pc]:pV,[Nc]:wI(r.name,r.args),[fV]:`redis://${i}:${a}`,[Gl]:i,[Kl]:a,[I]:hV},s=B({name:r.name,kind:G.CLIENT,attributes:o});try{let i=t.apply(this,n),a=r.resolve;r.resolve=function(t){e._callResponseHook(s,r,t),_V(s,null),a(t)};let o=r.reject;return r.reject=function(e){_V(s,e),o(e)},i}catch(e){throw _V(s,e),e}}}_patchConnection(){return e=>function(...t){if(!R())return e.apply(this,t);let{host:n,port:r}=this.options,i={[Pc]:pV,[Nc]:`connect`,[fV]:`redis://${n}:${r}`,[Gl]:n,[Kl]:r,[I]:hV},a=B({name:`connect`,kind:G.CLIENT,attributes:i});try{let n=e.apply(this,t);return n instanceof Promise?n.then(e=>(_V(a,null),e),e=>(_V(a,e),Promise.reject(e))):(_V(a,null),n)}catch(e){throw _V(a,e),e}}}_callResponseHook(e,t,n){let{responseHook:r}=this.getConfig();if(r)try{r(e,t.name,t.args,n)}catch{}}},yV=`@sentry/instrumentation-redis`,bV=`auto.db.otel.redis`,xV=Symbol(`opentelemetry.instrumentation.redis.open_spans`),SV=Symbol(`opentelemetry.instrumentation.redis.multi_command_options`);function CV(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function wV(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function TV(e){if(typeof e==`string`&&e)try{let t=new URL(e);return t.searchParams.delete(`user_pwd`),t.username=``,t.password=``,t.href}catch(e){GN&&A.error(`failed to sanitize redis connection url`,e)}}function EV(e){return{[Pc]:pV,[Gl]:e?.socket?.host,[Kl]:e?.socket?.port,[fV]:TV(e?.url),[I]:bV}}var DV=class e extends q{constructor(e={}){super(yV,k,e)}init(){return[new J(`redis`,[`>=2.6.0 <4`],e=>(K(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,`internal_send_command`),this._wrap(e.RedisClient.prototype,`internal_send_command`,this._getPatchInternalSendCommand()),e),e=>{e!==void 0&&this._unwrap(e.RedisClient.prototype,`internal_send_command`)})]}_getPatchInternalSendCommand(){let t=this;return function(n){return function(r){if(arguments.length!==1||typeof r!=`object`)return n.apply(this,arguments);let i={[Pc]:pV,[Nc]:wI(r.command,r.args),[I]:bV};this.connection_options&&(i[Gl]=this.connection_options.host,i[Kl]=this.connection_options.port),this.address&&(i[fV]=`redis://${this.address}`);let a=B({name:`${e.COMPONENT}-${r.command}`,kind:G.CLIENT,attributes:i}),o=arguments[0].callback;if(o){let e=R();arguments[0].callback=function(n,i){return wV(t.getConfig().responseHook,a,r.command,r.args,i),CV(a,n),V(e??null,()=>o.apply(this,arguments))}}try{return n.apply(this,arguments)}catch(e){throw CV(a,e),e}}}}};DV.COMPONENT=`redis`;var OV=DV,kV=class e extends q{constructor(e={}){super(yV,k,e)}init(){return[this._getInstrumentationNodeModuleDefinition(`@redis/client`),this._getInstrumentationNodeModuleDefinition(`@node-redis/client`)]}_getInstrumentationNodeModuleDefinition(e){return new J(e,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>e,()=>{},[new CR(`${e}/dist/lib/commander.js`,[`^1.0.0`],(e,t)=>{let n=e.transformCommandArguments;if(!n)return GN&&A.error(`internal instrumentation error, missing transformCommandArguments function`),e;let r=t?.startsWith(`1.0.`)?`extendWithCommands`:`attachCommands`;return K(e?.[r])&&this._unwrap(e,r),this._wrap(e,r,this._getPatchExtendWithCommands(n)),e},e=>{K(e?.extendWithCommands)&&this._unwrap(e,`extendWithCommands`),K(e?.attachCommands)&&this._unwrap(e,`attachCommands`)}),new CR(`${e}/dist/lib/client/multi-command.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>{let t=e?.default?.prototype;return K(t?.exec)&&this._unwrap(t,`exec`),this._wrap(t,`exec`,this._getPatchMultiCommandsExec()),K(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),this._wrap(t,`execAsPipeline`,this._getPatchMultiCommandsExec()),K(t?.addCommand)&&this._unwrap(t,`addCommand`),this._wrap(t,`addCommand`,this._getPatchMultiCommandsAddCommand()),e},e=>{let t=e?.default?.prototype;K(t?.exec)&&this._unwrap(t,`exec`),K(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),K(t?.addCommand)&&this._unwrap(t,`addCommand`)}),new CR(`${e}/dist/lib/client/index.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>{let t=e?.default?.prototype;return t?.multi&&(K(t?.multi)&&this._unwrap(t,`multi`),this._wrap(t,`multi`,this._getPatchRedisClientMulti())),t?.MULTI&&(K(t?.MULTI)&&this._unwrap(t,`MULTI`),this._wrap(t,`MULTI`,this._getPatchRedisClientMulti())),K(t?.sendCommand)&&this._unwrap(t,`sendCommand`),this._wrap(t,`sendCommand`,this._getPatchRedisClientSendCommand()),K(t?.connect)&&this._unwrap(t,`connect`),this._wrap(t,`connect`,this._getPatchedClientConnect()),e},e=>{let t=e?.default?.prototype;K(t?.multi)&&this._unwrap(t,`multi`),K(t?.MULTI)&&this._unwrap(t,`MULTI`),K(t?.sendCommand)&&this._unwrap(t,`sendCommand`),K(t?.connect)&&this._unwrap(t,`connect`)})])}_getPatchExtendWithCommands(e){let t=this;return function(n){return function(r){if(r?.BaseClass?.name!==`RedisClient`)return n.apply(this,arguments);let i=r.executor;return r.executor=function(n,r){let a=e(n,r).args;return t._traceClientCommand(i,this,arguments,a)},n.apply(this,arguments)}}}_getPatchMultiCommandsExec(){let e=this;return function(t){return function(){let n=t.apply(this,arguments);return typeof n?.then==`function`?n.then(t=>{let n=this[xV];return e._endSpansWithRedisReplies(n,t),t}).catch(t=>{let n=this[xV];if(!n)GN&&A.error(`cannot find open spans to end for multi/pipeline`);else{let r=t.constructor.name===`MultiErrorReply`?t.replies:Array(n.length).fill(t);e._endSpansWithRedisReplies(n,r)}return Promise.reject(t)}):(GN&&A.error(`non-promise result when patching exec/execAsPipeline`),n)}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(t){return function(n){return e._traceClientCommand(t,this,arguments,n)}}}_getPatchRedisClientMulti(){return function(e){return function(){let t=e.apply(this,arguments);return t[SV]=this.options,t}}}_getPatchRedisClientSendCommand(){let e=this;return function(t){return function(n){return e._traceClientCommand(t,this,arguments,n)}}}_getPatchedClientConnect(){return function(t){return function(){let n=EV(this.options),r=B({name:`${e.COMPONENT}-connect`,kind:G.CLIENT,attributes:n});return V(r,()=>t.apply(this)).then(e=>(r.end(),e),e=>(CV(r,e),Promise.reject(e)))}}}_traceClientCommand(t,n,r,i){let a=n.options||n[SV],o=i[0],s=i.slice(1),c=EV(a),l=wI(o,s);l!=null&&(c[Nc]=l);let u=B({name:`${e.COMPONENT}-${o}`,kind:G.CLIENT,attributes:c}),d=V(u,()=>t.apply(n,r));if(d instanceof Promise)d.then(e=>{this._endSpanWithResponse(u,o,s,e,void 0)},e=>{this._endSpanWithResponse(u,o,s,null,e)});else{let e=d;e[xV]=e[xV]||[],e[xV].push({span:u,commandName:o,commandArgs:s})}return d}_endSpansWithRedisReplies(e,t){if(!e){GN&&A.error(`cannot find open spans to end for redis multi/pipeline`);return}if(t.length!==e.length){GN&&A.error(`number of multi command spans does not match response from redis`);return}for(let n=0;n<e.length;n++){let{span:r,commandName:i,commandArgs:a}=e[n],o=t[n],[s,c]=o instanceof Error?[null,o]:[o,void 0];this._endSpanWithResponse(r,i,a,s,c)}}_endSpanWithResponse(e,t,n,r,i){i||wV(this.getConfig().responseHook,e,t,n,r),CV(e,i)}};kV.COMPONENT=`redis`;var AV=kV,jV=class extends q{constructor(e={}){super(yV,k,e),this.initialized=!1,this.instrumentationV2_V3=new OV(this.getConfig()),this.instrumentationV4_V5=new AV(this.getConfig()),this.initialized=!0}setConfig(e={}){super.setConfig(e),this.initialized&&(this.instrumentationV2_V3.setConfig(e),this.instrumentationV4_V5.setConfig(e))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(e){super.setTracerProvider(e),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(e),this.instrumentationV4_V5.setTracerProvider(e))}enable(){super.enable(),this.initialized&&(this.instrumentationV2_V3.enable(),this.instrumentationV4_V5.enable())}disable(){super.disable(),this.initialized&&(this.instrumentationV2_V3.disable(),this.instrumentationV4_V5.disable())}},MV=`Redis`,NV=Y(`${MV}.IORedis`,()=>new vV({responseHook:dV})),PV=Y(`${MV}.Redis`,()=>new jV({responseHook:dV})),FV=Object.assign(()=>{(!XB()||!w.tracingChannel)&&(NV(),PV())},{id:MV}),IV=W(((e={})=>Ed(SI({responseHook:dV}),{name:MV,setupOnce(){uV(e),FV()}}))),LV=(e=>(e.QUERY_PREFIX=`pg.query`,e.CONNECT=`pg.connect`,e.POOL_CONNECT=`pg-pool.connect`,e))(LV||{}),RV=(e=>(e.PG_PLAN=`db.postgresql.plan`,e.IDLE_TIMEOUT_MILLIS=`db.postgresql.idle.timeout.millis`,e.MAX_CLIENT=`db.postgresql.max.client`,e))(RV||{}),zV=`db.connection_string`,BV=`postgresql`,VV=`auto.db.otel.postgres`;function HV(e,t){if(!t)return LV.QUERY_PREFIX;let n=typeof t.name==`string`&&t.name?t.name:UV(t.text);return`${LV.QUERY_PREFIX}:${n}${e?` ${e}`:``}`}function UV(e){let t=e.trim(),n=t.indexOf(` `),r=n===-1?t:t.slice(0,n);return r=r.toUpperCase(),r.endsWith(`;`)?r.slice(0,-1):r}function WV(e){try{let t=new URL(e);return t.username=``,t.password=``,t.toString()}catch{return`postgresql://localhost:5432/`}}function GV(e){return`connectionString`in e&&e.connectionString?WV(e.connectionString):`postgresql://${e.host||`localhost`}:${e.port||5432}/${e.database||``}`}function KV(e){if(Number.isInteger(e))return e}function qV(e){return{[Pc]:BV,[Dc]:e.database,[zV]:GV(e),[Ic]:e.user,[Gl]:e.host,[Kl]:KV(e.port)}}function JV(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[RV.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[RV.MAX_CLIENT]:e.maxClient,[Pc]:BV,[Dc]:t?.pathname.slice(1)??e.database,[zV]:GV(e),[Gl]:t?.hostname??e.host,[Kl]:Number(t?.port)||KV(e.port),[Ic]:t?.username??e.user}}function YV(){return R()===void 0}function XV(e){let{connectionParameters:t}=this,n=t.database,r=B({name:HV(n,e),kind:G.CLIENT,attributes:{...qV(t),[I]:VV}});return e?(e.text&&r.setAttribute(Nc,e.text),typeof e.name==`string`&&r.setAttribute(RV.PG_PLAN,e.name),r):r}function ZV(e,t){return function(n,r){n&&e.setStatus({code:2,message:n.message}),e.end(),t.call(this,n,r)}}function QV(e,t){return function(n,r,i){n&&e.setStatus({code:2,message:n.message}),e.end(),t.call(this,n,r,i)}}function $V(e,t){return function(...n){let r=n[0];r instanceof Error&&e.setStatus({code:2,message:r.message}),e.end(),t.apply(this,n)}}function eH(e){return typeof e==`object`&&e&&`message`in e?String(e.message):void 0}function tH(e){return typeof e==`object`&&typeof e?.text==`string`}var nH=`@sentry/instrumentation-pg`;function rH(e){return e[Symbol.toStringTag]===`Module`?e.default:e}function iH(e,t){return function(...n){return V(e,()=>t.apply(this,n))}}var aH=class extends q{constructor(e={}){super(nH,k,e)}init(){let e=[`>=8.0.3 <9`],t=[`>=2.0.0 <4`],n=new CR(`pg/lib/native/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this));return[new J(`pg`,e,e=>{let t=rH(e);return this._patchPgClient(t.Client),e},e=>{let t=rH(e);return this._unpatchPgClient(t.Client),e},[new CR(`pg/lib/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),n]),new J(`pg-pool`,t,e=>{let t=rH(e);return K(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`connect`,this._getPoolConnectPatch()),t},e=>{let t=rH(e);K(t.prototype.connect)&&this._unwrap(t.prototype,`connect`)})]}_patchPgClient(e){if(!e)return;let t=rH(e);return K(t.prototype.query)&&this._unwrap(t.prototype,`query`),K(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`query`,this._getClientQueryPatch()),this._wrap(t.prototype,`connect`,this._getClientConnectPatch()),e}_unpatchPgClient(e){let t=rH(e);return K(t.prototype.query)&&this._unwrap(t.prototype,`query`),K(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),e}_getClientConnectPatch(){let e=this;return t=>function(n){if(YV()||e.getConfig().ignoreConnectSpans)return t.call(this,n);let r=B({name:LV.CONNECT,kind:G.CLIENT,attributes:qV(this)}),i=n;if(i){let e=R();i=$V(r,i),e&&(i=iH(e,i))}return oH(r,V(r,()=>t.call(this,i)))}}_getClientQueryPatch(){return e=>(this._diag.debug(`Patching pg.Client.prototype.query`),function(...t){if(YV())return e.apply(this,t);let n=t[0],r=typeof n==`string`,i=tH(n),a=r?{text:n,values:Array.isArray(t[1])?t[1]:void 0}:i?{...n,name:n.name,text:n.text,values:n.values??(Array.isArray(t[1])?t[1]:void 0)}:void 0,o=XV.call(this,a);if(t.length>0){let e=R();if(typeof t[t.length-1]==`function`)t[t.length-1]=ZV(o,t[t.length-1]),e&&(t[t.length-1]=iH(e,t[t.length-1]));else if(typeof a?.callback==`function`){let n=ZV(o,a.callback);e&&(n=iH(e,n)),t[0].callback=n}}let s;try{s=e.apply(this,t)}catch(e){throw o.setStatus({code:2,message:eH(e)}),o.end(),e}return s instanceof Promise?s.then(e=>(o.end(),e)).catch(e=>(o.setStatus({code:2,message:eH(e)}),o.end(),Promise.reject(e))):s})}_getPoolConnectPatch(){let e=this;return t=>function(n){if(YV()||e.getConfig().ignoreConnectSpans)return t.call(this,n);let r=B({name:LV.POOL_CONNECT,kind:G.CLIENT,attributes:JV(this.options)}),i=n;if(i){let e=R();i=QV(r,i),e&&(i=iH(e,i))}return oH(r,V(r,()=>t.call(this,i)))}}};function oH(e,t){return t instanceof Promise?t.then(t=>(e.end(),t)).catch(t=>(e.setStatus({code:2,message:eH(t)}),e.end(),Promise.reject(t))):t}var sH=`Postgres`,cH=Y(sH,aH,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),lH=W((e=>({name:sH,setupOnce(){cH(e)}})));b();var uH=`PostgresJs`,dH=[`>=3.0.0 <4`],fH=`db.response.status_code`,pH=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,mH=Symbol.for(`sentry.query.from.instrumented.sql`),hH=Y(uH,e=>new gH({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),gH=class extends q{constructor(e){super(`sentry-postgres-js`,k,e)}init(){let e=new J(`postgres`,dH,e=>{try{return this._patchPostgres(e)}catch(t){return GN&&A.error(`Failed to patch postgres module:`,t),e}},e=>e);return[`src`,`cf/src`,`cjs/src`].forEach(t=>{e.files.push(new CR(`postgres/${t}/query.js`,dH,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let t=typeof e==`function`,n=t?e:e.default;if(typeof n!=`function`)return GN&&A.warn(`postgres module does not export a function. Skipping instrumentation.`),e;let r=this,i=function(...e){let t=Reflect.construct(n,e);if(!t||typeof t!=`function`)return GN&&A.warn(`postgres() did not return a valid instance`),t;let i=r.getConfig();return ZC(t,{requireParentSpan:i.requireParentSpan,requestHook:i.requestHook})};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let e of Object.getOwnPropertyNames(n))if(![`length`,`name`,`prototype`].includes(e)){let t=Object.getOwnPropertyDescriptor(n,e);t&&Object.defineProperty(i,e,t)}return t?i:(cx(e,`default`,i),e)}_shouldCreateSpans(){let e=this.getConfig();return g.getSpan(r.active())!==void 0||!e.requireParentSpan}_setOperationName(e,t,n){if(n){e.setAttribute(jc,n);return}let r=t?.match(pH);r?.[1]&&e.setAttribute(jc,r[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((e,t,n)=>n===0?t:`${e}$${n}${t}`,``)}_sanitizeSqlQuery(e){return e?e.replace(/--.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``).replace(/;\s*$/,``).replace(/\s+/g,` `).trim().replace(/\bX'[0-9A-Fa-f]*'/gi,`?`).replace(/\bB'[01]*'/gi,`?`).replace(/'(?:[^']|'')*'/g,`?`).replace(/\b0x[0-9A-Fa-f]+/gi,`?`).replace(/\b(?:TRUE|FALSE)\b/gi,`?`).replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,`?`).replace(/-?\b\d+\.\d+\b/g,`?`).replace(/-?\.\d+\b/g,`?`).replace(/(?<!\$)-?\b\d+\b/g,`?`).replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,`IN (?)`).replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,`IN ($?)`):`Unknown SQL Query`}_patchQueryPrototype(e){let t=this,n=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...e){if(this.executed||this[mH]||!t._shouldCreateSpans())return n.apply(this,e);let r=t._reconstructQuery(this.strings),i=t._sanitizeSqlQuery(r);return ts({name:i||`postgresjs.query`,op:`db`},r=>{sN(r,`auto.db.postgresjs`),r.setAttributes({[Fc]:`postgres`,[Mc]:i});let{requestHook:a}=t.getConfig();a&&SE(()=>a(r,i,void 0),e=>{e&&(r.setAttribute(`sentry.hook.error`,`requestHook failed`),GN&&A.error(`Error in requestHook for ${uH} integration:`,e))},!0);let o=this.resolve;this.resolve=new Proxy(o,{apply:(e,n,a)=>{try{t._setOperationName(r,i,a?.[0]?.command),r.end()}catch(e){GN&&A.error(`Error ending span in resolve callback:`,e)}return Reflect.apply(e,n,a)}});let s=this.reject;this.reject=new Proxy(s,{apply:(e,n,a)=>{try{r.setStatus({code:2,message:a?.[0]?.message||`unknown_error`}),r.setAttribute(fH,a?.[0]?.code||`unknown`),r.setAttribute(Lc,a?.[0]?.name||`unknown`),t._setOperationName(r,i),r.end()}catch(e){GN&&A.error(`Error ending span in reject callback:`,e)}return Reflect.apply(e,n,a)}});try{return n.apply(this,e)}catch(e){throw r.setStatus({code:2,message:e instanceof Error?e.message:`unknown_error`}),r.end(),e}})},e.Query.prototype.handle.__sentry_original__=n,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},_H=W((e=>({name:uH,setupOnce(){hH(e)}}))),vH=(e=>(e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`,e))(vH||{}),yH=`@hapi/hapi`,bH=Symbol(`hapi-handler-patched`),xH={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},SH=new Set([`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`]);function CH(e){return e.name?e.name:e.pkg.name}var wH=e=>typeof e==`string`&&SH.has(e),TH=e=>{let t=e?.type;return t!==void 0&&wH(t)},EH=e=>Array.isArray(e)&&e.length<=3&&wH(e[0])&&typeof e[1]==`function`,DH=e=>!Array.isArray(e),OH=(e,t)=>{let n={[Sl]:e.path,[yl]:e.method},r;return t?(n[vH.HAPI_TYPE]=xH.PLUGIN,n[vH.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[vH.HAPI_TYPE]=xH.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},kH=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[vH.EXT_TYPE]:e,[vH.HAPI_TYPE]:xH.EXT,[vH.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[vH.EXT_TYPE]:e,[vH.HAPI_TYPE]:xH.EXT},name:r}},AH=e=>`plugin`in e?`plugin`in e.plugin?e.plugin.plugin:e.plugin:e;b();var jH=`@sentry/instrumentation-hapi`,MH=class extends q{constructor(e={}){super(jH,k,e)}init(){return new J(yH,[`>=17.0.0 <22`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return K(t.server)||this._wrap(t,`server`,this._getServerPatch.bind(this)),K(t.Server)||this._wrap(t,`Server`,this._getServerPatch.bind(this)),t},e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;this._massUnwrap([t],[`server`,`Server`])})}_getServerPatch(e){let t=this,n=this;return function(r){let i=e.apply(this,[r]);return n._wrap(i,`route`,e=>t._getServerRoutePatch.bind(t)(e)),n._wrap(i,`ext`,e=>t._getServerExtPatch.bind(t)(e)),n._wrap(i,`register`,t._getServerRegisterPatch.bind(t)),i}}_getServerRegisterPatch(e){let t=this;return function(n,r){if(Array.isArray(n))for(let e of n){let n=AH(e);t._wrapRegisterHandler(n)}else{let e=AH(n);t._wrapRegisterHandler(e)}return e.apply(this,[n,r])}}_getServerExtPatch(e,t){let n=this;return function(...r){if(Array.isArray(r[0])){let i=r[0];for(let e=0;e<i.length;e++){let r=i[e];if(wH(r.type)){let a=r;a.method=n._wrapExtMethods(a.method,r.type,t),i[e]=a}}return e.apply(this,r)}if(EH(r)){let i=r,a=i[1],o=n._wrapExtMethods(a,i[0],t);return e.apply(this,[i[0],o,i[2]])}if(TH(r[0])){let i=r[0];return i.method=n._wrapExtMethods(i.method,i.type,t),e.call(this,i)}return e.apply(this,r)}}_getServerRoutePatch(e,t){let n=this;return function(r){if(Array.isArray(r))for(let e=0;e<r.length;e++){let i=n._wrapRouteHandler.call(n,r[e],t);r[e]=i}else r=n._wrapRouteHandler.call(n,r,t);return e.apply(this,[r])}}_wrapRegisterHandler(e){let t=this,n=CH(e),r=e.register,i=this;e.register=function(e,a){return i._wrap(e,`route`,e=>t._getServerRoutePatch.bind(t)(e,n)),i._wrap(e,`ext`,e=>t._getServerExtPatch.bind(t)(e,n)),r.call(this,e,a)}}_wrapExtMethods(e,t,n){let i=this;if(e instanceof Array){for(let n=0;n<e.length;n++)e[n]=i._wrapExtMethods(e[n],t);return e}return DH(e)?e[bH]===!0?e:(e[bH]=!0,function(...i){if(g.getSpan(r.active())===void 0)return e.apply(this,i);let a=kH(t,n,e.name);return z({name:a.name,op:`${a.attributes[vH.HAPI_TYPE]}.hapi`,attributes:{...a.attributes,[I]:`auto.http.otel.hapi`}},()=>e.apply(void 0,i))}):e}_wrapRouteHandler(e,t){if(e[bH]===!0)return e;e[bH]=!0;let n=n=>function(...i){if(g.getSpan(r.active())===void 0)return n.call(this,...i);KN(e.path);let a=OH(e,t);return z({name:a.name,op:`${a.attributes[vH.HAPI_TYPE]}.hapi`,attributes:{...a.attributes,[I]:`auto.http.otel.hapi`}},()=>n.call(this,...i))};if(typeof e.handler==`function`)e.handler=n(e.handler);else if(typeof e.options==`function`){let t=e.options;e.options=function(e){let r=t(e);return typeof r.handler==`function`&&(r.handler=n(r.handler)),r}}else typeof e.options?.handler==`function`&&(e.options.handler=n(e.options.handler));return e}},NH=`Hapi`,PH=Y(NH,()=>new MH),FH=W((()=>({name:NH,setupOnce(){PH()}})));function IH(e){return!!(e&&typeof e==`object`&&`error`in e&&e.error)}function LH(e){H(e,{mechanism:{type:`auto.function.hapi`,handled:!1}})}var RH={name:`SentryHapiErrorPlugin`,version:k,register:async function(e){e.events.on({name:`request`,channels:[`error`]},(e,t)=>{if(N()!==$r()){let t=e.route;t.path&&N().setTransactionName(`${t.method.toUpperCase()} ${t.path}`)}else GN&&A.warn(`Isolation scope is still the default isolation scope - skipping setting transactionName`);IH(t)&&LH(t.error)})}};async function zH(e){await e.register(RH),SM(e.register,`hapi`)}var BH={HONO_TYPE:`hono.type`,HONO_NAME:`hono.name`},VH={MIDDLEWARE:`middleware`,REQUEST_HANDLER:`request_handler`};b();var HH=`@sentry/instrumentation-hono`,UH=`0.0.1`,WH=class extends q{constructor(e={}){super(HH,UH,e)}init(){return[new J(`hono`,[`>=4.0.0 <5`],e=>this._patch(e))]}_patch(e){let t=this;class n extends e.Hono{constructor(...e){super(...e),t._wrap(this,`get`,t._patchHandler()),t._wrap(this,`post`,t._patchHandler()),t._wrap(this,`put`,t._patchHandler()),t._wrap(this,`delete`,t._patchHandler()),t._wrap(this,`options`,t._patchHandler()),t._wrap(this,`patch`,t._patchHandler()),t._wrap(this,`all`,t._patchHandler()),t._wrap(this,`on`,t._patchOnHandler()),t._wrap(this,`use`,t._patchMiddlewareHandler())}}try{e.Hono=n}catch{return{...e,Hono:n}}return e}_patchHandler(){let e=this;return function(t){return function(...n){if(typeof n[0]==`string`){let r=n[0];if(n.length===1)return t.apply(this,[r]);let i=n.slice(1);return t.apply(this,[r,...i.map(t=>e._wrapHandler(t))])}return t.apply(this,n.map(t=>e._wrapHandler(t)))}}}_patchOnHandler(){let e=this;return function(t){return function(...n){let r=n.slice(2);return t.apply(this,[...n.slice(0,2),...r.map(t=>e._wrapHandler(t))])}}}_patchMiddlewareHandler(){let e=this;return function(t){return function(...n){if(typeof n[0]==`string`){let r=n[0];if(n.length===1)return t.apply(this,[r]);let i=n.slice(1);return t.apply(this,[r,...i.map(t=>e._wrapHandler(t))])}return t.apply(this,n.map(t=>e._wrapHandler(t)))}}}_wrapHandler(e){let t=this;return function(n,i){if(!t.isEnabled())return e.apply(this,[n,i]);let a=n.req.path,o=t.tracer.startSpan(a);return r.with(g.setSpan(r.active(),o),()=>t._safeExecute(()=>{let r=e.apply(this,[n,i]);if(Bn(r))return r.then(n=>{let r=t._determineHandlerType(n);return o.setAttributes({[BH.HONO_TYPE]:r,[BH.HONO_NAME]:r===VH.REQUEST_HANDLER?a:e.name||`anonymous`}),t.getConfig().responseHook?.(o),n});{let n=t._determineHandlerType(r);return o.setAttributes({[BH.HONO_TYPE]:n,[BH.HONO_NAME]:n===VH.REQUEST_HANDLER?a:e.name||`anonymous`}),t.getConfig().responseHook?.(o),r}},()=>o.end(),e=>{t._handleError(o,e),o.end()}))}}_safeExecute(e,t,n){try{let r=e();return Bn(r)?r.then(()=>t(),e=>n(e)):t(),r}catch(e){throw n(e),e}}_determineHandlerType(e){return e===void 0?VH.MIDDLEWARE:VH.REQUEST_HANDLER}_handleError(e,t){t instanceof Error&&(e.setStatus({code:ee.ERROR,message:t.message}),e.recordException(t))}},GH=`Hono`;function KH(e){let t=L(e).data,n=t[BH.HONO_TYPE];if(t[`sentry.op`]||!n)return;e.setAttributes({[I]:`auto.http.otel.hono`,[F]:`${n}.hono`});let r=t[BH.HONO_NAME];if(typeof r==`string`&&e.updateName(r),N()===$r()){GN&&A.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let i=t[Sl],a=t[bl];typeof i==`string`&&typeof a==`string`&&N().setTransactionName(`${a} ${i}`)}var qH=Y(GH,()=>new WH({responseHook:e=>{KH(e)}})),JH=W((()=>({name:GH,setupOnce(){qH()}})));function YH(){return async function(e,t){let n=Ap(e.req);N().setSDKProcessingMetadata({normalizedRequest:n}),await t()}}function XH(e){return e.res.status>=500}function ZH(e){return async function(t,n){await n(),(e?.shouldHandleError||XH)(t)&&(t.res.sentry=H(t.error,{mechanism:{type:`auto.middleware.hono`,handled:!1}}))}}function QH(e,t){e.use(YH()),e.use(ZH(t)),SM(e.use,`hono`)}var $H=(e=>(e.ROUTER=`router`,e.MIDDLEWARE=`middleware`,e))($H||{}),eU=(e=>(e.KOA_TYPE=`koa.type`,e.KOA_NAME=`koa.name`,e))(eU||{}),tU=(e,t,n,r)=>n?{attributes:{[eU.KOA_NAME]:r?.toString(),[eU.KOA_TYPE]:$H.ROUTER,[Sl]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[eU.KOA_NAME]:t.name??`middleware`,[eU.KOA_TYPE]:$H.MIDDLEWARE,[Tc]:t.name??`middleware`},name:`middleware - ${t.name}`},nU=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e)),rU=Symbol(`koa-layer-patched`);b();var iU=`@sentry/instrumentation-koa`,aU=class extends q{constructor(e={}){super(iU,k,e)}init(){return new J(`koa`,[`>=2.0.0 <4`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return t==null?t:(K(t.prototype.use)&&this._unwrap(t.prototype,`use`),this._wrap(t.prototype,`use`,this._getKoaUsePatch.bind(this)),e)},e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;t&&K(t.prototype.use)&&this._unwrap(t.prototype,`use`)})}_getKoaUsePatch(e){let t=this._patchRouterDispatch.bind(this),n=this._patchLayer.bind(this);return function(r){let i=r.router?t(r):n(r,!1);return e.apply(this,[i])}}_patchRouterDispatch(e){let t=e.router?.stack??[];for(let e of t){let t=e.path,n=e.stack;for(let e=0;e<n.length;e++){let r=n[e];n[e]=this._patchLayer(r,!0,t)}}return e}_patchLayer(e,t,n){let i=t?$H.ROUTER:$H.MIDDLEWARE;return e[rU]===!0||nU(i,this.getConfig())||e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?e:(e[rU]=!0,(a,o)=>{if(g.getSpan(r.active())===void 0)return e(a,o);let s=tU(a,e,t,n);a._matchedRoute&&KN(a._matchedRoute.toString());let c=s.attributes[eU.KOA_NAME];return z({name:typeof c==`string`?c||`< unknown >`:s.name,op:`${i}.koa`,attributes:{...s.attributes,[I]:`auto.http.otel.koa`}},()=>{let t=s.attributes[Sl];if(N()===$r())GN&&A.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);else if(t){let e=a.request?.method?.toUpperCase()||`GET`;N().setTransactionName(`${e} ${t}`)}return e(a,o)})})}},oU=`Koa`,sU=Y(oU,aU,(e={})=>({ignoreLayersType:e.ignoreLayersType})),cU=W(((e={})=>({name:oU,setupOnce(){sU(e)}}))),lU=e=>{e.use(async(e,t)=>{try{await t()}catch(e){throw H(e,{mechanism:{handled:!1,type:`auto.middleware.koa`}}),e}}),SM(e.use,`koa`)},uU=(e=>(e.CONNECT_TYPE=`connect.type`,e.CONNECT_NAME=`connect.name`,e))(uU||{}),dU=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`,e))(dU||{}),fU=Symbol(`opentelemetry.instrumentation-connect.request-route-stack`),pU=e=>{Array.isArray(e[fU])===!1&&Object.defineProperty(e,fU,{enumerable:!1,value:[]}),e[fU].push(`/`);let t=e[fU].length;return()=>{t===e[fU].length?e[fU].pop():GN&&A.warn(`Connect: Trying to pop the stack multiple time`)}},mU=(e,t)=>{t&&e[fU].splice(-1,1,t)},hU=e=>e[fU].reduce((e,t)=>e.replace(/\/+$/,``)+t),gU=`@sentry/instrumentation-connect`,_U=`anonymous`,vU=class extends q{constructor(e={}){super(gU,k,e)}init(){return[new J(`connect`,[`>=3.0.0 <4`],e=>this._patchConstructor(e))]}_patchApp(e){K(e.use)||this._wrap(e,`use`,this._patchUse.bind(this)),K(e.handle)||this._wrap(e,`handle`,this._patchHandle.bind(this))}_patchConstructor(e){let t=this._patchApp.bind(this);return function(...n){let r=Reflect.apply(e,this,n);return t(r),r}}_patchNext(e,t,n){return function(r){jn(r)&&t.setStatus({code:2,message:`internal_error`});let i=e.apply(this,[r]);return n(),i}}_startSpan(e,t){let n=e?dU.REQUEST_HANDLER:dU.MIDDLEWARE,r=e||t.name||_U;return B({name:r,op:`${n}.connect`,attributes:{[I]:`auto.http.otel.connect`,[Sl]:e.length>0?e:`/`,[uU.CONNECT_TYPE]:n,[uU.CONNECT_NAME]:r}})}_patchMiddleware(e,t){let n=this.isEnabled.bind(this),r=this._startSpan.bind(this),i=this._patchNext.bind(this),a=t.length===4;function o(){if(!n())return Reflect.apply(t,this,arguments);let[o,s,c]=a?[1,2,3]:[0,1,2],l=arguments[o],u=arguments[s],d=arguments[c];mU(l,e),e&&KN(hU(l));let f=r(e,t),p=!1;function m(){p||(p=!0,f.end()),u.removeListener(`close`,m)}u.addListener(`close`,m),arguments[c]=i(d,f,m);try{return Reflect.apply(t,this,arguments)}catch(e){throw f.setStatus({code:2,message:`internal_error`}),m(),e}}return Object.defineProperty(o,"length",{value:t.length,writable:!1,configurable:!0}),o}_patchUse(e){let t=this._patchMiddleware.bind(this);return function(...n){let r=n[n.length-1],i=n[n.length-2]||``;return n[n.length-1]=t(i,r),e.apply(this,n)}}_patchHandle(e){let t=this._patchOut.bind(this);return function(){let[n,r]=[0,2],i=arguments[n],a=arguments[r],o=pU(i);return typeof a==`function`&&(arguments[r]=t(a,o)),Reflect.apply(e,this,arguments)}}_patchOut(e,t){return function(...n){return t(),Reflect.apply(e,this,n)}}},yU=`Connect`,bU=Y(yU,()=>new vU),xU=W((()=>({name:yU,setupOnce(){bU()}})));function SU(e,t,n,r){H(e,{mechanism:{handled:!1,type:`auto.middleware.connect`}}),r(e)}var CU=e=>{e.use(SU),SM(e.use,`connect`)},wU=`db.sql.table`,TU=`sqlite`,EU=`postgresql`,DU=e=>{if(e){if(e.client){if(e.client._formatQuery)return e.client._formatQuery.bind(e.client);if(e.client.SqlString)return e.client.SqlString.format.bind(e.client.SqlString)}if(e.builder)return e.builder.toString.bind(e.builder)}return()=>`<noop formatter>`},OU=new Map([[`sqlite3`,TU],[`pg`,EU]]),kU=e=>OU.get(e)||e,AU=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,jU=(e,t)=>typeof e==`string`&&typeof t==`number`&&0<t&&t<e.length?`${e.substring(0,t)}..`:e,MU=e=>{if(e)try{return new URL(e).pathname?.replace(/^\//,``)||void 0}catch{return}},NU=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},PU=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},FU=e=>{let t=e?._single?.table;return typeof t==`object`?FU(t):t},IU=`@sentry/instrumentation-knex`,LU=`auto.db.otel.knex`,RU=`knex`,zU=[`>=0.22.0 <4`,`>=0.10.0 <0.18.0`,`>=0.19.0 <0.22.0`,`>=0.18.0 <0.19.0`],BU=1022,VU=Symbol(`sentry.instrumentation-knex.parent-span`),HU=class extends q{constructor(e={}){super(IU,k,e)}init(){let e=new J(RU,zU);return e.files.push(this._getClientNodeModuleFileInstrumentation(`src`),this._getClientNodeModuleFileInstrumentation(`lib`),this._getRunnerNodeModuleFileInstrumentation(`src`),this._getRunnerNodeModuleFileInstrumentation(`lib`),this._getRunnerNodeModuleFileInstrumentation(`lib/execution`)),e}_getRunnerNodeModuleFileInstrumentation(e){return new CR(`knex/${e}/runner.js`,zU,(e,t)=>(this._ensureWrapped(e.prototype,`query`,this._createQueryWrapper(t)),e),e=>(this._unwrap(e.prototype,`query`),e))}_getClientNodeModuleFileInstrumentation(e){return new CR(`knex/${e}/client.js`,zU,e=>(this._ensureWrapped(e.prototype,`queryBuilder`,this._storeContext.bind(this)),this._ensureWrapped(e.prototype,`schemaBuilder`,this._storeContext.bind(this)),this._ensureWrapped(e.prototype,`raw`,this._storeContext.bind(this)),e),e=>(this._unwrap(e.prototype,`queryBuilder`),this._unwrap(e.prototype,`schemaBuilder`),this._unwrap(e.prototype,`raw`),e))}_createQueryWrapper(e){return function(t){return function(n){let r=this.client.config,i=FU(this.builder),a=n?.method,o=r?.connection?.connectionString,s=r?.connection?.filename||r?.connection?.database||MU(o),c={[I]:LU,"knex.version":e,[Pc]:kU(this.client.driverName),[wU]:i,[kc]:a,[Ic]:r?.connection?.user,[Dc]:s,[Gl]:r?.connection?.host??NU(o),[Kl]:r?.connection?.port??PU(o),[ql]:r?.connection?.filename===`:memory:`?`inproc`:void 0,[Nc]:jU(n?.sql,BU)},l=this.builder[VU]||R(),u=arguments;return z({name:AU(s,a,i),kind:G.CLIENT,attributes:c,parentSpan:l,onlyIfParent:!0},e=>t.apply(this,u).catch(t=>{let r=DU(this)(n.sql,n.bindings||[]),i=t.message.replace(`${r} - `,``);throw e.setStatus({code:2,message:i}),t}))}}}_storeContext(e){return function(){let t=e.apply(this,arguments);return Object.defineProperty(t,VU,{value:R()}),t}}_ensureWrapped(e,t,n){K(e[t])&&this._unwrap(e,t),this._wrap(e,t,n)}},UU=`sentrySubscribeOrchestrionChannel`;function WU(e){let t=new Set,n=[];for(let{module:r}of e){let e=`${r.name}\0${r.versionRange}\0${String(r.filePath)}`;t.has(e)||(t.add(e),n.push({channelName:r.name,module:r,astQuery:`Program`,transform:UU}))}return n}var GU={name:`amqplib`,versionRange:`>=0.5.5 <2`},KU=[{channelName:`publish`,module:{...GU,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`publish`,kind:`Sync`}},{channelName:`confirmPublish`,module:{...GU,filePath:`lib/channel_model.js`},functionQuery:{className:`ConfirmChannel`,methodName:`publish`,kind:`Callback`}},{channelName:`consume`,module:{...GU,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`consume`,kind:`Async`}},{channelName:`dispatch`,module:{...GU,filePath:`lib/channel.js`},functionQuery:{className:`BaseChannel`,methodName:`dispatchMessage`,kind:`Sync`}},{channelName:`ack`,module:{...GU,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`ack`,kind:`Sync`}},{channelName:`nack`,module:{...GU,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`nack`,kind:`Sync`}},{channelName:`reject`,module:{...GU,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`reject`,kind:`Sync`}},{channelName:`ackAll`,module:{...GU,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`ackAll`,kind:`Sync`}},{channelName:`nackAll`,module:{...GU,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`nackAll`,kind:`Sync`}},{channelName:`connect`,module:{...GU,filePath:`lib/connect.js`},functionQuery:{functionName:`connect`,kind:`Callback`}}],qU={AMQPLIB_PUBLISH:`orchestrion:amqplib:publish`,AMQPLIB_CONFIRM_PUBLISH:`orchestrion:amqplib:confirmPublish`,AMQPLIB_CONSUME:`orchestrion:amqplib:consume`,AMQPLIB_DISPATCH:`orchestrion:amqplib:dispatch`,AMQPLIB_ACK:`orchestrion:amqplib:ack`,AMQPLIB_NACK:`orchestrion:amqplib:nack`,AMQPLIB_REJECT:`orchestrion:amqplib:reject`,AMQPLIB_ACK_ALL:`orchestrion:amqplib:ackAll`,AMQPLIB_NACK_ALL:`orchestrion:amqplib:nackAll`,AMQPLIB_CONNECT:`orchestrion:amqplib:connect`},JU=WU(KU),YU=[...[`resources/messages/messages.js`,`resources/messages/messages.mjs`].flatMap(e=>[`create`,`countTokens`].map(t=>({channelName:`chat`,module:{name:`@anthropic-ai/sdk`,versionRange:`>=0.19.2 <1`,filePath:e},functionQuery:{className:`Messages`,methodName:t,kind:`Auto`}}))),...[`resources/completions.js`,`resources/completions.mjs`].map(e=>({channelName:`chat`,module:{name:`@anthropic-ai/sdk`,versionRange:`>=0.19.2 <1`,filePath:e},functionQuery:{className:`Completions`,methodName:`create`,kind:`Auto`}})),...[`resources/beta/messages/messages.js`,`resources/beta/messages/messages.mjs`].map(e=>({channelName:`chat`,module:{name:`@anthropic-ai/sdk`,versionRange:`>=0.19.2 <1`,filePath:e},functionQuery:{className:`Messages`,methodName:`create`,kind:`Auto`}})),...[`resources/models.js`,`resources/models.mjs`].map(e=>({channelName:`models`,module:{name:`@anthropic-ai/sdk`,versionRange:`>=0.19.2 <1`,filePath:e},functionQuery:{className:`Models`,methodName:`retrieve`,kind:`Auto`}})),...[`resources/messages/messages.js`,`resources/messages/messages.mjs`].map(e=>({channelName:`messages-stream`,module:{name:`@anthropic-ai/sdk`,versionRange:`>=0.19.2 <1`,filePath:e},functionQuery:{className:`Messages`,methodName:`stream`,kind:`Sync`}}))],XU={ANTHROPIC_CHAT:`orchestrion:@anthropic-ai/sdk:chat`,ANTHROPIC_MODELS:`orchestrion:@anthropic-ai/sdk:models`,ANTHROPIC_MESSAGES_STREAM:`orchestrion:@anthropic-ai/sdk:messages-stream`},ZU=WU(YU),QU=[{channelName:`send`,module:{name:`@smithy/core`,versionRange:`>=3.24.0 <4`,filePath:`dist-cjs/submodules/client/index.js`},functionQuery:{className:`Client`,methodName:`send`,kind:`Async`}},{channelName:`send`,module:{name:`@smithy/smithy-client`,versionRange:`>=1.0.3 <5`,filePath:`dist-cjs/index.js`},functionQuery:{className:`Client`,methodName:`send`,kind:`Async`}},{channelName:`send`,module:{name:`@aws-sdk/smithy-client`,versionRange:`^3.1.0`,filePath:`dist-cjs/index.js`},functionQuery:{className:`Client`,methodName:`send`,kind:`Async`}}],$U={AWS_SMITHY_CORE_SEND:`orchestrion:@smithy/core:send`,AWS_SMITHY_CLIENT_SEND:`orchestrion:@smithy/smithy-client:send`,AWS_SDK_SMITHY_CLIENT_SEND:`orchestrion:@aws-sdk/smithy-client:send`},eW=WU(QU),tW={name:`dataloader`,versionRange:`>=2.0.0 <3`,filePath:`index.js`},nW=[{channelName:`construct`,module:tW,functionQuery:{functionName:`DataLoader`,kind:`Sync`}},{channelName:`load`,module:tW,functionQuery:{expressionName:`load`,kind:`Async`}},{channelName:`loadMany`,module:tW,functionQuery:{expressionName:`loadMany`,kind:`Async`}},{channelName:`prime`,module:tW,functionQuery:{expressionName:`prime`,kind:`Sync`}},{channelName:`clear`,module:tW,functionQuery:{expressionName:`clear`,kind:`Sync`}},{channelName:`clearAll`,module:tW,functionQuery:{expressionName:`clearAll`,kind:`Sync`}}],rW={DATALOADER_CONSTRUCT:`orchestrion:dataloader:construct`,DATALOADER_LOAD:`orchestrion:dataloader:load`,DATALOADER_LOAD_MANY:`orchestrion:dataloader:loadMany`,DATALOADER_PRIME:`orchestrion:dataloader:prime`,DATALOADER_CLEAR:`orchestrion:dataloader:clear`,DATALOADER_CLEAR_ALL:`orchestrion:dataloader:clearAll`},iW=WU(nW),aW=[{channelName:`handle`,module:{name:`express`,versionRange:`>=4.0.0 <5`,filePath:`lib/router/layer.js`},functionQuery:{expressionName:`handle_request`,kind:`Callback`}},{channelName:`handle`,module:{name:`router`,versionRange:`>=2.0.0 <3`,filePath:`lib/layer.js`},functionQuery:{expressionName:`handleRequest`,kind:`Callback`}},{channelName:`register`,module:{name:`express`,versionRange:`>=4.0.0 <5`,filePath:`lib/router/index.js`},functionQuery:{expressionName:`route`,kind:`Sync`}},{channelName:`register`,module:{name:`express`,versionRange:`>=4.0.0 <5`,filePath:`lib/router/index.js`},functionQuery:{expressionName:`use`,kind:`Sync`}},{channelName:`register`,module:{name:`router`,versionRange:`>=2.0.0 <3`,filePath:`index.js`},functionQuery:{expressionName:`route`,kind:`Sync`}},{channelName:`register`,module:{name:`router`,versionRange:`>=2.0.0 <3`,filePath:`index.js`},functionQuery:{expressionName:`use`,kind:`Sync`}}],oW={EXPRESS_HANDLE:`orchestrion:express:handle`,ROUTER_HANDLE:`orchestrion:router:handle`,EXPRESS_REGISTER:`orchestrion:express:register`,ROUTER_REGISTER:`orchestrion:router:register`},sW=WU(aW),cW=`>=3.0.0 <5`,lW=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,uW=[{functionName:`addDoc`,channelName:`add-doc`},{functionName:`getDocs`,channelName:`get-docs`},{functionName:`setDoc`,channelName:`set-doc`},{functionName:`deleteDoc`,channelName:`delete-doc`}],dW=`>=6.0.0 <7`,fW=[{file:`lib/v2/providers/https.js`,functionName:`onRequest`,channelName:`http-request`},{file:`lib/v2/providers/https.js`,functionName:`onCall`,channelName:`http-call`},{file:`lib/v2/providers/firestore.js`,functionName:`onDocumentCreated`,channelName:`firestore-created`},{file:`lib/v2/providers/firestore.js`,functionName:`onDocumentCreatedWithAuthContext`,channelName:`firestore-created`},{file:`lib/v2/providers/firestore.js`,functionName:`onDocumentUpdated`,channelName:`firestore-updated`},{file:`lib/v2/providers/firestore.js`,functionName:`onDocumentUpdatedWithAuthContext`,channelName:`firestore-updated`},{file:`lib/v2/providers/firestore.js`,functionName:`onDocumentDeleted`,channelName:`firestore-deleted`},{file:`lib/v2/providers/firestore.js`,functionName:`onDocumentDeletedWithAuthContext`,channelName:`firestore-deleted`},{file:`lib/v2/providers/firestore.js`,functionName:`onDocumentWritten`,channelName:`firestore-written`},{file:`lib/v2/providers/firestore.js`,functionName:`onDocumentWrittenWithAuthContext`,channelName:`firestore-written`},{file:`lib/v2/providers/scheduler.js`,functionName:`onSchedule`,channelName:`scheduler`},{file:`lib/v2/providers/storage.js`,functionName:`onObjectFinalized`,channelName:`storage-finalized`},{file:`lib/v2/providers/storage.js`,functionName:`onObjectArchived`,channelName:`storage-archived`},{file:`lib/v2/providers/storage.js`,functionName:`onObjectDeleted`,channelName:`storage-deleted`},{file:`lib/v2/providers/storage.js`,functionName:`onObjectMetadataUpdated`,channelName:`storage-metadata-updated`}],pW=[...uW.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:`@firebase/firestore`,versionRange:cW,filePath:lW},functionQuery:{functionName:e,kind:`Auto`}})),...fW.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:`firebase-functions`,versionRange:dW,filePath:e},functionQuery:{functionName:t,kind:`Sync`}}))],mW={FIREBASE_FIRESTORE_ADD_DOC:`orchestrion:@firebase/firestore:add-doc`,FIREBASE_FIRESTORE_GET_DOCS:`orchestrion:@firebase/firestore:get-docs`,FIREBASE_FIRESTORE_SET_DOC:`orchestrion:@firebase/firestore:set-doc`,FIREBASE_FIRESTORE_DELETE_DOC:`orchestrion:@firebase/firestore:delete-doc`,FIREBASE_FUNCTIONS_HTTP_REQUEST:`orchestrion:firebase-functions:http-request`,FIREBASE_FUNCTIONS_HTTP_CALL:`orchestrion:firebase-functions:http-call`,FIREBASE_FUNCTIONS_FIRESTORE_CREATED:`orchestrion:firebase-functions:firestore-created`,FIREBASE_FUNCTIONS_FIRESTORE_UPDATED:`orchestrion:firebase-functions:firestore-updated`,FIREBASE_FUNCTIONS_FIRESTORE_DELETED:`orchestrion:firebase-functions:firestore-deleted`,FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN:`orchestrion:firebase-functions:firestore-written`,FIREBASE_FUNCTIONS_SCHEDULER:`orchestrion:firebase-functions:scheduler`,FIREBASE_FUNCTIONS_STORAGE_FINALIZED:`orchestrion:firebase-functions:storage-finalized`,FIREBASE_FUNCTIONS_STORAGE_ARCHIVED:`orchestrion:firebase-functions:storage-archived`,FIREBASE_FUNCTIONS_STORAGE_DELETED:`orchestrion:firebase-functions:storage-deleted`,FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED:`orchestrion:firebase-functions:storage-metadata-updated`},hW=WU(pW),gW=[{channelName:`acquire`,module:{name:`generic-pool`,versionRange:`>=3.0.0 <4`,filePath:`lib/Pool.js`},functionQuery:{className:`Pool`,methodName:`acquire`,kind:`Auto`}},{channelName:`acquire`,module:{name:`generic-pool`,versionRange:`>=2.4.0 <3`,filePath:`lib/generic-pool.js`},functionQuery:{expressionName:`acquire`,kind:`Callback`}}],_W={GENERIC_POOL_ACQUIRE:`orchestrion:generic-pool:acquire`},vW=WU(gW),yW=[`dist/node/index.js`,`dist/node/index.mjs`,`dist/node/index.cjs`],bW=[...yW.flatMap(e=>[`generateContent`,`generateContentStream`].map(t=>({channelName:`generate-content`,module:{name:`@google/genai`,versionRange:`>=0.10.0 <2`,filePath:e},functionQuery:{expressionName:t,kind:`Auto`}}))),...yW.map(e=>({channelName:`embed-content`,module:{name:`@google/genai`,versionRange:`>=0.10.0 <2`,filePath:e},functionQuery:{className:`Models`,methodName:`embedContent`,kind:`Auto`}})),...yW.flatMap(e=>[`sendMessage`,`sendMessageStream`].map(t=>({channelName:`chat`,module:{name:`@google/genai`,versionRange:`>=0.10.0 <2`,filePath:e},functionQuery:{className:`Chat`,methodName:t,kind:`Auto`}})))],xW={GOOGLE_GENAI_GENERATE_CONTENT:`orchestrion:@google/genai:generate-content`,GOOGLE_GENAI_EMBED_CONTENT:`orchestrion:@google/genai:embed-content`,GOOGLE_GENAI_CHAT:`orchestrion:@google/genai:chat`},SW=WU(bW),CW=[{channelName:`parse`,module:{name:`graphql`,versionRange:`>=14.0.0 <17`,filePath:`language/parser.js`},functionQuery:{functionName:`parse`,kind:`Sync`}},{channelName:`validate`,module:{name:`graphql`,versionRange:`>=14.0.0 <17`,filePath:`validation/validate.js`},functionQuery:{functionName:`validate`,kind:`Sync`}},{channelName:`execute`,module:{name:`graphql`,versionRange:`>=14.0.0 <17`,filePath:`execution/execute.js`},functionQuery:{functionName:`execute`,kind:`Auto`}}],wW={GRAPHQL_PARSE:`orchestrion:graphql:parse`,GRAPHQL_VALIDATE:`orchestrion:graphql:validate`,GRAPHQL_EXECUTE:`orchestrion:graphql:execute`},TW=WU(CW),EW=[{channelName:`route`,module:{name:`@hapi/hapi`,versionRange:`>=17.0.0 <22.0.0`,filePath:`lib/server.js`},functionQuery:{methodName:`route`,kind:`Sync`}},{channelName:`ext`,module:{name:`@hapi/hapi`,versionRange:`>=17.0.0 <22.0.0`,filePath:`lib/server.js`},functionQuery:{methodName:`ext`,kind:`Sync`}}],DW={HAPI_ROUTE:`orchestrion:@hapi/hapi:route`,HAPI_EXT:`orchestrion:@hapi/hapi:ext`},OW=WU(EW),kW=[...[`lib/redis.js`,`built/redis.js`,`built/redis/index.js`].flatMap(e=>[{channelName:`command`,module:{name:`ioredis`,versionRange:`>=2.0.0 <5.0.0`,filePath:e},functionQuery:{expressionName:`sendCommand`,kind:`Async`}},{channelName:`connect`,module:{name:`ioredis`,versionRange:`>=2.0.0 <5.0.0`,filePath:e},functionQuery:{expressionName:`connect`,kind:`Async`}}]),{channelName:`command`,module:{name:`ioredis`,versionRange:`>=5.0.0 <5.11.0`,filePath:`built/Redis.js`},functionQuery:{className:`Redis`,methodName:`sendCommand`,kind:`Async`}},{channelName:`connect`,module:{name:`ioredis`,versionRange:`>=5.0.0 <5.11.0`,filePath:`built/Redis.js`},functionQuery:{className:`Redis`,methodName:`connect`,kind:`Async`}}],AW={IOREDIS_COMMAND:`orchestrion:ioredis:command`,IOREDIS_CONNECT:`orchestrion:ioredis:connect`},jW=WU(kW),MW=[{channelName:`send_batch`,module:{name:`kafkajs`,versionRange:`>=2.0.0 <3`,filePath:`src/producer/messageProducer.js`},functionQuery:{expressionName:`sendBatch`,kind:`Async`}},{channelName:`consumer_run`,module:{name:`kafkajs`,versionRange:`>=2.0.0 <3`,filePath:`src/consumer/index.js`},functionQuery:{expressionName:`run`,kind:`Async`}}],NW={KAFKAJS_SEND_BATCH:`orchestrion:kafkajs:send_batch`,KAFKAJS_CONSUMER_RUN:`orchestrion:kafkajs:consumer_run`},PW=WU(MW),FW=`knex`,IW=[{filePath:`lib/execution/runner.js`,versionRange:`>=0.22.0 <4`},{filePath:`lib/runner.js`,versionRange:`>=0.10.0 <0.22.0`},{filePath:`src/runner.js`,versionRange:`>=0.18.0 <0.19.0`}],LW=[{filePath:`lib/client.js`,versionRange:`>=0.10.0 <4`},{filePath:`src/client.js`,versionRange:`>=0.18.0 <0.19.0`}],RW=[`queryBuilder`,`schemaBuilder`,`raw`];function zW(e,t){return{channelName:`query`,module:{name:FW,versionRange:t,filePath:e},functionQuery:{className:`Runner`,methodName:`query`,kind:`Async`}}}function BW(e,t,n){return{channelName:e,module:{name:FW,versionRange:n,filePath:t},functionQuery:{className:`Client`,methodName:e,kind:`Sync`}}}var VW=[...IW.map(({filePath:e,versionRange:t})=>zW(e,t)),...LW.flatMap(({filePath:e,versionRange:t})=>RW.map(n=>BW(n,e,t)))],HW={KNEX_QUERY:`orchestrion:knex:query`,KNEX_QUERY_BUILDER:`orchestrion:knex:queryBuilder`,KNEX_SCHEMA_BUILDER:`orchestrion:knex:schemaBuilder`,KNEX_RAW:`orchestrion:knex:raw`},UW=WU(VW),WW=[{channelName:`use`,module:{name:`koa`,versionRange:`>=2.0.0 <4`,filePath:`lib/application.js`},functionQuery:{className:`Application`,methodName:`use`,kind:`Sync`}}],GW={KOA_USE:`orchestrion:koa:use`},KW=WU(WW),qW=[`dist/language_models/chat_models.cjs`,`dist/language_models/chat_models.js`].flatMap(e=>{let t={name:`@langchain/core`,versionRange:`>=0.1.0 <2.0.0`,filePath:e};return[{channelName:`chatModelInvoke`,module:t,functionQuery:{className:`BaseChatModel`,methodName:`invoke`,kind:`Async`}},{channelName:`chatModelStream`,module:t,functionQuery:{className:`BaseChatModel`,methodName:`_streamIterator`,kind:`Async`}}]}),JW=`embedQuery`,YW=`embedDocuments`,XW=[{name:`@langchain/openai`,versionRange:`>=0.1.0 <2.0.0`,methods:[JW,YW]},{name:`@langchain/google-genai`,versionRange:`>=0.1.0 <3.0.0`,methods:[JW,YW]},{name:`@langchain/mistralai`,versionRange:`>=0.1.0 <2.0.0`,methods:[JW,YW]},{name:`@langchain/google-common`,versionRange:`>=0.1.0 <3.0.0`,methods:[YW]}],ZW=XW.flatMap(({name:e,versionRange:t,methods:n})=>[`dist/embeddings.cjs`,`dist/embeddings.js`].flatMap(r=>n.map(n=>({channelName:n,module:{name:e,versionRange:t,filePath:r},functionQuery:{methodName:n,kind:`Async`}})))),QW=[...qW,...ZW],$W=XW.flatMap(({name:e,methods:t})=>t.map(t=>`orchestrion:${e}:${t}`)),eG={LANGCHAIN_CHAT_MODEL_INVOKE:`orchestrion:@langchain/core:chatModelInvoke`,LANGCHAIN_CHAT_MODEL_STREAM:`orchestrion:@langchain/core:chatModelStream`},tG=WU(QW),nG=e=>({name:`@langchain/langgraph`,versionRange:`>=0.0.0 <2.0.0`,filePath:e}),rG=[`dist/graph/state.cjs`,`dist/graph/state.js`].map(e=>({channelName:`stateGraphCompile`,module:nG(e),functionQuery:{className:`StateGraph`,methodName:`compile`,kind:`Sync`}})),iG=[`dist/prebuilt/react_agent_executor.cjs`,`dist/prebuilt/react_agent_executor.js`].map(e=>({channelName:`createReactAgent`,module:nG(e),functionQuery:{functionName:`createReactAgent`,kind:`Sync`}})),aG=[...rG,...iG],oG={LANGGRAPH_STATE_GRAPH_COMPILE:`orchestrion:@langchain/langgraph:stateGraphCompile`,LANGGRAPH_CREATE_REACT_AGENT:`orchestrion:@langchain/langgraph:createReactAgent`},sG=WU(aG),cG=[{channelName:`load`,module:{name:`lru-memoizer`,versionRange:`>=2.1.0 <4`,filePath:`lib/async.js`},functionQuery:{functionName:`memoizedFunction`,kind:`Callback`}}],lG={LRU_MEMOIZER_LOAD:`orchestrion:lru-memoizer:load`},uG=WU(cG),dG={name:`mongodb`},fG=[{channelName:`command`,module:{...dG,versionRange:`>=6.4.0 <8`,filePath:`lib/cmap/connection.js`},functionQuery:{methodName:`command`,kind:`Async`}},{channelName:`command`,module:{...dG,versionRange:`>=4.0.0 <6.4`,filePath:`lib/cmap/connection.js`},functionQuery:{methodName:`command`,kind:`Callback`}},{channelName:`checkout`,module:{...dG,versionRange:`>=4.0.0 <6.4`,filePath:`lib/cmap/connection_pool.js`},functionQuery:{methodName:`checkOut`,kind:`Callback`}},...[`insert`,`update`,`remove`].map(e=>({channelName:`v3_${e}`,module:{...dG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/index.js`},functionQuery:{expressionName:e,kind:`Callback`}})),{channelName:`v3_command`,module:{...dG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/command.js`},functionQuery:{functionName:`command`,kind:`Callback`}},{channelName:`v3_query`,module:{...dG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/query.js`},functionQuery:{functionName:`query`,kind:`Callback`}},{channelName:`v3_get_more`,module:{...dG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/get_more.js`},functionQuery:{functionName:`getMore`,kind:`Callback`}}],pG={MONGODB_COMMAND:`orchestrion:mongodb:command`,MONGODB_CHECKOUT:`orchestrion:mongodb:checkout`,MONGODB_V3_INSERT:`orchestrion:mongodb:v3_insert`,MONGODB_V3_UPDATE:`orchestrion:mongodb:v3_update`,MONGODB_V3_REMOVE:`orchestrion:mongodb:v3_remove`,MONGODB_V3_COMMAND:`orchestrion:mongodb:v3_command`,MONGODB_V3_QUERY:`orchestrion:mongodb:v3_query`,MONGODB_V3_GET_MORE:`orchestrion:mongodb:v3_get_more`},mG=WU(fG),hG={name:`mongoose`,versionRange:`>=5.9.7 <9.7.0`},gG=[`find`,`findOne`,`deleteOne`,`deleteMany`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`,`remove`,`count`,`findOneAndRemove`],_G=[{channelName:`query_exec`,module:{...hG,filePath:`lib/query.js`},functionQuery:{expressionName:`exec`,kind:`Auto`}},{channelName:`aggregate_exec`,module:{...hG,filePath:`lib/aggregate.js`},functionQuery:{expressionName:`exec`,kind:`Auto`}},{channelName:`model_save`,module:{...hG,filePath:`lib/model.js`},functionQuery:{expressionName:`save`,kind:`Auto`}},{channelName:`model_insert_many`,module:{...hG,filePath:`lib/model.js`},functionQuery:{expressionName:`insertMany`,kind:`Auto`}},{channelName:`model_bulk_write`,module:{...hG,filePath:`lib/model.js`},functionQuery:{expressionName:`bulkWrite`,kind:`Auto`}},{channelName:`model_remove`,module:{...hG,filePath:`lib/model.js`},functionQuery:{expressionName:`remove`,kind:`Auto`}},{channelName:`model_aggregate`,module:{...hG,filePath:`lib/model.js`},functionQuery:{expressionName:`aggregate`,kind:`Sync`}},...gG.map(e=>({channelName:`ctx_${e}`,module:{...hG,filePath:`lib/query.js`},functionQuery:{expressionName:e,kind:`Sync`}}))],vG={MONGOOSE_QUERY_EXEC:`orchestrion:mongoose:query_exec`,MONGOOSE_AGGREGATE_EXEC:`orchestrion:mongoose:aggregate_exec`,MONGOOSE_MODEL_SAVE:`orchestrion:mongoose:model_save`,MONGOOSE_MODEL_INSERT_MANY:`orchestrion:mongoose:model_insert_many`,MONGOOSE_MODEL_BULK_WRITE:`orchestrion:mongoose:model_bulk_write`,MONGOOSE_MODEL_REMOVE:`orchestrion:mongoose:model_remove`,MONGOOSE_MODEL_AGGREGATE:`orchestrion:mongoose:model_aggregate`},yG=gG.map(e=>`orchestrion:mongoose:ctx_${e}`),bG=WU(_G),xG=[{channelName:`query`,module:{name:`mysql2`,versionRange:`>=1.4.2 <3.11.5`,filePath:`lib/connection.js`},functionQuery:{className:`Connection`,methodName:`query`,kind:`Callback`}},{channelName:`execute`,module:{name:`mysql2`,versionRange:`>=1.4.2 <3.11.5`,filePath:`lib/connection.js`},functionQuery:{className:`Connection`,methodName:`execute`,kind:`Callback`}},{channelName:`query`,module:{name:`mysql2`,versionRange:`>=3.11.5 <3.20.0`,filePath:`lib/base/connection.js`},functionQuery:{className:`BaseConnection`,methodName:`query`,kind:`Callback`}},{channelName:`execute`,module:{name:`mysql2`,versionRange:`>=3.11.5 <3.20.0`,filePath:`lib/base/connection.js`},functionQuery:{className:`BaseConnection`,methodName:`execute`,kind:`Callback`}}],SG={MYSQL2_QUERY:`orchestrion:mysql2:query`,MYSQL2_EXECUTE:`orchestrion:mysql2:execute`},CG=WU(xG),wG=[{channelName:`query`,module:{name:`mysql`,versionRange:`>=2.0.0 <3`,filePath:`lib/Connection.js`},functionQuery:{expressionName:`query`,kind:`Auto`}}],TG={MYSQL_QUERY:`orchestrion:mysql:query`},EG=WU(wG);function DG(e){return e}var OG=[{channelName:`nestFactoryCreate`,module:{name:`@nestjs/core`,versionRange:`>=8.0.0 <12`,filePath:`nest-factory.js`},functionQuery:{className:`NestFactoryStatic`,methodName:`create`,kind:`Async`}},{channelName:`routerExecutionContextCreate`,module:{name:`@nestjs/core`,versionRange:`>=8.0.0 <12`,filePath:`router/router-execution-context.js`},functionQuery:{className:`RouterExecutionContext`,methodName:`create`,kind:`Sync`}},DG({channelName:`injectableDecorator`,module:{name:`@nestjs/common`,versionRange:`>=8.0.0 <12`,filePath:`decorators/core/injectable.decorator.js`},astQuery:`FunctionDeclaration[id.name="Injectable"] ReturnStatement > ArrowFunctionExpression`,functionQuery:{kind:`Sync`}}),DG({channelName:`catchDecorator`,module:{name:`@nestjs/common`,versionRange:`>=8.0.0 <12`,filePath:`decorators/core/catch.decorator.js`},astQuery:`FunctionDeclaration[id.name="Catch"] ReturnStatement > ArrowFunctionExpression`,functionQuery:{kind:`Sync`}}),{channelName:`cronDecorator`,module:{name:`@nestjs/schedule`,versionRange:`>=2.0.0`,filePath:`dist/decorators/cron.decorator.js`},functionQuery:{functionName:`Cron`,kind:`Sync`}},{channelName:`intervalDecorator`,module:{name:`@nestjs/schedule`,versionRange:`>=2.0.0`,filePath:`dist/decorators/interval.decorator.js`},functionQuery:{functionName:`Interval`,kind:`Sync`}},{channelName:`timeoutDecorator`,module:{name:`@nestjs/schedule`,versionRange:`>=2.0.0`,filePath:`dist/decorators/timeout.decorator.js`},functionQuery:{functionName:`Timeout`,kind:`Sync`}},{channelName:`onEventDecorator`,module:{name:`@nestjs/event-emitter`,versionRange:`>=2.0.0`,filePath:`dist/decorators/on-event.decorator.js`},functionQuery:{expressionName:`OnEvent`,kind:`Sync`}},{channelName:`processorDecorator`,module:{name:`@nestjs/bullmq`,versionRange:`>=10.0.0`,filePath:`dist/decorators/processor.decorator.js`},functionQuery:{functionName:`Processor`,kind:`Sync`}}],kG={NESTJS_APP_CREATION:`orchestrion:@nestjs/core:nestFactoryCreate`,NESTJS_ROUTER_CONTEXT:`orchestrion:@nestjs/core:routerExecutionContextCreate`,NESTJS_INJECTABLE:`orchestrion:@nestjs/common:injectableDecorator`,NESTJS_CATCH:`orchestrion:@nestjs/common:catchDecorator`,NESTJS_SCHEDULE_CRON:`orchestrion:@nestjs/schedule:cronDecorator`,NESTJS_SCHEDULE_INTERVAL:`orchestrion:@nestjs/schedule:intervalDecorator`,NESTJS_SCHEDULE_TIMEOUT:`orchestrion:@nestjs/schedule:timeoutDecorator`,NESTJS_ONEVENT:`orchestrion:@nestjs/event-emitter:onEventDecorator`,NESTJS_PROCESSOR:`orchestrion:@nestjs/bullmq:processorDecorator`},AG=WU(OG),jG=[...[`resources/chat/completions/completions.js`,`resources/chat/completions/completions.mjs`].map(e=>({channelName:`chat`,module:{name:`openai`,versionRange:`>=4.0.0 <8`,filePath:e},functionQuery:{className:`Completions`,methodName:`create`,kind:`Auto`}})),...[`resources/responses/responses.js`,`resources/responses/responses.mjs`].map(e=>({channelName:`chat`,module:{name:`openai`,versionRange:`>=4.0.0 <8`,filePath:e},functionQuery:{className:`Responses`,methodName:`create`,kind:`Auto`}})),...[`resources/embeddings.js`,`resources/embeddings.mjs`].map(e=>({channelName:`embeddings`,module:{name:`openai`,versionRange:`>=4.0.0 <8`,filePath:e},functionQuery:{className:`Embeddings`,methodName:`create`,kind:`Auto`}})),...[`resources/conversations/conversations.js`,`resources/conversations/conversations.mjs`].map(e=>({channelName:`chat`,module:{name:`openai`,versionRange:`>=4.0.0 <8`,filePath:e},functionQuery:{className:`Conversations`,methodName:`create`,kind:`Auto`}}))],MG={OPENAI_CHAT:`orchestrion:openai:chat`,OPENAI_EMBEDDINGS:`orchestrion:openai:embeddings`},NG=WU(jG),PG=[{channelName:`query`,module:{name:`pg`,versionRange:`>=8.0.3 <9`,filePath:`lib/client.js`},functionQuery:{className:`Client`,methodName:`query`,kind:`Auto`}},{channelName:`connect`,module:{name:`pg`,versionRange:`>=8.0.3 <9`,filePath:`lib/client.js`},functionQuery:{className:`Client`,methodName:`connect`,kind:`Auto`}},{channelName:`query`,module:{name:`pg`,versionRange:`>=8.0.3 <9`,filePath:`lib/native/client.js`},functionQuery:{expressionName:`query`,kind:`Auto`}},{channelName:`connect`,module:{name:`pg`,versionRange:`>=8.0.3 <9`,filePath:`lib/native/client.js`},functionQuery:{expressionName:`connect`,kind:`Auto`}},{channelName:`connect`,module:{name:`pg-pool`,versionRange:`>=2.0.0 <4`,filePath:`index.js`},functionQuery:{className:`Pool`,methodName:`connect`,kind:`Auto`}}],FG={PG_QUERY:`orchestrion:pg:query`,PG_CONNECT:`orchestrion:pg:connect`,PGPOOL_CONNECT:`orchestrion:pg-pool:connect`},IG=WU(PG),LG=[`src`,`cjs/src`].flatMap(e=>[{channelName:`handle`,module:{name:`postgres`,versionRange:`>=3.0.0 <4`,filePath:`${e}/query.js`},functionQuery:{className:`Query`,methodName:`handle`,kind:`Async`}},{channelName:`connection`,module:{name:`postgres`,versionRange:`>=3.0.0 <4`,filePath:`${e}/connection.js`},functionQuery:{functionName:`Connection`,kind:`Sync`}},{channelName:`execute`,module:{name:`postgres`,versionRange:`>=3.0.0 <4`,filePath:`${e}/connection.js`},functionQuery:{functionName:`execute`,kind:`Sync`}},{channelName:`connect`,module:{name:`postgres`,versionRange:`>=3.0.0 <4`,filePath:`${e}/connection.js`},functionQuery:{methodName:`connect`,kind:`Sync`}}]),RG={POSTGRESJS_HANDLE:`orchestrion:postgres:handle`,POSTGRESJS_CONNECTION:`orchestrion:postgres:connection`,POSTGRESJS_EXECUTE:`orchestrion:postgres:execute`,POSTGRESJS_CONNECT:`orchestrion:postgres:connect`},zG=WU(LG),BG=[{channelName:`command`,module:{name:`redis`,versionRange:`>=2.6.0 <4`,filePath:`index.js`},functionQuery:{expressionName:`internal_send_command`,kind:`Sync`}},{channelName:`executor`,module:{name:`@redis/client`,versionRange:`^1.0.0`,filePath:`dist/lib/client/index.js`},functionQuery:{className:`RedisClient`,methodName:`commandsExecutor`,kind:`Async`}},{channelName:`command`,module:{name:`@redis/client`,versionRange:`^1.0.0`,filePath:`dist/lib/client/index.js`},functionQuery:{className:`RedisClient`,methodName:`sendCommand`,kind:`Async`}},{channelName:`connect`,module:{name:`@redis/client`,versionRange:`^1.0.0`,filePath:`dist/lib/client/index.js`},functionQuery:{className:`RedisClient`,methodName:`connect`,kind:`Async`}},{channelName:`command`,module:{name:`@redis/client`,versionRange:`>=5.0.0 <5.12.0`,filePath:`dist/lib/client/index.js`},functionQuery:{className:`RedisClient`,methodName:`sendCommand`,kind:`Async`}},{channelName:`connect`,module:{name:`@redis/client`,versionRange:`>=5.0.0 <5.12.0`,filePath:`dist/lib/client/index.js`},functionQuery:{className:`RedisClient`,methodName:`connect`,kind:`Async`}},{channelName:`multi`,module:{name:`@redis/client`,versionRange:`>=5.0.0 <5.12.0`,filePath:`dist/lib/client/index.js`},functionQuery:{className:`RedisClient`,methodName:`_executeMulti`,kind:`Async`}},{channelName:`pipeline`,module:{name:`@redis/client`,versionRange:`>=5.0.0 <5.12.0`,filePath:`dist/lib/client/index.js`},functionQuery:{className:`RedisClient`,methodName:`_executePipeline`,kind:`Async`}},{channelName:`batch`,module:{name:`@redis/client`,versionRange:`^1.0.0`,filePath:`dist/lib/client/index.js`},functionQuery:{className:`RedisClient`,methodName:`multiExecutor`,kind:`Async`}}],VG={REDIS_COMMAND:`orchestrion:redis:command`,NODE_REDIS_COMMAND:`orchestrion:@redis/client:command`,NODE_REDIS_EXECUTOR:`orchestrion:@redis/client:executor`,NODE_REDIS_CONNECT:`orchestrion:@redis/client:connect`,NODE_REDIS_MULTI:`orchestrion:@redis/client:multi`,NODE_REDIS_PIPELINE:`orchestrion:@redis/client:pipeline`,NODE_REDIS_BATCH:`orchestrion:@redis/client:batch`},HG=WU(BG),UG=[`dist`,`dist/esm`].flatMap(e=>[{channelName:`requestHandler`,module:{name:`@remix-run/server-runtime`,versionRange:`>=2.0.0 <3`,filePath:`${e}/server.js`},astQuery:`FunctionExpression[id.name="requestHandler"]`,functionQuery:{kind:`Async`}},{channelName:`matchServerRoutes`,module:{name:`@remix-run/server-runtime`,versionRange:`>=2.0.0 <3`,filePath:`${e}/routeMatching.js`},functionQuery:{functionName:`matchServerRoutes`,kind:`Sync`}},{channelName:`callRouteLoader`,module:{name:`@remix-run/server-runtime`,versionRange:`>=2.9.0 <3`,filePath:`${e}/data.js`},functionQuery:{functionName:`callRouteLoader`,kind:`Async`}},{channelName:`callRouteAction`,module:{name:`@remix-run/server-runtime`,versionRange:`>=2.9.0 <3`,filePath:`${e}/data.js`},functionQuery:{functionName:`callRouteAction`,kind:`Async`}},{channelName:`callRouteLoader`,module:{name:`@remix-run/server-runtime`,versionRange:`>=2.0.0 <2.9.0`,filePath:`${e}/data.js`},functionQuery:{functionName:`callRouteLoaderRR`,kind:`Async`}},{channelName:`callRouteAction`,module:{name:`@remix-run/server-runtime`,versionRange:`>=2.0.0 <2.9.0`,filePath:`${e}/data.js`},functionQuery:{functionName:`callRouteActionRR`,kind:`Async`}}]),WG={REMIX_REQUEST_HANDLER:`orchestrion:@remix-run/server-runtime:requestHandler`,REMIX_MATCH_SERVER_ROUTES:`orchestrion:@remix-run/server-runtime:matchServerRoutes`,REMIX_CALL_ROUTE_LOADER:`orchestrion:@remix-run/server-runtime:callRouteLoader`,REMIX_CALL_ROUTE_ACTION:`orchestrion:@remix-run/server-runtime:callRouteAction`},GG=WU(UG),KG=`tedious`,qG=`lib/connection.js`,JG=`>=1.11.0 <20`,YG=[`connect`,`execSql`,`execSqlBatch`,`callProcedure`,`execBulkLoad`,`prepare`,`execute`].map(e=>({channelName:e,module:{name:KG,versionRange:JG,filePath:qG},functionQuery:{className:`Connection`,methodName:e,kind:`Sync`}})),XG={TEDIOUS_CONNECT:`orchestrion:tedious:connect`,TEDIOUS_EXEC_SQL:`orchestrion:tedious:execSql`,TEDIOUS_EXEC_SQL_BATCH:`orchestrion:tedious:execSqlBatch`,TEDIOUS_CALL_PROCEDURE:`orchestrion:tedious:callProcedure`,TEDIOUS_EXEC_BULK_LOAD:`orchestrion:tedious:execBulkLoad`,TEDIOUS_PREPARE:`orchestrion:tedious:prepare`,TEDIOUS_EXECUTE:`orchestrion:tedious:execute`},ZG=WU(YG),QG=[...eK(`>=4.0.0 <7.0.0`,`generateText`,`generateText`,`Async`),...eK(`>=4.0.0 <7.0.0`,`streamText`,`streamText`,`Sync`),...eK(`>=4.0.0 <7.0.0`,`generateObject`,`generateObject`,`Async`),...eK(`>=4.0.0 <7.0.0`,`embed`,`embed`,`Async`),...eK(`>=4.0.0 <7.0.0`,`embedMany`,`embedMany`,`Async`),...eK(`>=5.0.0 <7.0.0`,`resolveLanguageModel`,`resolveLanguageModel`,`Sync`),...eK(`>=6.0.0 <7.0.0`,`executeToolCall`,`executeToolCall`,`Async`)],$G={VERCEL_AI_GENERATE_TEXT:`orchestrion:ai:generateText`,VERCEL_AI_STREAM_TEXT:`orchestrion:ai:streamText`,VERCEL_AI_GENERATE_OBJECT:`orchestrion:ai:generateObject`,VERCEL_AI_EMBED:`orchestrion:ai:embed`,VERCEL_AI_EMBED_MANY:`orchestrion:ai:embedMany`,VERCEL_AI_EXECUTE_TOOL_CALL:`orchestrion:ai:executeToolCall`,VERCEL_AI_RESOLVE_LANGUAGE_MODEL:`orchestrion:ai:resolveLanguageModel`};function eK(e,t,n,r){return[`dist/index.js`,`dist/index.mjs`].map(i=>({channelName:t,module:{name:`ai`,versionRange:e,filePath:i},functionQuery:{functionName:n,kind:r}}))}var tK=WU(QG),$={...qU,...XU,...$U,...rW,...oW,...mW,..._W,...xW,...wW,...DW,...AW,...NW,...HW,...GW,...eG,...oG,...lG,...pG,...vG,...SG,...TG,...kG,...MG,...FG,...RG,...VG,...WG,...XG,...$G},nK=`Amqplib`,rK=`auto.amqplib.orchestrion.publisher`,iK=`auto.amqplib.orchestrion.consumer`,aK=`messaging.operation`,oK=`messaging.destination`,sK=`messaging.destination_kind`,cK=`messaging.rabbitmq.routing_key`,lK=`messaging.protocol`,uK=`messaging.protocol_version`,dK=`messaging.url`,fK=`messaging.message_id`,pK=`messaging.conversation_id`,mK=`messaging.rabbitmq.destination.routing_key`,hK=`messaging.message.conversation_id`,gK=`topic`,_K=`process`,vK=`send`,yK=6e4,bK={Ack:`ack`,AckAll:`ackAll`,Reject:`reject`,Nack:`nack`,NackAll:`nackAll`,ChannelClosed:`channel closed`,ChannelError:`channel error`,InstrumentationTimeout:`instrumentation timeout`},xK=Symbol(`sentry.amqplib.message.stored-span`),SK=Symbol(`sentry.amqplib.channel.spans-not-ended`),CK=Symbol(`sentry.amqplib.channel.consume-timeout-timer`),wK=Symbol(`sentry.amqplib.channel.consumer-info`),TK=Symbol(`sentry.amqplib.channel.is-confirm-publishing`),EK=Symbol(`sentry.amqplib.connection.attributes`),DK=()=>{},OK=!1,kK=(()=>({name:nK,setupOnce(){w.tracingChannel&&!OK&&(OK=!0,X&&A.log(`[orchestrion:amqplib] subscribing to amqplib tracing channels`),U(()=>{FK(),AK(),jK(),MK(),NK(),PK()}))}}));function AK(){Z(w.tracingChannel($.AMQPLIB_PUBLISH),e=>{if(!e.self?.[TK])return HK(e)})}function jK(){let e=w.tracingChannel($.AMQPLIB_CONFIRM_PUBLISH);Z(e,e=>(e.self&&(e.self[TK]=!0),HK(e))),e.end.subscribe(e=>{let t=e.self;t&&(t[TK]=!1)})}function MK(){let e=w.tracingChannel($.AMQPLIB_CONSUME);e.start.subscribe(DK),e.asyncEnd.subscribe(e=>{let t=e,n=t.self,r=t.result?.consumerTag;if(!n||!r)return;LK(n);let i=t.arguments[0],a=typeof i==`string`?i:`<unknown>`,o=t.arguments[2];n[wK]?.set(r,{noAck:!!o?.noAck,queue:a})})}function NK(){Z(w.tracingChannel($.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;LK(t);let i=n?.consumerTag?t[wK]?.get(n.consumerTag):void 0,a=i?.queue??r.fields?.routingKey??`<unknown>`,o=i?.noAck??!1,s=r.properties?.headers,c=is({sentryTrace:QK(s,`sentry-trace`),baggage:QK(s,`baggage`)},()=>UK(a,r,t));return o||(t[SK]?.push({msg:r,timeOfConsume:Lr()}),r[xK]=c),e._sentryNoAck=o,c},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function PK(){w.tracingChannel($.AMQPLIB_ACK).start.subscribe(e=>IK(e,!1,bK.Ack)),w.tracingChannel($.AMQPLIB_NACK).start.subscribe(e=>IK(e,!0,bK.Nack)),w.tracingChannel($.AMQPLIB_REJECT).start.subscribe(e=>IK(e,!0,bK.Reject)),w.tracingChannel($.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&BK(t.self,!1,bK.AckAll,void 0)}),w.tracingChannel($.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&BK(t.self,!0,bK.NackAll,t.arguments[0])})}function FK(){let e=w.tracingChannel($.AMQPLIB_CONNECT);e.start.subscribe(DK),e.asyncEnd.subscribe(e=>{let t=e,n=t.result;n&&typeof n==`object`&&(n[EK]={...KK(t.arguments?.[0]),...GK(n)})})}function IK(e,t,n){let r=e.self;if(!r)return;let i=e.arguments[0];if(!i)return;let a=e.arguments[1],o=e.arguments[2],s=n===bK.Reject?a:o,c=r[SK]??[],l=c.findIndex(e=>e.msg===i);if(l<0)VK(i,t,n,s);else if(n!==bK.Reject&&a){for(let e=0;e<=l;e++)VK(c[e].msg,t,n,s);c.splice(0,l+1)}else VK(i,t,n,s),c.splice(l,1)}function LK(e){if(Object.prototype.hasOwnProperty.call(e,SK))return;e[SK]=[],e[wK]=new Map;let t=setInterval(()=>zK(e),yK);t.unref?.(),e[CK]=t,typeof e.on==`function`&&(e.on(`close`,()=>{BK(e,!0,bK.ChannelClosed,void 0),RK(e)}),e.on(`error`,()=>{BK(e,!0,bK.ChannelError,void 0),RK(e)}))}function RK(e){let t=e[CK];t&&(clearInterval(t),e[CK]=void 0)}function zK(e){let t=Lr(),n=e[SK]??[],r=0;for(;r<n.length;r++){let e=n[r];if((t-e.timeOfConsume)*1e3<yK)break;VK(e.msg,null,bK.InstrumentationTimeout,!0)}n.splice(0,r)}function BK(e,t,n,r){(e[SK]??[]).forEach(e=>{VK(e.msg,t,n,r)}),e[SK]=[]}function VK(e,t,n,r){let i=e[xK];i&&(t!==!1&&i.setStatus({code:2,message:n!==bK.ChannelClosed&&n!==bK.ChannelError?`${n} called on message${r===!0?` with requeue`:r===!1?` without requeue`:``}`:n}),i.end(),e[xK]=void 0)}function HK(e){let t=e.arguments[0],n=e.arguments[1],r=typeof t==`string`?t:``,i=typeof n==`string`?n:``,a=e.arguments[3],o=B({name:`publish ${qK(r)}`,op:`message`,kind:G.PRODUCER,attributes:{...WK(e.self),[oK]:r,[Ml]:r,[sK]:gK,[cK]:i,[mK]:i,[Fl]:vK,[fK]:a?.messageId,[Nl]:a?.messageId,[pK]:a?.correlationId,[hK]:a?.correlationId,[I]:rK}});(!a||typeof a!=`object`)&&(a={},e.arguments[3]=a);let s=a.headers&&typeof a.headers==`object`?a.headers:a.headers={},c=yp({span:o});return c[`sentry-trace`]&&(s[`sentry-trace`]=c[`sentry-trace`]),c.baggage&&(s.baggage=c.baggage),o}function UK(e,t,n){return B({name:`${e} process`,op:`message`,kind:G.CONSUMER,attributes:{...WK(n),[oK]:t.fields?.exchange,[Ml]:t.fields?.exchange,[sK]:gK,[cK]:t.fields?.routingKey,[mK]:t.fields?.routingKey,[aK]:_K,[Fl]:_K,[fK]:t.properties?.messageId,[Nl]:t.properties?.messageId,[pK]:t.properties?.correlationId,[hK]:t.properties?.correlationId,[I]:iK}})}function WK(e){let t=e?.connection,n=t?.[EK];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r==`string`&&r?{[Il]:r.toLowerCase()}:{}}function GK(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t==`string`&&t?{[Il]:t.toLowerCase()}:{}}function KK(e){let t={[uK]:`0.9.1`,[Bl]:`0.9.1`},n=e||`amqp://localhost`;if(typeof n==`object`){let e=n,r=XK(e.protocol),i=ZK(e.hostname),a=YK(e.port,r);t[lK]=r,t[zl]=r,t[ou]=i,t[su]=a,t[Gl]=i,t[Kl]=a}else if(typeof n==`string`){let e=JK(n);t[dK]=e,t[uu]=e;try{let n=new URL(e),r=XK(n.protocol),i=ZK(n.hostname),a=YK(n.port?parseInt(n.port,10):void 0,r);t[lK]=r,t[zl]=r,t[ou]=i,t[su]=a,t[Gl]=i,t[Kl]=a}catch{}}return t}function qK(e){return e===``?`<default>`:e}function JK(e){return e.replace(/:[^:@/]*@/,`:***@`)}function YK(e,t){return e||(t===`AMQP`?5672:5671)}function XK(e){let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()}function ZK(e){return e||`localhost`}function QK(e,t){let n=e?.[t];if(n!=null)return String(Array.isArray(n)?n[0]:n)}var $K=W(kK),eq=`Anthropic_AI`,tq=`auto.ai.orchestrion.anthropic`,nq=[{channel:$.ANTHROPIC_CHAT,operation:`chat`,methodPath:`messages.create`,stream:`async-iterable`},{channel:$.ANTHROPIC_MODELS,operation:`models`,methodPath:`models.retrieve`,stream:`none`},{channel:$.ANTHROPIC_MESSAGES_STREAM,operation:`chat`,methodPath:`messages.stream`,stream:`message-stream`}],rq=!1,iq=((e={})=>({name:eq,setupOnce(){w.tracingChannel&&!rq&&(rq=!0,U(()=>{for(let{channel:t,operation:n,methodPath:r,stream:i}of nq)X&&A.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),Z(w.tracingChannel(t),t=>aq(t,n,r,e),{beforeSpanEnd:(t,n)=>{Ry(t,n.result,K_(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>cq(t,n,i,e)})}))}}));function aq(e,t,n,r){let i=e.arguments??[];if(Xf(eq)||i[1]?.headers?.[`X-Stainless-Helper-Method`]===`stream`)return;let a=typeof i[0]==`object`&&i[0]!==null?i[0]:void 0,{recordInputs:o}=K_(r),s=q_(r.enableTruncation),c=Py(i,n,t),l=c[`gen_ai.request.model`]||`unknown`;c[I]=tq;let u=B({name:`${t} ${l}`,op:`gen_ai.${t}`,attributes:c});return o&&a&&Fy(u,a,s),u}function oq(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function sq(e){return!!e&&typeof e.on==`function`}function cq(e,t,n,r){let{recordOutputs:i}=K_(r),a=t.result;if(n===`async-iterable`&&oq(a)){let t=a[Symbol.asyncIterator].bind(a),n=Ay({[Symbol.asyncIterator]:t},e,i);return a[Symbol.asyncIterator]=()=>n,!0}return n===`message-stream`&&sq(a)?(jy(a,e,i),!0):!1}var lq=W(iq),uq=`auto.aws.orchestrion.aws_sdk`,dq=`dynamodb`,fq=`messaging.destination_kind`,pq=`topic`,mq=`chat`,hq=`aws.bedrock`,gq=new TextDecoder,_q=class{requestPreSpanHook(e){switch(e.commandName){case`Converse`:return this._requestPreSpanHookConverse(e,!1);case`ConverseStream`:return this._requestPreSpanHookConverse(e,!0);case`InvokeModel`:return this._requestPreSpanHookInvokeModel(e,!1);case`InvokeModelWithResponseStream`:return this._requestPreSpanHookInvokeModel(e,!0)}return{}}responseHook(e,t){let n=e.request.commandName;if(!t.isRecording()){(n===`ConverseStream`||n===`InvokeModelWithResponseStream`)&&t.end();return}switch(n){case`Converse`:return this._responseHookConverse(e,t);case`ConverseStream`:return this._responseHookConverseStream(e,t);case`InvokeModel`:return this._responseHookInvokeModel(e,t);case`InvokeModelWithResponseStream`:return this._responseHookInvokeModelWithResponseStream(e,t)}}_requestPreSpanHookConverse(e,t){let n=mq,r={[al]:hq,[qc]:mq},i=e.commandInput.modelId;i&&(r[Zc]=i,n&&(n+=` ${i}`));let a=e.commandInput.inferenceConfig;if(a){let{maxTokens:e,temperature:t,topP:n,stopSequences:i}=a;e!==void 0&&(r[Xc]=e),t!==void 0&&(r[$c]=t),n!==void 0&&(r[el]=n),i!==void 0&&(r[Qc]=i)}return{spanName:n,isStream:t,spanAttributes:r}}_requestPreSpanHookInvokeModel(e,t){let n={[al]:hq},r=e.commandInput?.modelId;if(r&&(n[Zc]=r),e.commandInput?.body){let t=JSON.parse(e.commandInput.body);r.includes(`amazon.titan`)?(t.textGenerationConfig?.temperature!==void 0&&(n[$c]=t.textGenerationConfig.temperature),t.textGenerationConfig?.topP!==void 0&&(n[el]=t.textGenerationConfig.topP),t.textGenerationConfig?.maxTokenCount!==void 0&&(n[Xc]=t.textGenerationConfig.maxTokenCount),t.textGenerationConfig?.stopSequences!==void 0&&(n[Qc]=t.textGenerationConfig.stopSequences)):r.includes(`amazon.nova`)?(t.inferenceConfig?.temperature!==void 0&&(n[$c]=t.inferenceConfig.temperature),t.inferenceConfig?.top_p!==void 0&&(n[el]=t.inferenceConfig.top_p),t.inferenceConfig?.max_new_tokens!==void 0&&(n[Xc]=t.inferenceConfig.max_new_tokens),t.inferenceConfig?.stopSequences!==void 0&&(n[Qc]=t.inferenceConfig.stopSequences)):r.includes(`anthropic.claude`)?(t.max_tokens!==void 0&&(n[Xc]=t.max_tokens),t.temperature!==void 0&&(n[$c]=t.temperature),t.top_p!==void 0&&(n[el]=t.top_p),t.stop_sequences!==void 0&&(n[Qc]=t.stop_sequences)):r.includes(`meta.llama`)?(t.max_gen_len!==void 0&&(n[Xc]=t.max_gen_len),t.temperature!==void 0&&(n[$c]=t.temperature),t.top_p!==void 0&&(n[el]=t.top_p)):r.includes(`cohere.command-r`)?(t.max_tokens!==void 0&&(n[Xc]=t.max_tokens),t.temperature!==void 0&&(n[$c]=t.temperature),t.p!==void 0&&(n[el]=t.p),t.message!==void 0&&(n[ul]=Math.ceil(t.message.length/6)),t.stop_sequences!==void 0&&(n[Qc]=t.stop_sequences)):r.includes(`cohere.command`)?(t.max_tokens!==void 0&&(n[Xc]=t.max_tokens),t.temperature!==void 0&&(n[$c]=t.temperature),t.p!==void 0&&(n[el]=t.p),t.prompt!==void 0&&(n[ul]=Math.ceil(t.prompt.length/6)),t.stop_sequences!==void 0&&(n[Qc]=t.stop_sequences)):r.includes(`mistral`)&&(t.prompt!==void 0&&(n[ul]=Math.ceil(t.prompt.length/6)),t.max_tokens!==void 0&&(n[Xc]=t.max_tokens),t.temperature!==void 0&&(n[$c]=t.temperature),t.top_p!==void 0&&(n[el]=t.top_p),t.stop!==void 0&&(n[Qc]=t.stop))}return{isStream:t,spanAttributes:n}}_responseHookConverse(e,t){let{stopReason:n,usage:r}=e.data;bq(t,n),xq(t,r)}_responseHookConverseStream(e,t){e.data.stream=yq(e.data.stream,t)}_responseHookInvokeModel(e,t){let n=e.request.commandInput?.modelId;if(e.data?.body){let r=gq.decode(e.data.body),i=JSON.parse(r);n.includes(`amazon.titan`)?(i.inputTextTokenCount!==void 0&&t.setAttribute(ul,i.inputTextTokenCount),i.results?.[0]?.tokenCount!==void 0&&t.setAttribute(dl,i.results[0].tokenCount),i.results?.[0]?.completionReason!==void 0&&t.setAttribute(tl,[i.results[0].completionReason])):n.includes(`amazon.nova`)?(i.usage!==void 0&&(i.usage.inputTokens!==void 0&&t.setAttribute(ul,i.usage.inputTokens),i.usage.outputTokens!==void 0&&t.setAttribute(dl,i.usage.outputTokens)),i.stopReason!==void 0&&t.setAttribute(tl,[i.stopReason])):n.includes(`anthropic.claude`)?(i.usage?.input_tokens!==void 0&&t.setAttribute(ul,i.usage.input_tokens),i.usage?.output_tokens!==void 0&&t.setAttribute(dl,i.usage.output_tokens),i.stop_reason!==void 0&&t.setAttribute(tl,[i.stop_reason])):n.includes(`meta.llama`)?(i.prompt_token_count!==void 0&&t.setAttribute(ul,i.prompt_token_count),i.generation_token_count!==void 0&&t.setAttribute(dl,i.generation_token_count),i.stop_reason!==void 0&&t.setAttribute(tl,[i.stop_reason])):n.includes(`cohere.command-r`)?(i.text!==void 0&&t.setAttribute(dl,Math.ceil(i.text.length/6)),i.finish_reason!==void 0&&t.setAttribute(tl,[i.finish_reason])):n.includes(`cohere.command`)?(i.generations?.[0]?.text!==void 0&&t.setAttribute(dl,Math.ceil(i.generations[0].text.length/6)),i.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(tl,[i.generations[0].finish_reason])):n.includes(`mistral`)&&(i.outputs?.[0]?.text!==void 0&&t.setAttribute(dl,Math.ceil(i.outputs[0].text.length/6)),i.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(tl,[i.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(e,t){let n=e.data?.body,r=e.request.commandInput?.modelId;if(!n||!r)return;let i=vq(r);e.data.body=(async function*(){try{for await(let e of n){if(i){let n=Sq(e?.chunk?.bytes);n&&i(n,t)}yield e}}finally{t.end()}})()}};function vq(e){if(e.includes(`amazon.titan`))return Tq;if(e.includes(`anthropic.claude`))return wq;if(e.includes(`amazon.nova`))return Cq;if(e.includes(`meta.llama`))return Eq;if(e.includes(`cohere.command-r`))return kq;if(e.includes(`cohere.command`))return Oq;if(e.includes(`mistral`))return Dq}async function*yq(e,t){try{let n;for await(let r of e)bq(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;xq(t,n)}finally{t.end()}}function bq(e,t){t!==void 0&&e.setAttribute(tl,[t])}function xq(e,t){if(t){let{inputTokens:n,outputTokens:r}=t;n!==void 0&&e.setAttribute(ul,n),r!==void 0&&e.setAttribute(dl,r)}}function Sq(e){if(!e||!(e instanceof Uint8Array))return null;try{let t=Buffer.from(e).toString(`utf-8`);return JSON.parse(t)}catch(e){return X&&A.warn(`[orchestrion:aws-sdk] failed to parse streamed bedrock chunk`,e),null}}function Cq(e,t){e.metadata?.usage!==void 0&&(e.metadata?.usage.inputTokens!==void 0&&t.setAttribute(ul,e.metadata.usage.inputTokens),e.metadata?.usage.outputTokens!==void 0&&t.setAttribute(dl,e.metadata.usage.outputTokens)),e.messageStop?.stopReason!==void 0&&t.setAttribute(tl,[e.messageStop.stopReason])}function wq(e,t){e.message?.usage?.input_tokens!==void 0&&t.setAttribute(ul,e.message.usage.input_tokens),e.message?.usage?.output_tokens!==void 0&&t.setAttribute(dl,e.message.usage.output_tokens),e.delta?.stop_reason!==void 0&&t.setAttribute(tl,[e.delta.stop_reason])}function Tq(e,t){e.inputTextTokenCount!==void 0&&t.setAttribute(ul,e.inputTextTokenCount),e.totalOutputTextTokenCount!==void 0&&t.setAttribute(dl,e.totalOutputTextTokenCount),e.completionReason!==void 0&&t.setAttribute(tl,[e.completionReason])}function Eq(e,t){e.prompt_token_count!==void 0&&t.setAttribute(ul,e.prompt_token_count),e.generation_token_count!==void 0&&t.setAttribute(dl,e.generation_token_count),e.stop_reason!==void 0&&t.setAttribute(tl,[e.stop_reason])}function Dq(e,t){e.outputs?.[0]?.text!==void 0&&t.setAttribute(dl,Math.ceil(e.outputs[0].text.length/6)),e.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(tl,[e.outputs[0].stop_reason])}function Oq(e,t){e.generations?.[0]?.text!==void 0&&t.setAttribute(dl,Math.ceil(e.generations[0].text.length/6)),e.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(tl,[e.generations[0].finish_reason])}function kq(e,t){e.text!==void 0&&t.setAttribute(dl,Math.ceil(e.text.length/6)),e.finish_reason!==void 0&&t.setAttribute(tl,[e.finish_reason])}function Aq(e){return Array.isArray(e)?e:[e]}var jq=class{requestPreSpanHook(e){let t=e.commandName,n=e.commandInput?.TableName,r={};return r[Pc]=dq,r[Dc]=n,r[kc]=t,e.commandInput?.TableName?r[pc]=[e.commandInput.TableName]:e.commandInput?.RequestItems&&(r[pc]=Object.keys(e.commandInput.RequestItems)),(t===`CreateTable`||t===`UpdateTable`)&&e.commandInput?.ProvisionedThroughput&&(r[oc]=e.commandInput.ProvisionedThroughput.ReadCapacityUnits,r[sc]=e.commandInput.ProvisionedThroughput.WriteCapacityUnits),(t===`GetItem`||t===`Scan`||t===`Query`)&&e.commandInput?.ConsistentRead&&(r[Ys]=e.commandInput.ConsistentRead),(t===`Query`||t===`Scan`)&&e.commandInput?.ProjectionExpression&&(r[ac]=e.commandInput.ProjectionExpression),t===`CreateTable`&&(e.commandInput?.GlobalSecondaryIndexes&&(r[$s]=Aq(e.commandInput.GlobalSecondaryIndexes).map(e=>JSON.stringify(e))),e.commandInput?.LocalSecondaryIndexes&&(r[ic]=Aq(e.commandInput.LocalSecondaryIndexes).map(e=>JSON.stringify(e)))),(t===`ListTables`||t===`Query`||t===`Scan`)&&e.commandInput?.Limit&&(r[rc]=e.commandInput.Limit),t===`ListTables`&&e.commandInput?.ExclusiveStartTableName&&(r[Qs]=e.commandInput.ExclusiveStartTableName),t===`Query`&&(e.commandInput?.ScanIndexForward&&(r[lc]=e.commandInput.ScanIndexForward),e.commandInput?.IndexName&&(r[tc]=e.commandInput.IndexName),e.commandInput?.Select&&(r[dc]=e.commandInput.Select)),t===`Scan`&&(e.commandInput?.Segment&&(r[uc]=e.commandInput?.Segment),e.commandInput?.TotalSegments&&(r[mc]=e.commandInput?.TotalSegments),e.commandInput?.IndexName&&(r[tc]=e.commandInput.IndexName),e.commandInput?.Select&&(r[dc]=e.commandInput.Select)),t===`UpdateTable`&&(e.commandInput?.AttributeDefinitions&&(r[Js]=Aq(e.commandInput.AttributeDefinitions).map(e=>JSON.stringify(e))),e.commandInput?.GlobalSecondaryIndexUpdates&&(r[ec]=Aq(e.commandInput.GlobalSecondaryIndexUpdates).map(e=>JSON.stringify(e)))),{spanAttributes:r,spanKind:G.CLIENT,spanOp:`db`}}responseHook(e,t){e.data?.ConsumedCapacity&&t.setAttribute(Xs,Aq(e.data.ConsumedCapacity).map(e=>JSON.stringify(e))),e.data?.ItemCollectionMetrics&&t.setAttribute(nc,Aq(e.data.ItemCollectionMetrics).map(e=>JSON.stringify(e))),e.data?.TableNames&&t.setAttribute(fc,e.data?.TableNames.length),e.data?.Count&&t.setAttribute(Zs,e.data?.Count),e.data?.ScannedCount&&t.setAttribute(cc,e.data?.ScannedCount)}},Mq=class{requestPreSpanHook(e){let t=e.commandInput?.StreamName,n={};return t&&(n[hc]=t),{spanAttributes:n,spanKind:G.CLIENT}}},Nq=`Invoke`,Pq=class{requestPreSpanHook(e){let t=e.commandInput?.FunctionName,n={},r;return e.commandName===Nq&&(n[zc]=t,n[Bc]=`aws`,r=`${t} ${Nq}`),{spanAttributes:n,spanKind:G.CLIENT,spanName:r}}requestPostSpanHook(e,t){e.commandName===Nq&&e.commandInput&&(e.commandInput.ClientContext=Fq(e.commandInput.ClientContext,t))}responseHook(e,t){e.request.commandName===Nq&&(t.setAttribute(Rc,e.requestId),e.request.region&&t.setAttribute(Vc,e.request.region))}};function Fq(e,t){try{let n=yp({span:t}),r=e?JSON.parse(Buffer.from(e,`base64`).toString(`utf8`)):{},i={...r,custom:{...r.custom,...n}},a=Buffer.from(JSON.stringify(i)).toString(`base64`);return a.length>3583?(X&&A.warn(`[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations.`),e):a}catch(t){return X&&A.log(`[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext`,t),e}}var Iq=class{requestPreSpanHook(e){let t=e.commandInput?.Bucket,n={};return t&&(n[vc]=t),{spanAttributes:n,spanKind:G.CLIENT}}},Lq=class{requestPreSpanHook(e){let t=e.commandInput?.SecretId,n={};return typeof t==`string`&&t.startsWith(`arn:aws:secretsmanager:`)&&(n[yc]=t),{spanAttributes:n,spanKind:G.CLIENT}}responseHook(e,t){let n=e.data?.ARN;n&&t.setAttribute(yc,n)}},Rq=`sentry-trace`,zq=`baggage`,Bq=[Rq,zq];function Vq(e,t){let n=e??{},r=Object.keys(t);if(Object.keys(n).length+r.length<=10)for(let e of r){let r=t[e];r&&(n[e]={DataType:`String`,StringValue:r})}else X&&A.warn(`[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes`);return n}function Hq(e){let t=e.MessageAttributes??{},n=t[Rq]?.StringValue??t[Rq]?.Value;if(n)return{sentryTrace:n,baggage:t[zq]?.StringValue??t[zq]?.Value}}function Uq(e=[]){return Tp([...e,...Bq])}var Wq=class{requestPreSpanHook(e){let t=G.CLIENT,n=`SNS ${e.commandName}`,r={[Il]:`aws.sns`};if(e.commandName===`Publish`){t=G.PRODUCER,r[fq]=pq;let{TopicArn:i,TargetArn:a,PhoneNumber:o}=e.commandInput,s=Gq(i,a,o);r[jl]=s,r[Ml]=i||a||o||`unknown`,n=`${o?`phone_number`:s} send`}let i=e.commandInput?.TopicArn;return i&&(r[bc]=i),{spanAttributes:r,spanKind:t,spanName:n}}requestPostSpanHook(e,t){if(e.commandName===`Publish`){let n=e.commandInput.MessageAttributes??{};e.commandInput.MessageAttributes=Vq(n,yp({span:t}))}}responseHook(e,t){let n=e.data?.TopicArn;n&&t.setAttribute(bc,n)}};function Gq(e,t,n){if(e||t){let n=e??t;try{return n.substring(n.lastIndexOf(`:`)+1)}catch{return n}}return n||`unknown`}var Kq=class{requestPreSpanHook(e){let t=Jq(e.commandInput),n=Yq(t),r=G.CLIENT,i,a={[Il]:`aws_sqs`,[Ml]:n,[uu]:t};switch(e.commandName){case`ReceiveMessage`:r=G.CONSUMER,i=`${n} receive`,a[Fl]=`receive`,e.commandInput.MessageAttributeNames=Uq(e.commandInput.MessageAttributeNames);break;case`SendMessage`:case`SendMessageBatch`:r=G.PRODUCER,i=`${n} send`}return{spanAttributes:a,spanKind:r,spanName:i}}requestPostSpanHook(e,t){switch(e.commandName){case`SendMessage`:{let n=e.commandInput.MessageAttributes??{};e.commandInput.MessageAttributes=Vq(n,yp({span:t}))}break;case`SendMessageBatch`:{let n=e.commandInput?.Entries;if(Array.isArray(n)){let e=yp({span:t});n.forEach(t=>{t.MessageAttributes=Vq(t.MessageAttributes??{},e)})}}}}responseHook(e,t){switch(e.request.commandName){case`SendMessage`:t.setAttribute(Nl,e?.data?.MessageId);break;case`SendMessageBatch`:break;case`ReceiveMessage`:{let n=e?.data?.Messages||[];t.setAttribute(Al,n.length);for(let e of n)qq(t,e);break}}}};function qq(e,t){let n=Hq(t);if(!n)return;let{parentSpanId:r,traceId:i,sampled:a}=wa(n.sentryTrace,n.baggage);i&&r&&e.addLink({context:{traceId:i,spanId:r,traceFlags:+!!a},attributes:{[Nl]:t.MessageId}})}function Jq(e){return e?.QueueUrl}function Yq(e){if(!e)return;let t=e.split(`/`);if(t.length!==0)return t[t.length-1]}var Xq=class{requestPreSpanHook(e){let t=e.commandInput?.stateMachineArn,n=e.commandInput?.activityArn,r={};return t&&(r[Sc]=t),n&&(r[xc]=n),{spanAttributes:r,spanKind:G.CLIENT}}},Zq=class{constructor(){this._services=new Map([[`SecretsManager`,new Lq],[`SFN`,new Xq],[`SQS`,new Kq],[`SNS`,new Wq],[`DynamoDB`,new jq],[`Lambda`,new Pq],[`S3`,new Iq],[`Kinesis`,new Mq],[`BedrockRuntime`,new _q]])}requestPreSpanHook(e){let t=this._services.get(e.serviceName);return t?t.requestPreSpanHook(e):{}}requestPostSpanHook(e,t){this._services.get(e.serviceName)?.requestPostSpanHook?.(e,t)}responseHook(e,t){this._services.get(e.request.serviceName)?.responseHook?.(e,t)}};function Qq(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function $q(e,t,n,r){return{serviceName:e?.replace(/\s+/g,``),commandName:Qq(t,`Command`),commandInput:n,region:r}}function eJ(e){return{[Zl]:`aws-api`,[Yl]:e.commandName,[Xl]:e.serviceName,[wc]:e.region}}var tJ=`Aws`;function nJ(e){try{return e()}catch(e){X&&A.warn(`[orchestrion:aws-sdk] error building span`,e);return}}function rJ(e,t){t&&(t.requestId&&e.setAttribute(_c,t.requestId),t.httpStatusCode&&e.setAttribute(wl,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(gc,t.extendedRequestId))}var iJ=W((()=>{let e=new Zq;return{name:tJ,setupOnce(){if(!w.tracingChannel)return;let t=t=>nJ(()=>{let n=t.arguments[0],r=n?.constructor?.name;if(!n||!r)return;let i=t.self?.config,a=i?.serviceId??Qq(t.self?.constructor?.name||`AWS`,`Client`);n.input||={};let o=$q(a,r,n.input,void 0),s=e.requestPreSpanHook(o),c=B({name:s.spanName??`${o.serviceName}.${o.commandName}`,kind:s.spanKind??G.CLIENT,op:s.spanOp||`rpc`,attributes:{[I]:uq,...eJ(o),...s.spanAttributes}});t._sentryNormalizedRequest=o,t._sentryRequestMetadata=s;let l;try{l=i?.region?.()}catch{}let u={settled:!1,promise:Promise.resolve(l).then(e=>{e&&(o.region=e,c.setAttribute(wc,e))}).catch(()=>{}).finally(()=>{u.settled=!0})};return t._sentryRegion=u,nJ(()=>e.requestPostSpanHook(o,c)),c}),n={deferSpanEnd({span:t,data:n,end:r}){let i=n._sentryNormalizedRequest,a=n._sentryRequestMetadata;if(!i)return!1;let o=`error`in n;if(nJ(()=>{if(o){let e=n.error,r=e?.$metadata;rJ(t,{requestId:e?.RequestId??r?.requestId,httpStatusCode:r?.httpStatusCode,extendedRequestId:e?.extendedRequestId??r?.extendedRequestId});return}let r=n.result;rJ(t,r?.$metadata);let a={data:r,request:i,requestId:r?.$metadata?.requestId};e.responseHook(a,t)}),a?.isStream&&!o)return!0;let s=n._sentryRegion;return s&&!s.settled?(s.promise.then(()=>r()),!0):!1}},r=[$.AWS_SMITHY_CORE_SEND,$.AWS_SMITHY_CLIENT_SEND,$.AWS_SDK_SMITHY_CLIENT_SEND];X&&A.log(`[orchestrion:aws-sdk] subscribing to channels "${r.join(`", "`)}"`),U(()=>{for(let e of r)Z(w.tracingChannel(e),t,n)})}}})),aJ=`Dataloader`,oJ=`dataloader`,sJ=`auto.db.orchestrion.dataloader`,cJ=`cache.get`,lJ=Symbol(`sentry.dataloader.wrapped`);function uJ(e,t){let n=e?.name;return n?`${oJ}.${t} ${n}`:`${oJ}.${t}`}function dJ(e){return Array.isArray(e)?e.map(e=>String(e)):e==null?void 0:[String(e)]}function fJ(e,t,n){let r=t===`load`||t===`loadMany`||t===`batch`;return{name:uJ(e,t),kind:t===`batch`?void 0:G.CLIENT,op:r?cJ:void 0,onlyIfParent:!0,attributes:{[I]:sJ,[Cc]:r?dJ(n):void 0}}}var pJ=(()=>({name:aJ,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:dataloader] subscribing to dataloader tracing channels`),U(()=>{mJ(),hJ(),gJ($.DATALOADER_LOAD_MANY,`loadMany`),gJ($.DATALOADER_PRIME,`prime`),gJ($.DATALOADER_CLEAR,`clear`),gJ($.DATALOADER_CLEAR_ALL,`clearAll`)}))}}));function mJ(){w.tracingChannel($.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!=`function`||n[lJ])return;let r=n,i=function(...e){return z({...fJ(this,`batch`,e[0]),links:this._batch?.spanLinks},()=>r.apply(this,e))};i[lJ]=!0,t.arguments[0]=i})}function hJ(){let e=w.tracingChannel($.DATALOADER_LOAD);Z(e,e=>_J(e.self,`load`,e.arguments[0]),{requiresParentSpan:!0}),e.end.subscribe(e=>{let t=e,n=t._sentrySpan,r=t.self?._batch;n&&r&&n.isRecording()&&(r.spanLinks??=[]).push({context:n.spanContext()})})}function gJ(e,t){Z(w.tracingChannel(e),e=>_J(e.self,t,e.arguments[0]),{requiresParentSpan:!0})}function _J(e,t,n){return B(fJ(e,t,n))}var vJ=W(pJ),yJ=`GenericPool`,bJ=W((()=>({name:yJ,setupOnce(){w.tracingChannel&&U(()=>xJ())}})));function xJ(){Z(w.tracingChannel($.GENERIC_POOL_ACQUIRE),()=>B({name:`generic-pool.acquire`,attributes:{[I]:`auto.db.orchestrion.generic_pool`}}))}var SJ=`Google_GenAI`,CJ=`auto.ai.orchestrion.google_genai`,wJ=[{channel:$.GOOGLE_GENAI_GENERATE_CONTENT,operation:`generate_content`},{channel:$.GOOGLE_GENAI_EMBED_CONTENT,operation:`embeddings`},{channel:$.GOOGLE_GENAI_CHAT,operation:`chat`}],TJ=!1,EJ=((e={})=>({name:SJ,setupOnce(){w.tracingChannel&&!TJ&&(TJ=!0,U(()=>{for(let{channel:t,operation:n}of wJ)X&&A.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),Z(w.tracingChannel(t),t=>DJ(t,n,e),{beforeSpanEnd:(t,r)=>{n!==`embeddings`&&rb(t,r.result,K_(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>kJ(t,n,e)})}))}}));function DJ(e,t,n){if(Xf(SJ))return;if(t!==`chat`){let e=R();if(e){let{op:t,origin:n}=L(e);if(n===CJ&&t===`gen_ai.chat`)return}}let r=(e.arguments??[])[0],{recordInputs:i}=K_(n),a=q_(n.enableTruncation),o=tb(t,r,e.self),s=o[`gen_ai.request.model`]||`unknown`;o[I]=CJ;let c=B({name:`${t} ${s}`,op:`gen_ai.${t}`,attributes:o});return i&&r&&nb(c,r,t,a),c}function OJ(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function kJ(e,t,n){let r=t.result;if(!OJ(r))return!1;let{recordOutputs:i}=K_(n),a=r[Symbol.asyncIterator].bind(r),o=Zy({[Symbol.asyncIterator]:a},e,i??!1);return r[Symbol.asyncIterator]=()=>o,!0}var AJ=W(EJ),jJ=`auto.graphql.diagnostic_channel`,MJ=`graphql.parse`,NJ=`graphql.validate`,PJ=`graphql.execute`,FJ=`graphql.resolve`,IJ=`graphql.field.name`,LJ=`graphql.field.path`,RJ=`graphql.field.type`,zJ=`graphql.parent.name`,BJ=Symbol.for(`opentelemetry.graphql_data`),VJ=Symbol.for(`opentelemetry.patched`);function HJ(e){return typeof e?.then==`function`}function UJ(e,t){if(!e||e[VJ])return;e[VJ]=!0;let n=e.getFields();Object.keys(n).forEach(e=>{let r=n[e];if(r&&(r.resolve&&=WJ(t,r.resolve),r.type))for(let e of QJ(r.type))UJ(e,t)})}function WJ(e,t,n=!1){if(typeof t!=`function`||t[VJ])return t;function r(r,i,a,o){if(!t)return;let s=a??{};if(e().ignoreTrivialResolveSpans&&n&&(j(r)||typeof r==`function`)&&typeof r[o.fieldName]!=`function`||!s[BJ])return t.call(this,r,i,s,o);let{field:c,spanAdded:l}=KJ(s,o,ZJ(o.path)),u=c.span;return V(u,()=>{try{let e=t.call(this,r,i,s,o);return HJ(e)?e.then(e=>(GJ(u,l),e),e=>{throw GJ(u,l,e),e}):(GJ(u,l),e)}catch(e){throw GJ(u,l,e),e}})}return r[VJ]=!0,r}function GJ(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function KJ(e,t,n){let r=YJ(e,n);if(r)return{field:r,spanAdded:!1};let i={span:qJ(t,n,XJ(e,n))};return JJ(e,n,i),{field:i,spanAdded:!0}}function qJ(e,t,n){let r={[I]:jJ,[F]:hP,[IJ]:e.fieldName,[LJ]:t.join(`.`),[RJ]:e.returnType.toString(),[zJ]:e.parentType.name};return B({name:`${FJ} ${t.join(`.`)}`,attributes:r,parentSpan:n})}function JJ(e,t,n){let r=e[BJ];r&&(r.fields[t.join(`.`)]=n)}function YJ(e,t){return e[BJ]?.fields[t.join(`.`)]}function XJ(e,t){for(let n=t.length-1;n>0;n--){let r=YJ(e,t.slice(0,n));if(r)return r.span}return e[BJ]?.span}function ZJ(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function QJ(e){return`ofType`in e&&e.ofType?QJ(e.ofType):$J(e)?e.getTypes():eY(e)?[e]:[]}function $J(e){return`getTypes`in e&&typeof e.getTypes==`function`}function eY(e){return`getFields`in e&&typeof e.getFields==`function`}function tY(e,t){let n=e?.definitions;if(!n||!Array.isArray(n))return;let r=e=>!!e?.operation&&[`query`,`mutation`,`subscription`].indexOf(e.operation)!==-1;return t?n.filter(r).find(e=>t===e?.name?.value):n.find(r)}var nY={[I]:jJ,[F]:hP};function rY(){return B({name:MJ,attributes:{...nY}})}function iY(e){return B({name:NJ,attributes:{...nY,[pl]:DP(e)}})}function aY(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:`invalid_argument`})}function oY(e){if(e.length>=2)return{schema:e[0],document:e[1],contextValue:e[3]??{},operationName:e[5],fieldResolver:e[6],writeBack:(t,n)=>{e[3]=t,e[6]=n}};let t=e[0]??{};return{schema:t.schema,document:t.document,contextValue:t.contextValue??{},operationName:t.operationName,fieldResolver:t.fieldResolver,writeBack:(e,n)=>{t.contextValue=e,t.fieldResolver=n}}}function sY(e,t,n,r){let i=oY(e),{schema:a,document:o}=i,{contextValue:s,fieldResolver:c}=i,l=!!s[BJ];if(!n.ignoreResolveSpans&&!l){let e=c==null,n=t?.defaultFieldResolver,i=c??n;i&&(c=WJ(r,i,e)),a&&(UJ(a.getQueryType(),r),UJ(a.getMutationType(),r))}let u=tY(o,i.operationName),d=u?.operation,f=u?.name?.value??i.operationName??void 0,p=B({name:wP(d,f||void 0,PJ),attributes:{...nY,[hl]:d,[ml]:f||void 0,[pl]:DP(o)}});return n.useOperationNameForRootSpan&&d&&SP(p,d,f||void 0),s[BJ]={source:o,span:p,fields:{}},i.writeBack(s,c),p}function cY(e,t){TP(t)&&e.setStatus({code:2,message:`internal_error`})}var lY=`Graphql`;function uY(e){return{ignoreResolveSpans:e.ignoreResolveSpans!==!1,ignoreTrivialResolveSpans:e.ignoreTrivialResolveSpans!==!1,useOperationNameForRootSpan:e.useOperationNameForRootSpan!==!1}}function dY(e){try{return e()}catch(e){X&&A.warn(`[orchestrion:graphql] error building span`,e);return}}var fY=W(((e={})=>{let t=uY(e),n=()=>t;return{name:lY,setupOnce(){w.tracingChannel&&U(()=>{Z(w.tracingChannel($.GRAPHQL_PARSE),()=>dY(()=>rY())),Z(w.tracingChannel($.GRAPHQL_VALIDATE),e=>dY(()=>iY(e.arguments[1])),{beforeSpanEnd:(e,t)=>void dY(()=>aY(e,t.result))}),Z(w.tracingChannel($.GRAPHQL_EXECUTE),e=>dY(()=>sY(e.arguments,e.self,t,n)),{beforeSpanEnd:(e,t)=>void dY(()=>cY(e,t.result))})})}}})),pY=e=>{let t=fY(e);return Ed(JP(e),{name:lY,setupOnce:()=>t.setupOnce?.()})},mY=[`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`],hY=Symbol(`hapi-handler-patched`),gY={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},_Y=new Set(mY),vY=(e=>(e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`,e))(vY||{});function yY(e){let t=R();if(!t)return;let n=Za(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(Sl,e)}var bY=e=>typeof e==`string`&&_Y.has(e),xY=e=>{let t=e?.type;return t!==void 0&&bY(t)},SY=e=>Array.isArray(e)&&e.length<=3&&bY(e[0])&&typeof e[1]==`function`,CY=e=>!Array.isArray(e),wY=(e,t)=>{let n={[Sl]:e.path,[yl]:e.method},r;return t?(n[vY.HAPI_TYPE]=gY.PLUGIN,n[vY.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[vY.HAPI_TYPE]=gY.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},TY=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[vY.EXT_TYPE]:e,[vY.HAPI_TYPE]:gY.EXT,[vY.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[vY.EXT_TYPE]:e,[vY.HAPI_TYPE]:gY.EXT},name:r}};function EY(e,t){return z({name:e.name,op:`${e.attributes[vY.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[I]:`auto.http.orchestrion.hapi`}},t)}function DY(e,t){if(e[hY]===!0)return e;e[hY]=!0;let n=n=>function(...r){return R()?(yY(e.path),EY(wY(e,t),()=>n.call(this,...r))):n.call(this,...r)};if(typeof e.handler==`function`)e.handler=n(e.handler);else if(typeof e.options==`function`){let t=e.options;e.options=function(e){let r=t(e);return typeof r.handler==`function`&&(r.handler=n(r.handler)),r}}else typeof e.options?.handler==`function`&&(e.options.handler=n(e.options.handler));return e}function OY(e,t,n){if(Array.isArray(e)){for(let n=0;n<e.length;n++)e[n]=OY(e[n],t);return e}if(CY(e)){if(e[hY]===!0)return e;e[hY]=!0;let r=function(...r){return R()?EY(TY(t,n,e.name),()=>e.apply(void 0,r)):e.apply(this,r)};return r[hY]=!0,r}return e}function kY(e,t){let n=e[0];if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=DY(n[e],t);else e[0]=DY(n,t)}function AY(e,t){if(Array.isArray(e[0])){let n=e[0];for(let e=0;e<n.length;e++){let r=n[e];if(bY(r.type)){let i=r;i.method=OY(i.method,r.type,t),n[e]=i}}return}if(SY(e)){let n=e,r=n[1];e[1]=OY(r,n[0],t);return}if(xY(e[0])){let n=e[0];n.method=OY(n.method,n.type,t)}}var jY=`Hapi`,MY=W((()=>({name:jY,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:hapi] subscribing to channels "${$.HAPI_ROUTE}" / "${$.HAPI_EXT}"`),w.tracingChannel($.HAPI_ROUTE).subscribe({start(e){let t=e;kY(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),w.tracingChannel($.HAPI_EXT).subscribe({start(e){let t=e;AY(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}))),NY=`Koa`,PY=`auto.http.orchestrion.koa`,FY={ROUTER:`router`,MIDDLEWARE:`middleware`},IY=Symbol(`sentry.koa.layer-patched`),LY=!1,RY=((e={})=>{let t=e.ignoreLayersType??[];return{name:NY,setupOnce(){w.tracingChannel&&!LY&&(LY=!0,X&&A.log(`[orchestrion:koa] subscribing to channel "${$.KOA_USE}"`),w.tracingChannel($.KOA_USE).subscribe({start(e){zY(e,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function zY(e,t){let n=e.arguments[0];typeof n==`function`&&(e.arguments[0]=BY(n,t))}function BY(e,t){return e.router?VY(e,t):HY(e,!1,t)}function VY(e,t){let n=e.router?.stack??[];for(let e of n){let n=e.path,r=e.stack;r.forEach((e,i)=>{r[i]=HY(e,!0,t,n)})}return e}function HY(e,t,n,r){let i=t?FY.ROUTER:FY.MIDDLEWARE;return e[IY]===!0||n.includes(i)||e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?e:(e[IY]=!0,(n,a)=>{if(!R())return e(n,a);let o=UY(n,e,t,r);n._matchedRoute&&WY(n._matchedRoute.toString());let s=o.attributes[Ol];return z({name:typeof s==`string`?s||`< unknown >`:o.name,op:`${i}.koa`,attributes:{...o.attributes,[I]:PY}},()=>{let t=o.attributes[Sl];if(N()===$r())X&&A.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);else if(t){let e=n.request?.method?.toUpperCase()||`GET`;N().setTransactionName(`${e} ${t}`)}return e(n,a)})})}function UY(e,t,n,r){return n?{attributes:{[Ol]:r?.toString(),[kl]:FY.ROUTER,[Sl]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[Ol]:t.name||`middleware`,[kl]:FY.MIDDLEWARE,[Tc]:t.name||`middleware`},name:`middleware - ${t.name}`}}function WY(e){let t=R();if(!t)return;let n=Za(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(Sl,e)}var GY=W(RY),KY=`IORedis`,qY=`auto.db.orchestrion.redis`,JY=`db.connection_string`;function YY(e){return{host:e?.options?.host,port:e?.options?.port}}function XY(e,t){return{[Pc]:`redis`,[JY]:`redis://${e}:${t}`,[Gl]:e,[Kl]:t,[I]:qY}}var ZY=new WeakSet;function QY(e){let t=e.arguments?.[0];if(!t||typeof t!=`object`||ZY.has(t))return;ZY.add(t);let{host:n,port:r}=YY(e.self),i=wI(t.name,t.args??[]);return B({name:i,op:`db`,attributes:{...XY(n,r),[Nc]:i}})}var $Y=((e={})=>{let t=e.responseHook;return{name:KY,setupOnce(){if(!w.tracingChannel)return;X&&A.log(`[orchestrion:ioredis] subscribing to "${$.IOREDIS_COMMAND}"/"${$.IOREDIS_CONNECT}"`);let e=w.tracingChannel($.IOREDIS_COMMAND),n=w.tracingChannel($.IOREDIS_CONNECT);U(()=>{Z(e,QY,{requiresParentSpan:!0,beforeSpanEnd(e,n){if(`error`in n||!t)return;let r=n.arguments?.[0];r&&eX(t,e,r,n.result)}}),Z(n,e=>{let{host:t,port:n}=YY(e.self);return B({name:`connect`,op:`db`,attributes:{...XY(t,n),[Nc]:`connect`}})},{requiresParentSpan:!0})})}}});function eX(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var tX=W($Y),nX=`messaging.destination.partition.id`,rX=`messaging.kafka.message.key`,iX=`messaging.kafka.message.tombstone`,aX=`messaging.kafka.offset`,oX=`process`,sX=`receive`,cX=`send`,lX=`kafka`,uX=`_OTHER`,dX=`auto.kafkajs.orchestrion.producer`,fX=`auto.kafkajs.orchestrion.consumer`,pX=1,mX=0;function hX(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function gX(e){let t=hX(e,`sentry-trace`);if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=wa(t,hX(e,`baggage`));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?pX:mX}}]}function _X({topic:e,message:t,operationType:n,links:r,attributes:i}){let a=n===`receive`?`poll`:n;return B({name:`${a} ${e}`,op:`message`,kind:n===`receive`?G.CLIENT:G.CONSUMER,links:r,attributes:{...i,[Il]:lX,[Ml]:e,[Fl]:n,[Pl]:a,[rX]:t?.key?String(t.key):void 0,[iX]:t?.key&&t.value===null?!0:void 0,[aX]:t?.offset,...t?{[I]:fX}:{}}})}function vX(e,t){let n=B({name:`send ${e}`,op:`message`,kind:G.PRODUCER,attributes:{[Il]:lX,[Ml]:e,[rX]:t.key?String(t.key):void 0,[iX]:t.key&&t.value===null?!0:void 0,[nX]:t.partition===void 0?void 0:String(t.partition),[Pl]:`send`,[Fl]:cX,[I]:dX}});t.headers=t.headers??{};let r=yp({span:n});return r[`sentry-trace`]&&(t.headers[`sentry-trace`]=r[`sentry-trace`]),r.baggage&&(t.headers.baggage=r.baggage),n}function yX(e,t){let n,r=uX;typeof t==`string`||t===void 0?n=t:typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(t,`message`)&&(n=t.message,r=t.constructor.name),e.forEach(e=>{e.setAttribute(Lc,r),e.setStatus({code:2,message:n})})}function bX(e,t){return Promise.resolve(t).catch(t=>{throw yX(e,t),t}).finally(()=>{e.forEach(e=>e.end())})}var xX=Symbol(`sentry-kafkajs-consumer-callback-wrapped`);function SX(e){return typeof e==`function`&&e[xX]===!0}function CX(e){let t=function(t){return is({sentryTrace:hX(t.message.headers,`sentry-trace`),baggage:hX(t.message.headers,`baggage`)},()=>{let n=_X({topic:t.topic,message:t.message,operationType:oX,attributes:{[nX]:String(t.partition)}}),r=V(n,()=>e.call(this,t));return bX([n],r)})};return t[xX]=!0,t}function wX(e){let t=function(t){let n=ss(()=>_X({topic:t.batch.topic,message:void 0,operationType:sX,attributes:{[Al]:t.batch.messages.length,[nX]:String(t.batch.partition)}}));return V(n,()=>{let r=[n];return t.batch.messages.forEach(e=>{r.push(_X({topic:t.batch.topic,message:e,operationType:oX,links:gX(e.headers),attributes:{[nX]:String(t.batch.partition)}}))}),bX(r,e.call(this,t))})};return t[xX]=!0,t}var TX=`Kafka`;function EX(){w.tracingChannel($.KAFKAJS_SEND_BATCH).subscribe({start(e){let t=[];(e.arguments[0]?.topicMessages??[]).forEach(e=>{e.messages.forEach(n=>{t.push(vX(e.topic,n))})}),e._sentrySpans=t},error(e){e._sentrySpans&&yX(e._sentrySpans,e.error)},asyncEnd(e){e._sentrySpans?.forEach(e=>e.end())}})}function DX(){w.tracingChannel($.KAFKAJS_CONSUMER_RUN).subscribe({start(e){let t=e.arguments[0];t&&typeof t==`object`&&(typeof t.eachMessage==`function`&&!SX(t.eachMessage)&&(t.eachMessage=CX(t.eachMessage)),typeof t.eachBatch==`function`&&!SX(t.eachBatch)&&(t.eachBatch=wX(t.eachBatch)))}})}var OX=W((()=>({name:TX,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:kafkajs] subscribing to channels "${$.KAFKAJS_SEND_BATCH}", "${$.KAFKAJS_CONSUMER_RUN}"`),EX(),DX())}}))),kX=`Knex`,AX=`auto.db.orchestrion.knex`,jX=1021,MX=`db.sql.table`,NX=`sqlite`,PX=`postgresql`,FX=Symbol(`sentry.orchestrion.knex.parent-span`),IX=(()=>({name:kX,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:knex] subscribing to channel "${$.KNEX_QUERY}"`),U(()=>{LX($.KNEX_QUERY_BUILDER),LX($.KNEX_SCHEMA_BUILDER),LX($.KNEX_RAW),RX()}))}}));function LX(e){w.tracingChannel(e).end.subscribe(e=>{let t=e.result;if(!t||typeof t!=`object`||FX in t)return;let n=R();n&&Object.defineProperty(t,FX,{value:n})})}function RX(){Z(w.tracingChannel($.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[FX]??R();if(!r)return;let i=e.arguments[0],a=t?.client,o=a?.config?.connection,s=o?.connectionString,c=UX(n),l=i?.method,u=o?.filename||o?.database||WX(s),d={[I]:AX,"knex.version":e.moduleVersion,[Pc]:VX(a?.driverName),[MX]:c,[kc]:l,[Ic]:o?.user,[Dc]:u,[Gl]:o?.host??GX(s),[Kl]:o?.port??KX(s),[ql]:o?.filename===`:memory:`?`inproc`:void 0,[Nc]:i?.sql==null?void 0:hr(i.sql,jX)};return B({name:HX(u,l,c)??`knex.query`,kind:G.CLIENT,op:`db`,parentSpan:r,attributes:d})},{beforeSpanEnd(e,t){if(`error`in t){let n=zX(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function zX(e){let t=e.error;if(!t||typeof t!=`object`||typeof t.message!=`string`)return;let n=t.message,r=e.arguments[0];if(!r?.sql)return n;try{let t=BX(e.self)(r.sql,r.bindings||[]);return n.replace(`${t} - `,``)}catch{return n}}function BX(e){if(e){let t=e.client;if(t){if(t._formatQuery)return t._formatQuery.bind(t);if(t.SqlString)return t.SqlString.format.bind(t.SqlString)}if(e.builder?.toString)return e.builder.toString.bind(e.builder)}return()=>`<noop formatter>`}function VX(e){return e===`sqlite3`?NX:e===`pg`?PX:e}function HX(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function UX(e){let t=e?._single?.table;return t&&typeof t==`object`?UX(t):typeof t==`string`?t:void 0}function WX(e){if(e)try{return new URL(e).pathname?.replace(/^\//,``)||void 0}catch{return}}function GX(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function KX(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var qX=W(IX),JX=sb,YX=[$v,_y,Wy],XX=!1;function ZX(){Yf(YX)}var QX=((e={})=>({name:JX,setupOnce(){if(!w.tracingChannel||XX)return;XX=!0;let t=Ab(e),n=e=>{ZX();let n=e.arguments;if(!Array.isArray(n))return;let r=n[1];(!r||typeof r!=`object`||Array.isArray(r))&&(r={},n[1]=r),r.callbacks=kb(r.callbacks,t)};for(let e of[$.LANGCHAIN_CHAT_MODEL_INVOKE,$.LANGCHAIN_CHAT_MODEL_STREAM])X&&A.log(`[orchestrion:langchain] subscribing to channel "${e}"`),w.tracingChannel(e).start.subscribe(n);U(()=>{for(let t of $W)X&&A.log(`[orchestrion:langchain] subscribing to channel "${t}"`),Z(w.tracingChannel(t),t=>$X(t,e))})}}));function $X(e,t){ZX();let n=(e.arguments??[])[0];return B(Nb(e.self,n,t))}var eZ=W(QX),tZ=Ib,nZ=!1,rZ=!1,iZ=((e={})=>({name:tZ,setupOnce(){if(!w.tracingChannel||nZ)return;nZ=!0;let t=K_(e),n=Ab(t);U(()=>{X&&A.log(`[orchestrion:langgraph] subscribing to channel "${$.LANGGRAPH_STATE_GRAPH_COMPILE}"`),Z(w.tracingChannel($.LANGGRAPH_STATE_GRAPH_COMPILE),e=>{if(rZ)return;let t=aZ(e.arguments);return B(Jb(typeof t?.name==`string`?t.name:void 0))},{beforeSpanEnd:(e,r)=>{oZ(r.result,aZ(r.arguments)??{},t,null,n)}}),X&&A.log(`[orchestrion:langgraph] subscribing to channel "${$.LANGGRAPH_CREATE_REACT_AGENT}"`);let e=w.tracingChannel($.LANGGRAPH_CREATE_REACT_AGENT);e.start.subscribe(e=>{rZ=!0;try{let{arguments:n}=e,r=aZ(n);r&&Array.isArray(r.tools)&&r.tools.length>0&&Bb(r.tools,t,zb(n)??void 0)}catch(e){X&&A.error(`[orchestrion:langgraph] failed to wrap createReactAgent tools`,e)}}),e.end.subscribe(e=>{rZ=!1;let{arguments:r,result:i}=e,a=zb(r)??void 0;oZ(i,a?{name:a}:{},t,Rb(r),n)}),e.error.subscribe(()=>{rZ=!1})})}}));function aZ(e){let t=(e??[])[0];return typeof t==`object`&&t?t:void 0}function oZ(e,t,n,r,i){if(!e||typeof e!=`object`)return;let a=e,o=a.invoke;typeof o==`function`&&(a.invoke=Xb(o.bind(a),a,t,n,r,i))}var sZ=W(iZ),cZ=`LruMemoizer`,lZ=W((()=>({name:cZ,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:lru-memoizer] subscribing to channel "${$.LRU_MEMOIZER_LOAD}"`),U(()=>{Z(w.tracingChannel($.LRU_MEMOIZER_LOAD),()=>void 0)}))}}))),uZ=`Mongo`,dZ=`auto.db.orchestrion.mongo`,fZ=new Set([`insert`,`update`,`delete`,`find`,`getMore`,`killCursors`]),pZ=(()=>({name:uZ,setupOnce(){w.tracingChannel&&U(()=>{mZ(),hZ(),gZ()})}}));function mZ(){Z(w.tracingChannel($.MONGODB_COMMAND),e=>{let t=e.arguments??[],n=t[0],r=t[1];if(!n||!r||typeof r!=`object`||r.ismaster||r.hello)return;let i=Object.keys(r)[0];return kF(TF(e.self,n,r,i,dZ))},{requiresParentSpan:!0})}function hZ(){Z(w.tracingChannel($.MONGODB_CHECKOUT),()=>void 0)}function gZ(){for(let e of[`insert`,`update`,`remove`])_Z(e===`insert`?$.MONGODB_V3_INSERT:e===`update`?$.MONGODB_V3_UPDATE:$.MONGODB_V3_REMOVE,t=>({topology:t[0],ns:t[1],command:t[2]?.[0],operation:e}));_Z($.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&fZ.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?DF(t):void 0}}),_Z($.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:`find`})),_Z($.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:`getMore`}))}function _Z(e,t){Z(w.tracingChannel(e),e=>{let n=e.arguments;if(!n)return;let r=t(n);if(r&&typeof r.ns==`string`)return kF(OF(r.ns,r.topology,r.command,r.operation,dZ))},{requiresParentSpan:!0})}var vZ=W(pZ),yZ=`Mongoose`,bZ=`auto.db.orchestrion.mongoose`,xZ=new WeakMap,SZ=!1,CZ=(()=>({name:yZ,setupOnce(){w.tracingChannel&&U(()=>{aF(w.tracingChannel),wZ()})}}));function wZ(){if(!SZ){SZ=!0,X&&A.log(`[orchestrion:mongoose] subscribing to injected channels`);for(let e of yG)EZ(e).subscribe({start(e){OZ(e.self)}});EZ($.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t==`object`&&OZ(t)}}),DZ($.MONGOOSE_QUERY_EXEC,e=>{let t=e;return TZ(t.mongooseCollection,t.model?.modelName,t.op??`exec`,xZ.get(e))}),DZ($.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return TZ(t?.collection,t?.modelName,`aggregate`,xZ.get(e))}),DZ($.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return TZ(t.collection,t.modelName,`save`)}),DZ($.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return TZ(t.collection,t.modelName,`remove`)}),DZ($.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return TZ(t.collection,t.modelName,`insertMany`)}),DZ($.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return TZ(t.collection,t.modelName,`bulkWrite`)})}}function TZ(e,t,n,r){return gR({collection:e,modelName:t,operation:n,origin:bZ,parentSpan:r})}function EZ(e){return w.tracingChannel(e)}function DZ(e,t){Z(w.tracingChannel(e),e=>{let n=e.self;if(n)return t(n)})}function OZ(e){let t=R();e&&t&&xZ.set(e,t)}var kZ=W(CZ),AZ=`Mysql`,jZ=`db.system`,MZ=`db.connection_string`,NZ=`db.name`,PZ=`db.user`,FZ=`db.statement`,IZ=`net.peer.name`,LZ=`net.peer.port`,RZ=(()=>({name:AZ,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:mysql] subscribing to channel "${$.MYSQL_QUERY}"`),U(()=>{Z(w.tracingChannel($.MYSQL_QUERY),e=>{let t=BZ(e.arguments[0]),{host:n,port:r,database:i,user:a}=VZ(e.self),o=typeof r==`string`?parseInt(r,10):r,s=typeof o==`number`&&!isNaN(o);return e._sentryCallerScope=M(),B({name:t??`mysql.query`,kind:G.CLIENT,op:`db`,attributes:{[jZ]:`mysql`,[I]:`auto.db.orchestrion.mysql`,[MZ]:HZ(n,s?o:void 0,i),...i?{[NZ]:i}:{},...a?{[PZ]:a}:{},...t?{[FZ]:t}:{},...n?{[IZ]:n}:{},...s?{[LZ]:o}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!=`object`||!zZ(n))return!1;let r=e._sentryCallerScope;return r&&As(n,r),n.on(`error`,e=>t(e)),n.on(`end`,()=>t()),!0}})}))}}));function zZ(e){return`on`in e&&typeof e.on==`function`}function BZ(e){if(typeof e==`string`)return e;if(j(e)&&`sql`in e){let t=e.sql;return typeof t==`string`?t:void 0}}function VZ(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function HZ(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var UZ=W(RZ),WZ=`Mysql2`,GZ=`auto.db.orchestrion.mysql2`,KZ=`mysql`;function qZ(){LF(w.tracingChannel),JZ($.MYSQL2_QUERY),JZ($.MYSQL2_EXECUTE)}function JZ(e){Z(w.tracingChannel(e),e=>{let t=YZ(e.arguments);return B({name:t??`mysql2.query`,kind:G.CLIENT,attributes:{[I]:GZ,[F]:`db`,[Pc]:KZ,...ZZ(e.self?.config),[Nc]:t||void 0}})},{requiresParentSpan:!0})}function YZ(e){return XZ(e[0])}function XZ(e){if(typeof e==`string`)return e;if(j(e)&&`sql`in e){let t=e.sql;return typeof t==`string`?t:void 0}}function ZZ(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig??e??{},a=typeof n==`string`?parseInt(n,10):n,o=typeof a==`number`&&!isNaN(a);return{[Dc]:r||void 0,[Ic]:i||void 0,[Gl]:t||void 0,[Kl]:o?a:void 0}}var QZ=W((()=>({name:WZ,setupOnce(){w.tracingChannel&&U(()=>{qZ()})}}))),$Z=`OpenAI`,eQ=`auto.ai.orchestrion.openai`,tQ=[{channel:$.OPENAI_CHAT,operation:`chat`},{channel:$.OPENAI_EMBEDDINGS,operation:`embeddings`}],nQ=!1,rQ=((e={})=>({name:$Z,setupOnce(){w.tracingChannel&&!nQ&&(nQ=!0,U(()=>{for(let{channel:t,operation:n}of tQ)X&&A.log(`[orchestrion:openai] subscribing to channel "${t}"`),Z(w.tracingChannel(t),t=>iQ(t,n,e),{beforeSpanEnd:(t,n)=>{iy(t,n.result,K_(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>oQ(t,n,e)})}))}}));function iQ(e,t,n){if(Xf($Z))return;let r=e.arguments??[],i=r[0],{recordInputs:a}=K_(n),o=q_(n.enableTruncation),s=fy(r,t);s[I]=eQ;let c=B({name:`${t} ${i?.model||`unknown`}`,op:`gen_ai.${t}`,attributes:s});return a&&i&&py(c,i,t,o),c}function aQ(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function oQ(e,t,n){let r=t.result;if(!aQ(r))return!1;let{recordOutputs:i}=K_(n),a=r[Symbol.asyncIterator].bind(r),o=uy({[Symbol.asyncIterator]:a},e,i??!1);return r[Symbol.asyncIterator]=()=>o,!0}var sQ=W(rQ),cQ=`Postgres`,lQ=`auto.db.orchestrion.postgres`,uQ=`db.system`,dQ=`db.name`,fQ=`db.connection_string`,pQ=`db.user`,mQ=`db.statement`,hQ=`net.peer.name`,gQ=`net.peer.port`,_Q=`db.postgresql.plan`,vQ=`db.postgresql.idle.timeout.millis`,yQ=`db.postgresql.max.client`,bQ=`postgresql`,xQ=`pg.query`,SQ=`pg.connect`,CQ=`pg-pool.connect`,wQ=((e={})=>({name:cQ,setupOnce(){w.tracingChannel&&U(()=>{TQ($.PG_QUERY,EQ,{deferStreamedResult:!0}),e.ignoreConnectSpans||(TQ($.PG_CONNECT,DQ),TQ($.PGPOOL_CONNECT,OQ))})}}));function TQ(e,t,{deferStreamedResult:n=!1}={}){X&&A.log(`[orchestrion:pg] subscribing to channel "${e}"`),Z(w.tracingChannel(e),e=>(e._sentryCallerScope=M(),B({...t(e),kind:G.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!=`object`||!kQ(n))return!1;let r=e._sentryCallerScope;return r&&As(n,r),n.on(`error`,e=>t(e)),n.on(`end`,()=>t()),!0}}:{requiresParentSpan:!0})}function EQ(e){let t=e.self?.connectionParameters??{},n=AQ(e.arguments);return{name:n?.text??xQ,op:`db`,attributes:{...jQ(t),[I]:lQ,[mQ]:n?.text||void 0,[_Q]:typeof n?.name==`string`?n.name:void 0}}}function DQ(e){return{name:SQ,op:`db`,attributes:jQ(e.self?.connectionParameters??{})}}function OQ(e){return{name:CQ,op:`db`,attributes:MQ(e.self?.options??{})}}function kQ(e){return`on`in e&&typeof e.on==`function`}function AQ(e){let t=e[0];if(typeof t==`string`)return{text:t};if(j(t)&&typeof t.text==`string`){let e=t;return{text:e.text,name:e.name}}}function jQ(e){return{[uQ]:bQ,[fQ]:NQ(e),[dQ]:e.database,[pQ]:e.user,[hQ]:e.host,[gQ]:Number.isInteger(e.port)?e.port:void 0}}function MQ(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}let n=t?.pathname.slice(1)||e.database,r=t?.hostname||e.host,i=Number(t?.port)||(Number.isInteger(e.port)?e.port:void 0),a=t?.username||e.user;return{[uQ]:bQ,[fQ]:NQ(e),[vQ]:e.idleTimeoutMillis,[yQ]:e.max,[dQ]:n,[gQ]:i,[hQ]:r||void 0,[pQ]:a||void 0}}function NQ(e){if(e.connectionString)try{let t=new URL(e.connectionString);return t.username=``,t.password=``,t.toString()}catch{return`postgresql://localhost:5432/`}return`postgresql://${e.host||`localhost`}:${e.port||5432}/${e.database||``}`}var PQ=W(wQ),FQ=`PostgresJs`,IQ=`auto.db.orchestrion.postgresjs`,LQ=`db.response.status_code`,RQ=()=>{},zQ=Symbol.for(`sentry.query.from.instrumented.sql`),BQ=Symbol(`sentryPostgresJsSpan`),VQ=Symbol(`sentryPostgresJsConnectionAttrsSet`),HQ=Symbol(`sentryPostgresJsSpanEnded`),UQ=new WeakMap,WQ=[];function GQ(e){WQ.some(t=>t.ATTR_SERVER_ADDRESS===e.ATTR_SERVER_ADDRESS&&t.ATTR_SERVER_PORT===e.ATTR_SERVER_PORT&&t.ATTR_DB_NAMESPACE===e.ATTR_DB_NAMESPACE)||WQ.push(e)}function KQ(){return WQ.length===1?WQ[0]:void 0}function qQ(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!=`object`||!n)return;let r=cw(n);UQ.set(t,r),GQ(r)}function JQ(e,t,n){let r=t;r[VQ]||(r[VQ]=!0,ow(e,n))}function YQ(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[BQ],i=UQ.get(t);r&&i&&JQ(r,n,i)}function XQ(e,t,n){let r=e.self;if(!r)return;let i=()=>{e[HQ]=!0},a=r.resolve;typeof a==`function`&&(r.resolve=function(...e){i();try{let r=e[0]?.command;sw(t,n,r),t.end()}catch(e){X&&A.error(`[orchestrion:postgresjs] error ending span in resolve:`,e)}return a.apply(this,e)});let o=r.reject;typeof o==`function`&&(r.reject=function(...e){i();try{let r=e[0];t.setStatus({code:2,message:r?.message||`unknown_error`}),t.setAttribute(LQ,r?.code||`unknown`),t.setAttribute(Lc,r?.name||`unknown`),sw(t,n),t.end()}catch(e){X&&A.error(`[orchestrion:postgresjs] error ending span in reject:`,e)}return o.apply(this,e)})}var ZQ=W(((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:FQ,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:postgresjs] subscribing to "${$.POSTGRESJS_HANDLE}"`),w.tracingChannel($.POSTGRESJS_CONNECTION).subscribe({start:RQ,asyncStart:RQ,asyncEnd:RQ,error:RQ,end:qQ}),w.tracingChannel($.POSTGRESJS_EXECUTE).subscribe({end:RQ,asyncStart:RQ,asyncEnd:RQ,error:RQ,start:YQ}),w.tracingChannel($.POSTGRESJS_CONNECT).subscribe({end:RQ,asyncStart:RQ,asyncEnd:RQ,error:RQ,start:YQ}),U(()=>{Z(w.tracingChannel($.POSTGRESJS_HANDLE),e=>{let t=e.self;if(!t||t.executed===!0||t[zQ])return;let r=aw(rw(t.strings)),i=B({name:r||`postgresjs.query`,op:`db`,kind:G.CLIENT,attributes:{[I]:IQ,[Fc]:`postgres`,[Mc]:r}});t[BQ]=i;let a=KQ();if(a&&JQ(i,t,a),n)try{n(i,r,a)}catch(e){i.setAttribute(`sentry.hook.error`,`requestHook failed`),X&&A.error(`[orchestrion:postgresjs] error in requestHook:`,e)}return XQ(e,i,r),i},{requiresParentSpan:t!==!1,deferSpanEnd({data:e}){return e[HQ]?!0:!(`error`in e)}})}))}}})),QQ=`Tedious`,$Q=`auto.db.orchestrion.tedious`,e$=`mssql`,t$=`db.sql.table`,n$=Symbol(`sentry.orchestrion.tedious.current-database`);function r$(e){Object.defineProperty(this,n$,{value:e,writable:!0,configurable:!0})}function i$(){this.removeListener(`databaseChange`,r$)}function a$(){w.tracingChannel($.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(r$.call(t,t.config?.options?.database),t.removeListener(`databaseChange`,r$),t.on(`databaseChange`,r$),t.removeListener(`end`,i$),t.once(`end`,i$))})}function o$(e,t){w.tracingChannel(e).start.subscribe(e=>{let n=e,r=n.self,i=n.arguments[0];if(!r||!(i instanceof xe))return;let a=0,o=0,s=()=>{o++},c=()=>{a++},l=r[n$],u=s$(i),d={[I]:$Q,[Pc]:e$,[Dc]:l,[Ic]:r.config?.userName??r.config?.authentication?.options?.userName,[Nc]:u,[t$]:i.table,[Gl]:r.config?.server,[Kl]:r.config?.options?.port},f=B({name:c$(t,l,u,i.table),kind:G.CLIENT,op:`db`,attributes:d}),p=l$(e=>{i.removeListener(`done`,s),i.removeListener(`doneInProc`,s),i.removeListener(`doneProc`,c),i.removeListener(`error`,p),r.removeListener(`end`,p),f.setAttribute(`tedious.procedure_count`,a),f.setAttribute(`tedious.statement_count`,o),e&&f.setStatus({code:2,message:e.message}),f.end()});if(i.on(`done`,s),i.on(`doneInProc`,s),i.on(`doneProc`,c),i.once(`error`,p),r.on(`end`,p),typeof i.callback==`function`){let e=i.callback;i.callback=function(...t){return p(t[0]),e.apply(this,t)}}})}function s$(e){if(e.sqlTextOrProcedure===`sp_prepare`&&e.parametersByName?.stmt?.value!=null){let t=e.parametersByName.stmt.value;return typeof t==`string`?t:void 0}return e.sqlTextOrProcedure}function c$(e,t,n,r){return e===`execBulkLoad`&&r&&t?`${e} ${r} ${t}`:e===`callProcedure`?t?`${e} ${n} ${t}`:`${e} ${n}`:t?`${e} ${t}`:e}function l$(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var u$=W((()=>({name:QQ,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:tedious] subscribing to channel "${$.TEDIOUS_EXEC_SQL}"`),U(()=>{a$(),o$($.TEDIOUS_EXEC_SQL,`execSql`),o$($.TEDIOUS_EXEC_SQL_BATCH,`execSqlBatch`),o$($.TEDIOUS_CALL_PROCEDURE,`callProcedure`),o$($.TEDIOUS_EXEC_BULK_LOAD,`execBulkLoad`),o$($.TEDIOUS_PREPARE,`prepare`),o$($.TEDIOUS_EXECUTE,`execute`)}))}}))),d$=Symbol(`SentryVercelAiModelPatched`),f$=Symbol(`SentryVercelAiToolPatched`),p$=0;function m$(){return`v6-${++p$}`}var h$=new WeakMap,g$=new WeakSet,_$=new WeakSet,v$=new WeakMap,y$=new WeakMap,b$=new WeakMap,x$=new WeakSet,S$=!1;function C$(e,t={}){if(!S$){S$=!0;try{w$(e,$.VERCEL_AI_GENERATE_TEXT,F$(`generateText`),t),w$(e,$.VERCEL_AI_STREAM_TEXT,F$(`streamText`),t),w$(e,$.VERCEL_AI_GENERATE_OBJECT,F$(`generateObject`),t),w$(e,$.VERCEL_AI_EMBED,(e,t)=>({type:`embed`,event:{callId:m$(),...R$(e.model),maxRetries:e.maxRetries,value:e.value,...L$(t)}}),t),w$(e,$.VERCEL_AI_EMBED_MANY,(e,t)=>({type:`embedMany`,event:{callId:m$(),...R$(e.model),maxRetries:e.maxRetries,values:e.values,...L$(t)}}),t),w$(e,$.VERCEL_AI_EXECUTE_TOOL_CALL,(e,t)=>({type:`executeTool`,event:{callId:m$(),toolCall:e.toolCall,tools:e.tools,...L$(t)}}),t),k$(e,$.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{X&&A.log(`Vercel AI orchestrion channel subscription failed.`)}}}function w$(e,t,n,r){let i=e(t),a=e=>{let t=j(e.arguments[0])?e.arguments[0]:{},i=j(t.experimental_telemetry)?t.experimental_telemetry:{};if(i.isEnabled===!1&&!x$.has(i))return;let a=n(t,i);O$(t,i);let o=R(),s=tL(a,r);if(s){h$.set(e,a),g$.add(s);let n=j(t.model)&&t.model.specificationVersion===`v1`;b$.set(s,{callSiteSpan:o,toolErrorsBubbleToCaller:n}),a.type===`executeTool`&&_$.add(s);let c=Q(a.event.callId);c&&v$.set(s,c),y$.set(s,L$(i)),j(t.tools)&&N$(t.tools,r),n&&j$(t.model,r)}return s};Z(i,e=>a(e),{beforeSpanEnd:(e,t)=>{let n=h$.get(t);if(n){if(`error`in t){let n=b$.get(e)?.callSiteSpan;n&&j(t.error)&&Un(t.error,`_sentry_active_span`,n)}else n.result=n.type===`executeTool`?{output:t.result}:t.result,oL(e,n,r);n.type!==`streamText`&&GI(n),h$.delete(t)}},deferSpanEnd:({data:e,end:t})=>T$(e,t)})}function T$(e,t){if(h$.get(e)?.type!==`streamText`||`error`in e||!E$(e.result))return!1;let n=e.result;return(async()=>{try{let[r,i,a,o,s]=await Promise.all([n.totalUsage??n.usage,n.text,n.toolCalls,n.finishReason,n.response]);e.result={usage:r,text:i,toolCalls:a,finishReason:o,response:s},t()}catch(e){t(e)}})(),!0}function E$(e){return j(e)&&(D$(e.totalUsage)||D$(e.usage))}function D$(e){return j(e)&&typeof e.then==`function`}function O$(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};x$.add(n),e.experimental_telemetry=n}function k$(e,t,n){e(t).subscribe({end(e){let t=e;j(t.result)&&j$(t.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function A$(){let e=R();return e&&g$.has(e)?e:void 0}function j$(e,t){e[d$]||(e[d$]=!0,M$(e,`doGenerate`,t),M$(e,`doStream`,t))}function M$(e,t,n){let r=e[t];typeof r==`function`&&(e[t]=function(...i){let a=A$();if(!a)return Promise.resolve(r.apply(this,i));let o=j(i[0])?i[0]:{},s=v$.get(a),c={type:`languageModelCall`,event:{callId:s,provider:e.provider,modelId:e.modelId,tools:o.tools??(j(o.mode)?o.mode.tools:void 0),messages:o.prompt,...y$.get(a)}},l=V(a,()=>tL(c,n));if(!l)return Promise.resolve(r.apply(this,i));let u=()=>{t===`doStream`&&s&&KI(s)},d=e=>{throw l.setStatus({code:2,message:e instanceof Error?e.message:`unknown_error`}),l.end(),u(),e};try{return Promise.resolve(r.apply(this,i)).then(e=>t===`doStream`&&j(e)&&DI(e.stream)?(e.stream=OI(e.stream,t=>{c.result={...e,...QI(t)},oL(l,c,n),l.end(),u()},e=>{l.setStatus({code:2,message:e instanceof Error?e.message:`unknown_error`}),l.end(),u()}),e):(c.result=e,oL(l,c,n),l.end(),u(),e),d)}catch(e){return d(e)}})}function N$(e,t){try{for(let[n,r]of Object.entries(e))j(r)&&P$(n,r,e,t)}catch{X&&A.log(`Vercel AI orchestrion tool patching failed.`)}}function P$(e,t,n,r){let i=t.execute;typeof i!=`function`||t[f$]||(t[f$]=!0,t.execute=function(t,...a){let o=A$();if(!o||_$.has(o))return i.apply(this,[t,...a]);let s=j(a[0])?a[0]:{},c={type:`executeTool`,event:{callId:v$.get(o),toolCall:{toolName:e,toolCallId:Q(s.toolCallId),input:t},tools:n,...y$.get(o)}},l=V(o,()=>tL(c,r));if(!l)return i.apply(this,[t,...a]);let u=e=>{throw b$.get(o)?.toolErrorsBubbleToCaller?l.setStatus({code:2,message:e instanceof Error?e.message:`tool_error`}):mL(l,c,e),l.end(),e};try{return Promise.resolve(i.apply(this,[t,...a])).then(e=>(c.result={output:e},oL(l,c,r),l.end(),e),u)}catch(e){return u(e)}})}function F$(e){return(t,n)=>({type:e,event:{callId:m$(),operationId:`ai.${e}`,functionId:Q(n.functionId),...R$(t.model),maxRetries:t.maxRetries,instructions:Q(t.system),messages:I$(t),...L$(n)}})}function I$(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt==`string`?[{role:`user`,content:e.prompt}]:e.messages??e.prompt}function L$(e){let t=e.isEnabled===!0||void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function R$(e){return{provider:z$(e,`provider`),modelId:z$(e,`modelId`)}}function z$(e,t){return j(e)?Q(e[t]):void 0}var B$=W(((e={})=>Ed(vL(e),{options:e,setupOnce(){w.tracingChannel&&U(()=>{C$(w.tracingChannel,e)})}}))),V$=new WeakMap;function H$(e,t){V$.set(e,t)}function U$(e){return V$.get(e)}var W$=new WeakMap;function G$(e){let t=W$.get(e);return t||(t=[],W$.set(e,t)),t}function K$(e,t){G$(e).push(t)}function q$(e){G$(e).pop()}function J$(e){let t=e[0];return Array.isArray(t)?t.map(e=>Y$(e)??``).join(`,`):Y$(t)}function Y$(e){return typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0}function X$(e){let t=G$(e),n=``;for(let e of t)e!==`/`&&e!==`/*`&&(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}function Z$(e,t){let n=G$(e);if(n.length===0)return;let r=typeof e.originalUrl==`string`?e.originalUrl:``;if(n.every(e=>e===`/`))return r===`/`?`/`:void 0;if(t===`*`||t.includes(`/`)&&(t.includes(`,`)||t.includes(`\\`)||t.includes(`*`)||t.includes(`[`)))return t;let i=t.startsWith(`/`)?t:`/${t}`;return i.length>0&&(r===i||r.startsWith(i)||Q$(i))?i:void 0}function Q$(e){return e.includes(`:`)||e.includes(`*`)}var $$=`auto.http.express`,e1=`express.name`,t1=`express.type`,n1=()=>{},r1=!1;function i1(e,t){if(!r1){r1=!0;for(let e of[$.EXPRESS_REGISTER,$.ROUTER_REGISTER])t(e).subscribe({start:n1,asyncStart:n1,asyncEnd:n1,error:n1,end:a1});for(let n of[$.EXPRESS_HANDLE,$.ROUTER_HANDLE]){X&&A.log(`[orchestrion:express] subscribing to channel "${n}"`);let r=t(n);Z(r,t=>s1(t,e),{beforeSpanEnd(e,t){t._sentryCleanup?.()}}),r.subscribe({start:n1,asyncEnd:n1,end:n1,error:n1,asyncStart:o1})}}}function a1(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&H$(n,J$(e.arguments??[]))}function o1(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&q$(t)}function s1(e,t){let n=e.self,r=e.arguments;if(!n||!Array.isArray(r)||n.handle?.length===4||n.method&&!n.route)return;let i=r[0],a=r[1];if(!i||!R())return;let o=c1(n),s=U$(n);s!=null&&(K$(i,s),e._sentryStoredLayer=!0);let c=o===`request_handler`?X$(i):void 0,l=o===`request_handler`&&c!=null?Z$(i,c):void 0,u=o===`request_handler`?c||`request handler`:o===`router`?n.path??`/`:n.name??`<anonymous>`;if(l&&l1(l),o===`request_handler`&&c){let e=N();if(e!==$r()){let t=typeof i.method==`string`?i.method.toUpperCase():`GET`;e.setTransactionName(`${t} ${c}`)}else X&&A.warn(`[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name`)}if(u1(u,o,t))return;let d=B({name:u,attributes:{[I]:$$,[F]:`${o}.express`,[e1]:u,[t1]:o,...l?{[Sl]:l}:{}}});if(a&&typeof a.once==`function`){let t=()=>{d.end()};a.once(`finish`,t),e._sentryCleanup=()=>a.removeListener(`finish`,t)}return d}function c1(e){return e.name===`router`?`router`:e.name===`bound dispatch`||e.name===`handle`?`request_handler`:`middleware`}function l1(e){let t=R(),n=t&&Za(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(Sl,e)}function u1(e,t,n){let{ignoreLayers:r,ignoreLayersType:i}=n;if(Array.isArray(i)&&i.includes(t))return!0;if(!Array.isArray(r))return!1;try{return yr(e,r,!0)}catch{return!1}}var d1=`Express`,f1=W(((e={})=>({name:d1,setupOnce(){w.tracingChannel&&U(()=>{i1(e,w.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})));function p1(e,t){return B({name:`${e} ${t.path}`,op:`db.query`,kind:G.CLIENT,attributes:{[I]:`auto.firebase.orchestrion.firestore`,[jc]:e,...h1(t)}})}function m1(e){let t,n;if(typeof e.host==`string`){if(e.host.startsWith(`[`)){if(e.host.endsWith(`]`))t=e.host.replace(/^\[|\]$/g,``);else if(e.host.includes(`]:`)){let r=e.host.lastIndexOf(`:`);r!==-1&&(t=e.host.slice(1,r).replace(/^\[|\]$/g,``),n=e.host.slice(r+1))}}else if(S.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(`:`);r===-1?t=e.host:(t=e.host.slice(0,r),n=e.host.slice(r+1))}}return{address:t,port:n?parseInt(n,10):void 0}}function h1(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},i={[Ec]:e.path,[Oc]:t.name,[Fc]:`firebase.firestore`,"firebase.firestore.type":e.type,"firebase.firestore.options.projectId":n.projectId,"firebase.firestore.options.appId":n.appId,"firebase.firestore.options.messagingSenderId":n.messagingSenderId,"firebase.firestore.options.storageBucket":n.storageBucket},{address:a,port:o}=m1(r);return a&&(i[ou]=a),o&&(i[su]=o),i}var g1=`auto.firebase.orchestrion.functions`,_1=`__sentryFirebaseWrapped`;function v1(e,t){let n=e.arguments;if(!Array.isArray(n)||n.length===0)return;let r=typeof n[0]==`function`?0:1,i=n[r];typeof i!=`function`||i[_1]||(n[r]=y1(i,t))}function y1(e,t){let n=async function(...n){let r=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,i={[I]:g1,[Hc]:r,[Uc]:t,"faas.provider":`firebase`};return process.env.GCLOUD_PROJECT&&(i[`cloud.project_id`]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(i[`cloud.event_source`]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),ts({name:`firebase.function.${t}`,op:`function.firebase`,kind:G.SERVER,attributes:i},async t=>{try{let r=await e.apply(this,n);return t.end(),r}catch(e){throw t.setStatus({code:2}),H(e,{mechanism:{type:g1,handled:!1}}),t.end(),await rd(2e3),e}})};return n[_1]=!0,n}var b1=[{channel:$.FIREBASE_FIRESTORE_ADD_DOC,spanName:`addDoc`,useParent:!1},{channel:$.FIREBASE_FIRESTORE_GET_DOCS,spanName:`getDocs`,useParent:!1},{channel:$.FIREBASE_FIRESTORE_SET_DOC,spanName:`setDoc`,useParent:!0},{channel:$.FIREBASE_FIRESTORE_DELETE_DOC,spanName:`deleteDoc`,useParent:!0}],x1=[{channel:$.FIREBASE_FUNCTIONS_HTTP_REQUEST,triggerType:`http.request`},{channel:$.FIREBASE_FUNCTIONS_HTTP_CALL,triggerType:`http.call`},{channel:$.FIREBASE_FUNCTIONS_FIRESTORE_CREATED,triggerType:`firestore.document.created`},{channel:$.FIREBASE_FUNCTIONS_FIRESTORE_UPDATED,triggerType:`firestore.document.updated`},{channel:$.FIREBASE_FUNCTIONS_FIRESTORE_DELETED,triggerType:`firestore.document.deleted`},{channel:$.FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN,triggerType:`firestore.document.written`},{channel:$.FIREBASE_FUNCTIONS_SCHEDULER,triggerType:`scheduler.scheduled`},{channel:$.FIREBASE_FUNCTIONS_STORAGE_FINALIZED,triggerType:`storage.object.finalized`},{channel:$.FIREBASE_FUNCTIONS_STORAGE_ARCHIVED,triggerType:`storage.object.archived`},{channel:$.FIREBASE_FUNCTIONS_STORAGE_DELETED,triggerType:`storage.object.deleted`},{channel:$.FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED,triggerType:`storage.object.metadataUpdated`}],S1=()=>{};function C1(e){try{return e()}catch(e){X&&A.warn(`[orchestrion:firebase] error handling channel event`,e);return}}function w1(){for(let{channel:e,spanName:t,useParent:n}of b1)Z(w.tracingChannel(e),e=>C1(()=>{let r=e.arguments[0];if(!r)return;let i=n&&r.parent||r;return p1(t,i)}));for(let{channel:e,triggerType:t}of x1)w.tracingChannel(e).subscribe({start:e=>void C1(()=>v1(e,t)),end:S1,asyncStart:S1,asyncEnd:S1,error:S1})}var T1=`Firebase`,E1=W((()=>({name:T1,setupOnce(){w.tracingChannel&&U(()=>{w1()})}})));function D1(){return!!O.__SENTRY_ORCHESTRION__}function O1(){let{runtime:e,bundler:t}=O.__SENTRY_ORCHESTRION__??{};if(!e&&!t){A.warn("[Sentry] No diagnostics-channel injection detected. Channel-based integrations will not record spans. Make sure the diagnostics channels are injected via the runtime `--import` hook or a bundler plugin before the instrumented modules load.");return}A.log(e?`[Sentry] Runtime hook registered, injected libraries=${JSON.stringify(e)}`:`[Sentry] Runtime hook not registered`),A.log(t?`[Sentry] Bundler plugin ran, injected libraries=${JSON.stringify(t)}`:`[Sentry] Bundler plugin did not run`)}var k1=`RedisChannel`,A1=`auto.db.orchestrion.redis`,j1=`db.connection_string`,M1=`redis`;function N1(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function P1(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function F1(e){let t=e[0];return j(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function I1(e){if(typeof e==`string`&&e)try{let t=new URL(e);return t.searchParams.delete(`user_pwd`),t.username=``,t.password=``,t.href}catch{return}}function L1(e){return{[Pc]:M1,[Gl]:e?.socket?.host,[Kl]:e?.socket?.port,[j1]:I1(e?.url),[I]:A1}}function R1(e,t,n){return B({name:`redis-${e}`,kind:G.CLIENT,attributes:{...n,[F]:`db`,[Nc]:wI(e,t)}})}function z1(e){let t=w.tracingChannel($.REDIS_COMMAND),n=()=>{};t.subscribe({end:n,asyncStart:n,asyncEnd:n,start(t){let n=t.arguments?.[0];if(!n||typeof n!=`object`)return;let r=n.callback;if(typeof r!=`function`)return;let i=t.self,a={[Pc]:M1,[I]:A1};a[Gl]=i?.connection_options?.host,a[Kl]=i?.connection_options?.port,i?.address&&(a[j1]=`redis://${i.address}`);let o=R1(n.command,n.args??[],a);t._sentrySpan=o;let s=R();n.callback=function(t,i){t||P1(e,o,n.command,n.args??[],i),N1(o,t);let a=arguments;return V(s??null,()=>r.apply(this,a))}},error(e){let t=e._sentrySpan;t&&N1(t,e.error)}})}function B1(e,t,n){Z(w.tracingChannel(e),e=>{let n=t(e);if(!n?.length)return;let r=String(n[0]),i=e.self?.options;return R1(r,n.slice(1),L1(i))},{beforeSpanEnd(e,r){if(`error`in r||!n)return;let i=t(r);i?.length&&P1(n,e,String(i[0]),i.slice(1),r.result)}})}function V1(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function H1(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(typeof t?.transformArguments==`function`&&Array.isArray(n))try{return t.transformArguments(...F1(n))}catch{return}}function U1(){Z(w.tracingChannel($.NODE_REDIS_CONNECT),e=>{let t=e.self?.options;return B({name:`redis-connect`,kind:G.CLIENT,attributes:{...L1(t),[F]:`db`}})})}function W1(e,t){Z(w.tracingChannel(e),e=>{let n=e.arguments?.[0],r=Array.isArray(n)?n.length:void 0,i=e.self?.options?.socket;return B({name:t(e),kind:G.CLIENT,attributes:{[I]:A1,[F]:`db.redis`,[Fc]:M1,...r&&r>1?{[Ac]:r}:{},...i?.host==null?{}:{[ou]:i.host},...i?.port==null?{}:{[su]:i.port}}})})}var G1=W(((e={})=>{let t=e.responseHook;return{name:k1,setupOnce(){w.tracingChannel&&(X&&A.log(`[orchestrion:redis] subscribing to "${$.REDIS_COMMAND}" and node-redis channels`),z1(t),U(()=>{B1($.NODE_REDIS_COMMAND,V1,t),B1($.NODE_REDIS_EXECUTOR,H1,t),U1(),W1($.NODE_REDIS_MULTI,()=>`MULTI`),W1($.NODE_REDIS_PIPELINE,()=>`PIPELINE`),W1($.NODE_REDIS_BATCH,e=>e.arguments?.[2]===void 0?`PIPELINE`:`MULTI`)}))}}})),K1={postgresIntegration:PQ,postgresJsIntegration:ZQ,mongoIntegration:vZ,mysqlIntegration:UZ,mysql2Integration:QZ,genericPoolIntegration:bJ,mongooseIntegration:kZ,lruMemoizerIntegration:lZ,openaiIntegration:sQ,anthropicIntegration:lq,googleGenAIIntegration:AJ,langChainIntegration:eZ,langGraphIntegration:sZ,vercelAiIntegration:B$,amqplibIntegration:$K,hapiIntegration:MY,koaIntegration:GY,expressIntegration:f1,graphqlIntegration:pY,kafkajsIntegration:OX,tediousIntegration:u$,awsIntegration:iJ,firebaseIntegration:E1},q1=`Knex`,J1=Y(q1,()=>new HU),Y1=W((()=>({name:q1,setupOnce(){D1()?qX().setupOnce?.():J1()}}))),X1=`db.sql.table`,Z1=`mssql`;function Q1(e,t,n,r){return e===`execBulkLoad`&&r&&t?`${e} ${r} ${t}`:e===`callProcedure`?t?`${e} ${n} ${t}`:`${e} ${n}`:t?`${e} ${t}`:`${e}`}var $1=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}},e0=`@sentry/instrumentation-tedious`,t0=Symbol(`opentelemetry.instrumentation-tedious.current-database`),n0=[`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`];function r0(e){Object.defineProperty(this,t0,{value:e,writable:!0})}var i0=class e extends q{constructor(e={}){super(e0,k,e)}init(){return[new J(e.COMPONENT,[`>=1.11.0 <20`],e=>{let t=e.Connection.prototype;for(let e of n0)K(t[e])&&this._unwrap(t,e),this._wrap(t,e,this._patchQuery(e));return K(t.connect)&&this._unwrap(t,`connect`),this._wrap(t,`connect`,this._patchConnect),e},e=>{if(e===void 0)return;let t=e.Connection.prototype;for(let e of n0)this._unwrap(t,e);this._unwrap(t,`connect`)})]}_patchConnect(e){return function(){return r0.call(this,this.config?.options?.database),this.removeListener(`databaseChange`,r0),this.on(`databaseChange`,r0),this.once(`end`,()=>{this.removeListener(`databaseChange`,r0)}),e.apply(this,arguments)}}_patchQuery(e){return t=>{let n=this;function r(r){if(!(r instanceof dt))return n._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),t.apply(this,arguments);let i=0,a=0,o=()=>a++,s=()=>i++,c=this[t0],l=(e=>e.sqlTextOrProcedure===`sp_prepare`&&e.parametersByName?.stmt?.value?e.parametersByName.stmt.value:e.sqlTextOrProcedure)(r),u={[I]:`auto.db.otel.tedious`,[Pc]:Z1,[Dc]:c,[Ic]:this.config?.userName??this.config?.authentication?.options?.userName,[Nc]:l,[X1]:r.table,[Gl]:this.config?.server,[Kl]:this.config?.options?.port},d=B({name:Q1(e,c,l,r.table),kind:G.CLIENT,attributes:u}),f=$1(e=>{r.removeListener(`done`,o),r.removeListener(`doneInProc`,o),r.removeListener(`doneProc`,s),r.removeListener(`error`,f),this.removeListener(`end`,f),d.setAttribute(`tedious.procedure_count`,i),d.setAttribute(`tedious.statement_count`,a),e&&d.setStatus({code:2,message:e.message}),d.end()});return r.on(`done`,o),r.on(`doneInProc`,o),r.on(`doneProc`,s),r.once(`error`,f),this.on(`end`,f),typeof r.callback==`function`?n._wrap(r,`callback`,n._patchCallbackQuery(f)):n._diag.error(`Expected request.callback to be a function`),V(d,()=>t.apply(this,arguments))}return Object.defineProperty(r,"length",{value:t.length,writable:!1}),r}}_patchCallbackQuery(e){return t=>function(n,r,i){return e(n),t.apply(this,arguments)}}};i0.COMPONENT=`tedious`;var a0=i0,o0=`Tedious`,s0=Y(o0,()=>new a0({})),c0=W((()=>({name:o0,setupOnce(){s0()}}))),l0=`generic-pool`,u0=`@sentry/instrumentation-generic-pool`,d0=class extends q{constructor(e={}){super(u0,k,e),this._isDisabled=!1}init(){return[new J(l0,[`>=3.0.0 <4`],e=>{let t=e.Pool;return K(t.prototype.acquire)&&this._unwrap(t.prototype,`acquire`),this._wrap(t.prototype,`acquire`,this._acquirePatcher.bind(this)),e},e=>{let t=e.Pool;return this._unwrap(t.prototype,`acquire`),e}),new J(l0,[`>=2.4.0 <3`],e=>{let t=e.Pool;return K(t.prototype.acquire)&&this._unwrap(t.prototype,`acquire`),this._wrap(t.prototype,`acquire`,this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let t=e.Pool;return this._unwrap(t.prototype,`acquire`),e}),new J(l0,[`>=2.0.0 <2.4`],e=>(this._isDisabled=!1,K(e.Pool)&&this._unwrap(e,`Pool`),this._wrap(e,`Pool`,this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){return function(...t){return z({name:`generic-pool.acquire`,attributes:{[I]:`auto.db.otel.generic_pool`}},()=>e.call(this,...t))}}_poolWrapper(e){let t=this._wrap.bind(this),n=this._acquireWithCallbacksPatcher.bind(this);return function(...r){let i=e.apply(this,r);return t(i,`acquire`,n),i}}_acquireWithCallbacksPatcher(e){let t=()=>this._isDisabled;return function(n,r){return t()?e.call(this,n,r):ts({name:`generic-pool.acquire`,attributes:{[I]:`auto.db.otel.generic_pool`}},t=>{e.call(this,(e,r)=>{e&&t.setStatus({code:2,message:`internal_error`}),t.end(),n&&n(e,r)},r)})}}},f0=`GenericPool`,p0=Y(f0,()=>new d0({})),m0=W((()=>({name:f0,setupOnce(){p0()}}))),h0=`dataloader`,g0=`@sentry/instrumentation-dataloader`,_0=`auto.db.otel.dataloader`;function v0(e){return e[Symbol.toStringTag]===`Module`}function y0(e){return v0(e)?e.default:e}function b0(e,t){let n=e.name;return n?`${h0}.${t} ${n}`:`${h0}.${t}`}function x0(e){if(e===`load`||e===`loadMany`||e===`batch`)return`cache.get`}function S0(e){return Array.isArray(e)?e.map(e=>String(e)):e==null?void 0:[String(e)]}var C0=class extends q{constructor(e={}){super(g0,k,e)}init(){return[new J(h0,[`>=2.0.0 <3`],e=>{let t=y0(e);return this._patchLoad(t.prototype),this._patchLoadMany(t.prototype),this._patchPrime(t.prototype),this._patchClear(t.prototype),this._patchClearAll(t.prototype),this._getPatchedConstructor(t)},e=>{let t=y0(e);[`load`,`loadMany`,`prime`,`clear`,`clearAll`].forEach(e=>{K(t.prototype[e])&&this._unwrap(t.prototype,e)})})]}_wrapBatchLoadFn(e){let t=this;return function(...n){return t.isEnabled()?z({name:b0(this,`batch`),links:this._batch?.spanLinks,attributes:{[I]:_0,[F]:x0(`batch`),[Cc]:S0(n[0])},onlyIfParent:!0},()=>e.apply(this,n)):e.call(this,...n)}}_getPatchedConstructor(e){let t=this,n=e.prototype;if(!t.isEnabled())return e;function r(...n){return typeof n[0]==`function`&&(K(n[0])&&t._unwrap(n,0),n[0]=t._wrapBatchLoadFn(n[0])),e.apply(this,n)}return r.prototype=n,r}_patchLoad(e){K(e.load)&&this._unwrap(e,`load`),this._wrap(e,`load`,this._getPatchedLoad.bind(this))}_getPatchedLoad(e){return function(...t){return z({name:b0(this,`load`),kind:G.CLIENT,attributes:{[I]:_0,[F]:x0(`load`),[Cc]:S0(t[0])},onlyIfParent:!0},n=>{let r=e.call(this,...t);return this._batch&&n.isRecording()&&(this._batch.spanLinks||(this._batch.spanLinks=[]),this._batch.spanLinks.push({context:n.spanContext()})),r})}}_patchLoadMany(e){K(e.loadMany)&&this._unwrap(e,`loadMany`),this._wrap(e,`loadMany`,this._getPatchedLoadMany.bind(this))}_getPatchedLoadMany(e){return function(...t){return z({name:b0(this,`loadMany`),kind:G.CLIENT,attributes:{[I]:_0,[F]:x0(`loadMany`),[Cc]:S0(t[0])},onlyIfParent:!0},()=>e.call(this,...t))}}_patchPrime(e){K(e.prime)&&this._unwrap(e,`prime`),this._wrap(e,`prime`,this._getPatchedPrime.bind(this))}_getPatchedPrime(e){return function(...t){return z({name:b0(this,`prime`),kind:G.CLIENT,attributes:{[I]:_0,[F]:x0(`prime`)},onlyIfParent:!0},()=>e.call(this,...t))}}_patchClear(e){K(e.clear)&&this._unwrap(e,`clear`),this._wrap(e,`clear`,this._getPatchedClear.bind(this))}_getPatchedClear(e){return function(...t){return z({name:b0(this,`clear`),kind:G.CLIENT,attributes:{[I]:_0,[F]:x0(`clear`)},onlyIfParent:!0},()=>e.call(this,...t))}}_patchClearAll(e){K(e.clearAll)&&this._unwrap(e,`clearAll`),this._wrap(e,`clearAll`,this._getPatchedClearAll.bind(this))}_getPatchedClearAll(e){return function(...t){return z({name:b0(this,`clearAll`),kind:G.CLIENT,attributes:{[I]:_0,[F]:x0(`clearAll`)},onlyIfParent:!0},()=>e.call(this,...t))}}},w0=`Dataloader`,T0=Y(w0,()=>new C0),E0=W((()=>({name:w0,setupOnce(){D1()?vJ().setupOnce?.():T0()}}))),D0=(e=>(e.AutoAck=`auto ack`,e.Ack=`ack`,e.AckAll=`ackAll`,e.Reject=`reject`,e.Nack=`nack`,e.NackAll=`nackAll`,e.ChannelClosed=`channel closed`,e.ChannelError=`channel error`,e.InstrumentationTimeout=`instrumentation timeout`,e))(D0||{}),O0=`messaging.operation`,k0=`messaging.destination`,A0=`messaging.destination_kind`,j0=`messaging.rabbitmq.routing_key`,M0=`messaging.protocol`,N0=`messaging.protocol_version`,P0=`messaging.url`,F0=`messaging.message_id`,I0=`messaging.conversation_id`,L0=`topic`,R0=`process`;b();var z0=`auto.amqplib.otel.publisher`,B0=`auto.amqplib.otel.consumer`,V0=Symbol(`opentelemetry.amqplib.message.stored-span`),H0=Symbol(`opentelemetry.amqplib.channel.spans-not-ended`),U0=Symbol(`opentelemetry.amqplib.channel.consumer-timeout-timer`),W0=Symbol(`opentelemetry.amqplib.connection.attributes`),G0=Symbol(`sentry.amqplib.channel.is-confirm-publishing`),K0=e=>e===``?`<default>`:e,q0=e=>e.replace(/:[^:@/]*@/,`:***@`),J0=(e,t)=>e||(t===`AMQP`?5672:5671),Y0=e=>{let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()},X0=e=>e||`localhost`,Z0=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[Il]:t}:{}},Q0=e=>{let t={[N0]:`0.9.1`},n=e||`amqp://localhost`;if(typeof n==`object`){let e=n,r=Y0(e?.protocol);t[M0]=r,t[Gl]=X0(e?.hostname),t[Kl]=J0(e.port,r)}else{let e=q0(n);t[P0]=e;try{let n=new URL(e),r=Y0(n.protocol);t[M0]=r,t[Gl]=X0(n.hostname),t[Kl]=J0(n.port?parseInt(n.port):void 0,r)}catch{}}return t};function $0(e,t){let n=e?.[t];if(n!=null)return String(Array.isArray(n)?n[0]:n)}function e2(e,t,n,r){let i=B({name:`publish ${K0(e)}`,kind:y.PRODUCER,attributes:{...n.connection[W0],[k0]:e,[A0]:L0,[j0]:t,[F0]:r?.messageId,[I0]:r?.correlationId,[I]:z0}}),a=r??{};a.headers=a.headers??{};let o=yp({span:i});return o[`sentry-trace`]&&(a.headers[`sentry-trace`]=o[`sentry-trace`]),o.baggage&&(a.headers.baggage=o.baggage),{span:i,modifiedOptions:a}}function t2(e,t,n){return B({name:`${e} process`,kind:y.CONSUMER,attributes:{...n?.connection?.[W0],[k0]:t.fields?.exchange,[A0]:L0,[j0]:t.fields?.routingKey,[O0]:R0,[F0]:t?.properties.messageId,[I0]:t?.properties.correlationId,[I]:B0}})}var n2=6e4;function r2(e,t,n,r){let i=e[V0];i&&(t!==!1&&i.setStatus({code:2,message:n!==D0.ChannelClosed&&n!==D0.ChannelError?`${n} called on message${r===!0?` with requeue`:r===!1?` without requeue`:``}`:n}),i.end(),e[V0]=void 0)}function i2(e,t,n,r){(e[H0]??[]).forEach(e=>{r2(e.msg,t,n,r)}),e[H0]=[]}function a2(e){let t=Lr(),n=e[H0]??[],r=0;for(;r<n.length;r++){let e=n[r];if((t-e.timeOfConsume)*1e3<n2)break;r2(e.msg,null,D0.InstrumentationTimeout,!0)}n.splice(0,r)}function o2(e){return function(t,n,r){return e.call(this,t,n,function(e,n){if(e==null){let e=Q0(t),r=Z0(n);n[W0]={...e,...r}}r.apply(this,arguments)})}}function s2(e){return function(t){if(t===`close`){i2(this,!0,D0.ChannelClosed,void 0);let e=this[U0];e&&clearInterval(e),this[U0]=void 0}else t===`error`&&i2(this,!0,D0.ChannelError,void 0);return e.apply(this,arguments)}}function c2(e,t){return n=>function(r){return i2(this,e,t,r),n.apply(this,arguments)}}function l2(e,t){return n=>function(r,i,a){let o=this,s=t===D0.Reject?i:a,c=o[H0]??[],l=c.findIndex(e=>e.msg===r);if(l<0)r2(r,e,t,s);else if(t!==D0.Reject&&i){for(let n=0;n<=l;n++)r2(c[n].msg,e,t,s);c.splice(0,l+1)}else r2(r,e,t,s),c.splice(l,1);return n.apply(this,arguments)}}function u2(e){return function(t,n,r){let i=this;if(!Object.prototype.hasOwnProperty.call(i,H0)){let e=setInterval(()=>{a2(i)},n2);e.unref(),i[U0]=e,i[H0]=[]}let a=function(e){if(!e)return n.call(this,e);let a=e.properties.headers??{};is({sentryTrace:$0(a,`sentry-trace`),baggage:$0(a,`baggage`)},()=>{let a=t2(t,e,i);r?.noAck||(i[H0].push({msg:e,timeOfConsume:Lr()}),e[V0]=a),V(a,()=>{n.call(this,e)}),r?.noAck&&a.end()})},o=Array.prototype.slice.call(arguments);return o[1]=a,e.apply(this,o)}}function d2(e){return function(t,n,r,i,a){let o=this,{span:s,modifiedOptions:c}=e2(t,n,o,i),l=function(e,t){try{V(s,()=>{a?.call(this,e,t)})}finally{e&&s.setStatus({code:2,message:`message confirmation has been nack'ed`}),s.end()}},u=[...arguments];u[3]=c,u[4]=l,o[G0]=!0;try{return e.apply(this,u)}finally{o[G0]=!1}}}function f2(e){return function(t,n,r,i){if(this[G0])return e.apply(this,arguments);let{span:a,modifiedOptions:o}=e2(t,n,this,i),s=[...arguments];s[3]=o;let c=e.apply(this,s);return a.end(),c}}var p2=`@sentry/instrumentation-amqplib`,m2=[`>=0.5.5 <2`],h2=class extends q{constructor(e={}){super(p2,k,e)}init(){let e=new CR(`amqplib/lib/channel_model.js`,m2,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),t=new CR(`amqplib/lib/callback_model.js`,m2,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this));return new J(`amqplib`,m2,void 0,void 0,[e,new CR(`amqplib/lib/connect.js`,m2,this.patchConnect.bind(this),this.unpatchConnect.bind(this)),t])}patchConnect(e){let t=this.unpatchConnect(e);return K(t.connect)||this._wrap(t,`connect`,o2),t}unpatchConnect(e){return K(e.connect)&&this._unwrap(e,`connect`),e}patchChannelModel(e){return K(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,`publish`,f2),K(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,`consume`,u2),K(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,`ack`,l2(!1,D0.Ack)),K(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,`nack`,l2(!0,D0.Nack)),K(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,`reject`,l2(!0,D0.Reject)),K(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,`ackAll`,c2(!1,D0.AckAll)),K(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,`nackAll`,c2(!0,D0.NackAll)),K(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,`emit`,s2),K(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,`publish`,d2),e}unpatchChannelModel(e){return K(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,`publish`),K(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,`consume`),K(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,`ack`),K(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,`nack`),K(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,`reject`),K(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,`ackAll`),K(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,`nackAll`),K(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,`emit`),K(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,`publish`),e}},g2=`Amqplib`,_2=Y(g2,()=>new h2),v2=W((()=>({name:g2,setupOnce(){_2()}}))),y2=`VercelAI`,b2=[`>=3.0.0 <7`],x2=[`generateText`,`streamText`,`generateObject`,`streamObject`,`embed`,`embedMany`,`rerank`];function S2(e){if(typeof e!=`object`||!e)return!1;let t=e;return`type`in t&&`error`in t&&`toolName`in t&&`toolCallId`in t&&t.type===`tool-error`&&t.error instanceof Error}function C2(e){if(typeof e!=`object`||!e||!(`content`in e))return;let t=e;Array.isArray(t.content)&&(w2(t.content),T2(t.content))}function w2(e){for(let t of e){if(!S2(t))continue;let e=jv(t.toolCallId);bi(e?n=>{n.setContext(`trace`,{trace_id:e.traceId,span_id:e.spanId}),n.setTag(`vercel.ai.tool.name`,t.toolName),n.setTag(`vercel.ai.tool.callId`,t.toolCallId),n.setLevel(`error`),H(t.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})}:e=>{e.setTag(`vercel.ai.tool.name`,t.toolName),e.setTag(`vercel.ai.tool.callId`,t.toolCallId),e.setLevel(`error`),H(t.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})})}}function T2(e){for(let t of e)typeof t==`object`&&t&&`toolCallId`in t&&typeof t.toolCallId==`string`&&Mv(t.toolCallId)}function E2(e,t,n,r,i){return{recordInputs:e?.recordInputs===void 0?t.recordInputs===void 0?n===!0||r:t.recordInputs:e.recordInputs,recordOutputs:e?.recordOutputs===void 0?t.recordOutputs===void 0?n===!0||i:t.recordOutputs:e.recordOutputs}}var D2=class extends q{constructor(e={}){super(`@sentry/instrumentation-vercel-ai`,k,e),this._isPatched=!1,this._callbacks=[]}init(){return new J(`ai`,b2,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(e=>e()),this._callbacks=[];let t=e=>new Proxy(e,{apply:(e,t,n)=>{let r=n[0].experimental_telemetry||{},i=r.isEnabled,a=P(),o=a?.getIntegrationByName(y2),s=o?.options,c=o?a?.getDataCollectionOptions().genAI:void 0,{recordInputs:l,recordOutputs:u}=E2(s,r,i,!!c?.inputs,!!c?.outputs);return n[0].experimental_telemetry={...r,isEnabled:i===void 0||i,recordInputs:l,recordOutputs:u},Zo(()=>Reflect.apply(e,t,n),e=>{e&&typeof e==`object`&&Un(e,`_sentry_active_span`,R())},()=>{},e=>{C2(e)})}});if(Object.prototype.toString.call(e)===`[object Module]`){for(let n of x2)e[n]!=null&&(e[n]=t(e[n]));return e}{let n=x2.reduce((n,r)=>(e[r]!=null&&(n[r]=t(e[r])),n),{});return{...e,...n}}}},O2=Y(y2,()=>new D2({}));function k2(e){return!!e.getIntegrationByName(`Modules`)?.getModules?.()?.ai}var A2=W(((e={})=>{let t;return Ed(vL(e),{options:e,setupOnce(){t=O2()},afterAllSetup(n){e.force??k2(n)?Jv(n):t?.callWhenPatched(()=>Jv(n))}})})),j2=[`>=4.0.0 <8`],M2=class extends q{constructor(e={}){super(`@sentry/instrumentation-openai`,k,e)}init(){return new J(`openai`,j2,this._patch.bind(this))}_patch(e){let t=e;return t=this._patchClient(t,`OpenAI`),t=this._patchClient(t,`AzureOpenAI`),t}_patchClient(e,t){let n=e[t];if(!n)return e;let r=this.getConfig(),i=function(...e){return Xf(`OpenAI`)?Reflect.construct(n,e):gy(Reflect.construct(n,e),r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let e of Object.getOwnPropertyNames(n))if(![`length`,`name`,`prototype`].includes(e)){let t=Object.getOwnPropertyDescriptor(n,e);t&&Object.defineProperty(i,e,t)}try{e[t]=i}catch{Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=i}catch{Object.defineProperty(e,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return e}},N2=Y($v,e=>new M2(e)),P2=W(((e={})=>({name:$v,setupOnce(){N2(e)}}))),F2=[`>=0.19.2 <1.0.0`],I2=class extends q{constructor(e={}){super(`@sentry/instrumentation-anthropic-ai`,k,e)}init(){return new J(`@anthropic-ai/sdk`,F2,this._patch.bind(this))}_patch(e){let t=e.Anthropic,n=this.getConfig(),r=function(...e){return Xf(`Anthropic_AI`)?Reflect.construct(t,e):Uy(Reflect.construct(t,e),n)};Object.setPrototypeOf(r,t),Object.setPrototypeOf(r.prototype,t.prototype);for(let e of Object.getOwnPropertyNames(t))if(![`length`,`name`,`prototype`].includes(e)){let n=Object.getOwnPropertyDescriptor(t,e);n&&Object.defineProperty(r,e,n)}try{e.Anthropic=r}catch{Object.defineProperty(e,"Anthropic",{value:r,writable:!0,configurable:!0,enumerable:!0})}if(e.default===t)try{e.default=r}catch{Object.defineProperty(e,"default",{value:r,writable:!0,configurable:!0,enumerable:!0})}return e}},L2=Y(_y,e=>new I2(e)),R2=W(((e={})=>({name:_y,options:e,setupOnce(){L2(e)}}))),z2=[`>=0.10.0 <2`],B2=class extends q{constructor(e={}){super(`@sentry/instrumentation-google-genai`,k,e)}init(){return new J(`@google/genai`,z2,e=>this._patch(e),e=>e,[new CR(`@google/genai/dist/node/index.cjs`,z2,e=>this._patch(e),e=>e)])}_patch(e){let t=e.GoogleGenAI,n=this.getConfig();if(typeof t!=`function`)return e;let r=function(...e){return Xf(`Google_GenAI`)?Reflect.construct(t,e):ob(Reflect.construct(t,e),n)};Object.setPrototypeOf(r,t),Object.setPrototypeOf(r.prototype,t.prototype);for(let e of Object.getOwnPropertyNames(t))if(![`length`,`name`,`prototype`].includes(e)){let n=Object.getOwnPropertyDescriptor(t,e);n&&Object.defineProperty(r,e,n)}return cx(e,`GoogleGenAI`,r),e}},V2=Y(Wy,e=>new B2(e)),H2=W(((e={})=>({name:Wy,setupOnce(){V2(e)}}))),U2=[`>=0.1.0 <2.0.0`];function W2(e,t,n){return new Proxy(e,{apply(e,n,r){let i=r[1];return(!i||typeof i!=`object`||Array.isArray(i))&&(i={},r[1]=i),i.callbacks=kb(i.callbacks,t),Reflect.apply(e,n,r)}})}var G2=class extends q{constructor(e={}){super(`@sentry/instrumentation-langchain`,k,e)}init(){let e=[];for(let t of[`@langchain/anthropic`,`@langchain/openai`,`@langchain/google-genai`,`@langchain/mistralai`,`@langchain/google-vertexai`,`@langchain/groq`])e.push(new J(t,U2,this._patch.bind(this),e=>e,[new CR(`${t}/dist/index.cjs`,U2,this._patch.bind(this),e=>e)]));return e.push(new J(`langchain`,U2,this._patch.bind(this),e=>e,[new CR(`langchain/dist/chat_models/universal.cjs`,U2,this._patch.bind(this),e=>e)])),e}_patch(e){Yf([$v,_y,Wy]);let t=this.getConfig(),n=Ab(t);return this._patchRunnableMethods(e,n),this._patchEmbeddingsMethods(e,t),e}_patchRunnableMethods(e,t){let n=[`ChatAnthropic`,`ChatOpenAI`,`ChatGoogleGenerativeAI`,`ChatMistralAI`,`ChatVertexAI`,`ChatGroq`,`ConfigurableModel`],r=e.universal_exports??e,i=Object.values(r).find(e=>typeof e==`function`&&n.includes(e.name));if(!i)return;let a=i.prototype;if(!a.__sentry_patched__){a.__sentry_patched__=!0;for(let e of[`invoke`,`stream`,`batch`]){let n=a[e];typeof n==`function`&&(a[e]=W2(n,t))}}}_patchEmbeddingsMethods(e,t){let n=e.universal_exports??e;for(let e of Object.values(n)){if(typeof e!=`function`||!e.prototype)continue;let n=e.prototype;typeof n.embedQuery==`function`&&typeof n.embedDocuments==`function`&&(n.__sentry_patched__||(n.__sentry_patched__=!0,Fb(n,t)))}}},K2=Y(sb,e=>new G2(e)),q2=W(((e={})=>({name:sb,setupOnce(){K2(e)}}))),J2=[`>=0.0.0 <2.0.0`],Y2=class extends q{constructor(e={}){super(`@sentry/instrumentation-langgraph`,k,e)}init(){return[new J(`@langchain/langgraph`,J2,this._patch.bind(this),e=>e,[new CR(`@langchain/langgraph/dist/index.cjs`,J2,this._patch.bind(this),e=>e),new CR(`@langchain/langgraph/dist/prebuilt/index.cjs`,J2,this._patch.bind(this),e=>e)]),new J(`@langchain/langgraph/prebuilt`,J2,this._patch.bind(this),e=>e,[new CR(`@langchain/langgraph/dist/prebuilt/index.cjs`,J2,this._patch.bind(this),e=>e)])]}_patch(e){let t=P()?.getDataCollectionOptions().genAI,n={...this.getConfig(),recordInputs:this.getConfig().recordInputs??t?.inputs??!1,recordOutputs:this.getConfig().recordOutputs??t?.outputs??!1};if(e.StateGraph&&typeof e.StateGraph==`function`&&Qb(e.StateGraph.prototype,n),e.createReactAgent&&typeof e.createReactAgent==`function`){let t=e.createReactAgent;Object.defineProperty(e,"createReactAgent",{value:Zb(t,n),writable:!0,enumerable:!0,configurable:!0})}return e}},X2=Y(Ib,e=>new Y2(e)),Z2=W(((e={})=>({name:Ib,setupOnce(){X2(e)}}))),Q2=W(e=>(Fd()||an(()=>{console.warn(`The launchDarklyIntegration() can only be used in the browser.`)}),{name:`LaunchDarkly`}));function $2(){return Fd()||an(()=>{console.warn(`The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.`)}),{name:`sentry-flag-auditor`,type:`flag-used`,synchronous:!0,method:()=>null}}var e4=W(e=>(Fd()||an(()=>{console.warn(`The openFeatureIntegration() can only be used in the browser.`)}),{name:`OpenFeature`})),t4=class{constructor(){Fd()||an(()=>{console.warn(`The OpenFeatureIntegrationHook can only be used in the browser.`)})}after(){}error(){}},n4=W(e=>(Fd()||an(()=>{console.warn(`The statsigIntegration() can only be used in the browser.`)}),{name:`Statsig`})),r4=W(e=>(Fd()||an(()=>{console.warn(`The unleashIntegration() can only be used in the browser.`)}),{name:`Unleash`})),i4=qh;function a4(e,t,n){let r=new J(`@firebase/firestore`,e,e=>o4(e,t,n));for(let i of[`@firebase/firestore/dist/lite/index.node.cjs.js`,`@firebase/firestore/dist/lite/index.node.mjs.js`,`@firebase/firestore/dist/lite/index.rn.esm2017.js`,`@firebase/firestore/dist/lite/index.cjs.js`])r.files.push(new CR(i,e,e=>o4(e,t,n),e=>s4(e,n)));return r}function o4(e,t,n){return s4(e,n),t(e,`addDoc`,c4()),t(e,`getDocs`,u4()),t(e,`setDoc`,d4()),t(e,`deleteDoc`,l4()),e}function s4(e,t){for(let n of[`addDoc`,`getDocs`,`setDoc`,`deleteDoc`])K(e[n])&&t(e,n);return e}function c4(){return function(e){return function(t,n){return f4(`addDoc`,t,()=>e(t,n))}}}function l4(){return function(e){return function(t){return f4(`deleteDoc`,t.parent||t,()=>e(t))}}}function u4(){return function(e){return function(t){return f4(`getDocs`,t,()=>e(t))}}}function d4(){return function(e){return function(t,n,r){return f4(`setDoc`,t.parent||t,()=>r===void 0?e(t,n):e(t,n,r))}}}function f4(e,t,n){return z({name:`${e} ${t.path}`,op:`db.query`,kind:G.CLIENT,attributes:{[I]:`auto.firebase.otel.firestore`,[jc]:e,...m4(t)}},n)}function p4(e){let t,n;if(typeof e.host==`string`){if(e.host.startsWith(`[`)){if(e.host.endsWith(`]`))t=e.host.replace(/^\[|\]$/g,``);else if(e.host.includes(`]:`)){let r=e.host.lastIndexOf(`:`);r!==-1&&(t=e.host.slice(1,r).replace(/^\[|\]$/g,``),n=e.host.slice(r+1))}}else if(S.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(`:`);r===-1?t=e.host:(t=e.host.slice(0,r),n=e.host.slice(r+1))}}return{address:t,port:n?parseInt(n,10):void 0}}function m4(e){let t=e.firestore.app,n=t.options,r=(e.firestore.toJSON()||{}).settings||{},i={[Ec]:e.path,[Oc]:t.name,[Fc]:`firebase.firestore`,"firebase.firestore.type":e.type,"firebase.firestore.options.projectId":n.projectId,"firebase.firestore.options.appId":n.appId,"firebase.firestore.options.messagingSenderId":n.messagingSenderId,"firebase.firestore.options.storageBucket":n.storageBucket},{address:a,port:o}=p4(r);return a&&(i[ou]=a),o&&(i[su]=o),i}function h4(e,t,n){let r=new J(`firebase-functions`,e);return[{name:`firebase-functions/lib/v2/providers/https.js`,triggerType:`function`},{name:`firebase-functions/lib/v2/providers/firestore.js`,triggerType:`firestore`},{name:`firebase-functions/lib/v2/providers/scheduler.js`,triggerType:`scheduler`},{name:`firebase-functions/lib/v2/storage.js`,triggerType:`storage`}].forEach(({name:i,triggerType:a})=>{r.files.push(new CR(i,e,e=>_4(e,t,n,a),e=>v4(e,n)))}),r}function g4(e){return function(t){return function(...n){let r=typeof n[0]==`function`?n[0]:n[1],i=typeof n[0]==`function`?void 0:n[0];if(!r)return t.call(this,...n);let a=async function(...t){let n=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,i={[I]:`auto.firebase.otel.functions`,"faas.name":n,"faas.trigger":e,"faas.provider":`firebase`};return process.env.GCLOUD_PROJECT&&(i[`cloud.project_id`]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(i[`cloud.event_source`]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),ts({name:`firebase.function.${e}`,op:`http.request`,kind:G.SERVER,attributes:i},async e=>{try{let n=await r.apply(this,t);return e.end(),n}catch(t){throw e.setStatus({code:2}),H(t,{mechanism:{type:`auto.firebase.otel.functions`,handled:!1}}),e.end(),await rd(2e3),t}})};return i?t.call(this,i,a):t.call(this,a)}}}function _4(e,t,n,r){switch(v4(e,n),r){case`function`:t(e,`onRequest`,g4(`http.request`)),t(e,`onCall`,g4(`http.call`));break;case`firestore`:t(e,`onDocumentCreated`,g4(`firestore.document.created`)),t(e,`onDocumentUpdated`,g4(`firestore.document.updated`)),t(e,`onDocumentDeleted`,g4(`firestore.document.deleted`)),t(e,`onDocumentWritten`,g4(`firestore.document.written`)),t(e,`onDocumentCreatedWithAuthContext`,g4(`firestore.document.created`)),t(e,`onDocumentUpdatedWithAuthContext`,g4(`firestore.document.updated`)),t(e,`onDocumentDeletedWithAuthContext`,g4(`firestore.document.deleted`)),t(e,`onDocumentWrittenWithAuthContext`,g4(`firestore.document.written`));break;case`scheduler`:t(e,`onSchedule`,g4(`scheduler.scheduled`));break;case`storage`:t(e,`onObjectFinalized`,g4(`storage.object.finalized`)),t(e,`onObjectArchived`,g4(`storage.object.archived`)),t(e,`onObjectDeleted`,g4(`storage.object.deleted`)),t(e,`onObjectMetadataUpdated`,g4(`storage.object.metadataUpdated`))}return e}function v4(e,t){for(let n of[`onSchedule`,`onRequest`,`onCall`,`onObjectFinalized`,`onObjectArchived`,`onObjectDeleted`,`onObjectMetadataUpdated`,`onDocumentCreated`,`onDocumentUpdated`,`onDocumentDeleted`,`onDocumentWritten`,`onDocumentCreatedWithAuthContext`,`onDocumentUpdatedWithAuthContext`,`onDocumentDeletedWithAuthContext`,`onDocumentWrittenWithAuthContext`])K(e[n])&&t(e,n);return e}var y4=[`>=3.0.0 <5`],b4=[`>=6.0.0 <7`],x4=class extends q{constructor(e={}){super(`@sentry/instrumentation-firebase`,k,e)}init(){let e=[];return e.push(a4(y4,this._wrap,this._unwrap)),e.push(h4(b4,this._wrap,this._unwrap)),e}},S4=`Firebase`,C4=Y(S4,()=>new x4),w4=W((()=>({name:S4,setupOnce(){C4()}})));function T4(){return[QN(),xR(),lz(),JH(),$z(),_B(),kB(),KB(),IV(),lH(),lI(),FH(),cU(),xU(),c0(),m0(),jz(),v2(),Iz(),q2(),Z2(),A2(),P2(),R2(),H2(),_H(),w4()]}function E4(){return[gN,XN,bU,vR,PH,qH,Az,sU,Fz,Qz,gB,OB,GB,cH,PH,cz,FV,s0,p0,_2,K2,O2,N2,hH,C4,L2,V2,X2]}b();var D4=1e6,O4=Symbol.for(`opentelemetry.js.api.1`);function k4(e){if(g.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[O4];if(n&&!n.trace){if(GN&&A.warn("Replaced a pre-existing OpenTelemetry API registry that was created by a different @opentelemetry/api version and would have blocked tracing. If you want to manage OpenTelemetry yourself, set `skipOpenTelemetrySetup: true` in `Sentry.init()`."),t[O4]=void 0,!g.setGlobalTracerProvider(e))return!1;let r=t[O4];if(r){let{propagation:e,context:i,...a}=n;t[O4]={...a,...r}}return!0}return!1}function A4(e,t={}){e.getOptions().debug&&nA();let[n,r]=N4(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function j4(e={}){let{debug:t}=e;t&&A.enable(),fM(),M4(e.integrations).forEach(e=>{e(),t&&A.log(`[Sentry] Preloaded ${e.id} instrumentation`)})}function M4(e){let t=E4();return e?t.filter(t=>{let n=t.id;return e.some(e=>n===e||n.startsWith(`${e}.`))}):t}function N4(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||t.spanProcessors?.length))return P4(e);let n=new UD({sampler:new kk(e),resource:Kk(`node`),forceFlushTimeoutMillis:500,spanProcessors:[new Ok({timeout:F4(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});k4(n),d.setGlobalPropagator(new PO);let i=new tA;return r.setGlobalContextManager(i),[n,i.getAsyncLocalStorageLookup()]}function P4(e){let t=new zk({resource:Kk(`node`)});if(!k4(t))return GN&&A.warn(`Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered.`),[void 0,void 0];NO(`SentryTracerProvider`),d.setGlobalPropagator(new PO);let n=new tA;return r.setGlobalContextManager(n),e.on(`spanEnd`,e=>{Pk(e,{finalizeStatus:!0})}),Wo(e)&&e.on(`preprocessSpan`,Dk),e.on(`preprocessEvent`,e=>{e.type===`transaction`&&(e.contexts={...e.contexts,otel:{resource:t.resource?.attributes,...e.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function F4(e){if(e!=null){if(e>D4)return GN&&A.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${D4}`),D4;if(e<=0||Number.isNaN(e)){GN&&A.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function I4(){return pM().filter(e=>e.name!==`Http`&&e.name!==`NodeFetch`).concat(_N(),vN())}function L4(e){return[...I4(),...to(e)?T4():[]]}function R4(e,t){if(XB()&&to(t)){let t=ZB();if(t){let n=new Set(t.replacedOtelIntegrationNames);return[...e.filter(e=>!n.has(e.name)),...t.integrations]}}return e}function z4(e={}){return B4(e,L4)}function B4(e={},t){vp(e,`node`);let n=XB()&&to(e)?ZB():void 0;n&&n.register();let r=e.defaultIntegrations??t(e);if(n&&Array.isArray(r)&&r.length>0){let e=new Set(n.replacedOtelIntegrationNames);r=[...r.filter(t=>!e.has(t.name)),...n.integrations]}let i=mM({...e,defaultIntegrations:r});return i&&!e.skipOpenTelemetrySetup&&(A4(i,{spanProcessors:e.openTelemetrySpanProcessors}),gM()),n&&n.detect(),i}function V4(e={}){return B4(e,()=>[])}var H4=[...KU,...YU,...QU,...nW,...aW,...pW,...gW,...bW,...CW,...EW,...kW,...MW,...VW,...WW,...QW,...aG,...cG,...fG,..._G,...xG,...wG,...OG,...jG,...PG,...LG,...BG,...UG,...YG,...QG];[...JU,...ZU,...eW,...iW,...sW,...hW,...vW,...SW,...TW,...OW,...jW,...PW,...UW,...KW,...tG,...sG,...uG,...mG,...bG,...CG,...EG,...AG,...NG,...IG,...zG,...HG,...GG,...ZG,...tK];function U4(e=[]){return[...Tp([...H4,...e].map(e=>e.module.name)),`@remix-run/node`]}U4();function W4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var G4=K4;function K4(e,t){let[n]=e3(e,``);for(let e of Y4(t))if(q4(e,n))return!0;return!1}function q4(e,t){for(let[n,r]of e)if(!t3(t,r,n))return!1;return!0}function J4(e){return e===`latest`&&(e=`>=0`),e.match(/^([^\d+]*)(\d.*)$/)||[null,``,`*.*.*`]}function Y4(e){let t=[],n=[],r=e.trim().split(/\s+/);for(let e=0;e<r.length;e++){let i=r[e];if(i===`-`)continue;if(i===`||`){t.push(n),n=[];continue}if(/^[<>=~v^]+$/.test(i)&&e+1<r.length){r[e+1]=i+r[e+1];continue}let a=J4(i),o=a[1]||`=`;o.endsWith(`v`)&&(o=o.slice(0,-1));let[s,c]=e3(a[2],o);if(e+2<r.length&&r[e+1]===`-`){let t=J4(r[e+2]);r[e+2]=`<=`+(t[2].indexOf(`-`)===-1?t[2]+`.*.*`:t[2]),c=`>=`}if(c[0]===`~`){let e=a[2].split(`-`)[0].split(`.`).length;n.push([`>=`,s]),n.push([`<`,e===1?X4(s,0):X4(s,1)])}else if(c[0]===`^`){let e=s[0]===0?s[1]===0?2:1:0;n.push([`>=`,s]),n.push([`<`,e===0?X4(s,0):e===1?X4(s,1):X4(s,2)])}else n.push([c.replace(`~`,``).replace(`^`,``),s])}return n.length&&t.push(n),t}function X4(e,t){let n=e.slice(0);if(e[t]===-1)return n;for(n[t++]++;t<3;t++)n[t]=0;return n}function Z4(e){return e===`x`||e===`X`||e===`*`||e===`latest`?-1:Number(e)}function Q4(e){return/^\d+$/.test(e)?Number(e):e}function $4(e,t,n){return n===-1?e!==`<`:e===`=`?t===n:e===`>`?t>n:e===`>=`?t>=n:e===`<`?t<n:e===`<=`&&t<=n}function e3(e,t){e=e.split(`+`)[0];let[n,r]=e.split(`-`),i=n.split(`.`).map(Z4).slice(0,3),a=Math.max(i.length-1,0);return t===`>`?(t=`>=`,i.push(0,0,0),i[a]++):t===``?i.push(0,0,0):i.push(-1,-1,-1),r?[i.slice(0,3).concat(r.split(`.`).map(Q4)),t]:[i.slice(0,3),t]}function t3(e,t,n){if(!$4(`=`,e[0],t[0]))return $4(n,e[0],t[0]);if(!$4(`=`,e[1],t[1]))return $4(n,e[1],t[1]);if(!$4(`=`,e[2],t[2])||e.length===3&&t.length===3)return $4(n,e[2],t[2]);if(n[0]===`<`&&(t.length===3||e.length===3))return!1;if(n[0]===`>`){if(e.length===3)return!0;if(t.length===3)return!1}for(let r=3;r<Math.max(e.length,t.length);r++)if($4(n,e[r]||``,t[r]||``))return!0;return!1}function n3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r3(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}})(e,t)||o3(e,t)||(function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
32
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function i3(e){return(function(e){if(Array.isArray(e))return n3(e)})(e)||(function(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)})(e)||o3(e)||(function(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
33
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function a3(e){return(a3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e})(e)}function o3(e,t){if(e){if(typeof e==`string`)return n3(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?n3(e,t):void 0}}function s3(e,t){return e(t={exports:{}},t.exports),t.exports}var c3=s3((function(e,t){(function e(t){var n,r,i,a,o,s;function c(e){var t,n,r={};for(t in e)e.hasOwnProperty(t)&&(n=e[t],r[t]=typeof n==`object`&&n?c(n):n);return r}function l(e,t){this.parent=e,this.key=t}function u(e,t,n,r){this.node=e,this.path=t,this.wrap=n,this.ref=r}function d(){}function f(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function p(e,t){return(e===n.ObjectExpression||e===n.ObjectPattern)&&t===`properties`}function m(e,t){for(var n=e.length-1;n>=0;--n)if(e[n].node===t)return!0;return!1}function h(e,t){return new d().traverse(e,t)}function g(e,t){var n=(function(e,t){for(var n,r=e.length,i=0,a;r;)t(e[a=i+(n=r>>>1)])?r=n:(i=a+1,r-=n+1);return i})(t,(function(t){return t.range[0]>e.range[0]}));return e.extendedRange=[e.range[0],e.range[1]],n!==t.length&&(e.extendedRange[1]=t[n].range[0]),--n>=0&&(e.extendedRange[0]=t[n].range[1]),e}return n={AssignmentExpression:`AssignmentExpression`,AssignmentPattern:`AssignmentPattern`,ArrayExpression:`ArrayExpression`,ArrayPattern:`ArrayPattern`,ArrowFunctionExpression:`ArrowFunctionExpression`,AwaitExpression:`AwaitExpression`,BlockStatement:`BlockStatement`,BinaryExpression:`BinaryExpression`,BreakStatement:`BreakStatement`,CallExpression:`CallExpression`,CatchClause:`CatchClause`,ChainExpression:`ChainExpression`,ClassBody:`ClassBody`,ClassDeclaration:`ClassDeclaration`,ClassExpression:`ClassExpression`,ComprehensionBlock:`ComprehensionBlock`,ComprehensionExpression:`ComprehensionExpression`,ConditionalExpression:`ConditionalExpression`,ContinueStatement:`ContinueStatement`,DebuggerStatement:`DebuggerStatement`,DirectiveStatement:`DirectiveStatement`,DoWhileStatement:`DoWhileStatement`,EmptyStatement:`EmptyStatement`,ExportAllDeclaration:`ExportAllDeclaration`,ExportDefaultDeclaration:`ExportDefaultDeclaration`,ExportNamedDeclaration:`ExportNamedDeclaration`,ExportSpecifier:`ExportSpecifier`,ExpressionStatement:`ExpressionStatement`,ForStatement:`ForStatement`,ForInStatement:`ForInStatement`,ForOfStatement:`ForOfStatement`,FunctionDeclaration:`FunctionDeclaration`,FunctionExpression:`FunctionExpression`,GeneratorExpression:`GeneratorExpression`,Identifier:`Identifier`,IfStatement:`IfStatement`,ImportExpression:`ImportExpression`,ImportDeclaration:`ImportDeclaration`,ImportDefaultSpecifier:`ImportDefaultSpecifier`,ImportNamespaceSpecifier:`ImportNamespaceSpecifier`,ImportSpecifier:`ImportSpecifier`,Literal:`Literal`,LabeledStatement:`LabeledStatement`,LogicalExpression:`LogicalExpression`,MemberExpression:`MemberExpression`,MetaProperty:`MetaProperty`,MethodDefinition:`MethodDefinition`,ModuleSpecifier:`ModuleSpecifier`,NewExpression:`NewExpression`,ObjectExpression:`ObjectExpression`,ObjectPattern:`ObjectPattern`,PrivateIdentifier:`PrivateIdentifier`,Program:`Program`,Property:`Property`,PropertyDefinition:`PropertyDefinition`,RestElement:`RestElement`,ReturnStatement:`ReturnStatement`,SequenceExpression:`SequenceExpression`,SpreadElement:`SpreadElement`,Super:`Super`,SwitchStatement:`SwitchStatement`,SwitchCase:`SwitchCase`,TaggedTemplateExpression:`TaggedTemplateExpression`,TemplateElement:`TemplateElement`,TemplateLiteral:`TemplateLiteral`,ThisExpression:`ThisExpression`,ThrowStatement:`ThrowStatement`,TryStatement:`TryStatement`,UnaryExpression:`UnaryExpression`,UpdateExpression:`UpdateExpression`,VariableDeclaration:`VariableDeclaration`,VariableDeclarator:`VariableDeclarator`,WhileStatement:`WhileStatement`,WithStatement:`WithStatement`,YieldExpression:`YieldExpression`},i={AssignmentExpression:[`left`,`right`],AssignmentPattern:[`left`,`right`],ArrayExpression:[`elements`],ArrayPattern:[`elements`],ArrowFunctionExpression:[`params`,`body`],AwaitExpression:[`argument`],BlockStatement:[`body`],BinaryExpression:[`left`,`right`],BreakStatement:[`label`],CallExpression:[`callee`,`arguments`],CatchClause:[`param`,`body`],ChainExpression:[`expression`],ClassBody:[`body`],ClassDeclaration:[`id`,`superClass`,`body`],ClassExpression:[`id`,`superClass`,`body`],ComprehensionBlock:[`left`,`right`],ComprehensionExpression:[`blocks`,`filter`,`body`],ConditionalExpression:[`test`,`consequent`,`alternate`],ContinueStatement:[`label`],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:[`body`,`test`],EmptyStatement:[],ExportAllDeclaration:[`source`],ExportDefaultDeclaration:[`declaration`],ExportNamedDeclaration:[`declaration`,`specifiers`,`source`],ExportSpecifier:[`exported`,`local`],ExpressionStatement:[`expression`],ForStatement:[`init`,`test`,`update`,`body`],ForInStatement:[`left`,`right`,`body`],ForOfStatement:[`left`,`right`,`body`],FunctionDeclaration:[`id`,`params`,`body`],FunctionExpression:[`id`,`params`,`body`],GeneratorExpression:[`blocks`,`filter`,`body`],Identifier:[],IfStatement:[`test`,`consequent`,`alternate`],ImportExpression:[`source`],ImportDeclaration:[`specifiers`,`source`],ImportDefaultSpecifier:[`local`],ImportNamespaceSpecifier:[`local`],ImportSpecifier:[`imported`,`local`],Literal:[],LabeledStatement:[`label`,`body`],LogicalExpression:[`left`,`right`],MemberExpression:[`object`,`property`],MetaProperty:[`meta`,`property`],MethodDefinition:[`key`,`value`],ModuleSpecifier:[],NewExpression:[`callee`,`arguments`],ObjectExpression:[`properties`],ObjectPattern:[`properties`],PrivateIdentifier:[],Program:[`body`],Property:[`key`,`value`],PropertyDefinition:[`key`,`value`],RestElement:[`argument`],ReturnStatement:[`argument`],SequenceExpression:[`expressions`],SpreadElement:[`argument`],Super:[],SwitchStatement:[`discriminant`,`cases`],SwitchCase:[`test`,`consequent`],TaggedTemplateExpression:[`tag`,`quasi`],TemplateElement:[],TemplateLiteral:[`quasis`,`expressions`],ThisExpression:[],ThrowStatement:[`argument`],TryStatement:[`block`,`handler`,`finalizer`],UnaryExpression:[`argument`],UpdateExpression:[`argument`],VariableDeclaration:[`declarations`],VariableDeclarator:[`id`,`init`],WhileStatement:[`test`,`body`],WithStatement:[`object`,`body`],YieldExpression:[`argument`]},r={Break:a={},Skip:o={},Remove:s={}},l.prototype.replace=function(e){this.parent[this.key]=e},l.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},d.prototype.path=function(){var e,t,n,r,i;function a(e,t){if(Array.isArray(t))for(n=0,r=t.length;n<r;++n)e.push(t[n]);else e.push(t)}if(!this.__current.path)return null;for(i=[],e=2,t=this.__leavelist.length;e<t;++e)a(i,this.__leavelist[e].path);return a(i,this.__current.path),i},d.prototype.type=function(){return this.current().type||this.__current.wrap},d.prototype.parents=function(){var e,t,n=[];for(e=1,t=this.__leavelist.length;e<t;++e)n.push(this.__leavelist[e].node);return n},d.prototype.current=function(){return this.__current.node},d.prototype.__execute=function(e,t){var n,r=void 0;return n=this.__current,this.__current=t,this.__state=null,e&&(r=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=n,r},d.prototype.notify=function(e){this.__state=e},d.prototype.skip=function(){this.notify(o)},d.prototype.break=function(){this.notify(a)},d.prototype.remove=function(){this.notify(s)},d.prototype.__initialize=function(e,t){this.visitor=t,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,t.fallback===`iteration`?this.__fallback=Object.keys:typeof t.fallback==`function`&&(this.__fallback=t.fallback),this.__keys=i,t.keys&&(this.__keys=Object.assign(Object.create(this.__keys),t.keys))},d.prototype.traverse=function(e,t){var n,r,i,s,c,l,d,h,g,_,v,y;for(this.__initialize(e,t),y={},n=this.__worklist,r=this.__leavelist,n.push(new u(e,null,null,null)),r.push(new u(null,null,null,null));n.length;)if((i=n.pop())!==y){if(i.node){if(l=this.__execute(t.enter,i),this.__state===a||l===a)return;if(n.push(y),r.push(i),this.__state===o||l===o)continue;if(c=(s=i.node).type||i.wrap,!(_=this.__keys[c])){if(!this.__fallback)throw Error(`Unknown node type `+c+`.`);_=this.__fallback(s)}for(h=_.length;--h>=0;)if(v=s[d=_[h]]){if(Array.isArray(v)){for(g=v.length;--g>=0;)if(v[g]&&!m(r,v[g])){if(p(c,_[h]))i=new u(v[g],[d,g],`Property`,null);else{if(!f(v[g]))continue;i=new u(v[g],[d,g],null,null)}n.push(i)}}else if(f(v)){if(m(r,v))continue;n.push(new u(v,d,null,null))}}}}else if(i=r.pop(),l=this.__execute(t.leave,i),this.__state===a||l===a)return},d.prototype.replace=function(e,t){var n,r,i,c,d,m,h,g,_,v,y,ee,te;function ne(e){var t,r,i,a;if(e.ref.remove()){for(r=e.ref.key,a=e.ref.parent,t=n.length;t--;)if((i=n[t]).ref&&i.ref.parent===a){if(i.ref.key<r)break;--i.ref.key}}}for(this.__initialize(e,t),y={},n=this.__worklist,r=this.__leavelist,m=new u(e,null,null,new l(ee={root:e},`root`)),n.push(m),r.push(m);n.length;)if((m=n.pop())!==y){if((d=this.__execute(t.enter,m))!==void 0&&d!==a&&d!==o&&d!==s&&(m.ref.replace(d),m.node=d),this.__state!==s&&d!==s||(ne(m),m.node=null),this.__state===a||d===a)return ee.root;if((i=m.node)&&(n.push(y),r.push(m),this.__state!==o&&d!==o)){if(c=i.type||m.wrap,!(_=this.__keys[c])){if(!this.__fallback)throw Error(`Unknown node type `+c+`.`);_=this.__fallback(i)}for(h=_.length;--h>=0;)if(v=i[te=_[h]]){if(Array.isArray(v)){for(g=v.length;--g>=0;)if(v[g]){if(p(c,_[h]))m=new u(v[g],[te,g],`Property`,new l(v,g));else{if(!f(v[g]))continue;m=new u(v[g],[te,g],null,new l(v,g))}n.push(m)}}else f(v)&&n.push(new u(v,te,null,new l(i,te)))}}}else if(m=r.pop(),(d=this.__execute(t.leave,m))!==void 0&&d!==a&&d!==o&&d!==s&&m.ref.replace(d),this.__state!==s&&d!==s||ne(m),this.__state===a||d===a)return ee.root;return ee.root},t.Syntax=n,t.traverse=h,t.replace=function(e,t){return new d().replace(e,t)},t.attachComments=function(e,t,n){var i,a,o,s,l=[];if(!e.range)throw Error(`attachComments needs range information`);if(!n.length){if(t.length){for(o=0,a=t.length;o<a;o+=1)(i=c(t[o])).extendedRange=[0,e.range[0]],l.push(i);e.leadingComments=l}return e}for(o=0,a=t.length;o<a;o+=1)l.push(g(c(t[o]),n));return s=0,h(e,{enter:function(e){for(var t;s<l.length&&!((t=l[s]).extendedRange[1]>e.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||=[],e.leadingComments.push(t),l.splice(s,1)):s+=1;return s===l.length?r.Break:l[s].extendedRange[0]>e.range[1]?r.Skip:void 0}}),s=0,h(e,{leave:function(e){for(var t;s<l.length&&(t=l[s],!(e.range[1]<t.extendedRange[0]));)e.range[1]===t.extendedRange[0]?(e.trailingComments||=[],e.trailingComments.push(t),l.splice(s,1)):s+=1;return s===l.length?r.Break:l[s].extendedRange[0]>e.range[1]?r.Skip:void 0}}),e},t.VisitorKeys=i,t.VisitorOption=r,t.Controller=d,t.cloneEnvironment=function(){return e({})},t})(t)})),l3=s3((function(e){e.exports&&=(function(){function e(t,n,r,i){this.message=t,this.expected=n,this.found=r,this.location=i,this.name=`SyntaxError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e)}return(function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n})(e,Error),e.buildMessage=function(e,t){var n={literal:function(e){return`"`+i(e.text)+`"`},class:function(e){var t,n=``;for(t=0;t<e.parts.length;t++)n+=e.parts[t]instanceof Array?a(e.parts[t][0])+`-`+a(e.parts[t][1]):a(e.parts[t]);return`[`+(e.inverted?`^`:``)+n+`]`},any:function(e){return`any character`},end:function(e){return`end of input`},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function i(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,(function(e){return`\\x0`+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return`\\x`+r(e)}))}function a(e){return e.replace(/\\/g,`\\\\`).replace(/\]/g,`\\]`).replace(/\^/g,`\\^`).replace(/-/g,`\\-`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,(function(e){return`\\x0`+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return`\\x`+r(e)}))}return`Expected `+(function(e){var t,r,i,a=Array(e.length);for(t=0;t<e.length;t++)a[t]=(i=e[t],n[i.type](i));if(a.sort(),a.length>0){for(t=1,r=1;t<a.length;t++)a[t-1]!==a[t]&&(a[r]=a[t],r++);a.length=r}switch(a.length){case 1:return a[0];case 2:return a[0]+` or `+a[1];default:return a.slice(0,-1).join(`, `)+`, or `+a[a.length-1]}})(e)+` but `+(function(e){return e?`"`+i(e)+`"`:`end of input`})(t)+` found.`},{SyntaxError:e,parse:function(t,n){n=n===void 0?{}:n;var r,i,a,o,s={},c={start:Je},l=Je,u=C(` `,!1),d=/^[^ [\],():#!=><~+.]/,f=Ke([` `,`[`,`]`,`,`,`(`,`)`,`:`,`#`,`!`,`=`,`>`,`<`,`~`,`+`,`.`],!0,!1),p=C(`>`,!1),m=C(`~`,!1),h=C(`+`,!1),g=C(`,`,!1),_=function(e,t){return[e].concat(t.map((function(e){return e[3]})))},v=C(`!`,!1),y=C(`*`,!1),ee=C(`#`,!1),te=C(`[`,!1),ne=C(`]`,!1),re=/^[><!]/,ie=Ke([`>`,`<`,`!`],!1,!1),ae=C(`=`,!1),oe=function(e){return(e||``)+`=`},b=/^[><]/,se=Ke([`>`,`<`],!1,!1),ce=C(`.`,!1),le=function(e,t,n){return{type:`attribute`,name:e,operator:t,value:n}},ue=C(`"`,!1),de=/^[^\\"]/,fe=Ke([`\\`,`"`],!0,!1),pe=C(`\\`,!1),me={type:`any`},he=function(e,t){return e+t},ge=function(e){return{type:`literal`,value:(t=e.join(``),t.replace(/\\(.)/g,(function(e,t){switch(t){case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
|
|
34
|
+
`;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;default:return t}})))};var t},_e=C(`'`,!1),ve=/^[^\\']/,ye=Ke([`\\`,`'`],!0,!1),be=/^[0-9]/,xe=Ke([[`0`,`9`]],!1,!1),Se=C(`type(`,!1),Ce=/^[^ )]/,we=Ke([` `,`)`],!0,!1),Te=C(`)`,!1),Ee=/^[imsu]/,De=Ke([`i`,`m`,`s`,`u`],!1,!1),Oe=C(`/`,!1),ke=/^[^\]\\]/,Ae=Ke([`]`,`\\`],!0,!1),je=/^[^\/\\[]/,Me=Ke([`/`,`\\`,`[`],!0,!1),Ne=C(`:not(`,!1),Pe=C(`:matches(`,!1),Fe=function(e){return{type:`matches`,selectors:e}},Ie=C(`:is(`,!1),Le=C(`:has(`,!1),Re=C(`:first-child`,!1),ze=C(`:last-child`,!1),Be=C(`:nth-child(`,!1),Ve=C(`:nth-last-child(`,!1),He=C(`:`,!1),x=0,Ue=[{line:1,column:1}],We=0,Ge=[],S={};if(`startRule`in n){if(!(n.startRule in c))throw Error(`Can't start parsing from rule "`+n.startRule+`".`);l=c[n.startRule]}function C(e,t){return{type:`literal`,text:e,ignoreCase:t}}function Ke(e,t,n){return{type:`class`,parts:e,inverted:t,ignoreCase:n}}function w(e){var n,r=Ue[e];if(r)return r;for(n=e-1;!Ue[n];)n--;for(r={line:(r=Ue[n]).line,column:r.column};n<e;)t.charCodeAt(n)===10?(r.line++,r.column=1):r.column++,n++;return Ue[e]=r,r}function qe(e,t){var n=w(e),r=w(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function T(e){x<We||(x>We&&(We=x,Ge=[]),Ge.push(e))}function Je(){var e,t,n,r,i=36*x+0,a=S[i];return a?(x=a.nextPos,a.result):(e=x,(t=E())!==s&&(n=Ze())!==s&&E()!==s?e=t=(r=n).length===1?r[0]:{type:`matches`,selectors:r}:(x=e,e=s),e===s&&(e=x,(t=E())!==s&&(t=void 0),e=t),S[i]={nextPos:x,result:e},e)}function E(){var e,n,r=36*x+1,i=S[r];if(i)return x=i.nextPos,i.result;for(e=[],t.charCodeAt(x)===32?(n=` `,x++):(n=s,T(u));n!==s;)e.push(n),t.charCodeAt(x)===32?(n=` `,x++):(n=s,T(u));return S[r]={nextPos:x,result:e},e}function Ye(){var e,n,r,i=36*x+2,a=S[i];if(a)return x=a.nextPos,a.result;if(n=[],d.test(t.charAt(x))?(r=t.charAt(x),x++):(r=s,T(f)),r!==s)for(;r!==s;)n.push(r),d.test(t.charAt(x))?(r=t.charAt(x),x++):(r=s,T(f));else n=s;return n!==s&&(n=n.join(``)),e=n,S[i]={nextPos:x,result:e},e}function Xe(){var e,n,r,i=36*x+3,a=S[i];return a?(x=a.nextPos,a.result):(e=x,(n=E())===s?(x=e,e=s):(t.charCodeAt(x)===62?(r=`>`,x++):(r=s,T(p)),r!==s&&E()!==s?e=n=`child`:(x=e,e=s)),e===s&&(e=x,(n=E())===s?(x=e,e=s):(t.charCodeAt(x)===126?(r=`~`,x++):(r=s,T(m)),r!==s&&E()!==s?e=n=`sibling`:(x=e,e=s)),e===s&&(e=x,(n=E())===s?(x=e,e=s):(t.charCodeAt(x)===43?(r=`+`,x++):(r=s,T(h)),r!==s&&E()!==s?e=n=`adjacent`:(x=e,e=s)),e===s&&(e=x,t.charCodeAt(x)===32?(n=` `,x++):(n=s,T(u)),n!==s&&(r=E())!==s?e=n=`descendant`:(x=e,e=s)))),S[i]={nextPos:x,result:e},e)}function Ze(){var e,n,r,i,a,o,c,l,u=36*x+5,d=S[u];if(d)return x=d.nextPos,d.result;if(e=x,(n=$e())!==s){for(r=[],i=x,(a=E())===s?(x=i,i=s):(t.charCodeAt(x)===44?(o=`,`,x++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=$e())!==s?i=a=[a,o,c,l]:(x=i,i=s));i!==s;)r.push(i),i=x,(a=E())===s?(x=i,i=s):(t.charCodeAt(x)===44?(o=`,`,x++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=$e())!==s?i=a=[a,o,c,l]:(x=i,i=s));r===s?(x=e,e=s):e=n=_(n,r)}else x=e,e=s;return S[u]={nextPos:x,result:e},e}function Qe(){var e,t,n,r,i,a=36*x+6,o=S[a];return o?(x=o.nextPos,o.result):(e=x,(t=Xe())===s&&(t=null),t!==s&&(n=$e())!==s?(i=n,e=t=(r=t)?{type:r,left:{type:`exactNode`},right:i}:i):(x=e,e=s),S[a]={nextPos:x,result:e},e)}function $e(){var e,t,n,r,i,a,o,c=36*x+7,l=S[c];if(l)return x=l.nextPos,l.result;if(e=x,(t=et())!==s){for(n=[],r=x,(i=Xe())!==s&&(a=et())!==s?r=i=[i,a]:(x=r,r=s);r!==s;)n.push(r),r=x,(i=Xe())!==s&&(a=et())!==s?r=i=[i,a]:(x=r,r=s);n===s?(x=e,e=s):(o=t,e=t=n.reduce((function(e,t){return{type:t[0],left:e,right:t[1]}}),o))}else x=e,e=s;return S[c]={nextPos:x,result:e},e}function et(){var e,n,r,i,a,o,c,l=36*x+8,u=S[l];if(u)return x=u.nextPos,u.result;if(e=x,t.charCodeAt(x)===33?(n=`!`,x++):(n=s,T(v)),n===s&&(n=null),n!==s){if(r=[],(i=tt())!==s)for(;i!==s;)r.push(i),i=tt();else r=s;r===s?(x=e,e=s):(a=n,c=(o=r).length===1?o[0]:{type:`compound`,selectors:o},a&&(c.subject=!0),e=n=c)}else x=e,e=s;return S[l]={nextPos:x,result:e},e}function tt(){var e,n=36*x+9,r=S[n];return r?(x=r.nextPos,r.result):((e=(function(){var e,n,r=36*x+10,i=S[r];return i?(x=i.nextPos,i.result):(t.charCodeAt(x)===42?(n=`*`,x++):(n=s,T(y)),n!==s&&(n={type:`wildcard`,value:n}),e=n,S[r]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r,i=36*x+11,a=S[i];return a?(x=a.nextPos,a.result):(e=x,t.charCodeAt(x)===35?(n=`#`,x++):(n=s,T(ee)),n===s&&(n=null),n!==s&&(r=Ye())!==s?e=n={type:`identifier`,value:r}:(x=e,e=s),S[i]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*x+12,o=S[a];return o?(x=o.nextPos,o.result):(e=x,t.charCodeAt(x)===91?(n=`[`,x++):(n=s,T(te)),n!==s&&E()!==s&&(r=(function(){var e,n,r,i,a=36*x+16,o=S[a];return o?(x=o.nextPos,o.result):(e=x,(n=nt())!==s&&E()!==s&&(r=(function(){var e,n,r,i=36*x+14,a=S[i];return a?(x=a.nextPos,a.result):(e=x,t.charCodeAt(x)===33?(n=`!`,x++):(n=s,T(v)),n===s&&(n=null),n===s?(x=e,e=s):(t.charCodeAt(x)===61?(r=`=`,x++):(r=s,T(ae)),r===s?(x=e,e=s):(n=oe(n),e=n)),S[i]={nextPos:x,result:e},e)})())!==s&&E()!==s?((i=(function(){var e,n,r,i,a,o=36*x+20,c=S[o];if(c)return x=c.nextPos,c.result;if(e=x,t.substr(x,5)===`type(`?(n=`type(`,x+=5):(n=s,T(Se)),n!==s){if(E()!==s){if(r=[],Ce.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(we)),i!==s)for(;i!==s;)r.push(i),Ce.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(we));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(x)===41?(a=`)`,x++):(a=s,T(Te)),a===s?(x=e,e=s):(n={type:`type`,value:r.join(``)},e=n)):(x=e,e=s)}else x=e,e=s}else x=e,e=s;return S[o]={nextPos:x,result:e},e})())===s&&(i=(function(){var e,n,r,i,a,o,c=36*x+22,l=S[c];if(l)return x=l.nextPos,l.result;if(e=x,t.charCodeAt(x)===47?(n=`/`,x++):(n=s,T(Oe)),n!==s){if(r=[],(i=rt())===s&&(i=it())===s&&(i=at()),i!==s)for(;i!==s;)r.push(i),(i=rt())===s&&(i=it())===s&&(i=at());else r=s;r===s?(x=e,e=s):(t.charCodeAt(x)===47?(i=`/`,x++):(i=s,T(Oe)),i===s?(x=e,e=s):((a=(function(){var e,n,r=36*x+21,i=S[r];if(i)return x=i.nextPos,i.result;if(e=[],Ee.test(t.charAt(x))?(n=t.charAt(x),x++):(n=s,T(De)),n!==s)for(;n!==s;)e.push(n),Ee.test(t.charAt(x))?(n=t.charAt(x),x++):(n=s,T(De));else e=s;return S[r]={nextPos:x,result:e},e})())===s&&(a=null),a===s?(x=e,e=s):(o=a,n={type:`regexp`,value:new RegExp(r.join(``),o?o.join(``):``)},e=n)))}else x=e,e=s;return S[c]={nextPos:x,result:e},e})()),i===s?(x=e,e=s):(n=le(n,r,i),e=n)):(x=e,e=s),e===s&&(e=x,(n=nt())!==s&&E()!==s&&(r=(function(){var e,n,r,i=36*x+13,a=S[i];return a?(x=a.nextPos,a.result):(e=x,re.test(t.charAt(x))?(n=t.charAt(x),x++):(n=s,T(ie)),n===s&&(n=null),n===s?(x=e,e=s):(t.charCodeAt(x)===61?(r=`=`,x++):(r=s,T(ae)),r===s?(x=e,e=s):(n=oe(n),e=n)),e===s&&(b.test(t.charAt(x))?(e=t.charAt(x),x++):(e=s,T(se))),S[i]={nextPos:x,result:e},e)})())!==s&&E()!==s?((i=(function(){var e,n,r,i,a,o,c=36*x+17,l=S[c];if(l)return x=l.nextPos,l.result;if(e=x,t.charCodeAt(x)===34?(n=`"`,x++):(n=s,T(ue)),n!==s){for(r=[],de.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(fe)),i===s&&(i=x,t.charCodeAt(x)===92?(a=`\\`,x++):(a=s,T(pe)),a===s?(x=i,i=s):(t.length>x?(o=t.charAt(x),x++):(o=s,T(me)),o===s?(x=i,i=s):(a=he(a,o),i=a)));i!==s;)r.push(i),de.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(fe)),i===s&&(i=x,t.charCodeAt(x)===92?(a=`\\`,x++):(a=s,T(pe)),a===s?(x=i,i=s):(t.length>x?(o=t.charAt(x),x++):(o=s,T(me)),o===s?(x=i,i=s):(a=he(a,o),i=a)));r===s?(x=e,e=s):(t.charCodeAt(x)===34?(i=`"`,x++):(i=s,T(ue)),i===s?(x=e,e=s):(n=ge(r),e=n))}else x=e,e=s;if(e===s){if(e=x,t.charCodeAt(x)===39?(n=`'`,x++):(n=s,T(_e)),n!==s){for(r=[],ve.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(ye)),i===s&&(i=x,t.charCodeAt(x)===92?(a=`\\`,x++):(a=s,T(pe)),a===s?(x=i,i=s):(t.length>x?(o=t.charAt(x),x++):(o=s,T(me)),o===s?(x=i,i=s):(a=he(a,o),i=a)));i!==s;)r.push(i),ve.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(ye)),i===s&&(i=x,t.charCodeAt(x)===92?(a=`\\`,x++):(a=s,T(pe)),a===s?(x=i,i=s):(t.length>x?(o=t.charAt(x),x++):(o=s,T(me)),o===s?(x=i,i=s):(a=he(a,o),i=a)));r===s?(x=e,e=s):(t.charCodeAt(x)===39?(i=`'`,x++):(i=s,T(_e)),i===s?(x=e,e=s):(n=ge(r),e=n))}else x=e,e=s}return S[c]={nextPos:x,result:e},e})())===s&&(i=(function(){var e,n,r,i,a,o,c,l=36*x+18,u=S[l];if(u)return x=u.nextPos,u.result;for(e=x,n=x,r=[],be.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(xe));i!==s;)r.push(i),be.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(xe));if(r===s?(x=n,n=s):(t.charCodeAt(x)===46?(i=`.`,x++):(i=s,T(ce)),i===s?(x=n,n=s):n=r=[r,i]),n===s&&(n=null),n!==s){if(r=[],be.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(xe)),i!==s)for(;i!==s;)r.push(i),be.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(xe));else r=s;r===s?(x=e,e=s):(o=r,c=(a=n)?[].concat.apply([],a).join(``):``,n={type:`literal`,value:parseFloat(c+o.join(``))},e=n)}else x=e,e=s;return S[l]={nextPos:x,result:e},e})())===s&&(i=(function(){var e,t,n=36*x+19,r=S[n];return r?(x=r.nextPos,r.result):((t=Ye())!==s&&(t={type:`literal`,value:t}),e=t,S[n]={nextPos:x,result:e},e)})()),i===s?(x=e,e=s):(n=le(n,r,i),e=n)):(x=e,e=s),e===s&&(e=x,(n=nt())!==s&&(n={type:`attribute`,name:n}),e=n)),S[a]={nextPos:x,result:e},e)})())!==s&&E()!==s?(t.charCodeAt(x)===93?(i=`]`,x++):(i=s,T(ne)),i===s?(x=e,e=s):e=n=r):(x=e,e=s),S[a]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a,o,c,l,u=36*x+26,d=S[u];if(d)return x=d.nextPos,d.result;if(e=x,t.charCodeAt(x)===46?(n=`.`,x++):(n=s,T(ce)),n!==s){if((r=Ye())!==s){for(i=[],a=x,t.charCodeAt(x)===46?(o=`.`,x++):(o=s,T(ce)),o!==s&&(c=Ye())!==s?a=o=[o,c]:(x=a,a=s);a!==s;)i.push(a),a=x,t.charCodeAt(x)===46?(o=`.`,x++):(o=s,T(ce)),o!==s&&(c=Ye())!==s?a=o=[o,c]:(x=a,a=s);i===s?(x=e,e=s):(l=r,n={type:`field`,name:i.reduce((function(e,t){return e+t[0]+t[1]}),l)},e=n)}else x=e,e=s}else x=e,e=s;return S[u]={nextPos:x,result:e},e})())===s&&(e=(function(){var e,n,r,i,a=36*x+27,o=S[a];return o?(x=o.nextPos,o.result):(e=x,t.substr(x,5)===`:not(`?(n=`:not(`,x+=5):(n=s,T(Ne)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(x)===41?(i=`)`,x++):(i=s,T(Te)),i===s?(x=e,e=s):e=n={type:`not`,selectors:r}):(x=e,e=s),S[a]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*x+28,o=S[a];return o?(x=o.nextPos,o.result):(e=x,t.substr(x,9)===`:matches(`?(n=`:matches(`,x+=9):(n=s,T(Pe)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(x)===41?(i=`)`,x++):(i=s,T(Te)),i===s?(x=e,e=s):(n=Fe(r),e=n)):(x=e,e=s),S[a]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*x+29,o=S[a];return o?(x=o.nextPos,o.result):(e=x,t.substr(x,4)===`:is(`?(n=`:is(`,x+=4):(n=s,T(Ie)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(x)===41?(i=`)`,x++):(i=s,T(Te)),i===s?(x=e,e=s):(n=Fe(r),e=n)):(x=e,e=s),S[a]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*x+30,o=S[a];return o?(x=o.nextPos,o.result):(e=x,t.substr(x,5)===`:has(`?(n=`:has(`,x+=5):(n=s,T(Le)),n!==s&&E()!==s&&(r=(function(){var e,n,r,i,a,o,c,l,u=36*x+4,d=S[u];if(d)return x=d.nextPos,d.result;if(e=x,(n=Qe())!==s){for(r=[],i=x,(a=E())===s?(x=i,i=s):(t.charCodeAt(x)===44?(o=`,`,x++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=Qe())!==s?i=a=[a,o,c,l]:(x=i,i=s));i!==s;)r.push(i),i=x,(a=E())===s?(x=i,i=s):(t.charCodeAt(x)===44?(o=`,`,x++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=Qe())!==s?i=a=[a,o,c,l]:(x=i,i=s));r===s?(x=e,e=s):e=n=_(n,r)}else x=e,e=s;return S[u]={nextPos:x,result:e},e})())!==s&&E()!==s?(t.charCodeAt(x)===41?(i=`)`,x++):(i=s,T(Te)),i===s?(x=e,e=s):e=n={type:`has`,selectors:r}):(x=e,e=s),S[a]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r=36*x+31,i=S[r];return i?(x=i.nextPos,i.result):(t.substr(x,12)===`:first-child`?(n=`:first-child`,x+=12):(n=s,T(Re)),n!==s&&(n=ot(1)),e=n,S[r]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r=36*x+32,i=S[r];return i?(x=i.nextPos,i.result):(t.substr(x,11)===`:last-child`?(n=`:last-child`,x+=11):(n=s,T(ze)),n!==s&&(n=st(1)),e=n,S[r]={nextPos:x,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a,o=36*x+33,c=S[o];if(c)return x=c.nextPos,c.result;if(e=x,t.substr(x,11)===`:nth-child(`?(n=`:nth-child(`,x+=11):(n=s,T(Be)),n!==s){if(E()!==s){if(r=[],be.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(xe)),i!==s)for(;i!==s;)r.push(i),be.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(xe));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(x)===41?(a=`)`,x++):(a=s,T(Te)),a===s?(x=e,e=s):(n=ot(parseInt(r.join(``),10)),e=n)):(x=e,e=s)}else x=e,e=s}else x=e,e=s;return S[o]={nextPos:x,result:e},e})())===s&&(e=(function(){var e,n,r,i,a,o=36*x+34,c=S[o];if(c)return x=c.nextPos,c.result;if(e=x,t.substr(x,16)===`:nth-last-child(`?(n=`:nth-last-child(`,x+=16):(n=s,T(Ve)),n!==s){if(E()!==s){if(r=[],be.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(xe)),i!==s)for(;i!==s;)r.push(i),be.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(xe));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(x)===41?(a=`)`,x++):(a=s,T(Te)),a===s?(x=e,e=s):(n=st(parseInt(r.join(``),10)),e=n)):(x=e,e=s)}else x=e,e=s}else x=e,e=s;return S[o]={nextPos:x,result:e},e})())===s&&(e=(function(){var e,n,r,i=36*x+35,a=S[i];return a?(x=a.nextPos,a.result):(e=x,t.charCodeAt(x)===58?(n=`:`,x++):(n=s,T(He)),n!==s&&(r=Ye())!==s?e=n={type:`class`,name:r}:(x=e,e=s),S[i]={nextPos:x,result:e},e)})()),S[n]={nextPos:x,result:e},e)}function nt(){var e,n,r,i,a,o,c,l,u=36*x+15,d=S[u];if(d)return x=d.nextPos,d.result;if(e=x,(n=Ye())!==s){for(r=[],i=x,t.charCodeAt(x)===46?(a=`.`,x++):(a=s,T(ce)),a!==s&&(o=Ye())!==s?i=a=[a,o]:(x=i,i=s);i!==s;)r.push(i),i=x,t.charCodeAt(x)===46?(a=`.`,x++):(a=s,T(ce)),a!==s&&(o=Ye())!==s?i=a=[a,o]:(x=i,i=s);r===s?(x=e,e=s):(c=n,l=r,e=n=[].concat.apply([c],l).join(``))}else x=e,e=s;return S[u]={nextPos:x,result:e},e}function rt(){var e,n,r,i,a=36*x+23,o=S[a];if(o)return x=o.nextPos,o.result;if(e=x,t.charCodeAt(x)===91?(n=`[`,x++):(n=s,T(te)),n!==s){if(r=[],ke.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(Ae)),i===s&&(i=it()),i!==s)for(;i!==s;)r.push(i),ke.test(t.charAt(x))?(i=t.charAt(x),x++):(i=s,T(Ae)),i===s&&(i=it());else r=s;r===s?(x=e,e=s):(t.charCodeAt(x)===93?(i=`]`,x++):(i=s,T(ne)),i===s?(x=e,e=s):e=n=`[`+r.join(``)+`]`)}else x=e,e=s;return S[a]={nextPos:x,result:e},e}function it(){var e,n,r,i=36*x+24,a=S[i];return a?(x=a.nextPos,a.result):(e=x,t.charCodeAt(x)===92?(n=`\\`,x++):(n=s,T(pe)),n===s?(x=e,e=s):(t.length>x?(r=t.charAt(x),x++):(r=s,T(me)),r===s?(x=e,e=s):e=n=`\\`+r),S[i]={nextPos:x,result:e},e)}function at(){var e,n,r,i=36*x+25,a=S[i];if(a)return x=a.nextPos,a.result;if(n=[],je.test(t.charAt(x))?(r=t.charAt(x),x++):(r=s,T(Me)),r!==s)for(;r!==s;)n.push(r),je.test(t.charAt(x))?(r=t.charAt(x),x++):(r=s,T(Me));else n=s;return n!==s&&(n=n.join(``)),e=n,S[i]={nextPos:x,result:e},e}function ot(e){return{type:`nth-child`,index:{type:`literal`,value:e}}}function st(e){return{type:`nth-last-child`,index:{type:`literal`,value:e}}}if((r=l())!==s&&x===t.length)return r;throw r!==s&&x<t.length&&T({type:`end`}),i=Ge,a=We<t.length?t.charAt(We):null,o=We<t.length?qe(We,We+1):qe(We,We),new e(e.buildMessage(i,a),i,a,o)}}})()}));function u3(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var d3=typeof WeakMap==`function`?new WeakMap:null;function f3(e){if(e==null)return function(){return!0};if(d3!=null){var t=d3.get(e);return t??(t=p3(e),d3.set(e,t)),t}return p3(e)}function p3(e){switch(e.type){case`wildcard`:return function(){return!0};case`identifier`:var t=e.value.toLowerCase();return function(e,n,r){return t===e[r&&r.nodeTypeKey||`type`].toLowerCase()};case`exactNode`:return function(e,t){return t.length===0};case`field`:var n=e.name.split(`.`);return function(e,t){return(function e(t,n,r,i){for(var a=n,o=i;o<r.length;++o){if(a==null)return!1;var s=a[r[o]];if(Array.isArray(s)){for(var c=0;c<s.length;++c)if(e(t,s[c],r,o+1))return!0;return!1}a=s}return t===a})(e,t[n.length-1],n,0)};case`matches`:var r=e.selectors.map(f3);return function(e,t,n){for(var i=0;i<r.length;++i)if(r[i](e,t,n))return!0;return!1};case`compound`:var i=e.selectors.map(f3);return function(e,t,n){for(var r=0;r<i.length;++r)if(!i[r](e,t,n))return!1;return!0};case`not`:var a=e.selectors.map(f3);return function(e,t,n){for(var r=0;r<a.length;++r)if(a[r](e,t,n))return!1;return!0};case`has`:var o=e.selectors.map(f3);return function(e,t,n){var r=!1,i=[];return c3.traverse(e,{enter:function(e,t){t!=null&&i.unshift(t);for(var a=0;a<o.length;++a)if(o[a](e,i,n))return r=!0,void this.break()},leave:function(){i.shift()},keys:n&&n.visitorKeys,fallback:n&&n.fallback||`iteration`}),r};case`child`:var s=f3(e.left),c=f3(e.right);return function(e,t,n){return!!(t.length>0&&c(e,t,n))&&s(t[0],t.slice(1),n)};case`descendant`:var l=f3(e.left),u=f3(e.right);return function(e,t,n){if(u(e,t,n)){for(var r=0,i=t.length;r<i;++r)if(l(t[r],t.slice(r+1),n))return!0}return!1};case`attribute`:var d=e.name.split(`.`);switch(e.operator){case void 0:return function(e){return u3(e,d)!=null};case`=`:switch(e.value.type){case`regexp`:return function(t){var n=u3(t,d);return typeof n==`string`&&e.value.value.test(n)};case`literal`:var f=`${e.value.value}`;return function(e){return f===`${u3(e,d)}`};case`type`:return function(t){return e.value.value===a3(u3(t,d))}}throw Error(`Unknown selector value type: ${e.value.type}`);case`!=`:switch(e.value.type){case`regexp`:return function(t){return!e.value.value.test(u3(t,d))};case`literal`:var p=`${e.value.value}`;return function(e){return p!==`${u3(e,d)}`};case`type`:return function(t){return e.value.value!==a3(u3(t,d))}}throw Error(`Unknown selector value type: ${e.value.type}`);case`<=`:return function(t){return u3(t,d)<=e.value.value};case`<`:return function(t){return u3(t,d)<e.value.value};case`>`:return function(t){return u3(t,d)>e.value.value};case`>=`:return function(t){return u3(t,d)>=e.value.value}}throw Error(`Unknown operator: ${e.operator}`);case`sibling`:var m=f3(e.left),h=f3(e.right);return function(t,n,r){return h(t,n,r)&&g3(t,m,n,`LEFT_SIDE`,r)||e.left.subject&&m(t,n,r)&&g3(t,h,n,`RIGHT_SIDE`,r)};case`adjacent`:var g=f3(e.left),_=f3(e.right);return function(t,n,r){return _(t,n,r)&&_3(t,g,n,`LEFT_SIDE`,r)||e.right.subject&&g(t,n,r)&&_3(t,_,n,`RIGHT_SIDE`,r)};case`nth-child`:var v=e.index.value,y=f3(e.right);return function(e,t,n){return y(e,t,n)&&v3(e,t,v,n)};case`nth-last-child`:var ee=-e.index.value,te=f3(e.right);return function(e,t,n){return te(e,t,n)&&v3(e,t,ee,n)};case`class`:var ne=e.name.toLowerCase();return function(t,n,r){if(r&&r.matchClass)return r.matchClass(e.name,t,n);if(r&&r.nodeTypeKey)return!1;switch(ne){case`statement`:if(t.type.slice(-9)===`Statement`)return!0;case`declaration`:return t.type.slice(-11)===`Declaration`;case`pattern`:if(t.type.slice(-7)===`Pattern`)return!0;case`expression`:return t.type.slice(-10)===`Expression`||t.type.slice(-7)===`Literal`||t.type===`Identifier`&&(n.length===0||n[0].type!==`MetaProperty`)||t.type===`MetaProperty`;case`function`:return t.type===`FunctionDeclaration`||t.type===`FunctionExpression`||t.type===`ArrowFunctionExpression`}throw Error(`Unknown class name: ${e.name}`)}}throw Error(`Unknown selector type: ${e.type}`)}function m3(e,t){var n=t&&t.nodeTypeKey||`type`,r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:c3.VisitorKeys[r]?c3.VisitorKeys[r]:t&&typeof t.fallback==`function`?t.fallback(e):Object.keys(e).filter((function(e){return e!==n}))}function h3(e,t){var n=t&&t.nodeTypeKey||`type`;return e!==null&&a3(e)===`object`&&typeof e[n]==`string`}function g3(e,t,n,r,i){var a=r3(n,1)[0];if(!a)return!1;for(var o=m3(a,i),s=0;s<o.length;++s){var c=a[o[s]];if(Array.isArray(c)){var l=c.indexOf(e);if(l<0)continue;var u=void 0,d=void 0;r===`LEFT_SIDE`?(u=0,d=l):(u=l+1,d=c.length);for(var f=u;f<d;++f)if(h3(c[f],i)&&t(c[f],n,i))return!0}}return!1}function _3(e,t,n,r,i){var a=r3(n,1)[0];if(!a)return!1;for(var o=m3(a,i),s=0;s<o.length;++s){var c=a[o[s]];if(Array.isArray(c)){var l=c.indexOf(e);if(l<0)continue;if(r===`LEFT_SIDE`&&l>0&&h3(c[l-1],i)&&t(c[l-1],n,i)||r===`RIGHT_SIDE`&&l<c.length-1&&h3(c[l+1],i)&&t(c[l+1],n,i))return!0}}return!1}function v3(e,t,n,r){if(n===0)return!1;var i=r3(t,1)[0];if(!i)return!1;for(var a=m3(i,r),o=0;o<a.length;++o){var s=i[a[o]];if(Array.isArray(s)){var c=n<0?s.length+n:n-1;if(c>=0&&c<s.length&&s[c]===e)return!0}}return!1}function y3(e,t,n,r){if(t){var i=[],a=f3(t),o=(function e(t,n){if(t==null||a3(t)!=`object`)return[];n??=t;for(var r=t.subject?[n]:[],i=Object.keys(t),a=0;a<i.length;++a){var o=i[a],s=t[o];r.push.apply(r,i3(e(s,o===`left`?s:n)))}return r})(t).map(f3);c3.traverse(e,{enter:function(e,t){if(t!=null&&i.unshift(t),a(e,i,r)){if(o.length)for(var s=0,c=o.length;s<c;++s){o[s](e,i,r)&&n(e,t,i);for(var l=0,u=i.length;l<u;++l){var d=i.slice(l+1);o[s](i[l],d,r)&&n(i[l],t,d)}}else n(e,t,i)}},leave:function(){i.shift()},keys:r&&r.visitorKeys,fallback:r&&r.fallback||`iteration`})}}function b3(e,t,n){var r=[];return y3(e,t,(function(e){r.push(e)}),n),r}function x3(e){return l3.parse(e)}function S3(e,t,n){return b3(e,x3(t),n)}S3.parse=x3,S3.match=b3,S3.traverse=y3,S3.matches=function(e,t,n,r){return!t||!!e&&(n||=[],f3(t)(e,n,r))},S3.query=S3;var C3={},w3={},T3={exports:{}},E3=S3,{parse:D3}=C3,O3=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name===`tr_ch_apm_tracingChannel`,k3=/[^\w]/g,A3=e=>`tr_ch_apm$${e.replace(k3,`_`)}`,j3=T3.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(O3))return;let r={module:t===`esm`},i=n.body.findIndex(e=>e.directive===`use strict`),a=t===`esm`?`import tr_ch_apm_dc from "${e}"`:`const tr_ch_apm_dc = require("${e}")`;n.body.splice(i+1,0,D3(a,r).body[0],D3(`const { tracingChannel: tr_ch_apm_tracingChannel } = tr_ch_apm_dc`,r).body[0],D3(`const tr_ch_apm_hasSubscribers = ch => ch.start.hasSubscribers
|
|
35
|
+
|| ch.end.hasSubscribers
|
|
36
|
+
|| ch.asyncStart.hasSubscribers
|
|
37
|
+
|| ch.asyncEnd.hasSubscribers
|
|
38
|
+
|| ch.error.hasSubscribers`,r).body[0])},tracingChannelDeclaration(e,t){let{channelName:n,module:{name:r}}=e,i=A3(n);if(t.body.some(e=>e.declarations?.[0]?.id?.name===i))return;j3.tracingChannelImport(e,t);let a=t.body.findIndex(O3),o=`
|
|
39
|
+
const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
|
|
40
|
+
`;t.body.splice(a+1,0,D3(o).body[0])},traceCallback:N3,tracePromise:N3,traceSync:N3,traceAuto:N3};function M3(e){return[...(e||[]).filter(e=>e.type!==`RestElement`&&e.type!==`AssignmentPattern`).map((e,t)=>({type:`Identifier`,name:`__apm$arg${t}`})),{type:`RestElement`,argument:{type:`Identifier`,name:`__apm$args`}}]}function N3(e,t,n,r){let i=r[r.length-1];t.type===`ClassDeclaration`||t.type===`ClassExpression`?F3(e,t,i):P3(e,t,i)}function P3(e,t,n){j3.tracingChannelDeclaration(e,n);let{functionQuery:{methodName:r,privateMethodName:i,functionName:a,expressionName:o,propertyName:s}}=e,c=r===`constructor`||!r&&!i&&!a&&!o&&!s?`ArrowFunctionExpression`:t.type,l=t.params;t.body=I3(e,{type:c,params:l,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=M3(l),t.generator=!1,t.async=!1,L3(e,t)}function F3(e,t,n){let{functionQuery:r,operator:i}=e,{methodName:a}=r;if(!a)return;let o=t.body;if(o.body.some(({key:e})=>e.name===a))return;let s=o.body.find(({kind:e})=>e===`constructor`);j3.tracingChannelDeclaration(e,n),s||(s=D3(t.superClass?`class A extends Object { constructor (...args) { super(...args) } }`:`class A { constructor () {} }`).body[0].body.body[0],o.body.unshift(s));let c=D3(`
|
|
41
|
+
const __apm$${a} = this["${a}"]
|
|
42
|
+
this["${a}"] = function () {}
|
|
43
|
+
if (typeof __apm$${a} === 'function') {
|
|
44
|
+
Object.defineProperty(this["${a}"], 'length', {
|
|
45
|
+
value: __apm$${a}.length,
|
|
46
|
+
configurable: true
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
`).body,l=c[1].expression.right;l.params=[{type:`RestElement`,argument:{type:`Identifier`,name:`__apm$args`}}],l.async=i===`tracePromise`,l.body=I3(e,{type:`Identifier`,name:`__apm$${a}`},n),L3(e,l),s.value.body.body.push(...c)}function I3(e,t,n){let{operator:r,moduleVersion:i}=e,{returnKind:a}=e.functionQuery,o=a?U3(e,a,n):``,s;r===`traceCallback`&&(s=z3(e,t,o)),r===`tracePromise`&&(s=B3(e,t,o)),r===`traceSync`&&(s=V3(e,t,o)),r===`traceAuto`&&(s=R3(e,t,o));let c=(t.params||[]).filter(e=>e.type!==`RestElement`&&e.type!==`AssignmentPattern`).map((e,t)=>`__apm$arg${t}`).concat(`...__apm$args`).join(`, `),l=s.body[0].body,u=D3(t.type===`ArrowFunctionExpression`?`
|
|
50
|
+
const __apm$arguments = [${c}];
|
|
51
|
+
const __apm$ctx = {
|
|
52
|
+
arguments: __apm$arguments,
|
|
53
|
+
moduleVersion: ${JSON.stringify(i)}
|
|
54
|
+
};
|
|
55
|
+
const __apm$traced = () => {
|
|
56
|
+
const __apm$wrapped = () => {};
|
|
57
|
+
return __apm$wrapped(...__apm$arguments);
|
|
58
|
+
};
|
|
59
|
+
`:`
|
|
60
|
+
const __apm$arguments = [${c}].slice(0, arguments.length);
|
|
61
|
+
const __apm$ctx = {
|
|
62
|
+
arguments: __apm$arguments,
|
|
63
|
+
self: this,
|
|
64
|
+
moduleVersion: ${JSON.stringify(i)}
|
|
65
|
+
};
|
|
66
|
+
const __apm$traced = () => {
|
|
67
|
+
const __apm$wrapped = () => {};
|
|
68
|
+
return __apm$wrapped.apply(this, __apm$arguments);
|
|
69
|
+
};
|
|
70
|
+
`).body;return l.body.unshift(...u),E3.query(l,`[id.name=__apm$wrapped]`)[0].init=t,l}function L3(e,t){let n=new Set;E3.traverse(t.body,E3.parse(`[object.type=Super]`),(e,t)=>{let{name:r}=e.property,i;if(t.callee){let{expression:e}=D3(`__apm$super['${r}'].call(this)`).body[0];t.callee=i=e.callee,t.arguments.unshift(...e.arguments)}else t.expression=i=D3(`__apm$super['${r}']`).body[0];i.computed=t.callee.computed,i.optional=t.callee.optional,n.add(r)});for(let e of n){let n=D3(`
|
|
71
|
+
class Wrapper {
|
|
72
|
+
wrapper () {
|
|
73
|
+
__apm$super['${e}'] = super['${e}']
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`).body[0].body.body[0].value.body.body[0];t.body.body.unshift(n)}n.size>0&&t.body.body.unshift(D3(`const __apm$super = {}`).body[0])}function R3(e,t,n=``){let r=z3(e,t,n),i=B3(e,t,n),[a,o,s,c,l,u]=r.body[0].body.body,d={type:`IfStatement`,test:c.test,consequent:{type:`BlockStatement`,body:i.body[0].body.body},alternate:null};return r.body[0].body.body=[a,d,o,s,l,u],r}function z3(e,t,n=``){let{channelName:r,functionQuery:{callbackIndex:i=-1}}=e,a=A3(r);return D3(`
|
|
77
|
+
function wrapper () {
|
|
78
|
+
const __apm$cb = Array.prototype.at.call(__apm$arguments, ${i});
|
|
79
|
+
|
|
80
|
+
if (!${a}.start.hasSubscribers) return __apm$traced();
|
|
81
|
+
|
|
82
|
+
function __apm$wrappedCb(err, res) {
|
|
83
|
+
if (err) {
|
|
84
|
+
__apm$ctx.error = err;
|
|
85
|
+
${a}.error.publish(__apm$ctx);
|
|
86
|
+
} else {
|
|
87
|
+
__apm$ctx.result = res;
|
|
88
|
+
${n}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
${a}.asyncStart.runStores(__apm$ctx, () => {
|
|
92
|
+
try {
|
|
93
|
+
if (__apm$cb) {
|
|
94
|
+
return __apm$cb.apply(this, arguments);
|
|
95
|
+
}
|
|
96
|
+
} finally {
|
|
97
|
+
${a}.asyncEnd.publish(__apm$ctx);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (typeof __apm$cb !== 'function') {
|
|
103
|
+
return __apm$traced();
|
|
104
|
+
}
|
|
105
|
+
Array.prototype.splice.call(__apm$arguments, ${i}, 1, __apm$wrappedCb);
|
|
106
|
+
|
|
107
|
+
return ${a}.start.runStores(__apm$ctx, () => {
|
|
108
|
+
try {
|
|
109
|
+
return __apm$traced();
|
|
110
|
+
} catch (err) {
|
|
111
|
+
__apm$ctx.error = err;
|
|
112
|
+
${a}.error.publish(__apm$ctx);
|
|
113
|
+
throw err;
|
|
114
|
+
} finally {
|
|
115
|
+
__apm$ctx.self ??= this;
|
|
116
|
+
${a}.end.publish(__apm$ctx);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
`)}function B3(e,t,n=``){let{channelName:r}=e,i=A3(r);return D3(`
|
|
121
|
+
function wrapper () {
|
|
122
|
+
if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
|
|
123
|
+
|
|
124
|
+
return ${i}.start.runStores(__apm$ctx, () => {
|
|
125
|
+
try {
|
|
126
|
+
let promise = __apm$traced();
|
|
127
|
+
if (typeof promise?.then !== 'function') {
|
|
128
|
+
__apm$ctx.result = promise;
|
|
129
|
+
${n}
|
|
130
|
+
return __apm$ctx.result;
|
|
131
|
+
}
|
|
132
|
+
// Mirror Node.js core diagnostics_channel behaviour: for native Promise
|
|
133
|
+
// instances, chain normally (safe since there is no subclass API to
|
|
134
|
+
// preserve). For Promise subclasses and other thenables, side-chain the
|
|
135
|
+
// callbacks for event publishing and return the original so that any
|
|
136
|
+
// subclass-specific methods (e.g. APIPromise.withResponse()) remain
|
|
137
|
+
// accessible to the caller.
|
|
138
|
+
if (promise instanceof Promise && promise.constructor === Promise) {
|
|
139
|
+
return promise.then(
|
|
140
|
+
result => {
|
|
141
|
+
__apm$ctx.result = result;
|
|
142
|
+
${n}
|
|
143
|
+
${i}.asyncStart.publish(__apm$ctx);
|
|
144
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
145
|
+
return __apm$ctx.result;
|
|
146
|
+
},
|
|
147
|
+
err => {
|
|
148
|
+
__apm$ctx.error = err;
|
|
149
|
+
${i}.error.publish(__apm$ctx);
|
|
150
|
+
${i}.asyncStart.publish(__apm$ctx);
|
|
151
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
152
|
+
throw err;
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
promise.then(
|
|
157
|
+
result => {
|
|
158
|
+
__apm$ctx.result = result;
|
|
159
|
+
${n}
|
|
160
|
+
${i}.asyncStart.publish(__apm$ctx);
|
|
161
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
162
|
+
},
|
|
163
|
+
err => {
|
|
164
|
+
__apm$ctx.error = err;
|
|
165
|
+
${i}.error.publish(__apm$ctx);
|
|
166
|
+
${i}.asyncStart.publish(__apm$ctx);
|
|
167
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
return promise;
|
|
171
|
+
} catch (err) {
|
|
172
|
+
__apm$ctx.error = err;
|
|
173
|
+
${i}.error.publish(__apm$ctx);
|
|
174
|
+
throw err;
|
|
175
|
+
} finally {
|
|
176
|
+
__apm$ctx.self ??= this;
|
|
177
|
+
${i}.end.publish(__apm$ctx);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
`)}function V3(e,t,n=``){let{channelName:r}=e,i=A3(r);return D3(`
|
|
182
|
+
function wrapper () {
|
|
183
|
+
if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
|
|
184
|
+
|
|
185
|
+
return ${i}.start.runStores(__apm$ctx, () => {
|
|
186
|
+
try {
|
|
187
|
+
__apm$ctx.result = __apm$traced();
|
|
188
|
+
${n}
|
|
189
|
+
} catch (err) {
|
|
190
|
+
__apm$ctx.error = err;
|
|
191
|
+
${i}.error.publish(__apm$ctx);
|
|
192
|
+
throw err;
|
|
193
|
+
} finally {
|
|
194
|
+
__apm$ctx.self ??= this;
|
|
195
|
+
${i}.end.publish(__apm$ctx);
|
|
196
|
+
}
|
|
197
|
+
return __apm$ctx.result;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
`)}function H3(e,t){let{channelName:n,module:{name:r}}=e,i=A3(n+`:next`);if(t.body.some(e=>e.declarations?.[0]?.id?.name===i))return;let a=A3(n),o=t.body.findIndex(e=>e.declarations?.[0]?.id?.name===a),s=`const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}:next")`;t.body.splice(o+1,0,D3(s).body[0])}function U3(e,t,n){let{channelName:r}=e,i=t===`Iterator`?`traceSync`:`tracePromise`,a=A3(r+`:next`);return H3(e,n),`
|
|
201
|
+
const __apm$iter = __apm$ctx.result;
|
|
202
|
+
if (__apm$iter != null && typeof __apm$iter.next === 'function') {
|
|
203
|
+
const __apm$patchIter = function (method) {
|
|
204
|
+
const __apm$orig = __apm$iter[method];
|
|
205
|
+
if (typeof __apm$orig !== 'function') return;
|
|
206
|
+
__apm$iter[method] = function () {
|
|
207
|
+
const __apm$iterArgs = Array.prototype.slice.call(arguments);
|
|
208
|
+
if (!tr_ch_apm_hasSubscribers(${a})) return __apm$orig.apply(this, __apm$iterArgs);
|
|
209
|
+
__apm$ctx.method = method;
|
|
210
|
+
__apm$ctx.arguments = __apm$iterArgs;
|
|
211
|
+
return ${a}.${i}(__apm$orig, __apm$ctx, this, ...__apm$iterArgs);
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
__apm$patchIter('next');
|
|
215
|
+
__apm$patchIter('throw');
|
|
216
|
+
__apm$patchIter('return');
|
|
217
|
+
}
|
|
218
|
+
`}var W3=T3.exports,G3={},K3=e=>{throw TypeError(e)},q3=(e,t,n)=>t.has(e)||K3(`Cannot `+n),J3=(e,t,n)=>(q3(e,t,`read from private field`),n?n.call(e):t.get(e)),Y3=(e,t,n)=>t.has(e)?K3(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),X3=(e,t,n,r)=>(q3(e,t,`write to private field`),t.set(e,n),n),Z3=(e,t,n)=>(q3(e,t,`access private method`),n),Q3,$3,e6,t6,n6,r6,i6,a6,o6,s6,c6,l6,u6=S3,{parse:d6}=C3,{generate:f6}=w3,p6=W3,m6,h6,g6=class{constructor(e,t,n,r,i,a={}){Y3(this,i6),Y3(this,Q3,null),Y3(this,$3,null),Y3(this,e6,null),Y3(this,t6,[]),Y3(this,n6,null),Y3(this,r6,{}),X3(this,Q3,e),X3(this,$3,t),X3(this,e6,n),X3(this,t6,r),X3(this,n6,i),X3(this,r6,a)}free(){}get moduleName(){return J3(this,Q3)}get filePath(){return J3(this,e6)}transform(e,t,n){if(Buffer.isBuffer(e)&&(e=e.toString()),!e)return{code:e};let r,i={},a=0;for(let n of J3(this,t6)){let{astQuery:o,functionQuery:s={}}=n;if(!r){let n={loc:!0,ranges:!0,raw:!0,module:t===`esm`};try{r=d6(e,n)}catch{r=d6(e,{...n,module:!n.module})}t===`esm`&&(i=Z3(this,i6,s6).call(this,r))}let c=Z3(this,i6,c6).call(this,s,i),l=o||Z3(this,i6,l6).call(this,c),u={...n,dcModule:J3(this,n6),moduleType:t,moduleVersion:J3(this,$3),functionQuery:c};u.operator=Z3(this,i6,o6).call(this,u),u6.traverse(r,u6.parse(l),(...e)=>{a++,Z3(this,i6,a6).call(this,u,...e)})}if(a===0&&J3(this,t6).length>0){let e=J3(this,t6).map(({astQuery:e,functionQuery:t={}})=>{if(e)return e;let n=Z3(this,i6,c6).call(this,t,i),r=(e=>e.methodName||e.privateMethodName||e.functionName||e.expressionName||`constructor`)(t),a=t.className||t.functionName||t.expressionName,o=n.className||n.functionName||n.expressionName;return a&&a!==o?`${a} (local name: ${o})`:r});throw Error(`Failed to find injection points for: ${JSON.stringify(e)}`)}if(r){m6??=G3.SourceMapConsumer,h6??=G3.SourceMapGenerator;let e=`${J3(this,Q3)}/${J3(this,e6)}`,t;if(n){let r=new m6(n);r.file=e,t=h6.fromSourceMap(r)}else t=new h6({file:e});return{code:f6(r,{sourceMap:t}),map:t.toString()}}return{code:e}}};Q3=new WeakMap,$3=new WeakMap,e6=new WeakMap,t6=new WeakMap,n6=new WeakMap,r6=new WeakMap,i6=new WeakSet,a6=function(e,...t){let n=J3(this,r6)[e.operator]??p6[e.operator],{index:r=0}=e.functionQuery,[i]=t,a=i.init?.type||i.type;a!==`ClassDeclaration`&&a!==`ClassExpression`&&(i.type===`VariableDeclarator`||(e.functionIndex=++e.functionIndex||0,r!==null&&r!==e.functionIndex))||n(e,...t)},o6=function({transform:e,functionQuery:{kind:t}}){if(e)return e;switch(t){case`Async`:return`tracePromise`;case`Auto`:return`traceAuto`;case`Callback`:return`traceCallback`;case`Sync`:return`traceSync`;default:return`traceSync`}},s6=function(e){let t={};for(let n of e.body)if(n.type===`ExportNamedDeclaration`&&!n.source){for(let e of n.specifiers)if(e.exported&&e.local){let n=e.exported.name??e.exported.value,r=e.local.name??e.local.value;n&&r&&(t[n]=r)}}return t},c6=function(e,t){if(!e.isExportAlias)return e;let{functionName:n,expressionName:r,className:i}=e;return n&&t[n]?{...e,functionName:t[n]}:r&&t[r]?{...e,expressionName:t[r]}:i&&t[i]?{...e,className:t[i]}:e},l6=function(e){let{functionName:t,expressionName:n,className:r,objectName:i,propertyName:a}=e,o=e.privateMethodName?`PrivateIdentifier`:`Identifier`,s=[],c=e.methodName||e.privateMethodName;if(r?(c??=`constructor`,s.push(`[id.name="${r}"]`,`[id.name="${r}"] > ClassExpression`,`[id.name="${r}"] > ClassBody > [key.name="${c}"][key.type=${o}] > [async]`,`[id.name="${r}"] > ClassExpression > ClassBody > [key.name="${c}"][key.type=${o}] > [async]`)):c&&s.push(`ClassBody > [key.name="${c}"][key.type=${o}] > [async]`,`Property[key.name="${c}"][key.type=${o}] > [async]`),t?s.push(`FunctionDeclaration[id.name="${t}"][async]`):n&&s.push(`FunctionExpression[id.name="${n}"][async]`,`ArrowFunctionExpression[id.name="${n}"][async]`,`VariableDeclarator[id.name="${n}"] > FunctionExpression[async]`,`VariableDeclarator[id.name="${n}"] > ArrowFunctionExpression[async]`,`AssignmentExpression[left.property.name="${n}"] > FunctionExpression[async]`,`AssignmentExpression[left.property.name="${n}"] > ArrowFunctionExpression[async]`,`AssignmentExpression[left.name="${n}"] > FunctionExpression[async]`,`AssignmentExpression[left.name="${n}"] > ArrowFunctionExpression[async]`),i||a){if(!i||!a)throw Error(`functionQuery: 'objectName' and 'propertyName' must be used together (got objectName=${i}, propertyName=${a})`);let e=i===`this`?`left.object.type=ThisExpression`:`left.object.name="${i}"`;s.push(`AssignmentExpression[${e}][left.property.name="${a}"] > [async]`)}return s.join(`, `)};var _6={Transformer:g6},v6=e=>{throw TypeError(e)},y6=(e,t,n)=>t.has(e)||v6(`Cannot `+n),b6=(e,t,n)=>(y6(e,t,`read from private field`),n?n.call(e):t.get(e)),x6=(e,t,n)=>t.has(e)?v6(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),S6=(e,t,n,r)=>(y6(e,t,`write to private field`),t.set(e,n),n),C6,w6,T6,E6,D6=G4,{Transformer:O6}=_6,k6=class{constructor(e,t){x6(this,C6,[]),x6(this,w6,null),x6(this,T6,{}),x6(this,E6,{}),S6(this,C6,e),S6(this,w6,t||`diagnostics_channel`)}free(){S6(this,T6,{})}addTransform(e,t){b6(this,E6)[e]=t}getTransformer(e,t,n){n=n.replace(/\\/g,`/`);let r=`${e}/${n}@${t}`;if(b6(this,T6)[r])return b6(this,T6)[r];let i=b6(this,C6).filter(({module:r})=>r.name===e&&(typeof r.filePath==`string`?r.filePath===n:r.filePath.test(n))&&D6(t,r.versionRange));if(i.length!==0)return b6(this,T6)[r]=new O6(e,t,n,i,b6(this,w6),b6(this,E6)),b6(this,T6)[r]}};C6=new WeakMap,w6=new WeakMap,T6=new WeakMap,E6=new WeakMap;var{InstrumentationMatcher:A6}={InstrumentationMatcher:k6};function j6(e,t){return new A6(e,t)}var M6={create:j6},N6=we.sep,P6=function(e){var t=e.split(N6),n=t.lastIndexOf(`node_modules`);if(n!==-1&&t[n+1]){for(var r=t[n+1][0]===`@`,i=r?t[n+1]+`/`+t[n+2]:t[n+1],a=r?3:2,o=``,s=n+a-1,c=0;c<=s;c++)o+=c===s?t[c]:t[c]+N6;for(var l=``,u=t.length-1,d=n+a;d<=u;d++)l+=d===u?t[d]:t[d]+N6;return{name:i,basedir:o,path:l}}},F6=W4(P6),{readFileSync:I6}=Oe,{join:L6}=we,R6=new Map;function z6(e){if(R6.has(e))return R6.get(e);try{let t=I6(L6(e,`package.json`)),{version:n}=JSON.parse(t);return R6.set(e,n),n}catch{return process.version.slice(1)}}var B6=z6,V6=W4(B6),H6;function U6(e){H6=e}function W6(e){H6&&H6(e)}var G6={setDiagnosticsHook:U6,emitDiagnostics:W6},K6={exports:{}},q6=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)},J6=et,Y6=nt,X6=q6,{env:Z6}=process,Q6;X6(`no-color`)||X6(`no-colors`)||X6(`color=false`)||X6(`color=never`)?Q6=0:(X6(`color`)||X6(`colors`)||X6(`color=true`)||X6(`color=always`))&&(Q6=1),`FORCE_COLOR`in Z6&&(Q6=Z6.FORCE_COLOR===`true`?1:Z6.FORCE_COLOR===`false`?0:Z6.FORCE_COLOR.length===0?1:Math.min(parseInt(Z6.FORCE_COLOR,10),3));function $6(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function e8(e,t){if(Q6===0)return 0;if(X6(`color=16m`)||X6(`color=full`)||X6(`color=truecolor`))return 3;if(X6(`color=256`))return 2;if(e&&!t&&Q6===void 0)return 0;let n=Q6||0;if(Z6.TERM===`dumb`)return n;if(process.platform===`win32`){let e=J6.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in Z6)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in Z6)||Z6.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in Z6)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Z6.TEAMCITY_VERSION);if(Z6.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in Z6){let e=parseInt((Z6.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(Z6.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(Z6.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Z6.TERM)||`COLORTERM`in Z6?1:n}function t8(e){return $6(e8(e,e&&e.isTTY))}var n8={supportsColor:t8,stdout:$6(e8(!0,Y6.isatty(1))),stderr:$6(e8(!0,Y6.isatty(2)))},r8=1e3,i8=r8*60,a8=i8*60,o8=a8*24,s8=o8*7,c8=o8*365.25,l8=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return u8(e);if(n===`number`&&isFinite(e))return t.long?f8(e):d8(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function u8(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return n*c8;case`weeks`:case`week`:case`w`:return n*s8;case`days`:case`day`:case`d`:return n*o8;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return n*a8;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return n*i8;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return n*r8;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return n;default:return}}}}function d8(e){var t=Math.abs(e);return t>=o8?Math.round(e/o8)+`d`:t>=a8?Math.round(e/a8)+`h`:t>=i8?Math.round(e/i8)+`m`:t>=r8?Math.round(e/r8)+`s`:e+`ms`}function f8(e){var t=Math.abs(e);return t>=o8?p8(e,t,o8,`day`):t>=a8?p8(e,t,a8,`hour`):t>=i8?p8(e,t,i8,`minute`):t>=r8?p8(e,t,r8,`second`):e+` ms`}function p8(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}function m8(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=l8,n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var h8=m8;(function(e,t){let n=nt,r=Pe;t.init=u,t.log=s,t.formatArgs=a,t.save=c,t.load=l,t.useColors=i,t.destroy=r.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let e=n8;e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function i(){return`colors`in t.inspectOpts?!!t.inspectOpts.colors:n.isatty(process.stderr.fd)}function a(t){let{namespace:n,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${n} \x1B[0m`;t[0]=a+t[0].split(`
|
|
219
|
+
`).join(`
|
|
220
|
+
`+a),t.push(i+`m+`+e.exports.humanize(this.diff)+`\x1B[0m`)}else t[0]=o()+n+` `+t[0]}function o(){return t.inspectOpts.hideDate?``:new Date().toISOString()+` `}function s(...e){return process.stderr.write(r.formatWithOptions(t.inspectOpts,...e)+`
|
|
221
|
+
`)}function c(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function l(){return process.env.DEBUG}function u(e){e.inspectOpts={};let n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]}e.exports=h8(t);let{formatters:d}=e.exports;d.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split(`
|
|
222
|
+
`).map(e=>e.trim()).join(` `)},d.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}})(K6,K6.exports);var g8=K6.exports,_8=W4(g8),{create:v8}=M6,y8=be,b8=P6,{pathToFileURL:x8}=Ue,S8=B6,{emitDiagnostics:C8}=G6,w8=g8(`@apm-js-collab/tracing-hooks:module-patch`),T8=class{constructor({instrumentations:e=[]}={}){this.packages=new Set(e.map(e=>e.module.name)),this.instrumentator=v8(e),this.compile=y8.prototype._compile}patch(){let e=this;y8.prototype._compile=function(...t){let[n,r]=t,i=b8(r);if(i&&e.packages.has(i.name)){w8(`found resolved module, checking if there is a transformer %s`,r);let a=S8(i.basedir,i.name),o=e.instrumentator.getTransformer(i.name,a,i.path);if(o){w8(`transforming file %s`,r);try{t[0]=o.transform(n,`cjs`)?.code,C8({url:x8(r).href,moduleName:o.moduleName}),process.env.TRACING_DUMP&&E8(t[0],r)}catch(e){w8(`Error transforming module %s: %o`,r,e),C8({url:x8(r).href,moduleName:o.moduleName,error:e})}finally{o.free()}}}return e.compile.apply(this,t)}}unpatch(){y8.prototype._compile=this.compile}};function E8(e,t){let n=et,r=we,i=Oe,a=process.env.TRACING_DUMP_DIR??n.tmpdir(),o=r.dirname(t),s=r.basename(t),c=r.join(a,o),l=r.join(c,s);w8(`Dumping patched code to: %s`,l),i.mkdirSync(c,{recursive:!0}),i.writeFileSync(l,e)}var D8=W4(T8),O8=_8(`@apm-js-collab/tracing-hooks:esm-hook`),k8=null,A8=null,j8=null,M8=G6.emitDiagnostics;function N8(){let{port1:e,port2:t}=new Ye;return e.on(`message`,G6.emitDiagnostics),e.unref(),t}function P8(e={}){let t=e?.instrumentations||[];j8=M6.create(t),A8=new Set(t.map(e=>e.module.name)),k8=new Map,M8=e?.diagnosticsPort?F8(e.diagnosticsPort):G6.emitDiagnostics}function F8(e){return t=>{try{let n=t.error===void 0||t.error instanceof Error?t.error:Error(String(t.error));e.postMessage({...t,error:n})}catch(e){O8(`failed to post diagnostics for %s: %o`,t.url,e)}}}function I8(e){let t=F6(e.url);if(t&&A8.has(t.name)){let n=V6(We(t.basedir)),r=j8.getTransformer(t.name,n,t.path);r&&k8.set(e.url,r)}return e}function L8(e,t,n){return I8(n(e,t))}function R8(e,t,n){let r=n(e,t);if(k8.has(e)===!1)return r;if(r.format===`commonjs`){let t=new URL(r.responseURL??e);r.source??=je(t)}return z8(e,r)}function z8(e,t){let n=t.source;if(n){let r=k8.get(e);try{let i=t.format===`module`?`esm`:t.format===`commonjs`?`cjs`:`unknown`,a=typeof n==`string`?n:Buffer.from(n).toString(`utf8`);t.source=r.transform(a,i)?.code,t.shortCircuit=!0,M8({url:e,moduleName:r.moduleName})}catch(t){O8(`Error transforming module %s: %o`,e,t),M8({url:e,moduleName:r.moduleName,error:t})}finally{r.free()}}return t}G6.setDiagnosticsHook;function B8(e){if(e){let{major:t=0,minor:n=0}=Ar(e);return t>2||t===2&&n>=8}let{major:t=0,minor:n=0}=Ar(process.versions.node??`0.0.0`);return t>25||t===25&&n>=1||t===24&&n>=13}function V8(e){if(!Ze&&!Qe||O?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=B8(t.Deno?.version?.deno),r=ye;G6.setDiagnosticsHook(({moduleName:e,error:t})=>{t?A.warn(`[orchestrion] failed to inject diagnostics-channel into ${e}:`,t):(O.__SENTRY_ORCHESTRION__=O.__SENTRY_ORCHESTRION__||{},O.__SENTRY_ORCHESTRION__.runtime=O.__SENTRY_ORCHESTRION__.runtime||[],O.__SENTRY_ORCHESTRION__.runtime.push(e))});try{if(typeof r.registerHooks==`function`&&n)P8({instrumentations:H4}),r.registerHooks({resolve:L8,load:R8}),A.log(`Registered diagnostics-channel injection via Module.registerHooks()`);else if(typeof r.register==`function`&&!t.Bun&&!t.Deno){let e=N8(),t;t=import.meta.url,r.register(`@sentry/server-utils/orchestrion/hook`,{parentURL:t,data:{instrumentations:H4,diagnosticsPort:e},transferList:[e]}),new D8({instrumentations:H4}).patch(),A.log(`Registered diagnostics-channel injection via Module.register()`)}else{A.warn(`No available Node API to register diagnostics-channel injection hooks; skipping.`);return}}catch(e){A.warn(`Failed to register diagnostics-channel injection hooks; channel-based integrations will not record spans.`,e);return}O.__SENTRY_ORCHESTRION__=O.__SENTRY_ORCHESTRION__||{},O.__SENTRY_ORCHESTRION__.runtime=O.__SENTRY_ORCHESTRION__.runtime||[]}function H8(){return K1}function U8(e){YB(()=>{let e=Object.values(K1).map(e=>e()),t=e.map(e=>e.name);return{integrations:[...e,tX({responseHook:dV}),G1({responseHook:dV})],replacedOtelIntegrationNames:t,register:()=>V8(),detect:O1}})}export{TE as NODE_VERSION,lM as NodeClient,t4 as OpenFeatureIntegrationHook,k as SDK_VERSION,F as SEMANTIC_ATTRIBUTE_SENTRY_OP,I as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,wi as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,Ci as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,Zr as Scope,tA as SentryContextManager,qM as _INTERNAL_normalizeCollectionInterval,zp as addBreadcrumb,sd as addEventProcessor,Td as addIntegration,v2 as amqplibIntegration,MM as anrIntegration,R2 as anthropicAIIntegration,R4 as applyDiagnosticsChannelInjectionIntegrations,As as bindScopeToEmitter,$2 as buildLaunchDarklyFlagUsedHandler,pd as captureCheckIn,Rm as captureConsoleIntegration,Ku as captureEvent,H as captureException,tg as captureFeedback,Gu as captureMessage,dd as captureSession,sA as childProcessIntegration,id as close,xU as connectIntegration,Lj as consoleIntegration,cg as consoleLoggingIntegration,KA as contextLinesIntegration,is as continueTrace,hg as createConsolaReporter,aM as createGetModuleFromFilename,Ab as createLangChainCallbackHandler,$M as createSentryWinstonTransport,hf as createTransport,mN as cron,E0 as dataloaderIntegration,Vm as dedupeIntegration,sM as defaultStackParser,H8 as diagnosticsChannelInjectionIntegrations,PM as disableAnrDetectionForCallback,ld as endSession,Gp as eventFiltersIntegration,U8 as experimentalUseDiagnosticsChannelInjection,WC as expressErrorHandler,QN as expressIntegration,Ym as extraErrorDataIntegration,xR as fastifyIntegration,Kh as featureFlagsIntegration,w4 as firebaseIntegration,rd as flush,WN as fsIntegration,Hp as functionToStringIntegration,Y as generateInstrumentOnce,m0 as genericPoolIntegration,R as getActiveSpan,T4 as getAutoPerformanceIntegrations,P as getClient,M as getCurrentScope,L4 as getDefaultIntegrations,I4 as getDefaultIntegrationsWithoutPerformance,yi as getGlobalScope,N as getIsolationScope,Za as getRootSpan,oM as getSentryRelease,Xa as getSpanDescendants,Hi as getSpanStatusFromHttpCode,yp as getTraceData,wp as getTraceMetaTags,H2 as googleGenAIIntegration,lz as graphqlIntegration,i4 as growthbookIntegration,FH as hapiIntegration,JH as honoIntegration,Mp as httpHeadersToSpanAttributes,_N as httpIntegration,Xw as httpServerIntegration,Qw as httpServerSpansIntegration,Kp as inboundFiltersIntegration,z4 as init,A4 as initOpenTelemetry,V4 as initWithoutDefaultIntegrations,Uy as instrumentAnthropicAiClient,ob as instrumentGoogleGenAIClient,Fb as instrumentLangChainEmbeddings,$b as instrumentLangGraph,gy as instrumentOpenAiClient,Qb as instrumentStateGraph,Yb as instrumentStateGraphCompile,Th as instrumentSupabaseClient,XB as isDiagnosticsChannelInjectionEnabled,od as isEnabled,ad as isInitialized,jz as kafkaIntegration,Y1 as knexIntegration,cU as koaIntegration,q2 as langChainIntegration,Z2 as langGraphIntegration,nd as lastEventId,Q2 as launchDarklyIntegration,bm as linkedErrorsIntegration,lj as localVariablesIntegration,IM as logger,Iz as lruMemoizerIntegration,eM as makeNodeTransport,lg as metrics,pj as modulesIntegration,$z as mongoIntegration,_B as mongooseIntegration,KB as mysql2Integration,kB as mysqlIntegration,vN as nativeNodeFetchIntegration,pA as nodeContextIntegration,JM as nodeRuntimeMetricsIntegration,xj as onUncaughtExceptionIntegration,Tj as onUnhandledRejectionIntegration,P2 as openAIIntegration,e4 as openFeatureIntegration,gp as parameterize,oN as pinoIntegration,lH as postgresIntegration,_H as postgresJsIntegration,j4 as preloadOpenTelemetry,lI as prismaIntegration,Mj as processSessionIntegration,eg as profiler,IV as redisIntegration,Em as requestDataIntegration,sh as rewriteFramesIntegration,$u as setAttribute,Qu as setAttributes,qu as setContext,td as setConversationId,qf as setCurrentClient,Yu as setExtra,Ju as setExtras,Ui as setHttpStatus,Bo as setMeasurement,Zk as setNodeAsyncContextStrategy,Zu as setTag,Xu as setTags,ed as setUser,CU as setupConnectErrorHandler,YN as setupExpressErrorHandler,SR as setupFastifyErrorHandler,zH as setupHapiErrorHandler,QH as setupHonoErrorHandler,lU as setupKoaErrorHandler,ox as spanStreamingIntegration,_o as spanToBaggageHeader,L as spanToJSON,Ma as spanToTraceHeader,Pj as spotlightIntegration,B as startInactiveSpan,ss as startNewTrace,cd as startSession,z as startSpan,ts as startSpanManual,n4 as statsigIntegration,Oh as supabaseIntegration,as as suppressTracing,Hj as systemErrorIntegration,c0 as tediousIntegration,hx as trpcMiddleware,r4 as unleashIntegration,eo as updateSpanName,gM as validateOpenTelemetrySetup,A2 as vercelAIIntegration,Op as winterCGHeadersToDict,V as withActiveSpan,xi as withIsolationScope,fd as withMonitor,bi as withScope,vo as withStreamedSpan,sC as wrapMcpServerWithSentry,Ih as zodErrorsIntegration};
|