@yukino.js/yukino 0.0.13 → 0.0.15

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 (108) hide show
  1. package/README.md +13 -11
  2. package/dist/a2a-ANR7PFD4.js +15 -0
  3. package/dist/acp-4E7R254I.js +14 -0
  4. package/dist/{anthropic-74ALYMH2.js → anthropic-ZO73YJFY.js} +1 -1
  5. package/dist/browser/dist/index.html +44 -0
  6. package/dist/browser/dist/static/index.css +2 -0
  7. package/dist/browser/dist/static/index.js +203 -0
  8. package/dist/bwrap-LVIPV72Q.js +0 -0
  9. package/dist/chunk-3KKA6537.js +0 -0
  10. package/dist/chunk-3RH3COZW.js +365 -0
  11. package/dist/chunk-4JHZPFU6.js +67 -0
  12. package/dist/chunk-7MKA3SHV.js +0 -0
  13. package/dist/{chunk-OREDGNI6.js → chunk-B2RNOTT5.js} +1 -1
  14. package/dist/{chunk-APJAUOF6.js → chunk-C56EKYBO.js} +1 -1
  15. package/dist/{chunk-WGFROGUC.js → chunk-CKOUBYG6.js} +0 -0
  16. package/dist/{chunk-6JUOKMSJ.js → chunk-CW6G3RYM.js} +1 -1
  17. package/dist/{chunk-556TRLPT.js → chunk-CWWRUTF2.js} +1 -1
  18. package/dist/chunk-DVB57IVG.js +18 -0
  19. package/dist/chunk-ETZPOVUC.js +4 -0
  20. package/dist/chunk-F3JTT3TI.js +110 -0
  21. package/dist/chunk-FC2LG24U.js +4 -0
  22. package/dist/chunk-FNQMXCCE.js +4 -0
  23. package/dist/chunk-HWCLMDQF.js +0 -0
  24. package/dist/chunk-I74AL3PF.js +0 -0
  25. package/dist/chunk-IOMQY54U.js +967 -0
  26. package/dist/chunk-IQT2IFSO.js +4 -0
  27. package/dist/chunk-K45OXLJJ.js +16 -0
  28. package/dist/chunk-KJJYW5IY.js +0 -0
  29. package/dist/chunk-LCWNSYZU.js +0 -0
  30. package/dist/chunk-LR4ZNAAM.js +4 -0
  31. package/dist/chunk-LTMY67B2.js +5 -0
  32. package/dist/chunk-MDPSQ6L7.js +0 -0
  33. package/dist/chunk-MQAQBW7F.js +0 -0
  34. package/dist/{chunk-NEU4ER5V.js → chunk-NSNTZXFL.js} +1 -1
  35. package/dist/chunk-P6DHMU7R.js +0 -0
  36. package/dist/chunk-VCIRD267.js +0 -0
  37. package/dist/chunk-VM4YKTHC.js +0 -0
  38. package/dist/chunk-VU3JWAJR.js +0 -0
  39. package/dist/chunk-W4GMCNWF.js +0 -0
  40. package/dist/chunk-XY7ZFVZL.js +4 -0
  41. package/dist/devtools-UVGRIXO2.js +0 -0
  42. package/dist/{esm-HW2JMFYC.js → esm-2JJG3HR7.js} +1 -1
  43. package/dist/esm-7DWXO52B.js +4 -0
  44. package/dist/{esm-6L5BJ5GT.js → esm-EOOB75BT.js} +1 -1
  45. package/dist/{esm-DIYJ5HX6.js → esm-H73EL6IR.js} +1 -1
  46. package/dist/{esm-YKAO4ES6.js → esm-IBZKE3IU.js} +1 -1
  47. package/dist/esm-W4NAAZTQ.js +225 -0
  48. package/dist/{esm-RPR2GBJ2.js → esm-Y237QNPJ.js} +1 -1
  49. package/dist/getMachineId-bsd-A3UCSHLE.js +4 -0
  50. package/dist/getMachineId-bsd-E27XJQLX.js +0 -0
  51. package/dist/getMachineId-darwin-35UPAIXP.js +0 -0
  52. package/dist/getMachineId-darwin-MWJEU7OI.js +5 -0
  53. package/dist/getMachineId-linux-FNSLKUDN.js +4 -0
  54. package/dist/getMachineId-linux-MKXIYT6A.js +0 -0
  55. package/dist/getMachineId-unsupported-PKQWB2OJ.js +4 -0
  56. package/dist/getMachineId-unsupported-ZXVGGFX2.js +0 -0
  57. package/dist/getMachineId-win-3A667JT3.js +4 -0
  58. package/dist/getMachineId-win-RNVIYJG5.js +0 -0
  59. package/dist/lib/{anthropic-EQRUGP2C.js → anthropic-SQBOFRPQ.js} +4 -4
  60. package/dist/lib/{chunk-EGT7BJRD.js → chunk-AW2577J5.js} +2 -2
  61. package/dist/lib/{chunk-JYCSWXCR.js → chunk-GPJL4PLE.js} +2 -2
  62. package/dist/lib/{chunk-UBVKYJFI.js → chunk-IHVYAEY2.js} +1058 -522
  63. package/dist/lib/{chunk-CDMR25FD.js → chunk-U3OT4POQ.js} +3 -3
  64. package/dist/lib/{chunk-HUTUNNDX.js → chunk-WNGF7243.js} +0 -1
  65. package/dist/lib/{chunk-FUJDUZTH.js → chunk-WXR5HNB4.js} +1 -1
  66. package/dist/lib/{chunk-WWCSFKMR.js → chunk-XS3GONYN.js} +2 -11
  67. package/dist/lib/index.d.ts +98 -282
  68. package/dist/lib/index.js +1092 -2409
  69. package/dist/lib/{openai-B3I5WBFT.js → openai-UV4KFNQV.js} +3 -3
  70. package/dist/lib/{providers-EJ4VBHNP.js → providers-77VBEX3K.js} +2 -2
  71. package/dist/lib/{tool-filter-TURPCYFR.js → tool-filter-MLYQGWM5.js} +3 -3
  72. package/dist/{main-JEEKFCGX.js → main-653YZQHY.js} +228 -232
  73. package/dist/main.js +2 -2
  74. package/dist/node-634LOHDX.js +0 -0
  75. package/dist/{openai-7C6BVQ7M.js → openai-FKLMHNNC.js} +1 -1
  76. package/dist/providers-4IU7SUEQ.js +4 -0
  77. package/dist/seatbelt-UO7HGD4Z.js +0 -0
  78. package/dist/server-4NHV4RJL.js +4 -0
  79. package/dist/slim-Q56GHZZP.js +0 -0
  80. package/dist/{src-JBRNH4FA.js → src-DEVJGNXS.js} +1 -1
  81. package/dist/{src-X6JWWHHT.js → src-EMFESWQS.js} +1 -1
  82. package/dist/{src-R4BSSIJJ.js → src-GG4YROJH.js} +1 -1
  83. package/dist/{src-43CPCEK2.js → src-JFAO2DGP.js} +1 -1
  84. package/dist/tool-filter-LJTLMGFP.js +4 -0
  85. package/dist/turndown.es-NQ3KDXM7.js +0 -0
  86. package/package.json +22 -21
  87. package/dist/a2a-DKWMWGID.js +0 -14
  88. package/dist/acp-RL6DKS3R.js +0 -14
  89. package/dist/chunk-2LHY3FND.js +0 -67
  90. package/dist/chunk-3QL446GD.js +0 -4
  91. package/dist/chunk-6FSIG63T.js +0 -364
  92. package/dist/chunk-A5G5NTDB.js +0 -1015
  93. package/dist/chunk-A7CJPQC5.js +0 -5
  94. package/dist/chunk-AGSYLE4E.js +0 -16
  95. package/dist/chunk-CJSMVCUF.js +0 -6
  96. package/dist/chunk-CU3IISCC.js +0 -4
  97. package/dist/chunk-HMZQYFYG.js +0 -4
  98. package/dist/chunk-JFKC4VCA.js +0 -4
  99. package/dist/chunk-KCMBAHWU.js +0 -4
  100. package/dist/chunk-SCR7NDDL.js +0 -63
  101. package/dist/esm-57CJEGGK.js +0 -4
  102. package/dist/esm-YOQPBF42.js +0 -225
  103. package/dist/fe/dist/index.html +0 -21
  104. package/dist/fe/dist/static/index.css +0 -2
  105. package/dist/fe/dist/static/index.js +0 -203
  106. package/dist/providers-U23PWAHG.js +0 -4
  107. package/dist/server-EOSEQPNY.js +0 -4
  108. package/dist/tool-filter-UDSHRE5F.js +0 -4
@@ -0,0 +1,225 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __yukinoCreateRequire } from "node:module";
3
+ const require = __yukinoCreateRequire(import.meta.url);
4
+ import{b as T2}from"./chunk-CKOUBYG6.js";import"./chunk-VU3JWAJR.js";import{a as Cs,b as xs,c as tv,e as eu,m as __,n as nv,r as Ir,t as rv}from"./chunk-XY7ZFVZL.js";import"./chunk-IQT2IFSO.js";import{a as zN,c as ko,d as $p,g as Tr,h as ev,k as g_,m as Nt,n as Mn,o as pe,p as tn,q as zp,r as pi,s as he,u as st}from"./chunk-VCIRD267.js";import{a as Sn,c as Qp,d as $N,e as Jp}from"./chunk-7MKA3SHV.js";var qy=Qp((_Te,sk)=>{"use strict";var Ky=Sn("path").sep;sk.exports=function(e){var t=e.split(Ky),n=t.lastIndexOf("node_modules");if(n!==-1&&t[n+1]){for(var r=t[n+1][0]==="@",i=r?t[n+1]+"/"+t[n+2]:t[n+1],o=r?3:2,s="",c=n+o-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+Ky;for(var l="",p=t.length-1,u=n+o;u<=p;u++)u===p?l+=t[u]:l+=t[u]+Ky;return{name:i,basedir:s,path:l}}}});var zy=Qp((hTe,$y)=>{"use strict";var Ha=Sn("path"),fr=Sn("module"),mt=T2()("require-in-the-middle"),Dj=qy();$y.exports=jl;$y.exports.Hook=jl;var Qy,tm;if(fr.isBuiltin)tm=fr.isBuiltin;else if(fr.builtinModules)tm=e=>e.startsWith("node:")?!0:(Qy===void 0&&(Qy=new Set(fr.builtinModules)),Qy.has(e));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var Bj=/([/\\]index)?(\.js)?$/,Jy=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=Sn.cache[t];return!!(r&&this._kRitmExports in r)}}get(t,n){let r=this._localCache.get(t);if(r!==void 0)return r;if(!n){let i=Sn.cache[t];return i&&i[this._kRitmExports]}}set(t,n,r){r?this._localCache.set(t,n):t in Sn.cache?Sn.cache[t][this._kRitmExports]=n:(mt('non-core module is unexpectedly not in require.cache: "%s"',t),this._localCache.set(t,n))}};function jl(e,t,n){if(!(this instanceof jl))return new jl(e,t,n);if(typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),typeof fr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof fr._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 Jy,this._unhooked=!1,this._origRequire=fr.prototype.require;let r=this,i=new Set,o=t?t.internals===!0:!1,s=Array.isArray(e);mt("registering require hook"),this._require=fr.prototype.require=function(a){return r._unhooked===!0?(mt("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?(mt("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=tm(p),d;if(u){if(d=p,p.startsWith("node:")){let M=p.slice(5);tm(M)&&(d=M)}}else{if(l)return mt("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,a);try{d=fr._resolveFilename(p,this)}catch(M){return mt('Module._resolveFilename("%s") threw %j, calling original Module.require',p,M.message),r._origRequire.apply(this,a)}}let m,_;if(mt("processing %s module require('%s'): %s",u===!0?"core":"non-core",p,d),r._cache.has(d,u)===!0)return mt("returning already patched cached module: %s",d),r._cache.get(d,u);let h=i.has(d);h===!1&&i.add(d);let b=l?r._origGetBuiltinModule.apply(this,a):r._origRequire.apply(this,a);if(h===!0)return mt("module is in the process of being patched already - ignoring: %s",d),b;if(i.delete(d),u===!0){if(s===!0&&e.includes(d)===!1)return mt("ignoring core module not on whitelist: %s",d),b;m=d}else if(s===!0&&e.includes(d)){let M=Ha.parse(d);m=M.name,_=M.dir}else{let M=Dj(d);if(M===void 0)return mt("could not parse filename: %s",d),b;m=M.name,_=M.basedir;let v=Hj(M);mt("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",m,p,v,_);let N=!1;if(s){if(!p.startsWith(".")&&e.includes(p)&&(m=p,N=!0),!e.includes(m)&&!e.includes(v))return b;e.includes(v)&&v!==m&&(m=v,N=!0)}if(!N){let P;try{P=Sn.resolve(m,{paths:[_]})}catch{return mt("could not resolve module: %s",m),r._cache.set(d,b,u),b}if(P!==d)if(o===!0)m=m+Ha.sep+Ha.relative(_,d),mt("preparing to process require of internal file: %s",m);else return mt("ignoring require of non-main module file: %s",P),r._cache.set(d,b,u),b}}r._cache.set(d,b,u),mt("calling require hook: %s",m);let R=n(b,m,_);return r._cache.set(d,R,u),mt("returning module: %s",m),R}}jl.prototype.unhook=function(){this._unhooked=!0,this._require===fr.prototype.require?(fr.prototype.require=this._origRequire,mt("require unhook successful")):mt("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,mt("process.getBuiltinModule unhook successful")):mt("process.getBuiltinModule unhook unsuccessful"))};function Hj(e){let t=Ha.sep!=="/"?e.path.split(Ha.sep).join("/"):e.path;return Ha.posix.join(e.name,t).replace(Bj,"")}});var gk=Qp(Fa=>{"use strict";var iS=[],dk=new WeakMap,tS,nS,lk,oS=new Map,sS=[];function pk(e,t){return t==="module.exports"&&!Object.hasOwn(e,t)?e.default:e[t]}function mk(e,t,n){return dk.get(e).write(t,n)}function Vj(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return mk(e,t,n.value)}var Yj={defineProperty:Vj,set:mk};function fk(e,t,n){let r=tS.get(e)?.[t];return typeof r=="function"?r(n):!0}function jj(e,t){if(t===Symbol.toStringTag)return"Module";let n=nS.get(e)[t];if(typeof n=="function")return n()}function Zj(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return fk(e,t,n.value)}function Xj(e,t,n,r,i){tS??=new WeakMap,nS??=new WeakMap,lk??={defineProperty:Zj,get:jj,set:fk},oS.set(e,i),tS.set(t,n),nS.set(t,r);let o=new Proxy(t,lk);iS.forEach(s=>s(e,o,i)),sS.push([e,o,i])}function Kj(e,t,n,r,i){if(arguments.length===5){Xj(e,t,n,r,i);return}let{namespace:o}=t;oS.set(e,n),dk.set(o,t);let s=new Proxy(o,Yj);iS.forEach(c=>c(e,s,n)),sS.push([e,s,n])}var uk=[0,10,50],rS=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});#r=Object.create(null);#t;#n;#e;constructor(t,n,r,i){if(this.#t=r,n!==void 0)for(let o=0;o<n.length;o++)this.#s(n[o],o,i?.[o]??t)}#s(t,n,r){let i;try{i=pk(r,t),this.#t(n,i),this.namespace[t]=i}catch(o){if(!(o instanceof ReferenceError))throw o}i===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 i=pk(r,t);return i!==void 0?(this.#t(n,i),this.namespace[t]=i,!0):!1}catch(i){if(i instanceof ReferenceError)return!1;throw i}}}#i(){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.#i(),this.#o(0)})}#o(t){if(this.#e===void 0)return;if(t>=uk.length){this.#e=void 0;return}let n=setTimeout(()=>{this.#i(),this.#o(t+1)},uk[t]);n&&typeof n.unref=="function"&&n.unref()}};Fa.register=Kj;Fa.ModuleBinder=rS;Fa.importHooks=iS;Fa.specifiers=oS;Fa.toHook=sS});var pS=Qp((ITe,Va)=>{"use strict";var _k=Sn("path"),qj=qy(),{fileURLToPath:Qj}=Sn("url"),{MessageChannel:Jj}=Sn("worker_threads"),{isBuiltin:aS}=Sn("module");aS||(aS=()=>!0);var{importHooks:cS,specifiers:hk,toHook:$j}=gk();function zj(e,t){if(!(process.env.TURBOPACK??process.argv.includes("--turbo")))return!1;let r=e.slice(0,e.lastIndexOf("-"));return t.endsWith(r)}function bk(e){cS.push(e),$j.forEach(([t,n,r])=>e(t,n,r))}function yk(e){let t=cS.indexOf(e);t>-1&&cS.splice(t,1)}function Wa(e,t,n,r){let i=e(t,n,r);i&&i!==t&&"default"in t&&(t.default=i)}var lS;function eZ(){let{port1:e,port2:t}=new Jj,n=0,r;lS=c=>{n++,e.postMessage(c)},e.on("message",()=>{n--,r&&n<=0&&r()}).unref();function i(){let c=setInterval(()=>{},1e3),a=new Promise(l=>{r=l}).then(()=>{clearInterval(c)});return n===0&&r(),a}let o=t;return{registerOptions:{data:{addHookMessagePort:o,include:[]},transferList:[o]},addHookMessagePort:o,waitForAllMessagesAcknowledged:i}}function Zl(e,t,n){if(!(this instanceof Zl))return new Zl(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;lS&&Array.isArray(e)&&lS(e),this._iitmHook=(i,o,s)=>{let c=i,a=c.startsWith("node:"),l,p;if(a){let u=i.slice(5);aS(u)&&(i=u)}else if(c.startsWith("file://")){let u=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=Qj(i),i=l}catch{}if(Error.stackTraceLimit=u,l){let d=qj(l);d&&(i=d.name,p=d.basedir)}}if(e)for(let u of e)if(l&&u===l)Wa(n,o,l,void 0);else if(u===i){if(!p)Wa(n,o,i,p);else if(p.endsWith(hk.get(c))||zj(hk.get(c),p))Wa(n,o,i,p);else if(r){let d=i+_k.sep+_k.relative(p,l);Wa(n,o,d,p)}}else u===s&&Wa(n,o,s,p);else Wa(n,o,i,p)},bk(this._iitmHook)}Zl.prototype.unhook=function(){yk(this._iitmHook)};Va.exports=Zl;Va.exports.Hook=Zl;Va.exports.addHook=bk;Va.exports.removeHook=yk;Va.exports.createAddHookMessageChannel=eZ});var E=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var te=globalThis;var q="10.76.2";function Je(){return Qn(te),te}function Qn(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||q,t[q]=t[q]||{}}function wn(e,t,n=te){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[q]=r[q]||{};return i[e]||(i[e]=t())}var $n=["debug","info","warn","error","log","assert","trace"],I2="Sentry Logger ",Jn={};function Me(e){if(!("console"in te))return e();let t=te.console,n={},r=Object.keys(Jn);r.forEach(i=>{let o=Jn[i];n[i]=t[i],t[i]=o});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function A2(){b_().enabled=!0}function N2(){b_().enabled=!1}function iv(){return b_().enabled}function v2(...e){h_("log",...e)}function R2(...e){h_("warn",...e)}function O2(...e){h_("error",...e)}function h_(e,...t){E&&iv()&&Me(()=>{te.console[e](`${I2}[${e}]:`,...t)})}function b_(){return E?wn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:A2,disable:N2,isEnabled:iv,log:v2,warn:R2,error:O2};var ov=/\(error: (.*)\)/,sv=/captureMessage|captureException/;function nu(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{let o=[],s=n.split(`
5
+ `);for(let c=r;c<s.length;c++){let a=s[c];a.length>1024&&(a=a.slice(0,1024));let l=ov.test(a)?a.replace(ov,"$1"):a;if(!l.includes("Error: ")){for(let p of t){let u=p(l);if(u){o.push(u);break}}if(o.length>=50+i)break}}return av(o.slice(i))}}function S_(e){return Array.isArray(e)?nu(...e):e}function av(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(tu(t).function||"")&&t.pop(),t.reverse(),sv.test(tu(t).function||"")&&(t.pop(),sv.test(tu(t).function||"")&&t.pop()),t.slice(0,50).map(n=>({...n,filename:n.filename||tu(t).filename,function:n.function||"?"}))}function tu(e){return e[e.length-1]||{}}var y_="<anonymous>";function Rc(e){try{return!e||typeof e!="function"?y_:e.name||y_}catch{return y_}}function ru(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 cv(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var Oc={},lv={};function E_(e,t){return Oc[e]=Oc[e]||[],Oc[e].push(t),()=>{let n=Oc[e];if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}function Cc(e,t){if(!lv[e]){lv[e]=!0;try{t()}catch(n){E&&g.error(`Error while instrumenting ${e}`,n)}}}function Ps(e,t){let n=e&&Oc[e];if(n)for(let r of n)try{r(t)}catch(i){E&&g.error(`Error while triggering instrumentation handler.
6
+ Type: ${e}
7
+ Name: ${Rc(r)}
8
+ Error:`,i)}}var pv=Object.prototype.toString;function et(e){switch(pv.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return N_(e,Error)}}function iu(e,t){return pv.call(e)===`[object ${t}]`}function T_(e){return iu(e,"ErrorEvent")}function ks(e){return iu(e,"String")}function Bi(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function zn(e){return e===null||Bi(e)||typeof e!="object"&&typeof e!="function"}function Vt(e){return iu(e,"Object")}function B(e){return typeof e=="object"&&e!==null}function I_(e){return typeof Event<"u"&&N_(e,Event)}function A_(e){return iu(e,"RegExp")}function _t(e){return!!(e?.then&&typeof e.then=="function")}function N_(e,t){try{return e instanceof t}catch{return!1}}function Pt(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!="function")return;let i=n(r);typeof i=="function"&&Lo(i,r);try{e[t]=i}catch{E&&g.log(`Failed to replace method "${t}" in object`,e)}}function we(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 Lo(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,we(e,"__sentry_original__",t)}catch{}}function Ls(e,t,n,r=!0){let i=e[t];if(typeof i!="function")throw new Error(`Cannot wrap method: ${t} is not a function`);if(Ar(i))throw new Error(`Attempting to wrap method ${t} multiple times`);Lo(n,i),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function Ar(e){return e.__sentry_original__}function ou(e){if(et(e))return{message:e.message,name:e.name,stack:e.stack,...uv(e)};if(I_(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...uv(e)}}return e}function uv(e){return B(e)?Object.fromEntries(Object.entries(e)):{}}function v_(e){let t=Object.keys(ou(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var Ms;function Mo(e){if(Ms!==void 0)return Ms?Ms(e):e();let t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=te;return t in n&&typeof n[t]=="function"?(Ms=n[t],Ms(e)):(Ms=null,e())}function at(){return Mo(()=>Math.random())}function tt(){return Mo(()=>Date.now())}var dv=Symbol.for("sentry.skipNormalization"),mv=Symbol.for("sentry.overrideNormalizationDepth");function fv(e){we(e,dv,!0)}function gv(e,t){we(e,mv,t)}function _v(e){return!!e[dv]}function hv(e){let t=e[mv];return typeof t=="number"?t:void 0}var bv;function Ke(e,t=100,n=1/0){try{return R_("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function O_(e,t=3,n=100*1024){let r=Ke(e,t);return P2(r)>n?O_(e,t-1,n):r}function R_(e,t,n=1/0,r=1/0,i=k2()){let[o,s]=i;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let c=C_(e,t);if(!c.startsWith("[object "))return c;if(_v(t))return t;let a=hv(t),l=a!==void 0?a:n;if(l===0)return c.replace("object ","");if(o(t))return"[Circular ~]";let p=t;if(p&&typeof p.toJSON=="function")try{let _=p.toJSON();return R_("",_,l-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,m=ou(t);for(let _ in m){if(!Object.prototype.hasOwnProperty.call(m,_))continue;if(d>=r){u[_]="[MaxProperties ~]";break}let h=m[_];u[_]=R_(_,h,l-1,r,i),d++}return s(t),u}function C_(e,t){try{if(bv){let r=bv(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${Rc(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${C2(t)}]`}catch(n){return`**non-serializable** (${n})`}}function C2(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function x2(e){return~-encodeURI(e).split(/%..|./).length}function P2(e){return x2(JSON.stringify(e))}function k2(){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 Ge(e,t="[unserializable]"){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return typeof t=="function"?t(e):t}}function dn(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function x_(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,r);return o>r-5&&(o=r),o===r&&(i=Math.max(o-140,0)),n=n.slice(i,o),i>0&&(n=`'{snip} ${n}`),o<r&&(n+=" {snip}"),n}function ws(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let i=e[r];zn(i)?n.push(String(i)):i instanceof Error?n.push(i.message?`${i.name}: ${i.message}`:i.name):n.push(C_(void 0,i))}return n.join(t)}function Nr(e,t,n=!1){return ks(e)?A_(t)?t.test(e):ks(t)?n?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function mn(e,t=[],n=!1){for(let r of t)if(Nr(e,r,n))return!0;return!1}function L2(){let e=te;return e.crypto||e.msCrypto}var P_;function M2(){return at()*16}function pt(e=L2()){try{if(e?.randomUUID)return Mo(()=>e.randomUUID()).replace(/-/g,"")}catch{}return P_||(P_="10000000100040008000"+1e11),P_.replace(/[018]/g,t=>(t^(M2()&15)>>t/4).toString(16))}function yv(e){return e.exception?.values?.[0]}function Hi(e){let{message:t,event_id:n}=e;if(t)return t;let r=yv(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function L_(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type=n||"Error")}function Gn(e,t){let n=yv(e);if(!n)return;let r={type:"generic",handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&"data"in t){let o={...i?.data,...t.data};n.mechanism.data=o}}var w2=/^(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 k_(e){return parseInt(e||"",10)}function Gs(e){let t=e.match(w2)||[],n=k_(t[1]),r=k_(t[2]),i=k_(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:t[4]}}function su(e){if(Sv(e))return!0;try{we(e,"__sentry_captured__",!0)}catch{}return!1}function Sv(e){try{return e.__sentry_captured__}catch{}}var Tv=1e3;function vr(){return tt()/Tv}function G2(){let{performance:e}=te;if(!e?.now||!e.timeOrigin)return vr;let t=e.timeOrigin;return()=>(t+Mo(()=>e.now()))/Tv}var Ev;function ct(){return(Ev??(Ev=G2()))()}function Iv(e){let t=ct(),n={sid:pt(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>U2(n)};return e&&ui(n,e),n}function ui(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||ct(),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:pt()),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 Av(e,t){let n={};t?n={status:t}:e.status==="ok"&&(n={status:"exited"}),ui(e,n)}function U2(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 Fi(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Fi(r[i],t[i],n-1));return r}function ht(){return pt()}function Yt(){return pt().substring(16)}function wo(e){try{let t=te.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function Go(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}var M_="_sentrySpan";function Un(e,t){t?we(e,M_,wo(t)):delete e[M_]}function er(e){return Go(e[M_])}var D2=100,jt=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:ht(),sampleRand:at()}}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,Un(t,er(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&&ui(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():Vt(n)?t:void 0,{tags:i,attributes:o,extra:s,user:c,contexts:a,level:l,fingerprint:p=[],propagationContext:u,conversationId:d}=r||{};return this._tags={...this._tags,...i},this._attributes={...this._attributes,...o},this._extra={...this._extra,...s},this._contexts={...this._contexts,...a},c&&Object.keys(c).length&&(this._user=c),l&&(this._level=l),p.length&&(this._fingerprint=p),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Un(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ht(),sampleRand:at()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){let r=typeof n=="number"?n:D2;if(r<=0)return this;let i={timestamp:vr(),...t,message:t.message?dn(t.message,2048):t.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(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:er(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Fi(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){let r=n?.event_id||pt();if(!this._client)return E&&g.warn("No client configured on scope - will not capture exception!"),r;let i=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureMessage(t,n,r){let i=r?.event_id||pt();if(!this._client)return E&&g.warn("No client configured on scope - will not capture message!"),i;let o=r?.syntheticException??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:o,...r,event_id:i},this),i}captureEvent(t,n){let r=t.event_id||n?.event_id||pt();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 Us(){return wn("defaultCurrentScope",()=>new jt)}function vt(){return wn("defaultIsolationScope",()=>new jt)}var Nv=e=>e instanceof Promise&&!e[vv],vv=Symbol("chained PromiseLike"),au=(e,t,n)=>{let r=e.then(i=>(t(i),i),i=>{throw n(i),i});return Nv(r)&&Nv(e)?r:B2(e,r)},B2=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let i=e[r];typeof i=="function"?Object.defineProperty(t,r,{value:(...o)=>i.apply(e,o),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[vv]:!0}),t};var w_=class{constructor(t,n){let r;t?r=t:r=new jt;let i;n?i=n:i=new jt,this._stack=[{scope:r}],this._isolationScope=i}withScope(t){let n=this._pushScope(),r;try{r=t(n)}catch(i){throw this._popScope(),i}return _t(r)?au(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 Ds(){let e=Je(),t=Qn(e);return t.stack=t.stack||new w_(Us(),vt())}function H2(e){return Ds().withScope(e)}function F2(e,t){let n=Ds();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Rv(e){return Ds().withScope(()=>e(Ds().getIsolationScope()))}function Ov(){return{withIsolationScope:Rv,withScope:H2,withSetScope:F2,withSetIsolationScope:(e,t)=>Rv(t),getCurrentScope:()=>Ds().getScope(),getIsolationScope:()=>Ds().getIsolationScope()}}function G_(e){let t=Je(),n=Qn(t);n.acs=e}function bt(e){let t=Qn(e);return t.acs?t.acs:Ov()}function W2(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function V2(e,t){let{value:n,unit:r}=W2(e)?e:{value:e,unit:void 0},i=Y2(n),o=r&&typeof r=="string"?{unit:r}:{};if(i)return{...i,...o};if(!t||t==="skip-undefined"&&n===void 0)return;let s="";try{s=JSON.stringify(n)??""}catch{}return{value:s,type:"string",...o}}function di(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let o=V2(i,t);o&&(n[r]=o)}return n}function U_(e){if(!e)return 0;let t=0;for(let[n,r]of Object.entries(e)){t+=n.length*2,t+=r.type.length*2,t+=(r.unit?.length??0)*2;let i=r.value;Array.isArray(i)?t+=Cv(i[0])*i.length:zn(i)?t+=Cv(i):t+=100}return t}function Cv(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function Y2(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 xv;function Pv(){return xv?.()}function D_(){return xv!==void 0}function ne(){let e=Je();return bt(e).getCurrentScope()}function J(){let e=Je();return bt(e).getIsolationScope()}function Uo(){return wn("globalScope",()=>new jt)}function Be(...e){let t=Je(),n=bt(t);if(e.length===2){let[r,i]=e;return r?n.withSetScope(r,i):n.withScope(i)}return n.withScope(e[0])}function tr(...e){let t=Je(),n=bt(t);if(e.length===2){let[r,i]=e;return r?n.withSetIsolationScope(r,i):n.withIsolationScope(i)}return n.withIsolationScope(e[0])}function C(){return ne().getClient()}function Do(e){let t=Pv();if(t)return{trace_id:t.traceId,span_id:t.spanId};let n=e.getPropagationContext(),{traceId:r,parentSpanId:i,propagationSpanId:o}=n,s={trace_id:r,span_id:o||Yt()};return i&&(s.parent_span_id=i),s}var ve="sentry.source",Dn="sentry.sample_rate",B_="sentry.previous_trace_sample_rate",H="sentry.op",S="sentry.origin",H_="sentry.status.message";var cu="sentry.measurement_unit",lu="sentry.measurement_value",F_="sentry.release",W_="sentry.environment";var V_="sentry.sdk.integrations",Y_="user.id",j_="user.email",xc="user.ip_address",Z_="user.name",fn="sentry.custom_span_name",Bs="sentry.profile_id",Hs="sentry.exclusive_time",X_="cache.hit",K_="cache.key",q_="cache.item_size",Q_="http.request.method";var Bo="gen_ai.conversation.id";function Zt(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 Fs(e,t){e.setAttribute("http.response.status_code",t);let n=Zt(t);n.message!=="unknown_error"&&e.setStatus(n)}var kv="_sentryScope",Lv="_sentryIsolationScope",Mv=Symbol.for("sentry.otelSourceInference"),wv=Symbol.for("sentry.otelSourceExplicitlySet"),Gv=Symbol.for("sentry.tracerProviderSpan");function Rr(e,t,n){e&&(we(e,Lv,wo(n)),we(e,kv,t))}function Xt(e){let t=e;return{scope:t[kv],isolationScope:Go(t[Lv])}}function J_(e){we(e,Mv,!0)}function Ws(e){return e[Mv]===!0}function $_(e){we(e,wv,!0)}function z_(e){return e[wv]===!0}function eh(e){we(e,Gv,!0)}function pu(e){return e[Gv]===!0}var mi="sentry-";var Dv=8192;function nr(e){let t=Vs(e);if(!t)return;let n=Object.entries(t).reduce((r,[i,o])=>{if(i.startsWith(mi)){let s=i.slice(mi.length);r[s]=o}return r},{});if(Object.keys(n).length>0)return n}function Wi(e){if(!e)return;let t=Object.entries(e).reduce((n,[r,i])=>(i&&(n[`${mi}${r}`]=i),n),{});return th(t)}function Vs(e){if(!(!e||!ks(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{let r=Uv(n);return Object.entries(r).forEach(([i,o])=>{t[i]=o}),t},{}):Uv(e)}function Uv(e){return e.split(",").map(t=>{let n=t.indexOf("=");if(n===-1)return[];let r=t.slice(0,n),i=t.slice(n+1);return[r,i].map(o=>{try{return decodeURIComponent(o.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}function th(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],i)=>{let o=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,s=i===0?o:`${t},${o}`;return s.length>Dv?(E&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):s},"")}function Ys(e,t){if(!e)return t;let n=Vs(e),r=Vs(t);if(!r)return e;let i={},o=!1,s={},c={};for(let[a,l]of Object.entries(r))a.startsWith(mi)?(s[a]=l,o=!0):c[a]=l;if(n)for(let[a,l]of Object.entries(n))(!o||!a.startsWith(mi))&&(i[a]=l);o&&Object.assign(i,s);for(let[a,l]of Object.entries(c))i[a]??(i[a]=l);return th(i)}var j2=/^o(\d+)\./,Z2=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function X2(e){return e==="http"||e==="https"}function nn(e,t=!1){let{host:n,path:r,pass:i,port:o,projectId:s,protocol:c,publicKey:a}=e;return`${c}://${a}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function K2(e){let t=Z2.exec(e);if(!t){Me(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i="",o="",s="",c=""]=t.slice(1),a="",l=c,p=l.split("/");if(p.length>1&&(a=p.slice(0,-1).join("/"),l=p.pop()),l){let u=l.match(/^\d+/);u&&(l=u[0])}return Bv({host:o,pass:i,path:a,projectId:l,port:s,protocol:n,publicKey:r})}function Bv(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function q2(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+$/)?X2(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 Q2(e){return e.match(j2)?.[1]}function uu(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Q2(n)),r}function Hv(e){let t=typeof e=="string"?K2(e):Bv(e);if(!(!t||!q2(t)))return t}function En(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 du=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Fv(e){if(!e)return;let t=e.match(du);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 Pc(e){return!!e.parentSpanId||!!e.dsc}function Tn(e,t){let n=Fv(e),r=nr(t);if(!n?.traceId)return{traceId:ht(),sampleRand:at()};let i=J2(n,r);r&&(r.sample_rand=i.toString());let{traceId:o,parentSpanId:s,parentSampled:c}=n;return{traceId:o,parentSpanId:s,sampled:c,dsc:r||{},sampleRand:i}}function Vi(e=ht(),t=Yt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function Yi(e=ht(),t=Yt(),n){return`00-${e}-${t}-${n?"01":"00"}`}function J2(e,t){let n=En(t?.sample_rand);if(n!==void 0)return n;let r=En(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?at()*r:r+at()*(1-r):at()}function kc(e,t){let n=uu(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 fu=0,Mc=1,Wv=!1;function Yv(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:o,status:s,origin:c,links:a}=oe(e);return{parent_span_id:o,span_id:t,trace_id:n,data:r,op:i,status:s,origin:c,links:a}}function Cr(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:oe(e).parent_span_id,o=Xt(e).scope,s=r?o?.getPropagationContext().propagationSpanId||Yt():t;return{parent_span_id:i,span_id:s,trace_id:n}}function wc(e){let{traceId:t,spanId:n}=e.spanContext(),r=qt(e);return Vi(t,n,r)}function jv(e){let{traceId:t,spanId:n}=e.spanContext(),r=qt(e);return Yi(t,n,r)}function Ho(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...i},attributes:o})=>({span_id:t,trace_id:n,sampled:r===Mc,attributes:o,...i}))}function rh(e){if(e?.length)return e.map(({context:{spanId:t,traceId:n,traceFlags:r},attributes:i})=>({span_id:t,trace_id:n,sampled:r===Mc,attributes:i}))}function Kt(e){return typeof e=="number"?Vv(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Vv(e.getTime()):ct()}function Vv(e){return e>9999999999?e/1e3:e}function oe(e){if(Gc(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Xv(e)){let{attributes:r,startTime:i,name:o,endTime:s,status:c,links:a}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:Zv(e),start_timestamp:Kt(i),timestamp:Kt(s)||void 0,status:Fo(c),op:r[H],origin:r[S],links:Ho(a)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function gu(e){if(Gc(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Xv(e)){let{attributes:r,startTime:i,name:o,endTime:s,status:c,links:a}=e;return{name:o,span_id:t,trace_id:n,parent_span_id:Zv(e),start_timestamp:Kt(i),end_timestamp:Kt(s),is_segment:e===js(e),status:hu(c),attributes:ih(r,c),links:rh(a)}}return{span_id:t,trace_id:n,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===js(e)}}function Zv(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function _u(e){return{...e,attributes:di(e.attributes),links:e.links?.map(t=>({...t,attributes:di(t.attributes)}))}}function Xv(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Gc(e){return typeof e.getSpanJSON=="function"}function qt(e){let{traceFlags:t}=e.spanContext();return t===Mc}function Fo(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function hu(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}function ih(e,t){let n=hu(t)==="error"?t?.message:void 0;return{...n&&{[H_]:n},...e}}var Lc="_sentryChildSpans",nh="_sentryRootSpan";function fi(e,t){let n=e[nh]||e;we(t,nh,n),qt(e)&&(!e.isRecording()&&!n.isRecording()||(e[Lc]?e[Lc].add(t):we(e,Lc,new Set([t]))))}function Uc(e){let t=new Set;function n(r){if(!t.has(r)&&qt(r)){t.add(r);let i=r[Lc]?Array.from(r[Lc]):[];for(let o of i)n(o)}}return n(e),Array.from(t)}var Re=js;function js(e){return e[nh]||e}function Q(){let e=Je(),t=bt(e);return t.getActiveSpan?t.getActiveSpan():er(ne())}function Wo(){Wv||(Me(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Wv=!0)}function oh(e,t){e.updateName(t),e.setAttributes({[ve]:"custom",[fn]:t})}function Ue(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=e||C()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Kv(e){g.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function rr(e,t){if(!t?.length)return!1;for(let n of t){if(z2(n)){if(e.description&&Nr(e.description,n))return E&&Kv(e),!0;continue}let r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;let i=n.name?e.description&&Nr(e.description,n.name):!0,o=n.op?e.op&&Nr(e.op,n.op):!0,s=n.attributes?Object.entries(n.attributes).every(([c,a])=>$2(e.attributes?.[c],a)):!0;if(i&&o&&s)return E&&Kv(e),!0}return!1}function $2(e,t){return typeof e=="string"&&(typeof t=="string"||t instanceof RegExp)?Nr(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e===t}function qv(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let i of e)i.parent_span_id===r&&(i.parent_span_id=n)}function z2(e){return typeof e=="string"||e instanceof RegExp}var Qv=Symbol.for("sentry.nonRecordingSpan"),xr=class{constructor(t={}){this._traceId=t.traceId||ht(),this._spanId=t.spanId||Yt(),this.dropReason=t.dropReason,we(this,Qv,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:fu}}end(t){}setAttribute(t,n){return this}setAttributes(t){return this}setStatus(t){return this}updateName(t){return this}isRecording(){return!1}addEvent(t,n,r){return this}addLink(t){return this}addLinks(t){return this}recordException(t,n){}};function ji(e){return!!e&&e[Qv]===!0}var Zi="production";var Jv="_frozenDsc";function sh(e,t){we(e,Jv,t)}function ah(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Zi,release:n.release,public_key:r,trace_id:e,org_id:uu(t)};return t.emit("createDsc",i),i}function ir(e,t){let n=t.getPropagationContext();return n.dsc||ah(n.traceId,e)}function nt(e){let t=C();if(!t)return{};let n=Re(e),r=oe(n),i=r.data,o=n.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[Dn]??i[B_];function c(b){return(typeof s=="number"||typeof s=="string")&&(b.sample_rate=`${s}`),b}let a=n[Jv];if(a)return c(a);let l=ji(n),p=l&&n.dropReason==="ignored";if(l&&(!Ue(t.getOptions())||p)){let b=Xt(n).scope;if(b){let R={...ir(t,b)};return p&&(R.sampled="false"),c(R)}}let u=o?.get("sentry.dsc"),d=u&&nr(u);if(d)return c(d);let m=ah(e.spanContext().traceId,t),_=i[ve]??i["sentry.segment.name.source"],h=r.description;return _!=="url"&&h&&(m.transaction=h),Ue()&&(m.sampled=String(qt(n)),m.sample_rand=o?.get("sentry.sample_rand")??Xt(n).scope?.getPropagationContext().sampleRand.toString()),c(m),t.emit("createDsc",m,n),m}function ch(e){let t=nt(e);return Wi(t)}function lh(e){return we(e,"_streamed",!0),e}function gi(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function kt(e,t=[]){return[e,t]}function bu(e,t){let[n,r]=e;return[n,[...r,t]]}function Dc(e,t){let n=e[1];for(let r of n){let i=r[0].type;if(t(r,i))return!0}return!1}function uh(e,t){return Dc(e,(n,r)=>t.includes(r))}function ph(e){let t=Qn(te);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Bc(e){let[t,n]=e,r=JSON.stringify(t);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[ph(r),o]:r.push(typeof o=="string"?ph(o):o)}for(let o of n){let[s,c]=o;if(i(`
9
+ ${JSON.stringify(s)}
10
+ `),typeof c=="string"||c instanceof Uint8Array)i(c);else{let a;try{a=JSON.stringify(c)}catch{a=JSON.stringify(Ke(c))}i(a)}}return typeof r=="string"?r:eW(r)}function eW(e){let t=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(t),r=0;for(let i of e)n.set(i,r),r+=i.length;return n}function dh(e){return[{type:"span"},e]}function mh(e){let t=typeof e.data=="string"?ph(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var $v={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function tW(e){return e in $v}function yu(e){return tW(e)?$v[e]:e}function Zs(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function fh(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(tt()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:nn(r)},...i&&{trace:i}}}function nW(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 zv(e,t,n,r){let i=Zs(n),o={sent_at:new Date(tt()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:nn(t)}},s="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return kt(o,[s])}function eR(e,t,n,r){let i=Zs(n),o=e.type&&e.type!=="replay_event"?e.type:"event";nW(e,n?.sdk);let s=fh(e,i,r,t);return delete e.sdkProcessingMetadata,kt(s,[[{type:o},e]])}function tR(e,t){function n(m){return!!m.trace_id&&!!m.public_key}let r=nt(e[0]),i=t?.getDsn(),o=t?.getOptions().tunnel,s={sent_at:new Date(tt()).toISOString(),...n(r)&&{trace:r},...!!o&&i&&{dsn:nn(i)}},{beforeSendSpan:c,ignoreSpans:a}=t?.getOptions()||{},l=a?.length?e.filter(m=>{let _=oe(m);return!rr({description:_.description,op:_.op,attributes:_.data},a)}):e,p=e.length-l.length;p&&t?.recordDroppedEvent("before_send","span",p);let u=c?m=>{let _=oe(m),h=gi(c)?_:c(_);return h||(Wo(),_)}:oe,d=[];for(let m of l){let _=u(m);_&&d.push(dh(_))}return kt(s,d)}function Hc(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=oe(e),{spanId:i}=e.spanContext(),o=qt(e),s=Re(e),c=s===e,a=`[Tracing] Starting ${o?"sampled":"unsampled"} ${c?"root ":""}span`,l=[`op: ${n}`,`name: ${t}`,`ID: ${i}`];if(r&&l.push(`parent ID: ${r}`),!c){let{op:p,description:u}=oe(s);l.push(`root ID: ${s.spanContext().spanId}`),p&&l.push(`root op: ${p}`),u&&l.push(`root description: ${u}`)}g.log(`${a}
11
+ ${l.join(`
12
+ `)}`)}function Fc(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >"}=oe(e),{spanId:r}=e.spanContext(),o=Re(e)===e,s=`[Tracing] Finishing "${n}" ${o?"root ":""}span "${t}" with ID ${r}`;g.log(s)}function gh(e,t,n,r=Q()){let i=r&&Re(r);i&&(E&&g.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[lu]:t,[cu]:n}))}function Vo(e){if(!e||e.length===0)return;let t={};return e.forEach(n=>{let r=n.attributes||{},i=r[cu],o=r[lu];typeof i=="string"&&typeof o=="number"&&(t[n.name]={value:o,unit:i})}),t}function nR(e){Qn(Je()).segmentSpanCaptureStrategy=e}function Wc(){return Qn(Je()).segmentSpanCaptureStrategy}function rt(e){return e.getOptions().traceLifecycle==="stream"}var rR=1e3,Xs=class{constructor(t={}){this._traceId=t.traceId||ht(),this._spanId=t.spanId||Yt(),this._startTime=t.startTimestamp||ct(),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?Mc:fu}}setAttribute(t,n){return this._frozen?this:(n===void 0?delete this._attributes[t]:this._attributes[t]=n,t===ve&&n!==void 0&&Ws(this)&&$_(this),this)}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._frozen||(this._startTime=Kt(t))}setStatus(t){return this._frozen?this:(this._status=t,this)}updateName(t){return this._frozen?this:(this._name=t,Ws(this)||this.setAttribute(ve,"custom"),this)}end(t){if(this._endTime){this._frozen=pu(this);return}this._endTime=Kt(t),Fc(this),this._onSpanEnded(),this._frozen=pu(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:Fo(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[S],profile_id:this._attributes[Bs],exclusive_time:this._attributes[Hs],measurements:Vo(this._events),is_segment:this._isStandaloneSpan&&Re(this)===this||void 0,segment_id:this._isStandaloneSpan?Re(this).spanContext().spanId:void 0,links:Ho(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===Re(this),status:hu(this._status),attributes:ih(this._attributes,this._status),links:rh(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,r){if(this._frozen)return this;E&&g.log("[Tracing] Adding an event to span:",t);let i=iR(n)?n:r||ct(),o=iR(n)?{}:n||{},s={name:t,time:Kt(i),attributes:o};return this._events.push(s),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let t=C();t&&(t.emit("spanEnd",this),this._isStandaloneSpan||t.emit("afterSpanEnd",this));let n=Re(this),r=this._isStandaloneSpan||this===n;if(this._isStandaloneSpan){this._sampled?iW(tR([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=Wc();if(s){let c=Xt(this).scope||ne();s.onChildSpanEnded(this,n,a=>this._convertSpanToTransaction(a),c)}return}if(t&&rt(t)){t.emit("afterSegmentSpanEnd",this);return}let i=Xt(this).scope||ne(),o=Wc();if(o)o.onSegmentSpanEnded(s=>this._convertSpanToTransaction(s),i);else{let s=this._convertSpanToTransaction();s&&i.captureEvent(s)}}_convertSpanToTransaction(t={}){if(!oR(oe(this)))return;this._name||(E&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:n,isolationScope:r}=Xt(this),i=n?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;t.onSpanCaptured?.(this);let o=[];for(let u of Uc(this)){if(u===this||rW(u)||t.isSpanAlreadyCaptured?.(u))continue;let d=oe(u);oR(d)&&(t.onSpanCaptured?.(u),o.push(d))}let s=this._attributes[ve];delete this._attributes[fn];let c=!1;o.forEach(u=>{delete u.data[fn],u.op?.startsWith("gen_ai.")&&(c=!0)});let a={contexts:{trace:Yv(this)},spans:o.length>rR?o.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,rR):o,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:n,capturedSpanIsolationScope:r,dynamicSamplingContext:nt(this),hasGenAiSpans:c},request:i,...s&&{transaction_info:{source:s}}},l=Vo(this._events);return l&&Object.keys(l).length&&(E&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(l,void 0,2)),a.measurements=l),a}};function iR(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function oR(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function rW(e){return e instanceof Xs&&e.isStandaloneSpan()}function iW(e){let t=C();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function or(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(o){throw t(o),n(),o}return oW(i,t,n,r)}function oW(e,t,n,r){return _t(e)?au(e,i=>{n(),r(i)},i=>{t(i),n()}):(n(),r(e),e)}function Vc(e,t,n){if(!Ue(e))return[!1];let r,i;typeof e.tracesSampler=="function"?(i=e.tracesSampler({...t,inheritOrSampleWith:c=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):c}),r=!0):t.parentSampled!==void 0?i=t.parentSampled:typeof e.tracesSampleRate<"u"&&(i=e.tracesSampleRate,r=!0);let o=En(i);if(o===void 0)return E&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!o)return E&&g.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,o,r];let s=n<o;return s||E&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[s,o,r]}var Ks="__SENTRY_SUPPRESS_TRACING__";function Se(e,t){let n=Yo();if(n.startSpan)return n.startSpan(e,t);let r=bh(e),{forceTransaction:i,parentSpan:o,scope:s}=e,c=s?.clone();return Be(c,()=>cR(o)(()=>{let l=ne(),p=yh(l,o),u=C(),m=e.onlyIfParent&&!p?_h(l,u):hh({parentSpan:p,spanArguments:r,forceTransaction:i,scope:l});return(!kr(m)||!p)&&Un(l,m),or(()=>t(m),()=>{let{status:_}=oe(m);m.isRecording()&&(!_||_==="ok")&&m.setStatus({code:2,message:"internal_error"})},()=>{m.end()})}))}function ke(e,t){let n=Yo();if(n.startSpanManual)return n.startSpanManual(e,t);let r=bh(e),{forceTransaction:i,parentSpan:o,scope:s}=e,c=s?.clone();return Be(c,()=>cR(o)(()=>{let l=ne(),p=yh(l,o),d=e.onlyIfParent&&!p?_h(l,C()):hh({parentSpan:p,spanArguments:r,forceTransaction:i,scope:l});return(!kr(d)||!p)&&Un(l,d),or(()=>t(d,()=>d.end()),()=>{let{status:m}=oe(d);d.isRecording()&&(!m||m==="ok")&&d.setStatus({code:2,message:"internal_error"})})}))}function k(e){let t=Yo();return t.startInactiveSpan?t.startInactiveSpan(e):aR(e)}function qs(e){return aR(e)}function aR(e){let t=bh(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?o=>Be(e.scope,o):r!==void 0?o=>se(r,o):o=>o())(()=>{let o=ne(),s=yh(o,r),c=C();return e.onlyIfParent&&!s?_h(o,c):hh({parentSpan:s,spanArguments:t,forceTransaction:n,scope:o})})}var In=(e,t)=>{let n=Je(),r=bt(n);if(r.continueTrace)return r.continueTrace(e,t);let{sentryTrace:i,baggage:o}=e,s=C(),c=nr(o);return s&&!kc(s,c?.org_id)?An(t):Be(a=>{let l=Tn(i,o);return a.setPropagationContext(l),Un(a,void 0),t()})};function se(e,t){let n=Yo();return n.withActiveSpan?n.withActiveSpan(e,t):Be(r=>(Un(r,e||void 0),t(r)))}function Bn(e){let t=Yo();return t.suppressTracing?t.suppressTracing(e):Be(n=>{n.setSDKProcessingMetadata({[Ks]:!0});let r=e();return n.setSDKProcessingMetadata({[Ks]:void 0}),r})}function Pr(e=ne()){let t=Yo();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[Ks]===!0}function An(e){let t=Yo();return t.startNewTrace?t.startNewTrace(e):Be(n=>(n.setPropagationContext({traceId:ht(),sampleRand:at()}),E&&g.log(`Starting a new trace with id ${n.getPropagationContext().traceId}`),se(null,e)))}function _h(e,t){t?.recordDroppedEvent("no_parent_span","span");let n=new xr({traceId:e.getPropagationContext().traceId});return Rr(n,e,J()),n}function hh({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let i=J();if(!Ue()){let c=r.getPropagationContext(),a=e?e.spanContext().traceId:c.traceId,l=new xr({traceId:a});return e&&!n&&fi(e,l),Rr(l,r,i),l}let o=C();if(aW(o,t)){Pr(r)||o?.recordDroppedEvent("ignored","span");let c=new xr({dropReason:"ignored",traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&fi(e,c),Rr(c,r,i),c}let s;if(e&&!n)s=sW(e,r,t,i),fi(e,s);else if(e){let c=nt(e),{traceId:a,spanId:l}=e.spanContext(),p=qt(e);s=sR({traceId:a,parentSpanId:l,...t},r,i,p),sh(s,c)}else{let{traceId:c,dsc:a,parentSpanId:l,sampled:p}=r.getPropagationContext();s=sR({traceId:c,parentSpanId:l,...t},r,i,p),a&&sh(s,a)}return Hc(s),s}function bh(e){let n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let r={...n};return r.startTimestamp=Kt(e.startTime),delete r.startTime,r}return n}function Yo(){let e=Je();return bt(e)}function sR(e,t,n,r){let i=C(),o=i?.getOptions()||{},{name:s=""}=e,c={spanAttributes:{...e.attributes},spanName:s,parentSampled:r};i?.emit("beforeSampling",c,{decision:!1});let a=c.parentSampled??r,l=c.spanAttributes,p=t.getPropagationContext(),u=Pr(t),[d,m,_]=u?[!1]:Vc(o,{name:s,parentSampled:a,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:En(p.dsc?.sample_rate)},p.sampleRand),h=new Xs({...e,attributes:{[ve]:"custom",[Dn]:m!==void 0&&_?m:void 0,...l},sampled:d});return!d&&i&&!u&&(E&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),i.recordDroppedEvent("sample_rate",rt(i)?"span":"transaction")),Rr(h,t,n),i&&i.emit("spanStart",h),h}function sW(e,t,n,r){let{spanId:i,traceId:o}=e.spanContext(),s=Pr(t),c=s?!1:qt(e),a=c?new Xs({...n,parentSpanId:i,traceId:o,sampled:c}):new xr({traceId:o});fi(e,a),Rr(a,t,r);let l=C();return l&&(rt(l)&&ji(a)&&(ji(e)&&e.dropReason?(a.dropReason=e.dropReason,l.recordDroppedEvent(e.dropReason,"span")):s||(a.dropReason="sample_rate",l.recordDroppedEvent("sample_rate","span"))),l.emit("spanStart",a),n.endTimestamp&&(l.emit("spanEnd",a),l.emit("afterSpanEnd",a))),a}function yh(e,t){if(t)return t;if(t===null)return;let n=er(e);if(!n)return;let r=C();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Re(n):n}function cR(e){return e!==void 0?t=>se(e,t):t=>t()}function aW(e,t){let n=e?.getOptions().ignoreSpans;return!e||!rt(e)||!n?.length?!1:rr({description:t.name||"",op:t.attributes?.[H]||t.op,attributes:t.attributes},n)}function kr(e){return ji(e)&&e.dropReason==="ignored"}function Yc(e,t,n){let r,i,o,s=n?.maxWait?Math.max(n.maxWait,t):0,c=n?.setTimeoutImpl||setTimeout;function a(){return l(),r=e(),r}function l(){i!==void 0&&clearTimeout(i),o!==void 0&&clearTimeout(o),i=o=void 0}function p(){return i!==void 0||o!==void 0?a():r}function u(){return i&&clearTimeout(i),i=c(a,t),s&&o===void 0&&(o=c(a,s)),r}return u.cancel=l,u.flush=p,u}var Su=new WeakSet,lR=e=>Su.has(e),pR=e=>{Su.add(e)},Eu=new WeakMap;function Sh(e){if(Wc()||nR(cW),Eu.has(e))return;let t=new Set,n=Yc(()=>{let r=[...t];t.clear();for(let i of r)i()},1,{maxWait:100});e.on("flush",()=>{n.flush()}),Eu.set(e,r=>{t.add(r),n()})}var cW={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&Eu.get(n);if(!r){let i=e();i&&n?.captureEvent(i);return}r(()=>{let i=e({isSpanAlreadyCaptured:lR,onSpanCaptured:pR});i&&n.captureEvent(i)})},onChildSpanEnded(e,t,n,r){if(Su.has(e)||!Su.has(t))return;let i=r.getClient(),o=i&&Eu.get(i),s=()=>{let c=n({isSpanAlreadyCaptured:lR,onSpanCaptured:pR});c?.contexts?.trace?.data&&(c.contexts.trace.data["sentry.parent_span_already_sent"]=!0),c&&i?.captureEvent(c)};o?o(s):s()}};var lW=["addListener","on","once","prependListener","prependOnceListener","addEventListener"],pW=["removeListener","off","removeEventListener"],uR=Symbol("SentryScopeBoundListeners"),Qs;function uW(e){return Qs!==void 0&&(e===Qs||e.listener===Qs)}function gn(e,t=ne()){let n=e;if(Tu(n))return e;Eh(n);for(let r of lW)typeof n[r]=="function"&&(n[r]=mW(n,n[r],t));for(let r of pW)typeof n[r]=="function"&&(n[r]=fW(n,n[r]));return typeof n.removeAllListeners=="function"&&(n.removeAllListeners=gW(n,n.removeAllListeners)),e}function dW(e,t){return function(...n){return Be(t,()=>e.apply(this,n))}}function dR(e){return typeof e=="function"}function mW(e,t,n){return function(...r){let i=r[0],o=r[1],s=r.slice(2);if(!dR(o)||uW(o))return t.apply(this,r);let c=Tu(e)||Eh(e),a=c.get(i);a||(a=new WeakMap,c.set(i,a));let l=a.get(o);l||(l=dW(o,n),a.set(o,l));let p=Qs;Qs=l;try{return t.call(this,i,l,...s)}finally{Qs=p}}}function fW(e,t){return function(...n){let r=n[0],i=n[1],o=n.slice(2),s=dR(i)?Tu(e)?.get(r)?.get(i):void 0;return s?t.call(this,r,s,...o):t.apply(this,n)}}function gW(e,t){return function(...n){let r=Tu(e);if(r)if(n.length===0)Eh(e);else{let i=n[0];r.delete(i)}return t.apply(this,n)}}function Eh(e){let t=new Map;return e[uR]=t,t}function Tu(e){return e[uR]}function Ih(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;_W(e,t),r&&yW(e,r),SW(e,n),hW(e,i),bW(e,o)}function Th(e,t){let{extra:n,tags:r,attributes:i,user:o,contexts:s,level:c,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:p,eventProcessors:u,attachments:d,propagationContext:m,transactionName:_,span:h}=t;jc(e,"extra",n),jc(e,"tags",r),jc(e,"attributes",i),jc(e,"user",o),jc(e,"contexts",s),e.sdkProcessingMetadata=Fi(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 jc(e,t,n){e[t]=Fi(e[t],n,1)}function Nn(e,t){let n=Uo().getScopeData();return e&&Th(n,e.getScopeData()),t&&Th(n,t.getScopeData()),n}function _W(e,t){let{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:c}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),s&&(e.level=s),c&&e.type!=="transaction"&&(e.transaction=c)}function hW(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function bW(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function yW(e,t){e.contexts={trace:Cr(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:nt(t),...e.sdkProcessingMetadata};let n=Re(t),r=oe(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function SW(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 mR(e){let t={},{response:n,profile:r,cloud_resource:i,culture:o,state:s}=e;if(n&&(n.status_code!=null&&(t["http.response.status_code"]=n.status_code),n.body_size!=null&&(t["http.response.body.size"]=n.body_size)),r&&(r.profile_id&&(t["sentry.profile_id"]=r.profile_id),r.profiler_id&&(t["sentry.profiler_id"]=r.profiler_id)),i)for(let[l,p]of Object.entries(i))p!=null&&(t[l]=p);o&&(o.locale&&(t["culture.locale"]=o.locale),o.timezone&&(t["culture.timezone"]=o.timezone)),s?.state&&typeof s.state.type=="string"&&(t["state.type"]=s.state.type);let c=e.angular;if(c){let l=c.version;(typeof l=="string"||typeof l=="number")&&(t["angular.version"]=l)}let a=e.react;if(a){let l=a.version;(typeof l=="string"||typeof l=="number")&&(t["react.version"]=l)}return t}var fR="aws.dynamodb.attribute_definitions",gR="aws.dynamodb.consistent_read",_R="aws.dynamodb.consumed_capacity",hR="aws.dynamodb.count",bR="aws.dynamodb.exclusive_start_table",yR="aws.dynamodb.global_secondary_indexes",SR="aws.dynamodb.global_secondary_index_updates",Ah="aws.dynamodb.index_name",ER="aws.dynamodb.item_collection_metrics",TR="aws.dynamodb.limit",IR="aws.dynamodb.local_secondary_indexes",AR="aws.dynamodb.projection",NR="aws.dynamodb.provisioned_read_capacity",vR="aws.dynamodb.provisioned_write_capacity",RR="aws.dynamodb.scanned_count",OR="aws.dynamodb.scan_forward",CR="aws.dynamodb.segment",Nh="aws.dynamodb.select",xR="aws.dynamodb.table_count",vh="aws.dynamodb.table_names",PR="aws.dynamodb.total_segments";var kR="aws.kinesis.stream.name";var LR="aws.request.extended_id";var MR="aws.request.id",wR="aws.s3.bucket",Rh="aws.secretsmanager.secret.arn",Oh="aws.sns.topic.arn",GR="aws.step_functions.activity.arn",UR="aws.step_functions.state_machine.arn";var Js="cache.key";var Iu="cloud.region";var Au="code.function.name";var $s="db.collection.name";var yt="db.name",_i="db.namespace",zs="db.operation",ea="db.operation.batch.size",sr="db.operation.name";var Lr="db.query.text";var Ve="db.statement";var Pe="db.system",ut="db.system.name",Lt="db.user";var Mr="error.type";var DR="faas.execution";var BR="faas.invoked_name",HR="faas.invoked_provider",FR="faas.invoked_region",WR="faas.name";var Nu="faas.trigger";var VR="gen_ai.embeddings.input",YR="gen_ai.function_id",jR="gen_ai.input.messages",vu="gen_ai.operation.name";var Ch="gen_ai.output.messages";var ZR="gen_ai.request.available_tools";var hi="gen_ai.request.max_tokens";var Zc="gen_ai.request.model";var Xi="gen_ai.request.stop_sequences",bi="gen_ai.request.temperature";var yi="gen_ai.request.top_p",Rt="gen_ai.response.finish_reasons",XR="gen_ai.response.id",KR="gen_ai.response.model",qR="gen_ai.response.streaming";var Xc="gen_ai.system";var QR="gen_ai.tool.input";var JR="gen_ai.tool.name",$R="gen_ai.tool.output",zR="gen_ai.tool.type",wr="gen_ai.usage.cache_creation.input_tokens",Gr="gen_ai.usage.cache_read.input_tokens";var Qt="gen_ai.usage.input_tokens";var St="gen_ai.usage.output_tokens";var Ru="gen_ai.usage.reasoning.output_tokens",xh="gen_ai.usage.total_tokens",ta="graphql.document",Ou="graphql.operation.name",Cu="graphql.operation.type";var e0="http.client_ip";var t0="http.flavor";var n0="http.host",Ur="http.method";var Dr="http.request.method";var _n="http.response.status_code";var He="http.route",r0="http.scheme";var Si="http.status_code",xu="http.target",Ei="http.url",i0="http.user_agent";var Pu="koa.name",Ph="koa.type";var na="messaging.batch.message_count",o0="messaging.destination";var vn="messaging.destination.name";var ra="messaging.message.id";var ia="messaging.operation.name",ar="messaging.operation.type";var Mt="messaging.system";var s0="network.peer.address",a0="network.peer.port",kh="network.protocol.name",c0="network.protocol.version";var l0="net.host.ip",p0="net.host.name",u0="net.host.port",d0="net.peer.ip",Le="net.peer.name",xe="net.peer.port";var oa="net.transport";var m0="rpc.grpc.status_code",f0="rpc.method";var ku="rpc.service",g0="rpc.system";var Lh="sentry.graphql.operation";var _0="sentry.http.prefetch";var h0="sentry.origin";var b0="sentry.sdk.name",y0="sentry.sdk.version",S0="sentry.segment.id";var E0="sentry.segment.name";var T0="sentry.trace_lifecycle";var ft="server.address";var gt="server.port",Mh="service.name",I0="service.version";var lt="url.full",Ki="url.path";var Lu="url.query";var A0="url.scheme";var N0="user_agent.original";function wh(e,t){let n=gu(e),r=js(e),i=gu(r),{isolationScope:o,scope:s}=Xt(e),c=Nn(o,s);IW(n,i,t,c);let a=e.kind;t.emit("preprocessSpan",n,{spanKind:a}),n.is_segment&&(EW(n,c),TW(n,t),t.emit("processSegmentSpan",n)),t.emit("processSpan",n);let{beforeSendSpan:l}=t.getOptions(),p=l&&gi(l)?AW(n,l):n,u=p.attributes?.[ve];return n.is_segment&&u&&wt(p,{"sentry.segment.name.source":u}),{..._u(p),_segmentSpan:r}}function EW(e,t){let n=mR(t.contexts);wt(e,n)}function wt(e,t){let n=e.attributes??(e.attributes={});Object.entries(t).forEach(([r,i])=>{i!=null&&!(r in n)&&(n[r]=i)})}function TW(e,t){let n=t.getIntegrationNames();n.length&&wt(e,{[V_]:n})}function IW(e,t,n,r){let i=n.getSdkMetadata(),{release:o,environment:s}=n.getOptions();wt(e,{[T0]:"stream",[E0]:t.name,[S0]:t.span_id,[b0]:i?.sdk?.name,[y0]:i?.sdk?.version,[F_]:o,[W_]:s||Zi,[Y_]:r.user?.id,[j_]:r.user?.email,[xc]:r.user?.ip_address,[Z_]:r.user?.username,...r.attributes})}function AW(e,t){let n=t(e);return n||(Wo(),e)}var Gh=0,v0=1,R0=2;function Ti(e){return new Mu(t=>{t(e)})}function wu(e){return new Mu((t,n)=>{n(e)})}var Mu=class e{constructor(t){this._state=Gh,this._handlers=[],this._runExecutor(t)}then(t,n){return new e((r,i)=>{this._handlers.push([!1,o=>{if(!t)r(o);else try{r(t(o))}catch(s){i(s)}},o=>{if(!n)i(o);else try{r(n(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new e((n,r)=>{let i,o;return this.then(s=>{o=!1,i=s,t&&t()},s=>{o=!0,i=s,t&&t()}).then(()=>{if(o){r(i);return}n(i)})})}_executeHandlers(){if(this._state===Gh)return;let t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===v0&&n[1](this._value),this._state===R0&&n[2](this._value),n[0]=!0)})}_runExecutor(t){let n=(o,s)=>{if(this._state===Gh){if(_t(s)){s.then(r,i);return}this._state=o,this._value=s,this._executeHandlers()}},r=o=>{n(v0,o)},i=o=>{n(R0,o)};try{t(r,i)}catch(o){i(o)}}};function O0(e,t,n,r=0){try{let i=Uh(t,n,e,r);return _t(i)?i:Ti(i)}catch(i){return wu(i)}}function Uh(e,t,n,r){let i=n[r];if(!e||!i)return e;let o=i({...e},t);return E&&o===null&&g.log(`Event processor "${i.id||"?"}" dropped event`),_t(o)?o.then(s=>Uh(s,t,n,r+1)):Uh(o,t,n,r+1)}var jo,C0,x0,qi;function Kc(e){let t=te._sentryDebugIds,n=te._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(qi&&r.length===C0&&i.length===x0)return qi;C0=r.length,x0=i.length,qi={},jo||(jo={});let o=(s,c)=>{for(let a of s){let l=c[a],p=jo?.[a];if(p&&qi&&l)qi[p[0]]=l,jo&&(jo[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(_&&qi&&jo){qi[_]=l,jo[a]=[_,l];break}}}}};return t&&o(r,t),n&&o(i,n),qi}function qc(e){return e.data?.__sentry__===!0}function Gu(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 P0(e,t,n,r,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:c=1e3}=e,a={...t,event_id:t.event_id||n.event_id||pt(),timestamp:t.timestamp||vr()},l=n.integrations||e.integrations.map(b=>b.name);NW(a,e),OW(a,l),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&vW(a,e.stackParser);let p=xW(r,n.captureContext);n.mechanism&&Gn(a,n.mechanism);let u=i?i.getEventProcessors():[],d=Nn(o,p),m=[...n.attachments||[],...d.attachments];m.length&&(n.attachments=m),Ih(a,d);let _=[...u,...d.eventProcessors];return(qc(n)?Ti(a):O0(_,a,n)).then(b=>(b&&RW(b),typeof s=="number"&&s>0?CW(b,s,c):b))}function NW(e,t){let{environment:n,release:r,dist:i,maxValueLength:o}=t;e.environment=e.environment||n||Zi,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let s=e.request;s?.url&&o&&(s.url=dn(s.url,o)),o&&e.exception?.values?.forEach(c=>{c.value&&(c.value=dn(c.value,o))})}function vW(e,t){let n=Kc(t);e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=n[i.filename])})})}function RW(e){let t={};if(e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([r,i])=>{n.push({type:"sourcemap",code_file:r,debug_id:i})})}function OW(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function CW(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:Ke(i.data,t,n)}}))},...e.user&&{user:Ke(e.user,t,n)},...e.contexts&&{contexts:Ke(e.contexts,t,n)},...e.extra&&{extra:Ke(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ke(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(i=>({...i,...i.data&&{data:Ke(i.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Ke(e.contexts.flags,3,n)),r}function xW(e,t){if(!t)return e;let n=e?e.clone():new jt;return n.update(t),n}function k0(e){if(e)return PW(e)?{captureContext:e}:LW(e)?{captureContext:e}:e}function PW(e){return e instanceof jt||typeof e=="function"}var kW=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function LW(e){return Object.keys(e).some(t=>kW.includes(t))}function me(e,t){return ne().captureException(e,k0(t))}function Qc(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 Jc(e,t){return ne().captureEvent(e,t)}function Dh(e,t){J().setContext(e,t)}function Bh(e){J().setExtras(e)}function Hh(e,t){J().setExtra(e,t)}function Fh(e){J().setTags(e)}function Wh(e,t){J().setTag(e,t)}function Vh(e){J().setAttributes(e)}function Yh(e,t){J().setAttribute(e,t)}function jh(e){J().setUser(e)}function L0(e){J().setConversationId(e)}function Zh(){return J().lastEventId()}async function Zo(e){let t=C();return t?t.flush(e):(E&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function Xh(e){let t=C();return t?t.close(e):(E&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function Kh(){return!!C()}function Xo(){let e=C();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function qh(e){J().addEventProcessor(e)}function $c(e){let t=J(),{user:n}=Nn(t,ne()),{userAgent:r}=te.navigator||{},i=Iv({user:n,...r&&{userAgent:r},...e}),o=t.getSession();return o?.status==="ok"&&ui(o,{status:"exited"}),Ko(),t.setSession(i),i}function Ko(){let e=J(),n=ne().getSession()||e.getSession();n&&Av(n),M0(),e.setSession()}function M0(){let e=J(),t=C(),n=e.getSession();n&&t&&t.captureSession(n)}function Qh(e=!1){if(e){Ko();return}M0()}function Br(e,t,n){function r(){let o=zc({monitorSlug:e,status:"in_progress"},n),s=ct();function c(l){zc({monitorSlug:e,status:l,checkInId:o,duration:ct()-s})}let a;try{a=t()}catch(l){throw c("error"),l}return _t(a)?a.then(l=>(c("ok"),l),l=>{throw c("error"),l}):(c("ok"),a)}let i={...ne().getPropagationContext()};return tr(()=>{if(n?.isolateTrace)return An(r);let o=ne();return Pc(o.getPropagationContext())||o.setPropagationContext(i),r()})}function zc(e,t){let n=ne(),r=C();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 pt()}function Rn(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}function ue(e,t=1){if(bt(Je()).getTracingChannelBinding?.()){e();return}t&&Rn(setTimeout(()=>{ue(e,t-1)},1))}var MW="7";function wW(e){let t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function GW(e){return`${wW(e)}${e.projectId}/envelope/`}function UW(e,t){let n={sentry_version:MW};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function w0(e,t,n){return t||`${GW(e)}?${UW(e,n)}`}var Jh=[];function DW(e){let t={};return e.forEach(n=>{let{name:r}=n,i=t[r];i&&!i.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function $h(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(i=>{i.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){let i=n(t);r=Array.isArray(i)?i:[i]}else r=t;return DW(r)}function G0(e,t){let n={};return t.forEach(r=>{r?.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&eb(e,r,n)}),n}function zh(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function eb(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,!Jh.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),Jh.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){let r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(i,o)=>r(i,o,e))}if(typeof t.processEvent=="function"){let r=t.processEvent.bind(t),i=Object.assign((o,s)=>r(o,s,e),{id:t.name});e.addEventProcessor(i)}["processSpan","processSegmentSpan"].forEach(r=>{let i=t[r];typeof i=="function"&&e.on(r,o=>i.call(t,o,e))}),E&&g.log(`Integration installed: ${t.name}`)}function tb(e){let t=C();if(!t){E&&g.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}function Gt(e,t){let n={...e,...t};for(let r in t){let i=e[r],o=t[r];if(typeof i=="function"&&typeof o=="function"){let s=new Proxy(i,{apply:(c,a,l)=>(Reflect.apply(c,a,l),Reflect.apply(o,a,l))});n[r]=s}}return n}var BW="sentry.timestamp.sequence",nb=0,rb;function Uu(e){let t=Math.floor(e*1e3);rb!==void 0&&t!==rb&&(nb=0);let n=nb;return nb++,rb=t,{key:BW,value:{value:n,type:"integer"}}}function sa(e,t){return t?Be(t,()=>{let n=Q(),r=n?Cr(n):Do(t);return[n?nt(n):ir(e,t),r]}):[void 0,void 0]}var U0={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function D0(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function B0(){return!D0()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Et(){return typeof window<"u"&&(!B0()||HW())}function HW(){return te.process?.type==="renderer"}function FW(e,t){let n=t?"auto":"never";return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...Et()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function H0(e,t,n,r,i){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=nn(r)),kt(o,[FW(e,i)])}var WW=100;function Hr(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function F0(e,t){let n=ob(),r=W0(e);r===void 0?n.set(e,[t]):r.length>=WW?(aa(e,r),n.set(e,[t])):n.set(e,[...r,t])}function cr(e,t=ne(),n=F0){let r=t?.getClient()??C();if(!r){E&&g.warn("No client available to capture log.");return}let{release:i,environment:o,enableLogs:s=!0,beforeSendLog:c}=r.getOptions();if(!s){E&&g.warn("logging option not enabled, log will not be captured.");return}let[,a]=sa(r,t),l={...e.attributes},{user:{id:p,email:u,username:d},attributes:m={}}=Nn(J(),t);Hr(l,"user.id",p,!1),Hr(l,"user.email",u,!1),Hr(l,"user.name",d,!1),Hr(l,"sentry.release",i),Hr(l,"sentry.environment",o);let{name:_,version:h}=r.getSdkMetadata()?.sdk??{};Hr(l,"sentry.sdk.name",_),Hr(l,"sentry.sdk.version",h);let b=r.getIntegrationByName("Replay"),R=b?.getReplayId(!0);Hr(l,"sentry.replay_id",R),R&&b?.getRecordingMode()==="buffer"&&Hr(l,"sentry._internal.replay_is_buffering",!0);let M=e.message;if(Bi(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 v=er(t);Hr(l,"sentry.trace.parent_span_id",v?.spanContext().spanId);let N={...e,attributes:l};r.emit("beforeCaptureLog",N);let P=c?Me(()=>c(N)):N;if(!P){r.recordDroppedEvent("before_send","log_item",1),E&&g.warn("beforeSendLog returned null, log will not be captured.");return}let{level:D,message:I,attributes:F={},severityNumber:L}=P,G=ct(),ce=Uu(G),ge={timestamp:G,level:D,body:ib(String(I)),trace_id:a?.trace_id,severity_number:L??U0[D],attributes:VW({...di(m),...di(F,!0),[ce.key]:ce.value})};n(r,ge),r.emit("afterCaptureLog",P)}function aa(e,t){let n=t??W0(e)??[];if(n.length===0)return;let r=e.getOptions(),i=H0(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);ob().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function W0(e){return ob().get(e)}function ob(){return wn("clientToLogBufferMap",()=>new WeakMap)}function VW(e){let t={};for(let[n,r]of Object.entries(e)){let i=ib(n);r.type==="string"?t[i]={...r,value:ib(r.value)}:t[i]=r}return t}function ib(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 YW(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,...Et()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function V0(e,t,n,r,i){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=nn(r)),kt(o,[YW(e,i)])}var jW=1e3;function Ii(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function Y0(e,t){let n=ab(),r=j0(e);r===void 0?n.set(e,[t]):r.length>=jW?(ca(e,r),n.set(e,[t])):n.set(e,[...r,t])}function ZW(e,t,n){let{release:r,environment:i}=t.getOptions(),o={...e.attributes};Ii(o,"user.id",n.id,!1),Ii(o,"user.email",n.email,!1),Ii(o,"user.name",n.username,!1),Ii(o,"sentry.release",r),Ii(o,"sentry.environment",i);let{name:s,version:c}=t.getSdkMetadata()?.sdk??{};Ii(o,"sentry.sdk.name",s),Ii(o,"sentry.sdk.version",c);let a=t.getIntegrationByName("Replay"),l=a?.getReplayId(!0);return Ii(o,"sentry.replay_id",l),l&&a?.getRecordingMode()==="buffer"&&Ii(o,"sentry._internal.replay_is_buffering",!0),{...e,attributes:o}}function XW(e,t,n,r){let[,i]=sa(t,n),o=er(n),s=o?o.spanContext().traceId:i?.trace_id,c=o?o.spanContext().spanId:void 0,a=ct(),l=Uu(a);return{timestamp:a,trace_id:s??"",span_id:c,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...di(r),...di(e.attributes,"skip-undefined"),[l.key]:l.value}}}function sb(e,t){let n=t?.scope??ne(),r=t?.captureSerializedMetric??Y0,i=n?.getClient()??C();if(!i){E&&g.warn("No client available to capture metric.");return}let{_experiments:o,enableMetrics:s,beforeSendMetric:c}=i.getOptions();if(!(s??o?.enableMetrics??!0)){E&&g.warn("metrics option not enabled, metric will not be captured.");return}let{user:l,attributes:p}=Nn(J(),n),u=ZW(e,i,l);i.emit("processMetric",u);let d=c||o?.beforeSendMetric,m=d?d(u):u;if(!m){E&&g.log("`beforeSendMetric` returned `null`, will not send metric.");return}let _=XW(m,i,n,p);E&&g.log("[Metric]",_),r(i,_),i.emit("afterCaptureMetric",m)}function ca(e,t){let n=t??j0(e)??[];if(n.length===0)return;let r=e.getOptions(),i=V0(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);ab().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function j0(e){return ab().get(e)}function ab(){return wn("clientToMetricBufferMap",()=>new WeakMap)}function Z0(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 _u(t)}function X0(e,t){if(e.type!=="transaction"||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||rt(t))return;let n=[],r=[];for(let o of e.spans)o.op?.startsWith("gen_ai.")?n.push(Z0(o)):r.push(o);if(n.length===0)return;e.spans=r;let i=t.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Et()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var el=Symbol.for("SentryBufferFullError");function la(e=100){let t=new Set;function n(){return t.size<e}function r(s){t.delete(s)}function i(s){if(!n())return wu(el);let c=s();return t.add(c),c.then(()=>r(c),()=>r(c)),c}function o(s){if(!t.size)return Ti(!0);let c=Promise.allSettled(Array.from(t)).then(()=>!0);if(!s)return c;let a=[c,new Promise(l=>Rn(setTimeout(()=>l(!1),s)))];return Promise.race(a)}return{get $(){return Array.from(t)},add:i,drain:o}}var KW=60*1e3;function qW(e,t=tt()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?KW:r-t}function QW(e,t){return e[t]||e.all||0}function K0(e,t,n=tt()){return QW(e,t)>n}function q0(e,{statusCode:t,headers:n},r=tt()){let i={...e},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(let c of o.trim().split(",")){let[a,l,,,p]=c.split(":",5),u=parseInt(a,10),d=(isNaN(u)?60:u)*1e3;if(!l)i.all=r+d;else for(let m of l.split(";"))m==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(i[m]=r+d):i[m]=r+d}else s?i.all=r+qW(s,r):t===429&&(i.all=r+60*1e3);return i}var tl=64;function pa(e,t,n=la(e.bufferSize||tl)){let r={},i=s=>n.drain(s);function o(s){let c=[];if(Dc(s,(u,d)=>{let m=yu(d);K0(r,m)?e.recordDroppedEvent("ratelimit_backoff",m):c.push(u)}),c.length===0)return Promise.resolve({});let a=kt(s[0],c),l=u=>{if(uh(a,["client_report"])){E&&g.warn(`Dropping client report. Will not send outcomes (reason: ${u}).`);return}Dc(a,(d,m)=>{e.recordDroppedEvent(u,yu(m))})},p=()=>t({body:Bc(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=q0(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===el)return E&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw u})}return{send:o,flush:i}}function Q0(e,t,n){let r=[{type:"client_report"},{timestamp:n||vr(),discarded_events:e}];return kt(t?{dsn:t}:{},[r])}function J0(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:c}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:c,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:s?.[Bs],exclusive_time:s?.[Hs],measurements:e.measurements,is_segment:!0}}function $0(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&&{[Bs]:e.profile_id},...e.exclusive_time&&{[Hs]:e.exclusive_time}}}},measurements:e.measurements}}var ua="[Filtered]",nl=["forwarded","-ip","remote-","via","-user"],cb=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","sid","identity","set-cookie","cookie"],z0=[".sid","sessid","remember","oidc","pkce","nonce","__secure-","__host-","awsalb","awselb","akamai","__stripe","cognito","firebase","supabase","sb-","mfa","2fa"];function Du(e){return e===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:nl},httpHeaders:{request:{deny:nl},response:{deny:nl}},httpBodies:[],urlQueryParams:{deny:nl},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var JW={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 $W(e){return typeof e=="boolean"||"allow"in e||"deny"in e}function zW(e,t){return e===void 0?{...t.httpHeaders}:$W(e)?{request:e,response:e}:{request:e.request??t.httpHeaders.request,response:e.response??t.httpHeaders.response}}function eO(e){let t=e.dataCollection!=null?JW:Du(e.sendDefaultPii),n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:zW(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 tO="Not capturing exception because it's already been captured.",nO="Discarded session because of missing or non-string release",cO=Symbol.for("SentryInternalError"),lO=Symbol.for("SentryDoNotSendEventError"),eV=5e3;function Bu(e){return{message:e,[cO]:!0}}function lb(e){return{message:e,[lO]:!0}}function rO(e){return B(e)&&cO in e}function iO(e){return B(e)&&lO in e}function oO(e,t,n,r,i){let o=0,s,c=!1;e.on(n,()=>{o=0,clearTimeout(s),c=!1}),e.on(t,a=>{if(o+=r(a),o>=8e5)i(e);else if(!c){let l=e.getOptions()._flushInterval??eV;l>0&&(c=!0,s=Rn(setTimeout(()=>{i(e)},l)))}}),e.on("flush",()=>{i(e)})}var Hu=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=la(t.transportOptions?.bufferSize??tl),this._dataCollection=eO(t),t.dsn?this._dsn=Hv(t.dsn):E&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=w0(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&&oO(this,"afterCaptureLog","flushLogs",iV,aa),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&oO(this,"afterCaptureMetric","flushMetrics",rV,ca)}captureException(t,n,r){let i=pt();if(su(t))return E&&g.log(tO),i;let o={event_id:i,...n};return this._process(()=>this.eventFromException(t,o).then(s=>this._captureEvent(s,o,r)).then(s=>s),"error"),o.event_id}captureMessage(t,n,r,i){let o={event_id:pt(),...r},s=Bi(t)?t:String(t),c=zn(t),a=c?this.eventFromMessage(s,n,o):this.eventFromException(t,o);return this._process(()=>a.then(l=>this._captureEvent(l,o,i)),c?"unknown":"error"),o.event_id}captureEvent(t,n,r){let i=pt();if(n?.originalException&&su(n.originalException))return E&&g.log(tO),i;let o={event_id:i,...n},s=t.sdkProcessingMetadata||{},c=s.capturedSpanScope,a=s.capturedSpanIsolationScope,l=sO(t.type);return this._process(()=>this._captureEvent(t,o,c||r,a),l),o.event_id}captureSession(t){this.sendSession(t),ui(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){let n=this._transport;if(this.emit("flush"),!n)return!0;let r=await this._isClientDoneProcessing(t),i=await n.flush(t);return r&&i}async close(t){let n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(t){let n=this._integrations[t.name];!n&&t.beforeSetup&&t.beforeSetup(this),eb(this,t,this._integrations),n||zh(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let r=X0(t,this),i=eR(t,this._dsn,this._options._metadata,this._options.tunnel);if(!qc(n))for(let o of n.attachments||[])i=bu(i,mh(o));r&&(i=bu(i,r)),this.sendEnvelope(i).then(o=>this.emit("afterSendEvent",t,o))}sendSession(t){let{release:n,environment:r=Zi}=this._options;if("aggregates"in t){let o=t.attrs||{};if(!o.release&&!n){E&&g.warn(nO);return}o.release=o.release||n,o.environment=o.environment||r,t.attrs=o}else{if(!t.release&&!n){E&&g.warn(nO);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);let i=zv(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){let i=`${t}:${n}`;E&&g.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(t,n){let r=this._hooks[t]=this._hooks[t]||new Set,i=(...o)=>n(...o);return r.add(i),()=>{r.delete(i)}}emit(t,...n){let r=this._hooks[t];r&&r.forEach(i=>i(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return E&&g.error("Error while sending envelope:",n),{}}return E&&g.error("Transport disabled"),{}}registerCleanup(t){}dispose(){}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=G0(this,t),zh(this,t)}_updateSessionFromEvent(t,n){let r=n.level==="fatal",i=!1,o=n.exception?.values;if(o){i=!0,r=!1;for(let a of o)if(a.mechanism?.handled===!1){r=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(ui(t,{...r&&{status:"crashed"},errors:t.errors||Number(i||r)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,r,i){let o=this.getOptions(),s=this.getIntegrationNames();return!n.integrations&&s.length&&(n.integrations=s),this.emit("preprocessEvent",t,n),t.type||i.setLastEventId(t.event_id||n.event_id),P0(o,t,n,r,this,i).then(c=>{if(c===null)return c;this.emit("postprocessEvent",c,n),c.contexts={trace:{...c.contexts?.trace,...Do(r)},...c.contexts};let a=ir(this,r);return c.sdkProcessingMetadata={dynamicSamplingContext:a,...c.sdkProcessingMetadata},c})}_captureEvent(t,n={},r=ne(),i=J()){return E&&pb(t)&&g.log(`Captured error event \`${Gu(t)[0]||"<unknown>"}\``),this._processEvent(t,n,r,i).then(o=>o.event_id,o=>{E&&(iO(o)?g.log(o.message):rO(o)?g.warn(o.message):g.warn(o))})}_processEvent(t,n,r,i){let o=this.getOptions(),{sampleRate:s}=o,c=pO(t),a=pb(t),p=`before send for type \`${t.type||"error"}\``,u=typeof s>"u"?void 0:En(s),d=sO(t.type);return this._prepareEvent(t,n,r,i).then(m=>{if(m===null)throw this.recordDroppedEvent("event_processor",d),lb("An event processor returned `null`, will not send event.");if(qc(n))return m;let _=nV(this,o,m,n);return tV(_,p)}).then(m=>{if(m===null){if(this.recordDroppedEvent("before_send",d),c){let R=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",R)}throw lb(`${p} returned \`null\`, will not send event.`)}let _=r.getSession()||i.getSession();if(a&&_&&this._updateSessionFromEvent(_,m),a&&typeof u=="number"&&at()>u)throw this.recordDroppedEvent("sample_rate","error"),lb(`Discarding event because it's not included in the random sample (sampling rate = ${s})`);if(c){let b=m.sdkProcessingMetadata?.spanCountBeforeProcessing||0,R=m.spans?m.spans.length:0,M=b-R;M>0&&this.recordDroppedEvent("before_send","span",M)}let h=m.transaction_info;if(c&&h&&m.transaction!==t.transaction){let b="custom";m.transaction_info={...h,source:b}}return this.sendEvent(m,n),m}).then(null,m=>{throw iO(m)||rO(m)?m:(this.captureException(m,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:m}),Bu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
13
+ Reason: ${m}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===el&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{let[i,o]=n.split(":");return{reason:i,category:o,quantity:r}})}_flushOutcomes(){E&&g.log("Flushing outcomes...");let t=this._clearOutcomes();if(t.length===0){E&&g.log("No outcomes to send");return}if(!this._dsn){E&&g.log("No dsn provided, will not send outcomes");return}E&&g.log("Sending outcomes:",t);let n=Q0(t,this._options.tunnel&&nn(this._dsn));this.sendEnvelope(n)}};function sO(e){return e==="replay_event"?"replay":e||"error"}function tV(e,t){let n=`${t} must return \`null\` or a valid event.`;if(_t(e))return e.then(r=>{if(!Vt(r)&&r!==null)throw Bu(n);return r},r=>{throw Bu(`${t} rejected with ${r}`)});if(!Vt(e)&&e!==null)throw Bu(n);return e}function nV(e,t,n,r){let{beforeSend:i,beforeSendTransaction:o,ignoreSpans:s}=t,c=!gi(t.beforeSendSpan)&&t.beforeSendSpan,a=n;if(pb(a)&&i)return i(a,r);if(pO(a)){if(c||s){let l=J0(a);if(s?.length&&rr({description:l.description,op:l.op,attributes:l.data},s))return null;if(c){let p=c(l);p?a=Fi(n,$0(p)):Wo()}if(a.spans){let p=[],u=a.spans;for(let m of u){if(s?.length&&rr({description:m.description,op:m.op,attributes:m.data},s)){qv(u,m);continue}if(c){let _=c(m);_?p.push(_):(Wo(),p.push(m))}else p.push(m)}let d=a.spans.length-p.length;d&&e.recordDroppedEvent("before_send","span",d),a.spans=p}}if(o){if(a.spans){let l=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return o(a,r)}}return a}function pb(e){return e.type===void 0}function pO(e){return e.type==="transaction"}function rV(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+uO(e.attributes)}function iV(e){let t=0;return e.message&&(t+=e.message.length*2),t+uO(e.attributes)}function uO(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*aO(n[0]):zn(n)?t+=aO(n):t+=100}),t}function aO(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function ub(e){ne().setClient(e)}var db=new Set;function Ai(e){e.forEach(t=>{db.add(t),E&&g.log(`AI provider "${t}" wrapping will be skipped`)})}function On(e){return db.has(e)}function mb(){db.clear(),E&&g.log("Cleared AI provider skip registrations")}function oV(e,t){return t.some(n=>e.includes(n))}function fb(e,t,n){if(t===!1)return!0;let r=e.toLowerCase(),i=n!=null?[...cb,...n]:cb;if(oV(r,i))return!0;if(t===!0)return!1;let s=("deny"in t?t.deny:t.allow).some(c=>r.includes(c.toLowerCase()));return"deny"in t?s:!s}function da(e,t,n){if(t===!1)return{};let r={};for(let i of Object.keys(e))r[i]=fb(i,t,n)?ua:e[i];return r}function dO(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf("=",n);if(r===-1)break;let i=e.indexOf(";",n);if(i===-1)i=e.length;else if(i<r){n=e.lastIndexOf(";",r-1)+1;continue}let o=e.slice(n,r).trim();if(t[o]===void 0){let s=e.slice(r+1,i).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));try{t[o]=s.indexOf("%")!==-1?decodeURIComponent(s):s}catch{t[o]=s}}n=i+1}return t}function ma(e,t){if(!(!e||t===!1))return e.split("&").map(n=>{let r=n.indexOf("="),i=r===-1?n:n.slice(0,r),o=new URLSearchParams(`${i}=`).keys().next().value;return o!==void 0&&fb(o,t)?`${i}=${ua}`:n}).join("&")}function rl(e,t){let n=e.indexOf("#"),r=n===-1?e.length:n,i=e.indexOf("?");if(i===-1||i>r)return e;let o=e.slice(0,i),s=e.slice(i+1,r),c=e.slice(r),a=ma(s,t);return a?`${o}?${a}${c}`:`${o}${c}`}function mO(e){return(e??C())?.getDataCollectionOptions().urlQueryParams??!0}function Ot(e,t){return e===void 0?void 0:rl(e,mO(t))}function Hn(e,t){if(!e)return e;let n=e.startsWith("?"),r=ma(n?e.slice(1):e,mO(t));return r&&n?`?${r}`:r}var sV=new Set(["false","f","n","no","off","0"]),aV=new Set(["true","t","y","yes","on","1"]);function qo(e,t){let n=String(e).toLowerCase();return sV.has(n)?!1:aV.has(n)?!0:t?.strict?null:!!e}function fO(e,t,n,r,i){let o={sent_at:new Date(tt()).toISOString()};n?.sdk&&(o.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(o.dsn=nn(i)),t&&(o.trace=t);let s=cV(e);return kt(o,[s])}function cV(e){return[{type:"check_in"},e]}var lV="thismessage:/";function lr(e){return"isRelative"in e}function pr(e,t){let n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=t??(n?lV:void 0);try{if("canParse"in URL&&!URL.canParse(e,r))return;let i=new URL(e,r);return n?{isRelative:n,pathname:i.pathname,search:i.search,hash:i.hash}:i}catch{}}function gO(e){if(lr(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 pV(e,t,n,r){let i=n?.method?.toUpperCase()??"GET",o=r||(e?t==="client"?gO(e):e.pathname:"/");return`${i} ${o}`}function gb(e,t,n,r,i,o){let s={[S]:n,[ve]:"url"};return i&&(s[t==="server"?"http.route":"url.template"]=i,s[ve]="route"),r?.method&&(s[Q_]=r.method.toUpperCase()),e&&(e.search&&(s["url.query"]=Hn(e.search,o)),e.hash&&(s["url.fragment"]=e.hash),e.pathname&&(s["url.path"]=e.pathname,e.pathname==="/"&&(s[ve]="route")),lr(e)||(s[lt]=Ot(e.href,o),e.port&&(s["url.port"]=e.port),e.protocol&&(s["url.scheme"]=e.protocol),e.hostname&&(s[t==="server"?"server.address":"url.domain"]=e.hostname))),[pV(e,t,r,i),s]}function Qi(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 ur(e){return e.split(/[?#]/,1)[0]}function Ji(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${t?`${t}://`:""}${i}${r}`}function il(e,t=!0){if(e.startsWith("data:")){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=e.includes(";base64,"),o=e.indexOf(","),s="";if(t&&o!==-1){let c=e.slice(o+1);s=c.length>10?`${c.slice(0,10)}... [truncated]`:c}return`data:${r}${i?",base64":""}${s?`,${s}`:""}`}return e}function _b(e,t){let n=t?.getDsn(),r=t?.getOptions().tunnel;return dV(e,n)||uV(e,r)}function uV(e,t){return t?_O(e)===_O(t):!1}function dV(e,t){let n=pr(e);return!n||lr(n)||!t?!1:mV(n.hostname,t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function mV(e,t){return e===t||t.length>0&&e.endsWith(`.${t}`)}function _O(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function Fu(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 hb=Fu;function Qo(e,t,n=[t],r="npm"){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(o=>({name:`${r}:@sentry/${o}`,version:q})),i.version=q)}function $e(e={}){let t=e.client||C();if(!Xo()||!t)return{};let n=Je(),r=bt(n);if(r.getTraceData)return r.getTraceData(e);let i=e.scope||ne(),o=e.span||Q(),s=ji(o)&&!Ue(t.getOptions());if(!o&&D_())return{};let c=o&&!s?wc(o):fV(i),a=o?nt(o):ir(t,i),l=Wi(a);if(!du.test(c))return g.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let u={"sentry-trace":c,baggage:l};return e.propagateTraceparent&&(u.traceparent=o&&!s?jv(o):gV(i)),u}function fV(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Vi(t,r,n)}function gV(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Yi(t,r,n)}var hO="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function Jo(e,t,n){if(typeof e!="string"||!t)return!0;let r=n?.get(e);if(r!==void 0)return E&&!r&&g.log(hO,e),r;let i=mn(e,t);return n?.set(e,i),E&&!i&&g.log(hO,e),i}function bb(e){return Object.entries(e||$e()).map(([t,n])=>`<meta name="${t}" content="${n}"/>`).join("")}function ol(e){return Array.from(new Set(e))}var bO=1024*1024;function yb(e){return e==="small"?1e3:e==="medium"?1e4:bO}function yO(e){let t={};try{e.forEach((n,r)=>{typeof n=="string"&&(t[r]=n)})}catch{}return t}function Vu(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 $o(e){let t=e.headers||{},r=(typeof t["x-forwarded-host"]=="string"?t["x-forwarded-host"]:void 0)||(typeof t.host=="string"?t.host:void 0),o=(typeof t["x-forwarded-proto"]=="string"?t["x-forwarded-proto"]:void 0)||e.protocol||(e.socket?.encrypted?"https":"http"),s=e.url||"",c=_V({url:s,host:r,protocol:o}),a=e.body||void 0,l=e.cookies;return{url:c,method:e.method,query_string:SO(s),headers:Vu(t),cookies:l,data:a}}function _V({url:e,protocol:t,host:n}){if(e?.startsWith("http"))return e;if(e&&n)return`${t}://${n}${e}`}function Fr(e,t=!1,n="request"){let r=typeof t=="boolean"?Du(t):t,i=n==="request"?r.httpHeaders.request:r.httpHeaders.response,o=r.cookies,s=`http.${n}.header.`,c={};try{let a={};for(let[l,p]of Object.entries(e)){if(p==null)continue;let u=l.toLowerCase();if(u==="cookie"||u==="set-cookie"){if(o===!1)continue;if(typeof p=="string"&&p!==""){let m=hV(p,u==="set-cookie"),_=da(m,o,z0);for(let[h,b]of Object.entries(_))c[`${s}${Wu(u)}.${Wu(h)}`]=b}else c[`${s}${Wu(u)}`]=ua}else{if(i===!1)continue;Array.isArray(p)?a[u]=p.map(m=>m!=null?String(m):m).join(";"):typeof p=="string"&&(a[u]=p)}}if(i!==!1){let l=da(a,i);for(let[p,u]of Object.entries(l))c[`${s}${Wu(p)}`]=u}}catch{}return c}function Wu(e){return e.replace(/-/g,"_")}function hV(e,t){let n=e.indexOf(";"),r=t&&n!==-1?e.substring(0,n):e,i=t?[r]:r.split("; "),o={};for(let s of i){let c=s.indexOf("="),a=(c!==-1?s.substring(0,c):s).toLowerCase(),l=c!==-1?s.substring(c+1):"";o[a]=l}return o}function SO(e){if(e)try{let t=new URL(e,"http://s.io").search.slice(1);return t.length?t:void 0}catch{return}}var U={INTERNAL:0,SERVER:1,CLIENT:2,PRODUCER:3,CONSUMER:4},bV={[U.INTERNAL]:"INTERNAL",[U.SERVER]:"SERVER",[U.CLIENT]:"CLIENT",[U.PRODUCER]:"PRODUCER",[U.CONSUMER]:"CONSUMER"};function Sb(e){return bV[e]}var yV=100;function rn(e,t){let n=C(),r=J();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=yV}=n.getOptions();if(o<=0)return;let c={timestamp:vr(),...e},a=i?Me(()=>i(c,t)):c;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}var SV="FunctionToString",EO=new WeakMap,EV=(()=>({name:SV,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=Ar(this),r;try{EO.has(C())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){EO.set(e,!0)}})),sl=EV;var TV=[/^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$/],IV="EventFilters",ju=(e={})=>{let t;return{name:IV,setup(n){let r=n.getOptions();t=TO(e,r)},processEvent(n,r,i){if(!t){let o=i.getOptions();t=TO(e,o)}return AV(n,t)?null:n}}},al=((e={})=>({...ju(e),name:"InboundFilters"}));function TO(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:TV],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function AV(e,t){if(e.type){if(e.type==="transaction"&&vV(e,t.ignoreTransactions))return E&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
14
+ Event: ${Hi(e)}`),!0}else{if(NV(e,t.ignoreErrors))return E&&g.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
15
+ Event: ${Hi(e)}`),!0;if(xV(e))return E&&g.warn(`Event dropped due to not having an error message, error type or stacktrace.
16
+ Event: ${Hi(e)}`),!0;if(RV(e,t.denyUrls))return E&&g.warn(`Event dropped due to being matched by \`denyUrls\` option.
17
+ Event: ${Hi(e)}.
18
+ Url: ${Yu(e)}`),!0;if(!OV(e,t.allowUrls))return E&&g.warn(`Event dropped due to not being matched by \`allowUrls\` option.
19
+ Event: ${Hi(e)}.
20
+ Url: ${Yu(e)}`),!0}return!1}function NV(e,t){return t?.length?Gu(e).some(n=>mn(n,t)):!1}function vV(e,t){if(!t?.length)return!1;let n=e.transaction;return n?mn(n,t):!1}function RV(e,t){if(!t?.length)return!1;let n=Yu(e);return n?mn(n,t):!1}function OV(e,t){if(!t?.length)return!0;let n=Yu(e);return n?mn(n,t):!0}function CV(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 Yu(e){try{let n=[...e.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?CV(n):null}catch{return E&&g.error(`Cannot extract url for event ${Hi(e)}`),null}}function xV(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function NO(e,t,n,r,i,o){if(!i.exception?.values||!o||!et(o.originalException))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=Eb(e,t,r,o.originalException,n,i.exception.values,s,0))}function Eb(e,t,n,r,i,o,s,c){if(o.length>=n+1)return o;let a=[...o];if(et(r[i])){IO(s,c,r);let l=e(t,r[i]),p=a.length;AO(l,i,p,c),a=Eb(e,t,n,r[i],i,[l,...a],l,p)}return vO(r)&&r.errors.forEach((l,p)=>{if(et(l)){IO(s,c,r);let u=e(t,l),d=a.length;AO(u,`errors[${p}]`,d,c),a=Eb(e,t,n,l,i,[u,...a],u,d)}}),a}function vO(e){return Array.isArray(e.errors)}function IO(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...vO(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function AO(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function RO(e,t){return e(t.stack||"",1)}function PV(e){return et(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function kV(e){return PV(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Tb(e,t){let n={type:t.name||t.constructor.name,value:kV(t)},r=RO(e,t);return r.length&&(n.stacktrace={frames:r}),n}function LV(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(et(n))return n}}function MV(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=v_(e);if(T_(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=wV(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${t}`}function wV(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function GV(e,t,n,r){if(et(n))return[n,void 0];if(t.synthetic=!0,Vt(n)){let o=e?.getOptions().normalizeDepth,s={__serialized__:O_(n,o)},c=LV(n);if(c)return[c,s];let a=MV(n),l=r?.syntheticException||new Error(a);return l.message=a,[l,s]}let i=r?.syntheticException||new Error(n);return i.message=`${n}`,[i,void 0]}function OO(e,t,n,r){let o=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[s,c]=GV(e,o,n,r),a={exception:{values:[Tb(t,s)]}};return c&&(a.extra=c),L_(a,void 0,void 0),Gn(a,o),{...a,event_id:r?.event_id}}function CO(e,t,n="info",r,i){let o={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let s=RO(e,r.syntheticException);s.length&&(o.exception={values:[{value:t,stacktrace:{frames:s}}]},Gn(o,{synthetic:!0}))}if(Bi(t)){let{__sentry_template_string__:s,__sentry_template_values__:c}=t;return o.logentry={message:s,params:c},o}return o.message=t,o}var UV="cause",DV=5,BV="LinkedErrors",HV=((e={})=>{let t=e.limit||DV,n=e.key||UV;return{name:BV,preprocessEvent(r,i,o){let s=o.getOptions();NO(Tb,s.stackParser,n,t,r,i)}}}),cl=HV;var Ib=["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 Ab(e){let t={};for(let o of Object.keys(e))t[o.toLowerCase()]=e[o];return Ib.map(o=>{let s=t[o.toLowerCase()],c=Array.isArray(s)?s.join(";"):s;return o==="Forwarded"?FV(c):c?.split(",").map(a=>a.trim())}).reduce((o,s)=>s?o.concat(s):o,[]).find(o=>o!==null&&WV(o))||null}function FV(e){if(!e)return null;for(let t of e.split(";"))if(t.startsWith("for="))return t.slice(4);return null}function WV(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}|:)|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1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}var VV="RequestData",YV=((e={})=>{function t(n){let r=n.getDataCollectionOptions(),i={...r,...e.include?.cookies===!0&&r.cookies===!1&&{cookies:!0},...e.include?.headers===!0&&r.httpHeaders.request===!1&&{httpHeaders:{...r.httpHeaders,request:!0}},...e.include?.query_string===!0&&r.urlQueryParams===!1&&{urlQueryParams:!0}};return{dataCollection:i,include:{cookies:i.cookies!==!1,data:!0,headers:i.httpHeaders.request!==!1,ip:i.userInfo,query_string:i.urlQueryParams!==!1,url:!0,...e.include}}}return{name:VV,processEvent(n,r,i){let{sdkProcessingMetadata:o={}}=n,{normalizedRequest:s,ipAddress:c}=o,{include:a,dataCollection:l}=t(i);return s&&jV(n,s,{ipAddress:c},a,l),n},processSegmentSpan(n,r){let{sdkProcessingMetadata:i={}}=J().getScopeData(),{normalizedRequest:o,ipAddress:s}=i;if(!o)return;let{include:c,dataCollection:a}=t(r);ZV(n,o,s,c,a)}}}),ll=YV;function jV(e,t,n,r,i){let o=xO(t,r);if(o.query_string&&(o.query_string=PO(o.query_string,i.urlQueryParams)),o.url&&(o.url=rl(o.url,i.urlQueryParams)),e.request={...e.request,...o},r.ip){let s=t.headers&&Ab(t.headers)||n.ipAddress;s&&(e.user={...e.user,ip_address:s})}}function ZV(e,t,n,r,i){let o=xO(t,r),s={};if(o.url&&(s[lt]=rl(o.url,i.urlQueryParams)),o.method&&(s["http.request.method"]=o.method),o.query_string&&(s[Lu]=PO(o.query_string,i.urlQueryParams)),wt(e,s),o.cookies&&Object.keys(o.cookies).length>0){let c=Object.entries(o.cookies).map(([l,p])=>`${l}=${p}`).join("; "),a=Fr({cookie:c},i,"request");wt(e,a)}if(o.headers){let c=Fr(o.headers,i,"request");wt(e,c)}if(o.data!=null){let c=typeof o.data=="string"?o.data:JSON.stringify(o.data);c&&wt(e,{"http.request.body.data":c})}if(r.ip){let c=t.headers&&Ab(t.headers)||n||void 0;c&&wt(e,{[xc]:c})}}function xO(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let i=new Set(Ib.map(o=>o.toLowerCase()));for(let o of Object.keys(r))i.has(o.toLowerCase())&&delete r[o]}if(n.method=e.method,t.url&&(n.url=e.url),t.cookies){let i=e.cookies||(r?.cookie?dO(r.cookie):void 0);n.cookies=i||{}}return t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function PO(e,t){let n=XV(e);return n?ma(n,t):void 0}function XV(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 Zu=new Set([]);function fa(e){let t="console",n=E_(t,e);return Cc(t,KV),n}function LO(e){for(let t of e)Zu.add(t);return()=>{for(let t of e)Zu.delete(t)}}var kO=new Set;function KV(){"console"in te&&$n.forEach(function(e){kO.has(e)||!(e in te.console)||(kO.add(e),Pt(te.console,e,function(t){return Jn[e]=t,function(...n){let r=n[0],i=Jn[e],o=Zu.size&&typeof r=="string"&&mn(r,Zu);o||Ps("console",{args:n,level:e}),(!o||E&&g.isEnabled())&&i?.apply(te.console,n)}}))})}function $i(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var qV="CaptureConsole",QV=((e={})=>{let t=e.levels||$n,n=e.handled??!0;return{name:qV,setup(r){"console"in te&&fa(({args:i,level:o})=>{C()!==r||!t.includes(o)||JV(i,o,n)})}}}),Nb=QV;function JV(e,t,n){let r=$i(t),i=new Error,o={level:$i(t),extra:{arguments:e}};Be(s=>{if(s.addEventProcessor(l=>(l.logger="console",Gn(l,{handled:n,type:"auto.core.capture_console"}),l)),t==="assert"){if(!e[0]){let l=`Assertion failed: ${ws(e.slice(1)," ")||"console.assert"}`;s.setExtra("arguments",e.slice(1)),s.captureMessage(l,r,{captureContext:o,syntheticException:i})}return}let c=e.find(l=>l instanceof Error);if(c){me(c,o);return}let a=ws(e," ");s.captureMessage(a,r,{captureContext:o,syntheticException:i})})}var $V="Dedupe",zV=(()=>{let e;return{name:$V,processEvent(t){if(t.type)return t;try{if(eY(t,e))return E&&g.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),vb=zV;function eY(e,t){return t?!!(tY(e,t)||nY(e,t)):!1}function tY(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!GO(e,t)||!wO(e,t))}function nY(e,t){let n=MO(t),r=MO(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!GO(e,t)||!wO(e,t))}function wO(e,t){let n=ru(e),r=ru(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){let o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function GO(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 MO(e){return e.exception?.values?.[0]}var rY="ExtraErrorData",iY=((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:rY,processEvent(r,i,o){let{maxValueLength:s}=o.getOptions();return oY(r,i,t,n,s)}}}),Rb=iY;function oY(e,t={},n,r,i){if(!t.originalException||!et(t.originalException))return e;let o=t.originalException.name||t.originalException.constructor.name,s=UO(t.originalException,r,i);if(s){let c={...e.contexts},a=Ke(s,n);return Vt(a)&&(fv(a),c[o]=a),{...e,contexts:c}}return e}function UO(e,t,n){try{let r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],i={};for(let o of Object.keys(e)){if(r.indexOf(o)!==-1)continue;let s=e[o];i[o]=et(s)||typeof s=="string"?n?dn(`${s}`,n):`${s}`:s}if(t&&e.cause!==void 0)if(et(e.cause)){let o=e.cause.name||e.cause.constructor.name;i.cause={[o]:UO(e.cause,!1,n)}}else i.cause=e.cause;if(typeof e.toJSON=="function"){let o=e.toJSON();for(let s of Object.keys(o)){let c=o[s];i[s]=et(c)?c.toString():c}}return i}catch(r){E&&g.error("Unable to extract extra data from the Error object:",r)}return null}function sY(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let i=e[r];i==="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var aY=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function BO(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=aY.exec(t);return n?n.slice(1):[]}function Ob(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:"/";i&&(t=`${i}/${t}`,n=i.charAt(0)==="/")}return t=sY(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function DO(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 Cb(e,t){e=Ob(e).slice(1),t=Ob(t).slice(1);let n=DO(e.split("/")),r=DO(t.split("/")),i=Math.min(n.length,r.length),o=i;for(let c=0;c<i;c++)if(n[c]!==r[c]){o=c;break}let s=[];for(let c=o;c<n.length;c++)s.push("..");return s=s.concat(r.slice(o)),s.join("/")}function xb(e){let t=BO(e),n=t[0]||"",r=t[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}function Pb(e,t){let n=BO(e)[2]||"";return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var cY="RewriteFrames",kb=(e={})=>{let t=e.root,n=e.prefix||"app:///",r="window"in te&&!!te.window,i=e.iteratee||lY({isBrowser:r,root:t,prefix:n});function o(c){try{return{...c,exception:{...c.exception,values:c.exception.values.map(a=>({...a,...a.stacktrace&&{stacktrace:s(a.stacktrace)}}))}}}catch{return c}}function s(c){return{...c,frames:c?.frames?.map(a=>i(a))}}return{name:cY,processEvent(c){let a=c;return c.exception&&Array.isArray(c.exception.values)&&(a=o(a)),a}}};function lY({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;let i=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),o=/^\//.test(r.filename);if(e){if(t){let s=r.filename;s.indexOf(t)===0&&(r.filename=s.replace(t,n))}}else if(i||o){let s=i?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,c=t?Cb(t,s):Pb(s);r.filename=`${n}${c}`}return r}}var pY=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],uY=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],dY={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"},FO=["select","insert","upsert","update","delete"];function Xu(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function Ku(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function WO(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function mY(e,t){return WO(e,t)!==void 0}function VO(e,t){if(!e)return;if(typeof e.get=="function")return e.get(t)??void 0;let n=e,r=t.toLowerCase(),i=Object.keys(n).find(o=>o.toLowerCase()===r);return i!==void 0?n[i]:void 0}function fY(e,t={}){switch(e){case"GET":return"select";case"POST":return VO(t,"Prefer")?.includes("resolution=")?"upsert":"insert";case"PATCH":return"update";case"DELETE":return"delete";default:return"<unknown-op>"}}function gY(e,t){if(t===""||t==="*")return"select(*)";if(e==="select")return`select(${t})`;if(e==="or"||e.endsWith(".or"))return`${e}${t}`;let[n,...r]=t.split("."),i;return n?.startsWith("fts")?i="textSearch":n?.startsWith("plfts")?i="textSearch[plain]":n?.startsWith("phfts")?i="textSearch[phrase]":n?.startsWith("wfts")?i="textSearch[websearch]":i=n&&dY[n]||"filter",`${i}(${e}, ${r.join(".")})`}function HO(e,t=!1){return new Proxy(e,{apply(n,r,i){return Se({name:`auth ${t?"(admin) ":""}${e.name}`,attributes:{[S]:"auto.db.supabase",[H]:"db","db.system":"postgresql","db.operation":`auth.${t?"admin.":""}${e.name}`}},o=>Reflect.apply(n,r,i).then(s=>(B(s)&&"error"in s&&s.error?(o.setStatus({code:2}),me(s.error,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}})):o.setStatus({code:1}),o.end(),s)).catch(s=>{throw o.setStatus({code:2}),o.end(),me(s,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}}),s}).then(...i))}})}function _Y(e){let t=e.auth;if(!(!t||Ku(e.auth))){for(let n of pY){let r=t[n];r&&typeof e.auth[n]=="function"&&(e.auth[n]=HO(r))}for(let n of uY){let r=t.admin[n];r&&typeof e.auth.admin[n]=="function"&&(e.auth.admin[n]=HO(r,!0))}Xu(e.auth)}}function hY(e,t){Ku(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(n,r,i){let o=Reflect.apply(n,r,i),s=o.constructor;return yY(s,t),o}}),Xu(e.prototype.from))}function bY(e,t){Ku(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(n,r,i){let o=FO,s=r,c=fY(s.method,s.headers);if(!o.includes(c)||!s?.url?.pathname||typeof s.url.pathname!="string")return Reflect.apply(n,r,i);let a=s.url.pathname.split("/"),l=a.length>0?a[a.length-1]:"",p=[];for(let[N,P]of s.url.searchParams.entries())p.push(gY(N,P));let u=Object.create(null);if(Vt(s.body))for(let[N,P]of Object.entries(s.body))u[N]=P;let d=C(),m=t.sendOperationData??d?.getDataCollectionOptions().databaseQueryData===!0,_=WO(s.body,u),h=c==="select"?"":`${c}${mY(s.body,u)?"(...) ":""}`,b=m?p.join(" "):p.length>0?"[redacted]":"",R=[h.trimEnd(),b].filter(Boolean).join(" "),M=R?`${R} from(${l})`:`from(${l})`,v={"db.table":l,"db.schema":s.schema,"db.url":s.url.origin,"db.sdk":VO(s.headers,"X-Client-Info"),"db.system":"postgresql","db.operation":c,[S]:"auto.db.supabase",[H]:"db"};return p.length&&m&&(v["db.query"]=p),_!==void 0&&m&&(v["db.body"]=_),Se({name:M,attributes:v},N=>Reflect.apply(n,r,[]).then(P=>{if(N&&(P&&typeof P=="object"&&"status"in P&&Fs(N,P.status||500),N.end()),P?.error){let F=new Error(P.error.message);P.error.code&&(F.code=P.error.code),P.error.details&&(F.details=P.error.details);let L={};p.length&&m&&(L.query=p),_!==void 0&&m&&(L.body=_),me(F,G=>(G.addEventProcessor(ce=>(Gn(ce,{handled:!1,type:"auto.db.supabase.postgres"}),ce)),G.setContext("supabase",L),G))}let D={type:"supabase",category:`db.${c}`,message:M},I={};return p.length&&m&&(I.query=p),_!==void 0&&m&&(I.body=_),Object.keys(I).length&&(D.data=I),rn(D),P},P=>{throw N&&(Fs(N,500),N.end()),P}).then(...i))}}),Xu(e.prototype.then))}function yY(e,t){for(let n of FO)Ku(e.prototype[n])||(e.prototype[n]=new Proxy(e.prototype[n],{apply(r,i,o){let s=Reflect.apply(r,i,o),c=s.constructor;return E&&g.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),bY(c,t),s}}),Xu(e.prototype[n]))}var qu=(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;hY(n,t),_Y(e)},SY="Supabase",EY=((e,t)=>({setupOnce(){qu(e,t)},name:SY})),Lb=e=>EY(e.supabaseClient,{sendOperationData:e.sendOperationData});var TY=10,IY="ZodErrors";function AY(e){return et(e)&&e.name==="ZodError"&&Array.isArray(e.issues)}function NY(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 vY(e){return e.map(t=>typeof t=="number"?"<array>":t).join(".")}function RY(e){let t=new Set;for(let r of e.issues){let i=vY(r.path);i.length>0&&t.add(i)}let n=Array.from(t);if(n.length===0){let r="variable";if(e.issues.length>0){let i=e.issues[0];i!==void 0&&"expected"in i&&typeof i.expected=="string"&&(r=i.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${dn(n.join(", "),100)}`}function OY(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!AY(r.originalException)||r.originalException.issues.length===0)return n;try{let o=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(NY);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:o})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:RY(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":o.slice(0,e)}}}catch(i){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:i instanceof Error?`${i.name}: ${i.message}
21
+ ${i.stack}`:"unknown"}}}}}var CY=((e={})=>{let t=e.limit??TY;return{name:IY,processEvent(n,r){return OY(t,e.saveZodIssuesAsAttachment,n,r)}}}),Mb=CY;var xY="Console",wb=(e={})=>{let t=new Set(e.levels||$n);return{name:xY,setup(n){let r=fa(({args:i,level:o})=>{C()!==n||!t.has(o)||PY(o,i)});if(n.registerCleanup(r),e.filter){let i=LO(e.filter);n.registerCleanup(i)}}}};function PY(e,t){let n={category:"console",data:{arguments:t,logger:"console"},level:$i(e),message:YO(t)};if(e==="assert")if(t[0]===!1){let r=t.slice(1);n.message=r.length>0?`Assertion failed: ${YO(r)}`:"Assertion failed",n.data.arguments=r}else return;rn(n,{input:t,level:e})}function YO(e){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):ws(e," ")}var kY=100,LY=10,Qu="flag.evaluation.";function Ju(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 $u(e,t,n=kY){let r=ne().getScopeData().contexts;r.flags||(r.flags={values:[]});let i=r.flags.values;MY(i,e,t,n)}function MY(e,t,n,r){if(typeof n!="boolean")return;if(e.length>r){E&&g.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}let i=e.findIndex(o=>o.flag===t);i!==-1&&e.splice(i,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function zu(e,t,n=LY){if(typeof t!="boolean")return;let r=Q();if(!r)return;let i=oe(r).data;if(`${Qu}${e}`in i){r.setAttribute(`${Qu}${e}`,t);return}Object.keys(i).filter(s=>s.startsWith(Qu)).length<n&&r.setAttribute(`${Qu}${e}`,t)}var Gb=()=>({name:"FeatureFlags",processEvent(e,t,n){return Ju(e)},addFeatureFlag(e,t){$u(e,t),zu(e,t)}});var Ub=({growthbookClass:e})=>({name:"GrowthBook",setupOnce(){let t=e.prototype;typeof t.isOn=="function"&&Pt(t,"isOn",jO),typeof t.getFeatureValue=="function"&&Pt(t,"getFeatureValue",jO)},processEvent(t,n,r){return Ju(t)}});function jO(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"&&($u(n,r),zu(n,r)),r}}var wY="ConversationId",GY=(()=>({name:wY,setup(e){e.on("spanStart",t=>{let n=ne().getScopeData(),r=J().getScopeData(),i=n.conversationId||r.conversationId;if(i){let{op:o,data:s,description:c}=oe(t);if(!o?.startsWith("gen_ai.")&&!s["ai.operationId"]&&!c?.startsWith("ai."))return;t.setAttribute(Bo,i)}})}})),Db=GY;function ZO(e){return!!e&&typeof e._profiler<"u"&&typeof e._profiler.start=="function"&&typeof e._profiler.stop=="function"}function UY(){let e=C();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(!ZO(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.start()}function DY(){let e=C();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(!ZO(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.stop()}var Bb={startProfiler:UY,stopProfiler:DY};function Hb(e,t={},n=ne()){let{message:r,name:i,email:o,url:s,source:c,associatedEventId:a,tags:l}=e,p={contexts:{feedback:{contact_email:o,name:i,message:r,url:s,source:c,associated_event_id:a}},type:"feedback",level:"info",tags:l},u=n?.getClient()||C();return u&&u.emit("beforeSendFeedback",p,t),n.captureEvent(p,t)}function ga(e,t,n){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):BY(e,t,n)}function BY(e,t,n){return e.map(r=>zn(r)?String(r):JSON.stringify(Ke(r,t,n))).join(" ")}function ed(e){return/%[sdifocO]/.test(e)}function td(e,t){let n={},r=new Array(t.length).fill("{}").join(" ");return n["sentry.message.template"]=`${e} ${r}`,t.forEach((i,o)=>{n[`sentry.message.parameter.${o}`]=i}),n}var HY="ConsoleLogs",XO={[S]:"auto.log.console"},FY=((e={})=>{let t=e.levels||$n;return{name:HY,setup(n){let{enableLogs:r,normalizeDepth:i=3,normalizeMaxBreadth:o=1e3}=n.getOptions();if(!r){E&&g.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let s=fa(({args:c,level:a})=>{if(C()!==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: ${ga(p,i,o)}`:"Assertion failed";cr({level:"error",message:m,attributes:XO})}return}let u=a==="log",d={...XO};if(Vt(l)){Object.assign(d,Ke(l,i,o));let m=typeof c[1]=="string"?2:1;c.slice(m).forEach((h,b)=>{d[`sentry.message.parameter.${b}`]=Ke(h,i,o)})}else if(p.length>0&&typeof l=="string"&&!ed(l)){let _=td(l,p);for(let[h,b]of Object.entries(_))d[h]=h.startsWith("sentry.message.parameter.")?Ke(b,i,o):b}cr({level:u?"info":a,message:ga(c,i,o),severityNumber:u?10:void 0,attributes:d})});n.registerCleanup(s)}}}),Fb=FY;var dt={};$N(dt,{count:()=>WY,distribution:()=>YY,gauge:()=>VY});function Wb(e,t,n,r){sb({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function WY(e,t=1,n){Wb("counter",e,t,n)}function VY(e,t,n){Wb("gauge",e,t,n)}function YY(e,t,n){Wb("distribution",e,t,n)}var jY=["trace","debug","info","warn","error","fatal"];function Vb(e={}){let t=new Set(e.levels??jY),n=e.client;return{log(r){let{type:i,level:o,message:s,args:c,tag:a,date:l,...p}=r,u=n||C();if(!u)return;let d=KY(i,o);if(!t.has(d))return;let{normalizeDepth:m=3,normalizeMaxBreadth:_=1e3}=u.getOptions(),h={};for(let[R,M]of Object.entries(p))h[R]=Ke(M,m,_);h["sentry.origin"]="auto.log.consola",a&&(h["consola.tag"]=a),i&&(h["consola.type"]=i),o!=null&&typeof o=="number"&&(h["consola.level"]=o);let b=QY(qY(c,m,_),m,_);b?.attributes&&Object.assign(h,b.attributes),cr({level:d,message:b?.message||s||c&&ga(c,m,_)||"",attributes:h})}}}var ZY={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"},XY={0:"fatal",1:"warn",2:"info",3:"info",4:"debug",5:"trace"};function KY(e,t){if(e==="verbose")return"debug";if(e==="silent")return"trace";if(e){let n=ZY[e];if(n)return n}if(typeof t=="number"){let n=XY[t];if(n)return n}return"info"}function qY(e,t,n){if(!e?.length)return{message:""};let r=ga(e,t,n),i=e[0];if(Vt(i)){let o=typeof e[1]=="string"?2:1,s=e.slice(o);return{message:r,attributes:i,messageParameters:s}}else{let o=e.slice(1),s=o.length>0&&typeof i=="string"&&!ed(i);return{message:r,messageTemplate:s?i:void 0,messageParameters:s?o:void 0}}}function QY(e,t,n){let{message:r,attributes:i,messageTemplate:o,messageParameters:s}=e,c={};if(o&&s){let a=td(o,s);for(let[l,p]of Object.entries(a))c[l]=l.startsWith("sentry.message.parameter.")?Ke(p,t,n):p}else s&&s.length>0&&s.forEach((a,l)=>{c[`sentry.message.parameter.${l}`]=Ke(a,t,n)});return{message:r,attributes:{...Ke(i,t,n),...c}}}var KO="gen_ai.prompt",Wr="gen_ai.system",De="gen_ai.request.model",_a="gen_ai.request.stream",zi="gen_ai.request.temperature",ha="gen_ai.request.max_tokens",eo="gen_ai.request.frequency_penalty",ba="gen_ai.request.presence_penalty",to="gen_ai.request.top_p",nd="gen_ai.request.top_k",rd="gen_ai.request.encoding_format",id="gen_ai.request.dimensions",Vr="gen_ai.response.finish_reasons",on="gen_ai.response.model",no="gen_ai.response.id",qO="gen_ai.response.stop_reason",Tt="gen_ai.usage.input_tokens",Ut="gen_ai.usage.output_tokens",Fn="gen_ai.usage.total_tokens",it="gen_ai.operation.name",Ct="sentry.sdk_meta.gen_ai.input.messages.original_length",Dt="gen_ai.input.messages",QO="gen_ai.output.messages",Jt="gen_ai.system_instructions",$t="gen_ai.response.text",Wn="gen_ai.request.available_tools",JO="gen_ai.response.streaming",hn="gen_ai.response.tool_calls",ro="gen_ai.agent.name",$O="gen_ai.pipeline.name",io="gen_ai.conversation.id",Yb="gen_ai.usage.input_tokens.cache_write",oo="gen_ai.usage.input_tokens.cached",zO="gen_ai.invoke_agent",so="gen_ai.embeddings.input",jb="gen_ai.embeddings",Zb="gen_ai.execute_tool",Yr="gen_ai.tool.name",pl="gen_ai.tool.call.id",ul="gen_ai.tool.type",ya="gen_ai.tool.input",Sa="gen_ai.tool.output",Ea="gen_ai.tool.description";function ao(e){return!e||typeof e!="object"?!1:$Y(e)||tC(e)||JY(e)||nC(e)||rC(e)||zY(e)||e5(e)||t5(e)||n5(e)||r5(e)||i5(e)||o5(e)}function JY(e){return"image_url"in e?typeof e.image_url=="string"?e.image_url.startsWith("data:"):eC(e):!1}function eC(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 $Y(e){return"type"in e&&typeof e.type=="string"&&"source"in e&&ao(e.source)}function tC(e){return"inlineData"in e&&!!e.inlineData&&typeof e.inlineData=="object"&&"data"in e.inlineData&&typeof e.inlineData.data=="string"}function nC(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 rC(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 zY(e){return"media_type"in e&&typeof e.media_type=="string"&&"data"in e}function e5(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 t5(e){return"type"in e&&e.type==="image"&&"image"in e&&typeof e.image=="string"&&!e.image.startsWith("http://")&&!e.image.startsWith("https://")}function n5(e){return"type"in e&&(e.type==="blob"||e.type==="base64")}function r5(e){return"b64_json"in e}function i5(e){return"type"in e&&"result"in e&&e.type==="image_generation"}function o5(e){return"uri"in e&&typeof e.uri=="string"&&e.uri.startsWith("data:")}var dl="[Blob substitute]",s5=["image_url","data","content","b64_json","result","uri","image"];function zo(e){let t={...e};ao(t.source)&&(t.source=zo(t.source)),tC(e)&&(t.inlineData={...e.inlineData,data:dl}),eC(e)&&(t.image_url={...e.image_url,url:dl}),nC(e)&&(t.input_audio={...e.input_audio,data:dl}),rC(e)&&(t.file={...e.file,file_data:dl});for(let n of s5)typeof t[n]=="string"&&(t[n]=dl);return t}var oC=2e4,od=e=>new TextEncoder().encode(e).length,Kb=e=>od(JSON.stringify(e));function sd(e,t){if(od(e)<=t)return e;let n=0,r=e.length,i="";for(;n<=r;){let o=Math.floor((n+r)/2),s=e.slice(0,o);od(s)<=t?(i=s,n=o+1):r=o-1}return i}function a5(e){return typeof e=="string"?e:"text"in e&&typeof e.text=="string"?e.text:""}function iC(e,t){return typeof e=="string"?t:{...e,text:t}}function c5(e){return e!==null&&typeof e=="object"&&"content"in e&&typeof e.content=="string"}function sC(e){return e!==null&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)}function aC(e){return e!==null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)&&e.parts.length>0}function l5(e,t){let n={...e,content:""},r=Kb(n),i=t-r;if(i<=0)return[];let o=sd(e.content,i);return[{...e,content:o}]}function p5(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 u5(e,t){let{key:n,items:r}=p5(e);if(n===null||r.length===0)return[];let i=r.map(a=>iC(a,"")),o=Kb({...e,[n]:i}),s=t-o;if(s<=0)return[];let c=[];for(let a of r){let l=a5(a),p=od(l);if(p<=s)c.push(a),s-=p;else if(c.length===0){let u=sd(l,s);u&&c.push(iC(a,u));break}else break}return c.length<=0?[]:[{...e,[n]:c}]}function d5(e,t){if(!e)return[];if(typeof e=="string"){let n=sd(e,t);return n?[n]:[]}return typeof e!="object"?[]:c5(e)?l5(e,t):sC(e)||aC(e)?u5(e,t):[]}function Xb(e){return e.map(n=>{let r;return n&&typeof n=="object"&&(sC(n)?r={...n,content:Xb(n.content)}:"content"in n&&ao(n.content)&&(r={...n,content:zo(n.content)}),aC(n)&&(r={...r??n,parts:Xb(n.parts)}),ao(r)?r=zo(r):ao(n)&&(r=zo(n))),r??n})}function m5(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],i=Xb([r]),o=i[0];return Kb(o)<=n?i:d5(o,n)}function cC(e){return m5(e,oC)}function lC(e){return sd(e,oC)}function Ze(e){let t=C()?.getDataCollectionOptions().genAI;return{...e,recordInputs:e?.recordInputs??t?.inputs??!1,recordOutputs:e?.recordOutputs??t?.outputs??!1}}function ze(e){if(e!==void 0)return e;let t=C();return t?!rt(t)&&t.getOptions().streamGenAiSpans===!1:!0}function ad(e,t){return e?`${e}.${t}`:t}function jr(e,t,n,r,i){let o={};return typeof e=="number"&&(o[Tt]=e),typeof n=="number"&&(o[wr]=n),typeof r=="number"&&(o[Gr]=r),typeof t=="number"&&(o[Ut]=t),typeof i=="number"?o[Fn]=i:(typeof e=="number"||typeof t=="number")&&(o[Fn]=(typeof e=="number"?e:0)+(typeof t=="number"?t:0)),o}function es(e,t,n){if(!e.isRecording())return;let r={[JO]:!0};t.responseId&&(r[no]=t.responseId),t.responseModel&&(r[on]=t.responseModel),Object.assign(r,jr(t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens,t.totalTokens)),typeof t.reasoningOutputTokens=="number"&&(r[Ru]=t.reasoningOutputTokens),t.finishReasons.length&&(r[Vr]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[$t]=t.responseTexts.join("")),n&&t.toolCalls.length&&(r[hn]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function Bt(e){if(typeof e=="string")return lC(e);try{return JSON.stringify(Array.isArray(e)?cC(e):e)}catch{return"[unserializable]"}}function Cn(e){if(!Array.isArray(e))return{systemInstructions:void 0,filteredMessages:e};let t=e.findIndex(s=>s&&typeof s=="object"&&"role"in s&&s.role==="system");if(t===-1)return{systemInstructions:void 0,filteredMessages:e};let n=e[t],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:e};let i=JSON.stringify([{type:"text",content:r}]),o=[...e.slice(0,t),...e.slice(t+1)];return{systemInstructions:i,filteredMessages:o}}async function f5(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r=="object"&&"data"in r?{...r,data:n}:n}function Ta(e,t){return _t(e)?new Proxy(e,{get(n,r){let o=r in Promise.prototype||r===Symbol.toStringTag?t:n,s=Reflect.get(o,r);return r==="withResponse"&&typeof s=="function"?function(){let a=s.call(n);return f5(a,t)}:typeof s=="function"?s.bind(o):s}}):t}var pC="WorkersAI";var ml=new Map,cd=new Map,ld=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 pd="operation.name",ud="ai.operationId",dd="ai.prompt",uC="ai.schema",dC="ai.response.object",qb="ai.values",Qb="ai.response.text",Jb="ai.response.toolCalls",mC="ai.response.finishReason",ts="ai.prompt.messages",Ni="ai.prompt.tools",fl="ai.model.id",fC="ai.response.providerMetadata",gC="ai.usage.cachedInputTokens",_C="ai.usage.inputTokenDetails.",hC="ai.telemetry.functionId",bC="ai.usage.completionTokens",yC="ai.usage.promptTokens",SC="ai.usage.tokens",$b="ai.toolCall.name",zb="ai.toolCall.id",EC="ai.toolCall.args",TC="ai.toolCall.result";function AC(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[Tt],i=e.data[Ut];if(typeof r=="number"||typeof i=="number"){let o=t.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(o.inputTokens+=r),typeof i=="number"&&(o.outputTokens+=i),t.set(n,o)}}function ey(e,t){let n=t.get(e.span_id);!n||!e.data||(n.inputTokens>0&&(e.data[Tt]=n.inputTokens),n.outputTokens>0&&(e.data[Ut]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(e.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function g5(e){let t=new Map;for(let n of e){let r=n.data[Wn];if(typeof r=="string")try{let i=JSON.parse(r);for(let o of i)o.name&&o.description&&!t.has(o.name)&&t.set(o.name,o.description)}catch{}}return t}function NC(e,t){let n=g5(e);for(let r of e){if(r.op==="gen_ai.execute_tool"){let i=r.data[Yr];if(typeof i=="string"){let o=n.get(i);o&&(r.data[Ea]=o)}}r.op==="gen_ai.invoke_agent"&&ey(r,t)}}function ty(e){return ml.get(e)}function ny(e){ml.delete(e)}function vC(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 IC(e){return e.filter(t=>!!t&&typeof t=="object"&&"role"in t&&"content"in t)}function _5(e){try{let t=JSON.parse(e);if(t&&typeof t=="object"){let{messages:n}=t,{prompt:r,system:i}=t,o=[];if(typeof i=="string"&&o.push({role:"system",content:i}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return o.push(...IC(n)),o;if(Array.isArray(r))return o.push(...IC(r)),o;if(typeof r=="string"&&o.push({role:"user",content:r}),o.length>0)return o}}catch{}return[]}function RC(e,t,n){if(typeof t[dd]=="string"&&!t[Dt]&&!t[ts]){let r=t[dd],i=_5(r);if(i.length){let{systemInstructions:o,filteredMessages:s}=Cn(i);o&&e.setAttribute(Jt,o);let c=Array.isArray(s)?s.length:0,a=n?Bt(s):Ge(s);e.setAttributes({[dd]:a,[Dt]:a,[Ct]:c})}}else if(typeof t[ts]=="string"){let r=t[ts];try{let i=JSON.parse(r);if(Array.isArray(i)){let{systemInstructions:o,filteredMessages:s}=Cn(i);o&&e.setAttribute(Jt,o);let c=Array.isArray(s)?s.length:0,a=!n&&s===i?r:n?Bt(s):Ge(s);e.setAttributes({[ts]:a,[Dt]:a,[Ct]:c})}}catch{}}}function h5(e){let{data:t,description:n}=oe(e);if(!n)return;if(t[$b]&&t[zb]&&n==="ai.toolCall"){I5(e,t);return}if(!t[ud]&&!n.startsWith("ai."))return;ld.get(n)==="generate_content"&&Ai([pC]);let i=C()?.getIntegrationByName("VercelAI"),o=ze(i?.options?.enableTruncation);A5(e,n,t,o)}function b5(e){if(e.type==="transaction"&&e.spans){let t=new Map;for(let r of e.spans)E5(r),AC(r,t);NC(e.spans,t);let n=e.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&ey(n,t)}return e}function y5(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 S5(e){let t=e[Qb],n=e[Jb],r=e[mC];if(t==null&&n==null)return;let i=[];if(typeof t=="string"&&t.length>0&&i.push({type:"text",content:t}),n!=null)try{let o=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(o)){for(let s of o){let c=s.input??s.args;i.push({type:"tool_call",id:s.toolCallId,name:s.toolName,arguments:typeof c=="string"?c:JSON.stringify(c??{})})}delete e[Jb]}}catch{}if(i.length>0){let o={role:"assistant",parts:i,finish_reason:y5(r)};e[QO]=JSON.stringify([o]),delete e[Qb]}}function CC(e){if(Ht(e,bC,Ut),Ht(e,yC,Tt),Ht(e,gC,oo),Ht(e,"ai.usage.inputTokens",Tt),Ht(e,"ai.usage.outputTokens",Ut),Ht(e,SC,Tt),Ht(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),!Object.keys(e).some(n=>n.startsWith(_C))&&typeof e[Tt]=="number"&&typeof e[oo]=="number"&&(e[Tt]=e[Tt]+e[oo]),typeof e[Tt]=="number"){let n=typeof e[Ut]=="number"?e[Ut]:0;e[Fn]=n+e[Tt]}if(e[Ni]&&Array.isArray(e[Ni])&&(e[Ni]=vC(e[Ni])),e[pd]){let n=e[ud]?e[ud]:e[pd],r=ld.get(n)??n;e[it]=r,delete e[pd]}if(Ht(e,ts,Dt),S5(e),Ht(e,dC,"gen_ai.response.object"),Ht(e,Ni,"gen_ai.request.available_tools"),Ht(e,EC,ya),Ht(e,TC,Sa),Ht(e,uC,"gen_ai.request.schema"),Ht(e,fl,De),Array.isArray(e[qb])){let n=e[qb].map(r=>{try{return JSON.parse(r)}catch{return r}});e[so]=n.length===1?n[0]:JSON.stringify(n)}N5(e);for(let n of Object.keys(e))Array.isArray(e[n])&&(e[n]=JSON.stringify(e[n])),n.startsWith("ai.")&&Ht(e,n,`vercel.${n}`)}function E5(e){let{data:t,origin:n}=e;n==="auto.vercelai.otel"&&(e.status&&e.status!=="ok"&&(e.status="internal_error"),CC(t))}function T5(e){let t=e.attributes;if(t?.[S]==="auto.vercelai.otel"){if(CC(t),t[H]==="gen_ai.execute_tool"&&e.parent_span_id){let n=cd.get(e.parent_span_id);if(n){let r=t[Yr];if(typeof r=="string"){let i=n.get(r);i&&(t[Ea]=i)}}}cd.delete(e.span_id)}}function Ht(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function I5(e,t){e.setAttribute(S,"auto.vercelai.otel"),e.setAttribute(H,"gen_ai.execute_tool"),e.setAttribute(it,"execute_tool"),Ht(t,$b,Yr),Ht(t,zb,pl);let n=t[pl];typeof n=="string"&&ml.set(n,e.spanContext()),t[ul]||e.setAttribute(ul,"function");let r=t[Yr];r&&e.updateName(`execute_tool ${r}`)}function A5(e,t,n,r){e.setAttribute(S,"auto.vercelai.otel");let i=t.replace("ai.","");e.setAttribute("ai.pipeline.name",i),e.updateName(i);let o=n[hC];o&&typeof o=="string"&&e.setAttribute("gen_ai.function_id",o),RC(e,n,r),n[fl]&&!n[on]&&e.setAttribute(on,n[fl]),e.setAttribute("ai.streaming",t.includes("stream"));let s=ld.get(t);if(s?e.setAttribute(H,`gen_ai.${s}`):t.startsWith("ai.stream")&&e.setAttribute(H,"ai.run"),s==="invoke_agent"){o&&typeof o=="string"?e.updateName(`invoke_agent ${o}`):e.updateName("invoke_agent");return}let c=n[fl];c&&s&&e.updateName(`${s} ${c}`);let a=C();if(a&&rt(a)&&n[Ni]&&Array.isArray(n[Ni])){let l=new Map;for(let p of n[Ni])try{let u=typeof p=="string"?JSON.parse(p):p;u?.name&&u?.description&&l.set(u.name,u.description)}catch{}if(l.size>0){let p=oe(e).parent_span_id;p&&cd.set(p,l)}}}var OC=new WeakSet;function md(e){OC.has(e)||(OC.add(e),e.on("spanStart",h5),e.addEventProcessor(Object.assign(b5,{id:"VercelAiEventProcessor"})),e.on("processSpan",t=>{T5(t)}))}function fd(e){let t={};if(!e||typeof e!="object")return t;let n=e,r=n.openai??n.azure;if(r&&(xn(t,oo,r.cachedPromptTokens),xn(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),xn(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),xn(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),xn(t,io,r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;xn(t,oo,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;xn(t,Yb,s)}n.bedrock?.usage&&(xn(t,oo,n.bedrock.usage.cacheReadInputTokens),xn(t,Yb,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(xn(t,oo,n.deepseek.promptCacheHitTokens),xn(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens));let i=(n.google??n.vertex)?.usageMetadata;return i&&typeof i.thoughtsTokenCount=="number"&&i.thoughtsTokenCount>0&&(t[Ut]=(i.candidatesTokenCount??0)+i.thoughtsTokenCount,xn(t,Fn,i.totalTokenCount),xn(t,"gen_ai.usage.reasoning.output_tokens",i.thoughtsTokenCount)),t}var gd=new Set([Ut,Fn,"gen_ai.usage.reasoning.output_tokens"]);function N5(e){let t=e[fC];if(!t)return;let n=e[it]==="invoke_agent";try{let r=fd(JSON.parse(t));for(let[i,o]of Object.entries(r))i===io&&e[i]||n&&gd.has(i)||(e[i]=o)}catch{}}function xn(e,t,n){n!=null&&(e[t]=n)}var Zr="OpenAI",xC={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},v5=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],PC=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...v5];function kC(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&e.type.startsWith("response.")}function LC(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion.chunk"}function gl(e,t,n){if(!t||typeof t!="object")return;let r=t,i={};if(typeof r.id=="string"&&(i[no]=r.id),typeof r.model=="string"&&(i[on]=r.model),r.object==="conversation"&&typeof r.id=="string"&&(i[io]=r.id),r.usage&&typeof r.usage=="object"){let o=r.usage,s=o.prompt_tokens??o.input_tokens;typeof s=="number"&&(i[Tt]=s);let c=o.completion_tokens??o.output_tokens;typeof c=="number"&&(i[Ut]=c),typeof o.total_tokens=="number"&&(i[Fn]=o.total_tokens);let a=o.prompt_tokens_details??o.input_tokens_details;B(a)&&(typeof a.cached_tokens=="number"&&(i[Gr]=a.cached_tokens),typeof a.cache_write_tokens=="number"&&(i[wr]=a.cache_write_tokens))}if(Array.isArray(r.choices)){let o=r.choices,s=o.map(c=>c.finish_reason).filter(c=>typeof c=="string");if(s.length>0&&(i[Vr]=JSON.stringify(s)),n){let c=o.map(l=>l.message?.content||"");i[$t]=JSON.stringify(c);let a=o.map(l=>l.message?.tool_calls).filter(l=>Array.isArray(l)&&l.length>0).flat();a.length>0&&(i[hn]=JSON.stringify(a))}}if(typeof r.status=="string"&&(i[Vr]||(i[Vr]=JSON.stringify([r.status]))),n&&(typeof r.output_text=="string"&&!i[$t]&&(i[$t]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!i[hn])){let o=r.output.filter(s=>s?.type==="function_call");o.length>0&&(i[hn]=JSON.stringify(o))}e.setAttributes(i)}function R5(e){if("conversation"in e&&typeof e.conversation=="string")return e.conversation;if("previous_response_id"in e&&typeof e.previous_response_id=="string")return e.previous_response_id}function ry(e){let t={[De]:e.model??"unknown"};"temperature"in e&&(t[zi]=e.temperature),"top_p"in e&&(t[to]=e.top_p),"frequency_penalty"in e&&(t[eo]=e.frequency_penalty),"presence_penalty"in e&&(t[ba]=e.presence_penalty),"stream"in e&&(t[_a]=e.stream),"encoding_format"in e&&(t[rd]=e.encoding_format),"dimensions"in e&&(t[id]=e.dimensions);let n=R5(e);return n&&(t[io]=n),t}function O5(e,t){for(let n of e){let r=n.index;if(!(r===void 0||!n.function))if(!(r in t.chatCompletionToolCalls))t.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let i=t.chatCompletionToolCalls[r];n.function.arguments&&i?.function&&(i.function.arguments+=n.function.arguments)}}}function C5(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&&O5(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function x5(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"}),me(e,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in e))return;let i=e;if(!PC.includes(i.type)){t.eventTypes.push(i.type);return}if(n&&(i.type==="response.output_item.done"&&"item"in i&&t.responsesApiToolCalls.push(i.item),i.type==="response.output_text.delta"&&"delta"in i&&i.delta)){t.responseTexts.push(i.delta);return}if("response"in i){let{response:o}=i;t.responseId=o.id??t.responseId,t.responseModel=o.model??t.responseModel,o.usage&&(t.promptTokens=o.usage.input_tokens,t.completionTokens=o.usage.output_tokens,t.totalTokens=o.usage.total_tokens,t.cacheReadInputTokens=o.usage.input_tokens_details?.cached_tokens??t.cacheReadInputTokens,t.cacheCreationInputTokens=o.usage.input_tokens_details?.cache_write_tokens??t.cacheCreationInputTokens),o.status&&t.finishReasons.push(o.status),n&&o.output_text&&t.responseTexts.push(o.output_text)}}async function*_l(e,t,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,cacheReadInputTokens:void 0,cacheCreationInputTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let i of e)LC(i)?C5(i,r,n):kC(i)&&x5(i,r,n,t),yield i}finally{let i=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];es(t,{...r,toolCalls:i},n)}}function P5(e){let t=Array.isArray(e.tools)?e.tools:[],r=e.web_search_options&&typeof e.web_search_options=="object"?[{type:"web_search_options",...e.web_search_options}]:[],i=[...t,...r];if(i.length!==0)try{return JSON.stringify(i)}catch(o){E&&g.error("Failed to serialize OpenAI tools:",o);return}}function _d(e,t){let n={[Wr]:"openai",[it]:t,[S]:"auto.ai.openai"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let r=e[0],i=P5(r);i&&(n[Wn]=i),Object.assign(n,ry(r))}else n[De]="unknown";return n}function hl(e,t,n,r){if(n==="embeddings"&&"input"in t){let c=t.input;if(c==null||typeof c=="string"&&c.length===0||Array.isArray(c)&&c.length===0)return;e.setAttribute(so,typeof c=="string"?c:JSON.stringify(c));return}let i="input"in t?t.input:"messages"in t?t.messages:void 0;if(!i||Array.isArray(i)&&i.length===0)return;let{systemInstructions:o,filteredMessages:s}=Cn(i);o&&e.setAttribute(Jt,o),e.setAttribute(Dt,r?Bt(s):Ge(s)),Array.isArray(s)?e.setAttribute(Ct,s.length):e.setAttribute(Ct,1)}function k5(e,t,n,r,i){return function(...s){let c=n.operation||"unknown",a=_d(s,c),l=a[De]||"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=ke(d,R=>(h=e.apply(r,s),i.recordInputs&&p&&hl(R,p,c,ze(i.enableTruncation)),(async()=>{try{let M=await h;return _l(M,R,i.recordOutputs??!1)}catch(M){throw R.setStatus({code:2,message:"internal_error"}),R.end(),M}})()));return Ta(h,b)}let m,_=Se(d,h=>(m=e.apply(r,s),i.recordInputs&&p&&hl(h,p,c,ze(i.enableTruncation)),m.then(b=>(gl(h,b,i.recordOutputs),b))));return Ta(m,_)}}function MC(e,t="",n){return new Proxy(e,{get(r,i){let o=r[i],s=ad(t,String(i)),c=xC[s];return typeof o=="function"&&c?k5(o,s,c,r,n):typeof o=="function"?o.bind(r):o&&typeof o=="object"?MC(o,s,n):o}})}function hd(e,t){return MC(e,"",Ze(t))}var Xr="Anthropic_AI",iy={"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 wC(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:i}=Cn(t);r&&e.setAttributes({[Jt]:r});let o=Array.isArray(i)?i.length:1;e.setAttributes({[Dt]:n?Bt(i):Ge(i),[Ct]:o})}var L5={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 oy(e){return e&&L5[e]||"internal_error"}function GC(e,t){t.error&&(e.setStatus({code:2,message:oy(t.error.type)}),me(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function UC(e){let{system:t,messages:n,input:r}=e,i=typeof t=="string"?[{role:"system",content:e.system}]:[],o=Array.isArray(r)?r:r!=null?[r]:void 0,s=Array.isArray(n)?n:n!=null?[n]:[],c=o??s;return[...i,...c]}function M5(e,t){return"type"in e&&typeof e.type=="string"&&e.type==="error"?(t.setStatus({code:2,message:oy(e.error?.type)}),!0):!1}function w5(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 G5(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 U5(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 D5(e,t){if(e.type!=="content_block_stop"||typeof e.index!="number")return;let n=t.activeToolBlocks[e.index];if(!n)return;let r=n.inputJsonParts.join(""),i;try{i=r?JSON.parse(r):{}}catch{i={__unparsed:r}}t.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:i}),delete t.activeToolBlocks[e.index]}function DC(e,t,n,r){!(e&&typeof e=="object")||M5(e,r)||(w5(e,t),G5(e,t),U5(e,t,n),D5(e,t))}async function*bl(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let i of e)DC(i,r,n,t),yield i}finally{es(t,r,n)}}function yl(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return e.on("streamEvent",i=>{DC(i,r,n,t)}),e.on("message",()=>{es(t,r,n)}),e.on("error",i=>{me(i,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end())}),e}var bd=!1,BC=new WeakSet;function yd(e,t,n){let r={[Wr]:"anthropic",[it]:n,[S]:"auto.ai.anthropic"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let i=e[0];i.tools&&Array.isArray(i.tools)&&(r[Wn]=JSON.stringify(i.tools)),r[De]=i.model??"unknown","temperature"in i&&(r[zi]=i.temperature),"top_p"in i&&(r[to]=i.top_p),"stream"in i&&(r[_a]=i.stream),"top_k"in i&&(r[nd]=i.top_k),"frequency_penalty"in i&&(r[eo]=i.frequency_penalty),"max_tokens"in i&&(r[ha]=i.max_tokens)}else t==="models.retrieve"||t==="models.get"?r[De]=e[0]:r[De]="unknown";return r}function Ia(e,t,n){let r=UC(t);wC(e,r,n),"prompt"in t&&e.setAttributes({[KO]:JSON.stringify(t.prompt)})}function B5(e,t){if("content"in t&&Array.isArray(t.content)){e.setAttributes({[$t]: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({[hn]:JSON.stringify(n)})}"completion"in t&&e.setAttributes({[$t]:t.completion}),"input_tokens"in t&&e.setAttributes({[$t]:JSON.stringify(t.input_tokens)})}function H5(e,t){"id"in t&&"model"in t&&(e.setAttributes({[no]:t.id,[on]:t.model}),"usage"in t&&t.usage&&e.setAttributes(jr(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 Sd(e,t,n){if(!(!t||typeof t!="object")){if("type"in t&&t.type==="error"){GC(e,t);return}n&&B5(e,t),H5(e,t)}}function HC(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end()),e}function F5(e,t,n,r,i,o,s,c,a,l){let p=r[De]??"unknown",u={name:`${i} ${p}`,op:`gen_ai.${i}`,attributes:r};if(a&&!l){let d,m=ke(u,_=>(d=e.apply(t,n),c.recordInputs&&s&&Ia(_,s,ze(c.enableTruncation)),(async()=>{try{let h=await d;return bl(h,_,c.recordOutputs??!1)}catch(h){return HC(h,_)}})()));return Ta(d,m)}else return ke(u,d=>{try{c.recordInputs&&s&&Ia(d,s,ze(c.enableTruncation)),bd=!0;let m=e.apply(t,n);return bd=!1,yl(m,d,c.recordOutputs??!1)}catch(m){return bd=!1,HC(m,d)}})}function W5(e,t,n,r,i){return new Proxy(e,{apply(o,s,c){let a=s!==void 0?s:r,l=n.streaming===!0;if(!l&&bd)return o.apply(a,c);let p=n.operation||"unknown",u=yd(c,t,p),d=u[De]??"unknown",m=typeof c[0]=="object"?c[0]:void 0,_=!!m?.stream;if(_||l)return F5(o,a,c,u,p,t,m,i,_,l);let h,b=Se({name:`${p} ${d}`,op:`gen_ai.${p}`,attributes:u},R=>(h=o.apply(a,c),i.recordInputs&&m&&Ia(R,m,ze(i.enableTruncation)),h.then(M=>(Sd(R,M,i.recordOutputs),M))));return Ta(h,b)}})}function V5(e,t){for(let n of Object.keys(iy)){let r=n.split("."),i=r.pop(),o=e;for(let a of r)o=o?.[a];if(!o||typeof o[i]!="function")continue;let s=o[i];if(BC.has(s))continue;let c=W5(s,n,iy[n],o,t);BC.add(c),o[i]=c}return e}function Ed(e,t){return V5(e,Ze(t))}var Kr="Google_GenAI",FC={"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}},WC="google_genai";function Y5(e,t){let n=e?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:"internal_error"}),me(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function j5(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 Z5(e,t,n){Array.isArray(e.functionCalls)&&t.toolCalls.push(...e.functionCalls);for(let r of e.candidates??[]){r?.finishReason&&!t.finishReasons.includes(r.finishReason)&&t.finishReasons.push(r.finishReason);for(let i of r?.content?.parts??[])n&&i.text&&t.responseTexts.push(i.text),i.functionCall&&t.toolCalls.push({type:"function",id:i.functionCall.id,name:i.functionCall.name,arguments:i.functionCall.args})}}function X5(e,t,n,r){!e||Y5(e,r)||(j5(e,t),Z5(e,t,n))}async function*Sl(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let i of e)X5(i,r,n,t),yield i}finally{es(t,r,n)}}function Aa(e,t="user"){return typeof e=="string"?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(n=>Aa(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 VC(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 K5(e){let t={};return"temperature"in e&&typeof e.temperature=="number"&&(t[zi]=e.temperature),"topP"in e&&typeof e.topP=="number"&&(t[to]=e.topP),"topK"in e&&typeof e.topK=="number"&&(t[nd]=e.topK),"maxOutputTokens"in e&&typeof e.maxOutputTokens=="number"&&(t[ha]=e.maxOutputTokens),"frequencyPenalty"in e&&typeof e.frequencyPenalty=="number"&&(t[eo]=e.frequencyPenalty),"presencePenalty"in e&&typeof e.presencePenalty=="number"&&(t[ba]=e.presencePenalty),t}function Td(e,t,n){let r={[Wr]:WC,[it]:e,[S]:"auto.ai.google_genai"};if(t){if(r[De]=VC(t,n),"config"in t&&typeof t.config=="object"&&t.config){let i=t.config;if(Object.assign(r,K5(i)),"tools"in i&&Array.isArray(i.tools)){let o=i.tools.flatMap(s=>s.functionDeclarations);r[Wn]=JSON.stringify(o)}}}else r[De]=VC({},n);return r}function El(e,t,n,r){if(n==="embeddings"){let o=t.contents;o!=null&&e.setAttribute(so,typeof o=="string"?o:JSON.stringify(o));return}let i=[];if("config"in t&&t.config&&typeof t.config=="object"&&"systemInstruction"in t.config&&t.config.systemInstruction&&i.push(...Aa(t.config.systemInstruction,"system")),"history"in t&&i.push(...Aa(t.history,"user")),"contents"in t&&i.push(...Aa(t.contents,"user")),"message"in t&&i.push(...Aa(t.message,"user")),Array.isArray(i)&&i.length){let{systemInstructions:o,filteredMessages:s}=Cn(i);o&&e.setAttribute(Jt,o);let c=Array.isArray(s)?s.length:0;e.setAttributes({[Ct]:c,[Dt]:r?Bt(s):Ge(s)})}}function Id(e,t,n){if(!(!t||typeof t!="object")){if(t.modelVersion&&e.setAttribute(on,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata=="object"){let r=t.usageMetadata,i=typeof r.candidatesTokenCount=="number"||typeof r.thoughtsTokenCount=="number";e.setAttributes(jr(r.promptTokenCount,i?(r.candidatesTokenCount??0)+(r.thoughtsTokenCount??0):void 0,void 0,r.cachedContentTokenCount,r.totalTokenCount)),typeof r.thoughtsTokenCount=="number"&&e.setAttribute(Ru,r.thoughtsTokenCount)}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let r=t.candidates.map(i=>i.content?.parts&&Array.isArray(i.content.parts)?i.content.parts.map(o=>typeof o.text=="string"?o.text:"").filter(o=>o.length>0).join(""):"").filter(i=>i.length>0);r.length>0&&e.setAttributes({[$t]:r.join("")})}if(n&&t.functionCalls){let r=t.functionCalls;Array.isArray(r)&&r.length>0&&e.setAttributes({[hn]:JSON.stringify(r)})}}}function q5(e,t,n,r,i){let o=n.operation==="embeddings";return new Proxy(e,{apply(s,c,a){let l=n.operation||"unknown",p=a[0],u=Td(l,p,r),d=u[De]??"unknown";return n.streaming?ke({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},async m=>{try{i.recordInputs&&p&&El(m,p,l,ze(i.enableTruncation));let _=await s.apply(r,a);return Sl(_,m,!!i.recordOutputs)}catch(_){throw m.setStatus({code:2,message:"internal_error"}),m.end(),_}}):Se({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},m=>(i.recordInputs&&p&&El(m,p,l,ze(i.enableTruncation)),or(()=>s.apply(r,a),()=>{},()=>{},_=>{o||Id(m,_,i.recordOutputs)})))}})}function sy(e,t="",n){return new Proxy(e,{get:(r,i,o)=>{let s=Reflect.get(r,i,o),c=ad(t,String(i)),a=FC[c];if(typeof s=="function"&&a){let l=a.operation?q5(s,c,a,r,n):s.bind(r);return a.proxyResultPath?function(...p){let u=l(...p);return u&&typeof u=="object"?sy(u,a.proxyResultPath,n):u}:l}return typeof s=="function"?s.bind(r):s&&typeof s=="object"?sy(s,c,n):s}})}function Ad(e,t){return sy(e,"",Ze(t))}var Na="LangChain",va="auto.ai.langchain",YC={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var Vn=(e,t,n)=>{n!=null&&(e[t]=n)},Tl=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function Ra(e){if(Array.isArray(e))try{let t=e.map(n=>n&&typeof n=="object"&&ao(n)?zo(n):n);return JSON.stringify(t)}catch{return String(e)}return Ge(e,String)}function Il(e){let t=e.toLowerCase();return YC[t]??t}function jC(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 ay(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function Al(e){return e.map(t=>{let n=t._getType;if(typeof n=="function"){let i=n.call(t);return{role:Il(i),content:Ra(t.content)}}if(t.lc===1&&t.kwargs){let i=t.id,o=Array.isArray(i)&&i.length>0?i[i.length-1]:"",s=typeof o=="string"?jC(o):"user";return{role:Il(s),content:Ra(t.kwargs?.content)}}if(t.type){let i=String(t.type).toLowerCase();return{role:Il(i),content:Ra(t.content)}}if(t.role)return{role:Il(String(t.role)),content:Ra(t.content)};let r=t.constructor?.name;return r&&r!=="Object"?{role:Il(jC(r)),content:Ra(t.content)}:{role:"user",content:Ra(t.content)}})}function Q5(e,t,n){let r={},i="kwargs"in e?e.kwargs:void 0,o=t?.temperature??n?.ls_temperature??i?.temperature;Tl(r,zi,o);let s=t?.max_tokens??n?.ls_max_tokens??i?.max_tokens;Tl(r,ha,s);let c=t?.top_p??i?.top_p;Tl(r,to,c);let a=t?.frequency_penalty;Tl(r,eo,a);let l=t?.presence_penalty;return Tl(r,ba,l),t&&"stream"in t&&Vn(r,_a,!!t.stream),r}function XC(e,t,n,r,i){return{[Wr]:Ge(e??"langchain",String),[it]:"chat",[De]:Ge(t,String),[S]:va,...Q5(n,r,i)}}function KC(e,t,n,r,i,o){let s=o?.ls_provider,c=i?.model??o?.ls_model_name??"unknown",a=XC(s,c,e,i,o);if(n&&Array.isArray(t)&&t.length>0){Vn(a,Ct,t.length);let l=t.map(p=>({role:"user",content:p}));Vn(a,Dt,r?Bt(l):Ge(l))}return a}function qC(e,t,n,r,i,o){let s=o?.ls_provider??e.id?.[2],c=i?.model??o?.ls_model_name??"unknown",a=XC(s,c,e,i,o);if(n&&Array.isArray(t)&&t.length>0){let l=Al(t.flat()),{systemInstructions:p,filteredMessages:u}=Cn(l);p&&Vn(a,Jt,p);let d=Array.isArray(u)?u.length:0;Vn(a,Ct,d),Vn(a,Dt,r?Bt(u):Ge(u))}return a}function J5(e,t){let n=[],r=e.flat();for(let i of r){let s=i.message?.tool_calls;if(Array.isArray(s)&&s.length>0)n.push(...s);else{let c=i.message?.content;if(Array.isArray(c))for(let a of c){let l=a;l.type==="tool_use"&&n.push(l)}}}n.length>0&&Vn(t,hn,Ge(n,String))}function cy(e){let t=e.usage_metadata;if(B(t)){let i=B(t.input_token_details)?t.input_token_details:void 0;return jr(t.input_tokens,t.output_tokens,i?.cache_creation,i?.cache_read,t.total_tokens)}let n=e.response_metadata,r=B(n)&&B(n.tokenUsage)?n.tokenUsage:void 0;return jr(r?.promptTokens,r?.completionTokens,void 0,void 0,r?.totalTokens)}function $5(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(cy(a)))l[p]=(l[p]??0)+u}}Object.assign(t,Object.keys(n).length>0?n:r);let i=e.llmOutput;if(!i)return;let o=i.tokenUsage,s=i.usage;if(s&&Object.keys(n).length===0&&Object.keys(r).length===0){let{input_tokens:c,output_tokens:a,cache_creation_input_tokens:l,cache_read_input_tokens:p}=s;Object.assign(t,jr(c!==void 0||l!==void 0||p!==void 0?(c??0)+(l??0)+(p??0):void 0,a,l,p))}else o&&Object.keys(n).length===0&&Object.keys(r).length===0&&Object.assign(t,jr(o.promptTokens,o.completionTokens,void 0,void 0,o.totalTokens));s&&(typeof s.cache_creation_input_tokens=="number"&&!(wr in t)&&(t[wr]=s.cache_creation_input_tokens),typeof s.cache_read_input_tokens=="number"&&!(Gr in t)&&(t[Gr]=s.cache_read_input_tokens))}function QC(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&&Vn(n,Vr,Ge(l,String)),J5(e.generations,n),t){let p=e.generations.flat().map(u=>u.text??u.message?.content).filter(u=>typeof u=="string");p.length>0&&Vn(n,$t,Ge(p,String))}}$5(e,n);let r=e.llmOutput,o=e.generations?.[0]?.[0]?.message,s=r?.model_name??r?.model??o?.response_metadata?.model_name;s&&Vn(n,on,s);let c=r?.id??o?.id;c&&Vn(n,no,c);let a=r?.stop_reason??o?.response_metadata?.finish_reason;return a&&Vn(n,qO,Ge(a,String)),n}function Nd(e){let t={},n=e?.lc_agent_name;return typeof n=="string"&&(t[ro]=n),t}function JC(e){let t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;let n=t.map(r=>{let i=r.function;return{type:"function",name:r.name??i?.name??"",description:r.description??i?.description}});return JSON.stringify(n)}function z5(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.addHandler=="function"&&typeof t.copy=="function"}function e3(e){return typeof e=="object"&&e?.name==="SentryCallbackHandler"}function ZC(e){return e.some(e3)}function ns(e,t){if(!e)return[t];if(z5(e)){if(ZC(e.handlers??[]))return e;let r=e.copy();return r.addHandler(t,!0),r}let n=Array.isArray(e)?e:[e];return ZC(n)?e:[...n,t]}function dr(e={}){let{recordInputs:t,recordOutputs:n}=Ze(e),r=ze(e.enableTruncation),i=new Map,o=c=>{let a=i.get(c);a?.isRecording()&&(a.end(),i.delete(c))},s={lc_serializable:!1,lc_namespace:["langchain_core","callbacks","sentry"],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:["langchain_core","callbacks","sentry"],lc_kwargs:{},name:"SentryCallbackHandler",ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(c,a,l,p,u,d,m,_){let h=ay(d),b=KC(c,a,t,r,h,m),R=b[De],M=b[it];ke({name:`${M} ${R}`,op:"gen_ai.chat",attributes:{...Nd(m),...b,[H]:"gen_ai.chat"}},v=>(i.set(l,v),v))},handleChatModelStart(c,a,l,p,u,d,m,_){let h=ay(d),b=qC(c,a,t,r,h,m),R=JC(u);R&&(b[Wn]=R);let M=b[De],v=b[it];ke({name:`${v} ${M}`,op:"gen_ai.chat",attributes:{...Nd(m),...b,[H]:"gen_ai.chat"}},N=>(i.set(l,N),N))},handleLLMEnd(c,a,l,p,u){let d=i.get(a);if(d?.isRecording()){let m=QC(c,n);m&&d.setAttributes(m),o(a)}},handleLLMError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(a))},handleChainStart(c,a,l,p,u,d,m,_){if(d?.__sentry_langgraph__)return;let h=_||c.name||"unknown_chain",b={[S]:"auto.ai.langchain","langchain.chain.name":h};t&&(b["langchain.chain.inputs"]=JSON.stringify(a)),ke({name:`chain ${h}`,op:"gen_ai.invoke_agent",attributes:{...b,[H]:"gen_ai.invoke_agent"}},R=>(i.set(l,R),R))},handleChainEnd(c,a){let l=i.get(a);l?.isRecording()&&(n&&l.setAttributes({"langchain.chain.outputs":JSON.stringify(c)}),o(a))},handleChainError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(a))},handleToolStart(c,a,l,p,u,d,m){if(d?.__sentry_langgraph__)return;let _=m||c.name||"unknown_tool",h={...Nd(d),[S]:va,[it]:"execute_tool",[Yr]:_};t&&(h[ya]=a),ke({name:`execute_tool ${_}`,op:"gen_ai.execute_tool",attributes:{...h,[H]:"gen_ai.execute_tool"}},b=>(i.set(l,b),b))},handleToolEnd(c,a){let l=i.get(a);if(l?.isRecording()){if(n){let p=c,u=p&&typeof p=="object"&&"content"in p?p.content:c;l.setAttributes({[Sa]:typeof u=="string"?u:JSON.stringify(u)})}o(a)}},handleToolError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(a))},copy(){return s},toJSON(){return{lc:1,type:"not_implemented",id:s.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:s.lc_id}}};return s}function t3(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 n3(e){let t=e??{},n={[S]:va,[H]:jb,[it]:"embeddings",[De]:t.model??"unknown"};return n[Wr]=t3(t),"dimensions"in t&&(n[id]=t.dimensions),"encodingFormat"in t&&(n[rd]=t.encodingFormat),n}function vd(e,t,n={}){let{recordInputs:r}=Ze(n),i=n3(e),o=i[De]||"unknown";return r&&t!=null&&(i[so]=typeof t=="string"?t:JSON.stringify(t)),{name:`embeddings ${o}`,op:jb,attributes:i}}function $C(e,t={}){return new Proxy(e,{apply(n,r,i){return Se(vd(r,i[0],t),()=>Reflect.apply(n,r,i))}})}function Rd(e,t){let n=e;return typeof n.embedQuery=="function"&&(n.embedQuery=$C(n.embedQuery,t)),typeof n.embedDocuments=="function"&&(n.embedDocuments=$C(n.embedDocuments,t)),e}var Oa="LangGraph",Nl="auto.ai.langgraph";function vl(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 Ca(e){let t=e[0];return typeof t=="object"&&t&&"name"in t&&typeof t.name=="string"?t.name:null}function Rl(e,t,n){let r="__sentry_tool_wrapped__";for(let i of e){if(!i||typeof i!="object")continue;let o=i,s=o.invoke;if(typeof s!="function"||Object.prototype.hasOwnProperty.call(o,r))continue;let c=typeof o.name=="string"?o.name:"unknown_tool",a=typeof o.description=="string"?o.description:void 0,l=new Proxy(s,{apply(p,u,d){let m={[S]:Nl,[H]:Zb,[it]:"execute_tool",[Yr]:c,[ul]:"function"},h=d[1]?.metadata?.lc_agent_name??n;typeof h=="string"&&(m[ro]=h),a&&(m[Ea]=a);let b=d[0];if(typeof b=="object"&&b&&("id"in b&&typeof b.id=="string"&&(m[pl]=b.id),t.recordInputs)){let R="args"in b&&typeof b.args=="object"?b.args:b;try{m[ya]=JSON.stringify(R)}catch{}}return Se({op:Zb,name:`execute_tool ${c}`,attributes:m},async R=>{try{let M=await Reflect.apply(p,u,d);if(t.recordOutputs)try{let v=M,N=v&&typeof v=="object"&&"content"in v?v.content:M;R.setAttribute(Sa,typeof N=="string"?N:JSON.stringify(N))}catch{}return M}catch(M){throw R.setStatus({code:2,message:"internal_error"}),M}})}});o.invoke=l,Object.defineProperty(o,r,{value:!0,enumerable:!1})}return e}function r3(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 i3(e){let t=cy(e);return{inputTokens:t[Tt]??0,outputTokens:t[Ut]??0,totalTokens:t[Fn]??0,cacheCreationInputTokens:t[wr],cacheReadInputTokens:t[Gr]}}function o3(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(on,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&e.setAttribute(Vr,[r.finish_reason])}}function zC(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 ex(e,t,n){let i=n?.messages;if(!i||!Array.isArray(i))return;let o=t?.length??0,s=i.length>o?i.slice(o):[];if(s.length===0)return;let c=r3(s);c&&e.setAttribute(hn,JSON.stringify(c));let a=Al(s);e.setAttribute($t,JSON.stringify(a));let l=0,p=0,u=0,d,m;for(let _ of s){let h=i3(_);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),o3(e,_)}l>0&&e.setAttribute(Tt,l),p>0&&e.setAttribute(Ut,p),u>0&&e.setAttribute(Fn,u),d!==void 0&&e.setAttribute(wr,d),m!==void 0&&e.setAttribute(Gr,m)}var ly=!1,Od="__sentry_patched__";function Cd(e){let t={[S]:Nl,[H]:"gen_ai.create_agent",[it]:"create_agent"};return e&&(t[ro]=e),{op:"gen_ai.create_agent",name:e?`create_agent ${e}`:"create_agent",attributes:t}}function py(e,t){if(Object.prototype.hasOwnProperty.call(e,Od))return e;let n=dr(t),r=new Proxy(e,{apply(i,o,s){return ly?Reflect.apply(i,o,s):Se(Cd(),c=>{try{let a=Reflect.apply(i,o,s),l=s.length>0?s[0]:{};l?.name&&typeof l.name=="string"&&(c.setAttribute(ro,l.name),c.updateName(`create_agent ${l.name}`));let p=a.invoke;return p&&typeof p=="function"&&(a.invoke=Ol(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,Od,{value:!0,enumerable:!1}),r}function Ol(e,t,n,r,i,o){return new Proxy(e,{apply(s,c,a){let l=i?.modelName??i?.model;return Se({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[S]:Nl,[H]:zO,[it]:"invoke_agent"}},async p=>{try{let u=n?.name;u&&typeof u=="string"&&(p.setAttribute($O,u),p.setAttribute(ro,u),p.updateName(`invoke_agent ${u}`)),l&&p.setAttribute(De,l);let _=(a.length>1?a[1]:void 0)?.configurable?.thread_id;if(_&&typeof _=="string"&&p.setAttribute(io,_),o){let N=a[1]??{};a[1]=N;let P=N.metadata??{};N.metadata={...P,__sentry_langgraph__:!0,...typeof u=="string"?{lc_agent_name:u}:{}},N.callbacks=ns(N.callbacks,o)}let h=zC(t);h&&p.setAttribute(Wn,JSON.stringify(h));let b=r.recordInputs,R=r.recordOutputs,M=a.length>0?a[0]?.messages??[]:[];if(M&&b){let N=Al(M),{systemInstructions:P,filteredMessages:D}=Cn(N);P&&p.setAttribute(Jt,P);let I=ze(r.enableTruncation),F=Array.isArray(D)?D.length:0;p.setAttributes({[Dt]:I?Bt(D):Ge(D),[Ct]:F})}let v=await Reflect.apply(s,c,a);return R&&ex(p,M??null,v),v}catch(u){throw p.setStatus({code:2,message:"internal_error"}),u}})}})}function uy(e,t){if(Object.prototype.hasOwnProperty.call(e,Od))return e;let n=Ze(t),r=dr(n),i=new Proxy(e,{apply(o,s,c){let a=vl(c),l=Ca(c),p=c[0];p&&Array.isArray(p.tools)&&p.tools.length>0&&Rl(p.tools,n,l??void 0),ly=!0;let u;try{u=Reflect.apply(o,s,c)}finally{ly=!1}let d=u.invoke;if(d&&typeof d=="function"){let m={};l&&(m.name=l),u.invoke=Ol(d.bind(u),u,m,n,a,r)}return u}});return Object.defineProperty(i,Od,{value:!0,enumerable:!1}),i}function Cl(e,t){return e.compile=py(e.compile,Ze(t)),e}var tx=Cl;function nx(e,t,n){let r=n.getOptions(),i=n.getDsn(),o=r.tunnel,s=Zs(r._metadata),c={sent_at:new Date(tt()).toISOString(),...s3(t)&&{trace:t},...s&&{sdk:s},...!!o&&i&&{dsn:nn(i)}},a=n.getDataCollectionOptions().userInfo?"auto":"never",l=[{type:"span",item_count:e.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Et()&&{ingest_settings:{infer_ip:a,infer_user_agent:a}},items:e}];return kt(c,[l])}function s3(e){return!!e.trace_id&&!!e.public_key}function rx(e){let t=156;if(t+=e.name.length*2,t+=U_(e.attributes),e.links&&e.links.length>0){let r=e.links[0]?.attributes,i=100+(r?U_(r):0);t+=i*e.links.length}return t}var ix=1e3,a3=5e6,xd=class{constructor(t,n){this._traceBuckets=new Map,this._client=t;let{maxSpanLimit:r,flushInterval:i,maxTraceWeightInBytes:o}=n??{};this._maxSpanLimit=r&&r>0&&r<=ix?r:ix,this._flushInterval=i&&i>0?i:5e3,this._maxTraceWeight=o&&o>0?o:a3,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:Rn(setTimeout(()=>{this.flush(n)},this._flushInterval))},this._traceBuckets.set(n,r)),r.spans.add(t),r.size+=rx(t),(r.spans.size>=this._maxSpanLimit||r.size>=this._maxTraceWeight)&&this.flush(n)}drain(){this._traceBuckets.size&&(E&&g.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((t,n)=>{this.flush(n)}))}flush(t){let n=this._traceBuckets.get(t);if(!n)return;if(!n.spans.size){this._removeTrace(t);return}let r=Array.from(n.spans),i=r[0]?._segmentSpan;if(!i){E&&g.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}let o=nt(i),s=r.map(a=>{let{_segmentSpan:l,...p}=a;return p}),c=nx(s,o,this._client);E&&g.log(`Sending span envelope for trace ${t} with ${s.length} spans`),this._client.sendEnvelope(c).then(null,a=>{E&&g.error("Error while sending streamed span envelope:",a)}),this._removeTrace(t)}_removeTrace(t){let n=this._traceBuckets.get(t);n&&clearTimeout(n.timeout),this._traceBuckets.delete(t)}};var xl=()=>({name:"SpanStreaming",setup(e){let t="SpanStreaming integration requires",n="Falling back to static trace lifecycle.",r=e.getOptions();if(!rt(e)){r.traceLifecycle="static",E&&g.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let i=r.beforeSendSpan;if(i&&!gi(i)){r.traceLifecycle="static",E&&g.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let o=new xd(e);e.on("afterSpanEnd",s=>{qt(s)&&o.add(wh(s,e))})}});function Pl(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}function kl(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 Ft=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 ox(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 Ll=class extends Hu{constructor(t){ox(t),t.traceLifecycle==="stream"&&!t.integrations.some(n=>n.name==="SpanStreaming")&&t.integrations.push(xl()),super(t),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(t,n){let r=OO(this,this._options.stackParser,t,n);return r.level="error",Ti(r)}eventFromMessage(t,n="info",r){return Ti(CO(this._options.stackParser,t,n,r,this._options.attachStacktrace))}captureException(t,n,r){return sx(n),super.captureException(t,n,r)}captureEvent(t,n,r){return!t.type&&t.exception?.values&&t.exception.values.length>0&&sx(n),super.captureEvent(t,n,r)}captureCheckIn(t,n,r){let i="checkInId"in t&&t.checkInId?t.checkInId:pt();if(!this._isEnabled())return E&&g.warn("SDK not enabled, will not capture check-in."),i;let o=this.getOptions(),{release:s,environment:c,tunnel:a}=o,l={check_in_id:i,monitor_slug:t.monitorSlug,status:t.status,release:s,environment:c};"duration"in t&&(l.duration=t.duration),n&&(l.monitor_config={schedule:n.schedule,checkin_margin:n.checkinMargin,max_runtime:n.maxRuntime,timezone:n.timezone,failure_issue_threshold:n.failureIssueThreshold,recovery_threshold:n.recoveryThreshold});let[p,u]=sa(this,r);u&&(l.contexts={trace:u});let d=fO(l,p,this.getSdkMetadata(),a,this.getDsn());return E&&g.log("Sending checkin:",t.monitorSlug,t.status),this.sendEnvelope(d),i}registerCleanup(t){this._disposeCallbacks.push(t)}dispose(){E&&g.log("Disposing client...");for(let t of this._disposeCallbacks)try{t()}catch{}this._disposeCallbacks.length=0;for(let t of Object.keys(this._hooks))this._hooks[t]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=la(tl)}_prepareEvent(t,n,r,i){return this._options.platform&&(t.platform=t.platform||this._options.platform),this._options.runtime&&(t.contexts={...t.contexts,runtime:t.contexts?.runtime||this._options.runtime}),this._options.serverName&&(t.server_name=t.server_name||this._options.serverName),super._prepareEvent(t,n,r,i)}_setUpMetricsProcessing(){this.on("processMetric",t=>{this._options.serverName&&(t.attributes={"server.address":this._options.serverName,...t.attributes})})}};function sx(e){let t=J().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!=="crashed"?t.status="errored":n||(t.status="crashed")}}var ax={mechanism:{handled:!1,type:"auto.rpc.trpc.middleware"}};function c3(e){typeof e=="object"&&e!==null&&"ok"in e&&!e.ok&&"error"in e&&me(e.error,ax)}function dy(e={}){return async function(t){let{path:n,type:r,next:i,rawInput:o,getRawInput:s}=t,c=C(),a=c?.getOptions(),l=c?.getDataCollectionOptions(),p={procedure_path:n,procedure_type:r};if(gv(p,1+(a?.normalizeDepth??5)),(e.attachRpcInput!==void 0?e.attachRpcInput:l?.httpBodies.includes("incomingRequest"))&&(o!==void 0&&(p.input=Ke(o)),s!==void 0&&typeof s=="function"))try{let u=await s();p.input=Ke(u)}catch{}return tr(u=>(u.setContext("trpc",p),ke({name:`trpc/${n}`,op:"rpc.server",attributes:{[ve]:"route",[S]:"auto.rpc.trpc"},forceTransaction:!!e.forceTransaction},async d=>{try{let m=await i();return c3(m),d.end(),m}catch(m){throw me(m,ax),d.end(),m}})))}}function vi(e,t,n){try{if(!C())return;let i=Q();i?.isRecording()&&i.setStatus({code:2,message:"internal_error"}),me(e,{mechanism:{type:"auto.ai.mcp_server",handled:!1,data:{error_type:t||"handler_execution",...n}}})}catch{}}function xa(e,t){Pt(e,t,n=>function(r,...i){let o=i[i.length-1];if(typeof o!="function")return n.call(this,r,...i);let s=Ml(o,t,r);return n.call(this,r,...i.slice(0,-1),s)})}function Ml(e,t,n){return function(...r){try{return l3.call(this,e,t,n,r)}catch(i){return E&&g.warn("MCP handler wrapping failed:",i),e.apply(this,r)}}}function l3(e,t,n,r){try{let i=e.apply(this,r);return B(i)&&typeof i.then=="function"?Promise.resolve(i).catch(o=>{throw cx(o,t,n),o}):i}catch(i){throw cx(i,t,n),i}}function cx(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")?vi(e,"validation",r):e.name==="ServerTimeoutError"||e.message.includes("timed out")||e.message.includes("timeout")?vi(e,"timeout",r):vi(e,"tool_execution",r)):t==="resource"||t==="registerResource"?(r.resource_uri=n,vi(e,"resource_execution",r)):(t==="prompt"||t==="registerPrompt")&&(r.prompt_name=n,vi(e,"prompt_execution",r))}catch{}}function p3(e){typeof e.tool=="function"&&xa(e,"tool"),typeof e.registerTool=="function"&&xa(e,"registerTool")}function u3(e){typeof e.resource=="function"&&xa(e,"resource"),typeof e.registerResource=="function"&&xa(e,"registerResource")}function d3(e){typeof e.prompt=="function"&&xa(e,"prompt"),typeof e.registerPrompt=="function"&&xa(e,"registerPrompt")}function lx(e){p3(e),u3(e),d3(e)}function px(e){let t=e,n=t._registeredTools;if(B(n))for(let[s,c]of Object.entries(n))typeof c.executor=="function"&&(c.executor=Ml(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=Ml(c.readCallback,"registerResource",s));let i=t._registeredResourceTemplates;if(B(i))for(let[s,c]of Object.entries(i))typeof c.readCallback=="function"&&(c.readCallback=Ml(c.readCallback,"registerResource",s));let o=t._registeredPrompts;if(B(o))for(let[s,c]of Object.entries(o))typeof c.handler=="function"&&(c.handler=Ml(c.handler,"registerPrompt",s))}var my="mcp.method.name",ux="mcp.request.id",dx="mcp.session.id",mx="mcp.transport",fy="mcp.server.name",gy="mcp.server.title",_y="mcp.server.version",Pa="mcp.protocol.version",fx="mcp.tool.name",co="mcp.resource.uri",gx="mcp.prompt.name",_x="mcp.tool.result.is_error",hx="mcp.tool.result.content_count",bx="mcp.prompt.result.description",yx="mcp.prompt.result.message_count",Pd="mcp.request.argument",Sx="mcp.logging.level",Ex="mcp.logging.logger",Tx="mcp.logging.data_type",Ix="mcp.logging.message",Ax="network.transport",Nx="network.protocol.version",kd="client.address",Ld="client.port",hy="mcp.server",vx="mcp.notification.client_to_server",Rx="mcp.notification.server_to_client",Ox="auto.function.mcp_server",by="auto.mcp.notification",Cx="route";function xx(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&"id"in e}function yy(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&!("id"in e)}function Px(e){return B(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"id"in e&&("result"in e||"error"in e)}function kx(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 sn(e){return B(e)}function m3(e,t){let n={[hx]:e.length};for(let[r,i]of e.entries()){if(!sn(i))continue;let o=e.length===1?"mcp.tool.result":`mcp.tool.result.${r}`;if(typeof i.type=="string"&&(n[`${o}.content_type`]=i.type),t){let s=(a,l)=>{typeof l=="string"&&(n[`${o}.${a}`]=l)};s("mime_type",i.mimeType),s("uri",i.uri),s("name",i.name),typeof i.text=="string"&&(n[`${o}.content`]=i.text),typeof i.data=="string"&&(n[`${o}.data_size`]=i.data.length);let c=i.resource;sn(c)&&(s("resource_uri",c.uri),s("resource_mime_type",c.mimeType))}}return n}function Lx(e,t){if(!sn(e))return{};let n=Array.isArray(e.content)?m3(e.content,t):{};return typeof e.isError=="boolean"&&(n[_x]=e.isError),n}function Mx(e,t){let n={};if(!sn(e))return n;if(t&&typeof e.description=="string"&&(n[bx]=e.description),Array.isArray(e.messages)&&(n[yx]=e.messages.length,t)){let r=e.messages;for(let[i,o]of r.entries()){if(!sn(o))continue;let s=r.length===1?"mcp.prompt.result":`mcp.prompt.result.${i}`;if(((a,l)=>{if(typeof l=="string"){let p=r.length===1?`${s}.message_${a}`:`${s}.${a}`;n[p]=l}})("role",o.role),sn(o.content)){let a=o.content;if(typeof a.text=="string"){let l=r.length===1?`${s}.message_content`:`${s}.content`;n[l]=a.text}}}}return n}var Sy=new Map,wx=new WeakMap;function Md(e){let t=e.sessionId;return t?Sy.get(t):wx.get(e)}function f3(e,t){let n=e.sessionId;n?Sy.set(n,t):wx.set(e,t)}function wd(e,t){let n=Md(e)||{};f3(e,{...n,...t})}function Gx(e){return Md(e)?.clientInfo}function Ux(e){return Md(e)?.protocolVersion}function Dx(e){return Md(e)}function Bx(e){let t=e.sessionId;t&&Sy.delete(t)}var Hx="io.modelcontextprotocol/protocolVersion",Fx="io.modelcontextprotocol/clientInfo",Wx="io.modelcontextprotocol/serverInfo";function Gd(e){let t={};return sn(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 Vx(e){let t={};return sn(e.params)&&(typeof e.params.protocolVersion=="string"&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=Gd(e.params.clientInfo))),t}function Yx(e){let t={};if(sn(e.params)&&sn(e.params._meta)){let n=e.params._meta;typeof n[Hx]=="string"&&(t.protocolVersion=n[Hx]),n[Fx]&&(t.clientInfo=Gd(n[Fx]))}return t}function jx(e){let t={};return sn(e)&&(typeof e.protocolVersion=="string"&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=Gd(e.serverInfo))),t}function Zx(e){let t={};return sn(e)&&sn(e._meta)&&e._meta[Wx]&&(t.serverInfo=Gd(e._meta[Wx])),t}function g3(e){let t=Gx(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 Xx(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 _3(e){let t=Dx(e)?.serverInfo,n={};return t?.name&&(n[fy]=t.name),t?.title&&(n[gy]=t.title),t?.version&&(n[_y]=t.version),n}function Kx(e){let t={};return e?.name&&(t[fy]=e.name),e?.title&&(t[gy]=e.title),e?.version&&(t[_y]=e.version),t}function h3(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 b3(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 Ey(e,t){let n=e&&"sessionId"in e?e.sessionId:void 0,r=t?h3(t):{},{mcpTransport:i,networkTransport:o}=b3(e),s=g3(e),c=_3(e),a=Ux(e);return{...n&&{[dx]:n},...r.address&&{[kd]:r.address},...r.port&&{[Ld]:r.port},[mx]:i,[Ax]:o,[Nx]:"2.0",...a&&{[Pa]:a},...s,...c}}var Ud=new Map,Ty=new WeakMap;function qx(e){let t=e.sessionId;if(t){let r=Ud.get(t);return r||(r=new Map,Ud.set(t,r)),r}let n=Ty.get(e);return n||(n=new Map,Ty.set(e,n)),n}function Qx(e,t,n,r,i){qx(e).set(t,{span:n,method:r,capturePolicy:i,startTime:Date.now()})}function Jx(e,t,n,r=!1){let i=qx(e),o=i.get(t);if(o){let{span:s,method:c}=o,a=c==="initialize"?jx(n):Zx(n);(a.protocolVersion||a.serverInfo)&&wd(e,a);let l={...Kx(a.serverInfo)};if(a.protocolVersion&&(l[Pa]=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=Lx(n,o.capturePolicy.recordOutputs);s.setAttributes(p)}else if(c==="prompts/get"){let p=Mx(n,o.capturePolicy.recordOutputs);s.setAttributes(p)}s.end(),i.delete(t)}}function $x(e){let t=e.sessionId;if(t){let r=Ud.get(t);if(r){for(let[,i]of r)i.span.setStatus({code:2,message:"cancelled"}),i.span.end();Ud.delete(t)}return}let n=Ty.get(e);if(n){for(let[,r]of n)r.span.setStatus({code:2,message:"cancelled"}),r.span.end();n.clear()}}var zx={"tools/call":{targetField:"name",targetAttribute:fx,captureArguments:!0,argumentsField:"arguments"},"resources/read":{targetField:"uri",targetAttribute:co,captureUri:!0},"resources/subscribe":{targetField:"uri",targetAttribute:co},"resources/unsubscribe":{targetField:"uri",targetAttribute:co},"prompts/get":{targetField:"name",targetAttribute:gx,captureName:!0,captureArguments:!0,argumentsField:"arguments"}};function wl(e,t){let n=zx[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 eP(e,t){let n={},r=zx[e];if(!r)return n;if(r.captureArguments&&r.argumentsField&&t?.[r.argumentsField]){let i=t[r.argumentsField];if(B(i))for(let[o,s]of Object.entries(i))n[`${Pd}.${o.toLowerCase()}`]=JSON.stringify(s)}return r.captureUri&&t?.uri&&(n[`${Pd}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${Pd}.name`]=JSON.stringify(t.name)),n}function y3(e){return typeof e=="string"?e:JSON.stringify(e)}function S3(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[Sx]=String(t.level)),t?.logger&&(r[Ex]=String(t.logger)),t?.data!==void 0&&(r[Tx]=typeof t.data,n&&(r[Ix]=y3(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[co]=String(t.uri);let i=pr(String(t.uri));i&&!lr(i)&&(r["mcp.resource.protocol"]=i.protocol.replace(":",""))}break;case"notifications/initialized":r["mcp.lifecycle.phase"]="initialization_complete",r["mcp.protocol.ready"]=1;break}return r}function Iy(e,t,n,r){if(e==="request"){let i=t,o=wl(i.method,n||{});return{...i.id!==void 0&&{[ux]:String(i.id)},...o.attributes,...r?eP(i.method,n||{}):{}}}return S3(t.method,n||{},r)}var E3=new Set([kd,Ld,co]);function T3(e){return E3.has(e)}function Ay(e,t){return t?e:Object.entries(e).reduce((n,[r,i])=>(T3(r)||(n[r]=i),n),{})}function tP(e,t){return t?`${e} ${t}`:e}function nP(e){let t,n;switch(e){case"request":t=hy,n=Ox;break;case"notification-incoming":t=vx,n=by;break;case"notification-outgoing":t=Rx,n=by;break}return{[H]:t,[S]:n,[ve]:Cx}}function rP(e){let{type:t,message:n,transport:r,extra:i,callback:o,options:s}=e,{method:c}=n,a=n.params,l;if(t==="request"){let _=wl(c,a||{});l=tP(c,_.target)}else l=c;let p={...Ey(r,i),[my]:c,...Iy(t,n,a,s?.recordInputs),...nP(t)},d=!!C()?.getDataCollectionOptions().userInfo,m=Ay(p,d);return Se({name:l,forceTransaction:!0,attributes:m},o)}function iP(e,t,n,r,i){return rP({type:"notification-incoming",message:e,transport:t,extra:n,callback:i,options:r})}function oP(e,t,n,r){return rP({type:"notification-outgoing",message:e,transport:t,options:n,callback:r})}function sP(e,t,n,r){let{method:i}=e,o=e.params,s=wl(i,o||{}),c=tP(i,s.target),a={...Ey(t,n),[my]:i,...Iy("request",e,o,r?.recordInputs),...nP("request")},p=!!C()?.getDataCollectionOptions().userInfo,u=Ay(a,p);return{name:c,op:hy,forceTransaction:!0,attributes:u}}function Ny(e){if(e.recordInputs!==void 0&&e.recordOutputs!==void 0)return{recordInputs:e.recordInputs,recordOutputs:e.recordOutputs};let t=C()?.getDataCollectionOptions().genAI;return{recordInputs:e.recordInputs??t?.inputs??!1,recordOutputs:e.recordOutputs??t?.outputs??!1}}function aP(e,t){e.onmessage&&Pt(e,"onmessage",n=>function(r,i){let o=xx(r)?r:void 0,s=yy(r)?r:void 0,c=o||s,a;if(c)try{a=o?.method==="initialize"?Vx(o):Yx(c),(a.protocolVersion||a.clientInfo)&&wd(e,a)}catch{}if(o){let l=Ny(t),p=J().clone();return tr(p,()=>{let u=sP(o,e,i,l),d=k(u);return o.method==="initialize"&&a&&d.setAttributes({...Xx(a.clientInfo),...a.protocolVersion&&{[Pa]:a.protocolVersion}}),Qx(e,o.id,d,o.method,l),se(d,()=>n.call(this,o,i))})}if(s){let l=Ny(t);return iP(s,e,i,l,()=>n.call(this,s,i))}return n.call(this,r,i)})}function cP(e,t){e.send&&Pt(e,"send",n=>async function(...r){let[i]=r;if(yy(i)){let o=Ny(t);return oP(i,e,o,()=>n.call(this,...r))}return Px(i)&&i.id!==null&&i.id!==void 0&&(i.error&&I3(i.error),Jx(e,i.id,i.result,!!i.error)),n.call(this,...r)})}function lP(e){e.onclose&&Pt(e,"onclose",t=>function(...n){return $x(e),Bx(e),t.call(this,...n)})}function pP(e){e.onerror&&Pt(e,"onerror",t=>function(n){return A3(n),t.call(this,n)})}function I3(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}`,vi(r,"protocol")}}}catch{}}function A3(e){try{vi(e,"transport")}catch{}}var uP=new WeakSet;function vy(e,t){if(uP.has(e)||!kx(e))return e;let n=e,r={...t};return Pt(n,"connect",i=>async function(o,...s){let c=await i.call(this,o,...s);return aP(o,r),cP(o,r),lP(o),pP(o),c}),lx(n),px(n),uP.add(e),e}function fP(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 gP(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let o=i.match(r);if(o)return{filename:`<data:${o[2]}>`,function:o[1]};let s=i.match(n);if(s){let c,a,l,p,u;if(s[1]){l=s[1];let h=l.lastIndexOf(".");if(l[h-1]==="."&&h--,h>0){c=l.slice(0,h),a=l.slice(h+1);let b=c.indexOf(".Module");b>0&&(l=l.slice(b+1),c=c.slice(0,b))}p=void 0}a&&(p=c,u=a),a==="<anonymous>"&&(u=void 0,l=void 0),l===void 0&&(u=u||"?",l=p?`${p}.${u}`:u);let d=cv(s[2]),m=s[5]==="native";!d&&s[5]&&!m&&(d=s[5]);let _=d?N3(d):void 0;return{filename:_??d,module:_&&e?.(_),function:l,lineno:dP(s[3]),colno:dP(s[4]),in_app:fP(d||"",m)}}if(i.match(t))return{filename:i}}}function Ry(e){return[90,gP(e)]}function dP(e){return parseInt(e||"",10)||void 0}function N3(e){try{return decodeURI(e)}catch{return}}var Dd=new WeakMap,_P=(e,t)=>{let n=Dd.get(e);n?n.push(t):Dd.set(e,[t])},Gl=e=>{let t=Dd.get(e);return t||(t=[],Dd.set(e,t)),t};var rs="express.name",hP="http.route",is="express.type",Bd="router",bP="middleware",yP="request_handler";var Oy=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function v3(e){return e.includes(":")||e.includes("*")}var EP=(e,t,n)=>{if(t.name==="router"){let r=TP("",t),i=r||n||e||"/";return{attributes:{[rs]:i,[is]:Bd},name:`router - ${i}`}}else return t.name==="bound dispatch"||t.name==="handle"?{attributes:{[rs]:(e||n)??"request handler",[is]:yP},name:`request handler${t.path?` - ${e||n}`:""}`}:{attributes:{[rs]:t.name,[is]:bP},name:`middleware - ${t.name}`}},TP=(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)?TP(e,n):e},IP=(e,t,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(t))return!0;if(!Array.isArray(n?.ignoreLayers))return!1;try{return mn(e,n.ignoreLayers,!0)}catch{}return!1};function AP(e,t){let n=Gl(e);if(n.length===0)return;if(n.every(o=>o==="/"))return e.originalUrl==="/"?"/":void 0;if(t==="*"||t.includes("/")&&(t.includes(",")||t.includes("\\")||t.includes("*")||t.includes("[")))return t;let r=t.startsWith("/")?t:`/${t}`;return r.length>0&&(e.originalUrl===r||e.originalUrl.startsWith(r)||v3(r))?r:void 0}function NP(e){let t=Gl(e),n="";for(let r of t)r==="/"||r==="/*"||(n+=!n||n.endsWith("/")?r:`/${r}`);return n.replace(/\/{2,}/g,"/")}var Hd=e=>{let t=e[0];return Array.isArray(t)?t.map(n=>SP(n)||"").join(","):SP(t)},SP=e=>typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0,Fd=e=>vP(e?.Router?.prototype),vP=e=>(typeof e=="object"||typeof e=="function")&&!!e&&"route"in e&&typeof e.route=="function",RP=e=>vP(e.Router)&&!Fd(e);function R3(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function OP(e){return R3(e)>=500}function Ul(e){if(!J()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let n=$o(e);J().setSDKProcessingMetadata({normalizedRequest:n})}}function Wd(e,t,n){if(!t?.handle)return;let r=t,i=r.handle;if(Ar(i)||i.length===4)return;function o(s,c,...a){let l=e();Ul(s);let p=Q();if(!p)return i.apply(this,[s,c,...a]);n&&_P(s,n);let u=Gl(s),d=!!n,m=NP(s),_=AP(s,m);l.onRouteResolved?.(_);let h=EP(m,r,n),b=h.attributes[rs],R=h.attributes[is],M=Object.assign(h.attributes,{[S]:"auto.http.express",[H]:`${R}.express`});if(_&&(M[hP]=_),IP(h.attributes[rs],R,l))return d&&u.pop(),i.apply(this,[s,c,...a]);let v=J();if(v!==vt()){if(R==="request_handler"){let N=s.method?s.method.toUpperCase():"GET";v.setTransactionName(`${N} ${m}`)}}else E&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName");return ke({name:b,attributes:M},N=>{let P=!1;h.attributes[is]===Bd&&(N.end(),P=!0);let D=()=>{P||(P=!0,N.end())};for(let I=0;I<a.length;I++){let F=a[I];if(typeof F=="function"){a[I]=function(...L){let G=L[0],ce=!!G&&G!=="route"&&G!=="router";if(!P&&ce){let[ge,Ne]=Oy(G);N.setStatus({code:2,message:Ne})}return P||(P=!0,c.removeListener("finish",D),N.end()),!(s.route&&ce)&&d&&u.pop(),se(p,()=>F.apply(this,L))};break}}try{return i.apply(this,[s,c,...a])}catch(I){let[F,L]=Oy(I);throw N.setStatus({code:2,message:L}),I}finally{P||c.once("finish",D)}})}for(let s in i)s in o||Object.defineProperty(o,s,{get(){return i[s]},set(c){i[s]=c}});Lo(o,i),Object.defineProperty(r,"handle",{enumerable:!0,configurable:!0,writable:!0,value:o})}function Vd(e){return!!e&&typeof e=="object"&&"default"in e&&e.default||e}function O3(e){return!!e.express}var CP=!1;function C3(){CP||(CP=!0,E&&g.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function Cy(e,t){let n,r;if(!t&&O3(e)){let{express:p,...u}=e;r=p,n=()=>u,C3()}else{if(typeof t!="function")throw new TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");n=t,r=e}let i=Vd(r),o=Fd(i)?i.Router.prototype:RP(i)?i.Router:void 0;if(!o)throw new TypeError("no valid Express route function to instrument");let s=o.route;try{Ls(o,"route",function(...u){let d=s.apply(this,u),m=this.stack[this.stack.length-1];return Wd(n,m,Hd(u)),d})}catch(p){E&&g.error("Failed to patch express route method:",p)}let c=o.use;try{Ls(o,"use",function(...u){let d=c.apply(this,u),m=this.stack[this.stack.length-1];return m&&Wd(n,m,Hd(u)),d})}catch(p){E&&g.error("Failed to patch express use method:",p)}let{application:a}=i,l=a.use;try{Ls(a,"use",function(...u){let d=l.apply(this,u),m=Fd(i)?this.router:this._router;if(m){let _=m.stack[m.stack.length-1];_&&Wd(n,_,Hd(u))}return d})}catch(p){E&&g.error("Failed to patch express application.use method:",p)}return i}function x3(){return C()?.getIntegrationByName("Express")?.getShouldHandleError?.()}function xy(e){return function(n,r,i,o){Ul(r);let s=e?.shouldHandleError??x3()??OP;if(s===!1){o(n);return}if(s(n)){let c=me(n,{mechanism:{type:"auto.middleware.express",handled:!1}});i.sentry=c}o(n)}}function Py(e,t){e.use(P3()),e.use(xy(t))}function P3(){return function(t,n,r){Ul(t),r()}}var k3=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,Yd=Symbol("sentryPostgresConnectionContext"),ky=Symbol.for("sentry.instrumented.postgresjs"),L3=Symbol.for("sentry.query.from.instrumented.sql");function wy(e,t){return!e||typeof e!="function"?(E&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),e):My(e,{requireParentSpan:!0,...t})}function My(e,t,n){if(e[ky])return e;let r=new Proxy(e,{apply(i,o,s){let c=Reflect.apply(i,o,s);return B(c)&&"handle"in c&&xP(c,r,t),c},get(i,o){let s=i[o];return typeof o!="string"||typeof s!="function"?s:o==="unsafe"||o==="file"?M3(s,i,r,t):o==="begin"||o==="reserve"?w3(s,i,r,t):s}});return n?r[Yd]=n:U3(e,r),e[ky]=!0,r[ky]=!0,r}function M3(e,t,n,r){return function(...i){let o=Reflect.apply(e,t,i);return B(o)&&"handle"in o&&xP(o,n,r),o}}function w3(e,t,n,r){return function(...i){let o=n[Yd];if(!(typeof i[i.length-1]=="function")){let p=Reflect.apply(e,t,i);return p&&typeof p.then=="function"?p.then(u=>My(u,r,o)):p}let c=i.length===1?i[0]:i[1],a=function(p){let u=My(p,r,o);return c(u)},l=i.length===1?[a]:[i[0],a];return Reflect.apply(e,t,l)}}function xP(e,t,n){if(e.handle?.__sentryWrapped)return;e[L3]=!0;let r=e.handle,i=async function(...o){if(this.executed||!G3(n))return r.apply(this,o);let s=jd(e.strings),c=La(s);return ke({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[Yd]:void 0;if(Zd(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{ka(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"),ka(a,c),a.end()}catch(_){E&&g.error("Error ending span in reject callback:",_)}return Reflect.apply(u,d,m)}});try{return r.apply(this,o)}catch(u){throw a.setStatus({code:2,message:u instanceof Error?u.message:"unknown_error"}),a.end(),u}})};i.__sentryWrapped=!0,e.handle=i}function G3(e){return Q()!==void 0||!e.requireParentSpan}function jd(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((t,n,r)=>r===0?n:`${t}$${r}${n}`,"")}var Ly;function La(e){return e?(Ly||(Ly=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(Ly,"?").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 Zd(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 ka(e,t,n){if(n){e.setAttribute("db.operation.name",n);return}let r=t?.match(k3);r?.[1]&&e.setAttribute("db.operation.name",r[1].toUpperCase())}function Xd(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 U3(e,t){let n=e;!n.options||typeof n.options!="object"||(t[Yd]=Xd(n.options))}var qr="@sentry/instrumentation-http",Qr="http.client.request.created",Ma="http.server.request.start";function Kd(e){let t=e.host||"",n=/^(.*):(\d+)$/.exec(t),r=n?n[1]:t,i=e.port??(n?Number(n[2]):void 0);return{method:e.method,port:i,protocol:e.protocol,host:e.host,hostname:r,path:e.path,headers:e.getHeaders()}}function Gy(e){try{return String(PP(e))}catch{return""}}function PP(e){let t=e.protocol||"http:",r=e.headers?.host&&String(e.headers?.host)||e.hostname||e.host||"",i=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(r)?"":`:${e.port}`,o=e.path?e.path:"/",s=`${t}//${r}${i}`;return new URL(o.startsWith("//")?`${s}${o}`:o,s)}function mr(e){return String(Gy(Kd(e)))}function kP(e,t){let n=mr(e),r=Qi(n),i=t?.statusCode,o=Pl(i);rn({category:"http",data:{status_code:i,url:Ji(r),"http.method":e.method||"GET",...r.search?{"http.query":Hn(r.search)}:{},...r.hash?{"http.fragment":r.hash}:{}},type:"http",level:o},{event:"response",request:e,response:t})}function LP(e){let t=mr(e),[n,r]=gb(pr(t),"client","auto.http.client",e),i=e.getHeader("user-agent");return{name:n,attributes:{[H]:"http.client","otel.kind":"CLIENT","http.url":Ot(t),"http.method":e.method,"http.target":Ot(e.path||"/"),"net.peer.name":e.host,"http.host":e.getHeader("host"),...i?{"user_agent.original":i}:{},...r},onlyIfParent:!0}}function MP(e,t){let{statusCode:n,statusMessage:r,httpVersion:i,socket:o}=e,s=i?.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp";t.setAttributes({"http.response.status_code":n,"network.protocol.version":i,"http.flavor":i,"network.transport":s,"net.transport":s,"http.status_text":r?.toUpperCase(),"http.status_code":n,...B3(e),...D3(o)})}function D3(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 B3(e){let{headers:t}=e,n=t["content-length"],r=n?parseInt(String(n),10):-1,i=t["content-encoding"];return r>=0?i&&i!=="identity"?{"http.response_content_length":r}:{"http.response_content_length_uncompressed":r}:{}}function qd(e,t){let n=mr(e),r=C()?.getOptions(),{tracePropagationTargets:i,propagateTraceparent:o}=r??{};if(!Jo(n,i,t)||!!e.getHeader("sentry-trace"))return;let c=$e({propagateTraceparent:o});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c;if(a)try{e.setHeader("sentry-trace",a),E&&g.log(qr,"Added sentry-trace header")}catch(u){E&&g.error(qr,"Failed to set sentry-trace header:",et(u)?u.message:"Unknown error")}if(p&&!e.getHeader("traceparent"))try{e.setHeader("traceparent",p),E&&g.log(qr,"Added traceparent header")}catch(u){E&&g.error(qr,"Failed to set traceparent header:",et(u)?u.message:"Unknown error")}if(l){let u=Ys(e.getHeader("baggage"),l);if(u)try{e.setHeader("baggage",u),E&&g.log(qr,"Added baggage header")}catch(d){E&&g.error(qr,"Failed to set baggage header:",et(d)?d.message:"Unknown error")}}}var wP=e=>typeof e.__unwrap=="function",H3="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",GP=!1,Uy=E?e=>{GP||(wP(e.request)||wP(e.get))&&(GP=!0,g.warn(H3))}:()=>{};function Dl(e){let t=new Ft(100),n=()=>C()?.getOptions(),r=i=>{if(ne().getScopeData().sdkProcessingMetadata[Ks]===!0)return;let o=n(),{errorMonitor:s="error",spans:c=o?Ue(o):!0,propagateTrace:a=!1,breadcrumbs:l=!0,http:p,https:u,suppressOtelWarning:d=!1}=e,{request:m}=i,_=mr(m);if(_b(_,C())||e.ignoreOutgoingRequests?.(_,m))return;let h=!1;function b(D,I){h||(h=!0,kP(D,I))}function R(D){D.on(s,()=>b(D,void 0)),D.prependListener("response",I=>{D.listenerCount("response")<=1&&I.resume(),I.on("end",()=>b(D,I)),I.on(s,()=>b(D,I))})}if(!c){l&&R(m),a&&qd(m,t);return}d||(p&&Uy(p),u&&Uy(u));let M=k(LP(m));e.outgoingRequestHook?.(M,m),a&&(M.isRecording()?se(M,()=>{qd(m,t)}):qd(m,t));let v=!1;function N(D){v||(v=!0,M.setStatus(D),M.end())}let P=()=>N({code:0});m.on("close",P),m.on(s,D=>{E&&g.log(qr,"outgoingRequest on request error()",D),l&&b(m,void 0),N({code:2})}),m.prependListener("response",D=>{m.removeListener("close",P),m.listenerCount("response")<=1&&D.resume(),MP(D,M),gn(D),e.outgoingResponseHook?.(M,D);let I=!1;function F(L){if(!I){I=!0,L&&E&&g.log(qr,"outgoingRequest on response error()",L),l&&b(m,D);let G=D.aborted&&!D.complete,ce=L||typeof D.statusCode!="number"||G?{code:2}:Zt(D.statusCode);e.applyCustomAttributesOnSpan?.(M,m,D),N(ce)}}D.on("end",()=>F()),D.on(s,F)})};return{[Qr]:r}}var UP;function F3(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!="function"||(UP=Dl({...t,http:e})[Qr],Ar(n._storeHeader)))return;let i=n._storeHeader;Ls(n,"_storeHeader",function(...s){try{UP({request:this},Qr)}catch{}return i.apply(this,s)})}function W3(e,t={}){let n=Vd(e);return F3(n,t),e}var Dy=(e,t={})=>W3(e,t);function DP(e,t,n,r){let i=0,o=[];E&&g.log(r,"Patching request.on");let s=new WeakMap,c=yb(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,R)=>{try{let M=R[0],v=Buffer.from(M);i<c?(o.push(v),i+=v.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,R)}});return s.set(d,_),Reflect.apply(a,l,[u,_,...m])}return Reflect.apply(a,l,p)}}),e.off=e.removeListener=new Proxy(e.off,{apply:(a,l,p)=>{let[,u]=p,d=s.get(u);if(d){s.delete(u);let m=p.slice();return m[1]=d,Reflect.apply(a,l,m)}return Reflect.apply(a,l,p)}}),e.on("end",()=>{try{let a=Buffer.concat(o).toString("utf-8");if(a){let p=Buffer.byteLength(a,"utf-8")>c?`${Buffer.from(a).subarray(0,c-3).toString("utf-8")}...`:a;t.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(a){E&&g.error(r,"Error building captured request body",a)}})}catch(a){E&&g.error(r,"Error patching request to capture body",a)}}var By=new WeakMap;function BP(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let i=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&i){E&&g.log(`Recorded request session with status: ${i.status}`);let o=new Date(tt());o.setSeconds(0,0);let s=o.toISOString(),c=By.get(e),a=c?.[s]||{exited:0,crashed:0,errored:0};if(a[{ok:"exited",crashed:"crashed",errored:"errored"}[i.status]]++,c)c[s]=a;else{E&&g.log("Opened new request session aggregate.");let l={[s]:a};By.set(e,l);let p=()=>{clearTimeout(d),u(),By.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);Rn(d)}}})}var HP="Http.Server",V3="Http.SentryServerSpans",FP=new WeakMap,WP=Symbol.for("sentry_http_server_instrumented");function Y3(e){return!e[WP]&&(e[WP]=!0)}function j3(e,t){let n=t.emit,r=FP.get(t);if(n===r)return;let i=new Proxy(n,{apply(o,s,c){let[a,...l]=c;if(a!=="request")return o.apply(s,c);let p=C(),[u,d]=l;if(!p||!Y3(u))return o.apply(s,c);E&&g.log(HP,"Handling incoming request");let m=J().clone();m.setClient(p);let _=u.socket?.remoteAddress,h=u.url||"/",b=$o(u),{maxRequestBodySize:R="medium",ignoreRequestBody:M,sessions:v=!0,sessionFlushingDelayMS:N=6e4}=e;R!=="none"&&!M?.(h,u)&&DP(u,m,R,HP),m.setSDKProcessingMetadata({normalizedRequest:b,ipAddress:_});let P=(u.method||"GET").toUpperCase(),D=ur(h),I=`${P} ${D}`;return m.setTransactionName(I),v&&BP(p,{requestIsolationScope:m,response:d,sessionFlushingDelayMS:N??6e4}),tr(m,()=>{let F=b.headers?.["sentry-trace"],L=b.headers?.baggage,G=Array.isArray(F)?F[0]:F;return In({sentryTrace:G,baggage:Array.isArray(L)?L[0]:L},()=>{let ce=ne().getPropagationContext();ce.propagationSpanId=Yt(),G||(ce.traceId=ht(),ce.sampleRand=at()),d.once("close",()=>{m.setContext("response",{status_code:d.statusCode})});let ge=e.wrapServerEmitRequest,Ne=!1;return ge?ge(u,d,b,()=>{Ne=o.apply(s,c)}):Ne=o.apply(s,c),Ne})})}});FP.set(t,i),t.emit=i}function Hy(e){let t=e.wrapServerEmitRequest,n=Z3(e),r={...e,wrapServerEmitRequest(o,s,c,a){let l=C()?.getOptions();e.spans??(l?Ue(l):!1)?n(o,s,c,a):t?t(o,s,c,a):a()}},i=o=>{let{server:s}=o;j3(r,s)};return{[Ma]:i}}function Z3(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:i,errorMonitor:o="error",onSpanEnd:s}=e;return(c,a,l,p)=>{if(typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__)return p();return t?t(c,a,l,u):u();function u(){let m=J().getClient();if(!m)return p();if(X3(c,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return E&&g.log(V3,"Skipping span creation for incoming request",c.url),p();let _=l.url||c.url||"/",h=pr(_),b=h?h.pathname:ur(_),R=(c.method||"GET").toUpperCase(),M=`${R} ${b}`,v=c.headers,N=v["user-agent"],P=v["x-forwarded-for"],D=c.httpVersion,I=v.host,F=I?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",L=_.startsWith("https")?"https":"http",{socket:G}=c,{localAddress:ce,localPort:ge,remoteAddress:Ne,remotePort:Te}=G??{};return ke({name:M,kind:U.SERVER,attributes:{[H]:"http.server",[S]:"auto.http.server",[ve]:"url","http.route":b,"otel.kind":"SERVER","net.host.ip":ce,"net.host.port":ge,"net.peer.ip":Ne,"net.peer.port":Te,"sentry.http.prefetch":K3(c)||void 0,[lt]:h&&!lr(h)?Ot(h.href,m):void 0,[Ki]:h?.pathname??b,[Ei]:Ot(_,m),"http.method":R,"http.target":Ot(h?`${h.pathname}${h.search}`:b,m),"http.host":I,"net.host.name":F,"http.client_ip":typeof P=="string"?P.split(",")[0]:void 0,"http.user_agent":N,"http.scheme":L,"http.flavor":D,"net.transport":D?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...q3(c),...Fr(l.headers||{},m.getDataCollectionOptions())}},Ce=>{i?.(Ce,c,a);let qe=!1;function At(yn){qe||(qe=!0,Ce.setAttributes({"http.status_text":a.statusMessage?.toUpperCase(),"http.response.status_code":a.statusCode,"http.status_code":a.statusCode,...Fr(Vu(a.headers),m?.getDataCollectionOptions()??!1,"response")}),Ce.setStatus(yn),s?.(Ce,c,a),Ce.end())}a.once("close",()=>{At(Zt(a.statusCode))}),a.once(o,()=>{let yn=Zt(a.statusCode);At(yn.code===2?yn:{code:2})}),p()})}}}function X3(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,i=e.method?.toUpperCase();return!!(i==="OPTIONS"||i==="HEAD"||!r||t&&i==="GET"&&VP(r)||n?.(r,e))}function VP(e){let t=ur(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 K3(e){return e.headers["next-router-prefetch"]==="1"}function q3(e){let{headers:t}=e,n=t["content-length"],r=n?parseInt(String(n),10):-1,i=t["content-encoding"];return r>=0?i&&i!=="identity"?{"http.request_content_length":r}:{"http.request_content_length_uncompressed":r}:{}}st();import{subscribe as Q3}from"diagnostics_channel";var We=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var YP=ko("sentry_http_server_instrumented"),J3="Http.Server";function jP(e,t){we(e,"_startSpanCallback",new WeakRef(t))}var $3=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??"medium",spans:!1,ignoreRequestBody:e.ignoreRequestBody,wrapServerEmitRequest(n,r,i,o){let s=C();if(!s||pe.active().getValue(YP))return o();let c=pi.extract(pe.active(),i.headers).setValue(YP,!0);pe.with(c,()=>{s.emit("httpServerRequest",n,r,i);let a=n._startSpanCallback?.deref();a?a(()=>(o(),!0)):o()})}};return{name:J3,setupOnce(){let{[Ma]:n}=Hy(t);Q3(Ma,n)},afterAllSetup(n){We&&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`.")}}}),wa=$3;st();import{errorMonitor as z3}from"events";var ZP="Http.ServerSpans",ej=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,r=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:i}=e,{requestHook:o,responseHook:s,applyCustomAttributesOnSpan:c}=e.instrumentation??{};return{name:ZP,setup(a){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||a.on("httpServerRequest",(l,p,u)=>{let d=l,m=p;jP(d,h=>{if(rj(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return We&&g.log(ZP,"Skipping span creation for incoming request",d.url),h();let b=u.url||d.url||"/",R=pr(b),M=d.headers,v=M["user-agent"],N=M["x-forwarded-for"],P=d.httpVersion,D=M.host,I=D?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",F=b.startsWith("https")?"https":"http",L=u.method||d.method?.toUpperCase()||"GET",G=R?R.pathname:ur(b),ce=`${L} ${G}`,ge=k({name:ce,kind:U.SERVER,attributes:{[H]:"http.server",[S]:"auto.http.otel.http",[_0]:tj(d)||void 0,[lt]:R&&!lr(R)?Ot(R.href,a):void 0,[Ki]:R?.pathname??G,[Ei]:Ot(b,a),[Ur]:u.method,[xu]:Ot(R?`${R.pathname}${R.search}`:G,a),[n0]:D,[p0]:I,[e0]:typeof N=="string"?N.split(",")[0]:void 0,[i0]:v,[r0]:F,[t0]:P,[oa]:P?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...ij(d),...Fr(u.headers||{},a.getDataCollectionOptions())}});o?.(ge,d),s?.(ge,m),c?.(ge,d,m),i?.(ge,d,m);let Ne={type:__.HTTP,span:ge};return se(ge,()=>pe.with(nv(pe.active(),Ne),()=>{gn(d),gn(m);let Te=!1;function Ce(qe){if(Te)return;Te=!0;let At=aj(d,m,Ne);ge.setAttributes(At),ge.setStatus(qe),ge.end();let yn=At["http.route"];yn&&J().setTransactionName(`${d.method?.toUpperCase()||"GET"} ${yn}`)}return m.on("close",()=>{Ce(Zt(m.statusCode))}),m.on(z3,()=>{let qe=Zt(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(cj(l,r))return We&&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){We&&(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."))}}}),Ga=ej;function tj(e){return e.headers["next-router-prefetch"]==="1"}function nj(e){let t=ur(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 rj(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(Pr())return!0;let r=e.url,i=e.method?.toUpperCase();return!!(i==="OPTIONS"||i==="HEAD"||!r||t&&i==="GET"&&nj(r)||n?.(r,e))}function ij(e){let t=oj(e.headers);return t==null?{}:sj(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function oj(e){let t=e["content-length"];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function sj(e){let t=e["content-encoding"];return!!t&&t!=="identity"}function aj(e,t,n){let{socket:r}=e,{statusCode:i,statusMessage:o}=t,s={[_n]:i,[Si]:i,"http.status_text":o?.toUpperCase()};if(r){let{localAddress:c,localPort:a,remoteAddress:l,remotePort:p}=r;s[l0]=c,s[u0]=a,s[d0]=l,s[xe]=p}if(s[Si]=i,s["http.status_text"]=(o||"").toUpperCase(),n?.type===__.HTTP&&n.route!==void 0){let c=n.route;s[He]=c}return s}function cj(e,t){return t.some(n=>{if(typeof n=="number")return n===e;let[r,i]=n;return e>=r&&e<=i})}st();import{subscribe as nZ,unsubscribe as rZ}from"diagnostics_channel";st();var Bl=class{emit(t){}enabled(){return!1}},XP=new Bl;var Hl=Symbol.for("io.opentelemetry.js.api.logs"),Ua=globalThis;function KP(e,t,n){return r=>r===e?t:n}var Fy=1;var Wy=class{getLogger(t,n,r){return new Bl}},Qd=new Wy;var Jd=class{constructor(t,n,r,i){this._provider=t,this.name=n,this.version=r,this.options=i}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):XP}};var Fl=class{getLogger(t,n,r){var i;return(i=this._getDelegateLogger(t,n,r))!==null&&i!==void 0?i:new Jd(this,t,n,r)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Qd}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(t,n,r)}};var $d=class e{constructor(){this._proxyLoggerProvider=new Fl}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return Ua[Hl]?this.getLoggerProvider():(Ua[Hl]=KP(Fy,t,Qd),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,n;return(n=(t=Ua[Hl])===null||t===void 0?void 0:t.call(Ua,Fy))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(t,n,r){return this.getLoggerProvider().getLogger(t,n,r)}disable(){delete Ua[Hl],this._proxyLoggerProvider=new Fl}};var zd=$d.getInstance();function qP(e,t,n,r){for(let i=0,o=e.length;i<o;i++){let s=e[i];t&&s.setTracerProvider(t),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}}function QP(e){e.forEach(t=>t.disable())}function Da(e){let t=e.tracerProvider||he.getTracerProvider(),n=e.meterProvider||zp.getMeterProvider(),r=e.loggerProvider||zd.getLoggerProvider(),i=e.instrumentations?.flat()??[];return qP(i,t,n,r),()=>{QP(i)}}import*as Ri from"path";import{types as Sk}from"util";st();var tk=/^(?: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-]+)*))?$/,lj=/^(?<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-]+)*))?$/,pj={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function nk(e,t,n){if(!uj(e))return tn.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,"$1");let r=gj(e);if(!r)return!1;let i=[],o=rk(r,t,i,n);return o&&!n?.includePrerelease?mj(r,i):o}function uj(e){return typeof e=="string"&&tk.test(e)}function rk(e,t,n,r){if(t.includes("||")){let i=t.trim().split("||");for(let o of i)if(Vy(e,o,n,r))return!0;return!1}else if(t.includes(" - "))t=Gj(t,r);else if(t.includes(" ")){let i=t.trim().replace(/\s{2,}/g," ").split(" ");for(let o of i)if(!Vy(e,o,n,r))return!1;return!0}return Vy(e,t,n,r)}function Vy(e,t,n,r){if(t=fj(t,r),t.includes(" "))return rk(e,t,n,r);{let i=_j(t);return n.push(i),dj(e,i)}}function dj(e,t){if(t.invalid)return!1;if(!t.version||jy(t.version))return!0;let n=$P(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],i=t.prereleaseSegments||[];!r.length&&!i.length?n=0:!r.length&&i.length?n=1:r.length&&!i.length?n=-1:n=$P(r,i)}return pj[t.op]?.includes(n)}function mj(e,t){return e.prerelease?t.some(n=>n.prerelease&&n.version===e.version):!0}function fj(e,t){return e=e.trim(),e=Mj(e,t),e=Lj(e),e=wj(e,t),e=e.trim(),e}function an(e){return!e||e.toLowerCase()==="x"||e==="*"}function gj(e){let t=e.match(tk);if(!t){tn.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,i=t.groups.build,o=n.split("."),s=r?.split(".");return{op:void 0,version:n,versionSegments:o,versionSegmentCount:o.length,prerelease:r,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:i}}function _j(e){if(!e)return{};let t=e.match(lj);if(!t)return tn.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,i=t.groups.prerelease,o=t.groups.build,s=r.split("."),c=i?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:s,versionSegmentCount:s.length,prerelease:i,prereleaseSegments:c,prereleaseSegmentCount:c?c.length:0,build:o}}function jy(e){return e==="*"||e==="x"||e==="X"}function JP(e){let t=parseInt(e,10);return isNaN(t)?e:t}function hj(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 bj(e,t){if(jy(e)||jy(t))return 0;let[n,r]=hj(JP(e),JP(t));return n>r?1:n<r?-1:0}function $P(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=bj(e[n]||"0",t[n]||"0");if(r!==0)return r}return 0}var ik="[a-zA-Z0-9-]",ok="0|[1-9]\\d*",yj=`\\d*[a-zA-Z-]${ik}*`,Sj="((?:<|>)?=?)",zP=`(?:${ok}|${yj})`,Ej=`(?:-(${zP}(?:\\.${zP})*))`,ek=`${ik}+`,Tj=`(?:\\+(${ek}(?:\\.${ek})*))`,Yy=`${ok}|x|X|\\*`,Wl=`[v=\\s]*(${Yy})(?:\\.(${Yy})(?:\\.(${Yy})(?:${Ej})?${Tj}?)?)?`,Ij=`^${Sj}\\s*${Wl}$`,Aj=new RegExp(Ij),Nj=`^\\s*(${Wl})\\s+-\\s+(${Wl})\\s*$`,vj=new RegExp(Nj),Rj="(?:~>?)",Oj=`^${Rj}${Wl}$`,Cj=new RegExp(Oj),xj="(?:\\^)",Pj=`^${xj}${Wl}$`,kj=new RegExp(Pj);function Lj(e){let t=Cj;return e.replace(t,(n,r,i,o,s)=>{let c;return an(r)?c="":an(i)?c=`>=${r}.0.0 <${+r+1}.0.0-0`:an(o)?c=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:s?c=`>=${r}.${i}.${o}-${s} <${r}.${+i+1}.0-0`:c=`>=${r}.${i}.${o} <${r}.${+i+1}.0-0`,c})}function Mj(e,t){let n=kj,r=t?.includePrerelease?"-0":"";return e.replace(n,(i,o,s,c,a)=>{let l;return an(o)?l="":an(s)?l=`>=${o}.0.0${r} <${+o+1}.0.0-0`:an(c)?o==="0"?l=`>=${o}.${s}.0${r} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.0${r} <${+o+1}.0.0-0`:a?o==="0"?s==="0"?l=`>=${o}.${s}.${c}-${a} <${o}.${s}.${+c+1}-0`:l=`>=${o}.${s}.${c}-${a} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.${c}-${a} <${+o+1}.0.0-0`:o==="0"?s==="0"?l=`>=${o}.${s}.${c}${r} <${o}.${s}.${+c+1}-0`:l=`>=${o}.${s}.${c}${r} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.${c} <${+o+1}.0.0-0`,l})}function wj(e,t){let n=Aj;return e.replace(n,(r,i,o,s,c,a)=>{let l=an(o),p=l||an(s),u=p||an(c),d=u;return i==="="&&d&&(i=""),a=t?.includePrerelease?"-0":"",l?i===">"||i==="<"?r="<0.0.0-0":r="*":i&&d?(p&&(s=0),c=0,i===">"?(i=">=",p?(o=+o+1,s=0,c=0):(s=+s+1,c=0)):i==="<="&&(i="<",p?o=+o+1:s=+s+1),i==="<"&&(a="-0"),r=`${i+o}.${s}.${c}${a}`):p?r=`>=${o}.0.0${a} <${+o+1}.0.0-0`:u&&(r=`>=${o}.${s}.0${a} <${o}.${+s+1}.0-0`),r})}function Gj(e,t){let n=vj;return e.replace(n,(r,i,o,s,c,a,l,p,u,d,m,_)=>(an(o)?i="":an(s)?i=`>=${o}.0.0${t?.includePrerelease?"-0":""}`:an(c)?i=`>=${o}.${s}.0${t?.includePrerelease?"-0":""}`:a?i=`>=${i}`:i=`>=${i}${t?.includePrerelease?"-0":""}`,an(u)?p="":an(d)?p=`<${+u+1}.0.0-0`:an(m)?p=`<${u}.${+d+1}.0-0`:_?p=`<=${u}.${d}.${m}-${_}`:t?.includePrerelease?p=`<${u}.${d}.${+m+1}-0`:p=`<=${p}`,`${i} ${p}`.trim()))}var cn=console.error.bind(console);function Vl(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 os=(e,t,n)=>{if(!e||!e[t]){cn("no original function "+String(t)+" to wrap");return}if(!n){cn("no wrapper function"),cn(new Error().stack);return}let r=e[t];if(typeof r!="function"||typeof n!="function"){cn("original object and wrapper must be functions");return}let i=n(r,t);return Vl(i,"__original",r),Vl(i,"__unwrap",()=>{e[t]===i&&Vl(e,t,r)}),Vl(i,"__wrapped",!0),Vl(e,t,i),i},Zy=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{cn("must provide one or more modules to patch"),cn(new Error().stack);return}if(!(t&&Array.isArray(t))){cn("must provide one or more functions to wrap on modules");return}e.forEach(r=>{t.forEach(i=>{os(r,i,n)})})},Ba=(e,t)=>{if(!e||!e[t]){cn("no function to unwrap."),cn(new Error().stack);return}let n=e[t];if(!n.__unwrap)cn("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{n.__unwrap();return}},Xy=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{cn("must provide one or more modules to patch"),cn(new Error().stack);return}if(!(t&&Array.isArray(t))){cn("must provide one or more functions to unwrap on modules");return}e.forEach(n=>{t.forEach(r=>{Ba(n,r)})})};function Yl(e){e&&e.logger&&(typeof e.logger!="function"?cn("new logger isn't a function, not replacing"):cn=e.logger)}Yl.wrap=os;Yl.massWrap=Zy;Yl.unwrap=Ba;Yl.massUnwrap=Xy;st();var em=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,n,r){this.instrumentationName=t,this.instrumentationVersion=n,this.setConfig(r),this._diag=tn.createComponentLogger({namespace:t}),this._tracer=he.getTracer(t,n),this._meter=zp.getMeter(t,n),this._logger=zd.getLogger(t,n),this._updateMetricInstruments()}_wrap=os;_unwrap=Ba;_massWrap=Zy;_massUnwrap=Xy;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,n,r,i){if(t)try{t(r,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},o)}}};var ck=Jp(zy());import*as eS from"path";var nm=class{hooks=[];children=new Map},rm=class{_trie=new nm;_counter=0;insert(t){let n=this._trie;for(let r of t.moduleName.split("/")){let i=n.children.get(r);i||(i=new nm,n.children.set(r,i)),n=i}n.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:n,fullOnly:r}={}){let i=this._trie,o=[],s=!0;for(let c of t.split("/")){let a=i.children.get(c);if(!a){s=!1;break}r||o.push(...a.hooks),i=a}return r&&s&&o.push(...i.hooks),o.length===0?[]:o.length===1?[o[0].hook]:(n&&o.sort((c,a)=>c.insertedId-a.insertedId),o.map(({hook:c})=>c))}};var Fj=["afterEach","after","beforeEach","before","describe","it"].every(e=>typeof global[e]=="function"),im=class e{_moduleNameTrie=new rm;static _instance;constructor(){this._initialize()}_initialize(){new ck.Hook(null,{internals:!0},(t,n,r)=>{let i=Wj(n),o=this._moduleNameTrie.search(i,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:s}of o)t=s(t,n,r);return t})}register(t,n){let r={moduleName:t,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return Fj?new e:this._instance=this._instance??new e}};function Wj(e){return eS.sep!=="/"?e.split(eS.sep).join("/"):e}var Tk=Jp(pS());st();var Ik=Jp(zy());import{readFileSync as tZ}from"fs";function Jr(e,t,n){let r,i;try{i=e()}catch(o){r=o}finally{if(t(r,i),r&&!n)throw r;return i}}function w(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var ae=class extends em{_modules;_hooks=[];_requireInTheMiddleSingleton=im.getInstance();_enabled=!1;constructor(t,n,r){super(t,n,r);let i=this.init();i&&!Array.isArray(i)&&(i=[i]),this._modules=i||[],this._config.enabled&&this.enable()}_wrap=(t,n,r)=>{if(w(t[n])&&this._unwrap(t,n),Sk.isProxy(t)){let i=os(Object.assign({},t),n,r);return Object.defineProperty(t,n,{value:i}),i}else return os(t,n,r)};_unwrap=(t,n)=>Sk.isProxy(t)?Object.defineProperty(t,n,{value:t[n]}):Ba(t,n);_massWrap=(t,n,r)=>{if(t)Array.isArray(t)||(t=[t]);else{tn.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){tn.error("must provide one or more functions to wrap on modules");return}t.forEach(i=>{n.forEach(o=>{this._wrap(i,o,r)})})};_massUnwrap=(t,n)=>{if(t)Array.isArray(t)||(t=[t]);else{tn.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){tn.error("must provide one or more functions to wrap on modules");return}t.forEach(r=>{n.forEach(i=>{this._unwrap(r,i)})})};_warnOnPreloadedModules(){let t=globalThis.require;!t?.resolve||!t?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let i=t.resolve(r);t.cache[i]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(t){try{let n=tZ(Ri.join(t,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{tn.warn("Failed extracting version",t)}}_onRequire(t,n,r,i){if(!i)return typeof t.patch=="function"&&(t.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:t.name}),t.patch(n)):n;let o=this._extractPackageVersion(i);if(t.moduleVersion=o,t.name===r)return Ek(t.supportedVersions,o,t.includePrerelease)&&typeof t.patch=="function"&&(t.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:t.name,version:t.moduleVersion,baseDir:i}),t.patch(n,t.moduleVersion)):n;let s=t.files??[],c=Ri.normalize(r);return s.filter(l=>l.name===c&&Ek(l.supportedVersions,o,t.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:t.name,version:t.moduleVersion,fileName:p.name,baseDir:i}),p.patch(l,t.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let t of this._modules){typeof t.patch=="function"&&t.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:t.name,version:t.moduleVersion}),t.patch(t.moduleExports,t.moduleVersion));for(let n of t.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:t.name,version:t.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,t.moduleVersion))}return}this._warnOnPreloadedModules();for(let t of this._modules){let n=(s,c,a)=>{if(!a&&Ri.isAbsolute(c)){let l=Ri.parse(c);c=l.name,a=l.dir}return this._onRequire(t,s,c,a)},r=(s,c,a)=>this._onRequire(t,s,c,a),i=Ri.isAbsolute(t.name)?new Ik.Hook([t.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(t.name,r);this._hooks.push(i);let o=new Tk.Hook([t.name],{internals:!0},n);this._hooks.push(o)}}}disable(){if(this._enabled){this._enabled=!1;for(let t of this._modules){typeof t.unpatch=="function"&&t.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:t.name,version:t.moduleVersion}),t.unpatch(t.moduleExports,t.moduleVersion));for(let n of t.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:t.name,version:t.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,t.moduleVersion))}}}isEnabled(){return this._enabled}};function Ek(e,t,n){return typeof t>"u"?e.includes("*"):e.some(r=>nk(t,r,{includePrerelease:n}))}var re=class{files;name;supportedVersions;patch;unpatch;constructor(t,n,r,i,o){this.files=o||[],this.name=t,this.supportedVersions=n,this.patch=r,this.unpatch=i}};var zt=Gs(process.versions.node),Ya=zt.major,uS=zt.minor;import{errorMonitor as iZ}from"events";import*as Ak from"http";var oZ=zt.major===22&&zt.minor>=12||zt.major===23&&zt.minor>=2||zt.major>=24;function ss(e={}){let{outgoingRequestApplyCustomAttributes:t,...n}=e,r={propagateTrace:n.propagateTraceInOutgoingRequests??!0,applyCustomAttributesOnSpan:t,...n,spans:n.createSpansForOutgoingRequests!==!1&&(n.spans??!0),ignoreOutgoingRequests(i,o){return Pr()||!!n.ignoreOutgoingRequests?.(i,Kd(o))},outgoingRequestHook(i,o){n.outgoingRequestHook?.(i,o);let s=o.once,c=new Proxy(s,{apply(a,l,p){let[u]=p;if(u!=="response")return a.apply(l,p);let d=pe.active(),m=he.setSpan(d,i);return pe.with(m,()=>a.apply(l,p))}});o.once=c},outgoingResponseHook(i,o){n.outgoingResponseHook?.(i,o)},errorMonitor:iZ,http:Ak};oZ?sZ(r):aZ(r)}var dS;function sZ(e){let{[Qr]:t}=Dl(e);dS&&rZ(Qr,dS),nZ(Qr,t),dS=t}function aZ(e){Dy(Ak,e)}var Nk="Http";Object.assign(ss,{id:`${Nk}.sentry`});var vk=(e={})=>{let t=e.spans??!1,n=e.disableIncomingRequestSpans??!1,r=t&&!n,i={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},o={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes},s={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests,spans:t},c=wa(i),a=Ga(o);return{name:Nk,setup(l){r&&a.setup(l)},setupOnce(){c.setupOnce(),ss(s)},processEvent(l){return a.processEvent(l)}}};import*as sm from"diagnostics_channel";import{URL as mZ}from"url";var mS="sentry-trace",om="baggage",cZ="traceparent";function _S(e,t,n){let r=Ok(e.origin,e.path),{tracePropagationTargets:i,propagateTraceparent:o}=C()?.getOptions()||{};if(!Jo(r,i,t))return;let s=n&&kr(n)&&Q()?void 0:n,c=s?se(s,()=>$e({propagateTraceparent:o})):$e({propagateTraceparent:o});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c,u=Array.isArray(e.headers)?lZ(e.headers):pZ(e.headers);if(fS(u,mS),fS(u,om),o&&fS(u,cZ),!(gS(u,mS)!==-1)){a&&u.push(mS,a),p&&gS(u,"traceparent")===-1&&u.push("traceparent",p);let m=gS(u,om);if(l&&m===-1)u.push(om,l);else if(l){let _=u[m+1],h=Ys(_,l);h&&(u[m+1]=h)}}Array.isArray(e.headers)?e.headers.splice(0,e.headers.length,...u):e.headers=uZ(u)}function lZ(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 pZ(e){let t=e.split(`\r
22
+ `),n=[];for(let r of t)try{let i=r.indexOf(":");if(i===-1)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&n.push(o,s)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function uZ(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];!r||i==null||t.push(`${r}: ${i}`)}return t.length?t.join(`\r
23
+ `).concat(`\r
24
+ `):""}function fS(e,t){let n=-1;for(let r=0;r<e.length;r+=2){if(e[r]!==t)continue;if(n===-1){n=r;continue}let i=e[n+1];if(t===om&&i){let o=Ys(e[r+1],i);o&&(e[n+1]=o)}e.splice(r,2),r-=2}}function gS(e,t){return e.findIndex((n,r)=>r%2===0&&n===t)}function Rk(e,t){let n=dZ(e),r=t.statusCode,i=Pl(r);rn({category:"http",data:{status_code:r,...n},type:"http",level:i},{event:"response",request:e,response:t})}function dZ(e){try{let t=Ok(e.origin,e.path),n=Qi(t),r={url:Ji(n),"http.method":e.method||"GET"};return n.search&&(r["http.query"]=Hn(n.search)),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function Ok(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 fZ="http.request.method_original",hS=[],as=new WeakMap,xk=new WeakMap,Ck=new Ft(100);function Kl(e={}){hS.length||(Xl("undici:request:create",t=>gZ(e,t)),Xl("undici:client:sendHeaders",t=>_Z(e,t)),Xl("undici:request:headers",t=>hZ(e,t)),Xl("undici:request:trailers",t=>bZ(t)),Xl("undici:request:error",t=>yZ(t)))}function bS(e,t){try{return e()}catch(n){t(n);return}}function Xl(e,t){let[n=0,r=0]=process.version.replace("v","").split(".").map(o=>Number(o));n>18||n===18&&r>=19?hS.push(sm.subscribe?.(e,t)):hS.push(sm.channel(e).subscribe(t))}function Pk(e){let t=new Map;if(Array.isArray(e.headers))for(let n=0;n<e.headers.length;n+=2){let r=e.headers[n],i=e.headers[n+1];typeof r=="string"&&i!==void 0&&t.set(r.toLowerCase(),i)}else if(typeof e.headers=="string"){let n=e.headers.split(`\r
25
+ `);for(let r of n){if(!r)continue;let i=r.indexOf(":");if(i===-1)continue;let o=r.substring(0,i).toLowerCase(),s=r.substring(i+1).trim(),c=t.get(o);c&&Array.isArray(c)?c.push(s):c?t.set(o,[c,s]):t.set(o,s)}}return t}function gZ(e,{request:t}){let n=EZ(t.origin,t.path),r=bS(()=>!!e.ignoreOutgoingRequests?.(n),b=>b&&We&&g.error("caught ignoreOutgoingRequests error: ",b)),i=Pr()||!!r;if(xk.set(t,i),!e.spans){e.tracePropagation!==!1&&!i&&_S(t,Ck);return}if(t.method==="CONNECT"||r)return;let o;try{o=new mZ(t.path,t.origin)}catch(b){We&&g.warn("could not determine url.full:",b);return}let s=o.protocol.replace(":",""),c=SZ(t.method),a={[Dr]:c,[fZ]:t.method,[lt]:Ot(o.toString()),[Ki]:o.pathname,[Lu]:Hn(o.search),[A0]:s,[S]:"auto.http.otel.node_fetch"};if(n.startsWith("data:")){let b=il(n);a["http.url"]=b,a[lt]=b,a[fn]=`${t.method||"GET"} ${b}`}let l={https:"443",http:"80"},p=o.hostname,u=o.port||l[s];a[ft]=p,u&&!isNaN(Number(u))&&(a[gt]=Number(u));let m=Pk(t).get("user-agent");if(m){let b=Array.isArray(m)?m[m.length-1]:m;a[N0]=b}let _=C(),h=k({name:c==="_OTHER"?"HTTP":c,kind:U.CLIENT,attributes:a,onlyIfParent:!_||!rt(_)});bS(()=>e.requestHook?.(h,t),b=>b&&We&&g.error("caught requestHook error: ",b)),_S(t,Ck,h),as.set(t,h)}function _Z(e,{request:t,socket:n}){let r=as.get(t);if(!r)return;let{remoteAddress:i,remotePort:o}=n,s={[s0]:i,[a0]:o};if(e.headersToSpanAttributes?.requestHeaders){let c=new Set(e.headersToSpanAttributes.requestHeaders.map(l=>l.toLowerCase())),a=Pk(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 hZ(e,{request:t,response:n}){e.breadcrumbs!==!1&&!xk.get(t)&&Rk(t,n);let i=as.get(t);if(!i)return;let o={[_n]:n.statusCode};if(bS(()=>e.responseHook?.(i,{request:t,response:n}),s=>s&&We&&g.error("caught responseHook error: ",s)),e.headersToSpanAttributes?.responseHeaders){let s=new Set;e.headersToSpanAttributes?.responseHeaders.forEach(c=>s.add(c.toLowerCase()));for(let c=0;c<n.headers.length;c=c+2){let a=n.headers[c],l=n.headers[c+1];if(a===void 0||l===void 0)continue;let p=a.toString().toLowerCase(),u=l;if(s.has(p)){let d=`http.response.header.${p}`;Object.prototype.hasOwnProperty.call(o,d)?o[d].push(u.toString()):o[d]=[u.toString()]}}}i.setAttributes(o),n.statusCode>=400&&i.setStatus(Zt(n.statusCode))}function bZ({request:e}){let t=as.get(e);t&&(t.end(),as.delete(e))}function yZ({request:e,error:t}){let n=as.get(e);n&&(n.setStatus({code:2,message:t.message}),n.end(),as.delete(e))}function SZ(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 EZ(e,t="/"){let n=`${e}`;return n.endsWith("/")&&t.startsWith("/")?`${n}${t.slice(1)}`:!n.endsWith("/")&&!t.startsWith("/")?`${n}/${t}`:`${n}${t}`}var TZ=((e={})=>({name:"NodeFetch",setupOnce(){Kl(e)}})),kk=TZ;st();st();var PS="sentry.parentIsRemote",cs="sentry.graphql.operation";function kS(e){if("parentSpanId"in e)return e.parentSpanId;if("parentSpanContext"in e)return e.parentSpanContext?.spanId}function pm(e){return B(e.attributes)}function Uk(e){return typeof e.kind=="number"}function Dk(e){return!!e.status}function yS(e){return!!e.name}function Bk(e){if(!pm(e))return{};let t=e.attributes[lt]||e.attributes[Ei],n={url:t,"http.method":e.attributes[Dr]||e.attributes[Ur]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof t=="string"){let r=Qi(t);n.url=Ji(r);let i=Hn(r.search);i&&(n["http.query"]=i),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function Hk(e){return Uk(e)?e.kind:Nt.INTERNAL}var am="sentry-trace",SS="baggage",um="sentry.dsc",LS="sentry.sampled_not_recording",Fk="sentry.url",IZ="sentry.sample_rand",AZ="sentry.sample_rate",dm="sentry.ignored",Wk="sentry.segment_ignored",mm=ko("sentry_scopes"),ES=ko("sentry_fork_isolation_scope"),TS=ko("sentry_fork_set_scope"),cm=ko("sentry_fork_set_isolation_scope"),Vk="_scopeContext";function ls(e){return e.getValue(mm)}function Yk(e,t){return e.setValue(mm,t)}function NZ(e,t){we(e,Vk,wo(t))}function ja(e){return Go(e[Vk])}function Za(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(LS)==="1":!1;if(t===Tr.SAMPLED)return!0;if(r)return!1;let i=n?n.get(um):void 0,o=i?nr(i):void 0;if(o?.sampled==="true")return!0;if(o?.sampled==="false")return!1}function jk(e,t){let n=e.spanContext(),r=Re(e),i=Za(n);if(i!==void 0)return i;if(kr(r))return!1;if(!(!Ue(t?.getOptions())||n.isRemote||!Gc(r)))return qt(e)}function Ql(e,t,n){let r=t[Dr]||t[Ur];if(r)return RZ({attributes:t,name:e,kind:n},r);let i=t[ut]||t[Pe],o=typeof t[H]=="string"&&t[H].startsWith("cache.");if(i&&!o)return vZ({attributes:t,name:e});let s=t[ve]==="custom"?"custom":"route";if(t[ku])return{...ql(e,t,"route"),op:"rpc"};if(t[Mt])return{...ql(e,t,s),op:"message"};let l=t[Nu];return l?{...ql(e,t,s),op:l.toString()}:{op:void 0,description:e,source:"custom"}}function Zk(e){let t,n;if(pm(e))t=e.attributes,n=yS(e)?e.name:"<unknown>";else{let i=typeof e.spanContext=="function"?oe(e):void 0;t=i?.data||{},n=yS(e)?e.name:i?.description||"<unknown>"}let r=Hk(e);return Ql(n,t,r)}function vZ({attributes:e,name:t}){let n=e[fn];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[Ve];return{op:"db",description:r?r.toString():t,source:"task"}}function RZ({name:e,kind:t,attributes:n},r){let i=["http"];switch(t){case Nt.CLIENT:i.push("client");break;case Nt.SERVER:i.push("server");break}n["sentry.http.prefetch"]&&i.push("prefetch");let{urlPath:o,url:s,query:c,fragment:a,hasRoute:l}=CZ(n,t);if(!o)return{...ql(e,n),op:i.join(".")};let p=n[cs],u=`${r} ${o}`,d=p?`${u} (${OZ(p)})`:u,m=l||o==="/"?"route":"url",_={};s&&(_.url=Ot(s));let h=Hn(c);h&&(_["http.query"]=h.slice(1)),a&&(_["http.fragment"]=a.slice(1));let b=t===Nt.CLIENT||t===Nt.SERVER,M=!`${n[S]||"manual"}`.startsWith("auto"),v=n[ve]==="custom",N=n[fn],P=!v&&N==null&&(b||!M),{description:D,source:I}=P?{description:d,source:m}:ql(e,n);return{op:i.join("."),description:D,source:I,data:_}}function OZ(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(", "):`${t.slice(0,5).join(", ")}, +${t.length-5}`}return`${e}`}function CZ(e,t){let n=e[xu],r=e[Ei]||e[lt],i=e[He],o=typeof r=="string"?Qi(r):void 0,s=o?Ji(o):void 0,c=o?.search||void 0,a=o?.hash||void 0;return typeof i=="string"?{urlPath:i,url:s,query:c,fragment:a,hasRoute:!0}:t===Nt.SERVER&&typeof n=="string"?{urlPath:ur(n),url:s,query:c,fragment:a,hasRoute:!1}:o?{urlPath:s,url:s,query:c,fragment:a,hasRoute:!1}:typeof n=="string"?{urlPath:ur(n),url:s,query:c,fragment:a,hasRoute:!1}:{urlPath:void 0,url:s,query:c,fragment:a,hasRoute:!1}}function ql(e,t,n="custom"){let r=t[ve]||n,i=t[fn];return i&&typeof i=="string"?{description:i,source:r}:{description:e,source:r}}function MS(e){e.on("createDsc",(t,n)=>{if(!n)return;let r=oe(n),o=r.data[ve],s=jk(n,e);if(s===!1)delete t.transaction;else if(r.description){let{description:c}=Zk(n);o!=="url"&&c&&(t.transaction=c)}Ue()&&(t.sampled=s==null?void 0:String(s))})}function wS(){return he.getActiveSpan()}var lo=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,lm=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 Xk({dsc:e,sampled:t}){let n=e?Wi(e):void 0,r=new lm,i=n?r.set(um,n):r;return t===!1?i.set(LS,"1"):i}var Kk=new Set;function GS(){return Array.from(Kk)}function ps(e){Kk.add(e)}var Xa=class extends tv{constructor(){super(),ps("SentryPropagator"),this._urlMatchesTargetsMap=new Ft(100)}inject(t,n,r){if(xs(t)){lo&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let i=he.getSpan(t),o=i&&LZ(i),{tracePropagationTargets:s,propagateTraceparent:c}=C()?.getOptions()||{};if(!Jo(o,s,this._urlMatchesTargetsMap)){lo&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",o);return}let a=PZ(n),l=kZ(n),p=pi.getBaggage(t)||pi.createBaggage({}),{dynamicSamplingContext:u,traceId:d,spanId:m,sampled:_}=qk(t);if(a){let h=Vs(a);h&&Object.entries(h).forEach(([b,R])=>{!l&&b.startsWith(mi)||(p=p.setEntry(b,{value:R}))})}!l&&u&&(p=Object.entries(u).reduce((h,[b,R])=>R?h.setEntry(`${mi}${b}`,{value:R}):h,p)),!l&&d&&d!==ev&&(r.set(n,am,Vi(d,m,_)),c&&r.set(n,"traceparent",Yi(d,m,_))),super.inject(pi.setBaggage(t,p),n,r)}extract(t,n,r){let i=r.get(n,am),o=r.get(n,SS),s=i?Array.isArray(i)?i[0]:i:void 0;return Jk(Qk(t,{sentryTrace:s,baggage:o}))}fields(){return[am,SS,"traceparent"]}};function qk(e,t={}){let n=he.getSpan(e);if(n?.spanContext().isRemote){let c=n.spanContext();return{dynamicSamplingContext:nt(n),traceId:c.traceId,spanId:void 0,sampled:Za(c)}}if(n){let c=n.spanContext();return{dynamicSamplingContext:nt(n),traceId:c.traceId,spanId:c.spanId,sampled:jk(n,t.client)}}let r=t.scope||ls(e)?.scope||ne(),i=t.client||C(),o=r.getPropagationContext();return{dynamicSamplingContext:i?ir(i,r):void 0,traceId:o.traceId,spanId:o.propagationSpanId,sampled:o.sampled}}function Qk(e,{sentryTrace:t,baggage:n}){let r=Tn(t,n),{traceId:i,parentSpanId:o,sampled:s,dsc:c}=r,a=C(),l=nr(n);if(!o||a&&!kc(a,l?.org_id))return e;let p=MZ({traceId:i,spanId:o,sampled:s,dsc:c});return he.setSpanContext(e,p)}function xZ(e,t,n){let r=Jk(Qk(e,t));return pe.with(r,n)}function Jk(e){let t=ls(e),n={scope:t?t.scope:ne().clone(),isolationScope:t?t.isolationScope:J()};return Yk(e,n)}function PZ(e){try{let t=e[SS];return Array.isArray(t)?t.join(","):t}catch{return}}function kZ(e){try{return e[am]}catch{return}}function LZ(e){let t=oe(e).data,n=t[Ei]||t[lt];if(typeof n=="string")return n;let r=e.spanContext().traceState?.get(Fk);if(r)return r}function MZ({spanId:e,traceId:t,sampled:n,dsc:r}){let i=Xk({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?Tr.SAMPLED:Tr.NONE,traceState:i}}function $k(e,t,n){let r=nL(),{name:i,parentSpan:o}=e;return aL(o)(()=>{let c=oL(e.scope,e.forceTransaction),a=e.onlyIfParent&&!he.getSpan(c),l=a?Cs(c):c;a&&C()?.recordDroppedEvent("no_parent_span","span");let p=rL(e);if(!Ue()){let u=xs(l)?l:Cs(l);return pe.with(u,()=>r.startActiveSpan(i,p,u,d=>(IS(d),pe.with(c,()=>or(()=>t(d),()=>{oe(d).status===void 0&&d.setStatus({code:Mn.ERROR})},n?()=>d.end():void 0)))))}return r.startActiveSpan(i,p,l,u=>(IS(u),or(()=>t(u),()=>{oe(u).status===void 0&&u.setStatus({code:Mn.ERROR})},n?()=>u.end():void 0)))})}function zk(e,t){return $k(e,t,!0)}function eL(e,t){return $k(e,n=>t(n,()=>n.end()),!1)}function tL(e){let t=nL(),{name:n,parentSpan:r}=e;return aL(r)(()=>{let o=oL(e.scope,e.forceTransaction),s=e.onlyIfParent&&!he.getSpan(o),c=s?Cs(o):o;s&&C()?.recordDroppedEvent("no_parent_span","span");let a=rL(e);Ue()||(c=xs(c)?c:Cs(c));let l=t.startSpan(n,a,c);return IS(l),l})}function US(e,t){let n=e?he.setSpan(pe.active(),e):he.deleteSpan(pe.active());return pe.with(n,()=>t(ne()))}function nL(){return C()?.tracer||he.getTracer("@sentry/opentelemetry",q)}function rL(e){let{startTime:t,attributes:n,kind:r,op:i,links:o}=e,s=typeof t=="number"?iL(t):t;return{attributes:i?{[H]:i,...n}:n,kind:r,links:o,startTime:s}}function iL(e){return e<9999999999?e*1e3:e}function IS(e){let t=e.end.bind(e);e.end=n=>t(typeof n=="number"?iL(n):n)}function oL(e,t){let n=wZ(e),r=he.getSpan(n);if(!r||!t)return n;let i=he.deleteSpan(n),{spanId:o,traceId:s}=r.spanContext(),c=Za(r.spanContext()),a=Re(r),l=nt(a),p=Xk({dsc:l,sampled:c}),u={traceId:s,spanId:o,isRemote:!0,traceFlags:c?Tr.SAMPLED:Tr.NONE,traceState:p};return he.setSpanContext(i,u)}function wZ(e){if(e){let t=ja(e);if(t)return t}return pe.active()}function sL(e,t){return xZ(pe.active(),e,t)}function GZ(e){let t=ht(),n=Yt(),r={traceId:t,spanId:n,isRemote:!0,traceFlags:Tr.NONE},i=he.setSpanContext(pe.active(),r);return pe.with(i,()=>(ne().setPropagationContext({traceId:t,sampleRand:at()}),e()))}function DS(e,t){let n=ja(t),r=n&&he.getSpan(n),i=r?Cr(r):Do(t);return[r?nt(r):ir(e,t),i]}function aL(e){return e!==void 0?t=>US(e,t):t=>t()}function cL(e){let t=Cs(pe.active());return pe.with(t,e)}function UZ(e){let t=e?ja(e):pe.active();return t?xs(t):!1}function BS(e){e.on("preprocessEvent",t=>{let n=wS();if(!n||t.type==="transaction")return;t.contexts={trace:Cr(n),...t.contexts};let r=Re(n);return t.sdkProcessingMetadata={dynamicSamplingContext:nt(r),...t.sdkProcessingMetadata},t})}function lL(e,t){let n=he.getSpan(e),r;if(n?.spanContext().traceState?.get(dm)==="1"){let h=he.deleteSpan(e),b=he.getSpan(t);r=b?he.setSpan(h,b):h}else r=e;let i=ls(r),o=i?.scope||ne(),s=i?.isolationScope||J(),c=r.getValue(ES)===!0,a=r.getValue(TS),l=r.getValue(cm),p=a||o.clone(),u=l||(c?s.clone():s),_=Yk(r,{scope:p,isolationScope:u}).deleteValue(ES).deleteValue(TS).deleteValue(cm);return NZ(p,_),_}function DZ(e){let t=new Map;for(let n of e)BZ(t,n);return Array.from(t,function([n,r]){return r})}function pL(e){return e.attributes[PS]===!0?void 0:kS(e)}function BZ(e,t){let n=t.spanContext().spanId,r=pL(t);if(!r){AS(e,{id:n,span:t,children:[]});return}let i=HZ(e,r),o=AS(e,{id:n,span:t,parentNode:i,children:[]});i.children.push(o)}function HZ(e,t){let n=e.get(t);return n||AS(e,{id:t,children:[]})}function AS(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 uL={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"},dL=e=>Object.values(uL).includes(e);function mL(e){let t=pm(e)?e.attributes:{},n=Dk(e)?e.status:void 0;if(n){if(n.code===Mn.OK)return{code:1};if(n.code===Mn.ERROR){if(typeof n.message>"u"){let i=NS(t);if(i)return i}return n.message&&dL(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=NS(t);return r||(n?.code===Mn.UNSET?{code:1}:{code:2,message:"unknown_error"})}function NS(e){let t=e[_n]||e[Si],n=e[m0],r=typeof t=="number"?t:typeof t=="string"?parseInt(t):void 0;if(typeof r=="number")return Zt(r);if(typeof n=="string")return{code:2,message:uL[n]||"unknown_error"}}var Lk=1e3,FZ=300,WZ=1e4,vS=class{constructor(t){this._finishedSpanBucketSize=t?.timeout||FZ,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(tt()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Ft(WZ),this._debouncedFlush=Yc(this.flush.bind(this),1,{maxWait:100})}export(t){let n=Math.floor(tt()/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&&lo&&g.log(`SpanExporter dropped ${s} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,i=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=i,i.spans.add(t),this._spansToBucketEntry.set(t,i);let o=pL(t);(!o||this._sentSpans.get(o))&&this._debouncedFlush()}flush(){let t=this._finishedSpanBuckets.flatMap(o=>o?Array.from(o.spans):[]),n=this._maybeSend(t),r=n.size,i=t.length-r;lo&&g.log(`SpanExporter exported ${r} spans, ${i} spans are waiting for their parent spans to finish`);for(let o of n){this._sentSpans.set(o.spanContext().spanId,1);let s=this._spansToBucketEntry.get(o);s&&s.spans.delete(o)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(t){let n=DZ(t),r=new Set,i=this._getCompletedRootNodes(n);for(let o of i){let s=o.span;r.add(s);let c=YZ(s);if(o.parentNode&&this._sentSpans.get(o.parentNode.id)){let u=c.contexts?.trace?.data;u&&(u["sentry.parent_span_already_sent"]=!0)}let a=c.spans||[],l=!1;for(let u of o.children)RS(u,a,r)&&(l=!0);c.spans=a.length>Lk?a.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,Lk):a,l&&(c.sdkProcessingMetadata={...c.sdkProcessingMetadata,hasGenAiSpans:!0});let p=Vo(s.events);p&&(c.measurements=p),Jc(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 VZ(e){let t=e.attributes,n=t[S],r=t[H],i=t[ve];return{origin:n,op:r,source:i}}function YZ(e){let{op:t,description:n,data:r,origin:i="manual",source:o}=fL(e),s=Xt(e),c=e.attributes[Dn],a={[ve]:o,[Dn]:c,[H]:t,[S]:i,...r,...gL(e.attributes)},{links:l}=e,{traceId:p,spanId:u}=e.spanContext(),d=kS(e),m=mL(e),_={parent_span_id:d,span_id:u,trace_id:p,data:a,origin:i,op:t,status:Fo(m),links:Ho(l)},h=a[_n],b=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:_,otel:{resource:e.resource.attributes},...b},spans:[],start_timestamp:Kt(e.startTime),timestamp:Kt(e.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:s.scope,capturedSpanIsolationScope:s.isolationScope,sampleRate:c,dynamicSamplingContext:nt(e)},...o&&{transaction_info:{source:o}}}}function RS(e,t,n){let r=e.span;if(r&&n.add(r),!r){let N=!1;return e.children.forEach(P=>{RS(P,t,n)&&(N=!0)}),N}let o=r.spanContext().spanId,s=r.spanContext().traceId,c=kS(r),{attributes:a,startTime:l,endTime:p,links:u}=r,{op:d,description:m,data:_,origin:h="manual"}=fL(r),b={[S]:h,[H]:d,...gL(a),..._},R=mL(r),M={span_id:o,trace_id:s,data:b,description:m,parent_span_id:c,start_timestamp:Kt(l),timestamp:Kt(p)||void 0,status:Fo(R),op:d,origin:h,measurements:Vo(r.events),links:Ho(u)};t.push(M);let v=!!d?.startsWith("gen_ai.");return e.children.forEach(N=>{RS(N,t,n)&&(v=!0)}),v}function fL(e){let{op:t,source:n,origin:r}=VZ(e),{op:i,description:o,source:s,data:c}=Zk(e),a=t||i,l=n||s,p={...c,...jZ(e)};return{op:a,description:o,source:l,origin:r,data:p}}function gL(e){let t={...e};return delete t[Dn],delete t[PS],delete t[fn],t}function jZ(e){let t=e.attributes,n={};e.kind!==Nt.INTERNAL&&(n["otel.kind"]=Nt[e.kind]);let r=t[Si];r&&(n[_n]=r);let i=Bk(e);return i.url&&(n.url=i.url),i["http.query"]&&(n["http.query"]=i["http.query"].slice(1)),i["http.fragment"]&&(n["http.fragment"]=i["http.fragment"].slice(1)),n}function fm(e,t){let n=e.attributes??{},r=t?.spanKind??U.INTERNAL,{op:i,description:o,source:s,data:c}=Ql(e.name,n,r);e.name=o,wt(e,{[H]:i,[ve]:s,[h0]:"manual",...c}),r!==U.INTERNAL&&wt(e,{"otel.kind":Sb(r)})}var Jl=class{constructor(t){this._unsubscribePreprocessSpan=void 0,ps("SentrySpanProcessor"),this._exporter=new vS(t),this._client=t?.client??C(),this._client&&rt(this._client)&&(this._unsubscribePreprocessSpan=this._client.on("preprocessSpan",fm))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(t,n){let r=he.getSpan(n),i=ls(n);r&&!r.spanContext().isRemote&&fi(r,t),r?.spanContext().isRemote&&t.setAttribute(PS,!0),n===$p&&(i={scope:Us(),isolationScope:vt()}),i&&Rr(t,i.scope,i.isolationScope),Hc(t),this._client?.emit("spanStart",t)}onEnd(t){Fc(t),this._client?.emit("spanEnd",t),this._client&&rt(this._client)?this._client.emit("afterSpanEnd",t):this._exporter.export(t)}},$l=class{constructor(t){this._client=t,this._isSpanStreaming=rt(t),ps("SentrySampler")}shouldSample(t,n,r,i,o,s){let c=this._client.getOptions(),{ignoreSpans:a}=c,l=KZ(t),p=l?.spanContext();if(!Ue(c))return Oi({decision:void 0,context:t,spanAttributes:o});let u=o[Ur]||o[Dr];if(i===Nt.CLIENT&&u&&(!l||p?.isRemote)&&!this._isSpanStreaming)return this._client.recordDroppedEvent("no_parent_span","span"),Oi({decision:void 0,context:t,spanAttributes:o});let d=l?ZZ(l,n,r):void 0;if(!(!l||p?.isRemote)){if(this._isSpanStreaming){if(d&&a?.length){let{description:ce,op:ge}=Ql(r,o,i);if(rr({description:ce,op:o[H]??ge,attributes:o},a))return this._client.recordDroppedEvent("ignored","span"),Oi({decision:Ir.NOT_RECORD,context:t,spanAttributes:o,ignoredChildSpan:!0})}if(!d){let ce=p?.traceState?.get(Wk)==="1";this._client.recordDroppedEvent(ce?"ignored":"sample_rate","span")}}return Oi({decision:d?Ir.RECORD_AND_SAMPLED:Ir.NOT_RECORD,context:t,spanAttributes:o})}let{description:_,data:h,op:b}=Ql(r,o,i),R={...h,...o};if(b&&(R[H]=b),this._isSpanStreaming&&a?.length&&rr({description:_,op:R[H]??b,attributes:R},a))return this._client.recordDroppedEvent("ignored","span"),Oi({decision:Ir.NOT_RECORD,context:t,spanAttributes:o,ignoredSegmentSpan:!0});let M={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:R,spanName:_,parentSampled:d,parentContext:p},M),!M.decision)return Oi({decision:void 0,context:t,spanAttributes:o});let{isolationScope:v}=ls(t)??{},N=p?.traceState?p.traceState.get(um):void 0,P=N?nr(N):void 0,D=En(P?.sample_rand)??at(),[I,F,L]=Vc(c,{name:_,attributes:R,normalizedRequest:v?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:En(P?.sample_rate)},D),G=`${u}`.toUpperCase();return G==="OPTIONS"||G==="HEAD"?(lo&&g.log(`[Tracing] Not sampling span because HTTP method is '${G}' for ${r}`),Oi({decision:Ir.NOT_RECORD,context:t,spanAttributes:o,sampleRand:D,downstreamTraceSampleRate:0})):(!I&&d===void 0&&(lo&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate",this._isSpanStreaming?"span":"transaction")),{...Oi({decision:I?Ir.RECORD_AND_SAMPLED:Ir.NOT_RECORD,context:t,spanAttributes:o,sampleRand:D,downstreamTraceSampleRate:L?F:void 0}),attributes:{[Dn]:L?F:void 0}})}toString(){return"SentrySampler"}};function ZZ(e,t,n){let r=e.spanContext();if(g_(r)&&r.traceId===t){if(r.isRemote){let o=Za(e.spanContext());return lo&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${o}`),o}let i=Za(r);return lo&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${i}`),i}}function Oi({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:i,ignoredChildSpan:o,ignoredSegmentSpan:s}){let c=XZ(t,n);return i!==void 0&&(c=c.set(AZ,`${i}`)),r!==void 0&&(c=c.set(IZ,`${r}`)),o&&(c=c.set(dm,"1")),s&&(c=c.set(Wk,"1")),e==null?{decision:Ir.NOT_RECORD,traceState:c}:e===Ir.NOT_RECORD?{decision:e,traceState:c.set(LS,"1")}:{decision:e,traceState:c}}function XZ(e,t){let i=he.getSpan(e)?.spanContext()?.traceState||new lm,o=t[Ei]||t[lt];return o&&typeof o=="string"&&(i=i.set(Fk,o)),i}function KZ(e){let t=he.getSpan(e);return t&&g_(t.spanContext())?t:void 0}function gm(e,t={}){let n=oe(e),r=n.data,i=e.kind??Nt.INTERNAL,o=Ws(e),s=r[fn]!==void 0,c=o&&!s&&!z_(e),a=c&&r[ve]==="custom"?{...r,[ve]:void 0}:r,l=Ql(n.description||"<unknown>",a,i);if(i!==Nt.INTERNAL&&r["otel.kind"]===void 0&&e.setAttribute("otel.kind",Nt[i]),l.op&&r[H]===void 0&&e.setAttribute(H,l.op),l.source!==void 0&&l.source!=="custom"&&(t.finalizeStatus||l.source!=="url")&&(n.parent_span_id===void 0||i===Nt.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){JZ(e,r);let u=C();QZ(e,r,n.status,!!u&&rt(u))}o&&l.description!==n.description&&(r[ve]!=="custom"||c)&&e.updateName(l.description)}function qZ(e,t){we(e,"kind",t??Nt.INTERNAL)}function QZ(e,t,n,r){if(n===void 0){e.setStatus(NS(t)||{code:1});return}!r&&n!=="ok"&&!dL(n)&&e.setStatus({code:2,message:"internal_error"})}function JZ(e,t){let n=t[Si];t[_n]===void 0&&n!==void 0&&(e.setAttribute(_n,n),t[_n]=n)}var OS=class{startSpan(t,n={},r){let i=r||pe.active(),o=n.root?void 0:he.getSpan(i);if(xs(i))return this._createNonRecordingSpan(o);let s=this._startSentrySpan(t,n,o,r!==void 0);return eh(s),qZ(s,n.kind),n.attributes?.[ve]===void 0&&J_(s),gm(s),s}startActiveSpan(t,n,r,i){let o=typeof n=="function"?{}:n,s=typeof r=="function"||r===void 0?pe.active():r,c=typeof n=="function"?n:typeof r=="function"?r:i,a=this.startSpan(t,o,s),l=Xt(a).isolationScope,p=u=>l?u.setValue(cm,l):u;return kr(a)&&he.getSpan(s)?pe.with(p(s),()=>c(a)):pe.with(p(he.setSpan(s,a)),()=>(Un(ne(),a),c(a)))}_startSentrySpan(t,n,r,i){let o={name:t,attributes:n.attributes,links:n.links,startTime:n.startTime};return n.root?An(()=>qs({...o,parentSpan:null})):r?.spanContext().isRemote?this._startRootSpanWithRemoteParent(o,r):r?qs({...o,parentSpan:r}):An(()=>qs({...o,parentSpan:i?null:void 0}))}_startRootSpanWithRemoteParent(t,n){let{spanId:r,traceId:i,traceState:o}=n.spanContext(),s=nt(n),c=typeof s.sample_rand=="string"?Number(s.sample_rand):void 0,a=!!o?.get(um);return Be(l=>(l.setPropagationContext({traceId:i,parentSpanId:r,sampled:Za(n.spanContext()),dsc:a?s:void 0,sampleRand:typeof c=="number"&&!Number.isNaN(c)?c:at()}),Un(l,void 0),qs({...t,parentSpan:null})))}_createNonRecordingSpan(t){let n=new xr({traceId:t?.spanContext().traceId});return t&&fi(t,n),Rr(n,ne(),J()),n}},zl=class{constructor(t={}){this._tracers=new Map,this.resource=t.resource}getTracer(t,n,r){let i=JSON.stringify([t,n,r]),o=this._tracers.get(i);if(o)return o;let s=new OS;return this._tracers.set(i,s),s}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},Mk="telemetry.sdk.language",wk="telemetry.sdk.name",Gk="telemetry.sdk.version",$Z="service.namespace",CS=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 zZ(e){if(!e)return{};let t={};for(let n of e.split(",")){let r=n.indexOf("=");if(r===-1)continue;let i=n.substring(0,r).trim(),o=n.substring(r+1).trim();if(i)try{t[i]=decodeURIComponent(o)}catch{t[i]=o}}return t}function _m(e){let t=typeof process<"u"?process.env:{},n=t.OTEL_SERVICE_NAME,r=zZ(t.OTEL_RESOURCE_ATTRIBUTES);return new CS({[$Z]:"sentry",[Mh]:e,...r,...n?{[Mh]:n}:{},[I0]:q,[Mk]:eu[Mk],[wk]:eu[wk],[Gk]:eu[Gk]})}function eX({span:e,scope:t,client:n,propagateTraceparent:r}={}){let i=(t&&ja(t))??pe.active();if(e){let{scope:p}=Xt(e);i=p&&ja(p)||he.setSpan(pe.active(),e)}let{traceId:o,spanId:s,sampled:c,dynamicSamplingContext:a}=qk(i,{scope:t,client:n}),l={"sentry-trace":Vi(o,s,c),baggage:Wi(a)};return r&&(l.traceparent=Yi(o,s,c)),l}function _L(e){function t(){let a=pe.active(),l=ls(a);return l||{scope:Us(),isolationScope:vt()}}function n(a){let l=pe.active();return pe.with(l,()=>a(s()))}function r(a,l){let p=ja(a)||pe.active();return pe.with(p.setValue(TS,a),()=>l(a))}function i(a){let l=pe.active();return pe.with(l.setValue(ES,!0),()=>{let p=s();return Pc(p.getPropagationContext())||p.setPropagationContext({traceId:ht(),sampleRand:at()}),a(c())})}function o(a,l){let p=pe.active();return pe.with(p.setValue(cm,a),()=>l(c()))}function s(){return t().scope}function c(){return t().isolationScope}G_({withScope:n,withSetScope:r,withSetIsolationScope:o,withIsolationScope:i,getCurrentScope:s,getIsolationScope:c,startSpan:zk,startSpanManual:eL,startInactiveSpan:tL,getActiveSpan:wS,suppressTracing:cL,isTracingSuppressed:UZ,getTraceData:eX,continueTrace:sL,startNewTrace:GZ,withActiveSpan:US,getTracingChannelBinding:e?.getTracingChannelBinding})}st();st();import{AsyncLocalStorage as hL}from"async_hooks";import{EventEmitter as tX}from"events";var nX=["addListener","on","once","prependListener","prependOnceListener"],hm=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1,ps("SentryContextManager"),this._asyncLocalStorage=bt(Je()).getTracingChannelBinding?.()?.asyncLocalStorage??new hL}active(){return this._asyncLocalStorage.getStore()??$p}with(t,n,r,...i){let o=lL(t,this.active()),s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(o,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}bind(t,n){return n instanceof tX?this._bindEventEmitter(t,n):typeof n=="function"?this._bindFunction(t,n):n}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:mm}}_bindFunction(t,n){let r=this.with.bind(this),i=function(...o){return r(t,()=>n.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),i}_bindEventEmitter(t,n){if(this._getPatchMap(n)!==void 0)return n;this._createPatchMap(n);for(let r of nX)n[r]!==void 0&&(n[r]=this._patchAddListener(n,n[r],t));return typeof n.removeListener=="function"&&(n.removeListener=this._patchRemoveListener(n,n.removeListener)),typeof n.off=="function"&&(n.off=this._patchRemoveListener(n,n.off)),typeof n.removeAllListeners=="function"&&(n.removeAllListeners=this._patchRemoveAllListeners(n,n.removeAllListeners)),n}_patchRemoveListener(t,n){let r=this;return function(i,o){let s=r._getPatchMap(t)?.[i];if(s===void 0)return n.call(this,i,o);let c=s.get(o);return n.call(this,i,c||o)}}_patchRemoveAllListeners(t,n){let r=this;return function(i){let o=r._getPatchMap(t);return o!==void 0&&(arguments.length===0?r._createPatchMap(t):i!==void 0&&o[i]!==void 0&&delete o[i]),n.apply(this,arguments)}}_patchAddListener(t,n,r){let i=this;return function(o,s){if(i._wrapped)return n.call(this,o,s);let c=i._getPatchMap(t);c===void 0&&(c=i._createPatchMap(t));let a=c[o];a===void 0&&(a=new WeakMap,c[o]=a);let l=i.bind(r,s);a.set(s,l),i._wrapped=!0;try{return n.call(this,o,l)}finally{i._wrapped=!1}}}_createPatchMap(t){let n=Object.create(null);return t[this._kOtListeners]=n,n}_getPatchMap(t){return t[this._kOtListeners]}};function HS(e){_L({getTracingChannelBinding:e?.skipOpenTelemetrySetup?iX():rX()})}function rX(){let e=new hL;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:bL})}function iX(){return()=>{try{let t=pe._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return t?{asyncLocalStorage:t,getStoreWithActiveSpan:bL}:void 0}catch{return}}}function bL(e){let t=pe.active();return kr(e)&&Re(e)!==e||e.spanContext().traceState?.get(dm)==="1"?t:he.setSpan(t,e)}var ep=hm;st();function FS(){tn.disable(),tn.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},zN.DEBUG)}var tp={};function de(e,t,n){return n?sX(e,t,n):oX(e,t)}function oX(e,t){return Object.assign(n=>{let r=tp[e];if(r)return n&&r.setConfig(n),r;let i=t(n);return tp[e]=i,Da({instrumentations:[i]}),i},{id:e})}function sX(e,t,n){return Object.assign(r=>{let i=n(r),o=tp[e];if(o)return o.setConfig(i),o;let s=new t(i);return tp[e]=s,Da({instrumentations:[s]}),s},{id:e})}import*as WS from"diagnostics_channel";var aX="ChildProcess",bm=(e={})=>({name:aX,setup(){WS.channel("child_process").subscribe(t=>{B(t)&&"process"in t&&cX(t.process,e)}),WS.channel("worker_threads").subscribe(t=>{B(t)&&"worker"in t&&lX(t.worker,e)})}});function cX(e,t){let n=!1,r;e.on("spawn",()=>{if(e.spawnfile==="/usr/bin/sw_vers"){n=!0;return}r={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(r.spawnargs=e.spawnargs)}).on("exit",i=>{n||(n=!0,i!==null&&i!==0&&rn({category:"child_process",message:`Child process exited with code '${i}'`,level:i===0?"info":"warning",data:r}))}).on("error",i=>{n||(n=!0,rn({category:"child_process",message:`Child process errored with '${i.message}'`,level:"error",data:r}))})}function lX(e,t){let n;e.on("online",()=>{n=e.threadId}).on("error",r=>{t.captureWorkerErrors!==!1?me(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):rn({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as pX}from"child_process";import{readFile as uX,readdir as dX}from"fs";import*as It from"os";import{join as mX}from"path";import{promisify as EL}from"util";var fX=EL(uX),gX=EL(dX),_X="Context",hX=((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?TX():void 0,r=t.device?IX(t.device):void 0,i=t.culture?EX():void 0,o=t.cloudResource?CX():void 0,s=t.os?SX():void 0,c={"process.runtime.engine.name":"v8","process.runtime.engine.version":process.versions.v8,...yL({app:n,device:r,culture:i,cloud_resource:o})};s&&s.then(p=>Object.assign(c,yL({os:p}))).catch(()=>{});let a=(async()=>{let p={};return s&&(p.os=await s),n&&(p.app=n),r&&(p.device=r),i&&(p.culture=i),o&&(p.cloud_resource=o),p})();async function l(p){let u=bX(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:_X,processEvent(p){return l(p)},processSegmentSpan(p){wt(p,c),wt(p,yX(n,r))}}}),ym=hX;function bX(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=It.freemem()),e}function yL(e){let t={},{app:n,device:r,os:i,culture:o,cloud_resource:s}=e;if(n&&n.app_start_time&&(t["app.start_time"]=n.app_start_time),r&&(r.arch&&(t["device.archs"]=[r.arch]),r.boot_time&&(t["device.boot_time"]=r.boot_time),r.memory_size!=null&&(t["device.memory_size"]=r.memory_size),r.processor_count!=null&&(t["device.processor_count"]=r.processor_count),r.cpu_description&&(t["device.cpu_description"]=r.cpu_description),r.processor_frequency!=null&&(t["device.processor_frequency"]=r.processor_frequency)),i&&(i.name&&(t["os.name"]=i.name),i.version&&(t["os.version"]=i.version),i.kernel_version&&(t["os.kernel_version"]=i.kernel_version),i.build&&(t["os.build"]=i.build)),o&&(o.locale&&(t["culture.locale"]=o.locale),o.timezone&&(t["culture.timezone"]=o.timezone)),s)for(let[c,a]of Object.entries(s))a!=null&&(t[c]=a);return t}function yX(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"]=It.freemem()),n}async function SX(){let e=It.platform();switch(e){case"darwin":return RX();case"linux":return OX();default:return{name:AX[e]||e,version:It.release()}}}function EX(){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 TX(){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 IX(e){let t={},n;try{n=It.uptime()}catch{}if(typeof n=="number"&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=It.arch(),(e===!0||e.memory)&&(t.memory_size=It.totalmem(),t.free_memory=It.freemem()),e===!0||e.cpu){let r=It.cpus(),i=r?.[0];i&&(t.processor_count=r.length,t.cpu_description=i.model,t.processor_frequency=i.speed)}return t}var AX={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},NX=[{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"]}],vX={alpine:e=>e,arch:e=>$r(/distrib_release=(.*)/,e),centos:e=>$r(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>$r(/release (..)/,e),mint:e=>$r(/distrib_release=(.*)/,e),red:e=>$r(/release ([^ ]+)/,e),suse:e=>$r(/VERSION = (.*)\n/,e),ubuntu:e=>$r(/distrib_release=(.*)/,e)};function $r(e,t){let n=e.exec(t);return n?n[1]:void 0}async function RX(){let e={kernel_version:It.release(),name:"Mac OS X",version:`10.${Number(It.release().split(".")[0])-4}`};try{let t=await new Promise((n,r)=>{pX("/usr/bin/sw_vers",(i,o)=>{if(i){r(i);return}n(o)})});e.name=$r(/^ProductName:\s+(.*)$/m,t),e.version=$r(/^ProductVersion:\s+(.*)$/m,t),e.build=$r(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function SL(e){return e.split(" ")[0].toLowerCase()}async function OX(){let e={kernel_version:It.release(),name:"Linux"};try{let t=await gX("/etc"),n=NX.find(c=>t.includes(c.name));if(!n)return e;let r=mX("/etc",n.name),i=(await fX(r,{encoding:"utf-8"})).toLowerCase(),{distros:o}=n;e.name=o.find(c=>i.indexOf(SL(c))>=0)||o[0];let s=SL(e.name);e.version=vX[s]?.(i)}catch{}return e}function CX(){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 xX}from"fs";import{createInterface as PX}from"readline";var VS=new Ft(10),AL=new Ft(20),kX=7,LX="ContextLines",MX=1e3,wX=1e4;function GX(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function UX(e){return!!(e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:"))}function DX(e){return e.lineno!==void 0&&e.lineno>wX||e.colno!==void 0&&e.colno>MX}function BX(e,t){let n=VS.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 HX(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!="number")return[];let i=IL(r,t),o=[];for(;;){if(n===e.length-1){o.push(i);break}let s=e[n+1];if(typeof s!="number")break;s<=i[1]?i[1]=s+t:(o.push(i),i=IL(s,t)),n++}return o}function FX(e,t,n){return new Promise((r,i)=>{let o=xX(e),s=PX({input:o});function c(){o.destroy(),r()}let a=0,l=0,p=t[l];if(p===void 0){c();return}let u=p[0],d=p[1];function m(_){AL.set(e,1),We&&g.error(`Failed to read file: ${e}. Error: ${_}`),s.close(),s.removeAllListeners(),c()}o.on("error",m),s.on("error",m),s.on("close",c),s.on("line",_=>{if(a++,!(a<u)&&(n[a]=x_(_,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 WX(e,t){let n={};if(t>0&&e.exception?.values){for(let o of e.exception.values)if(o.stacktrace?.frames?.length)for(let s=o.stacktrace.frames.length-1;s>=0;s--){let c=o.stacktrace.frames[s],a=c?.filename;if(!c||typeof a!="string"||typeof c.lineno!="number"||UX(a)||DX(c))continue;n[a]||(n[a]=[]),n[a].push(c.lineno)}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let o of r){if(AL.get(o))continue;let s=n[o];if(!s)continue;s.sort((l,p)=>l-p);let c=HX(s,t);if(c.every(l=>BX(o,l)))continue;let a=GX(VS,o,{});i.push(FX(o,c,a))}if(await Promise.all(i).catch(()=>{We&&g.log("Failed to read one or more source files and resolve context lines")}),t>0&&e.exception?.values)for(let o of e.exception.values)o.stacktrace?.frames&&o.stacktrace.frames.length>0&&VX(o.stacktrace.frames,t,VS);return e}function VX(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=n.get(r.filename);if(i===void 0)continue;YX(r.lineno,r,t,i)}}function TL(e){delete e.pre_context,delete e.context_line,delete e.post_context}function YX(e,t,n,r){if(t.lineno===void 0||r===void 0){We&&g.error("Cannot resolve context for frame with no lineno or file contents");return}t.pre_context=[];for(let o=NL(e,n);o<e;o++){let s=r[o];if(s===void 0){TL(t),We&&g.error(`Could not find line ${o} in file ${t.filename}`);return}t.pre_context.push(s)}if(r[e]===void 0){TL(t),We&&g.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=vL(e,n);t.post_context=[];for(let o=e+1;o<=i;o++){let s=r[o];if(s===void 0)break;t.post_context.push(s)}}function NL(e,t){return Math.max(1,e-t)}function vL(e,t){return e+t}function IL(e,t){return[NL(e,t),vL(e,t)]}var jX=((e={})=>({name:LX,processEvent(t,n,r){let i=e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??kX;return WX(t,i)}})),Sm=jX;import{Worker as ZX}from"worker_threads";var Em;async function Ka(){if(Em===void 0)try{Em=!!(await import("inspector")).url()}catch{Em=!1}return Em}function Tm(e,t){return da(e,t)}var np="__SENTRY_ERROR_LOCAL_VARIABLES__";function OL(e,t,n){let r=0,i=5,o=0;return setInterval(()=>{o===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),o=i):(o-=1,o===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function RL(e){return e!==void 0&&(e.length===0||e==="?"||e==="<anonymous>")}function Im(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||RL(e)&&RL(t)}var XX="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc2LjIgKDA0MmUyMjgpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJ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dGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function CL(...e){g.log("[LocalVariables]",...e)}var xL=((e={})=>{function t(o,s,c){if(c===!1)return;let a=(o.stacktrace?.frames||[]).filter(l=>l.function!=="new Promise");for(let l=0;l<a.length;l++){let p=a.length-l-1,u=s[l],d=a[p];if(!d||!u)break;u.vars===void 0||d.in_app===!1&&e.includeOutOfAppFrames!==!0||!Im(d.function,u.function)||(d.vars=Tm(u.vars,c))}}function n(o,s){if(s.originalException&&typeof s.originalException=="object"&&np in s.originalException&&Array.isArray(s.originalException[np])){let c=C()?.getDataCollectionOptions().stackFrameVariables??!0;for(let a of o.exception?.values||[])t(a,s.originalException[np],c);s.originalException[np]=void 0}return o}async function r(){let o=await import("inspector");o.url()||o.open(0)}function i(o){let s=new ZX(new URL(`data:application/javascript;base64,${XX}`),{workerData:o,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{s.terminate()}),s.once("error",c=>{CL("Worker error",c)}),s.once("exit",c=>{CL("Worker exit",c)}),s.unref()}return{name:"LocalVariablesAsync",async setup(o){if(!o.getOptions().includeLocalVariables)return;if(await Ka()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let c={...e,debug:g.isEnabled()};r().then(()=>{try{i(c)}catch(a){g.error("Failed to start worker",a)}},a=>{g.error("Failed to start inspector",a)})},processEvent(o,s){return n(o,s)}}});function PL(e){if(e!==void 0)return e.slice(-10).reduce((t,n)=>`${t},${n.function},${n.lineno},${n.colno}`,"")}function KX(e,t){if(t!==void 0)return PL(e(t,1))}function kL(e){let t=[],n=!1;function r(s){t=[],!n&&(n=!0,e(s))}t.push(r);function i(s){t.push(s)}function o(s){let c=t.pop()||r;try{c(s)}catch{r(s)}}return{add:i,next:o}}var YS=class e{constructor(t){this._session=t}static async create(t){if(t)return t;let n=await import("inspector");return new e(new n.Session)}configureAndConnect(t,n){this._session.connect(),this._session.on("Debugger.paused",r=>{t(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(t){this._session.post("Debugger.setPauseOnExceptions",{state:t?"all":"uncaught"})}getLocalVariables(t,n){this._getProperties(t,r=>{let{add:i,next:o}=kL(n);for(let s of r)if(s.value?.objectId&&s.value.className==="Array"){let c=s.value.objectId;i(a=>this._unrollArray(c,s.name,a,o))}else if(s.value?.objectId&&s.value.className==="Object"){let c=s.value.objectId;i(a=>this._unrollObject(c,s.name,a,o))}else s.value&&i(c=>this._unrollOther(s,c,o));o({})})}_getProperties(t,n){this._session.post("Runtime.getProperties",{objectId:t,ownProperties:!0},(r,i)=>{n(r?[]:i.result)})}_unrollArray(t,n,r,i){this._getProperties(t,o=>{r[n]=o.filter(s=>s.name!=="length"&&!isNaN(parseInt(s.name,10))).sort((s,c)=>parseInt(s.name,10)-parseInt(c.name,10)).map(s=>s.value?.value),i(r)})}_unrollObject(t,n,r,i){this._getProperties(t,o=>{r[n]=o.map(s=>[s.name,s.value?.value]).reduce((s,[c,a])=>(s[c]=a,s),{}),i(r)})}_unrollOther(t,n,r){t.value&&("value"in t.value?t.value.value===void 0||t.value.value===null?n[t.name]=`<${t.value.value}>`:n[t.name]=t.value.value:"description"in t.value&&t.value.type!=="function"?n[t.name]=`<${t.value.description}>`:t.value.type==="undefined"&&(n[t.name]="<undefined>")),r(n)}},qX="LocalVariables",QX=((e={},t)=>{let n=new Ft(20),r,i=!1;function o(l,p){let u=PL(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[_],R=m[h];if(!R||!b)break;b.vars===void 0||R.in_app===!1&&e.includeOutOfAppFrames!==!0||!Im(R.function,b.function)||(R.vars=Tm(b.vars,p))}}function s(l){for(let p of l.exception?.values||[])o(p,C()?.getDataCollectionOptions().stackFrameVariables??!0);return l}let c;async function a(){let p=C()?.getOptions();if(!p?.includeLocalVariables)return;if(Ya<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Ka()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let d=await YS.create(t),m=(h,{params:{reason:b,data:R,callFrames:M}},v)=>{if(b!=="exception"&&b!=="promiseRejection"){v();return}r?.();let N=KX(h,R.description);if(N==null){v();return}let{add:P,next:D}=kL(I=>{n.set(N,I),v()});for(let I=0;I<Math.min(M.length,5);I++){let{scopeChain:F,functionName:L,this:G}=M[I],ce=F.find(Ne=>Ne.type==="local"),ge=G.className==="global"||!G.className?L:`${G.className}.${L}`;if(ce?.object.objectId===void 0)P(Ne=>{Ne[I]={function:ge},D(Ne)});else{let Ne=ce.object.objectId;P(Te=>d.getLocalVariables(Ne,Ce=>{Te[I]={function:ge,vars:Ce},D(Te)}))}}D([])},_=e.captureAllExceptions!==!1;if(d.configureAndConnect((h,b)=>m(p.stackParser,h,b),_),_){let h=e.maxExceptionsPerSecond||50;r=OL(h,()=>{g.log("Local variables rate-limit lifted."),d.setPauseOnExceptions(!0)},b=>{g.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${b} seconds.`),d.setPauseOnExceptions(!1)})}i=!0}catch(d){g.log("The `LocalVariables` integration failed to start.",d)}}return{name:qX,setupOnce(){c=a()},async processEvent(l){return await c,i?s(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}}),LL=QX;var Am=(e={})=>zt.major<19?LL(e):xL(e);import{readFileSync as JX}from"fs";import{join as $X}from"path";var jS,zX="Modules";function eK(){return typeof __SENTRY_SERVER_MODULES__<"u"?__SENTRY_SERVER_MODULES__:te.__SENTRY_SERVER_MODULES__??{}}var tK=(()=>({name:zX,processEvent(e){return e.modules={...e.modules,...ML()},e},getModules:ML})),Nm=tK;function nK(){return{...eK(),...iK()}}function ML(){return jS||(jS=nK()),jS}function rK(){try{let e=$X(process.cwd(),"package.json");return JSON.parse(JX(e,"utf8"))}catch{return{}}}function iK(){let e=rK();return{...e.dependencies,...e.devDependencies}}import{isMainThread as sK}from"worker_threads";var oK=2e3,wL=!1;function rp(e){if(wL)return;wL=!0,Me(()=>{console.error(e)});let t=C();if(t===void 0){We&&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:oK;t.close(r).then(i=>{i||We&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},i=>{We&&g.error(i),global.process.exit(1)})}var aK="OnUncaughtException",vm=(e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:aK,setup(n){sK&&global.process.on("uncaughtException",cK(n,t))}}};function cK(e,t){let r=!1,i=!1,o=!1,s,c=e.getOptions();return Object.assign(a=>{let l=rp;t.onFatalError?l=t.onFatalError:c.onFatalError&&(l=c.onFatalError);let u=global.process.listeners("uncaughtException").filter(m=>m.name!=="domainUncaughtExceptionClear"&&m._errorHandler!==!0).length===0,d=t.exitEvenIfOtherHandlersAreRegistered||u;r?d&&(o?(We&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),rp(a)):i||(i=!0,setTimeout(()=>{o||(o=!0,l(s,a))},2e3))):(s=a,r=!0,C()===e&&me(a,{originalException:a,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!o&&d&&(o=!0,l(a)))},{_errorHandler:!0})}var lK="OnUnhandledRejection",pK=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],uK=((e={})=>{let t={mode:e.mode??"warn",ignore:[...pK,...e.ignore??[]]};return{name:lK,setup(n){global.process.on("unhandledRejection",gK(n,t))}}}),Rm=uK;function dK(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 mK(e,t){let n=e.name===void 0||Nr(t.name,e.name,!0),r=e.message===void 0||Nr(t.message,e.message);return n&&r}function fK(e,t){let n=dK(t);return e.some(r=>mK(r,n))}function gK(e,t){return function(r,i){if(C()!==e||fK(t.ignore??[],r))return;let o=t.mode==="strict"?"fatal":"error",s=B(r)?r._sentry_active_span:void 0;(s?a=>se(s,a):a=>a())(()=>{me(r,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:o},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),_K(r,t.mode)}}function _K(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"?Me(()=>{console.warn(n),console.error(B(e)&&"stack"in e?e.stack:e)}):t==="strict"&&(Me(()=>{console.warn(n)}),rp(e))}var hK="ProcessSession",Om=()=>({name:hK,setupOnce(){$c(),process.on("beforeExit",()=>{J().getSession()?.status==="ok"&&Ko()})}});import*as GL from"http";var ZS="Spotlight",bK=((e={})=>{let t={sidecarUrl:e.sidecarUrl||"http://localhost:8969/stream"};return{name:ZS,setup(n){try{g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}yK(n,t)}}}),Cm=bK;function yK(e,t){let n=SK(t.sidecarUrl);if(!n)return;let r=0;e.on("beforeEnvelope",i=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let o=Bc(i);Bn(()=>{let s=GL.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},c=>{c.statusCode&&c.statusCode>=200&&c.statusCode<400&&(r=0),c.on("data",()=>{}),c.on("end",()=>{}),c.setEncoding("utf8")});s.on("error",()=>{r++,g.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),s.write(o),s.end()})})}function SK(e){try{return new URL(`${e}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var xm=(e={})=>({name:"Console",setup(t){process.env.LAMBDA_TASK_ROOT&&Cc("console",EK),wb({...e,filter:[...e.filter||[],"[DEP0205] DeprecationWarning"]}).setup?.(t)}});function EK(){let e=te?.console;e&&$n.forEach(t=>{t in e&&TK(e,t)})}function TK(e,t){let n=e[t];Jn[t]=n;let r=n,i,o=!1,s=function(...a){if(o){n.apply(e,a);return}o=!0;try{Ps("console",{args:a,level:t}),r.apply(e,a)}finally{o=!1}};Lo(s,n);let c=n.bind(e);Jn[t]=c;try{let a=s;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return a},set(l){l===s?(i!==void 0&&(r=i,i=void 0),a=s):l===c?(i=r,a=c):typeof l=="function"&&!l.__sentry_original__?(r=l,a=s):a=l}})}catch{Pt(e,t,function(a){return Jn[t]=a,function(...l){Ps("console",{args:l,level:t}),Jn[t]?.apply(this,l)}})}}import*as XS from"util";var IK="NodeSystemError";function AK(e){return!(e instanceof Error)||!("errno"in e)||typeof e.errno!="number"||typeof XS.getSystemErrorMap!="function"?!1:XS.getSystemErrorMap().has(e.errno)}var Pm=(e={})=>({name:IK,processEvent:(t,n,r)=>{if(!AK(n.originalException))return t;let i=n.originalException,o={...i};!r.getDataCollectionOptions().userInfo&&e.includePaths!==!0&&(delete o.path,delete o.dest),t.contexts={...t.contexts,node_system_error:o};for(let s of t.exception?.values||[])s.value&&(i.path&&s.value.includes(i.path)&&(s.value=s.value.replace(`'${i.path}'`,"").trim()),i.dest&&s.value.includes(i.dest)&&(s.value=s.value.replace(`'${i.dest}'`,"").trim()));return t}});import*as vK from"http";import*as RK from"https";import{Readable as OK}from"stream";import{createGzip as CK}from"zlib";import*as Ci from"net";import*as qS from"tls";import*as KS from"http";import"https";var UL,zr=Symbol("AgentBaseInternalState"),km=class extends(UL=KS.Agent,UL){constructor(t){super(t),this[zr]={}}isSecureEndpoint(t){if(t){if(typeof t.secureEndpoint=="boolean")return t.secureEndpoint;if(typeof t.protocol=="string")return t.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
26
+ `).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(t,n,r){let i={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(t,i)).then(o=>{if(o instanceof KS.Agent)return o.addRequest(t,i);this[zr].currentSocket=o,super.createSocket(t,n,r)},r)}createConnection(){let t=this[zr].currentSocket;if(this[zr].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[zr].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(t){this[zr]&&(this[zr].defaultPort=t)}get protocol(){return this[zr].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[zr]&&(this[zr].protocol=t)}};function Lm(...e){g.log("[https-proxy-agent:parse-proxy-response]",...e)}function DL(e){return new Promise((t,n)=>{let r=0,i=[];function o(){let p=e.read();p?l(p):e.once("readable",o)}function s(){e.removeListener("end",c),e.removeListener("error",a),e.removeListener("readable",o)}function c(){s(),Lm("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function a(p){s(),Lm("onerror %o",p),n(p)}function l(p){i.push(p),r+=p.length;let u=Buffer.concat(i,r),d=u.indexOf(`\r
27
+ \r
28
+ `);if(d===-1){Lm("have not received end of HTTP headers yet..."),o();return}let m=u.subarray(0,d).toString("ascii").split(`\r
29
+ `),_=m.shift();if(!_)return e.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=_.split(" "),b=+(h[1]||0),R=h.slice(2).join(" "),M={};for(let v of m){if(!v)continue;let N=v.indexOf(":");if(N===-1)return e.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${v}"`));let P=v.slice(0,N).toLowerCase(),D=v.slice(N+1).trimStart(),I=M[P];typeof I=="string"?M[P]=[I,D]:Array.isArray(I)?I.push(D):M[P]=D}Lm("got proxy server response: %o %o",_,M),s(),t({connect:{statusCode:b,statusText:R,headers:M},buffered:u})}e.on("error",a),e.on("end",c),o()})}function ip(...e){g.log("[https-proxy-agent]",...e)}var op=class extends km{constructor(t,n){super(n),this.options={},this.proxy=typeof t=="string"?new URL(t):t,this.proxyHeaders=n?.headers??{},ip("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),i=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?BL(n,"headers"):null,host:r,port:i}}async connect(t,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let i;if(r.protocol==="https:"){ip("Creating `tls.Socket`: %o",this.connectOpts);let d=this.connectOpts.servername||this.connectOpts.host;i=qS.connect({...this.connectOpts,servername:d&&Ci.isIP(d)?void 0:d})}else ip("Creating `net.Socket`: %o",this.connectOpts),i=Ci.connect(this.connectOpts);let o=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},s=Ci.isIPv6(n.host)?`[${n.host}]`:n.host,c=`CONNECT ${s}:${n.port} HTTP/1.1\r
30
+ `;if(r.username||r.password){let d=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(d).toString("base64")}`}o.Host=`${s}:${n.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let d of Object.keys(o))c+=`${d}: ${o[d]}\r
31
+ `;let a=DL(i);i.write(`${c}\r
32
+ `);let{connect:l,buffered:p}=await a;if(t.emit("proxyConnect",l),this.emit("proxyConnect",l,t),l.statusCode===200){if(t.once("socket",NK),n.secureEndpoint){ip("Upgrading socket connection to TLS");let d=n.servername||n.host;return qS.connect({...BL(n,"host","path","port"),socket:i,servername:Ci.isIP(d)?void 0:d})}return i}i.destroy();let u=new Ci.Socket({writable:!1});return u.readable=!0,t.once("socket",d=>{ip("Replaying proxy buffer for failed request"),d.push(p),d.push(null)}),u}};op.protocols=["http","https"];function NK(e){e.resume()}function BL(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var xK=1024*32;function PK(e){return new OK({read(){this.push(e),this.push(null)}})}function Mm(e){let t;try{t=new URL(e.url)}catch{return Me(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),pa(e,()=>Promise.resolve({}))}let n=t.protocol==="https:",r=kK(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?RK:vK,o=e.keepAlive===void 0?!1:e.keepAlive,s=r?new op(r):new i.Agent({keepAlive:o,maxSockets:30,timeout:2e3}),c=LK(e,e.httpModule??i,s);return pa(e,c)}function kK(e,t){let{no_proxy:n}=process.env;if(!n?.split(",").some(i=>e.host.endsWith(i)||e.hostname.endsWith(i)))return t}function LK(e,t,n){let{hostname:r,pathname:i,port:o,protocol:s,search:c}=new URL(e.url);return function(l){return new Promise((p,u)=>{Bn(()=>{let d=PK(l.body),m={...e.headers};l.body.length>xK&&(m["content-encoding"]="gzip",d=d.pipe(CK()));let _=r.startsWith("["),h=t.request({method:"POST",agent:n,headers:m,hostname:_?r.slice(1,-1):r,path:`${i}${c}`,port:o,protocol:s,ca:e.caCerts},b=>{b.on("data",()=>{}),b.on("end",()=>{}),b.setEncoding("utf8");let R=b.headers["retry-after"]??null,M=b.headers["x-sentry-rate-limits"]??null;p({statusCode:b.statusCode,headers:{"retry-after":R,"x-sentry-rate-limits":Array.isArray(M)?M[0]||null:M}})});h.on("error",u),d.pipe(h)})})}}function HL(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=qo(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 MK,sep as wK}from"path";function FL(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function wm(e=process.argv[1]?xb(process.argv[1]):process.cwd(),t=wK==="\\"){let n=t?FL(e):e;return r=>{if(!r)return;let i=t?FL(r):r,{dir:o,base:s,ext:c}=MK.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(s=s.slice(0,c.length*-1));let a=decodeURIComponent(s);o||(o=".");let l=o.lastIndexOf("/node_modules");if(l>-1)return`${o.slice(l+14).replace(/\//g,".")}:${a}`;if(o.startsWith(n)){let p=o.slice(n.length+1).replace(/\//g,".");return p?`${p}:${a}`:a}return a}}function Gm(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 Um=nu(Ry(wm()));st();import*as WL from"os";import{threadId as GK,isMainThread as UK}from"worker_threads";var DK=6e4,qa=class extends Ll{constructor(t){let n=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||WL.hostname(),r={...t,platform:"node",runtime:t.runtime||{name:"node",version:global.process.version},serverName:n};t.openTelemetryInstrumentations&&Da({instrumentations:t.openTelemetryInstrumentations}),Qo(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${UK?"main":`worker-${GK}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{aa(this)},n&&this.on("beforeCaptureLog",i=>{i.attributes={...i.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener)),this._metricsOnExitFlushListener=()=>{ca(this)},process.on("beforeExit",this._metricsOnExitFlushListener),Sh(this)}get tracer(){if(this._tracer)return this._tracer;let t="@sentry/node",n=q,r=he.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(()=>{We&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},t.clientReportFlushInterval??DK).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){mb(),super._setupIntegrations()}_getTraceInfoFromScope(t){return t?DS(this,t):[void 0,void 0]}};var jL=Jp(pS(),1);import*as ZL from"module";var VL;function YL(){return Ya>=21||Ya===20&&uS>=6||Ya===18&&uS>=19?!0:(VL||(VL=!0,Me(()=>{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 sp(){if(YL()&&!te._sentryEsmLoaderHookRegistered){te._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,jL.createAddHookMessageChannel)();ZL.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 Dm(){return[al(),sl(),cl(),ll(),Pm(),Db(),xm(),vk(),kk(),vm(),Rm(),Sm(),Am(),ym(),bm(),Om(),Nm()]}function QS(e={}){return BK(e,Dm)}function BK(e={},t){let n=HK(e,t);n.debug===!0&&(We?g.enable():Me(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&sp(),HS(n),ne().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:o})=>o===ZS)&&n.integrations.push(Cm({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Qo(n,"node-core");let i=new qa(n);return ne().setClient(i),i.init(),g.log("SDK initialized from ESM"),i.startClientReportTracking(),VK(),MS(i),BS(i),process.env.VERCEL&&process.on("SIGTERM",async()=>{await i.flush(200)}),i}function Bm(){if(!We)return;let e=GS(),t=["SentryContextManager","SentryPropagator"],n=e.includes("SentryTracerProvider");Ue()&&!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 HK(e,t){let n=FK(e.release),r=HL(e.spotlight),i=WK(e.tracesSampleRate),o={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??Mm,stackParser:S_(e.stackParser||Um),release:n,tracesSampleRate:i,spotlight:r,debug:qo(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,c=e.defaultIntegrations??t(o),a=$h({defaultIntegrations:c,integrations:s});return{...o,integrations:a}}function FK(e){if(e!==void 0)return e;let t=Gm();if(t!==void 0)return t}function WK(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 VK(){if(qo(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Tn(e,t);ne().setPropagationContext(n)}}var XL=e=>{let t;return t=!1,{package:e,"javascript.is_cjs":t}};function gr(e,t){let n=C()?.getOptions();!n?.disableInstrumentationWarnings&&!(w(e)||typeof Ar(e)=="function")&&Xo()&&Ue(n)&&(Me(()=>{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/.`)}),Uo().setContext("missing_instrumentation",XL(t)))}import{types as YK}from"util";import{Worker as jK}from"worker_threads";var{isPromise:ZK}=YK,XK="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc2LjIgKDA0MmUyMjgpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyB0fWZyb20ibm9kZTppbnNwZWN0b3IiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIG4scGFyZW50UG9ydCBhcyBlfWZyb20ibm9kZTp3b3JrZXJfdGhyZWFkcyI7aW1wb3J0e3Bvc2l4IGFzIHIsc2VwIGFzIG99ZnJvbSJub2RlOnBhdGgiO2ltcG9ydCphcyBpIGZyb20ibm9kZTpodHRwIjtpbXBvcnQqYXMgcyBmcm9tIm5vZGU6aHR0cHMiO2ltcG9ydHtSZWFkYWJsZSBhcyBjfWZyb20ibm9kZTpzdHJlYW0iO2ltcG9ydHtjcmVhdGVHemlwIGFzIHV9ZnJvbSJub2RlOnpsaWIiO2ltcG9ydCphcyBhIGZyb20ibm9kZTpuZXQiO2ltcG9ydCphcyBmIGZyb20ibm9kZTp0bHMiO2NvbnN0IGg9InVuZGVmaW5lZCI9PXR5cGVvZi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b24pKSx0LmRlYnVnSW1hZ2VzJiYocG49dC5kZWJ1Z0ltYWdlcyksd24oKX0pOw==",KK=50,qK=5e3;function JS(e,...t){g.log(`[ANR] ${e}`,...t)}function QK(){return te}function JK(){let e=Nn(J(),ne());return e.attachments=[],e.eventProcessors=[],e}async function $K(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 KL="Anr",zK=((e={})=>{if(zt.major<16||zt.major===16&&zt.minor<17)throw new Error("ANR detection requires Node 16.17.0 or later");let t,n,r=QK();return r.__SENTRY_GET_SCOPES__=JK,{name:KL,startWorker:()=>{t||n&&(t=e9(n,e))},stopWorker:()=>{t&&t.then(i=>{i(),t=void 0})},async setup(i){n=i,e.captureStackTrace&&await Ka()&&(g.warn("ANR captureStackTrace has been disabled because the debugger was already enabled"),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}),qL=zK;async function e9(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await $K(e);delete r.app?.app_memory,delete r.device?.free_memory;let i=e.getOptions(),o=e.getSdkMetadata()||{};o.sdk&&(o.sdk.integrations=i.integrations.map(l=>l.name));let s={debug:g.isEnabled(),dsn:n,tunnel:i.tunnel,environment:i.environment||"production",release:i.release,dist:i.dist,sdkMetadata:o,appRootPath:t.appRootPath,pollInterval:t.pollInterval||KK,anrThreshold:t.anrThreshold||qK,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 jK(new URL(`data:application/javascript;base64,${XK}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{c.terminate()});let a=setInterval(()=>{try{let l=J().getSession(),p=l?{...l,toJSON:void 0}:void 0;c.postMessage({session:p,debugImages:Kc(i.stackParser)})}catch{}},s.pollInterval);return a.unref(),c.on("message",l=>{l==="session-ended"&&(JS("ANR event sent from ANR worker. Clearing session in this thread."),J().setSession(void 0))}),c.once("error",l=>{clearInterval(a),JS("ANR worker error",l)}),c.once("exit",l=>{clearInterval(a),JS("ANR worker exit",l)}),c.unref(),()=>{c.terminate(),clearInterval(a)}}function QL(e){let t=C()?.getIntegrationByName(KL);if(!t)return e();t.stopWorker();let n=e();return ZK(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}var $S={};$N($S,{debug:()=>r9,error:()=>s9,fatal:()=>a9,fmt:()=>hb,info:()=>i9,trace:()=>n9,warn:()=>o9});import{format as t9}from"util";function xi(e,...t){let[n,r,i,o]=t;if(Array.isArray(r)){let s={...i};s["sentry.message.template"]=n,r.forEach((a,l)=>{s[`sentry.message.parameter.${l}`]=a});let c=t9(n,...r);cr({level:e,message:c,attributes:s},o?.scope)}else cr({level:e,message:n,attributes:r},i?.scope??o?.scope)}function n9(...e){xi("trace",...e)}function r9(...e){xi("debug",...e)}function i9(...e){xi("info",...e)}function o9(...e){xi("warn",...e)}function s9(...e){xi("error",...e)}function a9(...e){xi("fatal",...e)}import{monitorEventLoopDelay as c9,performance as zS}from"perf_hooks";var JL="NodeRuntimeMetrics",$L=3e4,Hm=1e3,zL=10;function eE(e,t,n){return Number.isFinite(e)?e<Hm?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${Hm}ms. Using minimum of ${Hm}ms.`),Hm):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var eM=(e={})=>{let t=eE(e.collectionIntervalMs??$L,JL,$L),n={cpuUtilization:!0,memHeapUsed:!0,memHeapTotal:!0,memRss:!0,eventLoopDelayP50:!0,eventLoopDelayP99:!0,eventLoopUtilization:!0,uptime:!0,cpuTime:!1,memExternal:!1,eventLoopDelayMin:!1,eventLoopDelayMax:!1,eventLoopDelayMean:!1,eventLoopDelayP90:!1,...e.collect},r=n.eventLoopDelayP99||n.eventLoopDelayMin||n.eventLoopDelayMax||n.eventLoopDelayMean||n.eventLoopDelayP50||n.eventLoopDelayP90,i=n.cpuUtilization||n.cpuTime,o,s,c,a=0,l,p=zL*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=tt(),R=b-a;if(i&&s!==void 0){let M=process.cpuUsage(s);n.cpuTime&&(dt.gauge("node.runtime.cpu.user",M.user/1e6,_),dt.gauge("node.runtime.cpu.system",M.system/1e6,_)),n.cpuUtilization&&R>0&&dt.gauge("node.runtime.cpu.utilization",(M.user+M.system)/(R*1e3),d),s=process.cpuUsage()}if(n.memRss||n.memHeapUsed||n.memHeapTotal||n.memExternal){let M=process.memoryUsage();n.memRss&&dt.gauge("node.runtime.mem.rss",M.rss,m),n.memHeapUsed&&dt.gauge("node.runtime.mem.heap_used",M.heapUsed,m),n.memHeapTotal&&dt.gauge("node.runtime.mem.heap_total",M.heapTotal,m),n.memExternal&&(dt.gauge("node.runtime.mem.external",M.external,m),dt.gauge("node.runtime.mem.array_buffers",M.arrayBuffers,m))}if(r&&l&&(n.eventLoopDelayMin&&dt.gauge("node.runtime.event_loop.delay.min",u(l.min),_),n.eventLoopDelayMax&&dt.gauge("node.runtime.event_loop.delay.max",u(l.max),_),n.eventLoopDelayMean&&dt.gauge("node.runtime.event_loop.delay.mean",u(l.mean),_),n.eventLoopDelayP50&&dt.gauge("node.runtime.event_loop.delay.p50",u(l.percentile(50)),_),n.eventLoopDelayP90&&dt.gauge("node.runtime.event_loop.delay.p90",u(l.percentile(90)),_),n.eventLoopDelayP99&&dt.gauge("node.runtime.event_loop.delay.p99",u(l.percentile(99)),_),l.reset()),n.eventLoopUtilization&&c!==void 0){let M=zS.eventLoopUtilization(),v=zS.eventLoopUtilization(M,c);dt.gauge("node.runtime.event_loop.utilization",v.utilization,d),c=M}n.uptime&&R>0&&dt.count("node.runtime.process.uptime",R/1e3,_),a=b}return{name:JL,setup(){if(r){l?.disable();try{l=c9({resolution:zL}),l.enable()}catch{l=void 0}}i&&(s=process.cpuUsage()),n.eventLoopUtilization&&(c=zS.eventLoopUtilization()),a=tt(),o&&clearInterval(o),o=Rn(setInterval(h,t))}}};var l9=["trace","debug","info","warn","error","fatal"],tM=Symbol.for("level"),p9=Symbol.for("message"),u9=Symbol.for("splat");function nM(e,t){class n extends e{constructor(i){super(i),this._levels=new Set(t?.levels??l9)}log(i,o){try{if(setImmediate(()=>{this.emit("logged",i)}),!B(i))return;let s=i[tM],{level:c,message:a,timestamp:l,...p}=i;p[tM]=void 0,p[p9]=void 0,p[u9]=void 0;let u=t?.customLevelMap?.[s],d=d9[s],m=u??d??"info";this._levels.has(m)?xi(m,a,{...p,"sentry.origin":"auto.log.winston"}):!u&&!d&&We&&g.log(`Winston log level ${s} is not captured by Sentry. Please add ${s} to the "customLevelMap" option of the Sentry Winston transport.`)}catch{}o&&o()}}return n}var d9={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 oM from"diagnostics_channel";var tE=Symbol("sentry-track-pino-logger");function rM(e,t,n){let r=Object.getOwnPropertySymbols(e),i=`Symbol(${t})`;for(let o of r)if(o.toString()===i){let s=e[o];return typeof s=="string"?s:n}return n}var iM={error:{levels:[],handled:!0},log:{levels:["trace","debug","info","warn","error","fatal"]}};function m9(e){let{level:t,time:n,pid:r,hostname:i,...o}=e;return o}var f9=(e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{...iM.error,...e.error},log:{...iM.log,...e.log}};function n(r){let i=r[tE];return i==="track"||i!=="ignore"&&t.autoInstrument}return{name:"Pino",setup:r=>{let i=!!r.getOptions().enableLogs,o=oM.tracingChannel("pino_asJson");function s(c,a,l){if(!n(c))return;let p=m9(l),[u,d,m]=a,_=c?.levels?.labels?.[m]||"info",h=rM(c,"pino.messageKey","msg"),b=d||p?.[h]||"";if(i&&t.log.levels.includes(_)){let R={...p,"sentry.origin":"auto.log.pino","pino.logger.level":m};cr({level:_,message:b,attributes:R})}if(t.error.levels.includes(_)){let R=rM(c,"pino.errorKey","err"),M={};for(let[N,P]of Object.entries(p))N!==R&&N!==h&&(M[N]=P);b&&(M[h]=b);let v={level:$i(_),contexts:{pino:M}};Be(N=>{N.addEventProcessor(D=>(D.logger="pino",Gn(D,{handled:t.error.handled,type:"auto.log.pino"}),D));let P=u[R];if(P){me(P,v);return}Qc(b,v)})}}o.end.subscribe(c=>{let{instance:a,arguments:l,result:p}=c;s(a,l,JSON.parse(p))})}}},sM=Object.assign(f9,{trackLogger(e){B(e)&&"levels"in e&&(e[tE]="track")},untrackLogger(e){B(e)&&"levels"in e&&(e[tE]="ignore")}});function nE(e,t){e.setAttribute(S,t)}var g9=[["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 us(e){return g9.reduce((t,[n,r])=>t.replace(new RegExp(n,"gi"),r),e)}var aM="Automatic instrumentation of CronJob only supports crontab string";function cM(e,t){let n=!1;return new Proxy(e,{construct(r,i){let[o,s,c,a,l,...p]=i;if(typeof o!="string")throw new Error(aM);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let u=us(o);async function d(m,_){return Br(t,async()=>{try{await s(m,_)}catch(h){throw me(h,{mechanism:{handled:!1,type:"auto.function.cron.instrumentCron"}}),h}},{schedule:{type:"crontab",value:u},timezone:l||void 0})}return new r(o,d,c,a,l,...p)},get(r,i){return i==="from"?o=>{let{cronTime:s,onTick:c,timeZone:a}=o;if(typeof s!="string")throw new Error(aM);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let l=us(s);return o.onTick=async(p,u)=>Br(t,async()=>{try{await c(p,u)}catch(d){throw me(d,{mechanism:{handled:!1,type:"auto.function.cron.instrumentCron"}}),d}},{schedule:{type:"crontab",value:l},timezone:a||void 0}),r.from(o)}:r[i]}})}function lM(e,t={}){return new Proxy(e,{get(n,r){return r==="schedule"&&n.schedule?new Proxy(n.schedule,{apply(i,o,s){let[c,a,l]=s,p=l?.name,u=l?.timezone;if(!p)throw new Error('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');let d=async(...m)=>Br(p,async()=>{try{return await a(...m)}catch(_){throw me(_,{mechanism:{handled:!1,type:"auto.function.node-cron.instrumentNodeCron"}}),_}},{schedule:{type:"crontab",value:us(c)},timezone:u,...t});return i.apply(o,[c,d,l])}}):n[r]}})}function pM(e){return new Proxy(e,{get(t,n){return n==="scheduleJob"?new Proxy(t.scheduleJob,{apply(r,i,o){let[s,c,a]=o;if(typeof s!="string"||typeof c!="string"||typeof a!="function")throw new Error("Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string");let l=s,p=c;async function u(){return Br(l,async()=>{await a?.()},{schedule:{type:"crontab",value:us(p)}})}return r.apply(i,[l,p,u])}}):t[n]}})}var uM={instrumentCron:cM,instrumentNodeCron:lM,instrumentNodeSchedule:pM};var dM="Http",mM=Object.assign(ss,{id:`${dM}.sentry`}),rE=(e={})=>{let t=e.spans??!0,n=e.disableIncomingRequestSpans,r=t&&!n,i={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},o={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},s=wa(i),c=Ga(o);return{name:dM,setup(a){let l=a.getOptions();r&&Ue(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=mr(p);if(u.startsWith("data:")){let d=il(u);l.setAttribute("http.url",d),l.setAttribute(lt,d),l.updateName(`${p.method||"GET"} ${d}`)}e.instrumentation?.requestHook?.(l,p)},outgoingResponseHook:e.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:e.instrumentation?.applyCustomAttributesOnSpan};ss(a)},processEvent(a){return c.processEvent(a)}}};var _9=((e={})=>({name:"NodeFetch",setupOnce(){let t=C()?.getOptions();Kl({...e,spans:h9(e,t)})}})),iE=_9;function h9(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&Ue(t))}import*as Wm from"fs";import{promisify as y9}from"util";var fM=["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"],gM=["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"],_M=["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 b9(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 oE(e,t){if(!t)throw new Error(JSON.stringify({member:t}));let n=b9(t),[r,i]=n;return i?{objectToPatch:e[r],functionNameToPatch:i}:{objectToPatch:e,functionNameToPatch:r}}var S9="auto.file.fs",E9="file",T9=["rename","renameSync"],I9=["copyFile","cp","copyFileSync","cpSync"],A9=["link","linkSync"],N9=["mkdtemp","mkdtempSync"],v9=["symlink","symlinkSync"],R9=["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 Vm(e,t,n){let r={[H]:E9,[S]:S9};return n.recordFilePaths&&(typeof t[0]=="string"&&R9.includes(e)?r.path_argument=t[0]:typeof t[0]=="string"&&typeof t[1]=="string"?v9.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):A9.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):I9.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):T9.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]=="string"&&N9.includes(e)&&(r.prefix_argument=t[0])),r}function Ym(e,t){return Object.assign(e,t)}var hM=new WeakMap;function Fm(e,t,n){let r=e[t];if(typeof r!="function")return;let i=hM.get(e);i||(i=new Set,hM.set(e,i)),!i.has(t)&&(i.add(t),e[t]=n(r))}function O9(e,t,n){return Ym(function(...i){let o=Vm(e,i,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:o},s=>{try{return Bn(()=>t.apply(this,i))}catch(c){throw ap(s,c,n),c}})},t)}function C9(e,t,n){return Ym(function(...i){let o=i.length-1,s=i[o];if(typeof s!="function")return t.apply(this,i);let c=Vm(e,i,n),a=k({name:`fs.${e}`,onlyIfParent:!0,attributes:c}),l=Q();i[o]=function(...p){let u=p[0];return u&&ap(a,u,n),a.end(),l?se(l,()=>s.apply(this,p)):s.apply(this,p)};try{return Bn(()=>t.apply(this,i))}catch(p){throw ap(a,p,n),a.end(),p}},t)}function x9(e,t){let n="exists",i=Ym(function(...s){let c=s.length-1,a=s[c];if(typeof a!="function")return e.apply(this,s);let l=Vm(n,s,t),p=k({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 Bn(()=>e.apply(this,s))}catch(d){throw ap(p,d,t),p.end(),d}},e),o=function(s){return new Promise(c=>i(s,c))};return Object.defineProperty(o,"name",{value:n}),Object.defineProperty(i,y9.custom,{value:o}),i}function P9(e,t,n){return Ym(async function(...i){let o=Vm(e,i,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:o},async s=>{try{return await Bn(()=>t.apply(this,i))}catch(c){throw ap(s,c,n),c}})},t)}function bM(e={}){for(let n of _M){let{objectToPatch:r,functionNameToPatch:i}=oE(Wm,n);Fm(r,i,o=>O9(n,o,e))}for(let n of gM){let{objectToPatch:r,functionNameToPatch:i}=oE(Wm,n);n==="exists"?Fm(r,i,o=>x9(o,e)):Fm(r,i,o=>C9(n,o,e))}let t=Wm.promises;for(let n of fM)Fm(t,n,r=>P9(n,r,e))}function ap(e,t,n){e.setStatus({code:2,message:"internal_error"}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute("fs_error",t.message)}var k9="FileSystem",L9=(e={})=>({name:k9,setupOnce(){bM(e)}});var Ye=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function ei(e){let t=Q();if(!t)return;let n=Re(t);n&&oe(n).data[H]==="http.server"&&n.setAttribute("http.route",e)}var yM="Express",M9=[">=4.0.0 <6"];function w9(e,t){Py(e,t),gr(e.use,"express")}var aE=de(yM,e=>new sE(e)),sE=class extends ae{constructor(t={}){super("sentry-express",q,t)}init(){return new re("express",M9,n=>{try{Cy(n,()=>({...this.getConfig(),onRouteResolved(r){r&&ei(r)}}))}catch(r){Ye&&g.error("Failed to patch express module:",r)}return n},n=>n)}},G9=(e=>({name:yM,setupOnce(){aE(e)},getShouldHandleError(){return e?.shouldHandleError}})),cE=G9;st();var po=(e=>(e.FASTIFY_NAME="fastify.name",e.FASTIFY_TYPE="fastify.type",e.HOOK_NAME="hook.name",e.PLUGIN_NAME="plugin.name",e))(po||{}),jm=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(jm||{}),Zm=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request handler",e))(Zm||{});st();var cp=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function lE(e,t,n,r={}){let i=t.startSpan(n,{attributes:r}),o=e[cp]||[];return o.push(i),Object.defineProperty(e,cp,{enumerable:!1,configurable:!0,value:o}),i}function Xm(e,t){let n=e[cp]||[];n.length&&(n.forEach(r=>{t&&(r.setStatus({code:Mn.ERROR,message:t.message}),r.recordException(t)),r.end()}),delete e[cp])}function EM(e,t,n){let r,i;try{i=e(),SM(i)&&i.then(o=>t(void 0,o),o=>t(o))}catch(o){r=o}finally{if(!SM(i)&&(t(r,i),r))throw r;return i}}function SM(e){return typeof e=="object"&&e&&typeof Object.getOwnPropertyDescriptor(e,"then")?.value=="function"||!1}var U9="@sentry/instrumentation-fastify-v3",TM="anonymous",D9=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),Km=class extends ae{constructor(t={}){super(U9,q,t)}init(){return[new re("fastify",[">=3.0.0 <3.21.0"],t=>this._patchConstructor(t))]}_hookOnRequest(){let t=this;return function(r,i,o){if(!t.isEnabled())return o();t._wrap(i,"send",t._patchSend());let s=r,c=s.routeOptions?s.routeOptions.url:r.routerPath;c&&ei(c);let a=r.method||"GET";J().setTransactionName(`${a} ${c}`),o()}}_wrapHandler(t,n,r,i){let o=this;return this._diag.debug("Patching fastify route.handler function"),function(...s){if(!o.isEnabled())return r.apply(this,s);let c=r.name||t||TM,a=`${Zm.MIDDLEWARE} - ${c}`,l=s[1],p=lE(l,o.tracer,a,{[po.FASTIFY_TYPE]:jm.MIDDLEWARE,[po.PLUGIN_NAME]:t,[po.HOOK_NAME]:n}),u=i&&s[s.length-1];return u&&(s[s.length-1]=function(...d){Xm(l),u.apply(this,d)}),pe.with(he.setSpan(pe.active(),p),()=>EM(()=>r.apply(this,s),d=>{d instanceof Error&&(p.setStatus({code:Mn.ERROR,message:d.message}),p.recordException(d)),i||Xm(l)}))}}_wrapAddHook(){let t=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...i){let o=i[0],s=i[1],c=this.pluginName;if(!D9.has(o))return n.apply(this,i);let a=typeof i[i.length-1]=="function"&&s.constructor.name!=="AsyncFunction";return n.apply(this,[o,t._wrapHandler(c,o,s,a)])}}}_patchConstructor(t){let n=this;function r(...i){let o=t.fastify.apply(this,i);return o.addHook("onRequest",n._hookOnRequest()),o.addHook("preHandler",n._hookPreHandler()),B9(),n._wrap(o,"addHook",n._wrapAddHook()),o}return t.errorCodes!==void 0&&(r.errorCodes=t.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let t=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...o){let s=o[0];return t.isEnabled()?Jr(()=>r.apply(this,o),c=>{!c&&s instanceof Error&&(c=s),Xm(this,c)}):r.apply(this,o)}}}_hookPreHandler(){let t=this;return this._diag.debug("Patching fastify preHandler function"),function(r,i,o){if(!t.isEnabled())return o();let s=r,c=s.routeOptions?.handler||s.context?.handler,a=c?.name.startsWith("bound ")?c.name.substring(6):c?.name,l=`${Zm.REQUEST_HANDLER} - ${a||this.pluginName||TM}`,p={[po.PLUGIN_NAME]:this.pluginName,[po.FASTIFY_TYPE]:jm.REQUEST_HANDLER,[He]:s.routeOptions?s.routeOptions.url:r.routerPath};a&&(p[po.FASTIFY_NAME]=a);let u=lE(i,t.tracer,l,p);IM(u);let{requestHook:d}=t.getConfig();return d&&Jr(()=>d(u,{request:r}),m=>{m&&t._diag.error("request hook failed",m)},!0),pe.with(he.setSpan(pe.active(),u),()=>{o()})}}};function B9(){let e=C();e&&e.on("spanStart",t=>{IM(t)})}function IM(e){let t=oe(e).data,n=t["fastify.type"];if(t[H]||!n)return;e.setAttributes({[S]:"auto.http.otel.fastify",[H]:`${n}.fastify`});let r=t["fastify.name"]||t["plugin.name"]||t["hook.name"];if(typeof r=="string"){let i=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(i)}}import*as mE from"diagnostics_channel";var AM="execute_tool";var NM="invoke_agent";var Pi="graphql";var $=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var uE=()=>{};function ee(e,t,n){let r=H9(e,t,n),i=n?.beforeSpanEnd,o=n?.deferSpanEnd,s=p=>typeof n?.captureError=="function"?n.captureError(p):{mechanism:{type:"auto.diagnostic_channels.bind_span",handled:!1}},c=(p,u)=>{n?.captureError&&me(u,s(u));let{message:d,attributes:m}=F9(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),pE(u,i))}},l={start:uE,asyncStart:uE,end(p){if("error"in p||"result"in p){let u=p._sentrySpan;if(u&&o?.({span:u,data:p,end:a(u,p)}))return;pE(p,i)}},error(p){let u=p._sentrySpan;u&&c(u,p.error)},asyncEnd(p){let u=p._sentrySpan;u&&o?.({span:u,data:p,end:a(u,p)})||pE(p,i)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function H9(e,t,n){let r=bt(Je()).getTracingChannelBinding?.();if(!r)return $&&g.log("[TracingChannel] Could not access async context binding."),{channel:e,unbind:uE};let i=r.asyncLocalStorage;return e.start.bindStore(i,o=>{o._sentryCallerStore=i.getStore();let c=!n?.requiresParentSpan||Q()?t(o):void 0;return c?(o._sentrySpan=c,r.getStoreWithActiveSpan(c)):o._sentryCallerStore}),e.asyncStart.bindStore(i,o=>o._sentryCallerStore),{channel:e,unbind:()=>{e.start.unbindStore(i),e.asyncStart.unbindStore(i)}}}function pE(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function F9(e){let t=B(e),n=t?"message"in e?e.message:void 0:e,r=n?String(n):void 0,i=t&&"name"in e?String(e.name):"unknown";return{message:r,attributes:{[Mr]:i}}}var dE="original-description",W9=new Set(["Int","Float","String","BlockString"]);function qm(e,t,n){let r=Re(e);if(r===e)return;let i=oe(r),o=n?`${t} ${n}`:t,s=i.data[Lh],c;Array.isArray(s)?c=[...s,o]:typeof s=="string"?c=[s,o]:c=o,r.setAttribute(Lh,c);let a=i.data[dE]??i.description;i.data[dE]||r.setAttribute(dE,a),r.updateName(`${a} (${V9(c)})`)}function V9(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 Qm(e,t,n){return e&&t?`${e} ${t}`:e||n}function Jm(e){if(B(e)&&"errors"in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function Y9(e){let t=e?.loc,n=t?.source?.body;if(!(typeof n!="string"||!t?.startToken))try{let r=[];for(let o=t.startToken;o;o=o.next)W9.has(o.kind)&&r.push({start:o.start,end:o.end,kind:o.kind});let i=n;for(let o=r.length-1;o>=0;o--){let{start:s,end:c,kind:a}=r[o],l=a==="String"||a==="BlockString"?'"*"':"*";i=i.slice(0,s)+l+i.slice(c)}return i}catch{return}}function Qa(e){if(C()?.getDataCollectionOptions().graphQL.document===!0)return Y9(e)}var j9="graphql:parse",Z9="graphql:validate",X9="graphql:execute",K9="graphql:subscribe",q9="graphql:resolve",$m="auto.graphql.diagnostic_channel",Q9="graphql.parse",J9="graphql.validate",$9="graphql.execute",z9="graphql.subscribe",eq="graphql.resolve",tq="graphql.field.name",nq="graphql.field.path",rq="graphql.field.type",iq="graphql.parent.name";function RM(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,i=t.useOperationNameForRootSpan!==!1;oq(e),sq(e),vM(e,X9,$9,i),vM(e,K9,z9,i),n||aq(e,r)}function oq(e){ee(e(j9),()=>k({name:Q9,attributes:{[S]:$m,[H]:Pi}}))}function sq(e){ee(e(Z9),t=>k({name:J9,attributes:{[S]:$m,[H]:Pi,[ta]:Qa(t.document)}}),{beforeSpanEnd:(t,n)=>{Array.isArray(n.result)&&n.result.length>0&&t.setStatus({code:2,message:"invalid_argument"})}})}function vM(e,t,n,r){ee(e(t),i=>{let o=k({name:Qm(i.operationType,i.operationName,n),attributes:{[S]:$m,[H]:Pi,[Cu]:i.operationType,[Ou]:i.operationName||void 0,[ta]:Qa(i.document)}});return r&&i.operationType&&qm(o,i.operationType,i.operationName),o},{beforeSpanEnd:(i,o)=>{Jm(o.result)&&i.setStatus({code:2,message:"internal_error"})}})}function aq(e,t){ee(e(q9),n=>{if(!(t&&n.isDefaultResolver))return k({name:`${eq} ${n.fieldPath}`,attributes:{[S]:$m,[H]:Pi,[tq]:n.fieldName,[nq]:n.fieldPath,[rq]:n.fieldType,[iq]:n.parentType}})})}var cq=((e={})=>({name:"Graphql",setupOnce(){mE.tracingChannel&&ue(()=>{RM(mE.tracingChannel,e)})}})),lp=cq;import*as gE from"diagnostics_channel";var lq="mongoose:query",pq="mongoose:aggregate",uq="mongoose:model:save",dq="mongoose:model:insertMany",mq="mongoose:model:bulkWrite",fq="mongoose:cursor:next",gq="auto.db.mongoose.diagnostic_channel",_q="mongodb",hq=10,OM=!1;function zm(e){if(!OM){OM=!0;try{Ja(e,lq),Ja(e,pq),Ja(e,uq),Ja(e,dq),Ja(e,mq),Ja(e,fq)}catch{$&&g.log("Mongoose node:diagnostics_channel subscription failed.")}}}function Ja(e,t){ee(e(t),n=>{let r=n.collection,i=yq(n.args?.pipeline??n.args?.filter),o=bq(n);return k({name:r?`mongoose.${r}.${n.operation}`:`mongoose.${n.operation}`,attributes:{[S]:gq,[H]:"db",[ut]:_q,[sr]:n.operation,[$s]:r??void 0,[_i]:n.database??void 0,[Lr]:i??void 0,[ea]:o??void 0,[ft]:n.serverAddress??void 0,[gt]:n.serverPort??void 0}})})}function bq(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 yq(e){if(e!=null)try{let t=fE(e,0),n=JSON.stringify(t);return n==null||n==="{}"||n==="[]"?void 0:n}catch{return}}function fE(e,t){if(t>hq)return"?";if(Array.isArray(e))return e.map(n=>fE(n,t+1));if(B(e)){let n={};for(let r of Object.keys(e))n[r]=fE(e[r],t+1);return n}return"?"}var Sq=(()=>({name:"Mongoose",setupOnce(){gE.tracingChannel&&ue(()=>{zm(gE.tracingChannel)})}})),_E=Sq;var Eq="db.system",Tq="db.name",CM="db.operation",Iq="db.statement",Aq="db.mongodb.collection",Nq="db.connection_string",vq="net.peer.name",Rq="net.peer.port",Oq="mongodb";function Cq(e){return JSON.stringify(hE(e))}function hE(e){if(Array.isArray(e))return e.map(t=>hE(t));if(xq(e)){let t={};return Object.entries(e).map(([n,r])=>[n,hE(r)]).reduce((n,r)=>(kq(r)&&(n[r[0]]=r[1]),n),t)}return"?"}function xq(e){return B(e)&&!Pq(e)}function Pq(e){return typeof Buffer<"u"&&Buffer.isBuffer(e)}function kq(e){return Array.isArray(e)}function pp(e,t,n,r,i){let o,s;if(e){let a=typeof e.address=="string"?e.address.split(":"):"";a.length===2&&(o=a[0],s=a[1])}let c;return n?.documents?.[0]?c=n.documents[0]:n?.cursors?c=n.cursors:c=n,xM(t.db,t.collection,o,s,c,r,i)}function xM(e,t,n,r,i,o,s){let c={[S]:s,[Eq]:Oq,[Tq]:e,[Aq]:t,[CM]:o,[Nq]:`mongodb://${n}:${r}/${e}`};if(n&&r){c[vq]=n;let a=parseInt(r,10);isNaN(a)||(c[Rq]=a)}if(i)try{c[Iq]=Cq(i)}catch{}return c}function up(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 dp(e,t,n,r,i){let o,s;if(t?.s&&(o=t.s.options?.host??t.s.host,s=(t.s.options?.port??t.s.port)?.toString(),o==null||s==null)){let p=t.description?.address;if(p){let u=p.split(":");o=u[0],s=u[1]}}let[c,a]=e.toString().split("."),l=n?.query??n?.q??n;return xM(c,a,o,s,l,r,i)}function _r(e){return k({name:`mongodb.${e[CM]||"command"}`,op:"db",kind:U.CLIENT,attributes:e})}import*as bE from"diagnostics_channel";var Lq="mysql2:query",Mq="mysql2:execute",wq="mysql2:connect",Gq="mysql2:pool:connect",LM="auto.db.mysql2.diagnostic_channel",MM="mysql",Uq=/^\s*(\w+)/;function ef(e){PM(e,Lq),PM(e,Mq),kM(e,wq,"mysql2.connect"),kM(e,Gq,"mysql2.pool.connect")}function PM(e,t){ee(e(t),n=>{let r=n.query?La(n.query):void 0,i=r?.match(Uq)?.[1]?.toUpperCase();return k({name:r||"mysql2.query",attributes:{[S]:LM,[H]:"db",[ut]:MM,[Lr]:r,[sr]:i,[_i]:n.database||void 0,[ft]:n.serverAddress,[gt]:n.serverPort}})},{requiresParentSpan:!0})}function kM(e,t,n){ee(e(t),r=>k({name:n,attributes:{[S]:LM,[H]:"db",[ut]:MM,[_i]:r.database||void 0,[ft]:r.serverAddress,[gt]:r.serverPort}}),{requiresParentSpan:!0})}var Dq=(()=>({name:"Mysql2",setupOnce(){bE.tracingChannel&&ue(()=>{ef(bE.tracingChannel)})}})),yE=Dq;var Bq="PRISMA_INSTRUMENTATION",Hq="V7_PRISMA_INSTRUMENTATION",wM=globalThis;function GM(e){let t={helper:e};wM[Hq]=t,wM[Bq]=t}var Fq=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES==="true"}catch{return!1}})(),Wq="00-10-10-00",Vq="auto.db.otel.prisma",DM=1e3,SE=new Ft(DM),$a=[];function EE(e,t){SE.set(e,t)}function TE(e,t){let n={...t,[S]:Vq};return e==="prisma:engine:db_query"&&n[Pe]==null&&(n[Pe]="prisma"),n}function IE(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 Yq(){let e=!0;for(;e;){e=!1;for(let t=$a.length-1;t>=0;t--){let n=$a[t],r=SE.get(n.parent_span_id);if(!r)continue;let i=TE(n.name,n.attributes),o=k({name:IE(n.name,i),attributes:i,kind:n.kind==="client"?U.CLIENT:U.INTERNAL,startTime:n.start_time,parentSpan:r});EE(n.span_id,o),n.links&&o.addLinks(n.links.flatMap(s=>{let c=SE.get(s.span_id);return c?[{context:c.spanContext()}]:[]})),o.end(n.end_time),$a.splice(t,1),e=!0}}}var tf=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}`:Wq}dispatchEngineSpans(t){let n=new Map,r=t.filter(i=>i.parentId===null);for(let i of r)BM(i,t,n,this.ignoreSpanTypes)}createEngineSpan(t){$a.push(...t.spans),Yq();let n=$a.length-DM;n>0&&($&&g.log(`[Prisma] Dropping ${n} unresolved v5 engine span(s) whose parent was never registered.`),$a.splice(0,n))}getActiveContext(){return Q()}runInChildSpan(t,n){let r=typeof t=="string"?{name:t}:t;if(r.internal&&!Fq)return n();let i=`prisma:client:${r.name}`;if(HM(i,this.ignoreSpanTypes))return n();let o=Q(),s=TE(i,r.attributes),c={name:IE(i,s),attributes:s,kind:r.kind,links:r.links,startTime:r.startTime,parentSpan:o};if(r.active===!1){let a=k(c);return EE(a.spanContext().spanId,a),UM(a,()=>n(a,o))}return ke(c,a=>(EE(a.spanContext().spanId,a),UM(a,()=>n(a,o))))}};function BM(e,t,n,r){if(HM(e.name,r))return;let i=TE(e.name,e.attributes);ke({name:IE(e.name,i),attributes:i,kind:e.kind==="client"?U.CLIENT:U.INTERNAL,startTime:e.startTime},o=>{n.set(e.id,o.spanContext().spanId),e.links&&o.addLinks(e.links.flatMap(c=>{let a=n.get(c);return a?{context:{spanId:a,traceId:o.spanContext().traceId,traceFlags:o.spanContext().traceFlags}}:[]}));let s=t.filter(c=>c.parentId===e.id);for(let c of s)BM(c,t,n,r);o.end(e.endTime)})}function UM(e,t){let n;try{n=t()}catch(r){throw e.end(),r}return jq(n)?n.then(r=>(e.end(),r),r=>{throw e.end(),r}):(e.end(),n)}function jq(e){return e!=null&&typeof e.then=="function"}function HM(e,t){return t.some(n=>typeof n=="string"?n===e:n.test(e))}var Zq="Prisma";function FM(e){GM(new tf({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var Xq=(e=>({name:Zq,setupOnce(){FM(e)}})),nf=Xq;import*as vE from"diagnostics_channel";var Kq="node-redis:command",qq="node-redis:batch",Qq="node-redis:connect",Jq="ioredis:command",$q="ioredis:connect",AE="auto.db.redis.diagnostic_channel",NE="redis";function YM(e,t){WM(e,Kq,n=>n.args.slice(1),t),zq(e,qq,n=>n.batchMode==="PIPELINE"?"PIPELINE":"MULTI"),VM(e,Qq),WM(e,Jq,n=>n.args,t),VM(e,$q)}function WM(e,t,n,r){ee(e(t),i=>{let o=n(i),s=o.length?`${i.command} ${o.join(" ")}`:i.command;return k({name:`redis-${i.command}`,attributes:{[S]:AE,[H]:"db.redis",[ut]:NE,[Lr]:s,...i.serverAddress!=null?{[ft]:i.serverAddress}:{},...i.serverPort!=null?{[gt]:i.serverPort}:{}}})},{beforeSpanEnd(i,o){"error"in o||e4(r,i,o.command,n(o),o.result)}})}function zq(e,t,n){ee(e(t),r=>k({name:n(r),attributes:{[S]:AE,[H]:"db.redis",[ut]:NE,...Number(r.batchSize)>1?{[ea]:r.batchSize}:{},...r.serverAddress!=null?{[ft]:r.serverAddress}:{},...r.serverPort!=null?{[gt]:r.serverPort}:{}}}))}function VM(e,t){ee(e(t),n=>k({name:"redis-connect",attributes:{[S]:AE,[H]:"db.redis.connect",[ut]:NE,...n.serverAddress!=null?{[ft]:n.serverAddress}:{},...n.serverPort!=null?{[gt]:n.serverPort}:{}}}))}function e4(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}var t4=((e={})=>({name:"Redis",setupOnce(){vE.tracingChannel&&ue(()=>{YM(vE.tracingChannel,e.responseHook)})}})),RE=t4;var n4=[{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}],ti=(e,t)=>{if(Array.isArray(t)&&t.length){let n=n4.find(({regex:i})=>i.test(e))?.args??0,r=n>=0?t.slice(0,n):t.slice();return t.length>r.length&&r.push(`[${t.length-n} other arguments]`),`${e} ${r.join(" ")}`}return e};function Fe(e){return typeof e=="string"?e:void 0}function rf(e){return typeof e=="number"&&!isNaN(e)?e:void 0}function OE(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function of(e){return B(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"}function sf(e,t,n){let r=e.getReader(),i={toolCalls:[]},o="",s=!1,c=()=>{s||(s=!0,o&&(i.text=o),t(i))},a=l=>{s||(s=!0,n(l))};return new ReadableStream({async pull(l){try{let{done:p,value:u}=await r.read();if(p){c(),l.close();return}o+=r4(i,u)??"",l.enqueue(u)}catch(p){a(p),l.error(p)}},cancel(l){return c(),r.cancel(l)}})}function r4(e,t){if(!B(t))return;let{type:n,delta:r,textDelta:i,id:o,modelId:s,toolCallId:c,toolName:a,input:l,args:p,finishReason:u,usage:d,providerMetadata:m}=t;switch(n){case"text-delta":{let _=r??i;return typeof _=="string"?_:void 0}case"tool-call":e.toolCalls.push({toolCallId:c,toolName:a,input:l??p});return;case"response-metadata":typeof o=="string"&&(e.responseId=o),typeof s=="string"&&(e.responseModel=s);return;case"finish":e.finishReason=u,e.usage=d,m!==void 0&&(e.providerMetadata=m);return;default:return}}var i4="ai:telemetry",ZM="auto.vercelai.channel",o4="gen_ai.tool.call.id",s4="gen_ai.tool.description",a4="embeddings",c4="rerank",l4="generate_content",p4="WorkersAI",XM="vercel.ai.operationId",u4="vercel.ai.model.provider",d4="vercel.ai.settings.maxRetries",xE=new Map,af=new Map,PE=new Map,KM=new Set(["generateText","streamText","generateObject","embed","embedMany","rerank"]);function kE(e){if(!KM.has(e.type))return;let t=Fe(e.event.callId);t&&LE(t)}function LE(e){xE.delete(e),af.delete(e),PE.delete(e)}function m4(e,t){if(KM.has(t))for(let n of gd)delete e[n]}function f4(e,t){if(!e||!Array.isArray(t))return;let n=af.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&&af.set(e,n)}function g4(e,t,n){let r=e?af.get(e)?.get(t):void 0;if(r)return r;if(Array.isArray(n)){let i=n.find(o=>B(o)&&o.name===t);return B(i)?Fe(i.description):void 0}if(B(n)){let i=n[t];return B(i)?Fe(i.description):void 0}}function qM(e,t={}){ee(e(i4),n=>fp(n,t),{beforeSpanEnd:(n,r)=>{za(n,r,t),kE(r)},deferSpanEnd:({data:n,end:r})=>_4(n,t,r)})}function _4(e,t,n){if(e.type!=="languageModelCall"||!B(e.result))return!1;let r=e.result,i=r.stream;if(!of(i))return!1;let o=Fe(e.event.callId),{recordOutputs:s}=GE(e.event,t);return r.stream=sf(i,c=>{e.result={...r,...ME(c)},n(),h4(o,c,s)},c=>n(c)),!0}function ME(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 h4(e,t,n){let r=e?PE.get(e):void 0;if(!r)return;let i=B(t.usage)?t.usage:void 0;if(i){let o=Yn(i.inputTokens)??Yn(i.promptTokens)??Yn(i.tokens),s=Yn(i.outputTokens)??Yn(i.completionTokens);CE(r,Qt,o),CE(r,St,s),CE(r,xh,Yn(i.totalTokens)??OE(o,s))}if(n){let o=zM(t.text,t.toolCalls),s=JM(o,QM({finishReason:t.finishReason}));s&&r.setAttribute(Ch,s)}}function CE(e,t,n){if(n===void 0)return;let r=oe(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:i,enableTruncation:o}=GE(r,t),s=Fe(r.provider),c=Fe(r.modelId),a=Fe(r.callId),l=rf(r.maxRetries);i&&f4(a,r.tools);let p={[S]:ZM,...s?{[Xc]:s,[u4]:s}:{},...c?{[Zc]:c}:{},...l!==void 0?{[d4]:l}:{}};switch(n){case"generateText":case"streamText":case"generateObject":return b4(r,p,i,o,a,n==="streamText");case"languageModelCall":return Ai([p4]),y4(r,p,i,o,a,c);case"executeTool":return S4(r,i);case"embed":case"embedMany":{let u=n==="embedMany"?r.values:r.value;return mp(a4,c,{...p,...i&&u!==void 0?{[VR]:Ge(u)}:{}})}case"rerank":return mp(c4,c,p);default:return}}function mp(e,t,n){return k({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[vu]:e,...n}})}function b4(e,t,n,r,i,o){let s=Fe(e.functionId),c=Fe(e.operationId)??(o?"ai.streamText":"ai.generateText");i&&xE.set(i,{operationId:c,isStream:o});let a=mp(NM,s,{...t,[XM]:c,[qR]:o,...s?{[YR]:s}:{},...n?e1(e,r):{}});return o&&i&&PE.set(i,a),a}function y4(e,t,n,r,i,o){let s=i?xE.get(i):void 0,c=s?`${s.operationId}.${s.isStream?"doStream":"doGenerate"}`:"ai.generateText.doGenerate";return mp(l4,o,{...t,[XM]:c,...n?e1(e,r):{},...n&&Array.isArray(e.tools)?{[ZR]:Ge(e.tools)}:{}})}function S4(e,t){let n=B(e.toolCall)?e.toolCall:{},r=Fe(n.toolName),i=Fe(e.toolCallId)??Fe(n.toolCallId),o=n.input??n.args,s=t&&r?g4(Fe(e.callId),r,e.tools):void 0;return mp(AM,r,{[S]:ZM,[zR]:"function",...r?{[JR]:r}:{},...i?{[o4]:i}:{},...s?{[s4]:s}:{},...t&&o!==void 0?{[QR]:Ge(o)}:{}})}function za(e,t,n){let{type:r,result:i}=t;if(!B(i))return;let{recordOutputs:o}=GE(t.event,n);if(r==="executeTool"){o&&e.setAttribute($R,Ge(i.output??i));let m=B(i.output)?i.output:void 0;m?.type==="tool-error"&&wE(e,t,m.error);return}let s=B(i.usage)?i.usage:void 0;if(s){let m=Yn(s.inputTokens)??Yn(s.promptTokens)??Yn(s.tokens),_=Yn(s.outputTokens)??Yn(s.completionTokens),h=Yn(s.totalTokens)??OE(m,_);m!==void 0&&e.setAttribute(Qt,m),_!==void 0&&e.setAttribute(St,_),h!==void 0&&e.setAttribute(xh,h)}let c=QM(i);c&&r==="languageModelCall"&&e.setAttribute(Rt,Ge([c]));let a=B(i.response)?i.response:void 0,l=Fe(a?.id)??Fe(i.responseId);l&&e.setAttribute(XR,l);let p=Fe(a?.modelId)??Fe(t.event.modelId);p&&e.setAttribute(KR,p);let u=i.providerMetadata,d=fd(u);if(Bo in d&&oe(e).data[Bo]&&delete d[Bo],m4(d,r),e.setAttributes(d),o){let m=r==="languageModelCall"&&Array.isArray(i.content)?T4(i.content):zM(i.text,i.toolCalls),_=JM(m,c);_&&e.setAttribute(Ch,_)}}function E4(e){return e==="tool-calls"?"tool_call":e??"stop"}function QM(e){let t=e.finishReason;return typeof t=="string"?t:B(t)?Fe(t.unified):void 0}function Yn(e){return rf(e)??(B(e)?rf(e.total):void 0)}function JM(e,t){if(e.length)return Ge([{role:"assistant",parts:e,finish_reason:E4(t)}])}function $M(e){let t=e.input??e.args;return{type:"tool_call",id:Fe(e.toolCallId),name:Fe(e.toolName),arguments:typeof t=="string"?t:Ge(t??{})}}function T4(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($M(n)));return t}function zM(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($M(r));return n}function wE(e,t,n){e.setStatus({code:2,message:n instanceof Error?n.message:"tool_error"});let r=B(t.event.toolCall)?t.event.toolCall:{},i=Fe(r.toolName),o=Fe(t.event.toolCallId)??Fe(r.toolCallId);Be(s=>{s.setContext("trace",Cr(e)),i&&s.setTag("vercel.ai.tool.name",i),o&&s.setTag("vercel.ai.tool.callId",o),s.setLevel("error"),me(n instanceof Error?n:new Error(typeof n=="string"?n:"Tool execution failed"),{mechanism:{type:"auto.vercelai.channel",handled:!1}})})}function GE(e,t){let n=C()?.getDataCollectionOptions().genAI;return{recordInputs:jM(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:jM(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:ze(t.enableTruncation)}}function jM(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n===!0}function e1(e,t){let n={},r=Fe(e.instructions);r&&(n[Jt]=Ge([{type:"text",content:r}]));let i=e.messages??e.prompt;return i!==void 0&&(n[jR]=t?Bt(i):Ge(i),n[Ct]=Array.isArray(i)?i.length:1),n}import*as UE from"diagnostics_channel";var I4=((e={})=>({name:"VercelAI",setupOnce(){UE.tracingChannel&&ue(()=>{qM(UE.tracingChannel,e)})}})),gp=I4;import*as i1 from"diagnostics_channel";var DE="@sentry/instrumentation-fastify",A4=">=3.21.0 <6",o1="auto.http.otel.fastify",N4="hook.fastify",s1="request_handler.fastify",a1=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],uo="hook.name",mo="fastify.type",ds="hook.callback.name",v4="fastify.root",R4="route-hook",ec="hook",c1="request-handler",fo="anonymous",ki=Symbol("sentry fastify request span"),l1=Symbol("sentry fastify addHook original"),p1=Symbol("sentry fastify setNotFoundHandler original");function u1(e){return e.routeOptions?.url??e.routerPath}function d1(e){return e.routeOptions?.config??e.routeConfig}function O4(e){return B(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||"routerPath"in e)}function m1(e,t,n){e.decorate(l1,e.addHook),e.decorate(p1,e.setNotFoundHandler),e.decorateRequest("opentelemetry",function(){return{span:this[ki]}}),e.decorateRequest(ki,null),e.addHook("onRoute",C4),e.addHook("onRequest",x4),e.addHook("onResponse",P4),e.addHook=M4,e.setNotFoundHandler=w4,n()}var BE=m1;BE[Symbol.for("skip-override")]=!0;BE[Symbol.for("fastify.display-name")]=DE;BE[Symbol.for("plugin-meta")]={fastify:A4,name:DE};function C4(e){if(e.config?.otel!==!1){for(let t of a1){let n=e[t];typeof n=="function"?e[t]=go(n,t,t1(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(r=>go(r,t,t1(this.pluginName,t,r,e.url))))}e.onSend=n1(e.onSend,k4),e.onError=n1(e.onError,L4),e.handler=go(e.handler,"handler",{[uo]:`${this.pluginName} - route-handler`,[mo]:c1,[He]:e.url,[ds]:e.handler.name.length>0?e.handler.name:fo})}}function t1(e,t,n,r){return{[uo]:`${e} - route -> ${t}`,[mo]:R4,[He]:r,[ds]:n.name?.length>0?n.name:fo}}function n1(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function x4(e,t,n){if(d1(e)?.otel===!1)return n();let r={[S]:o1,[v4]:DE,[Dr]:e.method,[Ki]:e.url},i=u1(e);if(i!=null){r[He]=i;let s=Q(),c=s&&Re(s);c&&oe(c).data[H]==="http.server"&&c.setAttribute(He,i)}let o=k({name:"request",op:s1,attributes:r});e[ki]=o,se(o,()=>{n()})}function P4(e,t,n){let r=e[ki];r!=null&&(r.setAttributes({[_n]:t.statusCode}),r.end()),e[ki]=null,n()}function k4(e,t,n,r){let i=e[ki];i!=null&&(t.statusCode>=500&&i.setStatus({code:2}),i.setAttributes({[_n]:t.statusCode}),i.end()),e[ki]=null,r(null,n)}function L4(e,t,n,r){let i=e[ki];i?.setStatus({code:2,message:n.message}),r()}function M4(e,t){let n=this[l1];return a1.includes(e)?n.call(this,e,go(t,e,{[uo]:`${this.pluginName} - ${e}`,[mo]:ec,[ds]:t.name?.length>0?t.name:fo})):n.call(this,e,t)}function w4(e,t){let n=this[p1];if(typeof e=="function"){n.call(this,go(e,"notFoundHandler",{[uo]:`${this.pluginName} - not-found-handler`,[mo]:ec,[ds]:e.name?.length>0?e.name:fo}));return}if(e.preValidation!=null&&(e.preValidation=go(e.preValidation,"notFoundHandler - preValidation",{[uo]:`${this.pluginName} - not-found-handler - preValidation`,[mo]:ec,[ds]:e.preValidation.name?.length>0?e.preValidation.name:fo})),e.preHandler!=null&&(e.preHandler=go(e.preHandler,"notFoundHandler - preHandler",{[uo]:`${this.pluginName} - not-found-handler - preHandler`,[mo]:ec,[ds]:e.preHandler.name?.length>0?e.preHandler.name:fo})),t==null){n.call(this,e);return}n.call(this,e,go(t,"notFoundHandler",{[uo]:`${this.pluginName} - not-found-handler`,[mo]:ec,[ds]:t.name?.length>0?t.name:fo}))}function G4(e){for(let t of e)if(O4(t))return t;return null}function go(e,t,n={}){return function(...i){let o=G4(i);if(o===null||d1(o)?.otel===!1)return e.call(this,...i);let s=o[ki]??void 0,c=e.name?.length>0?e.name:this.pluginName??fo,a=n[mo],l=a===ec?N4:a===c1?s1:void 0,p=l?U4(n[uo]):`${t} - ${c}`;return Se({name:p,op:l,attributes:{...n,[S]:o1},parentSpan:s},()=>e.call(this,...i))}}function U4(e=""){return e.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"").replace(/^@sentry\/instrumentation-fastify -> /,"")}function D4(e){e.addHook("onRequest",async(t,n)=>{let r=u1(t),i=t.method||"GET";J().setTransactionName(`${i} ${r}`)})}var r1=!1,f1=Object.assign(function(){r1||(r1=!0,i1.subscribe("fastify.initialization",t=>{let n=t.fastify;n?.register(m1).after(r=>{r?$&&g.error("Failed to setup Fastify instrumentation",r):n&&D4(n)})}))},{id:"Fastify.v5"});var cf="Fastify";function lf(e,t,n){let r=n.statusCode;return r>=500||r<=299}import*as g1 from"diagnostics_channel";function B4(){return C()?.getIntegrationByName(cf)}function _1(){g1.subscribe("tracing:fastify.request.handler:error",e=>{let{error:t,request:n,reply:r}=e;pf.call(pf,t,n,r,"diagnostics-channel")})}function pf(e,t,n,r){let i=B4()?.getShouldHandleError()||lf;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){$&&g.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}i(e,t,n)&&me(e,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var H4=(({shouldHandleError:e}={})=>{let t;return{name:cf,setupOnce(){t=e||lf,_1(),f1()},getShouldHandleError(){return t},setShouldHandleError(n){t=n}}}),HE=H4;var uf=pf;var F4="db.mongodb.collection",W4="db.name",V4="db.user",Y4="net.peer.name",j4="net.peer.port",Z4="db.operation",X4="db.system";function Li({collection:e,modelName:t,operation:n,origin:r,parentSpan:i}){let o={[F4]:e?.name,[W4]:e?.conn?.name,[V4]:e?.conn?.user,[Y4]:e?.conn?.host,[j4]:e?.conn?.port,[Z4]:n,[X4]:"mongoose",[S]:r};return k({name:`mongoose.${t}.${n}`,op:"db",kind:U.CLIENT,attributes:o,parentSpan:i})}var h1="Fastify",FE=de(`${h1}.v3`,()=>new Km);function K4(){let e=C();if(e)return e.getIntegrationByName(h1)}var q4=(e=>{let t=HE(e);return Gt(t,{setupOnce(){FE()}})}),WE=(e={})=>q4(e);function Q4(e,t){t?.shouldHandleError&&K4()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(r,i,o){r.addHook("onError",async(s,c,a)=>{uf.call(uf,a,s,c,"onError-hook")}),o()},{[Symbol.for("skip-override")]:!0,[Symbol.for("fastify.display-name")]:"sentry-fastify-error-handler"});e.register(n)}import{normalize as J4}from"path";var Ae=class{constructor(t,n,r,i){this.name=J4(t),this.supportedVersions=n,this.patch=r,this.unpatch=i}};var VE=(e=>(e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription",e))(VE||{}),_o=(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))(_o||{}),Mi=(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))(Mi||{});var bn=(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))(bn||{});var _p=Symbol.for("opentelemetry.patched"),ni=Symbol.for("opentelemetry.graphql_data");var b1="Operation$operationName$not supported";var y1=Object.values(VE),YE=e=>typeof e?.then=="function";function df(e,t,n,r){if(C()?.getDataCollectionOptions().graphQL.document===!0){let i=sQ(t,n,r);e.setAttribute(bn.SOURCE,i)}}function $4(e,t,n){let r=I1(e,n);if(r)return{field:r,spanAdded:!1};let i=tQ(e,n);return r={span:z4(e,t,n,i)},eQ(e,n,r),{field:r,spanAdded:!0}}function z4(e,t,n,r){let i={[bn.FIELD_NAME]:t.fieldName,[bn.FIELD_PATH]:n.join("."),[bn.FIELD_TYPE]:t.returnType.toString(),[bn.PARENT_NAME]:t.parentType.name},o=k({name:`${Mi.RESOLVE} ${i[bn.FIELD_PATH]}`,attributes:i,parentSpan:r}),s=e[ni].source,c=t.fieldNodes.find(a=>a.kind==="Field");return c&&df(o,s.loc,c.loc?.start,c.loc?.end),o}function ms(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function jE(e,t){if(!(!e||!Array.isArray(e.definitions)))return t?e.definitions.filter(n=>y1.indexOf(n?.operation)!==-1).find(n=>t===n?.name?.value):e.definitions.find(n=>y1.indexOf(n?.operation)!==-1)}function eQ(e,t,n){return e[ni].fields[t.join(".")]=n}function I1(e,t){return e[ni].fields[t.join(".")]}function tQ(e,t){for(let n=t.length-1;n>0;n--){let r=I1(e,t.slice(0,n));if(r)return r.span}return nQ(e)}function nQ(e){return e[ni].span}function rQ(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function iQ(e){return A1(`
33
+ `,e)}function S1(e){return A1(" ",e)}function A1(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}var oQ=[_o.FLOAT,_o.STRING,_o.INT,_o.BLOCK_STRING];function sQ(e,t,n){let r="";if(e?.startToken){let i=typeof t=="number"?t:e.start,o=typeof n=="number"?n:e.end,s=e.startToken.next,c=1;for(;s;){if(s.start<i){s=s.next,c=s?.line;continue}if(s.end>o){s=s.next,c=s?.line;continue}let a=s.value||s.kind,l="";oQ.indexOf(s.kind)>=0&&(a="*"),s.kind===_o.STRING&&(a=`"${a}"`),s.kind===_o.EOF&&(a=""),s.line>c?(r+=iQ(s.line-c),c=s.line,l=S1(s.column-1)):s.line===s.prev?.line&&(l=S1(s.start-(s.prev?.end||0))),r+=l+a,s&&(s=s.next)}}return r}function mf(e,t){if(!e||e[_p])return;let n=e.getFields();e[_p]=!0,Object.keys(n).forEach(r=>{let i=n[r];if(i&&(i.resolve&&(i.resolve=ZE(t,i.resolve)),i.type)){let o=N1(i.type);for(let s of o)mf(s,t)}})}function N1(e){return"ofType"in e?N1(e.ofType):aQ(e)?e.getTypes():cQ(e)?[e]:[]}function aQ(e){return"getTypes"in e&&typeof e.getTypes=="function"}function cQ(e){return"getFields"in e&&typeof e.getFields=="function"}var E1=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},T1=(e,t)=>{t&&e.end()};function ZE(e,t,n=!1){if(r[_p]||typeof t!="function")return t;function r(i,o,s,c){if(!t)return;if(e().ignoreTrivialResolveSpans&&n&&(B(i)||typeof i=="function")&&typeof i[c.fieldName]!="function")return t.call(this,i,o,s,c);if(!s[ni])return t.call(this,i,o,s,c);let l=rQ(c?.path),{field:p,spanAdded:u}=$4(s,c,l),d=p.span,m=u;return se(d,()=>{try{let _=t.call(this,i,o,s,c);return YE(_)?_.then(h=>(T1(d,m),h),h=>{throw E1(d,h,m),h}):(T1(d,m),_)}catch(_){throw E1(d,_,m),_}})}return r[_p]=!0,r}var lQ="@sentry/instrumentation-graphql",pQ="auto.graphql.otel.graphql",v1={ignoreResolveSpans:!1},ff=[">=14.0.0 <17"],gf=class extends ae{constructor(t={}){super(lQ,q,{...v1,...t})}setConfig(t={}){super.setConfig({...v1,...t})}init(){let t=new re("graphql",ff);return t.files.push(this._addPatchingExecute()),t.files.push(this._addPatchingParser()),t.files.push(this._addPatchingValidate()),t}_addPatchingExecute(){return new Ae("graphql/execution/execute.js",ff,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 Ae("graphql/language/parser.js",ff,t=>(w(t.parse)&&this._unwrap(t,"parse"),this._wrap(t,"parse",this._patchParse()),t),t=>{t&&this._unwrap(t,"parse")})}_addPatchingValidate(){return new Ae("graphql/validation/validate.js",ff,t=>(w(t.validate)&&this._unwrap(t,"validate"),this._wrap(t,"validate",this._patchValidate()),t),t=>{t&&this._unwrap(t,"validate")})}_patchExecute(t){let n=this;return function(i){return function(){let s;if(arguments.length>=2){let l=arguments;s=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],t)}else{let l=arguments[0];s=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,t)}let c=jE(s.document,s.operationName),a=n._createExecuteSpan(c,s);return s.contextValue[ni]={source:s.document?s.document||s.document[ni]:void 0,span:a,fields:{}},se(a,()=>Jr(()=>i.apply(this,[s]),(l,p)=>{n._handleExecutionResult(a,l,p)}))}}}_handleExecutionResult(t,n,r){if(r===void 0||n){ms(t,n);return}YE(r)?r.then(i=>{this._updateSpanFromResult(t,i),ms(t)},i=>{ms(t,i)}):(this._updateSpanFromResult(t,r),ms(t))}_updateSpanFromResult(t,n){if(n.errors?.length&&!oe(t).status&&t.setStatus({code:2}),!this.getConfig().useOperationNameForRootSpan)return;let r=oe(t).data,i=r[bn.OPERATION_TYPE],o=r[bn.OPERATION_NAME];if(!i)return;let s=Re(t),a=oe(s).data[cs]||[],l=o?`${i} ${o}`:`${i}`;Array.isArray(a)?(a.push(l),s.setAttribute(cs,a)):typeof a=="string"?s.setAttribute(cs,[a,l]):s.setAttribute(cs,l),oe(s).data["original-description"]||s.setAttribute("original-description",oe(s).description),s.updateName(`${oe(s).data["original-description"]} (${uQ(a)})`)}_patchParse(){let t=this;return function(r){return function(o,s){return t._parse(this,r,o,s)}}}_patchValidate(){let t=this;return function(r){return function(o,s,c,a,l){return t._validate(this,r,o,s,c,l,a)}}}_parse(t,n,r,i){let o=k({name:Mi.PARSE});return se(o,()=>Jr(()=>n.call(t,r,i),(s,c)=>{c&&(jE(c)?c.loc&&df(o,c.loc):o.updateName(Mi.SCHEMA_PARSE)),ms(o,s)}))}_validate(t,n,r,i,o,s,c){let a=k({name:Mi.VALIDATE});return se(a,()=>Jr(()=>n.call(t,r,i,o,c,s),(l,p)=>{i.loc||a.updateName(Mi.SCHEMA_VALIDATE),ms(a,l)}))}_createExecuteSpan(t,n){let r=k({name:Mi.EXECUTE,attributes:{[S]:pQ}});if(t){let{operation:i,name:o}=t;r.setAttribute(bn.OPERATION_TYPE,i);let s=o?.value;s?(r.setAttribute(bn.OPERATION_NAME,s),r.updateName(`${i} ${s}`)):r.updateName(i)}else{let i=" ";n.operationName&&(i=` "${n.operationName}" `),i=b1.replace("$operationName$",i),r.setAttribute(bn.OPERATION_NAME,i)}return n.document?.loc&&df(r,n.document.loc),r}_wrapExecuteArgs(t,n,r,i,o,s,c,a,l){if(i||(i={}),i[ni]||this.getConfig().ignoreResolveSpans)return{schema:t,document:n,rootValue:r,contextValue:i,variableValues:o,operationName:s,fieldResolver:c,typeResolver:a};let p=c==null;return c=ZE(()=>this.getConfig(),c??l,p),t&&(mf(t.getQueryType(),()=>this.getConfig()),mf(t.getMutationType(),()=>this.getConfig())),{schema:t,document:n,rootValue:r,contextValue:i,variableValues:o,operationName:s,fieldResolver:c,typeResolver:a}}};function uQ(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 R1="Graphql",KE=de(R1,gf,e=>XE(e)),dQ=((e={})=>Gt(lp(XE(e)),{name:R1,setupOnce(){KE(XE(e))}})),qE=dQ;function XE(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var tc="messaging.destination.partition.id",QE="messaging.kafka.message.key",JE="messaging.kafka.message.tombstone",O1="messaging.kafka.offset",$E="process",hp="receive",C1="send",zE="kafka",x1="_OTHER";st();var mQ="auto.kafkajs.otel.producer",fQ="auto.kafkajs.otel.consumer";function bp(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function P1(e){let t=bp(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=Tn(t,bp(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?Tr.SAMPLED:Tr.NONE}}]}function _f({topic:e,message:t,operationType:n,links:r,attributes:i}){let o=n===hp?"poll":n;return k({name:`${o} ${e}`,kind:n===hp?U.CLIENT:U.CONSUMER,links:r,attributes:{...i,[Mt]:zE,[vn]:e,[ar]:n,[ia]:o,[QE]:t?.key?String(t.key):void 0,[JE]:t?.key&&t.value===null?!0:void 0,[O1]:t?.offset,...t?{[S]:fQ}:{}}})}function eT(e,t){let n=k({name:`send ${e}`,kind:U.PRODUCER,attributes:{[Mt]:zE,[vn]:e,[QE]:t.key?String(t.key):void 0,[JE]:t.key&&t.value===null?!0:void 0,[tc]:t.partition!==void 0?String(t.partition):void 0,[ia]:"send",[ar]:C1,[S]:mQ}});t.headers=t.headers??{};let r=$e({span:n});return r["sentry-trace"]&&(t.headers["sentry-trace"]=r["sentry-trace"]),r.baggage&&(t.headers.baggage=r.baggage),n}function fs(e,t){return Promise.resolve(t).catch(n=>{let r,i=x1;throw typeof n=="string"||n===void 0?r=n:typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"message")&&(r=n.message,i=n.constructor.name),e.forEach(o=>{o.setAttribute(Mr,i),o.setStatus({code:2,message:r})}),n}).finally(()=>{e.forEach(n=>n.end())})}var gQ="@sentry/instrumentation-kafkajs",hf=class extends ae{constructor(t={}){super(gQ,q,t)}init(){let t=r=>{w(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),w(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new re("kafkajs",[">=0.3.0 <3"],r=>(t(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),t)}_getConsumerPatch(){let t=this;return n=>function(...i){let o=n.apply(this,i);return w(o.run)&&t._unwrap(o,"run"),t._wrap(o,"run",t._getConsumerRunPatch()),o}}_getProducerPatch(){let t=this;return n=>function(...i){let o=n.apply(this,i);return w(o.sendBatch)&&t._unwrap(o,"sendBatch"),t._wrap(o,"sendBatch",t._getSendBatchPatch()),w(o.send)&&t._unwrap(o,"send"),t._wrap(o,"send",t._getSendPatch()),w(o.transaction)&&t._unwrap(o,"transaction"),t._wrap(o,"transaction",t._getProducerTransactionPatch()),o}}_getConsumerRunPatch(){let t=this;return n=>function(...i){let o=i[0];return o?.eachMessage&&(w(o.eachMessage)&&t._unwrap(o,"eachMessage"),t._wrap(o,"eachMessage",t._getConsumerEachMessagePatch())),o?.eachBatch&&(w(o.eachBatch)&&t._unwrap(o,"eachBatch"),t._wrap(o,"eachBatch",t._getConsumerEachBatchPatch())),n.call(this,o)}}_getConsumerEachMessagePatch(){return t=>function(...r){let i=r[0],o=bp(i.message.headers,"sentry-trace"),s=bp(i.message.headers,"baggage");return In({sentryTrace:o,baggage:s},()=>{let c=_f({topic:i.topic,message:i.message,operationType:$E,attributes:{[tc]:String(i.partition)}}),a=se(c,()=>t.apply(this,r));return fs([c],a)})}}_getConsumerEachBatchPatch(){return t=>function(...r){let i=r[0],o=An(()=>_f({topic:i.batch.topic,message:void 0,operationType:hp,attributes:{[na]:i.batch.messages.length,[tc]:String(i.batch.partition)}}));return se(o,()=>{let s=[o];i.batch.messages.forEach(a=>{s.push(_f({topic:i.batch.topic,message:a,operationType:$E,links:P1(a.headers),attributes:{[tc]:String(i.batch.partition)}}))});let c=t.apply(this,r);return fs(s,c)})}}_getProducerTransactionPatch(){let t=this;return n=>function(...i){let o=k({name:"transaction"}),s=n.apply(this,i);return s.then(c=>{let a=c.send;c.send=function(...m){return se(o,()=>t._getSendPatch()(a).apply(this,m).catch(h=>{throw o.setStatus({code:2,message:h?.message}),h}))};let l=c.sendBatch;c.sendBatch=function(...m){return se(o,()=>t._getSendBatchPatch()(l).apply(this,m).catch(h=>{throw o.setStatus({code:2,message:h?.message}),h}))};let p=c.commit;c.commit=function(...m){let _=p.apply(this,m).then(()=>{o.setStatus({code:1})});return fs([o],_)};let u=c.abort;c.abort=function(...m){let _=u.apply(this,m);return fs([o],_)}}).catch(c=>{o.setStatus({code:2,message:c?.message}),o.end()}),s}}_getSendBatchPatch(){return t=>function(...r){let o=r[0].topicMessages||[],s=[];o.forEach(a=>{a.messages.forEach(l=>{s.push(eT(a.topic,l))})});let c=t.apply(this,r);return fs(s,c)}}_getSendPatch(){return t=>function(...r){let i=r[0],o=i.messages.map(c=>eT(i.topic,c)),s=t.apply(this,r);return fs(o,s)}}};var k1="Kafka",tT=de(k1,()=>new hf),_Q=(()=>({name:k1,setupOnce(){tT()}})),nT=_Q;var hQ="@sentry/instrumentation-lru-memoizer",bf=class extends ae{constructor(){super(hQ,q,{})}init(){return[new re("lru-memoizer",[">=1.3 <4"],t=>Object.assign(function(...r){let i=t.apply(this,r);return function(...o){let s=o.pop(),c=ne(),a=typeof s=="function"?function(...l){return Be(c,()=>s.apply(this,l))}:s;return i.apply(this,[...o,a])}},{sync:t.sync}),void 0)]}};var L1="LruMemoizer",rT=de(L1,()=>new bf),bQ=(()=>({name:L1,setupOnce(){rT()}})),iT=bQ;var M1="auto.db.otel.mongo";function oT(e,t,n,r){return pp(e,t,n,r,M1)}function yp(e,t,n,r){return dp(e,t,n,r,M1)}function gs(e,t){let n=Q(),r=!1;return function(...o){if(!r){r=!0;let s=o[0];e&&(s instanceof Error&&e.setStatus({code:2,message:s.message}),e.end())}return se(n??null,()=>t.apply(this,o))}}function _s(){return!Q()}function yf(e){return t=>function(r,i,o,s,c){let a=typeof s=="function"?s:c;if(_s()||typeof a!="function"||typeof o!="object")return typeof s=="function"?t.call(this,r,i,o,s):t.call(this,r,i,o,s,c);let l=_r(yp(i,r,o[0],e)),p=gs(l,a);return typeof s=="function"?t.call(this,r,i,o,p):t.call(this,r,i,o,s,p)}}function w1(){return e=>function(n,r,i,o,s){let c=typeof o=="function"?o:s;if(_s()||typeof c!="function"||typeof i!="object")return typeof o=="function"?e.call(this,n,r,i,o):e.call(this,n,r,i,o,s);let a=up(i),l=_r(yp(r,n,i,a)),p=gs(l,c);return typeof o=="function"?e.call(this,n,r,i,p):e.call(this,n,r,i,o,p)}}function G1(){return e=>function(n,r,i,o){let s=o,c=Object.keys(r)[0];if(typeof r!="object"||r.ismaster||r.hello)return e.call(this,n,r,i,o);let a;_s()||(a=_r(oT(this,n,r,c)));let l=gs(a,s);return e.call(this,n,r,i,l)}}function U1(){return e=>function(...n){let[r,i]=n,o=Object.keys(i)[0],s=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return e.apply(this,n);let c;_s()||(c=_r(oT(this,r,i,o)));let a=gs(c,s),l=e.apply(this,n);return l.then(p=>a(null,p),p=>a(p)),l}}function D1(){return e=>function(n,r,i,o,s,c){let a=typeof s=="function"?s:c;if(_s()||typeof a!="function"||typeof i!="object")return typeof s=="function"?e.call(this,n,r,i,o,s):e.call(this,n,r,i,o,s,c);let l=_r(yp(r,n,i,"find")),p=gs(l,a);return typeof s=="function"?e.call(this,n,r,i,o,p):e.call(this,n,r,i,o,s,p)}}function B1(){return e=>function(n,r,i,o,s,c){let a=typeof s=="function"?s:c;if(_s()||typeof a!="function")return typeof s=="function"?e.call(this,n,r,i,o,s):e.call(this,n,r,i,o,s,c);let l=_r(yp(r,n,i.cmd,"getMore")),p=gs(l,a);return typeof s=="function"?e.call(this,n,r,i,o,p):e.call(this,n,r,i,o,s,p)}}function H1(){return e=>function(n){let r=Q();return e.call(this,function(...i){return se(r??null,()=>n.apply(this,i))})}}var yQ="@sentry/instrumentation-mongodb",Sf=class extends ae{constructor(t={}){super(yQ,q,t)}init(){let{v3PatchConnection:t,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnectionCallback:r,v4PatchConnectionPromise:i,v4UnpatchConnection:o}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:s,v4UnpatchConnectionPool:c}=this._getV4ConnectionPoolPatches();return[new re("mongodb",[">=3.3.0 <4"],void 0,void 0,[new Ae("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],t,n)]),new re("mongodb",[">=4.0.0 <8"],void 0,void 0,[new Ae("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],r,o),new Ae("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,o),new Ae("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",yf("insert")),w(t.remove)&&this._unwrap(t,"remove"),this._wrap(t,"remove",yf("remove")),w(t.update)&&this._unwrap(t,"update"),this._wrap(t,"update",yf("update")),w(t.command)&&this._unwrap(t,"command"),this._wrap(t,"command",w1()),w(t.query)&&this._unwrap(t,"query"),this._wrap(t,"query",D1()),w(t.getMore)&&this._unwrap(t,"getMore"),this._wrap(t,"getMore",B1()),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",H1()),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",G1()),t),v4PatchConnectionPromise:t=>(w(t.Connection.prototype.command)&&this._unwrap(t.Connection.prototype,"command"),this._wrap(t.Connection.prototype,"command",U1()),t),v4UnpatchConnection:t=>{t!==void 0&&this._unwrap(t.Connection.prototype,"command")}}}};var F1="Mongo",sT=de(F1,()=>new Sf),SQ=(()=>({name:F1,setupOnce(){sT()}})),aT=SQ;function W1(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
34
+ Mongoose Error Code: ${t.code}`:""}`})}function V1(e,t){return e instanceof Promise?e.catch(n=>{throw W1(t,n),n}).finally(()=>t.end()):(t.end(),e)}function Y1(e,t,n,r,i){let o=0;return i.length===2?o=1:i.length===3&&(o=2),i[o]=(s,c)=>(s&&W1(r,s),r.end(),e(s,c)),t.apply(n,i)}var EQ="@sentry/instrumentation-mongoose",Sp="auto.db.otel.mongoose",If=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],TQ=["remove","count","findOneAndRemove",...If],IQ=["count","findOneAndRemove",...If],AQ=[...If];function j1(e){return e?e.startsWith("6.")||e.startsWith("5.")?TQ:e.startsWith("7.")?IQ:AQ:If}function Z1(e){return e&&(e.startsWith("5.")||e.startsWith("6."))||!1}function X1(e){return!e||!e.startsWith("8.")?!1:parseInt(e.split(".")[1],10)>=21}var Ef=Symbol("stored-parent-span"),K1=Symbol("already-instrumented"),Tf=class extends ae{constructor(t={}){super(EQ,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,Z1(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove")),X1(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()),j1(n).forEach(o=>{this._wrap(r.Query.prototype,o,this.patchAndCaptureSpanContext(o))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany")),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite")),r}unpatch(t,n){let r=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t,i=j1(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,Z1(n)&&this._unwrap(r.Model.prototype,"remove"),X1(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),i.forEach(o=>{this._unwrap(r.Query.prototype,o)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(){let t=this;return n=>function(i){let o=this[Ef],s=Li({collection:this._model.collection,modelName:this._model?.modelName,operation:"aggregate",origin:Sp,parentSpan:o});return t._handleResponse(s,n,this,arguments,i)}}patchQueryExec(){let t=this;return n=>function(i){if(this[K1])return n.apply(this,arguments);let o=this[Ef],s=Li({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:Sp,parentSpan:o});return t._handleResponse(s,n,this,arguments,i)}}patchOnModelMethods(t){let n=this;return r=>function(o,s){let c=Li({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:Sp});return o instanceof Function&&(s=o),n._handleResponse(c,r,this,arguments,s)}}_patchDocumentUpdateMethods(t){let n=this;return r=>function(o,s,c){let a=c;typeof o=="function"?a=o:typeof s=="function"&&(a=s);let l=Li({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:Sp}),p=n._handleResponse(l,r,this,arguments,a);return p&&typeof p=="object"&&(p[K1]=!0),p}}patchModelStatic(t){let n=this;return r=>function(o,s,c){typeof s=="function"&&(c=s);let a=Li({collection:this.collection,modelName:this.modelName,operation:t,origin:Sp});return n._handleResponse(a,r,this,arguments,c)}}patchModelAggregate(){return t=>function(){let r=Q(),i=t.apply(this,arguments);return i&&(i[Ef]=r),i}}patchAndCaptureSpanContext(t){return n=>function(){return this[Ef]=Q(),n.apply(this,arguments)}}_handleResponse(t,n,r,i,o){return se(t,()=>{if(o instanceof Function)return Y1(o,n,r,t,i);{let s=n.apply(r,i);return V1(s,t)}})}};var q1="Mongoose",cT=de(q1,()=>new Tf),NQ=(()=>Gt(_E(),{name:q1,setupOnce(){cT()}})),lT=NQ;var Q1="db.connection_string",J1="mysql";function $1(e){let t=e?.connectionConfig||e||{},{host:n,port:r,database:i,user:o}=t;return{host:n,port:r,database:i,user:o}}function z1(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function ew(e){return typeof e=="string"?e:e.sql}function tw(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var vQ="@sentry/instrumentation-mysql",RQ="auto.db.otel.mysql",Af=class extends ae{constructor(t={}){super(vQ,q,t)}init(){return[new re("mysql",[">=2.0.0 <3"],t=>(w(t.createConnection)&&this._unwrap(t,"createConnection"),this._wrap(t,"createConnection",this._patchCreateConnection()),w(t.createPool)&&this._unwrap(t,"createPool"),this._wrap(t,"createPool",this._patchCreatePool()),w(t.createPoolCluster)&&this._unwrap(t,"createPoolCluster"),this._wrap(t,"createPoolCluster",this._patchCreatePoolCluster()),t),t=>{t!==void 0&&(this._unwrap(t,"createConnection"),this._unwrap(t,"createPool"),this._unwrap(t,"createPoolCluster"))})]}_patchCreateConnection(){return t=>{let n=this;return function(i){let o=t(...arguments);return n._wrap(o,"query",n._patchQuery(o)),o}}}_patchCreatePool(){return t=>{let n=this;return function(i){let o=t(...arguments);return n._wrap(o,"query",n._patchQuery(o)),n._wrap(o,"getConnection",n._patchGetConnection(o)),o}}}_patchCreatePoolCluster(){return t=>{let n=this;return function(i){let o=t(...arguments);return n._wrap(o,"getConnection",n._patchGetConnection(o)),o}}}_patchGetConnection(t){return n=>{let r=this;return function(o,s,c){if(!r._enabled)return r._unwrap(t,"getConnection"),n.apply(t,arguments);if(arguments.length===1&&typeof o=="function"){let a=r._getConnectionCallbackPatchFn(o);return n.call(t,a)}if(arguments.length===2&&typeof s=="function"){let a=r._getConnectionCallbackPatchFn(s);return n.call(t,o,a)}if(arguments.length===3&&typeof c=="function"){let a=r._getConnectionCallbackPatchFn(c);return n.call(t,o,s,a)}return n.apply(t,arguments)}}}_getConnectionCallbackPatchFn(t){let n=this,r=ne();return function(i,o){o&&(w(o.query)||n._wrap(o,"query",n._patchQuery(o))),typeof t=="function"&&Be(r,()=>t.call(this,i,o))}}_patchQuery(t){return n=>{let r=this;return function(i,o,s){if(!r._enabled)return r._unwrap(t,"query"),n.apply(t,arguments);let{host:c,port:a,database:l,user:p}=$1(t.config),u=parseInt(String(a),10),d={[S]:RQ,[Pe]:J1,[Q1]:z1(c,a,l),[yt]:l,[Lt]:p,[Ve]:ew(i),[Le]:c};isNaN(u)||(d[xe]=u);let m=k({name:tw(i),kind:U.CLIENT,attributes:d}),_=Array.from(arguments).findIndex(b=>typeof b=="function"),h=ne();if(_===-1){let b=se(m,()=>n.apply(t,arguments));return gn(b,h),b.on("error",R=>{m.setStatus({code:2,message:R.message})}).on("end",()=>{m.end()})}else return r._wrap(arguments,_,r._patchCallbackQuery(m,h)),se(m,()=>n.apply(t,arguments))}}}_patchCallbackQuery(t,n){return r=>function(i,o,s){return i&&t.setStatus({code:2,message:i.message}),t.end(),Be(n,()=>r(...arguments))}}};var nw="Mysql",pT=de(nw,()=>new Af({})),OQ=(()=>({name:nw,setupOnce(){pT()}})),uT=OQ;var rw="db.connection_string",iw="mysql";function ow(e){let{host:t,port:n,database:r,user:i}=CQ(e),o={[rw]:xQ(t,n,r),[yt]:r,[Lt]:i,[Le]:t},s=parseInt(n,10);return isNaN(s)||(o[xe]=s),o}function CQ(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function xQ(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function sw(e,t,n){let[r,i]=typeof e=="string"?[e,n]:[e.sql,PQ(e)?n||e.values:n];try{return t&&i?t(r,i):r}catch{return"Could not determine the query due to an error in formatting"}}function PQ(e){return"values"in e}function aw(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var cw=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function dT(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:t}var kQ="@sentry/instrumentation-mysql2",LQ="auto.db.otel.mysql2",mT=[">=1.4.2 <3.20.0"],Nf=class extends ae{constructor(t={}){super(kQ,q,t)}init(){let t;function n(o){!t&&o.format&&(t=o.format)}let r=o=>{w(o.query)&&this._unwrap(o,"query"),this._wrap(o,"query",this._patchQuery(t)),w(o.execute)&&this._unwrap(o,"execute"),this._wrap(o,"execute",this._patchQuery(t))},i=o=>{this._unwrap(o,"query"),this._unwrap(o,"execute")};return[new re("mysql2",mT,o=>(n(o),o),()=>{},[new Ae("mysql2/promise.js",mT,o=>(n(o),o),()=>{}),new Ae("mysql2/lib/connection.js",mT,o=>{let s=dT(o);return r(s),o},o=>{if(o===void 0)return;let s=dT(o);i(s)})])]}_patchQuery(t){let n=this;return r=>function(i,o,s){let c;Array.isArray(o)?c=o:arguments[2]&&(c=[o]);let a={...ow(this.config),[Pe]:iw,[Ve]:sw(i,t,c),[S]:LQ},l=k({name:aw(i),kind:U.CLIENT,attributes:a}),p=cw(u=>{u&&l.setStatus({code:2,message:u.message}),l.end()});if(arguments.length===1){typeof i.onResult=="function"&&n._wrap(i,"onResult",n._patchCallbackQuery(p));let u=r.apply(this,arguments);return u.once("error",d=>{p(d)}).once("result",()=>{p()}),u}return typeof arguments[1]=="function"?n._wrap(arguments,1,n._patchCallbackQuery(p)):typeof arguments[2]=="function"&&n._wrap(arguments,2,n._patchCallbackQuery(p)),r.apply(this,arguments)}}_patchCallbackQuery(t){return n=>function(...r){return t(r[0]),n(...r)}}};var lw="Mysql2",fT=de(lw,()=>new Nf),MQ=(()=>Gt(yE(),{name:lw,setupOnce(){fT()}})),gT=MQ;import*as Nw from"diagnostics_channel";var vf,pw;function uw(e){vf=e}function nc(){return!!vf}function _T(){if(vf)return pw??(pw=vf())}var wQ=["get","set","setex"],hT=["get","mget"],GQ=["set","setex"],bT=["del","unlink"];function hs(e,t){return e.includes(t.toLowerCase())}function yT(e){return hs(hT,e)?"cache.get":hs(GQ,e)?"cache.put":hs(bT,e)?"cache.remove":void 0}function UQ(e,t){return t.some(n=>e.startsWith(n))}function mw(e,t){try{if(t.length===0)return;let n=i=>typeof i=="string"||typeof i=="number"||Buffer.isBuffer(i)?[i.toString()]:Array.isArray(i)?dw(i.map(o=>n(o))):["<unknown>"],r=t[0];return hs(wQ,e)&&r!=null?n(r):dw(t.map(i=>n(i)))}catch{return}}function fw(e,t,n){if(!yT(e))return!1;for(let r of t)if(UQ(r,n))return!0;return!1}function gw(e){let t=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n=="string"?n.length:typeof n=="number"?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(e)?e.reduce((n,r)=>{let i=t(r);return typeof i=="number"?n!==void 0?n+i:i:n},0):t(e)}function dw(e){let t=[],n=r=>{r.forEach(i=>{Array.isArray(i)?n(i):t.push(i)})};return n(e),t}var Ep={};function _w(e){Ep=e}var bs=(e,t,n,r)=>{let i=mw(t,n),o=yT(t);if(!i||!o||!Ep.cachePrefixes||!fw(t,i,Ep.cachePrefixes))return;let s=oe(e).data,c=s["net.peer.name"]??s["server.address"],a=s["net.peer.port"]??s["server.port"];a&&c&&e.setAttributes({"network.peer.address":c,"network.peer.port":a});let l=hs(bT,t)?void 0:gw(r);l&&e.setAttribute(q_,l),hs(hT,t)&&l!==void 0&&e.setAttribute(X_,l>0),e.setAttributes({[H]:o,[K_]:i});let p=i.join(", ");e.updateName(Ep.maxCacheKeyLength?dn(p,Ep.maxCacheKeyLength):p)};var rc="db.connection_string",ic="redis";var DQ="@sentry/instrumentation-ioredis",hw="auto.db.otel.redis",BQ=[">=2.0.0 <5.11.0"];function ys(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var Rf=class extends ae{constructor(t={}){super(DQ,q,t)}init(){return[new re("ioredis",BQ,t=>{let n=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t;return w(n.prototype.sendCommand)&&this._unwrap(n.prototype,"sendCommand"),this._wrap(n.prototype,"sendCommand",this._patchSendCommand()),w(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"connect",this._patchConnection()),t},t=>{if(t===void 0)return;let n=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(){let t=this;return n=>function(...r){let i=r[0];if(r.length<1||typeof i!="object"||!Q())return n.apply(this,r);let{host:o,port:s}=this.options,c={[Pe]:ic,[Ve]:ti(i.name,i.args),[rc]:`redis://${o}:${s}`,[Le]:o,[xe]:s,[S]:hw},a=k({name:i.name,kind:U.CLIENT,attributes:c});try{let l=n.apply(this,r),p=i.resolve;i.resolve=function(d){t._callResponseHook(a,i,d),ys(a,null),p(d)};let u=i.reject;return i.reject=function(d){ys(a,d),u(d)},l}catch(l){throw ys(a,l),l}}}_patchConnection(){return t=>function(...n){if(!Q())return t.apply(this,n);let{host:r,port:i}=this.options,o={[Pe]:ic,[Ve]:"connect",[rc]:`redis://${r}:${i}`,[Le]:r,[xe]:i,[S]:hw},s=k({name:"connect",kind:U.CLIENT,attributes:o});try{let c=t.apply(this,n);return c instanceof Promise?c.then(a=>(ys(s,null),a),a=>(ys(s,a),Promise.reject(a))):(ys(s,null),c)}catch(c){throw ys(s,c),c}}}_callResponseHook(t,n,r){let{responseHook:i}=this.getConfig();if(i)try{i(t,n.name,n.args,r)}catch{}}};var ET="@sentry/instrumentation-redis",Sw="auto.db.otel.redis",Tp=Symbol("opentelemetry.instrumentation.redis.open_spans"),bw=Symbol("opentelemetry.instrumentation.redis.multi_command_options");function Of(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function Ew(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function HQ(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){Ye&&g.error("failed to sanitize redis connection url",t)}}function yw(e){return{[Pe]:ic,[Le]:e?.socket?.host,[xe]:e?.socket?.port,[rc]:HQ(e?.url),[S]:Sw}}var Tw=class Iw extends ae{constructor(t={}){super(ET,q,t)}init(){return[new re("redis",[">=2.6.0 <4"],t=>(w(t.RedisClient.prototype.internal_send_command)&&this._unwrap(t.RedisClient.prototype,"internal_send_command"),this._wrap(t.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),t),t=>{t!==void 0&&this._unwrap(t.RedisClient.prototype,"internal_send_command")})]}_getPatchInternalSendCommand(){let t=this;return function(r){return function(o){if(arguments.length!==1||typeof o!="object")return r.apply(this,arguments);let s={[Pe]:ic,[Ve]:ti(o.command,o.args),[S]:Sw};this.connection_options&&(s[Le]=this.connection_options.host,s[xe]=this.connection_options.port),this.address&&(s[rc]=`redis://${this.address}`);let c=k({name:`${Iw.COMPONENT}-${o.command}`,kind:U.CLIENT,attributes:s}),a=arguments[0].callback;if(a){let l=Q();arguments[0].callback=function(u,d){return Ew(t.getConfig().responseHook,c,o.command,o.args,d),Of(c,u),se(l??null,()=>a.apply(this,arguments))}}try{return r.apply(this,arguments)}catch(l){throw Of(c,l),l}}}}};Tw.COMPONENT="redis";var FQ=Tw,Aw=class ST extends ae{constructor(t={}){super(ET,q,t)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(t){let n=new Ae(`${t}/dist/lib/commander.js`,["^1.0.0"],(o,s)=>{let c=o.transformCommandArguments;if(!c)return Ye&&g.error("internal instrumentation error, missing transformCommandArguments function"),o;let a=s?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return w(o?.[a])&&this._unwrap(o,a),this._wrap(o,a,this._getPatchExtendWithCommands(c)),o},o=>{w(o?.extendWithCommands)&&this._unwrap(o,"extendWithCommands"),w(o?.attachCommands)&&this._unwrap(o,"attachCommands")}),r=new Ae(`${t}/dist/lib/client/multi-command.js`,["^1.0.0",">=5.0.0 <5.12.0"],o=>{let s=o?.default?.prototype;return w(s?.exec)&&this._unwrap(s,"exec"),this._wrap(s,"exec",this._getPatchMultiCommandsExec()),w(s?.execAsPipeline)&&this._unwrap(s,"execAsPipeline"),this._wrap(s,"execAsPipeline",this._getPatchMultiCommandsExec()),w(s?.addCommand)&&this._unwrap(s,"addCommand"),this._wrap(s,"addCommand",this._getPatchMultiCommandsAddCommand()),o},o=>{let s=o?.default?.prototype;w(s?.exec)&&this._unwrap(s,"exec"),w(s?.execAsPipeline)&&this._unwrap(s,"execAsPipeline"),w(s?.addCommand)&&this._unwrap(s,"addCommand")}),i=new Ae(`${t}/dist/lib/client/index.js`,["^1.0.0",">=5.0.0 <5.12.0"],o=>{let s=o?.default?.prototype;return s?.multi&&(w(s?.multi)&&this._unwrap(s,"multi"),this._wrap(s,"multi",this._getPatchRedisClientMulti())),s?.MULTI&&(w(s?.MULTI)&&this._unwrap(s,"MULTI"),this._wrap(s,"MULTI",this._getPatchRedisClientMulti())),w(s?.sendCommand)&&this._unwrap(s,"sendCommand"),this._wrap(s,"sendCommand",this._getPatchRedisClientSendCommand()),w(s?.connect)&&this._unwrap(s,"connect"),this._wrap(s,"connect",this._getPatchedClientConnect()),o},o=>{let s=o?.default?.prototype;w(s?.multi)&&this._unwrap(s,"multi"),w(s?.MULTI)&&this._unwrap(s,"MULTI"),w(s?.sendCommand)&&this._unwrap(s,"sendCommand"),w(s?.connect)&&this._unwrap(s,"connect")});return new re(t,["^1.0.0",">=5.0.0 <5.12.0"],o=>o,()=>{},[n,r,i])}_getPatchExtendWithCommands(t){let n=this;return function(i){return function(s){if(s?.BaseClass?.name!=="RedisClient")return i.apply(this,arguments);let c=s.executor;return s.executor=function(a,l){let p=t(a,l).args;return n._traceClientCommand(c,this,arguments,p)},i.apply(this,arguments)}}}_getPatchMultiCommandsExec(){let t=this;return function(r){return function(){let o=r.apply(this,arguments);return typeof o?.then!="function"?(Ye&&g.error("non-promise result when patching exec/execAsPipeline"),o):o.then(s=>{let c=this[Tp];return t._endSpansWithRedisReplies(c,s),s}).catch(s=>{let c=this[Tp];if(!c)Ye&&g.error("cannot find open spans to end for multi/pipeline");else{let a=s.constructor.name==="MultiErrorReply"?s.replies:new Array(c.length).fill(s);t._endSpansWithRedisReplies(c,a)}return Promise.reject(s)})}}}_getPatchMultiCommandsAddCommand(){let t=this;return function(r){return function(o){return t._traceClientCommand(r,this,arguments,o)}}}_getPatchRedisClientMulti(){return function(n){return function(){let i=n.apply(this,arguments);return i[bw]=this.options,i}}}_getPatchRedisClientSendCommand(){let t=this;return function(r){return function(o){return t._traceClientCommand(r,this,arguments,o)}}}_getPatchedClientConnect(){return function(n){return function(){let i=yw(this.options),o=k({name:`${ST.COMPONENT}-connect`,kind:U.CLIENT,attributes:i});return se(o,()=>n.apply(this)).then(c=>(o.end(),c),c=>(Of(o,c),Promise.reject(c)))}}}_traceClientCommand(t,n,r,i){let o=n.options||n[bw],s=i[0],c=i.slice(1),a=yw(o),l=ti(s,c);l!=null&&(a[Ve]=l);let p=k({name:`${ST.COMPONENT}-${s}`,kind:U.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[Tp]=d[Tp]||[],d[Tp].push({span:p,commandName:s,commandArgs:c})}return u}_endSpansWithRedisReplies(t,n){if(!t){Ye&&g.error("cannot find open spans to end for redis multi/pipeline");return}if(n.length!==t.length){Ye&&g.error("number of multi command spans does not match response from redis");return}for(let r=0;r<t.length;r++){let{span:i,commandName:o,commandArgs:s}=t[r],c=n[r],[a,l]=c instanceof Error?[null,c]:[c,void 0];this._endSpanWithResponse(i,o,s,a,l)}}_endSpanWithResponse(t,n,r,i,o){o||Ew(this.getConfig().responseHook,t,n,r,i),Of(t,o)}};Aw.COMPONENT="redis";var WQ=Aw,Cf=class extends ae{constructor(t={}){super(ET,q,t),this.initialized=!1,this.instrumentationV2_V3=new FQ(this.getConfig()),this.instrumentationV4_V5=new WQ(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 xf="Redis",VQ=de(`${xf}.IORedis`,()=>new Rf({responseHook:bs})),YQ=de(`${xf}.Redis`,()=>new Cf({responseHook:bs})),TT=Object.assign(()=>{(!nc()||!Nw.tracingChannel)&&(VQ(),YQ())},{id:xf}),jQ=((e={})=>Gt(RE({responseHook:bs}),{name:xf,setupOnce(){_w(e),TT()}})),IT=jQ;var Ss=(e=>(e.QUERY_PREFIX="pg.query",e.CONNECT="pg.connect",e.POOL_CONNECT="pg-pool.connect",e))(Ss||{});var Ip=(e=>(e.PG_PLAN="db.postgresql.plan",e.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",e.MAX_CLIENT="db.postgresql.max.client",e))(Ip||{});var AT="db.connection_string",NT="postgresql";var ZQ="auto.db.otel.postgres";function XQ(e,t){if(!t)return Ss.QUERY_PREFIX;let n=typeof t.name=="string"&&t.name?t.name:KQ(t.text);return`${Ss.QUERY_PREFIX}:${n}${e?` ${e}`:""}`}function KQ(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 qQ(e){try{let t=new URL(e);return t.username="",t.password="",t.toString()}catch{return"postgresql://localhost:5432/"}}function vw(e){if("connectionString"in e&&e.connectionString)return qQ(e.connectionString);let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}function Rw(e){if(Number.isInteger(e))return e}function vT(e){return{[Pe]:NT,[yt]:e.database,[AT]:vw(e),[Lt]:e.user,[Le]:e.host,[xe]:Rw(e.port)}}function Ow(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[Ip.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[Ip.MAX_CLIENT]:e.maxClient,[Pe]:NT,[yt]:t?.pathname.slice(1)??e.database,[AT]:vw(e),[Le]:t?.hostname??e.host,[xe]:Number(t?.port)||Rw(e.port),[Lt]:t?.username??e.user}}function Pf(){return Q()===void 0}function Cw(e){let{connectionParameters:t}=this,n=t.database,r=XQ(n,e),i=k({name:r,kind:U.CLIENT,attributes:{...vT(t),[S]:ZQ}});return e&&(e.text&&i.setAttribute(Ve,e.text),typeof e.name=="string"&&i.setAttribute(Ip.PG_PLAN,e.name)),i}function RT(e,t){return function(r,i){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,i)}}function xw(e,t){return function(r,i,o){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,i,o)}}function Pw(e,t){return function(...r){let i=r[0];i instanceof Error&&e.setStatus({code:2,message:i.message}),e.end(),t.apply(this,r)}}function kf(e){return typeof e=="object"&&e!==null&&"message"in e?String(e.message):void 0}function kw(e){return typeof e=="object"&&typeof e?.text=="string"}var QQ="@sentry/instrumentation-pg";function oc(e){return e[Symbol.toStringTag]==="Module"?e.default:e}function Lf(e,t){return function(...n){return se(e,()=>t.apply(this,n))}}var Mf=class extends ae{constructor(t={}){super(QQ,q,t)}init(){let t=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new Ae("pg/lib/native/client.js",t,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),i=new Ae("pg/lib/client.js",t,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new re("pg",t,c=>{let a=oc(c);return this._patchPgClient(a.Client),c},c=>{let a=oc(c);return this._unpatchPgClient(a.Client),c},[i,r]),s=new re("pg-pool",n,c=>{let a=oc(c);return w(a.prototype.connect)&&this._unwrap(a.prototype,"connect"),this._wrap(a.prototype,"connect",this._getPoolConnectPatch()),a},c=>{let a=oc(c);w(a.prototype.connect)&&this._unwrap(a.prototype,"connect")});return[o,s]}_patchPgClient(t){if(!t)return;let n=oc(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=oc(t);return w(n.prototype.query)&&this._unwrap(n.prototype,"query"),w(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),t}_getClientConnectPatch(){let t=this;return n=>function(i){if(Pf()||t.getConfig().ignoreConnectSpans)return n.call(this,i);let o=k({name:Ss.CONNECT,kind:U.CLIENT,attributes:vT(this)}),s=i;if(s){let a=Q();s=Pw(o,s),a&&(s=Lf(a,s))}let c=se(o,()=>n.call(this,s));return Lw(o,c)}}_getClientQueryPatch(){return t=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...r){if(Pf())return t.apply(this,r);let i=r[0],o=typeof i=="string",s=kw(i),c=o?{text:i,values:Array.isArray(r[1])?r[1]:void 0}:s?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(r[1])?r[1]:void 0)}:void 0,a=Cw.call(this,c);if(r.length>0){let p=Q();if(typeof r[r.length-1]=="function")r[r.length-1]=RT(a,r[r.length-1]),p&&(r[r.length-1]=Lf(p,r[r.length-1]));else if(typeof c?.callback=="function"){let u=RT(a,c.callback);p&&(u=Lf(p,u)),r[0].callback=u}}let l;try{l=t.apply(this,r)}catch(p){throw a.setStatus({code:2,message:kf(p)}),a.end(),p}return l instanceof Promise?l.then(p=>(a.end(),p)).catch(p=>(a.setStatus({code:2,message:kf(p)}),a.end(),Promise.reject(p))):l})}_getPoolConnectPatch(){let t=this;return n=>function(i){if(Pf()||t.getConfig().ignoreConnectSpans)return n.call(this,i);let o=k({name:Ss.POOL_CONNECT,kind:U.CLIENT,attributes:Ow(this.options)}),s=i;if(s){let a=Q();s=xw(o,s),a&&(s=Lf(a,s))}let c=se(o,()=>n.call(this,s));return Lw(o,c)}}};function Lw(e,t){return t instanceof Promise?t.then(r=>(e.end(),r)).catch(r=>(e.setStatus({code:2,message:kf(r)}),e.end(),Promise.reject(r))):t}var Mw="Postgres",OT=de(Mw,Mf,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),JQ=(e=>({name:Mw,setupOnce(){OT(e)}})),CT=JQ;st();var PT="PostgresJs",ww=[">=3.0.0 <4"],$Q="db.response.status_code",zQ=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,eJ=Symbol.for("sentry.query.from.instrumented.sql"),kT=de(PT,e=>new xT({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),xT=class extends ae{constructor(t){super("sentry-postgres-js",q,t)}init(){let t=new re("postgres",ww,n=>{try{return this._patchPostgres(n)}catch(r){return Ye&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{t.files.push(new Ae(`postgres/${n}/query.js`,ww,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 Ye&&g.warn("postgres module does not export a function. Skipping instrumentation."),t;let i=this,o=function(...s){let c=Reflect.construct(r,s);if(!c||typeof c!="function")return Ye&&g.warn("postgres() did not return a valid instance"),c;let a=i.getConfig();return wy(c,{requireParentSpan:a.requireParentSpan,requestHook:a.requestHook})};Object.setPrototypeOf(o,r),Object.setPrototypeOf(o.prototype,r.prototype);for(let s of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(s)){let c=Object.getOwnPropertyDescriptor(r,s);c&&Object.defineProperty(o,s,c)}return n?o:(kl(t,"default",o),t)}_shouldCreateSpans(){let t=this.getConfig();return he.getSpan(pe.active())!==void 0||!t.requireParentSpan}_setOperationName(t,n,r){if(r){t.setAttribute(sr,r);return}let i=n?.match(zQ);i?.[1]&&t.setAttribute(sr,i[1].toUpperCase())}_reconstructQuery(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((n,r,i)=>i===0?r:`${n}$${i}${r}`,"")}_sanitizeSqlQuery(t){return t?t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(t){let n=this,r=t.Query.prototype.handle;return t.Query.prototype.handle=async function(...i){if(this.executed||this[eJ])return r.apply(this,i);if(!n._shouldCreateSpans())return r.apply(this,i);let o=n._reconstructQuery(this.strings),s=n._sanitizeSqlQuery(o);return ke({name:s||"postgresjs.query",op:"db"},c=>{nE(c,"auto.db.postgresjs"),c.setAttributes({[ut]:"postgres",[Lr]:s});let a=n.getConfig(),{requestHook:l}=a;l&&Jr(()=>l(c,s,void 0),d=>{d&&(c.setAttribute("sentry.hook.error","requestHook failed"),Ye&&g.error(`Error in requestHook for ${PT} 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){Ye&&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($Q,_?.[0]?.code||"unknown"),c.setAttribute(Mr,_?.[0]?.name||"unknown"),n._setOperationName(c,s),c.end()}catch(h){Ye&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(d,m,_)}});try{return r.apply(this,i)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})},t.Query.prototype.handle.__sentry_original__=r,t}_unpatchQueryPrototype(t){return t.Query.prototype.handle.__sentry_original__&&(t.Query.prototype.handle=t.Query.prototype.handle.__sentry_original__),t}},tJ=(e=>({name:PT,setupOnce(){kT(e)}})),LT=tJ;st();var Pn=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(Pn||{});var Gw="@hapi/hapi",Ap=Symbol("hapi-handler-patched"),Np={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},Uw=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"]);function Dw(e){return e.name?e.name:e.pkg.name}var wf=e=>typeof e=="string"&&Uw.has(e),Bw=e=>{let t=e?.type;return t!==void 0&&wf(t)},Hw=e=>Array.isArray(e)&&e.length<=3&&wf(e[0])&&typeof e[1]=="function",Fw=e=>!Array.isArray(e),Ww=(e,t)=>{let n={[He]:e.path,[Ur]:e.method},r;return t?(n[Pn.HAPI_TYPE]=Np.PLUGIN,n[Pn.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[Pn.HAPI_TYPE]=Np.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},Vw=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[Pn.EXT_TYPE]:e,[Pn.HAPI_TYPE]:Np.EXT,[Pn.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[Pn.EXT_TYPE]:e,[Pn.HAPI_TYPE]:Np.EXT},name:r}},MT=e=>"plugin"in e?"plugin"in e.plugin?e.plugin.plugin:e.plugin:e;var nJ="@sentry/instrumentation-hapi",Gf=class extends ae{constructor(t={}){super(nJ,q,t)}init(){return new re(Gw,[">=17.0.0 <22"],t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;return w(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),w(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;this._massUnwrap([n],["server","Server"])})}_getServerPatch(t){let n=this,r=this;return function(o){let s=t.apply(this,[o]);return r._wrap(s,"route",c=>n._getServerRoutePatch.bind(n)(c)),r._wrap(s,"ext",c=>n._getServerExtPatch.bind(n)(c)),r._wrap(s,"register",n._getServerRegisterPatch.bind(n)),s}}_getServerRegisterPatch(t){let n=this;return function(i,o){if(Array.isArray(i))for(let s of i){let c=MT(s);n._wrapRegisterHandler(c)}else{let s=MT(i);n._wrapRegisterHandler(s)}return t.apply(this,[i,o])}}_getServerExtPatch(t,n){let r=this;return function(...o){if(Array.isArray(o[0])){let s=o[0];for(let c=0;c<s.length;c++){let a=s[c];if(wf(a.type)){let l=a,p=r._wrapExtMethods(l.method,a.type,n);l.method=p,s[c]=l}}return t.apply(this,o)}else if(Hw(o)){let s=o,c=s[1],a=r._wrapExtMethods(c,s[0],n);return t.apply(this,[s[0],a,s[2]])}else if(Bw(o[0])){let s=o[0],c=r._wrapExtMethods(s.method,s.type,n);return s.method=c,t.call(this,s)}return t.apply(this,o)}}_getServerRoutePatch(t,n){let r=this;return function(i){if(Array.isArray(i))for(let o=0;o<i.length;o++){let s=r._wrapRouteHandler.call(r,i[o],n);i[o]=s}else i=r._wrapRouteHandler.call(r,i,n);return t.apply(this,[i])}}_wrapRegisterHandler(t){let n=this,r=Dw(t),i=t.register,o=this,s=function(c,a){return o._wrap(c,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),o._wrap(c,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),i.call(this,c,a)};t.register=s}_wrapExtMethods(t,n,r){let i=this;if(t instanceof Array){for(let o=0;o<t.length;o++)t[o]=i._wrapExtMethods(t[o],n);return t}else if(Fw(t))return t[Ap]===!0?t:(t[Ap]=!0,function(...s){if(he.getSpan(pe.active())===void 0)return t.apply(this,s);let c=Vw(n,r,t.name);return Se({name:c.name,op:`${c.attributes[Pn.HAPI_TYPE]}.hapi`,attributes:{...c.attributes,[S]:"auto.http.otel.hapi"}},()=>t.apply(void 0,s))});return t}_wrapRouteHandler(t,n){if(t[Ap]===!0)return t;t[Ap]=!0;let r=i=>function(...o){if(he.getSpan(pe.active())===void 0)return i.call(this,...o);ei(t.path);let s=Ww(t,n);return Se({name:s.name,op:`${s.attributes[Pn.HAPI_TYPE]}.hapi`,attributes:{...s.attributes,[S]:"auto.http.otel.hapi"}},()=>i.call(this,...o))};if(typeof t.handler=="function")t.handler=r(t.handler);else if(typeof t.options=="function"){let i=t.options;t.options=function(o){let s=i(o);return typeof s.handler=="function"&&(s.handler=r(s.handler)),s}}else typeof t.options?.handler=="function"&&(t.options.handler=r(t.options.handler));return t}};var Yw="Hapi",Uf=de(Yw,()=>new Gf),rJ=(()=>({name:Yw,setupOnce(){Uf()}})),wT=rJ;function iJ(e){return!!(e&&typeof e=="object"&&"error"in e&&e.error)}function oJ(e){me(e,{mechanism:{type:"auto.function.hapi",handled:!1}})}var sJ={name:"SentryHapiErrorPlugin",version:q,register:async function(e){e.events.on({name:"request",channels:["error"]},(n,r)=>{if(J()!==vt()){let i=n.route;i.path&&J().setTransactionName(`${i.method.toUpperCase()} ${i.path}`)}else Ye&&g.warn("Isolation scope is still the default isolation scope - skipping setting transactionName");iJ(r)&&oJ(r.error)})}};async function aJ(e){await e.register(sJ),gr(e.register,"hapi")}var ho={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},vp={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};st();var cJ="@sentry/instrumentation-hono",lJ="0.0.1",Df=class extends ae{constructor(t={}){super(cJ,lJ,t)}init(){return[new re("hono",[">=4.0.0 <5"],t=>this._patch(t))]}_patch(t){let n=this;class r extends t.Hono{constructor(...o){super(...o),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{t.Hono=r}catch{return{...t,Hono:r}}return t}_patchHandler(){let t=this;return function(n){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return n.apply(this,[o]);let s=i.slice(1);return n.apply(this,[o,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,i.map(o=>t._wrapHandler(o)))}}}_patchOnHandler(){let t=this;return function(n){return function(...i){let o=i.slice(2);return n.apply(this,[...i.slice(0,2),...o.map(s=>t._wrapHandler(s))])}}}_patchMiddlewareHandler(){let t=this;return function(n){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return n.apply(this,[o]);let s=i.slice(1);return n.apply(this,[o,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,i.map(o=>t._wrapHandler(o)))}}}_wrapHandler(t){let n=this;return function(r,i){if(!n.isEnabled())return t.apply(this,[r,i]);let o=r.req.path,s=n.tracer.startSpan(o);return pe.with(he.setSpan(pe.active(),s),()=>n._safeExecute(()=>{let c=t.apply(this,[r,i]);if(_t(c))return c.then(a=>{let l=n._determineHandlerType(a);return s.setAttributes({[ho.HONO_TYPE]:l,[ho.HONO_NAME]:l===vp.REQUEST_HANDLER?o:t.name||"anonymous"}),n.getConfig().responseHook?.(s),a});{let a=n._determineHandlerType(c);return s.setAttributes({[ho.HONO_TYPE]:a,[ho.HONO_NAME]:a===vp.REQUEST_HANDLER?o:t.name||"anonymous"}),n.getConfig().responseHook?.(s),c}},()=>s.end(),c=>{n._handleError(s,c),s.end()}))}}_safeExecute(t,n,r){try{let i=t();return _t(i)?i.then(()=>n(),o=>r(o)):n(),i}catch(i){throw r(i),i}}_determineHandlerType(t){return t===void 0?vp.MIDDLEWARE:vp.REQUEST_HANDLER}_handleError(t,n){n instanceof Error&&(t.setStatus({code:Mn.ERROR,message:n.message}),t.recordException(n))}};var jw="Hono";function pJ(e){let t=oe(e).data,n=t[ho.HONO_TYPE];if(t[H]||!n)return;e.setAttributes({[S]:"auto.http.otel.hono",[H]:`${n}.hono`});let r=t[ho.HONO_NAME];if(typeof r=="string"&&e.updateName(r),J()===vt()){Ye&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=t[He],o=t[Dr];typeof i=="string"&&typeof o=="string"&&J().setTransactionName(`${o} ${i}`)}var GT=de(jw,()=>new Df({responseHook:e=>{pJ(e)}})),uJ=(()=>({name:jw,setupOnce(){GT()}})),UT=uJ;function dJ(){return async function(t,n){let r=$o(t.req);J().setSDKProcessingMetadata({normalizedRequest:r}),await n()}}function mJ(e){return e.res.status>=500}function fJ(e){return async function(n,r){await r(),(e?.shouldHandleError||mJ)(n)&&(n.res.sentry=me(n.error,{mechanism:{type:"auto.middleware.hono",handled:!1}}))}}function gJ(e,t){e.use(dJ()),e.use(fJ(t)),gr(e.use,"hono")}st();var Es=(e=>(e.ROUTER="router",e.MIDDLEWARE="middleware",e))(Es||{});var bo=(e=>(e.KOA_TYPE="koa.type",e.KOA_NAME="koa.name",e))(bo||{});var Zw=(e,t,n,r)=>n?{attributes:{[bo.KOA_NAME]:r?.toString(),[bo.KOA_TYPE]:Es.ROUTER,[He]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[bo.KOA_NAME]:t.name??"middleware",[bo.KOA_TYPE]:Es.MIDDLEWARE,[Au]:t.name??"middleware"},name:`middleware - ${t.name}`},Xw=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e));var DT=Symbol("koa-layer-patched");var _J="@sentry/instrumentation-koa",Bf=class extends ae{constructor(t={}){super(_J,q,t)}init(){return new re("koa",[">=2.0.0 <4"],t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;return n==null?n:(w(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),t)},t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;n&&w(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(t){let n=this._patchRouterDispatch.bind(this),r=this._patchLayer.bind(this);return function(o){let s=o.router?n(o):r(o,!1);return t.apply(this,[s])}}_patchRouterDispatch(t){let r=t.router?.stack??[];for(let i of r){let o=i.path,s=i.stack;for(let c=0;c<s.length;c++){let a=s[c];s[c]=this._patchLayer(a,!0,o)}}return t}_patchLayer(t,n,r){let i=n?Es.ROUTER:Es.MIDDLEWARE;return t[DT]===!0||Xw(i,this.getConfig())||t.constructor.name==="GeneratorFunction"||t.constructor.name==="AsyncGeneratorFunction"?t:(t[DT]=!0,(o,s)=>{if(he.getSpan(pe.active())===void 0)return t(o,s);let a=Zw(o,t,n,r);o._matchedRoute&&ei(o._matchedRoute.toString());let l=a.attributes[bo.KOA_NAME],p=typeof l=="string"?l||"< unknown >":a.name;return Se({name:p,op:`${i}.koa`,attributes:{...a.attributes,[S]:"auto.http.otel.koa"}},()=>{let u=a.attributes[He];if(J()===vt())Ye&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");else if(u){let d=o.request?.method?.toUpperCase()||"GET";J().setTransactionName(`${d} ${u}`)}return t(o,s)})})}};var Kw="Koa",BT=de(Kw,Bf,(e={})=>({ignoreLayersType:e.ignoreLayersType})),hJ=((e={})=>({name:Kw,setupOnce(){BT(e)}})),HT=hJ,bJ=e=>{e.use(async(t,n)=>{try{await n()}catch(r){throw me(r,{mechanism:{handled:!1,type:"auto.middleware.koa"}}),r}}),gr(e.use,"koa")};var Hf=(e=>(e.CONNECT_TYPE="connect.type",e.CONNECT_NAME="connect.name",e))(Hf||{}),Ff=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(Ff||{});var wi=Symbol("opentelemetry.instrumentation-connect.request-route-stack");var qw=e=>{Array.isArray(e[wi])===!1&&Object.defineProperty(e,wi,{enumerable:!1,value:[]}),e[wi].push("/");let t=e[wi].length;return()=>{t===e[wi].length?e[wi].pop():Ye&&g.warn("Connect: Trying to pop the stack multiple time")}},Qw=(e,t)=>{t&&e[wi].splice(-1,1,t)},Jw=e=>e[wi].reduce((t,n)=>t.replace(/\/+$/,"")+n);var yJ="@sentry/instrumentation-connect",SJ="anonymous",Wf=class extends ae{constructor(t={}){super(yJ,q,t)}init(){return[new re("connect",[">=3.0.0 <4"],t=>this._patchConstructor(t))]}_patchApp(t){w(t.use)||this._wrap(t,"use",this._patchUse.bind(this)),w(t.handle)||this._wrap(t,"handle",this._patchHandle.bind(this))}_patchConstructor(t){let n=this._patchApp.bind(this);return function(...r){let i=Reflect.apply(t,this,r);return n(i),i}}_patchNext(t,n,r){return function(o){et(o)&&n.setStatus({code:2,message:"internal_error"});let s=t.apply(this,[o]);return r(),s}}_startSpan(t,n){let r=t?Ff.REQUEST_HANDLER:Ff.MIDDLEWARE,i=t||n.name||SJ;return k({name:i,op:`${r}.connect`,attributes:{[S]:"auto.http.otel.connect",[He]:t.length>0?t:"/",[Hf.CONNECT_TYPE]:r,[Hf.CONNECT_NAME]:i}})}_patchMiddleware(t,n){let r=this.isEnabled.bind(this),i=this._startSpan.bind(this),o=this._patchNext.bind(this),s=n.length===4;function c(){if(!r())return Reflect.apply(n,this,arguments);let[a,l,p]=s?[1,2,3]:[0,1,2],u=arguments[a],d=arguments[l],m=arguments[p];Qw(u,t),t&&ei(Jw(u));let _=i(t,n),h=!1;function b(){h||(h=!0,_.end()),d.removeListener("close",b)}d.addListener("close",b),arguments[p]=o(m,_,b);try{return Reflect.apply(n,this,arguments)}catch(R){throw _.setStatus({code:2,message:"internal_error"}),b(),R}}return Object.defineProperty(c,"length",{value:n.length,writable:!1,configurable:!0}),c}_patchUse(t){let n=this._patchMiddleware.bind(this);return function(...r){let i=r[r.length-1],o=r[r.length-2]||"";return r[r.length-1]=n(o,i),t.apply(this,r)}}_patchHandle(t){let n=this._patchOut.bind(this);return function(){let[r,i]=[0,2],o=arguments[r],s=arguments[i],c=qw(o);return typeof s=="function"&&(arguments[i]=n(s,c)),Reflect.apply(t,this,arguments)}}_patchOut(t,n){return function(...i){return n(),Reflect.apply(t,this,i)}}};var $w="Connect",FT=de($w,()=>new Wf),EJ=(()=>({name:$w,setupOnce(){FT()}})),WT=EJ;function TJ(e,t,n,r){me(e,{mechanism:{handled:!1,type:"auto.middleware.connect"}}),r(e)}var IJ=e=>{e.use(TJ),gr(e.use,"connect")};var zw="db.sql.table",eG="sqlite",tG="postgresql";var nG=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>"},AJ=new Map([["sqlite3",eG],["pg",tG]]),rG=e=>AJ.get(e)||e,iG=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,oG=(e,t)=>typeof e=="string"&&typeof t=="number"&&0<t&&t<e.length?`${e.substring(0,t)}..`:e,sG=e=>{if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}},aG=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},cG=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},VT=e=>{let t=e?._single?.table;return typeof t=="object"?VT(t):t};var NJ="@sentry/instrumentation-knex",vJ="auto.db.otel.knex",RJ="knex",YT=[">=0.22.0 <4",">=0.10.0 <0.18.0",">=0.19.0 <0.22.0",">=0.18.0 <0.19.0"],OJ=1022,lG=Symbol("sentry.instrumentation-knex.parent-span"),Vf=class extends ae{constructor(t={}){super(NJ,q,t)}init(){let t=new re(RJ,YT);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 Ae(`knex/${t}/runner.js`,YT,(n,r)=>(this._ensureWrapped(n.prototype,"query",this._createQueryWrapper(r)),n),n=>(this._unwrap(n.prototype,"query"),n))}_getClientNodeModuleFileInstrumentation(t){return new Ae(`knex/${t}/client.js`,YT,n=>(this._ensureWrapped(n.prototype,"queryBuilder",this._storeContext.bind(this)),this._ensureWrapped(n.prototype,"schemaBuilder",this._storeContext.bind(this)),this._ensureWrapped(n.prototype,"raw",this._storeContext.bind(this)),n),n=>(this._unwrap(n.prototype,"queryBuilder"),this._unwrap(n.prototype,"schemaBuilder"),this._unwrap(n.prototype,"raw"),n))}_createQueryWrapper(t){return function(r){return function(o){let s=this.client.config,c=VT(this.builder),a=o?.method,l=s?.connection?.connectionString,p=s?.connection?.filename||s?.connection?.database||sG(l),u={[S]:vJ,"knex.version":t,[Pe]:rG(this.client.driverName),[zw]:c,[zs]:a,[Lt]:s?.connection?.user,[yt]:p,[Le]:s?.connection?.host??aG(l),[xe]:s?.connection?.port??cG(l),[oa]:s?.connection?.filename===":memory:"?"inproc":void 0,[Ve]:oG(o?.sql,OJ)},d=this.builder[lG]||Q(),m=arguments;return Se({name:iG(p,a,c),kind:U.CLIENT,attributes:u,parentSpan:d,onlyIfParent:!0},_=>r.apply(this,m).catch(h=>{let R=nG(this)(o.sql,o.bindings||[]),M=h.message.replace(`${R} - `,"");throw _.setStatus({code:2,message:M}),h}))}}}_storeContext(t){return function(){let r=t.apply(this,arguments);return Object.defineProperty(r,lG,{value:Q()}),r}}_ensureWrapped(t,n,r){w(t[n])&&this._unwrap(t,n),this._wrap(t,n,r)}};import*as jn from"diagnostics_channel";var CJ="sentrySubscribeOrchestrionChannel";function fe(e){let t=new Set,n=[];for(let{module:r}of e){let i=`${r.name}\0${r.versionRange}\0${String(r.filePath)}`;t.has(i)||(t.add(i),n.push({channelName:r.name,module:r,astQuery:"Program",transform:CJ}))}return n}var ri={name:"amqplib",versionRange:">=0.5.5 <2"},jT=[{channelName:"publish",module:{...ri,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"publish",kind:"Sync"}},{channelName:"confirmPublish",module:{...ri,filePath:"lib/channel_model.js"},functionQuery:{className:"ConfirmChannel",methodName:"publish",kind:"Callback"}},{channelName:"consume",module:{...ri,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"consume",kind:"Async"}},{channelName:"dispatch",module:{...ri,filePath:"lib/channel.js"},functionQuery:{className:"BaseChannel",methodName:"dispatchMessage",kind:"Sync"}},{channelName:"ack",module:{...ri,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ack",kind:"Sync"}},{channelName:"nack",module:{...ri,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nack",kind:"Sync"}},{channelName:"reject",module:{...ri,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"reject",kind:"Sync"}},{channelName:"ackAll",module:{...ri,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ackAll",kind:"Sync"}},{channelName:"nackAll",module:{...ri,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nackAll",kind:"Sync"}},{channelName:"connect",module:{...ri,filePath:"lib/connect.js"},functionQuery:{functionName:"connect",kind:"Callback"}}],pG={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"},uG=fe(jT);var ZT=[...["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"}}))],dG={ANTHROPIC_CHAT:"orchestrion:@anthropic-ai/sdk:chat",ANTHROPIC_MODELS:"orchestrion:@anthropic-ai/sdk:models",ANTHROPIC_MESSAGES_STREAM:"orchestrion:@anthropic-ai/sdk:messages-stream"},mG=fe(ZT);var XT=[{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"}}],fG={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"},gG=fe(XT);var sc={name:"dataloader",versionRange:">=2.0.0 <3",filePath:"index.js"},KT=[{channelName:"construct",module:sc,functionQuery:{functionName:"DataLoader",kind:"Sync"}},{channelName:"load",module:sc,functionQuery:{expressionName:"load",kind:"Async"}},{channelName:"loadMany",module:sc,functionQuery:{expressionName:"loadMany",kind:"Async"}},{channelName:"prime",module:sc,functionQuery:{expressionName:"prime",kind:"Sync"}},{channelName:"clear",module:sc,functionQuery:{expressionName:"clear",kind:"Sync"}},{channelName:"clearAll",module:sc,functionQuery:{expressionName:"clearAll",kind:"Sync"}}],_G={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"},hG=fe(KT);var qT=[{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"}}],bG={EXPRESS_HANDLE:"orchestrion:express:handle",ROUTER_HANDLE:"orchestrion:router:handle",EXPRESS_REGISTER:"orchestrion:express:register",ROUTER_REGISTER:"orchestrion:router:register"},yG=fe(qT);var xJ=">=3.0.0 <5",PJ=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,kJ=[{functionName:"addDoc",channelName:"add-doc"},{functionName:"getDocs",channelName:"get-docs"},{functionName:"setDoc",channelName:"set-doc"},{functionName:"deleteDoc",channelName:"delete-doc"}],LJ=">=6.0.0 <7",MJ=[{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"}],QT=[...kJ.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:"@firebase/firestore",versionRange:xJ,filePath:PJ},functionQuery:{functionName:e,kind:"Auto"}})),...MJ.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:"firebase-functions",versionRange:LJ,filePath:e},functionQuery:{functionName:t,kind:"Sync"}}))],SG={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"},EG=fe(QT);var JT=[{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"}}],TG={GENERIC_POOL_ACQUIRE:"orchestrion:generic-pool:acquire"},IG=fe(JT);var $T=["dist/node/index.js","dist/node/index.mjs","dist/node/index.cjs"],zT=[...$T.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"}}))),...$T.map(e=>({channelName:"embed-content",module:{name:"@google/genai",versionRange:">=0.10.0 <2",filePath:e},functionQuery:{className:"Models",methodName:"embedContent",kind:"Auto"}})),...$T.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"}})))],AG={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"},NG=fe(zT);var eI=[{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"}}],vG={GRAPHQL_PARSE:"orchestrion:graphql:parse",GRAPHQL_VALIDATE:"orchestrion:graphql:validate",GRAPHQL_EXECUTE:"orchestrion:graphql:execute"},RG=fe(eI);var tI=[{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"}}],OG={HAPI_ROUTE:"orchestrion:@hapi/hapi:route",HAPI_EXT:"orchestrion:@hapi/hapi:ext"},CG=fe(tI);var nI=[...["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"}}],xG={IOREDIS_COMMAND:"orchestrion:ioredis:command",IOREDIS_CONNECT:"orchestrion:ioredis:connect"},PG=fe(nI);var rI=[{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"}}],kG={KAFKAJS_SEND_BATCH:"orchestrion:kafkajs:send_batch",KAFKAJS_CONSUMER_RUN:"orchestrion:kafkajs:consumer_run"},LG=fe(rI);var MG="knex",wJ=[{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"}],GJ=[{filePath:"lib/client.js",versionRange:">=0.10.0 <4"},{filePath:"src/client.js",versionRange:">=0.18.0 <0.19.0"}],UJ=["queryBuilder","schemaBuilder","raw"];function DJ(e,t){return{channelName:"query",module:{name:MG,versionRange:t,filePath:e},functionQuery:{className:"Runner",methodName:"query",kind:"Async"}}}function BJ(e,t,n){return{channelName:e,module:{name:MG,versionRange:n,filePath:t},functionQuery:{className:"Client",methodName:e,kind:"Sync"}}}var iI=[...wJ.map(({filePath:e,versionRange:t})=>DJ(e,t)),...GJ.flatMap(({filePath:e,versionRange:t})=>UJ.map(n=>BJ(n,e,t)))],wG={KNEX_QUERY:"orchestrion:knex:query",KNEX_QUERY_BUILDER:"orchestrion:knex:queryBuilder",KNEX_SCHEMA_BUILDER:"orchestrion:knex:schemaBuilder",KNEX_RAW:"orchestrion:knex:raw"},GG=fe(iI);var oI=[{channelName:"use",module:{name:"koa",versionRange:">=2.0.0 <4",filePath:"lib/application.js"},functionQuery:{className:"Application",methodName:"use",kind:"Sync"}}],UG={KOA_USE:"orchestrion:koa:use"},DG=fe(oI);var HJ=["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"}}]}),sI="embedQuery",Yf="embedDocuments",BG=[{name:"@langchain/openai",versionRange:">=0.1.0 <2.0.0",methods:[sI,Yf]},{name:"@langchain/google-genai",versionRange:">=0.1.0 <3.0.0",methods:[sI,Yf]},{name:"@langchain/mistralai",versionRange:">=0.1.0 <2.0.0",methods:[sI,Yf]},{name:"@langchain/google-common",versionRange:">=0.1.0 <3.0.0",methods:[Yf]}],FJ=BG.flatMap(({name:e,versionRange:t,methods:n})=>["dist/embeddings.cjs","dist/embeddings.js"].flatMap(r=>n.map(i=>({channelName:i,module:{name:e,versionRange:t,filePath:r},functionQuery:{methodName:i,kind:"Async"}})))),aI=[...HJ,...FJ],HG=BG.flatMap(({name:e,methods:t})=>t.map(n=>`orchestrion:${e}:${n}`)),FG={LANGCHAIN_CHAT_MODEL_INVOKE:"orchestrion:@langchain/core:chatModelInvoke",LANGCHAIN_CHAT_MODEL_STREAM:"orchestrion:@langchain/core:chatModelStream"},WG=fe(aI);var VG=e=>({name:"@langchain/langgraph",versionRange:">=0.0.0 <2.0.0",filePath:e}),WJ=["dist/graph/state.cjs","dist/graph/state.js"].map(e=>({channelName:"stateGraphCompile",module:VG(e),functionQuery:{className:"StateGraph",methodName:"compile",kind:"Sync"}})),VJ=["dist/prebuilt/react_agent_executor.cjs","dist/prebuilt/react_agent_executor.js"].map(e=>({channelName:"createReactAgent",module:VG(e),functionQuery:{functionName:"createReactAgent",kind:"Sync"}})),cI=[...WJ,...VJ],YG={LANGGRAPH_STATE_GRAPH_COMPILE:"orchestrion:@langchain/langgraph:stateGraphCompile",LANGGRAPH_CREATE_REACT_AGENT:"orchestrion:@langchain/langgraph:createReactAgent"},jG=fe(cI);var lI=[{channelName:"load",module:{name:"lru-memoizer",versionRange:">=2.1.0 <4",filePath:"lib/async.js"},functionQuery:{functionName:"memoizedFunction",kind:"Callback"}}],ZG={LRU_MEMOIZER_LOAD:"orchestrion:lru-memoizer:load"},XG=fe(lI);var Ts={name:"mongodb"},pI=[{channelName:"command",module:{...Ts,versionRange:">=6.4.0 <8",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Async"}},{channelName:"command",module:{...Ts,versionRange:">=4.0.0 <6.4",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Callback"}},{channelName:"checkout",module:{...Ts,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:{...Ts,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/index.js"},functionQuery:{expressionName:e,kind:"Callback"}})),{channelName:"v3_command",module:{...Ts,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/command.js"},functionQuery:{functionName:"command",kind:"Callback"}},{channelName:"v3_query",module:{...Ts,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/query.js"},functionQuery:{functionName:"query",kind:"Callback"}},{channelName:"v3_get_more",module:{...Ts,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/get_more.js"},functionQuery:{functionName:"getMore",kind:"Callback"}}],KG={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"},qG=fe(pI);var yo={name:"mongoose",versionRange:">=5.9.7 <9.7.0"},QG=["find","findOne","deleteOne","deleteMany","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace","remove","count","findOneAndRemove"],uI=[{channelName:"query_exec",module:{...yo,filePath:"lib/query.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"aggregate_exec",module:{...yo,filePath:"lib/aggregate.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"model_save",module:{...yo,filePath:"lib/model.js"},functionQuery:{expressionName:"save",kind:"Auto"}},{channelName:"model_insert_many",module:{...yo,filePath:"lib/model.js"},functionQuery:{expressionName:"insertMany",kind:"Auto"}},{channelName:"model_bulk_write",module:{...yo,filePath:"lib/model.js"},functionQuery:{expressionName:"bulkWrite",kind:"Auto"}},{channelName:"model_remove",module:{...yo,filePath:"lib/model.js"},functionQuery:{expressionName:"remove",kind:"Auto"}},{channelName:"model_aggregate",module:{...yo,filePath:"lib/model.js"},functionQuery:{expressionName:"aggregate",kind:"Sync"}},...QG.map(e=>({channelName:`ctx_${e}`,module:{...yo,filePath:"lib/query.js"},functionQuery:{expressionName:e,kind:"Sync"}}))],JG={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"},$G=QG.map(e=>`orchestrion:mongoose:ctx_${e}`),zG=fe(uI);var dI=[{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"}}],eU={MYSQL2_QUERY:"orchestrion:mysql2:query",MYSQL2_EXECUTE:"orchestrion:mysql2:execute"},tU=fe(dI);var mI=[{channelName:"query",module:{name:"mysql",versionRange:">=2.0.0 <3",filePath:"lib/Connection.js"},functionQuery:{expressionName:"query",kind:"Auto"}}],nU={MYSQL_QUERY:"orchestrion:mysql:query"},rU=fe(mI);var fI=[{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"}}],iU={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"},oU=fe(fI);var gI=[...["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"}}))],sU={OPENAI_CHAT:"orchestrion:openai:chat",OPENAI_EMBEDDINGS:"orchestrion:openai:embeddings"},aU=fe(gI);var _I=[{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"}}],cU={PG_QUERY:"orchestrion:pg:query",PG_CONNECT:"orchestrion:pg:connect",PGPOOL_CONNECT:"orchestrion:pg-pool:connect"},lU=fe(_I);var YJ=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"}}],hI=["src","cjs/src"].flatMap(YJ),pU={POSTGRESJS_HANDLE:"orchestrion:postgres:handle",POSTGRESJS_CONNECTION:"orchestrion:postgres:connection",POSTGRESJS_EXECUTE:"orchestrion:postgres:execute",POSTGRESJS_CONNECT:"orchestrion:postgres:connect"},uU=fe(hI);var bI=[{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"}}],dU={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"},mU=fe(bI);var jJ=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"}}],yI=["dist","dist/esm"].flatMap(jJ),fU={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"},gU=fe(yI);var ZJ="tedious",XJ="lib/connection.js",KJ=">=1.11.0 <20",qJ=["connect","execSql","execSqlBatch","callProcedure","execBulkLoad","prepare","execute"],SI=qJ.map(e=>({channelName:e,module:{name:ZJ,versionRange:KJ,filePath:XJ},functionQuery:{className:"Connection",methodName:e,kind:"Sync"}})),_U={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"},hU=fe(SI);var EI=[...Is(">=4.0.0 <7.0.0","generateText","generateText","Async"),...Is(">=4.0.0 <7.0.0","streamText","streamText","Sync"),...Is(">=4.0.0 <7.0.0","generateObject","generateObject","Async"),...Is(">=4.0.0 <7.0.0","embed","embed","Async"),...Is(">=4.0.0 <7.0.0","embedMany","embedMany","Async"),...Is(">=5.0.0 <7.0.0","resolveLanguageModel","resolveLanguageModel","Sync"),...Is(">=6.0.0 <7.0.0","executeToolCall","executeToolCall","Async")],bU={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 Is(e,t,n,r){return["dist/index.js","dist/index.mjs"].map(i=>({channelName:t,module:{name:"ai",versionRange:e,filePath:i},functionQuery:{functionName:n,kind:r}}))}var yU=fe(EI);var A={...pG,...dG,...fG,..._G,...bG,...SG,...TG,...AG,...vG,...OG,...xG,...kG,...wG,...UG,...FG,...YG,...ZG,...KG,...JG,...eU,...nU,...iU,...sU,...cU,...pU,...dU,...fU,..._U,...bU};var QJ="Amqplib",JJ="auto.amqplib.orchestrion.publisher",$J="auto.amqplib.orchestrion.consumer",zJ="messaging.operation",OU="messaging.destination",CU="messaging.destination_kind",xU="messaging.rabbitmq.routing_key",SU="messaging.protocol",e$="messaging.protocol_version",t$="messaging.url",PU="messaging.message_id",kU="messaging.conversation_id",LU="messaging.rabbitmq.destination.routing_key",MU="messaging.message.conversation_id",wU="topic",EU="process",n$="send",GU=1e3*60,Zn={Ack:"ack",AckAll:"ackAll",Reject:"reject",Nack:"nack",NackAll:"nackAll",ChannelClosed:"channel closed",ChannelError:"channel error",InstrumentationTimeout:"instrumentation timeout"},II=Symbol("sentry.amqplib.message.stored-span"),As=Symbol("sentry.amqplib.channel.spans-not-ended"),AI=Symbol("sentry.amqplib.channel.consume-timeout-timer"),vI=Symbol("sentry.amqplib.channel.consumer-info"),NI=Symbol("sentry.amqplib.channel.is-confirm-publishing"),UU=Symbol("sentry.amqplib.connection.attributes"),DU=()=>{},TU=!1,r$=(()=>({name:QJ,setupOnce(){!jn.tracingChannel||TU||(TU=!0,$&&g.log("[orchestrion:amqplib] subscribing to amqplib tracing channels"),ue(()=>{l$(),i$(),o$(),s$(),a$(),c$()}))}}));function i$(){ee(jn.tracingChannel(A.AMQPLIB_PUBLISH),e=>{if(!e.self?.[NI])return HU(e)})}function o$(){let e=jn.tracingChannel(A.AMQPLIB_CONFIRM_PUBLISH);ee(e,t=>(t.self&&(t.self[NI]=!0),HU(t))),e.end.subscribe(t=>{let n=t.self;n&&(n[NI]=!1)})}function s$(){let e=jn.tracingChannel(A.AMQPLIB_CONSUME);e.start.subscribe(DU),e.asyncEnd.subscribe(t=>{let n=t,r=n.self,o=n.result?.consumerTag;if(!r||!o)return;BU(r);let s=n.arguments[0],c=typeof s=="string"?s:"<unknown>",a=n.arguments[2];r[vI]?.set(o,{noAck:!!a?.noAck,queue:c})})}function a$(){ee(jn.tracingChannel(A.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;BU(t);let i=n?.consumerTag?t[vI]?.get(n.consumerTag):void 0,o=i?.queue??r.fields?.routingKey??"<unknown>",s=i?.noAck??!1,c=r.properties?.headers,a=RU(c,"sentry-trace"),l=RU(c,"baggage"),p=In({sentryTrace:a,baggage:l},()=>u$(o,r,t));return s||(t[As]?.push({msg:r,timeOfConsume:ct()}),r[II]=p),e._sentryNoAck=s,p},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function c$(){jn.tracingChannel(A.AMQPLIB_ACK).start.subscribe(e=>TI(e,!1,Zn.Ack)),jn.tracingChannel(A.AMQPLIB_NACK).start.subscribe(e=>TI(e,!0,Zn.Nack)),jn.tracingChannel(A.AMQPLIB_REJECT).start.subscribe(e=>TI(e,!0,Zn.Reject)),jn.tracingChannel(A.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&jf(t.self,!1,Zn.AckAll,void 0)}),jn.tracingChannel(A.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&jf(t.self,!0,Zn.NackAll,t.arguments[0])})}function l$(){let e=jn.tracingChannel(A.AMQPLIB_CONNECT);e.start.subscribe(DU),e.asyncEnd.subscribe(t=>{let n=t,r=n.result;!r||typeof r!="object"||(r[UU]={...m$(n.arguments?.[0]),...d$(r)})})}function TI(e,t,n){let r=e.self;if(!r)return;let i=e.arguments[0];if(!i)return;let o=e.arguments[1],s=e.arguments[2],c=n===Zn.Reject?o:s,a=r[As]??[],l=a.findIndex(p=>p.msg===i);if(l<0)Rp(i,t,n,c);else if(n!==Zn.Reject&&o){for(let p=0;p<=l;p++)Rp(a[p].msg,t,n,c);a.splice(0,l+1)}else Rp(i,t,n,c),a.splice(l,1)}function BU(e){if(Object.prototype.hasOwnProperty.call(e,As))return;e[As]=[],e[vI]=new Map;let t=setInterval(()=>p$(e),GU);t.unref?.(),e[AI]=t,typeof e.on=="function"&&(e.on("close",()=>{jf(e,!0,Zn.ChannelClosed,void 0),IU(e)}),e.on("error",()=>{jf(e,!0,Zn.ChannelError,void 0),IU(e)}))}function IU(e){let t=e[AI];t&&(clearInterval(t),e[AI]=void 0)}function p$(e){let t=ct(),n=e[As]??[],r;for(r=0;r<n.length;r++){let i=n[r];if((t-i.timeOfConsume)*1e3<GU)break;Rp(i.msg,null,Zn.InstrumentationTimeout,!0)}n.splice(0,r)}function jf(e,t,n,r){(e[As]??[]).forEach(o=>{Rp(o.msg,t,n,r)}),e[As]=[]}function Rp(e,t,n,r){let i=e[II];i&&(t!==!1&&i.setStatus({code:2,message:n!==Zn.ChannelClosed&&n!==Zn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),i.end(),e[II]=void 0)}function HU(e){let t=e.arguments[0],n=e.arguments[1],r=typeof t=="string"?t:"",i=typeof n=="string"?n:"",o=e.arguments[3],s=k({name:`publish ${f$(r)}`,op:"message",kind:U.PRODUCER,attributes:{...FU(e.self),[OU]:r,[vn]:r,[CU]:wU,[xU]:i,[LU]:i,[ar]:n$,[PU]:o?.messageId,[ra]:o?.messageId,[kU]:o?.correlationId,[MU]:o?.correlationId,[S]:JJ}});(!o||typeof o!="object")&&(o={},e.arguments[3]=o);let c=o.headers&&typeof o.headers=="object"?o.headers:o.headers={},a=$e({span:s});return a["sentry-trace"]&&(c["sentry-trace"]=a["sentry-trace"]),a.baggage&&(c.baggage=a.baggage),s}function u$(e,t,n){return k({name:`${e} process`,op:"message",kind:U.CONSUMER,attributes:{...FU(n),[OU]:t.fields?.exchange,[vn]:t.fields?.exchange,[CU]:wU,[xU]:t.fields?.routingKey,[LU]:t.fields?.routingKey,[zJ]:EU,[ar]:EU,[PU]:t.properties?.messageId,[ra]:t.properties?.messageId,[kU]:t.properties?.correlationId,[MU]:t.properties?.correlationId,[S]:$J}})}function FU(e){let t=e?.connection,n=t?.[UU];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r=="string"&&r?{[Mt]:r.toLowerCase()}:{}}function d$(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t=="string"&&t?{[Mt]:t.toLowerCase()}:{}}function m$(e){let t={[e$]:"0.9.1",[c0]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,i=NU(r.protocol),o=vU(r.hostname),s=AU(r.port,i);t[SU]=i,t[kh]=i,t[ft]=o,t[gt]=s,t[Le]=o,t[xe]=s}else if(typeof n=="string"){let r=g$(n);t[t$]=r,t[lt]=r;try{let i=new URL(r),o=NU(i.protocol),s=vU(i.hostname),c=AU(i.port?parseInt(i.port,10):void 0,o);t[SU]=o,t[kh]=o,t[ft]=s,t[gt]=c,t[Le]=s,t[xe]=c}catch{}}return t}function f$(e){return e!==""?e:"<default>"}function g$(e){return e.replace(/:[^:@/]*@/,":***@")}function AU(e,t){return e||(t==="AMQP"?5672:5671)}function NU(e){let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()}function vU(e){return e||"localhost"}function RU(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}var WU=r$;import*as RI from"diagnostics_channel";var YU="Anthropic_AI",_$="auto.ai.orchestrion.anthropic",h$=[{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"}],VU=!1,b$=((e={})=>({name:YU,setupOnce(){!RI.tracingChannel||VU||(VU=!0,ue(()=>{for(let{channel:t,operation:n,methodPath:r,stream:i}of h$)$&&g.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),ee(RI.tracingChannel(t),o=>y$(o,n,r,e),{beforeSpanEnd:(o,s)=>{Sd(o,s.result,Ze(e).recordOutputs)},deferSpanEnd:({span:o,data:s})=>T$(o,s,i,e)})}))}}));function y$(e,t,n,r){let i=e.arguments??[];if(On(YU)||i[1]?.headers?.["X-Stainless-Helper-Method"]==="stream")return;let s=typeof i[0]=="object"&&i[0]!==null?i[0]:void 0,{recordInputs:c}=Ze(r),a=ze(r.enableTruncation),l=yd(i,n,t),p=l[De]||"unknown";l[S]=_$;let u=k({name:`${t} ${p}`,op:`gen_ai.${t}`,attributes:l});return c&&s&&Ia(u,s,a),u}function S$(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function E$(e){return!!e&&typeof e.on=="function"}function T$(e,t,n,r){let{recordOutputs:i}=Ze(r),o=t.result;if(n==="async-iterable"&&S$(o)){let s=o[Symbol.asyncIterator].bind(o),c=bl({[Symbol.asyncIterator]:s},e,i);return o[Symbol.asyncIterator]=()=>c,!0}return n==="message-stream"&&E$(o)?(yl(o,e,i),!0):!1}var jU=b$;import*as MI from"diagnostics_channel";var ZU="auto.aws.orchestrion.aws_sdk",XU="dynamodb",KU="messaging.destination_kind",qU="topic",OI="chat",CI="aws.bedrock";var I$=new TextDecoder,Zf=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=OI,i={[Xc]:CI,[vu]:OI},o=t.commandInput.modelId;o&&(i[Zc]=o,r&&(r+=` ${o}`));let s=t.commandInput.inferenceConfig;if(s){let{maxTokens:c,temperature:a,topP:l,stopSequences:p}=s;c!==void 0&&(i[hi]=c),a!==void 0&&(i[bi]=a),l!==void 0&&(i[yi]=l),p!==void 0&&(i[Xi]=p)}return{spanName:r,isStream:n,spanAttributes:i}}_requestPreSpanHookInvokeModel(t,n){let r={[Xc]:CI},i=t.commandInput?.modelId;if(i&&(r[Zc]=i),t.commandInput?.body){let o=JSON.parse(t.commandInput.body);i.includes("amazon.titan")?(o.textGenerationConfig?.temperature!==void 0&&(r[bi]=o.textGenerationConfig.temperature),o.textGenerationConfig?.topP!==void 0&&(r[yi]=o.textGenerationConfig.topP),o.textGenerationConfig?.maxTokenCount!==void 0&&(r[hi]=o.textGenerationConfig.maxTokenCount),o.textGenerationConfig?.stopSequences!==void 0&&(r[Xi]=o.textGenerationConfig.stopSequences)):i.includes("amazon.nova")?(o.inferenceConfig?.temperature!==void 0&&(r[bi]=o.inferenceConfig.temperature),o.inferenceConfig?.top_p!==void 0&&(r[yi]=o.inferenceConfig.top_p),o.inferenceConfig?.max_new_tokens!==void 0&&(r[hi]=o.inferenceConfig.max_new_tokens),o.inferenceConfig?.stopSequences!==void 0&&(r[Xi]=o.inferenceConfig.stopSequences)):i.includes("anthropic.claude")?(o.max_tokens!==void 0&&(r[hi]=o.max_tokens),o.temperature!==void 0&&(r[bi]=o.temperature),o.top_p!==void 0&&(r[yi]=o.top_p),o.stop_sequences!==void 0&&(r[Xi]=o.stop_sequences)):i.includes("meta.llama")?(o.max_gen_len!==void 0&&(r[hi]=o.max_gen_len),o.temperature!==void 0&&(r[bi]=o.temperature),o.top_p!==void 0&&(r[yi]=o.top_p)):i.includes("cohere.command-r")?(o.max_tokens!==void 0&&(r[hi]=o.max_tokens),o.temperature!==void 0&&(r[bi]=o.temperature),o.p!==void 0&&(r[yi]=o.p),o.message!==void 0&&(r[Qt]=Math.ceil(o.message.length/6)),o.stop_sequences!==void 0&&(r[Xi]=o.stop_sequences)):i.includes("cohere.command")?(o.max_tokens!==void 0&&(r[hi]=o.max_tokens),o.temperature!==void 0&&(r[bi]=o.temperature),o.p!==void 0&&(r[yi]=o.p),o.prompt!==void 0&&(r[Qt]=Math.ceil(o.prompt.length/6)),o.stop_sequences!==void 0&&(r[Xi]=o.stop_sequences)):i.includes("mistral")&&(o.prompt!==void 0&&(r[Qt]=Math.ceil(o.prompt.length/6)),o.max_tokens!==void 0&&(r[hi]=o.max_tokens),o.temperature!==void 0&&(r[bi]=o.temperature),o.top_p!==void 0&&(r[yi]=o.top_p),o.stop!==void 0&&(r[Xi]=o.stop))}return{isStream:n,spanAttributes:r}}_responseHookConverse(t,n){let{stopReason:r,usage:i}=t.data;QU(n,r),JU(n,i)}_responseHookConverseStream(t,n){t.data.stream=N$(t.data.stream,n)}_responseHookInvokeModel(t,n){let r=t.request.commandInput?.modelId;if(t.data?.body){let i=I$.decode(t.data.body),o=JSON.parse(i);r.includes("amazon.titan")?(o.inputTextTokenCount!==void 0&&n.setAttribute(Qt,o.inputTextTokenCount),o.results?.[0]?.tokenCount!==void 0&&n.setAttribute(St,o.results[0].tokenCount),o.results?.[0]?.completionReason!==void 0&&n.setAttribute(Rt,[o.results[0].completionReason])):r.includes("amazon.nova")?(o.usage!==void 0&&(o.usage.inputTokens!==void 0&&n.setAttribute(Qt,o.usage.inputTokens),o.usage.outputTokens!==void 0&&n.setAttribute(St,o.usage.outputTokens)),o.stopReason!==void 0&&n.setAttribute(Rt,[o.stopReason])):r.includes("anthropic.claude")?(o.usage?.input_tokens!==void 0&&n.setAttribute(Qt,o.usage.input_tokens),o.usage?.output_tokens!==void 0&&n.setAttribute(St,o.usage.output_tokens),o.stop_reason!==void 0&&n.setAttribute(Rt,[o.stop_reason])):r.includes("meta.llama")?(o.prompt_token_count!==void 0&&n.setAttribute(Qt,o.prompt_token_count),o.generation_token_count!==void 0&&n.setAttribute(St,o.generation_token_count),o.stop_reason!==void 0&&n.setAttribute(Rt,[o.stop_reason])):r.includes("cohere.command-r")?(o.text!==void 0&&n.setAttribute(St,Math.ceil(o.text.length/6)),o.finish_reason!==void 0&&n.setAttribute(Rt,[o.finish_reason])):r.includes("cohere.command")?(o.generations?.[0]?.text!==void 0&&n.setAttribute(St,Math.ceil(o.generations[0].text.length/6)),o.generations?.[0]?.finish_reason!==void 0&&n.setAttribute(Rt,[o.generations[0].finish_reason])):r.includes("mistral")&&(o.outputs?.[0]?.text!==void 0&&n.setAttribute(St,Math.ceil(o.outputs[0].text.length/6)),o.outputs?.[0]?.stop_reason!==void 0&&n.setAttribute(Rt,[o.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(t,n){let r=t.data?.body,i=t.request.commandInput?.modelId;if(!r||!i)return;let o=A$(i);t.data.body=(async function*(){try{for await(let s of r){if(o){let c=v$(s?.chunk?.bytes);c&&o(c,n)}yield s}}finally{n.end()}})()}};function A$(e){if(e.includes("amazon.titan"))return C$;if(e.includes("anthropic.claude"))return O$;if(e.includes("amazon.nova"))return R$;if(e.includes("meta.llama"))return x$;if(e.includes("cohere.command-r"))return L$;if(e.includes("cohere.command"))return k$;if(e.includes("mistral"))return P$}async function*N$(e,t){try{let n;for await(let r of e)QU(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;JU(t,n)}finally{t.end()}}function QU(e,t){t!==void 0&&e.setAttribute(Rt,[t])}function JU(e,t){if(t){let{inputTokens:n,outputTokens:r}=t;n!==void 0&&e.setAttribute(Qt,n),r!==void 0&&e.setAttribute(St,r)}}function v$(e){if(!e||!(e instanceof Uint8Array))return null;try{let t=Buffer.from(e).toString("utf-8");return JSON.parse(t)}catch(t){return $&&g.warn("[orchestrion:aws-sdk] failed to parse streamed bedrock chunk",t),null}}function R$(e,t){e.metadata?.usage!==void 0&&(e.metadata?.usage.inputTokens!==void 0&&t.setAttribute(Qt,e.metadata.usage.inputTokens),e.metadata?.usage.outputTokens!==void 0&&t.setAttribute(St,e.metadata.usage.outputTokens)),e.messageStop?.stopReason!==void 0&&t.setAttribute(Rt,[e.messageStop.stopReason])}function O$(e,t){e.message?.usage?.input_tokens!==void 0&&t.setAttribute(Qt,e.message.usage.input_tokens),e.message?.usage?.output_tokens!==void 0&&t.setAttribute(St,e.message.usage.output_tokens),e.delta?.stop_reason!==void 0&&t.setAttribute(Rt,[e.delta.stop_reason])}function C$(e,t){e.inputTextTokenCount!==void 0&&t.setAttribute(Qt,e.inputTextTokenCount),e.totalOutputTextTokenCount!==void 0&&t.setAttribute(St,e.totalOutputTextTokenCount),e.completionReason!==void 0&&t.setAttribute(Rt,[e.completionReason])}function x$(e,t){e.prompt_token_count!==void 0&&t.setAttribute(Qt,e.prompt_token_count),e.generation_token_count!==void 0&&t.setAttribute(St,e.generation_token_count),e.stop_reason!==void 0&&t.setAttribute(Rt,[e.stop_reason])}function P$(e,t){e.outputs?.[0]?.text!==void 0&&t.setAttribute(St,Math.ceil(e.outputs[0].text.length/6)),e.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(Rt,[e.outputs[0].stop_reason])}function k$(e,t){e.generations?.[0]?.text!==void 0&&t.setAttribute(St,Math.ceil(e.generations[0].text.length/6)),e.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(Rt,[e.generations[0].finish_reason])}function L$(e,t){e.text!==void 0&&t.setAttribute(St,Math.ceil(e.text.length/6)),e.finish_reason!==void 0&&t.setAttribute(Rt,[e.finish_reason])}function ac(e){return Array.isArray(e)?e:[e]}var Xf=class{requestPreSpanHook(t){let n=t.commandName,r=t.commandInput?.TableName,i={};return i[Pe]=XU,i[yt]=r,i[zs]=n,t.commandInput?.TableName?i[vh]=[t.commandInput.TableName]:t.commandInput?.RequestItems&&(i[vh]=Object.keys(t.commandInput.RequestItems)),(n==="CreateTable"||n==="UpdateTable")&&t.commandInput?.ProvisionedThroughput&&(i[NR]=t.commandInput.ProvisionedThroughput.ReadCapacityUnits,i[vR]=t.commandInput.ProvisionedThroughput.WriteCapacityUnits),(n==="GetItem"||n==="Scan"||n==="Query")&&t.commandInput?.ConsistentRead&&(i[gR]=t.commandInput.ConsistentRead),(n==="Query"||n==="Scan")&&t.commandInput?.ProjectionExpression&&(i[AR]=t.commandInput.ProjectionExpression),n==="CreateTable"&&(t.commandInput?.GlobalSecondaryIndexes&&(i[yR]=ac(t.commandInput.GlobalSecondaryIndexes).map(o=>JSON.stringify(o))),t.commandInput?.LocalSecondaryIndexes&&(i[IR]=ac(t.commandInput.LocalSecondaryIndexes).map(o=>JSON.stringify(o)))),(n==="ListTables"||n==="Query"||n==="Scan")&&t.commandInput?.Limit&&(i[TR]=t.commandInput.Limit),n==="ListTables"&&t.commandInput?.ExclusiveStartTableName&&(i[bR]=t.commandInput.ExclusiveStartTableName),n==="Query"&&(t.commandInput?.ScanIndexForward&&(i[OR]=t.commandInput.ScanIndexForward),t.commandInput?.IndexName&&(i[Ah]=t.commandInput.IndexName),t.commandInput?.Select&&(i[Nh]=t.commandInput.Select)),n==="Scan"&&(t.commandInput?.Segment&&(i[CR]=t.commandInput?.Segment),t.commandInput?.TotalSegments&&(i[PR]=t.commandInput?.TotalSegments),t.commandInput?.IndexName&&(i[Ah]=t.commandInput.IndexName),t.commandInput?.Select&&(i[Nh]=t.commandInput.Select)),n==="UpdateTable"&&(t.commandInput?.AttributeDefinitions&&(i[fR]=ac(t.commandInput.AttributeDefinitions).map(o=>JSON.stringify(o))),t.commandInput?.GlobalSecondaryIndexUpdates&&(i[SR]=ac(t.commandInput.GlobalSecondaryIndexUpdates).map(o=>JSON.stringify(o)))),{spanAttributes:i,spanKind:U.CLIENT,spanOp:"db"}}responseHook(t,n){t.data?.ConsumedCapacity&&n.setAttribute(_R,ac(t.data.ConsumedCapacity).map(r=>JSON.stringify(r))),t.data?.ItemCollectionMetrics&&n.setAttribute(ER,ac(t.data.ItemCollectionMetrics).map(r=>JSON.stringify(r))),t.data?.TableNames&&n.setAttribute(xR,t.data?.TableNames.length),t.data?.Count&&n.setAttribute(hR,t.data?.Count),t.data?.ScannedCount&&n.setAttribute(RR,t.data?.ScannedCount)}};var Kf=class{requestPreSpanHook(t){let n=t.commandInput?.StreamName,r={};return n&&(r[kR]=n),{spanAttributes:r,spanKind:U.CLIENT}}};var qf="Invoke",Qf=class{requestPreSpanHook(t){let n=t.commandInput?.FunctionName,r={},i;return t.commandName===qf&&(r[BR]=n,r[HR]="aws",i=`${n} ${qf}`),{spanAttributes:r,spanKind:U.CLIENT,spanName:i}}requestPostSpanHook(t,n){t.commandName===qf&&t.commandInput&&(t.commandInput.ClientContext=M$(t.commandInput.ClientContext,n))}responseHook(t,n){t.request.commandName===qf&&(n.setAttribute(DR,t.requestId),t.request.region&&n.setAttribute(FR,t.request.region))}};function M$(e,t){try{let n=$e({span:t}),r=e?JSON.parse(Buffer.from(e,"base64").toString("utf8")):{},i={...r,custom:{...r.custom,...n}},o=Buffer.from(JSON.stringify(i)).toString("base64");return o.length>3583?($&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations."),e):o}catch(n){return $&&g.log("[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext",n),e}}var Jf=class{requestPreSpanHook(t){let n=t.commandInput?.Bucket,r={};return n&&(r[wR]=n),{spanAttributes:r,spanKind:U.CLIENT}}};var $f=class{requestPreSpanHook(t){let n=t.commandInput?.SecretId,r={};return typeof n=="string"&&n.startsWith("arn:aws:secretsmanager:")&&(r[Rh]=n),{spanAttributes:r,spanKind:U.CLIENT}}responseHook(t,n){let r=t.data?.ARN;r&&n.setAttribute(Rh,r)}};var w$=10,xI="sentry-trace",PI="baggage",G$=[xI,PI];function Op(e,t){let n=e??{},r=Object.keys(t);if(Object.keys(n).length+r.length<=w$)for(let i of r){let o=t[i];o&&(n[i]={DataType:"String",StringValue:o})}else $&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes");return n}function $U(e){let t=e.MessageAttributes??{},n=t[xI]?.StringValue??t[xI]?.Value;if(n)return{sentryTrace:n,baggage:t[PI]?.StringValue??t[PI]?.Value}}function zU(e=[]){return ol([...e,...G$])}var zf=class{requestPreSpanHook(t){let n=U.CLIENT,r=`SNS ${t.commandName}`,i={[Mt]:"aws.sns"};if(t.commandName==="Publish"){n=U.PRODUCER,i[KU]=qU;let{TopicArn:s,TargetArn:c,PhoneNumber:a}=t.commandInput,l=U$(s,c,a);i[o0]=l,i[vn]=s||c||a||"unknown",r=`${a?"phone_number":l} send`}let o=t.commandInput?.TopicArn;return o&&(i[Oh]=o),{spanAttributes:i,spanKind:n,spanName:r}}requestPostSpanHook(t,n){if(t.commandName==="Publish"){let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=Op(r,$e({span:n}))}}responseHook(t,n){let r=t.data?.TopicArn;r&&n.setAttribute(Oh,r)}};function U$(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 eg=class{requestPreSpanHook(t){let n=B$(t.commandInput),r=H$(n),i=U.CLIENT,o,s={[Mt]:"aws_sqs",[vn]:r,[lt]:n};switch(t.commandName){case"ReceiveMessage":i=U.CONSUMER,o=`${r} receive`,s[ar]="receive",t.commandInput.MessageAttributeNames=zU(t.commandInput.MessageAttributeNames);break;case"SendMessage":case"SendMessageBatch":i=U.PRODUCER,o=`${r} send`;break}return{spanAttributes:s,spanKind:i,spanName:o}}requestPostSpanHook(t,n){switch(t.commandName){case"SendMessage":{let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=Op(r,$e({span:n}))}break;case"SendMessageBatch":{let r=t.commandInput?.Entries;if(Array.isArray(r)){let i=$e({span:n});r.forEach(o=>{o.MessageAttributes=Op(o.MessageAttributes??{},i)})}}break}}responseHook(t,n){switch(t.request.commandName){case"SendMessage":n.setAttribute(ra,t?.data?.MessageId);break;case"SendMessageBatch":break;case"ReceiveMessage":{let r=t?.data?.Messages||[];n.setAttribute(na,r.length);for(let i of r)D$(n,i);break}}}};function D$(e,t){let n=$U(t);if(!n)return;let{parentSpanId:r,traceId:i,sampled:o}=Tn(n.sentryTrace,n.baggage);i&&r&&e.addLink({context:{traceId:i,spanId:r,traceFlags:o?1:0},attributes:{[ra]:t.MessageId}})}function B$(e){return e?.QueueUrl}function H$(e){if(!e)return;let t=e.split("/");if(t.length!==0)return t[t.length-1]}var tg=class{requestPreSpanHook(t){let n=t.commandInput?.stateMachineArn,r=t.commandInput?.activityArn,i={};return n&&(i[UR]=n),r&&(i[GR]=r),{spanAttributes:i,spanKind:U.CLIENT}}};var ng=class{constructor(){this._services=new Map([["SecretsManager",new $f],["SFN",new tg],["SQS",new eg],["SNS",new zf],["DynamoDB",new Xf],["Lambda",new Qf],["S3",new Jf],["Kinesis",new Kf],["BedrockRuntime",new Zf]])}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 kI(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function eD(e,t,n,r){return{serviceName:e?.replace(/\s+/g,""),commandName:kI(t,"Command"),commandInput:n,region:r}}function tD(e){return{[g0]:"aws-api",[f0]:e.commandName,[ku]:e.serviceName,[Iu]:e.region}}var F$="Aws";function LI(e){try{return e()}catch(t){$&&g.warn("[orchestrion:aws-sdk] error building span",t);return}}function nD(e,t){t&&(t.requestId&&e.setAttribute(MR,t.requestId),t.httpStatusCode&&e.setAttribute(Si,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(LR,t.extendedRequestId))}var W$=(()=>{let e=new ng;return{name:F$,setupOnce(){if(!MI.tracingChannel)return;let t=i=>LI(()=>{let o=i.arguments[0],s=o?.constructor?.name;if(!o||!s)return;let c=i.self?.config,a=c?.serviceId??kI(i.self?.constructor?.name||"AWS","Client");o.input||(o.input={});let l=eD(a,s,o.input,void 0),p=e.requestPreSpanHook(l),u=k({name:p.spanName??`${l.serviceName}.${l.commandName}`,kind:p.spanKind??U.CLIENT,op:p.spanOp||"rpc",attributes:{[S]:ZU,...tD(l),...p.spanAttributes}});i._sentryNormalizedRequest=l,i._sentryRequestMetadata=p;let d;try{d=c?.region?.()}catch{}let m={settled:!1,promise:Promise.resolve(d).then(_=>{_&&(l.region=_,u.setAttribute(Iu,_))}).catch(()=>{}).finally(()=>{m.settled=!0})};return i._sentryRegion=m,LI(()=>e.requestPostSpanHook(l,u)),u}),n={deferSpanEnd({span:i,data:o,end:s}){let c=o._sentryNormalizedRequest,a=o._sentryRequestMetadata;if(!c)return!1;let l="error"in o;if(LI(()=>{if(l){let m=o.error,_=m?.$metadata;nD(i,{requestId:m?.RequestId??_?.requestId,httpStatusCode:_?.httpStatusCode,extendedRequestId:m?.extendedRequestId??_?.extendedRequestId});return}let u=o.result;nD(i,u?.$metadata);let d={data:u,request:c,requestId:u?.$metadata?.requestId};e.responseHook(d,i)}),a?.isStream&&!l)return!0;let p=o._sentryRegion;return p&&!p.settled?(p.promise.then(()=>s()),!0):!1}},r=[A.AWS_SMITHY_CORE_SEND,A.AWS_SMITHY_CLIENT_SEND,A.AWS_SDK_SMITHY_CLIENT_SEND];$&&g.log(`[orchestrion:aws-sdk] subscribing to channels "${r.join('", "')}"`),ue(()=>{for(let i of r)ee(MI.tracingChannel(i),t,n)})}}}),rD=W$;import*as Cp from"diagnostics_channel";var V$="Dataloader",iD="dataloader",Y$="auto.db.orchestrion.dataloader",j$="cache.get",oD=Symbol("sentry.dataloader.wrapped");function Z$(e,t){let n=e?.name;return n?`${iD}.${t} ${n}`:`${iD}.${t}`}function X$(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}function sD(e,t,n){let r=t==="load"||t==="loadMany"||t==="batch";return{name:Z$(e,t),kind:t==="batch"?void 0:U.CLIENT,op:r?j$:void 0,onlyIfParent:!0,attributes:{[S]:Y$,[Js]:r?X$(n):void 0}}}var K$=(()=>({name:V$,setupOnce(){Cp.tracingChannel&&($&&g.log("[orchestrion:dataloader] subscribing to dataloader tracing channels"),ue(()=>{q$(),Q$(),rg(A.DATALOADER_LOAD_MANY,"loadMany"),rg(A.DATALOADER_PRIME,"prime"),rg(A.DATALOADER_CLEAR,"clear"),rg(A.DATALOADER_CLEAR_ALL,"clearAll")}))}}));function q$(){Cp.tracingChannel(A.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!="function"||n[oD])return;let r=n,i=function(...o){return Se({...sD(this,"batch",o[0]),links:this._batch?.spanLinks},()=>r.apply(this,o))};i[oD]=!0,t.arguments[0]=i})}function Q$(){let e=Cp.tracingChannel(A.DATALOADER_LOAD);ee(e,t=>aD(t.self,"load",t.arguments[0]),{requiresParentSpan:!0}),e.end.subscribe(t=>{let n=t,r=n._sentrySpan,i=n.self?._batch;r&&i&&r.isRecording()&&(i.spanLinks??(i.spanLinks=[])).push({context:r.spanContext()})})}function rg(e,t){ee(Cp.tracingChannel(e),n=>aD(n.self,t,n.arguments[0]),{requiresParentSpan:!0})}function aD(e,t,n){return k(sD(e,t,n))}var wI=K$;import*as GI from"diagnostics_channel";var J$="GenericPool",$$=(()=>({name:J$,setupOnce(){GI.tracingChannel&&ue(()=>z$())}})),cD=$$;function z$(){ee(GI.tracingChannel(A.GENERIC_POOL_ACQUIRE),()=>k({name:"generic-pool.acquire",attributes:{[S]:"auto.db.orchestrion.generic_pool"}}))}import*as UI from"diagnostics_channel";var uD="Google_GenAI",lD="auto.ai.orchestrion.google_genai",ez=[{channel:A.GOOGLE_GENAI_GENERATE_CONTENT,operation:"generate_content"},{channel:A.GOOGLE_GENAI_EMBED_CONTENT,operation:"embeddings"},{channel:A.GOOGLE_GENAI_CHAT,operation:"chat"}],pD=!1,tz=((e={})=>({name:uD,setupOnce(){!UI.tracingChannel||pD||(pD=!0,ue(()=>{for(let{channel:t,operation:n}of ez)$&&g.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),ee(UI.tracingChannel(t),r=>nz(r,n,e),{beforeSpanEnd:(r,i)=>{n!=="embeddings"&&Id(r,i.result,Ze(e).recordOutputs)},deferSpanEnd:({span:r,data:i})=>iz(r,i,e)})}))}}));function nz(e,t,n){if(On(uD))return;if(t!=="chat"){let p=Q();if(p){let{op:u,origin:d}=oe(p);if(d===lD&&u==="gen_ai.chat")return}}let i=(e.arguments??[])[0],{recordInputs:o}=Ze(n),s=ze(n.enableTruncation),c=Td(t,i,e.self),a=c[De]||"unknown";c[S]=lD;let l=k({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return o&&i&&El(l,i,t,s),l}function rz(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function iz(e,t,n){let r=t.result;if(!rz(r))return!1;let{recordOutputs:i}=Ze(n),o=r[Symbol.asyncIterator].bind(r),s=Sl({[Symbol.asyncIterator]:o},e,i??!1);return r[Symbol.asyncIterator]=()=>s,!0}var dD=tz;import*as kp from"diagnostics_channel";var ig="auto.graphql.diagnostic_channel",mD="graphql.parse",fD="graphql.validate",gD="graphql.execute",_D="graphql.resolve",hD="graphql.field.name",bD="graphql.field.path",yD="graphql.field.type",SD="graphql.parent.name",So=Symbol.for("opentelemetry.graphql_data"),xp=Symbol.for("opentelemetry.patched");function oz(e){return typeof e?.then=="function"}function sg(e,t){if(!e||e[xp])return;e[xp]=!0;let n=e.getFields();Object.keys(n).forEach(r=>{let i=n[r];if(i&&(i.resolve&&(i.resolve=DI(t,i.resolve)),i.type))for(let o of TD(i.type))sg(o,t)})}function DI(e,t,n=!1){if(typeof t!="function"||t[xp])return t;function r(i,o,s,c){if(!t)return;let a=s??{};if(e().ignoreTrivialResolveSpans&&n&&(B(i)||typeof i=="function")&&typeof i[c.fieldName]!="function")return t.call(this,i,o,a,c);if(!a[So])return t.call(this,i,o,a,c);let p=pz(c.path),{field:u,spanAdded:d}=sz(a,c,p),m=u.span;return se(m,()=>{try{let _=t.call(this,i,o,a,c);return oz(_)?_.then(h=>(og(m,d),h),h=>{throw og(m,d,h),h}):(og(m,d),_)}catch(_){throw og(m,d,_),_}})}return r[xp]=!0,r}function og(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function sz(e,t,n){let r=ED(e,n);if(r)return{field:r,spanAdded:!1};let i={span:az(t,n,lz(e,n))};return cz(e,n,i),{field:i,spanAdded:!0}}function az(e,t,n){let r={[S]:ig,[H]:Pi,[hD]:e.fieldName,[bD]:t.join("."),[yD]:e.returnType.toString(),[SD]:e.parentType.name};return k({name:`${_D} ${t.join(".")}`,attributes:r,parentSpan:n})}function cz(e,t,n){let r=e[So];r&&(r.fields[t.join(".")]=n)}function ED(e,t){return e[So]?.fields[t.join(".")]}function lz(e,t){for(let n=t.length-1;n>0;n--){let r=ED(e,t.slice(0,n));if(r)return r.span}return e[So]?.span}function pz(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function TD(e){return"ofType"in e&&e.ofType?TD(e.ofType):uz(e)?e.getTypes():dz(e)?[e]:[]}function uz(e){return"getTypes"in e&&typeof e.getTypes=="function"}function dz(e){return"getFields"in e&&typeof e.getFields=="function"}function ID(e,t){let n=e?.definitions;if(!n||!Array.isArray(n))return;let r=i=>!!i?.operation&&["query","mutation","subscription"].indexOf(i.operation)!==-1;return t?n.filter(r).find(i=>t===i?.name?.value):n.find(r)}var BI={[S]:ig,[H]:Pi};function AD(){return k({name:mD,attributes:{...BI}})}function ND(e){return k({name:fD,attributes:{...BI,[ta]:Qa(e)}})}function vD(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:"invalid_argument"})}function mz(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 RD(e,t,n,r){let i=mz(e),{schema:o,document:s}=i,{contextValue:c,fieldResolver:a}=i,l=!!c[So];if(!n.ignoreResolveSpans&&!l){let _=a==null,h=t?.defaultFieldResolver,b=a??h;b&&(a=DI(r,b,_)),o&&(sg(o.getQueryType(),r),sg(o.getMutationType(),r))}let p=ID(s,i.operationName),u=p?.operation,d=p?.name?.value??i.operationName??void 0,m=k({name:Qm(u,d||void 0,gD),attributes:{...BI,[Cu]:u,[Ou]:d||void 0,[ta]:Qa(s)}});return n.useOperationNameForRootSpan&&u&&qm(m,u,d||void 0),c[So]={source:s,span:m,fields:{}},i.writeBack(c,a),m}function OD(e,t){Jm(t)&&e.setStatus({code:2,message:"internal_error"})}var CD="Graphql";function fz(e){return{ignoreResolveSpans:e.ignoreResolveSpans!==!1,ignoreTrivialResolveSpans:e.ignoreTrivialResolveSpans!==!1,useOperationNameForRootSpan:e.useOperationNameForRootSpan!==!1}}function Pp(e){try{return e()}catch(t){$&&g.warn("[orchestrion:graphql] error building span",t);return}}var gz=((e={})=>{let t=fz(e),n=()=>t;return{name:CD,setupOnce(){kp.tracingChannel&&ue(()=>{ee(kp.tracingChannel(A.GRAPHQL_PARSE),()=>Pp(()=>AD())),ee(kp.tracingChannel(A.GRAPHQL_VALIDATE),r=>Pp(()=>ND(r.arguments[1])),{beforeSpanEnd:(r,i)=>{Pp(()=>vD(r,i.result))}}),ee(kp.tracingChannel(A.GRAPHQL_EXECUTE),r=>Pp(()=>RD(r.arguments,r.self,t,n)),{beforeSpanEnd:(r,i)=>{Pp(()=>OD(r,i.result))}})})}}}),_z=gz,xD=e=>{let t=_z(e);return Gt(lp(e),{name:CD,setupOnce:()=>t.setupOnce?.()})};import*as cg from"diagnostics_channel";var hz=["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"],cc=Symbol("hapi-handler-patched"),Lp={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},PD=new Set(hz),hr=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(hr||{});function bz(e){let t=Q();if(!t)return;let n=Re(t);n&&oe(n).data[H]==="http.server"&&n.setAttribute(He,e)}var HI=e=>typeof e=="string"&&PD.has(e),yz=e=>{let t=e?.type;return t!==void 0&&HI(t)},Sz=e=>Array.isArray(e)&&e.length<=3&&HI(e[0])&&typeof e[1]=="function",Ez=e=>!Array.isArray(e),Tz=(e,t)=>{let n={[He]:e.path,[Ur]:e.method},r;return t?(n[hr.HAPI_TYPE]=Lp.PLUGIN,n[hr.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[hr.HAPI_TYPE]=Lp.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},Iz=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[hr.EXT_TYPE]:e,[hr.HAPI_TYPE]:Lp.EXT,[hr.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[hr.EXT_TYPE]:e,[hr.HAPI_TYPE]:Lp.EXT},name:r}};function LD(e,t){return Se({name:e.name,op:`${e.attributes[hr.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[S]:"auto.http.orchestrion.hapi"}},t)}function kD(e,t){if(e[cc]===!0)return e;e[cc]=!0;let n=r=>function(...i){if(!Q())return r.call(this,...i);bz(e.path);let o=Tz(e,t);return LD(o,()=>r.call(this,...i))};if(typeof e.handler=="function")e.handler=n(e.handler);else if(typeof e.options=="function"){let r=e.options;e.options=function(i){let o=r(i);return typeof o.handler=="function"&&(o.handler=n(o.handler)),o}}else typeof e.options?.handler=="function"&&(e.options.handler=n(e.options.handler));return e}function ag(e,t,n){if(Array.isArray(e)){for(let r=0;r<e.length;r++)e[r]=ag(e[r],t);return e}else if(Ez(e)){if(e[cc]===!0)return e;e[cc]=!0;let r=function(...i){if(!Q())return e.apply(this,i);let o=Iz(t,n,e.name);return LD(o,()=>e.apply(void 0,i))};return r[cc]=!0,r}return e}function MD(e,t){let n=e[0];if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r]=kD(n[r],t);else e[0]=kD(n,t)}function wD(e,t){if(Array.isArray(e[0])){let n=e[0];for(let r=0;r<n.length;r++){let i=n[r];if(HI(i.type)){let o=i,s=ag(o.method,i.type,t);o.method=s,n[r]=o}}return}else if(Sz(e)){let n=e,r=n[1],i=ag(r,n[0],t);e[1]=i;return}else if(yz(e[0])){let n=e[0],r=ag(n.method,n.type,t);n.method=r}}var Az="Hapi",Nz=(()=>({name:Az,setupOnce(){cg.tracingChannel&&($&&g.log(`[orchestrion:hapi] subscribing to channels "${A.HAPI_ROUTE}" / "${A.HAPI_EXT}"`),cg.tracingChannel(A.HAPI_ROUTE).subscribe({start(e){let t=e;MD(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),cg.tracingChannel(A.HAPI_EXT).subscribe({start(e){let t=e;wD(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}})),GD=Nz;import*as FI from"diagnostics_channel";var vz="Koa",Rz="auto.http.orchestrion.koa",lg={ROUTER:"router",MIDDLEWARE:"middleware"},UD=Symbol("sentry.koa.layer-patched"),DD=!1,Oz=((e={})=>{let t=e.ignoreLayersType??[];return{name:vz,setupOnce(){!FI.tracingChannel||DD||(DD=!0,$&&g.log(`[orchestrion:koa] subscribing to channel "${A.KOA_USE}"`),FI.tracingChannel(A.KOA_USE).subscribe({start(n){Cz(n,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function Cz(e,t){let n=e.arguments[0];typeof n=="function"&&(e.arguments[0]=xz(n,t))}function xz(e,t){return e.router?Pz(e,t):BD(e,!1,t)}function Pz(e,t){let r=e.router?.stack??[];for(let i of r){let o=i.path,s=i.stack;s.forEach((c,a)=>{s[a]=BD(c,!0,t,o)})}return e}function BD(e,t,n,r){let i=t?lg.ROUTER:lg.MIDDLEWARE;return e[UD]===!0||n.includes(i)||e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?e:(e[UD]=!0,(o,s)=>{if(!Q())return e(o,s);let c=kz(o,e,t,r);o._matchedRoute&&Lz(o._matchedRoute.toString());let a=c.attributes[Pu],l=typeof a=="string"?a||"< unknown >":c.name;return Se({name:l,op:`${i}.koa`,attributes:{...c.attributes,[S]:Rz}},()=>{let p=c.attributes[He];if(J()===vt())$&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");else if(p){let u=o.request?.method?.toUpperCase()||"GET";J().setTransactionName(`${u} ${p}`)}return e(o,s)})})}function kz(e,t,n,r){return n?{attributes:{[Pu]:r?.toString(),[Ph]:lg.ROUTER,[He]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[Pu]:t.name||"middleware",[Ph]:lg.MIDDLEWARE,[Au]:t.name||"middleware"},name:`middleware - ${t.name}`}}function Lz(e){let t=Q();if(!t)return;let n=Re(t);n&&oe(n).data[H]==="http.server"&&n.setAttribute(He,e)}var HD=Oz;import*as pg from"diagnostics_channel";var Mz="IORedis",wz="auto.db.orchestrion.redis",Gz="db.connection_string";function WD(e){return{host:e?.options?.host,port:e?.options?.port}}function VD(e,t){return{[Pe]:"redis",[Gz]:`redis://${e}:${t}`,[Le]:e,[xe]:t,[S]:wz}}var FD=new WeakSet;function Uz(e){let t=e.arguments?.[0];if(!t||typeof t!="object"||FD.has(t))return;FD.add(t);let{host:n,port:r}=WD(e.self),i=ti(t.name,t.args??[]);return k({name:i,op:"db",attributes:{...VD(n,r),[Ve]:i}})}var Dz=((e={})=>{let t=e.responseHook;return{name:Mz,setupOnce(){if(!pg.tracingChannel)return;$&&g.log(`[orchestrion:ioredis] subscribing to "${A.IOREDIS_COMMAND}"/"${A.IOREDIS_CONNECT}"`);let n=pg.tracingChannel(A.IOREDIS_COMMAND),r=pg.tracingChannel(A.IOREDIS_CONNECT);ue(()=>{ee(n,Uz,{requiresParentSpan:!0,beforeSpanEnd(i,o){if("error"in o||!t)return;let s=o.arguments?.[0];s&&Bz(t,i,s,o.result)}}),ee(r,i=>{let{host:o,port:s}=WD(i.self);return k({name:"connect",op:"db",attributes:{...VD(o,s),[Ve]:"connect"}})},{requiresParentSpan:!0})})}}});function Bz(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var WI=Dz;import*as dg from"diagnostics_channel";var lc="messaging.destination.partition.id",VI="messaging.kafka.message.key",YI="messaging.kafka.message.tombstone",YD="messaging.kafka.offset",jI="process",Mp="receive",jD="send",ZI="kafka",ZD="_OTHER";var Hz="auto.kafkajs.orchestrion.producer",Fz="auto.kafkajs.orchestrion.consumer",Wz=1,Vz=0;function wp(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function XD(e){let t=wp(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=Tn(t,wp(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?Wz:Vz}}]}function ug({topic:e,message:t,operationType:n,links:r,attributes:i}){let o=n===Mp?"poll":n;return k({name:`${o} ${e}`,op:"message",kind:n===Mp?U.CLIENT:U.CONSUMER,links:r,attributes:{...i,[Mt]:ZI,[vn]:e,[ar]:n,[ia]:o,[VI]:t?.key?String(t.key):void 0,[YI]:t?.key&&t.value===null?!0:void 0,[YD]:t?.offset,...t?{[S]:Fz}:{}}})}function KD(e,t){let n=k({name:`send ${e}`,op:"message",kind:U.PRODUCER,attributes:{[Mt]:ZI,[vn]:e,[VI]:t.key?String(t.key):void 0,[YI]:t.key&&t.value===null?!0:void 0,[lc]:t.partition!==void 0?String(t.partition):void 0,[ia]:"send",[ar]:jD,[S]:Hz}});t.headers=t.headers??{};let r=$e({span:n});return r["sentry-trace"]&&(t.headers["sentry-trace"]=r["sentry-trace"]),r.baggage&&(t.headers.baggage=r.baggage),n}function XI(e,t){let n,r=ZD;typeof t=="string"||t===void 0?n=t:typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(t,"message")&&(n=t.message,r=t.constructor.name),e.forEach(i=>{i.setAttribute(Mr,r),i.setStatus({code:2,message:n})})}function KI(e,t){return Promise.resolve(t).catch(n=>{throw XI(e,n),n}).finally(()=>{e.forEach(n=>n.end())})}var qI=Symbol("sentry-kafkajs-consumer-callback-wrapped");function QI(e){return typeof e=="function"&&e[qI]===!0}function qD(e){let t=function(r){let i=wp(r.message.headers,"sentry-trace"),o=wp(r.message.headers,"baggage");return In({sentryTrace:i,baggage:o},()=>{let s=ug({topic:r.topic,message:r.message,operationType:jI,attributes:{[lc]:String(r.partition)}}),c=se(s,()=>e.call(this,r));return KI([s],c)})};return t[qI]=!0,t}function QD(e){let t=function(r){let i=An(()=>ug({topic:r.batch.topic,message:void 0,operationType:Mp,attributes:{[na]:r.batch.messages.length,[lc]:String(r.batch.partition)}}));return se(i,()=>{let o=[i];r.batch.messages.forEach(c=>{o.push(ug({topic:r.batch.topic,message:c,operationType:jI,links:XD(c.headers),attributes:{[lc]:String(r.batch.partition)}}))});let s=e.call(this,r);return KI(o,s)})};return t[qI]=!0,t}var Yz="Kafka";function jz(){let e=dg.tracingChannel(A.KAFKAJS_SEND_BATCH),t={start(n){let r=[];(n.arguments[0]?.topicMessages??[]).forEach(i=>{i.messages.forEach(o=>{r.push(KD(i.topic,o))})}),n._sentrySpans=r},error(n){n._sentrySpans&&XI(n._sentrySpans,n.error)},asyncEnd(n){n._sentrySpans?.forEach(r=>r.end())}};e.subscribe(t)}function Zz(){let e=dg.tracingChannel(A.KAFKAJS_CONSUMER_RUN),t={start(n){let r=n.arguments[0];!r||typeof r!="object"||(typeof r.eachMessage=="function"&&!QI(r.eachMessage)&&(r.eachMessage=qD(r.eachMessage)),typeof r.eachBatch=="function"&&!QI(r.eachBatch)&&(r.eachBatch=QD(r.eachBatch)))}};e.subscribe(t)}var Xz=(()=>({name:Yz,setupOnce(){dg.tracingChannel&&($&&g.log(`[orchestrion:kafkajs] subscribing to channels "${A.KAFKAJS_SEND_BATCH}", "${A.KAFKAJS_CONSUMER_RUN}"`),jz(),Zz())}})),JD=Xz;import*as mg from"diagnostics_channel";var Kz="Knex",qz="auto.db.orchestrion.knex",Qz=1021,Jz="db.sql.table",$z="sqlite",zz="postgresql",$I=Symbol("sentry.orchestrion.knex.parent-span"),e7=(()=>({name:Kz,setupOnce(){mg.tracingChannel&&($&&g.log(`[orchestrion:knex] subscribing to channel "${A.KNEX_QUERY}"`),ue(()=>{JI(A.KNEX_QUERY_BUILDER),JI(A.KNEX_SCHEMA_BUILDER),JI(A.KNEX_RAW),t7()}))}}));function JI(e){mg.tracingChannel(e).end.subscribe(t=>{let n=t.result;if(!n||typeof n!="object"||$I in n)return;let r=Q();r&&Object.defineProperty(n,$I,{value:r})})}function t7(){ee(mg.tracingChannel(A.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[$I]??Q();if(!r)return;let i=e.arguments[0],o=t?.client,s=o?.config?.connection,c=s?.connectionString,a=$D(n),l=i?.method,p=s?.filename||s?.database||s7(c),u={[S]:qz,"knex.version":e.moduleVersion,[Pe]:i7(o?.driverName),[Jz]:a,[zs]:l,[Lt]:s?.user,[yt]:p,[Le]:s?.host??a7(c),[xe]:s?.port??c7(c),[oa]:s?.filename===":memory:"?"inproc":void 0,[Ve]:i?.sql!=null?dn(i.sql,Qz):void 0};return k({name:o7(p,l,a)??"knex.query",kind:U.CLIENT,op:"db",parentSpan:r,attributes:u})},{beforeSpanEnd(e,t){if("error"in t){let n=n7(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function n7(e){let t=e.error;if(!t||typeof t!="object"||typeof t.message!="string")return;let n=t.message,r=e.arguments[0];if(!r?.sql)return n;try{let o=r7(e.self)(r.sql,r.bindings||[]);return n.replace(`${o} - `,"")}catch{return n}}function r7(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 i7(e){return e==="sqlite3"?$z:e==="pg"?zz:e}function o7(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function $D(e){let t=e?._single?.table;return t&&typeof t=="object"?$D(t):typeof t=="string"?t:void 0}function s7(e){if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}}function a7(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function c7(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var zI=e7;import*as fg from"diagnostics_channel";var l7=Na,p7=[Zr,Xr,Kr],zD=!1;function eB(){Ai(p7)}var u7=((e={})=>({name:l7,setupOnce(){if(!fg.tracingChannel||zD)return;zD=!0;let t=dr(e),n=r=>{eB();let i=r.arguments;if(!Array.isArray(i))return;let o=i[1];(!o||typeof o!="object"||Array.isArray(o))&&(o={},i[1]=o),o.callbacks=ns(o.callbacks,t)};for(let r of[A.LANGCHAIN_CHAT_MODEL_INVOKE,A.LANGCHAIN_CHAT_MODEL_STREAM])$&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),fg.tracingChannel(r).start.subscribe(n);ue(()=>{for(let r of HG)$&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),ee(fg.tracingChannel(r),i=>d7(i,e))})}}));function d7(e,t){eB();let n=(e.arguments??[])[0];return k(vd(e.self,n,t))}var tB=u7;import*as _g from"diagnostics_channel";var m7=Oa,nB=!1,gg=!1,f7=((e={})=>({name:m7,setupOnce(){if(!_g.tracingChannel||nB)return;nB=!0;let t=Ze(e),n=dr(t);ue(()=>{$&&g.log(`[orchestrion:langgraph] subscribing to channel "${A.LANGGRAPH_STATE_GRAPH_COMPILE}"`),ee(_g.tracingChannel(A.LANGGRAPH_STATE_GRAPH_COMPILE),i=>{if(gg)return;let o=eA(i.arguments),s=typeof o?.name=="string"?o.name:void 0;return k(Cd(s))},{beforeSpanEnd:(i,o)=>{rB(o.result,eA(o.arguments)??{},t,null,n)}}),$&&g.log(`[orchestrion:langgraph] subscribing to channel "${A.LANGGRAPH_CREATE_REACT_AGENT}"`);let r=_g.tracingChannel(A.LANGGRAPH_CREATE_REACT_AGENT);r.start.subscribe(i=>{gg=!0;try{let{arguments:o}=i,s=eA(o);s&&Array.isArray(s.tools)&&s.tools.length>0&&Rl(s.tools,t,Ca(o)??void 0)}catch(o){$&&g.error("[orchestrion:langgraph] failed to wrap createReactAgent tools",o)}}),r.end.subscribe(i=>{gg=!1;let{arguments:o,result:s}=i,c=Ca(o)??void 0;rB(s,c?{name:c}:{},t,vl(o),n)}),r.error.subscribe(()=>{gg=!1})})}}));function eA(e){let t=(e??[])[0];return typeof t=="object"&&t!==null?t:void 0}function rB(e,t,n,r,i){if(!e||typeof e!="object")return;let o=e,s=o.invoke;typeof s=="function"&&(o.invoke=Ol(s.bind(o),o,t,n,r,i))}var iB=f7;import*as tA from"diagnostics_channel";var g7="LruMemoizer",_7=(()=>({name:g7,setupOnce(){tA.tracingChannel&&($&&g.log(`[orchestrion:lru-memoizer] subscribing to channel "${A.LRU_MEMOIZER_LOAD}"`),ue(()=>{ee(tA.tracingChannel(A.LRU_MEMOIZER_LOAD),()=>{})}))}})),oB=_7;import*as Gp from"diagnostics_channel";var h7="Mongo",sB="auto.db.orchestrion.mongo",b7=new Set(["insert","update","delete","find","getMore","killCursors"]),y7=(()=>({name:h7,setupOnce(){Gp.tracingChannel&&ue(()=>{S7(),E7(),T7()})}}));function S7(){ee(Gp.tracingChannel(A.MONGODB_COMMAND),e=>{let t=e.arguments??[],n=t[0],r=t[1];if(!n||!r||typeof r!="object"||r.ismaster||r.hello)return;let i=Object.keys(r)[0];return _r(pp(e.self,n,r,i,sB))},{requiresParentSpan:!0})}function E7(){ee(Gp.tracingChannel(A.MONGODB_CHECKOUT),()=>{})}function T7(){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;hg(t,n=>({topology:n[0],ns:n[1],command:n[2]?.[0],operation:e}))}hg(A.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&b7.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?up(t):void 0}}),hg(A.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:"find"})),hg(A.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:"getMore"}))}function hg(e,t){ee(Gp.tracingChannel(e),n=>{let r=n.arguments;if(!r)return;let i=t(r);if(!(!i||typeof i.ns!="string"))return _r(dp(i.ns,i.topology,i.command,i.operation,sB))},{requiresParentSpan:!0})}var aB=y7;import*as Up from"diagnostics_channel";var I7="Mongoose",A7="auto.db.orchestrion.mongoose",nA=new WeakMap,cB=!1,N7=(()=>({name:I7,setupOnce(){Up.tracingChannel&&ue(()=>{zm(Up.tracingChannel),v7()})}}));function v7(){if(!cB){cB=!0,$&&g.log("[orchestrion:mongoose] subscribing to injected channels");for(let e of $G)lB(e).subscribe({start(t){pB(t.self)}});lB(A.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t=="object"&&pB(t)}}),uc(A.MONGOOSE_QUERY_EXEC,e=>{let t=e;return pc(t.mongooseCollection,t.model?.modelName,t.op??"exec",nA.get(e))}),uc(A.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return pc(t?.collection,t?.modelName,"aggregate",nA.get(e))}),uc(A.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return pc(t.collection,t.modelName,"save")}),uc(A.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return pc(t.collection,t.modelName,"remove")}),uc(A.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return pc(t.collection,t.modelName,"insertMany")}),uc(A.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return pc(t.collection,t.modelName,"bulkWrite")})}}function pc(e,t,n,r){return Li({collection:e,modelName:t,operation:n,origin:A7,parentSpan:r})}function lB(e){return Up.tracingChannel(e)}function uc(e,t){ee(Up.tracingChannel(e),n=>{let r=n.self;if(r)return t(r)})}function pB(e){let t=Q();e&&t&&nA.set(e,t)}var uB=N7;import*as rA from"diagnostics_channel";var R7="Mysql",O7="db.system",C7="db.connection_string",x7="db.name",P7="db.user",k7="db.statement",L7="net.peer.name",M7="net.peer.port",w7=(()=>({name:R7,setupOnce(){rA.tracingChannel&&($&&g.log(`[orchestrion:mysql] subscribing to channel "${A.MYSQL_QUERY}"`),ue(()=>{ee(rA.tracingChannel(A.MYSQL_QUERY),e=>{let t=U7(e.arguments[0]),{host:n,port:r,database:i,user:o}=D7(e.self),s=typeof r=="string"?parseInt(r,10):r,c=typeof s=="number"&&!isNaN(s);return e._sentryCallerScope=ne(),k({name:t??"mysql.query",kind:U.CLIENT,op:"db",attributes:{[O7]:"mysql",[S]:"auto.db.orchestrion.mysql",[C7]:B7(n,c?s:void 0,i),...i?{[x7]:i}:{},...o?{[P7]:o}:{},...t?{[k7]:t}:{},...n?{[L7]:n}:{},...c?{[M7]:s}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!="object"||!G7(n))return!1;let r=e._sentryCallerScope;return r&&gn(n,r),n.on("error",i=>t(i)),n.on("end",()=>t()),!0}})}))}}));function G7(e){return"on"in e&&typeof e.on=="function"}function U7(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 D7(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function B7(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var dB=w7;import*as bg from"diagnostics_channel";var H7="Mysql2",F7="auto.db.orchestrion.mysql2",W7="mysql";function V7(){ef(bg.tracingChannel),mB(A.MYSQL2_QUERY),mB(A.MYSQL2_EXECUTE)}function mB(e){ee(bg.tracingChannel(e),t=>{let n=Y7(t.arguments);return k({name:n??"mysql2.query",kind:U.CLIENT,attributes:{[S]:F7,[H]:"db",[Pe]:W7,...Z7(t.self?.config),[Ve]:n||void 0}})},{requiresParentSpan:!0})}function Y7(e){return j7(e[0])}function j7(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 Z7(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig??e??{},o=typeof n=="string"?parseInt(n,10):n,s=typeof o=="number"&&!isNaN(o);return{[yt]:r||void 0,[Lt]:i||void 0,[Le]:t||void 0,[xe]:s?o:void 0}}var X7=(()=>({name:H7,setupOnce(){bg.tracingChannel&&ue(()=>{V7()})}})),fB=X7;import*as iA from"diagnostics_channel";var _B="OpenAI",K7="auto.ai.orchestrion.openai",q7=[{channel:A.OPENAI_CHAT,operation:"chat"},{channel:A.OPENAI_EMBEDDINGS,operation:"embeddings"}],gB=!1,Q7=((e={})=>({name:_B,setupOnce(){!iA.tracingChannel||gB||(gB=!0,ue(()=>{for(let{channel:t,operation:n}of q7)$&&g.log(`[orchestrion:openai] subscribing to channel "${t}"`),ee(iA.tracingChannel(t),r=>J7(r,n,e),{beforeSpanEnd:(r,i)=>{gl(r,i.result,Ze(e).recordOutputs)},deferSpanEnd:({span:r,data:i})=>z7(r,i,e)})}))}}));function J7(e,t,n){if(On(_B))return;let r=e.arguments??[],i=r[0],{recordInputs:o}=Ze(n),s=ze(n.enableTruncation),c=_d(r,t);c[S]=K7;let a=i?.model||"unknown",l=k({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return o&&i&&hl(l,i,t,s),l}function $7(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function z7(e,t,n){let r=t.result;if(!$7(r))return!1;let{recordOutputs:i}=Ze(n),o=r[Symbol.asyncIterator].bind(r),s=_l({[Symbol.asyncIterator]:o},e,i??!1);return r[Symbol.asyncIterator]=()=>s,!0}var hB=Q7;import*as sA from"diagnostics_channel";var e6="Postgres",t6="auto.db.orchestrion.postgres",bB="db.system",yB="db.name",SB="db.connection_string",EB="db.user",n6="db.statement",TB="net.peer.name",IB="net.peer.port",r6="db.postgresql.plan",i6="db.postgresql.idle.timeout.millis",o6="db.postgresql.max.client",AB="postgresql",s6="pg.query",a6="pg.connect",c6="pg-pool.connect",l6=((e={})=>({name:e6,setupOnce(){sA.tracingChannel&&ue(()=>{oA(A.PG_QUERY,p6,{deferStreamedResult:!0}),e.ignoreConnectSpans||(oA(A.PG_CONNECT,u6),oA(A.PGPOOL_CONNECT,d6))})}}));function oA(e,t,{deferStreamedResult:n=!1}={}){$&&g.log(`[orchestrion:pg] subscribing to channel "${e}"`),ee(sA.tracingChannel(e),r=>(r._sentryCallerScope=ne(),k({...t(r),kind:U.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:r,end:i}){let o=r.result;if(!o||typeof o!="object"||!m6(o))return!1;let s=r._sentryCallerScope;return s&&gn(o,s),o.on("error",c=>i(c)),o.on("end",()=>i()),!0}}:{requiresParentSpan:!0})}function p6(e){let t=e.self?.connectionParameters??{},n=f6(e.arguments);return{name:n?.text??s6,op:"db",attributes:{...NB(t),[S]:t6,[n6]:n?.text||void 0,[r6]:typeof n?.name=="string"?n.name:void 0}}}function u6(e){let t=e.self?.connectionParameters??{};return{name:a6,op:"db",attributes:NB(t)}}function d6(e){let t=e.self?.options??{};return{name:c6,op:"db",attributes:g6(t)}}function m6(e){return"on"in e&&typeof e.on=="function"}function f6(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 NB(e){return{[bB]:AB,[SB]:vB(e),[yB]:e.database,[EB]:e.user,[TB]:e.host,[IB]:Number.isInteger(e.port)?e.port:void 0}}function g6(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}let n=t?.pathname.slice(1)||e.database,r=t?.hostname||e.host,i=Number(t?.port)||(Number.isInteger(e.port)?e.port:void 0),o=t?.username||e.user;return{[bB]:AB,[SB]:vB(e),[i6]:e.idleTimeoutMillis,[o6]:e.max,[yB]:n,[IB]:i,[TB]:r||void 0,[EB]:o||void 0}}function vB(e){if(e.connectionString)try{let i=new URL(e.connectionString);return i.username="",i.password="",i.toString()}catch{return"postgresql://localhost:5432/"}let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}var RB=l6;import*as dc from"diagnostics_channel";var _6="PostgresJs",h6="auto.db.orchestrion.postgresjs",b6="db.response.status_code",Xn=()=>{},y6=Symbol.for("sentry.query.from.instrumented.sql"),xB=Symbol("sentryPostgresJsSpan"),OB=Symbol("sentryPostgresJsConnectionAttrsSet"),PB=Symbol("sentryPostgresJsSpanEnded"),kB=new WeakMap,yg=[];function S6(e){yg.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)||yg.push(e)}function E6(){return yg.length===1?yg[0]:void 0}function T6(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!="object"||!n)return;let r=Xd(n);kB.set(t,r),S6(r)}function LB(e,t,n){let r=t;r[OB]||(r[OB]=!0,Zd(e,n))}function CB(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[xB],i=kB.get(t);r&&i&&LB(r,n,i)}function I6(e,t,n){let r=e.self;if(!r)return;let i=()=>{e[PB]=!0},o=r.resolve;typeof o=="function"&&(r.resolve=function(...c){i();try{let a=c[0]?.command;ka(t,n,a),t.end()}catch(a){$&&g.error("[orchestrion:postgresjs] error ending span in resolve:",a)}return o.apply(this,c)});let s=r.reject;typeof s=="function"&&(r.reject=function(...c){i();try{let a=c[0];t.setStatus({code:2,message:a?.message||"unknown_error"}),t.setAttribute(b6,a?.code||"unknown"),t.setAttribute(Mr,a?.name||"unknown"),ka(t,n),t.end()}catch(a){$&&g.error("[orchestrion:postgresjs] error ending span in reject:",a)}return s.apply(this,c)})}var A6=((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:_6,setupOnce(){dc.tracingChannel&&($&&g.log(`[orchestrion:postgresjs] subscribing to "${A.POSTGRESJS_HANDLE}"`),dc.tracingChannel(A.POSTGRESJS_CONNECTION).subscribe({start:Xn,asyncStart:Xn,asyncEnd:Xn,error:Xn,end:T6}),dc.tracingChannel(A.POSTGRESJS_EXECUTE).subscribe({end:Xn,asyncStart:Xn,asyncEnd:Xn,error:Xn,start:CB}),dc.tracingChannel(A.POSTGRESJS_CONNECT).subscribe({end:Xn,asyncStart:Xn,asyncEnd:Xn,error:Xn,start:CB}),ue(()=>{ee(dc.tracingChannel(A.POSTGRESJS_HANDLE),r=>{let i=r.self;if(!i||i.executed===!0||i[y6])return;let o=jd(i.strings),s=La(o),c=k({name:s||"postgresjs.query",op:"db",kind:U.CLIENT,attributes:{[S]:h6,[ut]:"postgres",[Lr]:s}});i[xB]=c;let a=E6();if(a&&LB(c,i,a),n)try{n(c,s,a)}catch(l){c.setAttribute("sentry.hook.error","requestHook failed"),$&&g.error("[orchestrion:postgresjs] error in requestHook:",l)}return I6(r,c,s),c},{requiresParentSpan:t!==!1,deferSpanEnd({data:r}){return r[PB]?!0:!("error"in r)}})}))}}}),MB=A6;import{EventEmitter as N6}from"events";import*as Eg from"diagnostics_channel";var v6="Tedious",R6="auto.db.orchestrion.tedious",O6="mssql",C6="db.sql.table",GB=Symbol("sentry.orchestrion.tedious.current-database");function Sg(e){Object.defineProperty(this,GB,{value:e,writable:!0,configurable:!0})}function wB(){this.removeListener("databaseChange",Sg)}function x6(){Eg.tracingChannel(A.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(Sg.call(t,t.config?.options?.database),t.removeListener("databaseChange",Sg),t.on("databaseChange",Sg),t.removeListener("end",wB),t.once("end",wB))})}function mc(e,t){Eg.tracingChannel(e).start.subscribe(n=>{let r=n,i=r.self,o=r.arguments[0];if(!i||!(o instanceof N6))return;let s=0,c=0,a=()=>{c++},l=()=>{s++},p=i[GB],u=P6(o),d={[S]:R6,[Pe]:O6,[yt]:p,[Lt]:i.config?.userName??i.config?.authentication?.options?.userName,[Ve]:u,[C6]:o.table,[Le]:i.config?.server,[xe]:i.config?.options?.port},m=k({name:k6(t,p,u,o.table),kind:U.CLIENT,op:"db",attributes:d}),_=L6(h=>{o.removeListener("done",a),o.removeListener("doneInProc",a),o.removeListener("doneProc",l),o.removeListener("error",_),i.removeListener("end",_),m.setAttribute("tedious.procedure_count",s),m.setAttribute("tedious.statement_count",c),h&&m.setStatus({code:2,message:h.message}),m.end()});if(o.on("done",a),o.on("doneInProc",a),o.on("doneProc",l),o.once("error",_),i.on("end",_),typeof o.callback=="function"){let h=o.callback;o.callback=function(...b){return _(b[0]),h.apply(this,b)}}})}function P6(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 k6(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 L6(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var M6=(()=>({name:v6,setupOnce(){Eg.tracingChannel&&($&&g.log(`[orchestrion:tedious] subscribing to channel "${A.TEDIOUS_EXEC_SQL}"`),ue(()=>{x6(),mc(A.TEDIOUS_EXEC_SQL,"execSql"),mc(A.TEDIOUS_EXEC_SQL_BATCH,"execSqlBatch"),mc(A.TEDIOUS_CALL_PROCEDURE,"callProcedure"),mc(A.TEDIOUS_EXEC_BULK_LOAD,"execBulkLoad"),mc(A.TEDIOUS_PREPARE,"prepare"),mc(A.TEDIOUS_EXECUTE,"execute")}))}})),UB=M6;import*as dA from"diagnostics_channel";var DB=Symbol("SentryVercelAiModelPatched"),BB=Symbol("SentryVercelAiToolPatched"),w6=0;function Tg(){return`v6-${++w6}`}var Ig=new WeakMap,YB=new WeakSet,jB=new WeakSet,pA=new WeakMap,uA=new WeakMap,cA=new WeakMap,ZB=new WeakSet,HB=!1;function XB(e,t={}){if(!HB){HB=!0;try{fc(e,A.VERCEL_AI_GENERATE_TEXT,aA("generateText"),t),fc(e,A.VERCEL_AI_STREAM_TEXT,aA("streamText"),t),fc(e,A.VERCEL_AI_GENERATE_OBJECT,aA("generateObject"),t),fc(e,A.VERCEL_AI_EMBED,(n,r)=>({type:"embed",event:{callId:Tg(),...lA(n.model),maxRetries:n.maxRetries,value:n.value,...Dp(r)}}),t),fc(e,A.VERCEL_AI_EMBED_MANY,(n,r)=>({type:"embedMany",event:{callId:Tg(),...lA(n.model),maxRetries:n.maxRetries,values:n.values,...Dp(r)}}),t),fc(e,A.VERCEL_AI_EXECUTE_TOOL_CALL,(n,r)=>({type:"executeTool",event:{callId:Tg(),toolCall:n.toolCall,tools:n.tools,...Dp(r)}}),t),B6(e,A.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{$&&g.log("Vercel AI orchestrion channel subscription failed.")}}}function fc(e,t,n,r){let i=e(t),o=s=>{let c=B(s.arguments[0])?s.arguments[0]:{},a=B(c.experimental_telemetry)?c.experimental_telemetry:{};if(a.isEnabled===!1&&!ZB.has(a))return;let l=n(c,a);D6(c,a);let p=Q(),u=fp(l,r);if(u){Ig.set(s,l),YB.add(u);let d=B(c.model)&&c.model.specificationVersion==="v1";cA.set(u,{callSiteSpan:p,toolErrorsBubbleToCaller:d}),l.type==="executeTool"&&jB.add(u);let m=Fe(l.event.callId);m&&pA.set(u,m),uA.set(u,Dp(a)),B(c.tools)&&H6(c.tools,r),d&&qB(c.model,r)}return u};ee(i,s=>o(s),{beforeSpanEnd:(s,c)=>{let a=Ig.get(c);if(a){if("error"in c){let l=cA.get(s)?.callSiteSpan;l&&B(c.error)&&we(c.error,"_sentry_active_span",l)}else a.result=a.type==="executeTool"?{output:c.result}:c.result,za(s,a,r);a.type!=="streamText"&&kE(a),Ig.delete(c)}},deferSpanEnd:({data:s,end:c})=>G6(s,c)})}function G6(e,t){if(Ig.get(e)?.type!=="streamText"||"error"in e||!U6(e.result))return!1;let n=e.result;return(async()=>{try{let[r,i,o,s,c]=await Promise.all([n.totalUsage??n.usage,n.text,n.toolCalls,n.finishReason,n.response]);e.result={usage:r,text:i,toolCalls:o,finishReason:s,response:c},t()}catch(r){t(r)}})(),!0}function U6(e){return B(e)&&(FB(e.totalUsage)||FB(e.usage))}function FB(e){return B(e)&&typeof e.then=="function"}function D6(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};ZB.add(n),e.experimental_telemetry=n}function B6(e,t,n){e(t).subscribe({end(r){let i=r;B(i.result)&&qB(i.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function KB(){let e=Q();return e&&YB.has(e)?e:void 0}function qB(e,t){e[DB]||(e[DB]=!0,WB(e,"doGenerate",t),WB(e,"doStream",t))}function WB(e,t,n){let r=e[t];typeof r=="function"&&(e[t]=function(...i){let o=KB();if(!o)return Promise.resolve(r.apply(this,i));let s=B(i[0])?i[0]:{},c=pA.get(o),a={type:"languageModelCall",event:{callId:c,provider:e.provider,modelId:e.modelId,tools:s.tools??(B(s.mode)?s.mode.tools:void 0),messages:s.prompt,...uA.get(o)}},l=se(o,()=>fp(a,n));if(!l)return Promise.resolve(r.apply(this,i));let p=()=>{t==="doStream"&&c&&LE(c)},u=d=>{throw l.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),l.end(),p(),d};try{return Promise.resolve(r.apply(this,i)).then(m=>t==="doStream"&&B(m)&&of(m.stream)?(m.stream=sf(m.stream,_=>{a.result={...m,...ME(_)},za(l,a,n),l.end(),p()},_=>{l.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),l.end(),p()}),m):(a.result=m,za(l,a,n),l.end(),p(),m),u)}catch(d){return u(d)}})}function H6(e,t){try{for(let[n,r]of Object.entries(e))B(r)&&F6(n,r,e,t)}catch{$&&g.log("Vercel AI orchestrion tool patching failed.")}}function F6(e,t,n,r){let i=t.execute;typeof i!="function"||t[BB]||(t[BB]=!0,t.execute=function(o,...s){let c=KB();if(!c||jB.has(c))return i.apply(this,[o,...s]);let a=B(s[0])?s[0]:{},l={type:"executeTool",event:{callId:pA.get(c),toolCall:{toolName:e,toolCallId:Fe(a.toolCallId),input:o},tools:n,...uA.get(c)}},p=se(c,()=>fp(l,r));if(!p)return i.apply(this,[o,...s]);let u=d=>{throw cA.get(c)?.toolErrorsBubbleToCaller?p.setStatus({code:2,message:d instanceof Error?d.message:"tool_error"}):wE(p,l,d),p.end(),d};try{return Promise.resolve(i.apply(this,[o,...s])).then(m=>(l.result={output:m},za(p,l,r),p.end(),m),u)}catch(d){return u(d)}})}function aA(e){return(t,n)=>({type:e,event:{callId:Tg(),operationId:`ai.${e}`,functionId:Fe(n.functionId),...lA(t.model),maxRetries:t.maxRetries,instructions:Fe(t.system),messages:W6(t),...Dp(n)}})}function W6(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt=="string"?[{role:"user",content:e.prompt}]:e.messages??e.prompt}function Dp(e){let t=e.isEnabled===!0?!0:void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function lA(e){return{provider:VB(e,"provider"),modelId:VB(e,"modelId")}}function VB(e,t){return B(e)?Fe(e[t]):void 0}var V6=((e={})=>{let t=gp(e);return Gt(t,{options:e,setupOnce(){dA.tracingChannel&&ue(()=>{XB(dA.tracingChannel,e)})}})}),QB=V6;import*as mA from"diagnostics_channel";var zB=new WeakMap;function eH(e,t){zB.set(e,t)}function tH(e){return zB.get(e)}var JB=new WeakMap;function Ag(e){let t=JB.get(e);return t||(t=[],JB.set(e,t)),t}function nH(e,t){Ag(e).push(t)}function rH(e){Ag(e).pop()}function iH(e){let t=e[0];return Array.isArray(t)?t.map(n=>$B(n)??"").join(","):$B(t)}function $B(e){return typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0}function oH(e){let t=Ag(e),n="";for(let r of t)r==="/"||r==="/*"||(n+=!n||n.endsWith("/")?r:`/${r}`);return n.replace(/\/{2,}/g,"/")}function sH(e,t){let n=Ag(e);if(n.length===0)return;let r=typeof e.originalUrl=="string"?e.originalUrl:"";if(n.every(s=>s==="/"))return r==="/"?"/":void 0;if(t==="*"||t.includes("/")&&(t.includes(",")||t.includes("\\")||t.includes("*")||t.includes("[")))return t;let i=t.startsWith("/")?t:`/${t}`;return i.length>0&&(r===i||r.startsWith(i)||Y6(i))?i:void 0}function Y6(e){return e.includes(":")||e.includes("*")}var j6="auto.http.express",Z6="express.name",X6="express.type",Eo=()=>{},aH=!1;function cH(e,t){if(!aH){aH=!0;for(let n of[A.EXPRESS_REGISTER,A.ROUTER_REGISTER])t(n).subscribe({start:Eo,asyncStart:Eo,asyncEnd:Eo,error:Eo,end:K6});for(let n of[A.EXPRESS_HANDLE,A.ROUTER_HANDLE]){$&&g.log(`[orchestrion:express] subscribing to channel "${n}"`);let r=t(n);ee(r,i=>Q6(i,e),{beforeSpanEnd(i,o){o._sentryCleanup?.()}}),r.subscribe({start:Eo,asyncEnd:Eo,end:Eo,error:Eo,asyncStart:q6})}}}function K6(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&eH(n,iH(e.arguments??[]))}function q6(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&rH(t)}function Q6(e,t){let n=e.self,r=e.arguments;if(!n||!Array.isArray(r)||n.handle?.length===4||n.method&&!n.route)return;let i=r[0],o=r[1];if(!i||!Q())return;let s=J6(n),c=tH(n);c!=null&&(nH(i,c),e._sentryStoredLayer=!0);let a=s==="request_handler"?oH(i):void 0,l=s==="request_handler"&&a!=null?sH(i,a):void 0,p=s==="request_handler"?a||"request handler":s==="router"?n.path??"/":n.name??"<anonymous>";if(l&&$6(l),s==="request_handler"&&a){let d=J();if(d!==vt()){let m=typeof i.method=="string"?i.method.toUpperCase():"GET";d.setTransactionName(`${m} ${a}`)}else $&&g.warn("[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name")}if(z6(p,s,t))return;let u=k({name:p,attributes:{[S]:j6,[H]:`${s}.express`,[Z6]:p,[X6]:s,...l?{[He]:l}:{}}});if(o&&typeof o.once=="function"){let d=()=>{u.end()};o.once("finish",d),e._sentryCleanup=()=>o.removeListener("finish",d)}return u}function J6(e){return e.name==="router"?"router":e.name==="bound dispatch"||e.name==="handle"?"request_handler":"middleware"}function $6(e){let t=Q(),n=t&&Re(t);n&&oe(n).data[H]==="http.server"&&n.setAttribute(He,e)}function z6(e,t,n){let{ignoreLayers:r,ignoreLayersType:i}=n;if(Array.isArray(i)&&i.includes(t))return!0;if(!Array.isArray(r))return!1;try{return mn(e,r,!0)}catch{return!1}}var e8="Express",t8=((e={})=>({name:e8,setupOnce(){mA.tracingChannel&&ue(()=>{cH(e,mA.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})),lH=t8;import*as hH from"diagnostics_channel";import*as fA from"diagnostics_channel";import*as pH from"net";function uH(e,t){return k({name:`${e} ${t.path}`,op:"db.query",kind:U.CLIENT,attributes:{[S]:"auto.firebase.orchestrion.firestore",[sr]:e,...r8(t)}})}function n8(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(pH.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 r8(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},i={[$s]:e.path,[_i]:t.name,[ut]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":n.projectId,"firebase.firestore.options.appId":n.appId,"firebase.firestore.options.messagingSenderId":n.messagingSenderId,"firebase.firestore.options.storageBucket":n.storageBucket},{address:o,port:s}=n8(r);return o&&(i[ft]=o),s&&(i[gt]=s),i}var dH="auto.firebase.orchestrion.functions",mH="__sentryFirebaseWrapped";function fH(e,t){let n=e.arguments;if(!Array.isArray(n)||n.length===0)return;let r=typeof n[0]=="function"?0:1,i=n[r];typeof i!="function"||i[mH]||(n[r]=i8(i,t))}function i8(e,t){let n=async function(...r){let i=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",o={[S]:dH,[WR]:i,[Nu]:t,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(o["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(o["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),ke({name:`firebase.function.${t}`,op:"function.firebase",kind:U.SERVER,attributes:o},async s=>{try{let c=await e.apply(this,r);return s.end(),c}catch(c){throw s.setStatus({code:2}),me(c,{mechanism:{type:dH,handled:!1}}),s.end(),await Zo(2e3),c}})};return n[mH]=!0,n}var o8=[{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}],s8=[{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"}],Ng=()=>{};function gH(e){try{return e()}catch(t){$&&g.warn("[orchestrion:firebase] error handling channel event",t);return}}function _H(){for(let{channel:e,spanName:t,useParent:n}of o8)ee(fA.tracingChannel(e),r=>gH(()=>{let i=r.arguments[0];if(!i)return;let o=n&&i.parent||i;return uH(t,o)}));for(let{channel:e,triggerType:t}of s8)fA.tracingChannel(e).subscribe({start:n=>{gH(()=>fH(n,t))},end:Ng,asyncStart:Ng,asyncEnd:Ng,error:Ng})}var a8="Firebase",c8=(()=>({name:a8,setupOnce(){hH.tracingChannel&&ue(()=>{_H()})}})),bH=c8;function Bp(){return!!te.__SENTRY_ORCHESTRION__}function gA(){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 gc from"diagnostics_channel";var l8="RedisChannel",hA="auto.db.orchestrion.redis",EH="db.connection_string",bA="redis";function yH(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function TH(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function p8(e){let t=e[0];return B(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function u8(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 IH(e){return{[Pe]:bA,[Le]:e?.socket?.host,[xe]:e?.socket?.port,[EH]:u8(e?.url),[S]:hA}}function AH(e,t,n){return k({name:`redis-${e}`,kind:U.CLIENT,attributes:{...n,[H]:"db",[Ve]:ti(e,t)}})}function d8(e){let t=gc.tracingChannel(A.REDIS_COMMAND),n=()=>{};t.subscribe({end:n,asyncStart:n,asyncEnd:n,start(r){let i=r.arguments?.[0];if(!i||typeof i!="object")return;let o=i.callback;if(typeof o!="function")return;let s=r.self,c={[Pe]:bA,[S]:hA};c[Le]=s?.connection_options?.host,c[xe]=s?.connection_options?.port,s?.address&&(c[EH]=`redis://${s.address}`);let a=AH(i.command,i.args??[],c);r._sentrySpan=a;let l=Q();i.callback=function(p,u){p||TH(e,a,i.command,i.args??[],u),yH(a,p);let d=arguments;return se(l??null,()=>o.apply(this,d))}},error(r){let i=r._sentrySpan;i&&yH(i,r.error)}})}function SH(e,t,n){let r=gc.tracingChannel(e);ee(r,i=>{let o=t(i);if(!o?.length)return;let s=String(o[0]),c=i.self?.options;return AH(s,o.slice(1),IH(c))},{beforeSpanEnd(i,o){if("error"in o||!n)return;let s=t(o);s?.length&&TH(n,i,String(s[0]),s.slice(1),o.result)}})}function m8(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function f8(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(!(typeof t?.transformArguments!="function"||!Array.isArray(n)))try{return t.transformArguments(...p8(n))}catch{return}}function g8(){let e=gc.tracingChannel(A.NODE_REDIS_CONNECT);ee(e,t=>{let n=t.self?.options;return k({name:"redis-connect",kind:U.CLIENT,attributes:{...IH(n),[H]:"db"}})})}function _A(e,t){let n=gc.tracingChannel(e);ee(n,r=>{let i=r.arguments?.[0],o=Array.isArray(i)?i.length:void 0,s=r.self?.options?.socket;return k({name:t(r),kind:U.CLIENT,attributes:{[S]:hA,[H]:"db.redis",[ut]:bA,...o&&o>1?{[ea]:o}:{},...s?.host!=null?{[ft]:s.host}:{},...s?.port!=null?{[gt]:s.port}:{}}})})}var _8=((e={})=>{let t=e.responseHook;return{name:l8,setupOnce(){gc.tracingChannel&&($&&g.log(`[orchestrion:redis] subscribing to "${A.REDIS_COMMAND}" and node-redis channels`),d8(t),ue(()=>{SH(A.NODE_REDIS_COMMAND,m8,t),SH(A.NODE_REDIS_EXECUTOR,f8,t),g8(),_A(A.NODE_REDIS_MULTI,()=>"MULTI"),_A(A.NODE_REDIS_PIPELINE,()=>"PIPELINE"),_A(A.NODE_REDIS_BATCH,n=>n.arguments?.[2]!==void 0?"MULTI":"PIPELINE")}))}}}),yA=_8;var SA={postgresIntegration:RB,postgresJsIntegration:MB,mongoIntegration:aB,mysqlIntegration:dB,mysql2Integration:fB,genericPoolIntegration:cD,mongooseIntegration:uB,lruMemoizerIntegration:oB,openaiIntegration:hB,anthropicIntegration:jU,googleGenAIIntegration:dD,langChainIntegration:tB,langGraphIntegration:iB,vercelAiIntegration:QB,amqplibIntegration:WU,hapiIntegration:GD,koaIntegration:HD,expressIntegration:lH,graphqlIntegration:xD,kafkajsIntegration:JD,tediousIntegration:UB,awsIntegration:rD,firebaseIntegration:bH};var NH="Knex",h8=de(NH,()=>new Vf),b8=(()=>({name:NH,setupOnce(){Bp()?zI().setupOnce?.():h8()}})),y8=b8;import{EventEmitter as S8}from"events";var vH="db.sql.table",RH="mssql";function OH(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 CH=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};var E8="@sentry/instrumentation-tedious",PH=Symbol("opentelemetry.instrumentation-tedious.current-database"),xH=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function vg(e){Object.defineProperty(this,PH,{value:e,writable:!0})}var kH=class LH extends ae{constructor(t={}){super(E8,q,t)}init(){return[new re(LH.COMPONENT,[">=1.11.0 <20"],t=>{let n=t.Connection.prototype;for(let r of xH)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 xH)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(t){return function(){return vg.call(this,this.config?.options?.database),this.removeListener("databaseChange",vg),this.on("databaseChange",vg),this.once("end",()=>{this.removeListener("databaseChange",vg)}),t.apply(this,arguments)}}_patchQuery(t){return n=>{let r=this;function i(o){if(!(o instanceof S8))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[PH],u=(h=>h.sqlTextOrProcedure==="sp_prepare"&&h.parametersByName?.stmt?.value?h.parametersByName.stmt.value:h.sqlTextOrProcedure)(o),d={[S]:"auto.db.otel.tedious",[Pe]:RH,[yt]:p,[Lt]:this.config?.userName??this.config?.authentication?.options?.userName,[Ve]:u,[vH]:o.table,[Le]:this.config?.server,[xe]:this.config?.options?.port},m=k({name:OH(t,p,u,o.table),kind:U.CLIENT,attributes:d}),_=CH(h=>{o.removeListener("done",a),o.removeListener("doneInProc",a),o.removeListener("doneProc",l),o.removeListener("error",_),this.removeListener("end",_),m.setAttribute("tedious.procedure_count",s),m.setAttribute("tedious.statement_count",c),h&&m.setStatus({code:2,message:h.message}),m.end()});return o.on("done",a),o.on("doneInProc",a),o.on("doneProc",l),o.once("error",_),this.on("end",_),typeof o.callback=="function"?r._wrap(o,"callback",r._patchCallbackQuery(_)):r._diag.error("Expected request.callback to be a function"),se(m,()=>n.apply(this,arguments))}return Object.defineProperty(i,"length",{value:n.length,writable:!1}),i}}_patchCallbackQuery(t){return n=>function(r,i,o){return t(r),n.apply(this,arguments)}}};kH.COMPONENT="tedious";var MH=kH;var wH="Tedious",EA=de(wH,()=>new MH({})),T8=(()=>({name:wH,setupOnce(){EA()}})),TA=T8;var IA="generic-pool",I8="@sentry/instrumentation-generic-pool",Rg=class extends ae{constructor(t={}){super(I8,q,t),this._isDisabled=!1}init(){return[new re(IA,[">=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(IA,[">=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(IA,[">=2.0.0 <2.4"],t=>(this._isDisabled=!1,w(t.Pool)&&this._unwrap(t,"Pool"),this._wrap(t,"Pool",this._poolWrapper.bind(this)),t),t=>(this._isDisabled=!0,t))]}_acquirePatcher(t){return function(...r){return Se({name:"generic-pool.acquire",attributes:{[S]:"auto.db.otel.generic_pool"}},()=>t.call(this,...r))}}_poolWrapper(t){let n=this._wrap.bind(this),r=this._acquireWithCallbacksPatcher.bind(this);return function(...o){let s=t.apply(this,o);return n(s,"acquire",r),s}}_acquireWithCallbacksPatcher(t){let n=()=>this._isDisabled;return function(i,o){return n()?t.call(this,i,o):ke({name:"generic-pool.acquire",attributes:{[S]:"auto.db.otel.generic_pool"}},s=>{t.call(this,(c,a)=>{c&&s.setStatus({code:2,message:"internal_error"}),s.end(),i&&i(c,a)},o)})}}};var GH="GenericPool",AA=de(GH,()=>new Rg({})),A8=(()=>({name:GH,setupOnce(){AA()}})),NA=A8;var RA="dataloader",N8="@sentry/instrumentation-dataloader",_c="auto.db.otel.dataloader";function v8(e){return e[Symbol.toStringTag]==="Module"}function UH(e){return v8(e)?e.default:e}function hc(e,t){let n=e.name;return n?`${RA}.${t} ${n}`:`${RA}.${t}`}function bc(e){if(e==="load"||e==="loadMany"||e==="batch")return"cache.get"}function vA(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}var Og=class extends ae{constructor(t={}){super(N8,q,t)}init(){return[new re(RA,[">=2.0.0 <3"],t=>{let n=UH(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=UH(t);["load","loadMany","prime","clear","clearAll"].forEach(r=>{w(n.prototype[r])&&this._unwrap(n.prototype,r)})})]}_wrapBatchLoadFn(t){let n=this;return function(...i){return n.isEnabled()?Se({name:hc(this,"batch"),links:this._batch?.spanLinks,attributes:{[S]:_c,[H]:bc("batch"),[Js]:vA(i[0])},onlyIfParent:!0},()=>t.apply(this,i)):t.call(this,...i)}}_getPatchedConstructor(t){let n=this,r=t.prototype;if(!n.isEnabled())return t;function i(...o){return typeof o[0]=="function"&&(w(o[0])&&n._unwrap(o,0),o[0]=n._wrapBatchLoadFn(o[0])),t.apply(this,o)}return i.prototype=r,i}_patchLoad(t){w(t.load)&&this._unwrap(t,"load"),this._wrap(t,"load",this._getPatchedLoad.bind(this))}_getPatchedLoad(t){return function(...r){return Se({name:hc(this,"load"),kind:U.CLIENT,attributes:{[S]:_c,[H]:bc("load"),[Js]:vA(r[0])},onlyIfParent:!0},i=>{let o=t.call(this,...r);return this._batch&&i.isRecording()&&(this._batch.spanLinks||(this._batch.spanLinks=[]),this._batch.spanLinks.push({context:i.spanContext()})),o})}}_patchLoadMany(t){w(t.loadMany)&&this._unwrap(t,"loadMany"),this._wrap(t,"loadMany",this._getPatchedLoadMany.bind(this))}_getPatchedLoadMany(t){return function(...r){return Se({name:hc(this,"loadMany"),kind:U.CLIENT,attributes:{[S]:_c,[H]:bc("loadMany"),[Js]:vA(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:hc(this,"prime"),kind:U.CLIENT,attributes:{[S]:_c,[H]:bc("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:hc(this,"clear"),kind:U.CLIENT,attributes:{[S]:_c,[H]:bc("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:hc(this,"clearAll"),kind:U.CLIENT,attributes:{[S]:_c,[H]:bc("clearAll")},onlyIfParent:!0},()=>t.call(this,...r))}}};var DH="Dataloader",R8=de(DH,()=>new Og),O8=(()=>({name:DH,setupOnce(){Bp()?wI().setupOnce?.():R8()}})),C8=O8;var ln=(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))(ln||{});st();var BH="messaging.operation",OA="messaging.destination",CA="messaging.destination_kind",xA="messaging.rabbitmq.routing_key",PA="messaging.protocol",HH="messaging.protocol_version",FH="messaging.url",kA="messaging.message_id",LA="messaging.conversation_id",MA="topic",WH="process";var x8="auto.amqplib.otel.publisher",P8="auto.amqplib.otel.consumer",Cg=Symbol("opentelemetry.amqplib.message.stored-span"),To=Symbol("opentelemetry.amqplib.channel.spans-not-ended"),xg=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer"),Pg=Symbol("opentelemetry.amqplib.connection.attributes"),kg=Symbol("sentry.amqplib.channel.is-confirm-publishing"),k8=e=>e!==""?e:"<default>",L8=e=>e.replace(/:[^:@/]*@/,":***@"),VH=(e,t)=>e||(t==="AMQP"?5672:5671),YH=e=>{let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()},jH=e=>e||"localhost",ZH=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[Mt]:t}:{}},XH=e=>{let t={[HH]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,i=YH(r?.protocol);t[PA]=i,t[Le]=jH(r?.hostname),t[xe]=VH(r.port,i)}else{let r=L8(n);t[FH]=r;try{let i=new URL(r),o=YH(i.protocol);t[PA]=o,t[Le]=jH(i.hostname),t[xe]=VH(i.port?parseInt(i.port):void 0,o)}catch{}}return t};function wA(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}function GA(e,t,n,r){let i=k8(e),o=k({name:`publish ${i}`,kind:Nt.PRODUCER,attributes:{...n.connection[Pg],[OA]:e,[CA]:MA,[xA]:t,[kA]:r?.messageId,[LA]:r?.correlationId,[S]:x8}}),s=r??{};s.headers=s.headers??{};let c=$e({span:o});return c["sentry-trace"]&&(s.headers["sentry-trace"]=c["sentry-trace"]),c.baggage&&(s.headers.baggage=c.baggage),{span:o,modifiedOptions:s}}function KH(e,t,n){return k({name:`${e} process`,kind:Nt.CONSUMER,attributes:{...n?.connection?.[Pg],[OA]:t.fields?.exchange,[CA]:MA,[xA]:t.fields?.routingKey,[BH]:WH,[kA]:t?.properties.messageId,[LA]:t?.properties.correlationId,[S]:P8}})}var qH=1e3*60;function Hp(e,t,n,r){let i=e[Cg];i&&(t!==!1&&i.setStatus({code:2,message:n!==ln.ChannelClosed&&n!==ln.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),i.end(),e[Cg]=void 0)}function UA(e,t,n,r){(e[To]??[]).forEach(o=>{Hp(o.msg,t,n,r)}),e[To]=[]}function M8(e){let t=ct(),n=e[To]??[],r;for(r=0;r<n.length;r++){let i=n[r];if((t-i.timeOfConsume)*1e3<qH)break;Hp(i.msg,null,ln.InstrumentationTimeout,!0)}n.splice(0,r)}function QH(e){return function(n,r,i){return e.call(this,n,r,function(o,s){if(o==null){let c=XH(n),a=ZH(s);s[Pg]={...c,...a}}i.apply(this,arguments)})}}function JH(e){return function(n){if(n==="close"){UA(this,!0,ln.ChannelClosed,void 0);let r=this[xg];r&&clearInterval(r),this[xg]=void 0}else n==="error"&&UA(this,!0,ln.ChannelError,void 0);return e.apply(this,arguments)}}function DA(e,t){return n=>function(i){return UA(this,e,t,i),n.apply(this,arguments)}}function Lg(e,t){return n=>function(i,o,s){let c=this,a=t===ln.Reject?o:s,l=c[To]??[],p=l.findIndex(u=>u.msg===i);if(p<0)Hp(i,e,t,a);else if(t!==ln.Reject&&o){for(let u=0;u<=p;u++)Hp(l[u].msg,e,t,a);l.splice(0,p+1)}else Hp(i,e,t,a),l.splice(p,1);return n.apply(this,arguments)}}function $H(e){return function(n,r,i){let o=this;if(!Object.prototype.hasOwnProperty.call(o,To)){let a=setInterval(()=>{M8(o)},qH);a.unref(),o[xg]=a,o[To]=[]}let s=function(a){if(!a)return r.call(this,a);let l=a.properties.headers??{},p=wA(l,"sentry-trace"),u=wA(l,"baggage");In({sentryTrace:p,baggage:u},()=>{let d=KH(n,a,o);i?.noAck||(o[To].push({msg:a,timeOfConsume:ct()}),a[Cg]=d),se(d,()=>{r.call(this,a)}),i?.noAck&&d.end()})},c=Array.prototype.slice.call(arguments);return c[1]=s,e.apply(this,c)}}function zH(e){return function(n,r,i,o,s){let c=this,{span:a,modifiedOptions:l}=GA(n,r,c,o),p=function(d,m){try{se(a,()=>{s?.call(this,d,m)})}finally{d&&a.setStatus({code:2,message:"message confirmation has been nack'ed"}),a.end()}},u=[...arguments];u[3]=l,u[4]=p,c[kg]=!0;try{return e.apply(this,u)}finally{c[kg]=!1}}}function eF(e){return function(n,r,i,o){if(this[kg])return e.apply(this,arguments);let s=this,{span:c,modifiedOptions:a}=GA(n,r,s,o),l=[...arguments];l[3]=a;let p=e.apply(this,l);return c.end(),p}}var w8="@sentry/instrumentation-amqplib",Mg=[">=0.5.5 <2"],wg=class extends ae{constructor(t={}){super(w8,q,t)}init(){let t=new Ae("amqplib/lib/channel_model.js",Mg,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ae("amqplib/lib/callback_model.js",Mg,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ae("amqplib/lib/connect.js",Mg,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new re("amqplib",Mg,void 0,void 0,[t,r,n])}patchConnect(t){let n=this.unpatchConnect(t);return w(n.connect)||this._wrap(n,"connect",QH),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",eF),w(t.Channel.prototype.consume)||this._wrap(t.Channel.prototype,"consume",$H),w(t.Channel.prototype.ack)||this._wrap(t.Channel.prototype,"ack",Lg(!1,ln.Ack)),w(t.Channel.prototype.nack)||this._wrap(t.Channel.prototype,"nack",Lg(!0,ln.Nack)),w(t.Channel.prototype.reject)||this._wrap(t.Channel.prototype,"reject",Lg(!0,ln.Reject)),w(t.Channel.prototype.ackAll)||this._wrap(t.Channel.prototype,"ackAll",DA(!1,ln.AckAll)),w(t.Channel.prototype.nackAll)||this._wrap(t.Channel.prototype,"nackAll",DA(!0,ln.NackAll)),w(t.Channel.prototype.emit)||this._wrap(t.Channel.prototype,"emit",JH),w(t.ConfirmChannel.prototype.publish)||this._wrap(t.ConfirmChannel.prototype,"publish",zH),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 tF="Amqplib",BA=de(tF,()=>new wg),G8=(()=>({name:tF,setupOnce(){BA()}})),HA=G8;var Gg="VercelAI";var U8=[">=3.0.0 <7"],nF=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function D8(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 B8(e){if(typeof e!="object"||e===null||!("content"in e)||typeof e.consumeStream=="function")return;let t=e;Array.isArray(t.content)&&(H8(t.content),F8(t.content))}function H8(e){for(let t of e){if(!D8(t))continue;let n=ty(t.toolCallId);n?Be(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"),me(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Be(r=>{r.setTag("vercel.ai.tool.name",t.toolName),r.setTag("vercel.ai.tool.callId",t.toolCallId),r.setLevel("error"),me(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function F8(e){for(let t of e)typeof t=="object"&&t!==null&&"toolCallId"in t&&typeof t.toolCallId=="string"&&ny(t.toolCallId)}function W8(e,t,n,r,i){let o=e?.recordInputs!==void 0?e.recordInputs:t.recordInputs!==void 0?t.recordInputs:n===!0?!0:r,s=e?.recordOutputs!==void 0?e.recordOutputs:t.recordOutputs!==void 0?t.recordOutputs:n===!0?!0:i;return{recordInputs:o,recordOutputs:s}}var Ug=class extends ae{constructor(t={}){super("@sentry/instrumentation-vercel-ai",q,t),this._isPatched=!1,this._callbacks=[]}init(){return new re("ai",U8,this._patch.bind(this))}callWhenPatched(t){this._isPatched?t():this._callbacks.push(t)}_patch(t){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(i,o,s)=>{let c=s[0].experimental_telemetry||{},a=c.isEnabled,l=C(),p=l?.getIntegrationByName(Gg),u=p?.options,d=p?l?.getDataCollectionOptions().genAI:void 0,{recordInputs:m,recordOutputs:_}=W8(u,c,a,!!d?.inputs,!!d?.outputs);return s[0].experimental_telemetry={...c,isEnabled:a!==void 0?a:!0,recordInputs:m,recordOutputs:_},or(()=>Reflect.apply(i,o,s),h=>{h&&typeof h=="object"&&we(h,"_sentry_active_span",Q())},()=>{},h=>{B8(h)})}});if(Object.prototype.toString.call(t)==="[object Module]"){for(let r of nF)t[r]!=null&&(t[r]=n(t[r]));return t}else{let r=nF.reduce((i,o)=>(t[o]!=null&&(i[o]=n(t[o])),i),{});return{...t,...r}}}};var FA=de(Gg,()=>new Ug({}));function V8(e){return!!e.getIntegrationByName("Modules")?.getModules?.()?.ai}var Y8=((e={})=>{let t,n=gp(e);return Gt(n,{options:e,setupOnce(){t=FA()},afterAllSetup(r){e.force??V8(r)?md(r):t?.callWhenPatched(()=>md(r))}})}),WA=Y8;var j8=[">=4.0.0 <8"],Dg=class extends ae{constructor(t={}){super("@sentry/instrumentation-openai",q,t)}init(){return new re("openai",j8,this._patch.bind(this))}_patch(t){let n=t;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(t,n){let r=t[n];if(!r)return t;let i=this.getConfig(),o=function(...s){if(On(Zr))return Reflect.construct(r,s);let c=Reflect.construct(r,s);return hd(c,i)};Object.setPrototypeOf(o,r),Object.setPrototypeOf(o.prototype,r.prototype);for(let s of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(s)){let c=Object.getOwnPropertyDescriptor(r,s);c&&Object.defineProperty(o,s,c)}try{t[n]=o}catch{Object.defineProperty(t,n,{value:o,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=o}catch{Object.defineProperty(t,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return t}};var VA=de(Zr,e=>new Dg(e)),Z8=((e={})=>({name:Zr,setupOnce(){VA(e)}})),YA=Z8;var X8=[">=0.19.2 <1.0.0"],Bg=class extends ae{constructor(t={}){super("@sentry/instrumentation-anthropic-ai",q,t)}init(){return new re("@anthropic-ai/sdk",X8,this._patch.bind(this))}_patch(t){let n=t.Anthropic,r=this.getConfig(),i=function(...o){if(On(Xr))return Reflect.construct(n,o);let s=Reflect.construct(n,o);return Ed(s,r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let o of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(i,o,s)}try{t.Anthropic=i}catch{Object.defineProperty(t,"Anthropic",{value:i,writable:!0,configurable:!0,enumerable:!0})}if(t.default===n)try{t.default=i}catch{Object.defineProperty(t,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return t}};var jA=de(Xr,e=>new Bg(e)),K8=((e={})=>({name:Xr,options:e,setupOnce(){jA(e)}})),ZA=K8;var rF=[">=0.10.0 <2"],Hg=class extends ae{constructor(t={}){super("@sentry/instrumentation-google-genai",q,t)}init(){return new re("@google/genai",rF,n=>this._patch(n),n=>n,[new Ae("@google/genai/dist/node/index.cjs",rF,n=>this._patch(n),n=>n)])}_patch(t){let n=t.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return t;let i=function(...o){if(On(Kr))return Reflect.construct(n,o);let s=Reflect.construct(n,o);return Ad(s,r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let o of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(i,o,s)}return kl(t,"GoogleGenAI",i),t}};var XA=de(Kr,e=>new Hg(e)),q8=((e={})=>({name:Kr,setupOnce(){XA(e)}})),KA=q8;var Fg=[">=0.1.0 <2.0.0"];function Q8(e,t,n){return new Proxy(e,{apply(r,i,o){let c=o[1];return(!c||typeof c!="object"||Array.isArray(c))&&(c={},o[1]=c),c.callbacks=ns(c.callbacks,t),Reflect.apply(r,i,o)}})}var Wg=class extends ae{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,Fg,this._patch.bind(this),i=>i,[new Ae(`${r}/dist/index.cjs`,Fg,this._patch.bind(this),i=>i)]));return t.push(new re("langchain",Fg,this._patch.bind(this),r=>r,[new Ae("langchain/dist/chat_models/universal.cjs",Fg,this._patch.bind(this),r=>r)])),t}_patch(t){Ai([Zr,Xr,Kr]);let n=this.getConfig(),r=dr(n);return this._patchRunnableMethods(t,r),this._patchEmbeddingsMethods(t,n),t}_patchRunnableMethods(t,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],i=t.universal_exports??t,o=Object.values(i).find(a=>typeof a=="function"&&r.includes(a.name));if(!o)return;let s=o.prototype;if(s.__sentry_patched__)return;s.__sentry_patched__=!0;let c=["invoke","stream","batch"];for(let a of c){let l=s[a];typeof l=="function"&&(s[a]=Q8(l,n))}}_patchEmbeddingsMethods(t,n){let r=t.universal_exports??t;for(let i of Object.values(r)){if(typeof i!="function"||!i.prototype)continue;let o=i.prototype;typeof o.embedQuery!="function"||typeof o.embedDocuments!="function"||o.__sentry_patched__||(o.__sentry_patched__=!0,Rd(o,n))}}};var qA=de(Na,e=>new Wg(e)),J8=((e={})=>({name:Na,setupOnce(){qA(e)}})),QA=J8;var Fp=[">=0.0.0 <2.0.0"],Vg=class extends ae{constructor(t={}){super("@sentry/instrumentation-langgraph",q,t)}init(){return[new re("@langchain/langgraph",Fp,this._patch.bind(this),t=>t,[new Ae("@langchain/langgraph/dist/index.cjs",Fp,this._patch.bind(this),t=>t),new Ae("@langchain/langgraph/dist/prebuilt/index.cjs",Fp,this._patch.bind(this),t=>t)]),new re("@langchain/langgraph/prebuilt",Fp,this._patch.bind(this),t=>t,[new Ae("@langchain/langgraph/dist/prebuilt/index.cjs",Fp,this._patch.bind(this),t=>t)])]}_patch(t){let r=C()?.getDataCollectionOptions().genAI,i={...this.getConfig(),recordInputs:this.getConfig().recordInputs??r?.inputs??!1,recordOutputs:this.getConfig().recordOutputs??r?.outputs??!1};if(t.StateGraph&&typeof t.StateGraph=="function"&&Cl(t.StateGraph.prototype,i),t.createReactAgent&&typeof t.createReactAgent=="function"){let o=t.createReactAgent;Object.defineProperty(t,"createReactAgent",{value:uy(o,i),writable:!0,enumerable:!0,configurable:!0})}return t}};var JA=de(Oa,e=>new Vg(e)),$8=((e={})=>({name:Oa,setupOnce(){JA(e)}})),$A=$8;var z8=e=>(Et()||Me(()=>{console.warn("The launchDarklyIntegration() can only be used in the browser.")}),{name:"LaunchDarkly"});function eee(){return Et()||Me(()=>{console.warn("The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.")}),{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:()=>null}}var tee=e=>(Et()||Me(()=>{console.warn("The openFeatureIntegration() can only be used in the browser.")}),{name:"OpenFeature"}),zA=class{constructor(){Et()||Me(()=>{console.warn("The OpenFeatureIntegrationHook can only be used in the browser.")})}after(){}error(){}};var nee=e=>(Et()||Me(()=>{console.warn("The statsigIntegration() can only be used in the browser.")}),{name:"Statsig"});var ree=e=>(Et()||Me(()=>{console.warn("The unleashIntegration() can only be used in the browser.")}),{name:"Unleash"});var iee=Ub;import*as oF from"net";function sF(e,t,n){let r=new re("@firebase/firestore",e,o=>iF(o,t,n)),i=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let o of i)r.files.push(new Ae(o,e,s=>iF(s,t,n),s=>aF(s,n)));return r}function iF(e,t,n){return aF(e,n),t(e,"addDoc",oee()),t(e,"getDocs",aee()),t(e,"setDoc",cee()),t(e,"deleteDoc",see()),e}function aF(e,t){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])w(e[n])&&t(e,n);return e}function oee(){return function(t){return function(n,r){return Yg("addDoc",n,()=>t(n,r))}}}function see(){return function(t){return function(n){return Yg("deleteDoc",n.parent||n,()=>t(n))}}}function aee(){return function(t){return function(n){return Yg("getDocs",n,()=>t(n))}}}function cee(){return function(t){return function(n,r,i){return Yg("setDoc",n.parent||n,()=>typeof i<"u"?t(n,r,i):t(n,r))}}}function Yg(e,t,n){return Se({name:`${e} ${t.path}`,op:"db.query",kind:U.CLIENT,attributes:{[S]:"auto.firebase.otel.firestore",[sr]:e,...pee(t)}},n)}function lee(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(oF.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 pee(e){let t=e.firestore.app,n=t.options,i=(e.firestore.toJSON()||{}).settings||{},o={[$s]:e.path,[_i]:t.name,[ut]:"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}=lee(i);return s&&(o[ft]=s),c&&(o[gt]=c),o}function cF(e,t,n){let r=new re("firebase-functions",e);return[{name:"firebase-functions/lib/v2/providers/https.js",triggerType:"function"},{name:"firebase-functions/lib/v2/providers/firestore.js",triggerType:"firestore"},{name:"firebase-functions/lib/v2/providers/scheduler.js",triggerType:"scheduler"},{name:"firebase-functions/lib/v2/storage.js",triggerType:"storage"}].forEach(({name:o,triggerType:s})=>{r.files.push(new Ae(o,e,c=>uee(c,t,n,s),c=>lF(c,n)))}),r}function pn(e){return function(n){return function(...r){let i=typeof r[0]=="function"?r[0]:r[1],o=typeof r[0]=="function"?void 0:r[0];if(!i)return n.call(this,...r);let s=async function(...c){let a=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",l={[S]:"auto.firebase.otel.functions","faas.name":a,"faas.trigger":e,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(l["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(l["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),ke({name:`firebase.function.${e}`,op:"http.request",kind:U.SERVER,attributes:l},async p=>{try{let u=await i.apply(this,c);return p.end(),u}catch(u){throw p.setStatus({code:2}),me(u,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),p.end(),await Zo(2e3),u}})};return o?n.call(this,o,s):n.call(this,s)}}}function uee(e,t,n,r){switch(lF(e,n),r){case"function":t(e,"onRequest",pn("http.request")),t(e,"onCall",pn("http.call"));break;case"firestore":t(e,"onDocumentCreated",pn("firestore.document.created")),t(e,"onDocumentUpdated",pn("firestore.document.updated")),t(e,"onDocumentDeleted",pn("firestore.document.deleted")),t(e,"onDocumentWritten",pn("firestore.document.written")),t(e,"onDocumentCreatedWithAuthContext",pn("firestore.document.created")),t(e,"onDocumentUpdatedWithAuthContext",pn("firestore.document.updated")),t(e,"onDocumentDeletedWithAuthContext",pn("firestore.document.deleted")),t(e,"onDocumentWrittenWithAuthContext",pn("firestore.document.written"));break;case"scheduler":t(e,"onSchedule",pn("scheduler.scheduled"));break;case"storage":t(e,"onObjectFinalized",pn("storage.object.finalized")),t(e,"onObjectArchived",pn("storage.object.archived")),t(e,"onObjectDeleted",pn("storage.object.deleted")),t(e,"onObjectMetadataUpdated",pn("storage.object.metadataUpdated"));break}return e}function lF(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 dee=[">=3.0.0 <5"],mee=[">=6.0.0 <7"],jg=class extends ae{constructor(t={}){super("@sentry/instrumentation-firebase",q,t)}init(){let t=[];return t.push(sF(dee,this._wrap,this._unwrap)),t.push(cF(mee,this._wrap,this._unwrap)),t}};var pF="Firebase",eN=de(pF,()=>new jg),fee=(()=>({name:pF,setupOnce(){eN()}})),tN=fee;function nN(){return[cE(),WE(),qE(),UT(),aT(),lT(),uT(),gT(),IT(),CT(),nf(),wT(),HT(),WT(),TA(),NA(),nT(),HA(),iT(),QA(),$A(),WA(),YA(),ZA(),KA(),LT(),tN()]}function uF(){return[mM,aE,FT,FE,Uf,GT,tT,BT,rT,sT,cT,pT,fT,OT,Uf,KE,TT,EA,AA,BA,qA,FA,VA,kT,eN,jA,XA,JA]}st();var rN=1e6,Zg=Symbol.for("opentelemetry.js.api.1");function dF(e){if(he.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[Zg];if(n&&!n.trace){if(Ye&&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[Zg]=void 0,!he.setGlobalTracerProvider(e))return!1;let r=t[Zg];if(r){let{propagation:i,context:o,...s}=n;t[Zg]={...s,...r}}return!0}return!1}function iN(e,t={}){e.getOptions().debug&&FS();let[n,r]=hee(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function gee(e={}){let{debug:t}=e;t&&g.enable(),sp(),_ee(e.integrations).forEach(n=>{n(),t&&g.log(`[Sentry] Preloaded ${n.id} instrumentation`)})}function _ee(e){let t=uF();return e?t.filter(n=>{let r=n.id;return e.some(i=>r===i||r.startsWith(`${i}.`))}):t}function hee(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||!!t.spanProcessors?.length))return bee(e);let r=new rv({sampler:new $l(e),resource:_m("node"),forceFlushTimeoutMillis:500,spanProcessors:[new Jl({timeout:yee(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});dF(r),pi.setGlobalPropagator(new Xa);let i=new ep;return pe.setGlobalContextManager(i),[r,i.getAsyncLocalStorageLookup()]}function bee(e){let t=new zl({resource:_m("node")});if(!dF(t))return Ye&&g.warn("Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered."),[void 0,void 0];ps("SentryTracerProvider"),pi.setGlobalPropagator(new Xa);let n=new ep;return pe.setGlobalContextManager(n),e.on("spanEnd",r=>{gm(r,{finalizeStatus:!0})}),rt(e)&&e.on("preprocessSpan",fm),e.on("preprocessEvent",r=>{r.type==="transaction"&&(r.contexts={...r.contexts,otel:{resource:t.resource?.attributes,...r.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function yee(e){if(e!=null){if(e>rN)return Ye&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${rN}`),rN;if(e<=0||Number.isNaN(e)){Ye&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function mF(){return Dm().filter(t=>t.name!=="Http"&&t.name!=="NodeFetch").concat(rE(),iE())}function fF(e){return[...mF(),...Ue(e)?nN():[]]}function See(e,t){if(nc()&&Ue(t)){let n=_T();if(n){let r=new Set(n.replacedOtelIntegrationNames);return[...e.filter(i=>!r.has(i.name)),...n.integrations]}}return e}function Eee(e={}){return gF(e,fF)}function gF(e={},t){Qo(e,"node");let n=nc()&&Ue(e)?_T():void 0;n&&n.register();let r=e.defaultIntegrations??t(e);if(n&&Array.isArray(r)&&r.length>0){let o=new Set(n.replacedOtelIntegrationNames);r=[...r.filter(s=>!o.has(s.name)),...n.integrations]}let i=QS({...e,defaultIntegrations:r});return i&&!e.skipOpenTelemetrySetup&&(iN(i,{spanProcessors:e.openTelemetrySpanProcessors}),Bm()),n&&n.detect(),i}function Tee(e={}){return gF(e,()=>[])}import*as Ote from"module";import"url";import{isMainThread as Cte,parentPort as xte}from"worker_threads";var Wp=[...jT,...ZT,...XT,...KT,...qT,...QT,...JT,...zT,...eI,...tI,...nI,...rI,...iI,...oI,...aI,...cI,...lI,...pI,...uI,...dI,...mI,...fI,...gI,..._I,...hI,...bI,...yI,...SI,...EI],k2e=[...uG,...mG,...gG,...hG,...yG,...EG,...IG,...NG,...RG,...CG,...PG,...LG,...GG,...DG,...WG,...jG,...XG,...qG,...zG,...tU,...rU,...oU,...aU,...lU,...uU,...mU,...gU,...hU,...yU];function Iee(e=[]){return[...ol([...Wp,...e].map(t=>t.module.name)),"@remix-run/node"]}var L2e=Iee();function Io(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hF=Aee;function Aee(e,t){let[n]=bF(e,"");for(let r of vee(t))if(Nee(r,n))return!0;return!1}function Nee(e,t){for(let[n,r]of e)if(!Cee(t,r,n))return!1;return!0}function _F(e){return e==="latest"&&(e=">=0"),e.match(/^([^\d+]*)(\d.*)$/)||[null,"","*.*.*"]}function vee(e){let t=[],n=[],r=e.trim().split(/\s+/);for(let i=0;i<r.length;i++){let o=r[i];if(o==="-")continue;if(o==="||"){t.push(n),n=[];continue}if(/^[<>=~v^]+$/.test(o)&&i+1<r.length){r[i+1]=o+r[i+1];continue}let s=_F(o),c=s[1]||"=";c.endsWith("v")&&(c=c.slice(0,-1));let[a,l]=bF(s[2],c);if(i+2<r.length&&r[i+1]==="-"){let p=_F(r[i+2]);r[i+2]="<="+(p[2].indexOf("-")===-1?p[2]+".*.*":p[2]),l=">="}if(l[0]==="~"){let p=s[2].split("-")[0].split(".").length;n.push([">=",a]),n.push(["<",p===1?yc(a,0):yc(a,1)])}else if(l[0]==="^"){let p=a[0]!==0?0:a[1]!==0?1:2;n.push([">=",a]),n.push(["<",p===0?yc(a,0):p===1?yc(a,1):yc(a,2)])}else n.push([l.replace("~","").replace("^",""),a])}return n.length&&t.push(n),t}function yc(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 Ree(e){return e==="x"||e==="X"||e==="*"||e==="latest"?-1:Number(e)}function Oee(e){return/^\d+$/.test(e)?Number(e):e}function Ao(e,t,n){return n===-1?e!=="<":e==="="?t===n:e===">"?t>n:e===">="?t>=n:e==="<"?t<n:e==="<="?t<=n:!1}function bF(e,t){e=e.split("+")[0];let[n,r]=e.split("-"),i=n.split(".").map(Ree).slice(0,3),o=Math.max(i.length-1,0);return t===">"?(t=">=",i.push(0,0,0),i[o]++):t===""?i.push(0,0,0):i.push(-1,-1,-1),r?[i.slice(0,3).concat(r.split(".").map(Oee)),t]:[i.slice(0,3),t]}function Cee(e,t,n){if(!Ao("=",e[0],t[0]))return Ao(n,e[0],t[0]);if(!Ao("=",e[1],t[1]))return Ao(n,e[1],t[1]);if(!Ao("=",e[2],t[2])||e.length===3&&t.length===3)return Ao(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(Ao(n,e[r]||"",t[r]||""))return!0;return!1}function sN(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 cN(e,t){return(function(n){if(Array.isArray(n))return n})(e)||(function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,s,c,a,l=[],p=!0,u=!1;try{if(c=(i=i.call(n)).next,r!==0)for(;!(p=(o=c.call(i)).done)&&(l.push(o.value),l.length!==r);p=!0);}catch(d){u=!0,s=d}finally{try{if(!p&&i.return!=null&&(a=i.return(),Object(a)!==a))return}finally{if(u)throw s}}return l}})(e,t)||IF(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 xee(e){return(function(t){if(Array.isArray(t))return sN(t)})(e)||(function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)})(e)||IF(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 Vp(e){return(Vp=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 IF(e,t){if(e){if(typeof e=="string")return sN(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)?sN(e,t):void 0}}function AF(e,t){return e(t={exports:{}},t.exports),t.exports}var Xg=AF((function(e,t){(function n(r){var i,o,s,c,a,l;function p(v){var N,P,D={};for(N in v)v.hasOwnProperty(N)&&(P=v[N],D[N]=typeof P=="object"&&P!==null?p(P):P);return D}function u(v,N){this.parent=v,this.key=N}function d(v,N,P,D){this.node=v,this.path=N,this.wrap=P,this.ref=D}function m(){}function _(v){return v!=null&&typeof v=="object"&&typeof v.type=="string"}function h(v,N){return(v===i.ObjectExpression||v===i.ObjectPattern)&&N==="properties"}function b(v,N){for(var P=v.length-1;P>=0;--P)if(v[P].node===N)return!0;return!1}function R(v,N){return new m().traverse(v,N)}function M(v,N){var P;return P=(function(D,I){var F,L,G,ce;for(L=D.length,G=0;L;)I(D[ce=G+(F=L>>>1)])?L=F:(G=ce+1,L-=F+1);return G})(N,(function(D){return D.range[0]>v.range[0]})),v.extendedRange=[v.range[0],v.range[1]],P!==N.length&&(v.extendedRange[1]=N[P].range[0]),(P-=1)>=0&&(v.extendedRange[0]=N[P].range[1]),v}return i={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},o={Break:c={},Skip:a={},Remove:l={}},u.prototype.replace=function(v){this.parent[this.key]=v},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 v,N,P,D,I;function F(L,G){if(Array.isArray(G))for(P=0,D=G.length;P<D;++P)L.push(G[P]);else L.push(G)}if(!this.__current.path)return null;for(I=[],v=2,N=this.__leavelist.length;v<N;++v)F(I,this.__leavelist[v].path);return F(I,this.__current.path),I},m.prototype.type=function(){return this.current().type||this.__current.wrap},m.prototype.parents=function(){var v,N,P;for(P=[],v=1,N=this.__leavelist.length;v<N;++v)P.push(this.__leavelist[v].node);return P},m.prototype.current=function(){return this.__current.node},m.prototype.__execute=function(v,N){var P,D;return D=void 0,P=this.__current,this.__current=N,this.__state=null,v&&(D=v.call(this,N.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=P,D},m.prototype.notify=function(v){this.__state=v},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(v,N){this.visitor=N,this.root=v,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,N.fallback==="iteration"?this.__fallback=Object.keys:typeof N.fallback=="function"&&(this.__fallback=N.fallback),this.__keys=s,N.keys&&(this.__keys=Object.assign(Object.create(this.__keys),N.keys))},m.prototype.traverse=function(v,N){var P,D,I,F,L,G,ce,ge,Ne,Te,Ce,qe;for(this.__initialize(v,N),qe={},P=this.__worklist,D=this.__leavelist,P.push(new d(v,null,null,null)),D.push(new d(null,null,null,null));P.length;)if((I=P.pop())!==qe){if(I.node){if(G=this.__execute(N.enter,I),this.__state===c||G===c)return;if(P.push(qe),D.push(I),this.__state===a||G===a)continue;if(L=(F=I.node).type||I.wrap,!(Te=this.__keys[L])){if(!this.__fallback)throw new Error("Unknown node type "+L+".");Te=this.__fallback(F)}for(ge=Te.length;(ge-=1)>=0;)if(Ce=F[ce=Te[ge]]){if(Array.isArray(Ce)){for(Ne=Ce.length;(Ne-=1)>=0;)if(Ce[Ne]&&!b(D,Ce[Ne])){if(h(L,Te[ge]))I=new d(Ce[Ne],[ce,Ne],"Property",null);else{if(!_(Ce[Ne]))continue;I=new d(Ce[Ne],[ce,Ne],null,null)}P.push(I)}}else if(_(Ce)){if(b(D,Ce))continue;P.push(new d(Ce,ce,null,null))}}}}else if(I=D.pop(),G=this.__execute(N.leave,I),this.__state===c||G===c)return},m.prototype.replace=function(v,N){var P,D,I,F,L,G,ce,ge,Ne,Te,Ce,qe,At;function yn(si){var ai,Oo,Co,vc;if(si.ref.remove()){for(Oo=si.ref.key,vc=si.ref.parent,ai=P.length;ai--;)if((Co=P[ai]).ref&&Co.ref.parent===vc){if(Co.ref.key<Oo)break;--Co.ref.key}}}for(this.__initialize(v,N),Ce={},P=this.__worklist,D=this.__leavelist,G=new d(v,null,null,new u(qe={root:v},"root")),P.push(G),D.push(G);P.length;)if((G=P.pop())!==Ce){if((L=this.__execute(N.enter,G))!==void 0&&L!==c&&L!==a&&L!==l&&(G.ref.replace(L),G.node=L),this.__state!==l&&L!==l||(yn(G),G.node=null),this.__state===c||L===c)return qe.root;if((I=G.node)&&(P.push(Ce),D.push(G),this.__state!==a&&L!==a)){if(F=I.type||G.wrap,!(Ne=this.__keys[F])){if(!this.__fallback)throw new Error("Unknown node type "+F+".");Ne=this.__fallback(I)}for(ce=Ne.length;(ce-=1)>=0;)if(Te=I[At=Ne[ce]])if(Array.isArray(Te)){for(ge=Te.length;(ge-=1)>=0;)if(Te[ge]){if(h(F,Ne[ce]))G=new d(Te[ge],[At,ge],"Property",new u(Te,ge));else{if(!_(Te[ge]))continue;G=new d(Te[ge],[At,ge],null,new u(Te,ge))}P.push(G)}}else _(Te)&&P.push(new d(Te,At,null,new u(I,At)))}}else if(G=D.pop(),(L=this.__execute(N.leave,G))!==void 0&&L!==c&&L!==a&&L!==l&&G.ref.replace(L),this.__state!==l&&L!==l||yn(G),this.__state===c||L===c)return qe.root;return qe.root},r.Syntax=i,r.traverse=R,r.replace=function(v,N){return new m().replace(v,N)},r.attachComments=function(v,N,P){var D,I,F,L,G=[];if(!v.range)throw new Error("attachComments needs range information");if(!P.length){if(N.length){for(F=0,I=N.length;F<I;F+=1)(D=p(N[F])).extendedRange=[0,v.range[0]],G.push(D);v.leadingComments=G}return v}for(F=0,I=N.length;F<I;F+=1)G.push(M(p(N[F]),P));return L=0,R(v,{enter:function(ce){for(var ge;L<G.length&&!((ge=G[L]).extendedRange[1]>ce.range[0]);)ge.extendedRange[1]===ce.range[0]?(ce.leadingComments||(ce.leadingComments=[]),ce.leadingComments.push(ge),G.splice(L,1)):L+=1;return L===G.length?o.Break:G[L].extendedRange[0]>ce.range[1]?o.Skip:void 0}}),L=0,R(v,{leave:function(ce){for(var ge;L<G.length&&(ge=G[L],!(ce.range[1]<ge.extendedRange[0]));)ce.range[1]===ge.extendedRange[0]?(ce.trailingComments||(ce.trailingComments=[]),ce.trailingComments.push(ge),G.splice(L,1)):L+=1;return L===G.length?o.Break:G[L].extendedRange[0]>ce.range[1]?o.Skip:void 0}}),v},r.VisitorKeys=s,r.VisitorOption=o,r.Controller=m,r.cloneEnvironment=function(){return n({})},r})(t)})),Pee=AF((function(e){e.exports&&(e.exports=(function(){function t(n,r,i,o){this.message=n,this.expected=r,this.found=i,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)}return(function(n,r){function i(){this.constructor=n}i.prototype=r.prototype,n.prototype=new i})(t,Error),t.buildMessage=function(n,r){var i={literal:function(a){return'"'+s(a.text)+'"'},class:function(a){var l,p="";for(l=0;l<a.parts.length;l++)p+=a.parts[l]instanceof Array?c(a.parts[l][0])+"-"+c(a.parts[l][1]):c(a.parts[l]);return"["+(a.inverted?"^":"")+p+"]"},any:function(a){return"any character"},end:function(a){return"end of input"},other:function(a){return a.description}};function o(a){return a.charCodeAt(0).toString(16).toUpperCase()}function s(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(l){return"\\x0"+o(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+o(l)}))}function c(a){return a.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(l){return"\\x0"+o(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+o(l)}))}return"Expected "+(function(a){var l,p,u,d=new Array(a.length);for(l=0;l<a.length;l++)d[l]=(u=a[l],i[u.type](u));if(d.sort(),d.length>0){for(l=1,p=1;l<d.length;l++)d[l-1]!==d[l]&&(d[p]=d[l],p++);d.length=p}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}})(n)+" but "+(function(a){return a?'"'+s(a)+'"':"end of input"})(r)+" found."},{SyntaxError:t,parse:function(n,r){r=r!==void 0?r:{};var i,o,s,c,a={},l={start:jN},p=jN,u=Xe(" ",!1),d=/^[^ [\],():#!=><~+.]/,m=Sr([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),_=Xe(">",!1),h=Xe("~",!1),b=Xe("+",!1),R=Xe(",",!1),M=function(T,W){return[T].concat(W.map((function(Y){return Y[3]})))},v=Xe("!",!1),N=Xe("*",!1),P=Xe("#",!1),D=Xe("[",!1),I=Xe("]",!1),F=/^[><!]/,L=Sr([">","<","!"],!1,!1),G=Xe("=",!1),ce=function(T){return(T||"")+"="},ge=/^[><]/,Ne=Sr([">","<"],!1,!1),Te=Xe(".",!1),Ce=function(T,W,Y){return{type:"attribute",name:T,operator:W,value:Y}},qe=Xe('"',!1),At=/^[^\\"]/,yn=Sr(["\\",'"'],!0,!1),si=Xe("\\",!1),ai={type:"any"},Oo=function(T,W){return T+W},Co=function(T){return{type:"literal",value:(W=T.join(""),W.replace(/\\(.)/g,(function(Y,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 W},vc=Xe("'",!1),PN=/^[^\\']/,kN=Sr(["\\","'"],!0,!1),Ui=/^[0-9]/,Di=Sr([["0","9"]],!1,!1),d2=Xe("type(",!1),LN=/^[^ )]/,MN=Sr([" ",")"],!0,!1),xo=Xe(")",!1),wN=/^[imsu]/,GN=Sr(["i","m","s","u"],!1,!1),UN=Xe("/",!1),DN=/^[^\]\\]/,BN=Sr(["]","\\"],!0,!1),HN=/^[^\/\\[]/,FN=Sr(["/","\\","["],!0,!1),m2=Xe(":not(",!1),f2=Xe(":matches(",!1),WN=function(T){return{type:"matches",selectors:T}},g2=Xe(":is(",!1),_2=Xe(":has(",!1),h2=Xe(":first-child",!1),b2=Xe(":last-child",!1),y2=Xe(":nth-child(",!1),S2=Xe(":nth-last-child(",!1),E2=Xe(":",!1),f=0,Zp=[{line:1,column:1}],yr=0,l_=[],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 Xe(T,W){return{type:"literal",text:T,ignoreCase:W}}function Sr(T,W,Y){return{type:"class",parts:T,inverted:W,ignoreCase:Y}}function VN(T){var W,Y=Zp[T];if(Y)return Y;for(W=T-1;!Zp[W];)W--;for(Y={line:(Y=Zp[W]).line,column:Y.column};W<T;)n.charCodeAt(W)===10?(Y.line++,Y.column=1):Y.column++,W++;return Zp[T]=Y,Y}function YN(T,W){var Y=VN(T),y=VN(W);return{start:{offset:T,line:Y.line,column:Y.column},end:{offset:W,line:y.line,column:y.column}}}function j(T){f<yr||(f>yr&&(yr=f,l_=[]),l_.push(T))}function jN(){var T,W,Y,y,O=36*f+0,K=z[O];return K?(f=K.nextPos,K.result):(T=f,(W=Oe())!==a&&(Y=Xp())!==a&&Oe()!==a?T=W=(y=Y).length===1?y[0]:{type:"matches",selectors:y}:(f=T,T=a),T===a&&(T=f,(W=Oe())!==a&&(W=void 0),T=W),z[O]={nextPos:f,result:T},T)}function Oe(){var T,W,Y=36*f+1,y=z[Y];if(y)return f=y.nextPos,y.result;for(T=[],n.charCodeAt(f)===32?(W=" ",f++):(W=a,j(u));W!==a;)T.push(W),n.charCodeAt(f)===32?(W=" ",f++):(W=a,j(u));return z[Y]={nextPos:f,result:T},T}function ci(){var T,W,Y,y=36*f+2,O=z[y];if(O)return f=O.nextPos,O.result;if(W=[],d.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(m)),Y!==a)for(;Y!==a;)W.push(Y),d.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(m));else W=a;return W!==a&&(W=W.join("")),T=W,z[y]={nextPos:f,result:T},T}function p_(){var T,W,Y,y=36*f+3,O=z[y];return O?(f=O.nextPos,O.result):(T=f,(W=Oe())!==a?(n.charCodeAt(f)===62?(Y=">",f++):(Y=a,j(_)),Y!==a&&Oe()!==a?T=W="child":(f=T,T=a)):(f=T,T=a),T===a&&(T=f,(W=Oe())!==a?(n.charCodeAt(f)===126?(Y="~",f++):(Y=a,j(h)),Y!==a&&Oe()!==a?T=W="sibling":(f=T,T=a)):(f=T,T=a),T===a&&(T=f,(W=Oe())!==a?(n.charCodeAt(f)===43?(Y="+",f++):(Y=a,j(b)),Y!==a&&Oe()!==a?T=W="adjacent":(f=T,T=a)):(f=T,T=a),T===a&&(T=f,n.charCodeAt(f)===32?(W=" ",f++):(W=a,j(u)),W!==a&&(Y=Oe())!==a?T=W="descendant":(f=T,T=a)))),z[y]={nextPos:f,result:T},T)}function Xp(){var T,W,Y,y,O,K,X,_e,be=36*f+5,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(T=f,(W=Kp())!==a){for(Y=[],y=f,(O=Oe())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(R)),K!==a&&(X=Oe())!==a&&(_e=Kp())!==a?y=O=[O,K,X,_e]:(f=y,y=a)):(f=y,y=a);y!==a;)Y.push(y),y=f,(O=Oe())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(R)),K!==a&&(X=Oe())!==a&&(_e=Kp())!==a?y=O=[O,K,X,_e]:(f=y,y=a)):(f=y,y=a);Y!==a?T=W=M(W,Y):(f=T,T=a)}else f=T,T=a;return z[be]={nextPos:f,result:T},T}function u_(){var T,W,Y,y,O,K=36*f+6,X=z[K];return X?(f=X.nextPos,X.result):(T=f,(W=p_())===a&&(W=null),W!==a&&(Y=Kp())!==a?(O=Y,T=W=(y=W)?{type:y,left:{type:"exactNode"},right:O}:O):(f=T,T=a),z[K]={nextPos:f,result:T},T)}function Kp(){var T,W,Y,y,O,K,X,_e=36*f+7,be=z[_e];if(be)return f=be.nextPos,be.result;if(T=f,(W=d_())!==a){for(Y=[],y=f,(O=p_())!==a&&(K=d_())!==a?y=O=[O,K]:(f=y,y=a);y!==a;)Y.push(y),y=f,(O=p_())!==a&&(K=d_())!==a?y=O=[O,K]:(f=y,y=a);Y!==a?(X=W,T=W=Y.reduce((function(ye,ot){return{type:ot[0],left:ye,right:ot[1]}}),X)):(f=T,T=a)}else f=T,T=a;return z[_e]={nextPos:f,result:T},T}function d_(){var T,W,Y,y,O,K,X,_e=36*f+8,be=z[_e];if(be)return f=be.nextPos,be.result;if(T=f,n.charCodeAt(f)===33?(W="!",f++):(W=a,j(v)),W===a&&(W=null),W!==a){if(Y=[],(y=ZN())!==a)for(;y!==a;)Y.push(y),y=ZN();else Y=a;Y!==a?(O=W,X=(K=Y).length===1?K[0]:{type:"compound",selectors:K},O&&(X.subject=!0),T=W=X):(f=T,T=a)}else f=T,T=a;return z[_e]={nextPos:f,result:T},T}function ZN(){var T,W=36*f+9,Y=z[W];return Y?(f=Y.nextPos,Y.result):((T=(function(){var y,O,K=36*f+10,X=z[K];return X?(f=X.nextPos,X.result):(n.charCodeAt(f)===42?(O="*",f++):(O=a,j(N)),O!==a&&(O={type:"wildcard",value:O}),y=O,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X=36*f+11,_e=z[X];return _e?(f=_e.nextPos,_e.result):(y=f,n.charCodeAt(f)===35?(O="#",f++):(O=a,j(P)),O===a&&(O=null),O!==a&&(K=ci())!==a?y=O={type:"identifier",value:K}:(f=y,y=a),z[X]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e=36*f+12,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.charCodeAt(f)===91?(O="[",f++):(O=a,j(D)),O!==a&&Oe()!==a&&(K=(function(){var ye,ot,kn,je,qn=36*f+16,en=z[qn];return en?(f=en.nextPos,en.result):(ye=f,(ot=m_())!==a&&Oe()!==a&&(kn=(function(){var Z,le,Ee,V=36*f+14,Ie=z[V];return Ie?(f=Ie.nextPos,Ie.result):(Z=f,n.charCodeAt(f)===33?(le="!",f++):(le=a,j(v)),le===a&&(le=null),le!==a?(n.charCodeAt(f)===61?(Ee="=",f++):(Ee=a,j(G)),Ee!==a?(le=ce(le),Z=le):(f=Z,Z=a)):(f=Z,Z=a),z[V]={nextPos:f,result:Z},Z)})())!==a&&Oe()!==a?((je=(function(){var Z,le,Ee,V,Ie,Qe=36*f+20,Ln=z[Qe];if(Ln)return f=Ln.nextPos,Ln.result;if(Z=f,n.substr(f,5)==="type("?(le="type(",f+=5):(le=a,j(d2)),le!==a)if(Oe()!==a){if(Ee=[],LN.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(MN)),V!==a)for(;V!==a;)Ee.push(V),LN.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(MN));else Ee=a;Ee!==a&&(V=Oe())!==a?(n.charCodeAt(f)===41?(Ie=")",f++):(Ie=a,j(xo)),Ie!==a?(le={type:"type",value:Ee.join("")},Z=le):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;else f=Z,Z=a;return z[Qe]={nextPos:f,result:Z},Z})())===a&&(je=(function(){var Z,le,Ee,V,Ie,Qe,Ln=36*f+22,Er=z[Ln];if(Er)return f=Er.nextPos,Er.result;if(Z=f,n.charCodeAt(f)===47?(le="/",f++):(le=a,j(UN)),le!==a){if(Ee=[],(V=XN())===a&&(V=qp())===a&&(V=KN()),V!==a)for(;V!==a;)Ee.push(V),(V=XN())===a&&(V=qp())===a&&(V=KN());else Ee=a;Ee!==a?(n.charCodeAt(f)===47?(V="/",f++):(V=a,j(UN)),V!==a?((Ie=(function(){var li,Po,JN=36*f+21,f_=z[JN];if(f_)return f=f_.nextPos,f_.result;if(li=[],wN.test(n.charAt(f))?(Po=n.charAt(f),f++):(Po=a,j(GN)),Po!==a)for(;Po!==a;)li.push(Po),wN.test(n.charAt(f))?(Po=n.charAt(f),f++):(Po=a,j(GN));else li=a;return z[JN]={nextPos:f,result:li},li})())===a&&(Ie=null),Ie!==a?(Qe=Ie,le={type:"regexp",value:new RegExp(Ee.join(""),Qe?Qe.join(""):"")},Z=le):(f=Z,Z=a)):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;return z[Ln]={nextPos:f,result:Z},Z})()),je!==a?(ot=Ce(ot,kn,je),ye=ot):(f=ye,ye=a)):(f=ye,ye=a),ye===a&&(ye=f,(ot=m_())!==a&&Oe()!==a&&(kn=(function(){var Z,le,Ee,V=36*f+13,Ie=z[V];return Ie?(f=Ie.nextPos,Ie.result):(Z=f,F.test(n.charAt(f))?(le=n.charAt(f),f++):(le=a,j(L)),le===a&&(le=null),le!==a?(n.charCodeAt(f)===61?(Ee="=",f++):(Ee=a,j(G)),Ee!==a?(le=ce(le),Z=le):(f=Z,Z=a)):(f=Z,Z=a),Z===a&&(ge.test(n.charAt(f))?(Z=n.charAt(f),f++):(Z=a,j(Ne))),z[V]={nextPos:f,result:Z},Z)})())!==a&&Oe()!==a?((je=(function(){var Z,le,Ee,V,Ie,Qe,Ln=36*f+17,Er=z[Ln];if(Er)return f=Er.nextPos,Er.result;if(Z=f,n.charCodeAt(f)===34?(le='"',f++):(le=a,j(qe)),le!==a){for(Ee=[],At.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(yn)),V===a&&(V=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(si)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(ai)),Qe!==a?(Ie=Oo(Ie,Qe),V=Ie):(f=V,V=a)):(f=V,V=a));V!==a;)Ee.push(V),At.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(yn)),V===a&&(V=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(si)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(ai)),Qe!==a?(Ie=Oo(Ie,Qe),V=Ie):(f=V,V=a)):(f=V,V=a));Ee!==a?(n.charCodeAt(f)===34?(V='"',f++):(V=a,j(qe)),V!==a?(le=Co(Ee),Z=le):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;if(Z===a)if(Z=f,n.charCodeAt(f)===39?(le="'",f++):(le=a,j(vc)),le!==a){for(Ee=[],PN.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(kN)),V===a&&(V=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(si)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(ai)),Qe!==a?(Ie=Oo(Ie,Qe),V=Ie):(f=V,V=a)):(f=V,V=a));V!==a;)Ee.push(V),PN.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(kN)),V===a&&(V=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(si)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(ai)),Qe!==a?(Ie=Oo(Ie,Qe),V=Ie):(f=V,V=a)):(f=V,V=a));Ee!==a?(n.charCodeAt(f)===39?(V="'",f++):(V=a,j(vc)),V!==a?(le=Co(Ee),Z=le):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;return z[Ln]={nextPos:f,result:Z},Z})())===a&&(je=(function(){var Z,le,Ee,V,Ie,Qe,Ln,Er=36*f+18,li=z[Er];if(li)return f=li.nextPos,li.result;for(Z=f,le=f,Ee=[],Ui.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(Di));V!==a;)Ee.push(V),Ui.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(Di));if(Ee!==a?(n.charCodeAt(f)===46?(V=".",f++):(V=a,j(Te)),V!==a?le=Ee=[Ee,V]:(f=le,le=a)):(f=le,le=a),le===a&&(le=null),le!==a){if(Ee=[],Ui.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(Di)),V!==a)for(;V!==a;)Ee.push(V),Ui.test(n.charAt(f))?(V=n.charAt(f),f++):(V=a,j(Di));else Ee=a;Ee!==a?(Qe=Ee,Ln=(Ie=le)?[].concat.apply([],Ie).join(""):"",le={type:"literal",value:parseFloat(Ln+Qe.join(""))},Z=le):(f=Z,Z=a)}else f=Z,Z=a;return z[Er]={nextPos:f,result:Z},Z})())===a&&(je=(function(){var Z,le,Ee=36*f+19,V=z[Ee];return V?(f=V.nextPos,V.result):((le=ci())!==a&&(le={type:"literal",value:le}),Z=le,z[Ee]={nextPos:f,result:Z},Z)})()),je!==a?(ot=Ce(ot,kn,je),ye=ot):(f=ye,ye=a)):(f=ye,ye=a),ye===a&&(ye=f,(ot=m_())!==a&&(ot={type:"attribute",name:ot}),ye=ot)),z[qn]={nextPos:f,result:ye},ye)})())!==a&&Oe()!==a?(n.charCodeAt(f)===93?(X="]",f++):(X=a,j(I)),X!==a?y=O=K:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e,be,ye,ot,kn=36*f+26,je=z[kn];if(je)return f=je.nextPos,je.result;if(y=f,n.charCodeAt(f)===46?(O=".",f++):(O=a,j(Te)),O!==a)if((K=ci())!==a){for(X=[],_e=f,n.charCodeAt(f)===46?(be=".",f++):(be=a,j(Te)),be!==a&&(ye=ci())!==a?_e=be=[be,ye]:(f=_e,_e=a);_e!==a;)X.push(_e),_e=f,n.charCodeAt(f)===46?(be=".",f++):(be=a,j(Te)),be!==a&&(ye=ci())!==a?_e=be=[be,ye]:(f=_e,_e=a);X!==a?(ot=K,O={type:"field",name:X.reduce((function(qn,en){return qn+en[0]+en[1]}),ot)},y=O):(f=y,y=a)}else f=y,y=a;else f=y,y=a;return z[kn]={nextPos:f,result:y},y})())===a&&(T=(function(){var y,O,K,X,_e=36*f+27,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,5)===":not("?(O=":not(",f+=5):(O=a,j(m2)),O!==a&&Oe()!==a&&(K=Xp())!==a&&Oe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(xo)),X!==a?y=O={type:"not",selectors:K}:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e=36*f+28,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,9)===":matches("?(O=":matches(",f+=9):(O=a,j(f2)),O!==a&&Oe()!==a&&(K=Xp())!==a&&Oe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(xo)),X!==a?(O=WN(K),y=O):(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e=36*f+29,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,4)===":is("?(O=":is(",f+=4):(O=a,j(g2)),O!==a&&Oe()!==a&&(K=Xp())!==a&&Oe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(xo)),X!==a?(O=WN(K),y=O):(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e=36*f+30,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,5)===":has("?(O=":has(",f+=5):(O=a,j(_2)),O!==a&&Oe()!==a&&(K=(function(){var ye,ot,kn,je,qn,en,Z,le,Ee=36*f+4,V=z[Ee];if(V)return f=V.nextPos,V.result;if(ye=f,(ot=u_())!==a){for(kn=[],je=f,(qn=Oe())!==a?(n.charCodeAt(f)===44?(en=",",f++):(en=a,j(R)),en!==a&&(Z=Oe())!==a&&(le=u_())!==a?je=qn=[qn,en,Z,le]:(f=je,je=a)):(f=je,je=a);je!==a;)kn.push(je),je=f,(qn=Oe())!==a?(n.charCodeAt(f)===44?(en=",",f++):(en=a,j(R)),en!==a&&(Z=Oe())!==a&&(le=u_())!==a?je=qn=[qn,en,Z,le]:(f=je,je=a)):(f=je,je=a);kn!==a?ye=ot=M(ot,kn):(f=ye,ye=a)}else f=ye,ye=a;return z[Ee]={nextPos:f,result:ye},ye})())!==a&&Oe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(xo)),X!==a?y=O={type:"has",selectors:K}:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K=36*f+31,X=z[K];return X?(f=X.nextPos,X.result):(n.substr(f,12)===":first-child"?(O=":first-child",f+=12):(O=a,j(h2)),O!==a&&(O=qN(1)),y=O,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K=36*f+32,X=z[K];return X?(f=X.nextPos,X.result):(n.substr(f,11)===":last-child"?(O=":last-child",f+=11):(O=a,j(b2)),O!==a&&(O=QN(1)),y=O,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e,be=36*f+33,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(y=f,n.substr(f,11)===":nth-child("?(O=":nth-child(",f+=11):(O=a,j(y2)),O!==a)if(Oe()!==a){if(K=[],Ui.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Di)),X!==a)for(;X!==a;)K.push(X),Ui.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Di));else K=a;K!==a&&(X=Oe())!==a?(n.charCodeAt(f)===41?(_e=")",f++):(_e=a,j(xo)),_e!==a?(O=qN(parseInt(K.join(""),10)),y=O):(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&&(T=(function(){var y,O,K,X,_e,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("?(O=":nth-last-child(",f+=16):(O=a,j(S2)),O!==a)if(Oe()!==a){if(K=[],Ui.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Di)),X!==a)for(;X!==a;)K.push(X),Ui.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Di));else K=a;K!==a&&(X=Oe())!==a?(n.charCodeAt(f)===41?(_e=")",f++):(_e=a,j(xo)),_e!==a?(O=QN(parseInt(K.join(""),10)),y=O):(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&&(T=(function(){var y,O,K,X=36*f+35,_e=z[X];return _e?(f=_e.nextPos,_e.result):(y=f,n.charCodeAt(f)===58?(O=":",f++):(O=a,j(E2)),O!==a&&(K=ci())!==a?y=O={type:"class",name:K}:(f=y,y=a),z[X]={nextPos:f,result:y},y)})()),z[W]={nextPos:f,result:T},T)}function m_(){var T,W,Y,y,O,K,X,_e,be=36*f+15,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(T=f,(W=ci())!==a){for(Y=[],y=f,n.charCodeAt(f)===46?(O=".",f++):(O=a,j(Te)),O!==a&&(K=ci())!==a?y=O=[O,K]:(f=y,y=a);y!==a;)Y.push(y),y=f,n.charCodeAt(f)===46?(O=".",f++):(O=a,j(Te)),O!==a&&(K=ci())!==a?y=O=[O,K]:(f=y,y=a);Y!==a?(X=W,_e=Y,T=W=[].concat.apply([X],_e).join("")):(f=T,T=a)}else f=T,T=a;return z[be]={nextPos:f,result:T},T}function XN(){var T,W,Y,y,O=36*f+23,K=z[O];if(K)return f=K.nextPos,K.result;if(T=f,n.charCodeAt(f)===91?(W="[",f++):(W=a,j(D)),W!==a){if(Y=[],DN.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(BN)),y===a&&(y=qp()),y!==a)for(;y!==a;)Y.push(y),DN.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(BN)),y===a&&(y=qp());else Y=a;Y!==a?(n.charCodeAt(f)===93?(y="]",f++):(y=a,j(I)),y!==a?T=W="["+Y.join("")+"]":(f=T,T=a)):(f=T,T=a)}else f=T,T=a;return z[O]={nextPos:f,result:T},T}function qp(){var T,W,Y,y=36*f+24,O=z[y];return O?(f=O.nextPos,O.result):(T=f,n.charCodeAt(f)===92?(W="\\",f++):(W=a,j(si)),W!==a?(n.length>f?(Y=n.charAt(f),f++):(Y=a,j(ai)),Y!==a?T=W="\\"+Y:(f=T,T=a)):(f=T,T=a),z[y]={nextPos:f,result:T},T)}function KN(){var T,W,Y,y=36*f+25,O=z[y];if(O)return f=O.nextPos,O.result;if(W=[],HN.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(FN)),Y!==a)for(;Y!==a;)W.push(Y),HN.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(FN));else W=a;return W!==a&&(W=W.join("")),T=W,z[y]={nextPos:f,result:T},T}function qN(T){return{type:"nth-child",index:{type:"literal",value:T}}}function QN(T){return{type:"nth-last-child",index:{type:"literal",value:T}}}if((i=p())!==a&&f===n.length)return i;throw i!==a&&f<n.length&&j({type:"end"}),o=l_,s=yr<n.length?n.charAt(yr):null,c=yr<n.length?YN(yr,yr+1):YN(yr,yr),new t(t.buildMessage(o,s),o,s,c)}}})())}));function br(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var oN=typeof WeakMap=="function"?new WeakMap:null;function Wt(e){if(e==null)return function(){return!0};if(oN!=null){var t=oN.get(e);return t!=null||(t=yF(e),oN.set(e,t)),t}return yF(e)}function yF(e){switch(e.type){case"wildcard":return function(){return!0};case"identifier":var t=e.value.toLowerCase();return function(I,F,L){var G=L&&L.nodeTypeKey||"type";return t===I[G].toLowerCase()};case"exactNode":return function(I,F){return F.length===0};case"field":var n=e.name.split(".");return function(I,F){return(function L(G,ce,ge,Ne){for(var Te=ce,Ce=Ne;Ce<ge.length;++Ce){if(Te==null)return!1;var qe=Te[ge[Ce]];if(Array.isArray(qe)){for(var At=0;At<qe.length;++At)if(L(G,qe[At],ge,Ce+1))return!0;return!1}Te=qe}return G===Te})(I,F[n.length-1],n,0)};case"matches":var r=e.selectors.map(Wt);return function(I,F,L){for(var G=0;G<r.length;++G)if(r[G](I,F,L))return!0;return!1};case"compound":var i=e.selectors.map(Wt);return function(I,F,L){for(var G=0;G<i.length;++G)if(!i[G](I,F,L))return!1;return!0};case"not":var o=e.selectors.map(Wt);return function(I,F,L){for(var G=0;G<o.length;++G)if(o[G](I,F,L))return!1;return!0};case"has":var s=e.selectors.map(Wt);return function(I,F,L){var G=!1,ce=[];return Xg.traverse(I,{enter:function(ge,Ne){Ne!=null&&ce.unshift(Ne);for(var Te=0;Te<s.length;++Te)if(s[Te](ge,ce,L))return G=!0,void this.break()},leave:function(){ce.shift()},keys:L&&L.visitorKeys,fallback:L&&L.fallback||"iteration"}),G};case"child":var c=Wt(e.left),a=Wt(e.right);return function(I,F,L){return!!(F.length>0&&a(I,F,L))&&c(F[0],F.slice(1),L)};case"descendant":var l=Wt(e.left),p=Wt(e.right);return function(I,F,L){if(p(I,F,L)){for(var G=0,ce=F.length;G<ce;++G)if(l(F[G],F.slice(G+1),L))return!0}return!1};case"attribute":var u=e.name.split(".");switch(e.operator){case void 0:return function(I){return br(I,u)!=null};case"=":switch(e.value.type){case"regexp":return function(I){var F=br(I,u);return typeof F=="string"&&e.value.value.test(F)};case"literal":var d="".concat(e.value.value);return function(I){return d==="".concat(br(I,u))};case"type":return function(I){return e.value.value===Vp(br(I,u))}}throw new Error("Unknown selector value type: ".concat(e.value.type));case"!=":switch(e.value.type){case"regexp":return function(I){return!e.value.value.test(br(I,u))};case"literal":var m="".concat(e.value.value);return function(I){return m!=="".concat(br(I,u))};case"type":return function(I){return e.value.value!==Vp(br(I,u))}}throw new Error("Unknown selector value type: ".concat(e.value.type));case"<=":return function(I){return br(I,u)<=e.value.value};case"<":return function(I){return br(I,u)<e.value.value};case">":return function(I){return br(I,u)>e.value.value};case">=":return function(I){return br(I,u)>=e.value.value}}throw new Error("Unknown operator: ".concat(e.operator));case"sibling":var _=Wt(e.left),h=Wt(e.right);return function(I,F,L){return h(I,F,L)&&SF(I,_,F,"LEFT_SIDE",L)||e.left.subject&&_(I,F,L)&&SF(I,h,F,"RIGHT_SIDE",L)};case"adjacent":var b=Wt(e.left),R=Wt(e.right);return function(I,F,L){return R(I,F,L)&&EF(I,b,F,"LEFT_SIDE",L)||e.right.subject&&b(I,F,L)&&EF(I,R,F,"RIGHT_SIDE",L)};case"nth-child":var M=e.index.value,v=Wt(e.right);return function(I,F,L){return v(I,F,L)&&TF(I,F,M,L)};case"nth-last-child":var N=-e.index.value,P=Wt(e.right);return function(I,F,L){return P(I,F,L)&&TF(I,F,N,L)};case"class":var D=e.name.toLowerCase();return function(I,F,L){if(L&&L.matchClass)return L.matchClass(e.name,I,F);if(L&&L.nodeTypeKey)return!1;switch(D){case"statement":if(I.type.slice(-9)==="Statement")return!0;case"declaration":return I.type.slice(-11)==="Declaration";case"pattern":if(I.type.slice(-7)==="Pattern")return!0;case"expression":return I.type.slice(-10)==="Expression"||I.type.slice(-7)==="Literal"||I.type==="Identifier"&&(F.length===0||F[0].type!=="MetaProperty")||I.type==="MetaProperty";case"function":return I.type==="FunctionDeclaration"||I.type==="FunctionExpression"||I.type==="ArrowFunctionExpression"}throw new Error("Unknown class name: ".concat(e.name))}}throw new Error("Unknown selector type: ".concat(e.type))}function lN(e,t){var n=t&&t.nodeTypeKey||"type",r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:Xg.VisitorKeys[r]?Xg.VisitorKeys[r]:t&&typeof t.fallback=="function"?t.fallback(e):Object.keys(e).filter((function(i){return i!==n}))}function aN(e,t){var n=t&&t.nodeTypeKey||"type";return e!==null&&Vp(e)==="object"&&typeof e[n]=="string"}function SF(e,t,n,r,i){var o=cN(n,1)[0];if(!o)return!1;for(var s=lN(o,i),c=0;c<s.length;++c){var a=o[s[c]];if(Array.isArray(a)){var l=a.indexOf(e);if(l<0)continue;var p=void 0,u=void 0;r==="LEFT_SIDE"?(p=0,u=l):(p=l+1,u=a.length);for(var d=p;d<u;++d)if(aN(a[d],i)&&t(a[d],n,i))return!0}}return!1}function EF(e,t,n,r,i){var o=cN(n,1)[0];if(!o)return!1;for(var s=lN(o,i),c=0;c<s.length;++c){var a=o[s[c]];if(Array.isArray(a)){var l=a.indexOf(e);if(l<0)continue;if(r==="LEFT_SIDE"&&l>0&&aN(a[l-1],i)&&t(a[l-1],n,i)||r==="RIGHT_SIDE"&&l<a.length-1&&aN(a[l+1],i)&&t(a[l+1],n,i))return!0}}return!1}function TF(e,t,n,r){if(n===0)return!1;var i=cN(t,1)[0];if(!i)return!1;for(var o=lN(i,r),s=0;s<o.length;++s){var c=i[o[s]];if(Array.isArray(c)){var a=n<0?c.length+n:n-1;if(a>=0&&a<c.length&&c[a]===e)return!0}}return!1}function NF(e,t,n,r){if(t){var i=[],o=Wt(t),s=(function c(a,l){if(a==null||Vp(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,xee(c(_,m==="left"?_:l)))}return p})(t).map(Wt);Xg.traverse(e,{enter:function(c,a){if(a!=null&&i.unshift(a),o(c,i,r))if(s.length)for(var l=0,p=s.length;l<p;++l){s[l](c,i,r)&&n(c,a,i);for(var u=0,d=i.length;u<d;++u){var m=i.slice(u+1);s[l](i[u],m,r)&&n(i[u],a,m)}}else n(c,a,i)},leave:function(){i.shift()},keys:r&&r.visitorKeys,fallback:r&&r.fallback||"iteration"})}}function vF(e,t,n){var r=[];return NF(e,t,(function(i){r.push(i)}),n),r}function RF(e){return Pee.parse(e)}function ii(e,t,n){return vF(e,RF(t),n)}ii.parse=RF,ii.match=vF,ii.traverse=NF,ii.matches=function(e,t,n,r){return!t||!!e&&(n||(n=[]),Wt(t)(e,n,r))},ii.query=ii;var Kg={};var OF={};var pN={exports:{}};var uN=ii,{parse:un}=Kg,CF=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name==="tr_ch_apm_tracingChannel",kee=/[^\w]/g,Ns=e=>`tr_ch_apm$${e.replace(kee,"_")}`,dN=pN.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(CF))return;let r={module:t==="esm"},i=n.body.findIndex(a=>a.directive==="use strict"),o=t==="esm"?`import tr_ch_apm_dc from "${e}"`:`const tr_ch_apm_dc = require("${e}")`;n.body.splice(i+1,0,un(o,r).body[0],un("const { tracingChannel: tr_ch_apm_tracingChannel } = tr_ch_apm_dc",r).body[0],un(`const tr_ch_apm_hasSubscribers = ch => ch.start.hasSubscribers
38
+ || ch.end.hasSubscribers
39
+ || ch.asyncStart.hasSubscribers
40
+ || ch.asyncEnd.hasSubscribers
41
+ || ch.error.hasSubscribers`,r).body[0])},tracingChannelDeclaration(e,t){let{channelName:n,module:{name:r}}=e,i=Ns(n);if(t.body.some(c=>c.declarations?.[0]?.id?.name===i))return;dN.tracingChannelImport(e,t);let o=t.body.findIndex(CF),s=`
42
+ const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
43
+ `;t.body.splice(o+1,0,un(s).body[0])},traceCallback:qg,tracePromise:qg,traceSync:qg,traceAuto:qg};function Lee(e){return[...(e||[]).filter(r=>r.type!=="RestElement"&&r.type!=="AssignmentPattern").map((r,i)=>({type:"Identifier",name:`__apm$arg${i}`})),{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}]}function qg(e,t,n,r){let i=r[r.length-1];t.type==="ClassDeclaration"||t.type==="ClassExpression"?wee(e,t,i):Mee(e,t,i)}function Mee(e,t,n){dN.tracingChannelDeclaration(e,n);let{functionQuery:{methodName:r,privateMethodName:i,functionName:o,expressionName:s,propertyName:c}}=e,l=r==="constructor"||!r&&!i&&!o&&!s&&!c?"ArrowFunctionExpression":t.type,p=t.params;t.body=xF(e,{type:l,params:p,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=Lee(p),t.generator=!1,t.async=!1,PF(e,t)}function wee(e,t,n){let{functionQuery:r,operator:i}=e,{methodName:o}=r;if(!o)return;let s=t.body;if(s.body.some(({key:p})=>p.name===o))return;let c=s.body.find(({kind:p})=>p==="constructor");dN.tracingChannelDeclaration(e,n),c||(c=un(t.superClass?"class A extends Object { constructor (...args) { super(...args) } }":"class A { constructor () {} }").body[0].body.body[0],s.body.unshift(c));let a=un(`
44
+ const __apm$${o} = this["${o}"]
45
+ this["${o}"] = function () {}
46
+ if (typeof __apm$${o} === 'function') {
47
+ Object.defineProperty(this["${o}"], 'length', {
48
+ value: __apm$${o}.length,
49
+ configurable: true
50
+ })
51
+ }
52
+ `).body,l=a[1].expression.right;l.params=[{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}],l.async=i==="tracePromise",l.body=xF(e,{type:"Identifier",name:`__apm$${o}`},n),PF(e,l),c.value.body.body.push(...a)}function xF(e,t,n){let{operator:r,moduleVersion:i}=e,{returnKind:o}=e.functionQuery,s=o?Bee(e,o,n):"",c;r==="traceCallback"&&(c=kF(e,t,s)),r==="tracePromise"&&(c=LF(e,t,s)),r==="traceSync"&&(c=Uee(e,t,s)),r==="traceAuto"&&(c=Gee(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=un(t.type==="ArrowFunctionExpression"?`
53
+ const __apm$arguments = [${a}];
54
+ const __apm$ctx = {
55
+ arguments: __apm$arguments,
56
+ moduleVersion: ${JSON.stringify(i)}
57
+ };
58
+ const __apm$traced = () => {
59
+ const __apm$wrapped = () => {};
60
+ return __apm$wrapped(...__apm$arguments);
61
+ };
62
+ `:`
63
+ const __apm$arguments = [${a}].slice(0, arguments.length);
64
+ const __apm$ctx = {
65
+ arguments: __apm$arguments,
66
+ self: this,
67
+ moduleVersion: ${JSON.stringify(i)}
68
+ };
69
+ const __apm$traced = () => {
70
+ const __apm$wrapped = () => {};
71
+ return __apm$wrapped.apply(this, __apm$arguments);
72
+ };
73
+ `).body;return l.body.unshift(...p),uN.query(l,"[id.name=__apm$wrapped]")[0].init=t,l}function PF(e,t){let n=new Set;uN.traverse(t.body,uN.parse("[object.type=Super]"),(r,i)=>{let{name:o}=r.property,s;if(i.callee){let{expression:c}=un(`__apm$super['${o}'].call(this)`).body[0];i.callee=s=c.callee,i.arguments.unshift(...c.arguments)}else i.expression=s=un(`__apm$super['${o}']`).body[0];s.computed=i.callee.computed,s.optional=i.callee.optional,n.add(o)});for(let r of n){let i=un(`
74
+ class Wrapper {
75
+ wrapper () {
76
+ __apm$super['${r}'] = super['${r}']
77
+ }
78
+ }
79
+ `).body[0].body.body[0].value.body.body[0];t.body.body.unshift(i)}n.size>0&&t.body.body.unshift(un("const __apm$super = {}").body[0])}function Gee(e,t,n=""){let r=kF(e,t,n),i=LF(e,t,n),[o,s,c,a,l,p]=r.body[0].body.body,u={type:"IfStatement",test:a.test,consequent:{type:"BlockStatement",body:i.body[0].body.body},alternate:null};return r.body[0].body.body=[o,u,s,c,l,p],r}function kF(e,t,n=""){let{channelName:r,functionQuery:{callbackIndex:i=-1}}=e,o=Ns(r);return un(`
80
+ function wrapper () {
81
+ const __apm$cb = Array.prototype.at.call(__apm$arguments, ${i});
82
+
83
+ if (!${o}.start.hasSubscribers) return __apm$traced();
84
+
85
+ function __apm$wrappedCb(err, res) {
86
+ if (err) {
87
+ __apm$ctx.error = err;
88
+ ${o}.error.publish(__apm$ctx);
89
+ } else {
90
+ __apm$ctx.result = res;
91
+ ${n}
92
+ }
93
+
94
+ ${o}.asyncStart.runStores(__apm$ctx, () => {
95
+ try {
96
+ if (__apm$cb) {
97
+ return __apm$cb.apply(this, arguments);
98
+ }
99
+ } finally {
100
+ ${o}.asyncEnd.publish(__apm$ctx);
101
+ }
102
+ });
103
+ }
104
+
105
+ if (typeof __apm$cb !== 'function') {
106
+ return __apm$traced();
107
+ }
108
+ Array.prototype.splice.call(__apm$arguments, ${i}, 1, __apm$wrappedCb);
109
+
110
+ return ${o}.start.runStores(__apm$ctx, () => {
111
+ try {
112
+ return __apm$traced();
113
+ } catch (err) {
114
+ __apm$ctx.error = err;
115
+ ${o}.error.publish(__apm$ctx);
116
+ throw err;
117
+ } finally {
118
+ __apm$ctx.self ??= this;
119
+ ${o}.end.publish(__apm$ctx);
120
+ }
121
+ });
122
+ }
123
+ `)}function LF(e,t,n=""){let{channelName:r}=e,i=Ns(r);return un(`
124
+ function wrapper () {
125
+ if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
126
+
127
+ return ${i}.start.runStores(__apm$ctx, () => {
128
+ try {
129
+ let promise = __apm$traced();
130
+ if (typeof promise?.then !== 'function') {
131
+ __apm$ctx.result = promise;
132
+ ${n}
133
+ return __apm$ctx.result;
134
+ }
135
+ // Mirror Node.js core diagnostics_channel behaviour: for native Promise
136
+ // instances, chain normally (safe since there is no subclass API to
137
+ // preserve). For Promise subclasses and other thenables, side-chain the
138
+ // callbacks for event publishing and return the original so that any
139
+ // subclass-specific methods (e.g. APIPromise.withResponse()) remain
140
+ // accessible to the caller.
141
+ if (promise instanceof Promise && promise.constructor === Promise) {
142
+ return promise.then(
143
+ result => {
144
+ __apm$ctx.result = result;
145
+ ${n}
146
+ ${i}.asyncStart.publish(__apm$ctx);
147
+ ${i}.asyncEnd.publish(__apm$ctx);
148
+ return __apm$ctx.result;
149
+ },
150
+ err => {
151
+ __apm$ctx.error = err;
152
+ ${i}.error.publish(__apm$ctx);
153
+ ${i}.asyncStart.publish(__apm$ctx);
154
+ ${i}.asyncEnd.publish(__apm$ctx);
155
+ throw err;
156
+ }
157
+ );
158
+ }
159
+ promise.then(
160
+ result => {
161
+ __apm$ctx.result = result;
162
+ ${n}
163
+ ${i}.asyncStart.publish(__apm$ctx);
164
+ ${i}.asyncEnd.publish(__apm$ctx);
165
+ },
166
+ err => {
167
+ __apm$ctx.error = err;
168
+ ${i}.error.publish(__apm$ctx);
169
+ ${i}.asyncStart.publish(__apm$ctx);
170
+ ${i}.asyncEnd.publish(__apm$ctx);
171
+ }
172
+ );
173
+ return promise;
174
+ } catch (err) {
175
+ __apm$ctx.error = err;
176
+ ${i}.error.publish(__apm$ctx);
177
+ throw err;
178
+ } finally {
179
+ __apm$ctx.self ??= this;
180
+ ${i}.end.publish(__apm$ctx);
181
+ }
182
+ });
183
+ }
184
+ `)}function Uee(e,t,n=""){let{channelName:r}=e,i=Ns(r);return un(`
185
+ function wrapper () {
186
+ if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
187
+
188
+ return ${i}.start.runStores(__apm$ctx, () => {
189
+ try {
190
+ __apm$ctx.result = __apm$traced();
191
+ ${n}
192
+ } catch (err) {
193
+ __apm$ctx.error = err;
194
+ ${i}.error.publish(__apm$ctx);
195
+ throw err;
196
+ } finally {
197
+ __apm$ctx.self ??= this;
198
+ ${i}.end.publish(__apm$ctx);
199
+ }
200
+ return __apm$ctx.result;
201
+ });
202
+ }
203
+ `)}function Dee(e,t){let{channelName:n,module:{name:r}}=e,i=Ns(n+":next");if(t.body.some(a=>a.declarations?.[0]?.id?.name===i))return;let o=Ns(n),s=t.body.findIndex(a=>a.declarations?.[0]?.id?.name===o),c=`const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}:next")`;t.body.splice(s+1,0,un(c).body[0])}function Bee(e,t,n){let{channelName:r}=e,i=t==="Iterator"?"traceSync":"tracePromise",o=Ns(r+":next");return Dee(e,n),`
204
+ const __apm$iter = __apm$ctx.result;
205
+ if (__apm$iter != null && typeof __apm$iter.next === 'function') {
206
+ const __apm$patchIter = function (method) {
207
+ const __apm$orig = __apm$iter[method];
208
+ if (typeof __apm$orig !== 'function') return;
209
+ __apm$iter[method] = function () {
210
+ const __apm$iterArgs = Array.prototype.slice.call(arguments);
211
+ if (!tr_ch_apm_hasSubscribers(${o})) return __apm$orig.apply(this, __apm$iterArgs);
212
+ __apm$ctx.method = method;
213
+ __apm$ctx.arguments = __apm$iterArgs;
214
+ return ${o}.${i}(__apm$orig, __apm$ctx, this, ...__apm$iterArgs);
215
+ };
216
+ };
217
+ __apm$patchIter('next');
218
+ __apm$patchIter('throw');
219
+ __apm$patchIter('return');
220
+ }
221
+ `}var MF=pN.exports;var mN={};var UF=e=>{throw TypeError(e)},hN=(e,t,n)=>t.has(e)||UF("Cannot "+n),oi=(e,t,n)=>(hN(e,t,"read from private field"),n?n.call(e):t.get(e)),vs=(e,t,n)=>t.has(e)?UF("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Sc=(e,t,n,r)=>(hN(e,t,"write to private field"),t.set(e,n),n),Ec=(e,t,n)=>(hN(e,t,"access private method"),n),Yp,Jg,jp,Tc,$g,zg,No,DF,BF,HF,gN,FF,wF=ii,{parse:GF}=Kg,{generate:Hee}=OF,Fee=MF,fN,Qg,_N=class{constructor(t,n,r,i,o,s={}){vs(this,No),vs(this,Yp,null),vs(this,Jg,null),vs(this,jp,null),vs(this,Tc,[]),vs(this,$g,null),vs(this,zg,{}),Sc(this,Yp,t),Sc(this,Jg,n),Sc(this,jp,r),Sc(this,Tc,i),Sc(this,$g,o),Sc(this,zg,s)}free(){}get moduleName(){return oi(this,Yp)}get filePath(){return oi(this,jp)}transform(t,n,r){if(Buffer.isBuffer(t)&&(t=t.toString()),!t)return{code:t};let i,o={},s=0;for(let c of oi(this,Tc)){let{astQuery:a,functionQuery:l={}}=c;if(!i){let m={loc:!0,ranges:!0,raw:!0,module:n==="esm"};try{i=GF(t,m)}catch{i=GF(t,{...m,module:!m.module})}n==="esm"&&(o=Ec(this,No,HF).call(this,i))}let p=Ec(this,No,gN).call(this,l,o),u=a||Ec(this,No,FF).call(this,p),d={...c,dcModule:oi(this,$g),moduleType:n,moduleVersion:oi(this,Jg),functionQuery:p};d.operator=Ec(this,No,BF).call(this,d),wF.traverse(i,wF.parse(u),(...m)=>{s++,Ec(this,No,DF).call(this,d,...m)})}if(s===0&&oi(this,Tc).length>0){let c=oi(this,Tc).map(({astQuery:a,functionQuery:l={}})=>{if(a)return a;let p=Ec(this,No,gN).call(this,l,o),d=(h=>h.methodName||h.privateMethodName||h.functionName||h.expressionName||"constructor")(l),m=l.className||l.functionName||l.expressionName,_=p.className||p.functionName||p.expressionName;return m&&m!==_?`${m} (local name: ${_})`:d});throw new Error(`Failed to find injection points for: ${JSON.stringify(c)}`)}if(i){fN??(fN=mN.SourceMapConsumer),Qg??(Qg=mN.SourceMapGenerator);let c=`${oi(this,Yp)}/${oi(this,jp)}`,a;if(r){let u=new fN(r);u.file=c,a=Qg.fromSourceMap(u)}else a=new Qg({file:c});let l=Hee(i,{sourceMap:a}),p=a.toString();return{code:l,map:p}}return{code:t}}};Yp=new WeakMap;Jg=new WeakMap;jp=new WeakMap;Tc=new WeakMap;$g=new WeakMap;zg=new WeakMap;No=new WeakSet;DF=function(e,...t){let n=oi(this,zg)[e.operator]??Fee[e.operator],{index:r=0}=e.functionQuery,[i]=t,o=i.init?.type||i.type;o!=="ClassDeclaration"&&o!=="ClassExpression"&&(i.type==="VariableDeclarator"||(e.functionIndex=++e.functionIndex||0,r!==null&&r!==e.functionIndex))||n(e,...t)};BF=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"}};HF=function(e){let t={};for(let n of e.body)if(n.type==="ExportNamedDeclaration"&&!n.source){for(let r of n.specifiers)if(r.exported&&r.local){let i=r.exported.name??r.exported.value,o=r.local.name??r.local.value;i&&o&&(t[i]=o)}}return t};gN=function(e,t){if(!e.isExportAlias)return e;let{functionName:n,expressionName:r,className:i}=e;return n&&t[n]?{...e,functionName:t[n]}:r&&t[r]?{...e,expressionName:t[r]}:i&&t[i]?{...e,className:t[i]}:e};FF=function(e){let{functionName:t,expressionName:n,className:r,objectName:i,propertyName:o}=e,s=e.privateMethodName?"PrivateIdentifier":"Identifier",c=[],a=e.methodName||e.privateMethodName;if(r?(a??(a="constructor"),c.push(`[id.name="${r}"]`,`[id.name="${r}"] > ClassExpression`,`[id.name="${r}"] > ClassBody > [key.name="${a}"][key.type=${s}] > [async]`,`[id.name="${r}"] > ClassExpression > ClassBody > [key.name="${a}"][key.type=${s}] > [async]`)):a&&c.push(`ClassBody > [key.name="${a}"][key.type=${s}] > [async]`,`Property[key.name="${a}"][key.type=${s}] > [async]`),t?c.push(`FunctionDeclaration[id.name="${t}"][async]`):n&&c.push(`FunctionExpression[id.name="${n}"][async]`,`ArrowFunctionExpression[id.name="${n}"][async]`,`VariableDeclarator[id.name="${n}"] > FunctionExpression[async]`,`VariableDeclarator[id.name="${n}"] > ArrowFunctionExpression[async]`,`AssignmentExpression[left.property.name="${n}"] > FunctionExpression[async]`,`AssignmentExpression[left.property.name="${n}"] > ArrowFunctionExpression[async]`,`AssignmentExpression[left.name="${n}"] > FunctionExpression[async]`,`AssignmentExpression[left.name="${n}"] > ArrowFunctionExpression[async]`),i||o){if(!i||!o)throw new Error(`functionQuery: 'objectName' and 'propertyName' must be used together (got objectName=${i}, propertyName=${o})`);let l=i==="this"?"left.object.type=ThisExpression":`left.object.name="${i}"`;c.push(`AssignmentExpression[${l}][left.property.name="${o}"] > [async]`)}return c.join(", ")};var WF={Transformer:_N};var VF=e=>{throw TypeError(e)},YF=(e,t,n)=>t.has(e)||VF("Cannot "+n),vo=(e,t,n)=>(YF(e,t,"read from private field"),n?n.call(e):t.get(e)),e_=(e,t,n)=>t.has(e)?VF("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),bN=(e,t,n,r)=>(YF(e,t,"write to private field"),t.set(e,n),n),t_,n_,Rs,r_,Wee=hF,{Transformer:Vee}=WF,yN=class{constructor(t,n){e_(this,t_,[]),e_(this,n_,null),e_(this,Rs,{}),e_(this,r_,{}),bN(this,t_,t),bN(this,n_,n||"diagnostics_channel")}free(){bN(this,Rs,{})}addTransform(t,n){vo(this,r_)[t]=n}getTransformer(t,n,r){r=r.replace(/\\/g,"/");let i=`${t}/${r}@${n}`;if(vo(this,Rs)[i])return vo(this,Rs)[i];let o=vo(this,t_).filter(({module:s})=>s.name===t&&(typeof s.filePath=="string"?s.filePath===r:s.filePath.test(r))&&Wee(n,s.versionRange));if(o.length!==0)return vo(this,Rs)[i]=new Vee(t,n,r,o,vo(this,n_),vo(this,r_)),vo(this,Rs)[i]}};t_=new WeakMap;n_=new WeakMap;Rs=new WeakMap;r_=new WeakMap;var jF={InstrumentationMatcher:yN};var{InstrumentationMatcher:Yee}=jF;function jee(e,t){return new Yee(e,t)}var ZF={create:jee};var i_=ZF;import dte from"module";import Zee from"path";var SN=Zee.sep,EN=function(e){var t=e.split(SN),n=t.lastIndexOf("node_modules");if(n!==-1&&t[n+1]){for(var r=t[n+1][0]==="@",i=r?t[n+1]+"/"+t[n+2]:t[n+1],o=r?3:2,s="",c=n+o-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+SN;for(var l="",p=t.length-1,u=n+o;u<=p;u++)u===p?l+=t[u]:l+=t[u]+SN;return{name:i,basedir:s,path:l}}},XF=Io(EN);import mte from"url";import Xee from"fs";import Kee from"path";var{readFileSync:qee}=Xee,{join:Qee}=Kee,TN=new Map;function Jee(e){if(TN.has(e))return TN.get(e);try{let t=Qee(e,"package.json"),n=qee(t),{version:r}=JSON.parse(n);return TN.set(e,r),r}catch{return process.version.slice(1)}}var IN=Jee,KF=Io(IN);var AN;function $ee(e){AN=e}function zee(e){AN&&AN(e)}var Gi={setDiagnosticsHook:$ee,emitDiagnostics:zee};var o_={exports:{}};import pte from"tty";import ute from"util";import ete from"os";import tte from"tty";var qF=(e,t=process.argv)=>{let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),i=t.indexOf("--");return r!==-1&&(i===-1||r<i)};var nte=ete,QF=tte,Kn=qF,{env:xt}=process,Ro;Kn("no-color")||Kn("no-colors")||Kn("color=false")||Kn("color=never")?Ro=0:(Kn("color")||Kn("colors")||Kn("color=true")||Kn("color=always"))&&(Ro=1);"FORCE_COLOR"in xt&&(xt.FORCE_COLOR==="true"?Ro=1:xt.FORCE_COLOR==="false"?Ro=0:Ro=xt.FORCE_COLOR.length===0?1:Math.min(parseInt(xt.FORCE_COLOR,10),3));function NN(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function vN(e,t){if(Ro===0)return 0;if(Kn("color=16m")||Kn("color=full")||Kn("color=truecolor"))return 3;if(Kn("color=256"))return 2;if(e&&!t&&Ro===void 0)return 0;let n=Ro||0;if(xt.TERM==="dumb")return n;if(process.platform==="win32"){let r=nte.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in xt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in xt)||xt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in xt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(xt.TEAMCITY_VERSION)?1:0;if(xt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in xt){let r=parseInt((xt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(xt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(xt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(xt.TERM)||"COLORTERM"in xt?1:n}function rte(e){let t=vN(e,e&&e.isTTY);return NN(t)}var JF={supportsColor:rte,stdout:NN(vN(!0,QF.isatty(1))),stderr:NN(vN(!0,QF.isatty(2)))};var Ic=1e3,Ac=Ic*60,Nc=Ac*60,Os=Nc*24,ite=Os*7,ote=Os*365.25,$F=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return ste(e);if(n==="number"&&isFinite(e))return t.long?cte(e):ate(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ste(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*ote;case"weeks":case"week":case"w":return n*ite;case"days":case"day":case"d":return n*Os;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Nc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ac;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ic;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function ate(e){var t=Math.abs(e);return t>=Os?Math.round(e/Os)+"d":t>=Nc?Math.round(e/Nc)+"h":t>=Ac?Math.round(e/Ac)+"m":t>=Ic?Math.round(e/Ic)+"s":e+"ms"}function cte(e){var t=Math.abs(e);return t>=Os?s_(e,t,Os,"day"):t>=Nc?s_(e,t,Nc,"hour"):t>=Ac?s_(e,t,Ac,"minute"):t>=Ic?s_(e,t,Ic,"second"):e+" ms"}function s_(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+" "+r+(i?"s":"")}function lte(e){n.debug=n,n.default=n,n.coerce=a,n.disable=s,n.enable=i,n.enabled=c,n.humanize=$F,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 R=h,M=Number(new Date),v=M-(u||M);R.diff=v,R.prev=u,R.curr=M,u=M,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let N=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(D,I)=>{if(D==="%%")return"%";N++;let F=n.formatters[I];if(typeof F=="function"){let L=b[N];D=F.call(R,L),b.splice(N,1),N--}return D}),n.formatArgs.call(R,b),(R.log||n.log).apply(R,b)}return h.namespace=p,h.useColors=n.useColors(),h.color=n.selectColor(p),h.extend=r,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==n.namespaces&&(m=n.namespaces,_=n.enabled(p)),_),set:b=>{d=b}}),typeof n.init=="function"&&n.init(h),h}function r(p,u){let d=n(this.namespace+(typeof u>"u"?":":u)+p);return d.log=this.log,d}function i(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let u=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of u)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function o(p,u){let d=0,m=0,_=-1,h=0;for(;d<p.length;)if(m<u.length&&(u[m]===p[d]||u[m]==="*"))u[m]==="*"?(_=m,h=d,m++):(d++,m++);else if(_!==-1)m=_+1,h++,d=h;else return!1;for(;m<u.length&&u[m]==="*";)m++;return m===u.length}function s(){let p=[...n.names,...n.skips.map(u=>"-"+u)].join(",");return n.enable(""),p}function c(p){for(let u of n.skips)if(o(p,u))return!1;for(let u of n.names)if(o(p,u))return!0;return!1}function a(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var zF=lte;(function(e,t){let n=pte,r=ute;t.init=p,t.log=c,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,t.destroy=r.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let d=JF;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,R)=>R.toUpperCase()),h=process.env[m];return/^(yes|on|true|enabled)$/i.test(h)?h=!0:/^(no|off|false|disabled)$/i.test(h)?h=!1:h==="null"?h=null:h=Number(h),d[_]=h,d},{});function i(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:n.isatty(process.stderr.fd)}function o(d){let{namespace:m,useColors:_}=this;if(_){let h=this.color,b="\x1B[3"+(h<8?h:"8;5;"+h),R=` ${b};1m${m} \x1B[0m`;d[0]=R+d[0].split(`
222
+ `).join(`
223
+ `+R),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=zF(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)}})(o_,o_.exports);var RN=o_.exports,e2=Io(RN);import fte from"os";import gte from"path";import _te from"fs";var{create:hte}=i_,ON=dte,bte=EN,{pathToFileURL:t2}=mte,yte=IN,{emitDiagnostics:n2}=Gi,a_=RN("@apm-js-collab/tracing-hooks:module-patch"),CN=class{constructor({instrumentations:t=[]}={}){this.packages=new Set(t.map(n=>n.module.name)),this.instrumentator=hte(t),this.compile=ON.prototype._compile}patch(){let t=this;ON.prototype._compile=function(...r){let[i,o]=r,s=bte(o);if(s&&t.packages.has(s.name)){a_("found resolved module, checking if there is a transformer %s",o);let c=yte(s.basedir,s.name),a=t.instrumentator.getTransformer(s.name,c,s.path);if(a){a_("transforming file %s",o);try{let l=a.transform(i,"cjs");r[0]=l?.code,n2({url:t2(o).href,moduleName:a.moduleName}),process.env.TRACING_DUMP&&Ste(r[0],o)}catch(l){a_("Error transforming module %s: %o",o,l),n2({url:t2(o).href,moduleName:a.moduleName,error:l})}finally{a.free()}}}return t.compile.apply(this,r)}}unpatch(){ON.prototype._compile=this.compile}};function Ste(e,t){let n=fte,r=gte,i=_te,o=process.env.TRACING_DUMP_DIR??n.tmpdir(),s=r.dirname(t),c=r.basename(t),a=r.join(o,s),l=r.join(a,c);a_("Dumping patched code to: %s",l),i.mkdirSync(a,{recursive:!0}),i.writeFileSync(l,e)}var Ete=CN,r2=Io(Ete);import{fileURLToPath as Tte}from"url";import{MessageChannel as Ite}from"worker_threads";import{readFileSync as Ate}from"fs";var i2=e2("@apm-js-collab/tracing-hooks:esm-hook"),c_=null,o2=null,s2=null,xN=Gi.emitDiagnostics;function a2(){let{port1:e,port2:t}=new Ite;return e.on("message",Gi.emitDiagnostics),e.unref(),t}function c2(e={}){let t=e?.instrumentations||[];s2=i_.create(t),o2=new Set(t.map(n=>n.module.name)),c_=new Map,xN=e?.diagnosticsPort?Nte(e.diagnosticsPort):Gi.emitDiagnostics}function Nte(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){i2("failed to post diagnostics for %s: %o",t.url,n)}}}function vte(e){let t=XF(e.url);if(t&&o2.has(t.name)){let n=Tte(t.basedir),r=KF(n),i=s2.getTransformer(t.name,r,t.path);i&&c_.set(e.url,i)}return e}function l2(e,t,n){return vte(n(e,t))}function p2(e,t,n){let r=n(e,t);if(c_.has(e)===!1)return r;if(r.format==="commonjs"){let i=new URL(r.responseURL??e);r.source??=Ate(i)}return Rte(e,r)}function Rte(e,t){let n=t.source;if(n){let r=c_.get(e);try{let i=t.format==="module"?"esm":t.format==="commonjs"?"cjs":"unknown",o=typeof n=="string"?n:Buffer.from(n).toString("utf8"),s=r.transform(o,i);t.source=s?.code,t.shortCircuit=!0,xN({url:e,moduleName:r.moduleName})}catch(i){i2("Error transforming module %s: %o",e,i),xN({url:e,moduleName:r.moduleName,error:i})}finally{r.free()}}return t}var qWe=Gi.setDiagnosticsHook;function Pte(e){if(e){let{major:r=0,minor:i=0}=Gs(e);return r>2||r===2&&i>=8}let{major:t=0,minor:n=0}=Gs(process.versions.node??"0.0.0");return t>25||t===25&&n>=1||t===24&&n>=13}function u2(e){if(!Cte&&!xte||te?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=Pte(t.Deno?.version?.deno),r=Ote;Gi.setDiagnosticsHook(({moduleName:i,error:o})=>{o?g.warn(`[orchestrion] failed to inject diagnostics-channel into ${i}:`,o):(te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[],te.__SENTRY_ORCHESTRION__.runtime.push(i))});try{if(typeof r.registerHooks=="function"&&n)c2({instrumentations:Wp}),r.registerHooks({resolve:l2,load:p2}),g.log("Registered diagnostics-channel injection via Module.registerHooks()");else if(typeof r.register=="function"&&!t.Bun&&!t.Deno){let i=a2(),o;o=import.meta.url,r.register("@sentry/server-utils/orchestrion/hook",{parentURL:o,data:{instrumentations:Wp,diagnosticsPort:i},transferList:[i]}),new r2({instrumentations:Wp}).patch(),g.log("Registered diagnostics-channel injection via Module.register()")}else{g.warn("No available Node API to register diagnostics-channel injection hooks; skipping.");return}}catch(i){g.warn("Failed to register diagnostics-channel injection hooks; channel-based integrations will not record spans.",i);return}te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[]}function kte(){return SA}function Lte(e){uw(()=>{let t=Object.values(SA).map(r=>r()),n=t.map(r=>r.name);return{integrations:[...t,WI({responseHook:bs}),yA({responseHook:bs})],replacedOtelIntegrationNames:n,register:()=>u2(),detect:gA}})}export{zt as NODE_VERSION,qa as NodeClient,zA as OpenFeatureIntegrationHook,q as SDK_VERSION,H as SEMANTIC_ATTRIBUTE_SENTRY_OP,S as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,Dn as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,ve as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,jt as Scope,ep as SentryContextManager,eE as _INTERNAL_normalizeCollectionInterval,rn as addBreadcrumb,qh as addEventProcessor,tb as addIntegration,HA as amqplibIntegration,qL as anrIntegration,ZA as anthropicAIIntegration,See as applyDiagnosticsChannelInjectionIntegrations,gn as bindScopeToEmitter,eee as buildLaunchDarklyFlagUsedHandler,zc as captureCheckIn,Nb as captureConsoleIntegration,Jc as captureEvent,me as captureException,Hb as captureFeedback,Qc as captureMessage,Qh as captureSession,bm as childProcessIntegration,Xh as close,WT as connectIntegration,xm as consoleIntegration,Fb as consoleLoggingIntegration,Sm as contextLinesIntegration,In as continueTrace,Vb as createConsolaReporter,wm as createGetModuleFromFilename,dr as createLangChainCallbackHandler,nM as createSentryWinstonTransport,pa as createTransport,uM as cron,C8 as dataloaderIntegration,vb as dedupeIntegration,Um as defaultStackParser,kte as diagnosticsChannelInjectionIntegrations,QL as disableAnrDetectionForCallback,Ko as endSession,ju as eventFiltersIntegration,Lte as experimentalUseDiagnosticsChannelInjection,xy as expressErrorHandler,cE as expressIntegration,Rb as extraErrorDataIntegration,WE as fastifyIntegration,Gb as featureFlagsIntegration,tN as firebaseIntegration,Zo as flush,L9 as fsIntegration,sl as functionToStringIntegration,de as generateInstrumentOnce,NA as genericPoolIntegration,Q as getActiveSpan,nN as getAutoPerformanceIntegrations,C as getClient,ne as getCurrentScope,fF as getDefaultIntegrations,mF as getDefaultIntegrationsWithoutPerformance,Uo as getGlobalScope,J as getIsolationScope,Re as getRootSpan,Gm as getSentryRelease,Uc as getSpanDescendants,Zt as getSpanStatusFromHttpCode,$e as getTraceData,bb as getTraceMetaTags,KA as googleGenAIIntegration,qE as graphqlIntegration,iee as growthbookIntegration,wT as hapiIntegration,UT as honoIntegration,Fr as httpHeadersToSpanAttributes,rE as httpIntegration,wa as httpServerIntegration,Ga as httpServerSpansIntegration,al as inboundFiltersIntegration,Eee as init,iN as initOpenTelemetry,Tee as initWithoutDefaultIntegrations,Ed as instrumentAnthropicAiClient,Ad as instrumentGoogleGenAIClient,Rd as instrumentLangChainEmbeddings,tx as instrumentLangGraph,hd as instrumentOpenAiClient,Cl as instrumentStateGraph,py as instrumentStateGraphCompile,qu as instrumentSupabaseClient,nc as isDiagnosticsChannelInjectionEnabled,Xo as isEnabled,Kh as isInitialized,nT as kafkaIntegration,y8 as knexIntegration,HT as koaIntegration,QA as langChainIntegration,$A as langGraphIntegration,Zh as lastEventId,z8 as launchDarklyIntegration,cl as linkedErrorsIntegration,Am as localVariablesIntegration,$S as logger,iT as lruMemoizerIntegration,Mm as makeNodeTransport,dt as metrics,Nm as modulesIntegration,aT as mongoIntegration,lT as mongooseIntegration,gT as mysql2Integration,uT as mysqlIntegration,iE as nativeNodeFetchIntegration,ym as nodeContextIntegration,eM as nodeRuntimeMetricsIntegration,vm as onUncaughtExceptionIntegration,Rm as onUnhandledRejectionIntegration,YA as openAIIntegration,tee as openFeatureIntegration,Fu as parameterize,sM as pinoIntegration,CT as postgresIntegration,LT as postgresJsIntegration,gee as preloadOpenTelemetry,nf as prismaIntegration,Om as processSessionIntegration,Bb as profiler,IT as redisIntegration,ll as requestDataIntegration,kb as rewriteFramesIntegration,Yh as setAttribute,Vh as setAttributes,Dh as setContext,L0 as setConversationId,ub as setCurrentClient,Hh as setExtra,Bh as setExtras,Fs as setHttpStatus,gh as setMeasurement,HS as setNodeAsyncContextStrategy,Wh as setTag,Fh as setTags,jh as setUser,IJ as setupConnectErrorHandler,w9 as setupExpressErrorHandler,Q4 as setupFastifyErrorHandler,aJ as setupHapiErrorHandler,gJ as setupHonoErrorHandler,bJ as setupKoaErrorHandler,xl as spanStreamingIntegration,ch as spanToBaggageHeader,oe as spanToJSON,wc as spanToTraceHeader,Cm as spotlightIntegration,k as startInactiveSpan,An as startNewTrace,$c as startSession,Se as startSpan,ke as startSpanManual,nee as statsigIntegration,Lb as supabaseIntegration,Bn as suppressTracing,Pm as systemErrorIntegration,TA as tediousIntegration,dy as trpcMiddleware,ree as unleashIntegration,oh as updateSpanName,Bm as validateOpenTelemetrySetup,WA as vercelAIIntegration,yO as winterCGHeadersToDict,se as withActiveSpan,tr as withIsolationScope,Br as withMonitor,Be as withScope,lh as withStreamedSpan,vy as wrapMcpServerWithSentry,Mb as zodErrorsIntegration};