@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.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/dist/{anthropic-LB4T3BEN.js → anthropic-5FTO3Q7W.js} +1 -1
  3. package/dist/browser/dist/static/{highlight-KNDEBJWF.js → highlight-7IMT657L.js} +9 -9
  4. package/dist/browser/dist/static/index.css +2 -2
  5. package/dist/browser/dist/static/index.js +81 -75
  6. package/dist/browser/dist/static/webapi-433PWHPB.js +4 -0
  7. package/dist/{chunk-NPIMUWFO.js → chunk-3FNHYMQD.js} +1 -1
  8. package/dist/{chunk-D6YQITPD.js → chunk-4UBQFHOG.js} +1 -1
  9. package/dist/{chunk-N7G2FDAI.js → chunk-5JFKXDO6.js} +1 -1
  10. package/dist/chunk-6YD572HB.js +4 -0
  11. package/dist/{chunk-XDERLDVW.js → chunk-7R67JSKQ.js} +1 -1
  12. package/dist/{chunk-FNQMXCCE.js → chunk-D5XGRVMZ.js} +1 -1
  13. package/dist/{chunk-WKKH2UE5.js → chunk-FOFOAOHI.js} +1 -1
  14. package/dist/{chunk-QYUIIFJY.js → chunk-GQKXEVHQ.js} +1 -1
  15. package/dist/{chunk-5D3QKHYQ.js → chunk-HNVICTWL.js} +1 -1
  16. package/dist/{chunk-7WP7SERS.js → chunk-HQ6FH7CR.js} +1 -1
  17. package/dist/{chunk-P6K7EQHF.js → chunk-I2KB6I3D.js} +2 -2
  18. package/dist/chunk-KBRCX7GE.js +30 -0
  19. package/dist/chunk-LLPVYWAK.js +10 -0
  20. package/dist/{chunk-2N7OIUQW.js → chunk-TVVVY2T4.js} +173 -173
  21. package/dist/{chunk-6SWKDCK3.js → chunk-WXCPYSJ3.js} +1 -1
  22. package/dist/{chunk-57IGGFHK.js → chunk-XB5QPPSI.js} +1 -1
  23. package/dist/{chunk-EQABLL4S.js → chunk-YWUBKWGK.js} +1 -1
  24. package/dist/{devtools-UVGRIXO2.js → devtools-BODX7K3L.js} +1 -1
  25. package/dist/{esm-HB7M3TZY.js → esm-4BJKCG42.js} +1 -1
  26. package/dist/{esm-63A57VQM.js → esm-AWTGQAUK.js} +1 -1
  27. package/dist/{esm-FURF4AWD.js → esm-JKMLEWEU.js} +1 -1
  28. package/dist/{esm-46K5BSA6.js → esm-MG7NDA4I.js} +1 -1
  29. package/dist/{esm-73AG4F4H.js → esm-NCNRWOJD.js} +1 -1
  30. package/dist/{esm-QAEO3U72.js → esm-QVP2GBDR.js} +1 -1
  31. package/dist/esm-ZR7DS25X.js +225 -0
  32. package/dist/file-type-Z4DPJWZH.js +12 -0
  33. package/dist/getMachineId-bsd-RSPO2LUX.js +4 -0
  34. package/dist/getMachineId-bsd-YMN7H6LU.js +4 -0
  35. package/dist/getMachineId-darwin-AOWQPOSH.js +5 -0
  36. package/dist/getMachineId-darwin-FEQVNOUN.js +5 -0
  37. package/dist/{getMachineId-win-2ZKMVYDE.js → getMachineId-win-H5SABCRW.js} +1 -1
  38. package/dist/{getMachineId-win-JOM5JSRW.js → getMachineId-win-RV3BPBHF.js} +1 -1
  39. package/dist/image-worker.js +1 -1
  40. package/dist/lib/{chunk-XVXFUSSS.js → chunk-IOPSBIYR.js} +1 -1
  41. package/dist/lib/index.d.ts +802 -802
  42. package/dist/lib/index.js +19 -17
  43. package/dist/lib/{providers-2NPR2VR4.js → providers-U3O7GOPH.js} +1 -1
  44. package/dist/{main-OMIZDIYB.js → main-BIBLUWZX.js} +219 -213
  45. package/dist/main.js +2 -2
  46. package/dist/{openai-UOCUBMFA.js → openai-AYEJOJTA.js} +1 -1
  47. package/dist/{providers-G5SKN22T.js → providers-USI6GYZC.js} +9 -9
  48. package/dist/{server-Z742CQSK.js → server-RGAJNHA4.js} +1 -1
  49. package/dist/{server-ESDMJACZ.js → server-XHQ7YJGI.js} +2 -2
  50. package/dist/{src-CHQYSTW5.js → src-E2NOTM6J.js} +1 -1
  51. package/dist/{src-HH6MC5CF.js → src-EBGRLYAR.js} +1 -1
  52. package/dist/{src-YWYPK5QA.js → src-HBBKRA75.js} +1 -1
  53. package/dist/src-P77FB5XW.js +12 -0
  54. package/dist/{turndown.es-NQ3KDXM7.js → turndown.es-E6SHSU5B.js} +13 -13
  55. package/package.json +2 -2
  56. package/dist/browser/dist/static/webapi-HZESKPJE.js +0 -4
  57. package/dist/chunk-5AOJ5ZSQ.js +0 -30
  58. package/dist/chunk-VM4YKTHC.js +0 -10
  59. package/dist/chunk-WKTO7XPO.js +0 -4
  60. package/dist/esm-6D27H27M.js +0 -225
  61. package/dist/file-type-PSFVPAEH.js +0 -12
  62. package/dist/getMachineId-bsd-2MDOCJCH.js +0 -4
  63. package/dist/getMachineId-bsd-L5XEQF74.js +0 -4
  64. package/dist/getMachineId-darwin-SMQEPEZ2.js +0 -5
  65. package/dist/getMachineId-darwin-V3OSZDJX.js +0 -5
  66. package/dist/src-P2WNZ6IY.js +0 -12
  67. /package/dist/{chunk-HKQWGX5S.js → chunk-UJIMMEIV.js} +0 -0
  68. /package/dist/{getMachineId-linux-OWR5YFVH.js → getMachineId-linux-337SESKP.js} +0 -0
  69. /package/dist/{getMachineId-linux-C4WJW6ZL.js → getMachineId-linux-P6HXMSZR.js} +0 -0
  70. /package/dist/{getMachineId-unsupported-M7AEHRA4.js → getMachineId-unsupported-52TDEFNE.js} +0 -0
  71. /package/dist/{getMachineId-unsupported-J7U5FNFT.js → getMachineId-unsupported-FWRH7XFO.js} +0 -0
@@ -1,225 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __yukinoCreateRequire } from "node:module";
3
- const require = __yukinoCreateRequire(import.meta.url);
4
- import{b as qW}from"./chunk-CKOUBYG6.js";import"./chunk-VU3JWAJR.js";import{a as Fs,b as Ws,c as JR,i as vu,u as oh,v as nv}from"./chunk-QYUIIFJY.js";import{a as rv,b as _o,c as Ou,d as ov,e as Xt,f as iv,g as sv,h as av,i as Xc,j as ih,k as gt,l as Lt,m as ce,n as Ee,o as Cu,p as ho,q as de}from"./chunk-U6NE2CTP.js";import{b as Nu,c as zR,d as Ru,e as ev,g as Yc,h as tv,i as jc,j as Zc,k as rh}from"./chunk-HKQWGX5S.js";import"./chunk-456FRBGE.js";import{a as An,c as Iu,d as $R,e as Au}from"./chunk-7MKA3SHV.js";var DS=Iu((IAe,pL)=>{"use strict";var US=An("path").sep;pL.exports=function(e){var t=e.split(US),n=t.lastIndexOf("node_modules");if(n!==-1&&t[n+1]){for(var r=t[n+1][0]==="@",o=r?t[n+1]+"/"+t[n+2]:t[n+1],i=r?3:2,s="",c=n+i-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+US;for(var l="",p=t.length-1,u=n+i;u<=p;u++)u===p?l+=t[u]:l+=t[u]+US;return{name:o,basedir:s,path:l}}}});var WS=Iu((AAe,FS)=>{"use strict";var za=An("path"),hr=An("module"),ft=qW()("require-in-the-middle"),uX=DS();FS.exports=mp;FS.exports.Hook=mp;var BS,Cm;if(hr.isBuiltin)Cm=hr.isBuiltin;else if(hr.builtinModules)Cm=e=>e.startsWith("node:")?!0:(BS===void 0&&(BS=new Set(hr.builtinModules)),BS.has(e));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var dX=/([/\\]index)?(\.js)?$/,HS=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 o=An.cache[t];return o&&o[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 mp(e,t,n){if(!(this instanceof mp))return new mp(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 HS,this._unhooked=!1,this._origRequire=hr.prototype.require;let r=this,o=new Set,i=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=Cm(p),d;if(u){if(d=p,p.startsWith("node:")){let M=p.slice(5);Cm(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=o.has(d);h===!1&&o.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(o.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=za.parse(d);m=M.name,_=M.dir}else{let M=uX(d);if(M===void 0)return ft("could not parse filename: %s",d),b;m=M.name,_=M.basedir;let N=mX(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(i===!0)m=m+za.sep+za.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}}mp.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 mX(e){let t=za.sep!=="/"?e.path.split(za.sep).join("/"):e.path;return za.posix.join(e.name,t).replace(dX,"")}});var yL=Iu(ec=>{"use strict";var XS=[],_L=new WeakMap,YS,jS,mL,KS=new Map,qS=[];function fL(e,t){return t==="module.exports"&&!Object.hasOwn(e,t)?e.default:e[t]}function hL(e,t,n){return _L.get(e).write(t,n)}function _X(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return hL(e,t,n.value)}var hX={defineProperty:_X,set:hL};function bL(e,t,n){let r=YS.get(e)?.[t];return typeof r=="function"?r(n):!0}function bX(e,t){if(t===Symbol.toStringTag)return"Module";let n=jS.get(e)[t];if(typeof n=="function")return n()}function yX(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return bL(e,t,n.value)}function SX(e,t,n,r,o){YS??=new WeakMap,jS??=new WeakMap,mL??={defineProperty:yX,get:bX,set:bL},KS.set(e,o),YS.set(t,n),jS.set(t,r);let i=new Proxy(t,mL);XS.forEach(s=>s(e,i,o)),qS.push([e,i,o])}function EX(e,t,n,r,o){if(arguments.length===5){SX(e,t,n,r,o);return}let{namespace:i}=t;KS.set(e,n),_L.set(i,t);let s=new Proxy(i,hX);XS.forEach(c=>c(e,s,n)),qS.push([e,s,n])}var gL=[0,10,50],ZS=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});#r=Object.create(null);#t;#n;#e;constructor(t,n,r,o){if(this.#t=r,n!==void 0)for(let i=0;i<n.length;i++)this.#s(n[i],i,o?.[i]??t)}#s(t,n,r){let o;try{o=fL(r,t),this.#t(n,o),this.namespace[t]=o}catch(i){if(!(i instanceof ReferenceError))throw i}o===void 0&&(this.#e??=[]).push(this.#a(t,n,r)),this.#r[t]=n}write(t,n){let r=this.#r[t];return r!==void 0&&(this.#t(r,n),this.#e!==void 0&&(this.#n??=Object.create(null),this.#n[t]=!0),this.namespace[t]=n),!0}#a(t,n,r){return()=>{if(this.#n?.[t]===!0)return!0;try{let o=fL(r,t);return o!==void 0?(this.#t(n,o),this.namespace[t]=o,!0):!1}catch(o){if(o instanceof ReferenceError)return!1;throw o}}}#o(){let t=this.#e;if(t===void 0)return;let n;for(let r of t)r()!==!0&&(n??=[]).push(r);this.#e=n}flush(){this.#e!==void 0&&queueMicrotask(()=>{this.#o(),this.#i(0)})}#i(t){if(this.#e===void 0)return;if(t>=gL.length){this.#e=void 0;return}let n=setTimeout(()=>{this.#o(),this.#i(t+1)},gL[t]);n&&typeof n.unref=="function"&&n.unref()}};ec.register=EX;ec.ModuleBinder=ZS;ec.importHooks=XS;ec.specifiers=KS;ec.toHook=qS});var eE=Iu((xAe,nc)=>{"use strict";var QS=An("path"),TX=DS(),{fileURLToPath:IX}=An("url"),{MessageChannel:AX}=An("worker_threads"),{isBuiltin:$S}=An("module");$S||($S=()=>!0);var{importHooks:JS,specifiers:NX,toHook:RX}=yL();function vX(e,t){if(process.platform==="win32"&&e.includes("/")&&(t=t.replaceAll(QS.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))}function SL(e){JS.push(e),RX.forEach(([t,n,r])=>e(t,n,r))}function EL(e){let t=JS.indexOf(e);t>-1&&JS.splice(t,1)}function tc(e,t,n,r){let o=e(t,n,r);o&&o!==t&&"default"in t&&(t.default=o)}var zS;function OX(){let{port1:e,port2:t}=new AX,n=0,r;zS=c=>{n++,e.postMessage(c)},e.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let c=setInterval(()=>{},1e3),a=new Promise(l=>{r=l}).then(()=>{clearInterval(c)});return n===0&&r(),a}let i=t;return{registerOptions:{data:{addHookMessagePort:i,include:[]},transferList:[i]},addHookMessagePort:i,waitForAllMessagesAcknowledged:o}}function fp(e,t,n){if(!(this instanceof fp))return new fp(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;zS&&Array.isArray(e)&&zS(e),this._iitmHook=(o,i,s)=>{let c=o,a=c.startsWith("node:"),l,p;if(a){let u=o.slice(5);$S(u)&&(o=u)}else if(c.startsWith("file://")){let u=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=IX(o),o=l}catch{}if(Error.stackTraceLimit=u,l){let d=TX(l);d&&(o=d.name,p=d.basedir)}}if(e)for(let u of e)if(l&&u===l)tc(n,i,l,void 0);else if(u===o){if(!p)tc(n,i,o,p);else if(vX(NX.get(c),p))tc(n,i,o,p);else if(r){let d=o+QS.sep+QS.relative(p,l);tc(n,i,d,p)}}else u===s&&tc(n,i,s,p);else tc(n,i,o,p)},SL(this._iitmHook)}fp.prototype.unhook=function(){EL(this._iitmHook)};nc.exports=fp;nc.exports.Hook=fp;nc.exports.addHook=SL;nc.exports.removeHook=EL;nc.exports.createAddHookMessageChannel=OX});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__||{},o=r[q]=r[q]||{};return o[e]||(o[e]=t())}var nr=["debug","info","warn","error","log","assert","trace"],QW="Sentry Logger ",tr={};function we(e){if(!("console"in te))return e();let t=te.console,n={},r=Object.keys(tr);r.forEach(o=>{let i=tr[o];n[o]=t[o],t[o]=i});try{return e()}finally{r.forEach(o=>{t[o]=n[o]})}}function $W(){ah().enabled=!0}function JW(){ah().enabled=!1}function cv(){return ah().enabled}function zW(...e){sh("log",...e)}function eV(...e){sh("warn",...e)}function tV(...e){sh("error",...e)}function sh(e,...t){E&&cv()&&we(()=>{te.console[e](`${QW}[${e}]:`,...t)})}function ah(){return E?Bn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:$W,disable:JW,isEnabled:cv,log:zW,warn:eV,error:tV};var lv=/\(error: (.*)\)/,pv=/captureMessage|captureException/;function Pu(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let i=[],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=lv.test(a)?a.replace(lv,"$1"):a;if(!l.includes("Error: ")){for(let p of t){let u=p(l);if(u){i.push(u);break}}if(i.length>=50+o)break}}return uv(i.slice(o))}}function lh(e){return Array.isArray(e)?Pu(...e):e}function uv(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(xu(t).function||"")&&t.pop(),t.reverse(),pv.test(xu(t).function||"")&&(t.pop(),pv.test(xu(t).function||"")&&t.pop()),t.slice(0,50).map(n=>({...n,filename:n.filename||xu(t).filename,function:n.function||"?"}))}function xu(e){return e[e.length-1]||{}}var ch="<anonymous>";function Kc(e){try{return!e||typeof e!="function"?ch:e.name||ch}catch{return ch}}function ku(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 dv(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var qc={},mv={};function ph(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 Qc(e,t){if(!mv[e]){mv[e]=!0;try{t()}catch(n){E&&g.error(`Error while instrumenting ${e}`,n)}}}function Vs(e,t){let n=e&&qc[e];if(n)for(let r of n)try{r(t)}catch(o){E&&g.error(`Error while triggering instrumentation handler.
6
- Type: ${e}
7
- Name: ${Kc(r)}
8
- Error:`,o)}}var fv=Object.prototype.toString;function ze(e){switch(fv.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return fh(e,Error)}}function Lu(e,t){return fv.call(e)===`[object ${t}]`}function uh(e){return Lu(e,"ErrorEvent")}function Ys(e){return Lu(e,"String")}function Zo(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function rr(e){return e===null||Zo(e)||typeof e!="object"&&typeof e!="function"}function Kt(e){return Lu(e,"Object")}function B(e){return typeof e=="object"&&e!==null}function dh(e){return typeof Event<"u"&&fh(e,Event)}function mh(e){return Lu(e,"RegExp")}function bt(e){return!!(e?.then&&typeof e.then=="function")}function fh(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 o=n(r);typeof o=="function"&&Fi(o,r);try{e[t]=o}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 Fi(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,Ge(e,"__sentry_original__",t)}catch{}}function js(e,t,n,r=!0){let o=e[t];if(typeof o!="function")throw new Error(`Cannot wrap method: ${t} is not a function`);if(Rr(o))throw new Error(`Attempting to wrap method ${t} multiple times`);Fi(n,o),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function Rr(e){return e.__sentry_original__}function Mu(e){if(ze(e))return{message:e.message,name:e.name,stack:e.stack,...gv(e)};if(dh(e)){let{type:t,target:n,currentTarget:r,detail:o}=e;return{type:t,target:n,currentTarget:r,...o?{detail:o}:{},...gv(e)}}return e}function gv(e){return B(e)?Object.fromEntries(Object.entries(e)):{}}function gh(e){let t=Object.keys(Mu(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var Zs;function Wi(e){if(Zs!==void 0)return Zs?Zs(e):e();let t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=te;return t in n&&typeof n[t]=="function"?(Zs=n[t],Zs(e)):(Zs=null,e())}function ct(){return Wi(()=>Math.random())}function rt(){return Wi(()=>Date.now())}var _v=Symbol.for("sentry.skipNormalization"),hv=Symbol.for("sentry.overrideNormalizationDepth");function bv(e){Ge(e,_v,!0)}function yv(e,t){Ge(e,hv,t)}function Sv(e){return!!e[_v]}function Ev(e){let t=e[hv];return typeof t=="number"?t:void 0}var Tv;function qe(e,t=100,n=1/0){try{return _h("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function hh(e,t=3,n=100*1024){let r=qe(e,t);return oV(r)>n?hh(e,t-1,n):r}function _h(e,t,n=1/0,r=1/0,o=iV()){let[i,s]=o;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let c=bh(e,t);if(!c.startsWith("[object "))return c;if(Sv(t))return t;let a=Ev(t),l=a!==void 0?a:n;if(l===0)return c.replace("object ","");if(i(t))return"[Circular ~]";let p=t;if(p&&typeof p.toJSON=="function")try{let _=p.toJSON();return _h("",_,l-1,r,o)}catch{}let u=Array.isArray(t)?[]:{},d=0,m=Mu(t);for(let _ in m){if(!Object.prototype.hasOwnProperty.call(m,_))continue;if(d>=r){u[_]="[MaxProperties ~]";break}let h=m[_];u[_]=_h(_,h,l-1,r,o),d++}return s(t),u}function bh(e,t){try{if(Tv){let r=Tv(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${Kc(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${nV(t)}]`}catch(n){return`**non-serializable** (${n})`}}function nV(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function rV(e){return~-encodeURI(e).split(/%..|./).length}function oV(e){return rV(JSON.stringify(e))}function iV(){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 yh(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let o=Math.max(t-60,0);o<5&&(o=0);let i=Math.min(o+140,r);return i>r-5&&(i=r),i===r&&(o=Math.max(i-140,0)),n=n.slice(o,i),o>0&&(n=`'{snip} ${n}`),i<r&&(n+=" {snip}"),n}function Xs(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let o=e[r];rr(o)?n.push(String(o)):o instanceof Error?n.push(o.message?`${o.name}: ${o.message}`:o.name):n.push(bh(void 0,o))}return n.join(t)}function vr(e,t,n=!1){return Ys(e)?mh(t)?t.test(e):Ys(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(vr(e,r,n))return!0;return!1}function sV(){let e=te;return e.crypto||e.msCrypto}var Sh;function aV(){return ct()*16}function ut(e=sV()){try{if(e?.randomUUID)return Wi(()=>e.randomUUID()).replace(/-/g,"")}catch{}return Sh||(Sh="10000000100040008000"+1e11),Sh.replace(/[018]/g,t=>(t^(aV()&15)>>t/4).toString(16))}function Iv(e){return e.exception?.values?.[0]}function Xo(e){let{message:t,event_id:n}=e;if(t)return t;let r=Iv(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Th(e,t,n){let r=e.exception=e.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type=n||"Error")}function Hn(e,t){let n=Iv(e);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...t},t&&"data"in t){let i={...o?.data,...t.data};n.mechanism.data=i}}var cV=/^(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 Eh(e){return parseInt(e||"",10)}function Ks(e){let t=e.match(cV)||[],n=Eh(t[1]),r=Eh(t[2]),o=Eh(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(o)?void 0:o,prerelease:t[4]}}function wu(e){if(Av(e))return!0;try{Ge(e,"__sentry_captured__",!0)}catch{}return!1}function Av(e){try{return e.__sentry_captured__}catch{}}var Rv=1e3;function Or(){return rt()/Rv}function lV(){let{performance:e}=te;if(!e?.now||!e.timeOrigin)return Or;let t=e.timeOrigin;return()=>(t+Wi(()=>e.now()))/Rv}var Nv;function lt(){return(Nv??(Nv=lV()))()}function vv(e){let t=lt(),n={sid:ut(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>pV(n)};return e&&bo(n,e),n}function bo(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 Ov(e,t){let n={};t?n={status:t}:e.status==="ok"&&(n={status:"exited"}),bo(e,n)}function pV(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 Ko(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 o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Ko(r[o],t[o],n-1));return r}function yt(){return ut()}function qt(){return ut().substring(16)}function Vi(e){try{let t=te.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function Yi(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}var Ih="_sentrySpan";function Fn(e,t){t?Ge(e,Ih,Vi(t)):delete e[Ih]}function or(e){return Yi(e[Ih])}var uV=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,or(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&&bo(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:o,attributes:i,extra:s,user:c,contexts:a,level:l,fingerprint:p=[],propagationContext:u,conversationId:d}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...i},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:uV;if(r<=0)return this;let o={timestamp:Or(),...t,message:t.message?gn(t.message,2048):t.message};return this._breadcrumbs.push(o),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:or(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Ko(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 o=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:o,...n,event_id:r},this),r}captureMessage(t,n,r){let o=r?.event_id||ut();if(!this._client)return E&&g.warn("No client configured on scope - will not capture message!"),o;let i=r?.syntheticException??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...r,event_id:o},this),o}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 Cv=e=>e instanceof Promise&&!e[xv],xv=Symbol("chained PromiseLike"),Gu=(e,t,n)=>{let r=e.then(o=>(t(o),o),o=>{throw n(o),o});return Cv(r)&&Cv(e)?r:dV(e,r)},dV=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let o=e[r];typeof o=="function"?Object.defineProperty(t,r,{value:(...i)=>o.apply(e,i),enumerable:!0,configurable:!0,writable:!0}):t[r]=o}return n&&Object.assign(t,{[xv]:!0}),t};var Ah=class{constructor(t,n){let r;t?r=t:r=new Qt;let o;n?o=n:o=new Qt,this._stack=[{scope:r}],this._isolationScope=o}withScope(t){let n=this._pushScope(),r;try{r=t(n)}catch(o){throw this._popScope(),o}return bt(r)?Gu(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 Qs(){let e=Je(),t=er(e);return t.stack=t.stack||new Ah(qs(),vt())}function mV(e){return Qs().withScope(e)}function fV(e,t){let n=Qs();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Pv(e){return Qs().withScope(()=>e(Qs().getIsolationScope()))}function kv(){return{withIsolationScope:Pv,withScope:mV,withSetScope:fV,withSetIsolationScope:(e,t)=>Pv(t),getCurrentScope:()=>Qs().getScope(),getIsolationScope:()=>Qs().getIsolationScope()}}function Nh(e){let t=Je(),n=er(t);n.acs=e}function St(e){let t=er(e);return t.acs?t.acs:kv()}function gV(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function _V(e,t){let{value:n,unit:r}=gV(e)?e:{value:e,unit:void 0},o=hV(n),i=r&&typeof r=="string"?{unit:r}:{};if(o)return{...o,...i};if(!t||t==="skip-undefined"&&n===void 0)return;let s="";try{s=JSON.stringify(n)??""}catch{}return{value:s,type:"string",...i}}function yo(e,t=!1){let n={};for(let[r,o]of Object.entries(e??{})){let i=_V(o,t);i&&(n[r]=i)}return n}function Rh(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 o=r.value;Array.isArray(o)?t+=Lv(o[0])*o.length:rr(o)?t+=Lv(o):t+=100}return t}function Lv(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function hV(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 Mv;function wv(){return Mv?.()}function vh(){return Mv!==void 0}function ne(){let e=Je();return St(e).getCurrentScope()}function $(){let e=Je();return St(e).getIsolationScope()}function ji(){return Bn("globalScope",()=>new Qt)}function He(...e){let t=Je(),n=St(t);if(e.length===2){let[r,o]=e;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(e[0])}function ir(...e){let t=Je(),n=St(t);if(e.length===2){let[r,o]=e;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(e[0])}function O(){return ne().getClient()}function Zi(e){let t=wv();if(t)return{trace_id:t.traceId,span_id:t.spanId};let n=e.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:i}=n,s={trace_id:r,span_id:i||qt()};return o&&(s.parent_span_id=o),s}var ve="sentry.source",Wn="sentry.sample_rate",Oh="sentry.previous_trace_sample_rate",H="sentry.op",S="sentry.origin",Ch="sentry.status.message";var Uu="sentry.measurement_unit",Du="sentry.measurement_value",xh="sentry.release",Ph="sentry.environment";var kh="sentry.sdk.integrations",Lh="user.id",Mh="user.email",$c="user.ip_address",wh="user.name",hn="sentry.custom_span_name",$s="sentry.profile_id",Js="sentry.exclusive_time",Gh="cache.hit",Uh="cache.key",Dh="cache.item_size",Bh="http.request.method";var Xi="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 zs(e,t){e.setAttribute("http.response.status_code",t);let n=wt(t);n.message!=="unknown_error"&&e.setStatus(n)}var Gv="_sentryScope",Uv="_sentryIsolationScope",Dv=Symbol.for("sentry.otelSourceInference"),Bv=Symbol.for("sentry.otelSourceExplicitlySet"),Hv=Symbol.for("sentry.tracerProviderSpan");function Cr(e,t,n){e&&(Ge(e,Uv,Vi(n)),Ge(e,Gv,t))}function $t(e){let t=e;return{scope:t[Gv],isolationScope:Yi(t[Uv])}}function Hh(e){Ge(e,Dv,!0)}function ea(e){return e[Dv]===!0}function Fh(e){Ge(e,Bv,!0)}function Wh(e){return e[Bv]===!0}function Vh(e){Ge(e,Hv,!0)}function Bu(e){return e[Hv]===!0}var So="sentry-";var Wv=8192;function sr(e){let t=ta(e);if(!t)return;let n=Object.entries(t).reduce((r,[o,i])=>{if(o.startsWith(So)){let s=o.slice(So.length);r[s]=i}return r},{});if(Object.keys(n).length>0)return n}function qo(e){if(!e)return;let t=Object.entries(e).reduce((n,[r,o])=>(o&&(n[`${So}${r}`]=o),n),{});return Yh(t)}function ta(e){if(!(!e||!Ys(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{let r=Fv(n);return Object.entries(r).forEach(([o,i])=>{t[o]=i}),t},{}):Fv(e)}function Fv(e){return e.split(",").map(t=>{let n=t.indexOf("=");if(n===-1)return[];let r=t.slice(0,n),o=t.slice(n+1);return[r,o].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}function Yh(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],o)=>{let i=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,s=o===0?i:`${t},${i}`;return s.length>Wv?(E&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):s},"")}function na(e,t){if(!e)return t;let n=ta(e),r=ta(t);if(!r)return e;let o={},i=!1,s={},c={};for(let[a,l]of Object.entries(r))a.startsWith(So)?(s[a]=l,i=!0):c[a]=l;if(n)for(let[a,l]of Object.entries(n))(!i||!a.startsWith(So))&&(o[a]=l);i&&Object.assign(o,s);for(let[a,l]of Object.entries(c))o[a]??(o[a]=l);return Yh(o)}var bV=/^o(\d+)\./,yV=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function SV(e){return e==="http"||e==="https"}function sn(e,t=!1){let{host:n,path:r,pass:o,port:i,projectId:s,protocol:c,publicKey:a}=e;return`${c}://${a}${t&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${s}`}function EV(e){let t=yV.exec(e);if(!t){we(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,o="",i="",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 Vv({host:i,pass:o,path:a,projectId:l,port:s,protocol:n,publicKey:r})}function Vv(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function TV(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+$/)?SV(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 IV(e){return e.match(bV)?.[1]}function Hu(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=IV(n)),r}function Yv(e){let t=typeof e=="string"?EV(e):Vv(e);if(!(!t||!TV(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 Fu=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function jv(e){if(!e)return;let t=e.match(Fu);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 Jc(e){return!!e.parentSpanId||!!e.dsc}function Rn(e,t){let n=jv(e),r=sr(t);if(!n?.traceId)return{traceId:yt(),sampleRand:ct()};let o=AV(n,r);r&&(r.sample_rand=o.toString());let{traceId:i,parentSpanId:s,parentSampled:c}=n;return{traceId:i,parentSpanId:s,sampled:c,dsc:r||{},sampleRand:o}}function Qo(e=yt(),t=qt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function $o(e=yt(),t=qt(),n){return`00-${e}-${t}-${n?"01":"00"}`}function AV(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 zc(e,t){let n=Hu(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 Wu=0,nl=1,Zv=!1;function Kv(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:o,parent_span_id:i,status:s,origin:c,links:a}=ie(e);return{parent_span_id:i,span_id:t,trace_id:n,data:r,op:o,status:s,origin:c,links:a}}function Pr(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),o=r?t:ie(e).parent_span_id,i=$t(e).scope,s=r?i?.getPropagationContext().propagationSpanId||qt():t;return{parent_span_id:o,span_id:s,trace_id:n}}function rl(e){let{traceId:t,spanId:n}=e.spanContext(),r=zt(e);return Qo(t,n,r)}function qv(e){let{traceId:t,spanId:n}=e.spanContext(),r=zt(e);return $o(t,n,r)}function Ki(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...o},attributes:i})=>({span_id:t,trace_id:n,sampled:r===nl,attributes:i,...o}))}function Zh(e){if(e?.length)return e.map(({context:{spanId:t,traceId:n,traceFlags:r},attributes:o})=>({span_id:t,trace_id:n,sampled:r===nl,attributes:o}))}function Jt(e){return typeof e=="number"?Xv(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Xv(e.getTime()):lt()}function Xv(e){return e>9999999999?e/1e3:e}function ie(e){if(ol(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if($v(e)){let{attributes:r,startTime:o,name:i,endTime:s,status:c,links:a}=e;return{span_id:t,trace_id:n,data:r,description:i,parent_span_id:Qv(e),start_timestamp:Jt(o),timestamp:Jt(s)||void 0,status:qi(c),op:r[H],origin:r[S],links:Ki(a)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Vu(e){if(ol(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if($v(e)){let{attributes:r,startTime:o,name:i,endTime:s,status:c,links:a}=e;return{name:i,span_id:t,trace_id:n,parent_span_id:Qv(e),start_timestamp:Jt(o),end_timestamp:Jt(s),is_segment:e===ra(e),status:ju(c),attributes:Xh(r,c),links:Zh(a)}}return{span_id:t,trace_id:n,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===ra(e)}}function Qv(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function Yu(e){return{...e,attributes:yo(e.attributes),links:e.links?.map(t=>({...t,attributes:yo(t.attributes)}))}}function $v(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===nl}function qi(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function ju(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}function Xh(e,t){let n=ju(t)==="error"?t?.message:void 0;return{...n&&{[Ch]:n},...e}}var el="_sentryChildSpans",jh="_sentryRootSpan";function Eo(e,t){let n=e[jh]||e;Ge(t,jh,n),zt(e)&&(!e.isRecording()&&!n.isRecording()||(e[el]?e[el].add(t):Ge(e,el,new Set([t]))))}function il(e){let t=new Set;function n(r){if(!t.has(r)&&zt(r)){t.add(r);let o=r[el]?Array.from(r[el]):[];for(let i of o)n(i)}}return n(e),Array.from(t)}var Oe=ra;function ra(e){return e[jh]||e}function Q(){let e=Je(),t=St(e);return t.getActiveSpan?t.getActiveSpan():or(ne())}function Qi(){Zv||(we(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Zv=!0)}function Kh(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 Jv(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(RV(n)){if(e.description&&vr(e.description,n))return E&&Jv(e),!0;continue}let r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;let o=n.name?e.description&&vr(e.description,n.name):!0,i=n.op?e.op&&vr(e.op,n.op):!0,s=n.attributes?Object.entries(n.attributes).every(([c,a])=>NV(e.attributes?.[c],a)):!0;if(o&&i&&s)return E&&Jv(e),!0}return!1}function NV(e,t){return typeof e=="string"&&(typeof t=="string"||t instanceof RegExp)?vr(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e===t}function zv(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let o of e)o.parent_span_id===r&&(o.parent_span_id=n)}function RV(e){return typeof e=="string"||e instanceof RegExp}var e0=Symbol.for("sentry.nonRecordingSpan"),kr=class{constructor(t={}){this._traceId=t.traceId||yt(),this._spanId=t.spanId||qt(),this.dropReason=t.dropReason,Ge(this,e0,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Wu}}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 Jo(e){return!!e&&e[e0]===!0}var zo="production";var t0="_frozenDsc";function qh(e,t){Ge(e,t0,t)}function Qh(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},o={environment:n.environment||zo,release:n.release,public_key:r,trace_id:e,org_id:Hu(t)};return t.emit("createDsc",o),o}function cr(e,t){let n=t.getPropagationContext();return n.dsc||Qh(n.traceId,e)}function ot(e){let t=O();if(!t)return{};let n=Oe(e),r=ie(n),o=r.data,i=n.spanContext().traceState,s=i?.get("sentry.sample_rate")??o[Wn]??o[Oh];function c(b){return(typeof s=="number"||typeof s=="string")&&(b.sample_rate=`${s}`),b}let a=n[t0];if(a)return c(a);let l=Jo(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=i?.get("sentry.dsc"),d=u&&sr(u);if(d)return c(d);let m=Qh(e.spanContext().traceId,t),_=o[ve]??o["sentry.segment.name.source"],h=r.description;return _!=="url"&&h&&(m.transaction=h),De()&&(m.sampled=String(zt(n)),m.sample_rand=i?.get("sentry.sample_rand")??$t(n).scope?.getPropagationContext().sampleRand.toString()),c(m),t.emit("createDsc",m,n),m}function $h(e){let t=ot(e);return qo(t)}function Jh(e){return Ge(e,"_streamed",!0),e}function To(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function Gt(e,t=[]){return[e,t]}function Zu(e,t){let[n,r]=e;return[n,[...r,t]]}function sl(e,t){let n=e[1];for(let r of n){let o=r[0].type;if(t(r,o))return!0}return!1}function eb(e,t){return sl(e,(n,r)=>t.includes(r))}function zh(e){let t=er(te);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function al(e){let[t,n]=e,r=JSON.stringify(t);function o(i){typeof r=="string"?r=typeof i=="string"?r+i:[zh(r),i]:r.push(typeof i=="string"?zh(i):i)}for(let i of n){let[s,c]=i;if(o(`
9
- ${JSON.stringify(s)}
10
- `),typeof c=="string"||c instanceof Uint8Array)o(c);else{let a;try{a=JSON.stringify(c)}catch{a=JSON.stringify(qe(c))}o(a)}}return typeof r=="string"?r:vV(r)}function vV(e){let t=e.reduce((o,i)=>o+i.length,0),n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function tb(e){return[{type:"span"},e]}function nb(e){let t=typeof e.data=="string"?zh(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var n0={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 OV(e){return e in n0}function Xu(e){return OV(e)?n0[e]:e}function oa(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function rb(e,t,n,r){let o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(rt()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:sn(r)},...o&&{trace:o}}}function CV(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 r0(e,t,n,r){let o=oa(n),i={sent_at:new Date(rt()).toISOString(),...o&&{sdk:o},...!!r&&t&&{dsn:sn(t)}},s="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return Gt(i,[s])}function o0(e,t,n,r){let o=oa(n),i=e.type&&e.type!=="replay_event"?e.type:"event";CV(e,n?.sdk);let s=rb(e,o,r,t);return delete e.sdkProcessingMetadata,Gt(s,[[{type:i},e]])}function i0(e,t){function n(m){return!!m.trace_id&&!!m.public_key}let r=ot(e[0]),o=t?.getDsn(),i=t?.getOptions().tunnel,s={sent_at:new Date(rt()).toISOString(),...n(r)&&{trace:r},...!!i&&o&&{dsn:sn(o)}},{beforeSendSpan:c,ignoreSpans:a}=t?.getOptions()||{},l=a?.length?e.filter(m=>{let _=ie(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 _=ie(m),h=To(c)?_:c(_);return h||(Qi(),_)}:ie,d=[];for(let m of l){let _=u(m);_&&d.push(tb(_))}return Gt(s,d)}function cl(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=ie(e),{spanId:o}=e.spanContext(),i=zt(e),s=Oe(e),c=s===e,a=`[Tracing] Starting ${i?"sampled":"unsampled"} ${c?"root ":""}span`,l=[`op: ${n}`,`name: ${t}`,`ID: ${o}`];if(r&&l.push(`parent ID: ${r}`),!c){let{op:p,description:u}=ie(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 ll(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >"}=ie(e),{spanId:r}=e.spanContext(),i=Oe(e)===e,s=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${t}" with ID ${r}`;g.log(s)}function ob(e,t,n,r=Q()){let o=r&&Oe(r);o&&(E&&g.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),o.addEvent(e,{[Du]:t,[Uu]:n}))}function $i(e){if(!e||e.length===0)return;let t={};return e.forEach(n=>{let r=n.attributes||{},o=r[Uu],i=r[Du];typeof o=="string"&&typeof i=="number"&&(t[n.name]={value:i,unit:o})}),t}function s0(e){er(Je()).segmentSpanCaptureStrategy=e}function pl(){return er(Je()).segmentSpanCaptureStrategy}function it(e){return e.getOptions().traceLifecycle==="stream"}var Ku=1e3,ia=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?nl:Wu}}setAttribute(t,n){return this._frozen?this:(n===void 0?delete this._attributes[t]:this._attributes[t]=n,t===ve&&n!==void 0&&ea(this)&&Fh(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,ea(this)||this.setAttribute(ve,"custom"),this)}end(t){if(this._endTime){this._frozen=Bu(this);return}this._endTime=Jt(t),ll(this),this._onSpanEnded(),this._frozen=Bu(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:qi(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[S],profile_id:this._attributes[$s],exclusive_time:this._attributes[Js],measurements:$i(this._events),is_segment:this._isStandaloneSpan&&Oe(this)===this||void 0,segment_id:this._isStandaloneSpan?Oe(this).spanContext().spanId:void 0,links:Ki(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:ju(this._status),attributes:Xh(this._attributes,this._status),links:Zh(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 o=a0(n)?n:r||lt(),i=a0(n)?{}:n||{},s={name:t,time:Jt(o),attributes:i};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?PV(i0([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=pl();if(s){let c=$t(this).scope||ne();s.onChildSpanEnded(this,n,a=>this._convertSpanToTransaction(a),c)}return}if(t&&it(t)){t.emit("afterSegmentSpanEnd",this);return}let o=$t(this).scope||ne(),i=pl();if(i)i.onSegmentSpanEnded(s=>this._convertSpanToTransaction(s),o);else{let s=this._convertSpanToTransaction();s&&o.captureEvent(s)}}_convertSpanToTransaction(t={}){if(!c0(ie(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),o=n?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;t.onSpanCaptured?.(this);let i=[],s=0;for(let m of il(this)){if(m===this||xV(m)||t.isSpanAlreadyCaptured?.(m))continue;let _=ie(m);if(!c0(_)){t.onSpanCaptured||s++;continue}t.onSpanCaptured?.(m),i.push(_)}let c=n?.getClient()||O();s&&c?.recordDroppedEvent("invalid","span",s),i.length>Ku&&c?.recordDroppedEvent("buffer_overflow","span",i.length-Ku);let a=this._attributes[ve];delete this._attributes[hn];let l=!1;i.forEach(m=>{delete m.data[hn],m.op?.startsWith("gen_ai.")&&(l=!0)});let p={contexts:{trace:Kv(this)},spans:i.length>Ku?i.sort((m,_)=>m.start_timestamp-_.start_timestamp).slice(0,Ku):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:n,capturedSpanIsolationScope:r,dynamicSamplingContext:ot(this),hasGenAiSpans:l},request:o,...a&&{transaction_info:{source:a}}},u=$i(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 a0(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function c0(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function xV(e){return e instanceof ia&&e.isStandaloneSpan()}function PV(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 o;try{o=e()}catch(i){throw t(i),n(),i}return kV(o,t,n,r)}function kV(e,t,n,r){return bt(e)?Gu(e,o=>{n(),r(o)},o=>{t(o),n()}):(n(),r(e),e)}function ul(e,t,n){if(!De(e))return[!1];let r,o;typeof e.tracesSampler=="function"?(o=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?o=t.parentSampled:typeof e.tracesSampleRate<"u"&&(o=e.tracesSampleRate,r=!0);let i=Nn(o);if(i===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(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!i)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,i,r];let s=n<i;return s||E&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[s,i,r]}var sa="__SENTRY_SUPPRESS_TRACING__";function Se(e,t){let n=Ji();if(n.startSpan)return n.startSpan(e,t);let r=ab(e),{forceTransaction:o,parentSpan:i,scope:s}=e,c=s?.clone();return He(c,()=>u0(i)(()=>{let l=ne(),p=cb(l,i),u=O(),m=e.onlyIfParent&&!p?ib(l,u):sb({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return(!Mr(m)||!p)&&Fn(l,m),lr(()=>t(m),()=>{let{status:_}=ie(m);m.isRecording()&&(!_||_==="ok")&&m.setStatus({code:2,message:"internal_error"})},()=>{m.end()})}))}function Le(e,t){let n=Ji();if(n.startSpanManual)return n.startSpanManual(e,t);let r=ab(e),{forceTransaction:o,parentSpan:i,scope:s}=e,c=s?.clone();return He(c,()=>u0(i)(()=>{let l=ne(),p=cb(l,i),d=e.onlyIfParent&&!p?ib(l,O()):sb({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return(!Mr(d)||!p)&&Fn(l,d),lr(()=>t(d,()=>d.end()),()=>{let{status:m}=ie(d);d.isRecording()&&(!m||m==="ok")&&d.setStatus({code:2,message:"internal_error"})})}))}function L(e){let t=Ji();return t.startInactiveSpan?t.startInactiveSpan(e):p0(e)}function aa(e){return p0(e)}function p0(e){let t=ab(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?i=>He(e.scope,i):r!==void 0?i=>se(r,i):i=>i())(()=>{let i=ne(),s=cb(i,r),c=O();return e.onlyIfParent&&!s?ib(i,c):sb({parentSpan:s,spanArguments:t,forceTransaction:n,scope:i})})}var vn=(e,t)=>{let n=Je(),r=St(n);if(r.continueTrace)return r.continueTrace(e,t);let{sentryTrace:o,baggage:i}=e,s=O(),c=sr(i);return s&&!zc(s,c?.org_id)?On(t):He(a=>{let l=Rn(o,i);return a.setPropagationContext(l),Fn(a,void 0),t()})};function se(e,t){let n=Ji();return n.withActiveSpan?n.withActiveSpan(e,t):He(r=>(Fn(r,e||void 0),t(r)))}function Vn(e){let t=Ji();return t.suppressTracing?t.suppressTracing(e):He(n=>{n.setSDKProcessingMetadata({[sa]:!0});let r=e();return n.setSDKProcessingMetadata({[sa]:void 0}),r})}function Lr(e=ne()){let t=Ji();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[sa]===!0}function On(e){let t=Ji();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 ib(e,t){t?.recordDroppedEvent("no_parent_span","span");let n=new kr({traceId:e.getPropagationContext().traceId});return Cr(n,e,$()),n}function sb({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let o=$();if(!De()){let c=r.getPropagationContext(),a=e?e.spanContext().traceId:c.traceId,l=new kr({traceId:a});return e&&!n&&Eo(e,l),Cr(l,r,o),l}let i=O();if(MV(i,t)){Lr(r)||i?.recordDroppedEvent("ignored","span");let c=new kr({dropReason:"ignored",traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&Eo(e,c),Cr(c,r,o),c}let s;if(e&&!n)s=LV(e,r,t,o),Eo(e,s);else if(e){let c=ot(e),{traceId:a,spanId:l}=e.spanContext(),p=zt(e);s=l0({traceId:a,parentSpanId:l,...t},r,o,p),qh(s,c)}else{let{traceId:c,dsc:a,parentSpanId:l,sampled:p}=r.getPropagationContext();s=l0({traceId:c,parentSpanId:l,...t},r,o,p),a&&qh(s,a)}return cl(s),s}function ab(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 Ji(){let e=Je();return St(e)}function l0(e,t,n,r){let o=O(),i=o?.getOptions()||{},{name:s=""}=e,c={spanAttributes:{...e.attributes},spanName:s,parentSampled:r};o?.emit("beforeSampling",c,{decision:!1});let a=c.parentSampled??r,l=c.spanAttributes,p=t.getPropagationContext(),u=Lr(t),[d,m,_]=u?[!1]:ul(i,{name:s,parentSampled:a,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:Nn(p.dsc?.sample_rate)},p.sampleRand),h=new ia({...e,attributes:{[ve]:"custom",[Wn]:m!==void 0&&_?m:void 0,...l},sampled:d});return!d&&o&&!u&&(E&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),o.recordDroppedEvent("sample_rate",it(o)?"span":"transaction")),Cr(h,t,n),o&&o.emit("spanStart",h),h}function LV(e,t,n,r){let{spanId:o,traceId:i}=e.spanContext(),s=Lr(t),c=s?!1:zt(e),a=c?new ia({...n,parentSpanId:o,traceId:i,sampled:c}):new kr({traceId:i});Eo(e,a),Cr(a,t,r);let l=O();return l&&(it(l)&&Jo(a)&&(Jo(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 cb(e,t){if(t)return t;if(t===null)return;let n=or(e);if(!n)return;let r=O();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Oe(n):n}function u0(e){return e!==void 0?t=>se(e,t):t=>t()}function MV(e,t){let n=e?.getOptions().ignoreSpans;return!e||!it(e)||!n?.length?!1:ar({description:t.name||"",op:t.attributes?.[H]||t.op,attributes:t.attributes},n)}function Mr(e){return Jo(e)&&e.dropReason==="ignored"}function dl(e,t,n){let r,o,i,s=n?.maxWait?Math.max(n.maxWait,t):0,c=n?.setTimeoutImpl||setTimeout;function a(){return l(),r=e(),r}function l(){o!==void 0&&clearTimeout(o),i!==void 0&&clearTimeout(i),o=i=void 0}function p(){return o!==void 0||i!==void 0?a():r}function u(){return o&&clearTimeout(o),o=c(a,t),s&&i===void 0&&(i=c(a,s)),r}return u.cancel=l,u.flush=p,u}var qu=new WeakSet,d0=e=>qu.has(e),m0=e=>{qu.add(e)},Qu=new WeakMap;function lb(e){if(pl()||s0(wV),Qu.has(e))return;let t=new Set,n=dl(()=>{let r=[...t];t.clear();for(let o of r)o()},1,{maxWait:100});e.on("flush",()=>{n.flush()}),Qu.set(e,r=>{t.add(r),n()})}var wV={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&Qu.get(n);if(!r){let o=e();o&&n?.captureEvent(o);return}r(()=>{let o=e({isSpanAlreadyCaptured:d0,onSpanCaptured:m0});o&&n.captureEvent(o)})},onChildSpanEnded(e,t,n,r){if(qu.has(e)||!qu.has(t))return;let o=r.getClient(),i=o&&Qu.get(o),s=()=>{let c=n({isSpanAlreadyCaptured:d0,onSpanCaptured:m0});c?.contexts?.trace?.data&&(c.contexts.trace.data["sentry.parent_span_already_sent"]=!0),c&&o?.captureEvent(c)};i?i(s):s()}};var GV=["addListener","on","once","prependListener","prependOnceListener","addEventListener"],UV=["removeListener","off","removeEventListener"],f0=Symbol("SentryScopeBoundListeners"),ca;function DV(e){return ca!==void 0&&(e===ca||e.listener===ca)}function bn(e,t=ne()){let n=e;if($u(n))return e;pb(n);for(let r of GV)typeof n[r]=="function"&&(n[r]=HV(n,n[r],t));for(let r of UV)typeof n[r]=="function"&&(n[r]=FV(n,n[r]));return typeof n.removeAllListeners=="function"&&(n.removeAllListeners=WV(n,n.removeAllListeners)),e}function BV(e,t){return function(...n){return He(t,()=>e.apply(this,n))}}function g0(e){return typeof e=="function"}function HV(e,t,n){return function(...r){let o=r[0],i=r[1],s=r.slice(2);if(!g0(i)||DV(i))return t.apply(this,r);let c=$u(e)||pb(e),a=c.get(o);a||(a=new WeakMap,c.set(o,a));let l=a.get(i);l||(l=BV(i,n),a.set(i,l));let p=ca;ca=l;try{return t.call(this,o,l,...s)}finally{ca=p}}}function FV(e,t){return function(...n){let r=n[0],o=n[1],i=n.slice(2),s=g0(o)?$u(e)?.get(r)?.get(o):void 0;return s?t.call(this,r,s,...i):t.apply(this,n)}}function WV(e,t){return function(...n){let r=$u(e);if(r)if(n.length===0)pb(e);else{let o=n[0];r.delete(o)}return t.apply(this,n)}}function pb(e){let t=new Map;return e[f0]=t,t}function $u(e){return e[f0]}function db(e,t){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=t;VV(e,t),r&&ZV(e,r),XV(e,n),YV(e,o),jV(e,i)}function ub(e,t){let{extra:n,tags:r,attributes:o,user:i,contexts:s,level:c,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:p,eventProcessors:u,attachments:d,propagationContext:m,transactionName:_,span:h}=t;ml(e,"extra",n),ml(e,"tags",r),ml(e,"attributes",o),ml(e,"user",i),ml(e,"contexts",s),e.sdkProcessingMetadata=Ko(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 ml(e,t,n){e[t]=Ko(e[t],n,1)}function Cn(e,t){let n=ji().getScopeData();return e&&ub(n,e.getScopeData()),t&&ub(n,t.getScopeData()),n}function VV(e,t){let{extra:n,tags:r,user:o,contexts:i,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(o).length&&(e.user={...o,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),s&&(e.level=s),c&&e.type!=="transaction"&&(e.transaction=c)}function YV(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function jV(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function ZV(e,t){e.contexts={trace:Pr(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ot(t),...e.sdkProcessingMetadata};let n=Oe(t),r=ie(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function XV(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 _0(e){let t={},{response:n,profile:r,cloud_resource:o,culture:i,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)),o)for(let[l,p]of Object.entries(o))p!=null&&(t[l]=p);i&&(i.locale&&(t["culture.locale"]=i.locale),i.timezone&&(t["culture.timezone"]=i.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 h0="aws.dynamodb.attribute_definitions",b0="aws.dynamodb.consistent_read",y0="aws.dynamodb.consumed_capacity",S0="aws.dynamodb.count",E0="aws.dynamodb.exclusive_start_table",T0="aws.dynamodb.global_secondary_indexes",I0="aws.dynamodb.global_secondary_index_updates",mb="aws.dynamodb.index_name",A0="aws.dynamodb.item_collection_metrics",N0="aws.dynamodb.limit",R0="aws.dynamodb.local_secondary_indexes",v0="aws.dynamodb.projection",O0="aws.dynamodb.provisioned_read_capacity",C0="aws.dynamodb.provisioned_write_capacity",x0="aws.dynamodb.scanned_count",P0="aws.dynamodb.scan_forward",k0="aws.dynamodb.segment",fb="aws.dynamodb.select",L0="aws.dynamodb.table_count",gb="aws.dynamodb.table_names",M0="aws.dynamodb.total_segments";var w0="aws.kinesis.stream.name";var G0="aws.request.extended_id";var U0="aws.request.id",D0="aws.s3.bucket",_b="aws.secretsmanager.secret.arn",hb="aws.sns.topic.arn",B0="aws.step_functions.activity.arn",H0="aws.step_functions.state_machine.arn";var la="cache.key";var Ju="cloud.region";var zu="code.function.name";var pa="db.collection.name";var Et="db.name",Io="db.namespace",ua="db.operation",da="db.operation.batch.size",pr="db.operation.name";var wr="db.query.text";var Ye="db.statement";var ke="db.system",dt="db.system.name",Ut="db.user";var Gr="error.type";var F0="faas.execution";var W0="faas.invoked_name",V0="faas.invoked_provider",Y0="faas.invoked_region",j0="faas.name";var ed="faas.trigger";var Z0="gen_ai.embeddings.input",X0="gen_ai.function_id",K0="gen_ai.input.messages",td="gen_ai.operation.name";var bb="gen_ai.output.messages";var q0="gen_ai.request.available_tools";var Ao="gen_ai.request.max_tokens";var fl="gen_ai.request.model";var ei="gen_ai.request.stop_sequences",No="gen_ai.request.temperature";var Ro="gen_ai.request.top_p",Ot="gen_ai.response.finish_reasons",Q0="gen_ai.response.id",$0="gen_ai.response.model",J0="gen_ai.response.streaming";var gl="gen_ai.system";var z0="gen_ai.tool.input";var eO="gen_ai.tool.name",tO="gen_ai.tool.output",nO="gen_ai.tool.type",Ur="gen_ai.usage.cache_creation.input_tokens",Dr="gen_ai.usage.cache_read.input_tokens";var en="gen_ai.usage.input_tokens";var Tt="gen_ai.usage.output_tokens";var nd="gen_ai.usage.reasoning.output_tokens",yb="gen_ai.usage.total_tokens",ma="graphql.document",rd="graphql.operation.name",od="graphql.operation.type";var rO="http.client_ip";var oO="http.flavor";var iO="http.host",Br="http.method";var Hr="http.request.method";var yn="http.response.status_code";var Fe="http.route",sO="http.scheme";var vo="http.status_code",id="http.target",Oo="http.url",aO="http.user_agent";var sd="koa.name",Sb="koa.type";var fa="messaging.batch.message_count",cO="messaging.destination";var xn="messaging.destination.name";var ga="messaging.message.id";var _a="messaging.operation.name",ur="messaging.operation.type";var Dt="messaging.system";var lO="network.peer.address",pO="network.peer.port",Eb="network.protocol.name",uO="network.protocol.version";var dO="net.host.ip",mO="net.host.name",fO="net.host.port",gO="net.peer.ip",Me="net.peer.name",Pe="net.peer.port";var ha="net.transport";var _O="rpc.grpc.status_code",hO="rpc.method";var ad="rpc.service",bO="rpc.system";var Tb="sentry.graphql.operation";var yO="sentry.http.prefetch";var SO="sentry.origin";var EO="sentry.sdk.name",TO="sentry.sdk.version",IO="sentry.segment.id";var AO="sentry.segment.name";var NO="sentry.trace_lifecycle";var _t="server.address";var ht="server.port",Ib="service.name",RO="service.version";var pt="url.full",ti="url.path";var cd="url.query";var vO="url.scheme";var OO="user_agent.original";function Ab(e,t){let n=Vu(e),r=ra(e),o=Vu(r),{isolationScope:i,scope:s}=$t(e),c=Cn(i,s);QV(n,o,t,c);let a=e.kind;t.emit("preprocessSpan",n,{spanKind:a}),n.is_segment&&(KV(n,c),qV(n,t),t.emit("processSegmentSpan",n)),t.emit("processSpan",n);let{beforeSendSpan:l}=t.getOptions(),p=l&&To(l)?$V(n,l):n,u=p.attributes?.[ve];return n.is_segment&&u&&Bt(p,{"sentry.segment.name.source":u}),{...Yu(p),_segmentSpan:r}}function KV(e,t){let n=_0(t.contexts);Bt(e,n)}function Bt(e,t){let n=e.attributes??(e.attributes={});Object.entries(t).forEach(([r,o])=>{o!=null&&!(r in n)&&(n[r]=o)})}function qV(e,t){let n=t.getIntegrationNames();n.length&&Bt(e,{[kh]:n})}function QV(e,t,n,r){let o=n.getSdkMetadata(),{release:i,environment:s}=n.getOptions();Bt(e,{[NO]:"stream",[AO]:t.name,[IO]:t.span_id,[EO]:o?.sdk?.name,[TO]:o?.sdk?.version,[xh]:i,[Ph]:s||zo,[Lh]:r.user?.id,[Mh]:r.user?.email,[$c]:r.user?.ip_address,[wh]:r.user?.username,...r.attributes})}function $V(e,t){let n=t(e);return n||(Qi(),e)}var Nb=0,CO=1,xO=2;function Co(e){return new ld(t=>{t(e)})}function ba(e){return new ld((t,n)=>{n(e)})}var ld=class e{constructor(t){this._state=Nb,this._handlers=[],this._runExecutor(t)}then(t,n){return new e((r,o)=>{this._handlers.push([!1,i=>{if(!t)r(i);else try{r(t(i))}catch(s){o(s)}},i=>{if(!n)o(i);else try{r(n(i))}catch(s){o(s)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new e((n,r)=>{let o,i;return this.then(s=>{i=!1,o=s,t&&t()},s=>{i=!0,o=s,t&&t()}).then(()=>{if(i){r(o);return}n(o)})})}_executeHandlers(){if(this._state===Nb)return;let t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===CO&&n[1](this._value),this._state===xO&&n[2](this._value),n[0]=!0)})}_runExecutor(t){let n=(i,s)=>{if(this._state===Nb){if(bt(s)){s.then(r,o);return}this._state=i,this._value=s,this._executeHandlers()}},r=i=>{n(CO,i)},o=i=>{n(xO,i)};try{t(r,o)}catch(i){o(i)}}};function PO(e,t,n,r=0){try{let o=Rb(t,n,e,r);return bt(o)?o:Co(o)}catch(o){return ba(o)}}function Rb(e,t,n,r){let o=n[r];if(!e||!o)return e;let i=o({...e},t);return E&&i===null&&g.log(`Event processor "${o.id||"?"}" dropped event`),bt(i)?i.then(s=>Rb(s,t,n,r+1)):Rb(i,t,n,r+1)}var zi,kO,LO,ni;function _l(e){let t=te._sentryDebugIds,n=te._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],o=n?Object.keys(n):[];if(ni&&r.length===kO&&o.length===LO)return ni;kO=r.length,LO=o.length,ni={},zi||(zi={});let i=(s,c)=>{for(let a of s){let l=c[a],p=zi?.[a];if(p&&ni&&l)ni[p[0]]=l,zi&&(zi[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(_&&ni&&zi){ni[_]=l,zi[a]=[_,l];break}}}}};return t&&i(r,t),n&&i(o,n),ni}function hl(e){return e.data?.__sentry__===!0}function pd(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 MO(e,t,n,r,o,i){let{normalizeDepth:s=3,normalizeMaxBreadth:c=1e3}=e,a={...t,event_id:t.event_id||n.event_id||ut(),timestamp:t.timestamp||Or()},l=n.integrations||e.integrations.map(b=>b.name);JV(a,e),tY(a,l),o&&o.emit("applyFrameMetadata",t),t.type===void 0&&zV(a,e.stackParser);let p=rY(r,n.captureContext);n.mechanism&&Hn(a,n.mechanism);let u=o?o.getEventProcessors():[],d=Cn(i,p),m=[...n.attachments||[],...d.attachments];m.length&&(n.attachments=m),db(a,d);let _=[...u,...d.eventProcessors];return(hl(n)?Co(a):PO(_,a,n)).then(b=>(b&&eY(b),typeof s=="number"&&s>0?nY(b,s,c):b))}function JV(e,t){let{environment:n,release:r,dist:o,maxValueLength:i}=t;e.environment=e.environment||n||zo,!e.release&&r&&(e.release=r),!e.dist&&o&&(e.dist=o);let s=e.request;s?.url&&i&&(s.url=gn(s.url,i)),i&&e.exception?.values?.forEach(c=>{c.value&&(c.value=gn(c.value,i))})}function zV(e,t){let n=_l(t);e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function eY(e){let t={};if(e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?t[o.abs_path]=o.debug_id:o.filename&&(t[o.filename]=o.debug_id),delete o.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,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function tY(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function nY(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:qe(o.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(o=>({...o,...o.data&&{data:qe(o.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=qe(e.contexts.flags,3,n)),r}function rY(e,t){if(!t)return e;let n=e?e.clone():new Qt;return n.update(t),n}function wO(e){if(e)return oY(e)?{captureContext:e}:sY(e)?{captureContext:e}:e}function oY(e){return e instanceof Qt||typeof e=="function"}var iY=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function sY(e){return Object.keys(e).some(t=>iY.includes(t))}function ge(e,t){return ne().captureException(e,wO(t))}function bl(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 yl(e,t){return ne().captureEvent(e,t)}function vb(e,t){$().setContext(e,t)}function Ob(e){$().setExtras(e)}function Cb(e,t){$().setExtra(e,t)}function xb(e){$().setTags(e)}function Pb(e,t){$().setTag(e,t)}function kb(e){$().setAttributes(e)}function Lb(e,t){$().setAttribute(e,t)}function Mb(e){$().setUser(e)}function GO(e){$().setConversationId(e)}function wb(){return $().lastEventId()}async function es(e){let t=O();return t?t.flush(e):(E&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function Gb(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 Ub(){return!!O()}function ts(){let e=O();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Db(e){$().addEventProcessor(e)}function Sl(e){let t=$(),{user:n}=Cn(t,ne()),{userAgent:r}=te.navigator||{},o=vv({user:n,...r&&{userAgent:r},...e}),i=t.getSession();return i?.status==="ok"&&bo(i,{status:"exited"}),ns(),t.setSession(o),o}function ns(){let e=$(),n=ne().getSession()||e.getSession();n&&Ov(n),UO(),e.setSession()}function UO(){let e=$(),t=O(),n=e.getSession();n&&t&&t.captureSession(n)}function Bb(e=!1){if(e){ns();return}UO()}function Fr(e,t,n){function r(){let i=El({monitorSlug:e,status:"in_progress"},n),s=lt();function c(l){El({monitorSlug:e,status:l,checkInId:i,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 o={...ne().getPropagationContext()};return ir(()=>{if(n?.isolateTrace)return On(r);let i=ne();return Jc(i.getPropagationContext())||i.setPropagationContext(o),r()})}function El(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 aY="7";function cY(e){let t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function lY(e){return`${cY(e)}${e.projectId}/envelope/`}function pY(e,t){let n={sentry_version:aY};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function DO(e,t,n){return t||`${lY(e)}?${pY(e,n)}`}var Hb=[];function uY(e){let t={};return e.forEach(n=>{let{name:r}=n,o=t[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function Fb(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){let o=n(t);r=Array.isArray(o)?o:[o]}else r=t;return uY(r)}function BO(e,t){let n={};return t.forEach(r=>{r?.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&Vb(e,r,n)}),n}function Wb(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Vb(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,!Hb.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),Hb.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",(o,i)=>r(o,i,e))}if(typeof t.processEvent=="function"){let r=t.processEvent.bind(t),o=Object.assign((i,s)=>r(i,s,e),{id:t.name});e.addEventProcessor(o)}["processSpan","processSegmentSpan"].forEach(r=>{let o=t[r];typeof o=="function"&&e.on(r,i=>o.call(t,i,e))}),E&&g.log(`Integration installed: ${t.name}`)}function Yb(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 o=e[r],i=t[r];if(typeof o=="function"&&typeof i=="function"){let s=new Proxy(o,{apply:(c,a,l)=>(Reflect.apply(c,a,l),Reflect.apply(i,a,l))});n[r]=s}}return n}var dY="sentry.timestamp.sequence",jb=0,Zb;function ud(e){let t=Math.floor(e*1e3);Zb!==void 0&&t!==Zb&&(jb=0);let n=jb;return jb++,Zb=t,{key:dY,value:{value:n,type:"integer"}}}function ya(e,t){return t?He(t,()=>{let n=Q(),r=n?Pr(n):Zi(t);return[n?ot(n):cr(e,t),r]}):[void 0,void 0]}var HO={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function FO(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function WO(){return!FO()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function It(){return typeof window<"u"&&(!WO()||mY())}function mY(){return te.process?.type==="renderer"}function fY(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 VO(e,t,n,r,o){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=sn(r)),Gt(i,[fY(e,o)])}var gY=100;function Wr(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function YO(e,t){let n=Kb(),r=jO(e);r===void 0?n.set(e,[t]):r.length>=gY?(Sa(e,r),n.set(e,[t])):n.set(e,[...r,t])}function dr(e,t=ne(),n=YO){let r=t?.getClient()??O();if(!r){E&&g.warn("No client available to capture log.");return}let{release:o,environment:i,enableLogs:s=!0,beforeSendLog:c}=r.getOptions();if(!s){E&&g.warn("logging option not enabled, log will not be captured.");return}let[,a]=ya(r,t),l={...e.attributes},{user:{id:p,email:u,username:d},attributes:m={}}=Cn($(),t);Wr(l,"user.id",p,!1),Wr(l,"user.email",u,!1),Wr(l,"user.name",d,!1),Wr(l,"sentry.release",o),Wr(l,"sentry.environment",i);let{name:_,version:h}=r.getSdkMetadata()?.sdk??{};Wr(l,"sentry.sdk.name",_),Wr(l,"sentry.sdk.version",h);let b=r.getIntegrationByName("Replay"),v=b?.getReplayId(!0);Wr(l,"sentry.replay_id",v),v&&b?.getRecordingMode()==="buffer"&&Wr(l,"sentry._internal.replay_is_buffering",!0);let M=e.message;if(Zo(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=or(t);Wr(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=ud(U),ue={timestamp:U,level:Y,body:Xb(String(T)),trace_id:a?.trace_id,severity_number:k??HO[Y],attributes:_Y({...yo(m),...yo(G,!0),[ae.key]:ae.value})};n(r,ue),r.emit("afterCaptureLog",P)}function Sa(e,t){let n=t??jO(e)??[];if(n.length===0)return;let r=e.getOptions(),o=VO(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Kb().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function jO(e){return Kb().get(e)}function Kb(){return Bn("clientToLogBufferMap",()=>new WeakMap)}function _Y(e){let t={};for(let[n,r]of Object.entries(e)){let o=Xb(n);r.type==="string"?t[o]={...r,value:Xb(r.value)}:t[o]=r}return t}function Xb(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 hY(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 ZO(e,t,n,r,o){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=sn(r)),Gt(i,[hY(e,o)])}var bY=1e3;function xo(e,t,n,r=!0){n&&(r||!(t in e))&&(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 yY(e,t,n){let{release:r,environment:o}=t.getOptions(),i={...e.attributes};xo(i,"user.id",n.id,!1),xo(i,"user.email",n.email,!1),xo(i,"user.name",n.username,!1),xo(i,"sentry.release",r),xo(i,"sentry.environment",o);let{name:s,version:c}=t.getSdkMetadata()?.sdk??{};xo(i,"sentry.sdk.name",s),xo(i,"sentry.sdk.version",c);let a=t.getIntegrationByName("Replay"),l=a?.getReplayId(!0);return xo(i,"sentry.replay_id",l),l&&a?.getRecordingMode()==="buffer"&&xo(i,"sentry._internal.replay_is_buffering",!0),{...e,attributes:i}}function SY(e,t,n,r){let[,o]=ya(t,n),i=or(n),s=i?i.spanContext().traceId:o?.trace_id,c=i?i.spanContext().spanId:void 0,a=lt(),l=ud(a);return{timestamp:a,trace_id:s??"",span_id:c,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...yo(r),...yo(e.attributes,"skip-undefined"),[l.key]:l.value}}}function qb(e,t){let n=t?.scope??ne(),r=t?.captureSerializedMetric??XO,o=n?.getClient()??O();if(!o){E&&g.warn("No client available to capture metric.");return}let{_experiments:i,enableMetrics:s,beforeSendMetric:c}=o.getOptions();if(!(s??i?.enableMetrics??!0)){E&&g.warn("metrics option not enabled, metric will not be captured.");return}let{user:l,attributes:p}=Cn($(),n),u=yY(e,o,l);o.emit("processMetric",u);let d=c||i?.beforeSendMetric,m=d?d(u):u;if(!m){E&&g.log("`beforeSendMetric` returned `null`, will not send metric.");return}let _=SY(m,o,n,p);E&&g.log("[Metric]",_),r(o,_),o.emit("afterCaptureMetric",m)}function Ea(e,t){let n=t??KO(e)??[];if(n.length===0)return;let r=e.getOptions(),o=ZO(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Qb().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function KO(e){return Qb().get(e)}function Qb(){return Bn("clientToMetricBufferMap",()=>new WeakMap)}function qO(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 Yu(t)}function QO(e,t){if(e.type!=="transaction"||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||it(t))return;let n=[],r=[];for(let i of e.spans)i.op?.startsWith("gen_ai.")?n.push(qO(i)):r.push(i);if(n.length===0)return;e.spans=r;let o=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:o,infer_user_agent:o}},items:n}]}var Tl=Symbol.for("SentryBufferFullError");function Ta(e=100){let t=new Set;function n(){return t.size<e}function r(s){t.delete(s)}function o(s){if(!n())return ba(Tl);let c=s();return t.add(c),c.then(()=>r(c),()=>r(c)),c}function i(s){if(!t.size)return Co(!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:o,drain:i}}var EY=60*1e3;function TY(e,t=rt()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?EY:r-t}function IY(e,t){return e[t]||e.all||0}function $O(e,t,n=rt()){return IY(e,t)>n}function JO(e,{statusCode:t,headers:n},r=rt()){let o={...e},i=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(i)for(let c of i.trim().split(",")){let[a,l,,,p]=c.split(":",5),u=parseInt(a,10),d=(isNaN(u)?60:u)*1e3;if(!l)o.all=r+d;else for(let m of l.split(";"))m==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[m]=r+d):o[m]=r+d}else s?o.all=r+TY(s,r):t===429&&(o.all=r+60*1e3);return o}var Il=64;function Ia(e,t,n=Ta(e.bufferSize||Il)){let r={},o=s=>n.drain(s);function i(s){let c=[];if(sl(s,(u,d)=>{let m=Xu(d);$O(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(eb(a,["client_report"])){E&&g.warn(`Dropping client report. Will not send outcomes (reason: ${u}).`);return}sl(a,(d,m)=>{e.recordDroppedEvent(u,Xu(m))})},p=()=>t({body:al(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=JO(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===Tl)return E&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw u})}return{send:i,flush:o}}function zO(e,t,n){let r=[{type:"client_report"},{timestamp:n||Or(),discarded_events:e}];return Gt(t?{dsn:t}:{},[r])}function eC(e){let{trace_id:t,parent_span_id:n,span_id:r,status:o,origin:i,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:o,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:s?.[$s],exclusive_time:s?.[Js],measurements:e.measurements,is_segment:!0}}function tC(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&&{[$s]:e.profile_id},...e.exclusive_time&&{[Js]:e.exclusive_time}}}},measurements:e.measurements}}var Aa="[Filtered]",Al=["forwarded","-ip","remote-","via","-user"],$b=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","sid","identity","set-cookie","cookie"],nC=[".sid","sessid","remember","oidc","pkce","nonce","__secure-","__host-","awsalb","awselb","akamai","__stripe","cognito","firebase","supabase","sb-","mfa","2fa"];function dd(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:Al},httpHeaders:{request:{deny:Al},response:{deny:Al}},httpBodies:[],urlQueryParams:{deny:Al},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var AY={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 NY(e){return typeof e=="boolean"||"allow"in e||"deny"in e}function RY(e,t){return e===void 0?{...t.httpHeaders}:NY(e)?{request:e,response:e}:{request:e.request??t.httpHeaders.request,response:e.response??t.httpHeaders.response}}function rC(e){let t=e.dataCollection!=null?AY:dd(e.sendDefaultPii),n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:RY(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 oC="Not capturing exception because it's already been captured.",iC="Discarded session because of missing or non-string release",dC=Symbol.for("SentryInternalError"),mC=Symbol.for("SentryDoNotSendEventError"),vY=5e3;function md(e){return{message:e,[dC]:!0}}function Jb(e){return{message:e,[mC]:!0}}function sC(e){return Jb(`Discarding event because it's not included in the random sample (sampling rate = ${e})`)}function aC(e){return B(e)&&dC in e}function cC(e){return B(e)&&mC in e}function lC(e,t,n,r,o){let i=0,s,c=!1;e.on(n,()=>{i=0,clearTimeout(s),c=!1}),e.on(t,a=>{if(i+=r(a),i>=8e5)o(e);else if(!c){let l=e.getOptions()._flushInterval??vY;l>0&&(c=!0,s=Pn(setTimeout(()=>{o(e)},l)))}}),e.on("flush",()=>{o(e)})}var fd=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Ta(t.transportOptions?.bufferSize??Il),this._dataCollection=rC(t),t.dsn?this._dsn=Yv(t.dsn):E&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=DO(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&&lC(this,"afterCaptureLog","flushLogs",PY,Sa),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&lC(this,"afterCaptureMetric","flushMetrics",xY,Ea)}captureException(t,n,r){let o=ut();if(wu(t))return E&&g.log(oC),o;let i={event_id:o,...n};return this._process(()=>this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r)).then(s=>s),"error"),i.event_id}captureMessage(t,n,r,o){let i={event_id:ut(),...r},s=Zo(t)?t:String(t),c=rr(t),a=c?this.eventFromMessage(s,n,i):this.eventFromException(t,i);return this._process(()=>a.then(l=>this._captureEvent(l,i,o)),c?"unknown":"error"),i.event_id}captureEvent(t,n,r){let o=ut();if(n?.originalException&&wu(n.originalException))return E&&g.log(oC),o;let i={event_id:o,...n},s=t.sdkProcessingMetadata||{},c=s.capturedSpanScope,a=s.capturedSpanIsolationScope,l=pC(t.type);return this._process(()=>this._captureEvent(t,i,c||r,a),l),i.event_id}captureSession(t){this.sendSession(t),bo(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),o=await n.flush(t);return r&&o}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),Vb(this,t,this._integrations),n||Wb(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let r=QO(t,this),o=o0(t,this._dsn,this._options._metadata,this._options.tunnel);if(!hl(n))for(let i of n.attachments||[])o=Zu(o,nb(i));r&&(o=Zu(o,r)),this.sendEnvelope(o).then(i=>this.emit("afterSendEvent",t,i))}sendSession(t){let{release:n,environment:r=zo}=this._options;if("aggregates"in t){let i=t.attrs||{};if(!i.release&&!n){E&&g.warn(iC);return}i.release=i.release||n,i.environment=i.environment||r,t.attrs=i}else{if(!t.release&&!n){E&&g.warn(iC);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);let o=r0(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){let o=`${t}:${n}`;E&&g.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(t,n){let r=this._hooks[t]=this._hooks[t]||new Set,o=(...i)=>n(...i);return r.add(o),()=>{r.delete(o)}}emit(t,...n){let r=this._hooks[t];r&&r.forEach(o=>o(...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=BO(this,t),Wb(this,t)}_updateSessionFromEvent(t,n){let r=n.level==="fatal",o=!1,i=n.exception?.values;if(i){o=!0,r=!1;for(let a of i)if(a.mechanism?.handled===!1){r=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(bo(t,{...r&&{status:"crashed"},errors:t.errors||Number(o||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,o){let i=this.getOptions(),s=this.getIntegrationNames();return!n.integrations&&s.length&&(n.integrations=s),this.emit("preprocessEvent",t,n),t.type||o.setLastEventId(t.event_id||n.event_id),MO(i,t,n,r,this,o).then(c=>{if(c===null)return c;this.emit("postprocessEvent",c,n),c.contexts={trace:{...c.contexts?.trace,...Zi(r)},...c.contexts};let a=cr(this,r);return c.sdkProcessingMetadata={dynamicSamplingContext:a,...c.sdkProcessingMetadata},c})}_captureEvent(t,n={},r=ne(),o=$()){return E&&zb(t)&&g.log(`Captured error event \`${pd(t)[0]||"<unknown>"}\``),this._processEvent(t,n,r,o).then(i=>i.event_id,i=>{E&&(cC(i)?g.log(i.message):aC(i)?g.warn(i.message):g.warn(i))})}_processEvent(t,n,r,o){let i=this.getOptions(),{sampleRate:s}=i,c=fC(t),a=zb(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=pC(t.type),_=r.getSession()||o.getSession();return d&&_?.status!=="ok"?(this.recordDroppedEvent("sample_rate","error"),ba(sC(s))):this._prepareEvent(t,n,r,o).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",m),Jb("An event processor returned `null`, will not send event.");if(hl(n))return h;let b=CY(this,i,h,n);return OY(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 Jb(`${p} returned \`null\`, will not send event.`)}if(a&&_&&this._updateSessionFromEvent(_,h),d)throw this.recordDroppedEvent("sample_rate","error"),sC(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 cC(h)||aC(h)?h:(this.captureException(h,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:h}),md(`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===Tl&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{let[o,i]=n.split(":");return{reason:o,category:i,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=zO(t,this._options.tunnel&&sn(this._dsn));this.sendEnvelope(n)}};function pC(e){return e==="replay_event"?"replay":e||"error"}function OY(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 md(n);return r},r=>{throw md(`${t} rejected with ${r}`)});if(!Kt(e)&&e!==null)throw md(n);return e}function CY(e,t,n,r){let{beforeSend:o,beforeSendTransaction:i,ignoreSpans:s}=t,c=!To(t.beforeSendSpan)&&t.beforeSendSpan,a=n;if(zb(a)&&o)return o(a,r);if(fC(a)){if(c||s){let l=eC(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=Ko(n,tC(p)):Qi()}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)){zv(u,m);continue}if(c){let _=c(m);_?p.push(_):(Qi(),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(i){if(a.spans){let l=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return i(a,r)}}return a}function zb(e){return e.type===void 0}function fC(e){return e.type==="transaction"}function xY(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+gC(e.attributes)}function PY(e){let t=0;return e.message&&(t+=e.message.length*2),t+gC(e.attributes)}function gC(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*uC(n[0]):rr(n)?t+=uC(n):t+=100}),t}function uC(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function ey(e){ne().setClient(e)}var ty=new Set;function Po(e){e.forEach(t=>{ty.add(t),E&&g.log(`AI provider "${t}" wrapping will be skipped`)})}function kn(e){return ty.has(e)}function ny(){ty.clear(),E&&g.log("Cleared AI provider skip registrations")}function kY(e,t){return t.some(n=>e.includes(n))}function ry(e,t,n){if(t===!1)return!0;let r=e.toLowerCase(),o=n!=null?[...$b,...n]:$b;if(kY(r,o))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 Na(e,t,n){if(t===!1)return{};let r={};for(let o of Object.keys(e))r[o]=ry(o,t,n)?Aa:e[o];return r}function _C(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf("=",n);if(r===-1)break;let o=e.indexOf(";",n);if(o===-1)o=e.length;else if(o<r){n=e.lastIndexOf(";",r-1)+1;continue}let i=e.slice(n,r).trim();if(t[i]===void 0){let s=e.slice(r+1,o).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));try{t[i]=s.indexOf("%")!==-1?decodeURIComponent(s):s}catch{t[i]=s}}n=o+1}return t}function Ra(e,t){if(!(!e||t===!1))return e.split("&").map(n=>{let r=n.indexOf("="),o=r===-1?n:n.slice(0,r),i=new URLSearchParams(`${o}=`).keys().next().value;return i!==void 0&&ry(i,t)?`${o}=${Aa}`:n}).join("&")}function Nl(e,t){let n=e.indexOf("#"),r=n===-1?e.length:n,o=e.indexOf("?");if(o===-1||o>r)return e;let i=e.slice(0,o),s=e.slice(o+1,r),c=e.slice(r),a=Ra(s,t);return a?`${i}?${a}${c}`:`${i}${c}`}function hC(e){return(e??O())?.getDataCollectionOptions().urlQueryParams??!0}function Ct(e,t){return e===void 0?void 0:Nl(e,hC(t))}function Yn(e,t){if(!e)return e;let n=e.startsWith("?"),r=Ra(n?e.slice(1):e,hC(t));return r&&n?`?${r}`:r}var LY=new Set(["false","f","n","no","off","0"]),MY=new Set(["true","t","y","yes","on","1"]);function rs(e,t){let n=String(e).toLowerCase();return LY.has(n)?!1:MY.has(n)?!0:t?.strict?null:!!e}function bC(e,t,n,r,o){let i={sent_at:new Date(rt()).toISOString()};n?.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(i.dsn=sn(o)),t&&(i.trace=t);let s=wY(e);return Gt(i,[s])}function wY(e){return[{type:"check_in"},e]}var GY="thismessage:/";function mr(e){return"isRelative"in e}function fr(e,t){let n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=t??(n?GY:void 0);try{if("canParse"in URL&&!URL.canParse(e,r))return;let o=new URL(e,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function yC(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 UY(e,t,n,r){let o=n?.method?.toUpperCase()??"GET",i=r||(e?t==="client"?yC(e):e.pathname:"/");return`${o} ${i}`}function oy(e,t,n,r,o,i){let s={[S]:n,[ve]:"url"};return o&&(s[t==="server"?"http.route":"url.template"]=o,s[ve]="route"),r?.method&&(s[Bh]=r.method.toUpperCase()),e&&(e.search&&(s["url.query"]=Yn(e.search,i)),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,i),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))),[UY(e,t,r,o),s]}function ri(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 oi(e){let{protocol:t,host:n,path:r}=e,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${t?`${t}://`:""}${o}${r}`}function Rl(e,t=!0){if(e.startsWith("data:")){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=e.includes(";base64,"),i=e.indexOf(","),s="";if(t&&i!==-1){let c=e.slice(i+1);s=c.length>10?`${c.slice(0,10)}... [truncated]`:c}return`data:${r}${o?",base64":""}${s?`,${s}`:""}`}return e}function iy(e,t){let n=t?.getDsn(),r=t?.getOptions().tunnel;return BY(e,n)||DY(e,r)}function DY(e,t){return t?SC(e)===SC(t):!1}function BY(e,t){let n=fr(e);return!n||mr(n)||!t?!1:HY(n.hostname,t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function HY(e,t){return e===t||t.length>0&&e.endsWith(`.${t}`)}function SC(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function gd(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 sy=gd;function os(e,t,n=[t],r="npm"){let o=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${t}`,o.packages=n.map(i=>({name:`${r}:@sentry/${i}`,version:q})),o.version=q)}function tt(e={}){let t=e.client||O();if(!ts()||!t)return{};let n=Je(),r=St(n);if(r.getTraceData)return r.getTraceData(e);let o=e.scope||ne(),i=e.span||Q(),s=Jo(i)&&!De(t.getOptions());if(!i&&vh())return{};let c=i&&!s?rl(i):FY(o),a=i?ot(i):cr(t,o),l=qo(a);if(!Fu.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=i&&!s?qv(i):WY(o)),u}function FY(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Qo(t,r,n)}function WY(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return $o(t,r,n)}var EC="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function is(e,t,n){if(typeof e!="string"||!t)return!0;let r=n?.get(e);if(r!==void 0)return E&&!r&&g.log(EC,e),r;let o=_n(e,t);return n?.set(e,o),E&&!o&&g.log(EC,e),o}function ay(e){return Object.entries(e||tt()).map(([t,n])=>`<meta name="${t}" content="${n}"/>`).join("")}function vl(e){return Array.from(new Set(e))}var TC=1024*1024;function cy(e){return e==="small"?1e3:e==="medium"?1e4:TC}function IC(e){let t={};try{e.forEach((n,r)=>{typeof n=="string"&&(t[r]=n)})}catch{}return t}function hd(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 ss(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),i=(typeof t["x-forwarded-proto"]=="string"?t["x-forwarded-proto"]:void 0)||e.protocol||(e.socket?.encrypted?"https":"http"),s=e.url||"",c=VY({url:s,host:r,protocol:i}),a=e.body||void 0,l=e.cookies;return{url:c,method:e.method,query_string:AC(s),headers:hd(t),cookies:l,data:a}}function VY({url:e,protocol:t,host:n}){if(e?.startsWith("http"))return e;if(e&&n)return`${t}://${n}${e}`}function Vr(e,t=!1,n="request"){let r=typeof t=="boolean"?dd(t):t,o=n==="request"?r.httpHeaders.request:r.httpHeaders.response,i=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(i===!1)continue;if(typeof p=="string"&&p!==""){let m=YY(p,u==="set-cookie"),_=Na(m,i,nC);for(let[h,b]of Object.entries(_))c[`${s}${_d(u)}.${_d(h)}`]=b}else c[`${s}${_d(u)}`]=Aa}else{if(o===!1)continue;Array.isArray(p)?a[u]=p.map(m=>m!=null?String(m):m).join(";"):typeof p=="string"&&(a[u]=p)}}if(o!==!1){let l=Na(a,o);for(let[p,u]of Object.entries(l))c[`${s}${_d(p)}`]=u}}catch{}return c}function _d(e){return e.replace(/-/g,"_")}function YY(e,t){let n=e.indexOf(";"),r=t&&n!==-1?e.substring(0,n):e,o=t?[r]:r.split("; "),i={};for(let s of o){let c=s.indexOf("="),a=(c!==-1?s.substring(0,c):s).toLowerCase(),l=c!==-1?s.substring(c+1):"";i[a]=l}return i}function AC(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},jY={[D.INTERNAL]:"INTERNAL",[D.SERVER]:"SERVER",[D.CLIENT]:"CLIENT",[D.PRODUCER]:"PRODUCER",[D.CONSUMER]:"CONSUMER"};function ly(e){return jY[e]}var ZY=100;function an(e,t){let n=O(),r=$();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:i=ZY}=n.getOptions();if(i<=0)return;let c={timestamp:Or(),...e},a=o?we(()=>o(c,t)):c;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,i))}var XY="FunctionToString",NC=new WeakMap,KY=(()=>({name:XY,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=Rr(this),r;try{NC.has(O())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){NC.set(e,!0)}})),Ol=KY;var qY=[/^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$/],QY="EventFilters",yd=(e={})=>{let t;return{name:QY,setup(n){let r=n.getOptions();t=RC(e,r)},processEvent(n,r,o){if(!t){let i=o.getOptions();t=RC(e,i)}return $Y(n,t)?null:n}}},Cl=((e={})=>({...yd(e),name:"InboundFilters"}));function RC(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:qY],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function $Y(e,t){if(e.type){if(e.type==="transaction"&&zY(e,t.ignoreTransactions))return E&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
14
- Event: ${Xo(e)}`),!0}else{if(JY(e,t.ignoreErrors))return E&&g.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
15
- Event: ${Xo(e)}`),!0;if(rj(e))return E&&g.warn(`Event dropped due to not having an error message, error type or stacktrace.
16
- Event: ${Xo(e)}`),!0;if(ej(e,t.denyUrls))return E&&g.warn(`Event dropped due to being matched by \`denyUrls\` option.
17
- Event: ${Xo(e)}.
18
- Url: ${bd(e)}`),!0;if(!tj(e,t.allowUrls))return E&&g.warn(`Event dropped due to not being matched by \`allowUrls\` option.
19
- Event: ${Xo(e)}.
20
- Url: ${bd(e)}`),!0}return!1}function JY(e,t){return t?.length?pd(e).some(n=>_n(n,t)):!1}function zY(e,t){if(!t?.length)return!1;let n=e.transaction;return n?_n(n,t):!1}function ej(e,t){if(!t?.length)return!1;let n=bd(e);return n?_n(n,t):!1}function tj(e,t){if(!t?.length)return!0;let n=bd(e);return n?_n(n,t):!0}function nj(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 bd(e){try{let n=[...e.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?nj(n):null}catch{return E&&g.error(`Cannot extract url for event ${Xo(e)}`),null}}function rj(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function CC(e,t,n,r,o,i){if(!o.exception?.values||!i||!ze(i.originalException))return;let s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=py(e,t,r,i.originalException,n,o.exception.values,s,0))}function py(e,t,n,r,o,i,s,c){if(i.length>=n+1)return i;let a=[...i];if(ze(r[o])){vC(s,c,r);let l=e(t,r[o]),p=a.length;OC(l,o,p,c),a=py(e,t,n,r[o],o,[l,...a],l,p)}return xC(r)&&r.errors.forEach((l,p)=>{if(ze(l)){vC(s,c,r);let u=e(t,l),d=a.length;OC(u,`errors[${p}]`,d,c),a=py(e,t,n,l,o,[u,...a],u,d)}}),a}function xC(e){return Array.isArray(e.errors)}function vC(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...xC(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function OC(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function PC(e,t){return e(t.stack||"",1)}function oj(e){return ze(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function ij(e){return oj(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function uy(e,t){let n={type:t.name||t.constructor.name,value:ij(t)},r=PC(e,t);return r.length&&(n.stacktrace={frames:r}),n}function sj(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(ze(n))return n}}function aj(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=gh(e);if(uh(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=cj(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${t}`}function cj(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function lj(e,t,n,r){if(ze(n))return[n,void 0];if(t.synthetic=!0,Kt(n)){let i=e?.getOptions().normalizeDepth,s={__serialized__:hh(n,i)},c=sj(n);if(c)return[c,s];let a=aj(n),l=r?.syntheticException||new Error(a);return l.message=a,[l,s]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function kC(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[s,c]=lj(e,i,n,r),a={exception:{values:[uy(t,s)]}};return c&&(a.extra=c),Th(a,void 0,void 0),Hn(a,i),{...a,event_id:r?.event_id}}function LC(e,t,n="info",r,o){let i={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let s=PC(e,r.syntheticException);s.length&&(i.exception={values:[{value:t,stacktrace:{frames:s}}]},Hn(i,{synthetic:!0}))}if(Zo(t)){let{__sentry_template_string__:s,__sentry_template_values__:c}=t;return i.logentry={message:s,params:c},i}return i.message=t,i}var pj="cause",uj=5,dj="LinkedErrors",mj=((e={})=>{let t=e.limit||uj,n=e.key||pj;return{name:dj,preprocessEvent(r,o,i){let s=i.getOptions();CC(uy,s.stackParser,n,t,r,o)}}}),xl=mj;var dy=["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 my(e){let t={};for(let i of Object.keys(e))t[i.toLowerCase()]=e[i];return dy.map(i=>{let s=t[i.toLowerCase()],c=Array.isArray(s)?s.join(";"):s;return i==="Forwarded"?fj(c):c?.split(",").map(a=>a.trim())}).reduce((i,s)=>s?i.concat(s):i,[]).find(i=>i!==null&&gj(i))||null}function fj(e){if(!e)return null;for(let t of e.split(";"))if(t.startsWith("for="))return t.slice(4);return null}function gj(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 _j="RequestData",hj=((e={})=>{function t(n){let r=n.getDataCollectionOptions(),o={...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:o,include:{cookies:o.cookies!==!1,data:!0,headers:o.httpHeaders.request!==!1,ip:o.userInfo,query_string:o.urlQueryParams!==!1,url:!0,...e.include}}}return{name:_j,processEvent(n,r,o){let{sdkProcessingMetadata:i={}}=n,{normalizedRequest:s,ipAddress:c}=i,{include:a,dataCollection:l}=t(o);return s&&bj(n,s,{ipAddress:c},a,l),n},processSegmentSpan(n,r){let{sdkProcessingMetadata:o={}}=$().getScopeData(),{normalizedRequest:i,ipAddress:s}=o;if(!i)return;let{include:c,dataCollection:a}=t(r);yj(n,i,s,c,a)}}}),Pl=hj;function bj(e,t,n,r,o){let i=MC(t,r);if(i.query_string&&(i.query_string=wC(i.query_string,o.urlQueryParams)),i.url&&(i.url=Nl(i.url,o.urlQueryParams)),e.request={...e.request,...i},r.ip){let s=t.headers&&my(t.headers)||n.ipAddress;s&&(e.user={...e.user,ip_address:s})}}function yj(e,t,n,r,o){let i=MC(t,r),s={};if(i.url&&(s[pt]=Nl(i.url,o.urlQueryParams)),i.method&&(s["http.request.method"]=i.method),i.query_string&&(s[cd]=wC(i.query_string,o.urlQueryParams)),Bt(e,s),i.cookies&&Object.keys(i.cookies).length>0){let c=Object.entries(i.cookies).map(([l,p])=>`${l}=${p}`).join("; "),a=Vr({cookie:c},o,"request");Bt(e,a)}if(i.headers){let c=Vr(i.headers,o,"request");Bt(e,c)}if(i.data!=null){let c=typeof i.data=="string"?i.data:JSON.stringify(i.data);c&&Bt(e,{"http.request.body.data":c})}if(r.ip){let c=t.headers&&my(t.headers)||n||void 0;c&&Bt(e,{[$c]:c})}}function MC(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let o=new Set(dy.map(i=>i.toLowerCase()));for(let i of Object.keys(r))o.has(i.toLowerCase())&&delete r[i]}if(n.method=e.method,t.url&&(n.url=e.url),t.cookies){let o=e.cookies||(r?.cookie?_C(r.cookie):void 0);n.cookies=o||{}}return t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function wC(e,t){let n=Sj(e);return n?Ra(n,t):void 0}function Sj(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 Sd=new Set([]);function va(e){let t="console",n=ph(t,e);return Qc(t,Ej),n}function UC(e){for(let t of e)Sd.add(t);return()=>{for(let t of e)Sd.delete(t)}}var GC=new Set;function Ej(){"console"in te&&nr.forEach(function(e){GC.has(e)||!(e in te.console)||(GC.add(e),Mt(te.console,e,function(t){return tr[e]=t,function(...n){let r=n[0],o=tr[e],i=Sd.size&&typeof r=="string"&&_n(r,Sd);i||Vs("console",{args:n,level:e}),(!i||E&&g.isEnabled())&&o?.apply(te.console,n)}}))})}function ii(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var Tj="CaptureConsole",Ij=((e={})=>{let t=e.levels||nr,n=e.handled??!0;return{name:Tj,setup(r){"console"in te&&va(({args:o,level:i})=>{O()!==r||!t.includes(i)||Aj(o,i,n)})}}}),fy=Ij;function Aj(e,t,n){let r=ii(t),o=new Error,i={level:ii(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: ${Xs(e.slice(1)," ")||"console.assert"}`;s.setExtra("arguments",e.slice(1)),s.captureMessage(l,r,{captureContext:i,syntheticException:o})}return}let c=e.find(l=>l instanceof Error);if(c){ge(c,i);return}let a=Xs(e," ");s.captureMessage(a,r,{captureContext:i,syntheticException:o})})}var Nj="Dedupe",Rj=(()=>{let e;return{name:Nj,processEvent(t){if(t.type)return t;try{if(vj(t,e))return E&&g.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),gy=Rj;function vj(e,t){return t?!!(Oj(e,t)||Cj(e,t)):!1}function Oj(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!HC(e,t)||!BC(e,t))}function Cj(e,t){let n=DC(t),r=DC(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!HC(e,t)||!BC(e,t))}function BC(e,t){let n=ku(e),r=ku(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let o=0;o<r.length;o++){let i=r[o],s=n[o];if(i.filename!==s.filename||i.lineno!==s.lineno||i.colno!==s.colno||i.function!==s.function)return!1}return!0}function HC(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 DC(e){return e.exception?.values?.[0]}var xj="ExtraErrorData",Pj=((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:xj,processEvent(r,o,i){let{maxValueLength:s}=i.getOptions();return kj(r,o,t,n,s)}}}),_y=Pj;function kj(e,t={},n,r,o){if(!t.originalException||!ze(t.originalException))return e;let i=t.originalException.name||t.originalException.constructor.name,s=FC(t.originalException,r,o);if(s){let c={...e.contexts},a=qe(s,n);return Kt(a)&&(bv(a),c[i]=a),{...e,contexts:c}}return e}function FC(e,t,n){try{let r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],o={};for(let i of Object.keys(e)){if(r.indexOf(i)!==-1)continue;let s=e[i];o[i]=ze(s)||typeof s=="string"?n?gn(`${s}`,n):`${s}`:s}if(t&&e.cause!==void 0)if(ze(e.cause)){let i=e.cause.name||e.cause.constructor.name;o.cause={[i]:FC(e.cause,!1,n)}}else o.cause=e.cause;if(typeof e.toJSON=="function"){let i=e.toJSON();for(let s of Object.keys(i)){let c=i[s];o[s]=ze(c)?c.toString():c}}return o}catch(r){E&&g.error("Unable to extract extra data from the Error object:",r)}return null}function Lj(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let o=e[r];o==="."?e.splice(r,1):o===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var Mj=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function VC(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Mj.exec(t);return n?n.slice(1):[]}function hy(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let o=r>=0?e[r]:"/";o&&(t=`${o}/${t}`,n=o.charAt(0)==="/")}return t=Lj(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function WC(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 by(e,t){e=hy(e).slice(1),t=hy(t).slice(1);let n=WC(e.split("/")),r=WC(t.split("/")),o=Math.min(n.length,r.length),i=o;for(let c=0;c<o;c++)if(n[c]!==r[c]){i=c;break}let s=[];for(let c=i;c<n.length;c++)s.push("..");return s=s.concat(r.slice(i)),s.join("/")}function yy(e){let t=VC(e),n=t[0]||"",r=t[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}function Sy(e,t){let n=VC(e)[2]||"";return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var wj="RewriteFrames",Ey=(e={})=>{let t=e.root,n=e.prefix||"app:///",r="window"in te&&!!te.window,o=e.iteratee||Gj({isBrowser:r,root:t,prefix:n});function i(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=>o(a))}}return{name:wj,processEvent(c){let a=c;return c.exception&&Array.isArray(c.exception.values)&&(a=i(a)),a}}};function Gj({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;let o=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),i=/^\//.test(r.filename);if(e){if(t){let s=r.filename;s.indexOf(t)===0&&(r.filename=s.replace(t,n))}}else if(o||i){let s=o?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,c=t?by(t,s):Sy(s);r.filename=`${n}${c}`}return r}}var Uj=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],Dj=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],Bj={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"},jC=["select","insert","upsert","update","delete"];function Ed(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function Td(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function ZC(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function Hj(e,t){return ZC(e,t)!==void 0}function XC(e,t){if(!e)return;if(typeof e.get=="function")return e.get(t)??void 0;let n=e,r=t.toLowerCase(),o=Object.keys(n).find(i=>i.toLowerCase()===r);return o!==void 0?n[o]:void 0}function Fj(e,t={}){switch(e){case"GET":return"select";case"POST":return XC(t,"Prefer")?.includes("resolution=")?"upsert":"insert";case"PATCH":return"update";case"DELETE":return"delete";default:return"<unknown-op>"}}function Wj(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("."),o;return n?.startsWith("fts")?o="textSearch":n?.startsWith("plfts")?o="textSearch[plain]":n?.startsWith("phfts")?o="textSearch[phrase]":n?.startsWith("wfts")?o="textSearch[websearch]":o=n&&Bj[n]||"filter",`${o}(${e}, ${r.join(".")})`}function YC(e,t=!1){return new Proxy(e,{apply(n,r,o){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}`}},i=>Reflect.apply(n,r,o).then(s=>(B(s)&&"error"in s&&s.error?(i.setStatus({code:2}),ge(s.error,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}})):i.setStatus({code:1}),i.end(),s)).catch(s=>{throw i.setStatus({code:2}),i.end(),ge(s,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}}),s}).then(...o))}})}function Vj(e){let t=e.auth;if(!(!t||Td(e.auth))){for(let n of Uj){let r=t[n];r&&typeof e.auth[n]=="function"&&(e.auth[n]=YC(r))}for(let n of Dj){let r=t.admin[n];r&&typeof e.auth.admin[n]=="function"&&(e.auth.admin[n]=YC(r,!0))}Ed(e.auth)}}function Yj(e,t){Td(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(n,r,o){let i=Reflect.apply(n,r,o),s=i.constructor;return Zj(s,t),i}}),Ed(e.prototype.from))}function jj(e,t){Td(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(n,r,o){let i=jC,s=r,c=Fj(s.method,s.headers);if(!i.includes(c)||!s?.url?.pathname||typeof s.url.pathname!="string")return Reflect.apply(n,r,o);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(Wj(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,_=ZC(s.body,u),h=c==="select"?"":`${c}${Hj(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":XC(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&&zs(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&&(zs(R,500),R.end()),P}).then(...o))}}),Ed(e.prototype.then))}function Zj(e,t){for(let n of jC)Td(e.prototype[n])||(e.prototype[n]=new Proxy(e.prototype[n],{apply(r,o,i){let s=Reflect.apply(r,o,i),c=s.constructor;return E&&g.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),jj(c,t),s}}),Ed(e.prototype[n]))}var Id=(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;Yj(n,t),Vj(e)},Xj="Supabase",Kj=((e,t)=>({setupOnce(){Id(e,t)},name:Xj})),Ty=e=>Kj(e.supabaseClient,{sendOperationData:e.sendOperationData});var qj=10,Qj="ZodErrors";function $j(e){return ze(e)&&e.name==="ZodError"&&Array.isArray(e.issues)}function Jj(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 zj(e){return e.map(t=>typeof t=="number"?"<array>":t).join(".")}function e5(e){let t=new Set;for(let r of e.issues){let o=zj(r.path);o.length>0&&t.add(o)}let n=Array.from(t);if(n.length===0){let r="variable";if(e.issues.length>0){let o=e.issues[0];o!==void 0&&"expected"in o&&typeof o.expected=="string"&&(r=o.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${gn(n.join(", "),100)}`}function t5(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!$j(r.originalException)||r.originalException.issues.length===0)return n;try{let i=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(Jj);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:i})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:e5(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":i.slice(0,e)}}}catch(o){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:o instanceof Error?`${o.name}: ${o.message}
21
- ${o.stack}`:"unknown"}}}}}var n5=((e={})=>{let t=e.limit??qj;return{name:Qj,processEvent(n,r){return t5(t,e.saveZodIssuesAsAttachment,n,r)}}}),Iy=n5;var r5="Console",Ay=(e={})=>{let t=new Set(e.levels||nr);return{name:r5,setup(n){let r=va(({args:o,level:i})=>{O()!==n||!t.has(i)||o5(i,o)});if(n.registerCleanup(r),e.filter){let o=UC(e.filter);n.registerCleanup(o)}}}};function o5(e,t){let n={category:"console",data:{arguments:t,logger:"console"},level:ii(e),message:KC(t)};if(e==="assert")if(t[0]===!1){let r=t.slice(1);n.message=r.length>0?`Assertion failed: ${KC(r)}`:"Assertion failed",n.data.arguments=r}else return;an(n,{input:t,level:e})}function KC(e){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):Xs(e," ")}var i5=100,s5=10,Ad="flag.evaluation.";function Nd(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 Rd(e,t,n=i5){let r=ne().getScopeData().contexts;r.flags||(r.flags={values:[]});let o=r.flags.values;a5(o,e,t,n)}function a5(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 o=e.findIndex(i=>i.flag===t);o!==-1&&e.splice(o,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function vd(e,t,n=s5){if(typeof t!="boolean")return;let r=Q();if(!r)return;let o=ie(r).data;if(`${Ad}${e}`in o){r.setAttribute(`${Ad}${e}`,t);return}Object.keys(o).filter(s=>s.startsWith(Ad)).length<n&&r.setAttribute(`${Ad}${e}`,t)}var Ny=()=>({name:"FeatureFlags",processEvent(e,t,n){return Nd(e)},addFeatureFlag(e,t){Rd(e,t),vd(e,t)}});var Ry=({growthbookClass:e})=>({name:"GrowthBook",setupOnce(){let t=e.prototype;typeof t.isOn=="function"&&Mt(t,"isOn",qC),typeof t.getFeatureValue=="function"&&Mt(t,"getFeatureValue",qC)},processEvent(t,n,r){return Nd(t)}});function qC(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"&&(Rd(n,r),vd(n,r)),r}}var c5="ConversationId",l5=(()=>({name:c5,setup(e){e.on("spanStart",t=>{let n=ne().getScopeData(),r=$().getScopeData(),o=n.conversationId||r.conversationId;if(o){let{op:i,data:s,description:c}=ie(t);if(!i?.startsWith("gen_ai.")&&!s["ai.operationId"]&&!c?.startsWith("ai."))return;t.setAttribute(Xi,o)}})}})),vy=l5;function QC(e){return!!e&&typeof e._profiler<"u"&&typeof e._profiler.start=="function"&&typeof e._profiler.stop=="function"}function p5(){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(!QC(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.start()}function u5(){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(!QC(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.stop()}var Oy={startProfiler:p5,stopProfiler:u5};function Cy(e,t={},n=ne()){let{message:r,name:o,email:i,url:s,source:c,associatedEventId:a,tags:l}=e,p={contexts:{feedback:{contact_email:i,name:o,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 Oa(e,t,n){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):d5(e,t,n)}function d5(e,t,n){return e.map(r=>rr(r)?String(r):JSON.stringify(qe(r,t,n))).join(" ")}function Od(e){return/%[sdifocO]/.test(e)}function Cd(e,t){let n={},r=new Array(t.length).fill("{}").join(" ");return n["sentry.message.template"]=`${e} ${r}`,t.forEach((o,i)=>{n[`sentry.message.parameter.${i}`]=o}),n}var m5="ConsoleLogs",$C={[S]:"auto.log.console"},f5=((e={})=>{let t=e.levels||nr;return{name:m5,setup(n){let{enableLogs:r,normalizeDepth:o=3,normalizeMaxBreadth:i=1e3}=n.getOptions();if(!r){E&&g.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let s=va(({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: ${Oa(p,o,i)}`:"Assertion failed";dr({level:"error",message:m,attributes:$C})}return}let u=a==="log",d={...$C};if(Kt(l)){Object.assign(d,qe(l,o,i));let m=typeof c[1]=="string"?2:1;c.slice(m).forEach((h,b)=>{d[`sentry.message.parameter.${b}`]=qe(h,o,i)})}else if(p.length>0&&typeof l=="string"&&!Od(l)){let _=Cd(l,p);for(let[h,b]of Object.entries(_))d[h]=h.startsWith("sentry.message.parameter.")?qe(b,o,i):b}dr({level:u?"info":a,message:Oa(c,o,i),severityNumber:u?10:void 0,attributes:d})});n.registerCleanup(s)}}}),xy=f5;var mt={};$R(mt,{count:()=>g5,distribution:()=>h5,gauge:()=>_5});function Py(e,t,n,r){qb({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function g5(e,t=1,n){Py("counter",e,t,n)}function _5(e,t,n){Py("gauge",e,t,n)}function h5(e,t,n){Py("distribution",e,t,n)}var b5=["trace","debug","info","warn","error","fatal"];function ky(e={}){let t=new Set(e.levels??b5),n=e.client;return{log(r){let{type:o,level:i,message:s,args:c,tag:a,date:l,...p}=r,u=n||O();if(!u)return;let d=E5(o,i);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),o&&(h["consola.type"]=o),i!=null&&typeof i=="number"&&(h["consola.level"]=i);let b=I5(T5(c,m,_),m,_);b?.attributes&&Object.assign(h,b.attributes),dr({level:d,message:b?.message||s||c&&Oa(c,m,_)||"",attributes:h})}}}var y5={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"},S5={0:"fatal",1:"warn",2:"info",3:"info",4:"debug",5:"trace"};function E5(e,t){if(e==="verbose")return"debug";if(e==="silent")return"trace";if(e){let n=y5[e];if(n)return n}if(typeof t=="number"){let n=S5[t];if(n)return n}return"info"}function T5(e,t,n){if(!e?.length)return{message:""};let r=Oa(e,t,n),o=e[0];if(Kt(o)){let i=typeof e[1]=="string"?2:1,s=e.slice(i);return{message:r,attributes:o,messageParameters:s}}else{let i=e.slice(1),s=i.length>0&&typeof o=="string"&&!Od(o);return{message:r,messageTemplate:s?o:void 0,messageParameters:s?i:void 0}}}function I5(e,t,n){let{message:r,attributes:o,messageTemplate:i,messageParameters:s}=e,c={};if(i&&s){let a=Cd(i,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(o,t,n),...c}}}var JC="gen_ai.prompt",Yr="gen_ai.system",Be="gen_ai.request.model",Ca="gen_ai.request.stream",si="gen_ai.request.temperature",xa="gen_ai.request.max_tokens",ai="gen_ai.request.frequency_penalty",Pa="gen_ai.request.presence_penalty",ci="gen_ai.request.top_p",xd="gen_ai.request.top_k",Pd="gen_ai.request.encoding_format",kd="gen_ai.request.dimensions",jr="gen_ai.response.finish_reasons",cn="gen_ai.response.model",li="gen_ai.response.id",zC="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",ex="gen_ai.output.messages",tn="gen_ai.system_instructions",nn="gen_ai.response.text",Zn="gen_ai.request.available_tools",tx="gen_ai.response.streaming",Sn="gen_ai.response.tool_calls",pi="gen_ai.agent.name",nx="gen_ai.pipeline.name",ui="gen_ai.conversation.id",Ly="gen_ai.usage.input_tokens.cache_write",di="gen_ai.usage.input_tokens.cached",rx="gen_ai.invoke_agent",mi="gen_ai.embeddings.input",My="gen_ai.embeddings",wy="gen_ai.execute_tool",Zr="gen_ai.tool.name",kl="gen_ai.tool.call.id",Ll="gen_ai.tool.type",ka="gen_ai.tool.input",La="gen_ai.tool.output",Ma="gen_ai.tool.description";function fi(e){return!e||typeof e!="object"?!1:N5(e)||ix(e)||A5(e)||sx(e)||ax(e)||R5(e)||v5(e)||O5(e)||C5(e)||x5(e)||P5(e)||k5(e)}function A5(e){return"image_url"in e?typeof e.image_url=="string"?e.image_url.startsWith("data:"):ox(e):!1}function ox(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 N5(e){return"type"in e&&typeof e.type=="string"&&"source"in e&&fi(e.source)}function ix(e){return"inlineData"in e&&!!e.inlineData&&typeof e.inlineData=="object"&&"data"in e.inlineData&&typeof e.inlineData.data=="string"}function sx(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 ax(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 R5(e){return"media_type"in e&&typeof e.media_type=="string"&&"data"in e}function v5(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 O5(e){return"type"in e&&e.type==="image"&&"image"in e&&typeof e.image=="string"&&!e.image.startsWith("http://")&&!e.image.startsWith("https://")}function C5(e){return"type"in e&&(e.type==="blob"||e.type==="base64")}function x5(e){return"b64_json"in e}function P5(e){return"type"in e&&"result"in e&&e.type==="image_generation"}function k5(e){return"uri"in e&&typeof e.uri=="string"&&e.uri.startsWith("data:")}var Ml="[Blob substitute]",L5=["image_url","data","content","b64_json","result","uri","image"];function as(e){let t={...e};fi(t.source)&&(t.source=as(t.source)),ix(e)&&(t.inlineData={...e.inlineData,data:Ml}),ox(e)&&(t.image_url={...e.image_url,url:Ml}),sx(e)&&(t.input_audio={...e.input_audio,data:Ml}),ax(e)&&(t.file={...e.file,file_data:Ml});for(let n of L5)typeof t[n]=="string"&&(t[n]=Ml);return t}var lx=2e4,Ld=e=>new TextEncoder().encode(e).length,Uy=e=>Ld(JSON.stringify(e));function Md(e,t){if(Ld(e)<=t)return e;let n=0,r=e.length,o="";for(;n<=r;){let i=Math.floor((n+r)/2),s=e.slice(0,i);Ld(s)<=t?(o=s,n=i+1):r=i-1}return o}function M5(e){return typeof e=="string"?e:"text"in e&&typeof e.text=="string"?e.text:""}function cx(e,t){return typeof e=="string"?t:{...e,text:t}}function w5(e){return e!==null&&typeof e=="object"&&"content"in e&&typeof e.content=="string"}function px(e){return e!==null&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)}function ux(e){return e!==null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)&&e.parts.length>0}function G5(e,t){let n={...e,content:""},r=Uy(n),o=t-r;if(o<=0)return[];let i=Md(e.content,o);return[{...e,content:i}]}function U5(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 D5(e,t){let{key:n,items:r}=U5(e);if(n===null||r.length===0)return[];let o=r.map(a=>cx(a,"")),i=Uy({...e,[n]:o}),s=t-i;if(s<=0)return[];let c=[];for(let a of r){let l=M5(a),p=Ld(l);if(p<=s)c.push(a),s-=p;else if(c.length===0){let u=Md(l,s);u&&c.push(cx(a,u));break}else break}return c.length<=0?[]:[{...e,[n]:c}]}function B5(e,t){if(!e)return[];if(typeof e=="string"){let n=Md(e,t);return n?[n]:[]}return typeof e!="object"?[]:w5(e)?G5(e,t):px(e)||ux(e)?D5(e,t):[]}function Gy(e){return e.map(n=>{let r;return n&&typeof n=="object"&&(px(n)?r={...n,content:Gy(n.content)}:"content"in n&&fi(n.content)&&(r={...n,content:as(n.content)}),ux(n)&&(r={...r??n,parts:Gy(n.parts)}),fi(r)?r=as(r):fi(n)&&(r=as(n))),r??n})}function H5(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],o=Gy([r]),i=o[0];return Uy(i)<=n?o:B5(i,n)}function dx(e){return H5(e,lx)}function mx(e){return Md(e,lx)}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?!it(t)&&t.getOptions().streamGenAiSpans===!1:!0}function wd(e,t){return e?`${e}.${t}`:t}function Xr(e,t,n,r,o){let i={};return typeof e=="number"&&(i[At]=e),typeof n=="number"&&(i[Ur]=n),typeof r=="number"&&(i[Dr]=r),typeof t=="number"&&(i[Ft]=t),typeof o=="number"?i[jn]=o:(typeof e=="number"||typeof t=="number")&&(i[jn]=(typeof e=="number"?e:0)+(typeof t=="number"?t:0)),i}function cs(e,t,n){if(!e.isRecording())return;let r={[tx]:!0};t.responseId&&(r[li]=t.responseId),t.responseModel&&(r[cn]=t.responseModel),Object.assign(r,Xr(t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens,t.totalTokens)),typeof t.reasoningOutputTokens=="number"&&(r[nd]=t.reasoningOutputTokens),t.finishReasons.length&&(r[jr]=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 mx(e);try{return JSON.stringify(Array.isArray(e)?dx(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 o=JSON.stringify([{type:"text",content:r}]),i=[...e.slice(0,t),...e.slice(t+1)];return{systemInstructions:o,filteredMessages:i}}async function F5(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r=="object"&&"data"in r?{...r,data:n}:n}function wa(e,t){return bt(e)?new Proxy(e,{get(n,r){let i=r in Promise.prototype||r===Symbol.toStringTag?t:n,s=Reflect.get(i,r);return r==="withResponse"&&typeof s=="function"?function(){let a=s.call(n);return F5(a,t)}:typeof s=="function"?s.bind(i):s}}):t}var fx="WorkersAI";var wl=new Map,Gd=new Map,Ud=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 Dd="operation.name",Bd="ai.operationId",Hd="ai.prompt",gx="ai.schema",_x="ai.response.object",Dy="ai.values",By="ai.response.text",Hy="ai.response.toolCalls",hx="ai.response.finishReason",ls="ai.prompt.messages",ko="ai.prompt.tools",Gl="ai.model.id",bx="ai.response.providerMetadata",yx="ai.usage.cachedInputTokens",Sx="ai.usage.inputTokenDetails.",Ex="ai.telemetry.functionId",Tx="ai.usage.completionTokens",Ix="ai.usage.promptTokens",Ax="ai.usage.tokens",Fy="ai.toolCall.name",Wy="ai.toolCall.id",Nx="ai.toolCall.args",Rx="ai.toolCall.result";function Ox(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[At],o=e.data[Ft];if(typeof r=="number"||typeof o=="number"){let i=t.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(i.inputTokens+=r),typeof o=="number"&&(i.outputTokens+=o),t.set(n,i)}}function Vy(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 W5(e){let t=new Map;for(let n of e){let r=n.data[Zn];if(typeof r=="string")try{let o=JSON.parse(r);for(let i of o)i.name&&i.description&&!t.has(i.name)&&t.set(i.name,i.description)}catch{}}return t}function Cx(e,t){let n=W5(e);for(let r of e){if(r.op==="gen_ai.execute_tool"){let o=r.data[Zr];if(typeof o=="string"){let i=n.get(o);i&&(r.data[Ma]=i)}}r.op==="gen_ai.invoke_agent"&&Vy(r,t)}}function Yy(e){return wl.get(e)}function jy(e){wl.delete(e)}function xx(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 vx(e){return e.filter(t=>!!t&&typeof t=="object"&&"role"in t&&"content"in t)}function V5(e){try{let t=JSON.parse(e);if(t&&typeof t=="object"){let{messages:n}=t,{prompt:r,system:o}=t,i=[];if(typeof o=="string"&&i.push({role:"system",content:o}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return i.push(...vx(n)),i;if(Array.isArray(r))return i.push(...vx(r)),i;if(typeof r=="string"&&i.push({role:"user",content:r}),i.length>0)return i}}catch{}return[]}function Px(e,t,n){if(typeof t[Hd]=="string"&&!t[Wt]&&!t[ls]){let r=t[Hd],o=V5(r);if(o.length){let{systemInstructions:i,filteredMessages:s}=Mn(o);i&&e.setAttribute(tn,i);let c=Array.isArray(s)?s.length:0,a=n?Vt(s):Ue(s);e.setAttributes({[Hd]:a,[Wt]:a,[xt]:c})}}else if(typeof t[ls]=="string"){let r=t[ls];try{let o=JSON.parse(r);if(Array.isArray(o)){let{systemInstructions:i,filteredMessages:s}=Mn(o);i&&e.setAttribute(tn,i);let c=Array.isArray(s)?s.length:0,a=!n&&s===o?r:n?Vt(s):Ue(s);e.setAttributes({[ls]:a,[Wt]:a,[xt]:c})}}catch{}}}function Y5(e){let{data:t,description:n}=ie(e);if(!n)return;if(t[Fy]&&t[Wy]&&n==="ai.toolCall"){Q5(e,t);return}if(!t[Bd]&&!n.startsWith("ai."))return;Ud.get(n)==="generate_content"&&Po([fx]);let o=O()?.getIntegrationByName("VercelAI"),i=nt(o?.options?.enableTruncation);$5(e,n,t,i)}function j5(e){if(e.type==="transaction"&&e.spans){let t=new Map;for(let r of e.spans)K5(r),Ox(r,t);Cx(e.spans,t);let n=e.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&Vy(n,t)}return e}function Z5(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 X5(e){let t=e[By],n=e[Hy],r=e[hx];if(t==null&&n==null)return;let o=[];if(typeof t=="string"&&t.length>0&&o.push({type:"text",content:t}),n!=null)try{let i=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(i)){for(let s of i){let c=s.input??s.args;o.push({type:"tool_call",id:s.toolCallId,name:s.toolName,arguments:typeof c=="string"?c:JSON.stringify(c??{})})}delete e[Hy]}}catch{}if(o.length>0){let i={role:"assistant",parts:o,finish_reason:Z5(r)};e[ex]=JSON.stringify([i]),delete e[By]}}function Lx(e){if(Yt(e,Tx,Ft),Yt(e,Ix,At),Yt(e,yx,di),Yt(e,"ai.usage.inputTokens",At),Yt(e,"ai.usage.outputTokens",Ft),Yt(e,Ax,At),Yt(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),!Object.keys(e).some(n=>n.startsWith(Sx))&&typeof e[At]=="number"&&typeof e[di]=="number"&&(e[At]=e[At]+e[di]),typeof e[At]=="number"){let n=typeof e[Ft]=="number"?e[Ft]:0;e[jn]=n+e[At]}if(e[ko]&&Array.isArray(e[ko])&&(e[ko]=xx(e[ko])),e[Dd]){let n=e[Bd]?e[Bd]:e[Dd],r=Ud.get(n)??n;e[st]=r,delete e[Dd]}if(Yt(e,ls,Wt),X5(e),Yt(e,_x,"gen_ai.response.object"),Yt(e,ko,"gen_ai.request.available_tools"),Yt(e,Nx,ka),Yt(e,Rx,La),Yt(e,gx,"gen_ai.request.schema"),Yt(e,Gl,Be),Array.isArray(e[Dy])){let n=e[Dy].map(r=>{try{return JSON.parse(r)}catch{return r}});e[mi]=n.length===1?n[0]:JSON.stringify(n)}J5(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 K5(e){let{data:t,origin:n}=e;n==="auto.vercelai.otel"&&(e.status&&e.status!=="ok"&&(e.status="internal_error"),Lx(t))}function q5(e){let t=e.attributes;if(t?.[S]==="auto.vercelai.otel"){if(Lx(t),t[H]==="gen_ai.execute_tool"&&e.parent_span_id){let n=Gd.get(e.parent_span_id);if(n){let r=t[Zr];if(typeof r=="string"){let o=n.get(r);o&&(t[Ma]=o)}}}Gd.delete(e.span_id)}}function Yt(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function Q5(e,t){e.setAttribute(S,"auto.vercelai.otel"),e.setAttribute(H,"gen_ai.execute_tool"),e.setAttribute(st,"execute_tool"),Yt(t,Fy,Zr),Yt(t,Wy,kl);let n=t[kl];typeof n=="string"&&wl.set(n,e.spanContext()),t[Ll]||e.setAttribute(Ll,"function");let r=t[Zr];r&&e.updateName(`execute_tool ${r}`)}function $5(e,t,n,r){e.setAttribute(S,"auto.vercelai.otel");let o=t.replace("ai.","");e.setAttribute("ai.pipeline.name",o),e.updateName(o);let i=n[Ex];i&&typeof i=="string"&&e.setAttribute("gen_ai.function_id",i),Px(e,n,r),n[Gl]&&!n[cn]&&e.setAttribute(cn,n[Gl]),e.setAttribute("ai.streaming",t.includes("stream"));let s=Ud.get(t);if(s?e.setAttribute(H,`gen_ai.${s}`):t.startsWith("ai.stream")&&e.setAttribute(H,"ai.run"),s==="invoke_agent"){i&&typeof i=="string"?e.updateName(`invoke_agent ${i}`):e.updateName("invoke_agent");return}let c=n[Gl];c&&s&&e.updateName(`${s} ${c}`);let a=O();if(a&&it(a)&&n[ko]&&Array.isArray(n[ko])){let l=new Map;for(let p of n[ko])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=ie(e).parent_span_id;p&&Gd.set(p,l)}}}var kx=new WeakSet;function Fd(e){kx.has(e)||(kx.add(e),e.on("spanStart",Y5),e.addEventProcessor(Object.assign(j5,{id:"VercelAiEventProcessor"})),e.on("processSpan",t=>{q5(t)}))}function Wd(e){let t={};if(!e||typeof e!="object")return t;let n=e,r=n.openai??n.azure;if(r&&(wn(t,di,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,ui,r.responseId)),n.anthropic){let i=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;wn(t,di,i);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;wn(t,Ly,s)}n.bedrock?.usage&&(wn(t,di,n.bedrock.usage.cacheReadInputTokens),wn(t,Ly,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(wn(t,di,n.deepseek.promptCacheHitTokens),wn(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens));let o=(n.google??n.vertex)?.usageMetadata;return o&&typeof o.thoughtsTokenCount=="number"&&o.thoughtsTokenCount>0&&(t[Ft]=(o.candidatesTokenCount??0)+o.thoughtsTokenCount,wn(t,jn,o.totalTokenCount),wn(t,"gen_ai.usage.reasoning.output_tokens",o.thoughtsTokenCount)),t}var Vd=new Set([Ft,jn,"gen_ai.usage.reasoning.output_tokens"]);function J5(e){let t=e[bx];if(!t)return;let n=e[st]==="invoke_agent";try{let r=Wd(JSON.parse(t));for(let[o,i]of Object.entries(r))o===ui&&e[o]||n&&Vd.has(o)||(e[o]=i)}catch{}}function wn(e,t,n){n!=null&&(e[t]=n)}var Kr="OpenAI",Mx={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},z5=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],wx=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...z5];function Gx(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&e.type.startsWith("response.")}function Ux(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion.chunk"}function Ul(e,t,n){if(!t||typeof t!="object")return;let r=t,o={};if(typeof r.id=="string"&&(o[li]=r.id),typeof r.model=="string"&&(o[cn]=r.model),r.object==="conversation"&&typeof r.id=="string"&&(o[ui]=r.id),r.usage&&typeof r.usage=="object"){let i=r.usage,s=i.prompt_tokens??i.input_tokens;typeof s=="number"&&(o[At]=s);let c=i.completion_tokens??i.output_tokens;typeof c=="number"&&(o[Ft]=c),typeof i.total_tokens=="number"&&(o[jn]=i.total_tokens);let a=i.prompt_tokens_details??i.input_tokens_details;B(a)&&(typeof a.cached_tokens=="number"&&(o[Dr]=a.cached_tokens),typeof a.cache_write_tokens=="number"&&(o[Ur]=a.cache_write_tokens))}if(Array.isArray(r.choices)){let i=r.choices,s=i.map(c=>c.finish_reason).filter(c=>typeof c=="string");if(s.length>0&&(o[jr]=JSON.stringify(s)),n){let c=i.map(l=>l.message?.content||"");o[nn]=JSON.stringify(c);let a=i.map(l=>l.message?.tool_calls).filter(l=>Array.isArray(l)&&l.length>0).flat();a.length>0&&(o[Sn]=JSON.stringify(a))}}if(typeof r.status=="string"&&(o[jr]||(o[jr]=JSON.stringify([r.status]))),n&&(typeof r.output_text=="string"&&!o[nn]&&(o[nn]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!o[Sn])){let i=r.output.filter(s=>s?.type==="function_call");i.length>0&&(o[Sn]=JSON.stringify(i))}e.setAttributes(o)}function e3(e){return"conversation"in e&&typeof e.conversation=="string"?e.conversation:void 0}function Zy(e){let t={[Be]:e.model??"unknown"};"temperature"in e&&(t[si]=e.temperature),"top_p"in e&&(t[ci]=e.top_p),"frequency_penalty"in e&&(t[ai]=e.frequency_penalty),"presence_penalty"in e&&(t[Pa]=e.presence_penalty),"stream"in e&&(t[Ca]=e.stream),"encoding_format"in e&&(t[Pd]=e.encoding_format),"dimensions"in e&&(t[kd]=e.dimensions);let n=e3(e);return n&&(t[ui]=n),t}function t3(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 o=t.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function n3(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&&t3(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function r3(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 o=e;if(!wx.includes(o.type)){t.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&t.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){t.responseTexts.push(o.delta);return}if("response"in o){let{response:i}=o;t.responseId=i.id??t.responseId,t.responseModel=i.model??t.responseModel,i.usage&&(t.promptTokens=i.usage.input_tokens,t.completionTokens=i.usage.output_tokens,t.totalTokens=i.usage.total_tokens,t.cacheReadInputTokens=i.usage.input_tokens_details?.cached_tokens??t.cacheReadInputTokens,t.cacheCreationInputTokens=i.usage.input_tokens_details?.cache_write_tokens??t.cacheCreationInputTokens),i.status&&t.finishReasons.push(i.status),n&&i.output_text&&t.responseTexts.push(i.output_text)}}async function*Dl(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 o of e)Ux(o)?n3(o,r,n):Gx(o)&&r3(o,r,n,t),yield o}finally{let o=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];cs(t,{...r,toolCalls:o},n)}}function o3(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}]:[],o=[...t,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(i){E&&g.error("Failed to serialize OpenAI tools:",i);return}}function Yd(e,t){let n={[Yr]:"openai",[st]:t,[S]:"auto.ai.openai"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let r=e[0],o=o3(r);o&&(n[Zn]=o),Object.assign(n,Zy(r))}else n[Be]="unknown";return n}function Bl(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(mi,typeof c=="string"?c:JSON.stringify(c));return}let o="input"in t?t.input:"messages"in t?t.messages:void 0;if(!o||Array.isArray(o)&&o.length===0)return;let{systemInstructions:i,filteredMessages:s}=Mn(o);i&&e.setAttribute(tn,i),e.setAttribute(Wt,r?Vt(s):Ue(s)),Array.isArray(s)?e.setAttribute(xt,s.length):e.setAttribute(xt,1)}function i3(e,t,n,r,o){return function(...s){let c=n.operation||"unknown",a=Yd(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),o.recordInputs&&p&&Bl(v,p,c,nt(o.enableTruncation)),(async()=>{try{let M=await h;return Dl(M,v,o.recordOutputs??!1)}catch(M){throw v.setStatus({code:2,message:"internal_error"}),v.end(),M}})()));return wa(h,b)}let m,_=Se(d,h=>(m=e.apply(r,s),o.recordInputs&&p&&Bl(h,p,c,nt(o.enableTruncation)),m.then(b=>(Ul(h,b,o.recordOutputs),b))));return wa(m,_)}}function Dx(e,t="",n){return new Proxy(e,{get(r,o){let i=r[o],s=wd(t,String(o)),c=Mx[s];return typeof i=="function"&&c?i3(i,s,c,r,n):typeof i=="function"?i.bind(r):i&&typeof i=="object"?Dx(i,s,n):i}})}function jd(e,t){return Dx(e,"",Xe(t))}var qr="Anthropic_AI",Xy={"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 Bx(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:o}=Mn(t);r&&e.setAttributes({[tn]:r});let i=Array.isArray(o)?o.length:1;e.setAttributes({[Wt]:n?Vt(o):Ue(o),[xt]:i})}var s3={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 Ky(e){return e&&s3[e]||"internal_error"}function Hx(e,t){t.error&&(e.setStatus({code:2,message:Ky(t.error.type)}),ge(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function Fx(e){let{system:t,messages:n,input:r}=e,o=typeof t=="string"?[{role:"system",content:e.system}]:[],i=Array.isArray(r)?r:r!=null?[r]:void 0,s=Array.isArray(n)?n:n!=null?[n]:[],c=i??s;return[...o,...c]}function a3(e,t){return"type"in e&&typeof e.type=="string"&&e.type==="error"?(t.setStatus({code:2,message:Ky(e.error?.type)}),!0):!1}function c3(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 l3(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 p3(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 u3(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(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}t.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete t.activeToolBlocks[e.index]}function Wx(e,t,n,r){!(e&&typeof e=="object")||a3(e,r)||(c3(e,t),l3(e,t),p3(e,t,n),u3(e,t))}async function*Hl(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 o of e)Wx(o,r,n,t),yield o}finally{cs(t,r,n)}}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:{}};return e.on("streamEvent",o=>{Wx(o,r,n,t)}),e.on("message",()=>{cs(t,r,n)}),e.on("error",o=>{ge(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end())}),e}var Zd=!1,Vx=new WeakSet;function Xd(e,t,n){let r={[Yr]:"anthropic",[st]:n,[S]:"auto.ai.anthropic"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let o=e[0];o.tools&&Array.isArray(o.tools)&&(r[Zn]=JSON.stringify(o.tools)),r[Be]=o.model??"unknown","temperature"in o&&(r[si]=o.temperature),"top_p"in o&&(r[ci]=o.top_p),"stream"in o&&(r[Ca]=o.stream),"top_k"in o&&(r[xd]=o.top_k),"frequency_penalty"in o&&(r[ai]=o.frequency_penalty),"max_tokens"in o&&(r[xa]=o.max_tokens)}else t==="models.retrieve"||t==="models.get"?r[Be]=e[0]:r[Be]="unknown";return r}function Ga(e,t,n){let r=Fx(t);Bx(e,r,n),"prompt"in t&&e.setAttributes({[JC]:JSON.stringify(t.prompt)})}function d3(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 m3(e,t){"id"in t&&"model"in t&&(e.setAttributes({[li]:t.id,[cn]:t.model}),"usage"in t&&t.usage&&e.setAttributes(Xr(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 Kd(e,t,n){if(!(!t||typeof t!="object")){if("type"in t&&t.type==="error"){Hx(e,t);return}n&&d3(e,t),m3(e,t)}}function Yx(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end()),e}function f3(e,t,n,r,o,i,s,c,a,l){let p=r[Be]??"unknown",u={name:`${o} ${p}`,op:`gen_ai.${o}`,attributes:r};if(a&&!l){let d,m=Le(u,_=>(d=e.apply(t,n),c.recordInputs&&s&&Ga(_,s,nt(c.enableTruncation)),(async()=>{try{let h=await d;return Hl(h,_,c.recordOutputs??!1)}catch(h){return Yx(h,_)}})()));return wa(d,m)}else return Le(u,d=>{try{c.recordInputs&&s&&Ga(d,s,nt(c.enableTruncation)),Zd=!0;let m=e.apply(t,n);return Zd=!1,Fl(m,d,c.recordOutputs??!1)}catch(m){return Zd=!1,Yx(m,d)}})}function g3(e,t,n,r,o){return new Proxy(e,{apply(i,s,c){let a=s!==void 0?s:r,l=n.streaming===!0;if(!l&&Zd)return i.apply(a,c);let p=n.operation||"unknown",u=Xd(c,t,p),d=u[Be]??"unknown",m=typeof c[0]=="object"?c[0]:void 0,_=!!m?.stream;if(_||l)return f3(i,a,c,u,p,t,m,o,_,l);let h,b=Se({name:`${p} ${d}`,op:`gen_ai.${p}`,attributes:u},v=>(h=i.apply(a,c),o.recordInputs&&m&&Ga(v,m,nt(o.enableTruncation)),h.then(M=>(Kd(v,M,o.recordOutputs),M))));return wa(h,b)}})}function _3(e,t){for(let n of Object.keys(Xy)){let r=n.split("."),o=r.pop(),i=e;for(let a of r)i=i?.[a];if(!i||typeof i[o]!="function")continue;let s=i[o];if(Vx.has(s))continue;let c=g3(s,n,Xy[n],i,t);Vx.add(c),i[o]=c}return e}function qd(e,t){return _3(e,Xe(t))}var Qr="Google_GenAI",jx={"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}},Zx="google_genai";function h3(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 b3(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 y3(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 o of r?.content?.parts??[])n&&o.text&&t.responseTexts.push(o.text),o.functionCall&&t.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function S3(e,t,n,r){!e||h3(e,r)||(b3(e,t),y3(e,t,n))}async function*Wl(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of e)S3(o,r,n,t),yield o}finally{cs(t,r,n)}}function Ua(e,t="user"){return typeof e=="string"?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(n=>Ua(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 Xx(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 E3(e){let t={};return"temperature"in e&&typeof e.temperature=="number"&&(t[si]=e.temperature),"topP"in e&&typeof e.topP=="number"&&(t[ci]=e.topP),"topK"in e&&typeof e.topK=="number"&&(t[xd]=e.topK),"maxOutputTokens"in e&&typeof e.maxOutputTokens=="number"&&(t[xa]=e.maxOutputTokens),"frequencyPenalty"in e&&typeof e.frequencyPenalty=="number"&&(t[ai]=e.frequencyPenalty),"presencePenalty"in e&&typeof e.presencePenalty=="number"&&(t[Pa]=e.presencePenalty),t}function Qd(e,t,n){let r={[Yr]:Zx,[st]:e,[S]:"auto.ai.google_genai"};if(t){if(r[Be]=Xx(t,n),"config"in t&&typeof t.config=="object"&&t.config){let o=t.config;if(Object.assign(r,E3(o)),"tools"in o&&Array.isArray(o.tools)){let i=o.tools.flatMap(s=>s.functionDeclarations);r[Zn]=JSON.stringify(i)}}}else r[Be]=Xx({},n);return r}function Vl(e,t,n,r){if(n==="embeddings"){let i=t.contents;i!=null&&e.setAttribute(mi,typeof i=="string"?i:JSON.stringify(i));return}let o=[];if("config"in t&&t.config&&typeof t.config=="object"&&"systemInstruction"in t.config&&t.config.systemInstruction&&o.push(...Ua(t.config.systemInstruction,"system")),"history"in t&&o.push(...Ua(t.history,"user")),"contents"in t&&o.push(...Ua(t.contents,"user")),"message"in t&&o.push(...Ua(t.message,"user")),Array.isArray(o)&&o.length){let{systemInstructions:i,filteredMessages:s}=Mn(o);i&&e.setAttribute(tn,i);let c=Array.isArray(s)?s.length:0;e.setAttributes({[xt]:c,[Wt]:r?Vt(s):Ue(s)})}}function $d(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,o=typeof r.candidatesTokenCount=="number"||typeof r.thoughtsTokenCount=="number";e.setAttributes(Xr(r.promptTokenCount,o?(r.candidatesTokenCount??0)+(r.thoughtsTokenCount??0):void 0,void 0,r.cachedContentTokenCount,r.totalTokenCount)),typeof r.thoughtsTokenCount=="number"&&e.setAttribute(nd,r.thoughtsTokenCount)}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let r=t.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(i=>typeof i.text=="string"?i.text:"").filter(i=>i.length>0).join(""):"").filter(o=>o.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 T3(e,t,n,r,o){let i=n.operation==="embeddings";return new Proxy(e,{apply(s,c,a){let l=n.operation||"unknown",p=a[0],u=Qd(l,p,r),d=u[Be]??"unknown";return n.streaming?Le({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},async m=>{try{o.recordInputs&&p&&Vl(m,p,l,nt(o.enableTruncation));let _=await s.apply(r,a);return Wl(_,m,!!o.recordOutputs)}catch(_){throw m.setStatus({code:2,message:"internal_error"}),m.end(),_}}):Se({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},m=>(o.recordInputs&&p&&Vl(m,p,l,nt(o.enableTruncation)),lr(()=>s.apply(r,a),()=>{},()=>{},_=>{i||$d(m,_,o.recordOutputs)})))}})}function qy(e,t="",n){return new Proxy(e,{get:(r,o,i)=>{let s=Reflect.get(r,o,i),c=wd(t,String(o)),a=jx[c];if(typeof s=="function"&&a){let l=a.operation?T3(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 Jd(e,t){return qy(e,"",Xe(t))}var Da="LangChain",Ba="auto.ai.langchain",Kx={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var Xn=(e,t,n)=>{n!=null&&(e[t]=n)},Yl=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function Ha(e){if(Array.isArray(e))try{let t=e.map(n=>n&&typeof n=="object"&&fi(n)?as(n):n);return JSON.stringify(t)}catch{return String(e)}return Ue(e,String)}function jl(e){let t=e.toLowerCase();return Kx[t]??t}function qx(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 Qy(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function Zl(e){return e.map(t=>{let n=t._getType;if(typeof n=="function"){let o=n.call(t);return{role:jl(o),content:Ha(t.content)}}if(t.lc===1&&t.kwargs){let o=t.id,i=Array.isArray(o)&&o.length>0?o[o.length-1]:"",s=typeof i=="string"?qx(i):"user";return{role:jl(s),content:Ha(t.kwargs?.content)}}if(t.type){let o=String(t.type).toLowerCase();return{role:jl(o),content:Ha(t.content)}}if(t.role)return{role:jl(String(t.role)),content:Ha(t.content)};let r=t.constructor?.name;return r&&r!=="Object"?{role:jl(qx(r)),content:Ha(t.content)}:{role:"user",content:Ha(t.content)}})}function I3(e,t,n){let r={},o="kwargs"in e?e.kwargs:void 0,i=t?.temperature??n?.ls_temperature??o?.temperature;Yl(r,si,i);let s=t?.max_tokens??n?.ls_max_tokens??o?.max_tokens;Yl(r,xa,s);let c=t?.top_p??o?.top_p;Yl(r,ci,c);let a=t?.frequency_penalty;Yl(r,ai,a);let l=t?.presence_penalty;return Yl(r,Pa,l),t&&"stream"in t&&Xn(r,Ca,!!t.stream),r}function $x(e,t,n,r,o){return{[Yr]:Ue(e??"langchain",String),[st]:"chat",[Be]:Ue(t,String),[S]:Ba,...I3(n,r,o)}}function Jx(e,t,n,r,o,i){let s=i?.ls_provider,c=o?.model??i?.ls_model_name??"unknown",a=$x(s,c,e,o,i);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 zx(e,t,n,r,o,i){let s=i?.ls_provider??e.id?.[2],c=o?.model??i?.ls_model_name??"unknown",a=$x(s,c,e,o,i);if(n&&Array.isArray(t)&&t.length>0){let l=Zl(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 A3(e,t){let n=[],r=e.flat();for(let o of r){let s=o.message?.tool_calls;if(Array.isArray(s)&&s.length>0)n.push(...s);else{let c=o.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 $y(e){let t=e.usage_metadata;if(B(t)){let o=B(t.input_token_details)?t.input_token_details:void 0;return Xr(t.input_tokens,t.output_tokens,o?.cache_creation,o?.cache_read,t.total_tokens)}let n=e.response_metadata,r=B(n)&&B(n.tokenUsage)?n.tokenUsage:void 0;return Xr(r?.promptTokens,r?.completionTokens,void 0,void 0,r?.totalTokens)}function N3(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($y(a)))l[p]=(l[p]??0)+u}}Object.assign(t,Object.keys(n).length>0?n:r);let o=e.llmOutput;if(!o)return;let i=o.tokenUsage,s=o.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,Xr(c!==void 0||l!==void 0||p!==void 0?(c??0)+(l??0)+(p??0):void 0,a,l,p))}else i&&Object.keys(n).length===0&&Object.keys(r).length===0&&Object.assign(t,Xr(i.promptTokens,i.completionTokens,void 0,void 0,i.totalTokens));s&&(typeof s.cache_creation_input_tokens=="number"&&!(Ur in t)&&(t[Ur]=s.cache_creation_input_tokens),typeof s.cache_read_input_tokens=="number"&&!(Dr in t)&&(t[Dr]=s.cache_read_input_tokens))}function eP(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,jr,Ue(l,String)),A3(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))}}N3(e,n);let r=e.llmOutput,i=e.generations?.[0]?.[0]?.message,s=r?.model_name??r?.model??i?.response_metadata?.model_name;s&&Xn(n,cn,s);let c=r?.id??i?.id;c&&Xn(n,li,c);let a=r?.stop_reason??i?.response_metadata?.finish_reason;return a&&Xn(n,zC,Ue(a,String)),n}function zd(e){let t={},n=e?.lc_agent_name;return typeof n=="string"&&(t[pi]=n),t}function tP(e){let t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;let n=t.map(r=>{let o=r.function;return{type:"function",name:r.name??o?.name??"",description:r.description??o?.description}});return JSON.stringify(n)}function R3(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.addHandler=="function"&&typeof t.copy=="function"}function v3(e){return typeof e=="object"&&e?.name==="SentryCallbackHandler"}function Qx(e){return e.some(v3)}function ps(e,t){if(!e)return[t];if(R3(e)){if(Qx(e.handlers??[]))return e;let r=e.copy();return r.addHandler(t,!0),r}let n=Array.isArray(e)?e:[e];return Qx(n)?e:[...n,t]}function gr(e={}){let{recordInputs:t,recordOutputs:n}=Xe(e),r=nt(e.enableTruncation),o=new Map,i=c=>{let a=o.get(c);a?.isRecording()&&(a.end(),o.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=Qy(d),b=Jx(c,a,t,r,h,m),v=b[Be],M=b[st];Le({name:`${M} ${v}`,op:"gen_ai.chat",attributes:{...zd(m),...b,[H]:"gen_ai.chat"}},N=>(o.set(l,N),N))},handleChatModelStart(c,a,l,p,u,d,m,_){let h=Qy(d),b=zx(c,a,t,r,h,m),v=tP(u);v&&(b[Zn]=v);let M=b[Be],N=b[st];Le({name:`${N} ${M}`,op:"gen_ai.chat",attributes:{...zd(m),...b,[H]:"gen_ai.chat"}},R=>(o.set(l,R),R))},handleLLMEnd(c,a,l,p,u){let d=o.get(a);if(d?.isRecording()){let m=eP(c,n);m&&d.setAttributes(m),i(a)}},handleLLMError(c,a){let l=o.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),i(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=>(o.set(l,v),v))},handleChainEnd(c,a){let l=o.get(a);l?.isRecording()&&(n&&l.setAttributes({"langchain.chain.outputs":JSON.stringify(c)}),i(a))},handleChainError(c,a){let l=o.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),i(a))},handleToolStart(c,a,l,p,u,d,m){if(d?.__sentry_langgraph__)return;let _=m||c.name||"unknown_tool",h={...zd(d),[S]:Ba,[st]:"execute_tool",[Zr]:_};t&&(h[ka]=a),Le({name:`execute_tool ${_}`,op:"gen_ai.execute_tool",attributes:{...h,[H]:"gen_ai.execute_tool"}},b=>(o.set(l,b),b))},handleToolEnd(c,a){let l=o.get(a);if(l?.isRecording()){if(n){let p=c,u=p&&typeof p=="object"&&"content"in p?p.content:c;l.setAttributes({[La]:typeof u=="string"?u:JSON.stringify(u)})}i(a)}},handleToolError(c,a){let l=o.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),i(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 O3(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 C3(e){let t=e??{},n={[S]:Ba,[H]:My,[st]:"embeddings",[Be]:t.model??"unknown"};return n[Yr]=O3(t),"dimensions"in t&&(n[kd]=t.dimensions),"encodingFormat"in t&&(n[Pd]=t.encodingFormat),n}function em(e,t,n={}){let{recordInputs:r}=Xe(n),o=C3(e),i=o[Be]||"unknown";return r&&t!=null&&(o[mi]=typeof t=="string"?t:JSON.stringify(t)),{name:`embeddings ${i}`,op:My,attributes:o}}function nP(e,t={}){return new Proxy(e,{apply(n,r,o){return Se(em(r,o[0],t),()=>Reflect.apply(n,r,o))}})}function tm(e,t){let n=e;return typeof n.embedQuery=="function"&&(n.embedQuery=nP(n.embedQuery,t)),typeof n.embedDocuments=="function"&&(n.embedDocuments=nP(n.embedDocuments,t)),e}var Fa="LangGraph",Xl="auto.ai.langgraph";function Kl(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 Wa(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 o of e){if(!o||typeof o!="object")continue;let i=o,s=i.invoke;if(typeof s!="function"||Object.prototype.hasOwnProperty.call(i,r))continue;let c=typeof i.name=="string"?i.name:"unknown_tool",a=typeof i.description=="string"?i.description:void 0,l=new Proxy(s,{apply(p,u,d){let m={[S]:Xl,[H]:wy,[st]:"execute_tool",[Zr]:c,[Ll]:"function"},h=d[1]?.metadata?.lc_agent_name??n;typeof h=="string"&&(m[pi]=h),a&&(m[Ma]=a);let b=d[0];if(typeof b=="object"&&b&&("id"in b&&typeof b.id=="string"&&(m[kl]=b.id),t.recordInputs)){let v="args"in b&&typeof b.args=="object"?b.args:b;try{m[ka]=JSON.stringify(v)}catch{}}return Se({op:wy,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(La,typeof R=="string"?R:JSON.stringify(R))}catch{}return M}catch(M){throw v.setStatus({code:2,message:"internal_error"}),M}})}});i.invoke=l,Object.defineProperty(i,r,{value:!0,enumerable:!1})}return e}function x3(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 P3(e){let t=$y(e);return{inputTokens:t[At]??0,outputTokens:t[Ft]??0,totalTokens:t[jn]??0,cacheCreationInputTokens:t[Ur],cacheReadInputTokens:t[Dr]}}function k3(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(jr,[r.finish_reason])}}function rP(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 oP(e,t,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let i=t?.length??0,s=o.length>i?o.slice(i):[];if(s.length===0)return;let c=x3(s);c&&e.setAttribute(Sn,JSON.stringify(c));let a=Zl(s);e.setAttribute(nn,JSON.stringify(a));let l=0,p=0,u=0,d,m;for(let _ of s){let h=P3(_);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),k3(e,_)}l>0&&e.setAttribute(At,l),p>0&&e.setAttribute(Ft,p),u>0&&e.setAttribute(jn,u),d!==void 0&&e.setAttribute(Ur,d),m!==void 0&&e.setAttribute(Dr,m)}var Jy=!1,nm="__sentry_patched__";function rm(e){let t={[S]:Xl,[H]:"gen_ai.create_agent",[st]:"create_agent"};return e&&(t[pi]=e),{op:"gen_ai.create_agent",name:e?`create_agent ${e}`:"create_agent",attributes:t}}function zy(e,t){if(Object.prototype.hasOwnProperty.call(e,nm))return e;let n=gr(t),r=new Proxy(e,{apply(o,i,s){return Jy?Reflect.apply(o,i,s):Se(rm(),c=>{try{let a=Reflect.apply(o,i,s),l=s.length>0?s[0]:{};l?.name&&typeof l.name=="string"&&(c.setAttribute(pi,l.name),c.updateName(`create_agent ${l.name}`));let p=a.invoke;return p&&typeof p=="function"&&(a.invoke=Ql(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,nm,{value:!0,enumerable:!1}),r}function Ql(e,t,n,r,o,i){return new Proxy(e,{apply(s,c,a){let l=o?.modelName??o?.model;return Se({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[S]:Xl,[H]:rx,[st]:"invoke_agent"}},async p=>{try{let u=n?.name;u&&typeof u=="string"&&(p.setAttribute(nx,u),p.setAttribute(pi,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(ui,_),i){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=ps(R.callbacks,i)}let h=rP(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=Zl(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&&oP(p,M??null,N),N}catch(u){throw p.setStatus({code:2,message:"internal_error"}),u}})}})}function eS(e,t){if(Object.prototype.hasOwnProperty.call(e,nm))return e;let n=Xe(t),r=gr(n),o=new Proxy(e,{apply(i,s,c){let a=Kl(c),l=Wa(c),p=c[0];p&&Array.isArray(p.tools)&&p.tools.length>0&&ql(p.tools,n,l??void 0),Jy=!0;let u;try{u=Reflect.apply(i,s,c)}finally{Jy=!1}let d=u.invoke;if(d&&typeof d=="function"){let m={};l&&(m.name=l),u.invoke=Ql(d.bind(u),u,m,n,a,r)}return u}});return Object.defineProperty(o,nm,{value:!0,enumerable:!1}),o}function $l(e,t){return e.compile=zy(e.compile,Xe(t)),e}var iP=$l;function sP(e,t,n){let r=n.getOptions(),o=n.getDsn(),i=r.tunnel,s=oa(r._metadata),c={sent_at:new Date(rt()).toISOString(),...L3(t)&&{trace:t},...s&&{sdk:s},...!!i&&o&&{dsn:sn(o)}},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 L3(e){return!!e.trace_id&&!!e.public_key}function aP(e){let t=156;if(t+=e.name.length*2,t+=Rh(e.attributes),e.links&&e.links.length>0){let r=e.links[0]?.attributes,o=100+(r?Rh(r):0);t+=o*e.links.length}return t}var cP=1e3,M3=5e6,om=class{constructor(t,n){this._traceBuckets=new Map,this._client=t;let{maxSpanLimit:r,flushInterval:o,maxTraceWeightInBytes:i}=n??{};this._maxSpanLimit=r&&r>0&&r<=cP?r:cP,this._flushInterval=o&&o>0?o:5e3,this._maxTraceWeight=i&&i>0?i:M3,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+=aP(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),o=r[0]?._segmentSpan;if(!o){E&&g.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}let i=ot(o),s=r.map(a=>{let{_segmentSpan:l,...p}=a;return p}),c=sP(s,i,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 Jl=()=>({name:"SpanStreaming",setup(e){let t="SpanStreaming integration requires",n="Falling back to static trace lifecycle.",r=e.getOptions();if(!it(e)){r.traceLifecycle="static",E&&g.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let o=r.beforeSendSpan;if(o&&!To(o)){r.traceLifecycle="static",E&&g.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let i=new om(e);e.on("afterSpanEnd",s=>{zt(s)&&i.add(Ab(s,e))})}});function zl(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}function ep(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 lP(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 tp=class extends fd{constructor(t){lP(t),t.traceLifecycle==="stream"&&!t.integrations.some(n=>n.name==="SpanStreaming")&&t.integrations.push(Jl()),super(t),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(t,n){let r=kC(this,this._options.stackParser,t,n);return r.level="error",Co(r)}eventFromMessage(t,n="info",r){return Co(LC(this._options.stackParser,t,n,r,this._options.attachStacktrace))}captureException(t,n,r){return pP(n),super.captureException(t,n,r)}captureEvent(t,n,r){return!t.type&&t.exception?.values&&t.exception.values.length>0&&pP(n),super.captureEvent(t,n,r)}captureCheckIn(t,n,r){let o="checkInId"in t&&t.checkInId?t.checkInId:ut();if(!this._isEnabled())return E&&g.warn("SDK not enabled, will not capture check-in."),o;let i=this.getOptions(),{release:s,environment:c,tunnel:a}=i,l={check_in_id:o,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]=ya(this,r);u&&(l.contexts={trace:u});let d=bC(l,p,this.getSdkMetadata(),a,this.getDsn());return E&&g.log("Sending checkin:",t.monitorSlug,t.status),this.sendEnvelope(d),o}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=Ta(Il)}_prepareEvent(t,n,r,o){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,o)}_setUpMetricsProcessing(){this.on("processMetric",t=>{this._options.serverName&&(t.attributes={"server.address":this._options.serverName,...t.attributes})})}};function pP(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 uP={mechanism:{handled:!1,type:"auto.rpc.trpc.middleware"}};function w3(e){typeof e=="object"&&e!==null&&"ok"in e&&!e.ok&&"error"in e&&ge(e.error,uP)}function tS(e={}){return async function(t){let{path:n,type:r,next:o,rawInput:i,getRawInput:s}=t,c=O(),a=c?.getOptions(),l=c?.getDataCollectionOptions(),p={procedure_path:n,procedure_type:r};if(yv(p,1+(a?.normalizeDepth??5)),(e.attachRpcInput!==void 0?e.attachRpcInput:l?.httpBodies.includes("incomingRequest"))&&(i!==void 0&&(p.input=qe(i)),s!==void 0&&typeof s=="function"))try{let u=await s();p.input=qe(u)}catch{}return ir(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 o();return w3(m),d.end(),m}catch(m){throw ge(m,uP),d.end(),m}})))}}function Lo(e,t,n){try{if(!O())return;let o=Q();o?.isRecording()&&o.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 Va(e,t){Mt(e,t,n=>function(r,...o){let i=o[o.length-1];if(typeof i!="function")return n.call(this,r,...o);let s=np(i,t,r);return n.call(this,r,...o.slice(0,-1),s)})}function np(e,t,n){return function(...r){try{return G3.call(this,e,t,n,r)}catch(o){return E&&g.warn("MCP handler wrapping failed:",o),e.apply(this,r)}}}function G3(e,t,n,r){try{let o=e.apply(this,r);return B(o)&&typeof o.then=="function"?Promise.resolve(o).catch(i=>{throw dP(i,t,n),i}):o}catch(o){throw dP(o,t,n),o}}function dP(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")?Lo(e,"validation",r):e.name==="ServerTimeoutError"||e.message.includes("timed out")||e.message.includes("timeout")?Lo(e,"timeout",r):Lo(e,"tool_execution",r)):t==="resource"||t==="registerResource"?(r.resource_uri=n,Lo(e,"resource_execution",r)):(t==="prompt"||t==="registerPrompt")&&(r.prompt_name=n,Lo(e,"prompt_execution",r))}catch{}}function U3(e){typeof e.tool=="function"&&Va(e,"tool"),typeof e.registerTool=="function"&&Va(e,"registerTool")}function D3(e){typeof e.resource=="function"&&Va(e,"resource"),typeof e.registerResource=="function"&&Va(e,"registerResource")}function B3(e){typeof e.prompt=="function"&&Va(e,"prompt"),typeof e.registerPrompt=="function"&&Va(e,"registerPrompt")}function mP(e){U3(e),D3(e),B3(e)}function fP(e){let t=e,n=t._registeredTools;if(B(n))for(let[s,c]of Object.entries(n))typeof c.executor=="function"&&(c.executor=np(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=np(c.readCallback,"registerResource",s));let o=t._registeredResourceTemplates;if(B(o))for(let[s,c]of Object.entries(o))typeof c.readCallback=="function"&&(c.readCallback=np(c.readCallback,"registerResource",s));let i=t._registeredPrompts;if(B(i))for(let[s,c]of Object.entries(i))typeof c.handler=="function"&&(c.handler=np(c.handler,"registerPrompt",s))}var nS="mcp.method.name",gP="mcp.request.id",_P="mcp.session.id",hP="mcp.transport",rS="mcp.server.name",oS="mcp.server.title",iS="mcp.server.version",Ya="mcp.protocol.version",bP="mcp.tool.name",gi="mcp.resource.uri",yP="mcp.prompt.name",SP="mcp.tool.result.is_error",EP="mcp.tool.result.content_count",TP="mcp.prompt.result.description",IP="mcp.prompt.result.message_count",im="mcp.request.argument",AP="mcp.logging.level",NP="mcp.logging.logger",RP="mcp.logging.data_type",vP="mcp.logging.message",OP="network.transport",CP="network.protocol.version",sm="client.address",am="client.port",sS="mcp.server",xP="mcp.notification.client_to_server",PP="mcp.notification.server_to_client",kP="auto.function.mcp_server",aS="auto.mcp.notification",LP="route";function MP(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&"id"in e}function cS(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&!("id"in e)}function wP(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"id"in e&&("result"in e||"error"in e)}function GP(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 H3(e,t){let n={[EP]:e.length};for(let[r,o]of e.entries()){if(!ln(o))continue;let i=e.length===1?"mcp.tool.result":`mcp.tool.result.${r}`;if(typeof o.type=="string"&&(n[`${i}.content_type`]=o.type),t){let s=(a,l)=>{typeof l=="string"&&(n[`${i}.${a}`]=l)};s("mime_type",o.mimeType),s("uri",o.uri),s("name",o.name),typeof o.text=="string"&&(n[`${i}.content`]=o.text),typeof o.data=="string"&&(n[`${i}.data_size`]=o.data.length);let c=o.resource;ln(c)&&(s("resource_uri",c.uri),s("resource_mime_type",c.mimeType))}}return n}function UP(e,t){if(!ln(e))return{};let n=Array.isArray(e.content)?H3(e.content,t):{};return typeof e.isError=="boolean"&&(n[SP]=e.isError),n}function DP(e,t){let n={};if(!ln(e))return n;if(t&&typeof e.description=="string"&&(n[TP]=e.description),Array.isArray(e.messages)&&(n[IP]=e.messages.length,t)){let r=e.messages;for(let[o,i]of r.entries()){if(!ln(i))continue;let s=r.length===1?"mcp.prompt.result":`mcp.prompt.result.${o}`;if(((a,l)=>{if(typeof l=="string"){let p=r.length===1?`${s}.message_${a}`:`${s}.${a}`;n[p]=l}})("role",i.role),ln(i.content)){let a=i.content;if(typeof a.text=="string"){let l=r.length===1?`${s}.message_content`:`${s}.content`;n[l]=a.text}}}}return n}var lS=new Map,BP=new WeakMap;function cm(e){let t=e.sessionId;return t?lS.get(t):BP.get(e)}function F3(e,t){let n=e.sessionId;n?lS.set(n,t):BP.set(e,t)}function lm(e,t){let n=cm(e)||{};F3(e,{...n,...t})}function HP(e){return cm(e)?.clientInfo}function FP(e){return cm(e)?.protocolVersion}function WP(e){return cm(e)}function VP(e){let t=e.sessionId;t&&lS.delete(t)}var YP="io.modelcontextprotocol/protocolVersion",jP="io.modelcontextprotocol/clientInfo",ZP="io.modelcontextprotocol/serverInfo";function pm(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 XP(e){let t={};return ln(e.params)&&(typeof e.params.protocolVersion=="string"&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=pm(e.params.clientInfo))),t}function KP(e){let t={};if(ln(e.params)&&ln(e.params._meta)){let n=e.params._meta;typeof n[YP]=="string"&&(t.protocolVersion=n[YP]),n[jP]&&(t.clientInfo=pm(n[jP]))}return t}function qP(e){let t={};return ln(e)&&(typeof e.protocolVersion=="string"&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=pm(e.serverInfo))),t}function QP(e){let t={};return ln(e)&&ln(e._meta)&&e._meta[ZP]&&(t.serverInfo=pm(e._meta[ZP])),t}function W3(e){let t=HP(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 $P(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 V3(e){let t=WP(e)?.serverInfo,n={};return t?.name&&(n[rS]=t.name),t?.title&&(n[oS]=t.title),t?.version&&(n[iS]=t.version),n}function JP(e){let t={};return e?.name&&(t[rS]=e.name),e?.title&&(t[oS]=e.title),e?.version&&(t[iS]=e.version),t}function Y3(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 j3(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 pS(e,t){let n=e&&"sessionId"in e?e.sessionId:void 0,r=t?Y3(t):{},{mcpTransport:o,networkTransport:i}=j3(e),s=W3(e),c=V3(e),a=FP(e);return{...n&&{[_P]:n},...r.address&&{[sm]:r.address},...r.port&&{[am]:r.port},[hP]:o,[OP]:i,[CP]:"2.0",...a&&{[Ya]:a},...s,...c}}var um=new Map,uS=new WeakMap;function zP(e){let t=e.sessionId;if(t){let r=um.get(t);return r||(r=new Map,um.set(t,r)),r}let n=uS.get(e);return n||(n=new Map,uS.set(e,n)),n}function ek(e,t,n,r,o){zP(e).set(t,{span:n,method:r,capturePolicy:o,startTime:Date.now()})}function tk(e,t,n,r=!1){let o=zP(e),i=o.get(t);if(i){let{span:s,method:c}=i,a=c==="initialize"?qP(n):QP(n);(a.protocolVersion||a.serverInfo)&&lm(e,a);let l={...JP(a.serverInfo)};if(a.protocolVersion&&(l[Ya]=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=UP(n,i.capturePolicy.recordOutputs);s.setAttributes(p)}else if(c==="prompts/get"){let p=DP(n,i.capturePolicy.recordOutputs);s.setAttributes(p)}s.end(),o.delete(t)}}function nk(e){let t=e.sessionId;if(t){let r=um.get(t);if(r){for(let[,o]of r)o.span.setStatus({code:2,message:"cancelled"}),o.span.end();um.delete(t)}return}let n=uS.get(e);if(n){for(let[,r]of n)r.span.setStatus({code:2,message:"cancelled"}),r.span.end();n.clear()}}var rk={"tools/call":{targetField:"name",targetAttribute:bP,captureArguments:!0,argumentsField:"arguments"},"resources/read":{targetField:"uri",targetAttribute:gi,captureUri:!0},"resources/subscribe":{targetField:"uri",targetAttribute:gi},"resources/unsubscribe":{targetField:"uri",targetAttribute:gi},"prompts/get":{targetField:"name",targetAttribute:yP,captureName:!0,captureArguments:!0,argumentsField:"arguments"}};function rp(e,t){let n=rk[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 ok(e,t){let n={},r=rk[e];if(!r)return n;if(r.captureArguments&&r.argumentsField&&t?.[r.argumentsField]){let o=t[r.argumentsField];if(B(o))for(let[i,s]of Object.entries(o))n[`${im}.${i.toLowerCase()}`]=JSON.stringify(s)}return r.captureUri&&t?.uri&&(n[`${im}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${im}.name`]=JSON.stringify(t.name)),n}function Z3(e){return typeof e=="string"?e:JSON.stringify(e)}function X3(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[AP]=String(t.level)),t?.logger&&(r[NP]=String(t.logger)),t?.data!==void 0&&(r[RP]=typeof t.data,n&&(r[vP]=Z3(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[gi]=String(t.uri);let o=fr(String(t.uri));o&&!mr(o)&&(r["mcp.resource.protocol"]=o.protocol.replace(":",""))}break;case"notifications/initialized":r["mcp.lifecycle.phase"]="initialization_complete",r["mcp.protocol.ready"]=1;break}return r}function dS(e,t,n,r){if(e==="request"){let o=t,i=rp(o.method,n||{});return{...o.id!==void 0&&{[gP]:String(o.id)},...i.attributes,...r?ok(o.method,n||{}):{}}}return X3(t.method,n||{},r)}var K3=new Set([sm,am,gi]);function q3(e){return K3.has(e)}function mS(e,t){return t?e:Object.entries(e).reduce((n,[r,o])=>(q3(r)||(n[r]=o),n),{})}function ik(e,t){return t?`${e} ${t}`:e}function sk(e){let t,n;switch(e){case"request":t=sS,n=kP;break;case"notification-incoming":t=xP,n=aS;break;case"notification-outgoing":t=PP,n=aS;break}return{[H]:t,[S]:n,[ve]:LP}}function ak(e){let{type:t,message:n,transport:r,extra:o,callback:i,options:s}=e,{method:c}=n,a=n.params,l;if(t==="request"){let _=rp(c,a||{});l=ik(c,_.target)}else l=c;let p={...pS(r,o),[nS]:c,...dS(t,n,a,s?.recordInputs),...sk(t)},d=!!O()?.getDataCollectionOptions().userInfo,m=mS(p,d);return Se({name:l,forceTransaction:!0,attributes:m},i)}function ck(e,t,n,r,o){return ak({type:"notification-incoming",message:e,transport:t,extra:n,callback:o,options:r})}function lk(e,t,n,r){return ak({type:"notification-outgoing",message:e,transport:t,options:n,callback:r})}function pk(e,t,n,r){let{method:o}=e,i=e.params,s=rp(o,i||{}),c=ik(o,s.target),a={...pS(t,n),[nS]:o,...dS("request",e,i,r?.recordInputs),...sk("request")},p=!!O()?.getDataCollectionOptions().userInfo,u=mS(a,p);return{name:c,op:sS,forceTransaction:!0,attributes:u}}function fS(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 uk(e,t){e.onmessage&&Mt(e,"onmessage",n=>function(r,o){let i=MP(r)?r:void 0,s=cS(r)?r:void 0,c=i||s,a;if(c)try{a=i?.method==="initialize"?XP(i):KP(c),(a.protocolVersion||a.clientInfo)&&lm(e,a)}catch{}if(i){let l=fS(t),p=$().clone();return ir(p,()=>{let u=pk(i,e,o,l),d=L(u);return i.method==="initialize"&&a&&d.setAttributes({...$P(a.clientInfo),...a.protocolVersion&&{[Ya]:a.protocolVersion}}),ek(e,i.id,d,i.method,l),se(d,()=>n.call(this,i,o))})}if(s){let l=fS(t);return ck(s,e,o,l,()=>n.call(this,s,o))}return n.call(this,r,o)})}function dk(e,t){e.send&&Mt(e,"send",n=>async function(...r){let[o]=r;if(cS(o)){let i=fS(t);return lk(o,e,i,()=>n.call(this,...r))}return wP(o)&&o.id!==null&&o.id!==void 0&&(o.error&&Q3(o.error),tk(e,o.id,o.result,!!o.error)),n.call(this,...r)})}function mk(e){e.onclose&&Mt(e,"onclose",t=>function(...n){return nk(e),VP(e),t.call(this,...n)})}function fk(e){e.onerror&&Mt(e,"onerror",t=>function(n){return $3(n),t.call(this,n)})}function Q3(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}`,Lo(r,"protocol")}}}catch{}}function $3(e){try{Lo(e,"transport")}catch{}}var gk=new WeakSet;function gS(e,t){if(gk.has(e)||!GP(e))return e;let n=e,r={...t};return Mt(n,"connect",o=>async function(i,...s){let c=await o.call(this,i,...s);return uk(i,r),dk(i,r),mk(i),fk(i),c}),mP(n),fP(n),gk.add(e),e}function bk(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 yk(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let i=o.match(r);if(i)return{filename:`<data:${i[2]}>`,function:i[1]};let s=o.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=dv(s[2]),m=s[5]==="native";!d&&s[5]&&!m&&(d=s[5]);let _=d?J3(d):void 0;return{filename:_??d,module:_&&e?.(_),function:l,lineno:_k(s[3]),colno:_k(s[4]),in_app:bk(d||"",m)}}if(o.match(t))return{filename:o}}}function _S(e){return[90,yk(e)]}function _k(e){return parseInt(e||"",10)||void 0}function J3(e){try{return decodeURI(e)}catch{return}}var dm=new WeakMap,Sk=(e,t)=>{let n=dm.get(e);n?n.push(t):dm.set(e,[t])},op=e=>{let t=dm.get(e);return t||(t=[],dm.set(e,t)),t};var us="express.name",Ek="http.route",ds="express.type",mm="router",Tk="middleware",Ik="request_handler";var hS=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function z3(e){return e.includes(":")||e.includes("*")}var Nk=(e,t,n)=>{if(t.name==="router"){let r=Rk("",t),o=r||n||e||"/";return{attributes:{[us]:o,[ds]:mm},name:`router - ${o}`}}else return t.name==="bound dispatch"||t.name==="handle"?{attributes:{[us]:(e||n)??"request handler",[ds]:Ik},name:`request handler${t.path?` - ${e||n}`:""}`}:{attributes:{[us]:t.name,[ds]:Tk},name:`middleware - ${t.name}`}},Rk=(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)?Rk(e,n):e},vk=(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 Ok(e,t){let n=op(e);if(n.length===0)return;if(n.every(i=>i==="/"))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)||z3(r))?r:void 0}function Ck(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 fm=e=>{let t=e[0];return Array.isArray(t)?t.map(n=>Ak(n)||"").join(","):Ak(t)},Ak=e=>typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0,gm=e=>xk(e?.Router?.prototype),xk=e=>(typeof e=="object"||typeof e=="function")&&!!e&&"route"in e&&typeof e.route=="function",Pk=e=>xk(e.Router)&&!gm(e);function eZ(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function kk(e){return eZ(e)>=500}function ip(e){if(!$()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let n=ss(e);$().setSDKProcessingMetadata({normalizedRequest:n})}}function _m(e,t,n){if(!t?.handle)return;let r=t,o=r.handle;if(Rr(o)||o.length===4)return;function i(s,c,...a){let l=e();ip(s);let p=Q();if(!p)return o.apply(this,[s,c,...a]);n&&Sk(s,n);let u=op(s),d=!!n,m=Ck(s),_=Ok(s,m);l.onRouteResolved?.(_);let h=Nk(m,r,n),b=h.attributes[us],v=h.attributes[ds],M=Object.assign(h.attributes,{[S]:"auto.http.express",[H]:`${v}.express`});if(_&&(M[Ek]=_),vk(h.attributes[us],v,l))return d&&u.pop(),o.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[ds]===mm&&(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]=hS(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 o.apply(this,[s,c,...a])}catch(k){let[U,ae]=hS(k);throw R.setStatus({code:2,message:ae}),k}finally{P||(c.once("finish",T),c.once("close",G))}})}for(let s in o)s in i||Object.defineProperty(i,s,{get(){return o[s]},set(c){o[s]=c}});Fi(i,o),Object.defineProperty(r,"handle",{enumerable:!0,configurable:!0,writable:!0,value:i})}function hm(e){return!!e&&typeof e=="object"&&"default"in e&&e.default||e}function tZ(e){return!!e.express}var Lk=!1;function nZ(){Lk||(Lk=!0,E&&g.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function bS(e,t){let n,r;if(!t&&tZ(e)){let{express:p,...u}=e;r=p,n=()=>u,nZ()}else{if(typeof t!="function")throw new TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");n=t,r=e}let o=hm(r),i=gm(o)?o.Router.prototype:Pk(o)?o.Router:void 0;if(!i)throw new TypeError("no valid Express route function to instrument");let s=i.route;try{js(i,"route",function(...u){let d=s.apply(this,u),m=this.stack[this.stack.length-1];return _m(n,m,fm(u)),d})}catch(p){E&&g.error("Failed to patch express route method:",p)}let c=i.use;try{js(i,"use",function(...u){let d=c.apply(this,u),m=this.stack[this.stack.length-1];return m&&_m(n,m,fm(u)),d})}catch(p){E&&g.error("Failed to patch express use method:",p)}let{application:a}=o,l=a.use;try{js(a,"use",function(...u){let d=l.apply(this,u),m=gm(o)?this.router:this._router;if(m){let _=m.stack[m.stack.length-1];_&&_m(n,_,fm(u))}return d})}catch(p){E&&g.error("Failed to patch express application.use method:",p)}return o}function rZ(){return O()?.getIntegrationByName("Express")?.getShouldHandleError?.()}function yS(e){return function(n,r,o,i){ip(r);let s=e?.shouldHandleError??rZ()??kk;if(s===!1){i(n);return}if(s(n)){let c=ge(n,{mechanism:{type:"auto.middleware.express",handled:!1}});o.sentry=c}i(n)}}function SS(e,t){e.use(oZ()),e.use(yS(t))}function oZ(){return function(t,n,r){ip(t),r()}}var iZ=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,bm=Symbol("sentryPostgresConnectionContext"),ES=Symbol.for("sentry.instrumented.postgresjs"),sZ=Symbol.for("sentry.query.from.instrumented.sql");function AS(e,t){return!e||typeof e!="function"?(E&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),e):IS(e,{requireParentSpan:!0,...t})}function IS(e,t,n){if(e[ES])return e;let r=new Proxy(e,{apply(o,i,s){let c=Reflect.apply(o,i,s);return B(c)&&"handle"in c&&Mk(c,r,t),c},get(o,i){let s=o[i];return typeof i!="string"||typeof s!="function"?s:i==="unsafe"||i==="file"?aZ(s,o,r,t):i==="begin"||i==="reserve"?cZ(s,o,r,t):s}});return n?r[bm]=n:pZ(e,r),e[ES]=!0,r[ES]=!0,r}function aZ(e,t,n,r){return function(...o){let i=Reflect.apply(e,t,o);return B(i)&&"handle"in i&&Mk(i,n,r),i}}function cZ(e,t,n,r){return function(...o){let i=n[bm];if(!(typeof o[o.length-1]=="function")){let p=Reflect.apply(e,t,o);return p&&typeof p.then=="function"?p.then(u=>IS(u,r,i)):p}let c=o.length===1?o[0]:o[1],a=function(p){let u=IS(p,r,i);return c(u)},l=o.length===1?[a]:[o[0],a];return Reflect.apply(e,t,l)}}function Mk(e,t,n){if(e.handle?.__sentryWrapped)return;e[sZ]=!0;let r=e.handle,o=async function(...i){if(this.executed||!lZ(n))return r.apply(this,i);let s=ym(e.strings),c=Za(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[bm]:void 0;if(Sm(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{ja(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"),ja(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,i)}catch(u){throw a.setStatus({code:2,message:u instanceof Error?u.message:"unknown_error"}),a.end(),u}})};o.__sentryWrapped=!0,e.handle=o}function lZ(e){return Q()!==void 0||!e.requireParentSpan}function ym(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((t,n,r)=>r===0?n:`${t}$${r}${n}`,"")}var TS;function Za(e){return e?(TS||(TS=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(TS,"?").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 Sm(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 ja(e,t,n){if(n){e.setAttribute("db.operation.name",n);return}let r=t?.match(iZ);r?.[1]&&e.setAttribute("db.operation.name",r[1].toUpperCase())}function Em(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 pZ(e,t){let n=e;!n.options||typeof n.options!="object"||(t[bm]=Em(n.options))}var $r="@sentry/instrumentation-http",Jr="http.client.request.created",Xa="http.server.request.start";function Tm(e){let t=e.host||"",n=/^(.*):(\d+)$/.exec(t),r=n?n[1]:t,o=e.port??(n?Number(n[2]):void 0);return{method:e.method,port:o,protocol:e.protocol,host:e.host,hostname:r,path:e.path,headers:e.getHeaders()}}function NS(e){try{return String(wk(e))}catch{return""}}function wk(e){let t=e.protocol||"http:",r=e.headers?.host&&String(e.headers?.host)||e.hostname||e.host||"",o=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(r)?"":`:${e.port}`,i=e.path?e.path:"/",s=`${t}//${r}${o}`;return new URL(i.startsWith("//")?`${s}${i}`:i,s)}function _r(e){return String(NS(Tm(e)))}function Gk(e,t){let n=_r(e),r=ri(n),o=t?.statusCode,i=zl(o);an({category:"http",data:{status_code:o,url:oi(r),"http.method":e.method||"GET",...r.search?{"http.query":Yn(r.search)}:{},...r.hash?{"http.fragment":r.hash}:{}},type:"http",level:i},{event:"response",request:e,response:t})}function Uk(e){let t=_r(e),[n,r]=oy(fr(t),"client","auto.http.client",e),o=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"),...o?{"user_agent.original":o}:{},...r},onlyIfParent:!0}}function Dk(e,t){let{statusCode:n,statusMessage:r,httpVersion:o,socket:i}=e,s=o?.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp";t.setAttributes({"http.response.status_code":n,"network.protocol.version":o,"http.flavor":o,"network.transport":s,"net.transport":s,"http.status_text":r?.toUpperCase(),"http.status_code":n,...dZ(e),...uZ(i)})}function uZ(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 dZ(e){let{headers:t}=e,n=t["content-length"],r=n?parseInt(String(n),10):-1,o=t["content-encoding"];return r>=0?o&&o!=="identity"?{"http.response_content_length":r}:{"http.response_content_length_uncompressed":r}:{}}function Im(e,t){let n=_r(e),r=O()?.getOptions(),{tracePropagationTargets:o,propagateTraceparent:i}=r??{};if(!is(n,o,t)||!!e.getHeader("sentry-trace"))return;let c=tt({propagateTraceparent:i});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c;if(a)try{e.setHeader("sentry-trace",a),E&&g.log($r,"Added sentry-trace header")}catch(u){E&&g.error($r,"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($r,"Added traceparent header")}catch(u){E&&g.error($r,"Failed to set traceparent header:",ze(u)?u.message:"Unknown error")}if(l){let u=na(e.getHeader("baggage"),l);if(u)try{e.setHeader("baggage",u),E&&g.log($r,"Added baggage header")}catch(d){E&&g.error($r,"Failed to set baggage header:",ze(d)?d.message:"Unknown error")}}}var Bk=e=>typeof e.__unwrap=="function",mZ="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",Hk=!1,RS=E?e=>{Hk||(Bk(e.request)||Bk(e.get))&&(Hk=!0,g.warn(mZ))}:()=>{};function sp(e){let t=new jt(100),n=()=>O()?.getOptions(),r=o=>{if(ne().getScopeData().sdkProcessingMetadata[sa]===!0)return;let i=n(),{errorMonitor:s="error",spans:c=i?De(i):!0,propagateTrace:a=!1,breadcrumbs:l=!0,http:p,https:u,suppressOtelWarning:d=!1}=e,{request:m}=o,_=_r(m);if(iy(_,O())||e.ignoreOutgoingRequests?.(_,m))return;let h=!1;function b(T,G){h||(h=!0,Gk(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&&Im(m,t);return}d||(p&&RS(p),u&&RS(u));let M=L(Uk(m));e.outgoingRequestHook?.(M,m),a&&(M.isRecording()?se(M,()=>{Im(m,t)}):Im(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($r,"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(),Dk(T,M),bn(T),e.outgoingResponseHook?.(M,T);let G=!1;function k(U){if(!G){G=!0,U&&E&&g.log($r,"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{[Jr]:r}}var Fk;function fZ(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!="function"||(Fk=sp({...t,http:e})[Jr],Rr(n._storeHeader)))return;let o=n._storeHeader;js(n,"_storeHeader",function(...s){try{Fk({request:this},Jr)}catch{}return o.apply(this,s)})}function gZ(e,t={}){let n=hm(e);return fZ(n,t),e}var vS=(e,t={})=>gZ(e,t);function Wk(e,t,n,r){let o=0,i=[];E&&g.log(r,"Patching request.on");let s=new WeakMap,c=cy(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);o<c?(i.push(N),o+=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(i).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 OS=new WeakMap;function Vk(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let o=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&o){E&&g.log(`Recorded request session with status: ${o.status}`);let i=new Date(rt());i.setSeconds(0,0);let s=i.toISOString(),c=OS.get(e),a=c?.[s]||{exited:0,crashed:0,errored:0};if(a[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,c)c[s]=a;else{E&&g.log("Opened new request session aggregate.");let l={[s]:a};OS.set(e,l);let p=()=>{clearTimeout(d),u(),OS.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 Yk="Http.Server",_Z="Http.SentryServerSpans",jk=new WeakMap,Zk=Symbol.for("sentry_http_server_instrumented");function hZ(e){return!e[Zk]&&(e[Zk]=!0)}function bZ(e,t){let n=t.emit,r=jk.get(t);if(n===r)return;let o=new Proxy(n,{apply(i,s,c){let[a,...l]=c;if(a!=="request")return i.apply(s,c);let p=O(),[u,d]=l;if(!p||!hZ(u))return i.apply(s,c);E&&g.log(Yk,"Handling incoming request");let m=$().clone();m.setClient(p);let _=u.socket?.remoteAddress,h=u.url||"/",b=ss(u),{maxRequestBodySize:v="medium",ignoreRequestBody:M,sessions:N=!0,sessionFlushingDelayMS:R=6e4}=e;v!=="none"&&!M?.(h,u)&&Wk(u,m,v,Yk),m.setSDKProcessingMetadata({normalizedRequest:b,ipAddress:_});let P=(u.method||"GET").toUpperCase(),Y=Ln(h),T=`${P} ${Y}`;return m.setTransactionName(T),N&&Vk(p,{requestIsolationScope:m,response:d,sessionFlushingDelayMS:R??6e4}),ir(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=i.apply(s,c)}):Ne=i.apply(s,c),Ne})})}});jk.set(t,o),t.emit=o}function CS(e){let t=e.wrapServerEmitRequest,n=yZ(e),r={...e,wrapServerEmitRequest(i,s,c,a){let l=O()?.getOptions();e.spans??(l?De(l):!1)?n(i,s,c,a):t?t(i,s,c,a):a()}},o=i=>{let{server:s}=i;bZ(r,s)};return{[Xa]:o}}function yZ(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:o,errorMonitor:i="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(SZ(c,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return E&&g.log(_Z,"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":EZ(c)||void 0,[pt]:h&&!mr(h)?Ct(h.href,m):void 0,[ti]:h?.pathname??b,[Oo]: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",...TZ(c),...Vr(l.headers||{},m.getDataCollectionOptions())}},Ce=>{o?.(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,...Vr(hd(a.headers),m?.getDataCollectionOptions()??!1,"response")}),Ce.setStatus(In),s?.(Ce,c,a),Ce.end())}a.once("close",()=>{Rt(wt(a.statusCode))}),a.once(i,()=>{let In=wt(a.statusCode);Rt(In.code===2?In:{code:2})}),p()})}}}function SZ(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,o=e.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||t&&o==="GET"&&Xk(r)||n?.(r,e))}function Xk(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 EZ(e){return e.headers["next-router-prefetch"]==="1"}function TZ(e){let{headers:t}=e,n=t["content-length"],r=n?parseInt(String(n),10):-1,o=t["content-encoding"];return r>=0?o&&o!=="identity"?{"http.request_content_length":r}:{"http.request_content_length_uncompressed":r}:{}}import{subscribe as IZ}from"diagnostics_channel";var Ve=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Kk=_o("sentry_http_server_instrumented"),AZ="Http.Server";function qk(e,t){Ge(e,"_startSpanCallback",new WeakRef(t))}var NZ=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??"medium",spans:!1,ignoreRequestBody:e.ignoreRequestBody,wrapServerEmitRequest(n,r,o,i){let s=O();if(!s||ce.active().getValue(Kk))return i();let c=ho.extract(ce.active(),o.headers).setValue(Kk,!0);ce.with(c,()=>{s.emit("httpServerRequest",n,r,o);let a=n._startSpanCallback?.deref();a?a(()=>(i(),!0)):i()})}};return{name:AZ,setupOnce(){let{[Xa]:n}=CS(t);IZ(Xa,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`.")}}}),Ka=NZ;import{errorMonitor as RZ}from"events";var Qk="Http.ServerSpans",vZ=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,r=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:o}=e,{requestHook:i,responseHook:s,applyCustomAttributesOnSpan:c}=e.instrumentation??{};return{name:Qk,setup(a){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||a.on("httpServerRequest",(l,p,u)=>{let d=l,m=p;qk(d,h=>{if(xZ(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return Ve&&g.log(Qk,"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",[yO]:OZ(d)||void 0,[pt]:v&&!mr(v)?Ct(v.href,a):void 0,[ti]:v?.pathname??U,[Oo]:Ct(b,a),[Br]:u.method,[id]:Ct(v?`${v.pathname}${v.search}`:U,a),[iO]:Y,[mO]:T,[rO]:typeof R=="string"?R.split(",")[0]:void 0,[aO]:N,[sO]:G,[oO]:P,[ha]:P?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...PZ(d),...Vr(u.headers||{},a.getDataCollectionOptions())}});i?.(ue,d),s?.(ue,m),c?.(ue,d,m),o?.(ue,d,m);let Ne={type:oh.HTTP,span:ue};return se(ue,()=>ce.with(nv(ce.active(),Ne),()=>{bn(d),bn(m);let Te=!1;function Ce(Qe){if(Te)return;Te=!0;let Rt=MZ(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(RZ,()=>{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(wZ(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=vZ;function OZ(e){return e.headers["next-router-prefetch"]==="1"}function CZ(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 xZ(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(Lr())return!0;let r=e.url,o=e.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||t&&o==="GET"&&CZ(r)||n?.(r,e))}function PZ(e){let t=kZ(e.headers);return t==null?{}:LZ(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function kZ(e){let t=e["content-length"];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function LZ(e){let t=e["content-encoding"];return!!t&&t!=="identity"}function MZ(e,t,n){let{socket:r}=e,{statusCode:o,statusMessage:i}=t,s={[yn]:o,[vo]:o,"http.status_text":i?.toUpperCase()};if(r){let{localAddress:c,localPort:a,remoteAddress:l,remotePort:p}=r;s[dO]=c,s[fO]=a,s[gO]=l,s[Pe]=p}if(s[vo]=o,s["http.status_text"]=(i||"").toUpperCase(),n?.type===oh.HTTP&&n.route!==void 0){let c=n.route;s[Fe]=c}return s}function wZ(e,t){return t.some(n=>{if(typeof n=="number")return n===e;let[r,o]=n;return e>=r&&e<=o})}import{subscribe as xX,unsubscribe as PX}from"diagnostics_channel";var ap=class{emit(t){}enabled(){return!1}},$k=new ap;var cp=Symbol.for("io.opentelemetry.js.api.logs"),Qa=globalThis;function Jk(e,t,n){return r=>r===e?t:n}var xS=1;var PS=class{getLogger(t,n,r){return new ap}},Am=new PS;var Nm=class{constructor(t,n,r,o){this._provider=t,this.name=n,this.version=r,this.options=o}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):$k}};var lp=class{getLogger(t,n,r){var o;return(o=this._getDelegateLogger(t,n,r))!==null&&o!==void 0?o:new Nm(this,t,n,r)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Am}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,n,r)}};var Rm=class e{constructor(){this._proxyLoggerProvider=new lp}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return Qa[cp]?this.getLoggerProvider():(Qa[cp]=Jk(xS,t,Am),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,n;return(n=(t=Qa[cp])===null||t===void 0?void 0:t.call(Qa,xS))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(t,n,r){return this.getLoggerProvider().getLogger(t,n,r)}disable(){delete Qa[cp],this._proxyLoggerProvider=new lp}};var vm=Rm.getInstance();function zk(e,t,n,r){for(let o=0,i=e.length;o<i;o++){let s=e[o];t&&s.setTracerProvider(t),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}}function eL(e){e.forEach(t=>t.disable())}function $a(e){let t=e.tracerProvider||de.getTracerProvider(),n=e.meterProvider||Cu.getMeterProvider(),r=e.loggerProvider||vm.getLoggerProvider(),o=e.instrumentations?.flat()??[];return zk(o,t,n,r),()=>{eL(o)}}import*as Mo from"path";import{types as TL}from"util";var iL=/^(?: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-]+)*))?$/,GZ=/^(?<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-]+)*))?$/,UZ={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function sL(e,t,n){if(!DZ(e))return Ee.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,"$1");let r=WZ(e);if(!r)return!1;let o=[],i=aL(r,t,o,n);return i&&!n?.includePrerelease?HZ(r,o):i}function DZ(e){return typeof e=="string"&&iL.test(e)}function aL(e,t,n,r){if(t.includes("||")){let o=t.trim().split("||");for(let i of o)if(kS(e,i,n,r))return!0;return!1}else if(t.includes(" - "))t=lX(t,r);else if(t.includes(" ")){let o=t.trim().replace(/\s{2,}/g," ").split(" ");for(let i of o)if(!kS(e,i,n,r))return!1;return!0}return kS(e,t,n,r)}function kS(e,t,n,r){if(t=FZ(t,r),t.includes(" "))return aL(e,t,n,r);{let o=VZ(t);return n.push(o),BZ(e,o)}}function BZ(e,t){if(t.invalid)return!1;if(!t.version||MS(t.version))return!0;let n=nL(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],o=t.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=nL(r,o)}return UZ[t.op]?.includes(n)}function HZ(e,t){return e.prerelease?t.some(n=>n.prerelease&&n.version===e.version):!0}function FZ(e,t){return e=e.trim(),e=aX(e,t),e=sX(e),e=cX(e,t),e=e.trim(),e}function pn(e){return!e||e.toLowerCase()==="x"||e==="*"}function WZ(e){let t=e.match(iL);if(!t){Ee.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,o=t.groups.build,i=n.split("."),s=r?.split(".");return{op:void 0,version:n,versionSegments:i,versionSegmentCount:i.length,prerelease:r,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:o}}function VZ(e){if(!e)return{};let t=e.match(GZ);if(!t)return Ee.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,o=t.groups.prerelease,i=t.groups.build,s=r.split("."),c=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:s,versionSegmentCount:s.length,prerelease:o,prereleaseSegments:c,prereleaseSegmentCount:c?c.length:0,build:i}}function MS(e){return e==="*"||e==="x"||e==="X"}function tL(e){let t=parseInt(e,10);return isNaN(t)?e:t}function YZ(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 jZ(e,t){if(MS(e)||MS(t))return 0;let[n,r]=YZ(tL(e),tL(t));return n>r?1:n<r?-1:0}function nL(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=jZ(e[n]||"0",t[n]||"0");if(r!==0)return r}return 0}var cL="[a-zA-Z0-9-]",lL="0|[1-9]\\d*",ZZ=`\\d*[a-zA-Z-]${cL}*`,XZ="((?:<|>)?=?)",rL=`(?:${lL}|${ZZ})`,KZ=`(?:-(${rL}(?:\\.${rL})*))`,oL=`${cL}+`,qZ=`(?:\\+(${oL}(?:\\.${oL})*))`,LS=`${lL}|x|X|\\*`,pp=`[v=\\s]*(${LS})(?:\\.(${LS})(?:\\.(${LS})(?:${KZ})?${qZ}?)?)?`,QZ=`^${XZ}\\s*${pp}$`,$Z=new RegExp(QZ),JZ=`^\\s*(${pp})\\s+-\\s+(${pp})\\s*$`,zZ=new RegExp(JZ),eX="(?:~>?)",tX=`^${eX}${pp}$`,nX=new RegExp(tX),rX="(?:\\^)",oX=`^${rX}${pp}$`,iX=new RegExp(oX);function sX(e){let t=nX;return e.replace(t,(n,r,o,i,s)=>{let c;return pn(r)?c="":pn(o)?c=`>=${r}.0.0 <${+r+1}.0.0-0`:pn(i)?c=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:s?c=`>=${r}.${o}.${i}-${s} <${r}.${+o+1}.0-0`:c=`>=${r}.${o}.${i} <${r}.${+o+1}.0-0`,c})}function aX(e,t){let n=iX,r=t?.includePrerelease?"-0":"";return e.replace(n,(o,i,s,c,a)=>{let l;return pn(i)?l="":pn(s)?l=`>=${i}.0.0${r} <${+i+1}.0.0-0`:pn(c)?i==="0"?l=`>=${i}.${s}.0${r} <${i}.${+s+1}.0-0`:l=`>=${i}.${s}.0${r} <${+i+1}.0.0-0`:a?i==="0"?s==="0"?l=`>=${i}.${s}.${c}-${a} <${i}.${s}.${+c+1}-0`:l=`>=${i}.${s}.${c}-${a} <${i}.${+s+1}.0-0`:l=`>=${i}.${s}.${c}-${a} <${+i+1}.0.0-0`:i==="0"?s==="0"?l=`>=${i}.${s}.${c}${r} <${i}.${s}.${+c+1}-0`:l=`>=${i}.${s}.${c}${r} <${i}.${+s+1}.0-0`:l=`>=${i}.${s}.${c} <${+i+1}.0.0-0`,l})}function cX(e,t){let n=$Z;return e.replace(n,(r,o,i,s,c,a)=>{let l=pn(i),p=l||pn(s),u=p||pn(c),d=u;return o==="="&&d&&(o=""),a=t?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&d?(p&&(s=0),c=0,o===">"?(o=">=",p?(i=+i+1,s=0,c=0):(s=+s+1,c=0)):o==="<="&&(o="<",p?i=+i+1:s=+s+1),o==="<"&&(a="-0"),r=`${o+i}.${s}.${c}${a}`):p?r=`>=${i}.0.0${a} <${+i+1}.0.0-0`:u&&(r=`>=${i}.${s}.0${a} <${i}.${+s+1}.0-0`),r})}function lX(e,t){let n=zZ;return e.replace(n,(r,o,i,s,c,a,l,p,u,d,m,_)=>(pn(i)?o="":pn(s)?o=`>=${i}.0.0${t?.includePrerelease?"-0":""}`:pn(c)?o=`>=${i}.${s}.0${t?.includePrerelease?"-0":""}`:a?o=`>=${o}`:o=`>=${o}${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}`,`${o} ${p}`.trim()))}var un=console.error.bind(console);function up(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 ms=(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 o=n(r,t);return up(o,"__original",r),up(o,"__unwrap",()=>{e[t]===o&&up(e,t,r)}),up(o,"__wrapped",!0),up(e,t,o),o},wS=(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(o=>{ms(r,o,n)})})},Ja=(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}},GS=(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=>{Ja(n,r)})})};function dp(e){e&&e.logger&&(typeof e.logger!="function"?un("new logger isn't a function, not replacing"):un=e.logger)}dp.wrap=ms;dp.massWrap=wS;dp.unwrap=Ja;dp.massUnwrap=GS;var Om=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=Cu.getMeter(t,n),this._logger=vm.getLogger(t,n),this._updateMetricInstruments()}_wrap=ms;_unwrap=Ja;_massWrap=wS;_massUnwrap=GS;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,o){if(t)try{t(r,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},i)}}};var dL=Au(WS());import*as VS from"path";var xm=class{hooks=[];children=new Map},Pm=class{_trie=new xm;_counter=0;insert(t){let n=this._trie;for(let r of t.moduleName.split("/")){let o=n.children.get(r);o||(o=new xm,n.children.set(r,o)),n=o}n.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,i=[],s=!0;for(let c of t.split("/")){let a=o.children.get(c);if(!a){s=!1;break}r||i.push(...a.hooks),o=a}return r&&s&&i.push(...o.hooks),i.length===0?[]:i.length===1?[i[0].hook]:(n&&i.sort((c,a)=>c.insertedId-a.insertedId),i.map(({hook:c})=>c))}};var fX=["afterEach","after","beforeEach","before","describe","it"].every(e=>typeof global[e]=="function"),km=class e{_moduleNameTrie=new Pm;static _instance;constructor(){this._initialize()}_initialize(){new dL.Hook(null,{internals:!0},(t,n,r)=>{let o=gX(n),i=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:s}of i)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 fX?new e:this._instance=this._instance??new e}};function gX(e){return VS.sep!=="/"?e.split(VS.sep).join("/"):e}var AL=Au(eE());var NL=Au(WS());import{readFileSync as CX}from"fs";function zr(e,t,n){let r,o;try{o=e()}catch(i){r=i}finally{if(t(r,o),r&&!n)throw r;return o}}function w(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var le=class extends Om{_modules;_hooks=[];_requireInTheMiddleSingleton=km.getInstance();_enabled=!1;constructor(t,n,r){super(t,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(t,n,r)=>{if(w(t[n])&&this._unwrap(t,n),TL.isProxy(t)){let o=ms(Object.assign({},t),n,r);return Object.defineProperty(t,n,{value:o}),o}else return ms(t,n,r)};_unwrap=(t,n)=>TL.isProxy(t)?Object.defineProperty(t,n,{value:t[n]}):Ja(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(o=>{n.forEach(i=>{this._wrap(o,i,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(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){let t=globalThis.require;!t?.resolve||!t?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let o=t.resolve(r);t.cache[o]?.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=CX(Mo.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,o){if(!o)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 i=this._extractPackageVersion(o);if(t.moduleVersion=i,t.name===r)return IL(t.supportedVersions,i,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:o}),t.patch(n,t.moduleVersion)):n;let s=t.files??[],c=Mo.normalize(r);return s.filter(l=>l.name===c&&IL(l.supportedVersions,i,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:o}),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&&Mo.isAbsolute(c)){let l=Mo.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),o=Mo.isAbsolute(t.name)?new NL.Hook([t.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(t.name,r);this._hooks.push(o);let i=new AL.Hook([t.name],{internals:!0},n);this._hooks.push(i)}}}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 IL(e,t,n){return typeof t>"u"?e.includes("*"):e.some(r=>sL(t,r,{includePrerelease:n}))}var re=class{files;name;supportedVersions;patch;unpatch;constructor(t,n,r,o,i){this.files=i||[],this.name=t,this.supportedVersions=n,this.patch=r,this.unpatch=o}};var rn=Ks(process.versions.node),rc=rn.major,tE=rn.minor;import{errorMonitor as kX}from"events";import*as RL from"http";var LX=rn.major===22&&rn.minor>=12||rn.major===23&&rn.minor>=2||rn.major>=24;function fs(e={}){let{outgoingRequestApplyCustomAttributes:t,...n}=e,r={propagateTrace:n.propagateTraceInOutgoingRequests??!0,applyCustomAttributesOnSpan:t,...n,spans:n.createSpansForOutgoingRequests!==!1&&(n.spans??!0),ignoreOutgoingRequests(o,i){return Lr()||!!n.ignoreOutgoingRequests?.(o,Tm(i))},outgoingRequestHook(o,i){n.outgoingRequestHook?.(o,i);let s=i.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,o);return ce.with(m,()=>a.apply(l,p))}});i.once=c},outgoingResponseHook(o,i){n.outgoingResponseHook?.(o,i)},errorMonitor:kX,http:RL};LX?MX(r):wX(r)}var nE;function MX(e){let{[Jr]:t}=sp(e);nE&&PX(Jr,nE),xX(Jr,t),nE=t}function wX(e){vS(RL,e)}var vL="Http";Object.assign(fs,{id:`${vL}.sentry`});var OL=(e={})=>{let t=e.spans??!1,n=e.disableIncomingRequestSpans??!1,r=t&&!n,o={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},i={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes},s={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests,spans:t},c=Ka(o),a=qa(i);return{name:vL,setup(l){r&&a.setup(l)},setupOnce(){c.setupOnce(),fs(s)},processEvent(l){return a.processEvent(l)}}};import*as Mm from"diagnostics_channel";import{URL as FX}from"url";var rE="sentry-trace",Lm="baggage",GX="traceparent";function sE(e,t,n){let r=xL(e.origin,e.path),{tracePropagationTargets:o,propagateTraceparent:i}=O()?.getOptions()||{};if(!is(r,o,t))return;let s=n&&Mr(n)&&Q()?void 0:n,c=s?se(s,()=>tt({propagateTraceparent:i})):tt({propagateTraceparent:i});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c,u=Array.isArray(e.headers)?UX(e.headers):DX(e.headers);if(oE(u,rE),oE(u,Lm),i&&oE(u,GX),!(iE(u,rE)!==-1)){a&&u.push(rE,a),p&&iE(u,"traceparent")===-1&&u.push("traceparent",p);let m=iE(u,Lm);if(l&&m===-1)u.push(Lm,l);else if(l){let _=u[m+1],h=na(_,l);h&&(u[m+1]=h)}}Array.isArray(e.headers)?e.headers.splice(0,e.headers.length,...u):e.headers=BX(u)}function UX(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 DX(e){let t=e.split(`\r
22
- `),n=[];for(let r of t)try{let o=r.indexOf(":");if(o===-1)continue;let i=r.slice(0,o).trim(),s=r.slice(o+1).trim();i&&n.push(i,s)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function BX(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],o=e[n+1];!r||o==null||t.push(`${r}: ${o}`)}return t.length?t.join(`\r
23
- `).concat(`\r
24
- `):""}function oE(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 o=e[n+1];if(t===Lm&&o){let i=na(e[r+1],o);i&&(e[n+1]=i)}e.splice(r,2),r-=2}}function iE(e,t){return e.findIndex((n,r)=>r%2===0&&n===t)}function CL(e,t){let n=HX(e),r=t.statusCode,o=zl(r);an({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:e,response:t})}function HX(e){try{let t=xL(e.origin,e.path),n=ri(t),r={url:oi(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 xL(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 WX="http.request.method_original",aE=[],_i=new WeakMap,kL=new WeakMap,PL=new jt(100);function _p(e={}){aE.length||(gp("undici:request:create",t=>VX(e,t)),gp("undici:client:sendHeaders",t=>YX(e,t)),gp("undici:request:headers",t=>jX(e,t)),gp("undici:request:trailers",t=>ZX(t)),gp("undici:request:error",t=>XX(t)))}function cE(e,t){try{return e()}catch(n){t(n);return}}function gp(e,t){let[n=0,r=0]=process.version.replace("v","").split(".").map(i=>Number(i));n>18||n===18&&r>=19?aE.push(Mm.subscribe?.(e,t)):aE.push(Mm.channel(e).subscribe(t))}function LL(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],o=e.headers[n+1];typeof r=="string"&&o!==void 0&&t.set(r.toLowerCase(),o)}else if(typeof e.headers=="string"){let n=e.headers.split(`\r
25
- `);for(let r of n){if(!r)continue;let o=r.indexOf(":");if(o===-1)continue;let i=r.substring(0,o).toLowerCase(),s=r.substring(o+1).trim(),c=t.get(i);c&&Array.isArray(c)?c.push(s):c?t.set(i,[c,s]):t.set(i,s)}}return t}function VX(e,{request:t}){let n=qX(t.origin,t.path),r=cE(()=>!!e.ignoreOutgoingRequests?.(n),b=>b&&Ve&&g.error("caught ignoreOutgoingRequests error: ",b)),o=Lr()||!!r;if(kL.set(t,o),!e.spans){e.tracePropagation!==!1&&!o&&sE(t,PL);return}if(t.method==="CONNECT"||r)return;let i;try{i=new FX(t.path,t.origin)}catch(b){Ve&&g.warn("could not determine url.full:",b);return}let s=i.protocol.replace(":",""),c=KX(t.method),a={[Hr]:c,[WX]:t.method,[pt]:Ct(i.toString()),[ti]:i.pathname,[cd]:Yn(i.search),[vO]:s,[S]:"auto.http.otel.node_fetch"};if(n.startsWith("data:")){let b=Rl(n);a["http.url"]=b,a[pt]=b,a[hn]=`${t.method||"GET"} ${b}`}let l={https:"443",http:"80"},p=i.hostname,u=i.port||l[s];a[_t]=p,u&&!isNaN(Number(u))&&(a[ht]=Number(u));let m=LL(t).get("user-agent");if(m){let b=Array.isArray(m)?m[m.length-1]:m;a[OO]=b}let _=O(),h=L({name:c==="_OTHER"?"HTTP":c,kind:D.CLIENT,attributes:a,onlyIfParent:!_||!it(_)});cE(()=>e.requestHook?.(h,t),b=>b&&Ve&&g.error("caught requestHook error: ",b)),sE(t,PL,h),_i.set(t,h)}function YX(e,{request:t,socket:n}){let r=_i.get(t);if(!r)return;let{remoteAddress:o,remotePort:i}=n,s={[lO]:o,[pO]:i};if(e.headersToSpanAttributes?.requestHeaders){let c=new Set(e.headersToSpanAttributes.requestHeaders.map(l=>l.toLowerCase())),a=LL(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 jX(e,{request:t,response:n}){e.breadcrumbs!==!1&&!kL.get(t)&&CL(t,n);let o=_i.get(t);if(!o)return;let i={[yn]:n.statusCode};if(cE(()=>e.responseHook?.(o,{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(i,d)?i[d].push(u.toString()):i[d]=[u.toString()]}}}o.setAttributes(i),n.statusCode>=400&&o.setStatus(wt(n.statusCode))}function ZX({request:e}){let t=_i.get(e);t&&(t.end(),_i.delete(e))}function XX({request:e,error:t}){let n=_i.get(e);if(!n)return;if(t.name==="AbortError"||typeof DOMException<"u"&&t instanceof DOMException&&t.code===DOMException.ABORT_ERR){n.end(),_i.delete(e);return}n.setStatus({code:2,message:t.message}),n.end(),_i.delete(e)}function KX(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 qX(e,t="/"){let n=`${e}`;return n.endsWith("/")&&t.startsWith("/")?`${n}${t.slice(1)}`:!n.endsWith("/")&&!t.startsWith("/")?`${n}/${t}`:`${n}${t}`}var QX=((e={})=>({name:"NodeFetch",setupOnce(){_p(e)}})),ML=QX;var $X=_o("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function lE(e){return e.getValue($X)===!0}function hi(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(!JX(n)){Ee.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!wm(r)){Ee.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function JX(e){return typeof e=="string"&&e!==""}function wm(e){return e==null?!0:Array.isArray(e)?zX(e):wL(typeof e)}function zX(e){let t;for(let n of e){if(n==null)continue;let r=typeof n;if(r!==t){if(!t){if(wL(r)){t=r;continue}return!1}return!1}}return!0}function wL(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function GL(){return e=>{Ee.error(eK(e))}}function eK(e){return typeof e=="string"?e:JSON.stringify(tK(e))}function tK(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(t[r])return;let o=n[r];o&&(t[r]=String(o))}),n=Object.getPrototypeOf(n);return t}var nK=GL();function hp(e){try{nK(e)}catch{}}import{inspect as rK}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 ${rK(t)} for ${e}, expected a number, using defaults`);return}return n}function bp(e){let t=process.env[e];if(!(t==null||t.trim()===""))return t}var UL="2.12.0";rh();var DL="process.runtime.name";var gs={[jc]:"opentelemetry",[DL]:"node",[Yc]:tv,[Zc]:UL};var eo=performance;var iK=9,sK=6,aK=Math.pow(10,sK),pE=Math.pow(10,iK);function bi(e){let t=e/1e3,n=Math.trunc(t),r=Math.round(e%1e3*aK);return[n,r]}function uE(e){let t=bi(eo.timeOrigin),n=bi(typeof e=="number"?e:eo.now());return Dm(t,n)}function dE(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(n-=1,r+=pE),[n,r]}function Gm(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function Um(e){return Gm(e)||typeof e=="number"||e instanceof Date}function Dm(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=pE&&(n[1]-=pE,n[0]+=1),n}var cK="[object Object]",lK="[object Null]",pK="[object Undefined]",uK=Function.prototype,FL=uK.toString,dK=FL.call(Object),mK=Object.getPrototypeOf,WL=Object.prototype,VL=WL.hasOwnProperty,_s=Symbol?Symbol.toStringTag:void 0,YL=WL.toString;function mE(e){if(!fK(e)||gK(e)!==cK)return!1;let t=mK(e);if(t===null)return!0;let n=VL.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&FL.call(n)===dK}function fK(e){return e!=null&&typeof e=="object"}function gK(e){return e==null?e===void 0?pK:lK:_s&&_s in Object(e)?_K(e):hK(e)}function _K(e){let t=VL.call(e,_s),n=e[_s],r=!1;try{e[_s]=void 0,r=!0}catch{}let o=YL.call(e);return r&&(t?e[_s]=n:delete e[_s]),o}function hK(e){return YL.call(e)}var bK=20;function gE(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ZL(t,e.shift(),0,n);return t}function fE(e){return Hm(e)?e.slice():e}function ZL(e,t,n=0,r){let o;if(!(n>bK)){if(n++,Bm(e)||Bm(t)||XL(t))o=fE(t);else if(Hm(e)){if(o=e.slice(),Hm(t))for(let i=0,s=t.length;i<s;i++)o.push(fE(t[i]));else if(yp(t)){let i=Object.keys(t);for(let s=0,c=i.length;s<c;s++){let a=i[s];a==="__proto__"||a==="constructor"||a==="prototype"||(o[a]=fE(t[a]))}}}else if(yp(e))if(yp(t)){if(!yK(e,t))return t;o=Object.assign({},e);let i=Object.keys(t);for(let s=0,c=i.length;s<c;s++){let a=i[s];if(a==="__proto__"||a==="constructor"||a==="prototype")continue;let l=t[a];if(Bm(l))typeof l>"u"?delete o[a]:o[a]=l;else{let p=o[a],u=l;if(jL(e,a,r)||jL(t,a,r))delete o[a];else{if(yp(p)&&yp(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)}o[a]=ZL(o[a],l,n,r)}}}}else o=t;return o}}function jL(e,t,n){let r=n.get(e[t])||[];for(let o=0,i=r.length;o<i;o++){let s=r[o];if(s.key===t&&s.obj===e)return!0}return!1}function Hm(e){return Array.isArray(e)}function XL(e){return typeof e=="function"}function yp(e){return!Bm(e)&&!Hm(e)&&!XL(e)&&typeof e=="object"}function Bm(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function yK(e,t){return!(!mE(e)||!mE(t))}rh();var Fm;function KL(){if(Fm===void 0)try{let e=globalThis.process.argv0;Fm=e?`unknown_service:${e}`:"unknown_service"}catch{Fm="unknown_service"}return Fm}var oc=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";var _E=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=qL(t),r._asyncAttributesPending=t.filter(([o,i])=>oc(i)).length>0,r}constructor(t,n){let r=t.attributes??{};this._rawAttributes=Object.entries(r).map(([o,i])=>(oc(i)&&(this._asyncAttributesPending=!0),[o,i])),this._rawAttributes=qL(this._rawAttributes),this._schemaUrl=SK(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=EK(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function QL(e,t){return _E.FromAttributeList(Object.entries(e),t)}function hE(){return QL({[ev]:KL(),[Yc]:gs[Yc],[jc]:gs[jc],[Zc]:gs[Zc]})}function qL(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 SK(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 EK(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,o=n===void 0||n==="",i=r===void 0||r==="";if(o)return r;if(i||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)}rh();var $L="exception";var ic=Symbol.for("nodejs.util.inspect.custom");function sc(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!="function"&&r!=null&&(t[n]??=r);return t}function ac(e,t,n,r,o){if(typeof n=="number"&&n<0){let s=`[${e}]`;return r?.stylize?r.stylize(s,"special"):s}if(typeof o!="function"||!r)return t;let i={...r,depth:r.depth==null?r.depth:r.depth-1};return`${e} ${o(t,i)}`}var Wm=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=eo.now(),this._performanceOffset=n-(this._performanceStartTime+eo.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(!wm(n))return Ee.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:r}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,t);return r!==void 0&&this._attributesCount>=r&&o?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(n),o&&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:o}=this._spanLimits;if(o===0)return Ee.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&Ee.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Um(n)&&(Um(r)||(r=n),n=void 0);let i=hi(n),{attributePerEventCountLimit:s}=this._spanLimits,c={},a=0,l=0;for(let p in i){if(!Object.prototype.hasOwnProperty.call(i,p))continue;let u=i[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,o=hi(t.attributes),i={},s=0,c=0;for(let l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;let p=o[l];if(r!==void 0&&c>=r){s++;continue}i[l]=this._truncateToSize(p),c++}let a={context:t.context};return c>0&&(a.attributes=i),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=dE(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<=eo.now())return uE(t+this._performanceOffset);if(typeof t=="number")return bi(t);if(t instanceof Date)return bi(t.getTime());if(Gm(t))return t;if(this._startTimeProvided)return bi(Date.now());let n=eo.now()-this._performanceStartTime;return Dm(this.startTime,bi(n))}isRecording(){return this._ended===!1}recordException(t,n){let r={};typeof t=="string"?r[Nu]=t:t&&(t.code?r[Ru]=t.code.toString():t.name&&(r[Ru]=t.name),t.message&&(r[Nu]=t.message),t.stack&&(r[zR]=t.stack)),r[Ru]||r[Nu]?this.addEvent($L,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}[ic](t,n,r){let o={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:sc(this.resource)}};return ac("SpanImpl",o,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 JL="otel.span.parent.origin",bE="otel.span.sampling_result";var zL="otel.sdk.span.live",eM="otel.sdk.span.started";var Vm=class{startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(eM,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(zL,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,n){let r=IK(n);if(this.startedSpans.add(1,{[JL]:TK(t),[bE]:r}),n===et.NOT_RECORD)return()=>{};let o={[bE]:r};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};function TK(e){return e?e.isRemote?"remote":"local":"none"}function IK(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 tM="2.12.0";var Ym=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",tM);this._tracerMetrics=new Vm(r)}startSpan(t,n={},r=ce.active()){n.root&&(r=de.deleteSpan(r));let o=de.getSpan(r);if(lE(r))return Ee.debug("Instrumentation suppressed, returning Noop Span"),de.wrapSpanContext(sv);let i=o?.spanContext(),s=this._idGenerator.generateSpanId(),c,a,l;!i||!de.isSpanContextValid(i)?a=this._idGenerator.generateTraceId():(a=i.traceId,l=i.traceState,c=i);let p=n.kind??gt.INTERNAL,u=(n.links??[]).map(N=>({context:N.context,attributes:hi(N.attributes)})),d=hi(n.attributes),m=this._sampler.shouldSample(r,a,t,p,d,u),_=this._tracerMetrics.startSpan(i,m.decision);l=m.traceState??l;let h=m.decision===ih.RECORD_AND_SAMPLED?Xt.SAMPLED:Xt.NONE,b={traceId:a,spanId:s,traceFlags:h,traceState:l};if(m.decision===ih.NOT_RECORD)return Ee.debug("Recording is off, propagating context in a non-recording span"),de.wrapSpanContext(b);let v=hi(Object.assign(d,m.attributes));return new Wm({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,o){let i,s,c;if(arguments.length<2)return;arguments.length===2?c=n:arguments.length===3?(i=n,c=r):(i=n,s=r,c=o);let a=s??ce.active(),l=this.startSpan(t,i,a),p=de.setSpan(a,l);return ce.with(p,c,void 0,l)}[ic](t,n,r){let o={instrumentationScope:this.instrumentationScope,resource:{attributes:sc(this._resource)},spanLimits:this._spanLimits};return ac("Tracer",o,t,n,r)}};var Zm=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=>{hp(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 to=class{shouldSample(){return{decision:et.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};var En=class{shouldSample(){return{decision:et.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};var br=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(hp(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new En),this._remoteParentSampled=t.remoteParentSampled??new En,this._remoteParentNotSampled=t.remoteParentNotSampled??new to,this._localParentSampled=t.localParentSampled??new En,this._localParentNotSampled=t.localParentNotSampled??new to}shouldSample(t,n,r,o,i,s){let c=de.getSpanContext(t);return!c||!Xc(c)?this._root.shouldSample(t,n,r,o,i,s):c.isRemote?c.traceFlags&Xt.SAMPLED?this._remoteParentSampled.shouldSample(t,n,r,o,i,s):this._remoteParentNotSampled.shouldSample(t,n,r,o,i,s):c.traceFlags&Xt.SAMPLED?this._localParentSampled.shouldSample(t,n,r,o,i,s):this._localParentNotSampled.shouldSample(t,n,r,o,i,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 hs=class{generateTraceId=nM(16);generateSpanId=nM(8)},Xm=Buffer.allocUnsafe(16);function nM(e){return function(){for(let n=0;n<e/4;n++)Xm.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<e&&!(Xm[n]>0);n++)n===e-1&&(Xm[e-1]=1);return Xm.toString("hex",0,e)}}var bs;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(bs||(bs={}));var Sp=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(t={}){this._forceFlushTimeoutMillis=t.forceFlushTimeoutMillis??3e4,this._resource=t.resource??hE();let n=t.spanProcessors??[];this._activeSpanProcessor=new Zm(n),this._tracerOptions={resource:this._resource,sampler:t.sampler??new br({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 hs,spanProcessor:this._activeSpanProcessor,meterProvider:t.meterProvider??{getMeter(){return ov()}}}}getTracer(t,n,r){let o=`${t}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new Ym({name:t,version:n,schemaUrl:r?.schemaUrl},this._tracerOptions)),this._tracers.get(o)}forceFlush(t){let n=t?.timeoutMillis??this._forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(o=>new Promise(i=>{let s,c=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${n} ms`)),s=bs.timeout},n);o.forceFlush().then(()=>{clearTimeout(c),s!==bs.timeout&&(s=bs.resolved,i(s))}).catch(a=>{clearTimeout(c),s=bs.error,i(a)})}));return new Promise((o,i)=>{Promise.all(r).then(s=>{let c=s.filter(a=>a!==bs.resolved);c.length>0?i(c):o()}).catch(s=>i([s]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[ic](t,n,r){let o=this._activeSpanProcessor._spanProcessors,i={resource:{attributes:sc(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:o.map(s=>s.constructor?.name??"SpanProcessor")};return ac("TracerProvider",i,t,n,r)}};var ys=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:av(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 o=0;for(let i=0;i<8;i++){let s=t.charCodeAt(r+i),c=s<58?s-48:s<71?s-55:s-87;o=o<<4|c}n=(n^o)>>>0}return n}};var no;(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"})(no||(no={}));var Km=1;function oM(){return{sampler:AK(),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 AK(){let e=bp("OTEL_TRACES_SAMPLER")??no.ParentBasedAlwaysOn;switch(e){case no.AlwaysOn:return new En;case no.AlwaysOff:return new to;case no.ParentBasedAlwaysOn:return new br({root:new En});case no.ParentBasedAlwaysOff:return new br({root:new to});case no.TraceIdRatio:return new ys(rM());case no.ParentBasedTraceIdRatio:return new br({root:new ys(rM())});default:return Ee.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${no.ParentBasedAlwaysOn}".`),new br({root:new En})}}function rM(){let e=Pt("OTEL_TRACES_SAMPLER_ARG");return e==null?(Ee.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Km}.`),Km):e<0||e>1?(Ee.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${Km}.`),Km):e}var NK=128,RK=1/0;function iM(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")??NK,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??Pt("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??Pt("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??RK,Object.assign({},e,{spanLimits:t})}var Ep=class extends Sp{constructor(t={}){let n=gE({},oM(),iM(t));delete n.generalLimits,super(n)}};var xE="sentry.parentIsRemote",Ss="sentry.graphql.operation";function PE(e){if("parentSpanId"in e)return e.parentSpanId;if("parentSpanContext"in e)return e.parentSpanContext?.spanId}function Jm(e){return B(e.attributes)}function pM(e){return typeof e.kind=="number"}function uM(e){return!!e.status}function yE(e){return!!e.name}function dM(e){if(!Jm(e))return{};let t=e.attributes[pt]||e.attributes[Oo],n={url:t,"http.method":e.attributes[Hr]||e.attributes[Br]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof t=="string"){let r=ri(t);n.url=oi(r);let o=Yn(r.search);o&&(n["http.query"]=o),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function mM(e){return pM(e)?e.kind:gt.INTERNAL}var qm="sentry-trace",SE="baggage",zm="sentry.dsc",kE="sentry.sampled_not_recording",fM="sentry.url",vK="sentry.sample_rand",OK="sentry.sample_rate",ef="sentry.ignored",gM="sentry.segment_ignored",tf=_o("sentry_scopes"),EE=_o("sentry_fork_isolation_scope"),TE=_o("sentry_fork_set_scope"),Qm=_o("sentry_fork_set_isolation_scope"),_M="_scopeContext";function Es(e){return e.getValue(tf)}function hM(e,t){return e.setValue(tf,t)}function CK(e,t){Ge(e,_M,Vi(t))}function cc(e){return Yi(e[_M])}function lc(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(kE)==="1":!1;if(t===Xt.SAMPLED)return!0;if(r)return!1;let o=n?n.get(zm):void 0,i=o?sr(o):void 0;if(i?.sampled==="true")return!0;if(i?.sampled==="false")return!1}function bM(e,t){let n=e.spanContext(),r=Oe(e),o=lc(n);if(o!==void 0)return o;if(Mr(r))return!1;if(!(!De(t?.getOptions())||n.isRemote||!ol(r)))return zt(e)}function Ip(e,t,n){let r=t[Hr]||t[Br];if(r)return PK({attributes:t,name:e,kind:n},r);let o=t[dt]||t[ke],i=typeof t[H]=="string"&&t[H].startsWith("cache.");if(o&&!i)return xK({attributes:t,name:e});let s=t[ve]==="custom"?"custom":"route";if(t[ad])return{...Tp(e,t,"route"),op:"rpc"};if(t[Dt])return{...Tp(e,t,s),op:"message"};let l=t[ed];return l?{...Tp(e,t,s),op:l.toString()}:{op:void 0,description:e,source:"custom"}}function yM(e){let t,n;if(Jm(e))t=e.attributes,n=yE(e)?e.name:"<unknown>";else{let o=typeof e.spanContext=="function"?ie(e):void 0;t=o?.data||{},n=yE(e)?e.name:o?.description||"<unknown>"}let r=mM(e);return Ip(n,t,r)}function xK({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 PK({name:e,kind:t,attributes:n},r){let o=["http"];switch(t){case gt.CLIENT:o.push("client");break;case gt.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:i,url:s,query:c,fragment:a,hasRoute:l}=LK(n,t);if(!i)return{...Tp(e,n),op:o.join(".")};let p=n[Ss],u=`${r} ${i}`,d=p?`${u} (${kK(p)})`:u,m=l||i==="/"?"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}:Tp(e,n);return{op:o.join("."),description:Y,source:T,data:_}}function kK(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 LK(e,t){let n=e[id],r=e[Oo]||e[pt],o=e[Fe],i=typeof r=="string"?ri(r):void 0,s=i?oi(i):void 0,c=i?.search||void 0,a=i?.hash||void 0;return typeof o=="string"?{urlPath:o,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}:i?{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 Tp(e,t,n="custom"){let r=t[ve]||n,o=t[hn];return o&&typeof o=="string"?{description:o,source:r}:{description:e,source:r}}function LE(e){e.on("createDsc",(t,n)=>{if(!n)return;let r=ie(n),i=r.data[ve],s=bM(n,e);if(s===!1)delete t.transaction;else if(r.description){let{description:c}=yM(n);i!=="url"&&c&&(t.transaction=c)}De()&&(t.sampled=s==null?void 0:String(s))})}function ME(){return de.getActiveSpan()}var yi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,$m=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 SM({dsc:e,sampled:t}){let n=e?qo(e):void 0,r=new $m,o=n?r.set(zm,n):r;return t===!1?o.set(kE,"1"):o}var EM=new Set;function wE(){return Array.from(EM)}function Ts(e){EM.add(e)}var pc=class extends JR{constructor(){super(),Ts("SentryPropagator"),this._urlMatchesTargetsMap=new jt(100)}inject(t,n,r){if(Ws(t)){yi&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=de.getSpan(t),i=o&&UK(o),{tracePropagationTargets:s,propagateTraceparent:c}=O()?.getOptions()||{};if(!is(i,s,this._urlMatchesTargetsMap)){yi&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",i);return}let a=wK(n),l=GK(n),p=ho.getBaggage(t)||ho.createBaggage({}),{dynamicSamplingContext:u,traceId:d,spanId:m,sampled:_}=TM(t);if(a){let h=ta(a);h&&Object.entries(h).forEach(([b,v])=>{!l&&b.startsWith(So)||(p=p.setEntry(b,{value:v}))})}!l&&u&&(p=Object.entries(u).reduce((h,[b,v])=>v?h.setEntry(`${So}${b}`,{value:v}):h,p)),!l&&d&&d!==iv&&(r.set(n,qm,Qo(d,m,_)),c&&r.set(n,"traceparent",$o(d,m,_))),super.inject(ho.setBaggage(t,p),n,r)}extract(t,n,r){let o=r.get(n,qm),i=r.get(n,SE),s=o?Array.isArray(o)?o[0]:o:void 0;return AM(IM(t,{sentryTrace:s,baggage:i}))}fields(){return[qm,SE,"traceparent"]}};function TM(e,t={}){let n=de.getSpan(e);if(n?.spanContext().isRemote){let c=n.spanContext();return{dynamicSamplingContext:ot(n),traceId:c.traceId,spanId:void 0,sampled:lc(c)}}if(n){let c=n.spanContext();return{dynamicSamplingContext:ot(n),traceId:c.traceId,spanId:c.spanId,sampled:bM(n,t.client)}}let r=t.scope||Es(e)?.scope||ne(),o=t.client||O(),i=r.getPropagationContext();return{dynamicSamplingContext:o?cr(o,r):void 0,traceId:i.traceId,spanId:i.propagationSpanId,sampled:i.sampled}}function IM(e,{sentryTrace:t,baggage:n}){let r=Rn(t,n),{traceId:o,parentSpanId:i,sampled:s,dsc:c}=r,a=O(),l=sr(n);if(!i||a&&!zc(a,l?.org_id))return e;let p=DK({traceId:o,spanId:i,sampled:s,dsc:c});return de.setSpanContext(e,p)}function MK(e,t,n){let r=AM(IM(e,t));return ce.with(r,n)}function AM(e){let t=Es(e),n={scope:t?t.scope:ne().clone(),isolationScope:t?t.isolationScope:$()};return hM(e,n)}function wK(e){try{let t=e[SE];return Array.isArray(t)?t.join(","):t}catch{return}}function GK(e){try{return e[qm]}catch{return}}function UK(e){let t=ie(e).data,n=t[Oo]||t[pt];if(typeof n=="string")return n;let r=e.spanContext().traceState?.get(fM);if(r)return r}function DK({spanId:e,traceId:t,sampled:n,dsc:r}){let o=SM({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?Xt.SAMPLED:Xt.NONE,traceState:o}}function NM(e,t,n){let r=CM(),{name:o,parentSpan:i}=e;return MM(i)(()=>{let c=kM(e.scope,e.forceTransaction),a=e.onlyIfParent&&!de.getSpan(c),l=a?Fs(c):c;a&&O()?.recordDroppedEvent("no_parent_span","span");let p=xM(e);if(!De()){let u=Ws(l)?l:Fs(l);return ce.with(u,()=>r.startActiveSpan(o,p,u,d=>(IE(d),ce.with(c,()=>lr(()=>t(d),()=>{ie(d).status===void 0&&d.setStatus({code:Lt.ERROR})},n?()=>d.end():void 0)))))}return r.startActiveSpan(o,p,l,u=>(IE(u),lr(()=>t(u),()=>{ie(u).status===void 0&&u.setStatus({code:Lt.ERROR})},n?()=>u.end():void 0)))})}function RM(e,t){return NM(e,t,!0)}function vM(e,t){return NM(e,n=>t(n,()=>n.end()),!1)}function OM(e){let t=CM(),{name:n,parentSpan:r}=e;return MM(r)(()=>{let i=kM(e.scope,e.forceTransaction),s=e.onlyIfParent&&!de.getSpan(i),c=s?Fs(i):i;s&&O()?.recordDroppedEvent("no_parent_span","span");let a=xM(e);De()||(c=Ws(c)?c:Fs(c));let l=t.startSpan(n,a,c);return IE(l),l})}function GE(e,t){let n=e?de.setSpan(ce.active(),e):de.deleteSpan(ce.active());return ce.with(n,()=>t(ne()))}function CM(){return O()?.tracer||de.getTracer("@sentry/opentelemetry",q)}function xM(e){let{startTime:t,attributes:n,kind:r,op:o,links:i}=e,s=typeof t=="number"?PM(t):t;return{attributes:o?{[H]:o,...n}:n,kind:r,links:i,startTime:s}}function PM(e){return e<9999999999?e*1e3:e}function IE(e){let t=e.end.bind(e);e.end=n=>t(typeof n=="number"?PM(n):n)}function kM(e,t){let n=BK(e),r=de.getSpan(n);if(!r||!t)return n;let o=de.deleteSpan(n),{spanId:i,traceId:s}=r.spanContext(),c=lc(r.spanContext()),a=Oe(r),l=ot(a),p=SM({dsc:l,sampled:c}),u={traceId:s,spanId:i,isRemote:!0,traceFlags:c?Xt.SAMPLED:Xt.NONE,traceState:p};return de.setSpanContext(o,u)}function BK(e){if(e){let t=cc(e);if(t)return t}return ce.active()}function LM(e,t){return MK(ce.active(),e,t)}function HK(e){let t=yt(),n=qt(),r={traceId:t,spanId:n,isRemote:!0,traceFlags:Xt.NONE},o=de.setSpanContext(ce.active(),r);return ce.with(o,()=>(ne().setPropagationContext({traceId:t,sampleRand:ct()}),e()))}function UE(e,t){let n=cc(t),r=n&&de.getSpan(n),o=r?Pr(r):Zi(t);return[r?ot(r):cr(e,t),o]}function MM(e){return e!==void 0?t=>GE(e,t):t=>t()}function wM(e){let t=Fs(ce.active());return ce.with(t,e)}function FK(e){let t=e?cc(e):ce.active();return t?Ws(t):!1}function DE(e){e.on("preprocessEvent",t=>{let n=ME();if(!n||t.type==="transaction")return;t.contexts={trace:Pr(n),...t.contexts};let r=Oe(n);return t.sdkProcessingMetadata={dynamicSamplingContext:ot(r),...t.sdkProcessingMetadata},t})}function GM(e,t){let n=de.getSpan(e),r;if(n?.spanContext().traceState?.get(ef)==="1"){let h=de.deleteSpan(e),b=de.getSpan(t);r=b?de.setSpan(h,b):h}else r=e;let o=Es(r),i=o?.scope||ne(),s=o?.isolationScope||$(),c=r.getValue(EE)===!0,a=r.getValue(TE),l=r.getValue(Qm),p=a||i.clone(),u=l||(c?s.clone():s),_=hM(r,{scope:p,isolationScope:u}).deleteValue(EE).deleteValue(TE).deleteValue(Qm);return CK(p,_),_}function WK(e){let t=new Map;for(let n of e)VK(t,n);return Array.from(t,function([n,r]){return r})}function UM(e){return e.attributes[xE]===!0?void 0:PE(e)}function VK(e,t){let n=t.spanContext().spanId,r=UM(t);if(!r){AE(e,{id:n,span:t,children:[]});return}let o=YK(e,r),i=AE(e,{id:n,span:t,parentNode:o,children:[]});o.children.push(i)}function YK(e,t){let n=e.get(t);return n||AE(e,{id:t,children:[]})}function AE(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 DM={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"},BM=e=>Object.values(DM).includes(e);function HM(e){let t=Jm(e)?e.attributes:{},n=uM(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 o=NE(t);if(o)return o}return n.message&&BM(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=NE(t);return r||(n?.code===Lt.UNSET?{code:1}:{code:2,message:"unknown_error"})}function NE(e){let t=e[yn]||e[vo],n=e[_O],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:DM[n]||"unknown_error"}}var sM=1e3,jK=300,ZK=1e4,RE=class{constructor(t){this._finishedSpanBucketSize=t?.timeout||jK,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(rt()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new jt(ZK),this._debouncedFlush=dl(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&&yi&&g.log(`SpanExporter dropped ${s} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,o=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=o,o.spans.add(t),this._spansToBucketEntry.set(t,o);let i=UM(t);(!i||this._sentSpans.get(i))&&this._debouncedFlush()}flush(){let t=this._finishedSpanBuckets.flatMap(i=>i?Array.from(i.spans):[]),n=this._maybeSend(t),r=n.size,o=t.length-r;yi&&g.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);for(let i of n){this._sentSpans.set(i.spanContext().spanId,1);let s=this._spansToBucketEntry.get(i);s&&s.spans.delete(i)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(t){let n=WK(t),r=new Set,o=this._getCompletedRootNodes(n);for(let i of o){let s=i.span;r.add(s);let c=KK(s);if(i.parentNode&&this._sentSpans.get(i.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 i.children)vE(u,a,r)&&(l=!0);c.spans=a.length>sM?a.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,sM):a,l&&(c.sdkProcessingMetadata={...c.sdkProcessingMetadata,hasGenAiSpans:!0});let p=$i(s.events);p&&(c.measurements=p),yl(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 XK(e){let t=e.attributes,n=t[S],r=t[H],o=t[ve];return{origin:n,op:r,source:o}}function KK(e){let{op:t,description:n,data:r,origin:o="manual",source:i}=FM(e),s=$t(e),c=e.attributes[Wn],a={[ve]:i,[Wn]:c,[H]:t,[S]:o,...r,...WM(e.attributes)},{links:l}=e,{traceId:p,spanId:u}=e.spanContext(),d=PE(e),m=HM(e),_={parent_span_id:d,span_id:u,trace_id:p,data:a,origin:o,op:t,status:qi(m),links:Ki(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:ot(e)},...i&&{transaction_info:{source:i}}}}function vE(e,t,n){let r=e.span;if(r&&n.add(r),!r){let R=!1;return e.children.forEach(P=>{vE(P,t,n)&&(R=!0)}),R}let i=r.spanContext().spanId,s=r.spanContext().traceId,c=PE(r),{attributes:a,startTime:l,endTime:p,links:u}=r,{op:d,description:m,data:_,origin:h="manual"}=FM(r),b={[S]:h,[H]:d,...WM(a),..._},v=HM(r),M={span_id:i,trace_id:s,data:b,description:m,parent_span_id:c,start_timestamp:Jt(l),timestamp:Jt(p)||void 0,status:qi(v),op:d,origin:h,measurements:$i(r.events),links:Ki(u)};t.push(M);let N=!!d?.startsWith("gen_ai.");return e.children.forEach(R=>{vE(R,t,n)&&(N=!0)}),N}function FM(e){let{op:t,source:n,origin:r}=XK(e),{op:o,description:i,source:s,data:c}=yM(e),a=t||o,l=n||s,p={...c,...qK(e)};return{op:a,description:i,source:l,origin:r,data:p}}function WM(e){let t={...e};return delete t[Wn],delete t[xE],delete t[hn],t}function qK(e){let t=e.attributes,n={};e.kind!==gt.INTERNAL&&(n["otel.kind"]=gt[e.kind]);let r=t[vo];r&&(n[yn]=r);let o=dM(e);return o.url&&(n.url=o.url),o["http.query"]&&(n["http.query"]=o["http.query"].slice(1)),o["http.fragment"]&&(n["http.fragment"]=o["http.fragment"].slice(1)),n}function nf(e,t){let n=e.attributes??{},r=t?.spanKind??D.INTERNAL,{op:o,description:i,source:s,data:c}=Ip(e.name,n,r);e.name=i,Bt(e,{[H]:o,[ve]:s,[SO]:"manual",...c}),r!==D.INTERNAL&&Bt(e,{"otel.kind":ly(r)})}var Ap=class{constructor(t){this._unsubscribePreprocessSpan=void 0,Ts("SentrySpanProcessor"),this._exporter=new RE(t),this._client=t?.client??O(),this._client&&it(this._client)&&(this._unsubscribePreprocessSpan=this._client.on("preprocessSpan",nf))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(t,n){let r=de.getSpan(n),o=Es(n);r&&!r.spanContext().isRemote&&Eo(r,t),r?.spanContext().isRemote&&t.setAttribute(xE,!0),n===Ou&&(o={scope:qs(),isolationScope:vt()}),o&&Cr(t,o.scope,o.isolationScope),cl(t),this._client?.emit("spanStart",t)}onEnd(t){ll(t),this._client?.emit("spanEnd",t),this._client&&it(this._client)?this._client.emit("afterSpanEnd",t):this._exporter.export(t)}},Np=class{constructor(t){this._client=t,this._isSpanStreaming=it(t),Ts("SentrySampler")}shouldSample(t,n,r,o,i,s){let c=this._client.getOptions(),{ignoreSpans:a}=c,l=JK(t),p=l?.spanContext();if(!De(c))return wo({decision:void 0,context:t,spanAttributes:i});let u=i[Br]||i[Hr];if(o===gt.CLIENT&&u&&(!l||p?.isRemote)&&!this._isSpanStreaming)return this._client.recordDroppedEvent("no_parent_span","span"),wo({decision:void 0,context:t,spanAttributes:i});let d=l?QK(l,n,r):void 0;if(!(!l||p?.isRemote)){if(this._isSpanStreaming){if(d&&a?.length){let{description:ae,op:ue}=Ip(r,i,o);if(ar({description:ae,op:i[H]??ue,attributes:i},a))return this._client.recordDroppedEvent("ignored","span"),wo({decision:et.NOT_RECORD,context:t,spanAttributes:i,ignoredChildSpan:!0})}if(!d){let ae=p?.traceState?.get(gM)==="1";this._client.recordDroppedEvent(ae?"ignored":"sample_rate","span")}}return wo({decision:d?et.RECORD_AND_SAMPLED:et.NOT_RECORD,context:t,spanAttributes:i})}let{description:_,data:h,op:b}=Ip(r,i,o),v={...h,...i};if(b&&(v[H]=b),this._isSpanStreaming&&a?.length&&ar({description:_,op:v[H]??b,attributes:v},a))return this._client.recordDroppedEvent("ignored","span"),wo({decision:et.NOT_RECORD,context:t,spanAttributes:i,ignoredSegmentSpan:!0});let M={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:v,spanName:_,parentSampled:d,parentContext:p},M),!M.decision)return wo({decision:void 0,context:t,spanAttributes:i});let{isolationScope:N}=Es(t)??{},R=p?.traceState?p.traceState.get(zm):void 0,P=R?sr(R):void 0,Y=Nn(P?.sample_rand)??ct(),[T,G,k]=ul(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"?(yi&&g.log(`[Tracing] Not sampling span because HTTP method is '${U}' for ${r}`),wo({decision:et.NOT_RECORD,context:t,spanAttributes:i,sampleRand:Y,downstreamTraceSampleRate:0})):(!T&&d===void 0&&(yi&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate",this._isSpanStreaming?"span":"transaction")),{...wo({decision:T?et.RECORD_AND_SAMPLED:et.NOT_RECORD,context:t,spanAttributes:i,sampleRand:Y,downstreamTraceSampleRate:k?G:void 0}),attributes:{[Wn]:k?G:void 0}})}toString(){return"SentrySampler"}};function QK(e,t,n){let r=e.spanContext();if(Xc(r)&&r.traceId===t){if(r.isRemote){let i=lc(e.spanContext());return yi&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${i}`),i}let o=lc(r);return yi&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function wo({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o,ignoredChildSpan:i,ignoredSegmentSpan:s}){let c=$K(t,n);return o!==void 0&&(c=c.set(OK,`${o}`)),r!==void 0&&(c=c.set(vK,`${r}`)),i&&(c=c.set(ef,"1")),s&&(c=c.set(gM,"1")),e==null?{decision:et.NOT_RECORD,traceState:c}:e===et.NOT_RECORD?{decision:e,traceState:c.set(kE,"1")}:{decision:e,traceState:c}}function $K(e,t){let o=de.getSpan(e)?.spanContext()?.traceState||new $m,i=t[Oo]||t[pt];return i&&typeof i=="string"&&(o=o.set(fM,i)),o}function JK(e){let t=de.getSpan(e);return t&&Xc(t.spanContext())?t:void 0}function rf(e,t={}){let n=ie(e),r=n.data,o=e.kind??gt.INTERNAL,i=ea(e),s=r[hn]!==void 0,c=i&&!s&&!Wh(e),a=c&&r[ve]==="custom"?{...r,[ve]:void 0}:r,l=Ip(n.description||"<unknown>",a,o);if(o!==gt.INTERNAL&&r["otel.kind"]===void 0&&e.setAttribute("otel.kind",gt[o]),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||o===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){t9(e,r);let u=O();e9(e,r,n.status,!!u&&it(u))}i&&l.description!==n.description&&(r[ve]!=="custom"||c)&&e.updateName(l.description)}function zK(e,t){Ge(e,"kind",t??gt.INTERNAL)}function e9(e,t,n,r){if(n===void 0){e.setStatus(NE(t)||{code:1});return}!r&&n!=="ok"&&!BM(n)&&e.setStatus({code:2,message:"internal_error"})}function t9(e,t){let n=t[vo];t[yn]===void 0&&n!==void 0&&(e.setAttribute(yn,n),t[yn]=n)}var OE=class{startSpan(t,n={},r){let o=r||ce.active(),i=n.root?void 0:de.getSpan(o);if(Ws(o))return this._createNonRecordingSpan(i);let s=this._startSentrySpan(t,n,i,r!==void 0);return Vh(s),zK(s,n.kind),n.attributes?.[ve]===void 0&&Hh(s),rf(s),s}startActiveSpan(t,n,r,o){let i=typeof n=="function"?{}:n,s=typeof r=="function"||r===void 0?ce.active():r,c=typeof n=="function"?n:typeof r=="function"?r:o,a=this.startSpan(t,i,s),l=$t(a).isolationScope,p=u=>l?u.setValue(Qm,l):u;return Mr(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,o){let i={name:t,attributes:n.attributes,links:n.links,startTime:n.startTime};return n.root?On(()=>aa({...i,parentSpan:null})):r?.spanContext().isRemote?this._startRootSpanWithRemoteParent(i,r):r?aa({...i,parentSpan:r}):On(()=>aa({...i,parentSpan:o?null:void 0}))}_startRootSpanWithRemoteParent(t,n){let{spanId:r,traceId:o,traceState:i}=n.spanContext(),s=ot(n),c=typeof s.sample_rand=="string"?Number(s.sample_rand):void 0,a=!!i?.get(zm);return He(l=>(l.setPropagationContext({traceId:o,parentSpanId:r,sampled:lc(n.spanContext()),dsc:a?s:void 0,sampleRand:typeof c=="number"&&!Number.isNaN(c)?c:ct()}),Fn(l,void 0),aa({...t,parentSpan:null})))}_createNonRecordingSpan(t){let n=new kr({traceId:t?.spanContext().traceId});return t&&Eo(t,n),Cr(n,ne(),$()),n}},Rp=class{constructor(t={}){this._tracers=new Map,this.resource=t.resource}getTracer(t,n,r){let o=JSON.stringify([t,n,r]),i=this._tracers.get(o);if(i)return i;let s=new OE;return this._tracers.set(o,s),s}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},aM="telemetry.sdk.language",cM="telemetry.sdk.name",lM="telemetry.sdk.version",n9="service.namespace",CE=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 r9(e){if(!e)return{};let t={};for(let n of e.split(",")){let r=n.indexOf("=");if(r===-1)continue;let o=n.substring(0,r).trim(),i=n.substring(r+1).trim();if(o)try{t[o]=decodeURIComponent(i)}catch{t[o]=i}}return t}function of(e){let t=typeof process<"u"?process.env:{},n=t.OTEL_SERVICE_NAME,r=r9(t.OTEL_RESOURCE_ATTRIBUTES);return new CE({[n9]:"sentry",[Ib]:e,...r,...n?{[Ib]:n}:{},[RO]:q,[aM]:vu[aM],[cM]:vu[cM],[lM]:vu[lM]})}function o9({span:e,scope:t,client:n,propagateTraceparent:r}={}){let o=(t&&cc(t))??ce.active();if(e){let{scope:p}=$t(e);o=p&&cc(p)||de.setSpan(ce.active(),e)}let{traceId:i,spanId:s,sampled:c,dynamicSamplingContext:a}=TM(o,{scope:t,client:n}),l={"sentry-trace":Qo(i,s,c),baggage:qo(a)};return r&&(l.traceparent=$o(i,s,c)),l}function VM(e){function t(){let a=ce.active(),l=Es(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=cc(a)||ce.active();return ce.with(p.setValue(TE,a),()=>l(a))}function o(a){let l=ce.active();return ce.with(l.setValue(EE,!0),()=>{let p=s();return Jc(p.getPropagationContext())||p.setPropagationContext({traceId:yt(),sampleRand:ct()}),a(c())})}function i(a,l){let p=ce.active();return ce.with(p.setValue(Qm,a),()=>l(c()))}function s(){return t().scope}function c(){return t().isolationScope}Nh({withScope:n,withSetScope:r,withSetIsolationScope:i,withIsolationScope:o,getCurrentScope:s,getIsolationScope:c,startSpan:RM,startSpanManual:vM,startInactiveSpan:OM,getActiveSpan:ME,suppressTracing:wM,isTracingSuppressed:FK,getTraceData:o9,continueTrace:LM,startNewTrace:HK,withActiveSpan:GE,getTracingChannelBinding:e?.getTracingChannelBinding})}import{AsyncLocalStorage as YM}from"async_hooks";import{EventEmitter as i9}from"events";var s9=["addListener","on","once","prependListener","prependOnceListener"],sf=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1,Ts("SentryContextManager"),this._asyncLocalStorage=St(Je()).getTracingChannelBinding?.()?.asyncLocalStorage??new YM}active(){return this._asyncLocalStorage.getStore()??Ou}with(t,n,r,...o){let i=GM(t,this.active()),s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(i,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}bind(t,n){return n instanceof i9?this._bindEventEmitter(t,n):typeof n=="function"?this._bindFunction(t,n):n}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:tf}}_bindFunction(t,n){let r=this.with.bind(this),o=function(...i){return r(t,()=>n.apply(this,i))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),o}_bindEventEmitter(t,n){if(this._getPatchMap(n)!==void 0)return n;this._createPatchMap(n);for(let r of s9)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(o,i){let s=r._getPatchMap(t)?.[o];if(s===void 0)return n.call(this,o,i);let c=s.get(i);return n.call(this,o,c||i)}}_patchRemoveAllListeners(t,n){let r=this;return function(o){let i=r._getPatchMap(t);return i!==void 0&&(arguments.length===0?r._createPatchMap(t):o!==void 0&&i[o]!==void 0&&delete i[o]),n.apply(this,arguments)}}_patchAddListener(t,n,r){let o=this;return function(i,s){if(o._wrapped)return n.call(this,i,s);let c=o._getPatchMap(t);c===void 0&&(c=o._createPatchMap(t));let a=c[i];a===void 0&&(a=new WeakMap,c[i]=a);let l=o.bind(r,s);a.set(s,l),o._wrapped=!0;try{return n.call(this,i,l)}finally{o._wrapped=!1}}}_createPatchMap(t){let n=Object.create(null);return t[this._kOtListeners]=n,n}_getPatchMap(t){return t[this._kOtListeners]}};function BE(e){VM({getTracingChannelBinding:e?.skipOpenTelemetrySetup?c9():a9()})}function a9(){let e=new YM;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:jM})}function c9(){return()=>{try{let t=ce._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return t?{asyncLocalStorage:t,getStoreWithActiveSpan:jM}:void 0}catch{return}}}function jM(e){let t=ce.active();return Mr(e)&&Oe(e)!==e||e.spanContext().traceState?.get(ef)==="1"?t:de.setSpan(t,e)}var vp=sf;function HE(){Ee.disable(),Ee.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},rv.DEBUG)}var Op={};function fe(e,t,n){return n?p9(e,t,n):l9(e,t)}function l9(e,t){return Object.assign(n=>{let r=Op[e];if(r)return n&&r.setConfig(n),r;let o=t(n);return Op[e]=o,$a({instrumentations:[o]}),o},{id:e})}function p9(e,t,n){return Object.assign(r=>{let o=n(r),i=Op[e];if(i)return i.setConfig(o),i;let s=new t(o);return Op[e]=s,$a({instrumentations:[s]}),s},{id:e})}import*as FE from"diagnostics_channel";var u9="ChildProcess",af=(e={})=>({name:u9,setup(){FE.channel("child_process").subscribe(t=>{B(t)&&"process"in t&&d9(t.process,e)}),FE.channel("worker_threads").subscribe(t=>{B(t)&&"worker"in t&&m9(t.worker,e)})}});function d9(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",o=>{n||(n=!0,o!==null&&o!==0&&an({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,an({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function m9(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 f9}from"child_process";import{readFile as g9,readdir as _9}from"fs";import*as Nt from"os";import{join as h9}from"path";import{promisify as KM}from"util";var b9=KM(g9),y9=KM(_9),S9="Context",E9=((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?R9():void 0,r=t.device?v9(t.device):void 0,o=t.culture?N9():void 0,i=t.cloudResource?L9():void 0,s=t.os?A9():void 0,c={"process.runtime.engine.name":"v8","process.runtime.engine.version":process.versions.v8,...ZM({app:n,device:r,culture:o,cloud_resource:i})};s&&s.then(p=>Object.assign(c,ZM({os:p}))).catch(()=>{});let a=(async()=>{let p={};return s&&(p.os=await s),n&&(p.app=n),r&&(p.device=r),o&&(p.culture=o),i&&(p.cloud_resource=i),p})();async function l(p){let u=T9(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:S9,processEvent(p){return l(p)},processSegmentSpan(p){Bt(p,c),Bt(p,I9(n,r))}}}),cf=E9;function T9(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 ZM(e){let t={},{app:n,device:r,os:o,culture:i,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)),o&&(o.name&&(t["os.name"]=o.name),o.version&&(t["os.version"]=o.version),o.kernel_version&&(t["os.kernel_version"]=o.kernel_version),o.build&&(t["os.build"]=o.build)),i&&(i.locale&&(t["culture.locale"]=i.locale),i.timezone&&(t["culture.timezone"]=i.timezone)),s)for(let[c,a]of Object.entries(s))a!=null&&(t[c]=a);return t}function I9(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 A9(){let e=Nt.platform();switch(e){case"darwin":return P9();case"linux":return k9();default:return{name:O9[e]||e,version:Nt.release()}}}function N9(){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 R9(){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 v9(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(),o=r?.[0];o&&(t.processor_count=r.length,t.cpu_description=o.model,t.processor_frequency=o.speed)}return t}var O9={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},C9=[{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"]}],x9={alpine:e=>e,arch:e=>ro(/distrib_release=(.*)/,e),centos:e=>ro(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>ro(/release (..)/,e),mint:e=>ro(/distrib_release=(.*)/,e),red:e=>ro(/release ([^ ]+)/,e),suse:e=>ro(/VERSION = (.*)\n/,e),ubuntu:e=>ro(/distrib_release=(.*)/,e)};function ro(e,t){let n=e.exec(t);return n?n[1]:void 0}async function P9(){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)=>{f9("/usr/bin/sw_vers",(o,i)=>{if(o){r(o);return}n(i)})});e.name=ro(/^ProductName:\s+(.*)$/m,t),e.version=ro(/^ProductVersion:\s+(.*)$/m,t),e.build=ro(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function XM(e){return e.split(" ")[0].toLowerCase()}async function k9(){let e={kernel_version:Nt.release(),name:"Linux"};try{let t=await y9("/etc"),n=C9.find(c=>t.includes(c.name));if(!n)return e;let r=h9("/etc",n.name),o=(await b9(r,{encoding:"utf-8"})).toLowerCase(),{distros:i}=n;e.name=i.find(c=>o.indexOf(XM(c))>=0)||i[0];let s=XM(e.name);e.version=x9[s]?.(o)}catch{}return e}function L9(){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 M9}from"fs";import{createInterface as w9}from"readline";var G9=/\.(?:[cm]?[jt]sx?|vue|svelte|astro|mdx)$/,WE=new jt(10),$M=new jt(20),U9=7,D9="ContextLines",B9=1e3,H9=1e4;function F9(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function W9(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:!G9.test(t)}function V9(e){return e.lineno!==void 0&&e.lineno>H9||e.colno!==void 0&&e.colno>B9}function Y9(e,t){let n=WE.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 j9(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!="number")return[];let o=QM(r,t),i=[];for(;;){if(n===e.length-1){i.push(o);break}let s=e[n+1];if(typeof s!="number")break;s<=o[1]?o[1]=s+t:(i.push(o),o=QM(s,t)),n++}return i}function Z9(e,t,n){return new Promise((r,o)=>{let i=M9(e),s=w9({input:i});function c(){i.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(_){$M.set(e,1),Ve&&g.error(`Failed to read file: ${e}. Error: ${_}`),s.close(),s.removeAllListeners(),c()}i.on("error",m),s.on("error",m),s.on("close",c),s.on("line",_=>{if(a++,!(a<u)&&(n[a]=yh(_,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 X9(e,t){let n={};if(t>0&&e.exception?.values){for(let i of e.exception.values)if(i.stacktrace?.frames?.length)for(let s=i.stacktrace.frames.length-1;s>=0;s--){let c=i.stacktrace.frames[s],a=c?.filename;if(!c||typeof a!="string"||typeof c.lineno!="number"||W9(a)||V9(c))continue;n[a]||(n[a]=[]),n[a].push(c.lineno)}}let r=Object.keys(n);if(r.length==0)return e;let o=[];for(let i of r){if($M.get(i))continue;let s=n[i];if(!s)continue;s.sort((l,p)=>l-p);let c=j9(s,t);if(c.every(l=>Y9(i,l)))continue;let a=F9(WE,i,{});o.push(Z9(i,c,a))}if(await Promise.all(o).catch(()=>{Ve&&g.log("Failed to read one or more source files and resolve context lines")}),t>0&&e.exception?.values)for(let i of e.exception.values)i.stacktrace?.frames&&i.stacktrace.frames.length>0&&K9(i.stacktrace.frames,t,WE);return e}function K9(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let o=n.get(r.filename);if(o===void 0)continue;q9(r.lineno,r,t,o)}}function qM(e){delete e.pre_context,delete e.context_line,delete e.post_context}function q9(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 i=JM(e,n);i<e;i++){let s=r[i];if(s===void 0){qM(t),Ve&&g.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(s)}if(r[e]===void 0){qM(t),Ve&&g.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let o=zM(e,n);t.post_context=[];for(let i=e+1;i<=o;i++){let s=r[i];if(s===void 0)break;t.post_context.push(s)}}function JM(e,t){return Math.max(1,e-t)}function zM(e,t){return e+t}function QM(e,t){return[JM(e,t),zM(e,t)]}var Q9=((e={})=>({name:D9,processEvent(t,n,r){let o=e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??U9;return X9(t,o)}})),lf=Q9;import{Worker as $9}from"worker_threads";var pf;async function uc(){if(pf===void 0)try{pf=!!(await import("inspector")).url()}catch{pf=!1}return pf}function uf(e,t){return Na(e,t)}var Cp="__SENTRY_ERROR_LOCAL_VARIABLES__";function t1(e,t,n){let r=0,o=5,i=0;return setInterval(()=>{i===0?r>e&&(o*=2,n(o),o>86400&&(o=86400),i=o):(i-=1,i===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function e1(e){return e!==void 0&&(e.length===0||e==="?"||e==="<anonymous>")}function df(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||e1(e)&&e1(t)}var J9="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc4LjAgKDVmMjc3ZGUpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQu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5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function n1(...e){g.log("[LocalVariables]",...e)}var r1=((e={})=>{function t(i,s,c){if(c===!1)return;let a=(i.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||!df(d.function,u.function)||(d.vars=uf(u.vars,c))}}function n(i,s){if(s.originalException&&typeof s.originalException=="object"&&Cp in s.originalException&&Array.isArray(s.originalException[Cp])){let c=O()?.getDataCollectionOptions().stackFrameVariables??!0;for(let a of i.exception?.values||[])t(a,s.originalException[Cp],c);s.originalException[Cp]=void 0}return i}async function r(){let i=await import("inspector");i.url()||i.open(0)}function o(i){let s=new $9(new URL(`data:application/javascript;base64,${J9}`),{workerData:i,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{s.terminate()}),s.once("error",c=>{n1("Worker error",c)}),s.once("exit",c=>{n1("Worker exit",c)}),s.unref()}return{name:"LocalVariablesAsync",async setup(i){if(!i.getOptions().includeLocalVariables)return;if(await uc()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let c={...e,debug:g.isEnabled()};r().then(()=>{try{o(c)}catch(a){g.error("Failed to start worker",a)}},a=>{g.error("Failed to start inspector",a)})},processEvent(i,s){return n(i,s)}}});function o1(e){if(e!==void 0)return e.slice(-10).reduce((t,n)=>`${t},${n.function},${n.lineno},${n.colno}`,"")}function z9(e,t){if(t!==void 0)return o1(e(t,1))}function i1(e){let t=[],n=!1;function r(s){t=[],!n&&(n=!0,e(s))}t.push(r);function o(s){t.push(s)}function i(s){let c=t.pop()||r;try{c(s)}catch{r(s)}}return{add:o,next:i}}var VE=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:o,next:i}=i1(n);for(let s of r)if(s.value?.objectId&&s.value.className==="Array"){let c=s.value.objectId;o(a=>this._unrollArray(c,s.name,a,i))}else if(s.value?.objectId&&s.value.className==="Object"){let c=s.value.objectId;o(a=>this._unrollObject(c,s.name,a,i))}else s.value&&o(c=>this._unrollOther(s,c,i));i({})})}_getProperties(t,n){this._session.post("Runtime.getProperties",{objectId:t,ownProperties:!0},(r,o)=>{n(r?[]:o.result)})}_unrollArray(t,n,r,o){this._getProperties(t,i=>{r[n]=i.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),o(r)})}_unrollObject(t,n,r,o){this._getProperties(t,i=>{r[n]=i.map(s=>[s.name,s.value?.value]).reduce((s,[c,a])=>(s[c]=a,s),{}),o(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)}},eq="LocalVariables",tq=((e={},t)=>{let n=new jt(20),r,o=!1;function i(l,p){let u=o1(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||!df(v.function,b.function)||(v.vars=uf(b.vars,p))}}function s(l){for(let p of l.exception?.values||[])i(p,O()?.getDataCollectionOptions().stackFrameVariables??!0);return l}let c;async function a(){let p=O()?.getOptions();if(!p?.includeLocalVariables)return;if(rc<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await uc()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let d=await VE.create(t),m=(h,{params:{reason:b,data:v,callFrames:M}},N)=>{if(b!=="exception"&&b!=="promiseRejection"){N();return}r?.();let R=z9(h,v.description);if(R==null){N();return}let{add:P,next:Y}=i1(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=t1(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)})}o=!0}catch(d){g.log("The `LocalVariables` integration failed to start.",d)}}return{name:eq,setupOnce(){c=a()},async processEvent(l){return await c,o?s(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}}),s1=tq;var mf=(e={})=>rn.major<19?s1(e):r1(e);import{readFileSync as nq}from"fs";import{join as rq}from"path";var YE,oq="Modules";function iq(){return typeof __SENTRY_SERVER_MODULES__<"u"?__SENTRY_SERVER_MODULES__:te.__SENTRY_SERVER_MODULES__??{}}var sq=(()=>({name:oq,processEvent(e){return e.modules={...e.modules,...a1()},e},getModules:a1})),ff=sq;function aq(){return{...iq(),...lq()}}function a1(){return YE||(YE=aq()),YE}function cq(){try{let e=rq(process.cwd(),"package.json");return JSON.parse(nq(e,"utf8"))}catch{return{}}}function lq(){let e=cq();return{...e.dependencies,...e.devDependencies}}import{isMainThread as uq}from"worker_threads";var pq=2e3,c1=!1;function xp(e){if(c1)return;c1=!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:pq;t.close(r).then(o=>{o||Ve&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{Ve&&g.error(o),global.process.exit(1)})}var dq="OnUncaughtException",gf=(e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:dq,setup(n){uq&&global.process.on("uncaughtException",mq(n,t))}}};function mq(e,t){let r=!1,o=!1,i=!1,s,c=e.getOptions();return Object.assign(a=>{let l=xp;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&&(i?(Ve&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),xp(a)):o||(o=!0,setTimeout(()=>{i||(i=!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"}}),!i&&d&&(i=!0,l(a)))},{_errorHandler:!0})}var fq="OnUnhandledRejection",gq=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],_q=((e={})=>{let t={mode:e.mode??"warn",ignore:[...gq,...e.ignore??[]]};return{name:fq,setup(n){global.process.on("unhandledRejection",Sq(n,t))}}}),_f=_q;function hq(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 bq(e,t){let n=e.name===void 0||vr(t.name,e.name,!0),r=e.message===void 0||vr(t.message,e.message);return n&&r}function yq(e,t){let n=hq(t);return e.some(r=>bq(r,n))}function Sq(e,t){return function(r,o){if(O()!==e||yq(t.ignore??[],r))return;let i=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:i},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),Eq(r,t.mode)}}function Eq(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)}),xp(e))}var Tq="ProcessSession",hf=()=>({name:Tq,setupOnce(){Sl(),process.on("beforeExit",()=>{$().getSession()?.status==="ok"&&ns()})}});import*as l1 from"http";var jE="Spotlight",Iq=((e={})=>{let t={sidecarUrl:e.sidecarUrl||"http://localhost:8969/stream"};return{name:jE,setup(n){try{g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}Aq(n,t)}}}),bf=Iq;function Aq(e,t){let n=Nq(t.sidecarUrl);if(!n)return;let r=0;e.on("beforeEnvelope",o=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let i=al(o);Vn(()=>{let s=l1.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(i),s.end()})})}function Nq(e){try{return new URL(`${e}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var yf=(e={})=>({name:"Console",setup(t){process.env.LAMBDA_TASK_ROOT&&Qc("console",Rq),Ay({...e,filter:[...e.filter||[],"[DEP0205] DeprecationWarning"]}).setup?.(t)}});function Rq(){let e=te?.console;e&&nr.forEach(t=>{t in e&&vq(e,t)})}function vq(e,t){let n=e[t];tr[t]=n;let r=n,o,i=!1,s=function(...a){if(i){n.apply(e,a);return}i=!0;try{Vs("console",{args:a,level:t}),r.apply(e,a)}finally{i=!1}};Fi(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?(o!==void 0&&(r=o,o=void 0),a=s):l===c?(o=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){Vs("console",{args:l,level:t}),tr[t]?.apply(this,l)}})}}import*as ZE from"util";var Oq="NodeSystemError";function Cq(e){return!(e instanceof Error)||!("errno"in e)||typeof e.errno!="number"||typeof ZE.getSystemErrorMap!="function"?!1:ZE.getSystemErrorMap().has(e.errno)}var Sf=(e={})=>({name:Oq,processEvent:(t,n,r)=>{if(!Cq(n.originalException))return t;let o=n.originalException,i={...o};!r.getDataCollectionOptions().userInfo&&e.includePaths!==!0&&(delete i.path,delete i.dest),t.contexts={...t.contexts,node_system_error:i};for(let s of t.exception?.values||[])s.value&&(o.path&&s.value.includes(o.path)&&(s.value=s.value.replace(`'${o.path}'`,"").trim()),o.dest&&s.value.includes(o.dest)&&(s.value=s.value.replace(`'${o.dest}'`,"").trim()));return t}});import*as Pq from"http";import*as kq from"https";import{Readable as Lq}from"stream";import{createGzip as Mq}from"zlib";import*as Go from"net";import*as KE from"tls";import*as XE from"http";import"https";var p1,oo=Symbol("AgentBaseInternalState"),Ef=class extends(p1=XE.Agent,p1){constructor(t){super(t),this[oo]={}}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 o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(t,o)).then(i=>{if(i instanceof XE.Agent)return i.addRequest(t,o);this[oo].currentSocket=i,super.createSocket(t,n,r)},r)}createConnection(){let t=this[oo].currentSocket;if(this[oo].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[oo].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(t){this[oo]&&(this[oo].defaultPort=t)}get protocol(){return this[oo].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[oo]&&(this[oo].protocol=t)}};function Tf(...e){g.log("[https-proxy-agent:parse-proxy-response]",...e)}function u1(e){return new Promise((t,n)=>{let r=0,o=[];function i(){let p=e.read();p?l(p):e.once("readable",i)}function s(){e.removeListener("end",c),e.removeListener("error",a),e.removeListener("readable",i)}function c(){s(),Tf("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function a(p){s(),Tf("onerror %o",p),n(p)}function l(p){o.push(p),r+=p.length;let u=Buffer.concat(o,r),d=u.indexOf(`\r
27
- \r
28
- `);if(d===-1){Tf("have not received end of HTTP headers yet..."),i();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}Tf("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),i()})}function Pp(...e){g.log("[https-proxy-agent]",...e)}var kp=class extends Ef{constructor(t,n){super(n),this.options={},this.proxy=typeof t=="string"?new URL(t):t,this.proxyHeaders=n?.headers??{},Pp("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?d1(n,"headers"):null,host:r,port:o}}async connect(t,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let o;if(r.protocol==="https:"){Pp("Creating `tls.Socket`: %o",this.connectOpts);let d=this.connectOpts.servername||this.connectOpts.host;o=KE.connect({...this.connectOpts,servername:d&&Go.isIP(d)?void 0:d})}else Pp("Creating `net.Socket`: %o",this.connectOpts),o=Go.connect(this.connectOpts);let i=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},s=Go.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)}`;i["Proxy-Authorization"]=`Basic ${Buffer.from(d).toString("base64")}`}i.Host=`${s}:${n.port}`,i["Proxy-Connection"]||(i["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let d of Object.keys(i))c+=`${d}: ${i[d]}\r
31
- `;let a=u1(o);o.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",xq),n.secureEndpoint){Pp("Upgrading socket connection to TLS");let d=n.servername||n.host;return KE.connect({...d1(n,"host","path","port"),socket:o,servername:Go.isIP(d)?void 0:d})}return o}o.destroy();let u=new Go.Socket({writable:!1});return u.readable=!0,t.once("socket",d=>{Pp("Replaying proxy buffer for failed request"),d.push(p),d.push(null)}),u}};kp.protocols=["http","https"];function xq(e){e.resume()}function d1(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var wq=1024*32;function Gq(e){return new Lq({read(){this.push(e),this.push(null)}})}function If(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.")}),Ia(e,()=>Promise.resolve({}))}let n=t.protocol==="https:",r=Uq(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?kq:Pq,i=e.keepAlive===void 0?!1:e.keepAlive,s=r?new kp(r):new o.Agent({keepAlive:i,maxSockets:30,timeout:2e3}),c=Dq(e,e.httpModule??o,s);return Ia(e,c)}function Uq(e,t){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>e.host.endsWith(o)||e.hostname.endsWith(o)))return t}function Dq(e,t,n){let{hostname:r,pathname:o,port:i,protocol:s,search:c}=new URL(e.url);return function(l){return new Promise((p,u)=>{Vn(()=>{let d=Gq(l.body),m={...e.headers};l.body.length>wq&&(m["content-encoding"]="gzip",d=d.pipe(Mq()));let _=r.startsWith("["),h=t.request({method:"POST",agent:n,headers:m,hostname:_?r.slice(1,-1):r,path:`${o}${c}`,port:i,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 m1(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=rs(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 Bq,sep as Hq}from"path";function f1(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function Af(e=process.argv[1]?yy(process.argv[1]):process.cwd(),t=Hq==="\\"){let n=t?f1(e):e;return r=>{if(!r)return;let o=t?f1(r):r,{dir:i,base:s,ext:c}=Bq.parse(o);(c===".js"||c===".mjs"||c===".cjs")&&(s=s.slice(0,c.length*-1));let a=decodeURIComponent(s);i||(i=".");let l=i.lastIndexOf("/node_modules");if(l>-1)return`${i.slice(l+14).replace(/\//g,".")}:${a}`;if(i.startsWith(n)){let p=i.slice(n.length+1).replace(/\//g,".");return p?`${p}:${a}`:a}return a}}function Nf(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 Rf=Pu(_S(Af()));import*as g1 from"os";import{threadId as Fq,isMainThread as Wq}from"worker_threads";var Vq=6e4,dc=class extends tp{constructor(t){let n=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||g1.hostname(),r={...t,platform:"node",runtime:t.runtime||{name:"node",version:global.process.version},serverName:n};t.openTelemetryInstrumentations&&$a({instrumentations:t.openTelemetryInstrumentations}),os(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${Wq?"main":`worker-${Fq}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Sa(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener)),this._metricsOnExitFlushListener=()=>{Ea(this)},process.on("beforeExit",this._metricsOnExitFlushListener),lb(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??Vq).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){ny(),super._setupIntegrations()}_getTraceInfoFromScope(t){return t?UE(this,t):[void 0,void 0]}};var b1=Au(eE(),1);import*as y1 from"module";var _1;function h1(){return rc>=21||rc===20&&tE>=6||rc===18&&tE>=19?!0:(_1||(_1=!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 Lp(){if(h1()&&!te._sentryEsmLoaderHookRegistered){te._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,b1.createAddHookMessageChannel)();y1.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 vf(){return[Cl(),Ol(),xl(),Pl(),Sf(),vy(),yf(),OL(),ML(),gf(),_f(),lf(),mf(),cf(),af(),hf(),ff()]}function qE(e={}){return Yq(e,vf)}function Yq(e={},t){let n=jq(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&&Lp(),BE(n),ne().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:i})=>i===jE)&&n.integrations.push(bf({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),os(n,"node-core");let o=new dc(n);return ne().setClient(o),o.init(),g.log("SDK initialized from ESM"),o.startClientReportTracking(),Kq(),LE(o),DE(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function Of(){if(!Ve)return;let e=wE(),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 jq(e,t){let n=Zq(e.release),r=m1(e.spotlight),o=Xq(e.tracesSampleRate),i={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??If,stackParser:lh(e.stackParser||Rf),release:n,tracesSampleRate:o,spotlight:r,debug:rs(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,c=e.defaultIntegrations??t(i),a=Fb({defaultIntegrations:c,integrations:s});return{...i,integrations:a}}function Zq(e){if(e!==void 0)return e;let t=Nf();if(t!==void 0)return t}function Xq(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 Kq(){if(rs(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 S1=e=>{let t;return t=!1,{package:e,"javascript.is_cjs":t}};function yr(e,t){let n=O()?.getOptions();!n?.disableInstrumentationWarnings&&!(w(e)||typeof Rr(e)=="function")&&ts()&&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/.`)}),ji().setContext("missing_instrumentation",S1(t)))}import{types as qq}from"util";import{Worker as Qq}from"worker_threads";var{isPromise:$q}=qq,Jq="LyohIEBzZW50cnkvb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TXM6KCk9Pntjb25zdFtuLGVdPXByb2Nlc3MuaHJ0aW1lKHQpO3JldHVybiBNYXRoLmZsb29yKDFlMypuK2UvMWU2KX0scmVzZXQ6KCk9Pnt0PXByb2Nlc3MuaHJ0aW1lKCl9fX0sYW4ucG9sbEludGVydmFsLGFuLmFuclRocmVzaG9sZCxmdW5jdGlvbigpe2RuKCJXYXRjaGRvZyB0aW1lb3V0IiksU24/KGRuKCJQYXVzaW5nIGRlYnVnZ2VyIHRvIGNhcHR1cmUgc3RhY2sgdHJhY2UiKSxTbigpKTooZG4oIkNhcHR1cmluZyBldmVudCB3aXRob3V0IGEgc3RhY2sgdHJhY2UiKSxfbigpLnRoZW4obnVsbCwoKT0+e2RuKCJTZW5kaW5nIEFOUiBldmVudCBmYWlsZWQgb24gd2F0Y2hkb2cgdGltZW91dC4iKX0pKX0pO2U/Lm9uKCJtZXNzYWdlIix0PT57dC5zZXNzaW9uJiYoZm49SCh0LnNlc3Npb24pKSx0LmRlYnVnSW1hZ2VzJiYocG49dC5kZWJ1Z0ltYWdlcyksd24oKX0pOw==",zq=50,e4=5e3;function QE(e,...t){g.log(`[ANR] ${e}`,...t)}function t4(){return te}function n4(){let e=Cn($(),ne());return e.attachments=[],e.eventProcessors=[],e}async function r4(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 E1="Anr",o4=((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=t4();return r.__SENTRY_GET_SCOPES__=n4,{name:E1,startWorker:()=>{t||n&&(t=i4(n,e))},stopWorker:()=>{t&&t.then(o=>{o(),t=void 0})},async setup(o){n=o,e.captureStackTrace&&await uc()&&(g.warn("ANR captureStackTrace has been disabled because the debugger was already enabled"),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}),T1=o4;async function i4(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await r4(e);delete r.app?.app_memory,delete r.device?.free_memory;let o=e.getOptions(),i=e.getSdkMetadata()||{};i.sdk&&(i.sdk.integrations=o.integrations.map(l=>l.name));let s={debug:g.isEnabled(),dsn:n,tunnel:o.tunnel,environment:o.environment||"production",release:o.release,dist:o.dist,sdkMetadata:i,appRootPath:t.appRootPath,pollInterval:t.pollInterval||zq,anrThreshold:t.anrThreshold||e4,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 Qq(new URL(`data:application/javascript;base64,${Jq}`),{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:_l(o.stackParser)})}catch{}},s.pollInterval);return a.unref(),c.on("message",l=>{l==="session-ended"&&(QE("ANR event sent from ANR worker. Clearing session in this thread."),$().setSession(void 0))}),c.once("error",l=>{clearInterval(a),QE("ANR worker error",l)}),c.once("exit",l=>{clearInterval(a),QE("ANR worker exit",l)}),c.unref(),()=>{c.terminate(),clearInterval(a)}}function I1(e){let t=O()?.getIntegrationByName(E1);if(!t)return e();t.stopWorker();let n=e();return $q(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}var $E={};$R($E,{debug:()=>c4,error:()=>u4,fatal:()=>d4,fmt:()=>sy,info:()=>l4,trace:()=>a4,warn:()=>p4});import{format as s4}from"util";function Uo(e,...t){let[n,r,o,i]=t;if(Array.isArray(r)){let s={...o};s["sentry.message.template"]=n,r.forEach((a,l)=>{s[`sentry.message.parameter.${l}`]=a});let c=s4(n,...r);dr({level:e,message:c,attributes:s},i?.scope)}else dr({level:e,message:n,attributes:r},o?.scope??i?.scope)}function a4(...e){Uo("trace",...e)}function c4(...e){Uo("debug",...e)}function l4(...e){Uo("info",...e)}function p4(...e){Uo("warn",...e)}function u4(...e){Uo("error",...e)}function d4(...e){Uo("fatal",...e)}import{monitorEventLoopDelay as m4,performance as JE}from"perf_hooks";var A1="NodeRuntimeMetrics",N1=3e4,Cf=1e3,R1=10;function zE(e,t,n){return Number.isFinite(e)?e<Cf?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${Cf}ms. Using minimum of ${Cf}ms.`),Cf):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var v1=(e={})=>{let t=zE(e.collectionIntervalMs??N1,A1,N1),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,o=n.cpuUtilization||n.cpuTime,i,s,c,a=0,l,p=R1*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(o&&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=JE.eventLoopUtilization(),N=JE.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:A1,setup(){if(r){l?.disable();try{l=m4({resolution:R1}),l.enable()}catch{l=void 0}}o&&(s=process.cpuUsage()),n.eventLoopUtilization&&(c=JE.eventLoopUtilization()),a=rt(),i&&clearInterval(i),i=Pn(setInterval(h,t))}}};var f4=["trace","debug","info","warn","error","fatal"],O1=Symbol.for("level"),g4=Symbol.for("message"),_4=Symbol.for("splat");function C1(e,t){class n extends e{constructor(o){super(o),this._levels=new Set(t?.levels??f4)}log(o,i){try{if(setImmediate(()=>{this.emit("logged",o)}),!B(o))return;let s=o[O1],{level:c,message:a,timestamp:l,...p}=o;p[O1]=void 0,p[g4]=void 0,p[_4]=void 0;let u=t?.customLevelMap?.[s],d=h4[s],m=u??d??"info";this._levels.has(m)?Uo(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{}i&&i()}}return n}var h4={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 k1 from"diagnostics_channel";var eT=Symbol("sentry-track-pino-logger");function x1(e,t,n){let r=Object.getOwnPropertySymbols(e),o=`Symbol(${t})`;for(let i of r)if(i.toString()===o){let s=e[i];return typeof s=="string"?s:n}return n}var P1={error:{levels:[],handled:!0},log:{levels:["trace","debug","info","warn","error","fatal"]}};function b4(e){let{level:t,time:n,pid:r,hostname:o,...i}=e;return i}var y4=(e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{...P1.error,...e.error},log:{...P1.log,...e.log}};function n(r){let o=r[eT];return o==="track"||o!=="ignore"&&t.autoInstrument}return{name:"Pino",setup:r=>{let o=!!r.getOptions().enableLogs,i=k1.tracingChannel("pino_asJson");function s(c,a,l){if(!n(c))return;let p=b4(l),[u,d,m]=a,_=c?.levels?.labels?.[m]||"info",h=x1(c,"pino.messageKey","msg"),b=d||p?.[h]||"";if(o&&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=x1(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:ii(_),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}bl(b,N)})}}i.end.subscribe(c=>{let{instance:a,arguments:l,result:p}=c;s(a,l,JSON.parse(p))})}}},L1=Object.assign(y4,{trackLogger(e){B(e)&&"levels"in e&&(e[eT]="track")},untrackLogger(e){B(e)&&"levels"in e&&(e[eT]="ignore")}});function tT(e,t){e.setAttribute(S,t)}var S4=[["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 Is(e){return S4.reduce((t,[n,r])=>t.replace(new RegExp(n,"gi"),r),e)}var M1="Automatic instrumentation of CronJob only supports crontab string";function w1(e,t){let n=!1;return new Proxy(e,{construct(r,o){let[i,s,c,a,l,...p]=o;if(typeof i!="string")throw new Error(M1);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let u=Is(i);async function d(m,_){return Fr(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(i,d,c,a,l,...p)},get(r,o){return o==="from"?i=>{let{cronTime:s,onTick:c,timeZone:a}=i;if(typeof s!="string")throw new Error(M1);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let l=Is(s);return i.onTick=async(p,u)=>Fr(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(i)}:r[o]}})}function G1(e,t={}){return new Proxy(e,{get(n,r){return r==="schedule"&&n.schedule?new Proxy(n.schedule,{apply(o,i,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)=>Fr(p,async()=>{try{return await a(...m)}catch(_){throw ge(_,{mechanism:{handled:!1,type:"auto.function.node-cron.instrumentNodeCron"}}),_}},{schedule:{type:"crontab",value:Is(c)},timezone:u,...t});return o.apply(i,[c,d,l])}}):n[r]}})}function U1(e){return new Proxy(e,{get(t,n){return n==="scheduleJob"?new Proxy(t.scheduleJob,{apply(r,o,i){let[s,c,a]=i;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 Fr(l,async()=>{await a?.()},{schedule:{type:"crontab",value:Is(p)}})}return r.apply(o,[l,p,u])}}):t[n]}})}var D1={instrumentCron:w1,instrumentNodeCron:G1,instrumentNodeSchedule:U1};var B1="Http",H1=Object.assign(fs,{id:`${B1}.sentry`}),nT=(e={})=>{let t=e.spans??!0,n=e.disableIncomingRequestSpans,r=t&&!n,o={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},i={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},s=Ka(o),c=qa(i);return{name:B1,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=Rl(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};fs(a)},processEvent(a){return c.processEvent(a)}}};var E4=((e={})=>({name:"NodeFetch",setupOnce(){let t=O()?.getOptions();_p({...e,spans:T4(e,t)})}})),rT=E4;function T4(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&De(t))}import*as Pf from"fs";import{promisify as A4}from"util";var F1=["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"],W1=["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"],V1=["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 I4(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 oT(e,t){if(!t)throw new Error(JSON.stringify({member:t}));let n=I4(t),[r,o]=n;return o?{objectToPatch:e[r],functionNameToPatch:o}:{objectToPatch:e,functionNameToPatch:r}}var N4="auto.file.fs",R4="file",v4=["rename","renameSync"],O4=["copyFile","cp","copyFileSync","cpSync"],C4=["link","linkSync"],x4=["mkdtemp","mkdtempSync"],P4=["symlink","symlinkSync"],k4=["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 kf(e,t,n){let r={[H]:R4,[S]:N4};return n.recordFilePaths&&(typeof t[0]=="string"&&k4.includes(e)?r.path_argument=t[0]:typeof t[0]=="string"&&typeof t[1]=="string"?P4.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):C4.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):O4.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):v4.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]=="string"&&x4.includes(e)&&(r.prefix_argument=t[0])),r}function Lf(e,t){return Object.assign(e,t)}var Y1=new WeakMap;function xf(e,t,n){let r=e[t];if(typeof r!="function")return;let o=Y1.get(e);o||(o=new Set,Y1.set(e,o)),!o.has(t)&&(o.add(t),e[t]=n(r))}function L4(e,t,n){return Lf(function(...o){let i=kf(e,o,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:i},s=>{try{return Vn(()=>t.apply(this,o))}catch(c){throw Mp(s,c,n),c}})},t)}function M4(e,t,n){return Lf(function(...o){let i=o.length-1,s=o[i];if(typeof s!="function")return t.apply(this,o);let c=kf(e,o,n),a=L({name:`fs.${e}`,onlyIfParent:!0,attributes:c}),l=Q();o[i]=function(...p){let u=p[0];return u&&Mp(a,u,n),a.end(),l?se(l,()=>s.apply(this,p)):s.apply(this,p)};try{return Vn(()=>t.apply(this,o))}catch(p){throw Mp(a,p,n),a.end(),p}},t)}function w4(e,t){let n="exists",o=Lf(function(...s){let c=s.length-1,a=s[c];if(typeof a!="function")return e.apply(this,s);let l=kf(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 Mp(p,d,t),p.end(),d}},e),i=function(s){return new Promise(c=>o(s,c))};return Object.defineProperty(i,"name",{value:n}),Object.defineProperty(o,A4.custom,{value:i}),o}function G4(e,t,n){return Lf(async function(...o){let i=kf(e,o,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:i},async s=>{try{return await Vn(()=>t.apply(this,o))}catch(c){throw Mp(s,c,n),c}})},t)}function j1(e={}){for(let n of V1){let{objectToPatch:r,functionNameToPatch:o}=oT(Pf,n);xf(r,o,i=>L4(n,i,e))}for(let n of W1){let{objectToPatch:r,functionNameToPatch:o}=oT(Pf,n);n==="exists"?xf(r,o,i=>w4(i,e)):xf(r,o,i=>M4(n,i,e))}let t=Pf.promises;for(let n of F1)xf(t,n,r=>G4(n,r,e))}function Mp(e,t,n){e.setStatus({code:2,message:"internal_error"}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute("fs_error",t.message)}var U4="FileSystem",D4=(e={})=>({name:U4,setupOnce(){j1(e)}});var je=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function io(e){let t=Q();if(!t)return;let n=Oe(t);n&&ie(n).data[H]==="http.server"&&n.setAttribute("http.route",e)}var Z1="Express",B4=[">=4.0.0 <6"];function H4(e,t){SS(e,t),yr(e.use,"express")}var sT=fe(Z1,e=>new iT(e)),iT=class extends le{constructor(t={}){super("sentry-express",q,t)}init(){return new re("express",B4,n=>{try{bS(n,()=>({...this.getConfig(),onRouteResolved(r){r&&io(r)}}))}catch(r){je&&g.error("Failed to patch express module:",r)}return n},n=>n)}},F4=(e=>({name:Z1,setupOnce(){sT(e)},getShouldHandleError(){return e?.shouldHandleError}})),aT=F4;var Si=(e=>(e.FASTIFY_NAME="fastify.name",e.FASTIFY_TYPE="fastify.type",e.HOOK_NAME="hook.name",e.PLUGIN_NAME="plugin.name",e))(Si||{}),Mf=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(Mf||{}),wf=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request handler",e))(wf||{});var wp=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function cT(e,t,n,r={}){let o=t.startSpan(n,{attributes:r}),i=e[wp]||[];return i.push(o),Object.defineProperty(e,wp,{enumerable:!1,configurable:!0,value:i}),o}function Gf(e,t){let n=e[wp]||[];n.length&&(n.forEach(r=>{t&&(r.setStatus({code:Lt.ERROR,message:t.message}),r.recordException(t)),r.end()}),delete e[wp])}function K1(e,t,n){let r,o;try{o=e(),X1(o)&&o.then(i=>t(void 0,i),i=>t(i))}catch(i){r=i}finally{if(!X1(o)&&(t(r,o),r))throw r;return o}}function X1(e){return typeof e=="object"&&e&&typeof Object.getOwnPropertyDescriptor(e,"then")?.value=="function"||!1}var W4="@sentry/instrumentation-fastify-v3",q1="anonymous",V4=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),Uf=class extends le{constructor(t={}){super(W4,q,t)}init(){return[new re("fastify",[">=3.0.0 <3.21.0"],t=>this._patchConstructor(t))]}_hookOnRequest(){let t=this;return function(r,o,i){if(!t.isEnabled())return i();t._wrap(o,"send",t._patchSend());let s=r,c=s.routeOptions?s.routeOptions.url:r.routerPath;c&&io(c);let a=r.method||"GET";$().setTransactionName(`${a} ${c}`),i()}}_wrapHandler(t,n,r,o){let i=this;return this._diag.debug("Patching fastify route.handler function"),function(...s){if(!i.isEnabled())return r.apply(this,s);let c=r.name||t||q1,a=`${wf.MIDDLEWARE} - ${c}`,l=s[1],p=cT(l,i.tracer,a,{[Si.FASTIFY_TYPE]:Mf.MIDDLEWARE,[Si.PLUGIN_NAME]:t,[Si.HOOK_NAME]:n}),u=o&&s[s.length-1];return u&&(s[s.length-1]=function(...d){Gf(l),u.apply(this,d)}),ce.with(de.setSpan(ce.active(),p),()=>K1(()=>r.apply(this,s),d=>{d instanceof Error&&(p.setStatus({code:Lt.ERROR,message:d.message}),p.recordException(d)),o||Gf(l)}))}}_wrapAddHook(){let t=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let i=o[0],s=o[1],c=this.pluginName;if(!V4.has(i))return n.apply(this,o);let a=typeof o[o.length-1]=="function"&&s.constructor.name!=="AsyncFunction";return n.apply(this,[i,t._wrapHandler(c,i,s,a)])}}}_patchConstructor(t){let n=this;function r(...o){let i=t.fastify.apply(this,o);return i.addHook("onRequest",n._hookOnRequest()),i.addHook("preHandler",n._hookPreHandler()),Y4(),n._wrap(i,"addHook",n._wrapAddHook()),i}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(...i){let s=i[0];return t.isEnabled()?zr(()=>r.apply(this,i),c=>{!c&&s instanceof Error&&(c=s),Gf(this,c)}):r.apply(this,i)}}}_hookPreHandler(){let t=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,i){if(!t.isEnabled())return i();let s=r,c=s.routeOptions?.handler||s.context?.handler,a=c?.name.startsWith("bound ")?c.name.substring(6):c?.name,l=`${wf.REQUEST_HANDLER} - ${a||this.pluginName||q1}`,p={[Si.PLUGIN_NAME]:this.pluginName,[Si.FASTIFY_TYPE]:Mf.REQUEST_HANDLER,[Fe]:s.routeOptions?s.routeOptions.url:r.routerPath};a&&(p[Si.FASTIFY_NAME]=a);let u=cT(o,t.tracer,l,p);Q1(u);let{requestHook:d}=t.getConfig();return d&&zr(()=>d(u,{request:r}),m=>{m&&t._diag.error("request hook failed",m)},!0),ce.with(de.setSpan(ce.active(),u),()=>{i()})}}};function Y4(){let e=O();e&&e.on("spanStart",t=>{Q1(t)})}function Q1(e){let t=ie(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 o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(o)}}import*as dT from"diagnostics_channel";var $1="execute_tool";var J1="invoke_agent";var Do="graphql";var J=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var pT=()=>{};function ee(e,t,n){let r=j4(e,t,n),o=n?.beforeSpanEnd,i=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}=Z4(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),lT(u,o))}},l={start:pT,asyncStart:pT,end(p){if("error"in p||"result"in p){let u=p._sentrySpan;if(u&&i?.({span:u,data:p,end:a(u,p)}))return;lT(p,o)}},error(p){let u=p._sentrySpan;u&&c(u,p.error)},asyncEnd(p){let u=p._sentrySpan;u&&i?.({span:u,data:p,end:a(u,p)})||lT(p,o)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function j4(e,t,n){let r=St(Je()).getTracingChannelBinding?.();if(!r)return J&&g.log("[TracingChannel] Could not access async context binding."),{channel:e,unbind:pT};let o=r.asyncLocalStorage;return e.start.bindStore(o,i=>{i._sentryCallerStore=o.getStore();let c=!n?.requiresParentSpan||Q()?t(i):void 0;return c?(i._sentrySpan=c,r.getStoreWithActiveSpan(c)):i._sentryCallerStore}),e.asyncStart.bindStore(o,i=>i._sentryCallerStore),{channel:e,unbind:()=>{e.start.unbindStore(o),e.asyncStart.unbindStore(o)}}}function lT(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function Z4(e){let t=B(e),n=t?"message"in e?e.message:void 0:e,r=n?String(n):void 0,o=t&&"name"in e?String(e.name):"unknown";return{message:r,attributes:{[Gr]:o}}}var uT="original-description",X4=new Set(["Int","Float","String","BlockString"]);function Df(e,t,n){let r=Oe(e);if(r===e)return;let o=ie(r),i=n?`${t} ${n}`:t,s=o.data[Tb],c;Array.isArray(s)?c=[...s,i]:typeof s=="string"?c=[s,i]:c=i,r.setAttribute(Tb,c);let a=o.data[uT]??o.description;o.data[uT]||r.setAttribute(uT,a),r.updateName(`${a} (${K4(c)})`)}function K4(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 Bf(e,t,n){return e&&t?`${e} ${t}`:e||n}function Hf(e){if(B(e)&&"errors"in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function q4(e){let t=e?.loc,n=t?.source?.body;if(!(typeof n!="string"||!t?.startToken))try{let r=[];for(let i=t.startToken;i;i=i.next)X4.has(i.kind)&&r.push({start:i.start,end:i.end,kind:i.kind});let o=n;for(let i=r.length-1;i>=0;i--){let{start:s,end:c,kind:a}=r[i],l=a==="String"||a==="BlockString"?'"*"':"*";o=o.slice(0,s)+l+o.slice(c)}return o}catch{return}}function mc(e){if(O()?.getDataCollectionOptions().graphQL.document===!0)return q4(e)}var Q4="graphql:parse",$4="graphql:validate",J4="graphql:execute",z4="graphql:subscribe",eQ="graphql:resolve",Ff="auto.graphql.diagnostic_channel",tQ="graphql.parse",nQ="graphql.validate",rQ="graphql.execute",oQ="graphql.subscribe",iQ="graphql.resolve",sQ="graphql.field.name",aQ="graphql.field.path",cQ="graphql.field.type",lQ="graphql.parent.name";function ew(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,o=t.useOperationNameForRootSpan!==!1;pQ(e),uQ(e),z1(e,J4,rQ,o),z1(e,z4,oQ,o),n||dQ(e,r)}function pQ(e){ee(e(Q4),()=>L({name:tQ,attributes:{[S]:Ff,[H]:Do}}))}function uQ(e){ee(e($4),t=>L({name:nQ,attributes:{[S]:Ff,[H]:Do,[ma]:mc(t.document)}}),{beforeSpanEnd:(t,n)=>{Array.isArray(n.result)&&n.result.length>0&&t.setStatus({code:2,message:"invalid_argument"})}})}function z1(e,t,n,r){ee(e(t),o=>{let i=L({name:Bf(o.operationType,o.operationName,n),attributes:{[S]:Ff,[H]:Do,[od]:o.operationType,[rd]:o.operationName||void 0,[ma]:mc(o.document)}});return r&&o.operationType&&Df(i,o.operationType,o.operationName),i},{beforeSpanEnd:(o,i)=>{Hf(i.result)&&o.setStatus({code:2,message:"internal_error"})}})}function dQ(e,t){ee(e(eQ),n=>{if(!(t&&n.isDefaultResolver))return L({name:`${iQ} ${n.fieldPath}`,attributes:{[S]:Ff,[H]:Do,[sQ]:n.fieldName,[aQ]:n.fieldPath,[cQ]:n.fieldType,[lQ]:n.parentType}})})}var mQ=((e={})=>({name:"Graphql",setupOnce(){dT.tracingChannel&&me(()=>{ew(dT.tracingChannel,e)})}})),Gp=mQ;import*as fT from"diagnostics_channel";var fQ="mongoose:query",gQ="mongoose:aggregate",_Q="mongoose:model:save",hQ="mongoose:model:insertMany",bQ="mongoose:model:bulkWrite",yQ="mongoose:cursor:next",SQ="auto.db.mongoose.diagnostic_channel",EQ="mongodb",TQ=10,tw=!1;function Wf(e){if(!tw){tw=!0;try{fc(e,fQ),fc(e,gQ),fc(e,_Q),fc(e,hQ),fc(e,bQ),fc(e,yQ)}catch{J&&g.log("Mongoose node:diagnostics_channel subscription failed.")}}}function fc(e,t){ee(e(t),n=>{let r=n.collection,o=AQ(n.args?.pipeline??n.args?.filter),i=IQ(n);return L({name:r?`mongoose.${r}.${n.operation}`:`mongoose.${n.operation}`,attributes:{[S]:SQ,[H]:"db",[dt]:EQ,[pr]:n.operation,[pa]:r??void 0,[Io]:n.database??void 0,[wr]:o??void 0,[da]:i??void 0,[_t]:n.serverAddress??void 0,[ht]:n.serverPort??void 0}})})}function IQ(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 AQ(e){if(e!=null)try{let t=mT(e,0),n=JSON.stringify(t);return n==null||n==="{}"||n==="[]"?void 0:n}catch{return}}function mT(e,t){if(t>TQ)return"?";if(Array.isArray(e))return e.map(n=>mT(n,t+1));if(B(e)){let n={};for(let r of Object.keys(e))n[r]=mT(e[r],t+1);return n}return"?"}var NQ=(()=>({name:"Mongoose",setupOnce(){fT.tracingChannel&&me(()=>{Wf(fT.tracingChannel)})}})),gT=NQ;var RQ="db.system",vQ="db.name",nw="db.operation",OQ="db.statement",CQ="db.mongodb.collection",xQ="db.connection_string",PQ="net.peer.name",kQ="net.peer.port",LQ="mongodb";function MQ(e){return JSON.stringify(_T(e))}function _T(e){if(Array.isArray(e))return e.map(t=>_T(t));if(wQ(e)){let t={};return Object.entries(e).map(([n,r])=>[n,_T(r)]).reduce((n,r)=>(UQ(r)&&(n[r[0]]=r[1]),n),t)}return"?"}function wQ(e){return B(e)&&!GQ(e)}function GQ(e){return typeof Buffer<"u"&&Buffer.isBuffer(e)}function UQ(e){return Array.isArray(e)}function Up(e,t,n,r,o){let i,s;if(e){let a=typeof e.address=="string"?e.address.split(":"):"";a.length===2&&(i=a[0],s=a[1])}let c;return n?.documents?.[0]?c=n.documents[0]:n?.cursors?c=n.cursors:c=n,rw(t.db,t.collection,i,s,c,r,o)}function rw(e,t,n,r,o,i,s){let c={[S]:s,[RQ]:LQ,[vQ]:e,[CQ]:t,[nw]:i,[xQ]:`mongodb://${n}:${r}/${e}`};if(n&&r){c[PQ]=n;let a=parseInt(r,10);isNaN(a)||(c[kQ]=a)}if(o)try{c[OQ]=MQ(o)}catch{}return c}function Dp(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 Bp(e,t,n,r,o){let i,s;if(t?.s&&(i=t.s.options?.host??t.s.host,s=(t.s.options?.port??t.s.port)?.toString(),i==null||s==null)){let p=t.description?.address;if(p){let u=p.split(":");i=u[0],s=u[1]}}let[c,a]=e.toString().split("."),l=n?.query??n?.q??n;return rw(c,a,i,s,l,r,o)}function Sr(e){return L({name:`mongodb.${e[nw]||"command"}`,op:"db",kind:D.CLIENT,attributes:e})}import*as hT from"diagnostics_channel";var DQ="mysql2:query",BQ="mysql2:execute",HQ="mysql2:connect",FQ="mysql2:pool:connect",sw="auto.db.mysql2.diagnostic_channel",aw="mysql",WQ=/^\s*(\w+)/;function Vf(e){ow(e,DQ),ow(e,BQ),iw(e,HQ,"mysql2.connect"),iw(e,FQ,"mysql2.pool.connect")}function ow(e,t){ee(e(t),n=>{let r=n.query?Za(n.query):void 0,o=r?.match(WQ)?.[1]?.toUpperCase();return L({name:r||"mysql2.query",attributes:{[S]:sw,[H]:"db",[dt]:aw,[wr]:r,[pr]:o,[Io]:n.database||void 0,[_t]:n.serverAddress,[ht]:n.serverPort}})},{requiresParentSpan:!0})}function iw(e,t,n){ee(e(t),r=>L({name:n,attributes:{[S]:sw,[H]:"db",[dt]:aw,[Io]:r.database||void 0,[_t]:r.serverAddress,[ht]:r.serverPort}}),{requiresParentSpan:!0})}var VQ=(()=>({name:"Mysql2",setupOnce(){hT.tracingChannel&&me(()=>{Vf(hT.tracingChannel)})}})),bT=VQ;var YQ="PRISMA_INSTRUMENTATION",jQ="V7_PRISMA_INSTRUMENTATION",cw=globalThis;function lw(e){let t={helper:e};cw[jQ]=t,cw[YQ]=t}var ZQ=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES==="true"}catch{return!1}})(),XQ="00-10-10-00",KQ="auto.db.otel.prisma",uw=1e3,yT=new jt(uw),gc=[];function ST(e,t){yT.set(e,t)}function ET(e,t){let n={...t,[S]:KQ};return e==="prisma:engine:db_query"&&n[ke]==null&&(n[ke]="prisma"),n}function TT(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 qQ(){let e=!0;for(;e;){e=!1;for(let t=gc.length-1;t>=0;t--){let n=gc[t],r=yT.get(n.parent_span_id);if(!r)continue;let o=ET(n.name,n.attributes),i=L({name:TT(n.name,o),attributes:o,kind:n.kind==="client"?D.CLIENT:D.INTERNAL,startTime:n.start_time,parentSpan:r});ST(n.span_id,i),n.links&&i.addLinks(n.links.flatMap(s=>{let c=yT.get(s.span_id);return c?[{context:c.spanContext()}]:[]})),i.end(n.end_time),gc.splice(t,1),e=!0}}}var Yf=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}`:XQ}dispatchEngineSpans(t){let n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)dw(o,t,n,this.ignoreSpanTypes)}createEngineSpan(t){gc.push(...t.spans),qQ();let n=gc.length-uw;n>0&&(J&&g.log(`[Prisma] Dropping ${n} unresolved v5 engine span(s) whose parent was never registered.`),gc.splice(0,n))}getActiveContext(){return Q()}runInChildSpan(t,n){let r=typeof t=="string"?{name:t}:t;if(r.internal&&!ZQ)return n();let o=`prisma:client:${r.name}`;if(mw(o,this.ignoreSpanTypes))return n();let i=Q(),s=ET(o,r.attributes),c={name:TT(o,s),attributes:s,kind:r.kind,links:r.links,startTime:r.startTime,parentSpan:i};if(r.active===!1){let a=L(c);return ST(a.spanContext().spanId,a),pw(a,()=>n(a,i))}return Le(c,a=>(ST(a.spanContext().spanId,a),pw(a,()=>n(a,i))))}};function dw(e,t,n,r){if(mw(e.name,r))return;let o=ET(e.name,e.attributes);Le({name:TT(e.name,o),attributes:o,kind:e.kind==="client"?D.CLIENT:D.INTERNAL,startTime:e.startTime},i=>{n.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let a=n.get(c);return a?{context:{spanId:a,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let s=t.filter(c=>c.parentId===e.id);for(let c of s)dw(c,t,n,r);i.end(e.endTime)})}function pw(e,t){let n;try{n=t()}catch(r){throw e.end(),r}return QQ(n)?n.then(r=>(e.end(),r),r=>{throw e.end(),r}):(e.end(),n)}function QQ(e){return e!=null&&typeof e.then=="function"}function mw(e,t){return t.some(n=>typeof n=="string"?n===e:n.test(e))}var $Q="Prisma";function fw(e){lw(new Yf({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var JQ=(e=>({name:$Q,setupOnce(){fw(e)}})),jf=JQ;import*as NT from"diagnostics_channel";var zQ="node-redis:command",e$="node-redis:batch",t$="node-redis:connect",n$="ioredis:command",r$="ioredis:connect",IT="auto.db.redis.diagnostic_channel",AT="redis";function hw(e,t){gw(e,zQ,n=>n.args.slice(1),t),o$(e,e$,n=>n.batchMode==="PIPELINE"?"PIPELINE":"MULTI"),_w(e,t$),gw(e,n$,n=>n.args,t),_w(e,r$)}function gw(e,t,n,r){ee(e(t),o=>{let i=n(o),s=i.length?`${o.command} ${i.join(" ")}`:o.command;return L({name:`redis-${o.command}`,attributes:{[S]:IT,[H]:"db.redis",[dt]:AT,[wr]:s,...o.serverAddress!=null?{[_t]:o.serverAddress}:{},...o.serverPort!=null?{[ht]:o.serverPort}:{}}})},{beforeSpanEnd(o,i){"error"in i||i$(r,o,i.command,n(i),i.result)}})}function o$(e,t,n){ee(e(t),r=>L({name:n(r),attributes:{[S]:IT,[H]:"db.redis",[dt]:AT,...Number(r.batchSize)>1?{[da]:r.batchSize}:{},...r.serverAddress!=null?{[_t]:r.serverAddress}:{},...r.serverPort!=null?{[ht]:r.serverPort}:{}}}))}function _w(e,t){ee(e(t),n=>L({name:"redis-connect",attributes:{[S]:IT,[H]:"db.redis.connect",[dt]:AT,...n.serverAddress!=null?{[_t]:n.serverAddress}:{},...n.serverPort!=null?{[ht]:n.serverPort}:{}}}))}function i$(e,t,n,r,o){if(e)try{e(t,n,r,o)}catch{}}var s$=((e={})=>({name:"Redis",setupOnce(){NT.tracingChannel&&me(()=>{hw(NT.tracingChannel,e.responseHook)})}})),RT=s$;var a$=[{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}],so=(e,t)=>{if(Array.isArray(t)&&t.length){let n=a$.find(({regex:o})=>o.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 Zf(e){return typeof e=="number"&&!isNaN(e)?e:void 0}function vT(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function Xf(e){return B(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"}function Kf(e,t,n){let r=e.getReader(),o={toolCalls:[]},i="",s=!1,c=()=>{s||(s=!0,i&&(o.text=i),t(o))},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}i+=c$(o,u)??"",l.enqueue(u)}catch(p){a(p),l.error(p)}},cancel(l){return c(),r.cancel(l)}})}function c$(e,t){if(!B(t))return;let{type:n,delta:r,textDelta:o,id:i,modelId:s,toolCallId:c,toolName:a,input:l,args:p,finishReason:u,usage:d,providerMetadata:m}=t;switch(n){case"text-delta":{let _=r??o;return typeof _=="string"?_:void 0}case"tool-call":e.toolCalls.push({toolCallId:c,toolName:a,input:l??p});return;case"response-metadata":typeof i=="string"&&(e.responseId=i),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 l$="ai:telemetry",yw="auto.vercelai.channel",p$="gen_ai.tool.call.id",u$="gen_ai.tool.description",d$="embeddings",m$="rerank",f$="generate_content",g$="WorkersAI",Sw="vercel.ai.operationId",_$="vercel.ai.model.provider",h$="vercel.ai.settings.maxRetries",CT=new Map,qf=new Map,xT=new Map,Ew=new Set(["generateText","streamText","generateObject","embed","embedMany","rerank"]);function PT(e){if(!Ew.has(e.type))return;let t=We(e.event.callId);t&&kT(t)}function kT(e){CT.delete(e),qf.delete(e),xT.delete(e)}function b$(e,t){if(Ew.has(t))for(let n of Vd)delete e[n]}function y$(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 S$(e,t,n){let r=e?qf.get(e)?.get(t):void 0;if(r)return r;if(Array.isArray(n)){let o=n.find(i=>B(i)&&i.name===t);return B(o)?We(o.description):void 0}if(B(n)){let o=n[t];return B(o)?We(o.description):void 0}}function Tw(e,t={}){ee(e(l$),n=>Fp(n,t),{beforeSpanEnd:(n,r)=>{_c(n,r,t),PT(r)},deferSpanEnd:({data:n,end:r})=>E$(n,t,r)})}function E$(e,t,n){if(e.type!=="languageModelCall"||!B(e.result))return!1;let r=e.result,o=r.stream;if(!Xf(o))return!1;let i=We(e.event.callId),{recordOutputs:s}=wT(e.event,t);return r.stream=Kf(o,c=>{e.result={...r,...LT(c)},n(),T$(i,c,s)},c=>n(c)),!0}function LT(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 T$(e,t,n){let r=e?xT.get(e):void 0;if(!r)return;let o=B(t.usage)?t.usage:void 0;if(o){let i=Kn(o.inputTokens)??Kn(o.promptTokens)??Kn(o.tokens),s=Kn(o.outputTokens)??Kn(o.completionTokens);OT(r,en,i),OT(r,Tt,s),OT(r,yb,Kn(o.totalTokens)??vT(i,s))}if(n){let i=Rw(t.text,t.toolCalls),s=Aw(i,Iw({finishReason:t.finishReason}));s&&r.setAttribute(bb,s)}}function OT(e,t,n){if(n===void 0)return;let r=ie(e).data[t];e.setAttribute(t,(typeof r=="number"?r:0)+n)}function Fp(e,t){let{type:n,event:r}=e;if(n==="step"||!r||typeof r!="object")return;let{recordInputs:o,enableTruncation:i}=wT(r,t),s=We(r.provider),c=We(r.modelId),a=We(r.callId),l=Zf(r.maxRetries);o&&y$(a,r.tools);let p={[S]:yw,...s?{[gl]:s,[_$]:s}:{},...c?{[fl]:c}:{},...l!==void 0?{[h$]:l}:{}};switch(n){case"generateText":case"streamText":case"generateObject":return I$(r,p,o,i,a,n==="streamText");case"languageModelCall":return Po([g$]),A$(r,p,o,i,a,c);case"executeTool":return N$(r,o);case"embed":case"embedMany":{let u=n==="embedMany"?r.values:r.value;return Hp(d$,c,{...p,...o&&u!==void 0?{[Z0]:Ue(u)}:{}})}case"rerank":return Hp(m$,c,p);default:return}}function Hp(e,t,n){return L({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[td]:e,...n}})}function I$(e,t,n,r,o,i){let s=We(e.functionId),c=We(e.operationId)??(i?"ai.streamText":"ai.generateText");o&&CT.set(o,{operationId:c,isStream:i});let a=Hp(J1,s,{...t,[Sw]:c,[J0]:i,...s?{[X0]:s}:{},...n?vw(e,r):{}});return i&&o&&xT.set(o,a),a}function A$(e,t,n,r,o,i){let s=o?CT.get(o):void 0,c=s?`${s.operationId}.${s.isStream?"doStream":"doGenerate"}`:"ai.generateText.doGenerate";return Hp(f$,i,{...t,[Sw]:c,...n?vw(e,r):{},...n&&Array.isArray(e.tools)?{[q0]:Ue(e.tools)}:{}})}function N$(e,t){let n=B(e.toolCall)?e.toolCall:{},r=We(n.toolName),o=We(e.toolCallId)??We(n.toolCallId),i=n.input??n.args,s=t&&r?S$(We(e.callId),r,e.tools):void 0;return Hp($1,r,{[S]:yw,[nO]:"function",...r?{[eO]:r}:{},...o?{[p$]:o}:{},...s?{[u$]:s}:{},...t&&i!==void 0?{[z0]:Ue(i)}:{}})}function _c(e,t,n){let{type:r,result:o}=t;if(!B(o))return;let{recordOutputs:i}=wT(t.event,n);if(r==="executeTool"){i&&e.setAttribute(tO,Ue(o.output??o));let m=B(o.output)?o.output:void 0;m?.type==="tool-error"&&MT(e,t,m.error);return}let s=B(o.usage)?o.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)??vT(m,_);m!==void 0&&e.setAttribute(en,m),_!==void 0&&e.setAttribute(Tt,_),h!==void 0&&e.setAttribute(yb,h)}let c=Iw(o);c&&r==="languageModelCall"&&e.setAttribute(Ot,Ue([c]));let a=B(o.response)?o.response:void 0,l=We(a?.id)??We(o.responseId);l&&e.setAttribute(Q0,l);let p=We(a?.modelId)??We(t.event.modelId);p&&e.setAttribute($0,p);let u=o.providerMetadata,d=Wd(u);if(Xi in d&&ie(e).data[Xi]&&delete d[Xi],b$(d,r),e.setAttributes(d),i){let m=r==="languageModelCall"&&Array.isArray(o.content)?v$(o.content):Rw(o.text,o.toolCalls),_=Aw(m,c);_&&e.setAttribute(bb,_)}}function R$(e){return e==="tool-calls"?"tool_call":e??"stop"}function Iw(e){let t=e.finishReason;return typeof t=="string"?t:B(t)?We(t.unified):void 0}function Kn(e){return Zf(e)??(B(e)?Zf(e.total):void 0)}function Aw(e,t){if(e.length)return Ue([{role:"assistant",parts:e,finish_reason:R$(t)}])}function Nw(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 v$(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(Nw(n)));return t}function Rw(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(Nw(r));return n}function MT(e,t,n){e.setStatus({code:2,message:n instanceof Error?n.message:"tool_error"});let r=B(t.event.toolCall)?t.event.toolCall:{},o=We(r.toolName),i=We(t.event.toolCallId)??We(r.toolCallId);He(s=>{s.setContext("trace",Pr(e)),o&&s.setTag("vercel.ai.tool.name",o),i&&s.setTag("vercel.ai.tool.callId",i),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 wT(e,t){let n=O()?.getDataCollectionOptions().genAI;return{recordInputs:bw(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:bw(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:nt(t.enableTruncation)}}function bw(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n===!0}function vw(e,t){let n={},r=We(e.instructions);r&&(n[tn]=Ue([{type:"text",content:r}]));let o=e.messages??e.prompt;return o!==void 0&&(n[K0]=t?Vt(o):Ue(o),n[xt]=Array.isArray(o)?o.length:1),n}import*as GT from"diagnostics_channel";var O$=((e={})=>({name:"VercelAI",setupOnce(){GT.tracingChannel&&me(()=>{Tw(GT.tracingChannel,e)})}})),Wp=O$;import*as Pw from"diagnostics_channel";var UT="@sentry/instrumentation-fastify",C$=">=3.21.0 <6",kw="auto.http.otel.fastify",x$="hook.fastify",Lw="request_handler.fastify",Mw=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Ei="hook.name",Ti="fastify.type",As="hook.callback.name",P$="fastify.root",k$="route-hook",hc="hook",ww="request-handler",Ii="anonymous",Bo=Symbol("sentry fastify request span"),Gw=Symbol("sentry fastify addHook original"),Uw=Symbol("sentry fastify setNotFoundHandler original");function Dw(e){return e.routeOptions?.url??e.routerPath}function Bw(e){return e.routeOptions?.config??e.routeConfig}function L$(e){return B(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||"routerPath"in e)}function Hw(e,t,n){e.decorate(Gw,e.addHook),e.decorate(Uw,e.setNotFoundHandler),e.decorateRequest("opentelemetry",function(){return{span:this[Bo]}}),e.decorateRequest(Bo,null),e.addHook("onRoute",M$),e.addHook("onRequest",w$),e.addHook("onResponse",G$),e.addHook=B$,e.setNotFoundHandler=H$,n()}var DT=Hw;DT[Symbol.for("skip-override")]=!0;DT[Symbol.for("fastify.display-name")]=UT;DT[Symbol.for("plugin-meta")]={fastify:C$,name:UT};function M$(e){if(e.config?.otel!==!1){for(let t of Mw){let n=e[t];typeof n=="function"?e[t]=Ai(n,t,Ow(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(r=>Ai(r,t,Ow(this.pluginName,t,r,e.url))))}e.onSend=Cw(e.onSend,U$),e.onError=Cw(e.onError,D$),e.handler=Ai(e.handler,"handler",{[Ei]:`${this.pluginName} - route-handler`,[Ti]:ww,[Fe]:e.url,[As]:e.handler.name.length>0?e.handler.name:Ii})}}function Ow(e,t,n,r){return{[Ei]:`${e} - route -> ${t}`,[Ti]:k$,[Fe]:r,[As]:n.name?.length>0?n.name:Ii}}function Cw(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function w$(e,t,n){if(Bw(e)?.otel===!1)return n();let r={[S]:kw,[P$]:UT,[Hr]:e.method,[ti]:e.url},o=Dw(e);if(o!=null){r[Fe]=o;let s=Q(),c=s&&Oe(s);c&&ie(c).data[H]==="http.server"&&c.setAttribute(Fe,o)}let i=L({name:"request",op:Lw,attributes:r});e[Bo]=i,se(i,()=>{n()})}function G$(e,t,n){let r=e[Bo];r!=null&&(r.setAttributes({[yn]:t.statusCode}),r.end()),e[Bo]=null,n()}function U$(e,t,n,r){let o=e[Bo];o!=null&&(t.statusCode>=500&&o.setStatus({code:2}),o.setAttributes({[yn]:t.statusCode}),o.end()),e[Bo]=null,r(null,n)}function D$(e,t,n,r){let o=e[Bo];o?.setStatus({code:2,message:n.message}),r()}function B$(e,t){let n=this[Gw];return Mw.includes(e)?n.call(this,e,Ai(t,e,{[Ei]:`${this.pluginName} - ${e}`,[Ti]:hc,[As]:t.name?.length>0?t.name:Ii})):n.call(this,e,t)}function H$(e,t){let n=this[Uw];if(typeof e=="function"){n.call(this,Ai(e,"notFoundHandler",{[Ei]:`${this.pluginName} - not-found-handler`,[Ti]:hc,[As]:e.name?.length>0?e.name:Ii}));return}if(e.preValidation!=null&&(e.preValidation=Ai(e.preValidation,"notFoundHandler - preValidation",{[Ei]:`${this.pluginName} - not-found-handler - preValidation`,[Ti]:hc,[As]:e.preValidation.name?.length>0?e.preValidation.name:Ii})),e.preHandler!=null&&(e.preHandler=Ai(e.preHandler,"notFoundHandler - preHandler",{[Ei]:`${this.pluginName} - not-found-handler - preHandler`,[Ti]:hc,[As]:e.preHandler.name?.length>0?e.preHandler.name:Ii})),t==null){n.call(this,e);return}n.call(this,e,Ai(t,"notFoundHandler",{[Ei]:`${this.pluginName} - not-found-handler`,[Ti]:hc,[As]:t.name?.length>0?t.name:Ii}))}function F$(e){for(let t of e)if(L$(t))return t;return null}function Ai(e,t,n={}){return function(...o){let i=F$(o);if(i===null||Bw(i)?.otel===!1)return e.call(this,...o);let s=i[Bo]??void 0,c=e.name?.length>0?e.name:this.pluginName??Ii,a=n[Ti],l=a===hc?x$:a===ww?Lw:void 0,p=l?W$(n[Ei]):`${t} - ${c}`;return Se({name:p,op:l,attributes:{...n,[S]:kw},parentSpan:s},()=>e.call(this,...o))}}function W$(e=""){return e.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"").replace(/^@sentry\/instrumentation-fastify -> /,"")}function V$(e){e.addHook("onRequest",async(t,n)=>{let r=Dw(t),o=t.method||"GET";$().setTransactionName(`${o} ${r}`)})}var xw=!1,Fw=Object.assign(function(){xw||(xw=!0,Pw.subscribe("fastify.initialization",t=>{let n=t.fastify;n?.register(Hw).after(r=>{r?J&&g.error("Failed to setup Fastify instrumentation",r):n&&V$(n)})}))},{id:"Fastify.v5"});var Qf="Fastify";function $f(e,t,n){let r=n.statusCode;return r>=500||r<=299}import*as Ww from"diagnostics_channel";function Y$(){return O()?.getIntegrationByName(Qf)}function Vw(){Ww.subscribe("tracing:fastify.request.handler:error",e=>{let{error:t,request:n,reply:r}=e;Jf.call(Jf,t,n,r,"diagnostics-channel")})}function Jf(e,t,n,r){let o=Y$()?.getShouldHandleError()||$f;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}o(e,t,n)&&ge(e,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var j$=(({shouldHandleError:e}={})=>{let t;return{name:Qf,setupOnce(){t=e||$f,Vw(),Fw()},getShouldHandleError(){return t},setShouldHandleError(n){t=n}}}),BT=j$;var zf=Jf;var Z$="db.mongodb.collection",X$="db.name",K$="db.user",q$="net.peer.name",Q$="net.peer.port",$$="db.operation",J$="db.system";function Ho({collection:e,modelName:t,operation:n,origin:r,parentSpan:o}){let i={[Z$]:e?.name,[X$]:e?.conn?.name,[K$]:e?.conn?.user,[q$]:e?.conn?.host,[Q$]:e?.conn?.port,[$$]:n,[J$]:"mongoose",[S]:r};return L({name:`mongoose.${t}.${n}`,op:"db",kind:D.CLIENT,attributes:i,parentSpan:o})}var Yw="Fastify",HT=fe(`${Yw}.v3`,()=>new Uf);function z$(){let e=O();if(e)return e.getIntegrationByName(Yw)}var eJ=(e=>{let t=BT(e);return Ht(t,{setupOnce(){HT()}})}),FT=(e={})=>eJ(e);function tJ(e,t){t?.shouldHandleError&&z$()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(r,o,i){r.addHook("onError",async(s,c,a)=>{zf.call(zf,a,s,c,"onError-hook")}),i()},{[Symbol.for("skip-override")]:!0,[Symbol.for("fastify.display-name")]:"sentry-fastify-error-handler"});e.register(n)}import{normalize as nJ}from"path";var Re=class{constructor(t,n,r,o){this.name=nJ(t),this.supportedVersions=n,this.patch=r,this.unpatch=o}};var WT=(e=>(e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription",e))(WT||{}),Ni=(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))(Ni||{}),Fo=(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))(Fo||{});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 Vp=Symbol.for("opentelemetry.patched"),ao=Symbol.for("opentelemetry.graphql_data");var jw="Operation$operationName$not supported";var Zw=Object.values(WT),VT=e=>typeof e?.then=="function";function eg(e,t,n,r){if(O()?.getDataCollectionOptions().graphQL.document===!0){let o=uJ(t,n,r);e.setAttribute(Tn.SOURCE,o)}}function rJ(e,t,n){let r=Qw(e,n);if(r)return{field:r,spanAdded:!1};let o=sJ(e,n);return r={span:oJ(e,t,n,o)},iJ(e,n,r),{field:r,spanAdded:!0}}function oJ(e,t,n,r){let o={[Tn.FIELD_NAME]:t.fieldName,[Tn.FIELD_PATH]:n.join("."),[Tn.FIELD_TYPE]:t.returnType.toString(),[Tn.PARENT_NAME]:t.parentType.name},i=L({name:`${Fo.RESOLVE} ${o[Tn.FIELD_PATH]}`,attributes:o,parentSpan:r}),s=e[ao].source,c=t.fieldNodes.find(a=>a.kind==="Field");return c&&eg(i,s.loc,c.loc?.start,c.loc?.end),i}function Ns(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function YT(e,t){if(!(!e||!Array.isArray(e.definitions)))return t?e.definitions.filter(n=>Zw.indexOf(n?.operation)!==-1).find(n=>t===n?.name?.value):e.definitions.find(n=>Zw.indexOf(n?.operation)!==-1)}function iJ(e,t,n){return e[ao].fields[t.join(".")]=n}function Qw(e,t){return e[ao].fields[t.join(".")]}function sJ(e,t){for(let n=t.length-1;n>0;n--){let r=Qw(e,t.slice(0,n));if(r)return r.span}return aJ(e)}function aJ(e){return e[ao].span}function cJ(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function lJ(e){return $w(`
33
- `,e)}function Xw(e){return $w(" ",e)}function $w(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}var pJ=[Ni.FLOAT,Ni.STRING,Ni.INT,Ni.BLOCK_STRING];function uJ(e,t,n){let r="";if(e?.startToken){let o=typeof t=="number"?t:e.start,i=typeof n=="number"?n:e.end,s=e.startToken.next,c=1;for(;s;){if(s.start<o){s=s.next,c=s?.line;continue}if(s.end>i){s=s.next,c=s?.line;continue}let a=s.value||s.kind,l="";pJ.indexOf(s.kind)>=0&&(a="*"),s.kind===Ni.STRING&&(a=`"${a}"`),s.kind===Ni.EOF&&(a=""),s.line>c?(r+=lJ(s.line-c),c=s.line,l=Xw(s.column-1)):s.line===s.prev?.line&&(l=Xw(s.start-(s.prev?.end||0))),r+=l+a,s&&(s=s.next)}}return r}function tg(e,t){if(!e||e[Vp])return;let n=e.getFields();e[Vp]=!0,Object.keys(n).forEach(r=>{let o=n[r];if(o&&(o.resolve&&(o.resolve=jT(t,o.resolve)),o.type)){let i=Jw(o.type);for(let s of i)tg(s,t)}})}function Jw(e){return"ofType"in e?Jw(e.ofType):dJ(e)?e.getTypes():mJ(e)?[e]:[]}function dJ(e){return"getTypes"in e&&typeof e.getTypes=="function"}function mJ(e){return"getFields"in e&&typeof e.getFields=="function"}var Kw=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},qw=(e,t)=>{t&&e.end()};function jT(e,t,n=!1){if(r[Vp]||typeof t!="function")return t;function r(o,i,s,c){if(!t)return;if(e().ignoreTrivialResolveSpans&&n&&(B(o)||typeof o=="function")&&typeof o[c.fieldName]!="function")return t.call(this,o,i,s,c);if(!s[ao])return t.call(this,o,i,s,c);let l=cJ(c?.path),{field:p,spanAdded:u}=rJ(s,c,l),d=p.span,m=u;return se(d,()=>{try{let _=t.call(this,o,i,s,c);return VT(_)?_.then(h=>(qw(d,m),h),h=>{throw Kw(d,h,m),h}):(qw(d,m),_)}catch(_){throw Kw(d,_,m),_}})}return r[Vp]=!0,r}var fJ="@sentry/instrumentation-graphql",gJ="auto.graphql.otel.graphql",zw={ignoreResolveSpans:!1},ng=[">=14.0.0 <17"],rg=class extends le{constructor(t={}){super(fJ,q,{...zw,...t})}setConfig(t={}){super.setConfig({...zw,...t})}init(){let t=new re("graphql",ng);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",ng,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",ng,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",ng,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(o){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=YT(s.document,s.operationName),a=n._createExecuteSpan(c,s);return s.contextValue[ao]={source:s.document?s.document||s.document[ao]:void 0,span:a,fields:{}},se(a,()=>zr(()=>o.apply(this,[s]),(l,p)=>{n._handleExecutionResult(a,l,p)}))}}}_handleExecutionResult(t,n,r){if(r===void 0||n){Ns(t,n);return}VT(r)?r.then(o=>{this._updateSpanFromResult(t,o),Ns(t)},o=>{Ns(t,o)}):(this._updateSpanFromResult(t,r),Ns(t))}_updateSpanFromResult(t,n){if(n.errors?.length&&!ie(t).status&&t.setStatus({code:2}),!this.getConfig().useOperationNameForRootSpan)return;let r=ie(t).data,o=r[Tn.OPERATION_TYPE],i=r[Tn.OPERATION_NAME];if(!o)return;let s=Oe(t),a=ie(s).data[Ss]||[],l=i?`${o} ${i}`:`${o}`;Array.isArray(a)?(a.push(l),s.setAttribute(Ss,a)):typeof a=="string"?s.setAttribute(Ss,[a,l]):s.setAttribute(Ss,l),ie(s).data["original-description"]||s.setAttribute("original-description",ie(s).description),s.updateName(`${ie(s).data["original-description"]} (${_J(a)})`)}_patchParse(){let t=this;return function(r){return function(i,s){return t._parse(this,r,i,s)}}}_patchValidate(){let t=this;return function(r){return function(i,s,c,a,l){return t._validate(this,r,i,s,c,l,a)}}}_parse(t,n,r,o){let i=L({name:Fo.PARSE});return se(i,()=>zr(()=>n.call(t,r,o),(s,c)=>{c&&(YT(c)?c.loc&&eg(i,c.loc):i.updateName(Fo.SCHEMA_PARSE)),Ns(i,s)}))}_validate(t,n,r,o,i,s,c){let a=L({name:Fo.VALIDATE});return se(a,()=>zr(()=>n.call(t,r,o,i,c,s),(l,p)=>{o.loc||a.updateName(Fo.SCHEMA_VALIDATE),Ns(a,l)}))}_createExecuteSpan(t,n){let r=L({name:Fo.EXECUTE,attributes:{[S]:gJ}});if(t){let{operation:o,name:i}=t;r.setAttribute(Tn.OPERATION_TYPE,o);let s=i?.value;s?(r.setAttribute(Tn.OPERATION_NAME,s),r.updateName(`${o} ${s}`)):r.updateName(o)}else{let o=" ";n.operationName&&(o=` "${n.operationName}" `),o=jw.replace("$operationName$",o),r.setAttribute(Tn.OPERATION_NAME,o)}return n.document?.loc&&eg(r,n.document.loc),r}_wrapExecuteArgs(t,n,r,o,i,s,c,a,l){if(o||(o={}),o[ao]||this.getConfig().ignoreResolveSpans)return{schema:t,document:n,rootValue:r,contextValue:o,variableValues:i,operationName:s,fieldResolver:c,typeResolver:a};let p=c==null;return c=jT(()=>this.getConfig(),c??l,p),t&&(tg(t.getQueryType(),()=>this.getConfig()),tg(t.getMutationType(),()=>this.getConfig())),{schema:t,document:n,rootValue:r,contextValue:o,variableValues:i,operationName:s,fieldResolver:c,typeResolver:a}}};function _J(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 eG="Graphql",XT=fe(eG,rg,e=>ZT(e)),hJ=((e={})=>Ht(Gp(ZT(e)),{name:eG,setupOnce(){XT(ZT(e))}})),KT=hJ;function ZT(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var bc="messaging.destination.partition.id",qT="messaging.kafka.message.key",QT="messaging.kafka.message.tombstone",tG="messaging.kafka.offset",$T="process",Yp="receive",nG="send",JT="kafka",rG="_OTHER";var bJ="auto.kafkajs.otel.producer",yJ="auto.kafkajs.otel.consumer";function jp(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function oG(e){let t=jp(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:o}=Rn(t,jp(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:o?Xt.SAMPLED:Xt.NONE}}]}function og({topic:e,message:t,operationType:n,links:r,attributes:o}){let i=n===Yp?"poll":n;return L({name:`${i} ${e}`,kind:n===Yp?D.CLIENT:D.CONSUMER,links:r,attributes:{...o,[Dt]:JT,[xn]:e,[ur]:n,[_a]:i,[qT]:t?.key?String(t.key):void 0,[QT]:t?.key&&t.value===null?!0:void 0,[tG]:t?.offset,...t?{[S]:yJ}:{}}})}function zT(e,t){let n=L({name:`send ${e}`,kind:D.PRODUCER,attributes:{[Dt]:JT,[xn]:e,[qT]:t.key?String(t.key):void 0,[QT]:t.key&&t.value===null?!0:void 0,[bc]:t.partition!==void 0?String(t.partition):void 0,[_a]:"send",[ur]:nG,[S]:bJ}});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 Rs(e,t){return Promise.resolve(t).catch(n=>{let r,o=rG;throw typeof n=="string"||n===void 0?r=n:typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"message")&&(r=n.message,o=n.constructor.name),e.forEach(i=>{i.setAttribute(Gr,o),i.setStatus({code:2,message:r})}),n}).finally(()=>{e.forEach(n=>n.end())})}var SJ="@sentry/instrumentation-kafkajs",ig=class extends le{constructor(t={}){super(SJ,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(...o){let i=n.apply(this,o);return w(i.run)&&t._unwrap(i,"run"),t._wrap(i,"run",t._getConsumerRunPatch()),i}}_getProducerPatch(){let t=this;return n=>function(...o){let i=n.apply(this,o);return w(i.sendBatch)&&t._unwrap(i,"sendBatch"),t._wrap(i,"sendBatch",t._getSendBatchPatch()),w(i.send)&&t._unwrap(i,"send"),t._wrap(i,"send",t._getSendPatch()),w(i.transaction)&&t._unwrap(i,"transaction"),t._wrap(i,"transaction",t._getProducerTransactionPatch()),i}}_getConsumerRunPatch(){let t=this;return n=>function(...o){let i=o[0];return i?.eachMessage&&(w(i.eachMessage)&&t._unwrap(i,"eachMessage"),t._wrap(i,"eachMessage",t._getConsumerEachMessagePatch())),i?.eachBatch&&(w(i.eachBatch)&&t._unwrap(i,"eachBatch"),t._wrap(i,"eachBatch",t._getConsumerEachBatchPatch())),n.call(this,i)}}_getConsumerEachMessagePatch(){return t=>function(...r){let o=r[0],i=jp(o.message.headers,"sentry-trace"),s=jp(o.message.headers,"baggage");return vn({sentryTrace:i,baggage:s},()=>{let c=og({topic:o.topic,message:o.message,operationType:$T,attributes:{[bc]:String(o.partition)}}),a=se(c,()=>t.apply(this,r));return Rs([c],a)})}}_getConsumerEachBatchPatch(){return t=>function(...r){let o=r[0],i=On(()=>og({topic:o.batch.topic,message:void 0,operationType:Yp,attributes:{[fa]:o.batch.messages.length,[bc]:String(o.batch.partition)}}));return se(i,()=>{let s=[i];o.batch.messages.forEach(a=>{s.push(og({topic:o.batch.topic,message:a,operationType:$T,links:oG(a.headers),attributes:{[bc]:String(o.batch.partition)}}))});let c=t.apply(this,r);return Rs(s,c)})}}_getProducerTransactionPatch(){let t=this;return n=>function(...o){let i=L({name:"transaction"}),s=n.apply(this,o);return s.then(c=>{let a=c.send;c.send=function(...m){return se(i,()=>t._getSendPatch()(a).apply(this,m).catch(h=>{throw i.setStatus({code:2,message:h?.message}),h}))};let l=c.sendBatch;c.sendBatch=function(...m){return se(i,()=>t._getSendBatchPatch()(l).apply(this,m).catch(h=>{throw i.setStatus({code:2,message:h?.message}),h}))};let p=c.commit;c.commit=function(...m){let _=p.apply(this,m).then(()=>{i.setStatus({code:1})});return Rs([i],_)};let u=c.abort;c.abort=function(...m){let _=u.apply(this,m);return Rs([i],_)}}).catch(c=>{i.setStatus({code:2,message:c?.message}),i.end()}),s}}_getSendBatchPatch(){return t=>function(...r){let i=r[0].topicMessages||[],s=[];i.forEach(a=>{a.messages.forEach(l=>{s.push(zT(a.topic,l))})});let c=t.apply(this,r);return Rs(s,c)}}_getSendPatch(){return t=>function(...r){let o=r[0],i=o.messages.map(c=>zT(o.topic,c)),s=t.apply(this,r);return Rs(i,s)}}};var iG="Kafka",eI=fe(iG,()=>new ig),EJ=(()=>({name:iG,setupOnce(){eI()}})),tI=EJ;var TJ="@sentry/instrumentation-lru-memoizer",sg=class extends le{constructor(){super(TJ,q,{})}init(){return[new re("lru-memoizer",[">=1.3 <4"],t=>Object.assign(function(...r){let o=t.apply(this,r);return function(...i){let s=i.pop(),c=ne(),a=typeof s=="function"?function(...l){return He(c,()=>s.apply(this,l))}:s;return o.apply(this,[...i,a])}},{sync:t.sync}),void 0)]}};var sG="LruMemoizer",nI=fe(sG,()=>new sg),IJ=(()=>({name:sG,setupOnce(){nI()}})),rI=IJ;var aG="auto.db.otel.mongo";function oI(e,t,n,r){return Up(e,t,n,r,aG)}function Zp(e,t,n,r){return Bp(e,t,n,r,aG)}function vs(e,t){let n=Q(),r=!1;return function(...i){if(!r){r=!0;let s=i[0];e&&(s instanceof Error&&e.setStatus({code:2,message:s.message}),e.end())}return se(n??null,()=>t.apply(this,i))}}function Os(){return!Q()}function ag(e){return t=>function(r,o,i,s,c){let a=typeof s=="function"?s:c;if(Os()||typeof a!="function"||typeof i!="object")return typeof s=="function"?t.call(this,r,o,i,s):t.call(this,r,o,i,s,c);let l=Sr(Zp(o,r,i[0],e)),p=vs(l,a);return typeof s=="function"?t.call(this,r,o,i,p):t.call(this,r,o,i,s,p)}}function cG(){return e=>function(n,r,o,i,s){let c=typeof i=="function"?i:s;if(Os()||typeof c!="function"||typeof o!="object")return typeof i=="function"?e.call(this,n,r,o,i):e.call(this,n,r,o,i,s);let a=Dp(o),l=Sr(Zp(r,n,o,a)),p=vs(l,c);return typeof i=="function"?e.call(this,n,r,o,p):e.call(this,n,r,o,i,p)}}function lG(){return e=>function(n,r,o,i){let s=i,c=Object.keys(r)[0];if(typeof r!="object"||r.ismaster||r.hello)return e.call(this,n,r,o,i);let a;Os()||(a=Sr(oI(this,n,r,c)));let l=vs(a,s);return e.call(this,n,r,o,l)}}function pG(){return e=>function(...n){let[r,o]=n,i=Object.keys(o)[0],s=()=>{};if(typeof o!="object"||o.ismaster||o.hello)return e.apply(this,n);let c;Os()||(c=Sr(oI(this,r,o,i)));let a=vs(c,s),l=e.apply(this,n);return l.then(p=>a(null,p),p=>a(p)),l}}function uG(){return e=>function(n,r,o,i,s,c){let a=typeof s=="function"?s:c;if(Os()||typeof a!="function"||typeof o!="object")return typeof s=="function"?e.call(this,n,r,o,i,s):e.call(this,n,r,o,i,s,c);let l=Sr(Zp(r,n,o,"find")),p=vs(l,a);return typeof s=="function"?e.call(this,n,r,o,i,p):e.call(this,n,r,o,i,s,p)}}function dG(){return e=>function(n,r,o,i,s,c){let a=typeof s=="function"?s:c;if(Os()||typeof a!="function")return typeof s=="function"?e.call(this,n,r,o,i,s):e.call(this,n,r,o,i,s,c);let l=Sr(Zp(r,n,o.cmd,"getMore")),p=vs(l,a);return typeof s=="function"?e.call(this,n,r,o,i,p):e.call(this,n,r,o,i,s,p)}}function mG(){return e=>function(n){let r=Q();return e.call(this,function(...o){return se(r??null,()=>n.apply(this,o))})}}var AJ="@sentry/instrumentation-mongodb",cg=class extends le{constructor(t={}){super(AJ,q,t)}init(){let{v3PatchConnection:t,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnectionCallback:r,v4PatchConnectionPromise:o,v4UnpatchConnection:i}=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,i),new Re("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],o,i),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",ag("insert")),w(t.remove)&&this._unwrap(t,"remove"),this._wrap(t,"remove",ag("remove")),w(t.update)&&this._unwrap(t,"update"),this._wrap(t,"update",ag("update")),w(t.command)&&this._unwrap(t,"command"),this._wrap(t,"command",cG()),w(t.query)&&this._unwrap(t,"query"),this._wrap(t,"query",uG()),w(t.getMore)&&this._unwrap(t,"getMore"),this._wrap(t,"getMore",dG()),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",mG()),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",lG()),t),v4PatchConnectionPromise:t=>(w(t.Connection.prototype.command)&&this._unwrap(t.Connection.prototype,"command"),this._wrap(t.Connection.prototype,"command",pG()),t),v4UnpatchConnection:t=>{t!==void 0&&this._unwrap(t.Connection.prototype,"command")}}}};var fG="Mongo",iI=fe(fG,()=>new cg),NJ=(()=>({name:fG,setupOnce(){iI()}})),sI=NJ;function gG(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
34
- Mongoose Error Code: ${t.code}`:""}`})}function _G(e,t){return e instanceof Promise?e.catch(n=>{throw gG(t,n),n}).finally(()=>t.end()):(t.end(),e)}function hG(e,t,n,r,o){let i=0;return o.length===2?i=1:o.length===3&&(i=2),o[i]=(s,c)=>(s&&gG(r,s),r.end(),e(s,c)),t.apply(n,o)}var RJ="@sentry/instrumentation-mongoose",Xp="auto.db.otel.mongoose",ug=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],vJ=["remove","count","findOneAndRemove",...ug],OJ=["count","findOneAndRemove",...ug],CJ=[...ug];function bG(e){return e?e.startsWith("6.")||e.startsWith("5.")?vJ:e.startsWith("7.")?OJ:CJ:ug}function yG(e){return e&&(e.startsWith("5.")||e.startsWith("6."))||!1}function SG(e){return!e||!e.startsWith("8.")?!1:parseInt(e.split(".")[1],10)>=21}var lg=Symbol("stored-parent-span"),EG=Symbol("already-instrumented"),pg=class extends le{constructor(t={}){super(RJ,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,yG(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove")),SG(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()),bG(n).forEach(i=>{this._wrap(r.Query.prototype,i,this.patchAndCaptureSpanContext(i))}),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,o=bG(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,yG(n)&&this._unwrap(r.Model.prototype,"remove"),SG(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"),o.forEach(i=>{this._unwrap(r.Query.prototype,i)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(){let t=this;return n=>function(o){let i=this[lg],s=Ho({collection:this._model.collection,modelName:this._model?.modelName,operation:"aggregate",origin:Xp,parentSpan:i});return t._handleResponse(s,n,this,arguments,o)}}patchQueryExec(){let t=this;return n=>function(o){if(this[EG])return n.apply(this,arguments);let i=this[lg],s=Ho({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:Xp,parentSpan:i});return t._handleResponse(s,n,this,arguments,o)}}patchOnModelMethods(t){let n=this;return r=>function(i,s){let c=Ho({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:Xp});return i instanceof Function&&(s=i),n._handleResponse(c,r,this,arguments,s)}}_patchDocumentUpdateMethods(t){let n=this;return r=>function(i,s,c){let a=c;typeof i=="function"?a=i:typeof s=="function"&&(a=s);let l=Ho({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:Xp}),p=n._handleResponse(l,r,this,arguments,a);return p&&typeof p=="object"&&(p[EG]=!0),p}}patchModelStatic(t){let n=this;return r=>function(i,s,c){typeof s=="function"&&(c=s);let a=Ho({collection:this.collection,modelName:this.modelName,operation:t,origin:Xp});return n._handleResponse(a,r,this,arguments,c)}}patchModelAggregate(){return t=>function(){let r=Q(),o=t.apply(this,arguments);return o&&(o[lg]=r),o}}patchAndCaptureSpanContext(t){return n=>function(){return this[lg]=Q(),n.apply(this,arguments)}}_handleResponse(t,n,r,o,i){return se(t,()=>{if(i instanceof Function)return hG(i,n,r,t,o);{let s=n.apply(r,o);return _G(s,t)}})}};var TG="Mongoose",aI=fe(TG,()=>new pg),xJ=(()=>Ht(gT(),{name:TG,setupOnce(){aI()}})),cI=xJ;var IG="db.connection_string",AG="mysql";function NG(e){let t=e?.connectionConfig||e||{},{host:n,port:r,database:o,user:i}=t;return{host:n,port:r,database:o,user:i}}function RG(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function vG(e){return typeof e=="string"?e:e.sql}function OG(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var PJ="@sentry/instrumentation-mysql",kJ="auto.db.otel.mysql",dg=class extends le{constructor(t={}){super(PJ,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(o){let i=t(...arguments);return n._wrap(i,"query",n._patchQuery(i)),i}}}_patchCreatePool(){return t=>{let n=this;return function(o){let i=t(...arguments);return n._wrap(i,"query",n._patchQuery(i)),n._wrap(i,"getConnection",n._patchGetConnection(i)),i}}}_patchCreatePoolCluster(){return t=>{let n=this;return function(o){let i=t(...arguments);return n._wrap(i,"getConnection",n._patchGetConnection(i)),i}}}_patchGetConnection(t){return n=>{let r=this;return function(i,s,c){if(!r._enabled)return r._unwrap(t,"getConnection"),n.apply(t,arguments);if(arguments.length===1&&typeof i=="function"){let a=r._getConnectionCallbackPatchFn(i);return n.call(t,a)}if(arguments.length===2&&typeof s=="function"){let a=r._getConnectionCallbackPatchFn(s);return n.call(t,i,a)}if(arguments.length===3&&typeof c=="function"){let a=r._getConnectionCallbackPatchFn(c);return n.call(t,i,s,a)}return n.apply(t,arguments)}}}_getConnectionCallbackPatchFn(t){let n=this,r=ne();return function(o,i){i&&(w(i.query)||n._wrap(i,"query",n._patchQuery(i))),typeof t=="function"&&He(r,()=>t.call(this,o,i))}}_patchQuery(t){return n=>{let r=this;return function(o,i,s){if(!r._enabled)return r._unwrap(t,"query"),n.apply(t,arguments);let{host:c,port:a,database:l,user:p}=NG(t.config),u=parseInt(String(a),10),d={[S]:kJ,[ke]:AG,[IG]:RG(c,a,l),[Et]:l,[Ut]:p,[Ye]:vG(o),[Me]:c};isNaN(u)||(d[Pe]=u);let m=L({name:OG(o),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(o,i,s){return o&&t.setStatus({code:2,message:o.message}),t.end(),He(n,()=>r(...arguments))}}};var CG="Mysql",lI=fe(CG,()=>new dg({})),LJ=(()=>({name:CG,setupOnce(){lI()}})),pI=LJ;var xG="db.connection_string",PG="mysql";function kG(e){let{host:t,port:n,database:r,user:o}=MJ(e),i={[xG]:wJ(t,n,r),[Et]:r,[Ut]:o,[Me]:t},s=parseInt(n,10);return isNaN(s)||(i[Pe]=s),i}function MJ(e){let{host:t,port:n,database:r,user:o}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:o}}function wJ(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function LG(e,t,n){let[r,o]=typeof e=="string"?[e,n]:[e.sql,GJ(e)?n||e.values:n];try{return t&&o?t(r,o):r}catch{return"Could not determine the query due to an error in formatting"}}function GJ(e){return"values"in e}function MG(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var wG=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function uI(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:t}var UJ="@sentry/instrumentation-mysql2",DJ="auto.db.otel.mysql2",dI=[">=1.4.2 <3.20.0"],mg=class extends le{constructor(t={}){super(UJ,q,t)}init(){let t;function n(i){!t&&i.format&&(t=i.format)}let r=i=>{w(i.query)&&this._unwrap(i,"query"),this._wrap(i,"query",this._patchQuery(t)),w(i.execute)&&this._unwrap(i,"execute"),this._wrap(i,"execute",this._patchQuery(t))},o=i=>{this._unwrap(i,"query"),this._unwrap(i,"execute")};return[new re("mysql2",dI,i=>(n(i),i),()=>{},[new Re("mysql2/promise.js",dI,i=>(n(i),i),()=>{}),new Re("mysql2/lib/connection.js",dI,i=>{let s=uI(i);return r(s),i},i=>{if(i===void 0)return;let s=uI(i);o(s)})])]}_patchQuery(t){let n=this;return r=>function(o,i,s){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let a={...kG(this.config),[ke]:PG,[Ye]:LG(o,t,c),[S]:DJ},l=L({name:MG(o),kind:D.CLIENT,attributes:a}),p=wG(u=>{u&&l.setStatus({code:2,message:u.message}),l.end()});if(arguments.length===1){typeof o.onResult=="function"&&n._wrap(o,"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 GG="Mysql2",mI=fe(GG,()=>new mg),BJ=(()=>Ht(bT(),{name:GG,setupOnce(){mI()}})),fI=BJ;import*as JG from"diagnostics_channel";var fg,UG;function DG(e){fg=e}function yc(){return!!fg}function gI(){if(fg)return UG??(UG=fg())}var HJ=["get","set","setex"],_I=["get","mget"],FJ=["set","setex"],hI=["del","unlink"];function Cs(e,t){return e.includes(t.toLowerCase())}function bI(e){return Cs(_I,e)?"cache.get":Cs(FJ,e)?"cache.put":Cs(hI,e)?"cache.remove":void 0}function WJ(e,t){return t.some(n=>e.startsWith(n))}function HG(e,t){try{if(t.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?BG(o.map(i=>n(i))):["<unknown>"],r=t[0];return Cs(HJ,e)&&r!=null?n(r):BG(t.map(o=>n(o)))}catch{return}}function FG(e,t,n){if(!bI(e))return!1;for(let r of t)if(WJ(r,n))return!0;return!1}function WG(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 o=t(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):t(e)}function BG(e){let t=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):t.push(o)})};return n(e),t}var Kp={};function VG(e){Kp=e}var xs=(e,t,n,r)=>{let o=HG(t,n),i=bI(t);if(!o||!i||!Kp.cachePrefixes||!FG(t,o,Kp.cachePrefixes))return;let s=ie(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=Cs(hI,t)?void 0:WG(r);l&&e.setAttribute(Dh,l),Cs(_I,t)&&l!==void 0&&e.setAttribute(Gh,l>0),e.setAttributes({[H]:i,[Uh]:o});let p=o.join(", ");e.updateName(Kp.maxCacheKeyLength?gn(p,Kp.maxCacheKeyLength):p)};var Sc="db.connection_string",Ec="redis";var VJ="@sentry/instrumentation-ioredis",YG="auto.db.otel.redis",YJ=[">=2.0.0 <5.11.0"];function Ps(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var gg=class extends le{constructor(t={}){super(VJ,q,t)}init(){return[new re("ioredis",YJ,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 o=r[0];if(r.length<1||typeof o!="object"||!Q())return n.apply(this,r);let{host:i,port:s}=this.options,c={[ke]:Ec,[Ye]:so(o.name,o.args),[Sc]:`redis://${i}:${s}`,[Me]:i,[Pe]:s,[S]:YG},a=L({name:o.name,kind:D.CLIENT,attributes:c});try{let l=n.apply(this,r),p=o.resolve;o.resolve=function(d){t._callResponseHook(a,o,d),Ps(a,null),p(d)};let u=o.reject;return o.reject=function(d){Ps(a,d),u(d)},l}catch(l){throw Ps(a,l),l}}}_patchConnection(){return t=>function(...n){if(!Q())return t.apply(this,n);let{host:r,port:o}=this.options,i={[ke]:Ec,[Ye]:"connect",[Sc]:`redis://${r}:${o}`,[Me]:r,[Pe]:o,[S]:YG},s=L({name:"connect",kind:D.CLIENT,attributes:i});try{let c=t.apply(this,n);return c instanceof Promise?c.then(a=>(Ps(s,null),a),a=>(Ps(s,a),Promise.reject(a))):(Ps(s,null),c)}catch(c){throw Ps(s,c),c}}}_callResponseHook(t,n,r){let{responseHook:o}=this.getConfig();if(o)try{o(t,n.name,n.args,r)}catch{}}};var SI="@sentry/instrumentation-redis",XG="auto.db.otel.redis",qp=Symbol("opentelemetry.instrumentation.redis.open_spans"),jG=Symbol("opentelemetry.instrumentation.redis.multi_command_options");function _g(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function KG(e,t,n,r,o){if(e)try{e(t,n,r,o)}catch{}}function jJ(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 ZG(e){return{[ke]:Ec,[Me]:e?.socket?.host,[Pe]:e?.socket?.port,[Sc]:jJ(e?.url),[S]:XG}}var qG=class QG extends le{constructor(t={}){super(SI,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(i){if(arguments.length!==1||typeof i!="object")return r.apply(this,arguments);let s={[ke]:Ec,[Ye]:so(i.command,i.args),[S]:XG};this.connection_options&&(s[Me]=this.connection_options.host,s[Pe]=this.connection_options.port),this.address&&(s[Sc]=`redis://${this.address}`);let c=L({name:`${QG.COMPONENT}-${i.command}`,kind:D.CLIENT,attributes:s}),a=arguments[0].callback;if(a){let l=Q();arguments[0].callback=function(u,d){return KG(t.getConfig().responseHook,c,i.command,i.args,d),_g(c,u),se(l??null,()=>a.apply(this,arguments))}}try{return r.apply(this,arguments)}catch(l){throw _g(c,l),l}}}}};qG.COMPONENT="redis";var ZJ=qG,$G=class yI extends le{constructor(t={}){super(SI,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"],(i,s)=>{let c=i.transformCommandArguments;if(!c)return je&&g.error("internal instrumentation error, missing transformCommandArguments function"),i;let a=s?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return w(i?.[a])&&this._unwrap(i,a),this._wrap(i,a,this._getPatchExtendWithCommands(c)),i},i=>{w(i?.extendWithCommands)&&this._unwrap(i,"extendWithCommands"),w(i?.attachCommands)&&this._unwrap(i,"attachCommands")}),r=new Re(`${t}/dist/lib/client/multi-command.js`,["^1.0.0",">=5.0.0 <5.12.0"],i=>{let s=i?.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()),i},i=>{let s=i?.default?.prototype;w(s?.exec)&&this._unwrap(s,"exec"),w(s?.execAsPipeline)&&this._unwrap(s,"execAsPipeline"),w(s?.addCommand)&&this._unwrap(s,"addCommand")}),o=new Re(`${t}/dist/lib/client/index.js`,["^1.0.0",">=5.0.0 <5.12.0"],i=>{let s=i?.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()),i},i=>{let s=i?.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"],i=>i,()=>{},[n,r,o])}_getPatchExtendWithCommands(t){let n=this;return function(o){return function(s){if(s?.BaseClass?.name!=="RedisClient")return o.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)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(){let t=this;return function(r){return function(){let i=r.apply(this,arguments);return typeof i?.then!="function"?(je&&g.error("non-promise result when patching exec/execAsPipeline"),i):i.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(i){return t._traceClientCommand(r,this,arguments,i)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[jG]=this.options,o}}}_getPatchRedisClientSendCommand(){let t=this;return function(r){return function(i){return t._traceClientCommand(r,this,arguments,i)}}}_getPatchedClientConnect(){return function(n){return function(){let o=ZG(this.options),i=L({name:`${yI.COMPONENT}-connect`,kind:D.CLIENT,attributes:o});return se(i,()=>n.apply(this)).then(c=>(i.end(),c),c=>(_g(i,c),Promise.reject(c)))}}}_traceClientCommand(t,n,r,o){let i=n.options||n[jG],s=o[0],c=o.slice(1),a=ZG(i),l=so(s,c);l!=null&&(a[Ye]=l);let p=L({name:`${yI.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:o,commandName:i,commandArgs:s}=t[r],c=n[r],[a,l]=c instanceof Error?[null,c]:[c,void 0];this._endSpanWithResponse(o,i,s,a,l)}}_endSpanWithResponse(t,n,r,o,i){i||KG(this.getConfig().responseHook,t,n,r,o),_g(t,i)}};$G.COMPONENT="redis";var XJ=$G,hg=class extends le{constructor(t={}){super(SI,q,t),this.initialized=!1,this.instrumentationV2_V3=new ZJ(this.getConfig()),this.instrumentationV4_V5=new XJ(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 bg="Redis",KJ=fe(`${bg}.IORedis`,()=>new gg({responseHook:xs})),qJ=fe(`${bg}.Redis`,()=>new hg({responseHook:xs})),EI=Object.assign(()=>{(!yc()||!JG.tracingChannel)&&(KJ(),qJ())},{id:bg}),QJ=((e={})=>Ht(RT({responseHook:xs}),{name:bg,setupOnce(){VG(e),EI()}})),TI=QJ;var ks=(e=>(e.QUERY_PREFIX="pg.query",e.CONNECT="pg.connect",e.POOL_CONNECT="pg-pool.connect",e))(ks||{});var Qp=(e=>(e.PG_PLAN="db.postgresql.plan",e.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",e.MAX_CLIENT="db.postgresql.max.client",e))(Qp||{});var II="db.connection_string",AI="postgresql";var $J="auto.db.otel.postgres";function JJ(e,t){if(!t)return ks.QUERY_PREFIX;let n=typeof t.name=="string"&&t.name?t.name:zJ(t.text);return`${ks.QUERY_PREFIX}:${n}${e?` ${e}`:""}`}function zJ(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 ez(e){try{let t=new URL(e);return t.username="",t.password="",t.toString()}catch{return"postgresql://localhost:5432/"}}function zG(e){if("connectionString"in e&&e.connectionString)return ez(e.connectionString);let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}function eU(e){if(Number.isInteger(e))return e}function NI(e){return{[ke]:AI,[Et]:e.database,[II]:zG(e),[Ut]:e.user,[Me]:e.host,[Pe]:eU(e.port)}}function tU(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[Qp.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[Qp.MAX_CLIENT]:e.maxClient,[ke]:AI,[Et]:t?.pathname.slice(1)??e.database,[II]:zG(e),[Me]:t?.hostname??e.host,[Pe]:Number(t?.port)||eU(e.port),[Ut]:t?.username??e.user}}function yg(){return Q()===void 0}function nU(e){let{connectionParameters:t}=this,n=t.database,r=JJ(n,e),o=L({name:r,kind:D.CLIENT,attributes:{...NI(t),[S]:$J}});return e&&(e.text&&o.setAttribute(Ye,e.text),typeof e.name=="string"&&o.setAttribute(Qp.PG_PLAN,e.name)),o}function RI(e,t){return function(r,o){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,o)}}function rU(e,t){return function(r,o,i){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,o,i)}}function oU(e,t){return function(...r){let o=r[0];o instanceof Error&&e.setStatus({code:2,message:o.message}),e.end(),t.apply(this,r)}}function Sg(e){return typeof e=="object"&&e!==null&&"message"in e?String(e.message):void 0}function iU(e){return typeof e=="object"&&typeof e?.text=="string"}var tz="@sentry/instrumentation-pg";function Tc(e){return e[Symbol.toStringTag]==="Module"?e.default:e}function Eg(e,t){return function(...n){return se(e,()=>t.apply(this,n))}}var Tg=class extends le{constructor(t={}){super(tz,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)),o=new Re("pg/lib/client.js",t,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),i=new re("pg",t,c=>{let a=Tc(c);return this._patchPgClient(a.Client),c},c=>{let a=Tc(c);return this._unpatchPgClient(a.Client),c},[o,r]),s=new re("pg-pool",n,c=>{let a=Tc(c);return w(a.prototype.connect)&&this._unwrap(a.prototype,"connect"),this._wrap(a.prototype,"connect",this._getPoolConnectPatch()),a},c=>{let a=Tc(c);w(a.prototype.connect)&&this._unwrap(a.prototype,"connect")});return[i,s]}_patchPgClient(t){if(!t)return;let n=Tc(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=Tc(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(o){if(yg()||t.getConfig().ignoreConnectSpans)return n.call(this,o);let i=L({name:ks.CONNECT,kind:D.CLIENT,attributes:NI(this)}),s=o;if(s){let a=Q();s=oU(i,s),a&&(s=Eg(a,s))}let c=se(i,()=>n.call(this,s));return sU(i,c)}}_getClientQueryPatch(){return t=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...r){if(yg())return t.apply(this,r);let o=r[0],i=typeof o=="string",s=iU(o),c=i?{text:o,values:Array.isArray(r[1])?r[1]:void 0}:s?{...o,name:o.name,text:o.text,values:o.values??(Array.isArray(r[1])?r[1]:void 0)}:void 0,a=nU.call(this,c);if(r.length>0){let p=Q();if(typeof r[r.length-1]=="function")r[r.length-1]=RI(a,r[r.length-1]),p&&(r[r.length-1]=Eg(p,r[r.length-1]));else if(typeof c?.callback=="function"){let u=RI(a,c.callback);p&&(u=Eg(p,u)),r[0].callback=u}}let l;try{l=t.apply(this,r)}catch(p){throw a.setStatus({code:2,message:Sg(p)}),a.end(),p}return l instanceof Promise?l.then(p=>(a.end(),p)).catch(p=>(a.setStatus({code:2,message:Sg(p)}),a.end(),Promise.reject(p))):l})}_getPoolConnectPatch(){let t=this;return n=>function(o){if(yg()||t.getConfig().ignoreConnectSpans)return n.call(this,o);let i=L({name:ks.POOL_CONNECT,kind:D.CLIENT,attributes:tU(this.options)}),s=o;if(s){let a=Q();s=rU(i,s),a&&(s=Eg(a,s))}let c=se(i,()=>n.call(this,s));return sU(i,c)}}};function sU(e,t){return t instanceof Promise?t.then(r=>(e.end(),r)).catch(r=>(e.setStatus({code:2,message:Sg(r)}),e.end(),Promise.reject(r))):t}var aU="Postgres",vI=fe(aU,Tg,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),nz=(e=>({name:aU,setupOnce(){vI(e)}})),OI=nz;var xI="PostgresJs",cU=[">=3.0.0 <4"],rz="db.response.status_code",oz=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,iz=Symbol.for("sentry.query.from.instrumented.sql"),PI=fe(xI,e=>new CI({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),CI=class extends le{constructor(t){super("sentry-postgres-js",q,t)}init(){let t=new re("postgres",cU,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`,cU,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 o=this,i=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=o.getConfig();return AS(c,{requireParentSpan:a.requireParentSpan,requestHook:a.requestHook})};Object.setPrototypeOf(i,r),Object.setPrototypeOf(i.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(i,s,c)}return n?i:(ep(t,"default",i),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 o=n?.match(oz);o?.[1]&&t.setAttribute(pr,o[1].toUpperCase())}_reconstructQuery(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((n,r,o)=>o===0?r:`${n}$${o}${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(...o){if(this.executed||this[iz])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let i=n._reconstructQuery(this.strings),s=n._sanitizeSqlQuery(i);return Le({name:s||"postgresjs.query",op:"db"},c=>{tT(c,"auto.db.postgresjs"),c.setAttributes({[dt]:"postgres",[wr]:s});let a=n.getConfig(),{requestHook:l}=a;l&&zr(()=>l(c,s,void 0),d=>{d&&(c.setAttribute("sentry.hook.error","requestHook failed"),je&&g.error(`Error in requestHook for ${xI} 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(rz,_?.[0]?.code||"unknown"),c.setAttribute(Gr,_?.[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,o)}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}},sz=(e=>({name:xI,setupOnce(){PI(e)}})),kI=sz;var Gn=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(Gn||{});var lU="@hapi/hapi",$p=Symbol("hapi-handler-patched"),Jp={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},pU=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"]);function uU(e){return e.name?e.name:e.pkg.name}var Ig=e=>typeof e=="string"&&pU.has(e),dU=e=>{let t=e?.type;return t!==void 0&&Ig(t)},mU=e=>Array.isArray(e)&&e.length<=3&&Ig(e[0])&&typeof e[1]=="function",fU=e=>!Array.isArray(e),gU=(e,t)=>{let n={[Fe]:e.path,[Br]:e.method},r;return t?(n[Gn.HAPI_TYPE]=Jp.PLUGIN,n[Gn.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[Gn.HAPI_TYPE]=Jp.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},_U=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[Gn.EXT_TYPE]:e,[Gn.HAPI_TYPE]:Jp.EXT,[Gn.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[Gn.EXT_TYPE]:e,[Gn.HAPI_TYPE]:Jp.EXT},name:r}},LI=e=>"plugin"in e?"plugin"in e.plugin?e.plugin.plugin:e.plugin:e;var az="@sentry/instrumentation-hapi",Ag=class extends le{constructor(t={}){super(az,q,t)}init(){return new re(lU,[">=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(i){let s=t.apply(this,[i]);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(o,i){if(Array.isArray(o))for(let s of o){let c=LI(s);n._wrapRegisterHandler(c)}else{let s=LI(o);n._wrapRegisterHandler(s)}return t.apply(this,[o,i])}}_getServerExtPatch(t,n){let r=this;return function(...i){if(Array.isArray(i[0])){let s=i[0];for(let c=0;c<s.length;c++){let a=s[c];if(Ig(a.type)){let l=a,p=r._wrapExtMethods(l.method,a.type,n);l.method=p,s[c]=l}}return t.apply(this,i)}else if(mU(i)){let s=i,c=s[1],a=r._wrapExtMethods(c,s[0],n);return t.apply(this,[s[0],a,s[2]])}else if(dU(i[0])){let s=i[0],c=r._wrapExtMethods(s.method,s.type,n);return s.method=c,t.call(this,s)}return t.apply(this,i)}}_getServerRoutePatch(t,n){let r=this;return function(o){if(Array.isArray(o))for(let i=0;i<o.length;i++){let s=r._wrapRouteHandler.call(r,o[i],n);o[i]=s}else o=r._wrapRouteHandler.call(r,o,n);return t.apply(this,[o])}}_wrapRegisterHandler(t){let n=this,r=uU(t),o=t.register,i=this,s=function(c,a){return i._wrap(c,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),i._wrap(c,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),o.call(this,c,a)};t.register=s}_wrapExtMethods(t,n,r){let o=this;if(t instanceof Array){for(let i=0;i<t.length;i++)t[i]=o._wrapExtMethods(t[i],n);return t}else if(fU(t))return t[$p]===!0?t:(t[$p]=!0,function(...s){if(de.getSpan(ce.active())===void 0)return t.apply(this,s);let c=_U(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[$p]===!0)return t;t[$p]=!0;let r=o=>function(...i){if(de.getSpan(ce.active())===void 0)return o.call(this,...i);io(t.path);let s=gU(t,n);return Se({name:s.name,op:`${s.attributes[Gn.HAPI_TYPE]}.hapi`,attributes:{...s.attributes,[S]:"auto.http.otel.hapi"}},()=>o.call(this,...i))};if(typeof t.handler=="function")t.handler=r(t.handler);else if(typeof t.options=="function"){let o=t.options;t.options=function(i){let s=o(i);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 hU="Hapi",Ng=fe(hU,()=>new Ag),cz=(()=>({name:hU,setupOnce(){Ng()}})),MI=cz;function lz(e){return!!(e&&typeof e=="object"&&"error"in e&&e.error)}function pz(e){ge(e,{mechanism:{type:"auto.function.hapi",handled:!1}})}var uz={name:"SentryHapiErrorPlugin",version:q,register:async function(e){e.events.on({name:"request",channels:["error"]},(n,r)=>{if($()!==vt()){let o=n.route;o.path&&$().setTransactionName(`${o.method.toUpperCase()} ${o.path}`)}else je&&g.warn("Isolation scope is still the default isolation scope - skipping setting transactionName");lz(r)&&pz(r.error)})}};async function dz(e){await e.register(uz),yr(e.register,"hapi")}var Ri={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},zp={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};var mz="@sentry/instrumentation-hono",fz="0.0.1",Rg=class extends le{constructor(t={}){super(mz,fz,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(...i){super(...i),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(...o){if(typeof o[0]=="string"){let i=o[0];if(o.length===1)return n.apply(this,[i]);let s=o.slice(1);return n.apply(this,[i,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,o.map(i=>t._wrapHandler(i)))}}}_patchOnHandler(){let t=this;return function(n){return function(...o){let i=o.slice(2);return n.apply(this,[...o.slice(0,2),...i.map(s=>t._wrapHandler(s))])}}}_patchMiddlewareHandler(){let t=this;return function(n){return function(...o){if(typeof o[0]=="string"){let i=o[0];if(o.length===1)return n.apply(this,[i]);let s=o.slice(1);return n.apply(this,[i,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,o.map(i=>t._wrapHandler(i)))}}}_wrapHandler(t){let n=this;return function(r,o){if(!n.isEnabled())return t.apply(this,[r,o]);let i=r.req.path,s=n.tracer.startSpan(i);return ce.with(de.setSpan(ce.active(),s),()=>n._safeExecute(()=>{let c=t.apply(this,[r,o]);if(bt(c))return c.then(a=>{let l=n._determineHandlerType(a);return s.setAttributes({[Ri.HONO_TYPE]:l,[Ri.HONO_NAME]:l===zp.REQUEST_HANDLER?i:t.name||"anonymous"}),n.getConfig().responseHook?.(s),a});{let a=n._determineHandlerType(c);return s.setAttributes({[Ri.HONO_TYPE]:a,[Ri.HONO_NAME]:a===zp.REQUEST_HANDLER?i:t.name||"anonymous"}),n.getConfig().responseHook?.(s),c}},()=>s.end(),c=>{n._handleError(s,c),s.end()}))}}_safeExecute(t,n,r){try{let o=t();return bt(o)?o.then(()=>n(),i=>r(i)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(t){return t===void 0?zp.MIDDLEWARE:zp.REQUEST_HANDLER}_handleError(t,n){n instanceof Error&&(t.setStatus({code:Lt.ERROR,message:n.message}),t.recordException(n))}};var bU="Hono";function gz(e){let t=ie(e).data,n=t[Ri.HONO_TYPE];if(t[H]||!n)return;e.setAttributes({[S]:"auto.http.otel.hono",[H]:`${n}.hono`});let r=t[Ri.HONO_NAME];if(typeof r=="string"&&e.updateName(r),$()===vt()){je&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=t[Fe],i=t[Hr];typeof o=="string"&&typeof i=="string"&&$().setTransactionName(`${i} ${o}`)}var wI=fe(bU,()=>new Rg({responseHook:e=>{gz(e)}})),_z=(()=>({name:bU,setupOnce(){wI()}})),GI=_z;function hz(){return async function(t,n){let r=ss(t.req);$().setSDKProcessingMetadata({normalizedRequest:r}),await n()}}function bz(e){return e.res.status>=500}function yz(e){return async function(n,r){await r(),(e?.shouldHandleError||bz)(n)&&(n.res.sentry=ge(n.error,{mechanism:{type:"auto.middleware.hono",handled:!1}}))}}function Sz(e,t){e.use(hz()),e.use(yz(t)),yr(e.use,"hono")}var Ls=(e=>(e.ROUTER="router",e.MIDDLEWARE="middleware",e))(Ls||{});var vi=(e=>(e.KOA_TYPE="koa.type",e.KOA_NAME="koa.name",e))(vi||{});var yU=(e,t,n,r)=>n?{attributes:{[vi.KOA_NAME]:r?.toString(),[vi.KOA_TYPE]:Ls.ROUTER,[Fe]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[vi.KOA_NAME]:t.name??"middleware",[vi.KOA_TYPE]:Ls.MIDDLEWARE,[zu]:t.name??"middleware"},name:`middleware - ${t.name}`},SU=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e));var UI=Symbol("koa-layer-patched");var Ez="@sentry/instrumentation-koa",vg=class extends le{constructor(t={}){super(Ez,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(i){let s=i.router?n(i):r(i,!1);return t.apply(this,[s])}}_patchRouterDispatch(t){let r=t.router?.stack??[];for(let o of r){let i=o.path,s=o.stack;for(let c=0;c<s.length;c++){let a=s[c];s[c]=this._patchLayer(a,!0,i)}}return t}_patchLayer(t,n,r){let o=n?Ls.ROUTER:Ls.MIDDLEWARE;return t[UI]===!0||SU(o,this.getConfig())||t.constructor.name==="GeneratorFunction"||t.constructor.name==="AsyncGeneratorFunction"?t:(t[UI]=!0,(i,s)=>{if(de.getSpan(ce.active())===void 0)return t(i,s);let a=yU(i,t,n,r);i._matchedRoute&&io(i._matchedRoute.toString());let l=a.attributes[vi.KOA_NAME],p=typeof l=="string"?l||"< unknown >":a.name;return Se({name:p,op:`${o}.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=i.request?.method?.toUpperCase()||"GET";$().setTransactionName(`${d} ${u}`)}return t(i,s)})})}};var EU="Koa",DI=fe(EU,vg,(e={})=>({ignoreLayersType:e.ignoreLayersType})),Tz=((e={})=>({name:EU,setupOnce(){DI(e)}})),BI=Tz,Iz=e=>{e.use(async(t,n)=>{try{await n()}catch(r){throw ge(r,{mechanism:{handled:!1,type:"auto.middleware.koa"}}),r}}),yr(e.use,"koa")};var Og=(e=>(e.CONNECT_TYPE="connect.type",e.CONNECT_NAME="connect.name",e))(Og||{}),Cg=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(Cg||{});var Wo=Symbol("opentelemetry.instrumentation-connect.request-route-stack");var TU=e=>{Array.isArray(e[Wo])===!1&&Object.defineProperty(e,Wo,{enumerable:!1,value:[]}),e[Wo].push("/");let t=e[Wo].length;return()=>{t===e[Wo].length?e[Wo].pop():je&&g.warn("Connect: Trying to pop the stack multiple time")}},IU=(e,t)=>{t&&e[Wo].splice(-1,1,t)},AU=e=>e[Wo].reduce((t,n)=>t.replace(/\/+$/,"")+n);var Az="@sentry/instrumentation-connect",Nz="anonymous",xg=class extends le{constructor(t={}){super(Az,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 o=Reflect.apply(t,this,r);return n(o),o}}_patchNext(t,n,r){return function(i){ze(i)&&n.setStatus({code:2,message:"internal_error"});let s=t.apply(this,[i]);return r(),s}}_startSpan(t,n){let r=t?Cg.REQUEST_HANDLER:Cg.MIDDLEWARE,o=t||n.name||Nz;return L({name:o,op:`${r}.connect`,attributes:{[S]:"auto.http.otel.connect",[Fe]:t.length>0?t:"/",[Og.CONNECT_TYPE]:r,[Og.CONNECT_NAME]:o}})}_patchMiddleware(t,n){let r=this.isEnabled.bind(this),o=this._startSpan.bind(this),i=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];IU(u,t),t&&io(AU(u));let _=o(t,n),h=!1;function b(){h||(h=!0,_.end()),d.removeListener("close",b)}d.addListener("close",b),arguments[p]=i(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 o=r[r.length-1],i=r[r.length-2]||"";return r[r.length-1]=n(i,o),t.apply(this,r)}}_patchHandle(t){let n=this._patchOut.bind(this);return function(){let[r,o]=[0,2],i=arguments[r],s=arguments[o],c=TU(i);return typeof s=="function"&&(arguments[o]=n(s,c)),Reflect.apply(t,this,arguments)}}_patchOut(t,n){return function(...o){return n(),Reflect.apply(t,this,o)}}};var NU="Connect",HI=fe(NU,()=>new xg),Rz=(()=>({name:NU,setupOnce(){HI()}})),FI=Rz;function vz(e,t,n,r){ge(e,{mechanism:{handled:!1,type:"auto.middleware.connect"}}),r(e)}var Oz=e=>{e.use(vz),yr(e.use,"connect")};var RU="db.sql.table",vU="sqlite",OU="postgresql";var CU=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>"},Cz=new Map([["sqlite3",vU],["pg",OU]]),xU=e=>Cz.get(e)||e,PU=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,kU=(e,t)=>typeof e=="string"&&typeof t=="number"&&0<t&&t<e.length?`${e.substring(0,t)}..`:e,LU=e=>{if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}},MU=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},wU=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},WI=e=>{let t=e?._single?.table;return typeof t=="object"?WI(t):t};var xz="@sentry/instrumentation-knex",Pz="auto.db.otel.knex",kz="knex",VI=[">=0.22.0 <4",">=0.10.0 <0.18.0",">=0.19.0 <0.22.0",">=0.18.0 <0.19.0"],Lz=1022,GU=Symbol("sentry.instrumentation-knex.parent-span"),Pg=class extends le{constructor(t={}){super(xz,q,t)}init(){let t=new re(kz,VI);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`,VI,(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`,VI,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(i){let s=this.client.config,c=WI(this.builder),a=i?.method,l=s?.connection?.connectionString,p=s?.connection?.filename||s?.connection?.database||LU(l),u={[S]:Pz,"knex.version":t,[ke]:xU(this.client.driverName),[RU]:c,[ua]:a,[Ut]:s?.connection?.user,[Et]:p,[Me]:s?.connection?.host??MU(l),[Pe]:s?.connection?.port??wU(l),[ha]:s?.connection?.filename===":memory:"?"inproc":void 0,[Ye]:kU(i?.sql,Lz)},d=this.builder[GU]||Q(),m=arguments;return Se({name:PU(p,a,c),kind:D.CLIENT,attributes:u,parentSpan:d,onlyIfParent:!0},_=>r.apply(this,m).catch(h=>{let v=CU(this)(i.sql,i.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,GU,{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 Mz="sentrySubscribeOrchestrionChannel";function _e(e){let t=new Set,n=[];for(let{module:r}of e){let o=`${r.name}\0${r.versionRange}\0${String(r.filePath)}`;t.has(o)||(t.add(o),n.push({channelName:r.name,module:r,astQuery:"Program",transform:Mz}))}return n}var co={name:"amqplib",versionRange:">=0.5.5 <2"},YI=[{channelName:"publish",module:{...co,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"publish",kind:"Sync"}},{channelName:"confirmPublish",module:{...co,filePath:"lib/channel_model.js"},functionQuery:{className:"ConfirmChannel",methodName:"publish",kind:"Callback"}},{channelName:"consume",module:{...co,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"consume",kind:"Async"}},{channelName:"dispatch",module:{...co,filePath:"lib/channel.js"},functionQuery:{className:"BaseChannel",methodName:"dispatchMessage",kind:"Sync"}},{channelName:"ack",module:{...co,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ack",kind:"Sync"}},{channelName:"nack",module:{...co,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nack",kind:"Sync"}},{channelName:"reject",module:{...co,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"reject",kind:"Sync"}},{channelName:"ackAll",module:{...co,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ackAll",kind:"Sync"}},{channelName:"nackAll",module:{...co,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nackAll",kind:"Sync"}},{channelName:"connect",module:{...co,filePath:"lib/connect.js"},functionQuery:{functionName:"connect",kind:"Callback"}}],UU={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"},DU=_e(YI);var jI=[...["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"}}))],BU={ANTHROPIC_CHAT:"orchestrion:@anthropic-ai/sdk:chat",ANTHROPIC_MODELS:"orchestrion:@anthropic-ai/sdk:models",ANTHROPIC_MESSAGES_STREAM:"orchestrion:@anthropic-ai/sdk:messages-stream"},HU=_e(jI);var ZI=[{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"}}],FU={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"},WU=_e(ZI);var Ic={name:"dataloader",versionRange:">=2.0.0 <3",filePath:"index.js"},XI=[{channelName:"construct",module:Ic,functionQuery:{functionName:"DataLoader",kind:"Sync"}},{channelName:"load",module:Ic,functionQuery:{expressionName:"load",kind:"Async"}},{channelName:"loadMany",module:Ic,functionQuery:{expressionName:"loadMany",kind:"Async"}},{channelName:"prime",module:Ic,functionQuery:{expressionName:"prime",kind:"Sync"}},{channelName:"clear",module:Ic,functionQuery:{expressionName:"clear",kind:"Sync"}},{channelName:"clearAll",module:Ic,functionQuery:{expressionName:"clearAll",kind:"Sync"}}],VU={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"},YU=_e(XI);var KI=[{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"}}],jU={EXPRESS_HANDLE:"orchestrion:express:handle",ROUTER_HANDLE:"orchestrion:router:handle",EXPRESS_REGISTER:"orchestrion:express:register",ROUTER_REGISTER:"orchestrion:router:register"},ZU=_e(KI);var wz=">=3.0.0 <5",Gz=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,Uz=[{functionName:"addDoc",channelName:"add-doc"},{functionName:"getDocs",channelName:"get-docs"},{functionName:"setDoc",channelName:"set-doc"},{functionName:"deleteDoc",channelName:"delete-doc"}],Dz=">=6.0.0 <7",Bz=[{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"}],qI=[...Uz.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:"@firebase/firestore",versionRange:wz,filePath:Gz},functionQuery:{functionName:e,kind:"Auto"}})),...Bz.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:"firebase-functions",versionRange:Dz,filePath:e},functionQuery:{functionName:t,kind:"Sync"}}))],XU={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"},KU=_e(qI);var QI=[{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"}}],qU={GENERIC_POOL_ACQUIRE:"orchestrion:generic-pool:acquire"},QU=_e(QI);var $I=["dist/node/index.js","dist/node/index.mjs","dist/node/index.cjs"],JI=[...$I.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"}}))),...$I.map(e=>({channelName:"embed-content",module:{name:"@google/genai",versionRange:">=0.10.0 <2",filePath:e},functionQuery:{className:"Models",methodName:"embedContent",kind:"Auto"}})),...$I.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"}})))],$U={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"},JU=_e(JI);var zI=[{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"}}],zU={GRAPHQL_PARSE:"orchestrion:graphql:parse",GRAPHQL_VALIDATE:"orchestrion:graphql:validate",GRAPHQL_EXECUTE:"orchestrion:graphql:execute"},eD=_e(zI);var eA=[{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"}}],tD={HAPI_ROUTE:"orchestrion:@hapi/hapi:route",HAPI_EXT:"orchestrion:@hapi/hapi:ext"},nD=_e(eA);var tA=[...["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"}}],rD={IOREDIS_COMMAND:"orchestrion:ioredis:command",IOREDIS_CONNECT:"orchestrion:ioredis:connect"},oD=_e(tA);var nA=[{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"}}],iD={KAFKAJS_SEND_BATCH:"orchestrion:kafkajs:send_batch",KAFKAJS_CONSUMER_RUN:"orchestrion:kafkajs:consumer_run"},sD=_e(nA);var aD="knex",Hz=[{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"}],Fz=[{filePath:"lib/client.js",versionRange:">=0.10.0 <4"},{filePath:"src/client.js",versionRange:">=0.18.0 <0.19.0"}],Wz=["queryBuilder","schemaBuilder","raw"];function Vz(e,t){return{channelName:"query",module:{name:aD,versionRange:t,filePath:e},functionQuery:{className:"Runner",methodName:"query",kind:"Async"}}}function Yz(e,t,n){return{channelName:e,module:{name:aD,versionRange:n,filePath:t},functionQuery:{className:"Client",methodName:e,kind:"Sync"}}}var rA=[...Hz.map(({filePath:e,versionRange:t})=>Vz(e,t)),...Fz.flatMap(({filePath:e,versionRange:t})=>Wz.map(n=>Yz(n,e,t)))],cD={KNEX_QUERY:"orchestrion:knex:query",KNEX_QUERY_BUILDER:"orchestrion:knex:queryBuilder",KNEX_SCHEMA_BUILDER:"orchestrion:knex:schemaBuilder",KNEX_RAW:"orchestrion:knex:raw"},lD=_e(rA);var oA=[{channelName:"use",module:{name:"koa",versionRange:">=2.0.0 <4",filePath:"lib/application.js"},functionQuery:{className:"Application",methodName:"use",kind:"Sync"}}],pD={KOA_USE:"orchestrion:koa:use"},uD=_e(oA);var jz=["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"}}]}),iA="embedQuery",kg="embedDocuments",dD=[{name:"@langchain/openai",versionRange:">=0.1.0 <2.0.0",methods:[iA,kg]},{name:"@langchain/google-genai",versionRange:">=0.1.0 <3.0.0",methods:[iA,kg]},{name:"@langchain/mistralai",versionRange:">=0.1.0 <2.0.0",methods:[iA,kg]},{name:"@langchain/google-common",versionRange:">=0.1.0 <3.0.0",methods:[kg]}],Zz=dD.flatMap(({name:e,versionRange:t,methods:n})=>["dist/embeddings.cjs","dist/embeddings.js"].flatMap(r=>n.map(o=>({channelName:o,module:{name:e,versionRange:t,filePath:r},functionQuery:{methodName:o,kind:"Async"}})))),sA=[...jz,...Zz],mD=dD.flatMap(({name:e,methods:t})=>t.map(n=>`orchestrion:${e}:${n}`)),fD={LANGCHAIN_CHAT_MODEL_INVOKE:"orchestrion:@langchain/core:chatModelInvoke",LANGCHAIN_CHAT_MODEL_STREAM:"orchestrion:@langchain/core:chatModelStream"},gD=_e(sA);var _D=e=>({name:"@langchain/langgraph",versionRange:">=0.0.0 <2.0.0",filePath:e}),Xz=["dist/graph/state.cjs","dist/graph/state.js"].map(e=>({channelName:"stateGraphCompile",module:_D(e),functionQuery:{className:"StateGraph",methodName:"compile",kind:"Sync"}})),Kz=["dist/prebuilt/react_agent_executor.cjs","dist/prebuilt/react_agent_executor.js"].map(e=>({channelName:"createReactAgent",module:_D(e),functionQuery:{functionName:"createReactAgent",kind:"Sync"}})),aA=[...Xz,...Kz],hD={LANGGRAPH_STATE_GRAPH_COMPILE:"orchestrion:@langchain/langgraph:stateGraphCompile",LANGGRAPH_CREATE_REACT_AGENT:"orchestrion:@langchain/langgraph:createReactAgent"},bD=_e(aA);var cA=[{channelName:"load",module:{name:"lru-memoizer",versionRange:">=2.1.0 <4",filePath:"lib/async.js"},functionQuery:{functionName:"memoizedFunction",kind:"Callback"}}],yD={LRU_MEMOIZER_LOAD:"orchestrion:lru-memoizer:load"},SD=_e(cA);var Ms={name:"mongodb"},lA=[{channelName:"command",module:{...Ms,versionRange:">=6.4.0 <8",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Async"}},{channelName:"command",module:{...Ms,versionRange:">=4.0.0 <6.4",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Callback"}},{channelName:"checkout",module:{...Ms,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:{...Ms,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/index.js"},functionQuery:{expressionName:e,kind:"Callback"}})),{channelName:"v3_command",module:{...Ms,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/command.js"},functionQuery:{functionName:"command",kind:"Callback"}},{channelName:"v3_query",module:{...Ms,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/query.js"},functionQuery:{functionName:"query",kind:"Callback"}},{channelName:"v3_get_more",module:{...Ms,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/get_more.js"},functionQuery:{functionName:"getMore",kind:"Callback"}}],ED={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"},TD=_e(lA);var Oi={name:"mongoose",versionRange:">=5.9.7 <9.7.0"},ID=["find","findOne","deleteOne","deleteMany","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace","remove","count","findOneAndRemove"],pA=[{channelName:"query_exec",module:{...Oi,filePath:"lib/query.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"aggregate_exec",module:{...Oi,filePath:"lib/aggregate.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"model_save",module:{...Oi,filePath:"lib/model.js"},functionQuery:{expressionName:"save",kind:"Auto"}},{channelName:"model_insert_many",module:{...Oi,filePath:"lib/model.js"},functionQuery:{expressionName:"insertMany",kind:"Auto"}},{channelName:"model_bulk_write",module:{...Oi,filePath:"lib/model.js"},functionQuery:{expressionName:"bulkWrite",kind:"Auto"}},{channelName:"model_remove",module:{...Oi,filePath:"lib/model.js"},functionQuery:{expressionName:"remove",kind:"Auto"}},{channelName:"model_aggregate",module:{...Oi,filePath:"lib/model.js"},functionQuery:{expressionName:"aggregate",kind:"Sync"}},...ID.map(e=>({channelName:`ctx_${e}`,module:{...Oi,filePath:"lib/query.js"},functionQuery:{expressionName:e,kind:"Sync"}}))],AD={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"},ND=ID.map(e=>`orchestrion:mongoose:ctx_${e}`),RD=_e(pA);var uA=[{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"}}],vD={MYSQL2_QUERY:"orchestrion:mysql2:query",MYSQL2_EXECUTE:"orchestrion:mysql2:execute"},OD=_e(uA);var dA=[{channelName:"query",module:{name:"mysql",versionRange:">=2.0.0 <3",filePath:"lib/Connection.js"},functionQuery:{expressionName:"query",kind:"Auto"}}],CD={MYSQL_QUERY:"orchestrion:mysql:query"},xD=_e(dA);var mA=[{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"}}],PD={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"},kD=_e(mA);var fA=[...["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"}}))],LD={OPENAI_CHAT:"orchestrion:openai:chat",OPENAI_EMBEDDINGS:"orchestrion:openai:embeddings"},MD=_e(fA);var gA=[{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"}}],wD={PG_QUERY:"orchestrion:pg:query",PG_CONNECT:"orchestrion:pg:connect",PGPOOL_CONNECT:"orchestrion:pg-pool:connect"},GD=_e(gA);var qz=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"}}],_A=["src","cjs/src"].flatMap(qz),UD={POSTGRESJS_HANDLE:"orchestrion:postgres:handle",POSTGRESJS_CONNECTION:"orchestrion:postgres:connection",POSTGRESJS_EXECUTE:"orchestrion:postgres:execute",POSTGRESJS_CONNECT:"orchestrion:postgres:connect"},DD=_e(_A);var hA=[{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"}}],BD={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"},HD=_e(hA);var Qz=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"}}],bA=["dist","dist/esm"].flatMap(Qz),FD={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"},WD=_e(bA);var $z="tedious",Jz="lib/connection.js",zz=">=1.11.0 <20",e7=["connect","execSql","execSqlBatch","callProcedure","execBulkLoad","prepare","execute"],yA=e7.map(e=>({channelName:e,module:{name:$z,versionRange:zz,filePath:Jz},functionQuery:{className:"Connection",methodName:e,kind:"Sync"}})),VD={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"},YD=_e(yA);var SA=[...ws(">=4.0.0 <7.0.0","generateText","generateText","Async"),...ws(">=4.0.0 <7.0.0","streamText","streamText","Sync"),...ws(">=4.0.0 <7.0.0","generateObject","generateObject","Async"),...ws(">=4.0.0 <7.0.0","embed","embed","Async"),...ws(">=4.0.0 <7.0.0","embedMany","embedMany","Async"),...ws(">=5.0.0 <7.0.0","resolveLanguageModel","resolveLanguageModel","Sync"),...ws(">=6.0.0 <7.0.0","executeToolCall","executeToolCall","Async")],jD={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 ws(e,t,n,r){return["dist/index.js","dist/index.mjs"].map(o=>({channelName:t,module:{name:"ai",versionRange:e,filePath:o},functionQuery:{functionName:n,kind:r}}))}var ZD=_e(SA);var A={...UU,...BU,...FU,...VU,...jU,...XU,...qU,...$U,...zU,...tD,...rD,...iD,...cD,...pD,...fD,...hD,...yD,...ED,...AD,...vD,...CD,...PD,...LD,...wD,...UD,...BD,...FD,...VD,...jD};var t7="Amqplib",n7="auto.amqplib.orchestrion.publisher",r7="auto.amqplib.orchestrion.consumer",o7="messaging.operation",tB="messaging.destination",nB="messaging.destination_kind",rB="messaging.rabbitmq.routing_key",XD="messaging.protocol",i7="messaging.protocol_version",s7="messaging.url",oB="messaging.message_id",iB="messaging.conversation_id",sB="messaging.rabbitmq.destination.routing_key",aB="messaging.message.conversation_id",cB="topic",KD="process",a7="send",lB=1e3*60,Qn={Ack:"ack",AckAll:"ackAll",Reject:"reject",Nack:"nack",NackAll:"nackAll",ChannelClosed:"channel closed",ChannelError:"channel error",InstrumentationTimeout:"instrumentation timeout"},TA=Symbol("sentry.amqplib.message.stored-span"),Gs=Symbol("sentry.amqplib.channel.spans-not-ended"),IA=Symbol("sentry.amqplib.channel.consume-timeout-timer"),NA=Symbol("sentry.amqplib.channel.consumer-info"),AA=Symbol("sentry.amqplib.channel.is-confirm-publishing"),pB=Symbol("sentry.amqplib.connection.attributes"),uB=()=>{},qD=!1,c7=(()=>({name:t7,setupOnce(){!qn.tracingChannel||qD||(qD=!0,J&&g.log("[orchestrion:amqplib] subscribing to amqplib tracing channels"),me(()=>{f7(),l7(),p7(),u7(),d7(),m7()}))}}));function l7(){ee(qn.tracingChannel(A.AMQPLIB_PUBLISH),e=>{if(!e.self?.[AA])return mB(e)})}function p7(){let e=qn.tracingChannel(A.AMQPLIB_CONFIRM_PUBLISH);ee(e,t=>(t.self&&(t.self[AA]=!0),mB(t))),e.end.subscribe(t=>{let n=t.self;n&&(n[AA]=!1)})}function u7(){let e=qn.tracingChannel(A.AMQPLIB_CONSUME);e.start.subscribe(uB),e.asyncEnd.subscribe(t=>{let n=t,r=n.self,i=n.result?.consumerTag;if(!r||!i)return;dB(r);let s=n.arguments[0],c=typeof s=="string"?s:"<unknown>",a=n.arguments[2];r[NA]?.set(i,{noAck:!!a?.noAck,queue:c})})}function d7(){ee(qn.tracingChannel(A.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;dB(t);let o=n?.consumerTag?t[NA]?.get(n.consumerTag):void 0,i=o?.queue??r.fields?.routingKey??"<unknown>",s=o?.noAck??!1,c=r.properties?.headers,a=eB(c,"sentry-trace"),l=eB(c,"baggage"),p=vn({sentryTrace:a,baggage:l},()=>_7(i,r,t));return s||(t[Gs]?.push({msg:r,timeOfConsume:lt()}),r[TA]=p),e._sentryNoAck=s,p},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function m7(){qn.tracingChannel(A.AMQPLIB_ACK).start.subscribe(e=>EA(e,!1,Qn.Ack)),qn.tracingChannel(A.AMQPLIB_NACK).start.subscribe(e=>EA(e,!0,Qn.Nack)),qn.tracingChannel(A.AMQPLIB_REJECT).start.subscribe(e=>EA(e,!0,Qn.Reject)),qn.tracingChannel(A.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&Lg(t.self,!1,Qn.AckAll,void 0)}),qn.tracingChannel(A.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&Lg(t.self,!0,Qn.NackAll,t.arguments[0])})}function f7(){let e=qn.tracingChannel(A.AMQPLIB_CONNECT);e.start.subscribe(uB),e.asyncEnd.subscribe(t=>{let n=t,r=n.result;!r||typeof r!="object"||(r[pB]={...b7(n.arguments?.[0]),...h7(r)})})}function EA(e,t,n){let r=e.self;if(!r)return;let o=e.arguments[0];if(!o)return;let i=e.arguments[1],s=e.arguments[2],c=n===Qn.Reject?i:s,a=r[Gs]??[],l=a.findIndex(p=>p.msg===o);if(l<0)eu(o,t,n,c);else if(n!==Qn.Reject&&i){for(let p=0;p<=l;p++)eu(a[p].msg,t,n,c);a.splice(0,l+1)}else eu(o,t,n,c),a.splice(l,1)}function dB(e){if(Object.prototype.hasOwnProperty.call(e,Gs))return;e[Gs]=[],e[NA]=new Map;let t=setInterval(()=>g7(e),lB);t.unref?.(),e[IA]=t,typeof e.on=="function"&&(e.on("close",()=>{Lg(e,!0,Qn.ChannelClosed,void 0),QD(e)}),e.on("error",()=>{Lg(e,!0,Qn.ChannelError,void 0),QD(e)}))}function QD(e){let t=e[IA];t&&(clearInterval(t),e[IA]=void 0)}function g7(e){let t=lt(),n=e[Gs]??[],r;for(r=0;r<n.length;r++){let o=n[r];if((t-o.timeOfConsume)*1e3<lB)break;eu(o.msg,null,Qn.InstrumentationTimeout,!0)}n.splice(0,r)}function Lg(e,t,n,r){(e[Gs]??[]).forEach(i=>{eu(i.msg,t,n,r)}),e[Gs]=[]}function eu(e,t,n,r){let o=e[TA];o&&(t!==!1&&o.setStatus({code:2,message:n!==Qn.ChannelClosed&&n!==Qn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),o.end(),e[TA]=void 0)}function mB(e){let t=e.arguments[0],n=e.arguments[1],r=typeof t=="string"?t:"",o=typeof n=="string"?n:"",i=e.arguments[3],s=L({name:`publish ${y7(r)}`,op:"message",kind:D.PRODUCER,attributes:{...fB(e.self),[tB]:r,[xn]:r,[nB]:cB,[rB]:o,[sB]:o,[ur]:a7,[oB]:i?.messageId,[ga]:i?.messageId,[iB]:i?.correlationId,[aB]:i?.correlationId,[S]:n7}});(!i||typeof i!="object")&&(i={},e.arguments[3]=i);let c=i.headers&&typeof i.headers=="object"?i.headers:i.headers={},a=tt({span:s});return a["sentry-trace"]&&(c["sentry-trace"]=a["sentry-trace"]),a.baggage&&(c.baggage=a.baggage),s}function _7(e,t,n){return L({name:`${e} process`,op:"message",kind:D.CONSUMER,attributes:{...fB(n),[tB]:t.fields?.exchange,[xn]:t.fields?.exchange,[nB]:cB,[rB]:t.fields?.routingKey,[sB]:t.fields?.routingKey,[o7]:KD,[ur]:KD,[oB]:t.properties?.messageId,[ga]:t.properties?.messageId,[iB]:t.properties?.correlationId,[aB]:t.properties?.correlationId,[S]:r7}})}function fB(e){let t=e?.connection,n=t?.[pB];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r=="string"&&r?{[Dt]:r.toLowerCase()}:{}}function h7(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t=="string"&&t?{[Dt]:t.toLowerCase()}:{}}function b7(e){let t={[i7]:"0.9.1",[uO]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,o=JD(r.protocol),i=zD(r.hostname),s=$D(r.port,o);t[XD]=o,t[Eb]=o,t[_t]=i,t[ht]=s,t[Me]=i,t[Pe]=s}else if(typeof n=="string"){let r=S7(n);t[s7]=r,t[pt]=r;try{let o=new URL(r),i=JD(o.protocol),s=zD(o.hostname),c=$D(o.port?parseInt(o.port,10):void 0,i);t[XD]=i,t[Eb]=i,t[_t]=s,t[ht]=c,t[Me]=s,t[Pe]=c}catch{}}return t}function y7(e){return e!==""?e:"<default>"}function S7(e){return e.replace(/:[^:@/]*@/,":***@")}function $D(e,t){return e||(t==="AMQP"?5672:5671)}function JD(e){let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()}function zD(e){return e||"localhost"}function eB(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}var gB=c7;import*as RA from"diagnostics_channel";var hB="Anthropic_AI",E7="auto.ai.orchestrion.anthropic",T7=[{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"}],_B=!1,I7=((e={})=>({name:hB,setupOnce(){!RA.tracingChannel||_B||(_B=!0,me(()=>{for(let{channel:t,operation:n,methodPath:r,stream:o}of T7)J&&g.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),ee(RA.tracingChannel(t),i=>A7(i,n,r,e),{beforeSpanEnd:(i,s)=>{Kd(i,s.result,Xe(e).recordOutputs)},deferSpanEnd:({span:i,data:s})=>v7(i,s,o,e)})}))}}));function A7(e,t,n,r){let o=e.arguments??[];if(kn(hB)||o[1]?.headers?.["X-Stainless-Helper-Method"]==="stream")return;let s=typeof o[0]=="object"&&o[0]!==null?o[0]:void 0,{recordInputs:c}=Xe(r),a=nt(r.enableTruncation),l=Xd(o,n,t),p=l[Be]||"unknown";l[S]=E7;let u=L({name:`${t} ${p}`,op:`gen_ai.${t}`,attributes:l});return c&&s&&Ga(u,s,a),u}function N7(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function R7(e){return!!e&&typeof e.on=="function"}function v7(e,t,n,r){let{recordOutputs:o}=Xe(r),i=t.result;if(n==="async-iterable"&&N7(i)){let s=i[Symbol.asyncIterator].bind(i),c=Hl({[Symbol.asyncIterator]:s},e,o);return i[Symbol.asyncIterator]=()=>c,!0}return n==="message-stream"&&R7(i)?(Fl(i,e,o),!0):!1}var bB=I7;import*as LA from"diagnostics_channel";var yB="auto.aws.orchestrion.aws_sdk",SB="dynamodb",EB="messaging.destination_kind",TB="topic",vA="chat",OA="aws.bedrock";var O7=new TextDecoder,Mg=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=vA,o={[gl]:OA,[td]:vA},i=t.commandInput.modelId;i&&(o[fl]=i,r&&(r+=` ${i}`));let s=t.commandInput.inferenceConfig;if(s){let{maxTokens:c,temperature:a,topP:l,stopSequences:p}=s;c!==void 0&&(o[Ao]=c),a!==void 0&&(o[No]=a),l!==void 0&&(o[Ro]=l),p!==void 0&&(o[ei]=p)}return{spanName:r,isStream:n,spanAttributes:o}}_requestPreSpanHookInvokeModel(t,n){let r={[gl]:OA},o=t.commandInput?.modelId;if(o&&(r[fl]=o),t.commandInput?.body){let i=JSON.parse(t.commandInput.body);o.includes("amazon.titan")?(i.textGenerationConfig?.temperature!==void 0&&(r[No]=i.textGenerationConfig.temperature),i.textGenerationConfig?.topP!==void 0&&(r[Ro]=i.textGenerationConfig.topP),i.textGenerationConfig?.maxTokenCount!==void 0&&(r[Ao]=i.textGenerationConfig.maxTokenCount),i.textGenerationConfig?.stopSequences!==void 0&&(r[ei]=i.textGenerationConfig.stopSequences)):o.includes("amazon.nova")?(i.inferenceConfig?.temperature!==void 0&&(r[No]=i.inferenceConfig.temperature),i.inferenceConfig?.top_p!==void 0&&(r[Ro]=i.inferenceConfig.top_p),i.inferenceConfig?.max_new_tokens!==void 0&&(r[Ao]=i.inferenceConfig.max_new_tokens),i.inferenceConfig?.stopSequences!==void 0&&(r[ei]=i.inferenceConfig.stopSequences)):o.includes("anthropic.claude")?(i.max_tokens!==void 0&&(r[Ao]=i.max_tokens),i.temperature!==void 0&&(r[No]=i.temperature),i.top_p!==void 0&&(r[Ro]=i.top_p),i.stop_sequences!==void 0&&(r[ei]=i.stop_sequences)):o.includes("meta.llama")?(i.max_gen_len!==void 0&&(r[Ao]=i.max_gen_len),i.temperature!==void 0&&(r[No]=i.temperature),i.top_p!==void 0&&(r[Ro]=i.top_p)):o.includes("cohere.command-r")?(i.max_tokens!==void 0&&(r[Ao]=i.max_tokens),i.temperature!==void 0&&(r[No]=i.temperature),i.p!==void 0&&(r[Ro]=i.p),i.message!==void 0&&(r[en]=Math.ceil(i.message.length/6)),i.stop_sequences!==void 0&&(r[ei]=i.stop_sequences)):o.includes("cohere.command")?(i.max_tokens!==void 0&&(r[Ao]=i.max_tokens),i.temperature!==void 0&&(r[No]=i.temperature),i.p!==void 0&&(r[Ro]=i.p),i.prompt!==void 0&&(r[en]=Math.ceil(i.prompt.length/6)),i.stop_sequences!==void 0&&(r[ei]=i.stop_sequences)):o.includes("mistral")&&(i.prompt!==void 0&&(r[en]=Math.ceil(i.prompt.length/6)),i.max_tokens!==void 0&&(r[Ao]=i.max_tokens),i.temperature!==void 0&&(r[No]=i.temperature),i.top_p!==void 0&&(r[Ro]=i.top_p),i.stop!==void 0&&(r[ei]=i.stop))}return{isStream:n,spanAttributes:r}}_responseHookConverse(t,n){let{stopReason:r,usage:o}=t.data;IB(n,r),AB(n,o)}_responseHookConverseStream(t,n){t.data.stream=x7(t.data.stream,n)}_responseHookInvokeModel(t,n){let r=t.request.commandInput?.modelId;if(t.data?.body){let o=O7.decode(t.data.body),i=JSON.parse(o);r.includes("amazon.titan")?(i.inputTextTokenCount!==void 0&&n.setAttribute(en,i.inputTextTokenCount),i.results?.[0]?.tokenCount!==void 0&&n.setAttribute(Tt,i.results[0].tokenCount),i.results?.[0]?.completionReason!==void 0&&n.setAttribute(Ot,[i.results[0].completionReason])):r.includes("amazon.nova")?(i.usage!==void 0&&(i.usage.inputTokens!==void 0&&n.setAttribute(en,i.usage.inputTokens),i.usage.outputTokens!==void 0&&n.setAttribute(Tt,i.usage.outputTokens)),i.stopReason!==void 0&&n.setAttribute(Ot,[i.stopReason])):r.includes("anthropic.claude")?(i.usage?.input_tokens!==void 0&&n.setAttribute(en,i.usage.input_tokens),i.usage?.output_tokens!==void 0&&n.setAttribute(Tt,i.usage.output_tokens),i.stop_reason!==void 0&&n.setAttribute(Ot,[i.stop_reason])):r.includes("meta.llama")?(i.prompt_token_count!==void 0&&n.setAttribute(en,i.prompt_token_count),i.generation_token_count!==void 0&&n.setAttribute(Tt,i.generation_token_count),i.stop_reason!==void 0&&n.setAttribute(Ot,[i.stop_reason])):r.includes("cohere.command-r")?(i.text!==void 0&&n.setAttribute(Tt,Math.ceil(i.text.length/6)),i.finish_reason!==void 0&&n.setAttribute(Ot,[i.finish_reason])):r.includes("cohere.command")?(i.generations?.[0]?.text!==void 0&&n.setAttribute(Tt,Math.ceil(i.generations[0].text.length/6)),i.generations?.[0]?.finish_reason!==void 0&&n.setAttribute(Ot,[i.generations[0].finish_reason])):r.includes("mistral")&&(i.outputs?.[0]?.text!==void 0&&n.setAttribute(Tt,Math.ceil(i.outputs[0].text.length/6)),i.outputs?.[0]?.stop_reason!==void 0&&n.setAttribute(Ot,[i.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(t,n){let r=t.data?.body,o=t.request.commandInput?.modelId;if(!r||!o)return;let i=C7(o);t.data.body=(async function*(){try{for await(let s of r){if(i){let c=P7(s?.chunk?.bytes);c&&i(c,n)}yield s}}finally{n.end()}})()}};function C7(e){if(e.includes("amazon.titan"))return M7;if(e.includes("anthropic.claude"))return L7;if(e.includes("amazon.nova"))return k7;if(e.includes("meta.llama"))return w7;if(e.includes("cohere.command-r"))return D7;if(e.includes("cohere.command"))return U7;if(e.includes("mistral"))return G7}async function*x7(e,t){try{let n;for await(let r of e)IB(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;AB(t,n)}finally{t.end()}}function IB(e,t){t!==void 0&&e.setAttribute(Ot,[t])}function AB(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 P7(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 k7(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 L7(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 M7(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 w7(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 G7(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 U7(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 D7(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 Ac(e){return Array.isArray(e)?e:[e]}var wg=class{requestPreSpanHook(t){let n=t.commandName,r=t.commandInput?.TableName,o={};return o[ke]=SB,o[Et]=r,o[ua]=n,t.commandInput?.TableName?o[gb]=[t.commandInput.TableName]:t.commandInput?.RequestItems&&(o[gb]=Object.keys(t.commandInput.RequestItems)),(n==="CreateTable"||n==="UpdateTable")&&t.commandInput?.ProvisionedThroughput&&(o[O0]=t.commandInput.ProvisionedThroughput.ReadCapacityUnits,o[C0]=t.commandInput.ProvisionedThroughput.WriteCapacityUnits),(n==="GetItem"||n==="Scan"||n==="Query")&&t.commandInput?.ConsistentRead&&(o[b0]=t.commandInput.ConsistentRead),(n==="Query"||n==="Scan")&&t.commandInput?.ProjectionExpression&&(o[v0]=t.commandInput.ProjectionExpression),n==="CreateTable"&&(t.commandInput?.GlobalSecondaryIndexes&&(o[T0]=Ac(t.commandInput.GlobalSecondaryIndexes).map(i=>JSON.stringify(i))),t.commandInput?.LocalSecondaryIndexes&&(o[R0]=Ac(t.commandInput.LocalSecondaryIndexes).map(i=>JSON.stringify(i)))),(n==="ListTables"||n==="Query"||n==="Scan")&&t.commandInput?.Limit&&(o[N0]=t.commandInput.Limit),n==="ListTables"&&t.commandInput?.ExclusiveStartTableName&&(o[E0]=t.commandInput.ExclusiveStartTableName),n==="Query"&&(t.commandInput?.ScanIndexForward&&(o[P0]=t.commandInput.ScanIndexForward),t.commandInput?.IndexName&&(o[mb]=t.commandInput.IndexName),t.commandInput?.Select&&(o[fb]=t.commandInput.Select)),n==="Scan"&&(t.commandInput?.Segment&&(o[k0]=t.commandInput?.Segment),t.commandInput?.TotalSegments&&(o[M0]=t.commandInput?.TotalSegments),t.commandInput?.IndexName&&(o[mb]=t.commandInput.IndexName),t.commandInput?.Select&&(o[fb]=t.commandInput.Select)),n==="UpdateTable"&&(t.commandInput?.AttributeDefinitions&&(o[h0]=Ac(t.commandInput.AttributeDefinitions).map(i=>JSON.stringify(i))),t.commandInput?.GlobalSecondaryIndexUpdates&&(o[I0]=Ac(t.commandInput.GlobalSecondaryIndexUpdates).map(i=>JSON.stringify(i)))),{spanAttributes:o,spanKind:D.CLIENT,spanOp:"db"}}responseHook(t,n){t.data?.ConsumedCapacity&&n.setAttribute(y0,Ac(t.data.ConsumedCapacity).map(r=>JSON.stringify(r))),t.data?.ItemCollectionMetrics&&n.setAttribute(A0,Ac(t.data.ItemCollectionMetrics).map(r=>JSON.stringify(r))),t.data?.TableNames&&n.setAttribute(L0,t.data?.TableNames.length),t.data?.Count&&n.setAttribute(S0,t.data?.Count),t.data?.ScannedCount&&n.setAttribute(x0,t.data?.ScannedCount)}};var Gg=class{requestPreSpanHook(t){let n=t.commandInput?.StreamName,r={};return n&&(r[w0]=n),{spanAttributes:r,spanKind:D.CLIENT}}};var Ug="Invoke",Dg=class{requestPreSpanHook(t){let n=t.commandInput?.FunctionName,r={},o;return t.commandName===Ug&&(r[W0]=n,r[V0]="aws",o=`${n} ${Ug}`),{spanAttributes:r,spanKind:D.CLIENT,spanName:o}}requestPostSpanHook(t,n){t.commandName===Ug&&t.commandInput&&(t.commandInput.ClientContext=B7(t.commandInput.ClientContext,n))}responseHook(t,n){t.request.commandName===Ug&&(n.setAttribute(F0,t.requestId),t.request.region&&n.setAttribute(Y0,t.request.region))}};function B7(e,t){try{let n=tt({span:t}),r=e?JSON.parse(Buffer.from(e,"base64").toString("utf8")):{},o={...r,custom:{...r.custom,...n}},i=Buffer.from(JSON.stringify(o)).toString("base64");return i.length>3583?(J&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations."),e):i}catch(n){return J&&g.log("[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext",n),e}}var Bg=class{requestPreSpanHook(t){let n=t.commandInput?.Bucket,r={};return n&&(r[D0]=n),{spanAttributes:r,spanKind:D.CLIENT}}};var Hg=class{requestPreSpanHook(t){let n=t.commandInput?.SecretId,r={};return typeof n=="string"&&n.startsWith("arn:aws:secretsmanager:")&&(r[_b]=n),{spanAttributes:r,spanKind:D.CLIENT}}responseHook(t,n){let r=t.data?.ARN;r&&n.setAttribute(_b,r)}};var H7=10,CA="sentry-trace",xA="baggage",F7=[CA,xA];function tu(e,t){let n=e??{},r=Object.keys(t);if(Object.keys(n).length+r.length<=H7)for(let o of r){let i=t[o];i&&(n[o]={DataType:"String",StringValue:i})}else J&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes");return n}function NB(e){let t=e.MessageAttributes??{},n=t[CA]?.StringValue??t[CA]?.Value;if(n)return{sentryTrace:n,baggage:t[xA]?.StringValue??t[xA]?.Value}}function RB(e=[]){return vl([...e,...F7])}var Fg=class{requestPreSpanHook(t){let n=D.CLIENT,r=`SNS ${t.commandName}`,o={[Dt]:"aws.sns"};if(t.commandName==="Publish"){n=D.PRODUCER,o[EB]=TB;let{TopicArn:s,TargetArn:c,PhoneNumber:a}=t.commandInput,l=W7(s,c,a);o[cO]=l,o[xn]=s||c||a||"unknown",r=`${a?"phone_number":l} send`}let i=t.commandInput?.TopicArn;return i&&(o[hb]=i),{spanAttributes:o,spanKind:n,spanName:r}}requestPostSpanHook(t,n){if(t.commandName==="Publish"){let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=tu(r,tt({span:n}))}}responseHook(t,n){let r=t.data?.TopicArn;r&&n.setAttribute(hb,r)}};function W7(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 Wg=class{requestPreSpanHook(t){let n=Y7(t.commandInput),r=j7(n),o=D.CLIENT,i,s={[Dt]:"aws_sqs",[xn]:r,[pt]:n};switch(t.commandName){case"ReceiveMessage":o=D.CONSUMER,i=`${r} receive`,s[ur]="receive",t.commandInput.MessageAttributeNames=RB(t.commandInput.MessageAttributeNames);break;case"SendMessage":case"SendMessageBatch":o=D.PRODUCER,i=`${r} send`;break}return{spanAttributes:s,spanKind:o,spanName:i}}requestPostSpanHook(t,n){switch(t.commandName){case"SendMessage":{let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=tu(r,tt({span:n}))}break;case"SendMessageBatch":{let r=t.commandInput?.Entries;if(Array.isArray(r)){let o=tt({span:n});r.forEach(i=>{i.MessageAttributes=tu(i.MessageAttributes??{},o)})}}break}}responseHook(t,n){switch(t.request.commandName){case"SendMessage":n.setAttribute(ga,t?.data?.MessageId);break;case"SendMessageBatch":break;case"ReceiveMessage":{let r=t?.data?.Messages||[];n.setAttribute(fa,r.length);for(let o of r)V7(n,o);break}}}};function V7(e,t){let n=NB(t);if(!n)return;let{parentSpanId:r,traceId:o,sampled:i}=Rn(n.sentryTrace,n.baggage);o&&r&&e.addLink({context:{traceId:o,spanId:r,traceFlags:i?1:0},attributes:{[ga]:t.MessageId}})}function Y7(e){return e?.QueueUrl}function j7(e){if(!e)return;let t=e.split("/");if(t.length!==0)return t[t.length-1]}var Vg=class{requestPreSpanHook(t){let n=t.commandInput?.stateMachineArn,r=t.commandInput?.activityArn,o={};return n&&(o[H0]=n),r&&(o[B0]=r),{spanAttributes:o,spanKind:D.CLIENT}}};var Yg=class{constructor(){this._services=new Map([["SecretsManager",new Hg],["SFN",new Vg],["SQS",new Wg],["SNS",new Fg],["DynamoDB",new wg],["Lambda",new Dg],["S3",new Bg],["Kinesis",new Gg],["BedrockRuntime",new Mg]])}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 PA(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function vB(e,t,n,r){return{serviceName:e?.replace(/\s+/g,""),commandName:PA(t,"Command"),commandInput:n,region:r}}function OB(e){return{[bO]:"aws-api",[hO]:e.commandName,[ad]:e.serviceName,[Ju]:e.region}}var Z7="Aws";function kA(e){try{return e()}catch(t){J&&g.warn("[orchestrion:aws-sdk] error building span",t);return}}function CB(e,t){t&&(t.requestId&&e.setAttribute(U0,t.requestId),t.httpStatusCode&&e.setAttribute(vo,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(G0,t.extendedRequestId))}var X7=(()=>{let e=new Yg;return{name:Z7,setupOnce(){if(!LA.tracingChannel)return;let t=o=>kA(()=>{let i=o.arguments[0],s=i?.constructor?.name;if(!i||!s)return;let c=o.self?.config,a=c?.serviceId??PA(o.self?.constructor?.name||"AWS","Client");i.input||(i.input={});let l=vB(a,s,i.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]:yB,...OB(l),...p.spanAttributes}});o._sentryNormalizedRequest=l,o._sentryRequestMetadata=p;let d;try{d=c?.region?.()}catch{}let m={settled:!1,promise:Promise.resolve(d).then(_=>{_&&(l.region=_,u.setAttribute(Ju,_))}).catch(()=>{}).finally(()=>{m.settled=!0})};return o._sentryRegion=m,kA(()=>e.requestPostSpanHook(l,u)),u}),n={deferSpanEnd({span:o,data:i,end:s}){let c=i._sentryNormalizedRequest,a=i._sentryRequestMetadata;if(!c)return!1;let l="error"in i;if(kA(()=>{if(l){let m=i.error,_=m?.$metadata;CB(o,{requestId:m?.RequestId??_?.requestId,httpStatusCode:_?.httpStatusCode,extendedRequestId:m?.extendedRequestId??_?.extendedRequestId});return}let u=i.result;CB(o,u?.$metadata);let d={data:u,request:c,requestId:u?.$metadata?.requestId};e.responseHook(d,o)}),a?.isStream&&!l)return!0;let p=i._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 o of r)ee(LA.tracingChannel(o),t,n)})}}}),xB=X7;import*as nu from"diagnostics_channel";var K7="Dataloader",PB="dataloader",q7="auto.db.orchestrion.dataloader",Q7="cache.get",kB=Symbol("sentry.dataloader.wrapped");function $7(e,t){let n=e?.name;return n?`${PB}.${t} ${n}`:`${PB}.${t}`}function J7(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}function LB(e,t,n){let r=t==="load"||t==="loadMany"||t==="batch";return{name:$7(e,t),kind:t==="batch"?void 0:D.CLIENT,op:r?Q7:void 0,onlyIfParent:!0,attributes:{[S]:q7,[la]:r?J7(n):void 0}}}var z7=(()=>({name:K7,setupOnce(){nu.tracingChannel&&(J&&g.log("[orchestrion:dataloader] subscribing to dataloader tracing channels"),me(()=>{e6(),t6(),jg(A.DATALOADER_LOAD_MANY,"loadMany"),jg(A.DATALOADER_PRIME,"prime"),jg(A.DATALOADER_CLEAR,"clear"),jg(A.DATALOADER_CLEAR_ALL,"clearAll")}))}}));function e6(){nu.tracingChannel(A.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!="function"||n[kB])return;let r=n,o=function(...i){return Se({...LB(this,"batch",i[0]),links:this._batch?.spanLinks},()=>r.apply(this,i))};o[kB]=!0,t.arguments[0]=o})}function t6(){let e=nu.tracingChannel(A.DATALOADER_LOAD);ee(e,t=>MB(t.self,"load",t.arguments[0]),{requiresParentSpan:!0}),e.end.subscribe(t=>{let n=t,r=n._sentrySpan,o=n.self?._batch;r&&o&&r.isRecording()&&(o.spanLinks??(o.spanLinks=[])).push({context:r.spanContext()})})}function jg(e,t){ee(nu.tracingChannel(e),n=>MB(n.self,t,n.arguments[0]),{requiresParentSpan:!0})}function MB(e,t,n){return L(LB(e,t,n))}var MA=z7;import*as wA from"diagnostics_channel";var n6="GenericPool",r6=(()=>({name:n6,setupOnce(){wA.tracingChannel&&me(()=>o6())}})),wB=r6;function o6(){ee(wA.tracingChannel(A.GENERIC_POOL_ACQUIRE),()=>L({name:"generic-pool.acquire",attributes:{[S]:"auto.db.orchestrion.generic_pool"}}))}import*as GA from"diagnostics_channel";var DB="Google_GenAI",GB="auto.ai.orchestrion.google_genai",i6=[{channel:A.GOOGLE_GENAI_GENERATE_CONTENT,operation:"generate_content"},{channel:A.GOOGLE_GENAI_EMBED_CONTENT,operation:"embeddings"},{channel:A.GOOGLE_GENAI_CHAT,operation:"chat"}],UB=!1,s6=((e={})=>({name:DB,setupOnce(){!GA.tracingChannel||UB||(UB=!0,me(()=>{for(let{channel:t,operation:n}of i6)J&&g.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),ee(GA.tracingChannel(t),r=>a6(r,n,e),{beforeSpanEnd:(r,o)=>{n!=="embeddings"&&$d(r,o.result,Xe(e).recordOutputs)},deferSpanEnd:({span:r,data:o})=>l6(r,o,e)})}))}}));function a6(e,t,n){if(kn(DB))return;if(t!=="chat"){let p=Q();if(p){let{op:u,origin:d}=ie(p);if(d===GB&&u==="gen_ai.chat")return}}let o=(e.arguments??[])[0],{recordInputs:i}=Xe(n),s=nt(n.enableTruncation),c=Qd(t,o,e.self),a=c[Be]||"unknown";c[S]=GB;let l=L({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return i&&o&&Vl(l,o,t,s),l}function c6(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function l6(e,t,n){let r=t.result;if(!c6(r))return!1;let{recordOutputs:o}=Xe(n),i=r[Symbol.asyncIterator].bind(r),s=Wl({[Symbol.asyncIterator]:i},e,o??!1);return r[Symbol.asyncIterator]=()=>s,!0}var BB=s6;import*as iu from"diagnostics_channel";var Zg="auto.graphql.diagnostic_channel",HB="graphql.parse",FB="graphql.validate",WB="graphql.execute",VB="graphql.resolve",YB="graphql.field.name",jB="graphql.field.path",ZB="graphql.field.type",XB="graphql.parent.name",Ci=Symbol.for("opentelemetry.graphql_data"),ru=Symbol.for("opentelemetry.patched");function p6(e){return typeof e?.then=="function"}function Kg(e,t){if(!e||e[ru])return;e[ru]=!0;let n=e.getFields();Object.keys(n).forEach(r=>{let o=n[r];if(o&&(o.resolve&&(o.resolve=UA(t,o.resolve)),o.type))for(let i of qB(o.type))Kg(i,t)})}function UA(e,t,n=!1){if(typeof t!="function"||t[ru])return t;function r(o,i,s,c){if(!t)return;let a=s??{};if(e().ignoreTrivialResolveSpans&&n&&(B(o)||typeof o=="function")&&typeof o[c.fieldName]!="function")return t.call(this,o,i,a,c);if(!a[Ci])return t.call(this,o,i,a,c);let p=g6(c.path),{field:u,spanAdded:d}=u6(a,c,p),m=u.span;return se(m,()=>{try{let _=t.call(this,o,i,a,c);return p6(_)?_.then(h=>(Xg(m,d),h),h=>{throw Xg(m,d,h),h}):(Xg(m,d),_)}catch(_){throw Xg(m,d,_),_}})}return r[ru]=!0,r}function Xg(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function u6(e,t,n){let r=KB(e,n);if(r)return{field:r,spanAdded:!1};let o={span:d6(t,n,f6(e,n))};return m6(e,n,o),{field:o,spanAdded:!0}}function d6(e,t,n){let r={[S]:Zg,[H]:Do,[YB]:e.fieldName,[jB]:t.join("."),[ZB]:e.returnType.toString(),[XB]:e.parentType.name};return L({name:`${VB} ${t.join(".")}`,attributes:r,parentSpan:n})}function m6(e,t,n){let r=e[Ci];r&&(r.fields[t.join(".")]=n)}function KB(e,t){return e[Ci]?.fields[t.join(".")]}function f6(e,t){for(let n=t.length-1;n>0;n--){let r=KB(e,t.slice(0,n));if(r)return r.span}return e[Ci]?.span}function g6(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function qB(e){return"ofType"in e&&e.ofType?qB(e.ofType):_6(e)?e.getTypes():h6(e)?[e]:[]}function _6(e){return"getTypes"in e&&typeof e.getTypes=="function"}function h6(e){return"getFields"in e&&typeof e.getFields=="function"}function QB(e,t){let n=e?.definitions;if(!n||!Array.isArray(n))return;let r=o=>!!o?.operation&&["query","mutation","subscription"].indexOf(o.operation)!==-1;return t?n.filter(r).find(o=>t===o?.name?.value):n.find(r)}var DA={[S]:Zg,[H]:Do};function $B(){return L({name:HB,attributes:{...DA}})}function JB(e){return L({name:FB,attributes:{...DA,[ma]:mc(e)}})}function zB(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:"invalid_argument"})}function b6(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 eH(e,t,n,r){let o=b6(e),{schema:i,document:s}=o,{contextValue:c,fieldResolver:a}=o,l=!!c[Ci];if(!n.ignoreResolveSpans&&!l){let _=a==null,h=t?.defaultFieldResolver,b=a??h;b&&(a=UA(r,b,_)),i&&(Kg(i.getQueryType(),r),Kg(i.getMutationType(),r))}let p=QB(s,o.operationName),u=p?.operation,d=p?.name?.value??o.operationName??void 0,m=L({name:Bf(u,d||void 0,WB),attributes:{...DA,[od]:u,[rd]:d||void 0,[ma]:mc(s)}});return n.useOperationNameForRootSpan&&u&&Df(m,u,d||void 0),c[Ci]={source:s,span:m,fields:{}},o.writeBack(c,a),m}function tH(e,t){Hf(t)&&e.setStatus({code:2,message:"internal_error"})}var nH="Graphql";function y6(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 S6=((e={})=>{let t=y6(e),n=()=>t;return{name:nH,setupOnce(){iu.tracingChannel&&me(()=>{ee(iu.tracingChannel(A.GRAPHQL_PARSE),()=>ou(()=>$B())),ee(iu.tracingChannel(A.GRAPHQL_VALIDATE),r=>ou(()=>JB(r.arguments[1])),{beforeSpanEnd:(r,o)=>{ou(()=>zB(r,o.result))}}),ee(iu.tracingChannel(A.GRAPHQL_EXECUTE),r=>ou(()=>eH(r.arguments,r.self,t,n)),{beforeSpanEnd:(r,o)=>{ou(()=>tH(r,o.result))}})})}}}),E6=S6,rH=e=>{let t=E6(e);return Ht(Gp(e),{name:nH,setupOnce:()=>t.setupOnce?.()})};import*as Qg from"diagnostics_channel";var T6=["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"],Nc=Symbol("hapi-handler-patched"),su={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},oH=new Set(T6),Er=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(Er||{});function I6(e){let t=Q();if(!t)return;let n=Oe(t);n&&ie(n).data[H]==="http.server"&&n.setAttribute(Fe,e)}var BA=e=>typeof e=="string"&&oH.has(e),A6=e=>{let t=e?.type;return t!==void 0&&BA(t)},N6=e=>Array.isArray(e)&&e.length<=3&&BA(e[0])&&typeof e[1]=="function",R6=e=>!Array.isArray(e),v6=(e,t)=>{let n={[Fe]:e.path,[Br]:e.method},r;return t?(n[Er.HAPI_TYPE]=su.PLUGIN,n[Er.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[Er.HAPI_TYPE]=su.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},O6=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[Er.EXT_TYPE]:e,[Er.HAPI_TYPE]:su.EXT,[Er.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[Er.EXT_TYPE]:e,[Er.HAPI_TYPE]:su.EXT},name:r}};function sH(e,t){return Se({name:e.name,op:`${e.attributes[Er.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[S]:"auto.http.orchestrion.hapi"}},t)}function iH(e,t){if(e[Nc]===!0)return e;e[Nc]=!0;let n=r=>function(...o){if(!Q())return r.call(this,...o);I6(e.path);let i=v6(e,t);return sH(i,()=>r.call(this,...o))};if(typeof e.handler=="function")e.handler=n(e.handler);else if(typeof e.options=="function"){let r=e.options;e.options=function(o){let i=r(o);return typeof i.handler=="function"&&(i.handler=n(i.handler)),i}}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(R6(e)){if(e[Nc]===!0)return e;e[Nc]=!0;let r=function(...o){if(!Q())return e.apply(this,o);let i=O6(t,n,e.name);return sH(i,()=>e.apply(void 0,o))};return r[Nc]=!0,r}return e}function aH(e,t){let n=e[0];if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r]=iH(n[r],t);else e[0]=iH(n,t)}function cH(e,t){if(Array.isArray(e[0])){let n=e[0];for(let r=0;r<n.length;r++){let o=n[r];if(BA(o.type)){let i=o,s=qg(i.method,o.type,t);i.method=s,n[r]=i}}return}else if(N6(e)){let n=e,r=n[1],o=qg(r,n[0],t);e[1]=o;return}else if(A6(e[0])){let n=e[0],r=qg(n.method,n.type,t);n.method=r}}var C6="Hapi",x6=(()=>({name:C6,setupOnce(){Qg.tracingChannel&&(J&&g.log(`[orchestrion:hapi] subscribing to channels "${A.HAPI_ROUTE}" / "${A.HAPI_EXT}"`),Qg.tracingChannel(A.HAPI_ROUTE).subscribe({start(e){let t=e;aH(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),Qg.tracingChannel(A.HAPI_EXT).subscribe({start(e){let t=e;cH(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}})),lH=x6;import*as HA from"diagnostics_channel";var P6="Koa",k6="auto.http.orchestrion.koa",$g={ROUTER:"router",MIDDLEWARE:"middleware"},pH=Symbol("sentry.koa.layer-patched"),uH=!1,L6=((e={})=>{let t=e.ignoreLayersType??[];return{name:P6,setupOnce(){!HA.tracingChannel||uH||(uH=!0,J&&g.log(`[orchestrion:koa] subscribing to channel "${A.KOA_USE}"`),HA.tracingChannel(A.KOA_USE).subscribe({start(n){M6(n,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function M6(e,t){let n=e.arguments[0];typeof n=="function"&&(e.arguments[0]=w6(n,t))}function w6(e,t){return e.router?G6(e,t):dH(e,!1,t)}function G6(e,t){let r=e.router?.stack??[];for(let o of r){let i=o.path,s=o.stack;s.forEach((c,a)=>{s[a]=dH(c,!0,t,i)})}return e}function dH(e,t,n,r){let o=t?$g.ROUTER:$g.MIDDLEWARE;return e[pH]===!0||n.includes(o)||e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?e:(e[pH]=!0,(i,s)=>{if(!Q())return e(i,s);let c=U6(i,e,t,r);i._matchedRoute&&D6(i._matchedRoute.toString());let a=c.attributes[sd],l=typeof a=="string"?a||"< unknown >":c.name;return Se({name:l,op:`${o}.koa`,attributes:{...c.attributes,[S]:k6}},()=>{let p=c.attributes[Fe];if($()===vt())J&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");else if(p){let u=i.request?.method?.toUpperCase()||"GET";$().setTransactionName(`${u} ${p}`)}return e(i,s)})})}function U6(e,t,n,r){return n?{attributes:{[sd]:r?.toString(),[Sb]:$g.ROUTER,[Fe]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[sd]:t.name||"middleware",[Sb]:$g.MIDDLEWARE,[zu]:t.name||"middleware"},name:`middleware - ${t.name}`}}function D6(e){let t=Q();if(!t)return;let n=Oe(t);n&&ie(n).data[H]==="http.server"&&n.setAttribute(Fe,e)}var mH=L6;import*as Jg from"diagnostics_channel";var B6="IORedis",H6="auto.db.orchestrion.redis",F6="db.connection_string";function gH(e){return{host:e?.options?.host,port:e?.options?.port}}function _H(e,t){return{[ke]:"redis",[F6]:`redis://${e}:${t}`,[Me]:e,[Pe]:t,[S]:H6}}var fH=new WeakSet;function W6(e){let t=e.arguments?.[0];if(!t||typeof t!="object"||fH.has(t))return;fH.add(t);let{host:n,port:r}=gH(e.self),o=so(t.name,t.args??[]);return L({name:o,op:"db",attributes:{..._H(n,r),[Ye]:o}})}var V6=((e={})=>{let t=e.responseHook;return{name:B6,setupOnce(){if(!Jg.tracingChannel)return;J&&g.log(`[orchestrion:ioredis] subscribing to "${A.IOREDIS_COMMAND}"/"${A.IOREDIS_CONNECT}"`);let n=Jg.tracingChannel(A.IOREDIS_COMMAND),r=Jg.tracingChannel(A.IOREDIS_CONNECT);me(()=>{ee(n,W6,{requiresParentSpan:!0,beforeSpanEnd(o,i){if("error"in i||!t)return;let s=i.arguments?.[0];s&&Y6(t,o,s,i.result)}}),ee(r,o=>{let{host:i,port:s}=gH(o.self);return L({name:"connect",op:"db",attributes:{..._H(i,s),[Ye]:"connect"}})},{requiresParentSpan:!0})})}}});function Y6(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var FA=V6;import*as e_ from"diagnostics_channel";var Rc="messaging.destination.partition.id",WA="messaging.kafka.message.key",VA="messaging.kafka.message.tombstone",hH="messaging.kafka.offset",YA="process",au="receive",bH="send",jA="kafka",yH="_OTHER";var j6="auto.kafkajs.orchestrion.producer",Z6="auto.kafkajs.orchestrion.consumer",X6=1,K6=0;function cu(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function SH(e){let t=cu(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:o}=Rn(t,cu(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:o?X6:K6}}]}function zg({topic:e,message:t,operationType:n,links:r,attributes:o}){let i=n===au?"poll":n;return L({name:`${i} ${e}`,op:"message",kind:n===au?D.CLIENT:D.CONSUMER,links:r,attributes:{...o,[Dt]:jA,[xn]:e,[ur]:n,[_a]:i,[WA]:t?.key?String(t.key):void 0,[VA]:t?.key&&t.value===null?!0:void 0,[hH]:t?.offset,...t?{[S]:Z6}:{}}})}function EH(e,t){let n=L({name:`send ${e}`,op:"message",kind:D.PRODUCER,attributes:{[Dt]:jA,[xn]:e,[WA]:t.key?String(t.key):void 0,[VA]:t.key&&t.value===null?!0:void 0,[Rc]:t.partition!==void 0?String(t.partition):void 0,[_a]:"send",[ur]:bH,[S]:j6}});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 ZA(e,t){let n,r=yH;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(o=>{o.setAttribute(Gr,r),o.setStatus({code:2,message:n})})}function XA(e,t){return Promise.resolve(t).catch(n=>{throw ZA(e,n),n}).finally(()=>{e.forEach(n=>n.end())})}var KA=Symbol("sentry-kafkajs-consumer-callback-wrapped");function qA(e){return typeof e=="function"&&e[KA]===!0}function TH(e){let t=function(r){let o=cu(r.message.headers,"sentry-trace"),i=cu(r.message.headers,"baggage");return vn({sentryTrace:o,baggage:i},()=>{let s=zg({topic:r.topic,message:r.message,operationType:YA,attributes:{[Rc]:String(r.partition)}}),c=se(s,()=>e.call(this,r));return XA([s],c)})};return t[KA]=!0,t}function IH(e){let t=function(r){let o=On(()=>zg({topic:r.batch.topic,message:void 0,operationType:au,attributes:{[fa]:r.batch.messages.length,[Rc]:String(r.batch.partition)}}));return se(o,()=>{let i=[o];r.batch.messages.forEach(c=>{i.push(zg({topic:r.batch.topic,message:c,operationType:YA,links:SH(c.headers),attributes:{[Rc]:String(r.batch.partition)}}))});let s=e.call(this,r);return XA(i,s)})};return t[KA]=!0,t}var q6="Kafka";function Q6(){let e=e_.tracingChannel(A.KAFKAJS_SEND_BATCH),t={start(n){let r=[];(n.arguments[0]?.topicMessages??[]).forEach(o=>{o.messages.forEach(i=>{r.push(EH(o.topic,i))})}),n._sentrySpans=r},error(n){n._sentrySpans&&ZA(n._sentrySpans,n.error)},asyncEnd(n){n._sentrySpans?.forEach(r=>r.end())}};e.subscribe(t)}function $6(){let e=e_.tracingChannel(A.KAFKAJS_CONSUMER_RUN),t={start(n){let r=n.arguments[0];!r||typeof r!="object"||(typeof r.eachMessage=="function"&&!qA(r.eachMessage)&&(r.eachMessage=TH(r.eachMessage)),typeof r.eachBatch=="function"&&!qA(r.eachBatch)&&(r.eachBatch=IH(r.eachBatch)))}};e.subscribe(t)}var J6=(()=>({name:q6,setupOnce(){e_.tracingChannel&&(J&&g.log(`[orchestrion:kafkajs] subscribing to channels "${A.KAFKAJS_SEND_BATCH}", "${A.KAFKAJS_CONSUMER_RUN}"`),Q6(),$6())}})),AH=J6;import*as t_ from"diagnostics_channel";var z6="Knex",e8="auto.db.orchestrion.knex",t8=1021,n8="db.sql.table",r8="sqlite",o8="postgresql",$A=Symbol("sentry.orchestrion.knex.parent-span"),i8=(()=>({name:z6,setupOnce(){t_.tracingChannel&&(J&&g.log(`[orchestrion:knex] subscribing to channel "${A.KNEX_QUERY}"`),me(()=>{QA(A.KNEX_QUERY_BUILDER),QA(A.KNEX_SCHEMA_BUILDER),QA(A.KNEX_RAW),s8()}))}}));function QA(e){t_.tracingChannel(e).end.subscribe(t=>{let n=t.result;if(!n||typeof n!="object"||$A in n)return;let r=Q();r&&Object.defineProperty(n,$A,{value:r})})}function s8(){ee(t_.tracingChannel(A.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[$A]??Q();if(!r)return;let o=e.arguments[0],i=t?.client,s=i?.config?.connection,c=s?.connectionString,a=NH(n),l=o?.method,p=s?.filename||s?.database||u8(c),u={[S]:e8,"knex.version":e.moduleVersion,[ke]:l8(i?.driverName),[n8]:a,[ua]:l,[Ut]:s?.user,[Et]:p,[Me]:s?.host??d8(c),[Pe]:s?.port??m8(c),[ha]:s?.filename===":memory:"?"inproc":void 0,[Ye]:o?.sql!=null?gn(o.sql,t8):void 0};return L({name:p8(p,l,a)??"knex.query",kind:D.CLIENT,op:"db",parentSpan:r,attributes:u})},{beforeSpanEnd(e,t){if("error"in t){let n=a8(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function a8(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 i=c8(e.self)(r.sql,r.bindings||[]);return n.replace(`${i} - `,"")}catch{return n}}function c8(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 l8(e){return e==="sqlite3"?r8:e==="pg"?o8:e}function p8(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function NH(e){let t=e?._single?.table;return t&&typeof t=="object"?NH(t):typeof t=="string"?t:void 0}function u8(e){if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}}function d8(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function m8(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var JA=i8;import*as n_ from"diagnostics_channel";var f8=Da,g8=[Kr,qr,Qr],RH=!1;function vH(){Po(g8)}var _8=((e={})=>({name:f8,setupOnce(){if(!n_.tracingChannel||RH)return;RH=!0;let t=gr(e),n=r=>{vH();let o=r.arguments;if(!Array.isArray(o))return;let i=o[1];(!i||typeof i!="object"||Array.isArray(i))&&(i={},o[1]=i),i.callbacks=ps(i.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}"`),n_.tracingChannel(r).start.subscribe(n);me(()=>{for(let r of mD)J&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),ee(n_.tracingChannel(r),o=>h8(o,e))})}}));function h8(e,t){vH();let n=(e.arguments??[])[0];return L(em(e.self,n,t))}var OH=_8;import*as o_ from"diagnostics_channel";var b8=Fa,CH=!1,r_=!1,y8=((e={})=>({name:b8,setupOnce(){if(!o_.tracingChannel||CH)return;CH=!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),o=>{if(r_)return;let i=zA(o.arguments),s=typeof i?.name=="string"?i.name:void 0;return L(rm(s))},{beforeSpanEnd:(o,i)=>{xH(i.result,zA(i.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(o=>{r_=!0;try{let{arguments:i}=o,s=zA(i);s&&Array.isArray(s.tools)&&s.tools.length>0&&ql(s.tools,t,Wa(i)??void 0)}catch(i){J&&g.error("[orchestrion:langgraph] failed to wrap createReactAgent tools",i)}}),r.end.subscribe(o=>{r_=!1;let{arguments:i,result:s}=o,c=Wa(i)??void 0;xH(s,c?{name:c}:{},t,Kl(i),n)}),r.error.subscribe(()=>{r_=!1})})}}));function zA(e){let t=(e??[])[0];return typeof t=="object"&&t!==null?t:void 0}function xH(e,t,n,r,o){if(!e||typeof e!="object")return;let i=e,s=i.invoke;typeof s=="function"&&(i.invoke=Ql(s.bind(i),i,t,n,r,o))}var PH=y8;import*as eN from"diagnostics_channel";var S8="LruMemoizer",E8=(()=>({name:S8,setupOnce(){eN.tracingChannel&&(J&&g.log(`[orchestrion:lru-memoizer] subscribing to channel "${A.LRU_MEMOIZER_LOAD}"`),me(()=>{ee(eN.tracingChannel(A.LRU_MEMOIZER_LOAD),()=>{})}))}})),kH=E8;import*as lu from"diagnostics_channel";var T8="Mongo",LH="auto.db.orchestrion.mongo",I8=new Set(["insert","update","delete","find","getMore","killCursors"]),A8=(()=>({name:T8,setupOnce(){lu.tracingChannel&&me(()=>{N8(),R8(),v8()})}}));function N8(){ee(lu.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 o=Object.keys(r)[0];return Sr(Up(e.self,n,r,o,LH))},{requiresParentSpan:!0})}function R8(){ee(lu.tracingChannel(A.MONGODB_CHECKOUT),()=>{})}function v8(){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;i_(t,n=>({topology:n[0],ns:n[1],command:n[2]?.[0],operation:e}))}i_(A.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&I8.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?Dp(t):void 0}}),i_(A.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:"find"})),i_(A.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:"getMore"}))}function i_(e,t){ee(lu.tracingChannel(e),n=>{let r=n.arguments;if(!r)return;let o=t(r);if(!(!o||typeof o.ns!="string"))return Sr(Bp(o.ns,o.topology,o.command,o.operation,LH))},{requiresParentSpan:!0})}var MH=A8;import*as pu from"diagnostics_channel";var O8="Mongoose",C8="auto.db.orchestrion.mongoose",tN=new WeakMap,wH=!1,x8=(()=>({name:O8,setupOnce(){pu.tracingChannel&&me(()=>{Wf(pu.tracingChannel),P8()})}}));function P8(){if(!wH){wH=!0,J&&g.log("[orchestrion:mongoose] subscribing to injected channels");for(let e of ND)GH(e).subscribe({start(t){UH(t.self)}});GH(A.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t=="object"&&UH(t)}}),Oc(A.MONGOOSE_QUERY_EXEC,e=>{let t=e;return vc(t.mongooseCollection,t.model?.modelName,t.op??"exec",tN.get(e))}),Oc(A.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return vc(t?.collection,t?.modelName,"aggregate",tN.get(e))}),Oc(A.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return vc(t.collection,t.modelName,"save")}),Oc(A.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return vc(t.collection,t.modelName,"remove")}),Oc(A.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return vc(t.collection,t.modelName,"insertMany")}),Oc(A.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return vc(t.collection,t.modelName,"bulkWrite")})}}function vc(e,t,n,r){return Ho({collection:e,modelName:t,operation:n,origin:C8,parentSpan:r})}function GH(e){return pu.tracingChannel(e)}function Oc(e,t){ee(pu.tracingChannel(e),n=>{let r=n.self;if(r)return t(r)})}function UH(e){let t=Q();e&&t&&tN.set(e,t)}var DH=x8;import*as nN from"diagnostics_channel";var k8="Mysql",L8="db.system",M8="db.connection_string",w8="db.name",G8="db.user",U8="db.statement",D8="net.peer.name",B8="net.peer.port",H8=(()=>({name:k8,setupOnce(){nN.tracingChannel&&(J&&g.log(`[orchestrion:mysql] subscribing to channel "${A.MYSQL_QUERY}"`),me(()=>{ee(nN.tracingChannel(A.MYSQL_QUERY),e=>{let t=W8(e.arguments[0]),{host:n,port:r,database:o,user:i}=V8(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:{[L8]:"mysql",[S]:"auto.db.orchestrion.mysql",[M8]:Y8(n,c?s:void 0,o),...o?{[w8]:o}:{},...i?{[G8]:i}:{},...t?{[U8]:t}:{},...n?{[D8]:n}:{},...c?{[B8]:s}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!="object"||!F8(n))return!1;let r=e._sentryCallerScope;return r&&bn(n,r),n.on("error",o=>t(o)),n.on("end",()=>t()),!0}})}))}}));function F8(e){return"on"in e&&typeof e.on=="function"}function W8(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 V8(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function Y8(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var BH=H8;import*as s_ from"diagnostics_channel";var j8="Mysql2",Z8="auto.db.orchestrion.mysql2",X8="mysql";function K8(){Vf(s_.tracingChannel),HH(A.MYSQL2_QUERY),HH(A.MYSQL2_EXECUTE)}function HH(e){ee(s_.tracingChannel(e),t=>{let n=q8(t.arguments);return L({name:n??"mysql2.query",kind:D.CLIENT,attributes:{[S]:Z8,[H]:"db",[ke]:X8,...$8(t.self?.config),[Ye]:n||void 0}})},{requiresParentSpan:!0})}function q8(e){return Q8(e[0])}function Q8(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 $8(e){let{host:t,port:n,database:r,user:o}=e?.connectionConfig??e??{},i=typeof n=="string"?parseInt(n,10):n,s=typeof i=="number"&&!isNaN(i);return{[Et]:r||void 0,[Ut]:o||void 0,[Me]:t||void 0,[Pe]:s?i:void 0}}var J8=(()=>({name:j8,setupOnce(){s_.tracingChannel&&me(()=>{K8()})}})),FH=J8;import*as rN from"diagnostics_channel";var VH="OpenAI",z8="auto.ai.orchestrion.openai",eee=[{channel:A.OPENAI_CHAT,operation:"chat"},{channel:A.OPENAI_EMBEDDINGS,operation:"embeddings"}],WH=!1,tee=((e={})=>({name:VH,setupOnce(){!rN.tracingChannel||WH||(WH=!0,me(()=>{for(let{channel:t,operation:n}of eee)J&&g.log(`[orchestrion:openai] subscribing to channel "${t}"`),ee(rN.tracingChannel(t),r=>nee(r,n,e),{beforeSpanEnd:(r,o)=>{Ul(r,o.result,Xe(e).recordOutputs)},deferSpanEnd:({span:r,data:o})=>oee(r,o,e)})}))}}));function nee(e,t,n){if(kn(VH))return;let r=e.arguments??[],o=r[0],{recordInputs:i}=Xe(n),s=nt(n.enableTruncation),c=Yd(r,t);c[S]=z8;let a=o?.model||"unknown",l=L({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return i&&o&&Bl(l,o,t,s),l}function ree(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function oee(e,t,n){let r=t.result;if(!ree(r))return!1;let{recordOutputs:o}=Xe(n),i=r[Symbol.asyncIterator].bind(r),s=Dl({[Symbol.asyncIterator]:i},e,o??!1);return r[Symbol.asyncIterator]=()=>s,!0}var YH=tee;import*as iN from"diagnostics_channel";var iee="Postgres",see="auto.db.orchestrion.postgres",jH="db.system",ZH="db.name",XH="db.connection_string",KH="db.user",aee="db.statement",qH="net.peer.name",QH="net.peer.port",cee="db.postgresql.plan",lee="db.postgresql.idle.timeout.millis",pee="db.postgresql.max.client",$H="postgresql",uee="pg.query",dee="pg.connect",mee="pg-pool.connect",fee=((e={})=>({name:iee,setupOnce(){iN.tracingChannel&&me(()=>{oN(A.PG_QUERY,gee,{deferStreamedResult:!0}),e.ignoreConnectSpans||(oN(A.PG_CONNECT,_ee),oN(A.PGPOOL_CONNECT,hee))})}}));function oN(e,t,{deferStreamedResult:n=!1}={}){J&&g.log(`[orchestrion:pg] subscribing to channel "${e}"`),ee(iN.tracingChannel(e),r=>(r._sentryCallerScope=ne(),L({...t(r),kind:D.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:r,end:o}){let i=r.result;if(!i||typeof i!="object"||!bee(i))return!1;let s=r._sentryCallerScope;return s&&bn(i,s),i.on("error",c=>o(c)),i.on("end",()=>o()),!0}}:{requiresParentSpan:!0})}function gee(e){let t=e.self?.connectionParameters??{},n=yee(e.arguments);return{name:n?.text??uee,op:"db",attributes:{...JH(t),[S]:see,[aee]:n?.text||void 0,[cee]:typeof n?.name=="string"?n.name:void 0}}}function _ee(e){let t=e.self?.connectionParameters??{};return{name:dee,op:"db",attributes:JH(t)}}function hee(e){let t=e.self?.options??{};return{name:mee,op:"db",attributes:See(t)}}function bee(e){return"on"in e&&typeof e.on=="function"}function yee(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 JH(e){return{[jH]:$H,[XH]:zH(e),[ZH]:e.database,[KH]:e.user,[qH]:e.host,[QH]:Number.isInteger(e.port)?e.port:void 0}}function See(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,o=Number(t?.port)||(Number.isInteger(e.port)?e.port:void 0),i=t?.username||e.user;return{[jH]:$H,[XH]:zH(e),[lee]:e.idleTimeoutMillis,[pee]:e.max,[ZH]:n,[QH]:o,[qH]:r||void 0,[KH]:i||void 0}}function zH(e){if(e.connectionString)try{let o=new URL(e.connectionString);return o.username="",o.password="",o.toString()}catch{return"postgresql://localhost:5432/"}let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}var eF=fee;import*as Cc from"diagnostics_channel";var Eee="PostgresJs",Tee="auto.db.orchestrion.postgresjs",Iee="db.response.status_code",$n=()=>{},Aee=Symbol.for("sentry.query.from.instrumented.sql"),rF=Symbol("sentryPostgresJsSpan"),tF=Symbol("sentryPostgresJsConnectionAttrsSet"),oF=Symbol("sentryPostgresJsSpanEnded"),iF=new WeakMap,a_=[];function Nee(e){a_.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)||a_.push(e)}function Ree(){return a_.length===1?a_[0]:void 0}function vee(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!="object"||!n)return;let r=Em(n);iF.set(t,r),Nee(r)}function sF(e,t,n){let r=t;r[tF]||(r[tF]=!0,Sm(e,n))}function nF(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[rF],o=iF.get(t);r&&o&&sF(r,n,o)}function Oee(e,t,n){let r=e.self;if(!r)return;let o=()=>{e[oF]=!0},i=r.resolve;typeof i=="function"&&(r.resolve=function(...c){o();try{let a=c[0]?.command;ja(t,n,a),t.end()}catch(a){J&&g.error("[orchestrion:postgresjs] error ending span in resolve:",a)}return i.apply(this,c)});let s=r.reject;typeof s=="function"&&(r.reject=function(...c){o();try{let a=c[0];t.setStatus({code:2,message:a?.message||"unknown_error"}),t.setAttribute(Iee,a?.code||"unknown"),t.setAttribute(Gr,a?.name||"unknown"),ja(t,n),t.end()}catch(a){J&&g.error("[orchestrion:postgresjs] error ending span in reject:",a)}return s.apply(this,c)})}var Cee=((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:Eee,setupOnce(){Cc.tracingChannel&&(J&&g.log(`[orchestrion:postgresjs] subscribing to "${A.POSTGRESJS_HANDLE}"`),Cc.tracingChannel(A.POSTGRESJS_CONNECTION).subscribe({start:$n,asyncStart:$n,asyncEnd:$n,error:$n,end:vee}),Cc.tracingChannel(A.POSTGRESJS_EXECUTE).subscribe({end:$n,asyncStart:$n,asyncEnd:$n,error:$n,start:nF}),Cc.tracingChannel(A.POSTGRESJS_CONNECT).subscribe({end:$n,asyncStart:$n,asyncEnd:$n,error:$n,start:nF}),me(()=>{ee(Cc.tracingChannel(A.POSTGRESJS_HANDLE),r=>{let o=r.self;if(!o||o.executed===!0||o[Aee])return;let i=ym(o.strings),s=Za(i),c=L({name:s||"postgresjs.query",op:"db",kind:D.CLIENT,attributes:{[S]:Tee,[dt]:"postgres",[wr]:s}});o[rF]=c;let a=Ree();if(a&&sF(c,o,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 Oee(r,c,s),c},{requiresParentSpan:t!==!1,deferSpanEnd({data:r}){return r[oF]?!0:!("error"in r)}})}))}}}),aF=Cee;import{EventEmitter as xee}from"events";import*as l_ from"diagnostics_channel";var Pee="Tedious",kee="auto.db.orchestrion.tedious",Lee="mssql",Mee="db.sql.table",lF=Symbol("sentry.orchestrion.tedious.current-database");function c_(e){Object.defineProperty(this,lF,{value:e,writable:!0,configurable:!0})}function cF(){this.removeListener("databaseChange",c_)}function wee(){l_.tracingChannel(A.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(c_.call(t,t.config?.options?.database),t.removeListener("databaseChange",c_),t.on("databaseChange",c_),t.removeListener("end",cF),t.once("end",cF))})}function xc(e,t){l_.tracingChannel(e).start.subscribe(n=>{let r=n,o=r.self,i=r.arguments[0];if(!o||!(i instanceof xee))return;let s=0,c=0,a=()=>{c++},l=()=>{s++},p=o[lF],u=Gee(i),d={[S]:kee,[ke]:Lee,[Et]:p,[Ut]:o.config?.userName??o.config?.authentication?.options?.userName,[Ye]:u,[Mee]:i.table,[Me]:o.config?.server,[Pe]:o.config?.options?.port},m=L({name:Uee(t,p,u,i.table),kind:D.CLIENT,op:"db",attributes:d}),_=Dee(h=>{i.removeListener("done",a),i.removeListener("doneInProc",a),i.removeListener("doneProc",l),i.removeListener("error",_),o.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(i.on("done",a),i.on("doneInProc",a),i.on("doneProc",l),i.once("error",_),o.on("end",_),typeof i.callback=="function"){let h=i.callback;i.callback=function(...b){return _(b[0]),h.apply(this,b)}}})}function Gee(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 Uee(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 Dee(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var Bee=(()=>({name:Pee,setupOnce(){l_.tracingChannel&&(J&&g.log(`[orchestrion:tedious] subscribing to channel "${A.TEDIOUS_EXEC_SQL}"`),me(()=>{wee(),xc(A.TEDIOUS_EXEC_SQL,"execSql"),xc(A.TEDIOUS_EXEC_SQL_BATCH,"execSqlBatch"),xc(A.TEDIOUS_CALL_PROCEDURE,"callProcedure"),xc(A.TEDIOUS_EXEC_BULK_LOAD,"execBulkLoad"),xc(A.TEDIOUS_PREPARE,"prepare"),xc(A.TEDIOUS_EXECUTE,"execute")}))}})),pF=Bee;import*as uN from"diagnostics_channel";var uF=Symbol("SentryVercelAiModelPatched"),dF=Symbol("SentryVercelAiToolPatched"),Hee=0;function p_(){return`v6-${++Hee}`}var u_=new WeakMap,hF=new WeakSet,bF=new WeakSet,lN=new WeakMap,pN=new WeakMap,aN=new WeakMap,yF=new WeakSet,mF=!1;function SF(e,t={}){if(!mF){mF=!0;try{Pc(e,A.VERCEL_AI_GENERATE_TEXT,sN("generateText"),t),Pc(e,A.VERCEL_AI_STREAM_TEXT,sN("streamText"),t),Pc(e,A.VERCEL_AI_GENERATE_OBJECT,sN("generateObject"),t),Pc(e,A.VERCEL_AI_EMBED,(n,r)=>({type:"embed",event:{callId:p_(),...cN(n.model),maxRetries:n.maxRetries,value:n.value,...uu(r)}}),t),Pc(e,A.VERCEL_AI_EMBED_MANY,(n,r)=>({type:"embedMany",event:{callId:p_(),...cN(n.model),maxRetries:n.maxRetries,values:n.values,...uu(r)}}),t),Pc(e,A.VERCEL_AI_EXECUTE_TOOL_CALL,(n,r)=>({type:"executeTool",event:{callId:p_(),toolCall:n.toolCall,tools:n.tools,...uu(r)}}),t),Yee(e,A.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{J&&g.log("Vercel AI orchestrion channel subscription failed.")}}}function Pc(e,t,n,r){let o=e(t),i=s=>{let c=B(s.arguments[0])?s.arguments[0]:{},a=B(c.experimental_telemetry)?c.experimental_telemetry:{};if(a.isEnabled===!1&&!yF.has(a))return;let l=n(c,a);Vee(c,a);let p=Q(),u=Fp(l,r);if(u){u_.set(s,l),hF.add(u);let d=B(c.model)&&c.model.specificationVersion==="v1";aN.set(u,{callSiteSpan:p,toolErrorsBubbleToCaller:d}),l.type==="executeTool"&&bF.add(u);let m=We(l.event.callId);m&&lN.set(u,m),pN.set(u,uu(a)),B(c.tools)&&jee(c.tools,r),d&&TF(c.model,r)}return u};ee(o,s=>i(s),{beforeSpanEnd:(s,c)=>{let a=u_.get(c);if(a){if("error"in c){let l=aN.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,_c(s,a,r);a.type!=="streamText"&&PT(a),u_.delete(c)}},deferSpanEnd:({data:s,end:c})=>Fee(s,c)})}function Fee(e,t){if(u_.get(e)?.type!=="streamText"||"error"in e||!Wee(e.result))return!1;let n=e.result;return(async()=>{try{let[r,o,i,s,c]=await Promise.all([n.totalUsage??n.usage,n.text,n.toolCalls,n.finishReason,n.response]);e.result={usage:r,text:o,toolCalls:i,finishReason:s,response:c},t()}catch(r){t(r)}})(),!0}function Wee(e){return B(e)&&(fF(e.totalUsage)||fF(e.usage))}function fF(e){return B(e)&&typeof e.then=="function"}function Vee(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};yF.add(n),e.experimental_telemetry=n}function Yee(e,t,n){e(t).subscribe({end(r){let o=r;B(o.result)&&TF(o.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function EF(){let e=Q();return e&&hF.has(e)?e:void 0}function TF(e,t){e[uF]||(e[uF]=!0,gF(e,"doGenerate",t),gF(e,"doStream",t))}function gF(e,t,n){let r=e[t];typeof r=="function"&&(e[t]=function(...o){let i=EF();if(!i)return Promise.resolve(r.apply(this,o));let s=B(o[0])?o[0]:{},c=lN.get(i),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,...pN.get(i)}},l=se(i,()=>Fp(a,n));if(!l)return Promise.resolve(r.apply(this,o));let p=()=>{t==="doStream"&&c&&kT(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,o)).then(m=>t==="doStream"&&B(m)&&Xf(m.stream)?(m.stream=Kf(m.stream,_=>{a.result={...m,...LT(_)},_c(l,a,n),l.end(),p()},_=>{l.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),l.end(),p()}),m):(a.result=m,_c(l,a,n),l.end(),p(),m),u)}catch(d){return u(d)}})}function jee(e,t){try{for(let[n,r]of Object.entries(e))B(r)&&Zee(n,r,e,t)}catch{J&&g.log("Vercel AI orchestrion tool patching failed.")}}function Zee(e,t,n,r){let o=t.execute;typeof o!="function"||t[dF]||(t[dF]=!0,t.execute=function(i,...s){let c=EF();if(!c||bF.has(c))return o.apply(this,[i,...s]);let a=B(s[0])?s[0]:{},l={type:"executeTool",event:{callId:lN.get(c),toolCall:{toolName:e,toolCallId:We(a.toolCallId),input:i},tools:n,...pN.get(c)}},p=se(c,()=>Fp(l,r));if(!p)return o.apply(this,[i,...s]);let u=d=>{throw aN.get(c)?.toolErrorsBubbleToCaller?p.setStatus({code:2,message:d instanceof Error?d.message:"tool_error"}):MT(p,l,d),p.end(),d};try{return Promise.resolve(o.apply(this,[i,...s])).then(m=>(l.result={output:m},_c(p,l,r),p.end(),m),u)}catch(d){return u(d)}})}function sN(e){return(t,n)=>({type:e,event:{callId:p_(),operationId:`ai.${e}`,functionId:We(n.functionId),...cN(t.model),maxRetries:t.maxRetries,instructions:We(t.system),messages:Xee(t),...uu(n)}})}function Xee(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt=="string"?[{role:"user",content:e.prompt}]:e.messages??e.prompt}function uu(e){let t=e.isEnabled===!0?!0:void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function cN(e){return{provider:_F(e,"provider"),modelId:_F(e,"modelId")}}function _F(e,t){return B(e)?We(e[t]):void 0}var Kee=((e={})=>{let t=Wp(e);return Ht(t,{options:e,setupOnce(){uN.tracingChannel&&me(()=>{SF(uN.tracingChannel,e)})}})}),IF=Kee;import*as dN from"diagnostics_channel";var RF=new WeakMap;function vF(e,t){RF.set(e,t)}function OF(e){return RF.get(e)}var AF=new WeakMap;function d_(e){let t=AF.get(e);return t||(t=[],AF.set(e,t)),t}function CF(e,t){d_(e).push(t)}function xF(e){d_(e).pop()}function PF(e){let t=e[0];return Array.isArray(t)?t.map(n=>NF(n)??"").join(","):NF(t)}function NF(e){return typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0}function kF(e){let t=d_(e),n="";for(let r of t)r==="/"||r==="/*"||(n+=!n||n.endsWith("/")?r:`/${r}`);return n.replace(/\/{2,}/g,"/")}function LF(e,t){let n=d_(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 o=t.startsWith("/")?t:`/${t}`;return o.length>0&&(r===o||r.startsWith(o)||qee(o))?o:void 0}function qee(e){return e.includes(":")||e.includes("*")}var Qee="auto.http.express",$ee="express.name",Jee="express.type",xi=()=>{},MF=!1;function wF(e,t){if(!MF){MF=!0;for(let n of[A.EXPRESS_REGISTER,A.ROUTER_REGISTER])t(n).subscribe({start:xi,asyncStart:xi,asyncEnd:xi,error:xi,end:zee});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,o=>tte(o,e),{beforeSpanEnd(o,i){i._sentryCleanup?.()}}),r.subscribe({start:xi,asyncEnd:xi,end:xi,error:xi,asyncStart:ete})}}}function zee(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&vF(n,PF(e.arguments??[]))}function ete(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&xF(t)}function tte(e,t){let n=e.self,r=e.arguments;if(!n||!Array.isArray(r)||n.handle?.length===4||n.method&&!n.route)return;let o=r[0],i=r[1];if(!o||!Q())return;let s=nte(n),c=OF(n);c!=null&&(CF(o,c),e._sentryStoredLayer=!0);let a=s==="request_handler"?kF(o):void 0,l=s==="request_handler"&&a!=null?LF(o,a):void 0,p=s==="request_handler"?a||"request handler":s==="router"?n.path??"/":n.name??"<anonymous>";if(l&&rte(l),s==="request_handler"&&a){let d=$();if(d!==vt()){let m=typeof o.method=="string"?o.method.toUpperCase():"GET";d.setTransactionName(`${m} ${a}`)}else J&&g.warn("[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name")}if(ote(p,s,t))return;let u=L({name:p,attributes:{[S]:Qee,[H]:`${s}.express`,[$ee]:p,[Jee]:s,...l?{[Fe]:l}:{}}});if(i&&typeof i.once=="function"){let d=()=>{i.removeListener("finish",m),i.removeListener("close",_)},m=()=>{d(),u.end()},_=()=>{d(),u.setStatus({code:2,message:"cancelled"}),u.end()};i.once("finish",m),i.once("close",_),e._sentryCleanup=d}return u}function nte(e){return e.name==="router"?"router":e.name==="bound dispatch"||e.name==="handle"?"request_handler":"middleware"}function rte(e){let t=Q(),n=t&&Oe(t);n&&ie(n).data[H]==="http.server"&&n.setAttribute(Fe,e)}function ote(e,t,n){let{ignoreLayers:r,ignoreLayersType:o}=n;if(Array.isArray(o)&&o.includes(t))return!0;if(!Array.isArray(r))return!1;try{return _n(e,r,!0)}catch{return!1}}var ite="Express",ste=((e={})=>({name:ite,setupOnce(){dN.tracingChannel&&me(()=>{wF(e,dN.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})),GF=ste;import*as YF from"diagnostics_channel";import*as mN from"diagnostics_channel";import*as UF from"net";function DF(e,t){return L({name:`${e} ${t.path}`,op:"db.query",kind:D.CLIENT,attributes:{[S]:"auto.firebase.orchestrion.firestore",[pr]:e,...cte(t)}})}function ate(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(UF.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 cte(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},o={[pa]:e.path,[Io]: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:i,port:s}=ate(r);return i&&(o[_t]=i),s&&(o[ht]=s),o}var BF="auto.firebase.orchestrion.functions",HF="__sentryFirebaseWrapped";function FF(e,t){let n=e.arguments;if(!Array.isArray(n)||n.length===0)return;let r=typeof n[0]=="function"?0:1,o=n[r];typeof o!="function"||o[HF]||(n[r]=lte(o,t))}function lte(e,t){let n=async function(...r){let o=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",i={[S]:BF,[j0]:o,[ed]:t,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(i["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(i["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),Le({name:`firebase.function.${t}`,op:"function.firebase",kind:D.SERVER,attributes:i},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:BF,handled:!1}}),s.end(),await es(2e3),c}})};return n[HF]=!0,n}var pte=[{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}],ute=[{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"}],m_=()=>{};function WF(e){try{return e()}catch(t){J&&g.warn("[orchestrion:firebase] error handling channel event",t);return}}function VF(){for(let{channel:e,spanName:t,useParent:n}of pte)ee(mN.tracingChannel(e),r=>WF(()=>{let o=r.arguments[0];if(!o)return;let i=n&&o.parent||o;return DF(t,i)}));for(let{channel:e,triggerType:t}of ute)mN.tracingChannel(e).subscribe({start:n=>{WF(()=>FF(n,t))},end:m_,asyncStart:m_,asyncEnd:m_,error:m_})}var dte="Firebase",mte=(()=>({name:dte,setupOnce(){YF.tracingChannel&&me(()=>{VF()})}})),jF=mte;function du(){return!!te.__SENTRY_ORCHESTRION__}function fN(){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 kc from"diagnostics_channel";var fte="RedisChannel",_N="auto.db.orchestrion.redis",KF="db.connection_string",hN="redis";function ZF(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function qF(e,t,n,r,o){if(e)try{e(t,n,r,o)}catch{}}function gte(e){let t=e[0];return B(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function _te(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 QF(e){return{[ke]:hN,[Me]:e?.socket?.host,[Pe]:e?.socket?.port,[KF]:_te(e?.url),[S]:_N}}function $F(e,t,n){return L({name:`redis-${e}`,kind:D.CLIENT,attributes:{...n,[H]:"db",[Ye]:so(e,t)}})}function hte(e){let t=kc.tracingChannel(A.REDIS_COMMAND),n=()=>{};t.subscribe({end:n,asyncStart:n,asyncEnd:n,start(r){let o=r.arguments?.[0];if(!o||typeof o!="object")return;let i=o.callback;if(typeof i!="function")return;let s=r.self,c={[ke]:hN,[S]:_N};c[Me]=s?.connection_options?.host,c[Pe]=s?.connection_options?.port,s?.address&&(c[KF]=`redis://${s.address}`);let a=$F(o.command,o.args??[],c);r._sentrySpan=a;let l=Q();o.callback=function(p,u){p||qF(e,a,o.command,o.args??[],u),ZF(a,p);let d=arguments;return se(l??null,()=>i.apply(this,d))}},error(r){let o=r._sentrySpan;o&&ZF(o,r.error)}})}function XF(e,t,n){let r=kc.tracingChannel(e);ee(r,o=>{let i=t(o);if(!i?.length)return;let s=String(i[0]),c=o.self?.options;return $F(s,i.slice(1),QF(c))},{beforeSpanEnd(o,i){if("error"in i||!n)return;let s=t(i);s?.length&&qF(n,o,String(s[0]),s.slice(1),i.result)}})}function bte(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function yte(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(!(typeof t?.transformArguments!="function"||!Array.isArray(n)))try{return t.transformArguments(...gte(n))}catch{return}}function Ste(){let e=kc.tracingChannel(A.NODE_REDIS_CONNECT);ee(e,t=>{let n=t.self?.options;return L({name:"redis-connect",kind:D.CLIENT,attributes:{...QF(n),[H]:"db"}})})}function gN(e,t){let n=kc.tracingChannel(e);ee(n,r=>{let o=r.arguments?.[0],i=Array.isArray(o)?o.length:void 0,s=r.self?.options?.socket;return L({name:t(r),kind:D.CLIENT,attributes:{[S]:_N,[H]:"db.redis",[dt]:hN,...i&&i>1?{[da]:i}:{},...s?.host!=null?{[_t]:s.host}:{},...s?.port!=null?{[ht]:s.port}:{}}})})}var Ete=((e={})=>{let t=e.responseHook;return{name:fte,setupOnce(){kc.tracingChannel&&(J&&g.log(`[orchestrion:redis] subscribing to "${A.REDIS_COMMAND}" and node-redis channels`),hte(t),me(()=>{XF(A.NODE_REDIS_COMMAND,bte,t),XF(A.NODE_REDIS_EXECUTOR,yte,t),Ste(),gN(A.NODE_REDIS_MULTI,()=>"MULTI"),gN(A.NODE_REDIS_PIPELINE,()=>"PIPELINE"),gN(A.NODE_REDIS_BATCH,n=>n.arguments?.[2]!==void 0?"MULTI":"PIPELINE")}))}}}),bN=Ete;var yN={postgresIntegration:eF,postgresJsIntegration:aF,mongoIntegration:MH,mysqlIntegration:BH,mysql2Integration:FH,genericPoolIntegration:wB,mongooseIntegration:DH,lruMemoizerIntegration:kH,openaiIntegration:YH,anthropicIntegration:bB,googleGenAIIntegration:BB,langChainIntegration:OH,langGraphIntegration:PH,vercelAiIntegration:IF,amqplibIntegration:gB,hapiIntegration:lH,koaIntegration:mH,expressIntegration:GF,graphqlIntegration:rH,kafkajsIntegration:AH,tediousIntegration:pF,awsIntegration:xB,firebaseIntegration:jF};var JF="Knex",Tte=fe(JF,()=>new Pg),Ite=(()=>({name:JF,setupOnce(){du()?JA().setupOnce?.():Tte()}})),Ate=Ite;import{EventEmitter as Nte}from"events";var zF="db.sql.table",e2="mssql";function t2(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 n2=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};var Rte="@sentry/instrumentation-tedious",o2=Symbol("opentelemetry.instrumentation-tedious.current-database"),r2=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function f_(e){Object.defineProperty(this,o2,{value:e,writable:!0})}var i2=class s2 extends le{constructor(t={}){super(Rte,q,t)}init(){return[new re(s2.COMPONENT,[">=1.11.0 <20"],t=>{let n=t.Connection.prototype;for(let r of r2)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 r2)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(t){return function(){return f_.call(this,this.config?.options?.database),this.removeListener("databaseChange",f_),this.on("databaseChange",f_),this.once("end",()=>{this.removeListener("databaseChange",f_)}),t.apply(this,arguments)}}_patchQuery(t){return n=>{let r=this;function o(i){if(!(i instanceof Nte))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[o2],u=(h=>h.sqlTextOrProcedure==="sp_prepare"&&h.parametersByName?.stmt?.value?h.parametersByName.stmt.value:h.sqlTextOrProcedure)(i),d={[S]:"auto.db.otel.tedious",[ke]:e2,[Et]:p,[Ut]:this.config?.userName??this.config?.authentication?.options?.userName,[Ye]:u,[zF]:i.table,[Me]:this.config?.server,[Pe]:this.config?.options?.port},m=L({name:t2(t,p,u,i.table),kind:D.CLIENT,attributes:d}),_=n2(h=>{i.removeListener("done",a),i.removeListener("doneInProc",a),i.removeListener("doneProc",l),i.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 i.on("done",a),i.on("doneInProc",a),i.on("doneProc",l),i.once("error",_),this.on("end",_),typeof i.callback=="function"?r._wrap(i,"callback",r._patchCallbackQuery(_)):r._diag.error("Expected request.callback to be a function"),se(m,()=>n.apply(this,arguments))}return Object.defineProperty(o,"length",{value:n.length,writable:!1}),o}}_patchCallbackQuery(t){return n=>function(r,o,i){return t(r),n.apply(this,arguments)}}};i2.COMPONENT="tedious";var a2=i2;var c2="Tedious",SN=fe(c2,()=>new a2({})),vte=(()=>({name:c2,setupOnce(){SN()}})),EN=vte;var TN="generic-pool",Ote="@sentry/instrumentation-generic-pool",g_=class extends le{constructor(t={}){super(Ote,q,t),this._isDisabled=!1}init(){return[new re(TN,[">=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(TN,[">=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(TN,[">=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(...i){let s=t.apply(this,i);return n(s,"acquire",r),s}}_acquireWithCallbacksPatcher(t){let n=()=>this._isDisabled;return function(o,i){return n()?t.call(this,o,i):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(),o&&o(c,a)},i)})}}};var l2="GenericPool",IN=fe(l2,()=>new g_({})),Cte=(()=>({name:l2,setupOnce(){IN()}})),AN=Cte;var RN="dataloader",xte="@sentry/instrumentation-dataloader",Lc="auto.db.otel.dataloader";function Pte(e){return e[Symbol.toStringTag]==="Module"}function p2(e){return Pte(e)?e.default:e}function Mc(e,t){let n=e.name;return n?`${RN}.${t} ${n}`:`${RN}.${t}`}function wc(e){if(e==="load"||e==="loadMany"||e==="batch")return"cache.get"}function NN(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}var __=class extends le{constructor(t={}){super(xte,q,t)}init(){return[new re(RN,[">=2.0.0 <3"],t=>{let n=p2(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=p2(t);["load","loadMany","prime","clear","clearAll"].forEach(r=>{w(n.prototype[r])&&this._unwrap(n.prototype,r)})})]}_wrapBatchLoadFn(t){let n=this;return function(...o){return n.isEnabled()?Se({name:Mc(this,"batch"),links:this._batch?.spanLinks,attributes:{[S]:Lc,[H]:wc("batch"),[la]:NN(o[0])},onlyIfParent:!0},()=>t.apply(this,o)):t.call(this,...o)}}_getPatchedConstructor(t){let n=this,r=t.prototype;if(!n.isEnabled())return t;function o(...i){return typeof i[0]=="function"&&(w(i[0])&&n._unwrap(i,0),i[0]=n._wrapBatchLoadFn(i[0])),t.apply(this,i)}return o.prototype=r,o}_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:Mc(this,"load"),kind:D.CLIENT,attributes:{[S]:Lc,[H]:wc("load"),[la]:NN(r[0])},onlyIfParent:!0},o=>{let i=t.call(this,...r);return this._batch&&o.isRecording()&&(this._batch.spanLinks||(this._batch.spanLinks=[]),this._batch.spanLinks.push({context:o.spanContext()})),i})}}_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:Mc(this,"loadMany"),kind:D.CLIENT,attributes:{[S]:Lc,[H]:wc("loadMany"),[la]:NN(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:Mc(this,"prime"),kind:D.CLIENT,attributes:{[S]:Lc,[H]:wc("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:Mc(this,"clear"),kind:D.CLIENT,attributes:{[S]:Lc,[H]:wc("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:Mc(this,"clearAll"),kind:D.CLIENT,attributes:{[S]:Lc,[H]:wc("clearAll")},onlyIfParent:!0},()=>t.call(this,...r))}}};var u2="Dataloader",kte=fe(u2,()=>new __),Lte=(()=>({name:u2,setupOnce(){du()?MA().setupOnce?.():kte()}})),Mte=Lte;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 d2="messaging.operation",vN="messaging.destination",ON="messaging.destination_kind",CN="messaging.rabbitmq.routing_key",xN="messaging.protocol",m2="messaging.protocol_version",f2="messaging.url",PN="messaging.message_id",kN="messaging.conversation_id",LN="topic",g2="process";var wte="auto.amqplib.otel.publisher",Gte="auto.amqplib.otel.consumer",h_=Symbol("opentelemetry.amqplib.message.stored-span"),Pi=Symbol("opentelemetry.amqplib.channel.spans-not-ended"),b_=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer"),y_=Symbol("opentelemetry.amqplib.connection.attributes"),S_=Symbol("sentry.amqplib.channel.is-confirm-publishing"),Ute=e=>e!==""?e:"<default>",Dte=e=>e.replace(/:[^:@/]*@/,":***@"),_2=(e,t)=>e||(t==="AMQP"?5672:5671),h2=e=>{let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()},b2=e=>e||"localhost",y2=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[Dt]:t}:{}},S2=e=>{let t={[m2]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,o=h2(r?.protocol);t[xN]=o,t[Me]=b2(r?.hostname),t[Pe]=_2(r.port,o)}else{let r=Dte(n);t[f2]=r;try{let o=new URL(r),i=h2(o.protocol);t[xN]=i,t[Me]=b2(o.hostname),t[Pe]=_2(o.port?parseInt(o.port):void 0,i)}catch{}}return t};function MN(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}function wN(e,t,n,r){let o=Ute(e),i=L({name:`publish ${o}`,kind:gt.PRODUCER,attributes:{...n.connection[y_],[vN]:e,[ON]:LN,[CN]:t,[PN]:r?.messageId,[kN]:r?.correlationId,[S]:wte}}),s=r??{};s.headers=s.headers??{};let c=tt({span:i});return c["sentry-trace"]&&(s.headers["sentry-trace"]=c["sentry-trace"]),c.baggage&&(s.headers.baggage=c.baggage),{span:i,modifiedOptions:s}}function E2(e,t,n){return L({name:`${e} process`,kind:gt.CONSUMER,attributes:{...n?.connection?.[y_],[vN]:t.fields?.exchange,[ON]:LN,[CN]:t.fields?.routingKey,[d2]:g2,[PN]:t?.properties.messageId,[kN]:t?.properties.correlationId,[S]:Gte}})}var T2=1e3*60;function mu(e,t,n,r){let o=e[h_];o&&(t!==!1&&o.setStatus({code:2,message:n!==dn.ChannelClosed&&n!==dn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),o.end(),e[h_]=void 0)}function GN(e,t,n,r){(e[Pi]??[]).forEach(i=>{mu(i.msg,t,n,r)}),e[Pi]=[]}function Bte(e){let t=lt(),n=e[Pi]??[],r;for(r=0;r<n.length;r++){let o=n[r];if((t-o.timeOfConsume)*1e3<T2)break;mu(o.msg,null,dn.InstrumentationTimeout,!0)}n.splice(0,r)}function I2(e){return function(n,r,o){return e.call(this,n,r,function(i,s){if(i==null){let c=S2(n),a=y2(s);s[y_]={...c,...a}}o.apply(this,arguments)})}}function A2(e){return function(n){if(n==="close"){GN(this,!0,dn.ChannelClosed,void 0);let r=this[b_];r&&clearInterval(r),this[b_]=void 0}else n==="error"&&GN(this,!0,dn.ChannelError,void 0);return e.apply(this,arguments)}}function UN(e,t){return n=>function(o){return GN(this,e,t,o),n.apply(this,arguments)}}function E_(e,t){return n=>function(o,i,s){let c=this,a=t===dn.Reject?i:s,l=c[Pi]??[],p=l.findIndex(u=>u.msg===o);if(p<0)mu(o,e,t,a);else if(t!==dn.Reject&&i){for(let u=0;u<=p;u++)mu(l[u].msg,e,t,a);l.splice(0,p+1)}else mu(o,e,t,a),l.splice(p,1);return n.apply(this,arguments)}}function N2(e){return function(n,r,o){let i=this;if(!Object.prototype.hasOwnProperty.call(i,Pi)){let a=setInterval(()=>{Bte(i)},T2);a.unref(),i[b_]=a,i[Pi]=[]}let s=function(a){if(!a)return r.call(this,a);let l=a.properties.headers??{},p=MN(l,"sentry-trace"),u=MN(l,"baggage");vn({sentryTrace:p,baggage:u},()=>{let d=E2(n,a,i);o?.noAck||(i[Pi].push({msg:a,timeOfConsume:lt()}),a[h_]=d),se(d,()=>{r.call(this,a)}),o?.noAck&&d.end()})},c=Array.prototype.slice.call(arguments);return c[1]=s,e.apply(this,c)}}function R2(e){return function(n,r,o,i,s){let c=this,{span:a,modifiedOptions:l}=wN(n,r,c,i),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[S_]=!0;try{return e.apply(this,u)}finally{c[S_]=!1}}}function v2(e){return function(n,r,o,i){if(this[S_])return e.apply(this,arguments);let s=this,{span:c,modifiedOptions:a}=wN(n,r,s,i),l=[...arguments];l[3]=a;let p=e.apply(this,l);return c.end(),p}}var Hte="@sentry/instrumentation-amqplib",T_=[">=0.5.5 <2"],I_=class extends le{constructor(t={}){super(Hte,q,t)}init(){let t=new Re("amqplib/lib/channel_model.js",T_,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Re("amqplib/lib/callback_model.js",T_,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Re("amqplib/lib/connect.js",T_,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new re("amqplib",T_,void 0,void 0,[t,r,n])}patchConnect(t){let n=this.unpatchConnect(t);return w(n.connect)||this._wrap(n,"connect",I2),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",v2),w(t.Channel.prototype.consume)||this._wrap(t.Channel.prototype,"consume",N2),w(t.Channel.prototype.ack)||this._wrap(t.Channel.prototype,"ack",E_(!1,dn.Ack)),w(t.Channel.prototype.nack)||this._wrap(t.Channel.prototype,"nack",E_(!0,dn.Nack)),w(t.Channel.prototype.reject)||this._wrap(t.Channel.prototype,"reject",E_(!0,dn.Reject)),w(t.Channel.prototype.ackAll)||this._wrap(t.Channel.prototype,"ackAll",UN(!1,dn.AckAll)),w(t.Channel.prototype.nackAll)||this._wrap(t.Channel.prototype,"nackAll",UN(!0,dn.NackAll)),w(t.Channel.prototype.emit)||this._wrap(t.Channel.prototype,"emit",A2),w(t.ConfirmChannel.prototype.publish)||this._wrap(t.ConfirmChannel.prototype,"publish",R2),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 O2="Amqplib",DN=fe(O2,()=>new I_),Fte=(()=>({name:O2,setupOnce(){DN()}})),BN=Fte;var A_="VercelAI";var Wte=[">=3.0.0 <7"],C2=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function Vte(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 Yte(e){if(typeof e!="object"||e===null||!("content"in e)||typeof e.consumeStream=="function")return;let t=e;Array.isArray(t.content)&&(jte(t.content),Zte(t.content))}function jte(e){for(let t of e){if(!Vte(t))continue;let n=Yy(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 Zte(e){for(let t of e)typeof t=="object"&&t!==null&&"toolCallId"in t&&typeof t.toolCallId=="string"&&jy(t.toolCallId)}function Xte(e,t,n,r,o){let i=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:o;return{recordInputs:i,recordOutputs:s}}var N_=class extends le{constructor(t={}){super("@sentry/instrumentation-vercel-ai",q,t),this._isPatched=!1,this._callbacks=[]}init(){return new re("ai",Wte,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:(o,i,s)=>{let c=s[0].experimental_telemetry||{},a=c.isEnabled,l=O(),p=l?.getIntegrationByName(A_),u=p?.options,d=p?l?.getDataCollectionOptions().genAI:void 0,{recordInputs:m,recordOutputs:_}=Xte(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(o,i,s),h=>{h&&typeof h=="object"&&Ge(h,"_sentry_active_span",Q())},()=>{},h=>{Yte(h)})}});if(Object.prototype.toString.call(t)==="[object Module]"){for(let r of C2)t[r]!=null&&(t[r]=n(t[r]));return t}else{let r=C2.reduce((o,i)=>(t[i]!=null&&(o[i]=n(t[i])),o),{});return{...t,...r}}}};var HN=fe(A_,()=>new N_({}));function Kte(e){return!!e.getIntegrationByName("Modules")?.getModules?.()?.ai}var qte=((e={})=>{let t,n=Wp(e);return Ht(n,{options:e,setupOnce(){t=HN()},afterAllSetup(r){e.force??Kte(r)?Fd(r):t?.callWhenPatched(()=>Fd(r))}})}),FN=qte;var Qte=[">=4.0.0 <8"],R_=class extends le{constructor(t={}){super("@sentry/instrumentation-openai",q,t)}init(){return new re("openai",Qte,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 o=this.getConfig(),i=function(...s){if(kn(Kr))return Reflect.construct(r,s);let c=Reflect.construct(r,s);return jd(c,o)};Object.setPrototypeOf(i,r),Object.setPrototypeOf(i.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(i,s,c)}try{t[n]=i}catch{Object.defineProperty(t,n,{value:i,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=i}catch{Object.defineProperty(t,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return t}};var WN=fe(Kr,e=>new R_(e)),$te=((e={})=>({name:Kr,setupOnce(){WN(e)}})),VN=$te;var Jte=[">=0.19.2 <1.0.0"],v_=class extends le{constructor(t={}){super("@sentry/instrumentation-anthropic-ai",q,t)}init(){return new re("@anthropic-ai/sdk",Jte,this._patch.bind(this))}_patch(t){let n=t.Anthropic,r=this.getConfig(),o=function(...i){if(kn(qr))return Reflect.construct(n,i);let s=Reflect.construct(n,i);return qd(s,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let i of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(i)){let s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(o,i,s)}try{t.Anthropic=o}catch{Object.defineProperty(t,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(t.default===n)try{t.default=o}catch{Object.defineProperty(t,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return t}};var YN=fe(qr,e=>new v_(e)),zte=((e={})=>({name:qr,options:e,setupOnce(){YN(e)}})),jN=zte;var x2=[">=0.10.0 <2"],O_=class extends le{constructor(t={}){super("@sentry/instrumentation-google-genai",q,t)}init(){return new re("@google/genai",x2,n=>this._patch(n),n=>n,[new Re("@google/genai/dist/node/index.cjs",x2,n=>this._patch(n),n=>n)])}_patch(t){let n=t.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return t;let o=function(...i){if(kn(Qr))return Reflect.construct(n,i);let s=Reflect.construct(n,i);return Jd(s,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let i of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(i)){let s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(o,i,s)}return ep(t,"GoogleGenAI",o),t}};var ZN=fe(Qr,e=>new O_(e)),ene=((e={})=>({name:Qr,setupOnce(){ZN(e)}})),XN=ene;var C_=[">=0.1.0 <2.0.0"];function tne(e,t,n){return new Proxy(e,{apply(r,o,i){let c=i[1];return(!c||typeof c!="object"||Array.isArray(c))&&(c={},i[1]=c),c.callbacks=ps(c.callbacks,t),Reflect.apply(r,o,i)}})}var x_=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,C_,this._patch.bind(this),o=>o,[new Re(`${r}/dist/index.cjs`,C_,this._patch.bind(this),o=>o)]));return t.push(new re("langchain",C_,this._patch.bind(this),r=>r,[new Re("langchain/dist/chat_models/universal.cjs",C_,this._patch.bind(this),r=>r)])),t}_patch(t){Po([Kr,qr,Qr]);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"],o=t.universal_exports??t,i=Object.values(o).find(a=>typeof a=="function"&&r.includes(a.name));if(!i)return;let s=i.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]=tne(l,n))}}_patchEmbeddingsMethods(t,n){let r=t.universal_exports??t;for(let o of Object.values(r)){if(typeof o!="function"||!o.prototype)continue;let i=o.prototype;typeof i.embedQuery!="function"||typeof i.embedDocuments!="function"||i.__sentry_patched__||(i.__sentry_patched__=!0,tm(i,n))}}};var KN=fe(Da,e=>new x_(e)),nne=((e={})=>({name:Da,setupOnce(){KN(e)}})),qN=nne;var fu=[">=0.0.0 <2.0.0"],P_=class extends le{constructor(t={}){super("@sentry/instrumentation-langgraph",q,t)}init(){return[new re("@langchain/langgraph",fu,this._patch.bind(this),t=>t,[new Re("@langchain/langgraph/dist/index.cjs",fu,this._patch.bind(this),t=>t),new Re("@langchain/langgraph/dist/prebuilt/index.cjs",fu,this._patch.bind(this),t=>t)]),new re("@langchain/langgraph/prebuilt",fu,this._patch.bind(this),t=>t,[new Re("@langchain/langgraph/dist/prebuilt/index.cjs",fu,this._patch.bind(this),t=>t)])]}_patch(t){let r=O()?.getDataCollectionOptions().genAI,o={...this.getConfig(),recordInputs:this.getConfig().recordInputs??r?.inputs??!1,recordOutputs:this.getConfig().recordOutputs??r?.outputs??!1};if(t.StateGraph&&typeof t.StateGraph=="function"&&$l(t.StateGraph.prototype,o),t.createReactAgent&&typeof t.createReactAgent=="function"){let i=t.createReactAgent;Object.defineProperty(t,"createReactAgent",{value:eS(i,o),writable:!0,enumerable:!0,configurable:!0})}return t}};var QN=fe(Fa,e=>new P_(e)),rne=((e={})=>({name:Fa,setupOnce(){QN(e)}})),$N=rne;var one=e=>(It()||we(()=>{console.warn("The launchDarklyIntegration() can only be used in the browser.")}),{name:"LaunchDarkly"});function ine(){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 sne=e=>(It()||we(()=>{console.warn("The openFeatureIntegration() can only be used in the browser.")}),{name:"OpenFeature"}),JN=class{constructor(){It()||we(()=>{console.warn("The OpenFeatureIntegrationHook can only be used in the browser.")})}after(){}error(){}};var ane=e=>(It()||we(()=>{console.warn("The statsigIntegration() can only be used in the browser.")}),{name:"Statsig"});var cne=e=>(It()||we(()=>{console.warn("The unleashIntegration() can only be used in the browser.")}),{name:"Unleash"});var lne=Ry;import*as k2 from"net";function L2(e,t,n){let r=new re("@firebase/firestore",e,i=>P2(i,t,n)),o=["@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 i of o)r.files.push(new Re(i,e,s=>P2(s,t,n),s=>M2(s,n)));return r}function P2(e,t,n){return M2(e,n),t(e,"addDoc",pne()),t(e,"getDocs",dne()),t(e,"setDoc",mne()),t(e,"deleteDoc",une()),e}function M2(e,t){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])w(e[n])&&t(e,n);return e}function pne(){return function(t){return function(n,r){return k_("addDoc",n,()=>t(n,r))}}}function une(){return function(t){return function(n){return k_("deleteDoc",n.parent||n,()=>t(n))}}}function dne(){return function(t){return function(n){return k_("getDocs",n,()=>t(n))}}}function mne(){return function(t){return function(n,r,o){return k_("setDoc",n.parent||n,()=>typeof o<"u"?t(n,r,o):t(n,r))}}}function k_(e,t,n){return Se({name:`${e} ${t.path}`,op:"db.query",kind:D.CLIENT,attributes:{[S]:"auto.firebase.otel.firestore",[pr]:e,...gne(t)}},n)}function fne(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(k2.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 gne(e){let t=e.firestore.app,n=t.options,o=(e.firestore.toJSON()||{}).settings||{},i={[pa]:e.path,[Io]: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}=fne(o);return s&&(i[_t]=s),c&&(i[ht]=c),i}function w2(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:i,triggerType:s})=>{r.files.push(new Re(i,e,c=>_ne(c,t,n,s),c=>G2(c,n)))}),r}function mn(e){return function(n){return function(...r){let o=typeof r[0]=="function"?r[0]:r[1],i=typeof r[0]=="function"?void 0:r[0];if(!o)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 o.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 es(2e3),u}})};return i?n.call(this,i,s):n.call(this,s)}}}function _ne(e,t,n,r){switch(G2(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 G2(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 hne=[">=3.0.0 <5"],bne=[">=6.0.0 <7"],L_=class extends le{constructor(t={}){super("@sentry/instrumentation-firebase",q,t)}init(){let t=[];return t.push(L2(hne,this._wrap,this._unwrap)),t.push(w2(bne,this._wrap,this._unwrap)),t}};var U2="Firebase",zN=fe(U2,()=>new L_),yne=(()=>({name:U2,setupOnce(){zN()}})),eR=yne;function tR(){return[aT(),FT(),KT(),GI(),sI(),cI(),pI(),fI(),TI(),OI(),jf(),MI(),BI(),FI(),EN(),AN(),tI(),BN(),rI(),qN(),$N(),FN(),VN(),jN(),XN(),kI(),eR()]}function D2(){return[H1,sT,HI,HT,Ng,wI,eI,DI,nI,iI,aI,lI,mI,vI,Ng,XT,EI,SN,IN,DN,KN,HN,WN,PI,zN,YN,ZN,QN]}var nR=1e6,M_=Symbol.for("opentelemetry.js.api.1");function B2(e){if(de.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[M_];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[M_]=void 0,!de.setGlobalTracerProvider(e))return!1;let r=t[M_];if(r){let{propagation:o,context:i,...s}=n;t[M_]={...s,...r}}return!0}return!1}function rR(e,t={}){e.getOptions().debug&&HE();let[n,r]=Tne(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function Sne(e={}){let{debug:t}=e;t&&g.enable(),Lp(),Ene(e.integrations).forEach(n=>{n(),t&&g.log(`[Sentry] Preloaded ${n.id} instrumentation`)})}function Ene(e){let t=D2();return e?t.filter(n=>{let r=n.id;return e.some(o=>r===o||r.startsWith(`${o}.`))}):t}function Tne(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||!!t.spanProcessors?.length))return Ine(e);let r=new Ep({sampler:new Np(e),resource:of("node"),forceFlushTimeoutMillis:500,spanProcessors:[new Ap({timeout:Ane(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});B2(r),ho.setGlobalPropagator(new pc);let o=new vp;return ce.setGlobalContextManager(o),[r,o.getAsyncLocalStorageLookup()]}function Ine(e){let t=new Rp({resource:of("node")});if(!B2(t))return je&&g.warn("Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered."),[void 0,void 0];Ts("SentryTracerProvider"),ho.setGlobalPropagator(new pc);let n=new vp;return ce.setGlobalContextManager(n),e.on("spanEnd",r=>{rf(r,{finalizeStatus:!0})}),it(e)&&e.on("preprocessSpan",nf),e.on("preprocessEvent",r=>{r.type==="transaction"&&(r.contexts={...r.contexts,otel:{resource:t.resource?.attributes,...r.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function Ane(e){if(e!=null){if(e>nR)return je&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${nR}`),nR;if(e<=0||Number.isNaN(e)){je&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function H2(){return vf().filter(t=>t.name!=="Http"&&t.name!=="NodeFetch").concat(nT(),rT())}function F2(e){return[...H2(),...De(e)?tR():[]]}function Nne(e,t){if(yc()&&De(t)){let n=gI();if(n){let r=new Set(n.replacedOtelIntegrationNames);return[...e.filter(o=>!r.has(o.name)),...n.integrations]}}return e}function Rne(e={}){return W2(e,F2)}function W2(e={},t){os(e,"node");let n=yc()&&De(e)?gI():void 0;n&&n.register();let r=e.defaultIntegrations??t(e);if(n&&Array.isArray(r)&&r.length>0){let i=new Set(n.replacedOtelIntegrationNames);r=[...r.filter(s=>!i.has(s.name)),...n.integrations]}let o=qE({...e,defaultIntegrations:r});return o&&!e.skipOpenTelemetrySetup&&(rR(o,{spanProcessors:e.openTelemetrySpanProcessors}),Of()),n&&n.detect(),o}function vne(e={}){return W2(e,()=>[])}import*as Lre from"module";import"url";import{isMainThread as Mre,parentPort as wre}from"worker_threads";var gu=[...YI,...jI,...ZI,...XI,...KI,...qI,...QI,...JI,...zI,...eA,...tA,...nA,...rA,...oA,...sA,...aA,...cA,...lA,...pA,...uA,...dA,...mA,...fA,...gA,..._A,...hA,...bA,...yA,...SA],i5e=[...DU,...HU,...WU,...YU,...ZU,...KU,...QU,...JU,...eD,...nD,...oD,...sD,...lD,...uD,...gD,...bD,...SD,...TD,...RD,...OD,...xD,...kD,...MD,...GD,...DD,...HD,...WD,...YD,...ZD];function One(e=[]){return[...vl([...gu,...e].map(t=>t.module.name)),"@remix-run/node"]}var s5e=One();function ki(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y2=Cne;function Cne(e,t){let[n]=j2(e,"");for(let r of Pne(t))if(xne(r,n))return!0;return!1}function xne(e,t){for(let[n,r]of e)if(!Mne(t,r,n))return!1;return!0}function V2(e){return e==="latest"&&(e=">=0"),e.match(/^([^\d+]*)(\d.*)$/)||[null,"","*.*.*"]}function Pne(e){let t=[],n=[],r=e.trim().split(/\s+/);for(let o=0;o<r.length;o++){let i=r[o];if(i==="-")continue;if(i==="||"){t.push(n),n=[];continue}if(/^[<>=~v^]+$/.test(i)&&o+1<r.length){r[o+1]=i+r[o+1];continue}let s=V2(i),c=s[1]||"=";c.endsWith("v")&&(c=c.slice(0,-1));let[a,l]=j2(s[2],c);if(o+2<r.length&&r[o+1]==="-"){let p=V2(r[o+2]);r[o+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?Gc(a,0):Gc(a,1)])}else if(l[0]==="^"){let p=a[0]!==0?0:a[1]!==0?1:2;n.push([">=",a]),n.push(["<",p===0?Gc(a,0):p===1?Gc(a,1):Gc(a,2)])}else n.push([l.replace("~","").replace("^",""),a])}return n.length&&t.push(n),t}function Gc(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 kne(e){return e==="x"||e==="X"||e==="*"||e==="latest"?-1:Number(e)}function Lne(e){return/^\d+$/.test(e)?Number(e):e}function Li(e,t,n){return n===-1?e!=="<":e==="="?t===n:e===">"?t>n:e===">="?t>=n:e==="<"?t<n:e==="<="?t<=n:!1}function j2(e,t){e=e.split("+")[0];let[n,r]=e.split("-"),o=n.split(".").map(kne).slice(0,3),i=Math.max(o.length-1,0);return t===">"?(t=">=",o.push(0,0,0),o[i]++):t===""?o.push(0,0,0):o.push(-1,-1,-1),r?[o.slice(0,3).concat(r.split(".").map(Lne)),t]:[o.slice(0,3),t]}function Mne(e,t,n){if(!Li("=",e[0],t[0]))return Li(n,e[0],t[0]);if(!Li("=",e[1],t[1]))return Li(n,e[1],t[1]);if(!Li("=",e[2],t[2])||e.length===3&&t.length===3)return Li(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(Li(n,e[r]||"",t[r]||""))return!0;return!1}function iR(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 aR(e,t){return(function(n){if(Array.isArray(n))return n})(e)||(function(n,r){var o=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(o!=null){var i,s,c,a,l=[],p=!0,u=!1;try{if(c=(o=o.call(n)).next,r!==0)for(;!(p=(i=c.call(o)).done)&&(l.push(i.value),l.length!==r);p=!0);}catch(d){u=!0,s=d}finally{try{if(!p&&o.return!=null&&(a=o.return(),Object(a)!==a))return}finally{if(u)throw s}}return l}})(e,t)||Q2(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 wne(e){return(function(t){if(Array.isArray(t))return iR(t)})(e)||(function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)})(e)||Q2(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 _u(e){return(_u=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 Q2(e,t){if(e){if(typeof e=="string")return iR(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)?iR(e,t):void 0}}function $2(e,t){return e(t={exports:{}},t.exports),t.exports}var w_=$2((function(e,t){(function n(r){var o,i,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===o.ObjectExpression||N===o.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 o={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"]},i={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(uo){var mo,Ui,Di,Vc;if(uo.ref.remove()){for(Ui=uo.ref.key,Vc=uo.ref.parent,mo=P.length;mo--;)if((Di=P[mo]).ref&&Di.ref.parent===Vc){if(Di.ref.key<Ui)break;--Di.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=o,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?i.Break:U[k].extendedRange[0]>ae.range[1]?i.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?i.Break:U[k].extendedRange[0]>ae.range[1]?i.Skip:void 0}}),N},r.VisitorKeys=s,r.VisitorOption=i,r.Controller=m,r.cloneEnvironment=function(){return n({})},r})(t)})),Gne=$2((function(e){e.exports&&(e.exports=(function(){function t(n,r,o,i){this.message=n,this.expected=r,this.found=o,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)}return(function(n,r){function o(){this.constructor=n}o.prototype=r.prototype,n.prototype=new o})(t,Error),t.buildMessage=function(n,r){var o={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 i(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"+i(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+i(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"+i(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+i(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],o[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 o,i,s,c,a={},l={start:YR},p=YR,u=Ke(" ",!1),d=/^[^ [\],():#!=><~+.]/,m=Ar([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!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=Ar([">","<","!"],!1,!1),U=Ke("=",!1),ae=function(I){return(I||"")+"="},ue=/^[><]/,Ne=Ar([">","<"],!1,!1),Te=Ke(".",!1),Ce=function(I,F,V){return{type:"attribute",name:I,operator:F,value:V}},Qe=Ke('"',!1),Rt=/^[^\\"]/,In=Ar(["\\",'"'],!0,!1),uo=Ke("\\",!1),mo={type:"any"},Ui=function(I,F){return I+F},Di=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},Vc=Ke("'",!1),xR=/^[^\\']/,PR=Ar(["\\","'"],!0,!1),Yo=/^[0-9]/,jo=Ar([["0","9"]],!1,!1),BW=Ke("type(",!1),kR=/^[^ )]/,LR=Ar([" ",")"],!0,!1),Bi=Ke(")",!1),MR=/^[imsu]/,wR=Ar(["i","m","s","u"],!1,!1),GR=Ke("/",!1),UR=/^[^\]\\]/,DR=Ar(["]","\\"],!0,!1),BR=/^[^\/\\[]/,HR=Ar(["/","\\","["],!0,!1),HW=Ke(":not(",!1),FW=Ke(":matches(",!1),FR=function(I){return{type:"matches",selectors:I}},WW=Ke(":is(",!1),VW=Ke(":has(",!1),YW=Ke(":first-child",!1),jW=Ke(":last-child",!1),ZW=Ke(":nth-child(",!1),XW=Ke(":nth-last-child(",!1),KW=Ke(":",!1),f=0,yu=[{line:1,column:1}],Ir=0,$_=[],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 Ar(I,F,V){return{type:"class",parts:I,inverted:F,ignoreCase:V}}function WR(I){var F,V=yu[I];if(V)return V;for(F=I-1;!yu[F];)F--;for(V={line:(V=yu[F]).line,column:V.column};F<I;)n.charCodeAt(F)===10?(V.line++,V.column=1):V.column++,F++;return yu[I]=V,V}function VR(I,F){var V=WR(I),y=WR(F);return{start:{offset:I,line:V.line,column:V.column},end:{offset:F,line:y.line,column:y.column}}}function j(I){f<Ir||(f>Ir&&(Ir=f,$_=[]),$_.push(I))}function YR(){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=Su())!==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 fo(){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 J_(){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 Su(){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=Eu())!==a){for(V=[],y=f,(x=xe())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(v)),K!==a&&(X=xe())!==a&&(he=Eu())!==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=Eu())!==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 z_(){var I,F,V,y,x,K=36*f+6,X=z[K];return X?(f=X.nextPos,X.result):(I=f,(F=J_())===a&&(F=null),F!==a&&(V=Eu())!==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 Eu(){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=eh())!==a){for(V=[],y=f,(x=J_())!==a&&(K=eh())!==a?y=x=[x,K]:(f=y,y=a);y!==a;)V.push(y),y=f,(x=J_())!==a&&(K=eh())!==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 eh(){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=jR())!==a)for(;y!==a;)V.push(y),y=jR();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 jR(){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=fo())!==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=th())!==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(BW)),pe!==a)if(xe()!==a){if(Ie=[],kR.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(LR)),W!==a)for(;W!==a;)Ie.push(W),kR.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(LR));else Ie=a;Ie!==a&&(W=xe())!==a?(n.charCodeAt(f)===41?(Ae=")",f++):(Ae=a,j(Bi)),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,Nr=z[Dn];if(Nr)return f=Nr.nextPos,Nr.result;if(Z=f,n.charCodeAt(f)===47?(pe="/",f++):(pe=a,j(GR)),pe!==a){if(Ie=[],(W=ZR())===a&&(W=Tu())===a&&(W=XR()),W!==a)for(;W!==a;)Ie.push(W),(W=ZR())===a&&(W=Tu())===a&&(W=XR());else Ie=a;Ie!==a?(n.charCodeAt(f)===47?(W="/",f++):(W=a,j(GR)),W!==a?((Ae=(function(){var go,Hi,QR=36*f+21,nh=z[QR];if(nh)return f=nh.nextPos,nh.result;if(go=[],MR.test(n.charAt(f))?(Hi=n.charAt(f),f++):(Hi=a,j(wR)),Hi!==a)for(;Hi!==a;)go.push(Hi),MR.test(n.charAt(f))?(Hi=n.charAt(f),f++):(Hi=a,j(wR));else go=a;return z[QR]={nextPos:f,result:go},go})())===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=th())!==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,Nr=z[Dn];if(Nr)return f=Nr.nextPos,Nr.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(uo)),Ae!==a?(n.length>f?($e=n.charAt(f),f++):($e=a,j(mo)),$e!==a?(Ae=Ui(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(uo)),Ae!==a?(n.length>f?($e=n.charAt(f),f++):($e=a,j(mo)),$e!==a?(Ae=Ui(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=Di(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(Vc)),pe!==a){for(Ie=[],xR.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(PR)),W===a&&(W=f,n.charCodeAt(f)===92?(Ae="\\",f++):(Ae=a,j(uo)),Ae!==a?(n.length>f?($e=n.charAt(f),f++):($e=a,j(mo)),$e!==a?(Ae=Ui(Ae,$e),W=Ae):(f=W,W=a)):(f=W,W=a));W!==a;)Ie.push(W),xR.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(PR)),W===a&&(W=f,n.charCodeAt(f)===92?(Ae="\\",f++):(Ae=a,j(uo)),Ae!==a?(n.length>f?($e=n.charAt(f),f++):($e=a,j(mo)),$e!==a?(Ae=Ui(Ae,$e),W=Ae):(f=W,W=a)):(f=W,W=a));Ie!==a?(n.charCodeAt(f)===39?(W="'",f++):(W=a,j(Vc)),W!==a?(pe=Di(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,Nr=36*f+18,go=z[Nr];if(go)return f=go.nextPos,go.result;for(Z=f,pe=f,Ie=[],Yo.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(jo));W!==a;)Ie.push(W),Yo.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(jo));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=[],Yo.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(jo)),W!==a)for(;W!==a;)Ie.push(W),Yo.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(jo));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[Nr]={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=fo())!==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=th())!==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=fo())!==a){for(X=[],he=f,n.charCodeAt(f)===46?(be=".",f++):(be=a,j(Te)),be!==a&&(ye=fo())!==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=fo())!==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(HW)),x!==a&&xe()!==a&&(K=Su())!==a&&xe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Bi)),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(FW)),x!==a&&xe()!==a&&(K=Su())!==a&&xe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Bi)),X!==a?(x=FR(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(WW)),x!==a&&xe()!==a&&(K=Su())!==a&&xe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Bi)),X!==a?(x=FR(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(VW)),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=z_())!==a){for(Un=[],Ze=f,(zn=xe())!==a?(n.charCodeAt(f)===44?(on=",",f++):(on=a,j(v)),on!==a&&(Z=xe())!==a&&(pe=z_())!==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=z_())!==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(Bi)),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(YW)),x!==a&&(x=KR(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(jW)),x!==a&&(x=qR(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(ZW)),x!==a)if(xe()!==a){if(K=[],Yo.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(jo)),X!==a)for(;X!==a;)K.push(X),Yo.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(jo));else K=a;K!==a&&(X=xe())!==a?(n.charCodeAt(f)===41?(he=")",f++):(he=a,j(Bi)),he!==a?(x=KR(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(XW)),x!==a)if(xe()!==a){if(K=[],Yo.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(jo)),X!==a)for(;X!==a;)K.push(X),Yo.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(jo));else K=a;K!==a&&(X=xe())!==a?(n.charCodeAt(f)===41?(he=")",f++):(he=a,j(Bi)),he!==a?(x=qR(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(KW)),x!==a&&(K=fo())!==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 th(){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=fo())!==a){for(V=[],y=f,n.charCodeAt(f)===46?(x=".",f++):(x=a,j(Te)),x!==a&&(K=fo())!==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=fo())!==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 ZR(){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=[],UR.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(DR)),y===a&&(y=Tu()),y!==a)for(;y!==a;)V.push(y),UR.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(DR)),y===a&&(y=Tu());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 Tu(){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(uo)),F!==a?(n.length>f?(V=n.charAt(f),f++):(V=a,j(mo)),V!==a?I=F="\\"+V:(f=I,I=a)):(f=I,I=a),z[y]={nextPos:f,result:I},I)}function XR(){var I,F,V,y=36*f+25,x=z[y];if(x)return f=x.nextPos,x.result;if(F=[],BR.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(HR)),V!==a)for(;V!==a;)F.push(V),BR.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(HR));else F=a;return F!==a&&(F=F.join("")),I=F,z[y]={nextPos:f,result:I},I}function KR(I){return{type:"nth-child",index:{type:"literal",value:I}}}function qR(I){return{type:"nth-last-child",index:{type:"literal",value:I}}}if((o=p())!==a&&f===n.length)return o;throw o!==a&&f<n.length&&j({type:"end"}),i=$_,s=Ir<n.length?n.charAt(Ir):null,c=Ir<n.length?VR(Ir,Ir+1):VR(Ir,Ir),new t(t.buildMessage(i,s),i,s,c)}}})())}));function Tr(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var oR=typeof WeakMap=="function"?new WeakMap:null;function Zt(e){if(e==null)return function(){return!0};if(oR!=null){var t=oR.get(e);return t!=null||(t=Z2(e),oR.set(e,t)),t}return Z2(e)}function Z2(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 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"not":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"has":var s=e.selectors.map(Zt);return function(T,G,k){var U=!1,ae=[];return w_.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 Tr(T,u)!=null};case"=":switch(e.value.type){case"regexp":return function(T){var G=Tr(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(Tr(T,u))};case"type":return function(T){return e.value.value===_u(Tr(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(Tr(T,u))};case"literal":var m="".concat(e.value.value);return function(T){return m!=="".concat(Tr(T,u))};case"type":return function(T){return e.value.value!==_u(Tr(T,u))}}throw new Error("Unknown selector value type: ".concat(e.value.type));case"<=":return function(T){return Tr(T,u)<=e.value.value};case"<":return function(T){return Tr(T,u)<e.value.value};case">":return function(T){return Tr(T,u)>e.value.value};case">=":return function(T){return Tr(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)&&X2(T,_,G,"LEFT_SIDE",k)||e.left.subject&&_(T,G,k)&&X2(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)&&K2(T,b,G,"LEFT_SIDE",k)||e.right.subject&&b(T,G,k)&&K2(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)&&q2(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)&&q2(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 cR(e,t){var n=t&&t.nodeTypeKey||"type",r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:w_.VisitorKeys[r]?w_.VisitorKeys[r]:t&&typeof t.fallback=="function"?t.fallback(e):Object.keys(e).filter((function(o){return o!==n}))}function sR(e,t){var n=t&&t.nodeTypeKey||"type";return e!==null&&_u(e)==="object"&&typeof e[n]=="string"}function X2(e,t,n,r,o){var i=aR(n,1)[0];if(!i)return!1;for(var s=cR(i,o),c=0;c<s.length;++c){var a=i[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(sR(a[d],o)&&t(a[d],n,o))return!0}}return!1}function K2(e,t,n,r,o){var i=aR(n,1)[0];if(!i)return!1;for(var s=cR(i,o),c=0;c<s.length;++c){var a=i[s[c]];if(Array.isArray(a)){var l=a.indexOf(e);if(l<0)continue;if(r==="LEFT_SIDE"&&l>0&&sR(a[l-1],o)&&t(a[l-1],n,o)||r==="RIGHT_SIDE"&&l<a.length-1&&sR(a[l+1],o)&&t(a[l+1],n,o))return!0}}return!1}function q2(e,t,n,r){if(n===0)return!1;var o=aR(t,1)[0];if(!o)return!1;for(var i=cR(o,r),s=0;s<i.length;++s){var c=o[i[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 J2(e,t,n,r){if(t){var o=[],i=Zt(t),s=(function c(a,l){if(a==null||_u(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,wne(c(_,m==="left"?_:l)))}return p})(t).map(Zt);w_.traverse(e,{enter:function(c,a){if(a!=null&&o.unshift(a),i(c,o,r))if(s.length)for(var l=0,p=s.length;l<p;++l){s[l](c,o,r)&&n(c,a,o);for(var u=0,d=o.length;u<d;++u){var m=o.slice(u+1);s[l](o[u],m,r)&&n(o[u],a,m)}}else n(c,a,o)},leave:function(){o.shift()},keys:r&&r.visitorKeys,fallback:r&&r.fallback||"iteration"})}}function z2(e,t,n){var r=[];return J2(e,t,(function(o){r.push(o)}),n),r}function eW(e){return Gne.parse(e)}function lo(e,t,n){return z2(e,eW(t),n)}lo.parse=eW,lo.match=z2,lo.traverse=J2,lo.matches=function(e,t,n,r){return!t||!!e&&(n||(n=[]),Zt(t)(e,n,r))},lo.query=lo;var G_={};var tW={};var lR={exports:{}};var pR=lo,{parse:fn}=G_,nW=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name==="tr_ch_apm_tracingChannel",Une=/[^\w]/g,Us=e=>`tr_ch_apm$${e.replace(Une,"_")}`,uR=lR.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(nW))return;let r={module:t==="esm"},o=n.body.findIndex(a=>a.directive==="use strict"),i=t==="esm"?`import tr_ch_apm_dc from "${e}"`:`const tr_ch_apm_dc = require("${e}")`;n.body.splice(o+1,0,fn(i,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,o=Us(n);if(t.body.some(c=>c.declarations?.[0]?.id?.name===o))return;uR.tracingChannelImport(e,t);let i=t.body.findIndex(nW),s=`
42
- const ${o} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
43
- `;t.body.splice(i+1,0,fn(s).body[0])},traceCallback:U_,tracePromise:U_,traceSync:U_,traceAuto:U_};function Dne(e){return[...(e||[]).filter(r=>r.type!=="RestElement"&&r.type!=="AssignmentPattern").map((r,o)=>({type:"Identifier",name:`__apm$arg${o}`})),{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}]}function U_(e,t,n,r){let o=r[r.length-1];t.type==="ClassDeclaration"||t.type==="ClassExpression"?Hne(e,t,o):Bne(e,t,o)}function Bne(e,t,n){uR.tracingChannelDeclaration(e,n);let{functionQuery:{methodName:r,privateMethodName:o,functionName:i,expressionName:s,propertyName:c}}=e,l=r==="constructor"||!r&&!o&&!i&&!s&&!c?"ArrowFunctionExpression":t.type,p=t.params;t.body=rW(e,{type:l,params:p,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=Dne(p),t.generator=!1,t.async=!1,oW(e,t)}function Hne(e,t,n){let{functionQuery:r,operator:o}=e,{methodName:i}=r;if(!i)return;let s=t.body;if(s.body.some(({key:p})=>p.name===i))return;let c=s.body.find(({kind:p})=>p==="constructor");uR.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$${i} = this["${i}"]
45
- this["${i}"] = function () {}
46
- if (typeof __apm$${i} === 'function') {
47
- Object.defineProperty(this["${i}"], 'length', {
48
- value: __apm$${i}.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=o==="tracePromise",l.body=rW(e,{type:"Identifier",name:`__apm$${i}`},n),oW(e,l),c.value.body.body.push(...a)}function rW(e,t,n){let{operator:r,moduleVersion:o}=e,{returnKind:i}=e.functionQuery,s=i?Yne(e,i,n):"",c;r==="traceCallback"&&(c=iW(e,t,s)),r==="tracePromise"&&(c=sW(e,t,s)),r==="traceSync"&&(c=Wne(e,t,s)),r==="traceAuto"&&(c=Fne(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(o)}
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(o)}
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),pR.query(l,"[id.name=__apm$wrapped]")[0].init=t,l}function oW(e,t){let n=new Set;pR.traverse(t.body,pR.parse("[object.type=Super]"),(r,o)=>{let{name:i}=r.property,s;if(o.callee){let{expression:c}=fn(`__apm$super['${i}'].call(this)`).body[0];o.callee=s=c.callee,o.arguments.unshift(...c.arguments)}else o.expression=s=fn(`__apm$super['${i}']`).body[0];s.computed=o.callee.computed,s.optional=o.callee.optional,n.add(i)});for(let r of n){let o=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(o)}n.size>0&&t.body.body.unshift(fn("const __apm$super = {}").body[0])}function Fne(e,t,n=""){let r=iW(e,t,n),o=sW(e,t,n),[i,s,c,a,l,p]=r.body[0].body.body,u={type:"IfStatement",test:a.test,consequent:{type:"BlockStatement",body:o.body[0].body.body},alternate:null};return r.body[0].body.body=[i,u,s,c,l,p],r}function iW(e,t,n=""){let{channelName:r,functionQuery:{callbackIndex:o=-1}}=e,i=Us(r);return fn(`
80
- function wrapper () {
81
- const __apm$cb = Array.prototype.at.call(__apm$arguments, ${o});
82
-
83
- if (!${i}.start.hasSubscribers) return __apm$traced();
84
-
85
- function __apm$wrappedCb(err, res) {
86
- if (err) {
87
- __apm$ctx.error = err;
88
- ${i}.error.publish(__apm$ctx);
89
- } else {
90
- __apm$ctx.result = res;
91
- ${n}
92
- }
93
-
94
- ${i}.asyncStart.runStores(__apm$ctx, () => {
95
- try {
96
- if (__apm$cb) {
97
- return __apm$cb.apply(this, arguments);
98
- }
99
- } finally {
100
- ${i}.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, ${o}, 1, __apm$wrappedCb);
109
-
110
- return ${i}.start.runStores(__apm$ctx, () => {
111
- try {
112
- return __apm$traced();
113
- } catch (err) {
114
- __apm$ctx.error = err;
115
- ${i}.error.publish(__apm$ctx);
116
- throw err;
117
- } finally {
118
- __apm$ctx.self ??= this;
119
- ${i}.end.publish(__apm$ctx);
120
- }
121
- });
122
- }
123
- `)}function sW(e,t,n=""){let{channelName:r}=e,o=Us(r);return fn(`
124
- function wrapper () {
125
- if (!tr_ch_apm_hasSubscribers(${o})) return __apm$traced();
126
-
127
- return ${o}.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
- ${o}.asyncStart.publish(__apm$ctx);
147
- ${o}.asyncEnd.publish(__apm$ctx);
148
- return __apm$ctx.result;
149
- },
150
- err => {
151
- __apm$ctx.error = err;
152
- ${o}.error.publish(__apm$ctx);
153
- ${o}.asyncStart.publish(__apm$ctx);
154
- ${o}.asyncEnd.publish(__apm$ctx);
155
- throw err;
156
- }
157
- );
158
- }
159
- promise.then(
160
- result => {
161
- __apm$ctx.result = result;
162
- ${n}
163
- ${o}.asyncStart.publish(__apm$ctx);
164
- ${o}.asyncEnd.publish(__apm$ctx);
165
- },
166
- err => {
167
- __apm$ctx.error = err;
168
- ${o}.error.publish(__apm$ctx);
169
- ${o}.asyncStart.publish(__apm$ctx);
170
- ${o}.asyncEnd.publish(__apm$ctx);
171
- }
172
- );
173
- return promise;
174
- } catch (err) {
175
- __apm$ctx.error = err;
176
- ${o}.error.publish(__apm$ctx);
177
- throw err;
178
- } finally {
179
- __apm$ctx.self ??= this;
180
- ${o}.end.publish(__apm$ctx);
181
- }
182
- });
183
- }
184
- `)}function Wne(e,t,n=""){let{channelName:r}=e,o=Us(r);return fn(`
185
- function wrapper () {
186
- if (!tr_ch_apm_hasSubscribers(${o})) return __apm$traced();
187
-
188
- return ${o}.start.runStores(__apm$ctx, () => {
189
- try {
190
- __apm$ctx.result = __apm$traced();
191
- ${n}
192
- } catch (err) {
193
- __apm$ctx.error = err;
194
- ${o}.error.publish(__apm$ctx);
195
- throw err;
196
- } finally {
197
- __apm$ctx.self ??= this;
198
- ${o}.end.publish(__apm$ctx);
199
- }
200
- return __apm$ctx.result;
201
- });
202
- }
203
- `)}function Vne(e,t){let{channelName:n,module:{name:r}}=e,o=Us(n+":next");if(t.body.some(a=>a.declarations?.[0]?.id?.name===o))return;let i=Us(n),s=t.body.findIndex(a=>a.declarations?.[0]?.id?.name===i),c=`const ${o} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}:next")`;t.body.splice(s+1,0,fn(c).body[0])}function Yne(e,t,n){let{channelName:r}=e,o=t==="Iterator"?"traceSync":"tracePromise",i=Us(r+":next");return Vne(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(${i})) return __apm$orig.apply(this, __apm$iterArgs);
212
- __apm$ctx.method = method;
213
- __apm$ctx.arguments = __apm$iterArgs;
214
- return ${i}.${o}(__apm$orig, __apm$ctx, this, ...__apm$iterArgs);
215
- };
216
- };
217
- __apm$patchIter('next');
218
- __apm$patchIter('throw');
219
- __apm$patchIter('return');
220
- }
221
- `}var aW=lR.exports;var dR={};var pW=e=>{throw TypeError(e)},_R=(e,t,n)=>t.has(e)||pW("Cannot "+n),po=(e,t,n)=>(_R(e,t,"read from private field"),n?n.call(e):t.get(e)),Ds=(e,t,n)=>t.has(e)?pW("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Uc=(e,t,n,r)=>(_R(e,t,"write to private field"),t.set(e,n),n),Dc=(e,t,n)=>(_R(e,t,"access private method"),n),hu,B_,bu,Bc,H_,F_,Mi,uW,dW,mW,fR,fW,cW=lo,{parse:lW}=G_,{generate:jne}=tW,Zne=aW,mR,D_,gR=class{constructor(t,n,r,o,i,s={}){Ds(this,Mi),Ds(this,hu,null),Ds(this,B_,null),Ds(this,bu,null),Ds(this,Bc,[]),Ds(this,H_,null),Ds(this,F_,{}),Uc(this,hu,t),Uc(this,B_,n),Uc(this,bu,r),Uc(this,Bc,o),Uc(this,H_,i),Uc(this,F_,s)}free(){}get moduleName(){return po(this,hu)}get filePath(){return po(this,bu)}transform(t,n,r){if(Buffer.isBuffer(t)&&(t=t.toString()),!t)return{code:t};let o,i={},s=0;for(let c of po(this,Bc)){let{astQuery:a,functionQuery:l={}}=c;if(!o){let m={loc:!0,ranges:!0,raw:!0,module:n==="esm"};try{o=lW(t,m)}catch{o=lW(t,{...m,module:!m.module})}n==="esm"&&(i=Dc(this,Mi,mW).call(this,o))}let p=Dc(this,Mi,fR).call(this,l,i),u=a||Dc(this,Mi,fW).call(this,p),d={...c,dcModule:po(this,H_),moduleType:n,moduleVersion:po(this,B_),functionQuery:p};d.operator=Dc(this,Mi,dW).call(this,d),cW.traverse(o,cW.parse(u),(...m)=>{s++,Dc(this,Mi,uW).call(this,d,...m)})}if(s===0&&po(this,Bc).length>0){let c=po(this,Bc).map(({astQuery:a,functionQuery:l={}})=>{if(a)return a;let p=Dc(this,Mi,fR).call(this,l,i),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(o){mR??(mR=dR.SourceMapConsumer),D_??(D_=dR.SourceMapGenerator);let c=`${po(this,hu)}/${po(this,bu)}`,a;if(r){let u=new mR(r);u.file=c,a=D_.fromSourceMap(u)}else a=new D_({file:c});let l=jne(o,{sourceMap:a}),p=a.toString();return{code:l,map:p}}return{code:t}}};hu=new WeakMap;B_=new WeakMap;bu=new WeakMap;Bc=new WeakMap;H_=new WeakMap;F_=new WeakMap;Mi=new WeakSet;uW=function(e,...t){let n=po(this,F_)[e.operator]??Zne[e.operator],{index:r=0}=e.functionQuery,[o]=t,i=o.init?.type||o.type;i!=="ClassDeclaration"&&i!=="ClassExpression"&&(o.type==="VariableDeclarator"||(e.functionIndex=++e.functionIndex||0,r!==null&&r!==e.functionIndex))||n(e,...t)};dW=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"}};mW=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 o=r.exported.name??r.exported.value,i=r.local.name??r.local.value;o&&i&&(t[o]=i)}}return t};fR=function(e,t){if(!e.isExportAlias)return e;let{functionName:n,expressionName:r,className:o}=e;return n&&t[n]?{...e,functionName:t[n]}:r&&t[r]?{...e,expressionName:t[r]}:o&&t[o]?{...e,className:t[o]}:e};fW=function(e){let{functionName:t,expressionName:n,className:r,objectName:o,propertyName:i}=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]`),o||i){if(!o||!i)throw new Error(`functionQuery: 'objectName' and 'propertyName' must be used together (got objectName=${o}, propertyName=${i})`);let l=o==="this"?"left.object.type=ThisExpression":`left.object.name="${o}"`;c.push(`AssignmentExpression[${l}][left.property.name="${i}"] > [async]`)}return c.join(", ")};var gW={Transformer:gR};var _W=e=>{throw TypeError(e)},hW=(e,t,n)=>t.has(e)||_W("Cannot "+n),wi=(e,t,n)=>(hW(e,t,"read from private field"),n?n.call(e):t.get(e)),W_=(e,t,n)=>t.has(e)?_W("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),hR=(e,t,n,r)=>(hW(e,t,"write to private field"),t.set(e,n),n),V_,Y_,Bs,j_,Xne=Y2,{Transformer:Kne}=gW,bR=class{constructor(t,n){W_(this,V_,[]),W_(this,Y_,null),W_(this,Bs,{}),W_(this,j_,{}),hR(this,V_,t),hR(this,Y_,n||"diagnostics_channel")}free(){hR(this,Bs,{})}addTransform(t,n){wi(this,j_)[t]=n}getTransformer(t,n,r){r=r.replace(/\\/g,"/");let o=`${t}/${r}@${n}`;if(wi(this,Bs)[o])return wi(this,Bs)[o];let i=wi(this,V_).filter(({module:s})=>s.name===t&&(typeof s.filePath=="string"?s.filePath===r:s.filePath.test(r))&&Xne(n,s.versionRange));if(i.length!==0)return wi(this,Bs)[o]=new Kne(t,n,r,i,wi(this,Y_),wi(this,j_)),wi(this,Bs)[o]}};V_=new WeakMap;Y_=new WeakMap;Bs=new WeakMap;j_=new WeakMap;var bW={InstrumentationMatcher:bR};var{InstrumentationMatcher:qne}=bW;function Qne(e,t){return new qne(e,t)}var yW={create:Qne};var Z_=yW;import hre from"module";import $ne from"path";var yR=$ne.sep,SR=function(e){var t=e.split(yR),n=t.lastIndexOf("node_modules");if(n!==-1&&t[n+1]){for(var r=t[n+1][0]==="@",o=r?t[n+1]+"/"+t[n+2]:t[n+1],i=r?3:2,s="",c=n+i-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+yR;for(var l="",p=t.length-1,u=n+i;u<=p;u++)u===p?l+=t[u]:l+=t[u]+yR;return{name:o,basedir:s,path:l}}},SW=ki(SR);import bre from"url";import Jne from"fs";import zne from"path";var{readFileSync:ere}=Jne,{join:tre}=zne,ER=new Map;function nre(e){if(ER.has(e))return ER.get(e);try{let t=tre(e,"package.json"),n=ere(t),{version:r}=JSON.parse(n);return ER.set(e,r),r}catch{return process.version.slice(1)}}var TR=nre,EW=ki(TR);var IR;function rre(e){IR=e}function ore(e){IR&&IR(e)}var Vo={setDiagnosticsHook:rre,emitDiagnostics:ore};var X_={exports:{}};import gre from"tty";import _re from"util";import ire from"os";import sre from"tty";var TW=(e,t=process.argv)=>{let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)};var are=ire,IW=sre,Jn=TW,{env:kt}=process,Gi;Jn("no-color")||Jn("no-colors")||Jn("color=false")||Jn("color=never")?Gi=0:(Jn("color")||Jn("colors")||Jn("color=true")||Jn("color=always"))&&(Gi=1);"FORCE_COLOR"in kt&&(kt.FORCE_COLOR==="true"?Gi=1:kt.FORCE_COLOR==="false"?Gi=0:Gi=kt.FORCE_COLOR.length===0?1:Math.min(parseInt(kt.FORCE_COLOR,10),3));function AR(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function NR(e,t){if(Gi===0)return 0;if(Jn("color=16m")||Jn("color=full")||Jn("color=truecolor"))return 3;if(Jn("color=256"))return 2;if(e&&!t&&Gi===void 0)return 0;let n=Gi||0;if(kt.TERM==="dumb")return n;if(process.platform==="win32"){let r=are.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 cre(e){let t=NR(e,e&&e.isTTY);return AR(t)}var AW={supportsColor:cre,stdout:AR(NR(!0,IW.isatty(1))),stderr:AR(NR(!0,IW.isatty(2)))};var Hc=1e3,Fc=Hc*60,Wc=Fc*60,Hs=Wc*24,lre=Hs*7,pre=Hs*365.25,NW=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return ure(e);if(n==="number"&&isFinite(e))return t.long?mre(e):dre(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ure(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*pre;case"weeks":case"week":case"w":return n*lre;case"days":case"day":case"d":return n*Hs;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Wc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Fc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Hc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function dre(e){var t=Math.abs(e);return t>=Hs?Math.round(e/Hs)+"d":t>=Wc?Math.round(e/Wc)+"h":t>=Fc?Math.round(e/Fc)+"m":t>=Hc?Math.round(e/Hc)+"s":e+"ms"}function mre(e){var t=Math.abs(e);return t>=Hs?K_(e,t,Hs,"day"):t>=Wc?K_(e,t,Wc,"hour"):t>=Fc?K_(e,t,Fc,"minute"):t>=Hc?K_(e,t,Hc,"second"):e+" ms"}function K_(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}function fre(e){n.debug=n,n.default=n,n.coerce=a,n.disable=s,n.enable=o,n.enabled=c,n.humanize=NW,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 o(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 i(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(i(p,u))return!1;for(let u of n.names)if(i(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 RW=fre;(function(e,t){let n=gre,r=_re;t.init=p,t.log=c,t.formatArgs=i,t.save=a,t.load=l,t.useColors=o,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=AW;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 o(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:n.isatty(process.stderr.fd)}function i(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=RW(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)}})(X_,X_.exports);var RR=X_.exports,vW=ki(RR);import yre from"os";import Sre from"path";import Ere from"fs";var{create:Tre}=Z_,vR=hre,Ire=SR,{pathToFileURL:OW}=bre,Are=TR,{emitDiagnostics:CW}=Vo,q_=RR("@apm-js-collab/tracing-hooks:module-patch"),OR=class{constructor({instrumentations:t=[]}={}){this.packages=new Set(t.map(n=>n.module.name)),this.instrumentator=Tre(t),this.compile=vR.prototype._compile}patch(){let t=this;vR.prototype._compile=function(...r){let[o,i]=r,s=Ire(i);if(s&&t.packages.has(s.name)){q_("found resolved module, checking if there is a transformer %s",i);let c=Are(s.basedir,s.name),a=t.instrumentator.getTransformer(s.name,c,s.path);if(a){q_("transforming file %s",i);try{let l=a.transform(o,"cjs");r[0]=l?.code,CW({url:OW(i).href,moduleName:a.moduleName}),process.env.TRACING_DUMP&&Nre(r[0],i)}catch(l){q_("Error transforming module %s: %o",i,l),CW({url:OW(i).href,moduleName:a.moduleName,error:l})}finally{a.free()}}}return t.compile.apply(this,r)}}unpatch(){vR.prototype._compile=this.compile}};function Nre(e,t){let n=yre,r=Sre,o=Ere,i=process.env.TRACING_DUMP_DIR??n.tmpdir(),s=r.dirname(t),c=r.basename(t),a=r.join(i,s),l=r.join(a,c);q_("Dumping patched code to: %s",l),o.mkdirSync(a,{recursive:!0}),o.writeFileSync(l,e)}var Rre=OR,xW=ki(Rre);import{fileURLToPath as vre}from"url";import{MessageChannel as Ore}from"worker_threads";import{readFileSync as Cre}from"fs";var PW=vW("@apm-js-collab/tracing-hooks:esm-hook"),Q_=null,kW=null,LW=null,CR=Vo.emitDiagnostics;function MW(){let{port1:e,port2:t}=new Ore;return e.on("message",Vo.emitDiagnostics),e.unref(),t}function wW(e={}){let t=e?.instrumentations||[];LW=Z_.create(t),kW=new Set(t.map(n=>n.module.name)),Q_=new Map,CR=e?.diagnosticsPort?xre(e.diagnosticsPort):Vo.emitDiagnostics}function xre(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){PW("failed to post diagnostics for %s: %o",t.url,n)}}}function Pre(e){let t=SW(e.url);if(t&&kW.has(t.name)){let n=vre(t.basedir),r=EW(n),o=LW.getTransformer(t.name,r,t.path);o&&Q_.set(e.url,o)}return e}function GW(e,t,n){return Pre(n(e,t))}function UW(e,t,n){let r=n(e,t);if(Q_.has(e)===!1)return r;if(r.format==="commonjs"){let o=new URL(r.responseURL??e);r.source??=Cre(o)}return kre(e,r)}function kre(e,t){let n=t.source;if(n){let r=Q_.get(e);try{let o=t.format==="module"?"esm":t.format==="commonjs"?"cjs":"unknown",i=typeof n=="string"?n:Buffer.from(n).toString("utf8"),s=r.transform(i,o);t.source=s?.code,t.shortCircuit=!0,CR({url:e,moduleName:r.moduleName})}catch(o){PW("Error transforming module %s: %o",e,o),CR({url:e,moduleName:r.moduleName,error:o})}finally{r.free()}}return t}var T3e=Vo.setDiagnosticsHook;function Gre(e){if(e){let{major:r=0,minor:o=0}=Ks(e);return r>2||r===2&&o>=8}let{major:t=0,minor:n=0}=Ks(process.versions.node??"0.0.0");return t>25||t===25&&n>=1||t===24&&n>=13}function DW(e){if(!Mre&&!wre||te?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=Gre(t.Deno?.version?.deno),r=Lre;Vo.setDiagnosticsHook(({moduleName:o,error:i})=>{i?g.warn(`[orchestrion] failed to inject diagnostics-channel into ${o}:`,i):(te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[],te.__SENTRY_ORCHESTRION__.runtime.push(o))});try{if(typeof r.registerHooks=="function"&&n)wW({instrumentations:gu}),r.registerHooks({resolve:GW,load:UW}),g.log("Registered diagnostics-channel injection via Module.registerHooks()");else if(typeof r.register=="function"&&!t.Bun&&!t.Deno){let o=MW(),i;i=import.meta.url,r.register("@sentry/server-utils/orchestrion/hook",{parentURL:i,data:{instrumentations:gu,diagnosticsPort:o},transferList:[o]}),new xW({instrumentations:gu}).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(o){g.warn("Failed to register diagnostics-channel injection hooks; channel-based integrations will not record spans.",o);return}te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[]}function Ure(){return yN}function Dre(e){DG(()=>{let t=Object.values(yN).map(r=>r()),n=t.map(r=>r.name);return{integrations:[...t,FA({responseHook:xs}),bN({responseHook:xs})],replacedOtelIntegrationNames:n,register:()=>DW(),detect:fN}})}export{rn as NODE_VERSION,dc as NodeClient,JN 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,vp as SentryContextManager,zE as _INTERNAL_normalizeCollectionInterval,an as addBreadcrumb,Db as addEventProcessor,Yb as addIntegration,BN as amqplibIntegration,T1 as anrIntegration,jN as anthropicAIIntegration,Nne as applyDiagnosticsChannelInjectionIntegrations,bn as bindScopeToEmitter,ine as buildLaunchDarklyFlagUsedHandler,El as captureCheckIn,fy as captureConsoleIntegration,yl as captureEvent,ge as captureException,Cy as captureFeedback,bl as captureMessage,Bb as captureSession,af as childProcessIntegration,Gb as close,FI as connectIntegration,yf as consoleIntegration,xy as consoleLoggingIntegration,lf as contextLinesIntegration,vn as continueTrace,ky as createConsolaReporter,Af as createGetModuleFromFilename,gr as createLangChainCallbackHandler,C1 as createSentryWinstonTransport,Ia as createTransport,D1 as cron,Mte as dataloaderIntegration,gy as dedupeIntegration,Rf as defaultStackParser,Ure as diagnosticsChannelInjectionIntegrations,I1 as disableAnrDetectionForCallback,ns as endSession,yd as eventFiltersIntegration,Dre as experimentalUseDiagnosticsChannelInjection,yS as expressErrorHandler,aT as expressIntegration,_y as extraErrorDataIntegration,FT as fastifyIntegration,Ny as featureFlagsIntegration,eR as firebaseIntegration,es as flush,D4 as fsIntegration,Ol as functionToStringIntegration,fe as generateInstrumentOnce,AN as genericPoolIntegration,Q as getActiveSpan,tR as getAutoPerformanceIntegrations,O as getClient,ne as getCurrentScope,F2 as getDefaultIntegrations,H2 as getDefaultIntegrationsWithoutPerformance,ji as getGlobalScope,$ as getIsolationScope,Oe as getRootSpan,Nf as getSentryRelease,il as getSpanDescendants,wt as getSpanStatusFromHttpCode,tt as getTraceData,ay as getTraceMetaTags,XN as googleGenAIIntegration,KT as graphqlIntegration,lne as growthbookIntegration,MI as hapiIntegration,GI as honoIntegration,Vr as httpHeadersToSpanAttributes,nT as httpIntegration,Ka as httpServerIntegration,qa as httpServerSpansIntegration,Cl as inboundFiltersIntegration,Rne as init,rR as initOpenTelemetry,vne as initWithoutDefaultIntegrations,qd as instrumentAnthropicAiClient,Jd as instrumentGoogleGenAIClient,tm as instrumentLangChainEmbeddings,iP as instrumentLangGraph,jd as instrumentOpenAiClient,$l as instrumentStateGraph,zy as instrumentStateGraphCompile,Id as instrumentSupabaseClient,yc as isDiagnosticsChannelInjectionEnabled,ts as isEnabled,Ub as isInitialized,tI as kafkaIntegration,Ate as knexIntegration,BI as koaIntegration,qN as langChainIntegration,$N as langGraphIntegration,wb as lastEventId,one as launchDarklyIntegration,xl as linkedErrorsIntegration,mf as localVariablesIntegration,$E as logger,rI as lruMemoizerIntegration,If as makeNodeTransport,mt as metrics,ff as modulesIntegration,sI as mongoIntegration,cI as mongooseIntegration,fI as mysql2Integration,pI as mysqlIntegration,rT as nativeNodeFetchIntegration,cf as nodeContextIntegration,v1 as nodeRuntimeMetricsIntegration,gf as onUncaughtExceptionIntegration,_f as onUnhandledRejectionIntegration,VN as openAIIntegration,sne as openFeatureIntegration,gd as parameterize,L1 as pinoIntegration,OI as postgresIntegration,kI as postgresJsIntegration,Sne as preloadOpenTelemetry,jf as prismaIntegration,hf as processSessionIntegration,Oy as profiler,TI as redisIntegration,Pl as requestDataIntegration,Ey as rewriteFramesIntegration,Lb as setAttribute,kb as setAttributes,vb as setContext,GO as setConversationId,ey as setCurrentClient,Cb as setExtra,Ob as setExtras,zs as setHttpStatus,ob as setMeasurement,BE as setNodeAsyncContextStrategy,Pb as setTag,xb as setTags,Mb as setUser,Oz as setupConnectErrorHandler,H4 as setupExpressErrorHandler,tJ as setupFastifyErrorHandler,dz as setupHapiErrorHandler,Sz as setupHonoErrorHandler,Iz as setupKoaErrorHandler,Jl as spanStreamingIntegration,$h as spanToBaggageHeader,ie as spanToJSON,rl as spanToTraceHeader,bf as spotlightIntegration,L as startInactiveSpan,On as startNewTrace,Sl as startSession,Se as startSpan,Le as startSpanManual,ane as statsigIntegration,Ty as supabaseIntegration,Vn as suppressTracing,Sf as systemErrorIntegration,EN as tediousIntegration,tS as trpcMiddleware,cne as unleashIntegration,Kh as updateSpanName,Of as validateOpenTelemetrySetup,FN as vercelAIIntegration,IC as winterCGHeadersToDict,se as withActiveSpan,ir as withIsolationScope,Fr as withMonitor,He as withScope,Jh as withStreamedSpan,gS as wrapMcpServerWithSentry,Iy as zodErrorsIntegration};