@yukino.js/yukino 0.0.21-dev → 0.0.22
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 +1 -1
- package/dist/{anthropic-LB4T3BEN.js → anthropic-5FTO3Q7W.js} +1 -1
- package/dist/browser/dist/static/{highlight-KNDEBJWF.js → highlight-7IMT657L.js} +9 -9
- package/dist/browser/dist/static/index.css +2 -2
- package/dist/browser/dist/static/index.js +81 -75
- package/dist/browser/dist/static/webapi-433PWHPB.js +4 -0
- package/dist/{chunk-NPIMUWFO.js → chunk-3FNHYMQD.js} +1 -1
- package/dist/{chunk-D6YQITPD.js → chunk-4UBQFHOG.js} +1 -1
- package/dist/{chunk-N7G2FDAI.js → chunk-5JFKXDO6.js} +1 -1
- package/dist/chunk-6YD572HB.js +4 -0
- package/dist/{chunk-XDERLDVW.js → chunk-7R67JSKQ.js} +1 -1
- package/dist/{chunk-FNQMXCCE.js → chunk-D5XGRVMZ.js} +1 -1
- package/dist/{chunk-WKKH2UE5.js → chunk-FOFOAOHI.js} +1 -1
- package/dist/{chunk-QYUIIFJY.js → chunk-GQKXEVHQ.js} +1 -1
- package/dist/{chunk-5D3QKHYQ.js → chunk-HNVICTWL.js} +1 -1
- package/dist/{chunk-7WP7SERS.js → chunk-HQ6FH7CR.js} +1 -1
- package/dist/{chunk-P6K7EQHF.js → chunk-I2KB6I3D.js} +2 -2
- package/dist/chunk-KBRCX7GE.js +30 -0
- package/dist/chunk-LLPVYWAK.js +10 -0
- package/dist/{chunk-2N7OIUQW.js → chunk-TVVVY2T4.js} +173 -173
- package/dist/{chunk-6SWKDCK3.js → chunk-WXCPYSJ3.js} +1 -1
- package/dist/{chunk-57IGGFHK.js → chunk-XB5QPPSI.js} +1 -1
- package/dist/{chunk-EQABLL4S.js → chunk-YWUBKWGK.js} +1 -1
- package/dist/{devtools-UVGRIXO2.js → devtools-BODX7K3L.js} +1 -1
- package/dist/{esm-HB7M3TZY.js → esm-4BJKCG42.js} +1 -1
- package/dist/{esm-63A57VQM.js → esm-AWTGQAUK.js} +1 -1
- package/dist/{esm-FURF4AWD.js → esm-JKMLEWEU.js} +1 -1
- package/dist/{esm-46K5BSA6.js → esm-MG7NDA4I.js} +1 -1
- package/dist/{esm-73AG4F4H.js → esm-NCNRWOJD.js} +1 -1
- package/dist/{esm-QAEO3U72.js → esm-QVP2GBDR.js} +1 -1
- package/dist/esm-ZR7DS25X.js +225 -0
- package/dist/file-type-Z4DPJWZH.js +12 -0
- package/dist/getMachineId-bsd-RSPO2LUX.js +4 -0
- package/dist/getMachineId-bsd-YMN7H6LU.js +4 -0
- package/dist/getMachineId-darwin-AOWQPOSH.js +5 -0
- package/dist/getMachineId-darwin-FEQVNOUN.js +5 -0
- package/dist/{getMachineId-win-2ZKMVYDE.js → getMachineId-win-H5SABCRW.js} +1 -1
- package/dist/{getMachineId-win-JOM5JSRW.js → getMachineId-win-RV3BPBHF.js} +1 -1
- package/dist/image-worker.js +1 -1
- package/dist/lib/{chunk-XVXFUSSS.js → chunk-IOPSBIYR.js} +1 -1
- package/dist/lib/index.d.ts +802 -802
- package/dist/lib/index.js +19 -17
- package/dist/lib/{providers-2NPR2VR4.js → providers-U3O7GOPH.js} +1 -1
- package/dist/{main-OMIZDIYB.js → main-BIBLUWZX.js} +219 -213
- package/dist/main.js +2 -2
- package/dist/{openai-UOCUBMFA.js → openai-AYEJOJTA.js} +1 -1
- package/dist/{providers-G5SKN22T.js → providers-USI6GYZC.js} +9 -9
- package/dist/{server-Z742CQSK.js → server-RGAJNHA4.js} +1 -1
- package/dist/{server-ESDMJACZ.js → server-XHQ7YJGI.js} +2 -2
- package/dist/{src-CHQYSTW5.js → src-E2NOTM6J.js} +1 -1
- package/dist/{src-HH6MC5CF.js → src-EBGRLYAR.js} +1 -1
- package/dist/{src-YWYPK5QA.js → src-HBBKRA75.js} +1 -1
- package/dist/src-P77FB5XW.js +12 -0
- package/dist/{turndown.es-NQ3KDXM7.js → turndown.es-E6SHSU5B.js} +13 -13
- package/package.json +2 -2
- package/dist/browser/dist/static/webapi-HZESKPJE.js +0 -4
- package/dist/chunk-5AOJ5ZSQ.js +0 -30
- package/dist/chunk-VM4YKTHC.js +0 -10
- package/dist/chunk-WKTO7XPO.js +0 -4
- package/dist/esm-6D27H27M.js +0 -225
- package/dist/file-type-PSFVPAEH.js +0 -12
- package/dist/getMachineId-bsd-2MDOCJCH.js +0 -4
- package/dist/getMachineId-bsd-L5XEQF74.js +0 -4
- package/dist/getMachineId-darwin-SMQEPEZ2.js +0 -5
- package/dist/getMachineId-darwin-V3OSZDJX.js +0 -5
- package/dist/src-P2WNZ6IY.js +0 -12
- /package/dist/{chunk-HKQWGX5S.js → chunk-UJIMMEIV.js} +0 -0
- /package/dist/{getMachineId-linux-OWR5YFVH.js → getMachineId-linux-337SESKP.js} +0 -0
- /package/dist/{getMachineId-linux-C4WJW6ZL.js → getMachineId-linux-P6HXMSZR.js} +0 -0
- /package/dist/{getMachineId-unsupported-M7AEHRA4.js → getMachineId-unsupported-52TDEFNE.js} +0 -0
- /package/dist/{getMachineId-unsupported-J7U5FNFT.js → getMachineId-unsupported-FWRH7XFO.js} +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
|
+
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
+
import{b as JW}from"./chunk-CKOUBYG6.js";import"./chunk-VU3JWAJR.js";import{a as Ws,b as Vs,c as tv,i as Ou,u as oh,v as ov}from"./chunk-GQKXEVHQ.js";import{a as sv,b as _i,c as Cu,d as av,e as Xt,f as cv,g as lv,h as pv,i as Kc,j as sh,k as gt,l as Lt,m as ce,n as Ee,o as xu,p as hi,q as de}from"./chunk-U6NE2CTP.js";import{b as Ru,c as nv,d as vu,e as rv,g as jc,h as iv,i as Zc,j as Xc,k as ih}from"./chunk-UJIMMEIV.js";import"./chunk-456FRBGE.js";import{a as An,c as Au,d as ev,e as Nu}from"./chunk-7MKA3SHV.js";var BS=Au((OAe,mL)=>{"use strict";var DS=An("path").sep;mL.exports=function(e){var t=e.split(DS),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],o=r?3:2,s="",c=n+o-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+DS;for(var l="",p=t.length-1,u=n+o;u<=p;u++)u===p?l+=t[u]:l+=t[u]+DS;return{name:i,basedir:s,path:l}}}});var VS=Au((CAe,WS)=>{"use strict";var ec=An("path"),hr=An("module"),ft=JW()("require-in-the-middle"),fX=BS();WS.exports=fp;WS.exports.Hook=fp;var HS,xm;if(hr.isBuiltin)xm=hr.isBuiltin;else if(hr.builtinModules)xm=e=>e.startsWith("node:")?!0:(HS===void 0&&(HS=new Set(hr.builtinModules)),HS.has(e));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var gX=/([/\\]index)?(\.js)?$/,FS=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 r=An.cache[t];return!!(r&&this._kRitmExports in r)}}get(t,n){let r=this._localCache.get(t);if(r!==void 0)return r;if(!n){let i=An.cache[t];return i&&i[this._kRitmExports]}}set(t,n,r){r?this._localCache.set(t,n):t in An.cache?An.cache[t][this._kRitmExports]=n:(ft('non-core module is unexpectedly not in require.cache: "%s"',t),this._localCache.set(t,n))}};function fp(e,t,n){if(!(this instanceof fp))return new fp(e,t,n);if(typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),typeof hr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof hr._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 FS,this._unhooked=!1,this._origRequire=hr.prototype.require;let r=this,i=new Set,o=t?t.internals===!0:!1,s=Array.isArray(e);ft("registering require hook"),this._require=hr.prototype.require=function(a){return r._unhooked===!0?(ft("ignoring require call - module is soft-unhooked"),r._origRequire.apply(this,arguments)):c.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(a){return r._unhooked===!0?(ft("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):c.call(this,arguments,!0)});function c(a,l){let p=a[0],u=xm(p),d;if(u){if(d=p,p.startsWith("node:")){let M=p.slice(5);xm(M)&&(d=M)}}else{if(l)return ft("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,a);try{d=hr._resolveFilename(p,this)}catch(M){return ft('Module._resolveFilename("%s") threw %j, calling original Module.require',p,M.message),r._origRequire.apply(this,a)}}let m,_;if(ft("processing %s module require('%s'): %s",u===!0?"core":"non-core",p,d),r._cache.has(d,u)===!0)return ft("returning already patched cached module: %s",d),r._cache.get(d,u);let h=i.has(d);h===!1&&i.add(d);let b=l?r._origGetBuiltinModule.apply(this,a):r._origRequire.apply(this,a);if(h===!0)return ft("module is in the process of being patched already - ignoring: %s",d),b;if(i.delete(d),u===!0){if(s===!0&&e.includes(d)===!1)return ft("ignoring core module not on whitelist: %s",d),b;m=d}else if(s===!0&&e.includes(d)){let M=ec.parse(d);m=M.name,_=M.dir}else{let M=fX(d);if(M===void 0)return ft("could not parse filename: %s",d),b;m=M.name,_=M.basedir;let N=_X(M);ft("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",m,p,N,_);let R=!1;if(s){if(!p.startsWith(".")&&e.includes(p)&&(m=p,R=!0),!e.includes(m)&&!e.includes(N))return b;e.includes(N)&&N!==m&&(m=N,R=!0)}if(!R){let P;try{P=An.resolve(m,{paths:[_]})}catch{return ft("could not resolve module: %s",m),r._cache.set(d,b,u),b}if(P!==d)if(o===!0)m=m+ec.sep+ec.relative(_,d),ft("preparing to process require of internal file: %s",m);else return ft("ignoring require of non-main module file: %s",P),r._cache.set(d,b,u),b}}r._cache.set(d,b,u),ft("calling require hook: %s",m);let v=n(b,m,_);return r._cache.set(d,v,u),ft("returning module: %s",m),v}}fp.prototype.unhook=function(){this._unhooked=!0,this._require===hr.prototype.require?(hr.prototype.require=this._origRequire,ft("require unhook successful")):ft("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,ft("process.getBuiltinModule unhook successful")):ft("process.getBuiltinModule unhook unsuccessful"))};function _X(e){let t=ec.sep!=="/"?e.path.split(ec.sep).join("/"):e.path;return ec.posix.join(e.name,t).replace(gX,"")}});var EL=Au(tc=>{"use strict";var qS=[],bL=new WeakMap,br,jS,ZS,_L,QS=new Map,$S=[];function XS(e,t){return t==="module.exports"&&!Object.hasOwn(e,t)?e.default:e[t]}function yX(e,t,n){try{for(let r=0;r<t.length;r++)if(XS(n?.[r]??e,t[r])===void 0)return!0}catch(r){if(!(r instanceof ReferenceError))throw r;return!0}return!1}function yL(e,t,n){return bL.get(e).write(t,n)}function SX(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return yL(e,t,n.value)}var EX={defineProperty:SX,set:yL};function SL(e,t,n){let r=jS.get(e)?.[t];return typeof r=="function"?r(n):!0}function TX(e,t){if(t===Symbol.toStringTag)return"Module";let n=ZS.get(e)[t];if(typeof n=="function")return n()}function IX(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return SL(e,t,n.value)}function AX(e,t,n,r,i){jS??=new WeakMap,ZS??=new WeakMap,_L??={defineProperty:IX,get:TX,set:SL},QS.set(e,i),jS.set(t,n),ZS.set(t,r);let o=new Proxy(t,_L);qS.forEach(s=>s(e,o,i)),$S.push([e,o,i])}function NX(e,t,n,r,i){if(arguments.length===5){AX(e,t,n,r,i);return}let{namespace:o}=t;QS.set(e,n),bL.set(o,t);let s=new Proxy(o,EX);qS.forEach(c=>c(e,s,n,r)),$S.push([e,s,n,r])}var hL=[0,10,50],KS=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});#n;#t;#r;#i;#e;constructor(t,n,r,i,o=!1){if(this.#r=r,this.#t=n,br?.size>0&&n!==void 0&&yX(t,n,i)){let s;do{s=br.size;for(let c of br)c()}while(br.size<s)}if(n!==void 0)for(let s=0;s<n.length;s++)this.#a(n[s],s,i?.[s]??t,o)}#a(t,n,r,i){let o,s=!1;try{o=XS(r,t),s=o===void 0&&br?.size>0,this.#r(n,o),this.namespace[t]=o}catch(c){if(!(c instanceof ReferenceError))throw c;s=!0}if(i||o===void 0){let c=this.#c(t,n,r);this.#e??=[],this.#e.push(c),s&&(br??=new Set,br.add(c))}}write(t,n){if(this.#n===void 0){if(this.#t===void 0)return!0;this.#n=Object.create(null);for(let i=0;i<this.#t.length;i++)this.#n[this.#t[i]]=i;this.#t=void 0}let r=this.#n[t];return r!==void 0&&(this.#r(r,n),this.#e!==void 0&&(this.#i??=Object.create(null),this.#i[t]=!0),this.namespace[t]=n),!0}#c(t,n,r){let i=()=>{if(this.#i?.[t]===!0)return br?.delete(i),!0;try{let o=XS(r,t);return o!==void 0||this.namespace[t]!==void 0?(this.#r(n,o),this.namespace[t]=o,br?.delete(i),!0):!1}catch(o){if(o instanceof ReferenceError)return!1;throw o}};return i}#o(){let t=this.#e;if(t===void 0)return;let n;for(let r of t)r()!==!0&&(n??=[],n.push(r));this.#e=n}flushSync(){this.#o(),this.flush()}flush(){this.#e!==void 0&&queueMicrotask(()=>{this.#o(),this.#s(0)})}#s(t){if(this.#e===void 0)return;if(t>=hL.length){if(br!==void 0)for(let r of this.#e)br.delete(r);this.#e=void 0;return}let n=setTimeout(()=>{this.#o(),this.#s(t+1)},hL[t]);n&&typeof n.unref=="function"&&n.unref()}};tc.register=NX;tc.ModuleBinder=KS;tc.importHooks=qS;tc.specifiers=QS;tc.toHook=$S});var rE=Au((wAe,rc)=>{"use strict";var zS=An("path"),RX=BS(),{fileURLToPath:vX}=An("url"),{MessageChannel:OX}=An("worker_threads"),{isBuiltin:eE}=An("module");eE||(eE=()=>!0);var{importHooks:tE,specifiers:CX,toHook:xX}=EL();function PX(e,t){if(process.platform==="win32"&&e.includes("/")&&(t=t.replaceAll(zS.sep,"/")),t.endsWith(e))return!0;if(!(process.env.TURBOPACK??process.argv.includes("--turbo")))return!1;let r=e.lastIndexOf("-");return r!==-1&&t.endsWith(e.slice(0,r))}var TL,JS;function kX(e){if(e===TL)return JS;let t=e,n,r;if(e.startsWith("node:")){let i=e.slice(5);eE(i)&&(t=i)}else if(e.startsWith("file://")){let i=Error.stackTraceLimit;Error.stackTraceLimit=0;try{n=vX(e),t=n}catch{}if(Error.stackTraceLimit=i,n){let o=RX(n);o&&(t=o.name,r=o.basedir)}}return TL=e,JS={name:t,filePath:n,baseDir:r},JS}function IL(e){tE.push(e),xX.forEach(([t,n,r,i])=>e(t,n,r,i))}function AL(e){let t=tE.indexOf(e);t>-1&&tE.splice(t,1)}function nc(e,t,n,r,i){let o=e(t,n,r,i);o&&o!==t&&"default"in t&&(t.default=o)}var nE;function LX(){let{port1:e,port2:t}=new OX,n=0,r;nE=c=>{n++,e.postMessage(c)},e.on("message",()=>{n--,r&&n<=0&&r()}).unref();function i(){let c=setInterval(()=>{},1e3),a=new Promise(l=>{r=l}).then(()=>{clearInterval(c)});return n===0&&r(),a}let o=t;return{registerOptions:{data:{addHookMessagePort:o,include:[]},transferList:[o]},addHookMessagePort:o,waitForAllMessagesAcknowledged:i}}function gp(e,t,n){if(!(this instanceof gp))return new gp(e,t,n);typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null);let r=t?t.internals===!0:!1;nE&&Array.isArray(e)&&nE(e),this._iitmHook=(i,o,s,c)=>{let{name:a,filePath:l,baseDir:p}=kX(i);if(e)for(let u of e)if(l&&u===l)nc(n,o,l,void 0,c);else if(u===a){if(!p)nc(n,o,a,p,c);else if(PX(CX.get(i),p))nc(n,o,a,p,c);else if(r){let d=a+zS.sep+zS.relative(p,l);nc(n,o,d,p,c)}}else u===s&&nc(n,o,s,p,c);else nc(n,o,a,p,c)},IL(this._iitmHook)}gp.prototype.unhook=function(){AL(this._iitmHook)};rc.exports=gp;rc.exports.Hook=gp;rc.exports.addHook=IL;rc.exports.removeHook=AL;rc.exports.createAddHookMessageChannel=LX});var E=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var te=globalThis;var q="10.78.0";function Je(){return er(te),te}function er(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||q,t[q]=t[q]||{}}function Bn(e,t,n=te){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[q]=r[q]||{};return i[e]||(i[e]=t())}var nr=["debug","info","warn","error","log","assert","trace"],zW="Sentry Logger ",tr={};function we(e){if(!("console"in te))return e();let t=te.console,n={},r=Object.keys(tr);r.forEach(i=>{let o=tr[i];n[i]=t[i],t[i]=o});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function eV(){ch().enabled=!0}function tV(){ch().enabled=!1}function uv(){return ch().enabled}function nV(...e){ah("log",...e)}function rV(...e){ah("warn",...e)}function iV(...e){ah("error",...e)}function ah(e,...t){E&&uv()&&we(()=>{te.console[e](`${zW}[${e}]:`,...t)})}function ch(){return E?Bn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:eV,disable:tV,isEnabled:uv,log:nV,warn:rV,error:iV};var dv=/\(error: (.*)\)/,mv=/captureMessage|captureException/;function ku(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{let o=[],s=n.split(`
|
|
5
|
+
`);for(let c=r;c<s.length;c++){let a=s[c];a.length>1024&&(a=a.slice(0,1024));let l=dv.test(a)?a.replace(dv,"$1"):a;if(!l.includes("Error: ")){for(let p of t){let u=p(l);if(u){o.push(u);break}}if(o.length>=50+i)break}}return fv(o.slice(i))}}function ph(e){return Array.isArray(e)?ku(...e):e}function fv(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Pu(t).function||"")&&t.pop(),t.reverse(),mv.test(Pu(t).function||"")&&(t.pop(),mv.test(Pu(t).function||"")&&t.pop()),t.slice(0,50).map(n=>({...n,filename:n.filename||Pu(t).filename,function:n.function||"?"}))}function Pu(e){return e[e.length-1]||{}}var lh="<anonymous>";function qc(e){try{return!e||typeof e!="function"?lh:e.name||lh}catch{return lh}}function Lu(e){let t=e.exception;if(t){let n=[];try{return t.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}function gv(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var Qc={},_v={};function uh(e,t){return Qc[e]=Qc[e]||[],Qc[e].push(t),()=>{let n=Qc[e];if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}function $c(e,t){if(!_v[e]){_v[e]=!0;try{t()}catch(n){E&&g.error(`Error while instrumenting ${e}`,n)}}}function Ys(e,t){let n=e&&Qc[e];if(n)for(let r of n)try{r(t)}catch(i){E&&g.error(`Error while triggering instrumentation handler.
|
|
6
|
+
Type: ${e}
|
|
7
|
+
Name: ${qc(r)}
|
|
8
|
+
Error:`,i)}}var hv=Object.prototype.toString;function ze(e){switch(hv.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return gh(e,Error)}}function Mu(e,t){return hv.call(e)===`[object ${t}]`}function dh(e){return Mu(e,"ErrorEvent")}function js(e){return Mu(e,"String")}function Zi(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function rr(e){return e===null||Zi(e)||typeof e!="object"&&typeof e!="function"}function Kt(e){return Mu(e,"Object")}function B(e){return typeof e=="object"&&e!==null}function mh(e){return typeof Event<"u"&&gh(e,Event)}function fh(e){return Mu(e,"RegExp")}function bt(e){return!!(e?.then&&typeof e.then=="function")}function gh(e,t){try{return e instanceof t}catch{return!1}}function Mt(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!="function")return;let i=n(r);typeof i=="function"&&Wo(i,r);try{e[t]=i}catch{E&&g.log(`Failed to replace method "${t}" in object`,e)}}function Ge(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{E&&g.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Wo(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,Ge(e,"__sentry_original__",t)}catch{}}function Zs(e,t,n,r=!0){let i=e[t];if(typeof i!="function")throw new Error(`Cannot wrap method: ${t} is not a function`);if(vr(i))throw new Error(`Attempting to wrap method ${t} multiple times`);Wo(n,i),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function vr(e){return e.__sentry_original__}function wu(e){if(ze(e))return{message:e.message,name:e.name,stack:e.stack,...bv(e)};if(mh(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...bv(e)}}return e}function bv(e){return B(e)?Object.fromEntries(Object.entries(e)):{}}function _h(e){let t=Object.keys(wu(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var Xs;function Vo(e){if(Xs!==void 0)return Xs?Xs(e):e();let t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=te;return t in n&&typeof n[t]=="function"?(Xs=n[t],Xs(e)):(Xs=null,e())}function ct(){return Vo(()=>Math.random())}function rt(){return Vo(()=>Date.now())}var yv=Symbol.for("sentry.skipNormalization"),Sv=Symbol.for("sentry.overrideNormalizationDepth");function Ev(e){Ge(e,yv,!0)}function Tv(e,t){Ge(e,Sv,t)}function Iv(e){return!!e[yv]}function Av(e){let t=e[Sv];return typeof t=="number"?t:void 0}var Nv;function qe(e,t=100,n=1/0){try{return hh("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function bh(e,t=3,n=100*1024){let r=qe(e,t);return aV(r)>n?bh(e,t-1,n):r}function hh(e,t,n=1/0,r=1/0,i=cV()){let[o,s]=i;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let c=yh(e,t);if(!c.startsWith("[object "))return c;if(Iv(t))return t;let a=Av(t),l=a!==void 0?a:n;if(l===0)return c.replace("object ","");if(o(t))return"[Circular ~]";let p=t;if(p&&typeof p.toJSON=="function")try{let _=p.toJSON();return hh("",_,l-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,m=wu(t);for(let _ in m){if(!Object.prototype.hasOwnProperty.call(m,_))continue;if(d>=r){u[_]="[MaxProperties ~]";break}let h=m[_];u[_]=hh(_,h,l-1,r,i),d++}return s(t),u}function yh(e,t){try{if(Nv){let r=Nv(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${qc(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${oV(t)}]`}catch(n){return`**non-serializable** (${n})`}}function oV(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function sV(e){return~-encodeURI(e).split(/%..|./).length}function aV(e){return sV(JSON.stringify(e))}function cV(){let e=new WeakSet;function t(r){return e.has(r)?!0:(e.add(r),!1)}function n(r){e.delete(r)}return[t,n]}function Ue(e,t="[unserializable]"){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return typeof t=="function"?t(e):t}}function gn(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Sh(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 o=Math.min(i+140,r);return o>r-5&&(o=r),o===r&&(i=Math.max(o-140,0)),n=n.slice(i,o),i>0&&(n=`'{snip} ${n}`),o<r&&(n+=" {snip}"),n}function Ks(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let i=e[r];rr(i)?n.push(String(i)):i instanceof Error?n.push(i.message?`${i.name}: ${i.message}`:i.name):n.push(yh(void 0,i))}return n.join(t)}function Or(e,t,n=!1){return js(e)?fh(t)?t.test(e):js(t)?n?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function _n(e,t=[],n=!1){for(let r of t)if(Or(e,r,n))return!0;return!1}function lV(){let e=te;return e.crypto||e.msCrypto}var Eh;function pV(){return ct()*16}function ut(e=lV()){try{if(e?.randomUUID)return Vo(()=>e.randomUUID()).replace(/-/g,"")}catch{}return Eh||(Eh="10000000100040008000"+1e11),Eh.replace(/[018]/g,t=>(t^(pV()&15)>>t/4).toString(16))}function Rv(e){return e.exception?.values?.[0]}function Xi(e){let{message:t,event_id:n}=e;if(t)return t;let r=Rv(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Ih(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type=n||"Error")}function Hn(e,t){let n=Rv(e);if(!n)return;let r={type:"generic",handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&"data"in t){let o={...i?.data,...t.data};n.mechanism.data=o}}var uV=/^(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 Th(e){return parseInt(e||"",10)}function qs(e){let t=e.match(uV)||[],n=Th(t[1]),r=Th(t[2]),i=Th(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 Gu(e){if(vv(e))return!0;try{Ge(e,"__sentry_captured__",!0)}catch{}return!1}function vv(e){try{return e.__sentry_captured__}catch{}}var Cv=1e3;function Cr(){return rt()/Cv}function dV(){let{performance:e}=te;if(!e?.now||!e.timeOrigin)return Cr;let t=e.timeOrigin;return()=>(t+Vo(()=>e.now()))/Cv}var Ov;function lt(){return(Ov??(Ov=dV()))()}function xv(e){let t=lt(),n={sid:ut(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>mV(n)};return e&&bi(n,e),n}function bi(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||lt(),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:ut()),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 n=e.timestamp-e.started;e.duration=n>=0?n: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 Pv(e,t){let n={};t?n={status:t}:e.status==="ok"&&(n={status:"exited"}),bi(e,n)}function mV(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 Ki(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 i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Ki(r[i],t[i],n-1));return r}function yt(){return ut()}function qt(){return ut().substring(16)}function Yo(e){try{let t=te.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function jo(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}var Ah="_sentrySpan";function Fn(e,t){t?Ge(e,Ah,Yo(t)):delete e[Ah]}function ir(e){return jo(e[Ah])}var fV=100,Qt=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:yt(),sampleRand:ct()}}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,Fn(t,ir(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&bi(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this.setTags({[t]:n})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,n){return this.setAttributes({[t]:n})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t=="function"?t(this):t,r=n instanceof e?n.getScopeData():Kt(n)?t:void 0,{tags:i,attributes:o,extra:s,user:c,contexts:a,level:l,fingerprint:p=[],propagationContext:u,conversationId:d}=r||{};return this._tags={...this._tags,...i},this._attributes={...this._attributes,...o},this._extra={...this._extra,...s},this._contexts={...this._contexts,...a},c&&Object.keys(c).length&&(this._user=c),l&&(this._level=l),p.length&&(this._fingerprint=p),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,Fn(this,void 0),this._attachments=[],this.setPropagationContext({traceId:yt(),sampleRand:ct()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){let r=typeof n=="number"?n:fV;if(r<=0)return this;let i={timestamp:Cr(),...t,message:t.message?gn(t.message,2048):t.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),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:ir(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Ki(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){let r=n?.event_id||ut();if(!this._client)return E&&g.warn("No client configured on scope - will not capture exception!"),r;let i=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureMessage(t,n,r){let i=r?.event_id||ut();if(!this._client)return E&&g.warn("No client configured on scope - will not capture message!"),i;let o=r?.syntheticException??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:o,...r,event_id:i},this),i}captureEvent(t,n){let r=t.event_id||n?.event_id||ut();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(E&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}};function Qs(){return Bn("defaultCurrentScope",()=>new Qt)}function vt(){return Bn("defaultIsolationScope",()=>new Qt)}var kv=e=>e instanceof Promise&&!e[Lv],Lv=Symbol("chained PromiseLike"),Uu=(e,t,n)=>{let r=e.then(i=>(t(i),i),i=>{throw n(i),i});return kv(r)&&kv(e)?r:gV(e,r)},gV=(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:(...o)=>i.apply(e,o),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[Lv]:!0}),t};var Nh=class{constructor(t,n){let r;t?r=t:r=new Qt;let i;n?i=n:i=new Qt,this._stack=[{scope:r}],this._isolationScope=i}withScope(t){let n=this._pushScope(),r;try{r=t(n)}catch(i){throw this._popScope(),i}return bt(r)?Uu(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function $s(){let e=Je(),t=er(e);return t.stack=t.stack||new Nh(Qs(),vt())}function _V(e){return $s().withScope(e)}function hV(e,t){let n=$s();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Mv(e){return $s().withScope(()=>e($s().getIsolationScope()))}function wv(){return{withIsolationScope:Mv,withScope:_V,withSetScope:hV,withSetIsolationScope:(e,t)=>Mv(t),getCurrentScope:()=>$s().getScope(),getIsolationScope:()=>$s().getIsolationScope()}}function Rh(e){let t=Je(),n=er(t);n.acs=e}function St(e){let t=er(e);return t.acs?t.acs:wv()}function bV(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function yV(e,t){let{value:n,unit:r}=bV(e)?e:{value:e,unit:void 0},i=SV(n),o=r&&typeof r=="string"?{unit:r}:{};if(i)return{...i,...o};if(!t||t==="skip-undefined"&&n===void 0)return;let s="";try{s=JSON.stringify(n)??""}catch{}return{value:s,type:"string",...o}}function yi(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let o=yV(i,t);o&&(n[r]=o)}return n}function vh(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 i=r.value;Array.isArray(i)?t+=Gv(i[0])*i.length:rr(i)?t+=Gv(i):t+=100}return t}function Gv(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function SV(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}}var Uv;function Dv(){return Uv?.()}function Oh(){return Uv!==void 0}function ne(){let e=Je();return St(e).getCurrentScope()}function $(){let e=Je();return St(e).getIsolationScope()}function Zo(){return Bn("globalScope",()=>new Qt)}function He(...e){let t=Je(),n=St(t);if(e.length===2){let[r,i]=e;return r?n.withSetScope(r,i):n.withScope(i)}return n.withScope(e[0])}function or(...e){let t=Je(),n=St(t);if(e.length===2){let[r,i]=e;return r?n.withSetIsolationScope(r,i):n.withIsolationScope(i)}return n.withIsolationScope(e[0])}function O(){return ne().getClient()}function Xo(e){let t=Dv();if(t)return{trace_id:t.traceId,span_id:t.spanId};let n=e.getPropagationContext(),{traceId:r,parentSpanId:i,propagationSpanId:o}=n,s={trace_id:r,span_id:o||qt()};return i&&(s.parent_span_id=i),s}var ve="sentry.source",Wn="sentry.sample_rate",Ch="sentry.previous_trace_sample_rate",H="sentry.op",S="sentry.origin",xh="sentry.status.message";var Du="sentry.measurement_unit",Bu="sentry.measurement_value",Ph="sentry.release",kh="sentry.environment";var Lh="sentry.sdk.integrations",Mh="user.id",wh="user.email",Jc="user.ip_address",Gh="user.name",hn="sentry.custom_span_name",Js="sentry.profile_id",zs="sentry.exclusive_time",Uh="cache.hit",Dh="cache.key",Bh="cache.item_size",Hh="http.request.method";var Ko="gen_ai.conversation.id";function wt(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 ea(e,t){e.setAttribute("http.response.status_code",t);let n=wt(t);n.message!=="unknown_error"&&e.setStatus(n)}var Bv="_sentryScope",Hv="_sentryIsolationScope",Fv=Symbol.for("sentry.otelSourceInference"),Wv=Symbol.for("sentry.otelSourceExplicitlySet"),Vv=Symbol.for("sentry.tracerProviderSpan");function xr(e,t,n){e&&(Ge(e,Hv,Yo(n)),Ge(e,Bv,t))}function $t(e){let t=e;return{scope:t[Bv],isolationScope:jo(t[Hv])}}function Fh(e){Ge(e,Fv,!0)}function ta(e){return e[Fv]===!0}function Wh(e){Ge(e,Wv,!0)}function Vh(e){return e[Wv]===!0}function Yh(e){Ge(e,Vv,!0)}function Hu(e){return e[Vv]===!0}var Si="sentry-";var jv=8192;function sr(e){let t=na(e);if(!t)return;let n=Object.entries(t).reduce((r,[i,o])=>{if(i.startsWith(Si)){let s=i.slice(Si.length);r[s]=o}return r},{});if(Object.keys(n).length>0)return n}function qi(e){if(!e)return;let t=Object.entries(e).reduce((n,[r,i])=>(i&&(n[`${Si}${r}`]=i),n),{});return jh(t)}function na(e){if(!(!e||!js(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{let r=Yv(n);return Object.entries(r).forEach(([i,o])=>{t[i]=o}),t},{}):Yv(e)}function Yv(e){return e.split(",").map(t=>{let n=t.indexOf("=");if(n===-1)return[];let r=t.slice(0,n),i=t.slice(n+1);return[r,i].map(o=>{try{return decodeURIComponent(o.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}function jh(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],i)=>{let o=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,s=i===0?o:`${t},${o}`;return s.length>jv?(E&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):s},"")}function ra(e,t){if(!e)return t;let n=na(e),r=na(t);if(!r)return e;let i={},o=!1,s={},c={};for(let[a,l]of Object.entries(r))a.startsWith(Si)?(s[a]=l,o=!0):c[a]=l;if(n)for(let[a,l]of Object.entries(n))(!o||!a.startsWith(Si))&&(i[a]=l);o&&Object.assign(i,s);for(let[a,l]of Object.entries(c))i[a]??(i[a]=l);return jh(i)}var EV=/^o(\d+)\./,TV=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function IV(e){return e==="http"||e==="https"}function sn(e,t=!1){let{host:n,path:r,pass:i,port:o,projectId:s,protocol:c,publicKey:a}=e;return`${c}://${a}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function AV(e){let t=TV.exec(e);if(!t){we(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i="",o="",s="",c=""]=t.slice(1),a="",l=c,p=l.split("/");if(p.length>1&&(a=p.slice(0,-1).join("/"),l=p.pop()),l){let u=l.match(/^\d+/);u&&(l=u[0])}return Zv({host:o,pass:i,path:a,projectId:l,port:s,protocol:n,publicKey:r})}function Zv(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function NV(e){if(!E)return!0;let{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(s=>e[s]?!1:(g.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:n.match(/^\d+$/)?IV(r)?t&&isNaN(parseInt(t,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function RV(e){return e.match(EV)?.[1]}function Fu(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=RV(n)),r}function Xv(e){let t=typeof e=="string"?AV(e):Zv(e);if(!(!t||!NV(t)))return t}function Nn(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 Wu=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Kv(e){if(!e)return;let t=e.match(Wu);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 zc(e){return!!e.parentSpanId||!!e.dsc}function Rn(e,t){let n=Kv(e),r=sr(t);if(!n?.traceId)return{traceId:yt(),sampleRand:ct()};let i=vV(n,r);r&&(r.sample_rand=i.toString());let{traceId:o,parentSpanId:s,parentSampled:c}=n;return{traceId:o,parentSpanId:s,sampled:c,dsc:r||{},sampleRand:i}}function Qi(e=yt(),t=qt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function $i(e=yt(),t=qt(),n){return`00-${e}-${t}-${n?"01":"00"}`}function vV(e,t){let n=Nn(t?.sample_rand);if(n!==void 0)return n;let r=Nn(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?ct()*r:r+ct()*(1-r):ct()}function el(e,t){let n=Fu(e);return t&&n&&t!==n?(g.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):(e.getOptions().strictTraceContinuation||!1)&&(t&&!n||!t&&n)?(g.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 Vu=0,rl=1,qv=!1;function $v(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:o,status:s,origin:c,links:a}=oe(e);return{parent_span_id:o,span_id:t,trace_id:n,data:r,op:i,status:s,origin:c,links:a}}function kr(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:oe(e).parent_span_id,o=$t(e).scope,s=r?o?.getPropagationContext().propagationSpanId||qt():t;return{parent_span_id:i,span_id:s,trace_id:n}}function il(e){let{traceId:t,spanId:n}=e.spanContext(),r=zt(e);return Qi(t,n,r)}function Jv(e){let{traceId:t,spanId:n}=e.spanContext(),r=zt(e);return $i(t,n,r)}function qo(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...i},attributes:o})=>({span_id:t,trace_id:n,sampled:r===rl,attributes:o,...i}))}function Xh(e){if(e?.length)return e.map(({context:{spanId:t,traceId:n,traceFlags:r},attributes:i})=>({span_id:t,trace_id:n,sampled:r===rl,attributes:i}))}function Jt(e){return typeof e=="number"?Qv(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Qv(e.getTime()):lt()}function Qv(e){return e>9999999999?e/1e3:e}function oe(e){if(ol(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(e0(e)){let{attributes:r,startTime:i,name:o,endTime:s,status:c,links:a}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:zv(e),start_timestamp:Jt(i),timestamp:Jt(s)||void 0,status:Qo(c),op:r[H],origin:r[S],links:qo(a)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Yu(e){if(ol(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(e0(e)){let{attributes:r,startTime:i,name:o,endTime:s,status:c,links:a}=e;return{name:o,span_id:t,trace_id:n,parent_span_id:zv(e),start_timestamp:Jt(i),end_timestamp:Jt(s),is_segment:e===ia(e),status:Zu(c),attributes:Kh(r,c),links:Xh(a)}}return{span_id:t,trace_id:n,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===ia(e)}}function zv(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function ju(e){return{...e,attributes:yi(e.attributes),links:e.links?.map(t=>({...t,attributes:yi(t.attributes)}))}}function e0(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function ol(e){return typeof e.getSpanJSON=="function"}function zt(e){let{traceFlags:t}=e.spanContext();return t===rl}function Qo(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function Zu(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}function Kh(e,t){let n=Zu(t)==="error"?t?.message:void 0;return{...n&&{[xh]:n},...e}}var tl="_sentryChildSpans",Zh="_sentryRootSpan";function Ei(e,t){let n=e[Zh]||e;Ge(t,Zh,n),zt(e)&&(!e.isRecording()&&!n.isRecording()||(e[tl]?e[tl].add(t):Ge(e,tl,new Set([t]))))}function sl(e){let t=new Set;function n(r){if(!t.has(r)&&zt(r)){t.add(r);let i=r[tl]?Array.from(r[tl]):[];for(let o of i)n(o)}}return n(e),Array.from(t)}var Oe=ia;function ia(e){return e[Zh]||e}function Q(){let e=Je(),t=St(e);return t.getActiveSpan?t.getActiveSpan():ir(ne())}function $o(){qv||(we(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),qv=!0)}function qh(e,t){e.updateName(t),e.setAttributes({[ve]:"custom",[hn]:t})}function De(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=e||O()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function t0(e){g.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ar(e,t){if(!t?.length)return!1;for(let n of t){if(CV(n)){if(e.description&&Or(e.description,n))return E&&t0(e),!0;continue}let r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;let i=n.name?e.description&&Or(e.description,n.name):!0,o=n.op?e.op&&Or(e.op,n.op):!0,s=n.attributes?Object.entries(n.attributes).every(([c,a])=>OV(e.attributes?.[c],a)):!0;if(i&&o&&s)return E&&t0(e),!0}return!1}function OV(e,t){return typeof e=="string"&&(typeof t=="string"||t instanceof RegExp)?Or(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e===t}function n0(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let i of e)i.parent_span_id===r&&(i.parent_span_id=n)}function CV(e){return typeof e=="string"||e instanceof RegExp}var r0=Symbol.for("sentry.nonRecordingSpan"),Lr=class{constructor(t={}){this._traceId=t.traceId||yt(),this._spanId=t.spanId||qt(),this.dropReason=t.dropReason,Ge(this,r0,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Vu}}end(t){}setAttribute(t,n){return this}setAttributes(t){return this}setStatus(t){return this}updateName(t){return this}isRecording(){return!1}addEvent(t,n,r){return this}addLink(t){return this}addLinks(t){return this}recordException(t,n){}};function Ji(e){return!!e&&e[r0]===!0}var zi="production";var i0="_frozenDsc";function Qh(e,t){Ge(e,i0,t)}function $h(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||zi,release:n.release,public_key:r,trace_id:e,org_id:Fu(t)};return t.emit("createDsc",i),i}function cr(e,t){let n=t.getPropagationContext();return n.dsc||$h(n.traceId,e)}function it(e){let t=O();if(!t)return{};let n=Oe(e),r=oe(n),i=r.data,o=n.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[Wn]??i[Ch];function c(b){return(typeof s=="number"||typeof s=="string")&&(b.sample_rate=`${s}`),b}let a=n[i0];if(a)return c(a);let l=Ji(n),p=l&&n.dropReason==="ignored";if(l&&(!De(t.getOptions())||p)){let b=$t(n).scope;if(b){let v={...cr(t,b)};return p&&(v.sampled="false"),c(v)}}let u=o?.get("sentry.dsc"),d=u&&sr(u);if(d)return c(d);let m=$h(e.spanContext().traceId,t),_=i[ve]??i["sentry.segment.name.source"],h=r.description;return _!=="url"&&h&&(m.transaction=h),De()&&(m.sampled=String(zt(n)),m.sample_rand=o?.get("sentry.sample_rand")??$t(n).scope?.getPropagationContext().sampleRand.toString()),c(m),t.emit("createDsc",m,n),m}function Jh(e){let t=it(e);return qi(t)}function zh(e){return Ge(e,"_streamed",!0),e}function Ti(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function Gt(e,t=[]){return[e,t]}function Xu(e,t){let[n,r]=e;return[n,[...r,t]]}function al(e,t){let n=e[1];for(let r of n){let i=r[0].type;if(t(r,i))return!0}return!1}function tb(e,t){return al(e,(n,r)=>t.includes(r))}function eb(e){let t=er(te);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function cl(e){let[t,n]=e,r=JSON.stringify(t);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[eb(r),o]:r.push(typeof o=="string"?eb(o):o)}for(let o of n){let[s,c]=o;if(i(`
|
|
9
|
+
${JSON.stringify(s)}
|
|
10
|
+
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let a;try{a=JSON.stringify(c)}catch{a=JSON.stringify(qe(c))}i(a)}}return typeof r=="string"?r:xV(r)}function xV(e){let t=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(t),r=0;for(let i of e)n.set(i,r),r+=i.length;return n}function nb(e){return[{type:"span"},e]}function rb(e){let t=typeof e.data=="string"?eb(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var o0={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",metric:"trace_metric"};function PV(e){return e in o0}function Ku(e){return PV(e)?o0[e]:e}function oa(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function ib(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(rt()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:sn(r)},...i&&{trace:i}}}function kV(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 s0(e,t,n,r){let i=oa(n),o={sent_at:new Date(rt()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:sn(t)}},s="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return Gt(o,[s])}function a0(e,t,n,r){let i=oa(n),o=e.type&&e.type!=="replay_event"?e.type:"event";kV(e,n?.sdk);let s=ib(e,i,r,t);return delete e.sdkProcessingMetadata,Gt(s,[[{type:o},e]])}function c0(e,t){function n(m){return!!m.trace_id&&!!m.public_key}let r=it(e[0]),i=t?.getDsn(),o=t?.getOptions().tunnel,s={sent_at:new Date(rt()).toISOString(),...n(r)&&{trace:r},...!!o&&i&&{dsn:sn(i)}},{beforeSendSpan:c,ignoreSpans:a}=t?.getOptions()||{},l=a?.length?e.filter(m=>{let _=oe(m);return!ar({description:_.description,op:_.op,attributes:_.data},a)}):e,p=e.length-l.length;p&&t?.recordDroppedEvent("before_send","span",p);let u=c?m=>{let _=oe(m),h=Ti(c)?_:c(_);return h||($o(),_)}:oe,d=[];for(let m of l){let _=u(m);_&&d.push(nb(_))}return Gt(s,d)}function ll(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=oe(e),{spanId:i}=e.spanContext(),o=zt(e),s=Oe(e),c=s===e,a=`[Tracing] Starting ${o?"sampled":"unsampled"} ${c?"root ":""}span`,l=[`op: ${n}`,`name: ${t}`,`ID: ${i}`];if(r&&l.push(`parent ID: ${r}`),!c){let{op:p,description:u}=oe(s);l.push(`root ID: ${s.spanContext().spanId}`),p&&l.push(`root op: ${p}`),u&&l.push(`root description: ${u}`)}g.log(`${a}
|
|
11
|
+
${l.join(`
|
|
12
|
+
`)}`)}function pl(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >"}=oe(e),{spanId:r}=e.spanContext(),o=Oe(e)===e,s=`[Tracing] Finishing "${n}" ${o?"root ":""}span "${t}" with ID ${r}`;g.log(s)}function ob(e,t,n,r=Q()){let i=r&&Oe(r);i&&(E&&g.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[Bu]:t,[Du]:n}))}function Jo(e){if(!e||e.length===0)return;let t={};return e.forEach(n=>{let r=n.attributes||{},i=r[Du],o=r[Bu];typeof i=="string"&&typeof o=="number"&&(t[n.name]={value:o,unit:i})}),t}function l0(e){er(Je()).segmentSpanCaptureStrategy=e}function ul(){return er(Je()).segmentSpanCaptureStrategy}function ot(e){return e.getOptions().traceLifecycle==="stream"}var qu=1e3,sa=class{constructor(t={}){this._traceId=t.traceId||yt(),this._spanId=t.spanId||qt(),this._startTime=t.startTimestamp||lt(),this._links=t.links,this._attributes={},this.setAttributes({[S]:"manual",[H]:t.op,...t.attributes}),this._name=t.name,t.parentSpanId&&(this._parentSpanId=t.parentSpanId),"sampled"in t&&(this._sampled=t.sampled),t.endTimestamp&&(this._endTime=t.endTimestamp),this._events=[],this._isStandaloneSpan=t.isStandalone,this._endTime&&this._onSpanEnded()}addLink(t){return this._frozen?this:(this._links?this._links.push(t):this._links=[t],this)}addLinks(t){return this._frozen?this:(this._links?this._links.push(...t):this._links=t,this)}recordException(t,n){}spanContext(){let{_spanId:t,_traceId:n,_sampled:r}=this;return{spanId:t,traceId:n,traceFlags:r?rl:Vu}}setAttribute(t,n){return this._frozen?this:(n===void 0?delete this._attributes[t]:this._attributes[t]=n,t===ve&&n!==void 0&&ta(this)&&Wh(this),this)}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._frozen||(this._startTime=Jt(t))}setStatus(t){return this._frozen?this:(this._status=t,this)}updateName(t){return this._frozen?this:(this._name=t,ta(this)||this.setAttribute(ve,"custom"),this)}end(t){if(this._endTime){this._frozen=Hu(this);return}this._endTime=Jt(t),pl(this),this._onSpanEnded(),this._frozen=Hu(this)}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[H],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Qo(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[S],profile_id:this._attributes[Js],exclusive_time:this._attributes[zs],measurements:Jo(this._events),is_segment:this._isStandaloneSpan&&Oe(this)===this||void 0,segment_id:this._isStandaloneSpan?Oe(this).spanContext().spanId:void 0,links:qo(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===Oe(this),status:Zu(this._status),attributes:Kh(this._attributes,this._status),links:Xh(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,r){if(this._frozen)return this;E&&g.log("[Tracing] Adding an event to span:",t);let i=p0(n)?n:r||lt(),o=p0(n)?{}:n||{},s={name:t,time:Jt(i),attributes:o};return this._events.push(s),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let t=O();t&&(t.emit("spanEnd",this),this._isStandaloneSpan||t.emit("afterSpanEnd",this));let n=Oe(this),r=this._isStandaloneSpan||this===n;if(this._isStandaloneSpan){this._sampled?MV(c0([this],t)):(E&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}if(!r){let s=ul();if(s){let c=$t(this).scope||ne();s.onChildSpanEnded(this,n,a=>this._convertSpanToTransaction(a),c)}return}if(t&&ot(t)){t.emit("afterSegmentSpanEnd",this);return}let i=$t(this).scope||ne(),o=ul();if(o)o.onSegmentSpanEnded(s=>this._convertSpanToTransaction(s),i);else{let s=this._convertSpanToTransaction();s&&i.captureEvent(s)}}_convertSpanToTransaction(t={}){if(!u0(oe(this)))return;this._name||(E&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:n,isolationScope:r}=$t(this),i=n?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;t.onSpanCaptured?.(this);let o=[],s=0;for(let m of sl(this)){if(m===this||LV(m)||t.isSpanAlreadyCaptured?.(m))continue;let _=oe(m);if(!u0(_)){t.onSpanCaptured||s++;continue}t.onSpanCaptured?.(m),o.push(_)}let c=n?.getClient()||O();s&&c?.recordDroppedEvent("invalid","span",s),o.length>qu&&c?.recordDroppedEvent("buffer_overflow","span",o.length-qu);let a=this._attributes[ve];delete this._attributes[hn];let l=!1;o.forEach(m=>{delete m.data[hn],m.op?.startsWith("gen_ai.")&&(l=!0)});let p={contexts:{trace:$v(this)},spans:o.length>qu?o.sort((m,_)=>m.start_timestamp-_.start_timestamp).slice(0,qu):o,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:n,capturedSpanIsolationScope:r,dynamicSamplingContext:it(this),hasGenAiSpans:l},request:i,...a&&{transaction_info:{source:a}}},u=Jo(this._events);return u&&Object.keys(u).length&&(E&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(u,void 0,2)),p.measurements=u),p}};function p0(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function u0(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function LV(e){return e instanceof sa&&e.isStandaloneSpan()}function MV(e){let t=O();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function lr(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(o){throw t(o),n(),o}return wV(i,t,n,r)}function wV(e,t,n,r){return bt(e)?Uu(e,i=>{n(),r(i)},i=>{t(i),n()}):(n(),r(e),e)}function dl(e,t,n){if(!De(e))return[!1];let r,i;typeof e.tracesSampler=="function"?(i=e.tracesSampler({...t,inheritOrSampleWith:c=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):c}),r=!0):t.parentSampled!==void 0?i=t.parentSampled:typeof e.tracesSampleRate<"u"&&(i=e.tracesSampleRate,r=!0);let o=Nn(i);if(o===void 0)return E&&g.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(!o)return E&&g.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,o,r];let s=n<o;return s||E&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[s,o,r]}var aa="__SENTRY_SUPPRESS_TRACING__";function Se(e,t){let n=zo();if(n.startSpan)return n.startSpan(e,t);let r=cb(e),{forceTransaction:i,parentSpan:o,scope:s}=e,c=s?.clone();return He(c,()=>f0(o)(()=>{let l=ne(),p=lb(l,o),u=O(),m=e.onlyIfParent&&!p?sb(l,u):ab({parentSpan:p,spanArguments:r,forceTransaction:i,scope:l});return(!wr(m)||!p)&&Fn(l,m),lr(()=>t(m),()=>{let{status:_}=oe(m);m.isRecording()&&(!_||_==="ok")&&m.setStatus({code:2,message:"internal_error"})},()=>{m.end()})}))}function Le(e,t){let n=zo();if(n.startSpanManual)return n.startSpanManual(e,t);let r=cb(e),{forceTransaction:i,parentSpan:o,scope:s}=e,c=s?.clone();return He(c,()=>f0(o)(()=>{let l=ne(),p=lb(l,o),d=e.onlyIfParent&&!p?sb(l,O()):ab({parentSpan:p,spanArguments:r,forceTransaction:i,scope:l});return(!wr(d)||!p)&&Fn(l,d),lr(()=>t(d,()=>d.end()),()=>{let{status:m}=oe(d);d.isRecording()&&(!m||m==="ok")&&d.setStatus({code:2,message:"internal_error"})})}))}function L(e){let t=zo();return t.startInactiveSpan?t.startInactiveSpan(e):m0(e)}function ca(e){return m0(e)}function m0(e){let t=cb(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?o=>He(e.scope,o):r!==void 0?o=>se(r,o):o=>o())(()=>{let o=ne(),s=lb(o,r),c=O();return e.onlyIfParent&&!s?sb(o,c):ab({parentSpan:s,spanArguments:t,forceTransaction:n,scope:o})})}var vn=(e,t)=>{let n=Je(),r=St(n);if(r.continueTrace)return r.continueTrace(e,t);let{sentryTrace:i,baggage:o}=e,s=O(),c=sr(o);return s&&!el(s,c?.org_id)?On(t):He(a=>{let l=Rn(i,o);return a.setPropagationContext(l),Fn(a,void 0),t()})};function se(e,t){let n=zo();return n.withActiveSpan?n.withActiveSpan(e,t):He(r=>(Fn(r,e||void 0),t(r)))}function Vn(e){let t=zo();return t.suppressTracing?t.suppressTracing(e):He(n=>{n.setSDKProcessingMetadata({[aa]:!0});let r=e();return n.setSDKProcessingMetadata({[aa]:void 0}),r})}function Mr(e=ne()){let t=zo();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[aa]===!0}function On(e){let t=zo();return t.startNewTrace?t.startNewTrace(e):He(n=>(n.setPropagationContext({traceId:yt(),sampleRand:ct()}),E&&g.log(`Starting a new trace with id ${n.getPropagationContext().traceId}`),se(null,e)))}function sb(e,t){t?.recordDroppedEvent("no_parent_span","span");let n=new Lr({traceId:e.getPropagationContext().traceId});return xr(n,e,$()),n}function ab({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let i=$();if(!De()){let c=r.getPropagationContext(),a=e?e.spanContext().traceId:c.traceId,l=new Lr({traceId:a});return e&&!n&&Ei(e,l),xr(l,r,i),l}let o=O();if(UV(o,t)){Mr(r)||o?.recordDroppedEvent("ignored","span");let c=new Lr({dropReason:"ignored",traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&Ei(e,c),xr(c,r,i),c}let s;if(e&&!n)s=GV(e,r,t,i),Ei(e,s);else if(e){let c=it(e),{traceId:a,spanId:l}=e.spanContext(),p=zt(e);s=d0({traceId:a,parentSpanId:l,...t},r,i,p),Qh(s,c)}else{let{traceId:c,dsc:a,parentSpanId:l,sampled:p}=r.getPropagationContext();s=d0({traceId:c,parentSpanId:l,...t},r,i,p),a&&Qh(s,a)}return ll(s),s}function cb(e){let n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let r={...n};return r.startTimestamp=Jt(e.startTime),delete r.startTime,r}return n}function zo(){let e=Je();return St(e)}function d0(e,t,n,r){let i=O(),o=i?.getOptions()||{},{name:s=""}=e,c={spanAttributes:{...e.attributes},spanName:s,parentSampled:r};i?.emit("beforeSampling",c,{decision:!1});let a=c.parentSampled??r,l=c.spanAttributes,p=t.getPropagationContext(),u=Mr(t),[d,m,_]=u?[!1]:dl(o,{name:s,parentSampled:a,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:Nn(p.dsc?.sample_rate)},p.sampleRand),h=new sa({...e,attributes:{[ve]:"custom",[Wn]:m!==void 0&&_?m:void 0,...l},sampled:d});return!d&&i&&!u&&(E&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),i.recordDroppedEvent("sample_rate",ot(i)?"span":"transaction")),xr(h,t,n),i&&i.emit("spanStart",h),h}function GV(e,t,n,r){let{spanId:i,traceId:o}=e.spanContext(),s=Mr(t),c=s?!1:zt(e),a=c?new sa({...n,parentSpanId:i,traceId:o,sampled:c}):new Lr({traceId:o});Ei(e,a),xr(a,t,r);let l=O();return l&&(ot(l)&&Ji(a)&&(Ji(e)&&e.dropReason?(a.dropReason=e.dropReason,l.recordDroppedEvent(e.dropReason,"span")):s||(a.dropReason="sample_rate",l.recordDroppedEvent("sample_rate","span"))),l.emit("spanStart",a),n.endTimestamp&&(l.emit("spanEnd",a),l.emit("afterSpanEnd",a))),a}function lb(e,t){if(t)return t;if(t===null)return;let n=ir(e);if(!n)return;let r=O();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Oe(n):n}function f0(e){return e!==void 0?t=>se(e,t):t=>t()}function UV(e,t){let n=e?.getOptions().ignoreSpans;return!e||!ot(e)||!n?.length?!1:ar({description:t.name||"",op:t.attributes?.[H]||t.op,attributes:t.attributes},n)}function wr(e){return Ji(e)&&e.dropReason==="ignored"}function ml(e,t,n){let r,i,o,s=n?.maxWait?Math.max(n.maxWait,t):0,c=n?.setTimeoutImpl||setTimeout;function a(){return l(),r=e(),r}function l(){i!==void 0&&clearTimeout(i),o!==void 0&&clearTimeout(o),i=o=void 0}function p(){return i!==void 0||o!==void 0?a():r}function u(){return i&&clearTimeout(i),i=c(a,t),s&&o===void 0&&(o=c(a,s)),r}return u.cancel=l,u.flush=p,u}var Qu=new WeakSet,g0=e=>Qu.has(e),_0=e=>{Qu.add(e)},$u=new WeakMap;function pb(e){if(ul()||l0(DV),$u.has(e))return;let t=new Set,n=ml(()=>{let r=[...t];t.clear();for(let i of r)i()},1,{maxWait:100});e.on("flush",()=>{n.flush()}),$u.set(e,r=>{t.add(r),n()})}var DV={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&$u.get(n);if(!r){let i=e();i&&n?.captureEvent(i);return}r(()=>{let i=e({isSpanAlreadyCaptured:g0,onSpanCaptured:_0});i&&n.captureEvent(i)})},onChildSpanEnded(e,t,n,r){if(Qu.has(e)||!Qu.has(t))return;let i=r.getClient(),o=i&&$u.get(i),s=()=>{let c=n({isSpanAlreadyCaptured:g0,onSpanCaptured:_0});c?.contexts?.trace?.data&&(c.contexts.trace.data["sentry.parent_span_already_sent"]=!0),c&&i?.captureEvent(c)};o?o(s):s()}};var BV=["addListener","on","once","prependListener","prependOnceListener","addEventListener"],HV=["removeListener","off","removeEventListener"],h0=Symbol("SentryScopeBoundListeners"),la;function FV(e){return la!==void 0&&(e===la||e.listener===la)}function bn(e,t=ne()){let n=e;if(Ju(n))return e;ub(n);for(let r of BV)typeof n[r]=="function"&&(n[r]=VV(n,n[r],t));for(let r of HV)typeof n[r]=="function"&&(n[r]=YV(n,n[r]));return typeof n.removeAllListeners=="function"&&(n.removeAllListeners=jV(n,n.removeAllListeners)),e}function WV(e,t){return function(...n){return He(t,()=>e.apply(this,n))}}function b0(e){return typeof e=="function"}function VV(e,t,n){return function(...r){let i=r[0],o=r[1],s=r.slice(2);if(!b0(o)||FV(o))return t.apply(this,r);let c=Ju(e)||ub(e),a=c.get(i);a||(a=new WeakMap,c.set(i,a));let l=a.get(o);l||(l=WV(o,n),a.set(o,l));let p=la;la=l;try{return t.call(this,i,l,...s)}finally{la=p}}}function YV(e,t){return function(...n){let r=n[0],i=n[1],o=n.slice(2),s=b0(i)?Ju(e)?.get(r)?.get(i):void 0;return s?t.call(this,r,s,...o):t.apply(this,n)}}function jV(e,t){return function(...n){let r=Ju(e);if(r)if(n.length===0)ub(e);else{let i=n[0];r.delete(i)}return t.apply(this,n)}}function ub(e){let t=new Map;return e[h0]=t,t}function Ju(e){return e[h0]}function mb(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;ZV(e,t),r&&qV(e,r),QV(e,n),XV(e,i),KV(e,o)}function db(e,t){let{extra:n,tags:r,attributes:i,user:o,contexts:s,level:c,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:p,eventProcessors:u,attachments:d,propagationContext:m,transactionName:_,span:h}=t;fl(e,"extra",n),fl(e,"tags",r),fl(e,"attributes",i),fl(e,"user",o),fl(e,"contexts",s),e.sdkProcessingMetadata=Ki(e.sdkProcessingMetadata,a,2),c&&(e.level=c),_&&(e.transactionName=_),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),p.length&&(e.fingerprint=[...e.fingerprint,...p]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...m}}function fl(e,t,n){e[t]=Ki(e[t],n,1)}function Cn(e,t){let n=Zo().getScopeData();return e&&db(n,e.getScopeData()),t&&db(n,t.getScopeData()),n}function ZV(e,t){let{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:c}=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(o).length&&(e.contexts={...o,...e.contexts}),s&&(e.level=s),c&&e.type!=="transaction"&&(e.transaction=c)}function XV(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function KV(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function qV(e,t){e.contexts={trace:kr(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:it(t),...e.sdkProcessingMetadata};let n=Oe(t),r=oe(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function QV(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 y0(e){let t={},{response:n,profile:r,cloud_resource:i,culture:o,state:s}=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[l,p]of Object.entries(i))p!=null&&(t[l]=p);o&&(o.locale&&(t["culture.locale"]=o.locale),o.timezone&&(t["culture.timezone"]=o.timezone)),s?.state&&typeof s.state.type=="string"&&(t["state.type"]=s.state.type);let c=e.angular;if(c){let l=c.version;(typeof l=="string"||typeof l=="number")&&(t["angular.version"]=l)}let a=e.react;if(a){let l=a.version;(typeof l=="string"||typeof l=="number")&&(t["react.version"]=l)}return t}var S0="aws.dynamodb.attribute_definitions",E0="aws.dynamodb.consistent_read",T0="aws.dynamodb.consumed_capacity",I0="aws.dynamodb.count",A0="aws.dynamodb.exclusive_start_table",N0="aws.dynamodb.global_secondary_indexes",R0="aws.dynamodb.global_secondary_index_updates",fb="aws.dynamodb.index_name",v0="aws.dynamodb.item_collection_metrics",O0="aws.dynamodb.limit",C0="aws.dynamodb.local_secondary_indexes",x0="aws.dynamodb.projection",P0="aws.dynamodb.provisioned_read_capacity",k0="aws.dynamodb.provisioned_write_capacity",L0="aws.dynamodb.scanned_count",M0="aws.dynamodb.scan_forward",w0="aws.dynamodb.segment",gb="aws.dynamodb.select",G0="aws.dynamodb.table_count",_b="aws.dynamodb.table_names",U0="aws.dynamodb.total_segments";var D0="aws.kinesis.stream.name";var B0="aws.request.extended_id";var H0="aws.request.id",F0="aws.s3.bucket",hb="aws.secretsmanager.secret.arn",bb="aws.sns.topic.arn",W0="aws.step_functions.activity.arn",V0="aws.step_functions.state_machine.arn";var pa="cache.key";var zu="cloud.region";var ed="code.function.name";var ua="db.collection.name";var Et="db.name",Ii="db.namespace",da="db.operation",ma="db.operation.batch.size",pr="db.operation.name";var Gr="db.query.text";var Ye="db.statement";var ke="db.system",dt="db.system.name",Ut="db.user";var Ur="error.type";var Y0="faas.execution";var j0="faas.invoked_name",Z0="faas.invoked_provider",X0="faas.invoked_region",K0="faas.name";var td="faas.trigger";var q0="gen_ai.embeddings.input",Q0="gen_ai.function_id",$0="gen_ai.input.messages",nd="gen_ai.operation.name";var yb="gen_ai.output.messages";var J0="gen_ai.request.available_tools";var Ai="gen_ai.request.max_tokens";var gl="gen_ai.request.model";var eo="gen_ai.request.stop_sequences",Ni="gen_ai.request.temperature";var Ri="gen_ai.request.top_p",Ot="gen_ai.response.finish_reasons",z0="gen_ai.response.id",eO="gen_ai.response.model",tO="gen_ai.response.streaming";var _l="gen_ai.system";var nO="gen_ai.tool.input";var rO="gen_ai.tool.name",iO="gen_ai.tool.output",oO="gen_ai.tool.type",Dr="gen_ai.usage.cache_creation.input_tokens",Br="gen_ai.usage.cache_read.input_tokens";var en="gen_ai.usage.input_tokens";var Tt="gen_ai.usage.output_tokens";var rd="gen_ai.usage.reasoning.output_tokens",Sb="gen_ai.usage.total_tokens",fa="graphql.document",id="graphql.operation.name",od="graphql.operation.type";var sO="http.client_ip";var aO="http.flavor";var cO="http.host",Hr="http.method";var Fr="http.request.method";var yn="http.response.status_code";var Fe="http.route",lO="http.scheme";var vi="http.status_code",sd="http.target",Oi="http.url",pO="http.user_agent";var ad="koa.name",Eb="koa.type";var ga="messaging.batch.message_count",uO="messaging.destination";var xn="messaging.destination.name";var _a="messaging.message.id";var ha="messaging.operation.name",ur="messaging.operation.type";var Dt="messaging.system";var dO="network.peer.address",mO="network.peer.port",Tb="network.protocol.name",fO="network.protocol.version";var gO="net.host.ip",_O="net.host.name",hO="net.host.port",bO="net.peer.ip",Me="net.peer.name",Pe="net.peer.port";var ba="net.transport";var yO="rpc.grpc.status_code",SO="rpc.method";var cd="rpc.service",EO="rpc.system";var Ib="sentry.graphql.operation";var TO="sentry.http.prefetch";var IO="sentry.origin";var AO="sentry.sdk.name",NO="sentry.sdk.version",RO="sentry.segment.id";var vO="sentry.segment.name";var OO="sentry.trace_lifecycle";var _t="server.address";var ht="server.port",Ab="service.name",CO="service.version";var pt="url.full",to="url.path";var ld="url.query";var xO="url.scheme";var PO="user_agent.original";function Nb(e,t){let n=Yu(e),r=ia(e),i=Yu(r),{isolationScope:o,scope:s}=$t(e),c=Cn(o,s);zV(n,i,t,c);let a=e.kind;t.emit("preprocessSpan",n,{spanKind:a}),n.is_segment&&($V(n,c),JV(n,t),t.emit("processSegmentSpan",n)),t.emit("processSpan",n);let{beforeSendSpan:l}=t.getOptions(),p=l&&Ti(l)?eY(n,l):n,u=p.attributes?.[ve];return n.is_segment&&u&&Bt(p,{"sentry.segment.name.source":u}),{...ju(p),_segmentSpan:r}}function $V(e,t){let n=y0(t.contexts);Bt(e,n)}function Bt(e,t){let n=e.attributes??(e.attributes={});Object.entries(t).forEach(([r,i])=>{i!=null&&!(r in n)&&(n[r]=i)})}function JV(e,t){let n=t.getIntegrationNames();n.length&&Bt(e,{[Lh]:n})}function zV(e,t,n,r){let i=n.getSdkMetadata(),{release:o,environment:s}=n.getOptions();Bt(e,{[OO]:"stream",[vO]:t.name,[RO]:t.span_id,[AO]:i?.sdk?.name,[NO]:i?.sdk?.version,[Ph]:o,[kh]:s||zi,[Mh]:r.user?.id,[wh]:r.user?.email,[Jc]:r.user?.ip_address,[Gh]:r.user?.username,...r.attributes})}function eY(e,t){let n=t(e);return n||($o(),e)}var Rb=0,kO=1,LO=2;function Ci(e){return new pd(t=>{t(e)})}function ya(e){return new pd((t,n)=>{n(e)})}var pd=class e{constructor(t){this._state=Rb,this._handlers=[],this._runExecutor(t)}then(t,n){return new e((r,i)=>{this._handlers.push([!1,o=>{if(!t)r(o);else try{r(t(o))}catch(s){i(s)}},o=>{if(!n)i(o);else try{r(n(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new e((n,r)=>{let i,o;return this.then(s=>{o=!1,i=s,t&&t()},s=>{o=!0,i=s,t&&t()}).then(()=>{if(o){r(i);return}n(i)})})}_executeHandlers(){if(this._state===Rb)return;let t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===kO&&n[1](this._value),this._state===LO&&n[2](this._value),n[0]=!0)})}_runExecutor(t){let n=(o,s)=>{if(this._state===Rb){if(bt(s)){s.then(r,i);return}this._state=o,this._value=s,this._executeHandlers()}},r=o=>{n(kO,o)},i=o=>{n(LO,o)};try{t(r,i)}catch(o){i(o)}}};function MO(e,t,n,r=0){try{let i=vb(t,n,e,r);return bt(i)?i:Ci(i)}catch(i){return ya(i)}}function vb(e,t,n,r){let i=n[r];if(!e||!i)return e;let o=i({...e},t);return E&&o===null&&g.log(`Event processor "${i.id||"?"}" dropped event`),bt(o)?o.then(s=>vb(s,t,n,r+1)):vb(o,t,n,r+1)}var es,wO,GO,no;function hl(e){let t=te._sentryDebugIds,n=te._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(no&&r.length===wO&&i.length===GO)return no;wO=r.length,GO=i.length,no={},es||(es={});let o=(s,c)=>{for(let a of s){let l=c[a],p=es?.[a];if(p&&no&&l)no[p[0]]=l,es&&(es[a]=[p[0],l]);else if(l){let u=e(a);for(let d=u.length-1;d>=0;d--){let _=u[d]?.filename;if(_&&no&&es){no[_]=l,es[a]=[_,l];break}}}}};return t&&o(r,t),n&&o(i,n),no}function bl(e){return e.data?.__sentry__===!0}function ud(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 UO(e,t,n,r,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:c=1e3}=e,a={...t,event_id:t.event_id||n.event_id||ut(),timestamp:t.timestamp||Cr()},l=n.integrations||e.integrations.map(b=>b.name);tY(a,e),iY(a,l),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&nY(a,e.stackParser);let p=sY(r,n.captureContext);n.mechanism&&Hn(a,n.mechanism);let u=i?i.getEventProcessors():[],d=Cn(o,p),m=[...n.attachments||[],...d.attachments];m.length&&(n.attachments=m),mb(a,d);let _=[...u,...d.eventProcessors];return(bl(n)?Ci(a):MO(_,a,n)).then(b=>(b&&rY(b),typeof s=="number"&&s>0?oY(b,s,c):b))}function tY(e,t){let{environment:n,release:r,dist:i,maxValueLength:o}=t;e.environment=e.environment||n||zi,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let s=e.request;s?.url&&o&&(s.url=gn(s.url,o)),o&&e.exception?.values?.forEach(c=>{c.value&&(c.value=gn(c.value,o))})}function nY(e,t){let n=hl(t);e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=n[i.filename])})})}function rY(e){let t={};if(e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.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(([r,i])=>{n.push({type:"sourcemap",code_file:r,debug_id:i})})}function iY(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function oY(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:qe(i.data,t,n)}}))},...e.user&&{user:qe(e.user,t,n)},...e.contexts&&{contexts:qe(e.contexts,t,n)},...e.extra&&{extra:qe(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=qe(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(i=>({...i,...i.data&&{data:qe(i.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=qe(e.contexts.flags,3,n)),r}function sY(e,t){if(!t)return e;let n=e?e.clone():new Qt;return n.update(t),n}function DO(e){if(e)return aY(e)?{captureContext:e}:lY(e)?{captureContext:e}:e}function aY(e){return e instanceof Qt||typeof e=="function"}var cY=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function lY(e){return Object.keys(e).some(t=>cY.includes(t))}function ge(e,t){return ne().captureException(e,DO(t))}function yl(e,t){let n=typeof t=="string"?t:void 0,r=typeof t!="string"?{captureContext:t}:void 0;return ne().captureMessage(e,n,r)}function Sl(e,t){return ne().captureEvent(e,t)}function Ob(e,t){$().setContext(e,t)}function Cb(e){$().setExtras(e)}function xb(e,t){$().setExtra(e,t)}function Pb(e){$().setTags(e)}function kb(e,t){$().setTag(e,t)}function Lb(e){$().setAttributes(e)}function Mb(e,t){$().setAttribute(e,t)}function wb(e){$().setUser(e)}function BO(e){$().setConversationId(e)}function Gb(){return $().lastEventId()}async function ts(e){let t=O();return t?t.flush(e):(E&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function Ub(e){let t=O();return t?t.close(e):(E&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function Db(){return!!O()}function ns(){let e=O();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Bb(e){$().addEventProcessor(e)}function El(e){let t=$(),{user:n}=Cn(t,ne()),{userAgent:r}=te.navigator||{},i=xv({user:n,...r&&{userAgent:r},...e}),o=t.getSession();return o?.status==="ok"&&bi(o,{status:"exited"}),rs(),t.setSession(i),i}function rs(){let e=$(),n=ne().getSession()||e.getSession();n&&Pv(n),HO(),e.setSession()}function HO(){let e=$(),t=O(),n=e.getSession();n&&t&&t.captureSession(n)}function Hb(e=!1){if(e){rs();return}HO()}function Wr(e,t,n){function r(){let o=Tl({monitorSlug:e,status:"in_progress"},n),s=lt();function c(l){Tl({monitorSlug:e,status:l,checkInId:o,duration:lt()-s})}let a;try{a=t()}catch(l){throw c("error"),l}return bt(a)?a.then(l=>(c("ok"),l),l=>{throw c("error"),l}):(c("ok"),a)}let i={...ne().getPropagationContext()};return or(()=>{if(n?.isolateTrace)return On(r);let o=ne();return zc(o.getPropagationContext())||o.setPropagationContext(i),r()})}function Tl(e,t){let n=ne(),r=O();if(!r)E&&g.warn("Cannot capture check-in. No client defined.");else if(!r.captureCheckIn)E&&g.warn("Cannot capture check-in. Client does not support sending check-ins.");else return r.captureCheckIn(e,t,n);return ut()}function Pn(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}function me(e,t=1){if(St(Je()).getTracingChannelBinding?.()){e();return}t&&Pn(setTimeout(()=>{me(e,t-1)},1))}var pY="7";function uY(e){let t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function dY(e){return`${uY(e)}${e.projectId}/envelope/`}function mY(e,t){let n={sentry_version:pY};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function FO(e,t,n){return t||`${dY(e)}?${mY(e,n)}`}var Fb=[];function fY(e){let t={};return e.forEach(n=>{let{name:r}=n,i=t[r];i&&!i.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function Wb(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(i=>{i.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){let i=n(t);r=Array.isArray(i)?i:[i]}else r=t;return fY(r)}function WO(e,t){let n={};return t.forEach(r=>{r?.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&Yb(e,r,n)}),n}function Vb(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Yb(e,t,n){if(n[t.name]){E&&g.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Fb.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),Fb.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){let r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(i,o)=>r(i,o,e))}if(typeof t.processEvent=="function"){let r=t.processEvent.bind(t),i=Object.assign((o,s)=>r(o,s,e),{id:t.name});e.addEventProcessor(i)}["processSpan","processSegmentSpan"].forEach(r=>{let i=t[r];typeof i=="function"&&e.on(r,o=>i.call(t,o,e))}),E&&g.log(`Integration installed: ${t.name}`)}function jb(e){let t=O();if(!t){E&&g.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}function Ht(e,t){let n={...e,...t};for(let r in t){let i=e[r],o=t[r];if(typeof i=="function"&&typeof o=="function"){let s=new Proxy(i,{apply:(c,a,l)=>(Reflect.apply(c,a,l),Reflect.apply(o,a,l))});n[r]=s}}return n}var gY="sentry.timestamp.sequence",Zb=0,Xb;function dd(e){let t=Math.floor(e*1e3);Xb!==void 0&&t!==Xb&&(Zb=0);let n=Zb;return Zb++,Xb=t,{key:gY,value:{value:n,type:"integer"}}}function Sa(e,t){return t?He(t,()=>{let n=Q(),r=n?kr(n):Xo(t);return[n?it(n):cr(e,t),r]}):[void 0,void 0]}var VO={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function YO(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function jO(){return!YO()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function It(){return typeof window<"u"&&(!jO()||_Y())}function _Y(){return te.process?.type==="renderer"}function hY(e,t){let n=t?"auto":"never";return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...It()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function ZO(e,t,n,r,i){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=sn(r)),Gt(o,[hY(e,i)])}var bY=100;function Vr(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function XO(e,t){let n=qb(),r=KO(e);r===void 0?n.set(e,[t]):r.length>=bY?(Ea(e,r),n.set(e,[t])):n.set(e,[...r,t])}function dr(e,t=ne(),n=XO){let r=t?.getClient()??O();if(!r){E&&g.warn("No client available to capture log.");return}let{release:i,environment:o,enableLogs:s=!0,beforeSendLog:c}=r.getOptions();if(!s){E&&g.warn("logging option not enabled, log will not be captured.");return}let[,a]=Sa(r,t),l={...e.attributes},{user:{id:p,email:u,username:d},attributes:m={}}=Cn($(),t);Vr(l,"user.id",p,!1),Vr(l,"user.email",u,!1),Vr(l,"user.name",d,!1),Vr(l,"sentry.release",i),Vr(l,"sentry.environment",o);let{name:_,version:h}=r.getSdkMetadata()?.sdk??{};Vr(l,"sentry.sdk.name",_),Vr(l,"sentry.sdk.version",h);let b=r.getIntegrationByName("Replay"),v=b?.getReplayId(!0);Vr(l,"sentry.replay_id",v),v&&b?.getRecordingMode()==="buffer"&&Vr(l,"sentry._internal.replay_is_buffering",!0);let M=e.message;if(Zi(M)){let{__sentry_template_string__:Ne,__sentry_template_values__:Te=[]}=M;Te?.length&&(l["sentry.message.template"]=Ne),Te.forEach((Ce,Qe)=>{l[`sentry.message.parameter.${Qe}`]=Ce})}let N=ir(t);Vr(l,"sentry.trace.parent_span_id",N?.spanContext().spanId);let R={...e,attributes:l};r.emit("beforeCaptureLog",R);let P=c?we(()=>c(R)):R;if(!P){r.recordDroppedEvent("before_send","log_item",1),E&&g.warn("beforeSendLog returned null, log will not be captured.");return}let{level:Y,message:T,attributes:G={},severityNumber:k}=P,U=lt(),ae=dd(U),ue={timestamp:U,level:Y,body:Kb(String(T)),trace_id:a?.trace_id,severity_number:k??VO[Y],attributes:yY({...yi(m),...yi(G,!0),[ae.key]:ae.value})};n(r,ue),r.emit("afterCaptureLog",P)}function Ea(e,t){let n=t??KO(e)??[];if(n.length===0)return;let r=e.getOptions(),i=ZO(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);qb().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function KO(e){return qb().get(e)}function qb(){return Bn("clientToLogBufferMap",()=>new WeakMap)}function yY(e){let t={};for(let[n,r]of Object.entries(e)){let i=Kb(n);r.type==="string"?t[i]={...r,value:Kb(r.value)}:t[i]=r}return t}function Kb(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 SY(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,...It()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function qO(e,t,n,r,i){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=sn(r)),Gt(o,[SY(e,i)])}var EY=1e3;function xi(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function QO(e,t){let n=$b(),r=$O(e);r===void 0?n.set(e,[t]):r.length>=EY?(Ta(e,r),n.set(e,[t])):n.set(e,[...r,t])}function TY(e,t,n){let{release:r,environment:i}=t.getOptions(),o={...e.attributes};xi(o,"user.id",n.id,!1),xi(o,"user.email",n.email,!1),xi(o,"user.name",n.username,!1),xi(o,"sentry.release",r),xi(o,"sentry.environment",i);let{name:s,version:c}=t.getSdkMetadata()?.sdk??{};xi(o,"sentry.sdk.name",s),xi(o,"sentry.sdk.version",c);let a=t.getIntegrationByName("Replay"),l=a?.getReplayId(!0);return xi(o,"sentry.replay_id",l),l&&a?.getRecordingMode()==="buffer"&&xi(o,"sentry._internal.replay_is_buffering",!0),{...e,attributes:o}}function IY(e,t,n,r){let[,i]=Sa(t,n),o=ir(n),s=o?o.spanContext().traceId:i?.trace_id,c=o?o.spanContext().spanId:void 0,a=lt(),l=dd(a);return{timestamp:a,trace_id:s??"",span_id:c,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...yi(r),...yi(e.attributes,"skip-undefined"),[l.key]:l.value}}}function Qb(e,t){let n=t?.scope??ne(),r=t?.captureSerializedMetric??QO,i=n?.getClient()??O();if(!i){E&&g.warn("No client available to capture metric.");return}let{_experiments:o,enableMetrics:s,beforeSendMetric:c}=i.getOptions();if(!(s??o?.enableMetrics??!0)){E&&g.warn("metrics option not enabled, metric will not be captured.");return}let{user:l,attributes:p}=Cn($(),n),u=TY(e,i,l);i.emit("processMetric",u);let d=c||o?.beforeSendMetric,m=d?d(u):u;if(!m){E&&g.log("`beforeSendMetric` returned `null`, will not send metric.");return}let _=IY(m,i,n,p);E&&g.log("[Metric]",_),r(i,_),i.emit("afterCaptureMetric",m)}function Ta(e,t){let n=t??$O(e)??[];if(n.length===0)return;let r=e.getOptions(),i=qO(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);$b().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function $O(e){return $b().get(e)}function $b(){return Bn("clientToMetricBufferMap",()=>new WeakMap)}function JO(e){let t={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};return ju(t)}function zO(e,t){if(e.type!=="transaction"||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||ot(t))return;let n=[],r=[];for(let o of e.spans)o.op?.startsWith("gen_ai.")?n.push(JO(o)):r.push(o);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,...It()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var Il=Symbol.for("SentryBufferFullError");function Ia(e=100){let t=new Set;function n(){return t.size<e}function r(s){t.delete(s)}function i(s){if(!n())return ya(Il);let c=s();return t.add(c),c.then(()=>r(c),()=>r(c)),c}function o(s){if(!t.size)return Ci(!0);let c=Promise.allSettled(Array.from(t)).then(()=>!0);if(!s)return c;let a=[c,new Promise(l=>Pn(setTimeout(()=>l(!1),s)))];return Promise.race(a)}return{get $(){return Array.from(t)},add:i,drain:o}}var AY=60*1e3;function NY(e,t=rt()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?AY:r-t}function RY(e,t){return e[t]||e.all||0}function eC(e,t,n=rt()){return RY(e,t)>n}function tC(e,{statusCode:t,headers:n},r=rt()){let i={...e},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(let c of o.trim().split(",")){let[a,l,,,p]=c.split(":",5),u=parseInt(a,10),d=(isNaN(u)?60:u)*1e3;if(!l)i.all=r+d;else for(let m of l.split(";"))m==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(i[m]=r+d):i[m]=r+d}else s?i.all=r+NY(s,r):t===429&&(i.all=r+60*1e3);return i}var Al=64;function Aa(e,t,n=Ia(e.bufferSize||Al)){let r={},i=s=>n.drain(s);function o(s){let c=[];if(al(s,(u,d)=>{let m=Ku(d);eC(r,m)?e.recordDroppedEvent("ratelimit_backoff",m):c.push(u)}),c.length===0)return Promise.resolve({});let a=Gt(s[0],c),l=u=>{if(tb(a,["client_report"])){E&&g.warn(`Dropping client report. Will not send outcomes (reason: ${u}).`);return}al(a,(d,m)=>{e.recordDroppedEvent(u,Ku(m))})},p=()=>t({body:cl(a)}).then(u=>u.statusCode===413?(E&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),u):(E&&u.statusCode!==void 0&&(u.statusCode<200||u.statusCode>=300)&&g.warn(`Sentry responded with status code ${u.statusCode} to sent event.`),r=tC(r,u),u),u=>{throw l("network_error"),E&&g.error("Encountered error running transport request:",u),u});return n.add(p).then(u=>u,u=>{if(u===Il)return E&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw u})}return{send:o,flush:i}}function nC(e,t,n){let r=[{type:"client_report"},{timestamp:n||Cr(),discarded_events:e}];return Gt(t?{dsn:t}:{},[r])}function rC(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:c}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:c,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:s?.[Js],exclusive_time:s?.[zs],measurements:e.measurements,is_segment:!0}}function iC(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&&{[Js]:e.profile_id},...e.exclusive_time&&{[zs]:e.exclusive_time}}}},measurements:e.measurements}}var Na="[Filtered]",Nl=["forwarded","-ip","remote-","via","-user"],Jb=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","sid","identity","set-cookie","cookie"],oC=[".sid","sessid","remember","oidc","pkce","nonce","__secure-","__host-","awsalb","awselb","akamai","__stripe","cognito","firebase","supabase","sb-","mfa","2fa"];function md(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:Nl},httpHeaders:{request:{deny:Nl},response:{deny:Nl}},httpBodies:[],urlQueryParams:{deny:Nl},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var vY={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 OY(e){return typeof e=="boolean"||"allow"in e||"deny"in e}function CY(e,t){return e===void 0?{...t.httpHeaders}:OY(e)?{request:e,response:e}:{request:e.request??t.httpHeaders.request,response:e.response??t.httpHeaders.response}}function sC(e){let t=e.dataCollection!=null?vY:md(e.sendDefaultPii),n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:CY(n.httpHeaders,t),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 aC="Not capturing exception because it's already been captured.",cC="Discarded session because of missing or non-string release",gC=Symbol.for("SentryInternalError"),_C=Symbol.for("SentryDoNotSendEventError"),xY=5e3;function fd(e){return{message:e,[gC]:!0}}function zb(e){return{message:e,[_C]:!0}}function lC(e){return zb(`Discarding event because it's not included in the random sample (sampling rate = ${e})`)}function pC(e){return B(e)&&gC in e}function uC(e){return B(e)&&_C in e}function dC(e,t,n,r,i){let o=0,s,c=!1;e.on(n,()=>{o=0,clearTimeout(s),c=!1}),e.on(t,a=>{if(o+=r(a),o>=8e5)i(e);else if(!c){let l=e.getOptions()._flushInterval??xY;l>0&&(c=!0,s=Pn(setTimeout(()=>{i(e)},l)))}}),e.on("flush",()=>{i(e)})}var gd=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Ia(t.transportOptions?.bufferSize??Al),this._dataCollection=sC(t),t.dsn?this._dsn=Xv(t.dsn):E&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=FO(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs??!0,this._options.enableLogs&&dC(this,"afterCaptureLog","flushLogs",MY,Ea),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&dC(this,"afterCaptureMetric","flushMetrics",LY,Ta)}captureException(t,n,r){let i=ut();if(Gu(t))return E&&g.log(aC),i;let o={event_id:i,...n};return this._process(()=>this.eventFromException(t,o).then(s=>this._captureEvent(s,o,r)).then(s=>s),"error"),o.event_id}captureMessage(t,n,r,i){let o={event_id:ut(),...r},s=Zi(t)?t:String(t),c=rr(t),a=c?this.eventFromMessage(s,n,o):this.eventFromException(t,o);return this._process(()=>a.then(l=>this._captureEvent(l,o,i)),c?"unknown":"error"),o.event_id}captureEvent(t,n,r){let i=ut();if(n?.originalException&&Gu(n.originalException))return E&&g.log(aC),i;let o={event_id:i,...n},s=t.sdkProcessingMetadata||{},c=s.capturedSpanScope,a=s.capturedSpanIsolationScope,l=mC(t.type);return this._process(()=>this._captureEvent(t,o,c||r,a),l),o.event_id}captureSession(t){this.sendSession(t),bi(t,{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(t){let n=this._transport;if(this.emit("flush"),!n)return!0;let r=await this._isClientDoneProcessing(t),i=await n.flush(t);return r&&i}async close(t){let n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(t){let n=this._integrations[t.name];!n&&t.beforeSetup&&t.beforeSetup(this),Yb(this,t,this._integrations),n||Vb(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let r=zO(t,this),i=a0(t,this._dsn,this._options._metadata,this._options.tunnel);if(!bl(n))for(let o of n.attachments||[])i=Xu(i,rb(o));r&&(i=Xu(i,r)),this.sendEnvelope(i).then(o=>this.emit("afterSendEvent",t,o))}sendSession(t){let{release:n,environment:r=zi}=this._options;if("aggregates"in t){let o=t.attrs||{};if(!o.release&&!n){E&&g.warn(cC);return}o.release=o.release||n,o.environment=o.environment||r,t.attrs=o}else{if(!t.release&&!n){E&&g.warn(cC);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);let i=s0(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){let i=`${t}:${n}`;E&&g.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(t,n){let r=this._hooks[t]=this._hooks[t]||new Set,i=(...o)=>n(...o);return r.add(i),()=>{r.delete(i)}}emit(t,...n){let r=this._hooks[t];r&&r.forEach(i=>i(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return E&&g.error("Error while sending envelope:",n),{}}return E&&g.error("Transport disabled"),{}}registerCleanup(t){}dispose(){}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=WO(this,t),Vb(this,t)}_updateSessionFromEvent(t,n){let r=n.level==="fatal",i=!1,o=n.exception?.values;if(o){i=!0,r=!1;for(let a of o)if(a.mechanism?.handled===!1){r=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(bi(t,{...r&&{status:"crashed"},errors:t.errors||Number(i||r)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,r,i){let o=this.getOptions(),s=this.getIntegrationNames();return!n.integrations&&s.length&&(n.integrations=s),this.emit("preprocessEvent",t,n),t.type||i.setLastEventId(t.event_id||n.event_id),UO(o,t,n,r,this,i).then(c=>{if(c===null)return c;this.emit("postprocessEvent",c,n),c.contexts={trace:{...c.contexts?.trace,...Xo(r)},...c.contexts};let a=cr(this,r);return c.sdkProcessingMetadata={dynamicSamplingContext:a,...c.sdkProcessingMetadata},c})}_captureEvent(t,n={},r=ne(),i=$()){return E&&ey(t)&&g.log(`Captured error event \`${ud(t)[0]||"<unknown>"}\``),this._processEvent(t,n,r,i).then(o=>o.event_id,o=>{E&&(uC(o)?g.log(o.message):pC(o)?g.warn(o.message):g.warn(o))})}_processEvent(t,n,r,i){let o=this.getOptions(),{sampleRate:s}=o,c=hC(t),a=ey(t),p=`before send for type \`${t.type||"error"}\``,u=typeof s>"u"?void 0:Nn(s),d=a&&typeof u=="number"&&ct()>u,m=mC(t.type),_=r.getSession()||i.getSession();return d&&_?.status!=="ok"?(this.recordDroppedEvent("sample_rate","error"),ya(lC(s))):this._prepareEvent(t,n,r,i).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",m),zb("An event processor returned `null`, will not send event.");if(bl(n))return h;let b=kY(this,o,h,n);return PY(b,p)}).then(h=>{if(h===null){if(this.recordDroppedEvent("before_send",m),c){let M=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",M)}throw zb(`${p} returned \`null\`, will not send event.`)}if(a&&_&&this._updateSessionFromEvent(_,h),d)throw this.recordDroppedEvent("sample_rate","error"),lC(s);if(c){let v=h.sdkProcessingMetadata?.spanCountBeforeProcessing||0,M=h.spans?h.spans.length:0,N=v-M;N>0&&this.recordDroppedEvent("before_send","span",N)}let b=h.transaction_info;if(c&&b&&h.transaction!==t.transaction){let v="custom";h.transaction_info={...b,source:v}}return this.sendEvent(h,n),h}).then(null,h=>{throw uC(h)||pC(h)?h:(this.captureException(h,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:h}),fd(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
13
|
+
Reason: ${h}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===Il&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{let[i,o]=n.split(":");return{reason:i,category:o,quantity:r}})}_flushOutcomes(){E&&g.log("Flushing outcomes...");let t=this._clearOutcomes();if(t.length===0){E&&g.log("No outcomes to send");return}if(!this._dsn){E&&g.log("No dsn provided, will not send outcomes");return}E&&g.log("Sending outcomes:",t);let n=nC(t,this._options.tunnel&&sn(this._dsn));this.sendEnvelope(n)}};function mC(e){return e==="replay_event"?"replay":e||"error"}function PY(e,t){let n=`${t} must return \`null\` or a valid event.`;if(bt(e))return e.then(r=>{if(!Kt(r)&&r!==null)throw fd(n);return r},r=>{throw fd(`${t} rejected with ${r}`)});if(!Kt(e)&&e!==null)throw fd(n);return e}function kY(e,t,n,r){let{beforeSend:i,beforeSendTransaction:o,ignoreSpans:s}=t,c=!Ti(t.beforeSendSpan)&&t.beforeSendSpan,a=n;if(ey(a)&&i)return i(a,r);if(hC(a)){if(c||s){let l=rC(a);if(s?.length&&ar({description:l.description,op:l.op,attributes:l.data},s))return null;if(c){let p=c(l);p?a=Ki(n,iC(p)):$o()}if(a.spans){let p=[],u=a.spans;for(let m of u){if(s?.length&&ar({description:m.description,op:m.op,attributes:m.data},s)){n0(u,m);continue}if(c){let _=c(m);_?p.push(_):($o(),p.push(m))}else p.push(m)}let d=a.spans.length-p.length;d&&e.recordDroppedEvent("before_send","span",d),a.spans=p}}if(o){if(a.spans){let l=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return o(a,r)}}return a}function ey(e){return e.type===void 0}function hC(e){return e.type==="transaction"}function LY(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+bC(e.attributes)}function MY(e){let t=0;return e.message&&(t+=e.message.length*2),t+bC(e.attributes)}function bC(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*fC(n[0]):rr(n)?t+=fC(n):t+=100}),t}function fC(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function ty(e){ne().setClient(e)}var ny=new Set;function Pi(e){e.forEach(t=>{ny.add(t),E&&g.log(`AI provider "${t}" wrapping will be skipped`)})}function kn(e){return ny.has(e)}function ry(){ny.clear(),E&&g.log("Cleared AI provider skip registrations")}function wY(e,t){return t.some(n=>e.includes(n))}function iy(e,t,n){if(t===!1)return!0;let r=e.toLowerCase(),i=n!=null?[...Jb,...n]:Jb;if(wY(r,i))return!0;if(t===!0)return!1;let s=("deny"in t?t.deny:t.allow).some(c=>r.includes(c.toLowerCase()));return"deny"in t?s:!s}function Ra(e,t,n){if(t===!1)return{};let r={};for(let i of Object.keys(e))r[i]=iy(i,t,n)?Na:e[i];return r}function yC(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 o=e.slice(n,r).trim();if(t[o]===void 0){let s=e.slice(r+1,i).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));try{t[o]=s.indexOf("%")!==-1?decodeURIComponent(s):s}catch{t[o]=s}}n=i+1}return t}function va(e,t){if(!(!e||t===!1))return e.split("&").map(n=>{let r=n.indexOf("="),i=r===-1?n:n.slice(0,r),o=new URLSearchParams(`${i}=`).keys().next().value;return o!==void 0&&iy(o,t)?`${i}=${Na}`:n}).join("&")}function Rl(e,t){let n=e.indexOf("#"),r=n===-1?e.length:n,i=e.indexOf("?");if(i===-1||i>r)return e;let o=e.slice(0,i),s=e.slice(i+1,r),c=e.slice(r),a=va(s,t);return a?`${o}?${a}${c}`:`${o}${c}`}function SC(e){return(e??O())?.getDataCollectionOptions().urlQueryParams??!0}function Ct(e,t){return e===void 0?void 0:Rl(e,SC(t))}function Yn(e,t){if(!e)return e;let n=e.startsWith("?"),r=va(n?e.slice(1):e,SC(t));return r&&n?`?${r}`:r}var GY=new Set(["false","f","n","no","off","0"]),UY=new Set(["true","t","y","yes","on","1"]);function is(e,t){let n=String(e).toLowerCase();return GY.has(n)?!1:UY.has(n)?!0:t?.strict?null:!!e}function EC(e,t,n,r,i){let o={sent_at:new Date(rt()).toISOString()};n?.sdk&&(o.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(o.dsn=sn(i)),t&&(o.trace=t);let s=DY(e);return Gt(o,[s])}function DY(e){return[{type:"check_in"},e]}var BY="thismessage:/";function mr(e){return"isRelative"in e}function fr(e,t){let n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=t??(n?BY:void 0);try{if("canParse"in URL&&!URL.canParse(e,r))return;let i=new URL(e,r);return n?{isRelative:n,pathname:i.pathname,search:i.search,hash:i.hash}:i}catch{}}function TC(e){if(mr(e))return e.pathname;let t=new URL(e);return t.search="",t.hash="",["80","443"].includes(t.port)&&(t.port=""),t.password&&(t.password="%filtered%"),t.username&&(t.username="%filtered%"),t.toString()}function HY(e,t,n,r){let i=n?.method?.toUpperCase()??"GET",o=r||(e?t==="client"?TC(e):e.pathname:"/");return`${i} ${o}`}function oy(e,t,n,r,i,o){let s={[S]:n,[ve]:"url"};return i&&(s[t==="server"?"http.route":"url.template"]=i,s[ve]="route"),r?.method&&(s[Hh]=r.method.toUpperCase()),e&&(e.search&&(s["url.query"]=Yn(e.search,o)),e.hash&&(s["url.fragment"]=e.hash),e.pathname&&(s["url.path"]=e.pathname,e.pathname==="/"&&(s[ve]="route")),mr(e)||(s[pt]=Ct(e.href,o),e.port&&(s["url.port"]=e.port),e.protocol&&(s["url.scheme"]=e.protocol),e.hostname&&(s[t==="server"?"server.address":"url.domain"]=e.hostname))),[HY(e,t,r,i),s]}function ro(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 Ln(e){return e.split(/[?#]/,1)[0]}function io(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${t?`${t}://`:""}${i}${r}`}function vl(e,t=!0){if(e.startsWith("data:")){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=e.includes(";base64,"),o=e.indexOf(","),s="";if(t&&o!==-1){let c=e.slice(o+1);s=c.length>10?`${c.slice(0,10)}... [truncated]`:c}return`data:${r}${i?",base64":""}${s?`,${s}`:""}`}return e}function sy(e,t){let n=t?.getDsn(),r=t?.getOptions().tunnel;return WY(e,n)||FY(e,r)}function FY(e,t){return t?IC(e)===IC(t):!1}function WY(e,t){let n=fr(e);return!n||mr(n)||!t?!1:VY(n.hostname,t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function VY(e,t){return e===t||t.length>0&&e.endsWith(`.${t}`)}function IC(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function _d(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 ay=_d;function os(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(o=>({name:`${r}:@sentry/${o}`,version:q})),i.version=q)}function tt(e={}){let t=e.client||O();if(!ns()||!t)return{};let n=Je(),r=St(n);if(r.getTraceData)return r.getTraceData(e);let i=e.scope||ne(),o=e.span||Q(),s=Ji(o)&&!De(t.getOptions());if(!o&&Oh())return{};let c=o&&!s?il(o):YY(i),a=o?it(o):cr(t,i),l=qi(a);if(!Wu.test(c))return g.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let u={"sentry-trace":c,baggage:l};return e.propagateTraceparent&&(u.traceparent=o&&!s?Jv(o):jY(i)),u}function YY(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Qi(t,r,n)}function jY(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return $i(t,r,n)}var AC="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function ss(e,t,n){if(typeof e!="string"||!t)return!0;let r=n?.get(e);if(r!==void 0)return E&&!r&&g.log(AC,e),r;let i=_n(e,t);return n?.set(e,i),E&&!i&&g.log(AC,e),i}function cy(e){return Object.entries(e||tt()).map(([t,n])=>`<meta name="${t}" content="${n}"/>`).join("")}function Ol(e){return Array.from(new Set(e))}var NC=1024*1024;function ly(e){return e==="small"?1e3:e==="medium"?1e4:NC}function RC(e){let t={};try{e.forEach((n,r)=>{typeof n=="string"&&(t[r]=n)})}catch{}return t}function bd(e){let t=Object.create(null);try{Object.entries(e).forEach(([n,r])=>{typeof r=="string"?t[n]=r:typeof r=="number"&&(t[n]=String(r))})}catch{}return t}function as(e){let t=e.headers||{},r=(typeof t["x-forwarded-host"]=="string"?t["x-forwarded-host"]:void 0)||(typeof t.host=="string"?t.host:void 0),o=(typeof t["x-forwarded-proto"]=="string"?t["x-forwarded-proto"]:void 0)||e.protocol||(e.socket?.encrypted?"https":"http"),s=e.url||"",c=ZY({url:s,host:r,protocol:o}),a=e.body||void 0,l=e.cookies;return{url:c,method:e.method,query_string:vC(s),headers:bd(t),cookies:l,data:a}}function ZY({url:e,protocol:t,host:n}){if(e?.startsWith("http"))return e;if(e&&n)return`${t}://${n}${e}`}function Yr(e,t=!1,n="request"){let r=typeof t=="boolean"?md(t):t,i=n==="request"?r.httpHeaders.request:r.httpHeaders.response,o=r.cookies,s=`http.${n}.header.`,c={};try{let a={};for(let[l,p]of Object.entries(e)){if(p==null)continue;let u=l.toLowerCase();if(u==="cookie"||u==="set-cookie"){if(o===!1)continue;if(typeof p=="string"&&p!==""){let m=XY(p,u==="set-cookie"),_=Ra(m,o,oC);for(let[h,b]of Object.entries(_))c[`${s}${hd(u)}.${hd(h)}`]=b}else c[`${s}${hd(u)}`]=Na}else{if(i===!1)continue;Array.isArray(p)?a[u]=p.map(m=>m!=null?String(m):m).join(";"):typeof p=="string"&&(a[u]=p)}}if(i!==!1){let l=Ra(a,i);for(let[p,u]of Object.entries(l))c[`${s}${hd(p)}`]=u}}catch{}return c}function hd(e){return e.replace(/-/g,"_")}function XY(e,t){let n=e.indexOf(";"),r=t&&n!==-1?e.substring(0,n):e,i=t?[r]:r.split("; "),o={};for(let s of i){let c=s.indexOf("="),a=(c!==-1?s.substring(0,c):s).toLowerCase(),l=c!==-1?s.substring(c+1):"";o[a]=l}return o}function vC(e){if(e)try{let t=new URL(e,"http://s.io").search.slice(1);return t.length?t:void 0}catch{return}}var D={INTERNAL:0,SERVER:1,CLIENT:2,PRODUCER:3,CONSUMER:4},KY={[D.INTERNAL]:"INTERNAL",[D.SERVER]:"SERVER",[D.CLIENT]:"CLIENT",[D.PRODUCER]:"PRODUCER",[D.CONSUMER]:"CONSUMER"};function py(e){return KY[e]}var qY=100;function an(e,t){let n=O(),r=$();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=qY}=n.getOptions();if(o<=0)return;let c={timestamp:Cr(),...e},a=i?we(()=>i(c,t)):c;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}var QY="FunctionToString",OC=new WeakMap,$Y=(()=>({name:QY,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=vr(this),r;try{OC.has(O())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){OC.set(e,!0)}})),Cl=$Y;var JY=[/^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$/],zY="EventFilters",Sd=(e={})=>{let t;return{name:zY,setup(n){let r=n.getOptions();t=CC(e,r)},processEvent(n,r,i){if(!t){let o=i.getOptions();t=CC(e,o)}return ej(n,t)?null:n}}},xl=((e={})=>({...Sd(e),name:"InboundFilters"}));function CC(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:JY],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function ej(e,t){if(e.type){if(e.type==="transaction"&&nj(e,t.ignoreTransactions))return E&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
14
|
+
Event: ${Xi(e)}`),!0}else{if(tj(e,t.ignoreErrors))return E&&g.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
15
|
+
Event: ${Xi(e)}`),!0;if(sj(e))return E&&g.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
16
|
+
Event: ${Xi(e)}`),!0;if(rj(e,t.denyUrls))return E&&g.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
17
|
+
Event: ${Xi(e)}.
|
|
18
|
+
Url: ${yd(e)}`),!0;if(!ij(e,t.allowUrls))return E&&g.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
19
|
+
Event: ${Xi(e)}.
|
|
20
|
+
Url: ${yd(e)}`),!0}return!1}function tj(e,t){return t?.length?ud(e).some(n=>_n(n,t)):!1}function nj(e,t){if(!t?.length)return!1;let n=e.transaction;return n?_n(n,t):!1}function rj(e,t){if(!t?.length)return!1;let n=yd(e);return n?_n(n,t):!1}function ij(e,t){if(!t?.length)return!0;let n=yd(e);return n?_n(n,t):!0}function oj(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 yd(e){try{let n=[...e.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?oj(n):null}catch{return E&&g.error(`Cannot extract url for event ${Xi(e)}`),null}}function sj(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function kC(e,t,n,r,i,o){if(!i.exception?.values||!o||!ze(o.originalException))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=uy(e,t,r,o.originalException,n,i.exception.values,s,0))}function uy(e,t,n,r,i,o,s,c){if(o.length>=n+1)return o;let a=[...o];if(ze(r[i])){xC(s,c,r);let l=e(t,r[i]),p=a.length;PC(l,i,p,c),a=uy(e,t,n,r[i],i,[l,...a],l,p)}return LC(r)&&r.errors.forEach((l,p)=>{if(ze(l)){xC(s,c,r);let u=e(t,l),d=a.length;PC(u,`errors[${p}]`,d,c),a=uy(e,t,n,l,i,[u,...a],u,d)}}),a}function LC(e){return Array.isArray(e.errors)}function xC(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...LC(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function PC(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function MC(e,t){return e(t.stack||"",1)}function aj(e){return ze(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function cj(e){return aj(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function dy(e,t){let n={type:t.name||t.constructor.name,value:cj(t)},r=MC(e,t);return r.length&&(n.stacktrace={frames:r}),n}function lj(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(ze(n))return n}}function pj(e){if("name"in e&&typeof e.name=="string"){let r=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(r+=` with message '${e.message}'`),r}else if("message"in e&&typeof e.message=="string")return e.message;let t=_h(e);if(dh(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=uj(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${t}`}function uj(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function dj(e,t,n,r){if(ze(n))return[n,void 0];if(t.synthetic=!0,Kt(n)){let o=e?.getOptions().normalizeDepth,s={__serialized__:bh(n,o)},c=lj(n);if(c)return[c,s];let a=pj(n),l=r?.syntheticException||new Error(a);return l.message=a,[l,s]}let i=r?.syntheticException||new Error(n);return i.message=`${n}`,[i,void 0]}function wC(e,t,n,r){let o=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[s,c]=dj(e,o,n,r),a={exception:{values:[dy(t,s)]}};return c&&(a.extra=c),Ih(a,void 0,void 0),Hn(a,o),{...a,event_id:r?.event_id}}function GC(e,t,n="info",r,i){let o={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let s=MC(e,r.syntheticException);s.length&&(o.exception={values:[{value:t,stacktrace:{frames:s}}]},Hn(o,{synthetic:!0}))}if(Zi(t)){let{__sentry_template_string__:s,__sentry_template_values__:c}=t;return o.logentry={message:s,params:c},o}return o.message=t,o}var mj="cause",fj=5,gj="LinkedErrors",_j=((e={})=>{let t=e.limit||fj,n=e.key||mj;return{name:gj,preprocessEvent(r,i,o){let s=o.getOptions();kC(dy,s.stackParser,n,t,r,i)}}}),Pl=_j;var my=["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 fy(e){let t={};for(let o of Object.keys(e))t[o.toLowerCase()]=e[o];return my.map(o=>{let s=t[o.toLowerCase()],c=Array.isArray(s)?s.join(";"):s;return o==="Forwarded"?hj(c):c?.split(",").map(a=>a.trim())}).reduce((o,s)=>s?o.concat(s):o,[]).find(o=>o!==null&&bj(o))||null}function hj(e){if(!e)return null;for(let t of e.split(";"))if(t.startsWith("for="))return t.slice(4);return null}function bj(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 yj="RequestData",Sj=((e={})=>{function t(n){let r=n.getDataCollectionOptions(),i={...r,...e.include?.cookies===!0&&r.cookies===!1&&{cookies:!0},...e.include?.headers===!0&&r.httpHeaders.request===!1&&{httpHeaders:{...r.httpHeaders,request:!0}},...e.include?.query_string===!0&&r.urlQueryParams===!1&&{urlQueryParams:!0}};return{dataCollection:i,include:{cookies:i.cookies!==!1,data:!0,headers:i.httpHeaders.request!==!1,ip:i.userInfo,query_string:i.urlQueryParams!==!1,url:!0,...e.include}}}return{name:yj,processEvent(n,r,i){let{sdkProcessingMetadata:o={}}=n,{normalizedRequest:s,ipAddress:c}=o,{include:a,dataCollection:l}=t(i);return s&&Ej(n,s,{ipAddress:c},a,l),n},processSegmentSpan(n,r){let{sdkProcessingMetadata:i={}}=$().getScopeData(),{normalizedRequest:o,ipAddress:s}=i;if(!o)return;let{include:c,dataCollection:a}=t(r);Tj(n,o,s,c,a)}}}),kl=Sj;function Ej(e,t,n,r,i){let o=UC(t,r);if(o.query_string&&(o.query_string=DC(o.query_string,i.urlQueryParams)),o.url&&(o.url=Rl(o.url,i.urlQueryParams)),e.request={...e.request,...o},r.ip){let s=t.headers&&fy(t.headers)||n.ipAddress;s&&(e.user={...e.user,ip_address:s})}}function Tj(e,t,n,r,i){let o=UC(t,r),s={};if(o.url&&(s[pt]=Rl(o.url,i.urlQueryParams)),o.method&&(s["http.request.method"]=o.method),o.query_string&&(s[ld]=DC(o.query_string,i.urlQueryParams)),Bt(e,s),o.cookies&&Object.keys(o.cookies).length>0){let c=Object.entries(o.cookies).map(([l,p])=>`${l}=${p}`).join("; "),a=Yr({cookie:c},i,"request");Bt(e,a)}if(o.headers){let c=Yr(o.headers,i,"request");Bt(e,c)}if(o.data!=null){let c=typeof o.data=="string"?o.data:JSON.stringify(o.data);c&&Bt(e,{"http.request.body.data":c})}if(r.ip){let c=t.headers&&fy(t.headers)||n||void 0;c&&Bt(e,{[Jc]:c})}}function UC(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let i=new Set(my.map(o=>o.toLowerCase()));for(let o of Object.keys(r))i.has(o.toLowerCase())&&delete r[o]}if(n.method=e.method,t.url&&(n.url=e.url),t.cookies){let i=e.cookies||(r?.cookie?yC(r.cookie):void 0);n.cookies=i||{}}return t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function DC(e,t){let n=Ij(e);return n?va(n,t):void 0}function Ij(e){if(typeof e=="string")return e||void 0;let t=Array.isArray(e)?e:Object.entries(e);return new URLSearchParams(t).toString()||void 0}var Ed=new Set([]);function Oa(e){let t="console",n=uh(t,e);return $c(t,Aj),n}function HC(e){for(let t of e)Ed.add(t);return()=>{for(let t of e)Ed.delete(t)}}var BC=new Set;function Aj(){"console"in te&&nr.forEach(function(e){BC.has(e)||!(e in te.console)||(BC.add(e),Mt(te.console,e,function(t){return tr[e]=t,function(...n){let r=n[0],i=tr[e],o=Ed.size&&typeof r=="string"&&_n(r,Ed);o||Ys("console",{args:n,level:e}),(!o||E&&g.isEnabled())&&i?.apply(te.console,n)}}))})}function oo(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var Nj="CaptureConsole",Rj=((e={})=>{let t=e.levels||nr,n=e.handled??!0;return{name:Nj,setup(r){"console"in te&&Oa(({args:i,level:o})=>{O()!==r||!t.includes(o)||vj(i,o,n)})}}}),gy=Rj;function vj(e,t,n){let r=oo(t),i=new Error,o={level:oo(t),extra:{arguments:e}};He(s=>{if(s.addEventProcessor(l=>(l.logger="console",Hn(l,{handled:n,type:"auto.core.capture_console"}),l)),t==="assert"){if(!e[0]){let l=`Assertion failed: ${Ks(e.slice(1)," ")||"console.assert"}`;s.setExtra("arguments",e.slice(1)),s.captureMessage(l,r,{captureContext:o,syntheticException:i})}return}let c=e.find(l=>l instanceof Error);if(c){ge(c,o);return}let a=Ks(e," ");s.captureMessage(a,r,{captureContext:o,syntheticException:i})})}var Oj="Dedupe",Cj=(()=>{let e;return{name:Oj,processEvent(t){if(t.type)return t;try{if(xj(t,e))return E&&g.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),_y=Cj;function xj(e,t){return t?!!(Pj(e,t)||kj(e,t)):!1}function Pj(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!VC(e,t)||!WC(e,t))}function kj(e,t){let n=FC(t),r=FC(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!VC(e,t)||!WC(e,t))}function WC(e,t){let n=Lu(e),r=Lu(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){let o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function VC(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 FC(e){return e.exception?.values?.[0]}var Lj="ExtraErrorData",Mj=((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:Lj,processEvent(r,i,o){let{maxValueLength:s}=o.getOptions();return wj(r,i,t,n,s)}}}),hy=Mj;function wj(e,t={},n,r,i){if(!t.originalException||!ze(t.originalException))return e;let o=t.originalException.name||t.originalException.constructor.name,s=YC(t.originalException,r,i);if(s){let c={...e.contexts},a=qe(s,n);return Kt(a)&&(Ev(a),c[o]=a),{...e,contexts:c}}return e}function YC(e,t,n){try{let r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],i={};for(let o of Object.keys(e)){if(r.indexOf(o)!==-1)continue;let s=e[o];i[o]=ze(s)||typeof s=="string"?n?gn(`${s}`,n):`${s}`:s}if(t&&e.cause!==void 0)if(ze(e.cause)){let o=e.cause.name||e.cause.constructor.name;i.cause={[o]:YC(e.cause,!1,n)}}else i.cause=e.cause;if(typeof e.toJSON=="function"){let o=e.toJSON();for(let s of Object.keys(o)){let c=o[s];i[s]=ze(c)?c.toString():c}}return i}catch(r){E&&g.error("Unable to extract extra data from the Error object:",r)}return null}function Gj(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let i=e[r];i==="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var Uj=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function ZC(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Uj.exec(t);return n?n.slice(1):[]}function by(...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=Gj(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function jC(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 yy(e,t){e=by(e).slice(1),t=by(t).slice(1);let n=jC(e.split("/")),r=jC(t.split("/")),i=Math.min(n.length,r.length),o=i;for(let c=0;c<i;c++)if(n[c]!==r[c]){o=c;break}let s=[];for(let c=o;c<n.length;c++)s.push("..");return s=s.concat(r.slice(o)),s.join("/")}function Sy(e){let t=ZC(e),n=t[0]||"",r=t[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}function Ey(e,t){let n=ZC(e)[2]||"";return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var Dj="RewriteFrames",Ty=(e={})=>{let t=e.root,n=e.prefix||"app:///",r="window"in te&&!!te.window,i=e.iteratee||Bj({isBrowser:r,root:t,prefix:n});function o(c){try{return{...c,exception:{...c.exception,values:c.exception.values.map(a=>({...a,...a.stacktrace&&{stacktrace:s(a.stacktrace)}}))}}}catch{return c}}function s(c){return{...c,frames:c?.frames?.map(a=>i(a))}}return{name:Dj,processEvent(c){let a=c;return c.exception&&Array.isArray(c.exception.values)&&(a=o(a)),a}}};function Bj({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("/"),o=/^\//.test(r.filename);if(e){if(t){let s=r.filename;s.indexOf(t)===0&&(r.filename=s.replace(t,n))}}else if(i||o){let s=i?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,c=t?yy(t,s):Ey(s);r.filename=`${n}${c}`}return r}}var Hj=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],Fj=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],Wj={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"},KC=["select","insert","upsert","update","delete"];function Td(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function Id(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function qC(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function Vj(e,t){return qC(e,t)!==void 0}function QC(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(o=>o.toLowerCase()===r);return i!==void 0?n[i]:void 0}function Yj(e,t={}){switch(e){case"GET":return"select";case"POST":return QC(t,"Prefer")?.includes("resolution=")?"upsert":"insert";case"PATCH":return"update";case"DELETE":return"delete";default:return"<unknown-op>"}}function jj(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 n?.startsWith("fts")?i="textSearch":n?.startsWith("plfts")?i="textSearch[plain]":n?.startsWith("phfts")?i="textSearch[phrase]":n?.startsWith("wfts")?i="textSearch[websearch]":i=n&&Wj[n]||"filter",`${i}(${e}, ${r.join(".")})`}function XC(e,t=!1){return new Proxy(e,{apply(n,r,i){return Se({name:`auth ${t?"(admin) ":""}${e.name}`,attributes:{[S]:"auto.db.supabase",[H]:"db","db.system":"postgresql","db.operation":`auth.${t?"admin.":""}${e.name}`}},o=>Reflect.apply(n,r,i).then(s=>(B(s)&&"error"in s&&s.error?(o.setStatus({code:2}),ge(s.error,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}})):o.setStatus({code:1}),o.end(),s)).catch(s=>{throw o.setStatus({code:2}),o.end(),ge(s,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}}),s}).then(...i))}})}function Zj(e){let t=e.auth;if(!(!t||Id(e.auth))){for(let n of Hj){let r=t[n];r&&typeof e.auth[n]=="function"&&(e.auth[n]=XC(r))}for(let n of Fj){let r=t.admin[n];r&&typeof e.auth.admin[n]=="function"&&(e.auth.admin[n]=XC(r,!0))}Td(e.auth)}}function Xj(e,t){Id(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(n,r,i){let o=Reflect.apply(n,r,i),s=o.constructor;return qj(s,t),o}}),Td(e.prototype.from))}function Kj(e,t){Id(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(n,r,i){let o=KC,s=r,c=Yj(s.method,s.headers);if(!o.includes(c)||!s?.url?.pathname||typeof s.url.pathname!="string")return Reflect.apply(n,r,i);let a=s.url.pathname.split("/"),l=a.length>0?a[a.length-1]:"",p=[];for(let[R,P]of s.url.searchParams.entries())p.push(jj(R,P));let u=Object.create(null);if(Kt(s.body))for(let[R,P]of Object.entries(s.body))u[R]=P;let d=O(),m=t.sendOperationData??d?.getDataCollectionOptions().databaseQueryData===!0,_=qC(s.body,u),h=c==="select"?"":`${c}${Vj(s.body,u)?"(...) ":""}`,b=m?p.join(" "):p.length>0?"[redacted]":"",v=[h.trimEnd(),b].filter(Boolean).join(" "),M=v?`${v} from(${l})`:`from(${l})`,N={"db.table":l,"db.schema":s.schema,"db.url":s.url.origin,"db.sdk":QC(s.headers,"X-Client-Info"),"db.system":"postgresql","db.operation":c,[S]:"auto.db.supabase",[H]:"db"};return p.length&&m&&(N["db.query"]=p),_!==void 0&&m&&(N["db.body"]=_),Se({name:M,attributes:N},R=>Reflect.apply(n,r,[]).then(P=>{if(R&&(P&&typeof P=="object"&&"status"in P&&ea(R,P.status||500),R.end()),P?.error){let G=new Error(P.error.message);P.error.code&&(G.code=P.error.code),P.error.details&&(G.details=P.error.details);let k={};p.length&&m&&(k.query=p),_!==void 0&&m&&(k.body=_),ge(G,U=>(U.addEventProcessor(ae=>(Hn(ae,{handled:!1,type:"auto.db.supabase.postgres"}),ae)),U.setContext("supabase",k),U))}let Y={type:"supabase",category:`db.${c}`,message:M},T={};return p.length&&m&&(T.query=p),_!==void 0&&m&&(T.body=_),Object.keys(T).length&&(Y.data=T),an(Y),P},P=>{throw R&&(ea(R,500),R.end()),P}).then(...i))}}),Td(e.prototype.then))}function qj(e,t){for(let n of KC)Id(e.prototype[n])||(e.prototype[n]=new Proxy(e.prototype[n],{apply(r,i,o){let s=Reflect.apply(r,i,o),c=s.constructor;return E&&g.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),Kj(c,t),s}}),Td(e.prototype[n]))}var Ad=(e,t={})=>{if(!e){E&&g.warn("Supabase integration was not installed because no Supabase client was provided.");return}let n=e.constructor===Function?e:e.constructor;Xj(n,t),Zj(e)},Qj="Supabase",$j=((e,t)=>({setupOnce(){Ad(e,t)},name:Qj})),Iy=e=>$j(e.supabaseClient,{sendOperationData:e.sendOperationData});var Jj=10,zj="ZodErrors";function e5(e){return ze(e)&&e.name==="ZodError"&&Array.isArray(e.issues)}function t5(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 n5(e){return e.map(t=>typeof t=="number"?"<array>":t).join(".")}function r5(e){let t=new Set;for(let r of e.issues){let i=n5(r.path);i.length>0&&t.add(i)}let n=Array.from(t);if(n.length===0){let r="variable";if(e.issues.length>0){let i=e.issues[0];i!==void 0&&"expected"in i&&typeof i.expected=="string"&&(r=i.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${gn(n.join(", "),100)}`}function i5(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!e5(r.originalException)||r.originalException.issues.length===0)return n;try{let o=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(t5);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:o})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:r5(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":o.slice(0,e)}}}catch(i){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:i instanceof Error?`${i.name}: ${i.message}
|
|
21
|
+
${i.stack}`:"unknown"}}}}}var o5=((e={})=>{let t=e.limit??Jj;return{name:zj,processEvent(n,r){return i5(t,e.saveZodIssuesAsAttachment,n,r)}}}),Ay=o5;var s5="Console",Ny=(e={})=>{let t=new Set(e.levels||nr);return{name:s5,setup(n){let r=Oa(({args:i,level:o})=>{O()!==n||!t.has(o)||a5(o,i)});if(n.registerCleanup(r),e.filter){let i=HC(e.filter);n.registerCleanup(i)}}}};function a5(e,t){let n={category:"console",data:{arguments:t,logger:"console"},level:oo(e),message:$C(t)};if(e==="assert")if(t[0]===!1){let r=t.slice(1);n.message=r.length>0?`Assertion failed: ${$C(r)}`:"Assertion failed",n.data.arguments=r}else return;an(n,{input:t,level:e})}function $C(e){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):Ks(e," ")}var c5=100,l5=10,Nd="flag.evaluation.";function Rd(e){if(e.type)return e;let n=ne().getScopeData().contexts.flags,r=n?n.values:[];return r.length&&(e.contexts===void 0&&(e.contexts={}),e.contexts.flags={values:[...r]}),e}function vd(e,t,n=c5){let r=ne().getScopeData().contexts;r.flags||(r.flags={values:[]});let i=r.flags.values;p5(i,e,t,n)}function p5(e,t,n,r){if(typeof n!="boolean")return;if(e.length>r){E&&g.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}let i=e.findIndex(o=>o.flag===t);i!==-1&&e.splice(i,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function Od(e,t,n=l5){if(typeof t!="boolean")return;let r=Q();if(!r)return;let i=oe(r).data;if(`${Nd}${e}`in i){r.setAttribute(`${Nd}${e}`,t);return}Object.keys(i).filter(s=>s.startsWith(Nd)).length<n&&r.setAttribute(`${Nd}${e}`,t)}var Ry=()=>({name:"FeatureFlags",processEvent(e,t,n){return Rd(e)},addFeatureFlag(e,t){vd(e,t),Od(e,t)}});var vy=({growthbookClass:e})=>({name:"GrowthBook",setupOnce(){let t=e.prototype;typeof t.isOn=="function"&&Mt(t,"isOn",JC),typeof t.getFeatureValue=="function"&&Mt(t,"getFeatureValue",JC)},processEvent(t,n,r){return Rd(t)}});function JC(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"&&(vd(n,r),Od(n,r)),r}}var u5="ConversationId",d5=(()=>({name:u5,setup(e){e.on("spanStart",t=>{let n=ne().getScopeData(),r=$().getScopeData(),i=n.conversationId||r.conversationId;if(i){let{op:o,data:s,description:c}=oe(t);if(!o?.startsWith("gen_ai.")&&!s["ai.operationId"]&&!c?.startsWith("ai."))return;t.setAttribute(Ko,i)}})}})),Oy=d5;function zC(e){return!!e&&typeof e._profiler<"u"&&typeof e._profiler.start=="function"&&typeof e._profiler.stop=="function"}function m5(){let e=O();if(!e){E&&g.warn("No Sentry client available, profiling is not started");return}let t=e.getIntegrationByName("ProfilingIntegration");if(!t){E&&g.warn("ProfilingIntegration is not available");return}if(!zC(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.start()}function f5(){let e=O();if(!e){E&&g.warn("No Sentry client available, profiling is not started");return}let t=e.getIntegrationByName("ProfilingIntegration");if(!t){E&&g.warn("ProfilingIntegration is not available");return}if(!zC(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.stop()}var Cy={startProfiler:m5,stopProfiler:f5};function xy(e,t={},n=ne()){let{message:r,name:i,email:o,url:s,source:c,associatedEventId:a,tags:l}=e,p={contexts:{feedback:{contact_email:o,name:i,message:r,url:s,source:c,associated_event_id:a}},type:"feedback",level:"info",tags:l},u=n?.getClient()||O();return u&&u.emit("beforeSendFeedback",p,t),n.captureEvent(p,t)}function Ca(e,t,n){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):g5(e,t,n)}function g5(e,t,n){return e.map(r=>rr(r)?String(r):JSON.stringify(qe(r,t,n))).join(" ")}function Cd(e){return/%[sdifocO]/.test(e)}function xd(e,t){let n={},r=new Array(t.length).fill("{}").join(" ");return n["sentry.message.template"]=`${e} ${r}`,t.forEach((i,o)=>{n[`sentry.message.parameter.${o}`]=i}),n}var _5="ConsoleLogs",ex={[S]:"auto.log.console"},h5=((e={})=>{let t=e.levels||nr;return{name:_5,setup(n){let{enableLogs:r,normalizeDepth:i=3,normalizeMaxBreadth:o=1e3}=n.getOptions();if(!r){E&&g.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let s=Oa(({args:c,level:a})=>{if(O()!==n||!t.includes(a))return;let l=c[0],p=c.slice(1);if(a==="assert"){if(!l){let m=p.length>0?`Assertion failed: ${Ca(p,i,o)}`:"Assertion failed";dr({level:"error",message:m,attributes:ex})}return}let u=a==="log",d={...ex};if(Kt(l)){Object.assign(d,qe(l,i,o));let m=typeof c[1]=="string"?2:1;c.slice(m).forEach((h,b)=>{d[`sentry.message.parameter.${b}`]=qe(h,i,o)})}else if(p.length>0&&typeof l=="string"&&!Cd(l)){let _=xd(l,p);for(let[h,b]of Object.entries(_))d[h]=h.startsWith("sentry.message.parameter.")?qe(b,i,o):b}dr({level:u?"info":a,message:Ca(c,i,o),severityNumber:u?10:void 0,attributes:d})});n.registerCleanup(s)}}}),Py=h5;var mt={};ev(mt,{count:()=>b5,distribution:()=>S5,gauge:()=>y5});function ky(e,t,n,r){Qb({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function b5(e,t=1,n){ky("counter",e,t,n)}function y5(e,t,n){ky("gauge",e,t,n)}function S5(e,t,n){ky("distribution",e,t,n)}var E5=["trace","debug","info","warn","error","fatal"];function Ly(e={}){let t=new Set(e.levels??E5),n=e.client;return{log(r){let{type:i,level:o,message:s,args:c,tag:a,date:l,...p}=r,u=n||O();if(!u)return;let d=A5(i,o);if(!t.has(d))return;let{normalizeDepth:m=3,normalizeMaxBreadth:_=1e3}=u.getOptions(),h={};for(let[v,M]of Object.entries(p))h[v]=qe(M,m,_);h["sentry.origin"]="auto.log.consola",a&&(h["consola.tag"]=a),i&&(h["consola.type"]=i),o!=null&&typeof o=="number"&&(h["consola.level"]=o);let b=R5(N5(c,m,_),m,_);b?.attributes&&Object.assign(h,b.attributes),dr({level:d,message:b?.message||s||c&&Ca(c,m,_)||"",attributes:h})}}}var T5={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"},I5={0:"fatal",1:"warn",2:"info",3:"info",4:"debug",5:"trace"};function A5(e,t){if(e==="verbose")return"debug";if(e==="silent")return"trace";if(e){let n=T5[e];if(n)return n}if(typeof t=="number"){let n=I5[t];if(n)return n}return"info"}function N5(e,t,n){if(!e?.length)return{message:""};let r=Ca(e,t,n),i=e[0];if(Kt(i)){let o=typeof e[1]=="string"?2:1,s=e.slice(o);return{message:r,attributes:i,messageParameters:s}}else{let o=e.slice(1),s=o.length>0&&typeof i=="string"&&!Cd(i);return{message:r,messageTemplate:s?i:void 0,messageParameters:s?o:void 0}}}function R5(e,t,n){let{message:r,attributes:i,messageTemplate:o,messageParameters:s}=e,c={};if(o&&s){let a=xd(o,s);for(let[l,p]of Object.entries(a))c[l]=l.startsWith("sentry.message.parameter.")?qe(p,t,n):p}else s&&s.length>0&&s.forEach((a,l)=>{c[`sentry.message.parameter.${l}`]=qe(a,t,n)});return{message:r,attributes:{...qe(i,t,n),...c}}}var tx="gen_ai.prompt",jr="gen_ai.system",Be="gen_ai.request.model",xa="gen_ai.request.stream",so="gen_ai.request.temperature",Pa="gen_ai.request.max_tokens",ao="gen_ai.request.frequency_penalty",ka="gen_ai.request.presence_penalty",co="gen_ai.request.top_p",Pd="gen_ai.request.top_k",kd="gen_ai.request.encoding_format",Ld="gen_ai.request.dimensions",Zr="gen_ai.response.finish_reasons",cn="gen_ai.response.model",lo="gen_ai.response.id",nx="gen_ai.response.stop_reason",At="gen_ai.usage.input_tokens",Ft="gen_ai.usage.output_tokens",jn="gen_ai.usage.total_tokens",st="gen_ai.operation.name",xt="sentry.sdk_meta.gen_ai.input.messages.original_length",Wt="gen_ai.input.messages",rx="gen_ai.output.messages",tn="gen_ai.system_instructions",nn="gen_ai.response.text",Zn="gen_ai.request.available_tools",ix="gen_ai.response.streaming",Sn="gen_ai.response.tool_calls",po="gen_ai.agent.name",ox="gen_ai.pipeline.name",uo="gen_ai.conversation.id",My="gen_ai.usage.input_tokens.cache_write",mo="gen_ai.usage.input_tokens.cached",sx="gen_ai.invoke_agent",fo="gen_ai.embeddings.input",wy="gen_ai.embeddings",Gy="gen_ai.execute_tool",Xr="gen_ai.tool.name",Ll="gen_ai.tool.call.id",Ml="gen_ai.tool.type",La="gen_ai.tool.input",Ma="gen_ai.tool.output",wa="gen_ai.tool.description";function go(e){return!e||typeof e!="object"?!1:O5(e)||cx(e)||v5(e)||lx(e)||px(e)||C5(e)||x5(e)||P5(e)||k5(e)||L5(e)||M5(e)||w5(e)}function v5(e){return"image_url"in e?typeof e.image_url=="string"?e.image_url.startsWith("data:"):ax(e):!1}function ax(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 O5(e){return"type"in e&&typeof e.type=="string"&&"source"in e&&go(e.source)}function cx(e){return"inlineData"in e&&!!e.inlineData&&typeof e.inlineData=="object"&&"data"in e.inlineData&&typeof e.inlineData.data=="string"}function lx(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 px(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 C5(e){return"media_type"in e&&typeof e.media_type=="string"&&"data"in e}function x5(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 P5(e){return"type"in e&&e.type==="image"&&"image"in e&&typeof e.image=="string"&&!e.image.startsWith("http://")&&!e.image.startsWith("https://")}function k5(e){return"type"in e&&(e.type==="blob"||e.type==="base64")}function L5(e){return"b64_json"in e}function M5(e){return"type"in e&&"result"in e&&e.type==="image_generation"}function w5(e){return"uri"in e&&typeof e.uri=="string"&&e.uri.startsWith("data:")}var wl="[Blob substitute]",G5=["image_url","data","content","b64_json","result","uri","image"];function cs(e){let t={...e};go(t.source)&&(t.source=cs(t.source)),cx(e)&&(t.inlineData={...e.inlineData,data:wl}),ax(e)&&(t.image_url={...e.image_url,url:wl}),lx(e)&&(t.input_audio={...e.input_audio,data:wl}),px(e)&&(t.file={...e.file,file_data:wl});for(let n of G5)typeof t[n]=="string"&&(t[n]=wl);return t}var dx=2e4,Md=e=>new TextEncoder().encode(e).length,Dy=e=>Md(JSON.stringify(e));function wd(e,t){if(Md(e)<=t)return e;let n=0,r=e.length,i="";for(;n<=r;){let o=Math.floor((n+r)/2),s=e.slice(0,o);Md(s)<=t?(i=s,n=o+1):r=o-1}return i}function U5(e){return typeof e=="string"?e:"text"in e&&typeof e.text=="string"?e.text:""}function ux(e,t){return typeof e=="string"?t:{...e,text:t}}function D5(e){return e!==null&&typeof e=="object"&&"content"in e&&typeof e.content=="string"}function mx(e){return e!==null&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)}function fx(e){return e!==null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)&&e.parts.length>0}function B5(e,t){let n={...e,content:""},r=Dy(n),i=t-r;if(i<=0)return[];let o=wd(e.content,i);return[{...e,content:o}]}function H5(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 F5(e,t){let{key:n,items:r}=H5(e);if(n===null||r.length===0)return[];let i=r.map(a=>ux(a,"")),o=Dy({...e,[n]:i}),s=t-o;if(s<=0)return[];let c=[];for(let a of r){let l=U5(a),p=Md(l);if(p<=s)c.push(a),s-=p;else if(c.length===0){let u=wd(l,s);u&&c.push(ux(a,u));break}else break}return c.length<=0?[]:[{...e,[n]:c}]}function W5(e,t){if(!e)return[];if(typeof e=="string"){let n=wd(e,t);return n?[n]:[]}return typeof e!="object"?[]:D5(e)?B5(e,t):mx(e)||fx(e)?F5(e,t):[]}function Uy(e){return e.map(n=>{let r;return n&&typeof n=="object"&&(mx(n)?r={...n,content:Uy(n.content)}:"content"in n&&go(n.content)&&(r={...n,content:cs(n.content)}),fx(n)&&(r={...r??n,parts:Uy(n.parts)}),go(r)?r=cs(r):go(n)&&(r=cs(n))),r??n})}function V5(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],i=Uy([r]),o=i[0];return Dy(o)<=n?i:W5(o,n)}function gx(e){return V5(e,dx)}function _x(e){return wd(e,dx)}function Xe(e){let t=O()?.getDataCollectionOptions().genAI;return{...e,recordInputs:e?.recordInputs??t?.inputs??!1,recordOutputs:e?.recordOutputs??t?.outputs??!1}}function nt(e){if(e!==void 0)return e;let t=O();return t?!ot(t)&&t.getOptions().streamGenAiSpans===!1:!0}function Gd(e,t){return e?`${e}.${t}`:t}function Kr(e,t,n,r,i){let o={};return typeof e=="number"&&(o[At]=e),typeof n=="number"&&(o[Dr]=n),typeof r=="number"&&(o[Br]=r),typeof t=="number"&&(o[Ft]=t),typeof i=="number"?o[jn]=i:(typeof e=="number"||typeof t=="number")&&(o[jn]=(typeof e=="number"?e:0)+(typeof t=="number"?t:0)),o}function ls(e,t,n){if(!e.isRecording())return;let r={[ix]:!0};t.responseId&&(r[lo]=t.responseId),t.responseModel&&(r[cn]=t.responseModel),Object.assign(r,Kr(t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens,t.totalTokens)),typeof t.reasoningOutputTokens=="number"&&(r[rd]=t.reasoningOutputTokens),t.finishReasons.length&&(r[Zr]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[nn]=t.responseTexts.join("")),n&&t.toolCalls.length&&(r[Sn]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function Vt(e){if(typeof e=="string")return _x(e);try{return JSON.stringify(Array.isArray(e)?gx(e):e)}catch{return"[unserializable]"}}function Mn(e){if(!Array.isArray(e))return{systemInstructions:void 0,filteredMessages:e};let t=e.findIndex(s=>s&&typeof s=="object"&&"role"in s&&s.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?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:e};let i=JSON.stringify([{type:"text",content:r}]),o=[...e.slice(0,t),...e.slice(t+1)];return{systemInstructions:i,filteredMessages:o}}async function Y5(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r=="object"&&"data"in r?{...r,data:n}:n}function Ga(e,t){return bt(e)?new Proxy(e,{get(n,r){let o=r in Promise.prototype||r===Symbol.toStringTag?t:n,s=Reflect.get(o,r);return r==="withResponse"&&typeof s=="function"?function(){let a=s.call(n);return Y5(a,t)}:typeof s=="function"?s.bind(o):s}}):t}var hx="WorkersAI";var Gl=new Map,Ud=new Map,Dd=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"]]);var Bd="operation.name",Hd="ai.operationId",Fd="ai.prompt",bx="ai.schema",yx="ai.response.object",By="ai.values",Hy="ai.response.text",Fy="ai.response.toolCalls",Sx="ai.response.finishReason",ps="ai.prompt.messages",ki="ai.prompt.tools",Ul="ai.model.id",Ex="ai.response.providerMetadata",Tx="ai.usage.cachedInputTokens",Ix="ai.usage.inputTokenDetails.",Ax="ai.telemetry.functionId",Nx="ai.usage.completionTokens",Rx="ai.usage.promptTokens",vx="ai.usage.tokens",Wy="ai.toolCall.name",Vy="ai.toolCall.id",Ox="ai.toolCall.args",Cx="ai.toolCall.result";function Px(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[At],i=e.data[Ft];if(typeof r=="number"||typeof i=="number"){let o=t.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(o.inputTokens+=r),typeof i=="number"&&(o.outputTokens+=i),t.set(n,o)}}function Yy(e,t){let n=t.get(e.span_id);!n||!e.data||(n.inputTokens>0&&(e.data[At]=n.inputTokens),n.outputTokens>0&&(e.data[Ft]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(e.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function j5(e){let t=new Map;for(let n of e){let r=n.data[Zn];if(typeof r=="string")try{let i=JSON.parse(r);for(let o of i)o.name&&o.description&&!t.has(o.name)&&t.set(o.name,o.description)}catch{}}return t}function kx(e,t){let n=j5(e);for(let r of e){if(r.op==="gen_ai.execute_tool"){let i=r.data[Xr];if(typeof i=="string"){let o=n.get(i);o&&(r.data[wa]=o)}}r.op==="gen_ai.invoke_agent"&&Yy(r,t)}}function jy(e){return Gl.get(e)}function Zy(e){Gl.delete(e)}function Lx(e){let t=e.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n});return JSON.stringify(t)}function xx(e){return e.filter(t=>!!t&&typeof t=="object"&&"role"in t&&"content"in t)}function Z5(e){try{let t=JSON.parse(e);if(t&&typeof t=="object"){let{messages:n}=t,{prompt:r,system:i}=t,o=[];if(typeof i=="string"&&o.push({role:"system",content:i}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return o.push(...xx(n)),o;if(Array.isArray(r))return o.push(...xx(r)),o;if(typeof r=="string"&&o.push({role:"user",content:r}),o.length>0)return o}}catch{}return[]}function Mx(e,t,n){if(typeof t[Fd]=="string"&&!t[Wt]&&!t[ps]){let r=t[Fd],i=Z5(r);if(i.length){let{systemInstructions:o,filteredMessages:s}=Mn(i);o&&e.setAttribute(tn,o);let c=Array.isArray(s)?s.length:0,a=n?Vt(s):Ue(s);e.setAttributes({[Fd]:a,[Wt]:a,[xt]:c})}}else if(typeof t[ps]=="string"){let r=t[ps];try{let i=JSON.parse(r);if(Array.isArray(i)){let{systemInstructions:o,filteredMessages:s}=Mn(i);o&&e.setAttribute(tn,o);let c=Array.isArray(s)?s.length:0,a=!n&&s===i?r:n?Vt(s):Ue(s);e.setAttributes({[ps]:a,[Wt]:a,[xt]:c})}}catch{}}}function X5(e){let{data:t,description:n}=oe(e);if(!n)return;if(t[Wy]&&t[Vy]&&n==="ai.toolCall"){z5(e,t);return}if(!t[Hd]&&!n.startsWith("ai."))return;Dd.get(n)==="generate_content"&&Pi([hx]);let i=O()?.getIntegrationByName("VercelAI"),o=nt(i?.options?.enableTruncation);e3(e,n,t,o)}function K5(e){if(e.type==="transaction"&&e.spans){let t=new Map;for(let r of e.spans)$5(r),Px(r,t);kx(e.spans,t);let n=e.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&Yy(n,t)}return e}function q5(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 Q5(e){let t=e[Hy],n=e[Fy],r=e[Sx];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 o=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(o)){for(let s of o){let c=s.input??s.args;i.push({type:"tool_call",id:s.toolCallId,name:s.toolName,arguments:typeof c=="string"?c:JSON.stringify(c??{})})}delete e[Fy]}}catch{}if(i.length>0){let o={role:"assistant",parts:i,finish_reason:q5(r)};e[rx]=JSON.stringify([o]),delete e[Hy]}}function Gx(e){if(Yt(e,Nx,Ft),Yt(e,Rx,At),Yt(e,Tx,mo),Yt(e,"ai.usage.inputTokens",At),Yt(e,"ai.usage.outputTokens",Ft),Yt(e,vx,At),Yt(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),!Object.keys(e).some(n=>n.startsWith(Ix))&&typeof e[At]=="number"&&typeof e[mo]=="number"&&(e[At]=e[At]+e[mo]),typeof e[At]=="number"){let n=typeof e[Ft]=="number"?e[Ft]:0;e[jn]=n+e[At]}if(e[ki]&&Array.isArray(e[ki])&&(e[ki]=Lx(e[ki])),e[Bd]){let n=e[Hd]?e[Hd]:e[Bd],r=Dd.get(n)??n;e[st]=r,delete e[Bd]}if(Yt(e,ps,Wt),Q5(e),Yt(e,yx,"gen_ai.response.object"),Yt(e,ki,"gen_ai.request.available_tools"),Yt(e,Ox,La),Yt(e,Cx,Ma),Yt(e,bx,"gen_ai.request.schema"),Yt(e,Ul,Be),Array.isArray(e[By])){let n=e[By].map(r=>{try{return JSON.parse(r)}catch{return r}});e[fo]=n.length===1?n[0]:JSON.stringify(n)}t3(e);for(let n of Object.keys(e))Array.isArray(e[n])&&(e[n]=JSON.stringify(e[n])),n.startsWith("ai.")&&Yt(e,n,`vercel.${n}`)}function $5(e){let{data:t,origin:n}=e;n==="auto.vercelai.otel"&&(e.status&&e.status!=="ok"&&(e.status="internal_error"),Gx(t))}function J5(e){let t=e.attributes;if(t?.[S]==="auto.vercelai.otel"){if(Gx(t),t[H]==="gen_ai.execute_tool"&&e.parent_span_id){let n=Ud.get(e.parent_span_id);if(n){let r=t[Xr];if(typeof r=="string"){let i=n.get(r);i&&(t[wa]=i)}}}Ud.delete(e.span_id)}}function Yt(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function z5(e,t){e.setAttribute(S,"auto.vercelai.otel"),e.setAttribute(H,"gen_ai.execute_tool"),e.setAttribute(st,"execute_tool"),Yt(t,Wy,Xr),Yt(t,Vy,Ll);let n=t[Ll];typeof n=="string"&&Gl.set(n,e.spanContext()),t[Ml]||e.setAttribute(Ml,"function");let r=t[Xr];r&&e.updateName(`execute_tool ${r}`)}function e3(e,t,n,r){e.setAttribute(S,"auto.vercelai.otel");let i=t.replace("ai.","");e.setAttribute("ai.pipeline.name",i),e.updateName(i);let o=n[Ax];o&&typeof o=="string"&&e.setAttribute("gen_ai.function_id",o),Mx(e,n,r),n[Ul]&&!n[cn]&&e.setAttribute(cn,n[Ul]),e.setAttribute("ai.streaming",t.includes("stream"));let s=Dd.get(t);if(s?e.setAttribute(H,`gen_ai.${s}`):t.startsWith("ai.stream")&&e.setAttribute(H,"ai.run"),s==="invoke_agent"){o&&typeof o=="string"?e.updateName(`invoke_agent ${o}`):e.updateName("invoke_agent");return}let c=n[Ul];c&&s&&e.updateName(`${s} ${c}`);let a=O();if(a&&ot(a)&&n[ki]&&Array.isArray(n[ki])){let l=new Map;for(let p of n[ki])try{let u=typeof p=="string"?JSON.parse(p):p;u?.name&&u?.description&&l.set(u.name,u.description)}catch{}if(l.size>0){let p=oe(e).parent_span_id;p&&Ud.set(p,l)}}}var wx=new WeakSet;function Wd(e){wx.has(e)||(wx.add(e),e.on("spanStart",X5),e.addEventProcessor(Object.assign(K5,{id:"VercelAiEventProcessor"})),e.on("processSpan",t=>{J5(t)}))}function Vd(e){let t={};if(!e||typeof e!="object")return t;let n=e,r=n.openai??n.azure;if(r&&(wn(t,mo,r.cachedPromptTokens),wn(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),wn(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),wn(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),wn(t,uo,r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;wn(t,mo,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;wn(t,My,s)}n.bedrock?.usage&&(wn(t,mo,n.bedrock.usage.cacheReadInputTokens),wn(t,My,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(wn(t,mo,n.deepseek.promptCacheHitTokens),wn(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[Ft]=(i.candidatesTokenCount??0)+i.thoughtsTokenCount,wn(t,jn,i.totalTokenCount),wn(t,"gen_ai.usage.reasoning.output_tokens",i.thoughtsTokenCount)),t}var Yd=new Set([Ft,jn,"gen_ai.usage.reasoning.output_tokens"]);function t3(e){let t=e[Ex];if(!t)return;let n=e[st]==="invoke_agent";try{let r=Vd(JSON.parse(t));for(let[i,o]of Object.entries(r))i===uo&&e[i]||n&&Yd.has(i)||(e[i]=o)}catch{}}function wn(e,t,n){n!=null&&(e[t]=n)}var qr="OpenAI",Ux={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},n3=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],Dx=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...n3];function Bx(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&e.type.startsWith("response.")}function Hx(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion.chunk"}function Dl(e,t,n){if(!t||typeof t!="object")return;let r=t,i={};if(typeof r.id=="string"&&(i[lo]=r.id),typeof r.model=="string"&&(i[cn]=r.model),r.object==="conversation"&&typeof r.id=="string"&&(i[uo]=r.id),r.usage&&typeof r.usage=="object"){let o=r.usage,s=o.prompt_tokens??o.input_tokens;typeof s=="number"&&(i[At]=s);let c=o.completion_tokens??o.output_tokens;typeof c=="number"&&(i[Ft]=c),typeof o.total_tokens=="number"&&(i[jn]=o.total_tokens);let a=o.prompt_tokens_details??o.input_tokens_details;B(a)&&(typeof a.cached_tokens=="number"&&(i[Br]=a.cached_tokens),typeof a.cache_write_tokens=="number"&&(i[Dr]=a.cache_write_tokens))}if(Array.isArray(r.choices)){let o=r.choices,s=o.map(c=>c.finish_reason).filter(c=>typeof c=="string");if(s.length>0&&(i[Zr]=JSON.stringify(s)),n){let c=o.map(l=>l.message?.content||"");i[nn]=JSON.stringify(c);let a=o.map(l=>l.message?.tool_calls).filter(l=>Array.isArray(l)&&l.length>0).flat();a.length>0&&(i[Sn]=JSON.stringify(a))}}if(typeof r.status=="string"&&(i[Zr]||(i[Zr]=JSON.stringify([r.status]))),n&&(typeof r.output_text=="string"&&!i[nn]&&(i[nn]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!i[Sn])){let o=r.output.filter(s=>s?.type==="function_call");o.length>0&&(i[Sn]=JSON.stringify(o))}e.setAttributes(i)}function r3(e){return"conversation"in e&&typeof e.conversation=="string"?e.conversation:void 0}function Xy(e){let t={[Be]:e.model??"unknown"};"temperature"in e&&(t[so]=e.temperature),"top_p"in e&&(t[co]=e.top_p),"frequency_penalty"in e&&(t[ao]=e.frequency_penalty),"presence_penalty"in e&&(t[ka]=e.presence_penalty),"stream"in e&&(t[xa]=e.stream),"encoding_format"in e&&(t[kd]=e.encoding_format),"dimensions"in e&&(t[Ld]=e.dimensions);let n=r3(e);return n&&(t[uo]=n),t}function i3(e,t){for(let n of e){let r=n.index;if(!(r===void 0||!n.function))if(!(r in t.chatCompletionToolCalls))t.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let i=t.chatCompletionToolCalls[r];n.function.arguments&&i?.function&&(i.function.arguments+=n.function.arguments)}}}function o3(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,t.cacheReadInputTokens=e.usage.prompt_tokens_details?.cached_tokens??t.cacheReadInputTokens,t.cacheCreationInputTokens=e.usage.prompt_tokens_details?.cache_write_tokens??t.cacheCreationInputTokens);for(let r of e.choices??[])n&&(r.delta?.content&&t.responseTexts.push(r.delta.content),r.delta?.tool_calls&&i3(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function s3(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"}),ge(e,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in e))return;let i=e;if(!Dx.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:o}=i;t.responseId=o.id??t.responseId,t.responseModel=o.model??t.responseModel,o.usage&&(t.promptTokens=o.usage.input_tokens,t.completionTokens=o.usage.output_tokens,t.totalTokens=o.usage.total_tokens,t.cacheReadInputTokens=o.usage.input_tokens_details?.cached_tokens??t.cacheReadInputTokens,t.cacheCreationInputTokens=o.usage.input_tokens_details?.cache_write_tokens??t.cacheCreationInputTokens),o.status&&t.finishReasons.push(o.status),n&&o.output_text&&t.responseTexts.push(o.output_text)}}async function*Bl(e,t,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,cacheReadInputTokens:void 0,cacheCreationInputTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let i of e)Hx(i)?o3(i,r,n):Bx(i)&&s3(i,r,n,t),yield i}finally{let i=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];ls(t,{...r,toolCalls:i},n)}}function a3(e){let t=Array.isArray(e.tools)?e.tools:[],r=e.web_search_options&&typeof e.web_search_options=="object"?[{type:"web_search_options",...e.web_search_options}]:[],i=[...t,...r];if(i.length!==0)try{return JSON.stringify(i)}catch(o){E&&g.error("Failed to serialize OpenAI tools:",o);return}}function jd(e,t){let n={[jr]:"openai",[st]:t,[S]:"auto.ai.openai"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let r=e[0],i=a3(r);i&&(n[Zn]=i),Object.assign(n,Xy(r))}else n[Be]="unknown";return n}function Hl(e,t,n,r){if(n==="embeddings"&&"input"in t){let c=t.input;if(c==null||typeof c=="string"&&c.length===0||Array.isArray(c)&&c.length===0)return;e.setAttribute(fo,typeof c=="string"?c:JSON.stringify(c));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:o,filteredMessages:s}=Mn(i);o&&e.setAttribute(tn,o),e.setAttribute(Wt,r?Vt(s):Ue(s)),Array.isArray(s)?e.setAttribute(xt,s.length):e.setAttribute(xt,1)}function c3(e,t,n,r,i){return function(...s){let c=n.operation||"unknown",a=jd(s,c),l=a[Be]||"unknown",p=s[0],u=p&&typeof p=="object"&&p.stream===!0,d={name:`${c} ${l}`,op:`gen_ai.${c}`,attributes:a};if(u){let h,b=Le(d,v=>(h=e.apply(r,s),i.recordInputs&&p&&Hl(v,p,c,nt(i.enableTruncation)),(async()=>{try{let M=await h;return Bl(M,v,i.recordOutputs??!1)}catch(M){throw v.setStatus({code:2,message:"internal_error"}),v.end(),M}})()));return Ga(h,b)}let m,_=Se(d,h=>(m=e.apply(r,s),i.recordInputs&&p&&Hl(h,p,c,nt(i.enableTruncation)),m.then(b=>(Dl(h,b,i.recordOutputs),b))));return Ga(m,_)}}function Fx(e,t="",n){return new Proxy(e,{get(r,i){let o=r[i],s=Gd(t,String(i)),c=Ux[s];return typeof o=="function"&&c?c3(o,s,c,r,n):typeof o=="function"?o.bind(r):o&&typeof o=="object"?Fx(o,s,n):o}})}function Zd(e,t){return Fx(e,"",Xe(t))}var Qr="Anthropic_AI",Ky={"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 Wx(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:i}=Mn(t);r&&e.setAttributes({[tn]:r});let o=Array.isArray(i)?i.length:1;e.setAttributes({[Wt]:n?Vt(i):Ue(i),[xt]:o})}var l3={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 qy(e){return e&&l3[e]||"internal_error"}function Vx(e,t){t.error&&(e.setStatus({code:2,message:qy(t.error.type)}),ge(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function Yx(e){let{system:t,messages:n,input:r}=e,i=typeof t=="string"?[{role:"system",content:e.system}]:[],o=Array.isArray(r)?r:r!=null?[r]:void 0,s=Array.isArray(n)?n:n!=null?[n]:[],c=o??s;return[...i,...c]}function p3(e,t){return"type"in e&&typeof e.type=="string"&&e.type==="error"?(t.setStatus({code:2,message:qy(e.error?.type)}),!0):!1}function u3(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+(n.usage.cache_creation_input_tokens??0)+(n.usage.cache_read_input_tokens??0)),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 d3(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 m3(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 r=t.activeToolBlocks[e.index];r&&r.inputJsonParts.push(e.delta.partial_json)}n&&typeof e.delta.text=="string"&&t.responseTexts.push(e.delta.text)}}function f3(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 jx(e,t,n,r){!(e&&typeof e=="object")||p3(e,r)||(u3(e,t),d3(e,t),m3(e,t,n),f3(e,t))}async function*Fl(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)jx(i,r,n,t),yield i}finally{ls(t,r,n)}}function Wl(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",i=>{jx(i,r,n,t)}),e.on("message",()=>{ls(t,r,n)}),e.on("error",i=>{ge(i,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end())}),e}var Xd=!1,Zx=new WeakSet;function Kd(e,t,n){let r={[jr]:"anthropic",[st]:n,[S]:"auto.ai.anthropic"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let i=e[0];i.tools&&Array.isArray(i.tools)&&(r[Zn]=JSON.stringify(i.tools)),r[Be]=i.model??"unknown","temperature"in i&&(r[so]=i.temperature),"top_p"in i&&(r[co]=i.top_p),"stream"in i&&(r[xa]=i.stream),"top_k"in i&&(r[Pd]=i.top_k),"frequency_penalty"in i&&(r[ao]=i.frequency_penalty),"max_tokens"in i&&(r[Pa]=i.max_tokens)}else t==="models.retrieve"||t==="models.get"?r[Be]=e[0]:r[Be]="unknown";return r}function Ua(e,t,n){let r=Yx(t);Wx(e,r,n),"prompt"in t&&e.setAttributes({[tx]:JSON.stringify(t.prompt)})}function g3(e,t){if("content"in t&&Array.isArray(t.content)){e.setAttributes({[nn]:t.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of t.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&e.setAttributes({[Sn]:JSON.stringify(n)})}"completion"in t&&e.setAttributes({[nn]:t.completion}),"input_tokens"in t&&e.setAttributes({[nn]:JSON.stringify(t.input_tokens)})}function _3(e,t){"id"in t&&"model"in t&&(e.setAttributes({[lo]:t.id,[cn]:t.model}),"usage"in t&&t.usage&&e.setAttributes(Kr(t.usage.input_tokens+(t.usage.cache_creation_input_tokens??0)+(t.usage.cache_read_input_tokens??0),t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens)))}function qd(e,t,n){if(!(!t||typeof t!="object")){if("type"in t&&t.type==="error"){Vx(e,t);return}n&&g3(e,t),_3(e,t)}}function Xx(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end()),e}function h3(e,t,n,r,i,o,s,c,a,l){let p=r[Be]??"unknown",u={name:`${i} ${p}`,op:`gen_ai.${i}`,attributes:r};if(a&&!l){let d,m=Le(u,_=>(d=e.apply(t,n),c.recordInputs&&s&&Ua(_,s,nt(c.enableTruncation)),(async()=>{try{let h=await d;return Fl(h,_,c.recordOutputs??!1)}catch(h){return Xx(h,_)}})()));return Ga(d,m)}else return Le(u,d=>{try{c.recordInputs&&s&&Ua(d,s,nt(c.enableTruncation)),Xd=!0;let m=e.apply(t,n);return Xd=!1,Wl(m,d,c.recordOutputs??!1)}catch(m){return Xd=!1,Xx(m,d)}})}function b3(e,t,n,r,i){return new Proxy(e,{apply(o,s,c){let a=s!==void 0?s:r,l=n.streaming===!0;if(!l&&Xd)return o.apply(a,c);let p=n.operation||"unknown",u=Kd(c,t,p),d=u[Be]??"unknown",m=typeof c[0]=="object"?c[0]:void 0,_=!!m?.stream;if(_||l)return h3(o,a,c,u,p,t,m,i,_,l);let h,b=Se({name:`${p} ${d}`,op:`gen_ai.${p}`,attributes:u},v=>(h=o.apply(a,c),i.recordInputs&&m&&Ua(v,m,nt(i.enableTruncation)),h.then(M=>(qd(v,M,i.recordOutputs),M))));return Ga(h,b)}})}function y3(e,t){for(let n of Object.keys(Ky)){let r=n.split("."),i=r.pop(),o=e;for(let a of r)o=o?.[a];if(!o||typeof o[i]!="function")continue;let s=o[i];if(Zx.has(s))continue;let c=b3(s,n,Ky[n],o,t);Zx.add(c),o[i]=c}return e}function Qd(e,t){return y3(e,Xe(t))}var $r="Google_GenAI",Kx={"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}},qx="google_genai";function S3(e,t){let n=e?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:"internal_error"}),ge(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function E3(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.candidateTokens=n.candidatesTokenCount),typeof n.thoughtsTokenCount=="number"&&(t.reasoningOutputTokens=n.thoughtsTokenCount),(t.candidateTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(t.completionTokens=(t.candidateTokens??0)+(t.reasoningOutputTokens??0)),typeof n.totalTokenCount=="number"&&(t.totalTokens=n.totalTokenCount),typeof n.cachedContentTokenCount=="number"&&(t.cacheReadInputTokens=n.cachedContentTokenCount))}function T3(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 i of r?.content?.parts??[])n&&i.text&&t.responseTexts.push(i.text),i.functionCall&&t.toolCalls.push({type:"function",id:i.functionCall.id,name:i.functionCall.name,arguments:i.functionCall.args})}}function I3(e,t,n,r){!e||S3(e,r)||(E3(e,t),T3(e,t,n))}async function*Vl(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let i of e)I3(i,r,n,t),yield i}finally{ls(t,r,n)}}function Da(e,t="user"){return typeof e=="string"?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(n=>Da(n,t)):typeof e!="object"||!e?[]:"role"in e&&typeof e.role=="string"?[e]:"parts"in e?[{...e,role:t}]:[{role:t,content:e}]}function Qx(e,t){if("model"in e&&typeof e.model=="string")return e.model;if(t&&typeof t=="object"){let n=t;if("model"in n&&typeof n.model=="string")return n.model;if("modelVersion"in n&&typeof n.modelVersion=="string")return n.modelVersion}return"unknown"}function A3(e){let t={};return"temperature"in e&&typeof e.temperature=="number"&&(t[so]=e.temperature),"topP"in e&&typeof e.topP=="number"&&(t[co]=e.topP),"topK"in e&&typeof e.topK=="number"&&(t[Pd]=e.topK),"maxOutputTokens"in e&&typeof e.maxOutputTokens=="number"&&(t[Pa]=e.maxOutputTokens),"frequencyPenalty"in e&&typeof e.frequencyPenalty=="number"&&(t[ao]=e.frequencyPenalty),"presencePenalty"in e&&typeof e.presencePenalty=="number"&&(t[ka]=e.presencePenalty),t}function $d(e,t,n){let r={[jr]:qx,[st]:e,[S]:"auto.ai.google_genai"};if(t){if(r[Be]=Qx(t,n),"config"in t&&typeof t.config=="object"&&t.config){let i=t.config;if(Object.assign(r,A3(i)),"tools"in i&&Array.isArray(i.tools)){let o=i.tools.flatMap(s=>s.functionDeclarations);r[Zn]=JSON.stringify(o)}}}else r[Be]=Qx({},n);return r}function Yl(e,t,n,r){if(n==="embeddings"){let o=t.contents;o!=null&&e.setAttribute(fo,typeof o=="string"?o:JSON.stringify(o));return}let i=[];if("config"in t&&t.config&&typeof t.config=="object"&&"systemInstruction"in t.config&&t.config.systemInstruction&&i.push(...Da(t.config.systemInstruction,"system")),"history"in t&&i.push(...Da(t.history,"user")),"contents"in t&&i.push(...Da(t.contents,"user")),"message"in t&&i.push(...Da(t.message,"user")),Array.isArray(i)&&i.length){let{systemInstructions:o,filteredMessages:s}=Mn(i);o&&e.setAttribute(tn,o);let c=Array.isArray(s)?s.length:0;e.setAttributes({[xt]:c,[Wt]:r?Vt(s):Ue(s)})}}function Jd(e,t,n){if(!(!t||typeof t!="object")){if(t.modelVersion&&e.setAttribute(cn,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata=="object"){let r=t.usageMetadata,i=typeof r.candidatesTokenCount=="number"||typeof r.thoughtsTokenCount=="number";e.setAttributes(Kr(r.promptTokenCount,i?(r.candidatesTokenCount??0)+(r.thoughtsTokenCount??0):void 0,void 0,r.cachedContentTokenCount,r.totalTokenCount)),typeof r.thoughtsTokenCount=="number"&&e.setAttribute(rd,r.thoughtsTokenCount)}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let r=t.candidates.map(i=>i.content?.parts&&Array.isArray(i.content.parts)?i.content.parts.map(o=>typeof o.text=="string"?o.text:"").filter(o=>o.length>0).join(""):"").filter(i=>i.length>0);r.length>0&&e.setAttributes({[nn]:r.join("")})}if(n&&t.functionCalls){let r=t.functionCalls;Array.isArray(r)&&r.length>0&&e.setAttributes({[Sn]:JSON.stringify(r)})}}}function N3(e,t,n,r,i){let o=n.operation==="embeddings";return new Proxy(e,{apply(s,c,a){let l=n.operation||"unknown",p=a[0],u=$d(l,p,r),d=u[Be]??"unknown";return n.streaming?Le({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},async m=>{try{i.recordInputs&&p&&Yl(m,p,l,nt(i.enableTruncation));let _=await s.apply(r,a);return Vl(_,m,!!i.recordOutputs)}catch(_){throw m.setStatus({code:2,message:"internal_error"}),m.end(),_}}):Se({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},m=>(i.recordInputs&&p&&Yl(m,p,l,nt(i.enableTruncation)),lr(()=>s.apply(r,a),()=>{},()=>{},_=>{o||Jd(m,_,i.recordOutputs)})))}})}function Qy(e,t="",n){return new Proxy(e,{get:(r,i,o)=>{let s=Reflect.get(r,i,o),c=Gd(t,String(i)),a=Kx[c];if(typeof s=="function"&&a){let l=a.operation?N3(s,c,a,r,n):s.bind(r);return a.proxyResultPath?function(...p){let u=l(...p);return u&&typeof u=="object"?Qy(u,a.proxyResultPath,n):u}:l}return typeof s=="function"?s.bind(r):s&&typeof s=="object"?Qy(s,c,n):s}})}function zd(e,t){return Qy(e,"",Xe(t))}var Ba="LangChain",Ha="auto.ai.langchain",$x={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var Xn=(e,t,n)=>{n!=null&&(e[t]=n)},jl=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function Fa(e){if(Array.isArray(e))try{let t=e.map(n=>n&&typeof n=="object"&&go(n)?cs(n):n);return JSON.stringify(t)}catch{return String(e)}return Ue(e,String)}function Zl(e){let t=e.toLowerCase();return $x[t]??t}function Jx(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 $y(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function Xl(e){return e.map(t=>{let n=t._getType;if(typeof n=="function"){let i=n.call(t);return{role:Zl(i),content:Fa(t.content)}}if(t.lc===1&&t.kwargs){let i=t.id,o=Array.isArray(i)&&i.length>0?i[i.length-1]:"",s=typeof o=="string"?Jx(o):"user";return{role:Zl(s),content:Fa(t.kwargs?.content)}}if(t.type){let i=String(t.type).toLowerCase();return{role:Zl(i),content:Fa(t.content)}}if(t.role)return{role:Zl(String(t.role)),content:Fa(t.content)};let r=t.constructor?.name;return r&&r!=="Object"?{role:Zl(Jx(r)),content:Fa(t.content)}:{role:"user",content:Fa(t.content)}})}function R3(e,t,n){let r={},i="kwargs"in e?e.kwargs:void 0,o=t?.temperature??n?.ls_temperature??i?.temperature;jl(r,so,o);let s=t?.max_tokens??n?.ls_max_tokens??i?.max_tokens;jl(r,Pa,s);let c=t?.top_p??i?.top_p;jl(r,co,c);let a=t?.frequency_penalty;jl(r,ao,a);let l=t?.presence_penalty;return jl(r,ka,l),t&&"stream"in t&&Xn(r,xa,!!t.stream),r}function eP(e,t,n,r,i){return{[jr]:Ue(e??"langchain",String),[st]:"chat",[Be]:Ue(t,String),[S]:Ha,...R3(n,r,i)}}function tP(e,t,n,r,i,o){let s=o?.ls_provider,c=i?.model??o?.ls_model_name??"unknown",a=eP(s,c,e,i,o);if(n&&Array.isArray(t)&&t.length>0){Xn(a,xt,t.length);let l=t.map(p=>({role:"user",content:p}));Xn(a,Wt,r?Vt(l):Ue(l))}return a}function nP(e,t,n,r,i,o){let s=o?.ls_provider??e.id?.[2],c=i?.model??o?.ls_model_name??"unknown",a=eP(s,c,e,i,o);if(n&&Array.isArray(t)&&t.length>0){let l=Xl(t.flat()),{systemInstructions:p,filteredMessages:u}=Mn(l);p&&Xn(a,tn,p);let d=Array.isArray(u)?u.length:0;Xn(a,xt,d),Xn(a,Wt,r?Vt(u):Ue(u))}return a}function v3(e,t){let n=[],r=e.flat();for(let i of r){let s=i.message?.tool_calls;if(Array.isArray(s)&&s.length>0)n.push(...s);else{let c=i.message?.content;if(Array.isArray(c))for(let a of c){let l=a;l.type==="tool_use"&&n.push(l)}}}n.length>0&&Xn(t,Sn,Ue(n,String))}function Jy(e){let t=e.usage_metadata;if(B(t)){let i=B(t.input_token_details)?t.input_token_details:void 0;return Kr(t.input_tokens,t.output_tokens,i?.cache_creation,i?.cache_read,t.total_tokens)}let n=e.response_metadata,r=B(n)&&B(n.tokenUsage)?n.tokenUsage:void 0;return Kr(r?.promptTokens,r?.completionTokens,void 0,void 0,r?.totalTokens)}function O3(e,t){let n={},r={};for(let c of e.generations??[]){let a=c[0]?.message;if(a){let l=B(a.usage_metadata)?n:r;for(let[p,u]of Object.entries(Jy(a)))l[p]=(l[p]??0)+u}}Object.assign(t,Object.keys(n).length>0?n:r);let i=e.llmOutput;if(!i)return;let o=i.tokenUsage,s=i.usage;if(s&&Object.keys(n).length===0&&Object.keys(r).length===0){let{input_tokens:c,output_tokens:a,cache_creation_input_tokens:l,cache_read_input_tokens:p}=s;Object.assign(t,Kr(c!==void 0||l!==void 0||p!==void 0?(c??0)+(l??0)+(p??0):void 0,a,l,p))}else o&&Object.keys(n).length===0&&Object.keys(r).length===0&&Object.assign(t,Kr(o.promptTokens,o.completionTokens,void 0,void 0,o.totalTokens));s&&(typeof s.cache_creation_input_tokens=="number"&&!(Dr in t)&&(t[Dr]=s.cache_creation_input_tokens),typeof s.cache_read_input_tokens=="number"&&!(Br in t)&&(t[Br]=s.cache_read_input_tokens))}function rP(e,t){if(!e)return;let n={};if(Array.isArray(e.generations)){let l=e.generations.flat().map(p=>p.generationInfo?.finish_reason?p.generationInfo.finish_reason:p.generation_info?.finish_reason?p.generation_info.finish_reason:null).filter(p=>typeof p=="string");if(l.length>0&&Xn(n,Zr,Ue(l,String)),v3(e.generations,n),t){let p=e.generations.flat().map(u=>u.text??u.message?.content).filter(u=>typeof u=="string");p.length>0&&Xn(n,nn,Ue(p,String))}}O3(e,n);let r=e.llmOutput,o=e.generations?.[0]?.[0]?.message,s=r?.model_name??r?.model??o?.response_metadata?.model_name;s&&Xn(n,cn,s);let c=r?.id??o?.id;c&&Xn(n,lo,c);let a=r?.stop_reason??o?.response_metadata?.finish_reason;return a&&Xn(n,nx,Ue(a,String)),n}function em(e){let t={},n=e?.lc_agent_name;return typeof n=="string"&&(t[po]=n),t}function iP(e){let t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;let n=t.map(r=>{let i=r.function;return{type:"function",name:r.name??i?.name??"",description:r.description??i?.description}});return JSON.stringify(n)}function C3(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.addHandler=="function"&&typeof t.copy=="function"}function x3(e){return typeof e=="object"&&e?.name==="SentryCallbackHandler"}function zx(e){return e.some(x3)}function us(e,t){if(!e)return[t];if(C3(e)){if(zx(e.handlers??[]))return e;let r=e.copy();return r.addHandler(t,!0),r}let n=Array.isArray(e)?e:[e];return zx(n)?e:[...n,t]}function gr(e={}){let{recordInputs:t,recordOutputs:n}=Xe(e),r=nt(e.enableTruncation),i=new Map,o=c=>{let a=i.get(c);a?.isRecording()&&(a.end(),i.delete(c))},s={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(c,a,l,p,u,d,m,_){let h=$y(d),b=tP(c,a,t,r,h,m),v=b[Be],M=b[st];Le({name:`${M} ${v}`,op:"gen_ai.chat",attributes:{...em(m),...b,[H]:"gen_ai.chat"}},N=>(i.set(l,N),N))},handleChatModelStart(c,a,l,p,u,d,m,_){let h=$y(d),b=nP(c,a,t,r,h,m),v=iP(u);v&&(b[Zn]=v);let M=b[Be],N=b[st];Le({name:`${N} ${M}`,op:"gen_ai.chat",attributes:{...em(m),...b,[H]:"gen_ai.chat"}},R=>(i.set(l,R),R))},handleLLMEnd(c,a,l,p,u){let d=i.get(a);if(d?.isRecording()){let m=rP(c,n);m&&d.setAttributes(m),o(a)}},handleLLMError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(a))},handleChainStart(c,a,l,p,u,d,m,_){if(d?.__sentry_langgraph__)return;let h=_||c.name||"unknown_chain",b={[S]:"auto.ai.langchain","langchain.chain.name":h};t&&(b["langchain.chain.inputs"]=JSON.stringify(a)),Le({name:`chain ${h}`,op:"gen_ai.invoke_agent",attributes:{...b,[H]:"gen_ai.invoke_agent"}},v=>(i.set(l,v),v))},handleChainEnd(c,a){let l=i.get(a);l?.isRecording()&&(n&&l.setAttributes({"langchain.chain.outputs":JSON.stringify(c)}),o(a))},handleChainError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(a))},handleToolStart(c,a,l,p,u,d,m){if(d?.__sentry_langgraph__)return;let _=m||c.name||"unknown_tool",h={...em(d),[S]:Ha,[st]:"execute_tool",[Xr]:_};t&&(h[La]=a),Le({name:`execute_tool ${_}`,op:"gen_ai.execute_tool",attributes:{...h,[H]:"gen_ai.execute_tool"}},b=>(i.set(l,b),b))},handleToolEnd(c,a){let l=i.get(a);if(l?.isRecording()){if(n){let p=c,u=p&&typeof p=="object"&&"content"in p?p.content:c;l.setAttributes({[Ma]:typeof u=="string"?u:JSON.stringify(u)})}o(a)}},handleToolError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(a))},copy(){return s},toJSON(){return{lc:1,type:"not_implemented",id:s.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:s.lc_id}}};return s}function P3(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 k3(e){let t=e??{},n={[S]:Ha,[H]:wy,[st]:"embeddings",[Be]:t.model??"unknown"};return n[jr]=P3(t),"dimensions"in t&&(n[Ld]=t.dimensions),"encodingFormat"in t&&(n[kd]=t.encodingFormat),n}function tm(e,t,n={}){let{recordInputs:r}=Xe(n),i=k3(e),o=i[Be]||"unknown";return r&&t!=null&&(i[fo]=typeof t=="string"?t:JSON.stringify(t)),{name:`embeddings ${o}`,op:wy,attributes:i}}function oP(e,t={}){return new Proxy(e,{apply(n,r,i){return Se(tm(r,i[0],t),()=>Reflect.apply(n,r,i))}})}function nm(e,t){let n=e;return typeof n.embedQuery=="function"&&(n.embedQuery=oP(n.embedQuery,t)),typeof n.embedDocuments=="function"&&(n.embedDocuments=oP(n.embedDocuments,t)),e}var Wa="LangGraph",Kl="auto.ai.langgraph";function ql(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 Va(e){let t=e[0];return typeof t=="object"&&t&&"name"in t&&typeof t.name=="string"?t.name:null}function Ql(e,t,n){let r="__sentry_tool_wrapped__";for(let i of e){if(!i||typeof i!="object")continue;let o=i,s=o.invoke;if(typeof s!="function"||Object.prototype.hasOwnProperty.call(o,r))continue;let c=typeof o.name=="string"?o.name:"unknown_tool",a=typeof o.description=="string"?o.description:void 0,l=new Proxy(s,{apply(p,u,d){let m={[S]:Kl,[H]:Gy,[st]:"execute_tool",[Xr]:c,[Ml]:"function"},h=d[1]?.metadata?.lc_agent_name??n;typeof h=="string"&&(m[po]=h),a&&(m[wa]=a);let b=d[0];if(typeof b=="object"&&b&&("id"in b&&typeof b.id=="string"&&(m[Ll]=b.id),t.recordInputs)){let v="args"in b&&typeof b.args=="object"?b.args:b;try{m[La]=JSON.stringify(v)}catch{}}return Se({op:Gy,name:`execute_tool ${c}`,attributes:m},async v=>{try{let M=await Reflect.apply(p,u,d);if(t.recordOutputs)try{let N=M,R=N&&typeof N=="object"&&"content"in N?N.content:M;v.setAttribute(Ma,typeof R=="string"?R:JSON.stringify(R))}catch{}return M}catch(M){throw v.setStatus({code:2,message:"internal_error"}),M}})}});o.invoke=l,Object.defineProperty(o,r,{value:!0,enumerable:!1})}return e}function L3(e){if(!e||e.length===0)return null;let t=[];for(let n of e)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&t.push(...r)}return t.length>0?t:null}function M3(e){let t=Jy(e);return{inputTokens:t[At]??0,outputTokens:t[Ft]??0,totalTokens:t[jn]??0,cacheCreationInputTokens:t[Dr],cacheReadInputTokens:t[Br]}}function w3(e,t){let n=t;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&e.setAttribute(cn,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&e.setAttribute(Zr,[r.finish_reason])}}function sP(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(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function aP(e,t,n){let i=n?.messages;if(!i||!Array.isArray(i))return;let o=t?.length??0,s=i.length>o?i.slice(o):[];if(s.length===0)return;let c=L3(s);c&&e.setAttribute(Sn,JSON.stringify(c));let a=Xl(s);e.setAttribute(nn,JSON.stringify(a));let l=0,p=0,u=0,d,m;for(let _ of s){let h=M3(_);l+=h.inputTokens,p+=h.outputTokens,u+=h.totalTokens,h.cacheCreationInputTokens!==void 0&&(d=(d??0)+h.cacheCreationInputTokens),h.cacheReadInputTokens!==void 0&&(m=(m??0)+h.cacheReadInputTokens),w3(e,_)}l>0&&e.setAttribute(At,l),p>0&&e.setAttribute(Ft,p),u>0&&e.setAttribute(jn,u),d!==void 0&&e.setAttribute(Dr,d),m!==void 0&&e.setAttribute(Br,m)}var zy=!1,rm="__sentry_patched__";function im(e){let t={[S]:Kl,[H]:"gen_ai.create_agent",[st]:"create_agent"};return e&&(t[po]=e),{op:"gen_ai.create_agent",name:e?`create_agent ${e}`:"create_agent",attributes:t}}function eS(e,t){if(Object.prototype.hasOwnProperty.call(e,rm))return e;let n=gr(t),r=new Proxy(e,{apply(i,o,s){return zy?Reflect.apply(i,o,s):Se(im(),c=>{try{let a=Reflect.apply(i,o,s),l=s.length>0?s[0]:{};l?.name&&typeof l.name=="string"&&(c.setAttribute(po,l.name),c.updateName(`create_agent ${l.name}`));let p=a.invoke;return p&&typeof p=="function"&&(a.invoke=$l(p.bind(a),a,l,t,void 0,n)),a}catch(a){throw c.setStatus({code:2,message:"internal_error"}),a}})}});return Object.defineProperty(r,rm,{value:!0,enumerable:!1}),r}function $l(e,t,n,r,i,o){return new Proxy(e,{apply(s,c,a){let l=i?.modelName??i?.model;return Se({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[S]:Kl,[H]:sx,[st]:"invoke_agent"}},async p=>{try{let u=n?.name;u&&typeof u=="string"&&(p.setAttribute(ox,u),p.setAttribute(po,u),p.updateName(`invoke_agent ${u}`)),l&&p.setAttribute(Be,l);let _=(a.length>1?a[1]:void 0)?.configurable?.thread_id;if(_&&typeof _=="string"&&p.setAttribute(uo,_),o){let R=a[1]??{};a[1]=R;let P=R.metadata??{};R.metadata={...P,__sentry_langgraph__:!0,...typeof u=="string"?{lc_agent_name:u}:{}},R.callbacks=us(R.callbacks,o)}let h=sP(t);h&&p.setAttribute(Zn,JSON.stringify(h));let b=r.recordInputs,v=r.recordOutputs,M=a.length>0?a[0]?.messages??[]:[];if(M&&b){let R=Xl(M),{systemInstructions:P,filteredMessages:Y}=Mn(R);P&&p.setAttribute(tn,P);let T=nt(r.enableTruncation),G=Array.isArray(Y)?Y.length:0;p.setAttributes({[Wt]:T?Vt(Y):Ue(Y),[xt]:G})}let N=await Reflect.apply(s,c,a);return v&&aP(p,M??null,N),N}catch(u){throw p.setStatus({code:2,message:"internal_error"}),u}})}})}function tS(e,t){if(Object.prototype.hasOwnProperty.call(e,rm))return e;let n=Xe(t),r=gr(n),i=new Proxy(e,{apply(o,s,c){let a=ql(c),l=Va(c),p=c[0];p&&Array.isArray(p.tools)&&p.tools.length>0&&Ql(p.tools,n,l??void 0),zy=!0;let u;try{u=Reflect.apply(o,s,c)}finally{zy=!1}let d=u.invoke;if(d&&typeof d=="function"){let m={};l&&(m.name=l),u.invoke=$l(d.bind(u),u,m,n,a,r)}return u}});return Object.defineProperty(i,rm,{value:!0,enumerable:!1}),i}function Jl(e,t){return e.compile=eS(e.compile,Xe(t)),e}var cP=Jl;function lP(e,t,n){let r=n.getOptions(),i=n.getDsn(),o=r.tunnel,s=oa(r._metadata),c={sent_at:new Date(rt()).toISOString(),...G3(t)&&{trace:t},...s&&{sdk:s},...!!o&&i&&{dsn:sn(i)}},a=n.getDataCollectionOptions().userInfo?"auto":"never",l=[{type:"span",item_count:e.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...It()&&{ingest_settings:{infer_ip:a,infer_user_agent:a}},items:e}];return Gt(c,[l])}function G3(e){return!!e.trace_id&&!!e.public_key}function pP(e){let t=156;if(t+=e.name.length*2,t+=vh(e.attributes),e.links&&e.links.length>0){let r=e.links[0]?.attributes,i=100+(r?vh(r):0);t+=i*e.links.length}return t}var uP=1e3,U3=5e6,om=class{constructor(t,n){this._traceBuckets=new Map,this._client=t;let{maxSpanLimit:r,flushInterval:i,maxTraceWeightInBytes:o}=n??{};this._maxSpanLimit=r&&r>0&&r<=uP?r:uP,this._flushInterval=i&&i>0?i:5e3,this._maxTraceWeight=o&&o>0?o:U3,this._client.on("flush",()=>{this.drain()}),this._client.on("close",()=>{this._traceBuckets.forEach(s=>{clearTimeout(s.timeout)}),this._traceBuckets.clear()})}add(t){let n=t.trace_id,r=this._traceBuckets.get(n);r||(r={spans:new Set,size:0,timeout:Pn(setTimeout(()=>{this.flush(n)},this._flushInterval))},this._traceBuckets.set(n,r)),r.spans.add(t),r.size+=pP(t),(r.spans.size>=this._maxSpanLimit||r.size>=this._maxTraceWeight)&&this.flush(n)}drain(){this._traceBuckets.size&&(E&&g.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((t,n)=>{this.flush(n)}))}flush(t){let n=this._traceBuckets.get(t);if(!n)return;if(!n.spans.size){this._removeTrace(t);return}let r=Array.from(n.spans),i=r[0]?._segmentSpan;if(!i){E&&g.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}let o=it(i),s=r.map(a=>{let{_segmentSpan:l,...p}=a;return p}),c=lP(s,o,this._client);E&&g.log(`Sending span envelope for trace ${t} with ${s.length} spans`),this._client.sendEnvelope(c).then(null,a=>{E&&g.error("Error while sending streamed span envelope:",a)}),this._removeTrace(t)}_removeTrace(t){let n=this._traceBuckets.get(t);n&&clearTimeout(n.timeout),this._traceBuckets.delete(t)}};var zl=()=>({name:"SpanStreaming",setup(e){let t="SpanStreaming integration requires",n="Falling back to static trace lifecycle.",r=e.getOptions();if(!ot(e)){r.traceLifecycle="static",E&&g.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let i=r.beforeSendSpan;if(i&&!Ti(i)){r.traceLifecycle="static",E&&g.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let o=new om(e);e.on("afterSpanEnd",s=>{zt(s)&&o.add(Nb(s,e))})}});function ep(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}function tp(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 jt=class{constructor(t){this._maxSize=t,this._cache=new Map}get size(){return this._cache.size}get(t){let n=this._cache.get(t);if(n!==void 0)return this._cache.delete(t),this._cache.set(t,n),n}set(t,n){if(this._cache.size>=this._maxSize){let r=this._cache.keys().next().value;this._cache.delete(r)}this._cache.set(t,n)}remove(t){let n=this._cache.get(t);return n&&this._cache.delete(t),n}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let t=[];return this._cache.forEach(n=>t.push(n)),t}};function dP(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 np=class extends gd{constructor(t){dP(t),t.traceLifecycle==="stream"&&!t.integrations.some(n=>n.name==="SpanStreaming")&&t.integrations.push(zl()),super(t),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(t,n){let r=wC(this,this._options.stackParser,t,n);return r.level="error",Ci(r)}eventFromMessage(t,n="info",r){return Ci(GC(this._options.stackParser,t,n,r,this._options.attachStacktrace))}captureException(t,n,r){return mP(n),super.captureException(t,n,r)}captureEvent(t,n,r){return!t.type&&t.exception?.values&&t.exception.values.length>0&&mP(n),super.captureEvent(t,n,r)}captureCheckIn(t,n,r){let i="checkInId"in t&&t.checkInId?t.checkInId:ut();if(!this._isEnabled())return E&&g.warn("SDK not enabled, will not capture check-in."),i;let o=this.getOptions(),{release:s,environment:c,tunnel:a}=o,l={check_in_id:i,monitor_slug:t.monitorSlug,status:t.status,release:s,environment:c};"duration"in t&&(l.duration=t.duration),n&&(l.monitor_config={schedule:n.schedule,checkin_margin:n.checkinMargin,max_runtime:n.maxRuntime,timezone:n.timezone,failure_issue_threshold:n.failureIssueThreshold,recovery_threshold:n.recoveryThreshold});let[p,u]=Sa(this,r);u&&(l.contexts={trace:u});let d=EC(l,p,this.getSdkMetadata(),a,this.getDsn());return E&&g.log("Sending checkin:",t.monitorSlug,t.status),this.sendEnvelope(d),i}registerCleanup(t){this._disposeCallbacks.push(t)}dispose(){E&&g.log("Disposing client...");for(let t of this._disposeCallbacks)try{t()}catch{}this._disposeCallbacks.length=0;for(let t of Object.keys(this._hooks))this._hooks[t]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Ia(Al)}_prepareEvent(t,n,r,i){return this._options.platform&&(t.platform=t.platform||this._options.platform),this._options.runtime&&(t.contexts={...t.contexts,runtime:t.contexts?.runtime||this._options.runtime}),this._options.serverName&&(t.server_name=t.server_name||this._options.serverName),super._prepareEvent(t,n,r,i)}_setUpMetricsProcessing(){this.on("processMetric",t=>{this._options.serverName&&(t.attributes={"server.address":this._options.serverName,...t.attributes})})}};function mP(e){let t=$().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!=="crashed"?t.status="errored":n||(t.status="crashed")}}var fP={mechanism:{handled:!1,type:"auto.rpc.trpc.middleware"}};function D3(e){typeof e=="object"&&e!==null&&"ok"in e&&!e.ok&&"error"in e&&ge(e.error,fP)}function nS(e={}){return async function(t){let{path:n,type:r,next:i,rawInput:o,getRawInput:s}=t,c=O(),a=c?.getOptions(),l=c?.getDataCollectionOptions(),p={procedure_path:n,procedure_type:r};if(Tv(p,1+(a?.normalizeDepth??5)),(e.attachRpcInput!==void 0?e.attachRpcInput:l?.httpBodies.includes("incomingRequest"))&&(o!==void 0&&(p.input=qe(o)),s!==void 0&&typeof s=="function"))try{let u=await s();p.input=qe(u)}catch{}return or(u=>(u.setContext("trpc",p),Le({name:`trpc/${n}`,op:"rpc.server",attributes:{[ve]:"route",[S]:"auto.rpc.trpc"},forceTransaction:!!e.forceTransaction},async d=>{try{let m=await i();return D3(m),d.end(),m}catch(m){throw ge(m,fP),d.end(),m}})))}}function Li(e,t,n){try{if(!O())return;let i=Q();i?.isRecording()&&i.setStatus({code:2,message:"internal_error"}),ge(e,{mechanism:{type:"auto.ai.mcp_server",handled:!1,data:{error_type:t||"handler_execution",...n}}})}catch{}}function Ya(e,t){Mt(e,t,n=>function(r,...i){let o=i[i.length-1];if(typeof o!="function")return n.call(this,r,...i);let s=rp(o,t,r);return n.call(this,r,...i.slice(0,-1),s)})}function rp(e,t,n){return function(...r){try{return B3.call(this,e,t,n,r)}catch(i){return E&&g.warn("MCP handler wrapping failed:",i),e.apply(this,r)}}}function B3(e,t,n,r){try{let i=e.apply(this,r);return B(i)&&typeof i.then=="function"?Promise.resolve(i).catch(o=>{throw gP(o,t,n),o}):i}catch(i){throw gP(i,t,n),i}}function gP(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")?Li(e,"validation",r):e.name==="ServerTimeoutError"||e.message.includes("timed out")||e.message.includes("timeout")?Li(e,"timeout",r):Li(e,"tool_execution",r)):t==="resource"||t==="registerResource"?(r.resource_uri=n,Li(e,"resource_execution",r)):(t==="prompt"||t==="registerPrompt")&&(r.prompt_name=n,Li(e,"prompt_execution",r))}catch{}}function H3(e){typeof e.tool=="function"&&Ya(e,"tool"),typeof e.registerTool=="function"&&Ya(e,"registerTool")}function F3(e){typeof e.resource=="function"&&Ya(e,"resource"),typeof e.registerResource=="function"&&Ya(e,"registerResource")}function W3(e){typeof e.prompt=="function"&&Ya(e,"prompt"),typeof e.registerPrompt=="function"&&Ya(e,"registerPrompt")}function _P(e){H3(e),F3(e),W3(e)}function hP(e){let t=e,n=t._registeredTools;if(B(n))for(let[s,c]of Object.entries(n))typeof c.executor=="function"&&(c.executor=rp(c.executor,"registerTool",s));let r=t._registeredResources;if(B(r))for(let[s,c]of Object.entries(r))typeof c.readCallback=="function"&&(c.readCallback=rp(c.readCallback,"registerResource",s));let i=t._registeredResourceTemplates;if(B(i))for(let[s,c]of Object.entries(i))typeof c.readCallback=="function"&&(c.readCallback=rp(c.readCallback,"registerResource",s));let o=t._registeredPrompts;if(B(o))for(let[s,c]of Object.entries(o))typeof c.handler=="function"&&(c.handler=rp(c.handler,"registerPrompt",s))}var rS="mcp.method.name",bP="mcp.request.id",yP="mcp.session.id",SP="mcp.transport",iS="mcp.server.name",oS="mcp.server.title",sS="mcp.server.version",ja="mcp.protocol.version",EP="mcp.tool.name",_o="mcp.resource.uri",TP="mcp.prompt.name",IP="mcp.tool.result.is_error",AP="mcp.tool.result.content_count",NP="mcp.prompt.result.description",RP="mcp.prompt.result.message_count",sm="mcp.request.argument",vP="mcp.logging.level",OP="mcp.logging.logger",CP="mcp.logging.data_type",xP="mcp.logging.message",PP="network.transport",kP="network.protocol.version",am="client.address",cm="client.port",aS="mcp.server",LP="mcp.notification.client_to_server",MP="mcp.notification.server_to_client",wP="auto.function.mcp_server",cS="auto.mcp.notification",GP="route";function UP(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&"id"in e}function lS(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&!("id"in e)}function DP(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"id"in e&&("result"in e||"error"in e)}function BP(e){return B(e)&&"connect"in e&&("tool"in e&&"resource"in e&&"prompt"in e||"registerTool"in e&&"registerResource"in e&&"registerPrompt"in e)?!0:(E&&g.warn("Did not patch MCP server. Interface is incompatible."),!1)}function ln(e){return B(e)}function V3(e,t){let n={[AP]:e.length};for(let[r,i]of e.entries()){if(!ln(i))continue;let o=e.length===1?"mcp.tool.result":`mcp.tool.result.${r}`;if(typeof i.type=="string"&&(n[`${o}.content_type`]=i.type),t){let s=(a,l)=>{typeof l=="string"&&(n[`${o}.${a}`]=l)};s("mime_type",i.mimeType),s("uri",i.uri),s("name",i.name),typeof i.text=="string"&&(n[`${o}.content`]=i.text),typeof i.data=="string"&&(n[`${o}.data_size`]=i.data.length);let c=i.resource;ln(c)&&(s("resource_uri",c.uri),s("resource_mime_type",c.mimeType))}}return n}function HP(e,t){if(!ln(e))return{};let n=Array.isArray(e.content)?V3(e.content,t):{};return typeof e.isError=="boolean"&&(n[IP]=e.isError),n}function FP(e,t){let n={};if(!ln(e))return n;if(t&&typeof e.description=="string"&&(n[NP]=e.description),Array.isArray(e.messages)&&(n[RP]=e.messages.length,t)){let r=e.messages;for(let[i,o]of r.entries()){if(!ln(o))continue;let s=r.length===1?"mcp.prompt.result":`mcp.prompt.result.${i}`;if(((a,l)=>{if(typeof l=="string"){let p=r.length===1?`${s}.message_${a}`:`${s}.${a}`;n[p]=l}})("role",o.role),ln(o.content)){let a=o.content;if(typeof a.text=="string"){let l=r.length===1?`${s}.message_content`:`${s}.content`;n[l]=a.text}}}}return n}var pS=new Map,WP=new WeakMap;function lm(e){let t=e.sessionId;return t?pS.get(t):WP.get(e)}function Y3(e,t){let n=e.sessionId;n?pS.set(n,t):WP.set(e,t)}function pm(e,t){let n=lm(e)||{};Y3(e,{...n,...t})}function VP(e){return lm(e)?.clientInfo}function YP(e){return lm(e)?.protocolVersion}function jP(e){return lm(e)}function ZP(e){let t=e.sessionId;t&&pS.delete(t)}var XP="io.modelcontextprotocol/protocolVersion",KP="io.modelcontextprotocol/clientInfo",qP="io.modelcontextprotocol/serverInfo";function um(e){let t={};return ln(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 QP(e){let t={};return ln(e.params)&&(typeof e.params.protocolVersion=="string"&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=um(e.params.clientInfo))),t}function $P(e){let t={};if(ln(e.params)&&ln(e.params._meta)){let n=e.params._meta;typeof n[XP]=="string"&&(t.protocolVersion=n[XP]),n[KP]&&(t.clientInfo=um(n[KP]))}return t}function JP(e){let t={};return ln(e)&&(typeof e.protocolVersion=="string"&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=um(e.serverInfo))),t}function zP(e){let t={};return ln(e)&&ln(e._meta)&&e._meta[qP]&&(t.serverInfo=um(e._meta[qP])),t}function j3(e){let t=VP(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 ek(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 Z3(e){let t=jP(e)?.serverInfo,n={};return t?.name&&(n[iS]=t.name),t?.title&&(n[oS]=t.title),t?.version&&(n[sS]=t.version),n}function tk(e){let t={};return e?.name&&(t[iS]=e.name),e?.title&&(t[oS]=e.title),e?.version&&(t[sS]=e.version),t}function X3(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 K3(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 uS(e,t){let n=e&&"sessionId"in e?e.sessionId:void 0,r=t?X3(t):{},{mcpTransport:i,networkTransport:o}=K3(e),s=j3(e),c=Z3(e),a=YP(e);return{...n&&{[yP]:n},...r.address&&{[am]:r.address},...r.port&&{[cm]:r.port},[SP]:i,[PP]:o,[kP]:"2.0",...a&&{[ja]:a},...s,...c}}var dm=new Map,dS=new WeakMap;function nk(e){let t=e.sessionId;if(t){let r=dm.get(t);return r||(r=new Map,dm.set(t,r)),r}let n=dS.get(e);return n||(n=new Map,dS.set(e,n)),n}function rk(e,t,n,r,i){nk(e).set(t,{span:n,method:r,capturePolicy:i,startTime:Date.now()})}function ik(e,t,n,r=!1){let i=nk(e),o=i.get(t);if(o){let{span:s,method:c}=o,a=c==="initialize"?JP(n):zP(n);(a.protocolVersion||a.serverInfo)&&pm(e,a);let l={...tk(a.serverInfo)};if(a.protocolVersion&&(l[ja]=a.protocolVersion),Object.keys(l).length>0&&s.setAttributes(l),r)s.setStatus({code:2,message:"internal_error"});else if(c==="tools/call"){let p=HP(n,o.capturePolicy.recordOutputs);s.setAttributes(p)}else if(c==="prompts/get"){let p=FP(n,o.capturePolicy.recordOutputs);s.setAttributes(p)}s.end(),i.delete(t)}}function ok(e){let t=e.sessionId;if(t){let r=dm.get(t);if(r){for(let[,i]of r)i.span.setStatus({code:2,message:"cancelled"}),i.span.end();dm.delete(t)}return}let n=dS.get(e);if(n){for(let[,r]of n)r.span.setStatus({code:2,message:"cancelled"}),r.span.end();n.clear()}}var sk={"tools/call":{targetField:"name",targetAttribute:EP,captureArguments:!0,argumentsField:"arguments"},"resources/read":{targetField:"uri",targetAttribute:_o,captureUri:!0},"resources/subscribe":{targetField:"uri",targetAttribute:_o},"resources/unsubscribe":{targetField:"uri",targetAttribute:_o},"prompts/get":{targetField:"name",targetAttribute:TP,captureName:!0,captureArguments:!0,argumentsField:"arguments"}};function ip(e,t){let n=sk[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 ak(e,t){let n={},r=sk[e];if(!r)return n;if(r.captureArguments&&r.argumentsField&&t?.[r.argumentsField]){let i=t[r.argumentsField];if(B(i))for(let[o,s]of Object.entries(i))n[`${sm}.${o.toLowerCase()}`]=JSON.stringify(s)}return r.captureUri&&t?.uri&&(n[`${sm}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${sm}.name`]=JSON.stringify(t.name)),n}function q3(e){return typeof e=="string"?e:JSON.stringify(e)}function Q3(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[vP]=String(t.level)),t?.logger&&(r[OP]=String(t.logger)),t?.data!==void 0&&(r[CP]=typeof t.data,n&&(r[xP]=q3(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[_o]=String(t.uri);let i=fr(String(t.uri));i&&!mr(i)&&(r["mcp.resource.protocol"]=i.protocol.replace(":",""))}break;case"notifications/initialized":r["mcp.lifecycle.phase"]="initialization_complete",r["mcp.protocol.ready"]=1;break}return r}function mS(e,t,n,r){if(e==="request"){let i=t,o=ip(i.method,n||{});return{...i.id!==void 0&&{[bP]:String(i.id)},...o.attributes,...r?ak(i.method,n||{}):{}}}return Q3(t.method,n||{},r)}var $3=new Set([am,cm,_o]);function J3(e){return $3.has(e)}function fS(e,t){return t?e:Object.entries(e).reduce((n,[r,i])=>(J3(r)||(n[r]=i),n),{})}function ck(e,t){return t?`${e} ${t}`:e}function lk(e){let t,n;switch(e){case"request":t=aS,n=wP;break;case"notification-incoming":t=LP,n=cS;break;case"notification-outgoing":t=MP,n=cS;break}return{[H]:t,[S]:n,[ve]:GP}}function pk(e){let{type:t,message:n,transport:r,extra:i,callback:o,options:s}=e,{method:c}=n,a=n.params,l;if(t==="request"){let _=ip(c,a||{});l=ck(c,_.target)}else l=c;let p={...uS(r,i),[rS]:c,...mS(t,n,a,s?.recordInputs),...lk(t)},d=!!O()?.getDataCollectionOptions().userInfo,m=fS(p,d);return Se({name:l,forceTransaction:!0,attributes:m},o)}function uk(e,t,n,r,i){return pk({type:"notification-incoming",message:e,transport:t,extra:n,callback:i,options:r})}function dk(e,t,n,r){return pk({type:"notification-outgoing",message:e,transport:t,options:n,callback:r})}function mk(e,t,n,r){let{method:i}=e,o=e.params,s=ip(i,o||{}),c=ck(i,s.target),a={...uS(t,n),[rS]:i,...mS("request",e,o,r?.recordInputs),...lk("request")},p=!!O()?.getDataCollectionOptions().userInfo,u=fS(a,p);return{name:c,op:aS,forceTransaction:!0,attributes:u}}function gS(e){if(e.recordInputs!==void 0&&e.recordOutputs!==void 0)return{recordInputs:e.recordInputs,recordOutputs:e.recordOutputs};let t=O()?.getDataCollectionOptions().genAI;return{recordInputs:e.recordInputs??t?.inputs??!1,recordOutputs:e.recordOutputs??t?.outputs??!1}}function fk(e,t){e.onmessage&&Mt(e,"onmessage",n=>function(r,i){let o=UP(r)?r:void 0,s=lS(r)?r:void 0,c=o||s,a;if(c)try{a=o?.method==="initialize"?QP(o):$P(c),(a.protocolVersion||a.clientInfo)&&pm(e,a)}catch{}if(o){let l=gS(t),p=$().clone();return or(p,()=>{let u=mk(o,e,i,l),d=L(u);return o.method==="initialize"&&a&&d.setAttributes({...ek(a.clientInfo),...a.protocolVersion&&{[ja]:a.protocolVersion}}),rk(e,o.id,d,o.method,l),se(d,()=>n.call(this,o,i))})}if(s){let l=gS(t);return uk(s,e,i,l,()=>n.call(this,s,i))}return n.call(this,r,i)})}function gk(e,t){e.send&&Mt(e,"send",n=>async function(...r){let[i]=r;if(lS(i)){let o=gS(t);return dk(i,e,o,()=>n.call(this,...r))}return DP(i)&&i.id!==null&&i.id!==void 0&&(i.error&&z3(i.error),ik(e,i.id,i.result,!!i.error)),n.call(this,...r)})}function _k(e){e.onclose&&Mt(e,"onclose",t=>function(...n){return ok(e),ZP(e),t.call(this,...n)})}function hk(e){e.onerror&&Mt(e,"onerror",t=>function(n){return eZ(n),t.call(this,n)})}function z3(e){try{if(B(e)&&"code"in e&&"message"in e){let t=e;if(t.code===-32603||t.code>=-32099&&t.code<=-32e3){let r=new Error(t.message);r.name=`JsonRpcError_${t.code}`,Li(r,"protocol")}}}catch{}}function eZ(e){try{Li(e,"transport")}catch{}}var bk=new WeakSet;function _S(e,t){if(bk.has(e)||!BP(e))return e;let n=e,r={...t};return Mt(n,"connect",i=>async function(o,...s){let c=await i.call(this,o,...s);return fk(o,r),gk(o,r),_k(o),hk(o),c}),_P(n),hP(n),bk.add(e),e}function Ek(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 Tk(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let o=i.match(r);if(o)return{filename:`<data:${o[2]}>`,function:o[1]};let s=i.match(n);if(s){let c,a,l,p,u;if(s[1]){l=s[1];let h=l.lastIndexOf(".");if(l[h-1]==="."&&h--,h>0){c=l.slice(0,h),a=l.slice(h+1);let b=c.indexOf(".Module");b>0&&(l=l.slice(b+1),c=c.slice(0,b))}p=void 0}a&&(p=c,u=a),a==="<anonymous>"&&(u=void 0,l=void 0),l===void 0&&(u=u||"?",l=p?`${p}.${u}`:u);let d=gv(s[2]),m=s[5]==="native";!d&&s[5]&&!m&&(d=s[5]);let _=d?tZ(d):void 0;return{filename:_??d,module:_&&e?.(_),function:l,lineno:yk(s[3]),colno:yk(s[4]),in_app:Ek(d||"",m)}}if(i.match(t))return{filename:i}}}function hS(e){return[90,Tk(e)]}function yk(e){return parseInt(e||"",10)||void 0}function tZ(e){try{return decodeURI(e)}catch{return}}var mm=new WeakMap,Ik=(e,t)=>{let n=mm.get(e);n?n.push(t):mm.set(e,[t])},op=e=>{let t=mm.get(e);return t||(t=[],mm.set(e,t)),t};var ds="express.name",Ak="http.route",ms="express.type",fm="router",Nk="middleware",Rk="request_handler";var bS=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function nZ(e){return e.includes(":")||e.includes("*")}var Ok=(e,t,n)=>{if(t.name==="router"){let r=Ck("",t),i=r||n||e||"/";return{attributes:{[ds]:i,[ms]:fm},name:`router - ${i}`}}else return t.name==="bound dispatch"||t.name==="handle"?{attributes:{[ds]:(e||n)??"request handler",[ms]:Rk},name:`request handler${t.path?` - ${e||n}`:""}`}:{attributes:{[ds]:t.name,[ms]:Nk},name:`middleware - ${t.name}`}},Ck=(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)?Ck(e,n):e},xk=(e,t,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(t))return!0;if(!Array.isArray(n?.ignoreLayers))return!1;try{return _n(e,n.ignoreLayers,!0)}catch{}return!1};function Pk(e,t){let n=op(e);if(n.length===0)return;if(n.every(o=>o==="/"))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)||nZ(r))?r:void 0}function kk(e){let t=op(e),n="";for(let r of t)r==="/"||r==="/*"||(n+=!n||n.endsWith("/")?r:`/${r}`);return n.replace(/\/{2,}/g,"/")}var gm=e=>{let t=e[0];return Array.isArray(t)?t.map(n=>vk(n)||"").join(","):vk(t)},vk=e=>typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0,_m=e=>Lk(e?.Router?.prototype),Lk=e=>(typeof e=="object"||typeof e=="function")&&!!e&&"route"in e&&typeof e.route=="function",Mk=e=>Lk(e.Router)&&!_m(e);function rZ(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function wk(e){return rZ(e)>=500}function sp(e){if(!$()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let n=as(e);$().setSDKProcessingMetadata({normalizedRequest:n})}}function hm(e,t,n){if(!t?.handle)return;let r=t,i=r.handle;if(vr(i)||i.length===4)return;function o(s,c,...a){let l=e();sp(s);let p=Q();if(!p)return i.apply(this,[s,c,...a]);n&&Ik(s,n);let u=op(s),d=!!n,m=kk(s),_=Pk(s,m);l.onRouteResolved?.(_);let h=Ok(m,r,n),b=h.attributes[ds],v=h.attributes[ms],M=Object.assign(h.attributes,{[S]:"auto.http.express",[H]:`${v}.express`});if(_&&(M[Ak]=_),xk(h.attributes[ds],v,l))return d&&u.pop(),i.apply(this,[s,c,...a]);let N=$();if(N!==vt()){if(v==="request_handler"){let R=s.method?s.method.toUpperCase():"GET";N.setTransactionName(`${R} ${m}`)}}else E&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName");return Le({name:b,attributes:M},R=>{let P=!1;h.attributes[ms]===fm&&(R.end(),P=!0);let Y=()=>{c.removeListener("finish",T),c.removeListener("close",G)},T=()=>{Y(),P||(P=!0,R.end())},G=()=>{Y(),P||(P=!0,R.setStatus({code:2,message:"cancelled"}),R.end())};for(let k=0;k<a.length;k++){let U=a[k];if(typeof U=="function"){a[k]=function(...ae){let ue=ae[0],Ne=!!ue&&ue!=="route"&&ue!=="router";if(!P&&Ne){let[Te,Ce]=bS(ue);R.setStatus({code:2,message:Ce})}return P||(P=!0,Y(),R.end()),!(s.route&&Ne)&&d&&u.pop(),se(p,()=>U.apply(this,ae))};break}}try{return i.apply(this,[s,c,...a])}catch(k){let[U,ae]=bS(k);throw R.setStatus({code:2,message:ae}),k}finally{P||(c.once("finish",T),c.once("close",G))}})}for(let s in i)s in o||Object.defineProperty(o,s,{get(){return i[s]},set(c){i[s]=c}});Wo(o,i),Object.defineProperty(r,"handle",{enumerable:!0,configurable:!0,writable:!0,value:o})}function bm(e){return!!e&&typeof e=="object"&&"default"in e&&e.default||e}function iZ(e){return!!e.express}var Gk=!1;function oZ(){Gk||(Gk=!0,E&&g.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function yS(e,t){let n,r;if(!t&&iZ(e)){let{express:p,...u}=e;r=p,n=()=>u,oZ()}else{if(typeof t!="function")throw new TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");n=t,r=e}let i=bm(r),o=_m(i)?i.Router.prototype:Mk(i)?i.Router:void 0;if(!o)throw new TypeError("no valid Express route function to instrument");let s=o.route;try{Zs(o,"route",function(...u){let d=s.apply(this,u),m=this.stack[this.stack.length-1];return hm(n,m,gm(u)),d})}catch(p){E&&g.error("Failed to patch express route method:",p)}let c=o.use;try{Zs(o,"use",function(...u){let d=c.apply(this,u),m=this.stack[this.stack.length-1];return m&&hm(n,m,gm(u)),d})}catch(p){E&&g.error("Failed to patch express use method:",p)}let{application:a}=i,l=a.use;try{Zs(a,"use",function(...u){let d=l.apply(this,u),m=_m(i)?this.router:this._router;if(m){let _=m.stack[m.stack.length-1];_&&hm(n,_,gm(u))}return d})}catch(p){E&&g.error("Failed to patch express application.use method:",p)}return i}function sZ(){return O()?.getIntegrationByName("Express")?.getShouldHandleError?.()}function SS(e){return function(n,r,i,o){sp(r);let s=e?.shouldHandleError??sZ()??wk;if(s===!1){o(n);return}if(s(n)){let c=ge(n,{mechanism:{type:"auto.middleware.express",handled:!1}});i.sentry=c}o(n)}}function ES(e,t){e.use(aZ()),e.use(SS(t))}function aZ(){return function(t,n,r){sp(t),r()}}var cZ=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,ym=Symbol("sentryPostgresConnectionContext"),TS=Symbol.for("sentry.instrumented.postgresjs"),lZ=Symbol.for("sentry.query.from.instrumented.sql");function NS(e,t){return!e||typeof e!="function"?(E&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),e):AS(e,{requireParentSpan:!0,...t})}function AS(e,t,n){if(e[TS])return e;let r=new Proxy(e,{apply(i,o,s){let c=Reflect.apply(i,o,s);return B(c)&&"handle"in c&&Uk(c,r,t),c},get(i,o){let s=i[o];return typeof o!="string"||typeof s!="function"?s:o==="unsafe"||o==="file"?pZ(s,i,r,t):o==="begin"||o==="reserve"?uZ(s,i,r,t):s}});return n?r[ym]=n:mZ(e,r),e[TS]=!0,r[TS]=!0,r}function pZ(e,t,n,r){return function(...i){let o=Reflect.apply(e,t,i);return B(o)&&"handle"in o&&Uk(o,n,r),o}}function uZ(e,t,n,r){return function(...i){let o=n[ym];if(!(typeof i[i.length-1]=="function")){let p=Reflect.apply(e,t,i);return p&&typeof p.then=="function"?p.then(u=>AS(u,r,o)):p}let c=i.length===1?i[0]:i[1],a=function(p){let u=AS(p,r,o);return c(u)},l=i.length===1?[a]:[i[0],a];return Reflect.apply(e,t,l)}}function Uk(e,t,n){if(e.handle?.__sentryWrapped)return;e[lZ]=!0;let r=e.handle,i=async function(...o){if(this.executed||!dZ(n))return r.apply(this,o);let s=Sm(e.strings),c=Xa(s);return Le({name:c||"postgresjs.query",op:"db"},a=>{a.setAttribute(S,"auto.db.postgresjs"),a.setAttributes({"db.system.name":"postgres","db.query.text":c});let l=t?t[ym]:void 0;if(Em(a,l),n.requestHook)try{n.requestHook(a,c,l)}catch(u){a.setAttribute("sentry.hook.error","requestHook failed"),E&&g.error("Error in requestHook for PostgresJs instrumentation:",u)}let p=this;p.resolve=new Proxy(p.resolve,{apply:(u,d,m)=>{try{Za(a,c,m?.[0]?.command),a.end()}catch(_){E&&g.error("Error ending span in resolve callback:",_)}return Reflect.apply(u,d,m)}}),p.reject=new Proxy(p.reject,{apply:(u,d,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute("db.response.status_code",m?.[0]?.code||"unknown"),a.setAttribute("error.type",m?.[0]?.name||"unknown"),Za(a,c),a.end()}catch(_){E&&g.error("Error ending span in reject callback:",_)}return Reflect.apply(u,d,m)}});try{return r.apply(this,o)}catch(u){throw a.setStatus({code:2,message:u instanceof Error?u.message:"unknown_error"}),a.end(),u}})};i.__sentryWrapped=!0,e.handle=i}function dZ(e){return Q()!==void 0||!e.requireParentSpan}function Sm(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((t,n,r)=>r===0?n:`${t}$${r}${n}`,"")}var IS;function Xa(e){return e?(IS||(IS=new 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(IS,"?").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 Em(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 Za(e,t,n){if(n){e.setAttribute("db.operation.name",n);return}let r=t?.match(cZ);r?.[1]&&e.setAttribute("db.operation.name",r[1].toUpperCase())}function Tm(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 mZ(e,t){let n=e;!n.options||typeof n.options!="object"||(t[ym]=Tm(n.options))}var Jr="@sentry/instrumentation-http",zr="http.client.request.created",Ka="http.server.request.start";function Im(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 RS(e){try{return String(Dk(e))}catch{return""}}function Dk(e){let t=e.protocol||"http:",r=e.headers?.host&&String(e.headers?.host)||e.hostname||e.host||"",i=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(r)?"":`:${e.port}`,o=e.path?e.path:"/",s=`${t}//${r}${i}`;return new URL(o.startsWith("//")?`${s}${o}`:o,s)}function _r(e){return String(RS(Im(e)))}function Bk(e,t){let n=_r(e),r=ro(n),i=t?.statusCode,o=ep(i);an({category:"http",data:{status_code:i,url:io(r),"http.method":e.method||"GET",...r.search?{"http.query":Yn(r.search)}:{},...r.hash?{"http.fragment":r.hash}:{}},type:"http",level:o},{event:"response",request:e,response:t})}function Hk(e){let t=_r(e),[n,r]=oy(fr(t),"client","auto.http.client",e),i=e.getHeader("user-agent");return{name:n,attributes:{[H]:"http.client","otel.kind":"CLIENT","http.url":Ct(t),"http.method":e.method,"http.target":Ct(e.path||"/"),"net.peer.name":e.host,"http.host":e.getHeader("host"),...i?{"user_agent.original":i}:{},...r},onlyIfParent:!0}}function Fk(e,t){let{statusCode:n,statusMessage:r,httpVersion:i,socket:o}=e,s=i?.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp";t.setAttributes({"http.response.status_code":n,"network.protocol.version":i,"http.flavor":i,"network.transport":s,"net.transport":s,"http.status_text":r?.toUpperCase(),"http.status_code":n,...gZ(e),...fZ(o)})}function fZ(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 gZ(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 Am(e,t){let n=_r(e),r=O()?.getOptions(),{tracePropagationTargets:i,propagateTraceparent:o}=r??{};if(!ss(n,i,t)||!!e.getHeader("sentry-trace"))return;let c=tt({propagateTraceparent:o});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c;if(a)try{e.setHeader("sentry-trace",a),E&&g.log(Jr,"Added sentry-trace header")}catch(u){E&&g.error(Jr,"Failed to set sentry-trace header:",ze(u)?u.message:"Unknown error")}if(p&&!e.getHeader("traceparent"))try{e.setHeader("traceparent",p),E&&g.log(Jr,"Added traceparent header")}catch(u){E&&g.error(Jr,"Failed to set traceparent header:",ze(u)?u.message:"Unknown error")}if(l){let u=ra(e.getHeader("baggage"),l);if(u)try{e.setHeader("baggage",u),E&&g.log(Jr,"Added baggage header")}catch(d){E&&g.error(Jr,"Failed to set baggage header:",ze(d)?d.message:"Unknown error")}}}var Wk=e=>typeof e.__unwrap=="function",_Z="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",Vk=!1,vS=E?e=>{Vk||(Wk(e.request)||Wk(e.get))&&(Vk=!0,g.warn(_Z))}:()=>{};function ap(e){let t=new jt(100),n=()=>O()?.getOptions(),r=i=>{if(ne().getScopeData().sdkProcessingMetadata[aa]===!0)return;let o=n(),{errorMonitor:s="error",spans:c=o?De(o):!0,propagateTrace:a=!1,breadcrumbs:l=!0,http:p,https:u,suppressOtelWarning:d=!1}=e,{request:m}=i,_=_r(m);if(sy(_,O())||e.ignoreOutgoingRequests?.(_,m))return;let h=!1;function b(T,G){h||(h=!0,Bk(T,G))}function v(T){T.on(s,()=>b(T,void 0)),T.prependListener("response",G=>{T.listenerCount("response")<=1&&G.resume(),G.on("end",()=>b(T,G)),G.on(s,()=>b(T,G))})}if(!c){l&&v(m),a&&Am(m,t);return}d||(p&&vS(p),u&&vS(u));let M=L(Hk(m));e.outgoingRequestHook?.(M,m),a&&(M.isRecording()?se(M,()=>{Am(m,t)}):Am(m,t));let N=!1;function R(T){N||(N=!0,M.setStatus(T),M.end())}let P=()=>R({code:0});m.on("close",P);let Y;m.on(s,T=>{E&&g.log(Jr,"outgoingRequest on request error()",T),l&&b(m,void 0),ze(T)&&T.name==="AbortError"?R(typeof Y=="number"?wt(Y):{code:0}):R({code:2})}),m.prependListener("response",T=>{m.removeListener("close",P),Y=T.statusCode,m.listenerCount("response")<=1&&T.resume(),Fk(T,M),bn(T),e.outgoingResponseHook?.(M,T);let G=!1;function k(U){if(!G){G=!0,U&&E&&g.log(Jr,"outgoingRequest on response error()",U),l&&b(m,T);let ae=T.aborted&&!T.complete,ue=U||typeof T.statusCode!="number"||ae?{code:2}:wt(T.statusCode);e.applyCustomAttributesOnSpan?.(M,m,T),R(ue)}}T.on("end",()=>k()),T.on(s,k)})};return{[zr]:r}}var Yk;function hZ(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!="function"||(Yk=ap({...t,http:e})[zr],vr(n._storeHeader)))return;let i=n._storeHeader;Zs(n,"_storeHeader",function(...s){try{Yk({request:this},zr)}catch{}return i.apply(this,s)})}function bZ(e,t={}){let n=bm(e);return hZ(n,t),e}var OS=(e,t={})=>bZ(e,t);function jk(e,t,n,r){let i=0,o=[];E&&g.log(r,"Patching request.on");let s=new WeakMap,c=ly(n);try{e.on=e.addListener=new Proxy(e.on,{apply:(a,l,p)=>{let[u,d,...m]=p;if(u==="data"){E&&g.log(r,`Handling request.on("data") with maximum body size of ${c}b`);let _=new Proxy(d,{apply:(h,b,v)=>{try{let M=v[0],N=Buffer.from(M);i<c?(o.push(N),i+=N.byteLength):E&&g.log(r,`Dropping request body chunk because maximum body length of ${c}b is exceeded.`)}catch{E&&g.error(r,"Encountered error while storing body chunk.")}return Reflect.apply(h,b,v)}});return s.set(d,_),Reflect.apply(a,l,[u,_,...m])}return Reflect.apply(a,l,p)}}),e.off=e.removeListener=new Proxy(e.off,{apply:(a,l,p)=>{let[,u]=p,d=s.get(u);if(d){s.delete(u);let m=p.slice();return m[1]=d,Reflect.apply(a,l,m)}return Reflect.apply(a,l,p)}}),e.on("end",()=>{try{let a=Buffer.concat(o).toString("utf-8");if(a){let p=Buffer.byteLength(a,"utf-8")>c?`${Buffer.from(a).subarray(0,c-3).toString("utf-8")}...`:a;t.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(a){E&&g.error(r,"Error building captured request body",a)}})}catch(a){E&&g.error(r,"Error patching request to capture body",a)}}var CS=new WeakMap;function Zk(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let i=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&i){E&&g.log(`Recorded request session with status: ${i.status}`);let o=new Date(rt());o.setSeconds(0,0);let s=o.toISOString(),c=CS.get(e),a=c?.[s]||{exited:0,crashed:0,errored:0};if(a[{ok:"exited",crashed:"crashed",errored:"errored"}[i.status]]++,c)c[s]=a;else{E&&g.log("Opened new request session aggregate.");let l={[s]:a};CS.set(e,l);let p=()=>{clearTimeout(d),u(),CS.delete(e);let m=Object.entries(l).map(([_,h])=>({started:_,exited:h.exited,errored:h.errored,crashed:h.crashed}));e.sendSession({aggregates:m})},u=e.on("flush",()=>{E&&g.log("Sending request session aggregate due to client flush"),p()}),d=setTimeout(()=>{E&&g.log("Sending request session aggregate due to flushing schedule"),p()},r);Pn(d)}}})}var Xk="Http.Server",yZ="Http.SentryServerSpans",Kk=new WeakMap,qk=Symbol.for("sentry_http_server_instrumented");function SZ(e){return!e[qk]&&(e[qk]=!0)}function EZ(e,t){let n=t.emit,r=Kk.get(t);if(n===r)return;let i=new Proxy(n,{apply(o,s,c){let[a,...l]=c;if(a!=="request")return o.apply(s,c);let p=O(),[u,d]=l;if(!p||!SZ(u))return o.apply(s,c);E&&g.log(Xk,"Handling incoming request");let m=$().clone();m.setClient(p);let _=u.socket?.remoteAddress,h=u.url||"/",b=as(u),{maxRequestBodySize:v="medium",ignoreRequestBody:M,sessions:N=!0,sessionFlushingDelayMS:R=6e4}=e;v!=="none"&&!M?.(h,u)&&jk(u,m,v,Xk),m.setSDKProcessingMetadata({normalizedRequest:b,ipAddress:_});let P=(u.method||"GET").toUpperCase(),Y=Ln(h),T=`${P} ${Y}`;return m.setTransactionName(T),N&&Zk(p,{requestIsolationScope:m,response:d,sessionFlushingDelayMS:R??6e4}),or(m,()=>{let G=b.headers?.["sentry-trace"],k=b.headers?.baggage,U=Array.isArray(G)?G[0]:G;return vn({sentryTrace:U,baggage:Array.isArray(k)?k[0]:k},()=>{let ae=ne().getPropagationContext();ae.propagationSpanId=qt(),U||(ae.traceId=yt(),ae.sampleRand=ct()),d.once("close",()=>{m.setContext("response",{status_code:d.statusCode})});let ue=e.wrapServerEmitRequest,Ne=!1;return ue?ue(u,d,b,()=>{Ne=o.apply(s,c)}):Ne=o.apply(s,c),Ne})})}});Kk.set(t,i),t.emit=i}function xS(e){let t=e.wrapServerEmitRequest,n=TZ(e),r={...e,wrapServerEmitRequest(o,s,c,a){let l=O()?.getOptions();e.spans??(l?De(l):!1)?n(o,s,c,a):t?t(o,s,c,a):a()}},i=o=>{let{server:s}=o;EZ(r,s)};return{[Ka]:i}}function TZ(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:i,errorMonitor:o="error",onSpanEnd:s}=e;return(c,a,l,p)=>{if(typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__)return p();return t?t(c,a,l,u):u();function u(){let m=$().getClient();if(!m)return p();if(IZ(c,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return E&&g.log(yZ,"Skipping span creation for incoming request",c.url),p();let _=l.url||c.url||"/",h=fr(_),b=h?h.pathname:Ln(_),v=(c.method||"GET").toUpperCase(),M=`${v} ${b}`,N=c.headers,R=N["user-agent"],P=N["x-forwarded-for"],Y=c.httpVersion,T=N.host,G=T?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",k=_.startsWith("https")?"https":"http",{socket:U}=c,{localAddress:ae,localPort:ue,remoteAddress:Ne,remotePort:Te}=U??{};return Le({name:M,kind:D.SERVER,attributes:{[H]:"http.server",[S]:"auto.http.server",[ve]:"url","http.route":b,"otel.kind":"SERVER","net.host.ip":ae,"net.host.port":ue,"net.peer.ip":Ne,"net.peer.port":Te,"sentry.http.prefetch":AZ(c)||void 0,[pt]:h&&!mr(h)?Ct(h.href,m):void 0,[to]:h?.pathname??b,[Oi]:Ct(_,m),"http.method":v,"http.target":Ct(h?`${h.pathname}${h.search}`:b,m),"http.host":T,"net.host.name":G,"http.client_ip":typeof P=="string"?P.split(",")[0]:void 0,"http.user_agent":R,"http.scheme":k,"http.flavor":Y,"net.transport":Y?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...NZ(c),...Yr(l.headers||{},m.getDataCollectionOptions())}},Ce=>{i?.(Ce,c,a);let Qe=!1;function Rt(In){Qe||(Qe=!0,Ce.setAttributes({"http.status_text":a.statusMessage?.toUpperCase(),"http.response.status_code":a.statusCode,"http.status_code":a.statusCode,...Yr(bd(a.headers),m?.getDataCollectionOptions()??!1,"response")}),Ce.setStatus(In),s?.(Ce,c,a),Ce.end())}a.once("close",()=>{Rt(wt(a.statusCode))}),a.once(o,()=>{let In=wt(a.statusCode);Rt(In.code===2?In:{code:2})}),p()})}}}function IZ(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,i=e.method?.toUpperCase();return!!(i==="OPTIONS"||i==="HEAD"||!r||t&&i==="GET"&&Qk(r)||n?.(r,e))}function Qk(e){let t=Ln(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 AZ(e){return e.headers["next-router-prefetch"]==="1"}function NZ(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}:{}}import{subscribe as RZ}from"diagnostics_channel";var Ve=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var $k=_i("sentry_http_server_instrumented"),vZ="Http.Server";function Jk(e,t){Ge(e,"_startSpanCallback",new WeakRef(t))}var OZ=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??"medium",spans:!1,ignoreRequestBody:e.ignoreRequestBody,wrapServerEmitRequest(n,r,i,o){let s=O();if(!s||ce.active().getValue($k))return o();let c=hi.extract(ce.active(),i.headers).setValue($k,!0);ce.with(c,()=>{s.emit("httpServerRequest",n,r,i);let a=n._startSpanCallback?.deref();a?a(()=>(o(),!0)):o()})}};return{name:vZ,setupOnce(){let{[Ka]:n}=xS(t);RZ(Ka,n)},afterAllSetup(n){Ve&&n.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}}),qa=OZ;import{errorMonitor as CZ}from"events";var zk="Http.ServerSpans",xZ=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,r=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:i}=e,{requestHook:o,responseHook:s,applyCustomAttributesOnSpan:c}=e.instrumentation??{};return{name:zk,setup(a){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||a.on("httpServerRequest",(l,p,u)=>{let d=l,m=p;Jk(d,h=>{if(LZ(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return Ve&&g.log(zk,"Skipping span creation for incoming request",d.url),h();let b=u.url||d.url||"/",v=fr(b),M=d.headers,N=M["user-agent"],R=M["x-forwarded-for"],P=d.httpVersion,Y=M.host,T=Y?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",G=b.startsWith("https")?"https":"http",k=u.method||d.method?.toUpperCase()||"GET",U=v?v.pathname:Ln(b),ae=`${k} ${U}`,ue=L({name:ae,kind:D.SERVER,attributes:{[H]:"http.server",[S]:"auto.http.otel.http",[TO]:PZ(d)||void 0,[pt]:v&&!mr(v)?Ct(v.href,a):void 0,[to]:v?.pathname??U,[Oi]:Ct(b,a),[Hr]:u.method,[sd]:Ct(v?`${v.pathname}${v.search}`:U,a),[cO]:Y,[_O]:T,[sO]:typeof R=="string"?R.split(",")[0]:void 0,[pO]:N,[lO]:G,[aO]:P,[ba]:P?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...MZ(d),...Yr(u.headers||{},a.getDataCollectionOptions())}});o?.(ue,d),s?.(ue,m),c?.(ue,d,m),i?.(ue,d,m);let Ne={type:oh.HTTP,span:ue};return se(ue,()=>ce.with(ov(ce.active(),Ne),()=>{bn(d),bn(m);let Te=!1;function Ce(Qe){if(Te)return;Te=!0;let Rt=UZ(d,m,Ne);ue.setAttributes(Rt),ue.setStatus(Qe),ue.end();let In=Rt["http.route"];In&&$().setTransactionName(`${d.method?.toUpperCase()||"GET"} ${In}`)}return m.on("close",()=>{Ce(wt(m.statusCode))}),m.on(CZ,()=>{let Qe=wt(m.statusCode);Ce(Qe.code===2?Qe:{code:2})}),h()}))})})},processEvent(a){if(a.type==="transaction"){let l=a.contexts?.trace?.data?.["http.response.status_code"];if(typeof l=="number"){if(DZ(l,r))return Ve&&g.log("Dropping transaction due to status code",l),null;a.contexts={...a.contexts,response:{...a.contexts?.response,status_code:l}}}}return a},afterAllSetup(a){Ve&&(a.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerSpansIntegration` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),a.getIntegrationByName("Http.Server")||g.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."))}}}),Qa=xZ;function PZ(e){return e.headers["next-router-prefetch"]==="1"}function kZ(e){let t=Ln(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 LZ(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(Mr())return!0;let r=e.url,i=e.method?.toUpperCase();return!!(i==="OPTIONS"||i==="HEAD"||!r||t&&i==="GET"&&kZ(r)||n?.(r,e))}function MZ(e){let t=wZ(e.headers);return t==null?{}:GZ(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function wZ(e){let t=e["content-length"];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function GZ(e){let t=e["content-encoding"];return!!t&&t!=="identity"}function UZ(e,t,n){let{socket:r}=e,{statusCode:i,statusMessage:o}=t,s={[yn]:i,[vi]:i,"http.status_text":o?.toUpperCase()};if(r){let{localAddress:c,localPort:a,remoteAddress:l,remotePort:p}=r;s[gO]=c,s[hO]=a,s[bO]=l,s[Pe]=p}if(s[vi]=i,s["http.status_text"]=(o||"").toUpperCase(),n?.type===oh.HTTP&&n.route!==void 0){let c=n.route;s[Fe]=c}return s}function DZ(e,t){return t.some(n=>{if(typeof n=="number")return n===e;let[r,i]=n;return e>=r&&e<=i})}import{subscribe as wX,unsubscribe as GX}from"diagnostics_channel";var cp=class{emit(t){}enabled(){return!1}},eL=new cp;var lp=Symbol.for("io.opentelemetry.js.api.logs"),$a=globalThis;function tL(e,t,n){return r=>r===e?t:n}var PS=1;var kS=class{getLogger(t,n,r){return new cp}},Nm=new kS;var Rm=class{constructor(t,n,r,i){this._provider=t,this.name=n,this.version=r,this.options=i}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):eL}};var pp=class{getLogger(t,n,r){var i;return(i=this._getDelegateLogger(t,n,r))!==null&&i!==void 0?i:new Rm(this,t,n,r)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Nm}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(t,n,r)}};var vm=class e{constructor(){this._proxyLoggerProvider=new pp}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return $a[lp]?this.getLoggerProvider():($a[lp]=tL(PS,t,Nm),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,n;return(n=(t=$a[lp])===null||t===void 0?void 0:t.call($a,PS))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(t,n,r){return this.getLoggerProvider().getLogger(t,n,r)}disable(){delete $a[lp],this._proxyLoggerProvider=new pp}};var Om=vm.getInstance();function nL(e,t,n,r){for(let i=0,o=e.length;i<o;i++){let s=e[i];t&&s.setTracerProvider(t),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}}function rL(e){e.forEach(t=>t.disable())}function Ja(e){let t=e.tracerProvider||de.getTracerProvider(),n=e.meterProvider||xu.getMeterProvider(),r=e.loggerProvider||Om.getLoggerProvider(),i=e.instrumentations?.flat()??[];return nL(i,t,n,r),()=>{rL(i)}}import*as Mi from"path";import{types as NL}from"util";var cL=/^(?: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-]+)*))?$/,BZ=/^(?<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-]+)*))?$/,HZ={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function lL(e,t,n){if(!FZ(e))return Ee.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,"$1");let r=jZ(e);if(!r)return!1;let i=[],o=pL(r,t,i,n);return o&&!n?.includePrerelease?VZ(r,i):o}function FZ(e){return typeof e=="string"&&cL.test(e)}function pL(e,t,n,r){if(t.includes("||")){let i=t.trim().split("||");for(let o of i)if(LS(e,o,n,r))return!0;return!1}else if(t.includes(" - "))t=dX(t,r);else if(t.includes(" ")){let i=t.trim().replace(/\s{2,}/g," ").split(" ");for(let o of i)if(!LS(e,o,n,r))return!1;return!0}return LS(e,t,n,r)}function LS(e,t,n,r){if(t=YZ(t,r),t.includes(" "))return pL(e,t,n,r);{let i=ZZ(t);return n.push(i),WZ(e,i)}}function WZ(e,t){if(t.invalid)return!1;if(!t.version||wS(t.version))return!0;let n=oL(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],i=t.prereleaseSegments||[];!r.length&&!i.length?n=0:!r.length&&i.length?n=1:r.length&&!i.length?n=-1:n=oL(r,i)}return HZ[t.op]?.includes(n)}function VZ(e,t){return e.prerelease?t.some(n=>n.prerelease&&n.version===e.version):!0}function YZ(e,t){return e=e.trim(),e=pX(e,t),e=lX(e),e=uX(e,t),e=e.trim(),e}function pn(e){return!e||e.toLowerCase()==="x"||e==="*"}function jZ(e){let t=e.match(cL);if(!t){Ee.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,i=t.groups.build,o=n.split("."),s=r?.split(".");return{op:void 0,version:n,versionSegments:o,versionSegmentCount:o.length,prerelease:r,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:i}}function ZZ(e){if(!e)return{};let t=e.match(BZ);if(!t)return Ee.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,i=t.groups.prerelease,o=t.groups.build,s=r.split("."),c=i?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:s,versionSegmentCount:s.length,prerelease:i,prereleaseSegments:c,prereleaseSegmentCount:c?c.length:0,build:o}}function wS(e){return e==="*"||e==="x"||e==="X"}function iL(e){let t=parseInt(e,10);return isNaN(t)?e:t}function XZ(e,t){if(typeof e==typeof t){if(typeof e=="number")return[e,t];if(typeof e=="string")return[e,t];throw new Error("Version segments can only be strings or numbers")}else return[String(e),String(t)]}function KZ(e,t){if(wS(e)||wS(t))return 0;let[n,r]=XZ(iL(e),iL(t));return n>r?1:n<r?-1:0}function oL(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=KZ(e[n]||"0",t[n]||"0");if(r!==0)return r}return 0}var uL="[a-zA-Z0-9-]",dL="0|[1-9]\\d*",qZ=`\\d*[a-zA-Z-]${uL}*`,QZ="((?:<|>)?=?)",sL=`(?:${dL}|${qZ})`,$Z=`(?:-(${sL}(?:\\.${sL})*))`,aL=`${uL}+`,JZ=`(?:\\+(${aL}(?:\\.${aL})*))`,MS=`${dL}|x|X|\\*`,up=`[v=\\s]*(${MS})(?:\\.(${MS})(?:\\.(${MS})(?:${$Z})?${JZ}?)?)?`,zZ=`^${QZ}\\s*${up}$`,eX=new RegExp(zZ),tX=`^\\s*(${up})\\s+-\\s+(${up})\\s*$`,nX=new RegExp(tX),rX="(?:~>?)",iX=`^${rX}${up}$`,oX=new RegExp(iX),sX="(?:\\^)",aX=`^${sX}${up}$`,cX=new RegExp(aX);function lX(e){let t=oX;return e.replace(t,(n,r,i,o,s)=>{let c;return pn(r)?c="":pn(i)?c=`>=${r}.0.0 <${+r+1}.0.0-0`:pn(o)?c=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:s?c=`>=${r}.${i}.${o}-${s} <${r}.${+i+1}.0-0`:c=`>=${r}.${i}.${o} <${r}.${+i+1}.0-0`,c})}function pX(e,t){let n=cX,r=t?.includePrerelease?"-0":"";return e.replace(n,(i,o,s,c,a)=>{let l;return pn(o)?l="":pn(s)?l=`>=${o}.0.0${r} <${+o+1}.0.0-0`:pn(c)?o==="0"?l=`>=${o}.${s}.0${r} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.0${r} <${+o+1}.0.0-0`:a?o==="0"?s==="0"?l=`>=${o}.${s}.${c}-${a} <${o}.${s}.${+c+1}-0`:l=`>=${o}.${s}.${c}-${a} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.${c}-${a} <${+o+1}.0.0-0`:o==="0"?s==="0"?l=`>=${o}.${s}.${c}${r} <${o}.${s}.${+c+1}-0`:l=`>=${o}.${s}.${c}${r} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.${c} <${+o+1}.0.0-0`,l})}function uX(e,t){let n=eX;return e.replace(n,(r,i,o,s,c,a)=>{let l=pn(o),p=l||pn(s),u=p||pn(c),d=u;return i==="="&&d&&(i=""),a=t?.includePrerelease?"-0":"",l?i===">"||i==="<"?r="<0.0.0-0":r="*":i&&d?(p&&(s=0),c=0,i===">"?(i=">=",p?(o=+o+1,s=0,c=0):(s=+s+1,c=0)):i==="<="&&(i="<",p?o=+o+1:s=+s+1),i==="<"&&(a="-0"),r=`${i+o}.${s}.${c}${a}`):p?r=`>=${o}.0.0${a} <${+o+1}.0.0-0`:u&&(r=`>=${o}.${s}.0${a} <${o}.${+s+1}.0-0`),r})}function dX(e,t){let n=nX;return e.replace(n,(r,i,o,s,c,a,l,p,u,d,m,_)=>(pn(o)?i="":pn(s)?i=`>=${o}.0.0${t?.includePrerelease?"-0":""}`:pn(c)?i=`>=${o}.${s}.0${t?.includePrerelease?"-0":""}`:a?i=`>=${i}`:i=`>=${i}${t?.includePrerelease?"-0":""}`,pn(u)?p="":pn(d)?p=`<${+u+1}.0.0-0`:pn(m)?p=`<${u}.${+d+1}.0-0`:_?p=`<=${u}.${d}.${m}-${_}`:t?.includePrerelease?p=`<${u}.${d}.${+m+1}-0`:p=`<=${p}`,`${i} ${p}`.trim()))}var un=console.error.bind(console);function dp(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 fs=(e,t,n)=>{if(!e||!e[t]){un("no original function "+String(t)+" to wrap");return}if(!n){un("no wrapper function"),un(new Error().stack);return}let r=e[t];if(typeof r!="function"||typeof n!="function"){un("original object and wrapper must be functions");return}let i=n(r,t);return dp(i,"__original",r),dp(i,"__unwrap",()=>{e[t]===i&&dp(e,t,r)}),dp(i,"__wrapped",!0),dp(e,t,i),i},GS=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{un("must provide one or more modules to patch"),un(new Error().stack);return}if(!(t&&Array.isArray(t))){un("must provide one or more functions to wrap on modules");return}e.forEach(r=>{t.forEach(i=>{fs(r,i,n)})})},za=(e,t)=>{if(!e||!e[t]){un("no function to unwrap."),un(new Error().stack);return}let n=e[t];if(!n.__unwrap)un("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{n.__unwrap();return}},US=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{un("must provide one or more modules to patch"),un(new Error().stack);return}if(!(t&&Array.isArray(t))){un("must provide one or more functions to unwrap on modules");return}e.forEach(n=>{t.forEach(r=>{za(n,r)})})};function mp(e){e&&e.logger&&(typeof e.logger!="function"?un("new logger isn't a function, not replacing"):un=e.logger)}mp.wrap=fs;mp.massWrap=GS;mp.unwrap=za;mp.massUnwrap=US;var Cm=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,n,r){this.instrumentationName=t,this.instrumentationVersion=n,this.setConfig(r),this._diag=Ee.createComponentLogger({namespace:t}),this._tracer=de.getTracer(t,n),this._meter=xu.getMeter(t,n),this._logger=Om.getLogger(t,n),this._updateMetricInstruments()}_wrap=fs;_unwrap=za;_massWrap=GS;_massUnwrap=US;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,n,r,i){if(t)try{t(r,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},o)}}};var gL=Nu(VS());import*as YS from"path";var Pm=class{hooks=[];children=new Map},km=class{_trie=new Pm;_counter=0;insert(t){let n=this._trie;for(let r of t.moduleName.split("/")){let i=n.children.get(r);i||(i=new Pm,n.children.set(r,i)),n=i}n.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:n,fullOnly:r}={}){let i=this._trie,o=[],s=!0;for(let c of t.split("/")){let a=i.children.get(c);if(!a){s=!1;break}r||o.push(...a.hooks),i=a}return r&&s&&o.push(...i.hooks),o.length===0?[]:o.length===1?[o[0].hook]:(n&&o.sort((c,a)=>c.insertedId-a.insertedId),o.map(({hook:c})=>c))}};var hX=["afterEach","after","beforeEach","before","describe","it"].every(e=>typeof global[e]=="function"),Lm=class e{_moduleNameTrie=new km;static _instance;constructor(){this._initialize()}_initialize(){new gL.Hook(null,{internals:!0},(t,n,r)=>{let i=bX(n),o=this._moduleNameTrie.search(i,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:s}of o)t=s(t,n,r);return t})}register(t,n){let r={moduleName:t,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return hX?new e:this._instance=this._instance??new e}};function bX(e){return YS.sep!=="/"?e.split(YS.sep).join("/"):e}var vL=Nu(rE());var OL=Nu(VS());import{readFileSync as MX}from"fs";function ei(e,t,n){let r,i;try{i=e()}catch(o){r=o}finally{if(t(r,i),r&&!n)throw r;return i}}function w(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var le=class extends Cm{_modules;_hooks=[];_requireInTheMiddleSingleton=Lm.getInstance();_enabled=!1;constructor(t,n,r){super(t,n,r);let i=this.init();i&&!Array.isArray(i)&&(i=[i]),this._modules=i||[],this._config.enabled&&this.enable()}_wrap=(t,n,r)=>{if(w(t[n])&&this._unwrap(t,n),NL.isProxy(t)){let i=fs(Object.assign({},t),n,r);return Object.defineProperty(t,n,{value:i}),i}else return fs(t,n,r)};_unwrap=(t,n)=>NL.isProxy(t)?Object.defineProperty(t,n,{value:t[n]}):za(t,n);_massWrap=(t,n,r)=>{if(t)Array.isArray(t)||(t=[t]);else{Ee.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Ee.error("must provide one or more functions to wrap on modules");return}t.forEach(i=>{n.forEach(o=>{this._wrap(i,o,r)})})};_massUnwrap=(t,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Ee.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Ee.error("must provide one or more functions to wrap on modules");return}t.forEach(r=>{n.forEach(i=>{this._unwrap(r,i)})})};_warnOnPreloadedModules(){let t=globalThis.require;!t?.resolve||!t?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let i=t.resolve(r);t.cache[i]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(t){try{let n=MX(Mi.join(t,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Ee.warn("Failed extracting version",t)}}_onRequire(t,n,r,i){if(!i)return typeof t.patch=="function"&&(t.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:t.name}),t.patch(n)):n;let o=this._extractPackageVersion(i);if(t.moduleVersion=o,t.name===r)return RL(t.supportedVersions,o,t.includePrerelease)&&typeof t.patch=="function"&&(t.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:t.name,version:t.moduleVersion,baseDir:i}),t.patch(n,t.moduleVersion)):n;let s=t.files??[],c=Mi.normalize(r);return s.filter(l=>l.name===c&&RL(l.supportedVersions,o,t.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:t.name,version:t.moduleVersion,fileName:p.name,baseDir:i}),p.patch(l,t.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let t of this._modules){typeof t.patch=="function"&&t.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:t.name,version:t.moduleVersion}),t.patch(t.moduleExports,t.moduleVersion));for(let n of t.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:t.name,version:t.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,t.moduleVersion))}return}this._warnOnPreloadedModules();for(let t of this._modules){let n=(s,c,a)=>{if(!a&&Mi.isAbsolute(c)){let l=Mi.parse(c);c=l.name,a=l.dir}return this._onRequire(t,s,c,a)},r=(s,c,a)=>this._onRequire(t,s,c,a),i=Mi.isAbsolute(t.name)?new OL.Hook([t.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(t.name,r);this._hooks.push(i);let o=new vL.Hook([t.name],{internals:!0},n);this._hooks.push(o)}}}disable(){if(this._enabled){this._enabled=!1;for(let t of this._modules){typeof t.unpatch=="function"&&t.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:t.name,version:t.moduleVersion}),t.unpatch(t.moduleExports,t.moduleVersion));for(let n of t.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:t.name,version:t.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,t.moduleVersion))}}}isEnabled(){return this._enabled}};function RL(e,t,n){return typeof t>"u"?e.includes("*"):e.some(r=>lL(t,r,{includePrerelease:n}))}var re=class{files;name;supportedVersions;patch;unpatch;constructor(t,n,r,i,o){this.files=o||[],this.name=t,this.supportedVersions=n,this.patch=r,this.unpatch=i}};var rn=qs(process.versions.node),ic=rn.major,iE=rn.minor;import{errorMonitor as UX}from"events";import*as CL from"http";var DX=rn.major===22&&rn.minor>=12||rn.major===23&&rn.minor>=2||rn.major>=24;function gs(e={}){let{outgoingRequestApplyCustomAttributes:t,...n}=e,r={propagateTrace:n.propagateTraceInOutgoingRequests??!0,applyCustomAttributesOnSpan:t,...n,spans:n.createSpansForOutgoingRequests!==!1&&(n.spans??!0),ignoreOutgoingRequests(i,o){return Mr()||!!n.ignoreOutgoingRequests?.(i,Im(o))},outgoingRequestHook(i,o){n.outgoingRequestHook?.(i,o);let s=o.once,c=new Proxy(s,{apply(a,l,p){let[u]=p;if(u!=="response")return a.apply(l,p);let d=ce.active(),m=de.setSpan(d,i);return ce.with(m,()=>a.apply(l,p))}});o.once=c},outgoingResponseHook(i,o){n.outgoingResponseHook?.(i,o)},errorMonitor:UX,http:CL};DX?BX(r):HX(r)}var oE;function BX(e){let{[zr]:t}=ap(e);oE&&GX(zr,oE),wX(zr,t),oE=t}function HX(e){OS(CL,e)}var xL="Http";Object.assign(gs,{id:`${xL}.sentry`});var PL=(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},o={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes},s={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests,spans:t},c=qa(i),a=Qa(o);return{name:xL,setup(l){r&&a.setup(l)},setupOnce(){c.setupOnce(),gs(s)},processEvent(l){return a.processEvent(l)}}};import*as wm from"diagnostics_channel";import{URL as ZX}from"url";var sE="sentry-trace",Mm="baggage",FX="traceparent";function lE(e,t,n){let r=LL(e.origin,e.path),{tracePropagationTargets:i,propagateTraceparent:o}=O()?.getOptions()||{};if(!ss(r,i,t))return;let s=n&&wr(n)&&Q()?void 0:n,c=s?se(s,()=>tt({propagateTraceparent:o})):tt({propagateTraceparent:o});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c,u=Array.isArray(e.headers)?WX(e.headers):VX(e.headers);if(aE(u,sE),aE(u,Mm),o&&aE(u,FX),!(cE(u,sE)!==-1)){a&&u.push(sE,a),p&&cE(u,"traceparent")===-1&&u.push("traceparent",p);let m=cE(u,Mm);if(l&&m===-1)u.push(Mm,l);else if(l){let _=u[m+1],h=ra(_,l);h&&(u[m+1]=h)}}Array.isArray(e.headers)?e.headers.splice(0,e.headers.length,...u):e.headers=YX(u)}function WX(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 VX(e){let t=e.split(`\r
|
|
22
|
+
`),n=[];for(let r of t)try{let i=r.indexOf(":");if(i===-1)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&n.push(o,s)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function YX(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
|
|
23
|
+
`).concat(`\r
|
|
24
|
+
`):""}function aE(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===Mm&&i){let o=ra(e[r+1],i);o&&(e[n+1]=o)}e.splice(r,2),r-=2}}function cE(e,t){return e.findIndex((n,r)=>r%2===0&&n===t)}function kL(e,t){let n=jX(e),r=t.statusCode,i=ep(r);an({category:"http",data:{status_code:r,...n},type:"http",level:i},{event:"response",request:e,response:t})}function jX(e){try{let t=LL(e.origin,e.path),n=ro(t),r={url:io(n),"http.method":e.method||"GET"};return n.search&&(r["http.query"]=Yn(n.search)),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function LL(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 XX="http.request.method_original",pE=[],ho=new WeakMap,wL=new WeakMap,ML=new jt(100);function hp(e={}){pE.length||(_p("undici:request:create",t=>KX(e,t)),_p("undici:client:sendHeaders",t=>qX(e,t)),_p("undici:request:headers",t=>QX(e,t)),_p("undici:request:trailers",t=>$X(t)),_p("undici:request:error",t=>JX(t)))}function uE(e,t){try{return e()}catch(n){t(n);return}}function _p(e,t){let[n=0,r=0]=process.version.replace("v","").split(".").map(o=>Number(o));n>18||n===18&&r>=19?pE.push(wm.subscribe?.(e,t)):pE.push(wm.channel(e).subscribe(t))}function GL(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
|
|
25
|
+
`);for(let r of n){if(!r)continue;let i=r.indexOf(":");if(i===-1)continue;let o=r.substring(0,i).toLowerCase(),s=r.substring(i+1).trim(),c=t.get(o);c&&Array.isArray(c)?c.push(s):c?t.set(o,[c,s]):t.set(o,s)}}return t}function KX(e,{request:t}){let n=eK(t.origin,t.path),r=uE(()=>!!e.ignoreOutgoingRequests?.(n),b=>b&&Ve&&g.error("caught ignoreOutgoingRequests error: ",b)),i=Mr()||!!r;if(wL.set(t,i),!e.spans){e.tracePropagation!==!1&&!i&&lE(t,ML);return}if(t.method==="CONNECT"||r)return;let o;try{o=new ZX(t.path,t.origin)}catch(b){Ve&&g.warn("could not determine url.full:",b);return}let s=o.protocol.replace(":",""),c=zX(t.method),a={[Fr]:c,[XX]:t.method,[pt]:Ct(o.toString()),[to]:o.pathname,[ld]:Yn(o.search),[xO]:s,[S]:"auto.http.otel.node_fetch"};if(n.startsWith("data:")){let b=vl(n);a["http.url"]=b,a[pt]=b,a[hn]=`${t.method||"GET"} ${b}`}let l={https:"443",http:"80"},p=o.hostname,u=o.port||l[s];a[_t]=p,u&&!isNaN(Number(u))&&(a[ht]=Number(u));let m=GL(t).get("user-agent");if(m){let b=Array.isArray(m)?m[m.length-1]:m;a[PO]=b}let _=O(),h=L({name:c==="_OTHER"?"HTTP":c,kind:D.CLIENT,attributes:a,onlyIfParent:!_||!ot(_)});uE(()=>e.requestHook?.(h,t),b=>b&&Ve&&g.error("caught requestHook error: ",b)),lE(t,ML,h),ho.set(t,h)}function qX(e,{request:t,socket:n}){let r=ho.get(t);if(!r)return;let{remoteAddress:i,remotePort:o}=n,s={[dO]:i,[mO]:o};if(e.headersToSpanAttributes?.requestHeaders){let c=new Set(e.headersToSpanAttributes.requestHeaders.map(l=>l.toLowerCase())),a=GL(t);for(let[l,p]of a.entries())if(c.has(l)){let u=Array.isArray(p)?p:[p];s[`http.request.header.${l}`]=u}}r.setAttributes(s)}function QX(e,{request:t,response:n}){e.breadcrumbs!==!1&&!wL.get(t)&&kL(t,n);let i=ho.get(t);if(!i)return;let o={[yn]:n.statusCode};if(uE(()=>e.responseHook?.(i,{request:t,response:n}),s=>s&&Ve&&g.error("caught responseHook error: ",s)),e.headersToSpanAttributes?.responseHeaders){let s=new Set;e.headersToSpanAttributes?.responseHeaders.forEach(c=>s.add(c.toLowerCase()));for(let c=0;c<n.headers.length;c=c+2){let a=n.headers[c],l=n.headers[c+1];if(a===void 0||l===void 0)continue;let p=a.toString().toLowerCase(),u=l;if(s.has(p)){let d=`http.response.header.${p}`;Object.prototype.hasOwnProperty.call(o,d)?o[d].push(u.toString()):o[d]=[u.toString()]}}}i.setAttributes(o),n.statusCode>=400&&i.setStatus(wt(n.statusCode))}function $X({request:e}){let t=ho.get(e);t&&(t.end(),ho.delete(e))}function JX({request:e,error:t}){let n=ho.get(e);if(!n)return;if(t.name==="AbortError"||typeof DOMException<"u"&&t instanceof DOMException&&t.code===DOMException.ABORT_ERR){n.end(),ho.delete(e);return}n.setStatus({code:2,message:t.message}),n.end(),ho.delete(e)}function zX(e){let t={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0};return e.toUpperCase()in t?e.toUpperCase():"_OTHER"}function eK(e,t="/"){let n=`${e}`;return n.endsWith("/")&&t.startsWith("/")?`${n}${t.slice(1)}`:!n.endsWith("/")&&!t.startsWith("/")?`${n}/${t}`:`${n}${t}`}var tK=((e={})=>({name:"NodeFetch",setupOnce(){hp(e)}})),UL=tK;var nK=_i("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function dE(e){return e.getValue(nK)===!0}function bo(e){let t={};if(typeof e!="object"||e==null)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!rK(n)){Ee.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Gm(r)){Ee.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function rK(e){return typeof e=="string"&&e!==""}function Gm(e){return e==null?!0:Array.isArray(e)?iK(e):DL(typeof e)}function iK(e){let t;for(let n of e){if(n==null)continue;let r=typeof n;if(r!==t){if(!t){if(DL(r)){t=r;continue}return!1}return!1}}return!0}function DL(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function BL(){return e=>{Ee.error(oK(e))}}function oK(e){return typeof e=="string"?e:JSON.stringify(sK(e))}function sK(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(t[r])return;let i=n[r];i&&(t[r]=String(i))}),n=Object.getPrototypeOf(n);return t}var aK=BL();function bp(e){try{aK(e)}catch{}}import{inspect as cK}from"util";function Pt(e){let t=process.env[e];if(t==null||t.trim()==="")return;let n=Number(t);if(isNaN(n)){Ee.warn(`Unknown value ${cK(t)} for ${e}, expected a number, using defaults`);return}return n}function yp(e){let t=process.env[e];if(!(t==null||t.trim()===""))return t}var HL="2.12.1";ih();var FL="process.runtime.name";var _s={[Zc]:"opentelemetry",[FL]:"node",[jc]:iv,[Xc]:HL};var ti=performance;var pK=9,uK=6,dK=Math.pow(10,uK),mE=Math.pow(10,pK);function yo(e){let t=e/1e3,n=Math.trunc(t),r=Math.round(e%1e3*dK);return[n,r]}function fE(e){let t=yo(ti.timeOrigin),n=yo(typeof e=="number"?e:ti.now());return Bm(t,n)}function gE(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(n-=1,r+=mE),[n,r]}function Um(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function Dm(e){return Um(e)||typeof e=="number"||e instanceof Date}function Bm(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=mE&&(n[1]-=mE,n[0]+=1),n}var mK="[object Object]",fK="[object Null]",gK="[object Undefined]",_K=Function.prototype,YL=_K.toString,hK=YL.call(Object),bK=Object.getPrototypeOf,jL=Object.prototype,ZL=jL.hasOwnProperty,hs=Symbol?Symbol.toStringTag:void 0,XL=jL.toString;function _E(e){if(!yK(e)||SK(e)!==mK)return!1;let t=bK(e);if(t===null)return!0;let n=ZL.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&YL.call(n)===hK}function yK(e){return e!=null&&typeof e=="object"}function SK(e){return e==null?e===void 0?gK:fK:hs&&hs in Object(e)?EK(e):TK(e)}function EK(e){let t=ZL.call(e,hs),n=e[hs],r=!1;try{e[hs]=void 0,r=!0}catch{}let i=XL.call(e);return r&&(t?e[hs]=n:delete e[hs]),i}function TK(e){return XL.call(e)}var IK=20;function bE(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=qL(t,e.shift(),0,n);return t}function hE(e){return Fm(e)?e.slice():e}function qL(e,t,n=0,r){let i;if(!(n>IK)){if(n++,Hm(e)||Hm(t)||QL(t))i=hE(t);else if(Fm(e)){if(i=e.slice(),Fm(t))for(let o=0,s=t.length;o<s;o++)i.push(hE(t[o]));else if(Sp(t)){let o=Object.keys(t);for(let s=0,c=o.length;s<c;s++){let a=o[s];a==="__proto__"||a==="constructor"||a==="prototype"||(i[a]=hE(t[a]))}}}else if(Sp(e))if(Sp(t)){if(!AK(e,t))return t;i=Object.assign({},e);let o=Object.keys(t);for(let s=0,c=o.length;s<c;s++){let a=o[s];if(a==="__proto__"||a==="constructor"||a==="prototype")continue;let l=t[a];if(Hm(l))typeof l>"u"?delete i[a]:i[a]=l;else{let p=i[a],u=l;if(KL(e,a,r)||KL(t,a,r))delete i[a];else{if(Sp(p)&&Sp(u)){let d=r.get(p)||[],m=r.get(u)||[];d.push({obj:e,key:a}),m.push({obj:t,key:a}),r.set(p,d),r.set(u,m)}i[a]=qL(i[a],l,n,r)}}}}else i=t;return i}}function KL(e,t,n){let r=n.get(e[t])||[];for(let i=0,o=r.length;i<o;i++){let s=r[i];if(s.key===t&&s.obj===e)return!0}return!1}function Fm(e){return Array.isArray(e)}function QL(e){return typeof e=="function"}function Sp(e){return!Hm(e)&&!Fm(e)&&!QL(e)&&typeof e=="object"}function Hm(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function AK(e,t){return!(!_E(e)||!_E(t))}ih();var Wm;function $L(){if(Wm===void 0)try{let e=globalThis.process.argv0;Wm=e?`unknown_service:${e}`:"unknown_service"}catch{Wm="unknown_service"}return Wm}var oc=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";var yE=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=JL(t),r._asyncAttributesPending=t.filter(([i,o])=>oc(o)).length>0,r}constructor(t,n){let r=t.attributes??{};this._rawAttributes=Object.entries(r).map(([i,o])=>(oc(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=JL(this._rawAttributes),this._schemaUrl=NK(n?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){let[n,r]=this._rawAttributes[t];this._rawAttributes[t]=[n,oc(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Ee.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let t={};for(let[n,r]of this._rawAttributes){if(oc(r)){Ee.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(t[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=RK(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function zL(e,t){return yE.FromAttributeList(Object.entries(e),t)}function SE(){return zL({[rv]:$L(),[jc]:_s[jc],[Zc]:_s[Zc],[Xc]:_s[Xc]})}function JL(e){return e.map(([t,n])=>oc(n)?[t,n.catch(r=>{Ee.debug("promise rejection for resource attribute: %s - %s",t,r)})]:[t,n])}function NK(e){if(typeof e=="string"||e===void 0)return e;Ee.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function RK(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n==="",o=r===void 0||r==="";if(i)return r;if(o||n===r)return n;Ee.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',n,r)}ih();var eM="exception";var sc=Symbol.for("nodejs.util.inspect.custom");function ac(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!="function"&&r!=null&&(t[n]??=r);return t}function cc(e,t,n,r,i){if(typeof n=="number"&&n<0){let s=`[${e}]`;return r?.stylize?r.stylize(s,"special"):s}if(typeof i!="function"||!r)return t;let o={...r,depth:r.depth==null?r.depth:r.depth-1};return`${e} ${i(t,o)}`}var Vm=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Lt.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let n=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=ti.now(),this._performanceOffset=n-(this._performanceStartTime+ti.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let r of t.links)this.addLink(r);this.startTime=this._getTime(t.startTime??n),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,n){if(n==null||this._isSpanEnded())return this;if(t.length===0)return Ee.warn(`Invalid attribute key: ${t}`),this;if(!Gm(n))return Ee.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:r}=this._spanLimits,i=!Object.prototype.hasOwnProperty.call(this.attributes,t);return r!==void 0&&this._attributesCount>=r&&i?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(n),i&&this._attributesCount++,this)}setAttributes(t){for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&this.setAttribute(n,t[n]);return this}addEvent(t,n,r){if(this._isSpanEnded())return this;let{eventCountLimit:i}=this._spanLimits;if(i===0)return Ee.warn("No events allowed."),this._droppedEventsCount++,this;i!==void 0&&this.events.length>=i&&(this._droppedEventsCount===0&&Ee.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Dm(n)&&(Dm(r)||(r=n),n=void 0);let o=bo(n),{attributePerEventCountLimit:s}=this._spanLimits,c={},a=0,l=0;for(let p in o){if(!Object.prototype.hasOwnProperty.call(o,p))continue;let u=o[p];if(s!==void 0&&l>=s){a++;continue}c[p]=this._truncateToSize(u),l++}return this.events.push({name:t,attributes:c,time:this._getTime(r),droppedAttributesCount:a}),this}addLink(t){if(this._isSpanEnded())return this;let{linkCountLimit:n}=this._spanLimits;if(n===0)return this._droppedLinksCount++,this;n!==void 0&&this.links.length>=n&&(this._droppedLinksCount===0&&Ee.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,i=bo(t.attributes),o={},s=0,c=0;for(let l in i){if(!Object.prototype.hasOwnProperty.call(i,l))continue;let p=i[l];if(r!==void 0&&c>=r){s++;continue}o[l]=this._truncateToSize(p),c++}let a={context:t.context};return c>0&&(a.attributes=o),s>0&&(a.droppedAttributesCount=s),this.links.push(a),this}addLinks(t){for(let n of t)this.addLink(n);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===Lt.UNSET)return this;if(this.status.code===Lt.OK)return this;let n={code:t.code};return t.code===Lt.ERROR&&(typeof t.message=="string"?n.message=t.message:t.message!=null&&Ee.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=n,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){Ee.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=gE(this.startTime,this.endTime),this._duration[0]<0&&(Ee.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&&Ee.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&Ee.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(t){if(typeof t=="number"&&t<=ti.now())return fE(t+this._performanceOffset);if(typeof t=="number")return yo(t);if(t instanceof Date)return yo(t.getTime());if(Um(t))return t;if(this._startTimeProvided)return yo(Date.now());let n=ti.now()-this._performanceStartTime;return Bm(this.startTime,yo(n))}isRecording(){return this._ended===!1}recordException(t,n){let r={};typeof t=="string"?r[Ru]=t:t&&(t.code?r[vu]=t.code.toString():t.name&&(r[vu]=t.name),t.message&&(r[Ru]=t.message),t.stack&&(r[nv]=t.stack)),r[vu]||r[Ru]?this.addEvent(eM,r,n):Ee.warn(`Failed to record an exception ${t}`)}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 t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);Ee.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,n){return t.length<=n?t:t.substring(0,n)}_truncateToSize(t){let n=this._attributeValueLengthLimit;return n<=0?(Ee.warn(`Attribute value limit must be positive, got ${n}`),t):typeof t=="string"?this._truncateToLimitUtil(t,n):Array.isArray(t)?t.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):t}[sc](t,n,r){let i={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:ac(this.resource)}};return cc("SpanImpl",i,t,n,r)}};var et;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(et||(et={}));var tM="otel.span.parent.origin",EE="otel.span.sampling_result";var nM="otel.sdk.span.live",rM="otel.sdk.span.started";var Ym=class{startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(rM,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(nM,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,n){let r=OK(n);if(this.startedSpans.add(1,{[tM]:vK(t),[EE]:r}),n===et.NOT_RECORD)return()=>{};let i={[EE]:r};return this.liveSpans.add(1,i),()=>{this.liveSpans.add(-1,i)}}};function vK(e){return e?e.isRemote?"remote":"local":"none"}function OK(e){switch(e){case et.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case et.RECORD:return"RECORD_ONLY";case et.NOT_RECORD:return"DROP"}}var iM="2.12.1";var jm=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,n){this.instrumentationScope=t,this._sampler=n.sampler,this._spanLimits=n.spanLimits,this._resource=n.resource,this._idGenerator=n.idGenerator,this._spanProcessor=n.spanProcessor;let r=n.meterProvider.getMeter("@opentelemetry/sdk-trace",iM);this._tracerMetrics=new Ym(r)}startSpan(t,n={},r=ce.active()){n.root&&(r=de.deleteSpan(r));let i=de.getSpan(r);if(dE(r))return Ee.debug("Instrumentation suppressed, returning Noop Span"),de.wrapSpanContext(lv);let o=i?.spanContext(),s=this._idGenerator.generateSpanId(),c,a,l;!o||!de.isSpanContextValid(o)?a=this._idGenerator.generateTraceId():(a=o.traceId,l=o.traceState,c=o);let p=n.kind??gt.INTERNAL,u=(n.links??[]).map(N=>({context:N.context,attributes:bo(N.attributes)})),d=bo(n.attributes),m=this._sampler.shouldSample(r,a,t,p,d,u),_=this._tracerMetrics.startSpan(o,m.decision);l=m.traceState??l;let h=m.decision===sh.RECORD_AND_SAMPLED?Xt.SAMPLED:Xt.NONE,b={traceId:a,spanId:s,traceFlags:h,traceState:l};if(m.decision===sh.NOT_RECORD)return Ee.debug("Recording is off, propagating context in a non-recording span"),de.wrapSpanContext(b);let v=bo(Object.assign(d,m.attributes));return new Vm({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:b,name:t,kind:p,links:u,parentSpanContext:c,attributes:v,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:_})}startActiveSpan(t,n,r,i){let o,s,c;if(arguments.length<2)return;arguments.length===2?c=n:arguments.length===3?(o=n,c=r):(o=n,s=r,c=i);let a=s??ce.active(),l=this.startSpan(t,o,a),p=de.setSpan(a,l);return ce.with(p,c,void 0,l)}[sc](t,n,r){let i={instrumentationScope:this.instrumentationScope,resource:{attributes:ac(this._resource)},spanLimits:this._spanLimits};return cc("Tracer",i,t,n,r)}};var Xm=class{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let n of this._spanProcessors)t.push(n.forceFlush());return new Promise(n=>{Promise.all(t).then(()=>{n()}).catch(r=>{bp(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(t,n){for(let r of this._spanProcessors)r.onStart(t,n)}onEnding(t){for(let n of this._spanProcessors)n.onEnding&&n.onEnding(t)}onEnd(t){for(let n of this._spanProcessors)n.onEnd(t)}shutdown(){let t=[];for(let n of this._spanProcessors)t.push(n.shutdown());return new Promise((n,r)=>{Promise.all(t).then(()=>{n()},r)})}};var ni=class{shouldSample(){return{decision:et.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};var En=class{shouldSample(){return{decision:et.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};var yr=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(bp(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new En),this._remoteParentSampled=t.remoteParentSampled??new En,this._remoteParentNotSampled=t.remoteParentNotSampled??new ni,this._localParentSampled=t.localParentSampled??new En,this._localParentNotSampled=t.localParentNotSampled??new ni}shouldSample(t,n,r,i,o,s){let c=de.getSpanContext(t);return!c||!Kc(c)?this._root.shouldSample(t,n,r,i,o,s):c.isRemote?c.traceFlags&Xt.SAMPLED?this._remoteParentSampled.shouldSample(t,n,r,i,o,s):this._remoteParentNotSampled.shouldSample(t,n,r,i,o,s):c.traceFlags&Xt.SAMPLED?this._localParentSampled.shouldSample(t,n,r,i,o,s):this._localParentNotSampled.shouldSample(t,n,r,i,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};var bs=class{generateTraceId=oM(16);generateSpanId=oM(8)},Km=Buffer.allocUnsafe(16);function oM(e){return function(){for(let n=0;n<e/4;n++)Km.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<e&&!(Km[n]>0);n++)n===e-1&&(Km[e-1]=1);return Km.toString("hex",0,e)}}var ys;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(ys||(ys={}));var Ep=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(t={}){this._forceFlushTimeoutMillis=t.forceFlushTimeoutMillis??3e4,this._resource=t.resource??SE();let n=t.spanProcessors??[];this._activeSpanProcessor=new Xm(n),this._tracerOptions={resource:this._resource,sampler:t.sampler??new yr({root:new En}),spanLimits:{attributeCountLimit:t.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:t.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:t.spanLimits?.eventCountLimit??128,linkCountLimit:t.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:t.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:t.spanLimits?.attributePerLinkCountLimit??128},idGenerator:t.idGenerator||new bs,spanProcessor:this._activeSpanProcessor,meterProvider:t.meterProvider??{getMeter(){return av()}}}}getTracer(t,n,r){let i=`${t}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new jm({name:t,version:n,schemaUrl:r?.schemaUrl},this._tracerOptions)),this._tracers.get(i)}forceFlush(t){let n=t?.timeoutMillis??this._forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(i=>new Promise(o=>{let s,c=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${n} ms`)),s=ys.timeout},n);i.forceFlush().then(()=>{clearTimeout(c),s!==ys.timeout&&(s=ys.resolved,o(s))}).catch(a=>{clearTimeout(c),s=ys.error,o(a)})}));return new Promise((i,o)=>{Promise.all(r).then(s=>{let c=s.filter(a=>a!==ys.resolved);c.length>0?o(c):i()}).catch(s=>o([s]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[sc](t,n,r){let i=this._activeSpanProcessor._spanProcessors,o={resource:{attributes:ac(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:i.map(s=>s.constructor?.name??"SpanProcessor")};return cc("TracerProvider",o,t,n,r)}};var Ss=class{_ratio;_upperBound;constructor(t=0){this._ratio=this._normalize(t),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(t,n){return{decision:pv(n)&&this._accumulate(n)<this._upperBound?et.RECORD_AND_SAMPLED:et.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let n=0;for(let r=0;r<32;r+=8){let i=0;for(let o=0;o<8;o++){let s=t.charCodeAt(r+o),c=s<58?s-48:s<71?s-55:s-87;i=i<<4|c}n=(n^i)>>>0}return n}};var ri;(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"})(ri||(ri={}));var qm=1;function aM(){return{sampler:CK(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:Pt("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:Pt("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:Pt("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:Pt("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:Pt("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:Pt("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:Pt("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:Pt("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}function CK(){let e=yp("OTEL_TRACES_SAMPLER")??ri.ParentBasedAlwaysOn;switch(e){case ri.AlwaysOn:return new En;case ri.AlwaysOff:return new ni;case ri.ParentBasedAlwaysOn:return new yr({root:new En});case ri.ParentBasedAlwaysOff:return new yr({root:new ni});case ri.TraceIdRatio:return new Ss(sM());case ri.ParentBasedTraceIdRatio:return new yr({root:new Ss(sM())});default:return Ee.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${ri.ParentBasedAlwaysOn}".`),new yr({root:new En})}}function sM(){let e=Pt("OTEL_TRACES_SAMPLER_ARG");return e==null?(Ee.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${qm}.`),qm):e<0||e>1?(Ee.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${qm}.`),qm):e}var xK=128,PK=1/0;function cM(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??Pt("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??Pt("OTEL_ATTRIBUTE_COUNT_LIMIT")??xK,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??Pt("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??Pt("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??PK,Object.assign({},e,{spanLimits:t})}var Tp=class extends Ep{constructor(t={}){let n=bE({},aM(),cM(t));delete n.generalLimits,super(n)}};var LE="sentry.parentIsRemote",Es="sentry.graphql.operation";function ME(e){if("parentSpanId"in e)return e.parentSpanId;if("parentSpanContext"in e)return e.parentSpanContext?.spanId}function zm(e){return B(e.attributes)}function mM(e){return typeof e.kind=="number"}function fM(e){return!!e.status}function TE(e){return!!e.name}function gM(e){if(!zm(e))return{};let t=e.attributes[pt]||e.attributes[Oi],n={url:t,"http.method":e.attributes[Fr]||e.attributes[Hr]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof t=="string"){let r=ro(t);n.url=io(r);let i=Yn(r.search);i&&(n["http.query"]=i),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function _M(e){return mM(e)?e.kind:gt.INTERNAL}var Qm="sentry-trace",IE="baggage",ef="sentry.dsc",wE="sentry.sampled_not_recording",hM="sentry.url",kK="sentry.sample_rand",LK="sentry.sample_rate",tf="sentry.ignored",bM="sentry.segment_ignored",nf=_i("sentry_scopes"),AE=_i("sentry_fork_isolation_scope"),NE=_i("sentry_fork_set_scope"),$m=_i("sentry_fork_set_isolation_scope"),yM="_scopeContext";function Ts(e){return e.getValue(nf)}function SM(e,t){return e.setValue(nf,t)}function MK(e,t){Ge(e,yM,Yo(t))}function lc(e){return jo(e[yM])}function pc(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(wE)==="1":!1;if(t===Xt.SAMPLED)return!0;if(r)return!1;let i=n?n.get(ef):void 0,o=i?sr(i):void 0;if(o?.sampled==="true")return!0;if(o?.sampled==="false")return!1}function EM(e,t){let n=e.spanContext(),r=Oe(e),i=pc(n);if(i!==void 0)return i;if(wr(r))return!1;if(!(!De(t?.getOptions())||n.isRemote||!ol(r)))return zt(e)}function Ap(e,t,n){let r=t[Fr]||t[Hr];if(r)return GK({attributes:t,name:e,kind:n},r);let i=t[dt]||t[ke],o=typeof t[H]=="string"&&t[H].startsWith("cache.");if(i&&!o)return wK({attributes:t,name:e});let s=t[ve]==="custom"?"custom":"route";if(t[cd])return{...Ip(e,t,"route"),op:"rpc"};if(t[Dt])return{...Ip(e,t,s),op:"message"};let l=t[td];return l?{...Ip(e,t,s),op:l.toString()}:{op:void 0,description:e,source:"custom"}}function TM(e){let t,n;if(zm(e))t=e.attributes,n=TE(e)?e.name:"<unknown>";else{let i=typeof e.spanContext=="function"?oe(e):void 0;t=i?.data||{},n=TE(e)?e.name:i?.description||"<unknown>"}let r=_M(e);return Ap(n,t,r)}function wK({attributes:e,name:t}){let n=e[hn];if(typeof n=="string")return{op:"db",description:n,source:e[ve]||"custom"};if(e[ve]==="custom")return{op:"db",description:t,source:"custom"};let r=e[Ye];return{op:"db",description:r?r.toString():t,source:"task"}}function GK({name:e,kind:t,attributes:n},r){let i=["http"];switch(t){case gt.CLIENT:i.push("client");break;case gt.SERVER:i.push("server");break}n["sentry.http.prefetch"]&&i.push("prefetch");let{urlPath:o,url:s,query:c,fragment:a,hasRoute:l}=DK(n,t);if(!o)return{...Ip(e,n),op:i.join(".")};let p=n[Es],u=`${r} ${o}`,d=p?`${u} (${UK(p)})`:u,m=l||o==="/"?"route":"url",_={};s&&(_.url=Ct(s));let h=Yn(c);h&&(_["http.query"]=h.slice(1)),a&&(_["http.fragment"]=a.slice(1));let b=t===gt.CLIENT||t===gt.SERVER,M=!`${n[S]||"manual"}`.startsWith("auto"),N=n[ve]==="custom",R=n[hn],P=!N&&R==null&&(b||!M),{description:Y,source:T}=P?{description:d,source:m}:Ip(e,n);return{op:i.join("."),description:Y,source:T,data:_}}function UK(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 DK(e,t){let n=e[sd],r=e[Oi]||e[pt],i=e[Fe],o=typeof r=="string"?ro(r):void 0,s=o?io(o):void 0,c=o?.search||void 0,a=o?.hash||void 0;return typeof i=="string"?{urlPath:i,url:s,query:c,fragment:a,hasRoute:!0}:t===gt.SERVER&&typeof n=="string"?{urlPath:Ln(n),url:s,query:c,fragment:a,hasRoute:!1}:o?{urlPath:s,url:s,query:c,fragment:a,hasRoute:!1}:typeof n=="string"?{urlPath:Ln(n),url:s,query:c,fragment:a,hasRoute:!1}:{urlPath:void 0,url:s,query:c,fragment:a,hasRoute:!1}}function Ip(e,t,n="custom"){let r=t[ve]||n,i=t[hn];return i&&typeof i=="string"?{description:i,source:r}:{description:e,source:r}}function GE(e){e.on("createDsc",(t,n)=>{if(!n)return;let r=oe(n),o=r.data[ve],s=EM(n,e);if(s===!1)delete t.transaction;else if(r.description){let{description:c}=TM(n);o!=="url"&&c&&(t.transaction=c)}De()&&(t.sampled=s==null?void 0:String(s))})}function UE(){return de.getActiveSpan()}var So=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Jm=class e{constructor(){this._internalState=new Map}set(t,n){let r=this._clone();return r._internalState.has(t)&&r._internalState.delete(t),r._internalState.set(t,n),r}unset(t){let n=this._clone();return n._internalState.delete(t),n}get(t){return this._internalState.get(t)}serialize(){return Array.from(this._internalState.keys()).reverse().map(t=>`${t}=${this._internalState.get(t)}`).join(",")}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};function IM({dsc:e,sampled:t}){let n=e?qi(e):void 0,r=new Jm,i=n?r.set(ef,n):r;return t===!1?i.set(wE,"1"):i}var AM=new Set;function DE(){return Array.from(AM)}function Is(e){AM.add(e)}var uc=class extends tv{constructor(){super(),Is("SentryPropagator"),this._urlMatchesTargetsMap=new jt(100)}inject(t,n,r){if(Vs(t)){So&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let i=de.getSpan(t),o=i&&WK(i),{tracePropagationTargets:s,propagateTraceparent:c}=O()?.getOptions()||{};if(!ss(o,s,this._urlMatchesTargetsMap)){So&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",o);return}let a=HK(n),l=FK(n),p=hi.getBaggage(t)||hi.createBaggage({}),{dynamicSamplingContext:u,traceId:d,spanId:m,sampled:_}=NM(t);if(a){let h=na(a);h&&Object.entries(h).forEach(([b,v])=>{!l&&b.startsWith(Si)||(p=p.setEntry(b,{value:v}))})}!l&&u&&(p=Object.entries(u).reduce((h,[b,v])=>v?h.setEntry(`${Si}${b}`,{value:v}):h,p)),!l&&d&&d!==cv&&(r.set(n,Qm,Qi(d,m,_)),c&&r.set(n,"traceparent",$i(d,m,_))),super.inject(hi.setBaggage(t,p),n,r)}extract(t,n,r){let i=r.get(n,Qm),o=r.get(n,IE),s=i?Array.isArray(i)?i[0]:i:void 0;return vM(RM(t,{sentryTrace:s,baggage:o}))}fields(){return[Qm,IE,"traceparent"]}};function NM(e,t={}){let n=de.getSpan(e);if(n?.spanContext().isRemote){let c=n.spanContext();return{dynamicSamplingContext:it(n),traceId:c.traceId,spanId:void 0,sampled:pc(c)}}if(n){let c=n.spanContext();return{dynamicSamplingContext:it(n),traceId:c.traceId,spanId:c.spanId,sampled:EM(n,t.client)}}let r=t.scope||Ts(e)?.scope||ne(),i=t.client||O(),o=r.getPropagationContext();return{dynamicSamplingContext:i?cr(i,r):void 0,traceId:o.traceId,spanId:o.propagationSpanId,sampled:o.sampled}}function RM(e,{sentryTrace:t,baggage:n}){let r=Rn(t,n),{traceId:i,parentSpanId:o,sampled:s,dsc:c}=r,a=O(),l=sr(n);if(!o||a&&!el(a,l?.org_id))return e;let p=VK({traceId:i,spanId:o,sampled:s,dsc:c});return de.setSpanContext(e,p)}function BK(e,t,n){let r=vM(RM(e,t));return ce.with(r,n)}function vM(e){let t=Ts(e),n={scope:t?t.scope:ne().clone(),isolationScope:t?t.isolationScope:$()};return SM(e,n)}function HK(e){try{let t=e[IE];return Array.isArray(t)?t.join(","):t}catch{return}}function FK(e){try{return e[Qm]}catch{return}}function WK(e){let t=oe(e).data,n=t[Oi]||t[pt];if(typeof n=="string")return n;let r=e.spanContext().traceState?.get(hM);if(r)return r}function VK({spanId:e,traceId:t,sampled:n,dsc:r}){let i=IM({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?Xt.SAMPLED:Xt.NONE,traceState:i}}function OM(e,t,n){let r=kM(),{name:i,parentSpan:o}=e;return UM(o)(()=>{let c=wM(e.scope,e.forceTransaction),a=e.onlyIfParent&&!de.getSpan(c),l=a?Ws(c):c;a&&O()?.recordDroppedEvent("no_parent_span","span");let p=LM(e);if(!De()){let u=Vs(l)?l:Ws(l);return ce.with(u,()=>r.startActiveSpan(i,p,u,d=>(RE(d),ce.with(c,()=>lr(()=>t(d),()=>{oe(d).status===void 0&&d.setStatus({code:Lt.ERROR})},n?()=>d.end():void 0)))))}return r.startActiveSpan(i,p,l,u=>(RE(u),lr(()=>t(u),()=>{oe(u).status===void 0&&u.setStatus({code:Lt.ERROR})},n?()=>u.end():void 0)))})}function CM(e,t){return OM(e,t,!0)}function xM(e,t){return OM(e,n=>t(n,()=>n.end()),!1)}function PM(e){let t=kM(),{name:n,parentSpan:r}=e;return UM(r)(()=>{let o=wM(e.scope,e.forceTransaction),s=e.onlyIfParent&&!de.getSpan(o),c=s?Ws(o):o;s&&O()?.recordDroppedEvent("no_parent_span","span");let a=LM(e);De()||(c=Vs(c)?c:Ws(c));let l=t.startSpan(n,a,c);return RE(l),l})}function BE(e,t){let n=e?de.setSpan(ce.active(),e):de.deleteSpan(ce.active());return ce.with(n,()=>t(ne()))}function kM(){return O()?.tracer||de.getTracer("@sentry/opentelemetry",q)}function LM(e){let{startTime:t,attributes:n,kind:r,op:i,links:o}=e,s=typeof t=="number"?MM(t):t;return{attributes:i?{[H]:i,...n}:n,kind:r,links:o,startTime:s}}function MM(e){return e<9999999999?e*1e3:e}function RE(e){let t=e.end.bind(e);e.end=n=>t(typeof n=="number"?MM(n):n)}function wM(e,t){let n=YK(e),r=de.getSpan(n);if(!r||!t)return n;let i=de.deleteSpan(n),{spanId:o,traceId:s}=r.spanContext(),c=pc(r.spanContext()),a=Oe(r),l=it(a),p=IM({dsc:l,sampled:c}),u={traceId:s,spanId:o,isRemote:!0,traceFlags:c?Xt.SAMPLED:Xt.NONE,traceState:p};return de.setSpanContext(i,u)}function YK(e){if(e){let t=lc(e);if(t)return t}return ce.active()}function GM(e,t){return BK(ce.active(),e,t)}function jK(e){let t=yt(),n=qt(),r={traceId:t,spanId:n,isRemote:!0,traceFlags:Xt.NONE},i=de.setSpanContext(ce.active(),r);return ce.with(i,()=>(ne().setPropagationContext({traceId:t,sampleRand:ct()}),e()))}function HE(e,t){let n=lc(t),r=n&&de.getSpan(n),i=r?kr(r):Xo(t);return[r?it(r):cr(e,t),i]}function UM(e){return e!==void 0?t=>BE(e,t):t=>t()}function DM(e){let t=Ws(ce.active());return ce.with(t,e)}function ZK(e){let t=e?lc(e):ce.active();return t?Vs(t):!1}function FE(e){e.on("preprocessEvent",t=>{let n=UE();if(!n||t.type==="transaction")return;t.contexts={trace:kr(n),...t.contexts};let r=Oe(n);return t.sdkProcessingMetadata={dynamicSamplingContext:it(r),...t.sdkProcessingMetadata},t})}function BM(e,t){let n=de.getSpan(e),r;if(n?.spanContext().traceState?.get(tf)==="1"){let h=de.deleteSpan(e),b=de.getSpan(t);r=b?de.setSpan(h,b):h}else r=e;let i=Ts(r),o=i?.scope||ne(),s=i?.isolationScope||$(),c=r.getValue(AE)===!0,a=r.getValue(NE),l=r.getValue($m),p=a||o.clone(),u=l||(c?s.clone():s),_=SM(r,{scope:p,isolationScope:u}).deleteValue(AE).deleteValue(NE).deleteValue($m);return MK(p,_),_}function XK(e){let t=new Map;for(let n of e)KK(t,n);return Array.from(t,function([n,r]){return r})}function HM(e){return e.attributes[LE]===!0?void 0:ME(e)}function KK(e,t){let n=t.spanContext().spanId,r=HM(t);if(!r){vE(e,{id:n,span:t,children:[]});return}let i=qK(e,r),o=vE(e,{id:n,span:t,parentNode:i,children:[]});i.children.push(o)}function qK(e,t){let n=e.get(t);return n||vE(e,{id:t,children:[]})}function vE(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 FM={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"},WM=e=>Object.values(FM).includes(e);function VM(e){let t=zm(e)?e.attributes:{},n=fM(e)?e.status:void 0;if(n){if(n.code===Lt.OK)return{code:1};if(n.code===Lt.ERROR){if(typeof n.message>"u"){let i=OE(t);if(i)return i}return n.message&&WM(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=OE(t);return r||(n?.code===Lt.UNSET?{code:1}:{code:2,message:"unknown_error"})}function OE(e){let t=e[yn]||e[vi],n=e[yO],r=typeof t=="number"?t:typeof t=="string"?parseInt(t):void 0;if(typeof r=="number")return wt(r);if(typeof n=="string")return{code:2,message:FM[n]||"unknown_error"}}var lM=1e3,QK=300,$K=1e4,CE=class{constructor(t){this._finishedSpanBucketSize=t?.timeout||QK,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(rt()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new jt($K),this._debouncedFlush=ml(this.flush.bind(this),1,{maxWait:100})}export(t){let n=Math.floor(rt()/1e3);if(this._lastCleanupTimestampInS!==n){let s=0;this._finishedSpanBuckets.forEach((c,a)=>{c&&c.timestampInS<=n-this._finishedSpanBucketSize&&(s+=c.spans.size,this._finishedSpanBuckets[a]=void 0)}),s>0&&So&&g.log(`SpanExporter dropped ${s} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,i=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=i,i.spans.add(t),this._spansToBucketEntry.set(t,i);let o=HM(t);(!o||this._sentSpans.get(o))&&this._debouncedFlush()}flush(){let t=this._finishedSpanBuckets.flatMap(o=>o?Array.from(o.spans):[]),n=this._maybeSend(t),r=n.size,i=t.length-r;So&&g.log(`SpanExporter exported ${r} spans, ${i} spans are waiting for their parent spans to finish`);for(let o of n){this._sentSpans.set(o.spanContext().spanId,1);let s=this._spansToBucketEntry.get(o);s&&s.spans.delete(o)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(t){let n=XK(t),r=new Set,i=this._getCompletedRootNodes(n);for(let o of i){let s=o.span;r.add(s);let c=zK(s);if(o.parentNode&&this._sentSpans.get(o.parentNode.id)){let u=c.contexts?.trace?.data;u&&(u["sentry.parent_span_already_sent"]=!0)}let a=c.spans||[],l=!1;for(let u of o.children)xE(u,a,r)&&(l=!0);c.spans=a.length>lM?a.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,lM):a,l&&(c.sdkProcessingMetadata={...c.sdkProcessingMetadata,hasGenAiSpans:!0});let p=Jo(s.events);p&&(c.measurements=p),Sl(c)}return r}_nodeIsCompletedRootNodeOrHasSentParent(t){return!!t.span&&(!t.parentNode||!!this._sentSpans.get(t.parentNode.id))}_getCompletedRootNodes(t){return t.filter(n=>this._nodeIsCompletedRootNodeOrHasSentParent(n))}};function JK(e){let t=e.attributes,n=t[S],r=t[H],i=t[ve];return{origin:n,op:r,source:i}}function zK(e){let{op:t,description:n,data:r,origin:i="manual",source:o}=YM(e),s=$t(e),c=e.attributes[Wn],a={[ve]:o,[Wn]:c,[H]:t,[S]:i,...r,...jM(e.attributes)},{links:l}=e,{traceId:p,spanId:u}=e.spanContext(),d=ME(e),m=VM(e),_={parent_span_id:d,span_id:u,trace_id:p,data:a,origin:i,op:t,status:Qo(m),links:qo(l)},h=a[yn],b=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:_,otel:{resource:e.resource.attributes},...b},spans:[],start_timestamp:Jt(e.startTime),timestamp:Jt(e.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:s.scope,capturedSpanIsolationScope:s.isolationScope,sampleRate:c,dynamicSamplingContext:it(e)},...o&&{transaction_info:{source:o}}}}function xE(e,t,n){let r=e.span;if(r&&n.add(r),!r){let R=!1;return e.children.forEach(P=>{xE(P,t,n)&&(R=!0)}),R}let o=r.spanContext().spanId,s=r.spanContext().traceId,c=ME(r),{attributes:a,startTime:l,endTime:p,links:u}=r,{op:d,description:m,data:_,origin:h="manual"}=YM(r),b={[S]:h,[H]:d,...jM(a),..._},v=VM(r),M={span_id:o,trace_id:s,data:b,description:m,parent_span_id:c,start_timestamp:Jt(l),timestamp:Jt(p)||void 0,status:Qo(v),op:d,origin:h,measurements:Jo(r.events),links:qo(u)};t.push(M);let N=!!d?.startsWith("gen_ai.");return e.children.forEach(R=>{xE(R,t,n)&&(N=!0)}),N}function YM(e){let{op:t,source:n,origin:r}=JK(e),{op:i,description:o,source:s,data:c}=TM(e),a=t||i,l=n||s,p={...c,...e9(e)};return{op:a,description:o,source:l,origin:r,data:p}}function jM(e){let t={...e};return delete t[Wn],delete t[LE],delete t[hn],t}function e9(e){let t=e.attributes,n={};e.kind!==gt.INTERNAL&&(n["otel.kind"]=gt[e.kind]);let r=t[vi];r&&(n[yn]=r);let i=gM(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 rf(e,t){let n=e.attributes??{},r=t?.spanKind??D.INTERNAL,{op:i,description:o,source:s,data:c}=Ap(e.name,n,r);e.name=o,Bt(e,{[H]:i,[ve]:s,[IO]:"manual",...c}),r!==D.INTERNAL&&Bt(e,{"otel.kind":py(r)})}var Np=class{constructor(t){this._unsubscribePreprocessSpan=void 0,Is("SentrySpanProcessor"),this._exporter=new CE(t),this._client=t?.client??O(),this._client&&ot(this._client)&&(this._unsubscribePreprocessSpan=this._client.on("preprocessSpan",rf))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(t,n){let r=de.getSpan(n),i=Ts(n);r&&!r.spanContext().isRemote&&Ei(r,t),r?.spanContext().isRemote&&t.setAttribute(LE,!0),n===Cu&&(i={scope:Qs(),isolationScope:vt()}),i&&xr(t,i.scope,i.isolationScope),ll(t),this._client?.emit("spanStart",t)}onEnd(t){pl(t),this._client?.emit("spanEnd",t),this._client&&ot(this._client)?this._client.emit("afterSpanEnd",t):this._exporter.export(t)}},Rp=class{constructor(t){this._client=t,this._isSpanStreaming=ot(t),Is("SentrySampler")}shouldSample(t,n,r,i,o,s){let c=this._client.getOptions(),{ignoreSpans:a}=c,l=r9(t),p=l?.spanContext();if(!De(c))return wi({decision:void 0,context:t,spanAttributes:o});let u=o[Hr]||o[Fr];if(i===gt.CLIENT&&u&&(!l||p?.isRemote)&&!this._isSpanStreaming)return this._client.recordDroppedEvent("no_parent_span","span"),wi({decision:void 0,context:t,spanAttributes:o});let d=l?t9(l,n,r):void 0;if(!(!l||p?.isRemote)){if(this._isSpanStreaming){if(d&&a?.length){let{description:ae,op:ue}=Ap(r,o,i);if(ar({description:ae,op:o[H]??ue,attributes:o},a))return this._client.recordDroppedEvent("ignored","span"),wi({decision:et.NOT_RECORD,context:t,spanAttributes:o,ignoredChildSpan:!0})}if(!d){let ae=p?.traceState?.get(bM)==="1";this._client.recordDroppedEvent(ae?"ignored":"sample_rate","span")}}return wi({decision:d?et.RECORD_AND_SAMPLED:et.NOT_RECORD,context:t,spanAttributes:o})}let{description:_,data:h,op:b}=Ap(r,o,i),v={...h,...o};if(b&&(v[H]=b),this._isSpanStreaming&&a?.length&&ar({description:_,op:v[H]??b,attributes:v},a))return this._client.recordDroppedEvent("ignored","span"),wi({decision:et.NOT_RECORD,context:t,spanAttributes:o,ignoredSegmentSpan:!0});let M={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:v,spanName:_,parentSampled:d,parentContext:p},M),!M.decision)return wi({decision:void 0,context:t,spanAttributes:o});let{isolationScope:N}=Ts(t)??{},R=p?.traceState?p.traceState.get(ef):void 0,P=R?sr(R):void 0,Y=Nn(P?.sample_rand)??ct(),[T,G,k]=dl(c,{name:_,attributes:v,normalizedRequest:N?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:Nn(P?.sample_rate)},Y),U=`${u}`.toUpperCase();return U==="OPTIONS"||U==="HEAD"?(So&&g.log(`[Tracing] Not sampling span because HTTP method is '${U}' for ${r}`),wi({decision:et.NOT_RECORD,context:t,spanAttributes:o,sampleRand:Y,downstreamTraceSampleRate:0})):(!T&&d===void 0&&(So&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate",this._isSpanStreaming?"span":"transaction")),{...wi({decision:T?et.RECORD_AND_SAMPLED:et.NOT_RECORD,context:t,spanAttributes:o,sampleRand:Y,downstreamTraceSampleRate:k?G:void 0}),attributes:{[Wn]:k?G:void 0}})}toString(){return"SentrySampler"}};function t9(e,t,n){let r=e.spanContext();if(Kc(r)&&r.traceId===t){if(r.isRemote){let o=pc(e.spanContext());return So&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${o}`),o}let i=pc(r);return So&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${i}`),i}}function wi({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:i,ignoredChildSpan:o,ignoredSegmentSpan:s}){let c=n9(t,n);return i!==void 0&&(c=c.set(LK,`${i}`)),r!==void 0&&(c=c.set(kK,`${r}`)),o&&(c=c.set(tf,"1")),s&&(c=c.set(bM,"1")),e==null?{decision:et.NOT_RECORD,traceState:c}:e===et.NOT_RECORD?{decision:e,traceState:c.set(wE,"1")}:{decision:e,traceState:c}}function n9(e,t){let i=de.getSpan(e)?.spanContext()?.traceState||new Jm,o=t[Oi]||t[pt];return o&&typeof o=="string"&&(i=i.set(hM,o)),i}function r9(e){let t=de.getSpan(e);return t&&Kc(t.spanContext())?t:void 0}function of(e,t={}){let n=oe(e),r=n.data,i=e.kind??gt.INTERNAL,o=ta(e),s=r[hn]!==void 0,c=o&&!s&&!Vh(e),a=c&&r[ve]==="custom"?{...r,[ve]:void 0}:r,l=Ap(n.description||"<unknown>",a,i);if(i!==gt.INTERNAL&&r["otel.kind"]===void 0&&e.setAttribute("otel.kind",gt[i]),l.op&&r[H]===void 0&&e.setAttribute(H,l.op),l.source!==void 0&&l.source!=="custom"&&(t.finalizeStatus||l.source!=="url")&&(n.parent_span_id===void 0||i===gt.SERVER)&&(r[ve]===void 0||c)&&e.setAttribute(ve,l.source),l.data&&Object.entries(l.data).forEach(([u,d])=>{d!==void 0&&r[u]===void 0&&e.setAttribute(u,d)}),t.finalizeStatus){s9(e,r);let u=O();o9(e,r,n.status,!!u&&ot(u))}o&&l.description!==n.description&&(r[ve]!=="custom"||c)&&e.updateName(l.description)}function i9(e,t){Ge(e,"kind",t??gt.INTERNAL)}function o9(e,t,n,r){if(n===void 0){e.setStatus(OE(t)||{code:1});return}!r&&n!=="ok"&&!WM(n)&&e.setStatus({code:2,message:"internal_error"})}function s9(e,t){let n=t[vi];t[yn]===void 0&&n!==void 0&&(e.setAttribute(yn,n),t[yn]=n)}var PE=class{startSpan(t,n={},r){let i=r||ce.active(),o=n.root?void 0:de.getSpan(i);if(Vs(i))return this._createNonRecordingSpan(o);let s=this._startSentrySpan(t,n,o,r!==void 0);return Yh(s),i9(s,n.kind),n.attributes?.[ve]===void 0&&Fh(s),of(s),s}startActiveSpan(t,n,r,i){let o=typeof n=="function"?{}:n,s=typeof r=="function"||r===void 0?ce.active():r,c=typeof n=="function"?n:typeof r=="function"?r:i,a=this.startSpan(t,o,s),l=$t(a).isolationScope,p=u=>l?u.setValue($m,l):u;return wr(a)&&de.getSpan(s)?ce.with(p(s),()=>c(a)):ce.with(p(de.setSpan(s,a)),()=>(Fn(ne(),a),c(a)))}_startSentrySpan(t,n,r,i){let o={name:t,attributes:n.attributes,links:n.links,startTime:n.startTime};return n.root?On(()=>ca({...o,parentSpan:null})):r?.spanContext().isRemote?this._startRootSpanWithRemoteParent(o,r):r?ca({...o,parentSpan:r}):On(()=>ca({...o,parentSpan:i?null:void 0}))}_startRootSpanWithRemoteParent(t,n){let{spanId:r,traceId:i,traceState:o}=n.spanContext(),s=it(n),c=typeof s.sample_rand=="string"?Number(s.sample_rand):void 0,a=!!o?.get(ef);return He(l=>(l.setPropagationContext({traceId:i,parentSpanId:r,sampled:pc(n.spanContext()),dsc:a?s:void 0,sampleRand:typeof c=="number"&&!Number.isNaN(c)?c:ct()}),Fn(l,void 0),ca({...t,parentSpan:null})))}_createNonRecordingSpan(t){let n=new Lr({traceId:t?.spanContext().traceId});return t&&Ei(t,n),xr(n,ne(),$()),n}},vp=class{constructor(t={}){this._tracers=new Map,this.resource=t.resource}getTracer(t,n,r){let i=JSON.stringify([t,n,r]),o=this._tracers.get(i);if(o)return o;let s=new PE;return this._tracers.set(i,s),s}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},pM="telemetry.sdk.language",uM="telemetry.sdk.name",dM="telemetry.sdk.version",a9="service.namespace",kE=class e{constructor(t){this._attributes=t}get attributes(){return this._attributes}merge(t){return t?new e({...this._attributes,...t.attributes}):this}getRawAttributes(){return Object.entries(this._attributes)}};function c9(e){if(!e)return{};let t={};for(let n of e.split(",")){let r=n.indexOf("=");if(r===-1)continue;let i=n.substring(0,r).trim(),o=n.substring(r+1).trim();if(i)try{t[i]=decodeURIComponent(o)}catch{t[i]=o}}return t}function sf(e){let t=typeof process<"u"?process.env:{},n=t.OTEL_SERVICE_NAME,r=c9(t.OTEL_RESOURCE_ATTRIBUTES);return new kE({[a9]:"sentry",[Ab]:e,...r,...n?{[Ab]:n}:{},[CO]:q,[pM]:Ou[pM],[uM]:Ou[uM],[dM]:Ou[dM]})}function l9({span:e,scope:t,client:n,propagateTraceparent:r}={}){let i=(t&&lc(t))??ce.active();if(e){let{scope:p}=$t(e);i=p&&lc(p)||de.setSpan(ce.active(),e)}let{traceId:o,spanId:s,sampled:c,dynamicSamplingContext:a}=NM(i,{scope:t,client:n}),l={"sentry-trace":Qi(o,s,c),baggage:qi(a)};return r&&(l.traceparent=$i(o,s,c)),l}function ZM(e){function t(){let a=ce.active(),l=Ts(a);return l||{scope:Qs(),isolationScope:vt()}}function n(a){let l=ce.active();return ce.with(l,()=>a(s()))}function r(a,l){let p=lc(a)||ce.active();return ce.with(p.setValue(NE,a),()=>l(a))}function i(a){let l=ce.active();return ce.with(l.setValue(AE,!0),()=>{let p=s();return zc(p.getPropagationContext())||p.setPropagationContext({traceId:yt(),sampleRand:ct()}),a(c())})}function o(a,l){let p=ce.active();return ce.with(p.setValue($m,a),()=>l(c()))}function s(){return t().scope}function c(){return t().isolationScope}Rh({withScope:n,withSetScope:r,withSetIsolationScope:o,withIsolationScope:i,getCurrentScope:s,getIsolationScope:c,startSpan:CM,startSpanManual:xM,startInactiveSpan:PM,getActiveSpan:UE,suppressTracing:DM,isTracingSuppressed:ZK,getTraceData:l9,continueTrace:GM,startNewTrace:jK,withActiveSpan:BE,getTracingChannelBinding:e?.getTracingChannelBinding})}import{AsyncLocalStorage as XM}from"async_hooks";import{EventEmitter as p9}from"events";var u9=["addListener","on","once","prependListener","prependOnceListener"],af=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1,Is("SentryContextManager"),this._asyncLocalStorage=St(Je()).getTracingChannelBinding?.()?.asyncLocalStorage??new XM}active(){return this._asyncLocalStorage.getStore()??Cu}with(t,n,r,...i){let o=BM(t,this.active()),s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(o,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}bind(t,n){return n instanceof p9?this._bindEventEmitter(t,n):typeof n=="function"?this._bindFunction(t,n):n}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:nf}}_bindFunction(t,n){let r=this.with.bind(this),i=function(...o){return r(t,()=>n.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),i}_bindEventEmitter(t,n){if(this._getPatchMap(n)!==void 0)return n;this._createPatchMap(n);for(let r of u9)n[r]!==void 0&&(n[r]=this._patchAddListener(n,n[r],t));return typeof n.removeListener=="function"&&(n.removeListener=this._patchRemoveListener(n,n.removeListener)),typeof n.off=="function"&&(n.off=this._patchRemoveListener(n,n.off)),typeof n.removeAllListeners=="function"&&(n.removeAllListeners=this._patchRemoveAllListeners(n,n.removeAllListeners)),n}_patchRemoveListener(t,n){let r=this;return function(i,o){let s=r._getPatchMap(t)?.[i];if(s===void 0)return n.call(this,i,o);let c=s.get(o);return n.call(this,i,c||o)}}_patchRemoveAllListeners(t,n){let r=this;return function(i){let o=r._getPatchMap(t);return o!==void 0&&(arguments.length===0?r._createPatchMap(t):i!==void 0&&o[i]!==void 0&&delete o[i]),n.apply(this,arguments)}}_patchAddListener(t,n,r){let i=this;return function(o,s){if(i._wrapped)return n.call(this,o,s);let c=i._getPatchMap(t);c===void 0&&(c=i._createPatchMap(t));let a=c[o];a===void 0&&(a=new WeakMap,c[o]=a);let l=i.bind(r,s);a.set(s,l),i._wrapped=!0;try{return n.call(this,o,l)}finally{i._wrapped=!1}}}_createPatchMap(t){let n=Object.create(null);return t[this._kOtListeners]=n,n}_getPatchMap(t){return t[this._kOtListeners]}};function WE(e){ZM({getTracingChannelBinding:e?.skipOpenTelemetrySetup?m9():d9()})}function d9(){let e=new XM;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:KM})}function m9(){return()=>{try{let t=ce._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return t?{asyncLocalStorage:t,getStoreWithActiveSpan:KM}:void 0}catch{return}}}function KM(e){let t=ce.active();return wr(e)&&Oe(e)!==e||e.spanContext().traceState?.get(tf)==="1"?t:de.setSpan(t,e)}var Op=af;function VE(){Ee.disable(),Ee.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},sv.DEBUG)}var Cp={};function fe(e,t,n){return n?g9(e,t,n):f9(e,t)}function f9(e,t){return Object.assign(n=>{let r=Cp[e];if(r)return n&&r.setConfig(n),r;let i=t(n);return Cp[e]=i,Ja({instrumentations:[i]}),i},{id:e})}function g9(e,t,n){return Object.assign(r=>{let i=n(r),o=Cp[e];if(o)return o.setConfig(i),o;let s=new t(i);return Cp[e]=s,Ja({instrumentations:[s]}),s},{id:e})}import*as YE from"diagnostics_channel";var _9="ChildProcess",cf=(e={})=>({name:_9,setup(){YE.channel("child_process").subscribe(t=>{B(t)&&"process"in t&&h9(t.process,e)}),YE.channel("worker_threads").subscribe(t=>{B(t)&&"worker"in t&&b9(t.worker,e)})}});function h9(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",i=>{n||(n=!0,i!==null&&i!==0&&an({category:"child_process",message:`Child process exited with code '${i}'`,level:i===0?"info":"warning",data:r}))}).on("error",i=>{n||(n=!0,an({category:"child_process",message:`Child process errored with '${i.message}'`,level:"error",data:r}))})}function b9(e,t){let n;e.on("online",()=>{n=e.threadId}).on("error",r=>{t.captureWorkerErrors!==!1?ge(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):an({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as y9}from"child_process";import{readFile as S9,readdir as E9}from"fs";import*as Nt from"os";import{join as T9}from"path";import{promisify as $M}from"util";var I9=$M(S9),A9=$M(E9),N9="Context",R9=((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?P9():void 0,r=t.device?k9(t.device):void 0,i=t.culture?x9():void 0,o=t.cloudResource?D9():void 0,s=t.os?C9():void 0,c={"process.runtime.engine.name":"v8","process.runtime.engine.version":process.versions.v8,...qM({app:n,device:r,culture:i,cloud_resource:o})};s&&s.then(p=>Object.assign(c,qM({os:p}))).catch(()=>{});let a=(async()=>{let p={};return s&&(p.os=await s),n&&(p.app=n),r&&(p.device=r),i&&(p.culture=i),o&&(p.cloud_resource=o),p})();async function l(p){let u=v9(await a);return p.contexts={...p.contexts,app:{...u.app,...p.contexts?.app},os:{...u.os,...p.contexts?.os},device:{...u.device,...p.contexts?.device},culture:{...u.culture,...p.contexts?.culture},cloud_resource:{...u.cloud_resource,...p.contexts?.cloud_resource}},p}return{name:N9,processEvent(p){return l(p)},processSegmentSpan(p){Bt(p,c),Bt(p,O9(n,r))}}}),lf=R9;function v9(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=Nt.freemem()),e}function qM(e){let t={},{app:n,device:r,os:i,culture:o,cloud_resource:s}=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)),o&&(o.locale&&(t["culture.locale"]=o.locale),o.timezone&&(t["culture.timezone"]=o.timezone)),s)for(let[c,a]of Object.entries(s))a!=null&&(t[c]=a);return t}function O9(e,t){let n={};if(e&&(n["app.memory"]=process.memoryUsage().rss,typeof process.availableMemory=="function")){let r=process.availableMemory?.();r!=null&&(n["app.free_memory"]=r)}return t?.free_memory!=null&&(n["device.free_memory"]=Nt.freemem()),n}async function C9(){let e=Nt.platform();switch(e){case"darwin":return G9();case"linux":return U9();default:return{name:L9[e]||e,version:Nt.release()}}}function x9(){try{if(typeof process.versions.icu!="string")return;let e=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(e)==="enero"){let n=Intl.DateTimeFormat().resolvedOptions();return{locale:n.locale,timezone:n.timeZone}}}catch{}}function P9(){let e=process.memoryUsage().rss,n={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory=="function"){let r=process.availableMemory?.();r!=null&&(n.free_memory=r)}return n}function k9(e){let t={},n;try{n=Nt.uptime()}catch{}if(typeof n=="number"&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=Nt.arch(),(e===!0||e.memory)&&(t.memory_size=Nt.totalmem(),t.free_memory=Nt.freemem()),e===!0||e.cpu){let r=Nt.cpus(),i=r?.[0];i&&(t.processor_count=r.length,t.cpu_description=i.model,t.processor_frequency=i.speed)}return t}var L9={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},M9=[{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"]}],w9={alpine:e=>e,arch:e=>ii(/distrib_release=(.*)/,e),centos:e=>ii(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>ii(/release (..)/,e),mint:e=>ii(/distrib_release=(.*)/,e),red:e=>ii(/release ([^ ]+)/,e),suse:e=>ii(/VERSION = (.*)\n/,e),ubuntu:e=>ii(/distrib_release=(.*)/,e)};function ii(e,t){let n=e.exec(t);return n?n[1]:void 0}async function G9(){let e={kernel_version:Nt.release(),name:"Mac OS X",version:`10.${Number(Nt.release().split(".")[0])-4}`};try{let t=await new Promise((n,r)=>{y9("/usr/bin/sw_vers",(i,o)=>{if(i){r(i);return}n(o)})});e.name=ii(/^ProductName:\s+(.*)$/m,t),e.version=ii(/^ProductVersion:\s+(.*)$/m,t),e.build=ii(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function QM(e){return e.split(" ")[0].toLowerCase()}async function U9(){let e={kernel_version:Nt.release(),name:"Linux"};try{let t=await A9("/etc"),n=M9.find(c=>t.includes(c.name));if(!n)return e;let r=T9("/etc",n.name),i=(await I9(r,{encoding:"utf-8"})).toLowerCase(),{distros:o}=n;e.name=o.find(c=>i.indexOf(QM(c))>=0)||o[0];let s=QM(e.name);e.version=w9[s]?.(i)}catch{}return e}function D9(){return process.env.VERCEL?{"cloud.provider":"vercel","cloud.region":process.env.VERCEL_REGION}:process.env.AWS_REGION?{"cloud.provider":"aws","cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV}:process.env.GCP_PROJECT?{"cloud.provider":"gcp"}:process.env.ALIYUN_REGION_ID?{"cloud.provider":"alibaba_cloud","cloud.region":process.env.ALIYUN_REGION_ID}:process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME?{"cloud.provider":"azure","cloud.region":process.env.REGION_NAME}:process.env.IBM_CLOUD_REGION?{"cloud.provider":"ibm_cloud","cloud.region":process.env.IBM_CLOUD_REGION}:process.env.TENCENTCLOUD_REGION?{"cloud.provider":"tencent_cloud","cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE}:process.env.NETLIFY?{"cloud.provider":"netlify"}:process.env.FLY_REGION?{"cloud.provider":"fly.io","cloud.region":process.env.FLY_REGION}:process.env.DYNO?{"cloud.provider":"heroku"}:void 0}import{createReadStream as B9}from"fs";import{createInterface as H9}from"readline";var F9=/\.(?:[cm]?[jt]sx?|vue|svelte|astro|mdx)$/,jE=new jt(10),e1=new jt(20),W9=7,V9="ContextLines",Y9=1e3,j9=1e4;function Z9(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function X9(e){if(e.startsWith("node:")||e.startsWith("data:"))return!0;let t=Ln(e).toLowerCase();return t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")?!0:!F9.test(t)}function K9(e){return e.lineno!==void 0&&e.lineno>j9||e.colno!==void 0&&e.colno>Y9}function q9(e,t){let n=jE.get(e);if(n===void 0)return!1;for(let r=t[0];r<=t[1];r++)if(n[r]===void 0)return!1;return!0}function Q9(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!="number")return[];let i=zM(r,t),o=[];for(;;){if(n===e.length-1){o.push(i);break}let s=e[n+1];if(typeof s!="number")break;s<=i[1]?i[1]=s+t:(o.push(i),i=zM(s,t)),n++}return o}function $9(e,t,n){return new Promise((r,i)=>{let o=B9(e),s=H9({input:o});function c(){o.destroy(),r()}let a=0,l=0,p=t[l];if(p===void 0){c();return}let u=p[0],d=p[1];function m(_){e1.set(e,1),Ve&&g.error(`Failed to read file: ${e}. Error: ${_}`),s.close(),s.removeAllListeners(),c()}o.on("error",m),s.on("error",m),s.on("close",c),s.on("line",_=>{if(a++,!(a<u)&&(n[a]=Sh(_,0),a>=d)){if(l===t.length-1){s.close(),s.removeAllListeners();return}l++;let h=t[l];if(h===void 0){s.close(),s.removeAllListeners();return}u=h[0],d=h[1]}})})}async function J9(e,t){let n={};if(t>0&&e.exception?.values){for(let o of e.exception.values)if(o.stacktrace?.frames?.length)for(let s=o.stacktrace.frames.length-1;s>=0;s--){let c=o.stacktrace.frames[s],a=c?.filename;if(!c||typeof a!="string"||typeof c.lineno!="number"||X9(a)||K9(c))continue;n[a]||(n[a]=[]),n[a].push(c.lineno)}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let o of r){if(e1.get(o))continue;let s=n[o];if(!s)continue;s.sort((l,p)=>l-p);let c=Q9(s,t);if(c.every(l=>q9(o,l)))continue;let a=Z9(jE,o,{});i.push($9(o,c,a))}if(await Promise.all(i).catch(()=>{Ve&&g.log("Failed to read one or more source files and resolve context lines")}),t>0&&e.exception?.values)for(let o of e.exception.values)o.stacktrace?.frames&&o.stacktrace.frames.length>0&&z9(o.stacktrace.frames,t,jE);return e}function z9(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=n.get(r.filename);if(i===void 0)continue;eq(r.lineno,r,t,i)}}function JM(e){delete e.pre_context,delete e.context_line,delete e.post_context}function eq(e,t,n,r){if(t.lineno===void 0||r===void 0){Ve&&g.error("Cannot resolve context for frame with no lineno or file contents");return}t.pre_context=[];for(let o=t1(e,n);o<e;o++){let s=r[o];if(s===void 0){JM(t),Ve&&g.error(`Could not find line ${o} in file ${t.filename}`);return}t.pre_context.push(s)}if(r[e]===void 0){JM(t),Ve&&g.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=n1(e,n);t.post_context=[];for(let o=e+1;o<=i;o++){let s=r[o];if(s===void 0)break;t.post_context.push(s)}}function t1(e,t){return Math.max(1,e-t)}function n1(e,t){return e+t}function zM(e,t){return[t1(e,t),n1(e,t)]}var tq=((e={})=>({name:V9,processEvent(t,n,r){let i=e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??W9;return J9(t,i)}})),pf=tq;import{Worker as nq}from"worker_threads";var uf;async function dc(){if(uf===void 0)try{uf=!!(await import("inspector")).url()}catch{uf=!1}return uf}function df(e,t){return Ra(e,t)}var xp="__SENTRY_ERROR_LOCAL_VARIABLES__";function i1(e,t,n){let r=0,i=5,o=0;return setInterval(()=>{o===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),o=i):(o-=1,o===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function r1(e){return e!==void 0&&(e.length===0||e==="?"||e==="<anonymous>")}function mf(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||r1(e)&&r1(t)}var rq="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc4LjAgKDVmMjc3ZGUpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z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O2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function o1(...e){g.log("[LocalVariables]",...e)}var s1=((e={})=>{function t(o,s,c){if(c===!1)return;let a=(o.stacktrace?.frames||[]).filter(l=>l.function!=="new Promise");for(let l=0;l<a.length;l++){let p=a.length-l-1,u=s[l],d=a[p];if(!d||!u)break;u.vars===void 0||d.in_app===!1&&e.includeOutOfAppFrames!==!0||!mf(d.function,u.function)||(d.vars=df(u.vars,c))}}function n(o,s){if(s.originalException&&typeof s.originalException=="object"&&xp in s.originalException&&Array.isArray(s.originalException[xp])){let c=O()?.getDataCollectionOptions().stackFrameVariables??!0;for(let a of o.exception?.values||[])t(a,s.originalException[xp],c);s.originalException[xp]=void 0}return o}async function r(){let o=await import("inspector");o.url()||o.open(0)}function i(o){let s=new nq(new URL(`data:application/javascript;base64,${rq}`),{workerData:o,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{s.terminate()}),s.once("error",c=>{o1("Worker error",c)}),s.once("exit",c=>{o1("Worker exit",c)}),s.unref()}return{name:"LocalVariablesAsync",async setup(o){if(!o.getOptions().includeLocalVariables)return;if(await dc()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let c={...e,debug:g.isEnabled()};r().then(()=>{try{i(c)}catch(a){g.error("Failed to start worker",a)}},a=>{g.error("Failed to start inspector",a)})},processEvent(o,s){return n(o,s)}}});function a1(e){if(e!==void 0)return e.slice(-10).reduce((t,n)=>`${t},${n.function},${n.lineno},${n.colno}`,"")}function iq(e,t){if(t!==void 0)return a1(e(t,1))}function c1(e){let t=[],n=!1;function r(s){t=[],!n&&(n=!0,e(s))}t.push(r);function i(s){t.push(s)}function o(s){let c=t.pop()||r;try{c(s)}catch{r(s)}}return{add:i,next:o}}var ZE=class e{constructor(t){this._session=t}static async create(t){if(t)return t;let n=await import("inspector");return new e(new n.Session)}configureAndConnect(t,n){this._session.connect(),this._session.on("Debugger.paused",r=>{t(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(t){this._session.post("Debugger.setPauseOnExceptions",{state:t?"all":"uncaught"})}getLocalVariables(t,n){this._getProperties(t,r=>{let{add:i,next:o}=c1(n);for(let s of r)if(s.value?.objectId&&s.value.className==="Array"){let c=s.value.objectId;i(a=>this._unrollArray(c,s.name,a,o))}else if(s.value?.objectId&&s.value.className==="Object"){let c=s.value.objectId;i(a=>this._unrollObject(c,s.name,a,o))}else s.value&&i(c=>this._unrollOther(s,c,o));o({})})}_getProperties(t,n){this._session.post("Runtime.getProperties",{objectId:t,ownProperties:!0},(r,i)=>{n(r?[]:i.result)})}_unrollArray(t,n,r,i){this._getProperties(t,o=>{r[n]=o.filter(s=>s.name!=="length"&&!isNaN(parseInt(s.name,10))).sort((s,c)=>parseInt(s.name,10)-parseInt(c.name,10)).map(s=>s.value?.value),i(r)})}_unrollObject(t,n,r,i){this._getProperties(t,o=>{r[n]=o.map(s=>[s.name,s.value?.value]).reduce((s,[c,a])=>(s[c]=a,s),{}),i(r)})}_unrollOther(t,n,r){t.value&&("value"in t.value?t.value.value===void 0||t.value.value===null?n[t.name]=`<${t.value.value}>`:n[t.name]=t.value.value:"description"in t.value&&t.value.type!=="function"?n[t.name]=`<${t.value.description}>`:t.value.type==="undefined"&&(n[t.name]="<undefined>")),r(n)}},oq="LocalVariables",sq=((e={},t)=>{let n=new jt(20),r,i=!1;function o(l,p){let u=a1(l.stacktrace?.frames);if(u===void 0)return;let d=n.remove(u);if(d===void 0||p===!1)return;let m=(l.stacktrace?.frames||[]).filter(_=>_.function!=="new Promise");for(let _=0;_<m.length;_++){let h=m.length-_-1,b=d[_],v=m[h];if(!v||!b)break;b.vars===void 0||v.in_app===!1&&e.includeOutOfAppFrames!==!0||!mf(v.function,b.function)||(v.vars=df(b.vars,p))}}function s(l){for(let p of l.exception?.values||[])o(p,O()?.getDataCollectionOptions().stackFrameVariables??!0);return l}let c;async function a(){let p=O()?.getOptions();if(!p?.includeLocalVariables)return;if(ic<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await dc()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let d=await ZE.create(t),m=(h,{params:{reason:b,data:v,callFrames:M}},N)=>{if(b!=="exception"&&b!=="promiseRejection"){N();return}r?.();let R=iq(h,v.description);if(R==null){N();return}let{add:P,next:Y}=c1(T=>{n.set(R,T),N()});for(let T=0;T<Math.min(M.length,5);T++){let{scopeChain:G,functionName:k,this:U}=M[T],ae=G.find(Ne=>Ne.type==="local"),ue=U.className==="global"||!U.className?k:`${U.className}.${k}`;if(ae?.object.objectId===void 0)P(Ne=>{Ne[T]={function:ue},Y(Ne)});else{let Ne=ae.object.objectId;P(Te=>d.getLocalVariables(Ne,Ce=>{Te[T]={function:ue,vars:Ce},Y(Te)}))}}Y([])},_=e.captureAllExceptions!==!1;if(d.configureAndConnect((h,b)=>m(p.stackParser,h,b),_),_){let h=e.maxExceptionsPerSecond||50;r=i1(h,()=>{g.log("Local variables rate-limit lifted."),d.setPauseOnExceptions(!0)},b=>{g.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${b} seconds.`),d.setPauseOnExceptions(!1)})}i=!0}catch(d){g.log("The `LocalVariables` integration failed to start.",d)}}return{name:oq,setupOnce(){c=a()},async processEvent(l){return await c,i?s(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}}),l1=sq;var ff=(e={})=>rn.major<19?l1(e):s1(e);import{readFileSync as aq}from"fs";import{join as cq}from"path";var XE,lq="Modules";function pq(){return typeof __SENTRY_SERVER_MODULES__<"u"?__SENTRY_SERVER_MODULES__:te.__SENTRY_SERVER_MODULES__??{}}var uq=(()=>({name:lq,processEvent(e){return e.modules={...e.modules,...p1()},e},getModules:p1})),gf=uq;function dq(){return{...pq(),...fq()}}function p1(){return XE||(XE=dq()),XE}function mq(){try{let e=cq(process.cwd(),"package.json");return JSON.parse(aq(e,"utf8"))}catch{return{}}}function fq(){let e=mq();return{...e.dependencies,...e.devDependencies}}import{isMainThread as _q}from"worker_threads";var gq=2e3,u1=!1;function Pp(e){if(u1)return;u1=!0,we(()=>{console.error(e)});let t=O();if(t===void 0){Ve&&g.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:gq;t.close(r).then(i=>{i||Ve&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},i=>{Ve&&g.error(i),global.process.exit(1)})}var hq="OnUncaughtException",_f=(e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:hq,setup(n){_q&&global.process.on("uncaughtException",bq(n,t))}}};function bq(e,t){let r=!1,i=!1,o=!1,s,c=e.getOptions();return Object.assign(a=>{let l=Pp;t.onFatalError?l=t.onFatalError:c.onFatalError&&(l=c.onFatalError);let u=global.process.listeners("uncaughtException").filter(m=>m.name!=="domainUncaughtExceptionClear"&&m._errorHandler!==!0).length===0,d=t.exitEvenIfOtherHandlersAreRegistered||u;r?d&&(o?(Ve&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Pp(a)):i||(i=!0,setTimeout(()=>{o||(o=!0,l(s,a))},2e3))):(s=a,r=!0,O()===e&&ge(a,{originalException:a,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!o&&d&&(o=!0,l(a)))},{_errorHandler:!0})}var yq="OnUnhandledRejection",Sq=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],Eq=((e={})=>{let t={mode:e.mode??"warn",ignore:[...Sq,...e.ignore??[]]};return{name:yq,setup(n){global.process.on("unhandledRejection",Nq(n,t))}}}),hf=Eq;function Tq(e){if(!B(e))return{name:"",message:String(e??"")};let t=e,n=typeof t.name=="string"?t.name:"",r=typeof t.message=="string"?t.message:String(e);return{name:n,message:r}}function Iq(e,t){let n=e.name===void 0||Or(t.name,e.name,!0),r=e.message===void 0||Or(t.message,e.message);return n&&r}function Aq(e,t){let n=Tq(t);return e.some(r=>Iq(r,n))}function Nq(e,t){return function(r,i){if(O()!==e||Aq(t.ignore??[],r))return;let o=t.mode==="strict"?"fatal":"error",s=B(r)?r._sentry_active_span:void 0;(s?a=>se(s,a):a=>a())(()=>{ge(r,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:o},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),Rq(r,t.mode)}}function Rq(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"?we(()=>{console.warn(n),console.error(B(e)&&"stack"in e?e.stack:e)}):t==="strict"&&(we(()=>{console.warn(n)}),Pp(e))}var vq="ProcessSession",bf=()=>({name:vq,setupOnce(){El(),process.on("beforeExit",()=>{$().getSession()?.status==="ok"&&rs()})}});import*as d1 from"http";var KE="Spotlight",Oq=((e={})=>{let t={sidecarUrl:e.sidecarUrl||"http://localhost:8969/stream"};return{name:KE,setup(n){try{g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}Cq(n,t)}}}),yf=Oq;function Cq(e,t){let n=xq(t.sidecarUrl);if(!n)return;let r=0;e.on("beforeEnvelope",i=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let o=cl(i);Vn(()=>{let s=d1.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},c=>{c.statusCode&&c.statusCode>=200&&c.statusCode<400&&(r=0),c.on("data",()=>{}),c.on("end",()=>{}),c.setEncoding("utf8")});s.on("error",()=>{r++,g.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),s.write(o),s.end()})})}function xq(e){try{return new URL(`${e}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var Sf=(e={})=>({name:"Console",setup(t){process.env.LAMBDA_TASK_ROOT&&$c("console",Pq),Ny({...e,filter:[...e.filter||[],"[DEP0205] DeprecationWarning"]}).setup?.(t)}});function Pq(){let e=te?.console;e&&nr.forEach(t=>{t in e&&kq(e,t)})}function kq(e,t){let n=e[t];tr[t]=n;let r=n,i,o=!1,s=function(...a){if(o){n.apply(e,a);return}o=!0;try{Ys("console",{args:a,level:t}),r.apply(e,a)}finally{o=!1}};Wo(s,n);let c=n.bind(e);tr[t]=c;try{let a=s;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return a},set(l){l===s?(i!==void 0&&(r=i,i=void 0),a=s):l===c?(i=r,a=c):typeof l=="function"&&!l.__sentry_original__?(r=l,a=s):a=l}})}catch{Mt(e,t,function(a){return tr[t]=a,function(...l){Ys("console",{args:l,level:t}),tr[t]?.apply(this,l)}})}}import*as qE from"util";var Lq="NodeSystemError";function Mq(e){return!(e instanceof Error)||!("errno"in e)||typeof e.errno!="number"||typeof qE.getSystemErrorMap!="function"?!1:qE.getSystemErrorMap().has(e.errno)}var Ef=(e={})=>({name:Lq,processEvent:(t,n,r)=>{if(!Mq(n.originalException))return t;let i=n.originalException,o={...i};!r.getDataCollectionOptions().userInfo&&e.includePaths!==!0&&(delete o.path,delete o.dest),t.contexts={...t.contexts,node_system_error:o};for(let s of t.exception?.values||[])s.value&&(i.path&&s.value.includes(i.path)&&(s.value=s.value.replace(`'${i.path}'`,"").trim()),i.dest&&s.value.includes(i.dest)&&(s.value=s.value.replace(`'${i.dest}'`,"").trim()));return t}});import*as Gq from"http";import*as Uq from"https";import{Readable as Dq}from"stream";import{createGzip as Bq}from"zlib";import*as Gi from"net";import*as $E from"tls";import*as QE from"http";import"https";var m1,oi=Symbol("AgentBaseInternalState"),Tf=class extends(m1=QE.Agent,m1){constructor(t){super(t),this[oi]={}}isSecureEndpoint(t){if(t){if(typeof t.secureEndpoint=="boolean")return t.secureEndpoint;if(typeof t.protocol=="string")return t.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
|
|
26
|
+
`).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(t,n,r){let i={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(t,i)).then(o=>{if(o instanceof QE.Agent)return o.addRequest(t,i);this[oi].currentSocket=o,super.createSocket(t,n,r)},r)}createConnection(){let t=this[oi].currentSocket;if(this[oi].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[oi].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(t){this[oi]&&(this[oi].defaultPort=t)}get protocol(){return this[oi].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[oi]&&(this[oi].protocol=t)}};function If(...e){g.log("[https-proxy-agent:parse-proxy-response]",...e)}function f1(e){return new Promise((t,n)=>{let r=0,i=[];function o(){let p=e.read();p?l(p):e.once("readable",o)}function s(){e.removeListener("end",c),e.removeListener("error",a),e.removeListener("readable",o)}function c(){s(),If("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function a(p){s(),If("onerror %o",p),n(p)}function l(p){i.push(p),r+=p.length;let u=Buffer.concat(i,r),d=u.indexOf(`\r
|
|
27
|
+
\r
|
|
28
|
+
`);if(d===-1){If("have not received end of HTTP headers yet..."),o();return}let m=u.subarray(0,d).toString("ascii").split(`\r
|
|
29
|
+
`),_=m.shift();if(!_)return e.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=_.split(" "),b=+(h[1]||0),v=h.slice(2).join(" "),M={};for(let N of m){if(!N)continue;let R=N.indexOf(":");if(R===-1)return e.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${N}"`));let P=N.slice(0,R).toLowerCase(),Y=N.slice(R+1).trimStart(),T=M[P];typeof T=="string"?M[P]=[T,Y]:Array.isArray(T)?T.push(Y):M[P]=Y}If("got proxy server response: %o %o",_,M),s(),t({connect:{statusCode:b,statusText:v,headers:M},buffered:u})}e.on("error",a),e.on("end",c),o()})}function kp(...e){g.log("[https-proxy-agent]",...e)}var Lp=class extends Tf{constructor(t,n){super(n),this.options={},this.proxy=typeof t=="string"?new URL(t):t,this.proxyHeaders=n?.headers??{},kp("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),i=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?g1(n,"headers"):null,host:r,port:i}}async connect(t,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let i;if(r.protocol==="https:"){kp("Creating `tls.Socket`: %o",this.connectOpts);let d=this.connectOpts.servername||this.connectOpts.host;i=$E.connect({...this.connectOpts,servername:d&&Gi.isIP(d)?void 0:d})}else kp("Creating `net.Socket`: %o",this.connectOpts),i=Gi.connect(this.connectOpts);let o=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},s=Gi.isIPv6(n.host)?`[${n.host}]`:n.host,c=`CONNECT ${s}:${n.port} HTTP/1.1\r
|
|
30
|
+
`;if(r.username||r.password){let d=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(d).toString("base64")}`}o.Host=`${s}:${n.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let d of Object.keys(o))c+=`${d}: ${o[d]}\r
|
|
31
|
+
`;let a=f1(i);i.write(`${c}\r
|
|
32
|
+
`);let{connect:l,buffered:p}=await a;if(t.emit("proxyConnect",l),this.emit("proxyConnect",l,t),l.statusCode===200){if(t.once("socket",wq),n.secureEndpoint){kp("Upgrading socket connection to TLS");let d=n.servername||n.host;return $E.connect({...g1(n,"host","path","port"),socket:i,servername:Gi.isIP(d)?void 0:d})}return i}i.destroy();let u=new Gi.Socket({writable:!1});return u.readable=!0,t.once("socket",d=>{kp("Replaying proxy buffer for failed request"),d.push(p),d.push(null)}),u}};Lp.protocols=["http","https"];function wq(e){e.resume()}function g1(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var Hq=1024*32;function Fq(e){return new Dq({read(){this.push(e),this.push(null)}})}function Af(e){let t;try{t=new URL(e.url)}catch{return we(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),Aa(e,()=>Promise.resolve({}))}let n=t.protocol==="https:",r=Wq(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?Uq:Gq,o=e.keepAlive===void 0?!1:e.keepAlive,s=r?new Lp(r):new i.Agent({keepAlive:o,maxSockets:30,timeout:2e3}),c=Vq(e,e.httpModule??i,s);return Aa(e,c)}function Wq(e,t){let{no_proxy:n}=process.env;if(!n?.split(",").some(i=>e.host.endsWith(i)||e.hostname.endsWith(i)))return t}function Vq(e,t,n){let{hostname:r,pathname:i,port:o,protocol:s,search:c}=new URL(e.url);return function(l){return new Promise((p,u)=>{Vn(()=>{let d=Fq(l.body),m={...e.headers};l.body.length>Hq&&(m["content-encoding"]="gzip",d=d.pipe(Bq()));let _=r.startsWith("["),h=t.request({method:"POST",agent:n,headers:m,hostname:_?r.slice(1,-1):r,path:`${i}${c}`,port:o,protocol:s,ca:e.caCerts},b=>{b.on("data",()=>{}),b.on("end",()=>{}),b.setEncoding("utf8");let v=b.headers["retry-after"]??null,M=b.headers["x-sentry-rate-limits"]??null;p({statusCode:b.statusCode,headers:{"retry-after":v,"x-sentry-rate-limits":Array.isArray(M)?M[0]||null:M}})});h.on("error",u),d.pipe(h)})})}}function _1(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=is(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}import{posix as Yq,sep as jq}from"path";function h1(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function Nf(e=process.argv[1]?Sy(process.argv[1]):process.cwd(),t=jq==="\\"){let n=t?h1(e):e;return r=>{if(!r)return;let i=t?h1(r):r,{dir:o,base:s,ext:c}=Yq.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(s=s.slice(0,c.length*-1));let a=decodeURIComponent(s);o||(o=".");let l=o.lastIndexOf("/node_modules");if(l>-1)return`${o.slice(l+14).replace(/\//g,".")}:${a}`;if(o.startsWith(n)){let p=o.slice(n.length+1).replace(/\//g,".");return p?`${p}:${a}`:a}return a}}function Rf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(te.SENTRY_RELEASE?.id)return te.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 vf=ku(hS(Nf()));import*as b1 from"os";import{threadId as Zq,isMainThread as Xq}from"worker_threads";var Kq=6e4,mc=class extends np{constructor(t){let n=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||b1.hostname(),r={...t,platform:"node",runtime:t.runtime||{name:"node",version:global.process.version},serverName:n};t.openTelemetryInstrumentations&&Ja({instrumentations:t.openTelemetryInstrumentations}),os(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${Xq?"main":`worker-${Zq}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Ea(this)},n&&this.on("beforeCaptureLog",i=>{i.attributes={...i.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener)),this._metricsOnExitFlushListener=()=>{Ta(this)},process.on("beforeExit",this._metricsOnExitFlushListener),pb(this)}get tracer(){if(this._tracer)return this._tracer;let t="@sentry/node",n=q,r=de.getTracer(t,n);return this._tracer=r,r}async flush(t){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(t)}async close(t){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener),this._metricsOnExitFlushListener&&process.off("beforeExit",this._metricsOnExitFlushListener);let n=await super.close(t);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let t=this.getOptions();t.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{Ve&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},t.clientReportFlushInterval??Kq).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){ry(),super._setupIntegrations()}_getTraceInfoFromScope(t){return t?HE(this,t):[void 0,void 0]}};var E1=Nu(rE(),1);import*as T1 from"module";var y1;function S1(){return ic>=21||ic===20&&iE>=6||ic===18&&iE>=19?!0:(y1||(y1=!0,we(()=>{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 Mp(){if(S1()&&!te._sentryEsmLoaderHookRegistered){te._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,E1.createAddHookMessageChannel)();T1.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:e,include:[]},transferList:[e]})}catch(e){g.warn("Failed to register 'import-in-the-middle' hook",e)}}}function Of(){return[xl(),Cl(),Pl(),kl(),Ef(),Oy(),Sf(),PL(),UL(),_f(),hf(),pf(),ff(),lf(),cf(),bf(),gf()]}function JE(e={}){return qq(e,Of)}function qq(e={},t){let n=Qq(e,t);n.debug===!0&&(Ve?g.enable():we(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&Mp(),WE(n),ne().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:o})=>o===KE)&&n.integrations.push(yf({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),os(n,"node-core");let i=new mc(n);return ne().setClient(i),i.init(),g.log("SDK initialized from ESM"),i.startClientReportTracking(),zq(),GE(i),FE(i),process.env.VERCEL&&process.on("SIGTERM",async()=>{await i.flush(200)}),i}function Cf(){if(!Ve)return;let e=DE(),t=["SentryContextManager","SentryPropagator"],n=e.includes("SentryTracerProvider");De()&&!n&&t.push("SentrySpanProcessor");for(let r of t)e.includes(r)||g.error(`You have to set up the ${r}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);!n&&!e.includes("SentrySampler")&&g.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 Qq(e,t){let n=$q(e.release),r=_1(e.spotlight),i=Jq(e.tracesSampleRate),o={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??Af,stackParser:ph(e.stackParser||vf),release:n,tracesSampleRate:i,spotlight:r,debug:is(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,c=e.defaultIntegrations??t(o),a=Wb({defaultIntegrations:c,integrations:s});return{...o,integrations:a}}function $q(e){if(e!==void 0)return e;let t=Rf();if(t!==void 0)return t}function Jq(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 zq(){if(is(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Rn(e,t);ne().setPropagationContext(n)}}var I1=e=>{let t;return t=!1,{package:e,"javascript.is_cjs":t}};function Sr(e,t){let n=O()?.getOptions();!n?.disableInstrumentationWarnings&&!(w(e)||typeof vr(e)=="function")&&ns()&&De(n)&&(we(()=>{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/.`)}),Zo().setContext("missing_instrumentation",I1(t)))}import{types as e4}from"util";import{Worker as t4}from"worker_threads";var{isPromise:n4}=e4,r4="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc4LjAgKDVmMjc3ZGUpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyB0fWZyb20ibm9kZTppbnNwZWN0b3IiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIG4scGFyZW50UG9ydCBhcyBlfWZyb20ibm9kZTp3b3JrZXJfdGhyZWFkcyI7aW1wb3J0e3Bvc2l4IGFzIHIsc2VwIGFzIG99ZnJvbSJub2RlOnBhdGgiO2ltcG9ydCphcyBpIGZyb20ibm9kZTpodHRwIjtpbXBvcnQqYXMgcyBmcm9tIm5vZGU6aHR0cHMiO2ltcG9ydHtSZWFkYWJsZSBhcyBjfWZyb20ibm9kZTpzdHJlYW0iO2ltcG9ydHtjcmVhdGVHemlwIGFzIHV9ZnJvbSJub2RlOnpsaWIiO2ltcG9ydCphcyBhIGZyb20ibm9kZTpuZXQiO2ltcG9yd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nSW1hZ2VzJiYocG49dC5kZWJ1Z0ltYWdlcyksd24oKX0pOw==",i4=50,o4=5e3;function zE(e,...t){g.log(`[ANR] ${e}`,...t)}function s4(){return te}function a4(){let e=Cn($(),ne());return e.attachments=[],e.eventProcessors=[],e}async function c4(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 A1="Anr",l4=((e={})=>{if(rn.major<16||rn.major===16&&rn.minor<17)throw new Error("ANR detection requires Node 16.17.0 or later");let t,n,r=s4();return r.__SENTRY_GET_SCOPES__=a4,{name:A1,startWorker:()=>{t||n&&(t=p4(n,e))},stopWorker:()=>{t&&t.then(i=>{i(),t=void 0})},async setup(i){n=i,e.captureStackTrace&&await dc()&&(g.warn("ANR captureStackTrace has been disabled because the debugger was already enabled"),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}),N1=l4;async function p4(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await c4(e);delete r.app?.app_memory,delete r.device?.free_memory;let i=e.getOptions(),o=e.getSdkMetadata()||{};o.sdk&&(o.sdk.integrations=i.integrations.map(l=>l.name));let s={debug:g.isEnabled(),dsn:n,tunnel:i.tunnel,environment:i.environment||"production",release:i.release,dist:i.dist,sdkMetadata:o,appRootPath:t.appRootPath,pollInterval:t.pollInterval||i4,anrThreshold:t.anrThreshold||o4,captureStackTrace:!!t.captureStackTrace,maxAnrEvents:t.maxAnrEvents||1,staticTags:t.staticTags||{},contexts:r};if(s.captureStackTrace){let l=await import("inspector");l.url()||l.open(0)}let c=new t4(new URL(`data:application/javascript;base64,${r4}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{c.terminate()});let a=setInterval(()=>{try{let l=$().getSession(),p=l?{...l,toJSON:void 0}:void 0;c.postMessage({session:p,debugImages:hl(i.stackParser)})}catch{}},s.pollInterval);return a.unref(),c.on("message",l=>{l==="session-ended"&&(zE("ANR event sent from ANR worker. Clearing session in this thread."),$().setSession(void 0))}),c.once("error",l=>{clearInterval(a),zE("ANR worker error",l)}),c.once("exit",l=>{clearInterval(a),zE("ANR worker exit",l)}),c.unref(),()=>{c.terminate(),clearInterval(a)}}function R1(e){let t=O()?.getIntegrationByName(A1);if(!t)return e();t.stopWorker();let n=e();return n4(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}var eT={};ev(eT,{debug:()=>m4,error:()=>_4,fatal:()=>h4,fmt:()=>ay,info:()=>f4,trace:()=>d4,warn:()=>g4});import{format as u4}from"util";function Ui(e,...t){let[n,r,i,o]=t;if(Array.isArray(r)){let s={...i};s["sentry.message.template"]=n,r.forEach((a,l)=>{s[`sentry.message.parameter.${l}`]=a});let c=u4(n,...r);dr({level:e,message:c,attributes:s},o?.scope)}else dr({level:e,message:n,attributes:r},i?.scope??o?.scope)}function d4(...e){Ui("trace",...e)}function m4(...e){Ui("debug",...e)}function f4(...e){Ui("info",...e)}function g4(...e){Ui("warn",...e)}function _4(...e){Ui("error",...e)}function h4(...e){Ui("fatal",...e)}import{monitorEventLoopDelay as b4,performance as tT}from"perf_hooks";var v1="NodeRuntimeMetrics",O1=3e4,xf=1e3,C1=10;function nT(e,t,n){return Number.isFinite(e)?e<xf?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${xf}ms. Using minimum of ${xf}ms.`),xf):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var x1=(e={})=>{let t=nT(e.collectionIntervalMs??O1,v1,O1),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,o,s,c,a=0,l,p=C1*1e6,u=b=>Math.max(0,(b-p)/1e9),d={attributes:{"sentry.origin":"auto.node.runtime_metrics"}},m={unit:"byte",attributes:{"sentry.origin":"auto.node.runtime_metrics"}},_={unit:"second",attributes:{"sentry.origin":"auto.node.runtime_metrics"}};function h(){let b=rt(),v=b-a;if(i&&s!==void 0){let M=process.cpuUsage(s);n.cpuTime&&(mt.gauge("node.runtime.cpu.user",M.user/1e6,_),mt.gauge("node.runtime.cpu.system",M.system/1e6,_)),n.cpuUtilization&&v>0&&mt.gauge("node.runtime.cpu.utilization",(M.user+M.system)/(v*1e3),d),s=process.cpuUsage()}if(n.memRss||n.memHeapUsed||n.memHeapTotal||n.memExternal){let M=process.memoryUsage();n.memRss&&mt.gauge("node.runtime.mem.rss",M.rss,m),n.memHeapUsed&&mt.gauge("node.runtime.mem.heap_used",M.heapUsed,m),n.memHeapTotal&&mt.gauge("node.runtime.mem.heap_total",M.heapTotal,m),n.memExternal&&(mt.gauge("node.runtime.mem.external",M.external,m),mt.gauge("node.runtime.mem.array_buffers",M.arrayBuffers,m))}if(r&&l&&(n.eventLoopDelayMin&&mt.gauge("node.runtime.event_loop.delay.min",u(l.min),_),n.eventLoopDelayMax&&mt.gauge("node.runtime.event_loop.delay.max",u(l.max),_),n.eventLoopDelayMean&&mt.gauge("node.runtime.event_loop.delay.mean",u(l.mean),_),n.eventLoopDelayP50&&mt.gauge("node.runtime.event_loop.delay.p50",u(l.percentile(50)),_),n.eventLoopDelayP90&&mt.gauge("node.runtime.event_loop.delay.p90",u(l.percentile(90)),_),n.eventLoopDelayP99&&mt.gauge("node.runtime.event_loop.delay.p99",u(l.percentile(99)),_),l.reset()),n.eventLoopUtilization&&c!==void 0){let M=tT.eventLoopUtilization(),N=tT.eventLoopUtilization(M,c);mt.gauge("node.runtime.event_loop.utilization",N.utilization,d),c=M}n.uptime&&v>0&&mt.count("node.runtime.process.uptime",v/1e3,_),a=b}return{name:v1,setup(){if(r){l?.disable();try{l=b4({resolution:C1}),l.enable()}catch{l=void 0}}i&&(s=process.cpuUsage()),n.eventLoopUtilization&&(c=tT.eventLoopUtilization()),a=rt(),o&&clearInterval(o),o=Pn(setInterval(h,t))}}};var y4=["trace","debug","info","warn","error","fatal"],P1=Symbol.for("level"),S4=Symbol.for("message"),E4=Symbol.for("splat");function k1(e,t){class n extends e{constructor(i){super(i),this._levels=new Set(t?.levels??y4)}log(i,o){try{if(setImmediate(()=>{this.emit("logged",i)}),!B(i))return;let s=i[P1],{level:c,message:a,timestamp:l,...p}=i;p[P1]=void 0,p[S4]=void 0,p[E4]=void 0;let u=t?.customLevelMap?.[s],d=T4[s],m=u??d??"info";this._levels.has(m)?Ui(m,a,{...p,"sentry.origin":"auto.log.winston"}):!u&&!d&&Ve&&g.log(`Winston log level ${s} is not captured by Sentry. Please add ${s} to the "customLevelMap" option of the Sentry Winston transport.`)}catch{}o&&o()}}return n}var T4={silly:"trace",debug:"debug",verbose:"debug",http:"debug",info:"info",notice:"info",warn:"warn",warning:"warn",error:"error",emerg:"fatal",alert:"fatal",crit:"fatal"};import*as w1 from"diagnostics_channel";var rT=Symbol("sentry-track-pino-logger");function L1(e,t,n){let r=Object.getOwnPropertySymbols(e),i=`Symbol(${t})`;for(let o of r)if(o.toString()===i){let s=e[o];return typeof s=="string"?s:n}return n}var M1={error:{levels:[],handled:!0},log:{levels:["trace","debug","info","warn","error","fatal"]}};function I4(e){let{level:t,time:n,pid:r,hostname:i,...o}=e;return o}var A4=(e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{...M1.error,...e.error},log:{...M1.log,...e.log}};function n(r){let i=r[rT];return i==="track"||i!=="ignore"&&t.autoInstrument}return{name:"Pino",setup:r=>{let i=!!r.getOptions().enableLogs,o=w1.tracingChannel("pino_asJson");function s(c,a,l){if(!n(c))return;let p=I4(l),[u,d,m]=a,_=c?.levels?.labels?.[m]||"info",h=L1(c,"pino.messageKey","msg"),b=d||p?.[h]||"";if(i&&t.log.levels.includes(_)){let v={...p,"sentry.origin":"auto.log.pino","pino.logger.level":m};dr({level:_,message:b,attributes:v})}if(t.error.levels.includes(_)){let v=L1(c,"pino.errorKey","err"),M={};for(let[R,P]of Object.entries(p))R!==v&&R!==h&&(M[R]=P);b&&(M[h]=b);let N={level:oo(_),contexts:{pino:M}};He(R=>{R.addEventProcessor(Y=>(Y.logger="pino",Hn(Y,{handled:t.error.handled,type:"auto.log.pino"}),Y));let P=u[v];if(P){ge(P,N);return}yl(b,N)})}}o.end.subscribe(c=>{let{instance:a,arguments:l,result:p}=c;s(a,l,JSON.parse(p))})}}},G1=Object.assign(A4,{trackLogger(e){B(e)&&"levels"in e&&(e[rT]="track")},untrackLogger(e){B(e)&&"levels"in e&&(e[rT]="ignore")}});function iT(e,t){e.setAttribute(S,t)}var N4=[["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 As(e){return N4.reduce((t,[n,r])=>t.replace(new RegExp(n,"gi"),r),e)}var U1="Automatic instrumentation of CronJob only supports crontab string";function D1(e,t){let n=!1;return new Proxy(e,{construct(r,i){let[o,s,c,a,l,...p]=i;if(typeof o!="string")throw new Error(U1);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let u=As(o);async function d(m,_){return Wr(t,async()=>{try{await s(m,_)}catch(h){throw ge(h,{mechanism:{handled:!1,type:"auto.function.cron.instrumentCron"}}),h}},{schedule:{type:"crontab",value:u},timezone:l||void 0})}return new r(o,d,c,a,l,...p)},get(r,i){return i==="from"?o=>{let{cronTime:s,onTick:c,timeZone:a}=o;if(typeof s!="string")throw new Error(U1);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let l=As(s);return o.onTick=async(p,u)=>Wr(t,async()=>{try{await c(p,u)}catch(d){throw ge(d,{mechanism:{handled:!1,type:"auto.function.cron.instrumentCron"}}),d}},{schedule:{type:"crontab",value:l},timezone:a||void 0}),r.from(o)}:r[i]}})}function B1(e,t={}){return new Proxy(e,{get(n,r){return r==="schedule"&&n.schedule?new Proxy(n.schedule,{apply(i,o,s){let[c,a,l]=s,p=l?.name,u=l?.timezone;if(!p)throw new Error('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');let d=async(...m)=>Wr(p,async()=>{try{return await a(...m)}catch(_){throw ge(_,{mechanism:{handled:!1,type:"auto.function.node-cron.instrumentNodeCron"}}),_}},{schedule:{type:"crontab",value:As(c)},timezone:u,...t});return i.apply(o,[c,d,l])}}):n[r]}})}function H1(e){return new Proxy(e,{get(t,n){return n==="scheduleJob"?new Proxy(t.scheduleJob,{apply(r,i,o){let[s,c,a]=o;if(typeof s!="string"||typeof c!="string"||typeof a!="function")throw new 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 l=s,p=c;async function u(){return Wr(l,async()=>{await a?.()},{schedule:{type:"crontab",value:As(p)}})}return r.apply(i,[l,p,u])}}):t[n]}})}var F1={instrumentCron:D1,instrumentNodeCron:B1,instrumentNodeSchedule:H1};var W1="Http",V1=Object.assign(gs,{id:`${W1}.sentry`}),oT=(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},o={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},s=qa(i),c=Qa(o);return{name:W1,setup(a){let l=a.getOptions();r&&De(l)&&c.setup(a)},setupOnce(){s.setupOnce();let a={breadcrumbs:e.breadcrumbs,spans:t,propagateTraceInOutgoingRequests:e.tracePropagation??!0,createSpansForOutgoingRequests:t,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(l,p)=>{let u=_r(p);if(u.startsWith("data:")){let d=vl(u);l.setAttribute("http.url",d),l.setAttribute(pt,d),l.updateName(`${p.method||"GET"} ${d}`)}e.instrumentation?.requestHook?.(l,p)},outgoingResponseHook:e.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:e.instrumentation?.applyCustomAttributesOnSpan};gs(a)},processEvent(a){return c.processEvent(a)}}};var R4=((e={})=>({name:"NodeFetch",setupOnce(){let t=O()?.getOptions();hp({...e,spans:v4(e,t)})}})),sT=R4;function v4(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&De(t))}import*as kf from"fs";import{promisify as C4}from"util";var Y1=["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"],j1=["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"],Z1=["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"];function O4(e){let t=e.split(".");if(t.length>1){if(t.length!==2)throw Error(`Invalid member function name ${e}`);return t}else return[e]}function aT(e,t){if(!t)throw new Error(JSON.stringify({member:t}));let n=O4(t),[r,i]=n;return i?{objectToPatch:e[r],functionNameToPatch:i}:{objectToPatch:e,functionNameToPatch:r}}var x4="auto.file.fs",P4="file",k4=["rename","renameSync"],L4=["copyFile","cp","copyFileSync","cpSync"],M4=["link","linkSync"],w4=["mkdtemp","mkdtempSync"],G4=["symlink","symlinkSync"],U4=["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"];function Lf(e,t,n){let r={[H]:P4,[S]:x4};return n.recordFilePaths&&(typeof t[0]=="string"&&U4.includes(e)?r.path_argument=t[0]:typeof t[0]=="string"&&typeof t[1]=="string"?G4.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):M4.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):L4.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):k4.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]=="string"&&w4.includes(e)&&(r.prefix_argument=t[0])),r}function Mf(e,t){return Object.assign(e,t)}var X1=new WeakMap;function Pf(e,t,n){let r=e[t];if(typeof r!="function")return;let i=X1.get(e);i||(i=new Set,X1.set(e,i)),!i.has(t)&&(i.add(t),e[t]=n(r))}function D4(e,t,n){return Mf(function(...i){let o=Lf(e,i,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:o},s=>{try{return Vn(()=>t.apply(this,i))}catch(c){throw wp(s,c,n),c}})},t)}function B4(e,t,n){return Mf(function(...i){let o=i.length-1,s=i[o];if(typeof s!="function")return t.apply(this,i);let c=Lf(e,i,n),a=L({name:`fs.${e}`,onlyIfParent:!0,attributes:c}),l=Q();i[o]=function(...p){let u=p[0];return u&&wp(a,u,n),a.end(),l?se(l,()=>s.apply(this,p)):s.apply(this,p)};try{return Vn(()=>t.apply(this,i))}catch(p){throw wp(a,p,n),a.end(),p}},t)}function H4(e,t){let n="exists",i=Mf(function(...s){let c=s.length-1,a=s[c];if(typeof a!="function")return e.apply(this,s);let l=Lf(n,s,t),p=L({name:`fs.${n}`,onlyIfParent:!0,attributes:l}),u=Q();s[c]=function(...d){return p.end(),u?se(u,()=>a.apply(this,d)):a.apply(this,d)};try{return Vn(()=>e.apply(this,s))}catch(d){throw wp(p,d,t),p.end(),d}},e),o=function(s){return new Promise(c=>i(s,c))};return Object.defineProperty(o,"name",{value:n}),Object.defineProperty(i,C4.custom,{value:o}),i}function F4(e,t,n){return Mf(async function(...i){let o=Lf(e,i,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:o},async s=>{try{return await Vn(()=>t.apply(this,i))}catch(c){throw wp(s,c,n),c}})},t)}function K1(e={}){for(let n of Z1){let{objectToPatch:r,functionNameToPatch:i}=aT(kf,n);Pf(r,i,o=>D4(n,o,e))}for(let n of j1){let{objectToPatch:r,functionNameToPatch:i}=aT(kf,n);n==="exists"?Pf(r,i,o=>H4(o,e)):Pf(r,i,o=>B4(n,o,e))}let t=kf.promises;for(let n of Y1)Pf(t,n,r=>F4(n,r,e))}function wp(e,t,n){e.setStatus({code:2,message:"internal_error"}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute("fs_error",t.message)}var W4="FileSystem",V4=(e={})=>({name:W4,setupOnce(){K1(e)}});var je=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function si(e){let t=Q();if(!t)return;let n=Oe(t);n&&oe(n).data[H]==="http.server"&&n.setAttribute("http.route",e)}var q1="Express",Y4=[">=4.0.0 <6"];function j4(e,t){ES(e,t),Sr(e.use,"express")}var lT=fe(q1,e=>new cT(e)),cT=class extends le{constructor(t={}){super("sentry-express",q,t)}init(){return new re("express",Y4,n=>{try{yS(n,()=>({...this.getConfig(),onRouteResolved(r){r&&si(r)}}))}catch(r){je&&g.error("Failed to patch express module:",r)}return n},n=>n)}},Z4=(e=>({name:q1,setupOnce(){lT(e)},getShouldHandleError(){return e?.shouldHandleError}})),pT=Z4;var Eo=(e=>(e.FASTIFY_NAME="fastify.name",e.FASTIFY_TYPE="fastify.type",e.HOOK_NAME="hook.name",e.PLUGIN_NAME="plugin.name",e))(Eo||{}),wf=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(wf||{}),Gf=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request handler",e))(Gf||{});var Gp=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function uT(e,t,n,r={}){let i=t.startSpan(n,{attributes:r}),o=e[Gp]||[];return o.push(i),Object.defineProperty(e,Gp,{enumerable:!1,configurable:!0,value:o}),i}function Uf(e,t){let n=e[Gp]||[];n.length&&(n.forEach(r=>{t&&(r.setStatus({code:Lt.ERROR,message:t.message}),r.recordException(t)),r.end()}),delete e[Gp])}function $1(e,t,n){let r,i;try{i=e(),Q1(i)&&i.then(o=>t(void 0,o),o=>t(o))}catch(o){r=o}finally{if(!Q1(i)&&(t(r,i),r))throw r;return i}}function Q1(e){return typeof e=="object"&&e&&typeof Object.getOwnPropertyDescriptor(e,"then")?.value=="function"||!1}var X4="@sentry/instrumentation-fastify-v3",J1="anonymous",K4=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),Df=class extends le{constructor(t={}){super(X4,q,t)}init(){return[new re("fastify",[">=3.0.0 <3.21.0"],t=>this._patchConstructor(t))]}_hookOnRequest(){let t=this;return function(r,i,o){if(!t.isEnabled())return o();t._wrap(i,"send",t._patchSend());let s=r,c=s.routeOptions?s.routeOptions.url:r.routerPath;c&&si(c);let a=r.method||"GET";$().setTransactionName(`${a} ${c}`),o()}}_wrapHandler(t,n,r,i){let o=this;return this._diag.debug("Patching fastify route.handler function"),function(...s){if(!o.isEnabled())return r.apply(this,s);let c=r.name||t||J1,a=`${Gf.MIDDLEWARE} - ${c}`,l=s[1],p=uT(l,o.tracer,a,{[Eo.FASTIFY_TYPE]:wf.MIDDLEWARE,[Eo.PLUGIN_NAME]:t,[Eo.HOOK_NAME]:n}),u=i&&s[s.length-1];return u&&(s[s.length-1]=function(...d){Uf(l),u.apply(this,d)}),ce.with(de.setSpan(ce.active(),p),()=>$1(()=>r.apply(this,s),d=>{d instanceof Error&&(p.setStatus({code:Lt.ERROR,message:d.message}),p.recordException(d)),i||Uf(l)}))}}_wrapAddHook(){let t=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...i){let o=i[0],s=i[1],c=this.pluginName;if(!K4.has(o))return n.apply(this,i);let a=typeof i[i.length-1]=="function"&&s.constructor.name!=="AsyncFunction";return n.apply(this,[o,t._wrapHandler(c,o,s,a)])}}}_patchConstructor(t){let n=this;function r(...i){let o=t.fastify.apply(this,i);return o.addHook("onRequest",n._hookOnRequest()),o.addHook("preHandler",n._hookPreHandler()),q4(),n._wrap(o,"addHook",n._wrapAddHook()),o}return t.errorCodes!==void 0&&(r.errorCodes=t.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let t=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...o){let s=o[0];return t.isEnabled()?ei(()=>r.apply(this,o),c=>{!c&&s instanceof Error&&(c=s),Uf(this,c)}):r.apply(this,o)}}}_hookPreHandler(){let t=this;return this._diag.debug("Patching fastify preHandler function"),function(r,i,o){if(!t.isEnabled())return o();let s=r,c=s.routeOptions?.handler||s.context?.handler,a=c?.name.startsWith("bound ")?c.name.substring(6):c?.name,l=`${Gf.REQUEST_HANDLER} - ${a||this.pluginName||J1}`,p={[Eo.PLUGIN_NAME]:this.pluginName,[Eo.FASTIFY_TYPE]:wf.REQUEST_HANDLER,[Fe]:s.routeOptions?s.routeOptions.url:r.routerPath};a&&(p[Eo.FASTIFY_NAME]=a);let u=uT(i,t.tracer,l,p);z1(u);let{requestHook:d}=t.getConfig();return d&&ei(()=>d(u,{request:r}),m=>{m&&t._diag.error("request hook failed",m)},!0),ce.with(de.setSpan(ce.active(),u),()=>{o()})}}};function q4(){let e=O();e&&e.on("spanStart",t=>{z1(t)})}function z1(e){let t=oe(e).data,n=t["fastify.type"];if(t[H]||!n)return;e.setAttributes({[S]:"auto.http.otel.fastify",[H]:`${n}.fastify`});let r=t["fastify.name"]||t["plugin.name"]||t["hook.name"];if(typeof r=="string"){let i=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(i)}}import*as gT from"diagnostics_channel";var ew="execute_tool";var tw="invoke_agent";var Di="graphql";var J=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var mT=()=>{};function ee(e,t,n){let r=Q4(e,t,n),i=n?.beforeSpanEnd,o=n?.deferSpanEnd,s=p=>typeof n?.captureError=="function"?n.captureError(p):{mechanism:{type:"auto.diagnostic_channels.bind_span",handled:!1}},c=(p,u)=>{n?.captureError&&ge(u,s(u));let{message:d,attributes:m}=$4(u);p.setStatus({code:2,message:d}),p.setAttributes(m)},a=(p,u)=>{let d=!1;return m=>{d||(d=!0,m!==void 0&&(c(p,m),u.error=m),dT(u,i))}},l={start:mT,asyncStart:mT,end(p){if("error"in p||"result"in p){let u=p._sentrySpan;if(u&&o?.({span:u,data:p,end:a(u,p)}))return;dT(p,i)}},error(p){let u=p._sentrySpan;u&&c(u,p.error)},asyncEnd(p){let u=p._sentrySpan;u&&o?.({span:u,data:p,end:a(u,p)})||dT(p,i)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function Q4(e,t,n){let r=St(Je()).getTracingChannelBinding?.();if(!r)return J&&g.log("[TracingChannel] Could not access async context binding."),{channel:e,unbind:mT};let i=r.asyncLocalStorage;return e.start.bindStore(i,o=>{o._sentryCallerStore=i.getStore();let c=!n?.requiresParentSpan||Q()?t(o):void 0;return c?(o._sentrySpan=c,r.getStoreWithActiveSpan(c)):o._sentryCallerStore}),e.asyncStart.bindStore(i,o=>o._sentryCallerStore),{channel:e,unbind:()=>{e.start.unbindStore(i),e.asyncStart.unbindStore(i)}}}function dT(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function $4(e){let t=B(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:{[Ur]:i}}}var fT="original-description",J4=new Set(["Int","Float","String","BlockString"]);function Bf(e,t,n){let r=Oe(e);if(r===e)return;let i=oe(r),o=n?`${t} ${n}`:t,s=i.data[Ib],c;Array.isArray(s)?c=[...s,o]:typeof s=="string"?c=[s,o]:c=o,r.setAttribute(Ib,c);let a=i.data[fT]??i.description;i.data[fT]||r.setAttribute(fT,a),r.updateName(`${a} (${z4(c)})`)}function z4(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 Hf(e,t,n){return e&&t?`${e} ${t}`:e||n}function Ff(e){if(B(e)&&"errors"in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function eQ(e){let t=e?.loc,n=t?.source?.body;if(!(typeof n!="string"||!t?.startToken))try{let r=[];for(let o=t.startToken;o;o=o.next)J4.has(o.kind)&&r.push({start:o.start,end:o.end,kind:o.kind});let i=n;for(let o=r.length-1;o>=0;o--){let{start:s,end:c,kind:a}=r[o],l=a==="String"||a==="BlockString"?'"*"':"*";i=i.slice(0,s)+l+i.slice(c)}return i}catch{return}}function fc(e){if(O()?.getDataCollectionOptions().graphQL.document===!0)return eQ(e)}var tQ="graphql:parse",nQ="graphql:validate",rQ="graphql:execute",iQ="graphql:subscribe",oQ="graphql:resolve",Wf="auto.graphql.diagnostic_channel",sQ="graphql.parse",aQ="graphql.validate",cQ="graphql.execute",lQ="graphql.subscribe",pQ="graphql.resolve",uQ="graphql.field.name",dQ="graphql.field.path",mQ="graphql.field.type",fQ="graphql.parent.name";function rw(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,i=t.useOperationNameForRootSpan!==!1;gQ(e),_Q(e),nw(e,rQ,cQ,i),nw(e,iQ,lQ,i),n||hQ(e,r)}function gQ(e){ee(e(tQ),()=>L({name:sQ,attributes:{[S]:Wf,[H]:Di}}))}function _Q(e){ee(e(nQ),t=>L({name:aQ,attributes:{[S]:Wf,[H]:Di,[fa]:fc(t.document)}}),{beforeSpanEnd:(t,n)=>{Array.isArray(n.result)&&n.result.length>0&&t.setStatus({code:2,message:"invalid_argument"})}})}function nw(e,t,n,r){ee(e(t),i=>{let o=L({name:Hf(i.operationType,i.operationName,n),attributes:{[S]:Wf,[H]:Di,[od]:i.operationType,[id]:i.operationName||void 0,[fa]:fc(i.document)}});return r&&i.operationType&&Bf(o,i.operationType,i.operationName),o},{beforeSpanEnd:(i,o)=>{Ff(o.result)&&i.setStatus({code:2,message:"internal_error"})}})}function hQ(e,t){ee(e(oQ),n=>{if(!(t&&n.isDefaultResolver))return L({name:`${pQ} ${n.fieldPath}`,attributes:{[S]:Wf,[H]:Di,[uQ]:n.fieldName,[dQ]:n.fieldPath,[mQ]:n.fieldType,[fQ]:n.parentType}})})}var bQ=((e={})=>({name:"Graphql",setupOnce(){gT.tracingChannel&&me(()=>{rw(gT.tracingChannel,e)})}})),Up=bQ;import*as hT from"diagnostics_channel";var yQ="mongoose:query",SQ="mongoose:aggregate",EQ="mongoose:model:save",TQ="mongoose:model:insertMany",IQ="mongoose:model:bulkWrite",AQ="mongoose:cursor:next",NQ="auto.db.mongoose.diagnostic_channel",RQ="mongodb",vQ=10,iw=!1;function Vf(e){if(!iw){iw=!0;try{gc(e,yQ),gc(e,SQ),gc(e,EQ),gc(e,TQ),gc(e,IQ),gc(e,AQ)}catch{J&&g.log("Mongoose node:diagnostics_channel subscription failed.")}}}function gc(e,t){ee(e(t),n=>{let r=n.collection,i=CQ(n.args?.pipeline??n.args?.filter),o=OQ(n);return L({name:r?`mongoose.${r}.${n.operation}`:`mongoose.${n.operation}`,attributes:{[S]:NQ,[H]:"db",[dt]:RQ,[pr]:n.operation,[ua]:r??void 0,[Ii]:n.database??void 0,[Gr]:i??void 0,[ma]:o??void 0,[_t]:n.serverAddress??void 0,[ht]:n.serverPort??void 0}})})}function OQ(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 CQ(e){if(e!=null)try{let t=_T(e,0),n=JSON.stringify(t);return n==null||n==="{}"||n==="[]"?void 0:n}catch{return}}function _T(e,t){if(t>vQ)return"?";if(Array.isArray(e))return e.map(n=>_T(n,t+1));if(B(e)){let n={};for(let r of Object.keys(e))n[r]=_T(e[r],t+1);return n}return"?"}var xQ=(()=>({name:"Mongoose",setupOnce(){hT.tracingChannel&&me(()=>{Vf(hT.tracingChannel)})}})),bT=xQ;var PQ="db.system",kQ="db.name",ow="db.operation",LQ="db.statement",MQ="db.mongodb.collection",wQ="db.connection_string",GQ="net.peer.name",UQ="net.peer.port",DQ="mongodb";function BQ(e){return JSON.stringify(yT(e))}function yT(e){if(Array.isArray(e))return e.map(t=>yT(t));if(HQ(e)){let t={};return Object.entries(e).map(([n,r])=>[n,yT(r)]).reduce((n,r)=>(WQ(r)&&(n[r[0]]=r[1]),n),t)}return"?"}function HQ(e){return B(e)&&!FQ(e)}function FQ(e){return typeof Buffer<"u"&&Buffer.isBuffer(e)}function WQ(e){return Array.isArray(e)}function Dp(e,t,n,r,i){let o,s;if(e){let a=typeof e.address=="string"?e.address.split(":"):"";a.length===2&&(o=a[0],s=a[1])}let c;return n?.documents?.[0]?c=n.documents[0]:n?.cursors?c=n.cursors:c=n,sw(t.db,t.collection,o,s,c,r,i)}function sw(e,t,n,r,i,o,s){let c={[S]:s,[PQ]:DQ,[kQ]:e,[MQ]:t,[ow]:o,[wQ]:`mongodb://${n}:${r}/${e}`};if(n&&r){c[GQ]=n;let a=parseInt(r,10);isNaN(a)||(c[UQ]=a)}if(i)try{c[LQ]=BQ(i)}catch{}return c}function Bp(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 Hp(e,t,n,r,i){let o,s;if(t?.s&&(o=t.s.options?.host??t.s.host,s=(t.s.options?.port??t.s.port)?.toString(),o==null||s==null)){let p=t.description?.address;if(p){let u=p.split(":");o=u[0],s=u[1]}}let[c,a]=e.toString().split("."),l=n?.query??n?.q??n;return sw(c,a,o,s,l,r,i)}function Er(e){return L({name:`mongodb.${e[ow]||"command"}`,op:"db",kind:D.CLIENT,attributes:e})}import*as ST from"diagnostics_channel";var VQ="mysql2:query",YQ="mysql2:execute",jQ="mysql2:connect",ZQ="mysql2:pool:connect",lw="auto.db.mysql2.diagnostic_channel",pw="mysql",XQ=/^\s*(\w+)/;function Yf(e){aw(e,VQ),aw(e,YQ),cw(e,jQ,"mysql2.connect"),cw(e,ZQ,"mysql2.pool.connect")}function aw(e,t){ee(e(t),n=>{let r=n.query?Xa(n.query):void 0,i=r?.match(XQ)?.[1]?.toUpperCase();return L({name:r||"mysql2.query",attributes:{[S]:lw,[H]:"db",[dt]:pw,[Gr]:r,[pr]:i,[Ii]:n.database||void 0,[_t]:n.serverAddress,[ht]:n.serverPort}})},{requiresParentSpan:!0})}function cw(e,t,n){ee(e(t),r=>L({name:n,attributes:{[S]:lw,[H]:"db",[dt]:pw,[Ii]:r.database||void 0,[_t]:r.serverAddress,[ht]:r.serverPort}}),{requiresParentSpan:!0})}var KQ=(()=>({name:"Mysql2",setupOnce(){ST.tracingChannel&&me(()=>{Yf(ST.tracingChannel)})}})),ET=KQ;var qQ="PRISMA_INSTRUMENTATION",QQ="V7_PRISMA_INSTRUMENTATION",uw=globalThis;function dw(e){let t={helper:e};uw[QQ]=t,uw[qQ]=t}var $Q=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES==="true"}catch{return!1}})(),JQ="00-10-10-00",zQ="auto.db.otel.prisma",fw=1e3,TT=new jt(fw),_c=[];function IT(e,t){TT.set(e,t)}function AT(e,t){let n={...t,[S]:zQ};return e==="prisma:engine:db_query"&&n[ke]==null&&(n[ke]="prisma"),n}function NT(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 e$(){let e=!0;for(;e;){e=!1;for(let t=_c.length-1;t>=0;t--){let n=_c[t],r=TT.get(n.parent_span_id);if(!r)continue;let i=AT(n.name,n.attributes),o=L({name:NT(n.name,i),attributes:i,kind:n.kind==="client"?D.CLIENT:D.INTERNAL,startTime:n.start_time,parentSpan:r});IT(n.span_id,o),n.links&&o.addLinks(n.links.flatMap(s=>{let c=TT.get(s.span_id);return c?[{context:c.spanContext()}]:[]})),o.end(n.end_time),_c.splice(t,1),e=!0}}}var jf=class{constructor({ignoreSpanTypes:t}){this.ignoreSpanTypes=t}isEnabled(){return!0}getTraceParent(t){let n=(t??Q())?.spanContext();return n?`00-${n.traceId}-${n.spanId}-0${n.traceFlags}`:JQ}dispatchEngineSpans(t){let n=new Map,r=t.filter(i=>i.parentId===null);for(let i of r)gw(i,t,n,this.ignoreSpanTypes)}createEngineSpan(t){_c.push(...t.spans),e$();let n=_c.length-fw;n>0&&(J&&g.log(`[Prisma] Dropping ${n} unresolved v5 engine span(s) whose parent was never registered.`),_c.splice(0,n))}getActiveContext(){return Q()}runInChildSpan(t,n){let r=typeof t=="string"?{name:t}:t;if(r.internal&&!$Q)return n();let i=`prisma:client:${r.name}`;if(_w(i,this.ignoreSpanTypes))return n();let o=Q(),s=AT(i,r.attributes),c={name:NT(i,s),attributes:s,kind:r.kind,links:r.links,startTime:r.startTime,parentSpan:o};if(r.active===!1){let a=L(c);return IT(a.spanContext().spanId,a),mw(a,()=>n(a,o))}return Le(c,a=>(IT(a.spanContext().spanId,a),mw(a,()=>n(a,o))))}};function gw(e,t,n,r){if(_w(e.name,r))return;let i=AT(e.name,e.attributes);Le({name:NT(e.name,i),attributes:i,kind:e.kind==="client"?D.CLIENT:D.INTERNAL,startTime:e.startTime},o=>{n.set(e.id,o.spanContext().spanId),e.links&&o.addLinks(e.links.flatMap(c=>{let a=n.get(c);return a?{context:{spanId:a,traceId:o.spanContext().traceId,traceFlags:o.spanContext().traceFlags}}:[]}));let s=t.filter(c=>c.parentId===e.id);for(let c of s)gw(c,t,n,r);o.end(e.endTime)})}function mw(e,t){let n;try{n=t()}catch(r){throw e.end(),r}return t$(n)?n.then(r=>(e.end(),r),r=>{throw e.end(),r}):(e.end(),n)}function t$(e){return e!=null&&typeof e.then=="function"}function _w(e,t){return t.some(n=>typeof n=="string"?n===e:n.test(e))}var n$="Prisma";function hw(e){dw(new jf({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var r$=(e=>({name:n$,setupOnce(){hw(e)}})),Zf=r$;import*as OT from"diagnostics_channel";var i$="node-redis:command",o$="node-redis:batch",s$="node-redis:connect",a$="ioredis:command",c$="ioredis:connect",RT="auto.db.redis.diagnostic_channel",vT="redis";function Sw(e,t){bw(e,i$,n=>n.args.slice(1),t),l$(e,o$,n=>n.batchMode==="PIPELINE"?"PIPELINE":"MULTI"),yw(e,s$),bw(e,a$,n=>n.args,t),yw(e,c$)}function bw(e,t,n,r){ee(e(t),i=>{let o=n(i),s=o.length?`${i.command} ${o.join(" ")}`:i.command;return L({name:`redis-${i.command}`,attributes:{[S]:RT,[H]:"db.redis",[dt]:vT,[Gr]:s,...i.serverAddress!=null?{[_t]:i.serverAddress}:{},...i.serverPort!=null?{[ht]:i.serverPort}:{}}})},{beforeSpanEnd(i,o){"error"in o||p$(r,i,o.command,n(o),o.result)}})}function l$(e,t,n){ee(e(t),r=>L({name:n(r),attributes:{[S]:RT,[H]:"db.redis",[dt]:vT,...Number(r.batchSize)>1?{[ma]:r.batchSize}:{},...r.serverAddress!=null?{[_t]:r.serverAddress}:{},...r.serverPort!=null?{[ht]:r.serverPort}:{}}}))}function yw(e,t){ee(e(t),n=>L({name:"redis-connect",attributes:{[S]:RT,[H]:"db.redis.connect",[dt]:vT,...n.serverAddress!=null?{[_t]:n.serverAddress}:{},...n.serverPort!=null?{[ht]:n.serverPort}:{}}}))}function p$(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}var u$=((e={})=>({name:"Redis",setupOnce(){OT.tracingChannel&&me(()=>{Sw(OT.tracingChannel,e.responseHook)})}})),CT=u$;var d$=[{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}],ai=(e,t)=>{if(Array.isArray(t)&&t.length){let n=d$.find(({regex:i})=>i.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 We(e){return typeof e=="string"?e:void 0}function Xf(e){return typeof e=="number"&&!isNaN(e)?e:void 0}function xT(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function Kf(e){return B(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"}function qf(e,t,n){let r=e.getReader(),i={toolCalls:[]},o="",s=!1,c=()=>{s||(s=!0,o&&(i.text=o),t(i))},a=l=>{s||(s=!0,n(l))};return new ReadableStream({async pull(l){try{let{done:p,value:u}=await r.read();if(p){c(),l.close();return}o+=m$(i,u)??"",l.enqueue(u)}catch(p){a(p),l.error(p)}},cancel(l){return c(),r.cancel(l)}})}function m$(e,t){if(!B(t))return;let{type:n,delta:r,textDelta:i,id:o,modelId:s,toolCallId:c,toolName:a,input:l,args:p,finishReason:u,usage:d,providerMetadata:m}=t;switch(n){case"text-delta":{let _=r??i;return typeof _=="string"?_:void 0}case"tool-call":e.toolCalls.push({toolCallId:c,toolName:a,input:l??p});return;case"response-metadata":typeof o=="string"&&(e.responseId=o),typeof s=="string"&&(e.responseModel=s);return;case"finish":e.finishReason=u,e.usage=d,m!==void 0&&(e.providerMetadata=m);return;default:return}}var f$="ai:telemetry",Tw="auto.vercelai.channel",g$="gen_ai.tool.call.id",_$="gen_ai.tool.description",h$="embeddings",b$="rerank",y$="generate_content",S$="WorkersAI",Iw="vercel.ai.operationId",E$="vercel.ai.model.provider",T$="vercel.ai.settings.maxRetries",kT=new Map,Qf=new Map,LT=new Map,Aw=new Set(["generateText","streamText","generateObject","embed","embedMany","rerank"]);function MT(e){if(!Aw.has(e.type))return;let t=We(e.event.callId);t&&wT(t)}function wT(e){kT.delete(e),Qf.delete(e),LT.delete(e)}function I$(e,t){if(Aw.has(t))for(let n of Yd)delete e[n]}function A$(e,t){if(!e||!Array.isArray(t))return;let n=Qf.get(e);for(let r of t)B(r)&&typeof r.name=="string"&&typeof r.description=="string"&&(n=n??new Map,n.has(r.name)||n.set(r.name,r.description));n&&Qf.set(e,n)}function N$(e,t,n){let r=e?Qf.get(e)?.get(t):void 0;if(r)return r;if(Array.isArray(n)){let i=n.find(o=>B(o)&&o.name===t);return B(i)?We(i.description):void 0}if(B(n)){let i=n[t];return B(i)?We(i.description):void 0}}function Nw(e,t={}){ee(e(f$),n=>Wp(n,t),{beforeSpanEnd:(n,r)=>{hc(n,r,t),MT(r)},deferSpanEnd:({data:n,end:r})=>R$(n,t,r)})}function R$(e,t,n){if(e.type!=="languageModelCall"||!B(e.result))return!1;let r=e.result,i=r.stream;if(!Kf(i))return!1;let o=We(e.event.callId),{recordOutputs:s}=DT(e.event,t);return r.stream=qf(i,c=>{e.result={...r,...GT(c)},n(),v$(o,c,s)},c=>n(c)),!0}function GT(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 v$(e,t,n){let r=e?LT.get(e):void 0;if(!r)return;let i=B(t.usage)?t.usage:void 0;if(i){let o=Kn(i.inputTokens)??Kn(i.promptTokens)??Kn(i.tokens),s=Kn(i.outputTokens)??Kn(i.completionTokens);PT(r,en,o),PT(r,Tt,s),PT(r,Sb,Kn(i.totalTokens)??xT(o,s))}if(n){let o=Cw(t.text,t.toolCalls),s=vw(o,Rw({finishReason:t.finishReason}));s&&r.setAttribute(yb,s)}}function PT(e,t,n){if(n===void 0)return;let r=oe(e).data[t];e.setAttribute(t,(typeof r=="number"?r:0)+n)}function Wp(e,t){let{type:n,event:r}=e;if(n==="step"||!r||typeof r!="object")return;let{recordInputs:i,enableTruncation:o}=DT(r,t),s=We(r.provider),c=We(r.modelId),a=We(r.callId),l=Xf(r.maxRetries);i&&A$(a,r.tools);let p={[S]:Tw,...s?{[_l]:s,[E$]:s}:{},...c?{[gl]:c}:{},...l!==void 0?{[T$]:l}:{}};switch(n){case"generateText":case"streamText":case"generateObject":return O$(r,p,i,o,a,n==="streamText");case"languageModelCall":return Pi([S$]),C$(r,p,i,o,a,c);case"executeTool":return x$(r,i);case"embed":case"embedMany":{let u=n==="embedMany"?r.values:r.value;return Fp(h$,c,{...p,...i&&u!==void 0?{[q0]:Ue(u)}:{}})}case"rerank":return Fp(b$,c,p);default:return}}function Fp(e,t,n){return L({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[nd]:e,...n}})}function O$(e,t,n,r,i,o){let s=We(e.functionId),c=We(e.operationId)??(o?"ai.streamText":"ai.generateText");i&&kT.set(i,{operationId:c,isStream:o});let a=Fp(tw,s,{...t,[Iw]:c,[tO]:o,...s?{[Q0]:s}:{},...n?xw(e,r):{}});return o&&i&<.set(i,a),a}function C$(e,t,n,r,i,o){let s=i?kT.get(i):void 0,c=s?`${s.operationId}.${s.isStream?"doStream":"doGenerate"}`:"ai.generateText.doGenerate";return Fp(y$,o,{...t,[Iw]:c,...n?xw(e,r):{},...n&&Array.isArray(e.tools)?{[J0]:Ue(e.tools)}:{}})}function x$(e,t){let n=B(e.toolCall)?e.toolCall:{},r=We(n.toolName),i=We(e.toolCallId)??We(n.toolCallId),o=n.input??n.args,s=t&&r?N$(We(e.callId),r,e.tools):void 0;return Fp(ew,r,{[S]:Tw,[oO]:"function",...r?{[rO]:r}:{},...i?{[g$]:i}:{},...s?{[_$]:s}:{},...t&&o!==void 0?{[nO]:Ue(o)}:{}})}function hc(e,t,n){let{type:r,result:i}=t;if(!B(i))return;let{recordOutputs:o}=DT(t.event,n);if(r==="executeTool"){o&&e.setAttribute(iO,Ue(i.output??i));let m=B(i.output)?i.output:void 0;m?.type==="tool-error"&&UT(e,t,m.error);return}let s=B(i.usage)?i.usage:void 0;if(s){let m=Kn(s.inputTokens)??Kn(s.promptTokens)??Kn(s.tokens),_=Kn(s.outputTokens)??Kn(s.completionTokens),h=Kn(s.totalTokens)??xT(m,_);m!==void 0&&e.setAttribute(en,m),_!==void 0&&e.setAttribute(Tt,_),h!==void 0&&e.setAttribute(Sb,h)}let c=Rw(i);c&&r==="languageModelCall"&&e.setAttribute(Ot,Ue([c]));let a=B(i.response)?i.response:void 0,l=We(a?.id)??We(i.responseId);l&&e.setAttribute(z0,l);let p=We(a?.modelId)??We(t.event.modelId);p&&e.setAttribute(eO,p);let u=i.providerMetadata,d=Vd(u);if(Ko in d&&oe(e).data[Ko]&&delete d[Ko],I$(d,r),e.setAttributes(d),o){let m=r==="languageModelCall"&&Array.isArray(i.content)?k$(i.content):Cw(i.text,i.toolCalls),_=vw(m,c);_&&e.setAttribute(yb,_)}}function P$(e){return e==="tool-calls"?"tool_call":e??"stop"}function Rw(e){let t=e.finishReason;return typeof t=="string"?t:B(t)?We(t.unified):void 0}function Kn(e){return Xf(e)??(B(e)?Xf(e.total):void 0)}function vw(e,t){if(e.length)return Ue([{role:"assistant",parts:e,finish_reason:P$(t)}])}function Ow(e){let t=e.input??e.args;return{type:"tool_call",id:We(e.toolCallId),name:We(e.toolName),arguments:typeof t=="string"?t:Ue(t??{})}}function k$(e){let t=[];for(let n of e)B(n)&&(n.type==="text"&&typeof n.text=="string"?t.push({type:"text",content:n.text}):n.type==="tool-call"&&t.push(Ow(n)));return t}function Cw(e,t){let n=[];if(typeof e=="string"&&e.length&&n.push({type:"text",content:e}),Array.isArray(t))for(let r of t)B(r)&&n.push(Ow(r));return n}function UT(e,t,n){e.setStatus({code:2,message:n instanceof Error?n.message:"tool_error"});let r=B(t.event.toolCall)?t.event.toolCall:{},i=We(r.toolName),o=We(t.event.toolCallId)??We(r.toolCallId);He(s=>{s.setContext("trace",kr(e)),i&&s.setTag("vercel.ai.tool.name",i),o&&s.setTag("vercel.ai.tool.callId",o),s.setLevel("error"),ge(n instanceof Error?n:new Error(typeof n=="string"?n:"Tool execution failed"),{mechanism:{type:"auto.vercelai.channel",handled:!1}})})}function DT(e,t){let n=O()?.getDataCollectionOptions().genAI;return{recordInputs:Ew(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:Ew(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:nt(t.enableTruncation)}}function Ew(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n===!0}function xw(e,t){let n={},r=We(e.instructions);r&&(n[tn]=Ue([{type:"text",content:r}]));let i=e.messages??e.prompt;return i!==void 0&&(n[$0]=t?Vt(i):Ue(i),n[xt]=Array.isArray(i)?i.length:1),n}import*as BT from"diagnostics_channel";var L$=((e={})=>({name:"VercelAI",setupOnce(){BT.tracingChannel&&me(()=>{Nw(BT.tracingChannel,e)})}})),Vp=L$;import*as Mw from"diagnostics_channel";var HT="@sentry/instrumentation-fastify",M$=">=3.21.0 <6",ww="auto.http.otel.fastify",w$="hook.fastify",Gw="request_handler.fastify",Uw=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],To="hook.name",Io="fastify.type",Ns="hook.callback.name",G$="fastify.root",U$="route-hook",bc="hook",Dw="request-handler",Ao="anonymous",Bi=Symbol("sentry fastify request span"),Bw=Symbol("sentry fastify addHook original"),Hw=Symbol("sentry fastify setNotFoundHandler original");function Fw(e){return e.routeOptions?.url??e.routerPath}function Ww(e){return e.routeOptions?.config??e.routeConfig}function D$(e){return B(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||"routerPath"in e)}function Vw(e,t,n){e.decorate(Bw,e.addHook),e.decorate(Hw,e.setNotFoundHandler),e.decorateRequest("opentelemetry",function(){return{span:this[Bi]}}),e.decorateRequest(Bi,null),e.addHook("onRoute",B$),e.addHook("onRequest",H$),e.addHook("onResponse",F$),e.addHook=Y$,e.setNotFoundHandler=j$,n()}var FT=Vw;FT[Symbol.for("skip-override")]=!0;FT[Symbol.for("fastify.display-name")]=HT;FT[Symbol.for("plugin-meta")]={fastify:M$,name:HT};function B$(e){if(e.config?.otel!==!1){for(let t of Uw){let n=e[t];typeof n=="function"?e[t]=No(n,t,Pw(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(r=>No(r,t,Pw(this.pluginName,t,r,e.url))))}e.onSend=kw(e.onSend,W$),e.onError=kw(e.onError,V$),e.handler=No(e.handler,"handler",{[To]:`${this.pluginName} - route-handler`,[Io]:Dw,[Fe]:e.url,[Ns]:e.handler.name.length>0?e.handler.name:Ao})}}function Pw(e,t,n,r){return{[To]:`${e} - route -> ${t}`,[Io]:U$,[Fe]:r,[Ns]:n.name?.length>0?n.name:Ao}}function kw(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function H$(e,t,n){if(Ww(e)?.otel===!1)return n();let r={[S]:ww,[G$]:HT,[Fr]:e.method,[to]:e.url},i=Fw(e);if(i!=null){r[Fe]=i;let s=Q(),c=s&&Oe(s);c&&oe(c).data[H]==="http.server"&&c.setAttribute(Fe,i)}let o=L({name:"request",op:Gw,attributes:r});e[Bi]=o,se(o,()=>{n()})}function F$(e,t,n){let r=e[Bi];r!=null&&(r.setAttributes({[yn]:t.statusCode}),r.end()),e[Bi]=null,n()}function W$(e,t,n,r){let i=e[Bi];i!=null&&(t.statusCode>=500&&i.setStatus({code:2}),i.setAttributes({[yn]:t.statusCode}),i.end()),e[Bi]=null,r(null,n)}function V$(e,t,n,r){let i=e[Bi];i?.setStatus({code:2,message:n.message}),r()}function Y$(e,t){let n=this[Bw];return Uw.includes(e)?n.call(this,e,No(t,e,{[To]:`${this.pluginName} - ${e}`,[Io]:bc,[Ns]:t.name?.length>0?t.name:Ao})):n.call(this,e,t)}function j$(e,t){let n=this[Hw];if(typeof e=="function"){n.call(this,No(e,"notFoundHandler",{[To]:`${this.pluginName} - not-found-handler`,[Io]:bc,[Ns]:e.name?.length>0?e.name:Ao}));return}if(e.preValidation!=null&&(e.preValidation=No(e.preValidation,"notFoundHandler - preValidation",{[To]:`${this.pluginName} - not-found-handler - preValidation`,[Io]:bc,[Ns]:e.preValidation.name?.length>0?e.preValidation.name:Ao})),e.preHandler!=null&&(e.preHandler=No(e.preHandler,"notFoundHandler - preHandler",{[To]:`${this.pluginName} - not-found-handler - preHandler`,[Io]:bc,[Ns]:e.preHandler.name?.length>0?e.preHandler.name:Ao})),t==null){n.call(this,e);return}n.call(this,e,No(t,"notFoundHandler",{[To]:`${this.pluginName} - not-found-handler`,[Io]:bc,[Ns]:t.name?.length>0?t.name:Ao}))}function Z$(e){for(let t of e)if(D$(t))return t;return null}function No(e,t,n={}){return function(...i){let o=Z$(i);if(o===null||Ww(o)?.otel===!1)return e.call(this,...i);let s=o[Bi]??void 0,c=e.name?.length>0?e.name:this.pluginName??Ao,a=n[Io],l=a===bc?w$:a===Dw?Gw:void 0,p=l?X$(n[To]):`${t} - ${c}`;return Se({name:p,op:l,attributes:{...n,[S]:ww},parentSpan:s},()=>e.call(this,...i))}}function X$(e=""){return e.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"").replace(/^@sentry\/instrumentation-fastify -> /,"")}function K$(e){e.addHook("onRequest",async(t,n)=>{let r=Fw(t),i=t.method||"GET";$().setTransactionName(`${i} ${r}`)})}var Lw=!1,Yw=Object.assign(function(){Lw||(Lw=!0,Mw.subscribe("fastify.initialization",t=>{let n=t.fastify;n?.register(Vw).after(r=>{r?J&&g.error("Failed to setup Fastify instrumentation",r):n&&K$(n)})}))},{id:"Fastify.v5"});var $f="Fastify";function Jf(e,t,n){let r=n.statusCode;return r>=500||r<=299}import*as jw from"diagnostics_channel";function q$(){return O()?.getIntegrationByName($f)}function Zw(){jw.subscribe("tracing:fastify.request.handler:error",e=>{let{error:t,request:n,reply:r}=e;zf.call(zf,t,n,r,"diagnostics-channel")})}function zf(e,t,n,r){let i=q$()?.getShouldHandleError()||Jf;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){J&&g.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)&&ge(e,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var Q$=(({shouldHandleError:e}={})=>{let t;return{name:$f,setupOnce(){t=e||Jf,Zw(),Yw()},getShouldHandleError(){return t},setShouldHandleError(n){t=n}}}),WT=Q$;var eg=zf;var $$="db.mongodb.collection",J$="db.name",z$="db.user",eJ="net.peer.name",tJ="net.peer.port",nJ="db.operation",rJ="db.system";function Hi({collection:e,modelName:t,operation:n,origin:r,parentSpan:i}){let o={[$$]:e?.name,[J$]:e?.conn?.name,[z$]:e?.conn?.user,[eJ]:e?.conn?.host,[tJ]:e?.conn?.port,[nJ]:n,[rJ]:"mongoose",[S]:r};return L({name:`mongoose.${t}.${n}`,op:"db",kind:D.CLIENT,attributes:o,parentSpan:i})}var Xw="Fastify",VT=fe(`${Xw}.v3`,()=>new Df);function iJ(){let e=O();if(e)return e.getIntegrationByName(Xw)}var oJ=(e=>{let t=WT(e);return Ht(t,{setupOnce(){VT()}})}),YT=(e={})=>oJ(e);function sJ(e,t){t?.shouldHandleError&&iJ()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(r,i,o){r.addHook("onError",async(s,c,a)=>{eg.call(eg,a,s,c,"onError-hook")}),o()},{[Symbol.for("skip-override")]:!0,[Symbol.for("fastify.display-name")]:"sentry-fastify-error-handler"});e.register(n)}import{normalize as aJ}from"path";var Re=class{constructor(t,n,r,i){this.name=aJ(t),this.supportedVersions=n,this.patch=r,this.unpatch=i}};var jT=(e=>(e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription",e))(jT||{}),Ro=(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))(Ro||{}),Fi=(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))(Fi||{});var Tn=(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))(Tn||{});var Yp=Symbol.for("opentelemetry.patched"),ci=Symbol.for("opentelemetry.graphql_data");var Kw="Operation$operationName$not supported";var qw=Object.values(jT),ZT=e=>typeof e?.then=="function";function tg(e,t,n,r){if(O()?.getDataCollectionOptions().graphQL.document===!0){let i=_J(t,n,r);e.setAttribute(Tn.SOURCE,i)}}function cJ(e,t,n){let r=zw(e,n);if(r)return{field:r,spanAdded:!1};let i=uJ(e,n);return r={span:lJ(e,t,n,i)},pJ(e,n,r),{field:r,spanAdded:!0}}function lJ(e,t,n,r){let i={[Tn.FIELD_NAME]:t.fieldName,[Tn.FIELD_PATH]:n.join("."),[Tn.FIELD_TYPE]:t.returnType.toString(),[Tn.PARENT_NAME]:t.parentType.name},o=L({name:`${Fi.RESOLVE} ${i[Tn.FIELD_PATH]}`,attributes:i,parentSpan:r}),s=e[ci].source,c=t.fieldNodes.find(a=>a.kind==="Field");return c&&tg(o,s.loc,c.loc?.start,c.loc?.end),o}function Rs(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function XT(e,t){if(!(!e||!Array.isArray(e.definitions)))return t?e.definitions.filter(n=>qw.indexOf(n?.operation)!==-1).find(n=>t===n?.name?.value):e.definitions.find(n=>qw.indexOf(n?.operation)!==-1)}function pJ(e,t,n){return e[ci].fields[t.join(".")]=n}function zw(e,t){return e[ci].fields[t.join(".")]}function uJ(e,t){for(let n=t.length-1;n>0;n--){let r=zw(e,t.slice(0,n));if(r)return r.span}return dJ(e)}function dJ(e){return e[ci].span}function mJ(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function fJ(e){return eG(`
|
|
33
|
+
`,e)}function Qw(e){return eG(" ",e)}function eG(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}var gJ=[Ro.FLOAT,Ro.STRING,Ro.INT,Ro.BLOCK_STRING];function _J(e,t,n){let r="";if(e?.startToken){let i=typeof t=="number"?t:e.start,o=typeof n=="number"?n:e.end,s=e.startToken.next,c=1;for(;s;){if(s.start<i){s=s.next,c=s?.line;continue}if(s.end>o){s=s.next,c=s?.line;continue}let a=s.value||s.kind,l="";gJ.indexOf(s.kind)>=0&&(a="*"),s.kind===Ro.STRING&&(a=`"${a}"`),s.kind===Ro.EOF&&(a=""),s.line>c?(r+=fJ(s.line-c),c=s.line,l=Qw(s.column-1)):s.line===s.prev?.line&&(l=Qw(s.start-(s.prev?.end||0))),r+=l+a,s&&(s=s.next)}}return r}function ng(e,t){if(!e||e[Yp])return;let n=e.getFields();e[Yp]=!0,Object.keys(n).forEach(r=>{let i=n[r];if(i&&(i.resolve&&(i.resolve=KT(t,i.resolve)),i.type)){let o=tG(i.type);for(let s of o)ng(s,t)}})}function tG(e){return"ofType"in e?tG(e.ofType):hJ(e)?e.getTypes():bJ(e)?[e]:[]}function hJ(e){return"getTypes"in e&&typeof e.getTypes=="function"}function bJ(e){return"getFields"in e&&typeof e.getFields=="function"}var $w=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},Jw=(e,t)=>{t&&e.end()};function KT(e,t,n=!1){if(r[Yp]||typeof t!="function")return t;function r(i,o,s,c){if(!t)return;if(e().ignoreTrivialResolveSpans&&n&&(B(i)||typeof i=="function")&&typeof i[c.fieldName]!="function")return t.call(this,i,o,s,c);if(!s[ci])return t.call(this,i,o,s,c);let l=mJ(c?.path),{field:p,spanAdded:u}=cJ(s,c,l),d=p.span,m=u;return se(d,()=>{try{let _=t.call(this,i,o,s,c);return ZT(_)?_.then(h=>(Jw(d,m),h),h=>{throw $w(d,h,m),h}):(Jw(d,m),_)}catch(_){throw $w(d,_,m),_}})}return r[Yp]=!0,r}var yJ="@sentry/instrumentation-graphql",SJ="auto.graphql.otel.graphql",nG={ignoreResolveSpans:!1},rg=[">=14.0.0 <17"],ig=class extends le{constructor(t={}){super(yJ,q,{...nG,...t})}setConfig(t={}){super.setConfig({...nG,...t})}init(){let t=new re("graphql",rg);return t.files.push(this._addPatchingExecute()),t.files.push(this._addPatchingParser()),t.files.push(this._addPatchingValidate()),t}_addPatchingExecute(){return new Re("graphql/execution/execute.js",rg,t=>(w(t.execute)&&this._unwrap(t,"execute"),this._wrap(t,"execute",this._patchExecute(t.defaultFieldResolver)),t),t=>{t&&this._unwrap(t,"execute")})}_addPatchingParser(){return new Re("graphql/language/parser.js",rg,t=>(w(t.parse)&&this._unwrap(t,"parse"),this._wrap(t,"parse",this._patchParse()),t),t=>{t&&this._unwrap(t,"parse")})}_addPatchingValidate(){return new Re("graphql/validation/validate.js",rg,t=>(w(t.validate)&&this._unwrap(t,"validate"),this._wrap(t,"validate",this._patchValidate()),t),t=>{t&&this._unwrap(t,"validate")})}_patchExecute(t){let n=this;return function(i){return function(){let s;if(arguments.length>=2){let l=arguments;s=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],t)}else{let l=arguments[0];s=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,t)}let c=XT(s.document,s.operationName),a=n._createExecuteSpan(c,s);return s.contextValue[ci]={source:s.document?s.document||s.document[ci]:void 0,span:a,fields:{}},se(a,()=>ei(()=>i.apply(this,[s]),(l,p)=>{n._handleExecutionResult(a,l,p)}))}}}_handleExecutionResult(t,n,r){if(r===void 0||n){Rs(t,n);return}ZT(r)?r.then(i=>{this._updateSpanFromResult(t,i),Rs(t)},i=>{Rs(t,i)}):(this._updateSpanFromResult(t,r),Rs(t))}_updateSpanFromResult(t,n){if(n.errors?.length&&!oe(t).status&&t.setStatus({code:2}),!this.getConfig().useOperationNameForRootSpan)return;let r=oe(t).data,i=r[Tn.OPERATION_TYPE],o=r[Tn.OPERATION_NAME];if(!i)return;let s=Oe(t),a=oe(s).data[Es]||[],l=o?`${i} ${o}`:`${i}`;Array.isArray(a)?(a.push(l),s.setAttribute(Es,a)):typeof a=="string"?s.setAttribute(Es,[a,l]):s.setAttribute(Es,l),oe(s).data["original-description"]||s.setAttribute("original-description",oe(s).description),s.updateName(`${oe(s).data["original-description"]} (${EJ(a)})`)}_patchParse(){let t=this;return function(r){return function(o,s){return t._parse(this,r,o,s)}}}_patchValidate(){let t=this;return function(r){return function(o,s,c,a,l){return t._validate(this,r,o,s,c,l,a)}}}_parse(t,n,r,i){let o=L({name:Fi.PARSE});return se(o,()=>ei(()=>n.call(t,r,i),(s,c)=>{c&&(XT(c)?c.loc&&tg(o,c.loc):o.updateName(Fi.SCHEMA_PARSE)),Rs(o,s)}))}_validate(t,n,r,i,o,s,c){let a=L({name:Fi.VALIDATE});return se(a,()=>ei(()=>n.call(t,r,i,o,c,s),(l,p)=>{i.loc||a.updateName(Fi.SCHEMA_VALIDATE),Rs(a,l)}))}_createExecuteSpan(t,n){let r=L({name:Fi.EXECUTE,attributes:{[S]:SJ}});if(t){let{operation:i,name:o}=t;r.setAttribute(Tn.OPERATION_TYPE,i);let s=o?.value;s?(r.setAttribute(Tn.OPERATION_NAME,s),r.updateName(`${i} ${s}`)):r.updateName(i)}else{let i=" ";n.operationName&&(i=` "${n.operationName}" `),i=Kw.replace("$operationName$",i),r.setAttribute(Tn.OPERATION_NAME,i)}return n.document?.loc&&tg(r,n.document.loc),r}_wrapExecuteArgs(t,n,r,i,o,s,c,a,l){if(i||(i={}),i[ci]||this.getConfig().ignoreResolveSpans)return{schema:t,document:n,rootValue:r,contextValue:i,variableValues:o,operationName:s,fieldResolver:c,typeResolver:a};let p=c==null;return c=KT(()=>this.getConfig(),c??l,p),t&&(ng(t.getQueryType(),()=>this.getConfig()),ng(t.getMutationType(),()=>this.getConfig())),{schema:t,document:n,rootValue:r,contextValue:i,variableValues:o,operationName:s,fieldResolver:c,typeResolver:a}}};function EJ(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 rG="Graphql",QT=fe(rG,ig,e=>qT(e)),TJ=((e={})=>Ht(Up(qT(e)),{name:rG,setupOnce(){QT(qT(e))}})),$T=TJ;function qT(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var yc="messaging.destination.partition.id",JT="messaging.kafka.message.key",zT="messaging.kafka.message.tombstone",iG="messaging.kafka.offset",eI="process",jp="receive",oG="send",tI="kafka",sG="_OTHER";var IJ="auto.kafkajs.otel.producer",AJ="auto.kafkajs.otel.consumer";function Zp(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function aG(e){let t=Zp(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=Rn(t,Zp(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?Xt.SAMPLED:Xt.NONE}}]}function og({topic:e,message:t,operationType:n,links:r,attributes:i}){let o=n===jp?"poll":n;return L({name:`${o} ${e}`,kind:n===jp?D.CLIENT:D.CONSUMER,links:r,attributes:{...i,[Dt]:tI,[xn]:e,[ur]:n,[ha]:o,[JT]:t?.key?String(t.key):void 0,[zT]:t?.key&&t.value===null?!0:void 0,[iG]:t?.offset,...t?{[S]:AJ}:{}}})}function nI(e,t){let n=L({name:`send ${e}`,kind:D.PRODUCER,attributes:{[Dt]:tI,[xn]:e,[JT]:t.key?String(t.key):void 0,[zT]:t.key&&t.value===null?!0:void 0,[yc]:t.partition!==void 0?String(t.partition):void 0,[ha]:"send",[ur]:oG,[S]:IJ}});t.headers=t.headers??{};let r=tt({span:n});return r["sentry-trace"]&&(t.headers["sentry-trace"]=r["sentry-trace"]),r.baggage&&(t.headers.baggage=r.baggage),n}function vs(e,t){return Promise.resolve(t).catch(n=>{let r,i=sG;throw typeof n=="string"||n===void 0?r=n:typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"message")&&(r=n.message,i=n.constructor.name),e.forEach(o=>{o.setAttribute(Ur,i),o.setStatus({code:2,message:r})}),n}).finally(()=>{e.forEach(n=>n.end())})}var NJ="@sentry/instrumentation-kafkajs",sg=class extends le{constructor(t={}){super(NJ,q,t)}init(){let t=r=>{w(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),w(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new re("kafkajs",[">=0.3.0 <3"],r=>(t(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),t)}_getConsumerPatch(){let t=this;return n=>function(...i){let o=n.apply(this,i);return w(o.run)&&t._unwrap(o,"run"),t._wrap(o,"run",t._getConsumerRunPatch()),o}}_getProducerPatch(){let t=this;return n=>function(...i){let o=n.apply(this,i);return w(o.sendBatch)&&t._unwrap(o,"sendBatch"),t._wrap(o,"sendBatch",t._getSendBatchPatch()),w(o.send)&&t._unwrap(o,"send"),t._wrap(o,"send",t._getSendPatch()),w(o.transaction)&&t._unwrap(o,"transaction"),t._wrap(o,"transaction",t._getProducerTransactionPatch()),o}}_getConsumerRunPatch(){let t=this;return n=>function(...i){let o=i[0];return o?.eachMessage&&(w(o.eachMessage)&&t._unwrap(o,"eachMessage"),t._wrap(o,"eachMessage",t._getConsumerEachMessagePatch())),o?.eachBatch&&(w(o.eachBatch)&&t._unwrap(o,"eachBatch"),t._wrap(o,"eachBatch",t._getConsumerEachBatchPatch())),n.call(this,o)}}_getConsumerEachMessagePatch(){return t=>function(...r){let i=r[0],o=Zp(i.message.headers,"sentry-trace"),s=Zp(i.message.headers,"baggage");return vn({sentryTrace:o,baggage:s},()=>{let c=og({topic:i.topic,message:i.message,operationType:eI,attributes:{[yc]:String(i.partition)}}),a=se(c,()=>t.apply(this,r));return vs([c],a)})}}_getConsumerEachBatchPatch(){return t=>function(...r){let i=r[0],o=On(()=>og({topic:i.batch.topic,message:void 0,operationType:jp,attributes:{[ga]:i.batch.messages.length,[yc]:String(i.batch.partition)}}));return se(o,()=>{let s=[o];i.batch.messages.forEach(a=>{s.push(og({topic:i.batch.topic,message:a,operationType:eI,links:aG(a.headers),attributes:{[yc]:String(i.batch.partition)}}))});let c=t.apply(this,r);return vs(s,c)})}}_getProducerTransactionPatch(){let t=this;return n=>function(...i){let o=L({name:"transaction"}),s=n.apply(this,i);return s.then(c=>{let a=c.send;c.send=function(...m){return se(o,()=>t._getSendPatch()(a).apply(this,m).catch(h=>{throw o.setStatus({code:2,message:h?.message}),h}))};let l=c.sendBatch;c.sendBatch=function(...m){return se(o,()=>t._getSendBatchPatch()(l).apply(this,m).catch(h=>{throw o.setStatus({code:2,message:h?.message}),h}))};let p=c.commit;c.commit=function(...m){let _=p.apply(this,m).then(()=>{o.setStatus({code:1})});return vs([o],_)};let u=c.abort;c.abort=function(...m){let _=u.apply(this,m);return vs([o],_)}}).catch(c=>{o.setStatus({code:2,message:c?.message}),o.end()}),s}}_getSendBatchPatch(){return t=>function(...r){let o=r[0].topicMessages||[],s=[];o.forEach(a=>{a.messages.forEach(l=>{s.push(nI(a.topic,l))})});let c=t.apply(this,r);return vs(s,c)}}_getSendPatch(){return t=>function(...r){let i=r[0],o=i.messages.map(c=>nI(i.topic,c)),s=t.apply(this,r);return vs(o,s)}}};var cG="Kafka",rI=fe(cG,()=>new sg),RJ=(()=>({name:cG,setupOnce(){rI()}})),iI=RJ;var vJ="@sentry/instrumentation-lru-memoizer",ag=class extends le{constructor(){super(vJ,q,{})}init(){return[new re("lru-memoizer",[">=1.3 <4"],t=>Object.assign(function(...r){let i=t.apply(this,r);return function(...o){let s=o.pop(),c=ne(),a=typeof s=="function"?function(...l){return He(c,()=>s.apply(this,l))}:s;return i.apply(this,[...o,a])}},{sync:t.sync}),void 0)]}};var lG="LruMemoizer",oI=fe(lG,()=>new ag),OJ=(()=>({name:lG,setupOnce(){oI()}})),sI=OJ;var pG="auto.db.otel.mongo";function aI(e,t,n,r){return Dp(e,t,n,r,pG)}function Xp(e,t,n,r){return Hp(e,t,n,r,pG)}function Os(e,t){let n=Q(),r=!1;return function(...o){if(!r){r=!0;let s=o[0];e&&(s instanceof Error&&e.setStatus({code:2,message:s.message}),e.end())}return se(n??null,()=>t.apply(this,o))}}function Cs(){return!Q()}function cg(e){return t=>function(r,i,o,s,c){let a=typeof s=="function"?s:c;if(Cs()||typeof a!="function"||typeof o!="object")return typeof s=="function"?t.call(this,r,i,o,s):t.call(this,r,i,o,s,c);let l=Er(Xp(i,r,o[0],e)),p=Os(l,a);return typeof s=="function"?t.call(this,r,i,o,p):t.call(this,r,i,o,s,p)}}function uG(){return e=>function(n,r,i,o,s){let c=typeof o=="function"?o:s;if(Cs()||typeof c!="function"||typeof i!="object")return typeof o=="function"?e.call(this,n,r,i,o):e.call(this,n,r,i,o,s);let a=Bp(i),l=Er(Xp(r,n,i,a)),p=Os(l,c);return typeof o=="function"?e.call(this,n,r,i,p):e.call(this,n,r,i,o,p)}}function dG(){return e=>function(n,r,i,o){let s=o,c=Object.keys(r)[0];if(typeof r!="object"||r.ismaster||r.hello)return e.call(this,n,r,i,o);let a;Cs()||(a=Er(aI(this,n,r,c)));let l=Os(a,s);return e.call(this,n,r,i,l)}}function mG(){return e=>function(...n){let[r,i]=n,o=Object.keys(i)[0],s=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return e.apply(this,n);let c;Cs()||(c=Er(aI(this,r,i,o)));let a=Os(c,s),l=e.apply(this,n);return l.then(p=>a(null,p),p=>a(p)),l}}function fG(){return e=>function(n,r,i,o,s,c){let a=typeof s=="function"?s:c;if(Cs()||typeof a!="function"||typeof i!="object")return typeof s=="function"?e.call(this,n,r,i,o,s):e.call(this,n,r,i,o,s,c);let l=Er(Xp(r,n,i,"find")),p=Os(l,a);return typeof s=="function"?e.call(this,n,r,i,o,p):e.call(this,n,r,i,o,s,p)}}function gG(){return e=>function(n,r,i,o,s,c){let a=typeof s=="function"?s:c;if(Cs()||typeof a!="function")return typeof s=="function"?e.call(this,n,r,i,o,s):e.call(this,n,r,i,o,s,c);let l=Er(Xp(r,n,i.cmd,"getMore")),p=Os(l,a);return typeof s=="function"?e.call(this,n,r,i,o,p):e.call(this,n,r,i,o,s,p)}}function _G(){return e=>function(n){let r=Q();return e.call(this,function(...i){return se(r??null,()=>n.apply(this,i))})}}var CJ="@sentry/instrumentation-mongodb",lg=class extends le{constructor(t={}){super(CJ,q,t)}init(){let{v3PatchConnection:t,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnectionCallback:r,v4PatchConnectionPromise:i,v4UnpatchConnection:o}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:s,v4UnpatchConnectionPool:c}=this._getV4ConnectionPoolPatches();return[new re("mongodb",[">=3.3.0 <4"],void 0,void 0,[new Re("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],t,n)]),new re("mongodb",[">=4.0.0 <8"],void 0,void 0,[new Re("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],r,o),new Re("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,o),new Re("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],s,c)])]}_getV3ConnectionPatches(){return{v3PatchConnection:t=>(w(t.insert)&&this._unwrap(t,"insert"),this._wrap(t,"insert",cg("insert")),w(t.remove)&&this._unwrap(t,"remove"),this._wrap(t,"remove",cg("remove")),w(t.update)&&this._unwrap(t,"update"),this._wrap(t,"update",cg("update")),w(t.command)&&this._unwrap(t,"command"),this._wrap(t,"command",uG()),w(t.query)&&this._unwrap(t,"query"),this._wrap(t,"query",fG()),w(t.getMore)&&this._unwrap(t,"getMore"),this._wrap(t,"getMore",gG()),t),v3UnpatchConnection:t=>{t!==void 0&&(this._unwrap(t,"insert"),this._unwrap(t,"remove"),this._unwrap(t,"update"),this._unwrap(t,"command"),this._unwrap(t,"query"),this._unwrap(t,"getMore"))}}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:t=>{let n=t.ConnectionPool.prototype;return w(n.checkOut)&&this._unwrap(n,"checkOut"),this._wrap(n,"checkOut",_G()),t},v4UnpatchConnectionPool:t=>{t!==void 0&&this._unwrap(t.ConnectionPool.prototype,"checkOut")}}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:t=>(w(t.Connection.prototype.command)&&this._unwrap(t.Connection.prototype,"command"),this._wrap(t.Connection.prototype,"command",dG()),t),v4PatchConnectionPromise:t=>(w(t.Connection.prototype.command)&&this._unwrap(t.Connection.prototype,"command"),this._wrap(t.Connection.prototype,"command",mG()),t),v4UnpatchConnection:t=>{t!==void 0&&this._unwrap(t.Connection.prototype,"command")}}}};var hG="Mongo",cI=fe(hG,()=>new lg),xJ=(()=>({name:hG,setupOnce(){cI()}})),lI=xJ;function bG(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
|
|
34
|
+
Mongoose Error Code: ${t.code}`:""}`})}function yG(e,t){return e instanceof Promise?e.catch(n=>{throw bG(t,n),n}).finally(()=>t.end()):(t.end(),e)}function SG(e,t,n,r,i){let o=0;return i.length===2?o=1:i.length===3&&(o=2),i[o]=(s,c)=>(s&&bG(r,s),r.end(),e(s,c)),t.apply(n,i)}var PJ="@sentry/instrumentation-mongoose",Kp="auto.db.otel.mongoose",dg=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],kJ=["remove","count","findOneAndRemove",...dg],LJ=["count","findOneAndRemove",...dg],MJ=[...dg];function EG(e){return e?e.startsWith("6.")||e.startsWith("5.")?kJ:e.startsWith("7.")?LJ:MJ:dg}function TG(e){return e&&(e.startsWith("5.")||e.startsWith("6."))||!1}function IG(e){return!e||!e.startsWith("8.")?!1:parseInt(e.split(".")[1],10)>=21}var pg=Symbol("stored-parent-span"),AG=Symbol("already-instrumented"),ug=class extends le{constructor(t={}){super(PJ,q,t)}init(){return new re("mongoose",[">=5.9.7 <9.7.0"],this.patch.bind(this),this.unpatch.bind(this))}patch(t,n){let r=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save")),r.Model.prototype.$save=r.Model.prototype.save,TG(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove")),IG(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne")),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne"))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec()),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec()),EG(n).forEach(o=>{this._wrap(r.Query.prototype,o,this.patchAndCaptureSpanContext(o))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany")),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite")),r}unpatch(t,n){let r=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t,i=EG(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,TG(n)&&this._unwrap(r.Model.prototype,"remove"),IG(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),i.forEach(o=>{this._unwrap(r.Query.prototype,o)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(){let t=this;return n=>function(i){let o=this[pg],s=Hi({collection:this._model.collection,modelName:this._model?.modelName,operation:"aggregate",origin:Kp,parentSpan:o});return t._handleResponse(s,n,this,arguments,i)}}patchQueryExec(){let t=this;return n=>function(i){if(this[AG])return n.apply(this,arguments);let o=this[pg],s=Hi({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:Kp,parentSpan:o});return t._handleResponse(s,n,this,arguments,i)}}patchOnModelMethods(t){let n=this;return r=>function(o,s){let c=Hi({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:Kp});return o instanceof Function&&(s=o),n._handleResponse(c,r,this,arguments,s)}}_patchDocumentUpdateMethods(t){let n=this;return r=>function(o,s,c){let a=c;typeof o=="function"?a=o:typeof s=="function"&&(a=s);let l=Hi({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:Kp}),p=n._handleResponse(l,r,this,arguments,a);return p&&typeof p=="object"&&(p[AG]=!0),p}}patchModelStatic(t){let n=this;return r=>function(o,s,c){typeof s=="function"&&(c=s);let a=Hi({collection:this.collection,modelName:this.modelName,operation:t,origin:Kp});return n._handleResponse(a,r,this,arguments,c)}}patchModelAggregate(){return t=>function(){let r=Q(),i=t.apply(this,arguments);return i&&(i[pg]=r),i}}patchAndCaptureSpanContext(t){return n=>function(){return this[pg]=Q(),n.apply(this,arguments)}}_handleResponse(t,n,r,i,o){return se(t,()=>{if(o instanceof Function)return SG(o,n,r,t,i);{let s=n.apply(r,i);return yG(s,t)}})}};var NG="Mongoose",pI=fe(NG,()=>new ug),wJ=(()=>Ht(bT(),{name:NG,setupOnce(){pI()}})),uI=wJ;var RG="db.connection_string",vG="mysql";function OG(e){let t=e?.connectionConfig||e||{},{host:n,port:r,database:i,user:o}=t;return{host:n,port:r,database:i,user:o}}function CG(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function xG(e){return typeof e=="string"?e:e.sql}function PG(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var GJ="@sentry/instrumentation-mysql",UJ="auto.db.otel.mysql",mg=class extends le{constructor(t={}){super(GJ,q,t)}init(){return[new re("mysql",[">=2.0.0 <3"],t=>(w(t.createConnection)&&this._unwrap(t,"createConnection"),this._wrap(t,"createConnection",this._patchCreateConnection()),w(t.createPool)&&this._unwrap(t,"createPool"),this._wrap(t,"createPool",this._patchCreatePool()),w(t.createPoolCluster)&&this._unwrap(t,"createPoolCluster"),this._wrap(t,"createPoolCluster",this._patchCreatePoolCluster()),t),t=>{t!==void 0&&(this._unwrap(t,"createConnection"),this._unwrap(t,"createPool"),this._unwrap(t,"createPoolCluster"))})]}_patchCreateConnection(){return t=>{let n=this;return function(i){let o=t(...arguments);return n._wrap(o,"query",n._patchQuery(o)),o}}}_patchCreatePool(){return t=>{let n=this;return function(i){let o=t(...arguments);return n._wrap(o,"query",n._patchQuery(o)),n._wrap(o,"getConnection",n._patchGetConnection(o)),o}}}_patchCreatePoolCluster(){return t=>{let n=this;return function(i){let o=t(...arguments);return n._wrap(o,"getConnection",n._patchGetConnection(o)),o}}}_patchGetConnection(t){return n=>{let r=this;return function(o,s,c){if(!r._enabled)return r._unwrap(t,"getConnection"),n.apply(t,arguments);if(arguments.length===1&&typeof o=="function"){let a=r._getConnectionCallbackPatchFn(o);return n.call(t,a)}if(arguments.length===2&&typeof s=="function"){let a=r._getConnectionCallbackPatchFn(s);return n.call(t,o,a)}if(arguments.length===3&&typeof c=="function"){let a=r._getConnectionCallbackPatchFn(c);return n.call(t,o,s,a)}return n.apply(t,arguments)}}}_getConnectionCallbackPatchFn(t){let n=this,r=ne();return function(i,o){o&&(w(o.query)||n._wrap(o,"query",n._patchQuery(o))),typeof t=="function"&&He(r,()=>t.call(this,i,o))}}_patchQuery(t){return n=>{let r=this;return function(i,o,s){if(!r._enabled)return r._unwrap(t,"query"),n.apply(t,arguments);let{host:c,port:a,database:l,user:p}=OG(t.config),u=parseInt(String(a),10),d={[S]:UJ,[ke]:vG,[RG]:CG(c,a,l),[Et]:l,[Ut]:p,[Ye]:xG(i),[Me]:c};isNaN(u)||(d[Pe]=u);let m=L({name:PG(i),kind:D.CLIENT,attributes:d}),_=Array.from(arguments).findIndex(b=>typeof b=="function"),h=ne();if(_===-1){let b=se(m,()=>n.apply(t,arguments));return bn(b,h),b.on("error",v=>{m.setStatus({code:2,message:v.message})}).on("end",()=>{m.end()})}else return r._wrap(arguments,_,r._patchCallbackQuery(m,h)),se(m,()=>n.apply(t,arguments))}}}_patchCallbackQuery(t,n){return r=>function(i,o,s){return i&&t.setStatus({code:2,message:i.message}),t.end(),He(n,()=>r(...arguments))}}};var kG="Mysql",dI=fe(kG,()=>new mg({})),DJ=(()=>({name:kG,setupOnce(){dI()}})),mI=DJ;var LG="db.connection_string",MG="mysql";function wG(e){let{host:t,port:n,database:r,user:i}=BJ(e),o={[LG]:HJ(t,n,r),[Et]:r,[Ut]:i,[Me]:t},s=parseInt(n,10);return isNaN(s)||(o[Pe]=s),o}function BJ(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function HJ(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function GG(e,t,n){let[r,i]=typeof e=="string"?[e,n]:[e.sql,FJ(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 FJ(e){return"values"in e}function UG(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var DG=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function fI(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:t}var WJ="@sentry/instrumentation-mysql2",VJ="auto.db.otel.mysql2",gI=[">=1.4.2 <3.20.0"],fg=class extends le{constructor(t={}){super(WJ,q,t)}init(){let t;function n(o){!t&&o.format&&(t=o.format)}let r=o=>{w(o.query)&&this._unwrap(o,"query"),this._wrap(o,"query",this._patchQuery(t)),w(o.execute)&&this._unwrap(o,"execute"),this._wrap(o,"execute",this._patchQuery(t))},i=o=>{this._unwrap(o,"query"),this._unwrap(o,"execute")};return[new re("mysql2",gI,o=>(n(o),o),()=>{},[new Re("mysql2/promise.js",gI,o=>(n(o),o),()=>{}),new Re("mysql2/lib/connection.js",gI,o=>{let s=fI(o);return r(s),o},o=>{if(o===void 0)return;let s=fI(o);i(s)})])]}_patchQuery(t){let n=this;return r=>function(i,o,s){let c;Array.isArray(o)?c=o:arguments[2]&&(c=[o]);let a={...wG(this.config),[ke]:MG,[Ye]:GG(i,t,c),[S]:VJ},l=L({name:UG(i),kind:D.CLIENT,attributes:a}),p=DG(u=>{u&&l.setStatus({code:2,message:u.message}),l.end()});if(arguments.length===1){typeof i.onResult=="function"&&n._wrap(i,"onResult",n._patchCallbackQuery(p));let u=r.apply(this,arguments);return u.once("error",d=>{p(d)}).once("result",()=>{p()}),u}return typeof arguments[1]=="function"?n._wrap(arguments,1,n._patchCallbackQuery(p)):typeof arguments[2]=="function"&&n._wrap(arguments,2,n._patchCallbackQuery(p)),r.apply(this,arguments)}}_patchCallbackQuery(t){return n=>function(...r){return t(r[0]),n(...r)}}};var BG="Mysql2",_I=fe(BG,()=>new fg),YJ=(()=>Ht(ET(),{name:BG,setupOnce(){_I()}})),hI=YJ;import*as tU from"diagnostics_channel";var gg,HG;function FG(e){gg=e}function Sc(){return!!gg}function bI(){if(gg)return HG??(HG=gg())}var jJ=["get","set","setex"],yI=["get","mget"],ZJ=["set","setex"],SI=["del","unlink"];function xs(e,t){return e.includes(t.toLowerCase())}function EI(e){return xs(yI,e)?"cache.get":xs(ZJ,e)?"cache.put":xs(SI,e)?"cache.remove":void 0}function XJ(e,t){return t.some(n=>e.startsWith(n))}function VG(e,t){try{if(t.length===0)return;let n=i=>typeof i=="string"||typeof i=="number"||Buffer.isBuffer(i)?[i.toString()]:Array.isArray(i)?WG(i.map(o=>n(o))):["<unknown>"],r=t[0];return xs(jJ,e)&&r!=null?n(r):WG(t.map(i=>n(i)))}catch{return}}function YG(e,t,n){if(!EI(e))return!1;for(let r of t)if(XJ(r,n))return!0;return!1}function jG(e){let t=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n=="string"?n.length:typeof n=="number"?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(e)?e.reduce((n,r)=>{let i=t(r);return typeof i=="number"?n!==void 0?n+i:i:n},0):t(e)}function WG(e){let t=[],n=r=>{r.forEach(i=>{Array.isArray(i)?n(i):t.push(i)})};return n(e),t}var qp={};function ZG(e){qp=e}var Ps=(e,t,n,r)=>{let i=VG(t,n),o=EI(t);if(!i||!o||!qp.cachePrefixes||!YG(t,i,qp.cachePrefixes))return;let s=oe(e).data,c=s["net.peer.name"]??s["server.address"],a=s["net.peer.port"]??s["server.port"];a&&c&&e.setAttributes({"network.peer.address":c,"network.peer.port":a});let l=xs(SI,t)?void 0:jG(r);l&&e.setAttribute(Bh,l),xs(yI,t)&&l!==void 0&&e.setAttribute(Uh,l>0),e.setAttributes({[H]:o,[Dh]:i});let p=i.join(", ");e.updateName(qp.maxCacheKeyLength?gn(p,qp.maxCacheKeyLength):p)};var Ec="db.connection_string",Tc="redis";var KJ="@sentry/instrumentation-ioredis",XG="auto.db.otel.redis",qJ=[">=2.0.0 <5.11.0"];function ks(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var _g=class extends le{constructor(t={}){super(KJ,q,t)}init(){return[new re("ioredis",qJ,t=>{let n=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t;return w(n.prototype.sendCommand)&&this._unwrap(n.prototype,"sendCommand"),this._wrap(n.prototype,"sendCommand",this._patchSendCommand()),w(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"connect",this._patchConnection()),t},t=>{if(t===void 0)return;let n=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(){let t=this;return n=>function(...r){let i=r[0];if(r.length<1||typeof i!="object"||!Q())return n.apply(this,r);let{host:o,port:s}=this.options,c={[ke]:Tc,[Ye]:ai(i.name,i.args),[Ec]:`redis://${o}:${s}`,[Me]:o,[Pe]:s,[S]:XG},a=L({name:i.name,kind:D.CLIENT,attributes:c});try{let l=n.apply(this,r),p=i.resolve;i.resolve=function(d){t._callResponseHook(a,i,d),ks(a,null),p(d)};let u=i.reject;return i.reject=function(d){ks(a,d),u(d)},l}catch(l){throw ks(a,l),l}}}_patchConnection(){return t=>function(...n){if(!Q())return t.apply(this,n);let{host:r,port:i}=this.options,o={[ke]:Tc,[Ye]:"connect",[Ec]:`redis://${r}:${i}`,[Me]:r,[Pe]:i,[S]:XG},s=L({name:"connect",kind:D.CLIENT,attributes:o});try{let c=t.apply(this,n);return c instanceof Promise?c.then(a=>(ks(s,null),a),a=>(ks(s,a),Promise.reject(a))):(ks(s,null),c)}catch(c){throw ks(s,c),c}}}_callResponseHook(t,n,r){let{responseHook:i}=this.getConfig();if(i)try{i(t,n.name,n.args,r)}catch{}}};var II="@sentry/instrumentation-redis",QG="auto.db.otel.redis",Qp=Symbol("opentelemetry.instrumentation.redis.open_spans"),KG=Symbol("opentelemetry.instrumentation.redis.multi_command_options");function hg(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function $G(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function QJ(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(t){je&&g.error("failed to sanitize redis connection url",t)}}function qG(e){return{[ke]:Tc,[Me]:e?.socket?.host,[Pe]:e?.socket?.port,[Ec]:QJ(e?.url),[S]:QG}}var JG=class zG extends le{constructor(t={}){super(II,q,t)}init(){return[new re("redis",[">=2.6.0 <4"],t=>(w(t.RedisClient.prototype.internal_send_command)&&this._unwrap(t.RedisClient.prototype,"internal_send_command"),this._wrap(t.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),t),t=>{t!==void 0&&this._unwrap(t.RedisClient.prototype,"internal_send_command")})]}_getPatchInternalSendCommand(){let t=this;return function(r){return function(o){if(arguments.length!==1||typeof o!="object")return r.apply(this,arguments);let s={[ke]:Tc,[Ye]:ai(o.command,o.args),[S]:QG};this.connection_options&&(s[Me]=this.connection_options.host,s[Pe]=this.connection_options.port),this.address&&(s[Ec]=`redis://${this.address}`);let c=L({name:`${zG.COMPONENT}-${o.command}`,kind:D.CLIENT,attributes:s}),a=arguments[0].callback;if(a){let l=Q();arguments[0].callback=function(u,d){return $G(t.getConfig().responseHook,c,o.command,o.args,d),hg(c,u),se(l??null,()=>a.apply(this,arguments))}}try{return r.apply(this,arguments)}catch(l){throw hg(c,l),l}}}}};JG.COMPONENT="redis";var $J=JG,eU=class TI extends le{constructor(t={}){super(II,q,t)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(t){let n=new Re(`${t}/dist/lib/commander.js`,["^1.0.0"],(o,s)=>{let c=o.transformCommandArguments;if(!c)return je&&g.error("internal instrumentation error, missing transformCommandArguments function"),o;let a=s?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return w(o?.[a])&&this._unwrap(o,a),this._wrap(o,a,this._getPatchExtendWithCommands(c)),o},o=>{w(o?.extendWithCommands)&&this._unwrap(o,"extendWithCommands"),w(o?.attachCommands)&&this._unwrap(o,"attachCommands")}),r=new Re(`${t}/dist/lib/client/multi-command.js`,["^1.0.0",">=5.0.0 <5.12.0"],o=>{let s=o?.default?.prototype;return w(s?.exec)&&this._unwrap(s,"exec"),this._wrap(s,"exec",this._getPatchMultiCommandsExec()),w(s?.execAsPipeline)&&this._unwrap(s,"execAsPipeline"),this._wrap(s,"execAsPipeline",this._getPatchMultiCommandsExec()),w(s?.addCommand)&&this._unwrap(s,"addCommand"),this._wrap(s,"addCommand",this._getPatchMultiCommandsAddCommand()),o},o=>{let s=o?.default?.prototype;w(s?.exec)&&this._unwrap(s,"exec"),w(s?.execAsPipeline)&&this._unwrap(s,"execAsPipeline"),w(s?.addCommand)&&this._unwrap(s,"addCommand")}),i=new Re(`${t}/dist/lib/client/index.js`,["^1.0.0",">=5.0.0 <5.12.0"],o=>{let s=o?.default?.prototype;return s?.multi&&(w(s?.multi)&&this._unwrap(s,"multi"),this._wrap(s,"multi",this._getPatchRedisClientMulti())),s?.MULTI&&(w(s?.MULTI)&&this._unwrap(s,"MULTI"),this._wrap(s,"MULTI",this._getPatchRedisClientMulti())),w(s?.sendCommand)&&this._unwrap(s,"sendCommand"),this._wrap(s,"sendCommand",this._getPatchRedisClientSendCommand()),w(s?.connect)&&this._unwrap(s,"connect"),this._wrap(s,"connect",this._getPatchedClientConnect()),o},o=>{let s=o?.default?.prototype;w(s?.multi)&&this._unwrap(s,"multi"),w(s?.MULTI)&&this._unwrap(s,"MULTI"),w(s?.sendCommand)&&this._unwrap(s,"sendCommand"),w(s?.connect)&&this._unwrap(s,"connect")});return new re(t,["^1.0.0",">=5.0.0 <5.12.0"],o=>o,()=>{},[n,r,i])}_getPatchExtendWithCommands(t){let n=this;return function(i){return function(s){if(s?.BaseClass?.name!=="RedisClient")return i.apply(this,arguments);let c=s.executor;return s.executor=function(a,l){let p=t(a,l).args;return n._traceClientCommand(c,this,arguments,p)},i.apply(this,arguments)}}}_getPatchMultiCommandsExec(){let t=this;return function(r){return function(){let o=r.apply(this,arguments);return typeof o?.then!="function"?(je&&g.error("non-promise result when patching exec/execAsPipeline"),o):o.then(s=>{let c=this[Qp];return t._endSpansWithRedisReplies(c,s),s}).catch(s=>{let c=this[Qp];if(!c)je&&g.error("cannot find open spans to end for multi/pipeline");else{let a=s.constructor.name==="MultiErrorReply"?s.replies:new Array(c.length).fill(s);t._endSpansWithRedisReplies(c,a)}return Promise.reject(s)})}}}_getPatchMultiCommandsAddCommand(){let t=this;return function(r){return function(o){return t._traceClientCommand(r,this,arguments,o)}}}_getPatchRedisClientMulti(){return function(n){return function(){let i=n.apply(this,arguments);return i[KG]=this.options,i}}}_getPatchRedisClientSendCommand(){let t=this;return function(r){return function(o){return t._traceClientCommand(r,this,arguments,o)}}}_getPatchedClientConnect(){return function(n){return function(){let i=qG(this.options),o=L({name:`${TI.COMPONENT}-connect`,kind:D.CLIENT,attributes:i});return se(o,()=>n.apply(this)).then(c=>(o.end(),c),c=>(hg(o,c),Promise.reject(c)))}}}_traceClientCommand(t,n,r,i){let o=n.options||n[KG],s=i[0],c=i.slice(1),a=qG(o),l=ai(s,c);l!=null&&(a[Ye]=l);let p=L({name:`${TI.COMPONENT}-${s}`,kind:D.CLIENT,attributes:a}),u=se(p,()=>t.apply(n,r));if(u instanceof Promise)u.then(d=>{this._endSpanWithResponse(p,s,c,d,void 0)},d=>{this._endSpanWithResponse(p,s,c,null,d)});else{let d=u;d[Qp]=d[Qp]||[],d[Qp].push({span:p,commandName:s,commandArgs:c})}return u}_endSpansWithRedisReplies(t,n){if(!t){je&&g.error("cannot find open spans to end for redis multi/pipeline");return}if(n.length!==t.length){je&&g.error("number of multi command spans does not match response from redis");return}for(let r=0;r<t.length;r++){let{span:i,commandName:o,commandArgs:s}=t[r],c=n[r],[a,l]=c instanceof Error?[null,c]:[c,void 0];this._endSpanWithResponse(i,o,s,a,l)}}_endSpanWithResponse(t,n,r,i,o){o||$G(this.getConfig().responseHook,t,n,r,i),hg(t,o)}};eU.COMPONENT="redis";var JJ=eU,bg=class extends le{constructor(t={}){super(II,q,t),this.initialized=!1,this.instrumentationV2_V3=new $J(this.getConfig()),this.instrumentationV4_V5=new JJ(this.getConfig()),this.initialized=!0}setConfig(t={}){super.setConfig(t),this.initialized&&(this.instrumentationV2_V3.setConfig(t),this.instrumentationV4_V5.setConfig(t))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(t){super.setTracerProvider(t),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(t),this.instrumentationV4_V5.setTracerProvider(t))}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())}};var yg="Redis",zJ=fe(`${yg}.IORedis`,()=>new _g({responseHook:Ps})),ez=fe(`${yg}.Redis`,()=>new bg({responseHook:Ps})),AI=Object.assign(()=>{(!Sc()||!tU.tracingChannel)&&(zJ(),ez())},{id:yg}),tz=((e={})=>Ht(CT({responseHook:Ps}),{name:yg,setupOnce(){ZG(e),AI()}})),NI=tz;var Ls=(e=>(e.QUERY_PREFIX="pg.query",e.CONNECT="pg.connect",e.POOL_CONNECT="pg-pool.connect",e))(Ls||{});var $p=(e=>(e.PG_PLAN="db.postgresql.plan",e.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",e.MAX_CLIENT="db.postgresql.max.client",e))($p||{});var RI="db.connection_string",vI="postgresql";var nz="auto.db.otel.postgres";function rz(e,t){if(!t)return Ls.QUERY_PREFIX;let n=typeof t.name=="string"&&t.name?t.name:iz(t.text);return`${Ls.QUERY_PREFIX}:${n}${e?` ${e}`:""}`}function iz(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 oz(e){try{let t=new URL(e);return t.username="",t.password="",t.toString()}catch{return"postgresql://localhost:5432/"}}function nU(e){if("connectionString"in e&&e.connectionString)return oz(e.connectionString);let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}function rU(e){if(Number.isInteger(e))return e}function OI(e){return{[ke]:vI,[Et]:e.database,[RI]:nU(e),[Ut]:e.user,[Me]:e.host,[Pe]:rU(e.port)}}function iU(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[$p.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[$p.MAX_CLIENT]:e.maxClient,[ke]:vI,[Et]:t?.pathname.slice(1)??e.database,[RI]:nU(e),[Me]:t?.hostname??e.host,[Pe]:Number(t?.port)||rU(e.port),[Ut]:t?.username??e.user}}function Sg(){return Q()===void 0}function oU(e){let{connectionParameters:t}=this,n=t.database,r=rz(n,e),i=L({name:r,kind:D.CLIENT,attributes:{...OI(t),[S]:nz}});return e&&(e.text&&i.setAttribute(Ye,e.text),typeof e.name=="string"&&i.setAttribute($p.PG_PLAN,e.name)),i}function CI(e,t){return function(r,i){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,i)}}function sU(e,t){return function(r,i,o){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,i,o)}}function aU(e,t){return function(...r){let i=r[0];i instanceof Error&&e.setStatus({code:2,message:i.message}),e.end(),t.apply(this,r)}}function Eg(e){return typeof e=="object"&&e!==null&&"message"in e?String(e.message):void 0}function cU(e){return typeof e=="object"&&typeof e?.text=="string"}var sz="@sentry/instrumentation-pg";function Ic(e){return e[Symbol.toStringTag]==="Module"?e.default:e}function Tg(e,t){return function(...n){return se(e,()=>t.apply(this,n))}}var Ig=class extends le{constructor(t={}){super(sz,q,t)}init(){let t=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new Re("pg/lib/native/client.js",t,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),i=new Re("pg/lib/client.js",t,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new re("pg",t,c=>{let a=Ic(c);return this._patchPgClient(a.Client),c},c=>{let a=Ic(c);return this._unpatchPgClient(a.Client),c},[i,r]),s=new re("pg-pool",n,c=>{let a=Ic(c);return w(a.prototype.connect)&&this._unwrap(a.prototype,"connect"),this._wrap(a.prototype,"connect",this._getPoolConnectPatch()),a},c=>{let a=Ic(c);w(a.prototype.connect)&&this._unwrap(a.prototype,"connect")});return[o,s]}_patchPgClient(t){if(!t)return;let n=Ic(t);return w(n.prototype.query)&&this._unwrap(n.prototype,"query"),w(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),t}_unpatchPgClient(t){let n=Ic(t);return w(n.prototype.query)&&this._unwrap(n.prototype,"query"),w(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),t}_getClientConnectPatch(){let t=this;return n=>function(i){if(Sg()||t.getConfig().ignoreConnectSpans)return n.call(this,i);let o=L({name:Ls.CONNECT,kind:D.CLIENT,attributes:OI(this)}),s=i;if(s){let a=Q();s=aU(o,s),a&&(s=Tg(a,s))}let c=se(o,()=>n.call(this,s));return lU(o,c)}}_getClientQueryPatch(){return t=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...r){if(Sg())return t.apply(this,r);let i=r[0],o=typeof i=="string",s=cU(i),c=o?{text:i,values:Array.isArray(r[1])?r[1]:void 0}:s?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(r[1])?r[1]:void 0)}:void 0,a=oU.call(this,c);if(r.length>0){let p=Q();if(typeof r[r.length-1]=="function")r[r.length-1]=CI(a,r[r.length-1]),p&&(r[r.length-1]=Tg(p,r[r.length-1]));else if(typeof c?.callback=="function"){let u=CI(a,c.callback);p&&(u=Tg(p,u)),r[0].callback=u}}let l;try{l=t.apply(this,r)}catch(p){throw a.setStatus({code:2,message:Eg(p)}),a.end(),p}return l instanceof Promise?l.then(p=>(a.end(),p)).catch(p=>(a.setStatus({code:2,message:Eg(p)}),a.end(),Promise.reject(p))):l})}_getPoolConnectPatch(){let t=this;return n=>function(i){if(Sg()||t.getConfig().ignoreConnectSpans)return n.call(this,i);let o=L({name:Ls.POOL_CONNECT,kind:D.CLIENT,attributes:iU(this.options)}),s=i;if(s){let a=Q();s=sU(o,s),a&&(s=Tg(a,s))}let c=se(o,()=>n.call(this,s));return lU(o,c)}}};function lU(e,t){return t instanceof Promise?t.then(r=>(e.end(),r)).catch(r=>(e.setStatus({code:2,message:Eg(r)}),e.end(),Promise.reject(r))):t}var pU="Postgres",xI=fe(pU,Ig,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),az=(e=>({name:pU,setupOnce(){xI(e)}})),PI=az;var LI="PostgresJs",uU=[">=3.0.0 <4"],cz="db.response.status_code",lz=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,pz=Symbol.for("sentry.query.from.instrumented.sql"),MI=fe(LI,e=>new kI({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),kI=class extends le{constructor(t){super("sentry-postgres-js",q,t)}init(){let t=new re("postgres",uU,n=>{try{return this._patchPostgres(n)}catch(r){return je&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{t.files.push(new Re(`postgres/${n}/query.js`,uU,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),t}_patchPostgres(t){let n=typeof t=="function",r=n?t:t.default;if(typeof r!="function")return je&&g.warn("postgres module does not export a function. Skipping instrumentation."),t;let i=this,o=function(...s){let c=Reflect.construct(r,s);if(!c||typeof c!="function")return je&&g.warn("postgres() did not return a valid instance"),c;let a=i.getConfig();return NS(c,{requireParentSpan:a.requireParentSpan,requestHook:a.requestHook})};Object.setPrototypeOf(o,r),Object.setPrototypeOf(o.prototype,r.prototype);for(let s of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(s)){let c=Object.getOwnPropertyDescriptor(r,s);c&&Object.defineProperty(o,s,c)}return n?o:(tp(t,"default",o),t)}_shouldCreateSpans(){let t=this.getConfig();return de.getSpan(ce.active())!==void 0||!t.requireParentSpan}_setOperationName(t,n,r){if(r){t.setAttribute(pr,r);return}let i=n?.match(lz);i?.[1]&&t.setAttribute(pr,i[1].toUpperCase())}_reconstructQuery(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((n,r,i)=>i===0?r:`${n}$${i}${r}`,"")}_sanitizeSqlQuery(t){return t?t.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(t){let n=this,r=t.Query.prototype.handle;return t.Query.prototype.handle=async function(...i){if(this.executed||this[pz])return r.apply(this,i);if(!n._shouldCreateSpans())return r.apply(this,i);let o=n._reconstructQuery(this.strings),s=n._sanitizeSqlQuery(o);return Le({name:s||"postgresjs.query",op:"db"},c=>{iT(c,"auto.db.postgresjs"),c.setAttributes({[dt]:"postgres",[Gr]:s});let a=n.getConfig(),{requestHook:l}=a;l&&ei(()=>l(c,s,void 0),d=>{d&&(c.setAttribute("sentry.hook.error","requestHook failed"),je&&g.error(`Error in requestHook for ${LI} integration:`,d))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(d,m,_)=>{try{n._setOperationName(c,s,_?.[0]?.command),c.end()}catch(h){je&&g.error("Error ending span in resolve callback:",h)}return Reflect.apply(d,m,_)}});let u=this.reject;this.reject=new Proxy(u,{apply:(d,m,_)=>{try{c.setStatus({code:2,message:_?.[0]?.message||"unknown_error"}),c.setAttribute(cz,_?.[0]?.code||"unknown"),c.setAttribute(Ur,_?.[0]?.name||"unknown"),n._setOperationName(c,s),c.end()}catch(h){je&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(d,m,_)}});try{return r.apply(this,i)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})},t.Query.prototype.handle.__sentry_original__=r,t}_unpatchQueryPrototype(t){return t.Query.prototype.handle.__sentry_original__&&(t.Query.prototype.handle=t.Query.prototype.handle.__sentry_original__),t}},uz=(e=>({name:LI,setupOnce(){MI(e)}})),wI=uz;var Gn=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(Gn||{});var dU="@hapi/hapi",Jp=Symbol("hapi-handler-patched"),zp={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},mU=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"]);function fU(e){return e.name?e.name:e.pkg.name}var Ag=e=>typeof e=="string"&&mU.has(e),gU=e=>{let t=e?.type;return t!==void 0&&Ag(t)},_U=e=>Array.isArray(e)&&e.length<=3&&Ag(e[0])&&typeof e[1]=="function",hU=e=>!Array.isArray(e),bU=(e,t)=>{let n={[Fe]:e.path,[Hr]:e.method},r;return t?(n[Gn.HAPI_TYPE]=zp.PLUGIN,n[Gn.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[Gn.HAPI_TYPE]=zp.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},yU=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[Gn.EXT_TYPE]:e,[Gn.HAPI_TYPE]:zp.EXT,[Gn.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[Gn.EXT_TYPE]:e,[Gn.HAPI_TYPE]:zp.EXT},name:r}},GI=e=>"plugin"in e?"plugin"in e.plugin?e.plugin.plugin:e.plugin:e;var dz="@sentry/instrumentation-hapi",Ng=class extends le{constructor(t={}){super(dz,q,t)}init(){return new re(dU,[">=17.0.0 <22"],t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;return w(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),w(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;this._massUnwrap([n],["server","Server"])})}_getServerPatch(t){let n=this,r=this;return function(o){let s=t.apply(this,[o]);return r._wrap(s,"route",c=>n._getServerRoutePatch.bind(n)(c)),r._wrap(s,"ext",c=>n._getServerExtPatch.bind(n)(c)),r._wrap(s,"register",n._getServerRegisterPatch.bind(n)),s}}_getServerRegisterPatch(t){let n=this;return function(i,o){if(Array.isArray(i))for(let s of i){let c=GI(s);n._wrapRegisterHandler(c)}else{let s=GI(i);n._wrapRegisterHandler(s)}return t.apply(this,[i,o])}}_getServerExtPatch(t,n){let r=this;return function(...o){if(Array.isArray(o[0])){let s=o[0];for(let c=0;c<s.length;c++){let a=s[c];if(Ag(a.type)){let l=a,p=r._wrapExtMethods(l.method,a.type,n);l.method=p,s[c]=l}}return t.apply(this,o)}else if(_U(o)){let s=o,c=s[1],a=r._wrapExtMethods(c,s[0],n);return t.apply(this,[s[0],a,s[2]])}else if(gU(o[0])){let s=o[0],c=r._wrapExtMethods(s.method,s.type,n);return s.method=c,t.call(this,s)}return t.apply(this,o)}}_getServerRoutePatch(t,n){let r=this;return function(i){if(Array.isArray(i))for(let o=0;o<i.length;o++){let s=r._wrapRouteHandler.call(r,i[o],n);i[o]=s}else i=r._wrapRouteHandler.call(r,i,n);return t.apply(this,[i])}}_wrapRegisterHandler(t){let n=this,r=fU(t),i=t.register,o=this,s=function(c,a){return o._wrap(c,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),o._wrap(c,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),i.call(this,c,a)};t.register=s}_wrapExtMethods(t,n,r){let i=this;if(t instanceof Array){for(let o=0;o<t.length;o++)t[o]=i._wrapExtMethods(t[o],n);return t}else if(hU(t))return t[Jp]===!0?t:(t[Jp]=!0,function(...s){if(de.getSpan(ce.active())===void 0)return t.apply(this,s);let c=yU(n,r,t.name);return Se({name:c.name,op:`${c.attributes[Gn.HAPI_TYPE]}.hapi`,attributes:{...c.attributes,[S]:"auto.http.otel.hapi"}},()=>t.apply(void 0,s))});return t}_wrapRouteHandler(t,n){if(t[Jp]===!0)return t;t[Jp]=!0;let r=i=>function(...o){if(de.getSpan(ce.active())===void 0)return i.call(this,...o);si(t.path);let s=bU(t,n);return Se({name:s.name,op:`${s.attributes[Gn.HAPI_TYPE]}.hapi`,attributes:{...s.attributes,[S]:"auto.http.otel.hapi"}},()=>i.call(this,...o))};if(typeof t.handler=="function")t.handler=r(t.handler);else if(typeof t.options=="function"){let i=t.options;t.options=function(o){let s=i(o);return typeof s.handler=="function"&&(s.handler=r(s.handler)),s}}else typeof t.options?.handler=="function"&&(t.options.handler=r(t.options.handler));return t}};var SU="Hapi",Rg=fe(SU,()=>new Ng),mz=(()=>({name:SU,setupOnce(){Rg()}})),UI=mz;function fz(e){return!!(e&&typeof e=="object"&&"error"in e&&e.error)}function gz(e){ge(e,{mechanism:{type:"auto.function.hapi",handled:!1}})}var _z={name:"SentryHapiErrorPlugin",version:q,register:async function(e){e.events.on({name:"request",channels:["error"]},(n,r)=>{if($()!==vt()){let i=n.route;i.path&&$().setTransactionName(`${i.method.toUpperCase()} ${i.path}`)}else je&&g.warn("Isolation scope is still the default isolation scope - skipping setting transactionName");fz(r)&&gz(r.error)})}};async function hz(e){await e.register(_z),Sr(e.register,"hapi")}var vo={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},eu={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};var bz="@sentry/instrumentation-hono",yz="0.0.1",vg=class extends le{constructor(t={}){super(bz,yz,t)}init(){return[new re("hono",[">=4.0.0 <5"],t=>this._patch(t))]}_patch(t){let n=this;class r extends t.Hono{constructor(...o){super(...o),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{t.Hono=r}catch{return{...t,Hono:r}}return t}_patchHandler(){let t=this;return function(n){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return n.apply(this,[o]);let s=i.slice(1);return n.apply(this,[o,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,i.map(o=>t._wrapHandler(o)))}}}_patchOnHandler(){let t=this;return function(n){return function(...i){let o=i.slice(2);return n.apply(this,[...i.slice(0,2),...o.map(s=>t._wrapHandler(s))])}}}_patchMiddlewareHandler(){let t=this;return function(n){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return n.apply(this,[o]);let s=i.slice(1);return n.apply(this,[o,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,i.map(o=>t._wrapHandler(o)))}}}_wrapHandler(t){let n=this;return function(r,i){if(!n.isEnabled())return t.apply(this,[r,i]);let o=r.req.path,s=n.tracer.startSpan(o);return ce.with(de.setSpan(ce.active(),s),()=>n._safeExecute(()=>{let c=t.apply(this,[r,i]);if(bt(c))return c.then(a=>{let l=n._determineHandlerType(a);return s.setAttributes({[vo.HONO_TYPE]:l,[vo.HONO_NAME]:l===eu.REQUEST_HANDLER?o:t.name||"anonymous"}),n.getConfig().responseHook?.(s),a});{let a=n._determineHandlerType(c);return s.setAttributes({[vo.HONO_TYPE]:a,[vo.HONO_NAME]:a===eu.REQUEST_HANDLER?o:t.name||"anonymous"}),n.getConfig().responseHook?.(s),c}},()=>s.end(),c=>{n._handleError(s,c),s.end()}))}}_safeExecute(t,n,r){try{let i=t();return bt(i)?i.then(()=>n(),o=>r(o)):n(),i}catch(i){throw r(i),i}}_determineHandlerType(t){return t===void 0?eu.MIDDLEWARE:eu.REQUEST_HANDLER}_handleError(t,n){n instanceof Error&&(t.setStatus({code:Lt.ERROR,message:n.message}),t.recordException(n))}};var EU="Hono";function Sz(e){let t=oe(e).data,n=t[vo.HONO_TYPE];if(t[H]||!n)return;e.setAttributes({[S]:"auto.http.otel.hono",[H]:`${n}.hono`});let r=t[vo.HONO_NAME];if(typeof r=="string"&&e.updateName(r),$()===vt()){je&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=t[Fe],o=t[Fr];typeof i=="string"&&typeof o=="string"&&$().setTransactionName(`${o} ${i}`)}var DI=fe(EU,()=>new vg({responseHook:e=>{Sz(e)}})),Ez=(()=>({name:EU,setupOnce(){DI()}})),BI=Ez;function Tz(){return async function(t,n){let r=as(t.req);$().setSDKProcessingMetadata({normalizedRequest:r}),await n()}}function Iz(e){return e.res.status>=500}function Az(e){return async function(n,r){await r(),(e?.shouldHandleError||Iz)(n)&&(n.res.sentry=ge(n.error,{mechanism:{type:"auto.middleware.hono",handled:!1}}))}}function Nz(e,t){e.use(Tz()),e.use(Az(t)),Sr(e.use,"hono")}var Ms=(e=>(e.ROUTER="router",e.MIDDLEWARE="middleware",e))(Ms||{});var Oo=(e=>(e.KOA_TYPE="koa.type",e.KOA_NAME="koa.name",e))(Oo||{});var TU=(e,t,n,r)=>n?{attributes:{[Oo.KOA_NAME]:r?.toString(),[Oo.KOA_TYPE]:Ms.ROUTER,[Fe]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[Oo.KOA_NAME]:t.name??"middleware",[Oo.KOA_TYPE]:Ms.MIDDLEWARE,[ed]:t.name??"middleware"},name:`middleware - ${t.name}`},IU=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e));var HI=Symbol("koa-layer-patched");var Rz="@sentry/instrumentation-koa",Og=class extends le{constructor(t={}){super(Rz,q,t)}init(){return new re("koa",[">=2.0.0 <4"],t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;return n==null?n:(w(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),t)},t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;n&&w(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(t){let n=this._patchRouterDispatch.bind(this),r=this._patchLayer.bind(this);return function(o){let s=o.router?n(o):r(o,!1);return t.apply(this,[s])}}_patchRouterDispatch(t){let r=t.router?.stack??[];for(let i of r){let o=i.path,s=i.stack;for(let c=0;c<s.length;c++){let a=s[c];s[c]=this._patchLayer(a,!0,o)}}return t}_patchLayer(t,n,r){let i=n?Ms.ROUTER:Ms.MIDDLEWARE;return t[HI]===!0||IU(i,this.getConfig())||t.constructor.name==="GeneratorFunction"||t.constructor.name==="AsyncGeneratorFunction"?t:(t[HI]=!0,(o,s)=>{if(de.getSpan(ce.active())===void 0)return t(o,s);let a=TU(o,t,n,r);o._matchedRoute&&si(o._matchedRoute.toString());let l=a.attributes[Oo.KOA_NAME],p=typeof l=="string"?l||"< unknown >":a.name;return Se({name:p,op:`${i}.koa`,attributes:{...a.attributes,[S]:"auto.http.otel.koa"}},()=>{let u=a.attributes[Fe];if($()===vt())je&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");else if(u){let d=o.request?.method?.toUpperCase()||"GET";$().setTransactionName(`${d} ${u}`)}return t(o,s)})})}};var AU="Koa",FI=fe(AU,Og,(e={})=>({ignoreLayersType:e.ignoreLayersType})),vz=((e={})=>({name:AU,setupOnce(){FI(e)}})),WI=vz,Oz=e=>{e.use(async(t,n)=>{try{await n()}catch(r){throw ge(r,{mechanism:{handled:!1,type:"auto.middleware.koa"}}),r}}),Sr(e.use,"koa")};var Cg=(e=>(e.CONNECT_TYPE="connect.type",e.CONNECT_NAME="connect.name",e))(Cg||{}),xg=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(xg||{});var Wi=Symbol("opentelemetry.instrumentation-connect.request-route-stack");var NU=e=>{Array.isArray(e[Wi])===!1&&Object.defineProperty(e,Wi,{enumerable:!1,value:[]}),e[Wi].push("/");let t=e[Wi].length;return()=>{t===e[Wi].length?e[Wi].pop():je&&g.warn("Connect: Trying to pop the stack multiple time")}},RU=(e,t)=>{t&&e[Wi].splice(-1,1,t)},vU=e=>e[Wi].reduce((t,n)=>t.replace(/\/+$/,"")+n);var Cz="@sentry/instrumentation-connect",xz="anonymous",Pg=class extends le{constructor(t={}){super(Cz,q,t)}init(){return[new re("connect",[">=3.0.0 <4"],t=>this._patchConstructor(t))]}_patchApp(t){w(t.use)||this._wrap(t,"use",this._patchUse.bind(this)),w(t.handle)||this._wrap(t,"handle",this._patchHandle.bind(this))}_patchConstructor(t){let n=this._patchApp.bind(this);return function(...r){let i=Reflect.apply(t,this,r);return n(i),i}}_patchNext(t,n,r){return function(o){ze(o)&&n.setStatus({code:2,message:"internal_error"});let s=t.apply(this,[o]);return r(),s}}_startSpan(t,n){let r=t?xg.REQUEST_HANDLER:xg.MIDDLEWARE,i=t||n.name||xz;return L({name:i,op:`${r}.connect`,attributes:{[S]:"auto.http.otel.connect",[Fe]:t.length>0?t:"/",[Cg.CONNECT_TYPE]:r,[Cg.CONNECT_NAME]:i}})}_patchMiddleware(t,n){let r=this.isEnabled.bind(this),i=this._startSpan.bind(this),o=this._patchNext.bind(this),s=n.length===4;function c(){if(!r())return Reflect.apply(n,this,arguments);let[a,l,p]=s?[1,2,3]:[0,1,2],u=arguments[a],d=arguments[l],m=arguments[p];RU(u,t),t&&si(vU(u));let _=i(t,n),h=!1;function b(){h||(h=!0,_.end()),d.removeListener("close",b)}d.addListener("close",b),arguments[p]=o(m,_,b);try{return Reflect.apply(n,this,arguments)}catch(v){throw _.setStatus({code:2,message:"internal_error"}),b(),v}}return Object.defineProperty(c,"length",{value:n.length,writable:!1,configurable:!0}),c}_patchUse(t){let n=this._patchMiddleware.bind(this);return function(...r){let i=r[r.length-1],o=r[r.length-2]||"";return r[r.length-1]=n(o,i),t.apply(this,r)}}_patchHandle(t){let n=this._patchOut.bind(this);return function(){let[r,i]=[0,2],o=arguments[r],s=arguments[i],c=NU(o);return typeof s=="function"&&(arguments[i]=n(s,c)),Reflect.apply(t,this,arguments)}}_patchOut(t,n){return function(...i){return n(),Reflect.apply(t,this,i)}}};var OU="Connect",VI=fe(OU,()=>new Pg),Pz=(()=>({name:OU,setupOnce(){VI()}})),YI=Pz;function kz(e,t,n,r){ge(e,{mechanism:{handled:!1,type:"auto.middleware.connect"}}),r(e)}var Lz=e=>{e.use(kz),Sr(e.use,"connect")};var CU="db.sql.table",xU="sqlite",PU="postgresql";var kU=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>"},Mz=new Map([["sqlite3",xU],["pg",PU]]),LU=e=>Mz.get(e)||e,MU=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,wU=(e,t)=>typeof e=="string"&&typeof t=="number"&&0<t&&t<e.length?`${e.substring(0,t)}..`:e,GU=e=>{if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}},UU=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},DU=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},jI=e=>{let t=e?._single?.table;return typeof t=="object"?jI(t):t};var wz="@sentry/instrumentation-knex",Gz="auto.db.otel.knex",Uz="knex",ZI=[">=0.22.0 <4",">=0.10.0 <0.18.0",">=0.19.0 <0.22.0",">=0.18.0 <0.19.0"],Dz=1022,BU=Symbol("sentry.instrumentation-knex.parent-span"),kg=class extends le{constructor(t={}){super(wz,q,t)}init(){let t=new re(Uz,ZI);return t.files.push(this._getClientNodeModuleFileInstrumentation("src"),this._getClientNodeModuleFileInstrumentation("lib"),this._getRunnerNodeModuleFileInstrumentation("src"),this._getRunnerNodeModuleFileInstrumentation("lib"),this._getRunnerNodeModuleFileInstrumentation("lib/execution")),t}_getRunnerNodeModuleFileInstrumentation(t){return new Re(`knex/${t}/runner.js`,ZI,(n,r)=>(this._ensureWrapped(n.prototype,"query",this._createQueryWrapper(r)),n),n=>(this._unwrap(n.prototype,"query"),n))}_getClientNodeModuleFileInstrumentation(t){return new Re(`knex/${t}/client.js`,ZI,n=>(this._ensureWrapped(n.prototype,"queryBuilder",this._storeContext.bind(this)),this._ensureWrapped(n.prototype,"schemaBuilder",this._storeContext.bind(this)),this._ensureWrapped(n.prototype,"raw",this._storeContext.bind(this)),n),n=>(this._unwrap(n.prototype,"queryBuilder"),this._unwrap(n.prototype,"schemaBuilder"),this._unwrap(n.prototype,"raw"),n))}_createQueryWrapper(t){return function(r){return function(o){let s=this.client.config,c=jI(this.builder),a=o?.method,l=s?.connection?.connectionString,p=s?.connection?.filename||s?.connection?.database||GU(l),u={[S]:Gz,"knex.version":t,[ke]:LU(this.client.driverName),[CU]:c,[da]:a,[Ut]:s?.connection?.user,[Et]:p,[Me]:s?.connection?.host??UU(l),[Pe]:s?.connection?.port??DU(l),[ba]:s?.connection?.filename===":memory:"?"inproc":void 0,[Ye]:wU(o?.sql,Dz)},d=this.builder[BU]||Q(),m=arguments;return Se({name:MU(p,a,c),kind:D.CLIENT,attributes:u,parentSpan:d,onlyIfParent:!0},_=>r.apply(this,m).catch(h=>{let v=kU(this)(o.sql,o.bindings||[]),M=h.message.replace(`${v} - `,"");throw _.setStatus({code:2,message:M}),h}))}}}_storeContext(t){return function(){let r=t.apply(this,arguments);return Object.defineProperty(r,BU,{value:Q()}),r}}_ensureWrapped(t,n,r){w(t[n])&&this._unwrap(t,n),this._wrap(t,n,r)}};import*as qn from"diagnostics_channel";var Bz="sentrySubscribeOrchestrionChannel";function _e(e){let t=new Set,n=[];for(let{module:r}of e){let i=`${r.name}\0${r.versionRange}\0${String(r.filePath)}`;t.has(i)||(t.add(i),n.push({channelName:r.name,module:r,astQuery:"Program",transform:Bz}))}return n}var li={name:"amqplib",versionRange:">=0.5.5 <2"},XI=[{channelName:"publish",module:{...li,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"publish",kind:"Sync"}},{channelName:"confirmPublish",module:{...li,filePath:"lib/channel_model.js"},functionQuery:{className:"ConfirmChannel",methodName:"publish",kind:"Callback"}},{channelName:"consume",module:{...li,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"consume",kind:"Async"}},{channelName:"dispatch",module:{...li,filePath:"lib/channel.js"},functionQuery:{className:"BaseChannel",methodName:"dispatchMessage",kind:"Sync"}},{channelName:"ack",module:{...li,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ack",kind:"Sync"}},{channelName:"nack",module:{...li,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nack",kind:"Sync"}},{channelName:"reject",module:{...li,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"reject",kind:"Sync"}},{channelName:"ackAll",module:{...li,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ackAll",kind:"Sync"}},{channelName:"nackAll",module:{...li,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nackAll",kind:"Sync"}},{channelName:"connect",module:{...li,filePath:"lib/connect.js"},functionQuery:{functionName:"connect",kind:"Callback"}}],HU={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"},FU=_e(XI);var KI=[...["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"}}))],WU={ANTHROPIC_CHAT:"orchestrion:@anthropic-ai/sdk:chat",ANTHROPIC_MODELS:"orchestrion:@anthropic-ai/sdk:models",ANTHROPIC_MESSAGES_STREAM:"orchestrion:@anthropic-ai/sdk:messages-stream"},VU=_e(KI);var qI=[{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"}}],YU={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"},jU=_e(qI);var Ac={name:"dataloader",versionRange:">=2.0.0 <3",filePath:"index.js"},QI=[{channelName:"construct",module:Ac,functionQuery:{functionName:"DataLoader",kind:"Sync"}},{channelName:"load",module:Ac,functionQuery:{expressionName:"load",kind:"Async"}},{channelName:"loadMany",module:Ac,functionQuery:{expressionName:"loadMany",kind:"Async"}},{channelName:"prime",module:Ac,functionQuery:{expressionName:"prime",kind:"Sync"}},{channelName:"clear",module:Ac,functionQuery:{expressionName:"clear",kind:"Sync"}},{channelName:"clearAll",module:Ac,functionQuery:{expressionName:"clearAll",kind:"Sync"}}],ZU={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"},XU=_e(QI);var $I=[{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"}}],KU={EXPRESS_HANDLE:"orchestrion:express:handle",ROUTER_HANDLE:"orchestrion:router:handle",EXPRESS_REGISTER:"orchestrion:express:register",ROUTER_REGISTER:"orchestrion:router:register"},qU=_e($I);var Hz=">=3.0.0 <5",Fz=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,Wz=[{functionName:"addDoc",channelName:"add-doc"},{functionName:"getDocs",channelName:"get-docs"},{functionName:"setDoc",channelName:"set-doc"},{functionName:"deleteDoc",channelName:"delete-doc"}],Vz=">=6.0.0 <7",Yz=[{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"}],JI=[...Wz.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:"@firebase/firestore",versionRange:Hz,filePath:Fz},functionQuery:{functionName:e,kind:"Auto"}})),...Yz.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:"firebase-functions",versionRange:Vz,filePath:e},functionQuery:{functionName:t,kind:"Sync"}}))],QU={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"},$U=_e(JI);var zI=[{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"}}],JU={GENERIC_POOL_ACQUIRE:"orchestrion:generic-pool:acquire"},zU=_e(zI);var eA=["dist/node/index.js","dist/node/index.mjs","dist/node/index.cjs"],tA=[...eA.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"}}))),...eA.map(e=>({channelName:"embed-content",module:{name:"@google/genai",versionRange:">=0.10.0 <2",filePath:e},functionQuery:{className:"Models",methodName:"embedContent",kind:"Auto"}})),...eA.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"}})))],eD={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"},tD=_e(tA);var nA=[{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"}}],nD={GRAPHQL_PARSE:"orchestrion:graphql:parse",GRAPHQL_VALIDATE:"orchestrion:graphql:validate",GRAPHQL_EXECUTE:"orchestrion:graphql:execute"},rD=_e(nA);var rA=[{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"}}],iD={HAPI_ROUTE:"orchestrion:@hapi/hapi:route",HAPI_EXT:"orchestrion:@hapi/hapi:ext"},oD=_e(rA);var iA=[...["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"}}],sD={IOREDIS_COMMAND:"orchestrion:ioredis:command",IOREDIS_CONNECT:"orchestrion:ioredis:connect"},aD=_e(iA);var oA=[{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"}}],cD={KAFKAJS_SEND_BATCH:"orchestrion:kafkajs:send_batch",KAFKAJS_CONSUMER_RUN:"orchestrion:kafkajs:consumer_run"},lD=_e(oA);var pD="knex",jz=[{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"}],Zz=[{filePath:"lib/client.js",versionRange:">=0.10.0 <4"},{filePath:"src/client.js",versionRange:">=0.18.0 <0.19.0"}],Xz=["queryBuilder","schemaBuilder","raw"];function Kz(e,t){return{channelName:"query",module:{name:pD,versionRange:t,filePath:e},functionQuery:{className:"Runner",methodName:"query",kind:"Async"}}}function qz(e,t,n){return{channelName:e,module:{name:pD,versionRange:n,filePath:t},functionQuery:{className:"Client",methodName:e,kind:"Sync"}}}var sA=[...jz.map(({filePath:e,versionRange:t})=>Kz(e,t)),...Zz.flatMap(({filePath:e,versionRange:t})=>Xz.map(n=>qz(n,e,t)))],uD={KNEX_QUERY:"orchestrion:knex:query",KNEX_QUERY_BUILDER:"orchestrion:knex:queryBuilder",KNEX_SCHEMA_BUILDER:"orchestrion:knex:schemaBuilder",KNEX_RAW:"orchestrion:knex:raw"},dD=_e(sA);var aA=[{channelName:"use",module:{name:"koa",versionRange:">=2.0.0 <4",filePath:"lib/application.js"},functionQuery:{className:"Application",methodName:"use",kind:"Sync"}}],mD={KOA_USE:"orchestrion:koa:use"},fD=_e(aA);var Qz=["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"}}]}),cA="embedQuery",Lg="embedDocuments",gD=[{name:"@langchain/openai",versionRange:">=0.1.0 <2.0.0",methods:[cA,Lg]},{name:"@langchain/google-genai",versionRange:">=0.1.0 <3.0.0",methods:[cA,Lg]},{name:"@langchain/mistralai",versionRange:">=0.1.0 <2.0.0",methods:[cA,Lg]},{name:"@langchain/google-common",versionRange:">=0.1.0 <3.0.0",methods:[Lg]}],$z=gD.flatMap(({name:e,versionRange:t,methods:n})=>["dist/embeddings.cjs","dist/embeddings.js"].flatMap(r=>n.map(i=>({channelName:i,module:{name:e,versionRange:t,filePath:r},functionQuery:{methodName:i,kind:"Async"}})))),lA=[...Qz,...$z],_D=gD.flatMap(({name:e,methods:t})=>t.map(n=>`orchestrion:${e}:${n}`)),hD={LANGCHAIN_CHAT_MODEL_INVOKE:"orchestrion:@langchain/core:chatModelInvoke",LANGCHAIN_CHAT_MODEL_STREAM:"orchestrion:@langchain/core:chatModelStream"},bD=_e(lA);var yD=e=>({name:"@langchain/langgraph",versionRange:">=0.0.0 <2.0.0",filePath:e}),Jz=["dist/graph/state.cjs","dist/graph/state.js"].map(e=>({channelName:"stateGraphCompile",module:yD(e),functionQuery:{className:"StateGraph",methodName:"compile",kind:"Sync"}})),zz=["dist/prebuilt/react_agent_executor.cjs","dist/prebuilt/react_agent_executor.js"].map(e=>({channelName:"createReactAgent",module:yD(e),functionQuery:{functionName:"createReactAgent",kind:"Sync"}})),pA=[...Jz,...zz],SD={LANGGRAPH_STATE_GRAPH_COMPILE:"orchestrion:@langchain/langgraph:stateGraphCompile",LANGGRAPH_CREATE_REACT_AGENT:"orchestrion:@langchain/langgraph:createReactAgent"},ED=_e(pA);var uA=[{channelName:"load",module:{name:"lru-memoizer",versionRange:">=2.1.0 <4",filePath:"lib/async.js"},functionQuery:{functionName:"memoizedFunction",kind:"Callback"}}],TD={LRU_MEMOIZER_LOAD:"orchestrion:lru-memoizer:load"},ID=_e(uA);var ws={name:"mongodb"},dA=[{channelName:"command",module:{...ws,versionRange:">=6.4.0 <8",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Async"}},{channelName:"command",module:{...ws,versionRange:">=4.0.0 <6.4",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Callback"}},{channelName:"checkout",module:{...ws,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:{...ws,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/index.js"},functionQuery:{expressionName:e,kind:"Callback"}})),{channelName:"v3_command",module:{...ws,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/command.js"},functionQuery:{functionName:"command",kind:"Callback"}},{channelName:"v3_query",module:{...ws,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/query.js"},functionQuery:{functionName:"query",kind:"Callback"}},{channelName:"v3_get_more",module:{...ws,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/get_more.js"},functionQuery:{functionName:"getMore",kind:"Callback"}}],AD={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"},ND=_e(dA);var Co={name:"mongoose",versionRange:">=5.9.7 <9.7.0"},RD=["find","findOne","deleteOne","deleteMany","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace","remove","count","findOneAndRemove"],mA=[{channelName:"query_exec",module:{...Co,filePath:"lib/query.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"aggregate_exec",module:{...Co,filePath:"lib/aggregate.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"model_save",module:{...Co,filePath:"lib/model.js"},functionQuery:{expressionName:"save",kind:"Auto"}},{channelName:"model_insert_many",module:{...Co,filePath:"lib/model.js"},functionQuery:{expressionName:"insertMany",kind:"Auto"}},{channelName:"model_bulk_write",module:{...Co,filePath:"lib/model.js"},functionQuery:{expressionName:"bulkWrite",kind:"Auto"}},{channelName:"model_remove",module:{...Co,filePath:"lib/model.js"},functionQuery:{expressionName:"remove",kind:"Auto"}},{channelName:"model_aggregate",module:{...Co,filePath:"lib/model.js"},functionQuery:{expressionName:"aggregate",kind:"Sync"}},...RD.map(e=>({channelName:`ctx_${e}`,module:{...Co,filePath:"lib/query.js"},functionQuery:{expressionName:e,kind:"Sync"}}))],vD={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"},OD=RD.map(e=>`orchestrion:mongoose:ctx_${e}`),CD=_e(mA);var fA=[{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"}}],xD={MYSQL2_QUERY:"orchestrion:mysql2:query",MYSQL2_EXECUTE:"orchestrion:mysql2:execute"},PD=_e(fA);var gA=[{channelName:"query",module:{name:"mysql",versionRange:">=2.0.0 <3",filePath:"lib/Connection.js"},functionQuery:{expressionName:"query",kind:"Auto"}}],kD={MYSQL_QUERY:"orchestrion:mysql:query"},LD=_e(gA);var _A=[{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"}},{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"}},{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"}}],MD={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"},wD=_e(_A);var hA=[...["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"}}))],GD={OPENAI_CHAT:"orchestrion:openai:chat",OPENAI_EMBEDDINGS:"orchestrion:openai:embeddings"},UD=_e(hA);var bA=[{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"}}],DD={PG_QUERY:"orchestrion:pg:query",PG_CONNECT:"orchestrion:pg:connect",PGPOOL_CONNECT:"orchestrion:pg-pool:connect"},BD=_e(bA);var e7=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"}}],yA=["src","cjs/src"].flatMap(e7),HD={POSTGRESJS_HANDLE:"orchestrion:postgres:handle",POSTGRESJS_CONNECTION:"orchestrion:postgres:connection",POSTGRESJS_EXECUTE:"orchestrion:postgres:execute",POSTGRESJS_CONNECT:"orchestrion:postgres:connect"},FD=_e(yA);var SA=[{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"}}],WD={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"},VD=_e(SA);var t7=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"}}],EA=["dist","dist/esm"].flatMap(t7),YD={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"},jD=_e(EA);var n7="tedious",r7="lib/connection.js",i7=">=1.11.0 <20",o7=["connect","execSql","execSqlBatch","callProcedure","execBulkLoad","prepare","execute"],TA=o7.map(e=>({channelName:e,module:{name:n7,versionRange:i7,filePath:r7},functionQuery:{className:"Connection",methodName:e,kind:"Sync"}})),ZD={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"},XD=_e(TA);var IA=[...Gs(">=4.0.0 <7.0.0","generateText","generateText","Async"),...Gs(">=4.0.0 <7.0.0","streamText","streamText","Sync"),...Gs(">=4.0.0 <7.0.0","generateObject","generateObject","Async"),...Gs(">=4.0.0 <7.0.0","embed","embed","Async"),...Gs(">=4.0.0 <7.0.0","embedMany","embedMany","Async"),...Gs(">=5.0.0 <7.0.0","resolveLanguageModel","resolveLanguageModel","Sync"),...Gs(">=6.0.0 <7.0.0","executeToolCall","executeToolCall","Async")],KD={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 Gs(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 qD=_e(IA);var A={...HU,...WU,...YU,...ZU,...KU,...QU,...JU,...eD,...nD,...iD,...sD,...cD,...uD,...mD,...hD,...SD,...TD,...AD,...vD,...xD,...kD,...MD,...GD,...DD,...HD,...WD,...YD,...ZD,...KD};var s7="Amqplib",a7="auto.amqplib.orchestrion.publisher",c7="auto.amqplib.orchestrion.consumer",l7="messaging.operation",iB="messaging.destination",oB="messaging.destination_kind",sB="messaging.rabbitmq.routing_key",QD="messaging.protocol",p7="messaging.protocol_version",u7="messaging.url",aB="messaging.message_id",cB="messaging.conversation_id",lB="messaging.rabbitmq.destination.routing_key",pB="messaging.message.conversation_id",uB="topic",$D="process",d7="send",dB=1e3*60,Qn={Ack:"ack",AckAll:"ackAll",Reject:"reject",Nack:"nack",NackAll:"nackAll",ChannelClosed:"channel closed",ChannelError:"channel error",InstrumentationTimeout:"instrumentation timeout"},NA=Symbol("sentry.amqplib.message.stored-span"),Us=Symbol("sentry.amqplib.channel.spans-not-ended"),RA=Symbol("sentry.amqplib.channel.consume-timeout-timer"),OA=Symbol("sentry.amqplib.channel.consumer-info"),vA=Symbol("sentry.amqplib.channel.is-confirm-publishing"),mB=Symbol("sentry.amqplib.connection.attributes"),fB=()=>{},JD=!1,m7=(()=>({name:s7,setupOnce(){!qn.tracingChannel||JD||(JD=!0,J&&g.log("[orchestrion:amqplib] subscribing to amqplib tracing channels"),me(()=>{y7(),f7(),g7(),_7(),h7(),b7()}))}}));function f7(){ee(qn.tracingChannel(A.AMQPLIB_PUBLISH),e=>{if(!e.self?.[vA])return _B(e)})}function g7(){let e=qn.tracingChannel(A.AMQPLIB_CONFIRM_PUBLISH);ee(e,t=>(t.self&&(t.self[vA]=!0),_B(t))),e.end.subscribe(t=>{let n=t.self;n&&(n[vA]=!1)})}function _7(){let e=qn.tracingChannel(A.AMQPLIB_CONSUME);e.start.subscribe(fB),e.asyncEnd.subscribe(t=>{let n=t,r=n.self,o=n.result?.consumerTag;if(!r||!o)return;gB(r);let s=n.arguments[0],c=typeof s=="string"?s:"<unknown>",a=n.arguments[2];r[OA]?.set(o,{noAck:!!a?.noAck,queue:c})})}function h7(){ee(qn.tracingChannel(A.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;gB(t);let i=n?.consumerTag?t[OA]?.get(n.consumerTag):void 0,o=i?.queue??r.fields?.routingKey??"<unknown>",s=i?.noAck??!1,c=r.properties?.headers,a=rB(c,"sentry-trace"),l=rB(c,"baggage"),p=vn({sentryTrace:a,baggage:l},()=>E7(o,r,t));return s||(t[Us]?.push({msg:r,timeOfConsume:lt()}),r[NA]=p),e._sentryNoAck=s,p},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function b7(){qn.tracingChannel(A.AMQPLIB_ACK).start.subscribe(e=>AA(e,!1,Qn.Ack)),qn.tracingChannel(A.AMQPLIB_NACK).start.subscribe(e=>AA(e,!0,Qn.Nack)),qn.tracingChannel(A.AMQPLIB_REJECT).start.subscribe(e=>AA(e,!0,Qn.Reject)),qn.tracingChannel(A.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&Mg(t.self,!1,Qn.AckAll,void 0)}),qn.tracingChannel(A.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&Mg(t.self,!0,Qn.NackAll,t.arguments[0])})}function y7(){let e=qn.tracingChannel(A.AMQPLIB_CONNECT);e.start.subscribe(fB),e.asyncEnd.subscribe(t=>{let n=t,r=n.result;!r||typeof r!="object"||(r[mB]={...I7(n.arguments?.[0]),...T7(r)})})}function AA(e,t,n){let r=e.self;if(!r)return;let i=e.arguments[0];if(!i)return;let o=e.arguments[1],s=e.arguments[2],c=n===Qn.Reject?o:s,a=r[Us]??[],l=a.findIndex(p=>p.msg===i);if(l<0)tu(i,t,n,c);else if(n!==Qn.Reject&&o){for(let p=0;p<=l;p++)tu(a[p].msg,t,n,c);a.splice(0,l+1)}else tu(i,t,n,c),a.splice(l,1)}function gB(e){if(Object.prototype.hasOwnProperty.call(e,Us))return;e[Us]=[],e[OA]=new Map;let t=setInterval(()=>S7(e),dB);t.unref?.(),e[RA]=t,typeof e.on=="function"&&(e.on("close",()=>{Mg(e,!0,Qn.ChannelClosed,void 0),zD(e)}),e.on("error",()=>{Mg(e,!0,Qn.ChannelError,void 0),zD(e)}))}function zD(e){let t=e[RA];t&&(clearInterval(t),e[RA]=void 0)}function S7(e){let t=lt(),n=e[Us]??[],r;for(r=0;r<n.length;r++){let i=n[r];if((t-i.timeOfConsume)*1e3<dB)break;tu(i.msg,null,Qn.InstrumentationTimeout,!0)}n.splice(0,r)}function Mg(e,t,n,r){(e[Us]??[]).forEach(o=>{tu(o.msg,t,n,r)}),e[Us]=[]}function tu(e,t,n,r){let i=e[NA];i&&(t!==!1&&i.setStatus({code:2,message:n!==Qn.ChannelClosed&&n!==Qn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),i.end(),e[NA]=void 0)}function _B(e){let t=e.arguments[0],n=e.arguments[1],r=typeof t=="string"?t:"",i=typeof n=="string"?n:"",o=e.arguments[3],s=L({name:`publish ${A7(r)}`,op:"message",kind:D.PRODUCER,attributes:{...hB(e.self),[iB]:r,[xn]:r,[oB]:uB,[sB]:i,[lB]:i,[ur]:d7,[aB]:o?.messageId,[_a]:o?.messageId,[cB]:o?.correlationId,[pB]:o?.correlationId,[S]:a7}});(!o||typeof o!="object")&&(o={},e.arguments[3]=o);let c=o.headers&&typeof o.headers=="object"?o.headers:o.headers={},a=tt({span:s});return a["sentry-trace"]&&(c["sentry-trace"]=a["sentry-trace"]),a.baggage&&(c.baggage=a.baggage),s}function E7(e,t,n){return L({name:`${e} process`,op:"message",kind:D.CONSUMER,attributes:{...hB(n),[iB]:t.fields?.exchange,[xn]:t.fields?.exchange,[oB]:uB,[sB]:t.fields?.routingKey,[lB]:t.fields?.routingKey,[l7]:$D,[ur]:$D,[aB]:t.properties?.messageId,[_a]:t.properties?.messageId,[cB]:t.properties?.correlationId,[pB]:t.properties?.correlationId,[S]:c7}})}function hB(e){let t=e?.connection,n=t?.[mB];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r=="string"&&r?{[Dt]:r.toLowerCase()}:{}}function T7(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t=="string"&&t?{[Dt]:t.toLowerCase()}:{}}function I7(e){let t={[p7]:"0.9.1",[fO]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,i=tB(r.protocol),o=nB(r.hostname),s=eB(r.port,i);t[QD]=i,t[Tb]=i,t[_t]=o,t[ht]=s,t[Me]=o,t[Pe]=s}else if(typeof n=="string"){let r=N7(n);t[u7]=r,t[pt]=r;try{let i=new URL(r),o=tB(i.protocol),s=nB(i.hostname),c=eB(i.port?parseInt(i.port,10):void 0,o);t[QD]=o,t[Tb]=o,t[_t]=s,t[ht]=c,t[Me]=s,t[Pe]=c}catch{}}return t}function A7(e){return e!==""?e:"<default>"}function N7(e){return e.replace(/:[^:@/]*@/,":***@")}function eB(e,t){return e||(t==="AMQP"?5672:5671)}function tB(e){let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()}function nB(e){return e||"localhost"}function rB(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}var bB=m7;import*as CA from"diagnostics_channel";var SB="Anthropic_AI",R7="auto.ai.orchestrion.anthropic",v7=[{channel:A.ANTHROPIC_CHAT,operation:"chat",methodPath:"messages.create",stream:"async-iterable"},{channel:A.ANTHROPIC_MODELS,operation:"models",methodPath:"models.retrieve",stream:"none"},{channel:A.ANTHROPIC_MESSAGES_STREAM,operation:"chat",methodPath:"messages.stream",stream:"message-stream"}],yB=!1,O7=((e={})=>({name:SB,setupOnce(){!CA.tracingChannel||yB||(yB=!0,me(()=>{for(let{channel:t,operation:n,methodPath:r,stream:i}of v7)J&&g.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),ee(CA.tracingChannel(t),o=>C7(o,n,r,e),{beforeSpanEnd:(o,s)=>{qd(o,s.result,Xe(e).recordOutputs)},deferSpanEnd:({span:o,data:s})=>k7(o,s,i,e)})}))}}));function C7(e,t,n,r){let i=e.arguments??[];if(kn(SB)||i[1]?.headers?.["X-Stainless-Helper-Method"]==="stream")return;let s=typeof i[0]=="object"&&i[0]!==null?i[0]:void 0,{recordInputs:c}=Xe(r),a=nt(r.enableTruncation),l=Kd(i,n,t),p=l[Be]||"unknown";l[S]=R7;let u=L({name:`${t} ${p}`,op:`gen_ai.${t}`,attributes:l});return c&&s&&Ua(u,s,a),u}function x7(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function P7(e){return!!e&&typeof e.on=="function"}function k7(e,t,n,r){let{recordOutputs:i}=Xe(r),o=t.result;if(n==="async-iterable"&&x7(o)){let s=o[Symbol.asyncIterator].bind(o),c=Fl({[Symbol.asyncIterator]:s},e,i);return o[Symbol.asyncIterator]=()=>c,!0}return n==="message-stream"&&P7(o)?(Wl(o,e,i),!0):!1}var EB=O7;import*as GA from"diagnostics_channel";var TB="auto.aws.orchestrion.aws_sdk",IB="dynamodb",AB="messaging.destination_kind",NB="topic",xA="chat",PA="aws.bedrock";var L7=new TextDecoder,wg=class{requestPreSpanHook(t){switch(t.commandName){case"Converse":return this._requestPreSpanHookConverse(t,!1);case"ConverseStream":return this._requestPreSpanHookConverse(t,!0);case"InvokeModel":return this._requestPreSpanHookInvokeModel(t,!1);case"InvokeModelWithResponseStream":return this._requestPreSpanHookInvokeModel(t,!0)}return{}}responseHook(t,n){let r=t.request.commandName;if(!n.isRecording()){(r==="ConverseStream"||r==="InvokeModelWithResponseStream")&&n.end();return}switch(r){case"Converse":return this._responseHookConverse(t,n);case"ConverseStream":return this._responseHookConverseStream(t,n);case"InvokeModel":return this._responseHookInvokeModel(t,n);case"InvokeModelWithResponseStream":return this._responseHookInvokeModelWithResponseStream(t,n)}}_requestPreSpanHookConverse(t,n){let r=xA,i={[_l]:PA,[nd]:xA},o=t.commandInput.modelId;o&&(i[gl]=o,r&&(r+=` ${o}`));let s=t.commandInput.inferenceConfig;if(s){let{maxTokens:c,temperature:a,topP:l,stopSequences:p}=s;c!==void 0&&(i[Ai]=c),a!==void 0&&(i[Ni]=a),l!==void 0&&(i[Ri]=l),p!==void 0&&(i[eo]=p)}return{spanName:r,isStream:n,spanAttributes:i}}_requestPreSpanHookInvokeModel(t,n){let r={[_l]:PA},i=t.commandInput?.modelId;if(i&&(r[gl]=i),t.commandInput?.body){let o=JSON.parse(t.commandInput.body);i.includes("amazon.titan")?(o.textGenerationConfig?.temperature!==void 0&&(r[Ni]=o.textGenerationConfig.temperature),o.textGenerationConfig?.topP!==void 0&&(r[Ri]=o.textGenerationConfig.topP),o.textGenerationConfig?.maxTokenCount!==void 0&&(r[Ai]=o.textGenerationConfig.maxTokenCount),o.textGenerationConfig?.stopSequences!==void 0&&(r[eo]=o.textGenerationConfig.stopSequences)):i.includes("amazon.nova")?(o.inferenceConfig?.temperature!==void 0&&(r[Ni]=o.inferenceConfig.temperature),o.inferenceConfig?.top_p!==void 0&&(r[Ri]=o.inferenceConfig.top_p),o.inferenceConfig?.max_new_tokens!==void 0&&(r[Ai]=o.inferenceConfig.max_new_tokens),o.inferenceConfig?.stopSequences!==void 0&&(r[eo]=o.inferenceConfig.stopSequences)):i.includes("anthropic.claude")?(o.max_tokens!==void 0&&(r[Ai]=o.max_tokens),o.temperature!==void 0&&(r[Ni]=o.temperature),o.top_p!==void 0&&(r[Ri]=o.top_p),o.stop_sequences!==void 0&&(r[eo]=o.stop_sequences)):i.includes("meta.llama")?(o.max_gen_len!==void 0&&(r[Ai]=o.max_gen_len),o.temperature!==void 0&&(r[Ni]=o.temperature),o.top_p!==void 0&&(r[Ri]=o.top_p)):i.includes("cohere.command-r")?(o.max_tokens!==void 0&&(r[Ai]=o.max_tokens),o.temperature!==void 0&&(r[Ni]=o.temperature),o.p!==void 0&&(r[Ri]=o.p),o.message!==void 0&&(r[en]=Math.ceil(o.message.length/6)),o.stop_sequences!==void 0&&(r[eo]=o.stop_sequences)):i.includes("cohere.command")?(o.max_tokens!==void 0&&(r[Ai]=o.max_tokens),o.temperature!==void 0&&(r[Ni]=o.temperature),o.p!==void 0&&(r[Ri]=o.p),o.prompt!==void 0&&(r[en]=Math.ceil(o.prompt.length/6)),o.stop_sequences!==void 0&&(r[eo]=o.stop_sequences)):i.includes("mistral")&&(o.prompt!==void 0&&(r[en]=Math.ceil(o.prompt.length/6)),o.max_tokens!==void 0&&(r[Ai]=o.max_tokens),o.temperature!==void 0&&(r[Ni]=o.temperature),o.top_p!==void 0&&(r[Ri]=o.top_p),o.stop!==void 0&&(r[eo]=o.stop))}return{isStream:n,spanAttributes:r}}_responseHookConverse(t,n){let{stopReason:r,usage:i}=t.data;RB(n,r),vB(n,i)}_responseHookConverseStream(t,n){t.data.stream=w7(t.data.stream,n)}_responseHookInvokeModel(t,n){let r=t.request.commandInput?.modelId;if(t.data?.body){let i=L7.decode(t.data.body),o=JSON.parse(i);r.includes("amazon.titan")?(o.inputTextTokenCount!==void 0&&n.setAttribute(en,o.inputTextTokenCount),o.results?.[0]?.tokenCount!==void 0&&n.setAttribute(Tt,o.results[0].tokenCount),o.results?.[0]?.completionReason!==void 0&&n.setAttribute(Ot,[o.results[0].completionReason])):r.includes("amazon.nova")?(o.usage!==void 0&&(o.usage.inputTokens!==void 0&&n.setAttribute(en,o.usage.inputTokens),o.usage.outputTokens!==void 0&&n.setAttribute(Tt,o.usage.outputTokens)),o.stopReason!==void 0&&n.setAttribute(Ot,[o.stopReason])):r.includes("anthropic.claude")?(o.usage?.input_tokens!==void 0&&n.setAttribute(en,o.usage.input_tokens),o.usage?.output_tokens!==void 0&&n.setAttribute(Tt,o.usage.output_tokens),o.stop_reason!==void 0&&n.setAttribute(Ot,[o.stop_reason])):r.includes("meta.llama")?(o.prompt_token_count!==void 0&&n.setAttribute(en,o.prompt_token_count),o.generation_token_count!==void 0&&n.setAttribute(Tt,o.generation_token_count),o.stop_reason!==void 0&&n.setAttribute(Ot,[o.stop_reason])):r.includes("cohere.command-r")?(o.text!==void 0&&n.setAttribute(Tt,Math.ceil(o.text.length/6)),o.finish_reason!==void 0&&n.setAttribute(Ot,[o.finish_reason])):r.includes("cohere.command")?(o.generations?.[0]?.text!==void 0&&n.setAttribute(Tt,Math.ceil(o.generations[0].text.length/6)),o.generations?.[0]?.finish_reason!==void 0&&n.setAttribute(Ot,[o.generations[0].finish_reason])):r.includes("mistral")&&(o.outputs?.[0]?.text!==void 0&&n.setAttribute(Tt,Math.ceil(o.outputs[0].text.length/6)),o.outputs?.[0]?.stop_reason!==void 0&&n.setAttribute(Ot,[o.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(t,n){let r=t.data?.body,i=t.request.commandInput?.modelId;if(!r||!i)return;let o=M7(i);t.data.body=(async function*(){try{for await(let s of r){if(o){let c=G7(s?.chunk?.bytes);c&&o(c,n)}yield s}}finally{n.end()}})()}};function M7(e){if(e.includes("amazon.titan"))return B7;if(e.includes("anthropic.claude"))return D7;if(e.includes("amazon.nova"))return U7;if(e.includes("meta.llama"))return H7;if(e.includes("cohere.command-r"))return V7;if(e.includes("cohere.command"))return W7;if(e.includes("mistral"))return F7}async function*w7(e,t){try{let n;for await(let r of e)RB(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;vB(t,n)}finally{t.end()}}function RB(e,t){t!==void 0&&e.setAttribute(Ot,[t])}function vB(e,t){if(t){let{inputTokens:n,outputTokens:r}=t;n!==void 0&&e.setAttribute(en,n),r!==void 0&&e.setAttribute(Tt,r)}}function G7(e){if(!e||!(e instanceof Uint8Array))return null;try{let t=Buffer.from(e).toString("utf-8");return JSON.parse(t)}catch(t){return J&&g.warn("[orchestrion:aws-sdk] failed to parse streamed bedrock chunk",t),null}}function U7(e,t){e.metadata?.usage!==void 0&&(e.metadata?.usage.inputTokens!==void 0&&t.setAttribute(en,e.metadata.usage.inputTokens),e.metadata?.usage.outputTokens!==void 0&&t.setAttribute(Tt,e.metadata.usage.outputTokens)),e.messageStop?.stopReason!==void 0&&t.setAttribute(Ot,[e.messageStop.stopReason])}function D7(e,t){e.message?.usage?.input_tokens!==void 0&&t.setAttribute(en,e.message.usage.input_tokens),e.message?.usage?.output_tokens!==void 0&&t.setAttribute(Tt,e.message.usage.output_tokens),e.delta?.stop_reason!==void 0&&t.setAttribute(Ot,[e.delta.stop_reason])}function B7(e,t){e.inputTextTokenCount!==void 0&&t.setAttribute(en,e.inputTextTokenCount),e.totalOutputTextTokenCount!==void 0&&t.setAttribute(Tt,e.totalOutputTextTokenCount),e.completionReason!==void 0&&t.setAttribute(Ot,[e.completionReason])}function H7(e,t){e.prompt_token_count!==void 0&&t.setAttribute(en,e.prompt_token_count),e.generation_token_count!==void 0&&t.setAttribute(Tt,e.generation_token_count),e.stop_reason!==void 0&&t.setAttribute(Ot,[e.stop_reason])}function F7(e,t){e.outputs?.[0]?.text!==void 0&&t.setAttribute(Tt,Math.ceil(e.outputs[0].text.length/6)),e.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(Ot,[e.outputs[0].stop_reason])}function W7(e,t){e.generations?.[0]?.text!==void 0&&t.setAttribute(Tt,Math.ceil(e.generations[0].text.length/6)),e.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(Ot,[e.generations[0].finish_reason])}function V7(e,t){e.text!==void 0&&t.setAttribute(Tt,Math.ceil(e.text.length/6)),e.finish_reason!==void 0&&t.setAttribute(Ot,[e.finish_reason])}function Nc(e){return Array.isArray(e)?e:[e]}var Gg=class{requestPreSpanHook(t){let n=t.commandName,r=t.commandInput?.TableName,i={};return i[ke]=IB,i[Et]=r,i[da]=n,t.commandInput?.TableName?i[_b]=[t.commandInput.TableName]:t.commandInput?.RequestItems&&(i[_b]=Object.keys(t.commandInput.RequestItems)),(n==="CreateTable"||n==="UpdateTable")&&t.commandInput?.ProvisionedThroughput&&(i[P0]=t.commandInput.ProvisionedThroughput.ReadCapacityUnits,i[k0]=t.commandInput.ProvisionedThroughput.WriteCapacityUnits),(n==="GetItem"||n==="Scan"||n==="Query")&&t.commandInput?.ConsistentRead&&(i[E0]=t.commandInput.ConsistentRead),(n==="Query"||n==="Scan")&&t.commandInput?.ProjectionExpression&&(i[x0]=t.commandInput.ProjectionExpression),n==="CreateTable"&&(t.commandInput?.GlobalSecondaryIndexes&&(i[N0]=Nc(t.commandInput.GlobalSecondaryIndexes).map(o=>JSON.stringify(o))),t.commandInput?.LocalSecondaryIndexes&&(i[C0]=Nc(t.commandInput.LocalSecondaryIndexes).map(o=>JSON.stringify(o)))),(n==="ListTables"||n==="Query"||n==="Scan")&&t.commandInput?.Limit&&(i[O0]=t.commandInput.Limit),n==="ListTables"&&t.commandInput?.ExclusiveStartTableName&&(i[A0]=t.commandInput.ExclusiveStartTableName),n==="Query"&&(t.commandInput?.ScanIndexForward&&(i[M0]=t.commandInput.ScanIndexForward),t.commandInput?.IndexName&&(i[fb]=t.commandInput.IndexName),t.commandInput?.Select&&(i[gb]=t.commandInput.Select)),n==="Scan"&&(t.commandInput?.Segment&&(i[w0]=t.commandInput?.Segment),t.commandInput?.TotalSegments&&(i[U0]=t.commandInput?.TotalSegments),t.commandInput?.IndexName&&(i[fb]=t.commandInput.IndexName),t.commandInput?.Select&&(i[gb]=t.commandInput.Select)),n==="UpdateTable"&&(t.commandInput?.AttributeDefinitions&&(i[S0]=Nc(t.commandInput.AttributeDefinitions).map(o=>JSON.stringify(o))),t.commandInput?.GlobalSecondaryIndexUpdates&&(i[R0]=Nc(t.commandInput.GlobalSecondaryIndexUpdates).map(o=>JSON.stringify(o)))),{spanAttributes:i,spanKind:D.CLIENT,spanOp:"db"}}responseHook(t,n){t.data?.ConsumedCapacity&&n.setAttribute(T0,Nc(t.data.ConsumedCapacity).map(r=>JSON.stringify(r))),t.data?.ItemCollectionMetrics&&n.setAttribute(v0,Nc(t.data.ItemCollectionMetrics).map(r=>JSON.stringify(r))),t.data?.TableNames&&n.setAttribute(G0,t.data?.TableNames.length),t.data?.Count&&n.setAttribute(I0,t.data?.Count),t.data?.ScannedCount&&n.setAttribute(L0,t.data?.ScannedCount)}};var Ug=class{requestPreSpanHook(t){let n=t.commandInput?.StreamName,r={};return n&&(r[D0]=n),{spanAttributes:r,spanKind:D.CLIENT}}};var Dg="Invoke",Bg=class{requestPreSpanHook(t){let n=t.commandInput?.FunctionName,r={},i;return t.commandName===Dg&&(r[j0]=n,r[Z0]="aws",i=`${n} ${Dg}`),{spanAttributes:r,spanKind:D.CLIENT,spanName:i}}requestPostSpanHook(t,n){t.commandName===Dg&&t.commandInput&&(t.commandInput.ClientContext=Y7(t.commandInput.ClientContext,n))}responseHook(t,n){t.request.commandName===Dg&&(n.setAttribute(Y0,t.requestId),t.request.region&&n.setAttribute(X0,t.request.region))}};function Y7(e,t){try{let n=tt({span:t}),r=e?JSON.parse(Buffer.from(e,"base64").toString("utf8")):{},i={...r,custom:{...r.custom,...n}},o=Buffer.from(JSON.stringify(i)).toString("base64");return o.length>3583?(J&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations."),e):o}catch(n){return J&&g.log("[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext",n),e}}var Hg=class{requestPreSpanHook(t){let n=t.commandInput?.Bucket,r={};return n&&(r[F0]=n),{spanAttributes:r,spanKind:D.CLIENT}}};var Fg=class{requestPreSpanHook(t){let n=t.commandInput?.SecretId,r={};return typeof n=="string"&&n.startsWith("arn:aws:secretsmanager:")&&(r[hb]=n),{spanAttributes:r,spanKind:D.CLIENT}}responseHook(t,n){let r=t.data?.ARN;r&&n.setAttribute(hb,r)}};var j7=10,kA="sentry-trace",LA="baggage",Z7=[kA,LA];function nu(e,t){let n=e??{},r=Object.keys(t);if(Object.keys(n).length+r.length<=j7)for(let i of r){let o=t[i];o&&(n[i]={DataType:"String",StringValue:o})}else J&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes");return n}function OB(e){let t=e.MessageAttributes??{},n=t[kA]?.StringValue??t[kA]?.Value;if(n)return{sentryTrace:n,baggage:t[LA]?.StringValue??t[LA]?.Value}}function CB(e=[]){return Ol([...e,...Z7])}var Wg=class{requestPreSpanHook(t){let n=D.CLIENT,r=`SNS ${t.commandName}`,i={[Dt]:"aws.sns"};if(t.commandName==="Publish"){n=D.PRODUCER,i[AB]=NB;let{TopicArn:s,TargetArn:c,PhoneNumber:a}=t.commandInput,l=X7(s,c,a);i[uO]=l,i[xn]=s||c||a||"unknown",r=`${a?"phone_number":l} send`}let o=t.commandInput?.TopicArn;return o&&(i[bb]=o),{spanAttributes:i,spanKind:n,spanName:r}}requestPostSpanHook(t,n){if(t.commandName==="Publish"){let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=nu(r,tt({span:n}))}}responseHook(t,n){let r=t.data?.TopicArn;r&&n.setAttribute(bb,r)}};function X7(e,t,n){if(e||t){let r=e??t;try{return r.substring(r.lastIndexOf(":")+1)}catch{return r}}else return n||"unknown"}var Vg=class{requestPreSpanHook(t){let n=q7(t.commandInput),r=Q7(n),i=D.CLIENT,o,s={[Dt]:"aws_sqs",[xn]:r,[pt]:n};switch(t.commandName){case"ReceiveMessage":i=D.CONSUMER,o=`${r} receive`,s[ur]="receive",t.commandInput.MessageAttributeNames=CB(t.commandInput.MessageAttributeNames);break;case"SendMessage":case"SendMessageBatch":i=D.PRODUCER,o=`${r} send`;break}return{spanAttributes:s,spanKind:i,spanName:o}}requestPostSpanHook(t,n){switch(t.commandName){case"SendMessage":{let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=nu(r,tt({span:n}))}break;case"SendMessageBatch":{let r=t.commandInput?.Entries;if(Array.isArray(r)){let i=tt({span:n});r.forEach(o=>{o.MessageAttributes=nu(o.MessageAttributes??{},i)})}}break}}responseHook(t,n){switch(t.request.commandName){case"SendMessage":n.setAttribute(_a,t?.data?.MessageId);break;case"SendMessageBatch":break;case"ReceiveMessage":{let r=t?.data?.Messages||[];n.setAttribute(ga,r.length);for(let i of r)K7(n,i);break}}}};function K7(e,t){let n=OB(t);if(!n)return;let{parentSpanId:r,traceId:i,sampled:o}=Rn(n.sentryTrace,n.baggage);i&&r&&e.addLink({context:{traceId:i,spanId:r,traceFlags:o?1:0},attributes:{[_a]:t.MessageId}})}function q7(e){return e?.QueueUrl}function Q7(e){if(!e)return;let t=e.split("/");if(t.length!==0)return t[t.length-1]}var Yg=class{requestPreSpanHook(t){let n=t.commandInput?.stateMachineArn,r=t.commandInput?.activityArn,i={};return n&&(i[V0]=n),r&&(i[W0]=r),{spanAttributes:i,spanKind:D.CLIENT}}};var jg=class{constructor(){this._services=new Map([["SecretsManager",new Fg],["SFN",new Yg],["SQS",new Vg],["SNS",new Wg],["DynamoDB",new Gg],["Lambda",new Bg],["S3",new Hg],["Kinesis",new Ug],["BedrockRuntime",new wg]])}requestPreSpanHook(t){let n=this._services.get(t.serviceName);return n?n.requestPreSpanHook(t):{}}requestPostSpanHook(t,n){this._services.get(t.serviceName)?.requestPostSpanHook?.(t,n)}responseHook(t,n){this._services.get(t.request.serviceName)?.responseHook?.(t,n)}};function MA(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function xB(e,t,n,r){return{serviceName:e?.replace(/\s+/g,""),commandName:MA(t,"Command"),commandInput:n,region:r}}function PB(e){return{[EO]:"aws-api",[SO]:e.commandName,[cd]:e.serviceName,[zu]:e.region}}var $7="Aws";function wA(e){try{return e()}catch(t){J&&g.warn("[orchestrion:aws-sdk] error building span",t);return}}function kB(e,t){t&&(t.requestId&&e.setAttribute(H0,t.requestId),t.httpStatusCode&&e.setAttribute(vi,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(B0,t.extendedRequestId))}var J7=(()=>{let e=new jg;return{name:$7,setupOnce(){if(!GA.tracingChannel)return;let t=i=>wA(()=>{let o=i.arguments[0],s=o?.constructor?.name;if(!o||!s)return;let c=i.self?.config,a=c?.serviceId??MA(i.self?.constructor?.name||"AWS","Client");o.input||(o.input={});let l=xB(a,s,o.input,void 0),p=e.requestPreSpanHook(l),u=L({name:p.spanName??`${l.serviceName}.${l.commandName}`,kind:p.spanKind??D.CLIENT,op:p.spanOp||"rpc",attributes:{[S]:TB,...PB(l),...p.spanAttributes}});i._sentryNormalizedRequest=l,i._sentryRequestMetadata=p;let d;try{d=c?.region?.()}catch{}let m={settled:!1,promise:Promise.resolve(d).then(_=>{_&&(l.region=_,u.setAttribute(zu,_))}).catch(()=>{}).finally(()=>{m.settled=!0})};return i._sentryRegion=m,wA(()=>e.requestPostSpanHook(l,u)),u}),n={deferSpanEnd({span:i,data:o,end:s}){let c=o._sentryNormalizedRequest,a=o._sentryRequestMetadata;if(!c)return!1;let l="error"in o;if(wA(()=>{if(l){let m=o.error,_=m?.$metadata;kB(i,{requestId:m?.RequestId??_?.requestId,httpStatusCode:_?.httpStatusCode,extendedRequestId:m?.extendedRequestId??_?.extendedRequestId});return}let u=o.result;kB(i,u?.$metadata);let d={data:u,request:c,requestId:u?.$metadata?.requestId};e.responseHook(d,i)}),a?.isStream&&!l)return!0;let p=o._sentryRegion;return p&&!p.settled?(p.promise.then(()=>s()),!0):!1}},r=[A.AWS_SMITHY_CORE_SEND,A.AWS_SMITHY_CLIENT_SEND,A.AWS_SDK_SMITHY_CLIENT_SEND];J&&g.log(`[orchestrion:aws-sdk] subscribing to channels "${r.join('", "')}"`),me(()=>{for(let i of r)ee(GA.tracingChannel(i),t,n)})}}}),LB=J7;import*as ru from"diagnostics_channel";var z7="Dataloader",MB="dataloader",e6="auto.db.orchestrion.dataloader",t6="cache.get",wB=Symbol("sentry.dataloader.wrapped");function n6(e,t){let n=e?.name;return n?`${MB}.${t} ${n}`:`${MB}.${t}`}function r6(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}function GB(e,t,n){let r=t==="load"||t==="loadMany"||t==="batch";return{name:n6(e,t),kind:t==="batch"?void 0:D.CLIENT,op:r?t6:void 0,onlyIfParent:!0,attributes:{[S]:e6,[pa]:r?r6(n):void 0}}}var i6=(()=>({name:z7,setupOnce(){ru.tracingChannel&&(J&&g.log("[orchestrion:dataloader] subscribing to dataloader tracing channels"),me(()=>{o6(),s6(),Zg(A.DATALOADER_LOAD_MANY,"loadMany"),Zg(A.DATALOADER_PRIME,"prime"),Zg(A.DATALOADER_CLEAR,"clear"),Zg(A.DATALOADER_CLEAR_ALL,"clearAll")}))}}));function o6(){ru.tracingChannel(A.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!="function"||n[wB])return;let r=n,i=function(...o){return Se({...GB(this,"batch",o[0]),links:this._batch?.spanLinks},()=>r.apply(this,o))};i[wB]=!0,t.arguments[0]=i})}function s6(){let e=ru.tracingChannel(A.DATALOADER_LOAD);ee(e,t=>UB(t.self,"load",t.arguments[0]),{requiresParentSpan:!0}),e.end.subscribe(t=>{let n=t,r=n._sentrySpan,i=n.self?._batch;r&&i&&r.isRecording()&&(i.spanLinks??(i.spanLinks=[])).push({context:r.spanContext()})})}function Zg(e,t){ee(ru.tracingChannel(e),n=>UB(n.self,t,n.arguments[0]),{requiresParentSpan:!0})}function UB(e,t,n){return L(GB(e,t,n))}var UA=i6;import*as DA from"diagnostics_channel";var a6="GenericPool",c6=(()=>({name:a6,setupOnce(){DA.tracingChannel&&me(()=>l6())}})),DB=c6;function l6(){ee(DA.tracingChannel(A.GENERIC_POOL_ACQUIRE),()=>L({name:"generic-pool.acquire",attributes:{[S]:"auto.db.orchestrion.generic_pool"}}))}import*as BA from"diagnostics_channel";var FB="Google_GenAI",BB="auto.ai.orchestrion.google_genai",p6=[{channel:A.GOOGLE_GENAI_GENERATE_CONTENT,operation:"generate_content"},{channel:A.GOOGLE_GENAI_EMBED_CONTENT,operation:"embeddings"},{channel:A.GOOGLE_GENAI_CHAT,operation:"chat"}],HB=!1,u6=((e={})=>({name:FB,setupOnce(){!BA.tracingChannel||HB||(HB=!0,me(()=>{for(let{channel:t,operation:n}of p6)J&&g.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),ee(BA.tracingChannel(t),r=>d6(r,n,e),{beforeSpanEnd:(r,i)=>{n!=="embeddings"&&Jd(r,i.result,Xe(e).recordOutputs)},deferSpanEnd:({span:r,data:i})=>f6(r,i,e)})}))}}));function d6(e,t,n){if(kn(FB))return;if(t!=="chat"){let p=Q();if(p){let{op:u,origin:d}=oe(p);if(d===BB&&u==="gen_ai.chat")return}}let i=(e.arguments??[])[0],{recordInputs:o}=Xe(n),s=nt(n.enableTruncation),c=$d(t,i,e.self),a=c[Be]||"unknown";c[S]=BB;let l=L({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return o&&i&&Yl(l,i,t,s),l}function m6(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function f6(e,t,n){let r=t.result;if(!m6(r))return!1;let{recordOutputs:i}=Xe(n),o=r[Symbol.asyncIterator].bind(r),s=Vl({[Symbol.asyncIterator]:o},e,i??!1);return r[Symbol.asyncIterator]=()=>s,!0}var WB=u6;import*as su from"diagnostics_channel";var Xg="auto.graphql.diagnostic_channel",VB="graphql.parse",YB="graphql.validate",jB="graphql.execute",ZB="graphql.resolve",XB="graphql.field.name",KB="graphql.field.path",qB="graphql.field.type",QB="graphql.parent.name",xo=Symbol.for("opentelemetry.graphql_data"),iu=Symbol.for("opentelemetry.patched");function g6(e){return typeof e?.then=="function"}function qg(e,t){if(!e||e[iu])return;e[iu]=!0;let n=e.getFields();Object.keys(n).forEach(r=>{let i=n[r];if(i&&(i.resolve&&(i.resolve=HA(t,i.resolve)),i.type))for(let o of JB(i.type))qg(o,t)})}function HA(e,t,n=!1){if(typeof t!="function"||t[iu])return t;function r(i,o,s,c){if(!t)return;let a=s??{};if(e().ignoreTrivialResolveSpans&&n&&(B(i)||typeof i=="function")&&typeof i[c.fieldName]!="function")return t.call(this,i,o,a,c);if(!a[xo])return t.call(this,i,o,a,c);let p=S6(c.path),{field:u,spanAdded:d}=_6(a,c,p),m=u.span;return se(m,()=>{try{let _=t.call(this,i,o,a,c);return g6(_)?_.then(h=>(Kg(m,d),h),h=>{throw Kg(m,d,h),h}):(Kg(m,d),_)}catch(_){throw Kg(m,d,_),_}})}return r[iu]=!0,r}function Kg(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function _6(e,t,n){let r=$B(e,n);if(r)return{field:r,spanAdded:!1};let i={span:h6(t,n,y6(e,n))};return b6(e,n,i),{field:i,spanAdded:!0}}function h6(e,t,n){let r={[S]:Xg,[H]:Di,[XB]:e.fieldName,[KB]:t.join("."),[qB]:e.returnType.toString(),[QB]:e.parentType.name};return L({name:`${ZB} ${t.join(".")}`,attributes:r,parentSpan:n})}function b6(e,t,n){let r=e[xo];r&&(r.fields[t.join(".")]=n)}function $B(e,t){return e[xo]?.fields[t.join(".")]}function y6(e,t){for(let n=t.length-1;n>0;n--){let r=$B(e,t.slice(0,n));if(r)return r.span}return e[xo]?.span}function S6(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function JB(e){return"ofType"in e&&e.ofType?JB(e.ofType):E6(e)?e.getTypes():T6(e)?[e]:[]}function E6(e){return"getTypes"in e&&typeof e.getTypes=="function"}function T6(e){return"getFields"in e&&typeof e.getFields=="function"}function zB(e,t){let n=e?.definitions;if(!n||!Array.isArray(n))return;let r=i=>!!i?.operation&&["query","mutation","subscription"].indexOf(i.operation)!==-1;return t?n.filter(r).find(i=>t===i?.name?.value):n.find(r)}var FA={[S]:Xg,[H]:Di};function eH(){return L({name:VB,attributes:{...FA}})}function tH(e){return L({name:YB,attributes:{...FA,[fa]:fc(e)}})}function nH(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:"invalid_argument"})}function I6(e){if(e.length>=2)return{schema:e[0],document:e[1],contextValue:e[3]??{},operationName:e[5],fieldResolver:e[6],writeBack:(n,r)=>{e[3]=n,e[6]=r}};let t=e[0]??{};return{schema:t.schema,document:t.document,contextValue:t.contextValue??{},operationName:t.operationName,fieldResolver:t.fieldResolver,writeBack:(n,r)=>{t.contextValue=n,t.fieldResolver=r}}}function rH(e,t,n,r){let i=I6(e),{schema:o,document:s}=i,{contextValue:c,fieldResolver:a}=i,l=!!c[xo];if(!n.ignoreResolveSpans&&!l){let _=a==null,h=t?.defaultFieldResolver,b=a??h;b&&(a=HA(r,b,_)),o&&(qg(o.getQueryType(),r),qg(o.getMutationType(),r))}let p=zB(s,i.operationName),u=p?.operation,d=p?.name?.value??i.operationName??void 0,m=L({name:Hf(u,d||void 0,jB),attributes:{...FA,[od]:u,[id]:d||void 0,[fa]:fc(s)}});return n.useOperationNameForRootSpan&&u&&Bf(m,u,d||void 0),c[xo]={source:s,span:m,fields:{}},i.writeBack(c,a),m}function iH(e,t){Ff(t)&&e.setStatus({code:2,message:"internal_error"})}var oH="Graphql";function A6(e){return{ignoreResolveSpans:e.ignoreResolveSpans!==!1,ignoreTrivialResolveSpans:e.ignoreTrivialResolveSpans!==!1,useOperationNameForRootSpan:e.useOperationNameForRootSpan!==!1}}function ou(e){try{return e()}catch(t){J&&g.warn("[orchestrion:graphql] error building span",t);return}}var N6=((e={})=>{let t=A6(e),n=()=>t;return{name:oH,setupOnce(){su.tracingChannel&&me(()=>{ee(su.tracingChannel(A.GRAPHQL_PARSE),()=>ou(()=>eH())),ee(su.tracingChannel(A.GRAPHQL_VALIDATE),r=>ou(()=>tH(r.arguments[1])),{beforeSpanEnd:(r,i)=>{ou(()=>nH(r,i.result))}}),ee(su.tracingChannel(A.GRAPHQL_EXECUTE),r=>ou(()=>rH(r.arguments,r.self,t,n)),{beforeSpanEnd:(r,i)=>{ou(()=>iH(r,i.result))}})})}}}),R6=N6,sH=e=>{let t=R6(e);return Ht(Up(e),{name:oH,setupOnce:()=>t.setupOnce?.()})};import*as $g from"diagnostics_channel";var v6=["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"],Rc=Symbol("hapi-handler-patched"),au={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},aH=new Set(v6),Tr=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(Tr||{});function O6(e){let t=Q();if(!t)return;let n=Oe(t);n&&oe(n).data[H]==="http.server"&&n.setAttribute(Fe,e)}var WA=e=>typeof e=="string"&&aH.has(e),C6=e=>{let t=e?.type;return t!==void 0&&WA(t)},x6=e=>Array.isArray(e)&&e.length<=3&&WA(e[0])&&typeof e[1]=="function",P6=e=>!Array.isArray(e),k6=(e,t)=>{let n={[Fe]:e.path,[Hr]:e.method},r;return t?(n[Tr.HAPI_TYPE]=au.PLUGIN,n[Tr.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[Tr.HAPI_TYPE]=au.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},L6=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[Tr.EXT_TYPE]:e,[Tr.HAPI_TYPE]:au.EXT,[Tr.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[Tr.EXT_TYPE]:e,[Tr.HAPI_TYPE]:au.EXT},name:r}};function lH(e,t){return Se({name:e.name,op:`${e.attributes[Tr.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[S]:"auto.http.orchestrion.hapi"}},t)}function cH(e,t){if(e[Rc]===!0)return e;e[Rc]=!0;let n=r=>function(...i){if(!Q())return r.call(this,...i);O6(e.path);let o=k6(e,t);return lH(o,()=>r.call(this,...i))};if(typeof e.handler=="function")e.handler=n(e.handler);else if(typeof e.options=="function"){let r=e.options;e.options=function(i){let o=r(i);return typeof o.handler=="function"&&(o.handler=n(o.handler)),o}}else typeof e.options?.handler=="function"&&(e.options.handler=n(e.options.handler));return e}function Qg(e,t,n){if(Array.isArray(e)){for(let r=0;r<e.length;r++)e[r]=Qg(e[r],t);return e}else if(P6(e)){if(e[Rc]===!0)return e;e[Rc]=!0;let r=function(...i){if(!Q())return e.apply(this,i);let o=L6(t,n,e.name);return lH(o,()=>e.apply(void 0,i))};return r[Rc]=!0,r}return e}function pH(e,t){let n=e[0];if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r]=cH(n[r],t);else e[0]=cH(n,t)}function uH(e,t){if(Array.isArray(e[0])){let n=e[0];for(let r=0;r<n.length;r++){let i=n[r];if(WA(i.type)){let o=i,s=Qg(o.method,i.type,t);o.method=s,n[r]=o}}return}else if(x6(e)){let n=e,r=n[1],i=Qg(r,n[0],t);e[1]=i;return}else if(C6(e[0])){let n=e[0],r=Qg(n.method,n.type,t);n.method=r}}var M6="Hapi",w6=(()=>({name:M6,setupOnce(){$g.tracingChannel&&(J&&g.log(`[orchestrion:hapi] subscribing to channels "${A.HAPI_ROUTE}" / "${A.HAPI_EXT}"`),$g.tracingChannel(A.HAPI_ROUTE).subscribe({start(e){let t=e;pH(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),$g.tracingChannel(A.HAPI_EXT).subscribe({start(e){let t=e;uH(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}})),dH=w6;import*as VA from"diagnostics_channel";var G6="Koa",U6="auto.http.orchestrion.koa",Jg={ROUTER:"router",MIDDLEWARE:"middleware"},mH=Symbol("sentry.koa.layer-patched"),fH=!1,D6=((e={})=>{let t=e.ignoreLayersType??[];return{name:G6,setupOnce(){!VA.tracingChannel||fH||(fH=!0,J&&g.log(`[orchestrion:koa] subscribing to channel "${A.KOA_USE}"`),VA.tracingChannel(A.KOA_USE).subscribe({start(n){B6(n,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function B6(e,t){let n=e.arguments[0];typeof n=="function"&&(e.arguments[0]=H6(n,t))}function H6(e,t){return e.router?F6(e,t):gH(e,!1,t)}function F6(e,t){let r=e.router?.stack??[];for(let i of r){let o=i.path,s=i.stack;s.forEach((c,a)=>{s[a]=gH(c,!0,t,o)})}return e}function gH(e,t,n,r){let i=t?Jg.ROUTER:Jg.MIDDLEWARE;return e[mH]===!0||n.includes(i)||e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?e:(e[mH]=!0,(o,s)=>{if(!Q())return e(o,s);let c=W6(o,e,t,r);o._matchedRoute&&V6(o._matchedRoute.toString());let a=c.attributes[ad],l=typeof a=="string"?a||"< unknown >":c.name;return Se({name:l,op:`${i}.koa`,attributes:{...c.attributes,[S]:U6}},()=>{let p=c.attributes[Fe];if($()===vt())J&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");else if(p){let u=o.request?.method?.toUpperCase()||"GET";$().setTransactionName(`${u} ${p}`)}return e(o,s)})})}function W6(e,t,n,r){return n?{attributes:{[ad]:r?.toString(),[Eb]:Jg.ROUTER,[Fe]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[ad]:t.name||"middleware",[Eb]:Jg.MIDDLEWARE,[ed]:t.name||"middleware"},name:`middleware - ${t.name}`}}function V6(e){let t=Q();if(!t)return;let n=Oe(t);n&&oe(n).data[H]==="http.server"&&n.setAttribute(Fe,e)}var _H=D6;import*as zg from"diagnostics_channel";var Y6="IORedis",j6="auto.db.orchestrion.redis",Z6="db.connection_string";function bH(e){return{host:e?.options?.host,port:e?.options?.port}}function yH(e,t){return{[ke]:"redis",[Z6]:`redis://${e}:${t}`,[Me]:e,[Pe]:t,[S]:j6}}var hH=new WeakSet;function X6(e){let t=e.arguments?.[0];if(!t||typeof t!="object"||hH.has(t))return;hH.add(t);let{host:n,port:r}=bH(e.self),i=ai(t.name,t.args??[]);return L({name:i,op:"db",attributes:{...yH(n,r),[Ye]:i}})}var K6=((e={})=>{let t=e.responseHook;return{name:Y6,setupOnce(){if(!zg.tracingChannel)return;J&&g.log(`[orchestrion:ioredis] subscribing to "${A.IOREDIS_COMMAND}"/"${A.IOREDIS_CONNECT}"`);let n=zg.tracingChannel(A.IOREDIS_COMMAND),r=zg.tracingChannel(A.IOREDIS_CONNECT);me(()=>{ee(n,X6,{requiresParentSpan:!0,beforeSpanEnd(i,o){if("error"in o||!t)return;let s=o.arguments?.[0];s&&q6(t,i,s,o.result)}}),ee(r,i=>{let{host:o,port:s}=bH(i.self);return L({name:"connect",op:"db",attributes:{...yH(o,s),[Ye]:"connect"}})},{requiresParentSpan:!0})})}}});function q6(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var YA=K6;import*as t_ from"diagnostics_channel";var vc="messaging.destination.partition.id",jA="messaging.kafka.message.key",ZA="messaging.kafka.message.tombstone",SH="messaging.kafka.offset",XA="process",cu="receive",EH="send",KA="kafka",TH="_OTHER";var Q6="auto.kafkajs.orchestrion.producer",$6="auto.kafkajs.orchestrion.consumer",J6=1,z6=0;function lu(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function IH(e){let t=lu(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=Rn(t,lu(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?J6:z6}}]}function e_({topic:e,message:t,operationType:n,links:r,attributes:i}){let o=n===cu?"poll":n;return L({name:`${o} ${e}`,op:"message",kind:n===cu?D.CLIENT:D.CONSUMER,links:r,attributes:{...i,[Dt]:KA,[xn]:e,[ur]:n,[ha]:o,[jA]:t?.key?String(t.key):void 0,[ZA]:t?.key&&t.value===null?!0:void 0,[SH]:t?.offset,...t?{[S]:$6}:{}}})}function AH(e,t){let n=L({name:`send ${e}`,op:"message",kind:D.PRODUCER,attributes:{[Dt]:KA,[xn]:e,[jA]:t.key?String(t.key):void 0,[ZA]:t.key&&t.value===null?!0:void 0,[vc]:t.partition!==void 0?String(t.partition):void 0,[ha]:"send",[ur]:EH,[S]:Q6}});t.headers=t.headers??{};let r=tt({span:n});return r["sentry-trace"]&&(t.headers["sentry-trace"]=r["sentry-trace"]),r.baggage&&(t.headers.baggage=r.baggage),n}function qA(e,t){let n,r=TH;typeof t=="string"||t===void 0?n=t:typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(t,"message")&&(n=t.message,r=t.constructor.name),e.forEach(i=>{i.setAttribute(Ur,r),i.setStatus({code:2,message:n})})}function QA(e,t){return Promise.resolve(t).catch(n=>{throw qA(e,n),n}).finally(()=>{e.forEach(n=>n.end())})}var $A=Symbol("sentry-kafkajs-consumer-callback-wrapped");function JA(e){return typeof e=="function"&&e[$A]===!0}function NH(e){let t=function(r){let i=lu(r.message.headers,"sentry-trace"),o=lu(r.message.headers,"baggage");return vn({sentryTrace:i,baggage:o},()=>{let s=e_({topic:r.topic,message:r.message,operationType:XA,attributes:{[vc]:String(r.partition)}}),c=se(s,()=>e.call(this,r));return QA([s],c)})};return t[$A]=!0,t}function RH(e){let t=function(r){let i=On(()=>e_({topic:r.batch.topic,message:void 0,operationType:cu,attributes:{[ga]:r.batch.messages.length,[vc]:String(r.batch.partition)}}));return se(i,()=>{let o=[i];r.batch.messages.forEach(c=>{o.push(e_({topic:r.batch.topic,message:c,operationType:XA,links:IH(c.headers),attributes:{[vc]:String(r.batch.partition)}}))});let s=e.call(this,r);return QA(o,s)})};return t[$A]=!0,t}var e8="Kafka";function t8(){let e=t_.tracingChannel(A.KAFKAJS_SEND_BATCH),t={start(n){let r=[];(n.arguments[0]?.topicMessages??[]).forEach(i=>{i.messages.forEach(o=>{r.push(AH(i.topic,o))})}),n._sentrySpans=r},error(n){n._sentrySpans&&qA(n._sentrySpans,n.error)},asyncEnd(n){n._sentrySpans?.forEach(r=>r.end())}};e.subscribe(t)}function n8(){let e=t_.tracingChannel(A.KAFKAJS_CONSUMER_RUN),t={start(n){let r=n.arguments[0];!r||typeof r!="object"||(typeof r.eachMessage=="function"&&!JA(r.eachMessage)&&(r.eachMessage=NH(r.eachMessage)),typeof r.eachBatch=="function"&&!JA(r.eachBatch)&&(r.eachBatch=RH(r.eachBatch)))}};e.subscribe(t)}var r8=(()=>({name:e8,setupOnce(){t_.tracingChannel&&(J&&g.log(`[orchestrion:kafkajs] subscribing to channels "${A.KAFKAJS_SEND_BATCH}", "${A.KAFKAJS_CONSUMER_RUN}"`),t8(),n8())}})),vH=r8;import*as n_ from"diagnostics_channel";var i8="Knex",o8="auto.db.orchestrion.knex",s8=1021,a8="db.sql.table",c8="sqlite",l8="postgresql",eN=Symbol("sentry.orchestrion.knex.parent-span"),p8=(()=>({name:i8,setupOnce(){n_.tracingChannel&&(J&&g.log(`[orchestrion:knex] subscribing to channel "${A.KNEX_QUERY}"`),me(()=>{zA(A.KNEX_QUERY_BUILDER),zA(A.KNEX_SCHEMA_BUILDER),zA(A.KNEX_RAW),u8()}))}}));function zA(e){n_.tracingChannel(e).end.subscribe(t=>{let n=t.result;if(!n||typeof n!="object"||eN in n)return;let r=Q();r&&Object.defineProperty(n,eN,{value:r})})}function u8(){ee(n_.tracingChannel(A.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[eN]??Q();if(!r)return;let i=e.arguments[0],o=t?.client,s=o?.config?.connection,c=s?.connectionString,a=OH(n),l=i?.method,p=s?.filename||s?.database||_8(c),u={[S]:o8,"knex.version":e.moduleVersion,[ke]:f8(o?.driverName),[a8]:a,[da]:l,[Ut]:s?.user,[Et]:p,[Me]:s?.host??h8(c),[Pe]:s?.port??b8(c),[ba]:s?.filename===":memory:"?"inproc":void 0,[Ye]:i?.sql!=null?gn(i.sql,s8):void 0};return L({name:g8(p,l,a)??"knex.query",kind:D.CLIENT,op:"db",parentSpan:r,attributes:u})},{beforeSpanEnd(e,t){if("error"in t){let n=d8(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function d8(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 o=m8(e.self)(r.sql,r.bindings||[]);return n.replace(`${o} - `,"")}catch{return n}}function m8(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 f8(e){return e==="sqlite3"?c8:e==="pg"?l8:e}function g8(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function OH(e){let t=e?._single?.table;return t&&typeof t=="object"?OH(t):typeof t=="string"?t:void 0}function _8(e){if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}}function h8(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function b8(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var tN=p8;import*as r_ from"diagnostics_channel";var y8=Ba,S8=[qr,Qr,$r],CH=!1;function xH(){Pi(S8)}var E8=((e={})=>({name:y8,setupOnce(){if(!r_.tracingChannel||CH)return;CH=!0;let t=gr(e),n=r=>{xH();let i=r.arguments;if(!Array.isArray(i))return;let o=i[1];(!o||typeof o!="object"||Array.isArray(o))&&(o={},i[1]=o),o.callbacks=us(o.callbacks,t)};for(let r of[A.LANGCHAIN_CHAT_MODEL_INVOKE,A.LANGCHAIN_CHAT_MODEL_STREAM])J&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),r_.tracingChannel(r).start.subscribe(n);me(()=>{for(let r of _D)J&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),ee(r_.tracingChannel(r),i=>T8(i,e))})}}));function T8(e,t){xH();let n=(e.arguments??[])[0];return L(tm(e.self,n,t))}var PH=E8;import*as o_ from"diagnostics_channel";var I8=Wa,kH=!1,i_=!1,A8=((e={})=>({name:I8,setupOnce(){if(!o_.tracingChannel||kH)return;kH=!0;let t=Xe(e),n=gr(t);me(()=>{J&&g.log(`[orchestrion:langgraph] subscribing to channel "${A.LANGGRAPH_STATE_GRAPH_COMPILE}"`),ee(o_.tracingChannel(A.LANGGRAPH_STATE_GRAPH_COMPILE),i=>{if(i_)return;let o=nN(i.arguments),s=typeof o?.name=="string"?o.name:void 0;return L(im(s))},{beforeSpanEnd:(i,o)=>{LH(o.result,nN(o.arguments)??{},t,null,n)}}),J&&g.log(`[orchestrion:langgraph] subscribing to channel "${A.LANGGRAPH_CREATE_REACT_AGENT}"`);let r=o_.tracingChannel(A.LANGGRAPH_CREATE_REACT_AGENT);r.start.subscribe(i=>{i_=!0;try{let{arguments:o}=i,s=nN(o);s&&Array.isArray(s.tools)&&s.tools.length>0&&Ql(s.tools,t,Va(o)??void 0)}catch(o){J&&g.error("[orchestrion:langgraph] failed to wrap createReactAgent tools",o)}}),r.end.subscribe(i=>{i_=!1;let{arguments:o,result:s}=i,c=Va(o)??void 0;LH(s,c?{name:c}:{},t,ql(o),n)}),r.error.subscribe(()=>{i_=!1})})}}));function nN(e){let t=(e??[])[0];return typeof t=="object"&&t!==null?t:void 0}function LH(e,t,n,r,i){if(!e||typeof e!="object")return;let o=e,s=o.invoke;typeof s=="function"&&(o.invoke=$l(s.bind(o),o,t,n,r,i))}var MH=A8;import*as rN from"diagnostics_channel";var N8="LruMemoizer",R8=(()=>({name:N8,setupOnce(){rN.tracingChannel&&(J&&g.log(`[orchestrion:lru-memoizer] subscribing to channel "${A.LRU_MEMOIZER_LOAD}"`),me(()=>{ee(rN.tracingChannel(A.LRU_MEMOIZER_LOAD),()=>{})}))}})),wH=R8;import*as pu from"diagnostics_channel";var v8="Mongo",GH="auto.db.orchestrion.mongo",O8=new Set(["insert","update","delete","find","getMore","killCursors"]),C8=(()=>({name:v8,setupOnce(){pu.tracingChannel&&me(()=>{x8(),P8(),k8()})}}));function x8(){ee(pu.tracingChannel(A.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 Er(Dp(e.self,n,r,i,GH))},{requiresParentSpan:!0})}function P8(){ee(pu.tracingChannel(A.MONGODB_CHECKOUT),()=>{})}function k8(){for(let e of["insert","update","remove"]){let t=e==="insert"?A.MONGODB_V3_INSERT:e==="update"?A.MONGODB_V3_UPDATE:A.MONGODB_V3_REMOVE;s_(t,n=>({topology:n[0],ns:n[1],command:n[2]?.[0],operation:e}))}s_(A.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&O8.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?Bp(t):void 0}}),s_(A.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:"find"})),s_(A.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:"getMore"}))}function s_(e,t){ee(pu.tracingChannel(e),n=>{let r=n.arguments;if(!r)return;let i=t(r);if(!(!i||typeof i.ns!="string"))return Er(Hp(i.ns,i.topology,i.command,i.operation,GH))},{requiresParentSpan:!0})}var UH=C8;import*as uu from"diagnostics_channel";var L8="Mongoose",M8="auto.db.orchestrion.mongoose",iN=new WeakMap,DH=!1,w8=(()=>({name:L8,setupOnce(){uu.tracingChannel&&me(()=>{Vf(uu.tracingChannel),G8()})}}));function G8(){if(!DH){DH=!0,J&&g.log("[orchestrion:mongoose] subscribing to injected channels");for(let e of OD)BH(e).subscribe({start(t){HH(t.self)}});BH(A.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t=="object"&&HH(t)}}),Cc(A.MONGOOSE_QUERY_EXEC,e=>{let t=e;return Oc(t.mongooseCollection,t.model?.modelName,t.op??"exec",iN.get(e))}),Cc(A.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return Oc(t?.collection,t?.modelName,"aggregate",iN.get(e))}),Cc(A.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return Oc(t.collection,t.modelName,"save")}),Cc(A.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return Oc(t.collection,t.modelName,"remove")}),Cc(A.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return Oc(t.collection,t.modelName,"insertMany")}),Cc(A.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return Oc(t.collection,t.modelName,"bulkWrite")})}}function Oc(e,t,n,r){return Hi({collection:e,modelName:t,operation:n,origin:M8,parentSpan:r})}function BH(e){return uu.tracingChannel(e)}function Cc(e,t){ee(uu.tracingChannel(e),n=>{let r=n.self;if(r)return t(r)})}function HH(e){let t=Q();e&&t&&iN.set(e,t)}var FH=w8;import*as oN from"diagnostics_channel";var U8="Mysql",D8="db.system",B8="db.connection_string",H8="db.name",F8="db.user",W8="db.statement",V8="net.peer.name",Y8="net.peer.port",j8=(()=>({name:U8,setupOnce(){oN.tracingChannel&&(J&&g.log(`[orchestrion:mysql] subscribing to channel "${A.MYSQL_QUERY}"`),me(()=>{ee(oN.tracingChannel(A.MYSQL_QUERY),e=>{let t=X8(e.arguments[0]),{host:n,port:r,database:i,user:o}=K8(e.self),s=typeof r=="string"?parseInt(r,10):r,c=typeof s=="number"&&!isNaN(s);return e._sentryCallerScope=ne(),L({name:t??"mysql.query",kind:D.CLIENT,op:"db",attributes:{[D8]:"mysql",[S]:"auto.db.orchestrion.mysql",[B8]:q8(n,c?s:void 0,i),...i?{[H8]:i}:{},...o?{[F8]:o}:{},...t?{[W8]:t}:{},...n?{[V8]:n}:{},...c?{[Y8]:s}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!="object"||!Z8(n))return!1;let r=e._sentryCallerScope;return r&&bn(n,r),n.on("error",i=>t(i)),n.on("end",()=>t()),!0}})}))}}));function Z8(e){return"on"in e&&typeof e.on=="function"}function X8(e){if(typeof e=="string")return e;if(B(e)&&"sql"in e){let t=e.sql;return typeof t=="string"?t:void 0}}function K8(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function q8(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var WH=j8;import*as a_ from"diagnostics_channel";var Q8="Mysql2",$8="auto.db.orchestrion.mysql2",J8="mysql";function z8(){Yf(a_.tracingChannel),VH(A.MYSQL2_QUERY),VH(A.MYSQL2_EXECUTE)}function VH(e){ee(a_.tracingChannel(e),t=>{let n=eee(t.arguments);return L({name:n??"mysql2.query",kind:D.CLIENT,attributes:{[S]:$8,[H]:"db",[ke]:J8,...nee(t.self?.config),[Ye]:n||void 0}})},{requiresParentSpan:!0})}function eee(e){return tee(e[0])}function tee(e){if(typeof e=="string")return e;if(B(e)&&"sql"in e){let t=e.sql;return typeof t=="string"?t:void 0}}function nee(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig??e??{},o=typeof n=="string"?parseInt(n,10):n,s=typeof o=="number"&&!isNaN(o);return{[Et]:r||void 0,[Ut]:i||void 0,[Me]:t||void 0,[Pe]:s?o:void 0}}var ree=(()=>({name:Q8,setupOnce(){a_.tracingChannel&&me(()=>{z8()})}})),YH=ree;import*as sN from"diagnostics_channel";var ZH="OpenAI",iee="auto.ai.orchestrion.openai",oee=[{channel:A.OPENAI_CHAT,operation:"chat"},{channel:A.OPENAI_EMBEDDINGS,operation:"embeddings"}],jH=!1,see=((e={})=>({name:ZH,setupOnce(){!sN.tracingChannel||jH||(jH=!0,me(()=>{for(let{channel:t,operation:n}of oee)J&&g.log(`[orchestrion:openai] subscribing to channel "${t}"`),ee(sN.tracingChannel(t),r=>aee(r,n,e),{beforeSpanEnd:(r,i)=>{Dl(r,i.result,Xe(e).recordOutputs)},deferSpanEnd:({span:r,data:i})=>lee(r,i,e)})}))}}));function aee(e,t,n){if(kn(ZH))return;let r=e.arguments??[],i=r[0],{recordInputs:o}=Xe(n),s=nt(n.enableTruncation),c=jd(r,t);c[S]=iee;let a=i?.model||"unknown",l=L({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return o&&i&&Hl(l,i,t,s),l}function cee(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function lee(e,t,n){let r=t.result;if(!cee(r))return!1;let{recordOutputs:i}=Xe(n),o=r[Symbol.asyncIterator].bind(r),s=Bl({[Symbol.asyncIterator]:o},e,i??!1);return r[Symbol.asyncIterator]=()=>s,!0}var XH=see;import*as cN from"diagnostics_channel";var pee="Postgres",uee="auto.db.orchestrion.postgres",KH="db.system",qH="db.name",QH="db.connection_string",$H="db.user",dee="db.statement",JH="net.peer.name",zH="net.peer.port",mee="db.postgresql.plan",fee="db.postgresql.idle.timeout.millis",gee="db.postgresql.max.client",eF="postgresql",_ee="pg.query",hee="pg.connect",bee="pg-pool.connect",yee=((e={})=>({name:pee,setupOnce(){cN.tracingChannel&&me(()=>{aN(A.PG_QUERY,See,{deferStreamedResult:!0}),e.ignoreConnectSpans||(aN(A.PG_CONNECT,Eee),aN(A.PGPOOL_CONNECT,Tee))})}}));function aN(e,t,{deferStreamedResult:n=!1}={}){J&&g.log(`[orchestrion:pg] subscribing to channel "${e}"`),ee(cN.tracingChannel(e),r=>(r._sentryCallerScope=ne(),L({...t(r),kind:D.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:r,end:i}){let o=r.result;if(!o||typeof o!="object"||!Iee(o))return!1;let s=r._sentryCallerScope;return s&&bn(o,s),o.on("error",c=>i(c)),o.on("end",()=>i()),!0}}:{requiresParentSpan:!0})}function See(e){let t=e.self?.connectionParameters??{},n=Aee(e.arguments);return{name:n?.text??_ee,op:"db",attributes:{...tF(t),[S]:uee,[dee]:n?.text||void 0,[mee]:typeof n?.name=="string"?n.name:void 0}}}function Eee(e){let t=e.self?.connectionParameters??{};return{name:hee,op:"db",attributes:tF(t)}}function Tee(e){let t=e.self?.options??{};return{name:bee,op:"db",attributes:Nee(t)}}function Iee(e){return"on"in e&&typeof e.on=="function"}function Aee(e){let t=e[0];if(typeof t=="string")return{text:t};if(B(t)&&typeof t.text=="string"){let n=t;return{text:n.text,name:n.name}}}function tF(e){return{[KH]:eF,[QH]:nF(e),[qH]:e.database,[$H]:e.user,[JH]:e.host,[zH]:Number.isInteger(e.port)?e.port:void 0}}function Nee(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),o=t?.username||e.user;return{[KH]:eF,[QH]:nF(e),[fee]:e.idleTimeoutMillis,[gee]:e.max,[qH]:n,[zH]:i,[JH]:r||void 0,[$H]:o||void 0}}function nF(e){if(e.connectionString)try{let i=new URL(e.connectionString);return i.username="",i.password="",i.toString()}catch{return"postgresql://localhost:5432/"}let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}var rF=yee;import*as xc from"diagnostics_channel";var Ree="PostgresJs",vee="auto.db.orchestrion.postgresjs",Oee="db.response.status_code",$n=()=>{},Cee=Symbol.for("sentry.query.from.instrumented.sql"),sF=Symbol("sentryPostgresJsSpan"),iF=Symbol("sentryPostgresJsConnectionAttrsSet"),aF=Symbol("sentryPostgresJsSpanEnded"),cF=new WeakMap,c_=[];function xee(e){c_.some(n=>n.ATTR_SERVER_ADDRESS===e.ATTR_SERVER_ADDRESS&&n.ATTR_SERVER_PORT===e.ATTR_SERVER_PORT&&n.ATTR_DB_NAMESPACE===e.ATTR_DB_NAMESPACE)||c_.push(e)}function Pee(){return c_.length===1?c_[0]:void 0}function kee(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!="object"||!n)return;let r=Tm(n);cF.set(t,r),xee(r)}function lF(e,t,n){let r=t;r[iF]||(r[iF]=!0,Em(e,n))}function oF(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[sF],i=cF.get(t);r&&i&&lF(r,n,i)}function Lee(e,t,n){let r=e.self;if(!r)return;let i=()=>{e[aF]=!0},o=r.resolve;typeof o=="function"&&(r.resolve=function(...c){i();try{let a=c[0]?.command;Za(t,n,a),t.end()}catch(a){J&&g.error("[orchestrion:postgresjs] error ending span in resolve:",a)}return o.apply(this,c)});let s=r.reject;typeof s=="function"&&(r.reject=function(...c){i();try{let a=c[0];t.setStatus({code:2,message:a?.message||"unknown_error"}),t.setAttribute(Oee,a?.code||"unknown"),t.setAttribute(Ur,a?.name||"unknown"),Za(t,n),t.end()}catch(a){J&&g.error("[orchestrion:postgresjs] error ending span in reject:",a)}return s.apply(this,c)})}var Mee=((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:Ree,setupOnce(){xc.tracingChannel&&(J&&g.log(`[orchestrion:postgresjs] subscribing to "${A.POSTGRESJS_HANDLE}"`),xc.tracingChannel(A.POSTGRESJS_CONNECTION).subscribe({start:$n,asyncStart:$n,asyncEnd:$n,error:$n,end:kee}),xc.tracingChannel(A.POSTGRESJS_EXECUTE).subscribe({end:$n,asyncStart:$n,asyncEnd:$n,error:$n,start:oF}),xc.tracingChannel(A.POSTGRESJS_CONNECT).subscribe({end:$n,asyncStart:$n,asyncEnd:$n,error:$n,start:oF}),me(()=>{ee(xc.tracingChannel(A.POSTGRESJS_HANDLE),r=>{let i=r.self;if(!i||i.executed===!0||i[Cee])return;let o=Sm(i.strings),s=Xa(o),c=L({name:s||"postgresjs.query",op:"db",kind:D.CLIENT,attributes:{[S]:vee,[dt]:"postgres",[Gr]:s}});i[sF]=c;let a=Pee();if(a&&lF(c,i,a),n)try{n(c,s,a)}catch(l){c.setAttribute("sentry.hook.error","requestHook failed"),J&&g.error("[orchestrion:postgresjs] error in requestHook:",l)}return Lee(r,c,s),c},{requiresParentSpan:t!==!1,deferSpanEnd({data:r}){return r[aF]?!0:!("error"in r)}})}))}}}),pF=Mee;import{EventEmitter as wee}from"events";import*as p_ from"diagnostics_channel";var Gee="Tedious",Uee="auto.db.orchestrion.tedious",Dee="mssql",Bee="db.sql.table",dF=Symbol("sentry.orchestrion.tedious.current-database");function l_(e){Object.defineProperty(this,dF,{value:e,writable:!0,configurable:!0})}function uF(){this.removeListener("databaseChange",l_)}function Hee(){p_.tracingChannel(A.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(l_.call(t,t.config?.options?.database),t.removeListener("databaseChange",l_),t.on("databaseChange",l_),t.removeListener("end",uF),t.once("end",uF))})}function Pc(e,t){p_.tracingChannel(e).start.subscribe(n=>{let r=n,i=r.self,o=r.arguments[0];if(!i||!(o instanceof wee))return;let s=0,c=0,a=()=>{c++},l=()=>{s++},p=i[dF],u=Fee(o),d={[S]:Uee,[ke]:Dee,[Et]:p,[Ut]:i.config?.userName??i.config?.authentication?.options?.userName,[Ye]:u,[Bee]:o.table,[Me]:i.config?.server,[Pe]:i.config?.options?.port},m=L({name:Wee(t,p,u,o.table),kind:D.CLIENT,op:"db",attributes:d}),_=Vee(h=>{o.removeListener("done",a),o.removeListener("doneInProc",a),o.removeListener("doneProc",l),o.removeListener("error",_),i.removeListener("end",_),m.setAttribute("tedious.procedure_count",s),m.setAttribute("tedious.statement_count",c),h&&m.setStatus({code:2,message:h.message}),m.end()});if(o.on("done",a),o.on("doneInProc",a),o.on("doneProc",l),o.once("error",_),i.on("end",_),typeof o.callback=="function"){let h=o.callback;o.callback=function(...b){return _(b[0]),h.apply(this,b)}}})}function Fee(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 Wee(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 Vee(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var Yee=(()=>({name:Gee,setupOnce(){p_.tracingChannel&&(J&&g.log(`[orchestrion:tedious] subscribing to channel "${A.TEDIOUS_EXEC_SQL}"`),me(()=>{Hee(),Pc(A.TEDIOUS_EXEC_SQL,"execSql"),Pc(A.TEDIOUS_EXEC_SQL_BATCH,"execSqlBatch"),Pc(A.TEDIOUS_CALL_PROCEDURE,"callProcedure"),Pc(A.TEDIOUS_EXEC_BULK_LOAD,"execBulkLoad"),Pc(A.TEDIOUS_PREPARE,"prepare"),Pc(A.TEDIOUS_EXECUTE,"execute")}))}})),mF=Yee;import*as fN from"diagnostics_channel";var fF=Symbol("SentryVercelAiModelPatched"),gF=Symbol("SentryVercelAiToolPatched"),jee=0;function u_(){return`v6-${++jee}`}var d_=new WeakMap,SF=new WeakSet,EF=new WeakSet,dN=new WeakMap,mN=new WeakMap,pN=new WeakMap,TF=new WeakSet,_F=!1;function IF(e,t={}){if(!_F){_F=!0;try{kc(e,A.VERCEL_AI_GENERATE_TEXT,lN("generateText"),t),kc(e,A.VERCEL_AI_STREAM_TEXT,lN("streamText"),t),kc(e,A.VERCEL_AI_GENERATE_OBJECT,lN("generateObject"),t),kc(e,A.VERCEL_AI_EMBED,(n,r)=>({type:"embed",event:{callId:u_(),...uN(n.model),maxRetries:n.maxRetries,value:n.value,...du(r)}}),t),kc(e,A.VERCEL_AI_EMBED_MANY,(n,r)=>({type:"embedMany",event:{callId:u_(),...uN(n.model),maxRetries:n.maxRetries,values:n.values,...du(r)}}),t),kc(e,A.VERCEL_AI_EXECUTE_TOOL_CALL,(n,r)=>({type:"executeTool",event:{callId:u_(),toolCall:n.toolCall,tools:n.tools,...du(r)}}),t),qee(e,A.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{J&&g.log("Vercel AI orchestrion channel subscription failed.")}}}function kc(e,t,n,r){let i=e(t),o=s=>{let c=B(s.arguments[0])?s.arguments[0]:{},a=B(c.experimental_telemetry)?c.experimental_telemetry:{};if(a.isEnabled===!1&&!TF.has(a))return;let l=n(c,a);Kee(c,a);let p=Q(),u=Wp(l,r);if(u){d_.set(s,l),SF.add(u);let d=B(c.model)&&c.model.specificationVersion==="v1";pN.set(u,{callSiteSpan:p,toolErrorsBubbleToCaller:d}),l.type==="executeTool"&&EF.add(u);let m=We(l.event.callId);m&&dN.set(u,m),mN.set(u,du(a)),B(c.tools)&&Qee(c.tools,r),d&&NF(c.model,r)}return u};ee(i,s=>o(s),{beforeSpanEnd:(s,c)=>{let a=d_.get(c);if(a){if("error"in c){let l=pN.get(s)?.callSiteSpan;l&&B(c.error)&&Ge(c.error,"_sentry_active_span",l)}else a.result=a.type==="executeTool"?{output:c.result}:c.result,hc(s,a,r);a.type!=="streamText"&&MT(a),d_.delete(c)}},deferSpanEnd:({data:s,end:c})=>Zee(s,c)})}function Zee(e,t){if(d_.get(e)?.type!=="streamText"||"error"in e||!Xee(e.result))return!1;let n=e.result;return(async()=>{try{let[r,i,o,s,c]=await Promise.all([n.totalUsage??n.usage,n.text,n.toolCalls,n.finishReason,n.response]);e.result={usage:r,text:i,toolCalls:o,finishReason:s,response:c},t()}catch(r){t(r)}})(),!0}function Xee(e){return B(e)&&(hF(e.totalUsage)||hF(e.usage))}function hF(e){return B(e)&&typeof e.then=="function"}function Kee(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};TF.add(n),e.experimental_telemetry=n}function qee(e,t,n){e(t).subscribe({end(r){let i=r;B(i.result)&&NF(i.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function AF(){let e=Q();return e&&SF.has(e)?e:void 0}function NF(e,t){e[fF]||(e[fF]=!0,bF(e,"doGenerate",t),bF(e,"doStream",t))}function bF(e,t,n){let r=e[t];typeof r=="function"&&(e[t]=function(...i){let o=AF();if(!o)return Promise.resolve(r.apply(this,i));let s=B(i[0])?i[0]:{},c=dN.get(o),a={type:"languageModelCall",event:{callId:c,provider:e.provider,modelId:e.modelId,tools:s.tools??(B(s.mode)?s.mode.tools:void 0),messages:s.prompt,...mN.get(o)}},l=se(o,()=>Wp(a,n));if(!l)return Promise.resolve(r.apply(this,i));let p=()=>{t==="doStream"&&c&&wT(c)},u=d=>{throw l.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),l.end(),p(),d};try{return Promise.resolve(r.apply(this,i)).then(m=>t==="doStream"&&B(m)&&Kf(m.stream)?(m.stream=qf(m.stream,_=>{a.result={...m,...GT(_)},hc(l,a,n),l.end(),p()},_=>{l.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),l.end(),p()}),m):(a.result=m,hc(l,a,n),l.end(),p(),m),u)}catch(d){return u(d)}})}function Qee(e,t){try{for(let[n,r]of Object.entries(e))B(r)&&$ee(n,r,e,t)}catch{J&&g.log("Vercel AI orchestrion tool patching failed.")}}function $ee(e,t,n,r){let i=t.execute;typeof i!="function"||t[gF]||(t[gF]=!0,t.execute=function(o,...s){let c=AF();if(!c||EF.has(c))return i.apply(this,[o,...s]);let a=B(s[0])?s[0]:{},l={type:"executeTool",event:{callId:dN.get(c),toolCall:{toolName:e,toolCallId:We(a.toolCallId),input:o},tools:n,...mN.get(c)}},p=se(c,()=>Wp(l,r));if(!p)return i.apply(this,[o,...s]);let u=d=>{throw pN.get(c)?.toolErrorsBubbleToCaller?p.setStatus({code:2,message:d instanceof Error?d.message:"tool_error"}):UT(p,l,d),p.end(),d};try{return Promise.resolve(i.apply(this,[o,...s])).then(m=>(l.result={output:m},hc(p,l,r),p.end(),m),u)}catch(d){return u(d)}})}function lN(e){return(t,n)=>({type:e,event:{callId:u_(),operationId:`ai.${e}`,functionId:We(n.functionId),...uN(t.model),maxRetries:t.maxRetries,instructions:We(t.system),messages:Jee(t),...du(n)}})}function Jee(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt=="string"?[{role:"user",content:e.prompt}]:e.messages??e.prompt}function du(e){let t=e.isEnabled===!0?!0:void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function uN(e){return{provider:yF(e,"provider"),modelId:yF(e,"modelId")}}function yF(e,t){return B(e)?We(e[t]):void 0}var zee=((e={})=>{let t=Vp(e);return Ht(t,{options:e,setupOnce(){fN.tracingChannel&&me(()=>{IF(fN.tracingChannel,e)})}})}),RF=zee;import*as gN from"diagnostics_channel";var CF=new WeakMap;function xF(e,t){CF.set(e,t)}function PF(e){return CF.get(e)}var vF=new WeakMap;function m_(e){let t=vF.get(e);return t||(t=[],vF.set(e,t)),t}function kF(e,t){m_(e).push(t)}function LF(e){m_(e).pop()}function MF(e){let t=e[0];return Array.isArray(t)?t.map(n=>OF(n)??"").join(","):OF(t)}function OF(e){return typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0}function wF(e){let t=m_(e),n="";for(let r of t)r==="/"||r==="/*"||(n+=!n||n.endsWith("/")?r:`/${r}`);return n.replace(/\/{2,}/g,"/")}function GF(e,t){let n=m_(e);if(n.length===0)return;let r=typeof e.originalUrl=="string"?e.originalUrl:"";if(n.every(s=>s==="/"))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)||ete(i))?i:void 0}function ete(e){return e.includes(":")||e.includes("*")}var tte="auto.http.express",nte="express.name",rte="express.type",Po=()=>{},UF=!1;function DF(e,t){if(!UF){UF=!0;for(let n of[A.EXPRESS_REGISTER,A.ROUTER_REGISTER])t(n).subscribe({start:Po,asyncStart:Po,asyncEnd:Po,error:Po,end:ite});for(let n of[A.EXPRESS_HANDLE,A.ROUTER_HANDLE]){J&&g.log(`[orchestrion:express] subscribing to channel "${n}"`);let r=t(n);ee(r,i=>ste(i,e),{beforeSpanEnd(i,o){o._sentryCleanup?.()}}),r.subscribe({start:Po,asyncEnd:Po,end:Po,error:Po,asyncStart:ote})}}}function ite(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&xF(n,MF(e.arguments??[]))}function ote(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&LF(t)}function ste(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],o=r[1];if(!i||!Q())return;let s=ate(n),c=PF(n);c!=null&&(kF(i,c),e._sentryStoredLayer=!0);let a=s==="request_handler"?wF(i):void 0,l=s==="request_handler"&&a!=null?GF(i,a):void 0,p=s==="request_handler"?a||"request handler":s==="router"?n.path??"/":n.name??"<anonymous>";if(l&&cte(l),s==="request_handler"&&a){let d=$();if(d!==vt()){let m=typeof i.method=="string"?i.method.toUpperCase():"GET";d.setTransactionName(`${m} ${a}`)}else J&&g.warn("[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name")}if(lte(p,s,t))return;let u=L({name:p,attributes:{[S]:tte,[H]:`${s}.express`,[nte]:p,[rte]:s,...l?{[Fe]:l}:{}}});if(o&&typeof o.once=="function"){let d=()=>{o.removeListener("finish",m),o.removeListener("close",_)},m=()=>{d(),u.end()},_=()=>{d(),u.setStatus({code:2,message:"cancelled"}),u.end()};o.once("finish",m),o.once("close",_),e._sentryCleanup=d}return u}function ate(e){return e.name==="router"?"router":e.name==="bound dispatch"||e.name==="handle"?"request_handler":"middleware"}function cte(e){let t=Q(),n=t&&Oe(t);n&&oe(n).data[H]==="http.server"&&n.setAttribute(Fe,e)}function lte(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 _n(e,r,!0)}catch{return!1}}var pte="Express",ute=((e={})=>({name:pte,setupOnce(){gN.tracingChannel&&me(()=>{DF(e,gN.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})),BF=ute;import*as XF from"diagnostics_channel";import*as _N from"diagnostics_channel";import*as HF from"net";function FF(e,t){return L({name:`${e} ${t.path}`,op:"db.query",kind:D.CLIENT,attributes:{[S]:"auto.firebase.orchestrion.firestore",[pr]:e,...mte(t)}})}function dte(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(HF.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(":");r!==-1?(t=e.host.slice(0,r),n=e.host.slice(r+1)):t=e.host}return{address:t,port:n?parseInt(n,10):void 0}}function mte(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},i={[ua]:e.path,[Ii]:t.name,[dt]:"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:o,port:s}=dte(r);return o&&(i[_t]=o),s&&(i[ht]=s),i}var WF="auto.firebase.orchestrion.functions",VF="__sentryFirebaseWrapped";function YF(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[VF]||(n[r]=fte(i,t))}function fte(e,t){let n=async function(...r){let i=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",o={[S]:WF,[K0]:i,[td]:t,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(o["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(o["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),Le({name:`firebase.function.${t}`,op:"function.firebase",kind:D.SERVER,attributes:o},async s=>{try{let c=await e.apply(this,r);return s.end(),c}catch(c){throw s.setStatus({code:2}),ge(c,{mechanism:{type:WF,handled:!1}}),s.end(),await ts(2e3),c}})};return n[VF]=!0,n}var gte=[{channel:A.FIREBASE_FIRESTORE_ADD_DOC,spanName:"addDoc",useParent:!1},{channel:A.FIREBASE_FIRESTORE_GET_DOCS,spanName:"getDocs",useParent:!1},{channel:A.FIREBASE_FIRESTORE_SET_DOC,spanName:"setDoc",useParent:!0},{channel:A.FIREBASE_FIRESTORE_DELETE_DOC,spanName:"deleteDoc",useParent:!0}],_te=[{channel:A.FIREBASE_FUNCTIONS_HTTP_REQUEST,triggerType:"http.request"},{channel:A.FIREBASE_FUNCTIONS_HTTP_CALL,triggerType:"http.call"},{channel:A.FIREBASE_FUNCTIONS_FIRESTORE_CREATED,triggerType:"firestore.document.created"},{channel:A.FIREBASE_FUNCTIONS_FIRESTORE_UPDATED,triggerType:"firestore.document.updated"},{channel:A.FIREBASE_FUNCTIONS_FIRESTORE_DELETED,triggerType:"firestore.document.deleted"},{channel:A.FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN,triggerType:"firestore.document.written"},{channel:A.FIREBASE_FUNCTIONS_SCHEDULER,triggerType:"scheduler.scheduled"},{channel:A.FIREBASE_FUNCTIONS_STORAGE_FINALIZED,triggerType:"storage.object.finalized"},{channel:A.FIREBASE_FUNCTIONS_STORAGE_ARCHIVED,triggerType:"storage.object.archived"},{channel:A.FIREBASE_FUNCTIONS_STORAGE_DELETED,triggerType:"storage.object.deleted"},{channel:A.FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED,triggerType:"storage.object.metadataUpdated"}],f_=()=>{};function jF(e){try{return e()}catch(t){J&&g.warn("[orchestrion:firebase] error handling channel event",t);return}}function ZF(){for(let{channel:e,spanName:t,useParent:n}of gte)ee(_N.tracingChannel(e),r=>jF(()=>{let i=r.arguments[0];if(!i)return;let o=n&&i.parent||i;return FF(t,o)}));for(let{channel:e,triggerType:t}of _te)_N.tracingChannel(e).subscribe({start:n=>{jF(()=>YF(n,t))},end:f_,asyncStart:f_,asyncEnd:f_,error:f_})}var hte="Firebase",bte=(()=>({name:hte,setupOnce(){XF.tracingChannel&&me(()=>{ZF()})}})),KF=bte;function mu(){return!!te.__SENTRY_ORCHESTRION__}function hN(){let{runtime:e,bundler:t}=te.__SENTRY_ORCHESTRION__??{};if(!e&&!t){g.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}g.log(e?`[Sentry] Runtime hook registered, injected libraries=${JSON.stringify(e)}`:"[Sentry] Runtime hook not registered"),g.log(t?`[Sentry] Bundler plugin ran, injected libraries=${JSON.stringify(t)}`:"[Sentry] Bundler plugin did not run")}import*as Lc from"diagnostics_channel";var yte="RedisChannel",yN="auto.db.orchestrion.redis",$F="db.connection_string",SN="redis";function qF(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function JF(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function Ste(e){let t=e[0];return B(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function Ete(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 zF(e){return{[ke]:SN,[Me]:e?.socket?.host,[Pe]:e?.socket?.port,[$F]:Ete(e?.url),[S]:yN}}function e2(e,t,n){return L({name:`redis-${e}`,kind:D.CLIENT,attributes:{...n,[H]:"db",[Ye]:ai(e,t)}})}function Tte(e){let t=Lc.tracingChannel(A.REDIS_COMMAND),n=()=>{};t.subscribe({end:n,asyncStart:n,asyncEnd:n,start(r){let i=r.arguments?.[0];if(!i||typeof i!="object")return;let o=i.callback;if(typeof o!="function")return;let s=r.self,c={[ke]:SN,[S]:yN};c[Me]=s?.connection_options?.host,c[Pe]=s?.connection_options?.port,s?.address&&(c[$F]=`redis://${s.address}`);let a=e2(i.command,i.args??[],c);r._sentrySpan=a;let l=Q();i.callback=function(p,u){p||JF(e,a,i.command,i.args??[],u),qF(a,p);let d=arguments;return se(l??null,()=>o.apply(this,d))}},error(r){let i=r._sentrySpan;i&&qF(i,r.error)}})}function QF(e,t,n){let r=Lc.tracingChannel(e);ee(r,i=>{let o=t(i);if(!o?.length)return;let s=String(o[0]),c=i.self?.options;return e2(s,o.slice(1),zF(c))},{beforeSpanEnd(i,o){if("error"in o||!n)return;let s=t(o);s?.length&&JF(n,i,String(s[0]),s.slice(1),o.result)}})}function Ite(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function Ate(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(!(typeof t?.transformArguments!="function"||!Array.isArray(n)))try{return t.transformArguments(...Ste(n))}catch{return}}function Nte(){let e=Lc.tracingChannel(A.NODE_REDIS_CONNECT);ee(e,t=>{let n=t.self?.options;return L({name:"redis-connect",kind:D.CLIENT,attributes:{...zF(n),[H]:"db"}})})}function bN(e,t){let n=Lc.tracingChannel(e);ee(n,r=>{let i=r.arguments?.[0],o=Array.isArray(i)?i.length:void 0,s=r.self?.options?.socket;return L({name:t(r),kind:D.CLIENT,attributes:{[S]:yN,[H]:"db.redis",[dt]:SN,...o&&o>1?{[ma]:o}:{},...s?.host!=null?{[_t]:s.host}:{},...s?.port!=null?{[ht]:s.port}:{}}})})}var Rte=((e={})=>{let t=e.responseHook;return{name:yte,setupOnce(){Lc.tracingChannel&&(J&&g.log(`[orchestrion:redis] subscribing to "${A.REDIS_COMMAND}" and node-redis channels`),Tte(t),me(()=>{QF(A.NODE_REDIS_COMMAND,Ite,t),QF(A.NODE_REDIS_EXECUTOR,Ate,t),Nte(),bN(A.NODE_REDIS_MULTI,()=>"MULTI"),bN(A.NODE_REDIS_PIPELINE,()=>"PIPELINE"),bN(A.NODE_REDIS_BATCH,n=>n.arguments?.[2]!==void 0?"MULTI":"PIPELINE")}))}}}),EN=Rte;var TN={postgresIntegration:rF,postgresJsIntegration:pF,mongoIntegration:UH,mysqlIntegration:WH,mysql2Integration:YH,genericPoolIntegration:DB,mongooseIntegration:FH,lruMemoizerIntegration:wH,openaiIntegration:XH,anthropicIntegration:EB,googleGenAIIntegration:WB,langChainIntegration:PH,langGraphIntegration:MH,vercelAiIntegration:RF,amqplibIntegration:bB,hapiIntegration:dH,koaIntegration:_H,expressIntegration:BF,graphqlIntegration:sH,kafkajsIntegration:vH,tediousIntegration:mF,awsIntegration:LB,firebaseIntegration:KF};var t2="Knex",vte=fe(t2,()=>new kg),Ote=(()=>({name:t2,setupOnce(){mu()?tN().setupOnce?.():vte()}})),Cte=Ote;import{EventEmitter as xte}from"events";var n2="db.sql.table",r2="mssql";function i2(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 o2=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};var Pte="@sentry/instrumentation-tedious",a2=Symbol("opentelemetry.instrumentation-tedious.current-database"),s2=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function g_(e){Object.defineProperty(this,a2,{value:e,writable:!0})}var c2=class l2 extends le{constructor(t={}){super(Pte,q,t)}init(){return[new re(l2.COMPONENT,[">=1.11.0 <20"],t=>{let n=t.Connection.prototype;for(let r of s2)w(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r));return w(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),t},t=>{if(t===void 0)return;let n=t.Connection.prototype;for(let r of s2)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(t){return function(){return g_.call(this,this.config?.options?.database),this.removeListener("databaseChange",g_),this.on("databaseChange",g_),this.once("end",()=>{this.removeListener("databaseChange",g_)}),t.apply(this,arguments)}}_patchQuery(t){return n=>{let r=this;function i(o){if(!(o instanceof xte))return r._diag.warn(`Unexpected invocation of patched ${t} method. Span not recorded`),n.apply(this,arguments);let s=0,c=0,a=()=>c++,l=()=>s++,p=this[a2],u=(h=>h.sqlTextOrProcedure==="sp_prepare"&&h.parametersByName?.stmt?.value?h.parametersByName.stmt.value:h.sqlTextOrProcedure)(o),d={[S]:"auto.db.otel.tedious",[ke]:r2,[Et]:p,[Ut]:this.config?.userName??this.config?.authentication?.options?.userName,[Ye]:u,[n2]:o.table,[Me]:this.config?.server,[Pe]:this.config?.options?.port},m=L({name:i2(t,p,u,o.table),kind:D.CLIENT,attributes:d}),_=o2(h=>{o.removeListener("done",a),o.removeListener("doneInProc",a),o.removeListener("doneProc",l),o.removeListener("error",_),this.removeListener("end",_),m.setAttribute("tedious.procedure_count",s),m.setAttribute("tedious.statement_count",c),h&&m.setStatus({code:2,message:h.message}),m.end()});return o.on("done",a),o.on("doneInProc",a),o.on("doneProc",l),o.once("error",_),this.on("end",_),typeof o.callback=="function"?r._wrap(o,"callback",r._patchCallbackQuery(_)):r._diag.error("Expected request.callback to be a function"),se(m,()=>n.apply(this,arguments))}return Object.defineProperty(i,"length",{value:n.length,writable:!1}),i}}_patchCallbackQuery(t){return n=>function(r,i,o){return t(r),n.apply(this,arguments)}}};c2.COMPONENT="tedious";var p2=c2;var u2="Tedious",IN=fe(u2,()=>new p2({})),kte=(()=>({name:u2,setupOnce(){IN()}})),AN=kte;var NN="generic-pool",Lte="@sentry/instrumentation-generic-pool",__=class extends le{constructor(t={}){super(Lte,q,t),this._isDisabled=!1}init(){return[new re(NN,[">=3.0.0 <4"],t=>{let n=t.Pool;return w(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),t},t=>{let n=t.Pool;return this._unwrap(n.prototype,"acquire"),t}),new re(NN,[">=2.4.0 <3"],t=>{let n=t.Pool;return w(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),t},t=>{let n=t.Pool;return this._unwrap(n.prototype,"acquire"),t}),new re(NN,[">=2.0.0 <2.4"],t=>(this._isDisabled=!1,w(t.Pool)&&this._unwrap(t,"Pool"),this._wrap(t,"Pool",this._poolWrapper.bind(this)),t),t=>(this._isDisabled=!0,t))]}_acquirePatcher(t){return function(...r){return Se({name:"generic-pool.acquire",attributes:{[S]:"auto.db.otel.generic_pool"}},()=>t.call(this,...r))}}_poolWrapper(t){let n=this._wrap.bind(this),r=this._acquireWithCallbacksPatcher.bind(this);return function(...o){let s=t.apply(this,o);return n(s,"acquire",r),s}}_acquireWithCallbacksPatcher(t){let n=()=>this._isDisabled;return function(i,o){return n()?t.call(this,i,o):Le({name:"generic-pool.acquire",attributes:{[S]:"auto.db.otel.generic_pool"}},s=>{t.call(this,(c,a)=>{c&&s.setStatus({code:2,message:"internal_error"}),s.end(),i&&i(c,a)},o)})}}};var d2="GenericPool",RN=fe(d2,()=>new __({})),Mte=(()=>({name:d2,setupOnce(){RN()}})),vN=Mte;var CN="dataloader",wte="@sentry/instrumentation-dataloader",Mc="auto.db.otel.dataloader";function Gte(e){return e[Symbol.toStringTag]==="Module"}function m2(e){return Gte(e)?e.default:e}function wc(e,t){let n=e.name;return n?`${CN}.${t} ${n}`:`${CN}.${t}`}function Gc(e){if(e==="load"||e==="loadMany"||e==="batch")return"cache.get"}function ON(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}var h_=class extends le{constructor(t={}){super(wte,q,t)}init(){return[new re(CN,[">=2.0.0 <3"],t=>{let n=m2(t);return this._patchLoad(n.prototype),this._patchLoadMany(n.prototype),this._patchPrime(n.prototype),this._patchClear(n.prototype),this._patchClearAll(n.prototype),this._getPatchedConstructor(n)},t=>{let n=m2(t);["load","loadMany","prime","clear","clearAll"].forEach(r=>{w(n.prototype[r])&&this._unwrap(n.prototype,r)})})]}_wrapBatchLoadFn(t){let n=this;return function(...i){return n.isEnabled()?Se({name:wc(this,"batch"),links:this._batch?.spanLinks,attributes:{[S]:Mc,[H]:Gc("batch"),[pa]:ON(i[0])},onlyIfParent:!0},()=>t.apply(this,i)):t.call(this,...i)}}_getPatchedConstructor(t){let n=this,r=t.prototype;if(!n.isEnabled())return t;function i(...o){return typeof o[0]=="function"&&(w(o[0])&&n._unwrap(o,0),o[0]=n._wrapBatchLoadFn(o[0])),t.apply(this,o)}return i.prototype=r,i}_patchLoad(t){w(t.load)&&this._unwrap(t,"load"),this._wrap(t,"load",this._getPatchedLoad.bind(this))}_getPatchedLoad(t){return function(...r){return Se({name:wc(this,"load"),kind:D.CLIENT,attributes:{[S]:Mc,[H]:Gc("load"),[pa]:ON(r[0])},onlyIfParent:!0},i=>{let o=t.call(this,...r);return this._batch&&i.isRecording()&&(this._batch.spanLinks||(this._batch.spanLinks=[]),this._batch.spanLinks.push({context:i.spanContext()})),o})}}_patchLoadMany(t){w(t.loadMany)&&this._unwrap(t,"loadMany"),this._wrap(t,"loadMany",this._getPatchedLoadMany.bind(this))}_getPatchedLoadMany(t){return function(...r){return Se({name:wc(this,"loadMany"),kind:D.CLIENT,attributes:{[S]:Mc,[H]:Gc("loadMany"),[pa]:ON(r[0])},onlyIfParent:!0},()=>t.call(this,...r))}}_patchPrime(t){w(t.prime)&&this._unwrap(t,"prime"),this._wrap(t,"prime",this._getPatchedPrime.bind(this))}_getPatchedPrime(t){return function(...r){return Se({name:wc(this,"prime"),kind:D.CLIENT,attributes:{[S]:Mc,[H]:Gc("prime")},onlyIfParent:!0},()=>t.call(this,...r))}}_patchClear(t){w(t.clear)&&this._unwrap(t,"clear"),this._wrap(t,"clear",this._getPatchedClear.bind(this))}_getPatchedClear(t){return function(...r){return Se({name:wc(this,"clear"),kind:D.CLIENT,attributes:{[S]:Mc,[H]:Gc("clear")},onlyIfParent:!0},()=>t.call(this,...r))}}_patchClearAll(t){w(t.clearAll)&&this._unwrap(t,"clearAll"),this._wrap(t,"clearAll",this._getPatchedClearAll.bind(this))}_getPatchedClearAll(t){return function(...r){return Se({name:wc(this,"clearAll"),kind:D.CLIENT,attributes:{[S]:Mc,[H]:Gc("clearAll")},onlyIfParent:!0},()=>t.call(this,...r))}}};var f2="Dataloader",Ute=fe(f2,()=>new h_),Dte=(()=>({name:f2,setupOnce(){mu()?UA().setupOnce?.():Ute()}})),Bte=Dte;var dn=(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))(dn||{});var g2="messaging.operation",xN="messaging.destination",PN="messaging.destination_kind",kN="messaging.rabbitmq.routing_key",LN="messaging.protocol",_2="messaging.protocol_version",h2="messaging.url",MN="messaging.message_id",wN="messaging.conversation_id",GN="topic",b2="process";var Hte="auto.amqplib.otel.publisher",Fte="auto.amqplib.otel.consumer",b_=Symbol("opentelemetry.amqplib.message.stored-span"),ko=Symbol("opentelemetry.amqplib.channel.spans-not-ended"),y_=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer"),S_=Symbol("opentelemetry.amqplib.connection.attributes"),E_=Symbol("sentry.amqplib.channel.is-confirm-publishing"),Wte=e=>e!==""?e:"<default>",Vte=e=>e.replace(/:[^:@/]*@/,":***@"),y2=(e,t)=>e||(t==="AMQP"?5672:5671),S2=e=>{let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()},E2=e=>e||"localhost",T2=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[Dt]:t}:{}},I2=e=>{let t={[_2]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,i=S2(r?.protocol);t[LN]=i,t[Me]=E2(r?.hostname),t[Pe]=y2(r.port,i)}else{let r=Vte(n);t[h2]=r;try{let i=new URL(r),o=S2(i.protocol);t[LN]=o,t[Me]=E2(i.hostname),t[Pe]=y2(i.port?parseInt(i.port):void 0,o)}catch{}}return t};function UN(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}function DN(e,t,n,r){let i=Wte(e),o=L({name:`publish ${i}`,kind:gt.PRODUCER,attributes:{...n.connection[S_],[xN]:e,[PN]:GN,[kN]:t,[MN]:r?.messageId,[wN]:r?.correlationId,[S]:Hte}}),s=r??{};s.headers=s.headers??{};let c=tt({span:o});return c["sentry-trace"]&&(s.headers["sentry-trace"]=c["sentry-trace"]),c.baggage&&(s.headers.baggage=c.baggage),{span:o,modifiedOptions:s}}function A2(e,t,n){return L({name:`${e} process`,kind:gt.CONSUMER,attributes:{...n?.connection?.[S_],[xN]:t.fields?.exchange,[PN]:GN,[kN]:t.fields?.routingKey,[g2]:b2,[MN]:t?.properties.messageId,[wN]:t?.properties.correlationId,[S]:Fte}})}var N2=1e3*60;function fu(e,t,n,r){let i=e[b_];i&&(t!==!1&&i.setStatus({code:2,message:n!==dn.ChannelClosed&&n!==dn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),i.end(),e[b_]=void 0)}function BN(e,t,n,r){(e[ko]??[]).forEach(o=>{fu(o.msg,t,n,r)}),e[ko]=[]}function Yte(e){let t=lt(),n=e[ko]??[],r;for(r=0;r<n.length;r++){let i=n[r];if((t-i.timeOfConsume)*1e3<N2)break;fu(i.msg,null,dn.InstrumentationTimeout,!0)}n.splice(0,r)}function R2(e){return function(n,r,i){return e.call(this,n,r,function(o,s){if(o==null){let c=I2(n),a=T2(s);s[S_]={...c,...a}}i.apply(this,arguments)})}}function v2(e){return function(n){if(n==="close"){BN(this,!0,dn.ChannelClosed,void 0);let r=this[y_];r&&clearInterval(r),this[y_]=void 0}else n==="error"&&BN(this,!0,dn.ChannelError,void 0);return e.apply(this,arguments)}}function HN(e,t){return n=>function(i){return BN(this,e,t,i),n.apply(this,arguments)}}function T_(e,t){return n=>function(i,o,s){let c=this,a=t===dn.Reject?o:s,l=c[ko]??[],p=l.findIndex(u=>u.msg===i);if(p<0)fu(i,e,t,a);else if(t!==dn.Reject&&o){for(let u=0;u<=p;u++)fu(l[u].msg,e,t,a);l.splice(0,p+1)}else fu(i,e,t,a),l.splice(p,1);return n.apply(this,arguments)}}function O2(e){return function(n,r,i){let o=this;if(!Object.prototype.hasOwnProperty.call(o,ko)){let a=setInterval(()=>{Yte(o)},N2);a.unref(),o[y_]=a,o[ko]=[]}let s=function(a){if(!a)return r.call(this,a);let l=a.properties.headers??{},p=UN(l,"sentry-trace"),u=UN(l,"baggage");vn({sentryTrace:p,baggage:u},()=>{let d=A2(n,a,o);i?.noAck||(o[ko].push({msg:a,timeOfConsume:lt()}),a[b_]=d),se(d,()=>{r.call(this,a)}),i?.noAck&&d.end()})},c=Array.prototype.slice.call(arguments);return c[1]=s,e.apply(this,c)}}function C2(e){return function(n,r,i,o,s){let c=this,{span:a,modifiedOptions:l}=DN(n,r,c,o),p=function(d,m){try{se(a,()=>{s?.call(this,d,m)})}finally{d&&a.setStatus({code:2,message:"message confirmation has been nack'ed"}),a.end()}},u=[...arguments];u[3]=l,u[4]=p,c[E_]=!0;try{return e.apply(this,u)}finally{c[E_]=!1}}}function x2(e){return function(n,r,i,o){if(this[E_])return e.apply(this,arguments);let s=this,{span:c,modifiedOptions:a}=DN(n,r,s,o),l=[...arguments];l[3]=a;let p=e.apply(this,l);return c.end(),p}}var jte="@sentry/instrumentation-amqplib",I_=[">=0.5.5 <2"],A_=class extends le{constructor(t={}){super(jte,q,t)}init(){let t=new Re("amqplib/lib/channel_model.js",I_,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Re("amqplib/lib/callback_model.js",I_,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Re("amqplib/lib/connect.js",I_,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new re("amqplib",I_,void 0,void 0,[t,r,n])}patchConnect(t){let n=this.unpatchConnect(t);return w(n.connect)||this._wrap(n,"connect",R2),n}unpatchConnect(t){return w(t.connect)&&this._unwrap(t,"connect"),t}patchChannelModel(t){return w(t.Channel.prototype.publish)||this._wrap(t.Channel.prototype,"publish",x2),w(t.Channel.prototype.consume)||this._wrap(t.Channel.prototype,"consume",O2),w(t.Channel.prototype.ack)||this._wrap(t.Channel.prototype,"ack",T_(!1,dn.Ack)),w(t.Channel.prototype.nack)||this._wrap(t.Channel.prototype,"nack",T_(!0,dn.Nack)),w(t.Channel.prototype.reject)||this._wrap(t.Channel.prototype,"reject",T_(!0,dn.Reject)),w(t.Channel.prototype.ackAll)||this._wrap(t.Channel.prototype,"ackAll",HN(!1,dn.AckAll)),w(t.Channel.prototype.nackAll)||this._wrap(t.Channel.prototype,"nackAll",HN(!0,dn.NackAll)),w(t.Channel.prototype.emit)||this._wrap(t.Channel.prototype,"emit",v2),w(t.ConfirmChannel.prototype.publish)||this._wrap(t.ConfirmChannel.prototype,"publish",C2),t}unpatchChannelModel(t){return w(t.Channel.prototype.publish)&&this._unwrap(t.Channel.prototype,"publish"),w(t.Channel.prototype.consume)&&this._unwrap(t.Channel.prototype,"consume"),w(t.Channel.prototype.ack)&&this._unwrap(t.Channel.prototype,"ack"),w(t.Channel.prototype.nack)&&this._unwrap(t.Channel.prototype,"nack"),w(t.Channel.prototype.reject)&&this._unwrap(t.Channel.prototype,"reject"),w(t.Channel.prototype.ackAll)&&this._unwrap(t.Channel.prototype,"ackAll"),w(t.Channel.prototype.nackAll)&&this._unwrap(t.Channel.prototype,"nackAll"),w(t.Channel.prototype.emit)&&this._unwrap(t.Channel.prototype,"emit"),w(t.ConfirmChannel.prototype.publish)&&this._unwrap(t.ConfirmChannel.prototype,"publish"),t}};var P2="Amqplib",FN=fe(P2,()=>new A_),Zte=(()=>({name:P2,setupOnce(){FN()}})),WN=Zte;var N_="VercelAI";var Xte=[">=3.0.0 <7"],k2=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function Kte(e){if(typeof e!="object"||e===null)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 qte(e){if(typeof e!="object"||e===null||!("content"in e)||typeof e.consumeStream=="function")return;let t=e;Array.isArray(t.content)&&(Qte(t.content),$te(t.content))}function Qte(e){for(let t of e){if(!Kte(t))continue;let n=jy(t.toolCallId);n?He(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",t.toolName),r.setTag("vercel.ai.tool.callId",t.toolCallId),r.setLevel("error"),ge(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):He(r=>{r.setTag("vercel.ai.tool.name",t.toolName),r.setTag("vercel.ai.tool.callId",t.toolCallId),r.setLevel("error"),ge(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function $te(e){for(let t of e)typeof t=="object"&&t!==null&&"toolCallId"in t&&typeof t.toolCallId=="string"&&Zy(t.toolCallId)}function Jte(e,t,n,r,i){let o=e?.recordInputs!==void 0?e.recordInputs:t.recordInputs!==void 0?t.recordInputs:n===!0?!0:r,s=e?.recordOutputs!==void 0?e.recordOutputs:t.recordOutputs!==void 0?t.recordOutputs:n===!0?!0:i;return{recordInputs:o,recordOutputs:s}}var R_=class extends le{constructor(t={}){super("@sentry/instrumentation-vercel-ai",q,t),this._isPatched=!1,this._callbacks=[]}init(){return new re("ai",Xte,this._patch.bind(this))}callWhenPatched(t){this._isPatched?t():this._callbacks.push(t)}_patch(t){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(i,o,s)=>{let c=s[0].experimental_telemetry||{},a=c.isEnabled,l=O(),p=l?.getIntegrationByName(N_),u=p?.options,d=p?l?.getDataCollectionOptions().genAI:void 0,{recordInputs:m,recordOutputs:_}=Jte(u,c,a,!!d?.inputs,!!d?.outputs);return s[0].experimental_telemetry={...c,isEnabled:a!==void 0?a:!0,recordInputs:m,recordOutputs:_},lr(()=>Reflect.apply(i,o,s),h=>{h&&typeof h=="object"&&Ge(h,"_sentry_active_span",Q())},()=>{},h=>{qte(h)})}});if(Object.prototype.toString.call(t)==="[object Module]"){for(let r of k2)t[r]!=null&&(t[r]=n(t[r]));return t}else{let r=k2.reduce((i,o)=>(t[o]!=null&&(i[o]=n(t[o])),i),{});return{...t,...r}}}};var VN=fe(N_,()=>new R_({}));function zte(e){return!!e.getIntegrationByName("Modules")?.getModules?.()?.ai}var ene=((e={})=>{let t,n=Vp(e);return Ht(n,{options:e,setupOnce(){t=VN()},afterAllSetup(r){e.force??zte(r)?Wd(r):t?.callWhenPatched(()=>Wd(r))}})}),YN=ene;var tne=[">=4.0.0 <8"],v_=class extends le{constructor(t={}){super("@sentry/instrumentation-openai",q,t)}init(){return new re("openai",tne,this._patch.bind(this))}_patch(t){let n=t;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(t,n){let r=t[n];if(!r)return t;let i=this.getConfig(),o=function(...s){if(kn(qr))return Reflect.construct(r,s);let c=Reflect.construct(r,s);return Zd(c,i)};Object.setPrototypeOf(o,r),Object.setPrototypeOf(o.prototype,r.prototype);for(let s of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(s)){let c=Object.getOwnPropertyDescriptor(r,s);c&&Object.defineProperty(o,s,c)}try{t[n]=o}catch{Object.defineProperty(t,n,{value:o,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=o}catch{Object.defineProperty(t,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return t}};var jN=fe(qr,e=>new v_(e)),nne=((e={})=>({name:qr,setupOnce(){jN(e)}})),ZN=nne;var rne=[">=0.19.2 <1.0.0"],O_=class extends le{constructor(t={}){super("@sentry/instrumentation-anthropic-ai",q,t)}init(){return new re("@anthropic-ai/sdk",rne,this._patch.bind(this))}_patch(t){let n=t.Anthropic,r=this.getConfig(),i=function(...o){if(kn(Qr))return Reflect.construct(n,o);let s=Reflect.construct(n,o);return Qd(s,r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let o of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(i,o,s)}try{t.Anthropic=i}catch{Object.defineProperty(t,"Anthropic",{value:i,writable:!0,configurable:!0,enumerable:!0})}if(t.default===n)try{t.default=i}catch{Object.defineProperty(t,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return t}};var XN=fe(Qr,e=>new O_(e)),ine=((e={})=>({name:Qr,options:e,setupOnce(){XN(e)}})),KN=ine;var L2=[">=0.10.0 <2"],C_=class extends le{constructor(t={}){super("@sentry/instrumentation-google-genai",q,t)}init(){return new re("@google/genai",L2,n=>this._patch(n),n=>n,[new Re("@google/genai/dist/node/index.cjs",L2,n=>this._patch(n),n=>n)])}_patch(t){let n=t.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return t;let i=function(...o){if(kn($r))return Reflect.construct(n,o);let s=Reflect.construct(n,o);return zd(s,r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let o of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(i,o,s)}return tp(t,"GoogleGenAI",i),t}};var qN=fe($r,e=>new C_(e)),one=((e={})=>({name:$r,setupOnce(){qN(e)}})),QN=one;var x_=[">=0.1.0 <2.0.0"];function sne(e,t,n){return new Proxy(e,{apply(r,i,o){let c=o[1];return(!c||typeof c!="object"||Array.isArray(c))&&(c={},o[1]=c),c.callbacks=us(c.callbacks,t),Reflect.apply(r,i,o)}})}var P_=class extends le{constructor(t={}){super("@sentry/instrumentation-langchain",q,t)}init(){let t=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)t.push(new re(r,x_,this._patch.bind(this),i=>i,[new Re(`${r}/dist/index.cjs`,x_,this._patch.bind(this),i=>i)]));return t.push(new re("langchain",x_,this._patch.bind(this),r=>r,[new Re("langchain/dist/chat_models/universal.cjs",x_,this._patch.bind(this),r=>r)])),t}_patch(t){Pi([qr,Qr,$r]);let n=this.getConfig(),r=gr(n);return this._patchRunnableMethods(t,r),this._patchEmbeddingsMethods(t,n),t}_patchRunnableMethods(t,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],i=t.universal_exports??t,o=Object.values(i).find(a=>typeof a=="function"&&r.includes(a.name));if(!o)return;let s=o.prototype;if(s.__sentry_patched__)return;s.__sentry_patched__=!0;let c=["invoke","stream","batch"];for(let a of c){let l=s[a];typeof l=="function"&&(s[a]=sne(l,n))}}_patchEmbeddingsMethods(t,n){let r=t.universal_exports??t;for(let i of Object.values(r)){if(typeof i!="function"||!i.prototype)continue;let o=i.prototype;typeof o.embedQuery!="function"||typeof o.embedDocuments!="function"||o.__sentry_patched__||(o.__sentry_patched__=!0,nm(o,n))}}};var $N=fe(Ba,e=>new P_(e)),ane=((e={})=>({name:Ba,setupOnce(){$N(e)}})),JN=ane;var gu=[">=0.0.0 <2.0.0"],k_=class extends le{constructor(t={}){super("@sentry/instrumentation-langgraph",q,t)}init(){return[new re("@langchain/langgraph",gu,this._patch.bind(this),t=>t,[new Re("@langchain/langgraph/dist/index.cjs",gu,this._patch.bind(this),t=>t),new Re("@langchain/langgraph/dist/prebuilt/index.cjs",gu,this._patch.bind(this),t=>t)]),new re("@langchain/langgraph/prebuilt",gu,this._patch.bind(this),t=>t,[new Re("@langchain/langgraph/dist/prebuilt/index.cjs",gu,this._patch.bind(this),t=>t)])]}_patch(t){let r=O()?.getDataCollectionOptions().genAI,i={...this.getConfig(),recordInputs:this.getConfig().recordInputs??r?.inputs??!1,recordOutputs:this.getConfig().recordOutputs??r?.outputs??!1};if(t.StateGraph&&typeof t.StateGraph=="function"&&Jl(t.StateGraph.prototype,i),t.createReactAgent&&typeof t.createReactAgent=="function"){let o=t.createReactAgent;Object.defineProperty(t,"createReactAgent",{value:tS(o,i),writable:!0,enumerable:!0,configurable:!0})}return t}};var zN=fe(Wa,e=>new k_(e)),cne=((e={})=>({name:Wa,setupOnce(){zN(e)}})),eR=cne;var lne=e=>(It()||we(()=>{console.warn("The launchDarklyIntegration() can only be used in the browser.")}),{name:"LaunchDarkly"});function pne(){return It()||we(()=>{console.warn("The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.")}),{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:()=>null}}var une=e=>(It()||we(()=>{console.warn("The openFeatureIntegration() can only be used in the browser.")}),{name:"OpenFeature"}),tR=class{constructor(){It()||we(()=>{console.warn("The OpenFeatureIntegrationHook can only be used in the browser.")})}after(){}error(){}};var dne=e=>(It()||we(()=>{console.warn("The statsigIntegration() can only be used in the browser.")}),{name:"Statsig"});var mne=e=>(It()||we(()=>{console.warn("The unleashIntegration() can only be used in the browser.")}),{name:"Unleash"});var fne=vy;import*as w2 from"net";function G2(e,t,n){let r=new re("@firebase/firestore",e,o=>M2(o,t,n)),i=["@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"];for(let o of i)r.files.push(new Re(o,e,s=>M2(s,t,n),s=>U2(s,n)));return r}function M2(e,t,n){return U2(e,n),t(e,"addDoc",gne()),t(e,"getDocs",hne()),t(e,"setDoc",bne()),t(e,"deleteDoc",_ne()),e}function U2(e,t){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])w(e[n])&&t(e,n);return e}function gne(){return function(t){return function(n,r){return L_("addDoc",n,()=>t(n,r))}}}function _ne(){return function(t){return function(n){return L_("deleteDoc",n.parent||n,()=>t(n))}}}function hne(){return function(t){return function(n){return L_("getDocs",n,()=>t(n))}}}function bne(){return function(t){return function(n,r,i){return L_("setDoc",n.parent||n,()=>typeof i<"u"?t(n,r,i):t(n,r))}}}function L_(e,t,n){return Se({name:`${e} ${t.path}`,op:"db.query",kind:D.CLIENT,attributes:{[S]:"auto.firebase.otel.firestore",[pr]:e,...Sne(t)}},n)}function yne(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(w2.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(":");r!==-1?(t=e.host.slice(0,r),n=e.host.slice(r+1)):t=e.host}return{address:t,port:n?parseInt(n,10):void 0}}function Sne(e){let t=e.firestore.app,n=t.options,i=(e.firestore.toJSON()||{}).settings||{},o={[ua]:e.path,[Ii]:t.name,[dt]:"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:s,port:c}=yne(i);return s&&(o[_t]=s),c&&(o[ht]=c),o}function D2(e,t,n){let r=new re("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:o,triggerType:s})=>{r.files.push(new Re(o,e,c=>Ene(c,t,n,s),c=>B2(c,n)))}),r}function mn(e){return function(n){return function(...r){let i=typeof r[0]=="function"?r[0]:r[1],o=typeof r[0]=="function"?void 0:r[0];if(!i)return n.call(this,...r);let s=async function(...c){let a=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",l={[S]:"auto.firebase.otel.functions","faas.name":a,"faas.trigger":e,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(l["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(l["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),Le({name:`firebase.function.${e}`,op:"http.request",kind:D.SERVER,attributes:l},async p=>{try{let u=await i.apply(this,c);return p.end(),u}catch(u){throw p.setStatus({code:2}),ge(u,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),p.end(),await ts(2e3),u}})};return o?n.call(this,o,s):n.call(this,s)}}}function Ene(e,t,n,r){switch(B2(e,n),r){case"function":t(e,"onRequest",mn("http.request")),t(e,"onCall",mn("http.call"));break;case"firestore":t(e,"onDocumentCreated",mn("firestore.document.created")),t(e,"onDocumentUpdated",mn("firestore.document.updated")),t(e,"onDocumentDeleted",mn("firestore.document.deleted")),t(e,"onDocumentWritten",mn("firestore.document.written")),t(e,"onDocumentCreatedWithAuthContext",mn("firestore.document.created")),t(e,"onDocumentUpdatedWithAuthContext",mn("firestore.document.updated")),t(e,"onDocumentDeletedWithAuthContext",mn("firestore.document.deleted")),t(e,"onDocumentWrittenWithAuthContext",mn("firestore.document.written"));break;case"scheduler":t(e,"onSchedule",mn("scheduler.scheduled"));break;case"storage":t(e,"onObjectFinalized",mn("storage.object.finalized")),t(e,"onObjectArchived",mn("storage.object.archived")),t(e,"onObjectDeleted",mn("storage.object.deleted")),t(e,"onObjectMetadataUpdated",mn("storage.object.metadataUpdated"));break}return e}function B2(e,t){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)w(e[r])&&t(e,r);return e}var Tne=[">=3.0.0 <5"],Ine=[">=6.0.0 <7"],M_=class extends le{constructor(t={}){super("@sentry/instrumentation-firebase",q,t)}init(){let t=[];return t.push(G2(Tne,this._wrap,this._unwrap)),t.push(D2(Ine,this._wrap,this._unwrap)),t}};var H2="Firebase",nR=fe(H2,()=>new M_),Ane=(()=>({name:H2,setupOnce(){nR()}})),rR=Ane;function iR(){return[pT(),YT(),$T(),BI(),lI(),uI(),mI(),hI(),NI(),PI(),Zf(),UI(),WI(),YI(),AN(),vN(),iI(),WN(),sI(),JN(),eR(),YN(),ZN(),KN(),QN(),wI(),rR()]}function F2(){return[V1,lT,VI,VT,Rg,DI,rI,FI,oI,cI,pI,dI,_I,xI,Rg,QT,AI,IN,RN,FN,$N,VN,jN,MI,nR,XN,qN,zN]}var oR=1e6,w_=Symbol.for("opentelemetry.js.api.1");function W2(e){if(de.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[w_];if(n&&!n.trace){if(je&&g.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[w_]=void 0,!de.setGlobalTracerProvider(e))return!1;let r=t[w_];if(r){let{propagation:i,context:o,...s}=n;t[w_]={...s,...r}}return!0}return!1}function sR(e,t={}){e.getOptions().debug&&VE();let[n,r]=vne(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function Nne(e={}){let{debug:t}=e;t&&g.enable(),Mp(),Rne(e.integrations).forEach(n=>{n(),t&&g.log(`[Sentry] Preloaded ${n.id} instrumentation`)})}function Rne(e){let t=F2();return e?t.filter(n=>{let r=n.id;return e.some(i=>r===i||r.startsWith(`${i}.`))}):t}function vne(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||!!t.spanProcessors?.length))return One(e);let r=new Tp({sampler:new Rp(e),resource:sf("node"),forceFlushTimeoutMillis:500,spanProcessors:[new Np({timeout:Cne(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});W2(r),hi.setGlobalPropagator(new uc);let i=new Op;return ce.setGlobalContextManager(i),[r,i.getAsyncLocalStorageLookup()]}function One(e){let t=new vp({resource:sf("node")});if(!W2(t))return je&&g.warn("Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered."),[void 0,void 0];Is("SentryTracerProvider"),hi.setGlobalPropagator(new uc);let n=new Op;return ce.setGlobalContextManager(n),e.on("spanEnd",r=>{of(r,{finalizeStatus:!0})}),ot(e)&&e.on("preprocessSpan",rf),e.on("preprocessEvent",r=>{r.type==="transaction"&&(r.contexts={...r.contexts,otel:{resource:t.resource?.attributes,...r.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function Cne(e){if(e!=null){if(e>oR)return je&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${oR}`),oR;if(e<=0||Number.isNaN(e)){je&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function V2(){return Of().filter(t=>t.name!=="Http"&&t.name!=="NodeFetch").concat(oT(),sT())}function Y2(e){return[...V2(),...De(e)?iR():[]]}function xne(e,t){if(Sc()&&De(t)){let n=bI();if(n){let r=new Set(n.replacedOtelIntegrationNames);return[...e.filter(i=>!r.has(i.name)),...n.integrations]}}return e}function Pne(e={}){return j2(e,Y2)}function j2(e={},t){os(e,"node");let n=Sc()&&De(e)?bI():void 0;n&&n.register();let r=e.defaultIntegrations??t(e);if(n&&Array.isArray(r)&&r.length>0){let o=new Set(n.replacedOtelIntegrationNames);r=[...r.filter(s=>!o.has(s.name)),...n.integrations]}let i=JE({...e,defaultIntegrations:r});return i&&!e.skipOpenTelemetrySetup&&(sR(i,{spanProcessors:e.openTelemetrySpanProcessors}),Cf()),n&&n.detect(),i}function kne(e={}){return j2(e,()=>[])}import*as Dre from"module";import"url";import{isMainThread as Bre,parentPort as Hre}from"worker_threads";var _u=[...XI,...KI,...qI,...QI,...$I,...JI,...zI,...tA,...nA,...rA,...iA,...oA,...sA,...aA,...lA,...pA,...uA,...dA,...mA,...fA,...gA,..._A,...hA,...bA,...yA,...SA,...EA,...TA,...IA],p5e=[...FU,...VU,...jU,...XU,...qU,...$U,...zU,...tD,...rD,...oD,...aD,...lD,...dD,...fD,...bD,...ED,...ID,...ND,...CD,...PD,...LD,...wD,...UD,...BD,...FD,...VD,...jD,...XD,...qD];function Lne(e=[]){return[...Ol([..._u,...e].map(t=>t.module.name)),"@remix-run/node"]}var u5e=Lne();function Lo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var X2=Mne;function Mne(e,t){let[n]=K2(e,"");for(let r of Gne(t))if(wne(r,n))return!0;return!1}function wne(e,t){for(let[n,r]of e)if(!Bne(t,r,n))return!1;return!0}function Z2(e){return e==="latest"&&(e=">=0"),e.match(/^([^\d+]*)(\d.*)$/)||[null,"","*.*.*"]}function Gne(e){let t=[],n=[],r=e.trim().split(/\s+/);for(let i=0;i<r.length;i++){let o=r[i];if(o==="-")continue;if(o==="||"){t.push(n),n=[];continue}if(/^[<>=~v^]+$/.test(o)&&i+1<r.length){r[i+1]=o+r[i+1];continue}let s=Z2(o),c=s[1]||"=";c.endsWith("v")&&(c=c.slice(0,-1));let[a,l]=K2(s[2],c);if(i+2<r.length&&r[i+1]==="-"){let p=Z2(r[i+2]);r[i+2]="<="+(p[2].indexOf("-")===-1?p[2]+".*.*":p[2]),l=">="}if(l[0]==="~"){let p=s[2].split("-")[0].split(".").length;n.push([">=",a]),n.push(["<",p===1?Uc(a,0):Uc(a,1)])}else if(l[0]==="^"){let p=a[0]!==0?0:a[1]!==0?1:2;n.push([">=",a]),n.push(["<",p===0?Uc(a,0):p===1?Uc(a,1):Uc(a,2)])}else n.push([l.replace("~","").replace("^",""),a])}return n.length&&t.push(n),t}function Uc(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 Une(e){return e==="x"||e==="X"||e==="*"||e==="latest"?-1:Number(e)}function Dne(e){return/^\d+$/.test(e)?Number(e):e}function Mo(e,t,n){return n===-1?e!=="<":e==="="?t===n:e===">"?t>n:e===">="?t>=n:e==="<"?t<n:e==="<="?t<=n:!1}function K2(e,t){e=e.split("+")[0];let[n,r]=e.split("-"),i=n.split(".").map(Une).slice(0,3),o=Math.max(i.length-1,0);return t===">"?(t=">=",i.push(0,0,0),i[o]++):t===""?i.push(0,0,0):i.push(-1,-1,-1),r?[i.slice(0,3).concat(r.split(".").map(Dne)),t]:[i.slice(0,3),t]}function Bne(e,t,n){if(!Mo("=",e[0],t[0]))return Mo(n,e[0],t[0]);if(!Mo("=",e[1],t[1]))return Mo(n,e[1],t[1]);if(!Mo("=",e[2],t[2])||e.length===3&&t.length===3)return Mo(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(Mo(n,e[r]||"",t[r]||""))return!0;return!1}function cR(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 pR(e,t){return(function(n){if(Array.isArray(n))return n})(e)||(function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,s,c,a,l=[],p=!0,u=!1;try{if(c=(i=i.call(n)).next,r!==0)for(;!(p=(o=c.call(i)).done)&&(l.push(o.value),l.length!==r);p=!0);}catch(d){u=!0,s=d}finally{try{if(!p&&i.return!=null&&(a=i.return(),Object(a)!==a))return}finally{if(u)throw s}}return l}})(e,t)||z2(e,t)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
35
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Hne(e){return(function(t){if(Array.isArray(t))return cR(t)})(e)||(function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)})(e)||z2(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
36
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function hu(e){return(hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function z2(e,t){if(e){if(typeof e=="string")return cR(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)?cR(e,t):void 0}}function eW(e,t){return e(t={exports:{}},t.exports),t.exports}var G_=eW((function(e,t){(function n(r){var i,o,s,c,a,l;function p(N){var R,P,Y={};for(R in N)N.hasOwnProperty(R)&&(P=N[R],Y[R]=typeof P=="object"&&P!==null?p(P):P);return Y}function u(N,R){this.parent=N,this.key=R}function d(N,R,P,Y){this.node=N,this.path=R,this.wrap=P,this.ref=Y}function m(){}function _(N){return N!=null&&typeof N=="object"&&typeof N.type=="string"}function h(N,R){return(N===i.ObjectExpression||N===i.ObjectPattern)&&R==="properties"}function b(N,R){for(var P=N.length-1;P>=0;--P)if(N[P].node===R)return!0;return!1}function v(N,R){return new m().traverse(N,R)}function M(N,R){var P;return P=(function(Y,T){var G,k,U,ae;for(k=Y.length,U=0;k;)T(Y[ae=U+(G=k>>>1)])?k=G:(U=ae+1,k-=G+1);return U})(R,(function(Y){return Y.range[0]>N.range[0]})),N.extendedRange=[N.range[0],N.range[1]],P!==R.length&&(N.extendedRange[1]=R[P].range[0]),(P-=1)>=0&&(N.extendedRange[0]=R[P].range[1]),N}return i={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"},s={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"]},o={Break:c={},Skip:a={},Remove:l={}},u.prototype.replace=function(N){this.parent[this.key]=N},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},m.prototype.path=function(){var N,R,P,Y,T;function G(k,U){if(Array.isArray(U))for(P=0,Y=U.length;P<Y;++P)k.push(U[P]);else k.push(U)}if(!this.__current.path)return null;for(T=[],N=2,R=this.__leavelist.length;N<R;++N)G(T,this.__leavelist[N].path);return G(T,this.__current.path),T},m.prototype.type=function(){return this.current().type||this.__current.wrap},m.prototype.parents=function(){var N,R,P;for(P=[],N=1,R=this.__leavelist.length;N<R;++N)P.push(this.__leavelist[N].node);return P},m.prototype.current=function(){return this.__current.node},m.prototype.__execute=function(N,R){var P,Y;return Y=void 0,P=this.__current,this.__current=R,this.__state=null,N&&(Y=N.call(this,R.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=P,Y},m.prototype.notify=function(N){this.__state=N},m.prototype.skip=function(){this.notify(a)},m.prototype.break=function(){this.notify(c)},m.prototype.remove=function(){this.notify(l)},m.prototype.__initialize=function(N,R){this.visitor=R,this.root=N,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,R.fallback==="iteration"?this.__fallback=Object.keys:typeof R.fallback=="function"&&(this.__fallback=R.fallback),this.__keys=s,R.keys&&(this.__keys=Object.assign(Object.create(this.__keys),R.keys))},m.prototype.traverse=function(N,R){var P,Y,T,G,k,U,ae,ue,Ne,Te,Ce,Qe;for(this.__initialize(N,R),Qe={},P=this.__worklist,Y=this.__leavelist,P.push(new d(N,null,null,null)),Y.push(new d(null,null,null,null));P.length;)if((T=P.pop())!==Qe){if(T.node){if(U=this.__execute(R.enter,T),this.__state===c||U===c)return;if(P.push(Qe),Y.push(T),this.__state===a||U===a)continue;if(k=(G=T.node).type||T.wrap,!(Te=this.__keys[k])){if(!this.__fallback)throw new Error("Unknown node type "+k+".");Te=this.__fallback(G)}for(ue=Te.length;(ue-=1)>=0;)if(Ce=G[ae=Te[ue]]){if(Array.isArray(Ce)){for(Ne=Ce.length;(Ne-=1)>=0;)if(Ce[Ne]&&!b(Y,Ce[Ne])){if(h(k,Te[ue]))T=new d(Ce[Ne],[ae,Ne],"Property",null);else{if(!_(Ce[Ne]))continue;T=new d(Ce[Ne],[ae,Ne],null,null)}P.push(T)}}else if(_(Ce)){if(b(Y,Ce))continue;P.push(new d(Ce,ae,null,null))}}}}else if(T=Y.pop(),U=this.__execute(R.leave,T),this.__state===c||U===c)return},m.prototype.replace=function(N,R){var P,Y,T,G,k,U,ae,ue,Ne,Te,Ce,Qe,Rt;function In(di){var mi,Do,Bo,Yc;if(di.ref.remove()){for(Do=di.ref.key,Yc=di.ref.parent,mi=P.length;mi--;)if((Bo=P[mi]).ref&&Bo.ref.parent===Yc){if(Bo.ref.key<Do)break;--Bo.ref.key}}}for(this.__initialize(N,R),Ce={},P=this.__worklist,Y=this.__leavelist,U=new d(N,null,null,new u(Qe={root:N},"root")),P.push(U),Y.push(U);P.length;)if((U=P.pop())!==Ce){if((k=this.__execute(R.enter,U))!==void 0&&k!==c&&k!==a&&k!==l&&(U.ref.replace(k),U.node=k),this.__state!==l&&k!==l||(In(U),U.node=null),this.__state===c||k===c)return Qe.root;if((T=U.node)&&(P.push(Ce),Y.push(U),this.__state!==a&&k!==a)){if(G=T.type||U.wrap,!(Ne=this.__keys[G])){if(!this.__fallback)throw new Error("Unknown node type "+G+".");Ne=this.__fallback(T)}for(ae=Ne.length;(ae-=1)>=0;)if(Te=T[Rt=Ne[ae]])if(Array.isArray(Te)){for(ue=Te.length;(ue-=1)>=0;)if(Te[ue]){if(h(G,Ne[ae]))U=new d(Te[ue],[Rt,ue],"Property",new u(Te,ue));else{if(!_(Te[ue]))continue;U=new d(Te[ue],[Rt,ue],null,new u(Te,ue))}P.push(U)}}else _(Te)&&P.push(new d(Te,Rt,null,new u(T,Rt)))}}else if(U=Y.pop(),(k=this.__execute(R.leave,U))!==void 0&&k!==c&&k!==a&&k!==l&&U.ref.replace(k),this.__state!==l&&k!==l||In(U),this.__state===c||k===c)return Qe.root;return Qe.root},r.Syntax=i,r.traverse=v,r.replace=function(N,R){return new m().replace(N,R)},r.attachComments=function(N,R,P){var Y,T,G,k,U=[];if(!N.range)throw new Error("attachComments needs range information");if(!P.length){if(R.length){for(G=0,T=R.length;G<T;G+=1)(Y=p(R[G])).extendedRange=[0,N.range[0]],U.push(Y);N.leadingComments=U}return N}for(G=0,T=R.length;G<T;G+=1)U.push(M(p(R[G]),P));return k=0,v(N,{enter:function(ae){for(var ue;k<U.length&&!((ue=U[k]).extendedRange[1]>ae.range[0]);)ue.extendedRange[1]===ae.range[0]?(ae.leadingComments||(ae.leadingComments=[]),ae.leadingComments.push(ue),U.splice(k,1)):k+=1;return k===U.length?o.Break:U[k].extendedRange[0]>ae.range[1]?o.Skip:void 0}}),k=0,v(N,{leave:function(ae){for(var ue;k<U.length&&(ue=U[k],!(ae.range[1]<ue.extendedRange[0]));)ae.range[1]===ue.extendedRange[0]?(ae.trailingComments||(ae.trailingComments=[]),ae.trailingComments.push(ue),U.splice(k,1)):k+=1;return k===U.length?o.Break:U[k].extendedRange[0]>ae.range[1]?o.Skip:void 0}}),N},r.VisitorKeys=s,r.VisitorOption=o,r.Controller=m,r.cloneEnvironment=function(){return n({})},r})(t)})),Fne=eW((function(e){e.exports&&(e.exports=(function(){function t(n,r,i,o){this.message=n,this.expected=r,this.found=i,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)}return(function(n,r){function i(){this.constructor=n}i.prototype=r.prototype,n.prototype=new i})(t,Error),t.buildMessage=function(n,r){var i={literal:function(a){return'"'+s(a.text)+'"'},class:function(a){var l,p="";for(l=0;l<a.parts.length;l++)p+=a.parts[l]instanceof Array?c(a.parts[l][0])+"-"+c(a.parts[l][1]):c(a.parts[l]);return"["+(a.inverted?"^":"")+p+"]"},any:function(a){return"any character"},end:function(a){return"end of input"},other:function(a){return a.description}};function o(a){return a.charCodeAt(0).toString(16).toUpperCase()}function s(a){return a.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(l){return"\\x0"+o(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+o(l)}))}function c(a){return a.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(l){return"\\x0"+o(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+o(l)}))}return"Expected "+(function(a){var l,p,u,d=new Array(a.length);for(l=0;l<a.length;l++)d[l]=(u=a[l],i[u.type](u));if(d.sort(),d.length>0){for(l=1,p=1;l<d.length;l++)d[l-1]!==d[l]&&(d[p]=d[l],p++);d.length=p}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}})(n)+" but "+(function(a){return a?'"'+s(a)+'"':"end of input"})(r)+" found."},{SyntaxError:t,parse:function(n,r){r=r!==void 0?r:{};var i,o,s,c,a={},l={start:XR},p=XR,u=Ke(" ",!1),d=/^[^ [\],():#!=><~+.]/,m=Nr([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),_=Ke(">",!1),h=Ke("~",!1),b=Ke("+",!1),v=Ke(",",!1),M=function(I,F){return[I].concat(F.map((function(V){return V[3]})))},N=Ke("!",!1),R=Ke("*",!1),P=Ke("#",!1),Y=Ke("[",!1),T=Ke("]",!1),G=/^[><!]/,k=Nr([">","<","!"],!1,!1),U=Ke("=",!1),ae=function(I){return(I||"")+"="},ue=/^[><]/,Ne=Nr([">","<"],!1,!1),Te=Ke(".",!1),Ce=function(I,F,V){return{type:"attribute",name:I,operator:F,value:V}},Qe=Ke('"',!1),Rt=/^[^\\"]/,In=Nr(["\\",'"'],!0,!1),di=Ke("\\",!1),mi={type:"any"},Do=function(I,F){return I+F},Bo=function(I){return{type:"literal",value:(F=I.join(""),F.replace(/\\(.)/g,(function(V,y){switch(y){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
37
|
+
`;case"r":return"\r";case"t":return" ";case"v":return"\v";default:return y}})))};var F},Yc=Ke("'",!1),LR=/^[^\\']/,MR=Nr(["\\","'"],!0,!1),Yi=/^[0-9]/,ji=Nr([["0","9"]],!1,!1),WW=Ke("type(",!1),wR=/^[^ )]/,GR=Nr([" ",")"],!0,!1),Ho=Ke(")",!1),UR=/^[imsu]/,DR=Nr(["i","m","s","u"],!1,!1),BR=Ke("/",!1),HR=/^[^\]\\]/,FR=Nr(["]","\\"],!0,!1),WR=/^[^\/\\[]/,VR=Nr(["/","\\","["],!0,!1),VW=Ke(":not(",!1),YW=Ke(":matches(",!1),YR=function(I){return{type:"matches",selectors:I}},jW=Ke(":is(",!1),ZW=Ke(":has(",!1),XW=Ke(":first-child",!1),KW=Ke(":last-child",!1),qW=Ke(":nth-child(",!1),QW=Ke(":nth-last-child(",!1),$W=Ke(":",!1),f=0,Su=[{line:1,column:1}],Ar=0,J_=[],z={};if("startRule"in r){if(!(r.startRule in l))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');p=l[r.startRule]}function Ke(I,F){return{type:"literal",text:I,ignoreCase:F}}function Nr(I,F,V){return{type:"class",parts:I,inverted:F,ignoreCase:V}}function jR(I){var F,V=Su[I];if(V)return V;for(F=I-1;!Su[F];)F--;for(V={line:(V=Su[F]).line,column:V.column};F<I;)n.charCodeAt(F)===10?(V.line++,V.column=1):V.column++,F++;return Su[I]=V,V}function ZR(I,F){var V=jR(I),y=jR(F);return{start:{offset:I,line:V.line,column:V.column},end:{offset:F,line:y.line,column:y.column}}}function j(I){f<Ar||(f>Ar&&(Ar=f,J_=[]),J_.push(I))}function XR(){var I,F,V,y,x=36*f+0,K=z[x];return K?(f=K.nextPos,K.result):(I=f,(F=xe())!==a&&(V=Eu())!==a&&xe()!==a?I=F=(y=V).length===1?y[0]:{type:"matches",selectors:y}:(f=I,I=a),I===a&&(I=f,(F=xe())!==a&&(F=void 0),I=F),z[x]={nextPos:f,result:I},I)}function xe(){var I,F,V=36*f+1,y=z[V];if(y)return f=y.nextPos,y.result;for(I=[],n.charCodeAt(f)===32?(F=" ",f++):(F=a,j(u));F!==a;)I.push(F),n.charCodeAt(f)===32?(F=" ",f++):(F=a,j(u));return z[V]={nextPos:f,result:I},I}function fi(){var I,F,V,y=36*f+2,x=z[y];if(x)return f=x.nextPos,x.result;if(F=[],d.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(m)),V!==a)for(;V!==a;)F.push(V),d.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(m));else F=a;return F!==a&&(F=F.join("")),I=F,z[y]={nextPos:f,result:I},I}function z_(){var I,F,V,y=36*f+3,x=z[y];return x?(f=x.nextPos,x.result):(I=f,(F=xe())!==a?(n.charCodeAt(f)===62?(V=">",f++):(V=a,j(_)),V!==a&&xe()!==a?I=F="child":(f=I,I=a)):(f=I,I=a),I===a&&(I=f,(F=xe())!==a?(n.charCodeAt(f)===126?(V="~",f++):(V=a,j(h)),V!==a&&xe()!==a?I=F="sibling":(f=I,I=a)):(f=I,I=a),I===a&&(I=f,(F=xe())!==a?(n.charCodeAt(f)===43?(V="+",f++):(V=a,j(b)),V!==a&&xe()!==a?I=F="adjacent":(f=I,I=a)):(f=I,I=a),I===a&&(I=f,n.charCodeAt(f)===32?(F=" ",f++):(F=a,j(u)),F!==a&&(V=xe())!==a?I=F="descendant":(f=I,I=a)))),z[y]={nextPos:f,result:I},I)}function Eu(){var I,F,V,y,x,K,X,he,be=36*f+5,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(I=f,(F=Tu())!==a){for(V=[],y=f,(x=xe())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(v)),K!==a&&(X=xe())!==a&&(he=Tu())!==a?y=x=[x,K,X,he]:(f=y,y=a)):(f=y,y=a);y!==a;)V.push(y),y=f,(x=xe())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(v)),K!==a&&(X=xe())!==a&&(he=Tu())!==a?y=x=[x,K,X,he]:(f=y,y=a)):(f=y,y=a);V!==a?I=F=M(F,V):(f=I,I=a)}else f=I,I=a;return z[be]={nextPos:f,result:I},I}function eh(){var I,F,V,y,x,K=36*f+6,X=z[K];return X?(f=X.nextPos,X.result):(I=f,(F=z_())===a&&(F=null),F!==a&&(V=Tu())!==a?(x=V,I=F=(y=F)?{type:y,left:{type:"exactNode"},right:x}:x):(f=I,I=a),z[K]={nextPos:f,result:I},I)}function Tu(){var I,F,V,y,x,K,X,he=36*f+7,be=z[he];if(be)return f=be.nextPos,be.result;if(I=f,(F=th())!==a){for(V=[],y=f,(x=z_())!==a&&(K=th())!==a?y=x=[x,K]:(f=y,y=a);y!==a;)V.push(y),y=f,(x=z_())!==a&&(K=th())!==a?y=x=[x,K]:(f=y,y=a);V!==a?(X=F,I=F=V.reduce((function(ye,at){return{type:at[0],left:ye,right:at[1]}}),X)):(f=I,I=a)}else f=I,I=a;return z[he]={nextPos:f,result:I},I}function th(){var I,F,V,y,x,K,X,he=36*f+8,be=z[he];if(be)return f=be.nextPos,be.result;if(I=f,n.charCodeAt(f)===33?(F="!",f++):(F=a,j(N)),F===a&&(F=null),F!==a){if(V=[],(y=KR())!==a)for(;y!==a;)V.push(y),y=KR();else V=a;V!==a?(x=F,X=(K=V).length===1?K[0]:{type:"compound",selectors:K},x&&(X.subject=!0),I=F=X):(f=I,I=a)}else f=I,I=a;return z[he]={nextPos:f,result:I},I}function KR(){var I,F=36*f+9,V=z[F];return V?(f=V.nextPos,V.result):((I=(function(){var y,x,K=36*f+10,X=z[K];return X?(f=X.nextPos,X.result):(n.charCodeAt(f)===42?(x="*",f++):(x=a,j(R)),x!==a&&(x={type:"wildcard",value:x}),y=x,z[K]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K,X=36*f+11,he=z[X];return he?(f=he.nextPos,he.result):(y=f,n.charCodeAt(f)===35?(x="#",f++):(x=a,j(P)),x===a&&(x=null),x!==a&&(K=fi())!==a?y=x={type:"identifier",value:K}:(f=y,y=a),z[X]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K,X,he=36*f+12,be=z[he];return be?(f=be.nextPos,be.result):(y=f,n.charCodeAt(f)===91?(x="[",f++):(x=a,j(Y)),x!==a&&xe()!==a&&(K=(function(){var ye,at,Un,Ze,zn=36*f+16,on=z[zn];return on?(f=on.nextPos,on.result):(ye=f,(at=nh())!==a&&xe()!==a&&(Un=(function(){var Z,pe,Ie,W=36*f+14,Ae=z[W];return Ae?(f=Ae.nextPos,Ae.result):(Z=f,n.charCodeAt(f)===33?(pe="!",f++):(pe=a,j(N)),pe===a&&(pe=null),pe!==a?(n.charCodeAt(f)===61?(Ie="=",f++):(Ie=a,j(U)),Ie!==a?(pe=ae(pe),Z=pe):(f=Z,Z=a)):(f=Z,Z=a),z[W]={nextPos:f,result:Z},Z)})())!==a&&xe()!==a?((Ze=(function(){var Z,pe,Ie,W,Ae,$e=36*f+20,Dn=z[$e];if(Dn)return f=Dn.nextPos,Dn.result;if(Z=f,n.substr(f,5)==="type("?(pe="type(",f+=5):(pe=a,j(WW)),pe!==a)if(xe()!==a){if(Ie=[],wR.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(GR)),W!==a)for(;W!==a;)Ie.push(W),wR.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(GR));else Ie=a;Ie!==a&&(W=xe())!==a?(n.charCodeAt(f)===41?(Ae=")",f++):(Ae=a,j(Ho)),Ae!==a?(pe={type:"type",value:Ie.join("")},Z=pe):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;else f=Z,Z=a;return z[$e]={nextPos:f,result:Z},Z})())===a&&(Ze=(function(){var Z,pe,Ie,W,Ae,$e,Dn=36*f+22,Rr=z[Dn];if(Rr)return f=Rr.nextPos,Rr.result;if(Z=f,n.charCodeAt(f)===47?(pe="/",f++):(pe=a,j(BR)),pe!==a){if(Ie=[],(W=qR())===a&&(W=Iu())===a&&(W=QR()),W!==a)for(;W!==a;)Ie.push(W),(W=qR())===a&&(W=Iu())===a&&(W=QR());else Ie=a;Ie!==a?(n.charCodeAt(f)===47?(W="/",f++):(W=a,j(BR)),W!==a?((Ae=(function(){var gi,Fo,zR=36*f+21,rh=z[zR];if(rh)return f=rh.nextPos,rh.result;if(gi=[],UR.test(n.charAt(f))?(Fo=n.charAt(f),f++):(Fo=a,j(DR)),Fo!==a)for(;Fo!==a;)gi.push(Fo),UR.test(n.charAt(f))?(Fo=n.charAt(f),f++):(Fo=a,j(DR));else gi=a;return z[zR]={nextPos:f,result:gi},gi})())===a&&(Ae=null),Ae!==a?($e=Ae,pe={type:"regexp",value:new RegExp(Ie.join(""),$e?$e.join(""):"")},Z=pe):(f=Z,Z=a)):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;return z[Dn]={nextPos:f,result:Z},Z})()),Ze!==a?(at=Ce(at,Un,Ze),ye=at):(f=ye,ye=a)):(f=ye,ye=a),ye===a&&(ye=f,(at=nh())!==a&&xe()!==a&&(Un=(function(){var Z,pe,Ie,W=36*f+13,Ae=z[W];return Ae?(f=Ae.nextPos,Ae.result):(Z=f,G.test(n.charAt(f))?(pe=n.charAt(f),f++):(pe=a,j(k)),pe===a&&(pe=null),pe!==a?(n.charCodeAt(f)===61?(Ie="=",f++):(Ie=a,j(U)),Ie!==a?(pe=ae(pe),Z=pe):(f=Z,Z=a)):(f=Z,Z=a),Z===a&&(ue.test(n.charAt(f))?(Z=n.charAt(f),f++):(Z=a,j(Ne))),z[W]={nextPos:f,result:Z},Z)})())!==a&&xe()!==a?((Ze=(function(){var Z,pe,Ie,W,Ae,$e,Dn=36*f+17,Rr=z[Dn];if(Rr)return f=Rr.nextPos,Rr.result;if(Z=f,n.charCodeAt(f)===34?(pe='"',f++):(pe=a,j(Qe)),pe!==a){for(Ie=[],Rt.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(In)),W===a&&(W=f,n.charCodeAt(f)===92?(Ae="\\",f++):(Ae=a,j(di)),Ae!==a?(n.length>f?($e=n.charAt(f),f++):($e=a,j(mi)),$e!==a?(Ae=Do(Ae,$e),W=Ae):(f=W,W=a)):(f=W,W=a));W!==a;)Ie.push(W),Rt.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(In)),W===a&&(W=f,n.charCodeAt(f)===92?(Ae="\\",f++):(Ae=a,j(di)),Ae!==a?(n.length>f?($e=n.charAt(f),f++):($e=a,j(mi)),$e!==a?(Ae=Do(Ae,$e),W=Ae):(f=W,W=a)):(f=W,W=a));Ie!==a?(n.charCodeAt(f)===34?(W='"',f++):(W=a,j(Qe)),W!==a?(pe=Bo(Ie),Z=pe):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;if(Z===a)if(Z=f,n.charCodeAt(f)===39?(pe="'",f++):(pe=a,j(Yc)),pe!==a){for(Ie=[],LR.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(MR)),W===a&&(W=f,n.charCodeAt(f)===92?(Ae="\\",f++):(Ae=a,j(di)),Ae!==a?(n.length>f?($e=n.charAt(f),f++):($e=a,j(mi)),$e!==a?(Ae=Do(Ae,$e),W=Ae):(f=W,W=a)):(f=W,W=a));W!==a;)Ie.push(W),LR.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(MR)),W===a&&(W=f,n.charCodeAt(f)===92?(Ae="\\",f++):(Ae=a,j(di)),Ae!==a?(n.length>f?($e=n.charAt(f),f++):($e=a,j(mi)),$e!==a?(Ae=Do(Ae,$e),W=Ae):(f=W,W=a)):(f=W,W=a));Ie!==a?(n.charCodeAt(f)===39?(W="'",f++):(W=a,j(Yc)),W!==a?(pe=Bo(Ie),Z=pe):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;return z[Dn]={nextPos:f,result:Z},Z})())===a&&(Ze=(function(){var Z,pe,Ie,W,Ae,$e,Dn,Rr=36*f+18,gi=z[Rr];if(gi)return f=gi.nextPos,gi.result;for(Z=f,pe=f,Ie=[],Yi.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(ji));W!==a;)Ie.push(W),Yi.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(ji));if(Ie!==a?(n.charCodeAt(f)===46?(W=".",f++):(W=a,j(Te)),W!==a?pe=Ie=[Ie,W]:(f=pe,pe=a)):(f=pe,pe=a),pe===a&&(pe=null),pe!==a){if(Ie=[],Yi.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(ji)),W!==a)for(;W!==a;)Ie.push(W),Yi.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(ji));else Ie=a;Ie!==a?($e=Ie,Dn=(Ae=pe)?[].concat.apply([],Ae).join(""):"",pe={type:"literal",value:parseFloat(Dn+$e.join(""))},Z=pe):(f=Z,Z=a)}else f=Z,Z=a;return z[Rr]={nextPos:f,result:Z},Z})())===a&&(Ze=(function(){var Z,pe,Ie=36*f+19,W=z[Ie];return W?(f=W.nextPos,W.result):((pe=fi())!==a&&(pe={type:"literal",value:pe}),Z=pe,z[Ie]={nextPos:f,result:Z},Z)})()),Ze!==a?(at=Ce(at,Un,Ze),ye=at):(f=ye,ye=a)):(f=ye,ye=a),ye===a&&(ye=f,(at=nh())!==a&&(at={type:"attribute",name:at}),ye=at)),z[zn]={nextPos:f,result:ye},ye)})())!==a&&xe()!==a?(n.charCodeAt(f)===93?(X="]",f++):(X=a,j(T)),X!==a?y=x=K:(f=y,y=a)):(f=y,y=a),z[he]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K,X,he,be,ye,at,Un=36*f+26,Ze=z[Un];if(Ze)return f=Ze.nextPos,Ze.result;if(y=f,n.charCodeAt(f)===46?(x=".",f++):(x=a,j(Te)),x!==a)if((K=fi())!==a){for(X=[],he=f,n.charCodeAt(f)===46?(be=".",f++):(be=a,j(Te)),be!==a&&(ye=fi())!==a?he=be=[be,ye]:(f=he,he=a);he!==a;)X.push(he),he=f,n.charCodeAt(f)===46?(be=".",f++):(be=a,j(Te)),be!==a&&(ye=fi())!==a?he=be=[be,ye]:(f=he,he=a);X!==a?(at=K,x={type:"field",name:X.reduce((function(zn,on){return zn+on[0]+on[1]}),at)},y=x):(f=y,y=a)}else f=y,y=a;else f=y,y=a;return z[Un]={nextPos:f,result:y},y})())===a&&(I=(function(){var y,x,K,X,he=36*f+27,be=z[he];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,5)===":not("?(x=":not(",f+=5):(x=a,j(VW)),x!==a&&xe()!==a&&(K=Eu())!==a&&xe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Ho)),X!==a?y=x={type:"not",selectors:K}:(f=y,y=a)):(f=y,y=a),z[he]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K,X,he=36*f+28,be=z[he];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,9)===":matches("?(x=":matches(",f+=9):(x=a,j(YW)),x!==a&&xe()!==a&&(K=Eu())!==a&&xe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Ho)),X!==a?(x=YR(K),y=x):(f=y,y=a)):(f=y,y=a),z[he]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K,X,he=36*f+29,be=z[he];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,4)===":is("?(x=":is(",f+=4):(x=a,j(jW)),x!==a&&xe()!==a&&(K=Eu())!==a&&xe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Ho)),X!==a?(x=YR(K),y=x):(f=y,y=a)):(f=y,y=a),z[he]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K,X,he=36*f+30,be=z[he];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,5)===":has("?(x=":has(",f+=5):(x=a,j(ZW)),x!==a&&xe()!==a&&(K=(function(){var ye,at,Un,Ze,zn,on,Z,pe,Ie=36*f+4,W=z[Ie];if(W)return f=W.nextPos,W.result;if(ye=f,(at=eh())!==a){for(Un=[],Ze=f,(zn=xe())!==a?(n.charCodeAt(f)===44?(on=",",f++):(on=a,j(v)),on!==a&&(Z=xe())!==a&&(pe=eh())!==a?Ze=zn=[zn,on,Z,pe]:(f=Ze,Ze=a)):(f=Ze,Ze=a);Ze!==a;)Un.push(Ze),Ze=f,(zn=xe())!==a?(n.charCodeAt(f)===44?(on=",",f++):(on=a,j(v)),on!==a&&(Z=xe())!==a&&(pe=eh())!==a?Ze=zn=[zn,on,Z,pe]:(f=Ze,Ze=a)):(f=Ze,Ze=a);Un!==a?ye=at=M(at,Un):(f=ye,ye=a)}else f=ye,ye=a;return z[Ie]={nextPos:f,result:ye},ye})())!==a&&xe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Ho)),X!==a?y=x={type:"has",selectors:K}:(f=y,y=a)):(f=y,y=a),z[he]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K=36*f+31,X=z[K];return X?(f=X.nextPos,X.result):(n.substr(f,12)===":first-child"?(x=":first-child",f+=12):(x=a,j(XW)),x!==a&&(x=$R(1)),y=x,z[K]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K=36*f+32,X=z[K];return X?(f=X.nextPos,X.result):(n.substr(f,11)===":last-child"?(x=":last-child",f+=11):(x=a,j(KW)),x!==a&&(x=JR(1)),y=x,z[K]={nextPos:f,result:y},y)})())===a&&(I=(function(){var y,x,K,X,he,be=36*f+33,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(y=f,n.substr(f,11)===":nth-child("?(x=":nth-child(",f+=11):(x=a,j(qW)),x!==a)if(xe()!==a){if(K=[],Yi.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(ji)),X!==a)for(;X!==a;)K.push(X),Yi.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(ji));else K=a;K!==a&&(X=xe())!==a?(n.charCodeAt(f)===41?(he=")",f++):(he=a,j(Ho)),he!==a?(x=$R(parseInt(K.join(""),10)),y=x):(f=y,y=a)):(f=y,y=a)}else f=y,y=a;else f=y,y=a;return z[be]={nextPos:f,result:y},y})())===a&&(I=(function(){var y,x,K,X,he,be=36*f+34,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(y=f,n.substr(f,16)===":nth-last-child("?(x=":nth-last-child(",f+=16):(x=a,j(QW)),x!==a)if(xe()!==a){if(K=[],Yi.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(ji)),X!==a)for(;X!==a;)K.push(X),Yi.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(ji));else K=a;K!==a&&(X=xe())!==a?(n.charCodeAt(f)===41?(he=")",f++):(he=a,j(Ho)),he!==a?(x=JR(parseInt(K.join(""),10)),y=x):(f=y,y=a)):(f=y,y=a)}else f=y,y=a;else f=y,y=a;return z[be]={nextPos:f,result:y},y})())===a&&(I=(function(){var y,x,K,X=36*f+35,he=z[X];return he?(f=he.nextPos,he.result):(y=f,n.charCodeAt(f)===58?(x=":",f++):(x=a,j($W)),x!==a&&(K=fi())!==a?y=x={type:"class",name:K}:(f=y,y=a),z[X]={nextPos:f,result:y},y)})()),z[F]={nextPos:f,result:I},I)}function nh(){var I,F,V,y,x,K,X,he,be=36*f+15,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(I=f,(F=fi())!==a){for(V=[],y=f,n.charCodeAt(f)===46?(x=".",f++):(x=a,j(Te)),x!==a&&(K=fi())!==a?y=x=[x,K]:(f=y,y=a);y!==a;)V.push(y),y=f,n.charCodeAt(f)===46?(x=".",f++):(x=a,j(Te)),x!==a&&(K=fi())!==a?y=x=[x,K]:(f=y,y=a);V!==a?(X=F,he=V,I=F=[].concat.apply([X],he).join("")):(f=I,I=a)}else f=I,I=a;return z[be]={nextPos:f,result:I},I}function qR(){var I,F,V,y,x=36*f+23,K=z[x];if(K)return f=K.nextPos,K.result;if(I=f,n.charCodeAt(f)===91?(F="[",f++):(F=a,j(Y)),F!==a){if(V=[],HR.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(FR)),y===a&&(y=Iu()),y!==a)for(;y!==a;)V.push(y),HR.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(FR)),y===a&&(y=Iu());else V=a;V!==a?(n.charCodeAt(f)===93?(y="]",f++):(y=a,j(T)),y!==a?I=F="["+V.join("")+"]":(f=I,I=a)):(f=I,I=a)}else f=I,I=a;return z[x]={nextPos:f,result:I},I}function Iu(){var I,F,V,y=36*f+24,x=z[y];return x?(f=x.nextPos,x.result):(I=f,n.charCodeAt(f)===92?(F="\\",f++):(F=a,j(di)),F!==a?(n.length>f?(V=n.charAt(f),f++):(V=a,j(mi)),V!==a?I=F="\\"+V:(f=I,I=a)):(f=I,I=a),z[y]={nextPos:f,result:I},I)}function QR(){var I,F,V,y=36*f+25,x=z[y];if(x)return f=x.nextPos,x.result;if(F=[],WR.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(VR)),V!==a)for(;V!==a;)F.push(V),WR.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(VR));else F=a;return F!==a&&(F=F.join("")),I=F,z[y]={nextPos:f,result:I},I}function $R(I){return{type:"nth-child",index:{type:"literal",value:I}}}function JR(I){return{type:"nth-last-child",index:{type:"literal",value:I}}}if((i=p())!==a&&f===n.length)return i;throw i!==a&&f<n.length&&j({type:"end"}),o=J_,s=Ar<n.length?n.charAt(Ar):null,c=Ar<n.length?ZR(Ar,Ar+1):ZR(Ar,Ar),new t(t.buildMessage(o,s),o,s,c)}}})())}));function Ir(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var aR=typeof WeakMap=="function"?new WeakMap:null;function Zt(e){if(e==null)return function(){return!0};if(aR!=null){var t=aR.get(e);return t!=null||(t=q2(e),aR.set(e,t)),t}return q2(e)}function q2(e){switch(e.type){case"wildcard":return function(){return!0};case"identifier":var t=e.value.toLowerCase();return function(T,G,k){var U=k&&k.nodeTypeKey||"type";return t===T[U].toLowerCase()};case"exactNode":return function(T,G){return G.length===0};case"field":var n=e.name.split(".");return function(T,G){return(function k(U,ae,ue,Ne){for(var Te=ae,Ce=Ne;Ce<ue.length;++Ce){if(Te==null)return!1;var Qe=Te[ue[Ce]];if(Array.isArray(Qe)){for(var Rt=0;Rt<Qe.length;++Rt)if(k(U,Qe[Rt],ue,Ce+1))return!0;return!1}Te=Qe}return U===Te})(T,G[n.length-1],n,0)};case"matches":var r=e.selectors.map(Zt);return function(T,G,k){for(var U=0;U<r.length;++U)if(r[U](T,G,k))return!0;return!1};case"compound":var i=e.selectors.map(Zt);return function(T,G,k){for(var U=0;U<i.length;++U)if(!i[U](T,G,k))return!1;return!0};case"not":var o=e.selectors.map(Zt);return function(T,G,k){for(var U=0;U<o.length;++U)if(o[U](T,G,k))return!1;return!0};case"has":var s=e.selectors.map(Zt);return function(T,G,k){var U=!1,ae=[];return G_.traverse(T,{enter:function(ue,Ne){Ne!=null&&ae.unshift(Ne);for(var Te=0;Te<s.length;++Te)if(s[Te](ue,ae,k))return U=!0,void this.break()},leave:function(){ae.shift()},keys:k&&k.visitorKeys,fallback:k&&k.fallback||"iteration"}),U};case"child":var c=Zt(e.left),a=Zt(e.right);return function(T,G,k){return!!(G.length>0&&a(T,G,k))&&c(G[0],G.slice(1),k)};case"descendant":var l=Zt(e.left),p=Zt(e.right);return function(T,G,k){if(p(T,G,k)){for(var U=0,ae=G.length;U<ae;++U)if(l(G[U],G.slice(U+1),k))return!0}return!1};case"attribute":var u=e.name.split(".");switch(e.operator){case void 0:return function(T){return Ir(T,u)!=null};case"=":switch(e.value.type){case"regexp":return function(T){var G=Ir(T,u);return typeof G=="string"&&e.value.value.test(G)};case"literal":var d="".concat(e.value.value);return function(T){return d==="".concat(Ir(T,u))};case"type":return function(T){return e.value.value===hu(Ir(T,u))}}throw new Error("Unknown selector value type: ".concat(e.value.type));case"!=":switch(e.value.type){case"regexp":return function(T){return!e.value.value.test(Ir(T,u))};case"literal":var m="".concat(e.value.value);return function(T){return m!=="".concat(Ir(T,u))};case"type":return function(T){return e.value.value!==hu(Ir(T,u))}}throw new Error("Unknown selector value type: ".concat(e.value.type));case"<=":return function(T){return Ir(T,u)<=e.value.value};case"<":return function(T){return Ir(T,u)<e.value.value};case">":return function(T){return Ir(T,u)>e.value.value};case">=":return function(T){return Ir(T,u)>=e.value.value}}throw new Error("Unknown operator: ".concat(e.operator));case"sibling":var _=Zt(e.left),h=Zt(e.right);return function(T,G,k){return h(T,G,k)&&Q2(T,_,G,"LEFT_SIDE",k)||e.left.subject&&_(T,G,k)&&Q2(T,h,G,"RIGHT_SIDE",k)};case"adjacent":var b=Zt(e.left),v=Zt(e.right);return function(T,G,k){return v(T,G,k)&&$2(T,b,G,"LEFT_SIDE",k)||e.right.subject&&b(T,G,k)&&$2(T,v,G,"RIGHT_SIDE",k)};case"nth-child":var M=e.index.value,N=Zt(e.right);return function(T,G,k){return N(T,G,k)&&J2(T,G,M,k)};case"nth-last-child":var R=-e.index.value,P=Zt(e.right);return function(T,G,k){return P(T,G,k)&&J2(T,G,R,k)};case"class":var Y=e.name.toLowerCase();return function(T,G,k){if(k&&k.matchClass)return k.matchClass(e.name,T,G);if(k&&k.nodeTypeKey)return!1;switch(Y){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"&&(G.length===0||G[0].type!=="MetaProperty")||T.type==="MetaProperty";case"function":return T.type==="FunctionDeclaration"||T.type==="FunctionExpression"||T.type==="ArrowFunctionExpression"}throw new Error("Unknown class name: ".concat(e.name))}}throw new Error("Unknown selector type: ".concat(e.type))}function uR(e,t){var n=t&&t.nodeTypeKey||"type",r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:G_.VisitorKeys[r]?G_.VisitorKeys[r]:t&&typeof t.fallback=="function"?t.fallback(e):Object.keys(e).filter((function(i){return i!==n}))}function lR(e,t){var n=t&&t.nodeTypeKey||"type";return e!==null&&hu(e)==="object"&&typeof e[n]=="string"}function Q2(e,t,n,r,i){var o=pR(n,1)[0];if(!o)return!1;for(var s=uR(o,i),c=0;c<s.length;++c){var a=o[s[c]];if(Array.isArray(a)){var l=a.indexOf(e);if(l<0)continue;var p=void 0,u=void 0;r==="LEFT_SIDE"?(p=0,u=l):(p=l+1,u=a.length);for(var d=p;d<u;++d)if(lR(a[d],i)&&t(a[d],n,i))return!0}}return!1}function $2(e,t,n,r,i){var o=pR(n,1)[0];if(!o)return!1;for(var s=uR(o,i),c=0;c<s.length;++c){var a=o[s[c]];if(Array.isArray(a)){var l=a.indexOf(e);if(l<0)continue;if(r==="LEFT_SIDE"&&l>0&&lR(a[l-1],i)&&t(a[l-1],n,i)||r==="RIGHT_SIDE"&&l<a.length-1&&lR(a[l+1],i)&&t(a[l+1],n,i))return!0}}return!1}function J2(e,t,n,r){if(n===0)return!1;var i=pR(t,1)[0];if(!i)return!1;for(var o=uR(i,r),s=0;s<o.length;++s){var c=i[o[s]];if(Array.isArray(c)){var a=n<0?c.length+n:n-1;if(a>=0&&a<c.length&&c[a]===e)return!0}}return!1}function tW(e,t,n,r){if(t){var i=[],o=Zt(t),s=(function c(a,l){if(a==null||hu(a)!="object")return[];l==null&&(l=a);for(var p=a.subject?[l]:[],u=Object.keys(a),d=0;d<u.length;++d){var m=u[d],_=a[m];p.push.apply(p,Hne(c(_,m==="left"?_:l)))}return p})(t).map(Zt);G_.traverse(e,{enter:function(c,a){if(a!=null&&i.unshift(a),o(c,i,r))if(s.length)for(var l=0,p=s.length;l<p;++l){s[l](c,i,r)&&n(c,a,i);for(var u=0,d=i.length;u<d;++u){var m=i.slice(u+1);s[l](i[u],m,r)&&n(i[u],a,m)}}else n(c,a,i)},leave:function(){i.shift()},keys:r&&r.visitorKeys,fallback:r&&r.fallback||"iteration"})}}function nW(e,t,n){var r=[];return tW(e,t,(function(i){r.push(i)}),n),r}function rW(e){return Fne.parse(e)}function pi(e,t,n){return nW(e,rW(t),n)}pi.parse=rW,pi.match=nW,pi.traverse=tW,pi.matches=function(e,t,n,r){return!t||!!e&&(n||(n=[]),Zt(t)(e,n,r))},pi.query=pi;var U_={};var iW={};var dR={exports:{}};var mR=pi,{parse:fn}=U_,oW=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name==="tr_ch_apm_tracingChannel",Wne=/[^\w]/g,Ds=e=>`tr_ch_apm$${e.replace(Wne,"_")}`,fR=dR.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(oW))return;let r={module:t==="esm"},i=n.body.findIndex(a=>a.directive==="use strict"),o=t==="esm"?`import tr_ch_apm_dc from "${e}"`:`const tr_ch_apm_dc = require("${e}")`;n.body.splice(i+1,0,fn(o,r).body[0],fn("const { tracingChannel: tr_ch_apm_tracingChannel } = tr_ch_apm_dc",r).body[0],fn(`const tr_ch_apm_hasSubscribers = ch => ch.start.hasSubscribers
|
|
38
|
+
|| ch.end.hasSubscribers
|
|
39
|
+
|| ch.asyncStart.hasSubscribers
|
|
40
|
+
|| ch.asyncEnd.hasSubscribers
|
|
41
|
+
|| ch.error.hasSubscribers`,r).body[0])},tracingChannelDeclaration(e,t){let{channelName:n,module:{name:r}}=e,i=Ds(n);if(t.body.some(c=>c.declarations?.[0]?.id?.name===i))return;fR.tracingChannelImport(e,t);let o=t.body.findIndex(oW),s=`
|
|
42
|
+
const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
|
|
43
|
+
`;t.body.splice(o+1,0,fn(s).body[0])},traceCallback:D_,tracePromise:D_,traceSync:D_,traceAuto:D_};function Vne(e){return[...(e||[]).filter(r=>r.type!=="RestElement"&&r.type!=="AssignmentPattern").map((r,i)=>({type:"Identifier",name:`__apm$arg${i}`})),{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}]}function D_(e,t,n,r){let i=r[r.length-1];t.type==="ClassDeclaration"||t.type==="ClassExpression"?jne(e,t,i):Yne(e,t,i)}function Yne(e,t,n){fR.tracingChannelDeclaration(e,n);let{functionQuery:{methodName:r,privateMethodName:i,functionName:o,expressionName:s,propertyName:c}}=e,l=r==="constructor"||!r&&!i&&!o&&!s&&!c?"ArrowFunctionExpression":t.type,p=t.params;t.body=sW(e,{type:l,params:p,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=Vne(p),t.generator=!1,t.async=!1,aW(e,t)}function jne(e,t,n){let{functionQuery:r,operator:i}=e,{methodName:o}=r;if(!o)return;let s=t.body;if(s.body.some(({key:p})=>p.name===o))return;let c=s.body.find(({kind:p})=>p==="constructor");fR.tracingChannelDeclaration(e,n),c||(c=fn(t.superClass?"class A extends Object { constructor (...args) { super(...args) } }":"class A { constructor () {} }").body[0].body.body[0],s.body.unshift(c));let a=fn(`
|
|
44
|
+
const __apm$${o} = this["${o}"]
|
|
45
|
+
this["${o}"] = function () {}
|
|
46
|
+
if (typeof __apm$${o} === 'function') {
|
|
47
|
+
Object.defineProperty(this["${o}"], 'length', {
|
|
48
|
+
value: __apm$${o}.length,
|
|
49
|
+
configurable: true
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
`).body,l=a[1].expression.right;l.params=[{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}],l.async=i==="tracePromise",l.body=sW(e,{type:"Identifier",name:`__apm$${o}`},n),aW(e,l),c.value.body.body.push(...a)}function sW(e,t,n){let{operator:r,moduleVersion:i}=e,{returnKind:o}=e.functionQuery,s=o?qne(e,o,n):"",c;r==="traceCallback"&&(c=cW(e,t,s)),r==="tracePromise"&&(c=lW(e,t,s)),r==="traceSync"&&(c=Xne(e,t,s)),r==="traceAuto"&&(c=Zne(e,t,s));let a=(t.params||[]).filter(u=>u.type!=="RestElement"&&u.type!=="AssignmentPattern").map((u,d)=>`__apm$arg${d}`).concat("...__apm$args").join(", "),l=c.body[0].body,p=fn(t.type==="ArrowFunctionExpression"?`
|
|
53
|
+
const __apm$arguments = [${a}];
|
|
54
|
+
const __apm$ctx = {
|
|
55
|
+
arguments: __apm$arguments,
|
|
56
|
+
moduleVersion: ${JSON.stringify(i)}
|
|
57
|
+
};
|
|
58
|
+
const __apm$traced = () => {
|
|
59
|
+
const __apm$wrapped = () => {};
|
|
60
|
+
return __apm$wrapped(...__apm$arguments);
|
|
61
|
+
};
|
|
62
|
+
`:`
|
|
63
|
+
const __apm$arguments = [${a}].slice(0, arguments.length);
|
|
64
|
+
const __apm$ctx = {
|
|
65
|
+
arguments: __apm$arguments,
|
|
66
|
+
self: this,
|
|
67
|
+
moduleVersion: ${JSON.stringify(i)}
|
|
68
|
+
};
|
|
69
|
+
const __apm$traced = () => {
|
|
70
|
+
const __apm$wrapped = () => {};
|
|
71
|
+
return __apm$wrapped.apply(this, __apm$arguments);
|
|
72
|
+
};
|
|
73
|
+
`).body;return l.body.unshift(...p),mR.query(l,"[id.name=__apm$wrapped]")[0].init=t,l}function aW(e,t){let n=new Set;mR.traverse(t.body,mR.parse("[object.type=Super]"),(r,i)=>{let{name:o}=r.property,s;if(i.callee){let{expression:c}=fn(`__apm$super['${o}'].call(this)`).body[0];i.callee=s=c.callee,i.arguments.unshift(...c.arguments)}else i.expression=s=fn(`__apm$super['${o}']`).body[0];s.computed=i.callee.computed,s.optional=i.callee.optional,n.add(o)});for(let r of n){let i=fn(`
|
|
74
|
+
class Wrapper {
|
|
75
|
+
wrapper () {
|
|
76
|
+
__apm$super['${r}'] = super['${r}']
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`).body[0].body.body[0].value.body.body[0];t.body.body.unshift(i)}n.size>0&&t.body.body.unshift(fn("const __apm$super = {}").body[0])}function Zne(e,t,n=""){let r=cW(e,t,n),i=lW(e,t,n),[o,s,c,a,l,p]=r.body[0].body.body,u={type:"IfStatement",test:a.test,consequent:{type:"BlockStatement",body:i.body[0].body.body},alternate:null};return r.body[0].body.body=[o,u,s,c,l,p],r}function cW(e,t,n=""){let{channelName:r,functionQuery:{callbackIndex:i=-1}}=e,o=Ds(r);return fn(`
|
|
80
|
+
function wrapper () {
|
|
81
|
+
const __apm$cb = Array.prototype.at.call(__apm$arguments, ${i});
|
|
82
|
+
|
|
83
|
+
if (!${o}.start.hasSubscribers) return __apm$traced();
|
|
84
|
+
|
|
85
|
+
function __apm$wrappedCb(err, res) {
|
|
86
|
+
if (err) {
|
|
87
|
+
__apm$ctx.error = err;
|
|
88
|
+
${o}.error.publish(__apm$ctx);
|
|
89
|
+
} else {
|
|
90
|
+
__apm$ctx.result = res;
|
|
91
|
+
${n}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
${o}.asyncStart.runStores(__apm$ctx, () => {
|
|
95
|
+
try {
|
|
96
|
+
if (__apm$cb) {
|
|
97
|
+
return __apm$cb.apply(this, arguments);
|
|
98
|
+
}
|
|
99
|
+
} finally {
|
|
100
|
+
${o}.asyncEnd.publish(__apm$ctx);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (typeof __apm$cb !== 'function') {
|
|
106
|
+
return __apm$traced();
|
|
107
|
+
}
|
|
108
|
+
Array.prototype.splice.call(__apm$arguments, ${i}, 1, __apm$wrappedCb);
|
|
109
|
+
|
|
110
|
+
return ${o}.start.runStores(__apm$ctx, () => {
|
|
111
|
+
try {
|
|
112
|
+
return __apm$traced();
|
|
113
|
+
} catch (err) {
|
|
114
|
+
__apm$ctx.error = err;
|
|
115
|
+
${o}.error.publish(__apm$ctx);
|
|
116
|
+
throw err;
|
|
117
|
+
} finally {
|
|
118
|
+
__apm$ctx.self ??= this;
|
|
119
|
+
${o}.end.publish(__apm$ctx);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
`)}function lW(e,t,n=""){let{channelName:r}=e,i=Ds(r);return fn(`
|
|
124
|
+
function wrapper () {
|
|
125
|
+
if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
|
|
126
|
+
|
|
127
|
+
return ${i}.start.runStores(__apm$ctx, () => {
|
|
128
|
+
try {
|
|
129
|
+
let promise = __apm$traced();
|
|
130
|
+
if (typeof promise?.then !== 'function') {
|
|
131
|
+
__apm$ctx.result = promise;
|
|
132
|
+
${n}
|
|
133
|
+
return __apm$ctx.result;
|
|
134
|
+
}
|
|
135
|
+
// Mirror Node.js core diagnostics_channel behaviour: for native Promise
|
|
136
|
+
// instances, chain normally (safe since there is no subclass API to
|
|
137
|
+
// preserve). For Promise subclasses and other thenables, side-chain the
|
|
138
|
+
// callbacks for event publishing and return the original so that any
|
|
139
|
+
// subclass-specific methods (e.g. APIPromise.withResponse()) remain
|
|
140
|
+
// accessible to the caller.
|
|
141
|
+
if (promise instanceof Promise && promise.constructor === Promise) {
|
|
142
|
+
return promise.then(
|
|
143
|
+
result => {
|
|
144
|
+
__apm$ctx.result = result;
|
|
145
|
+
${n}
|
|
146
|
+
${i}.asyncStart.publish(__apm$ctx);
|
|
147
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
148
|
+
return __apm$ctx.result;
|
|
149
|
+
},
|
|
150
|
+
err => {
|
|
151
|
+
__apm$ctx.error = err;
|
|
152
|
+
${i}.error.publish(__apm$ctx);
|
|
153
|
+
${i}.asyncStart.publish(__apm$ctx);
|
|
154
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
promise.then(
|
|
160
|
+
result => {
|
|
161
|
+
__apm$ctx.result = result;
|
|
162
|
+
${n}
|
|
163
|
+
${i}.asyncStart.publish(__apm$ctx);
|
|
164
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
165
|
+
},
|
|
166
|
+
err => {
|
|
167
|
+
__apm$ctx.error = err;
|
|
168
|
+
${i}.error.publish(__apm$ctx);
|
|
169
|
+
${i}.asyncStart.publish(__apm$ctx);
|
|
170
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
return promise;
|
|
174
|
+
} catch (err) {
|
|
175
|
+
__apm$ctx.error = err;
|
|
176
|
+
${i}.error.publish(__apm$ctx);
|
|
177
|
+
throw err;
|
|
178
|
+
} finally {
|
|
179
|
+
__apm$ctx.self ??= this;
|
|
180
|
+
${i}.end.publish(__apm$ctx);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
`)}function Xne(e,t,n=""){let{channelName:r}=e,i=Ds(r);return fn(`
|
|
185
|
+
function wrapper () {
|
|
186
|
+
if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
|
|
187
|
+
|
|
188
|
+
return ${i}.start.runStores(__apm$ctx, () => {
|
|
189
|
+
try {
|
|
190
|
+
__apm$ctx.result = __apm$traced();
|
|
191
|
+
${n}
|
|
192
|
+
} catch (err) {
|
|
193
|
+
__apm$ctx.error = err;
|
|
194
|
+
${i}.error.publish(__apm$ctx);
|
|
195
|
+
throw err;
|
|
196
|
+
} finally {
|
|
197
|
+
__apm$ctx.self ??= this;
|
|
198
|
+
${i}.end.publish(__apm$ctx);
|
|
199
|
+
}
|
|
200
|
+
return __apm$ctx.result;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
`)}function Kne(e,t){let{channelName:n,module:{name:r}}=e,i=Ds(n+":next");if(t.body.some(a=>a.declarations?.[0]?.id?.name===i))return;let o=Ds(n),s=t.body.findIndex(a=>a.declarations?.[0]?.id?.name===o),c=`const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}:next")`;t.body.splice(s+1,0,fn(c).body[0])}function qne(e,t,n){let{channelName:r}=e,i=t==="Iterator"?"traceSync":"tracePromise",o=Ds(r+":next");return Kne(e,n),`
|
|
204
|
+
const __apm$iter = __apm$ctx.result;
|
|
205
|
+
if (__apm$iter != null && typeof __apm$iter.next === 'function') {
|
|
206
|
+
const __apm$patchIter = function (method) {
|
|
207
|
+
const __apm$orig = __apm$iter[method];
|
|
208
|
+
if (typeof __apm$orig !== 'function') return;
|
|
209
|
+
__apm$iter[method] = function () {
|
|
210
|
+
const __apm$iterArgs = Array.prototype.slice.call(arguments);
|
|
211
|
+
if (!tr_ch_apm_hasSubscribers(${o})) return __apm$orig.apply(this, __apm$iterArgs);
|
|
212
|
+
__apm$ctx.method = method;
|
|
213
|
+
__apm$ctx.arguments = __apm$iterArgs;
|
|
214
|
+
return ${o}.${i}(__apm$orig, __apm$ctx, this, ...__apm$iterArgs);
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
__apm$patchIter('next');
|
|
218
|
+
__apm$patchIter('throw');
|
|
219
|
+
__apm$patchIter('return');
|
|
220
|
+
}
|
|
221
|
+
`}var pW=dR.exports;var gR={};var mW=e=>{throw TypeError(e)},yR=(e,t,n)=>t.has(e)||mW("Cannot "+n),ui=(e,t,n)=>(yR(e,t,"read from private field"),n?n.call(e):t.get(e)),Bs=(e,t,n)=>t.has(e)?mW("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Dc=(e,t,n,r)=>(yR(e,t,"write to private field"),t.set(e,n),n),Bc=(e,t,n)=>(yR(e,t,"access private method"),n),bu,H_,yu,Hc,F_,W_,wo,fW,gW,_W,hR,hW,uW=pi,{parse:dW}=U_,{generate:Qne}=iW,$ne=pW,_R,B_,bR=class{constructor(t,n,r,i,o,s={}){Bs(this,wo),Bs(this,bu,null),Bs(this,H_,null),Bs(this,yu,null),Bs(this,Hc,[]),Bs(this,F_,null),Bs(this,W_,{}),Dc(this,bu,t),Dc(this,H_,n),Dc(this,yu,r),Dc(this,Hc,i),Dc(this,F_,o),Dc(this,W_,s)}free(){}get moduleName(){return ui(this,bu)}get filePath(){return ui(this,yu)}transform(t,n,r){if(Buffer.isBuffer(t)&&(t=t.toString()),!t)return{code:t};let i,o={},s=0;for(let c of ui(this,Hc)){let{astQuery:a,functionQuery:l={}}=c;if(!i){let m={loc:!0,ranges:!0,raw:!0,module:n==="esm"};try{i=dW(t,m)}catch{i=dW(t,{...m,module:!m.module})}n==="esm"&&(o=Bc(this,wo,_W).call(this,i))}let p=Bc(this,wo,hR).call(this,l,o),u=a||Bc(this,wo,hW).call(this,p),d={...c,dcModule:ui(this,F_),moduleType:n,moduleVersion:ui(this,H_),functionQuery:p};d.operator=Bc(this,wo,gW).call(this,d),uW.traverse(i,uW.parse(u),(...m)=>{s++,Bc(this,wo,fW).call(this,d,...m)})}if(s===0&&ui(this,Hc).length>0){let c=ui(this,Hc).map(({astQuery:a,functionQuery:l={}})=>{if(a)return a;let p=Bc(this,wo,hR).call(this,l,o),d=(h=>h.methodName||h.privateMethodName||h.functionName||h.expressionName||"constructor")(l),m=l.className||l.functionName||l.expressionName,_=p.className||p.functionName||p.expressionName;return m&&m!==_?`${m} (local name: ${_})`:d});throw new Error(`Failed to find injection points for: ${JSON.stringify(c)}`)}if(i){_R??(_R=gR.SourceMapConsumer),B_??(B_=gR.SourceMapGenerator);let c=`${ui(this,bu)}/${ui(this,yu)}`,a;if(r){let u=new _R(r);u.file=c,a=B_.fromSourceMap(u)}else a=new B_({file:c});let l=Qne(i,{sourceMap:a}),p=a.toString();return{code:l,map:p}}return{code:t}}};bu=new WeakMap;H_=new WeakMap;yu=new WeakMap;Hc=new WeakMap;F_=new WeakMap;W_=new WeakMap;wo=new WeakSet;fW=function(e,...t){let n=ui(this,W_)[e.operator]??$ne[e.operator],{index:r=0}=e.functionQuery,[i]=t,o=i.init?.type||i.type;o!=="ClassDeclaration"&&o!=="ClassExpression"&&(i.type==="VariableDeclarator"||(e.functionIndex=++e.functionIndex||0,r!==null&&r!==e.functionIndex))||n(e,...t)};gW=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"}};_W=function(e){let t={};for(let n of e.body)if(n.type==="ExportNamedDeclaration"&&!n.source){for(let r of n.specifiers)if(r.exported&&r.local){let i=r.exported.name??r.exported.value,o=r.local.name??r.local.value;i&&o&&(t[i]=o)}}return t};hR=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};hW=function(e){let{functionName:t,expressionName:n,className:r,objectName:i,propertyName:o}=e,s=e.privateMethodName?"PrivateIdentifier":"Identifier",c=[],a=e.methodName||e.privateMethodName;if(r?(a??(a="constructor"),c.push(`[id.name="${r}"]`,`[id.name="${r}"] > ClassExpression`,`[id.name="${r}"] > ClassBody > [key.name="${a}"][key.type=${s}] > [async]`,`[id.name="${r}"] > ClassExpression > ClassBody > [key.name="${a}"][key.type=${s}] > [async]`)):a&&c.push(`ClassBody > [key.name="${a}"][key.type=${s}] > [async]`,`Property[key.name="${a}"][key.type=${s}] > [async]`),t?c.push(`FunctionDeclaration[id.name="${t}"][async]`):n&&c.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||o){if(!i||!o)throw new Error(`functionQuery: 'objectName' and 'propertyName' must be used together (got objectName=${i}, propertyName=${o})`);let l=i==="this"?"left.object.type=ThisExpression":`left.object.name="${i}"`;c.push(`AssignmentExpression[${l}][left.property.name="${o}"] > [async]`)}return c.join(", ")};var bW={Transformer:bR};var yW=e=>{throw TypeError(e)},SW=(e,t,n)=>t.has(e)||yW("Cannot "+n),Go=(e,t,n)=>(SW(e,t,"read from private field"),n?n.call(e):t.get(e)),V_=(e,t,n)=>t.has(e)?yW("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),SR=(e,t,n,r)=>(SW(e,t,"write to private field"),t.set(e,n),n),Y_,j_,Hs,Z_,Jne=X2,{Transformer:zne}=bW,ER=class{constructor(t,n){V_(this,Y_,[]),V_(this,j_,null),V_(this,Hs,{}),V_(this,Z_,{}),SR(this,Y_,t),SR(this,j_,n||"diagnostics_channel")}free(){SR(this,Hs,{})}addTransform(t,n){Go(this,Z_)[t]=n}getTransformer(t,n,r){r=r.replace(/\\/g,"/");let i=`${t}/${r}@${n}`;if(Go(this,Hs)[i])return Go(this,Hs)[i];let o=Go(this,Y_).filter(({module:s})=>s.name===t&&(typeof s.filePath=="string"?s.filePath===r:s.filePath.test(r))&&Jne(n,s.versionRange));if(o.length!==0)return Go(this,Hs)[i]=new zne(t,n,r,o,Go(this,j_),Go(this,Z_)),Go(this,Hs)[i]}};Y_=new WeakMap;j_=new WeakMap;Hs=new WeakMap;Z_=new WeakMap;var EW={InstrumentationMatcher:ER};var{InstrumentationMatcher:ere}=EW;function tre(e,t){return new ere(e,t)}var TW={create:tre};var X_=TW;import Tre from"module";import nre from"path";var TR=nre.sep,IR=function(e){var t=e.split(TR),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],o=r?3:2,s="",c=n+o-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+TR;for(var l="",p=t.length-1,u=n+o;u<=p;u++)u===p?l+=t[u]:l+=t[u]+TR;return{name:i,basedir:s,path:l}}},IW=Lo(IR);import Ire from"url";import rre from"fs";import ire from"path";var{readFileSync:ore}=rre,{join:sre}=ire,AR=new Map;function are(e){if(AR.has(e))return AR.get(e);try{let t=sre(e,"package.json"),n=ore(t),{version:r}=JSON.parse(n);return AR.set(e,r),r}catch{return process.version.slice(1)}}var NR=are,AW=Lo(NR);var RR;function cre(e){RR=e}function lre(e){RR&&RR(e)}var Vi={setDiagnosticsHook:cre,emitDiagnostics:lre};var K_={exports:{}};import Sre from"tty";import Ere from"util";import pre from"os";import ure from"tty";var NW=(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)};var dre=pre,RW=ure,Jn=NW,{env:kt}=process,Uo;Jn("no-color")||Jn("no-colors")||Jn("color=false")||Jn("color=never")?Uo=0:(Jn("color")||Jn("colors")||Jn("color=true")||Jn("color=always"))&&(Uo=1);"FORCE_COLOR"in kt&&(kt.FORCE_COLOR==="true"?Uo=1:kt.FORCE_COLOR==="false"?Uo=0:Uo=kt.FORCE_COLOR.length===0?1:Math.min(parseInt(kt.FORCE_COLOR,10),3));function vR(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function OR(e,t){if(Uo===0)return 0;if(Jn("color=16m")||Jn("color=full")||Jn("color=truecolor"))return 3;if(Jn("color=256"))return 2;if(e&&!t&&Uo===void 0)return 0;let n=Uo||0;if(kt.TERM==="dumb")return n;if(process.platform==="win32"){let r=dre.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in kt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in kt)||kt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in kt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(kt.TEAMCITY_VERSION)?1:0;if(kt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in kt){let r=parseInt((kt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(kt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(kt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(kt.TERM)||"COLORTERM"in kt?1:n}function mre(e){let t=OR(e,e&&e.isTTY);return vR(t)}var vW={supportsColor:mre,stdout:vR(OR(!0,RW.isatty(1))),stderr:vR(OR(!0,RW.isatty(2)))};var Fc=1e3,Wc=Fc*60,Vc=Wc*60,Fs=Vc*24,fre=Fs*7,gre=Fs*365.25,OW=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return _re(e);if(n==="number"&&isFinite(e))return t.long?bre(e):hre(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function _re(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]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*gre;case"weeks":case"week":case"w":return n*fre;case"days":case"day":case"d":return n*Fs;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Vc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Wc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Fc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function hre(e){var t=Math.abs(e);return t>=Fs?Math.round(e/Fs)+"d":t>=Vc?Math.round(e/Vc)+"h":t>=Wc?Math.round(e/Wc)+"m":t>=Fc?Math.round(e/Fc)+"s":e+"ms"}function bre(e){var t=Math.abs(e);return t>=Fs?q_(e,t,Fs,"day"):t>=Vc?q_(e,t,Vc,"hour"):t>=Wc?q_(e,t,Wc,"minute"):t>=Fc?q_(e,t,Fc,"second"):e+" ms"}function q_(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+" "+r+(i?"s":"")}function yre(e){n.debug=n,n.default=n,n.coerce=a,n.disable=s,n.enable=i,n.enabled=c,n.humanize=OW,n.destroy=l,Object.keys(e).forEach(p=>{n[p]=e[p]}),n.names=[],n.skips=[],n.formatters={};function t(p){let u=0;for(let d=0;d<p.length;d++)u=(u<<5)-u+p.charCodeAt(d),u|=0;return n.colors[Math.abs(u)%n.colors.length]}n.selectColor=t;function n(p){let u,d=null,m,_;function h(...b){if(!h.enabled)return;let v=h,M=Number(new Date),N=M-(u||M);v.diff=N,v.prev=u,v.curr=M,u=M,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let R=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(Y,T)=>{if(Y==="%%")return"%";R++;let G=n.formatters[T];if(typeof G=="function"){let k=b[R];Y=G.call(v,k),b.splice(R,1),R--}return Y}),n.formatArgs.call(v,b),(v.log||n.log).apply(v,b)}return h.namespace=p,h.useColors=n.useColors(),h.color=n.selectColor(p),h.extend=r,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==n.namespaces&&(m=n.namespaces,_=n.enabled(p)),_),set:b=>{d=b}}),typeof n.init=="function"&&n.init(h),h}function r(p,u){let d=n(this.namespace+(typeof u>"u"?":":u)+p);return d.log=this.log,d}function i(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let u=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of u)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function o(p,u){let d=0,m=0,_=-1,h=0;for(;d<p.length;)if(m<u.length&&(u[m]===p[d]||u[m]==="*"))u[m]==="*"?(_=m,h=d,m++):(d++,m++);else if(_!==-1)m=_+1,h++,d=h;else return!1;for(;m<u.length&&u[m]==="*";)m++;return m===u.length}function s(){let p=[...n.names,...n.skips.map(u=>"-"+u)].join(",");return n.enable(""),p}function c(p){for(let u of n.skips)if(o(p,u))return!1;for(let u of n.names)if(o(p,u))return!0;return!1}function a(p){return p instanceof Error?p.stack||p.message:p}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 CW=yre;(function(e,t){let n=Sre,r=Ere;t.init=p,t.log=c,t.formatArgs=o,t.save=a,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 d=vW;d&&(d.stderr||d).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(d=>/^debug_/i.test(d)).reduce((d,m)=>{let _=m.substring(6).toLowerCase().replace(/_([a-z])/g,(b,v)=>v.toUpperCase()),h=process.env[m];return/^(yes|on|true|enabled)$/i.test(h)?h=!0:/^(no|off|false|disabled)$/i.test(h)?h=!1:h==="null"?h=null:h=Number(h),d[_]=h,d},{});function i(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:n.isatty(process.stderr.fd)}function o(d){let{namespace:m,useColors:_}=this;if(_){let h=this.color,b="\x1B[3"+(h<8?h:"8;5;"+h),v=` ${b};1m${m} \x1B[0m`;d[0]=v+d[0].split(`
|
|
222
|
+
`).join(`
|
|
223
|
+
`+v),d.push(b+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else d[0]=s()+m+" "+d[0]}function s(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function c(...d){return process.stderr.write(r.formatWithOptions(t.inspectOpts,...d)+`
|
|
224
|
+
`)}function a(d){d?process.env.DEBUG=d:delete process.env.DEBUG}function l(){return process.env.DEBUG}function p(d){d.inspectOpts={};let m=Object.keys(t.inspectOpts);for(let _=0;_<m.length;_++)d.inspectOpts[m[_]]=t.inspectOpts[m[_]]}e.exports=CW(t);let{formatters:u}=e.exports;u.o=function(d){return this.inspectOpts.colors=this.useColors,r.inspect(d,this.inspectOpts).split(`
|
|
225
|
+
`).map(m=>m.trim()).join(" ")},u.O=function(d){return this.inspectOpts.colors=this.useColors,r.inspect(d,this.inspectOpts)}})(K_,K_.exports);var CR=K_.exports,xW=Lo(CR);import Are from"os";import Nre from"path";import Rre from"fs";var{create:vre}=X_,xR=Tre,Ore=IR,{pathToFileURL:PW}=Ire,Cre=NR,{emitDiagnostics:kW}=Vi,Q_=CR("@apm-js-collab/tracing-hooks:module-patch"),PR=class{constructor({instrumentations:t=[]}={}){this.packages=new Set(t.map(n=>n.module.name)),this.instrumentator=vre(t),this.compile=xR.prototype._compile}patch(){let t=this;xR.prototype._compile=function(...r){let[i,o]=r,s=Ore(o);if(s&&t.packages.has(s.name)){Q_("found resolved module, checking if there is a transformer %s",o);let c=Cre(s.basedir,s.name),a=t.instrumentator.getTransformer(s.name,c,s.path);if(a){Q_("transforming file %s",o);try{let l=a.transform(i,"cjs");r[0]=l?.code,kW({url:PW(o).href,moduleName:a.moduleName}),process.env.TRACING_DUMP&&xre(r[0],o)}catch(l){Q_("Error transforming module %s: %o",o,l),kW({url:PW(o).href,moduleName:a.moduleName,error:l})}finally{a.free()}}}return t.compile.apply(this,r)}}unpatch(){xR.prototype._compile=this.compile}};function xre(e,t){let n=Are,r=Nre,i=Rre,o=process.env.TRACING_DUMP_DIR??n.tmpdir(),s=r.dirname(t),c=r.basename(t),a=r.join(o,s),l=r.join(a,c);Q_("Dumping patched code to: %s",l),i.mkdirSync(a,{recursive:!0}),i.writeFileSync(l,e)}var Pre=PR,LW=Lo(Pre);import{fileURLToPath as kre}from"url";import{MessageChannel as Lre}from"worker_threads";import{readFileSync as Mre}from"fs";var MW=xW("@apm-js-collab/tracing-hooks:esm-hook"),$_=null,wW=null,GW=null,kR=Vi.emitDiagnostics;function UW(){let{port1:e,port2:t}=new Lre;return e.on("message",Vi.emitDiagnostics),e.unref(),t}function DW(e={}){let t=e?.instrumentations||[];GW=X_.create(t),wW=new Set(t.map(n=>n.module.name)),$_=new Map,kR=e?.diagnosticsPort?wre(e.diagnosticsPort):Vi.emitDiagnostics}function wre(e){return t=>{try{let n=t.error===void 0||t.error instanceof Error?t.error:new Error(String(t.error));e.postMessage({...t,error:n})}catch(n){MW("failed to post diagnostics for %s: %o",t.url,n)}}}function Gre(e){let t=IW(e.url);if(t&&wW.has(t.name)){let n=kre(t.basedir),r=AW(n),i=GW.getTransformer(t.name,r,t.path);i&&$_.set(e.url,i)}return e}function BW(e,t,n){return Gre(n(e,t))}function HW(e,t,n){let r=n(e,t);if($_.has(e)===!1)return r;if(r.format==="commonjs"){let i=new URL(r.responseURL??e);r.source??=Mre(i)}return Ure(e,r)}function Ure(e,t){let n=t.source;if(n){let r=$_.get(e);try{let i=t.format==="module"?"esm":t.format==="commonjs"?"cjs":"unknown",o=typeof n=="string"?n:Buffer.from(n).toString("utf8"),s=r.transform(o,i);t.source=s?.code,t.shortCircuit=!0,kR({url:e,moduleName:r.moduleName})}catch(i){MW("Error transforming module %s: %o",e,i),kR({url:e,moduleName:r.moduleName,error:i})}finally{r.free()}}return t}var v3e=Vi.setDiagnosticsHook;function Fre(e){if(e){let{major:r=0,minor:i=0}=qs(e);return r>2||r===2&&i>=8}let{major:t=0,minor:n=0}=qs(process.versions.node??"0.0.0");return t>25||t===25&&n>=1||t===24&&n>=13}function FW(e){if(!Bre&&!Hre||te?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=Fre(t.Deno?.version?.deno),r=Dre;Vi.setDiagnosticsHook(({moduleName:i,error:o})=>{o?g.warn(`[orchestrion] failed to inject diagnostics-channel into ${i}:`,o):(te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[],te.__SENTRY_ORCHESTRION__.runtime.push(i))});try{if(typeof r.registerHooks=="function"&&n)DW({instrumentations:_u}),r.registerHooks({resolve:BW,load:HW}),g.log("Registered diagnostics-channel injection via Module.registerHooks()");else if(typeof r.register=="function"&&!t.Bun&&!t.Deno){let i=UW(),o;o=import.meta.url,r.register("@sentry/server-utils/orchestrion/hook",{parentURL:o,data:{instrumentations:_u,diagnosticsPort:i},transferList:[i]}),new LW({instrumentations:_u}).patch(),g.log("Registered diagnostics-channel injection via Module.register()")}else{g.warn("No available Node API to register diagnostics-channel injection hooks; skipping.");return}}catch(i){g.warn("Failed to register diagnostics-channel injection hooks; channel-based integrations will not record spans.",i);return}te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[]}function Wre(){return TN}function Vre(e){FG(()=>{let t=Object.values(TN).map(r=>r()),n=t.map(r=>r.name);return{integrations:[...t,YA({responseHook:Ps}),EN({responseHook:Ps})],replacedOtelIntegrationNames:n,register:()=>FW(),detect:hN}})}export{rn as NODE_VERSION,mc as NodeClient,tR as OpenFeatureIntegrationHook,q as SDK_VERSION,H as SEMANTIC_ATTRIBUTE_SENTRY_OP,S as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,Wn as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,ve as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,Qt as Scope,Op as SentryContextManager,nT as _INTERNAL_normalizeCollectionInterval,an as addBreadcrumb,Bb as addEventProcessor,jb as addIntegration,WN as amqplibIntegration,N1 as anrIntegration,KN as anthropicAIIntegration,xne as applyDiagnosticsChannelInjectionIntegrations,bn as bindScopeToEmitter,pne as buildLaunchDarklyFlagUsedHandler,Tl as captureCheckIn,gy as captureConsoleIntegration,Sl as captureEvent,ge as captureException,xy as captureFeedback,yl as captureMessage,Hb as captureSession,cf as childProcessIntegration,Ub as close,YI as connectIntegration,Sf as consoleIntegration,Py as consoleLoggingIntegration,pf as contextLinesIntegration,vn as continueTrace,Ly as createConsolaReporter,Nf as createGetModuleFromFilename,gr as createLangChainCallbackHandler,k1 as createSentryWinstonTransport,Aa as createTransport,F1 as cron,Bte as dataloaderIntegration,_y as dedupeIntegration,vf as defaultStackParser,Wre as diagnosticsChannelInjectionIntegrations,R1 as disableAnrDetectionForCallback,rs as endSession,Sd as eventFiltersIntegration,Vre as experimentalUseDiagnosticsChannelInjection,SS as expressErrorHandler,pT as expressIntegration,hy as extraErrorDataIntegration,YT as fastifyIntegration,Ry as featureFlagsIntegration,rR as firebaseIntegration,ts as flush,V4 as fsIntegration,Cl as functionToStringIntegration,fe as generateInstrumentOnce,vN as genericPoolIntegration,Q as getActiveSpan,iR as getAutoPerformanceIntegrations,O as getClient,ne as getCurrentScope,Y2 as getDefaultIntegrations,V2 as getDefaultIntegrationsWithoutPerformance,Zo as getGlobalScope,$ as getIsolationScope,Oe as getRootSpan,Rf as getSentryRelease,sl as getSpanDescendants,wt as getSpanStatusFromHttpCode,tt as getTraceData,cy as getTraceMetaTags,QN as googleGenAIIntegration,$T as graphqlIntegration,fne as growthbookIntegration,UI as hapiIntegration,BI as honoIntegration,Yr as httpHeadersToSpanAttributes,oT as httpIntegration,qa as httpServerIntegration,Qa as httpServerSpansIntegration,xl as inboundFiltersIntegration,Pne as init,sR as initOpenTelemetry,kne as initWithoutDefaultIntegrations,Qd as instrumentAnthropicAiClient,zd as instrumentGoogleGenAIClient,nm as instrumentLangChainEmbeddings,cP as instrumentLangGraph,Zd as instrumentOpenAiClient,Jl as instrumentStateGraph,eS as instrumentStateGraphCompile,Ad as instrumentSupabaseClient,Sc as isDiagnosticsChannelInjectionEnabled,ns as isEnabled,Db as isInitialized,iI as kafkaIntegration,Cte as knexIntegration,WI as koaIntegration,JN as langChainIntegration,eR as langGraphIntegration,Gb as lastEventId,lne as launchDarklyIntegration,Pl as linkedErrorsIntegration,ff as localVariablesIntegration,eT as logger,sI as lruMemoizerIntegration,Af as makeNodeTransport,mt as metrics,gf as modulesIntegration,lI as mongoIntegration,uI as mongooseIntegration,hI as mysql2Integration,mI as mysqlIntegration,sT as nativeNodeFetchIntegration,lf as nodeContextIntegration,x1 as nodeRuntimeMetricsIntegration,_f as onUncaughtExceptionIntegration,hf as onUnhandledRejectionIntegration,ZN as openAIIntegration,une as openFeatureIntegration,_d as parameterize,G1 as pinoIntegration,PI as postgresIntegration,wI as postgresJsIntegration,Nne as preloadOpenTelemetry,Zf as prismaIntegration,bf as processSessionIntegration,Cy as profiler,NI as redisIntegration,kl as requestDataIntegration,Ty as rewriteFramesIntegration,Mb as setAttribute,Lb as setAttributes,Ob as setContext,BO as setConversationId,ty as setCurrentClient,xb as setExtra,Cb as setExtras,ea as setHttpStatus,ob as setMeasurement,WE as setNodeAsyncContextStrategy,kb as setTag,Pb as setTags,wb as setUser,Lz as setupConnectErrorHandler,j4 as setupExpressErrorHandler,sJ as setupFastifyErrorHandler,hz as setupHapiErrorHandler,Nz as setupHonoErrorHandler,Oz as setupKoaErrorHandler,zl as spanStreamingIntegration,Jh as spanToBaggageHeader,oe as spanToJSON,il as spanToTraceHeader,yf as spotlightIntegration,L as startInactiveSpan,On as startNewTrace,El as startSession,Se as startSpan,Le as startSpanManual,dne as statsigIntegration,Iy as supabaseIntegration,Vn as suppressTracing,Ef as systemErrorIntegration,AN as tediousIntegration,nS as trpcMiddleware,mne as unleashIntegration,qh as updateSpanName,Cf as validateOpenTelemetrySetup,YN as vercelAIIntegration,RC as winterCGHeadersToDict,se as withActiveSpan,or as withIsolationScope,Wr as withMonitor,He as withScope,zh as withStreamedSpan,_S as wrapMcpServerWithSentry,Ay as zodErrorsIntegration};
|